@fluid-topics/ft-reader-breadcrumbs 1.3.54 → 1.3.56
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.
|
@@ -15,6 +15,8 @@ export declare class FtReaderBreadcrumbs extends FtReaderBreadcrumbs_base implem
|
|
|
15
15
|
floatingMenuEndOffset?: number;
|
|
16
16
|
private tocId?;
|
|
17
17
|
private mapTitle?;
|
|
18
|
+
private toc?;
|
|
19
|
+
private translationLoading?;
|
|
18
20
|
private breadcrumb;
|
|
19
21
|
private ftFloatingMenu?;
|
|
20
22
|
constructor();
|
|
@@ -26,5 +28,6 @@ export declare class FtReaderBreadcrumbs extends FtReaderBreadcrumbs_base implem
|
|
|
26
28
|
private renderSeparator;
|
|
27
29
|
private renderBreadcrumbLink;
|
|
28
30
|
private renderBreadcrumbCurrentItem;
|
|
31
|
+
private renderLoader;
|
|
29
32
|
}
|
|
30
33
|
export {};
|
|
@@ -9,7 +9,7 @@ import { property, query, state } from "lit/decorators.js";
|
|
|
9
9
|
import { repeat } from "lit/directives/repeat.js";
|
|
10
10
|
import { when } from "lit/directives/when.js";
|
|
11
11
|
import { classMap } from "lit/directives/class-map.js";
|
|
12
|
-
import { redux } from "@fluid-topics/ft-wc-utils";
|
|
12
|
+
import { numberProperty, redux } from "@fluid-topics/ft-wc-utils";
|
|
13
13
|
import { styles } from "./ft-reader-breadcrumbs.styles";
|
|
14
14
|
import { FtReaderComponent } from "@fluid-topics/ft-reader-context/build/registration";
|
|
15
15
|
import { FtReaderInternalLink } from "@fluid-topics/ft-reader-internal-link";
|
|
@@ -19,6 +19,7 @@ import { FtFloatingMenu, FtFloatingMenuItem } from "@fluid-topics/ft-floating-me
|
|
|
19
19
|
import { withI18n } from "@fluid-topics/ft-i18n";
|
|
20
20
|
import { readerBreadcrumbsContext, readerBreadcrumbsDefaultMessages } from "./ReaderBreadcrumbsMessages";
|
|
21
21
|
import { FtRipple } from "@fluid-topics/ft-ripple";
|
|
22
|
+
import { FtSkeleton } from "@fluid-topics/ft-skeleton";
|
|
22
23
|
class FtReaderBreadcrumbs extends withI18n(FtReaderComponent) {
|
|
23
24
|
constructor() {
|
|
24
25
|
super();
|
|
@@ -29,8 +30,8 @@ class FtReaderBreadcrumbs extends withI18n(FtReaderComponent) {
|
|
|
29
30
|
willUpdate(props) {
|
|
30
31
|
var _a, _b, _c;
|
|
31
32
|
super.willUpdate(props);
|
|
32
|
-
if (props.has(
|
|
33
|
-
this.breadcrumb = (_b = (_a = this.
|
|
33
|
+
if (["tocId", "toc"].some(p => props.has(p)) && this.tocId !== undefined) {
|
|
34
|
+
this.breadcrumb = (_b = (_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.buildBreadcrumb(this.tocId)) !== null && _b !== void 0 ? _b : [];
|
|
34
35
|
}
|
|
35
36
|
if (props.has("breadcrumb")) {
|
|
36
37
|
(_c = this.ftFloatingMenu) === null || _c === void 0 ? void 0 : _c.closeMenu();
|
|
@@ -70,7 +71,7 @@ class FtReaderBreadcrumbs extends withI18n(FtReaderComponent) {
|
|
|
70
71
|
const isLastElement = index === breadcrumbs.length - 1;
|
|
71
72
|
return html `
|
|
72
73
|
<li>
|
|
73
|
-
${when(isLastElement && displayLastElementAsCurrent, () => this.renderBreadcrumbCurrentItem(breadcrumb), () => this.renderBreadcrumbLink(breadcrumb))}
|
|
74
|
+
${when(this.translationLoading, () => this.renderLoader(), () => when(isLastElement && displayLastElementAsCurrent, () => this.renderBreadcrumbCurrentItem(breadcrumb), () => this.renderBreadcrumbLink(breadcrumb)))}
|
|
74
75
|
</li>
|
|
75
76
|
${isLastElement ? nothing : this.renderSeparator()}`;
|
|
76
77
|
});
|
|
@@ -120,6 +121,10 @@ class FtReaderBreadcrumbs extends withI18n(FtReaderComponent) {
|
|
|
120
121
|
${breadcrumb.title}
|
|
121
122
|
</ft-typography>`;
|
|
122
123
|
}
|
|
124
|
+
renderLoader() {
|
|
125
|
+
return html `
|
|
126
|
+
<ft-skeleton part="loader"></ft-skeleton>`;
|
|
127
|
+
}
|
|
123
128
|
}
|
|
124
129
|
FtReaderBreadcrumbs.elementDefinitions = {
|
|
125
130
|
"ft-typography": FtTypography,
|
|
@@ -127,6 +132,7 @@ FtReaderBreadcrumbs.elementDefinitions = {
|
|
|
127
132
|
"ft-floating-menu": FtFloatingMenu,
|
|
128
133
|
"ft-floating-menu-item": FtFloatingMenuItem,
|
|
129
134
|
"ft-ripple": FtRipple,
|
|
135
|
+
"ft-skeleton": FtSkeleton,
|
|
130
136
|
};
|
|
131
137
|
FtReaderBreadcrumbs.styles = styles;
|
|
132
138
|
__decorate([
|
|
@@ -142,13 +148,13 @@ __decorate([
|
|
|
142
148
|
property({ type: Boolean })
|
|
143
149
|
], FtReaderBreadcrumbs.prototype, "useFloatingMenu", void 0);
|
|
144
150
|
__decorate([
|
|
145
|
-
|
|
151
|
+
numberProperty()
|
|
146
152
|
], FtReaderBreadcrumbs.prototype, "floatingMenuThreshold", void 0);
|
|
147
153
|
__decorate([
|
|
148
|
-
|
|
154
|
+
numberProperty()
|
|
149
155
|
], FtReaderBreadcrumbs.prototype, "floatingMenuStartOffset", void 0);
|
|
150
156
|
__decorate([
|
|
151
|
-
|
|
157
|
+
numberProperty()
|
|
152
158
|
], FtReaderBreadcrumbs.prototype, "floatingMenuEndOffset", void 0);
|
|
153
159
|
__decorate([
|
|
154
160
|
redux({
|
|
@@ -162,6 +168,15 @@ __decorate([
|
|
|
162
168
|
selector: (state) => { var _a; return (_a = state.map) === null || _a === void 0 ? void 0 : _a.title; },
|
|
163
169
|
})
|
|
164
170
|
], FtReaderBreadcrumbs.prototype, "mapTitle", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
redux({ store: "reader" })
|
|
173
|
+
], FtReaderBreadcrumbs.prototype, "toc", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
redux({
|
|
176
|
+
store: "reader",
|
|
177
|
+
selector: (state) => state.translation.isLoading
|
|
178
|
+
})
|
|
179
|
+
], FtReaderBreadcrumbs.prototype, "translationLoading", void 0);
|
|
165
180
|
__decorate([
|
|
166
181
|
state()
|
|
167
182
|
], FtReaderBreadcrumbs.prototype, "breadcrumb", void 0);
|