kiru 1.4.1 → 1.5.1
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/dist/components/derive.d.ts +1 -1
- package/dist/components/derive.d.ts.map +1 -1
- package/dist/constants.d.ts +2 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -1
- package/dist/constants.js.map +1 -1
- package/dist/devtools.d.ts +1 -1
- package/dist/devtools.d.ts.map +1 -1
- package/dist/dom/nodes.d.ts +1 -1
- package/dist/dom/nodes.d.ts.map +1 -1
- package/dist/dom/nodes.js.map +1 -1
- package/dist/dom/props.js.map +1 -1
- package/dist/globalContext.d.ts +2 -2
- package/dist/globalContext.d.ts.map +1 -1
- package/dist/headlessRender.d.ts.map +1 -1
- package/dist/headlessRender.js +3 -0
- package/dist/headlessRender.js.map +1 -1
- package/dist/hooks/onCleanup.d.ts.map +1 -1
- package/dist/hooks/onCleanup.js +3 -1
- package/dist/hooks/onCleanup.js.map +1 -1
- package/dist/hooks/setup.d.ts.map +1 -1
- package/dist/hooks/setup.js +11 -28
- package/dist/hooks/setup.js.map +1 -1
- package/dist/hooks/utils.d.ts.map +1 -1
- package/dist/hooks/utils.js +2 -1
- package/dist/hooks/utils.js.map +1 -1
- package/dist/hydration.d.ts +1 -1
- package/dist/hydration.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/profiling.d.ts +1 -1
- package/dist/profiling.d.ts.map +1 -1
- package/dist/reconciler.d.ts.map +1 -1
- package/dist/reconciler.js +38 -6
- package/dist/reconciler.js.map +1 -1
- package/dist/resource.d.ts +11 -5
- package/dist/resource.d.ts.map +1 -1
- package/dist/resource.js +90 -40
- package/dist/resource.js.map +1 -1
- package/dist/router/client/index.d.ts +1 -1
- package/dist/router/client/index.d.ts.map +1 -1
- package/dist/router/fileRouterController.d.ts.map +1 -1
- package/dist/router/fileRouterController.js +1 -1
- package/dist/router/fileRouterController.js.map +1 -1
- package/dist/router/globals.d.ts +2 -2
- package/dist/router/globals.d.ts.map +1 -1
- package/dist/router/link.d.ts +1 -1
- package/dist/router/link.d.ts.map +1 -1
- package/dist/router/pageConfig.d.ts +1 -1
- package/dist/router/pageConfig.d.ts.map +1 -1
- package/dist/router/types.d.ts +3 -3
- package/dist/router/types.d.ts.map +1 -1
- package/dist/router/types.internal.d.ts +2 -2
- package/dist/router/types.internal.d.ts.map +1 -1
- package/dist/router/utils/index.d.ts +2 -2
- package/dist/router/utils/index.d.ts.map +1 -1
- package/dist/scheduler.d.ts.map +1 -1
- package/dist/scheduler.js +15 -2
- package/dist/scheduler.js.map +1 -1
- package/dist/signals/base.d.ts +1 -0
- package/dist/signals/base.d.ts.map +1 -1
- package/dist/signals/base.js +14 -2
- package/dist/signals/base.js.map +1 -1
- package/dist/signals/effect.d.ts.map +1 -1
- package/dist/signals/effect.js +8 -0
- package/dist/signals/effect.js.map +1 -1
- package/dist/signals/tracking.d.ts +1 -1
- package/dist/signals/tracking.d.ts.map +1 -1
- package/dist/signals/tracking.js +14 -15
- package/dist/signals/tracking.js.map +1 -1
- package/dist/ssr/client.d.ts +1 -1
- package/dist/ssr/client.d.ts.map +1 -1
- package/dist/types.d.ts +31 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/types.dom.d.ts +190 -2
- package/dist/types.dom.d.ts.map +1 -1
- package/dist/types.utils.d.ts +28 -21
- package/dist/types.utils.d.ts.map +1 -1
- package/dist/utils/vdom.d.ts.map +1 -1
- package/dist/utils/vdom.js +5 -2
- package/dist/utils/vdom.js.map +1 -1
- package/package.json +1 -1
- package/src/components/derive.ts +1 -1
- package/src/constants.ts +2 -0
- package/src/devtools.ts +1 -1
- package/src/dom/commit.ts +1 -1
- package/src/dom/nodes.ts +8 -3
- package/src/dom/props.ts +6 -6
- package/src/globalContext.ts +2 -2
- package/src/headlessRender.ts +4 -1
- package/src/hooks/onCleanup.ts +3 -1
- package/src/hooks/setup.ts +17 -31
- package/src/hooks/utils.ts +2 -1
- package/src/hydration.ts +1 -1
- package/src/index.ts +1 -1
- package/src/profiling.ts +1 -1
- package/src/reconciler.ts +51 -9
- package/src/resource.ts +119 -45
- package/src/router/client/index.ts +2 -2
- package/src/router/fileRouterController.ts +5 -5
- package/src/router/globals.ts +2 -2
- package/src/router/link.ts +1 -1
- package/src/router/pageConfig.ts +1 -1
- package/src/router/types.internal.ts +2 -2
- package/src/router/types.ts +3 -3
- package/src/router/utils/index.ts +1 -1
- package/src/scheduler.ts +20 -3
- package/src/signals/base.ts +20 -2
- package/src/signals/effect.ts +8 -0
- package/src/signals/tracking.ts +18 -16
- package/src/ssr/client.ts +1 -1
- package/src/types.dom.ts +270 -53
- package/src/types.ts +36 -32
- package/src/types.utils.ts +56 -22
- package/src/utils/vdom.ts +7 -1
package/src/types.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import type { Signal as SignalClass } from "./signals"
|
|
2
|
-
import type {
|
|
3
|
-
|
|
1
|
+
import type { Signal as SignalClass } from "./signals/base.js"
|
|
2
|
+
import type {
|
|
3
|
+
$CONTEXT,
|
|
4
|
+
$ERROR_BOUNDARY,
|
|
5
|
+
$FRAGMENT,
|
|
6
|
+
$INLINE_FN,
|
|
7
|
+
} from "./constants.js"
|
|
8
|
+
import type { KiruGlobalContext } from "./globalContext.js"
|
|
4
9
|
import type {
|
|
5
10
|
GlobalAttributes,
|
|
6
11
|
HtmlElementAttributes,
|
|
@@ -10,14 +15,14 @@ import type {
|
|
|
10
15
|
HtmlElementBindableProps,
|
|
11
16
|
HTMLTagToElement,
|
|
12
17
|
SVGTagToElement,
|
|
13
|
-
} from "./types.dom"
|
|
18
|
+
} from "./types.dom.js"
|
|
14
19
|
import type {
|
|
15
20
|
AsyncTaskState,
|
|
16
21
|
Prettify,
|
|
17
22
|
Signalable,
|
|
18
23
|
SomeDom,
|
|
19
|
-
} from "./types.utils"
|
|
20
|
-
import type { AppHandle } from "./appHandle"
|
|
24
|
+
} from "./types.utils.js"
|
|
25
|
+
import type { AppHandle } from "./appHandle.js"
|
|
21
26
|
|
|
22
27
|
export type { AsyncTaskState, ElementProps, Prettify, Signalable, StyleObject }
|
|
23
28
|
|
|
@@ -131,7 +136,6 @@ declare global {
|
|
|
131
136
|
input: HTMLElementProps<"input">
|
|
132
137
|
ins: HTMLElementProps<"ins">
|
|
133
138
|
kbd: HTMLElementProps<"kbd">
|
|
134
|
-
//keygen: HTMLElementProps<"keygen">
|
|
135
139
|
label: HTMLElementProps<"label">
|
|
136
140
|
legend: HTMLElementProps<"legend">
|
|
137
141
|
li: HTMLElementProps<"li">
|
|
@@ -140,7 +144,6 @@ declare global {
|
|
|
140
144
|
map: HTMLElementProps<"map">
|
|
141
145
|
mark: HTMLElementProps<"mark">
|
|
142
146
|
menu: HTMLElementProps<"menu">
|
|
143
|
-
//menuitem: HTMLElementProps<"menuitem">
|
|
144
147
|
meta: HTMLElementProps<"meta">
|
|
145
148
|
meter: HTMLElementProps<"meter">
|
|
146
149
|
nav: HTMLElementProps<"nav">
|
|
@@ -187,12 +190,11 @@ declare global {
|
|
|
187
190
|
ul: HTMLElementProps<"ul">
|
|
188
191
|
var: HTMLElementProps<"var">
|
|
189
192
|
video: HTMLElementProps<"video">
|
|
190
|
-
|
|
191
|
-
//webview: HTMLElementProps<"webview">
|
|
193
|
+
wbr: HTMLElementProps<"wbr">
|
|
192
194
|
|
|
193
195
|
// SVG
|
|
194
|
-
|
|
195
|
-
|
|
196
|
+
animate: SVGElementProps<"animate">
|
|
197
|
+
animateMotion: SVGElementProps<"animateMotion">
|
|
196
198
|
animateTransform: SVGElementProps<"animateTransform">
|
|
197
199
|
circle: SVGElementProps<"circle">
|
|
198
200
|
clipPath: SVGElementProps<"clipPath">
|
|
@@ -200,11 +202,11 @@ declare global {
|
|
|
200
202
|
desc: SVGElementProps<"desc">
|
|
201
203
|
ellipse: SVGElementProps<"ellipse">
|
|
202
204
|
feBlend: SVGElementProps<"feBlend">
|
|
203
|
-
|
|
205
|
+
feColorMatrix: SVGElementProps<"feColorMatrix">
|
|
204
206
|
feComponentTransfer: SVGElementProps<"feComponentTransfer">
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
207
|
+
feComposite: SVGElementProps<"feComposite">
|
|
208
|
+
feConvolveMatrix: SVGElementProps<"feConvolveMatrix">
|
|
209
|
+
feDiffuseLighting: SVGElementProps<"feDiffuseLighting">
|
|
208
210
|
feDisplacementMap: SVGElementProps<"feDisplacementMap">
|
|
209
211
|
feDropShadow: SVGElementProps<"feDropShadow">
|
|
210
212
|
feFlood: SVGElementProps<"feFlood">
|
|
@@ -213,40 +215,41 @@ declare global {
|
|
|
213
215
|
feFuncG: SVGElementProps<"feFuncG">
|
|
214
216
|
feFuncR: SVGElementProps<"feFuncR">
|
|
215
217
|
feGaussianBlur: SVGElementProps<"feGaussianBlur">
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
218
|
+
feImage: SVGElementProps<"feImage">
|
|
219
|
+
feMerge: SVGElementProps<"feMerge">
|
|
220
|
+
feMergeNode: SVGElementProps<"feMergeNode">
|
|
221
|
+
feMorphology: SVGElementProps<"feMorphology">
|
|
222
|
+
feOffset: SVGElementProps<"feOffset">
|
|
223
|
+
feSpotLight: SVGElementProps<"feSpotLight">
|
|
224
|
+
feSpecularLighting: SVGElementProps<"feSpecularLighting">
|
|
225
|
+
feTile: SVGElementProps<"feTile">
|
|
223
226
|
feTurbulence: SVGElementProps<"feTurbulence">
|
|
224
227
|
filter: SVGElementProps<"filter">
|
|
225
|
-
|
|
228
|
+
foreignObject: SVGElementProps<"foreignObject">
|
|
226
229
|
g: SVGElementProps<"g">
|
|
227
230
|
image: SVGElementProps<"image">
|
|
228
231
|
line: SVGElementProps<"line">
|
|
229
232
|
linearGradient: SVGElementProps<"linearGradient">
|
|
230
|
-
|
|
233
|
+
marker: SVGElementProps<"marker">
|
|
231
234
|
mask: SVGElementProps<"mask">
|
|
232
|
-
|
|
233
|
-
|
|
235
|
+
metadata: SVGElementProps<"metadata">
|
|
236
|
+
mpath: SVGElementProps<"mpath">
|
|
234
237
|
path: SVGElementProps<"path">
|
|
235
238
|
pattern: SVGElementProps<"pattern">
|
|
236
239
|
polygon: SVGElementProps<"polygon">
|
|
237
240
|
polyline: SVGElementProps<"polyline">
|
|
238
241
|
radialGradient: SVGElementProps<"radialGradient">
|
|
239
242
|
rect: SVGElementProps<"rect">
|
|
240
|
-
|
|
243
|
+
set: SVGElementProps<"set">
|
|
241
244
|
stop: SVGElementProps<"stop">
|
|
242
|
-
|
|
243
|
-
|
|
245
|
+
switch: SVGElementProps<"switch">
|
|
246
|
+
symbol: SVGElementProps<"symbol">
|
|
244
247
|
text: SVGElementProps<"text">
|
|
245
248
|
textPath: SVGElementProps<"textPath">
|
|
246
249
|
tspan: SVGElementProps<"tspan">
|
|
247
250
|
svg: SVGElementProps<"svg">
|
|
248
|
-
|
|
249
|
-
|
|
251
|
+
use: SVGElementProps<"use">
|
|
252
|
+
view: SVGElementProps<"view">
|
|
250
253
|
}
|
|
251
254
|
|
|
252
255
|
interface IntrinsicAttributes {
|
|
@@ -332,6 +335,7 @@ declare global {
|
|
|
332
335
|
| typeof $FRAGMENT
|
|
333
336
|
| typeof $CONTEXT
|
|
334
337
|
| typeof $ERROR_BOUNDARY
|
|
338
|
+
| typeof $INLINE_FN
|
|
335
339
|
|
|
336
340
|
interface Element {
|
|
337
341
|
type:
|
package/src/types.utils.ts
CHANGED
|
@@ -1,26 +1,53 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type {
|
|
2
|
+
$CONTEXT,
|
|
3
|
+
$ERROR_BOUNDARY,
|
|
4
|
+
$FRAGMENT,
|
|
5
|
+
$INLINE_FN,
|
|
6
|
+
} from "./constants.js"
|
|
7
|
+
import type { Signal } from "./signals/base.js"
|
|
8
|
+
import type { ErrorBoundaryProps } from "./components/errorBoundary.js"
|
|
4
9
|
|
|
5
|
-
export type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
export type {
|
|
11
|
+
SomeElement,
|
|
12
|
+
SomeDom,
|
|
13
|
+
MaybeElement,
|
|
14
|
+
MaybeDom,
|
|
15
|
+
FunctionVNode,
|
|
16
|
+
ElementVNode,
|
|
17
|
+
DomVNode,
|
|
18
|
+
ContextNode,
|
|
19
|
+
ErrorBoundaryNode,
|
|
20
|
+
FragmentNode,
|
|
21
|
+
InlineFnNode,
|
|
22
|
+
Prettify,
|
|
23
|
+
Signalable,
|
|
24
|
+
AsyncTaskState,
|
|
25
|
+
Guard,
|
|
26
|
+
ArrayHas,
|
|
27
|
+
RecordHas,
|
|
28
|
+
Falsy,
|
|
29
|
+
Truthy,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type SomeElement = HTMLElement | SVGElement
|
|
33
|
+
type SomeDom = HTMLElement | SVGElement | Text
|
|
34
|
+
type MaybeElement = SomeElement | undefined
|
|
35
|
+
type MaybeDom = SomeDom | undefined
|
|
9
36
|
|
|
10
|
-
|
|
37
|
+
interface FunctionVNode extends Kiru.VNode {
|
|
11
38
|
type: (props: Record<string, unknown>) => JSX.Element
|
|
12
39
|
}
|
|
13
40
|
|
|
14
|
-
|
|
41
|
+
interface ElementVNode extends Kiru.VNode {
|
|
15
42
|
dom: SomeElement
|
|
16
43
|
type: string
|
|
17
44
|
}
|
|
18
|
-
|
|
45
|
+
interface DomVNode extends Kiru.VNode {
|
|
19
46
|
dom: SomeDom
|
|
20
47
|
type: "#text" | (string & {})
|
|
21
48
|
}
|
|
22
49
|
|
|
23
|
-
|
|
50
|
+
interface ContextNode<T> extends Kiru.VNode {
|
|
24
51
|
type: typeof $CONTEXT
|
|
25
52
|
props: Kiru.VNode["props"] & {
|
|
26
53
|
value: T
|
|
@@ -28,23 +55,30 @@ export interface ContextNode<T> extends Kiru.VNode {
|
|
|
28
55
|
}
|
|
29
56
|
}
|
|
30
57
|
|
|
31
|
-
|
|
58
|
+
interface ErrorBoundaryNode extends Kiru.VNode {
|
|
32
59
|
type: typeof $ERROR_BOUNDARY
|
|
33
60
|
props: ErrorBoundaryProps
|
|
34
61
|
error?: Error
|
|
35
62
|
}
|
|
36
63
|
|
|
37
|
-
|
|
64
|
+
interface FragmentNode extends Kiru.VNode {
|
|
38
65
|
type: typeof $FRAGMENT
|
|
39
66
|
}
|
|
40
67
|
|
|
41
|
-
|
|
68
|
+
interface InlineFnNode extends Kiru.VNode {
|
|
69
|
+
type: typeof $INLINE_FN
|
|
70
|
+
props: {
|
|
71
|
+
expr: () => JSX.Element
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
type Prettify<T> = {
|
|
42
76
|
[K in keyof T]: T[K]
|
|
43
77
|
} & {}
|
|
44
78
|
|
|
45
|
-
|
|
79
|
+
type Signalable<T> = T | Signal<T>
|
|
46
80
|
|
|
47
|
-
|
|
81
|
+
type AsyncTaskState<T, E extends Error = Error> =
|
|
48
82
|
| {
|
|
49
83
|
data: null
|
|
50
84
|
error: null
|
|
@@ -61,19 +95,19 @@ export type AsyncTaskState<T, E extends Error = Error> =
|
|
|
61
95
|
loading: false
|
|
62
96
|
}
|
|
63
97
|
|
|
64
|
-
|
|
98
|
+
type Guard<T, K extends keyof T> = {
|
|
65
99
|
[P in K]: T[P]
|
|
66
100
|
}
|
|
67
101
|
|
|
68
|
-
|
|
102
|
+
type ArrayHas<T extends any[], U> =
|
|
69
103
|
// does the union of element types intersect U?
|
|
70
104
|
Extract<T[number], U> extends never ? false : true
|
|
71
105
|
|
|
72
|
-
|
|
73
|
-
Extract<T[keyof T], U
|
|
106
|
+
type RecordHas<T extends Record<string, any>, U> = [
|
|
107
|
+
Extract<T[keyof T], U>,
|
|
74
108
|
] extends [never]
|
|
75
109
|
? false
|
|
76
110
|
: true
|
|
77
111
|
|
|
78
|
-
|
|
79
|
-
|
|
112
|
+
type Falsy = false | 0 | 0n | "" | null | undefined
|
|
113
|
+
type Truthy<T> = Exclude<T, Falsy>
|
package/src/utils/vdom.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
FLAG_UPDATE,
|
|
6
6
|
$ERROR_BOUNDARY,
|
|
7
7
|
$CONTEXT,
|
|
8
|
+
$INLINE_FN,
|
|
8
9
|
} from "../constants.js"
|
|
9
10
|
import { createElement } from "../index.js"
|
|
10
11
|
import { KiruError } from "../error.js"
|
|
@@ -70,7 +71,12 @@ function isValidTextChild(thing: unknown): thing is string | number | bigint {
|
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
function isExoticType(type: Kiru.VNode["type"]): type is Kiru.ExoticSymbol {
|
|
73
|
-
return
|
|
74
|
+
return (
|
|
75
|
+
type === $FRAGMENT ||
|
|
76
|
+
type === $CONTEXT ||
|
|
77
|
+
type === $ERROR_BOUNDARY ||
|
|
78
|
+
type === $INLINE_FN
|
|
79
|
+
)
|
|
74
80
|
}
|
|
75
81
|
|
|
76
82
|
function isFragment(
|