@faiwer/react 0.8.4 → 0.9.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 (207) hide show
  1. package/README.md +20 -17
  2. package/dist/core/actions/applyAction.d.ts.map +1 -1
  3. package/dist/core/actions/applyAction.js +2 -0
  4. package/dist/core/actions/applyAction.js.map +1 -1
  5. package/dist/core/actions/createComment.action.d.ts +2 -2
  6. package/dist/core/actions/createComment.action.d.ts.map +1 -1
  7. package/dist/core/actions/createComment.action.js +1 -8
  8. package/dist/core/actions/createComment.action.js.map +1 -1
  9. package/dist/core/actions/createContainer.action.d.ts +7 -0
  10. package/dist/core/actions/createContainer.action.d.ts.map +1 -0
  11. package/dist/core/actions/createContainer.action.js +28 -0
  12. package/dist/core/actions/createContainer.action.js.map +1 -0
  13. package/dist/core/actions/createTag.action.d.ts +2 -1
  14. package/dist/core/actions/createTag.action.d.ts.map +1 -1
  15. package/dist/core/actions/createTag.action.js +22 -4
  16. package/dist/core/actions/createTag.action.js.map +1 -1
  17. package/dist/core/actions/createText.action.d.ts.map +1 -1
  18. package/dist/core/actions/createText.action.js +2 -5
  19. package/dist/core/actions/createText.action.js.map +1 -1
  20. package/dist/core/actions/dom/attributes.d.ts.map +1 -1
  21. package/dist/core/actions/dom/attributes.js +4 -1
  22. package/dist/core/actions/dom/attributes.js.map +1 -1
  23. package/dist/core/actions/dom/css.d.ts.map +1 -1
  24. package/dist/core/actions/dom/css.js +2 -1
  25. package/dist/core/actions/dom/css.js.map +1 -1
  26. package/dist/core/actions/dom/events.d.ts.map +1 -1
  27. package/dist/core/actions/dom/events.js +15 -3
  28. package/dist/core/actions/dom/events.js.map +1 -1
  29. package/dist/core/actions/dom/value.d.ts +17 -0
  30. package/dist/core/actions/dom/value.d.ts.map +1 -0
  31. package/dist/core/actions/dom/value.js +204 -0
  32. package/dist/core/actions/dom/value.js.map +1 -0
  33. package/dist/core/actions/helpers.d.ts +17 -10
  34. package/dist/core/actions/helpers.d.ts.map +1 -1
  35. package/dist/core/actions/helpers.js +63 -68
  36. package/dist/core/actions/helpers.js.map +1 -1
  37. package/dist/core/actions/relayout.action.d.ts +2 -1
  38. package/dist/core/actions/relayout.action.d.ts.map +1 -1
  39. package/dist/core/actions/relayout.action.js +119 -30
  40. package/dist/core/actions/relayout.action.js.map +1 -1
  41. package/dist/core/actions/remove.action.d.ts +2 -2
  42. package/dist/core/actions/remove.action.d.ts.map +1 -1
  43. package/dist/core/actions/remove.action.js +20 -16
  44. package/dist/core/actions/remove.action.js.map +1 -1
  45. package/dist/core/actions/replace.action.d.ts +1 -1
  46. package/dist/core/actions/replace.action.d.ts.map +1 -1
  47. package/dist/core/actions/replace.action.js +30 -23
  48. package/dist/core/actions/replace.action.js.map +1 -1
  49. package/dist/core/actions/setAttr.action.d.ts +1 -1
  50. package/dist/core/actions/setAttr.action.d.ts.map +1 -1
  51. package/dist/core/actions/setAttr.action.js +48 -6
  52. package/dist/core/actions/setAttr.action.js.map +1 -1
  53. package/dist/core/actions/setProps.action.d.ts.map +1 -1
  54. package/dist/core/actions/setProps.action.js +2 -1
  55. package/dist/core/actions/setProps.action.js.map +1 -1
  56. package/dist/core/actions/setRef.action.d.ts +1 -1
  57. package/dist/core/actions/setRef.action.d.ts.map +1 -1
  58. package/dist/core/actions/setRef.action.js +4 -4
  59. package/dist/core/actions/setRef.action.js.map +1 -1
  60. package/dist/core/actions/setText.action.d.ts.map +1 -1
  61. package/dist/core/actions/setText.action.js +3 -3
  62. package/dist/core/actions/setText.action.js.map +1 -1
  63. package/dist/core/classComponent.d.ts.map +1 -1
  64. package/dist/core/classComponent.js +4 -3
  65. package/dist/core/classComponent.js.map +1 -1
  66. package/dist/core/compact.d.ts +10 -29
  67. package/dist/core/compact.d.ts.map +1 -1
  68. package/dist/core/compact.js +12 -100
  69. package/dist/core/compact.js.map +1 -1
  70. package/dist/core/components.d.ts +2 -2
  71. package/dist/core/components.d.ts.map +1 -1
  72. package/dist/core/components.js +19 -6
  73. package/dist/core/components.js.map +1 -1
  74. package/dist/core/createElement.d.ts +2 -8
  75. package/dist/core/createElement.d.ts.map +1 -1
  76. package/dist/core/createElement.js +3 -1
  77. package/dist/core/createElement.js.map +1 -1
  78. package/dist/core/reactNodeToFiberNode.d.ts.map +1 -1
  79. package/dist/core/reactNodeToFiberNode.js +6 -1
  80. package/dist/core/reactNodeToFiberNode.js.map +1 -1
  81. package/dist/core/reconciliation/app.js +3 -3
  82. package/dist/core/reconciliation/app.js.map +1 -1
  83. package/dist/core/reconciliation/collect/fromApp.d.ts.map +1 -1
  84. package/dist/core/reconciliation/collect/fromApp.js +3 -27
  85. package/dist/core/reconciliation/collect/fromApp.js.map +1 -1
  86. package/dist/core/reconciliation/collect/fromChildrenPair.d.ts.map +1 -1
  87. package/dist/core/reconciliation/collect/fromChildrenPair.js +11 -6
  88. package/dist/core/reconciliation/collect/fromChildrenPair.js.map +1 -1
  89. package/dist/core/reconciliation/collect/fromComponent.d.ts +2 -2
  90. package/dist/core/reconciliation/collect/fromComponent.d.ts.map +1 -1
  91. package/dist/core/reconciliation/collect/fromComponent.js +4 -8
  92. package/dist/core/reconciliation/collect/fromComponent.js.map +1 -1
  93. package/dist/core/reconciliation/collect/fromFiberPair.d.ts.map +1 -1
  94. package/dist/core/reconciliation/collect/fromFiberPair.js +2 -4
  95. package/dist/core/reconciliation/collect/fromFiberPair.js.map +1 -1
  96. package/dist/core/reconciliation/collect/fromNewFiber.d.ts.map +1 -1
  97. package/dist/core/reconciliation/collect/fromNewFiber.js +7 -15
  98. package/dist/core/reconciliation/collect/fromNewFiber.js.map +1 -1
  99. package/dist/core/reconciliation/errors/ReactError.d.ts +7 -0
  100. package/dist/core/reconciliation/errors/ReactError.d.ts.map +1 -0
  101. package/dist/core/reconciliation/errors/ReactError.js +26 -0
  102. package/dist/core/reconciliation/errors/ReactError.js.map +1 -0
  103. package/dist/core/reconciliation/errors/stack.d.ts +7 -1
  104. package/dist/core/reconciliation/errors/stack.d.ts.map +1 -1
  105. package/dist/core/reconciliation/errors/stack.js +63 -6
  106. package/dist/core/reconciliation/errors/stack.js.map +1 -1
  107. package/dist/core/reconciliation/fibers.d.ts +1 -0
  108. package/dist/core/reconciliation/fibers.d.ts.map +1 -1
  109. package/dist/core/reconciliation/fibers.js +3 -2
  110. package/dist/core/reconciliation/fibers.js.map +1 -1
  111. package/dist/core/reconciliation/heap.d.ts +18 -0
  112. package/dist/core/reconciliation/heap.d.ts.map +1 -0
  113. package/dist/core/reconciliation/heap.js +81 -0
  114. package/dist/core/reconciliation/heap.js.map +1 -0
  115. package/dist/core/reconciliation/invalidateFiber.d.ts.map +1 -1
  116. package/dist/core/reconciliation/invalidateFiber.js +6 -5
  117. package/dist/core/reconciliation/invalidateFiber.js.map +1 -1
  118. package/dist/core/reconciliation/mount.d.ts.map +1 -1
  119. package/dist/core/reconciliation/mount.js +14 -4
  120. package/dist/core/reconciliation/mount.js.map +1 -1
  121. package/dist/core/reconciliation/postCommit.d.ts +1 -1
  122. package/dist/core/reconciliation/postCommit.d.ts.map +1 -1
  123. package/dist/core/reconciliation/postCommit.js +17 -4
  124. package/dist/core/reconciliation/postCommit.js.map +1 -1
  125. package/dist/core/reconciliation/queue.d.ts +21 -0
  126. package/dist/core/reconciliation/queue.d.ts.map +1 -0
  127. package/dist/core/reconciliation/queue.js +55 -0
  128. package/dist/core/reconciliation/queue.js.map +1 -0
  129. package/dist/core/reconciliation/render.js +1 -1
  130. package/dist/core/reconciliation/render.js.map +1 -1
  131. package/dist/core/reconciliation/runFiberComponents.d.ts.map +1 -1
  132. package/dist/core/reconciliation/runFiberComponents.js +2 -1
  133. package/dist/core/reconciliation/runFiberComponents.js.map +1 -1
  134. package/dist/core/reconciliation/typeGuards.d.ts +3 -0
  135. package/dist/core/reconciliation/typeGuards.d.ts.map +1 -1
  136. package/dist/core/reconciliation/typeGuards.js +13 -0
  137. package/dist/core/reconciliation/typeGuards.js.map +1 -1
  138. package/dist/core/reconciliation/validateApp.d.ts +1 -1
  139. package/dist/core/reconciliation/validateApp.d.ts.map +1 -1
  140. package/dist/core/reconciliation/validateApp.js +28 -21
  141. package/dist/core/reconciliation/validateApp.js.map +1 -1
  142. package/dist/hooks/helpers.d.ts +2 -2
  143. package/dist/hooks/helpers.d.ts.map +1 -1
  144. package/dist/hooks/helpers.js +3 -2
  145. package/dist/hooks/helpers.js.map +1 -1
  146. package/dist/hooks/index.d.ts +1 -1
  147. package/dist/hooks/index.d.ts.map +1 -1
  148. package/dist/hooks/index.js +1 -1
  149. package/dist/hooks/index.js.map +1 -1
  150. package/dist/hooks/useContext.d.ts.map +1 -1
  151. package/dist/hooks/useContext.js +6 -6
  152. package/dist/hooks/useContext.js.map +1 -1
  153. package/dist/hooks/useEffect.d.ts +2 -1
  154. package/dist/hooks/useEffect.d.ts.map +1 -1
  155. package/dist/hooks/useEffect.js +1 -1
  156. package/dist/hooks/useEffect.js.map +1 -1
  157. package/dist/hooks/useRef.d.ts +8 -3
  158. package/dist/hooks/useRef.d.ts.map +1 -1
  159. package/dist/hooks/useRef.js +27 -0
  160. package/dist/hooks/useRef.js.map +1 -1
  161. package/dist/hooks/useState.d.ts +1 -1
  162. package/dist/hooks/useState.d.ts.map +1 -1
  163. package/dist/hooks/useState.js +4 -6
  164. package/dist/hooks/useState.js.map +1 -1
  165. package/dist/index.d.ts +3 -0
  166. package/dist/index.d.ts.map +1 -1
  167. package/dist/index.js +1 -0
  168. package/dist/index.js.map +1 -1
  169. package/dist/jsx.d.ts +159 -44
  170. package/dist/mocks.d.ts +0 -7
  171. package/dist/mocks.d.ts.map +1 -1
  172. package/dist/mocks.js +0 -6
  173. package/dist/mocks.js.map +1 -1
  174. package/dist/react.d.ts +46 -0
  175. package/dist/types/actions.d.ts +11 -4
  176. package/dist/types/actions.d.ts.map +1 -1
  177. package/dist/types/app.d.ts +12 -2
  178. package/dist/types/app.d.ts.map +1 -1
  179. package/dist/types/attributes.d.ts +42 -0
  180. package/dist/types/attributes.d.ts.map +1 -0
  181. package/dist/types/attributes.js +2 -0
  182. package/dist/types/attributes.js.map +1 -0
  183. package/dist/types/common.d.ts +10 -1
  184. package/dist/types/common.d.ts.map +1 -1
  185. package/dist/types/component.d.ts +5 -2
  186. package/dist/types/component.d.ts.map +1 -1
  187. package/dist/types/context.d.ts +3 -2
  188. package/dist/types/context.d.ts.map +1 -1
  189. package/dist/types/core.d.ts +17 -13
  190. package/dist/types/core.d.ts.map +1 -1
  191. package/dist/types/dom.d.ts +23 -22
  192. package/dist/types/dom.d.ts.map +1 -1
  193. package/dist/types/events.d.ts +18 -11
  194. package/dist/types/events.d.ts.map +1 -1
  195. package/dist/types/fiber.d.ts +29 -11
  196. package/dist/types/fiber.d.ts.map +1 -1
  197. package/dist/types/fiber.js +5 -1
  198. package/dist/types/fiber.js.map +1 -1
  199. package/dist/types/hooks.d.ts +4 -4
  200. package/dist/types/hooks.d.ts.map +1 -1
  201. package/dist/types/react.d.ts +35 -0
  202. package/dist/types/react.d.ts.map +1 -0
  203. package/dist/types/react.js +2 -0
  204. package/dist/types/react.js.map +1 -0
  205. package/dist/types/refs.d.ts +5 -8
  206. package/dist/types/refs.d.ts.map +1 -1
  207. package/package.json +11 -3
package/README.md CHANGED
@@ -6,6 +6,7 @@ A naive React implementation. Why? What's wrong with the existing one? Nothing.
6
6
 
7
7
  - JSX
8
8
  - Functional components
9
+ - Class components (limited)
9
10
  - Hooks:
10
11
  - `useState`
11
12
  - `useRef`
@@ -14,21 +15,30 @@ A naive React implementation. Why? What's wrong with the existing one? Nothing.
14
15
  - `useLayoutEffect`, `useEffect` (improved versions)
15
16
  - `useId`
16
17
  - `useContext`
17
- - Tag-based refs
18
+ - Refs
18
19
  - Context
19
20
  - Portals
20
21
  - Fragments
21
22
 
22
23
  ## Installation
23
24
 
24
- - `npm i --save @faiwer/react`
25
- - Update your `tsconfig.json`:
25
+ - `npm uninstall react react-dom @types/react @types/react-dom`
26
+ - `npm i --save react@npm:@faiwer/react`
27
+ - `npm i --save --force react-dom@npm:@faiwer/react-dom`
28
+ - You might need to update your `tsconfig.json` (no necessarily):
26
29
  ```json
27
30
  "compilerOptions": {
28
31
  "jsx": "react-jsx",
29
- "jsxImportSource": "@faiwer/react"
30
32
  }
31
33
  ```
34
+ Or use `"jsx": "preserve"`
35
+ - If you're using `eslint-plugin-react` than configure this in your .eslintrc:
36
+ ```json
37
+ "settings": {
38
+ "react": { "version": "19" } // not 'detect'
39
+ },
40
+ ```
41
+ - Good luck. If your project is big enough, I'm pretty sure you got a ton of type errors. Sorry :-)
32
42
 
33
43
  ### Usage
34
44
 
@@ -42,23 +52,19 @@ createRoot(container).render(<App />);
42
52
  ## TODO
43
53
 
44
54
  - 1st line
45
- - Events:
46
- - "capture"-kind of events
47
- - camelCase events
48
- - custom `onChange` like in ReactDOM
49
55
  - Error handling
50
- - Direct component refs, `forwardRef`, `useImperativeHandle`
51
- - 2nd line
52
- - prepare an NPM-package
53
- - 3rd line
54
- - `RunComponent` is not pure. Some hooks change the state during the rendering phase. Fix it.
55
56
  - `useReducer`
57
+ - 2rd line
58
+ - HMR
59
+ - Resolve "TODO: add a test" comments
60
+ - `runComponent` is not pure. Some hooks change the state during the rendering phase. Fix it.
61
+ - leverage `isStaticChildren` in `jsx()`
56
62
 
57
63
  ## It does NOT support
58
64
 
59
65
  … and probably never will:
60
66
 
61
- - Class Components
67
+ - Class Components: `getSnapshotBeforeUpdate`
62
68
  - Synthetic events
63
69
  - Portals:
64
70
  - Event bubbling from portals
@@ -87,6 +93,3 @@ createRoot(container).render(<App />);
87
93
  - All components are memoized by default. Why not?
88
94
  - No custom DOM-related code. This library is supposed to be simple and silly. Whereas React-DOM lib is huge.
89
95
  - No modern fiber-driven stuff like `<Suspense>`, `cacheSignal`, or `use`. Too much work. It took React many years to cook it well :)
90
-
91
- - научить solo режим ссылаться на внутренний <!--end-->
92
- это уберёт миллиард begin-end в wrapper-ах
@@ -1 +1 @@
1
- {"version":3,"file":"applyAction.d.ts","sourceRoot":"","sources":["../../../src/core/actions/applyAction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAYzD;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,0BAGvB,CAAC"}
1
+ {"version":3,"file":"applyAction.d.ts","sourceRoot":"","sources":["../../../src/core/actions/applyAction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAazD;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,0BAGvB,CAAC"}
@@ -8,6 +8,7 @@ import { setTextAction } from './setText.action';
8
8
  import { removeAction } from './remove.action';
9
9
  import { replaceAction } from './replace.action';
10
10
  import { relayoutAction } from './relayout.action';
11
+ import { createContainerAction } from './createContainer.action';
11
12
  /**
12
13
  * The commit phase of the rendering process contains two parts:
13
14
  * - Applying DOM changes
@@ -24,6 +25,7 @@ const actionHandlers = {
24
25
  CreateTag: createTagAction,
25
26
  CreateText: createTextAction,
26
27
  CreateComment: createCommentAction,
28
+ CreateContainer: createContainerAction,
27
29
  SetProps: setPropsAction,
28
30
  SetRef: setRefAction,
29
31
  SetAttr: setAttrAction,
@@ -1 +1 @@
1
- {"version":3,"file":"applyAction.js","sourceRoot":"","sources":["../../../src/core/actions/applyAction.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC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0BAA0B,CAAC;AAEjE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAc,EAAQ,EAAE,CAAC;IACnD,kCAAkC;IAClC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,MAAa,CAAC,CAAC;AAAA,CAC1D,CAAC;AAEF,MAAM,cAAc,GAKhB;IACF,SAAS,EAAE,eAAe;IAC1B,UAAU,EAAE,gBAAgB;IAC5B,aAAa,EAAE,mBAAmB;IAClC,eAAe,EAAE,qBAAqB;IACtC,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,aAAa;IACtB,QAAQ,EAAE,cAAc;CACzB,CAAC"}
@@ -1,7 +1,7 @@
1
- import type { FiberNode } from '../../types';
1
+ import { type FiberNode } from '../../types';
2
2
  import type { CreateCommentAction } from '../../types/actions';
3
3
  /**
4
4
  * Creates a new comment DOM node (<!--r:${mode}:${fiber.id}-->).
5
5
  */
6
- export declare function createCommentAction(fiber: FiberNode, { mode }: CreateCommentAction): void;
6
+ export declare function createCommentAction(fiber: FiberNode, { mode }: Pick<CreateCommentAction, 'mode'>): void;
7
7
  //# sourceMappingURL=createComment.action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createComment.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/createComment.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAKtE;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,EAChB,EAAE,IAAI,EAAE,EAAE,mBAAmB,QAc9B"}
1
+ {"version":3,"file":"createComment.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/createComment.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAItE;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,EAChB,EAAE,IAAI,EAAE,EAAE,IAAI,CAAC,mBAAmB,EAAE,MAAM,CAAC,QAO5C"}
@@ -1,20 +1,13 @@
1
1
  import { getParentElement } from './helpers';
2
- import { tryToCompactNode } from '../compact';
3
2
  import { buildComment } from '../reconciliation/comments';
4
3
  /**
5
4
  * Creates a new comment DOM node (<!--r:${mode}:${fiber.id}-->).
6
5
  */
7
6
  export function createCommentAction(fiber, { mode }) {
8
7
  // Only two scenarios lead here:
9
- // - First render of a fragment or component. The parent's element is a
10
- // comment `r:begin:{id}`
8
+ // - Render a component or a fragment without children
11
9
  // - Render of a portal. The parent element is the portal target node.
12
10
  fiber.element = buildComment(mode, fiber.id);
13
11
  getParentElement(fiber).appendChild(fiber.element);
14
- if (mode === 'end') {
15
- // All children are added. If the current fiber is the only child, we can
16
- // compact the parent node: "<!--begin-->child<!--end-->" -> "child".
17
- tryToCompactNode(fiber);
18
- }
19
12
  }
20
13
  //# sourceMappingURL=createComment.action.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createComment.action.js","sourceRoot":"","sources":["../../../src/core/actions/createComment.action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAgB,EAChB,EAAE,IAAI,EAAuB,EAC7B;IACA,gCAAgC;IAChC,uEAAuE;IACvE,2BAA2B;IAC3B,sEAAsE;IACtE,KAAK,CAAC,OAAO,GAAG,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;IAC7C,gBAAgB,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEnD,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,yEAAyE;QACzE,qEAAqE;QACrE,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;AAAA,CACF"}
1
+ {"version":3,"file":"createComment.action.js","sourceRoot":"","sources":["../../../src/core/actions/createComment.action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAgB,EAChB,EAAE,IAAI,EAAqC,EAC3C;IACA,gCAAgC;IAChC,sDAAsD;IACtD,sEAAsE;IACtE,KAAK,CAAC,OAAO,GAAG,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;IAC7C,gBAAgB,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAAA,CACpD"}
@@ -0,0 +1,7 @@
1
+ import { type FiberNode } from '../../types';
2
+ /**
3
+ * Once all component- or fragment-fiber's nodes are mounted we can finalize
4
+ * their fragment-like container.
5
+ */
6
+ export declare function createContainerAction(fiber: FiberNode): void;
7
+ //# sourceMappingURL=createContainer.action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createContainer.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/createContainer.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAIlE;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,QAiBrD"}
@@ -0,0 +1,28 @@
1
+ import { containerSym } from '../../types';
2
+ import { getParentElement } from './helpers';
3
+ import { buildComment } from '../reconciliation/comments';
4
+ /**
5
+ * Once all component- or fragment-fiber's nodes are mounted we can finalize
6
+ * their fragment-like container.
7
+ */
8
+ export function createContainerAction(fiber) {
9
+ if (fiber.children.length === 0) {
10
+ // Case 1: We have no child nodes, so create an !--empty comment.
11
+ const container = getParentElement(fiber);
12
+ const empty = buildComment('empty', fiber.id);
13
+ container.appendChild(empty);
14
+ fiber.element = empty;
15
+ }
16
+ else if (fiber.children.length === 1) {
17
+ // Case 2: We have only one child. Let's refer to it. It's slightly faster
18
+ // than the `containerSym` approach.
19
+ fiber.element = fiber.children[0].element;
20
+ }
21
+ else {
22
+ // Case 3: We have more then one DOM children. Resort to the slow path:
23
+ // containerSym. In such a mode to get the fiber's domNodes we need to
24
+ // traverse through some of its children.
25
+ fiber.element = containerSym;
26
+ }
27
+ }
28
+ //# sourceMappingURL=createContainer.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createContainer.action.js","sourceRoot":"","sources":["../../../src/core/actions/createContainer.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAgB,EAAE;IACtD,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChC,iEAAiE;QACjE,MAAM,SAAS,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC1C,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;QAC9C,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC7B,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;IACxB,CAAC;SAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvC,0EAA0E;QAC1E,oCAAoC;QACpC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAC5C,CAAC;SAAM,CAAC;QACN,uEAAuE;QACvE,sEAAsE;QACtE,yCAAyC;QACzC,KAAK,CAAC,OAAO,GAAG,YAAY,CAAC;IAC/B,CAAC;AAAA,CACF"}
@@ -1,4 +1,5 @@
1
1
  import type { FiberNode } from '../../types';
2
+ import type { CreateTagAction } from '../../types/actions';
2
3
  /**
3
4
  * Handles two scenarios:
4
5
  * - Creates a <!--r:portal:id--> comment for portal fibers
@@ -6,5 +7,5 @@ import type { FiberNode } from '../../types';
6
7
  *
7
8
  * This doesn't create child nodes or set attributes/event handlers.
8
9
  */
9
- export declare function createTagAction(fiber: FiberNode): void;
10
+ export declare function createTagAction(fiber: FiberNode, { attrs, ref }: CreateTagAction): void;
10
11
  //# sourceMappingURL=createTag.action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createTag.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/createTag.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAIpD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAkBtD"}
1
+ {"version":3,"file":"createTag.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/createTag.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAIpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAIlE;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,SAAS,EAChB,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,eAAe,GAC9B,IAAI,CAsCN"}
@@ -1,5 +1,8 @@
1
1
  import { getParentElement } from './helpers';
2
- import { applyAction } from './applyAction';
2
+ import { createCommentAction } from './createComment.action';
3
+ import { setAttrAction } from './setAttr.action';
4
+ import { setRefAction } from './setRef.action';
5
+ import { ReactError } from '../reconciliation/errors/ReactError';
3
6
  /**
4
7
  * Handles two scenarios:
5
8
  * - Creates a <!--r:portal:id--> comment for portal fibers
@@ -7,15 +10,15 @@ import { applyAction } from './applyAction';
7
10
  *
8
11
  * This doesn't create child nodes or set attributes/event handlers.
9
12
  */
10
- export function createTagAction(fiber) {
13
+ export function createTagAction(fiber, { attrs, ref }) {
11
14
  if (fiber.type !== 'tag') {
12
- throw new Error(`createTagAction supports only tag-fiber-nodes.`);
15
+ throw new ReactError(fiber, `createTagAction supports only tag-fiber-nodes.`);
13
16
  }
14
17
  if (fiber.data instanceof HTMLElement) {
15
18
  // This is a portal, not a regular tag. We shouldn't create it since it
16
19
  // already exists outside the app's DOM subtree. Instead, create a
17
20
  // <!--r:portal:id--> comment node.
18
- applyAction({ type: 'CreateComment', fiber, mode: 'portal' });
21
+ createCommentAction(fiber, { mode: 'portal' });
19
22
  }
20
23
  else if (fiber.tag !== 'root') {
21
24
  // 'root' is a special case - it's the node where the app is mounted.
@@ -24,8 +27,23 @@ export function createTagAction(fiber) {
24
27
  : document.createElement(fiber.tag);
25
28
  fiber.element = tag;
26
29
  getParentElement(fiber).appendChild(fiber.element);
30
+ if (fiber.element instanceof HTMLInputElement) {
31
+ if (attrs?.type === 'radio') {
32
+ attrs.checked ??= undefined;
33
+ }
34
+ if (typeof attrs?.type === 'string') {
35
+ fiber.element.type = attrs.type;
36
+ }
37
+ }
38
+ for (const [name, value] of Object.entries(attrs ?? EMPTY)) {
39
+ setAttrAction(fiber, { name, value, creation: true });
40
+ }
41
+ if (ref) {
42
+ setRefAction(fiber, { ref, dontUnsetRef: true });
43
+ }
27
44
  }
28
45
  }
46
+ const EMPTY = {};
29
47
  const SVG_TAGS = new Set([
30
48
  // Core SVG Elements:
31
49
  'svg',
@@ -1 +1 @@
1
- {"version":3,"file":"createTag.action.js","sourceRoot":"","sources":["../../../src/core/actions/createTag.action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,KAAgB,EAAQ;IACtD,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,YAAY,WAAW,EAAE,CAAC;QACtC,uEAAuE;QACvE,kEAAkE;QAClE,mCAAmC;QACnC,WAAW,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAChE,CAAC;SAAM,IAAI,KAAK,CAAC,GAAG,KAAK,MAAM,EAAE,CAAC;QAChC,qEAAqE;QACrE,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;YACjC,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,4BAA4B,EAAE,KAAK,CAAC,GAAG,CAAC;YACnE,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtC,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC;QACpB,gBAAgB,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;AAAA,CACF;AAED,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;IACvB,qBAAqB;IACrB,KAAK;IACL,GAAG;IACH,MAAM;IACN,QAAQ;IACR,KAAK;IACL,OAAO;IACP,QAAQ;IACR,OAAO;IACP,gBAAgB;IAChB,MAAM;IACN,QAAQ;IACR,SAAS;IACT,MAAM;IACN,UAAU;IACV,SAAS;IACT,MAAM;IACN,iBAAiB;IACjB,MAAM;IACN,OAAO;IACP,MAAM;IACN,UAAU;IACV,UAAU;IACV,UAAU;IACV,0BAA0B;IAC1B,OAAO;IACP,MAAM;IACN,UAAU;IACV,sBAAsB;IACtB,eAAe;IACf,QAAQ;IACR,SAAS;IACT,MAAM;IACN,UAAU;IACV,QAAQ;IACR,gCAAgC;IAChC,gBAAgB;IAChB,gBAAgB;IAChB,MAAM;IACN,sBAAsB;IACtB,SAAS;IACT,eAAe;IACf,kBAAkB;IAClB,KAAK;IACL,6BAA6B;IAC7B,SAAS;IACT,eAAe;IACf,qBAAqB;IACrB,aAAa;IACb,kBAAkB;IAClB,mBAAmB;IACnB,mBAAmB;IACnB,cAAc;IACd,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,gBAAgB;IAChB,SAAS;IACT,SAAS;IACT,aAAa;IACb,cAAc;IACd,UAAU;IACV,cAAc;IACd,oBAAoB;IACpB,aAAa;IACb,QAAQ;IACR,cAAc;IACd,iBAAiB;IACjB,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,WAAW;IACX,eAAe;IACf,eAAe;IACf,kBAAkB;IAClB,gBAAgB;IAChB,eAAe;CAChB,CAAC,CAAC"}
1
+ {"version":3,"file":"createTag.action.js","sourceRoot":"","sources":["../../../src/core/actions/createTag.action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,KAAgB,EAChB,EAAE,KAAK,EAAE,GAAG,EAAmB,EACzB;IACN,IAA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 -1 +1 @@
1
- {"version":3,"file":"createText.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/createText.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGpD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,QAWhD"}
1
+ {"version":3,"file":"createText.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/createText.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAIpD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,QAUhD"}
@@ -1,15 +1,12 @@
1
1
  import { getParentElement } from './helpers';
2
+ import { ReactError } from '../reconciliation/errors/ReactError';
2
3
  /**
3
4
  * Creates a new text DOM node.
4
5
  */
5
6
  export function createTextAction(fiber) {
6
7
  if (fiber.type !== 'text') {
7
- throw new Error(`Can't apply CreateText for a ${fiber.type} node`);
8
+ throw new ReactError(fiber, `Can't apply CreateText for a ${fiber.type} node`);
8
9
  }
9
- // Only two scenarios lead here:
10
- // - First render of a fragment or component. The parent's element is
11
- // a comment `r:begin:{id}`
12
- // - Render of a portal. The parent element is the portal target node.
13
10
  fiber.element = new Text(fiber.props.text);
14
11
  getParentElement(fiber).appendChild(fiber.element);
15
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createText.action.js","sourceRoot":"","sources":["../../../src/core/actions/createText.action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAgB,EAAE;IACjD,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,gCAAgC,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC;IACrE,CAAC;IAED,gCAAgC;IAChC,qEAAqE;IACrE,6BAA6B;IAC7B,sEAAsE;IACtE,KAAK,CAAC,OAAO,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3C,gBAAgB,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAAA,CACpD"}
1
+ {"version":3,"file":"createText.action.js","sourceRoot":"","sources":["../../../src/core/actions/createText.action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEjE;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAgB,EAAE;IACjD,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,UAAU,CAClB,KAAK,EACL,gCAAgC,KAAK,CAAC,IAAI,OAAO,CAClD,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,OAAO,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3C,gBAAgB,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAAA,CACpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../../../src/core/actions/dom/attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,eAAO,MAAM,gBAAgB,mEAe5B,CAAC;AAEF,eAAO,MAAM,UAAU,aAuCrB,CAAC"}
1
+ {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../../../src/core/actions/dom/attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,eAAO,MAAM,gBAAgB,mEAoB5B,CAAC;AAEF,eAAO,MAAM,UAAU,aAsCrB,CAAC"}
@@ -8,6 +8,10 @@ export const setHtmlAttribute = (element, name, value) => {
8
8
  }
9
9
  return;
10
10
  }
11
+ if (name === 'value') {
12
+ element.value = value == null ? '' : String(value);
13
+ return;
14
+ }
11
15
  element.setAttribute(name === 'className' ? 'class' : name, String(value));
12
16
  };
13
17
  export const BOOL_ATTRS = new Set([
@@ -19,7 +23,6 @@ export const BOOL_ATTRS = new Set([
19
23
  'contentEditable',
20
24
  'spellCheck',
21
25
  'draggable',
22
- 'value',
23
26
  'autoReverse',
24
27
  'externalResourcesRequired',
25
28
  'focusable',
@@ -1 +1 @@
1
- {"version":3,"file":"attributes.js","sourceRoot":"","sources":["../../../../src/core/actions/dom/attributes.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,OAAoB,EACpB,IAAY,EACZ,KAAmB,EACnB,EAAE,CAAC;IACH,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QACD,OAAO;IACT,CAAC;IAED,OAAO,CAAC,YAAY,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAAA,CAC5E,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IAChC,WAAW;IACX,SAAS;IACT,UAAU;IACV,OAAO;IACP,UAAU;IACV,iBAAiB;IACjB,YAAY;IACZ,WAAW;IACX,OAAO;IACP,aAAa;IACb,2BAA2B;IAC3B,WAAW;IACX,eAAe;IACf,iBAAiB;IACjB,OAAO;IACP,UAAU;IACV,UAAU;IACV,SAAS;IACT,OAAO;IACP,UAAU;IACV,yBAAyB;IACzB,uBAAuB;IACvB,gBAAgB;IAChB,QAAQ;IACR,MAAM;IACN,UAAU;IACV,YAAY;IACZ,MAAM;IACN,aAAa;IACb,UAAU;IACV,UAAU;IACV,UAAU;IACV,QAAQ;IACR,UAAU;IACV,WAAW;IACX,SAAS;IACT,UAAU;IACV,OAAO;CACR,CAAC,CAAC"}
1
+ {"version":3,"file":"attributes.js","sourceRoot":"","sources":["../../../../src/core/actions/dom/attributes.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,OAAoB,EACpB,IAAY,EACZ,KAAmB,EACnB,EAAE,CAAC;IACH,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QACD,OAAO;IACT,CAAC;IAED,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACpB,OAA4B,CAAC,KAAK,GAAG,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACzE,OAAO;IACT,CAAC;IAED,OAAO,CAAC,YAAY,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAAA,CAC5E,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IAChC,WAAW;IACX,SAAS;IACT,UAAU;IACV,OAAO;IACP,UAAU;IACV,iBAAiB;IACjB,YAAY;IACZ,WAAW;IACX,aAAa;IACb,2BAA2B;IAC3B,WAAW;IACX,eAAe;IACf,iBAAiB;IACjB,OAAO;IACP,UAAU;IACV,UAAU;IACV,SAAS;IACT,OAAO;IACP,UAAU;IACV,yBAAyB;IACzB,uBAAuB;IACvB,gBAAgB;IAChB,QAAQ;IACR,MAAM;IACN,UAAU;IACV,YAAY;IACZ,MAAM;IACN,aAAa;IACb,UAAU;IACV,UAAU;IACV,UAAU;IACV,QAAQ;IACR,UAAU;IACV,WAAW;IACX,SAAS;IACT,UAAU;IACV,OAAO;CACR,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../../../src/core/actions/dom/css.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAa,MAAM,oBAAoB,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,YAAY,wDA0CxB,CAAC"}
1
+ {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../../../src/core/actions/dom/css.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAa,MAAM,oBAAoB,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,YAAY,wDA0CxB,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { ReactError } from '../../../core/reconciliation/errors/ReactError';
1
2
  /**
2
3
  * Handles removing, toggling and adding tag styles.
3
4
  */
@@ -7,7 +8,7 @@ stylesRaw) => {
7
8
  if (typeof stylesRaw !== 'string' &&
8
9
  stylesRaw != null &&
9
10
  typeof stylesRaw !== 'object') {
10
- throw new Error(`Unsupported format of styles`);
11
+ throw new ReactError(fiber, `Unsupported format of styles`);
11
12
  }
12
13
  const elementStyle = fiber.element.style;
13
14
  const newStyles = typeof stylesRaw === 'string' ? strToStyles(stylesRaw) : (stylesRaw ?? {});
@@ -1 +1 @@
1
- {"version":3,"file":"css.js","sourceRoot":"","sources":["../../../../src/core/actions/dom/css.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,KAAmB;AACnB,gEAAgE;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AAK,CAAC,OAAO,GAAG,GAAG,CAAC;IAC7B,OAAO,MAAM,CAAC,WAAW,CACvB,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACpC,CAAC;QACD,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;KACnC,CAAC,CACH,CAAC;AAAA,CACH,CAAC;AAEF,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../src/core/actions/dom/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAErE,eAAO,MAAM,eAAe,oFAwC3B,CAAC"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../src/core/actions/dom/events.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAErE,eAAO,MAAM,eAAe,oFAwD3B,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { ReactError } from '../../../core/reconciliation/errors/ReactError';
1
2
  export const setEventHandler = (fiber, element, name, value) => {
2
3
  const { events } = fiber.data;
3
4
  if (value == null || value === false) {
@@ -8,22 +9,33 @@ export const setEventHandler = (fiber, element, name, value) => {
8
9
  return;
9
10
  }
10
11
  if (typeof value !== 'function') {
11
- throw new Error(`Unsupported format of event handler. It has to be "undefined" or a function`);
12
+ throw new ReactError(fiber, `Unsupported format of event handler. It has to be "undefined" or a function`);
12
13
  }
13
14
  // Instead of adding and removing event handlers on every render, we can add a
14
15
  // wrapper that calls `events[name]` and update only the internal
15
16
  // function when it changes.
16
17
  if (!events[name]) {
17
- const eventName = name.slice(2).toLowerCase(); // onClick -> click.
18
+ const capture = name.endsWith('Capture');
19
+ let eventName = name.slice(2).toLowerCase(); // onClick -> click.
20
+ if (capture) {
21
+ eventName = eventName.slice(0, eventName.length - 7);
22
+ }
23
+ if (eventName === 'change' &&
24
+ (fiber.tag === 'input' ||
25
+ fiber.tag === 'textarea' ||
26
+ fiber.tag === 'select')) {
27
+ eventName = 'input'; // Custom behavior. @see `./value.ts`.
28
+ }
18
29
  events[name] = {
19
30
  name: eventName,
20
31
  handler: value,
32
+ capture,
21
33
  wrapper: (event) => {
22
34
  // Original React doesn't support stopping propagation on `false` return.
23
35
  events[name].handler?.(event);
24
36
  },
25
37
  };
26
- element.addEventListener(eventName, events[name].wrapper);
38
+ element.addEventListener(eventName, events[name].wrapper, { capture });
27
39
  }
28
40
  else {
29
41
  // The tag is already listening to this event. Just update the internal ref.
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sourceRoot":"","sources":["../../../../src/core/actions/dom/events.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,KAAmB,EACnB,OAAgB,EAChB,IAAY,EACZ,KAAmB,EACb,EAAE,CAAC;IACT,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;IAE9B,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QACrC,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YACjB,uDAAuD;YACvD,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC;QAC9B,CAAC;QACD,OAAO;IACT,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CACb,6EAA6E,CAC9E,CAAC;IACJ,CAAC;IAED,8EAA8E;IAC9E,iEAAiE;IACjE,4BAA4B;IAC5B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAClB,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WA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AClB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,oBAAoB;QACjE,IAAI,OAAO,EAAE,CAAC;YACZ,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACvD,CAAC;QAED,IACE,SAAS,KAAK,QAAQ;YACtB,CAAC,KAAK,CAAC,GAAG,KAAK,OAAO;gBACpB,KAAK,CAAC,GAAG,KAAK,UAAU;gBACxB,KAAK,CAAC,GAAG,KAAK,QAAQ,CAAC,EACzB,CAAC;YACD,SAAS,GAAG,OAAO,CAAC,CAAC,sCAAsC;QAC7D,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,GAAG;YACb,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,OAAO;YACP,OAAO,EAAE,CAAC,KAAY,EAAE,EAAE,CAAC;gBACzB,yEAAyE;gBACzE,MAAM,CAAC,IAAI,CAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;YAAA,CAChC;SACF,CAAC;QACF,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;SAAM,CAAC;QACN,4EAA4E;QAC5E,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC;IAC/B,CAAC;AAAA,CACF,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { App, TagAttrValue, TagFiberNode } from '../../../types';
2
+ /**
3
+ * Original React has a very special behavior for the "onChange" event:
4
+ * - It treats "onChange" as an "onInput" event for form controls
5
+ * - If the "value" prop is provided and is not `null` or `undefined`, React
6
+ * treats the input as "controlled" and ignores user changes by restoring the
7
+ * original value after each input event
8
+ * - Even for controlled inputs, React still calls the "onChange" handler with
9
+ * the updated event.target.value before restoring the previous value
10
+ * - React overrides the property descriptor of the "value" property on the DOM
11
+ * element to intercept and track all value changes
12
+ */
13
+ export declare const setValueAttr: (fiber: TagFiberNode, attrName: "checked" | "value", attrValue: TagAttrValue) => void;
14
+ export declare const changeControlValue: (app: App, element: FormControl, attrName: "checked" | "value", valueRaw: unknown, restoreCursor?: boolean) => void;
15
+ type FormControl = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
16
+ export {};
17
+ //# sourceMappingURL=value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value.d.ts","sourceRoot":"","sources":["../../../../src/core/actions/dom/value.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAI1E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,uFAsCxB,CAAC;AAmBF,eAAO,MAAM,kBAAkB,qHAiC9B,CAAC;AA2KF,KAAK,WAAW,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,iBAAiB,CAAC"}