@fluid-topics/ft-reader-context 1.4.4 → 2.0.0

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/index.js CHANGED
@@ -1,5 +1,3 @@
1
- import { customElement } from "@fluid-topics/ft-wc-utils";
2
- import { FtReaderContext } from "./ft-reader-context";
3
1
  export * from "./ft-reader-context.styles";
4
2
  export * from "./ft-reader-context.properties";
5
3
  export * from "./ft-reader-context";
@@ -8,4 +6,3 @@ export * from "./store/model";
8
6
  export * from "./store/utils/FtReaderConverter";
9
7
  export * from "./store/utils/FtReaderService";
10
8
  export * from "./store/utils/FtOfficialReaderService";
11
- customElement("ft-reader-context")(FtReaderContext);
@@ -227,7 +227,7 @@ export class FtReaderStateManager {
227
227
  } : undefined;
228
228
  }
229
229
  setLinkPreviewDialogId(linkPreviewDialogId) {
230
- this.store.actions.setLinkPreviewDialogId(linkPreviewDialogId);
230
+ this.store.actions.linkPreviewDialogId(linkPreviewDialogId);
231
231
  }
232
232
  async fetchMapRating() {
233
233
  var _a;
@@ -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 {};
@@ -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
- let prettyUrl = (_b = node.prettyUrl) === null || _b === void 0 ? void 0 : _b.replace(/^\//, "");
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
- let prettyUrl = (_a = node.prettyUrl) === null || _a === void 0 ? void 0 : _a.replace(/^\//, "");
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 (let tocId of [...page.topics, ...page.hiddenTopics]) {
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,31 +1,31 @@
1
1
  {
2
- "name": "@fluid-topics/ft-reader-context",
3
- "version": "1.4.4",
4
- "description": "Context block for integrated reader components",
5
- "keywords": [
6
- "Lit"
7
- ],
8
- "author": "Fluid Topics <devtopics@antidot.net>",
9
- "license": "ISC",
10
- "main": "build/index.js",
11
- "web": "build/ft-reader-context.min.js",
12
- "typings": "build/index",
13
- "files": [
14
- "build/**/*.js",
15
- "build/**/*.ts"
16
- ],
17
- "repository": {
18
- "type": "git",
19
- "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
- },
21
- "dependencies": {
22
- "@fluid-topics/ft-app-context": "1.4.4",
23
- "@fluid-topics/ft-wc-utils": "1.4.4",
24
- "@reduxjs/toolkit": "^1.6.2",
25
- "lit": "3.1.0"
26
- },
27
- "devDependencies": {
28
- "@fluid-topics/public-api": "1.0.114"
29
- },
30
- "gitHead": "fdd626e6a7b6cfef613b7060c1ac2ece1073a1da"
2
+ "name": "@fluid-topics/ft-reader-context",
3
+ "version": "2.0.0",
4
+ "description": "Context block for integrated reader components",
5
+ "keywords": [
6
+ "Lit"
7
+ ],
8
+ "author": "Fluid Topics <devtopics@antidot.net>",
9
+ "license": "ISC",
10
+ "main": "build/index.js",
11
+ "web": "build/ft-reader-context.min.js",
12
+ "typings": "build/index",
13
+ "files": [
14
+ "build/**/*.js",
15
+ "build/**/*.ts"
16
+ ],
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
+ },
21
+ "dependencies": {
22
+ "@fluid-topics/ft-app-context": "2.0.0",
23
+ "@fluid-topics/ft-wc-utils": "2.0.0",
24
+ "@reduxjs/toolkit": "^1.6.2",
25
+ "lit": "3.1.0"
26
+ },
27
+ "devDependencies": {
28
+ "@fluid-topics/public-api": "1.0.114"
29
+ },
30
+ "gitHead": "139801842483cdd25e6c0d850431dfb2b930f394"
31
31
  }