@fluid-topics/ft-reader-topic-context 1.1.3 → 1.1.5

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.
@@ -68,7 +68,7 @@ class fo extends It{constructor(){super(...arguments),this.renderOptions={host:t
68
68
  * Copyright 2019 Google LLC
69
69
  * SPDX-License-Identifier: BSD-3-Clause
70
70
  */
71
- const mo=window,Oo=mo.ShadowRoot&&(void 0===mo.ShadyCSS||mo.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype;class No extends fo{createRenderRoot(){const t=this.constructor;t.elementDefinitions&&!t.registry&&(t.registry=new CustomElementRegistry,Object.entries(t.elementDefinitions).forEach((([o,e])=>t.registry.define(o,e))));const o={...t.shadowRootOptions,customElements:t.registry},e=this.renderOptions.creationScope=this.attachShadow(o);return((t,o)=>{Oo?t.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):o.forEach((o=>{const e=document.createElement("style"),r=mo.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=o.cssText,t.appendChild(e)}))})(e,t.elementStyles),e}}var So,vo=function(t,o,e,r){for(var i,a=arguments.length,n=a<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(n=(a<3?i(n):a>3?i(o,e,n):i(o,e))||n);return a>3&&n&&Object.defineProperty(o,e,n),n};const Co=Symbol("constructorPrototype"),wo=Symbol("constructorName"),xo=Symbol("exportpartsDebouncer");class Ro extends No{constructor(){super(),this[So]=new R(5),this[wo]=this.constructor.name,this[Co]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[wo]&&Object.setPrototypeOf(this,this[Co])}updated(t){super.updated(t),setTimeout((()=>{this.contentAvailableCallback(t),this.scheduleExportpartsUpdate()}),0)}contentAvailableCallback(t){var o,e;if((null!==(e=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelectorAll(".ft-lit-element--custom-stylesheet"))&&void 0!==e?e:[]).forEach((t=>t.remove())),this.customStylesheet){const t=document.createElement("style");t.classList.add("ft-lit-element--custom-stylesheet"),t.innerHTML=this.customStylesheet,this.shadowRoot.append(t)}}scheduleExportpartsUpdate(){this[xo].run((()=>{var t;(null===(t=this.exportpartsPrefix)||void 0===t?void 0:t.trim())?this.setExportpartsAttribute([this.exportpartsPrefix]):null!=this.exportpartsPrefixes&&this.exportpartsPrefixes.length>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)}))}setExportpartsAttribute(t){var o,e,r,i,a,n;const s=t=>null!=t&&t.trim().length>0,c=t.filter(s).map((t=>t.trim()));if(0===c.length)return void this.removeAttribute("exportparts");const l=new Set;for(let t of null!==(e=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelectorAll("[part],[exportparts]"))&&void 0!==e?e:[]){const o=null!==(i=null===(r=t.getAttribute("part"))||void 0===r?void 0:r.split(" "))&&void 0!==i?i:[],e=null!==(n=null===(a=t.getAttribute("exportparts"))||void 0===a?void 0:a.split(",").map((t=>t.split(":")[1])))&&void 0!==n?n:[];new Array(...o,...e).filter(s).map((t=>t.trim())).forEach((t=>l.add(t)))}if(0===l.size)return void this.removeAttribute("exportparts");const h=[...l.values()].flatMap((t=>c.map((o=>`${t}:${o}--${t}`))));this.setAttribute("exportparts",[...this.part,...h].join(", "))}}So=xo,vo([w()],Ro.prototype,"exportpartsPrefix",void 0),vo([function(t,o){const e=()=>JSON.parse(JSON.stringify(t));return w({type:Object,converter:{fromAttribute:t=>{if(null==t)return e();try{return JSON.parse(t)}catch{return e()}},toAttribute:t=>JSON.stringify(t)},hasChanged:(t,o)=>!U(t,o),...null!=o?o:{}})}([])],Ro.prototype,"exportpartsPrefixes",void 0),vo([w()],Ro.prototype,"customStylesheet",void 0);const Uo=uo.create("--ft-utils-highlight-html-background-color","","COLOR","#FFF26E");function Eo(t){var o;return null!==(o=null==t?void 0:t.isFtReduxStore)&&void 0!==o&&o}var Io,Lo,Wo;dt`
71
+ const mo=window,Oo=mo.ShadowRoot&&(void 0===mo.ShadyCSS||mo.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype;class No extends fo{createRenderRoot(){const t=this.constructor;t.elementDefinitions&&!t.registry&&(t.registry=new CustomElementRegistry,Object.entries(t.elementDefinitions).forEach((([o,e])=>t.registry.define(o,e))));const o={...t.shadowRootOptions,customElements:t.registry},e=this.renderOptions.creationScope=this.attachShadow(o);return((t,o)=>{Oo?t.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):o.forEach((o=>{const e=document.createElement("style"),r=mo.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=o.cssText,t.appendChild(e)}))})(e,t.elementStyles),e}}var So,vo=function(t,o,e,r){for(var i,a=arguments.length,n=a<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(n=(a<3?i(n):a>3?i(o,e,n):i(o,e))||n);return a>3&&n&&Object.defineProperty(o,e,n),n};const Co=Symbol("constructorPrototype"),wo=Symbol("constructorName"),xo=Symbol("exportpartsDebouncer");class Ro extends No{constructor(){super(),this[So]=new R(5),this[wo]=this.constructor.name,this[Co]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[wo]&&Object.setPrototypeOf(this,this[Co])}updated(t){super.updated(t),setTimeout((()=>{this.contentAvailableCallback(t),this.scheduleExportpartsUpdate()}),0)}contentAvailableCallback(t){var o,e;if((null!==(e=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelectorAll(".ft-lit-element--custom-stylesheet"))&&void 0!==e?e:[]).forEach((t=>t.remove())),this.customStylesheet){const t=document.createElement("style");t.classList.add("ft-lit-element--custom-stylesheet"),t.innerHTML=this.customStylesheet,this.shadowRoot.append(t)}}scheduleExportpartsUpdate(){this[xo].run((()=>{var t;(null===(t=this.exportpartsPrefix)||void 0===t?void 0:t.trim())?this.setExportpartsAttribute([this.exportpartsPrefix]):null!=this.exportpartsPrefixes&&this.exportpartsPrefixes.length>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)}))}setExportpartsAttribute(t){var o,e,r,i,a,n;const s=t=>null!=t&&t.trim().length>0,c=t.filter(s).map((t=>t.trim()));if(0===c.length)return void this.removeAttribute("exportparts");const l=new Set;for(let t of null!==(e=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelectorAll("[part],[exportparts]"))&&void 0!==e?e:[]){const o=null!==(i=null===(r=t.getAttribute("part"))||void 0===r?void 0:r.split(" "))&&void 0!==i?i:[],e=null!==(n=null===(a=t.getAttribute("exportparts"))||void 0===a?void 0:a.split(",").map((t=>t.split(":")[1])))&&void 0!==n?n:[];new Array(...o,...e).filter(s).map((t=>t.trim())).forEach((t=>l.add(t)))}if(0===l.size)return void this.removeAttribute("exportparts");const h=[...l.values()].flatMap((t=>c.map((o=>`${t}:${o}--${t}`))));this.setAttribute("exportparts",[...this.part,...h].join(", "))}}So=xo,vo([w()],Ro.prototype,"exportpartsPrefix",void 0),vo([function(t,o){const e=()=>JSON.parse(JSON.stringify(t));return w({type:Object,converter:{fromAttribute:t=>{if(null==t)return e();try{return JSON.parse(t)}catch{return e()}},toAttribute:t=>JSON.stringify(t)},hasChanged:(t,o)=>!U(t,o),...null!=o?o:{}})}([])],Ro.prototype,"exportpartsPrefixes",void 0),vo([w()],Ro.prototype,"customStylesheet",void 0);const Uo=uo.create("--ft-utils-highlight-html-background-color","","COLOR","#FFF26E");dt`
72
72
  .highlight-html-match {
73
73
  background: ${Uo};
74
74
  }
@@ -104,7 +104,7 @@ const mo=window,Oo=mo.ShadowRoot&&(void 0===mo.ShadyCSS||mo.ShadyCSS.nativeShado
104
104
  display: inline-block;
105
105
  width: 0;
106
106
  }
107
- `;const ko=Symbol("internalReduxEventsUnsubscribers"),Ko=Symbol("internalStoresUnsubscribers"),Zo=Symbol("internalStores");class Ao extends Ro{constructor(){super(...arguments),this[Io]=new Map,this[Lo]=new Map,this[Wo]=[]}update(t){var o;super.update(t),(null===(o=this.reduxReactiveProperties)||void 0===o?void 0:o.some((o=>t.has(o))))&&this.updateFromStores()}getUnnamedStore(){if(this[Zo].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[Zo].values()][0]}getStore(t){return null==t?this.getUnnamedStore():this[Zo].get(t)}addStore(t,o){var e;o=null!==(e=null!=o?o:Eo(t)?t.name:void 0)&&void 0!==e?e:"default-store",this.unsubscribeFromStore(o),this.setupStore(o,t)}removeStore(t){const o="string"==typeof t?t:t.name;this.unsubscribeFromStore(o),this[Zo].delete(o)}setupStore(t,o){this[Zo].set(t,o),this.subscribeToStore(t,o),this.updateFromStores()}setupStores(){this.unsubscribeFromStores(),this[Zo].forEach(((t,o)=>this.subscribeToStore(o,t))),this.updateFromStores()}updateFromStores(){this.reduxProperties&&this.reduxProperties.forEach(((t,o)=>{const e=this.constructor.getPropertyOptions(o);if(!(null==e?void 0:e.attribute)||!this.hasAttribute("string"==typeof(null==e?void 0:e.attribute)?e.attribute:o)){const e=this.getStore(t.store);e&&(t.store?this[Ko].has(t.store):this[Ko].size>0)&&(this[o]=t.selector(e.getState(),this))}}))}subscribeToStore(t,o){var e;this[Ko].set(t,o.subscribe((()=>this.updateFromStores()))),Eo(o)&&o.eventBus&&(null===(e=this.reduxEventListeners)||void 0===e||e.forEach(((t,e)=>{if("function"==typeof this[e]&&(!t.store||o.name===t.store)){const r=t=>this[e](t);o.eventBus.addEventListener(t.eventName,r),this[ko].push((()=>o.eventBus.removeEventListener(t.eventName,r)))}}))),this.onStoreAvailable(t)}unsubscribeFromStores(){this[Ko].forEach(((t,o)=>this.unsubscribeFromStore(o))),this[ko].forEach((t=>t())),this[ko]=[]}unsubscribeFromStore(t){this[Ko].has(t)&&this[Ko].get(t)(),this[Ko].delete(t)}onStoreAvailable(t){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromStores()}}Io=Ko,Lo=Zo,Wo=ko,window.ftReduxStores||(window.ftReduxStores={});var $o,Mo;navigator.vendor&&navigator.vendor.match(/apple/i)||(null===(Mo=null===($o=window.safari)||void 0===$o?void 0:$o.pushNotification)||void 0===Mo||Mo.toString());const Fo=dt`
107
+ `;function Eo(t){var o;return null!==(o=null==t?void 0:t.isFtReduxStore)&&void 0!==o&&o}var Io,Lo,Wo;const ko=Symbol("internalReduxEventsUnsubscribers"),Ko=Symbol("internalStoresUnsubscribers"),Zo=Symbol("internalStores");class Ao extends Ro{constructor(){super(...arguments),this[Io]=new Map,this[Lo]=new Map,this[Wo]=[]}update(t){var o;super.update(t),(null===(o=this.reduxReactiveProperties)||void 0===o?void 0:o.some((o=>t.has(o))))&&this.updateFromStores()}getUnnamedStore(){if(this[Zo].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[Zo].values()][0]}getStore(t){return null==t?this.getUnnamedStore():this[Zo].get(t)}addStore(t,o){var e;o=null!==(e=null!=o?o:Eo(t)?t.name:void 0)&&void 0!==e?e:"default-store",this.unsubscribeFromStore(o),this.setupStore(o,t)}removeStore(t){const o="string"==typeof t?t:t.name;this.unsubscribeFromStore(o),this[Zo].delete(o)}setupStore(t,o){this[Zo].set(t,o),this.subscribeToStore(t,o),this.updateFromStores()}setupStores(){this.unsubscribeFromStores(),this[Zo].forEach(((t,o)=>this.subscribeToStore(o,t))),this.updateFromStores()}updateFromStores(){this.reduxProperties&&this.reduxProperties.forEach(((t,o)=>{const e=this.constructor.getPropertyOptions(o);if(!(null==e?void 0:e.attribute)||!this.hasAttribute("string"==typeof(null==e?void 0:e.attribute)?e.attribute:o)){const e=this.getStore(t.store);e&&(t.store?this[Ko].has(t.store):this[Ko].size>0)&&(this[o]=t.selector(e.getState(),this))}}))}subscribeToStore(t,o){var e;this[Ko].set(t,o.subscribe((()=>this.updateFromStores()))),Eo(o)&&o.eventBus&&(null===(e=this.reduxEventListeners)||void 0===e||e.forEach(((t,e)=>{if("function"==typeof this[e]&&(!t.store||o.name===t.store)){const r=t=>this[e](t);o.eventBus.addEventListener(t.eventName,r),this[ko].push((()=>o.eventBus.removeEventListener(t.eventName,r)))}}))),this.onStoreAvailable(t)}unsubscribeFromStores(){this[Ko].forEach(((t,o)=>this.unsubscribeFromStore(o))),this[ko].forEach((t=>t())),this[ko]=[]}unsubscribeFromStore(t){this[Ko].has(t)&&this[Ko].get(t)(),this[Ko].delete(t)}onStoreAvailable(t){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromStores()}}var $o,Mo;Io=Ko,Lo=Zo,Wo=ko,window.ftReduxStores||(window.ftReduxStores={}),navigator.vendor&&navigator.vendor.match(/apple/i)||(null===(Mo=null===($o=window.safari)||void 0===$o?void 0:$o.pushNotification)||void 0===Mo||Mo.toString());const Fo=dt`
108
108
  `;var Bo;!function(t){t.FEEDBACK="FEEDBACK",t.RATING="RATING",t.PRINT="PRINT",t.BOOKMARK="BOOKMARK",t.COLLECTIONS="COLLECTIONS",t.PERSONAL_BOOKS="PERSONAL_BOOKS"}(Bo||(Bo={}));var zo=function(t,o,e,r){for(var i,a=arguments.length,n=a<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(n=(a<3?i(n):a>3?i(o,e,n):i(o,e))||n);return a>3&&n&&Object.defineProperty(o,e,n),n};class Do extends Event{constructor(){super("register-ft-reader-component",{bubbles:!0,composed:!0})}}const Po=Symbol("registerInterval");class _o extends(function(t){var o;class e extends t{constructor(){super(...arguments),this[o]=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[Po]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[Po]):this.dispatchEvent(new Do)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return o=Po,zo([x()],e.prototype,"stateManager",void 0),e}(Ao)){}var To,Go=function(t,o,e,r){for(var i,a=arguments.length,n=a<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(n=(a<3?i(n):a>3?i(o,e,n):i(o,e))||n);return a>3&&n&&Object.defineProperty(o,e,n),n};class jo extends _o{constructor(){super(...arguments),this.disableContextInteractions=!1,this.registeredComponents=[]}render(){return Jt`
109
109
  <article id=${this.tocId}>
110
110
  <slot @register-ft-reader-topic-component=${this.registerComponent}></slot>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-topic-context",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Context block for integrated reader topic components.",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,8 +19,8 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-wc-utils": "1.1.3",
22
+ "@fluid-topics/ft-wc-utils": "1.1.5",
23
23
  "lit": "3.1.0"
24
24
  },
25
- "gitHead": "0d44a470e710f185c37e42ee87be4481a3bdf793"
25
+ "gitHead": "334ea71061e13d064f1f59b0f75d84c46d32d860"
26
26
  }