@aevantec/litevue 0.5.10 → 0.5.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/litevue-devtools.iife.js +1 -1
- package/dist/litevue-devtools.mjs +1 -1
- package/dist/litevue-devtools.umd.js +1 -1
- package/dist/litevue-plugins.dev.iife.js +23 -5
- package/dist/litevue-plugins.dev.mjs +23 -5
- package/dist/litevue-plugins.iife.js +1 -1
- package/dist/litevue-plugins.mjs +1 -1
- package/dist/litevue-plugins.umd.js +1 -1
- package/dist/litevue.dev.iife.js +32 -1
- package/dist/litevue.dev.mjs +32 -1
- package/dist/litevue.iife.js +1 -1
- package/dist/litevue.mjs +1 -1
- package/dist/litevue.umd.js +1 -1
- package/dist/plugins/morph.dev.iife.js +10 -2
- package/dist/plugins/morph.dev.mjs +10 -2
- package/dist/plugins/morph.iife.js +1 -1
- package/dist/plugins/morph.mjs +1 -1
- package/dist/plugins/morph.umd.js +1 -1
- package/dist/plugins/navigate.dev.iife.js +193 -0
- package/dist/plugins/navigate.dev.mjs +189 -0
- package/dist/plugins/navigate.iife.js +1 -0
- package/dist/plugins/navigate.mjs +1 -0
- package/dist/plugins/navigate.umd.js +1 -0
- package/dist/plugins/popover.iife.js +1 -0
- package/dist/plugins/popover.mjs +1 -0
- package/dist/plugins/popover.umd.js +1 -0
- package/dist/plugins/resize.iife.js +1 -1
- package/dist/plugins/resize.mjs +1 -1
- package/dist/plugins/resize.umd.js +1 -1
- package/dist/types/devtools-panel/plugins.d.mts +10 -0
- package/dist/types/devtools-panel/plugins.d.ts +10 -0
- package/dist/types/devtools-panel/styles.d.mts +4 -1
- package/dist/types/devtools-panel/styles.d.ts +4 -1
- package/dist/types/devtools.d.mts +28 -1
- package/dist/types/devtools.d.ts +28 -1
- package/dist/types/plugins/navigate/index.d.mts +19 -0
- package/dist/types/plugins/navigate/index.d.ts +19 -0
- package/dist/types/plugins/popover/index.d.mts +2 -0
- package/dist/types/plugins/popover/index.d.ts +2 -0
- package/dist/types/plugins/resize/index.d.mts +5 -2
- package/dist/types/plugins/resize/index.d.ts +5 -2
- package/package.json +28 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/** Selector matching every scope root, deferred or not. */
|
|
2
|
+
var SCOPE_SELECTOR = ["[v-scope]", ...[
|
|
3
|
+
"visible",
|
|
4
|
+
"idle",
|
|
5
|
+
"interaction"
|
|
6
|
+
].map((m) => `[v-scope\\.${m}]`)].join(",");
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/plugins/navigate/index.ts
|
|
9
|
+
var STATUS_ID = "litevue-navigate-status";
|
|
10
|
+
var isLocal = (url) => url.origin === location.origin;
|
|
11
|
+
var pathOf = (url) => url.pathname + url.search;
|
|
12
|
+
var optedOut = (el) => !!el.closest("[data-navigate=\"false\"]");
|
|
13
|
+
var emit = (name, detail, cancelable = false) => document.dispatchEvent(new CustomEvent("navigate:" + name, {
|
|
14
|
+
detail,
|
|
15
|
+
cancelable
|
|
16
|
+
}));
|
|
17
|
+
var assets = (doc) => [...doc.head.querySelectorAll("[data-navigate-track]")].map((el) => el.getAttribute("src") || el.getAttribute("href")).sort().join();
|
|
18
|
+
/**
|
|
19
|
+
* Adds the next page's head elements and returns a function dropping the
|
|
20
|
+
* current page's, run after the swap so the old styles hold until then.
|
|
21
|
+
* Scripts are left out both ways: fetched ones never run, and removing a
|
|
22
|
+
* script does not unload it. New stylesheets load before the swap.
|
|
23
|
+
*/
|
|
24
|
+
var mergeHead = async (doc) => {
|
|
25
|
+
const sel = "link,style,meta";
|
|
26
|
+
const live = [...document.head.querySelectorAll(sel)];
|
|
27
|
+
const loads = [];
|
|
28
|
+
for (const el of doc.head.querySelectorAll(sel)) {
|
|
29
|
+
const i = live.findIndex((l) => l.isEqualNode(el));
|
|
30
|
+
if (i > -1) {
|
|
31
|
+
live.splice(i, 1);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
const fresh = document.importNode(el, true);
|
|
35
|
+
if (fresh.matches("link[rel=stylesheet]")) loads.push(new Promise((r) => {
|
|
36
|
+
fresh.addEventListener("load", r);
|
|
37
|
+
fresh.addEventListener("error", r);
|
|
38
|
+
}));
|
|
39
|
+
document.head.append(fresh);
|
|
40
|
+
}
|
|
41
|
+
await Promise.all(loads);
|
|
42
|
+
return () => live.forEach((el) => el.matches("[data-navigate-preserve]") || el.remove());
|
|
43
|
+
};
|
|
44
|
+
var hasCtxAbove = (el) => {
|
|
45
|
+
for (; el; el = el.parentElement) if (el.__ctx) return true;
|
|
46
|
+
return false;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Morph with the app's roots kept in step. Under a mounted scope morph binds
|
|
50
|
+
* and releases nodes itself; at page level there is no scope, so roots the
|
|
51
|
+
* page removes are unmounted and roots it adds are mounted here.
|
|
52
|
+
*/
|
|
53
|
+
var render = (app, patch, from, to) => {
|
|
54
|
+
const roots = [from, ...from.querySelectorAll("*")].filter((el) => el.__ctx && !hasCtxAbove(el.parentElement));
|
|
55
|
+
const added = [];
|
|
56
|
+
patch(from, to, { beforeNodeAdded: (node) => {
|
|
57
|
+
node.nodeType === 1 && added.push(node);
|
|
58
|
+
} });
|
|
59
|
+
roots.forEach((el) => el.isConnected || app.unmount(el));
|
|
60
|
+
added.forEach((el) => el.isConnected && !hasCtxAbove(el) && (el.matches(SCOPE_SELECTOR) || el.querySelector(SCOPE_SELECTOR)) && app.mount(el));
|
|
61
|
+
};
|
|
62
|
+
var navigate = (app, options = {}) => {
|
|
63
|
+
const target = options.target || "body";
|
|
64
|
+
let controller;
|
|
65
|
+
let rendered = pathOf(location);
|
|
66
|
+
const posting = /* @__PURE__ */ new WeakSet();
|
|
67
|
+
const restoration = history.scrollRestoration;
|
|
68
|
+
history.scrollRestoration = "manual";
|
|
69
|
+
const status = document.createElement("div");
|
|
70
|
+
status.id = STATUS_ID;
|
|
71
|
+
status.setAttribute("aria-live", "polite");
|
|
72
|
+
status.setAttribute("data-morph-preserve", "");
|
|
73
|
+
status.style.cssText = "position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)";
|
|
74
|
+
document.body.append(status);
|
|
75
|
+
const show = (from, doc, url, push, dropOld, y) => {
|
|
76
|
+
if (push) history[url.href === location.href ? "replaceState" : "pushState"]({}, "", url.href);
|
|
77
|
+
rendered = pathOf(location);
|
|
78
|
+
document.title = doc.title;
|
|
79
|
+
render(app, app.scope.$morph, from, doc.querySelector(target));
|
|
80
|
+
dropOld();
|
|
81
|
+
if (options.scroll !== false) {
|
|
82
|
+
const anchor = y == null && url.hash && document.getElementById(url.hash.slice(1));
|
|
83
|
+
anchor ? anchor.scrollIntoView() : scrollTo(0, y || 0);
|
|
84
|
+
}
|
|
85
|
+
const auto = from.querySelector("[autofocus]");
|
|
86
|
+
if (auto) auto.focus();
|
|
87
|
+
else if (from === document.body) document.activeElement?.blur?.();
|
|
88
|
+
else {
|
|
89
|
+
from.hasAttribute("tabindex") || from.setAttribute("tabindex", "-1");
|
|
90
|
+
from.focus({ preventScroll: true });
|
|
91
|
+
}
|
|
92
|
+
status.textContent = document.title || document.querySelector("h1")?.textContent?.trim() || location.pathname;
|
|
93
|
+
emit("after", { url: url.href });
|
|
94
|
+
};
|
|
95
|
+
const go = async (href, init = {}, y) => {
|
|
96
|
+
if (!emit("before", { url: href }, true)) return;
|
|
97
|
+
controller?.abort();
|
|
98
|
+
const c = controller = new AbortController();
|
|
99
|
+
const post = init.method === "POST";
|
|
100
|
+
if (y == null) history.replaceState({
|
|
101
|
+
...history.state,
|
|
102
|
+
y: scrollY
|
|
103
|
+
}, "");
|
|
104
|
+
try {
|
|
105
|
+
if (!app.scope.$morph) {
|
|
106
|
+
console.error("[navigate] needs the morph plugin: app.use(morphPlugin).use(navigate)");
|
|
107
|
+
throw new Error("navigate needs the morph plugin");
|
|
108
|
+
}
|
|
109
|
+
const res = await fetch(href, {
|
|
110
|
+
...init,
|
|
111
|
+
signal: c.signal,
|
|
112
|
+
headers: { "X-Requested-With": "litevue" }
|
|
113
|
+
});
|
|
114
|
+
const url = new URL(res.url || href);
|
|
115
|
+
url.hash ||= new URL(href).hash;
|
|
116
|
+
if (!res.headers.get("content-type")?.includes("text/html") || !isLocal(url) || !res.ok && !post) throw new Error(`cannot render ${res.status} from ${url.href}`);
|
|
117
|
+
const html = await res.text();
|
|
118
|
+
if (c !== controller) return;
|
|
119
|
+
const doc = new DOMParser().parseFromString(html, "text/html");
|
|
120
|
+
const from = document.querySelector(target);
|
|
121
|
+
if (!from || !doc.querySelector(target)) throw new Error(`no ${target} in ${url.href}`);
|
|
122
|
+
if (assets(doc) !== assets(document)) throw new Error(`${url.href} loads different scripts or styles`);
|
|
123
|
+
doc.querySelectorAll("script").forEach((s) => s.remove());
|
|
124
|
+
const dropOld = await mergeHead(doc);
|
|
125
|
+
const run = () => c === controller && show(from, doc, url, res.ok && y == null, dropOld, y);
|
|
126
|
+
options.transition && document.startViewTransition ? document.startViewTransition(run) : run();
|
|
127
|
+
} catch (error) {
|
|
128
|
+
if (c.signal.aborted) return;
|
|
129
|
+
emit("error", {
|
|
130
|
+
url: href,
|
|
131
|
+
error
|
|
132
|
+
});
|
|
133
|
+
if (!post) location.assign(href);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const onClick = (e) => {
|
|
137
|
+
if (e.defaultPrevented || e.button || e.metaKey || e.ctrlKey) return;
|
|
138
|
+
if (e.shiftKey || e.altKey) return;
|
|
139
|
+
const a = e.target.closest?.("a[href]");
|
|
140
|
+
if (!a || optedOut(a) || a.hasAttribute("download")) return;
|
|
141
|
+
if (a.target && a.target !== "_self") return;
|
|
142
|
+
const url = new URL(a.href, location.href);
|
|
143
|
+
if (!isLocal(url)) return;
|
|
144
|
+
if (url.hash && pathOf(url) === pathOf(location)) return;
|
|
145
|
+
e.preventDefault();
|
|
146
|
+
go(url.href);
|
|
147
|
+
};
|
|
148
|
+
const onSubmit = (e) => {
|
|
149
|
+
const form = e.target;
|
|
150
|
+
const by = e.submitter;
|
|
151
|
+
const attr = (name) => by?.getAttribute("form" + name) || form.getAttribute(name);
|
|
152
|
+
const method = (attr("method") || "get").toLowerCase();
|
|
153
|
+
const where = attr("target");
|
|
154
|
+
if (e.defaultPrevented || method === "dialog" || optedOut(form)) return;
|
|
155
|
+
if (where && where !== "_self") return;
|
|
156
|
+
const url = new URL(attr("action") || location.href, location.href);
|
|
157
|
+
if (!isLocal(url)) return;
|
|
158
|
+
const data = new FormData(form);
|
|
159
|
+
if (by?.name) data.append(by.name, by.value);
|
|
160
|
+
e.preventDefault();
|
|
161
|
+
if (method === "post") {
|
|
162
|
+
if (posting.has(form)) return;
|
|
163
|
+
posting.add(form);
|
|
164
|
+
return go(url.href, {
|
|
165
|
+
method: "POST",
|
|
166
|
+
body: data
|
|
167
|
+
}).finally(() => posting.delete(form));
|
|
168
|
+
}
|
|
169
|
+
url.search = new URLSearchParams(data).toString();
|
|
170
|
+
go(url.href);
|
|
171
|
+
};
|
|
172
|
+
const onPop = (e) => {
|
|
173
|
+
if (pathOf(location) === rendered) return;
|
|
174
|
+
go(location.href, {}, e.state?.y || 0);
|
|
175
|
+
};
|
|
176
|
+
document.addEventListener("click", onClick);
|
|
177
|
+
document.addEventListener("submit", onSubmit);
|
|
178
|
+
addEventListener("popstate", onPop);
|
|
179
|
+
return () => {
|
|
180
|
+
controller?.abort();
|
|
181
|
+
document.removeEventListener("click", onClick);
|
|
182
|
+
document.removeEventListener("submit", onSubmit);
|
|
183
|
+
removeEventListener("popstate", onPop);
|
|
184
|
+
history.scrollRestoration = restoration;
|
|
185
|
+
status.remove();
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
//#endregion
|
|
189
|
+
export { navigate };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var LiteVueNavigate=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var t=["[v-scope]",...["visible","idle","interaction"].map(e=>`[v-scope\\.${e}]`)].join(","),r=e=>e.origin===location.origin,o=e=>e.pathname+e.search,n=e=>!!e.closest('[data-navigate="false"]'),a=(e,t,r=!1)=>document.dispatchEvent(new CustomEvent("navigate:"+e,{detail:t,cancelable:r})),i=e=>[...e.head.querySelectorAll("[data-navigate-track]")].map(e=>e.getAttribute("src")||e.getAttribute("href")).sort().join(),s=e=>{for(;e;e=e.parentElement)if(e.__ctx)return!0;return!1};return e.navigate=(e,l={})=>{const c=l.target||"body";let u,d=o(location);const h=new WeakSet,f=history.scrollRestoration;history.scrollRestoration="manual";const m=document.createElement("div");m.id="litevue-navigate-status",m.setAttribute("aria-live","polite"),m.setAttribute("data-morph-preserve",""),m.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)",document.body.append(m);const p=(r,n,i,u,h,f)=>{if(u&&history[i.href===location.href?"replaceState":"pushState"]({},"",i.href),d=o(location),document.title=n.title,((e,r,o,n)=>{const a=[o,...o.querySelectorAll("*")].filter(e=>e.__ctx&&!s(e.parentElement)),i=[];r(o,n,{beforeNodeAdded:e=>{1===e.nodeType&&i.push(e)}}),a.forEach(t=>t.isConnected||e.unmount(t)),i.forEach(r=>r.isConnected&&!s(r)&&(r.matches(t)||r.querySelector(t))&&e.mount(r))})(e,e.scope.$morph,r,n.querySelector(c)),h(),!1!==l.scroll){const e=null==f&&i.hash&&document.getElementById(i.hash.slice(1));e?e.scrollIntoView():scrollTo(0,f||0)}const p=r.querySelector("[autofocus]");p?p.focus():r===document.body?document.activeElement?.blur?.():(r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),r.focus({preventScroll:!0})),m.textContent=document.title||document.querySelector("h1")?.textContent?.trim()||location.pathname,a("after",{url:i.href})},v=async(t,o={},n)=>{if(!a("before",{url:t},!0))return;u?.abort();const s=u=new AbortController,d="POST"===o.method;null==n&&history.replaceState({...history.state,y:scrollY},"");try{if(!e.scope.$morph)throw new Error("navigate needs the morph plugin");const a=await fetch(t,{...o,signal:s.signal,headers:{"X-Requested-With":"litevue"}}),h=new URL(a.url||t);if(h.hash||=new URL(t).hash,!a.headers.get("content-type")?.includes("text/html")||!r(h)||!a.ok&&!d)throw new Error(`cannot render ${a.status} from ${h.href}`);const f=await a.text();if(s!==u)return;const m=(new DOMParser).parseFromString(f,"text/html"),v=document.querySelector(c);if(!v||!m.querySelector(c))throw new Error(`no ${c} in ${h.href}`);if(i(m)!==i(document))throw new Error(`${h.href} loads different scripts or styles`);m.querySelectorAll("script").forEach(e=>e.remove());const y=await(async e=>{const t="link,style,meta",r=[...document.head.querySelectorAll(t)],o=[];for(const n of e.head.querySelectorAll(t)){const e=r.findIndex(e=>e.isEqualNode(n));if(e>-1){r.splice(e,1);continue}const t=document.importNode(n,!0);t.matches("link[rel=stylesheet]")&&o.push(new Promise(e=>{t.addEventListener("load",e),t.addEventListener("error",e)})),document.head.append(t)}return await Promise.all(o),()=>r.forEach(e=>e.matches("[data-navigate-preserve]")||e.remove())})(m),g=()=>s===u&&p(v,m,h,a.ok&&null==n,y,n);l.transition&&document.startViewTransition?document.startViewTransition(g):g()}catch(h){if(s.signal.aborted)return;a("error",{url:t,error:h}),d||location.assign(t)}},y=e=>{if(e.defaultPrevented||e.button||e.metaKey||e.ctrlKey)return;if(e.shiftKey||e.altKey)return;const t=e.target.closest?.("a[href]");if(!t||n(t)||t.hasAttribute("download"))return;if(t.target&&"_self"!==t.target)return;const a=new URL(t.href,location.href);r(a)&&(a.hash&&o(a)===o(location)||(e.preventDefault(),v(a.href)))},g=e=>{const t=e.target,o=e.submitter,a=e=>o?.getAttribute("form"+e)||t.getAttribute(e),i=(a("method")||"get").toLowerCase(),s=a("target");if(e.defaultPrevented||"dialog"===i||n(t))return;if(s&&"_self"!==s)return;const l=new URL(a("action")||location.href,location.href);if(!r(l))return;const c=new FormData(t);if(o?.name&&c.append(o.name,o.value),e.preventDefault(),"post"===i){if(h.has(t))return;return h.add(t),v(l.href,{method:"POST",body:c}).finally(()=>h.delete(t))}l.search=new URLSearchParams(c).toString(),v(l.href)},b=e=>{o(location)!==d&&v(location.href,{},e.state?.y||0)};return document.addEventListener("click",y),document.addEventListener("submit",g),addEventListener("popstate",b),()=>{u?.abort(),document.removeEventListener("click",y),document.removeEventListener("submit",g),removeEventListener("popstate",b),history.scrollRestoration=f,m.remove()}},e}({});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=["[v-scope]",...["visible","idle","interaction"].map(e=>`[v-scope\\.${e}]`)].join(","),t=e=>e.origin===location.origin,r=e=>e.pathname+e.search,o=e=>!!e.closest('[data-navigate="false"]'),n=(e,t,r=!1)=>document.dispatchEvent(new CustomEvent("navigate:"+e,{detail:t,cancelable:r})),a=e=>[...e.head.querySelectorAll("[data-navigate-track]")].map(e=>e.getAttribute("src")||e.getAttribute("href")).sort().join(),i=e=>{for(;e;e=e.parentElement)if(e.__ctx)return!0;return!1},s=(s,l={})=>{const c=l.target||"body";let u,d=r(location);const h=/* @__PURE__ */new WeakSet,m=history.scrollRestoration;history.scrollRestoration="manual";const f=document.createElement("div");f.id="litevue-navigate-status",f.setAttribute("aria-live","polite"),f.setAttribute("data-morph-preserve",""),f.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)",document.body.append(f);const p=(t,o,a,u,h,m)=>{if(u&&history[a.href===location.href?"replaceState":"pushState"]({},"",a.href),d=r(location),document.title=o.title,((t,r,o,n)=>{const a=[o,...o.querySelectorAll("*")].filter(e=>e.__ctx&&!i(e.parentElement)),s=[];r(o,n,{beforeNodeAdded:e=>{1===e.nodeType&&s.push(e)}}),a.forEach(e=>e.isConnected||t.unmount(e)),s.forEach(r=>r.isConnected&&!i(r)&&(r.matches(e)||r.querySelector(e))&&t.mount(r))})(s,s.scope.$morph,t,o.querySelector(c)),h(),!1!==l.scroll){const e=null==m&&a.hash&&document.getElementById(a.hash.slice(1));e?e.scrollIntoView():scrollTo(0,m||0)}const p=t.querySelector("[autofocus]");p?p.focus():t===document.body?document.activeElement?.blur?.():(t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0})),f.textContent=document.title||document.querySelector("h1")?.textContent?.trim()||location.pathname,n("after",{url:a.href})},v=async(e,r={},o)=>{if(!n("before",{url:e},!0))return;u?.abort();const i=u=new AbortController,d="POST"===r.method;null==o&&history.replaceState({...history.state,y:scrollY},"");try{if(!s.scope.$morph)throw new Error("navigate needs the morph plugin");const n=await fetch(e,{...r,signal:i.signal,headers:{"X-Requested-With":"litevue"}}),h=new URL(n.url||e);if(h.hash||=new URL(e).hash,!n.headers.get("content-type")?.includes("text/html")||!t(h)||!n.ok&&!d)throw new Error(`cannot render ${n.status} from ${h.href}`);const m=await n.text();if(i!==u)return;const f=(new DOMParser).parseFromString(m,"text/html"),v=document.querySelector(c);if(!v||!f.querySelector(c))throw new Error(`no ${c} in ${h.href}`);if(a(f)!==a(document))throw new Error(`${h.href} loads different scripts or styles`);f.querySelectorAll("script").forEach(e=>e.remove());const y=await(async e=>{const t="link,style,meta",r=[...document.head.querySelectorAll(t)],o=[];for(const n of e.head.querySelectorAll(t)){const e=r.findIndex(e=>e.isEqualNode(n));if(e>-1){r.splice(e,1);continue}const t=document.importNode(n,!0);t.matches("link[rel=stylesheet]")&&o.push(new Promise(e=>{t.addEventListener("load",e),t.addEventListener("error",e)})),document.head.append(t)}return await Promise.all(o),()=>r.forEach(e=>e.matches("[data-navigate-preserve]")||e.remove())})(f),g=()=>i===u&&p(v,f,h,n.ok&&null==o,y,o);l.transition&&document.startViewTransition?document.startViewTransition(g):g()}catch(h){if(i.signal.aborted)return;n("error",{url:e,error:h}),d||location.assign(e)}},y=e=>{if(e.defaultPrevented||e.button||e.metaKey||e.ctrlKey)return;if(e.shiftKey||e.altKey)return;const n=e.target.closest?.("a[href]");if(!n||o(n)||n.hasAttribute("download"))return;if(n.target&&"_self"!==n.target)return;const a=new URL(n.href,location.href);t(a)&&(a.hash&&r(a)===r(location)||(e.preventDefault(),v(a.href)))},g=e=>{const r=e.target,n=e.submitter,a=e=>n?.getAttribute("form"+e)||r.getAttribute(e),i=(a("method")||"get").toLowerCase(),s=a("target");if(e.defaultPrevented||"dialog"===i||o(r))return;if(s&&"_self"!==s)return;const l=new URL(a("action")||location.href,location.href);if(!t(l))return;const c=new FormData(r);if(n?.name&&c.append(n.name,n.value),e.preventDefault(),"post"===i){if(h.has(r))return;return h.add(r),v(l.href,{method:"POST",body:c}).finally(()=>h.delete(r))}l.search=new URLSearchParams(c).toString(),v(l.href)},w=e=>{r(location)!==d&&v(location.href,{},e.state?.y||0)};return document.addEventListener("click",y),document.addEventListener("submit",g),addEventListener("popstate",w),()=>{u?.abort(),document.removeEventListener("click",y),document.removeEventListener("submit",g),removeEventListener("popstate",w),history.scrollRestoration=m,f.remove()}};export{s as navigate};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).LiteVueNavigate={})}(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var t=["[v-scope]",...["visible","idle","interaction"].map(e=>`[v-scope\\.${e}]`)].join(","),r=e=>e.origin===location.origin,o=e=>e.pathname+e.search,n=e=>!!e.closest('[data-navigate="false"]'),a=(e,t,r=!1)=>document.dispatchEvent(new CustomEvent("navigate:"+e,{detail:t,cancelable:r})),i=e=>[...e.head.querySelectorAll("[data-navigate-track]")].map(e=>e.getAttribute("src")||e.getAttribute("href")).sort().join(),s=e=>{for(;e;e=e.parentElement)if(e.__ctx)return!0;return!1};e.navigate=(e,l={})=>{const c=l.target||"body";let u,d=o(location);const h=new WeakSet,f=history.scrollRestoration;history.scrollRestoration="manual";const m=document.createElement("div");m.id="litevue-navigate-status",m.setAttribute("aria-live","polite"),m.setAttribute("data-morph-preserve",""),m.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)",document.body.append(m);const p=(r,n,i,u,h,f)=>{if(u&&history[i.href===location.href?"replaceState":"pushState"]({},"",i.href),d=o(location),document.title=n.title,((e,r,o,n)=>{const a=[o,...o.querySelectorAll("*")].filter(e=>e.__ctx&&!s(e.parentElement)),i=[];r(o,n,{beforeNodeAdded:e=>{1===e.nodeType&&i.push(e)}}),a.forEach(t=>t.isConnected||e.unmount(t)),i.forEach(r=>r.isConnected&&!s(r)&&(r.matches(t)||r.querySelector(t))&&e.mount(r))})(e,e.scope.$morph,r,n.querySelector(c)),h(),!1!==l.scroll){const e=null==f&&i.hash&&document.getElementById(i.hash.slice(1));e?e.scrollIntoView():scrollTo(0,f||0)}const p=r.querySelector("[autofocus]");p?p.focus():r===document.body?document.activeElement?.blur?.():(r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),r.focus({preventScroll:!0})),m.textContent=document.title||document.querySelector("h1")?.textContent?.trim()||location.pathname,a("after",{url:i.href})},y=async(t,o={},n)=>{if(!a("before",{url:t},!0))return;u?.abort();const s=u=new AbortController,d="POST"===o.method;null==n&&history.replaceState({...history.state,y:scrollY},"");try{if(!e.scope.$morph)throw new Error("navigate needs the morph plugin");const a=await fetch(t,{...o,signal:s.signal,headers:{"X-Requested-With":"litevue"}}),h=new URL(a.url||t);if(h.hash||=new URL(t).hash,!a.headers.get("content-type")?.includes("text/html")||!r(h)||!a.ok&&!d)throw new Error(`cannot render ${a.status} from ${h.href}`);const f=await a.text();if(s!==u)return;const m=(new DOMParser).parseFromString(f,"text/html"),y=document.querySelector(c);if(!y||!m.querySelector(c))throw new Error(`no ${c} in ${h.href}`);if(i(m)!==i(document))throw new Error(`${h.href} loads different scripts or styles`);m.querySelectorAll("script").forEach(e=>e.remove());const v=await(async e=>{const t="link,style,meta",r=[...document.head.querySelectorAll(t)],o=[];for(const n of e.head.querySelectorAll(t)){const e=r.findIndex(e=>e.isEqualNode(n));if(e>-1){r.splice(e,1);continue}const t=document.importNode(n,!0);t.matches("link[rel=stylesheet]")&&o.push(new Promise(e=>{t.addEventListener("load",e),t.addEventListener("error",e)})),document.head.append(t)}return await Promise.all(o),()=>r.forEach(e=>e.matches("[data-navigate-preserve]")||e.remove())})(m),g=()=>s===u&&p(y,m,h,a.ok&&null==n,v,n);l.transition&&document.startViewTransition?document.startViewTransition(g):g()}catch(h){if(s.signal.aborted)return;a("error",{url:t,error:h}),d||location.assign(t)}},v=e=>{if(e.defaultPrevented||e.button||e.metaKey||e.ctrlKey)return;if(e.shiftKey||e.altKey)return;const t=e.target.closest?.("a[href]");if(!t||n(t)||t.hasAttribute("download"))return;if(t.target&&"_self"!==t.target)return;const a=new URL(t.href,location.href);r(a)&&(a.hash&&o(a)===o(location)||(e.preventDefault(),y(a.href)))},g=e=>{const t=e.target,o=e.submitter,a=e=>o?.getAttribute("form"+e)||t.getAttribute(e),i=(a("method")||"get").toLowerCase(),s=a("target");if(e.defaultPrevented||"dialog"===i||n(t))return;if(s&&"_self"!==s)return;const l=new URL(a("action")||location.href,location.href);if(!r(l))return;const c=new FormData(t);if(o?.name&&c.append(o.name,o.value),e.preventDefault(),"post"===i){if(h.has(t))return;return h.add(t),y(l.href,{method:"POST",body:c}).finally(()=>h.delete(t))}l.search=new URLSearchParams(c).toString(),y(l.href)},b=e=>{o(location)!==d&&y(location.href,{},e.state?.y||0)};return document.addEventListener("click",v),document.addEventListener("submit",g),addEventListener("popstate",b),()=>{u?.abort(),document.removeEventListener("click",v),document.removeEventListener("submit",g),removeEventListener("popstate",b),history.scrollRestoration=f,m.remove()}}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var LiteVuePopover=function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});var e={top:"top","top-start":"top span-right","top-end":"top span-left",bottom:"bottom","bottom-start":"bottom span-right","bottom-end":"bottom span-left",left:"left","left-start":"left span-bottom","left-end":"left span-top",right:"right","right-start":"right span-bottom","right-end":"right span-top"},o={top:"bottom",bottom:"top",left:"right",right:"left"},r=0,s=(t,e,o)=>{if(!t)return;const r=t.style.getPropertyValue("anchor-name").split(/\s*,\s*/).filter(t=>t&&t!==e);o&&r.push(e),t.style.setProperty("anchor-name",r.join())};return t.popover=t=>{t.directive("popover",({el:t,get:e,effect:o,exp:r})=>{const s=t;s.popover||(s.popover="auto");const n=e(`(val) => { ${r} = val }`),i=t=>n("open"===t.newState);return s.addEventListener("toggle",i),o(()=>{const t=!!e();t!==s.matches(":popover-open")&&(t?s.showPopover():s.hidePopover())}),()=>s.removeEventListener("toggle",i)}),t.directive("anchor",({el:t,get:n,effect:i,modifiers:p})=>{const l=t;let a="bottom",f=0;for(const o in p||{}){o in e&&(a=o);const t=/^offset-(\d+)$/.exec(o);t&&(f=+t[1])}const c=l.style.cssText,g=/^(top|bottom)/.test(a);let h;if(l.style.position="fixed",l.style.inset="auto",l.style.margin="0",CSS.supports("anchor-name: --a")){const t="--litevue-anchor-"+ ++r;return l.hasAttribute("popover")||(l.style.position="absolute"),l.style.margin=g?`${f}px 0`:`0 ${f}px`,l.style.setProperty("position-anchor",t),l.style.setProperty("position-area",e[a]),l.style.setProperty("position-try-fallbacks","flip-block, flip-inline"),i(()=>{s(h,t,!1),h=n(),s(h,t,!0)}),()=>{s(h,t,!1),l.style.cssText=c}}const v=()=>{!h||l.popover&&!l.matches(":popover-open")||((t,e,r,s)=>{const[n,i]=r.split("-"),p=e.getBoundingClientRect(),l=t.offsetWidth+s,a=t.offsetHeight+s,f={top:p.top-a,bottom:innerHeight-p.bottom-a,left:p.left-l,right:innerWidth-p.right-l},c=f[n]<0&&f[o[n]]>=0?o[n]:n,g="top"===c||"bottom"===c,[h,v,m]=g?[p.left,p.width,t.offsetWidth]:[p.top,p.height,t.offsetHeight],d="start"===i?h:"end"===i?h+v-m:h+(v-m)/2,b="top"===c?p.top-a:"bottom"===c?p.bottom+s:"left"===c?p.left-l:p.right+s;t.style.left=(g?d:b)+"px",t.style.top=(g?b:d)+"px"})(l,h,a,f)};return i(()=>{h=n(),v()}),addEventListener("scroll",v,!0),addEventListener("resize",v),l.addEventListener("toggle",v),()=>{removeEventListener("scroll",v,!0),removeEventListener("resize",v),l.removeEventListener("toggle",v),l.style.cssText=c}})},t}({});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t={top:"top","top-start":"top span-right","top-end":"top span-left",bottom:"bottom","bottom-start":"bottom span-right","bottom-end":"bottom span-left",left:"left","left-start":"left span-bottom","left-end":"left span-top",right:"right","right-start":"right span-bottom","right-end":"right span-top"},e={top:"bottom",bottom:"top",left:"right",right:"left"},o=0,s=(t,e,o)=>{if(!t)return;const s=t.style.getPropertyValue("anchor-name").split(/\s*,\s*/).filter(t=>t&&t!==e);o&&s.push(e),t.style.setProperty("anchor-name",s.join())},r=r=>{r.directive("popover",({el:t,get:e,effect:o,exp:s})=>{const r=t;r.popover||(r.popover="auto");const n=e(`(val) => { ${s} = val }`),i=t=>n("open"===t.newState);return r.addEventListener("toggle",i),o(()=>{const t=!!e();t!==r.matches(":popover-open")&&(t?r.showPopover():r.hidePopover())}),()=>r.removeEventListener("toggle",i)}),r.directive("anchor",({el:r,get:n,effect:i,modifiers:p})=>{const l=r;let a="bottom",f=0;for(const e in p||{}){e in t&&(a=e);const o=/^offset-(\d+)$/.exec(e);o&&(f=+o[1])}const h=l.style.cssText,c=/^(top|bottom)/.test(a);let g;if(l.style.position="fixed",l.style.inset="auto",l.style.margin="0",CSS.supports("anchor-name: --a")){const e="--litevue-anchor-"+ ++o;return l.hasAttribute("popover")||(l.style.position="absolute"),l.style.margin=c?`${f}px 0`:`0 ${f}px`,l.style.setProperty("position-anchor",e),l.style.setProperty("position-area",t[a]),l.style.setProperty("position-try-fallbacks","flip-block, flip-inline"),i(()=>{s(g,e,!1),g=n(),s(g,e,!0)}),()=>{s(g,e,!1),l.style.cssText=h}}const m=()=>{!g||l.popover&&!l.matches(":popover-open")||((t,o,s,r)=>{const[n,i]=s.split("-"),p=o.getBoundingClientRect(),l=t.offsetWidth+r,a=t.offsetHeight+r,f={top:p.top-a,bottom:innerHeight-p.bottom-a,left:p.left-l,right:innerWidth-p.right-l},h=f[n]<0&&f[e[n]]>=0?e[n]:n,c="top"===h||"bottom"===h,[g,m,v]=c?[p.left,p.width,t.offsetWidth]:[p.top,p.height,t.offsetHeight],d="start"===i?g:"end"===i?g+m-v:g+(m-v)/2,b="top"===h?p.top-a:"bottom"===h?p.bottom+r:"left"===h?p.left-l:p.right+r;t.style.left=(c?d:b)+"px",t.style.top=(c?b:d)+"px"})(l,g,a,f)};return i(()=>{g=n(),m()}),addEventListener("scroll",m,!0),addEventListener("resize",m),l.addEventListener("toggle",m),()=>{removeEventListener("scroll",m,!0),removeEventListener("resize",m),l.removeEventListener("toggle",m),l.style.cssText=h}})};export{r as popover};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).LiteVuePopover={})}(this,function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});var e={top:"top","top-start":"top span-right","top-end":"top span-left",bottom:"bottom","bottom-start":"bottom span-right","bottom-end":"bottom span-left",left:"left","left-start":"left span-bottom","left-end":"left span-top",right:"right","right-start":"right span-bottom","right-end":"right span-top"},o={top:"bottom",bottom:"top",left:"right",right:"left"},s=0,n=(t,e,o)=>{if(!t)return;const s=t.style.getPropertyValue("anchor-name").split(/\s*,\s*/).filter(t=>t&&t!==e);o&&s.push(e),t.style.setProperty("anchor-name",s.join())};t.popover=t=>{t.directive("popover",({el:t,get:e,effect:o,exp:s})=>{const n=t;n.popover||(n.popover="auto");const r=e(`(val) => { ${s} = val }`),i=t=>r("open"===t.newState);return n.addEventListener("toggle",i),o(()=>{const t=!!e();t!==n.matches(":popover-open")&&(t?n.showPopover():n.hidePopover())}),()=>n.removeEventListener("toggle",i)}),t.directive("anchor",({el:t,get:r,effect:i,modifiers:p})=>{const l=t;let f="bottom",a=0;for(const o in p||{}){o in e&&(f=o);const t=/^offset-(\d+)$/.exec(o);t&&(a=+t[1])}const c=l.style.cssText,h=/^(top|bottom)/.test(f);let g;if(l.style.position="fixed",l.style.inset="auto",l.style.margin="0",CSS.supports("anchor-name: --a")){const t="--litevue-anchor-"+ ++s;return l.hasAttribute("popover")||(l.style.position="absolute"),l.style.margin=h?`${a}px 0`:`0 ${a}px`,l.style.setProperty("position-anchor",t),l.style.setProperty("position-area",e[f]),l.style.setProperty("position-try-fallbacks","flip-block, flip-inline"),i(()=>{n(g,t,!1),g=r(),n(g,t,!0)}),()=>{n(g,t,!1),l.style.cssText=c}}const d=()=>{!g||l.popover&&!l.matches(":popover-open")||((t,e,s,n)=>{const[r,i]=s.split("-"),p=e.getBoundingClientRect(),l=t.offsetWidth+n,f=t.offsetHeight+n,a={top:p.top-f,bottom:innerHeight-p.bottom-f,left:p.left-l,right:innerWidth-p.right-l},c=a[r]<0&&a[o[r]]>=0?o[r]:r,h="top"===c||"bottom"===c,[g,d,m]=h?[p.left,p.width,t.offsetWidth]:[p.top,p.height,t.offsetHeight],v="start"===i?g:"end"===i?g+d-m:g+(d-m)/2,y="top"===c?p.top-f:"bottom"===c?p.bottom+n:"left"===c?p.left-l:p.right+n;t.style.left=(h?v:y)+"px",t.style.top=(h?y:v)+"px"})(l,g,f,a)};return i(()=>{g=r(),d()}),addEventListener("scroll",d,!0),addEventListener("resize",d),l.addEventListener("toggle",d),()=>{removeEventListener("scroll",d,!0),removeEventListener("resize",d),l.removeEventListener("toggle",d),l.style.cssText=c}})}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var LiteVueResize=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});return e.resize=e=>{e.directive("resize",({el:e,get:
|
|
1
|
+
var LiteVueResize=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});return e.resize=e=>{e.directive("resize",({el:e,get:i,exp:t,modifiers:n})=>{const r=i(`(($width, $height) => { ${t} })`);if(n?.window||n?.visual){const e=n.visual&&window.visualViewport||window,i=()=>r(e.width||innerWidth,e.height||innerHeight);return e.addEventListener("resize",i),i(),()=>e.removeEventListener("resize",i)}const o=new ResizeObserver(e=>{for(const i of e){const e=i.contentRect;r(e.width,e.height)}});return o.observe(e),()=>o.disconnect()})},e}({});
|
package/dist/plugins/resize.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=e=>{e.directive("resize",({el:e,get:
|
|
1
|
+
var e=e=>{e.directive("resize",({el:e,get:i,exp:t,modifiers:n})=>{const r=i(`(($width, $height) => { ${t} })`);if(n?.window||n?.visual){const e=n.visual&&window.visualViewport||window,i=()=>r(e.width||innerWidth,e.height||innerHeight);return e.addEventListener("resize",i),i(),()=>e.removeEventListener("resize",i)}const s=new ResizeObserver(e=>{for(const i of e){const e=i.contentRect;r(e.width,e.height)}});return s.observe(e),()=>s.disconnect()})};export{e as resize};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,
|
|
1
|
+
!function(e,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((e="undefined"!=typeof globalThis?globalThis:e||self).LiteVueResize={})}(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});e.resize=e=>{e.directive("resize",({el:e,get:i,exp:t,modifiers:n})=>{const o=i(`(($width, $height) => { ${t} })`);if(n?.window||n?.visual){const e=n.visual&&window.visualViewport||window,i=()=>o(e.width||innerWidth,e.height||innerHeight);return e.addEventListener("resize",i),i(),()=>e.removeEventListener("resize",i)}const s=new ResizeObserver(e=>{for(const i of e){const e=i.contentRect;o(e.width,e.height)}});return s.observe(e),()=>s.disconnect()})}});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LiteVueDevtools } from '../devtools.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Plugins describe the app, not a scope, so the view opens from the panel bar
|
|
4
|
+
* and takes the whole body rather than a third sidebar tab.
|
|
5
|
+
*/
|
|
6
|
+
export declare const createPluginsView: (devtools: LiteVueDevtools) => {
|
|
7
|
+
btn: HTMLElement;
|
|
8
|
+
el: HTMLElement;
|
|
9
|
+
render: () => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LiteVueDevtools } from '../devtools';
|
|
2
|
+
/**
|
|
3
|
+
* Plugins describe the app, not a scope, so the view opens from the panel bar
|
|
4
|
+
* and takes the whole body rather than a third sidebar tab.
|
|
5
|
+
*/
|
|
6
|
+
export declare const createPluginsView: (devtools: LiteVueDevtools) => {
|
|
7
|
+
btn: HTMLElement;
|
|
8
|
+
el: HTMLElement;
|
|
9
|
+
render: () => void;
|
|
10
|
+
};
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
* Panel stylesheet. Note the template below is a *string* — comments inside it
|
|
3
3
|
* ship verbatim, so explanations belong out here where terser strips them.
|
|
4
4
|
*
|
|
5
|
+
* `[hidden]` is forced with `!important` because an author `display`, such as
|
|
6
|
+
* `.side`'s flex, beats the UA rule, and the plugins view hides by `hidden`.
|
|
7
|
+
*
|
|
5
8
|
* Docked layouts (`.dock-bottom` / `.dock-right`) give the tree a full viewport
|
|
6
9
|
* edge, as browser devtools do; only the cross-axis stays resizable, since the
|
|
7
10
|
* other would fight the dock.
|
|
@@ -14,4 +17,4 @@
|
|
|
14
17
|
* always bottom-right — the wrong corner once docked, where dragging down would
|
|
15
18
|
* grow the panel upward. Each mode gets a handle on the edge that moves.
|
|
16
19
|
*/
|
|
17
|
-
export declare const css = "\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";
|
|
20
|
+
export declare const css = "\n:host {\n all: initial;\n --bg: #1e1e1e;\n --bg2: #252526;\n --hover: #2a2d2e;\n --border: #3c3c3c;\n --fg: #d4d4d4;\n --muted: #808080;\n --accent: #42b883;\n --sel: #094771;\n --key: #9cdcfe;\n --val: #ce9178;\n --exp: #6a9955;\n}\n:host(.light) {\n --bg: #ffffff;\n --bg2: #f3f3f3;\n --hover: #ececec;\n --border: #d0d0d0;\n --fg: #383a42;\n --muted: #8e8e90;\n --sel: #d2e5f5;\n --key: #0451a5;\n --val: #a31515;\n --exp: #22863a;\n}\n* {\n box-sizing: border-box;\n}\n.pill, .panel {\n position: fixed;\n right: 12px;\n bottom: 12px;\n z-index: 2147483646;\n font: 11px/1.5 ui-monospace, Menlo, Consolas, monospace;\n color: var(--fg);\n}\n.pill {\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 999px;\n padding: 4px 10px;\n cursor: pointer;\n user-select: none;\n}\n.pill:hover {\n border-color: var(--accent);\n}\n.panel {\n display: flex;\n flex-direction: column;\n width: 760px;\n max-width: calc(100vw - 24px);\n height: 450px;\n max-height: calc(100vh - 24px);\n min-width: 320px;\n min-height: 320px;\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 6px;\n overflow: hidden;\n box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);\n}\n.panel.dock-bottom {\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n max-width: none;\n border-radius: 0;\n border-left: 0;\n border-right: 0;\n border-bottom: 0;\n}\n.panel.dock-right {\n top: 0;\n right: 0;\n bottom: 0;\n height: 100%;\n max-height: none;\n border-radius: 0;\n border-top: 0;\n border-right: 0;\n border-bottom: 0;\n}\n.panel.dock-bottom .header,\n.panel.dock-right .header {\n cursor: default;\n}\n.grip {\n position: absolute;\n z-index: 1;\n touch-action: none;\n right: 0;\n bottom: 0;\n width: 14px;\n height: 14px;\n cursor: nwse-resize;\n background: linear-gradient(135deg, transparent 50%, var(--border) 50%);\n}\n.panel.dock-bottom .grip {\n top: 0;\n left: 0;\n width: auto;\n height: 5px;\n cursor: ns-resize;\n background: none;\n}\n.panel.dock-right .grip {\n top: 0;\n left: 0;\n width: 5px;\n height: auto;\n cursor: ew-resize;\n background: none;\n}\n.panel.dock-bottom .grip:hover,\n.panel.dock-bottom .grip.active,\n.panel.dock-right .grip:hover,\n.panel.dock-right .grip.active {\n background: var(--accent);\n}\n.header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px 8px;\n background: var(--bg2);\n border-bottom: 1px solid var(--border);\n user-select: none;\n cursor: move;\n}\n.title {\n color: var(--accent);\n font-weight: bold;\n margin-right: auto;\n}\n.btn {\n display: flex;\n align-items: center;\n background: none;\n border: 1px solid var(--border);\n border-radius: 3px;\n color: var(--fg);\n font: inherit;\n padding: 3px 7px;\n cursor: pointer;\n}\n.btn svg {\n display: block;\n}\n.btn:hover {\n border-color: var(--accent);\n}\n.btn.active {\n background: var(--accent);\n border-color: var(--accent);\n color: var(--bg);\n}\n.body {\n display: flex;\n flex: 1;\n min-height: 0;\n}\n[hidden] {\n display: none !important;\n}\n.plugins {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.plugin {\n display: flex;\n gap: 8px;\n padding: 3px 10px;\n align-items: baseline;\n}\n.plugin .name {\n min-width: 120px;\n}\n.plugin .gave {\n flex: 1;\n color: var(--muted);\n word-break: break-word;\n}\n.plugin .flag {\n color: var(--muted);\n opacity: 0.7;\n}\n.side {\n display: flex;\n flex-direction: column;\n width: 40%;\n min-width: 0;\n border-right: 1px solid var(--border);\n}\n.tabs {\n display: flex;\n border-bottom: 1px solid var(--border);\n user-select: none;\n}\n.tab {\n flex: 1;\n padding: 4px 0;\n text-align: center;\n color: var(--muted);\n border-bottom: 2px solid transparent;\n cursor: pointer;\n}\n.tab:hover {\n color: var(--fg);\n}\n.tab.active {\n color: var(--fg);\n border-bottom-color: var(--accent);\n}\n.filter {\n margin: 6px 6px 2px;\n background: var(--bg2);\n border: 1px solid var(--border);\n border-radius: 3px;\n color: var(--fg);\n font: inherit;\n padding: 2px 6px;\n outline: none;\n}\n.filter:focus {\n border-color: var(--accent);\n}\n.filter::placeholder {\n color: var(--muted);\n}\n.tree {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.state {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.row {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 2px 8px;\n white-space: nowrap;\n overflow: hidden;\n cursor: pointer;\n}\n.row .label {\n flex-shrink: 0;\n}\n.row .arrow {\n cursor: pointer;\n padding: 3px 4px;\n margin: -3px -4px;\n box-sizing: content-box;\n}\n.row .arrow:hover {\n color: var(--key);\n}\n.row .hit {\n color: var(--exp);\n opacity: 0.75;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.row:hover {\n background: var(--hover);\n}\n.row.sel {\n background: var(--sel);\n}\n.row .name {\n color: var(--key);\n}\n.row .punct {\n color: var(--muted);\n}\n.row .exp {\n color: var(--exp);\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.prop {\n display: flex;\n gap: 6px;\n padding: 2px 8px;\n align-items: center;\n}\n.prop .key {\n color: var(--key);\n flex-shrink: 0;\n}\n.arrow {\n width: 12px;\n flex-shrink: 0;\n color: var(--muted);\n font-size: 9px;\n transition: transform 0.1s;\n}\n.arrow.open {\n transform: rotate(90deg);\n}\n.spacer {\n width: 12px;\n flex-shrink: 0;\n}\n.prop.toggle {\n cursor: pointer;\n user-select: none;\n}\n.prop.toggle:hover {\n background: var(--hover);\n}\n.preview {\n flex: 1;\n min-width: 0;\n color: var(--muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.muted {\n color: var(--muted);\n padding: 2px 8px;\n}\n.check {\n margin: 0;\n flex-shrink: 0;\n accent-color: var(--accent);\n cursor: pointer;\n}\n.del {\n visibility: hidden;\n flex-shrink: 0;\n background: none;\n border: none;\n padding: 0 2px;\n color: var(--muted);\n font: inherit;\n cursor: pointer;\n}\n.prop:hover .del {\n visibility: visible;\n}\n.del:hover {\n color: #e5534b;\n}\n.adder .key-in {\n flex: 0 0 30%;\n color: var(--key);\n}\n.adder input::placeholder {\n color: var(--muted);\n}\n.adder input {\n border-color: var(--border);\n}\n.bool {\n color: var(--val);\n}\n.prop.inherited .key {\n color: var(--muted);\n}\n.prop .val {\n flex: 1;\n min-width: 0;\n background: none;\n border: 1px solid transparent;\n border-radius: 3px;\n color: var(--val);\n font: inherit;\n padding: 0 3px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\ninput.val:hover, input.val:focus {\n border-color: var(--border);\n outline: none;\n background: var(--bg2);\n}\n.divider {\n padding: 4px 8px 1px;\n color: var(--muted);\n font-size: 10px;\n text-transform: uppercase;\n user-select: none;\n}\n.empty {\n padding: 8px;\n color: var(--muted);\n}\n.highlight {\n position: fixed;\n z-index: 2147483645;\n background: rgba(66, 184, 131, 0.25);\n border: 1px solid var(--accent);\n pointer-events: none;\n display: none;\n}\n";
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
* Panel stylesheet. Note the template below is a *string* — comments inside it
|
|
3
3
|
* ship verbatim, so explanations belong out here where terser strips them.
|
|
4
4
|
*
|
|
5
|
+
* `[hidden]` is forced with `!important` because an author `display`, such as
|
|
6
|
+
* `.side`'s flex, beats the UA rule, and the plugins view hides by `hidden`.
|
|
7
|
+
*
|
|
5
8
|
* Docked layouts (`.dock-bottom` / `.dock-right`) give the tree a full viewport
|
|
6
9
|
* edge, as browser devtools do; only the cross-axis stays resizable, since the
|
|
7
10
|
* other would fight the dock.
|
|
@@ -14,4 +17,4 @@
|
|
|
14
17
|
* always bottom-right — the wrong corner once docked, where dragging down would
|
|
15
18
|
* grow the panel upward. Each mode gets a handle on the edge that moves.
|
|
16
19
|
*/
|
|
17
|
-
export declare const css = "\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";
|
|
20
|
+
export declare const css = "\n:host {\n all: initial;\n --bg: #1e1e1e;\n --bg2: #252526;\n --hover: #2a2d2e;\n --border: #3c3c3c;\n --fg: #d4d4d4;\n --muted: #808080;\n --accent: #42b883;\n --sel: #094771;\n --key: #9cdcfe;\n --val: #ce9178;\n --exp: #6a9955;\n}\n:host(.light) {\n --bg: #ffffff;\n --bg2: #f3f3f3;\n --hover: #ececec;\n --border: #d0d0d0;\n --fg: #383a42;\n --muted: #8e8e90;\n --sel: #d2e5f5;\n --key: #0451a5;\n --val: #a31515;\n --exp: #22863a;\n}\n* {\n box-sizing: border-box;\n}\n.pill, .panel {\n position: fixed;\n right: 12px;\n bottom: 12px;\n z-index: 2147483646;\n font: 11px/1.5 ui-monospace, Menlo, Consolas, monospace;\n color: var(--fg);\n}\n.pill {\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 999px;\n padding: 4px 10px;\n cursor: pointer;\n user-select: none;\n}\n.pill:hover {\n border-color: var(--accent);\n}\n.panel {\n display: flex;\n flex-direction: column;\n width: 760px;\n max-width: calc(100vw - 24px);\n height: 450px;\n max-height: calc(100vh - 24px);\n min-width: 320px;\n min-height: 320px;\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 6px;\n overflow: hidden;\n box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);\n}\n.panel.dock-bottom {\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n max-width: none;\n border-radius: 0;\n border-left: 0;\n border-right: 0;\n border-bottom: 0;\n}\n.panel.dock-right {\n top: 0;\n right: 0;\n bottom: 0;\n height: 100%;\n max-height: none;\n border-radius: 0;\n border-top: 0;\n border-right: 0;\n border-bottom: 0;\n}\n.panel.dock-bottom .header,\n.panel.dock-right .header {\n cursor: default;\n}\n.grip {\n position: absolute;\n z-index: 1;\n touch-action: none;\n right: 0;\n bottom: 0;\n width: 14px;\n height: 14px;\n cursor: nwse-resize;\n background: linear-gradient(135deg, transparent 50%, var(--border) 50%);\n}\n.panel.dock-bottom .grip {\n top: 0;\n left: 0;\n width: auto;\n height: 5px;\n cursor: ns-resize;\n background: none;\n}\n.panel.dock-right .grip {\n top: 0;\n left: 0;\n width: 5px;\n height: auto;\n cursor: ew-resize;\n background: none;\n}\n.panel.dock-bottom .grip:hover,\n.panel.dock-bottom .grip.active,\n.panel.dock-right .grip:hover,\n.panel.dock-right .grip.active {\n background: var(--accent);\n}\n.header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px 8px;\n background: var(--bg2);\n border-bottom: 1px solid var(--border);\n user-select: none;\n cursor: move;\n}\n.title {\n color: var(--accent);\n font-weight: bold;\n margin-right: auto;\n}\n.btn {\n display: flex;\n align-items: center;\n background: none;\n border: 1px solid var(--border);\n border-radius: 3px;\n color: var(--fg);\n font: inherit;\n padding: 3px 7px;\n cursor: pointer;\n}\n.btn svg {\n display: block;\n}\n.btn:hover {\n border-color: var(--accent);\n}\n.btn.active {\n background: var(--accent);\n border-color: var(--accent);\n color: var(--bg);\n}\n.body {\n display: flex;\n flex: 1;\n min-height: 0;\n}\n[hidden] {\n display: none !important;\n}\n.plugins {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.plugin {\n display: flex;\n gap: 8px;\n padding: 3px 10px;\n align-items: baseline;\n}\n.plugin .name {\n min-width: 120px;\n}\n.plugin .gave {\n flex: 1;\n color: var(--muted);\n word-break: break-word;\n}\n.plugin .flag {\n color: var(--muted);\n opacity: 0.7;\n}\n.side {\n display: flex;\n flex-direction: column;\n width: 40%;\n min-width: 0;\n border-right: 1px solid var(--border);\n}\n.tabs {\n display: flex;\n border-bottom: 1px solid var(--border);\n user-select: none;\n}\n.tab {\n flex: 1;\n padding: 4px 0;\n text-align: center;\n color: var(--muted);\n border-bottom: 2px solid transparent;\n cursor: pointer;\n}\n.tab:hover {\n color: var(--fg);\n}\n.tab.active {\n color: var(--fg);\n border-bottom-color: var(--accent);\n}\n.filter {\n margin: 6px 6px 2px;\n background: var(--bg2);\n border: 1px solid var(--border);\n border-radius: 3px;\n color: var(--fg);\n font: inherit;\n padding: 2px 6px;\n outline: none;\n}\n.filter:focus {\n border-color: var(--accent);\n}\n.filter::placeholder {\n color: var(--muted);\n}\n.tree {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.state {\n flex: 1;\n overflow: auto;\n padding: 4px 0;\n}\n.row {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 2px 8px;\n white-space: nowrap;\n overflow: hidden;\n cursor: pointer;\n}\n.row .label {\n flex-shrink: 0;\n}\n.row .arrow {\n cursor: pointer;\n padding: 3px 4px;\n margin: -3px -4px;\n box-sizing: content-box;\n}\n.row .arrow:hover {\n color: var(--key);\n}\n.row .hit {\n color: var(--exp);\n opacity: 0.75;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.row:hover {\n background: var(--hover);\n}\n.row.sel {\n background: var(--sel);\n}\n.row .name {\n color: var(--key);\n}\n.row .punct {\n color: var(--muted);\n}\n.row .exp {\n color: var(--exp);\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.prop {\n display: flex;\n gap: 6px;\n padding: 2px 8px;\n align-items: center;\n}\n.prop .key {\n color: var(--key);\n flex-shrink: 0;\n}\n.arrow {\n width: 12px;\n flex-shrink: 0;\n color: var(--muted);\n font-size: 9px;\n transition: transform 0.1s;\n}\n.arrow.open {\n transform: rotate(90deg);\n}\n.spacer {\n width: 12px;\n flex-shrink: 0;\n}\n.prop.toggle {\n cursor: pointer;\n user-select: none;\n}\n.prop.toggle:hover {\n background: var(--hover);\n}\n.preview {\n flex: 1;\n min-width: 0;\n color: var(--muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.muted {\n color: var(--muted);\n padding: 2px 8px;\n}\n.check {\n margin: 0;\n flex-shrink: 0;\n accent-color: var(--accent);\n cursor: pointer;\n}\n.del {\n visibility: hidden;\n flex-shrink: 0;\n background: none;\n border: none;\n padding: 0 2px;\n color: var(--muted);\n font: inherit;\n cursor: pointer;\n}\n.prop:hover .del {\n visibility: visible;\n}\n.del:hover {\n color: #e5534b;\n}\n.adder .key-in {\n flex: 0 0 30%;\n color: var(--key);\n}\n.adder input::placeholder {\n color: var(--muted);\n}\n.adder input {\n border-color: var(--border);\n}\n.bool {\n color: var(--val);\n}\n.prop.inherited .key {\n color: var(--muted);\n}\n.prop .val {\n flex: 1;\n min-width: 0;\n background: none;\n border: 1px solid transparent;\n border-radius: 3px;\n color: var(--val);\n font: inherit;\n padding: 0 3px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\ninput.val:hover, input.val:focus {\n border-color: var(--border);\n outline: none;\n background: var(--bg2);\n}\n.divider {\n padding: 4px 8px 1px;\n color: var(--muted);\n font-size: 10px;\n text-transform: uppercase;\n user-select: none;\n}\n.empty {\n padding: 8px;\n color: var(--muted);\n}\n.highlight {\n position: fixed;\n z-index: 2147483645;\n background: rgba(66, 184, 131, 0.25);\n border: 1px solid var(--accent);\n pointer-events: none;\n display: none;\n}\n";
|
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
export type DevtoolsEvent = 'scope:mount' | 'scope:unmount' | 'store:register' | 'flush';
|
|
1
|
+
export type DevtoolsEvent = 'scope:mount' | 'scope:unmount' | 'store:register' | 'plugin:install' | 'flush';
|
|
2
2
|
type Listener = (...args: any[]) => void;
|
|
3
|
+
/**
|
|
4
|
+
* What one `app.use()` contributed.
|
|
5
|
+
*
|
|
6
|
+
* `directives` and `magics` carry the weight, not `name`: minifiers rename
|
|
7
|
+
* plugin functions, so `Function.name` is an empty string in every production
|
|
8
|
+
* build — the builds an inspector is actually pointed at. What a plugin added
|
|
9
|
+
* survives minification and is what someone debugging wants anyway.
|
|
10
|
+
*/
|
|
11
|
+
export interface PluginInfo {
|
|
12
|
+
/** The plugin function's name where a build kept it, else `plugin <n>`. */
|
|
13
|
+
name: string;
|
|
14
|
+
/** Directives it registered, e.g. `["intersect"]`. */
|
|
15
|
+
directives: string[];
|
|
16
|
+
/** Root-scope magics it added, e.g. `["$morph"]`. */
|
|
17
|
+
magics: string[];
|
|
18
|
+
/** Whether it returned a teardown, so a full unmount releases it. */
|
|
19
|
+
teardown: boolean;
|
|
20
|
+
}
|
|
3
21
|
export interface LiteVueDevtools {
|
|
4
22
|
/**
|
|
5
23
|
* Live map of scope root elements (app roots and v-scope elements) to
|
|
@@ -27,6 +45,10 @@ export interface LiteVueDevtools {
|
|
|
27
45
|
* `<Cart>` rather than by tag or id.
|
|
28
46
|
*/
|
|
29
47
|
components: Set<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Plugins passed to app.use(), in install order.
|
|
50
|
+
*/
|
|
51
|
+
plugins: PluginInfo[];
|
|
30
52
|
/**
|
|
31
53
|
* Find the scope governing a node by walking up the DOM to the nearest
|
|
32
54
|
* registered scope root. Usable from the console: __LITE_VUE__.getScope($0)
|
|
@@ -43,6 +65,7 @@ export interface LiteVueDevtools {
|
|
|
43
65
|
* the same element (upsert semantics).
|
|
44
66
|
* - 'scope:unmount' (el): a scope root was torn down.
|
|
45
67
|
* - 'store:register' (name, store): a global store was registered.
|
|
68
|
+
* - 'plugin:install' (info): a plugin was installed via app.use().
|
|
46
69
|
* - 'flush': the reactive job queue flushed; state may have changed.
|
|
47
70
|
*/
|
|
48
71
|
on(event: DevtoolsEvent, fn: Listener): () => void;
|
|
@@ -51,6 +74,10 @@ export interface LiteVueDevtools {
|
|
|
51
74
|
export declare const registerScope: (el: Element, scope: Record<string, any>, exp?: string, name?: string) => (() => void);
|
|
52
75
|
export declare const registerStore: (name: string, store: Record<string, any>) => void;
|
|
53
76
|
export declare const registerComponent: (name: string) => void;
|
|
77
|
+
/** Registers a plugin and returns a deregister, as registerScope does. */
|
|
78
|
+
export declare const registerPlugin: (info: PluginInfo) => (() => void) | undefined;
|
|
79
|
+
/** True when something is listening, so app.use() can skip the diff. */
|
|
80
|
+
export declare const pluginsWatched: () => boolean;
|
|
54
81
|
export declare const emitFlush: () => void;
|
|
55
82
|
export declare const devtools: LiteVueDevtools;
|
|
56
83
|
/**
|
package/dist/types/devtools.d.ts
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
export type DevtoolsEvent = 'scope:mount' | 'scope:unmount' | 'store:register' | 'flush';
|
|
1
|
+
export type DevtoolsEvent = 'scope:mount' | 'scope:unmount' | 'store:register' | 'plugin:install' | 'flush';
|
|
2
2
|
type Listener = (...args: any[]) => void;
|
|
3
|
+
/**
|
|
4
|
+
* What one `app.use()` contributed.
|
|
5
|
+
*
|
|
6
|
+
* `directives` and `magics` carry the weight, not `name`: minifiers rename
|
|
7
|
+
* plugin functions, so `Function.name` is an empty string in every production
|
|
8
|
+
* build — the builds an inspector is actually pointed at. What a plugin added
|
|
9
|
+
* survives minification and is what someone debugging wants anyway.
|
|
10
|
+
*/
|
|
11
|
+
export interface PluginInfo {
|
|
12
|
+
/** The plugin function's name where a build kept it, else `plugin <n>`. */
|
|
13
|
+
name: string;
|
|
14
|
+
/** Directives it registered, e.g. `["intersect"]`. */
|
|
15
|
+
directives: string[];
|
|
16
|
+
/** Root-scope magics it added, e.g. `["$morph"]`. */
|
|
17
|
+
magics: string[];
|
|
18
|
+
/** Whether it returned a teardown, so a full unmount releases it. */
|
|
19
|
+
teardown: boolean;
|
|
20
|
+
}
|
|
3
21
|
export interface LiteVueDevtools {
|
|
4
22
|
/**
|
|
5
23
|
* Live map of scope root elements (app roots and v-scope elements) to
|
|
@@ -27,6 +45,10 @@ export interface LiteVueDevtools {
|
|
|
27
45
|
* `<Cart>` rather than by tag or id.
|
|
28
46
|
*/
|
|
29
47
|
components: Set<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Plugins passed to app.use(), in install order.
|
|
50
|
+
*/
|
|
51
|
+
plugins: PluginInfo[];
|
|
30
52
|
/**
|
|
31
53
|
* Find the scope governing a node by walking up the DOM to the nearest
|
|
32
54
|
* registered scope root. Usable from the console: __LITE_VUE__.getScope($0)
|
|
@@ -43,6 +65,7 @@ export interface LiteVueDevtools {
|
|
|
43
65
|
* the same element (upsert semantics).
|
|
44
66
|
* - 'scope:unmount' (el): a scope root was torn down.
|
|
45
67
|
* - 'store:register' (name, store): a global store was registered.
|
|
68
|
+
* - 'plugin:install' (info): a plugin was installed via app.use().
|
|
46
69
|
* - 'flush': the reactive job queue flushed; state may have changed.
|
|
47
70
|
*/
|
|
48
71
|
on(event: DevtoolsEvent, fn: Listener): () => void;
|
|
@@ -51,6 +74,10 @@ export interface LiteVueDevtools {
|
|
|
51
74
|
export declare const registerScope: (el: Element, scope: Record<string, any>, exp?: string, name?: string) => (() => void);
|
|
52
75
|
export declare const registerStore: (name: string, store: Record<string, any>) => void;
|
|
53
76
|
export declare const registerComponent: (name: string) => void;
|
|
77
|
+
/** Registers a plugin and returns a deregister, as registerScope does. */
|
|
78
|
+
export declare const registerPlugin: (info: PluginInfo) => (() => void) | undefined;
|
|
79
|
+
/** True when something is listening, so app.use() can skip the diff. */
|
|
80
|
+
export declare const pluginsWatched: () => boolean;
|
|
54
81
|
export declare const emitFlush: () => void;
|
|
55
82
|
export declare const devtools: LiteVueDevtools;
|
|
56
83
|
/**
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Plugin } from '../../app.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Same-origin links and forms fetch the next page and morph it into this one,
|
|
4
|
+
* so scopes the two pages share keep their state. Anything it cannot do
|
|
5
|
+
* safely falls back to a full load: a non-HTML response, another origin, a
|
|
6
|
+
* missing target, or different [data-navigate-track] scripts or styles.
|
|
7
|
+
*
|
|
8
|
+
* Needs the morph plugin installed too; it is not bundled, so a page loading
|
|
9
|
+
* both carries one copy. Opt out per region with data-navigate="false".
|
|
10
|
+
*/
|
|
11
|
+
export interface NavigateOptions {
|
|
12
|
+
/** Selector of the region to morph. Default `body`. */
|
|
13
|
+
target?: string;
|
|
14
|
+
/** Run each navigation inside `document.startViewTransition()`. */
|
|
15
|
+
transition?: boolean;
|
|
16
|
+
/** Scroll to the top, or the URL's hash, after navigating. Default true. */
|
|
17
|
+
scroll?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const navigate: Plugin<NavigateOptions>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Plugin } from '../../app';
|
|
2
|
+
/**
|
|
3
|
+
* Same-origin links and forms fetch the next page and morph it into this one,
|
|
4
|
+
* so scopes the two pages share keep their state. Anything it cannot do
|
|
5
|
+
* safely falls back to a full load: a non-HTML response, another origin, a
|
|
6
|
+
* missing target, or different [data-navigate-track] scripts or styles.
|
|
7
|
+
*
|
|
8
|
+
* Needs the morph plugin installed too; it is not bundled, so a page loading
|
|
9
|
+
* both carries one copy. Opt out per region with data-navigate="false".
|
|
10
|
+
*/
|
|
11
|
+
export interface NavigateOptions {
|
|
12
|
+
/** Selector of the region to morph. Default `body`. */
|
|
13
|
+
target?: string;
|
|
14
|
+
/** Run each navigation inside `document.startViewTransition()`. */
|
|
15
|
+
transition?: boolean;
|
|
16
|
+
/** Scroll to the top, or the URL's hash, after navigating. Default true. */
|
|
17
|
+
scroll?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const navigate: Plugin<NavigateOptions>;
|
|
@@ -4,7 +4,10 @@ import type { Plugin } from '../../app.mjs';
|
|
|
4
4
|
* queries cannot hand to JavaScript. The expression runs with `$width` and
|
|
5
5
|
* `$height` in scope.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* `.window` measures the viewport instead, from `innerWidth`/`innerHeight`.
|
|
8
|
+
* A ResizeObserver cannot do this: on `documentElement` it reports the
|
|
9
|
+
* *document* height, so a 3000px page under a 700px viewport reports 3000.
|
|
10
|
+
* `.visual` measures the visual viewport, which shrinks for an on-screen
|
|
11
|
+
* keyboard where `innerHeight` does not.
|
|
9
12
|
*/
|
|
10
13
|
export declare const resize: Plugin;
|
|
@@ -4,7 +4,10 @@ import type { Plugin } from '../../app';
|
|
|
4
4
|
* queries cannot hand to JavaScript. The expression runs with `$width` and
|
|
5
5
|
* `$height` in scope.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* `.window` measures the viewport instead, from `innerWidth`/`innerHeight`.
|
|
8
|
+
* A ResizeObserver cannot do this: on `documentElement` it reports the
|
|
9
|
+
* *document* height, so a 3000px page under a 700px viewport reports 3000.
|
|
10
|
+
* `.visual` measures the visual viewport, which shrinks for an on-screen
|
|
11
|
+
* keyboard where `innerHeight` does not.
|
|
9
12
|
*/
|
|
10
13
|
export declare const resize: Plugin;
|