@fluid-topics/ft-reader-toc 0.3.11 → 0.3.13
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.css.d.ts +11 -0
- package/build/ft-reader-toc.css.js +48 -0
- package/build/ft-reader-toc.d.ts +4 -22
- package/build/ft-reader-toc.js +16 -56
- package/build/ft-reader-toc.light.js +472 -473
- package/build/ft-reader-toc.min.js +483 -484
- package/build/ft-reader-toc.properties.d.ts +15 -0
- package/build/ft-reader-toc.properties.js +5 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +2 -0
- package/package.json +7 -7
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const FtReaderTocCssVariables: {
|
|
2
|
+
tabulationSize: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
3
|
+
verticalSpacing: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
4
|
+
textColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
5
|
+
highlightedTextColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
6
|
+
highlightedFontWeight: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
7
|
+
highlightedBackgroundColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
8
|
+
iconFontSize: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
9
|
+
};
|
|
10
|
+
export declare const styles: import("lit").CSSResult;
|
|
11
|
+
//# sourceMappingURL=ft-reader-toc.css.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
import { designSystemVariables, FtCssVariableFactory, setVariable } from "@fluid-topics/ft-wc-utils";
|
|
3
|
+
import { FtTypographyCssVariables } from "@fluid-topics/ft-typography/build/ft-typography.css";
|
|
4
|
+
import { FtButtonCssVariables } from "@fluid-topics/ft-button/build/ft-button.css";
|
|
5
|
+
export const FtReaderTocCssVariables = {
|
|
6
|
+
tabulationSize: FtCssVariableFactory.create("--ft-reader-toc-tabulation-size", "SIZE", "16px"),
|
|
7
|
+
verticalSpacing: FtCssVariableFactory.create("--ft-reader-toc-vertical-spacing", "SIZE", "4px"),
|
|
8
|
+
textColor: FtCssVariableFactory.extend("--ft-reader-toc-text-color", designSystemVariables.colorOnSurface),
|
|
9
|
+
highlightedTextColor: FtCssVariableFactory.extend("--ft-reader-toc-highlighted-text-color", designSystemVariables.colorPrimary),
|
|
10
|
+
highlightedFontWeight: FtCssVariableFactory.create("--ft-reader-toc-highlighted-font-weight", "UNKNOWN", "bold"),
|
|
11
|
+
highlightedBackgroundColor: FtCssVariableFactory.create("--ft-reader-toc-highlighted-background-color", "COLOR", "transparent"),
|
|
12
|
+
iconFontSize: FtCssVariableFactory.create("--ft-reader-toc-icon-font-size", "SIZE", "16px"),
|
|
13
|
+
};
|
|
14
|
+
// language=CSS
|
|
15
|
+
export const styles = css `
|
|
16
|
+
.ft-reader-toc {
|
|
17
|
+
color: ${FtReaderTocCssVariables.textColor};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.ft-reader-toc--node-highlighted > .ft-reader-toc--link-container {
|
|
21
|
+
background-color: ${FtReaderTocCssVariables.highlightedBackgroundColor};
|
|
22
|
+
color: ${FtReaderTocCssVariables.highlightedTextColor};
|
|
23
|
+
${setVariable(FtTypographyCssVariables.fontWeight, FtReaderTocCssVariables.highlightedFontWeight)}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ft-reader-toc--link-container {
|
|
27
|
+
display: flex;
|
|
28
|
+
gap: 4px;
|
|
29
|
+
padding: ${FtReaderTocCssVariables.verticalSpacing} 4px; /* left padding is override on inline style */
|
|
30
|
+
align-items: center;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ft-reader-toc-mobile .ft-reader-toc--toggle-container {
|
|
34
|
+
flex-shrink: 0;
|
|
35
|
+
width: calc(${FtReaderTocCssVariables.iconFontSize} + 12px); /*--ft-button-internal-horizontal-padding: 8px; in ft-button NOT dense*/
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.ft-reader-toc-desktop .ft-reader-toc--toggle-container {
|
|
39
|
+
flex-shrink: 0;
|
|
40
|
+
width: calc(${FtReaderTocCssVariables.iconFontSize} + 4px); /*--ft-button-internal-horizontal-padding: 4px; in ft-button dense*/
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
ft-button {
|
|
44
|
+
${setVariable(FtButtonCssVariables.iconSize, FtReaderTocCssVariables.iconFontSize)};
|
|
45
|
+
${setVariable(FtButtonCssVariables.backgroundColor, "transparent")};
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
//# sourceMappingURL=ft-reader-toc.css.js.map
|
package/build/ft-reader-toc.d.ts
CHANGED
|
@@ -1,31 +1,13 @@
|
|
|
1
1
|
import { PropertyValues, TemplateResult } from "lit";
|
|
2
|
-
import { ElementDefinitionsMap
|
|
2
|
+
import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
|
|
3
3
|
import { FtReaderComponent } from "@fluid-topics/ft-reader-context/build/registration";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
collapseIcon?: string;
|
|
7
|
-
expandIcon?: string;
|
|
8
|
-
autoCollapse?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface FtReaderTocLabels extends ParametrizedLabels {
|
|
11
|
-
expand?: string;
|
|
12
|
-
collapse?: string;
|
|
13
|
-
}
|
|
14
|
-
export declare const DEFAULT_LABELS: FtReaderTocLabels;
|
|
15
|
-
export declare const FtReaderTocCssVariables: {
|
|
16
|
-
tabulationSize: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
17
|
-
verticalSpacing: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
18
|
-
textColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
19
|
-
highlightedTextColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
20
|
-
highlightedFontWeight: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
21
|
-
highlightedBackgroundColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
22
|
-
iconFontFamily: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
23
|
-
iconFontSize: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
24
|
-
};
|
|
4
|
+
import { FtIconVariants } from "@fluid-topics/ft-icon";
|
|
5
|
+
import { FtReaderTocLabels, FtReaderTocProperties } from "./ft-reader-toc.properties";
|
|
25
6
|
export declare class FtReaderToc extends FtReaderComponent implements FtReaderTocProperties {
|
|
26
7
|
static elementDefinitions: ElementDefinitionsMap;
|
|
27
8
|
static styles: import("lit").CSSResult;
|
|
28
9
|
expanded: boolean;
|
|
10
|
+
iconVariant: FtIconVariants;
|
|
29
11
|
collapseIcon: string;
|
|
30
12
|
expandIcon: string;
|
|
31
13
|
autoCollapse: boolean;
|
package/build/ft-reader-toc.js
CHANGED
|
@@ -4,36 +4,25 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
7
|
+
import { html, nothing } from "lit";
|
|
8
8
|
import { repeat } from "lit/directives/repeat.js";
|
|
9
9
|
import { classMap } from "lit/directives/class-map.js";
|
|
10
10
|
import { styleMap } from "lit/directives/style-map.js";
|
|
11
11
|
import { property, state } from "lit/decorators.js";
|
|
12
|
-
import { deepEqual,
|
|
12
|
+
import { deepEqual, jsonProperty, ParametrizedLabelResolver, redux } from "@fluid-topics/ft-wc-utils";
|
|
13
13
|
import { FtReaderComponent, } from "@fluid-topics/ft-reader-context/build/registration";
|
|
14
|
-
import { FtTypography
|
|
14
|
+
import { FtTypography } from "@fluid-topics/ft-typography";
|
|
15
15
|
import { FtReaderInternalLink } from "@fluid-topics/ft-reader-internal-link";
|
|
16
|
-
import {
|
|
17
|
-
import { FtButton
|
|
16
|
+
import { FtIconVariants } from "@fluid-topics/ft-icon";
|
|
17
|
+
import { FtButton } from "@fluid-topics/ft-button";
|
|
18
18
|
import { FtSizeCategory, FtSizeWatcher } from "@fluid-topics/ft-size-watcher";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
collapse: "Collapse {0}",
|
|
22
|
-
};
|
|
23
|
-
export const FtReaderTocCssVariables = {
|
|
24
|
-
tabulationSize: FtCssVariableFactory.create("--ft-reader-toc-tabulation-size", "SIZE", "16px"),
|
|
25
|
-
verticalSpacing: FtCssVariableFactory.create("--ft-reader-toc-vertical-spacing", "SIZE", "4px"),
|
|
26
|
-
textColor: FtCssVariableFactory.extend("--ft-reader-toc-text-color", designSystemVariables.colorOnSurface),
|
|
27
|
-
highlightedTextColor: FtCssVariableFactory.extend("--ft-reader-toc-highlighted-text-color", designSystemVariables.colorPrimary),
|
|
28
|
-
highlightedFontWeight: FtCssVariableFactory.create("--ft-reader-toc-highlighted-font-weight", "UNKNOWN", "bold"),
|
|
29
|
-
highlightedBackgroundColor: FtCssVariableFactory.create("--ft-reader-toc-highlighted-background-color", "COLOR", "transparent"),
|
|
30
|
-
iconFontFamily: FtCssVariableFactory.create("--ft-reader-toc-icon-font-family", "UNKNOWN", "ft-icons"),
|
|
31
|
-
iconFontSize: FtCssVariableFactory.create("--ft-reader-toc-icon-font-size", "SIZE", "16px"),
|
|
32
|
-
};
|
|
19
|
+
import { DEFAULT_LABELS } from "./ft-reader-toc.properties";
|
|
20
|
+
import { FtReaderTocCssVariables, styles } from "./ft-reader-toc.css";
|
|
33
21
|
export class FtReaderToc extends FtReaderComponent {
|
|
34
22
|
constructor() {
|
|
35
23
|
super(...arguments);
|
|
36
24
|
this.expanded = false;
|
|
25
|
+
this.iconVariant = FtIconVariants.fluid_topics;
|
|
37
26
|
this.collapseIcon = "MINUS";
|
|
38
27
|
this.expandIcon = "PLUS";
|
|
39
28
|
this.autoCollapse = false;
|
|
@@ -74,6 +63,7 @@ export class FtReaderToc extends FtReaderComponent {
|
|
|
74
63
|
const isHighlighted = 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);
|
|
75
64
|
const isExpanded = this.expanded || this.manuallyExpandedNodes.has(node.tocId) || (this.automaticallyExpandedNodes.has(node.tocId) && !this.manuallyCollapsedNodes.has(node.tocId));
|
|
76
65
|
const canDisplayChildren = !shouldSplit && node.children.length > 0;
|
|
66
|
+
const displayToggle = canDisplayChildren && !this.expanded;
|
|
77
67
|
const styles = {
|
|
78
68
|
"padding-left": `calc( ${FtReaderTocCssVariables.tabulationSize} * ${node.depth - 1} + 4px)` // +4px for padding before button
|
|
79
69
|
};
|
|
@@ -81,15 +71,15 @@ export class FtReaderToc extends FtReaderComponent {
|
|
|
81
71
|
<div class="ft-reader-toc--node ${isHighlighted ? "ft-reader-toc--node-highlighted" : ""}">
|
|
82
72
|
<div class="ft-reader-toc--link-container" data-depth="${node.depth}" style=${styleMap(styles)}>
|
|
83
73
|
<div class="ft-reader-toc--toggle-container">
|
|
84
|
-
${
|
|
74
|
+
${displayToggle
|
|
85
75
|
? html `
|
|
86
76
|
<ft-button round hideTooltip
|
|
87
77
|
?dense=${this.viewportSize !== FtSizeCategory.S}
|
|
88
78
|
label="${this.labelResolver.resolve(isExpanded ? "collapse" : "expand", node.title)}"
|
|
89
|
-
iconVariant="${
|
|
79
|
+
iconVariant="${this.iconVariant}"
|
|
90
80
|
icon="${(isExpanded ? this.collapseIcon : this.expandIcon)}"
|
|
91
81
|
@click=${() => this.manuallyToggle(node.tocId, isExpanded)}
|
|
92
|
-
data-expand-node
|
|
82
|
+
data-expand-node="${node.tocId}"
|
|
93
83
|
>
|
|
94
84
|
</ft-button>
|
|
95
85
|
`
|
|
@@ -148,43 +138,13 @@ FtReaderToc.elementDefinitions = {
|
|
|
148
138
|
"ft-typography": FtTypography,
|
|
149
139
|
};
|
|
150
140
|
// language=CSS
|
|
151
|
-
FtReaderToc.styles =
|
|
152
|
-
.ft-reader-toc {
|
|
153
|
-
color: ${FtReaderTocCssVariables.textColor};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.ft-reader-toc--node-highlighted > .ft-reader-toc--link-container {
|
|
157
|
-
background-color: ${FtReaderTocCssVariables.highlightedBackgroundColor};
|
|
158
|
-
color: ${FtReaderTocCssVariables.highlightedTextColor};
|
|
159
|
-
${setVariable(FtTypographyCssVariables.fontWeight, FtReaderTocCssVariables.highlightedFontWeight)}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.ft-reader-toc--link-container {
|
|
163
|
-
display: flex;
|
|
164
|
-
gap: 4px;
|
|
165
|
-
padding: ${FtReaderTocCssVariables.verticalSpacing} 4px; /* left padding is override on inline style */
|
|
166
|
-
align-items: center;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.ft-reader-toc-mobile .ft-reader-toc--toggle-container {
|
|
170
|
-
flex-shrink: 0;
|
|
171
|
-
width: calc(${FtReaderTocCssVariables.iconFontSize} + 12px); /*--ft-button-internal-horizontal-padding: 8px; in ft-button NOT dense*/
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.ft-reader-toc-desktop .ft-reader-toc--toggle-container {
|
|
175
|
-
flex-shrink: 0;
|
|
176
|
-
width: calc(${FtReaderTocCssVariables.iconFontSize} + 4px); /*--ft-button-internal-horizontal-padding: 4px; in ft-button dense*/
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
ft-button {
|
|
180
|
-
${setVariable(FtIconCssVariables.fluidTopicsFontFamily, FtReaderTocCssVariables.iconFontFamily)};
|
|
181
|
-
${setVariable(FtButtonCssVariables.iconSize, FtReaderTocCssVariables.iconFontSize)};
|
|
182
|
-
${setVariable(FtButtonCssVariables.backgroundColor, "transparent")};
|
|
183
|
-
}
|
|
184
|
-
`;
|
|
141
|
+
FtReaderToc.styles = styles;
|
|
185
142
|
__decorate([
|
|
186
143
|
property({ type: Boolean })
|
|
187
144
|
], FtReaderToc.prototype, "expanded", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
property()
|
|
147
|
+
], FtReaderToc.prototype, "iconVariant", void 0);
|
|
188
148
|
__decorate([
|
|
189
149
|
property()
|
|
190
150
|
], FtReaderToc.prototype, "collapseIcon", void 0);
|