@fluid-topics/ft-reader-topic-content 0.3.65 → 0.3.67
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.
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
.topic-loading {
|
|
16
16
|
height: 100vh;
|
|
17
17
|
}
|
|
18
|
-
`;var r=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 l extends Event{constructor(){super("register-ft-reader-component",{bubbles:!0,composed:!0})}}class c extends(function(t){class e extends t{constructor(){super(...arguments),this.registerIntervalReader=0}setReaderStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"reader")}clearStateManager(){this.stateManager&&(this.removeStore("reader"),this.stateManager=void 0)}get service(){var t;return null===(t=this.stateManager)||void 0===t?void 0:t.service}connectedCallback(){super.connectedCallback(),this.registerIntervalReader=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this.registerIntervalReader):this.dispatchEvent(new l)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return r([s.state()],e.prototype,"stateManager",void 0),e}(e.FtLitElementRedux)){}var x,d
|
|
18
|
+
`;var r=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 l extends Event{constructor(){super("register-ft-reader-component",{bubbles:!0,composed:!0})}}class c extends(function(t){class e extends t{constructor(){super(...arguments),this.registerIntervalReader=0}setReaderStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"reader")}clearStateManager(){this.stateManager&&(this.removeStore("reader"),this.stateManager=void 0)}get service(){var t;return null===(t=this.stateManager)||void 0===t?void 0:t.service}connectedCallback(){super.connectedCallback(),this.registerIntervalReader=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this.registerIntervalReader):this.dispatchEvent(new l)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return r([s.state()],e.prototype,"stateManager",void 0),e}(e.FtLitElementRedux)){}var x,h,d=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 u extends Event{constructor(){super("register-ft-reader-topic-component",{bubbles:!0,composed:!0})}}class v extends(function(t){class e extends t{constructor(){super(...arguments),this.disableContextInteractions=!1,this.registerIntervalTopic=0}connectedCallback(){super.connectedCallback(),this.registerIntervalTopic=window.setInterval((()=>this.tryToRegisterToTopicContext()),50)}tryToRegisterToTopicContext(){null!=this.tocNode?window.clearInterval(this.registerIntervalTopic):this.dispatchEvent(new u)}disconnectedCallback(){super.disconnectedCallback(),this.tocNode=void 0}}return d([s.state()],e.prototype,"tocNode",void 0),d([s.state()],e.prototype,"disableContextInteractions",void 0),e}(c)){}!function(t){t.THUMBS_DOWN="",t.THUMBS_DOWN_PLAIN="",t.THUMBS_UP="",t.THUMBS_UP_PLAIN="",t.STAR="",t.STAR_PLAIN="",t.DESKTOP="",t.TABLET_LANDSCAPE="",t.TABLET_PORTRAIT="",t.MOBILE_LANDSCAPE="",t.MOBILE_PORTRAIT="",t.ARROW_RIGHT_TO_LINE="",t.THIN_ARROW_UP="",t.CONTEXTUAL="",t.UNSTRUCTURED_DOC="",t.RESET="",t.THIN_ARROW_LEFT="",t.THIN_ARROW_RIGHT="",t.MY_COLLECTIONS="",t.OFFLINE_SETTINGS="",t.MY_LIBRARY="",t.RATE_PLAIN="",t.RATE="",t.FEEDBACK_PLAIN="",t.PAUSE="",t.PLAY="",t.RELATIVES_PLAIN="",t.RELATIVES="",t.SHORTCUT_MENU="",t.PRINT="",t.DEFAULT_ROLES="",t.ACCOUNT_SETTINGS="",t.ONLINE="",t.OFFLINE="",t.UPLOAD="",t.BOOK_PLAIN="",t.SYNC="",t.SHARED_PBK="",t.COLLECTIONS="",t.SEARCH_IN_PUBLICATION="",t.BOOKS="",t.LOCKER="",t.ARROW_DOWN="",t.ARROW_LEFT="",t.ARROW_RIGHT="",t.ARROW_UP="",t.SAVE="",t.MAILS_AND_NOTIFICATIONS="",t.DOT="",t.MINUS="",t.PLUS="",t.FILTERS="",t.STRIPE_ARROW_RIGHT="",t.STRIPE_ARROW_LEFT="",t.ATTACHMENTS="",t.ADD_BOOKMARK="",t.BOOKMARK="",t.EXPORT="",t.MENU="",t.TAG="",t.TAG_PLAIN="",t.COPY_TO_CLIPBOARD="",t.COLUMNS="",t.ARTICLE="",t.CLOSE_PLAIN="",t.CHECK_PLAIN="",t.LOGOUT="",t.SIGN_IN="",t.THIN_ARROW="",t.TRIANGLE_BOTTOM="",t.TRIANGLE_LEFT="",t.TRIANGLE_RIGHT="",t.TRIANGLE_TOP="",t.FACET_HAS_DESCENDANT="",t.MINUS_PLAIN="",t.PLUS_PLAIN="",t.INFO="",t.ICON_EXPAND="",t.ICON_COLLAPSE="",t.ADD_TO_PBK="",t.ALERT="",t.ADD_ALERT="",t.BACK_TO_SEARCH="",t.DOWNLOAD="",t.EDIT="",t.FEEDBACK="",t.MODIFY_PBK="",t.SCHEDULED="",t.SEARCH="",t.SHARE="󨃱",t.TOC="",t.WRITE_UGC="",t.TRASH="",t.EXTLINK="",t.CALENDAR="",t.BOOK="",t.DOWNLOAD_PLAIN="",t.CHECK="",t.TOPICS="",t.EYE="",t.DISC="",t.CIRCLE="",t.SHARED="",t.SORT_UNSORTED="",t.SORT_UP="",t.SORT_DOWN="",t.WORKING="",t.CLOSE="",t.ZOOM_OUT="",t.ZOOM_IN="",t.ZOOM_REALSIZE="",t.ZOOM_FULLSCREEN="",t.ADMIN_RESTRICTED="",t.ADMIN_THEME="",t.WARNING="",t.CONTEXT="",t.SEARCH_HOME="",t.STEPS="",t.HOME="",t.TRANSLATE="",t.USER="",t.ADMIN="",t.ANALYTICS="",t.ADMIN_KHUB="",t.ADMIN_USERS="",t.ADMIN_INTEGRATION="",t.ADMIN_PORTAL=""}(x||(x={})),function(t){t.UNKNOWN="",t.ABW="",t.AUDIO="",t.AVI="",t.CHM="",t.CODE="",t.CSV="",t.DITA="",t.EPUB="",t.EXCEL="",t.FLAC="",t.GIF="",t.GZIP="",t.HTML="",t.IMAGE="",t.JPEG="",t.JSON="",t.M4A="",t.MOV="",t.MP3="",t.MP4="",t.OGG="",t.PDF="",t.PNG="",t.POWERPOINT="",t.RAR="",t.STP="",t.TEXT="",t.VIDEO="",t.WAV="",t.WMA="",t.WORD="",t.XML="",t.YAML="",t.ZIP=""}(h||(h={})),new Map([...["abw"].map((t=>[t,h.ABW])),...["3gp","act","aiff","aac","amr","au","awb","dct","dss","dvf","gsm","iklax","ivs","mmf","mpc","msv","opus","ra","rm","raw","sln","tta","vox","wv"].map((t=>[t,h.AUDIO])),...["avi"].map((t=>[t,h.AVI])),...["chm","xhs"].map((t=>[t,h.CHM])),...["java","py","php","php3","php4","php5","js","javascript","rb","rbw","c","cpp","cxx","h","hh","hpp","hxx","sh","bash","zsh","tcsh","ksh","csh","vb","scala","pl","prl","perl","groovy","ceylon","aspx","jsp","scpt","applescript","bas","bat","lua","jsp","mk","cmake","css","sass","less","m","mm","xcodeproj"].map((t=>[t,h.CODE])),...["csv"].map((t=>[t,h.CSV])),...["dita","ditamap","ditaval"].map((t=>[t,h.DITA])),...["epub"].map((t=>[t,h.EPUB])),...["xls","xlt","xlm","xlsx","xlsm","xltx","xltm","xlsb","xla","xlam","xll","xlw"].map((t=>[t,h.EXCEL])),...["flac"].map((t=>[t,h.FLAC])),...["gif"].map((t=>[t,h.GIF])),...["gzip","x-gzip","giz","gz","tgz"].map((t=>[t,h.GZIP])),...["html","htm","xhtml"].map((t=>[t,h.HTML])),...["ai","vml","xps","img","cpt","psd","psp","xcf","svg","svg+xml","bmp","bpg","ppm","pgm","pbm","pnm","rif","tif","tiff","webp","wmf"].map((t=>[t,h.IMAGE])),...["jpeg","jpg","jpe"].map((t=>[t,h.JPEG])),...["json"].map((t=>[t,h.JSON])),...["m4a","m4p"].map((t=>[t,h.M4A])),...["mov","qt"].map((t=>[t,h.MOV])),...["mp3"].map((t=>[t,h.MP3])),...["mp4","m4v"].map((t=>[t,h.MP4])),...["ogg","oga"].map((t=>[t,h.OGG])),...["pdf","ps"].map((t=>[t,h.PDF])),...["png"].map((t=>[t,h.PNG])),...["ppt","pot","pps","pptx","pptm","potx","potm","ppam","ppsx","ppsm","sldx","sldm"].map((t=>[t,h.POWERPOINT])),...["rar"].map((t=>[t,h.RAR])),...["stp"].map((t=>[t,h.STP])),...["txt","rtf","md","mdown"].map((t=>[t,h.TEXT])),...["webm","mkv","flv","vob","ogv","ogg","drc","mng","wmv","yuv","rm","rmvb","asf","mpg","mp2","mpeg","mpe","mpv","m2v","svi","3gp","3g2","mxf","roq","nsv"].map((t=>[t,h.VIDEO])),...["wav"].map((t=>[t,h.WAV])),...["wma"].map((t=>[t,h.WMA])),...["doc","dot","docx","docm","dotx","dotm","docb"].map((t=>[t,h.WORD])),...["xml","xsl","rdf"].map((t=>[t,h.XML])),...["yaml","yml","x-yaml"].map((t=>[t,h.YAML])),...["zip"].map((t=>[t,h.ZIP]))]);const p=e.FtCssVariableFactory.create("--ft-icon-font-size","SIZE","24px"),f=e.FtCssVariableFactory.extend("--ft-icon-fluid-topics-font-family",e.FtCssVariableFactory.create("--ft-icon-font-family","UNKNOWN","ft-icons")),m=e.FtCssVariableFactory.extend("--ft-icon-file-format-font-family",e.FtCssVariableFactory.create("--ft-icon-font-family","UNKNOWN","ft-mime")),b=e.FtCssVariableFactory.extend("--ft-icon-material-font-family",e.FtCssVariableFactory.create("--ft-icon-font-family","UNKNOWN","Material Icons")),g=e.FtCssVariableFactory.create("--ft-icon-vertical-align","UNKNOWN","unset"),w=i.css`
|
|
19
19
|
:host, i.ft-icon {
|
|
20
20
|
display: inline-flex;
|
|
21
21
|
align-items: center;
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
${o.unsafeHTML(this.resolvedIcon)}
|
|
68
68
|
<slot ?hidden=${s}></slot>
|
|
69
69
|
</i>
|
|
70
|
-
`}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 y.file_format:this.resolvedIcon=null!==(t=
|
|
71
|
-
`,
|
|
72
|
-
`,
|
|
70
|
+
`}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 y.file_format:this.resolvedIcon=null!==(t=h[s.replace("-","_").toUpperCase()])&&void 0!==t?t:s;break;case y.material:this.resolvedIcon=this.value||i.nothing;break;default:this.resolvedIcon=null!==(e=x[s.replace("-","_").toUpperCase()])&&void 0!==e?e:s}}firstUpdated(t){super.firstUpdated(t),setTimeout((()=>this.resolveIcon()))}}j.elementDefinitions={},j.styles=w,C([s.property()],j.prototype,"variant",void 0),C([s.property()],j.prototype,"value",void 0),C([s.state()],j.prototype,"resolvedIcon",void 0),C([s.query("slot")],j.prototype,"slottedContent",void 0),e.customElement("ft-icon")(j);const $=i.css`
|
|
71
|
+
`,k=i.css`
|
|
72
|
+
`,O=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 U{static build(t){const{baseUrl:e,apiIntegrationIdentifier:i}=O.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=O.subscribe((()=>{i=U.get(t),i&&(s(),e(i))}))}}))}}var I;const N=Symbol("clearAfterUnitTest");class M{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new e.CacheRegistry,this.listeners={},this.currentUiLocale="",this[I]=()=>{this.defaultMessages={},this.cache=new e.CacheRegistry,this.listeners={}},this.currentUiLocale=O.getState().uiLocale,O.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=O.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)))))}}I=N,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new M((async(t,e)=>(await U.await()).getFluidTopicsMessageContext(t,e)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new M((async(t,e)=>(await U.await()).getCustomMessageContext(t,e))));const S=window.FluidTopicsI18nService,T=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 A 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=()=>U.get(),this.cache=new e.CacheRegistry,this.cleanSessionDebouncer=new e.Debouncer}render(){return i.html`
|
|
73
73
|
<slot></slot>
|
|
74
|
-
`}updated(t){super.updated(t),t.has("baseUrl")&&
|
|
74
|
+
`}updated(t){super.updated(t),t.has("baseUrl")&&O.actions.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&O.actions.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&O.actions.setUiLocale(this.uiLocale),t.has("noCustom")&&O.actions.setNoCustom(this.noCustom),t.has("editorMode")&&O.actions.setEditorMode(this.editorMode),t.has("noCustomComponent")&&O.actions.setNoCustomComponent(this.noCustomComponent),t.has("session")&&O.actions.setSession(this.session),t.has("availableUiLocales")&&O.actions.setAvailableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>S.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()))))}}A.elementDefinitions={},A.styles=k,z([s.property()],A.prototype,"baseUrl",void 0),z([s.property()],A.prototype,"apiIntegrationIdentifier",void 0),z([s.property()],A.prototype,"uiLocale",void 0),z([e.jsonProperty([])],A.prototype,"availableUiLocales",void 0),z([s.property({type:Boolean})],A.prototype,"editorMode",void 0),z([s.property({type:Boolean})],A.prototype,"noCustom",void 0),z([s.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],A.prototype,"noCustomComponent",void 0),z([s.property({type:Boolean})],A.prototype,"withManualResources",void 0),z([e.jsonProperty([])],A.prototype,"messageContexts",void 0),z([e.jsonProperty(void 0)],A.prototype,"session",void 0),z([s.property({type:Object})],A.prototype,"apiProvider",void 0),e.customElement("ft-app-context")(A);var L=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 P=Symbol("i18nProperties"),E=Symbol("i18nUnsubs");function G(t){var e;class i extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?T:S}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[P])||void 0===e||e.forEach(((e,i)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[i]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}updated(t){var e;super.updated(t),null===(e=this[P])||void 0===e||e.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[P]&&new Set([...this[P].values()].map((t=>t.context))).forEach((t=>this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[E].has(t)||this[E].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[E].forEach((t=>t())),this[E].clear()}}return e=E,L([s.property({type:Boolean})],i.prototype,"useCustomMessageContexts",void 0),i}class R extends(G(e.FtLitElement)){}class W extends(G(e.FtLitElementRedux)){}var B=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 K extends W{constructor(){super(),this.editorMode=!1,this.addStore(O)}render(){return this.key&&this.context?i.html`
|
|
75
75
|
<span class="ft-i18n">${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}</span>
|
|
76
|
-
`:i.nothing}update(t){super.update(t),this.context&&this.key&&this.defaultMessage&&this.addI18nMessages(this.context,{[this.key]:this.defaultMessage})}}
|
|
76
|
+
`: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})}}K.elementDefinitions={},K.styles=$,B([e.redux()],K.prototype,"editorMode",void 0),B([s.property()],K.prototype,"context",void 0),B([s.property()],K.prototype,"key",void 0),B([e.jsonProperty([])],K.prototype,"args",void 0),B([s.property()],K.prototype,"defaultMessage",void 0);class _{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)=>S.resolveMessage(this.name,e,...t)})}static build(t){return new _(t)}static fromGwt(t){return new _(t)}}e.customElement("ft-i18n")(K);const q=_.build("designedReaderTopicContent");var D=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 F extends v{render(){var t,e;return this.map&&(this.error||this.content)?i.html`
|
|
77
77
|
<style>
|
|
78
78
|
@import "${null===(t=this.map)||void 0===t?void 0:t.contentStyles.topicStylesheetUrl}";
|
|
79
79
|
</style>
|
|
@@ -86,11 +86,11 @@
|
|
|
86
86
|
<div class="topic-on-error">
|
|
87
87
|
<ft-icon>WARNING</ft-icon>
|
|
88
88
|
<div>
|
|
89
|
-
${this.is404Error()?
|
|
89
|
+
${this.is404Error()?q.messages.topicMissingAdvice():q.messages.somethingWentWrong()}
|
|
90
90
|
</div>
|
|
91
91
|
</div>
|
|
92
92
|
`;const a=null!==(e=null===(t=this.map)||void 0===t?void 0:t.contentStyles.customCssClasses.join(" "))&&void 0!==e?e:"";return i.html`
|
|
93
93
|
<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}">
|
|
94
94
|
${o.unsafeHTML(`${this.content}`)}
|
|
95
95
|
</div>
|
|
96
|
-
`}is404Error(){return 404===this.error.status}}
|
|
96
|
+
`}is404Error(){return 404===this.error.status}}F.styles=a,D([e.redux()],F.prototype,"map",void 0),D([e.redux()],F.prototype,"scrollTarget",void 0),D([s.state()],F.prototype,"content",void 0),D([s.state()],F.prototype,"error",void 0),e.customElement("ft-reader-topic-content")(F),t.FtReaderTopicContent=F,t.FtReaderTopicContentCssVariables=n,t.styles=a,Object.defineProperty(t,"t",{value:!0})}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litUnsafeHTML);
|
|
@@ -186,11 +186,11 @@ var ut,lt;class ht extends R{constructor(){super(...arguments),this.renderOption
|
|
|
186
186
|
*/
|
|
187
187
|
function(t,e){return(({finisher:t,descriptor:e})=>(i,n)=>{var r;if(void 0===n){const n=null!==(r=i.originalKey)&&void 0!==r?r:i.key,o=null!=e?{kind:"method",placement:"prototype",key:n,descriptor:e(i.key)}:{...i,key:n};return null!=t&&(o.finisher=function(e){t(e,n)}),o}{const r=i.constructor;void 0!==e&&Object.defineProperty(i,n,e(n)),null==t||t(r,n)}})({descriptor:i=>{const n={get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t))&&void 0!==i?i:null},enumerable:!0,configurable:!0};if(e){const e="symbol"==typeof i?Symbol():"__"+i;n.get=function(){var i,n;return void 0===this[e]&&(this[e]=null!==(n=null===(i=this.renderRoot)||void 0===i?void 0:i.querySelector(t))&&void 0!==n?n:null),this[e]}}return n}})}("slot")],ji.prototype,"slottedContent",void 0),u("ft-icon")(ji);const Ci=b`
|
|
188
188
|
`,Ei=b`
|
|
189
|
-
`,Ni=Ye.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 Ri{static build(t){const{baseUrl:e,apiIntegrationIdentifier:i}=Ni.getState(),n=null!=t?t:i;if(e&&n&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,n,!0)}static get(t){var e;return null!=t?Ri.build(t):null!==(e=Ri.API)&&void 0!==e?e:Ri.API=Ri.build()}static await(t){return new Promise((e=>{let i=Ri.get(t);if(i)e(i);else{const n=Ni.subscribe((()=>{i=Ri.get(t),i&&(n(),e(i))}))}}))}}var Mi;const $i=Symbol("clearAfterUnitTest");class ki{constructor(t){this.
|
|
189
|
+
`,Ni=Ye.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 Ri{static build(t){const{baseUrl:e,apiIntegrationIdentifier:i}=Ni.getState(),n=null!=t?t:i;if(e&&n&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,n,!0)}static get(t){var e;return null!=t?Ri.build(t):null!==(e=Ri.API)&&void 0!==e?e:Ri.API=Ri.build()}static await(t){return new Promise((e=>{let i=Ri.get(t);if(i)e(i);else{const n=Ni.subscribe((()=>{i=Ri.get(t),i&&(n(),e(i))}))}}))}}var Mi;const $i=Symbol("clearAfterUnitTest");class ki{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new i,this.listeners={},this.currentUiLocale="",this[Mi]=()=>{this.defaultMessages={},this.cache=new i,this.listeners={}},this.currentUiLocale=Ni.getState().uiLocale,Ni.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Ni.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,e){var i;if(t=t.toLowerCase(),Object.keys(e).length>0){const n={...null!==(i=this.defaultMessages[t])&&void 0!==i?i:{},...e};c(this.defaultMessages[t],n)||(this.defaultMessages[t]=n,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...i){var n,r,o;t=t.toLowerCase(),this.fetchContext(t);const s=null!==(r=null===(n=this.cache.getNow(t))||void 0===n?void 0:n.messages)&&void 0!==r?r:{};return new bt(null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},s).resolve(e,...i)}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=>{return(e=0,new Promise((t=>setTimeout(t,e)))).then((()=>t())).catch((()=>null));var e})))}}Mi=$i,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new ki((async(t,e)=>(await Ri.await()).getFluidTopicsMessageContext(t,e)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new ki((async(t,e)=>(await Ri.await()).getCustomMessageContext(t,e))));const Ui=window.FluidTopicsI18nService,Ai=window.FluidTopicsCustomI18nService;var Pi=function(t,e,i,n){for(var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};class Fi extends xt{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=()=>Ri.get(),this.cache=new i,this.cleanSessionDebouncer=new n}render(){return J`
|
|
190
190
|
<slot></slot>
|
|
191
|
-
`}updated(t){super.updated(t),t.has("baseUrl")&&Ni.actions.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&Ni.actions.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Ni.actions.setUiLocale(this.uiLocale),t.has("noCustom")&&Ni.actions.setNoCustom(this.noCustom),t.has("editorMode")&&Ni.actions.setEditorMode(this.editorMode),t.has("noCustomComponent")&&Ni.actions.setNoCustomComponent(this.noCustomComponent),t.has("session")&&Ni.actions.setSession(this.session),t.has("availableUiLocales")&&Ni.actions.setAvailableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Ui.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()))))}}
|
|
191
|
+
`}updated(t){super.updated(t),t.has("baseUrl")&&Ni.actions.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&Ni.actions.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Ni.actions.setUiLocale(this.uiLocale),t.has("noCustom")&&Ni.actions.setNoCustom(this.noCustom),t.has("editorMode")&&Ni.actions.setEditorMode(this.editorMode),t.has("noCustomComponent")&&Ni.actions.setNoCustomComponent(this.noCustomComponent),t.has("session")&&Ni.actions.setSession(this.session),t.has("availableUiLocales")&&Ni.actions.setAvailableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Ui.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()))))}}Fi.elementDefinitions={},Fi.styles=Ei,Pi([o()],Fi.prototype,"baseUrl",void 0),Pi([o()],Fi.prototype,"apiIntegrationIdentifier",void 0),Pi([o()],Fi.prototype,"uiLocale",void 0),Pi([l([])],Fi.prototype,"availableUiLocales",void 0),Pi([o({type:Boolean})],Fi.prototype,"editorMode",void 0),Pi([o({type:Boolean})],Fi.prototype,"noCustom",void 0),Pi([o({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Fi.prototype,"noCustomComponent",void 0),Pi([o({type:Boolean})],Fi.prototype,"withManualResources",void 0),Pi([l([])],Fi.prototype,"messageContexts",void 0),Pi([l(void 0)],Fi.prototype,"session",void 0),Pi([o({type:Object})],Fi.prototype,"apiProvider",void 0),u("ft-app-context")(Fi);var Li=function(t,e,i,n){for(var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};const _i=Symbol("i18nProperties"),Ti=Symbol("i18nUnsubs");function Ii(t){var e;class i extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?Ai:Ui}i18n(t,e,...i){var n;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...i);const r=null!==(n=t.args)&&void 0!==n?n:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...r)}onI18nUpdate(t){var e;null===(e=this[_i])||void 0===e||e.forEach(((e,i)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[i]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}updated(t){var e;super.updated(t),null===(e=this[_i])||void 0===e||e.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[_i]&&new Set([...this[_i].values()].map((t=>t.context))).forEach((t=>this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[Ti].has(t)||this[Ti].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[Ti].forEach((t=>t())),this[Ti].clear()}}return e=Ti,Li([o({type:Boolean})],i.prototype,"useCustomMessageContexts",void 0),i}class Bi extends(Ii(xt)){}class Di extends(Ii(Ge)){}var Wi=function(t,e,i,n){for(var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};class Ki extends Di{constructor(){super(),this.editorMode=!1,this.addStore(Ni)}render(){return this.key&&this.context?J`
|
|
192
192
|
<span class="ft-i18n">${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}</span>
|
|
193
|
-
`:q}update(t){super.update(t),this.context&&this.key&&this.defaultMessage&&this.addI18nMessages(this.context,{[this.key]:this.defaultMessage})}}
|
|
193
|
+
`:this.editorMode?"Select a context and a label key.":q}update(t){super.update(t),this.context&&this.key&&this.defaultMessage&&this.addI18nMessages(this.context,{[this.key]:this.defaultMessage})}}Ki.elementDefinitions={},Ki.styles=Ci,Wi([Xe()],Ki.prototype,"editorMode",void 0),Wi([o()],Ki.prototype,"context",void 0),Wi([o()],Ki.prototype,"key",void 0),Wi([l([])],Ki.prototype,"args",void 0),Wi([o()],Ki.prototype,"defaultMessage",void 0);class zi{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)=>Ui.resolveMessage(this.name,e,...t)})}static build(t){return new zi(t)}static fromGwt(t){return new zi(t)}}u("ft-i18n")(Ki);const Hi=zi.build("designedReaderTopicContent");var Vi=function(t,e,i,n){for(var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};class Ji extends ui{render(){var t,e;return this.map&&(this.error||this.content)?J`
|
|
194
194
|
<style>
|
|
195
195
|
@import "${null===(t=this.map)||void 0===t?void 0:t.contentStyles.topicStylesheetUrl}";
|
|
196
196
|
</style>
|
|
@@ -203,11 +203,11 @@ function(t,e){return(({finisher:t,descriptor:e})=>(i,n)=>{var r;if(void 0===n){c
|
|
|
203
203
|
<div class="topic-on-error">
|
|
204
204
|
<ft-icon>WARNING</ft-icon>
|
|
205
205
|
<div>
|
|
206
|
-
${this.is404Error()?
|
|
206
|
+
${this.is404Error()?Hi.messages.topicMissingAdvice():Hi.messages.somethingWentWrong()}
|
|
207
207
|
</div>
|
|
208
208
|
</div>
|
|
209
209
|
`;const r=null!==(e=null===(t=this.map)||void 0===t?void 0:t.contentStyles.customCssClasses.join(" "))&&void 0!==e?e:"";return J`
|
|
210
210
|
<div class="depth-${null===(i=this.tocNode)||void 0===i?void 0:i.depth} content-locale-${null===(n=this.map)||void 0===n?void 0:n.lang} ${r}">
|
|
211
211
|
${di(`${this.content}`)}
|
|
212
212
|
</div>
|
|
213
|
-
`}is404Error(){return 404===this.error.status}}
|
|
213
|
+
`}is404Error(){return 404===this.error.status}}Ji.styles=ni,Vi([Xe()],Ji.prototype,"map",void 0),Vi([Xe()],Ji.prototype,"scrollTarget",void 0),Vi([s()],Ji.prototype,"content",void 0),Vi([s()],Ji.prototype,"error",void 0),u("ft-reader-topic-content")(Ji),t.FtReaderTopicContent=Ji,t.FtReaderTopicContentCssVariables=ii,t.styles=ni,Object.defineProperty(t,"U",{value:!0})}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-reader-topic-content",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.67",
|
|
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": "0.3.
|
|
23
|
-
"@fluid-topics/ft-i18n": "0.3.
|
|
24
|
-
"@fluid-topics/ft-reader-context": "0.3.
|
|
25
|
-
"@fluid-topics/ft-reader-topic-context": "0.3.
|
|
26
|
-
"@fluid-topics/ft-tooltip": "0.3.
|
|
27
|
-
"@fluid-topics/ft-wc-utils": "0.3.
|
|
22
|
+
"@fluid-topics/ft-chip": "0.3.67",
|
|
23
|
+
"@fluid-topics/ft-i18n": "0.3.67",
|
|
24
|
+
"@fluid-topics/ft-reader-context": "0.3.67",
|
|
25
|
+
"@fluid-topics/ft-reader-topic-context": "0.3.67",
|
|
26
|
+
"@fluid-topics/ft-tooltip": "0.3.67",
|
|
27
|
+
"@fluid-topics/ft-wc-utils": "0.3.67",
|
|
28
28
|
"@fluid-topics/public-api": "1.0.33",
|
|
29
29
|
"lit": "2.2.8"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "9db69a3abe84d6fb5ec11e29164f2ceaa7369352"
|
|
32
32
|
}
|