kiru 0.44.4 → 0.45.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.
Files changed (310) hide show
  1. package/README.md +3 -3
  2. package/dist/appContext.d.ts +38 -0
  3. package/dist/appContext.d.ts.map +1 -0
  4. package/dist/appContext.js +143 -0
  5. package/dist/appContext.js.map +1 -0
  6. package/dist/cloneVNode.d.ts +2 -0
  7. package/dist/cloneVNode.d.ts.map +1 -0
  8. package/dist/cloneVNode.js +14 -0
  9. package/dist/cloneVNode.js.map +1 -0
  10. package/dist/constants.d.ts +31 -0
  11. package/dist/constants.d.ts.map +1 -0
  12. package/dist/constants.js +127 -0
  13. package/dist/constants.js.map +1 -0
  14. package/dist/context.d.ts +3 -0
  15. package/dist/context.d.ts.map +1 -0
  16. package/dist/context.js +50 -0
  17. package/dist/context.js.map +1 -0
  18. package/dist/dom.d.ts +8 -0
  19. package/dist/dom.d.ts.map +1 -0
  20. package/dist/dom.js +582 -0
  21. package/dist/dom.js.map +1 -0
  22. package/dist/element.d.ts +6 -0
  23. package/dist/element.d.ts.map +1 -0
  24. package/dist/element.js +41 -0
  25. package/dist/element.js.map +1 -0
  26. package/dist/env.d.ts +2 -0
  27. package/dist/env.d.ts.map +1 -0
  28. package/dist/env.js +6 -0
  29. package/dist/env.js.map +1 -0
  30. package/dist/error.d.ts +19 -0
  31. package/dist/error.d.ts.map +1 -0
  32. package/dist/error.js +63 -0
  33. package/dist/error.js.map +1 -0
  34. package/dist/flags.d.ts +6 -0
  35. package/dist/flags.d.ts.map +1 -0
  36. package/dist/flags.js +16 -0
  37. package/dist/flags.js.map +1 -0
  38. package/dist/form/index.d.ts +4 -0
  39. package/dist/form/index.d.ts.map +1 -0
  40. package/dist/form/index.js +509 -0
  41. package/dist/form/index.js.map +1 -0
  42. package/dist/form/types.d.ts +121 -0
  43. package/dist/form/types.d.ts.map +1 -0
  44. package/dist/form/types.js +2 -0
  45. package/dist/form/types.js.map +1 -0
  46. package/dist/form/utils.d.ts +3 -0
  47. package/dist/form/utils.d.ts.map +1 -0
  48. package/dist/form/utils.js +16 -0
  49. package/dist/form/utils.js.map +1 -0
  50. package/dist/generateId.d.ts +8 -0
  51. package/dist/generateId.d.ts.map +1 -0
  52. package/dist/generateId.js +15 -0
  53. package/dist/generateId.js.map +1 -0
  54. package/dist/globalContext.d.ts +37 -0
  55. package/dist/globalContext.d.ts.map +1 -0
  56. package/dist/globalContext.js +85 -0
  57. package/dist/globalContext.js.map +1 -0
  58. package/dist/globals.d.ts +16 -0
  59. package/dist/globals.d.ts.map +1 -0
  60. package/dist/globals.js +15 -0
  61. package/dist/globals.js.map +1 -0
  62. package/dist/hmr.d.ts +32 -0
  63. package/dist/hmr.d.ts.map +1 -0
  64. package/dist/hmr.js +125 -0
  65. package/dist/hmr.js.map +1 -0
  66. package/dist/hooks/index.d.ts +15 -0
  67. package/dist/hooks/index.d.ts.map +1 -0
  68. package/dist/hooks/index.js +15 -0
  69. package/dist/hooks/index.js.map +1 -0
  70. package/dist/hooks/useAsync.d.ts +29 -0
  71. package/dist/hooks/useAsync.d.ts.map +1 -0
  72. package/dist/hooks/useAsync.js +96 -0
  73. package/dist/hooks/useAsync.js.map +1 -0
  74. package/dist/hooks/useCallback.d.ts +7 -0
  75. package/dist/hooks/useCallback.d.ts.map +1 -0
  76. package/dist/hooks/useCallback.js +29 -0
  77. package/dist/hooks/useCallback.js.map +1 -0
  78. package/dist/hooks/useContext.d.ts +7 -0
  79. package/dist/hooks/useContext.d.ts.map +1 -0
  80. package/dist/hooks/useContext.js +59 -0
  81. package/dist/hooks/useContext.js.map +1 -0
  82. package/dist/hooks/useEffect.d.ts +8 -0
  83. package/dist/hooks/useEffect.d.ts.map +1 -0
  84. package/dist/hooks/useEffect.js +33 -0
  85. package/dist/hooks/useEffect.js.map +1 -0
  86. package/dist/hooks/useEffectEvent.d.ts +8 -0
  87. package/dist/hooks/useEffectEvent.d.ts.map +1 -0
  88. package/dist/hooks/useEffectEvent.js +22 -0
  89. package/dist/hooks/useEffectEvent.js.map +1 -0
  90. package/dist/hooks/useId.d.ts +8 -0
  91. package/dist/hooks/useId.d.ts.map +1 -0
  92. package/dist/hooks/useId.js +35 -0
  93. package/dist/hooks/useId.js.map +1 -0
  94. package/dist/hooks/useLayoutEffect.d.ts +8 -0
  95. package/dist/hooks/useLayoutEffect.d.ts.map +1 -0
  96. package/dist/hooks/useLayoutEffect.js +33 -0
  97. package/dist/hooks/useLayoutEffect.js.map +1 -0
  98. package/dist/hooks/useMemo.d.ts +8 -0
  99. package/dist/hooks/useMemo.d.ts.map +1 -0
  100. package/dist/hooks/useMemo.js +30 -0
  101. package/dist/hooks/useMemo.js.map +1 -0
  102. package/dist/hooks/useReducer.d.ts +7 -0
  103. package/dist/hooks/useReducer.d.ts.map +1 -0
  104. package/dist/hooks/useReducer.js +44 -0
  105. package/dist/hooks/useReducer.js.map +1 -0
  106. package/dist/hooks/useRef.d.ts +10 -0
  107. package/dist/hooks/useRef.d.ts.map +1 -0
  108. package/dist/hooks/useRef.js +28 -0
  109. package/dist/hooks/useRef.js.map +1 -0
  110. package/dist/hooks/useState.d.ts +7 -0
  111. package/dist/hooks/useState.d.ts.map +1 -0
  112. package/dist/hooks/useState.js +54 -0
  113. package/dist/hooks/useState.js.map +1 -0
  114. package/dist/hooks/useSyncExternalStore.d.ts +8 -0
  115. package/dist/hooks/useSyncExternalStore.d.ts.map +1 -0
  116. package/dist/hooks/useSyncExternalStore.js +50 -0
  117. package/dist/hooks/useSyncExternalStore.js.map +1 -0
  118. package/dist/hooks/useViewTransition.d.ts +10 -0
  119. package/dist/hooks/useViewTransition.d.ts.map +1 -0
  120. package/dist/hooks/useViewTransition.js +28 -0
  121. package/dist/hooks/useViewTransition.js.map +1 -0
  122. package/dist/hooks/utils.d.ts +69 -0
  123. package/dist/hooks/utils.d.ts.map +1 -0
  124. package/dist/hooks/utils.js +163 -0
  125. package/dist/hooks/utils.js.map +1 -0
  126. package/dist/hydration.d.ts +17 -0
  127. package/dist/hydration.d.ts.map +1 -0
  128. package/dist/hydration.js +59 -0
  129. package/dist/hydration.js.map +1 -0
  130. package/dist/index.d.ts +17 -0
  131. package/dist/index.d.ts.map +1 -0
  132. package/dist/index.js +40 -0
  133. package/dist/index.js.map +1 -0
  134. package/dist/jsx.d.ts +6 -0
  135. package/dist/jsx.d.ts.map +1 -0
  136. package/dist/jsx.js +8 -0
  137. package/dist/jsx.js.map +1 -0
  138. package/dist/lazy.d.ts +11 -0
  139. package/dist/lazy.d.ts.map +1 -0
  140. package/dist/lazy.js +177 -0
  141. package/dist/lazy.js.map +1 -0
  142. package/dist/memo.d.ts +9 -0
  143. package/dist/memo.d.ts.map +1 -0
  144. package/dist/memo.js +25 -0
  145. package/dist/memo.js.map +1 -0
  146. package/dist/portal.d.ts +10 -0
  147. package/dist/portal.d.ts.map +1 -0
  148. package/dist/portal.js +34 -0
  149. package/dist/portal.js.map +1 -0
  150. package/dist/profiling.d.ts +26 -0
  151. package/dist/profiling.d.ts.map +1 -0
  152. package/dist/profiling.js +83 -0
  153. package/dist/profiling.js.map +1 -0
  154. package/dist/props.d.ts +4 -0
  155. package/dist/props.d.ts.map +1 -0
  156. package/dist/props.js +27 -0
  157. package/dist/props.js.map +1 -0
  158. package/dist/reconciler.d.ts +4 -0
  159. package/dist/reconciler.d.ts.map +1 -0
  160. package/dist/reconciler.js +466 -0
  161. package/dist/reconciler.js.map +1 -0
  162. package/dist/renderToString.d.ts +2 -0
  163. package/dist/renderToString.d.ts.map +1 -0
  164. package/dist/renderToString.js +74 -0
  165. package/dist/renderToString.js.map +1 -0
  166. package/dist/router/index.d.ts +3 -0
  167. package/dist/router/index.d.ts.map +1 -0
  168. package/dist/router/index.js +3 -0
  169. package/dist/router/index.js.map +1 -0
  170. package/dist/router/route.d.ts +46 -0
  171. package/dist/router/route.d.ts.map +1 -0
  172. package/dist/router/route.js +8 -0
  173. package/dist/router/route.js.map +1 -0
  174. package/dist/router/router.d.ts +62 -0
  175. package/dist/router/router.d.ts.map +1 -0
  176. package/dist/router/router.js +178 -0
  177. package/dist/router/router.js.map +1 -0
  178. package/dist/router/routerUtils.d.ts +5 -0
  179. package/dist/router/routerUtils.d.ts.map +1 -0
  180. package/dist/router/routerUtils.js +39 -0
  181. package/dist/router/routerUtils.js.map +1 -0
  182. package/dist/scheduler.d.ts +14 -0
  183. package/dist/scheduler.d.ts.map +1 -0
  184. package/dist/scheduler.js +457 -0
  185. package/dist/scheduler.js.map +1 -0
  186. package/dist/signals/base.d.ts +36 -0
  187. package/dist/signals/base.d.ts.map +1 -0
  188. package/dist/signals/base.js +205 -0
  189. package/dist/signals/base.js.map +1 -0
  190. package/dist/signals/computed.d.ts +16 -0
  191. package/dist/signals/computed.d.ts.map +1 -0
  192. package/dist/signals/computed.js +116 -0
  193. package/dist/signals/computed.js.map +1 -0
  194. package/dist/signals/effect.d.ts +18 -0
  195. package/dist/signals/effect.d.ts.map +1 -0
  196. package/dist/signals/effect.js +43 -0
  197. package/dist/signals/effect.js.map +1 -0
  198. package/dist/signals/globals.d.ts +9 -0
  199. package/dist/signals/globals.d.ts.map +1 -0
  200. package/dist/signals/globals.js +9 -0
  201. package/dist/signals/globals.js.map +1 -0
  202. package/dist/signals/index.d.ts +12 -0
  203. package/dist/signals/index.d.ts.map +1 -0
  204. package/dist/signals/index.js +12 -0
  205. package/dist/signals/index.js.map +1 -0
  206. package/dist/signals/jsx.d.ts +16 -0
  207. package/dist/signals/jsx.d.ts.map +1 -0
  208. package/dist/signals/jsx.js +11 -0
  209. package/dist/signals/jsx.js.map +1 -0
  210. package/dist/signals/types.d.ts +9 -0
  211. package/dist/signals/types.d.ts.map +1 -0
  212. package/dist/signals/types.js +2 -0
  213. package/dist/signals/types.js.map +1 -0
  214. package/dist/signals/utils.d.ts +4 -0
  215. package/dist/signals/utils.d.ts.map +1 -0
  216. package/dist/signals/utils.js +12 -0
  217. package/dist/signals/utils.js.map +1 -0
  218. package/dist/signals/watch.d.ts +24 -0
  219. package/dist/signals/watch.d.ts.map +1 -0
  220. package/dist/signals/watch.js +104 -0
  221. package/dist/signals/watch.js.map +1 -0
  222. package/dist/ssr/client.d.ts +4 -0
  223. package/dist/ssr/client.d.ts.map +1 -0
  224. package/dist/ssr/client.js +12 -0
  225. package/dist/ssr/client.js.map +1 -0
  226. package/dist/ssr/hydrationBoundary.d.ts +27 -0
  227. package/dist/ssr/hydrationBoundary.d.ts.map +1 -0
  228. package/dist/ssr/hydrationBoundary.js +30 -0
  229. package/dist/ssr/hydrationBoundary.js.map +1 -0
  230. package/dist/ssr/index.d.ts +2 -0
  231. package/dist/ssr/index.d.ts.map +1 -0
  232. package/dist/ssr/index.js +2 -0
  233. package/dist/ssr/index.js.map +1 -0
  234. package/dist/ssr/server.d.ts +3 -0
  235. package/dist/ssr/server.d.ts.map +1 -0
  236. package/dist/ssr/server.js +101 -0
  237. package/dist/ssr/server.js.map +1 -0
  238. package/dist/store.d.ts +28 -0
  239. package/dist/store.d.ts.map +1 -0
  240. package/dist/store.js +166 -0
  241. package/dist/store.js.map +1 -0
  242. package/dist/swr.d.ts +74 -0
  243. package/dist/swr.d.ts.map +1 -0
  244. package/dist/swr.js +228 -0
  245. package/dist/swr.js.map +1 -0
  246. package/dist/transition.d.ts +18 -0
  247. package/dist/transition.d.ts.map +1 -0
  248. package/dist/transition.js +48 -0
  249. package/dist/transition.js.map +1 -0
  250. package/dist/types.d.ts +143 -0
  251. package/dist/types.d.ts.map +1 -0
  252. package/dist/types.dom.d.ts +920 -0
  253. package/dist/types.dom.d.ts.map +1 -0
  254. package/dist/types.dom.js +2 -0
  255. package/dist/types.dom.js.map +1 -0
  256. package/dist/types.js +2 -0
  257. package/dist/types.js.map +1 -0
  258. package/dist/types.utils.d.ts +41 -0
  259. package/dist/types.utils.d.ts.map +1 -0
  260. package/dist/types.utils.js +2 -0
  261. package/dist/types.utils.js.map +1 -0
  262. package/dist/utils.d.ts +61 -0
  263. package/dist/utils.d.ts.map +1 -0
  264. package/dist/utils.js +478 -0
  265. package/dist/utils.js.map +1 -0
  266. package/dist/warning.d.ts +2 -0
  267. package/dist/warning.d.ts.map +1 -0
  268. package/dist/warning.js +4 -0
  269. package/dist/warning.js.map +1 -0
  270. package/package.json +1 -1
  271. package/src/appContext.ts +7 -7
  272. package/src/cloneVNode.ts +1 -1
  273. package/src/constants.ts +9 -9
  274. package/src/context.ts +7 -7
  275. package/src/dom.ts +13 -15
  276. package/src/element.ts +4 -4
  277. package/src/error.ts +11 -13
  278. package/src/globalContext.ts +6 -10
  279. package/src/globals.ts +3 -3
  280. package/src/hmr.ts +4 -4
  281. package/src/hooks/useContext.ts +5 -5
  282. package/src/hooks/useId.ts +1 -1
  283. package/src/hooks/useReducer.ts +1 -1
  284. package/src/hooks/useRef.ts +4 -4
  285. package/src/hooks/useState.ts +4 -4
  286. package/src/hooks/useSyncExternalStore.ts +2 -2
  287. package/src/hooks/utils.ts +7 -9
  288. package/src/index.ts +4 -4
  289. package/src/jsx.ts +2 -2
  290. package/src/lazy.ts +11 -11
  291. package/src/memo.ts +1 -1
  292. package/src/portal.ts +4 -4
  293. package/src/props.ts +5 -7
  294. package/src/reconciler.ts +6 -6
  295. package/src/renderToString.ts +1 -1
  296. package/src/router/route.ts +1 -1
  297. package/src/router/router.ts +4 -4
  298. package/src/scheduler.ts +14 -14
  299. package/src/signals/base.ts +1 -1
  300. package/src/signals/types.ts +1 -1
  301. package/src/signals/watch.ts +2 -2
  302. package/src/ssr/hydrationBoundary.ts +1 -1
  303. package/src/ssr/server.ts +1 -1
  304. package/src/store.ts +7 -7
  305. package/src/swr.ts +2 -2
  306. package/src/types.dom.ts +1 -1
  307. package/src/types.ts +13 -13
  308. package/src/types.utils.ts +5 -5
  309. package/src/utils.ts +7 -10
  310. package/src/warning.ts +1 -1
package/src/props.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { KaiokenError } from "./error.js"
1
+ import { KiruError } from "./error.js"
2
2
  import { Signal } from "./signals/base.js"
3
3
 
4
- export function assertValidElementProps(vNode: Kaioken.VNode) {
4
+ export function assertValidElementProps(vNode: Kiru.VNode) {
5
5
  if ("children" in vNode.props && vNode.props.innerHTML) {
6
- throw new KaiokenError({
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 KaiokenError({
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 = Kaioken.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: Kaioken.VNode, parent: Kaioken.VNode) {
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.__kaioken?.profilingContext?.emit("updateNode", ctx.current)
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.__kaioken?.profilingContext?.emit("createNode", ctx.current)
446
+ window.__kiru?.profilingContext?.emit("createNode", ctx.current)
447
447
  }
448
448
 
449
- const $LIST_CHILD = Symbol("kaioken:marked-list-child")
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 = `[kaioken]: ${str}. See https://kaioken.dev/keys-warning for more information.`
513
+ const formatted = `[kiru]: ${str}. See https://kaioken.dev/keys-warning for more information.`
514
514
  console.error(formatted)
515
515
  }
516
516
 
@@ -31,7 +31,7 @@ export function renderToString<T extends Record<string, unknown>>(
31
31
 
32
32
  function renderToString_internal(
33
33
  el: unknown,
34
- parent: Kaioken.VNode | null,
34
+ parent: Kiru.VNode | null,
35
35
  idx: number
36
36
  ): string {
37
37
  if (el === null) return ""
@@ -46,6 +46,6 @@ export function Route({ element }: RouteProps) {
46
46
 
47
47
  export function isRoute(
48
48
  thing: unknown
49
- ): thing is Kaioken.VNode & { props: RouteProps } {
49
+ ): thing is Kiru.VNode & { props: RouteProps } {
50
50
  return isVNode(thing) && thing.type === Route
51
51
  }
@@ -67,7 +67,7 @@ export function Link({ to, onclick, replace, inherit, ...props }: LinkProps) {
67
67
  }
68
68
 
69
69
  type RouterCtx = {
70
- viewTransition: Kaioken.RefObject<ViewTransition>
70
+ viewTransition: Kiru.RefObject<ViewTransition>
71
71
  queueSyncNav: (callback: () => void) => void
72
72
  params: Record<string, string>
73
73
  query: Record<string, string>
@@ -205,8 +205,8 @@ export function Router(props: RouterProps) {
205
205
  }
206
206
  })
207
207
 
208
- type RouteComponent = Kaioken.VNode & {
209
- props: Kaioken.InferProps<typeof Route>
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
- "[kaioken]: More than one fallback route defined. Only the last one will be used."
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 { KaiokenError } from "./error.js"
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 = Kaioken.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.__kaioken?.profilingContext?.emit("updateDirtied", appCtx)
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.__kaioken?.profilingContext?.beginTick(appCtx)
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.__kaioken?.profilingContext?.endTick(appCtx)
271
- window.__kaioken?.profilingContext?.emit("updateDirtied", appCtx)
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.__kaioken!.emit("update", appCtx)
278
+ window.__kiru!.emit("update", appCtx)
279
279
  if (__DEV__) {
280
- window.__kaioken?.profilingContext?.emit("update", appCtx)
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.__kaioken?.profilingContext?.endTick(appCtx)
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.__kaioken?.emit(
365
+ window.__kiru?.emit(
366
366
  "error",
367
367
  appCtx,
368
368
  error instanceof Error ? error : new Error(String(error))
369
369
  )
370
- if (KaiokenError.isKaiokenError(error)) {
370
+ if (KiruError.isKiruError(error)) {
371
371
  if (error.customNodeStack) {
372
372
  setTimeout(() => {
373
373
  throw new Error(error.customNodeStack)
@@ -452,7 +452,7 @@ export function createScheduler(
452
452
  newChild = latest(type)(props)
453
453
  delete vNode.hmrUpdated
454
454
  if (++renderTryCount > CONSECUTIVE_DIRTY_LIMIT) {
455
- throw new KaiokenError({
455
+ throw new KiruError({
456
456
  message:
457
457
  "Too many re-renders. Kaioken limits the number of renders to prevent an infinite loop.",
458
458
  fatal: true,
@@ -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.__kaiokenNode = vNode
487
+ vNode.dom.__kiruNode = vNode
488
488
  }
489
489
  }
490
490
  // text should _never_ have children
@@ -500,7 +500,7 @@ export function createScheduler(
500
500
 
501
501
  function checkForTooManyConsecutiveDirtyRenders() {
502
502
  if (consecutiveDirtyCount > CONSECUTIVE_DIRTY_LIMIT) {
503
- throw new KaiokenError(
503
+ throw new KiruError(
504
504
  "Maximum update depth exceeded. This can happen when a component repeatedly calls setState during render or in useLayoutEffect. Kaioken limits the number of nested updates to prevent infinite loops."
505
505
  )
506
506
  }
@@ -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 | Kaioken.VNode) => boolean }) {
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") {
@@ -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 = Kaioken.VNode | Function
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
@@ -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.__kaioken!.HMRContext!.signals
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.__kaioken?.HMRContext?.isReplacement()
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 = "kaioken:h-boundary"
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: Kaioken.VNode | null,
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: Kaioken.StateSetter<T>) => void,
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: Kaioken.StateSetter<T>) => void
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<Kaioken.VNode | Function>
55
- nodeStateMap: WeakMap<Kaioken.VNode, NodeState>
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<Kaioken.VNode | Function>(),
69
- nodeStateMap: new WeakMap<Kaioken.VNode, NodeState>(),
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: Kaioken.StateSetter<T>) => {
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 = Kaioken.Hook<{
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.__kaioken!.globalState[Symbol.for("SWR_GLOBAL")] ??=
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
@@ -349,7 +349,7 @@ type NoChildElementElement =
349
349
  | HTMLTextAreaElement
350
350
 
351
351
  declare global {
352
- namespace Kaioken {
352
+ namespace Kiru {
353
353
  type DOMEvent<E = Event, C = unknown, T = unknown> = Omit<
354
354
  E,
355
355
  "target" | "currentTarget"
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 { KaiokenGlobalContext } from "./globalContext"
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
- Kaioken.EventAttributes<HTMLTagToElement<Tag>> &
53
+ Kiru.EventAttributes<HTMLTagToElement<Tag>> &
54
54
  JSX.ElementAttributes & {
55
55
  ref?:
56
- | Kaioken.Ref<HTMLTagToElement<Tag>>
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
- Kaioken.EventAttributes<SVGTagToElement<Tag>> &
64
+ Kiru.EventAttributes<SVGTagToElement<Tag>> &
65
65
  JSX.ElementAttributes & {
66
66
  ref?:
67
- | Kaioken.Ref<SVGTagToElement<Tag>>
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
- __kaioken: KaiokenGlobalContext | undefined
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
- | Kaioken.VNode
100
+ | Kiru.VNode
101
101
  | PrimitiveChild
102
- | Kaioken.Signal<PrimitiveChild>
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
- | Kaioken.Signal<string | number | null | undefined>
110
+ | Kiru.Signal<string | number | null | undefined>
111
111
  }
112
112
  }
113
- namespace Kaioken {
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 Kaioken.FC<infer P> ? P : never
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?: Kaioken.Ref<unknown>
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
- __kaiokenNode?: Kaioken.VNode
207
+ __kiruNode?: Kiru.VNode
208
208
  }
209
209
  }
@@ -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 = Kaioken.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: Kaioken.ExoticSymbol
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> = Kaioken.VNode & {
26
+ export type ContextProviderNode<T> = Kiru.VNode & {
27
27
  type: typeof $CONTEXT_PROVIDER
28
- props: { value: T; ctx: Kaioken.Context<T>; dependents: Set<Kaioken.VNode> }
28
+ props: { value: T; ctx: Kiru.Context<T>; dependents: Set<Kiru.VNode> }
29
29
  }
30
- export type HydrationBoundaryNode = Kaioken.VNode & {
30
+ export type HydrationBoundaryNode = Kiru.VNode & {
31
31
  type: typeof $HYDRATION_BOUNDARY
32
32
  props: { mode: HydrationBoundaryMode }
33
33
  }
package/src/utils.ts CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  REGEX_UNIT,
9
9
  } from "./constants.js"
10
10
  import { unwrap } from "./signals/utils.js"
11
- import { KaiokenError } from "./error.js"
11
+ import { KiruError } from "./error.js"
12
12
  import type { AppContext } from "./appContext"
13
13
  import { __DEV__ } from "./env.js"
14
14
  import { flags } from "./flags.js"
@@ -44,7 +44,7 @@ export {
44
44
  safeStringify,
45
45
  }
46
46
 
47
- type VNode = Kaioken.VNode
47
+ type VNode = Kiru.VNode
48
48
 
49
49
  const noop: () => void = Object.freeze(() => {})
50
50
 
@@ -81,7 +81,7 @@ function isVNode(thing: unknown): thing is VNode {
81
81
  return typeof thing === "object" && thing !== null && "type" in thing
82
82
  }
83
83
 
84
- function isExoticType(type: VNode["type"]): type is Kaioken.ExoticSymbol {
84
+ function isExoticType(type: VNode["type"]): type is Kiru.ExoticSymbol {
85
85
  return (
86
86
  type === $FRAGMENT ||
87
87
  type === $CONTEXT_PROVIDER ||
@@ -101,7 +101,7 @@ function isLazy(vNode: VNode): boolean {
101
101
  )
102
102
  }
103
103
 
104
- function isMemo(vNode: Kaioken.VNode): boolean {
104
+ function isMemo(vNode: Kiru.VNode): boolean {
105
105
  return (
106
106
  typeof vNode.type === "function" &&
107
107
  "displayName" in vNode.type &&
@@ -122,7 +122,7 @@ function getCurrentVNode(): VNode | null {
122
122
  function getVNodeAppContext(vNode: VNode): AppContext {
123
123
  const n = nodeToCtxMap.get(vNode)
124
124
  if (!n)
125
- throw new KaiokenError({
125
+ throw new KiruError({
126
126
  message: "Unable to find VNode's AppContext.",
127
127
  vNode,
128
128
  })
@@ -226,11 +226,8 @@ function postOrderApply(
226
226
  callbacks.onAscent(root)
227
227
  }
228
228
 
229
- function findParent(
230
- vNode: Kaioken.VNode,
231
- predicate: (n: Kaioken.VNode) => boolean
232
- ) {
233
- let n: Kaioken.VNode | null = vNode.parent
229
+ function findParent(vNode: Kiru.VNode, predicate: (n: Kiru.VNode) => boolean) {
230
+ let n: Kiru.VNode | null = vNode.parent
234
231
  while (n) {
235
232
  if (predicate(n)) return n
236
233
  n = n.parent
package/src/warning.ts CHANGED
@@ -4,6 +4,6 @@ export const warnDeprecated = (
4
4
  solution: string
5
5
  ) => {
6
6
  console.warn(
7
- `[kaioken]: "${featName}" is deprecated ${reason} and will be removed in future versions. ${solution}.`
7
+ `[kiru]: "${featName}" is deprecated ${reason} and will be removed in future versions. ${solution}.`
8
8
  )
9
9
  }