@fluid-topics/ft-reader-context 1.4.4 → 1.4.5
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-context.js +3 -4
- package/build/ft-reader-context.light.js +6 -6
- package/build/ft-reader-context.min.js +15 -15
- package/build/store/FtReaderStateManager.js +1 -1
- package/build/store/redux.d.ts +0 -2
- package/build/store/redux.js +0 -3
- package/build/store/utils/FtReaderConverter.js +15 -15
- package/package.json +4 -4
|
@@ -227,7 +227,7 @@ export class FtReaderStateManager {
|
|
|
227
227
|
} : undefined;
|
|
228
228
|
}
|
|
229
229
|
setLinkPreviewDialogId(linkPreviewDialogId) {
|
|
230
|
-
this.store.actions.
|
|
230
|
+
this.store.actions.linkPreviewDialogId(linkPreviewDialogId);
|
|
231
231
|
}
|
|
232
232
|
async fetchMapRating() {
|
|
233
233
|
var _a;
|
package/build/store/redux.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ declare const readerStoreStateReducers: {
|
|
|
8
8
|
setTranslationLoading: (state: FtReaderState, action: PayloadAction<FtReaderState["translation"]["isLoading"]>) => void;
|
|
9
9
|
setTranslationError: (state: FtReaderState, action: PayloadAction<FtReaderState["translation"]["isError"]>) => void;
|
|
10
10
|
setTopicsRating: (state: FtReaderState, action: PayloadAction<FtReaderState["topicsRating"]>) => void;
|
|
11
|
-
setLinkPreviewDialogId: (state: FtReaderState, action: PayloadAction<FtReaderState["linkPreviewDialogId"]>) => void;
|
|
12
11
|
};
|
|
13
12
|
export type FtReaderStateReducers = typeof readerStoreStateReducers;
|
|
14
13
|
export type FtReaderReduxStore = FtReduxStore<FtReaderState, FtReaderStateReducers>;
|
|
@@ -19,6 +18,5 @@ export declare const createReaderStore: (id: string) => FtReduxStore<FtReaderSta
|
|
|
19
18
|
setTranslationLoading: (state: FtReaderState, action: PayloadAction<FtReaderState["translation"]["isLoading"]>) => void;
|
|
20
19
|
setTranslationError: (state: FtReaderState, action: PayloadAction<FtReaderState["translation"]["isError"]>) => void;
|
|
21
20
|
setTopicsRating: (state: FtReaderState, action: PayloadAction<FtReaderState["topicsRating"]>) => void;
|
|
22
|
-
setLinkPreviewDialogId: (state: FtReaderState, action: PayloadAction<FtReaderState["linkPreviewDialogId"]>) => void;
|
|
23
21
|
}, import("redux").AnyAction>;
|
|
24
22
|
export {};
|
package/build/store/redux.js
CHANGED
|
@@ -20,9 +20,6 @@ const readerStoreStateReducers = {
|
|
|
20
20
|
state.topicsRating[key] = action.payload[key];
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
|
-
setLinkPreviewDialogId: (state, action) => {
|
|
24
|
-
state.linkPreviewDialogId = action.payload;
|
|
25
|
-
},
|
|
26
23
|
};
|
|
27
24
|
export const createReaderStore = (id) => FtReduxStore.get({
|
|
28
25
|
name: "ft-reader-" + id,
|
|
@@ -18,11 +18,11 @@ class EnrichedTocBuilder {
|
|
|
18
18
|
duplicatedPrettyUrls: this.duplicatedPrettyUrls,
|
|
19
19
|
pages: this.pages,
|
|
20
20
|
pageByTocId: this.pageByTocId,
|
|
21
|
-
translationError: this.paginatedToc.translationError
|
|
21
|
+
translationError: this.paginatedToc.translationError,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
extractPagesToc(nodes, depth, parentTocId) {
|
|
25
|
-
return nodes.flatMap(node => {
|
|
25
|
+
return nodes.flatMap((node) => {
|
|
26
26
|
var _a;
|
|
27
27
|
if (node.pageConfiguration) {
|
|
28
28
|
this.registerPage(this.buildPage(node, parentTocId));
|
|
@@ -36,21 +36,21 @@ class EnrichedTocBuilder {
|
|
|
36
36
|
title: (_a = node.title) !== null && _a !== void 0 ? _a : "",
|
|
37
37
|
untranslatedTitle: node.untranslatedTitle,
|
|
38
38
|
depth,
|
|
39
|
-
children: this.extractPagesToc(node.children, depth + 1, node.tocId)
|
|
40
|
-
}
|
|
39
|
+
children: this.extractPagesToc(node.children, depth + 1, node.tocId),
|
|
40
|
+
},
|
|
41
41
|
];
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
convertNodes(nodes, depth, parentTocId) {
|
|
45
|
-
return nodes.flatMap(node => {
|
|
45
|
+
return nodes.flatMap((node) => {
|
|
46
46
|
var _a, _b, _c;
|
|
47
47
|
if (node.tocId == null) {
|
|
48
48
|
return [
|
|
49
49
|
...this.convertSectionNodes((_a = node.pageToc) !== null && _a !== void 0 ? _a : [], depth, node.tocId),
|
|
50
|
-
...this.convertNodes(node.children, depth, node.tocId)
|
|
50
|
+
...this.convertNodes(node.children, depth, node.tocId),
|
|
51
51
|
];
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
const prettyUrl = (_b = node.prettyUrl) === null || _b === void 0 ? void 0 : _b.replace(/^\//, "");
|
|
54
54
|
const enrichedNode = {
|
|
55
55
|
tocId: node.tocId,
|
|
56
56
|
contentId: node.contentId,
|
|
@@ -61,28 +61,28 @@ class EnrichedTocBuilder {
|
|
|
61
61
|
prettyUrl,
|
|
62
62
|
depth,
|
|
63
63
|
parentTocId: parentTocId,
|
|
64
|
-
children: []
|
|
64
|
+
children: [],
|
|
65
65
|
};
|
|
66
66
|
this.register(enrichedNode);
|
|
67
67
|
const sectionChildren = this.convertSectionNodes((_c = node.pageToc) !== null && _c !== void 0 ? _c : [], depth + 1, node.tocId);
|
|
68
68
|
const childrenWithPages = this.convertNodes(node.children, depth + 1, enrichedNode.tocId);
|
|
69
69
|
enrichedNode.children = [
|
|
70
70
|
...sectionChildren,
|
|
71
|
-
...childrenWithPages
|
|
71
|
+
...childrenWithPages,
|
|
72
72
|
];
|
|
73
73
|
return [enrichedNode];
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
convertSectionNodes(nodes, depth, parentTocId) {
|
|
77
|
-
return nodes.flatMap(node => {
|
|
77
|
+
return nodes.flatMap((node) => {
|
|
78
78
|
var _a;
|
|
79
|
-
|
|
79
|
+
const prettyUrl = (_a = node.prettyUrl) === null || _a === void 0 ? void 0 : _a.replace(/^\//, "");
|
|
80
80
|
const enrichedNode = {
|
|
81
81
|
...node,
|
|
82
82
|
prettyUrl,
|
|
83
83
|
depth,
|
|
84
84
|
parentTocId,
|
|
85
|
-
children: []
|
|
85
|
+
children: [],
|
|
86
86
|
};
|
|
87
87
|
this.register(enrichedNode);
|
|
88
88
|
enrichedNode.children = this.convertSectionNodes(node.children, depth + 1, node.tocId);
|
|
@@ -99,7 +99,7 @@ class EnrichedTocBuilder {
|
|
|
99
99
|
toc: ((_c = node.pageToc) !== null && _c !== void 0 ? _c : []).map((n) => this.nodeByTocId[n.tocId]),
|
|
100
100
|
topics: [],
|
|
101
101
|
hiddenTopics: [],
|
|
102
|
-
breadcrumb: parentTocId ? this.buildBreadcrumb(this.nodeByTocId[parentTocId]) : []
|
|
102
|
+
breadcrumb: parentTocId ? this.buildBreadcrumb(this.nodeByTocId[parentTocId]) : [],
|
|
103
103
|
};
|
|
104
104
|
const add = (tocId, visible) => (visible ? page.topics : page.hiddenTopics).push(tocId);
|
|
105
105
|
const parentsVisibility = (_e = (_d = node.pageConfiguration) === null || _d === void 0 ? void 0 : _d.parentsVisibility) !== null && _e !== void 0 ? _e : [];
|
|
@@ -113,7 +113,7 @@ class EnrichedTocBuilder {
|
|
|
113
113
|
return page;
|
|
114
114
|
}
|
|
115
115
|
registerPage(page) {
|
|
116
|
-
for (
|
|
116
|
+
for (const tocId of [...page.topics, ...page.hiddenTopics]) {
|
|
117
117
|
if (!this.pageByTocId[tocId]) {
|
|
118
118
|
this.pageByTocId[tocId] = page;
|
|
119
119
|
}
|
|
@@ -121,7 +121,7 @@ class EnrichedTocBuilder {
|
|
|
121
121
|
this.pages.push(page);
|
|
122
122
|
}
|
|
123
123
|
tocIds(nodes) {
|
|
124
|
-
return nodes.flatMap(node => [node.tocId, ...this.tocIds(node.children)]);
|
|
124
|
+
return nodes.flatMap((node) => [node.tocId, ...this.tocIds(node.children)]);
|
|
125
125
|
}
|
|
126
126
|
buildBreadcrumb(node) {
|
|
127
127
|
const breadcrumb = [node.tocId];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-reader-context",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.5",
|
|
4
4
|
"description": "Context block for integrated reader components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-app-context": "1.4.
|
|
23
|
-
"@fluid-topics/ft-wc-utils": "1.4.
|
|
22
|
+
"@fluid-topics/ft-app-context": "1.4.5",
|
|
23
|
+
"@fluid-topics/ft-wc-utils": "1.4.5",
|
|
24
24
|
"@reduxjs/toolkit": "^1.6.2",
|
|
25
25
|
"lit": "3.1.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@fluid-topics/public-api": "1.0.114"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "efdc859657751cd9e7af2736f3783341ffd6aae4"
|
|
31
31
|
}
|