@yongdall/theme 0.4.4 → 0.4.5
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/hooks.mjs +1 -1
- package/hooks.mjs.map +1 -1
- package/index.mjs +25 -25
- package/index.mjs.map +1 -1
- package/package.json +3 -3
- package/theme-base.css +1 -1
- package/theme-base.css.map +1 -1
- package/theme-tabs.css +1 -1
- package/theme-tabs.css.map +1 -1
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Ident as e,Menu as t,Page as n,PageIdent as r,PageSider as i,User as a,application as o,createComputed as s,
|
|
1
|
+
import{Ident as e,Menu as t,Page as n,PageIdent as r,PageSider as i,User as a,application as o,createComputed as s,createFrame as c,createIcon as l,createShowField as u,createState as d,createTick as f,effect as p,flatPermission as m,neverAbortedSignal as h,root as g,runPattern as _,toFileLink as v,toPermissionFilter as y,waitAbortSignal as b,watch as x}from"@yongdall/web";const S=`YongDallTheme`,C=`${S}-activity`,w=document.createElement(`div`);w.classList.add(C);const T=new Map;let E,D=!1;function O(e){D=e}var ee=e=>{let t=document.createElement(`div`);t.classList.add(`${C}-page`);let n=t.appendChild(document.createElement(`a`));n.classList.add(`${C}-title`),n.href=e.href,n.innerText=e.title;let r=t.appendChild(document.createElement(`button`));r.type=`button`,r.classList.add(`${C}-close`),r.addEventListener(`click`,()=>{e.destroy()});let i={button:t,link:n,next:E};E&&(E.last=i),E=i,T.set(e,i),w.insertBefore(t,D?null:w.firstChild),p(()=>{n.innerText=e.title},e.signal),p(()=>{n.href=e.href},e.signal),p(()=>{e.current?t.classList.add(`${C}-current`):t.classList.remove(`${C}-current`)},e.signal),p(()=>{e.loading?t.classList.add(`${C}-loading`):t.classList.remove(`${C}-loading`)},e.signal),p(()=>{e.unsaved?t.classList.add(`${C}-unsaved`):t.classList.remove(`${C}-unsaved`)},e.signal),b(e.signal).then(()=>{let{last:e,next:n}=i;e&&(e.next=n),n&&(n.last=e),E===i&&(E=n),t.remove()})},te=class{#e;#t;#n;#r;#i=[];#a=document.createElement(`table`);#o=this.#a.appendChild(document.createElement(`thead`));#s=this.#o.appendChild(document.createElement(`tr`));#c=this.#a.appendChild(document.createElement(`tbody`));get root(){return this.#a}get createUrl(){return this.#e}set createUrl(e){let t=typeof e==`function`?e:null;this.#e!==t&&(this.#e=t,this.#l())}constructor(e,t){let n=Object.entries(t.fields).filter(([,{type:e}])=>e&&typeof e!=`object`),r=Object.entries(t.fields).filter(([,e])=>e.primary).map(([e])=>e);this.#n=t.labelPattern||``,this.#e=typeof e==`function`?e:null,this.#t=n,this.#r=r;let i=this.#s;i.innerHTML=``,i.appendChild(document.createElement(`th`)).appendChild(document.createTextNode(`#`));for(let[e,t]of n)i.appendChild(document.createElement(`th`)).appendChild(document.createTextNode(t.label||e))}#l(){let e=this.#c;e.innerHTML=``;let t=this.#r,n=this.#n,r=this.#t,i=this.#e;for(let a of this.#i){let o=e.appendChild(document.createElement(`tr`)),s=o.appendChild(document.createElement(`td`)),c=_(n,a)||t.map(e=>a[e]).join(`$`);if(i){let e=s.appendChild(document.createElement(`a`));e.href=i(t.map(e=>a[e]).join(`$`)),e.appendChild(document.createTextNode(c))}else s.appendChild(document.createTextNode(c));for(let[e,t]of r){let n=o.appendChild(document.createElement(`td`)),r=u(e,t,{inline:!0},a);n.appendChild(r.root)}}}setData(e){this.#i=e,this.#l()}destroy(){}},ne=class extends HTMLElement{static formAssociated=!0;#e=document.createElement(`div`);#t=this.attachInternals();constructor(){super();let e=this.attachShadow({mode:`closed`});e.appendChild(document.createElement(`style`)).textContent=`:host {
|
|
2
2
|
display: inline-block;
|
|
3
3
|
color: #000;
|
|
4
4
|
margin: auto;
|
|
@@ -24,7 +24,7 @@ div {
|
|
|
24
24
|
pointer-events: none;
|
|
25
25
|
transform-origin: left;
|
|
26
26
|
}
|
|
27
|
-
`,e.appendChild(this.#e);let t=e=>{if(!(e.buttons&1))return;let{left:t,width:n,top:r,height:i}=this.getBoundingClientRect(),a=e.clientX-t-n/2,o=e.clientY-r-i/2,s=Math.atan2(o,a)/Math.PI*180;this.value=Math.round(s),this.dispatchEvent(new InputEvent(`input`)),this.dispatchEvent(new InputEvent(`change`))};this.addEventListener(`pointerdown`,t),this.addEventListener(`pointermove`,t),this.value=this.getAttribute(`value`)}#n=0;get value(){return this.#n}set value(e){let t=parseInt(String(e));Number.isFinite(t)&&(this.#n=t,this.#e.style.transform=`rotate(${t}deg)`,this.#t.setFormValue(String(t)))}connectedCallback(){this.getAttribute(`tabindex`)===null&&this.setAttribute(`tabindex`,`0`)}};try{customElements.define(`nl-angle`,
|
|
27
|
+
`,e.appendChild(this.#e);let t=e=>{if(!(e.buttons&1))return;let{left:t,width:n,top:r,height:i}=this.getBoundingClientRect(),a=e.clientX-t-n/2,o=e.clientY-r-i/2,s=Math.atan2(o,a)/Math.PI*180;this.value=Math.round(s),this.dispatchEvent(new InputEvent(`input`)),this.dispatchEvent(new InputEvent(`change`))};this.addEventListener(`pointerdown`,t),this.addEventListener(`pointermove`,t),this.value=this.getAttribute(`value`)}#n=0;get value(){return this.#n}set value(e){let t=parseInt(String(e));Number.isFinite(t)&&(this.#n=t,this.#e.style.transform=`rotate(${t}deg)`,this.#t.setFormValue(String(t)))}connectedCallback(){this.getAttribute(`tabindex`)===null&&this.setAttribute(`tabindex`,`0`)}};try{customElements.define(`nl-angle`,ne)}catch{}var re=class extends HTMLElement{static observedAttributes=[`separator`];#e=document.createElement(`style`);#t(e){if(e===null){this.#e.textContent=``;return}let t=`::slotted(*)::after {content: ${JSON.stringify(e)}; }`;this.#e.textContent=t}constructor(){super();let e=this.attachShadow({mode:`closed`});e.appendChild(document.createElement(`style`)).textContent=`::slotted(*)::after {content: var(--nl-breadcrumb-separator, ' / ');}`,e.appendChild(this.#e),e.appendChild(document.createElement(`style`)).textContent=`::slotted(:last-child)::after {content: none}`,e.appendChild(document.createElement(`slot`))}get separator(){return this.getAttribute(`separator`)}set separator(e){e==null?this.removeAttribute(`separator`):this.setAttribute(`separator`,e)}connectedCallback(){this.#t(this.separator)}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`separator`:this.#t(n);break}}};try{customElements.define(`nl-breadcrumb`,re)}catch{}var ie=class extends HTMLElement{static observedAttributes=[`label`,`explain`];get label(){return this.getAttribute(`label`)||``}set label(e){e?this.setAttribute(`label`,e):this.removeAttribute(`label`)}get explain(){return this.getAttribute(`explain`)||``}set explain(e){e?this.setAttribute(`explain`,e):this.removeAttribute(`explain`)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}#e=document.createElement(`div`);#t=document.createElement(`div`);constructor(){super();let e=this.attachShadow({mode:`closed`});e.appendChild(document.createElement(`style`)).textContent=`
|
|
28
28
|
[hidden]{
|
|
29
29
|
display: none!important;
|
|
30
30
|
}
|
|
@@ -91,13 +91,13 @@ div {
|
|
|
91
91
|
display: block;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
`,e.addEventListener(`click`,e=>{this.disabled&&(e.stopPropagation(),e.preventDefault())});let t=e.appendChild(document.createElement(`slot`));t.name=`icon`,t.className=`icon`,t.hidden=!t.assignedNodes().length,t.addEventListener(`slotchange`,e=>{t.hidden=!t.assignedNodes().length});let n=e.appendChild(document.createElement(`div`));n.className=`body`;let r=n.appendChild(this.#e);r.className=`label`;let i=n.appendChild(this.#t);i.setAttribute(`part`,`explain`),i.className=`explain`;let a=e.appendChild(document.createElement(`slot`));a.name=`extra`,a.className=`extra`,a.hidden=!a.assignedNodes().length,a.addEventListener(`slotchange`,e=>{a.hidden=!a.assignedNodes().length});let o=e.appendChild(document.createElement(`div`));o.className=`link`,o.setAttribute(`part`,`link`)}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`label`:this.#e.innerText=n||``;break;case`explain`:this.#t.innerText=n||``;break}}};try{customElements.define(`nl-cell`,
|
|
94
|
+
`,e.addEventListener(`click`,e=>{this.disabled&&(e.stopPropagation(),e.preventDefault())});let t=e.appendChild(document.createElement(`slot`));t.name=`icon`,t.className=`icon`,t.hidden=!t.assignedNodes().length,t.addEventListener(`slotchange`,e=>{t.hidden=!t.assignedNodes().length});let n=e.appendChild(document.createElement(`div`));n.className=`body`;let r=n.appendChild(this.#e);r.className=`label`;let i=n.appendChild(this.#t);i.setAttribute(`part`,`explain`),i.className=`explain`;let a=e.appendChild(document.createElement(`slot`));a.name=`extra`,a.className=`extra`,a.hidden=!a.assignedNodes().length,a.addEventListener(`slotchange`,e=>{a.hidden=!a.assignedNodes().length});let o=e.appendChild(document.createElement(`div`));o.className=`link`,o.setAttribute(`part`,`link`)}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`label`:this.#e.innerText=n||``;break;case`explain`:this.#t.innerText=n||``;break}}};try{customElements.define(`nl-cell`,ie)}catch{}
|
|
95
95
|
/*!
|
|
96
96
|
* 匿龙组件库 @neeloong/components v0.7.0
|
|
97
97
|
* (c) 2023-2024 猛火Fierflame
|
|
98
98
|
* @license MIT
|
|
99
99
|
*/
|
|
100
|
-
const
|
|
100
|
+
const ae=new Set([`vertical-lr`,`vertical-rl`,`sideways-lr`,`sideways-rl`]);function k(e,t,n){n?e.setAttribute(t,``):e.removeAttribute(t)}var oe=class e extends HTMLElement{static observedAttributes=[`accordion`,`disabled`,`open`,`menu`,`animation`,`label`];get nonTrigger(){return this.getAttribute(`non-trigger`)!==null}set nonTrigger(e){k(this,`non-trigger`,e)}get startTrigger(){return this.getAttribute(`start-trigger`)!==null}set startTrigger(e){k(this,`start-trigger`,e)}get accordion(){return this.getAttribute(`accordion`)!==null}set accordion(e){k(this,`accordion`,e)}get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){k(this,`disabled`,e)}get open(){return this.getAttribute(`open`)!==null}set open(e){k(this,`open`,e)}get animation(){return this.getAttribute(`animation`)!==null}set animation(e){k(this,`animation`,e)}get menu(){return this.getAttribute(`menu`)!==null}set menu(e){k(this,`menu`,e)}get label(){return this.getAttribute(`label`)||``}set label(e){e?this.setAttribute(`label`,e):this.removeAttribute(`label`)}#e=(()=>{let e=this.attachShadow({mode:`closed`});return e.appendChild(document.createElement(`style`)).textContent=`
|
|
101
101
|
:host {
|
|
102
102
|
display: block;
|
|
103
103
|
border: 1px solid #666;
|
|
@@ -166,15 +166,15 @@ main {
|
|
|
166
166
|
:host([start-trigger]) header {
|
|
167
167
|
flex-direction: row-reverse;
|
|
168
168
|
}
|
|
169
|
-
`,e})();#t=(()=>{let e=document.createElement(`header`);e.setAttribute(`part`,`header`),this.#e.appendChild(e),e.tabIndex=0;let t=t=>{this.disabled||this.#e.activeElement===e&&this.dispatchEvent(new Event(`beforechange`,{cancelable:!0}))&&(this.open=!this.open,this.dispatchEvent(new Event(`change`)))};return e.addEventListener(`click`,t),e.addEventListener(`keydown`,e=>{(e.code===`Enter`||e.code===`Space`)&&t()}),e})();#n=(()=>{let e=document.createElement(`slot`);return this.#t.appendChild(e),e.className=`label`,e.name=`label`,e})();#r=(()=>{let e=document.createElement(`slot`);return this.#t.appendChild(e),e.name=`trigger`,e.className=`trigger-slot`,e.appendChild(document.createElement(`span`)).className=`trigger`,e})();#i=(()=>{let e=document.createElement(`section`);return e.setAttribute(`part`,`main`),this.#e.appendChild(e),e})();#a=(()=>{let e=document.createElement(`main`);return this.#i.appendChild(e),e.appendChild(document.createElement(`slot`)),e})();#o(){let e=
|
|
169
|
+
`,e})();#t=(()=>{let e=document.createElement(`header`);e.setAttribute(`part`,`header`),this.#e.appendChild(e),e.tabIndex=0;let t=t=>{this.disabled||this.#e.activeElement===e&&this.dispatchEvent(new Event(`beforechange`,{cancelable:!0}))&&(this.open=!this.open,this.dispatchEvent(new Event(`change`)))};return e.addEventListener(`click`,t),e.addEventListener(`keydown`,e=>{(e.code===`Enter`||e.code===`Space`)&&t()}),e})();#n=(()=>{let e=document.createElement(`slot`);return this.#t.appendChild(e),e.className=`label`,e.name=`label`,e})();#r=(()=>{let e=document.createElement(`slot`);return this.#t.appendChild(e),e.name=`trigger`,e.className=`trigger-slot`,e.appendChild(document.createElement(`span`)).className=`trigger`,e})();#i=(()=>{let e=document.createElement(`section`);return e.setAttribute(`part`,`main`),this.#e.appendChild(e),e})();#a=(()=>{let e=document.createElement(`main`);return this.#i.appendChild(e),e.appendChild(document.createElement(`slot`)),e})();#o(){let e=ae.has(getComputedStyle(this).writingMode?.toLowerCase());this.#i.style.blockSize=`${e?this.#a.clientWidth:this.#a.clientHeight}px`}updateSize(){this.#o()}#s=new ResizeObserver(()=>this.#o());connectedCallback(){this.#s.observe(this.#a)}disconnectedCallback(){this.#s.unobserve(this.#a)}adoptedCallback(){}#c(){let t=this.parentElement;if(!t)return;let n=getComputedStyle(t).whiteSpace?.toLowerCase()||``,r=n.startsWith(`pre`)||n===`break-spaces`,i=this;for(;i=i.previousSibling;)if(!(i instanceof Comment)){if(i instanceof Text){let e=i.textContent||``;if(r?e.includes(`
|
|
170
170
|
`):e.replace(/[\s\n ]/g,``))break;continue}if(!(i instanceof e)||!i.accordion)break;i.open=!1}for(i=this;i=i.nextSibling;)if(!(i instanceof Comment)){if(i instanceof Text){let e=i.textContent||``;if(r?e.includes(`
|
|
171
|
-
`):e.replace(/[\s\n ]/g,``))break;continue}if(!(i instanceof e)||!i.accordion)break;i.open=!1}}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`accordion`:if(n===null||!this.open)break;this.#c();break;case`disabled`:n===null?this.#t.tabIndex=0:this.#t.removeAttribute(`tabindex`);break;case`open`:if(!this.accordion||!this.open)break;this.#c();break;case`label`:this.#n.innerText=n||``;break}}};try{customElements.define(`nl-collapse`,
|
|
171
|
+
`):e.replace(/[\s\n ]/g,``))break;continue}if(!(i instanceof e)||!i.accordion)break;i.open=!1}}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`accordion`:if(n===null||!this.open)break;this.#c();break;case`disabled`:n===null?this.#t.tabIndex=0:this.#t.removeAttribute(`tabindex`);break;case`open`:if(!this.accordion||!this.open)break;this.#c();break;case`label`:this.#n.innerText=n||``;break}}};try{customElements.define(`nl-collapse`,oe)}catch{}
|
|
172
172
|
/*!
|
|
173
173
|
* 匿龙组件库 @neeloong/components v0.7.0
|
|
174
174
|
* (c) 2023-2024 猛火Fierflame
|
|
175
175
|
* @license MIT
|
|
176
176
|
*/
|
|
177
|
-
const
|
|
177
|
+
const se=typeof HTMLElement.prototype.showPopover==`function`;let ce=0;function le(e){let t=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),n=document.createElementNS(`http://www.w3.org/2000/svg`,`defs`),r=document.createElementNS(`http://www.w3.org/2000/svg`,`mask`),i=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`),a=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`),o=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`),s=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),c=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`),l=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`),u=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`),d=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`),f=`nl-focus-mask:${ce++}`;return t.appendChild(n),n.appendChild(r),r.setAttribute(`id`,f),r.appendChild(i),i.setAttribute(`x`,`0`),i.setAttribute(`y`,`0`),i.setAttribute(`width`,`100vw`),i.setAttribute(`height`,`100vh`),i.setAttribute(`fill`,`white`),r.appendChild(a),a.setAttribute(`x`,`0`),a.setAttribute(`y`,`0`),a.setAttribute(`width`,`100vw`),a.setAttribute(`height`,`100vh`),a.setAttribute(`fill`,`black`),t.appendChild(o),o.setAttribute(`x`,`0`),o.setAttribute(`y`,`0`),o.setAttribute(`width`,`100%`),o.setAttribute(`height`,`100%`),o.setAttribute(`fill`,`currentcolor`),o.setAttribute(`mask`,`url(#${f})`),t.appendChild(s),s.setAttribute(`pointer-events`,`auto`),s.setAttribute(`fill`,`transparent`),s.appendChild(c),c.setAttribute(`x`,`0`),c.setAttribute(`y`,`0`),c.setAttribute(`width`,`100%`),c.setAttribute(`height`,`100%`),s.appendChild(l),l.setAttribute(`x`,`0`),l.setAttribute(`y`,`0`),l.setAttribute(`width`,`100%`),l.setAttribute(`height`,`100%`),s.appendChild(u),u.setAttribute(`x`,`0`),u.setAttribute(`y`,`0`),u.setAttribute(`width`,`100%`),u.setAttribute(`height`,`100%`),s.appendChild(d),d.setAttribute(`x`,`0`),d.setAttribute(`y`,`0`),d.setAttribute(`width`,`100%`),d.setAttribute(`height`,`100%`),e.appendChild(t),{setRect(e,t,n,r){a.setAttribute(`x`,`${e}`),a.setAttribute(`y`,`${t}`),a.setAttribute(`width`,`${n}`),a.setAttribute(`height`,`${r}`),c.setAttribute(`width`,`${e}`),l.setAttribute(`height`,`${t}`),u.setAttribute(`x`,`${e+n}`),d.setAttribute(`y`,`${t+r}`)}}}var ue=class extends HTMLElement{static observedAttributes=[`hidden`,`target`,`x`,`y`,`width`,`height`];get x(){return parseFloat(this.getAttribute(`x`)||``)||0}set x(e){e&&typeof e==`number`&&Number.isFinite(e)?this.setAttribute(`x`,String(e)):this.removeAttribute(`x`)}get y(){return parseFloat(this.getAttribute(`y`)||``)||0}set y(e){e&&typeof e==`number`&&Number.isFinite(e)?this.setAttribute(`y`,String(e)):this.removeAttribute(`y`)}get width(){return parseFloat(this.getAttribute(`width`)||``)||0}set width(e){e&&typeof e==`number`&&Number.isFinite(e)?this.setAttribute(`width`,String(e)):this.removeAttribute(`width`)}get height(){return parseFloat(this.getAttribute(`height`)||``)||0}set height(e){e&&typeof e==`number`&&Number.isFinite(e)?this.setAttribute(`height`,String(e)):this.removeAttribute(`height`)}get target(){return this.getAttribute(`target`)}set target(e){typeof e==`string`?this.setAttribute(`target`,e):this.removeAttribute(`target`)}#e=(()=>{let e=this.attachShadow({mode:`closed`});return e.appendChild(document.createElement(`style`)).textContent=`
|
|
178
178
|
:host {
|
|
179
179
|
display: contents;
|
|
180
180
|
color: inherit;
|
|
@@ -200,7 +200,7 @@ svg {
|
|
|
200
200
|
inset: 0;
|
|
201
201
|
pointer-events: none;
|
|
202
202
|
}
|
|
203
|
-
`,e})();#t=this.#e.appendChild(document.createElement(`div`));#n=
|
|
203
|
+
`,e})();#t=this.#e.appendChild(document.createElement(`div`));#n=le(this.#t);#r=this.attachInternals();#i=null;get targetElement(){return this.#i}set targetElement(e){this.#i=e instanceof Element?e:null}#a=!1;#o=!1;#s(){this.#a&&=(this.#t.removeAttribute(`popover`),!1)}#c(){if(!(this.#a||!this.#o)){if(se){let e=this.#t;e.popover=`manual`,e.showPopover()}this.update(),this.#a=!0}}#l(){let e=this.#i;if(e)return e;let{target:t}=this;if(t===``)return this.parentElement;if(!t)return null;try{return document.querySelector(t)}catch{}return null}update(){if(!this.#o)return;let{left:e,top:t,width:n,height:r}=this.#l()?.getBoundingClientRect()||{top:this.y,left:this.x,width:this.width,height:this.height};this.#n.setRect(e,t,n,r)}connectedCallback(){this.#o=!0,!this.hidden&&this.#c()}disconnectedCallback(){this.#o=!1}attributeChangedCallback(e,t,n){if(this.#o&&t!==n)switch(e){case`hidden`:n===null?this.#c():this.#s();break;case`target`:case`x`:case`y`:case`width`:case`height`:this.update();break}}};try{customElements.define(`nl-focus`,ue)}catch{}var de=class extends HTMLElement{static observedAttributes=[`radius`,`unit`];get radius(){let e=parseFloat(this.getAttribute(`radius`)||``);return Number.isNaN(e)||!Number.isFinite(e)?0:e<0?-1:e}set radius(e){typeof e!=`number`||!Number.isFinite(e)?this.removeAttribute(`radius`):this.setAttribute(`radius`,e<0?`-1`:String(e))}get unit(){return this.getAttribute(`unit`)||`px`}set unit(e){e?this.setAttribute(`unit`,e):this.removeAttribute(`unit`)}get long(){return this.hasAttribute(`nl-long`)}set long(e){e?this.setAttribute(`nl-long`,``):this.removeAttribute(`nl-long`)}get column(){return this.hasAttribute(`column`)}set column(e){e?this.setAttribute(`column`,``):this.removeAttribute(`column`)}#e=document.createElement(`style`);constructor(){super();let e=this.attachShadow({mode:`closed`});e.appendChild(document.createElement(`style`)).textContent=`
|
|
204
204
|
:host {
|
|
205
205
|
display: inline-flex;
|
|
206
206
|
flex-direction: row;
|
|
@@ -243,13 +243,13 @@ slot {
|
|
|
243
243
|
::slotted([nl-long]) {
|
|
244
244
|
flex: 100000;
|
|
245
245
|
}
|
|
246
|
-
`,e.appendChild(this.#e),e.appendChild(document.createElement(`slot`)),this.#t()}#t(){let{radius:e}=this,t=e>=0?`${e}${this.unit}`:`50%`;this.#e.textContent=`:host {border-radius: var(--nl-group-radius, ${t})}`}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`radius`:case`unit`:this.#t();break}}};try{customElements.define(`nl-group`,
|
|
246
|
+
`,e.appendChild(this.#e),e.appendChild(document.createElement(`slot`)),this.#t()}#t(){let{radius:e}=this,t=e>=0?`${e}${this.unit}`:`50%`;this.#e.textContent=`:host {border-radius: var(--nl-group-radius, ${t})}`}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`radius`:case`unit`:this.#t();break}}};try{customElements.define(`nl-group`,de)}catch{}
|
|
247
247
|
/*!
|
|
248
248
|
* 匿龙组件库 @neeloong/components v0.7.0
|
|
249
249
|
* (c) 2023-2024 猛火Fierflame
|
|
250
250
|
* @license MIT
|
|
251
251
|
*/
|
|
252
|
-
const
|
|
252
|
+
const fe=new Set;document.addEventListener(`pointerdown`,e=>{if(!e.isPrimary)return;let t=new Set(e.composedPath());for(let e of[...fe])t.has(e)||e.close()});const pe=new Set([`vertical-lr`,`vertical-rl`,`sideways-lr`,`sideways-rl`]),me=typeof HTMLElement.prototype.showPopover==`function`;function he({left:e,top:t,width:n,height:r},i,a,o){let s=window.innerWidth-e-n,c=window.innerHeight-t-r,l=[[e,n,s],[t,r,c]];return i&&l.reverse(),a&&l[1].reverse(),o&&l[0].reverse(),l}const ge=[`blockEnd`,`blockStart`,`inlineEnd`,`inlineStart`],_e=[`start`,`end`,`center`],ve=[`inlineEnd`,`inlineStart`],ye=[`start`,`end`];function be(e){let t=[];function n(e){t.includes(e)||t.push(e)}for(let t of(e||``).replace(/\n|\s|-/g,``).toLowerCase().split(/,/))(t===`inlineend`||t===`inline`)&&n(`inlineEnd`),(t===`inlinestart`||t===`inline`)&&n(`inlineStart`),(t===`blockend`||t===`block`)&&n(`blockEnd`),(t===`blockstart`||t===`block`)&&n(`blockStart`);return t.length?t:ge}function xe(e){let t=[];for(let n of(e||``).replace(/\n|\s|-/g,``).toLowerCase().split(/,/))[`start`,`end`,`center`].includes(n)&&(t.includes(n)||t.push(n));return t.length?t:_e}function Se(e){let t=getComputedStyle(e),n=t.writingMode?.toLowerCase();return[pe.has(n),[`vertical-rl`,`sideways-rl`].includes(n),t.direction.toLowerCase()===`rtl`!=(n===`sideways-lr`)]}var Ce=class e extends HTMLElement{static observedAttributes=[`open`,`hidden`,`target`,`x`,`y`,`direction`,`align`,`mask`,`disabled`];close(){this.removeAttribute(`open`)}show(){this.setAttribute(`open`,``)}get open(){return this.hasAttribute(`open`)}set open(e){e?this.show():this.close()}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}get mask(){return this.hasAttribute(`mask`)}set mask(e){e?this.setAttribute(`mask`,``):this.removeAttribute(`mask`)}get x(){return parseFloat(this.getAttribute(`x`)||``)||0}set x(e){e&&typeof e==`number`&&Number.isFinite(e)?this.setAttribute(`x`,String(e)):this.removeAttribute(`x`)}get y(){return parseFloat(this.getAttribute(`y`)||``)||0}set y(e){e&&typeof e==`number`&&Number.isFinite(e)?this.setAttribute(`y`,String(e)):this.removeAttribute(`y`)}get target(){return this.getAttribute(`target`)}set target(e){typeof e==`string`?this.setAttribute(`target`,e):this.removeAttribute(`target`)}#e=ge;#t=_e;get direction(){return[...this.#e]}set direction(e){let t=Array.isArray(e)?e.filter(Boolean).join(`,`):e;t!==null&&typeof t!=`string`||(t?this.setAttribute(`direction`,t):this.removeAttribute(`direction`))}get align(){return[...this.#t]}set align(e){let t=Array.isArray(e)?e.filter(Boolean).join(`,`):e;t!==null&&typeof t!=`string`||(t?this.setAttribute(`direction`,t):this.removeAttribute(`direction`))}#n=document.createElement(`div`);#r=document.createElement(`dialog`);#i=this.attachInternals();#a=this;constructor(){super();let e=this.attachShadow({mode:`closed`});e.appendChild(document.createElement(`style`)).textContent=`
|
|
253
253
|
:host {
|
|
254
254
|
display: contents;
|
|
255
255
|
}
|
|
@@ -303,13 +303,13 @@ div.open, div:hover, div:focus, dialog ::slotted(:hover), dialog ::slotted(:focu
|
|
|
303
303
|
dialog::backdrop {
|
|
304
304
|
background: transparent;
|
|
305
305
|
}
|
|
306
|
-
`;let t=e.appendChild(this.#n);t.appendChild(document.createElement(`slot`)).name=`label`,t.addEventListener(`pointerenter`,e=>{this.#u&&e.isPrimary&&this.#f()}),t.addEventListener(`click`,e=>{e.stopPropagation()});let n=e.appendChild(this.#r);n.setAttribute(`part`,`menu`);let r=n.appendChild(document.createElement(`slot`));n.addEventListener(`click`,e=>{if(this.#u)return;let t=e.composedPath(),r=t.indexOf(n);r>=0&&t.slice(0,r).find(e=>e instanceof Element&&e.getAttribute(`disabled`)!==null||e instanceof HTMLHRElement)||this.close()}),n.addEventListener(`close`,e=>{this.close()}),r.addEventListener(`pointermove`,e=>{if(!e.isPrimary)return;let t=this.#l;t&&(e.composedPath().includes(t)||t.#d())}),n.addEventListener(`scroll`,e=>{if(!this.#c)return;let t=this.#l;t&&t.#_()}),this.addEventListener(`contextmenu`,e=>{e.stopPropagation(),e.preventDefault()},{capture:!0})}#o=null;get targetElement(){return this.#o}set targetElement(e){this.#o=e instanceof Element?e:null}#s=!1;#c=!1;#l=null;#u=null;get parentMenu(){return this.#u}#d(){if(!this.#s)return;let e=this.#l;e&&e.#d();let t=this.#u;t&&t.#l===this?t.#l=null:
|
|
306
|
+
`;let t=e.appendChild(this.#n);t.appendChild(document.createElement(`slot`)).name=`label`,t.addEventListener(`pointerenter`,e=>{this.#u&&e.isPrimary&&this.#f()}),t.addEventListener(`click`,e=>{e.stopPropagation()});let n=e.appendChild(this.#r);n.setAttribute(`part`,`menu`);let r=n.appendChild(document.createElement(`slot`));n.addEventListener(`click`,e=>{if(this.#u)return;let t=e.composedPath(),r=t.indexOf(n);r>=0&&t.slice(0,r).find(e=>e instanceof Element&&e.getAttribute(`disabled`)!==null||e instanceof HTMLHRElement)||this.close()}),n.addEventListener(`close`,e=>{this.close()}),r.addEventListener(`pointermove`,e=>{if(!e.isPrimary)return;let t=this.#l;t&&(e.composedPath().includes(t)||t.#d())}),n.addEventListener(`scroll`,e=>{if(!this.#c)return;let t=this.#l;t&&t.#_()}),this.addEventListener(`contextmenu`,e=>{e.stopPropagation(),e.preventDefault()},{capture:!0})}#o=null;get targetElement(){return this.#o}set targetElement(e){this.#o=e instanceof Element?e:null}#s=!1;#c=!1;#l=null;#u=null;get parentMenu(){return this.#u}#d(){if(!this.#s)return;let e=this.#l;e&&e.#d();let t=this.#u;t&&t.#l===this?t.#l=null:fe.delete(this);let n=this.#r;n.close(),this.#i.states?.delete(`--open`),this.#n.classList.remove(`open`),n.removeAttribute(`popover`),this.#s=!1}#f(){if(this.#s||!this.#c)return;let e=this.#u,t=this.#r;if(e){if(!e.#s||this.disabled)return;let n=e.#l;n&&n.#d(),e.#l=this,me?(t.popover=`manual`,t.showPopover()):t.show()}else{this.#v();let e=this.#l;e&&e.#d(),me&&!this.hasAttribute(`mask`)?(t.popover=`manual`,t.showPopover(),fe.add(this)):t.showModal()}this.#n.classList.add(`open`),this.#i.states?.add(`--open`),requestAnimationFrame(()=>{this.#c&&this.#_()}),this.#s=!0}#p=!1;#m=!1;#h=!1;#g(){if(this.#u)return this.#n;let e=this.#o;if(e)return e;let{target:t}=this;if(t===``)return this.parentElement;if(!t)return null;try{return document.querySelector(t)}catch{}return null}#_(){if(!this.#c)return;let e=this.#r,t=this.#g(),n=this.#a,r=n.#p,i=he(t?.getBoundingClientRect()||{top:this.y,left:this.x,width:0,height:0},n.#p,n.#m,n.#h),[[a,o,s],[c,l,u]]=i,[d,f]=this.#u?[ve,ye]:[this.#e,this.#t],p=e.getBoundingClientRect(),m=r?p.height:p.width,h=r?p.width:p.height,[g]=d.map(e=>{switch(e){case`blockStart`:return[e,c/h,1];case`blockEnd`:return[e,u/h,1];case`inlineStart`:return[e,1,a/m];default:return[`inlineEnd`,1,s/m]}}).reduce((e,t)=>e[1]<1&&t[1]<1?e[1]>=t[1]?e:t:e[1]>=1&&t[1]<1?e:t[1]>=1&&e[1]<1?t:e[2]>=1||e[2]>=t[2]?e:t),_=g===`blockEnd`||g===`blockStart`;_&&i.reverse();let[[v,y,b],[x,S,C]]=i,[w,T]=_?[m,h]:[h,m],E=f.find(e=>e===`start`?S+C>w:e===`end`?S+x>w:!0)||``,D=g===`inlineStart`||g===`blockStart`?v-T:v+y,O=0;switch(E){case`start`:O=x;break;case`end`:O=x+S-w;break;default:O=Math.max(18,Math.min(x+S/2-w/2,x+S+C-18-w));break}_&&([D,O]=[O,D]),e.style.insetBlockStart=`${O}px`,e.style.insetInlineStart=`${D}px`;let ee=this.#l;ee&&ee.#_()}update(){if(this.#c)return this.#_()}#v(){let[e,t,n]=Se(this);this.#p=e,this.#m=t,this.#h=n}connectedCallback(){this.#c=!0;let t=this.parentNode,n=t instanceof e?t:null;this.#u=n,this.#a=n?n.#a:this,this.#n.hidden=!n,!this.hidden&&n&&n.#s&&this.#f()}disconnectedCallback(){this.close(),this.#a=this,this.#c=!1,this.#u=null}attributeChangedCallback(e,t,n){if(this.#c&&t!==n)switch(e){case`disabled`:this.#c&&this.open&&n!==null&&this.close();break;case`open`:!this.#u&&!this.hidden&&(n===null?this.#d():this.#f());break;case`mask`:if(n!==null){let e=this.#r;e.getAttribute(`popover`)!==null&&(e.removeAttribute(`popover`),this.close())}break;case`hidden`:n===null?this.open&&!this.#u&&this.#f():this.#d();break;case`direction`:this.#e=be(n),this.#c&&!this.#u&&this.#_();break;case`align`:this.#t=xe(n),this.#c&&!this.#u&&this.#_();break;case`target`:case`x`:case`y`:this.#c&&!this.#u&&this.#_();break}}};try{customElements.define(`nl-menu`,Ce)}catch{}
|
|
307
307
|
/*!
|
|
308
308
|
* 匿龙组件库 @neeloong/components v0.7.0
|
|
309
309
|
* (c) 2023-2024 猛火Fierflame
|
|
310
310
|
* @license MIT
|
|
311
311
|
*/
|
|
312
|
-
const
|
|
312
|
+
const A=[];function we(e){let t=getComputedStyle(e).writingMode?.toLowerCase();return[`vertical-lr`,`sideways-lr`].includes(t)?1:[`vertical-rl`,`sideways-rl`].includes(t)?2:0}function Te(){let e=[0,0,0,0];for(let{element:t}of A){let n=we(t),r=t.classList.contains(`open`);r&&(e[n]+=20),t.style.insetBlockStart=`${e[n]}px`,r&&(e[n]+=n%3?t.clientWidth:t.clientHeight)}}const Ee=new ResizeObserver(function(){Te()});var De=class extends HTMLElement{static observedAttributes=[`open`,`hidden`,`duration`];get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get closable(){return this.hasAttribute(`closable`)}set closable(e){e?this.setAttribute(`closable`,``):this.removeAttribute(`closable`)}get duration(){let e=parseFloat(this.getAttribute(`duration`)||``);return Number.isNaN(e)?1.5:e<=0?1/0:Number.isFinite(e)?e:1.5}set duration(e){typeof e!=`number`||!Number.isFinite(e)?this.removeAttribute(`duration`):e<=0||!Number.isFinite(e)?this.setAttribute(`duration`,`0`):this.setAttribute(`duration`,String(e))}#e=document.createElement(`style`);#t=document.createElement(`section`);#n={element:this.#t};#r=!1;#i=null;#a=this.attachInternals();constructor(){super();let e=this.attachShadow({mode:`closed`});e.appendChild(document.createElement(`style`)).textContent=`
|
|
313
313
|
:host {
|
|
314
314
|
transition-property: none;
|
|
315
315
|
transition-duration: .5s;
|
|
@@ -390,7 +390,7 @@ slot {
|
|
|
390
390
|
transform: rotate(-45deg);
|
|
391
391
|
}
|
|
392
392
|
|
|
393
|
-
`,e.appendChild(this.#e);let t=e.appendChild(this.#t);t.popover=`manual`,t.setAttribute(`part`,`message`),t.appendChild(document.createElement(`slot`)).setAttribute(`part`,`slot`);let n=t.appendChild(document.createElement(`div`));n.className=`close`,n.addEventListener(`click`,e=>{this.#o(e)}),n.setAttribute(`part`,`close`),n.tabIndex=0,n.addEventListener(`keydown`,e=>{[`Enter`,`Space`].includes(e.code)&&this.#o(e)}),t.addEventListener(`transitionend`,e=>{e.propertyName===`opacity`&&(t.classList.contains(`open`)||this.#p())})}#o(e){e?.defaultPrevented||this.open&&this.dispatchEvent(new Event(`beforeclose`,{cancelable:!0}))&&(this.open=!1,this.dispatchEvent(new Event(`close`)))}#s=!1;#c(){let e=this.#i;e!==null&&(clearTimeout(e),this.#i=null)}#l(){this.#c();let{duration:e}=this;e!==1/0&&(this.#i=setTimeout(()=>{this.#i=null,this.open=!1},e*1e3))}#u(){if(this.#s)return;this.#s=!0;let e=0,t=
|
|
393
|
+
`,e.appendChild(this.#e);let t=e.appendChild(this.#t);t.popover=`manual`,t.setAttribute(`part`,`message`),t.appendChild(document.createElement(`slot`)).setAttribute(`part`,`slot`);let n=t.appendChild(document.createElement(`div`));n.className=`close`,n.addEventListener(`click`,e=>{this.#o(e)}),n.setAttribute(`part`,`close`),n.tabIndex=0,n.addEventListener(`keydown`,e=>{[`Enter`,`Space`].includes(e.code)&&this.#o(e)}),t.addEventListener(`transitionend`,e=>{e.propertyName===`opacity`&&(t.classList.contains(`open`)||this.#p())})}#o(e){e?.defaultPrevented||this.open&&this.dispatchEvent(new Event(`beforeclose`,{cancelable:!0}))&&(this.open=!1,this.dispatchEvent(new Event(`close`)))}#s=!1;#c(){let e=this.#i;e!==null&&(clearTimeout(e),this.#i=null)}#l(){this.#c();let{duration:e}=this;e!==1/0&&(this.#i=setTimeout(()=>{this.#i=null,this.open=!1},e*1e3))}#u(){if(this.#s)return;this.#s=!0;let e=0,t=we(this.#t);for(let{element:n}of A)n.classList.contains(`open`)&&we(n)===t&&(e+=(t%3?n.clientWidth:n.clientHeight)+20);let n=this.#t;n.style.insetBlockStart=`${e}px`,n.showPopover?.(),n.classList.add(`shown`),this.#a.states?.add(`--shown`),n.setAttribute(`part`,`message shown`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.#s&&n.classList.contains(`shown`)&&(n.classList.add(`open`),this.#a.states?.add(`--open`),this.#l(),Ee.observe(n),A.push(this.#n),Te())})})}#d(){let e=A.indexOf(this.#n);e<0||(A.splice(e,1),!(e>=A.length)&&Te())}#f(){if(!this.#s)return;this.#s=!1,this.#c();let e=this.#t;e.classList.remove(`open`),this.#a.states?.delete(`--open`),Ee.unobserve(e),Te()}#p(){this.#d();let e=this.#t;e.hidePopover?.(),this.#a.states?.delete(`--shown`),e.classList.remove(`shown`),e.setAttribute(`part`,`message`)}connectedCallback(){this.#r=!0,!this.hidden&&this.open&&this.#u()}disconnectedCallback(){this.#r=!1,this.#f(),this.#p()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`hidden`:case`open`:this.#r&&(!this.hidden&&this.open?this.#u():this.#f());break;case`duration`:this.#l();break}}};try{customElements.define(`nl-message`,De)}catch{}function j(e,t,n){n?e.setAttribute(t,``):e.removeAttribute(t)}var Oe=class extends HTMLElement{static observedAttributes=[`hidden`,`open`,`disabled`,`size`,`position`];get open(){return this.hasAttribute(`open`)}set open(e){j(this,`open`,e)}get cancelable(){return this.hasAttribute(`cancelable`)}set cancelable(e){j(this,`cancelable`,e)}get closable(){return this.hasAttribute(`closable`)}set closable(e){j(this,`closable`,e)}get mask(){return this.hasAttribute(`mask`)}set mask(e){j(this,`mask`,e)}get maskClosable(){return this.hasAttribute(`mask-closable`)}set maskClosable(e){j(this,`mask-closable`,e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){j(this,`disabled`,e)}get size(){return this.getAttribute(`size`)||``}set size(e){e?this.setAttribute(`size`,e):this.removeAttribute(`size`)}get position(){let e=this.getAttribute(`position`)||``;return[`block-start`,`block-end`,`inline-start`,`inline-end`].includes(e)?e:`center`}set position(e){e?this.setAttribute(`position`,e):this.removeAttribute(`position`)}cancel(){this.disabled||this.open&&this.dispatchEvent(new Event(`cancel`,{cancelable:!0}))&&(this.open=!1,this.dispatchEvent(new Event(`close`)))}ok(){this.disabled||this.open&&this.dispatchEvent(new Event(`ok`,{cancelable:!0}))&&(this.open=!1,this.dispatchEvent(new Event(`close`)))}#e=document.createElement(`section`);#t=document.createElement(`dialog`);#n=document.createElement(`button`);#r=document.createElement(`button`);constructor(){super();let e=()=>this.cancel(),t=this.attachShadow({mode:`closed`});t.appendChild(document.createElement(`style`)).textContent=`
|
|
394
394
|
:host {
|
|
395
395
|
display: none;
|
|
396
396
|
}
|
|
@@ -588,20 +588,20 @@ footer {
|
|
|
588
588
|
border-end-end-radius: inherit;
|
|
589
589
|
}
|
|
590
590
|
|
|
591
|
-
`,this.#t.autofocus=!1;let n=t.appendChild(this.#t);n.className=`center`,n.addEventListener(`keydown`,t=>{t.defaultPrevented||t.code===`Escape`&&(t.preventDefault(),e())}),n.addEventListener(`click`,t=>{t.target===t.currentTarget&&this.maskClosable&&e()});let r=n.appendChild(this.#e);r.style.inlineSize=this.getAttribute(`size`)||``;let i=r.appendChild(document.createElement(`header`)),a=i.appendChild(document.createElement(`slot`));a.name=`header`,a.addEventListener(`slotchange`,e=>{a.assignedNodes().length?i.classList.remove(`empty`):i.classList.add(`empty`)}),a.assignedNodes().length?i.classList.remove(`empty`):i.classList.add(`empty`);let o=i.appendChild(document.createElement(`slot`));o.className=`close`,o.name=`close`,o.addEventListener(`click`,e),o.addEventListener(`slotchange`,e=>{o.assignedNodes().length?o.classList.remove(`close-icon`):o.classList.add(`close-icon`)}),o.assignedNodes().length?o.classList.remove(`close-icon`):o.classList.add(`close-icon`),r.appendChild(document.createElement(`slot`)).className=`body`;let s=r.appendChild(document.createElement(`footer`)).appendChild(document.createElement(`slot`));s.name=`footer`;let{disabled:c}=this,l=s.appendChild(this.#n);l.addEventListener(`click`,()=>this.ok()),l.className=`ok`,l.disabled=c;let u=s.appendChild(this.#r);u.addEventListener(`click`,e),u.className=`cancel`,u.disabled=c}#i=!1;connectedCallback(){this.#i=!0,!this.hidden&&this.open&&this.#t.showModal()}disconnectedCallback(){this.#i=!1,this.#t.close()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`hidden`:case`open`:this.#i&&(!this.hidden&&this.open?this.#t.showModal():this.#t.close());break;case`disabled`:{let e=n!==null;this.#r.disabled=e,this.#n.disabled=e;break}case`position`:{let{size:e}=this,t=this.#e,r=this.#t;switch(n){case`block-start`:case`block-end`:t.style.inlineSize=``,t.style.blockSize=e,r.className=n;break;case`inline-start`:case`inline-end`:t.style.inlineSize=e,t.style.blockSize=``,r.className=n;break;default:t.style.inlineSize=e,t.style.blockSize=``,r.className=`center`}break}case`size`:this.position.startsWith(`block`)?this.#e.style.blockSize=n||``:this.#e.style.inlineSize=n||``;break}}};try{customElements.define(`nl-modal`,
|
|
591
|
+
`,this.#t.autofocus=!1;let n=t.appendChild(this.#t);n.className=`center`,n.addEventListener(`keydown`,t=>{t.defaultPrevented||t.code===`Escape`&&(t.preventDefault(),e())}),n.addEventListener(`click`,t=>{t.target===t.currentTarget&&this.maskClosable&&e()});let r=n.appendChild(this.#e);r.style.inlineSize=this.getAttribute(`size`)||``;let i=r.appendChild(document.createElement(`header`)),a=i.appendChild(document.createElement(`slot`));a.name=`header`,a.addEventListener(`slotchange`,e=>{a.assignedNodes().length?i.classList.remove(`empty`):i.classList.add(`empty`)}),a.assignedNodes().length?i.classList.remove(`empty`):i.classList.add(`empty`);let o=i.appendChild(document.createElement(`slot`));o.className=`close`,o.name=`close`,o.addEventListener(`click`,e),o.addEventListener(`slotchange`,e=>{o.assignedNodes().length?o.classList.remove(`close-icon`):o.classList.add(`close-icon`)}),o.assignedNodes().length?o.classList.remove(`close-icon`):o.classList.add(`close-icon`),r.appendChild(document.createElement(`slot`)).className=`body`;let s=r.appendChild(document.createElement(`footer`)).appendChild(document.createElement(`slot`));s.name=`footer`;let{disabled:c}=this,l=s.appendChild(this.#n);l.addEventListener(`click`,()=>this.ok()),l.className=`ok`,l.disabled=c;let u=s.appendChild(this.#r);u.addEventListener(`click`,e),u.className=`cancel`,u.disabled=c}#i=!1;connectedCallback(){this.#i=!0,!this.hidden&&this.open&&this.#t.showModal()}disconnectedCallback(){this.#i=!1,this.#t.close()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`hidden`:case`open`:this.#i&&(!this.hidden&&this.open?this.#t.showModal():this.#t.close());break;case`disabled`:{let e=n!==null;this.#r.disabled=e,this.#n.disabled=e;break}case`position`:{let{size:e}=this,t=this.#e,r=this.#t;switch(n){case`block-start`:case`block-end`:t.style.inlineSize=``,t.style.blockSize=e,r.className=n;break;case`inline-start`:case`inline-end`:t.style.inlineSize=e,t.style.blockSize=``,r.className=n;break;default:t.style.inlineSize=e,t.style.blockSize=``,r.className=`center`}break}case`size`:this.position.startsWith(`block`)?this.#e.style.blockSize=n||``:this.#e.style.inlineSize=n||``;break}}};try{customElements.define(`nl-modal`,Oe)}catch{}function ke(e,t){let n=e.attachShadow({mode:`closed`});n.appendChild(document.createElement(`style`)).textContent=`:host {
|
|
592
592
|
display: block;
|
|
593
593
|
overflow: hidden;
|
|
594
594
|
position: relative;
|
|
595
595
|
}
|
|
596
|
-
:host([hidden]) { display: none; }`,n.appendChild(document.createElement(`slot`));let r=new ResizeObserver(e=>{let n=e.pop();if(!n)return;let{contentRect:{width:r,height:i}}=n;for(let e of t)e.resize(r,i)});function i(n){let r=n.composedPath(),i=r.findIndex(t=>t===e),a=i<0?[]:r.slice(0,i).reverse();for(let e of[...t]){let t=e.match(a);if(t)return e;if(t===null)return null}return null}let a={};function o(t){let n=i(t);if(!n)return;let{pageX:r,pageY:o,pointerId:s}=t,{x:c,y:l}=e.getBoundingClientRect(),u=r-c,d=o-l,f=null;t.pointerType===`mouse`?f=n.mouseBegin(u,d,t.buttons):t.pointerType===`touch`&&(f=n.touchBegin(s,u,d)),typeof f==`boolean`&&(f&&e.setPointerCapture(s),a[s]=n)}function s(t){let{pointerId:n}=t,r=a[n];if(!r)return;let{pageX:i,pageY:o}=t,{x:s,y:c}=e.getBoundingClientRect(),l=i-s,u=o-c;if(t.pointerType===`mouse`){r?.mouseMove(l,u,t.buttons);return}t.pointerType===`touch`&&r.touchMove(n,l,u)}function c(t){let{pointerId:n}=t;e.hasPointerCapture(n)&&e.releasePointerCapture(n);let r=a[n];r&&(t.pointerType===`mouse`&&r.mouseEnd(),t.pointerType===`touch`&&(delete a[n],r.touchEnd(n)))}function l(t){let n=i(t);if(!n)return;let{deltaMode:r,deltaX:a,deltaY:o,pageX:s,pageY:c}=t,{x:l,y:u}=e.getBoundingClientRect(),d=s-l,f=c-u;n.wheel(r,a,o,d,f)}return e.addEventListener(`wheel`,l,!0),e.addEventListener(`pointermove`,s),e.addEventListener(`pointerdown`,o),e.addEventListener(`pointerup`,c),e.addEventListener(`pointercancel`,c),e.addEventListener(`lostpointercapture`,c),e.addEventListener(`touchmove`,e=>e.preventDefault()),[()=>{r.observe(e)},()=>{r.unobserve(e)}]}var
|
|
596
|
+
:host([hidden]) { display: none; }`,n.appendChild(document.createElement(`slot`));let r=new ResizeObserver(e=>{let n=e.pop();if(!n)return;let{contentRect:{width:r,height:i}}=n;for(let e of t)e.resize(r,i)});function i(n){let r=n.composedPath(),i=r.findIndex(t=>t===e),a=i<0?[]:r.slice(0,i).reverse();for(let e of[...t]){let t=e.match(a);if(t)return e;if(t===null)return null}return null}let a={};function o(t){let n=i(t);if(!n)return;let{pageX:r,pageY:o,pointerId:s}=t,{x:c,y:l}=e.getBoundingClientRect(),u=r-c,d=o-l,f=null;t.pointerType===`mouse`?f=n.mouseBegin(u,d,t.buttons):t.pointerType===`touch`&&(f=n.touchBegin(s,u,d)),typeof f==`boolean`&&(f&&e.setPointerCapture(s),a[s]=n)}function s(t){let{pointerId:n}=t,r=a[n];if(!r)return;let{pageX:i,pageY:o}=t,{x:s,y:c}=e.getBoundingClientRect(),l=i-s,u=o-c;if(t.pointerType===`mouse`){r?.mouseMove(l,u,t.buttons);return}t.pointerType===`touch`&&r.touchMove(n,l,u)}function c(t){let{pointerId:n}=t;e.hasPointerCapture(n)&&e.releasePointerCapture(n);let r=a[n];r&&(t.pointerType===`mouse`&&r.mouseEnd(),t.pointerType===`touch`&&(delete a[n],r.touchEnd(n)))}function l(t){let n=i(t);if(!n)return;let{deltaMode:r,deltaX:a,deltaY:o,pageX:s,pageY:c}=t,{x:l,y:u}=e.getBoundingClientRect(),d=s-l,f=c-u;n.wheel(r,a,o,d,f)}return e.addEventListener(`wheel`,l,!0),e.addEventListener(`pointermove`,s),e.addEventListener(`pointerdown`,o),e.addEventListener(`pointerup`,c),e.addEventListener(`pointercancel`,c),e.addEventListener(`lostpointercapture`,c),e.addEventListener(`touchmove`,e=>e.preventDefault()),[()=>{r.observe(e)},()=>{r.unobserve(e)}]}var Ae=class extends HTMLElement{#e=new Set;#t;#n;constructor(){super(),[this.#t,this.#n]=ke(this,this.#e)}register(e){let t=this.#e;t.add(e);let{width:n,height:r}=this.getBoundingClientRect();return e.resize(n,r),()=>{t.delete(e)}}connectedCallback(){this.#t()}disconnectedCallback(){this.#n()}adoptedCallback(){}};function je(e,t){let n=e.reduce((e,t)=>e+t)/e.length,r=t.reduce((e,t)=>e+t)/t.length;return e.map((i,a)=>(e[a]-n)*(t[a]-r)).reduce((e,t)=>e+t)/e.map(e=>(e-n)**2).reduce((e,t)=>e+t)}function Me(e){let t=performance.now()/1e3;for(let n=0;n<e.length;n++){let[,,r]=e[n];if(t-r>.05){e.length=n;break}t=r}if(e.length<3)return;let n=e.map(e=>e[2]),r=je(n,e.map(e=>e[0])),i=je(n,e.map(e=>e[1])),a=Math.sign(r),o=Math.sign(i),s=Math.abs(r),c=Math.abs(i),l=(s**2+c**2)**.5,u=s/l,d=c/l,f=1e3,[[p,m,h]]=e;function g(){let e=performance.now()/1e3-h;return l-e*f<=0?[p+a*s*l/f/2,m+o*c*l/f/2,!0]:[p+a*(s+s-f*u*e)*e/2,m+o*(c+c-f*d*e)*e/2,!1]}return g}var Ne=class extends HTMLElement{#e;#t;constructor(){super();let e=()=>{};this.#t=()=>{let t=this.parentNode;for(;t&&!(t instanceof Re);)t=t.parentNode;t&&(e=t.register(this))},this.#e=()=>{e()}}connectedCallback(){this.#t()}disconnectedCallback(){this.#e()}};function Pe(e,t,n,r){return((e-t)**2+(n-r)**2)**.5}function Fe(e,t,n){let r=t-n,i=Math.min(r,0),a=Math.max(r,0);return Math.min(Math.max(i,e),a)}function Ie(e,t){let n=e.attachShadow({mode:`closed`});n.appendChild(document.createElement(`style`)).textContent=`
|
|
597
597
|
:host{display: block; position: absolute; transform-origin: 0 0; }
|
|
598
598
|
:host([hidden]) { display: none; }
|
|
599
|
-
`,n.appendChild(document.createElement(`slot`));let r=!1;function i(){r=!0;let[t,n]=o;!t||!n||(r=!1,l=Math.min(t/e.clientWidth,n/e.clientHeight),s=(t-e.clientWidth*l)/2,c=(n-e.clientHeight*l)/2,e.style.transform=`translate(${s}px,${c}px)scale(${l})`)}let a={},o=[0,0],s=0,c=0,l=1;function u(t){let n=e.clientWidth,r=e.clientHeight,[i,a]=o;if(!i||!a)return t;let s=i/n,c=a/r,l=Math.max(s,c,5),u=Math.min(s,c,.5);return Math.max(u,Math.min(t,l))}let d=``,f;function p(e,t,n,r){let i=
|
|
599
|
+
`,n.appendChild(document.createElement(`slot`));let r=!1;function i(){r=!0;let[t,n]=o;!t||!n||(r=!1,l=Math.min(t/e.clientWidth,n/e.clientHeight),s=(t-e.clientWidth*l)/2,c=(n-e.clientHeight*l)/2,e.style.transform=`translate(${s}px,${c}px)scale(${l})`)}let a={},o=[0,0],s=0,c=0,l=1;function u(t){let n=e.clientWidth,r=e.clientHeight,[i,a]=o;if(!i||!a)return t;let s=i/n,c=a/r,l=Math.max(s,c,5),u=Math.min(s,c,.5);return Math.max(u,Math.min(t,l))}let d=``,f;function p(e,t,n,r){let i=Pe(e,n,t,r),a=l;if(!i||!a){f=void 0;return}f={x:(s-(e+n)/2)/a,y:(c-(t+r)/2)/a,s:a/i}}function m(e,t,n,r){if(!f)return;let i=Pe(e,n,t,r);if(!i)return;let{s:a,x:o,y:d}=f,p=u(i*a);l=p,s=o*p+(e+n)/2,c=d*p+(t+r)/2,T()}function h(){d=``,f=void 0}let g=``,_,v=0;function y(e,t){cancelAnimationFrame(v),_=void 0,_={x:s,y:c,frame:[[s,c,performance.now()/1e3]],bx:e,by:t}}function b(e,t){if(!_)return;let{x:n,y:r,bx:i,by:a}=_;s=n+e-i,c=r+t-a;let o=[s,c,performance.now()/1e3];_.frame=[o,..._.frame].slice(0,20),T()}function x(){if(!_)return;g=``;let{frame:t}=_;if(_=void 0,!e.inertia)return;let n=Me(t);if(!n)return;let r=()=>{let t;[s,c,t]=n(),T(),e.inertia&&(t||(v=requestAnimationFrame(r)))};r()}function S(){cancelAnimationFrame(v),g=``,_=void 0}let C={resize(t,n){o=[t,n],(e.autoAdaptively||r)&&i()},match(n){if(!n.length)return e.global||!1;if(n[0]!==e)return!1;if(!t.size)return!0;let r=new Set(n);for(let e of t)if(r.has(e))return!0;return null},touchMove(t,n,r){a[t]=[n,r];let i=Object.values(a);if(g===`touch`){if(i.length!==1)return S();let[e]=i;b(e[0],e[1])}if(d!==`touch`)return;if(!e.touchScalable||i.length!==2)return h();let[o,s]=i;m(o[0],o[1],s[0],s[1])},touchBegin(t,n,r){a[t]=[n,r];let i=Object.values(a);if(i.length===1){if(!g&&e.touchMovable)return h(),g=`touch`,y(n,r),e.touchCapture}else if(i.length===2&&!d&&e.touchScalable){S(),d=`touch`;let[t,n]=i;return p(t[0],t[1],n[0],n[1]),e.touchCapture}return null},touchEnd(e){delete a[e],d===`touch`&&h(),g===`touch`&&x()},mouseMove(e,t,n){if(g===`leftMouse`&&!(n&1)||g===`roller`&&!(n&4)){x();return}g&&b(e,t)},mouseBegin(t,n,r){if(g)return null;let i=``,a=null;if(r&1){if(!e.leftMouseMovable)return null;i=`leftMouse`,a=e.leftMouseMovableCapture}else if(r&4){if(!e.rollerMovable)return null;i=`roller`,a=e.rollerMovableCapture}return h(),g=i,y(t,n),a},mouseEnd(){g&&x()},wheel(t,n,r,i,a){if(!e.rollerScalable)return;let o=Math.abs(n)>Math.abs(r)?n:r;if(o===0)return;h();let d=Math.abs(o),f=0;if(o>0)switch(t){case 0:f=1.01;break;case 1:f=1.25;break;case 2:f=1.6;break}else switch(t){case 0:f=1/1.01;break;case 1:f=1/1.25;break;case 2:f=1/1.6;break}let p=l,m=u(f**d*p);l=m,s=(s-i)/p*m+i,c=(c-a)/p*m+a,T()}},w=()=>{};function T(){let[t,n]=o;(!t||!n)&&(e.style.transform=`translate(${s}px,${c}px)scale(${l})`),s=Fe(s,t,e.clientWidth*l),c=Fe(c,n,e.clientHeight*l),e.style.transform=`translate(${s}px,${c}px)scale(${l})`}return[()=>{e.autoAdaptively&&requestAnimationFrame(i);let t=e.parentNode;for(;t&&!(t instanceof Ae);)t=t.parentNode;t&&(w=t.register(C))},()=>{w()},i]}function M(e,t,n){if(!n&&n!==``){e.removeAttribute(t);return}e.setAttribute(t,n===!0?``:n)}var Le=class extends HTMLElement{static get Area(){return Ae}static get Target(){return Ne}get inertia(){return this.getAttribute(`inertia`)!==null}set inertia(e){M(this,`inertia`,e)}get touchCapture(){return this.getAttribute(`touch-capture`)!==null}set touchCapture(e){M(this,`touch-capture`,e)}get touchMovable(){return this.getAttribute(`touch-movable`)!==null}set touchMovable(e){M(this,`touch-movable`,e)}get touchScalable(){return this.getAttribute(`touch-scalable`)!==null}set touchScalable(e){M(this,`touch-scalable`,e)}get rollerMovable(){return this.getAttribute(`roller-movable`)!==null}set rollerMovable(e){M(this,`roller-movable`,e)}get rollerMovableCapture(){return this.getAttribute(`roller-movable-capture`)!==null}set rollerMovableCapture(e){M(this,`roller-movable-capture`,e)}get rollerScalable(){return this.getAttribute(`roller-scalable`)!==null}set rollerScalable(e){M(this,`roller-scalable`,e)}get leftMouseMovable(){return this.getAttribute(`left-mouse-movable`)!==null}set leftMouseMovable(e){M(this,`left-mouse-movable`,e)}get leftMouseMovableCapture(){return this.getAttribute(`left-mouse-movable-capture`)!==null}set leftMouseMovableCapture(e){M(this,`left-mouse-movable-capture`,e)}get autoAdaptively(){return this.getAttribute(`adaptively`)!==null}set autoAdaptively(e){M(this,`adaptively`,e)}get global(){return this.getAttribute(`global`)!==null}set global(e){M(this,`global`,e)}#e=new Set;#t;#n;#r;constructor(){super(),[this.#t,this.#n,this.#r]=Ie(this,this.#e)}register(e){let t=this.#e;return t.add(e),()=>{t.delete(e)}}adaptively(){this.#r()}connectedCallback(){this.#t()}disconnectedCallback(){this.#n()}adoptedCallback(){}};try{customElements.define(`nl-movable-area`,Ae),customElements.define(`nl-movable`,Le),customElements.define(`nl-movable-target`,Ne)}catch{}var Re=Le,N=class extends HTMLElement{#e=()=>{};#t=null;get pagination(){return this.#t}updateCallback(e){}#n=0;#r=0;#i=1;#a=1;get size(){return this.#n}get total(){return this.#r}get pages(){return this.#i}get page(){return this.#a}connectedCallback(){let e=this.parentNode;for(;e&&!(e instanceof Qe);)e=e.parentNode;e&&(this.#t=e,this.#e=e.register({update:({size:e,total:t,pages:n,page:r})=>{this.#n=e,this.#r=t,this.#i=n,this.#a=r,this.updateCallback({size:e,total:t,pages:n,page:r})}}))}disconnectedCallback(){this.#t=null,this.#e()}};function P(e){let t=document.createElement(`style`);return t.textContent=e,t}var ze=class extends N{static observedAttributes=[`disabled`];get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}#e=this.attachShadow({mode:`closed`});#t=this.#e.appendChild(P(``));#n=(()=>{let e=document.createElement(`input`);e.setAttribute(`part`,`input`),e.type=`number`,e.min=`1`,e.step=`1`,this.#e.appendChild(e);let t=()=>{let{pagination:t}=this;if(!t)return;let n=e.value;n&&t.setPage(Number(n))};return e.addEventListener(`change`,t),e.addEventListener(`keydown`,e=>{e.code===`Enter`&&(e.preventDefault(),t())}),e})();updateCallback(){let e=this.#n,{pages:t,page:n}=this;e.max=String(t),e.value=String(n),e.placeholder=String(n)}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`disabled`:this.#n.disabled=this.disabled;break}}},Be=class extends N{static observedAttributes=[`disabled`];get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}#e=this.attachShadow({mode:`closed`});#t=this.#e.appendChild(P(``));#n=(()=>{let e=document.createElement(`button`);return e.type=`button`,this.#e.appendChild(e),e.setAttribute(`part`,`button`),e})();#r=this.#n.appendChild(document.createElement(`slot`));#i(){this.#n.disabled=this.disabled||this.page===this.pages}constructor(){super(),this.addEventListener(`click`,e=>{let{defaultPrevented:t}=e;e.preventDefault(),this.#n.disabled?e.stopPropagation():t||this.pagination?.setPage(this.page+1)})}updateCallback(){this.#i()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`disabled`:this.#i();break}}},Ve=class extends N{static observedAttributes=[`value`,`disabled`];get value(){return Math.max(1,parseInt(this.getAttribute(`value`)||``)||1)}set value(e){e?this.setAttribute(`value`,String(e)):this.removeAttribute(`value`)}get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}get target(){return Math.min(this.value,this.pages)}get isCurrent(){return this.target===this.page}#e=this.attachShadow({mode:`closed`});#t=this.#e.appendChild(P(``));#n=(()=>{let e=document.createElement(`button`);return e.type=`button`,e.setAttribute(`part`,`button`),this.#e.appendChild(e),e})();#r=(()=>{let e=document.createElement(`slot`);return this.#n.appendChild(e),e.innerText=`1`,e})();#i(){this.#n.disabled=this.disabled||this.isCurrent}constructor(){super(),this.addEventListener(`click`,e=>{let{defaultPrevented:t}=e;e.preventDefault(),this.#n.disabled?e.stopPropagation():t||this.pagination?.setPage(this.value)})}updateCallback(){this.#i()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`value`:this.#r.innerText=String(this.value),this.#i();break;case`disabled`:this.#i();break}}},He=class extends N{static observedAttributes=[`disabled`];get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}#e=this.attachShadow({mode:`closed`});#t=this.#e.appendChild(P(`
|
|
600
600
|
:host { display: contents; }
|
|
601
601
|
.placeholder::after {
|
|
602
602
|
content: var(--nl-pagination-pager-placeholder, '...');
|
|
603
603
|
}
|
|
604
|
-
`));#n=Object.create(null);#r=[];#i(){for(let e of this.#r)e.remove();let e=Object.create(null),t=[];this.#n=e,this.#r=t;let{disabled:n}=this,r=this.#e,i=this.page,a=this.pages,o=Math.max(2,i-2),s=Math.min(i+2,a-1),c=a=>{let o=document.createElement(`button`);o.type=`button`,o.innerText=String(a),o.setAttribute(`part`,a===i?`button current`:`button`),o.disabled=n||a===i,o.addEventListener(`click`,()=>{this.pagination?.setPage(a)}),t.push(o),r.appendChild(o),e[a]=o},l=()=>{let e=document.createElement(`span`);e.className=`placeholder`,e.setAttribute(`part`,`placeholder`),r.appendChild(e),t.push(e)};c(1),i>4&&l();for(let e=o;e<=s;e++)c(e);a-i>3&&l(),a>1&&c(a)}#a(){let{disabled:e}=this,t=String(this.page);for(let[n,r]of Object.entries(this.#n))r.disabled=e||n===t}updateCallback(){this.#i()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`disabled`:this.#a();break}}},
|
|
604
|
+
`));#n=Object.create(null);#r=[];#i(){for(let e of this.#r)e.remove();let e=Object.create(null),t=[];this.#n=e,this.#r=t;let{disabled:n}=this,r=this.#e,i=this.page,a=this.pages,o=Math.max(2,i-2),s=Math.min(i+2,a-1),c=a=>{let o=document.createElement(`button`);o.type=`button`,o.innerText=String(a),o.setAttribute(`part`,a===i?`button current`:`button`),o.disabled=n||a===i,o.addEventListener(`click`,()=>{this.pagination?.setPage(a)}),t.push(o),r.appendChild(o),e[a]=o},l=()=>{let e=document.createElement(`span`);e.className=`placeholder`,e.setAttribute(`part`,`placeholder`),r.appendChild(e),t.push(e)};c(1),i>4&&l();for(let e=o;e<=s;e++)c(e);a-i>3&&l(),a>1&&c(a)}#a(){let{disabled:e}=this,t=String(this.page);for(let[n,r]of Object.entries(this.#n))r.disabled=e||n===t}updateCallback(){this.#i()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`disabled`:this.#a();break}}},Ue=class extends N{static observedAttributes=[`disabled`];get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}#e=this.attachShadow({mode:`closed`});#t=this.#e.appendChild(P(``));#n=(()=>{let e=document.createElement(`button`);return e.type=`button`,e.setAttribute(`part`,`button`),this.#e.appendChild(e),e})();#r=this.#n.appendChild(document.createElement(`slot`));#i(){this.#n.disabled=this.disabled||this.page===1}constructor(){super(),this.addEventListener(`click`,e=>{let{defaultPrevented:t}=e;e.preventDefault(),this.#n.disabled?e.stopPropagation():t||this.pagination?.setPage(this.page-1)})}updateCallback(){this.#i()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`disabled`:this.#i();break}}};function We(e){let t=e?.split(/[,;: ]/).map(e=>parseInt(e)).filter(e=>e>=0);return t?.length?new Set(t):null}function Ge(e){if(typeof e==`string`){let t=We(e);return t?[...t]:[]}if(typeof e==`number`){let t=Math.floor(e);return t>=0?[t]:[]}if(typeof e==`bigint`)return e>=0n?[Number(e)]:[];try{return Array(e).flat(1/0).flatMap(Ge)}catch{return[]}}const Ke=[10,20,30,50,100];function qe(e,t){let n=We(e)||new Set(Ke);return typeof t==`number`&&n.add(t),[...n].sort((e,t)=>e-t)}var Je=class extends N{static observedAttributes=[`sizes`,`label`,`non-label`,`disabled`];get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}#e=this.attachShadow({mode:`closed`});#t=this.#e.appendChild(P(``));#n=(()=>{let e=this.#e.appendChild(document.createElement(`select`));return e.setAttribute(`part`,`input`),e.addEventListener(`change`,()=>{let{pagination:t}=this;t&&t.setSize(Number(e.value))}),e})();#r=(()=>{let e=document.createElement(`option`);return e.label=`-`,e.value=`0`,e})();#i=[];#a(){let e=We(this.getAttribute(`sizes`))||new Set(Ke),{size:t}=this;e.add(t);let n=this.#n;n.innerHTML=``,e.delete(0)&&n.appendChild(this.#r);let r=[];this.#i=r;let i=this.label;for(let t of[...e].sort((e,t)=>e-t)){let e=document.createElement(`option`);e.label=i.replace(/#/g,String(t)),e.value=String(t),r.push(e),n.appendChild(e)}n.value=String(t)}get label(){return this.getAttribute(`label`)||`#`}set label(e){e?this.setAttribute(`label`,e):this.removeAttribute(`label`)}get nonLabel(){return this.getAttribute(`non-label`)||`-`}set nonLabel(e){e?this.setAttribute(`non-label`,e):this.removeAttribute(`non-label`)}get sizes(){return qe(this.getAttribute(`sizes`))}set sizes(e){let t=Ge(e);t.length?this.setAttribute(`sizes`,[...new Set(t)].sort((e,t)=>e-t).join(`,`)):this.removeAttribute(`sizes`)}#o=0;updateCallback(){let{size:e}=this;this.#o!==e&&(this.#o=e,this.#a())}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`sizes`:this.#a();break;case`label`:{let e=this.label;for(let t of this.#i)t.label=e.replace(/#/g,t.value);break}case`non-label`:this.#r.label=this.nonLabel;break;case`disabled`:this.#n.disabled=this.disabled;break}}},Ye=class extends N{static observedAttributes=[`name`];get name(){let e=this.getAttribute(`name`)?.toLowerCase()||``;return[`size`,`total`,`pages`,`page`,`start`,`end`].includes(e)?e:`page`}set name(e){e?this.setAttribute(`name`,String(e)):this.removeAttribute(`name`)}#e={size:0,total:0,pages:1,page:1,start:0,end:0};#t=this.attachShadow({mode:`closed`});#n=this.#t.appendChild(P(``));#r=this.#t.appendChild(document.createTextNode(``));#i(){let e=this.#e[this.name];this.#r.textContent=String(e)}updateCallback(){let{size:e,total:t,pages:n,page:r}=this;this.#e={size:e,total:t,pages:n,page:r,start:Math.min((r-1)*e+1,t),end:e?Math.min(r*e,t):t},this.#i()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`name`:this.#i()}}};function Xe(e,t,n){if(n=typeof n==`string`?parseInt(n):typeof n==`number`?Math.floor(n):typeof n==`bigint`?Number(n):NaN,Number.isNaN(n)||n<0){e.removeAttribute(t);return}e.setAttribute(t,String(n))}function Ze(e){if(!e)return 0;let t=parseInt(e);return Number.isNaN(t)||t<0?0:t}var Qe=class extends HTMLElement{static get Widget(){return N}static get Jumper(){return ze}static get Next(){return Be}static get Page(){return Ve}static get Pager(){return He}static get Prev(){return Ue}static get Sizer(){return Je}static get Value(){return Ye}static observedAttributes=[`size`,`total`,`pages`,`page`];get size(){return Ze(this.getAttribute(`size`))||0}set size(e){Xe(this,`size`,e)}get total(){return Ze(this.getAttribute(`total`))||0}set total(e){Xe(this,`total`,e)}get pages(){let e=Ze(this.getAttribute(`pages`));if(e)return e;let{size:t}=this;return t&&Math.ceil(this.total/t)||1}set pages(e){Xe(this,`pages`,e)}get page(){return Math.min(Ze(this.getAttribute(`page`))||1,this.pages)}set page(e){Xe(this,`page`,e)}setPage(e){this.page=e,this.dispatchEvent(new Event(`change`))}setSize(e){this.size=e,this.dispatchEvent(new Event(`change`))}#e=new Set;register(e){let t=this.#e;return t.add(e),e.update({...this.#t}),()=>{t.delete(e)}}connectedCallback(){}disconnectedCallback(){}adoptedCallback(){}#t={size:0,total:0,pages:1,page:1};attributeChangedCallback(e,t,n){if(t===n)return;let{size:r,total:i,pages:a,page:o}=this,s=this.#t;if(r===s.size&&i===s.total&&a===s.pages&&o===s.page)return;let c={size:r,total:i,pages:a,page:o};this.#t=c;for(let e of[...this.#e])e.update({...c})}};try{customElements.define(`nl-pagination`,Qe),customElements.define(`nl-pagination-jumper`,ze),customElements.define(`nl-pagination-next`,Be),customElements.define(`nl-pagination-page`,Ve),customElements.define(`nl-pagination-pager`,He),customElements.define(`nl-pagination-prev`,Ue),customElements.define(`nl-pagination-sizer`,Je),customElements.define(`nl-pagination-value`,Ye)}catch{}var $e=class extends HTMLElement{static observedAttributes=[`digit`,`value`,`sign`,`plus`,`zero`];#e=document.createElement(`span`);#t=document.createElement(`span`);#n=document.createElement(`span`);#r(){let e=this.currentDigit,t=this.currentSign;this.#n.innerText=this.sign?t:`${e}`,this.#e.style.insetBlockStart=`-${e}00%`,this.#t.style.insetBlockStart=`-${t===`+`?2:t===`-`?0:1}00%`}constructor(){super();let e=this.attachShadow({mode:`closed`});e.appendChild(document.createElement(`style`)).textContent=`
|
|
605
605
|
:host {
|
|
606
606
|
display: inline-block;
|
|
607
607
|
overflow: hidden;
|
|
@@ -675,7 +675,7 @@ footer {
|
|
|
675
675
|
:host([sign]) .root {
|
|
676
676
|
inset-inline-start: 100%;
|
|
677
677
|
}
|
|
678
|
-
`;let t=e.appendChild(this.#e);t.className=`root`;for(let e=0;e<10;e++)t.appendChild(document.createElement(`span`));let n=e.appendChild(this.#t);n.className=`sign`;for(let e=0;e<3;e++)n.appendChild(document.createElement(`span`));e.appendChild(this.#n).className=`value`}get currentDigit(){return Math.floor(Math.abs(this.value)/10**this.digit%10)}get currentSign(){let{value:e}=this;return e<0?`-`:e?this.plus?`+`:``:this.zero}get digit(){return parseInt(this.getAttribute(`digit`)||``)||0}set digit(e){e==null?this.removeAttribute(`digit`):this.setAttribute(`digit`,String(e))}get sign(){return this.hasAttribute(`sign`)}set sign(e){e?this.setAttribute(`sign`,``):this.removeAttribute(`sign`)}get plus(){return this.hasAttribute(`plus`)}set plus(e){e?this.setAttribute(`plus`,``):this.removeAttribute(`plus`)}get zero(){let e=this.getAttribute(`zero`);return e===`+`||e===`-`?e:``}set zero(e){e===`+`||e===`-`?this.setAttribute(`plus-zero`,e):this.removeAttribute(`zero`)}get value(){return parseFloat(this.getAttribute(`value`)||``)||0}set value(e){e==null?this.removeAttribute(`value`):this.setAttribute(`value`,String(e))}connectedCallback(){this.#r()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`digit`:case`value`:case`sign`:case`plus`:case`zero`:this.#r();break}}};try{customElements.define(`nl-roll-digit
|
|
678
|
+
`;let t=e.appendChild(this.#e);t.className=`root`;for(let e=0;e<10;e++)t.appendChild(document.createElement(`span`));let n=e.appendChild(this.#t);n.className=`sign`;for(let e=0;e<3;e++)n.appendChild(document.createElement(`span`));e.appendChild(this.#n).className=`value`}get currentDigit(){return Math.floor(Math.abs(this.value)/10**this.digit%10)}get currentSign(){let{value:e}=this;return e<0?`-`:e?this.plus?`+`:``:this.zero}get digit(){return parseInt(this.getAttribute(`digit`)||``)||0}set digit(e){e==null?this.removeAttribute(`digit`):this.setAttribute(`digit`,String(e))}get sign(){return this.hasAttribute(`sign`)}set sign(e){e?this.setAttribute(`sign`,``):this.removeAttribute(`sign`)}get plus(){return this.hasAttribute(`plus`)}set plus(e){e?this.setAttribute(`plus`,``):this.removeAttribute(`plus`)}get zero(){let e=this.getAttribute(`zero`);return e===`+`||e===`-`?e:``}set zero(e){e===`+`||e===`-`?this.setAttribute(`plus-zero`,e):this.removeAttribute(`zero`)}get value(){return parseFloat(this.getAttribute(`value`)||``)||0}set value(e){e==null?this.removeAttribute(`value`):this.setAttribute(`value`,String(e))}connectedCallback(){this.#r()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`digit`:case`value`:case`sign`:case`plus`:case`zero`:this.#r();break}}};try{customElements.define(`nl-roll-digit`,$e)}catch{}function et(e){return e?/^\d+$/.test(e)?`${e}px`:e:`0`}function tt(e){let t=[`::slotted(*) {
|
|
679
679
|
flex-basis: calc(100% / ${e});
|
|
680
680
|
max-inline-size: calc(100% / ${e});
|
|
681
681
|
}`];for(let n=1;n<=e;n++)t.push(`::slotted([nl-span="${n}"]) {
|
|
@@ -685,14 +685,14 @@ footer {
|
|
|
685
685
|
}`),t.push(`::slotted([nl-offset="${n}"]) {
|
|
686
686
|
margin-inline-start: calc(${n}00% / ${e});
|
|
687
687
|
}`);return t.join(`
|
|
688
|
-
`)}function
|
|
688
|
+
`)}function nt(e){if(typeof e!=`number`)return 0;let t=Math.floor(e);return Number.isFinite(t)&&t>1?t:0}var rt=class extends HTMLElement{static observedAttributes=[`aliquot`,`gutter-inline`,`gutter-block`];#e=document.createElement(`style`);#t=document.createElement(`style`);get gutterInline(){return et(this.getAttribute(`gutter-inline`))}set gutterInline(e){this.setAttribute(`gutter-inline`,String(e))}get gutterBlock(){return et(this.getAttribute(`gutter-block`))}set gutterBlock(e){this.setAttribute(`gutter-block`,String(e))}get aliquot(){let e=parseInt(this.getAttribute(`aliquot`)||``);return!e||e<2?24:e}set aliquot(e){let t=nt(e);t?this.setAttribute(`aliquot`,String(t)):this.removeAttribute(`aliquot`)}constructor(){super();let e=this.attachShadow({mode:`closed`});e.appendChild(document.createElement(`style`)).textContent=`
|
|
689
689
|
:host { display: flex; flex-flow: row wrap; }
|
|
690
690
|
::slotted(*) { box-sizing: border-box; }
|
|
691
691
|
::slotted([nl-span=0]) { flex: 0 0 0%; max-inline-size: 0%; }
|
|
692
|
-
`,e.appendChild(this.#t),e.appendChild(this.#e),e.appendChild(document.createElement(`slot`))}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`aliquot`:this.#t.textContent
|
|
692
|
+
`,e.appendChild(this.#t),e.appendChild(this.#e),e.appendChild(document.createElement(`slot`))}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`aliquot`:this.#t.textContent=tt(this.aliquot);break;case`gutter-inline`:case`gutter-block`:this.#e.textContent=`::slotted(*) {
|
|
693
693
|
padding-block: ${this.gutterBlock};
|
|
694
694
|
padding-inline: ${this.gutterInline};
|
|
695
|
-
}`;break}}};try{customElements.define(`nl-row`,
|
|
695
|
+
}`;break}}};try{customElements.define(`nl-row`,rt)}catch{}var it=class extends HTMLElement{static observedAttributes=[`column`,`space`,`unit`];get column(){return this.hasAttribute(`column`)}set column(e){e?this.setAttribute(`column`,``):this.removeAttribute(`column`)}get space(){let e=parseFloat(this.getAttribute(`space`)||``);return Number.isNaN(e)||!Number.isFinite(e)?16:e<=0?0:e}set space(e){typeof e!=`number`||!Number.isFinite(e)?this.removeAttribute(`space`):this.setAttribute(`space`,e<=0?`0`:String(e))}get unit(){return this.getAttribute(`unit`)||`px`}set unit(e){e?this.setAttribute(`unit`,e):this.removeAttribute(`unit`)}#e=document.createElement(`style`);constructor(){super();let e=this.attachShadow({mode:`closed`});e.appendChild(this.#e),e.appendChild(document.createElement(`style`)).textContent=`
|
|
696
696
|
:host {
|
|
697
697
|
display: inline-block;
|
|
698
698
|
}
|
|
@@ -706,7 +706,7 @@ footer {
|
|
|
706
706
|
:host([column]) ::slotted(*) {
|
|
707
707
|
display: block;
|
|
708
708
|
}
|
|
709
|
-
`,e.appendChild(document.createElement(`slot`))}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`column`:case`space`:case`unit`:this.#e.textContent=`::slotted(*) {margin-${this.column?`block`:`inline`}-end: var(--nl-space, ${this.space}${this.unit})}`;break}}};try{customElements.define(`nl-space`,
|
|
709
|
+
`,e.appendChild(document.createElement(`slot`))}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`column`:case`space`:case`unit`:this.#e.textContent=`::slotted(*) {margin-${this.column?`block`:`inline`}-end: var(--nl-space, ${this.space}${this.unit})}`;break}}};try{customElements.define(`nl-space`,it)}catch{}function at(e,t,n){n?e.setAttribute(t,``):e.removeAttribute(t)}function F(e,t,n=0,r=1){let i=e?parseFloat(e):t;return Math.max(n,Math.min(Number.isNaN(i)?t:i,r))}function ot(e,t,n,r=0,i=1){let a=typeof n==`string`?parseFloat(n):n===null?NaN:n;if(Number.isNaN(a)){e.removeAttribute(t);return}e.setAttribute(t,String(Math.max(r,Math.min(a,i))))}const st=new Set([`vertical-lr`,`vertical-rl`,`sideways-lr`,`sideways-rl`]);function ct(e){let t=getComputedStyle(e),n=t.writingMode?.toLowerCase(),r=st.has(n),i=t.flexDirection.toLocaleLowerCase(),a=i.includes(`column`),o=a?[`vertical-rl`,`sideways-rl`].includes(n):t.direction.toLowerCase()===`rtl`!=(n===`sideways-lr`);return o=o!==i.includes(`reverse`),[r!==a,o]}var lt=class extends HTMLElement{static observedAttributes=[`column`,`disabled`,`min`,`max`,`value`];get column(){return this.getAttribute(`column`)!==null}set column(e){at(this,`column`,e)}get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){at(this,`disabled`,e)}get min(){return F(this.getAttribute(`min`),0,0,1)}set min(e){ot(this,`min`,e,0,F(this.getAttribute(`max`),1,0,1))}get max(){return F(this.getAttribute(`max`),1,this.min,1)}set max(e){ot(this,`max`,e,this.min,1)}get value(){return F(this.getAttribute(`value`),.5,this.min,this.max)}set value(e){ot(this,`value`,e,this.min,this.max)}#e=null;#t(){let e=this.#e;e!==null&&(this.#i.states.delete(`--moving`),this.#e=null,this.#a.releasePointerCapture(e))}#n=(()=>{let e=this.attachShadow({mode:`closed`});return e.appendChild(document.createElement(`style`)).textContent=`
|
|
710
710
|
:host {
|
|
711
711
|
display: flex;
|
|
712
712
|
border: 1px solid;
|
|
@@ -743,7 +743,7 @@ slot {
|
|
|
743
743
|
:host(:state(--moving)) div, div:hover {
|
|
744
744
|
opacity: .5;
|
|
745
745
|
}
|
|
746
|
-
`,e})();#r=(()=>{let e=document.createElement(`slot`);return e.name=`start`,e.className=`start`,this.#n.appendChild(e),e})();#i=this.attachInternals();#a=(()=>{let e=document.createElement(`slot`);e.name=`trigger`,e.tabIndex=0,e.className=`trigger`,e.appendChild(document.createElement(`div`)),this.#n.appendChild(e);let t=0;e.addEventListener(`pointerdown`,n=>{if(this.hidden||this.disabled)return;let{pointerId:r}=n,i=this.#e;if([null,r].includes(i))switch(this.#i.states.add(`--moving`),this.#e=r,e.setPointerCapture(r),ot(e).map((e,t)=>e?2**t:0).reduce((e,t)=>e+t)){case 0:t=-n.offsetX;break;case 1:t=-n.offsetY;break;case 2:t=n.offsetX-e.offsetWidth;break;case 3:t=n.offsetY-e.offsetHeight;break}});let n=this,r=t=>t?n.clientHeight-e.offsetHeight:n.clientWidth-e.offsetWidth,i=i=>{let[a,o]=ot(e),s=0;switch([a,o].map((e,t)=>e?2**t:0).reduce((e,t)=>e+t)){case 0:s=i.clientX-n.getBoundingClientRect().left;break;case 1:s=i.clientY-n.getBoundingClientRect().top;break;case 2:s=n.getBoundingClientRect().right-i.clientX;break;case 3:s=n.getBoundingClientRect().bottom-i.clientY;break}let{max:c,min:l}=this,u=Math.max(l,Math.min((s+t)/r(a),c));this.setAttribute(`value`,String(u))};return e.addEventListener(`pointermove`,t=>{let{pointerId:n}=t;e.hasPointerCapture(n)&&i(t)}),e.addEventListener(`pointerup`,e=>{let{pointerId:t}=e;t===this.#e&&(i(e),this.#t())}),e.addEventListener(`pointercancel`,e=>{let{pointerId:t}=e;t===this.#e&&(i(e),this.#t())}),e.addEventListener(`keydown`,t=>{if(this.hidden||this.disabled||this.#e!==null||this.#n.activeElement!==e)return;let{max:n,min:i}=this;switch(t.code){case`Home`:t.preventDefault(),this.setAttribute(`value`,String(Math.max(i,0)));return;case`End`:t.preventDefault(),this.setAttribute(`value`,String(Math.min(1,n)));return}let[a,o]=ot(e),s=0;switch(t.code){case`ArrowUp`:s=a?-1:0;break;case`ArrowDown`:s=a?1:0;break;case`ArrowLeft`:s=a?0:-1;break;case`ArrowRight`:s=a?0:1;break}if(!s)return;t.preventDefault(),o&&(s=-s),t.ctrlKey&&(s*=100),t.shiftKey&&(s*=10);let c=F(this.getAttribute(`value`),.5,i,n);c=Math.max(i,Math.min(c+s/r(a),n)),this.setAttribute(`value`,String(c))}),e})();#o=(()=>{let e=document.createElement(`slot`);return e.name=`end`,e.className=`end`,this.#n.appendChild(e),e})();connectedCallback(){}disconnectedCallback(){this.#t()}adoptedCallback(){this.#t()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`hidden`:if(!this.hidden)break;this.#t();break;case`disabled`:n===null?this.#a.tabIndex=0:this.#a.removeAttribute(`tabindex`),this.#t();break;case`min`:case`max`:case`value`:{let{value:e}=this;this.#r.style.flex=`${e}`,this.#o.style.flex=`${1-e}`;break}}}};try{customElements.define(`nl-split`,st)}catch{}var ct=class{#e;#t;constructor(){let e=document.createElement(`nl-pagination`);e.size=20,e.appendChild(document.createElement(`nl-pagination-value`)).name=`start`,e.appendChild(document.createTextNode(`-`)),e.appendChild(document.createElement(`nl-pagination-value`)).name=`end`,e.appendChild(document.createTextNode(`/`)),e.appendChild(document.createElement(`nl-pagination-value`)).name=`total`,e.appendChild(document.createElement(`nl-pagination-prev`)).innerText=`上一页`,e.appendChild(document.createElement(`nl-pagination-pager`)),e.appendChild(document.createElement(`nl-pagination-next`)).innerText=`下一页`,e.appendChild(document.createElement(`nl-pagination-sizer`));let t=new Set;e.addEventListener(`change`,()=>{for(let e of t)e()}),this.#e=t,this.#t=e}get root(){return this.#t}get size(){return this.#t.size}set size(e){this.#t.size=e}get page(){return this.#t.page}set page(e){this.#t.page=e}get total(){return this.#t.total}set total(e){this.#t.total=e}listen(e){let t=this.#e,n=()=>e(this);return t.add(n),()=>{t.delete(n)}}destroy(){}};function lt(e){e.listen(`update`,()=>{let{container:t}=e;t.innerHTML=``})}function*ut(e,t,n){if(!e)return;let r=e.indexOf(`?`),i=r<0?e:e.slice(0,r);if(r>=0&&r+1<e.length)for(let n=e.slice(r).split(`&`);n.length;n.pop()){let e=t.get(`${i}${n.join(`&`)}`);e?.length&&(yield e)}let a=t.get(i);a?.length&&(yield a);let o=n.get(i);o?.length&&(yield o.map(e=>e[0]))}function*dt(t,n,r,i,a){if(yield*ut(t,n,r),i)for(let t of[...e.stringifyPaths(i)].reverse()){let e=a.get(t);e?.length&&(yield e)}}function*ft(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let e;e=t.nextNode();)yield e}function pt(e,t){let n=[],r=[...ft(t)].filter(e=>e.nodeValue?.length),i=r.reduce((e,t)=>{let n=e[e.length-1]?.[1]||0;return[...e,[n,n+(t.nodeValue?.length||0),t]]},[]),a=r.map(e=>e.nodeValue).join(``),o=0;for(let t of e){let e=a.indexOf(t,o);if(e===-1)return[];let r=e+t.length,s=i.findLast(([t])=>t<=e);if(!s)return[];let c=i.findLast(([,e])=>e>=r);if(!c)return[];o=e+t.length;let l=new Range;l.setStart(s[2],e-s[0]),l.setEnd(c[2],r-s[0]),n.push(l)}return n}function mt(t,n,i={}){let a=new Map,s=new Map,c=new Map,l=null,u=[],d=[];function f(e){let t=document.createElement(`a`);return t.href=e.path||`#`,t.appendChild(document.createTextNode(e.label||e.title||``)),t.title=e.title||e.label||``,t}let p=null;function h(t,n){let{children:i}=t;if(!i.length){let n=document.createElement(`div`),i=n.appendChild(document.createElement(`a`));i.appendChild(document.createTextNode(t.label||t.title||``));let{page:l,path:u,uri:d,target:m}=t,h=null,g=l&&e.parse(l);if(g)h=new URL(r.stringify(g,u),o.root),i.href=h.href,m&&typeof m==`string`&&(i.target=m);else if(d){i.href=d;try{h=new URL(d),h.origin!==location.origin&&(h=null)}catch{}m!==``&&(i.target=m??`_blank`)}if(h&&(i.target||`_self`)===`_self`){i.addEventListener(`click`,()=>{p=n,requestIdleCallback(()=>{p===n&&(p=null)})});let{pathname:t,search:r}=h,o=(r||`?`)===`?`?t:`${t}${r}`,l=s.get(o);l?l.push(n):s.set(t,[n]);let d=a.get(o);if(d?d.push([n,r.length]):a.set(t,[[n,r.length]]),g&&(!u||u[0]===`?`||u[0]===`#`)){let t=e.stringify(g),r=c.get(t);r?r.push(n):c.set(t,[n])}}for(let e of t.buttons||[])n.appendChild(f(e));return n.className=`NavMenu-item`,{el:n,filter(e,t){let r=t?pt(t,i):[];return n.hidden=!!(!e&&t&&!r.length),r}}}let l=document.createElement(`nl-collapse`);l.setAttribute(`animation`,``),l.setAttribute(`menu`,``);let u=l.appendChild(document.createElement(`div`));u.appendChild(document.createTextNode(t.label||t.title||``)),u.className=`NavMenu-label`,u.slot=`label`,u.style.flex=`1`;for(let e of t.buttons||[])l.appendChild(f(e)).slot=`label`;let d=g(l,i,n+1);return d.length?{el:l,filter(e,t){if(!t){for(let t of d)t.filter(e);return l.hidden=!1,l.open=!1,[]}let n=pt(t,u),r=!!(e||n.length),i=d.flatMap(e=>e.filter(r,t));l.open=!!i.length;let a=[...n,...i];return l.hidden=!e&&!a.length,a}}:null}function g(e,t,n){let r=!1,i=!1,a=[];for(let o of t){if(!o){if(!r)continue;i=!0;continue}i&&(i=!1,e.appendChild(document.createElement(`hr`)));let t=h(o,n);t&&(a.push(t),r=!0,e.appendChild(t.el),u.push(t.el),t.el.style.setProperty(`--NavMenu-level`,String(n)))}return a}let _=g(t,n,0),v=!1;function b(){if(!v){v=!0;for(let e of u)e.remove();for(let e of d)e()}}let x=i.signal||m;x.aborted?b():x.addEventListener(`abort`,b,{once:!0});let S=[];return y(()=>{let e=i.active;return e?typeof e==`string`?e.replace(/#.*/,``)||``:Array.isArray(e)?e[1]?[e[0]?.replace(/#.*/,``)||``,e[1]||null]:e[0]?.replace(/#.*/,``)||null:null:null},e=>{if(!e)return;let n=Array.isArray(e)?e[0]:``,r=Array.isArray(e)?e[1]:null;for(let e of dt(n,s,a,r,c)){let n=p&&e.includes(p)?p:null;if(n&&(p=null),!n&&l&&e.includes(l))return;let r=n||e[0],i=[],a=r.parentElement;for(;a&&a!==t;a=a.parentElement)i.push(a);if(a!==t)return;S=i,l?.classList.remove(`NavMenu-current`);for(let e of S)e.setAttribute(`open`,``);l=r,l?.classList.add(`NavMenu-current`);return}},{signal:x,immediate:!0}),e=>{let t=e.toLowerCase().split(/[\s\n]+/).filter(Boolean);if(t.length)return _.flatMap(e=>e.filter(!1,t));_.flatMap(e=>e.filter(!1));for(let e of S)e.setAttribute(`open`,``);return[]}}const I=document.createElement(`div`);I.style.display=`flex`,I.style.flexDirection=`column`;const ht=I.appendChild(document.createElement(`header`));ht.classList.add(`NavMenu-header`);const L=ht.appendChild(document.createElement(`input`));L.placeholder=`过滤菜单...`,L.type=`search`;const R=ht.appendChild(document.createElement(`button`));R.appendChild(c(`refresh`,!0)),R.classList.add(`icon`),R.title=`刷新`;const z=I.appendChild(document.createElement(`main`));z.style.flex=`1`,z.style.overflow=`auto`,z.classList.add(`NavMenu`);let gt=null;function _t(){let e=gt?.(L.value)||[],t=new Highlight(...e);CSS.highlights.set(`NavMenu-filter-highlight`,t)}L.addEventListener(`input`,_t);const vt=s(()=>t.fromDefine(o.menus,[])),yt=s(()=>{let e=a.permissions,n=vt.get();return e.size<0?n:t.filter(n,t=>{let n=t.permission;return n?p(n,e):!0})}),bt=u(``);let xt=null;f(()=>{xt?.abort(),z.innerHTML=``,xt=new AbortController,gt=mt(z,yt.get(),{signal:xt.signal,get active(){return bt.get()}}),_t()});function St(e,t,n,r){if(!r){bt.set(`${e}${t}`);return}bt.set([`${e}${t}`,r])}R.addEventListener(`click`,()=>o.refresh());function Ct(e,t,n){if(!e){let e=c(`user`,t);return n||e.setAttribute(`fill-opacity`,`0.5`),e}let r=document.createElement(`img`);return r.src=e,r}function wt(e,t,n=m){e.classList.add(`${b}-user-avatar`);let r=s(()=>a.single?null:a.session?.avatar||``).get(),i=new AbortController,o=AbortSignal.any([i.signal,n]),l=r===null?c(`singleUser`,o):Ct(r,o,t);e.appendChild(l),f(()=>{let o=a.single?null:a.session?.avatar||``;if(o===r)return;r=o,i?.abort(),i=new AbortController;let s=AbortSignal.any([i.signal,n]),u=r===null?c(`singleUser`,s):Ct(r,s,t);!t&&r===null&&u.setAttribute(`fill-opacity`,`0.5`),e.replaceChild(u,l),l.remove(),l=u},n);let u=s(()=>{let e=a.target,t=a.session;return!e||e.id===(t?.id||``)?null:e.avatar||``}),d=null,p=null,h=null;f(()=>{let r=u.get();r!==d&&(d=r,p?.remove(),p=null,h?.abort(),r!==null&&(h=new AbortController,p=Ct(r,AbortSignal.any([h.signal,n]),t),e.insertBefore(p,l)))},n)}const B=document.createElement(`div`);B.classList.add(`${b}-user`);const V=document.createElement(`div`);V.classList.add(`${b}-user-button`),wt(V,!0);const H=B.appendChild(document.createElement(`span`));H.classList.add(`${b}-user-info`);const Tt=H.appendChild(document.createElement(`span`));wt(Tt),Tt.classList.add(`avatar`);const Et=H.appendChild(document.createElement(`span`));Et.classList.add(`username`),Et.innerText=`用户名`;const Dt=H.appendChild(document.createElement(`span`));if(Dt.classList.add(`btns`),o.help){let e=Dt.appendChild(document.createElement(`a`));e.href=o.help,e.target=`_blank`,e.appendChild(c(`help`,!0)),e.title=`帮助`}const U=Dt.appendChild(document.createElement(`div`));U.appendChild(c(`logout`,!0)),U.title=`退出登录`,f(()=>{U.hidden=!a.current}),U.addEventListener(`click`,()=>a.exit()),f(()=>{Et.innerText=a.current?.name||``});const Ot=s(()=>t.fromDefine(o.userMenus,[])),kt=s(()=>{let e=Ot.get();return a.current?e:t.filter(e,e=>!e.logged)}),W=B.appendChild(document.createElement(`main`));W.style.flex=`1`,W.style.overflow=`auto`,W.classList.add(`NavMenu`);let At=null;f(()=>{At?.abort(),W.innerHTML=``,At=new AbortController,mt(W,kt.get(),{signal:At.signal})});const G=document.createElement(`a`);G.classList.add(`${b}-logo`),G.href=o.root,y(()=>{let e=o.logo;return e&&_(e)},e=>{if(G.innerHTML=``,e){let t=G.appendChild(document.createElement(`img`));t.src=e.href,t.classList.add(`logo`)}else G.appendChild(c(`logo`,!0)).classList.add(`logo`)},{immediate:!0});const jt={404:{title:`您所请求的页面无法找到`,description:`服务器无法正常提供信息。
|
|
747
|
-
目标页面可能已经被更改、删除或移到其他位置,或您所输入页面地址错误。`}};function
|
|
748
|
-
`))c.appendChild(document.createTextNode(e)),c.appendChild(document.createElement(`br`));e.container.appendChild(a),e.loading=!1}const
|
|
746
|
+
`,e})();#r=(()=>{let e=document.createElement(`slot`);return e.name=`start`,e.className=`start`,this.#n.appendChild(e),e})();#i=this.attachInternals();#a=(()=>{let e=document.createElement(`slot`);e.name=`trigger`,e.tabIndex=0,e.className=`trigger`,e.appendChild(document.createElement(`div`)),this.#n.appendChild(e);let t=0;e.addEventListener(`pointerdown`,n=>{if(this.hidden||this.disabled)return;let{pointerId:r}=n,i=this.#e;if([null,r].includes(i))switch(this.#i.states.add(`--moving`),this.#e=r,e.setPointerCapture(r),ct(e).map((e,t)=>e?2**t:0).reduce((e,t)=>e+t)){case 0:t=-n.offsetX;break;case 1:t=-n.offsetY;break;case 2:t=n.offsetX-e.offsetWidth;break;case 3:t=n.offsetY-e.offsetHeight;break}});let n=this,r=t=>t?n.clientHeight-e.offsetHeight:n.clientWidth-e.offsetWidth,i=i=>{let[a,o]=ct(e),s=0;switch([a,o].map((e,t)=>e?2**t:0).reduce((e,t)=>e+t)){case 0:s=i.clientX-n.getBoundingClientRect().left;break;case 1:s=i.clientY-n.getBoundingClientRect().top;break;case 2:s=n.getBoundingClientRect().right-i.clientX;break;case 3:s=n.getBoundingClientRect().bottom-i.clientY;break}let{max:c,min:l}=this,u=Math.max(l,Math.min((s+t)/r(a),c));this.setAttribute(`value`,String(u))};return e.addEventListener(`pointermove`,t=>{let{pointerId:n}=t;e.hasPointerCapture(n)&&i(t)}),e.addEventListener(`pointerup`,e=>{let{pointerId:t}=e;t===this.#e&&(i(e),this.#t())}),e.addEventListener(`pointercancel`,e=>{let{pointerId:t}=e;t===this.#e&&(i(e),this.#t())}),e.addEventListener(`keydown`,t=>{if(this.hidden||this.disabled||this.#e!==null||this.#n.activeElement!==e)return;let{max:n,min:i}=this;switch(t.code){case`Home`:t.preventDefault(),this.setAttribute(`value`,String(Math.max(i,0)));return;case`End`:t.preventDefault(),this.setAttribute(`value`,String(Math.min(1,n)));return}let[a,o]=ct(e),s=0;switch(t.code){case`ArrowUp`:s=a?-1:0;break;case`ArrowDown`:s=a?1:0;break;case`ArrowLeft`:s=a?0:-1;break;case`ArrowRight`:s=a?0:1;break}if(!s)return;t.preventDefault(),o&&(s=-s),t.ctrlKey&&(s*=100),t.shiftKey&&(s*=10);let c=F(this.getAttribute(`value`),.5,i,n);c=Math.max(i,Math.min(c+s/r(a),n)),this.setAttribute(`value`,String(c))}),e})();#o=(()=>{let e=document.createElement(`slot`);return e.name=`end`,e.className=`end`,this.#n.appendChild(e),e})();connectedCallback(){}disconnectedCallback(){this.#t()}adoptedCallback(){this.#t()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`hidden`:if(!this.hidden)break;this.#t();break;case`disabled`:n===null?this.#a.tabIndex=0:this.#a.removeAttribute(`tabindex`),this.#t();break;case`min`:case`max`:case`value`:{let{value:e}=this;this.#r.style.flex=`${e}`,this.#o.style.flex=`${1-e}`;break}}}};try{customElements.define(`nl-split`,lt)}catch{}var ut=class{#e;#t;constructor(){let e=document.createElement(`nl-pagination`);e.size=20,e.appendChild(document.createElement(`nl-pagination-value`)).name=`start`,e.appendChild(document.createTextNode(`-`)),e.appendChild(document.createElement(`nl-pagination-value`)).name=`end`,e.appendChild(document.createTextNode(`/`)),e.appendChild(document.createElement(`nl-pagination-value`)).name=`total`,e.appendChild(document.createElement(`nl-pagination-prev`)).innerText=`上一页`,e.appendChild(document.createElement(`nl-pagination-pager`)),e.appendChild(document.createElement(`nl-pagination-next`)).innerText=`下一页`,e.appendChild(document.createElement(`nl-pagination-sizer`));let t=new Set;e.addEventListener(`change`,()=>{for(let e of t)e()}),this.#e=t,this.#t=e}get root(){return this.#t}get size(){return this.#t.size}set size(e){this.#t.size=e}get page(){return this.#t.page}set page(e){this.#t.page=e}get total(){return this.#t.total}set total(e){this.#t.total=e}listen(e){let t=this.#e,n=()=>e(this);return t.add(n),()=>{t.delete(n)}}destroy(){}};function dt(e){e.listen(`update`,()=>{let{container:t}=e;t.innerHTML=``})}function*ft(e,t,n){if(!e)return;let r=e.indexOf(`?`),i=r<0?e:e.slice(0,r);if(r>=0&&r+1<e.length)for(let n=e.slice(r).split(`&`);n.length;n.pop()){let e=t.get(`${i}${n.join(`&`)}`);e?.length&&(yield e)}let a=t.get(i);a?.length&&(yield a);let o=n.get(i);o?.length&&(yield o.map(e=>e[0]))}function*pt(t,n,r,i,a){if(yield*ft(t,n,r),i)for(let t of[...e.stringifyPaths(i)].reverse()){let e=a.get(t);e?.length&&(yield e)}}function*mt(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let e;e=t.nextNode();)yield e}function ht(e,t){let n=[],r=[...mt(t)].filter(e=>e.nodeValue?.length),i=r.reduce((e,t)=>{let n=e[e.length-1]?.[1]||0;return[...e,[n,n+(t.nodeValue?.length||0),t]]},[]),a=r.map(e=>e.nodeValue).join(``),o=0;for(let t of e){let e=a.indexOf(t,o);if(e===-1)return[];let r=e+t.length,s=i.findLast(([t])=>t<=e);if(!s)return[];let c=i.findLast(([,e])=>e>=r);if(!c)return[];o=e+t.length;let l=new Range;l.setStart(s[2],e-s[0]),l.setEnd(c[2],r-s[0]),n.push(l)}return n}function gt(t,n,i={}){let a=new Map,s=new Map,c=new Map,l=null,u=[],d=[];function f(e){let t=document.createElement(`a`);return t.href=e.path||`#`,t.appendChild(document.createTextNode(e.label||e.title||``)),t.title=e.title||e.label||``,t}let p=null;function m(t,n){let{children:i}=t;if(!i.length){let n=document.createElement(`div`),i=n.appendChild(document.createElement(`a`));i.appendChild(document.createTextNode(t.label||t.title||``));let{page:l,path:u,uri:d,target:m}=t,h=null,g=l&&e.parse(l);if(g)h=new URL(r.stringify(g,u),o.root),i.href=h.href,m&&typeof m==`string`&&(i.target=m);else if(d){i.href=d;try{h=new URL(d),h.origin!==location.origin&&(h=null)}catch{}m!==``&&(i.target=m??`_blank`)}if(h&&(i.target||`_self`)===`_self`){i.addEventListener(`click`,()=>{p=n,requestIdleCallback(()=>{p===n&&(p=null)})});let{pathname:t,search:r}=h,o=(r||`?`)===`?`?t:`${t}${r}`,l=s.get(o);l?l.push(n):s.set(t,[n]);let d=a.get(o);if(d?d.push([n,r.length]):a.set(t,[[n,r.length]]),g&&(!u||u[0]===`?`||u[0]===`#`)){let t=e.stringify(g),r=c.get(t);r?r.push(n):c.set(t,[n])}}for(let e of t.buttons||[])n.appendChild(f(e));return n.className=`NavMenu-item`,{el:n,filter(e,t){let r=t?ht(t,i):[];return n.hidden=!!(!e&&t&&!r.length),r}}}let l=document.createElement(`nl-collapse`);l.setAttribute(`animation`,``),l.setAttribute(`menu`,``);let u=l.appendChild(document.createElement(`div`));u.appendChild(document.createTextNode(t.label||t.title||``)),u.className=`NavMenu-label`,u.slot=`label`,u.style.flex=`1`;for(let e of t.buttons||[])l.appendChild(f(e)).slot=`label`;let d=g(l,i,n+1);return d.length?{el:l,filter(e,t){if(!t){for(let t of d)t.filter(e);return l.hidden=!1,l.open=!1,[]}let n=ht(t,u),r=!!(e||n.length),i=d.flatMap(e=>e.filter(r,t));l.open=!!i.length;let a=[...n,...i];return l.hidden=!e&&!a.length,a}}:null}function g(e,t,n){let r=!1,i=!1,a=[];for(let o of t){if(!o){if(!r)continue;i=!0;continue}i&&(i=!1,e.appendChild(document.createElement(`hr`)));let t=m(o,n);t&&(a.push(t),r=!0,e.appendChild(t.el),u.push(t.el),t.el.style.setProperty(`--NavMenu-level`,String(n)))}return a}let _=g(t,n,0),v=!1;function y(){if(!v){v=!0;for(let e of u)e.remove();for(let e of d)e()}}let b=i.signal||h;b.aborted?y():b.addEventListener(`abort`,y,{once:!0});let S=[];return x(()=>{let e=i.active;return e?typeof e==`string`?e.replace(/#.*/,``)||``:Array.isArray(e)?e[1]?[e[0]?.replace(/#.*/,``)||``,e[1]||null]:e[0]?.replace(/#.*/,``)||null:null:null},e=>{if(!e)return;let n=Array.isArray(e)?e[0]:``,r=Array.isArray(e)?e[1]:null;for(let e of pt(n,s,a,r,c)){let n=p&&e.includes(p)?p:null;if(n&&(p=null),!n&&l&&e.includes(l))return;let r=n||e[0],i=[],a=r.parentElement;for(;a&&a!==t;a=a.parentElement)i.push(a);if(a!==t)return;S=i,l?.classList.remove(`NavMenu-current`);for(let e of S)e.setAttribute(`open`,``);l=r,l?.classList.add(`NavMenu-current`);return}},{signal:b,immediate:!0}),e=>{let t=e.toLowerCase().split(/[\s\n]+/).filter(Boolean);if(t.length)return _.flatMap(e=>e.filter(!1,t));_.flatMap(e=>e.filter(!1));for(let e of S)e.setAttribute(`open`,``);return[]}}const I=document.createElement(`div`);I.style.display=`flex`,I.style.flexDirection=`column`;const _t=I.appendChild(document.createElement(`header`));_t.classList.add(`NavMenu-header`);const vt=_t.appendChild(document.createElement(`input`));vt.placeholder=`过滤菜单...`,vt.type=`search`;const L=_t.appendChild(document.createElement(`button`));L.appendChild(l(`refresh`,!0)),L.classList.add(`icon`),L.title=`刷新`;const R=I.appendChild(document.createElement(`main`));R.style.flex=`1`,R.style.overflow=`auto`,R.classList.add(`NavMenu`);let yt=null;function bt(){let e=yt?.(vt.value)||[],t=new Highlight(...e);CSS.highlights.set(`NavMenu-filter-highlight`,t)}vt.addEventListener(`input`,bt);const xt=s(()=>t.fromDefine(o.menus,[])),St=s(()=>{let e=a.permissions,n=xt.get();if(e.size<0)return n;let r=y({permissions:e,organizationPermissions:a.organizationPermissions,allOrganizationPermissions:a.allOrganizationPermissions});return t.filter(n,e=>{let t=m(e.permission);return t.length?!!t.find(r):!0})}),Ct=d(``);let wt=null;p(()=>{wt?.abort(),R.innerHTML=``,wt=new AbortController,yt=gt(R,St.get(),{signal:wt.signal,get active(){return Ct.get()}}),bt()});function Tt(e,t,n,r){if(!r){Ct.set(`${e}${t}`);return}Ct.set([`${e}${t}`,r])}L.addEventListener(`click`,()=>o.refresh());function Et(e,t,n){if(!e){let e=l(`user`,t);return n||e.setAttribute(`fill-opacity`,`0.5`),e}let r=document.createElement(`img`);return r.src=e,r}function Dt(e,t,n=h){e.classList.add(`${S}-user-avatar`);let r=s(()=>a.single?null:a.session?.avatar||``).get(),i=new AbortController,o=AbortSignal.any([i.signal,n]),c=r===null?l(`singleUser`,o):Et(r,o,t);e.appendChild(c),p(()=>{let o=a.single?null:a.session?.avatar||``;if(o===r)return;r=o,i?.abort(),i=new AbortController;let s=AbortSignal.any([i.signal,n]),u=r===null?l(`singleUser`,s):Et(r,s,t);!t&&r===null&&u.setAttribute(`fill-opacity`,`0.5`),e.replaceChild(u,c),c.remove(),c=u},n);let u=s(()=>{let e=a.target,t=a.session;return!e||e.id===(t?.id||``)?null:e.avatar||``}),d=null,f=null,m=null;p(()=>{let r=u.get();r!==d&&(d=r,f?.remove(),f=null,m?.abort(),r!==null&&(m=new AbortController,f=Et(r,AbortSignal.any([m.signal,n]),t),e.insertBefore(f,c)))},n)}const z=document.createElement(`div`);z.classList.add(`${S}-user`);const B=document.createElement(`div`);B.classList.add(`${S}-user-button`),Dt(B,!0);const V=z.appendChild(document.createElement(`span`));V.classList.add(`${S}-user-info`);const Ot=V.appendChild(document.createElement(`span`));Dt(Ot),Ot.classList.add(`avatar`);const kt=V.appendChild(document.createElement(`span`));kt.classList.add(`username`),kt.innerText=`用户名`;const At=V.appendChild(document.createElement(`span`));if(At.classList.add(`btns`),o.help){let e=At.appendChild(document.createElement(`a`));e.href=o.help,e.target=`_blank`,e.appendChild(l(`help`,!0)),e.title=`帮助`}const H=At.appendChild(document.createElement(`div`));H.appendChild(l(`logout`,!0)),H.title=`退出登录`,p(()=>{H.hidden=!a.current}),H.addEventListener(`click`,()=>a.exit()),p(()=>{kt.innerText=a.current?.name||``});const jt=s(()=>t.fromDefine(o.userMenus,[])),Mt=s(()=>{let e=jt.get();return a.current?e:t.filter(e,e=>!e.logged)}),U=z.appendChild(document.createElement(`main`));U.style.flex=`1`,U.style.overflow=`auto`,U.classList.add(`NavMenu`);let Nt=null;p(()=>{Nt?.abort(),U.innerHTML=``,Nt=new AbortController,gt(U,Mt.get(),{signal:Nt.signal})});const W=document.createElement(`a`);W.classList.add(`${S}-logo`),W.href=o.root,x(()=>{let e=o.logo;return e&&v(e)},e=>{if(W.innerHTML=``,e){let t=W.appendChild(document.createElement(`img`));t.src=e.href,t.classList.add(`logo`)}else W.appendChild(l(`logo`,!0)).classList.add(`logo`)},{immediate:!0});const Pt={404:{title:`您所请求的页面无法找到`,description:`服务器无法正常提供信息。
|
|
747
|
+
目标页面可能已经被更改、删除或移到其他位置,或您所输入页面地址错误。`}};function Ft(e,t){if((t??``)==``){e.container.appendChild(document.createTextNode(`空页面`));return}let n=(typeof t==`number`||typeof t==`string`)&&Object.hasOwn(Pt,t)&&Pt[t]||Pt[404],r=n?.title||`Error`,i=n?.description,a=document.createElement(`div`),o=a.appendChild(document.createElement(`div`)),s=o.appendChild(document.createElement(`div`)),c=o.appendChild(document.createElement(`div`));if(a.style.marginBlock=`8%`,a.style.marginInline=`auto`,a.style.inlineSize=`600px`,a.style.maxInlineSize=`100%`,a.style.padding=`20px`,s.style.paddingBlock=`20px`,s.style.fontSize=`20px`,s.style.color=`#8e8e8e`,s.style.textAlign=`center`,c.style.fontSize=`13px`,c.style.lineHeight=`1.3em`,c.style.color=`#b5b5b5`,s.appendChild(document.createTextNode(r)),e.title=r||`Error`,i&&typeof i==`string`)for(let e of i.split(`
|
|
748
|
+
`))c.appendChild(document.createTextNode(e)),c.appendChild(document.createElement(`br`));e.container.appendChild(a),e.loading=!1}const G=`${S}-allSider-nav`,It=document.createElement(`header`);It.className=`${G}-header`;const K=It.appendChild(document.createElement(`div`));K.classList.add(`${G}-actions`);const Lt=It.appendChild(document.createElement(`div`));Lt.classList.add(`${G}-sidebar`);const Rt=`${G}-open`;let q=null;function zt(){window.innerWidth>800||q?.()}var Bt=class{button;sider;#e;#t=!1;get disabled(){return this.#t}set disabled(e){e?this.disable():this.enable()}disable(){if(this.#t)return;this.#t=!0;let e=this.#e;q===e&&e(),this.button.hidden=!0,this.sider.hidden=!0}enable(){this.#t&&(this.#t=!1,this.button.hidden=!1)}#n=()=>this.toggle();constructor(e,t){let n=t instanceof HTMLElement?t:document.createElement(`div`),r=e instanceof HTMLElement?e:document.createElement(`div`);n.tabIndex=0,n.classList.add(`${G}-button`),r.hidden=!0,Lt.appendChild(r),n.classList.add(`${G}-selectable`),n.addEventListener(`click`,this.#n),this.#e=()=>{q=null,document.body.classList.remove(Rt),n.classList.remove(`${G}-selected`),r.hidden=!0},this.button=n,this.sider=r}get open(){return q===this.#e}set open(e){e?this.show():this.hide()}show(){if(this.#t)return;let e=this.#e;q!==e&&(q?.(),q=e,document.body.classList.add(Rt),this.button.classList.add(`${G}-selected`),this.sider.hidden=!1)}toggle(){if(this.#t)return;let e=this.#e;if(q===e){e();return}this.show()}hide(){if(this.#t)return;let e=this.#e;q===e&&e()}remove(){let e=this.#e;q===e&&e();let{button:t,sider:n}=this;t.remove(),n.remove(),t.classList.remove(`${G}-button`),t.classList.remove(`${G}-selectable`),t.removeEventListener(`click`,this.#n),n.hidden=!1}};Lt.addEventListener(`click`,e=>{e.target===e.currentTarget&&q?.()});var Vt=class e{root=document.createElement(`div`);#e=new Set;constructor(e){let t=this.root;e.appendChild(t),t.className=`${G}-group`}remove(){this.root.remove();for(let e of[...this.#e])e()}createGroup(){let t=new e(this.root),n=this.#e,r=()=>{n.delete(r),t.remove()};return n.add(r),t}createAction(e){let t=document.createElement(e?`a`:`div`);t.tabIndex=0,t.classList.add(`${G}-button`),t.addEventListener(`click`,()=>{zt()}),this.root.appendChild(t);let n=this.#e,r=()=>{n.delete(r),t.remove()};return n.add(r),t}createSider(e,t){let n=new Bt(e,t);this.root.appendChild(n.button);let r=this.#e,i=()=>{r.delete(i),n.remove()};return r.add(i),n}};const Ht=document.createElement(`div`),Ut=new Vt(K),Wt=new Vt(K);new Vt(K),K.appendChild(document.createElement(`span`));const Gt=new Vt(K),J=Wt.createSider(Ht);J.button.innerText=`页面`,J.disabled=!0;var Kt=class extends i{#e;#t;constructor(e,t,n,r,i){super(t,n,r,i),this.#e=e,this.#t=t,i.addEventListener(`abort`,()=>{this.#n()})}insert(){super.insert(),this.#e.show&&(J.disabled=!1)}#n(){this.#e.show&&!this.#t.children.length&&(J.disabled=!0)}remove(){super.remove(),this.#n()}},qt=class extends n{#e=(()=>{let e=document.createElement(`div`);return e.classList.add(`Page-sides`),Ht.appendChild(e),e})();destroy(){return super.destroy()?(this.#e.remove(),!0):!1}toggle(e){super.toggle(e),J.disabled=!(e&&this.#e.children.length)}get siderOpen(){return J.open}set siderOpen(e){e?J.show():J.hide()}createSider(e,t){if(this.destroyed)throw Error(`页面组件已被销毁`);t?.throwIfAborted();let n=this.#e;return new Kt(this,n,null,e!==!1,t instanceof AbortSignal?AbortSignal.any([t,this.signal]):this.signal)}constructor(e){super(e),e&&(J.disabled=!this.#e.children.length)}};function Jt(e,t,n){let r=document.createElement(`nl-menu`),i=!1,a=!1,o=()=>{i=!0,a&&(a=!1,r.appendChild(document.createElement(`hr`)))};for(let s of e){if(!s){if(!i)continue;a=!0;continue}let{children:e}=s;if(!e?.length){let e=new AbortController,i=t(s,AbortSignal.any([n,e.signal]));if(!i){e.abort();continue}o(),r.appendChild(i);continue}let c=Jt(e,t,n);if(!c)continue;o();let l=r.appendChild(c),u=l.insertBefore(document.createElement(`div`),l.firstChild);u.appendChild(document.createTextNode(s.label||s.title||``)),u.slot=`label`}return i?r:null}function Yt(e,t,n){if(n.aborted)return null;let r=document.createElement(`div`),i=!1,a=!1,o=()=>{i=!0,a&&(a=!1,r.appendChild(document.createElement(`hr`)))};for(let s of e){if(!s){if(!i)continue;a=!0;continue}let{children:e}=s;if(!e?.length){let e=new AbortController,i=t(s,AbortSignal.any([n,e.signal]),!0);if(!i){e.abort();continue}o(),r.appendChild(i);continue}let c=Jt(e,t,n);if(!c)continue;o();let l=r.appendChild(document.createElement(`button`));l.appendChild(document.createTextNode(s.label||s.title||``)),c.targetElement=l,l.addEventListener(`click`,()=>c.show?.()),r.appendChild(c)}return r.childNodes.length?(r.classList.add(`MenuButtons`),r):null}function Xt(e,t,n){let r=document.createElement(`a`),i=n?document.createElement(`button`):null;r.appendChild(document.createTextNode(e.label||e.title||``));let{page:a,path:s,uri:c,target:l,command:u,script:d,click:f}=e;function m(){let t=e.disabled;return!!(typeof t==`function`?t():t)}return p(()=>{let e=m();r.disabled=e,i&&(i.disabled=e)},t),a?(r.href=new URL(s?.[0]===`/`?`${a}${s}`:`${a}/${s||``}`,o.root).href,l&&typeof l==`string`&&(r.target=l)):c?(r.href=c,l!==``&&(r.target=l??`_blank`)):typeof f==`function`?r.addEventListener(`click`,e=>{m()||e.defaultPrevented||f()}):(u||d)&&r.addEventListener(`click`,e=>{m()||e.defaultPrevented}),i?(i.appendChild(r),i):r}function Zt(e,t,n,r){let i=document.createElement(`div`),a=Jt(e,n,r);if(!a)return null;let o=i.appendChild(document.createElement(`button`)),s=t?.label||t?.title||``;return s?o.appendChild(document.createTextNode(s)):o.appendChild(l(t?.icon||`more`,r)),a.targetElement=o,o.addEventListener(`click`,()=>a.show()),i.appendChild(a),i}var Qt={title(e){return[e.title,o.title||`拥道YongDall`].filter(Boolean).join(` | `)},icon(e){return e.icon},components:{List:te,Pagination:ut,createMenuButtons:Yt,createMenuItem:Xt,createMenuButton:Zt},updatePath:Tt,pageManager:ee,elements:[g,It],classNames:[S,`${S}-allSider`],styleFiles:[`theme-allSider.css`],home:dt,rootClassName:`${S}-root`,createFrame:c,createPage(e){return new qt(e)},renderError(e,t){Ft(e,t)},setup(e){O(!1),W.addEventListener(`click`,()=>{zt()},{signal:e}),K.insertBefore(W,K.firstElementChild);let t=Ut.createSider(I);t.button.appendChild(l(`menu`,e)),t.button.title=`菜单`;let n=Ut.createSider(w);n.button.appendChild(l(`activity`,e)),n.button.title=`活动`,window.innerWidth>800&&t.show();let r=Gt.createSider(z,B);e.addEventListener(`abort`,()=>{W.remove(),t.remove(),n.remove(),r.remove()},{once:!0})}};const Y=`${S}-base`,$t=[`theme-base.css`],en=document.createElement(`header`),X=en.appendChild(document.createElement(`div`));X.classList.add(`${Y}-header`);const tn=en.appendChild(document.createElement(`div`));tn.classList.add(`${Y}-sidebar`);const nn=X.appendChild(l(`menu`,!0));nn.classList.add(`${Y}-menu-button`);const rn=X.appendChild(document.createElement(`span`)),an=`${Y}-menu-open`;nn.addEventListener(`click`,()=>{document.body.classList.toggle(an)}),tn.addEventListener(`click`,e=>{e.target===e.currentTarget&&document.body.classList.remove(an)});let on=null;var sn={title(e){return[[on&&e.loading?`⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏`[on.get()%10]:``,e.unsaved?`🔴`:``,e.title].join(``),o.title||`拥道YongDall`].filter(Boolean).join(` | `)},icon(e){return e.icon},components:{List:te,Pagination:ut,createMenuButtons:Yt,createMenuItem:Xt,createMenuButton:Zt},updatePath:Tt,pageManager(e){let t=!1;p(()=>{if(!e.current){t&&e.destroy();return}t=!0},e.signal)},elements:[en,g],classNames:[S,Y],styleFiles:$t,home:dt,rootClassName:`${S}-root`,createFrame:c,createPage(e){return new n(e)},renderError(e,t){Ft(e,t)},setup(e){on=f(80,e),W.addEventListener(`click`,()=>{window.innerWidth>800||document.body.classList.remove(an)},{signal:e});let t=document.createElement(`div`);t.classList.add(`${Y}-header-title`),p(()=>{t.innerText=o.title||o.company||``},e),X.insertBefore(W,rn),X.insertBefore(t,rn),window.innerWidth>800&&document.body.classList.add(an),tn.appendChild(I),document.body.appendChild(z),z.setAttribute(`popover`,`auto`),B.addEventListener(`click`,()=>{z.showPopover()},{signal:e}),X.appendChild(B),e.addEventListener(`abort`,()=>{W.remove(),t.remove(),I.remove(),z.removeAttribute(`popover`),z.remove(),B.remove()},{once:!0})}};const Z=`${S}-tabs`,cn=document.createElement(`header`),Q=cn.appendChild(document.createElement(`div`));Q.classList.add(`${Z}-header`);const ln=cn.appendChild(document.createElement(`div`));ln.classList.add(`${Z}-sidebar`);const un=Q.appendChild(l(`menu`,!0));un.classList.add(`${Z}-menu-button`);const dn=Q.appendChild(document.createElement(`span`)),$=`${Z}-menu-open`;un.addEventListener(`click`,()=>{document.body.classList.toggle($)});function fn(){window.innerWidth>800||document.body.classList.remove($)}ln.addEventListener(`click`,e=>{e.target===e.currentTarget&&document.body.classList.remove($)});var pn={title(e){return[e.title,o.title||`拥道YongDall`].filter(Boolean).join(` | `)},icon(e){return e.icon},components:{List:te,Pagination:ut,createMenuButtons:Yt,createMenuItem:Xt,createMenuButton:Zt},updatePath:Tt,pageManager:ee,elements:[cn,g],classNames:[S,`${S}-tabs`],styleFiles:[`theme-tabs.css`],home:dt,rootClassName:`${S}-root`,createFrame:c,createPage(e){return new n(e)},renderError(e,t){Ft(e,t)},setup(e){O(!0),W.addEventListener(`click`,()=>{fn()},{signal:e});let t=document.createElement(`div`);t.classList.add(`${Z}-header-title`),p(()=>{t.innerText=o.title||o.company||``},e),Q.insertBefore(W,dn),Q.insertBefore(t,dn),cn.appendChild(w),window.innerWidth>800&&document.body.classList.add($),ln.appendChild(I),document.body.appendChild(z),z.setAttribute(`popover`,`auto`),B.addEventListener(`click`,()=>{z.showPopover()},{signal:e}),Q.appendChild(B),e.addEventListener(`abort`,()=>{W.remove(),t.remove(),w.remove(),I.remove(),z.removeAttribute(`popover`),z.remove(),B.remove()},{once:!0})}};export{Qt as allSider,Qt as theme,sn as base,sn as tradition,pn as tabs};
|
|
749
749
|
//# sourceMappingURL=index.mjs.map
|