@fluid-topics/ft-reader-toc 2.2.17 → 2.2.19
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.
|
@@ -19,12 +19,13 @@ import { FtChip } from "@fluid-topics/ft-chip";
|
|
|
19
19
|
import { state } from "lit/decorators.js";
|
|
20
20
|
export class FtReaderAccessibleToc extends FtReaderBaseToc {
|
|
21
21
|
willUpdate(props) {
|
|
22
|
-
var _a, _b
|
|
22
|
+
var _a, _b;
|
|
23
|
+
var _c;
|
|
23
24
|
super.willUpdate(props);
|
|
24
25
|
if (props.has("toc") || props.has("highlightedTocIds")) {
|
|
25
|
-
const allTocIds = (
|
|
26
|
+
const allTocIds = (_c = (_a = this.toc) === null || _a === void 0 ? void 0 : _a.flatMap((t) => this.allTocIds(t))) !== null && _c !== void 0 ? _c : [];
|
|
26
27
|
for (const tocId of allTocIds) {
|
|
27
|
-
if ((
|
|
28
|
+
if ((_b = this.highlightedTocIds) === null || _b === void 0 ? void 0 : _b.includes(tocId)) {
|
|
28
29
|
this.currentTocNode = tocId;
|
|
29
30
|
break;
|
|
30
31
|
}
|
|
@@ -35,7 +36,8 @@ export class FtReaderAccessibleToc extends FtReaderBaseToc {
|
|
|
35
36
|
return [toc.tocId, ...(toc.children.flatMap((t) => this.allTocIds(t)))];
|
|
36
37
|
}
|
|
37
38
|
render() {
|
|
38
|
-
var _a
|
|
39
|
+
var _a;
|
|
40
|
+
var _b;
|
|
39
41
|
return html `
|
|
40
42
|
<div class="${classMap(this.tocClasses)}" part="container">
|
|
41
43
|
<ft-size-watcher @change=${this.onViewportSizeChange}></ft-size-watcher>
|
|
@@ -47,12 +49,13 @@ export class FtReaderAccessibleToc extends FtReaderBaseToc {
|
|
|
47
49
|
`;
|
|
48
50
|
}
|
|
49
51
|
renderNode(node) {
|
|
50
|
-
var _a, _b, _c
|
|
52
|
+
var _a, _b, _c;
|
|
53
|
+
var _d;
|
|
51
54
|
const isHighlighted = (_a = this.highlightedTocIds) === null || _a === void 0 ? void 0 : _a.includes(node.tocId);
|
|
52
55
|
const isCurrent = node.tocId === this.currentTocNode;
|
|
53
56
|
const isExpanded = this.nodeIsExpanded(node);
|
|
54
57
|
const canDisplayChildren = node.children.length > 0;
|
|
55
|
-
const currentPageDepth = this.isCurrentPageToc ? ((
|
|
58
|
+
const currentPageDepth = this.isCurrentPageToc ? ((_d = (_b = this.currentPage) === null || _b === void 0 ? void 0 : _b.breadcrumb.length) !== null && _d !== void 0 ? _d : 0) + 1 : 0;
|
|
56
59
|
const tabNumber = node.depth - 1 - currentPageDepth;
|
|
57
60
|
const styles = {
|
|
58
61
|
"padding-left": `calc( ${FtReaderTocCssVariables.tabulationSize} * ${tabNumber} + 4px)`, // +4px for padding before button
|
|
@@ -68,7 +71,7 @@ export class FtReaderAccessibleToc extends FtReaderBaseToc {
|
|
|
68
71
|
<a part="node-link ${node.contentClass ? `node-link-class-${node.contentClass}` : ""}"
|
|
69
72
|
class="ft-reader-toc--node-link"
|
|
70
73
|
style="${styleMap(styles)}"
|
|
71
|
-
href="${(
|
|
74
|
+
href="${(_c = this.service) === null || _c === void 0 ? void 0 : _c.getLinkWithFilter(node.tocId)}"
|
|
72
75
|
tabindex="${isCurrent ? "0" : "-1"}"
|
|
73
76
|
data-tocId="${node.tocId}"
|
|
74
77
|
data-depth="${node.depth}"
|
|
@@ -190,7 +193,8 @@ export class FtReaderAccessibleToc extends FtReaderBaseToc {
|
|
|
190
193
|
}
|
|
191
194
|
}
|
|
192
195
|
get allLinks() {
|
|
193
|
-
var _a
|
|
196
|
+
var _a;
|
|
197
|
+
var _b;
|
|
194
198
|
return Array.from((_b = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll("[part~=\"node-link\"]")) !== null && _b !== void 0 ? _b : []);
|
|
195
199
|
}
|
|
196
200
|
selectNextNode(target, nodes) {
|
|
@@ -49,13 +49,13 @@ export declare abstract class FtReaderBaseToc extends FtReaderBaseToc_base imple
|
|
|
49
49
|
"ft-reader-toc-loaded": boolean;
|
|
50
50
|
"ft-reader-toc-expanded": boolean;
|
|
51
51
|
};
|
|
52
|
-
protected renderExpandCollapseAll(): TemplateResult<1
|
|
52
|
+
protected renderExpandCollapseAll(): typeof nothing | TemplateResult<1>;
|
|
53
53
|
protected abstract renderNode(node: TocNode): TemplateResult;
|
|
54
54
|
protected buildAutomaticallyExpandedNodes(tocIdsToShow: Array<string>): Set<string>;
|
|
55
55
|
protected manuallyToggle(tocId: string, isExpanded: boolean, e?: MouseEvent): void;
|
|
56
56
|
protected onViewportSizeChange(event: FtSizeChangeEvent): void;
|
|
57
57
|
protected toggleExpandCollapseAll(): void;
|
|
58
|
-
protected getExpandCollapseAllTooltipPosition(): "
|
|
58
|
+
protected getExpandCollapseAllTooltipPosition(): "bottom" | "left" | "right";
|
|
59
59
|
protected getLeafNodeIcon(): TemplateResult<1>;
|
|
60
60
|
}
|
|
61
61
|
export {};
|
|
@@ -225,12 +225,9 @@ __decorate([
|
|
|
225
225
|
], FtReaderBaseToc.prototype, "currentPage", void 0);
|
|
226
226
|
__decorate([
|
|
227
227
|
redux({
|
|
228
|
-
selector: (s, self) => {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
? (((_b = s.currentPage) === null || _b === void 0 ? void 0 : _b.rootTocId) ? [s.currentPage.rootTocId] : [])
|
|
232
|
-
: s.visibleTopics;
|
|
233
|
-
},
|
|
228
|
+
selector: (s, self) => { var _a, _b; return ((_a = s.paginationConfiguration) === null || _a === void 0 ? void 0 : _a.splitCurrentPageToc) && !self.isCurrentPageToc
|
|
229
|
+
? (((_b = s.currentPage) === null || _b === void 0 ? void 0 : _b.rootTocId) ? [s.currentPage.rootTocId] : [])
|
|
230
|
+
: s.visibleTopics; },
|
|
234
231
|
})
|
|
235
232
|
], FtReaderBaseToc.prototype, "highlightedTocIds", void 0);
|
|
236
233
|
__decorate([
|
package/build/ft-reader-toc.js
CHANGED
|
@@ -13,7 +13,8 @@ import { FtReaderBaseToc } from "./ft-reader-base-toc";
|
|
|
13
13
|
import { classMap } from "lit/directives/class-map.js";
|
|
14
14
|
export class FtReaderToc extends FtReaderBaseToc {
|
|
15
15
|
render() {
|
|
16
|
-
var _a
|
|
16
|
+
var _a;
|
|
17
|
+
var _b;
|
|
17
18
|
return html `
|
|
18
19
|
<div class="${classMap(this.tocClasses)}" role="tree" aria-label="${(_a = this.currentPage) === null || _a === void 0 ? void 0 : _a.title}">
|
|
19
20
|
<ft-size-watcher @change=${this.onViewportSizeChange}></ft-size-watcher>
|
|
@@ -23,7 +24,8 @@ export class FtReaderToc extends FtReaderBaseToc {
|
|
|
23
24
|
`;
|
|
24
25
|
}
|
|
25
26
|
renderNode(node) {
|
|
26
|
-
var _a, _b
|
|
27
|
+
var _a, _b;
|
|
28
|
+
var _c;
|
|
27
29
|
const isHighlighted = (_a = this.highlightedTocIds) === null || _a === void 0 ? void 0 : _a.includes(node.tocId);
|
|
28
30
|
const isExpanded = this.nodeIsExpanded(node);
|
|
29
31
|
const canDisplayChildren = node.children.length > 0;
|