@fluid-topics/ft-reader-toc 1.0.8 → 1.0.9

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.
@@ -93,7 +93,7 @@ var vt,xt;let yt=class extends R{constructor(){super(...arguments),this.renderOp
93
93
  display: inline-block;
94
94
  width: 0;
95
95
  }
96
- `;class zt{constructor(t,e){this.defaultLabels=t,this.labels=e}resolve(t,...e){var i,o;t=this.resolvePluralKey(t,e);let n=null!==(o=null!==(i=this.labels[t])&&void 0!==i?i:this.defaultLabels[t])&&void 0!==o?o:"";return e.forEach(((t,e)=>n=n.replace(new RegExp(`\\{${e}([^}]*)\\}`,"g"),((e,i)=>this.formatValue(t,i))))),n}resolvePluralKey(t,e){for(let i of e)if("number"==typeof i){const e=`${String(t)}[\\=${i}]`;if(e in this.labels||e in this.defaultLabels)return e}return t}formatValue(t,e){return t instanceof Date?this.formatDate(t,e):null!=t?t:""}formatDate(t,e){const i=i=>(null==e?void 0:e.includes("date"))?t.toLocaleDateString(i):(null==e?void 0:e.includes("time"))?t.toLocaleTimeString(i):t.toLocaleString(i);try{return i(document.documentElement.lang)}catch(t){return i()}}}var At,jt;const Ut=t=>{const e=null!=t?t:{};return(t,i)=>{var n;const s={hasChanged:(t,e)=>!h(t,e),attribute:!1,...e};o(s)(t,i);const r=t;r.reduxProperties=r.reduxProperties||new Map,r.reduxProperties.set(i,{selector:null!==(n=e.selector)&&void 0!==n?n:t=>t[i],store:e.store})}},Ft=Symbol("internalStoresUnsubscribers"),It=Symbol("internalStores");class Lt extends Et{constructor(){super(...arguments),this[At]=new Map,this[jt]=new Map}getUnnamedStore(){if(this[It].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[It].values()][0]}getStore(t){return null==t?this.getUnnamedStore():this[It].get(t)}addStore(t,e){e=null!=e?e:function(t){var e;return null!==(e=null==t?void 0:t.isFtReduxStore)&&void 0!==e&&e}(t)?t.name:void 0,this.unsubscribeFromStore(e),this.setupStore(e,t)}removeStore(t){const e="string"==typeof t?t:t.name;this.unsubscribeFromStore(e),this[It].delete(e)}setupStore(t,e){this[It].set(t,e),this.subscribeToStore(t,e),this.updateFromStores()}setupStores(){this.unsubscribeFromStores(),this[It].forEach(((t,e)=>this.subscribeToStore(e,t))),this.updateFromStores()}updateFromStores(){this.reduxProperties&&this.reduxProperties.forEach(((t,e)=>{const i=this.constructor.getPropertyOptions(e);if(!(null==i?void 0:i.attribute)||!this.hasAttribute("string"==typeof(null==i?void 0:i.attribute)?i.attribute:e)){const i=this.getStore(t.store);i&&(this[e]=t.selector(i.getState(),this))}}))}subscribeToStore(t,e){this[Ft].set(t,e.subscribe((()=>this.updateFromStores()))),this.onStoreAvailable(t)}unsubscribeFromStores(){Object.keys(this[Ft]).forEach((t=>this.unsubscribeFromStore(t)))}unsubscribeFromStore(t){this[Ft].has(t)&&this[Ft].get(t)(),this[Ft].delete(t)}onStoreAvailable(t){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){this.unsubscribeFromStores(),super.disconnectedCallback()}}var Bt,Tt,Pt;At=Ft,jt=It;const _t=navigator.vendor&&!!navigator.vendor.match(/apple/i)||"[object SafariRemoteNotification]"===(null!==(Pt=null===(Tt=null===(Bt=window.safari)||void 0===Bt?void 0:Bt.pushNotification)||void 0===Tt?void 0:Tt.toString())&&void 0!==Pt?Pt:""),Dt=1,Wt=2,Ht=t=>(...e)=>({_$litDirective$:t,values:e});
96
+ `;class zt{constructor(t,e){this.defaultLabels=t,this.labels=e}resolve(t,...e){var i,o;t=this.resolvePluralKey(t,e);let n=null!==(o=null!==(i=this.labels[t])&&void 0!==i?i:this.defaultLabels[t])&&void 0!==o?o:"";return e.forEach(((t,e)=>n=n.replace(new RegExp(`\\{${e}([^}]*)\\}`,"g"),((e,i)=>this.formatValue(t,i))))),n}resolvePluralKey(t,e){for(let i of e)if("number"==typeof i){const e=`${String(t)}[\\=${i}]`;if(e in this.labels||e in this.defaultLabels)return e}return t}formatValue(t,e){return t instanceof Date?this.formatDate(t,e):null!=t?t:""}formatDate(t,e){const i=i=>(null==e?void 0:e.includes("date"))?t.toLocaleDateString(i):(null==e?void 0:e.includes("time"))?t.toLocaleTimeString(i):t.toLocaleString(i);try{return i(document.documentElement.lang)}catch(t){return i()}}}var At,jt;const Ut=t=>{const e=null!=t?t:{};return(t,i)=>{var n;const s={hasChanged:(t,e)=>!h(t,e),attribute:!1,...e};o(s)(t,i);const r=t;r.reduxProperties=r.reduxProperties||new Map,r.reduxProperties.set(i,{selector:null!==(n=e.selector)&&void 0!==n?n:t=>t[i],store:e.store})}},Ft=Symbol("internalStoresUnsubscribers"),It=Symbol("internalStores");class Lt extends Et{constructor(){super(...arguments),this[At]=new Map,this[jt]=new Map}getUnnamedStore(){if(this[It].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[It].values()][0]}getStore(t){return null==t?this.getUnnamedStore():this[It].get(t)}addStore(t,e){var i;e=null!==(i=null!=e?e:function(t){var e;return null!==(e=null==t?void 0:t.isFtReduxStore)&&void 0!==e&&e}(t)?t.name:void 0)&&void 0!==i?i:"default-store",this.unsubscribeFromStore(e),this.setupStore(e,t)}removeStore(t){const e="string"==typeof t?t:t.name;this.unsubscribeFromStore(e),this[It].delete(e)}setupStore(t,e){this[It].set(t,e),this.subscribeToStore(t,e),this.updateFromStores()}setupStores(){this.unsubscribeFromStores(),this[It].forEach(((t,e)=>this.subscribeToStore(e,t))),this.updateFromStores()}updateFromStores(){this.reduxProperties&&this.reduxProperties.forEach(((t,e)=>{const i=this.constructor.getPropertyOptions(e);if(!(null==i?void 0:i.attribute)||!this.hasAttribute("string"==typeof(null==i?void 0:i.attribute)?i.attribute:e)){const i=this.getStore(t.store);i&&(this[e]=t.selector(i.getState(),this))}}))}subscribeToStore(t,e){this[Ft].set(t,e.subscribe((()=>this.updateFromStores()))),this.onStoreAvailable(t)}unsubscribeFromStores(){Object.keys(this[Ft]).forEach((t=>this.unsubscribeFromStore(t)))}unsubscribeFromStore(t){this[Ft].has(t)&&this[Ft].get(t)(),this[Ft].delete(t)}onStoreAvailable(t){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){this.unsubscribeFromStores(),super.disconnectedCallback()}}var Bt,Tt,Pt;At=Ft,jt=It;const _t=navigator.vendor&&!!navigator.vendor.match(/apple/i)||"[object SafariRemoteNotification]"===(null!==(Pt=null===(Tt=null===(Bt=window.safari)||void 0===Bt?void 0:Bt.pushNotification)||void 0===Tt?void 0:Tt.toString())&&void 0!==Pt?Pt:""),Dt=1,Wt=2,Ht=t=>(...e)=>({_$litDirective$:t,values:e});
97
97
  /**
98
98
  * @license
99
99
  * Copyright 2017 Google LLC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-toc",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Main table of content for integrated reader",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,12 +19,12 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-icon": "1.0.8",
23
- "@fluid-topics/ft-reader-context": "1.0.8",
24
- "@fluid-topics/ft-size-watcher": "1.0.8",
25
- "@fluid-topics/ft-typography": "1.0.8",
26
- "@fluid-topics/ft-wc-utils": "1.0.8",
22
+ "@fluid-topics/ft-icon": "1.0.9",
23
+ "@fluid-topics/ft-reader-context": "1.0.9",
24
+ "@fluid-topics/ft-size-watcher": "1.0.9",
25
+ "@fluid-topics/ft-typography": "1.0.9",
26
+ "@fluid-topics/ft-wc-utils": "1.0.9",
27
27
  "lit": "2.7.2"
28
28
  },
29
- "gitHead": "b55ea6fbe362f72c42f5c26f705fde8e39261001"
29
+ "gitHead": "33ec465f5c0ea39fc825eaecfba336841f69a3e3"
30
30
  }