@fluid-topics/ft-reader-content 1.1.3 → 1.1.4
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.
|
@@ -78,7 +78,7 @@ let Oo=class extends At{constructor(){super(...arguments),this.renderOptions={ho
|
|
|
78
78
|
* Copyright 2019 Google LLC
|
|
79
79
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
80
80
|
*/
|
|
81
|
-
const xo=window,Ro=xo.ShadowRoot&&(void 0===xo.ShadyCSS||xo.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype;class Eo extends Oo{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)=>{Ro?t.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):o.forEach((o=>{const e=document.createElement("style"),r=xo.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=o.cssText,t.appendChild(e)}))})(e,t.elementStyles),e}}var Uo,Io=function(t,o,e,r){for(var i,n=arguments.length,s=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,a=t.length-1;a>=0;a--)(i=t[a])&&(s=(n<3?i(s):n>3?i(o,e,s):i(o,e))||s);return n>3&&s&&Object.defineProperty(o,e,s),s};const Lo=Symbol("constructorPrototype"),Wo=Symbol("constructorName"),ko=Symbol("exportpartsDebouncer");class Ko extends Eo{constructor(){super(),this[Uo]=new U(5),this[Wo]=this.constructor.name,this[Lo]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[Wo]&&Object.setPrototypeOf(this,this[Lo])}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[ko].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,n,s;const a=t=>null!=t&&t.trim().length>0,c=t.filter(a).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!==(s=null===(n=t.getAttribute("exportparts"))||void 0===n?void 0:n.split(",").map((t=>t.split(":")[1])))&&void 0!==s?s:[];new Array(...o,...e).filter(a).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(", "))}}Uo=ko,Io([C()],Ko.prototype,"exportpartsPrefix",void 0),Io([function(t,o){const e=()=>JSON.parse(JSON.stringify(t));return C({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)=>!I(t,o),...null!=o?o:{}})}([])],Ko.prototype,"exportpartsPrefixes",void 0),Io([C()],Ko.prototype,"customStylesheet",void 0);const Zo=So.create("--ft-utils-highlight-html-background-color","","COLOR","#FFF26E");
|
|
81
|
+
const xo=window,Ro=xo.ShadowRoot&&(void 0===xo.ShadyCSS||xo.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype;class Eo extends Oo{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)=>{Ro?t.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):o.forEach((o=>{const e=document.createElement("style"),r=xo.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=o.cssText,t.appendChild(e)}))})(e,t.elementStyles),e}}var Uo,Io=function(t,o,e,r){for(var i,n=arguments.length,s=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,a=t.length-1;a>=0;a--)(i=t[a])&&(s=(n<3?i(s):n>3?i(o,e,s):i(o,e))||s);return n>3&&s&&Object.defineProperty(o,e,s),s};const Lo=Symbol("constructorPrototype"),Wo=Symbol("constructorName"),ko=Symbol("exportpartsDebouncer");class Ko extends Eo{constructor(){super(),this[Uo]=new U(5),this[Wo]=this.constructor.name,this[Lo]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[Wo]&&Object.setPrototypeOf(this,this[Lo])}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[ko].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,n,s;const a=t=>null!=t&&t.trim().length>0,c=t.filter(a).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!==(s=null===(n=t.getAttribute("exportparts"))||void 0===n?void 0:n.split(",").map((t=>t.split(":")[1])))&&void 0!==s?s:[];new Array(...o,...e).filter(a).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(", "))}}Uo=ko,Io([C()],Ko.prototype,"exportpartsPrefix",void 0),Io([function(t,o){const e=()=>JSON.parse(JSON.stringify(t));return C({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)=>!I(t,o),...null!=o?o:{}})}([])],Ko.prototype,"exportpartsPrefixes",void 0),Io([C()],Ko.prototype,"customStylesheet",void 0);const Zo=So.create("--ft-utils-highlight-html-background-color","","COLOR","#FFF26E");Nt`
|
|
82
82
|
.highlight-html-match {
|
|
83
83
|
background: ${Zo};
|
|
84
84
|
}
|
|
@@ -114,7 +114,7 @@ const xo=window,Ro=xo.ShadowRoot&&(void 0===xo.ShadyCSS||xo.ShadyCSS.nativeShado
|
|
|
114
114
|
display: inline-block;
|
|
115
115
|
width: 0;
|
|
116
116
|
}
|
|
117
|
-
`;const Bo=Symbol("internalReduxEventsUnsubscribers"),
|
|
117
|
+
`;const $o=t=>{const o=null!=t?t:{};return(t,e)=>{var r;const i={hasChanged:(t,o)=>!I(t,o),attribute:!1,...o};C(i)(t,e);const n=t;n.reduxProperties=n.reduxProperties||new Map,n.reduxProperties.set(e,{selector:null!==(r=o.selector)&&void 0!==r?r:t=>t[e],store:o.store})}};function Ao(t){var o;return null!==(o=null==t?void 0:t.isFtReduxStore)&&void 0!==o&&o}var Mo,Fo,Bo;const zo=Symbol("internalReduxEventsUnsubscribers"),Do=Symbol("internalStoresUnsubscribers"),To=Symbol("internalStores");class Po extends Ko{constructor(){super(...arguments),this[Mo]=new Map,this[Fo]=new Map,this[Bo]=[]}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[To].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[To].values()][0]}getStore(t){return null==t?this.getUnnamedStore():this[To].get(t)}addStore(t,o){var e;o=null!==(e=null!=o?o:Ao(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[To].delete(o)}setupStore(t,o){this[To].set(t,o),this.subscribeToStore(t,o),this.updateFromStores()}setupStores(){this.unsubscribeFromStores(),this[To].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[Do].has(t.store):this[Do].size>0)&&(this[o]=t.selector(e.getState(),this))}}))}subscribeToStore(t,o){var e;this[Do].set(t,o.subscribe((()=>this.updateFromStores()))),Ao(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[zo].push((()=>o.eventBus.removeEventListener(t.eventName,r)))}}))),this.onStoreAvailable(t)}unsubscribeFromStores(){this[Do].forEach(((t,o)=>this.unsubscribeFromStore(o))),this[zo].forEach((t=>t())),this[zo]=[]}unsubscribeFromStore(t){this[Do].has(t)&&this[Do].get(t)(),this[Do].delete(t)}onStoreAvailable(t){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromStores()}}var _o,jo,Go;Mo=Do,Fo=To,Bo=zo,window.ftReduxStores||(window.ftReduxStores={}),navigator.vendor&&navigator.vendor.match(/apple/i)||(null===(jo=null===(_o=window.safari)||void 0===_o?void 0:_o.pushNotification)||void 0===jo||jo.toString()),function(t){t.FEEDBACK="FEEDBACK",t.RATING="RATING",t.PRINT="PRINT",t.BOOKMARK="BOOKMARK",t.COLLECTIONS="COLLECTIONS",t.PERSONAL_BOOKS="PERSONAL_BOOKS"}(Go||(Go={}));var Ho=function(t,o,e,r){for(var i,n=arguments.length,s=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,a=t.length-1;a>=0;a--)(i=t[a])&&(s=(n<3?i(s):n>3?i(o,e,s):i(o,e))||s);return n>3&&s&&Object.defineProperty(o,e,s),s};class Yo extends Event{constructor(){super("register-ft-reader-component",{bubbles:!0,composed:!0})}}const Jo=Symbol("registerInterval");class Vo 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[Jo]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[Jo]):this.dispatchEvent(new Yo)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return o=Jo,Ho([x()],e.prototype,"stateManager",void 0),e}(Po)){}
|
|
118
118
|
/**
|
|
119
119
|
* @license
|
|
120
120
|
* Copyright 2017 Google LLC
|
|
@@ -194,7 +194,7 @@ class ce extends Qo{constructor(t){if(super(t),this.et=X,t.type!==qo)throw Error
|
|
|
194
194
|
<article id=${this.tocId}>
|
|
195
195
|
<slot @register-ft-reader-topic-component=${this.registerComponent}></slot>
|
|
196
196
|
</article>
|
|
197
|
-
`}registerComponent(t){t.stopPropagation();const o=t.composedPath()[0];this.register(o)}register(t){this.registeredComponents.push(t),t.tocNode=this.tocNode,t.disableContextInteractions=this.disableContextInteractions}update(t){super.update(t),["mapId","tocId","stateManager"].some((o=>t.has(o)))&&this.setTocNode(),t.has("tocNode")&&this.registeredComponents.forEach((t=>t.tocNode=this.tocNode))}async setTocNode(){var t;this.tocNode=void 0,this.tocNode=this.mapId&&this.tocId?await(null===(t=this.service)||void 0===t?void 0:t.getTocNode(this.tocId)):void 0}disconnectedCallback(){super.disconnectedCallback(),this.registeredComponents=[]}}ve.styles=Oe,Ne([
|
|
197
|
+
`}registerComponent(t){t.stopPropagation();const o=t.composedPath()[0];this.register(o)}register(t){this.registeredComponents.push(t),t.tocNode=this.tocNode,t.disableContextInteractions=this.disableContextInteractions}update(t){super.update(t),["mapId","tocId","stateManager"].some((o=>t.has(o)))&&this.setTocNode(),t.has("tocNode")&&this.registeredComponents.forEach((t=>t.tocNode=this.tocNode))}async setTocNode(){var t;this.tocNode=void 0,this.tocNode=this.mapId&&this.tocId?await(null===(t=this.service)||void 0===t?void 0:t.getTocNode(this.tocId)):void 0}disconnectedCallback(){super.disconnectedCallback(),this.registeredComponents=[]}}ve.styles=Oe,Ne([$o({selector:t=>{var o;return null===(o=t.map)||void 0===o?void 0:o.id}})],ve.prototype,"mapId",void 0),Ne([C()],ve.prototype,"tocId",void 0),Ne([C({type:Boolean})],ve.prototype,"disableContextInteractions",void 0),Ne([x()],ve.prototype,"tocNode",void 0),L("ft-reader-topic-context")(ve);var Se=function(t,o,e,r){for(var i,n=arguments.length,s=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,a=t.length-1;a>=0;a--)(i=t[a])&&(s=(n<3?i(s):n>3?i(o,e,s):i(o,e))||s);return n>3&&s&&Object.defineProperty(o,e,s),s};class we extends Vo{constructor(){super(...arguments),this.renderTopic=()=>eo`
|
|
198
198
|
<ft-reader-topic-title></ft-reader-topic-title>
|
|
199
199
|
<ft-reader-topic-content></ft-reader-topic-content>
|
|
200
200
|
`,this.disableContextInteractions=!1,this.renderBeforeFirst=5,this.renderAfterLast=10,this.visibleTopicsDebouncer=new U(50)}render(){var t;const o=(null===(t=this.currentPage)||void 0===t?void 0:t.topics)||[];return 0===o.length?io:eo`
|
|
@@ -214,4 +214,4 @@ class ce extends Qo{constructor(t){if(super(t),this.et=X,t.type!==qo)throw Error
|
|
|
214
214
|
<ft-reader-topic-context tocId="${t}" ?disableContextInteractions=${this.disableContextInteractions}>
|
|
215
215
|
${this.renderTopic(t,o)}
|
|
216
216
|
</ft-reader-topic-context>
|
|
217
|
-
`}getScrollTarget(){var t,o,e,r,i;if(this.disableContextInteractions)return null;const n=null!==(r=null===(t=this.visibleTopics)||void 0===t?void 0:t.includes(null!==(e=null===(o=this.scrollTarget)||void 0===o?void 0:o.tocId)&&void 0!==e?e:""))&&void 0!==r&&r;return!(null===(i=this.scrollTarget)||void 0===i?void 0:i.tocId)||n&&null!=this.scrollTarget.section?null:this.scrollTarget.tocId}visibleTopicChange(t){this.disableContextInteractions||this.visibleTopicsDebouncer.run((()=>{var o;return null===(o=this.stateManager)||void 0===o?void 0:o.setVisibleTopics(t.detail.visibleItems)}))}onScrollDone(){var t,o;this.disableContextInteractions||(null===(t=this.scrollTarget)||void 0===t?void 0:t.section)||null===(o=this.stateManager)||void 0===o||o.scrollDone()}}we.elementDefinitions={"ft-infinite-scroll":be},we.styles=me,Se([C()],we.prototype,"renderTopic",void 0),Se([C({type:Boolean})],we.prototype,"disableContextInteractions",void 0),Se([
|
|
217
|
+
`}getScrollTarget(){var t,o,e,r,i;if(this.disableContextInteractions)return null;const n=null!==(r=null===(t=this.visibleTopics)||void 0===t?void 0:t.includes(null!==(e=null===(o=this.scrollTarget)||void 0===o?void 0:o.tocId)&&void 0!==e?e:""))&&void 0!==r&&r;return!(null===(i=this.scrollTarget)||void 0===i?void 0:i.tocId)||n&&null!=this.scrollTarget.section?null:this.scrollTarget.tocId}visibleTopicChange(t){this.disableContextInteractions||this.visibleTopicsDebouncer.run((()=>{var o;return null===(o=this.stateManager)||void 0===o?void 0:o.setVisibleTopics(t.detail.visibleItems)}))}onScrollDone(){var t,o;this.disableContextInteractions||(null===(t=this.scrollTarget)||void 0===t?void 0:t.section)||null===(o=this.stateManager)||void 0===o||o.scrollDone()}}we.elementDefinitions={"ft-infinite-scroll":be},we.styles=me,Se([C()],we.prototype,"renderTopic",void 0),Se([C({type:Boolean})],we.prototype,"disableContextInteractions",void 0),Se([$o()],we.prototype,"currentPage",void 0),Se([$o()],we.prototype,"scrollTarget",void 0),Se([$o()],we.prototype,"visibleTopics",void 0),Se([$o({selector:t=>{var o,e;return null!==(e=null===(o=t.configuration)||void 0===o?void 0:o.loadBeforeFirstVisibleTopic)&&void 0!==e?e:5}})],we.prototype,"renderBeforeFirst",void 0),Se([$o({selector:t=>{var o,e;return null!==(e=null===(o=t.configuration)||void 0===o?void 0:o.loadAfterLastVisibleTopic)&&void 0!==e?e:5}})],we.prototype,"renderAfterLast",void 0),Se([E(".ft-reader-content")],we.prototype,"container",void 0),L("ft-reader-content")(we),t.FtReaderContent=we,t.FtReaderContentCssVariables={},t.styles=me}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-reader-content",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Main 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-infinite-scroll": "1.1.
|
|
23
|
-
"@fluid-topics/ft-reader-topic-content": "1.1.
|
|
24
|
-
"@fluid-topics/ft-reader-topic-context": "1.1.
|
|
25
|
-
"@fluid-topics/ft-reader-topic-title": "1.1.
|
|
26
|
-
"@fluid-topics/ft-wc-utils": "1.1.
|
|
22
|
+
"@fluid-topics/ft-infinite-scroll": "1.1.4",
|
|
23
|
+
"@fluid-topics/ft-reader-topic-content": "1.1.4",
|
|
24
|
+
"@fluid-topics/ft-reader-topic-context": "1.1.4",
|
|
25
|
+
"@fluid-topics/ft-reader-topic-title": "1.1.4",
|
|
26
|
+
"@fluid-topics/ft-wc-utils": "1.1.4",
|
|
27
27
|
"lit": "3.1.0"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "b13ddd3359734158be660854f9ffe5fc5880c430"
|
|
30
30
|
}
|