kiru 0.44.4 → 0.45.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/LICENSE +1 -1
- package/README.md +3 -3
- package/dist/appContext.d.ts +38 -0
- package/dist/appContext.d.ts.map +1 -0
- package/dist/appContext.js +143 -0
- package/dist/appContext.js.map +1 -0
- package/dist/cloneVNode.d.ts +2 -0
- package/dist/cloneVNode.d.ts.map +1 -0
- package/dist/cloneVNode.js +14 -0
- package/dist/cloneVNode.js.map +1 -0
- package/dist/constants.d.ts +31 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +127 -0
- package/dist/constants.js.map +1 -0
- package/dist/context.d.ts +3 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +50 -0
- package/dist/context.js.map +1 -0
- package/dist/dom.d.ts +8 -0
- package/dist/dom.d.ts.map +1 -0
- package/dist/dom.js +582 -0
- package/dist/dom.js.map +1 -0
- package/dist/element.d.ts +6 -0
- package/dist/element.d.ts.map +1 -0
- package/dist/element.js +41 -0
- package/dist/element.js.map +1 -0
- package/dist/env.d.ts +2 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +6 -0
- package/dist/env.js.map +1 -0
- package/dist/error.d.ts +19 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +63 -0
- package/dist/error.js.map +1 -0
- package/dist/flags.d.ts +6 -0
- package/dist/flags.d.ts.map +1 -0
- package/dist/flags.js +16 -0
- package/dist/flags.js.map +1 -0
- package/dist/form/index.d.ts +4 -0
- package/dist/form/index.d.ts.map +1 -0
- package/dist/form/index.js +509 -0
- package/dist/form/index.js.map +1 -0
- package/dist/form/types.d.ts +121 -0
- package/dist/form/types.d.ts.map +1 -0
- package/dist/form/types.js +2 -0
- package/dist/form/types.js.map +1 -0
- package/dist/form/utils.d.ts +3 -0
- package/dist/form/utils.d.ts.map +1 -0
- package/dist/form/utils.js +16 -0
- package/dist/form/utils.js.map +1 -0
- package/dist/generateId.d.ts +8 -0
- package/dist/generateId.d.ts.map +1 -0
- package/dist/generateId.js +15 -0
- package/dist/generateId.js.map +1 -0
- package/dist/globalContext.d.ts +37 -0
- package/dist/globalContext.d.ts.map +1 -0
- package/dist/globalContext.js +85 -0
- package/dist/globalContext.js.map +1 -0
- package/dist/globals.d.ts +16 -0
- package/dist/globals.d.ts.map +1 -0
- package/dist/globals.js +15 -0
- package/dist/globals.js.map +1 -0
- package/dist/hmr.d.ts +32 -0
- package/dist/hmr.d.ts.map +1 -0
- package/dist/hmr.js +125 -0
- package/dist/hmr.js.map +1 -0
- package/dist/hooks/index.d.ts +15 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +15 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useAsync.d.ts +29 -0
- package/dist/hooks/useAsync.d.ts.map +1 -0
- package/dist/hooks/useAsync.js +96 -0
- package/dist/hooks/useAsync.js.map +1 -0
- package/dist/hooks/useCallback.d.ts +7 -0
- package/dist/hooks/useCallback.d.ts.map +1 -0
- package/dist/hooks/useCallback.js +29 -0
- package/dist/hooks/useCallback.js.map +1 -0
- package/dist/hooks/useContext.d.ts +7 -0
- package/dist/hooks/useContext.d.ts.map +1 -0
- package/dist/hooks/useContext.js +59 -0
- package/dist/hooks/useContext.js.map +1 -0
- package/dist/hooks/useEffect.d.ts +8 -0
- package/dist/hooks/useEffect.d.ts.map +1 -0
- package/dist/hooks/useEffect.js +33 -0
- package/dist/hooks/useEffect.js.map +1 -0
- package/dist/hooks/useEffectEvent.d.ts +8 -0
- package/dist/hooks/useEffectEvent.d.ts.map +1 -0
- package/dist/hooks/useEffectEvent.js +22 -0
- package/dist/hooks/useEffectEvent.js.map +1 -0
- package/dist/hooks/useId.d.ts +8 -0
- package/dist/hooks/useId.d.ts.map +1 -0
- package/dist/hooks/useId.js +35 -0
- package/dist/hooks/useId.js.map +1 -0
- package/dist/hooks/useLayoutEffect.d.ts +8 -0
- package/dist/hooks/useLayoutEffect.d.ts.map +1 -0
- package/dist/hooks/useLayoutEffect.js +33 -0
- package/dist/hooks/useLayoutEffect.js.map +1 -0
- package/dist/hooks/useMemo.d.ts +8 -0
- package/dist/hooks/useMemo.d.ts.map +1 -0
- package/dist/hooks/useMemo.js +30 -0
- package/dist/hooks/useMemo.js.map +1 -0
- package/dist/hooks/useReducer.d.ts +7 -0
- package/dist/hooks/useReducer.d.ts.map +1 -0
- package/dist/hooks/useReducer.js +44 -0
- package/dist/hooks/useReducer.js.map +1 -0
- package/dist/hooks/useRef.d.ts +10 -0
- package/dist/hooks/useRef.d.ts.map +1 -0
- package/dist/hooks/useRef.js +28 -0
- package/dist/hooks/useRef.js.map +1 -0
- package/dist/hooks/useState.d.ts +7 -0
- package/dist/hooks/useState.d.ts.map +1 -0
- package/dist/hooks/useState.js +54 -0
- package/dist/hooks/useState.js.map +1 -0
- package/dist/hooks/useSyncExternalStore.d.ts +8 -0
- package/dist/hooks/useSyncExternalStore.d.ts.map +1 -0
- package/dist/hooks/useSyncExternalStore.js +50 -0
- package/dist/hooks/useSyncExternalStore.js.map +1 -0
- package/dist/hooks/useViewTransition.d.ts +10 -0
- package/dist/hooks/useViewTransition.d.ts.map +1 -0
- package/dist/hooks/useViewTransition.js +28 -0
- package/dist/hooks/useViewTransition.js.map +1 -0
- package/dist/hooks/utils.d.ts +69 -0
- package/dist/hooks/utils.d.ts.map +1 -0
- package/dist/hooks/utils.js +163 -0
- package/dist/hooks/utils.js.map +1 -0
- package/dist/hydration.d.ts +17 -0
- package/dist/hydration.d.ts.map +1 -0
- package/dist/hydration.js +59 -0
- package/dist/hydration.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx.d.ts +6 -0
- package/dist/jsx.d.ts.map +1 -0
- package/dist/jsx.js +8 -0
- package/dist/jsx.js.map +1 -0
- package/dist/lazy.d.ts +11 -0
- package/dist/lazy.d.ts.map +1 -0
- package/dist/lazy.js +177 -0
- package/dist/lazy.js.map +1 -0
- package/dist/memo.d.ts +9 -0
- package/dist/memo.d.ts.map +1 -0
- package/dist/memo.js +25 -0
- package/dist/memo.js.map +1 -0
- package/dist/portal.d.ts +10 -0
- package/dist/portal.d.ts.map +1 -0
- package/dist/portal.js +34 -0
- package/dist/portal.js.map +1 -0
- package/dist/profiling.d.ts +26 -0
- package/dist/profiling.d.ts.map +1 -0
- package/dist/profiling.js +83 -0
- package/dist/profiling.js.map +1 -0
- package/dist/props.d.ts +4 -0
- package/dist/props.d.ts.map +1 -0
- package/dist/props.js +27 -0
- package/dist/props.js.map +1 -0
- package/dist/reconciler.d.ts +4 -0
- package/dist/reconciler.d.ts.map +1 -0
- package/dist/reconciler.js +466 -0
- package/dist/reconciler.js.map +1 -0
- package/dist/renderToString.d.ts +2 -0
- package/dist/renderToString.d.ts.map +1 -0
- package/dist/renderToString.js +74 -0
- package/dist/renderToString.js.map +1 -0
- package/dist/router/index.d.ts +3 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/index.js +3 -0
- package/dist/router/index.js.map +1 -0
- package/dist/router/route.d.ts +46 -0
- package/dist/router/route.d.ts.map +1 -0
- package/dist/router/route.js +8 -0
- package/dist/router/route.js.map +1 -0
- package/dist/router/router.d.ts +62 -0
- package/dist/router/router.d.ts.map +1 -0
- package/dist/router/router.js +178 -0
- package/dist/router/router.js.map +1 -0
- package/dist/router/routerUtils.d.ts +5 -0
- package/dist/router/routerUtils.d.ts.map +1 -0
- package/dist/router/routerUtils.js +39 -0
- package/dist/router/routerUtils.js.map +1 -0
- package/dist/scheduler.d.ts +14 -0
- package/dist/scheduler.d.ts.map +1 -0
- package/dist/scheduler.js +457 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/signals/base.d.ts +36 -0
- package/dist/signals/base.d.ts.map +1 -0
- package/dist/signals/base.js +205 -0
- package/dist/signals/base.js.map +1 -0
- package/dist/signals/computed.d.ts +16 -0
- package/dist/signals/computed.d.ts.map +1 -0
- package/dist/signals/computed.js +116 -0
- package/dist/signals/computed.js.map +1 -0
- package/dist/signals/effect.d.ts +18 -0
- package/dist/signals/effect.d.ts.map +1 -0
- package/dist/signals/effect.js +43 -0
- package/dist/signals/effect.js.map +1 -0
- package/dist/signals/globals.d.ts +9 -0
- package/dist/signals/globals.d.ts.map +1 -0
- package/dist/signals/globals.js +9 -0
- package/dist/signals/globals.js.map +1 -0
- package/dist/signals/index.d.ts +12 -0
- package/dist/signals/index.d.ts.map +1 -0
- package/dist/signals/index.js +12 -0
- package/dist/signals/index.js.map +1 -0
- package/dist/signals/jsx.d.ts +16 -0
- package/dist/signals/jsx.d.ts.map +1 -0
- package/dist/signals/jsx.js +11 -0
- package/dist/signals/jsx.js.map +1 -0
- package/dist/signals/types.d.ts +9 -0
- package/dist/signals/types.d.ts.map +1 -0
- package/dist/signals/types.js +2 -0
- package/dist/signals/types.js.map +1 -0
- package/dist/signals/utils.d.ts +4 -0
- package/dist/signals/utils.d.ts.map +1 -0
- package/dist/signals/utils.js +12 -0
- package/dist/signals/utils.js.map +1 -0
- package/dist/signals/watch.d.ts +24 -0
- package/dist/signals/watch.d.ts.map +1 -0
- package/dist/signals/watch.js +104 -0
- package/dist/signals/watch.js.map +1 -0
- package/dist/ssr/client.d.ts +4 -0
- package/dist/ssr/client.d.ts.map +1 -0
- package/dist/ssr/client.js +12 -0
- package/dist/ssr/client.js.map +1 -0
- package/dist/ssr/hydrationBoundary.d.ts +27 -0
- package/dist/ssr/hydrationBoundary.d.ts.map +1 -0
- package/dist/ssr/hydrationBoundary.js +30 -0
- package/dist/ssr/hydrationBoundary.js.map +1 -0
- package/dist/ssr/index.d.ts +2 -0
- package/dist/ssr/index.d.ts.map +1 -0
- package/dist/ssr/index.js +2 -0
- package/dist/ssr/index.js.map +1 -0
- package/dist/ssr/server.d.ts +3 -0
- package/dist/ssr/server.d.ts.map +1 -0
- package/dist/ssr/server.js +101 -0
- package/dist/ssr/server.js.map +1 -0
- package/dist/store.d.ts +28 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +166 -0
- package/dist/store.js.map +1 -0
- package/dist/swr.d.ts +74 -0
- package/dist/swr.d.ts.map +1 -0
- package/dist/swr.js +228 -0
- package/dist/swr.js.map +1 -0
- package/dist/transition.d.ts +18 -0
- package/dist/transition.d.ts.map +1 -0
- package/dist/transition.js +48 -0
- package/dist/transition.js.map +1 -0
- package/dist/types.d.ts +143 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.dom.d.ts +920 -0
- package/dist/types.dom.d.ts.map +1 -0
- package/dist/types.dom.js +2 -0
- package/dist/types.dom.js.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/types.utils.d.ts +41 -0
- package/dist/types.utils.d.ts.map +1 -0
- package/dist/types.utils.js +2 -0
- package/dist/types.utils.js.map +1 -0
- package/dist/utils.d.ts +61 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +478 -0
- package/dist/utils.js.map +1 -0
- package/dist/warning.d.ts +2 -0
- package/dist/warning.d.ts.map +1 -0
- package/dist/warning.js +4 -0
- package/dist/warning.js.map +1 -0
- package/package.json +2 -2
- package/src/appContext.ts +7 -7
- package/src/cloneVNode.ts +1 -1
- package/src/constants.ts +9 -9
- package/src/context.ts +7 -7
- package/src/dom.ts +13 -15
- package/src/element.ts +4 -4
- package/src/error.ts +11 -13
- package/src/globalContext.ts +6 -10
- package/src/globals.ts +3 -3
- package/src/hmr.ts +4 -4
- package/src/hooks/useAsync.ts +2 -2
- package/src/hooks/useCallback.ts +1 -1
- package/src/hooks/useContext.ts +6 -6
- package/src/hooks/useEffect.ts +2 -2
- package/src/hooks/useEffectEvent.ts +1 -1
- package/src/hooks/useId.ts +2 -2
- package/src/hooks/useLayoutEffect.ts +2 -2
- package/src/hooks/useMemo.ts +2 -2
- package/src/hooks/useReducer.ts +2 -2
- package/src/hooks/useRef.ts +5 -5
- package/src/hooks/useState.ts +5 -5
- package/src/hooks/useSyncExternalStore.ts +3 -3
- package/src/hooks/useViewTransition.ts +1 -1
- package/src/hooks/utils.ts +7 -9
- package/src/index.ts +4 -4
- package/src/jsx.ts +2 -2
- package/src/lazy.ts +15 -17
- package/src/memo.ts +2 -2
- package/src/portal.ts +4 -4
- package/src/props.ts +5 -7
- package/src/reconciler.ts +6 -6
- package/src/renderToString.ts +1 -1
- package/src/router/route.ts +1 -1
- package/src/router/router.ts +6 -6
- package/src/scheduler.ts +16 -16
- package/src/signals/base.ts +1 -1
- package/src/signals/types.ts +1 -1
- package/src/signals/watch.ts +2 -2
- package/src/ssr/hydrationBoundary.ts +1 -1
- package/src/ssr/server.ts +1 -1
- package/src/store.ts +7 -7
- package/src/swr.ts +2 -2
- package/src/types.dom.ts +1 -1
- package/src/types.ts +13 -13
- package/src/types.utils.ts +5 -5
- package/src/utils.ts +9 -12
- package/src/warning.ts +1 -1
package/src/lazy.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createElement } from "./element.js"
|
|
2
2
|
import { __DEV__ } from "./env.js"
|
|
3
|
-
import {
|
|
3
|
+
import { KiruError } from "./error.js"
|
|
4
4
|
import { node, renderMode } from "./globals.js"
|
|
5
5
|
import { useContext } from "./hooks/useContext.js"
|
|
6
6
|
import { useRef } from "./hooks/useRef.js"
|
|
@@ -13,16 +13,16 @@ import {
|
|
|
13
13
|
import type { SomeDom } from "./types.utils"
|
|
14
14
|
import { noop } from "./utils.js"
|
|
15
15
|
|
|
16
|
-
type FCModule = { default:
|
|
17
|
-
type LazyImportValue =
|
|
16
|
+
type FCModule = { default: Kiru.FC<any> }
|
|
17
|
+
type LazyImportValue = Kiru.FC<any> | FCModule
|
|
18
18
|
type InferLazyImportProps<T extends LazyImportValue> = T extends FCModule
|
|
19
|
-
?
|
|
20
|
-
:
|
|
19
|
+
? Kiru.InferProps<T["default"]>
|
|
20
|
+
: Kiru.InferProps<T>
|
|
21
21
|
|
|
22
22
|
type LazyState = {
|
|
23
23
|
fn: string
|
|
24
24
|
promise: Promise<LazyImportValue>
|
|
25
|
-
result:
|
|
25
|
+
result: Kiru.FC | null
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
type LazyComponentProps<T extends LazyImportValue> = InferLazyImportProps<T> & {
|
|
@@ -32,10 +32,10 @@ type LazyComponentProps<T extends LazyImportValue> = InferLazyImportProps<T> & {
|
|
|
32
32
|
const lazyCache: Map<string, LazyState> =
|
|
33
33
|
"window" in globalThis
|
|
34
34
|
? // @ts-ignore - we're shamefully polluting the global scope here and hiding it 🥲
|
|
35
|
-
(window.
|
|
35
|
+
(window.__KIRU_LAZY_CACHE ??= new Map<string, LazyState>())
|
|
36
36
|
: new Map<string, LazyState>()
|
|
37
37
|
|
|
38
|
-
function consumeHydrationBoundaryChildren(parentNode:
|
|
38
|
+
function consumeHydrationBoundaryChildren(parentNode: Kiru.VNode): {
|
|
39
39
|
parent: HTMLElement
|
|
40
40
|
childNodes: Node[]
|
|
41
41
|
startIndex: number
|
|
@@ -45,9 +45,8 @@ function consumeHydrationBoundaryChildren(parentNode: Kaioken.VNode): {
|
|
|
45
45
|
boundaryStart?.nodeType !== Node.COMMENT_NODE ||
|
|
46
46
|
boundaryStart.nodeValue !== HYDRATION_BOUNDARY_MARKER
|
|
47
47
|
) {
|
|
48
|
-
throw new
|
|
49
|
-
message:
|
|
50
|
-
"Invalid HydrationBoundary node. This is likely a bug in Kaioken.",
|
|
48
|
+
throw new KiruError({
|
|
49
|
+
message: "Invalid HydrationBoundary node. This is likely a bug in Kiru.",
|
|
51
50
|
fatal: true,
|
|
52
51
|
vNode: parentNode,
|
|
53
52
|
})
|
|
@@ -71,9 +70,8 @@ function consumeHydrationBoundaryChildren(parentNode: Kaioken.VNode): {
|
|
|
71
70
|
}
|
|
72
71
|
const boundaryEnd = hydrationStack.currentChild()
|
|
73
72
|
if (!isBoundaryEnd(boundaryEnd)) {
|
|
74
|
-
throw new
|
|
75
|
-
message:
|
|
76
|
-
"Invalid HydrationBoundary node. This is likely a bug in Kaioken.",
|
|
73
|
+
throw new KiruError({
|
|
74
|
+
message: "Invalid HydrationBoundary node. This is likely a bug in Kiru.",
|
|
77
75
|
fatal: true,
|
|
78
76
|
vNode: parentNode,
|
|
79
77
|
})
|
|
@@ -84,7 +82,7 @@ function consumeHydrationBoundaryChildren(parentNode: Kaioken.VNode): {
|
|
|
84
82
|
|
|
85
83
|
export function lazy<T extends LazyImportValue>(
|
|
86
84
|
componentPromiseFn: () => Promise<T>
|
|
87
|
-
):
|
|
85
|
+
): Kiru.FC<LazyComponentProps<T>> {
|
|
88
86
|
function LazyComponent(props: LazyComponentProps<T>) {
|
|
89
87
|
const { fallback = null, ...rest } = props
|
|
90
88
|
const appCtx = useAppContext()
|
|
@@ -136,7 +134,7 @@ export function lazy<T extends LazyImportValue>(
|
|
|
136
134
|
}
|
|
137
135
|
|
|
138
136
|
if (__DEV__) {
|
|
139
|
-
window.
|
|
137
|
+
window.__kiru?.HMRContext?.onHmr(() => {
|
|
140
138
|
if (needsHydration.current) {
|
|
141
139
|
abortHydration.current()
|
|
142
140
|
}
|
|
@@ -222,7 +220,7 @@ export function lazy<T extends LazyImportValue>(
|
|
|
222
220
|
}
|
|
223
221
|
return createElement(cachedState.result, rest)
|
|
224
222
|
}
|
|
225
|
-
LazyComponent.displayName = "
|
|
223
|
+
LazyComponent.displayName = "Kiru.lazy"
|
|
226
224
|
return LazyComponent
|
|
227
225
|
}
|
|
228
226
|
|
package/src/memo.ts
CHANGED
|
@@ -25,7 +25,7 @@ export type MemoFn = Function & {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export function memo<T extends Record<string, unknown> = {}>(
|
|
28
|
-
fn:
|
|
28
|
+
fn: Kiru.FC<T>,
|
|
29
29
|
arePropsEqual: (prevProps: T, nextProps: T) => boolean = _arePropsEqual
|
|
30
30
|
): (props: T) => JSX.Element {
|
|
31
31
|
return Object.assign(
|
|
@@ -34,7 +34,7 @@ export function memo<T extends Record<string, unknown> = {}>(
|
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
[$MEMO]: { arePropsEqual },
|
|
37
|
-
displayName: "
|
|
37
|
+
displayName: "Kiru.memo",
|
|
38
38
|
}
|
|
39
39
|
)
|
|
40
40
|
}
|
package/src/portal.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __DEV__ } from "./env.js"
|
|
2
|
-
import {
|
|
2
|
+
import { KiruError } from "./error.js"
|
|
3
3
|
import { renderMode } from "./globals.js"
|
|
4
4
|
import { useVNode } from "./hooks/utils.js"
|
|
5
5
|
import { getVNodeAppContext } from "./utils.js"
|
|
@@ -18,7 +18,7 @@ function Portal({ children, container }: PortalProps) {
|
|
|
18
18
|
vNode.dom = typeof container === "function" ? container() : container
|
|
19
19
|
if (!(vNode.dom instanceof HTMLElement)) {
|
|
20
20
|
if (__DEV__) {
|
|
21
|
-
throw new
|
|
21
|
+
throw new KiruError({
|
|
22
22
|
message: `Invalid portal container, expected HTMLElement, got ${vNode.dom}`,
|
|
23
23
|
vNode: vNode,
|
|
24
24
|
})
|
|
@@ -37,7 +37,7 @@ function Portal({ children, container }: PortalProps) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
function isPortal(
|
|
40
|
-
node:
|
|
41
|
-
): node is
|
|
40
|
+
node: Kiru.VNode
|
|
41
|
+
): node is Kiru.VNode & { type: typeof Portal } {
|
|
42
42
|
return node.type === Portal
|
|
43
43
|
}
|
package/src/props.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { KiruError } from "./error.js"
|
|
2
2
|
import { Signal } from "./signals/base.js"
|
|
3
3
|
|
|
4
|
-
export function assertValidElementProps(vNode:
|
|
4
|
+
export function assertValidElementProps(vNode: Kiru.VNode) {
|
|
5
5
|
if ("children" in vNode.props && vNode.props.innerHTML) {
|
|
6
|
-
throw new
|
|
6
|
+
throw new KiruError({
|
|
7
7
|
message: "Cannot use both children and innerHTML on an element",
|
|
8
8
|
vNode,
|
|
9
9
|
})
|
|
@@ -11,7 +11,7 @@ export function assertValidElementProps(vNode: Kaioken.VNode) {
|
|
|
11
11
|
|
|
12
12
|
for (const key in vNode.props) {
|
|
13
13
|
if ("bind:" + key in vNode.props) {
|
|
14
|
-
throw new
|
|
14
|
+
throw new KiruError({
|
|
15
15
|
message: `Cannot use both bind:${key} and ${key} on an element`,
|
|
16
16
|
vNode,
|
|
17
17
|
})
|
|
@@ -25,9 +25,7 @@ export function isValidElementKeyProp(
|
|
|
25
25
|
return typeof thing === "string" || typeof thing === "number"
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export function isValidElementRefProp(
|
|
29
|
-
thing: unknown
|
|
30
|
-
): thing is Kaioken.Ref<any> {
|
|
28
|
+
export function isValidElementRefProp(thing: unknown): thing is Kiru.Ref<any> {
|
|
31
29
|
return (
|
|
32
30
|
typeof thing === "function" ||
|
|
33
31
|
(typeof thing === "object" && !!thing && "current" in thing) ||
|
package/src/reconciler.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { createElement, Fragment } from "./element.js"
|
|
|
6
6
|
import { flags } from "./flags.js"
|
|
7
7
|
import { ctx } from "./globals.js"
|
|
8
8
|
|
|
9
|
-
type VNode =
|
|
9
|
+
type VNode = Kiru.VNode
|
|
10
10
|
|
|
11
11
|
export function reconcileChildren(parent: VNode, children: unknown) {
|
|
12
12
|
if (Array.isArray(children)) {
|
|
@@ -428,7 +428,7 @@ function updateFromMap(
|
|
|
428
428
|
return null
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
-
function setParent(child:
|
|
431
|
+
function setParent(child: Kiru.VNode, parent: Kiru.VNode) {
|
|
432
432
|
child.parent = parent
|
|
433
433
|
child.depth = parent.depth + 1
|
|
434
434
|
if (parent.isMemoized || flags.get(parent.flags, FLAG.HAS_MEMO_ANCESTOR)) {
|
|
@@ -438,15 +438,15 @@ function setParent(child: Kaioken.VNode, parent: Kaioken.VNode) {
|
|
|
438
438
|
|
|
439
439
|
function emitUpdateNode() {
|
|
440
440
|
if (!("window" in globalThis)) return
|
|
441
|
-
window.
|
|
441
|
+
window.__kiru?.profilingContext?.emit("updateNode", ctx.current)
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
function emitCreateNode() {
|
|
445
445
|
if (!("window" in globalThis)) return
|
|
446
|
-
window.
|
|
446
|
+
window.__kiru?.profilingContext?.emit("createNode", ctx.current)
|
|
447
447
|
}
|
|
448
448
|
|
|
449
|
-
const $LIST_CHILD = Symbol("
|
|
449
|
+
const $LIST_CHILD = Symbol("kiru:marked-list-child")
|
|
450
450
|
function markListChild(children: unknown[]) {
|
|
451
451
|
Object.assign(children, { [$LIST_CHILD]: true })
|
|
452
452
|
}
|
|
@@ -510,7 +510,7 @@ function checkForMissingKeys(parent: VNode, children: unknown[]) {
|
|
|
510
510
|
}
|
|
511
511
|
|
|
512
512
|
function keyWarning(str: string) {
|
|
513
|
-
const formatted = `[
|
|
513
|
+
const formatted = `[kiru]: ${str}. See https://kirujs.dev/keys-warning for more information.`
|
|
514
514
|
console.error(formatted)
|
|
515
515
|
}
|
|
516
516
|
|
package/src/renderToString.ts
CHANGED
package/src/router/route.ts
CHANGED
package/src/router/router.ts
CHANGED
|
@@ -67,7 +67,7 @@ export function Link({ to, onclick, replace, inherit, ...props }: LinkProps) {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
type RouterCtx = {
|
|
70
|
-
viewTransition:
|
|
70
|
+
viewTransition: Kiru.RefObject<ViewTransition>
|
|
71
71
|
queueSyncNav: (callback: () => void) => void
|
|
72
72
|
params: Record<string, string>
|
|
73
73
|
query: Record<string, string>
|
|
@@ -95,7 +95,7 @@ function setQuery(query: Record<string, string>) {
|
|
|
95
95
|
/**
|
|
96
96
|
* Gets state and methods provided by a parent <Router>.
|
|
97
97
|
*
|
|
98
|
-
* @see https://
|
|
98
|
+
* @see https://kirujs.dev/docs/api/routing
|
|
99
99
|
*/
|
|
100
100
|
export function useRouter() {
|
|
101
101
|
const { viewTransition, params, query } = useContext(RouterContext)
|
|
@@ -152,7 +152,7 @@ const initLoc = () => ({
|
|
|
152
152
|
/**
|
|
153
153
|
* Main router component.
|
|
154
154
|
*
|
|
155
|
-
* @see https://
|
|
155
|
+
* @see https://kirujs.dev/docs/api/routing
|
|
156
156
|
*/
|
|
157
157
|
export function Router(props: RouterProps) {
|
|
158
158
|
const appCtx = useAppContext()
|
|
@@ -205,8 +205,8 @@ export function Router(props: RouterProps) {
|
|
|
205
205
|
}
|
|
206
206
|
})
|
|
207
207
|
|
|
208
|
-
type RouteComponent =
|
|
209
|
-
props:
|
|
208
|
+
type RouteComponent = Kiru.VNode & {
|
|
209
|
+
props: Kiru.InferProps<typeof Route>
|
|
210
210
|
}
|
|
211
211
|
let fallbackRoute: RouteComponent | undefined
|
|
212
212
|
let route: RouteComponent | undefined
|
|
@@ -221,7 +221,7 @@ export function Router(props: RouterProps) {
|
|
|
221
221
|
if (__DEV__) {
|
|
222
222
|
if (fallbackRoute) {
|
|
223
223
|
console.warn(
|
|
224
|
-
"[
|
|
224
|
+
"[kiru]: More than one fallback route defined. Only the last one will be used."
|
|
225
225
|
)
|
|
226
226
|
}
|
|
227
227
|
}
|
package/src/scheduler.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./constants.js"
|
|
13
13
|
import { commitWork, createDom, hydrateDom } from "./dom.js"
|
|
14
14
|
import { __DEV__ } from "./env.js"
|
|
15
|
-
import {
|
|
15
|
+
import { KiruError } from "./error.js"
|
|
16
16
|
import { ctx, hookIndex, node, nodeToCtxMap, renderMode } from "./globals.js"
|
|
17
17
|
import { hydrationStack } from "./hydration.js"
|
|
18
18
|
import { assertValidElementProps } from "./props.js"
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from "./utils.js"
|
|
27
27
|
import { Signal } from "./signals/base.js"
|
|
28
28
|
|
|
29
|
-
type VNode =
|
|
29
|
+
type VNode = Kiru.VNode
|
|
30
30
|
|
|
31
31
|
export interface Scheduler {
|
|
32
32
|
clear(): void
|
|
@@ -122,7 +122,7 @@ export function createScheduler(
|
|
|
122
122
|
// If this node is currently being rendered, just mark it dirty
|
|
123
123
|
if (node.current === vNode) {
|
|
124
124
|
if (__DEV__) {
|
|
125
|
-
window.
|
|
125
|
+
window.__kiru?.profilingContext?.emit("updateDirtied", appCtx)
|
|
126
126
|
}
|
|
127
127
|
isRenderDirtied = true
|
|
128
128
|
return
|
|
@@ -234,7 +234,7 @@ export function createScheduler(
|
|
|
234
234
|
|
|
235
235
|
function workLoop(deadline?: IdleDeadline): void {
|
|
236
236
|
if (__DEV__) {
|
|
237
|
-
window.
|
|
237
|
+
window.__kiru?.profilingContext?.beginTick(appCtx)
|
|
238
238
|
}
|
|
239
239
|
ctx.current = appCtx
|
|
240
240
|
while (nextUnitOfWork) {
|
|
@@ -267,17 +267,17 @@ export function createScheduler(
|
|
|
267
267
|
immediateEffectDirtiedRender = false
|
|
268
268
|
consecutiveDirtyCount++
|
|
269
269
|
if (__DEV__) {
|
|
270
|
-
window.
|
|
271
|
-
window.
|
|
270
|
+
window.__kiru?.profilingContext?.endTick(appCtx)
|
|
271
|
+
window.__kiru?.profilingContext?.emit("updateDirtied", appCtx)
|
|
272
272
|
}
|
|
273
273
|
return workLoop()
|
|
274
274
|
}
|
|
275
275
|
consecutiveDirtyCount = 0
|
|
276
276
|
|
|
277
277
|
flushEffects(effectCallbacks.post)
|
|
278
|
-
window.
|
|
278
|
+
window.__kiru!.emit("update", appCtx)
|
|
279
279
|
if (__DEV__) {
|
|
280
|
-
window.
|
|
280
|
+
window.__kiru?.profilingContext?.emit("update", appCtx)
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
|
|
@@ -287,7 +287,7 @@ export function createScheduler(
|
|
|
287
287
|
nextIdleEffects.shift()!(scheduler)
|
|
288
288
|
}
|
|
289
289
|
if (__DEV__) {
|
|
290
|
-
window.
|
|
290
|
+
window.__kiru?.profilingContext?.endTick(appCtx)
|
|
291
291
|
}
|
|
292
292
|
return
|
|
293
293
|
}
|
|
@@ -362,12 +362,12 @@ export function createScheduler(
|
|
|
362
362
|
renderChild = updateFunctionComponent(vNode as FunctionVNode)
|
|
363
363
|
}
|
|
364
364
|
} catch (error) {
|
|
365
|
-
window.
|
|
365
|
+
window.__kiru?.emit(
|
|
366
366
|
"error",
|
|
367
367
|
appCtx,
|
|
368
368
|
error instanceof Error ? error : new Error(String(error))
|
|
369
369
|
)
|
|
370
|
-
if (
|
|
370
|
+
if (KiruError.isKiruError(error)) {
|
|
371
371
|
if (error.customNodeStack) {
|
|
372
372
|
setTimeout(() => {
|
|
373
373
|
throw new Error(error.customNodeStack)
|
|
@@ -452,9 +452,9 @@ export function createScheduler(
|
|
|
452
452
|
newChild = latest(type)(props)
|
|
453
453
|
delete vNode.hmrUpdated
|
|
454
454
|
if (++renderTryCount > CONSECUTIVE_DIRTY_LIMIT) {
|
|
455
|
-
throw new
|
|
455
|
+
throw new KiruError({
|
|
456
456
|
message:
|
|
457
|
-
"Too many re-renders.
|
|
457
|
+
"Too many re-renders. Kiru limits the number of renders to prevent an infinite loop.",
|
|
458
458
|
fatal: true,
|
|
459
459
|
vNode,
|
|
460
460
|
})
|
|
@@ -484,7 +484,7 @@ export function createScheduler(
|
|
|
484
484
|
}
|
|
485
485
|
if (__DEV__) {
|
|
486
486
|
// @ts-expect-error we apply vNode to the dom node
|
|
487
|
-
vNode.dom.
|
|
487
|
+
vNode.dom.__kiruNode = vNode
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
490
|
// text should _never_ have children
|
|
@@ -500,8 +500,8 @@ export function createScheduler(
|
|
|
500
500
|
|
|
501
501
|
function checkForTooManyConsecutiveDirtyRenders() {
|
|
502
502
|
if (consecutiveDirtyCount > CONSECUTIVE_DIRTY_LIMIT) {
|
|
503
|
-
throw new
|
|
504
|
-
"Maximum update depth exceeded. This can happen when a component repeatedly calls setState during render or in useLayoutEffect.
|
|
503
|
+
throw new KiruError(
|
|
504
|
+
"Maximum update depth exceeded. This can happen when a component repeatedly calls setState during render or in useLayoutEffect. Kiru limits the number of nested updates to prevent infinite loops."
|
|
505
505
|
)
|
|
506
506
|
}
|
|
507
507
|
}
|
package/src/signals/base.ts
CHANGED
|
@@ -111,7 +111,7 @@ export class Signal<T> {
|
|
|
111
111
|
return () => signalSubsMap.get(this.$id)?.delete(cb)
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
notify(options?: { filter?: (sub: Function |
|
|
114
|
+
notify(options?: { filter?: (sub: Function | Kiru.VNode) => boolean }) {
|
|
115
115
|
signalSubsMap.get(this.$id)?.forEach((sub) => {
|
|
116
116
|
if (options?.filter && !options.filter(sub)) return
|
|
117
117
|
if (typeof sub === "function") {
|
package/src/signals/types.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type Signal } from "./base"
|
|
|
3
3
|
export type ReadonlySignal<T> = Signal<T> & {
|
|
4
4
|
readonly value: T
|
|
5
5
|
}
|
|
6
|
-
export type SignalSubscriber =
|
|
6
|
+
export type SignalSubscriber = Kiru.VNode | Function
|
|
7
7
|
|
|
8
8
|
export type SignalValues<T extends readonly Signal<unknown>[]> = {
|
|
9
9
|
[I in keyof T]: T[I] extends Signal<infer V> ? V : never
|
package/src/signals/watch.ts
CHANGED
|
@@ -42,7 +42,7 @@ export class WatchEffect<const Deps extends readonly Signal<unknown>[] = []> {
|
|
|
42
42
|
},
|
|
43
43
|
}
|
|
44
44
|
if ("window" in globalThis) {
|
|
45
|
-
const signals = window.
|
|
45
|
+
const signals = window.__kiru!.HMRContext!.signals
|
|
46
46
|
if (signals.isWaitingForNextWatchCall()) {
|
|
47
47
|
signals.pushWatch(this as WatchEffect)
|
|
48
48
|
}
|
|
@@ -62,7 +62,7 @@ export class WatchEffect<const Deps extends readonly Signal<unknown>[] = []> {
|
|
|
62
62
|
// postpone execution during HMR
|
|
63
63
|
if (
|
|
64
64
|
"window" in globalThis &&
|
|
65
|
-
window.
|
|
65
|
+
window.__kiru?.HMRContext?.isReplacement()
|
|
66
66
|
) {
|
|
67
67
|
return queueMicrotask(() => {
|
|
68
68
|
if (this.isRunning) {
|
|
@@ -5,7 +5,7 @@ import { renderMode } from "../globals.js"
|
|
|
5
5
|
|
|
6
6
|
type EventsArray = (keyof GlobalEventHandlersEventMap)[]
|
|
7
7
|
|
|
8
|
-
export const HYDRATION_BOUNDARY_MARKER = "
|
|
8
|
+
export const HYDRATION_BOUNDARY_MARKER = "kiru:h-boundary"
|
|
9
9
|
export const DEFAULT_INTERACTION_EVENTS = [
|
|
10
10
|
"pointerdown",
|
|
11
11
|
"keydown",
|
package/src/ssr/server.ts
CHANGED
|
@@ -42,7 +42,7 @@ export function renderToReadableStream<T extends Record<string, unknown>>(
|
|
|
42
42
|
function renderToStream_internal(
|
|
43
43
|
state: RequestState,
|
|
44
44
|
el: unknown,
|
|
45
|
-
parent:
|
|
45
|
+
parent: Kiru.VNode | null,
|
|
46
46
|
idx: number
|
|
47
47
|
): void {
|
|
48
48
|
if (el === null) return
|
package/src/store.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { createStore }
|
|
|
9
9
|
export type { Store, MethodFactory }
|
|
10
10
|
|
|
11
11
|
type MethodFactory<T> = (
|
|
12
|
-
setState: (setter:
|
|
12
|
+
setState: (setter: Kiru.StateSetter<T>) => void,
|
|
13
13
|
getState: () => T
|
|
14
14
|
) => Record<string, Function>
|
|
15
15
|
|
|
@@ -32,7 +32,7 @@ type Subscribe<T> = {
|
|
|
32
32
|
|
|
33
33
|
type Store<T, U extends Record<string, Function>> = StoreHook<T, U> & {
|
|
34
34
|
getState: () => T
|
|
35
|
-
setState: (setter:
|
|
35
|
+
setState: (setter: Kiru.StateSetter<T>) => void
|
|
36
36
|
methods: U
|
|
37
37
|
subscribe: Subscribe<T>
|
|
38
38
|
}
|
|
@@ -51,8 +51,8 @@ type NodeState = {
|
|
|
51
51
|
type InternalStoreState<T, U extends MethodFactory<T>> = {
|
|
52
52
|
value: T
|
|
53
53
|
epoch: number
|
|
54
|
-
subscribers: Set<
|
|
55
|
-
nodeStateMap: WeakMap<
|
|
54
|
+
subscribers: Set<Kiru.VNode | Function>
|
|
55
|
+
nodeStateMap: WeakMap<Kiru.VNode, NodeState>
|
|
56
56
|
methods: ReturnType<U>
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -65,8 +65,8 @@ function createStore<T, U extends MethodFactory<T>>(
|
|
|
65
65
|
current: {
|
|
66
66
|
value: initial,
|
|
67
67
|
epoch: 0,
|
|
68
|
-
subscribers: new Set<
|
|
69
|
-
nodeStateMap: new WeakMap<
|
|
68
|
+
subscribers: new Set<Kiru.VNode | Function>(),
|
|
69
|
+
nodeStateMap: new WeakMap<Kiru.VNode, NodeState>(),
|
|
70
70
|
methods: null as any as ReturnType<U>,
|
|
71
71
|
} satisfies InternalStoreState<T, U>,
|
|
72
72
|
}
|
|
@@ -76,7 +76,7 @@ function createStore<T, U extends MethodFactory<T>>(
|
|
|
76
76
|
|
|
77
77
|
const getState = () => state.current.value
|
|
78
78
|
|
|
79
|
-
const setState = (setter:
|
|
79
|
+
const setState = (setter: Kiru.StateSetter<T>) => {
|
|
80
80
|
state.current.value =
|
|
81
81
|
typeof setter === "function"
|
|
82
82
|
? (setter as Function)(state.current.value)
|
package/src/swr.ts
CHANGED
|
@@ -88,7 +88,7 @@ export type SWROptions = {
|
|
|
88
88
|
refetchWhenOffline?: boolean
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
type SWRHook =
|
|
91
|
+
type SWRHook = Kiru.Hook<{
|
|
92
92
|
strKey: string
|
|
93
93
|
options: SWROptions
|
|
94
94
|
update: () => void
|
|
@@ -107,7 +107,7 @@ let SWR_GLOBAL_CACHE: SWRCache
|
|
|
107
107
|
let IS_ONLINE = false
|
|
108
108
|
|
|
109
109
|
if ("window" in globalThis) {
|
|
110
|
-
SWR_GLOBAL_CACHE = window.
|
|
110
|
+
SWR_GLOBAL_CACHE = window.__kiru!.globalState[Symbol.for("SWR_GLOBAL")] ??=
|
|
111
111
|
new Map()
|
|
112
112
|
|
|
113
113
|
IS_ONLINE = navigator.onLine
|
package/src/types.dom.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
$FRAGMENT,
|
|
6
6
|
$HYDRATION_BOUNDARY,
|
|
7
7
|
} from "./constants"
|
|
8
|
-
import type {
|
|
8
|
+
import type { KiruGlobalContext } from "./globalContext"
|
|
9
9
|
import type {
|
|
10
10
|
GlobalAttributes,
|
|
11
11
|
HtmlElementAttributes,
|
|
@@ -50,10 +50,10 @@ type ElementMap = {
|
|
|
50
50
|
[Tag in keyof HtmlElementAttributes]: SignalableHtmlElementAttributes<Tag> &
|
|
51
51
|
SignalableGlobalAttributes &
|
|
52
52
|
SignalableAriaProps &
|
|
53
|
-
|
|
53
|
+
Kiru.EventAttributes<HTMLTagToElement<Tag>> &
|
|
54
54
|
JSX.ElementAttributes & {
|
|
55
55
|
ref?:
|
|
56
|
-
|
|
|
56
|
+
| Kiru.Ref<HTMLTagToElement<Tag>>
|
|
57
57
|
| SignalClass<HTMLTagToElement<Tag> | null>
|
|
58
58
|
}
|
|
59
59
|
} & {
|
|
@@ -61,10 +61,10 @@ type ElementMap = {
|
|
|
61
61
|
SignalableSvgGlobalAttributes &
|
|
62
62
|
SignalableGlobalAttributes &
|
|
63
63
|
SignalableAriaProps &
|
|
64
|
-
|
|
64
|
+
Kiru.EventAttributes<SVGTagToElement<Tag>> &
|
|
65
65
|
JSX.ElementAttributes & {
|
|
66
66
|
ref?:
|
|
67
|
-
|
|
|
67
|
+
| Kiru.Ref<SVGTagToElement<Tag>>
|
|
68
68
|
| SignalClass<SVGTagToElement<Tag> | null>
|
|
69
69
|
}
|
|
70
70
|
} & {
|
|
@@ -73,7 +73,7 @@ type ElementMap = {
|
|
|
73
73
|
|
|
74
74
|
declare global {
|
|
75
75
|
interface Window {
|
|
76
|
-
|
|
76
|
+
__kiru: KiruGlobalContext | undefined
|
|
77
77
|
}
|
|
78
78
|
namespace JSX {
|
|
79
79
|
interface IntrinsicElements extends ElementMap {}
|
|
@@ -97,9 +97,9 @@ declare global {
|
|
|
97
97
|
|
|
98
98
|
type Element =
|
|
99
99
|
| Element[]
|
|
100
|
-
|
|
|
100
|
+
| Kiru.VNode
|
|
101
101
|
| PrimitiveChild
|
|
102
|
-
|
|
|
102
|
+
| Kiru.Signal<PrimitiveChild>
|
|
103
103
|
|
|
104
104
|
type ElementAttributes = {
|
|
105
105
|
key?: JSX.ElementKey
|
|
@@ -107,10 +107,10 @@ declare global {
|
|
|
107
107
|
innerHTML?:
|
|
108
108
|
| string
|
|
109
109
|
| number
|
|
110
|
-
|
|
|
110
|
+
| Kiru.Signal<string | number | null | undefined>
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
namespace
|
|
113
|
+
namespace Kiru {
|
|
114
114
|
type ProviderProps<T> = {
|
|
115
115
|
value: T
|
|
116
116
|
children?: JSX.Children | ((value: T) => JSX.Element)
|
|
@@ -130,7 +130,7 @@ declare global {
|
|
|
130
130
|
displayName?: string
|
|
131
131
|
}
|
|
132
132
|
type FCProps<T = {}> = T & { children?: JSX.Children }
|
|
133
|
-
type InferProps<T> = T extends
|
|
133
|
+
type InferProps<T> = T extends Kiru.FC<infer P> ? P : never
|
|
134
134
|
|
|
135
135
|
type HookDevtoolsProvisions<T extends Record<string, any>> = {
|
|
136
136
|
get: () => T
|
|
@@ -176,7 +176,7 @@ declare global {
|
|
|
176
176
|
[key: string]: any
|
|
177
177
|
children?: unknown
|
|
178
178
|
key?: JSX.ElementKey
|
|
179
|
-
ref?:
|
|
179
|
+
ref?: Kiru.Ref<unknown>
|
|
180
180
|
}
|
|
181
181
|
index: number
|
|
182
182
|
depth: number
|
|
@@ -204,6 +204,6 @@ declare global {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
interface Element {
|
|
207
|
-
|
|
207
|
+
__kiruNode?: Kiru.VNode
|
|
208
208
|
}
|
|
209
209
|
}
|
package/src/types.utils.ts
CHANGED
|
@@ -6,13 +6,13 @@ export type SomeElement = HTMLElement | SVGElement
|
|
|
6
6
|
export type SomeDom = HTMLElement | SVGElement | Text
|
|
7
7
|
export type MaybeDom = SomeDom | undefined
|
|
8
8
|
|
|
9
|
-
type VNode =
|
|
9
|
+
type VNode = Kiru.VNode
|
|
10
10
|
|
|
11
11
|
export type FunctionVNode = Omit<VNode, "type"> & {
|
|
12
12
|
type: (...args: any) => any
|
|
13
13
|
}
|
|
14
14
|
export type ExoticVNode = Omit<VNode, "type"> & {
|
|
15
|
-
type:
|
|
15
|
+
type: Kiru.ExoticSymbol
|
|
16
16
|
}
|
|
17
17
|
export type ElementVNode = Omit<VNode, "dom" | "type"> & {
|
|
18
18
|
dom: SomeElement
|
|
@@ -23,11 +23,11 @@ export type DomVNode = Omit<VNode, "dom" | "type"> & {
|
|
|
23
23
|
type: "#text" | (string & {})
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export type ContextProviderNode<T> =
|
|
26
|
+
export type ContextProviderNode<T> = Kiru.VNode & {
|
|
27
27
|
type: typeof $CONTEXT_PROVIDER
|
|
28
|
-
props: { value: T; ctx:
|
|
28
|
+
props: { value: T; ctx: Kiru.Context<T>; dependents: Set<Kiru.VNode> }
|
|
29
29
|
}
|
|
30
|
-
export type HydrationBoundaryNode =
|
|
30
|
+
export type HydrationBoundaryNode = Kiru.VNode & {
|
|
31
31
|
type: typeof $HYDRATION_BOUNDARY
|
|
32
32
|
props: { mode: HydrationBoundaryMode }
|
|
33
33
|
}
|