kiru 0.48.3 → 0.49.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 (236) hide show
  1. package/dist/action.d.ts +22 -0
  2. package/dist/action.d.ts.map +1 -0
  3. package/dist/action.js +20 -0
  4. package/dist/action.js.map +1 -0
  5. package/dist/components/index.d.ts +5 -0
  6. package/dist/components/index.d.ts.map +1 -0
  7. package/dist/components/index.js +5 -0
  8. package/dist/components/index.js.map +1 -0
  9. package/dist/components/lazy.d.ts.map +1 -0
  10. package/dist/{lazy.js → components/lazy.js} +11 -11
  11. package/dist/components/lazy.js.map +1 -0
  12. package/dist/{memo.d.ts → components/memo.d.ts} +1 -1
  13. package/dist/components/memo.d.ts.map +1 -0
  14. package/dist/{memo.js → components/memo.js} +2 -2
  15. package/dist/components/memo.js.map +1 -0
  16. package/dist/components/portal.d.ts.map +1 -0
  17. package/dist/{portal.js → components/portal.js} +6 -6
  18. package/dist/components/portal.js.map +1 -0
  19. package/dist/components/router/index.d.ts.map +1 -0
  20. package/dist/components/router/index.js.map +1 -0
  21. package/dist/components/router/route.d.ts.map +1 -0
  22. package/dist/{router → components/router}/route.js +1 -1
  23. package/dist/components/router/route.js.map +1 -0
  24. package/dist/{router → components/router}/router.d.ts +1 -1
  25. package/dist/components/router/router.d.ts.map +1 -0
  26. package/dist/{router → components/router}/router.js +8 -8
  27. package/dist/components/router/router.js.map +1 -0
  28. package/dist/components/router/routerUtils.d.ts.map +1 -0
  29. package/dist/components/router/routerUtils.js.map +1 -0
  30. package/dist/components/transition.d.ts.map +1 -0
  31. package/dist/{transition.js → components/transition.js} +5 -5
  32. package/dist/components/transition.js.map +1 -0
  33. package/dist/constants.d.ts +2 -1
  34. package/dist/constants.d.ts.map +1 -1
  35. package/dist/constants.js +79 -1
  36. package/dist/constants.js.map +1 -1
  37. package/dist/context.js +1 -1
  38. package/dist/context.js.map +1 -1
  39. package/dist/dom.d.ts.map +1 -1
  40. package/dist/dom.js +8 -9
  41. package/dist/dom.js.map +1 -1
  42. package/dist/element.js +2 -2
  43. package/dist/element.js.map +1 -1
  44. package/dist/error.js +1 -1
  45. package/dist/error.js.map +1 -1
  46. package/dist/form/index.d.ts.map +1 -1
  47. package/dist/form/index.js +1 -2
  48. package/dist/form/index.js.map +1 -1
  49. package/dist/hmr.js +1 -1
  50. package/dist/hmr.js.map +1 -1
  51. package/dist/hooks/useAsync.d.ts.map +1 -1
  52. package/dist/hooks/useAsync.js +2 -2
  53. package/dist/hooks/useAsync.js.map +1 -1
  54. package/dist/hooks/useCallback.d.ts.map +1 -1
  55. package/dist/hooks/useCallback.js +2 -1
  56. package/dist/hooks/useCallback.js.map +1 -1
  57. package/dist/hooks/useEffect.d.ts.map +1 -1
  58. package/dist/hooks/useEffect.js +2 -1
  59. package/dist/hooks/useEffect.js.map +1 -1
  60. package/dist/hooks/useEffectEvent.d.ts.map +1 -1
  61. package/dist/hooks/useEffectEvent.js +2 -1
  62. package/dist/hooks/useEffectEvent.js.map +1 -1
  63. package/dist/hooks/useLayoutEffect.d.ts.map +1 -1
  64. package/dist/hooks/useLayoutEffect.js +2 -1
  65. package/dist/hooks/useLayoutEffect.js.map +1 -1
  66. package/dist/hooks/useMemo.d.ts.map +1 -1
  67. package/dist/hooks/useMemo.js +2 -1
  68. package/dist/hooks/useMemo.js.map +1 -1
  69. package/dist/hooks/useReducer.js +2 -2
  70. package/dist/hooks/useReducer.js.map +1 -1
  71. package/dist/hooks/useRef.d.ts.map +1 -1
  72. package/dist/hooks/useRef.js +2 -1
  73. package/dist/hooks/useRef.js.map +1 -1
  74. package/dist/hooks/useState.js +2 -2
  75. package/dist/hooks/useState.js.map +1 -1
  76. package/dist/hooks/useSyncExternalStore.js +2 -2
  77. package/dist/hooks/useSyncExternalStore.js.map +1 -1
  78. package/dist/hooks/useViewTransition.d.ts.map +1 -1
  79. package/dist/hooks/useViewTransition.js +1 -2
  80. package/dist/hooks/useViewTransition.js.map +1 -1
  81. package/dist/hooks/utils.d.ts +0 -1
  82. package/dist/hooks/utils.d.ts.map +1 -1
  83. package/dist/hooks/utils.js +1 -2
  84. package/dist/hooks/utils.js.map +1 -1
  85. package/dist/index.d.ts +2 -5
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +2 -5
  88. package/dist/index.js.map +1 -1
  89. package/dist/reconciler.js +8 -7
  90. package/dist/reconciler.js.map +1 -1
  91. package/dist/renderToString.js +1 -2
  92. package/dist/renderToString.js.map +1 -1
  93. package/dist/scheduler.js +2 -2
  94. package/dist/scheduler.js.map +1 -1
  95. package/dist/signals/base.d.ts.map +1 -1
  96. package/dist/signals/base.js +1 -2
  97. package/dist/signals/base.js.map +1 -1
  98. package/dist/signals/computed.js +1 -1
  99. package/dist/signals/computed.js.map +1 -1
  100. package/dist/signals/effect.js +1 -1
  101. package/dist/signals/effect.js.map +1 -1
  102. package/dist/signals/watch.d.ts.map +1 -1
  103. package/dist/signals/watch.js +2 -3
  104. package/dist/signals/watch.js.map +1 -1
  105. package/dist/ssr/server.js +1 -2
  106. package/dist/ssr/server.js.map +1 -1
  107. package/dist/store.d.ts +1 -1
  108. package/dist/store.d.ts.map +1 -1
  109. package/dist/store.js +2 -2
  110. package/dist/store.js.map +1 -1
  111. package/dist/swr.js +1 -1
  112. package/dist/swr.js.map +1 -1
  113. package/dist/types.d.ts +4 -3
  114. package/dist/types.d.ts.map +1 -1
  115. package/dist/types.dom.d.ts +2 -2
  116. package/dist/types.dom.d.ts.map +1 -1
  117. package/dist/utils/compare.d.ts +3 -0
  118. package/dist/utils/compare.d.ts.map +1 -0
  119. package/dist/utils/compare.js +123 -0
  120. package/dist/utils/compare.js.map +1 -0
  121. package/dist/utils/format.d.ts +20 -0
  122. package/dist/utils/format.d.ts.map +1 -0
  123. package/dist/utils/format.js +129 -0
  124. package/dist/utils/format.js.map +1 -0
  125. package/dist/utils/generateId.d.ts.map +1 -0
  126. package/dist/utils/generateId.js.map +1 -0
  127. package/dist/utils/index.d.ts +7 -0
  128. package/dist/utils/index.d.ts.map +1 -0
  129. package/dist/utils/index.js +7 -0
  130. package/dist/utils/index.js.map +1 -0
  131. package/dist/utils/runtime.d.ts +11 -0
  132. package/dist/utils/runtime.d.ts.map +1 -0
  133. package/dist/utils/runtime.js +23 -0
  134. package/dist/utils/runtime.js.map +1 -0
  135. package/dist/utils/vdom.d.ts +25 -0
  136. package/dist/utils/vdom.d.ts.map +1 -0
  137. package/dist/utils/vdom.js +124 -0
  138. package/dist/utils/vdom.js.map +1 -0
  139. package/package.json +6 -6
  140. package/src/action.ts +42 -0
  141. package/src/components/index.ts +4 -0
  142. package/src/{lazy.ts → components/lazy.ts} +12 -12
  143. package/src/{memo.ts → components/memo.ts} +3 -3
  144. package/src/{portal.ts → components/portal.ts} +6 -6
  145. package/src/{router → components/router}/route.ts +1 -1
  146. package/src/{router → components/router}/router.ts +9 -9
  147. package/src/{transition.ts → components/transition.ts} +5 -5
  148. package/src/constants.ts +80 -1
  149. package/src/context.ts +1 -1
  150. package/src/customEvents.ts +22 -22
  151. package/src/dom.ts +7 -8
  152. package/src/element.ts +2 -2
  153. package/src/error.ts +1 -1
  154. package/src/form/index.ts +5 -2
  155. package/src/hmr.ts +1 -1
  156. package/src/hooks/useAsync.ts +5 -3
  157. package/src/hooks/useCallback.ts +2 -1
  158. package/src/hooks/useEffect.ts +2 -6
  159. package/src/hooks/useEffectEvent.ts +2 -1
  160. package/src/hooks/useLayoutEffect.ts +2 -6
  161. package/src/hooks/useMemo.ts +2 -1
  162. package/src/hooks/useReducer.ts +2 -2
  163. package/src/hooks/useRef.ts +2 -1
  164. package/src/hooks/useState.ts +2 -2
  165. package/src/hooks/useSyncExternalStore.ts +2 -2
  166. package/src/hooks/useViewTransition.ts +1 -2
  167. package/src/hooks/utils.ts +1 -2
  168. package/src/index.ts +2 -5
  169. package/src/reconciler.ts +13 -11
  170. package/src/renderToString.ts +2 -2
  171. package/src/scheduler.ts +2 -2
  172. package/src/signals/base.ts +6 -2
  173. package/src/signals/computed.ts +1 -1
  174. package/src/signals/effect.ts +1 -1
  175. package/src/signals/watch.ts +2 -3
  176. package/src/ssr/server.ts +2 -2
  177. package/src/store.ts +6 -2
  178. package/src/swr.ts +3 -3
  179. package/src/types.dom.ts +2 -1
  180. package/src/types.ts +9 -2
  181. package/src/utils/compare.ts +125 -0
  182. package/src/utils/format.ts +158 -0
  183. package/src/utils/index.ts +7 -0
  184. package/src/utils/runtime.ts +25 -0
  185. package/src/utils/vdom.ts +184 -0
  186. package/dist/cloneVNode.d.ts +0 -2
  187. package/dist/cloneVNode.d.ts.map +0 -1
  188. package/dist/cloneVNode.js +0 -14
  189. package/dist/cloneVNode.js.map +0 -1
  190. package/dist/generateId.d.ts.map +0 -1
  191. package/dist/generateId.js.map +0 -1
  192. package/dist/lazy.d.ts.map +0 -1
  193. package/dist/lazy.js.map +0 -1
  194. package/dist/memo.d.ts.map +0 -1
  195. package/dist/memo.js.map +0 -1
  196. package/dist/portal.d.ts.map +0 -1
  197. package/dist/portal.js.map +0 -1
  198. package/dist/props.d.ts +0 -4
  199. package/dist/props.d.ts.map +0 -1
  200. package/dist/props.js +0 -27
  201. package/dist/props.js.map +0 -1
  202. package/dist/router/index.d.ts.map +0 -1
  203. package/dist/router/index.js.map +0 -1
  204. package/dist/router/route.d.ts.map +0 -1
  205. package/dist/router/route.js.map +0 -1
  206. package/dist/router/router.d.ts.map +0 -1
  207. package/dist/router/router.js.map +0 -1
  208. package/dist/router/routerUtils.d.ts.map +0 -1
  209. package/dist/router/routerUtils.js.map +0 -1
  210. package/dist/transition.d.ts.map +0 -1
  211. package/dist/transition.js.map +0 -1
  212. package/dist/utils.d.ts +0 -52
  213. package/dist/utils.d.ts.map +0 -1
  214. package/dist/utils.js +0 -433
  215. package/dist/utils.js.map +0 -1
  216. package/dist/warning.d.ts +0 -2
  217. package/dist/warning.d.ts.map +0 -1
  218. package/dist/warning.js +0 -4
  219. package/dist/warning.js.map +0 -1
  220. package/src/cloneVNode.ts +0 -14
  221. package/src/props.ts +0 -34
  222. package/src/utils.ts +0 -518
  223. package/src/warning.ts +0 -9
  224. /package/dist/{lazy.d.ts → components/lazy.d.ts} +0 -0
  225. /package/dist/{portal.d.ts → components/portal.d.ts} +0 -0
  226. /package/dist/{router → components/router}/index.d.ts +0 -0
  227. /package/dist/{router → components/router}/index.js +0 -0
  228. /package/dist/{router → components/router}/route.d.ts +0 -0
  229. /package/dist/{router → components/router}/routerUtils.d.ts +0 -0
  230. /package/dist/{router → components/router}/routerUtils.js +0 -0
  231. /package/dist/{transition.d.ts → components/transition.d.ts} +0 -0
  232. /package/dist/{generateId.d.ts → utils/generateId.d.ts} +0 -0
  233. /package/dist/{generateId.js → utils/generateId.js} +0 -0
  234. /package/src/{router → components/router}/index.ts +0 -0
  235. /package/src/{router → components/router}/routerUtils.ts +0 -0
  236. /package/src/{generateId.ts → utils/generateId.ts} +0 -0
@@ -0,0 +1,124 @@
1
+ import { Signal } from "../signals/index.js";
2
+ import { FLAG_DELETION, $FRAGMENT, $CONTEXT_PROVIDER, $HYDRATION_BOUNDARY, FLAG_PLACEMENT, FLAG_UPDATE, } from "../constants.js";
3
+ import { createElement } from "../index.js";
4
+ import { KiruError } from "../error.js";
5
+ import { node } from "../globals.js";
6
+ export { cloneVNode, isVNodeDeleted, isVNode, isExoticType, isFragment, isLazy, isMemo, isContextProvider, vNodeContains, getCurrentVNode, getVNodeAppContext, commitSnapshot, traverseApply, findParent, assertValidElementProps, isValidElementKeyProp, isValidElementRefProp, };
7
+ function cloneVNode(vNode) {
8
+ const children = vNode.props.children;
9
+ let clonedChildren;
10
+ if (isVNode(children)) {
11
+ clonedChildren = cloneVNode(children);
12
+ }
13
+ else if (Array.isArray(children)) {
14
+ clonedChildren = children.map((c) => (isVNode(c) ? cloneVNode(c) : c));
15
+ }
16
+ return createElement(vNode.type, { ...vNode.props, children: clonedChildren });
17
+ }
18
+ function isVNodeDeleted(vNode) {
19
+ return (vNode.flags & FLAG_DELETION) !== 0;
20
+ }
21
+ function isVNode(thing) {
22
+ return typeof thing === "object" && thing !== null && "type" in thing;
23
+ }
24
+ function isExoticType(type) {
25
+ return (type === $FRAGMENT ||
26
+ type === $CONTEXT_PROVIDER ||
27
+ type === $HYDRATION_BOUNDARY);
28
+ }
29
+ function isFragment(vNode) {
30
+ return vNode.type === $FRAGMENT;
31
+ }
32
+ function isLazy(vNode) {
33
+ return (typeof vNode.type === "function" &&
34
+ "displayName" in vNode.type &&
35
+ vNode.type.displayName === "Kiru.lazy");
36
+ }
37
+ function isMemo(vNode) {
38
+ return (typeof vNode.type === "function" &&
39
+ "displayName" in vNode.type &&
40
+ vNode.type.displayName === "Kiru.memo");
41
+ }
42
+ function isContextProvider(thing) {
43
+ return isVNode(thing) && thing.type === $CONTEXT_PROVIDER;
44
+ }
45
+ function getCurrentVNode() {
46
+ return node.current;
47
+ }
48
+ function getVNodeAppContext(vNode) {
49
+ let n = vNode;
50
+ while (n) {
51
+ if (n.app) {
52
+ return (vNode.app = n.app);
53
+ }
54
+ n = n.parent;
55
+ }
56
+ return null;
57
+ }
58
+ function commitSnapshot(vNode) {
59
+ const { props: { children, ...props }, memoizedProps, index, } = vNode;
60
+ vNode.prev = { props, memoizedProps, index };
61
+ vNode.flags &= ~(FLAG_UPDATE | FLAG_PLACEMENT | FLAG_DELETION);
62
+ }
63
+ function vNodeContains(haystack, needle) {
64
+ if (needle.depth < haystack.depth)
65
+ return false;
66
+ if (haystack === needle)
67
+ return true;
68
+ let checkSiblings = false;
69
+ const stack = [haystack];
70
+ while (stack.length) {
71
+ const n = stack.pop();
72
+ if (n === needle)
73
+ return true;
74
+ n.child && stack.push(n.child);
75
+ checkSiblings && n.sibling && stack.push(n.sibling);
76
+ checkSiblings = true;
77
+ }
78
+ return false;
79
+ }
80
+ function traverseApply(vNode, func) {
81
+ func(vNode);
82
+ let child = vNode.child;
83
+ while (child) {
84
+ func(child);
85
+ if (child.child) {
86
+ traverseApply(child, func);
87
+ }
88
+ child = child.sibling;
89
+ }
90
+ }
91
+ function findParent(vNode, predicate) {
92
+ let n = vNode.parent;
93
+ while (n) {
94
+ if (predicate(n))
95
+ return n;
96
+ n = n.parent;
97
+ }
98
+ return null;
99
+ }
100
+ function assertValidElementProps(vNode) {
101
+ if ("children" in vNode.props && vNode.props.innerHTML) {
102
+ throw new KiruError({
103
+ message: "Cannot use both children and innerHTML on an element",
104
+ vNode,
105
+ });
106
+ }
107
+ for (const key in vNode.props) {
108
+ if ("bind:" + key in vNode.props) {
109
+ throw new KiruError({
110
+ message: `Cannot use both bind:${key} and ${key} on an element`,
111
+ vNode,
112
+ });
113
+ }
114
+ }
115
+ }
116
+ function isValidElementKeyProp(thing) {
117
+ return typeof thing === "string" || typeof thing === "number";
118
+ }
119
+ function isValidElementRefProp(thing) {
120
+ return (typeof thing === "function" ||
121
+ (typeof thing === "object" && !!thing && "current" in thing) ||
122
+ Signal.isSignal(thing));
123
+ }
124
+ //# sourceMappingURL=vdom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vdom.js","sourceRoot":"","sources":["../../src/utils/vdom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EACL,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,WAAW,GACZ,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAGpC,OAAO,EACL,UAAU,EACV,cAAc,EACd,OAAO,EACP,YAAY,EACZ,UAAU,EACV,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,UAAU,EACV,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,GACtB,CAAA;AAED,SAA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,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;QACvD,MAAM,IAAI,SAAS,CAAC;YAClB,OAAO,EAAE,sDAAsD;YAC/D,KAAK;SACN,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,OAAO,GAAG,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YACjC,MAAM,IAAI,SAAS,CAAC;gBAClB,OAAO,EAAE,wBAAwB,GAAG,QAAQ,GAAG,gBAAgB;gBAC/D,KAAK;aACN,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAc;IAC3C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAA;AAC/D,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAc;IAC3C,OAAO,CACL,OAAO,KAAK,KAAK,UAAU;QAC3B,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAC,KAAK,IAAI,SAAS,IAAI,KAAK,CAAC;QAC5D,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CACvB,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kiru",
3
- "version": "0.48.3",
3
+ "version": "0.49.0",
4
4
  "description": "A batteries-included, easy-to-use rendering library with a tiny footprint",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -15,16 +15,16 @@
15
15
  "default": "./dist/form/index.js"
16
16
  },
17
17
  "./router": {
18
- "types": "./dist/router/index.d.ts",
19
- "default": "./dist/router/index.js"
18
+ "types": "./dist/components/router/index.d.ts",
19
+ "default": "./dist/components/router/index.js"
20
20
  },
21
21
  "./swr": {
22
22
  "types": "./dist/swr.d.ts",
23
23
  "default": "./dist/swr.js"
24
24
  },
25
25
  "./utils": {
26
- "types": "./dist/utils.d.ts",
27
- "default": "./dist/utils.js"
26
+ "types": "./dist/utils/index.d.ts",
27
+ "default": "./dist/utils/index.js"
28
28
  },
29
29
  "./ssr": {
30
30
  "types": "./dist/ssr/index.d.ts",
@@ -75,7 +75,7 @@
75
75
  },
76
76
  "scripts": {
77
77
  "build": "rm -rf dist && pnpm i && tsc",
78
- "test": "node --test",
78
+ "test": "node --test dist/**/*.test.js",
79
79
  "dev": "tsc --watch"
80
80
  }
81
81
  }
package/src/action.ts ADDED
@@ -0,0 +1,42 @@
1
+ export type ActionResult<T> =
2
+ | {
3
+ error: ActionError
4
+ data: null
5
+ }
6
+ | {
7
+ error: null
8
+ data: T
9
+ }
10
+
11
+ export interface ActionConfig<T> {
12
+ /**
13
+ * Executes the action and returns the result.
14
+ */
15
+ execute: () => Promise<T>
16
+ /**
17
+ * Called when the action fails.
18
+ */
19
+ onError?: (error: ActionError) => void
20
+ }
21
+
22
+ export class ActionError extends Error {
23
+ constructor(cause: unknown) {
24
+ super("Error occurred during action execution", { cause })
25
+ }
26
+ }
27
+
28
+ export function defineAction<T extends readonly unknown[], R>(
29
+ callback: (...args: T) => ActionConfig<R>
30
+ ): (...args: T) => Promise<ActionResult<R>> {
31
+ return async (...args: T) => {
32
+ const { execute, onError } = callback(...args)
33
+ try {
34
+ const data = await execute()
35
+ return { error: null, data }
36
+ } catch (e) {
37
+ const error = new ActionError(e)
38
+ onError?.(error)
39
+ return { error, data: null }
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./lazy.js"
2
+ export { memo } from "./memo.js"
3
+ export * from "./portal.js"
4
+ export * from "./transition.js"
@@ -1,18 +1,18 @@
1
- import { createElement } from "./element.js"
2
- import { __DEV__ } from "./env.js"
3
- import { KiruError } from "./error.js"
4
- import { node, renderMode } from "./globals.js"
5
- import { useContext } from "./hooks/useContext.js"
6
- import { useRef } from "./hooks/useRef.js"
7
- import { useRequestUpdate } from "./hooks/utils.js"
8
- import { hydrationStack } from "./hydration.js"
9
- import { flushSync, nextIdle } from "./scheduler.js"
1
+ import { createElement } from "../element.js"
2
+ import { __DEV__ } from "../env.js"
3
+ import { KiruError } from "../error.js"
4
+ import { node, renderMode } from "../globals.js"
5
+ import { useContext } from "../hooks/useContext.js"
6
+ import { useRef } from "../hooks/useRef.js"
7
+ import { useRequestUpdate } from "../hooks/utils.js"
8
+ import { hydrationStack } from "../hydration.js"
9
+ import { flushSync, nextIdle } from "../scheduler.js"
10
10
  import {
11
11
  HYDRATION_BOUNDARY_MARKER,
12
12
  HydrationBoundaryContext,
13
- } from "./ssr/hydrationBoundary.js"
14
- import type { SomeDom } from "./types.utils"
15
- import { noop } from "./utils.js"
13
+ } from "../ssr/hydrationBoundary.js"
14
+ import { noop } from "../utils/index.js"
15
+ import type { SomeDom } from "../types.utils"
16
16
 
17
17
  interface FCModule {
18
18
  default: Kiru.FC<any>
@@ -1,6 +1,6 @@
1
- import { $MEMO } from "./constants.js"
2
- import { createElement } from "./element.js"
3
- import { __DEV__ } from "./env.js"
1
+ import { $MEMO } from "../constants.js"
2
+ import { createElement } from "../element.js"
3
+ import { __DEV__ } from "../env.js"
4
4
 
5
5
  function _arePropsEqual<T extends Record<string, unknown>>(
6
6
  prevProps: T,
@@ -1,9 +1,9 @@
1
- import { FLAG_STATIC_DOM } from "./constants.js"
2
- import { __DEV__ } from "./env.js"
3
- import { KiruError } from "./error.js"
4
- import { renderMode } from "./globals.js"
5
- import { useVNode } from "./hooks/utils.js"
6
- import { nextIdle, requestUpdate } from "./scheduler.js"
1
+ import { FLAG_STATIC_DOM } from "../constants.js"
2
+ import { __DEV__ } from "../env.js"
3
+ import { KiruError } from "../error.js"
4
+ import { renderMode } from "../globals.js"
5
+ import { useVNode } from "../hooks/utils.js"
6
+ import { nextIdle, requestUpdate } from "../scheduler.js"
7
7
 
8
8
  interface PortalProps {
9
9
  children?: JSX.Children
@@ -1,4 +1,4 @@
1
- import { isVNode } from "../utils.js"
1
+ import { isVNode } from "../../utils/index.js"
2
2
 
3
3
  interface RouteProps {
4
4
  /**
@@ -1,23 +1,23 @@
1
- import { createElement } from "../element.js"
1
+ import { createElement } from "../../element.js"
2
2
  import {
3
3
  useState,
4
4
  useMemo,
5
5
  useContext,
6
6
  useLayoutEffect,
7
7
  useRef,
8
- } from "../hooks/index.js"
9
- import { __DEV__ } from "../env.js"
8
+ } from "../../hooks/index.js"
9
+ import { __DEV__ } from "../../env.js"
10
+ import { createContext } from "../../context.js"
11
+ import { isRoute, Route } from "./route.js"
12
+ import { noop } from "../../utils/index.js"
13
+ import { node } from "../../globals.js"
14
+ import type { ElementProps } from "../../types.js"
15
+ import { flushSync, nextIdle } from "../../scheduler.js"
10
16
  import {
11
17
  parsePathParams,
12
18
  parseSearchParams,
13
19
  routeMatchesPath,
14
20
  } from "./routerUtils.js"
15
- import { createContext } from "../context.js"
16
- import { isRoute, Route } from "./route.js"
17
- import { noop } from "../utils.js"
18
- import { node } from "../globals.js"
19
- import type { ElementProps } from "../types"
20
- import { flushSync, nextIdle } from "../scheduler.js"
21
21
 
22
22
  export interface LinkProps extends Omit<ElementProps<"a">, "href"> {
23
23
  /**
@@ -1,8 +1,8 @@
1
- import { useCallback } from "./hooks/useCallback.js"
2
- import { useEffect } from "./hooks/useEffect.js"
3
- import { useLayoutEffect } from "./hooks/useLayoutEffect.js"
4
- import { useRef } from "./hooks/useRef.js"
5
- import { useState } from "./hooks/useState.js"
1
+ import { useCallback } from "../hooks/useCallback.js"
2
+ import { useEffect } from "../hooks/useEffect.js"
3
+ import { useLayoutEffect } from "../hooks/useLayoutEffect.js"
4
+ import { useRef } from "../hooks/useRef.js"
5
+ import { useState } from "../hooks/useState.js"
6
6
 
7
7
  export type TransitionState = "entering" | "entered" | "exiting" | "exited"
8
8
  interface TransitionProps {
package/src/constants.ts CHANGED
@@ -19,7 +19,7 @@ export {
19
19
  FLAG_DIRTY,
20
20
  }
21
21
 
22
- export { voidElements, svgTags, booleanAttributes }
22
+ export { voidElements, svgTags, booleanAttributes, snakeCaseAttributes }
23
23
 
24
24
  const $SIGNAL = Symbol.for("kiru.signal")
25
25
  const $CONTEXT = Symbol.for("kiru.context")
@@ -155,3 +155,82 @@ const booleanAttributes = new Set([
155
155
  "translate",
156
156
  "wrap",
157
157
  ])
158
+
159
+ const snakeCaseAttributes = new Map([
160
+ ["acceptCharset", "accept-charset"],
161
+ ["accentHeight", "accent-height"],
162
+ ["alignmentBaseline", "alignment-baseline"],
163
+ ["arabicForm", "arabic-form"],
164
+ ["baselineShift", "baseline-shift"],
165
+ ["capHeight", "cap-height"],
166
+ ["clipPath", "clip-path"],
167
+ ["clipRule", "clip-rule"],
168
+ ["colorInterpolation", "color-interpolation"],
169
+ ["colorInterpolationFilters", "color-interpolation-filters"],
170
+ ["colorProfile", "color-profile"],
171
+ ["colorRendering", "color-rendering"],
172
+ ["dominantBaseline", "dominant-baseline"],
173
+ ["enableBackground", "enable-background"],
174
+ ["fillOpacity", "fill-opacity"],
175
+ ["fillRule", "fill-rule"],
176
+ ["floodColor", "flood-color"],
177
+ ["floodOpacity", "flood-opacity"],
178
+ ["fontFamily", "font-family"],
179
+ ["fontSize", "font-size"],
180
+ ["fontSizeAdjust", "font-size-adjust"],
181
+ ["fontStretch", "font-stretch"],
182
+ ["fontStyle", "font-style"],
183
+ ["fontVariant", "font-variant"],
184
+ ["fontWeight", "font-weight"],
185
+ ["glyphName", "glyph-name"],
186
+ ["glyphOrientationHorizontal", "glyph-orientation-horizontal"],
187
+ ["glyphOrientationVertical", "glyph-orientation-vertical"],
188
+ ["horizAdvX", "horiz-adv-x"],
189
+ ["horizOriginX", "horiz-origin-x"],
190
+ ["httpEquiv", "http-equiv"],
191
+ ["imageRendering", "image-rendering"],
192
+ ["letterSpacing", "letter-spacing"],
193
+ ["lightingColor", "lighting-color"],
194
+ ["markerEnd", "marker-end"],
195
+ ["markerMid", "marker-mid"],
196
+ ["markerStart", "marker-start"],
197
+ ["overlinePosition", "overline-position"],
198
+ ["overlineThickness", "overline-thickness"],
199
+ ["paintOrder", "paint-order"],
200
+ ["panose-1", "panose-1"],
201
+ ["pointerEvents", "pointer-events"],
202
+ ["renderingIntent", "rendering-intent"],
203
+ ["shapeRendering", "shape-rendering"],
204
+ ["stopColor", "stop-color"],
205
+ ["stopOpacity", "stop-opacity"],
206
+ ["strikethroughPosition", "strikethrough-position"],
207
+ ["strikethroughThickness", "strikethrough-thickness"],
208
+ ["strokeDasharray", "stroke-dasharray"],
209
+ ["strokeDashoffset", "stroke-dashoffset"],
210
+ ["strokeLinecap", "stroke-linecap"],
211
+ ["strokeLinejoin", "stroke-linejoin"],
212
+ ["strokeMiterlimit", "stroke-miterlimit"],
213
+ ["strokeOpacity", "stroke-opacity"],
214
+ ["strokeWidth", "stroke-width"],
215
+ ["textAnchor", "text-anchor"],
216
+ ["textDecoration", "text-decoration"],
217
+ ["textRendering", "text-rendering"],
218
+ ["transformOrigin", "transform-origin"],
219
+ ["underlinePosition", "underline-position"],
220
+ ["underlineThickness", "underline-thickness"],
221
+ ["unicodeBidi", "unicode-bidi"],
222
+ ["unicodeRange", "unicode-range"],
223
+ ["unitsPerEm", "units-per-em"],
224
+ ["vAlphabetic", "v-alphabetic"],
225
+ ["vHanging", "v-hanging"],
226
+ ["vIdeographic", "v-ideographic"],
227
+ ["vMathematical", "v-mathematical"],
228
+ ["vectorEffect", "vector-effect"],
229
+ ["vertAdvY", "vert-adv-y"],
230
+ ["vertOriginX", "vert-origin-x"],
231
+ ["vertOriginY", "vert-origin-y"],
232
+ ["wordSpacing", "word-spacing"],
233
+ ["writingMode", "writing-mode"],
234
+ ["xmlnsXlink", "xmlns:xlink"],
235
+ ["xHeight", "x-height"],
236
+ ])
package/src/context.ts CHANGED
@@ -4,7 +4,7 @@ import { __DEV__ } from "./env.js"
4
4
  import { GenericHMRAcceptor } from "./hmr.js"
5
5
  import { useState } from "./hooks/useState.js"
6
6
  import { requestUpdate } from "./scheduler.js"
7
- import { traverseApply } from "./utils.js"
7
+ import { traverseApply } from "./utils/index.js"
8
8
 
9
9
  export function createContext<T>(defaultValue: T): Kiru.Context<T> {
10
10
  const ctx: Kiru.Context<T> = {
@@ -1,22 +1,22 @@
1
- export class CustomEvents {
2
- private constructor() {}
3
-
4
- static on<K extends keyof Kiru.CustomEvents & string>(
5
- type: K,
6
- callback: (event: CustomEvent<Kiru.CustomEvents[K]>) => void
7
- ) {
8
- window.addEventListener(type, callback as unknown as EventListener)
9
- return () =>
10
- window.removeEventListener(type, callback as unknown as EventListener)
11
- }
12
-
13
- static dispatch<K extends keyof Kiru.CustomEvents & string>(
14
- type: K,
15
- detail: Kiru.CustomEvents[K],
16
- target?: Element
17
- ) {
18
- ;(target || document).dispatchEvent(
19
- new CustomEvent(type, { detail, bubbles: true })
20
- )
21
- }
22
- }
1
+ export class CustomEvents {
2
+ private constructor() {}
3
+
4
+ static on<K extends keyof Kiru.CustomEvents & string>(
5
+ type: K,
6
+ callback: (event: CustomEvent<Kiru.CustomEvents[K]>) => void
7
+ ) {
8
+ window.addEventListener(type, callback as unknown as EventListener)
9
+ return () =>
10
+ window.removeEventListener(type, callback as unknown as EventListener)
11
+ }
12
+
13
+ static dispatch<K extends keyof Kiru.CustomEvents & string>(
14
+ type: K,
15
+ detail: Kiru.CustomEvents[K],
16
+ target?: Element
17
+ ) {
18
+ ;(target || document).dispatchEvent(
19
+ new CustomEvent(type, { detail, bubbles: true })
20
+ )
21
+ }
22
+ }
package/src/dom.ts CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  propFilters,
5
5
  propToHtmlAttr,
6
6
  getVNodeAppContext,
7
- } from "./utils.js"
7
+ } from "./utils/index.js"
8
8
  import {
9
9
  booleanAttributes,
10
10
  FLAG_PLACEMENT,
@@ -100,15 +100,14 @@ function createDom(vNode: DomVNode): SomeDom {
100
100
  return dom
101
101
  }
102
102
  function createTextNode(vNode: VNode): Text {
103
- const nodeValue = vNode.props.nodeValue
104
- if (Signal.isSignal(nodeValue)) {
105
- const value = nodeValue.peek()
106
- const textNode = document.createTextNode(value)
107
- subTextNode(vNode, textNode, nodeValue)
108
- return textNode
103
+ const { nodeValue } = vNode.props
104
+ if (!Signal.isSignal(nodeValue)) {
105
+ return document.createTextNode(nodeValue)
109
106
  }
110
107
 
111
- const textNode = document.createTextNode(nodeValue)
108
+ const value = nodeValue.peek() ?? ""
109
+ const textNode = document.createTextNode(value)
110
+ subTextNode(vNode, textNode, nodeValue)
112
111
  return textNode
113
112
  }
114
113
 
package/src/element.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { $FRAGMENT, $MEMO, FLAG_MEMO } from "./constants.js"
2
- import { isMemoFn } from "./memo.js"
3
- import { isValidElementKeyProp, isValidElementRefProp } from "./props.js"
2
+ import { isMemoFn } from "./components/memo.js"
3
+ import { isValidElementKeyProp, isValidElementRefProp } from "./utils/index.js"
4
4
 
5
5
  export function createElement<T extends Kiru.VNode["type"]>(
6
6
  type: T,
package/src/error.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { $KIRU_ERROR } from "./constants.js"
2
2
  import { __DEV__ } from "./env.js"
3
- import { findParent, noop } from "./utils.js"
3
+ import { findParent, noop } from "./utils/index.js"
4
4
 
5
5
  type KiruErrorOptions =
6
6
  | string
package/src/form/index.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import { __DEV__ } from "../env.js"
2
2
  import { Fragment } from "../element.js"
3
- import { generateRandomID } from "../generateId.js"
4
- import { safeStringify, shallowCompare } from "../utils.js"
3
+ import {
4
+ safeStringify,
5
+ shallowCompare,
6
+ generateRandomID,
7
+ } from "../utils/index.js"
5
8
  import { useEffect } from "../hooks/useEffect.js"
6
9
  import { useMemo } from "../hooks/useMemo.js"
7
10
  import { useRef } from "../hooks/useRef.js"
package/src/hmr.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { $HMR_ACCEPT } from "./constants.js"
2
2
  import { __DEV__ } from "./env.js"
3
- import { traverseApply } from "./utils.js"
3
+ import { traverseApply } from "./utils/index.js"
4
4
  import { requestUpdate } from "./scheduler.js"
5
5
  import { Signal } from "./signals/base.js"
6
6
  import type { WatchEffect } from "./signals/watch.js"
@@ -1,6 +1,6 @@
1
1
  import { __DEV__ } from "../env.js"
2
- import { noop } from "../utils.js"
3
- import { depsRequireChange, sideEffectsEnabled, useHook } from "./utils.js"
2
+ import { noop, sideEffectsEnabled } from "../utils/index.js"
3
+ import { depsRequireChange, useHook } from "./utils.js"
4
4
  import type { AsyncTaskState } from "../types.utils.js"
5
5
 
6
6
  export type UseAsyncState<T> = AsyncTaskState<T, UseAsyncError> & {
@@ -48,7 +48,9 @@ export function useAsync<T>(
48
48
  deps,
49
49
  id: 0,
50
50
  task: null as any as InternalTaskState<T>,
51
- load: noop as (func: (ctx: UseAsyncCallbackContext) => Promise<T>) => void,
51
+ load: noop as (
52
+ func: (ctx: UseAsyncCallbackContext) => Promise<T>
53
+ ) => void,
52
54
  },
53
55
  ({ hook, isInit, isHMR, update }) => {
54
56
  if (__DEV__) {
@@ -1,5 +1,6 @@
1
1
  import { __DEV__ } from "../env.js"
2
- import { depsRequireChange, useHook, sideEffectsEnabled } from "./utils.js"
2
+ import { sideEffectsEnabled } from "../utils/index.js"
3
+ import { depsRequireChange, useHook } from "./utils.js"
3
4
 
4
5
  /**
5
6
  * Creates a memoized callback function.
@@ -1,10 +1,6 @@
1
+ import { sideEffectsEnabled } from "../utils/index.js"
1
2
  import { __DEV__ } from "../env.js"
2
- import {
3
- cleanupHook,
4
- depsRequireChange,
5
- sideEffectsEnabled,
6
- useHook,
7
- } from "./utils.js"
3
+ import { cleanupHook, depsRequireChange, useHook } from "./utils.js"
8
4
 
9
5
  /**
10
6
  * Runs a function after the component is rendered, or when a value provided in the optional [dependency
@@ -1,6 +1,7 @@
1
+ import { sideEffectsEnabled } from "../utils/index.js"
1
2
  import { node } from "../globals.js"
2
3
  import { __DEV__ } from "../env.js"
3
- import { sideEffectsEnabled, useHook } from "./utils.js"
4
+ import { useHook } from "./utils.js"
4
5
 
5
6
  /**
6
7
  * Wraps a function to be called within effects and other callbacks.
@@ -1,10 +1,6 @@
1
+ import { sideEffectsEnabled } from "../utils/index.js"
1
2
  import { __DEV__ } from "../env.js"
2
- import {
3
- cleanupHook,
4
- depsRequireChange,
5
- sideEffectsEnabled,
6
- useHook,
7
- } from "./utils.js"
3
+ import { cleanupHook, depsRequireChange, useHook } from "./utils.js"
8
4
 
9
5
  /**
10
6
  * Runs a function before the component is rendered, or when a value provided in the optional [dependency
@@ -1,5 +1,6 @@
1
+ import { sideEffectsEnabled } from "../utils/index.js"
1
2
  import { __DEV__ } from "../env.js"
2
- import { depsRequireChange, sideEffectsEnabled, useHook } from "./utils.js"
3
+ import { depsRequireChange, useHook } from "./utils.js"
3
4
 
4
5
  /**
5
6
  * Creates a memoized value that only changes when the [dependency
@@ -1,6 +1,6 @@
1
1
  import { __DEV__ } from "../env.js"
2
- import { noop } from "../utils.js"
3
- import { sideEffectsEnabled, useHook } from "./utils.js"
2
+ import { noop, sideEffectsEnabled } from "../utils/index.js"
3
+ import { useHook } from "./utils.js"
4
4
 
5
5
  /**
6
6
  * Creates 'dispatcher-driven' state.
@@ -1,5 +1,6 @@
1
1
  import { __DEV__ } from "../env.js"
2
- import { sideEffectsEnabled, useHook } from "./utils.js"
2
+ import { sideEffectsEnabled } from "../utils/index.js"
3
+ import { useHook } from "./utils.js"
3
4
 
4
5
  /**
5
6
  * Creates a ref object. Useful for persisting values between renders or getting