@fluid-topics/ft-reader-topic-context 1.2.34 → 1.2.36
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.
|
@@ -4,9 +4,12 @@ import { FtReaderComponent } from "@fluid-topics/ft-reader-context/build/registr
|
|
|
4
4
|
import { FtReaderTopicComponentInterface } from "./registration";
|
|
5
5
|
import { FtReaderTocNode } from "@fluid-topics/ft-reader-context/build/store/model";
|
|
6
6
|
import { FtRegistrationContext } from "@fluid-topics/ft-wc-utils";
|
|
7
|
+
import { FtTranslationLocale } from "@fluid-topics/public-api";
|
|
7
8
|
export declare class FtReaderTopicContext extends FtReaderComponent implements FtReaderTopicContextProperties, FtRegistrationContext<FtReaderTopicComponentInterface> {
|
|
8
9
|
static styles: import("lit").CSSResult;
|
|
9
10
|
mapId?: string;
|
|
11
|
+
translationProfileId?: string;
|
|
12
|
+
translationDestinationLanguage?: FtTranslationLocale;
|
|
10
13
|
tocId?: string;
|
|
11
14
|
disableContextInteractions: boolean;
|
|
12
15
|
tocNode?: FtReaderTocNode;
|
|
@@ -38,7 +38,7 @@ class FtReaderTopicContext extends FtReaderComponent {
|
|
|
38
38
|
}
|
|
39
39
|
update(changedProperties) {
|
|
40
40
|
super.update(changedProperties);
|
|
41
|
-
if (["mapId", "tocId", "stateManager"].some(p => changedProperties.has(p))) {
|
|
41
|
+
if (["mapId", "tocId", "stateManager", "translationDestinationLanguage", "translationProfileId"].some(p => changedProperties.has(p))) {
|
|
42
42
|
this.setTocNode();
|
|
43
43
|
}
|
|
44
44
|
if (changedProperties.has("tocNode")) {
|
|
@@ -48,7 +48,7 @@ class FtReaderTopicContext extends FtReaderComponent {
|
|
|
48
48
|
async setTocNode() {
|
|
49
49
|
var _a;
|
|
50
50
|
this.tocNode = undefined;
|
|
51
|
-
this.tocNode = this.mapId && this.tocId ? await ((_a = this.
|
|
51
|
+
this.tocNode = this.mapId && this.tocId ? await ((_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.getTocNode(this.tocId)) : undefined;
|
|
52
52
|
}
|
|
53
53
|
disconnectedCallback() {
|
|
54
54
|
super.disconnectedCallback();
|
|
@@ -59,6 +59,12 @@ FtReaderTopicContext.styles = styles;
|
|
|
59
59
|
__decorate([
|
|
60
60
|
redux({ selector: (s) => { var _a; return (_a = s.map) === null || _a === void 0 ? void 0 : _a.id; } })
|
|
61
61
|
], FtReaderTopicContext.prototype, "mapId", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
redux({ selector: (s) => s.translation.profileId })
|
|
64
|
+
], FtReaderTopicContext.prototype, "translationProfileId", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
redux({ selector: (s) => s.translation.destinationLanguage })
|
|
67
|
+
], FtReaderTopicContext.prototype, "translationDestinationLanguage", void 0);
|
|
62
68
|
__decorate([
|
|
63
69
|
property()
|
|
64
70
|
], FtReaderTopicContext.prototype, "tocId", void 0);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";(()=>{var
|
|
2
|
-
`;var
|
|
1
|
+
"use strict";(()=>{var L=Object.create;var b=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var u=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var B=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of w(t))!K.call(e,r)&&r!==o&&b(e,r,{get:()=>t[r],enumerable:!(n=P(t,r))||n.enumerable});return e};var l=(e,t,o)=>(o=e!=null?L(A(e)):{},B(t||!e||!e.__esModule?b(o,"default",{value:e,enumerable:!0}):o,e));var f=u(($,I)=>{I.exports=ftGlobals.wcUtils});var v=u((U,O)=>{O.exports=ftGlobals.lit});var g=u((V,N)=>{N.exports=ftGlobals.litDecorators});var E=l(f());var S=l(v()),p=l(g());var y=l(v()),q={},R=y.css`
|
|
2
|
+
`;var _=l(f()),M=l(g());var T;(function(e){e.FEEDBACK="FEEDBACK",e.RATING="RATING",e.PRINT="PRINT",e.BOOKMARK="BOOKMARK",e.COLLECTIONS="COLLECTIONS",e.PERSONAL_BOOKS="PERSONAL_BOOKS"})(T||(T={}));var D=function(e,t,o,n){var r=arguments.length,s=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,o):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,o,n);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(s=(r<3?a(s):r>3?a(t,o,s):a(t,o))||s);return r>3&&s&&Object.defineProperty(t,o,s),s},C=class extends Event{constructor(){super("register-ft-reader-component",{bubbles:!0,composed:!0})}},x=Symbol("registerInterval");function j(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[x]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null?window.clearInterval(this[x]):this.dispatchEvent(new C)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return t=x,D([(0,M.state)()],o.prototype,"stateManager",void 0),o}var m=class extends j(_.FtLitElementRedux){};var h=l(f()),d=function(e,t,o,n){var r=arguments.length,s=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,o):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,o,n);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(s=(r<3?a(s):r>3?a(t,o,s):a(t,o))||s);return r>3&&s&&Object.defineProperty(t,o,s),s},i=class extends m{constructor(){super(...arguments),this.disableContextInteractions=!1,this.registeredComponents=[]}render(){return S.html`
|
|
3
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}update(t){super.update(t),["mapId","tocId","stateManager"].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.
|
|
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}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=[]}};i.styles=R;d([(0,h.redux)({selector:e=>{var t;return(t=e.map)===null||t===void 0?void 0:t.id}})],i.prototype,"mapId",void 0);d([(0,h.redux)({selector:e=>e.translation.profileId})],i.prototype,"translationProfileId",void 0);d([(0,h.redux)({selector:e=>e.translation.destinationLanguage})],i.prototype,"translationDestinationLanguage",void 0);d([(0,p.property)()],i.prototype,"tocId",void 0);d([(0,p.property)({type:Boolean})],i.prototype,"disableContextInteractions",void 0);d([(0,p.state)()],i.prototype,"tocNode",void 0);(0,E.customElement)("ft-reader-topic-context")(i);})();
|