@fluid-topics/ft-reader-internal-link 2.0.28 → 2.0.29

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.
@@ -1,20 +1,20 @@
1
- "use strict";(()=>{var w=Object.create;var C=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var d=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of j(t))!G.call(e,r)&&r!==o&&C(e,r,{get:()=>t[r],enumerable:!(i=B(t,r))||i.enumerable});return e};var l=(e,t,o)=>(o=e!=null?w(D(e)):{},$(t||!e||!e.__esModule?C(o,"default",{value:e,enumerable:!0}):o,e));var f=d((z,_)=>{_.exports=ftGlobals.wcUtils});var b=d((F,O)=>{O.exports=ftGlobals.lit});var g=d((J,M)=>{M.exports=ftGlobals.litDecorators});var I=d((Q,S)=>{S.exports=ftGlobals.litClassMap});var A=l(f());var E=l(b()),p=l(g()),K=l(I());var u=l(f()),k=l(g());var R;(function(e){e.clusteringHelperCreated="clustering-helper-created",e.mapAttachmentsUpdate="map-attachments-update",e.visibleTopicChange="visible-topic-change"})(R||(R={}));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 V=function(e,t,o,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,o):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,o,i);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(s=(r<3?n(s):r>3?n(t,o,s):n(t,o))||s);return r>3&&s&&Object.defineProperty(t,o,s),s},x=class extends Event{constructor(){super("register-ft-reader-component",{bubbles:!0,composed:!0})}},y=Symbol("registerInterval"),U=(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[y]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null?window.clearInterval(this[y]):this.dispatchEvent(new x)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return t=y,V([(0,k.state)()],o.prototype,"stateManager",void 0),o}),m=class extends U(u.FtLitElementRedux){};var h=l(f()),N=l(b()),H={outlineColor:h.FtCssVariableFactory.extend("--ft-reader-internal-link-outline-color","",h.designSystemVariables.colorPrimary)},L=N.css`
1
+ "use strict";(()=>{var w=Object.create;var C=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var d=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of j(t))!G.call(e,r)&&r!==o&&C(e,r,{get:()=>t[r],enumerable:!(i=B(t,r))||i.enumerable});return e};var l=(e,t,o)=>(o=e!=null?w(D(e)):{},$(t||!e||!e.__esModule?C(o,"default",{value:e,enumerable:!0}):o,e));var f=d((z,_)=>{_.exports=ftGlobals.wcUtils});var b=d((F,O)=>{O.exports=ftGlobals.lit});var g=d((J,M)=>{M.exports=ftGlobals.litDecorators});var S=d((Q,I)=>{I.exports=ftGlobals.litClassMap});var E=l(f());var K=l(b()),p=l(g()),P=l(S());var u=l(f()),N=l(g());var R;(function(e){e.clusteringHelperCreated="clustering-helper-created",e.mapAttachmentsUpdate="map-attachments-update",e.visibleTopicChange="visible-topic-change",e.requestedTopicNotFound="requested-topic-not-found"})(R||(R={}));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 V=function(e,t,o,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,o):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,o,i);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(s=(r<3?n(s):r>3?n(t,o,s):n(t,o))||s);return r>3&&s&&Object.defineProperty(t,o,s),s},x=class extends Event{constructor(){super("register-ft-reader-component",{bubbles:!0,composed:!0})}},y=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[y]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null?window.clearInterval(this[y]):this.dispatchEvent(new x)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return t=y,V([(0,N.state)()],o.prototype,"stateManager",void 0),o}),m=class extends q(u.FtLitElementRedux){};var h=l(f()),k=l(b()),U={outlineColor:h.FtCssVariableFactory.extend("--ft-reader-internal-link-outline-color","",h.designSystemVariables.colorPrimary)},L=k.css`
2
2
  :host {
3
3
  display: contents;
4
4
  }
5
5
 
6
6
  a:focus {
7
- outline-color: ${H.outlineColor};
7
+ outline-color: ${U.outlineColor};
8
8
  }
9
9
 
10
10
  .ft-reader-link--remove-style {
11
11
  text-decoration: none;
12
12
  color: inherit;
13
13
  }
14
- `;var v=function(e,t,o,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,o):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,o,i);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(s=(r<3?n(s):r>3?n(t,o,s):n(t,o))||s);return r>3&&s&&Object.defineProperty(t,o,s),s},a=class extends m{constructor(){super(...arguments),this.removeStyle=!1}render(){var t;let o=(0,K.classMap)({"ft-reader-link":!0,"ft-reader-link--remove-style":this.removeStyle});return E.html`
14
+ `;var v=function(e,t,o,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,o):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,o,i);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(s=(r<3?n(s):r>3?n(t,o,s):n(t,o))||s);return r>3&&s&&Object.defineProperty(t,o,s),s},a=class extends m{constructor(){super(...arguments),this.removeStyle=!1}render(){var t;let o=(0,P.classMap)({"ft-reader-link":!0,"ft-reader-link--remove-style":this.removeStyle});return K.html`
15
15
  <a class=${o}
16
16
  href="${(t=this.service)===null||t===void 0?void 0:t.getLink(this.tocId,this.pageNumber,this.section)}"
17
17
  @click=${i=>this.onLinkClick(i)}>
18
18
  <slot></slot>
19
19
  </a>
20
- `}onLinkClick(t){var o,i,r;!t.ctrlKey&&!t.metaKey&&(t.stopPropagation(),t.preventDefault(),performance.mark(`fluid_topics__reader_link_click__${this.tocId}`),(o=this.stateManager)===null||o===void 0||o.navigateToTopic(this.tocId,this.section,this.pageNumber),(i=this.stateManager)===null||i===void 0||i.store.commands.clear(/^focus-topic-/),(r=this.stateManager)===null||r===void 0||r.store.commands.add({type:`focus-topic-${this.tocId}`}),this.click())}};a.styles=L;v([(0,p.property)()],a.prototype,"tocId",void 0);v([(0,p.property)()],a.prototype,"section",void 0);v([(0,p.property)({type:Number})],a.prototype,"pageNumber",void 0);v([(0,p.property)({type:Boolean})],a.prototype,"removeStyle",void 0);var P={"ft-reader-internal-link":a};(0,A.customElements)(P);})();
20
+ `}onLinkClick(t){var o,i,r;!t.ctrlKey&&!t.metaKey&&(t.stopPropagation(),t.preventDefault(),performance.mark(`fluid_topics__reader_link_click__${this.tocId}`),(o=this.stateManager)===null||o===void 0||o.navigateToTopic(this.tocId,this.section,this.pageNumber),(i=this.stateManager)===null||i===void 0||i.store.commands.clear(/^focus-topic-/),(r=this.stateManager)===null||r===void 0||r.store.commands.add({type:`focus-topic-${this.tocId}`}),this.click())}};a.styles=L;v([(0,p.property)()],a.prototype,"tocId",void 0);v([(0,p.property)()],a.prototype,"section",void 0);v([(0,p.property)({type:Number})],a.prototype,"pageNumber",void 0);v([(0,p.property)({type:Boolean})],a.prototype,"removeStyle",void 0);var A={"ft-reader-internal-link":a};(0,E.customElements)(A);})();
@@ -82,7 +82,7 @@ Also for action icons.`,c.colorGray200),contentGlobalSubtle:r.extend("--ftds-con
82
82
  <li>${this.helperText}</li>
83
83
  `)}
84
84
  </ul>
85
- `}resolveStatus(){return this.forceStatus?this.forceStatus:this.errorMessages.length?Ze.error:this.warningMessages.length?Ze.warning:Ze.default}processRules(n){return n.map(a=>a(this.value)).filter(a=>a!==!0).map(a=>a)}}return j([D()],e.prototype,"warningRules",void 0),j([D()],e.prototype,"errorRules",void 0),j([D()],e.prototype,"validateOn",void 0),j([D({type:Boolean})],e.prototype,"validateAtRender",void 0),j([D()],e.prototype,"label",void 0),j([D({type:Boolean})],e.prototype,"hideLabel",void 0),j([D()],e.prototype,"name",void 0),j([D({type:Boolean})],e.prototype,"disabled",void 0),j([D()],e.prototype,"helperText",void 0),j([D()],e.prototype,"forceStatus",void 0),j([D({reflect:!0})],e.prototype,"value",void 0),j([ee()],e.prototype,"errorMessages",void 0),j([ee()],e.prototype,"warningMessages",void 0),j([ee()],e.prototype,"status",void 0),j([ee()],e.prototype,"focused",void 0),j([ee()],e.prototype,"additionalWarningRules",void 0),j([ee()],e.prototype,"additionalErrorRules",void 0),e});var Zt=(t,e)=>{let o=t._$AN;if(o===void 0)return!1;for(let n of o)n._$AO?.(e,!1),Zt(n,e);return!0},Cr=t=>{let e,o;do{if((e=t._$AM)===void 0)break;o=e._$AN,o.delete(t),t=e}while(o?.size===0)},$s=t=>{for(let e;e=t._$AM;t=e){let o=e._$AN;if(o===void 0)e._$AN=o=new Set;else if(o.has(t))break;o.add(t),tu(e)}};function Qd(t){this._$AN!==void 0?(Cr(this),this._$AM=t,$s(this)):this._$AM=t}function eu(t,e=!1,o=0){let n=this._$AH,a=this._$AN;if(a!==void 0&&a.size!==0)if(e)if(Array.isArray(n))for(let i=o;i<n.length;i++)Zt(n[i],!1),Cr(n[i]);else n!=null&&(Zt(n,!1),Cr(n));else Zt(this,t)}var tu=t=>{t.type==le.CHILD&&(t._$AP??=eu,t._$AQ??=Qd)},xt=class extends te{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,o,n){super._$AT(e,o,n),$s(this),this.isConnected=e._$AU}_$AO(e,o=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),o&&(Zt(this,e),Cr(this))}setValue(e){if(ra(this._$Ct))this._$Ct._$AI(e,this);else{let o=[...this._$Ct._$AH];o[this._$Ci]=e,this._$Ct._$AI(o,this,0)}}disconnected(){}reconnected(){}};var Pn=class extends xt{get element(){var e;return(e=this.part)===null||e===void 0?void 0:e.element}constructor(e){super(e),this.onFirstTrapFocus=async o=>{if(!this.element||!o.relatedTarget)return;let n=o.relatedTarget;this.isInsideElement(n,this.element)?await this.focusLastDescendant(this.element):await this.focusFirstDescendant(this.element)},this.onLastTrapFocus=async o=>{if(!this.element||!o.relatedTarget)return;let n=o.relatedTarget;this.isInsideElement(n,this.element)?await this.focusFirstDescendant(this.element):await this.focusLastDescendant(this.element)}}render(){return z}update(e){return this.part=e,this.ensureFocusTrap(e.element),z}reconnected(){var e;this.ensureFocusTrap((e=this.part)===null||e===void 0?void 0:e.element)}disconnected(){this.removeFocusTrap()}ensureFocusTrap(e){var o,n;this.isElementTrappable(e)&&(((o=this.firstTrap)===null||o===void 0?void 0:o.parentElement)===e&&((n=this.lastTrap)===null||n===void 0?void 0:n.parentElement)===e||(this.removeFocusTrap(),this.createFocusTrap(e)))}removeFocusTrap(){var e,o,n,a;(e=this.firstTrap)===null||e===void 0||e.removeEventListener("focus",this.onFirstTrapFocus),(o=this.lastTrap)===null||o===void 0||o.removeEventListener("focus",this.onLastTrapFocus),(n=this.firstTrap)===null||n===void 0||n.remove(),(a=this.lastTrap)===null||a===void 0||a.remove(),this.firstTrap=void 0,this.lastTrap=void 0}isElementTrappable(e){return!!e&&e instanceof HTMLElement&&e.childElementCount>0}createFocusTrap(e){this.firstTrap=this.createTrap(),this.lastTrap=this.createTrap(),e.insertBefore(this.firstTrap,e.firstChild),e.appendChild(this.lastTrap),this.lastTrap.addEventListener("focus",this.onLastTrapFocus),this.firstTrap.addEventListener("focus",this.onFirstTrapFocus)}createTrap(){let e=document.createElement("div");return e.tabIndex=0,e}getChildren(e){return e instanceof HTMLSlotElement?e.assignedElements():e.shadowRoot?e.shadowRoot.children:e.children}async focusFirstDescendant(e){await this.updateCompleteIfNecessary(e);let o=this.getChildren(e);for(let n=0;n<o.length;n++){let a=o[n];if(a instanceof HTMLElement&&(this.attemptFocus(a)||await this.focusFirstDescendant(a)))return!0}return!1}async focusLastDescendant(e){await this.updateCompleteIfNecessary(e);let o=this.getChildren(e);for(let n=o.length-1;n>=0;n--){let a=o[n];if(a instanceof HTMLElement&&(this.attemptFocus(a)||await this.focusLastDescendant(a)))return!0}return!1}async updateCompleteIfNecessary(e){e instanceof Q&&await e.updateComplete}isInsideElement(e,o){for(let n=e;n;n=n.parentNode){if(n===o)return!0;n instanceof ShadowRoot?n=n.host:n.assignedSlot&&(n=n.assignedSlot)}return!1}attemptFocus(e){return e===this.firstTrap||e===this.lastTrap||!this.isFocusable(e)?!1:(e.focus(),!0)}isFocusable(e){return!e.checkVisibility()||this.isElementDisabled(e)?!1:e instanceof HTMLAnchorElement?!!e.href&&e.rel!=="ignore":e instanceof HTMLInputElement?e.type!=="hidden":e.tabIndex>=0}isElementDisabled(e){return"disabled"in e&&!!e.disabled}},Wb=Y(Pn);var zs;(function(t){t.sm="sm",t.md="md",t.lg="lg",t.xl="xl"})(zs||(zs={}));var ru={sm:640,md:768,lg:1024,xl:1280},Ln=class extends xt{constructor(e){super(e),this.size=0,this.onResize=()=>{let o=window.innerWidth;this.size!==o&&(this.size=o,this.lastArgs&&this.setValue(this.render(...this.lastArgs)))},this.size=window.innerWidth,window.addEventListener("resize",this.onResize)}disconnected(){window.removeEventListener("resize",this.onResize)}reconnected(){window.addEventListener("resize",this.onResize)}update(e,[o,n,a]){return this.lastArgs=[o,n,a],this.render(o,n,a)}render(e,o,n){let a=this.resolveThreshold(e),i=n??(()=>B);return this.size>a?o():i()}resolveThreshold(e){return typeof e=="number"?e:ru[e]}},Zb=Y(Ln);var kn,Nn,Dn,Fn,ou=navigator.vendor&&!!navigator.vendor.match(/apple/i)||((Dn=(Nn=(kn=window.safari)===null||kn===void 0?void 0:kn.pushNotification)===null||Nn===void 0?void 0:Nn.toString())!==null&&Dn!==void 0?Dn:"")==="[object SafariRemoteNotification]",nu="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;window.ftGlobals=(Fn=window.ftGlobals)!==null&&Fn!==void 0?Fn:{lit:Br,litDecorators:Hr,litRepeat:$r,litClassMap:Gr,litStyleMap:Wr,litUnsafeHTML:jr,wcUtils:{...no,...Kr,...lo,...Cn,...uo,...Yr,...mo,...ro,..._o,...Tn,...Us,...bn,...Po,...ho,...Mo,...On,...Do,...In,...yi,...Qr,...Bo,...go,...Ho,...Bs,...gi,...zo,...yn,...wn,...Lo,...No,...vn,...io,isSafari:ou,isTouchScreen:nu,setVariable:tt}};var Gs;(function(t){t.clusteringHelperCreated="clustering-helper-created",t.mapAttachmentsUpdate="map-attachments-update",t.visibleTopicChange="visible-topic-change"})(Gs||(Gs={}));var Ws;(function(t){t.FEEDBACK="FEEDBACK",t.RATING="RATING",t.PRINT="PRINT",t.BOOKMARK="BOOKMARK",t.COLLECTIONS="COLLECTIONS",t.PERSONAL_BOOKS="PERSONAL_BOOKS"})(Ws||(Ws={}));var au=function(t,e,o,n){var a=arguments.length,i=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,o):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,o,n);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(i=(a<3?s(i):a>3?s(e,o,i):s(e,o))||i);return a>3&&i&&Object.defineProperty(e,o,i),i},Un=class extends Event{constructor(){super("register-ft-reader-component",{bubbles:!0,composed:!0})}},Mn=Symbol("registerInterval"),iu=K(Symbol("toFtReaderComponent"),function(t){var e;class o extends t{constructor(){super(...arguments),this[e]=0}setReaderStateManager(a){this.clearStateManager(),this.stateManager=a,this.addStore(a.store,"reader")}clearStateManager(){this.stateManager&&(this.removeStore("reader"),this.stateManager=void 0)}get service(){var a;return(a=this.stateManager)===null||a===void 0?void 0:a.service}connectedCallback(){super.connectedCallback(),this[Mn]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null?window.clearInterval(this[Mn]):this.dispatchEvent(new Un)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return e=Mn,au([ee()],o.prototype,"stateManager",void 0),o}),Ar=class extends iu(Wt){};var su={outlineColor:r.extend("--ft-reader-internal-link-outline-color","",yo.colorPrimary)},js=$`
85
+ `}resolveStatus(){return this.forceStatus?this.forceStatus:this.errorMessages.length?Ze.error:this.warningMessages.length?Ze.warning:Ze.default}processRules(n){return n.map(a=>a(this.value)).filter(a=>a!==!0).map(a=>a)}}return j([D()],e.prototype,"warningRules",void 0),j([D()],e.prototype,"errorRules",void 0),j([D()],e.prototype,"validateOn",void 0),j([D({type:Boolean})],e.prototype,"validateAtRender",void 0),j([D()],e.prototype,"label",void 0),j([D({type:Boolean})],e.prototype,"hideLabel",void 0),j([D()],e.prototype,"name",void 0),j([D({type:Boolean})],e.prototype,"disabled",void 0),j([D()],e.prototype,"helperText",void 0),j([D()],e.prototype,"forceStatus",void 0),j([D({reflect:!0})],e.prototype,"value",void 0),j([ee()],e.prototype,"errorMessages",void 0),j([ee()],e.prototype,"warningMessages",void 0),j([ee()],e.prototype,"status",void 0),j([ee()],e.prototype,"focused",void 0),j([ee()],e.prototype,"additionalWarningRules",void 0),j([ee()],e.prototype,"additionalErrorRules",void 0),e});var Zt=(t,e)=>{let o=t._$AN;if(o===void 0)return!1;for(let n of o)n._$AO?.(e,!1),Zt(n,e);return!0},Cr=t=>{let e,o;do{if((e=t._$AM)===void 0)break;o=e._$AN,o.delete(t),t=e}while(o?.size===0)},$s=t=>{for(let e;e=t._$AM;t=e){let o=e._$AN;if(o===void 0)e._$AN=o=new Set;else if(o.has(t))break;o.add(t),tu(e)}};function Qd(t){this._$AN!==void 0?(Cr(this),this._$AM=t,$s(this)):this._$AM=t}function eu(t,e=!1,o=0){let n=this._$AH,a=this._$AN;if(a!==void 0&&a.size!==0)if(e)if(Array.isArray(n))for(let i=o;i<n.length;i++)Zt(n[i],!1),Cr(n[i]);else n!=null&&(Zt(n,!1),Cr(n));else Zt(this,t)}var tu=t=>{t.type==le.CHILD&&(t._$AP??=eu,t._$AQ??=Qd)},xt=class extends te{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,o,n){super._$AT(e,o,n),$s(this),this.isConnected=e._$AU}_$AO(e,o=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),o&&(Zt(this,e),Cr(this))}setValue(e){if(ra(this._$Ct))this._$Ct._$AI(e,this);else{let o=[...this._$Ct._$AH];o[this._$Ci]=e,this._$Ct._$AI(o,this,0)}}disconnected(){}reconnected(){}};var Pn=class extends xt{get element(){var e;return(e=this.part)===null||e===void 0?void 0:e.element}constructor(e){super(e),this.onFirstTrapFocus=async o=>{if(!this.element||!o.relatedTarget)return;let n=o.relatedTarget;this.isInsideElement(n,this.element)?await this.focusLastDescendant(this.element):await this.focusFirstDescendant(this.element)},this.onLastTrapFocus=async o=>{if(!this.element||!o.relatedTarget)return;let n=o.relatedTarget;this.isInsideElement(n,this.element)?await this.focusFirstDescendant(this.element):await this.focusLastDescendant(this.element)}}render(){return z}update(e){return this.part=e,this.ensureFocusTrap(e.element),z}reconnected(){var e;this.ensureFocusTrap((e=this.part)===null||e===void 0?void 0:e.element)}disconnected(){this.removeFocusTrap()}ensureFocusTrap(e){var o,n;this.isElementTrappable(e)&&(((o=this.firstTrap)===null||o===void 0?void 0:o.parentElement)===e&&((n=this.lastTrap)===null||n===void 0?void 0:n.parentElement)===e||(this.removeFocusTrap(),this.createFocusTrap(e)))}removeFocusTrap(){var e,o,n,a;(e=this.firstTrap)===null||e===void 0||e.removeEventListener("focus",this.onFirstTrapFocus),(o=this.lastTrap)===null||o===void 0||o.removeEventListener("focus",this.onLastTrapFocus),(n=this.firstTrap)===null||n===void 0||n.remove(),(a=this.lastTrap)===null||a===void 0||a.remove(),this.firstTrap=void 0,this.lastTrap=void 0}isElementTrappable(e){return!!e&&e instanceof HTMLElement&&e.childElementCount>0}createFocusTrap(e){this.firstTrap=this.createTrap(),this.lastTrap=this.createTrap(),e.insertBefore(this.firstTrap,e.firstChild),e.appendChild(this.lastTrap),this.lastTrap.addEventListener("focus",this.onLastTrapFocus),this.firstTrap.addEventListener("focus",this.onFirstTrapFocus)}createTrap(){let e=document.createElement("div");return e.tabIndex=0,e}getChildren(e){return e instanceof HTMLSlotElement?e.assignedElements():e.shadowRoot?e.shadowRoot.children:e.children}async focusFirstDescendant(e){await this.updateCompleteIfNecessary(e);let o=this.getChildren(e);for(let n=0;n<o.length;n++){let a=o[n];if(a instanceof HTMLElement&&(this.attemptFocus(a)||await this.focusFirstDescendant(a)))return!0}return!1}async focusLastDescendant(e){await this.updateCompleteIfNecessary(e);let o=this.getChildren(e);for(let n=o.length-1;n>=0;n--){let a=o[n];if(a instanceof HTMLElement&&(this.attemptFocus(a)||await this.focusLastDescendant(a)))return!0}return!1}async updateCompleteIfNecessary(e){e instanceof Q&&await e.updateComplete}isInsideElement(e,o){for(let n=e;n;n=n.parentNode){if(n===o)return!0;n instanceof ShadowRoot?n=n.host:n.assignedSlot&&(n=n.assignedSlot)}return!1}attemptFocus(e){return e===this.firstTrap||e===this.lastTrap||!this.isFocusable(e)?!1:(e.focus(),!0)}isFocusable(e){return!e.checkVisibility()||this.isElementDisabled(e)?!1:e instanceof HTMLAnchorElement?!!e.href&&e.rel!=="ignore":e instanceof HTMLInputElement?e.type!=="hidden":e.tabIndex>=0}isElementDisabled(e){return"disabled"in e&&!!e.disabled}},Wb=Y(Pn);var zs;(function(t){t.sm="sm",t.md="md",t.lg="lg",t.xl="xl"})(zs||(zs={}));var ru={sm:640,md:768,lg:1024,xl:1280},Ln=class extends xt{constructor(e){super(e),this.size=0,this.onResize=()=>{let o=window.innerWidth;this.size!==o&&(this.size=o,this.lastArgs&&this.setValue(this.render(...this.lastArgs)))},this.size=window.innerWidth,window.addEventListener("resize",this.onResize)}disconnected(){window.removeEventListener("resize",this.onResize)}reconnected(){window.addEventListener("resize",this.onResize)}update(e,[o,n,a]){return this.lastArgs=[o,n,a],this.render(o,n,a)}render(e,o,n){let a=this.resolveThreshold(e),i=n??(()=>B);return this.size>a?o():i()}resolveThreshold(e){return typeof e=="number"?e:ru[e]}},Zb=Y(Ln);var kn,Nn,Dn,Fn,ou=navigator.vendor&&!!navigator.vendor.match(/apple/i)||((Dn=(Nn=(kn=window.safari)===null||kn===void 0?void 0:kn.pushNotification)===null||Nn===void 0?void 0:Nn.toString())!==null&&Dn!==void 0?Dn:"")==="[object SafariRemoteNotification]",nu="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;window.ftGlobals=(Fn=window.ftGlobals)!==null&&Fn!==void 0?Fn:{lit:Br,litDecorators:Hr,litRepeat:$r,litClassMap:Gr,litStyleMap:Wr,litUnsafeHTML:jr,wcUtils:{...no,...Kr,...lo,...Cn,...uo,...Yr,...mo,...ro,..._o,...Tn,...Us,...bn,...Po,...ho,...Mo,...On,...Do,...In,...yi,...Qr,...Bo,...go,...Ho,...Bs,...gi,...zo,...yn,...wn,...Lo,...No,...vn,...io,isSafari:ou,isTouchScreen:nu,setVariable:tt}};var Gs;(function(t){t.clusteringHelperCreated="clustering-helper-created",t.mapAttachmentsUpdate="map-attachments-update",t.visibleTopicChange="visible-topic-change",t.requestedTopicNotFound="requested-topic-not-found"})(Gs||(Gs={}));var Ws;(function(t){t.FEEDBACK="FEEDBACK",t.RATING="RATING",t.PRINT="PRINT",t.BOOKMARK="BOOKMARK",t.COLLECTIONS="COLLECTIONS",t.PERSONAL_BOOKS="PERSONAL_BOOKS"})(Ws||(Ws={}));var au=function(t,e,o,n){var a=arguments.length,i=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,o):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,o,n);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(i=(a<3?s(i):a>3?s(e,o,i):s(e,o))||i);return a>3&&i&&Object.defineProperty(e,o,i),i},Un=class extends Event{constructor(){super("register-ft-reader-component",{bubbles:!0,composed:!0})}},Mn=Symbol("registerInterval"),iu=K(Symbol("toFtReaderComponent"),function(t){var e;class o extends t{constructor(){super(...arguments),this[e]=0}setReaderStateManager(a){this.clearStateManager(),this.stateManager=a,this.addStore(a.store,"reader")}clearStateManager(){this.stateManager&&(this.removeStore("reader"),this.stateManager=void 0)}get service(){var a;return(a=this.stateManager)===null||a===void 0?void 0:a.service}connectedCallback(){super.connectedCallback(),this[Mn]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null?window.clearInterval(this[Mn]):this.dispatchEvent(new Un)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return e=Mn,au([ee()],o.prototype,"stateManager",void 0),o}),Ar=class extends iu(Wt){};var su={outlineColor:r.extend("--ft-reader-internal-link-outline-color","",yo.colorPrimary)},js=$`
86
86
  :host {
87
87
  display: contents;
88
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-internal-link",
3
- "version": "2.0.28",
3
+ "version": "2.0.29",
4
4
  "description": "Reader internal link for integrated reader",
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": "2.0.28",
22
+ "@fluid-topics/ft-wc-utils": "2.0.29",
23
23
  "lit": "3.1.0"
24
24
  },
25
- "gitHead": "c81a78f103c19425eb2eac2675a6dd8396e2aa4e"
25
+ "gitHead": "7c6a7af32908ebb8496d98416d21cd37097b991f"
26
26
  }