@yongdall/theme 0.1.0 → 0.1.2
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/assets.yongdall.mjs +2 -2
- package/hooks.mjs +1 -1
- package/hooks.mjs.map +1 -1
- package/hooks.yongdall.mjs +14 -7
- package/hooks.yongdall.mjs.map +1 -1
- package/index.mjs +25 -25
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/theme-base.css +210 -0
- package/theme-base.css.map +1 -0
- package/{theme-tradition.css → theme-tabs.css} +41 -41
- package/theme-tabs.css.map +1 -0
- package/theme-tabs.mjs +0 -0
- package/theme-tradition.css.map +0 -1
- /package/{theme-tradition.mjs → theme-base.mjs} +0 -0
package/hooks.yongdall.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.yongdall.mjs","names":[],"sources":["../../packages/theme/hooks.yongdall.mjs"],"sourcesContent":["export const enumerations = {\n\ttheme: [\n\t\t{ theme: '@yongdall/theme#allSider', label: '全侧主题' },\n\t\t{ theme: '@yongdall/theme#
|
|
1
|
+
{"version":3,"file":"hooks.yongdall.mjs","names":[],"sources":["../../packages/theme/hooks.yongdall.mjs"],"sourcesContent":["export const enumerations = {\n\ttheme: [\n\t\t{ theme: '@yongdall/theme#allSider', label: '全侧主题' },\n\t\t{ theme: '@yongdall/theme#base', label: '基础主题' },\n\t\t{ theme: '@yongdall/theme#tabs', label: '多页主题' },\n\t]\n};\n"],"mappings":";AAAA,MAAa,eAAe,EAC3B,OAAO;CACN;EAAE,OAAO;EAA4B,OAAO;EAAQ;CACpD;EAAE,OAAO;EAAwB,OAAO;EAAQ;CAChD;EAAE,OAAO;EAAwB,OAAO;EAAQ;CAChD,EACD"}
|
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Menu as e,Page as t,PageSider as n,User as r,configuration as i,createComputed as a,createIcon as o,createShowField as s,createState as c,effect as l,filterPermission as u,loadMenu as d,neverAbortedSignal as f,root as p,runPattern as m,toFileLink as h,userMenus as g,waitAbortSignal as _,watch as v,webRoot as y}from"@yongdall/web";const b=`YongDallTheme`,x=`${b}-activity`,S=document.createElement(`div`);S.classList.add(x);const ee=new Map;let C;function w(e){document.title=[e?e.title:``,i.title||`拥道YongDall`].filter(Boolean).join(` | `)}
|
|
1
|
+
import{Menu as e,Page as t,PageSider as n,User as r,configuration as i,createComputed as a,createIcon as o,createShowField as s,createState as c,effect as l,filterPermission as u,loadMenu as d,neverAbortedSignal as f,root as p,runPattern as m,toFileLink as h,userMenus as g,waitAbortSignal as _,watch as v,webRoot as y}from"@yongdall/web";const b=`YongDallTheme`,x=`${b}-activity`,S=document.createElement(`div`);S.classList.add(x);const ee=new Map;let C,w=!1;function te(e){w=e}function T(e){document.title=[e?e.title:``,i.title||`拥道YongDall`].filter(Boolean).join(` | `)}T();var E=e=>{let t=document.createElement(`div`);t.classList.add(`${x}-page`);let n=t.appendChild(document.createElement(`a`));n.classList.add(`${x}-title`),n.href=e.href,n.innerText=e.title;let r=t.appendChild(document.createElement(`button`));r.type=`button`,r.classList.add(`${x}-close`),r.addEventListener(`click`,()=>{e.destroy()});let i={button:t,link:n,next:C};C&&(C.last=i),C=i,ee.set(e,i),S.insertBefore(t,w?null:S.firstChild),l(()=>{e.current&&T(e)},e.signal),l(()=>{n.innerText=e.title},e.signal),l(()=>{n.href=e.href},e.signal),l(()=>{e.current?t.classList.add(`${x}-current`):t.classList.remove(`${x}-current`)},e.signal),l(()=>{e.loading?t.classList.add(`${x}-loading`):t.classList.remove(`${x}-loading`)},e.signal),l(()=>{e.unsaved?t.classList.add(`${x}-unsaved`):t.classList.remove(`${x}-unsaved`)},e.signal),_(e.signal).then(()=>{let{last:e,next:n}=i;e&&(e.next=n),n&&(n.last=e),C===i&&(C=n),t.remove()})},D=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`)),c=o.appendChild(document.createElement(`td`)),l=m(n,a)||t.map(e=>a[e]).join(`$`);if(i){let e=c.appendChild(document.createElement(`a`));e.href=i(t.map(e=>a[e]).join(`$`)),e.appendChild(document.createTextNode(l))}else c.appendChild(document.createTextNode(l));for(let[e,t]of r){let n=o.appendChild(document.createElement(`td`)),r=s(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 O(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){O(this,`non-trigger`,e)}get startTrigger(){return this.getAttribute(`start-trigger`)!==null}set startTrigger(e){O(this,`start-trigger`,e)}get accordion(){return this.getAttribute(`accordion`)!==null}set accordion(e){O(this,`accordion`,e)}get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){O(this,`disabled`,e)}get open(){return this.getAttribute(`open`)!==null}set open(e){O(this,`open`,e)}get animation(){return this.getAttribute(`animation`)!==null}set animation(e){O(this,`animation`,e)}get menu(){return this.getAttribute(`menu`)!==null}set menu(e){O(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,ee]]=i,[C,w]=_?[m,h]:[h,m],te=f.find(e=>e===`start`?S+ee>C:e===`end`?S+x>C:!0)||``,T=g===`inlineStart`||g===`blockStart`?v-w:v+y,E=0;switch(te){case`start`:E=x;break;case`end`:E=x+S-C;break;default:E=Math.max(18,Math.min(x+S/2-C/2,x+S+ee-18-C));break}_&&([T,E]=[E,T]),e.style.insetBlockStart=`${E}px`,e.style.insetInlineStart=`${T}px`;let D=this.#l;D&&D.#_()}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 k=[];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 k){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 k)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),k.push(this.#n),Te())})})}#d(){let e=k.indexOf(this.#n);e<0||(k.splice(e,1),!(e>=k.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 A(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){A(this,`open`,e)}get cancelable(){return this.hasAttribute(`cancelable`)}set cancelable(e){A(this,`cancelable`,e)}get closable(){return this.hasAttribute(`closable`)}set closable(e){A(this,`closable`,e)}get mask(){return this.hasAttribute(`mask`)}set mask(e){A(this,`mask`,e)}get maskClosable(){return this.hasAttribute(`mask-closable`)}set maskClosable(e){A(this,`mask-closable`,e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){A(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,w()}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),w()}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(),w(),e.inertia&&(t||(v=requestAnimationFrame(r)))};r()}function S(){cancelAnimationFrame(v),g=``,_=void 0}let ee={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,w()}},C=()=>{};function w(){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&&(C=t.register(ee))},()=>{C()},i]}function j(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){j(this,`inertia`,e)}get touchCapture(){return this.getAttribute(`touch-capture`)!==null}set touchCapture(e){j(this,`touch-capture`,e)}get touchMovable(){return this.getAttribute(`touch-movable`)!==null}set touchMovable(e){j(this,`touch-movable`,e)}get touchScalable(){return this.getAttribute(`touch-scalable`)!==null}set touchScalable(e){j(this,`touch-scalable`,e)}get rollerMovable(){return this.getAttribute(`roller-movable`)!==null}set rollerMovable(e){j(this,`roller-movable`,e)}get rollerMovableCapture(){return this.getAttribute(`roller-movable-capture`)!==null}set rollerMovableCapture(e){j(this,`roller-movable-capture`,e)}get rollerScalable(){return this.getAttribute(`roller-scalable`)!==null}set rollerScalable(e){j(this,`roller-scalable`,e)}get leftMouseMovable(){return this.getAttribute(`left-mouse-movable`)!==null}set leftMouseMovable(e){j(this,`left-mouse-movable`,e)}get leftMouseMovableCapture(){return this.getAttribute(`left-mouse-movable-capture`)!==null}set leftMouseMovableCapture(e){j(this,`left-mouse-movable-capture`,e)}get autoAdaptively(){return this.getAttribute(`adaptively`)!==null}set autoAdaptively(e){j(this,`adaptively`,e)}get global(){return this.getAttribute(`global`)!==null}set global(e){j(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,M=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 Ze);)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 N(e){let t=document.createElement(`style`);return t.textContent=e,t}var ze=class extends M{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(N(``));#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 M{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(N(``));#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 M{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(N(``));#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 M{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(N(`
|
|
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 M{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(N(``));#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 M{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(N(``));#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 M{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(N(``));#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 P(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 Xe(e){if(!e)return 0;let t=parseInt(e);return Number.isNaN(t)||t<0?0:t}var Ze=class extends HTMLElement{static get Widget(){return M}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 Xe(this.getAttribute(`size`))||0}set size(e){P(this,`size`,e)}get total(){return Xe(this.getAttribute(`total`))||0}set total(e){P(this,`total`,e)}get pages(){let e=Xe(this.getAttribute(`pages`));if(e)return e;let{size:t}=this;return t&&Math.ceil(this.total/t)||1}set pages(e){P(this,`pages`,e)}get page(){return Math.min(Xe(this.getAttribute(`page`))||1,this.pages)}set page(e){P(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`,Ze),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 Qe=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`,Qe)}catch{}function $e(e){return e?/^\d+$/.test(e)?`${e}px`:e:`0`}function et(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 tt(e){if(typeof e!=`number`)return 0;let t=Math.floor(e);return Number.isFinite(t)&&t>1?t:0}var nt=class extends HTMLElement{static observedAttributes=[`aliquot`,`gutter-inline`,`gutter-block`];#e=document.createElement(`style`);#t=document.createElement(`style`);get gutterInline(){return $e(this.getAttribute(`gutter-inline`))}set gutterInline(e){this.setAttribute(`gutter-inline`,String(e))}get gutterBlock(){return $e(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=tt(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=et(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`,nt)}catch{}var rt=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`,rt)}catch{}function it(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 at(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 ot=new Set([`vertical-lr`,`vertical-rl`,`sideways-lr`,`sideways-rl`]);function st(e){let t=getComputedStyle(e),n=t.writingMode?.toLowerCase(),r=ot.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 ct=class extends HTMLElement{static observedAttributes=[`column`,`disabled`,`min`,`max`,`value`];get column(){return this.getAttribute(`column`)!==null}set column(e){it(this,`column`,e)}get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){it(this,`disabled`,e)}get min(){return F(this.getAttribute(`min`),0,0,1)}set min(e){at(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){at(this,`max`,e,this.min,1)}get value(){return F(this.getAttribute(`value`),.5,this.min,this.max)}set value(e){at(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),at(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]=at(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]=at(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`,ot)}catch{}var st=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 ct(e){e.listen(`update`,()=>{let{container:t}=e;t.innerHTML=``})}function*lt(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let e;e=t.nextNode();)yield e}function ut(e,t){let n=[],r=[...lt(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 dt(e,t,n,r={}){let i=new Map,a=null,o=[],s=[];function c(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}function l(e,t){let{children:r}=e;if(!r.length){let t=document.createElement(`div`),r=new AbortController,a=n(e,r.signal);if(!a)return r.abort(),null;s.push(()=>{r.abort()}),t.appendChild(a);for(let n of e.buttons||[])t.appendChild(c(n));t.className=`NavMenu-item`;let{page:o,path:l}=e;if(o){let e=`${o}/${l}`,n=i.get(e);n?n.push(t):i.set(e,[t])}return{el:t,filter(e,n){let r=n?ut(n,a):[];return t.hidden=!!(!e&&n&&!r.length),r}}}let a=document.createElement(`nl-collapse`);a.setAttribute(`animation`,``),a.setAttribute(`menu`,``);let o=a.appendChild(document.createElement(`div`));o.appendChild(document.createTextNode(e.label||e.title||``)),o.className=`NavMenu-label`,o.slot=`label`,o.style.flex=`1`;for(let t of e.buttons||[])a.appendChild(c(t)).slot=`label`;let l=u(a,r,t+1);return l.length?{el:a,filter(e,t){if(!t){for(let t of l)t.filter(e);return a.hidden=!1,a.open=!1,[]}let n=ut(t,o),r=!!(e||n.length),i=l.flatMap(e=>e.filter(r,t));a.open=!!i.length;let s=[...n,...i];return a.hidden=!e&&!s.length,s}}:null}function u(t,n,r){let i=!1,a=!1,s=[];for(let c of n){if(!c){if(!i)continue;a=!0;continue}a&&(a=!1,e.appendChild(document.createElement(`hr`)));let n=l(c,r);n&&(s.push(n),i=!0,t.appendChild(n.el),o.push(n.el),n.el.style.setProperty(`--NavMenu-level`,String(r)))}return s}let d=u(e,t,0);function p(t){let n=i.get(t)?.[0];if(!n)return;let r=[],o=n.parentElement;for(;o&&o!==e;o=o.parentElement)r.push(o);if(o===e){a?.classList.remove(`NavMenu-current`);for(let e of r)e.setAttribute(`open`,``);a=n,a?.classList.add(`NavMenu-current`)}}let m=!1;function h(){if(!m){m=!0;for(let e of o)e.remove();for(let e of s)e()}}let g=r.signal||f;return g.aborted?h():g.addEventListener(`abort`,h,{once:!0}),v(()=>r.active||``,e=>{e&&p(e)},{signal:g,immediate:!0}),e=>{let t=e.toLowerCase().split(/[\s\n]+/).filter(Boolean);return t.length||(t=null),d.flatMap(e=>e.filter(!1,t))}}const I=document.createElement(`div`);I.style.display=`flex`,I.style.flexDirection=`column`;const ft=I.appendChild(document.createElement(`header`));ft.classList.add(`NavMenu-header`);const L=ft.appendChild(document.createElement(`input`));L.placeholder=`过滤菜单...`,L.type=`search`;const R=ft.appendChild(document.createElement(`button`));R.appendChild(o(`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 pt=0,mt=!1,ht=null;function gt(){let e=ht?.(L.value)||[],t=new Highlight(...e);CSS.highlights.set(`NavMenu-filter-highlight`,t)}L.addEventListener(`input`,gt);const _t=c([]),vt=a(()=>{let t=r.permissions,n=_t.get();return t?e.filter(n,e=>{let n=e.permission;return n?u(n,t):!0}):n});let yt=null;l(()=>{yt?.abort(),z.innerHTML=``,yt=new AbortController,ht=dt(z,vt.get(),e.createItem,{signal:yt.signal}),gt()});async function bt(t=!1){if(R.disabled)return;R.disabled=!0,++pt;let n=pt,r=`application`,a=i.application||``,o=await d(r,a,t);mt&&n!==pt||(R.disabled=!1,mt=!0,_t.set(e.build(o,r,a,[])))}R.addEventListener(`click`,()=>bt(!0));function xt(e,t,n){if(!e){let e=o(`user`,t);return n||e.setAttribute(`fill-opacity`,`0.5`),e}let r=document.createElement(`img`);return r.src=e,r}function St(e,t){e.classList.add(`${b}-user-avatar`);let n=[],s,c=new AbortController;if(n.push(()=>c.abort()),i.single)s=o(`singleUser`,new AbortController().signal),t||s.setAttribute(`fill-opacity`,`0.5`),e.appendChild(s);else{let i=``,o=new AbortController;s=xt(i,o.signal,t),e.appendChild(s);let u=a(()=>r.session?.avatar||``);l(()=>{let n=u.get();if(n===i)return;i=n,o?.abort(),o=new AbortController;let r=xt(i,o.signal,t);e.replaceChild(r,s),s=r},c.signal),n.push(()=>{o?.abort(),o=null})}let u=a(()=>{let e=r.target,t=r.session;return!e||e.id===(t?.id||``)?null:e.avatar||``}),d=null,f=null,p=null;return l(()=>{let n=u.get();n!==d&&(d=n,f?.remove(),f=null,p?.abort(),n!==null&&(p=new AbortController,f=xt(n,p.signal,t),e.insertBefore(f,s)))},c.signal),n.push(()=>{p?.abort(),p=null}),()=>{for(let e of n)e()}}const B=document.createElement(`div`);B.classList.add(`${b}-user`);const V=document.createElement(`div`);V.classList.add(`${b}-user-button`),St(V,!0);const H=B.appendChild(document.createElement(`span`));H.classList.add(`${b}-user-info`);const Ct=H.appendChild(document.createElement(`span`));St(Ct),Ct.classList.add(`avatar`);const wt=H.appendChild(document.createElement(`span`));wt.classList.add(`username`),wt.innerText=`用户名`;const Tt=H.appendChild(document.createElement(`span`));if(Tt.classList.add(`btns`),i.help){let e=Tt.appendChild(document.createElement(`a`));e.href=i.help,e.target=`_blank`,e.appendChild(o(`help`,!0)),e.title=`帮助`}const U=Tt.appendChild(document.createElement(`div`));U.appendChild(o(`logout`,!0)),U.title=`退出登录`,l(()=>{U.hidden=!r.current}),U.addEventListener(`click`,()=>r.exit()),l(()=>{wt.innerText=r.current?.name||``});const Et=c([]);Et.set(e.fromDefine(g,[]));const Dt=a(()=>{let t=Et.get();return r.current?t:e.filter(t,e=>!e.logged)}),W=B.appendChild(document.createElement(`main`));W.style.flex=`1`,W.style.overflow=`auto`,W.classList.add(`NavMenu`);let Ot=null;l(()=>{Ot?.abort(),W.innerHTML=``,Ot=new AbortController,dt(W,Dt.get(),e.createItem,{signal:Ot.signal})});const G=document.createElement(`a`);G.classList.add(`${b}-logo`),G.href=y.href;const kt=i.logo,At=kt&&h(kt);if(At){let e=G.appendChild(document.createElement(`img`));e.src=At.href,e.classList.add(`logo`)}else G.appendChild(o(`logo`,!0)).classList.add(`logo`);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),st(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]=st(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]=st(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`,ct)}catch{}var lt=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 ut(e){e.listen(`update`,()=>{let{container:t}=e;t.innerHTML=``})}function*dt(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let e;e=t.nextNode();)yield e}function ft(e,t){let n=[],r=[...dt(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 pt(e,t,n,r={}){let i=new Map,a=null,o=[],s=[];function c(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}function l(e,t){let{children:r}=e;if(!r.length){let t=document.createElement(`div`),r=new AbortController,a=n(e,r.signal);if(!a)return r.abort(),null;s.push(()=>{r.abort()}),t.appendChild(a);for(let n of e.buttons||[])t.appendChild(c(n));t.className=`NavMenu-item`;let{page:o,path:l}=e;if(o){let e=`${o}/${l}`,n=i.get(e);n?n.push(t):i.set(e,[t])}return{el:t,filter(e,n){let r=n?ft(n,a):[];return t.hidden=!!(!e&&n&&!r.length),r}}}let a=document.createElement(`nl-collapse`);a.setAttribute(`animation`,``),a.setAttribute(`menu`,``);let o=a.appendChild(document.createElement(`div`));o.appendChild(document.createTextNode(e.label||e.title||``)),o.className=`NavMenu-label`,o.slot=`label`,o.style.flex=`1`;for(let t of e.buttons||[])a.appendChild(c(t)).slot=`label`;let l=u(a,r,t+1);return l.length?{el:a,filter(e,t){if(!t){for(let t of l)t.filter(e);return a.hidden=!1,a.open=!1,[]}let n=ft(t,o),r=!!(e||n.length),i=l.flatMap(e=>e.filter(r,t));a.open=!!i.length;let s=[...n,...i];return a.hidden=!e&&!s.length,s}}:null}function u(t,n,r){let i=!1,a=!1,s=[];for(let c of n){if(!c){if(!i)continue;a=!0;continue}a&&(a=!1,e.appendChild(document.createElement(`hr`)));let n=l(c,r);n&&(s.push(n),i=!0,t.appendChild(n.el),o.push(n.el),n.el.style.setProperty(`--NavMenu-level`,String(r)))}return s}let d=u(e,t,0);function p(t){let n=i.get(t)?.[0];if(!n)return;let r=[],o=n.parentElement;for(;o&&o!==e;o=o.parentElement)r.push(o);if(o===e){a?.classList.remove(`NavMenu-current`);for(let e of r)e.setAttribute(`open`,``);a=n,a?.classList.add(`NavMenu-current`)}}let m=!1;function h(){if(!m){m=!0;for(let e of o)e.remove();for(let e of s)e()}}let g=r.signal||f;return g.aborted?h():g.addEventListener(`abort`,h,{once:!0}),v(()=>r.active||``,e=>{e&&p(e)},{signal:g,immediate:!0}),e=>{let t=e.toLowerCase().split(/[\s\n]+/).filter(Boolean);return t.length||(t=null),d.flatMap(e=>e.filter(!1,t))}}const I=document.createElement(`div`);I.style.display=`flex`,I.style.flexDirection=`column`;const mt=I.appendChild(document.createElement(`header`));mt.classList.add(`NavMenu-header`);const ht=mt.appendChild(document.createElement(`input`));ht.placeholder=`过滤菜单...`,ht.type=`search`;const L=mt.appendChild(document.createElement(`button`));L.appendChild(o(`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 gt=0,_t=!1,vt=null;function yt(){let e=vt?.(ht.value)||[],t=new Highlight(...e);CSS.highlights.set(`NavMenu-filter-highlight`,t)}ht.addEventListener(`input`,yt);const bt=c([]),xt=a(()=>{let t=r.permissions,n=bt.get();return t?e.filter(n,e=>{let n=e.permission;return n?u(n,t):!0}):n});let St=null;l(()=>{St?.abort(),R.innerHTML=``,St=new AbortController,vt=pt(R,xt.get(),e.createItem,{signal:St.signal}),yt()});async function z(t=!1){if(L.disabled)return;L.disabled=!0,++gt;let n=gt,r=`application`,a=i.application||``,o=await d(r,a,t);_t&&n!==gt||(L.disabled=!1,_t=!0,bt.set(e.build(o,r,a,[])))}L.addEventListener(`click`,()=>z(!0));function Ct(e,t,n){if(!e){let e=o(`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){e.classList.add(`${b}-user-avatar`);let n=[],s,c=new AbortController;if(n.push(()=>c.abort()),i.single)s=o(`singleUser`,new AbortController().signal),t||s.setAttribute(`fill-opacity`,`0.5`),e.appendChild(s);else{let i=``,o=new AbortController;s=Ct(i,o.signal,t),e.appendChild(s);let u=a(()=>r.session?.avatar||``);l(()=>{let n=u.get();if(n===i)return;i=n,o?.abort(),o=new AbortController;let r=Ct(i,o.signal,t);e.replaceChild(r,s),s=r},c.signal),n.push(()=>{o?.abort(),o=null})}let u=a(()=>{let e=r.target,t=r.session;return!e||e.id===(t?.id||``)?null:e.avatar||``}),d=null,f=null,p=null;return l(()=>{let n=u.get();n!==d&&(d=n,f?.remove(),f=null,p?.abort(),n!==null&&(p=new AbortController,f=Ct(n,p.signal,t),e.insertBefore(f,s)))},c.signal),n.push(()=>{p?.abort(),p=null}),()=>{for(let e of n)e()}}function B(e,t){let n=document.createElement(`a`);n.appendChild(document.createTextNode(e.label||e.title||``));let{page:r,path:i,uri:a,target:o,command:s,script:c,click:u}=e;function d(){let t=e.disabled;return!!(typeof t==`function`?t():t)}return l(()=>{n.disabled=d()},t),r?(n.href=new URL(i?.[0]===`/`?`${r}${i}`:`${r}/${i||``}`,y).href,o&&typeof o==`string`&&(n.target=o)):a?(n.href=a,o!==``&&(n.target=o??`_blank`)):typeof u==`function`?n.addEventListener(`click`,e=>{d()||e.defaultPrevented||u()}):(s||c)&&n.addEventListener(`click`,e=>{d()||e.defaultPrevented}),n}const V=document.createElement(`div`);V.classList.add(`${b}-user`);const H=document.createElement(`div`);H.classList.add(`${b}-user-button`),wt(H,!0);const Tt=V.appendChild(document.createElement(`span`));Tt.classList.add(`${b}-user-info`);const Et=Tt.appendChild(document.createElement(`span`));wt(Et),Et.classList.add(`avatar`);const Dt=Tt.appendChild(document.createElement(`span`));Dt.classList.add(`username`),Dt.innerText=`用户名`;const Ot=Tt.appendChild(document.createElement(`span`));if(Ot.classList.add(`btns`),i.help){let e=Ot.appendChild(document.createElement(`a`));e.href=i.help,e.target=`_blank`,e.appendChild(o(`help`,!0)),e.title=`帮助`}const kt=Ot.appendChild(document.createElement(`div`));kt.appendChild(o(`logout`,!0)),kt.title=`退出登录`,l(()=>{kt.hidden=!r.current}),kt.addEventListener(`click`,()=>r.exit()),l(()=>{Dt.innerText=r.current?.name||``});const At=c([]);At.set(e.fromDefine(g,[]));const jt=a(()=>{let t=At.get();return r.current?t:e.filter(t,e=>!e.logged)}),U=V.appendChild(document.createElement(`main`));U.style.flex=`1`,U.style.overflow=`auto`,U.classList.add(`NavMenu`);let Mt=null;l(()=>{Mt?.abort(),U.innerHTML=``,Mt=new AbortController,pt(U,jt.get(),B,{signal:Mt.signal})});const W=document.createElement(`a`);W.classList.add(`${b}-logo`),W.href=y.href;const Nt=i.logo,Pt=Nt&&h(Nt);if(Pt){let e=W.appendChild(document.createElement(`img`));e.src=Pt.href,e.classList.add(`logo`)}else W.appendChild(o(`logo`,!0)).classList.add(`logo`);const Ft={404:{title:`您所请求的页面无法找到`,description:`服务器无法正常提供信息。
|
|
747
|
+
目标页面可能已经被更改、删除或移到其他位置,或您所输入页面地址错误。`}};function It(e,t){if((t??``)==``){e.container.appendChild(document.createTextNode(`空页面`));return}let n=(typeof t==`number`||typeof t==`string`)&&Object.hasOwn(Ft,t)&&Ft[t]||Ft[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=`${b}-allSider-nav`,Lt=document.createElement(`header`);Lt.className=`${G}-header`;const K=Lt.appendChild(document.createElement(`div`));K.classList.add(`${G}-actions`);const Rt=Lt.appendChild(document.createElement(`div`));Rt.classList.add(`${G}-sidebar`);const zt=`${G}-open`;let q=null;function Bt(){window.innerWidth>800||q?.()}var Vt=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,Rt.appendChild(r),n.classList.add(`${G}-selectable`),n.addEventListener(`click`,this.#n),this.#e=()=>{q=null,document.body.classList.remove(zt),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(zt),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}};Rt.addEventListener(`click`,e=>{e.target===e.currentTarget&&q?.()});var J=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`,()=>{Bt()}),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 Vt(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 J(K),Wt=new J(K);new J(K),K.appendChild(document.createElement(`span`));const Gt=new J(K),Y=Wt.createSider(Ht);Y.button.innerText=`页面`,Y.disabled=!0;var Kt=class extends n{#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&&(Y.disabled=!1)}#n(){this.#e.show&&!this.#t.children.length&&(Y.disabled=!0)}remove(){super.remove(),this.#n()}},qt=class extends t{#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),Y.disabled=!(e&&this.#e.children.length)}get siderOpen(){return Y.open}set siderOpen(e){e?Y.show():Y.hide()}createSider(e,t){if(this.destroyed||t?.aborted)return null;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&&(Y.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&&=!1};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(document.createElement(`button`)).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,r){let i=document.createElement(`div`),a=Jt(e,n,r);if(!a)return null;let s=i.appendChild(document.createElement(`button`)),c=t?.label||t?.title||``;return c?s.appendChild(document.createTextNode(c)):s.appendChild(o(t?.icon||`more`,r)),a.targetElement=s,s.addEventListener(`click`,()=>a.show()),i.appendChild(a),i}var Zt={components:{List:D,Pagination:lt,createMenuButtons:Yt,createMenuItem:B,createMenuButton:Xt},pageManager:E,elements:[p,Lt],classNames:[b,`${b}-allSider`],styleFiles:[`theme-allSider.css`],home:ut,rootClassName:`${b}-root`,createPage(e){return new qt(e)},renderError(e,t){It(e,t)},setup(e){te(!1),W.addEventListener(`click`,()=>{Bt()},{signal:e}),K.insertBefore(W,K.firstElementChild);let t=Ut.createSider(I);z(!0),t.button.appendChild(o(`menu`,e)),t.button.title=`菜单`;let n=Ut.createSider(S);n.button.appendChild(o(`activity`,e)),n.button.title=`活动`;let r=Gt.createSider(V,H);e.addEventListener(`abort`,()=>{W.remove(),t.remove(),n.remove(),r.remove()},{once:!0})}};const X=`${b}-base`,Qt=[`theme-base.css`],$t=document.createElement(`header`),Z=$t.appendChild(document.createElement(`div`));Z.classList.add(`${X}-header`);const en=$t.appendChild(document.createElement(`div`));en.classList.add(`${X}-sidebar`);const tn=Z.appendChild(o(`menu`,!0));tn.classList.add(`${X}-menu-button`);const nn=Z.appendChild(document.createElement(`div`));nn.classList.add(`${X}-header-title`),nn.innerText=i.title||i.company||``,Z.appendChild(document.createElement(`span`));const rn=`${X}-menu-open`;tn.addEventListener(`click`,()=>{document.body.classList.toggle(rn)}),en.addEventListener(`click`,e=>{e.target===e.currentTarget&&document.body.classList.remove(rn)});var an={components:{List:D,Pagination:lt,createMenuButtons:Yt,createMenuItem:B,createMenuButton:Xt},pageManager(e){let t=!1;l(()=>{if(!e.current){t&&e.destroy();return}t=!0,document.title=[e?e.title:``,i.title||`拥道YongDall`].filter(Boolean).join(` | `)},e.signal)},elements:[$t,p],classNames:[b,X],styleFiles:Qt,home:ut,rootClassName:`${b}-root`,createPage(e){return new t(e)},renderError(e,t){It(e,t)},setup(e){W.addEventListener(`click`,()=>{window.innerWidth>800||document.body.classList.remove(rn)},{signal:e}),Z.insertBefore(W,nn),en.appendChild(I),z(!0),document.body.appendChild(V),V.setAttribute(`popover`,`auto`),H.addEventListener(`click`,()=>{V.showPopover()},{signal:e}),Z.appendChild(H),e.addEventListener(`abort`,()=>{W.remove(),I.remove(),V.removeAttribute(`popover`),V.remove(),H.remove()},{once:!0})}};const Q=`${b}-tabs`,on=document.createElement(`header`),$=on.appendChild(document.createElement(`div`));$.classList.add(`${Q}-header`);const sn=on.appendChild(document.createElement(`div`));sn.classList.add(`${Q}-sidebar`);const cn=$.appendChild(o(`menu`,!0));cn.classList.add(`${Q}-menu-button`);const ln=$.appendChild(document.createElement(`div`));ln.classList.add(`${Q}-header-title`),ln.innerText=i.title||i.company||``,$.appendChild(document.createElement(`span`));const un=`${Q}-menu-open`;cn.addEventListener(`click`,()=>{document.body.classList.toggle(un)});function dn(){window.innerWidth>800||document.body.classList.remove(un)}sn.addEventListener(`click`,e=>{e.target===e.currentTarget&&document.body.classList.remove(un)});var fn={components:{List:D,Pagination:lt,createMenuButtons:Yt,createMenuItem:B,createMenuButton:Xt},pageManager:E,elements:[on,p],classNames:[b,`${b}-tabs`],styleFiles:[`theme-tabs.css`],home:ut,rootClassName:`${b}-root`,createPage(e){return new t(e)},renderError(e,t){It(e,t)},setup(e){te(!0),W.addEventListener(`click`,()=>{dn()},{signal:e}),$.insertBefore(W,ln),on.appendChild(S),sn.appendChild(I),z(!0),document.body.appendChild(V),V.setAttribute(`popover`,`auto`),H.addEventListener(`click`,()=>{V.showPopover()},{signal:e}),$.appendChild(H),e.addEventListener(`abort`,()=>{W.remove(),S.remove(),I.remove(),V.removeAttribute(`popover`),V.remove(),H.remove()},{once:!0})}};export{Zt as allSider,Zt as theme,an as base,an as tradition,fn as tabs};
|
|
749
749
|
//# sourceMappingURL=index.mjs.map
|