@aevantec/litevue 0.5.4 → 0.5.6
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 +3 -2
- package/dist/litevue-devtools.iife.js +1 -1
- package/dist/litevue-devtools.mjs +1 -853
- package/dist/litevue-devtools.umd.js +1 -1
- package/dist/litevue-plugins.iife.js +1 -1
- package/dist/litevue-plugins.mjs +1 -717
- package/dist/litevue-plugins.umd.js +1 -1
- package/dist/litevue.iife.js +1 -12
- package/dist/litevue.mjs +1 -1890
- package/dist/litevue.umd.js +1 -12
- package/dist/plugins/collapse.iife.js +1 -1
- package/dist/plugins/collapse.mjs +1 -46
- package/dist/plugins/collapse.umd.js +1 -1
- package/dist/plugins/focus.iife.js +1 -1
- package/dist/plugins/focus.mjs +1 -69
- package/dist/plugins/focus.umd.js +1 -1
- package/dist/plugins/intersect.iife.js +1 -1
- package/dist/plugins/intersect.mjs +1 -20
- package/dist/plugins/intersect.umd.js +1 -1
- package/dist/plugins/mask.iife.js +1 -1
- package/dist/plugins/mask.mjs +1 -37
- package/dist/plugins/mask.umd.js +1 -1
- package/dist/plugins/media.iife.js +1 -1
- package/dist/plugins/media.mjs +1 -204
- package/dist/plugins/media.umd.js +1 -1
- package/dist/plugins/morph.iife.js +1 -1
- package/dist/plugins/morph.mjs +1 -174
- package/dist/plugins/morph.umd.js +1 -1
- package/dist/plugins/persist.iife.js +1 -1
- package/dist/plugins/persist.mjs +1 -86
- package/dist/plugins/persist.umd.js +1 -1
- package/dist/plugins/resize.iife.js +1 -1
- package/dist/plugins/resize.mjs +1 -15
- package/dist/plugins/resize.umd.js +1 -1
- package/dist/plugins/transition.iife.js +1 -1
- package/dist/plugins/transition.mjs +1 -76
- package/dist/plugins/transition.umd.js +1 -1
- package/dist/types/app.d.mts +20 -2
- package/dist/types/app.d.ts +20 -2
- package/dist/types/block.d.mts +6 -0
- package/dist/types/block.d.ts +6 -0
- package/dist/types/context.d.mts +8 -4
- package/dist/types/context.d.ts +8 -4
- package/dist/types/devtools.d.mts +7 -0
- package/dist/types/devtools.d.ts +7 -0
- package/dist/types/effect.d.mts +6 -10
- package/dist/types/effect.d.ts +6 -10
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/magics.d.mts +5 -6
- package/dist/types/magics.d.ts +5 -6
- package/dist/types/ownership.d.mts +23 -0
- package/dist/types/ownership.d.ts +23 -0
- package/dist/types/plugins/focus/index.d.mts +6 -8
- package/dist/types/plugins/focus/index.d.ts +6 -8
- package/dist/types/plugins/media/index.d.mts +6 -11
- package/dist/types/plugins/media/index.d.ts +6 -11
- package/dist/types/plugins/morph/index.d.mts +21 -10
- package/dist/types/plugins/morph/index.d.ts +21 -10
- package/dist/types/plugins/persist/index.d.mts +12 -19
- package/dist/types/plugins/persist/index.d.ts +12 -19
- package/dist/types/plugins/resize/index.d.mts +5 -7
- package/dist/types/plugins/resize/index.d.ts +5 -7
- package/dist/types/plugins/transition/index.d.mts +7 -12
- package/dist/types/plugins/transition/index.d.ts +7 -12
- package/dist/types/scheduler.d.mts +3 -0
- package/dist/types/scheduler.d.ts +3 -0
- package/dist/types/store.d.mts +3 -6
- package/dist/types/store.d.ts +3 -6
- package/dist/types/utils.d.mts +3 -3
- package/dist/types/utils.d.ts +3 -3
- package/dist/types/warn.d.mts +14 -0
- package/dist/types/warn.d.ts +14 -0
- package/package.json +16 -8
|
@@ -21,6 +21,12 @@ export interface LiteVueDevtools {
|
|
|
21
21
|
* reactive — writing to one updates every app using it.
|
|
22
22
|
*/
|
|
23
23
|
stores: Map<string, Record<string, any>>;
|
|
24
|
+
/**
|
|
25
|
+
* Names registered with app.component(). Inspection UIs use this to label a
|
|
26
|
+
* scope by the component that produced it — `v-scope="Cart()"` reads as
|
|
27
|
+
* `<Cart>` rather than by tag or id.
|
|
28
|
+
*/
|
|
29
|
+
components: Set<string>;
|
|
24
30
|
/**
|
|
25
31
|
* Find the scope governing a node by walking up the DOM to the nearest
|
|
26
32
|
* registered scope root. Usable from the console: __LITE_VUE__.getScope($0)
|
|
@@ -44,6 +50,7 @@ export interface LiteVueDevtools {
|
|
|
44
50
|
}
|
|
45
51
|
export declare const registerScope: (el: Element, scope: Record<string, any>, exp?: string, name?: string) => (() => void);
|
|
46
52
|
export declare const registerStore: (name: string, store: Record<string, any>) => void;
|
|
53
|
+
export declare const registerComponent: (name: string) => void;
|
|
47
54
|
export declare const emitFlush: () => void;
|
|
48
55
|
export declare const devtools: LiteVueDevtools;
|
|
49
56
|
/**
|
package/dist/types/devtools.d.ts
CHANGED
|
@@ -21,6 +21,12 @@ export interface LiteVueDevtools {
|
|
|
21
21
|
* reactive — writing to one updates every app using it.
|
|
22
22
|
*/
|
|
23
23
|
stores: Map<string, Record<string, any>>;
|
|
24
|
+
/**
|
|
25
|
+
* Names registered with app.component(). Inspection UIs use this to label a
|
|
26
|
+
* scope by the component that produced it — `v-scope="Cart()"` reads as
|
|
27
|
+
* `<Cart>` rather than by tag or id.
|
|
28
|
+
*/
|
|
29
|
+
components: Set<string>;
|
|
24
30
|
/**
|
|
25
31
|
* Find the scope governing a node by walking up the DOM to the nearest
|
|
26
32
|
* registered scope root. Usable from the console: __LITE_VUE__.getScope($0)
|
|
@@ -44,6 +50,7 @@ export interface LiteVueDevtools {
|
|
|
44
50
|
}
|
|
45
51
|
export declare const registerScope: (el: Element, scope: Record<string, any>, exp?: string, name?: string) => (() => void);
|
|
46
52
|
export declare const registerStore: (name: string, store: Record<string, any>) => void;
|
|
53
|
+
export declare const registerComponent: (name: string) => void;
|
|
47
54
|
export declare const emitFlush: () => void;
|
|
48
55
|
export declare const devtools: LiteVueDevtools;
|
|
49
56
|
/**
|
package/dist/types/effect.d.mts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* tied to an element: syncing state to storage or the URL, updating
|
|
5
|
-
* document.title, driving a non-LiteVue widget.
|
|
2
|
+
* Runs `fn` now, then again when the reactive state it read changes. The
|
|
3
|
+
* JS-side counterpart to `v-effect`, for work not tied to an element.
|
|
6
4
|
*
|
|
7
|
-
* Re-runs
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* mutation.
|
|
5
|
+
* Re-runs are scheduled, so a burst of mutations in one tick triggers one run
|
|
6
|
+
* with the DOM already updated — unlike raw `effect`, which fires
|
|
7
|
+
* synchronously per mutation.
|
|
11
8
|
*
|
|
12
|
-
* Returns a function
|
|
13
|
-
* hold onto it for anything shorter-lived than the page.
|
|
9
|
+
* Returns a stop function. Nothing stops it automatically.
|
|
14
10
|
*/
|
|
15
11
|
export declare const watchEffect: (fn: () => void) => (() => void);
|
package/dist/types/effect.d.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* tied to an element: syncing state to storage or the URL, updating
|
|
5
|
-
* document.title, driving a non-LiteVue widget.
|
|
2
|
+
* Runs `fn` now, then again when the reactive state it read changes. The
|
|
3
|
+
* JS-side counterpart to `v-effect`, for work not tied to an element.
|
|
6
4
|
*
|
|
7
|
-
* Re-runs
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* mutation.
|
|
5
|
+
* Re-runs are scheduled, so a burst of mutations in one tick triggers one run
|
|
6
|
+
* with the DOM already updated — unlike raw `effect`, which fires
|
|
7
|
+
* synchronously per mutation.
|
|
11
8
|
*
|
|
12
|
-
* Returns a function
|
|
13
|
-
* hold onto it for anything shorter-lived than the page.
|
|
9
|
+
* Returns a stop function. Nothing stops it automatically.
|
|
14
10
|
*/
|
|
15
11
|
export declare const watchEffect: (fn: () => void) => (() => void);
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createApp } from './app.mjs';
|
|
2
|
-
export type { App, Plugin } from './app.mjs';
|
|
2
|
+
export type { App, ComponentFactory, Plugin } from './app.mjs';
|
|
3
3
|
export { store } from './store.mjs';
|
|
4
4
|
export { nextTick } from './scheduler.mjs';
|
|
5
5
|
export { watchEffect } from './effect.mjs';
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/magics.d.mts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { Context } from './context.mjs';
|
|
2
2
|
/**
|
|
3
|
-
* $id('name') — unique ids for accessibility attributes. Stable within a
|
|
4
|
-
*
|
|
5
|
-
* label/input pairs match), unique across scopes.
|
|
3
|
+
* $id('name') — unique ids for accessibility attributes. Stable within a scope
|
|
4
|
+
* so label/input pairs match, unique across scopes.
|
|
6
5
|
*/
|
|
7
6
|
export declare const createId: () => (name?: string) => string;
|
|
8
7
|
/**
|
|
9
|
-
* $watch(source, callback) — watches a dot-path string or getter
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* $watch(source, callback) — watches a dot-path string or getter and calls
|
|
9
|
+
* back with (value, oldValue). Tied to the owning scope's effects, so it stops
|
|
10
|
+
* when the scope unmounts.
|
|
12
11
|
*/
|
|
13
12
|
export declare const createWatch: (ctx: Context) => (source: string | (() => any), cb: (value: any, oldValue: any) => void) => void;
|
package/dist/types/magics.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { Context } from './context';
|
|
2
2
|
/**
|
|
3
|
-
* $id('name') — unique ids for accessibility attributes. Stable within a
|
|
4
|
-
*
|
|
5
|
-
* label/input pairs match), unique across scopes.
|
|
3
|
+
* $id('name') — unique ids for accessibility attributes. Stable within a scope
|
|
4
|
+
* so label/input pairs match, unique across scopes.
|
|
6
5
|
*/
|
|
7
6
|
export declare const createId: () => (name?: string) => string;
|
|
8
7
|
/**
|
|
9
|
-
* $watch(source, callback) — watches a dot-path string or getter
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* $watch(source, callback) — watches a dot-path string or getter and calls
|
|
9
|
+
* back with (value, oldValue). Tied to the owning scope's effects, so it stops
|
|
10
|
+
* when the scope unmounts.
|
|
12
11
|
*/
|
|
13
12
|
export declare const createWatch: (ctx: Context) => (source: string | (() => any), cb: (value: any, oldValue: any) => void) => void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-node disposal.
|
|
3
|
+
*
|
|
4
|
+
* A Context spans one `v-scope` to the next — the right boundary for
|
|
5
|
+
* `app.unmount(el)`, too coarse for a node removed on its own. Morph detaches
|
|
6
|
+
* nodes directly, leaving their effects live. Tracking what each node acquired
|
|
7
|
+
* lets a detached subtree be disposed without a Context per node.
|
|
8
|
+
*/
|
|
9
|
+
type Disposer = () => void;
|
|
10
|
+
export declare const setOwner: (node: Node | undefined) => Node | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Registers a disposer against `node`, defaulting to the node being walked.
|
|
13
|
+
* Pass `node` explicitly for a directive that outlives its element: `v-if` and
|
|
14
|
+
* `v-for` detach the template and render from an anchor, so they must own to
|
|
15
|
+
* the anchor.
|
|
16
|
+
*/
|
|
17
|
+
export declare const own: (dispose: Disposer, node?: Node | undefined) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Disposes `node` and its subtree. Safe on an unowned node, and idempotent —
|
|
20
|
+
* the record is dropped as it runs.
|
|
21
|
+
*/
|
|
22
|
+
export declare const disposeSubtree: (node: Node) => void;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-node disposal.
|
|
3
|
+
*
|
|
4
|
+
* A Context spans one `v-scope` to the next — the right boundary for
|
|
5
|
+
* `app.unmount(el)`, too coarse for a node removed on its own. Morph detaches
|
|
6
|
+
* nodes directly, leaving their effects live. Tracking what each node acquired
|
|
7
|
+
* lets a detached subtree be disposed without a Context per node.
|
|
8
|
+
*/
|
|
9
|
+
type Disposer = () => void;
|
|
10
|
+
export declare const setOwner: (node: Node | undefined) => Node | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Registers a disposer against `node`, defaulting to the node being walked.
|
|
13
|
+
* Pass `node` explicitly for a directive that outlives its element: `v-if` and
|
|
14
|
+
* `v-for` detach the template and render from an anchor, so they must own to
|
|
15
|
+
* the anchor.
|
|
16
|
+
*/
|
|
17
|
+
export declare const own: (dispose: Disposer, node?: Node | undefined) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Disposes `node` and its subtree. Safe on an unowned node, and idempotent —
|
|
20
|
+
* the record is dropped as it runs.
|
|
21
|
+
*/
|
|
22
|
+
export declare const disposeSubtree: (node: Node) => void;
|
|
23
|
+
export {};
|
|
@@ -2,14 +2,12 @@ import type { Plugin } from '../../app.mjs';
|
|
|
2
2
|
/**
|
|
3
3
|
* Focus utilities.
|
|
4
4
|
*
|
|
5
|
-
* v-focus="expression" — focuses the element
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - .select also select the element's text (inputs/textareas)
|
|
5
|
+
* v-focus="expression" — focuses the element while the expression is truthy,
|
|
6
|
+
* on mount included, making it an autofocus.
|
|
7
|
+
* - .select also select the text (inputs/textareas)
|
|
9
8
|
*
|
|
10
|
-
* v-trap="expression" —
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* the previously focused element on release or unmount.
|
|
9
|
+
* v-trap="expression" — cycles Tab / Shift+Tab within the element while truthy,
|
|
10
|
+
* for accessible modals. Focus enters the first focusable child and returns to
|
|
11
|
+
* the previous element on release or unmount.
|
|
14
12
|
*/
|
|
15
13
|
export declare const focus: Plugin;
|
|
@@ -2,14 +2,12 @@ import type { Plugin } from '../../app';
|
|
|
2
2
|
/**
|
|
3
3
|
* Focus utilities.
|
|
4
4
|
*
|
|
5
|
-
* v-focus="expression" — focuses the element
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - .select also select the element's text (inputs/textareas)
|
|
5
|
+
* v-focus="expression" — focuses the element while the expression is truthy,
|
|
6
|
+
* on mount included, making it an autofocus.
|
|
7
|
+
* - .select also select the text (inputs/textareas)
|
|
9
8
|
*
|
|
10
|
-
* v-trap="expression" —
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* the previously focused element on release or unmount.
|
|
9
|
+
* v-trap="expression" — cycles Tab / Shift+Tab within the element while truthy,
|
|
10
|
+
* for accessible modals. Focus enters the first focusable child and returns to
|
|
11
|
+
* the previous element on release or unmount.
|
|
14
12
|
*/
|
|
15
13
|
export declare const focus: Plugin;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { Plugin } from '../../app.mjs';
|
|
2
2
|
/**
|
|
3
|
-
* Viewport-driven behaviour
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* first paint; this runs after it.
|
|
3
|
+
* Viewport-driven behaviour for the cases CSS cannot serve: values handed to
|
|
4
|
+
* JavaScript, structural branches, skipping expensive init on small screens.
|
|
5
|
+
* Appearance still belongs in a stylesheet, which applies before first paint.
|
|
7
6
|
*/
|
|
8
7
|
export type Breakpoints = Record<string, number>;
|
|
9
8
|
export interface MediaOptions {
|
|
@@ -14,9 +13,9 @@ export interface MediaOptions {
|
|
|
14
13
|
export type ResponsiveMap<T = any> = Record<string | number, T>;
|
|
15
14
|
export type Device = 'mobile' | 'tablet' | 'desktop';
|
|
16
15
|
/**
|
|
17
|
-
* The scale in use until
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* The scale in use until `configure()` runs. Exported because `configure()`
|
|
17
|
+
* replaces rather than merges, so adjusting one breakpoint means spreading
|
|
18
|
+
* this rather than retyping all five.
|
|
20
19
|
*/
|
|
21
20
|
export declare const defaultBreakpoints: Readonly<Breakpoints>;
|
|
22
21
|
export interface Mq {
|
|
@@ -38,9 +37,5 @@ export interface Mq {
|
|
|
38
37
|
configure(options: MediaOptions): void;
|
|
39
38
|
}
|
|
40
39
|
export declare const mq: Mq;
|
|
41
|
-
/**
|
|
42
|
-
* Test seam. Drops every subscription and returns to the default scale, so a
|
|
43
|
-
* suite can swap its matchMedia stub between cases.
|
|
44
|
-
*/
|
|
45
40
|
export declare const resetMedia: () => void;
|
|
46
41
|
export declare const media: Plugin<MediaOptions>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { Plugin } from '../../app';
|
|
2
2
|
/**
|
|
3
|
-
* Viewport-driven behaviour
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* first paint; this runs after it.
|
|
3
|
+
* Viewport-driven behaviour for the cases CSS cannot serve: values handed to
|
|
4
|
+
* JavaScript, structural branches, skipping expensive init on small screens.
|
|
5
|
+
* Appearance still belongs in a stylesheet, which applies before first paint.
|
|
7
6
|
*/
|
|
8
7
|
export type Breakpoints = Record<string, number>;
|
|
9
8
|
export interface MediaOptions {
|
|
@@ -14,9 +13,9 @@ export interface MediaOptions {
|
|
|
14
13
|
export type ResponsiveMap<T = any> = Record<string | number, T>;
|
|
15
14
|
export type Device = 'mobile' | 'tablet' | 'desktop';
|
|
16
15
|
/**
|
|
17
|
-
* The scale in use until
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* The scale in use until `configure()` runs. Exported because `configure()`
|
|
17
|
+
* replaces rather than merges, so adjusting one breakpoint means spreading
|
|
18
|
+
* this rather than retyping all five.
|
|
20
19
|
*/
|
|
21
20
|
export declare const defaultBreakpoints: Readonly<Breakpoints>;
|
|
22
21
|
export interface Mq {
|
|
@@ -38,9 +37,5 @@ export interface Mq {
|
|
|
38
37
|
configure(options: MediaOptions): void;
|
|
39
38
|
}
|
|
40
39
|
export declare const mq: Mq;
|
|
41
|
-
/**
|
|
42
|
-
* Test seam. Drops every subscription and returns to the default scale, so a
|
|
43
|
-
* suite can swap its matchMedia stub between cases.
|
|
44
|
-
*/
|
|
45
40
|
export declare const resetMedia: () => void;
|
|
46
41
|
export declare const media: Plugin<MediaOptions>;
|
|
@@ -2,15 +2,10 @@ import type { Plugin } from '../../app.mjs';
|
|
|
2
2
|
/**
|
|
3
3
|
* Update a live region in place from new HTML, instead of replacing it.
|
|
4
4
|
*
|
|
5
|
-
* Replacing markup
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* teardown, so the discarded subtree's effects stay subscribed and keep writing
|
|
10
|
-
* to detached nodes.
|
|
11
|
-
*
|
|
12
|
-
* Morphing patches the differences onto the existing tree, so unchanged
|
|
13
|
-
* elements are never touched and none of that is lost.
|
|
5
|
+
* Replacing markup destroys every element in the region — and with it every
|
|
6
|
+
* scope, its state, and the browser state riding on those nodes: focus, caret,
|
|
7
|
+
* selection, scroll, media playback, `<details open>`. Morphing patches only
|
|
8
|
+
* the differences, so unchanged elements are never touched.
|
|
14
9
|
*/
|
|
15
10
|
export interface MorphOptions {
|
|
16
11
|
/**
|
|
@@ -21,6 +16,22 @@ export interface MorphOptions {
|
|
|
21
16
|
key?: (el: Element) => string | null | undefined;
|
|
22
17
|
/** Return true to leave a subtree completely untouched. */
|
|
23
18
|
skip?: (from: Element, to: Element) => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Return true to keep an element the incoming HTML no longer contains.
|
|
21
|
+
* `skip` cannot express this — it is only consulted for a matched pair, so
|
|
22
|
+
* it never sees one the server stopped sending, which is exactly the case a
|
|
23
|
+
* client-only widget hits. `data-morph-preserve` does the same declaratively.
|
|
24
|
+
*/
|
|
25
|
+
preserve?: (el: Element) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Called before a node is inserted. Return `false` to leave it out.
|
|
28
|
+
*/
|
|
29
|
+
beforeNodeAdded?: (node: Node) => boolean | void;
|
|
30
|
+
/**
|
|
31
|
+
* Called after a node has been removed, once its effects and listeners are
|
|
32
|
+
* released — so what arrives here is inert, not a live subtree.
|
|
33
|
+
*/
|
|
34
|
+
afterNodeRemoved?: (node: Node) => void;
|
|
24
35
|
}
|
|
25
36
|
/**
|
|
26
37
|
* morph(from, to) — patch `from` in place so it matches `to`, which may be an
|
|
@@ -28,7 +39,7 @@ export interface MorphOptions {
|
|
|
28
39
|
*/
|
|
29
40
|
export declare const morph: (from: Element, to: Element | string, opts?: MorphOptions) => Element;
|
|
30
41
|
/**
|
|
31
|
-
* Registers `$morph
|
|
42
|
+
* Registers `$morph`, so a template can update a region from a fetch response
|
|
32
43
|
* without dropping into JavaScript.
|
|
33
44
|
*/
|
|
34
45
|
export declare const morphPlugin: Plugin;
|
|
@@ -2,15 +2,10 @@ import type { Plugin } from '../../app';
|
|
|
2
2
|
/**
|
|
3
3
|
* Update a live region in place from new HTML, instead of replacing it.
|
|
4
4
|
*
|
|
5
|
-
* Replacing markup
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* teardown, so the discarded subtree's effects stay subscribed and keep writing
|
|
10
|
-
* to detached nodes.
|
|
11
|
-
*
|
|
12
|
-
* Morphing patches the differences onto the existing tree, so unchanged
|
|
13
|
-
* elements are never touched and none of that is lost.
|
|
5
|
+
* Replacing markup destroys every element in the region — and with it every
|
|
6
|
+
* scope, its state, and the browser state riding on those nodes: focus, caret,
|
|
7
|
+
* selection, scroll, media playback, `<details open>`. Morphing patches only
|
|
8
|
+
* the differences, so unchanged elements are never touched.
|
|
14
9
|
*/
|
|
15
10
|
export interface MorphOptions {
|
|
16
11
|
/**
|
|
@@ -21,6 +16,22 @@ export interface MorphOptions {
|
|
|
21
16
|
key?: (el: Element) => string | null | undefined;
|
|
22
17
|
/** Return true to leave a subtree completely untouched. */
|
|
23
18
|
skip?: (from: Element, to: Element) => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Return true to keep an element the incoming HTML no longer contains.
|
|
21
|
+
* `skip` cannot express this — it is only consulted for a matched pair, so
|
|
22
|
+
* it never sees one the server stopped sending, which is exactly the case a
|
|
23
|
+
* client-only widget hits. `data-morph-preserve` does the same declaratively.
|
|
24
|
+
*/
|
|
25
|
+
preserve?: (el: Element) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Called before a node is inserted. Return `false` to leave it out.
|
|
28
|
+
*/
|
|
29
|
+
beforeNodeAdded?: (node: Node) => boolean | void;
|
|
30
|
+
/**
|
|
31
|
+
* Called after a node has been removed, once its effects and listeners are
|
|
32
|
+
* released — so what arrives here is inert, not a live subtree.
|
|
33
|
+
*/
|
|
34
|
+
afterNodeRemoved?: (node: Node) => void;
|
|
24
35
|
}
|
|
25
36
|
/**
|
|
26
37
|
* morph(from, to) — patch `from` in place so it matches `to`, which may be an
|
|
@@ -28,7 +39,7 @@ export interface MorphOptions {
|
|
|
28
39
|
*/
|
|
29
40
|
export declare const morph: (from: Element, to: Element | string, opts?: MorphOptions) => Element;
|
|
30
41
|
/**
|
|
31
|
-
* Registers `$morph
|
|
42
|
+
* Registers `$morph`, so a template can update a region from a fetch response
|
|
32
43
|
* without dropping into JavaScript.
|
|
33
44
|
*/
|
|
34
45
|
export declare const morphPlugin: Plugin;
|
|
@@ -5,15 +5,12 @@ export interface PersistStorage {
|
|
|
5
5
|
setItem(key: string, value: string): void;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
* Register a custom storage under a name,
|
|
9
|
-
*
|
|
8
|
+
* Register a custom storage under a name, selectable anywhere — including as a
|
|
9
|
+
* directive modifier. Any object with getItem/setItem works.
|
|
10
10
|
*
|
|
11
11
|
* registerStorage('memory', myMemoryStorage);
|
|
12
12
|
* persistStore('scratch', { storage: 'memory' });
|
|
13
13
|
* <div v-persist.memory="scratch">…</div>
|
|
14
|
-
*
|
|
15
|
-
* Any object with getItem/setItem works — sessionStorage, an IndexedDB
|
|
16
|
-
* shim, an in-memory map, a server-backed store.
|
|
17
14
|
*/
|
|
18
15
|
export declare const registerStorage: (name: string, storage: PersistStorage) => void;
|
|
19
16
|
/**
|
|
@@ -24,27 +21,23 @@ export declare const registerStorage: (name: string, storage: PersistStorage) =>
|
|
|
24
21
|
*/
|
|
25
22
|
export declare const setDefaultStorage: (storage: PersistStorage | string) => void;
|
|
26
23
|
/**
|
|
27
|
-
* v-persist="storage-key" — syncs the element's scope to storage
|
|
28
|
-
*
|
|
29
|
-
* and arrays) is written back automatically.
|
|
24
|
+
* v-persist="storage-key" — syncs the element's scope to storage: restored on
|
|
25
|
+
* mount, written back on every change, nested values included.
|
|
30
26
|
*
|
|
31
|
-
* The attribute value is
|
|
32
|
-
*
|
|
27
|
+
* The attribute value is the storage key verbatim, not an expression, and
|
|
28
|
+
* falls back to the element id. An argument narrows which properties are
|
|
29
|
+
* stored; a modifier picks the storage (`local` default, `session`, or any
|
|
30
|
+
* name given to registerStorage()).
|
|
33
31
|
*
|
|
34
|
-
* An argument narrows what is stored to specific properties:
|
|
35
32
|
* v-persist:draft="composer" — only `draft`
|
|
36
33
|
* v-persist:draft,recipient="composer" — only those two
|
|
37
|
-
*
|
|
38
|
-
* A modifier picks the storage — `local` (default), `session`, or any name
|
|
39
|
-
* passed to registerStorage():
|
|
40
|
-
* v-persist.session="wizard"
|
|
41
|
-
* v-persist:draft.session="composer"
|
|
34
|
+
* v-persist:draft.session="composer" — and into sessionStorage
|
|
42
35
|
*/
|
|
43
36
|
export declare const persist: Plugin;
|
|
44
37
|
/**
|
|
45
|
-
* persistStore('cart') — the JS-side counterpart for global stores, which
|
|
46
|
-
*
|
|
47
|
-
*
|
|
38
|
+
* persistStore('cart') — the JS-side counterpart for global stores, which have
|
|
39
|
+
* no element to hang a directive on. Restores immediately, saves on change,
|
|
40
|
+
* and returns a stop function.
|
|
48
41
|
*
|
|
49
42
|
* persistStore('cart') // the whole store
|
|
50
43
|
* persistStore('cart', { keys: ['items'] }) // only these properties
|
|
@@ -5,15 +5,12 @@ export interface PersistStorage {
|
|
|
5
5
|
setItem(key: string, value: string): void;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
* Register a custom storage under a name,
|
|
9
|
-
*
|
|
8
|
+
* Register a custom storage under a name, selectable anywhere — including as a
|
|
9
|
+
* directive modifier. Any object with getItem/setItem works.
|
|
10
10
|
*
|
|
11
11
|
* registerStorage('memory', myMemoryStorage);
|
|
12
12
|
* persistStore('scratch', { storage: 'memory' });
|
|
13
13
|
* <div v-persist.memory="scratch">…</div>
|
|
14
|
-
*
|
|
15
|
-
* Any object with getItem/setItem works — sessionStorage, an IndexedDB
|
|
16
|
-
* shim, an in-memory map, a server-backed store.
|
|
17
14
|
*/
|
|
18
15
|
export declare const registerStorage: (name: string, storage: PersistStorage) => void;
|
|
19
16
|
/**
|
|
@@ -24,27 +21,23 @@ export declare const registerStorage: (name: string, storage: PersistStorage) =>
|
|
|
24
21
|
*/
|
|
25
22
|
export declare const setDefaultStorage: (storage: PersistStorage | string) => void;
|
|
26
23
|
/**
|
|
27
|
-
* v-persist="storage-key" — syncs the element's scope to storage
|
|
28
|
-
*
|
|
29
|
-
* and arrays) is written back automatically.
|
|
24
|
+
* v-persist="storage-key" — syncs the element's scope to storage: restored on
|
|
25
|
+
* mount, written back on every change, nested values included.
|
|
30
26
|
*
|
|
31
|
-
* The attribute value is
|
|
32
|
-
*
|
|
27
|
+
* The attribute value is the storage key verbatim, not an expression, and
|
|
28
|
+
* falls back to the element id. An argument narrows which properties are
|
|
29
|
+
* stored; a modifier picks the storage (`local` default, `session`, or any
|
|
30
|
+
* name given to registerStorage()).
|
|
33
31
|
*
|
|
34
|
-
* An argument narrows what is stored to specific properties:
|
|
35
32
|
* v-persist:draft="composer" — only `draft`
|
|
36
33
|
* v-persist:draft,recipient="composer" — only those two
|
|
37
|
-
*
|
|
38
|
-
* A modifier picks the storage — `local` (default), `session`, or any name
|
|
39
|
-
* passed to registerStorage():
|
|
40
|
-
* v-persist.session="wizard"
|
|
41
|
-
* v-persist:draft.session="composer"
|
|
34
|
+
* v-persist:draft.session="composer" — and into sessionStorage
|
|
42
35
|
*/
|
|
43
36
|
export declare const persist: Plugin;
|
|
44
37
|
/**
|
|
45
|
-
* persistStore('cart') — the JS-side counterpart for global stores, which
|
|
46
|
-
*
|
|
47
|
-
*
|
|
38
|
+
* persistStore('cart') — the JS-side counterpart for global stores, which have
|
|
39
|
+
* no element to hang a directive on. Restores immediately, saves on change,
|
|
40
|
+
* and returns a stop function.
|
|
48
41
|
*
|
|
49
42
|
* persistStore('cart') // the whole store
|
|
50
43
|
* persistStore('cart', { keys: ['items'] }) // only these properties
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { Plugin } from '../../app.mjs';
|
|
2
2
|
/**
|
|
3
|
-
* `v-resize="expr"` — element size, which no media query
|
|
4
|
-
*
|
|
5
|
-
* `$
|
|
3
|
+
* `v-resize="expr"` — element size, which no media query reports and container
|
|
4
|
+
* queries cannot hand to JavaScript. The expression runs with `$width` and
|
|
5
|
+
* `$height` in scope.
|
|
6
6
|
*
|
|
7
|
-
* Separate from the media plugin
|
|
8
|
-
*
|
|
9
|
-
* element it sits on. They share no code, and the shape here — one directive
|
|
10
|
-
* wrapping one observer — is the same as `intersect`.
|
|
7
|
+
* Separate from the media plugin: that is viewport state, readable with no
|
|
8
|
+
* element involved, while this is bound to the element it sits on.
|
|
11
9
|
*/
|
|
12
10
|
export declare const resize: Plugin;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { Plugin } from '../../app';
|
|
2
2
|
/**
|
|
3
|
-
* `v-resize="expr"` — element size, which no media query
|
|
4
|
-
*
|
|
5
|
-
* `$
|
|
3
|
+
* `v-resize="expr"` — element size, which no media query reports and container
|
|
4
|
+
* queries cannot hand to JavaScript. The expression runs with `$width` and
|
|
5
|
+
* `$height` in scope.
|
|
6
6
|
*
|
|
7
|
-
* Separate from the media plugin
|
|
8
|
-
*
|
|
9
|
-
* element it sits on. They share no code, and the shape here — one directive
|
|
10
|
-
* wrapping one observer — is the same as `intersect`.
|
|
7
|
+
* Separate from the media plugin: that is viewport state, readable with no
|
|
8
|
+
* element involved, while this is bound to the element it sits on.
|
|
11
9
|
*/
|
|
12
10
|
export declare const resize: Plugin;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import type { Plugin } from '../../app.mjs';
|
|
2
2
|
/**
|
|
3
|
-
* v-transition:name="expression" — an animated v-show
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
3
|
+
* v-transition:name="expression" — an animated v-show, using Vue-style
|
|
4
|
+
* classes: name-enter-from/-active/-to on show, name-leave-* before hiding.
|
|
5
|
+
* The element hides only once the leave transition finishes, its duration read
|
|
6
|
+
* from computed styles. The name defaults to "v", and the initial state does
|
|
7
|
+
* not animate unless `.appear` is present.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* With no expression (`v-transition:fade` on a v-if/v-for element) it
|
|
13
|
-
* switches to unmount mode: the enter transition runs when the element is
|
|
14
|
-
* inserted, and a leave hook is registered so the core delays removal until
|
|
15
|
-
* the leave transition finishes.
|
|
9
|
+
* With no expression, on a v-if/v-for element, it switches to unmount mode:
|
|
10
|
+
* enter runs on insertion, and a leave hook makes the core delay removal.
|
|
16
11
|
*/
|
|
17
12
|
export declare const transition: Plugin;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import type { Plugin } from '../../app';
|
|
2
2
|
/**
|
|
3
|
-
* v-transition:name="expression" — an animated v-show
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
3
|
+
* v-transition:name="expression" — an animated v-show, using Vue-style
|
|
4
|
+
* classes: name-enter-from/-active/-to on show, name-leave-* before hiding.
|
|
5
|
+
* The element hides only once the leave transition finishes, its duration read
|
|
6
|
+
* from computed styles. The name defaults to "v", and the initial state does
|
|
7
|
+
* not animate unless `.appear` is present.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* With no expression (`v-transition:fade` on a v-if/v-for element) it
|
|
13
|
-
* switches to unmount mode: the enter transition runs when the element is
|
|
14
|
-
* inserted, and a leave hook is registered so the core delays removal until
|
|
15
|
-
* the leave transition finishes.
|
|
9
|
+
* With no expression, on a v-if/v-for element, it switches to unmount mode:
|
|
10
|
+
* enter runs on insertion, and a leave hook makes the core delay removal.
|
|
16
11
|
*/
|
|
17
12
|
export declare const transition: Plugin;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
import { type ReactiveEffectRunner } from '@vue/reactivity';
|
|
2
|
+
/** Stops an effect and remembers that it is stopped. Use instead of `stop`. */
|
|
3
|
+
export declare const stopEffect: (runner: ReactiveEffectRunner) => void;
|
|
1
4
|
export declare const nextTick: (fn: () => void) => Promise<void>;
|
|
2
5
|
export declare const queueJob: (job: Function) => void;
|