@fluid-topics/ft-reader-toc 0.3.16 → 0.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/ft-reader-toc.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare class FtReaderToc extends FtReaderComponent implements FtReaderTo
|
|
|
12
12
|
expandIcon: string;
|
|
13
13
|
autoCollapse: boolean;
|
|
14
14
|
scope: FtReaderTocProperties["scope"];
|
|
15
|
+
hideIfEmpty: boolean;
|
|
15
16
|
empty: boolean;
|
|
16
17
|
labels: FtReaderTocLabels;
|
|
17
18
|
private labelResolver;
|
package/build/ft-reader-toc.js
CHANGED
|
@@ -27,6 +27,7 @@ export class FtReaderToc extends FtReaderComponent {
|
|
|
27
27
|
this.expandIcon = "PLUS";
|
|
28
28
|
this.autoCollapse = false;
|
|
29
29
|
this.scope = "pages";
|
|
30
|
+
this.hideIfEmpty = false;
|
|
30
31
|
this.empty = true;
|
|
31
32
|
this.labels = {};
|
|
32
33
|
this.labelResolver = new ParametrizedLabelResolver(DEFAULT_LABELS, {});
|
|
@@ -61,6 +62,13 @@ export class FtReaderToc extends FtReaderComponent {
|
|
|
61
62
|
"ft-reader-toc-expanded": this.expanded,
|
|
62
63
|
};
|
|
63
64
|
return html `
|
|
65
|
+
${this.hideIfEmpty && this.empty ? html `
|
|
66
|
+
<style>
|
|
67
|
+
:host {
|
|
68
|
+
display: none;
|
|
69
|
+
}
|
|
70
|
+
</style>
|
|
71
|
+
` : nothing}
|
|
64
72
|
<div class=${classMap(classes)}>
|
|
65
73
|
<ft-size-watcher @change=${this.onViewportSizeChange}></ft-size-watcher>
|
|
66
74
|
${repeat((_a = this.getToc()) !== null && _a !== void 0 ? _a : [], node => node.tocId, node => this.renderNode(node))}
|
|
@@ -175,6 +183,9 @@ __decorate([
|
|
|
175
183
|
__decorate([
|
|
176
184
|
property()
|
|
177
185
|
], FtReaderToc.prototype, "scope", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
property({ type: Boolean })
|
|
188
|
+
], FtReaderToc.prototype, "hideIfEmpty", void 0);
|
|
178
189
|
__decorate([
|
|
179
190
|
property({ type: Boolean, reflect: true })
|
|
180
191
|
], FtReaderToc.prototype, "empty", void 0);
|
|
@@ -526,7 +526,7 @@ const G=Symbol.for(""),K=t=>{if((null==t?void 0:t.r)===G)return null==t?void 0:t
|
|
|
526
526
|
${i.setVariable(Gi.size,Xi.iconSize)};
|
|
527
527
|
${i.setVariable(Gi.color,"var(--ft-button-internal-color)")};
|
|
528
528
|
}
|
|
529
|
-
`];var te,ie=function(t,i,e,o){for(var n,s=arguments.length,r=s<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,a=t.length-1;a>=0;a--)(n=t[a])&&(r=(s<3?n(r):s>3?n(i,e,r):n(i,e))||r);return s>3&&r&&Object.defineProperty(i,e,r),r};class ee extends i.FtLitElement{constructor(){super(...arguments),this.primary=!1,this.outlined=!1,this.disabled=!1,this.dense=!1,this.round=!1,this.label="",this.icon=void 0,this.iconVariant=wi.material,this.trailingIcon=!1,this.loading=!1,this.tooltipPosition="bottom",this.hideTooltip=!1,this.onclick=t=>{this.isDisabled()&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())}}render(){const t={"ft-button":!0,"ft-button--primary":this.primary,"ft-button--outlined":this.outlined,"ft-button--dense":this.dense,"ft-button--round":this.round,"ft-button--trailing-icon":this.trailingIcon,"ft-button--loading":this.trailingIcon,"ft-button--safari-fix":i.isSafari,"ft-no-text-select":!0};return this.addTooltipIfNeeded(e.html`
|
|
529
|
+
`];var te,ie=function(t,i,e,o){for(var n,s=arguments.length,r=s<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,a=t.length-1;a>=0;a--)(n=t[a])&&(r=(s<3?n(r):s>3?n(i,e,r):n(i,e))||r);return s>3&&r&&Object.defineProperty(i,e,r),r};class ee extends i.FtLitElement{constructor(){super(...arguments),this.primary=!1,this.outlined=!1,this.disabled=!1,this.dense=!1,this.round=!1,this.label="",this.icon=void 0,this.iconVariant=wi.material,this.trailingIcon=!1,this.loading=!1,this.tooltipPosition="bottom",this.hideTooltip=!1,this.forceTooltip=!1,this.onclick=t=>{this.isDisabled()&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())}}render(){const t={"ft-button":!0,"ft-button--primary":this.primary,"ft-button--outlined":this.outlined,"ft-button--dense":this.dense,"ft-button--round":this.round,"ft-button--trailing-icon":this.trailingIcon,"ft-button--loading":this.trailingIcon,"ft-button--safari-fix":i.isSafari,"ft-no-text-select":!0};return this.addTooltipIfNeeded(e.html`
|
|
530
530
|
<button part="button"
|
|
531
531
|
class="${n.classMap(t)}"
|
|
532
532
|
aria-label="${this.getLabel()}"
|
|
@@ -540,15 +540,15 @@ const G=Symbol.for(""),K=t=>{if((null==t?void 0:t.r)===G)return null==t?void 0:t
|
|
|
540
540
|
</ft-typography>
|
|
541
541
|
${this.resolveIcon()}
|
|
542
542
|
</button>
|
|
543
|
-
`)}addTooltipIfNeeded(t){return this.
|
|
543
|
+
`)}addTooltipIfNeeded(t){return this.getLabel().trim().length>0&&(this.forceTooltip||!this.hasTextContent()&&!this.hideTooltip)?e.html`
|
|
544
544
|
<ft-tooltip part="tooltip"
|
|
545
545
|
text="${this.getLabel()}"
|
|
546
546
|
position="${this.tooltipPosition}">
|
|
547
547
|
${t}
|
|
548
548
|
</ft-tooltip>
|
|
549
|
-
|
|
549
|
+
`:t}resolveIcon(){return this.loading?e.html`
|
|
550
550
|
<ft-loader></ft-loader> `:this.icon?e.html`
|
|
551
|
-
<ft-icon variant="${this.iconVariant}" value="${this.icon}"></ft-icon> `:e.nothing}focus(){var t;null===(t=this.button)||void 0===t||t.focus()}getLabel(){return this.label||this.textContent}get textContent(){return this.unslotText(this.slottedContent).trim()}unslotText(t){return t instanceof HTMLSlotElement?t.assignedNodes().map((t=>this.unslotText(t))).join(""):(null==t?void 0:t.textContent)||""}hasTextContent(){return this.textContent.length>0}onSlotchange(){this.requestUpdate()}isDisabled(){return this.disabled||this.loading}}ee.elementDefinitions={"ft-ripple":Fi,"ft-tooltip":Di,"ft-typography":ci,"ft-icon":zi,"ft-loader":Hi},ee.styles=Qi,ie([r.property({type:Boolean})],ee.prototype,"primary",void 0),ie([r.property({type:Boolean})],ee.prototype,"outlined",void 0),ie([r.property({type:Boolean})],ee.prototype,"disabled",void 0),ie([r.property({type:Boolean})],ee.prototype,"dense",void 0),ie([r.property({type:Boolean})],ee.prototype,"round",void 0),ie([r.property({type:String})],ee.prototype,"label",void 0),ie([r.property({type:String})],ee.prototype,"icon",void 0),ie([r.property({type:String})],ee.prototype,"iconVariant",void 0),ie([r.property({type:Boolean})],ee.prototype,"trailingIcon",void 0),ie([r.property({type:Boolean})],ee.prototype,"loading",void 0),ie([r.property({type:String})],ee.prototype,"tooltipPosition",void 0),ie([r.property({type:Boolean})],ee.prototype,"hideTooltip",void 0),ie([r.query(".ft-button")],ee.prototype,"button",void 0),ie([r.query(".ft-button--label slot")],ee.prototype,"slottedContent",void 0),i.customElement("ft-button")(ee),function(t){t.S="S",t.M="M",t.L="L",t.XL="XL",t.XXL="XXL"}(te||(te={}));const oe=e.css`
|
|
551
|
+
<ft-icon variant="${this.iconVariant}" value="${this.icon}"></ft-icon> `:e.nothing}focus(){var t;null===(t=this.button)||void 0===t||t.focus()}getLabel(){return this.label||this.textContent}get textContent(){return this.unslotText(this.slottedContent).trim()}unslotText(t){return t instanceof HTMLSlotElement?t.assignedNodes().map((t=>this.unslotText(t))).join(""):(null==t?void 0:t.textContent)||""}hasTextContent(){return this.textContent.length>0}onSlotchange(){this.requestUpdate()}isDisabled(){return this.disabled||this.loading}}ee.elementDefinitions={"ft-ripple":Fi,"ft-tooltip":Di,"ft-typography":ci,"ft-icon":zi,"ft-loader":Hi},ee.styles=Qi,ie([r.property({type:Boolean})],ee.prototype,"primary",void 0),ie([r.property({type:Boolean})],ee.prototype,"outlined",void 0),ie([r.property({type:Boolean})],ee.prototype,"disabled",void 0),ie([r.property({type:Boolean})],ee.prototype,"dense",void 0),ie([r.property({type:Boolean})],ee.prototype,"round",void 0),ie([r.property({type:String})],ee.prototype,"label",void 0),ie([r.property({type:String})],ee.prototype,"icon",void 0),ie([r.property({type:String})],ee.prototype,"iconVariant",void 0),ie([r.property({type:Boolean})],ee.prototype,"trailingIcon",void 0),ie([r.property({type:Boolean})],ee.prototype,"loading",void 0),ie([r.property({type:String})],ee.prototype,"tooltipPosition",void 0),ie([r.property({type:Boolean})],ee.prototype,"hideTooltip",void 0),ie([r.property({type:Boolean})],ee.prototype,"forceTooltip",void 0),ie([r.query(".ft-button")],ee.prototype,"button",void 0),ie([r.query(".ft-button--label slot")],ee.prototype,"slottedContent",void 0),i.customElement("ft-button")(ee),function(t){t.S="S",t.M="M",t.L="L",t.XL="XL",t.XXL="XXL"}(te||(te={}));const oe=e.css`
|
|
552
552
|
.ft-size-watcher--pixel {
|
|
553
553
|
width: 0;
|
|
554
554
|
height: 0;
|
|
@@ -609,7 +609,14 @@ const G=Symbol.for(""),K=t=>{if((null==t?void 0:t.r)===G)return null==t?void 0:t
|
|
|
609
609
|
${i.setVariable(Xi.iconSize,le.iconFontSize)};
|
|
610
610
|
${i.setVariable(Xi.backgroundColor,"transparent")};
|
|
611
611
|
}
|
|
612
|
-
`;var pe=function(t,i,e,o){for(var n,s=arguments.length,r=s<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,a=t.length-1;a>=0;a--)(n=t[a])&&(r=(s<3?n(r):s>3?n(i,e,r):n(i,e))||r);return s>3&&r&&Object.defineProperty(i,e,r),r};class fe extends f{constructor(){super(...arguments),this.expanded=!1,this.iconVariant=wi.fluid_topics,this.collapseIcon="MINUS",this.expandIcon="PLUS",this.autoCollapse=!1,this.scope="pages",this.empty=!0,this.labels={},this.labelResolver=new i.ParametrizedLabelResolver(ae,{}),this.automaticallyExpandedNodes=new Set,this.manuallyExpandedNodes=new Set,this.manuallyCollapsedNodes=new Set,this.viewportSize=te.M}get isCurrentPageToc(){return"current-page"===this.scope}update(t){var e;if(super.update(t),t.has("labels")&&(this.labelResolver=new i.ParametrizedLabelResolver(ae,this.labels)),!this.expanded&&["splitToc","visibleTopics","currentPage","toc"].some((i=>t.has(i)))){const t=this.isCurrentPageToc||!this.splitToc?null!==(e=this.visibleTopics)&&void 0!==e?e:[]:this.currentPage?[this.currentPage.rootTocId]:[];this.automaticallyExpandedNodes=this.buildAutomaticallyExpandedNodes(t)}this.empty=!this.getToc()}render(){var t;const i={"ft-reader-toc":!0,"ft-reader-toc-mobile":this.viewportSize===te.S,"ft-reader-toc-desktop":this.viewportSize!==te.S,"ft-reader-toc-loaded":null!=this.toc&&null!=this.currentPage,"ft-reader-toc-expanded":this.expanded};return e.html`
|
|
612
|
+
`;var pe=function(t,i,e,o){for(var n,s=arguments.length,r=s<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,a=t.length-1;a>=0;a--)(n=t[a])&&(r=(s<3?n(r):s>3?n(i,e,r):n(i,e))||r);return s>3&&r&&Object.defineProperty(i,e,r),r};class fe extends f{constructor(){super(...arguments),this.expanded=!1,this.iconVariant=wi.fluid_topics,this.collapseIcon="MINUS",this.expandIcon="PLUS",this.autoCollapse=!1,this.scope="pages",this.hideIfEmpty=!1,this.empty=!0,this.labels={},this.labelResolver=new i.ParametrizedLabelResolver(ae,{}),this.automaticallyExpandedNodes=new Set,this.manuallyExpandedNodes=new Set,this.manuallyCollapsedNodes=new Set,this.viewportSize=te.M}get isCurrentPageToc(){return"current-page"===this.scope}update(t){var e;if(super.update(t),t.has("labels")&&(this.labelResolver=new i.ParametrizedLabelResolver(ae,this.labels)),!this.expanded&&["splitToc","visibleTopics","currentPage","toc"].some((i=>t.has(i)))){const t=this.isCurrentPageToc||!this.splitToc?null!==(e=this.visibleTopics)&&void 0!==e?e:[]:this.currentPage?[this.currentPage.rootTocId]:[];this.automaticallyExpandedNodes=this.buildAutomaticallyExpandedNodes(t)}this.empty=!this.getToc()}render(){var t;const i={"ft-reader-toc":!0,"ft-reader-toc-mobile":this.viewportSize===te.S,"ft-reader-toc-desktop":this.viewportSize!==te.S,"ft-reader-toc-loaded":null!=this.toc&&null!=this.currentPage,"ft-reader-toc-expanded":this.expanded};return e.html`
|
|
613
|
+
${this.hideIfEmpty&&this.empty?e.html`
|
|
614
|
+
<style>
|
|
615
|
+
:host {
|
|
616
|
+
display: none;
|
|
617
|
+
}
|
|
618
|
+
</style>
|
|
619
|
+
`:e.nothing}
|
|
613
620
|
<div class=${n.classMap(i)}>
|
|
614
621
|
<ft-size-watcher @change=${this.onViewportSizeChange}></ft-size-watcher>
|
|
615
622
|
${o.repeat(null!==(t=this.getToc())&&void 0!==t?t:[],(t=>t.tocId),(t=>this.renderNode(t)))}
|
|
@@ -642,4 +649,4 @@ const G=Symbol.for(""),K=t=>{if((null==t?void 0:t.r)===G)return null==t?void 0:t
|
|
|
642
649
|
</div>
|
|
643
650
|
`:e.nothing}
|
|
644
651
|
</div>
|
|
645
|
-
`}buildAutomaticallyExpandedNodes(t){var i,e,o,n;let s=new Set(this.autoCollapse?[]:this.automaticallyExpandedNodes);for(let r of t){let t=null===(e=null===(i=this.service)||void 0===i?void 0:i.getTocNodeOrThrow(r))||void 0===e?void 0:e.parentTocId;for(;t&&!s.has(t);)s.add(t),this.manuallyCollapsedNodes.delete(t),t=null===(n=null===(o=this.service)||void 0===o?void 0:o.getTocNodeOrThrow(t))||void 0===n?void 0:n.parentTocId}return s}manuallyToggle(t,i){i?(this.manuallyCollapsedNodes.add(t),this.manuallyExpandedNodes.delete(t)):(this.manuallyExpandedNodes.add(t),this.manuallyCollapsedNodes.delete(t)),this.requestUpdate()}onViewportSizeChange(t){this.viewportSize=t.detail.category}}fe.elementDefinitions={"ft-button":ee,"ft-reader-internal-link":bi,"ft-size-watcher":re,"ft-typography":ci},fe.styles=he,pe([r.property({type:Boolean})],fe.prototype,"expanded",void 0),pe([r.property()],fe.prototype,"iconVariant",void 0),pe([r.property()],fe.prototype,"collapseIcon",void 0),pe([r.property()],fe.prototype,"expandIcon",void 0),pe([r.property({type:Boolean})],fe.prototype,"autoCollapse",void 0),pe([r.property()],fe.prototype,"scope",void 0),pe([r.property({type:Boolean,reflect:!0})],fe.prototype,"empty",void 0),pe([i.jsonProperty({})],fe.prototype,"labels",void 0),pe([i.redux()],fe.prototype,"toc",void 0),pe([i.redux((t=>{var i;return null===(i=t.map)||void 0===i?void 0:i.shouldSplitCurrentPageToc}))],fe.prototype,"splitToc",void 0),pe([i.redux()],fe.prototype,"currentPage",void 0),pe([i.redux()],fe.prototype,"visibleTopics",void 0),pe([r.state({hasChanged:(t,e)=>!i.deepEqual(t,e)})],fe.prototype,"automaticallyExpandedNodes",void 0),pe([r.state({hasChanged:(t,e)=>!i.deepEqual(t,e)})],fe.prototype,"manuallyExpandedNodes",void 0),pe([r.state({hasChanged:(t,e)=>!i.deepEqual(t,e)})],fe.prototype,"manuallyCollapsedNodes",void 0),pe([r.state()],fe.prototype,"viewportSize",void 0),i.customElement("ft-reader-toc")(fe),t.DEFAULT_LABELS=ae,t.FtReaderToc=fe,t.FtReaderTocCssVariables=le,t.styles=he,Object.defineProperty(t,"t",{value:!0})}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litRepeat,ftGlobals.litClassMap,ftGlobals.litStyleMap,ftGlobals.litDecorators,ftGlobals.litUnsafeHTML);
|
|
652
|
+
`}buildAutomaticallyExpandedNodes(t){var i,e,o,n;let s=new Set(this.autoCollapse?[]:this.automaticallyExpandedNodes);for(let r of t){let t=null===(e=null===(i=this.service)||void 0===i?void 0:i.getTocNodeOrThrow(r))||void 0===e?void 0:e.parentTocId;for(;t&&!s.has(t);)s.add(t),this.manuallyCollapsedNodes.delete(t),t=null===(n=null===(o=this.service)||void 0===o?void 0:o.getTocNodeOrThrow(t))||void 0===n?void 0:n.parentTocId}return s}manuallyToggle(t,i){i?(this.manuallyCollapsedNodes.add(t),this.manuallyExpandedNodes.delete(t)):(this.manuallyExpandedNodes.add(t),this.manuallyCollapsedNodes.delete(t)),this.requestUpdate()}onViewportSizeChange(t){this.viewportSize=t.detail.category}}fe.elementDefinitions={"ft-button":ee,"ft-reader-internal-link":bi,"ft-size-watcher":re,"ft-typography":ci},fe.styles=he,pe([r.property({type:Boolean})],fe.prototype,"expanded",void 0),pe([r.property()],fe.prototype,"iconVariant",void 0),pe([r.property()],fe.prototype,"collapseIcon",void 0),pe([r.property()],fe.prototype,"expandIcon",void 0),pe([r.property({type:Boolean})],fe.prototype,"autoCollapse",void 0),pe([r.property()],fe.prototype,"scope",void 0),pe([r.property({type:Boolean})],fe.prototype,"hideIfEmpty",void 0),pe([r.property({type:Boolean,reflect:!0})],fe.prototype,"empty",void 0),pe([i.jsonProperty({})],fe.prototype,"labels",void 0),pe([i.redux()],fe.prototype,"toc",void 0),pe([i.redux((t=>{var i;return null===(i=t.map)||void 0===i?void 0:i.shouldSplitCurrentPageToc}))],fe.prototype,"splitToc",void 0),pe([i.redux()],fe.prototype,"currentPage",void 0),pe([i.redux()],fe.prototype,"visibleTopics",void 0),pe([r.state({hasChanged:(t,e)=>!i.deepEqual(t,e)})],fe.prototype,"automaticallyExpandedNodes",void 0),pe([r.state({hasChanged:(t,e)=>!i.deepEqual(t,e)})],fe.prototype,"manuallyExpandedNodes",void 0),pe([r.state({hasChanged:(t,e)=>!i.deepEqual(t,e)})],fe.prototype,"manuallyCollapsedNodes",void 0),pe([r.state()],fe.prototype,"viewportSize",void 0),i.customElement("ft-reader-toc")(fe),t.DEFAULT_LABELS=ae,t.FtReaderToc=fe,t.FtReaderTocCssVariables=le,t.styles=he,Object.defineProperty(t,"t",{value:!0})}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litRepeat,ftGlobals.litClassMap,ftGlobals.litStyleMap,ftGlobals.litDecorators,ftGlobals.litUnsafeHTML);
|
|
@@ -647,7 +647,7 @@ function(t,e,i){let o,n=t;return"object"==typeof t?(n=t.slot,o=t):o={flatten:e},
|
|
|
647
647
|
${vt(Zi.size,qi.iconSize)};
|
|
648
648
|
${vt(Zi.color,"var(--ft-button-internal-color)")};
|
|
649
649
|
}
|
|
650
|
-
`];var eo,io=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class oo extends gt{constructor(){super(...arguments),this.primary=!1,this.outlined=!1,this.disabled=!1,this.dense=!1,this.round=!1,this.label="",this.icon=void 0,this.iconVariant=Oi.material,this.trailingIcon=!1,this.loading=!1,this.tooltipPosition="bottom",this.hideTooltip=!1,this.onclick=t=>{this.isDisabled()&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())}}render(){const t={"ft-button":!0,"ft-button--primary":this.primary,"ft-button--outlined":this.outlined,"ft-button--dense":this.dense,"ft-button--round":this.round,"ft-button--trailing-icon":this.trailingIcon,"ft-button--loading":this.trailingIcon,"ft-button--safari-fix":Nt,"ft-no-text-select":!0};return this.addTooltipIfNeeded(Z`
|
|
650
|
+
`];var eo,io=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class oo extends gt{constructor(){super(...arguments),this.primary=!1,this.outlined=!1,this.disabled=!1,this.dense=!1,this.round=!1,this.label="",this.icon=void 0,this.iconVariant=Oi.material,this.trailingIcon=!1,this.loading=!1,this.tooltipPosition="bottom",this.hideTooltip=!1,this.forceTooltip=!1,this.onclick=t=>{this.isDisabled()&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())}}render(){const t={"ft-button":!0,"ft-button--primary":this.primary,"ft-button--outlined":this.outlined,"ft-button--dense":this.dense,"ft-button--round":this.round,"ft-button--trailing-icon":this.trailingIcon,"ft-button--loading":this.trailingIcon,"ft-button--safari-fix":Nt,"ft-no-text-select":!0};return this.addTooltipIfNeeded(Z`
|
|
651
651
|
<button part="button"
|
|
652
652
|
class="${Pt(t)}"
|
|
653
653
|
aria-label="${this.getLabel()}"
|
|
@@ -661,15 +661,15 @@ function(t,e,i){let o,n=t;return"object"==typeof t?(n=t.slot,o=t):o={flatten:e},
|
|
|
661
661
|
</ft-typography>
|
|
662
662
|
${this.resolveIcon()}
|
|
663
663
|
</button>
|
|
664
|
-
`)}addTooltipIfNeeded(t){return this.
|
|
664
|
+
`)}addTooltipIfNeeded(t){return this.getLabel().trim().length>0&&(this.forceTooltip||!this.hasTextContent()&&!this.hideTooltip)?Z`
|
|
665
665
|
<ft-tooltip part="tooltip"
|
|
666
666
|
text="${this.getLabel()}"
|
|
667
667
|
position="${this.tooltipPosition}">
|
|
668
668
|
${t}
|
|
669
669
|
</ft-tooltip>
|
|
670
|
-
|
|
670
|
+
`:t}resolveIcon(){return this.loading?Z`
|
|
671
671
|
<ft-loader></ft-loader> `:this.icon?Z`
|
|
672
|
-
<ft-icon variant="${this.iconVariant}" value="${this.icon}"></ft-icon> `:J}focus(){var t;null===(t=this.button)||void 0===t||t.focus()}getLabel(){return this.label||this.textContent}get textContent(){return this.unslotText(this.slottedContent).trim()}unslotText(t){return t instanceof HTMLSlotElement?t.assignedNodes().map((t=>this.unslotText(t))).join(""):(null==t?void 0:t.textContent)||""}hasTextContent(){return this.textContent.length>0}onSlotchange(){this.requestUpdate()}isDisabled(){return this.disabled||this.loading}}oo.elementDefinitions={"ft-ripple":Bi,"ft-tooltip":Ki,"ft-typography":di,"ft-icon":ki,"ft-loader":Ji},oo.styles=to,io([o({type:Boolean})],oo.prototype,"primary",void 0),io([o({type:Boolean})],oo.prototype,"outlined",void 0),io([o({type:Boolean})],oo.prototype,"disabled",void 0),io([o({type:Boolean})],oo.prototype,"dense",void 0),io([o({type:Boolean})],oo.prototype,"round",void 0),io([o({type:String})],oo.prototype,"label",void 0),io([o({type:String})],oo.prototype,"icon",void 0),io([o({type:String})],oo.prototype,"iconVariant",void 0),io([o({type:Boolean})],oo.prototype,"trailingIcon",void 0),io([o({type:Boolean})],oo.prototype,"loading",void 0),io([o({type:String})],oo.prototype,"tooltipPosition",void 0),io([o({type:Boolean})],oo.prototype,"hideTooltip",void 0),io([s(".ft-button")],oo.prototype,"button",void 0),io([s(".ft-button--label slot")],oo.prototype,"slottedContent",void 0),h("ft-button")(oo),function(t){t.S="S",t.M="M",t.L="L",t.XL="XL",t.XXL="XXL"}(eo||(eo={}));const no=b`
|
|
672
|
+
<ft-icon variant="${this.iconVariant}" value="${this.icon}"></ft-icon> `:J}focus(){var t;null===(t=this.button)||void 0===t||t.focus()}getLabel(){return this.label||this.textContent}get textContent(){return this.unslotText(this.slottedContent).trim()}unslotText(t){return t instanceof HTMLSlotElement?t.assignedNodes().map((t=>this.unslotText(t))).join(""):(null==t?void 0:t.textContent)||""}hasTextContent(){return this.textContent.length>0}onSlotchange(){this.requestUpdate()}isDisabled(){return this.disabled||this.loading}}oo.elementDefinitions={"ft-ripple":Bi,"ft-tooltip":Ki,"ft-typography":di,"ft-icon":ki,"ft-loader":Ji},oo.styles=to,io([o({type:Boolean})],oo.prototype,"primary",void 0),io([o({type:Boolean})],oo.prototype,"outlined",void 0),io([o({type:Boolean})],oo.prototype,"disabled",void 0),io([o({type:Boolean})],oo.prototype,"dense",void 0),io([o({type:Boolean})],oo.prototype,"round",void 0),io([o({type:String})],oo.prototype,"label",void 0),io([o({type:String})],oo.prototype,"icon",void 0),io([o({type:String})],oo.prototype,"iconVariant",void 0),io([o({type:Boolean})],oo.prototype,"trailingIcon",void 0),io([o({type:Boolean})],oo.prototype,"loading",void 0),io([o({type:String})],oo.prototype,"tooltipPosition",void 0),io([o({type:Boolean})],oo.prototype,"hideTooltip",void 0),io([o({type:Boolean})],oo.prototype,"forceTooltip",void 0),io([s(".ft-button")],oo.prototype,"button",void 0),io([s(".ft-button--label slot")],oo.prototype,"slottedContent",void 0),h("ft-button")(oo),function(t){t.S="S",t.M="M",t.L="L",t.XL="XL",t.XXL="XXL"}(eo||(eo={}));const no=b`
|
|
673
673
|
.ft-size-watcher--pixel {
|
|
674
674
|
width: 0;
|
|
675
675
|
height: 0;
|
|
@@ -730,7 +730,14 @@ function(t,e,i){let o,n=t;return"object"==typeof t?(n=t.slot,o=t):o={flatten:e},
|
|
|
730
730
|
${vt(qi.iconSize,ho.iconFontSize)};
|
|
731
731
|
${vt(qi.backgroundColor,"transparent")};
|
|
732
732
|
}
|
|
733
|
-
`;var po=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class fo extends Wt{constructor(){super(...arguments),this.expanded=!1,this.iconVariant=Oi.fluid_topics,this.collapseIcon="MINUS",this.expandIcon="PLUS",this.autoCollapse=!1,this.scope="pages",this.empty=!0,this.labels={},this.labelResolver=new mt(lo,{}),this.automaticallyExpandedNodes=new Set,this.manuallyExpandedNodes=new Set,this.manuallyCollapsedNodes=new Set,this.viewportSize=eo.M}get isCurrentPageToc(){return"current-page"===this.scope}update(t){var e;if(super.update(t),t.has("labels")&&(this.labelResolver=new mt(lo,this.labels)),!this.expanded&&["splitToc","visibleTopics","currentPage","toc"].some((e=>t.has(e)))){const t=this.isCurrentPageToc||!this.splitToc?null!==(e=this.visibleTopics)&&void 0!==e?e:[]:this.currentPage?[this.currentPage.rootTocId]:[];this.automaticallyExpandedNodes=this.buildAutomaticallyExpandedNodes(t)}this.empty=!this.getToc()}render(){var t;const e={"ft-reader-toc":!0,"ft-reader-toc-mobile":this.viewportSize===eo.S,"ft-reader-toc-desktop":this.viewportSize!==eo.S,"ft-reader-toc-loaded":null!=this.toc&&null!=this.currentPage,"ft-reader-toc-expanded":this.expanded};return Z`
|
|
733
|
+
`;var po=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class fo extends Wt{constructor(){super(...arguments),this.expanded=!1,this.iconVariant=Oi.fluid_topics,this.collapseIcon="MINUS",this.expandIcon="PLUS",this.autoCollapse=!1,this.scope="pages",this.hideIfEmpty=!1,this.empty=!0,this.labels={},this.labelResolver=new mt(lo,{}),this.automaticallyExpandedNodes=new Set,this.manuallyExpandedNodes=new Set,this.manuallyCollapsedNodes=new Set,this.viewportSize=eo.M}get isCurrentPageToc(){return"current-page"===this.scope}update(t){var e;if(super.update(t),t.has("labels")&&(this.labelResolver=new mt(lo,this.labels)),!this.expanded&&["splitToc","visibleTopics","currentPage","toc"].some((e=>t.has(e)))){const t=this.isCurrentPageToc||!this.splitToc?null!==(e=this.visibleTopics)&&void 0!==e?e:[]:this.currentPage?[this.currentPage.rootTocId]:[];this.automaticallyExpandedNodes=this.buildAutomaticallyExpandedNodes(t)}this.empty=!this.getToc()}render(){var t;const e={"ft-reader-toc":!0,"ft-reader-toc-mobile":this.viewportSize===eo.S,"ft-reader-toc-desktop":this.viewportSize!==eo.S,"ft-reader-toc-loaded":null!=this.toc&&null!=this.currentPage,"ft-reader-toc-expanded":this.expanded};return Z`
|
|
734
|
+
${this.hideIfEmpty&&this.empty?Z`
|
|
735
|
+
<style>
|
|
736
|
+
:host {
|
|
737
|
+
display: none;
|
|
738
|
+
}
|
|
739
|
+
</style>
|
|
740
|
+
`:J}
|
|
734
741
|
<div class=${Pt(e)}>
|
|
735
742
|
<ft-size-watcher @change=${this.onViewportSizeChange}></ft-size-watcher>
|
|
736
743
|
${Lt(null!==(t=this.getToc())&&void 0!==t?t:[],(t=>t.tocId),(t=>this.renderNode(t)))}
|
|
@@ -763,4 +770,4 @@ function(t,e,i){let o,n=t;return"object"==typeof t?(n=t.slot,o=t):o={flatten:e},
|
|
|
763
770
|
</div>
|
|
764
771
|
`:J}
|
|
765
772
|
</div>
|
|
766
|
-
`}buildAutomaticallyExpandedNodes(t){var e,i,o,n;let r=new Set(this.autoCollapse?[]:this.automaticallyExpandedNodes);for(let s of t){let t=null===(i=null===(e=this.service)||void 0===e?void 0:e.getTocNodeOrThrow(s))||void 0===i?void 0:i.parentTocId;for(;t&&!r.has(t);)r.add(t),this.manuallyCollapsedNodes.delete(t),t=null===(n=null===(o=this.service)||void 0===o?void 0:o.getTocNodeOrThrow(t))||void 0===n?void 0:n.parentTocId}return r}manuallyToggle(t,e){e?(this.manuallyCollapsedNodes.add(t),this.manuallyExpandedNodes.delete(t)):(this.manuallyExpandedNodes.add(t),this.manuallyCollapsedNodes.delete(t)),this.requestUpdate()}onViewportSizeChange(t){this.viewportSize=t.detail.category}}fo.elementDefinitions={"ft-button":oo,"ft-reader-internal-link":yi,"ft-size-watcher":ao,"ft-typography":di},fo.styles=co,po([o({type:Boolean})],fo.prototype,"expanded",void 0),po([o()],fo.prototype,"iconVariant",void 0),po([o()],fo.prototype,"collapseIcon",void 0),po([o()],fo.prototype,"expandIcon",void 0),po([o({type:Boolean})],fo.prototype,"autoCollapse",void 0),po([o()],fo.prototype,"scope",void 0),po([o({type:Boolean,reflect:!0})],fo.prototype,"empty",void 0),po([c({})],fo.prototype,"labels",void 0),po([wt()],fo.prototype,"toc",void 0),po([wt((t=>{var e;return null===(e=t.map)||void 0===e?void 0:e.shouldSplitCurrentPageToc}))],fo.prototype,"splitToc",void 0),po([wt()],fo.prototype,"currentPage",void 0),po([wt()],fo.prototype,"visibleTopics",void 0),po([n({hasChanged:(t,e)=>!p(t,e)})],fo.prototype,"automaticallyExpandedNodes",void 0),po([n({hasChanged:(t,e)=>!p(t,e)})],fo.prototype,"manuallyExpandedNodes",void 0),po([n({hasChanged:(t,e)=>!p(t,e)})],fo.prototype,"manuallyCollapsedNodes",void 0),po([n()],fo.prototype,"viewportSize",void 0),h("ft-reader-toc")(fo),t.DEFAULT_LABELS=lo,t.FtReaderToc=fo,t.FtReaderTocCssVariables=ho,t.styles=co,Object.defineProperty(t,"i",{value:!0})}({});
|
|
773
|
+
`}buildAutomaticallyExpandedNodes(t){var e,i,o,n;let r=new Set(this.autoCollapse?[]:this.automaticallyExpandedNodes);for(let s of t){let t=null===(i=null===(e=this.service)||void 0===e?void 0:e.getTocNodeOrThrow(s))||void 0===i?void 0:i.parentTocId;for(;t&&!r.has(t);)r.add(t),this.manuallyCollapsedNodes.delete(t),t=null===(n=null===(o=this.service)||void 0===o?void 0:o.getTocNodeOrThrow(t))||void 0===n?void 0:n.parentTocId}return r}manuallyToggle(t,e){e?(this.manuallyCollapsedNodes.add(t),this.manuallyExpandedNodes.delete(t)):(this.manuallyExpandedNodes.add(t),this.manuallyCollapsedNodes.delete(t)),this.requestUpdate()}onViewportSizeChange(t){this.viewportSize=t.detail.category}}fo.elementDefinitions={"ft-button":oo,"ft-reader-internal-link":yi,"ft-size-watcher":ao,"ft-typography":di},fo.styles=co,po([o({type:Boolean})],fo.prototype,"expanded",void 0),po([o()],fo.prototype,"iconVariant",void 0),po([o()],fo.prototype,"collapseIcon",void 0),po([o()],fo.prototype,"expandIcon",void 0),po([o({type:Boolean})],fo.prototype,"autoCollapse",void 0),po([o()],fo.prototype,"scope",void 0),po([o({type:Boolean})],fo.prototype,"hideIfEmpty",void 0),po([o({type:Boolean,reflect:!0})],fo.prototype,"empty",void 0),po([c({})],fo.prototype,"labels",void 0),po([wt()],fo.prototype,"toc",void 0),po([wt((t=>{var e;return null===(e=t.map)||void 0===e?void 0:e.shouldSplitCurrentPageToc}))],fo.prototype,"splitToc",void 0),po([wt()],fo.prototype,"currentPage",void 0),po([wt()],fo.prototype,"visibleTopics",void 0),po([n({hasChanged:(t,e)=>!p(t,e)})],fo.prototype,"automaticallyExpandedNodes",void 0),po([n({hasChanged:(t,e)=>!p(t,e)})],fo.prototype,"manuallyExpandedNodes",void 0),po([n({hasChanged:(t,e)=>!p(t,e)})],fo.prototype,"manuallyCollapsedNodes",void 0),po([n()],fo.prototype,"viewportSize",void 0),h("ft-reader-toc")(fo),t.DEFAULT_LABELS=lo,t.FtReaderToc=fo,t.FtReaderTocCssVariables=ho,t.styles=co,Object.defineProperty(t,"i",{value:!0})}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-reader-toc",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.17",
|
|
4
4
|
"description": "Main table of content for integrated reader",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-icon": "0.3.
|
|
23
|
-
"@fluid-topics/ft-reader-context": "0.3.
|
|
24
|
-
"@fluid-topics/ft-size-watcher": "0.3.
|
|
25
|
-
"@fluid-topics/ft-typography": "0.3.
|
|
26
|
-
"@fluid-topics/ft-wc-utils": "0.3.
|
|
22
|
+
"@fluid-topics/ft-icon": "0.3.17",
|
|
23
|
+
"@fluid-topics/ft-reader-context": "0.3.17",
|
|
24
|
+
"@fluid-topics/ft-size-watcher": "0.3.17",
|
|
25
|
+
"@fluid-topics/ft-typography": "0.3.17",
|
|
26
|
+
"@fluid-topics/ft-wc-utils": "0.3.17",
|
|
27
27
|
"lit": "2.2.8"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "35c3683874910a6b132930ac8f7dd1ede0294f28"
|
|
30
30
|
}
|