@fluid-topics/ft-reader-saved-bookmarks 1.3.15 → 1.3.16
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
|
|
2
2
|
import { FtReaderSavedBookmarksProperties } from "./ft-reader-saved-bookmarks.properties";
|
|
3
|
-
import { FtReaderComponent, FtReaderState } from "@fluid-topics/ft-reader-context/build/registration";
|
|
3
|
+
import { FtReaderComponent, FtReaderState, FtReaderTocNode } from "@fluid-topics/ft-reader-context/build/registration";
|
|
4
4
|
import { FtBookmark } from "@fluid-topics/public-api";
|
|
5
5
|
declare const FtReaderSavedBookmarks_base: typeof FtReaderComponent & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface>;
|
|
6
6
|
export declare class FtReaderSavedBookmarks extends FtReaderSavedBookmarks_base implements FtReaderSavedBookmarksProperties {
|
|
@@ -12,6 +12,7 @@ export declare class FtReaderSavedBookmarks extends FtReaderSavedBookmarks_base
|
|
|
12
12
|
private mapId?;
|
|
13
13
|
constructor();
|
|
14
14
|
get bookmarksTocIds(): string[];
|
|
15
|
+
static flattenTocNode(node: FtReaderTocNode): string[];
|
|
15
16
|
static filterRemainingTocIdsInBookmarks(s: FtReaderState, self: FtReaderSavedBookmarks): string[] | undefined;
|
|
16
17
|
render(): import("lit-html").TemplateResult<1>;
|
|
17
18
|
private isAbsentFromToc;
|
|
@@ -31,9 +31,16 @@ class FtReaderSavedBookmarks extends withI18n(FtReaderComponent) {
|
|
|
31
31
|
get bookmarksTocIds() {
|
|
32
32
|
return this.bookmarks.map((b) => b.tocId);
|
|
33
33
|
}
|
|
34
|
+
static flattenTocNode(node) {
|
|
35
|
+
const ids = [node.tocId];
|
|
36
|
+
for (const childNode of node.children) {
|
|
37
|
+
ids.push(...this.flattenTocNode(childNode));
|
|
38
|
+
}
|
|
39
|
+
return ids;
|
|
40
|
+
}
|
|
34
41
|
static filterRemainingTocIdsInBookmarks(s, self) {
|
|
35
42
|
var _a;
|
|
36
|
-
return (_a = s.toc) === null || _a === void 0 ? void 0 : _a.filter((
|
|
43
|
+
return (_a = s.toc) === null || _a === void 0 ? void 0 : _a.map((n) => FtReaderSavedBookmarks.flattenTocNode(n)).flat().filter((tocId) => self.bookmarksTocIds.indexOf(tocId) >= 0);
|
|
37
44
|
}
|
|
38
45
|
render() {
|
|
39
46
|
return html `
|