@fluid-topics/ft-reader-topic-title 1.2.49 → 1.2.51
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.
|
@@ -12,6 +12,6 @@ export declare class FtReaderTopicTitle extends FtReaderTopicComponent implement
|
|
|
12
12
|
private translationError?;
|
|
13
13
|
titleContainer?: HTMLElement;
|
|
14
14
|
protected render(): typeof nothing | import("lit-html").TemplateResult;
|
|
15
|
-
protected
|
|
15
|
+
protected contentAvailableCallback(props: PropertyValues): void;
|
|
16
16
|
private getTopicLanguage;
|
|
17
17
|
}
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { nothing } from "lit";
|
|
8
8
|
import { styles } from "./ft-reader-topic-title.styles";
|
|
9
9
|
import { FtReaderTopicComponent } from "@fluid-topics/ft-reader-topic-context/build/registration";
|
|
10
|
-
import { highlightHtml, highlightHtmlStyles, redux
|
|
10
|
+
import { highlightHtml, highlightHtmlStyles, redux } from "@fluid-topics/ft-wc-utils";
|
|
11
11
|
import { html, unsafeStatic } from "lit/static-html.js";
|
|
12
12
|
import { query } from "lit/decorators.js";
|
|
13
13
|
import { FtSkeleton } from "@fluid-topics/ft-skeleton";
|
|
@@ -34,11 +34,11 @@ class FtReaderTopicTitle extends FtReaderTopicComponent {
|
|
|
34
34
|
</section>
|
|
35
35
|
`;
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
super.
|
|
39
|
-
this.
|
|
40
|
-
.
|
|
41
|
-
|
|
37
|
+
contentAvailableCallback(props) {
|
|
38
|
+
super.contentAvailableCallback(props);
|
|
39
|
+
if (this.titleContainer) {
|
|
40
|
+
highlightHtml(this.titleContainer, this.disableContextInteractions ? "" : this.searchInDocumentQuery, { attributes: { part: "kwicmatch" } });
|
|
41
|
+
}
|
|
42
42
|
}
|
|
43
43
|
getTopicLanguage() {
|
|
44
44
|
var _a;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";(()=>{var
|
|
1
|
+
"use strict";(()=>{var Bt=Object.create;var rt=Object.defineProperty;var Ut=Object.getOwnPropertyDescriptor;var Wt=Object.getOwnPropertyNames;var Vt=Object.getPrototypeOf,Ft=Object.prototype.hasOwnProperty;var V=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var Kt=(i,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Wt(t))!Ft.call(i,o)&&o!==e&&rt(i,o,{get:()=>t[o],enumerable:!(s=Ut(t,o))||s.enumerable});return i};var u=(i,t,e)=>(e=i!=null?Bt(Vt(i)):{},Kt(t||!i||!i.__esModule?rt(e,"default",{value:i,enumerable:!0}):e,i));var v=V((ie,at)=>{at.exports=ftGlobals.wcUtils});var H=V((se,lt)=>{lt.exports=ftGlobals.lit});var L=V((ne,dt)=>{dt.exports=ftGlobals.litDecorators});var jt=u(v());var Dt=u(H());var ct=u(H()),k=u(v()),Zt={fontFamily:k.FtCssVariableFactory.external(k.designSystemVariables.titleFont,"Design system")},ht=ct.css`
|
|
2
2
|
.title {
|
|
3
|
-
font-family: ${
|
|
3
|
+
font-family: ${Zt.fontFamily};
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
ft-skeleton {
|
|
7
7
|
width: 150px;
|
|
8
8
|
}
|
|
9
|
-
`;var G=u(
|
|
10
|
-
\f\r]`,I=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
11
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
9
|
+
`;var G=u(L());var mt=u(v()),ft=u(L());var pt;(function(i){i.clusteringHelperCreated="clustering-helper-created",i.mapAttachmentsUpdate="map-attachments-update"})(pt||(pt={}));var ut;(function(i){i.FEEDBACK="FEEDBACK",i.RATING="RATING",i.PRINT="PRINT",i.BOOKMARK="BOOKMARK",i.COLLECTIONS="COLLECTIONS",i.PERSONAL_BOOKS="PERSONAL_BOOKS"})(ut||(ut={}));var Gt=function(i,t,e,s){var o=arguments.length,n=o<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(i,t,e,s);else for(var l=i.length-1;l>=0;l--)(r=i[l])&&(n=(o<3?r(n):o>3?r(t,e,n):r(t,e))||n);return o>3&&n&&Object.defineProperty(t,e,n),n},K=class extends Event{constructor(){super("register-ft-reader-component",{bubbles:!0,composed:!0})}},F=Symbol("registerInterval");function Qt(i){var t;class e extends i{constructor(){super(...arguments),this[t]=0}setReaderStateManager(o){this.clearStateManager(),this.stateManager=o,this.addStore(o.store,"reader")}clearStateManager(){this.stateManager&&(this.removeStore("reader"),this.stateManager=void 0)}get service(){var o;return(o=this.stateManager)===null||o===void 0?void 0:o.service}connectedCallback(){super.connectedCallback(),this[F]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null?window.clearInterval(this[F]):this.dispatchEvent(new K)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return t=F,Gt([(0,ft.state)()],e.prototype,"stateManager",void 0),e}var D=class extends Qt(mt.FtLitElementRedux){};var $t=function(i,t,e,s){var o=arguments.length,n=o<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(i,t,e,s);else for(var l=i.length-1;l>=0;l--)(r=i[l])&&(n=(o<3?r(n):o>3?r(t,e,n):r(t,e))||n);return o>3&&n&&Object.defineProperty(t,e,n),n},Q=class extends Event{constructor(){super("register-ft-reader-topic-component",{bubbles:!0,composed:!0})}},Z=Symbol("registerInterval");function zt(i){var t;class e extends i{constructor(){super(...arguments),this.disableContextInteractions=!1,this[t]=0}connectedCallback(){super.connectedCallback(),this[Z]=window.setInterval(()=>this.tryToRegisterToTopicContext(),50)}tryToRegisterToTopicContext(){this.tocNode!=null?window.clearInterval(this[Z]):this.dispatchEvent(new Q)}disconnectedCallback(){super.disconnectedCallback(),this.tocNode=void 0}}return t=Z,$t([(0,G.state)()],e.prototype,"tocNode",void 0),$t([(0,G.state)()],e.prototype,"disableContextInteractions",void 0),e}var P=class extends zt(D){};var g=u(v());var et=globalThis,j=et.trustedTypes,gt=j?j.createPolicy("lit-html",{createHTML:i=>i}):void 0,bt="$lit$",y=`lit$${Math.random().toFixed(9).slice(2)}$`,Ct="?"+y,qt=`<${Ct}>`,S=document,B=()=>S.createComment(""),O=i=>i===null||typeof i!="object"&&typeof i!="function",it=Array.isArray,Yt=i=>it(i)||typeof i?.[Symbol.iterator]=="function",z=`[
|
|
10
|
+
\f\r]`,I=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_t=/-->/g,At=/>/g,b=RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^
|
|
11
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),vt=/'/g,yt=/"/g,St=/^(?:script|style|textarea|title)$/i,st=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),Nt=st(1),Tt=st(2),wt=st(3),E=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),xt=new WeakMap,C=S.createTreeWalker(S,129);function Ht(i,t){if(!it(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return gt!==void 0?gt.createHTML(t):t}var Jt=(i,t)=>{let e=i.length-1,s=[],o,n=t===2?"<svg>":t===3?"<math>":"",r=I;for(let l=0;l<e;l++){let a=i[l],c,d,h=-1,_=0;for(;_<a.length&&(r.lastIndex=_,d=r.exec(a),d!==null);)_=r.lastIndex,r===I?d[1]==="!--"?r=_t:d[1]!==void 0?r=At:d[2]!==void 0?(St.test(d[2])&&(o=RegExp("</"+d[2],"g")),r=b):d[3]!==void 0&&(r=b):r===b?d[0]===">"?(r=o??I,h=-1):d[1]===void 0?h=-2:(h=r.lastIndex-d[2].length,c=d[1],r=d[3]===void 0?b:d[3]==='"'?yt:vt):r===yt||r===vt?r=b:r===_t||r===At?r=I:(r=b,o=void 0);let A=r===b&&i[l+1].startsWith("/>")?" ":"";n+=r===I?a+qt:h>=0?(s.push(c),a.slice(0,h)+bt+a.slice(h)+y+A):a+y+(h===-2?l:A)}return[Ht(i,n+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},M=class i{constructor({strings:t,_$litType$:e},s){let o;this.parts=[];let n=0,r=0,l=t.length-1,a=this.parts,[c,d]=Jt(t,e);if(this.el=i.createElement(c,s),C.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(o=C.nextNode())!==null&&a.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let h of o.getAttributeNames())if(h.endsWith(bt)){let _=d[r++],A=o.getAttribute(h).split(y),R=/([.?@])?(.*)/.exec(_);a.push({type:1,index:n,name:R[2],strings:A,ctor:R[1]==="."?Y:R[1]==="?"?J:R[1]==="@"?X:T}),o.removeAttribute(h)}else h.startsWith(y)&&(a.push({type:6,index:n}),o.removeAttribute(h));if(St.test(o.tagName)){let h=o.textContent.split(y),_=h.length-1;if(_>0){o.textContent=j?j.emptyScript:"";for(let A=0;A<_;A++)o.append(h[A],B()),C.nextNode(),a.push({type:2,index:++n});o.append(h[_],B())}}}else if(o.nodeType===8)if(o.data===Ct)a.push({type:2,index:n});else{let h=-1;for(;(h=o.data.indexOf(y,h+1))!==-1;)a.push({type:7,index:n}),h+=y.length-1}n++}}static createElement(t,e){let s=S.createElement("template");return s.innerHTML=t,s}};function N(i,t,e=i,s){if(t===E)return t;let o=s!==void 0?e._$Co?.[s]:e._$Cl,n=O(t)?void 0:t._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),n===void 0?o=void 0:(o=new n(i),o._$AT(i,e,s)),s!==void 0?(e._$Co??=[])[s]=o:e._$Cl=o),o!==void 0&&(t=N(i,o._$AS(i,t.values),o,s)),t}var q=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:s}=this._$AD,o=(t?.creationScope??S).importNode(e,!0);C.currentNode=o;let n=C.nextNode(),r=0,l=0,a=s[0];for(;a!==void 0;){if(r===a.index){let c;a.type===2?c=new U(n,n.nextSibling,this,t):a.type===1?c=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(c=new tt(n,this,t)),this._$AV.push(c),a=s[++l]}r!==a?.index&&(n=C.nextNode(),r++)}return C.currentNode=S,o}p(t){let e=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}},U=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,o){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=N(this,t,e),O(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==E&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Yt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==p&&O(this._$AH)?this._$AA.nextSibling.data=t:this.T(S.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:s}=t,o=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=M.createElement(Ht(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===o)this._$AH.p(e);else{let n=new q(o,this),r=n.u(this.options);n.p(e),this.T(r),this._$AH=n}}_$AC(t){let e=xt.get(t.strings);return e===void 0&&xt.set(t.strings,e=new M(t)),e}k(t){it(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,s,o=0;for(let n of t)o===e.length?e.push(s=new i(this.O(B()),this.O(B()),this,this.options)):s=e[o],s._$AI(n),o++;o<e.length&&(this._$AR(s&&s._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let s=t.nextSibling;t.remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},T=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,o,n){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=p}_$AI(t,e=this,s,o){let n=this.strings,r=!1;if(n===void 0)t=N(this,t,e,0),r=!O(t)||t!==this._$AH&&t!==E,r&&(this._$AH=t);else{let l=t,a,c;for(t=n[0],a=0;a<n.length-1;a++)c=N(this,l[s+a],e,a),c===E&&(c=this._$AH[a]),r||=!O(c)||c!==this._$AH[a],c===p?t=p:t!==p&&(t+=(c??"")+n[a+1]),this._$AH[a]=c}r&&!o&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Y=class extends T{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}},J=class extends T{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}},X=class extends T{constructor(t,e,s,o,n){super(t,e,s,o,n),this.type=5}_$AI(t,e=this){if((t=N(this,t,e,0)??p)===E)return;let s=this._$AH,o=t===p&&s!==p||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==p&&(s===p||o);o&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},tt=class{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){N(this,t)}};var Xt=et.litHtmlPolyfillSupport;Xt?.(M,U),(et.litHtmlVersions??=[]).push("3.3.0");var Ot=Symbol.for(""),te=i=>{if(i?.r===Ot)return i?._$litStatic$},ot=i=>({_$litStatic$:i,r:Ot});var It=new Map,nt=i=>(t,...e)=>{let s=e.length,o,n,r=[],l=[],a,c=0,d=!1;for(;c<s;){for(a=t[c];c<s&&(n=e[c],(o=te(n))!==void 0);)a+=o+t[++c],d=!0;c!==s&&l.push(n),r.push(a),c++}if(c===s&&r.push(t[s]),d){let h=r.join("$$lit$$");(t=It.get(h))===void 0&&(r.raw=r,It.set(h,t=r)),e=l}return i(t,...e)},W=nt(Nt),ue=nt(Tt),me=nt(wt);var Pt=u(L());var Lt=u(v());var Rt=u(H()),kt=u(v());var Et=u(H()),$=u(v()),m={display:$.FtCssVariableFactory.create("--ft-skeleton--display","","DISPLAY","block"),width:$.FtCssVariableFactory.create("--ft-skeleton--width","","SIZE","100%"),height:$.FtCssVariableFactory.create("--ft-skeleton--height","","SIZE","20px"),backgroundColor:$.FtCssVariableFactory.create("--ft-skeleton--background-color","","COLOR","#f1f1f1"),glareWidth:$.FtCssVariableFactory.create("--ft-skeleton--glare-width","","SIZE","200px"),glareColor:$.FtCssVariableFactory.create("--ft-skeleton--glare-color","","COLOR","rgba(255, 255, 255, .6)"),animationDuration:$.FtCssVariableFactory.create("--ft-skeleton--animation-duration","","UNKNOWN","2s"),borderRadiusM:$.FtCssVariableFactory.external($.designSystemVariables.borderRadiusM,"Design system")},Mt=Et.css`
|
|
12
12
|
:host {
|
|
13
13
|
width: ${m.width};
|
|
14
14
|
height: ${m.height};
|
|
@@ -35,19 +35,19 @@
|
|
|
35
35
|
background-position: calc(100vw + ${m.glareWidth}) 0, calc(${m.glareWidth} * -1) 0;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
`;var x=class extends
|
|
39
|
-
`}};x.elementDefinitions={};x.styles=
|
|
38
|
+
`;var x=class extends kt.FtLitElement{render(){return Rt.html`
|
|
39
|
+
`}};x.elementDefinitions={};x.styles=Mt;(0,Lt.customElement)("ft-skeleton")(x);var w=function(i,t,e,s){var o=arguments.length,n=o<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(i,t,e,s);else for(var l=i.length-1;l>=0;l--)(r=i[l])&&(n=(o<3?r(n):o>3?r(t,e,n):r(t,e))||n);return o>3&&n&&Object.defineProperty(t,e,n),n},f=class extends P{render(){var t,e,s,o,n;if((!this.map||!this.tocNode)&&!this.translationLoading)return Dt.nothing;let r=`h${Math.min(((t=this.tocNode)===null||t===void 0?void 0:t.depth)||1,6)}`,l=(s=(e=this.map)===null||e===void 0?void 0:e.contentStyles.customCssClasses.join(" "))!==null&&s!==void 0?s:"";return W`
|
|
40
40
|
<style>
|
|
41
41
|
@import "${(o=this.map)===null||o===void 0?void 0:o.contentStyles.titleStylesheetUrl}";
|
|
42
42
|
</style>
|
|
43
43
|
<section class="title" lang="${this.getTopicLanguage()}">
|
|
44
|
-
${this.translationLoading?
|
|
45
|
-
<ft-skeleton></ft-skeleton>`:
|
|
44
|
+
${this.translationLoading?W`
|
|
45
|
+
<ft-skeleton></ft-skeleton>`:W`
|
|
46
46
|
<div class="depth-${(n=this.tocNode)===null||n===void 0?void 0:n.depth} content-locale-${this.getTopicLanguage()} ${l}">
|
|
47
47
|
<${ot(r)}>${this.tocNode.title}</${ot(r)}>
|
|
48
48
|
</div>`}
|
|
49
49
|
</section>
|
|
50
|
-
`}
|
|
50
|
+
`}contentAvailableCallback(t){super.contentAvailableCallback(t),this.titleContainer&&(0,g.highlightHtml)(this.titleContainer,this.disableContextInteractions?"":this.searchInDocumentQuery,{attributes:{part:"kwicmatch"}})}getTopicLanguage(){var t;return this.translationDestinationLanguage&&!this.translationError?this.translationDestinationLanguage.code:(t=this.map)===null||t===void 0?void 0:t.lang}};f.elementDefinitions={"ft-skeleton":x};f.styles=[ht,g.highlightHtmlStyles];w([(0,g.redux)()],f.prototype,"map",void 0);w([(0,g.redux)({selector:(i,t)=>t.disableContextInteractions?"":i.searchInDocumentQuery})],f.prototype,"searchInDocumentQuery",void 0);w([(0,g.redux)({selector:i=>i.translation.destinationLanguage})],f.prototype,"translationDestinationLanguage",void 0);w([(0,g.redux)({selector:i=>i.translation.isLoading})],f.prototype,"translationLoading",void 0);w([(0,g.redux)({selector:i=>i.translation.isError})],f.prototype,"translationError",void 0);w([(0,Pt.query)("section.title")],f.prototype,"titleContainer",void 0);(0,jt.customElement)("ft-reader-topic-title")(f);})();
|
|
51
51
|
/*! Bundled license information:
|
|
52
52
|
|
|
53
53
|
lit-html/lit-html.js:
|