@aevantec/litevue 0.5.10 → 0.5.11
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/README.md +1 -1
- package/dist/litevue-devtools.iife.js +1 -1
- package/dist/litevue-devtools.mjs +1 -1
- package/dist/litevue-devtools.umd.js +1 -1
- package/dist/litevue-plugins.dev.iife.js +13 -3
- package/dist/litevue-plugins.dev.mjs +13 -3
- package/dist/litevue-plugins.iife.js +1 -1
- package/dist/litevue-plugins.mjs +1 -1
- package/dist/litevue-plugins.umd.js +1 -1
- package/dist/litevue.dev.iife.js +32 -1
- package/dist/litevue.dev.mjs +32 -1
- package/dist/litevue.iife.js +1 -1
- package/dist/litevue.mjs +1 -1
- package/dist/litevue.umd.js +1 -1
- package/dist/plugins/popover.iife.js +1 -0
- package/dist/plugins/popover.mjs +1 -0
- package/dist/plugins/popover.umd.js +1 -0
- package/dist/plugins/resize.iife.js +1 -1
- package/dist/plugins/resize.mjs +1 -1
- package/dist/plugins/resize.umd.js +1 -1
- package/dist/types/devtools-panel/plugins.d.mts +10 -0
- package/dist/types/devtools-panel/plugins.d.ts +10 -0
- package/dist/types/devtools-panel/styles.d.mts +4 -1
- package/dist/types/devtools-panel/styles.d.ts +4 -1
- package/dist/types/devtools.d.mts +28 -1
- package/dist/types/devtools.d.ts +28 -1
- package/dist/types/plugins/popover/index.d.mts +2 -0
- package/dist/types/plugins/popover/index.d.ts +2 -0
- package/dist/types/plugins/resize/index.d.mts +5 -2
- package/dist/types/plugins/resize/index.d.ts +5 -2
- package/package.json +14 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ stays `LiteVue`.
|
|
|
10
10
|
- Vue-compatible syntax: `{{ }}`, `v-if`/`v-for` (keyed), `v-model`, `v-show`, …
|
|
11
11
|
- **Built-in devtools** — in-page inspector panel + browser extension, one line to disable in production
|
|
12
12
|
- **Transitions** that work with `v-show` *and* `v-if` (deferred unmount)
|
|
13
|
-
- **Plugin system** with
|
|
13
|
+
- **Plugin system** with ten first-party plugins: intersect, persist, focus (+trap), collapse, transition, mask, morph, media, resize, and popover (+anchor)
|
|
14
14
|
- **Lazy mounting** — `v-scope.visible`, `.idle` and `.interaction` leave a region unbound until it is seen, the browser is idle, or it is first used
|
|
15
15
|
- **Components** registered by name with `app.component()`, usable from `v-scope`
|
|
16
16
|
- **Global store** (`store()` / `$store`) and magic properties (`$dispatch`, `$watch`, `$id`, `$root`, …)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var LiteVueDevtoolsPanel=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var n,t,o,r,i,l,d,a,s,p,c,h,u=e=>'<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">'+e+"</svg>",g="litevue-devtools-theme",v="litevue-devtools-ui",f=()=>{try{return JSON.parse(localStorage.getItem(v)||"{}")}catch{return{}}},x=e=>{try{localStorage.setItem(v,JSON.stringify({...f(),...e}))}catch{}},b={dark:u('<path d="M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z"/>'),light:u('<circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.2" y1="4.2" x2="5.6" y2="5.6"/><line x1="18.4" y1="18.4" x2="19.8" y2="19.8"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.2" y1="19.8" x2="5.6" y2="18.4"/><line x1="18.4" y1="5.6" x2="19.8" y2="4.2"/>'),system:u('<rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/>')},m={float:u('<rect x="2" y="4" width="14" height="11" rx="1"/><rect x="9" y="10" width="13" height="10" rx="1" fill="currentColor"/>'),bottom:u('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="2" y="14" width="20" height="7" fill="currentColor"/>'),right:u('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="14" y="3" width="8" height="18" fill="currentColor"/>')},y={float:"bottom",bottom:"right",right:"float"},w={float:"floating",bottom:"docked to bottom",right:"docked to right"},k={dark:"light",light:"system",system:"dark"},C=(e,n,t)=>Math.min(Math.max(e,n),Math.max(n,t)),L=(e,n,t)=>{const o=document.createElement(e);return o.className=n,null!=t&&(o.textContent=t),o},E=(e,n)=>{const t=new Set,o=(e,r,i)=>{if(null!=e){if("object"!=typeof e)return String(e).toLowerCase().includes(n)?r:void 0;if(i>4||t.has(e))return;t.add(e);for(const t of Object.keys(e)){if("$"===t[0])continue;let l;try{l=e[t]}catch{continue}if("function"==typeof l)continue;const d=r?`${r}.${t}`:t;if(t.toLowerCase().includes(n))return d;const a=o(l,d,i+1);if(a)return a}}};return o(e,"",0)},O=e=>{let n;try{n=void 0===e?"undefined":JSON.stringify(e)??String(e)}catch{n=String(e)}return n.length>60?n.slice(0,60)+"\u2026":n},S=null,_=null,$=!1,M="",z="Elements",I="float",N="",j="",P="",T="",D="",H="",W=(()=>{try{const e=localStorage.getItem(g);if("light"===e||"system"===e)return e}catch{}return"dark"})(),V=matchMedia("(prefers-color-scheme: light)"),R=()=>{const e="light"===W||"system"===W&&V.matches;t.host.classList.toggle("light",e),a.innerHTML=b[W],a.title="theme: "+W},X=new Set,Y=new WeakSet,A=()=>{if("float"!==I)return;const e=parseInt(o.style.right)||0,n=parseInt(o.style.bottom)||0;P=o.style.right=C(e,0,window.innerWidth-o.offsetWidth)+"px",T=o.style.bottom=C(n,0,window.innerHeight-o.offsetHeight)+"px"},B=e=>{"float"===I?(N=o.style.width||N,j=o.style.height||j,P=o.style.right||P,T=o.style.bottom||T):"bottom"===I?D=o.style.height||D:H=o.style.width||H,I=e;const n="float"!==e;o.classList.toggle("dock-bottom","bottom"===e),o.classList.toggle("dock-right","right"===e),o.style.right=n?"":P,o.style.bottom=n?"":T,o.style.width="bottom"===e?"":"right"===e?H:N,o.style.height="right"===e?"":"bottom"===e?D:j,p.innerHTML=m[e],p.title="panel: "+w[e]},F=e=>{const n=L("span","label");return n.appendChild(L("span","punct","<")),n.appendChild(L("span","name",ee(e))),n.appendChild(L("span","punct",">")),n},J=e=>{let t=e.parentElement;for(;t;){if(n.scopes.has(t))return t;t=t.parentElement}return null},U=e=>{const n=e.getBoundingClientRect();s.style.cssText=`display:block;left:${n.left}px;top:${n.top}px;width:${n.width}px;height:${n.height}px`},q=()=>{s.style.display="none"},G=e=>{e!==S&&X.clear(),_=null,S=e,z="Elements",window.$scope=e?n.scopes.get(e):void 0,ne(),te()},Z=e=>{e!==_&&X.clear(),S=null,_=e,z="Stores",window.$scope=n.stores.get(e),ne(),te()},K=e=>{z=e,ne()},Q=/^\s*([A-Za-z_$][\w$]*)\s*\(/,ee=e=>n.names.get(e)||(e=>{const t=Q.exec(n.exps.get(e)||"")?.[1];return t&&n.components?.has(t)?t:void 0})(e)||e.id||e.tagName.toLowerCase(),ne=()=>{if((()=>{const e=n.stores?n.stores.size:0;c.textContent=`Elements (${n.scopes.size})`,c.className="Elements"===z?"tab active":"tab",h.textContent=`Stores (${e})`,h.className="Stores"===z?"tab active":"tab"})(),i.textContent="","Elements"===z){const e=[...n.scopes.keys()].sort((e,n)=>e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),t=new Map;for(const i of e)if(!M||ee(i).toLowerCase().includes(M))t.set(i,void 0);else{const e=E(n.scopes.get(i),M);e&&t.set(i,e)}if(!t.size)return void i.appendChild(L("div","empty",M?"no matching scopes":"no scopes mounted"));const o=new Set;for(const n of t.keys()){o.add(n);for(let e=J(n);e;e=J(e))o.add(e)}const r=new Map,l=new Map,d=new Map;for(const n of e){if(!o.has(n))continue;const e=J(n);r.set(n,e),d.set(n,e?(d.get(e)??0)+1:0),e&&l.set(e,(l.get(e)||0)+1)}const a=e=>{for(let n=r.get(e);n;n=r.get(n)??null)if(Y.has(n))return!0;return!1};for(const s of e){if(!o.has(s)||a(s))continue;const e=L("div",s===S?"row sel":"row");e.style.paddingLeft=8+12*(d.get(s)??0)+"px";const r=Y.has(s);if(l.get(s)){const n=L("span",r?"arrow":"arrow open","\u25b6");n.onclick=e=>{e.stopPropagation(),r?Y.delete(s):Y.add(s),ne()},e.appendChild(n)}else e.appendChild(L("span","spacer"));e.appendChild(F(s));const p=n.exps.get(s);p&&e.appendChild(L("span","exp"," "+p));const c=t.get(s);c&&e.appendChild(L("span","hit"," "+c)),e.onclick=()=>G(s),e.onmouseenter=()=>U(s),e.onmouseleave=q,i.appendChild(e)}return}const e=new Map;for(const o of n.stores?n.stores.keys():[])if(!M||o.toLowerCase().includes(M))e.set(o,void 0);else{const t=E(n.stores.get(o),M);t&&e.set(o,t)}const t=[...e.keys()];if(t.length)for(const n of t){const t=L("div",n===_?"row sel":"row"),o=L("span","label");o.appendChild(L("span","punct","$store.")),o.appendChild(L("span","name",n)),t.appendChild(o);const r=e.get(n);r&&t.appendChild(L("span","hit"," "+r)),t.onclick=()=>Z(n),i.appendChild(t)}else i.appendChild(L("div","empty",M?"no matching stores":"no stores registered"))},te=()=>{if(l.contains(t.activeElement))return;l.textContent="";const e=_?n.stores.get(_):S?n.scopes.get(S):void 0;if(!e)return void l.appendChild(L("div","empty","Select a scope"));const{own:o,inherited:r}=(e=>{const n=(e,n)=>"$"!==n[0]&&"function"!=typeof e[n],t=Object.keys(e).filter(t=>n(e,t)),o=new Set(t),r=[];let i=Object.getPrototypeOf(e);for(;i&&i!==Object.prototype;){for(const e of Object.keys(i))!o.has(e)&&n(i,e)&&(o.add(e),r.push(e));i=Object.getPrototypeOf(i)}return{own:t,inherited:r}})(e);o.forEach(n=>re(n,e,n,0,"prop",[])),r.length&&(l.appendChild(L("div","divider","inherited")),r.forEach(n=>re(n,e,n,0,"prop inherited",[]))),o.length||r.length||l.appendChild(L("div","empty","empty scope")),l.appendChild(oe(e))},oe=e=>{const n=L("div","prop adder");n.appendChild(L("span","spacer"));const t=L("input","val key-in");t.placeholder="key";const o=L("input","val");o.placeholder="value";return t.onkeydown=o.onkeydown=n=>{"Enter"===n.key&&(()=>{const n=t.value.trim();if(!n)return;const r=o.value;let i=r;"true"===r?i=!0:"false"===r?i=!1:""===r||isNaN(+r)||(i=+r),e[n]=i,t.blur(),o.blur(),pe(),setTimeout(()=>{const e=l.querySelector(".adder .key-in");e&&e.focus()})})()},n.appendChild(t),n.appendChild(o),n},re=(e,n,t,o,r,i)=>{const d=n[e],a=L("div",r);if(a.style.paddingLeft=8+14*o+"px",null!==d&&"object"==typeof d){const s=i.indexOf(d)>-1,p=!s&&X.has(t);if(a.appendChild(L("span",p?"arrow open":"arrow","\u25b6")),a.appendChild(L("span","key",e)),a.appendChild(L("span","preview",s?"(circular)":(e=>Array.isArray(e)?`(${e.length}) ${O(e)}`:O(e))(d))),s||(a.classList.add("toggle"),a.onclick=()=>{p?X.delete(t):X.add(t),te()}),ie(a,n,e,o,r),l.appendChild(a),p){const e=Object.keys(d);if(!e.length){const e=L("div","muted","(empty)");e.style.paddingLeft=22+14*(o+1)+"px",l.appendChild(e)}for(const n of e)re(n,d,t+"."+n,o+1,r,i.concat([d]))}return}a.appendChild(L("span","spacer")),a.appendChild(L("span","key",e));const s=((e,n)=>{for(let t=e;t&&t!==Object.prototype;t=Object.getPrototypeOf(t)){const e=Object.getOwnPropertyDescriptor(t,n);if(e)return e}})(n,e);if("function"==typeof d)a.appendChild(L("span","preview","\u0192"));else if((e=>{if(!e)return!1;if(e.get&&!e.set)return!0;const n=e.value;return!!n&&!0===n.__v_isRef&&!0===n.__v_isReadonly})(s))a.appendChild(L("span","preview",O(d)));else if("boolean"==typeof d){a.appendChild(L("span","bool",String(d)));const t=L("input","check");t.type="checkbox",t.checked=d,t.onchange=()=>{n[e]=t.checked,t.blur(),pe()},a.appendChild(t)}else{const t=L("input","val");t.value=O(d),t.onfocus=()=>{t.value="string"==typeof d?d:String(d)},t.onkeydown=e=>{"Enter"===e.key&&t.blur(),"Escape"===e.key&&(t.value=O(d),t.blur())},t.onblur=()=>{const o=((e,n)=>{if("number"==typeof n){const n=parseFloat(e);return isNaN(n)?e:n}return e})(t.value,d);o!==d?(n[e]=o,pe()):t.value=O(d)},a.appendChild(t)}ie(a,n,e,o,r),l.appendChild(a)},ie=(e,n,o,r,i)=>{if(0!==r||"prop"!==i)return;const l=Object.getOwnPropertyDescriptor(n,o);if(l&&l.get)return;const d=L("button","del","\u2715");d.title=`delete "${o}"`,d.onclick=e=>{e.stopPropagation();const r=t.activeElement;r&&r.blur&&r.blur(),delete n[o],pe()},e.appendChild(d)},le=e=>{const o=e.target;if(o===t.host)return;e.preventDefault(),e.stopPropagation(),ae();let r=o;for(;r&&!n.scopes.has(r);)r=r.parentElement;r&&G(r)},de=e=>{let o=e.target;if(o!==t.host){for(;o&&!n.scopes.has(o);)o=o.parentElement;o?U(o):q()}},ae=()=>{$=!1,d.classList.remove("active"),q(),document.removeEventListener("click",le,!0),document.removeEventListener("mousemove",de,!0)},se=!1,pe=()=>{se||(se=!0,setTimeout(()=>{se=!1,"none"!==o.style.display&&(ne(),te())}))},ce=()=>{const e=document.createElement("div");t=e.attachShadow({mode:"open"});const v=document.createElement("style");v.textContent="\n:host {\n all: initial;\n --bg: #1e1e1e;\n --bg2: #252526;\n --hover: #2a2d2e;\n --border: #3c3c3c;\n --fg: #d4d4d4;\n --muted: #808080;\n --accent: #42b883;\n --sel: #094771;\n --key: #9cdcfe;\n --val: #ce9178;\n --exp: #6a9955;\n}\n:host(.light) {\n --bg: #ffffff;\n --bg2: #f3f3f3;\n --hover: #ececec;\n --border: #d0d0d0;\n --fg: #383a42;\n --muted: #8e8e90;\n --sel: #d2e5f5;\n --key: #0451a5;\n --val: #a31515;\n --exp: #22863a;\n}\n* {\n box-sizing: border-box;\n}\n.pill, .panel {\n position: fixed;\n right: 12px;\n bottom: 12px;\n z-index: 2147483646;\n font: 11px/1.5 ui-monospace, Menlo, Consolas, monospace;\n color: var(--fg);\n}\n.pill {\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 999px;\n padding: 4px 10px;\n cursor: pointer;\n user-select: none;\n}\n.pill:hover {\n border-color: var(--accent);\n}\n.panel {\n display: flex;\n flex-direction: column;\n width: 760px;\n max-width: calc(100vw - 24px);\n height: 450px;\n max-height: calc(100vh - 24px);\n min-width: 320px;\n min-height: 320px;\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 6px;\n overflow: hidden;\n box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);\n}\n.panel.dock-bottom {\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n max-width: none;\n border-radius: 0;\n border-left: 0;\n border-right: 0;\n border-bottom: 0;\n}\n.panel.dock-right {\n top: 0;\n right: 0;\n bottom: 0;\n height: 100%;\n max-height: none;\n border-radius: 0;\n border-top: 0;\n border-right: 0;\n border-bottom: 0;\n}\n.panel.dock-bottom .header,\n.panel.dock-right .header {\n cursor: default;\n}\n.grip {\n position: absolute;\n z-index: 1;\n touch-action: none;\n right: 0;\n bottom: 0;\n width: 14px;\n height: 14px;\n cursor: nwse-resize;\n background: linear-gradient(135deg, transparent 50%, var(--border) 50%);\n}\n.panel.dock-bottom .grip {\n top: 0;\n left: 0;\n width: auto;\n height: 5px;\n cursor: ns-resize;\n background: none;\n}\n.panel.dock-right .grip {\n top: 0;\n left: 0;\n width: 5px;\n height: auto;\n cursor: ew-resize;\n background: none;\n}\n.panel.dock-bottom .grip:hover,\n.panel.dock-bottom .grip.active,\n.panel.dock-right .grip:hover,\n.panel.dock-right .grip.active {\n background: var(--accent);\n}\n.header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px 8px;\n background: var(--bg2);\n border-bottom: 1px solid var(--border);\n user-select: none;\n cursor: move;\n}\n.title {\n color: var(--accent);\n font-weight: bold;\n margin-right: auto;\n}\n.btn {\n display: flex;\n align-items: center;\n background: none;\n border: 1px solid var(--border);\n border-radius: 3px;\n color: var(--fg);\n font: inherit;\n padding: 3px 7px;\n cursor: pointer;\n}\n.btn svg {\n display: block;\n}\n.btn:hover {\n border-color: var(--accent);\n}\n.btn.active {\n background: var(--accent);\n border-color: var(--accent);\n color: var(--bg);\n}\n.body {\n display: flex;\n flex: 1;\n min-height: 0;\n}\n.side {\n display: flex;\n flex-direction: column;\n width: 40%;\n min-width: 0;\n border-right: 1px solid var(--border);\n}\n.tabs {\n display: flex;\n border-bottom: 1px solid var(--border);\n user-select: none;\n}\n.tab {\n flex: 1;\n padding: 4px 0;\n text-align: center;\n color: var(--muted);\n border-bottom: 2px solid transparent;\n cursor: pointer;\n}\n.tab:hover {\n color: var(--fg);\n}\n.tab.active {\n color: var(--fg);\n border-bottom-color: var(--accent);\n}\n.filter {\n margin: 6px 6px 2px;\n background: var(--bg2);\n border: 1px solid var(--border);\n border-radius: 3px;\n color: var(--fg);\n font: inherit;\n padding: 2px 6px;\n outline: none;\n}\n.filter:focus {\n border-color: var(--accent);\n}\n.filter::placeholder {\n color: var(--muted);\n}\n.tree {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.state {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.row {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 2px 8px;\n white-space: nowrap;\n overflow: hidden;\n cursor: pointer;\n}\n.row .label {\n flex-shrink: 0;\n}\n.row .arrow {\n cursor: pointer;\n padding: 3px 4px;\n margin: -3px -4px;\n box-sizing: content-box;\n}\n.row .arrow:hover {\n color: var(--key);\n}\n.row .hit {\n color: var(--exp);\n opacity: 0.75;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.row:hover {\n background: var(--hover);\n}\n.row.sel {\n background: var(--sel);\n}\n.row .name {\n color: var(--key);\n}\n.row .punct {\n color: var(--muted);\n}\n.row .exp {\n color: var(--exp);\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.prop {\n display: flex;\n gap: 6px;\n padding: 2px 8px;\n align-items: center;\n}\n.prop .key {\n color: var(--key);\n flex-shrink: 0;\n}\n.arrow {\n width: 12px;\n flex-shrink: 0;\n color: var(--muted);\n font-size: 9px;\n transition: transform 0.1s;\n}\n.arrow.open {\n transform: rotate(90deg);\n}\n.spacer {\n width: 12px;\n flex-shrink: 0;\n}\n.prop.toggle {\n cursor: pointer;\n user-select: none;\n}\n.prop.toggle:hover {\n background: var(--hover);\n}\n.preview {\n flex: 1;\n min-width: 0;\n color: var(--muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.muted {\n color: var(--muted);\n padding: 2px 8px;\n}\n.check {\n margin: 0;\n flex-shrink: 0;\n accent-color: var(--accent);\n cursor: pointer;\n}\n.del {\n visibility: hidden;\n flex-shrink: 0;\n background: none;\n border: none;\n padding: 0 2px;\n color: var(--muted);\n font: inherit;\n cursor: pointer;\n}\n.prop:hover .del {\n visibility: visible;\n}\n.del:hover {\n color: #e5534b;\n}\n.adder .key-in {\n flex: 0 0 30%;\n color: var(--key);\n}\n.adder input::placeholder {\n color: var(--muted);\n}\n.adder input {\n border-color: var(--border);\n}\n.bool {\n color: var(--val);\n}\n.prop.inherited .key {\n color: var(--muted);\n}\n.prop .val {\n flex: 1;\n min-width: 0;\n background: none;\n border: 1px solid transparent;\n border-radius: 3px;\n color: var(--val);\n font: inherit;\n padding: 0 3px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\ninput.val:hover, input.val:focus {\n border-color: var(--border);\n outline: none;\n background: var(--bg2);\n}\n.divider {\n padding: 4px 8px 1px;\n color: var(--muted);\n font-size: 10px;\n text-transform: uppercase;\n user-select: none;\n}\n.empty {\n padding: 8px;\n color: var(--muted);\n}\n.highlight {\n position: fixed;\n z-index: 2147483645;\n background: rgba(66, 184, 131, 0.25);\n border: 1px solid var(--accent);\n pointer-events: none;\n display: none;\n}\n",t.appendChild(v),s=L("div","highlight"),t.appendChild(s),(r=L("div","pill","\u26a1 LiteVue")).onclick=()=>{r.style.display="none",o.style.display="flex",A(),x({open:!0}),pe()},t.appendChild(r),(o=L("div","panel")).style.display="none";const b=L("div","header");b.appendChild(L("span","title","\u26a1 LiteVue")),b.addEventListener("mousedown",e=>{if(e.target.closest(".btn"))return;if("float"!==I)return;e.preventDefault();const n=o.getBoundingClientRect(),t=window.innerWidth-n.right,r=window.innerHeight-n.bottom,i=e.clientX,l=e.clientY,d=e=>{o.style.right=C(t-(e.clientX-i),0,window.innerWidth-o.offsetWidth)+"px",o.style.bottom=C(r-(e.clientY-l),0,window.innerHeight-o.offsetHeight)+"px"},a=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a),x({right:parseInt(o.style.right)||12,bottom:parseInt(o.style.bottom)||12})};document.addEventListener("mousemove",d),document.addEventListener("mouseup",a)});const m=L("div","grip");m.addEventListener("mousedown",e=>{e.preventDefault(),m.classList.add("active");const n=o.getBoundingClientRect(),t=e.clientX,r=e.clientY,i=n.width,l=n.height,d=e=>{if("right"!==I){const n="bottom"===I?r-e.clientY:e.clientY-r;o.style.height=C(l+n,320,window.innerHeight-24)+"px"}if("bottom"!==I){const n="right"===I?t-e.clientX:e.clientX-t;o.style.width=C(i+n,320,window.innerWidth-24)+"px"}},a=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a),m.classList.remove("active");const e=parseInt(o.style.width),n=parseInt(o.style.height);x("float"===I?{w:e,h:n}:"bottom"===I?{bh:n}:{rw:e})};document.addEventListener("mousemove",d),document.addEventListener("mouseup",a)}),(p=L("button","btn")).onclick=()=>{B(y[I]),x({dock:I})},b.appendChild(p),(a=L("button","btn")).onclick=()=>{(e=>{try{localStorage.setItem(g,e)}catch{}})(W=k[W]),R()},b.appendChild(a),V.addEventListener("change",()=>{"system"===W&&R()}),R(),(d=L("button","btn")).title="pick an element on the page",d.innerHTML=u('<circle cx="12" cy="12" r="7"/><line x1="12" y1="1" x2="12" y2="6"/><line x1="12" y1="18" x2="12" y2="23"/><line x1="1" y1="12" x2="6" y2="12"/><line x1="18" y1="12" x2="23" y2="12"/>'),d.onclick=()=>$?ae():($=!0,d.classList.add("active"),document.addEventListener("click",le,!0),void document.addEventListener("mousemove",de,!0)),b.appendChild(d);const w=L("button","btn","\u2715");w.onclick=()=>{$&&ae(),o.style.display="none",r.style.display="",x({open:!1})},b.appendChild(w),o.appendChild(b);const E=L("div","body"),O=L("div","side"),_=L("div","tabs");(c=L("div","tab active")).onclick=()=>K("Elements"),(h=L("div","tab")).onclick=()=>K("Stores"),_.appendChild(c),_.appendChild(h),O.appendChild(_);const z=L("input","filter");z.placeholder="Filter by name or state",z.oninput=()=>{M=z.value.trim().toLowerCase(),ne()},z.onkeydown=e=>{"Escape"===e.key&&(z.value="",M="",ne())},O.appendChild(z),i=L("div","tree"),O.appendChild(i),l=L("div","state"),E.appendChild(O),E.appendChild(l),o.appendChild(E),o.appendChild(m),t.appendChild(o);const X=f();X.w&&(N=o.style.width=X.w+"px"),X.h&&(j=o.style.height=X.h+"px"),null!=X.right&&(P=o.style.right=X.right+"px"),null!=X.bottom&&(T=o.style.bottom=X.bottom+"px"),X.bh&&(D=X.bh+"px"),X.rw&&(H=X.rw+"px"),B(X.dock||"float"),document.body.appendChild(e),X.open&&(r.style.display="none",o.style.display="flex",A(),pe()),n.on("scope:mount",pe),n.on("scope:unmount",e=>{e===S&&(S=null),pe()}),n.stores&&n.on("store:register",pe),n.on("flush",pe)},he=()=>{const e=window.__LITE_VUE__;e?(n=e,document.body?ce():addEventListener("DOMContentLoaded",ce)):console.warn("[LiteVue devtools] window.__LITE_VUE__ not found \u2014 load LiteVue before the devtools panel script.")};return he(),e.init=he,e}({});
|
|
1
|
+
var LiteVueDevtoolsPanel=function(n){Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});var e,t,o,r,i,l,d,a,s,p,c,h,g=n=>'<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">'+n+"</svg>",u="litevue-devtools-theme",v="litevue-devtools-ui",f=()=>{try{return JSON.parse(localStorage.getItem(v)||"{}")}catch{return{}}},x=n=>{try{localStorage.setItem(v,JSON.stringify({...f(),...n}))}catch{}},m={dark:g('<path d="M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z"/>'),light:g('<circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.2" y1="4.2" x2="5.6" y2="5.6"/><line x1="18.4" y1="18.4" x2="19.8" y2="19.8"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.2" y1="19.8" x2="5.6" y2="18.4"/><line x1="18.4" y1="5.6" x2="19.8" y2="4.2"/>'),system:g('<rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/>')},b={float:g('<rect x="2" y="4" width="14" height="11" rx="1"/><rect x="9" y="10" width="13" height="10" rx="1" fill="currentColor"/>'),bottom:g('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="2" y="14" width="20" height="7" fill="currentColor"/>'),right:g('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="14" y="3" width="8" height="18" fill="currentColor"/>')},y={float:"bottom",bottom:"right",right:"float"},w={float:"floating",bottom:"docked to bottom",right:"docked to right"},k={dark:"light",light:"system",system:"dark"},C=(n,e,t)=>Math.min(Math.max(n,e),Math.max(e,t)),L=(n,e,t)=>{const o=document.createElement(n);return o.className=e,null!=t&&(o.textContent=t),o},E=(n,e)=>{const t=new Set,o=(n,r,i)=>{if(null!=n){if("object"!=typeof n)return String(n).toLowerCase().includes(e)?r:void 0;if(i>4||t.has(n))return;t.add(n);for(const t of Object.keys(n)){if("$"===t[0])continue;let l;try{l=n[t]}catch{continue}if("function"==typeof l)continue;const d=r?`${r}.${t}`:t;if(t.toLowerCase().includes(e))return d;const a=o(l,d,i+1);if(a)return a}}};return o(n,"",0)},O=n=>{let e;try{e=void 0===n?"undefined":JSON.stringify(n)??String(n)}catch{e=String(n)}return e.length>60?e.slice(0,60)+"\u2026":e},S=n=>[...n.directives.map(n=>"v-"+n),...n.magics].join(" "),M=null,$=null,_=!1,z="",j="Elements",I="float",N="",H="",P="",T="",D="",V="",W=()=>{},R=(()=>{try{const n=localStorage.getItem(u);if("light"===n||"system"===n)return n}catch{}return"dark"})(),X=matchMedia("(prefers-color-scheme: light)"),Y=()=>{const n="light"===R||"system"===R&&X.matches;t.host.classList.toggle("light",n),a.innerHTML=m[R],a.title="theme: "+R},A=new Set,B=new WeakSet,F=()=>{if("float"!==I)return;const n=parseInt(o.style.right)||0,e=parseInt(o.style.bottom)||0;P=o.style.right=C(n,0,window.innerWidth-o.offsetWidth)+"px",T=o.style.bottom=C(e,0,window.innerHeight-o.offsetHeight)+"px"},J=n=>{"float"===I?(N=o.style.width||N,H=o.style.height||H,P=o.style.right||P,T=o.style.bottom||T):"bottom"===I?D=o.style.height||D:V=o.style.width||V,I=n;const e="float"!==n;o.classList.toggle("dock-bottom","bottom"===n),o.classList.toggle("dock-right","right"===n),o.style.right=e?"":P,o.style.bottom=e?"":T,o.style.width="bottom"===n?"":"right"===n?V:N,o.style.height="right"===n?"":"bottom"===n?D:H,p.innerHTML=b[n],p.title="panel: "+w[n]},U=n=>{const e=L("span","label");return e.appendChild(L("span","punct","<")),e.appendChild(L("span","name",tn(n))),e.appendChild(L("span","punct",">")),e},q=n=>{let t=n.parentElement;for(;t;){if(e.scopes.has(t))return t;t=t.parentElement}return null},G=n=>{const e=n.getBoundingClientRect();s.style.cssText=`display:block;left:${e.left}px;top:${e.top}px;width:${e.width}px;height:${e.height}px`},Z=()=>{s.style.display="none"},K=n=>{n!==M&&A.clear(),$=null,M=n,j="Elements",window.$scope=n?e.scopes.get(n):void 0,on(),rn()},Q=n=>{n!==$&&A.clear(),M=null,$=n,j="Stores",window.$scope=e.stores.get(n),on(),rn()},nn=n=>{j=n,on()},en=/^\s*([A-Za-z_$][\w$]*)\s*\(/,tn=n=>e.names.get(n)||(n=>{const t=en.exec(e.exps.get(n)||"")?.[1];return t&&e.components?.has(t)?t:void 0})(n)||n.id||n.tagName.toLowerCase(),on=()=>{if((()=>{const n=e.stores?e.stores.size:0;c.textContent=`Elements (${e.scopes.size})`,c.className="Elements"===j?"tab active":"tab",h.textContent=`Stores (${n})`,h.className="Stores"===j?"tab active":"tab"})(),W(),i.textContent="","Elements"===j){const n=[...e.scopes.keys()].sort((n,e)=>n.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),t=new Map;for(const i of n)if(!z||tn(i).toLowerCase().includes(z))t.set(i,void 0);else{const n=E(e.scopes.get(i),z);n&&t.set(i,n)}if(!t.size)return void i.appendChild(L("div","empty",z?"no matching scopes":"no scopes mounted"));const o=new Set;for(const e of t.keys()){o.add(e);for(let n=q(e);n;n=q(n))o.add(n)}const r=new Map,l=new Map,d=new Map;for(const e of n){if(!o.has(e))continue;const n=q(e);r.set(e,n),d.set(e,n?(d.get(n)??0)+1:0),n&&l.set(n,(l.get(n)||0)+1)}const a=n=>{for(let e=r.get(n);e;e=r.get(e)??null)if(B.has(e))return!0;return!1};for(const s of n){if(!o.has(s)||a(s))continue;const n=L("div",s===M?"row sel":"row");n.style.paddingLeft=8+12*(d.get(s)??0)+"px";const r=B.has(s);if(l.get(s)){const e=L("span",r?"arrow":"arrow open","\u25b6");e.onclick=n=>{n.stopPropagation(),r?B.delete(s):B.add(s),on()},n.appendChild(e)}else n.appendChild(L("span","spacer"));n.appendChild(U(s));const p=e.exps.get(s);p&&n.appendChild(L("span","exp"," "+p));const c=t.get(s);c&&n.appendChild(L("span","hit"," "+c)),n.onclick=()=>K(s),n.onmouseenter=()=>G(s),n.onmouseleave=Z,i.appendChild(n)}return}const n=new Map;for(const o of e.stores?e.stores.keys():[])if(!z||o.toLowerCase().includes(z))n.set(o,void 0);else{const t=E(e.stores.get(o),z);t&&n.set(o,t)}const t=[...n.keys()];if(t.length)for(const e of t){const t=L("div",e===$?"row sel":"row"),o=L("span","label");o.appendChild(L("span","punct","$store.")),o.appendChild(L("span","name",e)),t.appendChild(o);const r=n.get(e);r&&t.appendChild(L("span","hit"," "+r)),t.onclick=()=>Q(e),i.appendChild(t)}else i.appendChild(L("div","empty",z?"no matching stores":"no stores registered"))},rn=()=>{if(l.contains(t.activeElement))return;l.textContent="";const n=$?e.stores.get($):M?e.scopes.get(M):void 0;if(!n)return void l.appendChild(L("div","empty","Select a scope"));const{own:o,inherited:r}=(n=>{const e=(n,e)=>"$"!==e[0]&&"function"!=typeof n[e],t=Object.keys(n).filter(t=>e(n,t)),o=new Set(t),r=[];let i=Object.getPrototypeOf(n);for(;i&&i!==Object.prototype;){for(const n of Object.keys(i))!o.has(n)&&e(i,n)&&(o.add(n),r.push(n));i=Object.getPrototypeOf(i)}return{own:t,inherited:r}})(n);o.forEach(e=>dn(e,n,e,0,"prop",[])),r.length&&(l.appendChild(L("div","divider","inherited")),r.forEach(e=>dn(e,n,e,0,"prop inherited",[]))),o.length||r.length||l.appendChild(L("div","empty","empty scope")),l.appendChild(ln(n))},ln=n=>{const e=L("div","prop adder");e.appendChild(L("span","spacer"));const t=L("input","val key-in");t.placeholder="key";const o=L("input","val");o.placeholder="value";return t.onkeydown=o.onkeydown=e=>{"Enter"===e.key&&(()=>{const e=t.value.trim();if(!e)return;const r=o.value;let i=r;"true"===r?i=!0:"false"===r?i=!1:""===r||isNaN(+r)||(i=+r),n[e]=i,t.blur(),o.blur(),gn(),setTimeout(()=>{const n=l.querySelector(".adder .key-in");n&&n.focus()})})()},e.appendChild(t),e.appendChild(o),e},dn=(n,e,t,o,r,i)=>{const d=e[n],a=L("div",r);if(a.style.paddingLeft=8+14*o+"px",null!==d&&"object"==typeof d){const s=i.indexOf(d)>-1,p=!s&&A.has(t);if(a.appendChild(L("span",p?"arrow open":"arrow","\u25b6")),a.appendChild(L("span","key",n)),a.appendChild(L("span","preview",s?"(circular)":(n=>Array.isArray(n)?`(${n.length}) ${O(n)}`:O(n))(d))),s||(a.classList.add("toggle"),a.onclick=()=>{p?A.delete(t):A.add(t),rn()}),an(a,e,n,o,r),l.appendChild(a),p){const n=Object.keys(d);if(!n.length){const n=L("div","muted","(empty)");n.style.paddingLeft=22+14*(o+1)+"px",l.appendChild(n)}for(const e of n)dn(e,d,t+"."+e,o+1,r,i.concat([d]))}return}a.appendChild(L("span","spacer")),a.appendChild(L("span","key",n));const s=((n,e)=>{for(let t=n;t&&t!==Object.prototype;t=Object.getPrototypeOf(t)){const n=Object.getOwnPropertyDescriptor(t,e);if(n)return n}})(e,n);if("function"==typeof d)a.appendChild(L("span","preview","\u0192"));else if((n=>{if(!n)return!1;if(n.get&&!n.set)return!0;const e=n.value;return!!e&&!0===e.__v_isRef&&!0===e.__v_isReadonly})(s))a.appendChild(L("span","preview",O(d)));else if("boolean"==typeof d){a.appendChild(L("span","bool",String(d)));const t=L("input","check");t.type="checkbox",t.checked=d,t.onchange=()=>{e[n]=t.checked,t.blur(),gn()},a.appendChild(t)}else{const t=L("input","val");t.value=O(d),t.onfocus=()=>{t.value="string"==typeof d?d:String(d)},t.onkeydown=n=>{"Enter"===n.key&&t.blur(),"Escape"===n.key&&(t.value=O(d),t.blur())},t.onblur=()=>{const o=((n,e)=>{if("number"==typeof e){const e=parseFloat(n);return isNaN(e)?n:e}return n})(t.value,d);o!==d?(e[n]=o,gn()):t.value=O(d)},a.appendChild(t)}an(a,e,n,o,r),l.appendChild(a)},an=(n,e,o,r,i)=>{if(0!==r||"prop"!==i)return;const l=Object.getOwnPropertyDescriptor(e,o);if(l&&l.get)return;const d=L("button","del","\u2715");d.title=`delete "${o}"`,d.onclick=n=>{n.stopPropagation();const r=t.activeElement;r&&r.blur&&r.blur(),delete e[o],gn()},n.appendChild(d)},sn=n=>{const o=n.target;if(o===t.host)return;n.preventDefault(),n.stopPropagation(),cn();let r=o;for(;r&&!e.scopes.has(r);)r=r.parentElement;r&&K(r)},pn=n=>{let o=n.target;if(o!==t.host){for(;o&&!e.scopes.has(o);)o=o.parentElement;o?G(o):Z()}},cn=()=>{_=!1,d.classList.remove("active"),Z(),document.removeEventListener("click",sn,!0),document.removeEventListener("mousemove",pn,!0)},hn=!1,gn=()=>{hn||(hn=!0,setTimeout(()=>{hn=!1,"none"!==o.style.display&&(on(),rn())}))},un=()=>{const n=document.createElement("div");t=n.attachShadow({mode:"open"});const v=document.createElement("style");v.textContent="\n:host {\n all: initial;\n --bg: #1e1e1e;\n --bg2: #252526;\n --hover: #2a2d2e;\n --border: #3c3c3c;\n --fg: #d4d4d4;\n --muted: #808080;\n --accent: #42b883;\n --sel: #094771;\n --key: #9cdcfe;\n --val: #ce9178;\n --exp: #6a9955;\n}\n:host(.light) {\n --bg: #ffffff;\n --bg2: #f3f3f3;\n --hover: #ececec;\n --border: #d0d0d0;\n --fg: #383a42;\n --muted: #8e8e90;\n --sel: #d2e5f5;\n --key: #0451a5;\n --val: #a31515;\n --exp: #22863a;\n}\n* {\n box-sizing: border-box;\n}\n.pill, .panel {\n position: fixed;\n right: 12px;\n bottom: 12px;\n z-index: 2147483646;\n font: 11px/1.5 ui-monospace, Menlo, Consolas, monospace;\n color: var(--fg);\n}\n.pill {\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 999px;\n padding: 4px 10px;\n cursor: pointer;\n user-select: none;\n}\n.pill:hover {\n border-color: var(--accent);\n}\n.panel {\n display: flex;\n flex-direction: column;\n width: 760px;\n max-width: calc(100vw - 24px);\n height: 450px;\n max-height: calc(100vh - 24px);\n min-width: 320px;\n min-height: 320px;\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 6px;\n overflow: hidden;\n box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);\n}\n.panel.dock-bottom {\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n max-width: none;\n border-radius: 0;\n border-left: 0;\n border-right: 0;\n border-bottom: 0;\n}\n.panel.dock-right {\n top: 0;\n right: 0;\n bottom: 0;\n height: 100%;\n max-height: none;\n border-radius: 0;\n border-top: 0;\n border-right: 0;\n border-bottom: 0;\n}\n.panel.dock-bottom .header,\n.panel.dock-right .header {\n cursor: default;\n}\n.grip {\n position: absolute;\n z-index: 1;\n touch-action: none;\n right: 0;\n bottom: 0;\n width: 14px;\n height: 14px;\n cursor: nwse-resize;\n background: linear-gradient(135deg, transparent 50%, var(--border) 50%);\n}\n.panel.dock-bottom .grip {\n top: 0;\n left: 0;\n width: auto;\n height: 5px;\n cursor: ns-resize;\n background: none;\n}\n.panel.dock-right .grip {\n top: 0;\n left: 0;\n width: 5px;\n height: auto;\n cursor: ew-resize;\n background: none;\n}\n.panel.dock-bottom .grip:hover,\n.panel.dock-bottom .grip.active,\n.panel.dock-right .grip:hover,\n.panel.dock-right .grip.active {\n background: var(--accent);\n}\n.header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px 8px;\n background: var(--bg2);\n border-bottom: 1px solid var(--border);\n user-select: none;\n cursor: move;\n}\n.title {\n color: var(--accent);\n font-weight: bold;\n margin-right: auto;\n}\n.btn {\n display: flex;\n align-items: center;\n background: none;\n border: 1px solid var(--border);\n border-radius: 3px;\n color: var(--fg);\n font: inherit;\n padding: 3px 7px;\n cursor: pointer;\n}\n.btn svg {\n display: block;\n}\n.btn:hover {\n border-color: var(--accent);\n}\n.btn.active {\n background: var(--accent);\n border-color: var(--accent);\n color: var(--bg);\n}\n.body {\n display: flex;\n flex: 1;\n min-height: 0;\n}\n[hidden] {\n display: none !important;\n}\n.plugins {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.plugin {\n display: flex;\n gap: 8px;\n padding: 3px 10px;\n align-items: baseline;\n}\n.plugin .name {\n min-width: 120px;\n}\n.plugin .gave {\n flex: 1;\n color: var(--muted);\n word-break: break-word;\n}\n.plugin .flag {\n color: var(--muted);\n opacity: 0.7;\n}\n.side {\n display: flex;\n flex-direction: column;\n width: 40%;\n min-width: 0;\n border-right: 1px solid var(--border);\n}\n.tabs {\n display: flex;\n border-bottom: 1px solid var(--border);\n user-select: none;\n}\n.tab {\n flex: 1;\n padding: 4px 0;\n text-align: center;\n color: var(--muted);\n border-bottom: 2px solid transparent;\n cursor: pointer;\n}\n.tab:hover {\n color: var(--fg);\n}\n.tab.active {\n color: var(--fg);\n border-bottom-color: var(--accent);\n}\n.filter {\n margin: 6px 6px 2px;\n background: var(--bg2);\n border: 1px solid var(--border);\n border-radius: 3px;\n color: var(--fg);\n font: inherit;\n padding: 2px 6px;\n outline: none;\n}\n.filter:focus {\n border-color: var(--accent);\n}\n.filter::placeholder {\n color: var(--muted);\n}\n.tree {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.state {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.row {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 2px 8px;\n white-space: nowrap;\n overflow: hidden;\n cursor: pointer;\n}\n.row .label {\n flex-shrink: 0;\n}\n.row .arrow {\n cursor: pointer;\n padding: 3px 4px;\n margin: -3px -4px;\n box-sizing: content-box;\n}\n.row .arrow:hover {\n color: var(--key);\n}\n.row .hit {\n color: var(--exp);\n opacity: 0.75;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.row:hover {\n background: var(--hover);\n}\n.row.sel {\n background: var(--sel);\n}\n.row .name {\n color: var(--key);\n}\n.row .punct {\n color: var(--muted);\n}\n.row .exp {\n color: var(--exp);\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.prop {\n display: flex;\n gap: 6px;\n padding: 2px 8px;\n align-items: center;\n}\n.prop .key {\n color: var(--key);\n flex-shrink: 0;\n}\n.arrow {\n width: 12px;\n flex-shrink: 0;\n color: var(--muted);\n font-size: 9px;\n transition: transform 0.1s;\n}\n.arrow.open {\n transform: rotate(90deg);\n}\n.spacer {\n width: 12px;\n flex-shrink: 0;\n}\n.prop.toggle {\n cursor: pointer;\n user-select: none;\n}\n.prop.toggle:hover {\n background: var(--hover);\n}\n.preview {\n flex: 1;\n min-width: 0;\n color: var(--muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.muted {\n color: var(--muted);\n padding: 2px 8px;\n}\n.check {\n margin: 0;\n flex-shrink: 0;\n accent-color: var(--accent);\n cursor: pointer;\n}\n.del {\n visibility: hidden;\n flex-shrink: 0;\n background: none;\n border: none;\n padding: 0 2px;\n color: var(--muted);\n font: inherit;\n cursor: pointer;\n}\n.prop:hover .del {\n visibility: visible;\n}\n.del:hover {\n color: #e5534b;\n}\n.adder .key-in {\n flex: 0 0 30%;\n color: var(--key);\n}\n.adder input::placeholder {\n color: var(--muted);\n}\n.adder input {\n border-color: var(--border);\n}\n.bool {\n color: var(--val);\n}\n.prop.inherited .key {\n color: var(--muted);\n}\n.prop .val {\n flex: 1;\n min-width: 0;\n background: none;\n border: 1px solid transparent;\n border-radius: 3px;\n color: var(--val);\n font: inherit;\n padding: 0 3px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\ninput.val:hover, input.val:focus {\n border-color: var(--border);\n outline: none;\n background: var(--bg2);\n}\n.divider {\n padding: 4px 8px 1px;\n color: var(--muted);\n font-size: 10px;\n text-transform: uppercase;\n user-select: none;\n}\n.empty {\n padding: 8px;\n color: var(--muted);\n}\n.highlight {\n position: fixed;\n z-index: 2147483645;\n background: rgba(66, 184, 131, 0.25);\n border: 1px solid var(--accent);\n pointer-events: none;\n display: none;\n}\n",t.appendChild(v),s=L("div","highlight"),t.appendChild(s),(r=L("div","pill","\u26a1 LiteVue")).onclick=()=>{r.style.display="none",o.style.display="flex",F(),x({open:!0}),gn()},t.appendChild(r),(o=L("div","panel")).style.display="none";const m=L("div","header");m.appendChild(L("span","title","\u26a1 LiteVue")),m.addEventListener("mousedown",n=>{if(n.target.closest(".btn"))return;if("float"!==I)return;n.preventDefault();const e=o.getBoundingClientRect(),t=window.innerWidth-e.right,r=window.innerHeight-e.bottom,i=n.clientX,l=n.clientY,d=n=>{o.style.right=C(t-(n.clientX-i),0,window.innerWidth-o.offsetWidth)+"px",o.style.bottom=C(r-(n.clientY-l),0,window.innerHeight-o.offsetHeight)+"px"},a=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a),x({right:parseInt(o.style.right)||12,bottom:parseInt(o.style.bottom)||12})};document.addEventListener("mousemove",d),document.addEventListener("mouseup",a)});const b=L("div","grip");b.addEventListener("mousedown",n=>{n.preventDefault(),b.classList.add("active");const e=o.getBoundingClientRect(),t=n.clientX,r=n.clientY,i=e.width,l=e.height,d=n=>{if("right"!==I){const e="bottom"===I?r-n.clientY:n.clientY-r;o.style.height=C(l+e,320,window.innerHeight-24)+"px"}if("bottom"!==I){const e="right"===I?t-n.clientX:n.clientX-t;o.style.width=C(i+e,320,window.innerWidth-24)+"px"}},a=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a),b.classList.remove("active");const n=parseInt(o.style.width),e=parseInt(o.style.height);x("float"===I?{w:n,h:e}:"bottom"===I?{bh:e}:{rw:n})};document.addEventListener("mousemove",d),document.addEventListener("mouseup",a)});const w=(n=>{let e=!1;const t=L("button","btn");t.innerHTML=g('<path d="M9 3a2 2 0 0 1 4 0v1h3a1 1 0 0 1 1 1v3h1a2 2 0 0 1 0 4h-1v3a1 1 0 0 1-1 1h-3v-1a2 2 0 0 0-4 0v1H6a1 1 0 0 1-1-1v-3H4a2 2 0 0 1 0-4h1V5a1 1 0 0 1 1-1h3z"/>');const o=L("div","plugins");o.hidden=!0;const r=()=>{const r=n.plugins||[];if(t.title=`plugins (${r.length})`,e)if(o.textContent="",r.length)for(const n of r){const e=L("div","plugin");e.appendChild(L("span","name",n.name)),e.appendChild(L("span","gave",S(n)||"nothing registered")),n.teardown||e.appendChild(L("span","flag","no teardown")),o.appendChild(e)}else o.appendChild(L("div","empty","no plugins installed, or this is a production build"))};return t.onclick=()=>{e=!e;for(const n of o.parentElement.children)n.hidden=n===o?!e:e;t.classList.toggle("active",e),r()},{btn:t,el:o,render:r}})(e);W=w.render,m.appendChild(w.btn),(p=L("button","btn")).onclick=()=>{J(y[I]),x({dock:I})},m.appendChild(p),(a=L("button","btn")).onclick=()=>{(n=>{try{localStorage.setItem(u,n)}catch{}})(R=k[R]),Y()},m.appendChild(a),X.addEventListener("change",()=>{"system"===R&&Y()}),Y(),(d=L("button","btn")).title="pick an element on the page",d.innerHTML=g('<circle cx="12" cy="12" r="7"/><line x1="12" y1="1" x2="12" y2="6"/><line x1="12" y1="18" x2="12" y2="23"/><line x1="1" y1="12" x2="6" y2="12"/><line x1="18" y1="12" x2="23" y2="12"/>'),d.onclick=()=>_?cn():(_=!0,d.classList.add("active"),document.addEventListener("click",sn,!0),void document.addEventListener("mousemove",pn,!0)),m.appendChild(d);const E=L("button","btn","\u2715");E.onclick=()=>{_&&cn(),o.style.display="none",r.style.display="",x({open:!1})},m.appendChild(E),o.appendChild(m);const O=L("div","body"),$=L("div","side"),j=L("div","tabs");(c=L("div","tab active")).onclick=()=>nn("Elements"),(h=L("div","tab")).onclick=()=>nn("Stores"),j.appendChild(c),j.appendChild(h),$.appendChild(j);const A=L("input","filter");A.placeholder="Filter by name or state",A.oninput=()=>{z=A.value.trim().toLowerCase(),on()},A.onkeydown=n=>{"Escape"===n.key&&(A.value="",z="",on())},$.appendChild(A),i=L("div","tree"),$.appendChild(i),l=L("div","state"),O.appendChild($),O.appendChild(l),O.appendChild(w.el),o.appendChild(O),o.appendChild(b),t.appendChild(o);const B=f();B.w&&(N=o.style.width=B.w+"px"),B.h&&(H=o.style.height=B.h+"px"),null!=B.right&&(P=o.style.right=B.right+"px"),null!=B.bottom&&(T=o.style.bottom=B.bottom+"px"),B.bh&&(D=B.bh+"px"),B.rw&&(V=B.rw+"px"),J(B.dock||"float"),document.body.appendChild(n),B.open&&(r.style.display="none",o.style.display="flex",F(),gn()),e.on("scope:mount",gn),e.on("scope:unmount",n=>{n===M&&(M=null),gn()}),e.stores&&e.on("store:register",gn),e.plugins&&e.on("plugin:install",gn),e.on("flush",gn)},vn=()=>{const n=window.__LITE_VUE__;n?(e=n,document.body?un():addEventListener("DOMContentLoaded",un)):console.warn("[LiteVue devtools] window.__LITE_VUE__ not found \u2014 load LiteVue before the devtools panel script.")};return vn(),n.init=vn,n}({});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,n,t,o,r,i,d,l,a,s,p,c,h=e=>'<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">'+e+"</svg>",u="litevue-devtools-theme",g="litevue-devtools-ui",v=()=>{try{return JSON.parse(localStorage.getItem(g)||"{}")}catch{return{}}},f=e=>{try{localStorage.setItem(g,JSON.stringify({...v(),...e}))}catch{}},x={dark:h('<path d="M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z"/>'),light:h('<circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.2" y1="4.2" x2="5.6" y2="5.6"/><line x1="18.4" y1="18.4" x2="19.8" y2="19.8"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.2" y1="19.8" x2="5.6" y2="18.4"/><line x1="18.4" y1="5.6" x2="19.8" y2="4.2"/>'),system:h('<rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/>')},b={float:h('<rect x="2" y="4" width="14" height="11" rx="1"/><rect x="9" y="10" width="13" height="10" rx="1" fill="currentColor"/>'),bottom:h('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="2" y="14" width="20" height="7" fill="currentColor"/>'),right:h('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="14" y="3" width="8" height="18" fill="currentColor"/>')},m={float:"bottom",bottom:"right",right:"float"},y={float:"floating",bottom:"docked to bottom",right:"docked to right"},w={dark:"light",light:"system",system:"dark"},k=(e,n,t)=>Math.min(Math.max(e,n),Math.max(n,t)),C=(e,n,t)=>{const o=document.createElement(e);return o.className=n,null!=t&&(o.textContent=t),o},L=(e,n)=>{const t=/* @__PURE__ */new Set,o=(e,r,i)=>{if(null!=e){if("object"!=typeof e)return String(e).toLowerCase().includes(n)?r:void 0;if(i>4||t.has(e))return;t.add(e);for(const t of Object.keys(e)){if("$"===t[0])continue;let d;try{d=e[t]}catch{continue}if("function"==typeof d)continue;const l=r?`${r}.${t}`:t;if(t.toLowerCase().includes(n))return l;const a=o(d,l,i+1);if(a)return a}}};return o(e,"",0)},E=e=>{let n;try{n=void 0===e?"undefined":JSON.stringify(e)??String(e)}catch{n=String(e)}return n.length>60?n.slice(0,60)+"\u2026":n},O=null,S=null,_=!1,$="",M="Elements",z="float",I="",N="",j="",P="",T="",H="",D=(()=>{try{const e=localStorage.getItem(u);if("light"===e||"system"===e)return e}catch{}return"dark"})(),W=matchMedia("(prefers-color-scheme: light)"),V=()=>{const e="light"===D||"system"===D&&W.matches;n.host.classList.toggle("light",e),l.innerHTML=x[D],l.title="theme: "+D},R=/* @__PURE__ */new Set,X=/* @__PURE__ */new WeakSet,Y=()=>{if("float"!==z)return;const e=parseInt(t.style.right)||0,n=parseInt(t.style.bottom)||0;j=t.style.right=k(e,0,window.innerWidth-t.offsetWidth)+"px",P=t.style.bottom=k(n,0,window.innerHeight-t.offsetHeight)+"px"},A=e=>{"float"===z?(I=t.style.width||I,N=t.style.height||N,j=t.style.right||j,P=t.style.bottom||P):"bottom"===z?T=t.style.height||T:H=t.style.width||H,z=e;const n="float"!==e;t.classList.toggle("dock-bottom","bottom"===e),t.classList.toggle("dock-right","right"===e),t.style.right=n?"":j,t.style.bottom=n?"":P,t.style.width="bottom"===e?"":"right"===e?H:I,t.style.height="right"===e?"":"bottom"===e?T:N,s.innerHTML=b[e],s.title="panel: "+y[e]},B=e=>{const n=C("span","label");return n.appendChild(C("span","punct","<")),n.appendChild(C("span","name",Q(e))),n.appendChild(C("span","punct",">")),n},F=n=>{let t=n.parentElement;for(;t;){if(e.scopes.has(t))return t;t=t.parentElement}return null},J=e=>{const n=e.getBoundingClientRect();a.style.cssText=`display:block;left:${n.left}px;top:${n.top}px;width:${n.width}px;height:${n.height}px`},U=()=>{a.style.display="none"},q=n=>{n!==O&&R.clear(),S=null,O=n,M="Elements",window.$scope=n?e.scopes.get(n):void 0,ee(),ne()},G=n=>{n!==S&&R.clear(),O=null,S=n,M="Stores",window.$scope=e.stores.get(n),ee(),ne()},Z=e=>{M=e,ee()},K=/^\s*([A-Za-z_$][\w$]*)\s*\(/,Q=n=>e.names.get(n)||(n=>{const t=K.exec(e.exps.get(n)||"")?.[1];return t&&e.components?.has(t)?t:void 0})(n)||n.id||n.tagName.toLowerCase(),ee=()=>{if((()=>{const n=e.stores?e.stores.size:0;p.textContent=`Elements (${e.scopes.size})`,p.className="Elements"===M?"tab active":"tab",c.textContent=`Stores (${n})`,c.className="Stores"===M?"tab active":"tab"})(),r.textContent="","Elements"===M){const n=[...e.scopes.keys()].sort((e,n)=>e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),t=/* @__PURE__ */new Map;for(const r of n)if(!$||Q(r).toLowerCase().includes($))t.set(r,void 0);else{const n=L(e.scopes.get(r),$);n&&t.set(r,n)}if(!t.size)return void r.appendChild(C("div","empty",$?"no matching scopes":"no scopes mounted"));const o=/* @__PURE__ */new Set;for(const e of t.keys()){o.add(e);for(let n=F(e);n;n=F(n))o.add(n)}const i=/* @__PURE__ */new Map,d=/* @__PURE__ */new Map,l=/* @__PURE__ */new Map;for(const e of n){if(!o.has(e))continue;const n=F(e);i.set(e,n),l.set(e,n?(l.get(n)??0)+1:0),n&&d.set(n,(d.get(n)||0)+1)}const a=e=>{for(let n=i.get(e);n;n=i.get(n)??null)if(X.has(n))return!0;return!1};for(const s of n){if(!o.has(s)||a(s))continue;const n=C("div",s===O?"row sel":"row");n.style.paddingLeft=8+12*(l.get(s)??0)+"px";const i=X.has(s);if(d.get(s)){const e=C("span",i?"arrow":"arrow open","\u25b6");e.onclick=e=>{e.stopPropagation(),i?X.delete(s):X.add(s),ee()},n.appendChild(e)}else n.appendChild(C("span","spacer"));n.appendChild(B(s));const p=e.exps.get(s);p&&n.appendChild(C("span","exp"," "+p));const c=t.get(s);c&&n.appendChild(C("span","hit"," "+c)),n.onclick=()=>q(s),n.onmouseenter=()=>J(s),n.onmouseleave=U,r.appendChild(n)}return}const n=/* @__PURE__ */new Map;for(const o of e.stores?e.stores.keys():[])if(!$||o.toLowerCase().includes($))n.set(o,void 0);else{const t=L(e.stores.get(o),$);t&&n.set(o,t)}const t=[...n.keys()];if(t.length)for(const e of t){const t=C("div",e===S?"row sel":"row"),o=C("span","label");o.appendChild(C("span","punct","$store.")),o.appendChild(C("span","name",e)),t.appendChild(o);const i=n.get(e);i&&t.appendChild(C("span","hit"," "+i)),t.onclick=()=>G(e),r.appendChild(t)}else r.appendChild(C("div","empty",$?"no matching stores":"no stores registered"))},ne=()=>{if(i.contains(n.activeElement))return;i.textContent="";const t=S?e.stores.get(S):O?e.scopes.get(O):void 0;if(!t)return void i.appendChild(C("div","empty","Select a scope"));const{own:o,inherited:r}=(e=>{const n=(e,n)=>"$"!==n[0]&&"function"!=typeof e[n],t=Object.keys(e).filter(t=>n(e,t)),o=new Set(t),r=[];let i=Object.getPrototypeOf(e);for(;i&&i!==Object.prototype;){for(const e of Object.keys(i))!o.has(e)&&n(i,e)&&(o.add(e),r.push(e));i=Object.getPrototypeOf(i)}return{own:t,inherited:r}})(t);o.forEach(e=>oe(e,t,e,0,"prop",[])),r.length&&(i.appendChild(C("div","divider","inherited")),r.forEach(e=>oe(e,t,e,0,"prop inherited",[]))),o.length||r.length||i.appendChild(C("div","empty","empty scope")),i.appendChild(te(t))},te=e=>{const n=C("div","prop adder");n.appendChild(C("span","spacer"));const t=C("input","val key-in");t.placeholder="key";const o=C("input","val");o.placeholder="value";return t.onkeydown=o.onkeydown=n=>{"Enter"===n.key&&(()=>{const n=t.value.trim();if(!n)return;const r=o.value;let d=r;"true"===r?d=!0:"false"===r?d=!1:""===r||isNaN(+r)||(d=+r),e[n]=d,t.blur(),o.blur(),se(),setTimeout(()=>{const e=i.querySelector(".adder .key-in");e&&e.focus()})})()},n.appendChild(t),n.appendChild(o),n},oe=(e,n,t,o,r,d)=>{const l=n[e],a=C("div",r);if(a.style.paddingLeft=8+14*o+"px",null!==l&&"object"==typeof l){const s=d.indexOf(l)>-1,p=!s&&R.has(t);if(a.appendChild(C("span",p?"arrow open":"arrow","\u25b6")),a.appendChild(C("span","key",e)),a.appendChild(C("span","preview",s?"(circular)":(e=>Array.isArray(e)?`(${e.length}) ${E(e)}`:E(e))(l))),s||(a.classList.add("toggle"),a.onclick=()=>{p?R.delete(t):R.add(t),ne()}),re(a,n,e,o,r),i.appendChild(a),p){const e=Object.keys(l);if(!e.length){const e=C("div","muted","(empty)");e.style.paddingLeft=22+14*(o+1)+"px",i.appendChild(e)}for(const n of e)oe(n,l,t+"."+n,o+1,r,d.concat([l]))}return}a.appendChild(C("span","spacer")),a.appendChild(C("span","key",e));const s=((e,n)=>{for(let t=e;t&&t!==Object.prototype;t=Object.getPrototypeOf(t)){const e=Object.getOwnPropertyDescriptor(t,n);if(e)return e}})(n,e);if("function"==typeof l)a.appendChild(C("span","preview","\u0192"));else if((e=>{if(!e)return!1;if(e.get&&!e.set)return!0;const n=e.value;return!!n&&!0===n.__v_isRef&&!0===n.__v_isReadonly})(s))a.appendChild(C("span","preview",E(l)));else if("boolean"==typeof l){a.appendChild(C("span","bool",String(l)));const t=C("input","check");t.type="checkbox",t.checked=l,t.onchange=()=>{n[e]=t.checked,t.blur(),se()},a.appendChild(t)}else{const t=C("input","val");t.value=E(l),t.onfocus=()=>{t.value="string"==typeof l?l:String(l)},t.onkeydown=e=>{"Enter"===e.key&&t.blur(),"Escape"===e.key&&(t.value=E(l),t.blur())},t.onblur=()=>{const o=((e,n)=>{if("number"==typeof n){const n=parseFloat(e);return isNaN(n)?e:n}return e})(t.value,l);o!==l?(n[e]=o,se()):t.value=E(l)},a.appendChild(t)}re(a,n,e,o,r),i.appendChild(a)},re=(e,t,o,r,i)=>{if(0!==r||"prop"!==i)return;const d=Object.getOwnPropertyDescriptor(t,o);if(d&&d.get)return;const l=C("button","del","\u2715");l.title=`delete "${o}"`,l.onclick=e=>{e.stopPropagation();const r=n.activeElement;r&&r.blur&&r.blur(),delete t[o],se()},e.appendChild(l)},ie=t=>{const o=t.target;if(o===n.host)return;t.preventDefault(),t.stopPropagation(),le();let r=o;for(;r&&!e.scopes.has(r);)r=r.parentElement;r&&q(r)},de=t=>{let o=t.target;if(o!==n.host){for(;o&&!e.scopes.has(o);)o=o.parentElement;o?J(o):U()}},le=()=>{_=!1,d.classList.remove("active"),U(),document.removeEventListener("click",ie,!0),document.removeEventListener("mousemove",de,!0)},ae=!1,se=()=>{ae||(ae=!0,setTimeout(()=>{ae=!1,"none"!==t.style.display&&(ee(),ne())}))},pe=()=>{const g=document.createElement("div");n=g.attachShadow({mode:"open"});const x=document.createElement("style");x.textContent="\n:host {\n all: initial;\n --bg: #1e1e1e;\n --bg2: #252526;\n --hover: #2a2d2e;\n --border: #3c3c3c;\n --fg: #d4d4d4;\n --muted: #808080;\n --accent: #42b883;\n --sel: #094771;\n --key: #9cdcfe;\n --val: #ce9178;\n --exp: #6a9955;\n}\n:host(.light) {\n --bg: #ffffff;\n --bg2: #f3f3f3;\n --hover: #ececec;\n --border: #d0d0d0;\n --fg: #383a42;\n --muted: #8e8e90;\n --sel: #d2e5f5;\n --key: #0451a5;\n --val: #a31515;\n --exp: #22863a;\n}\n* {\n box-sizing: border-box;\n}\n.pill, .panel {\n position: fixed;\n right: 12px;\n bottom: 12px;\n z-index: 2147483646;\n font: 11px/1.5 ui-monospace, Menlo, Consolas, monospace;\n color: var(--fg);\n}\n.pill {\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 999px;\n padding: 4px 10px;\n cursor: pointer;\n user-select: none;\n}\n.pill:hover {\n border-color: var(--accent);\n}\n.panel {\n display: flex;\n flex-direction: column;\n width: 760px;\n max-width: calc(100vw - 24px);\n height: 450px;\n max-height: calc(100vh - 24px);\n min-width: 320px;\n min-height: 320px;\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 6px;\n overflow: hidden;\n box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);\n}\n.panel.dock-bottom {\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n max-width: none;\n border-radius: 0;\n border-left: 0;\n border-right: 0;\n border-bottom: 0;\n}\n.panel.dock-right {\n top: 0;\n right: 0;\n bottom: 0;\n height: 100%;\n max-height: none;\n border-radius: 0;\n border-top: 0;\n border-right: 0;\n border-bottom: 0;\n}\n.panel.dock-bottom .header,\n.panel.dock-right .header {\n cursor: default;\n}\n.grip {\n position: absolute;\n z-index: 1;\n touch-action: none;\n right: 0;\n bottom: 0;\n width: 14px;\n height: 14px;\n cursor: nwse-resize;\n background: linear-gradient(135deg, transparent 50%, var(--border) 50%);\n}\n.panel.dock-bottom .grip {\n top: 0;\n left: 0;\n width: auto;\n height: 5px;\n cursor: ns-resize;\n background: none;\n}\n.panel.dock-right .grip {\n top: 0;\n left: 0;\n width: 5px;\n height: auto;\n cursor: ew-resize;\n background: none;\n}\n.panel.dock-bottom .grip:hover,\n.panel.dock-bottom .grip.active,\n.panel.dock-right .grip:hover,\n.panel.dock-right .grip.active {\n background: var(--accent);\n}\n.header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px 8px;\n background: var(--bg2);\n border-bottom: 1px solid var(--border);\n user-select: none;\n cursor: move;\n}\n.title {\n color: var(--accent);\n font-weight: bold;\n margin-right: auto;\n}\n.btn {\n display: flex;\n align-items: center;\n background: none;\n border: 1px solid var(--border);\n border-radius: 3px;\n color: var(--fg);\n font: inherit;\n padding: 3px 7px;\n cursor: pointer;\n}\n.btn svg {\n display: block;\n}\n.btn:hover {\n border-color: var(--accent);\n}\n.btn.active {\n background: var(--accent);\n border-color: var(--accent);\n color: var(--bg);\n}\n.body {\n display: flex;\n flex: 1;\n min-height: 0;\n}\n.side {\n display: flex;\n flex-direction: column;\n width: 40%;\n min-width: 0;\n border-right: 1px solid var(--border);\n}\n.tabs {\n display: flex;\n border-bottom: 1px solid var(--border);\n user-select: none;\n}\n.tab {\n flex: 1;\n padding: 4px 0;\n text-align: center;\n color: var(--muted);\n border-bottom: 2px solid transparent;\n cursor: pointer;\n}\n.tab:hover {\n color: var(--fg);\n}\n.tab.active {\n color: var(--fg);\n border-bottom-color: var(--accent);\n}\n.filter {\n margin: 6px 6px 2px;\n background: var(--bg2);\n border: 1px solid var(--border);\n border-radius: 3px;\n color: var(--fg);\n font: inherit;\n padding: 2px 6px;\n outline: none;\n}\n.filter:focus {\n border-color: var(--accent);\n}\n.filter::placeholder {\n color: var(--muted);\n}\n.tree {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.state {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.row {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 2px 8px;\n white-space: nowrap;\n overflow: hidden;\n cursor: pointer;\n}\n.row .label {\n flex-shrink: 0;\n}\n.row .arrow {\n cursor: pointer;\n padding: 3px 4px;\n margin: -3px -4px;\n box-sizing: content-box;\n}\n.row .arrow:hover {\n color: var(--key);\n}\n.row .hit {\n color: var(--exp);\n opacity: 0.75;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.row:hover {\n background: var(--hover);\n}\n.row.sel {\n background: var(--sel);\n}\n.row .name {\n color: var(--key);\n}\n.row .punct {\n color: var(--muted);\n}\n.row .exp {\n color: var(--exp);\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.prop {\n display: flex;\n gap: 6px;\n padding: 2px 8px;\n align-items: center;\n}\n.prop .key {\n color: var(--key);\n flex-shrink: 0;\n}\n.arrow {\n width: 12px;\n flex-shrink: 0;\n color: var(--muted);\n font-size: 9px;\n transition: transform 0.1s;\n}\n.arrow.open {\n transform: rotate(90deg);\n}\n.spacer {\n width: 12px;\n flex-shrink: 0;\n}\n.prop.toggle {\n cursor: pointer;\n user-select: none;\n}\n.prop.toggle:hover {\n background: var(--hover);\n}\n.preview {\n flex: 1;\n min-width: 0;\n color: var(--muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.muted {\n color: var(--muted);\n padding: 2px 8px;\n}\n.check {\n margin: 0;\n flex-shrink: 0;\n accent-color: var(--accent);\n cursor: pointer;\n}\n.del {\n visibility: hidden;\n flex-shrink: 0;\n background: none;\n border: none;\n padding: 0 2px;\n color: var(--muted);\n font: inherit;\n cursor: pointer;\n}\n.prop:hover .del {\n visibility: visible;\n}\n.del:hover {\n color: #e5534b;\n}\n.adder .key-in {\n flex: 0 0 30%;\n color: var(--key);\n}\n.adder input::placeholder {\n color: var(--muted);\n}\n.adder input {\n border-color: var(--border);\n}\n.bool {\n color: var(--val);\n}\n.prop.inherited .key {\n color: var(--muted);\n}\n.prop .val {\n flex: 1;\n min-width: 0;\n background: none;\n border: 1px solid transparent;\n border-radius: 3px;\n color: var(--val);\n font: inherit;\n padding: 0 3px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\ninput.val:hover, input.val:focus {\n border-color: var(--border);\n outline: none;\n background: var(--bg2);\n}\n.divider {\n padding: 4px 8px 1px;\n color: var(--muted);\n font-size: 10px;\n text-transform: uppercase;\n user-select: none;\n}\n.empty {\n padding: 8px;\n color: var(--muted);\n}\n.highlight {\n position: fixed;\n z-index: 2147483645;\n background: rgba(66, 184, 131, 0.25);\n border: 1px solid var(--accent);\n pointer-events: none;\n display: none;\n}\n",n.appendChild(x),a=C("div","highlight"),n.appendChild(a),(o=C("div","pill","\u26a1 LiteVue")).onclick=()=>{o.style.display="none",t.style.display="flex",Y(),f({open:!0}),se()},n.appendChild(o),(t=C("div","panel")).style.display="none";const b=C("div","header");b.appendChild(C("span","title","\u26a1 LiteVue")),b.addEventListener("mousedown",e=>{if(e.target.closest(".btn"))return;if("float"!==z)return;e.preventDefault();const n=t.getBoundingClientRect(),o=window.innerWidth-n.right,r=window.innerHeight-n.bottom,i=e.clientX,d=e.clientY,l=e=>{t.style.right=k(o-(e.clientX-i),0,window.innerWidth-t.offsetWidth)+"px",t.style.bottom=k(r-(e.clientY-d),0,window.innerHeight-t.offsetHeight)+"px"},a=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a),f({right:parseInt(t.style.right)||12,bottom:parseInt(t.style.bottom)||12})};document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)});const y=C("div","grip");y.addEventListener("mousedown",e=>{e.preventDefault(),y.classList.add("active");const n=t.getBoundingClientRect(),o=e.clientX,r=e.clientY,i=n.width,d=n.height,l=e=>{if("right"!==z){const n="bottom"===z?r-e.clientY:e.clientY-r;t.style.height=k(d+n,320,window.innerHeight-24)+"px"}if("bottom"!==z){const n="right"===z?o-e.clientX:e.clientX-o;t.style.width=k(i+n,320,window.innerWidth-24)+"px"}},a=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a),y.classList.remove("active");const e=parseInt(t.style.width),n=parseInt(t.style.height);f("float"===z?{w:e,h:n}:"bottom"===z?{bh:n}:{rw:e})};document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)}),(s=C("button","btn")).onclick=()=>{A(m[z]),f({dock:z})},b.appendChild(s),(l=C("button","btn")).onclick=()=>{(e=>{try{localStorage.setItem(u,e)}catch{}})(D=w[D]),V()},b.appendChild(l),W.addEventListener("change",()=>{"system"===D&&V()}),V(),(d=C("button","btn")).title="pick an element on the page",d.innerHTML=h('<circle cx="12" cy="12" r="7"/><line x1="12" y1="1" x2="12" y2="6"/><line x1="12" y1="18" x2="12" y2="23"/><line x1="1" y1="12" x2="6" y2="12"/><line x1="18" y1="12" x2="23" y2="12"/>'),d.onclick=()=>_?le():(_=!0,d.classList.add("active"),document.addEventListener("click",ie,!0),void document.addEventListener("mousemove",de,!0)),b.appendChild(d);const L=C("button","btn","\u2715");L.onclick=()=>{_&&le(),t.style.display="none",o.style.display="",f({open:!1})},b.appendChild(L),t.appendChild(b);const E=C("div","body"),S=C("div","side"),M=C("div","tabs");(p=C("div","tab active")).onclick=()=>Z("Elements"),(c=C("div","tab")).onclick=()=>Z("Stores"),M.appendChild(p),M.appendChild(c),S.appendChild(M);const R=C("input","filter");R.placeholder="Filter by name or state",R.oninput=()=>{$=R.value.trim().toLowerCase(),ee()},R.onkeydown=e=>{"Escape"===e.key&&(R.value="",$="",ee())},S.appendChild(R),r=C("div","tree"),S.appendChild(r),i=C("div","state"),E.appendChild(S),E.appendChild(i),t.appendChild(E),t.appendChild(y),n.appendChild(t);const X=v();X.w&&(I=t.style.width=X.w+"px"),X.h&&(N=t.style.height=X.h+"px"),null!=X.right&&(j=t.style.right=X.right+"px"),null!=X.bottom&&(P=t.style.bottom=X.bottom+"px"),X.bh&&(T=X.bh+"px"),X.rw&&(H=X.rw+"px"),A(X.dock||"float"),document.body.appendChild(g),X.open&&(o.style.display="none",t.style.display="flex",Y(),se()),e.on("scope:mount",se),e.on("scope:unmount",e=>{e===O&&(O=null),se()}),e.stores&&e.on("store:register",se),e.on("flush",se)},ce=()=>{const n=window.__LITE_VUE__;n?(e=n,document.body?pe():addEventListener("DOMContentLoaded",pe)):console.warn("[LiteVue devtools] window.__LITE_VUE__ not found \u2014 load LiteVue before the devtools panel script.")};ce();export{ce as init};
|
|
1
|
+
var n,e,t,o,r,i,l,d,a,s,p,c,h=n=>'<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">'+n+"</svg>",g="litevue-devtools-theme",u="litevue-devtools-ui",v=()=>{try{return JSON.parse(localStorage.getItem(u)||"{}")}catch{return{}}},f=n=>{try{localStorage.setItem(u,JSON.stringify({...v(),...n}))}catch{}},x={dark:h('<path d="M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z"/>'),light:h('<circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.2" y1="4.2" x2="5.6" y2="5.6"/><line x1="18.4" y1="18.4" x2="19.8" y2="19.8"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.2" y1="19.8" x2="5.6" y2="18.4"/><line x1="18.4" y1="5.6" x2="19.8" y2="4.2"/>'),system:h('<rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/>')},m={float:h('<rect x="2" y="4" width="14" height="11" rx="1"/><rect x="9" y="10" width="13" height="10" rx="1" fill="currentColor"/>'),bottom:h('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="2" y="14" width="20" height="7" fill="currentColor"/>'),right:h('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="14" y="3" width="8" height="18" fill="currentColor"/>')},b={float:"bottom",bottom:"right",right:"float"},y={float:"floating",bottom:"docked to bottom",right:"docked to right"},w={dark:"light",light:"system",system:"dark"},k=(n,e,t)=>Math.min(Math.max(n,e),Math.max(e,t)),C=(n,e,t)=>{const o=document.createElement(n);return o.className=e,null!=t&&(o.textContent=t),o},L=(n,e)=>{const t=/* @__PURE__ */new Set,o=(n,r,i)=>{if(null!=n){if("object"!=typeof n)return String(n).toLowerCase().includes(e)?r:void 0;if(i>4||t.has(n))return;t.add(n);for(const t of Object.keys(n)){if("$"===t[0])continue;let l;try{l=n[t]}catch{continue}if("function"==typeof l)continue;const d=r?`${r}.${t}`:t;if(t.toLowerCase().includes(e))return d;const a=o(l,d,i+1);if(a)return a}}};return o(n,"",0)},E=n=>{let e;try{e=void 0===n?"undefined":JSON.stringify(n)??String(n)}catch{e=String(n)}return e.length>60?e.slice(0,60)+"\u2026":e},O=n=>[...n.directives.map(n=>"v-"+n),...n.magics].join(" "),S=null,$=null,_=!1,M="",z="Elements",I="float",N="",j="",H="",T="",P="",D="",W=()=>{},V=(()=>{try{const n=localStorage.getItem(g);if("light"===n||"system"===n)return n}catch{}return"dark"})(),R=matchMedia("(prefers-color-scheme: light)"),X=()=>{const n="light"===V||"system"===V&&R.matches;e.host.classList.toggle("light",n),d.innerHTML=x[V],d.title="theme: "+V},Y=/* @__PURE__ */new Set,A=/* @__PURE__ */new WeakSet,B=()=>{if("float"!==I)return;const n=parseInt(t.style.right)||0,e=parseInt(t.style.bottom)||0;H=t.style.right=k(n,0,window.innerWidth-t.offsetWidth)+"px",T=t.style.bottom=k(e,0,window.innerHeight-t.offsetHeight)+"px"},F=n=>{"float"===I?(N=t.style.width||N,j=t.style.height||j,H=t.style.right||H,T=t.style.bottom||T):"bottom"===I?P=t.style.height||P:D=t.style.width||D,I=n;const e="float"!==n;t.classList.toggle("dock-bottom","bottom"===n),t.classList.toggle("dock-right","right"===n),t.style.right=e?"":H,t.style.bottom=e?"":T,t.style.width="bottom"===n?"":"right"===n?D:N,t.style.height="right"===n?"":"bottom"===n?P:j,s.innerHTML=m[n],s.title="panel: "+y[n]},J=n=>{const e=C("span","label");return e.appendChild(C("span","punct","<")),e.appendChild(C("span","name",en(n))),e.appendChild(C("span","punct",">")),e},U=e=>{let t=e.parentElement;for(;t;){if(n.scopes.has(t))return t;t=t.parentElement}return null},q=n=>{const e=n.getBoundingClientRect();a.style.cssText=`display:block;left:${e.left}px;top:${e.top}px;width:${e.width}px;height:${e.height}px`},G=()=>{a.style.display="none"},Z=e=>{e!==S&&Y.clear(),$=null,S=e,z="Elements",window.$scope=e?n.scopes.get(e):void 0,tn(),on()},K=e=>{e!==$&&Y.clear(),S=null,$=e,z="Stores",window.$scope=n.stores.get(e),tn(),on()},Q=n=>{z=n,tn()},nn=/^\s*([A-Za-z_$][\w$]*)\s*\(/,en=e=>n.names.get(e)||(e=>{const t=nn.exec(n.exps.get(e)||"")?.[1];return t&&n.components?.has(t)?t:void 0})(e)||e.id||e.tagName.toLowerCase(),tn=()=>{if((()=>{const e=n.stores?n.stores.size:0;p.textContent=`Elements (${n.scopes.size})`,p.className="Elements"===z?"tab active":"tab",c.textContent=`Stores (${e})`,c.className="Stores"===z?"tab active":"tab"})(),W(),r.textContent="","Elements"===z){const e=[...n.scopes.keys()].sort((n,e)=>n.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),t=/* @__PURE__ */new Map;for(const r of e)if(!M||en(r).toLowerCase().includes(M))t.set(r,void 0);else{const e=L(n.scopes.get(r),M);e&&t.set(r,e)}if(!t.size)return void r.appendChild(C("div","empty",M?"no matching scopes":"no scopes mounted"));const o=/* @__PURE__ */new Set;for(const n of t.keys()){o.add(n);for(let e=U(n);e;e=U(e))o.add(e)}const i=/* @__PURE__ */new Map,l=/* @__PURE__ */new Map,d=/* @__PURE__ */new Map;for(const n of e){if(!o.has(n))continue;const e=U(n);i.set(n,e),d.set(n,e?(d.get(e)??0)+1:0),e&&l.set(e,(l.get(e)||0)+1)}const a=n=>{for(let e=i.get(n);e;e=i.get(e)??null)if(A.has(e))return!0;return!1};for(const s of e){if(!o.has(s)||a(s))continue;const e=C("div",s===S?"row sel":"row");e.style.paddingLeft=8+12*(d.get(s)??0)+"px";const i=A.has(s);if(l.get(s)){const n=C("span",i?"arrow":"arrow open","\u25b6");n.onclick=n=>{n.stopPropagation(),i?A.delete(s):A.add(s),tn()},e.appendChild(n)}else e.appendChild(C("span","spacer"));e.appendChild(J(s));const p=n.exps.get(s);p&&e.appendChild(C("span","exp"," "+p));const c=t.get(s);c&&e.appendChild(C("span","hit"," "+c)),e.onclick=()=>Z(s),e.onmouseenter=()=>q(s),e.onmouseleave=G,r.appendChild(e)}return}const e=/* @__PURE__ */new Map;for(const o of n.stores?n.stores.keys():[])if(!M||o.toLowerCase().includes(M))e.set(o,void 0);else{const t=L(n.stores.get(o),M);t&&e.set(o,t)}const t=[...e.keys()];if(t.length)for(const n of t){const t=C("div",n===$?"row sel":"row"),o=C("span","label");o.appendChild(C("span","punct","$store.")),o.appendChild(C("span","name",n)),t.appendChild(o);const i=e.get(n);i&&t.appendChild(C("span","hit"," "+i)),t.onclick=()=>K(n),r.appendChild(t)}else r.appendChild(C("div","empty",M?"no matching stores":"no stores registered"))},on=()=>{if(i.contains(e.activeElement))return;i.textContent="";const t=$?n.stores.get($):S?n.scopes.get(S):void 0;if(!t)return void i.appendChild(C("div","empty","Select a scope"));const{own:o,inherited:r}=(n=>{const e=(n,e)=>"$"!==e[0]&&"function"!=typeof n[e],t=Object.keys(n).filter(t=>e(n,t)),o=new Set(t),r=[];let i=Object.getPrototypeOf(n);for(;i&&i!==Object.prototype;){for(const n of Object.keys(i))!o.has(n)&&e(i,n)&&(o.add(n),r.push(n));i=Object.getPrototypeOf(i)}return{own:t,inherited:r}})(t);o.forEach(n=>ln(n,t,n,0,"prop",[])),r.length&&(i.appendChild(C("div","divider","inherited")),r.forEach(n=>ln(n,t,n,0,"prop inherited",[]))),o.length||r.length||i.appendChild(C("div","empty","empty scope")),i.appendChild(rn(t))},rn=n=>{const e=C("div","prop adder");e.appendChild(C("span","spacer"));const t=C("input","val key-in");t.placeholder="key";const o=C("input","val");o.placeholder="value";return t.onkeydown=o.onkeydown=e=>{"Enter"===e.key&&(()=>{const e=t.value.trim();if(!e)return;const r=o.value;let l=r;"true"===r?l=!0:"false"===r?l=!1:""===r||isNaN(+r)||(l=+r),n[e]=l,t.blur(),o.blur(),hn(),setTimeout(()=>{const n=i.querySelector(".adder .key-in");n&&n.focus()})})()},e.appendChild(t),e.appendChild(o),e},ln=(n,e,t,o,r,l)=>{const d=e[n],a=C("div",r);if(a.style.paddingLeft=8+14*o+"px",null!==d&&"object"==typeof d){const s=l.indexOf(d)>-1,p=!s&&Y.has(t);if(a.appendChild(C("span",p?"arrow open":"arrow","\u25b6")),a.appendChild(C("span","key",n)),a.appendChild(C("span","preview",s?"(circular)":(n=>Array.isArray(n)?`(${n.length}) ${E(n)}`:E(n))(d))),s||(a.classList.add("toggle"),a.onclick=()=>{p?Y.delete(t):Y.add(t),on()}),dn(a,e,n,o,r),i.appendChild(a),p){const n=Object.keys(d);if(!n.length){const n=C("div","muted","(empty)");n.style.paddingLeft=22+14*(o+1)+"px",i.appendChild(n)}for(const e of n)ln(e,d,t+"."+e,o+1,r,l.concat([d]))}return}a.appendChild(C("span","spacer")),a.appendChild(C("span","key",n));const s=((n,e)=>{for(let t=n;t&&t!==Object.prototype;t=Object.getPrototypeOf(t)){const n=Object.getOwnPropertyDescriptor(t,e);if(n)return n}})(e,n);if("function"==typeof d)a.appendChild(C("span","preview","\u0192"));else if((n=>{if(!n)return!1;if(n.get&&!n.set)return!0;const e=n.value;return!!e&&!0===e.__v_isRef&&!0===e.__v_isReadonly})(s))a.appendChild(C("span","preview",E(d)));else if("boolean"==typeof d){a.appendChild(C("span","bool",String(d)));const t=C("input","check");t.type="checkbox",t.checked=d,t.onchange=()=>{e[n]=t.checked,t.blur(),hn()},a.appendChild(t)}else{const t=C("input","val");t.value=E(d),t.onfocus=()=>{t.value="string"==typeof d?d:String(d)},t.onkeydown=n=>{"Enter"===n.key&&t.blur(),"Escape"===n.key&&(t.value=E(d),t.blur())},t.onblur=()=>{const o=((n,e)=>{if("number"==typeof e){const e=parseFloat(n);return isNaN(e)?n:e}return n})(t.value,d);o!==d?(e[n]=o,hn()):t.value=E(d)},a.appendChild(t)}dn(a,e,n,o,r),i.appendChild(a)},dn=(n,t,o,r,i)=>{if(0!==r||"prop"!==i)return;const l=Object.getOwnPropertyDescriptor(t,o);if(l&&l.get)return;const d=C("button","del","\u2715");d.title=`delete "${o}"`,d.onclick=n=>{n.stopPropagation();const r=e.activeElement;r&&r.blur&&r.blur(),delete t[o],hn()},n.appendChild(d)},an=t=>{const o=t.target;if(o===e.host)return;t.preventDefault(),t.stopPropagation(),pn();let r=o;for(;r&&!n.scopes.has(r);)r=r.parentElement;r&&Z(r)},sn=t=>{let o=t.target;if(o!==e.host){for(;o&&!n.scopes.has(o);)o=o.parentElement;o?q(o):G()}},pn=()=>{_=!1,l.classList.remove("active"),G(),document.removeEventListener("click",an,!0),document.removeEventListener("mousemove",sn,!0)},cn=!1,hn=()=>{cn||(cn=!0,setTimeout(()=>{cn=!1,"none"!==t.style.display&&(tn(),on())}))},gn=()=>{const u=document.createElement("div");e=u.attachShadow({mode:"open"});const x=document.createElement("style");x.textContent="\n:host {\n all: initial;\n --bg: #1e1e1e;\n --bg2: #252526;\n --hover: #2a2d2e;\n --border: #3c3c3c;\n --fg: #d4d4d4;\n --muted: #808080;\n --accent: #42b883;\n --sel: #094771;\n --key: #9cdcfe;\n --val: #ce9178;\n --exp: #6a9955;\n}\n:host(.light) {\n --bg: #ffffff;\n --bg2: #f3f3f3;\n --hover: #ececec;\n --border: #d0d0d0;\n --fg: #383a42;\n --muted: #8e8e90;\n --sel: #d2e5f5;\n --key: #0451a5;\n --val: #a31515;\n --exp: #22863a;\n}\n* {\n box-sizing: border-box;\n}\n.pill, .panel {\n position: fixed;\n right: 12px;\n bottom: 12px;\n z-index: 2147483646;\n font: 11px/1.5 ui-monospace, Menlo, Consolas, monospace;\n color: var(--fg);\n}\n.pill {\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 999px;\n padding: 4px 10px;\n cursor: pointer;\n user-select: none;\n}\n.pill:hover {\n border-color: var(--accent);\n}\n.panel {\n display: flex;\n flex-direction: column;\n width: 760px;\n max-width: calc(100vw - 24px);\n height: 450px;\n max-height: calc(100vh - 24px);\n min-width: 320px;\n min-height: 320px;\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 6px;\n overflow: hidden;\n box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);\n}\n.panel.dock-bottom {\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n max-width: none;\n border-radius: 0;\n border-left: 0;\n border-right: 0;\n border-bottom: 0;\n}\n.panel.dock-right {\n top: 0;\n right: 0;\n bottom: 0;\n height: 100%;\n max-height: none;\n border-radius: 0;\n border-top: 0;\n border-right: 0;\n border-bottom: 0;\n}\n.panel.dock-bottom .header,\n.panel.dock-right .header {\n cursor: default;\n}\n.grip {\n position: absolute;\n z-index: 1;\n touch-action: none;\n right: 0;\n bottom: 0;\n width: 14px;\n height: 14px;\n cursor: nwse-resize;\n background: linear-gradient(135deg, transparent 50%, var(--border) 50%);\n}\n.panel.dock-bottom .grip {\n top: 0;\n left: 0;\n width: auto;\n height: 5px;\n cursor: ns-resize;\n background: none;\n}\n.panel.dock-right .grip {\n top: 0;\n left: 0;\n width: 5px;\n height: auto;\n cursor: ew-resize;\n background: none;\n}\n.panel.dock-bottom .grip:hover,\n.panel.dock-bottom .grip.active,\n.panel.dock-right .grip:hover,\n.panel.dock-right .grip.active {\n background: var(--accent);\n}\n.header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px 8px;\n background: var(--bg2);\n border-bottom: 1px solid var(--border);\n user-select: none;\n cursor: move;\n}\n.title {\n color: var(--accent);\n font-weight: bold;\n margin-right: auto;\n}\n.btn {\n display: flex;\n align-items: center;\n background: none;\n border: 1px solid var(--border);\n border-radius: 3px;\n color: var(--fg);\n font: inherit;\n padding: 3px 7px;\n cursor: pointer;\n}\n.btn svg {\n display: block;\n}\n.btn:hover {\n border-color: var(--accent);\n}\n.btn.active {\n background: var(--accent);\n border-color: var(--accent);\n color: var(--bg);\n}\n.body {\n display: flex;\n flex: 1;\n min-height: 0;\n}\n[hidden] {\n display: none !important;\n}\n.plugins {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.plugin {\n display: flex;\n gap: 8px;\n padding: 3px 10px;\n align-items: baseline;\n}\n.plugin .name {\n min-width: 120px;\n}\n.plugin .gave {\n flex: 1;\n color: var(--muted);\n word-break: break-word;\n}\n.plugin .flag {\n color: var(--muted);\n opacity: 0.7;\n}\n.side {\n display: flex;\n flex-direction: column;\n width: 40%;\n min-width: 0;\n border-right: 1px solid var(--border);\n}\n.tabs {\n display: flex;\n border-bottom: 1px solid var(--border);\n user-select: none;\n}\n.tab {\n flex: 1;\n padding: 4px 0;\n text-align: center;\n color: var(--muted);\n border-bottom: 2px solid transparent;\n cursor: pointer;\n}\n.tab:hover {\n color: var(--fg);\n}\n.tab.active {\n color: var(--fg);\n border-bottom-color: var(--accent);\n}\n.filter {\n margin: 6px 6px 2px;\n background: var(--bg2);\n border: 1px solid var(--border);\n border-radius: 3px;\n color: var(--fg);\n font: inherit;\n padding: 2px 6px;\n outline: none;\n}\n.filter:focus {\n border-color: var(--accent);\n}\n.filter::placeholder {\n color: var(--muted);\n}\n.tree {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.state {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.row {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 2px 8px;\n white-space: nowrap;\n overflow: hidden;\n cursor: pointer;\n}\n.row .label {\n flex-shrink: 0;\n}\n.row .arrow {\n cursor: pointer;\n padding: 3px 4px;\n margin: -3px -4px;\n box-sizing: content-box;\n}\n.row .arrow:hover {\n color: var(--key);\n}\n.row .hit {\n color: var(--exp);\n opacity: 0.75;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.row:hover {\n background: var(--hover);\n}\n.row.sel {\n background: var(--sel);\n}\n.row .name {\n color: var(--key);\n}\n.row .punct {\n color: var(--muted);\n}\n.row .exp {\n color: var(--exp);\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.prop {\n display: flex;\n gap: 6px;\n padding: 2px 8px;\n align-items: center;\n}\n.prop .key {\n color: var(--key);\n flex-shrink: 0;\n}\n.arrow {\n width: 12px;\n flex-shrink: 0;\n color: var(--muted);\n font-size: 9px;\n transition: transform 0.1s;\n}\n.arrow.open {\n transform: rotate(90deg);\n}\n.spacer {\n width: 12px;\n flex-shrink: 0;\n}\n.prop.toggle {\n cursor: pointer;\n user-select: none;\n}\n.prop.toggle:hover {\n background: var(--hover);\n}\n.preview {\n flex: 1;\n min-width: 0;\n color: var(--muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.muted {\n color: var(--muted);\n padding: 2px 8px;\n}\n.check {\n margin: 0;\n flex-shrink: 0;\n accent-color: var(--accent);\n cursor: pointer;\n}\n.del {\n visibility: hidden;\n flex-shrink: 0;\n background: none;\n border: none;\n padding: 0 2px;\n color: var(--muted);\n font: inherit;\n cursor: pointer;\n}\n.prop:hover .del {\n visibility: visible;\n}\n.del:hover {\n color: #e5534b;\n}\n.adder .key-in {\n flex: 0 0 30%;\n color: var(--key);\n}\n.adder input::placeholder {\n color: var(--muted);\n}\n.adder input {\n border-color: var(--border);\n}\n.bool {\n color: var(--val);\n}\n.prop.inherited .key {\n color: var(--muted);\n}\n.prop .val {\n flex: 1;\n min-width: 0;\n background: none;\n border: 1px solid transparent;\n border-radius: 3px;\n color: var(--val);\n font: inherit;\n padding: 0 3px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\ninput.val:hover, input.val:focus {\n border-color: var(--border);\n outline: none;\n background: var(--bg2);\n}\n.divider {\n padding: 4px 8px 1px;\n color: var(--muted);\n font-size: 10px;\n text-transform: uppercase;\n user-select: none;\n}\n.empty {\n padding: 8px;\n color: var(--muted);\n}\n.highlight {\n position: fixed;\n z-index: 2147483645;\n background: rgba(66, 184, 131, 0.25);\n border: 1px solid var(--accent);\n pointer-events: none;\n display: none;\n}\n",e.appendChild(x),a=C("div","highlight"),e.appendChild(a),(o=C("div","pill","\u26a1 LiteVue")).onclick=()=>{o.style.display="none",t.style.display="flex",B(),f({open:!0}),hn()},e.appendChild(o),(t=C("div","panel")).style.display="none";const m=C("div","header");m.appendChild(C("span","title","\u26a1 LiteVue")),m.addEventListener("mousedown",n=>{if(n.target.closest(".btn"))return;if("float"!==I)return;n.preventDefault();const e=t.getBoundingClientRect(),o=window.innerWidth-e.right,r=window.innerHeight-e.bottom,i=n.clientX,l=n.clientY,d=n=>{t.style.right=k(o-(n.clientX-i),0,window.innerWidth-t.offsetWidth)+"px",t.style.bottom=k(r-(n.clientY-l),0,window.innerHeight-t.offsetHeight)+"px"},a=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a),f({right:parseInt(t.style.right)||12,bottom:parseInt(t.style.bottom)||12})};document.addEventListener("mousemove",d),document.addEventListener("mouseup",a)});const y=C("div","grip");y.addEventListener("mousedown",n=>{n.preventDefault(),y.classList.add("active");const e=t.getBoundingClientRect(),o=n.clientX,r=n.clientY,i=e.width,l=e.height,d=n=>{if("right"!==I){const e="bottom"===I?r-n.clientY:n.clientY-r;t.style.height=k(l+e,320,window.innerHeight-24)+"px"}if("bottom"!==I){const e="right"===I?o-n.clientX:n.clientX-o;t.style.width=k(i+e,320,window.innerWidth-24)+"px"}},a=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a),y.classList.remove("active");const n=parseInt(t.style.width),e=parseInt(t.style.height);f("float"===I?{w:n,h:e}:"bottom"===I?{bh:e}:{rw:n})};document.addEventListener("mousemove",d),document.addEventListener("mouseup",a)});const L=(n=>{let e=!1;const t=C("button","btn");t.innerHTML=h('<path d="M9 3a2 2 0 0 1 4 0v1h3a1 1 0 0 1 1 1v3h1a2 2 0 0 1 0 4h-1v3a1 1 0 0 1-1 1h-3v-1a2 2 0 0 0-4 0v1H6a1 1 0 0 1-1-1v-3H4a2 2 0 0 1 0-4h1V5a1 1 0 0 1 1-1h3z"/>');const o=C("div","plugins");o.hidden=!0;const r=()=>{const r=n.plugins||[];if(t.title=`plugins (${r.length})`,e)if(o.textContent="",r.length)for(const n of r){const e=C("div","plugin");e.appendChild(C("span","name",n.name)),e.appendChild(C("span","gave",O(n)||"nothing registered")),n.teardown||e.appendChild(C("span","flag","no teardown")),o.appendChild(e)}else o.appendChild(C("div","empty","no plugins installed, or this is a production build"))};return t.onclick=()=>{e=!e;for(const n of o.parentElement.children)n.hidden=n===o?!e:e;t.classList.toggle("active",e),r()},{btn:t,el:o,render:r}})(n);W=L.render,m.appendChild(L.btn),(s=C("button","btn")).onclick=()=>{F(b[I]),f({dock:I})},m.appendChild(s),(d=C("button","btn")).onclick=()=>{(n=>{try{localStorage.setItem(g,n)}catch{}})(V=w[V]),X()},m.appendChild(d),R.addEventListener("change",()=>{"system"===V&&X()}),X(),(l=C("button","btn")).title="pick an element on the page",l.innerHTML=h('<circle cx="12" cy="12" r="7"/><line x1="12" y1="1" x2="12" y2="6"/><line x1="12" y1="18" x2="12" y2="23"/><line x1="1" y1="12" x2="6" y2="12"/><line x1="18" y1="12" x2="23" y2="12"/>'),l.onclick=()=>_?pn():(_=!0,l.classList.add("active"),document.addEventListener("click",an,!0),void document.addEventListener("mousemove",sn,!0)),m.appendChild(l);const E=C("button","btn","\u2715");E.onclick=()=>{_&&pn(),t.style.display="none",o.style.display="",f({open:!1})},m.appendChild(E),t.appendChild(m);const $=C("div","body"),z=C("div","side"),Y=C("div","tabs");(p=C("div","tab active")).onclick=()=>Q("Elements"),(c=C("div","tab")).onclick=()=>Q("Stores"),Y.appendChild(p),Y.appendChild(c),z.appendChild(Y);const A=C("input","filter");A.placeholder="Filter by name or state",A.oninput=()=>{M=A.value.trim().toLowerCase(),tn()},A.onkeydown=n=>{"Escape"===n.key&&(A.value="",M="",tn())},z.appendChild(A),r=C("div","tree"),z.appendChild(r),i=C("div","state"),$.appendChild(z),$.appendChild(i),$.appendChild(L.el),t.appendChild($),t.appendChild(y),e.appendChild(t);const J=v();J.w&&(N=t.style.width=J.w+"px"),J.h&&(j=t.style.height=J.h+"px"),null!=J.right&&(H=t.style.right=J.right+"px"),null!=J.bottom&&(T=t.style.bottom=J.bottom+"px"),J.bh&&(P=J.bh+"px"),J.rw&&(D=J.rw+"px"),F(J.dock||"float"),document.body.appendChild(u),J.open&&(o.style.display="none",t.style.display="flex",B(),hn()),n.on("scope:mount",hn),n.on("scope:unmount",n=>{n===S&&(S=null),hn()}),n.stores&&n.on("store:register",hn),n.plugins&&n.on("plugin:install",hn),n.on("flush",hn)},un=()=>{const e=window.__LITE_VUE__;e?(n=e,document.body?gn():addEventListener("DOMContentLoaded",gn)):console.warn("[LiteVue devtools] window.__LITE_VUE__ not found \u2014 load LiteVue before the devtools panel script.")};un();export{un as init};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).LiteVueDevtoolsPanel={})}(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var n,t,o,r,i,d,l,a,s,p,c,h,u=e=>'<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">'+e+"</svg>",g="litevue-devtools-theme",f="litevue-devtools-ui",v=()=>{try{return JSON.parse(localStorage.getItem(f)||"{}")}catch{return{}}},x=e=>{try{localStorage.setItem(f,JSON.stringify({...v(),...e}))}catch{}},b={dark:u('<path d="M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z"/>'),light:u('<circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.2" y1="4.2" x2="5.6" y2="5.6"/><line x1="18.4" y1="18.4" x2="19.8" y2="19.8"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.2" y1="19.8" x2="5.6" y2="18.4"/><line x1="18.4" y1="5.6" x2="19.8" y2="4.2"/>'),system:u('<rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/>')},m={float:u('<rect x="2" y="4" width="14" height="11" rx="1"/><rect x="9" y="10" width="13" height="10" rx="1" fill="currentColor"/>'),bottom:u('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="2" y="14" width="20" height="7" fill="currentColor"/>'),right:u('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="14" y="3" width="8" height="18" fill="currentColor"/>')},y={float:"bottom",bottom:"right",right:"float"},w={float:"floating",bottom:"docked to bottom",right:"docked to right"},k={dark:"light",light:"system",system:"dark"},C=(e,n,t)=>Math.min(Math.max(e,n),Math.max(n,t)),L=(e,n,t)=>{const o=document.createElement(e);return o.className=n,null!=t&&(o.textContent=t),o},E=(e,n)=>{const t=new Set,o=(e,r,i)=>{if(null!=e){if("object"!=typeof e)return String(e).toLowerCase().includes(n)?r:void 0;if(i>4||t.has(e))return;t.add(e);for(const t of Object.keys(e)){if("$"===t[0])continue;let d;try{d=e[t]}catch{continue}if("function"==typeof d)continue;const l=r?`${r}.${t}`:t;if(t.toLowerCase().includes(n))return l;const a=o(d,l,i+1);if(a)return a}}};return o(e,"",0)},O=e=>{let n;try{n=void 0===e?"undefined":JSON.stringify(e)??String(e)}catch{n=String(e)}return n.length>60?n.slice(0,60)+"\u2026":n},S=null,_=null,$=!1,M="",j="Elements",z="float",I="",N="",T="",P="",D="",H="",W=(()=>{try{const e=localStorage.getItem(g);if("light"===e||"system"===e)return e}catch{}return"dark"})(),V=matchMedia("(prefers-color-scheme: light)"),R=()=>{const e="light"===W||"system"===W&&V.matches;t.host.classList.toggle("light",e),a.innerHTML=b[W],a.title="theme: "+W},X=new Set,Y=new WeakSet,A=()=>{if("float"!==z)return;const e=parseInt(o.style.right)||0,n=parseInt(o.style.bottom)||0;T=o.style.right=C(e,0,window.innerWidth-o.offsetWidth)+"px",P=o.style.bottom=C(n,0,window.innerHeight-o.offsetHeight)+"px"},B=e=>{"float"===z?(I=o.style.width||I,N=o.style.height||N,T=o.style.right||T,P=o.style.bottom||P):"bottom"===z?D=o.style.height||D:H=o.style.width||H,z=e;const n="float"!==e;o.classList.toggle("dock-bottom","bottom"===e),o.classList.toggle("dock-right","right"===e),o.style.right=n?"":T,o.style.bottom=n?"":P,o.style.width="bottom"===e?"":"right"===e?H:I,o.style.height="right"===e?"":"bottom"===e?D:N,p.innerHTML=m[e],p.title="panel: "+w[e]},F=e=>{const n=L("span","label");return n.appendChild(L("span","punct","<")),n.appendChild(L("span","name",ee(e))),n.appendChild(L("span","punct",">")),n},J=e=>{let t=e.parentElement;for(;t;){if(n.scopes.has(t))return t;t=t.parentElement}return null},U=e=>{const n=e.getBoundingClientRect();s.style.cssText=`display:block;left:${n.left}px;top:${n.top}px;width:${n.width}px;height:${n.height}px`},q=()=>{s.style.display="none"},G=e=>{e!==S&&X.clear(),_=null,S=e,j="Elements",window.$scope=e?n.scopes.get(e):void 0,ne(),te()},Z=e=>{e!==_&&X.clear(),S=null,_=e,j="Stores",window.$scope=n.stores.get(e),ne(),te()},K=e=>{j=e,ne()},Q=/^\s*([A-Za-z_$][\w$]*)\s*\(/,ee=e=>n.names.get(e)||(e=>{const t=Q.exec(n.exps.get(e)||"")?.[1];return t&&n.components?.has(t)?t:void 0})(e)||e.id||e.tagName.toLowerCase(),ne=()=>{if((()=>{const e=n.stores?n.stores.size:0;c.textContent=`Elements (${n.scopes.size})`,c.className="Elements"===j?"tab active":"tab",h.textContent=`Stores (${e})`,h.className="Stores"===j?"tab active":"tab"})(),i.textContent="","Elements"===j){const e=[...n.scopes.keys()].sort((e,n)=>e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),t=new Map;for(const i of e)if(!M||ee(i).toLowerCase().includes(M))t.set(i,void 0);else{const e=E(n.scopes.get(i),M);e&&t.set(i,e)}if(!t.size)return void i.appendChild(L("div","empty",M?"no matching scopes":"no scopes mounted"));const o=new Set;for(const n of t.keys()){o.add(n);for(let e=J(n);e;e=J(e))o.add(e)}const r=new Map,d=new Map,l=new Map;for(const n of e){if(!o.has(n))continue;const e=J(n);r.set(n,e),l.set(n,e?(l.get(e)??0)+1:0),e&&d.set(e,(d.get(e)||0)+1)}const a=e=>{for(let n=r.get(e);n;n=r.get(n)??null)if(Y.has(n))return!0;return!1};for(const s of e){if(!o.has(s)||a(s))continue;const e=L("div",s===S?"row sel":"row");e.style.paddingLeft=8+12*(l.get(s)??0)+"px";const r=Y.has(s);if(d.get(s)){const n=L("span",r?"arrow":"arrow open","\u25b6");n.onclick=e=>{e.stopPropagation(),r?Y.delete(s):Y.add(s),ne()},e.appendChild(n)}else e.appendChild(L("span","spacer"));e.appendChild(F(s));const p=n.exps.get(s);p&&e.appendChild(L("span","exp"," "+p));const c=t.get(s);c&&e.appendChild(L("span","hit"," "+c)),e.onclick=()=>G(s),e.onmouseenter=()=>U(s),e.onmouseleave=q,i.appendChild(e)}return}const e=new Map;for(const o of n.stores?n.stores.keys():[])if(!M||o.toLowerCase().includes(M))e.set(o,void 0);else{const t=E(n.stores.get(o),M);t&&e.set(o,t)}const t=[...e.keys()];if(t.length)for(const n of t){const t=L("div",n===_?"row sel":"row"),o=L("span","label");o.appendChild(L("span","punct","$store.")),o.appendChild(L("span","name",n)),t.appendChild(o);const r=e.get(n);r&&t.appendChild(L("span","hit"," "+r)),t.onclick=()=>Z(n),i.appendChild(t)}else i.appendChild(L("div","empty",M?"no matching stores":"no stores registered"))},te=()=>{if(d.contains(t.activeElement))return;d.textContent="";const e=_?n.stores.get(_):S?n.scopes.get(S):void 0;if(!e)return void d.appendChild(L("div","empty","Select a scope"));const{own:o,inherited:r}=(e=>{const n=(e,n)=>"$"!==n[0]&&"function"!=typeof e[n],t=Object.keys(e).filter(t=>n(e,t)),o=new Set(t),r=[];let i=Object.getPrototypeOf(e);for(;i&&i!==Object.prototype;){for(const e of Object.keys(i))!o.has(e)&&n(i,e)&&(o.add(e),r.push(e));i=Object.getPrototypeOf(i)}return{own:t,inherited:r}})(e);o.forEach(n=>re(n,e,n,0,"prop",[])),r.length&&(d.appendChild(L("div","divider","inherited")),r.forEach(n=>re(n,e,n,0,"prop inherited",[]))),o.length||r.length||d.appendChild(L("div","empty","empty scope")),d.appendChild(oe(e))},oe=e=>{const n=L("div","prop adder");n.appendChild(L("span","spacer"));const t=L("input","val key-in");t.placeholder="key";const o=L("input","val");o.placeholder="value";return t.onkeydown=o.onkeydown=n=>{"Enter"===n.key&&(()=>{const n=t.value.trim();if(!n)return;const r=o.value;let i=r;"true"===r?i=!0:"false"===r?i=!1:""===r||isNaN(+r)||(i=+r),e[n]=i,t.blur(),o.blur(),pe(),setTimeout(()=>{const e=d.querySelector(".adder .key-in");e&&e.focus()})})()},n.appendChild(t),n.appendChild(o),n},re=(e,n,t,o,r,i)=>{const l=n[e],a=L("div",r);if(a.style.paddingLeft=8+14*o+"px",null!==l&&"object"==typeof l){const s=i.indexOf(l)>-1,p=!s&&X.has(t);if(a.appendChild(L("span",p?"arrow open":"arrow","\u25b6")),a.appendChild(L("span","key",e)),a.appendChild(L("span","preview",s?"(circular)":(e=>Array.isArray(e)?`(${e.length}) ${O(e)}`:O(e))(l))),s||(a.classList.add("toggle"),a.onclick=()=>{p?X.delete(t):X.add(t),te()}),ie(a,n,e,o,r),d.appendChild(a),p){const e=Object.keys(l);if(!e.length){const e=L("div","muted","(empty)");e.style.paddingLeft=22+14*(o+1)+"px",d.appendChild(e)}for(const n of e)re(n,l,t+"."+n,o+1,r,i.concat([l]))}return}a.appendChild(L("span","spacer")),a.appendChild(L("span","key",e));const s=((e,n)=>{for(let t=e;t&&t!==Object.prototype;t=Object.getPrototypeOf(t)){const e=Object.getOwnPropertyDescriptor(t,n);if(e)return e}})(n,e);if("function"==typeof l)a.appendChild(L("span","preview","\u0192"));else if((e=>{if(!e)return!1;if(e.get&&!e.set)return!0;const n=e.value;return!!n&&!0===n.__v_isRef&&!0===n.__v_isReadonly})(s))a.appendChild(L("span","preview",O(l)));else if("boolean"==typeof l){a.appendChild(L("span","bool",String(l)));const t=L("input","check");t.type="checkbox",t.checked=l,t.onchange=()=>{n[e]=t.checked,t.blur(),pe()},a.appendChild(t)}else{const t=L("input","val");t.value=O(l),t.onfocus=()=>{t.value="string"==typeof l?l:String(l)},t.onkeydown=e=>{"Enter"===e.key&&t.blur(),"Escape"===e.key&&(t.value=O(l),t.blur())},t.onblur=()=>{const o=((e,n)=>{if("number"==typeof n){const n=parseFloat(e);return isNaN(n)?e:n}return e})(t.value,l);o!==l?(n[e]=o,pe()):t.value=O(l)},a.appendChild(t)}ie(a,n,e,o,r),d.appendChild(a)},ie=(e,n,o,r,i)=>{if(0!==r||"prop"!==i)return;const d=Object.getOwnPropertyDescriptor(n,o);if(d&&d.get)return;const l=L("button","del","\u2715");l.title=`delete "${o}"`,l.onclick=e=>{e.stopPropagation();const r=t.activeElement;r&&r.blur&&r.blur(),delete n[o],pe()},e.appendChild(l)},de=e=>{const o=e.target;if(o===t.host)return;e.preventDefault(),e.stopPropagation(),ae();let r=o;for(;r&&!n.scopes.has(r);)r=r.parentElement;r&&G(r)},le=e=>{let o=e.target;if(o!==t.host){for(;o&&!n.scopes.has(o);)o=o.parentElement;o?U(o):q()}},ae=()=>{$=!1,l.classList.remove("active"),q(),document.removeEventListener("click",de,!0),document.removeEventListener("mousemove",le,!0)},se=!1,pe=()=>{se||(se=!0,setTimeout(()=>{se=!1,"none"!==o.style.display&&(ne(),te())}))},ce=()=>{const e=document.createElement("div");t=e.attachShadow({mode:"open"});const f=document.createElement("style");f.textContent="\n:host {\n all: initial;\n --bg: #1e1e1e;\n --bg2: #252526;\n --hover: #2a2d2e;\n --border: #3c3c3c;\n --fg: #d4d4d4;\n --muted: #808080;\n --accent: #42b883;\n --sel: #094771;\n --key: #9cdcfe;\n --val: #ce9178;\n --exp: #6a9955;\n}\n:host(.light) {\n --bg: #ffffff;\n --bg2: #f3f3f3;\n --hover: #ececec;\n --border: #d0d0d0;\n --fg: #383a42;\n --muted: #8e8e90;\n --sel: #d2e5f5;\n --key: #0451a5;\n --val: #a31515;\n --exp: #22863a;\n}\n* {\n box-sizing: border-box;\n}\n.pill, .panel {\n position: fixed;\n right: 12px;\n bottom: 12px;\n z-index: 2147483646;\n font: 11px/1.5 ui-monospace, Menlo, Consolas, monospace;\n color: var(--fg);\n}\n.pill {\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 999px;\n padding: 4px 10px;\n cursor: pointer;\n user-select: none;\n}\n.pill:hover {\n border-color: var(--accent);\n}\n.panel {\n display: flex;\n flex-direction: column;\n width: 760px;\n max-width: calc(100vw - 24px);\n height: 450px;\n max-height: calc(100vh - 24px);\n min-width: 320px;\n min-height: 320px;\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 6px;\n overflow: hidden;\n box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);\n}\n.panel.dock-bottom {\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n max-width: none;\n border-radius: 0;\n border-left: 0;\n border-right: 0;\n border-bottom: 0;\n}\n.panel.dock-right {\n top: 0;\n right: 0;\n bottom: 0;\n height: 100%;\n max-height: none;\n border-radius: 0;\n border-top: 0;\n border-right: 0;\n border-bottom: 0;\n}\n.panel.dock-bottom .header,\n.panel.dock-right .header {\n cursor: default;\n}\n.grip {\n position: absolute;\n z-index: 1;\n touch-action: none;\n right: 0;\n bottom: 0;\n width: 14px;\n height: 14px;\n cursor: nwse-resize;\n background: linear-gradient(135deg, transparent 50%, var(--border) 50%);\n}\n.panel.dock-bottom .grip {\n top: 0;\n left: 0;\n width: auto;\n height: 5px;\n cursor: ns-resize;\n background: none;\n}\n.panel.dock-right .grip {\n top: 0;\n left: 0;\n width: 5px;\n height: auto;\n cursor: ew-resize;\n background: none;\n}\n.panel.dock-bottom .grip:hover,\n.panel.dock-bottom .grip.active,\n.panel.dock-right .grip:hover,\n.panel.dock-right .grip.active {\n background: var(--accent);\n}\n.header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px 8px;\n background: var(--bg2);\n border-bottom: 1px solid var(--border);\n user-select: none;\n cursor: move;\n}\n.title {\n color: var(--accent);\n font-weight: bold;\n margin-right: auto;\n}\n.btn {\n display: flex;\n align-items: center;\n background: none;\n border: 1px solid var(--border);\n border-radius: 3px;\n color: var(--fg);\n font: inherit;\n padding: 3px 7px;\n cursor: pointer;\n}\n.btn svg {\n display: block;\n}\n.btn:hover {\n border-color: var(--accent);\n}\n.btn.active {\n background: var(--accent);\n border-color: var(--accent);\n color: var(--bg);\n}\n.body {\n display: flex;\n flex: 1;\n min-height: 0;\n}\n.side {\n display: flex;\n flex-direction: column;\n width: 40%;\n min-width: 0;\n border-right: 1px solid var(--border);\n}\n.tabs {\n display: flex;\n border-bottom: 1px solid var(--border);\n user-select: none;\n}\n.tab {\n flex: 1;\n padding: 4px 0;\n text-align: center;\n color: var(--muted);\n border-bottom: 2px solid transparent;\n cursor: pointer;\n}\n.tab:hover {\n color: var(--fg);\n}\n.tab.active {\n color: var(--fg);\n border-bottom-color: var(--accent);\n}\n.filter {\n margin: 6px 6px 2px;\n background: var(--bg2);\n border: 1px solid var(--border);\n border-radius: 3px;\n color: var(--fg);\n font: inherit;\n padding: 2px 6px;\n outline: none;\n}\n.filter:focus {\n border-color: var(--accent);\n}\n.filter::placeholder {\n color: var(--muted);\n}\n.tree {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.state {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.row {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 2px 8px;\n white-space: nowrap;\n overflow: hidden;\n cursor: pointer;\n}\n.row .label {\n flex-shrink: 0;\n}\n.row .arrow {\n cursor: pointer;\n padding: 3px 4px;\n margin: -3px -4px;\n box-sizing: content-box;\n}\n.row .arrow:hover {\n color: var(--key);\n}\n.row .hit {\n color: var(--exp);\n opacity: 0.75;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.row:hover {\n background: var(--hover);\n}\n.row.sel {\n background: var(--sel);\n}\n.row .name {\n color: var(--key);\n}\n.row .punct {\n color: var(--muted);\n}\n.row .exp {\n color: var(--exp);\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.prop {\n display: flex;\n gap: 6px;\n padding: 2px 8px;\n align-items: center;\n}\n.prop .key {\n color: var(--key);\n flex-shrink: 0;\n}\n.arrow {\n width: 12px;\n flex-shrink: 0;\n color: var(--muted);\n font-size: 9px;\n transition: transform 0.1s;\n}\n.arrow.open {\n transform: rotate(90deg);\n}\n.spacer {\n width: 12px;\n flex-shrink: 0;\n}\n.prop.toggle {\n cursor: pointer;\n user-select: none;\n}\n.prop.toggle:hover {\n background: var(--hover);\n}\n.preview {\n flex: 1;\n min-width: 0;\n color: var(--muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.muted {\n color: var(--muted);\n padding: 2px 8px;\n}\n.check {\n margin: 0;\n flex-shrink: 0;\n accent-color: var(--accent);\n cursor: pointer;\n}\n.del {\n visibility: hidden;\n flex-shrink: 0;\n background: none;\n border: none;\n padding: 0 2px;\n color: var(--muted);\n font: inherit;\n cursor: pointer;\n}\n.prop:hover .del {\n visibility: visible;\n}\n.del:hover {\n color: #e5534b;\n}\n.adder .key-in {\n flex: 0 0 30%;\n color: var(--key);\n}\n.adder input::placeholder {\n color: var(--muted);\n}\n.adder input {\n border-color: var(--border);\n}\n.bool {\n color: var(--val);\n}\n.prop.inherited .key {\n color: var(--muted);\n}\n.prop .val {\n flex: 1;\n min-width: 0;\n background: none;\n border: 1px solid transparent;\n border-radius: 3px;\n color: var(--val);\n font: inherit;\n padding: 0 3px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\ninput.val:hover, input.val:focus {\n border-color: var(--border);\n outline: none;\n background: var(--bg2);\n}\n.divider {\n padding: 4px 8px 1px;\n color: var(--muted);\n font-size: 10px;\n text-transform: uppercase;\n user-select: none;\n}\n.empty {\n padding: 8px;\n color: var(--muted);\n}\n.highlight {\n position: fixed;\n z-index: 2147483645;\n background: rgba(66, 184, 131, 0.25);\n border: 1px solid var(--accent);\n pointer-events: none;\n display: none;\n}\n",t.appendChild(f),s=L("div","highlight"),t.appendChild(s),(r=L("div","pill","\u26a1 LiteVue")).onclick=()=>{r.style.display="none",o.style.display="flex",A(),x({open:!0}),pe()},t.appendChild(r),(o=L("div","panel")).style.display="none";const b=L("div","header");b.appendChild(L("span","title","\u26a1 LiteVue")),b.addEventListener("mousedown",e=>{if(e.target.closest(".btn"))return;if("float"!==z)return;e.preventDefault();const n=o.getBoundingClientRect(),t=window.innerWidth-n.right,r=window.innerHeight-n.bottom,i=e.clientX,d=e.clientY,l=e=>{o.style.right=C(t-(e.clientX-i),0,window.innerWidth-o.offsetWidth)+"px",o.style.bottom=C(r-(e.clientY-d),0,window.innerHeight-o.offsetHeight)+"px"},a=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a),x({right:parseInt(o.style.right)||12,bottom:parseInt(o.style.bottom)||12})};document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)});const m=L("div","grip");m.addEventListener("mousedown",e=>{e.preventDefault(),m.classList.add("active");const n=o.getBoundingClientRect(),t=e.clientX,r=e.clientY,i=n.width,d=n.height,l=e=>{if("right"!==z){const n="bottom"===z?r-e.clientY:e.clientY-r;o.style.height=C(d+n,320,window.innerHeight-24)+"px"}if("bottom"!==z){const n="right"===z?t-e.clientX:e.clientX-t;o.style.width=C(i+n,320,window.innerWidth-24)+"px"}},a=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a),m.classList.remove("active");const e=parseInt(o.style.width),n=parseInt(o.style.height);x("float"===z?{w:e,h:n}:"bottom"===z?{bh:n}:{rw:e})};document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)}),(p=L("button","btn")).onclick=()=>{B(y[z]),x({dock:z})},b.appendChild(p),(a=L("button","btn")).onclick=()=>{(e=>{try{localStorage.setItem(g,e)}catch{}})(W=k[W]),R()},b.appendChild(a),V.addEventListener("change",()=>{"system"===W&&R()}),R(),(l=L("button","btn")).title="pick an element on the page",l.innerHTML=u('<circle cx="12" cy="12" r="7"/><line x1="12" y1="1" x2="12" y2="6"/><line x1="12" y1="18" x2="12" y2="23"/><line x1="1" y1="12" x2="6" y2="12"/><line x1="18" y1="12" x2="23" y2="12"/>'),l.onclick=()=>$?ae():($=!0,l.classList.add("active"),document.addEventListener("click",de,!0),void document.addEventListener("mousemove",le,!0)),b.appendChild(l);const w=L("button","btn","\u2715");w.onclick=()=>{$&&ae(),o.style.display="none",r.style.display="",x({open:!1})},b.appendChild(w),o.appendChild(b);const E=L("div","body"),O=L("div","side"),_=L("div","tabs");(c=L("div","tab active")).onclick=()=>K("Elements"),(h=L("div","tab")).onclick=()=>K("Stores"),_.appendChild(c),_.appendChild(h),O.appendChild(_);const j=L("input","filter");j.placeholder="Filter by name or state",j.oninput=()=>{M=j.value.trim().toLowerCase(),ne()},j.onkeydown=e=>{"Escape"===e.key&&(j.value="",M="",ne())},O.appendChild(j),i=L("div","tree"),O.appendChild(i),d=L("div","state"),E.appendChild(O),E.appendChild(d),o.appendChild(E),o.appendChild(m),t.appendChild(o);const X=v();X.w&&(I=o.style.width=X.w+"px"),X.h&&(N=o.style.height=X.h+"px"),null!=X.right&&(T=o.style.right=X.right+"px"),null!=X.bottom&&(P=o.style.bottom=X.bottom+"px"),X.bh&&(D=X.bh+"px"),X.rw&&(H=X.rw+"px"),B(X.dock||"float"),document.body.appendChild(e),X.open&&(r.style.display="none",o.style.display="flex",A(),pe()),n.on("scope:mount",pe),n.on("scope:unmount",e=>{e===S&&(S=null),pe()}),n.stores&&n.on("store:register",pe),n.on("flush",pe)},he=()=>{const e=window.__LITE_VUE__;e?(n=e,document.body?ce():addEventListener("DOMContentLoaded",ce)):console.warn("[LiteVue devtools] window.__LITE_VUE__ not found \u2014 load LiteVue before the devtools panel script.")};he(),e.init=he});
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).LiteVueDevtoolsPanel={})}(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var n,t,o,r,i,l,d,a,s,p,c,h,g=e=>'<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">'+e+"</svg>",u="litevue-devtools-theme",f="litevue-devtools-ui",v=()=>{try{return JSON.parse(localStorage.getItem(f)||"{}")}catch{return{}}},x=e=>{try{localStorage.setItem(f,JSON.stringify({...v(),...e}))}catch{}},m={dark:g('<path d="M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z"/>'),light:g('<circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.2" y1="4.2" x2="5.6" y2="5.6"/><line x1="18.4" y1="18.4" x2="19.8" y2="19.8"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.2" y1="19.8" x2="5.6" y2="18.4"/><line x1="18.4" y1="5.6" x2="19.8" y2="4.2"/>'),system:g('<rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/>')},b={float:g('<rect x="2" y="4" width="14" height="11" rx="1"/><rect x="9" y="10" width="13" height="10" rx="1" fill="currentColor"/>'),bottom:g('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="2" y="14" width="20" height="7" fill="currentColor"/>'),right:g('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="14" y="3" width="8" height="18" fill="currentColor"/>')},y={float:"bottom",bottom:"right",right:"float"},w={float:"floating",bottom:"docked to bottom",right:"docked to right"},k={dark:"light",light:"system",system:"dark"},C=(e,n,t)=>Math.min(Math.max(e,n),Math.max(n,t)),L=(e,n,t)=>{const o=document.createElement(e);return o.className=n,null!=t&&(o.textContent=t),o},E=(e,n)=>{const t=new Set,o=(e,r,i)=>{if(null!=e){if("object"!=typeof e)return String(e).toLowerCase().includes(n)?r:void 0;if(i>4||t.has(e))return;t.add(e);for(const t of Object.keys(e)){if("$"===t[0])continue;let l;try{l=e[t]}catch{continue}if("function"==typeof l)continue;const d=r?`${r}.${t}`:t;if(t.toLowerCase().includes(n))return d;const a=o(l,d,i+1);if(a)return a}}};return o(e,"",0)},O=e=>{let n;try{n=void 0===e?"undefined":JSON.stringify(e)??String(e)}catch{n=String(e)}return n.length>60?n.slice(0,60)+"\u2026":n},S=e=>[...e.directives.map(e=>"v-"+e),...e.magics].join(" "),M=null,$=null,_=!1,j="",z="Elements",I="float",N="",T="",H="",P="",D="",V="",W=()=>{},R=(()=>{try{const e=localStorage.getItem(u);if("light"===e||"system"===e)return e}catch{}return"dark"})(),X=matchMedia("(prefers-color-scheme: light)"),Y=()=>{const e="light"===R||"system"===R&&X.matches;t.host.classList.toggle("light",e),a.innerHTML=m[R],a.title="theme: "+R},A=new Set,B=new WeakSet,F=()=>{if("float"!==I)return;const e=parseInt(o.style.right)||0,n=parseInt(o.style.bottom)||0;H=o.style.right=C(e,0,window.innerWidth-o.offsetWidth)+"px",P=o.style.bottom=C(n,0,window.innerHeight-o.offsetHeight)+"px"},J=e=>{"float"===I?(N=o.style.width||N,T=o.style.height||T,H=o.style.right||H,P=o.style.bottom||P):"bottom"===I?D=o.style.height||D:V=o.style.width||V,I=e;const n="float"!==e;o.classList.toggle("dock-bottom","bottom"===e),o.classList.toggle("dock-right","right"===e),o.style.right=n?"":H,o.style.bottom=n?"":P,o.style.width="bottom"===e?"":"right"===e?V:N,o.style.height="right"===e?"":"bottom"===e?D:T,p.innerHTML=b[e],p.title="panel: "+w[e]},U=e=>{const n=L("span","label");return n.appendChild(L("span","punct","<")),n.appendChild(L("span","name",te(e))),n.appendChild(L("span","punct",">")),n},q=e=>{let t=e.parentElement;for(;t;){if(n.scopes.has(t))return t;t=t.parentElement}return null},G=e=>{const n=e.getBoundingClientRect();s.style.cssText=`display:block;left:${n.left}px;top:${n.top}px;width:${n.width}px;height:${n.height}px`},Z=()=>{s.style.display="none"},K=e=>{e!==M&&A.clear(),$=null,M=e,z="Elements",window.$scope=e?n.scopes.get(e):void 0,oe(),re()},Q=e=>{e!==$&&A.clear(),M=null,$=e,z="Stores",window.$scope=n.stores.get(e),oe(),re()},ee=e=>{z=e,oe()},ne=/^\s*([A-Za-z_$][\w$]*)\s*\(/,te=e=>n.names.get(e)||(e=>{const t=ne.exec(n.exps.get(e)||"")?.[1];return t&&n.components?.has(t)?t:void 0})(e)||e.id||e.tagName.toLowerCase(),oe=()=>{if((()=>{const e=n.stores?n.stores.size:0;c.textContent=`Elements (${n.scopes.size})`,c.className="Elements"===z?"tab active":"tab",h.textContent=`Stores (${e})`,h.className="Stores"===z?"tab active":"tab"})(),W(),i.textContent="","Elements"===z){const e=[...n.scopes.keys()].sort((e,n)=>e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),t=new Map;for(const i of e)if(!j||te(i).toLowerCase().includes(j))t.set(i,void 0);else{const e=E(n.scopes.get(i),j);e&&t.set(i,e)}if(!t.size)return void i.appendChild(L("div","empty",j?"no matching scopes":"no scopes mounted"));const o=new Set;for(const n of t.keys()){o.add(n);for(let e=q(n);e;e=q(e))o.add(e)}const r=new Map,l=new Map,d=new Map;for(const n of e){if(!o.has(n))continue;const e=q(n);r.set(n,e),d.set(n,e?(d.get(e)??0)+1:0),e&&l.set(e,(l.get(e)||0)+1)}const a=e=>{for(let n=r.get(e);n;n=r.get(n)??null)if(B.has(n))return!0;return!1};for(const s of e){if(!o.has(s)||a(s))continue;const e=L("div",s===M?"row sel":"row");e.style.paddingLeft=8+12*(d.get(s)??0)+"px";const r=B.has(s);if(l.get(s)){const n=L("span",r?"arrow":"arrow open","\u25b6");n.onclick=e=>{e.stopPropagation(),r?B.delete(s):B.add(s),oe()},e.appendChild(n)}else e.appendChild(L("span","spacer"));e.appendChild(U(s));const p=n.exps.get(s);p&&e.appendChild(L("span","exp"," "+p));const c=t.get(s);c&&e.appendChild(L("span","hit"," "+c)),e.onclick=()=>K(s),e.onmouseenter=()=>G(s),e.onmouseleave=Z,i.appendChild(e)}return}const e=new Map;for(const o of n.stores?n.stores.keys():[])if(!j||o.toLowerCase().includes(j))e.set(o,void 0);else{const t=E(n.stores.get(o),j);t&&e.set(o,t)}const t=[...e.keys()];if(t.length)for(const n of t){const t=L("div",n===$?"row sel":"row"),o=L("span","label");o.appendChild(L("span","punct","$store.")),o.appendChild(L("span","name",n)),t.appendChild(o);const r=e.get(n);r&&t.appendChild(L("span","hit"," "+r)),t.onclick=()=>Q(n),i.appendChild(t)}else i.appendChild(L("div","empty",j?"no matching stores":"no stores registered"))},re=()=>{if(l.contains(t.activeElement))return;l.textContent="";const e=$?n.stores.get($):M?n.scopes.get(M):void 0;if(!e)return void l.appendChild(L("div","empty","Select a scope"));const{own:o,inherited:r}=(e=>{const n=(e,n)=>"$"!==n[0]&&"function"!=typeof e[n],t=Object.keys(e).filter(t=>n(e,t)),o=new Set(t),r=[];let i=Object.getPrototypeOf(e);for(;i&&i!==Object.prototype;){for(const e of Object.keys(i))!o.has(e)&&n(i,e)&&(o.add(e),r.push(e));i=Object.getPrototypeOf(i)}return{own:t,inherited:r}})(e);o.forEach(n=>le(n,e,n,0,"prop",[])),r.length&&(l.appendChild(L("div","divider","inherited")),r.forEach(n=>le(n,e,n,0,"prop inherited",[]))),o.length||r.length||l.appendChild(L("div","empty","empty scope")),l.appendChild(ie(e))},ie=e=>{const n=L("div","prop adder");n.appendChild(L("span","spacer"));const t=L("input","val key-in");t.placeholder="key";const o=L("input","val");o.placeholder="value";return t.onkeydown=o.onkeydown=n=>{"Enter"===n.key&&(()=>{const n=t.value.trim();if(!n)return;const r=o.value;let i=r;"true"===r?i=!0:"false"===r?i=!1:""===r||isNaN(+r)||(i=+r),e[n]=i,t.blur(),o.blur(),he(),setTimeout(()=>{const e=l.querySelector(".adder .key-in");e&&e.focus()})})()},n.appendChild(t),n.appendChild(o),n},le=(e,n,t,o,r,i)=>{const d=n[e],a=L("div",r);if(a.style.paddingLeft=8+14*o+"px",null!==d&&"object"==typeof d){const s=i.indexOf(d)>-1,p=!s&&A.has(t);if(a.appendChild(L("span",p?"arrow open":"arrow","\u25b6")),a.appendChild(L("span","key",e)),a.appendChild(L("span","preview",s?"(circular)":(e=>Array.isArray(e)?`(${e.length}) ${O(e)}`:O(e))(d))),s||(a.classList.add("toggle"),a.onclick=()=>{p?A.delete(t):A.add(t),re()}),de(a,n,e,o,r),l.appendChild(a),p){const e=Object.keys(d);if(!e.length){const e=L("div","muted","(empty)");e.style.paddingLeft=22+14*(o+1)+"px",l.appendChild(e)}for(const n of e)le(n,d,t+"."+n,o+1,r,i.concat([d]))}return}a.appendChild(L("span","spacer")),a.appendChild(L("span","key",e));const s=((e,n)=>{for(let t=e;t&&t!==Object.prototype;t=Object.getPrototypeOf(t)){const e=Object.getOwnPropertyDescriptor(t,n);if(e)return e}})(n,e);if("function"==typeof d)a.appendChild(L("span","preview","\u0192"));else if((e=>{if(!e)return!1;if(e.get&&!e.set)return!0;const n=e.value;return!!n&&!0===n.__v_isRef&&!0===n.__v_isReadonly})(s))a.appendChild(L("span","preview",O(d)));else if("boolean"==typeof d){a.appendChild(L("span","bool",String(d)));const t=L("input","check");t.type="checkbox",t.checked=d,t.onchange=()=>{n[e]=t.checked,t.blur(),he()},a.appendChild(t)}else{const t=L("input","val");t.value=O(d),t.onfocus=()=>{t.value="string"==typeof d?d:String(d)},t.onkeydown=e=>{"Enter"===e.key&&t.blur(),"Escape"===e.key&&(t.value=O(d),t.blur())},t.onblur=()=>{const o=((e,n)=>{if("number"==typeof n){const n=parseFloat(e);return isNaN(n)?e:n}return e})(t.value,d);o!==d?(n[e]=o,he()):t.value=O(d)},a.appendChild(t)}de(a,n,e,o,r),l.appendChild(a)},de=(e,n,o,r,i)=>{if(0!==r||"prop"!==i)return;const l=Object.getOwnPropertyDescriptor(n,o);if(l&&l.get)return;const d=L("button","del","\u2715");d.title=`delete "${o}"`,d.onclick=e=>{e.stopPropagation();const r=t.activeElement;r&&r.blur&&r.blur(),delete n[o],he()},e.appendChild(d)},ae=e=>{const o=e.target;if(o===t.host)return;e.preventDefault(),e.stopPropagation(),pe();let r=o;for(;r&&!n.scopes.has(r);)r=r.parentElement;r&&K(r)},se=e=>{let o=e.target;if(o!==t.host){for(;o&&!n.scopes.has(o);)o=o.parentElement;o?G(o):Z()}},pe=()=>{_=!1,d.classList.remove("active"),Z(),document.removeEventListener("click",ae,!0),document.removeEventListener("mousemove",se,!0)},ce=!1,he=()=>{ce||(ce=!0,setTimeout(()=>{ce=!1,"none"!==o.style.display&&(oe(),re())}))},ge=()=>{const e=document.createElement("div");t=e.attachShadow({mode:"open"});const f=document.createElement("style");f.textContent="\n:host {\n all: initial;\n --bg: #1e1e1e;\n --bg2: #252526;\n --hover: #2a2d2e;\n --border: #3c3c3c;\n --fg: #d4d4d4;\n --muted: #808080;\n --accent: #42b883;\n --sel: #094771;\n --key: #9cdcfe;\n --val: #ce9178;\n --exp: #6a9955;\n}\n:host(.light) {\n --bg: #ffffff;\n --bg2: #f3f3f3;\n --hover: #ececec;\n --border: #d0d0d0;\n --fg: #383a42;\n --muted: #8e8e90;\n --sel: #d2e5f5;\n --key: #0451a5;\n --val: #a31515;\n --exp: #22863a;\n}\n* {\n box-sizing: border-box;\n}\n.pill, .panel {\n position: fixed;\n right: 12px;\n bottom: 12px;\n z-index: 2147483646;\n font: 11px/1.5 ui-monospace, Menlo, Consolas, monospace;\n color: var(--fg);\n}\n.pill {\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 999px;\n padding: 4px 10px;\n cursor: pointer;\n user-select: none;\n}\n.pill:hover {\n border-color: var(--accent);\n}\n.panel {\n display: flex;\n flex-direction: column;\n width: 760px;\n max-width: calc(100vw - 24px);\n height: 450px;\n max-height: calc(100vh - 24px);\n min-width: 320px;\n min-height: 320px;\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 6px;\n overflow: hidden;\n box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);\n}\n.panel.dock-bottom {\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n max-width: none;\n border-radius: 0;\n border-left: 0;\n border-right: 0;\n border-bottom: 0;\n}\n.panel.dock-right {\n top: 0;\n right: 0;\n bottom: 0;\n height: 100%;\n max-height: none;\n border-radius: 0;\n border-top: 0;\n border-right: 0;\n border-bottom: 0;\n}\n.panel.dock-bottom .header,\n.panel.dock-right .header {\n cursor: default;\n}\n.grip {\n position: absolute;\n z-index: 1;\n touch-action: none;\n right: 0;\n bottom: 0;\n width: 14px;\n height: 14px;\n cursor: nwse-resize;\n background: linear-gradient(135deg, transparent 50%, var(--border) 50%);\n}\n.panel.dock-bottom .grip {\n top: 0;\n left: 0;\n width: auto;\n height: 5px;\n cursor: ns-resize;\n background: none;\n}\n.panel.dock-right .grip {\n top: 0;\n left: 0;\n width: 5px;\n height: auto;\n cursor: ew-resize;\n background: none;\n}\n.panel.dock-bottom .grip:hover,\n.panel.dock-bottom .grip.active,\n.panel.dock-right .grip:hover,\n.panel.dock-right .grip.active {\n background: var(--accent);\n}\n.header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px 8px;\n background: var(--bg2);\n border-bottom: 1px solid var(--border);\n user-select: none;\n cursor: move;\n}\n.title {\n color: var(--accent);\n font-weight: bold;\n margin-right: auto;\n}\n.btn {\n display: flex;\n align-items: center;\n background: none;\n border: 1px solid var(--border);\n border-radius: 3px;\n color: var(--fg);\n font: inherit;\n padding: 3px 7px;\n cursor: pointer;\n}\n.btn svg {\n display: block;\n}\n.btn:hover {\n border-color: var(--accent);\n}\n.btn.active {\n background: var(--accent);\n border-color: var(--accent);\n color: var(--bg);\n}\n.body {\n display: flex;\n flex: 1;\n min-height: 0;\n}\n[hidden] {\n display: none !important;\n}\n.plugins {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.plugin {\n display: flex;\n gap: 8px;\n padding: 3px 10px;\n align-items: baseline;\n}\n.plugin .name {\n min-width: 120px;\n}\n.plugin .gave {\n flex: 1;\n color: var(--muted);\n word-break: break-word;\n}\n.plugin .flag {\n color: var(--muted);\n opacity: 0.7;\n}\n.side {\n display: flex;\n flex-direction: column;\n width: 40%;\n min-width: 0;\n border-right: 1px solid var(--border);\n}\n.tabs {\n display: flex;\n border-bottom: 1px solid var(--border);\n user-select: none;\n}\n.tab {\n flex: 1;\n padding: 4px 0;\n text-align: center;\n color: var(--muted);\n border-bottom: 2px solid transparent;\n cursor: pointer;\n}\n.tab:hover {\n color: var(--fg);\n}\n.tab.active {\n color: var(--fg);\n border-bottom-color: var(--accent);\n}\n.filter {\n margin: 6px 6px 2px;\n background: var(--bg2);\n border: 1px solid var(--border);\n border-radius: 3px;\n color: var(--fg);\n font: inherit;\n padding: 2px 6px;\n outline: none;\n}\n.filter:focus {\n border-color: var(--accent);\n}\n.filter::placeholder {\n color: var(--muted);\n}\n.tree {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.state {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.row {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 2px 8px;\n white-space: nowrap;\n overflow: hidden;\n cursor: pointer;\n}\n.row .label {\n flex-shrink: 0;\n}\n.row .arrow {\n cursor: pointer;\n padding: 3px 4px;\n margin: -3px -4px;\n box-sizing: content-box;\n}\n.row .arrow:hover {\n color: var(--key);\n}\n.row .hit {\n color: var(--exp);\n opacity: 0.75;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.row:hover {\n background: var(--hover);\n}\n.row.sel {\n background: var(--sel);\n}\n.row .name {\n color: var(--key);\n}\n.row .punct {\n color: var(--muted);\n}\n.row .exp {\n color: var(--exp);\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.prop {\n display: flex;\n gap: 6px;\n padding: 2px 8px;\n align-items: center;\n}\n.prop .key {\n color: var(--key);\n flex-shrink: 0;\n}\n.arrow {\n width: 12px;\n flex-shrink: 0;\n color: var(--muted);\n font-size: 9px;\n transition: transform 0.1s;\n}\n.arrow.open {\n transform: rotate(90deg);\n}\n.spacer {\n width: 12px;\n flex-shrink: 0;\n}\n.prop.toggle {\n cursor: pointer;\n user-select: none;\n}\n.prop.toggle:hover {\n background: var(--hover);\n}\n.preview {\n flex: 1;\n min-width: 0;\n color: var(--muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.muted {\n color: var(--muted);\n padding: 2px 8px;\n}\n.check {\n margin: 0;\n flex-shrink: 0;\n accent-color: var(--accent);\n cursor: pointer;\n}\n.del {\n visibility: hidden;\n flex-shrink: 0;\n background: none;\n border: none;\n padding: 0 2px;\n color: var(--muted);\n font: inherit;\n cursor: pointer;\n}\n.prop:hover .del {\n visibility: visible;\n}\n.del:hover {\n color: #e5534b;\n}\n.adder .key-in {\n flex: 0 0 30%;\n color: var(--key);\n}\n.adder input::placeholder {\n color: var(--muted);\n}\n.adder input {\n border-color: var(--border);\n}\n.bool {\n color: var(--val);\n}\n.prop.inherited .key {\n color: var(--muted);\n}\n.prop .val {\n flex: 1;\n min-width: 0;\n background: none;\n border: 1px solid transparent;\n border-radius: 3px;\n color: var(--val);\n font: inherit;\n padding: 0 3px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\ninput.val:hover, input.val:focus {\n border-color: var(--border);\n outline: none;\n background: var(--bg2);\n}\n.divider {\n padding: 4px 8px 1px;\n color: var(--muted);\n font-size: 10px;\n text-transform: uppercase;\n user-select: none;\n}\n.empty {\n padding: 8px;\n color: var(--muted);\n}\n.highlight {\n position: fixed;\n z-index: 2147483645;\n background: rgba(66, 184, 131, 0.25);\n border: 1px solid var(--accent);\n pointer-events: none;\n display: none;\n}\n",t.appendChild(f),s=L("div","highlight"),t.appendChild(s),(r=L("div","pill","\u26a1 LiteVue")).onclick=()=>{r.style.display="none",o.style.display="flex",F(),x({open:!0}),he()},t.appendChild(r),(o=L("div","panel")).style.display="none";const m=L("div","header");m.appendChild(L("span","title","\u26a1 LiteVue")),m.addEventListener("mousedown",e=>{if(e.target.closest(".btn"))return;if("float"!==I)return;e.preventDefault();const n=o.getBoundingClientRect(),t=window.innerWidth-n.right,r=window.innerHeight-n.bottom,i=e.clientX,l=e.clientY,d=e=>{o.style.right=C(t-(e.clientX-i),0,window.innerWidth-o.offsetWidth)+"px",o.style.bottom=C(r-(e.clientY-l),0,window.innerHeight-o.offsetHeight)+"px"},a=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a),x({right:parseInt(o.style.right)||12,bottom:parseInt(o.style.bottom)||12})};document.addEventListener("mousemove",d),document.addEventListener("mouseup",a)});const b=L("div","grip");b.addEventListener("mousedown",e=>{e.preventDefault(),b.classList.add("active");const n=o.getBoundingClientRect(),t=e.clientX,r=e.clientY,i=n.width,l=n.height,d=e=>{if("right"!==I){const n="bottom"===I?r-e.clientY:e.clientY-r;o.style.height=C(l+n,320,window.innerHeight-24)+"px"}if("bottom"!==I){const n="right"===I?t-e.clientX:e.clientX-t;o.style.width=C(i+n,320,window.innerWidth-24)+"px"}},a=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a),b.classList.remove("active");const e=parseInt(o.style.width),n=parseInt(o.style.height);x("float"===I?{w:e,h:n}:"bottom"===I?{bh:n}:{rw:e})};document.addEventListener("mousemove",d),document.addEventListener("mouseup",a)});const w=(e=>{let n=!1;const t=L("button","btn");t.innerHTML=g('<path d="M9 3a2 2 0 0 1 4 0v1h3a1 1 0 0 1 1 1v3h1a2 2 0 0 1 0 4h-1v3a1 1 0 0 1-1 1h-3v-1a2 2 0 0 0-4 0v1H6a1 1 0 0 1-1-1v-3H4a2 2 0 0 1 0-4h1V5a1 1 0 0 1 1-1h3z"/>');const o=L("div","plugins");o.hidden=!0;const r=()=>{const r=e.plugins||[];if(t.title=`plugins (${r.length})`,n)if(o.textContent="",r.length)for(const e of r){const n=L("div","plugin");n.appendChild(L("span","name",e.name)),n.appendChild(L("span","gave",S(e)||"nothing registered")),e.teardown||n.appendChild(L("span","flag","no teardown")),o.appendChild(n)}else o.appendChild(L("div","empty","no plugins installed, or this is a production build"))};return t.onclick=()=>{n=!n;for(const e of o.parentElement.children)e.hidden=e===o?!n:n;t.classList.toggle("active",n),r()},{btn:t,el:o,render:r}})(n);W=w.render,m.appendChild(w.btn),(p=L("button","btn")).onclick=()=>{J(y[I]),x({dock:I})},m.appendChild(p),(a=L("button","btn")).onclick=()=>{(e=>{try{localStorage.setItem(u,e)}catch{}})(R=k[R]),Y()},m.appendChild(a),X.addEventListener("change",()=>{"system"===R&&Y()}),Y(),(d=L("button","btn")).title="pick an element on the page",d.innerHTML=g('<circle cx="12" cy="12" r="7"/><line x1="12" y1="1" x2="12" y2="6"/><line x1="12" y1="18" x2="12" y2="23"/><line x1="1" y1="12" x2="6" y2="12"/><line x1="18" y1="12" x2="23" y2="12"/>'),d.onclick=()=>_?pe():(_=!0,d.classList.add("active"),document.addEventListener("click",ae,!0),void document.addEventListener("mousemove",se,!0)),m.appendChild(d);const E=L("button","btn","\u2715");E.onclick=()=>{_&&pe(),o.style.display="none",r.style.display="",x({open:!1})},m.appendChild(E),o.appendChild(m);const O=L("div","body"),$=L("div","side"),z=L("div","tabs");(c=L("div","tab active")).onclick=()=>ee("Elements"),(h=L("div","tab")).onclick=()=>ee("Stores"),z.appendChild(c),z.appendChild(h),$.appendChild(z);const A=L("input","filter");A.placeholder="Filter by name or state",A.oninput=()=>{j=A.value.trim().toLowerCase(),oe()},A.onkeydown=e=>{"Escape"===e.key&&(A.value="",j="",oe())},$.appendChild(A),i=L("div","tree"),$.appendChild(i),l=L("div","state"),O.appendChild($),O.appendChild(l),O.appendChild(w.el),o.appendChild(O),o.appendChild(b),t.appendChild(o);const B=v();B.w&&(N=o.style.width=B.w+"px"),B.h&&(T=o.style.height=B.h+"px"),null!=B.right&&(H=o.style.right=B.right+"px"),null!=B.bottom&&(P=o.style.bottom=B.bottom+"px"),B.bh&&(D=B.bh+"px"),B.rw&&(V=B.rw+"px"),J(B.dock||"float"),document.body.appendChild(e),B.open&&(r.style.display="none",o.style.display="flex",F(),he()),n.on("scope:mount",he),n.on("scope:unmount",e=>{e===M&&(M=null),he()}),n.stores&&n.on("store:register",he),n.plugins&&n.on("plugin:install",he),n.on("flush",he)},ue=()=>{const e=window.__LITE_VUE__;e?(n=e,document.body?ge():addEventListener("DOMContentLoaded",ge)):console.warn("[LiteVue devtools] window.__LITE_VUE__ not found \u2014 load LiteVue before the devtools panel script.")};ue(),e.init=ue});
|
|
@@ -866,12 +866,22 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
|
|
|
866
866
|
* queries cannot hand to JavaScript. The expression runs with `$width` and
|
|
867
867
|
* `$height` in scope.
|
|
868
868
|
*
|
|
869
|
-
*
|
|
870
|
-
*
|
|
869
|
+
* `.window` measures the viewport instead, from `innerWidth`/`innerHeight`.
|
|
870
|
+
* A ResizeObserver cannot do this: on `documentElement` it reports the
|
|
871
|
+
* *document* height, so a 3000px page under a 700px viewport reports 3000.
|
|
872
|
+
* `.visual` measures the visual viewport, which shrinks for an on-screen
|
|
873
|
+
* keyboard where `innerHeight` does not.
|
|
871
874
|
*/
|
|
872
875
|
var resize = (app) => {
|
|
873
|
-
app.directive("resize", ({ el, get, exp }) => {
|
|
876
|
+
app.directive("resize", ({ el, get, exp, modifiers }) => {
|
|
874
877
|
const handler = get(`(($width, $height) => { ${exp} })`);
|
|
878
|
+
if (modifiers?.window || modifiers?.visual) {
|
|
879
|
+
const view = modifiers.visual && window.visualViewport || window;
|
|
880
|
+
const fire = () => handler(view.width || innerWidth, view.height || innerHeight);
|
|
881
|
+
view.addEventListener("resize", fire);
|
|
882
|
+
fire();
|
|
883
|
+
return () => view.removeEventListener("resize", fire);
|
|
884
|
+
}
|
|
875
885
|
const observer = new ResizeObserver((entries) => {
|
|
876
886
|
for (const entry of entries) {
|
|
877
887
|
const box = entry.contentRect;
|
|
@@ -865,12 +865,22 @@ var media = (app, options) => {
|
|
|
865
865
|
* queries cannot hand to JavaScript. The expression runs with `$width` and
|
|
866
866
|
* `$height` in scope.
|
|
867
867
|
*
|
|
868
|
-
*
|
|
869
|
-
*
|
|
868
|
+
* `.window` measures the viewport instead, from `innerWidth`/`innerHeight`.
|
|
869
|
+
* A ResizeObserver cannot do this: on `documentElement` it reports the
|
|
870
|
+
* *document* height, so a 3000px page under a 700px viewport reports 3000.
|
|
871
|
+
* `.visual` measures the visual viewport, which shrinks for an on-screen
|
|
872
|
+
* keyboard where `innerHeight` does not.
|
|
870
873
|
*/
|
|
871
874
|
var resize = (app) => {
|
|
872
|
-
app.directive("resize", ({ el, get, exp }) => {
|
|
875
|
+
app.directive("resize", ({ el, get, exp, modifiers }) => {
|
|
873
876
|
const handler = get(`(($width, $height) => { ${exp} })`);
|
|
877
|
+
if (modifiers?.window || modifiers?.visual) {
|
|
878
|
+
const view = modifiers.visual && window.visualViewport || window;
|
|
879
|
+
const fire = () => handler(view.width || innerWidth, view.height || innerHeight);
|
|
880
|
+
view.addEventListener("resize", fire);
|
|
881
|
+
fire();
|
|
882
|
+
return () => view.removeEventListener("resize", fire);
|
|
883
|
+
}
|
|
874
884
|
const observer = new ResizeObserver((entries) => {
|
|
875
885
|
for (const entry of entries) {
|
|
876
886
|
const box = entry.contentRect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var LiteVuePlugins=function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var n={9:/\d/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},r=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),o=(e,t)=>{const n=e.split(","),o=t.split(",");let i=0;for(let s=0;s<n.length;s++)i=Math.max(i,r(n[s])+r(o[s%o.length]));return i},i="litevue:",s=Object.create(null),c="local",a=e=>{const t=e??c;return"string"!=typeof t?t:s[t]??(e=>{try{if("local"===e||"localStorage"===e)return localStorage;if("session"===e||"sessionStorage"===e)return sessionStorage}catch{}})(t)},l=(e,t,n,r,o)=>{if(!r)return o(()=>{});const i=((e,t)=>(t??Object.keys(e)).filter(t=>{if("$"===t[0])return!1;const n=Object.getOwnPropertyDescriptor(e,t);if(n&&n.get&&!n.set)return!1;const r=n&&n.value;return(!r||!0!==r.__v_isRef||!0!==r.__v_isReadonly)&&"function"!=typeof e[t]}))(e,n);try{const n=JSON.parse(r.getItem(t)||"null");if(n)for(const t of i)t in n&&(e[t]=n[t])}catch{}return o(()=>{const n={};for(const t of i)n[t]=e[t];try{r.setItem(t,JSON.stringify(n))}catch{}})},f=(e,t)=>1===e.nodeType&&(e.hasAttribute("data-morph-preserve")||!!t.preserve?.(e)),d=/^(?:v-|:|@)/,u=/^(?::|v-bind:)/,m=/^v-(?!scope|on:)/,p=["id","data-key","data-id"],v=e=>{for(const t of p){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},h=e=>{for(let t=e;t;t=t.parentElement)if(t.__ctx)return t.__ctx},b=e=>e.hasAttribute("v-for")||e.hasAttribute("v-if")||e.hasAttribute("v-else")||e.hasAttribute("v-else-if"),g=(e,t)=>{const n=(e=>{const t=new Set;for(const{name:n}of e.attributes)u.test(n)?t.add(n.replace(u,"").split(".")[0]):"v-model"===n?(t.add("value"),t.add("checked")):"v-bind"===n?t.add("*"):m.test(n)&&t.add("style");return t})(t);for(const{name:r,value:o}of[...t.attributes])d.test(r)||n.has(r)||e.getAttribute(r)!==o&&e.setAttribute(r,o);for(const{name:r}of[...e.attributes])n.has("*")||n.has(r)||t.hasAttribute(r)||e.removeAttribute(r)},y=(e,t,n,r)=>{if(e.nodeType!==t.nodeType)return k(e,t,n,r);if(3===e.nodeType||8===e.nodeType){const r=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(r,n))return;return void(e.data!==r&&(e.data=r))}if(1!==e.nodeType)return;const o=e,i=t;if(o.tagName!==i.tagName)return k(e,t,n,r);r.skip?.(o,i)||o.hasAttribute("data-morph-skip")||(g(o,i),(e=>{if(e.hasAttribute("v-text")||e.hasAttribute("v-html")||e.hasAttribute("v-pre")||e.hasAttribute("v-once")||b(e))return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(b(t))return!0;return!1})(i)||w(o,i,o.__ctx||n,r))},k=(e,t,n,r)=>{if(f(e,r))return;const o=t.cloneNode(!0);!1!==r.beforeNodeAdded?.(o)&&(n?.dispose?.(e),e.parentNode.replaceChild(o,e),r.afterNodeRemoved?.(e),x(o,n))},x=(e,t)=>{const n=t||h(e.parentNode);n?.walk?.(e,n)},w=(e,t,n,r)=>{const o=r.key||v,i=new Map;for(let f=e.firstChild;f;f=f.nextSibling)if(1===f.nodeType){const e=o(f);if(null==e)continue;i.set(e,f)}const s=e=>e&&1===e.nodeType?o(e):null;let c=e.firstChild,a=t.firstChild;const l=t=>{const o=t.cloneNode(!0);!1!==r.beforeNodeAdded?.(o)&&(e.insertBefore(o,c),x(o,n))};for(;a;){const t=a.nextSibling,o=s(a);if(null!=o){const t=i.get(o);t?(t===c?c=c.nextSibling:e.insertBefore(t,c),i.delete(o),y(t,a,n,r)):l(a)}else if(c&&null==s(c)){const e=c.nextSibling;y(c,a,n,r),c=e}else l(a);a=t}for(;c;){const t=c.nextSibling;f(c,r)||(n?.dispose?.(c),e.removeChild(c),r.afterNodeRemoved?.(c)),c=t}},S=(e,t,n={})=>{let r;if("string"==typeof t){const n=document.createElement("template");n.innerHTML=t.trim();const o=n.content;r=1===o.childElementCount?o.firstElementChild:(()=>{const t=e.cloneNode(!1);return t.appendChild(o),t})()}else r=t;if(r){const t=()=>{const t=E();y(e,r,h(e),n),t()};n.transition&&document.startViewTransition?document.startViewTransition(t):t()}return e},E=()=>{const e=document.activeElement;if(!e||e===document.body)return()=>{};const t=e;let n=null,r=null;try{n=t.selectionStart,r=t.selectionEnd}catch{}return()=>{if(e!==document.activeElement&&e.isConnected&&(e.focus(),null!==n))try{t.setSelectionRange(n,r)}catch{}}},A={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},O=Object.freeze({...A}),L={mobile:"base",tablet:"md",desktop:"lg"},T=/^\d+$/,$=(0,t.reactive)({bp:"base",tick:0}),j={...A},_=["base"],N=!1,q=[],P=new Map,C=()=>"undefined"!=typeof window&&"function"==typeof window.matchMedia,D=(e,t)=>e.addEventListener?(e.addEventListener("change",t),{mql:e,off:()=>e.removeEventListener("change",t)}):(e.addListener(t),{mql:e,off:()=>e.removeListener(t)}),M=()=>{for(let e=q.length-1;e>=0;e--)if(q[e].mql.matches)return _[e+1];return"base"},R=()=>{q.forEach(e=>e.off()),q=[];const e=Object.keys(j).filter(e=>j[e]>0).sort((e,t)=>j[e]-j[t]);_=["base",...e],C()&&(q=e.map(e=>{const t=window.matchMedia(`(min-width: ${j[e]}px)`);return D(t,()=>{$.bp=M()})}),$.bp=M())},z=()=>{N||(N=!0,R()),$.tick},I=e=>{if(!C())return!1;let t=P.get(e);if(!t){const n=window.matchMedia(e);t=D(n,()=>$.tick++),P.set(e,t)}return t.mql.matches},B=e=>{if("number"==typeof e)return e;if("base"===e)return 0;if(T.test(e))return Number(e);const t=L[e];return void 0!==t?"base"===t?0:j[t]:j[e]},H=e=>{if(e<=0)return!0;const t=_.findIndex(t=>"base"!==t&&j[t]===e);return-1!==t?_.indexOf($.bp)>=t:($.tick,I(`(min-width: ${e}px)`))},V=new Set,J=(e,t)=>{if(z(),!e||"object"!=typeof e)return t;let n,r=-1;for(const o of Object.keys(e)){const t=B(o);void 0!==t?t>=r&&H(t)&&(r=t,n=e[o]):(_.join(", "),Object.keys(L).join(", "))}return void 0!==n?n:t},K=e=>{const t=L[e],n=j[t];return void 0!==n?n:A[t]},Z=Object.defineProperties((e,t)=>J(e,t),{props:{value:e=>{z();const t={};for(const n of Object.keys(e))t[n]=J(e[n]);return t}},breakpoint:{get:()=>(z(),$.bp),enumerable:!0},device:{get:()=>(z(),H(K("tablet"))?H(K("desktop"))?"desktop":"tablet":"mobile"),enumerable:!0},atLeast:{value:e=>{z();const t=B(e);return void 0!==t&&H(t)}},match:{value:e=>(z(),I(e))},configure:{value:({breakpoints:e})=>{e&&(j={...e},N&&(R(),$.tick++))}}}),F=()=>{q.forEach(e=>e.off()),P.forEach(e=>e.off()),q=[],P.clear(),N=!1};return e.collapse=e=>{e.directive("collapse",({el:e,get:t,effect:n,modifiers:r})=>{const o=e;let i=250;for(const u in r||{}){const e=/^duration-(\d+)$/.exec(u);e&&(i=+e[1])}const s=["overflow","height","transition"],c=s.map(e=>o.style[e]);o.style.overflow="hidden";let a=!0,l=0;const f=new Set,d=(e,t)=>{const n=setTimeout(()=>{f.delete(n),e()},t);f.add(n)};return n(()=>{const e=!!t(),n=++l;if(a)return a=!1,e||(o.style.height="0px"),void d(()=>{o.style.transition=`height ${i}ms ease`});e?(o.style.height=o.scrollHeight+"px",d(()=>{n===l&&(o.style.height="")},i)):(o.style.height=o.scrollHeight+"px",o.offsetHeight,o.style.height="0px")}),()=>{f.forEach(clearTimeout),s.forEach((e,t)=>o.style[e]=c[t])}})},e.defaultBreakpoints=O,e.focus=e=>{e.directive("focus",({el:e,get:t,effect:n,modifiers:r})=>{let o=!0;return n(()=>{const n=!!t();Promise.resolve().then(()=>{o&&n&&(e.focus(),r?.select&&e.select&&e.select())})}),()=>{o=!1}}),e.directive("trap",({el:e,get:t,effect:n})=>{let r=!1,o=null;const i=()=>[...e.querySelectorAll('a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])')].filter(e=>!e.hasAttribute("disabled")),s=t=>{if("Tab"!==t.key)return;const n=i();if(!n.length)return void t.preventDefault();const r=n[0],o=n[n.length-1],s=document.activeElement;e.contains(s)?t.shiftKey&&s===r?(t.preventDefault(),o.focus()):t.shiftKey||s!==o||(t.preventDefault(),r.focus()):(t.preventDefault(),r.focus())},c=()=>{r=!1,document.removeEventListener("keydown",s,!0),o&&o.focus&&o.focus()};return n(()=>{const n=!!t();n&&!r?(r=!0,o=document.activeElement,document.addEventListener("keydown",s,!0),Promise.resolve().then(()=>{r&&(i()[0]||e).focus()})):!n&&r&&c()}),()=>{r&&c()}})},e.intersect=e=>{e.directive("intersect",({el:e,get:t,modifiers:n})=>{const r=new IntersectionObserver(e=>{for(const o of e)(n?.leave?!o.isIntersecting:o.isIntersecting)&&(t(),n?.once&&r.disconnect())},{threshold:n?.full?1:0});return r.observe(e),()=>r.disconnect()})},e.mask=e=>{e.directive("mask",({el:e,exp:t})=>{const r=e,o=()=>{const e=((e,t)=>{let r="",o="",i=0;for(let s=0;s<t.length;s++){const c=n[t[s]];if(c){for(;i<e.length&&!c.test(e[i]);)i++;if(i>=e.length)break;r+=o+e[i++],o=""}else o+=t[s],e[i]===t[s]&&i++}return r})(r.value,t);e!==r.value&&(r.value=e)};return e.addEventListener("input",o),o(),()=>e.removeEventListener("input",o)})},e.media=(e,t)=>(t?.breakpoints&&JSON.stringify(t.breakpoints),t&&Z.configure(t),e.scope.$mq=Z,e.scope.$mqProps=Z.props,e.scope.$mqAtLeast=Z.atLeast,e.scope.$mqMatch=Z.match,Object.defineProperty(e.scope,"$mqBreakpoint",{get:()=>Z.breakpoint,enumerable:!0,configurable:!0}),Object.defineProperty(e.scope,"$mqDevice",{get:()=>Z.device,enumerable:!0,configurable:!0}),F),e.morph=S,e.morphPlugin=e=>{e.scope.$morph=S},e.mq=Z,e.persist=e=>{e.directive("persist",({ctx:e,el:t,exp:n,arg:r,modifiers:o,effect:s})=>{const c=i+(n||t.id);let f;for(const i in o||{})if(a(i)){f=i;break}const d=r?r.split(",").map(e=>e.trim()).filter(Boolean):void 0;l(e.scope,c,d,a(f),s)})},e.persistStore=(e,n={})=>{const r=(0,t.store)(e);if(!r)return()=>{};const o=a(n.storage);return l(r,i+(n.key??e),n.keys,o,t.watchEffect)},e.registerStorage=(e,t)=>{s[e]=t},e.resetMedia=()=>{F(),j={...A},_=["base",...Object.keys(j).sort((e,t)=>j[e]-j[t])],N=!1,V.clear(),$.bp="base",$.tick=0},e.resize=e=>{e.directive("resize",({el:e,get:t,exp:n})=>{const r=t(`(($width, $height) => { ${n} })`),o=new ResizeObserver(e=>{for(const t of e){const e=t.contentRect;r(e.width,e.height)}});return o.observe(e),()=>o.disconnect()})},e.setDefaultStorage=e=>{c=e},e.transition=e=>{e.directive("transition",({el:e,get:t,effect:n,arg:r,modifiers:i,exp:s})=>{const c=e,a=r||"v",l=e=>`${a}-${e}`;let f,d=0,u=!0;const m=()=>{c.classList.remove(l("enter-from"),l("enter-active"),l("enter-to"),l("leave-from"),l("leave-active"),l("leave-to"))},p=(e,t)=>{const n=++d;m(),c.classList.add(l(e+"-from"),l(e+"-active")),c.offsetWidth,c.classList.remove(l(e+"-from")),c.classList.add(l(e+"-to")),clearTimeout(f),f=setTimeout(()=>{n===d&&(m(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(o(t.transitionDuration,t.transitionDelay),o(t.animationDuration,t.animationDelay))})(c))};if(!s){let e=!0;return Promise.resolve().then(()=>{e&&p("enter")}),c.__leave=()=>new Promise(e=>p("leave",e)),()=>{e=!1,clearTimeout(f),delete c.__leave}}return n(()=>{const e=!!t();if(u)return u=!1,c.style.display=e?"":"none",void(e&&i?.appear&&p("enter"));e?(c.style.display="",p("enter")):p("leave",()=>{c.style.display="none"})}),()=>clearTimeout(f)})},e}({},LiteVue);
|
|
1
|
+
var LiteVuePlugins=function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var n={9:/\d/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},r=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),o=(e,t)=>{const n=e.split(","),o=t.split(",");let i=0;for(let s=0;s<n.length;s++)i=Math.max(i,r(n[s])+r(o[s%o.length]));return i},i="litevue:",s=Object.create(null),c="local",a=e=>{const t=e??c;return"string"!=typeof t?t:s[t]??(e=>{try{if("local"===e||"localStorage"===e)return localStorage;if("session"===e||"sessionStorage"===e)return sessionStorage}catch{}})(t)},l=(e,t,n,r,o)=>{if(!r)return o(()=>{});const i=((e,t)=>(t??Object.keys(e)).filter(t=>{if("$"===t[0])return!1;const n=Object.getOwnPropertyDescriptor(e,t);if(n&&n.get&&!n.set)return!1;const r=n&&n.value;return(!r||!0!==r.__v_isRef||!0!==r.__v_isReadonly)&&"function"!=typeof e[t]}))(e,n);try{const n=JSON.parse(r.getItem(t)||"null");if(n)for(const t of i)t in n&&(e[t]=n[t])}catch{}return o(()=>{const n={};for(const t of i)n[t]=e[t];try{r.setItem(t,JSON.stringify(n))}catch{}})},d=(e,t)=>1===e.nodeType&&(e.hasAttribute("data-morph-preserve")||!!t.preserve?.(e)),f=/^(?:v-|:|@)/,u=/^(?::|v-bind:)/,m=/^v-(?!scope|on:)/,p=["id","data-key","data-id"],v=e=>{for(const t of p){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},h=e=>{for(let t=e;t;t=t.parentElement)if(t.__ctx)return t.__ctx},b=e=>e.hasAttribute("v-for")||e.hasAttribute("v-if")||e.hasAttribute("v-else")||e.hasAttribute("v-else-if"),g=(e,t)=>{const n=(e=>{const t=new Set;for(const{name:n}of e.attributes)u.test(n)?t.add(n.replace(u,"").split(".")[0]):"v-model"===n?(t.add("value"),t.add("checked")):"v-bind"===n?t.add("*"):m.test(n)&&t.add("style");return t})(t);for(const{name:r,value:o}of[...t.attributes])f.test(r)||n.has(r)||e.getAttribute(r)!==o&&e.setAttribute(r,o);for(const{name:r}of[...e.attributes])n.has("*")||n.has(r)||t.hasAttribute(r)||e.removeAttribute(r)},y=(e,t,n,r)=>{if(e.nodeType!==t.nodeType)return k(e,t,n,r);if(3===e.nodeType||8===e.nodeType){const r=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(r,n))return;return void(e.data!==r&&(e.data=r))}if(1!==e.nodeType)return;const o=e,i=t;if(o.tagName!==i.tagName)return k(e,t,n,r);r.skip?.(o,i)||o.hasAttribute("data-morph-skip")||(g(o,i),(e=>{if(e.hasAttribute("v-text")||e.hasAttribute("v-html")||e.hasAttribute("v-pre")||e.hasAttribute("v-once")||b(e))return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(b(t))return!0;return!1})(i)||x(o,i,o.__ctx||n,r))},k=(e,t,n,r)=>{if(d(e,r))return;const o=t.cloneNode(!0);!1!==r.beforeNodeAdded?.(o)&&(n?.dispose?.(e),e.parentNode.replaceChild(o,e),r.afterNodeRemoved?.(e),w(o,n))},w=(e,t)=>{const n=t||h(e.parentNode);n?.walk?.(e,n)},x=(e,t,n,r)=>{const o=r.key||v,i=new Map;for(let d=e.firstChild;d;d=d.nextSibling)if(1===d.nodeType){const e=o(d);if(null==e)continue;i.set(e,d)}const s=e=>e&&1===e.nodeType?o(e):null;let c=e.firstChild,a=t.firstChild;const l=t=>{const o=t.cloneNode(!0);!1!==r.beforeNodeAdded?.(o)&&(e.insertBefore(o,c),w(o,n))};for(;a;){const t=a.nextSibling,o=s(a);if(null!=o){const t=i.get(o);t?(t===c?c=c.nextSibling:e.insertBefore(t,c),i.delete(o),y(t,a,n,r)):l(a)}else if(c&&null==s(c)){const e=c.nextSibling;y(c,a,n,r),c=e}else l(a);a=t}for(;c;){const t=c.nextSibling;d(c,r)||(n?.dispose?.(c),e.removeChild(c),r.afterNodeRemoved?.(c)),c=t}},E=(e,t,n={})=>{let r;if("string"==typeof t){const n=document.createElement("template");n.innerHTML=t.trim();const o=n.content;r=1===o.childElementCount?o.firstElementChild:(()=>{const t=e.cloneNode(!1);return t.appendChild(o),t})()}else r=t;if(r){const t=()=>{const t=S();y(e,r,h(e),n),t()};n.transition&&document.startViewTransition?document.startViewTransition(t):t()}return e},S=()=>{const e=document.activeElement;if(!e||e===document.body)return()=>{};const t=e;let n=null,r=null;try{n=t.selectionStart,r=t.selectionEnd}catch{}return()=>{if(e!==document.activeElement&&e.isConnected&&(e.focus(),null!==n))try{t.setSelectionRange(n,r)}catch{}}},A={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},L=Object.freeze({...A}),O={mobile:"base",tablet:"md",desktop:"lg"},T=/^\d+$/,$=(0,t.reactive)({bp:"base",tick:0}),j={...A},_=["base"],N=!1,q=[],P=new Map,C=()=>"undefined"!=typeof window&&"function"==typeof window.matchMedia,D=(e,t)=>e.addEventListener?(e.addEventListener("change",t),{mql:e,off:()=>e.removeEventListener("change",t)}):(e.addListener(t),{mql:e,off:()=>e.removeListener(t)}),M=()=>{for(let e=q.length-1;e>=0;e--)if(q[e].mql.matches)return _[e+1];return"base"},z=()=>{q.forEach(e=>e.off()),q=[];const e=Object.keys(j).filter(e=>j[e]>0).sort((e,t)=>j[e]-j[t]);_=["base",...e],C()&&(q=e.map(e=>{const t=window.matchMedia(`(min-width: ${j[e]}px)`);return D(t,()=>{$.bp=M()})}),$.bp=M())},R=()=>{N||(N=!0,z()),$.tick},I=e=>{if(!C())return!1;let t=P.get(e);if(!t){const n=window.matchMedia(e);t=D(n,()=>$.tick++),P.set(e,t)}return t.mql.matches},B=e=>{if("number"==typeof e)return e;if("base"===e)return 0;if(T.test(e))return Number(e);const t=O[e];return void 0!==t?"base"===t?0:j[t]:j[e]},H=e=>{if(e<=0)return!0;const t=_.findIndex(t=>"base"!==t&&j[t]===e);return-1!==t?_.indexOf($.bp)>=t:($.tick,I(`(min-width: ${e}px)`))},V=new Set,J=(e,t)=>{if(R(),!e||"object"!=typeof e)return t;let n,r=-1;for(const o of Object.keys(e)){const t=B(o);void 0!==t?t>=r&&H(t)&&(r=t,n=e[o]):(_.join(", "),Object.keys(O).join(", "))}return void 0!==n?n:t},K=e=>{const t=O[e],n=j[t];return void 0!==n?n:A[t]},W=Object.defineProperties((e,t)=>J(e,t),{props:{value:e=>{R();const t={};for(const n of Object.keys(e))t[n]=J(e[n]);return t}},breakpoint:{get:()=>(R(),$.bp),enumerable:!0},device:{get:()=>(R(),H(K("tablet"))?H(K("desktop"))?"desktop":"tablet":"mobile"),enumerable:!0},atLeast:{value:e=>{R();const t=B(e);return void 0!==t&&H(t)}},match:{value:e=>(R(),I(e))},configure:{value:({breakpoints:e})=>{e&&(j={...e},N&&(z(),$.tick++))}}}),Z=()=>{q.forEach(e=>e.off()),P.forEach(e=>e.off()),q=[],P.clear(),N=!1};return e.collapse=e=>{e.directive("collapse",({el:e,get:t,effect:n,modifiers:r})=>{const o=e;let i=250;for(const u in r||{}){const e=/^duration-(\d+)$/.exec(u);e&&(i=+e[1])}const s=["overflow","height","transition"],c=s.map(e=>o.style[e]);o.style.overflow="hidden";let a=!0,l=0;const d=new Set,f=(e,t)=>{const n=setTimeout(()=>{d.delete(n),e()},t);d.add(n)};return n(()=>{const e=!!t(),n=++l;if(a)return a=!1,e||(o.style.height="0px"),void f(()=>{o.style.transition=`height ${i}ms ease`});e?(o.style.height=o.scrollHeight+"px",f(()=>{n===l&&(o.style.height="")},i)):(o.style.height=o.scrollHeight+"px",o.offsetHeight,o.style.height="0px")}),()=>{d.forEach(clearTimeout),s.forEach((e,t)=>o.style[e]=c[t])}})},e.defaultBreakpoints=L,e.focus=e=>{e.directive("focus",({el:e,get:t,effect:n,modifiers:r})=>{let o=!0;return n(()=>{const n=!!t();Promise.resolve().then(()=>{o&&n&&(e.focus(),r?.select&&e.select&&e.select())})}),()=>{o=!1}}),e.directive("trap",({el:e,get:t,effect:n})=>{let r=!1,o=null;const i=()=>[...e.querySelectorAll('a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])')].filter(e=>!e.hasAttribute("disabled")),s=t=>{if("Tab"!==t.key)return;const n=i();if(!n.length)return void t.preventDefault();const r=n[0],o=n[n.length-1],s=document.activeElement;e.contains(s)?t.shiftKey&&s===r?(t.preventDefault(),o.focus()):t.shiftKey||s!==o||(t.preventDefault(),r.focus()):(t.preventDefault(),r.focus())},c=()=>{r=!1,document.removeEventListener("keydown",s,!0),o&&o.focus&&o.focus()};return n(()=>{const n=!!t();n&&!r?(r=!0,o=document.activeElement,document.addEventListener("keydown",s,!0),Promise.resolve().then(()=>{r&&(i()[0]||e).focus()})):!n&&r&&c()}),()=>{r&&c()}})},e.intersect=e=>{e.directive("intersect",({el:e,get:t,modifiers:n})=>{const r=new IntersectionObserver(e=>{for(const o of e)(n?.leave?!o.isIntersecting:o.isIntersecting)&&(t(),n?.once&&r.disconnect())},{threshold:n?.full?1:0});return r.observe(e),()=>r.disconnect()})},e.mask=e=>{e.directive("mask",({el:e,exp:t})=>{const r=e,o=()=>{const e=((e,t)=>{let r="",o="",i=0;for(let s=0;s<t.length;s++){const c=n[t[s]];if(c){for(;i<e.length&&!c.test(e[i]);)i++;if(i>=e.length)break;r+=o+e[i++],o=""}else o+=t[s],e[i]===t[s]&&i++}return r})(r.value,t);e!==r.value&&(r.value=e)};return e.addEventListener("input",o),o(),()=>e.removeEventListener("input",o)})},e.media=(e,t)=>(t?.breakpoints&&JSON.stringify(t.breakpoints),t&&W.configure(t),e.scope.$mq=W,e.scope.$mqProps=W.props,e.scope.$mqAtLeast=W.atLeast,e.scope.$mqMatch=W.match,Object.defineProperty(e.scope,"$mqBreakpoint",{get:()=>W.breakpoint,enumerable:!0,configurable:!0}),Object.defineProperty(e.scope,"$mqDevice",{get:()=>W.device,enumerable:!0,configurable:!0}),Z),e.morph=E,e.morphPlugin=e=>{e.scope.$morph=E},e.mq=W,e.persist=e=>{e.directive("persist",({ctx:e,el:t,exp:n,arg:r,modifiers:o,effect:s})=>{const c=i+(n||t.id);let d;for(const i in o||{})if(a(i)){d=i;break}const f=r?r.split(",").map(e=>e.trim()).filter(Boolean):void 0;l(e.scope,c,f,a(d),s)})},e.persistStore=(e,n={})=>{const r=(0,t.store)(e);if(!r)return()=>{};const o=a(n.storage);return l(r,i+(n.key??e),n.keys,o,t.watchEffect)},e.registerStorage=(e,t)=>{s[e]=t},e.resetMedia=()=>{Z(),j={...A},_=["base",...Object.keys(j).sort((e,t)=>j[e]-j[t])],N=!1,V.clear(),$.bp="base",$.tick=0},e.resize=e=>{e.directive("resize",({el:e,get:t,exp:n,modifiers:r})=>{const o=t(`(($width, $height) => { ${n} })`);if(r?.window||r?.visual){const e=r.visual&&window.visualViewport||window,t=()=>o(e.width||innerWidth,e.height||innerHeight);return e.addEventListener("resize",t),t(),()=>e.removeEventListener("resize",t)}const i=new ResizeObserver(e=>{for(const t of e){const e=t.contentRect;o(e.width,e.height)}});return i.observe(e),()=>i.disconnect()})},e.setDefaultStorage=e=>{c=e},e.transition=e=>{e.directive("transition",({el:e,get:t,effect:n,arg:r,modifiers:i,exp:s})=>{const c=e,a=r||"v",l=e=>`${a}-${e}`;let d,f=0,u=!0;const m=()=>{c.classList.remove(l("enter-from"),l("enter-active"),l("enter-to"),l("leave-from"),l("leave-active"),l("leave-to"))},p=(e,t)=>{const n=++f;m(),c.classList.add(l(e+"-from"),l(e+"-active")),c.offsetWidth,c.classList.remove(l(e+"-from")),c.classList.add(l(e+"-to")),clearTimeout(d),d=setTimeout(()=>{n===f&&(m(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(o(t.transitionDuration,t.transitionDelay),o(t.animationDuration,t.animationDelay))})(c))};if(!s){let e=!0;return Promise.resolve().then(()=>{e&&p("enter")}),c.__leave=()=>new Promise(e=>p("leave",e)),()=>{e=!1,clearTimeout(d),delete c.__leave}}return n(()=>{const e=!!t();if(u)return u=!1,c.style.display=e?"":"none",void(e&&i?.appear&&p("enter"));e?(c.style.display="",p("enter")):p("leave",()=>{c.style.display="none"})}),()=>clearTimeout(d)})},e}({},LiteVue);
|
package/dist/litevue-plugins.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{reactive as e,store as t,watchEffect as n}from"@aevantec/litevue";var r=e=>{e.directive("intersect",({el:e,get:t,modifiers:n})=>{const r=new IntersectionObserver(e=>{for(const o of e)(n?.leave?!o.isIntersecting:o.isIntersecting)&&(t(),n?.once&&r.disconnect())},{threshold:n?.full?1:0});return r.observe(e),()=>r.disconnect()})},o={9:/\d/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},i=e=>{e.directive("mask",({el:e,exp:t})=>{const n=e,r=()=>{const e=((e,t)=>{let n="",r="",i=0;for(let s=0;s<t.length;s++){const c=o[t[s]];if(c){for(;i<e.length&&!c.test(e[i]);)i++;if(i>=e.length)break;n+=r+e[i++],r=""}else r+=t[s],e[i]===t[s]&&i++}return n})(n.value,t);e!==n.value&&(n.value=e)};return e.addEventListener("input",r),r(),()=>e.removeEventListener("input",r)})},s=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),c=(e,t)=>{const n=e.split(","),r=t.split(",");let o=0;for(let i=0;i<n.length;i++)o=Math.max(o,s(n[i])+s(r[i%r.length]));return o},a=e=>{e.directive("transition",({el:e,get:t,effect:n,arg:r,modifiers:o,exp:i})=>{const s=e,a=r||"v",l=e=>`${a}-${e}`;let f,d=0,u=!0;const m=()=>{s.classList.remove(l("enter-from"),l("enter-active"),l("enter-to"),l("leave-from"),l("leave-active"),l("leave-to"))},p=(e,t)=>{const n=++d;m(),s.classList.add(l(e+"-from"),l(e+"-active")),s.offsetWidth,s.classList.remove(l(e+"-from")),s.classList.add(l(e+"-to")),clearTimeout(f),f=setTimeout(()=>{n===d&&(m(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(c(t.transitionDuration,t.transitionDelay),c(t.animationDuration,t.animationDelay))})(s))};if(!i){let e=!0;return Promise.resolve().then(()=>{e&&p("enter")}),s.__leave=()=>new Promise(e=>p("leave",e)),()=>{e=!1,clearTimeout(f),delete s.__leave}}return n(()=>{const e=!!t();if(u)return u=!1,s.style.display=e?"":"none",void(e&&o?.appear&&p("enter"));e?(s.style.display="",p("enter")):p("leave",()=>{s.style.display="none"})}),()=>clearTimeout(f)})},l="litevue:",f=Object.create(null),d="local",u=e=>{const t=e??d;return"string"!=typeof t?t:f[t]??(e=>{try{if("local"===e||"localStorage"===e)return localStorage;if("session"===e||"sessionStorage"===e)return sessionStorage}catch{}})(t)},m=(e,t)=>{f[e]=t},p=e=>{d=e},v=(e,t,n,r,o)=>{if(!r)return o(()=>{});const i=((e,t)=>(t??Object.keys(e)).filter(t=>{if("$"===t[0])return!1;const n=Object.getOwnPropertyDescriptor(e,t);if(n&&n.get&&!n.set)return!1;const r=n&&n.value;return(!r||!0!==r.__v_isRef||!0!==r.__v_isReadonly)&&"function"!=typeof e[t]}))(e,n);try{const n=JSON.parse(r.getItem(t)||"null");if(n)for(const t of i)t in n&&(e[t]=n[t])}catch{}return o(()=>{const n={};for(const t of i)n[t]=e[t];try{r.setItem(t,JSON.stringify(n))}catch{}})},h=e=>{e.directive("persist",({ctx:e,el:t,exp:n,arg:r,modifiers:o,effect:i})=>{const s=l+(n||t.id);let c;for(const l in o||{})if(u(l)){c=l;break}const a=r?r.split(",").map(e=>e.trim()).filter(Boolean):void 0;v(e.scope,s,a,u(c),i)})},b=(e,r={})=>{const o=t(e);if(!o)return()=>{};const i=u(r.storage);return v(o,l+(r.key??e),r.keys,i,n)},g=e=>{e.directive("focus",({el:e,get:t,effect:n,modifiers:r})=>{let o=!0;return n(()=>{const n=!!t();Promise.resolve().then(()=>{o&&n&&(e.focus(),r?.select&&e.select&&e.select())})}),()=>{o=!1}}),e.directive("trap",({el:e,get:t,effect:n})=>{let r=!1,o=null;const i=()=>[...e.querySelectorAll('a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])')].filter(e=>!e.hasAttribute("disabled")),s=t=>{if("Tab"!==t.key)return;const n=i();if(!n.length)return void t.preventDefault();const r=n[0],o=n[n.length-1],s=document.activeElement;e.contains(s)?t.shiftKey&&s===r?(t.preventDefault(),o.focus()):t.shiftKey||s!==o||(t.preventDefault(),r.focus()):(t.preventDefault(),r.focus())},c=()=>{r=!1,document.removeEventListener("keydown",s,!0),o&&o.focus&&o.focus()};return n(()=>{const n=!!t();n&&!r?(r=!0,o=document.activeElement,document.addEventListener("keydown",s,!0),Promise.resolve().then(()=>{r&&(i()[0]||e).focus()})):!n&&r&&c()}),()=>{r&&c()}})},y=e=>{e.directive("collapse",({el:e,get:t,effect:n,modifiers:r})=>{const o=e;let i=250;for(const u in r||{}){const e=/^duration-(\d+)$/.exec(u);e&&(i=+e[1])}const s=["overflow","height","transition"],c=s.map(e=>o.style[e]);o.style.overflow="hidden";let a=!0,l=0;const f=/* @__PURE__ */new Set,d=(e,t)=>{const n=setTimeout(()=>{f.delete(n),e()},t);f.add(n)};return n(()=>{const e=!!t(),n=++l;if(a)return a=!1,e||(o.style.height="0px"),void d(()=>{o.style.transition=`height ${i}ms ease`});e?(o.style.height=o.scrollHeight+"px",d(()=>{n===l&&(o.style.height="")},i)):(o.style.height=o.scrollHeight+"px",o.offsetHeight,o.style.height="0px")}),()=>{f.forEach(clearTimeout),s.forEach((e,t)=>o.style[e]=c[t])}})},k=(e,t)=>1===e.nodeType&&(e.hasAttribute("data-morph-preserve")||!!t.preserve?.(e)),x=/^(?:v-|:|@)/,w=/^(?::|v-bind:)/,E=/^v-(?!scope|on:)/,A=["id","data-key","data-id"],S=e=>{for(const t of A){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},O=e=>{for(let t=e;t;t=t.parentElement)if(t.__ctx)return t.__ctx},T=e=>e.hasAttribute("v-for")||e.hasAttribute("v-if")||e.hasAttribute("v-else")||e.hasAttribute("v-else-if"),$=(e,t)=>{const n=(e=>{const t=/* @__PURE__ */new Set;for(const{name:n}of e.attributes)w.test(n)?t.add(n.replace(w,"").split(".")[0]):"v-model"===n?(t.add("value"),t.add("checked")):"v-bind"===n?t.add("*"):E.test(n)&&t.add("style");return t})(t);for(const{name:r,value:o}of[...t.attributes])x.test(r)||n.has(r)||e.getAttribute(r)!==o&&e.setAttribute(r,o);for(const{name:r}of[...e.attributes])n.has("*")||n.has(r)||t.hasAttribute(r)||e.removeAttribute(r)},L=(e,t,n,r)=>{if(e.nodeType!==t.nodeType)return _(e,t,n,r);if(3===e.nodeType||8===e.nodeType){const r=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(r,n))return;return void(e.data!==r&&(e.data=r))}if(1!==e.nodeType)return;const o=e,i=t;if(o.tagName!==i.tagName)return _(e,t,n,r);r.skip?.(o,i)||o.hasAttribute("data-morph-skip")||($(o,i),(e=>{if(e.hasAttribute("v-text")||e.hasAttribute("v-html")||e.hasAttribute("v-pre")||e.hasAttribute("v-once")||T(e))return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(T(t))return!0;return!1})(i)||N(o,i,o.__ctx||n,r))},_=(e,t,n,r)=>{if(k(e,r))return;const o=t.cloneNode(!0);!1!==r.beforeNodeAdded?.(o)&&(n?.dispose?.(e),e.parentNode.replaceChild(o,e),r.afterNodeRemoved?.(e),j(o,n))},j=(e,t)=>{const n=t||O(e.parentNode);n?.walk?.(e,n)},N=(e,t,n,r)=>{const o=r.key||S,i=/* @__PURE__ */new Map;for(let f=e.firstChild;f;f=f.nextSibling)if(1===f.nodeType){const e=o(f);if(null==e)continue;i.set(e,f)}const s=e=>e&&1===e.nodeType?o(e):null;let c=e.firstChild,a=t.firstChild;const l=t=>{const o=t.cloneNode(!0);!1!==r.beforeNodeAdded?.(o)&&(e.insertBefore(o,c),j(o,n))};for(;a;){const t=a.nextSibling,o=s(a);if(null!=o){const t=i.get(o);t?(t===c?c=c.nextSibling:e.insertBefore(t,c),i.delete(o),L(t,a,n,r)):l(a)}else if(c&&null==s(c)){const e=c.nextSibling;L(c,a,n,r),c=e}else l(a);a=t}for(;c;){const t=c.nextSibling;k(c,r)||(n?.dispose?.(c),e.removeChild(c),r.afterNodeRemoved?.(c)),c=t}},q=(e,t,n={})=>{let r;if("string"==typeof t){const n=document.createElement("template");n.innerHTML=t.trim();const o=n.content;r=1===o.childElementCount?o.firstElementChild:(()=>{const t=e.cloneNode(!1);return t.appendChild(o),t})()}else r=t;if(r){const t=()=>{const t=C();L(e,r,O(e),n),t()};n.transition&&document.startViewTransition?document.startViewTransition(t):t()}return e},C=()=>{const e=document.activeElement;if(!e||e===document.body)return()=>{};const t=e;let n=null,r=null;try{n=t.selectionStart,r=t.selectionEnd}catch{}return()=>{if(e!==document.activeElement&&e.isConnected&&(e.focus(),null!==n))try{t.setSelectionRange(n,r)}catch{}}},D=e=>{e.scope.$morph=q},M={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},P=Object.freeze({...M}),R={mobile:"base",tablet:"md",desktop:"lg"},I=/^\d+$/,z=e({bp:"base",tick:0}),B={...M},H=["base"],J=!1,K=[],V=/* @__PURE__ */new Map,Z=()=>"undefined"!=typeof window&&"function"==typeof window.matchMedia,F=(e,t)=>e.addEventListener?(e.addEventListener("change",t),{mql:e,off:()=>e.removeEventListener("change",t)}):(e.addListener(t),{mql:e,off:()=>e.removeListener(t)}),W=()=>{for(let e=K.length-1;e>=0;e--)if(K[e].mql.matches)return H[e+1];return"base"},G=()=>{K.forEach(e=>e.off()),K=[];const e=Object.keys(B).filter(e=>B[e]>0).sort((e,t)=>B[e]-B[t]);H=["base",...e],Z()&&(K=e.map(e=>{const t=window.matchMedia(`(min-width: ${B[e]}px)`);return F(t,()=>{z.bp=W()})}),z.bp=W())},Q=()=>{J||(J=!0,G()),z.tick},U=e=>{if(!Z())return!1;let t=V.get(e);if(!t){const n=window.matchMedia(e);t=F(n,()=>z.tick++),V.set(e,t)}return t.mql.matches},X=e=>{if("number"==typeof e)return e;if("base"===e)return 0;if(I.test(e))return Number(e);const t=R[e];return void 0!==t?"base"===t?0:B[t]:B[e]},Y=e=>{if(e<=0)return!0;const t=H.findIndex(t=>"base"!==t&&B[t]===e);return-1!==t?H.indexOf(z.bp)>=t:(z.tick,U(`(min-width: ${e}px)`))},ee=/* @__PURE__ */new Set,te=(e,t)=>{if(Q(),!e||"object"!=typeof e)return t;let n,r=-1;for(const o of Object.keys(e)){const t=X(o);void 0!==t?t>=r&&Y(t)&&(r=t,n=e[o]):(H.join(", "),Object.keys(R).join(", "))}return void 0!==n?n:t},ne=e=>{const t=R[e],n=B[t];return void 0!==n?n:M[t]},re=Object.defineProperties((e,t)=>te(e,t),{props:{value:e=>{Q();const t={};for(const n of Object.keys(e))t[n]=te(e[n]);return t}},breakpoint:{get:()=>(Q(),z.bp),enumerable:!0},device:{get:()=>(Q(),Y(ne("tablet"))?Y(ne("desktop"))?"desktop":"tablet":"mobile"),enumerable:!0},atLeast:{value:e=>{Q();const t=X(e);return void 0!==t&&Y(t)}},match:{value:e=>(Q(),U(e))},configure:{value:({breakpoints:e})=>{e&&(B={...e},J&&(G(),z.tick++))}}}),oe=()=>{K.forEach(e=>e.off()),V.forEach(e=>e.off()),K=[],V.clear(),J=!1},ie=()=>{oe(),B={...M},H=["base",...Object.keys(B).sort((e,t)=>B[e]-B[t])],J=!1,ee.clear(),z.bp="base",z.tick=0},se=(e,t)=>(t?.breakpoints&&JSON.stringify(t.breakpoints),t&&re.configure(t),e.scope.$mq=re,e.scope.$mqProps=re.props,e.scope.$mqAtLeast=re.atLeast,e.scope.$mqMatch=re.match,Object.defineProperty(e.scope,"$mqBreakpoint",{get:()=>re.breakpoint,enumerable:!0,configurable:!0}),Object.defineProperty(e.scope,"$mqDevice",{get:()=>re.device,enumerable:!0,configurable:!0}),oe),ce=e=>{e.directive("resize",({el:e,get:t,exp:n})=>{const r=t(`(($width, $height) => { ${n} })`),o=new ResizeObserver(e=>{for(const t of e){const e=t.contentRect;r(e.width,e.height)}});return o.observe(e),()=>o.disconnect()})};export{y as collapse,P as defaultBreakpoints,g as focus,r as intersect,i as mask,se as media,q as morph,D as morphPlugin,re as mq,h as persist,b as persistStore,m as registerStorage,ie as resetMedia,ce as resize,p as setDefaultStorage,a as transition};
|
|
1
|
+
import{reactive as e,store as t,watchEffect as n}from"@aevantec/litevue";var r=e=>{e.directive("intersect",({el:e,get:t,modifiers:n})=>{const r=new IntersectionObserver(e=>{for(const o of e)(n?.leave?!o.isIntersecting:o.isIntersecting)&&(t(),n?.once&&r.disconnect())},{threshold:n?.full?1:0});return r.observe(e),()=>r.disconnect()})},o={9:/\d/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},i=e=>{e.directive("mask",({el:e,exp:t})=>{const n=e,r=()=>{const e=((e,t)=>{let n="",r="",i=0;for(let s=0;s<t.length;s++){const c=o[t[s]];if(c){for(;i<e.length&&!c.test(e[i]);)i++;if(i>=e.length)break;n+=r+e[i++],r=""}else r+=t[s],e[i]===t[s]&&i++}return n})(n.value,t);e!==n.value&&(n.value=e)};return e.addEventListener("input",r),r(),()=>e.removeEventListener("input",r)})},s=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),c=(e,t)=>{const n=e.split(","),r=t.split(",");let o=0;for(let i=0;i<n.length;i++)o=Math.max(o,s(n[i])+s(r[i%r.length]));return o},a=e=>{e.directive("transition",({el:e,get:t,effect:n,arg:r,modifiers:o,exp:i})=>{const s=e,a=r||"v",l=e=>`${a}-${e}`;let d,f=0,u=!0;const m=()=>{s.classList.remove(l("enter-from"),l("enter-active"),l("enter-to"),l("leave-from"),l("leave-active"),l("leave-to"))},p=(e,t)=>{const n=++f;m(),s.classList.add(l(e+"-from"),l(e+"-active")),s.offsetWidth,s.classList.remove(l(e+"-from")),s.classList.add(l(e+"-to")),clearTimeout(d),d=setTimeout(()=>{n===f&&(m(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(c(t.transitionDuration,t.transitionDelay),c(t.animationDuration,t.animationDelay))})(s))};if(!i){let e=!0;return Promise.resolve().then(()=>{e&&p("enter")}),s.__leave=()=>new Promise(e=>p("leave",e)),()=>{e=!1,clearTimeout(d),delete s.__leave}}return n(()=>{const e=!!t();if(u)return u=!1,s.style.display=e?"":"none",void(e&&o?.appear&&p("enter"));e?(s.style.display="",p("enter")):p("leave",()=>{s.style.display="none"})}),()=>clearTimeout(d)})},l="litevue:",d=Object.create(null),f="local",u=e=>{const t=e??f;return"string"!=typeof t?t:d[t]??(e=>{try{if("local"===e||"localStorage"===e)return localStorage;if("session"===e||"sessionStorage"===e)return sessionStorage}catch{}})(t)},m=(e,t)=>{d[e]=t},p=e=>{f=e},v=(e,t,n,r,o)=>{if(!r)return o(()=>{});const i=((e,t)=>(t??Object.keys(e)).filter(t=>{if("$"===t[0])return!1;const n=Object.getOwnPropertyDescriptor(e,t);if(n&&n.get&&!n.set)return!1;const r=n&&n.value;return(!r||!0!==r.__v_isRef||!0!==r.__v_isReadonly)&&"function"!=typeof e[t]}))(e,n);try{const n=JSON.parse(r.getItem(t)||"null");if(n)for(const t of i)t in n&&(e[t]=n[t])}catch{}return o(()=>{const n={};for(const t of i)n[t]=e[t];try{r.setItem(t,JSON.stringify(n))}catch{}})},h=e=>{e.directive("persist",({ctx:e,el:t,exp:n,arg:r,modifiers:o,effect:i})=>{const s=l+(n||t.id);let c;for(const l in o||{})if(u(l)){c=l;break}const a=r?r.split(",").map(e=>e.trim()).filter(Boolean):void 0;v(e.scope,s,a,u(c),i)})},b=(e,r={})=>{const o=t(e);if(!o)return()=>{};const i=u(r.storage);return v(o,l+(r.key??e),r.keys,i,n)},g=e=>{e.directive("focus",({el:e,get:t,effect:n,modifiers:r})=>{let o=!0;return n(()=>{const n=!!t();Promise.resolve().then(()=>{o&&n&&(e.focus(),r?.select&&e.select&&e.select())})}),()=>{o=!1}}),e.directive("trap",({el:e,get:t,effect:n})=>{let r=!1,o=null;const i=()=>[...e.querySelectorAll('a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])')].filter(e=>!e.hasAttribute("disabled")),s=t=>{if("Tab"!==t.key)return;const n=i();if(!n.length)return void t.preventDefault();const r=n[0],o=n[n.length-1],s=document.activeElement;e.contains(s)?t.shiftKey&&s===r?(t.preventDefault(),o.focus()):t.shiftKey||s!==o||(t.preventDefault(),r.focus()):(t.preventDefault(),r.focus())},c=()=>{r=!1,document.removeEventListener("keydown",s,!0),o&&o.focus&&o.focus()};return n(()=>{const n=!!t();n&&!r?(r=!0,o=document.activeElement,document.addEventListener("keydown",s,!0),Promise.resolve().then(()=>{r&&(i()[0]||e).focus()})):!n&&r&&c()}),()=>{r&&c()}})},y=e=>{e.directive("collapse",({el:e,get:t,effect:n,modifiers:r})=>{const o=e;let i=250;for(const u in r||{}){const e=/^duration-(\d+)$/.exec(u);e&&(i=+e[1])}const s=["overflow","height","transition"],c=s.map(e=>o.style[e]);o.style.overflow="hidden";let a=!0,l=0;const d=/* @__PURE__ */new Set,f=(e,t)=>{const n=setTimeout(()=>{d.delete(n),e()},t);d.add(n)};return n(()=>{const e=!!t(),n=++l;if(a)return a=!1,e||(o.style.height="0px"),void f(()=>{o.style.transition=`height ${i}ms ease`});e?(o.style.height=o.scrollHeight+"px",f(()=>{n===l&&(o.style.height="")},i)):(o.style.height=o.scrollHeight+"px",o.offsetHeight,o.style.height="0px")}),()=>{d.forEach(clearTimeout),s.forEach((e,t)=>o.style[e]=c[t])}})},w=(e,t)=>1===e.nodeType&&(e.hasAttribute("data-morph-preserve")||!!t.preserve?.(e)),k=/^(?:v-|:|@)/,x=/^(?::|v-bind:)/,E=/^v-(?!scope|on:)/,A=["id","data-key","data-id"],S=e=>{for(const t of A){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},L=e=>{for(let t=e;t;t=t.parentElement)if(t.__ctx)return t.__ctx},O=e=>e.hasAttribute("v-for")||e.hasAttribute("v-if")||e.hasAttribute("v-else")||e.hasAttribute("v-else-if"),T=(e,t)=>{const n=(e=>{const t=/* @__PURE__ */new Set;for(const{name:n}of e.attributes)x.test(n)?t.add(n.replace(x,"").split(".")[0]):"v-model"===n?(t.add("value"),t.add("checked")):"v-bind"===n?t.add("*"):E.test(n)&&t.add("style");return t})(t);for(const{name:r,value:o}of[...t.attributes])k.test(r)||n.has(r)||e.getAttribute(r)!==o&&e.setAttribute(r,o);for(const{name:r}of[...e.attributes])n.has("*")||n.has(r)||t.hasAttribute(r)||e.removeAttribute(r)},$=(e,t,n,r)=>{if(e.nodeType!==t.nodeType)return _(e,t,n,r);if(3===e.nodeType||8===e.nodeType){const r=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(r,n))return;return void(e.data!==r&&(e.data=r))}if(1!==e.nodeType)return;const o=e,i=t;if(o.tagName!==i.tagName)return _(e,t,n,r);r.skip?.(o,i)||o.hasAttribute("data-morph-skip")||(T(o,i),(e=>{if(e.hasAttribute("v-text")||e.hasAttribute("v-html")||e.hasAttribute("v-pre")||e.hasAttribute("v-once")||O(e))return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(O(t))return!0;return!1})(i)||N(o,i,o.__ctx||n,r))},_=(e,t,n,r)=>{if(w(e,r))return;const o=t.cloneNode(!0);!1!==r.beforeNodeAdded?.(o)&&(n?.dispose?.(e),e.parentNode.replaceChild(o,e),r.afterNodeRemoved?.(e),j(o,n))},j=(e,t)=>{const n=t||L(e.parentNode);n?.walk?.(e,n)},N=(e,t,n,r)=>{const o=r.key||S,i=/* @__PURE__ */new Map;for(let d=e.firstChild;d;d=d.nextSibling)if(1===d.nodeType){const e=o(d);if(null==e)continue;i.set(e,d)}const s=e=>e&&1===e.nodeType?o(e):null;let c=e.firstChild,a=t.firstChild;const l=t=>{const o=t.cloneNode(!0);!1!==r.beforeNodeAdded?.(o)&&(e.insertBefore(o,c),j(o,n))};for(;a;){const t=a.nextSibling,o=s(a);if(null!=o){const t=i.get(o);t?(t===c?c=c.nextSibling:e.insertBefore(t,c),i.delete(o),$(t,a,n,r)):l(a)}else if(c&&null==s(c)){const e=c.nextSibling;$(c,a,n,r),c=e}else l(a);a=t}for(;c;){const t=c.nextSibling;w(c,r)||(n?.dispose?.(c),e.removeChild(c),r.afterNodeRemoved?.(c)),c=t}},q=(e,t,n={})=>{let r;if("string"==typeof t){const n=document.createElement("template");n.innerHTML=t.trim();const o=n.content;r=1===o.childElementCount?o.firstElementChild:(()=>{const t=e.cloneNode(!1);return t.appendChild(o),t})()}else r=t;if(r){const t=()=>{const t=C();$(e,r,L(e),n),t()};n.transition&&document.startViewTransition?document.startViewTransition(t):t()}return e},C=()=>{const e=document.activeElement;if(!e||e===document.body)return()=>{};const t=e;let n=null,r=null;try{n=t.selectionStart,r=t.selectionEnd}catch{}return()=>{if(e!==document.activeElement&&e.isConnected&&(e.focus(),null!==n))try{t.setSelectionRange(n,r)}catch{}}},D=e=>{e.scope.$morph=q},M={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},P=Object.freeze({...M}),z={mobile:"base",tablet:"md",desktop:"lg"},R=/^\d+$/,I=e({bp:"base",tick:0}),H={...M},B=["base"],J=!1,V=[],K=/* @__PURE__ */new Map,W=()=>"undefined"!=typeof window&&"function"==typeof window.matchMedia,Z=(e,t)=>e.addEventListener?(e.addEventListener("change",t),{mql:e,off:()=>e.removeEventListener("change",t)}):(e.addListener(t),{mql:e,off:()=>e.removeListener(t)}),F=()=>{for(let e=V.length-1;e>=0;e--)if(V[e].mql.matches)return B[e+1];return"base"},G=()=>{V.forEach(e=>e.off()),V=[];const e=Object.keys(H).filter(e=>H[e]>0).sort((e,t)=>H[e]-H[t]);B=["base",...e],W()&&(V=e.map(e=>{const t=window.matchMedia(`(min-width: ${H[e]}px)`);return Z(t,()=>{I.bp=F()})}),I.bp=F())},Q=()=>{J||(J=!0,G()),I.tick},U=e=>{if(!W())return!1;let t=K.get(e);if(!t){const n=window.matchMedia(e);t=Z(n,()=>I.tick++),K.set(e,t)}return t.mql.matches},X=e=>{if("number"==typeof e)return e;if("base"===e)return 0;if(R.test(e))return Number(e);const t=z[e];return void 0!==t?"base"===t?0:H[t]:H[e]},Y=e=>{if(e<=0)return!0;const t=B.findIndex(t=>"base"!==t&&H[t]===e);return-1!==t?B.indexOf(I.bp)>=t:(I.tick,U(`(min-width: ${e}px)`))},ee=/* @__PURE__ */new Set,te=(e,t)=>{if(Q(),!e||"object"!=typeof e)return t;let n,r=-1;for(const o of Object.keys(e)){const t=X(o);void 0!==t?t>=r&&Y(t)&&(r=t,n=e[o]):(B.join(", "),Object.keys(z).join(", "))}return void 0!==n?n:t},ne=e=>{const t=z[e],n=H[t];return void 0!==n?n:M[t]},re=Object.defineProperties((e,t)=>te(e,t),{props:{value:e=>{Q();const t={};for(const n of Object.keys(e))t[n]=te(e[n]);return t}},breakpoint:{get:()=>(Q(),I.bp),enumerable:!0},device:{get:()=>(Q(),Y(ne("tablet"))?Y(ne("desktop"))?"desktop":"tablet":"mobile"),enumerable:!0},atLeast:{value:e=>{Q();const t=X(e);return void 0!==t&&Y(t)}},match:{value:e=>(Q(),U(e))},configure:{value:({breakpoints:e})=>{e&&(H={...e},J&&(G(),I.tick++))}}}),oe=()=>{V.forEach(e=>e.off()),K.forEach(e=>e.off()),V=[],K.clear(),J=!1},ie=()=>{oe(),H={...M},B=["base",...Object.keys(H).sort((e,t)=>H[e]-H[t])],J=!1,ee.clear(),I.bp="base",I.tick=0},se=(e,t)=>(t?.breakpoints&&JSON.stringify(t.breakpoints),t&&re.configure(t),e.scope.$mq=re,e.scope.$mqProps=re.props,e.scope.$mqAtLeast=re.atLeast,e.scope.$mqMatch=re.match,Object.defineProperty(e.scope,"$mqBreakpoint",{get:()=>re.breakpoint,enumerable:!0,configurable:!0}),Object.defineProperty(e.scope,"$mqDevice",{get:()=>re.device,enumerable:!0,configurable:!0}),oe),ce=e=>{e.directive("resize",({el:e,get:t,exp:n,modifiers:r})=>{const o=t(`(($width, $height) => { ${n} })`);if(r?.window||r?.visual){const e=r.visual&&window.visualViewport||window,t=()=>o(e.width||innerWidth,e.height||innerHeight);return e.addEventListener("resize",t),t(),()=>e.removeEventListener("resize",t)}const i=new ResizeObserver(e=>{for(const t of e){const e=t.contentRect;o(e.width,e.height)}});return i.observe(e),()=>i.disconnect()})};export{y as collapse,P as defaultBreakpoints,g as focus,r as intersect,i as mask,se as media,q as morph,D as morphPlugin,re as mq,h as persist,b as persistStore,m as registerStorage,ie as resetMedia,ce as resize,p as setDefaultStorage,a as transition};
|