@aevantec/litevue 0.5.16 → 0.5.17
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-plugins.dev.iife.js +32 -29
- package/dist/litevue-plugins.dev.mjs +32 -29
- 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 +232 -213
- package/dist/litevue.dev.mjs +232 -213
- package/dist/litevue.iife.js +1 -1
- package/dist/litevue.mjs +1 -1
- package/dist/litevue.umd.js +1 -1
- package/dist/plugins/focus.iife.js +1 -1
- package/dist/plugins/focus.mjs +1 -1
- package/dist/plugins/focus.umd.js +1 -1
- package/dist/plugins/mask.iife.js +1 -1
- package/dist/plugins/mask.mjs +1 -1
- package/dist/plugins/mask.umd.js +1 -1
- package/dist/plugins/media.dev.iife.js +9 -7
- package/dist/plugins/media.dev.mjs +9 -7
- package/dist/plugins/media.iife.js +1 -1
- package/dist/plugins/media.mjs +1 -1
- package/dist/plugins/media.umd.js +1 -1
- package/dist/plugins/morph.dev.iife.js +7 -4
- package/dist/plugins/morph.dev.mjs +7 -4
- 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 +36 -16
- package/dist/plugins/navigate.dev.mjs +36 -16
- package/dist/plugins/navigate.iife.js +1 -1
- package/dist/plugins/navigate.mjs +1 -1
- package/dist/plugins/navigate.umd.js +1 -1
- package/dist/plugins/persist.dev.iife.js +1 -2
- package/dist/plugins/persist.dev.mjs +1 -2
- package/dist/types/block.d.mts +1 -1
- package/dist/types/block.d.ts +1 -1
- package/dist/types/context.d.mts +7 -1
- package/dist/types/context.d.ts +7 -1
- package/dist/types/directives/on.d.mts +2 -0
- package/dist/types/directives/on.d.ts +2 -0
- package/dist/types/directives/show.d.mts +4 -1
- package/dist/types/directives/show.d.ts +4 -1
- package/dist/types/ownership.d.mts +2 -0
- package/dist/types/ownership.d.ts +2 -0
- package/dist/types/scheduler.d.mts +9 -1
- package/dist/types/scheduler.d.ts +9 -1
- package/dist/types/walk.d.mts +1 -0
- package/dist/types/walk.d.ts +1 -0
- package/package.json +2 -2
|
@@ -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=(e,t,r=!1)=>document.dispatchEvent(new CustomEvent("navigate:"+e,{detail:t,cancelable:r})),
|
|
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 A=(r,n,a,i,c,f)=>{if(i&&history[a.href===location.href?"replaceState":"pushState"]({},"",a.href),h=o(location),document.title=n.title,((e,r,o,n)=>{const a=[o,...o.querySelectorAll("*")].filter(e=>e.__ctx&&!l(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&&!l(r)&&(r.matches(t)||r.querySelector(t))&&e.mount(r))})(e,e.scope.$morph,r,n.querySelector(d)),c(),!1!==u.scroll){const e=null==f&&a.hash&&document.getElementById(a.hash.slice(1));e?e.scrollIntoView():scrollTo(0,f||0)}const m=r.querySelector("[autofocus]");m?m.focus():r===document.body?document.activeElement?.blur?.():(r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),r.focus({preventScroll:!0})),S.textContent=document.title||document.querySelector("h1")?.textContent?.trim()||location.pathname,s("after",{url:a.href})},L=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").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())})(s),b=v.ok&&null==a,g=()=>h===f&&A(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(),L(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),k=u.prefetch?[["pointerover",P],["focusin",P],["pointerout",R],["focusout",R],["pointerdown",q]]:[],C=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");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),L(u.href,{method:"POST",body:"multipart/form-data"===l?d:a(d)},t).finally(()=>m.delete(t))}u.search=a(d).toString(),L(u.href,{},t)},$=()=>{clearTimeout(y),y=setTimeout(i,150)},D=e=>{clearTimeout(y),o(location)!==h&&L(location.href,{},void 0,e.state?.y||0)};return document.addEventListener("click",x),document.addEventListener("submit",C),k.forEach(([e,t])=>document.addEventListener(e,t)),addEventListener("popstate",D),addEventListener("scroll",$),()=>{clearTimeout(y),removeEventListener("scroll",$),f?.abort(),p?.c.abort(),clearTimeout(v),document.removeEventListener("click",x),document.removeEventListener("submit",C),k.forEach(([e,t])=>document.removeEventListener(e,t)),removeEventListener("popstate",D),history.scrollRestoration=E,w([]),S.remove()}}});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var LiteVuePersist = (function(exports, _aevantec_litevue) {
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
|
|
3
|
+
// src/plugins/persist/index.ts
|
|
4
4
|
var PREFIX = "litevue:";
|
|
5
5
|
/** Custom storages registered by name, usable as a directive modifier. */
|
|
6
6
|
var registry = Object.create(null);
|
|
@@ -117,7 +117,6 @@ var LiteVuePersist = (function(exports, _aevantec_litevue) {
|
|
|
117
117
|
if (!storage) console.error(`persistStore("${name}") — storage "${String(options.storage)}" is not available.`);
|
|
118
118
|
return sync(target, PREFIX + (options.key ?? name), options.keys, storage, _aevantec_litevue.watchEffect);
|
|
119
119
|
};
|
|
120
|
-
//#endregion
|
|
121
120
|
exports.persist = persist;
|
|
122
121
|
exports.persistStore = persistStore;
|
|
123
122
|
exports.registerStorage = registerStorage;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { store, watchEffect } from "@aevantec/litevue";
|
|
2
|
-
|
|
2
|
+
// src/plugins/persist/index.ts
|
|
3
3
|
var PREFIX = "litevue:";
|
|
4
4
|
/** Custom storages registered by name, usable as a directive modifier. */
|
|
5
5
|
var registry = Object.create(null);
|
|
@@ -116,5 +116,4 @@ var persistStore = (name, options = {}) => {
|
|
|
116
116
|
if (!storage) console.error(`persistStore("${name}") — storage "${String(options.storage)}" is not available.`);
|
|
117
117
|
return sync(target, PREFIX + (options.key ?? name), options.keys, storage, watchEffect);
|
|
118
118
|
};
|
|
119
|
-
//#endregion
|
|
120
119
|
export { persist, persistStore, registerStorage, setDefaultStorage };
|
package/dist/types/block.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ export declare class Block {
|
|
|
7
7
|
isFragment: boolean;
|
|
8
8
|
start?: Text;
|
|
9
9
|
end?: Text;
|
|
10
|
-
owned
|
|
10
|
+
owned?: boolean;
|
|
11
11
|
get el(): any;
|
|
12
12
|
constructor(template: Element, parentCtx: Context, isRoot?: boolean);
|
|
13
13
|
insert(parent: Element, anchor?: Node | null): void;
|
package/dist/types/block.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare class Block {
|
|
|
7
7
|
isFragment: boolean;
|
|
8
8
|
start?: Text;
|
|
9
9
|
end?: Text;
|
|
10
|
-
owned
|
|
10
|
+
owned?: boolean;
|
|
11
11
|
get el(): any;
|
|
12
12
|
constructor(template: Element, parentCtx: Context, isRoot?: boolean);
|
|
13
13
|
insert(parent: Element, anchor?: Node | null): void;
|
package/dist/types/context.d.mts
CHANGED
|
@@ -23,5 +23,11 @@ export interface Context {
|
|
|
23
23
|
dispose?: (node: Node) => void;
|
|
24
24
|
}
|
|
25
25
|
export declare const createContext: (parent?: Context) => Context;
|
|
26
|
+
/**
|
|
27
|
+
* Framework-provided, so non-enumerable: `Object.assign`-ing one scope onto
|
|
28
|
+
* another must copy the user's data and leave these alone. v-for does exactly
|
|
29
|
+
* that on every update, which reset each row's $id and wiped its $refs.
|
|
30
|
+
*/
|
|
31
|
+
export declare const hide: (scope: any, key: string, value: any) => any;
|
|
26
32
|
export declare const createScopedContext: (ctx: Context, data?: {}) => Context;
|
|
27
|
-
export declare const bindContextMethods: (scope: Record<string, any>) => void;
|
|
33
|
+
export declare const bindContextMethods: (scope: Record<string, any>, raw?: Record<string, any>) => void;
|
package/dist/types/context.d.ts
CHANGED
|
@@ -23,5 +23,11 @@ export interface Context {
|
|
|
23
23
|
dispose?: (node: Node) => void;
|
|
24
24
|
}
|
|
25
25
|
export declare const createContext: (parent?: Context) => Context;
|
|
26
|
+
/**
|
|
27
|
+
* Framework-provided, so non-enumerable: `Object.assign`-ing one scope onto
|
|
28
|
+
* another must copy the user's data and leave these alone. v-for does exactly
|
|
29
|
+
* that on every update, which reset each row's $id and wiped its $refs.
|
|
30
|
+
*/
|
|
31
|
+
export declare const hide: (scope: any, key: string, value: any) => any;
|
|
26
32
|
export declare const createScopedContext: (ctx: Context, data?: {}) => Context;
|
|
27
|
-
export declare const bindContextMethods: (scope: Record<string, any>) => void;
|
|
33
|
+
export declare const bindContextMethods: (scope: Record<string, any>, raw?: Record<string, any>) => void;
|
|
@@ -15,6 +15,8 @@ export declare const setOwner: (node: Node | undefined) => Node | undefined;
|
|
|
15
15
|
* the anchor.
|
|
16
16
|
*/
|
|
17
17
|
export declare const own: (dispose: Disposer, node?: Node | undefined) => void;
|
|
18
|
+
/** Withdraws a disposer from `node`, for an owner that removes it itself. */
|
|
19
|
+
export declare const disown: (dispose: Disposer, node: Node) => void;
|
|
18
20
|
/**
|
|
19
21
|
* Disposes `node` and its subtree. Safe on an unowned node, and idempotent —
|
|
20
22
|
* the record is dropped as it runs.
|
|
@@ -15,6 +15,8 @@ export declare const setOwner: (node: Node | undefined) => Node | undefined;
|
|
|
15
15
|
* the anchor.
|
|
16
16
|
*/
|
|
17
17
|
export declare const own: (dispose: Disposer, node?: Node | undefined) => void;
|
|
18
|
+
/** Withdraws a disposer from `node`, for an owner that removes it itself. */
|
|
19
|
+
export declare const disown: (dispose: Disposer, node: Node) => void;
|
|
18
20
|
/**
|
|
19
21
|
* Disposes `node` and its subtree. Safe on an unowned node, and idempotent —
|
|
20
22
|
* the record is dropped as it runs.
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { type ReactiveEffectRunner } from '@vue/reactivity';
|
|
2
2
|
/** Stops an effect and remembers that it is stopped. Use instead of `stop`. */
|
|
3
3
|
export declare const stopEffect: (runner: ReactiveEffectRunner) => void;
|
|
4
|
+
export type Job = Function & {
|
|
5
|
+
i?: number;
|
|
6
|
+
};
|
|
4
7
|
export declare const nextTick: (fn: () => void) => Promise<void>;
|
|
5
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Stamps a job with its creation order, which the flush runs in. An effect
|
|
10
|
+
* stamped as it is created sorts before the children its first run creates.
|
|
11
|
+
*/
|
|
12
|
+
export declare const stampJob: <T extends Job>(job: T) => T;
|
|
13
|
+
export declare const queueJob: (job: Job) => void;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { type ReactiveEffectRunner } from '@vue/reactivity';
|
|
2
2
|
/** Stops an effect and remembers that it is stopped. Use instead of `stop`. */
|
|
3
3
|
export declare const stopEffect: (runner: ReactiveEffectRunner) => void;
|
|
4
|
+
export type Job = Function & {
|
|
5
|
+
i?: number;
|
|
6
|
+
};
|
|
4
7
|
export declare const nextTick: (fn: () => void) => Promise<void>;
|
|
5
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Stamps a job with its creation order, which the flush runs in. An effect
|
|
10
|
+
* stamped as it is created sorts before the children its first run creates.
|
|
11
|
+
*/
|
|
12
|
+
export declare const stampJob: <T extends Job>(job: T) => T;
|
|
13
|
+
export declare const queueJob: (job: Job) => void;
|
package/dist/types/walk.d.mts
CHANGED
package/dist/types/walk.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aevantec/litevue",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.17",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"description": "A maintained petite-vue fork: Vue's template syntax and reactivity in ~
|
|
7
|
+
"description": "A maintained petite-vue fork: Vue's template syntax and reactivity in ~11kb, with built-in devtools. No build step.",
|
|
8
8
|
"type": "commonjs",
|
|
9
9
|
"//sideEffects": "The core auto-mounts when its script tag has `init`, and the devtools panel self-initializes on import — both are real import side effects and must not be tree-shaken. The plugins bundle is pure, so bundlers may drop unused plugins.",
|
|
10
10
|
"sideEffects": [
|