@fluid-topics/ft-reader-saved-bookmarks 2.0.3 → 2.0.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.
|
@@ -963,7 +963,7 @@ svg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa {
|
|
|
963
963
|
</div>
|
|
964
964
|
</div>
|
|
965
965
|
</div>
|
|
966
|
-
`}setupFor(t){this.eventsTarget!==t&&(this.removeHandlers(),this.eventsTarget=t,this.eventsTarget.addEventListener("
|
|
966
|
+
`}setupFor(t){this.eventsTarget!==t&&(this.removeHandlers(),this.eventsTarget=t,this.eventsTarget.addEventListener("mouseover",this.onHover,{passive:!0}),this.eventsTarget.addEventListener("mouseleave",this.onOut,{passive:!0}),this.eventsTarget.addEventListener("focusin",this.onFocusIn,{passive:!0}),this.eventsTarget.addEventListener("focusout",this.onOut,{passive:!0}),this.eventsTarget.addEventListener("touchstart",this.onTouch,{passive:!0}),this.eventsTarget.addEventListener("click",this.onClick,{passive:!0}))}removeHandlers(){this.eventsTarget&&(this.eventsTarget.removeEventListener("mouseover",this.onHover),this.eventsTarget.removeEventListener("mouseleave",this.onOut),this.eventsTarget.removeEventListener("focusin",this.onFocusIn),this.eventsTarget.removeEventListener("focusout",this.onOut),this.eventsTarget.removeEventListener("touchstart",this.onTouch),this.eventsTarget.removeEventListener("click",this.onClick),this.eventsTarget=void 0)}defaultSetup(){this.container&&this.setupFor(this.container)}updated(t){var o,n;t.has("visible")&&(this.visible?(this.resetTooltipContent(),(o=this.tooltip)===null||o===void 0||o.showPopover()):(n=this.tooltip)===null||n===void 0||n.hidePopover()),super.updated(t)}contentAvailableCallback(t){super.contentAvailableCallback(t),["visible","text"].some(o=>t.has(o))&&this.visible&&this.positionTooltip()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.eventsTarget==null&&this.defaultSetup()})}disconnectedCallback(){super.disconnectedCallback(),this.removeHandlers()}async show(t){this.visible=!0,t!=null&&await this.hideDebounce.run(()=>{this.hide()},t)}async showTemporaryText(t,o){let n=this.manual;this.manual=!0;let a=this.text;this.text={message:t},await this.show(o),this.text=a,this.manual=n}hide(){this.visible=!1}toggle(){this.visible=!this.visible}isVisible(){return this.visible}get slottedElement(){var t;return((t=this.slotNodes)!==null&&t!==void 0?t:[]).filter(o=>o.nodeType==Node.ELEMENT_NODE)[0]}resetTooltipContent(){if(this.tooltip&&this.tooltipContent){let t=this.tooltipContent.style;switch(t.transition="none",this.validPosition){case"top":t.top=this.tooltip.clientHeight+"px",t.left="0";break;case"bottom":t.top=-this.tooltip.clientHeight+"px",t.left="0";break;case"left":t.top="0",t.left=this.tooltip.clientWidth+"px";break;case"right":t.top="0",t.left=-this.tooltip.clientWidth+"px";break}}}positionTooltip(){this.resetTooltipContent(),this.tooltip&&this.slottedElement&&P4(this.slottedElement,this.tooltip,{placement:this.position,strategy:"fixed"}).then(({x:t,y:o})=>{this.tooltip&&(this.tooltip.style.transform=`translate(${t}px,${o}px)`)}),this.revealDebouncer.run(()=>{this.tooltipContent&&(this.tooltipContent.style.transition=`top ${Se.designSystemVariables.transitionDuration}, left ${Se.designSystemVariables.transitionDuration}`,this.tooltipContent.style.top="0",this.tooltipContent.style.left="0")},this.manual?0:this.delay)}isIgnored(t){return this.manual||(0,Se.eventPathContainsMatchingElement)(t,this.ignoreMatchingElements,this.eventsTarget)}};q.elementDefinitions={"ft-typography":Ae};q.styles=a4;Ne([I4()],q.prototype,"text",void 0);Ne([(0,Ce.property)({type:Boolean})],q.prototype,"manual",void 0);Ne([(0,Ce.property)({type:Boolean})],q.prototype,"inline",void 0);Ne([(0,Se.numberProperty)()],q.prototype,"delay",void 0);Ne([(0,Ce.property)()],q.prototype,"position",void 0);Ne([(0,Se.jsonProperty)([])],q.prototype,"ignoreMatchingElements",void 0);Ne([(0,Ce.queryAssignedNodes)()],q.prototype,"slotNodes",void 0);Ne([(0,Ce.query)(".ft-tooltip--container")],q.prototype,"container",void 0);Ne([(0,Ce.query)(".ft-tooltip")],q.prototype,"tooltip",void 0);Ne([(0,Ce.query)(".ft-tooltip--content")],q.prototype,"tooltipContent",void 0);Ne([(0,Ce.state)()],q.prototype,"visible",void 0);var U4=A(D());(0,U4.customElement)("ft-tooltip")(q);var fn=function(e,t,o,n){var a=arguments.length,i=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,o):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(i=(a<3?c(i):a>3?c(t,o,i):c(t,o))||i);return a>3&&i&&Object.defineProperty(t,o,i),i},Ee=class e extends qo(Xr){constructor(){super(),this.name="",this.bookmarks=[],this.remainingTocIdsInBookmarks=[],this.addStore(ne),this.addI18nContext(Fr,o4)}get bookmarksTocIds(){return this.bookmarks.map(t=>t.tocId)}static flattenTocNode(t){let o=[t.tocId];for(let n of t.children)o.push(...this.flattenTocNode(n));return o}static bookmarksFromMap(t,o){var n,a;return(a=(n=t.bookmarks)===null||n===void 0?void 0:n.filter(i=>i.mapId===o.mapId).sort((i,c)=>i.title.localeCompare(c.title)))!==null&&a!==void 0?a:[]}static filterRemainingTocIdsInBookmarks(t,o){var n;return(n=t.toc)===null||n===void 0?void 0:n.map(a=>e.flattenTocNode(a)).flat().filter(a=>o.bookmarksTocIds.indexOf(a)>=0)}render(){return dn.html`
|
|
967
967
|
<div part="container" class="ft-reader-saved-bookmarks">
|
|
968
968
|
<span id="context" class="sr-only">${Fr.messages.bookmarks()}</span>
|
|
969
969
|
<span id="missing-context" class="sr-only">${Fr.messages.bookmarkMissingFromToc()}</span>
|
|
@@ -1043,7 +1043,7 @@ svg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa {
|
|
|
1043
1043
|
</div>
|
|
1044
1044
|
</div>
|
|
1045
1045
|
</div>
|
|
1046
|
-
`}setupFor(t){this.eventsTarget!==t&&(this.removeHandlers(),this.eventsTarget=t,this.eventsTarget.addEventListener("
|
|
1046
|
+
`}setupFor(t){this.eventsTarget!==t&&(this.removeHandlers(),this.eventsTarget=t,this.eventsTarget.addEventListener("mouseover",this.onHover,{passive:!0}),this.eventsTarget.addEventListener("mouseleave",this.onOut,{passive:!0}),this.eventsTarget.addEventListener("focusin",this.onFocusIn,{passive:!0}),this.eventsTarget.addEventListener("focusout",this.onOut,{passive:!0}),this.eventsTarget.addEventListener("touchstart",this.onTouch,{passive:!0}),this.eventsTarget.addEventListener("click",this.onClick,{passive:!0}))}removeHandlers(){this.eventsTarget&&(this.eventsTarget.removeEventListener("mouseover",this.onHover),this.eventsTarget.removeEventListener("mouseleave",this.onOut),this.eventsTarget.removeEventListener("focusin",this.onFocusIn),this.eventsTarget.removeEventListener("focusout",this.onOut),this.eventsTarget.removeEventListener("touchstart",this.onTouch),this.eventsTarget.removeEventListener("click",this.onClick),this.eventsTarget=void 0)}defaultSetup(){this.container&&this.setupFor(this.container)}updated(t){var r,o;t.has("visible")&&(this.visible?(this.resetTooltipContent(),(r=this.tooltip)===null||r===void 0||r.showPopover()):(o=this.tooltip)===null||o===void 0||o.hidePopover()),super.updated(t)}contentAvailableCallback(t){super.contentAvailableCallback(t),["visible","text"].some(r=>t.has(r))&&this.visible&&this.positionTooltip()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.eventsTarget==null&&this.defaultSetup()})}disconnectedCallback(){super.disconnectedCallback(),this.removeHandlers()}async show(t){this.visible=!0,t!=null&&await this.hideDebounce.run(()=>{this.hide()},t)}async showTemporaryText(t,r){let o=this.manual;this.manual=!0;let a=this.text;this.text={message:t},await this.show(r),this.text=a,this.manual=o}hide(){this.visible=!1}toggle(){this.visible=!this.visible}isVisible(){return this.visible}get slottedElement(){var t;return((t=this.slotNodes)!==null&&t!==void 0?t:[]).filter(r=>r.nodeType==Node.ELEMENT_NODE)[0]}resetTooltipContent(){if(this.tooltip&&this.tooltipContent){let t=this.tooltipContent.style;switch(t.transition="none",this.validPosition){case"top":t.top=this.tooltip.clientHeight+"px",t.left="0";break;case"bottom":t.top=-this.tooltip.clientHeight+"px",t.left="0";break;case"left":t.top="0",t.left=this.tooltip.clientWidth+"px";break;case"right":t.top="0",t.left=-this.tooltip.clientWidth+"px";break}}}positionTooltip(){this.resetTooltipContent(),this.tooltip&&this.slottedElement&&di(this.slottedElement,this.tooltip,{placement:this.position,strategy:"fixed"}).then(({x:t,y:r})=>{this.tooltip&&(this.tooltip.style.transform=`translate(${t}px,${r}px)`)}),this.revealDebouncer.run(()=>{this.tooltipContent&&(this.tooltipContent.style.transition=`top ${ee.transitionDuration}, left ${ee.transitionDuration}`,this.tooltipContent.style.top="0",this.tooltipContent.style.left="0")},this.manual?0:this.delay)}isIgnored(t){return this.manual||ba(t,this.ignoreMatchingElements,this.eventsTarget)}};ae.elementDefinitions={"ft-typography":Pe};ae.styles=e4;Ie([t4()],ae.prototype,"text",void 0);Ie([N({type:Boolean})],ae.prototype,"manual",void 0);Ie([N({type:Boolean})],ae.prototype,"inline",void 0);Ie([qo()],ae.prototype,"delay",void 0);Ie([N()],ae.prototype,"position",void 0);Ie([Ce([])],ae.prototype,"ignoreMatchingElements",void 0);Ie([da()],ae.prototype,"slotNodes",void 0);Ie([De(".ft-tooltip--container")],ae.prototype,"container",void 0);Ie([De(".ft-tooltip")],ae.prototype,"tooltip",void 0);Ie([De(".ft-tooltip--content")],ae.prototype,"tooltipContent",void 0);Ie([Y()],ae.prototype,"visible",void 0);se("ft-tooltip")(ae);var Zn=function(e,t,r,o){var a=arguments.length,i=a<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,r):o,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,r,o);else for(var c=e.length-1;c>=0;c--)(s=e[c])&&(i=(a<3?s(i):a>3?s(t,r,i):s(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},we=class e extends Kn(xn){constructor(){super(),this.name="",this.bookmarks=[],this.remainingTocIdsInBookmarks=[],this.addStore(fe),this.addI18nContext(ko,Jd)}get bookmarksTocIds(){return this.bookmarks.map(t=>t.tocId)}static flattenTocNode(t){let r=[t.tocId];for(let o of t.children)r.push(...this.flattenTocNode(o));return r}static bookmarksFromMap(t,r){var o,a;return(a=(o=t.bookmarks)===null||o===void 0?void 0:o.filter(i=>i.mapId===r.mapId).sort((i,s)=>i.title.localeCompare(s.title)))!==null&&a!==void 0?a:[]}static filterRemainingTocIdsInBookmarks(t,r){var o;return(o=t.toc)===null||o===void 0?void 0:o.map(a=>e.flattenTocNode(a)).flat().filter(a=>r.bookmarksTocIds.indexOf(a)>=0)}render(){return Q`
|
|
1047
1047
|
<div part="container" class="ft-reader-saved-bookmarks">
|
|
1048
1048
|
<span id="context" class="sr-only">${ko.messages.bookmarks()}</span>
|
|
1049
1049
|
<span id="missing-context" class="sr-only">${ko.messages.bookmarkMissingFromToc()}</span>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-reader-saved-bookmarks",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Display the list of saved bookmarks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,11 +19,11 @@
|
|
|
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.
|
|
22
|
+
"@fluid-topics/ft-wc-utils": "2.0.4",
|
|
23
23
|
"lit": "3.1.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@fluid-topics/ft-wc-test-utils": "2.0.
|
|
26
|
+
"@fluid-topics/ft-wc-test-utils": "2.0.4"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "bc275bc44bc77b2e5802f2da9e92a0aca4479155"
|
|
29
29
|
}
|