@fluid-topics/ft-reader-context 1.1.99 → 1.1.101
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.
|
@@ -9,6 +9,8 @@ export declare class FtReaderStateManager {
|
|
|
9
9
|
clusteringHelper?: ClusteringHelper;
|
|
10
10
|
service?: FtReaderService;
|
|
11
11
|
errorHandler?: (e: Error) => void;
|
|
12
|
+
private _loaded;
|
|
13
|
+
loaded(): Promise<void>;
|
|
12
14
|
constructor(store: FtReaderReduxStore, serviceProvider: () => Promise<FtReaderService>, clusteringHelperProvider?: (() => ClusteringHelper) | undefined);
|
|
13
15
|
initService(serviceProvider: () => Promise<FtReaderService>): Promise<void>;
|
|
14
16
|
setMapId(mapId?: string): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CanceledPromiseError, ClusteringHelper, Debouncer, waitFor } from "@fluid-topics/ft-wc-utils";
|
|
1
|
+
import { CanceledPromiseError, ClusteringHelper, Debouncer, waitFor, waitUntil } from "@fluid-topics/ft-wc-utils";
|
|
2
2
|
import { createReaderStore } from "./redux";
|
|
3
3
|
import { FtOfficialReaderService } from "./utils/FtOfficialReaderService";
|
|
4
4
|
import { ftAppInfoStore } from "@fluid-topics/ft-app-context";
|
|
@@ -6,10 +6,14 @@ export class FtReaderStateManager {
|
|
|
6
6
|
static build(id, serviceProvider) {
|
|
7
7
|
return new FtReaderStateManager(createReaderStore(id.trim() || "context"), serviceProvider !== null && serviceProvider !== void 0 ? serviceProvider : FtOfficialReaderService.build);
|
|
8
8
|
}
|
|
9
|
+
loaded() {
|
|
10
|
+
return waitUntil(() => this._loaded);
|
|
11
|
+
}
|
|
9
12
|
constructor(store, serviceProvider, clusteringHelperProvider) {
|
|
10
13
|
this.store = store;
|
|
11
14
|
this.clusteringHelperProvider = clusteringHelperProvider;
|
|
12
15
|
this.metadataForSwitchToRelatives = new Set();
|
|
16
|
+
this._loaded = false;
|
|
13
17
|
this.loadDebouncer = new Debouncer(10);
|
|
14
18
|
this.initService(serviceProvider);
|
|
15
19
|
}
|
|
@@ -34,6 +38,7 @@ export class FtReaderStateManager {
|
|
|
34
38
|
return waitFor(() => this.service);
|
|
35
39
|
}
|
|
36
40
|
async navigateToTopic(tocId, section, pageNumber) {
|
|
41
|
+
await this.loaded();
|
|
37
42
|
const service = await this.awaitService();
|
|
38
43
|
const page = await (pageNumber != null ? service.getPage(pageNumber) : service.getPageByTocId(tocId !== null && tocId !== void 0 ? tocId : "root"));
|
|
39
44
|
this.store.actions.currentPage(page);
|
|
@@ -51,6 +56,7 @@ export class FtReaderStateManager {
|
|
|
51
56
|
return nonRootTocId;
|
|
52
57
|
}
|
|
53
58
|
async navigateToPage(pageNumber) {
|
|
59
|
+
await this.loaded();
|
|
54
60
|
const service = await this.awaitService();
|
|
55
61
|
let page = await service.getPage(pageNumber);
|
|
56
62
|
this.store.actions.currentPage(page);
|
|
@@ -66,6 +72,7 @@ export class FtReaderStateManager {
|
|
|
66
72
|
}
|
|
67
73
|
clear() {
|
|
68
74
|
var _a;
|
|
75
|
+
this._loaded = false;
|
|
69
76
|
this.store.actions.configuration(undefined);
|
|
70
77
|
this.store.actions.map(undefined);
|
|
71
78
|
this.store.actions.toc(undefined);
|
|
@@ -89,11 +96,11 @@ export class FtReaderStateManager {
|
|
|
89
96
|
(_c = this.service) === null || _c === void 0 ? void 0 : _c.getToc().then(toc => this.store.actions.toc(toc)),
|
|
90
97
|
(_d = this.service) === null || _d === void 0 ? void 0 : _d.getPagesToc().then(pagesToc => this.store.actions.pagesToc(pagesToc)),
|
|
91
98
|
(_e = this.service) === null || _e === void 0 ? void 0 : _e.getPaginationConfiguration().then(conf => this.store.actions.paginationConfiguration(conf)),
|
|
92
|
-
])
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
99
|
+
]);
|
|
100
|
+
if (this.metadataForSwitchToRelatives.size > 0) {
|
|
101
|
+
this.fetchRelatives();
|
|
102
|
+
}
|
|
103
|
+
this._loaded = true;
|
|
97
104
|
}
|
|
98
105
|
catch (e) {
|
|
99
106
|
if (this.errorHandler && !(e instanceof CanceledPromiseError)) {
|
|
@@ -136,6 +143,7 @@ export class FtReaderStateManager {
|
|
|
136
143
|
}
|
|
137
144
|
async navigateToRelativeTopicIfFound(topicPivotMetadataValue) {
|
|
138
145
|
var _a, _b, _c;
|
|
146
|
+
await this.loaded();
|
|
139
147
|
const relativeTopicPivotMetadata = await waitFor(() => { var _a; return (_a = this.store.getState().configuration) === null || _a === void 0 ? void 0 : _a.relativeTopicPivotMetadata; });
|
|
140
148
|
const mapId = this.store.getState().mapId;
|
|
141
149
|
const service = await this.awaitService();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-reader-context",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.101",
|
|
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.1.
|
|
23
|
-
"@fluid-topics/ft-wc-utils": "1.1.
|
|
22
|
+
"@fluid-topics/ft-app-context": "1.1.101",
|
|
23
|
+
"@fluid-topics/ft-wc-utils": "1.1.101",
|
|
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.73"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "2d444ace3306098342639937b95d84f13f24cb2d"
|
|
31
31
|
}
|