@faiwer/react 0.8.4 → 19.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -21
- package/dist/core/actions/applyAction.d.ts.map +1 -1
- package/dist/core/actions/applyAction.js +6 -0
- package/dist/core/actions/applyAction.js.map +1 -1
- package/dist/core/actions/catchError.action.d.ts +10 -0
- package/dist/core/actions/catchError.action.d.ts.map +1 -0
- package/dist/core/actions/catchError.action.js +51 -0
- package/dist/core/actions/catchError.action.js.map +1 -0
- package/dist/core/actions/createComment.action.d.ts +2 -2
- package/dist/core/actions/createComment.action.d.ts.map +1 -1
- package/dist/core/actions/createComment.action.js +1 -8
- package/dist/core/actions/createComment.action.js.map +1 -1
- package/dist/core/actions/createContainer.action.d.ts +7 -0
- package/dist/core/actions/createContainer.action.d.ts.map +1 -0
- package/dist/core/actions/createContainer.action.js +28 -0
- package/dist/core/actions/createContainer.action.js.map +1 -0
- package/dist/core/actions/createTag.action.d.ts +2 -1
- package/dist/core/actions/createTag.action.d.ts.map +1 -1
- package/dist/core/actions/createTag.action.js +22 -4
- package/dist/core/actions/createTag.action.js.map +1 -1
- package/dist/core/actions/createText.action.d.ts.map +1 -1
- package/dist/core/actions/createText.action.js +2 -5
- package/dist/core/actions/createText.action.js.map +1 -1
- package/dist/core/actions/dom/attributes.d.ts.map +1 -1
- package/dist/core/actions/dom/attributes.js +4 -1
- package/dist/core/actions/dom/attributes.js.map +1 -1
- package/dist/core/actions/dom/css.d.ts.map +1 -1
- package/dist/core/actions/dom/css.js +2 -1
- package/dist/core/actions/dom/css.js.map +1 -1
- package/dist/core/actions/dom/events.d.ts.map +1 -1
- package/dist/core/actions/dom/events.js +15 -3
- package/dist/core/actions/dom/events.js.map +1 -1
- package/dist/core/actions/dom/value.d.ts +18 -0
- package/dist/core/actions/dom/value.d.ts.map +1 -0
- package/dist/core/actions/dom/value.js +211 -0
- package/dist/core/actions/dom/value.js.map +1 -0
- package/dist/core/actions/helpers.d.ts +17 -10
- package/dist/core/actions/helpers.d.ts.map +1 -1
- package/dist/core/actions/helpers.js +64 -70
- package/dist/core/actions/helpers.js.map +1 -1
- package/dist/core/actions/relayout.action.d.ts +2 -1
- package/dist/core/actions/relayout.action.d.ts.map +1 -1
- package/dist/core/actions/relayout.action.js +119 -30
- package/dist/core/actions/relayout.action.js.map +1 -1
- package/dist/core/actions/remove.action.d.ts +2 -2
- package/dist/core/actions/remove.action.d.ts.map +1 -1
- package/dist/core/actions/remove.action.js +20 -17
- package/dist/core/actions/remove.action.js.map +1 -1
- package/dist/core/actions/replace.action.d.ts +1 -1
- package/dist/core/actions/replace.action.d.ts.map +1 -1
- package/dist/core/actions/replace.action.js +34 -23
- package/dist/core/actions/replace.action.js.map +1 -1
- package/dist/core/actions/scheduleEffect.action.d.ts +7 -0
- package/dist/core/actions/scheduleEffect.action.d.ts.map +1 -0
- package/dist/core/actions/scheduleEffect.action.js +8 -0
- package/dist/core/actions/scheduleEffect.action.js.map +1 -0
- package/dist/core/actions/setAttr.action.d.ts +1 -1
- package/dist/core/actions/setAttr.action.d.ts.map +1 -1
- package/dist/core/actions/setAttr.action.js +47 -6
- package/dist/core/actions/setAttr.action.js.map +1 -1
- package/dist/core/actions/setProps.action.d.ts.map +1 -1
- package/dist/core/actions/setProps.action.js +2 -1
- package/dist/core/actions/setProps.action.js.map +1 -1
- package/dist/core/actions/setRef.action.d.ts +1 -1
- package/dist/core/actions/setRef.action.d.ts.map +1 -1
- package/dist/core/actions/setRef.action.js +5 -6
- package/dist/core/actions/setRef.action.js.map +1 -1
- package/dist/core/actions/setText.action.d.ts.map +1 -1
- package/dist/core/actions/setText.action.js +3 -3
- package/dist/core/actions/setText.action.js.map +1 -1
- package/dist/core/classComponent.d.ts +2 -1
- package/dist/core/classComponent.d.ts.map +1 -1
- package/dist/core/classComponent.js +20 -12
- package/dist/core/classComponent.js.map +1 -1
- package/dist/core/compact.d.ts +10 -29
- package/dist/core/compact.d.ts.map +1 -1
- package/dist/core/compact.js +12 -100
- package/dist/core/compact.js.map +1 -1
- package/dist/core/components.d.ts +6 -4
- package/dist/core/components.d.ts.map +1 -1
- package/dist/core/components.js +26 -8
- package/dist/core/components.js.map +1 -1
- package/dist/core/createElement.d.ts +2 -8
- package/dist/core/createElement.d.ts.map +1 -1
- package/dist/core/createElement.js +3 -1
- package/dist/core/createElement.js.map +1 -1
- package/dist/core/reactNodeToFiberNode.d.ts +3 -1
- package/dist/core/reactNodeToFiberNode.d.ts.map +1 -1
- package/dist/core/reactNodeToFiberNode.js +80 -17
- package/dist/core/reactNodeToFiberNode.js.map +1 -1
- package/dist/core/reconciliation/app.js +3 -3
- package/dist/core/reconciliation/app.js.map +1 -1
- package/dist/core/reconciliation/collect/fromApp.d.ts +2 -1
- package/dist/core/reconciliation/collect/fromApp.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromApp.js +7 -26
- package/dist/core/reconciliation/collect/fromApp.js.map +1 -1
- package/dist/core/reconciliation/collect/fromChildrenPair.d.ts +2 -1
- package/dist/core/reconciliation/collect/fromChildrenPair.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromChildrenPair.js +37 -10
- package/dist/core/reconciliation/collect/fromChildrenPair.js.map +1 -1
- package/dist/core/reconciliation/collect/fromComponent.d.ts +3 -2
- package/dist/core/reconciliation/collect/fromComponent.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromComponent.js +27 -9
- package/dist/core/reconciliation/collect/fromComponent.js.map +1 -1
- package/dist/core/reconciliation/collect/fromFiberPair.d.ts +2 -1
- package/dist/core/reconciliation/collect/fromFiberPair.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromFiberPair.js +8 -5
- package/dist/core/reconciliation/collect/fromFiberPair.js.map +1 -1
- package/dist/core/reconciliation/collect/fromNewFiber.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromNewFiber.js +7 -15
- package/dist/core/reconciliation/collect/fromNewFiber.js.map +1 -1
- package/dist/core/reconciliation/effects.d.ts +2 -2
- package/dist/core/reconciliation/effects.d.ts.map +1 -1
- package/dist/core/reconciliation/effects.js +52 -4
- package/dist/core/reconciliation/effects.js.map +1 -1
- package/dist/core/reconciliation/errors/ReactError.d.ts +15 -0
- package/dist/core/reconciliation/errors/ReactError.d.ts.map +1 -0
- package/dist/core/reconciliation/errors/ReactError.js +56 -0
- package/dist/core/reconciliation/errors/ReactError.js.map +1 -0
- package/dist/core/reconciliation/errors/stack.d.ts +8 -2
- package/dist/core/reconciliation/errors/stack.d.ts.map +1 -1
- package/dist/core/reconciliation/errors/stack.js +65 -8
- package/dist/core/reconciliation/errors/stack.js.map +1 -1
- package/dist/core/reconciliation/fibers.d.ts +1 -0
- package/dist/core/reconciliation/fibers.d.ts.map +1 -1
- package/dist/core/reconciliation/fibers.js +3 -2
- package/dist/core/reconciliation/fibers.js.map +1 -1
- package/dist/core/reconciliation/heap.d.ts +18 -0
- package/dist/core/reconciliation/heap.d.ts.map +1 -0
- package/dist/core/reconciliation/heap.js +81 -0
- package/dist/core/reconciliation/heap.js.map +1 -0
- package/dist/core/reconciliation/invalidateFiber.d.ts.map +1 -1
- package/dist/core/reconciliation/invalidateFiber.js +6 -5
- package/dist/core/reconciliation/invalidateFiber.js.map +1 -1
- package/dist/core/reconciliation/mount.d.ts.map +1 -1
- package/dist/core/reconciliation/mount.js +24 -6
- package/dist/core/reconciliation/mount.js.map +1 -1
- package/dist/core/reconciliation/postCommit.d.ts +1 -1
- package/dist/core/reconciliation/postCommit.d.ts.map +1 -1
- package/dist/core/reconciliation/postCommit.js +17 -4
- package/dist/core/reconciliation/postCommit.js.map +1 -1
- package/dist/core/reconciliation/queue.d.ts +21 -0
- package/dist/core/reconciliation/queue.d.ts.map +1 -0
- package/dist/core/reconciliation/queue.js +55 -0
- package/dist/core/reconciliation/queue.js.map +1 -0
- package/dist/core/reconciliation/render.d.ts.map +1 -1
- package/dist/core/reconciliation/render.js +9 -3
- package/dist/core/reconciliation/render.js.map +1 -1
- package/dist/core/reconciliation/runFiberComponents.d.ts +3 -1
- package/dist/core/reconciliation/runFiberComponents.d.ts.map +1 -1
- package/dist/core/reconciliation/runFiberComponents.js +33 -5
- package/dist/core/reconciliation/runFiberComponents.js.map +1 -1
- package/dist/core/reconciliation/typeGuards.d.ts +3 -0
- package/dist/core/reconciliation/typeGuards.d.ts.map +1 -1
- package/dist/core/reconciliation/typeGuards.js +13 -0
- package/dist/core/reconciliation/typeGuards.js.map +1 -1
- package/dist/core/reconciliation/validateApp.d.ts +1 -1
- package/dist/core/reconciliation/validateApp.d.ts.map +1 -1
- package/dist/core/reconciliation/validateApp.js +28 -21
- package/dist/core/reconciliation/validateApp.js.map +1 -1
- package/dist/hooks/helpers.d.ts +3 -3
- package/dist/hooks/helpers.d.ts.map +1 -1
- package/dist/hooks/helpers.js +3 -2
- package/dist/hooks/helpers.js.map +1 -1
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useContext.d.ts.map +1 -1
- package/dist/hooks/useContext.js +6 -6
- package/dist/hooks/useContext.js.map +1 -1
- package/dist/hooks/useEffect.d.ts +2 -1
- package/dist/hooks/useEffect.d.ts.map +1 -1
- package/dist/hooks/useEffect.js +21 -7
- package/dist/hooks/useEffect.js.map +1 -1
- package/dist/hooks/useError.d.ts +5 -0
- package/dist/hooks/useError.d.ts.map +1 -0
- package/dist/hooks/useError.js +19 -0
- package/dist/hooks/useError.js.map +1 -0
- package/dist/hooks/useReducer.d.ts +7 -0
- package/dist/hooks/useReducer.d.ts.map +1 -0
- package/dist/hooks/useReducer.js +10 -0
- package/dist/hooks/useReducer.js.map +1 -0
- package/dist/hooks/useRef.d.ts +8 -3
- package/dist/hooks/useRef.d.ts.map +1 -1
- package/dist/hooks/useRef.js +27 -0
- package/dist/hooks/useRef.js.map +1 -1
- package/dist/hooks/useState.d.ts +1 -1
- package/dist/hooks/useState.d.ts.map +1 -1
- package/dist/hooks/useState.js +3 -6
- package/dist/hooks/useState.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/jsx.d.ts +159 -44
- package/dist/mocks.d.ts +0 -7
- package/dist/mocks.d.ts.map +1 -1
- package/dist/mocks.js +0 -6
- package/dist/mocks.js.map +1 -1
- package/dist/react.d.ts +46 -0
- package/dist/types/actions.d.ts +23 -5
- package/dist/types/actions.d.ts.map +1 -1
- package/dist/types/app.d.ts +17 -3
- package/dist/types/app.d.ts.map +1 -1
- package/dist/types/attributes.d.ts +42 -0
- package/dist/types/attributes.d.ts.map +1 -0
- package/dist/types/attributes.js +2 -0
- package/dist/types/attributes.js.map +1 -0
- package/dist/types/common.d.ts +10 -1
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/component.d.ts +11 -2
- package/dist/types/component.d.ts.map +1 -1
- package/dist/types/context.d.ts +3 -2
- package/dist/types/context.d.ts.map +1 -1
- package/dist/types/core.d.ts +17 -13
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/dom.d.ts +23 -22
- package/dist/types/dom.d.ts.map +1 -1
- package/dist/types/events.d.ts +18 -11
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/fiber.d.ts +30 -12
- package/dist/types/fiber.d.ts.map +1 -1
- package/dist/types/fiber.js +5 -1
- package/dist/types/fiber.js.map +1 -1
- package/dist/types/hooks.d.ts +16 -6
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/react.d.ts +31 -0
- package/dist/types/react.d.ts.map +1 -0
- package/dist/types/react.js +2 -0
- package/dist/types/react.js.map +1 -0
- package/dist/types/refs.d.ts +5 -8
- package/dist/types/refs.d.ts.map +1 -1
- package/package.json +11 -3
package/README.md
CHANGED
|
@@ -2,10 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
A naive React implementation. Why? What's wrong with the existing one? Nothing. I just wanted to implement it from scratch by myself. It can be used as a drop-in replacement for some simple React apps. May require some trivial changes, though.
|
|
4
4
|
|
|
5
|
+
A few stats:
|
|
6
|
+
|
|
7
|
+
- ~5.5k LoC in TypeScript
|
|
8
|
+
- ~122 KiB: transpiled JS code
|
|
9
|
+
- ~44 KiB: minified by `terser`
|
|
10
|
+
- ~16 KiB: minified gzipped
|
|
11
|
+
- `preact` is about ~10 KiB
|
|
12
|
+
|
|
13
|
+
- areFiberNodesEq
|
|
14
|
+
// what if a context's ctx was changed? switch one context to another
|
|
15
|
+
// how does it work in React?
|
|
16
|
+
|
|
17
|
+
- Multiple setState work?
|
|
18
|
+
setNumber(n => n + 1);
|
|
19
|
+
setNumber(n => n + 1);
|
|
20
|
+
setNumber(n => n + 1);
|
|
21
|
+
= +3
|
|
22
|
+
|
|
5
23
|
## It supports
|
|
24
|
+
https://github.com/preactjs/preact-devtools/blob/main/src/adapter/renderer.ts
|
|
25
|
+
|
|
6
26
|
|
|
7
27
|
- JSX
|
|
8
28
|
- Functional components
|
|
29
|
+
- Class components (limited)
|
|
9
30
|
- Hooks:
|
|
10
31
|
- `useState`
|
|
11
32
|
- `useRef`
|
|
@@ -14,21 +35,30 @@ A naive React implementation. Why? What's wrong with the existing one? Nothing.
|
|
|
14
35
|
- `useLayoutEffect`, `useEffect` (improved versions)
|
|
15
36
|
- `useId`
|
|
16
37
|
- `useContext`
|
|
17
|
-
-
|
|
38
|
+
- Refs
|
|
18
39
|
- Context
|
|
19
40
|
- Portals
|
|
20
41
|
- Fragments
|
|
21
42
|
|
|
22
43
|
## Installation
|
|
23
44
|
|
|
24
|
-
- `npm
|
|
25
|
-
-
|
|
45
|
+
- `npm uninstall react react-dom @types/react @types/react-dom`
|
|
46
|
+
- `npm i --save react@npm:@faiwer/react`
|
|
47
|
+
- `npm i --save --force react-dom@npm:@faiwer/react-dom`
|
|
48
|
+
- You might need to update your `tsconfig.json` (no necessarily):
|
|
26
49
|
```json
|
|
27
50
|
"compilerOptions": {
|
|
28
51
|
"jsx": "react-jsx",
|
|
29
|
-
"jsxImportSource": "@faiwer/react"
|
|
30
52
|
}
|
|
31
53
|
```
|
|
54
|
+
Or use `"jsx": "preserve"`
|
|
55
|
+
- If you're using `eslint-plugin-react` than configure this in your .eslintrc:
|
|
56
|
+
```json
|
|
57
|
+
"settings": {
|
|
58
|
+
"react": { "version": "19" } // not 'detect'
|
|
59
|
+
},
|
|
60
|
+
```
|
|
61
|
+
- Good luck. If your project is big enough, I'm pretty sure you got a ton of type errors. Sorry :-)
|
|
32
62
|
|
|
33
63
|
### Usage
|
|
34
64
|
|
|
@@ -41,24 +71,19 @@ createRoot(container).render(<App />);
|
|
|
41
71
|
|
|
42
72
|
## TODO
|
|
43
73
|
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
- `useReducer`
|
|
74
|
+
- HMR
|
|
75
|
+
- Preact Devtools?
|
|
76
|
+
- JSX: Math namespace
|
|
77
|
+
- Lazy
|
|
78
|
+
- Make all hooks pure
|
|
79
|
+
- Resolve "TODO: add a test" comments
|
|
80
|
+
- leverage `isStaticChildren` in `jsx()`
|
|
56
81
|
|
|
57
82
|
## It does NOT support
|
|
58
83
|
|
|
59
84
|
… and probably never will:
|
|
60
85
|
|
|
61
|
-
- Class Components
|
|
86
|
+
- Class Components: `getSnapshotBeforeUpdate`
|
|
62
87
|
- Synthetic events
|
|
63
88
|
- Portals:
|
|
64
89
|
- Event bubbling from portals
|
|
@@ -85,8 +110,5 @@ createRoot(container).render(<App />);
|
|
|
85
110
|
- It renders HTML-comment for nullable nodes and some fragments. Why? It helps a lot to keep the reconciliation algorithm simple. Took this idea from Angular.
|
|
86
111
|
- No synthetic events. I don't see any reason to implement them.
|
|
87
112
|
- All components are memoized by default. Why not?
|
|
88
|
-
-
|
|
113
|
+
- Not too much custom DOM-related code. This library is supposed to be simple and silly. Whereas React-DOM lib is huge.
|
|
89
114
|
- 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;
|
|
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;AAezD;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,0BAGvB,CAAC"}
|
|
@@ -8,6 +8,9 @@ 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';
|
|
12
|
+
import { scheduleEffectAction } from './scheduleEffect.action';
|
|
13
|
+
import { catchErrorAction } from './catchError.action';
|
|
11
14
|
/**
|
|
12
15
|
* The commit phase of the rendering process contains two parts:
|
|
13
16
|
* - Applying DOM changes
|
|
@@ -24,6 +27,7 @@ const actionHandlers = {
|
|
|
24
27
|
CreateTag: createTagAction,
|
|
25
28
|
CreateText: createTextAction,
|
|
26
29
|
CreateComment: createCommentAction,
|
|
30
|
+
CreateContainer: createContainerAction,
|
|
27
31
|
SetProps: setPropsAction,
|
|
28
32
|
SetRef: setRefAction,
|
|
29
33
|
SetAttr: setAttrAction,
|
|
@@ -31,5 +35,7 @@ const actionHandlers = {
|
|
|
31
35
|
Remove: removeAction,
|
|
32
36
|
Replace: replaceAction,
|
|
33
37
|
Relayout: relayoutAction,
|
|
38
|
+
ScheduleEffect: scheduleEffectAction,
|
|
39
|
+
CatchError: catchErrorAction,
|
|
34
40
|
};
|
|
35
41
|
//# sourceMappingURL=applyAction.js.map
|
|
@@ -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;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
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;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;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;IACxB,cAAc,EAAE,oBAAoB;IACpC,UAAU,EAAE,gBAAgB;CAC7B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type FiberNode } from '../../types';
|
|
2
|
+
import type { CatchErrorAction } from '../../types/actions';
|
|
3
|
+
/**
|
|
4
|
+
* During the current render one of the components failed. This is the error
|
|
5
|
+
* handler for the closest error boundary component.
|
|
6
|
+
* - It removes the existing content
|
|
7
|
+
* - Runs the error handler
|
|
8
|
+
*/
|
|
9
|
+
export declare function catchErrorAction(fiber: FiberNode, { error }: Pick<CatchErrorAction, 'error'>): void;
|
|
10
|
+
//# sourceMappingURL=catchError.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catchError.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/catchError.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAMnE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,EAChB,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,QA4C3C"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { removeAction } from './remove.action';
|
|
2
|
+
import { scheduleEffect } from '../reconciliation/effects';
|
|
3
|
+
import { tryFixContainerType } from './relayout.action';
|
|
4
|
+
import { isFiberDead } from '../reconciliation/fibers';
|
|
5
|
+
import { getAppByFiber } from '../reconciliation/app';
|
|
6
|
+
import { ReactError } from '../reconciliation/errors/ReactError';
|
|
7
|
+
/**
|
|
8
|
+
* During the current render one of the components failed. This is the error
|
|
9
|
+
* handler for the closest error boundary component.
|
|
10
|
+
* - It removes the existing content
|
|
11
|
+
* - Runs the error handler
|
|
12
|
+
*/
|
|
13
|
+
export function catchErrorAction(fiber, { error }) {
|
|
14
|
+
scheduleEffect(fiber, () => {
|
|
15
|
+
const compFiber = fiber;
|
|
16
|
+
// Disable this node as an error boundary for one render cycle to avoid
|
|
17
|
+
// an eternal loop if the sequential render again leads to an error.
|
|
18
|
+
compFiber.data.isErrorBoundary = false;
|
|
19
|
+
const info = {
|
|
20
|
+
componentStack: error.fullStack,
|
|
21
|
+
};
|
|
22
|
+
const handlers = compFiber.data.hooks.filter((h) => h.type === 'error');
|
|
23
|
+
for (const { fn } of handlers) {
|
|
24
|
+
fn(error, info);
|
|
25
|
+
}
|
|
26
|
+
if (!getAppByFiber(fiber).invalidatedComponents.has(compFiber)) {
|
|
27
|
+
throw new ReactError(compFiber, `ErrorBoundaries must update their state on error`);
|
|
28
|
+
}
|
|
29
|
+
// Recover `isErrorBoundary` after a sucessful rerender.
|
|
30
|
+
scheduleEffect(fiber, () => {
|
|
31
|
+
if (!isFiberDead(compFiber)) {
|
|
32
|
+
compFiber.data.isErrorBoundary = true;
|
|
33
|
+
}
|
|
34
|
+
}, 'afterActions');
|
|
35
|
+
}, 'normal');
|
|
36
|
+
if (fiber.element) {
|
|
37
|
+
killChildrenOnError(fiber);
|
|
38
|
+
}
|
|
39
|
+
// else: fiber.children === [nullNode].
|
|
40
|
+
}
|
|
41
|
+
const killChildrenOnError = (fiber) => {
|
|
42
|
+
// Not the 1st render. Nodes are mounted. Must be removed.
|
|
43
|
+
for (const [idx, child] of fiber.children.entries()) {
|
|
44
|
+
removeAction(child, { last: idx === fiber.children.length - 1 });
|
|
45
|
+
}
|
|
46
|
+
fiber.children = [];
|
|
47
|
+
if (fiber.parent.type === 'component') {
|
|
48
|
+
tryFixContainerType(fiber.parent);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=catchError.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catchError.action.js","sourceRoot":"","sources":["../../../src/core/actions/catchError.action.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAgB,EAChB,EAAE,KAAK,EAAmC,EAC1C;IACA,cA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AC,KAAK,EAAE,EAAE,IAAI,EAAE,GAAG,KAAK,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAC;IACpB,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACtC,mBAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;AAAA,CACF,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
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,
|
|
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
|
-
// -
|
|
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,
|
|
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,
|
|
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 {
|
|
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
|
|
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
|
-
|
|
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,
|
|
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,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,UAAU,CAClB,KAAK,EACL,gDAAgD,CACjD,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,YAAY,WAAW,EAAE,CAAC;QACtC,uEAAuE;QACvE,kEAAkE;QAClE,mCAAmC;QACnC,mBAAmB,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACjD,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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AgB;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 +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;
|
|
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
|
|
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;
|
|
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,
|
|
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,
|
|
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":"
|
|
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
|
|
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":"
|
|
1
|
+
{"version":3,"file":"css.js","sourceRoot":"","sources":["../../../../src/core/actions/dom/css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oDAAoD,CAAC;AAGhF;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,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,GAAG,IAAI,YAAY,EAAE,CAAC;gBAC/B,8CAA8C;gBAC9C,YAAY,CAAC,GAAsB,CAAC,GAAG,KAAK,CAAC;YAC/C,CAAC;QACH,CAAC;IACH,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,OAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;AAAA,CAC/B,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,GAAG,CAAC,GAAW,EAAa,EAAE,CAAC;IAC9C,QAAQ,CAAC,KAAK,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":"
|
|
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
|
|
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
|
|
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":"
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../../src/core/actions/dom/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oDAAoD,CAAC;AAGhF,MA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AE,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,18 @@
|
|
|
1
|
+
import type { FiberNode, 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: (fiber: FiberNode, element: FormControl, attrName: "checked" | "value", valueRaw: unknown, restoreCursor?: boolean) => void;
|
|
15
|
+
type FormControl = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
|
|
16
|
+
export declare const updateValueStore: (fiber: FiberNode) => void;
|
|
17
|
+
export {};
|
|
18
|
+
//# 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,EAEV,SAAS,EACT,YAAY,EACZ,YAAY,EACb,MAAM,oBAAoB,CAAC;AAI5B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,uFAsCxB,CAAC;AA2BF,eAAO,MAAM,kBAAkB,6HAiC9B,CAAC;AAgLF,KAAK,WAAW,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,iBAAiB,CAAC;AAE9E,eAAO,MAAM,gBAAgB,4BAK5B,CAAC"}
|