@fluid-topics/ft-reader-topic-content 1.1.1 → 1.1.2
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.
|
@@ -3,15 +3,18 @@ import { FtReaderTopicContentProperties } from "./ft-reader-topic-content.proper
|
|
|
3
3
|
import { FtReaderTopicComponent } from "@fluid-topics/ft-reader-topic-context/build/registration";
|
|
4
4
|
import "@fluid-topics/ft-icon";
|
|
5
5
|
export declare class FtReaderTopicContent extends FtReaderTopicComponent implements FtReaderTopicContentProperties {
|
|
6
|
-
static styles: import("lit").CSSResult;
|
|
6
|
+
static styles: import("lit").CSSResult[];
|
|
7
7
|
private map?;
|
|
8
8
|
private scrollTarget?;
|
|
9
9
|
private content?;
|
|
10
10
|
private error?;
|
|
11
|
+
private searchInDocumentQuery?;
|
|
11
12
|
contentPreprocessor: (content: string) => string;
|
|
12
13
|
onContentAvailable: (container: HTMLElement, shadowRoot: ShadowRoot) => void;
|
|
14
|
+
private topicContainer?;
|
|
13
15
|
protected render(): import("lit").TemplateResult<1>;
|
|
14
16
|
protected update(props: PropertyValues): void;
|
|
17
|
+
protected updated(props: PropertyValues): void;
|
|
15
18
|
private updateContent;
|
|
16
19
|
protected contentAvailableCallback(props: PropertyValues): void;
|
|
17
20
|
protected onStoreAvailable(): void;
|
|
@@ -9,9 +9,10 @@ import { styles } from "./ft-reader-topic-content.css";
|
|
|
9
9
|
import { FtReaderTopicComponent } from "@fluid-topics/ft-reader-topic-context/build/registration";
|
|
10
10
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
11
11
|
import { redux } from "@fluid-topics/ft-wc-utils";
|
|
12
|
-
import { property, state } from "lit/decorators.js";
|
|
12
|
+
import { property, query, state } from "lit/decorators.js";
|
|
13
13
|
import "@fluid-topics/ft-icon";
|
|
14
14
|
import { context } from "./i18n/TopicContentMessages";
|
|
15
|
+
import { highlightHtml, highlightHtmlStyles } from "@fluid-topics/ft-wc-utils";
|
|
15
16
|
class FtReaderTopicContent extends FtReaderTopicComponent {
|
|
16
17
|
constructor() {
|
|
17
18
|
super(...arguments);
|
|
@@ -40,6 +41,14 @@ class FtReaderTopicContent extends FtReaderTopicComponent {
|
|
|
40
41
|
this.updateContent();
|
|
41
42
|
}
|
|
42
43
|
}
|
|
44
|
+
updated(props) {
|
|
45
|
+
super.updated(props);
|
|
46
|
+
this.updateComplete.then((noMoreUpdates) => {
|
|
47
|
+
if (noMoreUpdates && this.topicContainer) {
|
|
48
|
+
highlightHtml(this.topicContainer, this.searchInDocumentQuery);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
43
52
|
updateContent() {
|
|
44
53
|
var _a;
|
|
45
54
|
this.error = undefined;
|
|
@@ -49,16 +58,15 @@ class FtReaderTopicContent extends FtReaderTopicComponent {
|
|
|
49
58
|
}
|
|
50
59
|
}
|
|
51
60
|
contentAvailableCallback(props) {
|
|
52
|
-
var _a, _b, _c, _d, _e, _f
|
|
61
|
+
var _a, _b, _c, _d, _e, _f;
|
|
53
62
|
super.contentAvailableCallback(props);
|
|
54
63
|
if (!this.disableContextInteractions && ((_a = this.scrollTarget) === null || _a === void 0 ? void 0 : _a.section) && ((_b = this.tocNode) === null || _b === void 0 ? void 0 : _b.tocId) && ((_c = this.tocNode) === null || _c === void 0 ? void 0 : _c.tocId) === this.scrollTarget.tocId && this.content) {
|
|
55
64
|
const target = (_e = (_d = this.shadowRoot) === null || _d === void 0 ? void 0 : _d.querySelector(`[id="${this.scrollTarget.section}"], [name="${this.scrollTarget.section}"]`)) !== null && _e !== void 0 ? _e : this;
|
|
56
65
|
target.scrollIntoView({ block: "start" });
|
|
57
66
|
(_f = this.stateManager) === null || _f === void 0 ? void 0 : _f.scrollDone();
|
|
58
67
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
this.onContentAvailable(container, this.shadowRoot);
|
|
68
|
+
if (this.topicContainer) {
|
|
69
|
+
this.onContentAvailable(this.topicContainer, this.shadowRoot);
|
|
62
70
|
}
|
|
63
71
|
}
|
|
64
72
|
onStoreAvailable() {
|
|
@@ -88,7 +96,10 @@ class FtReaderTopicContent extends FtReaderTopicComponent {
|
|
|
88
96
|
return this.error.status === 404;
|
|
89
97
|
}
|
|
90
98
|
}
|
|
91
|
-
FtReaderTopicContent.styles =
|
|
99
|
+
FtReaderTopicContent.styles = [
|
|
100
|
+
styles,
|
|
101
|
+
highlightHtmlStyles
|
|
102
|
+
];
|
|
92
103
|
__decorate([
|
|
93
104
|
redux()
|
|
94
105
|
], FtReaderTopicContent.prototype, "map", void 0);
|
|
@@ -101,10 +112,16 @@ __decorate([
|
|
|
101
112
|
__decorate([
|
|
102
113
|
state()
|
|
103
114
|
], FtReaderTopicContent.prototype, "error", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
redux({ selector: (s, self) => self.disableContextInteractions ? "" : s.searchInDocumentQuery })
|
|
117
|
+
], FtReaderTopicContent.prototype, "searchInDocumentQuery", void 0);
|
|
104
118
|
__decorate([
|
|
105
119
|
property({ attribute: false })
|
|
106
120
|
], FtReaderTopicContent.prototype, "contentPreprocessor", void 0);
|
|
107
121
|
__decorate([
|
|
108
122
|
property({ attribute: false })
|
|
109
123
|
], FtReaderTopicContent.prototype, "onContentAvailable", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
query("section.topic")
|
|
126
|
+
], FtReaderTopicContent.prototype, "topicContainer", void 0);
|
|
110
127
|
export { FtReaderTopicContent };
|
|
@@ -68,15 +68,15 @@
|
|
|
68
68
|
${o.unsafeHTML(this.resolvedIcon)}
|
|
69
69
|
<slot ?hidden=${e}></slot>
|
|
70
70
|
</i>
|
|
71
|
-
`}get textContent(){var t,e;return null!==(e=null===(t=this.slottedContent)||void 0===t?void 0:t.assignedNodes().map((t=>t.textContent)).join("").trim())&&void 0!==e?e:""}update(t){super.update(t),["value","variant"].some((e=>t.has(e)))&&this.resolveIcon()}resolveIcon(){var t,e;let s=this.value||this.textContent;switch(this.variant){case j.file_format:this.resolvedIcon=null!==(t=m[s.replace("-","_").toUpperCase()])&&void 0!==t?t:s;break;case j.material:this.resolvedIcon=this.value||i.nothing;break;default:this.resolvedIcon=null!==(e=f[s.replace("-","_").toUpperCase()])&&void 0!==e?e:s}}firstUpdated(t){super.firstUpdated(t),setTimeout((()=>this.resolveIcon()))}}$.elementDefinitions={},$.styles=k,O([s.property()],$.prototype,"variant",void 0),O([s.property()],$.prototype,"value",void 0),O([s.state()],$.prototype,"resolvedIcon",void 0),O([s.query("slot")],$.prototype,"slottedContent",void 0),e.customElement("ft-icon")($);const
|
|
72
|
-
`,
|
|
71
|
+
`}get textContent(){var t,e;return null!==(e=null===(t=this.slottedContent)||void 0===t?void 0:t.assignedNodes().map((t=>t.textContent)).join("").trim())&&void 0!==e?e:""}update(t){super.update(t),["value","variant"].some((e=>t.has(e)))&&this.resolveIcon()}resolveIcon(){var t,e;let s=this.value||this.textContent;switch(this.variant){case j.file_format:this.resolvedIcon=null!==(t=m[s.replace("-","_").toUpperCase()])&&void 0!==t?t:s;break;case j.material:this.resolvedIcon=this.value||i.nothing;break;default:this.resolvedIcon=null!==(e=f[s.replace("-","_").toUpperCase()])&&void 0!==e?e:s}}firstUpdated(t){super.firstUpdated(t),setTimeout((()=>this.resolveIcon()))}}$.elementDefinitions={},$.styles=k,O([s.property()],$.prototype,"variant",void 0),O([s.property()],$.prototype,"value",void 0),O([s.state()],$.prototype,"resolvedIcon",void 0),O([s.query("slot")],$.prototype,"slottedContent",void 0),e.customElement("ft-icon")($);const I=i.css`
|
|
72
|
+
`,S=i.css`
|
|
73
73
|
`,U=e.FtReduxStore.get({name:"ft-app-info",reducers:{setBaseUrl:(t,e)=>{t.baseUrl=e.payload},setApiIntegrationIdentifier:(t,e)=>{t.apiIntegrationIdentifier=e.payload},setUiLocale:(t,e)=>{t.uiLocale=e.payload},setAvailableUiLocales:(t,e)=>{t.availableUiLocales=e.payload},setEditorMode:(t,e)=>{t.editorMode=e.payload},setNoCustom:(t,e)=>{t.noCustom=e.payload},setNoCustomComponent:(t,e)=>{t.noCustomComponent=e.payload},setSession:(t,e)=>{t.session=e.payload}},initialState:{uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],editorMode:!1,noCustom:!1,noCustomComponent:!1}});class M{static build(t){const{baseUrl:e,apiIntegrationIdentifier:i}=U.getState(),s=null!=t?t:i;if(e&&s&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,s,!0)}static get(t){var e;return null!=t?M.build(t):null!==(e=M.API)&&void 0!==e?e:M.API=M.build()}static await(t){return new Promise((e=>{let i=M.get(t);if(i)e(i);else{const s=U.subscribe((()=>{i=M.get(t),i&&(s(),e(i))}))}}))}}var N;const A=Symbol("clearAfterUnitTest");class T{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new e.CacheRegistry,this.listeners={},this.currentUiLocale="",this[N]=()=>{this.defaultMessages={},this.cache=new e.CacheRegistry,this.listeners={}},this.currentUiLocale=U.getState().uiLocale,U.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=U.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const e=t.name.toLowerCase();this.cache.setFinal(e,t),this.notify(e)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,i){var s;if(t=t.toLowerCase(),Object.keys(i).length>0){const o={...null!==(s=this.defaultMessages[t])&&void 0!==s?s:{},...i};e.deepEqual(this.defaultMessages[t],o)||(this.defaultMessages[t]=o,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,i,...s){var o,n,a;t=t.toLowerCase(),this.fetchContext(t);const r=null!==(n=null===(o=this.cache.getNow(t))||void 0===o?void 0:o.messages)&&void 0!==n?n:{};return new e.ParametrizedLabelResolver(null!==(a=this.defaultMessages[t])&&void 0!==a?a:{},r).resolve(i,...s)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,e){var i;return t=t.toLowerCase(),this.listeners[t]=null!==(i=this.listeners[t])&&void 0!==i?i:new Set,this.listeners[t].add(e),()=>{var i;return null===(i=this.listeners[t])||void 0===i?void 0:i.delete(e)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>e.delay(0).then((()=>t())).catch((()=>null)))))}}N=A,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new T((async(t,e)=>(await M.await()).getFluidTopicsMessageContext(t,e)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new T((async(t,e)=>(await M.await()).getCustomMessageContext(t,e))));const L=window.FluidTopicsI18nService,B=window.FluidTopicsCustomI18nService;var z=function(t,e,i,s){for(var o,n=arguments.length,a=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,r=t.length-1;r>=0;r--)(o=t[r])&&(a=(n<3?o(a):n>3?o(e,i,a):o(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class P extends e.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.availableUiLocales=[],this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>M.get(),this.cache=new e.CacheRegistry,this.cleanSessionDebouncer=new e.Debouncer}render(){return i.html`
|
|
74
74
|
<slot></slot>
|
|
75
|
-
`}update(t){super.update(t),t.has("baseUrl")&&U.actions.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&U.actions.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&U.actions.setUiLocale(this.uiLocale),t.has("noCustom")&&U.actions.setNoCustom(this.noCustom),t.has("editorMode")&&U.actions.setEditorMode(this.editorMode),t.has("noCustomComponent")&&U.actions.setNoCustomComponent(this.noCustomComponent),t.has("session")&&U.actions.setSession(this.session),t.has("availableUiLocales")&&U.actions.setAvailableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>L.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){const t=this.apiProvider();!this.withManualResources&&t&&(null==this.session&&(this.session=await this.cache.get("session",(async()=>{const e=await t.getCurrentSession();return e.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),e.idleTimeoutInMillis),e}))),null==this.availableUiLocales&&(this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>t.getAvailableUiLocales()))))}}P.elementDefinitions={},P.styles=
|
|
75
|
+
`}update(t){super.update(t),t.has("baseUrl")&&U.actions.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&U.actions.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&U.actions.setUiLocale(this.uiLocale),t.has("noCustom")&&U.actions.setNoCustom(this.noCustom),t.has("editorMode")&&U.actions.setEditorMode(this.editorMode),t.has("noCustomComponent")&&U.actions.setNoCustomComponent(this.noCustomComponent),t.has("session")&&U.actions.setSession(this.session),t.has("availableUiLocales")&&U.actions.setAvailableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>L.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){const t=this.apiProvider();!this.withManualResources&&t&&(null==this.session&&(this.session=await this.cache.get("session",(async()=>{const e=await t.getCurrentSession();return e.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),e.idleTimeoutInMillis),e}))),null==this.availableUiLocales&&(this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>t.getAvailableUiLocales()))))}}P.elementDefinitions={},P.styles=S,z([s.property()],P.prototype,"baseUrl",void 0),z([s.property()],P.prototype,"apiIntegrationIdentifier",void 0),z([s.property()],P.prototype,"uiLocale",void 0),z([e.jsonProperty([])],P.prototype,"availableUiLocales",void 0),z([s.property({type:Boolean})],P.prototype,"editorMode",void 0),z([s.property({type:Boolean})],P.prototype,"noCustom",void 0),z([s.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],P.prototype,"noCustomComponent",void 0),z([s.property({type:Boolean})],P.prototype,"withManualResources",void 0),z([e.jsonProperty([])],P.prototype,"messageContexts",void 0),z([e.jsonProperty(void 0)],P.prototype,"session",void 0),z([s.property({type:Object})],P.prototype,"apiProvider",void 0);class E{async listMySearches(){var t;return(null===(t=U.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await M.await()).listMySearches(U.getState().session.profile.userId):[]}}const R=new e.CacheRegistry;class K{async listMyBookmarks(){return R.get("bookmarks",(async()=>(await M.await()).listMyBookmarks(U.getState().session.profile.userId)))}clearCache(){R.clear("bookmarks")}}const G=e.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=U.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new K,U.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:i}=U.getState();e.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==i?void 0:i.profile)||(this.currentSession=i,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){G.actions.savedSearches(void 0)}clearMyBookmarks(){G.actions.bookmarks(void 0)}async reloadMySearches(){const t=new E,e=await t.listMySearches();G.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;G.actions.bookmarks(e)}}},e.customElement("ft-app-context")(P);var W=function(t,e,i,s){for(var o,n=arguments.length,a=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,r=t.length-1;r>=0;r--)(o=t[r])&&(a=(n<3?o(a):n>3?o(e,i,a):o(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};const D=Symbol("i18nProperties"),_=Symbol("i18nUnsubs");function q(t){var e;class i extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?B:L}i18n(t,e,...i){var s;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...i);const o=null!==(s=t.args)&&void 0!==s?s:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...o)}onI18nUpdate(t){var e;null===(e=this[D])||void 0===e||e.forEach(((e,i)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[i]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}update(t){var e;super.update(t),null===(e=this[D])||void 0===e||e.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[D]&&new Set([...this[D].values()].map((t=>t.context))).forEach((t=>this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[_].has(t)||this[_].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages(t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[_].forEach((t=>t())),this[_].clear()}}return e=_,W([s.property({type:Boolean})],i.prototype,"useCustomMessageContexts",void 0),i}class F extends(q(e.FtLitElement)){}class Q extends(q(e.FtLitElementRedux)){}var Z=function(t,e,i,s){for(var o,n=arguments.length,a=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,r=t.length-1;r>=0;r--)(o=t[r])&&(a=(n<3?o(a):n>3?o(e,i,a):o(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class H extends Q{constructor(){super(),this.editorMode=!1,this.addStore(U)}render(){return this.key&&this.context?i.html`
|
|
76
76
|
<span class="ft-i18n">
|
|
77
77
|
${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
|
|
78
78
|
</span>
|
|
79
|
-
`:this.editorMode?"Select a context and a label key.":i.nothing}update(t){super.update(t),this.context&&this.key&&this.defaultMessage&&this.addI18nMessages(this.context,{[this.key]:this.defaultMessage})}}
|
|
79
|
+
`:this.editorMode?"Select a context and a label key.":i.nothing}update(t){super.update(t),this.context&&this.key&&this.defaultMessage&&this.addI18nMessages(this.context,{[this.key]:this.defaultMessage})}}H.elementDefinitions={},H.styles=I,Z([e.redux()],H.prototype,"editorMode",void 0),Z([s.property()],H.prototype,"context",void 0),Z([s.property()],H.prototype,"key",void 0),Z([e.jsonProperty([])],H.prototype,"args",void 0),Z([s.property()],H.prototype,"defaultMessage",void 0);class J{static build(t){return new J(t)}static fromGwt(t){return new J(t)}constructor(t){this.name=t,this.properties=new Proxy({},{get:(t,e)=>{const i=e;return t=>({context:this.name,key:i,args:"function"==typeof t?void 0:t,argsProvider:"function"==typeof t?t:void 0})}}),this.messages=new Proxy({},{get:(t,e)=>(...t)=>L.resolveMessage(this.name,e,...t)})}}e.customElement("ft-i18n")(H);const V=J.build("designedReaderTopicContent");var X=function(t,e,i,s){for(var o,n=arguments.length,a=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,r=t.length-1;r>=0;r--)(o=t[r])&&(a=(n<3?o(a):n>3?o(e,i,a):o(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class Y extends p{constructor(){super(...arguments),this.contentPreprocessor=t=>t,this.onContentAvailable=()=>null}render(){var t,e;return this.map&&(this.error||this.content)?i.html`
|
|
80
80
|
<style>
|
|
81
81
|
@import "${null===(t=this.map)||void 0===t?void 0:t.contentStyles.topicStylesheetUrl}";
|
|
82
82
|
</style>
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
</section>
|
|
86
86
|
`:i.html`
|
|
87
87
|
<section class="topic-loading"></section>
|
|
88
|
-
`}update(t){super.update(t),(t.has("map")||t.has("tocNode"))&&this.updateContent()}updateContent(){var t;this.error=void 0,this.content=void 0,this.map&&this.tocNode&&(null===(t=this.service)||void 0===t||t.getTopicContent(this.tocNode).then((t=>this.content=t||'<div class="empty-topic"></div>')).catch((t=>this.error=t)))}contentAvailableCallback(t){var e,i,s,o,n,a
|
|
88
|
+
`}update(t){super.update(t),(t.has("map")||t.has("tocNode"))&&this.updateContent()}updated(t){super.updated(t),this.updateComplete.then((t=>{t&&this.topicContainer&&e.highlightHtml(this.topicContainer,this.searchInDocumentQuery)}))}updateContent(){var t;this.error=void 0,this.content=void 0,this.map&&this.tocNode&&(null===(t=this.service)||void 0===t||t.getTopicContent(this.tocNode).then((t=>this.content=t||'<div class="empty-topic"></div>')).catch((t=>this.error=t)))}contentAvailableCallback(t){var e,i,s,o,n,a;if(super.contentAvailableCallback(t),!this.disableContextInteractions&&(null===(e=this.scrollTarget)||void 0===e?void 0:e.section)&&(null===(i=this.tocNode)||void 0===i?void 0:i.tocId)&&(null===(s=this.tocNode)||void 0===s?void 0:s.tocId)===this.scrollTarget.tocId&&this.content){(null!==(n=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelector(`[id="${this.scrollTarget.section}"], [name="${this.scrollTarget.section}"]`))&&void 0!==n?n:this).scrollIntoView({block:"start"}),null===(a=this.stateManager)||void 0===a||a.scrollDone()}this.topicContainer&&this.onContentAvailable(this.topicContainer,this.shadowRoot)}onStoreAvailable(){super.onStoreAvailable(),this.updateContent()}renderTopicContent(){var t,e,s,n;if(this.error)return i.html`
|
|
89
89
|
<div class="topic-on-error">
|
|
90
90
|
<ft-icon>WARNING</ft-icon>
|
|
91
91
|
<div>
|
|
@@ -96,4 +96,4 @@
|
|
|
96
96
|
<div class="depth-${null===(s=this.tocNode)||void 0===s?void 0:s.depth} content-locale-${null===(n=this.map)||void 0===n?void 0:n.lang} ${a}">
|
|
97
97
|
${null!=this.content?o.unsafeHTML(`${this.contentPreprocessor(this.content)}`):i.nothing}
|
|
98
98
|
</div>
|
|
99
|
-
`}is404Error(){return 404===this.error.status}}Y.styles=a,X([e.redux()],Y.prototype,"map",void 0),X([e.redux()],Y.prototype,"scrollTarget",void 0),X([s.state()],Y.prototype,"content",void 0),X([s.state()],Y.prototype,"error",void 0),X([s.property({attribute:!1})],Y.prototype,"contentPreprocessor",void 0),X([s.property({attribute:!1})],Y.prototype,"onContentAvailable",void 0),e.customElement("ft-reader-topic-content")(Y),t.FtReaderTopicContent=Y,t.FtReaderTopicContentCssVariables=n,t.styles=a}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litUnsafeHTML);
|
|
99
|
+
`}is404Error(){return 404===this.error.status}}Y.styles=[a,e.highlightHtmlStyles],X([e.redux()],Y.prototype,"map",void 0),X([e.redux()],Y.prototype,"scrollTarget",void 0),X([s.state()],Y.prototype,"content",void 0),X([s.state()],Y.prototype,"error",void 0),X([e.redux({selector:(t,e)=>e.disableContextInteractions?"":t.searchInDocumentQuery})],Y.prototype,"searchInDocumentQuery",void 0),X([s.property({attribute:!1})],Y.prototype,"contentPreprocessor",void 0),X([s.property({attribute:!1})],Y.prototype,"onContentAvailable",void 0),X([s.query("section.topic")],Y.prototype,"topicContainer",void 0),e.customElement("ft-reader-topic-content")(Y),t.FtReaderTopicContent=Y,t.FtReaderTopicContentCssVariables=n,t.styles=a}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litUnsafeHTML);
|