@fluid-topics/ft-reader-topic-content 1.1.16 → 1.1.17

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.
@@ -17,6 +17,7 @@ export declare class FtReaderTopicContent extends FtReaderTopicComponent impleme
17
17
  protected updated(props: PropertyValues): void;
18
18
  private updateContent;
19
19
  protected contentAvailableCallback(props: PropertyValues): void;
20
+ moveSvgInShadowRoot(): void;
20
21
  protected onStoreAvailable(): void;
21
22
  renderTopicContent(): import("lit").TemplateResult<1>;
22
23
  private is404Error;
@@ -64,8 +64,21 @@ class FtReaderTopicContent extends FtReaderTopicComponent {
64
64
  }
65
65
  if (this.topicContainer) {
66
66
  this.onContentAvailable(this.topicContainer, this.shadowRoot);
67
+ this.moveSvgInShadowRoot();
67
68
  }
68
69
  }
70
+ moveSvgInShadowRoot() {
71
+ this.shadowRoot.querySelectorAll(".ft-svg-container").forEach(svgContainer => {
72
+ if (!svgContainer.shadowRoot) {
73
+ var innerHTML = svgContainer.innerHTML;
74
+ svgContainer.innerHTML = "";
75
+ var shadow = svgContainer.attachShadow({ mode: "open" });
76
+ var documentFragment = document.createRange().createContextualFragment(innerHTML);
77
+ var svgNode = document.importNode(documentFragment, true);
78
+ shadow.append(svgNode);
79
+ }
80
+ });
81
+ }
69
82
  onStoreAvailable() {
70
83
  super.onStoreAvailable();
71
84
  this.updateContent();
@@ -63,16 +63,16 @@
63
63
  .ft-icon--material {
64
64
  font-family: ${y}, "Material Icons", sans-serif;
65
65
  }
66
- `;var j;!function(t){t.fluid_topics="fluid-topics",t.file_format="file-format",t.material="material"}(j||(j={}));var O=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 $ extends e.FtLitElement{constructor(){super(...arguments),this.resolvedIcon=i.nothing}render(){const t=this.variant&&Object.values(j).includes(this.variant)?this.variant:j.fluid_topics,e=t!==j.material||!!this.value;return i.html`
66
+ `;var j;!function(t){t.fluid_topics="fluid-topics",t.file_format="file-format",t.material="material"}(j||(j={}));var O=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 S extends e.FtLitElement{constructor(){super(...arguments),this.resolvedIcon=i.nothing}render(){const t=this.variant&&Object.values(j).includes(this.variant)?this.variant:j.fluid_topics,e=t!==j.material||!!this.value;return i.html`
67
67
  <i class="ft-icon ft-icon--${t}" part="icon icon-${t}">
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 I=i.css`
72
- `,S=i.css`
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()))}}S.elementDefinitions={},S.styles=k,O([s.property()],S.prototype,"variant",void 0),O([s.property()],S.prototype,"value",void 0),O([s.state()],S.prototype,"resolvedIcon",void 0),O([s.query("slot")],S.prototype,"slottedContent",void 0),e.customElement("ft-icon")(S);const I=i.css`
72
+ `,$=i.css`
73
73
  `,M=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},setMetadataDescriptors:(t,e)=>{t.metadataDescriptors=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:[],metadataDescriptors:[],editorMode:!1,noCustom:!1,noCustomComponent:!1}});class U{static build(t){const{baseUrl:e,apiIntegrationIdentifier:i}=M.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?U.build(t):null!==(e=U.API)&&void 0!==e?e:U.API=U.build()}static await(t){return new Promise((e=>{let i=U.get(t);if(i)e(i);else{const s=M.subscribe((()=>{i=U.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=M.getState().uiLocale,M.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=M.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 U.await()).getFluidTopicsMessageContext(t,e)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new T((async(t,e)=>(await U.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.metadataDescriptors=[],this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>U.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")&&M.actions.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&M.actions.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&M.actions.setUiLocale(this.uiLocale),t.has("metadataDescriptors")&&M.actions.setMetadataDescriptors(this.metadataDescriptors),t.has("noCustom")&&M.actions.setNoCustom(this.noCustom),t.has("editorMode")&&M.actions.setEditorMode(this.editorMode),t.has("noCustomComponent")&&M.actions.setNoCustomComponent(this.noCustomComponent),t.has("session")&&M.actions.setSession(this.session),t.has("availableUiLocales")&&M.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()))),null==this.metadataDescriptors&&(this.metadataDescriptors=await this.cache.get("metadataDescriptors",(()=>t.getMetadataDescriptors()))))}}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([e.jsonProperty([])],P.prototype,"metadataDescriptors",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=M.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await U.await()).listMySearches(M.getState().session.profile.userId):[]}}const R=new e.CacheRegistry;class D{async listMyBookmarks(){return R.get("bookmarks",(async()=>(await U.await()).listMyBookmarks(M.getState().session.profile.userId)))}clearCache(){R.clear("bookmarks")}}const K=e.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=M.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new D,M.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:i}=M.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(){K.actions.savedSearches(void 0)}clearMyBookmarks(){K.actions.bookmarks(void 0)}async reloadMySearches(){const t=new E,e=await t.listMySearches();K.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;K.actions.bookmarks(e)}}},e.customElement("ft-app-context")(P);var G=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 W=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[W])||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[W])||void 0===e||e.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[W]&&new Set([...this[W].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=_,G([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(M)}render(){return this.key&&this.context?i.html`
75
+ `}update(t){super.update(t),t.has("baseUrl")&&M.actions.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&M.actions.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&M.actions.setUiLocale(this.uiLocale),t.has("metadataDescriptors")&&M.actions.setMetadataDescriptors(this.metadataDescriptors),t.has("noCustom")&&M.actions.setNoCustom(this.noCustom),t.has("editorMode")&&M.actions.setEditorMode(this.editorMode),t.has("noCustomComponent")&&M.actions.setNoCustomComponent(this.noCustomComponent),t.has("session")&&M.actions.setSession(this.session),t.has("availableUiLocales")&&M.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()))),null==this.metadataDescriptors&&(this.metadataDescriptors=await this.cache.get("metadataDescriptors",(()=>t.getMetadataDescriptors()))))}}P.elementDefinitions={},P.styles=$,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([e.jsonProperty([])],P.prototype,"metadataDescriptors",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 R{async listMySearches(){var t;return(null===(t=M.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await U.await()).listMySearches(M.getState().session.profile.userId):[]}}const E=new e.CacheRegistry;class D{async listMyBookmarks(){return E.get("bookmarks",(async()=>(await U.await()).listMyBookmarks(M.getState().session.profile.userId)))}clearCache(){E.clear("bookmarks")}}const K=e.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=M.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new D,M.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:i}=M.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(){K.actions.savedSearches(void 0)}clearMyBookmarks(){K.actions.bookmarks(void 0)}async reloadMySearches(){const t=new R,e=await t.listMySearches();K.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;K.actions.bookmarks(e)}}},e.customElement("ft-app-context")(P);var G=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 W=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[W])||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[W])||void 0===e||e.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[W]&&new Set([...this[W].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=_,G([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(M)}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>
@@ -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()}updated(t){super.updated(t),this.updateComplete.then((()=>e.waitFor((()=>this.topicContainer)))).then((t=>e.highlightHtml(t,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`
88
+ `}update(t){super.update(t),(t.has("map")||t.has("tocNode"))&&this.updateContent()}updated(t){super.updated(t),this.updateComplete.then((()=>e.waitFor((()=>this.topicContainer)))).then((t=>e.highlightHtml(t,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),this.moveSvgInShadowRoot())}moveSvgInShadowRoot(){this.shadowRoot.querySelectorAll(".ft-svg-container").forEach((t=>{if(!t.shadowRoot){var e=t.innerHTML;t.innerHTML="";var i=t.attachShadow({mode:"open"}),s=document.createRange().createContextualFragment(e),o=document.importNode(s,!0);i.append(o)}}))}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>
@@ -209,7 +209,7 @@ let ve=class extends Zt{constructor(){super(...arguments),this.renderOptions={ho
209
209
  </section>
210
210
  `:ie`
211
211
  <section class="topic-loading"></section>
212
- `}update(t){super.update(t),(t.has("map")||t.has("tocNode"))&&this.updateContent()}updated(t){super.updated(t),this.updateComplete.then((()=>A((()=>this.topicContainer)))).then((t=>function(t,e){let o=t.getAttribute("data-highlight-html-query");if((null!=o?o:"")!==(null!=e?e:"")){const o=new $e(t);o.unmark(Pe),e&&e.trim()&&o.mark(e,Pe)}t.setAttribute("data-highlight-html-query",null!=e?e:"")}(t,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,o,r,i,n,a;if(super.contentAvailableCallback(t),!this.disableContextInteractions&&(null===(e=this.scrollTarget)||void 0===e?void 0:e.section)&&(null===(o=this.tocNode)||void 0===o?void 0:o.tocId)&&(null===(r=this.tocNode)||void 0===r?void 0:r.tocId)===this.scrollTarget.tocId&&this.content){(null!==(n=null===(i=this.shadowRoot)||void 0===i?void 0:i.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,o,r;if(this.error)return ie`
212
+ `}update(t){super.update(t),(t.has("map")||t.has("tocNode"))&&this.updateContent()}updated(t){super.updated(t),this.updateComplete.then((()=>A((()=>this.topicContainer)))).then((t=>function(t,e){var o;let r=t.getAttribute("data-highlight-html-query");if((null!=r?r:"")!==(null!=e?e:"")){const r=new $e(t);r.unmark(Pe),e&&e.trim()&&(r.mark(e.replace(/"[^"]+"/g,""),{...Pe,separateWordSearch:!0}),(null!==(o=e.match(/"[^"]+"/g))&&void 0!==o?o:[]).forEach((t=>r.mark(t.replace(/"/g,""),{...Pe,separateWordSearch:!1}))))}t.setAttribute("data-highlight-html-query",null!=e?e:"")}(t,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,o,r,i,n,a;if(super.contentAvailableCallback(t),!this.disableContextInteractions&&(null===(e=this.scrollTarget)||void 0===e?void 0:e.section)&&(null===(o=this.tocNode)||void 0===o?void 0:o.tocId)&&(null===(r=this.tocNode)||void 0===r?void 0:r.tocId)===this.scrollTarget.tocId&&this.content){(null!==(n=null===(i=this.shadowRoot)||void 0===i?void 0:i.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),this.moveSvgInShadowRoot())}moveSvgInShadowRoot(){this.shadowRoot.querySelectorAll(".ft-svg-container").forEach((t=>{if(!t.shadowRoot){var e=t.innerHTML;t.innerHTML="";var o=t.attachShadow({mode:"open"}),r=document.createRange().createContextualFragment(e),i=document.importNode(r,!0);o.append(i)}}))}onStoreAvailable(){super.onStoreAvailable(),this.updateContent()}renderTopicContent(){var t,e,o,r;if(this.error)return ie`
213
213
  <div class="topic-on-error">
214
214
  <ft-icon>WARNING</ft-icon>
215
215
  <div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-topic-content",
3
- "version": "1.1.16",
3
+ "version": "1.1.17",
4
4
  "description": "Content of a topic in integrated reader.",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,14 +19,14 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-chip": "1.1.16",
23
- "@fluid-topics/ft-i18n": "1.1.16",
24
- "@fluid-topics/ft-reader-context": "1.1.16",
25
- "@fluid-topics/ft-reader-topic-context": "1.1.16",
26
- "@fluid-topics/ft-tooltip": "1.1.16",
27
- "@fluid-topics/ft-wc-utils": "1.1.16",
22
+ "@fluid-topics/ft-chip": "1.1.17",
23
+ "@fluid-topics/ft-i18n": "1.1.17",
24
+ "@fluid-topics/ft-reader-context": "1.1.17",
25
+ "@fluid-topics/ft-reader-topic-context": "1.1.17",
26
+ "@fluid-topics/ft-tooltip": "1.1.17",
27
+ "@fluid-topics/ft-wc-utils": "1.1.17",
28
28
  "@fluid-topics/public-api": "1.0.54",
29
29
  "lit": "3.1.0"
30
30
  },
31
- "gitHead": "28b18ce8d88cc14097865aad4a8b31406b351434"
31
+ "gitHead": "a8c1d6ed00e2cad51f1e81aa0486f251050db54d"
32
32
  }