what-core 0.13.11 → 0.15.0
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/LICENSE +21 -0
- package/README.md +64 -38
- package/a11y.d.ts +128 -0
- package/data.d.ts +294 -0
- package/dist/a11y.js +510 -0
- package/dist/a11y.min.js +413 -0
- package/dist/actions.js +158 -0
- package/dist/actions.min.js +112 -0
- package/dist/animation.js +481 -0
- package/dist/animation.min.js +295 -0
- package/dist/async.js +180 -0
- package/dist/async.min.js +134 -0
- package/dist/components.js +577 -0
- package/dist/components.min.js +413 -0
- package/dist/data.js +1212 -0
- package/dist/data.min.js +918 -0
- package/dist/diagnostics.js +187 -0
- package/dist/diagnostics.min.js +134 -0
- package/dist/dom.js +796 -0
- package/dist/dom.min.js +603 -0
- package/dist/entries/a11y.js +43 -0
- package/dist/entries/a11y.min.js +43 -0
- package/dist/entries/data.js +29 -0
- package/dist/entries/data.min.js +29 -0
- package/dist/entries/dom.js +45 -0
- package/dist/entries/dom.min.js +45 -0
- package/dist/entries/form.js +31 -0
- package/dist/entries/form.min.js +31 -0
- package/dist/entries/internal.js +123 -0
- package/dist/entries/internal.min.js +123 -0
- package/dist/entries/motion.js +23 -0
- package/dist/entries/motion.min.js +23 -0
- package/dist/entries/ui.js +25 -0
- package/dist/entries/ui.min.js +25 -0
- package/dist/env.js +5 -0
- package/dist/env.min.js +5 -0
- package/dist/errors.js +1518 -0
- package/dist/errors.min.js +548 -0
- package/dist/form.js +936 -0
- package/dist/form.min.js +703 -0
- package/dist/guardrails.js +84 -0
- package/dist/guardrails.min.js +55 -0
- package/dist/h.js +232 -0
- package/dist/h.min.js +171 -0
- package/dist/head.js +241 -0
- package/dist/head.min.js +207 -0
- package/dist/helpers.js +126 -0
- package/dist/helpers.min.js +98 -0
- package/dist/hooks.js +255 -0
- package/dist/hooks.min.js +153 -0
- package/dist/hot.js +215 -0
- package/dist/hot.min.js +24 -0
- package/dist/hydration-data.js +495 -0
- package/dist/hydration-data.min.js +371 -0
- package/dist/import-changes.js +273 -0
- package/dist/import-changes.min.js +272 -0
- package/dist/index.js +95 -0
- package/dist/index.min.js +95 -227
- package/dist/jsx-dev-runtime.js +10 -0
- package/dist/jsx-dev-runtime.min.js +10 -1
- package/dist/jsx-runtime.js +27 -0
- package/dist/jsx-runtime.min.js +15 -1
- package/dist/live.js +54 -0
- package/dist/live.min.js +49 -0
- package/dist/markup-rules.js +250 -0
- package/dist/markup-rules.min.js +213 -0
- package/dist/reactive.js +3334 -0
- package/dist/reactive.min.js +2033 -0
- package/dist/render.js +4746 -0
- package/dist/render.min.js +2797 -1
- package/dist/scheduler.js +225 -0
- package/dist/scheduler.min.js +162 -0
- package/dist/selector.js +11 -0
- package/dist/selector.min.js +10 -0
- package/dist/server-context.js +148 -0
- package/dist/server-context.min.js +121 -0
- package/dist/skeleton.js +342 -0
- package/dist/skeleton.min.js +310 -0
- package/dist/store.js +72 -0
- package/dist/store.min.js +50 -0
- package/dist/testing.js +720 -0
- package/dist/testing.min.js +458 -1
- package/dist/vnode-adoption.js +19 -0
- package/dist/vnode-adoption.min.js +19 -0
- package/dist/vnode-renderer.js +61 -0
- package/dist/vnode-renderer.min.js +47 -0
- package/dom.d.ts +44 -0
- package/form.d.ts +218 -0
- package/hot.d.ts +35 -0
- package/index.d.ts +421 -736
- package/internal.d.ts +284 -0
- package/jsx-runtime.d.ts +160 -137
- package/markup-rules.d.ts +83 -0
- package/motion.d.ts +156 -0
- package/package.json +117 -3
- package/render.d.ts +278 -29
- package/src/a11y.js +64 -59
- package/src/actions.js +226 -0
- package/src/animation.js +105 -57
- package/src/async.js +259 -0
- package/src/components.js +495 -144
- package/src/data.js +1410 -1159
- package/src/diagnostics.js +263 -0
- package/src/dom.js +1159 -872
- package/src/entries/a11y.js +24 -0
- package/src/entries/data.js +17 -0
- package/src/entries/dom.js +29 -0
- package/src/entries/form.js +16 -0
- package/src/entries/internal.js +63 -0
- package/src/entries/motion.js +13 -0
- package/src/entries/ui.js +13 -0
- package/src/env-development.js +12 -0
- package/src/env.js +33 -0
- package/src/errors.js +1144 -168
- package/src/form.js +723 -225
- package/src/guardrails.js +38 -126
- package/src/h.js +227 -152
- package/src/head.js +189 -19
- package/src/helpers.js +47 -75
- package/src/hooks.js +233 -248
- package/src/hot.js +316 -0
- package/src/hydration-data.js +859 -16
- package/src/import-changes.js +156 -0
- package/src/index.js +38 -188
- package/src/jsx-dev-runtime.js +7 -14
- package/src/jsx-runtime.js +25 -9
- package/src/live.js +80 -0
- package/src/markup-rules.js +387 -0
- package/src/reactive.js +4400 -862
- package/src/render.js +6502 -2570
- package/src/scheduler.js +56 -21
- package/src/selector.js +31 -0
- package/src/server-context.js +252 -22
- package/src/skeleton.js +22 -12
- package/src/store.js +17 -31
- package/src/testing.js +389 -63
- package/src/vnode-adoption.js +48 -0
- package/src/vnode-renderer.js +114 -0
- package/testing.d.ts +81 -1
- package/ui.d.ts +20 -0
- package/dist/chunk-6YOUZ6T4.min.js +0 -1
- package/dist/chunk-FN6HXME3.min.js +0 -11
- package/dist/chunk-VKZY7JPN.min.js +0 -1
- package/src/agent-context.js +0 -127
- package/src/warnings.js +0 -193
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "what-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "What Framework - Signal-based UI framework built for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -9,43 +9,154 @@
|
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./index.d.ts",
|
|
12
|
+
"development": "./src/index.js",
|
|
12
13
|
"production": "./dist/index.min.js",
|
|
14
|
+
"node": "./src/index.js",
|
|
15
|
+
"module": "./dist/index.js",
|
|
13
16
|
"import": "./src/index.js",
|
|
14
17
|
"default": "./src/index.js"
|
|
15
18
|
},
|
|
16
19
|
"./jsx-runtime": {
|
|
17
20
|
"types": "./jsx-runtime.d.ts",
|
|
21
|
+
"development": "./src/jsx-runtime.js",
|
|
18
22
|
"production": "./dist/jsx-runtime.min.js",
|
|
23
|
+
"node": "./src/jsx-runtime.js",
|
|
24
|
+
"module": "./dist/jsx-runtime.js",
|
|
19
25
|
"import": "./src/jsx-runtime.js",
|
|
20
26
|
"default": "./src/jsx-runtime.js"
|
|
21
27
|
},
|
|
22
28
|
"./jsx-dev-runtime": {
|
|
23
29
|
"types": "./jsx-dev-runtime.d.ts",
|
|
30
|
+
"development": "./src/jsx-dev-runtime.js",
|
|
24
31
|
"production": "./dist/jsx-dev-runtime.min.js",
|
|
32
|
+
"node": "./src/jsx-dev-runtime.js",
|
|
33
|
+
"module": "./dist/jsx-dev-runtime.js",
|
|
25
34
|
"import": "./src/jsx-dev-runtime.js",
|
|
26
35
|
"default": "./src/jsx-dev-runtime.js"
|
|
27
36
|
},
|
|
28
37
|
"./render": {
|
|
29
38
|
"types": "./render.d.ts",
|
|
39
|
+
"development": "./src/render.js",
|
|
30
40
|
"production": "./dist/render.min.js",
|
|
41
|
+
"node": "./src/render.js",
|
|
42
|
+
"module": "./dist/render.js",
|
|
31
43
|
"import": "./src/render.js",
|
|
32
44
|
"default": "./src/render.js"
|
|
33
45
|
},
|
|
46
|
+
"./a11y": {
|
|
47
|
+
"types": "./a11y.d.ts",
|
|
48
|
+
"development": "./src/entries/a11y.js",
|
|
49
|
+
"production": "./dist/entries/a11y.min.js",
|
|
50
|
+
"node": "./src/entries/a11y.js",
|
|
51
|
+
"module": "./dist/entries/a11y.js",
|
|
52
|
+
"import": "./src/entries/a11y.js",
|
|
53
|
+
"default": "./src/entries/a11y.js"
|
|
54
|
+
},
|
|
55
|
+
"./ui": {
|
|
56
|
+
"types": "./ui.d.ts",
|
|
57
|
+
"development": "./src/entries/ui.js",
|
|
58
|
+
"production": "./dist/entries/ui.min.js",
|
|
59
|
+
"node": "./src/entries/ui.js",
|
|
60
|
+
"module": "./dist/entries/ui.js",
|
|
61
|
+
"import": "./src/entries/ui.js",
|
|
62
|
+
"default": "./src/entries/ui.js"
|
|
63
|
+
},
|
|
64
|
+
"./motion": {
|
|
65
|
+
"types": "./motion.d.ts",
|
|
66
|
+
"development": "./src/entries/motion.js",
|
|
67
|
+
"production": "./dist/entries/motion.min.js",
|
|
68
|
+
"node": "./src/entries/motion.js",
|
|
69
|
+
"module": "./dist/entries/motion.js",
|
|
70
|
+
"import": "./src/entries/motion.js",
|
|
71
|
+
"default": "./src/entries/motion.js"
|
|
72
|
+
},
|
|
73
|
+
"./dom": {
|
|
74
|
+
"types": "./dom.d.ts",
|
|
75
|
+
"development": "./src/entries/dom.js",
|
|
76
|
+
"production": "./dist/entries/dom.min.js",
|
|
77
|
+
"node": "./src/entries/dom.js",
|
|
78
|
+
"module": "./dist/entries/dom.js",
|
|
79
|
+
"import": "./src/entries/dom.js",
|
|
80
|
+
"default": "./src/entries/dom.js"
|
|
81
|
+
},
|
|
82
|
+
"./form": {
|
|
83
|
+
"types": "./form.d.ts",
|
|
84
|
+
"development": "./src/entries/form.js",
|
|
85
|
+
"production": "./dist/entries/form.min.js",
|
|
86
|
+
"node": "./src/entries/form.js",
|
|
87
|
+
"module": "./dist/entries/form.js",
|
|
88
|
+
"import": "./src/entries/form.js",
|
|
89
|
+
"default": "./src/entries/form.js"
|
|
90
|
+
},
|
|
91
|
+
"./data": {
|
|
92
|
+
"types": "./data.d.ts",
|
|
93
|
+
"development": "./src/entries/data.js",
|
|
94
|
+
"production": "./dist/entries/data.min.js",
|
|
95
|
+
"node": "./src/entries/data.js",
|
|
96
|
+
"module": "./dist/entries/data.js",
|
|
97
|
+
"import": "./src/entries/data.js",
|
|
98
|
+
"default": "./src/entries/data.js"
|
|
99
|
+
},
|
|
34
100
|
"./testing": {
|
|
35
101
|
"types": "./testing.d.ts",
|
|
102
|
+
"development": "./src/testing.js",
|
|
36
103
|
"production": "./dist/testing.min.js",
|
|
104
|
+
"node": "./src/testing.js",
|
|
105
|
+
"module": "./dist/testing.js",
|
|
37
106
|
"import": "./src/testing.js",
|
|
38
107
|
"default": "./src/testing.js"
|
|
108
|
+
},
|
|
109
|
+
"./hot": {
|
|
110
|
+
"types": "./hot.d.ts",
|
|
111
|
+
"development": "./src/hot.js",
|
|
112
|
+
"production": "./dist/hot.min.js",
|
|
113
|
+
"node": "./src/hot.js",
|
|
114
|
+
"module": "./dist/hot.js",
|
|
115
|
+
"import": "./src/hot.js",
|
|
116
|
+
"default": "./src/hot.js"
|
|
117
|
+
},
|
|
118
|
+
"./internal": {
|
|
119
|
+
"types": "./internal.d.ts",
|
|
120
|
+
"development": "./src/entries/internal.js",
|
|
121
|
+
"production": "./dist/entries/internal.min.js",
|
|
122
|
+
"node": "./src/entries/internal.js",
|
|
123
|
+
"module": "./dist/entries/internal.js",
|
|
124
|
+
"import": "./src/entries/internal.js",
|
|
125
|
+
"default": "./src/entries/internal.js"
|
|
126
|
+
},
|
|
127
|
+
"./internal/markup-rules": {
|
|
128
|
+
"types": "./markup-rules.d.ts",
|
|
129
|
+
"development": "./src/markup-rules.js",
|
|
130
|
+
"production": "./dist/markup-rules.min.js",
|
|
131
|
+
"node": "./src/markup-rules.js",
|
|
132
|
+
"module": "./dist/markup-rules.js",
|
|
133
|
+
"import": "./src/markup-rules.js",
|
|
134
|
+
"default": "./src/markup-rules.js"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"imports": {
|
|
138
|
+
"#env": {
|
|
139
|
+
"development": "./src/env-development.js",
|
|
140
|
+
"default": "./src/env.js"
|
|
39
141
|
}
|
|
40
142
|
},
|
|
41
143
|
"files": [
|
|
42
144
|
"src",
|
|
43
|
-
"dist/**/*.
|
|
145
|
+
"dist/**/*.js",
|
|
44
146
|
"index.d.ts",
|
|
45
147
|
"jsx-runtime.d.ts",
|
|
46
148
|
"jsx-dev-runtime.d.ts",
|
|
47
149
|
"render.d.ts",
|
|
48
|
-
"
|
|
150
|
+
"a11y.d.ts",
|
|
151
|
+
"ui.d.ts",
|
|
152
|
+
"motion.d.ts",
|
|
153
|
+
"dom.d.ts",
|
|
154
|
+
"form.d.ts",
|
|
155
|
+
"data.d.ts",
|
|
156
|
+
"internal.d.ts",
|
|
157
|
+
"markup-rules.d.ts",
|
|
158
|
+
"testing.d.ts",
|
|
159
|
+
"hot.d.ts"
|
|
49
160
|
],
|
|
50
161
|
"sideEffects": false,
|
|
51
162
|
"keywords": [
|
|
@@ -60,6 +171,9 @@
|
|
|
60
171
|
],
|
|
61
172
|
"author": "ZVN DEV (https://zvndev.com)",
|
|
62
173
|
"license": "MIT",
|
|
174
|
+
"engines": {
|
|
175
|
+
"node": ">=20"
|
|
176
|
+
},
|
|
63
177
|
"repository": {
|
|
64
178
|
"type": "git",
|
|
65
179
|
"url": "https://github.com/CelsianJs/what-framework"
|
package/render.d.ts
CHANGED
|
@@ -1,42 +1,195 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
export { effect, untrack } from './index.js';
|
|
2
|
+
import type { VNodeChild, Signal, Component, VNode } from './index.js';
|
|
3
|
+
|
|
4
|
+
// Fine-grained rendering primitives: the runtime compiled JSX calls, for code
|
|
5
|
+
// written without JSX.
|
|
6
|
+
export function template(html: string): () => Element;
|
|
7
|
+
export function insert(parent: Node, child: any, marker?: Node | null): any;
|
|
8
|
+
/**
|
|
9
|
+
* @internal insert() for a function written in the hole itself: the reactive
|
|
10
|
+
* region insert() would hand it to. Emitted by the compiler.
|
|
11
|
+
*/
|
|
12
|
+
export function _$reactive(parent: Node, child: () => any, marker?: Node | null, devName?: string): void;
|
|
13
|
+
/** `source` is an accessor, or an array for a list that never changes. */
|
|
14
|
+
export function mapArray<T>(
|
|
15
|
+
source: (() => readonly T[] | null | undefined) | readonly T[],
|
|
16
|
+
mapFn: (item: T | Signal<T>, index: number, raw: T) => Node,
|
|
17
|
+
/**
|
|
18
|
+
* `raw`: the row gets the item itself. `follow`: the row gets the item's cell
|
|
19
|
+
* (what-compiler's `.map()` lowering). `loc`: the list's source location,
|
|
20
|
+
* named by the duplicate-key diagnostic. `slot`: the number what-compiler
|
|
21
|
+
* gives a list it lowers, the same as the server's, for the place of its
|
|
22
|
+
* keyed rows. `key` is handed the item and its index (a key of both is the
|
|
23
|
+
* row's item and position).
|
|
24
|
+
*/
|
|
25
|
+
options?: { key?: (item: T, index: number) => string | number; raw?: boolean; follow?: boolean; loc?: string; slot?: number },
|
|
26
|
+
): (parent: Node, marker?: Node | null) => Node;
|
|
27
|
+
export function spread(el: Element, props: Record<string, any>): void;
|
|
28
|
+
export function setProp(el: Element, key: string, value: any): void;
|
|
29
|
+
/** @internal spread() as compiled output calls it: a select or an option it is given has its code installed by its module (`_$selects`). */
|
|
30
|
+
export function _$spread(el: Element, props: Record<string, any>, after?: string[]): void;
|
|
31
|
+
/** @internal Compiled JSX's spreads with other writers: the sources in source order (or a function giving them, read again), each name's last writer winning. */
|
|
32
|
+
export function _$spreads(el: Element, sources: readonly unknown[] | (() => readonly unknown[]), after?: string[]): void;
|
|
33
|
+
/** @internal Install the writer of SVG's XLink attributes (compiled JSX, at module scope). */
|
|
34
|
+
export function _$xlink(): void;
|
|
35
|
+
/** @internal setProp() as compiled output calls it (see `_$spread`). */
|
|
36
|
+
export function _$setProp(el: Element, key: string, value: any): void;
|
|
37
|
+
/** @internal setProp() for an input's `type` or a select's `multiple`, as compiled output writes them: a change writes the field's value and checked again. */
|
|
38
|
+
export function _$retype(el: Element, key: string, value: any): void;
|
|
39
|
+
/** @internal setValue() as compiled output calls it (see `_$spread`). */
|
|
40
|
+
export function _$setValue(el: Element, value: any, bound?: 1): void;
|
|
41
|
+
/** @internal Compiler output, once at module scope in a module whose JSX writes a prop of a <select> or an <option>: installs the code that keeps their selection. */
|
|
42
|
+
export function _$selects(): void;
|
|
43
|
+
/** @internal Compiler output, once at module scope in a module whose JSX can build a form field: what the user changed in a form before hydration goes to the fields built before the walk reached them. */
|
|
44
|
+
export function _$carryFields(): void;
|
|
45
|
+
/**
|
|
46
|
+
* One listener per event type on `root` (the document by default; a shadow root
|
|
47
|
+
* or an element delegates for its own subtree) runs the `$$event` handlers on
|
|
48
|
+
* the event's path.
|
|
49
|
+
*/
|
|
50
|
+
export function delegateEvents(eventNames: string[], root?: Document | ShadowRoot | Element): void;
|
|
51
|
+
/** @internal Compiler output from a module that binds onChange: the `$$change` handlers under `root` are React's change event, which a text field fires as the user types. */
|
|
52
|
+
export function _$changes(root?: Document | ShadowRoot | Element): void;
|
|
53
|
+
/**
|
|
54
|
+
* Add a DOM listener, removed when the current owner (the component, list row
|
|
55
|
+
* or root being built) is disposed; returns the function that removes it
|
|
56
|
+
* sooner. In components, write onClick={...} in JSX. `event` is the DOM's:
|
|
57
|
+
* `on(el, 'change', fn)` hears a text field's commit (blur, Enter), where the
|
|
58
|
+
* onChange prop is React's change event, which fires as the user types.
|
|
59
|
+
*/
|
|
60
|
+
export function on(el: Element, event: string, handler: (e: Event) => void, options?: boolean | AddEventListenerOptions): () => void;
|
|
61
|
+
/** @internal Compiler output: marks the element's delegated `$$event` handlers as the current owner's. */
|
|
62
|
+
export function _$own(el: Element): void;
|
|
63
|
+
export function classList(
|
|
64
|
+
el: Element,
|
|
65
|
+
classes: Record<string, unknown> | null | undefined | (() => Record<string, unknown> | null | undefined),
|
|
66
|
+
): void;
|
|
67
|
+
|
|
68
|
+
/** @internal Used by what-text. Lets the text engine intercept text-node insertion. */
|
|
69
|
+
export function _setTextInsertHook(hook: unknown): void;
|
|
70
|
+
|
|
71
|
+
// Compiler-internal template: parsed on first use. `flag` 2 marks markup the
|
|
72
|
+
// compiler wrapped in <svg>/<math> so its root parses in that namespace.
|
|
73
|
+
export function _$template(html: string, flag?: number): () => Element;
|
|
18
74
|
|
|
19
75
|
// Specialized attribute setters emitted by the compiler for statically-known
|
|
20
|
-
// attribute names
|
|
76
|
+
// attribute names. Function values are treated as reactive
|
|
21
77
|
// accessors (wrapped in an effect), mirroring setProp.
|
|
22
78
|
export function setClass(el: Element, value: string | null | undefined | (() => any)): void;
|
|
79
|
+
/** class on an element the compiler knows is HTML or MathML: writes `className`. */
|
|
80
|
+
export function className(el: Element, value: string | null | undefined | (() => any)): void;
|
|
81
|
+
/**
|
|
82
|
+
* classList={{ name: boolean }}: toggles each key by the truthiness of its value
|
|
83
|
+
* over the class attribute. A function classList, or a function value, is a
|
|
84
|
+
* reactive accessor. A key a previous object had falls back to the class
|
|
85
|
+
* attribute. Composes with `class` in prop order, as the server folds them.
|
|
86
|
+
*/
|
|
87
|
+
export function setClassList(
|
|
88
|
+
el: Element,
|
|
89
|
+
value: Record<string, unknown> | null | undefined | (() => Record<string, unknown> | null | undefined),
|
|
90
|
+
): void;
|
|
91
|
+
/**
|
|
92
|
+
* ref={...}: calls a callback with the element or sets `.current` on a ref object.
|
|
93
|
+
* Returns the element when `ref` is neither, including when it is a DOM node (a
|
|
94
|
+
* `let` ref still holding an earlier element); the compiler assigns the result
|
|
95
|
+
* back to a `let` ref.
|
|
96
|
+
*/
|
|
97
|
+
export function applyRef<T>(ref: T, el: Element): T | Element;
|
|
23
98
|
export function setStyle(el: Element, value: string | object | null | undefined | (() => any)): void;
|
|
24
99
|
export function setAttr(el: Element, name: string, value: any): void;
|
|
25
|
-
export function setValue(el: Element, value: any): void;
|
|
26
|
-
export function setChecked(el: Element, value: any): void;
|
|
100
|
+
export function setValue(el: Element, value: any, bound?: 1): void;
|
|
101
|
+
export function setChecked(el: Element, value: any, bound?: 1): void;
|
|
102
|
+
|
|
103
|
+
/** O(1) keyed selection; see createSelector in the package index. */
|
|
104
|
+
export function createSelector<T>(source: () => T): (key: T) => boolean;
|
|
105
|
+
|
|
106
|
+
/** @internal A keyed list row's item cell (mapArray's `follow` mode); read it with `_$item`. */
|
|
107
|
+
export interface RowItem<T> {
|
|
108
|
+
readonly value: T;
|
|
109
|
+
}
|
|
110
|
+
/** @internal Read a compiled `.map()` row's item from its cell; bindings that read it track it. */
|
|
111
|
+
export function _$item<T>(cell: RowItem<T>): T;
|
|
112
|
+
/**
|
|
113
|
+
* @internal A component body's read of one field of a prop, `props[name][key]`: a row item's getter records that field.
|
|
114
|
+
* `record` (development builds): the ERR_PROP_READ_ONCE of a value derived from the read, reported when it records no row field.
|
|
115
|
+
*/
|
|
116
|
+
export function _$propField(props: object, name: string, key: string | number, record?: { code: string; data: Record<string, unknown>; loc: string }): any;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @internal The keyed-only list the compiler imports (as `_$mapArray`) in modules
|
|
120
|
+
* whose every list is a keyed `.map()`: raw items, or with `follow` the item's
|
|
121
|
+
* cell (see mapArray).
|
|
122
|
+
*/
|
|
123
|
+
export function _$mapKeyed<T>(
|
|
124
|
+
source: () => T[] | null | undefined,
|
|
125
|
+
mapFn: (item: any, index: number, raw: T) => Node,
|
|
126
|
+
options: { key: (item: T, index: number) => unknown; raw?: boolean; follow?: boolean; loc?: string; slot?: number },
|
|
127
|
+
): (parent: Node, marker?: Node | null) => Comment;
|
|
27
128
|
|
|
28
129
|
// Equality-gated eager memo (the reactive memo, NOT the component-HOC `memo`
|
|
29
130
|
// exported from the package index). Emitted by the compiler for branch
|
|
30
|
-
// memoization of conditional JSX
|
|
31
|
-
export function memo<T>(fn: () => T): (() => T) & { peek(): T };
|
|
131
|
+
// memoization of conditional JSX.
|
|
132
|
+
export function _$memo<T>(fn: () => T): (() => T) & { peek(): T };
|
|
133
|
+
// The lazy memo (a computed): the condition of a branch that may never be
|
|
134
|
+
// reached, evaluated on its first read. Emitted for inner arms of ternary
|
|
135
|
+
// chains, <Show> fallbacks and ternaries handed to a component as JSX.
|
|
136
|
+
export function _$lazyMemo<T>(fn: () => T): () => T;
|
|
137
|
+
|
|
138
|
+
// A component with a key outside a list row whose value can change: a
|
|
139
|
+
// reactive child that builds it again, fresh, whenever the key's value changes.
|
|
140
|
+
export function _$keyed(key: () => unknown, build: () => unknown): () => unknown;
|
|
141
|
+
|
|
142
|
+
export interface IslandProps {
|
|
143
|
+
component: Component<any>;
|
|
144
|
+
mode: 'load' | 'idle' | 'visible' | 'interaction' | 'media' | 'action' | 'static';
|
|
145
|
+
mediaQuery?: string;
|
|
146
|
+
/** The island's data-island; the component function's name when left out. */
|
|
147
|
+
name?: string;
|
|
148
|
+
/** The component's props. Without it, every other key is a prop. */
|
|
149
|
+
props?: Record<string, any>;
|
|
150
|
+
[key: string]: any;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* What `<Counter client:idle start={1} />` compiles to:
|
|
155
|
+
* `h(_$Island, { component: Counter, name: 'Counter', mode: 'idle', props: { start: 1 } })`,
|
|
156
|
+
* an island that hydrates itself when its trigger fires (`mode`). The public
|
|
157
|
+
* island component, which hydrates through the island registry, is
|
|
158
|
+
* what-framework/server's Island.
|
|
159
|
+
*/
|
|
160
|
+
export function _$Island(props: IslandProps): VNode;
|
|
161
|
+
/** @internal What what-compiler found while compiling a module (development builds), reported when it loads. */
|
|
162
|
+
export function _$buildDiagnostics(records: Array<{ code: string; data: Record<string, unknown>; loc: string }>): void;
|
|
32
163
|
|
|
33
164
|
// --- Hydration ---
|
|
34
|
-
// hydrate() adopts server-rendered DOM instead of recreating it:
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
|
|
165
|
+
// hydrate() adopts server-rendered DOM instead of recreating it: the tree's
|
|
166
|
+
// components run once, and what they render claims the nodes the server wrote
|
|
167
|
+
// (h() vnodes, and compiled JSX built with what-compiler's `hydratable`
|
|
168
|
+
// option). Returns the unmount function, as mount() does; hydrating or
|
|
169
|
+
// mounting into the same container disposes the root it held.
|
|
170
|
+
export interface HydrationMismatch {
|
|
171
|
+
/** tag, text, missing, extra-nodes, marker, key, shadow-root (an element hosting a shadow root the client would not make), prebuilt (JSX built before the walk reached its place took the server's nodes' place), not-hydratable (DOM built before hydrate() could claim the server's, reported once), or attribute (an attribute the server wrote otherwise than the client's first write: development only, as the ERR_HYDRATION_MISMATCH diagnostic's data; onHydrationError does not hear it) */
|
|
172
|
+
kind: string;
|
|
173
|
+
/** The component whose output mismatched, or 'root'. */
|
|
174
|
+
component: string;
|
|
175
|
+
/** Its owner path (the server's data-hk), or null. */
|
|
176
|
+
ownerPath: string | null;
|
|
177
|
+
/** The DOM path under the container, e.g. `main>ul>li[1]`. */
|
|
178
|
+
path: string;
|
|
179
|
+
expected: string;
|
|
180
|
+
found: string;
|
|
181
|
+
/** 'client-render', 'move' for a keyed list's rows, 'none' for a component's key mismatch, or 'client-value' for an attribute. */
|
|
182
|
+
recovery: string;
|
|
183
|
+
/** The attribute's name, for kind attribute. */
|
|
184
|
+
attribute?: string;
|
|
185
|
+
}
|
|
186
|
+
export interface HydrateOptions {
|
|
187
|
+
/** Called for every mismatch, in production too (where nothing is logged). */
|
|
188
|
+
onHydrationError?: (mismatch: HydrationMismatch) => void;
|
|
189
|
+
}
|
|
190
|
+
export function hydrate(vnode: VNodeChild, container: string | Element, options?: HydrateOptions): () => void;
|
|
38
191
|
|
|
39
|
-
/** True while a hydration pass is
|
|
192
|
+
/** True while a hydration pass is claiming server-rendered DOM. */
|
|
40
193
|
export function isHydrating(): boolean;
|
|
41
194
|
|
|
42
195
|
// SVG counterpart to template(): elements are created in the SVG namespace, which
|
|
@@ -50,9 +203,105 @@ export function svgTemplate(html: string): () => Element;
|
|
|
50
203
|
*/
|
|
51
204
|
export function _$createComponent(component: unknown, props?: unknown, ...args: unknown[]): unknown;
|
|
52
205
|
|
|
206
|
+
/**
|
|
207
|
+
* @internal `_$createComponent` for a module whose every component is a plain
|
|
208
|
+
* function (never a class component, never a tag held in a binding): it does
|
|
209
|
+
* not look for either.
|
|
210
|
+
*/
|
|
211
|
+
export function _$createLazyFn(component: unknown, props?: unknown, ...args: unknown[]): unknown;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @internal `_$createComponent` for a module whose JSX hands no component
|
|
215
|
+
* children and no JSX in a prop: the compiler imports it under that name, so
|
|
216
|
+
* an app of such modules does not carry the lazy props.
|
|
217
|
+
*/
|
|
218
|
+
export function _$createLeaf(component: unknown, props?: unknown, ...args: unknown[]): unknown;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* @internal `_$createLeaf` for a module whose every component is a plain
|
|
222
|
+
* function (never a class component, never a tag held in a binding): it does
|
|
223
|
+
* not look for either.
|
|
224
|
+
*/
|
|
225
|
+
export function _$createFn(component: unknown, props?: unknown, ...args: unknown[]): unknown;
|
|
226
|
+
|
|
53
227
|
/**
|
|
54
228
|
* @internal The unbuilt sibling of `_$createComponent`, emitted for the JSX
|
|
55
|
-
* passed directly to `hydrate()
|
|
56
|
-
*
|
|
229
|
+
* passed directly to `hydrate()` in a hydratable build: hydrate() runs it when
|
|
230
|
+
* its walk reaches it.
|
|
57
231
|
*/
|
|
58
232
|
export function _$componentVNode(component: unknown, props?: unknown, ...args: unknown[]): VNodeChild;
|
|
233
|
+
/** @internal `_$componentVNode` for a root whose tag may be a string held in a binding: it claims the server's element. */
|
|
234
|
+
export function _$hcomponentVNode(component: unknown, props?: unknown, ...args: unknown[]): VNodeChild;
|
|
235
|
+
|
|
236
|
+
// @internal The helpers what-compiler's `hydratable` output calls instead of
|
|
237
|
+
// cloning templates and walking them by path (render.js has the protocol).
|
|
238
|
+
/** @internal Compiler output: a keyed row's text that reads a plain field of its item, written by the row's item cell. */
|
|
239
|
+
export function _$field(parent: Node, cell: unknown, value: unknown, marker: Node | null | undefined, read: (item: any) => unknown): void;
|
|
240
|
+
/** @internal `_$field` for hydratable output (`flag` as `_$hole`'s). */
|
|
241
|
+
export function _$hfield(parent: Node, cell: unknown, value: unknown, flag: number, read: (item: any) => unknown): void;
|
|
242
|
+
/** @internal Compiler output: a child that is an expression with no call in it, read once before the runtime decides whether an effect is needed. */
|
|
243
|
+
export function _$plain(parent: Node, read: () => unknown, marker?: Node | null, devName?: string): void;
|
|
244
|
+
/** @internal `_$plain` for hydratable output (`flag` as `_$hole`'s). */
|
|
245
|
+
export function _$hplain(parent: Node, read: () => unknown, flag: number, devName?: string): void;
|
|
246
|
+
/** @internal Compiler output: `el`, a form field whose props a spread sets; a field a `value` or `checked` among them binds to state shows it again after each of its events. */
|
|
247
|
+
export function _$controlled<T extends Element>(el: T): T;
|
|
248
|
+
/** @internal Compiler output, as the value of an option of a keyed list whose rows can hold a plain child that is a field of the row: installs the code that binds one. Returns true. */
|
|
249
|
+
export function _$rowFields(): true;
|
|
250
|
+
export function _$htemplate(html: string, flag?: number): (() => Node) & { root(): Node };
|
|
251
|
+
export function _$claim(template: (() => Node) & { root(): Node }, flags?: number): any;
|
|
252
|
+
export function _$next(skip: number, flags?: number): any;
|
|
253
|
+
/** @internal _$next for a form control: what the user changed in it before hydration stays. */
|
|
254
|
+
export function _$control(skip: number, flags?: number): any;
|
|
255
|
+
/** @internal _$claim for a template whose root is a form control. */
|
|
256
|
+
export function _$claimControl(tmpl: any, flags?: number): any;
|
|
257
|
+
export function _$skip(count: number): void;
|
|
258
|
+
export function _$hole(parent: Node, value: unknown, flag: number, devName?: string): void;
|
|
259
|
+
export function _$exit(): void;
|
|
260
|
+
export function _$hcreateComponent(component: unknown, props?: unknown, ...args: unknown[]): unknown;
|
|
261
|
+
/** @internal `_$hcreateComponent` for a module whose every component is a plain function (`_$createLazyFn`). */
|
|
262
|
+
export function _$hcreateFn(component: unknown, props?: unknown, ...args: unknown[]): unknown;
|
|
263
|
+
export function _$outside<T>(build: () => T): T;
|
|
264
|
+
/** @internal A value rendered as DOM nodes, appended to `out` (what-react's keyed rows render what is not theirs with it). */
|
|
265
|
+
export function _valuesToNodes(value: unknown, parent: Node | null, out: Node[], isSvg?: boolean): Node[];
|
|
266
|
+
/** @internal The children of `parent` changed: a select among them, or the one it is, writes its value again (what-react's keyed rows). */
|
|
267
|
+
export function _$childrenChanged(parent: Node): void;
|
|
268
|
+
/** @internal what-react's mixed mode: the delegated handlers a React root's listener on `container` runs for `e`, a part at a time between React's own (`walk(node)` runs those before `node`, `walk(null)` the rest up to the container; true once one stopped the event); `change` takes React's change event's. Null where no root above delegates the event. */
|
|
269
|
+
export function _delegatedWalk(e: Event, container: EventTarget, change: boolean): ((node: EventTarget | null) => boolean) | null;
|
|
270
|
+
/** @internal what-react's mixed mode: `wrap(toFunction)` answers, from now on, which function runs a component native code renders (what-react's own components run as islands; any other is `toFunction`'s answer). */
|
|
271
|
+
export function _setForeignComponent(wrap: (toFunction: (component: any) => any) => (component: any) => any): void;
|
|
272
|
+
/** @internal what-react's mixed mode: `wrap(keyedRows)` is the rows a region renders its value through, around the vnode rows (null when none are installed), with an `adopt(value, scope, open, close)` for a hydrating region. */
|
|
273
|
+
export function _installForeignRows(
|
|
274
|
+
wrap: (keyedRows: ((value: any, rows: any, isSvg: boolean, scope: any, end?: any, adopted?: any) => any) | null) =>
|
|
275
|
+
((value: any, rows: any, isSvg: boolean, scope: any, end?: any, adopted?: any) => any) & { adopt?: (value: any, scope: any, open: Comment, close: Comment) => any },
|
|
276
|
+
): void;
|
|
277
|
+
/** @internal Install the vnode renderer and its keyed rows, in a program that has none of what-core's (what-react's mixed mode). */
|
|
278
|
+
export function _installVNodeRuntime(
|
|
279
|
+
render: (vnode: any, parent?: any, isSvg?: boolean, inParent?: 1) => any,
|
|
280
|
+
keyedRows: ((value: any, rows: any, isSvg: boolean, scope: any, end?: any, adopted?: any) => any) | null,
|
|
281
|
+
setProp: ((el: any, key: string, value: any, isSvg: boolean) => void) | undefined,
|
|
282
|
+
refuses: ((key: string, value: any) => boolean) | undefined,
|
|
283
|
+
): void;
|
|
284
|
+
/** @internal A hydratable array whose members claim the server's nodes in document order as `build` creates them. `nested` 1: it follows another array's markers; 2: a component's children, with markers of their own only where their placement has them (`_$place`). */
|
|
285
|
+
export function _$members<T>(build: () => T, nested?: number): T;
|
|
286
|
+
/** @internal A `_$members` member that is not an element or a component, adopted where it stands while hydrating. */
|
|
287
|
+
export function _$member<T>(value: T, index: number): T;
|
|
288
|
+
/** @internal Compiled JSX: `props` carrying `slots`, the factories of the props its JSX passed as JSX or forwarded, which the component reads as lazy getters. */
|
|
289
|
+
export function _$slots<P extends object>(props: P, slots: Record<string, () => unknown>): P;
|
|
290
|
+
/** @internal Compiled JSX's spread props, merged in order into one plain props object of What's; getters of props objects What built stay getters (live props). */
|
|
291
|
+
export function _$merge(...sources: unknown[]): Record<string, unknown>;
|
|
292
|
+
/** @internal The key compiled JSX marks a props object with (`{ [_$props]: true, ... }`): its getters are live props, and its component gets it as a plain object with the mark hidden. `Symbol.for('what-core.props.v1')`. */
|
|
293
|
+
export const _$props: unique symbol;
|
|
294
|
+
/** @internal Compiled JSX: its props literal `props` marked with `_$props`, the mark not enumerable, and returned. */
|
|
295
|
+
export function _$marked<P extends object>(props: P): P;
|
|
296
|
+
/** @internal Compiled JSX's rest element of destructured props: `props` without `keys`, getters kept. */
|
|
297
|
+
export function _$omit(props: unknown, keys: readonly string[]): Record<string, unknown>;
|
|
298
|
+
/** @internal Compiled JSX: a component call placed in SVG (`ns` 1), MathML (2) or HTML inside one of them (0), so a tag held in a binding below it that SVG and HTML both name is created in that namespace. */
|
|
299
|
+
export function _$inNs<T>(ns: 0 | 1 | 2, build: () => T): T;
|
|
300
|
+
/** @internal A compiled read of `props[key]` where its value is placed: a lazy prop is built there. `inPlace` 1: where the server writes it with no markers of its own (an element's hole, a fragment's or an array's members). */
|
|
301
|
+
export function _$place(props: object, key: string, inPlace?: 1): unknown;
|
|
302
|
+
/** @internal The onHydrationError hook of the hydrate() walking now, or null (what-react's islands report to it after the walk). */
|
|
303
|
+
export function _hydrationErrorHook(): ((info: object) => void) | null;
|
|
304
|
+
/** @internal what-react: while hydrating, the owner path the next component adopted here would take, its step taken (a hole's React rows take one each). */
|
|
305
|
+
export function _takeOwnerStep(): string | undefined;
|
|
306
|
+
/** @internal A hydration walk of the server's nodes between `open` and `close` (exclusive): what `fn` builds claims them (what-react: a native component inside a React island). */
|
|
307
|
+
export function _hydrateRange<T>(open: Comment, close: Comment, fn: () => T, onError?: ((info: object) => void) | null): T;
|