@fluid-topics/ft-reader-context 2.0.30 → 2.0.32

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.
@@ -61,7 +61,10 @@ export class FtReaderStateManager {
61
61
  var _a, _b, _c;
62
62
  const nonRootTocId = (_a = (tocId === "root" ? undefined : tocId)) !== null && _a !== void 0 ? _a : page.rootTocId;
63
63
  if (!page.topics.includes(nonRootTocId)) {
64
- this.store.dispatchEvent(new Event(FtReaderStoreEvents.requestedTopicNotFound));
64
+ if (tocId != "root") {
65
+ // The redirection is expected when tocId = root, don't send the event.
66
+ this.store.dispatchEvent(new Event(FtReaderStoreEvents.requestedTopicNotFound));
67
+ }
65
68
  return (_c = (_b = page.topics[0]) !== null && _b !== void 0 ? _b : page.hiddenTopics[0]) !== null && _c !== void 0 ? _c : "root";
66
69
  }
67
70
  return nonRootTocId;
@@ -90,26 +90,26 @@ class EnrichedTocBuilder {
90
90
  });
91
91
  }
92
92
  buildPage(node, parentTocId) {
93
- var _a, _b, _c, _d, _e, _f;
93
+ var _a, _b, _c, _d, _e, _f, _g, _h;
94
94
  const page = {
95
95
  number: this.pages.length + 1,
96
96
  title: (_a = node.title) !== null && _a !== void 0 ? _a : "",
97
97
  untranslatedTitle: node.untranslatedTitle,
98
- rootTocId: (_b = node.tocId) !== null && _b !== void 0 ? _b : "root",
99
- toc: ((_c = node.pageToc) !== null && _c !== void 0 ? _c : []).map((n) => this.nodeByTocId[n.tocId]),
98
+ rootTocId: (_d = (_b = node.tocId) !== null && _b !== void 0 ? _b : (_c = node.pageToc) === null || _c === void 0 ? void 0 : _c[0].tocId) !== null && _d !== void 0 ? _d : "root",
99
+ toc: ((_e = node.pageToc) !== null && _e !== void 0 ? _e : []).map((n) => this.nodeByTocId[n.tocId]),
100
100
  topics: [],
101
101
  hiddenTopics: [],
102
102
  breadcrumb: parentTocId ? this.buildBreadcrumb(this.nodeByTocId[parentTocId]) : [],
103
103
  };
104
104
  const add = (tocId, visible) => (visible ? page.topics : page.hiddenTopics).push(tocId);
105
- const parentsVisibility = (_e = (_d = node.pageConfiguration) === null || _d === void 0 ? void 0 : _d.parentsVisibility) !== null && _e !== void 0 ? _e : [];
105
+ const parentsVisibility = (_g = (_f = node.pageConfiguration) === null || _f === void 0 ? void 0 : _f.parentsVisibility) !== null && _g !== void 0 ? _g : [];
106
106
  page.breadcrumb.forEach((tocId, index) => {
107
107
  add(tocId, parentsVisibility[index]);
108
108
  });
109
109
  if (node.tocId) {
110
110
  add(node.tocId, node.pageConfiguration.isVisible);
111
111
  }
112
- page.topics.push(...this.tocIds((_f = node.pageToc) !== null && _f !== void 0 ? _f : []));
112
+ page.topics.push(...this.tocIds((_h = node.pageToc) !== null && _h !== void 0 ? _h : []));
113
113
  return page;
114
114
  }
115
115
  registerPage(page) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-context",
3
- "version": "2.0.30",
3
+ "version": "2.0.32",
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": "2.0.30",
23
- "@fluid-topics/ft-wc-utils": "2.0.30",
22
+ "@fluid-topics/ft-app-context": "2.0.32",
23
+ "@fluid-topics/ft-wc-utils": "2.0.32",
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.123"
29
29
  },
30
- "gitHead": "842c87986021522cf8ebea6bf0880ea1a298b20e"
30
+ "gitHead": "7b9fd05cccbb50a04b9639b26e2d958ca494c83e"
31
31
  }