@aevantec/litevue 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/litevue-devtools.iife.js +1 -1
  2. package/dist/litevue-devtools.mjs +1 -1
  3. package/dist/litevue-devtools.umd.js +1 -1
  4. package/dist/litevue-plugins.dev.iife.js +64 -41
  5. package/dist/litevue-plugins.dev.mjs +64 -40
  6. package/dist/litevue-plugins.iife.js +1 -1
  7. package/dist/litevue-plugins.mjs +1 -1
  8. package/dist/litevue-plugins.umd.js +1 -1
  9. package/dist/litevue.dev.iife.js +121 -39
  10. package/dist/litevue.dev.mjs +121 -38
  11. package/dist/litevue.iife.js +1 -1
  12. package/dist/litevue.mjs +1 -1
  13. package/dist/litevue.umd.js +1 -1
  14. package/dist/plugins/collapse.iife.js +1 -1
  15. package/dist/plugins/collapse.mjs +1 -1
  16. package/dist/plugins/collapse.umd.js +1 -1
  17. package/dist/plugins/focus.iife.js +1 -1
  18. package/dist/plugins/focus.mjs +1 -1
  19. package/dist/plugins/focus.umd.js +1 -1
  20. package/dist/plugins/intersect.iife.js +1 -1
  21. package/dist/plugins/intersect.umd.js +1 -1
  22. package/dist/plugins/mask.iife.js +1 -1
  23. package/dist/plugins/mask.mjs +1 -1
  24. package/dist/plugins/mask.umd.js +1 -1
  25. package/dist/plugins/media.dev.iife.js +3 -4
  26. package/dist/plugins/media.dev.mjs +3 -3
  27. package/dist/plugins/media.iife.js +1 -1
  28. package/dist/plugins/media.mjs +1 -1
  29. package/dist/plugins/media.umd.js +1 -1
  30. package/dist/plugins/morph.dev.iife.js +39 -19
  31. package/dist/plugins/morph.dev.mjs +39 -18
  32. package/dist/plugins/morph.iife.js +1 -1
  33. package/dist/plugins/morph.mjs +1 -1
  34. package/dist/plugins/morph.umd.js +1 -1
  35. package/dist/plugins/navigate.dev.iife.js +26 -19
  36. package/dist/plugins/navigate.dev.mjs +26 -18
  37. package/dist/plugins/navigate.iife.js +1 -1
  38. package/dist/plugins/navigate.mjs +1 -1
  39. package/dist/plugins/navigate.umd.js +1 -1
  40. package/dist/plugins/persist.dev.iife.js +2 -3
  41. package/dist/plugins/persist.dev.mjs +2 -2
  42. package/dist/plugins/persist.iife.js +1 -1
  43. package/dist/plugins/persist.mjs +1 -1
  44. package/dist/plugins/persist.umd.js +1 -1
  45. package/dist/plugins/popover.iife.js +1 -1
  46. package/dist/plugins/popover.mjs +1 -1
  47. package/dist/plugins/popover.umd.js +1 -1
  48. package/dist/plugins/resize.iife.js +1 -1
  49. package/dist/plugins/resize.umd.js +1 -1
  50. package/dist/plugins/transition.iife.js +1 -1
  51. package/dist/plugins/transition.mjs +1 -1
  52. package/dist/plugins/transition.umd.js +1 -1
  53. package/dist/types/app.d.mts +3 -1
  54. package/dist/types/app.d.ts +3 -1
  55. package/dist/types/context.d.mts +1 -1
  56. package/dist/types/context.d.ts +1 -1
  57. package/dist/types/devtools-panel/chrome.d.mts +6 -5
  58. package/dist/types/devtools-panel/chrome.d.ts +6 -5
  59. package/dist/types/devtools-panel/menu.d.mts +12 -0
  60. package/dist/types/devtools-panel/menu.d.ts +12 -0
  61. package/dist/types/devtools-panel/styles.d.mts +5 -2
  62. package/dist/types/devtools-panel/styles.d.ts +5 -2
  63. package/dist/types/devtools-panel/values.d.mts +11 -5
  64. package/dist/types/devtools-panel/values.d.ts +11 -5
  65. package/dist/types/directives/show.d.mts +1 -0
  66. package/dist/types/directives/show.d.ts +1 -0
  67. package/dist/types/errors.d.mts +1 -1
  68. package/dist/types/errors.d.ts +1 -1
  69. package/dist/types/store.d.mts +5 -1
  70. package/dist/types/store.d.ts +5 -1
  71. package/package.json +3 -3
@@ -11,6 +11,13 @@ var PREFETCH_TTL = 1e4;
11
11
  var SCROLL_SAVE_DELAY = 150;
12
12
  var isLocal = (url) => url.origin === location.origin;
13
13
  var pathOf = (url) => url.pathname + url.search;
14
+ var decode = (s) => {
15
+ try {
16
+ return decodeURIComponent(s);
17
+ } catch {
18
+ return s;
19
+ }
20
+ };
14
21
  var optedOut = (el) => !!el.closest("[data-navigate=\"false\"]");
15
22
  var encode = (data) => new URLSearchParams([...data].map(([k, v]) => [k, v.name ?? v]));
16
23
  var saveScroll = () => history.replaceState({
@@ -32,18 +39,21 @@ var mergeHead = async (doc) => {
32
39
  const sel = "link,style,meta";
33
40
  const live = [...document.head.querySelectorAll(sel)];
34
41
  const loads = [];
42
+ let at;
35
43
  for (const el of doc.head.querySelectorAll(sel)) {
36
44
  const i = live.findIndex((l) => l.isEqualNode(el));
37
45
  if (i > -1) {
38
- live.splice(i, 1);
46
+ [at] = live.splice(i, 1);
39
47
  continue;
40
48
  }
41
49
  const fresh = document.importNode(el, true);
42
- if (fresh.matches("link[rel=stylesheet][href]:not([disabled],[href=\"\"])")) loads.push(new Promise((r) => {
50
+ if (fresh.matches("link[rel=stylesheet][href]:not([disabled]):not([href=\"\"])")) loads.push(new Promise((r) => {
43
51
  fresh.addEventListener("load", r);
44
52
  fresh.addEventListener("error", r);
45
53
  }));
46
- document.head.append(fresh);
54
+ if (at) at.after(fresh);
55
+ else document.head.prepend(fresh);
56
+ at = fresh;
47
57
  }
48
58
  await Promise.all(loads);
49
59
  return () => live.forEach((el) => el.matches("[data-navigate-preserve]") || el.remove());
@@ -62,12 +72,11 @@ var hasCtxAbove = (el) => {
62
72
  return false;
63
73
  };
64
74
  /**
65
- * Morph with the app's roots kept in step. Under a mounted scope morph binds
66
- * and releases nodes itself; at page level there is no scope, so roots the
67
- * page removes are unmounted and roots it adds are mounted here.
75
+ * Morph with the app's roots kept in step. Morph releases the roots it
76
+ * removes; at page level there is no scope to bind what it adds, so roots
77
+ * the page adds are mounted here.
68
78
  */
69
79
  var render = (app, patch, from, to, values) => {
70
- const roots = [from, ...from.querySelectorAll("*")].filter((el) => el.__ctx && !hasCtxAbove(el.parentElement));
71
80
  const added = [];
72
81
  patch(from, to, {
73
82
  values,
@@ -75,7 +84,6 @@ var render = (app, patch, from, to, values) => {
75
84
  node.nodeType === 1 && added.push(node);
76
85
  }
77
86
  });
78
- roots.forEach((el) => el.isConnected || app.unmount(el));
79
87
  added.forEach((el) => el.isConnected && !hasCtxAbove(el) && (el.matches(SCOPE_SELECTOR) || el.querySelector(SCOPE_SELECTOR)) && app.mount(el));
80
88
  };
81
89
  var navigate = (app, options = {}) => {
@@ -107,7 +115,8 @@ var navigate = (app, options = {}) => {
107
115
  render(app, app.scope.$morph, from, doc.querySelector(target), ok);
108
116
  dropOld();
109
117
  if (options.scroll !== false) {
110
- const anchor = y == null && url.hash && document.getElementById(url.hash.slice(1));
118
+ const id = url.hash.slice(1);
119
+ const anchor = y == null && id && (document.getElementById(id) || document.getElementById(decode(id)));
111
120
  anchor ? anchor.scrollIntoView() : scrollTo(0, y || 0);
112
121
  }
113
122
  if (ok) moveFocus(from);
@@ -136,7 +145,7 @@ var navigate = (app, options = {}) => {
136
145
  }));
137
146
  const url = new URL(res.url || href);
138
147
  url.hash ||= new URL(href).hash;
139
- if (!res.headers.get("content-type")?.includes("text/html") || !isLocal(url) || !res.ok && !post) {
148
+ if (!res.headers.get("content-type")?.includes("text/html") || !isLocal(url) || !res.ok && (!post || res.redirected)) {
140
149
  res.body?.cancel();
141
150
  throw new Error(`cannot render ${res.status} from ${url.href}`);
142
151
  }
@@ -146,21 +155,20 @@ var navigate = (app, options = {}) => {
146
155
  const from = document.querySelector(target);
147
156
  if (!from || !doc.querySelector(target)) throw new Error(`no ${target} in ${url.href}`);
148
157
  if (assets(doc) !== assets(document)) throw new Error(`${url.href} loads different scripts or styles`);
149
- doc.querySelectorAll("script,noscript").forEach((s) => /^\s*(module\s*)?$|script/i.test(s.type || "") && s.remove());
158
+ [doc, from].forEach((d) => d.querySelectorAll("script,noscript").forEach((s) => /^\s*(module\s*)?$|script/i.test(s.type || "") && s.remove()));
150
159
  const dropOld = await mergeHead(doc);
151
160
  const ok = res.ok;
152
- const run = () => c === controller && show(from, doc, url, ok, dropOld, y);
161
+ const run = () => c === controller && (setBusy([]), show(from, doc, url, ok, dropOld, y));
153
162
  options.transition && document.startViewTransition ? document.startViewTransition(run) : run();
154
163
  } catch (error) {
155
164
  if (c.signal.aborted) return;
165
+ setBusy([]);
156
166
  emit("error", {
157
167
  url: href,
158
168
  error
159
169
  });
160
170
  if (!post) location.assign(href);
161
171
  else if (res?.redirected) location.assign(res.url);
162
- } finally {
163
- c === controller && setBusy([]);
164
172
  }
165
173
  };
166
174
  /** The URL a link leads to, when navigate would take it over. */
@@ -174,9 +182,9 @@ var navigate = (app, options = {}) => {
174
182
  if (url.href.includes("#") && pathOf(url) === pathOf(location)) return;
175
183
  return url;
176
184
  };
185
+ const special = (e) => e.button || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey;
177
186
  const onClick = (e) => {
178
- if (e.defaultPrevented || e.button || e.metaKey || e.ctrlKey) return;
179
- if (e.shiftKey || e.altKey) return;
187
+ if (e.defaultPrevented || special(e)) return;
180
188
  const url = linkTo(e);
181
189
  if (!url) return;
182
190
  e.preventDefault();
@@ -211,7 +219,7 @@ var navigate = (app, options = {}) => {
211
219
  ["focusin", onHover],
212
220
  ["pointerout", onLeave],
213
221
  ["focusout", onLeave],
214
- ["pointerdown", prefetch]
222
+ ["pointerdown", (e) => special(e) || prefetch(e)]
215
223
  ] : [];
216
224
  const onSubmit = (e) => {
217
225
  const form = e.target;
@@ -223,7 +231,7 @@ var navigate = (app, options = {}) => {
223
231
  if (e.defaultPrevented || method === "dialog" || optedOut(form)) return;
224
232
  if (type === "text/plain") return;
225
233
  if (where && where !== "_self") return;
226
- const url = new URL(attr("action") || location.href, location.href);
234
+ const url = new URL(attr("action") || location.href, document.baseURI);
227
235
  if (!isLocal(url)) return;
228
236
  const data = new FormData(form);
229
237
  if (by?.name) data.append(by.name, by.value);
@@ -1 +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=>new URLSearchParams([...e].map(([e,t])=>[e,t.name??t])),i=()=>history.replaceState({...history.state,y:scrollY},""),s=(e,t,r=!1)=>document.dispatchEvent(new CustomEvent("navigate:"+e,{detail:t,cancelable:r})),c=e=>[...e.head.querySelectorAll("[data-navigate-track]")].map(e=>e.getAttribute("src")||e.getAttribute("href")).sort().join(),l=e=>{for(;e;e=e.parentElement)if(e.__ctx)return!0;return!1};return e.navigate=(e,u={})=>{const d=u.target||"body";let h,f=o(location);const m=new WeakSet;let p,v,y,b=[];const g=e=>p?.href===e&&Date.now()-p.at<1e4,w=e=>{b.forEach(e=>e.removeAttribute("aria-busy")),(b=e).forEach(e=>e.setAttribute("aria-busy","true"))},E=history.scrollRestoration;history.scrollRestoration="manual";const S=document.createElement("div");S.id="litevue-navigate-status",S.setAttribute("aria-live","polite"),S.setAttribute("data-morph-preserve",""),S.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)",document.body.append(S);const L=(r,n,a,i,c,h)=>{if(i&&null==h&&history[a.href===location.href?"replaceState":"pushState"]({},"",a.href),f=o(location),document.title=n.title,((e,r,o,n,a)=>{const i=[o,...o.querySelectorAll("*")].filter(e=>e.__ctx&&!l(e.parentElement)),s=[];r(o,n,{values:a,beforeNodeAdded:e=>{1===e.nodeType&&s.push(e)}}),i.forEach(t=>t.isConnected||e.unmount(t)),s.forEach(r=>r.isConnected&&!l(r)&&(r.matches(t)||r.querySelector(t))&&e.mount(r))})(e,e.scope.$morph,r,n.querySelector(d),i),c(),!1!==u.scroll){const e=null==h&&a.hash&&document.getElementById(a.hash.slice(1));e?e.scrollIntoView():scrollTo(0,h||0)}i&&(e=>{const t=e.querySelector("[autofocus]");t?t.focus():e===document.body?document.activeElement?.blur?.():(e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0}))})(r),S.textContent=document.title||document.querySelector("h1")?.textContent?.trim()||location.pathname,s("after",{url:a.href})},A=async(t,o={},n,a)=>{if(!s("before",{url:t},null==a))return;const l=!o.method&&g(t)?p:p?.c.abort();p=void 0,h?.abort();const f=h=l?l.c:new AbortController;w([document.documentElement,n].filter(Boolean));const m="POST"===o.method;let v;null==a&&i();try{if(!e.scope.$morph)throw new Error("navigate needs the morph plugin");v=await(l?l.res:fetch(t,{...o,signal:f.signal,headers:{"X-Requested-With":"litevue"}}));const n=new URL(v.url||t);if(n.hash||=new URL(t).hash,!v.headers.get("content-type")?.includes("text/html")||!r(n)||!v.ok&&!m)throw v.body?.cancel(),new Error(`cannot render ${v.status} from ${n.href}`);const i=await v.text();if(f!==h)return;const s=(new DOMParser).parseFromString(i,"text/html"),p=document.querySelector(d);if(!p||!s.querySelector(d))throw new Error(`no ${d} in ${n.href}`);if(c(s)!==c(document))throw new Error(`${n.href} loads different scripts or styles`);s.querySelectorAll("script,noscript").forEach(e=>/^\s*(module\s*)?$|script/i.test(e.type||"")&&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][href]:not([disabled],[href=""])')&&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())})(s),b=v.ok,g=()=>f===h&&L(p,s,n,b,y,a);u.transition&&document.startViewTransition?document.startViewTransition(g):g()}catch(y){if(f.signal.aborted)return;s("error",{url:t,error:y}),m?v?.redirected&&location.assign(v.url):location.assign(t)}finally{f===h&&w([])}},T=e=>{const t=e.target.closest?.("a[href]");if(!(t instanceof HTMLAnchorElement))return;if(n(t)||t.hasAttribute("download"))return;if(t.target&&"_self"!==t.target)return;const a=new URL(t.href,location.href);return!r(a)||a.href.includes("#")&&o(a)===o(location)?void 0:a},q=e=>{if(e.defaultPrevented||e.button||e.metaKey||e.ctrlKey)return;if(e.shiftKey||e.altKey)return;const t=T(e);t&&(e.preventDefault(),A(t.href))},x=e=>{const t=T(e);if(!t||o(t)===f||g(t.href))return;p?.c.abort();const r=new AbortController;p={href:t.href,at:Date.now(),c:r,res:fetch(t.href,{signal:r.signal,headers:{"X-Requested-With":"litevue","X-Sec-Purpose":"prefetch"}})},p.res.catch(()=>{})},P=e=>{clearTimeout(v),v=setTimeout(x,100,e)},R=()=>clearTimeout(v),C=u.prefetch?[["pointerover",P],["focusin",P],["pointerout",R],["focusout",R],["pointerdown",x]]:[],$=e=>{const t=e.target,o=e.submitter,i=e=>o?.getAttribute("form"+e)||t.getAttribute(e),s=(i("method")||"get").toLowerCase(),c=i("target"),l=i("enctype")?.toLowerCase();if(e.defaultPrevented||"dialog"===s||n(t))return;if("text/plain"===l)return;if(c&&"_self"!==c)return;const u=new URL(i("action")||location.href,location.href);if(!r(u))return;const d=new FormData(t);if(o?.name&&d.append(o.name,o.value),e.preventDefault(),"post"===s){if(m.has(t))return;return m.add(t),A(u.href,{method:"POST",body:"multipart/form-data"===l?d:a(d)},t).finally(()=>m.delete(t))}u.search=a(d).toString(),A(u.href,{},t)},k=()=>{clearTimeout(y),y=setTimeout(i,150)},D=e=>{clearTimeout(y),o(location)!==f&&A(location.href,{},void 0,e.state?.y||0)};return document.addEventListener("click",q),document.addEventListener("submit",$),C.forEach(([e,t])=>document.addEventListener(e,t)),addEventListener("popstate",D),addEventListener("scroll",k),()=>{clearTimeout(y),removeEventListener("scroll",k),h=h?.abort(),p?.c.abort(),clearTimeout(v),document.removeEventListener("click",q),document.removeEventListener("submit",$),C.forEach(([e,t])=>document.removeEventListener(e,t)),removeEventListener("popstate",D),history.scrollRestoration=E,w([]),S.remove()}},e}({});
1
+ var LiteVueNavigate=function(e){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=>new URLSearchParams([...e].map(([e,t])=>[e,t.name??t])),i=()=>history.replaceState({...history.state,y:scrollY},""),s=(e,t,r=!1)=>document.dispatchEvent(new CustomEvent("navigate:"+e,{detail:t,cancelable:r})),c=e=>[...e.head.querySelectorAll("[data-navigate-track]")].map(e=>e.getAttribute("src")||e.getAttribute("href")).sort().join();return e.navigate=(e,l={})=>{const u=l.target||"body";let d,h=o(location);const m=new WeakSet;let f,p,v,y=[];const b=e=>f?.href===e&&Date.now()-f.at<1e4,g=e=>{y.forEach(e=>e.removeAttribute("aria-busy")),(y=e).forEach(e=>e.setAttribute("aria-busy","true"))},w=history.scrollRestoration;history.scrollRestoration="manual";const E=document.createElement("div");E.id="litevue-navigate-status",E.setAttribute("aria-live","polite"),E.setAttribute("data-morph-preserve",""),E.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)",document.body.append(E);const L=(r,n,a,i,c,d)=>{if(i&&null==d&&history[a.href===location.href?"replaceState":"pushState"]({},"",a.href),h=o(location),document.title=n.title,((e,r,o,n,a)=>{const i=[];r(o,n,{values:a,beforeNodeAdded:e=>{1===e.nodeType&&i.push(e)}}),i.forEach(r=>r.isConnected&&!(e=>{for(;e;e=e.parentElement)if(e.__ctx)return!0;return!1})(r)&&(r.matches(t)||r.querySelector(t))&&e.mount(r))})(e,e.scope.$morph,r,n.querySelector(u),i),c(),!1!==l.scroll){const e=a.hash.slice(1),t=null==d&&e&&(document.getElementById(e)||document.getElementById((e=>{try{return decodeURIComponent(e)}catch{return e}})(e)));t?t.scrollIntoView():scrollTo(0,d||0)}i&&(e=>{const t=e.querySelector("[autofocus]");t?t.focus():e===document.body?document.activeElement?.blur?.():(e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0}))})(r),E.textContent=document.title||document.querySelector("h1")?.textContent?.trim()||location.pathname,s("after",{url:a.href})},S=async(t,o={},n,a)=>{if(!s("before",{url:t},null==a))return;const h=!o.method&&b(t)?f:f?.c.abort();f=void 0,d?.abort();const m=d=h?h.c:new AbortController;g([document.documentElement,n].filter(Boolean));const p="POST"===o.method;let v;null==a&&i();try{if(!e.scope.$morph)throw new Error("navigate needs the morph plugin");v=await(h?h.res:fetch(t,{...o,signal:m.signal,headers:{"X-Requested-With":"litevue"}}));const n=new URL(v.url||t);if(n.hash||=new URL(t).hash,!v.headers.get("content-type")?.includes("text/html")||!r(n)||!v.ok&&(!p||v.redirected))throw v.body?.cancel(),new Error(`cannot render ${v.status} from ${n.href}`);const i=await v.text();if(m!==d)return;const s=(new DOMParser).parseFromString(i,"text/html"),f=document.querySelector(u);if(!f||!s.querySelector(u))throw new Error(`no ${u} in ${n.href}`);if(c(s)!==c(document))throw new Error(`${n.href} loads different scripts or styles`);[s,f].forEach(e=>e.querySelectorAll("script,noscript").forEach(e=>/^\s*(module\s*)?$|script/i.test(e.type||"")&&e.remove()));const y=await(async e=>{const t="link,style,meta",r=[...document.head.querySelectorAll(t)],o=[];let n;for(const a of e.head.querySelectorAll(t)){const e=r.findIndex(e=>e.isEqualNode(a));if(e>-1){[n]=r.splice(e,1);continue}const t=document.importNode(a,!0);t.matches('link[rel=stylesheet][href]:not([disabled]):not([href=""])')&&o.push(new Promise(e=>{t.addEventListener("load",e),t.addEventListener("error",e)})),n?n.after(t):document.head.prepend(t),n=t}return await Promise.all(o),()=>r.forEach(e=>e.matches("[data-navigate-preserve]")||e.remove())})(s),b=v.ok,w=()=>m===d&&(g([]),L(f,s,n,b,y,a));l.transition&&document.startViewTransition?document.startViewTransition(w):w()}catch(y){if(m.signal.aborted)return;g([]),s("error",{url:t,error:y}),p?v?.redirected&&location.assign(v.url):location.assign(t)}},A=e=>{const t=e.target.closest?.("a[href]");if(!(t instanceof HTMLAnchorElement))return;if(n(t)||t.hasAttribute("download"))return;if(t.target&&"_self"!==t.target)return;const a=new URL(t.href,location.href);return!r(a)||a.href.includes("#")&&o(a)===o(location)?void 0:a},T=e=>e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,q=e=>{if(e.defaultPrevented||T(e))return;const t=A(e);t&&(e.preventDefault(),S(t.href))},x=e=>{const t=A(e);if(!t||o(t)===h||b(t.href))return;f?.c.abort();const r=new AbortController;f={href:t.href,at:Date.now(),c:r,res:fetch(t.href,{signal:r.signal,headers:{"X-Requested-With":"litevue","X-Sec-Purpose":"prefetch"}})},f.res.catch(()=>{})},R=e=>{clearTimeout(p),p=setTimeout(x,100,e)},C=()=>clearTimeout(p),P=l.prefetch?[["pointerover",R],["focusin",R],["pointerout",C],["focusout",C],["pointerdown",e=>T(e)||x(e)]]:[],$=e=>{const t=e.target,o=e.submitter,i=e=>o?.getAttribute("form"+e)||t.getAttribute(e),s=(i("method")||"get").toLowerCase(),c=i("target"),l=i("enctype")?.toLowerCase();if(e.defaultPrevented||"dialog"===s||n(t))return;if("text/plain"===l)return;if(c&&"_self"!==c)return;const u=new URL(i("action")||location.href,document.baseURI);if(!r(u))return;const d=new FormData(t);if(o?.name&&d.append(o.name,o.value),e.preventDefault(),"post"===s){if(m.has(t))return;return m.add(t),S(u.href,{method:"POST",body:"multipart/form-data"===l?d:a(d)},t).finally(()=>m.delete(t))}u.search=a(d).toString(),S(u.href,{},t)},k=()=>{clearTimeout(v),v=setTimeout(i,150)},U=e=>{clearTimeout(v),o(location)!==h&&S(location.href,{},void 0,e.state?.y||0)};return document.addEventListener("click",q),document.addEventListener("submit",$),P.forEach(([e,t])=>document.addEventListener(e,t)),addEventListener("popstate",U),addEventListener("scroll",k),()=>{clearTimeout(v),removeEventListener("scroll",k),d=d?.abort(),f?.c.abort(),clearTimeout(p),document.removeEventListener("click",q),document.removeEventListener("submit",$),P.forEach(([e,t])=>document.removeEventListener(e,t)),removeEventListener("popstate",U),history.scrollRestoration=w,g([]),E.remove()}},e}({});
@@ -1 +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=>new URLSearchParams([...e].map(([e,t])=>[e,t.name??t])),a=()=>history.replaceState({...history.state,y:scrollY},""),i=(e,t,r=!1)=>document.dispatchEvent(new CustomEvent("navigate:"+e,{detail:t,cancelable:r})),s=e=>[...e.head.querySelectorAll("[data-navigate-track]")].map(e=>e.getAttribute("src")||e.getAttribute("href")).sort().join(),c=e=>{for(;e;e=e.parentElement)if(e.__ctx)return!0;return!1},l=(l,u={})=>{const d=u.target||"body";let h,f=r(location);const m=/* @__PURE__ */new WeakSet;let p,v,y,b=[];const w=e=>p?.href===e&&Date.now()-p.at<1e4,E=e=>{b.forEach(e=>e.removeAttribute("aria-busy")),(b=e).forEach(e=>e.setAttribute("aria-busy","true"))},g=history.scrollRestoration;history.scrollRestoration="manual";const S=document.createElement("div");S.id="litevue-navigate-status",S.setAttribute("aria-live","polite"),S.setAttribute("data-morph-preserve",""),S.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)",document.body.append(S);const A=(t,o,n,a,s,h)=>{if(a&&null==h&&history[n.href===location.href?"replaceState":"pushState"]({},"",n.href),f=r(location),document.title=o.title,((t,r,o,n,a)=>{const i=[o,...o.querySelectorAll("*")].filter(e=>e.__ctx&&!c(e.parentElement)),s=[];r(o,n,{values:a,beforeNodeAdded:e=>{1===e.nodeType&&s.push(e)}}),i.forEach(e=>e.isConnected||t.unmount(e)),s.forEach(r=>r.isConnected&&!c(r)&&(r.matches(e)||r.querySelector(e))&&t.mount(r))})(l,l.scope.$morph,t,o.querySelector(d),a),s(),!1!==u.scroll){const e=null==h&&n.hash&&document.getElementById(n.hash.slice(1));e?e.scrollIntoView():scrollTo(0,h||0)}a&&(e=>{const t=e.querySelector("[autofocus]");t?t.focus():e===document.body?document.activeElement?.blur?.():(e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0}))})(t),S.textContent=document.title||document.querySelector("h1")?.textContent?.trim()||location.pathname,i("after",{url:n.href})},L=async(e,r={},o,n)=>{if(!i("before",{url:e},null==n))return;const c=!r.method&&w(e)?p:p?.c.abort();p=void 0,h?.abort();const f=h=c?c.c:new AbortController;E([document.documentElement,o].filter(Boolean));const m="POST"===r.method;let v;null==n&&a();try{if(!l.scope.$morph)throw new Error("navigate needs the morph plugin");v=await(c?c.res:fetch(e,{...r,signal:f.signal,headers:{"X-Requested-With":"litevue"}}));const o=new URL(v.url||e);if(o.hash||=new URL(e).hash,!v.headers.get("content-type")?.includes("text/html")||!t(o)||!v.ok&&!m)throw v.body?.cancel(),new Error(`cannot render ${v.status} from ${o.href}`);const a=await v.text();if(f!==h)return;const i=(new DOMParser).parseFromString(a,"text/html"),p=document.querySelector(d);if(!p||!i.querySelector(d))throw new Error(`no ${d} in ${o.href}`);if(s(i)!==s(document))throw new Error(`${o.href} loads different scripts or styles`);i.querySelectorAll("script,noscript").forEach(e=>/^\s*(module\s*)?$|script/i.test(e.type||"")&&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][href]:not([disabled],[href=""])')&&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())})(i),b=v.ok,w=()=>f===h&&A(p,i,o,b,y,n);u.transition&&document.startViewTransition?document.startViewTransition(w):w()}catch(y){if(f.signal.aborted)return;i("error",{url:e,error:y}),m?v?.redirected&&location.assign(v.url):location.assign(e)}finally{f===h&&E([])}},T=e=>{const n=e.target.closest?.("a[href]");if(!(n instanceof HTMLAnchorElement))return;if(o(n)||n.hasAttribute("download"))return;if(n.target&&"_self"!==n.target)return;const a=new URL(n.href,location.href);return!t(a)||a.href.includes("#")&&r(a)===r(location)?void 0:a},x=e=>{if(e.defaultPrevented||e.button||e.metaKey||e.ctrlKey)return;if(e.shiftKey||e.altKey)return;const t=T(e);t&&(e.preventDefault(),L(t.href))},q=e=>{const t=T(e);if(!t||r(t)===f||w(t.href))return;p?.c.abort();const o=new AbortController;p={href:t.href,at:Date.now(),c:o,res:fetch(t.href,{signal:o.signal,headers:{"X-Requested-With":"litevue","X-Sec-Purpose":"prefetch"}})},p.res.catch(()=>{})},R=e=>{clearTimeout(v),v=setTimeout(q,100,e)},C=()=>clearTimeout(v),P=u.prefetch?[["pointerover",R],["focusin",R],["pointerout",C],["focusout",C],["pointerdown",q]]:[],$=e=>{const r=e.target,a=e.submitter,i=e=>a?.getAttribute("form"+e)||r.getAttribute(e),s=(i("method")||"get").toLowerCase(),c=i("target"),l=i("enctype")?.toLowerCase();if(e.defaultPrevented||"dialog"===s||o(r))return;if("text/plain"===l)return;if(c&&"_self"!==c)return;const u=new URL(i("action")||location.href,location.href);if(!t(u))return;const d=new FormData(r);if(a?.name&&d.append(a.name,a.value),e.preventDefault(),"post"===s){if(m.has(r))return;return m.add(r),L(u.href,{method:"POST",body:"multipart/form-data"===l?d:n(d)},r).finally(()=>m.delete(r))}u.search=n(d).toString(),L(u.href,{},r)},k=()=>{clearTimeout(y),y=setTimeout(a,150)},D=e=>{clearTimeout(y),r(location)!==f&&L(location.href,{},void 0,e.state?.y||0)};return document.addEventListener("click",x),document.addEventListener("submit",$),P.forEach(([e,t])=>document.addEventListener(e,t)),addEventListener("popstate",D),addEventListener("scroll",k),()=>{clearTimeout(y),removeEventListener("scroll",k),h=h?.abort(),p?.c.abort(),clearTimeout(v),document.removeEventListener("click",x),document.removeEventListener("submit",$),P.forEach(([e,t])=>document.removeEventListener(e,t)),removeEventListener("popstate",D),history.scrollRestoration=g,E([]),S.remove()}};export{l as navigate};
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=>new URLSearchParams([...e].map(([e,t])=>[e,t.name??t])),a=()=>history.replaceState({...history.state,y:scrollY},""),i=(e,t,r=!1)=>document.dispatchEvent(new CustomEvent("navigate:"+e,{detail:t,cancelable:r})),s=e=>[...e.head.querySelectorAll("[data-navigate-track]")].map(e=>e.getAttribute("src")||e.getAttribute("href")).sort().join(),c=(c,l={})=>{const u=l.target||"body";let d,h=r(location);const m=/* @__PURE__ */new WeakSet;let f,p,v,y=[];const b=e=>f?.href===e&&Date.now()-f.at<1e4,w=e=>{y.forEach(e=>e.removeAttribute("aria-busy")),(y=e).forEach(e=>e.setAttribute("aria-busy","true"))},g=history.scrollRestoration;history.scrollRestoration="manual";const E=document.createElement("div");E.id="litevue-navigate-status",E.setAttribute("aria-live","polite"),E.setAttribute("data-morph-preserve",""),E.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)",document.body.append(E);const S=(t,o,n,a,s,d)=>{if(a&&null==d&&history[n.href===location.href?"replaceState":"pushState"]({},"",n.href),h=r(location),document.title=o.title,((t,r,o,n,a)=>{const i=[];r(o,n,{values:a,beforeNodeAdded:e=>{1===e.nodeType&&i.push(e)}}),i.forEach(r=>r.isConnected&&!(e=>{for(;e;e=e.parentElement)if(e.__ctx)return!0;return!1})(r)&&(r.matches(e)||r.querySelector(e))&&t.mount(r))})(c,c.scope.$morph,t,o.querySelector(u),a),s(),!1!==l.scroll){const e=n.hash.slice(1),t=null==d&&e&&(document.getElementById(e)||document.getElementById((e=>{try{return decodeURIComponent(e)}catch{return e}})(e)));t?t.scrollIntoView():scrollTo(0,d||0)}a&&(e=>{const t=e.querySelector("[autofocus]");t?t.focus():e===document.body?document.activeElement?.blur?.():(e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0}))})(t),E.textContent=document.title||document.querySelector("h1")?.textContent?.trim()||location.pathname,i("after",{url:n.href})},L=async(e,r={},o,n)=>{if(!i("before",{url:e},null==n))return;const h=!r.method&&b(e)?f:f?.c.abort();f=void 0,d?.abort();const m=d=h?h.c:new AbortController;w([document.documentElement,o].filter(Boolean));const p="POST"===r.method;let v;null==n&&a();try{if(!c.scope.$morph)throw new Error("navigate needs the morph plugin");v=await(h?h.res:fetch(e,{...r,signal:m.signal,headers:{"X-Requested-With":"litevue"}}));const o=new URL(v.url||e);if(o.hash||=new URL(e).hash,!v.headers.get("content-type")?.includes("text/html")||!t(o)||!v.ok&&(!p||v.redirected))throw v.body?.cancel(),new Error(`cannot render ${v.status} from ${o.href}`);const a=await v.text();if(m!==d)return;const i=(new DOMParser).parseFromString(a,"text/html"),f=document.querySelector(u);if(!f||!i.querySelector(u))throw new Error(`no ${u} in ${o.href}`);if(s(i)!==s(document))throw new Error(`${o.href} loads different scripts or styles`);[i,f].forEach(e=>e.querySelectorAll("script,noscript").forEach(e=>/^\s*(module\s*)?$|script/i.test(e.type||"")&&e.remove()));const y=await(async e=>{const t="link,style,meta",r=[...document.head.querySelectorAll(t)],o=[];let n;for(const a of e.head.querySelectorAll(t)){const e=r.findIndex(e=>e.isEqualNode(a));if(e>-1){[n]=r.splice(e,1);continue}const t=document.importNode(a,!0);t.matches('link[rel=stylesheet][href]:not([disabled]):not([href=""])')&&o.push(new Promise(e=>{t.addEventListener("load",e),t.addEventListener("error",e)})),n?n.after(t):document.head.prepend(t),n=t}return await Promise.all(o),()=>r.forEach(e=>e.matches("[data-navigate-preserve]")||e.remove())})(i),b=v.ok,g=()=>m===d&&(w([]),S(f,i,o,b,y,n));l.transition&&document.startViewTransition?document.startViewTransition(g):g()}catch(y){if(m.signal.aborted)return;w([]),i("error",{url:e,error:y}),p?v?.redirected&&location.assign(v.url):location.assign(e)}},A=e=>{const n=e.target.closest?.("a[href]");if(!(n instanceof HTMLAnchorElement))return;if(o(n)||n.hasAttribute("download"))return;if(n.target&&"_self"!==n.target)return;const a=new URL(n.href,location.href);return!t(a)||a.href.includes("#")&&r(a)===r(location)?void 0:a},T=e=>e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,x=e=>{if(e.defaultPrevented||T(e))return;const t=A(e);t&&(e.preventDefault(),L(t.href))},q=e=>{const t=A(e);if(!t||r(t)===h||b(t.href))return;f?.c.abort();const o=new AbortController;f={href:t.href,at:Date.now(),c:o,res:fetch(t.href,{signal:o.signal,headers:{"X-Requested-With":"litevue","X-Sec-Purpose":"prefetch"}})},f.res.catch(()=>{})},R=e=>{clearTimeout(p),p=setTimeout(q,100,e)},C=()=>clearTimeout(p),P=l.prefetch?[["pointerover",R],["focusin",R],["pointerout",C],["focusout",C],["pointerdown",e=>T(e)||q(e)]]:[],$=e=>{const r=e.target,a=e.submitter,i=e=>a?.getAttribute("form"+e)||r.getAttribute(e),s=(i("method")||"get").toLowerCase(),c=i("target"),l=i("enctype")?.toLowerCase();if(e.defaultPrevented||"dialog"===s||o(r))return;if("text/plain"===l)return;if(c&&"_self"!==c)return;const u=new URL(i("action")||location.href,document.baseURI);if(!t(u))return;const d=new FormData(r);if(a?.name&&d.append(a.name,a.value),e.preventDefault(),"post"===s){if(m.has(r))return;return m.add(r),L(u.href,{method:"POST",body:"multipart/form-data"===l?d:n(d)},r).finally(()=>m.delete(r))}u.search=n(d).toString(),L(u.href,{},r)},k=()=>{clearTimeout(v),v=setTimeout(a,150)},U=e=>{clearTimeout(v),r(location)!==h&&L(location.href,{},void 0,e.state?.y||0)};return document.addEventListener("click",x),document.addEventListener("submit",$),P.forEach(([e,t])=>document.addEventListener(e,t)),addEventListener("popstate",U),addEventListener("scroll",k),()=>{clearTimeout(v),removeEventListener("scroll",k),d=d?.abort(),f?.c.abort(),clearTimeout(p),document.removeEventListener("click",x),document.removeEventListener("submit",$),P.forEach(([e,t])=>document.removeEventListener(e,t)),removeEventListener("popstate",U),history.scrollRestoration=g,w([]),E.remove()}};export{c as navigate};
@@ -1 +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=>new URLSearchParams([...e].map(([e,t])=>[e,t.name??t])),i=()=>history.replaceState({...history.state,y:scrollY},""),s=(e,t,r=!1)=>document.dispatchEvent(new CustomEvent("navigate:"+e,{detail:t,cancelable:r})),c=e=>[...e.head.querySelectorAll("[data-navigate-track]")].map(e=>e.getAttribute("src")||e.getAttribute("href")).sort().join(),l=e=>{for(;e;e=e.parentElement)if(e.__ctx)return!0;return!1};e.navigate=(e,u={})=>{const d=u.target||"body";let f,h=o(location);const m=new WeakSet;let p,v,y,b=[];const g=e=>p?.href===e&&Date.now()-p.at<1e4,w=e=>{b.forEach(e=>e.removeAttribute("aria-busy")),(b=e).forEach(e=>e.setAttribute("aria-busy","true"))},E=history.scrollRestoration;history.scrollRestoration="manual";const S=document.createElement("div");S.id="litevue-navigate-status",S.setAttribute("aria-live","polite"),S.setAttribute("data-morph-preserve",""),S.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)",document.body.append(S);const L=(r,n,a,i,c,f)=>{if(i&&null==f&&history[a.href===location.href?"replaceState":"pushState"]({},"",a.href),h=o(location),document.title=n.title,((e,r,o,n,a)=>{const i=[o,...o.querySelectorAll("*")].filter(e=>e.__ctx&&!l(e.parentElement)),s=[];r(o,n,{values:a,beforeNodeAdded:e=>{1===e.nodeType&&s.push(e)}}),i.forEach(t=>t.isConnected||e.unmount(t)),s.forEach(r=>r.isConnected&&!l(r)&&(r.matches(t)||r.querySelector(t))&&e.mount(r))})(e,e.scope.$morph,r,n.querySelector(d),i),c(),!1!==u.scroll){const e=null==f&&a.hash&&document.getElementById(a.hash.slice(1));e?e.scrollIntoView():scrollTo(0,f||0)}i&&(e=>{const t=e.querySelector("[autofocus]");t?t.focus():e===document.body?document.activeElement?.blur?.():(e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0}))})(r),S.textContent=document.title||document.querySelector("h1")?.textContent?.trim()||location.pathname,s("after",{url:a.href})},A=async(t,o={},n,a)=>{if(!s("before",{url:t},null==a))return;const l=!o.method&&g(t)?p:p?.c.abort();p=void 0,f?.abort();const h=f=l?l.c:new AbortController;w([document.documentElement,n].filter(Boolean));const m="POST"===o.method;let v;null==a&&i();try{if(!e.scope.$morph)throw new Error("navigate needs the morph plugin");v=await(l?l.res:fetch(t,{...o,signal:h.signal,headers:{"X-Requested-With":"litevue"}}));const n=new URL(v.url||t);if(n.hash||=new URL(t).hash,!v.headers.get("content-type")?.includes("text/html")||!r(n)||!v.ok&&!m)throw v.body?.cancel(),new Error(`cannot render ${v.status} from ${n.href}`);const i=await v.text();if(h!==f)return;const s=(new DOMParser).parseFromString(i,"text/html"),p=document.querySelector(d);if(!p||!s.querySelector(d))throw new Error(`no ${d} in ${n.href}`);if(c(s)!==c(document))throw new Error(`${n.href} loads different scripts or styles`);s.querySelectorAll("script,noscript").forEach(e=>/^\s*(module\s*)?$|script/i.test(e.type||"")&&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][href]:not([disabled],[href=""])')&&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())})(s),b=v.ok,g=()=>h===f&&L(p,s,n,b,y,a);u.transition&&document.startViewTransition?document.startViewTransition(g):g()}catch(y){if(h.signal.aborted)return;s("error",{url:t,error:y}),m?v?.redirected&&location.assign(v.url):location.assign(t)}finally{h===f&&w([])}},T=e=>{const t=e.target.closest?.("a[href]");if(!(t instanceof HTMLAnchorElement))return;if(n(t)||t.hasAttribute("download"))return;if(t.target&&"_self"!==t.target)return;const a=new URL(t.href,location.href);return!r(a)||a.href.includes("#")&&o(a)===o(location)?void 0:a},x=e=>{if(e.defaultPrevented||e.button||e.metaKey||e.ctrlKey)return;if(e.shiftKey||e.altKey)return;const t=T(e);t&&(e.preventDefault(),A(t.href))},q=e=>{const t=T(e);if(!t||o(t)===h||g(t.href))return;p?.c.abort();const r=new AbortController;p={href:t.href,at:Date.now(),c:r,res:fetch(t.href,{signal:r.signal,headers:{"X-Requested-With":"litevue","X-Sec-Purpose":"prefetch"}})},p.res.catch(()=>{})},P=e=>{clearTimeout(v),v=setTimeout(q,100,e)},R=()=>clearTimeout(v),C=u.prefetch?[["pointerover",P],["focusin",P],["pointerout",R],["focusout",R],["pointerdown",q]]:[],$=e=>{const t=e.target,o=e.submitter,i=e=>o?.getAttribute("form"+e)||t.getAttribute(e),s=(i("method")||"get").toLowerCase(),c=i("target"),l=i("enctype")?.toLowerCase();if(e.defaultPrevented||"dialog"===s||n(t))return;if("text/plain"===l)return;if(c&&"_self"!==c)return;const u=new URL(i("action")||location.href,location.href);if(!r(u))return;const d=new FormData(t);if(o?.name&&d.append(o.name,o.value),e.preventDefault(),"post"===s){if(m.has(t))return;return m.add(t),A(u.href,{method:"POST",body:"multipart/form-data"===l?d:a(d)},t).finally(()=>m.delete(t))}u.search=a(d).toString(),A(u.href,{},t)},k=()=>{clearTimeout(y),y=setTimeout(i,150)},D=e=>{clearTimeout(y),o(location)!==h&&A(location.href,{},void 0,e.state?.y||0)};return document.addEventListener("click",x),document.addEventListener("submit",$),C.forEach(([e,t])=>document.addEventListener(e,t)),addEventListener("popstate",D),addEventListener("scroll",k),()=>{clearTimeout(y),removeEventListener("scroll",k),f=f?.abort(),p?.c.abort(),clearTimeout(v),document.removeEventListener("click",x),document.removeEventListener("submit",$),C.forEach(([e,t])=>document.removeEventListener(e,t)),removeEventListener("popstate",D),history.scrollRestoration=E,w([]),S.remove()}}});
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){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=>new URLSearchParams([...e].map(([e,t])=>[e,t.name??t])),i=()=>history.replaceState({...history.state,y:scrollY},""),s=(e,t,r=!1)=>document.dispatchEvent(new CustomEvent("navigate:"+e,{detail:t,cancelable:r})),c=e=>[...e.head.querySelectorAll("[data-navigate-track]")].map(e=>e.getAttribute("src")||e.getAttribute("href")).sort().join();e.navigate=(e,l={})=>{const u=l.target||"body";let d,h=o(location);const f=new WeakSet;let m,p,v,y=[];const b=e=>m?.href===e&&Date.now()-m.at<1e4,g=e=>{y.forEach(e=>e.removeAttribute("aria-busy")),(y=e).forEach(e=>e.setAttribute("aria-busy","true"))},w=history.scrollRestoration;history.scrollRestoration="manual";const E=document.createElement("div");E.id="litevue-navigate-status",E.setAttribute("aria-live","polite"),E.setAttribute("data-morph-preserve",""),E.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)",document.body.append(E);const L=(r,n,a,i,c,d)=>{if(i&&null==d&&history[a.href===location.href?"replaceState":"pushState"]({},"",a.href),h=o(location),document.title=n.title,((e,r,o,n,a)=>{const i=[];r(o,n,{values:a,beforeNodeAdded:e=>{1===e.nodeType&&i.push(e)}}),i.forEach(r=>r.isConnected&&!(e=>{for(;e;e=e.parentElement)if(e.__ctx)return!0;return!1})(r)&&(r.matches(t)||r.querySelector(t))&&e.mount(r))})(e,e.scope.$morph,r,n.querySelector(u),i),c(),!1!==l.scroll){const e=a.hash.slice(1),t=null==d&&e&&(document.getElementById(e)||document.getElementById((e=>{try{return decodeURIComponent(e)}catch{return e}})(e)));t?t.scrollIntoView():scrollTo(0,d||0)}i&&(e=>{const t=e.querySelector("[autofocus]");t?t.focus():e===document.body?document.activeElement?.blur?.():(e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0}))})(r),E.textContent=document.title||document.querySelector("h1")?.textContent?.trim()||location.pathname,s("after",{url:a.href})},S=async(t,o={},n,a)=>{if(!s("before",{url:t},null==a))return;const h=!o.method&&b(t)?m:m?.c.abort();m=void 0,d?.abort();const f=d=h?h.c:new AbortController;g([document.documentElement,n].filter(Boolean));const p="POST"===o.method;let v;null==a&&i();try{if(!e.scope.$morph)throw new Error("navigate needs the morph plugin");v=await(h?h.res:fetch(t,{...o,signal:f.signal,headers:{"X-Requested-With":"litevue"}}));const n=new URL(v.url||t);if(n.hash||=new URL(t).hash,!v.headers.get("content-type")?.includes("text/html")||!r(n)||!v.ok&&(!p||v.redirected))throw v.body?.cancel(),new Error(`cannot render ${v.status} from ${n.href}`);const i=await v.text();if(f!==d)return;const s=(new DOMParser).parseFromString(i,"text/html"),m=document.querySelector(u);if(!m||!s.querySelector(u))throw new Error(`no ${u} in ${n.href}`);if(c(s)!==c(document))throw new Error(`${n.href} loads different scripts or styles`);[s,m].forEach(e=>e.querySelectorAll("script,noscript").forEach(e=>/^\s*(module\s*)?$|script/i.test(e.type||"")&&e.remove()));const y=await(async e=>{const t="link,style,meta",r=[...document.head.querySelectorAll(t)],o=[];let n;for(const a of e.head.querySelectorAll(t)){const e=r.findIndex(e=>e.isEqualNode(a));if(e>-1){[n]=r.splice(e,1);continue}const t=document.importNode(a,!0);t.matches('link[rel=stylesheet][href]:not([disabled]):not([href=""])')&&o.push(new Promise(e=>{t.addEventListener("load",e),t.addEventListener("error",e)})),n?n.after(t):document.head.prepend(t),n=t}return await Promise.all(o),()=>r.forEach(e=>e.matches("[data-navigate-preserve]")||e.remove())})(s),b=v.ok,w=()=>f===d&&(g([]),L(m,s,n,b,y,a));l.transition&&document.startViewTransition?document.startViewTransition(w):w()}catch(y){if(f.signal.aborted)return;g([]),s("error",{url:t,error:y}),p?v?.redirected&&location.assign(v.url):location.assign(t)}},A=e=>{const t=e.target.closest?.("a[href]");if(!(t instanceof HTMLAnchorElement))return;if(n(t)||t.hasAttribute("download"))return;if(t.target&&"_self"!==t.target)return;const a=new URL(t.href,location.href);return!r(a)||a.href.includes("#")&&o(a)===o(location)?void 0:a},T=e=>e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,x=e=>{if(e.defaultPrevented||T(e))return;const t=A(e);t&&(e.preventDefault(),S(t.href))},q=e=>{const t=A(e);if(!t||o(t)===h||b(t.href))return;m?.c.abort();const r=new AbortController;m={href:t.href,at:Date.now(),c:r,res:fetch(t.href,{signal:r.signal,headers:{"X-Requested-With":"litevue","X-Sec-Purpose":"prefetch"}})},m.res.catch(()=>{})},R=e=>{clearTimeout(p),p=setTimeout(q,100,e)},C=()=>clearTimeout(p),P=l.prefetch?[["pointerover",R],["focusin",R],["pointerout",C],["focusout",C],["pointerdown",e=>T(e)||q(e)]]:[],$=e=>{const t=e.target,o=e.submitter,i=e=>o?.getAttribute("form"+e)||t.getAttribute(e),s=(i("method")||"get").toLowerCase(),c=i("target"),l=i("enctype")?.toLowerCase();if(e.defaultPrevented||"dialog"===s||n(t))return;if("text/plain"===l)return;if(c&&"_self"!==c)return;const u=new URL(i("action")||location.href,document.baseURI);if(!r(u))return;const d=new FormData(t);if(o?.name&&d.append(o.name,o.value),e.preventDefault(),"post"===s){if(f.has(t))return;return f.add(t),S(u.href,{method:"POST",body:"multipart/form-data"===l?d:a(d)},t).finally(()=>f.delete(t))}u.search=a(d).toString(),S(u.href,{},t)},k=()=>{clearTimeout(v),v=setTimeout(i,150)},U=e=>{clearTimeout(v),o(location)!==h&&S(location.href,{},void 0,e.state?.y||0)};return document.addEventListener("click",x),document.addEventListener("submit",$),P.forEach(([e,t])=>document.addEventListener(e,t)),addEventListener("popstate",U),addEventListener("scroll",k),()=>{clearTimeout(v),removeEventListener("scroll",k),d=d?.abort(),m?.c.abort(),clearTimeout(p),document.removeEventListener("click",x),document.removeEventListener("submit",$),P.forEach(([e,t])=>document.removeEventListener(e,t)),removeEventListener("popstate",U),history.scrollRestoration=w,g([]),E.remove()}}});
@@ -1,5 +1,4 @@
1
1
  var LiteVuePersist = (function(exports, _aevantec_litevue) {
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
2
  // src/plugins/persist/index.ts
4
3
  var PREFIX = "litevue:";
5
4
  /** Custom storages registered by name, usable as a directive modifier. */
@@ -14,7 +13,7 @@ var LiteVuePersist = (function(exports, _aevantec_litevue) {
14
13
  var resolve = (storage) => {
15
14
  const target = storage ?? defaultStorage;
16
15
  if (typeof target !== "string") return target;
17
- return registry[target] ?? builtin(target);
16
+ return registry[target.toLowerCase()] ?? builtin(target);
18
17
  };
19
18
  /**
20
19
  * Register a custom storage under a name, selectable anywhere — including as a
@@ -25,7 +24,7 @@ var LiteVuePersist = (function(exports, _aevantec_litevue) {
25
24
  * <div v-persist.memory="scratch">…</div>
26
25
  */
27
26
  var registerStorage = (name, storage) => {
28
- registry[name] = storage;
27
+ registry[name.toLowerCase()] = storage;
29
28
  };
30
29
  /**
31
30
  * Switch the storage used when none is specified. Accepts a registered name
@@ -13,7 +13,7 @@ var builtin = (name) => {
13
13
  var resolve = (storage) => {
14
14
  const target = storage ?? defaultStorage;
15
15
  if (typeof target !== "string") return target;
16
- return registry[target] ?? builtin(target);
16
+ return registry[target.toLowerCase()] ?? builtin(target);
17
17
  };
18
18
  /**
19
19
  * Register a custom storage under a name, selectable anywhere — including as a
@@ -24,7 +24,7 @@ var resolve = (storage) => {
24
24
  * <div v-persist.memory="scratch">…</div>
25
25
  */
26
26
  var registerStorage = (name, storage) => {
27
- registry[name] = storage;
27
+ registry[name.toLowerCase()] = storage;
28
28
  };
29
29
  /**
30
30
  * Switch the storage used when none is specified. Accepts a registered name
@@ -1 +1 @@
1
- var LiteVuePersist=function(t,e){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});var r="litevue:",o=Object.create(null),s="local",n=t=>{const e=t??s;return"string"!=typeof e?e:o[e]??(t=>{try{if("local"===t||"localStorage"===t)return localStorage;if("session"===t||"sessionStorage"===t)return sessionStorage}catch{}})(e)},i=(t,e,r,o,s)=>{if(!o)return s(()=>{});const n=((t,e)=>(e??Object.keys(t)).filter(e=>{if("$"===e[0])return!1;const r=Object.getOwnPropertyDescriptor(t,e);if(r&&r.get&&!r.set)return!1;const o=r&&r.value;return(!o||!0!==o.__v_isRef||!0!==o.__v_isReadonly)&&"function"!=typeof t[e]}))(t,r);try{const r=JSON.parse(o.getItem(e)||"null");if(r)for(const e of n)({}).hasOwnProperty.call(r,e)&&(t[e]=r[e])}catch{}return s(()=>{const r={};for(const e of n)r[e]=t[e];try{o.setItem(e,JSON.stringify(r))}catch{}})};return t.persist=t=>{t.directive("persist",({ctx:t,el:e,exp:o,arg:s,modifiers:c,effect:a})=>{const f=r+(o||e.id);let l=c?void 0:n();for(const r in c)if(l=n(r))break;const u=s?s.split(",").map(t=>t.trim()).filter(Boolean):void 0;i(t.scope,f,u,l,a)})},t.persistStore=(t,o={})=>{const s=(0,e.store)(t);if(!s)return()=>{};const c=n(o.storage);return i(s,r+(o.key??t),o.keys,c,e.watchEffect)},t.registerStorage=(t,e)=>{o[t]=e},t.setDefaultStorage=t=>{s=t},t}({},LiteVue);
1
+ var LiteVuePersist=function(t,e){var r="litevue:",o=Object.create(null),s="local",n=t=>{const e=t??s;return"string"!=typeof e?e:o[e.toLowerCase()]??(t=>{try{if("local"===t||"localStorage"===t)return localStorage;if("session"===t||"sessionStorage"===t)return sessionStorage}catch{}})(e)},i=(t,e,r,o,s)=>{if(!o)return s(()=>{});const n=((t,e)=>(e??Object.keys(t)).filter(e=>{if("$"===e[0])return!1;const r=Object.getOwnPropertyDescriptor(t,e);if(r&&r.get&&!r.set)return!1;const o=r&&r.value;return(!o||!0!==o.__v_isRef||!0!==o.__v_isReadonly)&&"function"!=typeof t[e]}))(t,r);try{const r=JSON.parse(o.getItem(e)||"null");if(r)for(const e of n)({}).hasOwnProperty.call(r,e)&&(t[e]=r[e])}catch{}return s(()=>{const r={};for(const e of n)r[e]=t[e];try{o.setItem(e,JSON.stringify(r))}catch{}})};return t.persist=t=>{t.directive("persist",({ctx:t,el:e,exp:o,arg:s,modifiers:c,effect:a})=>{const f=r+(o||e.id);let l=c?void 0:n();for(const r in c)if(l=n(r))break;const u=s?s.split(",").map(t=>t.trim()).filter(Boolean):void 0;i(t.scope,f,u,l,a)})},t.persistStore=(t,o={})=>{const s=(0,e.store)(t);if(!s)return()=>{};const c=n(o.storage);return i(s,r+(o.key??t),o.keys,c,e.watchEffect)},t.registerStorage=(t,e)=>{o[t.toLowerCase()]=e},t.setDefaultStorage=t=>{s=t},t}({},LiteVue);
@@ -1 +1 @@
1
- import{store as t,watchEffect as e}from"@aevantec/litevue";var r="litevue:",o=Object.create(null),s="local",n=t=>{const e=t??s;return"string"!=typeof e?e:o[e]??(t=>{try{if("local"===t||"localStorage"===t)return localStorage;if("session"===t||"sessionStorage"===t)return sessionStorage}catch{}})(e)},c=(t,e)=>{o[t]=e},i=t=>{s=t},a=(t,e,r,o,s)=>{if(!o)return s(()=>{});const n=((t,e)=>(e??Object.keys(t)).filter(e=>{if("$"===e[0])return!1;const r=Object.getOwnPropertyDescriptor(t,e);if(r&&r.get&&!r.set)return!1;const o=r&&r.value;return(!o||!0!==o.__v_isRef||!0!==o.__v_isReadonly)&&"function"!=typeof t[e]}))(t,r);try{const r=JSON.parse(o.getItem(e)||"null");if(r)for(const e of n)({}).hasOwnProperty.call(r,e)&&(t[e]=r[e])}catch{}return s(()=>{const r={};for(const e of n)r[e]=t[e];try{o.setItem(e,JSON.stringify(r))}catch{}})},f=t=>{t.directive("persist",({ctx:t,el:e,exp:o,arg:s,modifiers:c,effect:i})=>{const f=r+(o||e.id);let l=c?void 0:n();for(const r in c)if(l=n(r))break;const u=s?s.split(",").map(t=>t.trim()).filter(Boolean):void 0;a(t.scope,f,u,l,i)})},l=(o,s={})=>{const c=t(o);if(!c)return()=>{};const i=n(s.storage);return a(c,r+(s.key??o),s.keys,i,e)};export{f as persist,l as persistStore,c as registerStorage,i as setDefaultStorage};
1
+ import{store as t,watchEffect as e}from"@aevantec/litevue";var r="litevue:",o=Object.create(null),s="local",n=t=>{const e=t??s;return"string"!=typeof e?e:o[e.toLowerCase()]??(t=>{try{if("local"===t||"localStorage"===t)return localStorage;if("session"===t||"sessionStorage"===t)return sessionStorage}catch{}})(e)},c=(t,e)=>{o[t.toLowerCase()]=e},i=t=>{s=t},a=(t,e,r,o,s)=>{if(!o)return s(()=>{});const n=((t,e)=>(e??Object.keys(t)).filter(e=>{if("$"===e[0])return!1;const r=Object.getOwnPropertyDescriptor(t,e);if(r&&r.get&&!r.set)return!1;const o=r&&r.value;return(!o||!0!==o.__v_isRef||!0!==o.__v_isReadonly)&&"function"!=typeof t[e]}))(t,r);try{const r=JSON.parse(o.getItem(e)||"null");if(r)for(const e of n)({}).hasOwnProperty.call(r,e)&&(t[e]=r[e])}catch{}return s(()=>{const r={};for(const e of n)r[e]=t[e];try{o.setItem(e,JSON.stringify(r))}catch{}})},f=t=>{t.directive("persist",({ctx:t,el:e,exp:o,arg:s,modifiers:c,effect:i})=>{const f=r+(o||e.id);let l=c?void 0:n();for(const r in c)if(l=n(r))break;const u=s?s.split(",").map(t=>t.trim()).filter(Boolean):void 0;a(t.scope,f,u,l,i)})},l=(o,s={})=>{const c=t(o);if(!c)return()=>{};const i=n(s.storage);return a(c,r+(s.key??o),s.keys,i,e)};export{f as persist,l as persistStore,c as registerStorage,i as setDefaultStorage};
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@aevantec/litevue")):"function"==typeof define&&define.amd?define(["exports","@aevantec/litevue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).LiteVuePersist={},e.LiteVue)}(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var r="litevue:",o=Object.create(null),s="local",i=e=>{const t=e??s;return"string"!=typeof t?t:o[t]??(e=>{try{if("local"===e||"localStorage"===e)return localStorage;if("session"===e||"sessionStorage"===e)return sessionStorage}catch{}})(t)},n=(e,t,r,o,s)=>{if(!o)return s(()=>{});const i=((e,t)=>(t??Object.keys(e)).filter(t=>{if("$"===t[0])return!1;const r=Object.getOwnPropertyDescriptor(e,t);if(r&&r.get&&!r.set)return!1;const o=r&&r.value;return(!o||!0!==o.__v_isRef||!0!==o.__v_isReadonly)&&"function"!=typeof e[t]}))(e,r);try{const r=JSON.parse(o.getItem(t)||"null");if(r)for(const t of i)({}).hasOwnProperty.call(r,t)&&(e[t]=r[t])}catch{}return s(()=>{const r={};for(const t of i)r[t]=e[t];try{o.setItem(t,JSON.stringify(r))}catch{}})};e.persist=e=>{e.directive("persist",({ctx:e,el:t,exp:o,arg:s,modifiers:c,effect:f})=>{const a=r+(o||t.id);let l=c?void 0:i();for(const r in c)if(l=i(r))break;const u=s?s.split(",").map(e=>e.trim()).filter(Boolean):void 0;n(e.scope,a,u,l,f)})},e.persistStore=(e,o={})=>{const s=(0,t.store)(e);if(!s)return()=>{};const c=i(o.storage);return n(s,r+(o.key??e),o.keys,c,t.watchEffect)},e.registerStorage=(e,t)=>{o[e]=t},e.setDefaultStorage=e=>{s=e}});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@aevantec/litevue")):"function"==typeof define&&define.amd?define(["exports","@aevantec/litevue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).LiteVuePersist={},e.LiteVue)}(this,function(e,t){var r="litevue:",o=Object.create(null),s="local",i=e=>{const t=e??s;return"string"!=typeof t?t:o[t.toLowerCase()]??(e=>{try{if("local"===e||"localStorage"===e)return localStorage;if("session"===e||"sessionStorage"===e)return sessionStorage}catch{}})(t)},n=(e,t,r,o,s)=>{if(!o)return s(()=>{});const i=((e,t)=>(t??Object.keys(e)).filter(t=>{if("$"===t[0])return!1;const r=Object.getOwnPropertyDescriptor(e,t);if(r&&r.get&&!r.set)return!1;const o=r&&r.value;return(!o||!0!==o.__v_isRef||!0!==o.__v_isReadonly)&&"function"!=typeof e[t]}))(e,r);try{const r=JSON.parse(o.getItem(t)||"null");if(r)for(const t of i)({}).hasOwnProperty.call(r,t)&&(e[t]=r[t])}catch{}return s(()=>{const r={};for(const t of i)r[t]=e[t];try{o.setItem(t,JSON.stringify(r))}catch{}})};e.persist=e=>{e.directive("persist",({ctx:e,el:t,exp:o,arg:s,modifiers:c,effect:f})=>{const a=r+(o||t.id);let l=c?void 0:i();for(const r in c)if(l=i(r))break;const u=s?s.split(",").map(e=>e.trim()).filter(Boolean):void 0;n(e.scope,a,u,l,f)})},e.persistStore=(e,o={})=>{const s=(0,t.store)(e);if(!s)return()=>{};const c=i(o.storage);return n(s,r+(o.key??e),o.keys,c,t.watchEffect)},e.registerStorage=(e,t)=>{o[e.toLowerCase()]=t},e.setDefaultStorage=e=>{s=e}});
@@ -1 +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"},s=0,r=(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())};return t.popover=t=>{t.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);r.addEventListener("toggle",i);const p=()=>{const t=!!e();r.isConnected&&t!==r.matches(":popover-open")&&(t?r.showPopover():r.hidePopover())};return o(()=>{r.isConnected?p():(e(),Promise.resolve().then(p))}),()=>r.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,h=/^(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 t="--litevue-anchor-"+ ++s;return l.hasAttribute("popover")||(l.style.position="absolute"),l.style.margin=h?`${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(()=>{r(g,t,!1),g=n(),r(g,t,!0)}),()=>{r(g,t,!1),l.style.cssText=c}}const v=()=>{!g||l.popover&&!l.matches(":popover-open")||((t,e,s,r)=>{const[n,i]=s.split("-"),p=e.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},c=f[n]<0&&f[o[n]]>=0?o[n]:n,h="top"===c||"bottom"===c,[g,v,m]=h?[p.left,p.width,t.offsetWidth]:[p.top,p.height,t.offsetHeight],d="start"===i?g:"end"===i?g+v-m:g+(v-m)/2,b="top"===c?p.top-a:"bottom"===c?p.bottom+r:"left"===c?p.left-l:p.right+r;t.style.left=(h?d:b)+"px",t.style.top=(h?b:d)+"px"})(l,g,a,f)};return i(()=>{g=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}({});
1
+ var LiteVuePopover=function(t){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,n=(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",t.__anchor=r.join())};return t.popover=t=>{t.directive("popover",({el:t,get:e,effect:o,exp:r})=>{const n=t;n.popover||(n.popover="auto");const s=e(`(val) => { ${r} = val }`),i=t=>s?.("open"===t.newState);n.addEventListener("toggle",i);const p=()=>{const t=!!e();n.isConnected&&t!==n.matches(":popover-open")&&(t?n.showPopover():n.hidePopover())};return o(()=>{n.isConnected?p():(e(),Promise.resolve().then(p))}),()=>n.removeEventListener("toggle",i)}),t.directive("anchor",({el:t,get:s,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=[],h=(t,e)=>{c.unshift([t,l.style.getPropertyValue(t)]),l.style.setProperty(t,e)},v=()=>c.forEach(([t,e])=>l.style.setProperty(t,e)),g=/^(top|bottom)/.test(a);let m;if(h("position","fixed"),h("inset","auto"),h("margin","0"),CSS.supports("anchor-name: --a")){const t="--litevue-anchor-"+ ++r;return l.matches("[popover],[v-popover]")||h("position","absolute"),h("margin",g?`${f}px 0`:`0 ${f}px`),h("position-anchor",t),h("position-area",e[a]),h("position-try-fallbacks","flip-block, flip-inline"),i(()=>{n(m,t,!1),m=s(),n(m,t,!0)}),()=>{n(m,t,!1),v()}}const d=()=>{!m||l.popover&&!l.matches(":popover-open")||((t,e,r,n)=>{const[s,i]=r.split("-"),p=e.getBoundingClientRect(),l=t.offsetWidth+n,a=t.offsetHeight+n,f={top:p.top-a,bottom:innerHeight-p.bottom-a,left:p.left-l,right:innerWidth-p.right-l},c=f[s]<0&&f[o[s]]>=0?o[s]:s,h="top"===c||"bottom"===c,[v,g,m]=h?[p.left,p.width,t.offsetWidth]:[p.top,p.height,t.offsetHeight],d="start"===i?v:"end"===i?v+g-m:v+(g-m)/2,b="top"===c?p.top-a:"bottom"===c?p.bottom+n:"left"===c?p.left-l:p.right+n;t.style.left=(h?d:b)+"px",t.style.top=(h?b:d)+"px"})(l,m,a,f)};i(()=>{m=s(),d()});const b=new ResizeObserver(d);return b.observe(l),addEventListener("scroll",d,!0),addEventListener("resize",d),l.addEventListener("toggle",d),()=>{b.disconnect(),removeEventListener("scroll",d,!0),removeEventListener("resize",d),l.removeEventListener("toggle",d),v()}})},t}({});
@@ -1 +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);r.addEventListener("toggle",i);const p=()=>{const t=!!e();r.isConnected&&t!==r.matches(":popover-open")&&(t?r.showPopover():r.hidePopover())};return o(()=>{r.isConnected?p():(e(),Promise.resolve().then(p))}),()=>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 c=l.style.cssText,h=/^(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=h?`${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=c}}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},c=f[n]<0&&f[e[n]]>=0?e[n]:n,h="top"===c||"bottom"===c,[g,m,v]=h?[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"===c?p.top-a:"bottom"===c?p.bottom+r:"left"===c?p.left-l:p.right+r;t.style.left=(h?d:b)+"px",t.style.top=(h?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=c}})};export{r as popover};
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,n=(t,e,o)=>{if(!t)return;const n=t.style.getPropertyValue("anchor-name").split(/\s*,\s*/).filter(t=>t&&t!==e);o&&n.push(e),t.style.setProperty("anchor-name",t.__anchor=n.join())},r=r=>{r.directive("popover",({el:t,get:e,effect:o,exp:n})=>{const r=t;r.popover||(r.popover="auto");const s=e(`(val) => { ${n} = val }`),i=t=>s?.("open"===t.newState);r.addEventListener("toggle",i);const p=()=>{const t=!!e();r.isConnected&&t!==r.matches(":popover-open")&&(t?r.showPopover():r.hidePopover())};return o(()=>{r.isConnected?p():(e(),Promise.resolve().then(p))}),()=>r.removeEventListener("toggle",i)}),r.directive("anchor",({el:r,get:s,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 c=[],h=(t,e)=>{c.unshift([t,l.style.getPropertyValue(t)]),l.style.setProperty(t,e)},g=()=>c.forEach(([t,e])=>l.style.setProperty(t,e)),v=/^(top|bottom)/.test(a);let m;if(h("position","fixed"),h("inset","auto"),h("margin","0"),CSS.supports("anchor-name: --a")){const e="--litevue-anchor-"+ ++o;return l.matches("[popover],[v-popover]")||h("position","absolute"),h("margin",v?`${f}px 0`:`0 ${f}px`),h("position-anchor",e),h("position-area",t[a]),h("position-try-fallbacks","flip-block, flip-inline"),i(()=>{n(m,e,!1),m=s(),n(m,e,!0)}),()=>{n(m,e,!1),g()}}const d=()=>{!m||l.popover&&!l.matches(":popover-open")||((t,o,n,r)=>{const[s,i]=n.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},c=f[s]<0&&f[e[s]]>=0?e[s]:s,h="top"===c||"bottom"===c,[g,v,m]=h?[p.left,p.width,t.offsetWidth]:[p.top,p.height,t.offsetHeight],d="start"===i?g:"end"===i?g+v-m:g+(v-m)/2,b="top"===c?p.top-a:"bottom"===c?p.bottom+r:"left"===c?p.left-l:p.right+r;t.style.left=(h?d:b)+"px",t.style.top=(h?b:d)+"px"})(l,m,a,f)};i(()=>{m=s(),d()});const b=new ResizeObserver(d);return b.observe(l),addEventListener("scroll",d,!0),addEventListener("resize",d),l.addEventListener("toggle",d),()=>{b.disconnect(),removeEventListener("scroll",d,!0),removeEventListener("resize",d),l.removeEventListener("toggle",d),g()}})};export{r as popover};
@@ -1 +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);n.addEventListener("toggle",i);const p=()=>{const t=!!e();n.isConnected&&t!==n.matches(":popover-open")&&(t?n.showPopover():n.hidePopover())};return o(()=>{n.isConnected?p():(e(),Promise.resolve().then(p))}),()=>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 d;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(d,t,!1),d=r(),n(d,t,!0)}),()=>{n(d,t,!1),l.style.cssText=c}}const g=()=>{!d||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,[d,g,m]=h?[p.left,p.width,t.offsetWidth]:[p.top,p.height,t.offsetHeight],v="start"===i?d:"end"===i?d+g-m:d+(g-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,d,f,a)};return i(()=>{d=r(),g()}),addEventListener("scroll",g,!0),addEventListener("resize",g),l.addEventListener("toggle",g),()=>{removeEventListener("scroll",g,!0),removeEventListener("resize",g),l.removeEventListener("toggle",g),l.style.cssText=c}})}});
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){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"},n=0,r=(t,e,o)=>{if(!t)return;const n=t.style.getPropertyValue("anchor-name").split(/\s*,\s*/).filter(t=>t&&t!==e);o&&n.push(e),t.style.setProperty("anchor-name",t.__anchor=n.join())};t.popover=t=>{t.directive("popover",({el:t,get:e,effect:o,exp:n})=>{const r=t;r.popover||(r.popover="auto");const s=e(`(val) => { ${n} = val }`),i=t=>s?.("open"===t.newState);r.addEventListener("toggle",i);const p=()=>{const t=!!e();r.isConnected&&t!==r.matches(":popover-open")&&(t?r.showPopover():r.hidePopover())};return o(()=>{r.isConnected?p():(e(),Promise.resolve().then(p))}),()=>r.removeEventListener("toggle",i)}),t.directive("anchor",({el:t,get:s,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=[],h=(t,e)=>{c.unshift([t,l.style.getPropertyValue(t)]),l.style.setProperty(t,e)},d=()=>c.forEach(([t,e])=>l.style.setProperty(t,e)),g=/^(top|bottom)/.test(f);let v;if(h("position","fixed"),h("inset","auto"),h("margin","0"),CSS.supports("anchor-name: --a")){const t="--litevue-anchor-"+ ++n;return l.matches("[popover],[v-popover]")||h("position","absolute"),h("margin",g?`${a}px 0`:`0 ${a}px`),h("position-anchor",t),h("position-area",e[f]),h("position-try-fallbacks","flip-block, flip-inline"),i(()=>{r(v,t,!1),v=s(),r(v,t,!0)}),()=>{r(v,t,!1),d()}}const m=()=>{!v||l.popover&&!l.matches(":popover-open")||((t,e,n,r)=>{const[s,i]=n.split("-"),p=e.getBoundingClientRect(),l=t.offsetWidth+r,f=t.offsetHeight+r,a={top:p.top-f,bottom:innerHeight-p.bottom-f,left:p.left-l,right:innerWidth-p.right-l},c=a[s]<0&&a[o[s]]>=0?o[s]:s,h="top"===c||"bottom"===c,[d,g,v]=h?[p.left,p.width,t.offsetWidth]:[p.top,p.height,t.offsetHeight],m="start"===i?d:"end"===i?d+g-v:d+(g-v)/2,b="top"===c?p.top-f:"bottom"===c?p.bottom+r:"left"===c?p.left-l:p.right+r;t.style.left=(h?m:b)+"px",t.style.top=(h?b:m)+"px"})(l,v,f,a)};i(()=>{v=s(),m()});const b=new ResizeObserver(m);return b.observe(l),addEventListener("scroll",m,!0),addEventListener("resize",m),l.addEventListener("toggle",m),()=>{b.disconnect(),removeEventListener("scroll",m,!0),removeEventListener("resize",m),l.removeEventListener("toggle",m),d()}})}});
@@ -1 +1 @@
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}({});
1
+ var LiteVueResize=function(e){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 s=new ResizeObserver(e=>{for(const i of e){const e=i.contentRect;r(e.width,e.height)}});return s.observe(e),()=>s.disconnect()})},e}({});
@@ -1 +1 @@
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()})}});
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){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()})}});
@@ -1 +1 @@
1
- var LiteVueTransition=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var t=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),n=(e,n)=>{const a=e.split(","),i=n.split(",");let r=0;for(let l=0;l<a.length;l++)r=Math.max(r,t(a[l])+t(i[l%i.length]));return r};return e.transition=e=>{e.directive("transition",({el:e,get:t,effect:a,arg:i,modifiers:r,exp:l})=>{const o=e,s=i||"v",c=e=>`${s}-${e}`;let m,u=0;const v=()=>{o.classList.remove(c("enter-from"),c("enter-active"),c("enter-to"),c("leave-from"),c("leave-active"),c("leave-to"))},d=(e,t)=>{const a=++u;v(),o.classList.add(c(e+"-from"),c(e+"-active")),o.offsetWidth,o.classList.remove(c(e+"-from")),o.classList.add(c(e+"-to")),clearTimeout(m),m=setTimeout(()=>{a===u&&(v(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(n(t.transitionDuration,t.transitionDelay),n(t.animationDuration,t.animationDelay))})(o))};if(!l){let e=!0;return Promise.resolve().then(()=>{e&&d("enter")}),o.__leave=()=>(e=!1,new Promise(e=>d("leave",e))),()=>{e=!1,clearTimeout(m),v(),delete o.__leave}}const y="none"==o.style.display?"":o.style.display;let f;return a(()=>{const e=!!t();if(e===f)return;const n=null!=f;f=e,e?(o.style.display=y,(n||r?.appear)&&d("enter")):n?d("leave",()=>{o.style.display="none"}):o.style.display="none"}),()=>{clearTimeout(m),v()}})},e}({});
1
+ var LiteVueTransition=function(e){var t=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),n=(e,n)=>{const a=e.split(","),i=n.split(",");let s=0;for(let l=0;l<a.length;l++)s=Math.max(s,t(a[l])+t(i[l%i.length]));return s};return e.transition=e=>{e.directive("transition",({el:e,get:t,effect:a,arg:i,modifiers:s,exp:l})=>{const r=e,o=i||"v",c=e=>`${o}-${e}`;let m,v=0;const u=()=>{r.classList.remove(c("enter-from"),c("enter-active"),c("enter-to"),c("leave-from"),c("leave-active"),c("leave-to"))},d=(e,t)=>{const a=++v;u(),r.classList.add(c(e+"-from"),c(e+"-active")),r.offsetWidth,r.classList.remove(c(e+"-from")),r.classList.add(c(e+"-to")),clearTimeout(m),m=setTimeout(()=>{a===v&&(u(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(n(t.transitionDuration,t.transitionDelay),n(t.animationDuration,t.animationDelay))})(r))};if(!l){let e=!0;return Promise.resolve().then(()=>{e&&d("enter")}),r.__leave=()=>(e=!1,r.__leaving=1,new Promise(e=>d("leave",e))),()=>{e=!1,clearTimeout(m),u(),delete r.__leave}}const y="none"==r.style.display?"":r.style.display;let f;return a(()=>{const e=!!t();if(e===f)return;const n=null!=f;f=e,e?(r.style.display=y,(n||s?.appear)&&d("enter")):n?d("leave",()=>{r.style.display="none"}):r.style.display="none"}),()=>{clearTimeout(m),u(),!1===f&&(r.style.display="none")}})},e}({});
@@ -1 +1 @@
1
- var e=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),t=(t,a)=>{const s=t.split(","),l=a.split(",");let n=0;for(let i=0;i<s.length;i++)n=Math.max(n,e(s[i])+e(l[i%l.length]));return n},a=e=>{e.directive("transition",({el:e,get:a,effect:s,arg:l,modifiers:n,exp:i})=>{const o=e,r=l||"v",c=e=>`${r}-${e}`;let m,v=0;const d=()=>{o.classList.remove(c("enter-from"),c("enter-active"),c("enter-to"),c("leave-from"),c("leave-active"),c("leave-to"))},u=(e,a)=>{const s=++v;d(),o.classList.add(c(e+"-from"),c(e+"-active")),o.offsetWidth,o.classList.remove(c(e+"-from")),o.classList.add(c(e+"-to")),clearTimeout(m),m=setTimeout(()=>{s===v&&(d(),a&&a())},(e=>{const a=getComputedStyle(e);return Math.max(t(a.transitionDuration,a.transitionDelay),t(a.animationDuration,a.animationDelay))})(o))};if(!i){let e=!0;return Promise.resolve().then(()=>{e&&u("enter")}),o.__leave=()=>(e=!1,new Promise(e=>u("leave",e))),()=>{e=!1,clearTimeout(m),d(),delete o.__leave}}const p="none"==o.style.display?"":o.style.display;let y;return s(()=>{const e=!!a();if(e===y)return;const t=null!=y;y=e,e?(o.style.display=p,(t||n?.appear)&&u("enter")):t?u("leave",()=>{o.style.display="none"}):o.style.display="none"}),()=>{clearTimeout(m),d()}})};export{a as transition};
1
+ var e=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),t=(t,a)=>{const l=t.split(","),s=a.split(",");let n=0;for(let i=0;i<l.length;i++)n=Math.max(n,e(l[i])+e(s[i%s.length]));return n},a=e=>{e.directive("transition",({el:e,get:a,effect:l,arg:s,modifiers:n,exp:i})=>{const o=e,r=s||"v",c=e=>`${r}-${e}`;let m,v=0;const d=()=>{o.classList.remove(c("enter-from"),c("enter-active"),c("enter-to"),c("leave-from"),c("leave-active"),c("leave-to"))},y=(e,a)=>{const l=++v;d(),o.classList.add(c(e+"-from"),c(e+"-active")),o.offsetWidth,o.classList.remove(c(e+"-from")),o.classList.add(c(e+"-to")),clearTimeout(m),m=setTimeout(()=>{l===v&&(d(),a&&a())},(e=>{const a=getComputedStyle(e);return Math.max(t(a.transitionDuration,a.transitionDelay),t(a.animationDuration,a.animationDelay))})(o))};if(!i){let e=!0;return Promise.resolve().then(()=>{e&&y("enter")}),o.__leave=()=>(e=!1,o.__leaving=1,new Promise(e=>y("leave",e))),()=>{e=!1,clearTimeout(m),d(),delete o.__leave}}const p="none"==o.style.display?"":o.style.display;let u;return l(()=>{const e=!!a();if(e===u)return;const t=null!=u;u=e,e?(o.style.display=p,(t||n?.appear)&&y("enter")):t?y("leave",()=>{o.style.display="none"}):o.style.display="none"}),()=>{clearTimeout(m),d(),!1===u&&(o.style.display="none")}})};export{a as transition};
@@ -1 +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).LiteVueTransition={})}(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var t=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),n=(e,n)=>{const o=e.split(","),i=n.split(",");let s=0;for(let a=0;a<o.length;a++)s=Math.max(s,t(o[a])+t(i[a%i.length]));return s};e.transition=e=>{e.directive("transition",({el:e,get:t,effect:o,arg:i,modifiers:s,exp:a})=>{const l=e,r=i||"v",c=e=>`${r}-${e}`;let d,f=0;const u=()=>{l.classList.remove(c("enter-from"),c("enter-active"),c("enter-to"),c("leave-from"),c("leave-active"),c("leave-to"))},m=(e,t)=>{const o=++f;u(),l.classList.add(c(e+"-from"),c(e+"-active")),l.offsetWidth,l.classList.remove(c(e+"-from")),l.classList.add(c(e+"-to")),clearTimeout(d),d=setTimeout(()=>{o===f&&(u(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(n(t.transitionDuration,t.transitionDelay),n(t.animationDuration,t.animationDelay))})(l))};if(!a){let e=!0;return Promise.resolve().then(()=>{e&&m("enter")}),l.__leave=()=>(e=!1,new Promise(e=>m("leave",e))),()=>{e=!1,clearTimeout(d),u(),delete l.__leave}}const p="none"==l.style.display?"":l.style.display;let y;return o(()=>{const e=!!t();if(e===y)return;const n=null!=y;y=e,e?(l.style.display=p,(n||s?.appear)&&m("enter")):n?m("leave",()=>{l.style.display="none"}):l.style.display="none"}),()=>{clearTimeout(d),u()}})}});
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).LiteVueTransition={})}(this,function(e){var t=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),n=(e,n)=>{const i=e.split(","),o=n.split(",");let s=0;for(let a=0;a<i.length;a++)s=Math.max(s,t(i[a])+t(o[a%o.length]));return s};e.transition=e=>{e.directive("transition",({el:e,get:t,effect:i,arg:o,modifiers:s,exp:a})=>{const l=e,r=o||"v",c=e=>`${r}-${e}`;let d,f=0;const m=()=>{l.classList.remove(c("enter-from"),c("enter-active"),c("enter-to"),c("leave-from"),c("leave-active"),c("leave-to"))},u=(e,t)=>{const i=++f;m(),l.classList.add(c(e+"-from"),c(e+"-active")),l.offsetWidth,l.classList.remove(c(e+"-from")),l.classList.add(c(e+"-to")),clearTimeout(d),d=setTimeout(()=>{i===f&&(m(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(n(t.transitionDuration,t.transitionDelay),n(t.animationDuration,t.animationDelay))})(l))};if(!a){let e=!0;return Promise.resolve().then(()=>{e&&u("enter")}),l.__leave=()=>(e=!1,l.__leaving=1,new Promise(e=>u("leave",e))),()=>{e=!1,clearTimeout(d),m(),delete l.__leave}}const p="none"==l.style.display?"":l.style.display;let y;return i(()=>{const e=!!t();if(e===y)return;const n=null!=y;y=e,e?(l.style.display=p,(n||s?.appear)&&u("enter")):n?u("leave",()=>{l.style.display="none"}):l.style.display="none"}),()=>{clearTimeout(d),m(),!1===y&&(l.style.display="none")}})}});
@@ -25,7 +25,9 @@ export interface App {
25
25
  * Returns an unregister function; a full `unmount()` also releases it.
26
26
  */
27
27
  onError(handler: ErrorHandler): () => void;
28
- mount(el?: string | Element | null): App | void;
28
+ mount(el?: Element | null): App;
29
+ /** A selector that matches no element mounts nothing and returns undefined. */
30
+ mount(el: string): App | undefined;
29
31
  /**
30
32
  * Tear down every mounted root, or — given an element or selector — only the
31
33
  * roots at or inside it, leaving the rest of the app running.
@@ -25,7 +25,9 @@ export interface App {
25
25
  * Returns an unregister function; a full `unmount()` also releases it.
26
26
  */
27
27
  onError(handler: ErrorHandler): () => void;
28
- mount(el?: string | Element | null): App | void;
28
+ mount(el?: Element | null): App;
29
+ /** A selector that matches no element mounts nothing and returns undefined. */
30
+ mount(el: string): App | undefined;
29
31
  /**
30
32
  * Tear down every mounted root, or — given an element or selector — only the
31
33
  * roots at or inside it, leaving the rest of the app running.
@@ -29,5 +29,5 @@ export declare const createContext: (parent?: Context) => Context;
29
29
  * that on every update, which reset each row's $id and wiped its $refs.
30
30
  */
31
31
  export declare const hide: (scope: any, key: string, value: any) => any;
32
- export declare const createScopedContext: (ctx: Context, data?: {}) => Context;
32
+ export declare const createScopedContext: (ctx: Context, data?: {}, isRow?: boolean) => Context;
33
33
  export declare const bindContextMethods: (scope: Record<string, any>, raw?: Record<string, any>) => void;
@@ -29,5 +29,5 @@ export declare const createContext: (parent?: Context) => Context;
29
29
  * that on every update, which reset each row's $id and wiped its $refs.
30
30
  */
31
31
  export declare const hide: (scope: any, key: string, value: any) => any;
32
- export declare const createScopedContext: (ctx: Context, data?: {}) => Context;
32
+ export declare const createScopedContext: (ctx: Context, data?: {}, isRow?: boolean) => Context;
33
33
  export declare const bindContextMethods: (scope: Record<string, any>, raw?: Record<string, any>) => void;
@@ -1,14 +1,16 @@
1
+ import type { MenuOption } from './menu.mjs';
1
2
  export declare const icon: (paths: string) => string;
2
3
  export type ThemeMode = 'dark' | 'light' | 'system';
3
- export type Dock = 'float' | 'bottom' | 'right';
4
+ export type Dock = 'float' | 'left' | 'bottom' | 'right';
4
5
  export interface UiState {
5
6
  open?: boolean;
6
7
  right?: number;
7
8
  bottom?: number;
8
9
  w?: number;
9
10
  h?: number;
10
- /** dock-bottom height and dock-right width, remembered separately */
11
+ /** dock-bottom height and dock-left / dock-right widths, remembered separately */
11
12
  bh?: number;
13
+ lw?: number;
12
14
  rw?: number;
13
15
  dock?: Dock;
14
16
  }
@@ -20,9 +22,8 @@ export declare const themeIcons: Record<ThemeMode, string>;
20
22
  /** Dock icons: an outlined viewport with the docked region filled, per browser
21
23
  * devtools convention. Floating shows a detached window. */
22
24
  export declare const dockIcons: Record<Dock, string>;
23
- export declare const nextDock: Record<Dock, Dock>;
24
- export declare const dockTitles: Record<Dock, string>;
25
- export declare const nextTheme: Record<ThemeMode, ThemeMode>;
25
+ export declare const dockOptions: MenuOption<Dock>[];
26
+ export declare const themeOptions: MenuOption<ThemeMode>[];
26
27
  export declare const MIN_W = 320;
27
28
  export declare const MIN_H = 320;
28
29
  export declare const maxW: () => number;
@@ -1,14 +1,16 @@
1
+ import type { MenuOption } from './menu';
1
2
  export declare const icon: (paths: string) => string;
2
3
  export type ThemeMode = 'dark' | 'light' | 'system';
3
- export type Dock = 'float' | 'bottom' | 'right';
4
+ export type Dock = 'float' | 'left' | 'bottom' | 'right';
4
5
  export interface UiState {
5
6
  open?: boolean;
6
7
  right?: number;
7
8
  bottom?: number;
8
9
  w?: number;
9
10
  h?: number;
10
- /** dock-bottom height and dock-right width, remembered separately */
11
+ /** dock-bottom height and dock-left / dock-right widths, remembered separately */
11
12
  bh?: number;
13
+ lw?: number;
12
14
  rw?: number;
13
15
  dock?: Dock;
14
16
  }
@@ -20,9 +22,8 @@ export declare const themeIcons: Record<ThemeMode, string>;
20
22
  /** Dock icons: an outlined viewport with the docked region filled, per browser
21
23
  * devtools convention. Floating shows a detached window. */
22
24
  export declare const dockIcons: Record<Dock, string>;
23
- export declare const nextDock: Record<Dock, Dock>;
24
- export declare const dockTitles: Record<Dock, string>;
25
- export declare const nextTheme: Record<ThemeMode, ThemeMode>;
25
+ export declare const dockOptions: MenuOption<Dock>[];
26
+ export declare const themeOptions: MenuOption<ThemeMode>[];
26
27
  export declare const MIN_W = 320;
27
28
  export declare const MIN_H = 320;
28
29
  export declare const maxW: () => number;
@@ -0,0 +1,12 @@
1
+ export interface MenuOption<T extends string> {
2
+ value: T;
3
+ label: string;
4
+ icon: string;
5
+ }
6
+ export interface Menu<T extends string> {
7
+ /** The wrapper to place in the header. */
8
+ el: HTMLElement;
9
+ /** Shows `value` as current, without calling `onSelect`. */
10
+ set: (value: T) => void;
11
+ }
12
+ export declare const createMenu: <T extends string>(name: string, options: MenuOption<T>[], onSelect: (value: T) => void) => Menu<T>;
@@ -0,0 +1,12 @@
1
+ export interface MenuOption<T extends string> {
2
+ value: T;
3
+ label: string;
4
+ icon: string;
5
+ }
6
+ export interface Menu<T extends string> {
7
+ /** The wrapper to place in the header. */
8
+ el: HTMLElement;
9
+ /** Shows `value` as current, without calling `onSelect`. */
10
+ set: (value: T) => void;
11
+ }
12
+ export declare const createMenu: <T extends string>(name: string, options: MenuOption<T>[], onSelect: (value: T) => void) => Menu<T>;