Skip to content

Commit

Permalink
Built artefacts
Browse files Browse the repository at this point in the history
  • Loading branch information
longhotsummer committed May 5, 2023
1 parent de4bab8 commit 0f8d0b3
Show file tree
Hide file tree
Showing 28 changed files with 209 additions and 195 deletions.
70 changes: 37 additions & 33 deletions core/dist/cjs/la-table-of-contents.cjs.entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,25 @@ const TableOfContents = class {
* JSON value or string value parsed to array of items used to build the table of contents. Each item must have
* a `title` attribute (which may be `null`), and a `children` attribute (which may be `null`).
*
* Items may optionally have an id attribute and a url attribute, which are used to build the links for each item.
* Items may optionally have an id attribute and an href attribute, which are used to build the links for each item.
* */
this.items = [];
/**
* value to filter items by item title
* */
this.titleFilter = '';
/** Should the table of contents be expanded when first created? */
/**
* Should items be expanded by default? This can be overridden by setting the expanded property for individual items.
* */
this.expanded = true;
/** Fetch content from Laws.Africa services? Requires a Laws.Africa partnership and the frbrExpressionUri property to be set. */
this.fetch = false;
/** Provider URL for fetching content (advanced usage only). */
this.provider = services.PROVIDER;
this.filteredItems = null;
this.innerItems = [];
this.expandIconHtml = '';
this.collapseIconHtml = '';
}
parseItemsProp(newValue) {
if (typeof newValue === 'string') {
Expand Down Expand Up @@ -63,20 +67,29 @@ const TableOfContents = class {
this.partner = services.getPartner();
}
}
getSlotHTML(selector) {
var _a;
const element = this.el.querySelector(selector);
/**
* If slots originate from `la-table-of-contents`, query for slot html is
* `this.el.querySelector("[slot]").innerHTML`
* If slot originate from `la-table-of-contents-controller` query for slot html is
* `this.el.querySelector("[slot] [slot]").innerHTML`
* */
// Slots originating from la-table-of-content-controller
if (element === null || element === void 0 ? void 0 : element.querySelector(selector)) {
return ((_a = element.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.innerHTML) || '';
}
// Slots originating from la-table-of-content
return (element === null || element === void 0 ? void 0 : element.innerHTML) || '';
}
componentWillLoad() {
this.expandIconHtml = this.getSlotHTML("[slot='expand-icon']");
this.collapseIconHtml = this.getSlotHTML("[slot='collapse-icon']");
this.parseItemsProp(this.items);
this.titleFilterChanged(this.titleFilter);
this.fetchContent();
}
componentDidLoad() {
// expand or collapse when first loaded
if (this.expanded) {
this.expandAll();
}
else {
this.collapseAll();
}
}
/**
* Expands all items
*/
Expand Down Expand Up @@ -141,29 +154,20 @@ const TableOfContents = class {
}
this.expandAll();
}
/**
* Render items recursively. We render from the bottom up, allowing us to append children into their
* parents. Rendering recursively here rather than inside la-toc-item means we can make use of global
* configuration details without having to pass them down the tree.
*/
renderItem(item) {
// render the children first, so we can add them to the parent
const kids = (item.children || []).map((child) => this.renderItem(child));
// if the item has an explicit expanded value, use that, otherwise use the tree's default value
const expanded = item.expanded === undefined ? this.expanded : item.expanded;
return index.h("la-toc-item", { item: item, filteredItems: this.filteredItems, expandIconHtml: this.expandIconHtml, collapseIconHtml: this.collapseIconHtml, expanded: expanded }, kids);
}
render() {
const renderTOCItem = (item) => {
const getSlotHTML = (selector) => {
var _a;
const element = this.el.querySelector(selector);
/**
* If slots originate from `la-table-of-contents`, query for slot html is
* `this.el.querySelector("[slot]").innerHTML`
* If slot originate from `la-table-of-contents-controller` query for slot html is
* `this.el.querySelector("[slot] [slot]").innerHTML`
* */
// Slots originating from la-table-of-content-controller
if (element === null || element === void 0 ? void 0 : element.querySelector(selector)) {
return ((_a = element.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.innerHTML) || '';
}
// Slots originating from la-table-of-content
return (element === null || element === void 0 ? void 0 : element.innerHTML) || '';
};
const expandIcon = getSlotHTML("[slot='expand-icon']");
const collapseIcon = getSlotHTML("[slot='collapse-icon']");
return (index.h("la-toc-item", { item: item, filteredItems: this.filteredItems, expandIconHtml: expandIcon, collapseIconHtml: collapseIcon, expanded: false }));
};
return (index.h(index.Host, null, index.h("div", { style: { display: 'none' } }, index.h("slot", { name: "expand-icon" }), index.h("slot", { name: "collapse-icon" })), index.h("div", { class: "toc-items" }, this.innerItems.map((item) => renderTOCItem(item)))));
return (index.h(index.Host, null, index.h("div", { style: { display: 'none' } }, index.h("slot", { name: "expand-icon" }), index.h("slot", { name: "collapse-icon" })), this.innerItems.map((item) => this.renderItem(item))));
}
get el() { return index.getElement(this); }
static get watchers() { return {
Expand Down
8 changes: 3 additions & 5 deletions core/dist/cjs/la-toc-item.cjs.entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,17 @@ const TocItem = class {
this.itemRendered.emit();
}
render() {
var _a, _b;
var _a;
const isParent = !!((_a = this.item.children) === null || _a === void 0 ? void 0 : _a.length);
const showItem = !this.filteredItems || this.filteredItems.has(this.item);
const url = this.item.url || `#${this.item.id || ''}`;
const href = this.item.href || `#${this.item.id || ''}`;
const renderToggleBtnInner = () => {
if (this.expanded) {
return this.collapseIconHtml ? index.h("span", { innerHTML: this.collapseIconHtml }) : index.h("span", null, "\u25BC");
}
return this.expandIconHtml ? index.h("span", { innerHTML: this.expandIconHtml }) : index.h("span", null, "\u25BA");
};
return (index.h(index.Host, Object.assign({}, (isParent ? { parent: isParent } : {}), { class: `${!showItem ? 'excluded' : ''}` }), index.h("div", { class: "indented" }, isParent ? (index.h("div", { class: "indented__toggle-btn", role: "button", onClick: () => this.toggle() }, renderToggleBtnInner())) : null), index.h("div", { class: "content" }, index.h("div", { class: "content__action" }, this.prependHtml ? index.h("div", { class: "content__action__prepend", innerHTML: this.prependHtml }) : null, index.h("a", { href: url, class: "content__action__title", onClick: this.onItemTitleClick }, this.item.title), this.appendHtml ? index.h("div", { class: "content__action__append", innerHTML: this.appendHtml }) : null), index.h("div", { class: "content__children" }, ((_b = this.item.children) === null || _b === void 0 ? void 0 : _b.length)
? this.item.children.map((item) => (index.h("la-toc-item", { item: item, filteredItems: this.filteredItems, expandIconHtml: this.expandIconHtml, collapseIconHtml: this.collapseIconHtml })))
: null))));
return (index.h(index.Host, Object.assign({}, (isParent ? { parent: isParent } : {}), { class: `${!showItem ? 'excluded' : ''}` }), index.h("div", { class: "indented" }, isParent ? (index.h("div", { class: "indented__toggle-btn", role: "button", onClick: () => this.toggle() }, renderToggleBtnInner())) : null), index.h("div", { class: "content" }, index.h("div", { class: "content__action" }, this.prependHtml ? index.h("div", { class: "content__action__prepend", innerHTML: this.prependHtml }) : null, index.h("a", { href: href, class: "content__action__title", onClick: this.onItemTitleClick }, this.item.title), this.appendHtml ? index.h("div", { class: "content__action__append", innerHTML: this.appendHtml }) : null), index.h("div", { class: "content__children" }, index.h("slot", null)))));
}
};
TocItem.style = tocItemCss;
Expand Down
2 changes: 1 addition & 1 deletion core/dist/cjs/lawwidgets.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ const patchDynamicImport = (base, orgScriptElm) => {
};

patchBrowser().then(options => {
return index.bootstrapLazy([["la-table-of-contents-controller.cjs",[[4,"la-table-of-contents-controller",{"items":[1],"titleFilterPlaceholder":[1,"title-filter-placeholder"],"hideClearTitleFilterButton":[4,"hide-clear-title-filter-button"],"titleFilterClearBtnClasses":[1,"title-filter-clear-btn-classes"],"expandAllBtnClasses":[1,"expand-all-btn-classes"],"collapseAllBtnClasses":[1,"collapse-all-btn-classes"],"expandAllBtnText":[1,"expand-all-btn-text"],"collapseAllBtnText":[1,"collapse-all-btn-text"],"expanded":[4],"titleFilterInputClasses":[1,"title-filter-input-classes"],"frbrExpressionUri":[1537,"frbr-expression-uri"],"fetch":[1540],"partner":[1537],"provider":[1],"titleFilter":[32]}]]],["la-akoma-ntoso.cjs",[[0,"la-akoma-ntoso",{"frbrExpressionUri":[1537,"frbr-expression-uri"],"frbrCountry":[1537,"frbr-country"],"frbrType":[1537,"frbr-type"],"frbrSubtype":[1537,"frbr-subtype"],"frbrAuthor":[1537,"frbr-author"],"frbrDate":[1537,"frbr-date"],"frbrNumber":[1537,"frbr-number"],"frbrExpressionDate":[1537,"frbr-expression-date"],"frbrLanguage":[1537,"frbr-language"],"fetch":[1540],"partner":[1537],"provider":[1]}]]],["la-decorate-external-refs.cjs",[[0,"la-decorate-external-refs",{"akomaNtoso":[1,"akoma-ntoso"],"popups":[4],"partner":[1],"provider":[1]}]]],["la-decorate-internal-refs.cjs",[[0,"la-decorate-internal-refs",{"akomaNtoso":[1,"akoma-ntoso"],"popups":[4],"flag":[4],"fetch":[1540],"partner":[1537],"provider":[1]}]]],["la-decorate-terms.cjs",[[0,"la-decorate-terms",{"akomaNtoso":[1,"akoma-ntoso"],"popupDefinitions":[4,"popup-definitions"],"linkTerms":[4,"link-terms"]}]]],["la-gutter.cjs",[[0,"la-gutter",{"akomaNtoso":[1,"akoma-ntoso"],"layoutItems":[64],"activateNextItem":[64],"activatePrevItem":[64]},[[0,"laItemChanged","itemChanged"],[0,"click","clicked"]]]]],["la-gutter-item.cjs",[[0,"la-gutter-item",{"anchor":[1],"active":[1540]},[[0,"click","onClick"]]]]],["la-toc-item.cjs",[[0,"la-toc-item",{"item":[16],"filteredItems":[16],"prependHtml":[1,"prepend-html"],"appendHtml":[1,"append-html"],"expandIconHtml":[1,"expand-icon-html"],"collapseIconHtml":[1,"collapse-icon-html"],"expanded":[1540]}]]],["la-table-of-contents.cjs",[[4,"la-table-of-contents",{"items":[1],"titleFilter":[1,"title-filter"],"expanded":[4],"frbrExpressionUri":[1537,"frbr-expression-uri"],"fetch":[1540],"partner":[1537],"provider":[1],"filteredItems":[32],"innerItems":[32],"expandAll":[64],"collapseAll":[64]}]]]], options);
return index.bootstrapLazy([["la-table-of-contents-controller.cjs",[[4,"la-table-of-contents-controller",{"items":[1],"titleFilterPlaceholder":[1,"title-filter-placeholder"],"hideClearTitleFilterButton":[4,"hide-clear-title-filter-button"],"titleFilterClearBtnClasses":[1,"title-filter-clear-btn-classes"],"expandAllBtnClasses":[1,"expand-all-btn-classes"],"collapseAllBtnClasses":[1,"collapse-all-btn-classes"],"expandAllBtnText":[1,"expand-all-btn-text"],"collapseAllBtnText":[1,"collapse-all-btn-text"],"expanded":[4],"titleFilterInputClasses":[1,"title-filter-input-classes"],"frbrExpressionUri":[1537,"frbr-expression-uri"],"fetch":[1540],"partner":[1537],"provider":[1],"titleFilter":[32]}]]],["la-akoma-ntoso.cjs",[[0,"la-akoma-ntoso",{"frbrExpressionUri":[1537,"frbr-expression-uri"],"frbrCountry":[1537,"frbr-country"],"frbrType":[1537,"frbr-type"],"frbrSubtype":[1537,"frbr-subtype"],"frbrAuthor":[1537,"frbr-author"],"frbrDate":[1537,"frbr-date"],"frbrNumber":[1537,"frbr-number"],"frbrExpressionDate":[1537,"frbr-expression-date"],"frbrLanguage":[1537,"frbr-language"],"fetch":[1540],"partner":[1537],"provider":[1]}]]],["la-decorate-external-refs.cjs",[[0,"la-decorate-external-refs",{"akomaNtoso":[1,"akoma-ntoso"],"popups":[4],"partner":[1],"provider":[1]}]]],["la-decorate-internal-refs.cjs",[[0,"la-decorate-internal-refs",{"akomaNtoso":[1,"akoma-ntoso"],"popups":[4],"flag":[4],"fetch":[1540],"partner":[1537],"provider":[1]}]]],["la-decorate-terms.cjs",[[0,"la-decorate-terms",{"akomaNtoso":[1,"akoma-ntoso"],"popupDefinitions":[4,"popup-definitions"],"linkTerms":[4,"link-terms"]}]]],["la-gutter.cjs",[[0,"la-gutter",{"akomaNtoso":[1,"akoma-ntoso"],"layoutItems":[64],"activateNextItem":[64],"activatePrevItem":[64]},[[0,"laItemChanged","itemChanged"],[0,"click","clicked"]]]]],["la-gutter-item.cjs",[[0,"la-gutter-item",{"anchor":[1],"active":[1540]},[[0,"click","onClick"]]]]],["la-toc-item.cjs",[[4,"la-toc-item",{"item":[16],"filteredItems":[16],"prependHtml":[1,"prepend-html"],"appendHtml":[1,"append-html"],"expandIconHtml":[1,"expand-icon-html"],"collapseIconHtml":[1,"collapse-icon-html"],"expanded":[1540]}]]],["la-table-of-contents.cjs",[[4,"la-table-of-contents",{"items":[1],"titleFilter":[1,"title-filter"],"expanded":[4],"frbrExpressionUri":[1537,"frbr-expression-uri"],"fetch":[1540],"partner":[1537],"provider":[1],"filteredItems":[32],"innerItems":[32],"expandAll":[64],"collapseAll":[64]}]]]], options);
});
2 changes: 1 addition & 1 deletion core/dist/cjs/loader.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0f8d0b3

Please sign in to comment.