@aevantec/litevue 0.5.2 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +5 -4
  2. package/dist/litevue-devtools.iife.js +1 -1
  3. package/dist/litevue-devtools.mjs +14 -2
  4. package/dist/litevue-devtools.umd.js +1 -1
  5. package/dist/litevue-plugins.iife.js +1 -1
  6. package/dist/litevue-plugins.mjs +409 -8
  7. package/dist/litevue-plugins.umd.js +1 -1
  8. package/dist/litevue.iife.js +2 -2
  9. package/dist/litevue.mjs +126 -17
  10. package/dist/litevue.umd.js +2 -2
  11. package/dist/plugins/collapse.iife.js +1 -0
  12. package/dist/plugins/collapse.mjs +46 -0
  13. package/dist/plugins/collapse.umd.js +1 -0
  14. package/dist/plugins/focus.iife.js +1 -0
  15. package/dist/plugins/focus.mjs +69 -0
  16. package/dist/plugins/focus.umd.js +1 -0
  17. package/dist/plugins/intersect.iife.js +1 -0
  18. package/dist/plugins/intersect.mjs +20 -0
  19. package/dist/plugins/intersect.umd.js +1 -0
  20. package/dist/plugins/mask.iife.js +1 -0
  21. package/dist/plugins/mask.mjs +37 -0
  22. package/dist/plugins/mask.umd.js +1 -0
  23. package/dist/plugins/media.iife.js +1 -0
  24. package/dist/plugins/media.mjs +204 -0
  25. package/dist/plugins/media.umd.js +1 -0
  26. package/dist/plugins/morph.iife.js +1 -0
  27. package/dist/plugins/morph.mjs +174 -0
  28. package/dist/plugins/morph.umd.js +1 -0
  29. package/dist/plugins/persist.iife.js +1 -0
  30. package/dist/plugins/persist.mjs +86 -0
  31. package/dist/plugins/persist.umd.js +1 -0
  32. package/dist/plugins/resize.iife.js +1 -0
  33. package/dist/plugins/resize.mjs +15 -0
  34. package/dist/plugins/resize.umd.js +1 -0
  35. package/dist/plugins/transition.iife.js +1 -0
  36. package/dist/plugins/transition.mjs +76 -0
  37. package/dist/plugins/transition.umd.js +1 -0
  38. package/dist/types/app.d.mts +5 -1
  39. package/dist/types/app.d.ts +5 -1
  40. package/dist/types/context.d.mts +7 -0
  41. package/dist/types/context.d.ts +7 -0
  42. package/dist/types/index.d.mts +2 -1
  43. package/dist/types/index.d.ts +2 -1
  44. package/dist/types/plugins/{collapse.d.mts → collapse/index.d.mts} +1 -1
  45. package/dist/types/plugins/{collapse.d.ts → collapse/index.d.ts} +1 -1
  46. package/dist/types/plugins/{focus.d.mts → focus/index.d.mts} +1 -1
  47. package/dist/types/plugins/{focus.d.ts → focus/index.d.ts} +1 -1
  48. package/dist/types/plugins/index.d.mts +12 -7
  49. package/dist/types/plugins/index.d.ts +5 -0
  50. package/dist/types/plugins/{intersect.d.mts → intersect/index.d.mts} +1 -1
  51. package/dist/types/plugins/{intersect.d.ts → intersect/index.d.ts} +1 -1
  52. package/dist/types/plugins/{mask.d.mts → mask/index.d.mts} +1 -1
  53. package/dist/types/plugins/{mask.d.ts → mask/index.d.ts} +1 -1
  54. package/dist/types/plugins/media/index.d.mts +46 -0
  55. package/dist/types/plugins/media/index.d.ts +46 -0
  56. package/dist/types/plugins/morph/index.d.mts +34 -0
  57. package/dist/types/plugins/morph/index.d.ts +34 -0
  58. package/dist/types/plugins/{persist.d.mts → persist/index.d.mts} +1 -1
  59. package/dist/types/plugins/{persist.d.ts → persist/index.d.ts} +1 -1
  60. package/dist/types/plugins/resize/index.d.mts +12 -0
  61. package/dist/types/plugins/resize/index.d.ts +12 -0
  62. package/dist/types/plugins/{transition.d.mts → transition/index.d.mts} +1 -1
  63. package/dist/types/plugins/{transition.d.ts → transition/index.d.ts} +1 -1
  64. package/dist/types/utils.d.mts +6 -1
  65. package/dist/types/utils.d.ts +6 -1
  66. package/package.json +120 -4
package/README.md CHANGED
@@ -6,14 +6,15 @@ Published on npm as **[`@aevantec/litevue`](https://www.npmjs.com/package/@aevan
6
6
  unscoped name is blocked by an unrelated `lite-vue` package. The IIFE/UMD global
7
7
  stays `LiteVue`.
8
8
 
9
- - **~8kb** gzipped core, driven by the real `@vue/reactivity`
9
+ - **~9kb** gzipped core, driven by the real `@vue/reactivity`
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 first-party plugins: intersect, persist, focus (+trap), collapse, transition, mask
13
+ - **Plugin system** with first-party plugins: intersect, persist, focus (+trap), collapse, transition, mask, morph
14
14
  - **Global store** (`store()` / `$store`) and magic properties (`$dispatch`, `$watch`, `$id`, `$root`, …)
15
+ - **Cached derived state** with `computed()`, alongside `reactive()` and `watchEffect()`
15
16
  - Extra event modifiers: `.outside`, `.window`, `.debounce`, `.throttle`, animation-event filters
16
- - Safe with dynamic content: injected markup stays inert until explicitly mounted
17
+ - Safe with dynamic content: injected markup stays inert until explicitly mounted, and `morph` updates a server-rendered region in place without losing scope state, focus or scroll
17
18
 
18
19
  ## Quick start
19
20
 
@@ -47,7 +48,7 @@ Full documentation lives in the **[docs site](https://litevue.dev/)** (source in
47
48
  - [Essentials](https://litevue.dev/essentials/) — state, templating, components, lifecycle, dynamic content
48
49
  - [Directives](https://litevue.dev/directives/) — a page per directive, with live demos
49
50
  - [Magics](https://litevue.dev/magics/) — `$el`, `$store`, `$dispatch`, `$watch`, `$id`, …
50
- - [Globals](https://litevue.dev/globals/) — `createApp()`, `store()`, the devtools API
51
+ - [Globals](https://litevue.dev/globals/) — `createApp()`, `store()`, `computed()`, `watchEffect()`, the devtools API
51
52
  - [Plugins](https://litevue.dev/plugins/) — the plugin system and all first-party plugins
52
53
  - [Devtools](https://litevue.dev/devtools/) — inspector panel, browser extension, production kill-switch
53
54
  - [Migrating from petite-vue](https://litevue.dev/migration/from-petite-vue) · [Coming from Alpine](https://litevue.dev/migration/from-alpine)
@@ -1 +1 @@
1
- var LiteVueDevtoolsPanel=function(e){"use strict";let n,t,o,r,i,l,d,a,s,p,c,h=null,u=null,v=!1,x="",g="Elements";const m=e=>'<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">'+e+"</svg>",y="litevue-devtools-theme",f="litevue-devtools-ui",b=()=>{try{return JSON.parse(localStorage.getItem(f)||"{}")}catch{return{}}},w=e=>{try{localStorage.setItem(f,JSON.stringify({...b(),...e}))}catch{}},k={dark:m('<path d="M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z"/>'),light:m('<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:m('<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"/>')},C={dark:"light",light:"system",system:"dark"};let E="dark";try{const e=localStorage.getItem(y);"light"!==e&&"system"!==e||(E=e)}catch{}const L=matchMedia("(prefers-color-scheme: light)"),O=()=>{const e="light"===E||"system"===E&&L.matches;t.host.classList.toggle("light",e),a.innerHTML=k[E],a.title="theme: "+E},S=new Set,N=(e,n,t)=>{const o=document.createElement(e);return o.className=n,null!=t&&(o.textContent=t),o},$=e=>{const n=N("span","label");return n.appendChild(N("span","punct","<")),n.appendChild(N("span","name",D(e))),n.appendChild(N("span","punct",">")),n},T=e=>{let t=0,o=e.parentElement;for(;o;)n.scopes.has(o)&&t++,o=o.parentElement;return t},_=e=>{let n;try{n=void 0===e?"undefined":JSON.stringify(e)??String(e)}catch(t){n=String(e)}return n.length>60?n.slice(0,60)+"\u2026":n},z=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`},I=()=>{s.style.display="none"},j=e=>{e!==h&&S.clear(),u=null,h=e,g="Elements",window.$scope=e?n.scopes.get(e):void 0,V(),H()},M=e=>{e!==u&&S.clear(),h=null,u=e,g="Stores",window.$scope=n.stores.get(e),V(),H()},P=e=>{g=e,V()},D=e=>n.names.get(e)||e.id||e.tagName.toLowerCase(),V=()=>{if((()=>{const e=n.stores?n.stores.size:0;p.textContent=`Elements (${n.scopes.size})`,p.className="Elements"===g?"tab active":"tab",c.textContent=`Stores (${e})`,c.className="Stores"===g?"tab active":"tab"})(),i.textContent="","Elements"===g){const e=[...n.scopes.keys()].filter(e=>D(e).toLowerCase().includes(x)).sort((e,n)=>e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1);if(!e.length)return void i.appendChild(N("div","empty",x?"no matching scopes":"no scopes mounted"));for(const t of e){const e=N("div",t===h?"row sel":"row");e.style.paddingLeft=8+12*T(t)+"px",e.appendChild($(t));const o=n.exps.get(t);o&&e.appendChild(N("span","exp"," "+o)),e.onclick=()=>j(t),e.onmouseenter=()=>z(t),e.onmouseleave=I,i.appendChild(e)}return}const e=[...n.stores?n.stores.keys():[]].filter(e=>e.toLowerCase().includes(x));if(e.length)for(const n of e){const e=N("div",n===u?"row sel":"row"),t=N("span","label");t.appendChild(N("span","punct","$store.")),t.appendChild(N("span","name",n)),e.appendChild(t),e.onclick=()=>M(n),i.appendChild(e)}else i.appendChild(N("div","empty",x?"no matching stores":"no stores registered"))},H=()=>{if(l.contains(t.activeElement))return;l.textContent="";const e=u?n.stores.get(u):h?n.scopes.get(h):void 0;if(!e)return void l.appendChild(N("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=>W(n,e,n,0,"prop",[])),r.length&&(l.appendChild(N("div","divider","inherited")),r.forEach(n=>W(n,e,n,0,"prop inherited",[]))),o.length||r.length||l.appendChild(N("div","empty","empty scope")),l.appendChild(R(e))},R=e=>{const n=N("div","prop adder");n.appendChild(N("span","spacer"));const t=N("input","val key-in");t.placeholder="key";const o=N("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(),X(),setTimeout(()=>{const e=l.querySelector(".adder .key-in");e&&e.focus()})})()},n.appendChild(t),n.appendChild(o),n},W=(e,n,t,o,r,i)=>{const d=n[e],a=N("div",r);if(a.style.paddingLeft=8+14*o+"px",null!==d&&"object"==typeof d){const s=i.indexOf(d)>-1,p=!s&&S.has(t);if(a.appendChild(N("span",p?"arrow open":"arrow","\u25b6")),a.appendChild(N("span","key",e)),a.appendChild(N("span","preview",s?"(circular)":(e=>Array.isArray(e)?`(${e.length}) ${_(e)}`:_(e))(d))),s||(a.classList.add("toggle"),a.onclick=()=>{p?S.delete(t):S.add(t),H()}),A(a,n,e,o,r),l.appendChild(a),p){const e=Object.keys(d);if(!e.length){const e=N("div","muted","(empty)");e.style.paddingLeft=22+14*(o+1)+"px",l.appendChild(e)}for(const n of e)W(n,d,t+"."+n,o+1,r,i.concat([d]))}return}a.appendChild(N("span","spacer")),a.appendChild(N("span","key",e));const s=Object.getOwnPropertyDescriptor(n,e);if("function"==typeof d)a.appendChild(N("span","preview","\u0192"));else if(s&&s.get&&!s.set)a.appendChild(N("span","preview",_(d)));else if("boolean"==typeof d){a.appendChild(N("span","bool",String(d)));const t=N("input","check");t.type="checkbox",t.checked=d,t.onchange=()=>{n[e]=t.checked,t.blur(),X()},a.appendChild(t)}else{const t=N("input","val");t.value=_(d),t.onfocus=()=>{t.value="string"==typeof d?d:String(d)},t.onkeydown=e=>{"Enter"===e.key&&t.blur(),"Escape"===e.key&&(t.value=_(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,X()):t.value=_(d)},a.appendChild(t)}A(a,n,e,o,r),l.appendChild(a)},A=(e,n,o,r,i)=>{if(0!==r||"prop"!==i)return;const l=Object.getOwnPropertyDescriptor(n,o);if(l&&l.get)return;const d=N("button","del","\u2715");d.title=`delete "${o}"`,d.onclick=e=>{e.stopPropagation();const r=t.activeElement;r&&r.blur&&r.blur(),delete n[o],X()},e.appendChild(d)},B=e=>{const o=e.target;if(o===t.host)return;e.preventDefault(),e.stopPropagation(),J();let r=o;for(;r&&!n.scopes.has(r);)r=r.parentElement;r&&j(r)},F=e=>{let o=e.target;if(o!==t.host){for(;o&&!n.scopes.has(o);)o=o.parentElement;o?z(o):I()}},J=()=>{v=!1,d.classList.remove("active"),I(),document.removeEventListener("click",B,!0),document.removeEventListener("mousemove",F,!0)};let U=!1;const X=()=>{U||(U=!0,setTimeout(()=>{U=!1,"none"!==o.style.display&&(V(),H())}))},Y=()=>{const e=document.createElement("div");t=e.attachShadow({mode:"open"});const u=document.createElement("style");u.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: 640px;\n max-width: calc(100vw - 24px);\n height: 440px;\n max-height: calc(100vh - 24px);\n min-width: 320px;\n min-height: 200px;\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 6px;\n overflow: hidden;\n resize: both;\n box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);\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 padding: 2px 8px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\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}\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(u),s=N("div","highlight"),t.appendChild(s),r=N("div","pill","\u26a1 LiteVue"),r.onclick=()=>{r.style.display="none",o.style.display="flex",w({open:!0}),X()},t.appendChild(r),o=N("div","panel"),o.style.display="none";const g=N("div","header");g.appendChild(N("span","title","\u26a1 LiteVue")),g.addEventListener("mousedown",e=>{if(e.target.closest(".btn"))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=Math.max(0,t-(e.clientX-i))+"px",o.style.bottom=Math.max(0,r-(e.clientY-l))+"px"},a=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a),w({right:parseInt(o.style.right)||12,bottom:parseInt(o.style.bottom)||12})};document.addEventListener("mousemove",d),document.addEventListener("mouseup",a)}),a=N("button","btn"),a.onclick=()=>{E=C[E];try{localStorage.setItem(y,E)}catch{}O()},g.appendChild(a),L.addEventListener("change",()=>{"system"===E&&O()}),O(),d=N("button","btn"),d.title="pick an element on the page",d.innerHTML=m('<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=()=>v?J():(v=!0,d.classList.add("active"),document.addEventListener("click",B,!0),void document.addEventListener("mousemove",F,!0)),g.appendChild(d);const f=N("button","btn","\u2715");f.onclick=()=>{v&&J(),o.style.display="none",r.style.display="",w({open:!1})},g.appendChild(f),o.appendChild(g);const k=N("div","body"),S=N("div","side"),$=N("div","tabs");p=N("div","tab active"),p.onclick=()=>P("Elements"),c=N("div","tab"),c.onclick=()=>P("Stores"),$.appendChild(p),$.appendChild(c),S.appendChild($);const T=N("input","filter");T.placeholder="Filter by name",T.oninput=()=>{x=T.value.trim().toLowerCase(),V()},T.onkeydown=e=>{"Escape"===e.key&&(T.value="",x="",V())},S.appendChild(T),i=N("div","tree"),S.appendChild(i),l=N("div","state"),k.appendChild(S),k.appendChild(l),o.appendChild(k),t.appendChild(o);const _=b();if(null!=_.right&&(o.style.right=_.right+"px"),null!=_.bottom&&(o.style.bottom=_.bottom+"px"),_.w&&(o.style.width=_.w+"px"),_.h&&(o.style.height=_.h+"px"),_.open&&(r.style.display="none",o.style.display="flex",X()),"undefined"!=typeof ResizeObserver){let e;new ResizeObserver(()=>{clearTimeout(e),e=setTimeout(()=>{"none"!==o.style.display&&o.offsetWidth&&w({w:o.offsetWidth,h:o.offsetHeight})},300)}).observe(o)}document.body.appendChild(e),n.on("scope:mount",X),n.on("scope:unmount",e=>{e===h&&(h=null),X()}),n.stores&&n.on("store:register",X),n.on("flush",X)},q=()=>{const e=window.__LITE_VUE__;e?(n=e,document.body?Y():addEventListener("DOMContentLoaded",Y)):console.warn("[LiteVue devtools] window.__LITE_VUE__ not found \u2014 load LiteVue before the devtools panel script.")};return q(),e.init=q,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
1
+ var LiteVueDevtoolsPanel=function(e){"use strict";let n,t,o,r,i,l,d,a,s,p,c,h=null,u=null,v=!1,g="",x="Elements";const f=e=>'<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">'+e+"</svg>",y="litevue-devtools-theme",m="litevue-devtools-ui",b=()=>{try{return JSON.parse(localStorage.getItem(m)||"{}")}catch{return{}}},w=e=>{try{localStorage.setItem(m,JSON.stringify({...b(),...e}))}catch{}},k={dark:f('<path d="M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z"/>'),light:f('<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:f('<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"/>')},C={dark:"light",light:"system",system:"dark"};let E="dark";try{const e=localStorage.getItem(y);"light"!==e&&"system"!==e||(E=e)}catch{}const L=matchMedia("(prefers-color-scheme: light)"),O=()=>{const e="light"===E||"system"===E&&L.matches;t.host.classList.toggle("light",e),a.innerHTML=k[E],a.title="theme: "+E},S=new Set,_=(e,n,t)=>{const o=document.createElement(e);return o.className=n,null!=t&&(o.textContent=t),o},N=e=>{const n=_("span","label");return n.appendChild(_("span","punct","<")),n.appendChild(_("span","name",D(e))),n.appendChild(_("span","punct",">")),n},$=e=>{let t=0,o=e.parentElement;for(;o;)n.scopes.has(o)&&t++,o=o.parentElement;return t},j=e=>{let n;try{n=void 0===e?"undefined":JSON.stringify(e)??String(e)}catch(t){n=String(e)}return n.length>60?n.slice(0,60)+"\u2026":n},T=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"},I=e=>{e!==h&&S.clear(),u=null,h=e,x="Elements",window.$scope=e?n.scopes.get(e):void 0,V(),R()},P=e=>{e!==u&&S.clear(),h=null,u=e,x="Stores",window.$scope=n.stores.get(e),V(),R()},M=e=>{x=e,V()},D=e=>n.names.get(e)||e.id||e.tagName.toLowerCase(),V=()=>{if((()=>{const e=n.stores?n.stores.size:0;p.textContent=`Elements (${n.scopes.size})`,p.className="Elements"===x?"tab active":"tab",c.textContent=`Stores (${e})`,c.className="Stores"===x?"tab active":"tab"})(),i.textContent="","Elements"===x){const e=[...n.scopes.keys()].filter(e=>D(e).toLowerCase().includes(g)).sort((e,n)=>e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1);if(!e.length)return void i.appendChild(_("div","empty",g?"no matching scopes":"no scopes mounted"));for(const t of e){const e=_("div",t===h?"row sel":"row");e.style.paddingLeft=8+12*$(t)+"px",e.appendChild(N(t));const o=n.exps.get(t);o&&e.appendChild(_("span","exp"," "+o)),e.onclick=()=>I(t),e.onmouseenter=()=>T(t),e.onmouseleave=z,i.appendChild(e)}return}const e=[...n.stores?n.stores.keys():[]].filter(e=>e.toLowerCase().includes(g));if(e.length)for(const n of e){const e=_("div",n===u?"row sel":"row"),t=_("span","label");t.appendChild(_("span","punct","$store.")),t.appendChild(_("span","name",n)),e.appendChild(t),e.onclick=()=>P(n),i.appendChild(e)}else i.appendChild(_("div","empty",g?"no matching stores":"no stores registered"))},R=()=>{if(l.contains(t.activeElement))return;l.textContent="";const e=u?n.stores.get(u):h?n.scopes.get(h):void 0;if(!e)return void l.appendChild(_("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=>W(n,e,n,0,"prop",[])),r.length&&(l.appendChild(_("div","divider","inherited")),r.forEach(n=>W(n,e,n,0,"prop inherited",[]))),o.length||r.length||l.appendChild(_("div","empty","empty scope")),l.appendChild(H(e))},H=e=>{const n=_("div","prop adder");n.appendChild(_("span","spacer"));const t=_("input","val key-in");t.placeholder="key";const o=_("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(),X(),setTimeout(()=>{const e=l.querySelector(".adder .key-in");e&&e.focus()})})()},n.appendChild(t),n.appendChild(o),n},W=(e,n,t,o,r,i)=>{const d=n[e],a=_("div",r);if(a.style.paddingLeft=8+14*o+"px",null!==d&&"object"==typeof d){const s=i.indexOf(d)>-1,p=!s&&S.has(t);if(a.appendChild(_("span",p?"arrow open":"arrow","\u25b6")),a.appendChild(_("span","key",e)),a.appendChild(_("span","preview",s?"(circular)":(e=>Array.isArray(e)?`(${e.length}) ${j(e)}`:j(e))(d))),s||(a.classList.add("toggle"),a.onclick=()=>{p?S.delete(t):S.add(t),R()}),A(a,n,e,o,r),l.appendChild(a),p){const e=Object.keys(d);if(!e.length){const e=_("div","muted","(empty)");e.style.paddingLeft=22+14*(o+1)+"px",l.appendChild(e)}for(const n of e)W(n,d,t+"."+n,o+1,r,i.concat([d]))}return}a.appendChild(_("span","spacer")),a.appendChild(_("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(_("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(_("span","preview",j(d)));else if("boolean"==typeof d){a.appendChild(_("span","bool",String(d)));const t=_("input","check");t.type="checkbox",t.checked=d,t.onchange=()=>{n[e]=t.checked,t.blur(),X()},a.appendChild(t)}else{const t=_("input","val");t.value=j(d),t.onfocus=()=>{t.value="string"==typeof d?d:String(d)},t.onkeydown=e=>{"Enter"===e.key&&t.blur(),"Escape"===e.key&&(t.value=j(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,X()):t.value=j(d)},a.appendChild(t)}A(a,n,e,o,r),l.appendChild(a)},A=(e,n,o,r,i)=>{if(0!==r||"prop"!==i)return;const l=Object.getOwnPropertyDescriptor(n,o);if(l&&l.get)return;const d=_("button","del","\u2715");d.title=`delete "${o}"`,d.onclick=e=>{e.stopPropagation();const r=t.activeElement;r&&r.blur&&r.blur(),delete n[o],X()},e.appendChild(d)},B=e=>{const o=e.target;if(o===t.host)return;e.preventDefault(),e.stopPropagation(),J();let r=o;for(;r&&!n.scopes.has(r);)r=r.parentElement;r&&I(r)},F=e=>{let o=e.target;if(o!==t.host){for(;o&&!n.scopes.has(o);)o=o.parentElement;o?T(o):z()}},J=()=>{v=!1,d.classList.remove("active"),z(),document.removeEventListener("click",B,!0),document.removeEventListener("mousemove",F,!0)};let U=!1;const X=()=>{U||(U=!0,setTimeout(()=>{U=!1,"none"!==o.style.display&&(V(),R())}))},Y=()=>{const e=document.createElement("div");t=e.attachShadow({mode:"open"});const u=document.createElement("style");u.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: 640px;\n max-width: calc(100vw - 24px);\n height: 440px;\n max-height: calc(100vh - 24px);\n min-width: 320px;\n min-height: 200px;\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 6px;\n overflow: hidden;\n resize: both;\n box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);\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 padding: 2px 8px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\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}\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(u),s=_("div","highlight"),t.appendChild(s),r=_("div","pill","\u26a1 LiteVue"),r.onclick=()=>{r.style.display="none",o.style.display="flex",w({open:!0}),X()},t.appendChild(r),o=_("div","panel"),o.style.display="none";const x=_("div","header");x.appendChild(_("span","title","\u26a1 LiteVue")),x.addEventListener("mousedown",e=>{if(e.target.closest(".btn"))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=Math.max(0,t-(e.clientX-i))+"px",o.style.bottom=Math.max(0,r-(e.clientY-l))+"px"},a=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a),w({right:parseInt(o.style.right)||12,bottom:parseInt(o.style.bottom)||12})};document.addEventListener("mousemove",d),document.addEventListener("mouseup",a)}),a=_("button","btn"),a.onclick=()=>{E=C[E];try{localStorage.setItem(y,E)}catch{}O()},x.appendChild(a),L.addEventListener("change",()=>{"system"===E&&O()}),O(),d=_("button","btn"),d.title="pick an element on the page",d.innerHTML=f('<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=()=>v?J():(v=!0,d.classList.add("active"),document.addEventListener("click",B,!0),void document.addEventListener("mousemove",F,!0)),x.appendChild(d);const m=_("button","btn","\u2715");m.onclick=()=>{v&&J(),o.style.display="none",r.style.display="",w({open:!1})},x.appendChild(m),o.appendChild(x);const k=_("div","body"),S=_("div","side"),N=_("div","tabs");p=_("div","tab active"),p.onclick=()=>M("Elements"),c=_("div","tab"),c.onclick=()=>M("Stores"),N.appendChild(p),N.appendChild(c),S.appendChild(N);const $=_("input","filter");$.placeholder="Filter by name",$.oninput=()=>{g=$.value.trim().toLowerCase(),V()},$.onkeydown=e=>{"Escape"===e.key&&($.value="",g="",V())},S.appendChild($),i=_("div","tree"),S.appendChild(i),l=_("div","state"),k.appendChild(S),k.appendChild(l),o.appendChild(k),t.appendChild(o);const j=b();if(null!=j.right&&(o.style.right=j.right+"px"),null!=j.bottom&&(o.style.bottom=j.bottom+"px"),j.w&&(o.style.width=j.w+"px"),j.h&&(o.style.height=j.h+"px"),j.open&&(r.style.display="none",o.style.display="flex",X()),"undefined"!=typeof ResizeObserver){let e;new ResizeObserver(()=>{clearTimeout(e),e=setTimeout(()=>{"none"!==o.style.display&&o.offsetWidth&&w({w:o.offsetWidth,h:o.offsetHeight})},300)}).observe(o)}document.body.appendChild(e),n.on("scope:mount",X),n.on("scope:unmount",e=>{e===h&&(h=null),X()}),n.stores&&n.on("store:register",X),n.on("flush",X)},q=()=>{const e=window.__LITE_VUE__;e?(n=e,document.body?Y():addEventListener("DOMContentLoaded",Y)):console.warn("[LiteVue devtools] window.__LITE_VUE__ not found \u2014 load LiteVue before the devtools panel script.")};return q(),e.init=q,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
@@ -397,6 +397,18 @@ const coerce = (raw, old) => {
397
397
  }
398
398
  return raw;
399
399
  };
400
+ const descriptorOf = (o, key) => {
401
+ for (let t = o; t && t !== Object.prototype; t = Object.getPrototypeOf(t)) {
402
+ const d = Object.getOwnPropertyDescriptor(t, key);
403
+ if (d) return d;
404
+ }
405
+ };
406
+ const isReadOnly = (desc) => {
407
+ if (!desc) return false;
408
+ if (desc.get && !desc.set) return true;
409
+ const raw = desc.value;
410
+ return !!raw && raw.__v_isRef === true && raw.__v_isReadonly === true;
411
+ };
400
412
  const collectProps = (scope) => {
401
413
  const isData = (o, k) => k[0] !== "$" && typeof o[k] !== "function";
402
414
  const own = Object.keys(scope).filter((k) => isData(scope, k));
@@ -591,10 +603,10 @@ const addNode = (key, container, path, depth, cls, ancestors) => {
591
603
  }
592
604
  row.appendChild(h("span", "spacer"));
593
605
  row.appendChild(h("span", "key", key));
594
- const desc = Object.getOwnPropertyDescriptor(container, key);
606
+ const desc = descriptorOf(container, key);
595
607
  if (typeof v === "function") {
596
608
  row.appendChild(h("span", "preview", "ƒ"));
597
- } else if (desc && desc.get && !desc.set) {
609
+ } else if (isReadOnly(desc)) {
598
610
  row.appendChild(h("span", "preview", fmt(v)));
599
611
  } else if (typeof v === "boolean") {
600
612
  row.appendChild(h("span", "bool", String(v)));
@@ -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){"use strict";let n,t,o,r,i,l,d,a,s,p,c,h=null,u=null,v=!1,x="",g="Elements";const f=e=>'<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">'+e+"</svg>",y="litevue-devtools-theme",m="litevue-devtools-ui",b=()=>{try{return JSON.parse(localStorage.getItem(m)||"{}")}catch{return{}}},w=e=>{try{localStorage.setItem(m,JSON.stringify({...b(),...e}))}catch{}},k={dark:f('<path d="M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z"/>'),light:f('<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:f('<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"/>')},C={dark:"light",light:"system",system:"dark"};let E="dark";try{const e=localStorage.getItem(y);"light"!==e&&"system"!==e||(E=e)}catch{}const L=matchMedia("(prefers-color-scheme: light)"),O=()=>{const e="light"===E||"system"===E&&L.matches;t.host.classList.toggle("light",e),a.innerHTML=k[E],a.title="theme: "+E},S=new Set,N=(e,n,t)=>{const o=document.createElement(e);return o.className=n,null!=t&&(o.textContent=t),o},T=e=>{const n=N("span","label");return n.appendChild(N("span","punct","<")),n.appendChild(N("span","name",D(e))),n.appendChild(N("span","punct",">")),n},$=e=>{let t=0,o=e.parentElement;for(;o;)n.scopes.has(o)&&t++,o=o.parentElement;return t},_=e=>{let n;try{n=void 0===e?"undefined":JSON.stringify(e)??String(e)}catch(t){n=String(e)}return n.length>60?n.slice(0,60)+"\u2026":n},j=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"},I=e=>{e!==h&&S.clear(),u=null,h=e,g="Elements",window.$scope=e?n.scopes.get(e):void 0,V(),H()},M=e=>{e!==u&&S.clear(),h=null,u=e,g="Stores",window.$scope=n.stores.get(e),V(),H()},P=e=>{g=e,V()},D=e=>n.names.get(e)||e.id||e.tagName.toLowerCase(),V=()=>{if((()=>{const e=n.stores?n.stores.size:0;p.textContent=`Elements (${n.scopes.size})`,p.className="Elements"===g?"tab active":"tab",c.textContent=`Stores (${e})`,c.className="Stores"===g?"tab active":"tab"})(),i.textContent="","Elements"===g){const e=[...n.scopes.keys()].filter(e=>D(e).toLowerCase().includes(x)).sort((e,n)=>e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1);if(!e.length)return void i.appendChild(N("div","empty",x?"no matching scopes":"no scopes mounted"));for(const t of e){const e=N("div",t===h?"row sel":"row");e.style.paddingLeft=8+12*$(t)+"px",e.appendChild(T(t));const o=n.exps.get(t);o&&e.appendChild(N("span","exp"," "+o)),e.onclick=()=>I(t),e.onmouseenter=()=>j(t),e.onmouseleave=z,i.appendChild(e)}return}const e=[...n.stores?n.stores.keys():[]].filter(e=>e.toLowerCase().includes(x));if(e.length)for(const n of e){const e=N("div",n===u?"row sel":"row"),t=N("span","label");t.appendChild(N("span","punct","$store.")),t.appendChild(N("span","name",n)),e.appendChild(t),e.onclick=()=>M(n),i.appendChild(e)}else i.appendChild(N("div","empty",x?"no matching stores":"no stores registered"))},H=()=>{if(l.contains(t.activeElement))return;l.textContent="";const e=u?n.stores.get(u):h?n.scopes.get(h):void 0;if(!e)return void l.appendChild(N("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=>W(n,e,n,0,"prop",[])),r.length&&(l.appendChild(N("div","divider","inherited")),r.forEach(n=>W(n,e,n,0,"prop inherited",[]))),o.length||r.length||l.appendChild(N("div","empty","empty scope")),l.appendChild(R(e))},R=e=>{const n=N("div","prop adder");n.appendChild(N("span","spacer"));const t=N("input","val key-in");t.placeholder="key";const o=N("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(),X(),setTimeout(()=>{const e=l.querySelector(".adder .key-in");e&&e.focus()})})()},n.appendChild(t),n.appendChild(o),n},W=(e,n,t,o,r,i)=>{const d=n[e],a=N("div",r);if(a.style.paddingLeft=8+14*o+"px",null!==d&&"object"==typeof d){const s=i.indexOf(d)>-1,p=!s&&S.has(t);if(a.appendChild(N("span",p?"arrow open":"arrow","\u25b6")),a.appendChild(N("span","key",e)),a.appendChild(N("span","preview",s?"(circular)":(e=>Array.isArray(e)?`(${e.length}) ${_(e)}`:_(e))(d))),s||(a.classList.add("toggle"),a.onclick=()=>{p?S.delete(t):S.add(t),H()}),A(a,n,e,o,r),l.appendChild(a),p){const e=Object.keys(d);if(!e.length){const e=N("div","muted","(empty)");e.style.paddingLeft=22+14*(o+1)+"px",l.appendChild(e)}for(const n of e)W(n,d,t+"."+n,o+1,r,i.concat([d]))}return}a.appendChild(N("span","spacer")),a.appendChild(N("span","key",e));const s=Object.getOwnPropertyDescriptor(n,e);if("function"==typeof d)a.appendChild(N("span","preview","\u0192"));else if(s&&s.get&&!s.set)a.appendChild(N("span","preview",_(d)));else if("boolean"==typeof d){a.appendChild(N("span","bool",String(d)));const t=N("input","check");t.type="checkbox",t.checked=d,t.onchange=()=>{n[e]=t.checked,t.blur(),X()},a.appendChild(t)}else{const t=N("input","val");t.value=_(d),t.onfocus=()=>{t.value="string"==typeof d?d:String(d)},t.onkeydown=e=>{"Enter"===e.key&&t.blur(),"Escape"===e.key&&(t.value=_(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,X()):t.value=_(d)},a.appendChild(t)}A(a,n,e,o,r),l.appendChild(a)},A=(e,n,o,r,i)=>{if(0!==r||"prop"!==i)return;const l=Object.getOwnPropertyDescriptor(n,o);if(l&&l.get)return;const d=N("button","del","\u2715");d.title=`delete "${o}"`,d.onclick=e=>{e.stopPropagation();const r=t.activeElement;r&&r.blur&&r.blur(),delete n[o],X()},e.appendChild(d)},B=e=>{const o=e.target;if(o===t.host)return;e.preventDefault(),e.stopPropagation(),J();let r=o;for(;r&&!n.scopes.has(r);)r=r.parentElement;r&&I(r)},F=e=>{let o=e.target;if(o!==t.host){for(;o&&!n.scopes.has(o);)o=o.parentElement;o?j(o):z()}},J=()=>{v=!1,d.classList.remove("active"),z(),document.removeEventListener("click",B,!0),document.removeEventListener("mousemove",F,!0)};let U=!1;const X=()=>{U||(U=!0,setTimeout(()=>{U=!1,"none"!==o.style.display&&(V(),H())}))},Y=()=>{const e=document.createElement("div");t=e.attachShadow({mode:"open"});const u=document.createElement("style");u.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: 640px;\n max-width: calc(100vw - 24px);\n height: 440px;\n max-height: calc(100vh - 24px);\n min-width: 320px;\n min-height: 200px;\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 6px;\n overflow: hidden;\n resize: both;\n box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);\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 padding: 2px 8px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\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}\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(u),s=N("div","highlight"),t.appendChild(s),r=N("div","pill","\u26a1 LiteVue"),r.onclick=()=>{r.style.display="none",o.style.display="flex",w({open:!0}),X()},t.appendChild(r),o=N("div","panel"),o.style.display="none";const g=N("div","header");g.appendChild(N("span","title","\u26a1 LiteVue")),g.addEventListener("mousedown",e=>{if(e.target.closest(".btn"))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=Math.max(0,t-(e.clientX-i))+"px",o.style.bottom=Math.max(0,r-(e.clientY-l))+"px"},a=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a),w({right:parseInt(o.style.right)||12,bottom:parseInt(o.style.bottom)||12})};document.addEventListener("mousemove",d),document.addEventListener("mouseup",a)}),a=N("button","btn"),a.onclick=()=>{E=C[E];try{localStorage.setItem(y,E)}catch{}O()},g.appendChild(a),L.addEventListener("change",()=>{"system"===E&&O()}),O(),d=N("button","btn"),d.title="pick an element on the page",d.innerHTML=f('<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=()=>v?J():(v=!0,d.classList.add("active"),document.addEventListener("click",B,!0),void document.addEventListener("mousemove",F,!0)),g.appendChild(d);const m=N("button","btn","\u2715");m.onclick=()=>{v&&J(),o.style.display="none",r.style.display="",w({open:!1})},g.appendChild(m),o.appendChild(g);const k=N("div","body"),S=N("div","side"),T=N("div","tabs");p=N("div","tab active"),p.onclick=()=>P("Elements"),c=N("div","tab"),c.onclick=()=>P("Stores"),T.appendChild(p),T.appendChild(c),S.appendChild(T);const $=N("input","filter");$.placeholder="Filter by name",$.oninput=()=>{x=$.value.trim().toLowerCase(),V()},$.onkeydown=e=>{"Escape"===e.key&&($.value="",x="",V())},S.appendChild($),i=N("div","tree"),S.appendChild(i),l=N("div","state"),k.appendChild(S),k.appendChild(l),o.appendChild(k),t.appendChild(o);const _=b();if(null!=_.right&&(o.style.right=_.right+"px"),null!=_.bottom&&(o.style.bottom=_.bottom+"px"),_.w&&(o.style.width=_.w+"px"),_.h&&(o.style.height=_.h+"px"),_.open&&(r.style.display="none",o.style.display="flex",X()),"undefined"!=typeof ResizeObserver){let e;new ResizeObserver(()=>{clearTimeout(e),e=setTimeout(()=>{"none"!==o.style.display&&o.offsetWidth&&w({w:o.offsetWidth,h:o.offsetHeight})},300)}).observe(o)}document.body.appendChild(e),n.on("scope:mount",X),n.on("scope:unmount",e=>{e===h&&(h=null),X()}),n.stores&&n.on("store:register",X),n.on("flush",X)},q=()=>{const e=window.__LITE_VUE__;e?(n=e,document.body?Y():addEventListener("DOMContentLoaded",Y)):console.warn("[LiteVue devtools] window.__LITE_VUE__ not found \u2014 load LiteVue before the devtools panel script.")};q(),e.init=q,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
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){"use strict";let n,t,o,r,i,l,d,a,s,p,c,h=null,u=null,v=!1,f="",x="Elements";const g=e=>'<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">'+e+"</svg>",y="litevue-devtools-theme",b="litevue-devtools-ui",m=()=>{try{return JSON.parse(localStorage.getItem(b)||"{}")}catch{return{}}},w=e=>{try{localStorage.setItem(b,JSON.stringify({...m(),...e}))}catch{}},k={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"/>')},C={dark:"light",light:"system",system:"dark"};let E="dark";try{const e=localStorage.getItem(y);"light"!==e&&"system"!==e||(E=e)}catch{}const L=matchMedia("(prefers-color-scheme: light)"),O=()=>{const e="light"===E||"system"===E&&L.matches;t.host.classList.toggle("light",e),a.innerHTML=k[E],a.title="theme: "+E},S=new Set,_=(e,n,t)=>{const o=document.createElement(e);return o.className=n,null!=t&&(o.textContent=t),o},N=e=>{const n=_("span","label");return n.appendChild(_("span","punct","<")),n.appendChild(_("span","name",D(e))),n.appendChild(_("span","punct",">")),n},T=e=>{let t=0,o=e.parentElement;for(;o;)n.scopes.has(o)&&t++,o=o.parentElement;return t},j=e=>{let n;try{n=void 0===e?"undefined":JSON.stringify(e)??String(e)}catch(t){n=String(e)}return n.length>60?n.slice(0,60)+"\u2026":n},$=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"},I=e=>{e!==h&&S.clear(),u=null,h=e,x="Elements",window.$scope=e?n.scopes.get(e):void 0,V(),R()},P=e=>{e!==u&&S.clear(),h=null,u=e,x="Stores",window.$scope=n.stores.get(e),V(),R()},M=e=>{x=e,V()},D=e=>n.names.get(e)||e.id||e.tagName.toLowerCase(),V=()=>{if((()=>{const e=n.stores?n.stores.size:0;p.textContent=`Elements (${n.scopes.size})`,p.className="Elements"===x?"tab active":"tab",c.textContent=`Stores (${e})`,c.className="Stores"===x?"tab active":"tab"})(),i.textContent="","Elements"===x){const e=[...n.scopes.keys()].filter(e=>D(e).toLowerCase().includes(f)).sort((e,n)=>e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1);if(!e.length)return void i.appendChild(_("div","empty",f?"no matching scopes":"no scopes mounted"));for(const t of e){const e=_("div",t===h?"row sel":"row");e.style.paddingLeft=8+12*T(t)+"px",e.appendChild(N(t));const o=n.exps.get(t);o&&e.appendChild(_("span","exp"," "+o)),e.onclick=()=>I(t),e.onmouseenter=()=>$(t),e.onmouseleave=z,i.appendChild(e)}return}const e=[...n.stores?n.stores.keys():[]].filter(e=>e.toLowerCase().includes(f));if(e.length)for(const n of e){const e=_("div",n===u?"row sel":"row"),t=_("span","label");t.appendChild(_("span","punct","$store.")),t.appendChild(_("span","name",n)),e.appendChild(t),e.onclick=()=>P(n),i.appendChild(e)}else i.appendChild(_("div","empty",f?"no matching stores":"no stores registered"))},R=()=>{if(l.contains(t.activeElement))return;l.textContent="";const e=u?n.stores.get(u):h?n.scopes.get(h):void 0;if(!e)return void l.appendChild(_("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=>W(n,e,n,0,"prop",[])),r.length&&(l.appendChild(_("div","divider","inherited")),r.forEach(n=>W(n,e,n,0,"prop inherited",[]))),o.length||r.length||l.appendChild(_("div","empty","empty scope")),l.appendChild(H(e))},H=e=>{const n=_("div","prop adder");n.appendChild(_("span","spacer"));const t=_("input","val key-in");t.placeholder="key";const o=_("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(),X(),setTimeout(()=>{const e=l.querySelector(".adder .key-in");e&&e.focus()})})()},n.appendChild(t),n.appendChild(o),n},W=(e,n,t,o,r,i)=>{const d=n[e],a=_("div",r);if(a.style.paddingLeft=8+14*o+"px",null!==d&&"object"==typeof d){const s=i.indexOf(d)>-1,p=!s&&S.has(t);if(a.appendChild(_("span",p?"arrow open":"arrow","\u25b6")),a.appendChild(_("span","key",e)),a.appendChild(_("span","preview",s?"(circular)":(e=>Array.isArray(e)?`(${e.length}) ${j(e)}`:j(e))(d))),s||(a.classList.add("toggle"),a.onclick=()=>{p?S.delete(t):S.add(t),R()}),A(a,n,e,o,r),l.appendChild(a),p){const e=Object.keys(d);if(!e.length){const e=_("div","muted","(empty)");e.style.paddingLeft=22+14*(o+1)+"px",l.appendChild(e)}for(const n of e)W(n,d,t+"."+n,o+1,r,i.concat([d]))}return}a.appendChild(_("span","spacer")),a.appendChild(_("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(_("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(_("span","preview",j(d)));else if("boolean"==typeof d){a.appendChild(_("span","bool",String(d)));const t=_("input","check");t.type="checkbox",t.checked=d,t.onchange=()=>{n[e]=t.checked,t.blur(),X()},a.appendChild(t)}else{const t=_("input","val");t.value=j(d),t.onfocus=()=>{t.value="string"==typeof d?d:String(d)},t.onkeydown=e=>{"Enter"===e.key&&t.blur(),"Escape"===e.key&&(t.value=j(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,X()):t.value=j(d)},a.appendChild(t)}A(a,n,e,o,r),l.appendChild(a)},A=(e,n,o,r,i)=>{if(0!==r||"prop"!==i)return;const l=Object.getOwnPropertyDescriptor(n,o);if(l&&l.get)return;const d=_("button","del","\u2715");d.title=`delete "${o}"`,d.onclick=e=>{e.stopPropagation();const r=t.activeElement;r&&r.blur&&r.blur(),delete n[o],X()},e.appendChild(d)},B=e=>{const o=e.target;if(o===t.host)return;e.preventDefault(),e.stopPropagation(),J();let r=o;for(;r&&!n.scopes.has(r);)r=r.parentElement;r&&I(r)},F=e=>{let o=e.target;if(o!==t.host){for(;o&&!n.scopes.has(o);)o=o.parentElement;o?$(o):z()}},J=()=>{v=!1,d.classList.remove("active"),z(),document.removeEventListener("click",B,!0),document.removeEventListener("mousemove",F,!0)};let U=!1;const X=()=>{U||(U=!0,setTimeout(()=>{U=!1,"none"!==o.style.display&&(V(),R())}))},Y=()=>{const e=document.createElement("div");t=e.attachShadow({mode:"open"});const u=document.createElement("style");u.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: 640px;\n max-width: calc(100vw - 24px);\n height: 440px;\n max-height: calc(100vh - 24px);\n min-width: 320px;\n min-height: 200px;\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 6px;\n overflow: hidden;\n resize: both;\n box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);\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 padding: 2px 8px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\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}\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(u),s=_("div","highlight"),t.appendChild(s),r=_("div","pill","\u26a1 LiteVue"),r.onclick=()=>{r.style.display="none",o.style.display="flex",w({open:!0}),X()},t.appendChild(r),o=_("div","panel"),o.style.display="none";const x=_("div","header");x.appendChild(_("span","title","\u26a1 LiteVue")),x.addEventListener("mousedown",e=>{if(e.target.closest(".btn"))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=Math.max(0,t-(e.clientX-i))+"px",o.style.bottom=Math.max(0,r-(e.clientY-l))+"px"},a=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a),w({right:parseInt(o.style.right)||12,bottom:parseInt(o.style.bottom)||12})};document.addEventListener("mousemove",d),document.addEventListener("mouseup",a)}),a=_("button","btn"),a.onclick=()=>{E=C[E];try{localStorage.setItem(y,E)}catch{}O()},x.appendChild(a),L.addEventListener("change",()=>{"system"===E&&O()}),O(),d=_("button","btn"),d.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=()=>v?J():(v=!0,d.classList.add("active"),document.addEventListener("click",B,!0),void document.addEventListener("mousemove",F,!0)),x.appendChild(d);const b=_("button","btn","\u2715");b.onclick=()=>{v&&J(),o.style.display="none",r.style.display="",w({open:!1})},x.appendChild(b),o.appendChild(x);const k=_("div","body"),S=_("div","side"),N=_("div","tabs");p=_("div","tab active"),p.onclick=()=>M("Elements"),c=_("div","tab"),c.onclick=()=>M("Stores"),N.appendChild(p),N.appendChild(c),S.appendChild(N);const T=_("input","filter");T.placeholder="Filter by name",T.oninput=()=>{f=T.value.trim().toLowerCase(),V()},T.onkeydown=e=>{"Escape"===e.key&&(T.value="",f="",V())},S.appendChild(T),i=_("div","tree"),S.appendChild(i),l=_("div","state"),k.appendChild(S),k.appendChild(l),o.appendChild(k),t.appendChild(o);const j=m();if(null!=j.right&&(o.style.right=j.right+"px"),null!=j.bottom&&(o.style.bottom=j.bottom+"px"),j.w&&(o.style.width=j.w+"px"),j.h&&(o.style.height=j.h+"px"),j.open&&(r.style.display="none",o.style.display="flex",X()),"undefined"!=typeof ResizeObserver){let e;new ResizeObserver(()=>{clearTimeout(e),e=setTimeout(()=>{"none"!==o.style.display&&o.offsetWidth&&w({w:o.offsetWidth,h:o.offsetHeight})},300)}).observe(o)}document.body.appendChild(e),n.on("scope:mount",X),n.on("scope:unmount",e=>{e===h&&(h=null),X()}),n.stores&&n.on("store:register",X),n.on("flush",X)},q=()=>{const e=window.__LITE_VUE__;e?(n=e,document.body?Y():addEventListener("DOMContentLoaded",Y)):console.warn("[LiteVue devtools] window.__LITE_VUE__ not found \u2014 load LiteVue before the devtools panel script.")};q(),e.init=q,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
@@ -1 +1 @@
1
- var LiteVuePlugins=function(e,t){"use strict";const s={9:/\d/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},n=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),r=(e,t)=>{const s=e.split(","),r=t.split(",");let o=0;for(let i=0;i<s.length;i++)o=Math.max(o,n(s[i])+n(r[i%r.length]));return o},o="litevue:",i=Object.create(null);let l="local";const c=e=>{const t=e??l;return"string"!=typeof t?t:i[t]??(e=>{try{if("local"===e||"localStorage"===e)return localStorage;if("session"===e||"sessionStorage"===e)return sessionStorage}catch{}})(t)},a=(e,t,s,n,r)=>{if(!n)return r(()=>{});const o=((e,t)=>(t??Object.keys(e)).filter(t=>{if("$"===t[0])return!1;const s=Object.getOwnPropertyDescriptor(e,t);return!(s&&s.get&&!s.set)&&"function"!=typeof e[t]}))(e,s);try{const s=JSON.parse(n.getItem(t)||"null");if(s)for(const t of o)t in s&&(e[t]=s[t])}catch{}return r(()=>{const s={};for(const t of o)s[t]=e[t];try{n.setItem(t,JSON.stringify(s))}catch{}})};return e.collapse=e=>{e.directive("collapse",({el:e,get:t,effect:s,modifiers:n})=>{const r=e;let o=250;for(const c in n||{}){const e=/^duration-(\d+)$/.exec(c);e&&(o=+e[1])}r.style.overflow="hidden";let i=!0,l=0;s(()=>{const e=!!t(),s=++l;if(i)return i=!1,e||(r.style.height="0px"),void setTimeout(()=>{r.style.transition=`height ${o}ms ease`});e?(r.style.height=r.scrollHeight+"px",setTimeout(()=>{s===l&&(r.style.height="")},o)):(r.style.height=r.scrollHeight+"px",r.offsetHeight,r.style.height="0px")})})},e.focus=e=>{e.directive("focus",({el:e,get:t,effect:s,modifiers:n})=>{s(()=>{const s=!!t();Promise.resolve().then(()=>{s&&(e.focus(),n?.select&&e.select&&e.select())})})}),e.directive("trap",({el:e,get:t,effect:s})=>{let n=!1,r=null;const o=()=>[...e.querySelectorAll('a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])')].filter(e=>!e.hasAttribute("disabled")),i=t=>{if("Tab"!==t.key)return;const s=o();if(!s.length)return void t.preventDefault();const n=s[0],r=s[s.length-1],i=document.activeElement;e.contains(i)?t.shiftKey&&i===n?(t.preventDefault(),r.focus()):t.shiftKey||i!==r||(t.preventDefault(),n.focus()):(t.preventDefault(),n.focus())},l=()=>{n=!1,document.removeEventListener("keydown",i,!0),r&&r.focus&&r.focus()};return s(()=>{const s=!!t();s&&!n?(n=!0,r=document.activeElement,document.addEventListener("keydown",i,!0),Promise.resolve().then(()=>{n&&(o()[0]||e).focus()})):!s&&n&&l()}),()=>{n&&l()}})},e.intersect=e=>{e.directive("intersect",({el:e,get:t,modifiers:s})=>{const n=new IntersectionObserver(e=>{for(const r of e){(s?.leave?!r.isIntersecting:r.isIntersecting)&&(t(),s?.once&&n.disconnect())}},{threshold:s?.full?1:0});return n.observe(e),()=>n.disconnect()})},e.mask=e=>{e.directive("mask",({el:e,exp:t})=>{const n=e,r=()=>{const e=((e,t)=>{let n="",r="",o=0;for(let i=0;i<t.length;i++){const l=s[t[i]];if(l){for(;o<e.length&&!l.test(e[o]);)o++;if(o>=e.length)break;n+=r+e[o++],r=""}else r+=t[i],e[o]===t[i]&&o++}return n})(n.value,t);e!==n.value&&(n.value=e)};return e.addEventListener("input",r),r(),()=>e.removeEventListener("input",r)})},e.persist=e=>{e.directive("persist",({ctx:e,el:t,exp:s,arg:n,modifiers:r,effect:i})=>{const l=o+(s||t.id);let f;for(const o in r||{})if(c(o)){f=o;break}const u=n?n.split(",").map(e=>e.trim()).filter(Boolean):void 0;a(e.scope,l,u,c(f),i)})},e.persistStore=(e,s={})=>{const n=t.store(e);if(!n)return()=>{};const r=c(s.storage);return a(n,o+(s.key??e),s.keys,r,t.watchEffect)},e.registerStorage=(e,t)=>{i[e]=t},e.setDefaultStorage=e=>{l=e},e.transition=e=>{e.directive("transition",({el:e,get:t,effect:s,arg:n,modifiers:o,exp:i})=>{const l=e,c=n||"v",a=e=>`${c}-${e}`;let f=0,u=!0;const d=()=>{l.classList.remove(a("enter-from"),a("enter-active"),a("enter-to"),a("leave-from"),a("leave-active"),a("leave-to"))},v=(e,t)=>{const s=++f;d(),l.classList.add(a(e+"-from"),a(e+"-active")),l.offsetWidth,l.classList.remove(a(e+"-from")),l.classList.add(a(e+"-to")),setTimeout(()=>{s===f&&(d(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(r(t.transitionDuration,t.transitionDelay),r(t.animationDuration,t.animationDelay))})(l))};if(!i)return Promise.resolve().then(()=>v("enter")),l.__leave=()=>new Promise(e=>v("leave",e)),()=>{delete l.__leave};s(()=>{const e=!!t();if(u)return u=!1,l.style.display=e?"":"none",void(e&&o?.appear&&v("enter"));e?(l.style.display="",v("enter")):v("leave",()=>{l.style.display="none"})})})},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({},LiteVue);
1
+ var LiteVuePlugins=function(e,t){"use strict";const 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);let c="local";const l=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)},a=(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=/^(?:v-|:|@)/,u=/^(?::|v-bind:)/,d=["id","data-key","data-id"],m=e=>{for(const t of d){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},p=e=>{for(let t=e;t;t=t.parentElement)if(t.__ctx)return t.__ctx},h=e=>e.hasAttribute("v-for")||e.hasAttribute("v-if")||e.hasAttribute("v-else")||e.hasAttribute("v-else-if"),v=(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"));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(r)||t.hasAttribute(r)||e.removeAttribute(r)},b=(e,t,n,r)=>{if(e.nodeType!==t.nodeType)return g(e,t,n);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 g(e,t,n);r.skip?.(o,i)||o.hasAttribute("data-morph-skip")||(v(o,i),(e=>{if(e.hasAttribute("v-text")||e.hasAttribute("v-html")||e.hasAttribute("v-pre")||e.hasAttribute("v-once")||h(e))return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(h(t))return!0;return!1})(i)||k(o,i,o.__ctx||n,r))},g=(e,t,n)=>{const r=t.cloneNode(!0);e.parentNode.replaceChild(r,e),y(r,n)},y=(e,t)=>{const n=t||p(e.parentNode);n?.walk?.(e,n)},k=(e,t,n,r)=>{const o=r.key||m,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,l=t.firstChild;const a=t=>{const r=t.cloneNode(!0);e.insertBefore(r,c),y(r,n)};for(;l;){const t=l.nextSibling,o=s(l);if(null!=o){const t=i.get(o);t?(t===c?c=c.nextSibling:e.insertBefore(t,c),i.delete(o),b(t,l,n,r)):a(l)}else if(c&&null==s(c)){const e=c.nextSibling;b(c,l,n,r),c=e}else a(l);l=t}for(;c;){const t=c.nextSibling;e.removeChild(c),c=t}},x=(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=w();b(e,r,p(e),n),t()}return e},w=()=>{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{}}},S={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},E=Object.freeze({...S}),O={mobile:"base",tablet:"md",desktop:"lg"},A=/^\d+$/,L=t.reactive({bp:"base",tick:0});let $={...S},_=["base"],j=!1,T=[];const q=new Map,P=()=>"undefined"!=typeof window&&"function"==typeof window.matchMedia,C=(e,t)=>e.addEventListener?(e.addEventListener("change",t),{mql:e,off:()=>e.removeEventListener("change",t)}):(e.addListener(t),{mql:e,off:()=>e.removeListener(t)}),D=()=>{for(let e=T.length-1;e>=0;e--)if(T[e].mql.matches)return _[e+1];return"base"},M=()=>{T.forEach(e=>e.off()),T=[];const e=Object.keys($).filter(e=>$[e]>0).sort((e,t)=>$[e]-$[t]);_=["base",...e],P()&&(T=e.map(e=>{const t=window.matchMedia(`(min-width: ${$[e]}px)`);return C(t,()=>{L.bp=D()})}),L.bp=D())},N=()=>{j||(j=!0,M()),L.tick},z=e=>{if(!P())return!1;let t=q.get(e);if(!t){const n=window.matchMedia(e);t=C(n,()=>L.tick++),q.set(e,t)}return t.mql.matches},I=e=>{if("number"==typeof e)return e;if("base"===e)return 0;if(A.test(e))return Number(e);const t=O[e];return void 0!==t?"base"===t?0:$[t]:$[e]},B=e=>{if(e<=0)return!0;const t=_.findIndex(t=>"base"!==t&&$[t]===e);return-1!==t?_.indexOf(L.bp)>=t:(L.tick,z(`(min-width: ${e}px)`))},R=new Set,H=e=>{},J=(e,t)=>{let n;N();let r=-1;for(const o of Object.keys(e)){const t=I(o);void 0!==t?t>=r&&B(t)&&(r=t,n=e[o]):H((_.join(", "),Object.keys(O).join(", ")))}return void 0!==n?n:t},K=e=>{const t=O[e],n=$[t];return void 0!==n?n:S[t]},V=Object.defineProperties((e,t)=>J(e,t),{props:{value:e=>{N();const t={};for(const n of Object.keys(e))t[n]=J(e[n]);return t}},breakpoint:{get:()=>(N(),L.bp),enumerable:!0},device:{get:()=>(N(),B(K("tablet"))?B(K("desktop"))?"desktop":"tablet":"mobile"),enumerable:!0},atLeast:{value:e=>{N();const t=I(e);return void 0!==t&&B(t)}},match:{value:e=>(N(),z(e))},configure:{value:({breakpoints:e})=>{e&&($={...e},j&&(M(),L.tick++))}}});return e.collapse=e=>{e.directive("collapse",({el:e,get:t,effect:n,modifiers:r})=>{const o=e;let i=250;for(const f in r||{}){const e=/^duration-(\d+)$/.exec(f);e&&(i=+e[1])}o.style.overflow="hidden";let s=!0,c=0;const l=new Set,a=(e,t)=>{const n=setTimeout(()=>{l.delete(n),e()},t);l.add(n)};return n(()=>{const e=!!t(),n=++c;if(s)return s=!1,e||(o.style.height="0px"),void a(()=>{o.style.transition=`height ${i}ms ease`});e?(o.style.height=o.scrollHeight+"px",a(()=>{n===c&&(o.style.height="")},i)):(o.style.height=o.scrollHeight+"px",o.offsetHeight,o.style.height="0px")}),()=>l.forEach(clearTimeout)})},e.defaultBreakpoints=E,e.focus=e=>{e.directive("focus",({el:e,get:t,effect:n,modifiers:r})=>{n(()=>{const n=!!t();Promise.resolve().then(()=>{n&&(e.focus(),r?.select&&e.select&&e.select())})})}),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&&V.configure(t),e.scope.$mq=V,e.scope.$mqProps=V.props,e.scope.$mqAtLeast=V.atLeast,e.scope.$mqMatch=V.match,Object.defineProperty(e.scope,"$mqBreakpoint",{get:()=>V.breakpoint,enumerable:!0,configurable:!0}),Object.defineProperty(e.scope,"$mqDevice",{get:()=>V.device,enumerable:!0,configurable:!0})},e.morph=x,e.morphPlugin=e=>{e.scope.$morph=x},e.mq=V,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(l(i)){f=i;break}const u=r?r.split(",").map(e=>e.trim()).filter(Boolean):void 0;a(e.scope,c,u,l(f),s)})},e.persistStore=(e,n={})=>{const r=t.store(e);if(!r)return()=>{};const o=l(n.storage);return a(r,i+(n.key??e),n.keys,o,t.watchEffect)},e.registerStorage=(e,t)=>{s[e]=t},e.resetMedia=()=>{T.forEach(e=>e.off()),q.forEach(e=>e.off()),T=[],q.clear(),$={...S},_=["base",...Object.keys($).sort((e,t)=>$[e]-$[t])],j=!1,R.clear(),L.bp="base",L.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,l=r||"v",a=e=>`${l}-${e}`;let f=0,u=!0;const d=()=>{c.classList.remove(a("enter-from"),a("enter-active"),a("enter-to"),a("leave-from"),a("leave-active"),a("leave-to"))},m=(e,t)=>{const n=++f;d(),c.classList.add(a(e+"-from"),a(e+"-active")),c.offsetWidth,c.classList.remove(a(e+"-from")),c.classList.add(a(e+"-to")),setTimeout(()=>{n===f&&(d(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(o(t.transitionDuration,t.transitionDelay),o(t.animationDuration,t.animationDelay))})(c))};if(!s)return Promise.resolve().then(()=>m("enter")),c.__leave=()=>new Promise(e=>m("leave",e)),()=>{delete c.__leave};n(()=>{const e=!!t();if(u)return u=!1,c.style.display=e?"":"none",void(e&&i?.appear&&m("enter"));e?(c.style.display="",m("enter")):m("leave",()=>{c.style.display="none"})})})},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({},LiteVue);