@fluid-topics/ft-reader-topic-context 2.1.10 → 2.1.12
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.
- package/build/ft-reader-topic-context.d.ts +1 -0
- package/build/ft-reader-topic-context.js +10 -6
- package/build/ft-reader-topic-context.light.js +4 -4
- package/build/ft-reader-topic-context.min.js +14 -14
- package/build/registration.d.ts +1 -0
- package/build/registration.js +4 -1
- package/package.json +3 -3
|
@@ -13,6 +13,7 @@ export declare class FtReaderTopicContext extends FtReaderComponent implements F
|
|
|
13
13
|
tocId?: string;
|
|
14
14
|
disableContextInteractions: boolean;
|
|
15
15
|
headingLevelsShift: number;
|
|
16
|
+
headingStartLevel?: number;
|
|
16
17
|
tocNode?: FtReaderTocNode;
|
|
17
18
|
private registeredComponents;
|
|
18
19
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
@@ -4,11 +4,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { html } from "lit";
|
|
8
|
-
import { property, state } from "lit/decorators.js";
|
|
7
|
+
import { html, } from "lit";
|
|
8
|
+
import { property, state, } from "lit/decorators.js";
|
|
9
9
|
import { styles } from "./ft-reader-topic-context.styles";
|
|
10
10
|
import { FtReaderComponent } from "@fluid-topics/ft-reader-context/build/registration";
|
|
11
|
-
import { redux } from "@fluid-topics/ft-wc-utils";
|
|
11
|
+
import { numberProperty, redux, } from "@fluid-topics/ft-wc-utils";
|
|
12
12
|
export class FtReaderTopicContext extends FtReaderComponent {
|
|
13
13
|
constructor() {
|
|
14
14
|
// Uncomment to use scoped web components
|
|
@@ -22,7 +22,7 @@ export class FtReaderTopicContext extends FtReaderComponent {
|
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
24
24
|
return html `
|
|
25
|
-
<article id
|
|
25
|
+
<article id="${this.tocId}">
|
|
26
26
|
<slot @register-ft-reader-topic-component=${this.registerComponent}></slot>
|
|
27
27
|
</article>
|
|
28
28
|
`;
|
|
@@ -37,14 +37,15 @@ export class FtReaderTopicContext extends FtReaderComponent {
|
|
|
37
37
|
component.tocNode = this.tocNode;
|
|
38
38
|
component.disableContextInteractions = this.disableContextInteractions;
|
|
39
39
|
component.headingLevelsShift = this.headingLevelsShift;
|
|
40
|
+
component.headingStartLevel = this.headingStartLevel;
|
|
40
41
|
}
|
|
41
42
|
update(changedProperties) {
|
|
42
43
|
super.update(changedProperties);
|
|
43
|
-
if (["mapId", "tocId", "stateManager", "translationDestinationLanguage", "translationProfileId"].some(p => changedProperties.has(p))) {
|
|
44
|
+
if (["mapId", "tocId", "stateManager", "translationDestinationLanguage", "translationProfileId"].some((p) => changedProperties.has(p))) {
|
|
44
45
|
this.setTocNode();
|
|
45
46
|
}
|
|
46
47
|
if (changedProperties.has("tocNode")) {
|
|
47
|
-
this.registeredComponents.forEach(c => c.tocNode = this.tocNode);
|
|
48
|
+
this.registeredComponents.forEach((c) => c.tocNode = this.tocNode);
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
async setTocNode() {
|
|
@@ -76,6 +77,9 @@ __decorate([
|
|
|
76
77
|
__decorate([
|
|
77
78
|
property({ type: Number })
|
|
78
79
|
], FtReaderTopicContext.prototype, "headingLevelsShift", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
numberProperty()
|
|
82
|
+
], FtReaderTopicContext.prototype, "headingStartLevel", void 0);
|
|
79
83
|
__decorate([
|
|
80
84
|
state()
|
|
81
85
|
], FtReaderTopicContext.prototype, "tocNode", void 0);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";(()=>{var w=Object.create;var I=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var g=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(o){throw t=0,o}};var j=(e,t,o,
|
|
2
|
-
`;var
|
|
3
|
-
<article id
|
|
1
|
+
"use strict";(()=>{var w=Object.create;var I=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var g=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(o){throw t=0,o}};var j=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of K(t))!D.call(e,r)&&r!==o&&I(e,r,{get:()=>t[r],enumerable:!(s=A(t,r))||s.enumerable});return e};var d=(e,t,o)=>(o=e!=null?w(B(e)):{},j(t||!e||!e.__esModule?I(o,"default",{value:e,enumerable:!0}):o,e));var f=g(($,y)=>{y.exports=ftGlobals.wcUtils});var v=g((H,N)=>{N.exports=ftGlobals.lit});var C=g((V,O)=>{O.exports=ftGlobals.litDecorators});var E=d(f());var _=d(v()),p=d(C());var S=d(v());var L=S.css`
|
|
2
|
+
`;var u=d(f()),R=d(C());var T;(function(e){e.clusteringHelperCreated="clustering-helper-created",e.mapAttachmentsUpdate="map-attachments-update",e.visibleTopicChange="visible-topic-change",e.requestedTopicNotFound="requested-topic-not-found"})(T||(T={}));var M;(function(e){e.FEEDBACK="FEEDBACK",e.RATING="RATING",e.PRINT="PRINT",e.BOOKMARK="BOOKMARK",e.COLLECTIONS="COLLECTIONS",e.PERSONAL_BOOKS="PERSONAL_BOOKS"})(M||(M={}));var G=function(e,t,o,s){var r=arguments.length,i=r<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,o):s,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,s);else for(var l=e.length-1;l>=0;l--)(a=e[l])&&(i=(r<3?a(i):r>3?a(t,o,i):a(t,o))||i);return r>3&&i&&Object.defineProperty(t,o,i),i},x=class extends Event{constructor(){super("register-ft-reader-component",{bubbles:!0,composed:!0})}},b=Symbol("registerInterval"),q=(0,u.applyMixinOnce)(Symbol("toFtReaderComponent"),function(e){var t;class o extends e{constructor(){super(...arguments),this[t]=0}setReaderStateManager(r){this.clearStateManager(),this.stateManager=r,this.addStore(r.store,"reader")}clearStateManager(){this.stateManager&&(this.removeStore("reader"),this.stateManager=void 0)}get service(){var r;return(r=this.stateManager)===null||r===void 0?void 0:r.service}connectedCallback(){super.connectedCallback(),this[b]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null?window.clearInterval(this[b]):this.dispatchEvent(new x)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return t=b,G([(0,R.state)()],o.prototype,"stateManager",void 0),o}),m=class extends q(u.FtLitElementRedux){};var h=d(f()),c=function(e,t,o,s){var r=arguments.length,i=r<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,o):s,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,s);else for(var l=e.length-1;l>=0;l--)(a=e[l])&&(i=(r<3?a(i):r>3?a(t,o,i):a(t,o))||i);return r>3&&i&&Object.defineProperty(t,o,i),i},n=class extends m{constructor(){super(...arguments),this.disableContextInteractions=!1,this.headingLevelsShift=0,this.registeredComponents=[]}render(){return _.html`
|
|
3
|
+
<article id="${this.tocId}">
|
|
4
4
|
<slot @register-ft-reader-topic-component=${this.registerComponent}></slot>
|
|
5
5
|
</article>
|
|
6
|
-
`}registerComponent(t){t.stopPropagation();let o=t.composedPath()[0];this.register(o)}register(t){this.registeredComponents.push(t),t.tocNode=this.tocNode,t.disableContextInteractions=this.disableContextInteractions,t.headingLevelsShift=this.headingLevelsShift}update(t){super.update(t),["mapId","tocId","stateManager","translationDestinationLanguage","translationProfileId"].some(o=>t.has(o))&&this.setTocNode(),t.has("tocNode")&&this.registeredComponents.forEach(o=>o.tocNode=this.tocNode)}async setTocNode(){var t;this.tocNode=void 0,this.tocNode=this.mapId&&this.tocId?await((t=this.stateManager)===null||t===void 0?void 0:t.getTocNode(this.tocId)):void 0}disconnectedCallback(){super.disconnectedCallback(),this.registeredComponents=[]}};n.styles=
|
|
6
|
+
`}registerComponent(t){t.stopPropagation();let o=t.composedPath()[0];this.register(o)}register(t){this.registeredComponents.push(t),t.tocNode=this.tocNode,t.disableContextInteractions=this.disableContextInteractions,t.headingLevelsShift=this.headingLevelsShift,t.headingStartLevel=this.headingStartLevel}update(t){super.update(t),["mapId","tocId","stateManager","translationDestinationLanguage","translationProfileId"].some(o=>t.has(o))&&this.setTocNode(),t.has("tocNode")&&this.registeredComponents.forEach(o=>o.tocNode=this.tocNode)}async setTocNode(){var t;this.tocNode=void 0,this.tocNode=this.mapId&&this.tocId?await((t=this.stateManager)===null||t===void 0?void 0:t.getTocNode(this.tocId)):void 0}disconnectedCallback(){super.disconnectedCallback(),this.registeredComponents=[]}};n.styles=L;c([(0,h.redux)({selector:e=>{var t;return(t=e.map)===null||t===void 0?void 0:t.id}})],n.prototype,"mapId",void 0);c([(0,h.redux)({selector:e=>e.translation.profileId})],n.prototype,"translationProfileId",void 0);c([(0,h.redux)({selector:e=>e.translation.destinationLanguage})],n.prototype,"translationDestinationLanguage",void 0);c([(0,p.property)()],n.prototype,"tocId",void 0);c([(0,p.property)({type:Boolean})],n.prototype,"disableContextInteractions",void 0);c([(0,p.property)({type:Number})],n.prototype,"headingLevelsShift",void 0);c([(0,h.numberProperty)()],n.prototype,"headingStartLevel",void 0);c([(0,p.state)()],n.prototype,"tocNode",void 0);var P={"ft-reader-topic-context":n};(0,E.customElements)(P);})();
|