@fluid-topics/ft-reader-page-title 1.1.66 → 1.1.68
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.
|
@@ -121,9 +121,9 @@ const j=Symbol.for(""),_=t=>{if(t?.r===j)return t?._$litStatic$},Y=t=>({_$litSta
|
|
|
121
121
|
`:X`
|
|
122
122
|
<slot class="ft-typography ft-typography--${this.variant}"></slot>
|
|
123
123
|
`}}Io.styles=[ho,go,yo,bo,uo,mo,Oo,xo,No,So,vo,...wo],Co([r.property()],Io.prototype,"element",void 0),Co([r.property()],Io.prototype,"variant",void 0),o.customElement("ft-typography")(Io);const Eo=e.css`
|
|
124
|
-
`,Uo=o.FtReduxStore.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1}});class Wo{static get(t){const{baseUrl:o,apiIntegrationIdentifier:e}=Uo.getState(),r=null!=t?t:e;if(o&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,r,!0)}static await(t){return new Promise((o=>{let e=Wo.get(t);if(e)o(e);else{const r=Uo.subscribe((()=>{e=Wo.get(t),e&&(r(),o(e))}))}}))}}class Ro{constructor(t=!0,e){var r;this.overrideApi=e;let a=this.constructor;a.commonCache=null!==(r=a.commonCache)&&void 0!==r?r:new o.CacheRegistry,this.cache=t?a.commonCache:new o.CacheRegistry}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Wo.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Wo.await()}clearCache(){this.cache.clearAll()}}var Zo;const Lo=Symbol("clearAfterUnitTest");class Ko extends Ro{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[Zo]=()=>{this.defaultMessages={},this.cache=new o.CacheRegistry,this.listeners={}},this.currentUiLocale=Uo.getState().uiLocale,Uo.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Uo.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var r;if(t=t.toLowerCase(),Object.keys(e).length>0){const a={...null!==(r=this.defaultMessages[t])&&void 0!==r?r:{},...e};o.deepEqual(this.defaultMessages[t],a)||(this.defaultMessages[t]=a,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...r){var a,i,n;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(i=null===(a=this.cache.getNow(t))||void 0===a?void 0:a.messages)&&void 0!==i?i:{};return new o.ParametrizedLabelResolver(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},l).resolve(e,...r)}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,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}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=>o.delay(0).then((()=>t())).catch((()=>null)))))}}Zo=Lo,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Ko{constructor(){super((async(t,o)=>(await this.awaitApi).getFluidTopicsMessageContext(t,o)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Ko{constructor(){super((async(t,o)=>(await this.awaitApi).getCustomMessageContext(t,o)))}});const zo=window.FluidTopicsI18nService,ko=window.FluidTopicsCustomI18nService;var $o=function(t,o,e,r){for(var a,i=arguments.length,n=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(a=t[l])&&(n=(i<3?a(n):i>3?a(o,e,n):a(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class Do extends o.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.
|
|
124
|
+
`,Uo=o.FtReduxStore.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1}});class Wo{static get(t){const{baseUrl:o,apiIntegrationIdentifier:e}=Uo.getState(),r=null!=t?t:e;if(o&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,r,!0)}static await(t){return new Promise((o=>{let e=Wo.get(t);if(e)o(e);else{const r=Uo.subscribe((()=>{e=Wo.get(t),e&&(r(),o(e))}))}}))}}class Ro{constructor(t=!0,e){var r;this.overrideApi=e;let a=this.constructor;a.commonCache=null!==(r=a.commonCache)&&void 0!==r?r:new o.CacheRegistry,this.cache=t?a.commonCache:new o.CacheRegistry}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Wo.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Wo.await()}clearCache(){this.cache.clearAll()}}var Zo;const Lo=Symbol("clearAfterUnitTest");class Ko extends Ro{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[Zo]=()=>{this.defaultMessages={},this.cache=new o.CacheRegistry,this.listeners={}},this.currentUiLocale=Uo.getState().uiLocale,Uo.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Uo.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var r;if(t=t.toLowerCase(),Object.keys(e).length>0){const a={...null!==(r=this.defaultMessages[t])&&void 0!==r?r:{},...e};o.deepEqual(this.defaultMessages[t],a)||(this.defaultMessages[t]=a,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...r){var a,i,n;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(i=null===(a=this.cache.getNow(t))||void 0===a?void 0:a.messages)&&void 0!==i?i:{};return new o.ParametrizedLabelResolver(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},l).resolve(e,...r)}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,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}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=>o.delay(0).then((()=>t())).catch((()=>null)))))}}Zo=Lo,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Ko{constructor(){super((async(t,o)=>(await this.awaitApi).getFluidTopicsMessageContext(t,o)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Ko{constructor(){super((async(t,o)=>(await this.awaitApi).getCustomMessageContext(t,o)))}});const zo=window.FluidTopicsI18nService,ko=window.FluidTopicsCustomI18nService;var $o=function(t,o,e,r){for(var a,i=arguments.length,n=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(a=t[l])&&(n=(i<3?a(n):i>3?a(o,e,n):a(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class Do extends o.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.navigatorOnline=!1,this.forcedOffline=!1,this.apiProvider=()=>Wo.get(),this.messageContexts=[],this.cache=new o.CacheRegistry,this.cleanSessionDebouncer=new o.Debouncer}render(){return e.html`
|
|
125
125
|
<slot></slot>
|
|
126
|
-
`}update(t){super.update(t),t.has("baseUrl")&&(Uo.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Uo.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Uo.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Uo.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Uo.actions.noCustom(this.noCustom),t.has("editorMode")&&Uo.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Uo.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Uo.actions.session(this.session),t.has("availableUiLocales")&&Uo.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>zo.addContext(t))),t.has("openExternalDocumentInNewTab")&&Uo.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}Do.elementDefinitions={},Do.styles=Eo,$o([r.property()],Do.prototype,"baseUrl",void 0),$o([r.property()],Do.prototype,"apiIntegrationIdentifier",void 0),$o([r.property()],Do.prototype,"uiLocale",void 0),$o([o.jsonProperty(null)],Do.prototype,"availableUiLocales",void 0),$o([o.jsonProperty(null)],Do.prototype,"metadataConfiguration",void 0),$o([r.property({type:Boolean})],Do.prototype,"editorMode",void 0),$o([r.property({type:Boolean})],Do.prototype,"noCustom",void 0),$o([r.property({type:Boolean})],Do.prototype,"openExternalDocumentInNewTab",void 0),$o([r.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Do.prototype,"noCustomComponent",void 0),$o([r.property({type:Boolean})],Do.prototype,"withManualResources",void 0),$o([
|
|
126
|
+
`}update(t){super.update(t),t.has("baseUrl")&&(Uo.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Uo.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Uo.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Uo.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Uo.actions.noCustom(this.noCustom),t.has("editorMode")&&Uo.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Uo.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Uo.actions.session(this.session),t.has("availableUiLocales")&&Uo.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>zo.addContext(t))),t.has("openExternalDocumentInNewTab")&&Uo.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),t.has("navigatorOnline")&&Uo.actions.navigatorOnline(this.navigatorOnline),t.has("forcedOffline")&&Uo.actions.forcedOffline(this.forcedOffline),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}Do.elementDefinitions={},Do.styles=Eo,$o([r.property()],Do.prototype,"baseUrl",void 0),$o([r.property()],Do.prototype,"apiIntegrationIdentifier",void 0),$o([r.property()],Do.prototype,"uiLocale",void 0),$o([o.jsonProperty(null)],Do.prototype,"availableUiLocales",void 0),$o([o.jsonProperty(null)],Do.prototype,"metadataConfiguration",void 0),$o([r.property({type:Boolean})],Do.prototype,"editorMode",void 0),$o([r.property({type:Boolean})],Do.prototype,"noCustom",void 0),$o([r.property({type:Boolean})],Do.prototype,"openExternalDocumentInNewTab",void 0),$o([r.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Do.prototype,"noCustomComponent",void 0),$o([r.property({type:Boolean})],Do.prototype,"withManualResources",void 0),$o([r.property({type:Boolean})],Do.prototype,"navigatorOnline",void 0),$o([r.property({type:Boolean})],Do.prototype,"forcedOffline",void 0),$o([r.property({type:Object})],Do.prototype,"apiProvider",void 0),$o([o.jsonProperty([])],Do.prototype,"messageContexts",void 0),$o([o.jsonProperty(void 0)],Do.prototype,"session",void 0);class Fo extends Ro{async listMySearches(){let t=Uo.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class Ao extends Ro{async listMyBookmarks(){let t=Uo.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const Bo=o.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=Uo.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Ao,this.savedSearchesService=new Fo,Uo.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=Uo.getState();o.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),Bo.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),Bo.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();Bo.actions.savedSearches(t)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const o=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Bo.actions.bookmarks(o)}}},o.customElement("ft-app-context")(Do);const Ho=e.css`
|
|
127
127
|
`;var Go=function(t,o,e,r){for(var a,i=arguments.length,n=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(a=t[l])&&(n=(i<3?a(n):i>3?a(o,e,n):a(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};const Mo=Symbol("i18nAttributes"),Po=Symbol("i18nProperties"),To=Symbol("i18nUnsubs");function jo(t){var o;class e extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[o]=new Map}get i18nService(){return this.useCustomMessageContexts?ko:zo}i18n(t,o,...e){var r;if("string"==typeof t)return this.i18nService.resolveMessage(t,o,...e);const a=null!==(r=t.args)&&void 0!==r?r:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...a)}onI18nUpdate(t){var o,e;null===(o=this[Mo])||void 0===o||o.forEach(((o,e)=>{var r;const a=this.getI18nAttributeValue(e);(null===(r=null==a?void 0:a.context)||void 0===r?void 0:r.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(e,a,o)})),null===(e=this[Po])||void 0===e||e.forEach(((o,e)=>{o.context.toLowerCase()===t.toLowerCase()&&(this[e]=this.i18n(o))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,o,e){this[t]={...o,message:this.i18n({context:o.context,key:o.key,...e})}}update(t){var o,e;super.update(t),null===(o=this[Mo])||void 0===o||o.forEach(((o,e)=>{const r=this.getI18nAttributeValue(e);(null==r?void 0:r.context)&&r.key&&(t.has(e)||null!=o.argsProvider)&&(t.has(e)&&this.addI18nContext(r.context),this.updateI18nAttributeMessage(e,r,o))})),null===(e=this[Po])||void 0===e||e.forEach(((t,o)=>{null!=t.argsProvider&&(this[o]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,o,e,r;super.connectedCallback(),new Set([...null!==(o=null===(t=this[Po])||void 0===t?void 0:t.values())&&void 0!==o?o:[],...[...null!==(r=null===(e=this[Mo])||void 0===e?void 0:e.keys())&&void 0!==r?r:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,o){t=t.toLowerCase(),this[To].has(t)||this[To].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=o?o:{})}addI18nContext(t,o){this.addI18nMessages("string"==typeof t?t:t.name,o)}disconnectedCallback(){super.disconnectedCallback(),this[To].forEach((t=>t())),this[To].clear()}}return o=To,Go([r.property({type:Boolean})],e.prototype,"useCustomMessageContexts",void 0),e}class _o extends(jo(o.FtLitElement)){}class Yo extends(jo(o.FtLitElementRedux)){}var Vo=function(t,o,e,r){for(var a,i=arguments.length,n=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(a=t[l])&&(n=(i<3?a(n):i>3?a(o,e,n):a(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class Xo extends Yo{constructor(){super(),this.editorMode=!1,this.addStore(Uo)}render(){return this.key&&this.context?e.html`
|
|
128
128
|
<span class="ft-i18n">
|
|
129
129
|
${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
|