@aevantec/litevue 0.5.6 → 0.5.8
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 +9 -6
- 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 +898 -0
- package/dist/litevue-plugins.dev.mjs +880 -0
- 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 +2193 -0
- package/dist/litevue.dev.mjs +2182 -0
- package/dist/litevue.iife.js +1 -1
- package/dist/litevue.mjs +1 -1
- package/dist/litevue.umd.js +1 -1
- package/dist/plugins/collapse.iife.js +1 -1
- package/dist/plugins/collapse.mjs +1 -1
- package/dist/plugins/collapse.umd.js +1 -1
- package/dist/plugins/media.dev.iife.js +249 -0
- package/dist/plugins/media.dev.mjs +243 -0
- package/dist/plugins/morph.dev.iife.js +217 -0
- package/dist/plugins/morph.dev.mjs +212 -0
- package/dist/plugins/persist.dev.iife.js +126 -0
- package/dist/plugins/persist.dev.mjs +120 -0
- package/dist/types/app.d.mts +7 -0
- package/dist/types/app.d.ts +7 -0
- package/dist/types/directives/bind.d.mts +1 -1
- package/dist/types/directives/bind.d.ts +1 -1
- package/dist/types/errors.d.mts +36 -0
- package/dist/types/errors.d.ts +36 -0
- package/dist/types/eval.d.mts +8 -2
- package/dist/types/eval.d.ts +8 -2
- package/dist/types/index.d.mts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lazy.d.mts +15 -0
- package/dist/types/lazy.d.ts +15 -0
- package/dist/types/plugins/morph/index.d.mts +2 -1
- package/dist/types/plugins/morph/index.d.ts +2 -1
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -6,15 +6,18 @@ 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
|
-
- **~
|
|
9
|
+
- **~10kb**<!-- size:dist/litevue.iife.js --> 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
13
|
- **Plugin system** with nine first-party plugins: intersect, persist, focus (+trap), collapse, transition, mask, morph, media, resize
|
|
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
|
|
14
15
|
- **Components** registered by name with `app.component()`, usable from `v-scope`
|
|
15
16
|
- **Global store** (`store()` / `$store`) and magic properties (`$dispatch`, `$watch`, `$id`, `$root`, …)
|
|
16
17
|
- **Cached derived state** with `computed()`, alongside `reactive()` and `watchEffect()`
|
|
17
18
|
- Extra event modifiers: `.outside`, `.window`, `.debounce`, `.throttle`, animation-event filters
|
|
19
|
+
- **Error diagnostics** that name the directive, element and expression — and suggest the name you meant — plus `app.onError()` for monitoring in production
|
|
20
|
+
- **Development builds** with warnings for common mistakes, picked automatically by Vite and webpack while you develop
|
|
18
21
|
- 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
|
|
19
22
|
|
|
20
23
|
## Quick start
|
|
@@ -45,12 +48,12 @@ createApp({ count: 0 }).mount();
|
|
|
45
48
|
Full documentation lives in the **[docs site](https://litevue.dev/)** (source in [`docs/`](docs/), `pnpm docs:dev` to run locally):
|
|
46
49
|
|
|
47
50
|
- [Introduction](https://litevue.dev/start-here/introduction) — what it is, Vue compatibility, limitations, security and CSP
|
|
48
|
-
- [Installation](https://litevue.dev/start-here/installation) — CDN, npm, and
|
|
49
|
-
- [Essentials](https://litevue.dev/essentials/) — state, templating, components, lifecycle, dynamic content
|
|
51
|
+
- [Installation](https://litevue.dev/start-here/installation) — CDN, npm, mount options, and development builds
|
|
52
|
+
- [Essentials](https://litevue.dev/essentials/) — state, templating, components, lifecycle, dynamic content, server-driven HTML, error handling
|
|
50
53
|
- [Directives](https://litevue.dev/directives/) — a page per directive, with live demos
|
|
51
54
|
- [Magics](https://litevue.dev/magics/) — `$el`, `$store`, `$dispatch`, `$watch`, `$id`, …
|
|
52
|
-
- [Globals](https://litevue.dev/globals/) — `createApp()`, `store()`, `computed()`, `watchEffect()`, the devtools API
|
|
53
|
-
- [Plugins](https://litevue.dev/plugins/) —
|
|
55
|
+
- [Globals](https://litevue.dev/globals/) — `createApp()`, `store()`, `reactive()`, `computed()`, `watchEffect()`, `nextTick()`, the devtools API
|
|
56
|
+
- [Plugins](https://litevue.dev/plugins/) — all first-party plugins, and writing your own
|
|
54
57
|
- [Devtools](https://litevue.dev/devtools/) — inspector panel, browser extension, production kill-switch
|
|
55
58
|
- [Migrating from petite-vue](https://litevue.dev/migration/from-petite-vue) · [Coming from Alpine](https://litevue.dev/migration/from-alpine)
|
|
56
59
|
|
|
@@ -60,7 +63,7 @@ Full documentation lives in the **[docs site](https://litevue.dev/)** (source in
|
|
|
60
63
|
pnpm install
|
|
61
64
|
pnpm dev # test pages at localhost:3000
|
|
62
65
|
pnpm test # vitest suite
|
|
63
|
-
pnpm build # core
|
|
66
|
+
pnpm build # core, devtools and plugin bundles, production and development
|
|
64
67
|
pnpm docs:dev # documentation site
|
|
65
68
|
```
|
|
66
69
|
|
|
@@ -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=null,g=null,v=!1,f="",x="Elements",b="float",m="",y="",w="",k="",C="",L="",E=(e,n,t)=>Math.min(Math.max(e,n),Math.max(n,t)),O=e=>'<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">'+e+"</svg>",S="litevue-devtools-theme",_="litevue-devtools-ui",$=()=>{try{return JSON.parse(localStorage.getItem(_)||"{}")}catch{return{}}},M=e=>{try{localStorage.setItem(_,JSON.stringify({...$(),...e}))}catch{}},z={dark:O('<path d="M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z"/>'),light:O('<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:O('<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"/>')},I={float:O('<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:O('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="2" y="14" width="20" height="7" fill="currentColor"/>'),right:O('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="14" y="3" width="8" height="18" fill="currentColor"/>')},N={float:"bottom",bottom:"right",right:"float"},j={float:"floating",bottom:"docked to bottom",right:"docked to right"},P={dark:"light",light:"system",system:"dark"},T="dark";try{const e=localStorage.getItem(S);"light"!==e&&"system"!==e||(T=e)}catch{}var D=matchMedia("(prefers-color-scheme: light)"),H=()=>{const e="light"===T||"system"===T&&D.matches;t.host.classList.toggle("light",e),a.innerHTML=z[T],a.title="theme: "+T},W=new Set,V=new WeakSet,R=()=>{if("float"!==b)return;const e=parseInt(o.style.right)||0,n=parseInt(o.style.bottom)||0;w=o.style.right=E(e,0,window.innerWidth-o.offsetWidth)+"px",k=o.style.bottom=E(n,0,window.innerHeight-o.offsetHeight)+"px"},X=e=>{"float"===b?(m=o.style.width||m,y=o.style.height||y,w=o.style.right||w,k=o.style.bottom||k):"bottom"===b?C=o.style.height||C:L=o.style.width||L,b=e;const n="float"!==e;o.classList.toggle("dock-bottom","bottom"===e),o.classList.toggle("dock-right","right"===e),o.style.right=n?"":w,o.style.bottom=n?"":k,o.style.width="bottom"===e?"":"right"===e?L:m,o.style.height="right"===e?"":"bottom"===e?C:y,p.innerHTML=I[e],p.title="panel: "+j[e]},Y=(e,n,t)=>{const o=document.createElement(e);return o.className=n,null!=t&&(o.textContent=t),o},A=e=>{const n=Y("span","label");return n.appendChild(Y("span","punct","<")),n.appendChild(Y("span","name",ee(e))),n.appendChild(Y("span","punct",">")),n},B=e=>{let t=e.parentElement;for(;t;){if(n.scopes.has(t))return t;t=t.parentElement}return null},F=(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)},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},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!==u&&W.clear(),g=null,u=e,x="Elements",window.$scope=e?n.scopes.get(e):void 0,ne(),te()},Z=e=>{e!==g&&W.clear(),u=null,g=e,x="Stores",window.$scope=n.stores.get(e),ne(),te()},K=e=>{x=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"===x?"tab active":"tab",h.textContent=`Stores (${e})`,h.className="Stores"===x?"tab active":"tab"})(),i.textContent="","Elements"===x){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(!f||ee(i).toLowerCase().includes(f))t.set(i,void 0);else{const e=F(n.scopes.get(i),f);e&&t.set(i,e)}if(!t.size)return void i.appendChild(Y("div","empty",f?"no matching scopes":"no scopes mounted"));const o=new Set;for(const n of t.keys()){o.add(n);for(let e=B(n);e;e=B(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=B(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(V.has(n))return!0;return!1};for(const s of e){if(!o.has(s)||a(s))continue;const e=Y("div",s===u?"row sel":"row");e.style.paddingLeft=8+12*(d.get(s)??0)+"px";const r=V.has(s);if(l.get(s)){const n=Y("span",r?"arrow":"arrow open","\u25b6");n.onclick=e=>{e.stopPropagation(),r?V.delete(s):V.add(s),ne()},e.appendChild(n)}else e.appendChild(Y("span","spacer"));e.appendChild(A(s));const p=n.exps.get(s);p&&e.appendChild(Y("span","exp"," "+p));const c=t.get(s);c&&e.appendChild(Y("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(!f||o.toLowerCase().includes(f))e.set(o,void 0);else{const t=F(n.stores.get(o),f);t&&e.set(o,t)}const t=[...e.keys()];if(t.length)for(const n of t){const t=Y("div",n===g?"row sel":"row"),o=Y("span","label");o.appendChild(Y("span","punct","$store.")),o.appendChild(Y("span","name",n)),t.appendChild(o);const r=e.get(n);r&&t.appendChild(Y("span","hit"," "+r)),t.onclick=()=>Z(n),i.appendChild(t)}else i.appendChild(Y("div","empty",f?"no matching stores":"no stores registered"))},te=()=>{if(l.contains(t.activeElement))return;l.textContent="";const e=g?n.stores.get(g):u?n.scopes.get(u):void 0;if(!e)return void l.appendChild(Y("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(Y("div","divider","inherited")),r.forEach(n=>re(n,e,n,0,"prop inherited",[]))),o.length||r.length||l.appendChild(Y("div","empty","empty scope")),l.appendChild(oe(e))},oe=e=>{const n=Y("div","prop adder");n.appendChild(Y("span","spacer"));const t=Y("input","val key-in");t.placeholder="key";const o=Y("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=Y("div",r);if(a.style.paddingLeft=8+14*o+"px",null!==d&&"object"==typeof d){const s=i.indexOf(d)>-1,p=!s&&W.has(t);if(a.appendChild(Y("span",p?"arrow open":"arrow","\u25b6")),a.appendChild(Y("span","key",e)),a.appendChild(Y("span","preview",s?"(circular)":(e=>Array.isArray(e)?`(${e.length}) ${J(e)}`:J(e))(d))),s||(a.classList.add("toggle"),a.onclick=()=>{p?W.delete(t):W.add(t),te()}),ie(a,n,e,o,r),l.appendChild(a),p){const e=Object.keys(d);if(!e.length){const e=Y("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(Y("span","spacer")),a.appendChild(Y("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(Y("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(Y("span","preview",J(d)));else if("boolean"==typeof d){a.appendChild(Y("span","bool",String(d)));const t=Y("input","check");t.type="checkbox",t.checked=d,t.onchange=()=>{n[e]=t.checked,t.blur(),pe()},a.appendChild(t)}else{const t=Y("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,pe()):t.value=J(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=Y("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=()=>{v=!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 g=document.createElement("style");g.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(g),s=Y("div","highlight"),t.appendChild(s),(r=Y("div","pill","\u26a1 LiteVue")).onclick=()=>{r.style.display="none",o.style.display="flex",R(),M({open:!0}),pe()},t.appendChild(r),(o=Y("div","panel")).style.display="none";const x=Y("div","header");x.appendChild(Y("span","title","\u26a1 LiteVue")),x.addEventListener("mousedown",e=>{if(e.target.closest(".btn"))return;if("float"!==b)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=E(t-(e.clientX-i),0,window.innerWidth-o.offsetWidth)+"px",o.style.bottom=E(r-(e.clientY-l),0,window.innerHeight-o.offsetHeight)+"px"},a=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a),M({right:parseInt(o.style.right)||12,bottom:parseInt(o.style.bottom)||12})};document.addEventListener("mousemove",d),document.addEventListener("mouseup",a)});const _=Y("div","grip");_.addEventListener("mousedown",e=>{e.preventDefault(),_.classList.add("active");const n=o.getBoundingClientRect(),t=e.clientX,r=e.clientY,i=n.width,l=n.height,d=e=>{if("right"!==b){const n="bottom"===b?r-e.clientY:e.clientY-r;o.style.height=E(l+n,320,window.innerHeight-24)+"px"}if("bottom"!==b){const n="right"===b?t-e.clientX:e.clientX-t;o.style.width=E(i+n,320,window.innerWidth-24)+"px"}},a=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a),_.classList.remove("active");const e=parseInt(o.style.width),n=parseInt(o.style.height);M("float"===b?{w:e,h:n}:"bottom"===b?{bh:n}:{rw:e})};document.addEventListener("mousemove",d),document.addEventListener("mouseup",a)}),(p=Y("button","btn")).onclick=()=>{X(N[b]),M({dock:b})},x.appendChild(p),(a=Y("button","btn")).onclick=()=>{T=P[T];try{localStorage.setItem(S,T)}catch{}H()},x.appendChild(a),D.addEventListener("change",()=>{"system"===T&&H()}),H(),(d=Y("button","btn")).title="pick an element on the page",d.innerHTML=O('<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?ae():(v=!0,d.classList.add("active"),document.addEventListener("click",le,!0),void document.addEventListener("mousemove",de,!0)),x.appendChild(d);const z=Y("button","btn","\u2715");z.onclick=()=>{v&&ae(),o.style.display="none",r.style.display="",M({open:!1})},x.appendChild(z),o.appendChild(x);const I=Y("div","body"),j=Y("div","side"),W=Y("div","tabs");(c=Y("div","tab active")).onclick=()=>K("Elements"),(h=Y("div","tab")).onclick=()=>K("Stores"),W.appendChild(c),W.appendChild(h),j.appendChild(W);const V=Y("input","filter");V.placeholder="Filter by name or state",V.oninput=()=>{f=V.value.trim().toLowerCase(),ne()},V.onkeydown=e=>{"Escape"===e.key&&(V.value="",f="",ne())},j.appendChild(V),i=Y("div","tree"),j.appendChild(i),l=Y("div","state"),I.appendChild(j),I.appendChild(l),o.appendChild(I),o.appendChild(_),t.appendChild(o);const A=$();A.w&&(m=o.style.width=A.w+"px"),A.h&&(y=o.style.height=A.h+"px"),null!=A.right&&(w=o.style.right=A.right+"px"),null!=A.bottom&&(k=o.style.bottom=A.bottom+"px"),A.bh&&(C=A.bh+"px"),A.rw&&(L=A.rw+"px"),X(A.dock||"float"),document.body.appendChild(e),A.open&&(r.style.display="none",o.style.display="flex",R(),pe()),n.on("scope:mount",pe),n.on("scope:unmount",e=>{e===u&&(u=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(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var n,t,o,r,i,l,d,a,s,p,c,h,u=null,g=null,v=!1,f="",x="Elements",b="float",m="",y="",w="",k="",C="",L="",E=(e,n,t)=>Math.min(Math.max(e,n),Math.max(n,t)),O=e=>'<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">'+e+"</svg>",S="litevue-devtools-theme",_="litevue-devtools-ui",$=()=>{try{return JSON.parse(localStorage.getItem(_)||"{}")}catch{return{}}},M=e=>{try{localStorage.setItem(_,JSON.stringify({...$(),...e}))}catch{}},z={dark:O('<path d="M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z"/>'),light:O('<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:O('<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"/>')},I={float:O('<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:O('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="2" y="14" width="20" height="7" fill="currentColor"/>'),right:O('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="14" y="3" width="8" height="18" fill="currentColor"/>')},N={float:"bottom",bottom:"right",right:"float"},j={float:"floating",bottom:"docked to bottom",right:"docked to right"},P={dark:"light",light:"system",system:"dark"},T="dark";try{const e=localStorage.getItem(S);"light"!==e&&"system"!==e||(T=e)}catch{}var D=matchMedia("(prefers-color-scheme: light)"),H=()=>{const e="light"===T||"system"===T&&D.matches;t.host.classList.toggle("light",e),a.innerHTML=z[T],a.title="theme: "+T},W=new Set,V=new WeakSet,R=()=>{if("float"!==b)return;const e=parseInt(o.style.right)||0,n=parseInt(o.style.bottom)||0;w=o.style.right=E(e,0,window.innerWidth-o.offsetWidth)+"px",k=o.style.bottom=E(n,0,window.innerHeight-o.offsetHeight)+"px"},X=e=>{"float"===b?(m=o.style.width||m,y=o.style.height||y,w=o.style.right||w,k=o.style.bottom||k):"bottom"===b?C=o.style.height||C:L=o.style.width||L,b=e;const n="float"!==e;o.classList.toggle("dock-bottom","bottom"===e),o.classList.toggle("dock-right","right"===e),o.style.right=n?"":w,o.style.bottom=n?"":k,o.style.width="bottom"===e?"":"right"===e?L:m,o.style.height="right"===e?"":"bottom"===e?C:y,p.innerHTML=I[e],p.title="panel: "+j[e]},Y=(e,n,t)=>{const o=document.createElement(e);return o.className=n,null!=t&&(o.textContent=t),o},A=e=>{const n=Y("span","label");return n.appendChild(Y("span","punct","<")),n.appendChild(Y("span","name",ee(e))),n.appendChild(Y("span","punct",">")),n},B=e=>{let t=e.parentElement;for(;t;){if(n.scopes.has(t))return t;t=t.parentElement}return null},F=(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)},J=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},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!==u&&W.clear(),g=null,u=e,x="Elements",window.$scope=e?n.scopes.get(e):void 0,ne(),te()},Z=e=>{e!==g&&W.clear(),u=null,g=e,x="Stores",window.$scope=n.stores.get(e),ne(),te()},K=e=>{x=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"===x?"tab active":"tab",h.textContent=`Stores (${e})`,h.className="Stores"===x?"tab active":"tab"})(),i.textContent="","Elements"===x){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(!f||ee(i).toLowerCase().includes(f))t.set(i,void 0);else{const e=F(n.scopes.get(i),f);e&&t.set(i,e)}if(!t.size)return void i.appendChild(Y("div","empty",f?"no matching scopes":"no scopes mounted"));const o=new Set;for(const n of t.keys()){o.add(n);for(let e=B(n);e;e=B(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=B(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(V.has(n))return!0;return!1};for(const s of e){if(!o.has(s)||a(s))continue;const e=Y("div",s===u?"row sel":"row");e.style.paddingLeft=8+12*(d.get(s)??0)+"px";const r=V.has(s);if(l.get(s)){const n=Y("span",r?"arrow":"arrow open","\u25b6");n.onclick=e=>{e.stopPropagation(),r?V.delete(s):V.add(s),ne()},e.appendChild(n)}else e.appendChild(Y("span","spacer"));e.appendChild(A(s));const p=n.exps.get(s);p&&e.appendChild(Y("span","exp"," "+p));const c=t.get(s);c&&e.appendChild(Y("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(!f||o.toLowerCase().includes(f))e.set(o,void 0);else{const t=F(n.stores.get(o),f);t&&e.set(o,t)}const t=[...e.keys()];if(t.length)for(const n of t){const t=Y("div",n===g?"row sel":"row"),o=Y("span","label");o.appendChild(Y("span","punct","$store.")),o.appendChild(Y("span","name",n)),t.appendChild(o);const r=e.get(n);r&&t.appendChild(Y("span","hit"," "+r)),t.onclick=()=>Z(n),i.appendChild(t)}else i.appendChild(Y("div","empty",f?"no matching stores":"no stores registered"))},te=()=>{if(l.contains(t.activeElement))return;l.textContent="";const e=g?n.stores.get(g):u?n.scopes.get(u):void 0;if(!e)return void l.appendChild(Y("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(Y("div","divider","inherited")),r.forEach(n=>re(n,e,n,0,"prop inherited",[]))),o.length||r.length||l.appendChild(Y("div","empty","empty scope")),l.appendChild(oe(e))},oe=e=>{const n=Y("div","prop adder");n.appendChild(Y("span","spacer"));const t=Y("input","val key-in");t.placeholder="key";const o=Y("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=Y("div",r);if(a.style.paddingLeft=8+14*o+"px",null!==d&&"object"==typeof d){const s=i.indexOf(d)>-1,p=!s&&W.has(t);if(a.appendChild(Y("span",p?"arrow open":"arrow","\u25b6")),a.appendChild(Y("span","key",e)),a.appendChild(Y("span","preview",s?"(circular)":(e=>Array.isArray(e)?`(${e.length}) ${J(e)}`:J(e))(d))),s||(a.classList.add("toggle"),a.onclick=()=>{p?W.delete(t):W.add(t),te()}),ie(a,n,e,o,r),l.appendChild(a),p){const e=Object.keys(d);if(!e.length){const e=Y("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(Y("span","spacer")),a.appendChild(Y("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(Y("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(Y("span","preview",J(d)));else if("boolean"==typeof d){a.appendChild(Y("span","bool",String(d)));const t=Y("input","check");t.type="checkbox",t.checked=d,t.onchange=()=>{n[e]=t.checked,t.blur(),pe()},a.appendChild(t)}else{const t=Y("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,pe()):t.value=J(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=Y("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=()=>{v=!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 g=document.createElement("style");g.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(g),s=Y("div","highlight"),t.appendChild(s),(r=Y("div","pill","\u26a1 LiteVue")).onclick=()=>{r.style.display="none",o.style.display="flex",R(),M({open:!0}),pe()},t.appendChild(r),(o=Y("div","panel")).style.display="none";const x=Y("div","header");x.appendChild(Y("span","title","\u26a1 LiteVue")),x.addEventListener("mousedown",e=>{if(e.target.closest(".btn"))return;if("float"!==b)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=E(t-(e.clientX-i),0,window.innerWidth-o.offsetWidth)+"px",o.style.bottom=E(r-(e.clientY-l),0,window.innerHeight-o.offsetHeight)+"px"},a=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a),M({right:parseInt(o.style.right)||12,bottom:parseInt(o.style.bottom)||12})};document.addEventListener("mousemove",d),document.addEventListener("mouseup",a)});const _=Y("div","grip");_.addEventListener("mousedown",e=>{e.preventDefault(),_.classList.add("active");const n=o.getBoundingClientRect(),t=e.clientX,r=e.clientY,i=n.width,l=n.height,d=e=>{if("right"!==b){const n="bottom"===b?r-e.clientY:e.clientY-r;o.style.height=E(l+n,320,window.innerHeight-24)+"px"}if("bottom"!==b){const n="right"===b?t-e.clientX:e.clientX-t;o.style.width=E(i+n,320,window.innerWidth-24)+"px"}},a=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a),_.classList.remove("active");const e=parseInt(o.style.width),n=parseInt(o.style.height);M("float"===b?{w:e,h:n}:"bottom"===b?{bh:n}:{rw:e})};document.addEventListener("mousemove",d),document.addEventListener("mouseup",a)}),(p=Y("button","btn")).onclick=()=>{X(N[b]),M({dock:b})},x.appendChild(p),(a=Y("button","btn")).onclick=()=>{T=P[T];try{localStorage.setItem(S,T)}catch{}H()},x.appendChild(a),D.addEventListener("change",()=>{"system"===T&&H()}),H(),(d=Y("button","btn")).title="pick an element on the page",d.innerHTML=O('<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?ae():(v=!0,d.classList.add("active"),document.addEventListener("click",le,!0),void document.addEventListener("mousemove",de,!0)),x.appendChild(d);const z=Y("button","btn","\u2715");z.onclick=()=>{v&&ae(),o.style.display="none",r.style.display="",M({open:!1})},x.appendChild(z),o.appendChild(x);const I=Y("div","body"),j=Y("div","side"),W=Y("div","tabs");(c=Y("div","tab active")).onclick=()=>K("Elements"),(h=Y("div","tab")).onclick=()=>K("Stores"),W.appendChild(c),W.appendChild(h),j.appendChild(W);const V=Y("input","filter");V.placeholder="Filter by name or state",V.oninput=()=>{f=V.value.trim().toLowerCase(),ne()},V.onkeydown=e=>{"Escape"===e.key&&(V.value="",f="",ne())},j.appendChild(V),i=Y("div","tree"),j.appendChild(i),l=Y("div","state"),I.appendChild(j),I.appendChild(l),o.appendChild(I),o.appendChild(_),t.appendChild(o);const A=$();A.w&&(m=o.style.width=A.w+"px"),A.h&&(y=o.style.height=A.h+"px"),null!=A.right&&(w=o.style.right=A.right+"px"),null!=A.bottom&&(k=o.style.bottom=A.bottom+"px"),A.bh&&(C=A.bh+"px"),A.rw&&(L=A.rw+"px"),X(A.dock||"float"),document.body.appendChild(e),A.open&&(r.style.display="none",o.style.display="flex",R(),pe()),n.on("scope:mount",pe),n.on("scope:unmount",e=>{e===u&&(u=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 +1 @@
|
|
|
1
|
-
var e,n,t,o,r,i,d,l,a,s,p,c,h=null,g=null,u=!1,v="",f="Elements",x="float",b="",m="",y="",w="",k="",C="",L=(e,n,t)=>Math.min(Math.max(e,n),Math.max(n,t)),E=e=>'<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">'+e+"</svg>",O="litevue-devtools-theme",S="litevue-devtools-ui",_=()=>{try{return JSON.parse(localStorage.getItem(S)||"{}")}catch{return{}}},$=e=>{try{localStorage.setItem(S,JSON.stringify({..._(),...e}))}catch{}},M={dark:E('<path d="M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z"/>'),light:E('<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:E('<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"/>')},z={float:E('<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:E('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="2" y="14" width="20" height="7" fill="currentColor"/>'),right:E('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="14" y="3" width="8" height="18" fill="currentColor"/>')},I={float:"bottom",bottom:"right",right:"float"},N={float:"floating",bottom:"docked to bottom",right:"docked to right"},j={dark:"light",light:"system",system:"dark"},P="dark";try{const e=localStorage.getItem(O);"light"!==e&&"system"!==e||(P=e)}catch{}var T=matchMedia("(prefers-color-scheme: light)"),H=()=>{const e="light"===P||"system"===P&&T.matches;n.host.classList.toggle("light",e),l.innerHTML=M[P],l.title="theme: "+P},D=/* @__PURE__ */new Set,W=/* @__PURE__ */new WeakSet,V=()=>{if("float"!==x)return;const e=parseInt(t.style.right)||0,n=parseInt(t.style.bottom)||0;y=t.style.right=L(e,0,window.innerWidth-t.offsetWidth)+"px",w=t.style.bottom=L(n,0,window.innerHeight-t.offsetHeight)+"px"},R=e=>{"float"===x?(b=t.style.width||b,m=t.style.height||m,y=t.style.right||y,w=t.style.bottom||w):"bottom"===x?k=t.style.height||k:C=t.style.width||C,x=e;const n="float"!==e;t.classList.toggle("dock-bottom","bottom"===e),t.classList.toggle("dock-right","right"===e),t.style.right=n?"":y,t.style.bottom=n?"":w,t.style.width="bottom"===e?"":"right"===e?C:b,t.style.height="right"===e?"":"bottom"===e?k:m,s.innerHTML=z[e],s.title="panel: "+N[e]},X=(e,n,t)=>{const o=document.createElement(e);return o.className=n,null!=t&&(o.textContent=t),o},Y=e=>{const n=X("span","label");return n.appendChild(X("span","punct","<")),n.appendChild(X("span","name",Q(e))),n.appendChild(X("span","punct",">")),n},A=n=>{let t=n.parentElement;for(;t;){if(e.scopes.has(t))return t;t=t.parentElement}return null},B=(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)},F=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();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!==h&&D.clear(),g=null,h=n,f="Elements",window.$scope=n?e.scopes.get(n):void 0,ee(),ne()},G=n=>{n!==g&&D.clear(),h=null,g=n,f="Stores",window.$scope=e.stores.get(n),ee(),ne()},Z=e=>{f=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"===f?"tab active":"tab",c.textContent=`Stores (${n})`,c.className="Stores"===f?"tab active":"tab"})(),r.textContent="","Elements"===f){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(!v||Q(r).toLowerCase().includes(v))t.set(r,void 0);else{const n=B(e.scopes.get(r),v);n&&t.set(r,n)}if(!t.size)return void r.appendChild(X("div","empty",v?"no matching scopes":"no scopes mounted"));const o=/* @__PURE__ */new Set;for(const e of t.keys()){o.add(e);for(let n=A(e);n;n=A(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=A(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(W.has(n))return!0;return!1};for(const s of n){if(!o.has(s)||a(s))continue;const n=X("div",s===h?"row sel":"row");n.style.paddingLeft=8+12*(l.get(s)??0)+"px";const i=W.has(s);if(d.get(s)){const e=X("span",i?"arrow":"arrow open","\u25b6");e.onclick=e=>{e.stopPropagation(),i?W.delete(s):W.add(s),ee()},n.appendChild(e)}else n.appendChild(X("span","spacer"));n.appendChild(Y(s));const p=e.exps.get(s);p&&n.appendChild(X("span","exp"," "+p));const c=t.get(s);c&&n.appendChild(X("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(!v||o.toLowerCase().includes(v))n.set(o,void 0);else{const t=B(e.stores.get(o),v);t&&n.set(o,t)}const t=[...n.keys()];if(t.length)for(const e of t){const t=X("div",e===g?"row sel":"row"),o=X("span","label");o.appendChild(X("span","punct","$store.")),o.appendChild(X("span","name",e)),t.appendChild(o);const i=n.get(e);i&&t.appendChild(X("span","hit"," "+i)),t.onclick=()=>G(e),r.appendChild(t)}else r.appendChild(X("div","empty",v?"no matching stores":"no stores registered"))},ne=()=>{if(i.contains(n.activeElement))return;i.textContent="";const t=g?e.stores.get(g):h?e.scopes.get(h):void 0;if(!t)return void i.appendChild(X("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(X("div","divider","inherited")),r.forEach(e=>oe(e,t,e,0,"prop inherited",[]))),o.length||r.length||i.appendChild(X("div","empty","empty scope")),i.appendChild(te(t))},te=e=>{const n=X("div","prop adder");n.appendChild(X("span","spacer"));const t=X("input","val key-in");t.placeholder="key";const o=X("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=X("div",r);if(a.style.paddingLeft=8+14*o+"px",null!==l&&"object"==typeof l){const s=d.indexOf(l)>-1,p=!s&&D.has(t);if(a.appendChild(X("span",p?"arrow open":"arrow","\u25b6")),a.appendChild(X("span","key",e)),a.appendChild(X("span","preview",s?"(circular)":(e=>Array.isArray(e)?`(${e.length}) ${F(e)}`:F(e))(l))),s||(a.classList.add("toggle"),a.onclick=()=>{p?D.delete(t):D.add(t),ne()}),re(a,n,e,o,r),i.appendChild(a),p){const e=Object.keys(l);if(!e.length){const e=X("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(X("span","spacer")),a.appendChild(X("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(X("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(X("span","preview",F(l)));else if("boolean"==typeof l){a.appendChild(X("span","bool",String(l)));const t=X("input","check");t.type="checkbox",t.checked=l,t.onchange=()=>{n[e]=t.checked,t.blur(),se()},a.appendChild(t)}else{const t=X("input","val");t.value=F(l),t.onfocus=()=>{t.value="string"==typeof l?l:String(l)},t.onkeydown=e=>{"Enter"===e.key&&t.blur(),"Escape"===e.key&&(t.value=F(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=F(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=X("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=()=>{u=!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 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",n.appendChild(f),a=X("div","highlight"),n.appendChild(a),(o=X("div","pill","\u26a1 LiteVue")).onclick=()=>{o.style.display="none",t.style.display="flex",V(),$({open:!0}),se()},n.appendChild(o),(t=X("div","panel")).style.display="none";const S=X("div","header");S.appendChild(X("span","title","\u26a1 LiteVue")),S.addEventListener("mousedown",e=>{if(e.target.closest(".btn"))return;if("float"!==x)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=L(o-(e.clientX-i),0,window.innerWidth-t.offsetWidth)+"px",t.style.bottom=L(r-(e.clientY-d),0,window.innerHeight-t.offsetHeight)+"px"},a=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a),$({right:parseInt(t.style.right)||12,bottom:parseInt(t.style.bottom)||12})};document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)});const M=X("div","grip");M.addEventListener("mousedown",e=>{e.preventDefault(),M.classList.add("active");const n=t.getBoundingClientRect(),o=e.clientX,r=e.clientY,i=n.width,d=n.height,l=e=>{if("right"!==x){const n="bottom"===x?r-e.clientY:e.clientY-r;t.style.height=L(d+n,320,window.innerHeight-24)+"px"}if("bottom"!==x){const n="right"===x?o-e.clientX:e.clientX-o;t.style.width=L(i+n,320,window.innerWidth-24)+"px"}},a=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a),M.classList.remove("active");const e=parseInt(t.style.width),n=parseInt(t.style.height);$("float"===x?{w:e,h:n}:"bottom"===x?{bh:n}:{rw:e})};document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)}),(s=X("button","btn")).onclick=()=>{R(I[x]),$({dock:x})},S.appendChild(s),(l=X("button","btn")).onclick=()=>{P=j[P];try{localStorage.setItem(O,P)}catch{}H()},S.appendChild(l),T.addEventListener("change",()=>{"system"===P&&H()}),H(),(d=X("button","btn")).title="pick an element on the page",d.innerHTML=E('<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=()=>u?le():(u=!0,d.classList.add("active"),document.addEventListener("click",ie,!0),void document.addEventListener("mousemove",de,!0)),S.appendChild(d);const z=X("button","btn","\u2715");z.onclick=()=>{u&&le(),t.style.display="none",o.style.display="",$({open:!1})},S.appendChild(z),t.appendChild(S);const N=X("div","body"),D=X("div","side"),W=X("div","tabs");(p=X("div","tab active")).onclick=()=>Z("Elements"),(c=X("div","tab")).onclick=()=>Z("Stores"),W.appendChild(p),W.appendChild(c),D.appendChild(W);const Y=X("input","filter");Y.placeholder="Filter by name or state",Y.oninput=()=>{v=Y.value.trim().toLowerCase(),ee()},Y.onkeydown=e=>{"Escape"===e.key&&(Y.value="",v="",ee())},D.appendChild(Y),r=X("div","tree"),D.appendChild(r),i=X("div","state"),N.appendChild(D),N.appendChild(i),t.appendChild(N),t.appendChild(M),n.appendChild(t);const A=_();A.w&&(b=t.style.width=A.w+"px"),A.h&&(m=t.style.height=A.h+"px"),null!=A.right&&(y=t.style.right=A.right+"px"),null!=A.bottom&&(w=t.style.bottom=A.bottom+"px"),A.bh&&(k=A.bh+"px"),A.rw&&(C=A.rw+"px"),R(A.dock||"float"),document.body.appendChild(g),A.open&&(o.style.display="none",t.style.display="flex",V(),se()),e.on("scope:mount",se),e.on("scope:unmount",e=>{e===h&&(h=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 e,n,t,o,r,i,d,l,a,s,p,c,h=null,g=null,u=!1,v="",f="Elements",x="float",b="",m="",y="",w="",k="",C="",L=(e,n,t)=>Math.min(Math.max(e,n),Math.max(n,t)),E=e=>'<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">'+e+"</svg>",O="litevue-devtools-theme",S="litevue-devtools-ui",_=()=>{try{return JSON.parse(localStorage.getItem(S)||"{}")}catch{return{}}},$=e=>{try{localStorage.setItem(S,JSON.stringify({..._(),...e}))}catch{}},M={dark:E('<path d="M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z"/>'),light:E('<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:E('<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"/>')},z={float:E('<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:E('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="2" y="14" width="20" height="7" fill="currentColor"/>'),right:E('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="14" y="3" width="8" height="18" fill="currentColor"/>')},I={float:"bottom",bottom:"right",right:"float"},N={float:"floating",bottom:"docked to bottom",right:"docked to right"},j={dark:"light",light:"system",system:"dark"},P="dark";try{const e=localStorage.getItem(O);"light"!==e&&"system"!==e||(P=e)}catch{}var T=matchMedia("(prefers-color-scheme: light)"),H=()=>{const e="light"===P||"system"===P&&T.matches;n.host.classList.toggle("light",e),l.innerHTML=M[P],l.title="theme: "+P},D=/* @__PURE__ */new Set,W=/* @__PURE__ */new WeakSet,V=()=>{if("float"!==x)return;const e=parseInt(t.style.right)||0,n=parseInt(t.style.bottom)||0;y=t.style.right=L(e,0,window.innerWidth-t.offsetWidth)+"px",w=t.style.bottom=L(n,0,window.innerHeight-t.offsetHeight)+"px"},R=e=>{"float"===x?(b=t.style.width||b,m=t.style.height||m,y=t.style.right||y,w=t.style.bottom||w):"bottom"===x?k=t.style.height||k:C=t.style.width||C,x=e;const n="float"!==e;t.classList.toggle("dock-bottom","bottom"===e),t.classList.toggle("dock-right","right"===e),t.style.right=n?"":y,t.style.bottom=n?"":w,t.style.width="bottom"===e?"":"right"===e?C:b,t.style.height="right"===e?"":"bottom"===e?k:m,s.innerHTML=z[e],s.title="panel: "+N[e]},X=(e,n,t)=>{const o=document.createElement(e);return o.className=n,null!=t&&(o.textContent=t),o},Y=e=>{const n=X("span","label");return n.appendChild(X("span","punct","<")),n.appendChild(X("span","name",Q(e))),n.appendChild(X("span","punct",">")),n},A=n=>{let t=n.parentElement;for(;t;){if(e.scopes.has(t))return t;t=t.parentElement}return null},B=(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)},F=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},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!==h&&D.clear(),g=null,h=n,f="Elements",window.$scope=n?e.scopes.get(n):void 0,ee(),ne()},G=n=>{n!==g&&D.clear(),h=null,g=n,f="Stores",window.$scope=e.stores.get(n),ee(),ne()},Z=e=>{f=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"===f?"tab active":"tab",c.textContent=`Stores (${n})`,c.className="Stores"===f?"tab active":"tab"})(),r.textContent="","Elements"===f){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(!v||Q(r).toLowerCase().includes(v))t.set(r,void 0);else{const n=B(e.scopes.get(r),v);n&&t.set(r,n)}if(!t.size)return void r.appendChild(X("div","empty",v?"no matching scopes":"no scopes mounted"));const o=/* @__PURE__ */new Set;for(const e of t.keys()){o.add(e);for(let n=A(e);n;n=A(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=A(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(W.has(n))return!0;return!1};for(const s of n){if(!o.has(s)||a(s))continue;const n=X("div",s===h?"row sel":"row");n.style.paddingLeft=8+12*(l.get(s)??0)+"px";const i=W.has(s);if(d.get(s)){const e=X("span",i?"arrow":"arrow open","\u25b6");e.onclick=e=>{e.stopPropagation(),i?W.delete(s):W.add(s),ee()},n.appendChild(e)}else n.appendChild(X("span","spacer"));n.appendChild(Y(s));const p=e.exps.get(s);p&&n.appendChild(X("span","exp"," "+p));const c=t.get(s);c&&n.appendChild(X("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(!v||o.toLowerCase().includes(v))n.set(o,void 0);else{const t=B(e.stores.get(o),v);t&&n.set(o,t)}const t=[...n.keys()];if(t.length)for(const e of t){const t=X("div",e===g?"row sel":"row"),o=X("span","label");o.appendChild(X("span","punct","$store.")),o.appendChild(X("span","name",e)),t.appendChild(o);const i=n.get(e);i&&t.appendChild(X("span","hit"," "+i)),t.onclick=()=>G(e),r.appendChild(t)}else r.appendChild(X("div","empty",v?"no matching stores":"no stores registered"))},ne=()=>{if(i.contains(n.activeElement))return;i.textContent="";const t=g?e.stores.get(g):h?e.scopes.get(h):void 0;if(!t)return void i.appendChild(X("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(X("div","divider","inherited")),r.forEach(e=>oe(e,t,e,0,"prop inherited",[]))),o.length||r.length||i.appendChild(X("div","empty","empty scope")),i.appendChild(te(t))},te=e=>{const n=X("div","prop adder");n.appendChild(X("span","spacer"));const t=X("input","val key-in");t.placeholder="key";const o=X("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=X("div",r);if(a.style.paddingLeft=8+14*o+"px",null!==l&&"object"==typeof l){const s=d.indexOf(l)>-1,p=!s&&D.has(t);if(a.appendChild(X("span",p?"arrow open":"arrow","\u25b6")),a.appendChild(X("span","key",e)),a.appendChild(X("span","preview",s?"(circular)":(e=>Array.isArray(e)?`(${e.length}) ${F(e)}`:F(e))(l))),s||(a.classList.add("toggle"),a.onclick=()=>{p?D.delete(t):D.add(t),ne()}),re(a,n,e,o,r),i.appendChild(a),p){const e=Object.keys(l);if(!e.length){const e=X("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(X("span","spacer")),a.appendChild(X("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(X("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(X("span","preview",F(l)));else if("boolean"==typeof l){a.appendChild(X("span","bool",String(l)));const t=X("input","check");t.type="checkbox",t.checked=l,t.onchange=()=>{n[e]=t.checked,t.blur(),se()},a.appendChild(t)}else{const t=X("input","val");t.value=F(l),t.onfocus=()=>{t.value="string"==typeof l?l:String(l)},t.onkeydown=e=>{"Enter"===e.key&&t.blur(),"Escape"===e.key&&(t.value=F(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=F(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=X("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=()=>{u=!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 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",n.appendChild(f),a=X("div","highlight"),n.appendChild(a),(o=X("div","pill","\u26a1 LiteVue")).onclick=()=>{o.style.display="none",t.style.display="flex",V(),$({open:!0}),se()},n.appendChild(o),(t=X("div","panel")).style.display="none";const S=X("div","header");S.appendChild(X("span","title","\u26a1 LiteVue")),S.addEventListener("mousedown",e=>{if(e.target.closest(".btn"))return;if("float"!==x)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=L(o-(e.clientX-i),0,window.innerWidth-t.offsetWidth)+"px",t.style.bottom=L(r-(e.clientY-d),0,window.innerHeight-t.offsetHeight)+"px"},a=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a),$({right:parseInt(t.style.right)||12,bottom:parseInt(t.style.bottom)||12})};document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)});const M=X("div","grip");M.addEventListener("mousedown",e=>{e.preventDefault(),M.classList.add("active");const n=t.getBoundingClientRect(),o=e.clientX,r=e.clientY,i=n.width,d=n.height,l=e=>{if("right"!==x){const n="bottom"===x?r-e.clientY:e.clientY-r;t.style.height=L(d+n,320,window.innerHeight-24)+"px"}if("bottom"!==x){const n="right"===x?o-e.clientX:e.clientX-o;t.style.width=L(i+n,320,window.innerWidth-24)+"px"}},a=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a),M.classList.remove("active");const e=parseInt(t.style.width),n=parseInt(t.style.height);$("float"===x?{w:e,h:n}:"bottom"===x?{bh:n}:{rw:e})};document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)}),(s=X("button","btn")).onclick=()=>{R(I[x]),$({dock:x})},S.appendChild(s),(l=X("button","btn")).onclick=()=>{P=j[P];try{localStorage.setItem(O,P)}catch{}H()},S.appendChild(l),T.addEventListener("change",()=>{"system"===P&&H()}),H(),(d=X("button","btn")).title="pick an element on the page",d.innerHTML=E('<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=()=>u?le():(u=!0,d.classList.add("active"),document.addEventListener("click",ie,!0),void document.addEventListener("mousemove",de,!0)),S.appendChild(d);const z=X("button","btn","\u2715");z.onclick=()=>{u&&le(),t.style.display="none",o.style.display="",$({open:!1})},S.appendChild(z),t.appendChild(S);const N=X("div","body"),D=X("div","side"),W=X("div","tabs");(p=X("div","tab active")).onclick=()=>Z("Elements"),(c=X("div","tab")).onclick=()=>Z("Stores"),W.appendChild(p),W.appendChild(c),D.appendChild(W);const Y=X("input","filter");Y.placeholder="Filter by name or state",Y.oninput=()=>{v=Y.value.trim().toLowerCase(),ee()},Y.onkeydown=e=>{"Escape"===e.key&&(Y.value="",v="",ee())},D.appendChild(Y),r=X("div","tree"),D.appendChild(r),i=X("div","state"),N.appendChild(D),N.appendChild(i),t.appendChild(N),t.appendChild(M),n.appendChild(t);const A=_();A.w&&(b=t.style.width=A.w+"px"),A.h&&(m=t.style.height=A.h+"px"),null!=A.right&&(y=t.style.right=A.right+"px"),null!=A.bottom&&(w=t.style.bottom=A.bottom+"px"),A.bh&&(k=A.bh+"px"),A.rw&&(C=A.rw+"px"),R(A.dock||"float"),document.body.appendChild(g),A.open&&(o.style.display="none",t.style.display="flex",V(),se()),e.on("scope:mount",se),e.on("scope:unmount",e=>{e===h&&(h=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 +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=null,g=null,f=!1,v="",x="Elements",b="float",m="",y="",w="",k="",C="",L="",E=(e,n,t)=>Math.min(Math.max(e,n),Math.max(n,t)),O=e=>'<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">'+e+"</svg>",S="litevue-devtools-theme",_="litevue-devtools-ui",$=()=>{try{return JSON.parse(localStorage.getItem(_)||"{}")}catch{return{}}},M=e=>{try{localStorage.setItem(_,JSON.stringify({...$(),...e}))}catch{}},j={dark:O('<path d="M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z"/>'),light:O('<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:O('<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"/>')},z={float:O('<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:O('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="2" y="14" width="20" height="7" fill="currentColor"/>'),right:O('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="14" y="3" width="8" height="18" fill="currentColor"/>')},I={float:"bottom",bottom:"right",right:"float"},N={float:"floating",bottom:"docked to bottom",right:"docked to right"},T={dark:"light",light:"system",system:"dark"},P="dark";try{const e=localStorage.getItem(S);"light"!==e&&"system"!==e||(P=e)}catch{}var D=matchMedia("(prefers-color-scheme: light)"),H=()=>{const e="light"===P||"system"===P&&D.matches;t.host.classList.toggle("light",e),a.innerHTML=j[P],a.title="theme: "+P},W=new Set,V=new WeakSet,R=()=>{if("float"!==b)return;const e=parseInt(o.style.right)||0,n=parseInt(o.style.bottom)||0;w=o.style.right=E(e,0,window.innerWidth-o.offsetWidth)+"px",k=o.style.bottom=E(n,0,window.innerHeight-o.offsetHeight)+"px"},X=e=>{"float"===b?(m=o.style.width||m,y=o.style.height||y,w=o.style.right||w,k=o.style.bottom||k):"bottom"===b?C=o.style.height||C:L=o.style.width||L,b=e;const n="float"!==e;o.classList.toggle("dock-bottom","bottom"===e),o.classList.toggle("dock-right","right"===e),o.style.right=n?"":w,o.style.bottom=n?"":k,o.style.width="bottom"===e?"":"right"===e?L:m,o.style.height="right"===e?"":"bottom"===e?C:y,p.innerHTML=z[e],p.title="panel: "+N[e]},Y=(e,n,t)=>{const o=document.createElement(e);return o.className=n,null!=t&&(o.textContent=t),o},A=e=>{const n=Y("span","label");return n.appendChild(Y("span","punct","<")),n.appendChild(Y("span","name",ee(e))),n.appendChild(Y("span","punct",">")),n},B=e=>{let t=e.parentElement;for(;t;){if(n.scopes.has(t))return t;t=t.parentElement}return null},F=(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)},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},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!==u&&W.clear(),g=null,u=e,x="Elements",window.$scope=e?n.scopes.get(e):void 0,ne(),te()},Z=e=>{e!==g&&W.clear(),u=null,g=e,x="Stores",window.$scope=n.stores.get(e),ne(),te()},K=e=>{x=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"===x?"tab active":"tab",h.textContent=`Stores (${e})`,h.className="Stores"===x?"tab active":"tab"})(),i.textContent="","Elements"===x){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(!v||ee(i).toLowerCase().includes(v))t.set(i,void 0);else{const e=F(n.scopes.get(i),v);e&&t.set(i,e)}if(!t.size)return void i.appendChild(Y("div","empty",v?"no matching scopes":"no scopes mounted"));const o=new Set;for(const n of t.keys()){o.add(n);for(let e=B(n);e;e=B(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=B(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(V.has(n))return!0;return!1};for(const s of e){if(!o.has(s)||a(s))continue;const e=Y("div",s===u?"row sel":"row");e.style.paddingLeft=8+12*(l.get(s)??0)+"px";const r=V.has(s);if(d.get(s)){const n=Y("span",r?"arrow":"arrow open","\u25b6");n.onclick=e=>{e.stopPropagation(),r?V.delete(s):V.add(s),ne()},e.appendChild(n)}else e.appendChild(Y("span","spacer"));e.appendChild(A(s));const p=n.exps.get(s);p&&e.appendChild(Y("span","exp"," "+p));const c=t.get(s);c&&e.appendChild(Y("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(!v||o.toLowerCase().includes(v))e.set(o,void 0);else{const t=F(n.stores.get(o),v);t&&e.set(o,t)}const t=[...e.keys()];if(t.length)for(const n of t){const t=Y("div",n===g?"row sel":"row"),o=Y("span","label");o.appendChild(Y("span","punct","$store.")),o.appendChild(Y("span","name",n)),t.appendChild(o);const r=e.get(n);r&&t.appendChild(Y("span","hit"," "+r)),t.onclick=()=>Z(n),i.appendChild(t)}else i.appendChild(Y("div","empty",v?"no matching stores":"no stores registered"))},te=()=>{if(d.contains(t.activeElement))return;d.textContent="";const e=g?n.stores.get(g):u?n.scopes.get(u):void 0;if(!e)return void d.appendChild(Y("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(Y("div","divider","inherited")),r.forEach(n=>re(n,e,n,0,"prop inherited",[]))),o.length||r.length||d.appendChild(Y("div","empty","empty scope")),d.appendChild(oe(e))},oe=e=>{const n=Y("div","prop adder");n.appendChild(Y("span","spacer"));const t=Y("input","val key-in");t.placeholder="key";const o=Y("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=Y("div",r);if(a.style.paddingLeft=8+14*o+"px",null!==l&&"object"==typeof l){const s=i.indexOf(l)>-1,p=!s&&W.has(t);if(a.appendChild(Y("span",p?"arrow open":"arrow","\u25b6")),a.appendChild(Y("span","key",e)),a.appendChild(Y("span","preview",s?"(circular)":(e=>Array.isArray(e)?`(${e.length}) ${J(e)}`:J(e))(l))),s||(a.classList.add("toggle"),a.onclick=()=>{p?W.delete(t):W.add(t),te()}),ie(a,n,e,o,r),d.appendChild(a),p){const e=Object.keys(l);if(!e.length){const e=Y("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(Y("span","spacer")),a.appendChild(Y("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(Y("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(Y("span","preview",J(l)));else if("boolean"==typeof l){a.appendChild(Y("span","bool",String(l)));const t=Y("input","check");t.type="checkbox",t.checked=l,t.onchange=()=>{n[e]=t.checked,t.blur(),pe()},a.appendChild(t)}else{const t=Y("input","val");t.value=J(l),t.onfocus=()=>{t.value="string"==typeof l?l:String(l)},t.onkeydown=e=>{"Enter"===e.key&&t.blur(),"Escape"===e.key&&(t.value=J(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=J(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=Y("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=()=>{f=!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 g=document.createElement("style");g.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(g),s=Y("div","highlight"),t.appendChild(s),(r=Y("div","pill","\u26a1 LiteVue")).onclick=()=>{r.style.display="none",o.style.display="flex",R(),M({open:!0}),pe()},t.appendChild(r),(o=Y("div","panel")).style.display="none";const x=Y("div","header");x.appendChild(Y("span","title","\u26a1 LiteVue")),x.addEventListener("mousedown",e=>{if(e.target.closest(".btn"))return;if("float"!==b)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=E(t-(e.clientX-i),0,window.innerWidth-o.offsetWidth)+"px",o.style.bottom=E(r-(e.clientY-d),0,window.innerHeight-o.offsetHeight)+"px"},a=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a),M({right:parseInt(o.style.right)||12,bottom:parseInt(o.style.bottom)||12})};document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)});const _=Y("div","grip");_.addEventListener("mousedown",e=>{e.preventDefault(),_.classList.add("active");const n=o.getBoundingClientRect(),t=e.clientX,r=e.clientY,i=n.width,d=n.height,l=e=>{if("right"!==b){const n="bottom"===b?r-e.clientY:e.clientY-r;o.style.height=E(d+n,320,window.innerHeight-24)+"px"}if("bottom"!==b){const n="right"===b?t-e.clientX:e.clientX-t;o.style.width=E(i+n,320,window.innerWidth-24)+"px"}},a=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a),_.classList.remove("active");const e=parseInt(o.style.width),n=parseInt(o.style.height);M("float"===b?{w:e,h:n}:"bottom"===b?{bh:n}:{rw:e})};document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)}),(p=Y("button","btn")).onclick=()=>{X(I[b]),M({dock:b})},x.appendChild(p),(a=Y("button","btn")).onclick=()=>{P=T[P];try{localStorage.setItem(S,P)}catch{}H()},x.appendChild(a),D.addEventListener("change",()=>{"system"===P&&H()}),H(),(l=Y("button","btn")).title="pick an element on the page",l.innerHTML=O('<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=()=>f?ae():(f=!0,l.classList.add("active"),document.addEventListener("click",de,!0),void document.addEventListener("mousemove",le,!0)),x.appendChild(l);const j=Y("button","btn","\u2715");j.onclick=()=>{f&&ae(),o.style.display="none",r.style.display="",M({open:!1})},x.appendChild(j),o.appendChild(x);const z=Y("div","body"),N=Y("div","side"),W=Y("div","tabs");(c=Y("div","tab active")).onclick=()=>K("Elements"),(h=Y("div","tab")).onclick=()=>K("Stores"),W.appendChild(c),W.appendChild(h),N.appendChild(W);const V=Y("input","filter");V.placeholder="Filter by name or state",V.oninput=()=>{v=V.value.trim().toLowerCase(),ne()},V.onkeydown=e=>{"Escape"===e.key&&(V.value="",v="",ne())},N.appendChild(V),i=Y("div","tree"),N.appendChild(i),d=Y("div","state"),z.appendChild(N),z.appendChild(d),o.appendChild(z),o.appendChild(_),t.appendChild(o);const A=$();A.w&&(m=o.style.width=A.w+"px"),A.h&&(y=o.style.height=A.h+"px"),null!=A.right&&(w=o.style.right=A.right+"px"),null!=A.bottom&&(k=o.style.bottom=A.bottom+"px"),A.bh&&(C=A.bh+"px"),A.rw&&(L=A.rw+"px"),X(A.dock||"float"),document.body.appendChild(e),A.open&&(r.style.display="none",o.style.display="flex",R(),pe()),n.on("scope:mount",pe),n.on("scope:unmount",e=>{e===u&&(u=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,d,l,a,s,p,c,h,u=null,g=null,f=!1,v="",x="Elements",b="float",m="",y="",w="",k="",C="",L="",E=(e,n,t)=>Math.min(Math.max(e,n),Math.max(n,t)),O=e=>'<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">'+e+"</svg>",S="litevue-devtools-theme",_="litevue-devtools-ui",$=()=>{try{return JSON.parse(localStorage.getItem(_)||"{}")}catch{return{}}},M=e=>{try{localStorage.setItem(_,JSON.stringify({...$(),...e}))}catch{}},j={dark:O('<path d="M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z"/>'),light:O('<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:O('<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"/>')},z={float:O('<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:O('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="2" y="14" width="20" height="7" fill="currentColor"/>'),right:O('<rect x="2" y="3" width="20" height="18" rx="1"/><rect x="14" y="3" width="8" height="18" fill="currentColor"/>')},I={float:"bottom",bottom:"right",right:"float"},N={float:"floating",bottom:"docked to bottom",right:"docked to right"},T={dark:"light",light:"system",system:"dark"},P="dark";try{const e=localStorage.getItem(S);"light"!==e&&"system"!==e||(P=e)}catch{}var D=matchMedia("(prefers-color-scheme: light)"),H=()=>{const e="light"===P||"system"===P&&D.matches;t.host.classList.toggle("light",e),a.innerHTML=j[P],a.title="theme: "+P},W=new Set,V=new WeakSet,R=()=>{if("float"!==b)return;const e=parseInt(o.style.right)||0,n=parseInt(o.style.bottom)||0;w=o.style.right=E(e,0,window.innerWidth-o.offsetWidth)+"px",k=o.style.bottom=E(n,0,window.innerHeight-o.offsetHeight)+"px"},X=e=>{"float"===b?(m=o.style.width||m,y=o.style.height||y,w=o.style.right||w,k=o.style.bottom||k):"bottom"===b?C=o.style.height||C:L=o.style.width||L,b=e;const n="float"!==e;o.classList.toggle("dock-bottom","bottom"===e),o.classList.toggle("dock-right","right"===e),o.style.right=n?"":w,o.style.bottom=n?"":k,o.style.width="bottom"===e?"":"right"===e?L:m,o.style.height="right"===e?"":"bottom"===e?C:y,p.innerHTML=z[e],p.title="panel: "+N[e]},Y=(e,n,t)=>{const o=document.createElement(e);return o.className=n,null!=t&&(o.textContent=t),o},A=e=>{const n=Y("span","label");return n.appendChild(Y("span","punct","<")),n.appendChild(Y("span","name",ee(e))),n.appendChild(Y("span","punct",">")),n},B=e=>{let t=e.parentElement;for(;t;){if(n.scopes.has(t))return t;t=t.parentElement}return null},F=(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)},J=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},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!==u&&W.clear(),g=null,u=e,x="Elements",window.$scope=e?n.scopes.get(e):void 0,ne(),te()},Z=e=>{e!==g&&W.clear(),u=null,g=e,x="Stores",window.$scope=n.stores.get(e),ne(),te()},K=e=>{x=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"===x?"tab active":"tab",h.textContent=`Stores (${e})`,h.className="Stores"===x?"tab active":"tab"})(),i.textContent="","Elements"===x){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(!v||ee(i).toLowerCase().includes(v))t.set(i,void 0);else{const e=F(n.scopes.get(i),v);e&&t.set(i,e)}if(!t.size)return void i.appendChild(Y("div","empty",v?"no matching scopes":"no scopes mounted"));const o=new Set;for(const n of t.keys()){o.add(n);for(let e=B(n);e;e=B(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=B(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(V.has(n))return!0;return!1};for(const s of e){if(!o.has(s)||a(s))continue;const e=Y("div",s===u?"row sel":"row");e.style.paddingLeft=8+12*(l.get(s)??0)+"px";const r=V.has(s);if(d.get(s)){const n=Y("span",r?"arrow":"arrow open","\u25b6");n.onclick=e=>{e.stopPropagation(),r?V.delete(s):V.add(s),ne()},e.appendChild(n)}else e.appendChild(Y("span","spacer"));e.appendChild(A(s));const p=n.exps.get(s);p&&e.appendChild(Y("span","exp"," "+p));const c=t.get(s);c&&e.appendChild(Y("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(!v||o.toLowerCase().includes(v))e.set(o,void 0);else{const t=F(n.stores.get(o),v);t&&e.set(o,t)}const t=[...e.keys()];if(t.length)for(const n of t){const t=Y("div",n===g?"row sel":"row"),o=Y("span","label");o.appendChild(Y("span","punct","$store.")),o.appendChild(Y("span","name",n)),t.appendChild(o);const r=e.get(n);r&&t.appendChild(Y("span","hit"," "+r)),t.onclick=()=>Z(n),i.appendChild(t)}else i.appendChild(Y("div","empty",v?"no matching stores":"no stores registered"))},te=()=>{if(d.contains(t.activeElement))return;d.textContent="";const e=g?n.stores.get(g):u?n.scopes.get(u):void 0;if(!e)return void d.appendChild(Y("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(Y("div","divider","inherited")),r.forEach(n=>re(n,e,n,0,"prop inherited",[]))),o.length||r.length||d.appendChild(Y("div","empty","empty scope")),d.appendChild(oe(e))},oe=e=>{const n=Y("div","prop adder");n.appendChild(Y("span","spacer"));const t=Y("input","val key-in");t.placeholder="key";const o=Y("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=Y("div",r);if(a.style.paddingLeft=8+14*o+"px",null!==l&&"object"==typeof l){const s=i.indexOf(l)>-1,p=!s&&W.has(t);if(a.appendChild(Y("span",p?"arrow open":"arrow","\u25b6")),a.appendChild(Y("span","key",e)),a.appendChild(Y("span","preview",s?"(circular)":(e=>Array.isArray(e)?`(${e.length}) ${J(e)}`:J(e))(l))),s||(a.classList.add("toggle"),a.onclick=()=>{p?W.delete(t):W.add(t),te()}),ie(a,n,e,o,r),d.appendChild(a),p){const e=Object.keys(l);if(!e.length){const e=Y("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(Y("span","spacer")),a.appendChild(Y("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(Y("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(Y("span","preview",J(l)));else if("boolean"==typeof l){a.appendChild(Y("span","bool",String(l)));const t=Y("input","check");t.type="checkbox",t.checked=l,t.onchange=()=>{n[e]=t.checked,t.blur(),pe()},a.appendChild(t)}else{const t=Y("input","val");t.value=J(l),t.onfocus=()=>{t.value="string"==typeof l?l:String(l)},t.onkeydown=e=>{"Enter"===e.key&&t.blur(),"Escape"===e.key&&(t.value=J(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=J(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=Y("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=()=>{f=!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 g=document.createElement("style");g.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(g),s=Y("div","highlight"),t.appendChild(s),(r=Y("div","pill","\u26a1 LiteVue")).onclick=()=>{r.style.display="none",o.style.display="flex",R(),M({open:!0}),pe()},t.appendChild(r),(o=Y("div","panel")).style.display="none";const x=Y("div","header");x.appendChild(Y("span","title","\u26a1 LiteVue")),x.addEventListener("mousedown",e=>{if(e.target.closest(".btn"))return;if("float"!==b)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=E(t-(e.clientX-i),0,window.innerWidth-o.offsetWidth)+"px",o.style.bottom=E(r-(e.clientY-d),0,window.innerHeight-o.offsetHeight)+"px"},a=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a),M({right:parseInt(o.style.right)||12,bottom:parseInt(o.style.bottom)||12})};document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)});const _=Y("div","grip");_.addEventListener("mousedown",e=>{e.preventDefault(),_.classList.add("active");const n=o.getBoundingClientRect(),t=e.clientX,r=e.clientY,i=n.width,d=n.height,l=e=>{if("right"!==b){const n="bottom"===b?r-e.clientY:e.clientY-r;o.style.height=E(d+n,320,window.innerHeight-24)+"px"}if("bottom"!==b){const n="right"===b?t-e.clientX:e.clientX-t;o.style.width=E(i+n,320,window.innerWidth-24)+"px"}},a=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a),_.classList.remove("active");const e=parseInt(o.style.width),n=parseInt(o.style.height);M("float"===b?{w:e,h:n}:"bottom"===b?{bh:n}:{rw:e})};document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)}),(p=Y("button","btn")).onclick=()=>{X(I[b]),M({dock:b})},x.appendChild(p),(a=Y("button","btn")).onclick=()=>{P=T[P];try{localStorage.setItem(S,P)}catch{}H()},x.appendChild(a),D.addEventListener("change",()=>{"system"===P&&H()}),H(),(l=Y("button","btn")).title="pick an element on the page",l.innerHTML=O('<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=()=>f?ae():(f=!0,l.classList.add("active"),document.addEventListener("click",de,!0),void document.addEventListener("mousemove",le,!0)),x.appendChild(l);const j=Y("button","btn","\u2715");j.onclick=()=>{f&&ae(),o.style.display="none",r.style.display="",M({open:!1})},x.appendChild(j),o.appendChild(x);const z=Y("div","body"),N=Y("div","side"),W=Y("div","tabs");(c=Y("div","tab active")).onclick=()=>K("Elements"),(h=Y("div","tab")).onclick=()=>K("Stores"),W.appendChild(c),W.appendChild(h),N.appendChild(W);const V=Y("input","filter");V.placeholder="Filter by name or state",V.oninput=()=>{v=V.value.trim().toLowerCase(),ne()},V.onkeydown=e=>{"Escape"===e.key&&(V.value="",v="",ne())},N.appendChild(V),i=Y("div","tree"),N.appendChild(i),d=Y("div","state"),z.appendChild(N),z.appendChild(d),o.appendChild(z),o.appendChild(_),t.appendChild(o);const A=$();A.w&&(m=o.style.width=A.w+"px"),A.h&&(y=o.style.height=A.h+"px"),null!=A.right&&(w=o.style.right=A.right+"px"),null!=A.bottom&&(k=o.style.bottom=A.bottom+"px"),A.bh&&(C=A.bh+"px"),A.rw&&(L=A.rw+"px"),X(A.dock||"float"),document.body.appendChild(e),A.open&&(r.style.display="none",o.style.display="flex",R(),pe()),n.on("scope:mount",pe),n.on("scope:unmount",e=>{e===u&&(u=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});
|