@fluid-topics/ft-reader-toc 0.3.16 → 0.3.18

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.
@@ -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;
@@ -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 !important;
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))}
@@ -75,14 +83,16 @@ export class FtReaderToc extends FtReaderComponent {
75
83
  return this.toc;
76
84
  }
77
85
  renderNode(node) {
78
- var _a, _b;
86
+ var _a, _b, _c, _d;
79
87
  const shouldSplit = !this.isCurrentPageToc && this.splitToc && node.page != null && !node.page.onItsOwn;
80
88
  const isHighlighted = !this.isCurrentPageToc && this.splitToc ? ((_a = this.currentPage) === null || _a === void 0 ? void 0 : _a.rootTocId) === node.tocId : (_b = this.visibleTopics) === null || _b === void 0 ? void 0 : _b.includes(node.tocId);
81
89
  const isExpanded = this.expanded || this.manuallyExpandedNodes.has(node.tocId) || (this.automaticallyExpandedNodes.has(node.tocId) && !this.manuallyCollapsedNodes.has(node.tocId));
82
90
  const canDisplayChildren = (this.isCurrentPageToc || !shouldSplit) && node.children.length > 0;
83
91
  const displayToggle = canDisplayChildren && !this.expanded;
92
+ const currentPageDepth = this.isCurrentPageToc ? ((_d = (_c = this.currentPage) === null || _c === void 0 ? void 0 : _c.breadcrumb.length) !== null && _d !== void 0 ? _d : 0) + 1 : 0;
93
+ const tabNumber = node.depth - 1 - currentPageDepth;
84
94
  const styles = {
85
- "padding-left": `calc( ${FtReaderTocCssVariables.tabulationSize} * ${node.depth - 1} + 4px)` // +4px for padding before button
95
+ "padding-left": `calc( ${FtReaderTocCssVariables.tabulationSize} * ${tabNumber} + 4px)` // +4px for padding before button
86
96
  };
87
97
  return html `
88
98
  <div class="ft-reader-toc--node ${isHighlighted ? "ft-reader-toc--node-highlighted" : ""}">
@@ -175,6 +185,9 @@ __decorate([
175
185
  __decorate([
176
186
  property()
177
187
  ], FtReaderToc.prototype, "scope", void 0);
188
+ __decorate([
189
+ property({ type: Boolean })
190
+ ], FtReaderToc.prototype, "hideIfEmpty", void 0);
178
191
  __decorate([
179
192
  property({ type: Boolean, reflect: true })
180
193
  ], 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.hasTextContent()||0===this.getLabel().trim().length||this.hideTooltip?t:e.html`
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
- `}resolveIcon(){return this.loading?e.html`
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,22 +609,29 @@ 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 !important;
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)))}
616
623
  </div>
617
- `}getToc(){var t;return this.isCurrentPageToc?this.splitToc?null===(t=this.currentPage)||void 0===t?void 0:t.toc:void 0:this.toc}renderNode(t){var i,n;const r=!this.isCurrentPageToc&&this.splitToc&&null!=t.page&&!t.page.onItsOwn,a=!this.isCurrentPageToc&&this.splitToc?(null===(i=this.currentPage)||void 0===i?void 0:i.rootTocId)===t.tocId:null===(n=this.visibleTopics)||void 0===n?void 0:n.includes(t.tocId),l=this.expanded||this.manuallyExpandedNodes.has(t.tocId)||this.automaticallyExpandedNodes.has(t.tocId)&&!this.manuallyCollapsedNodes.has(t.tocId),h=(this.isCurrentPageToc||!r)&&t.children.length>0,p=h&&!this.expanded,f={"padding-left":`calc( ${le.tabulationSize} * ${t.depth-1} + 4px)`};return e.html`
618
- <div class="ft-reader-toc--node ${a?"ft-reader-toc--node-highlighted":""}">
619
- <div class="ft-reader-toc--link-container" data-depth="${t.depth}" style=${s.styleMap(f)}>
624
+ `}getToc(){var t;return this.isCurrentPageToc?this.splitToc?null===(t=this.currentPage)||void 0===t?void 0:t.toc:void 0:this.toc}renderNode(t){var i,n,r,a;const l=!this.isCurrentPageToc&&this.splitToc&&null!=t.page&&!t.page.onItsOwn,h=!this.isCurrentPageToc&&this.splitToc?(null===(i=this.currentPage)||void 0===i?void 0:i.rootTocId)===t.tocId:null===(n=this.visibleTopics)||void 0===n?void 0:n.includes(t.tocId),p=this.expanded||this.manuallyExpandedNodes.has(t.tocId)||this.automaticallyExpandedNodes.has(t.tocId)&&!this.manuallyCollapsedNodes.has(t.tocId),f=(this.isCurrentPageToc||!l)&&t.children.length>0,d=f&&!this.expanded,c=this.isCurrentPageToc?(null!==(a=null===(r=this.currentPage)||void 0===r?void 0:r.breadcrumb.length)&&void 0!==a?a:0)+1:0,u=t.depth-1-c,g={"padding-left":`calc( ${le.tabulationSize} * ${u} + 4px)`};return e.html`
625
+ <div class="ft-reader-toc--node ${h?"ft-reader-toc--node-highlighted":""}">
626
+ <div class="ft-reader-toc--link-container" data-depth="${t.depth}" style=${s.styleMap(g)}>
620
627
  <div class="ft-reader-toc--toggle-container">
621
- ${p?e.html`
628
+ ${d?e.html`
622
629
  <ft-button round hideTooltip
623
630
  ?dense=${this.viewportSize!==te.S}
624
- label="${this.labelResolver.resolve(l?"collapse":"expand",t.title)}"
631
+ label="${this.labelResolver.resolve(p?"collapse":"expand",t.title)}"
625
632
  iconVariant="${this.iconVariant}"
626
- icon="${l?this.collapseIcon:this.expandIcon}"
627
- @click=${()=>this.manuallyToggle(t.tocId,l)}
633
+ icon="${p?this.collapseIcon:this.expandIcon}"
634
+ @click=${()=>this.manuallyToggle(t.tocId,p)}
628
635
  data-expand-node="${t.tocId}"
629
636
  >
630
637
  </ft-button>
@@ -636,10 +643,10 @@ const G=Symbol.for(""),K=t=>{if((null==t?void 0:t.r)===G)return null==t?void 0:t
636
643
  <ft-typography variant="body2">${t.title}</ft-typography>
637
644
  </ft-reader-internal-link>
638
645
  </div>
639
- ${h?e.html`
646
+ ${f?e.html`
640
647
  <div class="ft-reader-toc--node-children">
641
- ${l?o.repeat(t.children,(t=>t.tocId),(t=>this.renderNode(t))):e.nothing}
648
+ ${p?o.repeat(t.children,(t=>t.tocId),(t=>this.renderNode(t))):e.nothing}
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);
@@ -39,7 +39,7 @@ if(!ShadowRoot.prototype.createElement){const t=window.HTMLElement,e=window.cust
39
39
  * @license
40
40
  * Copyright 2021 Google LLC
41
41
  * SPDX-License-Identifier: BSD-3-Clause
42
- */var a;const l=null!=(null===(a=window.HTMLSlotElement)||void 0===a?void 0:a.prototype.assignedElements)?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter((t=>t.nodeType===Node.ELEMENT_NODE));const h=t=>e=>{window.customElements.get(t)||window.customElements.define(t,e)};function c(t,e){const i=()=>JSON.parse(JSON.stringify(t));return o({type:Object,converter:{fromAttribute:t=>{if(null==t)return i();try{return JSON.parse(t)}catch{return i()}},toAttribute:t=>JSON.stringify(t)},...null!=e?e:{}})}function p(t,e){if(t===e)return!0;if(t&&e&&"object"==typeof t&&"object"==typeof e){if(t.constructor!==e.constructor)return!1;var i,o,n;if(Array.isArray(t)){if((i=t.length)!=e.length)return!1;for(o=i;0!=o--;)if(!p(t[o],e[o]))return!1;return!0}if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(o of t.entries())if(!e.has(o[0]))return!1;for(o of t.entries())if(!p(o[1],e.get(o[0])))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(o of t.entries())if(!e.has(o[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if((i=(n=Object.keys(t)).length)!==Object.keys(e).length)return!1;for(o=i;0!=o--;)if(!Object.prototype.hasOwnProperty.call(e,n[o]))return!1;for(o=i;0!=o--;){var r=n[o];if(!p(t[r],e[r]))return!1}return!0}return t!=t&&e!=e}
42
+ */var a;const l=null!=(null===(a=window.HTMLSlotElement)||void 0===a?void 0:a.prototype.assignedElements)?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter((t=>t.nodeType===Node.ELEMENT_NODE));const h=t=>e=>{window.customElements.get(t)||window.customElements.define(t,e)};function c(t,e){const i=()=>JSON.parse(JSON.stringify(t));return o({type:Object,converter:{fromAttribute:t=>{if(null==t)return i();try{return JSON.parse(t)}catch{return i()}},toAttribute:t=>JSON.stringify(t)},...null!=e?e:{}})}function p(t,e){try{return function(t,e){if(t===e)return!0;if(t&&e&&"object"==typeof t&&"object"==typeof e){if(t.constructor!==e.constructor)return!1;var i,o,n;if(Array.isArray(t)){if((i=t.length)!=e.length)return!1;for(o=i;0!=o--;)if(!p(t[o],e[o]))return!1;return!0}if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(o of t.entries())if(!e.has(o[0]))return!1;for(o of t.entries())if(!p(o[1],e.get(o[0])))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(o of t.entries())if(!e.has(o[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if((i=(n=Object.keys(t)).length)!==Object.keys(e).length)return!1;for(o=i;0!=o--;)if(!Object.prototype.hasOwnProperty.call(e,n[o]))return!1;for(o=i;0!=o--;){var r=n[o];if(!p(t[r],e[r]))return!1}return!0}return t!=t&&e!=e}(t,e)}catch(t){return!1}}
43
43
  /**
44
44
  * @license
45
45
  * Copyright 2019 Google LLC
@@ -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.hasTextContent()||0===this.getLabel().trim().length||this.hideTooltip?t:Z`
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
- `}resolveIcon(){return this.loading?Z`
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,22 +730,29 @@ 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 !important;
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)))}
737
744
  </div>
738
- `}getToc(){var t;return this.isCurrentPageToc?this.splitToc?null===(t=this.currentPage)||void 0===t?void 0:t.toc:void 0:this.toc}renderNode(t){var e,i;const o=!this.isCurrentPageToc&&this.splitToc&&null!=t.page&&!t.page.onItsOwn,n=!this.isCurrentPageToc&&this.splitToc?(null===(e=this.currentPage)||void 0===e?void 0:e.rootTocId)===t.tocId:null===(i=this.visibleTopics)||void 0===i?void 0:i.includes(t.tocId),r=this.expanded||this.manuallyExpandedNodes.has(t.tocId)||this.automaticallyExpandedNodes.has(t.tocId)&&!this.manuallyCollapsedNodes.has(t.tocId),s=(this.isCurrentPageToc||!o)&&t.children.length>0,a=s&&!this.expanded,l={"padding-left":`calc( ${ho.tabulationSize} * ${t.depth-1} + 4px)`};return Z`
739
- <div class="ft-reader-toc--node ${n?"ft-reader-toc--node-highlighted":""}">
740
- <div class="ft-reader-toc--link-container" data-depth="${t.depth}" style=${It(l)}>
745
+ `}getToc(){var t;return this.isCurrentPageToc?this.splitToc?null===(t=this.currentPage)||void 0===t?void 0:t.toc:void 0:this.toc}renderNode(t){var e,i,o,n;const r=!this.isCurrentPageToc&&this.splitToc&&null!=t.page&&!t.page.onItsOwn,s=!this.isCurrentPageToc&&this.splitToc?(null===(e=this.currentPage)||void 0===e?void 0:e.rootTocId)===t.tocId:null===(i=this.visibleTopics)||void 0===i?void 0:i.includes(t.tocId),a=this.expanded||this.manuallyExpandedNodes.has(t.tocId)||this.automaticallyExpandedNodes.has(t.tocId)&&!this.manuallyCollapsedNodes.has(t.tocId),l=(this.isCurrentPageToc||!r)&&t.children.length>0,h=l&&!this.expanded,c=this.isCurrentPageToc?(null!==(n=null===(o=this.currentPage)||void 0===o?void 0:o.breadcrumb.length)&&void 0!==n?n:0)+1:0,p=t.depth-1-c,d={"padding-left":`calc( ${ho.tabulationSize} * ${p} + 4px)`};return Z`
746
+ <div class="ft-reader-toc--node ${s?"ft-reader-toc--node-highlighted":""}">
747
+ <div class="ft-reader-toc--link-container" data-depth="${t.depth}" style=${It(d)}>
741
748
  <div class="ft-reader-toc--toggle-container">
742
- ${a?Z`
749
+ ${h?Z`
743
750
  <ft-button round hideTooltip
744
751
  ?dense=${this.viewportSize!==eo.S}
745
- label="${this.labelResolver.resolve(r?"collapse":"expand",t.title)}"
752
+ label="${this.labelResolver.resolve(a?"collapse":"expand",t.title)}"
746
753
  iconVariant="${this.iconVariant}"
747
- icon="${r?this.collapseIcon:this.expandIcon}"
748
- @click=${()=>this.manuallyToggle(t.tocId,r)}
754
+ icon="${a?this.collapseIcon:this.expandIcon}"
755
+ @click=${()=>this.manuallyToggle(t.tocId,a)}
749
756
  data-expand-node="${t.tocId}"
750
757
  >
751
758
  </ft-button>
@@ -757,10 +764,10 @@ function(t,e,i){let o,n=t;return"object"==typeof t?(n=t.slot,o=t):o={flatten:e},
757
764
  <ft-typography variant="body2">${t.title}</ft-typography>
758
765
  </ft-reader-internal-link>
759
766
  </div>
760
- ${s?Z`
767
+ ${l?Z`
761
768
  <div class="ft-reader-toc--node-children">
762
- ${r?Lt(t.children,(t=>t.tocId),(t=>this.renderNode(t))):J}
769
+ ${a?Lt(t.children,(t=>t.tocId),(t=>this.renderNode(t))):J}
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})}({});
@@ -6,6 +6,7 @@ export interface FtReaderTocProperties {
6
6
  collapseIcon?: string;
7
7
  expandIcon?: string;
8
8
  autoCollapse?: boolean;
9
+ hideIfEmpty?: boolean;
9
10
  scope?: "pages" | "current-page";
10
11
  }
11
12
  export interface FtReaderTocLabels extends ParametrizedLabels {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-toc",
3
- "version": "0.3.16",
3
+ "version": "0.3.18",
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.16",
23
- "@fluid-topics/ft-reader-context": "0.3.16",
24
- "@fluid-topics/ft-size-watcher": "0.3.16",
25
- "@fluid-topics/ft-typography": "0.3.16",
26
- "@fluid-topics/ft-wc-utils": "0.3.16",
22
+ "@fluid-topics/ft-icon": "0.3.18",
23
+ "@fluid-topics/ft-reader-context": "0.3.18",
24
+ "@fluid-topics/ft-size-watcher": "0.3.18",
25
+ "@fluid-topics/ft-typography": "0.3.18",
26
+ "@fluid-topics/ft-wc-utils": "0.3.18",
27
27
  "lit": "2.2.8"
28
28
  },
29
- "gitHead": "0d05a101f09cb5819ee10930772a873e7e0cc87b"
29
+ "gitHead": "33fac246cb4042276b1804479304a2c8fe0f8e3f"
30
30
  }