@aevantec/litevue 0.5.5 → 0.5.7
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 +10 -7
- package/dist/litevue-devtools.iife.js +1 -1
- package/dist/litevue-devtools.mjs +1 -1
- package/dist/litevue-devtools.umd.js +1 -1
- package/dist/litevue-plugins.dev.iife.js +898 -0
- package/dist/litevue-plugins.dev.mjs +880 -0
- package/dist/litevue-plugins.iife.js +1 -1
- package/dist/litevue-plugins.mjs +1 -1
- package/dist/litevue-plugins.umd.js +1 -1
- package/dist/litevue.dev.iife.js +2103 -0
- package/dist/litevue.dev.mjs +2092 -0
- package/dist/litevue.iife.js +1 -1
- package/dist/litevue.mjs +1 -1
- package/dist/litevue.umd.js +1 -1
- package/dist/plugins/collapse.iife.js +1 -1
- package/dist/plugins/collapse.mjs +1 -1
- package/dist/plugins/collapse.umd.js +1 -1
- package/dist/plugins/media.dev.iife.js +249 -0
- package/dist/plugins/media.dev.mjs +243 -0
- package/dist/plugins/morph.dev.iife.js +217 -0
- package/dist/plugins/morph.dev.mjs +212 -0
- package/dist/plugins/morph.iife.js +1 -1
- package/dist/plugins/morph.mjs +1 -1
- package/dist/plugins/morph.umd.js +1 -1
- package/dist/plugins/persist.dev.iife.js +126 -0
- package/dist/plugins/persist.dev.mjs +120 -0
- package/dist/types/app.d.mts +15 -18
- package/dist/types/app.d.ts +15 -18
- package/dist/types/block.d.mts +1 -2
- package/dist/types/block.d.ts +1 -2
- package/dist/types/context.d.mts +5 -8
- package/dist/types/context.d.ts +5 -8
- 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/errors.d.mts +36 -0
- package/dist/types/errors.d.ts +36 -0
- package/dist/types/eval.d.mts +8 -2
- package/dist/types/eval.d.ts +8 -2
- package/dist/types/index.d.mts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/magics.d.mts +5 -6
- package/dist/types/magics.d.ts +5 -6
- package/dist/types/ownership.d.mts +9 -16
- package/dist/types/ownership.d.ts +9 -16
- 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 -7
- package/dist/types/plugins/media/index.d.ts +6 -7
- package/dist/types/plugins/morph/index.d.mts +23 -11
- package/dist/types/plugins/morph/index.d.ts +23 -11
- 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/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 +6 -8
- package/dist/types/warn.d.ts +6 -8
- package/package.json +11 -2
package/dist/types/block.d.mts
CHANGED
|
@@ -14,8 +14,7 @@ export declare class Block {
|
|
|
14
14
|
remove(): void;
|
|
15
15
|
/**
|
|
16
16
|
* The bookkeeping half of `remove()`, for a block whose nodes are already
|
|
17
|
-
* gone
|
|
18
|
-
* throw on nodes that no longer have this parent.
|
|
17
|
+
* gone — `remove()`'s `removeChild` calls would throw on them.
|
|
19
18
|
*/
|
|
20
19
|
discard(): void;
|
|
21
20
|
teardown(): void;
|
package/dist/types/block.d.ts
CHANGED
|
@@ -14,8 +14,7 @@ export declare class Block {
|
|
|
14
14
|
remove(): void;
|
|
15
15
|
/**
|
|
16
16
|
* The bookkeeping half of `remove()`, for a block whose nodes are already
|
|
17
|
-
* gone
|
|
18
|
-
* throw on nodes that no longer have this parent.
|
|
17
|
+
* gone — `remove()`'s `removeChild` calls would throw on them.
|
|
19
18
|
*/
|
|
20
19
|
discard(): void;
|
|
21
20
|
teardown(): void;
|
package/dist/types/context.d.mts
CHANGED
|
@@ -12,17 +12,14 @@ export interface Context {
|
|
|
12
12
|
delimiters: [string, string];
|
|
13
13
|
delimitersRE: RegExp;
|
|
14
14
|
/**
|
|
15
|
-
* The framework walker, published
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* reading it here keeps them from importing — and re-bundling — the core.
|
|
15
|
+
* The framework walker, published by `mount()` and inherited by every child
|
|
16
|
+
* context. Plugins that insert markup into a live tree (morph) bind it with
|
|
17
|
+
* this instead of importing — and re-bundling — the core.
|
|
19
18
|
*/
|
|
20
19
|
walk?: (node: Node, ctx: Context) => ChildNode | null | void;
|
|
21
20
|
/**
|
|
22
|
-
* Disposes a node and its subtree. Published
|
|
23
|
-
*
|
|
24
|
-
* — morph does, directly — can release what they owned without importing
|
|
25
|
-
* and re-bundling the core.
|
|
21
|
+
* Disposes a node and its subtree. Published alongside `walk`, so a plugin
|
|
22
|
+
* that removes nodes directly can release what they owned.
|
|
26
23
|
*/
|
|
27
24
|
dispose?: (node: Node) => void;
|
|
28
25
|
}
|
package/dist/types/context.d.ts
CHANGED
|
@@ -12,17 +12,14 @@ export interface Context {
|
|
|
12
12
|
delimiters: [string, string];
|
|
13
13
|
delimitersRE: RegExp;
|
|
14
14
|
/**
|
|
15
|
-
* The framework walker, published
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* reading it here keeps them from importing — and re-bundling — the core.
|
|
15
|
+
* The framework walker, published by `mount()` and inherited by every child
|
|
16
|
+
* context. Plugins that insert markup into a live tree (morph) bind it with
|
|
17
|
+
* this instead of importing — and re-bundling — the core.
|
|
19
18
|
*/
|
|
20
19
|
walk?: (node: Node, ctx: Context) => ChildNode | null | void;
|
|
21
20
|
/**
|
|
22
|
-
* Disposes a node and its subtree. Published
|
|
23
|
-
*
|
|
24
|
-
* — morph does, directly — can release what they owned without importing
|
|
25
|
-
* and re-bundling the core.
|
|
21
|
+
* Disposes a node and its subtree. Published alongside `walk`, so a plugin
|
|
22
|
+
* that removes nodes directly can release what they owned.
|
|
26
23
|
*/
|
|
27
24
|
dispose?: (node: Node) => void;
|
|
28
25
|
}
|
|
@@ -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);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One route for every runtime error. The diagnostic prose is DEV-only; the
|
|
3
|
+
* routing and `onError` handlers ship, since that is where monitoring hooks in.
|
|
4
|
+
*/
|
|
5
|
+
export type ErrorPhase =
|
|
6
|
+
/** evaluating a directive's expression, or a text interpolation */
|
|
7
|
+
'expression'
|
|
8
|
+
/** inside a v-on handler, after the event fired */
|
|
9
|
+
| 'handler'
|
|
10
|
+
/** a directive's own setup threw */
|
|
11
|
+
| 'directive'
|
|
12
|
+
/** the expression could not be compiled into a function at all */
|
|
13
|
+
| 'compile'
|
|
14
|
+
/** re-running after a change: a `$watch` callback, `watchEffect`, a plugin effect */
|
|
15
|
+
| 'effect'
|
|
16
|
+
/** a plugin's teardown, during a full `app.unmount()` */
|
|
17
|
+
| 'teardown';
|
|
18
|
+
export interface ErrorInfo {
|
|
19
|
+
phase: ErrorPhase;
|
|
20
|
+
/** the expression text, as written in the attribute */
|
|
21
|
+
expression?: string;
|
|
22
|
+
/** the attribute or construct it came from, e.g. `v-on:click` or `{{ }}` */
|
|
23
|
+
source?: string;
|
|
24
|
+
/** the element the directive sits on */
|
|
25
|
+
el?: Node;
|
|
26
|
+
/** the scope the expression was evaluated against */
|
|
27
|
+
scope?: Record<string, any>;
|
|
28
|
+
}
|
|
29
|
+
export type ErrorHandler = (err: unknown, info: ErrorInfo) => void;
|
|
30
|
+
/** A short, recognisable rendering of the element — not its whole subtree. */
|
|
31
|
+
export declare const describeEl: (el?: Node) => string | undefined;
|
|
32
|
+
/** Registered by `app.onError()`. Shared across apps, like the store registry. */
|
|
33
|
+
export declare const addErrorHandler: (fn: ErrorHandler) => () => void;
|
|
34
|
+
/** Test seam — drops every registered handler. */
|
|
35
|
+
export declare const clearErrorHandlers: () => undefined;
|
|
36
|
+
export declare const handleError: (err: unknown, info: ErrorInfo) => void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One route for every runtime error. The diagnostic prose is DEV-only; the
|
|
3
|
+
* routing and `onError` handlers ship, since that is where monitoring hooks in.
|
|
4
|
+
*/
|
|
5
|
+
export type ErrorPhase =
|
|
6
|
+
/** evaluating a directive's expression, or a text interpolation */
|
|
7
|
+
'expression'
|
|
8
|
+
/** inside a v-on handler, after the event fired */
|
|
9
|
+
| 'handler'
|
|
10
|
+
/** a directive's own setup threw */
|
|
11
|
+
| 'directive'
|
|
12
|
+
/** the expression could not be compiled into a function at all */
|
|
13
|
+
| 'compile'
|
|
14
|
+
/** re-running after a change: a `$watch` callback, `watchEffect`, a plugin effect */
|
|
15
|
+
| 'effect'
|
|
16
|
+
/** a plugin's teardown, during a full `app.unmount()` */
|
|
17
|
+
| 'teardown';
|
|
18
|
+
export interface ErrorInfo {
|
|
19
|
+
phase: ErrorPhase;
|
|
20
|
+
/** the expression text, as written in the attribute */
|
|
21
|
+
expression?: string;
|
|
22
|
+
/** the attribute or construct it came from, e.g. `v-on:click` or `{{ }}` */
|
|
23
|
+
source?: string;
|
|
24
|
+
/** the element the directive sits on */
|
|
25
|
+
el?: Node;
|
|
26
|
+
/** the scope the expression was evaluated against */
|
|
27
|
+
scope?: Record<string, any>;
|
|
28
|
+
}
|
|
29
|
+
export type ErrorHandler = (err: unknown, info: ErrorInfo) => void;
|
|
30
|
+
/** A short, recognisable rendering of the element — not its whole subtree. */
|
|
31
|
+
export declare const describeEl: (el?: Node) => string | undefined;
|
|
32
|
+
/** Registered by `app.onError()`. Shared across apps, like the store registry. */
|
|
33
|
+
export declare const addErrorHandler: (fn: ErrorHandler) => () => void;
|
|
34
|
+
/** Test seam — drops every registered handler. */
|
|
35
|
+
export declare const clearErrorHandlers: () => undefined;
|
|
36
|
+
export declare const handleError: (err: unknown, info: ErrorInfo) => void;
|
package/dist/types/eval.d.mts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { type ErrorInfo } from './errors.mjs';
|
|
2
|
+
/** Where the expression came from, so a failure can name its directive and element. */
|
|
3
|
+
export type EvalMeta = Pick<ErrorInfo, 'source' | 'el'> & {
|
|
4
|
+
/** Shown instead of the compiled text: `{{ total }}`, not `$s( total )`. */
|
|
5
|
+
expression?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const evaluate: (scope: any, exp: string, el?: Node, meta?: EvalMeta) => any;
|
|
8
|
+
export declare const execute: (scope: any, exp: string, el?: Node, meta?: EvalMeta) => any;
|
package/dist/types/eval.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { type ErrorInfo } from './errors';
|
|
2
|
+
/** Where the expression came from, so a failure can name its directive and element. */
|
|
3
|
+
export type EvalMeta = Pick<ErrorInfo, 'source' | 'el'> & {
|
|
4
|
+
/** Shown instead of the compiled text: `{{ total }}`, not `$s( total )`. */
|
|
5
|
+
expression?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const evaluate: (scope: any, exp: string, el?: Node, meta?: EvalMeta) => any;
|
|
8
|
+
export declare const execute: (scope: any, exp: string, el?: Node, meta?: EvalMeta) => any;
|
package/dist/types/index.d.mts
CHANGED
|
@@ -5,5 +5,6 @@ export { nextTick } from './scheduler.mjs';
|
|
|
5
5
|
export { watchEffect } from './effect.mjs';
|
|
6
6
|
export { computed, reactive } from '@vue/reactivity';
|
|
7
7
|
export type { ComputedRef, WritableComputedRef } from '@vue/reactivity';
|
|
8
|
+
export type { ErrorHandler, ErrorInfo, ErrorPhase } from './errors.mjs';
|
|
8
9
|
export { devtools, disableDevtools } from './devtools.mjs';
|
|
9
10
|
export type { LiteVueDevtools, DevtoolsEvent } from './devtools.mjs';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ export { nextTick } from './scheduler';
|
|
|
5
5
|
export { watchEffect } from './effect';
|
|
6
6
|
export { computed, reactive } from '@vue/reactivity';
|
|
7
7
|
export type { ComputedRef, WritableComputedRef } from '@vue/reactivity';
|
|
8
|
+
export type { ErrorHandler, ErrorInfo, ErrorPhase } from './errors';
|
|
8
9
|
export { devtools, disableDevtools } from './devtools';
|
|
9
10
|
export type { LiteVueDevtools, DevtoolsEvent } from './devtools';
|
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;
|
|
@@ -1,30 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Per-node disposal.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* leaves the DOM while its effects stay in an array that is still alive and
|
|
9
|
-
* still reacting.
|
|
10
|
-
*
|
|
11
|
-
* This records what each node acquired while it was walked, so a removed
|
|
12
|
-
* subtree can be disposed precisely without giving every node a Context.
|
|
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.
|
|
13
8
|
*/
|
|
14
9
|
type Disposer = () => void;
|
|
15
10
|
export declare const setOwner: (node: Node | undefined) => Node | undefined;
|
|
16
11
|
/**
|
|
17
12
|
* Registers a disposer against `node`, defaulting to the node being walked.
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* anchor, so their own effects have to be owned by a node that stays in the
|
|
22
|
-
* tree, not by the template they removed.
|
|
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.
|
|
23
16
|
*/
|
|
24
17
|
export declare const own: (dispose: Disposer, node?: Node | undefined) => void;
|
|
25
18
|
/**
|
|
26
|
-
* Disposes `node` and
|
|
27
|
-
*
|
|
19
|
+
* Disposes `node` and its subtree. Safe on an unowned node, and idempotent —
|
|
20
|
+
* the record is dropped as it runs.
|
|
28
21
|
*/
|
|
29
22
|
export declare const disposeSubtree: (node: Node) => void;
|
|
30
23
|
export {};
|
|
@@ -1,30 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Per-node disposal.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* leaves the DOM while its effects stay in an array that is still alive and
|
|
9
|
-
* still reacting.
|
|
10
|
-
*
|
|
11
|
-
* This records what each node acquired while it was walked, so a removed
|
|
12
|
-
* subtree can be disposed precisely without giving every node a Context.
|
|
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.
|
|
13
8
|
*/
|
|
14
9
|
type Disposer = () => void;
|
|
15
10
|
export declare const setOwner: (node: Node | undefined) => Node | undefined;
|
|
16
11
|
/**
|
|
17
12
|
* Registers a disposer against `node`, defaulting to the node being walked.
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* anchor, so their own effects have to be owned by a node that stays in the
|
|
22
|
-
* tree, not by the template they removed.
|
|
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.
|
|
23
16
|
*/
|
|
24
17
|
export declare const own: (dispose: Disposer, node?: Node | undefined) => void;
|
|
25
18
|
/**
|
|
26
|
-
* Disposes `node` and
|
|
27
|
-
*
|
|
19
|
+
* Disposes `node` and its subtree. Safe on an unowned node, and idempotent —
|
|
20
|
+
* the record is dropped as it runs.
|
|
28
21
|
*/
|
|
29
22
|
export declare const disposeSubtree: (node: Node) => void;
|
|
30
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 {
|
|
@@ -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 {
|
|
@@ -2,25 +2,37 @@ 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
|
/**
|
|
17
|
-
* Identity used to match children across the update. Defaults to `id
|
|
12
|
+
* Identity used to match children across the update. Defaults to `id`,
|
|
13
|
+
* then `data-key`, then `data-id`.
|
|
18
14
|
* Elements that match keep their DOM node (and therefore their scope);
|
|
19
15
|
* unkeyed children fall back to matching by position.
|
|
20
16
|
*/
|
|
21
17
|
key?: (el: Element) => string | null | undefined;
|
|
22
18
|
/** Return true to leave a subtree completely untouched. */
|
|
23
19
|
skip?: (from: Element, to: Element) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Return true to keep an element the incoming HTML no longer contains.
|
|
22
|
+
* `skip` cannot express this — it is only consulted for a matched pair, so
|
|
23
|
+
* it never sees one the server stopped sending, which is exactly the case a
|
|
24
|
+
* client-only widget hits. `data-morph-preserve` does the same declaratively.
|
|
25
|
+
*/
|
|
26
|
+
preserve?: (el: Element) => boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Called before a node is inserted. Return `false` to leave it out.
|
|
29
|
+
*/
|
|
30
|
+
beforeNodeAdded?: (node: Node) => boolean | void;
|
|
31
|
+
/**
|
|
32
|
+
* Called after a node has been removed, once its effects and listeners are
|
|
33
|
+
* released — so what arrives here is inert, not a live subtree.
|
|
34
|
+
*/
|
|
35
|
+
afterNodeRemoved?: (node: Node) => void;
|
|
24
36
|
}
|
|
25
37
|
/**
|
|
26
38
|
* morph(from, to) — patch `from` in place so it matches `to`, which may be an
|
|
@@ -28,7 +40,7 @@ export interface MorphOptions {
|
|
|
28
40
|
*/
|
|
29
41
|
export declare const morph: (from: Element, to: Element | string, opts?: MorphOptions) => Element;
|
|
30
42
|
/**
|
|
31
|
-
* Registers `$morph
|
|
43
|
+
* Registers `$morph`, so a template can update a region from a fetch response
|
|
32
44
|
* without dropping into JavaScript.
|
|
33
45
|
*/
|
|
34
46
|
export declare const morphPlugin: Plugin;
|
|
@@ -2,25 +2,37 @@ 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
|
/**
|
|
17
|
-
* Identity used to match children across the update. Defaults to `id
|
|
12
|
+
* Identity used to match children across the update. Defaults to `id`,
|
|
13
|
+
* then `data-key`, then `data-id`.
|
|
18
14
|
* Elements that match keep their DOM node (and therefore their scope);
|
|
19
15
|
* unkeyed children fall back to matching by position.
|
|
20
16
|
*/
|
|
21
17
|
key?: (el: Element) => string | null | undefined;
|
|
22
18
|
/** Return true to leave a subtree completely untouched. */
|
|
23
19
|
skip?: (from: Element, to: Element) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Return true to keep an element the incoming HTML no longer contains.
|
|
22
|
+
* `skip` cannot express this — it is only consulted for a matched pair, so
|
|
23
|
+
* it never sees one the server stopped sending, which is exactly the case a
|
|
24
|
+
* client-only widget hits. `data-morph-preserve` does the same declaratively.
|
|
25
|
+
*/
|
|
26
|
+
preserve?: (el: Element) => boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Called before a node is inserted. Return `false` to leave it out.
|
|
29
|
+
*/
|
|
30
|
+
beforeNodeAdded?: (node: Node) => boolean | void;
|
|
31
|
+
/**
|
|
32
|
+
* Called after a node has been removed, once its effects and listeners are
|
|
33
|
+
* released — so what arrives here is inert, not a live subtree.
|
|
34
|
+
*/
|
|
35
|
+
afterNodeRemoved?: (node: Node) => void;
|
|
24
36
|
}
|
|
25
37
|
/**
|
|
26
38
|
* morph(from, to) — patch `from` in place so it matches `to`, which may be an
|
|
@@ -28,7 +40,7 @@ export interface MorphOptions {
|
|
|
28
40
|
*/
|
|
29
41
|
export declare const morph: (from: Element, to: Element | string, opts?: MorphOptions) => Element;
|
|
30
42
|
/**
|
|
31
|
-
* Registers `$morph
|
|
43
|
+
* Registers `$morph`, so a template can update a region from a fetch response
|
|
32
44
|
* without dropping into JavaScript.
|
|
33
45
|
*/
|
|
34
46
|
export declare const morphPlugin: Plugin;
|