@faiwer/react 0.8.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 (246) hide show
  1. package/README.md +90 -0
  2. package/dist/core/actions/applyAction.d.ts +11 -0
  3. package/dist/core/actions/applyAction.d.ts.map +1 -0
  4. package/dist/core/actions/applyAction.js +35 -0
  5. package/dist/core/actions/applyAction.js.map +1 -0
  6. package/dist/core/actions/createComment.action.d.ts +7 -0
  7. package/dist/core/actions/createComment.action.d.ts.map +1 -0
  8. package/dist/core/actions/createComment.action.js +20 -0
  9. package/dist/core/actions/createComment.action.js.map +1 -0
  10. package/dist/core/actions/createTag.action.d.ts +10 -0
  11. package/dist/core/actions/createTag.action.d.ts.map +1 -0
  12. package/dist/core/actions/createTag.action.js +27 -0
  13. package/dist/core/actions/createTag.action.js.map +1 -0
  14. package/dist/core/actions/createText.action.d.ts +6 -0
  15. package/dist/core/actions/createText.action.d.ts.map +1 -0
  16. package/dist/core/actions/createText.action.js +16 -0
  17. package/dist/core/actions/createText.action.js.map +1 -0
  18. package/dist/core/actions/helpers.d.ts +43 -0
  19. package/dist/core/actions/helpers.d.ts.map +1 -0
  20. package/dist/core/actions/helpers.js +141 -0
  21. package/dist/core/actions/helpers.js.map +1 -0
  22. package/dist/core/actions/relayout.action.d.ts +20 -0
  23. package/dist/core/actions/relayout.action.d.ts.map +1 -0
  24. package/dist/core/actions/relayout.action.js +113 -0
  25. package/dist/core/actions/relayout.action.js.map +1 -0
  26. package/dist/core/actions/remove.action.d.ts +7 -0
  27. package/dist/core/actions/remove.action.d.ts.map +1 -0
  28. package/dist/core/actions/remove.action.js +64 -0
  29. package/dist/core/actions/remove.action.js.map +1 -0
  30. package/dist/core/actions/replace.action.d.ts +18 -0
  31. package/dist/core/actions/replace.action.d.ts.map +1 -0
  32. package/dist/core/actions/replace.action.js +57 -0
  33. package/dist/core/actions/replace.action.js.map +1 -0
  34. package/dist/core/actions/setAttr.action.d.ts +9 -0
  35. package/dist/core/actions/setAttr.action.d.ts.map +1 -0
  36. package/dist/core/actions/setAttr.action.js +62 -0
  37. package/dist/core/actions/setAttr.action.js.map +1 -0
  38. package/dist/core/actions/setProps.action.d.ts +8 -0
  39. package/dist/core/actions/setProps.action.d.ts.map +1 -0
  40. package/dist/core/actions/setProps.action.js +13 -0
  41. package/dist/core/actions/setProps.action.js.map +1 -0
  42. package/dist/core/actions/setRef.action.d.ts +11 -0
  43. package/dist/core/actions/setRef.action.d.ts.map +1 -0
  44. package/dist/core/actions/setRef.action.js +38 -0
  45. package/dist/core/actions/setRef.action.js.map +1 -0
  46. package/dist/core/actions/setText.action.d.ts +7 -0
  47. package/dist/core/actions/setText.action.d.ts.map +1 -0
  48. package/dist/core/actions/setText.action.js +12 -0
  49. package/dist/core/actions/setText.action.js.map +1 -0
  50. package/dist/core/compact.d.ts +38 -0
  51. package/dist/core/compact.d.ts.map +1 -0
  52. package/dist/core/compact.js +112 -0
  53. package/dist/core/compact.js.map +1 -0
  54. package/dist/core/components.d.ts +32 -0
  55. package/dist/core/components.d.ts.map +1 -0
  56. package/dist/core/components.js +57 -0
  57. package/dist/core/components.js.map +1 -0
  58. package/dist/core/createElement.d.ts +47 -0
  59. package/dist/core/createElement.d.ts.map +1 -0
  60. package/dist/core/createElement.js +73 -0
  61. package/dist/core/createElement.js.map +1 -0
  62. package/dist/core/createRoot.d.ts +13 -0
  63. package/dist/core/createRoot.d.ts.map +1 -0
  64. package/dist/core/createRoot.js +33 -0
  65. package/dist/core/createRoot.js.map +1 -0
  66. package/dist/core/reactNodeToFiberNode.d.ts +8 -0
  67. package/dist/core/reactNodeToFiberNode.d.ts.map +1 -0
  68. package/dist/core/reactNodeToFiberNode.js +132 -0
  69. package/dist/core/reactNodeToFiberNode.js.map +1 -0
  70. package/dist/core/reconciliation/app.d.ts +5 -0
  71. package/dist/core/reconciliation/app.d.ts.map +1 -0
  72. package/dist/core/reconciliation/app.js +20 -0
  73. package/dist/core/reconciliation/app.js.map +1 -0
  74. package/dist/core/reconciliation/applyActions.d.ts +8 -0
  75. package/dist/core/reconciliation/applyActions.d.ts.map +1 -0
  76. package/dist/core/reconciliation/applyActions.js +12 -0
  77. package/dist/core/reconciliation/applyActions.js.map +1 -0
  78. package/dist/core/reconciliation/collect/fromApp.d.ts +9 -0
  79. package/dist/core/reconciliation/collect/fromApp.d.ts.map +1 -0
  80. package/dist/core/reconciliation/collect/fromApp.js +39 -0
  81. package/dist/core/reconciliation/collect/fromApp.js.map +1 -0
  82. package/dist/core/reconciliation/collect/fromChildrenPair.d.ts +9 -0
  83. package/dist/core/reconciliation/collect/fromChildrenPair.d.ts.map +1 -0
  84. package/dist/core/reconciliation/collect/fromChildrenPair.js +127 -0
  85. package/dist/core/reconciliation/collect/fromChildrenPair.js.map +1 -0
  86. package/dist/core/reconciliation/collect/fromComponent.d.ts +10 -0
  87. package/dist/core/reconciliation/collect/fromComponent.d.ts.map +1 -0
  88. package/dist/core/reconciliation/collect/fromComponent.js +22 -0
  89. package/dist/core/reconciliation/collect/fromComponent.js.map +1 -0
  90. package/dist/core/reconciliation/collect/fromFiberPair.d.ts +9 -0
  91. package/dist/core/reconciliation/collect/fromFiberPair.d.ts.map +1 -0
  92. package/dist/core/reconciliation/collect/fromFiberPair.js +125 -0
  93. package/dist/core/reconciliation/collect/fromFiberPair.js.map +1 -0
  94. package/dist/core/reconciliation/collect/fromNewFiber.d.ts +7 -0
  95. package/dist/core/reconciliation/collect/fromNewFiber.d.ts.map +1 -0
  96. package/dist/core/reconciliation/collect/fromNewFiber.js +45 -0
  97. package/dist/core/reconciliation/collect/fromNewFiber.js.map +1 -0
  98. package/dist/core/reconciliation/comments.d.ts +3 -0
  99. package/dist/core/reconciliation/comments.d.ts.map +1 -0
  100. package/dist/core/reconciliation/comments.js +3 -0
  101. package/dist/core/reconciliation/comments.js.map +1 -0
  102. package/dist/core/reconciliation/compare/areFiberNodesEq.d.ts +7 -0
  103. package/dist/core/reconciliation/compare/areFiberNodesEq.d.ts.map +1 -0
  104. package/dist/core/reconciliation/compare/areFiberNodesEq.js +14 -0
  105. package/dist/core/reconciliation/compare/areFiberNodesEq.js.map +1 -0
  106. package/dist/core/reconciliation/compare/areFiberPropsEq.d.ts +7 -0
  107. package/dist/core/reconciliation/compare/areFiberPropsEq.d.ts.map +1 -0
  108. package/dist/core/reconciliation/compare/areFiberPropsEq.js +18 -0
  109. package/dist/core/reconciliation/compare/areFiberPropsEq.js.map +1 -0
  110. package/dist/core/reconciliation/effects.d.ts +14 -0
  111. package/dist/core/reconciliation/effects.d.ts.map +1 -0
  112. package/dist/core/reconciliation/effects.js +26 -0
  113. package/dist/core/reconciliation/effects.js.map +1 -0
  114. package/dist/core/reconciliation/fibers.d.ts +35 -0
  115. package/dist/core/reconciliation/fibers.d.ts.map +1 -0
  116. package/dist/core/reconciliation/fibers.js +51 -0
  117. package/dist/core/reconciliation/fibers.js.map +1 -0
  118. package/dist/core/reconciliation/invalidateFiber.d.ts +8 -0
  119. package/dist/core/reconciliation/invalidateFiber.d.ts.map +1 -0
  120. package/dist/core/reconciliation/invalidateFiber.js +28 -0
  121. package/dist/core/reconciliation/invalidateFiber.js.map +1 -0
  122. package/dist/core/reconciliation/mount.d.ts +7 -0
  123. package/dist/core/reconciliation/mount.d.ts.map +1 -0
  124. package/dist/core/reconciliation/mount.js +53 -0
  125. package/dist/core/reconciliation/mount.js.map +1 -0
  126. package/dist/core/reconciliation/postCommit.d.ts +11 -0
  127. package/dist/core/reconciliation/postCommit.d.ts.map +1 -0
  128. package/dist/core/reconciliation/postCommit.js +47 -0
  129. package/dist/core/reconciliation/postCommit.js.map +1 -0
  130. package/dist/core/reconciliation/render.d.ts +11 -0
  131. package/dist/core/reconciliation/render.d.ts.map +1 -0
  132. package/dist/core/reconciliation/render.js +35 -0
  133. package/dist/core/reconciliation/render.js.map +1 -0
  134. package/dist/core/reconciliation/runFiberComponents.d.ts +10 -0
  135. package/dist/core/reconciliation/runFiberComponents.d.ts.map +1 -0
  136. package/dist/core/reconciliation/runFiberComponents.js +37 -0
  137. package/dist/core/reconciliation/runFiberComponents.js.map +1 -0
  138. package/dist/core/reconciliation/typeGuards.d.ts +12 -0
  139. package/dist/core/reconciliation/typeGuards.d.ts.map +1 -0
  140. package/dist/core/reconciliation/typeGuards.js +32 -0
  141. package/dist/core/reconciliation/typeGuards.js.map +1 -0
  142. package/dist/core/reconciliation/validateTree.d.ts +6 -0
  143. package/dist/core/reconciliation/validateTree.d.ts.map +1 -0
  144. package/dist/core/reconciliation/validateTree.js +48 -0
  145. package/dist/core/reconciliation/validateTree.js.map +1 -0
  146. package/dist/hooks/helpers.d.ts +19 -0
  147. package/dist/hooks/helpers.d.ts.map +1 -0
  148. package/dist/hooks/helpers.js +40 -0
  149. package/dist/hooks/helpers.js.map +1 -0
  150. package/dist/hooks/index.d.ts +9 -0
  151. package/dist/hooks/index.d.ts.map +1 -0
  152. package/dist/hooks/index.js +9 -0
  153. package/dist/hooks/index.js.map +1 -0
  154. package/dist/hooks/useCallback.d.ts +2 -0
  155. package/dist/hooks/useCallback.d.ts.map +1 -0
  156. package/dist/hooks/useCallback.js +5 -0
  157. package/dist/hooks/useCallback.js.map +1 -0
  158. package/dist/hooks/useContext.d.ts +37 -0
  159. package/dist/hooks/useContext.d.ts.map +1 -0
  160. package/dist/hooks/useContext.js +101 -0
  161. package/dist/hooks/useContext.js.map +1 -0
  162. package/dist/hooks/useEffect.d.ts +48 -0
  163. package/dist/hooks/useEffect.d.ts.map +1 -0
  164. package/dist/hooks/useEffect.js +100 -0
  165. package/dist/hooks/useEffect.js.map +1 -0
  166. package/dist/hooks/useId.d.ts +2 -0
  167. package/dist/hooks/useId.d.ts.map +1 -0
  168. package/dist/hooks/useId.js +10 -0
  169. package/dist/hooks/useId.js.map +1 -0
  170. package/dist/hooks/useMemo.d.ts +20 -0
  171. package/dist/hooks/useMemo.d.ts.map +1 -0
  172. package/dist/hooks/useMemo.js +33 -0
  173. package/dist/hooks/useMemo.js.map +1 -0
  174. package/dist/hooks/useRef.d.ts +4 -0
  175. package/dist/hooks/useRef.d.ts.map +1 -0
  176. package/dist/hooks/useRef.js +9 -0
  177. package/dist/hooks/useRef.js.map +1 -0
  178. package/dist/hooks/useStableCallback.d.ts +45 -0
  179. package/dist/hooks/useStableCallback.d.ts.map +1 -0
  180. package/dist/hooks/useStableCallback.js +66 -0
  181. package/dist/hooks/useStableCallback.js.map +1 -0
  182. package/dist/hooks/useState.d.ts +15 -0
  183. package/dist/hooks/useState.d.ts.map +1 -0
  184. package/dist/hooks/useState.js +39 -0
  185. package/dist/hooks/useState.js.map +1 -0
  186. package/dist/index.d.ts +8 -0
  187. package/dist/index.d.ts.map +1 -0
  188. package/dist/index.js +13 -0
  189. package/dist/index.js.map +1 -0
  190. package/dist/jsx-dev-runtime.d.ts +6 -0
  191. package/dist/jsx-dev-runtime.d.ts.map +1 -0
  192. package/dist/jsx-dev-runtime.js +7 -0
  193. package/dist/jsx-dev-runtime.js.map +1 -0
  194. package/dist/jsx-runtime.d.ts +31 -0
  195. package/dist/jsx-runtime.d.ts.map +1 -0
  196. package/dist/jsx-runtime.js +32 -0
  197. package/dist/jsx-runtime.js.map +1 -0
  198. package/dist/testing.d.ts +8 -0
  199. package/dist/testing.d.ts.map +1 -0
  200. package/dist/testing.js +10 -0
  201. package/dist/testing.js.map +1 -0
  202. package/dist/types/actions.d.ts +53 -0
  203. package/dist/types/actions.d.ts.map +1 -0
  204. package/dist/types/actions.js +2 -0
  205. package/dist/types/actions.js.map +1 -0
  206. package/dist/types/app.d.ts +74 -0
  207. package/dist/types/app.d.ts.map +1 -0
  208. package/dist/types/app.js +2 -0
  209. package/dist/types/app.js.map +1 -0
  210. package/dist/types/component.d.ts +11 -0
  211. package/dist/types/component.d.ts.map +1 -0
  212. package/dist/types/component.js +2 -0
  213. package/dist/types/component.js.map +1 -0
  214. package/dist/types/context.d.ts +28 -0
  215. package/dist/types/context.d.ts.map +1 -0
  216. package/dist/types/context.js +2 -0
  217. package/dist/types/context.js.map +1 -0
  218. package/dist/types/core.d.ts +51 -0
  219. package/dist/types/core.d.ts.map +1 -0
  220. package/dist/types/core.js +2 -0
  221. package/dist/types/core.js.map +1 -0
  222. package/dist/types/dom.d.ts +48 -0
  223. package/dist/types/dom.d.ts.map +1 -0
  224. package/dist/types/dom.js +2 -0
  225. package/dist/types/dom.js.map +1 -0
  226. package/dist/types/fiber.d.ts +169 -0
  227. package/dist/types/fiber.d.ts.map +1 -0
  228. package/dist/types/fiber.js +2 -0
  229. package/dist/types/fiber.js.map +1 -0
  230. package/dist/types/hooks.d.ts +47 -0
  231. package/dist/types/hooks.d.ts.map +1 -0
  232. package/dist/types/hooks.js +2 -0
  233. package/dist/types/hooks.js.map +1 -0
  234. package/dist/types/index.d.ts +9 -0
  235. package/dist/types/index.d.ts.map +1 -0
  236. package/dist/types/index.js +9 -0
  237. package/dist/types/index.js.map +1 -0
  238. package/dist/types/refs.d.ts +19 -0
  239. package/dist/types/refs.d.ts.map +1 -0
  240. package/dist/types/refs.js +2 -0
  241. package/dist/types/refs.js.map +1 -0
  242. package/dist/utils.d.ts +2 -0
  243. package/dist/utils.d.ts.map +1 -0
  244. package/dist/utils.js +7 -0
  245. package/dist/utils.js.map +1 -0
  246. package/package.json +67 -0
@@ -0,0 +1,100 @@
1
+ import { getCurrentApp, isFirstFiberRender } from '../core/components';
2
+ import { checkDeps, getNextHookOrCreate, saveDeps } from './helpers';
3
+ import { scheduleEffect } from '../core/reconciliation/effects';
4
+ function useBaseEffect(mode, fn, deps) {
5
+ const item = getNextHookOrCreate('effect', () => {
6
+ const item = {
7
+ type: 'effect',
8
+ mode,
9
+ fn,
10
+ destructor: null,
11
+ deps: deps ? saveDeps(deps) : null,
12
+ };
13
+ scheduleEffect(getCurrentApp(), () => runEffect(item), mode);
14
+ return item;
15
+ });
16
+ item.fn = fn;
17
+ if (!isFirstFiberRender() && (!deps || !checkDeps(item.deps, deps))) {
18
+ scheduleEffect(getCurrentApp(), () => runEffect(item), mode);
19
+ item.deps = deps ? saveDeps(deps) : null;
20
+ }
21
+ }
22
+ /**
23
+ * A hook that performs side effects in functional components. This enhanced
24
+ * version supports async functions and provides an AbortSignal for cleanup.
25
+ *
26
+ * Effects run after the render is committed to the screen, making them suitable
27
+ * for data fetching, subscriptions, or manually changing the DOM.
28
+ *
29
+ * @example
30
+ * // Basic effect with cleanup
31
+ * useEffect(() => {
32
+ * const timer = setInterval(() => console.log('tick'), 1000);
33
+ * return () => clearInterval(timer);
34
+ * }, []);
35
+ *
36
+ * // Async effect with abort signal
37
+ * useEffect(async (signal) => {
38
+ * try {
39
+ * const response = await fetch('/api/data', { signal });
40
+ * const data = await response.json();
41
+ * setData(data);
42
+ * } catch (error) {
43
+ * if (!signal.aborted) {
44
+ * console.error('Fetch failed:', error);
45
+ * }
46
+ * }
47
+ * }, [userId]);
48
+ */
49
+ export const useEffect = (
50
+ /** The effect function that receives an AbortSignal. Can be async and can
51
+ * return a cleanup function. The AbortSignal is automatically aborted when
52
+ * the effect is cleaned up. */
53
+ fn,
54
+ /** Optional array of dependencies. If provided, the effect only runs when one
55
+ * of the dependencies has changed. If omitted, the effect runs after every
56
+ * render. */
57
+ deps) => {
58
+ useBaseEffect('normal', fn, deps);
59
+ };
60
+ /**
61
+ * A hook that performs side effects synchronously after all DOM mutations but
62
+ * before the browser paints. This enhanced version supports async functions
63
+ * and provides an AbortSignal for cleanup.
64
+ *
65
+ * Use this for DOM measurements, synchronous DOM mutations, or when you need
66
+ * to read layout properties before the browser paints.
67
+ *
68
+ * @example
69
+ * // Measuring DOM elements before paint
70
+ * useLayoutEffect(() => {
71
+ * const rect = elementRef.current?.getBoundingClientRect();
72
+ * if (rect) {
73
+ * setDimensions({ width: rect.width, height: rect.height });
74
+ * }
75
+ * }, []);
76
+ */
77
+ export const useLayoutEffect = (
78
+ /** The effect function that receives an AbortSignal. Can be async and can
79
+ * return a cleanup function. The AbortSignal is automatically aborted when
80
+ * the effect is cleaned up. */
81
+ fn,
82
+ /** Optional array of dependencies. If provided, the effect only runs when one
83
+ * of the dependencies has changed. If omitted, the effect runs after every
84
+ * render. */
85
+ deps) => {
86
+ useBaseEffect('layout', fn, deps);
87
+ };
88
+ const runEffect = (item) => {
89
+ item.destructor?.();
90
+ item.destructor = null;
91
+ const controller = new AbortController();
92
+ const result = item.fn(controller.signal);
93
+ item.destructor = function effectDestructor() {
94
+ controller.abort();
95
+ if (typeof result === 'function') {
96
+ result();
97
+ }
98
+ };
99
+ };
100
+ //# sourceMappingURL=useEffect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEffect.js","sourceRoot":"","sources":["../../src/hooks/useEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAMtE,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAE1E,SAAS,aAAa,CAAC,IAAgB,EAAE,EAAiB,EAAE,IAAgB,EAAE;IAC5E,MAAM,IAAI,GAAG,mBAAmB,CAAC,QAAQ,EAAE,GAAkB,EAAE,CAAC;QAC9D,MAAM,IAAI,GAAkB;YAC1B,IAAI,EAAE,QAAQ;YACd,IAAI;YACJ,EAAE;YACF,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;SACnC,CAAC;QACF,cAAc,CAAC,aAAa,EAAE,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;QAC7D,OAAO,IAAI,CAAC;IAAA,CACb,CAAC,CAAC;IAEH,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IAEb,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAK,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC;QACrE,cAAc,CAAC,aAAa,EAAE,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3C,CAAC;AAAA,CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;AACvB;;+BAE+B;AAC/B,EAAiB;AACjB;;aAEa;AACb,IAAgB,EAChB,EAAE,CAAC;IACH,aAAa,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;AAAA,CACnC,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;AAC7B;;+BAE+B;AAC/B,EAAiB;AACjB;;aAEa;AACb,IAAgB,EAChB,EAAE,CAAC;IACH,aAAa,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;AAAA,CACnC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,IAAmB,EAAQ,EAAE,CAAC;IAC/C,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC;IACpB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IAEvB,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAE1C,IAAI,CAAC,UAAU,GAAG,SAAS,gBAAgB,GAAG;QAC5C,UAAU,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;YACjC,MAAM,EAAE,CAAC;QACX,CAAC;IAAA,CACF,CAAC;AAAA,CACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function useId(): string;
2
+ //# sourceMappingURL=useId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useId.d.ts","sourceRoot":"","sources":["../../src/hooks/useId.ts"],"names":[],"mappings":"AAIA,wBAAgB,KAAK,IAAI,MAAM,CAO9B"}
@@ -0,0 +1,10 @@
1
+ import { useRef } from './useRef';
2
+ let idx = 0;
3
+ export function useId() {
4
+ const ref = useRef(null);
5
+ if (ref.current === undefined) {
6
+ ref.current = `_r_${++idx}`;
7
+ }
8
+ return ref.current;
9
+ }
10
+ //# sourceMappingURL=useId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useId.js","sourceRoot":"","sources":["../../src/hooks/useId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,IAAI,GAAG,GAAG,CAAC,CAAC;AAEZ,MAAM,UAAU,KAAK,GAAW;IAC9B,MAAM,GAAG,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IACxC,IAAI,GAAG,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC9B,GAAG,CAAC,OAAO,GAAG,MAAM,EAAE,GAAG,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO,GAAG,CAAC,OAAQ,CAAC;AAAA,CACrB"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * A hook that memoizes the result of a computation and only recalculates it
3
+ * when one of the dependencies has changed. This is useful for expensive
4
+ * calculations that you don't want to repeat on every render, or when you want
5
+ * to preserve the same object across renders to avoid invalidating effects
6
+ * or other memoization.
7
+ *
8
+ * @example
9
+ * const expensiveValue = useMemo(() => {
10
+ * return count * multiplier * 1000; // Simulate expensive computation
11
+ * }, [count, multiplier]);
12
+ */
13
+ export declare function useMemo<T>(
14
+ /** A function that computes the value to be memoized. This function should be
15
+ * pure (no side effects) and will only be called when needed. */
16
+ fn: () => T,
17
+ /** An array of dependencies that the memoized value depends on. When any of
18
+ * these values change, the function will be re-executed. */
19
+ deps: unknown[]): T;
20
+ //# sourceMappingURL=useMemo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMemo.d.ts","sourceRoot":"","sources":["../../src/hooks/useMemo.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CAAC,CAAC;AACvB;iEACiE;AACjE,EAAE,EAAE,MAAM,CAAC;AACX;4DAC4D;AAC5D,IAAI,EAAE,OAAO,EAAE,GACd,CAAC,CAgBH"}
@@ -0,0 +1,33 @@
1
+ import { isFirstFiberRender } from '../core/components';
2
+ import { checkDeps, getNextHookOrCreate, saveDeps } from './helpers';
3
+ /**
4
+ * A hook that memoizes the result of a computation and only recalculates it
5
+ * when one of the dependencies has changed. This is useful for expensive
6
+ * calculations that you don't want to repeat on every render, or when you want
7
+ * to preserve the same object across renders to avoid invalidating effects
8
+ * or other memoization.
9
+ *
10
+ * @example
11
+ * const expensiveValue = useMemo(() => {
12
+ * return count * multiplier * 1000; // Simulate expensive computation
13
+ * }, [count, multiplier]);
14
+ */
15
+ export function useMemo(
16
+ /** A function that computes the value to be memoized. This function should be
17
+ * pure (no side effects) and will only be called when needed. */
18
+ fn,
19
+ /** An array of dependencies that the memoized value depends on. When any of
20
+ * these values change, the function will be re-executed. */
21
+ deps) {
22
+ const item = getNextHookOrCreate('memo', () => ({
23
+ type: 'memo',
24
+ value: fn(),
25
+ deps: saveDeps(deps),
26
+ }));
27
+ if (!isFirstFiberRender() && !checkDeps(item.deps, deps)) {
28
+ item.value = fn();
29
+ item.deps = saveDeps(deps);
30
+ }
31
+ return item.value;
32
+ }
33
+ //# sourceMappingURL=useMemo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMemo.js","sourceRoot":"","sources":["../../src/hooks/useMemo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,OAAO;AACrB;iEACiE;AACjE,EAAW;AACX;4DAC4D;AAC5D,IAAe,EACZ;IACH,MAAM,IAAI,GAAG,mBAAmB,CAC9B,MAAM,EACN,GAAgB,EAAE,CAAC,CAAC;QAClB,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,EAAE,EAAE;QACX,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;KACrB,CAAC,CACH,CAAC;IAEF,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QACzD,IAAI,CAAC,KAAK,GAAG,EAAE,EAAE,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,IAAI,CAAC,KAAU,CAAC;AAAA,CACxB"}
@@ -0,0 +1,4 @@
1
+ import { type Ref } from '../types';
2
+ export declare function useRef<T>(): Ref<T | undefined>;
3
+ export declare function useRef<T>(initialValue: T): Ref<T>;
4
+ //# sourceMappingURL=useRef.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRef.d.ts","sourceRoot":"","sources":["../../src/hooks/useRef.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAGrD,wBAAgB,MAAM,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;AAChD,wBAAgB,MAAM,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { getNextHookOrCreate } from './helpers';
2
+ export function useRef(initialValue) {
3
+ const item = getNextHookOrCreate('ref', () => ({
4
+ type: 'ref',
5
+ value: { current: initialValue ?? undefined },
6
+ }));
7
+ return item.value;
8
+ }
9
+ //# sourceMappingURL=useRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRef.js","sourceRoot":"","sources":["../../src/hooks/useRef.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAIhD,MAAM,UAAU,MAAM,CAAI,YAAgB,EAAU;IAClD,MAAM,IAAI,GAAG,mBAAmB,CAC9B,KAAK,EACL,GAAe,EAAE,CAAC,CAAC;QACjB,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,EAAE,OAAO,EAAE,YAAY,IAAI,SAAS,EAAE;KAC9C,CAAC,CACH,CAAC;IAEF,OAAO,IAAI,CAAC,KAAe,CAAC;AAAA,CAC7B"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * A hook that returns a stable callback function that never changes reference
3
+ * but always calls the latest version of the provided function. This is
4
+ * superior to React's `useEffectEvent` which returns a new function on each
5
+ * render.
6
+ *
7
+ * Unlike React's `useEffectEvent`, this hook:
8
+ * - Returns the SAME function reference on every render (truly stable)
9
+ * - Can be safely included in dependency arrays (though not needed)
10
+ * - Is designed for async actions and event handlers, not just effects
11
+ * - Eliminates the need to exclude it from dependency arrays
12
+ *
13
+ * ⚠️ **Important**: The returned function should never be called during the
14
+ * rendering phase because at that time its internal function is not updated,
15
+ * so calling it would work incorrectly. Only call it in event handlers,
16
+ * effects, or other non-rendering contexts.
17
+ *
18
+ * @example
19
+ * const MyComponent = ({ onSubmit, userId }) => {
20
+ * // This callback never changes reference, unlike useCallback
21
+ * const handleSubmit = useStableCallback((data: FormData) => {
22
+ * // Always uses the latest onSubmit and userId values
23
+ * onSubmit({ ...data, userId });
24
+ * });
25
+ *
26
+ * useEffect(() => {
27
+ * // Safe to include in deps (though not necessary)
28
+ * document.addEventListener('keydown', handleSubmit);
29
+ * return () => document.removeEventListener('keydown', handleSubmit);
30
+ * }, [handleSubmit]); // No lint warnings, handleSubmit never changes
31
+ *
32
+ * // Perfect for async event handlers
33
+ * const handleClick = useStableCallback(async () => {
34
+ * const result = await api.updateUser(userId); // Always latest userId
35
+ * onSubmit(result); // Always latest onSubmit
36
+ * });
37
+ *
38
+ * return <User onClick={handleClick}>Update User</User>;
39
+ * };
40
+ */
41
+ export declare function useStableCallback<TArgs extends unknown[], TRes>(
42
+ /** The function to wrap. The wrapper will always call the latest version of
43
+ * this function, but the wrapper itself never changes reference. */
44
+ fn: (...TArgs: TArgs) => TRes): (...TArgs: TArgs) => TRes;
45
+ //# sourceMappingURL=useStableCallback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStableCallback.d.ts","sourceRoot":"","sources":["../../src/hooks/useStableCallback.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,SAAS,OAAO,EAAE,EAAE,IAAI;AAC7D;oEACoE;AACpE,EAAE,EAAE,CAAC,GAAG,KAAK,EAAE,KAAK,KAAK,IAAI,GAC5B,CAAC,GAAG,KAAK,EAAE,KAAK,KAAK,IAAI,CAyB3B"}
@@ -0,0 +1,66 @@
1
+ import { getNextHookOrCreate } from './helpers';
2
+ import { useLayoutEffect } from './useEffect';
3
+ /**
4
+ * A hook that returns a stable callback function that never changes reference
5
+ * but always calls the latest version of the provided function. This is
6
+ * superior to React's `useEffectEvent` which returns a new function on each
7
+ * render.
8
+ *
9
+ * Unlike React's `useEffectEvent`, this hook:
10
+ * - Returns the SAME function reference on every render (truly stable)
11
+ * - Can be safely included in dependency arrays (though not needed)
12
+ * - Is designed for async actions and event handlers, not just effects
13
+ * - Eliminates the need to exclude it from dependency arrays
14
+ *
15
+ * ⚠️ **Important**: The returned function should never be called during the
16
+ * rendering phase because at that time its internal function is not updated,
17
+ * so calling it would work incorrectly. Only call it in event handlers,
18
+ * effects, or other non-rendering contexts.
19
+ *
20
+ * @example
21
+ * const MyComponent = ({ onSubmit, userId }) => {
22
+ * // This callback never changes reference, unlike useCallback
23
+ * const handleSubmit = useStableCallback((data: FormData) => {
24
+ * // Always uses the latest onSubmit and userId values
25
+ * onSubmit({ ...data, userId });
26
+ * });
27
+ *
28
+ * useEffect(() => {
29
+ * // Safe to include in deps (though not necessary)
30
+ * document.addEventListener('keydown', handleSubmit);
31
+ * return () => document.removeEventListener('keydown', handleSubmit);
32
+ * }, [handleSubmit]); // No lint warnings, handleSubmit never changes
33
+ *
34
+ * // Perfect for async event handlers
35
+ * const handleClick = useStableCallback(async () => {
36
+ * const result = await api.updateUser(userId); // Always latest userId
37
+ * onSubmit(result); // Always latest onSubmit
38
+ * });
39
+ *
40
+ * return <User onClick={handleClick}>Update User</User>;
41
+ * };
42
+ */
43
+ export function useStableCallback(
44
+ /** The function to wrap. The wrapper will always call the latest version of
45
+ * this function, but the wrapper itself never changes reference. */
46
+ fn) {
47
+ const item = getNextHookOrCreate('ref', () => {
48
+ let item;
49
+ const state = {
50
+ fn,
51
+ wrapper: function effectEventHandler(...args) {
52
+ return item.value.current.fn(...args);
53
+ },
54
+ };
55
+ item = {
56
+ type: 'ref',
57
+ value: { current: state },
58
+ };
59
+ return item;
60
+ });
61
+ useLayoutEffect(() => {
62
+ item.value.current.fn = fn;
63
+ }, [fn]);
64
+ return item.value.current.wrapper;
65
+ }
66
+ //# sourceMappingURL=useStableCallback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStableCallback.js","sourceRoot":"","sources":["../../src/hooks/useStableCallback.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,iBAAiB;AAC/B;oEACoE;AACpE,EAA6B,EACF;IAC3B,MAAM,IAAI,GAAG,mBAAmB,CAC9B,KAAK,EACL,GAAmC,EAAE,CAAC;QACpC,IAAI,IAAoC,CAAC;QACzC,MAAM,KAAK,GAAuB;YAChC,EAAE;YACF,OAAO,EAAE,SAAS,kBAAkB,CAAC,GAAG,IAAW,EAAQ;gBACzD,OAAO,IAAK,CAAC,KAAK,CAAC,OAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;YAAA,CACzC;SACF,CAAC;QAEF,IAAI,GAAG;YACL,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;SAC1B,CAAC;QACF,OAAO,IAAI,CAAC;IAAA,CACb,CACF,CAAC;IAEF,eAAe,CAAC,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,KAAK,CAAC,OAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;IAAA,CAC7B,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAET,OAAO,IAAI,CAAC,KAAK,CAAC,OAAQ,CAAC,OAAoC,CAAC;AAAA,CACjE"}
@@ -0,0 +1,15 @@
1
+ import { type StateSetter } from '../types';
2
+ /**
3
+ * A hook that allows you to add state to functional components. Returns a
4
+ * stateful value and a function to update it.
5
+ *
6
+ * @example
7
+ * const [count, setCount] = useState(0);
8
+ * setCount(1); // Set to specific value
9
+ * setCount(prev => prev + 1); // Update based on previous value
10
+ *
11
+ * // With lazy initialization
12
+ * const [data, setData] = useState(() => expensiveComputation());
13
+ */
14
+ export declare const useState: <T>(initValue: (() => T) | (T extends Function ? () => T : T)) => [T, StateSetter<T>];
15
+ //# sourceMappingURL=useState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useState.d.ts","sourceRoot":"","sources":["../../src/hooks/useState.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,UAAU,CAAC;AAG/D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,mFA2BzB,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { invalidateFiber } from '../core/reconciliation/invalidateFiber';
2
+ import { getNextHookOrCreate } from './helpers';
3
+ /**
4
+ * A hook that allows you to add state to functional components. Returns a
5
+ * stateful value and a function to update it.
6
+ *
7
+ * @example
8
+ * const [count, setCount] = useState(0);
9
+ * setCount(1); // Set to specific value
10
+ * setCount(prev => prev + 1); // Update based on previous value
11
+ *
12
+ * // With lazy initialization
13
+ * const [data, setData] = useState(() => expensiveComputation());
14
+ */
15
+ export const useState = (
16
+ /** The initial state value or a function that returns the initial state. If a
17
+ * function is provided, it will only be called once during initialization. */
18
+ initValue) => {
19
+ const item = getNextHookOrCreate('state', (fiber) => {
20
+ const item = {
21
+ type: 'state',
22
+ state: (typeof initValue === 'function'
23
+ ? initValue()
24
+ : initValue),
25
+ setter: function setState(valueOrFn) {
26
+ const v = (typeof valueOrFn === 'function'
27
+ ? valueOrFn(item.state)
28
+ : valueOrFn);
29
+ if (item.state === v)
30
+ return;
31
+ item.state = v;
32
+ invalidateFiber(fiber);
33
+ },
34
+ };
35
+ return item;
36
+ });
37
+ return [item.state, item.setter];
38
+ };
39
+ //# sourceMappingURL=useState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useState.js","sourceRoot":"","sources":["../../src/hooks/useState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AAEnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;AACtB;8EAC8E;AAC9E,SAAyD,EACpC,EAAE,CAAC;IACxB,MAAM,IAAI,GAAG,mBAAmB,CAAC,OAAO,EAAE,CAAC,KAAK,EAAgB,EAAE,CAAC;QACjE,MAAM,IAAI,GAAoB;YAC5B,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,CAAC,OAAO,SAAS,KAAK,UAAU;gBACrC,CAAC,CAAE,SAAqB,EAAE;gBAC1B,CAAC,CAAC,SAAS,CAAM;YACnB,MAAM,EAAE,SAAS,QAAQ,CAAC,SAAS,EAAE;gBACnC,MAAM,CAAC,GAAG,CACR,OAAO,SAAS,KAAK,UAAU;oBAC7B,CAAC,CAAE,SAA4B,CAAC,IAAI,CAAC,KAAK,CAAC;oBAC3C,CAAC,CAAC,SAAS,CACT,CAAC;gBAEP,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC;oBAAE,OAAO;gBAC7B,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;gBACf,eAAe,CAAC,KAAK,CAAC,CAAC;YAAA,CACxB;SACF,CAAC;QACF,OAAO,IAAoB,CAAC;IAAA,CAC7B,CAAC,CAAC;IAEH,OAAO,CAAC,IAAI,CAAC,KAAU,EAAE,IAAI,CAAC,MAAwB,CAAC,CAAC;AAAA,CACzD,CAAC"}
@@ -0,0 +1,8 @@
1
+ export * from './types';
2
+ export * from './hooks/index';
3
+ export * from './core/createRoot';
4
+ export * from './core/createElement';
5
+ export declare function memo<T>(Comp: T, isEq: unknown): T;
6
+ /** <Fragment/> */
7
+ export { FRAGMENT_TAG as Fragment } from './core/reconciliation/fibers';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AAErC,wBAAgB,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,GAAG,CAAC,CAMjD;AAED,kBAAkB;AAClB,OAAO,EAAE,YAAY,IAAI,QAAQ,EAAE,MAAM,8BAA8B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ export * from './types';
2
+ export * from './hooks/index';
3
+ export * from './core/createRoot';
4
+ export * from './core/createElement';
5
+ export function memo(Comp, isEq) {
6
+ if (isEq) {
7
+ throw new Error(`Custom "isEqual" for memo is not supported`);
8
+ }
9
+ return Comp; // Components are already memoized by default.
10
+ }
11
+ /** <Fragment/> */
12
+ export { FRAGMENT_TAG as Fragment } from './core/reconciliation/fibers';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AAErC,MAAM,UAAU,IAAI,CAAI,IAAO,EAAE,IAAa,EAAK;IACjD,IAAI,IAAI,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,IAAI,CAAC,CAAC,8CAA8C;AAA/C,CACb;AAED,kBAAkB;AAClB,OAAO,EAAE,YAAY,IAAI,QAAQ,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { createElement } from './index';
2
+ export declare const jsx: typeof createElement;
3
+ export declare const jsxDEV: typeof createElement;
4
+ export declare const jsxs: typeof createElement;
5
+ export declare const Fragment = "x-fragment";
6
+ //# sourceMappingURL=jsx-dev-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-dev-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-dev-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,eAAO,MAAM,GAAG,sBAAgB,CAAC;AACjC,eAAO,MAAM,MAAM,sBAAgB,CAAC;AACpC,eAAO,MAAM,IAAI,sBAAgB,CAAC;AAClC,eAAO,MAAM,QAAQ,eAAe,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { createElement } from './index';
2
+ import { FRAGMENT_TAG } from './core/reconciliation/fibers';
3
+ export const jsx = createElement;
4
+ export const jsxDEV = createElement;
5
+ export const jsxs = createElement;
6
+ export const Fragment = FRAGMENT_TAG;
7
+ //# sourceMappingURL=jsx-dev-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-dev-runtime.js","sourceRoot":"","sources":["../src/jsx-dev-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,MAAM,CAAC,MAAM,GAAG,GAAG,aAAa,CAAC;AACjC,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAC;AACpC,MAAM,CAAC,MAAM,IAAI,GAAG,aAAa,CAAC;AAClC,MAAM,CAAC,MAAM,QAAQ,GAAG,YAAY,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { createElement } from './index';
2
+ /**
3
+ * This file is used to get `jsx`, `jsxs` & `Fragment` to be used by the JSX | TSX
4
+ * compiler to convert <tag/> or <Component/> into vNodes (ElementNode in this
5
+ * library).
6
+ */
7
+ /**
8
+ * @example
9
+ * <span/> ===
10
+ * jsx("span", {})
11
+ * <span>A</span> ===
12
+ * jsx("span", { children: "A" })
13
+ */
14
+ export declare const jsx: typeof createElement;
15
+ /**
16
+ * `createElement` with 2+ children
17
+ * @example
18
+ * <div><span>A</span><span>B</span></div> ===
19
+ * jsxs("div", { children: [
20
+ * jsx("span", { children: "A" }),
21
+ * jsx("span", { children: "B" })
22
+ * ]});
23
+ */
24
+ export declare const jsxs: typeof createElement;
25
+ /**
26
+ * <>[1,2]</>
27
+ * === jsxs(FRAGMENT_TAG, { children: [1,2] })
28
+ * === jsxs('x-fragment', { children: [1,2] })
29
+ */
30
+ export declare const Fragment = "x-fragment";
31
+ //# sourceMappingURL=jsx-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC;;;;GAIG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,GAAG,sBAAgB,CAAC;AAEjC;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,sBAAgB,CAAC;AAElC;;;;GAIG;AACH,eAAO,MAAM,QAAQ,eAAe,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { createElement } from './index';
2
+ import { FRAGMENT_TAG } from './core/reconciliation/fibers';
3
+ /**
4
+ * This file is used to get `jsx`, `jsxs` & `Fragment` to be used by the JSX | TSX
5
+ * compiler to convert <tag/> or <Component/> into vNodes (ElementNode in this
6
+ * library).
7
+ */
8
+ /**
9
+ * @example
10
+ * <span/> ===
11
+ * jsx("span", {})
12
+ * <span>A</span> ===
13
+ * jsx("span", { children: "A" })
14
+ */
15
+ export const jsx = createElement;
16
+ /**
17
+ * `createElement` with 2+ children
18
+ * @example
19
+ * <div><span>A</span><span>B</span></div> ===
20
+ * jsxs("div", { children: [
21
+ * jsx("span", { children: "A" }),
22
+ * jsx("span", { children: "B" })
23
+ * ]});
24
+ */
25
+ export const jsxs = createElement;
26
+ /**
27
+ * <>[1,2]</>
28
+ * === jsxs(FRAGMENT_TAG, { children: [1,2] })
29
+ * === jsxs('x-fragment', { children: [1,2] })
30
+ */
31
+ export const Fragment = FRAGMENT_TAG;
32
+ //# sourceMappingURL=jsx-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-runtime.js","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D;;;;GAIG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,aAAa,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,aAAa,CAAC;AAElC;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,YAAY,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Put your "setState" calls in tests within the `fn` callback. When the promise
3
+ * resolves, the component will be re-rendered and its HTML will be up to date.
4
+ * Layout effects will have finished running, but normal effects may still be
5
+ * pending.
6
+ */
7
+ export declare const act: (fn: () => void | Promise<void>) => Promise<void>;
8
+ //# sourceMappingURL=testing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,GAAG,mDAEf,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Put your "setState" calls in tests within the `fn` callback. When the promise
3
+ * resolves, the component will be re-rendered and its HTML will be up to date.
4
+ * Layout effects will have finished running, but normal effects may still be
5
+ * pending.
6
+ */
7
+ export const act = async (fn) => {
8
+ await fn();
9
+ };
10
+ //# sourceMappingURL=testing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testing.js","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,EAAE,EAA8B,EAAE,EAAE,CAAC;IAC3D,MAAM,EAAE,EAAE,CAAC;AAAA,CACZ,CAAC"}
@@ -0,0 +1,53 @@
1
+ import type { CommentMode, UnknownProps } from './core';
2
+ import type { TagAttrValue } from './dom';
3
+ import type { FiberMap, FiberNode } from './fiber';
4
+ import type { Ref, RefSetter } from './refs';
5
+ type CommonAction = {
6
+ fiber: FiberNode;
7
+ };
8
+ type CreateTagAction = CommonAction & {
9
+ type: 'CreateTag';
10
+ };
11
+ type CreateTextAction = CommonAction & {
12
+ type: 'CreateText';
13
+ };
14
+ export type CreateCommentAction = CommonAction & {
15
+ type: 'CreateComment';
16
+ mode: CommentMode;
17
+ };
18
+ type CreateAction = CreateTagAction | CreateTextAction | CreateCommentAction;
19
+ export type SetTextAction = CommonAction & {
20
+ type: 'SetText';
21
+ text: string;
22
+ };
23
+ export type SetAttrAction = CommonAction & {
24
+ type: 'SetAttr';
25
+ name: string;
26
+ value: TagAttrValue;
27
+ };
28
+ export type SetRefAction = CommonAction & {
29
+ type: 'SetRef';
30
+ ref: Ref<unknown> | RefSetter<unknown> | null;
31
+ dontUnsetRef?: boolean;
32
+ };
33
+ export type SetPropsAction = CommonAction & {
34
+ type: 'SetProps';
35
+ props: UnknownProps;
36
+ };
37
+ type UpdateAction = SetTextAction | SetAttrAction | SetPropsAction | SetRefAction;
38
+ export type RemoveAction = CommonAction & {
39
+ type: 'Remove';
40
+ };
41
+ export type RelayoutAction = CommonAction & {
42
+ type: 'Relayout';
43
+ before: FiberMap;
44
+ after: FiberMap;
45
+ };
46
+ export type ReplaceAction = CommonAction & {
47
+ type: 'Replace';
48
+ newFiber: FiberNode;
49
+ };
50
+ type LayoutAction = RemoveAction | RelayoutAction | ReplaceAction;
51
+ export type Action = CreateAction | UpdateAction | LayoutAction;
52
+ export {};
53
+ //# sourceMappingURL=actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/types/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE7C,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC;AAGF,KAAK,eAAe,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC;AAC5D,KAAK,gBAAgB,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC;AAC9D,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG;IAC/C,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC;AACF,KAAK,YAAY,GAAG,eAAe,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;AAG7E,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAC7E,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG;IACzC,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,YAAY,CAAC;CACrB,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG;IACxC,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IAE9C,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AACF,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG;IAC1C,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,YAAY,CAAC;CACrB,CAAC;AACF,KAAK,YAAY,GACb,aAAa,GACb,aAAa,GACb,cAAc,GACd,YAAY,CAAC;AAGjB,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAC7D,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG;IAC1C,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,QAAQ,CAAC;IACjB,KAAK,EAAE,QAAQ,CAAC;CACjB,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG;IACzC,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AACF,KAAK,YAAY,GAAG,YAAY,GAAG,cAAc,GAAG,aAAa,CAAC;AAElE,MAAM,MAAM,MAAM,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/types/actions.ts"],"names":[],"mappings":""}