@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.
- package/README.md +20 -17
- package/dist/core/actions/applyAction.d.ts.map +1 -1
- package/dist/core/actions/applyAction.js +2 -0
- package/dist/core/actions/applyAction.js.map +1 -1
- 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 +17 -0
- package/dist/core/actions/dom/value.d.ts.map +1 -0
- package/dist/core/actions/dom/value.js +204 -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 +63 -68
- 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 -16
- 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 +30 -23
- package/dist/core/actions/replace.action.js.map +1 -1
- 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 +48 -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 +4 -4
- 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.map +1 -1
- package/dist/core/classComponent.js +4 -3
- 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 +2 -2
- package/dist/core/components.d.ts.map +1 -1
- package/dist/core/components.js +19 -6
- 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.map +1 -1
- package/dist/core/reactNodeToFiberNode.js +6 -1
- 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.map +1 -1
- package/dist/core/reconciliation/collect/fromApp.js +3 -27
- package/dist/core/reconciliation/collect/fromApp.js.map +1 -1
- package/dist/core/reconciliation/collect/fromChildrenPair.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromChildrenPair.js +11 -6
- package/dist/core/reconciliation/collect/fromChildrenPair.js.map +1 -1
- package/dist/core/reconciliation/collect/fromComponent.d.ts +2 -2
- package/dist/core/reconciliation/collect/fromComponent.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromComponent.js +4 -8
- package/dist/core/reconciliation/collect/fromComponent.js.map +1 -1
- package/dist/core/reconciliation/collect/fromFiberPair.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromFiberPair.js +2 -4
- 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/errors/ReactError.d.ts +7 -0
- package/dist/core/reconciliation/errors/ReactError.d.ts.map +1 -0
- package/dist/core/reconciliation/errors/ReactError.js +26 -0
- package/dist/core/reconciliation/errors/ReactError.js.map +1 -0
- package/dist/core/reconciliation/errors/stack.d.ts +7 -1
- package/dist/core/reconciliation/errors/stack.d.ts.map +1 -1
- package/dist/core/reconciliation/errors/stack.js +63 -6
- 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 +14 -4
- 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.js +1 -1
- package/dist/core/reconciliation/render.js.map +1 -1
- package/dist/core/reconciliation/runFiberComponents.d.ts.map +1 -1
- package/dist/core/reconciliation/runFiberComponents.js +2 -1
- 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 +2 -2
- 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 +1 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -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 +1 -1
- package/dist/hooks/useEffect.js.map +1 -1
- 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 +4 -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 +11 -4
- package/dist/types/actions.d.ts.map +1 -1
- package/dist/types/app.d.ts +12 -2
- 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 +5 -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 +29 -11
- 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 +4 -4
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/react.d.ts +35 -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
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { nullthrowsForFiber, ReactError, } from '../reconciliation/errors/ReactError';
|
|
2
2
|
/**
|
|
3
3
|
* Replaces the text content within a Text DOM node.
|
|
4
4
|
*/
|
|
5
5
|
export function setTextAction(fiber, { text }) {
|
|
6
6
|
if (fiber.type !== 'text') {
|
|
7
|
-
throw new
|
|
7
|
+
throw new ReactError(fiber, `Can't apply setText action to non-text node`);
|
|
8
8
|
}
|
|
9
9
|
fiber.props = { text };
|
|
10
|
-
|
|
10
|
+
nullthrowsForFiber(fiber, fiber.element).textContent = text;
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=setText.action.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setText.action.js","sourceRoot":"","sources":["../../../src/core/actions/setText.action.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"setText.action.js","sourceRoot":"","sources":["../../../src/core/actions/setText.action.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,UAAU,GACX,MAAM,qCAAqC,CAAC;AAE7C;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAAgB,EAAE,EAAE,IAAI,EAAiB,EAAE;IACvE,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,UAAU,CAAC,KAAK,EAAE,6CAA6C,CAAC,CAAC;IAC7E,CAAC;IACD,KAAK,CAAC,KAAK,GAAG,EAAE,IAAI,EAAE,CAAC;IACvB,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,WAAW,GAAG,IAAI,CAAC;AAAA,CAC7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classComponent.d.ts","sourceRoot":"","sources":["../../src/core/classComponent.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,YAAY,EACb,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"classComponent.d.ts","sourceRoot":"","sources":["../../src/core/classComponent.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,YAAY,EACb,MAAM,oBAAoB,CAAC;AAI5B,eAAO,MAAM,gBAAgB,yEAO5B,CAAC;AAEF;;;;GAIG;AACH,qBAAa,SAAS,CACpB,KAAK,SAAS,YAAY,GAAG,YAAY,EACzC,KAAK,SAAS,YAAY,GAAG,YAAY;IAEzC,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAG,KAAK,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC7B,MAAM,CAAC,WAAW,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC;IAEvC,YAAY,KAAK,EAAE,KAAK,EAEvB;IAGD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,QAAI;IAGpC,iBAAiB,IAAI,IAAI,CAAG;IAC5B,oBAAoB,IAAI,IAAI,CAAG;IAE/B,WAAW,CAAC,EAAE,CAAC,EAAE,MAAM,IAAI,QAK1B;IAED,kBAAkB,CAAC,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,QAAI;IAE3D,qBAAqB,CACnB,UAAU,EAAE,KAAK,EACjB,UAAU,EAAE,KAAK,EACjB,YAAY,CAAC,EAAE,OAAO,WAGvB;IAED,MAAM,IAAI,GAAG,CAAC,OAAO,CAKpB;IAED,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAEvD;IAED,uBAAuB,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,GAAG,OAAO,CAEzE;IAED,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAEtE;CACF;AASD;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GACpC,KAAK,uBACL,KAAK,uGA6FN,CAAC;AAEF,MAAM,MAAM,cAAc,CACxB,KAAK,SAAS,YAAY,GAAG,YAAY,EACzC,KAAK,SAAS,YAAY,GAAG,YAAY,IACvC,KAAK,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, } from '../hooks';
|
|
2
2
|
import { getCurrentComponentFiber } from './components';
|
|
3
|
+
import { ReactError } from './reconciliation/errors/ReactError';
|
|
3
4
|
export const isComponentClass = (value) => {
|
|
4
5
|
return (value != null &&
|
|
5
6
|
typeof value === 'function' &&
|
|
@@ -36,13 +37,13 @@ export class Component {
|
|
|
36
37
|
return true;
|
|
37
38
|
}
|
|
38
39
|
render() {
|
|
39
|
-
throw new
|
|
40
|
+
throw new ReactError(getCurrentComponentFiber(), `Render method must be overridden`);
|
|
40
41
|
}
|
|
41
42
|
componentDidCatch(_error, _info) {
|
|
42
|
-
throw new
|
|
43
|
+
throw new ReactError(getCurrentComponentFiber(), `Not implemented`);
|
|
43
44
|
}
|
|
44
45
|
getSnapshotBeforeUpdate(_prevProps, _prevState) {
|
|
45
|
-
throw new
|
|
46
|
+
throw new ReactError(getCurrentComponentFiber(), `Not implemented`);
|
|
46
47
|
}
|
|
47
48
|
static getDerivedStateFromProps(_props, _state) {
|
|
48
49
|
return {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classComponent.js","sourceRoot":"","sources":["../../src/core/classComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,eAAe,EACf,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,oBAAoB,CAAC;AAM5B,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"classComponent.js","sourceRoot":"","sources":["../../src/core/classComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,eAAe,EACf,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,oBAAoB,CAAC;AAM5B,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAEhE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAc,EAA2B,EAAE,CAAC;IAC3E,OAAO,CACL,KAAK,IAAI,IAAI;QACb,OAAO,KAAK,KAAK,UAAU;QAC3B,WAAW,IAAI,KAAK;QACpB,KAAK,CAAC,SAAS,YAAY,SAAS,CACrC,CAAC;AAAA,CACH,CAAC;AAEF;;;;GAIG;AACH,MAAM,OAAO,SAAS;IAIpB,KAAK,CAAQ;IACb,KAAK,CAAS;IACd,OAAO,CAAU;IACjB,MAAM,CAAC,YAAY,CAAU;IAC7B,MAAM,CAAC,WAAW,CAAqB;IAEvC,YAAY,KAAY,EAAE;QACxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAAA,CACpB;IAED,4CAA4C;IAC5C,QAAQ,CAAC,OAAuB,EAAE,EAAC,CAAC;IAEpC,uBAAuB;IACvB,iBAAiB,GAAS,EAAC,CAAC;IAC5B,oBAAoB,GAAS,EAAC,CAAC;IAE/B,WAAW,CAAC,EAAe,EAAE;QAC3B,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAClB,IAAI,EAAE,EAAE,CAAC;YACP,OAAO,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CAAC;YAAA,CACrB,CAAC;QAAA,CACH,EAAE,EAAE,CAAC,CAAC;QAEP,SAAS,CAAC,GAAG,EAAE,CAAC;YACd,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;gBAClB,QAAQ,CAAC,kBAAkB,CAAC,GAAG,CAAC,SAAU,EAAE,GAAG,CAAC,SAAU,CAAC,CAAC;YAC9D,CAAC;YAED,GAAG,CAAC,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC;YAC/B,GAAG,CAAC,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC;QAAA,CAChC,CAAC,CAAC;QAEH,IAAI,WAAW,EAAE,CAAC;YAChB,QAAQ,CAAC,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;QAC7C,CAAC;QAED,QAAQ,CAAC,KAAK,GAAG;YACf,GAAG,YAAY;YACf,GAAG,KAAK;SACT,CAAC;QACF,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;QAEvB,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,QAAQ,CAAC,qBAAqB,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1E,GAAG,CAAC,UAAU,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;QACrC,CAAC;QAED,EAAE,GAAG,CAAC,QAAQ,CAAC;QACf,OAAO,GAAG,CAAC,UAAU,CAAC;IAAA,CACvB;IAED,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,kBAAyB,CAAC,CAAC;IAChD,OAAO,kBAAkB,CAAC;AAAA,CAC3B,CAAC"}
|
package/dist/core/compact.d.ts
CHANGED
|
@@ -1,38 +1,19 @@
|
|
|
1
|
-
import { type DomNode, type FiberNode } from '../types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare const isBeginOf: (domNode: ChildNode, fiber: FiberNode) => domNode is Comment;
|
|
1
|
+
import { containerSym, type DomNode, type FiberNode } from '../types';
|
|
2
|
+
export declare const isAutoContainer: (fiber: FiberNode) => fiber is FiberNode & {
|
|
3
|
+
element: typeof containerSym;
|
|
4
|
+
};
|
|
6
5
|
/**
|
|
7
|
-
* Returns true if the given `fiber` is in
|
|
8
|
-
*
|
|
9
|
-
* only child's `element`, avoiding the need for <!--brackets-->.
|
|
6
|
+
* Returns true if the given `fiber` is in the single-child mode. This means it
|
|
7
|
+
* its `element` refers to its only child's DOM element.
|
|
10
8
|
*/
|
|
11
|
-
export declare const
|
|
9
|
+
export declare const isSingleChildContainer: (fiber: FiberNode) => fiber is FiberNode & {
|
|
12
10
|
element: DomNode;
|
|
13
11
|
};
|
|
14
12
|
/**
|
|
15
|
-
* Returns true if the given `fiber` is in
|
|
16
|
-
*
|
|
13
|
+
* Returns true if the given `fiber` is in the empty mode. This means it has no
|
|
14
|
+
* fiber children, and its element is <!--r:empty:id-->
|
|
17
15
|
*/
|
|
18
|
-
export declare const
|
|
16
|
+
export declare const isEmptyContainer: (fiber: FiberNode) => fiber is FiberNode & {
|
|
19
17
|
element: DomNode;
|
|
20
18
|
};
|
|
21
|
-
/**
|
|
22
|
-
* If the given fiber node has <!--brackets-->, this function tries to apply one
|
|
23
|
-
* of the "compact" optimizations:
|
|
24
|
-
*
|
|
25
|
-
* - If the node has no children, it replaces the brackets with
|
|
26
|
-
* <!--r:empty:id-->
|
|
27
|
-
* - If the node has only one child, it removes the brackets and sets
|
|
28
|
-
* `fiber.element` to reference its only direct DOM child
|
|
29
|
-
*
|
|
30
|
-
* It also tries to recursively compact parent nodes when possible.
|
|
31
|
-
*/
|
|
32
|
-
export declare function tryToCompactNode(fiber: FiberNode): void;
|
|
33
|
-
/**
|
|
34
|
-
* Converts <!--empty--> or the single compact container node into:
|
|
35
|
-
* <!--begin-->...children...<!--end-->
|
|
36
|
-
*/
|
|
37
|
-
export declare const unwrapCompactFiber: (fiber: FiberNode) => void;
|
|
38
19
|
//# sourceMappingURL=compact.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../src/core/compact.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../src/core/compact.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,KAAK,OAAO,EACZ,KAAK,SAAS,EACf,MAAM,UAAU,CAAC;AAelB,eAAO,MAAM,eAAe;;CAGI,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;CAOA,CAAC;AAEpC;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;CAMK,CAAC"}
|
package/dist/core/compact.js
CHANGED
|
@@ -1,112 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
* Returns true if domNode is <!--r:begin:ID--> where ID is fiber.id
|
|
4
|
-
*/
|
|
5
|
-
export const isBeginOf = (domNode, fiber) => domNode instanceof Comment &&
|
|
6
|
-
domNode.textContent === buildCommentText('begin', fiber.id);
|
|
7
|
-
/**
|
|
8
|
-
* Returns true if domNode is <!--r:end:ID--> where ID is fiber.id
|
|
9
|
-
*/
|
|
10
|
-
const isEndOf = (domNode, fiber) => domNode instanceof Comment &&
|
|
11
|
-
domNode.textContent === buildCommentText('end', fiber.id);
|
|
1
|
+
import { containerSym, } from '../types';
|
|
2
|
+
import { buildCommentText } from './reconciliation/comments';
|
|
12
3
|
/**
|
|
13
4
|
* Returns true if domNode is <!--r:empty:ID--> where ID is fiber.id
|
|
14
5
|
*/
|
|
15
6
|
const isEmptyOf = (domNode, fiber) => domNode instanceof Comment &&
|
|
16
7
|
domNode.textContent === buildCommentText('empty', fiber.id);
|
|
8
|
+
// Returns true when the given fiber is a component or a fragment that contains
|
|
9
|
+
// more than one direct DOM-nodes.
|
|
10
|
+
export const isAutoContainer = (fiber) => fiber.element === containerSym;
|
|
17
11
|
/**
|
|
18
|
-
* Returns true if the given `fiber` is in
|
|
19
|
-
*
|
|
20
|
-
* only child's `element`, avoiding the need for <!--brackets-->.
|
|
12
|
+
* Returns true if the given `fiber` is in the single-child mode. This means it
|
|
13
|
+
* its `element` refers to its only child's DOM element.
|
|
21
14
|
*/
|
|
22
|
-
export const
|
|
23
|
-
|
|
15
|
+
export const isSingleChildContainer = (fiber) => (fiber.type === 'fragment' || fiber.type === 'component') &&
|
|
16
|
+
fiber.element !== containerSym &&
|
|
24
17
|
!isEmptyOf(fiber.element, fiber);
|
|
25
18
|
/**
|
|
26
|
-
* Returns true if the given `fiber` is in
|
|
27
|
-
*
|
|
19
|
+
* Returns true if the given `fiber` is in the empty mode. This means it has no
|
|
20
|
+
* fiber children, and its element is <!--r:empty:id-->
|
|
28
21
|
*/
|
|
29
|
-
export const
|
|
22
|
+
export const isEmptyContainer = (fiber) => (fiber.type === 'fragment' || fiber.type === 'component') &&
|
|
30
23
|
isEmptyOf(fiber.element, fiber);
|
|
31
|
-
/**
|
|
32
|
-
* If the given fiber node has <!--brackets-->, this function tries to apply one
|
|
33
|
-
* of the "compact" optimizations:
|
|
34
|
-
*
|
|
35
|
-
* - If the node has no children, it replaces the brackets with
|
|
36
|
-
* <!--r:empty:id-->
|
|
37
|
-
* - If the node has only one child, it removes the brackets and sets
|
|
38
|
-
* `fiber.element` to reference its only direct DOM child
|
|
39
|
-
*
|
|
40
|
-
* It also tries to recursively compact parent nodes when possible.
|
|
41
|
-
*/
|
|
42
|
-
export function tryToCompactNode(fiber) {
|
|
43
|
-
if (!isEndOf(fiber.element, fiber)) {
|
|
44
|
-
return; // Node is not a !--container or is already compact.
|
|
45
|
-
}
|
|
46
|
-
// By default each fragment or component is rendered with 3+ nodes:
|
|
47
|
-
// <!--r:begin:id--> + …children + <!--r:end:id-->
|
|
48
|
-
// This approach supports 0 or 2+ nodes without overly complex logic.
|
|
49
|
-
// However, most cases have only one child or none. For these scenarios,
|
|
50
|
-
// we support two different compact modes.
|
|
51
|
-
const prev1 = fiber.element.previousSibling;
|
|
52
|
-
// Scenario 1: 0 children.
|
|
53
|
-
if (prev1 && isBeginOf(prev1, fiber)) {
|
|
54
|
-
const emptyNode = buildComment('empty', fiber.id);
|
|
55
|
-
prev1.parentElement.insertBefore(emptyNode, prev1);
|
|
56
|
-
prev1.remove(); // !--begin
|
|
57
|
-
fiber.element.remove(); // !--end
|
|
58
|
-
fiber.element = emptyNode;
|
|
59
|
-
return;
|
|
60
|
-
// <!--begin--><--end--> are replaced with <!--empty-->
|
|
61
|
-
}
|
|
62
|
-
const prev2 = prev1?.previousSibling;
|
|
63
|
-
// Scenario 2: 1 children
|
|
64
|
-
if (prev2 && isBeginOf(prev2, fiber)) {
|
|
65
|
-
prev2.remove(); // !--begin
|
|
66
|
-
fiber.element.remove(); // !--end
|
|
67
|
-
fiber.element = fiber.children[0].element;
|
|
68
|
-
// <!--begin--><!--end--> are removed. Now `fiber.element` refers to its
|
|
69
|
-
// only child node.
|
|
70
|
-
tryToCompactNode(fiber.parent);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Converts <!--empty--> or the single compact container node into:
|
|
75
|
-
* <!--begin-->...children...<!--end-->
|
|
76
|
-
*/
|
|
77
|
-
export const unwrapCompactFiber = (fiber) => {
|
|
78
|
-
const container = fiber.element.parentElement;
|
|
79
|
-
let begin = buildComment('begin', fiber.id);
|
|
80
|
-
let end = buildComment('end', fiber.id);
|
|
81
|
-
if (isCompactSingleChild(fiber)) {
|
|
82
|
-
// before: <container><child/></container>
|
|
83
|
-
// after: <container><!--begin--><child/><!--end--></container>
|
|
84
|
-
container.insertBefore(begin, fiber.element);
|
|
85
|
-
container.insertBefore(end, fiber.element.nextSibling);
|
|
86
|
-
fiber.element = end;
|
|
87
|
-
// Repeat the same with every single-compact ancestor:
|
|
88
|
-
let parent = fiber.parent;
|
|
89
|
-
while (isCompactSingleChild(parent)) {
|
|
90
|
-
const pBegin = buildComment('begin', parent.id);
|
|
91
|
-
const pEnd = buildComment('end', parent.id);
|
|
92
|
-
container.insertBefore(pBegin, begin);
|
|
93
|
-
container.insertBefore(pEnd, end.nextSibling);
|
|
94
|
-
parent.element = pEnd;
|
|
95
|
-
begin = pBegin;
|
|
96
|
-
end = pEnd;
|
|
97
|
-
parent = parent.parent;
|
|
98
|
-
}
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (isCompactNone(fiber)) {
|
|
102
|
-
// before: <container><!--empty--></container>
|
|
103
|
-
// after: <container><!--begin--><!--end--></container>
|
|
104
|
-
container.insertBefore(begin, fiber.element);
|
|
105
|
-
container.insertBefore(end, fiber.element.nextSibling);
|
|
106
|
-
fiber.element.remove();
|
|
107
|
-
fiber.element = end;
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
throw new Error(`Unsupported format of compact node`);
|
|
111
|
-
};
|
|
112
24
|
//# sourceMappingURL=compact.js.map
|
package/dist/core/compact.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact.js","sourceRoot":"","sources":["../../src/core/compact.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compact.js","sourceRoot":"","sources":["../../src/core/compact.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,GAIb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D;;GAEG;AACH,MAAM,SAAS,GAAG,CAChB,OAAoC,EACpC,KAAgB,EACI,EAAE,CACtB,OAAO,YAAY,OAAO;IAC1B,OAAO,CAAC,WAAW,KAAK,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;AAE9D,+EAA+E;AAC/E,kCAAkC;AAClC,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,KAAgB,EAC6B,EAAE,CAC/C,KAAK,CAAC,OAAO,KAAK,YAAY,CAAC;AAEjC;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,KAAgB,EAGhB,EAAE,CACF,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC;IACzD,KAAK,CAAC,OAAO,KAAK,YAAY;IAC9B,CAAC,SAAS,CAAC,KAAK,CAAC,OAAQ,EAAE,KAAK,CAAC,CAAC;AAEpC;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,KAAgB,EAGhB,EAAE,CACF,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC;IACzD,SAAS,CAAC,KAAK,CAAC,OAAQ,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type HookStateItem, type FiberNode, type App, type ComponentFiberNode } from '../types';
|
|
1
|
+
import { type HookStateItem, type FiberNode, type App, type ComponentFiberNode, type UnknownProps } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Returns the fiber of the component that is being rendered right now. Don't
|
|
4
4
|
* run this function outside of the render phase.
|
|
@@ -18,7 +18,7 @@ export declare const isFirstFiberRender: () => boolean;
|
|
|
18
18
|
* is required to make hooks work. The result is JSX returned from the component
|
|
19
19
|
* function.
|
|
20
20
|
*/
|
|
21
|
-
export declare const runComponent: (fiber: FiberNode,
|
|
21
|
+
export declare const runComponent: (fiber: FiberNode, props: UnknownProps | null) => import("../index.js").JsxElement;
|
|
22
22
|
/**
|
|
23
23
|
* Switches to the next hook and returns its state.
|
|
24
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/core/components.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,SAAS,EAEd,KAAK,GAAG,EACR,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/core/components.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,SAAS,EAEd,KAAK,GAAG,EACR,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAClB,MAAM,UAAU,CAAC;AAWlB;;;GAGG;AACH,eAAO,MAAM,wBAAwB,0BACX,CAAC;AAE3B;;;GAGG;AACH,eAAO,MAAM,aAAa,WAGzB,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,kBAAkB,eAAkC,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,YAAY,qFAuCxB,CAAC;AAYF;;GAEG;AACH,eAAO,MAAM,iBAAiB,qBACgC,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,iBAAiB;;UAI7B,CAAC"}
|
package/dist/core/components.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { nullthrows } from '../utils';
|
|
2
2
|
import { getAppByFiber } from './reconciliation/app';
|
|
3
3
|
import { isFiberDead } from './reconciliation/fibers';
|
|
4
|
+
import { nullthrowsForFiber, ReactError, } from './reconciliation/errors/ReactError';
|
|
4
5
|
/** Component that is rendered right now. */
|
|
5
6
|
let currentFiber;
|
|
6
7
|
/**
|
|
@@ -12,7 +13,10 @@ export const getCurrentComponentFiber = () => nullthrows(currentFiber);
|
|
|
12
13
|
* The app of the component that is being rendered right now. Don't run this
|
|
13
14
|
* function outside of the render phase.
|
|
14
15
|
*/
|
|
15
|
-
export const getCurrentApp = () =>
|
|
16
|
+
export const getCurrentApp = () => {
|
|
17
|
+
const fiber = getCurrentComponentFiber();
|
|
18
|
+
return nullthrowsForFiber(fiber, getAppByFiber(fiber));
|
|
19
|
+
};
|
|
16
20
|
let firstFiberRender = false;
|
|
17
21
|
/**
|
|
18
22
|
* Returns true when it's the 1st render of currentFiber's component.
|
|
@@ -25,18 +29,27 @@ export const isFirstFiberRender = () => firstFiberRender;
|
|
|
25
29
|
*/
|
|
26
30
|
export const runComponent = (fiber,
|
|
27
31
|
/** Source of `.props`. If not given `fiber.props` are used. */
|
|
28
|
-
|
|
32
|
+
props) => {
|
|
29
33
|
if (fiber.type !== 'component') {
|
|
30
|
-
throw new
|
|
34
|
+
throw new ReactError(fiber, `Can't run ${fiber.type} as a component`);
|
|
31
35
|
}
|
|
32
36
|
if (isFiberDead(fiber)) {
|
|
33
|
-
throw new
|
|
37
|
+
throw new ReactError(fiber, `Can't run a dead component`);
|
|
34
38
|
}
|
|
35
39
|
currentFiber = fiber;
|
|
36
40
|
firstFiberRender = !fiber.data.hooks;
|
|
37
41
|
fiber.data.hooks ??= [];
|
|
38
42
|
hookIdx = -1;
|
|
39
|
-
let jsxElement
|
|
43
|
+
let jsxElement;
|
|
44
|
+
try {
|
|
45
|
+
jsxElement = fiber.component(props ?? fiber.props);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
throw new ReactError(fiber, error, `Error during rendering a component: %fiber%`);
|
|
49
|
+
}
|
|
50
|
+
if (!firstFiberRender && hookIdx !== fiber.data.hooks.length - 1) {
|
|
51
|
+
throw new ReactError(fiber, `The hook order is violated. There were ${fiber.data.hooks.length} hooks in the previous render. Now only ${hookIdx + 1}`);
|
|
52
|
+
}
|
|
40
53
|
currentFiber = null;
|
|
41
54
|
firstFiberRender = false;
|
|
42
55
|
return jsxElement;
|
|
@@ -44,7 +57,7 @@ propsSource) => {
|
|
|
44
57
|
let hookIdx = -1;
|
|
45
58
|
const getComponentHookStore = (fiberNode) => {
|
|
46
59
|
if (!fiberNode.data.hooks) {
|
|
47
|
-
throw new
|
|
60
|
+
throw new ReactError(fiberNode, `HookStore is empty.`);
|
|
48
61
|
}
|
|
49
62
|
return fiberNode.data.hooks;
|
|
50
63
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/core/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/core/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;A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,4 @@
|
|
|
1
|
-
import type { ElementNode, ElementType, ReactContextProvider, ReactKey } from '../types';
|
|
1
|
+
import type { ElementNode, ElementType, JsxSource, ReactContextProvider, ReactKey } from '../types';
|
|
2
2
|
import { type ComponentClass } from './classComponent';
|
|
3
3
|
/**
|
|
4
4
|
* This method is used as the JSX resolver. Every <tag/> or <Component/> is a
|
|
@@ -23,12 +23,7 @@ export declare function createElementNew(
|
|
|
23
23
|
* What to render. Can be a tag (string), a component (function),
|
|
24
24
|
* or a portal target (HTMLElement).
|
|
25
25
|
*/
|
|
26
|
-
type: ReactContextProvider | ElementType | HTMLElement | ComponentClass, propsRaw: Record<PropertyKey, unknown>, key: ReactKey | null | undefined, _isStaticChildren?: boolean,
|
|
27
|
-
type Source = {
|
|
28
|
-
fileName: string;
|
|
29
|
-
lineNumber: number;
|
|
30
|
-
columnNumber: number;
|
|
31
|
-
};
|
|
26
|
+
type: ReactContextProvider | ElementType | HTMLElement | ComponentClass, propsRaw: Record<PropertyKey, unknown>, key: ReactKey | null | undefined, _isStaticChildren?: boolean, source?: JsxSource | null, _self?: unknown): ElementNode;
|
|
32
27
|
/**
|
|
33
28
|
* Renders content into an external HTML node. Unlike React, this version
|
|
34
29
|
* doesn't support interdimensional event bubbling.
|
|
@@ -49,5 +44,4 @@ key?: string): ElementNode;
|
|
|
49
44
|
* built with this signature.
|
|
50
45
|
*/
|
|
51
46
|
export declare function createElement(type: ReactContextProvider | ElementType | HTMLElement, propsRaw: Record<PropertyKey, unknown>, ...children: JSX.Element[]): ElementNode;
|
|
52
|
-
export {};
|
|
53
47
|
//# sourceMappingURL=createElement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createElement.d.ts","sourceRoot":"","sources":["../../src/core/createElement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,oBAAoB,EACpB,QAAQ,EAET,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,cA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ACtC,GAAG,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,GACzB,WAAW,CAOb"}
|
|
@@ -26,7 +26,7 @@ export function createElementNew(
|
|
|
26
26
|
type, propsRaw, key,
|
|
27
27
|
// The following arguments are provided only in the development mode.
|
|
28
28
|
// TODO: Support them to show more informative warnings and errors.
|
|
29
|
-
_isStaticChildren,
|
|
29
|
+
_isStaticChildren, source = null, _self) {
|
|
30
30
|
key ??= null; // Narrow the type for simplicity.
|
|
31
31
|
if (isComponentClass(type)) {
|
|
32
32
|
type = convertClassComponentToFC(type);
|
|
@@ -41,6 +41,7 @@ _isStaticChildren, _source, _self) {
|
|
|
41
41
|
// what's inside until the component runs. Children are passed via `props`
|
|
42
42
|
// instead.
|
|
43
43
|
children: [],
|
|
44
|
+
source,
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
47
|
// Any tag instance (<div/>).
|
|
@@ -55,6 +56,7 @@ _isStaticChildren, _source, _self) {
|
|
|
55
56
|
props: propsWithoutChildren,
|
|
56
57
|
key,
|
|
57
58
|
children,
|
|
59
|
+
source,
|
|
58
60
|
};
|
|
59
61
|
}
|
|
60
62
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createElement.js","sourceRoot":"","sources":["../../src/core/createElement.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createElement.js","sourceRoot":"","sources":["../../src/core/createElement.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,yBAAyB,EACzB,gBAAgB,GAEjB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,gBAAgB;AAC9B;;;GAGG;AACH,kBAAkB;AAClB,IAQkB,EAClB,QAAsC,EACtC,GAAgC;AAChC,qEAAqE;AACrE,mEAAmE;AACnE,iBAA2B,EAC3B,MAAM,GAAqB,IAAI,EAC/B,KAAe,EACF;IACb,GAAG,KAAK,IAAI,CAAC,CAAC,kCAAkC;IAEhD,IAAI,g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AI,QAAQ,EAAE,EAClD,GAA2B,CAC5B,CAAC;AAAA,CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactNodeToFiberNode.d.ts","sourceRoot":"","sources":["../../src/core/reactNodeToFiberNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"reactNodeToFiberNode.d.ts","sourceRoot":"","sources":["../../src/core/reactNodeToFiberNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EAUf,MAAM,UAAU,CAAC;AASlB;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,4GAoIjC,CAAC"}
|
|
@@ -19,6 +19,7 @@ unwrapComponents) => {
|
|
|
19
19
|
props: {},
|
|
20
20
|
key: null,
|
|
21
21
|
children: jsxElement,
|
|
22
|
+
source: null,
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
25
|
// Any null-like value, i.e. it doesn't render a tag or a text node.
|
|
@@ -66,6 +67,7 @@ unwrapComponents) => {
|
|
|
66
67
|
role: 'context',
|
|
67
68
|
props,
|
|
68
69
|
data: { ctx: jsxElement.type.__ctx, consumers: new Set() },
|
|
70
|
+
source: jsxElement.source,
|
|
69
71
|
};
|
|
70
72
|
contextFiber.children = jsxElement.children.map((n) => jsxElementToFiberNode(n, contextFiber, unwrapComponents));
|
|
71
73
|
return contextFiber;
|
|
@@ -76,6 +78,7 @@ unwrapComponents) => {
|
|
|
76
78
|
...createFiberNode(parent),
|
|
77
79
|
type: 'fragment',
|
|
78
80
|
key,
|
|
81
|
+
source: jsxElement.source,
|
|
79
82
|
};
|
|
80
83
|
fragmentFiber.children = jsxElement.children.map((n) => jsxElementToFiberNode(n, fragmentFiber, unwrapComponents));
|
|
81
84
|
return fragmentFiber;
|
|
@@ -87,8 +90,9 @@ unwrapComponents) => {
|
|
|
87
90
|
type: 'component',
|
|
88
91
|
component: jsxElement.type,
|
|
89
92
|
key,
|
|
90
|
-
props,
|
|
93
|
+
props: jsxElement.props,
|
|
91
94
|
data: { hooks: null },
|
|
95
|
+
source: jsxElement.source,
|
|
92
96
|
};
|
|
93
97
|
if (unwrapComponents) {
|
|
94
98
|
const content = runComponent(fiber, null);
|
|
@@ -107,6 +111,7 @@ unwrapComponents) => {
|
|
|
107
111
|
tag: jsxElement.type,
|
|
108
112
|
ref,
|
|
109
113
|
data: { events: {}, styles: null },
|
|
114
|
+
source: jsxElement.source,
|
|
110
115
|
};
|
|
111
116
|
tagFiber.children = jsxElement.children
|
|
112
117
|
.map((n) => jsxElementToFiberNode(n, tagFiber, unwrapComponents))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactNodeToFiberNode.js","sourceRoot":"","sources":["../../src/core/reactNodeToFiberNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reactNodeToFiberNode.js","sourceRoot":"","sources":["../../src/core/reactNodeToFiberNode.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,YAAY,EACZ,eAAe,GAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,UAAuB;AACvB,sEAAsE;AACtE,MAAiB;AACjB;uEACuE;AACvE,gBAAyB,EACd,EAAE,CAAC;IACd,qDAAqD;IACrD,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9B,UAAU,GAAG;YACX,IAAI,EAAE,YAAY;YAClB,KAAK,EAAE,EAAE;YACT,GAAG,EAAE,IAAI;YACT,QAAQ,EAAE,UAAU;YACpB,MAAM,EAAE,IAAI;SACb,CAAC;IACJ,CAAC;IAED,oEAAoE;IACpE,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,K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ACzB,CAAC,CAAC,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,SAAS,IAAI,GAAG,CAAC,EACtD,CAAC;QACD,OAAO;IACT,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;AAAA,CACjE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { nullthrowsForFiber } from './errors/ReactError';
|
|
2
2
|
const apps = [];
|
|
3
3
|
export const getAppByFiber = (fiber) => {
|
|
4
|
-
return
|
|
4
|
+
return nullthrowsForFiber(fiber, apps[fiber.appId]);
|
|
5
5
|
};
|
|
6
6
|
export const registerApp = (fn) => {
|
|
7
7
|
apps.push(fn(apps.length));
|
|
@@ -14,7 +14,7 @@ export const removeApp = (id) => {
|
|
|
14
14
|
// Help with garbage collection.
|
|
15
15
|
app.root = app.tempContext = null;
|
|
16
16
|
app.effects = { normal: [] };
|
|
17
|
-
app.invalidatedComponents = {
|
|
17
|
+
app.invalidatedComponents = { isEmpty: () => true };
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
//# sourceMappingURL=app.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/core/reconciliation/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/core/reconciliation/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,IAAI,GAAsB,EAAE,CAAC;AAEnC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAgB,EAAO,EAAE,CAAC;IACtD,OAAO,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAAA,CACrD,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAuB,EAAO,EAAE,CAAC;IAC3D,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3B,OAAO,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC;AAAA,CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAU,EAAQ,EAAE,CAAC;IAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,CAA4B,CAAC;IAChD,IAAI,GAAG,EAAE,CAAC;QACR,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;QAChB,gCAAgC;QAChC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC;QAClC,GAAG,CAAC,OAAO,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;QAC7B,GAAG,CAAC,qBAAqB,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IACtD,CAAC;AAAA,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fromApp.d.ts","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"fromApp.d.ts","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGzD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,wBASjC,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { collectActionsFromComponent } from './fromComponent';
|
|
2
|
-
import { getFiberLevel } from '../fibers';
|
|
3
2
|
/**
|
|
4
3
|
* Goes through the list of invalidated components, runs them, finds the diff,
|
|
5
4
|
* and returns the list of actions to convert the previous fiber tree to the new
|
|
@@ -7,32 +6,9 @@ import { getFiberLevel } from '../fibers';
|
|
|
7
6
|
*/
|
|
8
7
|
export const collectActionsFromApp = (app) => {
|
|
9
8
|
const actions = [];
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
.map((f) => ({ fiber: f, level: getFiberLevel(f) }))
|
|
14
|
-
.sort((a, b) => a.level - b.level);
|
|
15
|
-
for (const { fiber } of sorted) {
|
|
16
|
-
// Redo the check because some components can be indirectly removed in between.
|
|
17
|
-
if (app.invalidatedComponents.has(fiber)) {
|
|
18
|
-
actions.push(...collectActionsFromComponent(app, fiber, null));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
if (app.invalidatedComponents.size > 0) {
|
|
22
|
-
// The only reason why a component might be kept in `invalidatedComponents`
|
|
23
|
-
// after the first run is that this component was "trapped" inside a
|
|
24
|
-
// non-invalidated component. We don't traverse through the whole fiber
|
|
25
|
-
// tree, so we need to run the rest of the queue again.
|
|
26
|
-
if (app.testMode) {
|
|
27
|
-
// A sanity check
|
|
28
|
-
for (const fiber of app.invalidatedComponents) {
|
|
29
|
-
if (fiber.type !== 'component' ||
|
|
30
|
-
!fiber.data.hooks?.some((h) => h.type === 'context')) {
|
|
31
|
-
throw new Error(`Fiber node is stuck`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
actions.push(...collectActionsFromApp(app));
|
|
9
|
+
while (!app.invalidatedComponents.isEmpty()) {
|
|
10
|
+
const [fiber, props] = app.invalidatedComponents.poll();
|
|
11
|
+
actions.push(...collectActionsFromComponent(fiber, props));
|
|
36
12
|
}
|
|
37
13
|
return actions;
|
|
38
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fromApp.js","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromApp.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"fromApp.js","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromApp.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAE9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,GAAQ,EAAY,EAAE,CAAC;IAC3D,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,OAAO,EAAE,EAAE,CAAC;QAC5C,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,GAAG,CAAC,qBAAqB,CAAC,IAAI,EAAE,CAAC;QACxD,OAAO,CAAC,IAAI,CAAC,GAAG,2BAA2B,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,OAAO,CAAC;AAAA,CAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fromChildrenPair.d.ts","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromChildrenPair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,SAAS,EAGV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AASzD;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,
|
|
1
|
+
{"version":3,"file":"fromChildrenPair.d.ts","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromChildrenPair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,SAAS,EAGV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AASzD;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,oDAsE1C,CAAC"}
|