@faiwer/react 0.8.2 → 0.8.4
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 +3 -0
- package/dist/core/Children.d.ts +11 -0
- package/dist/core/Children.d.ts.map +1 -0
- package/dist/core/Children.js +35 -0
- package/dist/core/Children.js.map +1 -0
- package/dist/core/actions/createTag.action.d.ts.map +1 -1
- package/dist/core/actions/createTag.action.js +85 -1
- package/dist/core/actions/createTag.action.js.map +1 -1
- package/dist/core/actions/dom/attributes.d.ts +4 -0
- package/dist/core/actions/dom/attributes.d.ts.map +1 -0
- package/dist/core/actions/dom/attributes.js +53 -0
- package/dist/core/actions/dom/attributes.js.map +1 -0
- package/dist/core/actions/dom/css.d.ts +6 -0
- package/dist/core/actions/dom/css.d.ts.map +1 -0
- package/dist/core/actions/dom/css.js +53 -0
- package/dist/core/actions/dom/css.js.map +1 -0
- package/dist/core/actions/dom/events.d.ts +3 -0
- package/dist/core/actions/dom/events.d.ts.map +1 -0
- package/dist/core/actions/dom/events.js +33 -0
- package/dist/core/actions/dom/events.js.map +1 -0
- package/dist/core/actions/dom/svg.d.ts +7 -0
- package/dist/core/actions/dom/svg.d.ts.map +1 -0
- package/dist/core/actions/dom/svg.js +76 -0
- package/dist/core/actions/dom/svg.js.map +1 -0
- package/dist/core/actions/helpers.d.ts +2 -2
- package/dist/core/actions/helpers.d.ts.map +1 -1
- package/dist/core/actions/helpers.js +17 -2
- package/dist/core/actions/helpers.js.map +1 -1
- package/dist/core/actions/remove.action.d.ts +2 -1
- package/dist/core/actions/remove.action.d.ts.map +1 -1
- package/dist/core/actions/remove.action.js +5 -5
- package/dist/core/actions/remove.action.js.map +1 -1
- package/dist/core/actions/replace.action.d.ts.map +1 -1
- package/dist/core/actions/replace.action.js +18 -0
- package/dist/core/actions/replace.action.js.map +1 -1
- package/dist/core/actions/setAttr.action.d.ts.map +1 -1
- package/dist/core/actions/setAttr.action.js +11 -85
- package/dist/core/actions/setAttr.action.js.map +1 -1
- package/dist/core/actions/setRef.action.d.ts.map +1 -1
- package/dist/core/actions/setRef.action.js +1 -2
- package/dist/core/actions/setRef.action.js.map +1 -1
- package/dist/core/classComponent.d.ts +33 -0
- package/dist/core/classComponent.d.ts.map +1 -0
- package/dist/core/classComponent.js +126 -0
- package/dist/core/classComponent.js.map +1 -0
- package/dist/core/components.d.ts.map +1 -1
- package/dist/core/components.js +4 -0
- package/dist/core/components.js.map +1 -1
- package/dist/core/createElement.d.ts +8 -2
- package/dist/core/createElement.d.ts.map +1 -1
- package/dist/core/createElement.js +16 -2
- package/dist/core/createElement.js.map +1 -1
- package/dist/core/createRoot.js.map +1 -1
- package/dist/core/reconciliation/collect/fromChildrenPair.js +16 -12
- package/dist/core/reconciliation/collect/fromChildrenPair.js.map +1 -1
- package/dist/core/reconciliation/collect/fromFiberPair.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromFiberPair.js +4 -0
- package/dist/core/reconciliation/collect/fromFiberPair.js.map +1 -1
- package/dist/core/reconciliation/effects.d.ts.map +1 -1
- package/dist/core/reconciliation/effects.js +0 -5
- package/dist/core/reconciliation/effects.js.map +1 -1
- package/dist/core/reconciliation/errors/stack.d.ts +3 -0
- package/dist/core/reconciliation/errors/stack.d.ts.map +1 -0
- package/dist/core/reconciliation/errors/stack.js +23 -0
- package/dist/core/reconciliation/errors/stack.js.map +1 -0
- package/dist/core/reconciliation/fibers.d.ts +6 -0
- package/dist/core/reconciliation/fibers.d.ts.map +1 -1
- package/dist/core/reconciliation/fibers.js +6 -0
- package/dist/core/reconciliation/fibers.js.map +1 -1
- package/dist/core/reconciliation/invalidateFiber.d.ts.map +1 -1
- package/dist/core/reconciliation/invalidateFiber.js +5 -0
- 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 +3 -3
- package/dist/core/reconciliation/mount.js.map +1 -1
- package/dist/core/reconciliation/postCommit.d.ts.map +1 -1
- package/dist/core/reconciliation/postCommit.js +3 -1
- package/dist/core/reconciliation/postCommit.js.map +1 -1
- package/dist/core/reconciliation/render.js +4 -4
- package/dist/core/reconciliation/render.js.map +1 -1
- package/dist/core/reconciliation/typeGuards.d.ts +6 -1
- package/dist/core/reconciliation/typeGuards.d.ts.map +1 -1
- package/dist/core/reconciliation/typeGuards.js +12 -0
- package/dist/core/reconciliation/typeGuards.js.map +1 -1
- package/dist/core/reconciliation/validateApp.d.ts +3 -0
- package/dist/core/reconciliation/validateApp.d.ts.map +1 -0
- package/dist/core/reconciliation/{validateTree.js → validateApp.js} +21 -2
- package/dist/core/reconciliation/validateApp.js.map +1 -0
- package/dist/hooks/useContext.d.ts.map +1 -1
- package/dist/hooks/useContext.js +16 -0
- package/dist/hooks/useContext.js.map +1 -1
- package/dist/hooks/useState.d.ts.map +1 -1
- package/dist/hooks/useState.js +25 -0
- package/dist/hooks/useState.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.d.ts +4 -4
- package/dist/jsx-dev-runtime.d.ts.map +1 -1
- package/dist/jsx-dev-runtime.js +4 -4
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.d.ts +3 -3
- package/dist/jsx-runtime.d.ts.map +1 -1
- package/dist/jsx-runtime.js +3 -3
- package/dist/jsx-runtime.js.map +1 -1
- package/{src → dist}/jsx.d.ts +25 -0
- package/dist/mocks.d.ts +28 -0
- package/dist/mocks.d.ts.map +1 -0
- package/dist/mocks.js +33 -0
- package/dist/mocks.js.map +1 -0
- package/dist/types/actions.d.ts +1 -0
- package/dist/types/actions.d.ts.map +1 -1
- package/dist/types/app.d.ts +5 -0
- package/dist/types/app.d.ts.map +1 -1
- package/dist/types/common.d.ts +4 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +2 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/component.d.ts +1 -0
- package/dist/types/component.d.ts.map +1 -1
- package/dist/types/dom.d.ts +5 -10
- package/dist/types/dom.d.ts.map +1 -1
- package/dist/types/events.d.ts +24 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +2 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/fiber.d.ts +2 -0
- package/dist/types/fiber.d.ts.map +1 -1
- package/dist/types/hooks.d.ts +4 -1
- package/dist/types/hooks.d.ts.map +1 -1
- package/package.json +9 -3
- package/dist/core/reconciliation/validateTree.d.ts +0 -6
- package/dist/core/reconciliation/validateTree.d.ts.map +0 -1
- package/dist/core/reconciliation/validateTree.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../../src/core/reconciliation/errors/stack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,eAAO,MAAM,YAAY,gCASxB,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const captureStack = (fiber) => {
|
|
2
|
+
const result = [];
|
|
3
|
+
while (fiber.parent) {
|
|
4
|
+
result.push(getFiberLabel(fiber.parent));
|
|
5
|
+
fiber = fiber.parent;
|
|
6
|
+
}
|
|
7
|
+
return result;
|
|
8
|
+
};
|
|
9
|
+
const getFiberLabel = (fiber) => {
|
|
10
|
+
switch (fiber.type) {
|
|
11
|
+
case 'component':
|
|
12
|
+
return '<' + fiber.component.name + '/>';
|
|
13
|
+
case 'tag':
|
|
14
|
+
return '<' + fiber.tag + '/>';
|
|
15
|
+
case 'text':
|
|
16
|
+
return 'text(' + fiber.props.text.substring(0, 10) + '…)';
|
|
17
|
+
case 'fragment':
|
|
18
|
+
return '</>';
|
|
19
|
+
case 'null':
|
|
20
|
+
return 'null';
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../../src/core/reconciliation/errors/stack.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAgB,EAAY,EAAE,CAAC;IAC1D,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QACzC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,OAAO,MAAM,CAAC;AAAA,CACf,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,KAAgB,EAAU,EAAE,CAAC;IAClD,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,WAAW;YACd,OAAO,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC;QAC3C,KAAK,KAAK;YACR,OAAO,GAAG,GAAG,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC;QAChC,KAAK,MAAM;YACT,OAAO,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,MAAI,CAAC;QAC5D,KAAK,UAAU;YACb,OAAO,KAAK,CAAC;QACf,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;IAClB,CAAC;AAAA,CACF,CAAA"}
|
|
@@ -32,4 +32,10 @@ export declare const NULL_FIBER: FiberNode;
|
|
|
32
32
|
* it. But this can only be done with non-keyed regular fragments.
|
|
33
33
|
*/
|
|
34
34
|
export declare const toFiberChildren: (fiber: FiberNode) => FiberNode[];
|
|
35
|
+
/**
|
|
36
|
+
* Return `true` when the given fiber:
|
|
37
|
+
* - was removed
|
|
38
|
+
* - was abandoned (its content moved to another node)
|
|
39
|
+
*/
|
|
40
|
+
export declare const isFiberDead: (fiber: FiberNode) => boolean;
|
|
35
41
|
//# sourceMappingURL=fibers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fibers.d.ts","sourceRoot":"","sources":["../../../src/core/reconciliation/fibers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGpD;;;GAGG;AACH,eAAO,MAAM,aAAa,8BAOzB,CAAC;AAEF;wEACwE;AACxE,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAEhD;iEACiE;AACjE,eAAO,MAAM,YAAY,eAAe,CAAC;AAGzC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;CAgBmB,CAAC;AAEhD,eAAO,MAAM,UAAU,WAA+B,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,eAAe,mCAU3B,CAAC"}
|
|
1
|
+
{"version":3,"file":"fibers.d.ts","sourceRoot":"","sources":["../../../src/core/reconciliation/fibers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGpD;;;GAGG;AACH,eAAO,MAAM,aAAa,8BAOzB,CAAC;AAEF;wEACwE;AACxE,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAEhD;iEACiE;AACjE,eAAO,MAAM,YAAY,eAAe,CAAC;AAGzC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;CAgBmB,CAAC;AAEhD,eAAO,MAAM,UAAU,WAA+B,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,eAAe,mCAU3B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,WAAW,+BAAqC,CAAC"}
|
|
@@ -48,4 +48,10 @@ export const toFiberChildren = (fiber) => {
|
|
|
48
48
|
}
|
|
49
49
|
return [fiber];
|
|
50
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* Return `true` when the given fiber:
|
|
53
|
+
* - was removed
|
|
54
|
+
* - was abandoned (its content moved to another node)
|
|
55
|
+
*/
|
|
56
|
+
export const isFiberDead = (fiber) => fiber.id < 0;
|
|
51
57
|
//# sourceMappingURL=fibers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fibers.js","sourceRoot":"","sources":["../../../src/core/reconciliation/fibers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAgB,EAAU,EAAE,CAAC;IACzD,IAAI,KAAK,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,KAAK,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC9C,OAAO,KAAK,CAAC,KAAK,CAAC;AAAA,CACpB,CAAC;AAEF;wEACwE;AACxE,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC;AAEhD;iEACiE;AACjE,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC;AAEzC,IAAI,QAAQ,GAAG,CAAC,CAAC;AACjB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAiB,EAAE,EAAE,CACnD,CAAC;IACC,EAAE,EAAE,EAAE,QAAQ;IACd,KAAK,EAAE,MAAM,CAAC,KAAK;IACnB,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,MAAM;IACN,KAAK,EAAE,IAAI;IACX,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,IAAI;IACT,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,IAAI;IACX,GAAG,EAAE,IAAI;IACT,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,IAAI;CACX,CAA4C,CAAC;AAEhD,MAAM,CAAC,MAAM,UAAU,GAAG,IAA4B,CAAC;AAEvD;;;GAGG;AACH,MAAM,C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AE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,MAAM;IACN,KAAK,EAAE,IAAI;IACX,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,IAAI;IACT,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,IAAI;IACX,GAAG,EAAE,IAAI;IACT,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,IAAI;CACX,CAA4C,CAAC;AAEhD,MAAM,CAAC,MAAM,UAAU,GAAG,IAA4B,CAAC;AAEvD;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAgB,EAAe,EAAE,CAAC;IAChE,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;QAC3E,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACnC,kDAAkD;YAClD,KAAK,CAAC,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,KAAK,CAAC,QAAQ,CAAC;IACxB,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,CAAC;AAAA,CAChB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAgB,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalidateFiber.d.ts","sourceRoot":"","sources":["../../../src/core/reconciliation/invalidateFiber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"invalidateFiber.d.ts","sourceRoot":"","sources":["../../../src/core/reconciliation/invalidateFiber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAKpD;;;;GAIG;AACH,eAAO,MAAM,eAAe,4BA2B3B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getAppByFiber } from './app';
|
|
2
2
|
import { reactRender } from './render';
|
|
3
|
+
import { isFiberDead } from './fibers';
|
|
3
4
|
/**
|
|
4
5
|
* Adds the given component to the update queue (`invalidatedComponents`).
|
|
5
6
|
* Schedules a new render cycle if one isn't scheduled already. Throws an error
|
|
@@ -9,6 +10,9 @@ export const invalidateFiber = (fiber) => {
|
|
|
9
10
|
if (fiber.type !== 'component') {
|
|
10
11
|
throw new Error(`Cannot invalidate a non-component fiber (${fiber.type})`);
|
|
11
12
|
}
|
|
13
|
+
if (isFiberDead(fiber)) {
|
|
14
|
+
throw new Error(`Cannot invalidate a dead component`);
|
|
15
|
+
}
|
|
12
16
|
const app = getAppByFiber(fiber);
|
|
13
17
|
switch (app.state) {
|
|
14
18
|
case 'idle':
|
|
@@ -19,6 +23,7 @@ export const invalidateFiber = (fiber) => {
|
|
|
19
23
|
case 'scheduled':
|
|
20
24
|
case 'effects':
|
|
21
25
|
case 'layoutEffects':
|
|
26
|
+
case 'refEffects':
|
|
22
27
|
app.invalidatedComponents.add(fiber);
|
|
23
28
|
break;
|
|
24
29
|
case 'render':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalidateFiber.js","sourceRoot":"","sources":["../../../src/core/reconciliation/invalidateFiber.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAgB,EAAQ,EAAE,CAAC;IACzD,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,4CAA4C,KAAK,CAAC,IAAI,GAAG,CAAC,C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G,CAAC,CAAC,CAAC;YACvC,MAAM;QAER,KAAK,WAAW,CAAC;QACjB,KAAK,SAAS,CAAC;QACf,KAAK,eAAe,CAAC;QACrB,KAAK,YAAY;YACf,GAAG,CAAC,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACrC,MAAM;QAER,KAAK,QAAQ;YACX,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAClE,CAAC;AAAA,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../src/core/reconciliation/mount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,UAAU,EAGX,MAAM,oBAAoB,CAAC;AAU5B;;;GAGG;AACH,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../src/core/reconciliation/mount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,UAAU,EAGX,MAAM,oBAAoB,CAAC;AAU5B;;;GAGG;AACH,eAAO,MAAM,KAAK,4GAuCjB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxElementToFiberNode } from '../reactNodeToFiberNode';
|
|
2
2
|
import { collectActionsFromNewFiber } from './collect/fromNewFiber';
|
|
3
|
-
import {
|
|
3
|
+
import { validateApp } from './validateApp';
|
|
4
4
|
import { applyActions } from './applyActions';
|
|
5
5
|
import { postCommit } from './postCommit';
|
|
6
6
|
import { removeApp, registerApp } from './app';
|
|
@@ -26,14 +26,14 @@ export const mount = (container, jsxElement, options) => {
|
|
|
26
26
|
const actions = collectActionsFromNewFiber(app.root).flat();
|
|
27
27
|
applyActions(app, actions);
|
|
28
28
|
if (app.testMode)
|
|
29
|
-
|
|
29
|
+
validateApp(app);
|
|
30
30
|
postCommit(app, 0);
|
|
31
31
|
return function destroyApp() {
|
|
32
32
|
app.invalidatedComponents.clear();
|
|
33
33
|
app.effects.refs = [];
|
|
34
34
|
app.effects.layout = [];
|
|
35
35
|
app.effects.normal = [];
|
|
36
|
-
applyActions(app, [{ type: 'Remove', fiber: app.root }]);
|
|
36
|
+
applyActions(app, [{ type: 'Remove', fiber: app.root, immediate: true }]);
|
|
37
37
|
app.state = 'killed';
|
|
38
38
|
removeApp(app.id);
|
|
39
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../../../src/core/reconciliation/mount.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../../../src/core/reconciliation/mount.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,SAAsB,EACtB,UAAuB,EACvB,OAAmB,EACL,EAAE,CAAC;IACjB,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC;IAEzB,MAAM,GAAG,GAAQ,WAAW,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACvC,EAAE,EAAE,KAAK;QACT,IAAI,EAAE,eAAe,CAAC,KAAK,CAAC;QAC5B,OAAO,EAAE,EAAE,IAAI,EAAE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;AAEF;;;GAGG;AACH,MAAM,eAAe,GAAG,CAAC,KAAa,EAAgB,EAAE,CAAC,CAAC;IACxD,GAAG,eAAe,CAAC,EAAE,KAAK,EAA0B,CAAC;IACrD,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;IAClC,KAAK,EAAE,EAAE;CACV,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postCommit.d.ts","sourceRoot":"","sources":["../../../src/core/reconciliation/postCommit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAI9C;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"postCommit.d.ts","sourceRoot":"","sources":["../../../src/core/reconciliation/postCommit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAI9C;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,QA6CjD"}
|
|
@@ -13,8 +13,10 @@ export function postCommit(app, depth) {
|
|
|
13
13
|
// Run "ref" and "layout" effects. They must be run in the same microtask
|
|
14
14
|
// queue as the commit phase.
|
|
15
15
|
if (app.effects.layout.length > 0 || app.effects.refs.length > 0) {
|
|
16
|
+
app.state = 'refEffects';
|
|
17
|
+
runEffects(app, 'refs');
|
|
16
18
|
app.state = 'layoutEffects';
|
|
17
|
-
runEffects(app, 'layout');
|
|
19
|
+
runEffects(app, 'layout');
|
|
18
20
|
if (app.invalidatedComponents.size > 0) {
|
|
19
21
|
// 1+ component was invalidated in an effect
|
|
20
22
|
if (app.effects.normal.length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postCommit.js","sourceRoot":"","sources":["../../../src/core/reconciliation/postCommit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,GAAQ,EAAE,KAAa,EAAE;IAClD,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAExB,yEAAyE;IACzE,6BAA6B;IAC7B,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjE,GAAG,CAAC,KAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"postCommit.js","sourceRoot":"","sources":["../../../src/core/reconciliation/postCommit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,GAAQ,EAAE,KAAa,EAAE;IAClD,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAExB,yEAAyE;IACzE,6BAA6B;IAC7B,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjE,GAAG,CAAC,KAAK,GAAG,YAAY,CAAC;QACzB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAExB,GAAG,CAAC,KAAK,GAAG,eAAe,CAAC;QAC5B,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAE1B,IAAI,GAAG,CAAC,qBAAqB,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YACvC,4CAA4C;YAC5C,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAClC,qEAAqE;gBACrE,uEAAuE;gBACvE,cAAc;gBACd,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC;gBACtB,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YAC5B,CAAC;YAED,GAAG,CAAC,KAAK,GAAG,WAAW,CAAC;YACxB,cAAc,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;YAClD,OAAO;QACT,CAAC;IACH,CAAC;IAED,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpC,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC;QACnB,OAAO;IACT,CAAC;IAED,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC;IACtB,UAAU,CAAC,GAAG,EAAE,CAAC;QACf,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAE1B,IAAI,GAAG,CAAC,qBAAqB,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YACvC,GAAG,CAAC,KAAK,GAAG,WAAW,CAAC;YACxB,UAAU,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YACtC,OAAO;QACT,CAAC;QAED,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC;IAAA,CACpB,EAAE,CAAC,CAAC,CAAC;AAAA,CACP"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { validateApp } from './validateApp';
|
|
2
2
|
import { collectActionsFromApp } from './collect/fromApp';
|
|
3
3
|
import { postCommit } from './postCommit';
|
|
4
4
|
import { applyActions } from './applyActions';
|
|
@@ -21,14 +21,14 @@ export function reactRender(app, depth = 0) {
|
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
if (app.testMode)
|
|
24
|
-
|
|
24
|
+
validateApp(app);
|
|
25
25
|
app.state = 'render';
|
|
26
26
|
const actions = collectActionsFromApp(app);
|
|
27
27
|
if (app.testMode)
|
|
28
|
-
|
|
28
|
+
validateApp(app);
|
|
29
29
|
applyActions(app, actions);
|
|
30
30
|
if (app.testMode)
|
|
31
|
-
|
|
31
|
+
validateApp(app);
|
|
32
32
|
postCommit(app, depth);
|
|
33
33
|
}
|
|
34
34
|
const MAX_DEPTH = 50; // Like in React.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../src/core/reconciliation/render.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../src/core/reconciliation/render.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,GAAQ,EAAE,KAAK,GAAG,CAAC,EAAE;IAC/C,IAAI,KAAK,GAAG,SAAS,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,qBAAqB,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,GAAG,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO;IACT,CAAC;IAED,IAAI,GAAG,CAAC,QAAQ;QAAE,WAAW,CAAC,GAAG,CAAC,CAAC;IAEnC,GAAG,CAAC,KAAK,GAAG,QAAQ,CAAC;IACrB,MAAM,OAAO,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC3C,IAAI,GAAG,CAAC,QAAQ;QAAE,WAAW,CAAC,GAAG,CAAC,CAAC;IAEnC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC3B,IAAI,GAAG,CAAC,QAAQ;QAAE,WAAW,CAAC,GAAG,CAAC,CAAC;IAEnC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAAA,CACxB;AAED,MAAM,SAAS,GAAG,EAAE,CAAC,CAAC,iBAAiB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ElementType, FiberNode, TagAttrValue } from '../../types';
|
|
1
|
+
import type { ElementNode, ElementType, FiberNode, TagAttrValue } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Returns true if the given fiber can contain children fiber nodes.
|
|
4
4
|
*/
|
|
@@ -13,4 +13,9 @@ export declare const isContextProvider: (node: ElementType | import("../../index
|
|
|
13
13
|
* Throws if not.
|
|
14
14
|
*/
|
|
15
15
|
export declare function assertsTagAttrValue(name: string, v: unknown): asserts v is TagAttrValue;
|
|
16
|
+
/**
|
|
17
|
+
* Not used in the library, but it's a part of what React exports. Returns true
|
|
18
|
+
* if the given value is something that `createElement` returns.
|
|
19
|
+
*/
|
|
20
|
+
export declare const isValidElement: (value: unknown) => value is ElementNode;
|
|
16
21
|
//# sourceMappingURL=typeGuards.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["../../../src/core/reconciliation/typeGuards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EAET,YAAY,EACb,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,eAAO,MAAM,gBAAgB,+BAGP,CAAC;AAGvB,eAAO,MAAM,iBAAiB,4IAM7B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE,OAAO,GACT,OAAO,CAAC,CAAC,IAAI,YAAY,CAkB3B"}
|
|
1
|
+
{"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["../../../src/core/reconciliation/typeGuards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,SAAS,EAET,YAAY,EACb,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,eAAO,MAAM,gBAAgB,+BAGP,CAAC;AAGvB,eAAO,MAAM,iBAAiB,4IAM7B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE,OAAO,GACT,OAAO,CAAC,CAAC,IAAI,YAAY,CAkB3B;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,0CAS1B,CAAC"}
|
|
@@ -33,4 +33,16 @@ export function assertsTagAttrValue(name, v) {
|
|
|
33
33
|
throw new Error(`Unsupported format of tag attribute value (${String(v)})`);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Not used in the library, but it's a part of what React exports. Returns true
|
|
38
|
+
* if the given value is something that `createElement` returns.
|
|
39
|
+
*/
|
|
40
|
+
export const isValidElement = (value) => {
|
|
41
|
+
return (typeof value === 'object' &&
|
|
42
|
+
!!value &&
|
|
43
|
+
'type' in value &&
|
|
44
|
+
'props' in value &&
|
|
45
|
+
'key' in value &&
|
|
46
|
+
'children' in value);
|
|
47
|
+
};
|
|
36
48
|
//# sourceMappingURL=typeGuards.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeGuards.js","sourceRoot":"","sources":["../../../src/core/reconciliation/typeGuards.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typeGuards.js","sourceRoot":"","sources":["../../../src/core/reconciliation/typeGuards.ts"],"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 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateApp.d.ts","sourceRoot":"","sources":["../../../src/core/reconciliation/validateApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAa,MAAM,oBAAoB,CAAC;AAKzD,eAAO,MAAM,WAAW,oBAkBvB,CAAC"}
|
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
import { nullthrows } from '../../utils';
|
|
2
|
+
import { captureStack } from './errors/stack';
|
|
3
|
+
import { FAKE_CONTAINER_TAG } from './fibers';
|
|
4
|
+
export const validateApp = (app) => {
|
|
5
|
+
for (const fiber of app.invalidatedComponents) {
|
|
6
|
+
if (!fiber.parent) {
|
|
7
|
+
throw new Error('Orphan component invalidated');
|
|
8
|
+
}
|
|
9
|
+
if (fiber.parent.tag === FAKE_CONTAINER_TAG) {
|
|
10
|
+
const e = new Error(`Cannot invalidate not-mounted fiber node`);
|
|
11
|
+
e.message +=
|
|
12
|
+
'\n' +
|
|
13
|
+
captureStack(fiber)
|
|
14
|
+
.map((s, i) => `\t${i + 1}: ${s}`)
|
|
15
|
+
.join('\n');
|
|
16
|
+
throw e;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
validateTree(app.root);
|
|
20
|
+
};
|
|
2
21
|
/**
|
|
3
22
|
* Validates the given fiber node and its subnodes. In case of error it throws.
|
|
4
23
|
*/
|
|
5
|
-
|
|
24
|
+
const validateTree = (node, path = '') => {
|
|
6
25
|
// Each rendered node must be associated with at least one real DOM node.
|
|
7
26
|
nullthrows(node.element, `${path}.element`);
|
|
8
27
|
if (node.type === 'tag') {
|
|
@@ -45,4 +64,4 @@ const getFiberPathLabel = (node) => {
|
|
|
45
64
|
? `<${node.component.name || 'Comp'}/>`
|
|
46
65
|
: 'unknown';
|
|
47
66
|
};
|
|
48
|
-
//# sourceMappingURL=
|
|
67
|
+
//# sourceMappingURL=validateApp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateApp.js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OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,CAC/D,CAAC;QACJ,CAAC;QACD,YAAY,CAAC,KAAK,EAAE,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC,CAAC;IACxC,CAAC;AAAA,CACF,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,IAAe,EAAU,EAAE,CAAC;IACrD,OAAO,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;QACjD,CAAC,CAAC,IAAI,CAAC,IAAI;QACX,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,KAAK;YACnB,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI;YAC9B,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU;gBACxB,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS;oBACvB,CAAC,CAAC,QAAQ;oBACV,CAAC,CAAC,IAAI;gBACR,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW;oBACzB,CAAC,CAAC,IAAI,IAAI,CAAC,SAAU,CAAC,IAAI,IAAI,MAAM,IAAI;oBACxC,CAAC,CAAC,SAAS,CAAC;AAAA,CACrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useContext.d.ts","sourceRoot":"","sources":["../../src/hooks/useContext.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,YAAY,EAIlB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"useContext.d.ts","sourceRoot":"","sources":["../../src/hooks/useContext.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,YAAY,EAIlB,MAAM,UAAU,CAAC;AAIlB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,qCAmB9B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,4BAsD3B,CAAC"}
|
package/dist/hooks/useContext.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getAppByFiber } from '../core/reconciliation/app';
|
|
2
2
|
import { getNextHookOrCreate } from './helpers';
|
|
3
|
+
import { isFiberDead } from '../core/reconciliation/fibers';
|
|
3
4
|
/**
|
|
4
5
|
* Creates a React context object that can be used to pass data through the
|
|
5
6
|
* component tree without having to pass props down manually at every level.
|
|
@@ -65,14 +66,29 @@ ctx) => {
|
|
|
65
66
|
type: 'context',
|
|
66
67
|
ctx,
|
|
67
68
|
providerFiber,
|
|
69
|
+
move(newFiber) {
|
|
70
|
+
if (providerFiber) {
|
|
71
|
+
if (providerFiber.id < 0) {
|
|
72
|
+
throw 'again';
|
|
73
|
+
}
|
|
74
|
+
providerFiber.data.consumers.delete(fiber);
|
|
75
|
+
providerFiber.data.consumers.add(newFiber);
|
|
76
|
+
}
|
|
77
|
+
fiber = newFiber;
|
|
78
|
+
},
|
|
68
79
|
destructor: () => {
|
|
69
80
|
providerFiber?.data.consumers.delete(fiber);
|
|
81
|
+
// it'll remove the old fiber :(
|
|
70
82
|
},
|
|
71
83
|
};
|
|
72
84
|
});
|
|
73
85
|
if (item.providerFiber) {
|
|
86
|
+
if (isFiberDead(item.providerFiber)) {
|
|
87
|
+
throw new Error(`Cannot read from dead context provider`);
|
|
88
|
+
}
|
|
74
89
|
const { tempContext } = getAppByFiber(item.providerFiber);
|
|
75
90
|
const { id } = item.providerFiber;
|
|
91
|
+
// I change ID in displace. ^
|
|
76
92
|
if (tempContext.has(id)) {
|
|
77
93
|
// When we're here it means the provider's value was invalidated during
|
|
78
94
|
// the active render.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useContext.js","sourceRoot":"","sources":["../../src/hooks/useContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAQrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3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,YAAY,GAAG,CACnB,KAAgB,EAChB,EAAU,EACe,EAAE,CAAC;IAC5B,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,EAAE,EAAE,CAAC;QAC9D,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AAAA,CACd,CAAC;AAEF,IAAI,GAAG,GAAG,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useState.d.ts","sourceRoot":"","sources":["../../src/hooks/useState.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"useState.d.ts","sourceRoot":"","sources":["../../src/hooks/useState.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,UAAU,CAAC;AAI/D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,mFAoDzB,CAAC"}
|
package/dist/hooks/useState.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { invalidateFiber } from '../core/reconciliation/invalidateFiber';
|
|
2
2
|
import { getNextHookOrCreate } from './helpers';
|
|
3
|
+
import { getAppByFiber } from '../core/reconciliation/app';
|
|
3
4
|
/**
|
|
4
5
|
* A hook that allows you to add state to functional components. Returns a
|
|
5
6
|
* stateful value and a function to update it.
|
|
@@ -17,12 +18,36 @@ export const useState = (
|
|
|
17
18
|
* function is provided, it will only be called once during initialization. */
|
|
18
19
|
initValue) => {
|
|
19
20
|
const item = getNextHookOrCreate('state', (fiber) => {
|
|
21
|
+
const app = getAppByFiber(fiber);
|
|
20
22
|
const item = {
|
|
21
23
|
type: 'state',
|
|
22
24
|
state: (typeof initValue === 'function'
|
|
23
25
|
? initValue()
|
|
24
26
|
: initValue),
|
|
27
|
+
move: (newFiber) => {
|
|
28
|
+
fiber = newFiber;
|
|
29
|
+
},
|
|
30
|
+
destructor: () => {
|
|
31
|
+
item.state = null;
|
|
32
|
+
// @ts-expect-error
|
|
33
|
+
fiber = null;
|
|
34
|
+
},
|
|
25
35
|
setter: function setState(valueOrFn) {
|
|
36
|
+
if (!fiber) {
|
|
37
|
+
// When a component is removed, we clean up all of its children and
|
|
38
|
+
// their refs. This setState function may be used as a ref handler.
|
|
39
|
+
// The ref handler gets scheduled before the parent node is removed,
|
|
40
|
+
// but executes after removal. In this case, we should skip the
|
|
41
|
+
// warning since it's expected behavior.
|
|
42
|
+
if (app.state !== 'refEffects') {
|
|
43
|
+
console.warn(`Component has been removed. State cannot be updated`);
|
|
44
|
+
// a test
|
|
45
|
+
}
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (fiber.id < 0) {
|
|
49
|
+
throw 'again2';
|
|
50
|
+
}
|
|
26
51
|
const v = (typeof valueOrFn === 'function'
|
|
27
52
|
? valueOrFn(item.state)
|
|
28
53
|
: valueOrFn);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useState.js","sourceRoot":"","sources":["../../src/hooks/useState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AAEnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"useState.js","sourceRoot":"","sources":["../../src/hooks/useState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AAEnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;AACtB;8EAC8E;AAC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,CAAC,KAAK,CAAC,CAAC;YAAA,CACxB;SACF,CAAC;QACF,OAAO,IAAoB,CAAC;IAAA,CAC7B,CAAC,CAAC;IAEH,OAAO,CAAC,IAAI,CAAC,KAAU,EAAE,IAAI,CAAC,MAAwB,CAAC,CAAC;AAAA,CACzD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,11 @@ export * from './types';
|
|
|
2
2
|
export * from './hooks/index';
|
|
3
3
|
export * from './core/createRoot';
|
|
4
4
|
export * from './core/createElement';
|
|
5
|
-
export
|
|
5
|
+
export { Component, Component as PureComponent } from './core/classComponent';
|
|
6
|
+
export * from './mocks';
|
|
7
|
+
export { isValidElement } from './core/reconciliation/typeGuards';
|
|
8
|
+
export { Children } from './core/Children';
|
|
9
|
+
export declare function memo<T>(Comp: T, isEq?: unknown): T;
|
|
6
10
|
/** <Fragment/> */
|
|
7
11
|
export { FRAGMENT_TAG as Fragment } from './core/reconciliation/fibers';
|
|
8
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC9E,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,wBAAgB,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,CAAC,CAMlD;AAED,kBAAkB;AAClB,OAAO,EAAE,YAAY,IAAI,QAAQ,EAAE,MAAM,8BAA8B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,10 @@ export * from './types';
|
|
|
2
2
|
export * from './hooks/index';
|
|
3
3
|
export * from './core/createRoot';
|
|
4
4
|
export * from './core/createElement';
|
|
5
|
+
export { Component, Component as PureComponent } from './core/classComponent';
|
|
6
|
+
export * from './mocks';
|
|
7
|
+
export { isValidElement } from './core/reconciliation/typeGuards';
|
|
8
|
+
export { Children } from './core/Children';
|
|
5
9
|
export function memo(Comp, isEq) {
|
|
6
10
|
if (isEq) {
|
|
7
11
|
throw new Error(`Custom "isEqual" for memo is not supported`);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC9E,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,UAAU,IAAI,CAAI,IAAO,EAAE,IAAc,EAAK;IAClD,IAAI,IAAI,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,IAAI,CAAC,CAAC,8CAA8C;AAA/C,CACb;AAED,kBAAkB;AAClB,OAAO,EAAE,YAAY,IAAI,QAAQ,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const jsx: typeof
|
|
3
|
-
export declare const jsxDEV: typeof
|
|
4
|
-
export declare const jsxs: typeof
|
|
1
|
+
import { createElementNew } from './index';
|
|
2
|
+
export declare const jsx: typeof createElementNew;
|
|
3
|
+
export declare const jsxDEV: typeof createElementNew;
|
|
4
|
+
export declare const jsxs: typeof createElementNew;
|
|
5
5
|
export declare const Fragment = "x-fragment";
|
|
6
6
|
//# sourceMappingURL=jsx-dev-runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-dev-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-dev-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-dev-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG3C,eAAO,MAAM,GAAG,yBAAmB,CAAC;AACpC,eAAO,MAAM,MAAM,yBAAmB,CAAC;AACvC,eAAO,MAAM,IAAI,yBAAmB,CAAC;AACrC,eAAO,MAAM,QAAQ,eAAe,CAAC"}
|
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createElementNew } from './index';
|
|
2
2
|
import { FRAGMENT_TAG } from './core/reconciliation/fibers';
|
|
3
|
-
export const jsx =
|
|
4
|
-
export const jsxDEV =
|
|
5
|
-
export const jsxs =
|
|
3
|
+
export const jsx = createElementNew;
|
|
4
|
+
export const jsxDEV = createElementNew;
|
|
5
|
+
export const jsxs = createElementNew;
|
|
6
6
|
export const Fragment = FRAGMENT_TAG;
|
|
7
7
|
//# sourceMappingURL=jsx-dev-runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-dev-runtime.js","sourceRoot":"","sources":["../src/jsx-dev-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.js","sourceRoot":"","sources":["../src/jsx-dev-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,MAAM,CAAC,MAAM,GAAG,GAAG,gBAAgB,CAAC;AACpC,MAAM,CAAC,MAAM,MAAM,GAAG,gBAAgB,CAAC;AACvC,MAAM,CAAC,MAAM,IAAI,GAAG,gBAAgB,CAAC;AACrC,MAAM,CAAC,MAAM,QAAQ,GAAG,YAAY,CAAC"}
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createElementNew } from './index';
|
|
2
2
|
/**
|
|
3
3
|
* This file is used to get `jsx`, `jsxs` & `Fragment` to be used by the JSX | TSX
|
|
4
4
|
* compiler to convert <tag/> or <Component/> into vNodes (ElementNode in this
|
|
@@ -11,7 +11,7 @@ import { createElement } from './index';
|
|
|
11
11
|
* <span>A</span> ===
|
|
12
12
|
* jsx("span", { children: "A" })
|
|
13
13
|
*/
|
|
14
|
-
export declare const jsx: typeof
|
|
14
|
+
export declare const jsx: typeof createElementNew;
|
|
15
15
|
/**
|
|
16
16
|
* `createElement` with 2+ children
|
|
17
17
|
* @example
|
|
@@ -21,7 +21,7 @@ export declare const jsx: typeof createElement;
|
|
|
21
21
|
* jsx("span", { children: "B" })
|
|
22
22
|
* ]});
|
|
23
23
|
*/
|
|
24
|
-
export declare const jsxs: typeof
|
|
24
|
+
export declare const jsxs: typeof createElementNew;
|
|
25
25
|
/**
|
|
26
26
|
* <>[1,2]</>
|
|
27
27
|
* === jsxs(FRAGMENT_TAG, { children: [1,2] })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG3C;;;;GAIG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,GAAG,yBAAmB,CAAC;AAEpC;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,yBAAmB,CAAC;AAErC;;;;GAIG;AACH,eAAO,MAAM,QAAQ,eAAe,CAAC"}
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createElementNew } from './index';
|
|
2
2
|
import { FRAGMENT_TAG } from './core/reconciliation/fibers';
|
|
3
3
|
/**
|
|
4
4
|
* This file is used to get `jsx`, `jsxs` & `Fragment` to be used by the JSX | TSX
|
|
@@ -12,7 +12,7 @@ import { FRAGMENT_TAG } from './core/reconciliation/fibers';
|
|
|
12
12
|
* <span>A</span> ===
|
|
13
13
|
* jsx("span", { children: "A" })
|
|
14
14
|
*/
|
|
15
|
-
export const jsx =
|
|
15
|
+
export const jsx = createElementNew;
|
|
16
16
|
/**
|
|
17
17
|
* `createElement` with 2+ children
|
|
18
18
|
* @example
|
|
@@ -22,7 +22,7 @@ export const jsx = createElement;
|
|
|
22
22
|
* jsx("span", { children: "B" })
|
|
23
23
|
* ]});
|
|
24
24
|
*/
|
|
25
|
-
export const jsxs =
|
|
25
|
+
export const jsxs = createElementNew;
|
|
26
26
|
/**
|
|
27
27
|
* <>[1,2]</>
|
|
28
28
|
* === jsxs(FRAGMENT_TAG, { children: [1,2] })
|
package/dist/jsx-runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-runtime.js","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"jsx-runtime.js","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D;;;;GAIG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,gBAAgB,CAAC;AAEpC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,gBAAgB,CAAC;AAErC;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,YAAY,CAAC"}
|
package/{src → dist}/jsx.d.ts
RENAMED
|
@@ -1,16 +1,41 @@
|
|
|
1
|
+
import type { Component } from './core/classComponent';
|
|
1
2
|
import {
|
|
2
3
|
type JsxElement,
|
|
3
4
|
type TagProps,
|
|
4
5
|
type SvgTagProps,
|
|
5
6
|
type SvgRootProps,
|
|
7
|
+
type ReactComponent,
|
|
8
|
+
type FC,
|
|
9
|
+
type ReactKey,
|
|
6
10
|
} from './types';
|
|
7
11
|
|
|
8
12
|
export {};
|
|
9
13
|
|
|
10
14
|
declare global {
|
|
15
|
+
namespace React {
|
|
16
|
+
export { FC };
|
|
17
|
+
|
|
18
|
+
export type ReactNode = JSX.Element;
|
|
19
|
+
}
|
|
20
|
+
|
|
11
21
|
namespace JSX {
|
|
12
22
|
type Element = JsxElement;
|
|
13
23
|
|
|
24
|
+
interface ElementClass extends Component<any, any> {
|
|
25
|
+
render: () => JSX.Element;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface IntrinsicAttributes {
|
|
29
|
+
key?: ReactKey | null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type LibraryManagedAttributes<Component, Props> = Component extends {
|
|
33
|
+
defaultProps: infer Defaults;
|
|
34
|
+
}
|
|
35
|
+
? Partial<Pick<Props, keyof Defaults>> &
|
|
36
|
+
Pick<Props, Exclude<keyof Props, keyof Defaults>>
|
|
37
|
+
: Props;
|
|
38
|
+
|
|
14
39
|
interface IntrinsicElements {
|
|
15
40
|
// Document structure
|
|
16
41
|
html: TagProps<HTMLHtmlElement>;
|