@fluid-topics/ft-reader-context 1.2.3 → 1.2.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.
|
@@ -97,7 +97,7 @@ class FtReaderContext extends FtLitElementRedux {
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
if (props.has("visibleTopics")) {
|
|
100
|
+
if ((props.has("visibleTopics") || props.has("scrollTarget")) && this.scrollTarget == null) {
|
|
101
101
|
Promise.all(this.visibleTopics.map(tocId => { var _a; return this.stateManager.service.getAccurateNavigationData(tocId, (_a = this.currentPage) === null || _a === void 0 ? void 0 : _a.number); }))
|
|
102
102
|
.then(navigationData => {
|
|
103
103
|
let visibleTopics = navigationData.filter(data => data != null && data.topicTitle !== "")
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<style>
|
|
11
11
|
@import "${n}"
|
|
12
12
|
</style>
|
|
13
|
-
`}get stateManager(){return this._stateManager==null&&(this._stateManager=at.build(this.id||(""+Math.round(Math.random()*999e3)).padStart(6,"0"),this.readerServiceProvider),this._stateManager.errorHandler=e=>this.handleLoadError(e),this.addStore(this.stateManager.store,"reader")),this._stateManager}connectedCallback(){super.connectedCallback(),this.stateManager.setMapId(this.mapId),this.stateManager.awaitService().then(e=>{let t=e.fontsStylesheet();if(t&&!window.location.href.startsWith(this.baseUrl)&&!document.querySelector(`head link[href="${t}"]`)){let n=document.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("href",t),document.head.append(n)}window.FluidTopicsReaderService=new ht(this.stateManager)})}update(e){super.update(e),e.has("readerServiceProvider")&&this.readerServiceProvider&&this.stateManager.initService(this.readerServiceProvider),e.has("mapId")&&this.mapId&&(this.stateManager.setMapId(this.mapId),this.lastNotifiedNotFoundRelative=void 0),e.has("searchInDocumentQuery")&&this.searchInDocumentQuery!=null&&this.stateManager.setSearchInDocumentQuery(this.searchInDocumentQuery),["tocId","section","page","mapId","topicPivot"].some(t=>e.has(t))&&this.mapId&&this.navigateToTarget(),e.has("session")&&this.reload()}contentAvailableCallback(e){var t;if(super.contentAvailableCallback(e),(e.has("map")||e.has("toc"))&&this.sendLoadedEventIfLoaded(),e.has("scrollTarget")&&((t=this.scrollTarget)===null||t===void 0?void 0:t.tocId)==null){let n=e.get("scrollTarget");n?.tocId!=null&&this.scrollToTargetDebouncer.run(()=>{var i;return this.stateManager.service.getAccurateNavigationData(n.tocId,(i=this.currentPage)===null||i===void 0?void 0:i.number,n.section).then(a=>this.dispatchEvent(new ut(a)))})}e.has("visibleTopics")&&Promise.all(this.visibleTopics.map(n=>{var i;return this.stateManager.service.getAccurateNavigationData(n,(i=this.currentPage)===null||i===void 0?void 0:i.number)})).then(n=>{let i=n.filter(a=>a!=null&&a.topicTitle!=="").map(a=>{var o;return{tocId:a.tocId,title:a.topicTitle,page:a.page,prettyUrl:a.prettyUrl,prettyUrlDuplicated:a.prettyUrlDuplicated,breadcrumb:(o=this.stateManager.service)===null||o===void 0?void 0:o.buildBreadcrumb(a.tocId)}});this.dispatchEvent(new st(this.map,i))})}clear(){this.stateManager.clear()}async reload(){await this.stateManager.reload()}async navigateToTarget(){await this.navigationDebouncer.run(async()=>{this.topicPivot!=null?!await this.stateManager.navigateToRelativeTopicIfFound(this.topicPivot)&&this.lastNotifiedNotFoundRelative!==this.mapId+this.topicPivot?(this.dispatchEvent(new pt),this.lastNotifiedNotFoundRelative=this.mapId+this.topicPivot):this.lastNotifiedNotFoundRelative=void 0:this.tocId!=null?await this.stateManager.navigateToTopic(this.tocId,this.section,this.page):this.page!=null&&await this.stateManager.navigateToPage(this.page)})}registerComponent(e){e.stopPropagation();let t=e.composedPath()[0];this.register(t)}register(e){e.setReaderStateManager(this.stateManager)}handleLoadError(e){let t=e;t.status===401?this.dispatchEvent(new dt):t.status===403?this.dispatchEvent(new ft):t.status===404?this.dispatchEvent(new lt):this.dispatchEvent(new ct(e))}reloadBookmarks(){yn.reloadBookmarks()}async reloadRating(){var e,t;await((e=this.stateManager.service)===null||e===void 0?void 0:e.reloadRating()),(t=this.stateManager.store)===null||t===void 0||t.dispatchEvent(new CustomEvent("rating-changed"))}sendLoadedEventIfLoaded(){this.mapLoadedEventDebouncer.run(()=>{this.map&&this.toc&&this.dispatchEvent(new ot(this.map,this.toc))})}};M.styles=En;V([(0,B.redux)({store:g.name})],M.prototype,"baseUrl",void 0);V([(0,B.redux)({store:g.name})],M.prototype,"session",void 0);V([(0,se.property)()],M.prototype,"mapId",void 0);V([(0,se.property)()],M.prototype,"tocId",void 0);V([(0,se.property)()],M.prototype,"section",void 0);V([(0,se.property)()],M.prototype,"topicPivot",void 0);V([(0,se.property)()],M.prototype,"searchInDocumentQuery",void 0);V([(0,se.property)({type:Number,converter:{fromAttribute:Ti()}})],M.prototype,"page",void 0);V([(0,B.redux)({store:"reader"})],M.prototype,"map",void 0);V([(0,B.redux)({store:"reader"})],M.prototype,"toc",void 0);V([(0,B.redux)({store:"reader"})],M.prototype,"visibleTopics",void 0);V([(0,B.redux)({store:"reader"})],M.prototype,"currentPage",void 0);V([(0,B.redux)({store:"reader"})],M.prototype,"scrollTarget",void 0);V([(0,se.property)({attribute:!1})],M.prototype,"readerServiceProvider",void 0);(0,wn.customElement)("ft-reader-context")(M);})();
|
|
13
|
+
`}get stateManager(){return this._stateManager==null&&(this._stateManager=at.build(this.id||(""+Math.round(Math.random()*999e3)).padStart(6,"0"),this.readerServiceProvider),this._stateManager.errorHandler=e=>this.handleLoadError(e),this.addStore(this.stateManager.store,"reader")),this._stateManager}connectedCallback(){super.connectedCallback(),this.stateManager.setMapId(this.mapId),this.stateManager.awaitService().then(e=>{let t=e.fontsStylesheet();if(t&&!window.location.href.startsWith(this.baseUrl)&&!document.querySelector(`head link[href="${t}"]`)){let n=document.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("href",t),document.head.append(n)}window.FluidTopicsReaderService=new ht(this.stateManager)})}update(e){super.update(e),e.has("readerServiceProvider")&&this.readerServiceProvider&&this.stateManager.initService(this.readerServiceProvider),e.has("mapId")&&this.mapId&&(this.stateManager.setMapId(this.mapId),this.lastNotifiedNotFoundRelative=void 0),e.has("searchInDocumentQuery")&&this.searchInDocumentQuery!=null&&this.stateManager.setSearchInDocumentQuery(this.searchInDocumentQuery),["tocId","section","page","mapId","topicPivot"].some(t=>e.has(t))&&this.mapId&&this.navigateToTarget(),e.has("session")&&this.reload()}contentAvailableCallback(e){var t;if(super.contentAvailableCallback(e),(e.has("map")||e.has("toc"))&&this.sendLoadedEventIfLoaded(),e.has("scrollTarget")&&((t=this.scrollTarget)===null||t===void 0?void 0:t.tocId)==null){let n=e.get("scrollTarget");n?.tocId!=null&&this.scrollToTargetDebouncer.run(()=>{var i;return this.stateManager.service.getAccurateNavigationData(n.tocId,(i=this.currentPage)===null||i===void 0?void 0:i.number,n.section).then(a=>this.dispatchEvent(new ut(a)))})}(e.has("visibleTopics")||e.has("scrollTarget"))&&this.scrollTarget==null&&Promise.all(this.visibleTopics.map(n=>{var i;return this.stateManager.service.getAccurateNavigationData(n,(i=this.currentPage)===null||i===void 0?void 0:i.number)})).then(n=>{let i=n.filter(a=>a!=null&&a.topicTitle!=="").map(a=>{var o;return{tocId:a.tocId,title:a.topicTitle,page:a.page,prettyUrl:a.prettyUrl,prettyUrlDuplicated:a.prettyUrlDuplicated,breadcrumb:(o=this.stateManager.service)===null||o===void 0?void 0:o.buildBreadcrumb(a.tocId)}});this.dispatchEvent(new st(this.map,i))})}clear(){this.stateManager.clear()}async reload(){await this.stateManager.reload()}async navigateToTarget(){await this.navigationDebouncer.run(async()=>{this.topicPivot!=null?!await this.stateManager.navigateToRelativeTopicIfFound(this.topicPivot)&&this.lastNotifiedNotFoundRelative!==this.mapId+this.topicPivot?(this.dispatchEvent(new pt),this.lastNotifiedNotFoundRelative=this.mapId+this.topicPivot):this.lastNotifiedNotFoundRelative=void 0:this.tocId!=null?await this.stateManager.navigateToTopic(this.tocId,this.section,this.page):this.page!=null&&await this.stateManager.navigateToPage(this.page)})}registerComponent(e){e.stopPropagation();let t=e.composedPath()[0];this.register(t)}register(e){e.setReaderStateManager(this.stateManager)}handleLoadError(e){let t=e;t.status===401?this.dispatchEvent(new dt):t.status===403?this.dispatchEvent(new ft):t.status===404?this.dispatchEvent(new lt):this.dispatchEvent(new ct(e))}reloadBookmarks(){yn.reloadBookmarks()}async reloadRating(){var e,t;await((e=this.stateManager.service)===null||e===void 0?void 0:e.reloadRating()),(t=this.stateManager.store)===null||t===void 0||t.dispatchEvent(new CustomEvent("rating-changed"))}sendLoadedEventIfLoaded(){this.mapLoadedEventDebouncer.run(()=>{this.map&&this.toc&&this.dispatchEvent(new ot(this.map,this.toc))})}};M.styles=En;V([(0,B.redux)({store:g.name})],M.prototype,"baseUrl",void 0);V([(0,B.redux)({store:g.name})],M.prototype,"session",void 0);V([(0,se.property)()],M.prototype,"mapId",void 0);V([(0,se.property)()],M.prototype,"tocId",void 0);V([(0,se.property)()],M.prototype,"section",void 0);V([(0,se.property)()],M.prototype,"topicPivot",void 0);V([(0,se.property)()],M.prototype,"searchInDocumentQuery",void 0);V([(0,se.property)({type:Number,converter:{fromAttribute:Ti()}})],M.prototype,"page",void 0);V([(0,B.redux)({store:"reader"})],M.prototype,"map",void 0);V([(0,B.redux)({store:"reader"})],M.prototype,"toc",void 0);V([(0,B.redux)({store:"reader"})],M.prototype,"visibleTopics",void 0);V([(0,B.redux)({store:"reader"})],M.prototype,"currentPage",void 0);V([(0,B.redux)({store:"reader"})],M.prototype,"scrollTarget",void 0);V([(0,se.property)({attribute:!1})],M.prototype,"readerServiceProvider",void 0);(0,wn.customElement)("ft-reader-context")(M);})();
|
|
14
14
|
/*! Bundled license information:
|
|
15
15
|
|
|
16
16
|
@lit/reactive-element/css-tag.js:
|
|
@@ -58,7 +58,7 @@ Also for action icons.`,c.colorGray200),contentGlobalSubtle:o.extend("--ft-conte
|
|
|
58
58
|
<style>
|
|
59
59
|
@import "${n}"
|
|
60
60
|
</style>
|
|
61
|
-
`}get stateManager(){return this._stateManager==null&&(this._stateManager=fo.build(this.id||(""+Math.round(Math.random()*999e3)).padStart(6,"0"),this.readerServiceProvider),this._stateManager.errorHandler=e=>this.handleLoadError(e),this.addStore(this.stateManager.store,"reader")),this._stateManager}connectedCallback(){super.connectedCallback(),this.stateManager.setMapId(this.mapId),this.stateManager.awaitService().then(e=>{let t=e.fontsStylesheet();if(t&&!window.location.href.startsWith(this.baseUrl)&&!document.querySelector(`head link[href="${t}"]`)){let n=document.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("href",t),document.head.append(n)}window.FluidTopicsReaderService=new So(this.stateManager)})}update(e){super.update(e),e.has("readerServiceProvider")&&this.readerServiceProvider&&this.stateManager.initService(this.readerServiceProvider),e.has("mapId")&&this.mapId&&(this.stateManager.setMapId(this.mapId),this.lastNotifiedNotFoundRelative=void 0),e.has("searchInDocumentQuery")&&this.searchInDocumentQuery!=null&&this.stateManager.setSearchInDocumentQuery(this.searchInDocumentQuery),["tocId","section","page","mapId","topicPivot"].some(t=>e.has(t))&&this.mapId&&this.navigateToTarget(),e.has("session")&&this.reload()}contentAvailableCallback(e){var t;if(super.contentAvailableCallback(e),(e.has("map")||e.has("toc"))&&this.sendLoadedEventIfLoaded(),e.has("scrollTarget")&&((t=this.scrollTarget)===null||t===void 0?void 0:t.tocId)==null){let n=e.get("scrollTarget");n?.tocId!=null&&this.scrollToTargetDebouncer.run(()=>{var a;return this.stateManager.service.getAccurateNavigationData(n.tocId,(a=this.currentPage)===null||a===void 0?void 0:a.number,n.section).then(i=>this.dispatchEvent(new go(i)))})}e.has("visibleTopics")&&Promise.all(this.visibleTopics.map(n=>{var a;return this.stateManager.service.getAccurateNavigationData(n,(a=this.currentPage)===null||a===void 0?void 0:a.number)})).then(n=>{let a=n.filter(i=>i!=null&&i.topicTitle!=="").map(i=>{var s;return{tocId:i.tocId,title:i.topicTitle,page:i.page,prettyUrl:i.prettyUrl,prettyUrlDuplicated:i.prettyUrlDuplicated,breadcrumb:(s=this.stateManager.service)===null||s===void 0?void 0:s.buildBreadcrumb(i.tocId)}});this.dispatchEvent(new ho(this.map,a))})}clear(){this.stateManager.clear()}async reload(){await this.stateManager.reload()}async navigateToTarget(){await this.navigationDebouncer.run(async()=>{this.topicPivot!=null?!await this.stateManager.navigateToRelativeTopicIfFound(this.topicPivot)&&this.lastNotifiedNotFoundRelative!==this.mapId+this.topicPivot?(this.dispatchEvent(new xo),this.lastNotifiedNotFoundRelative=this.mapId+this.topicPivot):this.lastNotifiedNotFoundRelative=void 0:this.tocId!=null?await this.stateManager.navigateToTopic(this.tocId,this.section,this.page):this.page!=null&&await this.stateManager.navigateToPage(this.page)})}registerComponent(e){e.stopPropagation();let t=e.composedPath()[0];this.register(t)}register(e){e.setReaderStateManager(this.stateManager)}handleLoadError(e){let t=e;t.status===401?this.dispatchEvent(new bo):t.status===403?this.dispatchEvent(new vo):t.status===404?this.dispatchEvent(new mo):this.dispatchEvent(new yo(e))}reloadBookmarks(){yc.reloadBookmarks()}async reloadRating(){var e,t;await((e=this.stateManager.service)===null||e===void 0?void 0:e.reloadRating()),(t=this.stateManager.store)===null||t===void 0||t.dispatchEvent(new CustomEvent("rating-changed"))}sendLoadedEventIfLoaded(){this.mapLoadedEventDebouncer.run(()=>{this.map&&this.toc&&this.dispatchEvent(new po(this.map,this.toc))})}};V.styles=mc;J([ge({store:_.name})],V.prototype,"baseUrl",void 0);J([ge({store:_.name})],V.prototype,"session",void 0);J([U()],V.prototype,"mapId",void 0);J([U()],V.prototype,"tocId",void 0);J([U()],V.prototype,"section",void 0);J([U()],V.prototype,"topicPivot",void 0);J([U()],V.prototype,"searchInDocumentQuery",void 0);J([U({type:Number,converter:{fromAttribute:Eu()}})],V.prototype,"page",void 0);J([ge({store:"reader"})],V.prototype,"map",void 0);J([ge({store:"reader"})],V.prototype,"toc",void 0);J([ge({store:"reader"})],V.prototype,"visibleTopics",void 0);J([ge({store:"reader"})],V.prototype,"currentPage",void 0);J([ge({store:"reader"})],V.prototype,"scrollTarget",void 0);J([U({attribute:!1})],V.prototype,"readerServiceProvider",void 0);Zt("ft-reader-context")(V);})();
|
|
61
|
+
`}get stateManager(){return this._stateManager==null&&(this._stateManager=fo.build(this.id||(""+Math.round(Math.random()*999e3)).padStart(6,"0"),this.readerServiceProvider),this._stateManager.errorHandler=e=>this.handleLoadError(e),this.addStore(this.stateManager.store,"reader")),this._stateManager}connectedCallback(){super.connectedCallback(),this.stateManager.setMapId(this.mapId),this.stateManager.awaitService().then(e=>{let t=e.fontsStylesheet();if(t&&!window.location.href.startsWith(this.baseUrl)&&!document.querySelector(`head link[href="${t}"]`)){let n=document.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("href",t),document.head.append(n)}window.FluidTopicsReaderService=new So(this.stateManager)})}update(e){super.update(e),e.has("readerServiceProvider")&&this.readerServiceProvider&&this.stateManager.initService(this.readerServiceProvider),e.has("mapId")&&this.mapId&&(this.stateManager.setMapId(this.mapId),this.lastNotifiedNotFoundRelative=void 0),e.has("searchInDocumentQuery")&&this.searchInDocumentQuery!=null&&this.stateManager.setSearchInDocumentQuery(this.searchInDocumentQuery),["tocId","section","page","mapId","topicPivot"].some(t=>e.has(t))&&this.mapId&&this.navigateToTarget(),e.has("session")&&this.reload()}contentAvailableCallback(e){var t;if(super.contentAvailableCallback(e),(e.has("map")||e.has("toc"))&&this.sendLoadedEventIfLoaded(),e.has("scrollTarget")&&((t=this.scrollTarget)===null||t===void 0?void 0:t.tocId)==null){let n=e.get("scrollTarget");n?.tocId!=null&&this.scrollToTargetDebouncer.run(()=>{var a;return this.stateManager.service.getAccurateNavigationData(n.tocId,(a=this.currentPage)===null||a===void 0?void 0:a.number,n.section).then(i=>this.dispatchEvent(new go(i)))})}(e.has("visibleTopics")||e.has("scrollTarget"))&&this.scrollTarget==null&&Promise.all(this.visibleTopics.map(n=>{var a;return this.stateManager.service.getAccurateNavigationData(n,(a=this.currentPage)===null||a===void 0?void 0:a.number)})).then(n=>{let a=n.filter(i=>i!=null&&i.topicTitle!=="").map(i=>{var s;return{tocId:i.tocId,title:i.topicTitle,page:i.page,prettyUrl:i.prettyUrl,prettyUrlDuplicated:i.prettyUrlDuplicated,breadcrumb:(s=this.stateManager.service)===null||s===void 0?void 0:s.buildBreadcrumb(i.tocId)}});this.dispatchEvent(new ho(this.map,a))})}clear(){this.stateManager.clear()}async reload(){await this.stateManager.reload()}async navigateToTarget(){await this.navigationDebouncer.run(async()=>{this.topicPivot!=null?!await this.stateManager.navigateToRelativeTopicIfFound(this.topicPivot)&&this.lastNotifiedNotFoundRelative!==this.mapId+this.topicPivot?(this.dispatchEvent(new xo),this.lastNotifiedNotFoundRelative=this.mapId+this.topicPivot):this.lastNotifiedNotFoundRelative=void 0:this.tocId!=null?await this.stateManager.navigateToTopic(this.tocId,this.section,this.page):this.page!=null&&await this.stateManager.navigateToPage(this.page)})}registerComponent(e){e.stopPropagation();let t=e.composedPath()[0];this.register(t)}register(e){e.setReaderStateManager(this.stateManager)}handleLoadError(e){let t=e;t.status===401?this.dispatchEvent(new bo):t.status===403?this.dispatchEvent(new vo):t.status===404?this.dispatchEvent(new mo):this.dispatchEvent(new yo(e))}reloadBookmarks(){yc.reloadBookmarks()}async reloadRating(){var e,t;await((e=this.stateManager.service)===null||e===void 0?void 0:e.reloadRating()),(t=this.stateManager.store)===null||t===void 0||t.dispatchEvent(new CustomEvent("rating-changed"))}sendLoadedEventIfLoaded(){this.mapLoadedEventDebouncer.run(()=>{this.map&&this.toc&&this.dispatchEvent(new po(this.map,this.toc))})}};V.styles=mc;J([ge({store:_.name})],V.prototype,"baseUrl",void 0);J([ge({store:_.name})],V.prototype,"session",void 0);J([U()],V.prototype,"mapId",void 0);J([U()],V.prototype,"tocId",void 0);J([U()],V.prototype,"section",void 0);J([U()],V.prototype,"topicPivot",void 0);J([U()],V.prototype,"searchInDocumentQuery",void 0);J([U({type:Number,converter:{fromAttribute:Eu()}})],V.prototype,"page",void 0);J([ge({store:"reader"})],V.prototype,"map",void 0);J([ge({store:"reader"})],V.prototype,"toc",void 0);J([ge({store:"reader"})],V.prototype,"visibleTopics",void 0);J([ge({store:"reader"})],V.prototype,"currentPage",void 0);J([ge({store:"reader"})],V.prototype,"scrollTarget",void 0);J([U({attribute:!1})],V.prototype,"readerServiceProvider",void 0);Zt("ft-reader-context")(V);})();
|
|
62
62
|
/*! Bundled license information:
|
|
63
63
|
|
|
64
64
|
@webcomponents/scoped-custom-element-registry/src/scoped-custom-element-registry.js:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-reader-context",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.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.2.
|
|
23
|
-
"@fluid-topics/ft-wc-utils": "1.2.
|
|
22
|
+
"@fluid-topics/ft-app-context": "1.2.5",
|
|
23
|
+
"@fluid-topics/ft-wc-utils": "1.2.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.78"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "aec75d3dcbb3256c079ecf330a0f2755e7469584"
|
|
31
31
|
}
|