@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEffect.js","sourceRoot":"","sources":["../../src/hooks/useEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAMtE,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAE1E,
|
|
1
|
+
{"version":3,"file":"useEffect.js","sourceRoot":"","sources":["../../src/hooks/useEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAMtE,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAE1E,MAAM,UAAU,aAAa,CAC3B,IAAgB,EAChB,EAAiB,EACjB,IAAgB,EAChB;IACA,MAAM,IAAI,GAAG,mBAAmB,CAAC,QAAQ,EAAE,GAAkB,EAAE,CAAC;QAC9D,MAAM,IAAI,GAAkB;YAC1B,IAAI,EAAE,QAAQ;YACd,IAAI;YACJ,EAAE;YACF,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;SACnC,CAAC;QACF,cAAc,CAAC,aAAa,EAAE,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,E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,SAAS,gBAAgB,GAAG;QAC5C,UAAU,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;YACjC,MAAM,EAAE,CAAC;QACX,CAAC;IAAA,CACF,CAAC;AAAA,CACH,CAAC"}
|
package/dist/hooks/useRef.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { type Ref } from '../types';
|
|
2
|
-
export declare function useRef<T>():
|
|
3
|
-
export declare function useRef<T>(initialValue: T):
|
|
1
|
+
import { type RefObject, type UnknownProps, type Ref, type ReactComponent } from '../types';
|
|
2
|
+
export declare function useRef<T>(value: T): RefObject<T>;
|
|
3
|
+
export declare function useRef<T>(initialValue: T | null): RefObject<T | null>;
|
|
4
|
+
export declare function useRef<T>(initialValue: T | undefined): RefObject<T | undefined>;
|
|
5
|
+
export declare const forwardRef: <Props extends UnknownProps, R>(Component: (props: Props, ref?: Ref<R> | undefined) => import("../index.js").JsxElement) => ReactComponent<Props & {
|
|
6
|
+
ref?: Ref<R> | undefined;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const useImperativeHandle: <T>(ref: Ref<T> | undefined, factory: () => T, deps?: unknown[] | undefined) => void;
|
|
4
9
|
//# sourceMappingURL=useRef.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRef.d.ts","sourceRoot":"","sources":["../../src/hooks/useRef.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"useRef.d.ts","sourceRoot":"","sources":["../../src/hooks/useRef.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,GAAG,EACR,KAAK,cAAc,EACpB,MAAM,UAAU,CAAC;AAIlB,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAClD,wBAAgB,MAAM,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AACvE,wBAAgB,MAAM,CAAC,CAAC,EACtB,YAAY,EAAE,CAAC,GAAG,SAAS,GAC1B,SAAS,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;AAa5B,eAAO,MAAM,UAAU,GAAI,KAAK,uBAAuB,CAAC;;EAMvD,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,CAAC,kFA2BpC,CAAC"}
|
package/dist/hooks/useRef.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getNextHookOrCreate } from './helpers';
|
|
2
|
+
import { useBaseEffect } from './useEffect';
|
|
2
3
|
export function useRef(initialValue) {
|
|
3
4
|
const item = getNextHookOrCreate('ref', () => ({
|
|
4
5
|
type: 'ref',
|
|
@@ -6,4 +7,30 @@ export function useRef(initialValue) {
|
|
|
6
7
|
}));
|
|
7
8
|
return item.value;
|
|
8
9
|
}
|
|
10
|
+
export const forwardRef = (Component) => {
|
|
11
|
+
return function ForwardRef({ ref, ...props }) {
|
|
12
|
+
return Component(props, ref);
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export const useImperativeHandle = (ref, factory, deps) => {
|
|
16
|
+
useBaseEffect('refsMount', () => {
|
|
17
|
+
if (!ref)
|
|
18
|
+
return;
|
|
19
|
+
const handle = factory();
|
|
20
|
+
if (typeof ref === 'function') {
|
|
21
|
+
ref(handle);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
ref.current = handle;
|
|
25
|
+
}
|
|
26
|
+
return () => {
|
|
27
|
+
if (typeof ref === 'function') {
|
|
28
|
+
ref(null);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
ref.current = null;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}, deps ? [ref, ...deps] : undefined);
|
|
35
|
+
};
|
|
9
36
|
//# sourceMappingURL=useRef.js.map
|
package/dist/hooks/useRef.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRef.js","sourceRoot":"","sources":["../../src/hooks/useRef.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useRef.js","sourceRoot":"","sources":["../../src/hooks/useRef.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAO5C,MAAM,UAAU,MAAM,CAAI,YAAgB,EAAgB;IACxD,MAAM,IAAI,GAAG,mBAAmB,CAC9B,KAAK,EACL,GAAe,EAAE,CAAC,CAAC;QACjB,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,EAAE,OAAO,EAAE,YAAY,IAAI,SAAS,EAAE;KAC9C,CAAC,CACH,CAAC;IAEF,OAAO,IAAI,CAAC,KAAqB,CAAC;AAAA,CACnC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,SAAsD,EACZ,EAAE,CAAC;IAC7C,OAAO,SAAS,UAAU,CAAC,EAAE,GAAG,EAAE,GAAG,KAAK,EAA4B,EAAE;QACtE,OAAO,SAAS,CAAC,KAAyB,EAAE,GAAG,CAAC,CAAC;IAAA,CAClD,CAAC;AAAA,CACH,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,GAAuB,EACvB,OAAgB,EAChB,IAAgB,EACV,EAAE,CAAC;IACT,aAAa,CACX,WAAW,EACX,GAAG,EAAE,CAAC;QACJ,IAAI,CAAC,GAAG;YAAE,OAAO;QAEjB,MAAM,MAAM,GAAG,OAAO,EAAE,CAAC;QACzB,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;YAC9B,GAAG,CAAC,MAAM,CAAC,CAAC;QACd,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;QACvB,CAAC;QAED,OAAO,GAAG,EAAE,CAAC;YACX,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;gBAC9B,GAAG,CAAC,IAAI,CAAC,CAAC;YACZ,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;YACrB,CAAC;QAAA,CACF,CAAC;IAAA,CACH,EACD,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAClC,CAAC;AAAA,CACH,CAAC"}
|
package/dist/hooks/useState.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ import { type StateSetter } from '../types';
|
|
|
11
11
|
* // With lazy initialization
|
|
12
12
|
* const [data, setData] = useState(() => expensiveComputation());
|
|
13
13
|
*/
|
|
14
|
-
export declare const useState: <T>(initValue: (() => T) | (
|
|
14
|
+
export declare const useState: <T>(initValue: T | (() => T) | (() => T)) => [T, StateSetter<T>];
|
|
15
15
|
//# sourceMappingURL=useState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useState.d.ts","sourceRoot":"","sources":["../../src/hooks/useState.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"useState.d.ts","sourceRoot":"","sources":["../../src/hooks/useState.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,WAAW,EAAqB,MAAM,UAAU,CAAC;AAI/E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,8DAkDzB,CAAC"}
|
package/dist/hooks/useState.js
CHANGED
|
@@ -17,7 +17,8 @@ export const useState = (
|
|
|
17
17
|
/** The initial state value or a function that returns the initial state. If a
|
|
18
18
|
* function is provided, it will only be called once during initialization. */
|
|
19
19
|
initValue) => {
|
|
20
|
-
const item = getNextHookOrCreate('state', (
|
|
20
|
+
const item = getNextHookOrCreate('state', (initFiber) => {
|
|
21
|
+
let fiber = initFiber;
|
|
21
22
|
const app = getAppByFiber(fiber);
|
|
22
23
|
const item = {
|
|
23
24
|
type: 'state',
|
|
@@ -28,8 +29,8 @@ initValue) => {
|
|
|
28
29
|
fiber = newFiber;
|
|
29
30
|
},
|
|
30
31
|
destructor: () => {
|
|
32
|
+
// Help GC.
|
|
31
33
|
item.state = null;
|
|
32
|
-
// @ts-expect-error
|
|
33
34
|
fiber = null;
|
|
34
35
|
},
|
|
35
36
|
setter: function setState(valueOrFn) {
|
|
@@ -41,13 +42,10 @@ initValue) => {
|
|
|
41
42
|
// warning since it's expected behavior.
|
|
42
43
|
if (app.state !== 'refEffects') {
|
|
43
44
|
console.warn(`Component has been removed. State cannot be updated`);
|
|
44
|
-
// a test
|
|
45
|
+
// TODO: add a test ^.
|
|
45
46
|
}
|
|
46
47
|
return;
|
|
47
48
|
}
|
|
48
|
-
if (fiber.id < 0) {
|
|
49
|
-
throw 'again2';
|
|
50
|
-
}
|
|
51
49
|
const v = (typeof valueOrFn === 'function'
|
|
52
50
|
? valueOrFn(item.state)
|
|
53
51
|
: 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;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;AACtB;8EAC8E;AAC9E,
|
|
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;8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C;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
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;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"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,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
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;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
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,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"}
|
package/dist/jsx.d.ts
CHANGED
|
@@ -4,22 +4,27 @@ import {
|
|
|
4
4
|
type TagProps,
|
|
5
5
|
type SvgTagProps,
|
|
6
6
|
type SvgRootProps,
|
|
7
|
-
type ReactComponent,
|
|
8
|
-
type FC,
|
|
9
7
|
type ReactKey,
|
|
8
|
+
type ElementType as ET,
|
|
9
|
+
type FiberNode,
|
|
10
10
|
} from './types';
|
|
11
11
|
|
|
12
12
|
export {};
|
|
13
13
|
|
|
14
14
|
declare global {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
interface Element {
|
|
16
|
+
__fiber?: FiberNode;
|
|
17
|
+
}
|
|
18
|
+
interface Text {
|
|
19
|
+
__fiber?: FiberNode;
|
|
20
|
+
}
|
|
21
|
+
interface Comment {
|
|
22
|
+
__fiber?: FiberNode;
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
namespace JSX {
|
|
22
26
|
type Element = JsxElement;
|
|
27
|
+
type ElementType = ET;
|
|
23
28
|
|
|
24
29
|
interface ElementClass extends Component<any, any> {
|
|
25
30
|
render: () => JSX.Element;
|
|
@@ -29,15 +34,31 @@ declare global {
|
|
|
29
34
|
key?: ReactKey | null;
|
|
30
35
|
}
|
|
31
36
|
|
|
37
|
+
// Determines the `children` props name.
|
|
38
|
+
// <div>… here …</div> (but not <div children={…}/>).
|
|
39
|
+
interface ElementChildrenAttribute {
|
|
40
|
+
children: {};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// To auto-detect props for class-based components via:
|
|
44
|
+
// class User { props: T /* <- this */ }
|
|
45
|
+
interface ElementAttributesProperty {
|
|
46
|
+
props: {};
|
|
47
|
+
}
|
|
48
|
+
|
|
32
49
|
type LibraryManagedAttributes<Component, Props> = Component extends {
|
|
33
50
|
defaultProps: infer Defaults;
|
|
34
51
|
}
|
|
35
|
-
? Partial<
|
|
36
|
-
|
|
52
|
+
? Defaults extends Partial<Props>
|
|
53
|
+
? Partial<Pick<Props, keyof Defaults & keyof Props>> &
|
|
54
|
+
Pick<Props, Exclude<keyof Props, keyof Defaults>>
|
|
55
|
+
: Props
|
|
37
56
|
: Props;
|
|
38
57
|
|
|
39
58
|
interface IntrinsicElements {
|
|
40
|
-
|
|
59
|
+
['x-fragment']: IntrinsicAttributes & { children: JSX.Element };
|
|
60
|
+
|
|
61
|
+
// HTML Elements
|
|
41
62
|
html: TagProps<HTMLHtmlElement>;
|
|
42
63
|
head: TagProps<HTMLHeadElement>;
|
|
43
64
|
body: TagProps<HTMLBodyElement>;
|
|
@@ -46,16 +67,13 @@ declare global {
|
|
|
46
67
|
link: TagProps<HTMLLinkElement>;
|
|
47
68
|
script: TagProps<HTMLScriptElement>;
|
|
48
69
|
style: TagProps<HTMLStyleElement>;
|
|
49
|
-
|
|
50
|
-
// Content sectioning
|
|
70
|
+
article: TagProps<HTMLElement>;
|
|
51
71
|
h1: TagProps<HTMLHeadingElement>;
|
|
52
72
|
h2: TagProps<HTMLHeadingElement>;
|
|
53
73
|
h3: TagProps<HTMLHeadingElement>;
|
|
54
74
|
h4: TagProps<HTMLHeadingElement>;
|
|
55
75
|
h5: TagProps<HTMLHeadingElement>;
|
|
56
76
|
h6: TagProps<HTMLHeadingElement>;
|
|
57
|
-
|
|
58
|
-
// Text content
|
|
59
77
|
div: TagProps<HTMLDivElement>;
|
|
60
78
|
p: TagProps<HTMLParagraphElement>;
|
|
61
79
|
span: TagProps<HTMLSpanElement>;
|
|
@@ -65,29 +83,26 @@ declare global {
|
|
|
65
83
|
ol: TagProps<HTMLOListElement>;
|
|
66
84
|
li: TagProps<HTMLLIElement>;
|
|
67
85
|
dl: TagProps<HTMLDListElement>;
|
|
86
|
+
dt: TagProps<HTMLElement>;
|
|
87
|
+
dd: TagProps<HTMLElement>;
|
|
68
88
|
hr: TagProps<HTMLHRElement>;
|
|
69
89
|
br: TagProps<HTMLBRElement>;
|
|
70
|
-
|
|
71
|
-
|
|
90
|
+
em: TagProps<HTMLElement>;
|
|
91
|
+
i: TagProps<HTMLElement>;
|
|
92
|
+
b: TagProps<HTMLElement>;
|
|
72
93
|
a: TagProps<HTMLAnchorElement>;
|
|
73
94
|
q: TagProps<HTMLQuoteElement>;
|
|
74
95
|
time: TagProps<HTMLTimeElement>;
|
|
75
|
-
|
|
76
|
-
// Image and multimedia
|
|
77
96
|
img: TagProps<HTMLImageElement>;
|
|
78
97
|
video: TagProps<HTMLVideoElement>;
|
|
79
98
|
audio: TagProps<HTMLAudioElement>;
|
|
80
99
|
source: TagProps<HTMLSourceElement>;
|
|
81
100
|
track: TagProps<HTMLTrackElement>;
|
|
82
101
|
canvas: TagProps<HTMLCanvasElement>;
|
|
83
|
-
|
|
84
|
-
// Embedded content
|
|
85
102
|
iframe: TagProps<HTMLIFrameElement>;
|
|
86
103
|
embed: TagProps<HTMLEmbedElement>;
|
|
87
104
|
object: TagProps<HTMLObjectElement>;
|
|
88
105
|
param: TagProps<HTMLParamElement>;
|
|
89
|
-
|
|
90
|
-
// Forms
|
|
91
106
|
form: TagProps<HTMLFormElement>;
|
|
92
107
|
input: TagProps<HTMLInputElement>;
|
|
93
108
|
button: TagProps<HTMLButtonElement>;
|
|
@@ -102,13 +117,9 @@ declare global {
|
|
|
102
117
|
output: TagProps<HTMLOutputElement>;
|
|
103
118
|
progress: TagProps<HTMLProgressElement>;
|
|
104
119
|
meter: TagProps<HTMLMeterElement>;
|
|
105
|
-
|
|
106
|
-
// Interactive elements
|
|
107
120
|
details: TagProps<HTMLDetailsElement>;
|
|
108
121
|
summary: TagProps<HTMLElement>;
|
|
109
122
|
dialog: TagProps<HTMLDialogElement>;
|
|
110
|
-
|
|
111
|
-
// Tables
|
|
112
123
|
table: TagProps<HTMLTableElement>;
|
|
113
124
|
thead: TagProps<HTMLTableSectionElement>;
|
|
114
125
|
tbody: TagProps<HTMLTableSectionElement>;
|
|
@@ -119,28 +130,132 @@ declare global {
|
|
|
119
130
|
caption: TagProps<HTMLTableCaptionElement>;
|
|
120
131
|
colgroup: TagProps<HTMLTableColElement>;
|
|
121
132
|
col: TagProps<HTMLTableColElement>;
|
|
133
|
+
area: TagProps<HTMLAreaElement>;
|
|
134
|
+
base: TagProps<HTMLBaseElement>;
|
|
135
|
+
data: TagProps<HTMLDataElement>;
|
|
136
|
+
menu: TagProps<HTMLMenuElement>;
|
|
137
|
+
picture: TagProps<HTMLPictureElement>;
|
|
138
|
+
slot: TagProps<HTMLSlotElement>;
|
|
139
|
+
template: TagProps<HTMLTemplateElement>;
|
|
140
|
+
font: TagProps<HTMLFontElement>;
|
|
141
|
+
frame: TagProps<HTMLFrameElement>;
|
|
142
|
+
marquee: TagProps<HTMLMarqueeElement>;
|
|
143
|
+
map: TagProps<HTMLMapElement>;
|
|
144
|
+
del: TagProps<HTMLModElement>;
|
|
145
|
+
ins: TagProps<HTMLModElement>;
|
|
146
|
+
dir: TagProps<HTMLDirectoryElement>;
|
|
147
|
+
frameset: TagProps<HTMLFrameSetElement>;
|
|
148
|
+
// No custom DOM constructor:
|
|
149
|
+
abbr: TagProps<HTMLElement>;
|
|
150
|
+
acronym: TagProps<HTMLElement>;
|
|
151
|
+
address: TagProps<HTMLElement>;
|
|
152
|
+
aside: TagProps<HTMLElement>;
|
|
153
|
+
bdi: TagProps<HTMLElement>;
|
|
154
|
+
bdo: TagProps<HTMLElement>;
|
|
155
|
+
big: TagProps<HTMLElement>;
|
|
156
|
+
center: TagProps<HTMLElement>;
|
|
157
|
+
cite: TagProps<HTMLElement>;
|
|
158
|
+
code: TagProps<HTMLElement>;
|
|
159
|
+
dfn: TagProps<HTMLElement>;
|
|
160
|
+
fencedframe: TagProps<HTMLElement>;
|
|
161
|
+
figcaption: TagProps<HTMLElement>;
|
|
162
|
+
figure: TagProps<HTMLElement>;
|
|
163
|
+
footer: TagProps<HTMLElement>;
|
|
164
|
+
header: TagProps<HTMLElement>;
|
|
165
|
+
hgroup: TagProps<HTMLElement>;
|
|
166
|
+
type: TagProps<HTMLElement>;
|
|
167
|
+
kbd: TagProps<HTMLElement>;
|
|
168
|
+
main: TagProps<HTMLElement>;
|
|
169
|
+
mark: TagProps<HTMLElement>;
|
|
170
|
+
nav: TagProps<HTMLElement>;
|
|
171
|
+
nobr: TagProps<HTMLElement>;
|
|
172
|
+
noembed: TagProps<HTMLElement>;
|
|
173
|
+
noframes: TagProps<HTMLElement>;
|
|
174
|
+
noscript: TagProps<HTMLElement>;
|
|
175
|
+
plaintext: TagProps<HTMLElement>;
|
|
176
|
+
portal: TagProps<HTMLElement>;
|
|
177
|
+
rb: TagProps<HTMLElement>;
|
|
178
|
+
rp: TagProps<HTMLElement>;
|
|
179
|
+
rt: TagProps<HTMLElement>;
|
|
180
|
+
rtc: TagProps<HTMLElement>;
|
|
181
|
+
ruby: TagProps<HTMLElement>;
|
|
182
|
+
s: TagProps<HTMLElement>;
|
|
183
|
+
samp: TagProps<HTMLElement>;
|
|
184
|
+
search: TagProps<HTMLElement>;
|
|
185
|
+
section: TagProps<HTMLElement>;
|
|
186
|
+
small: TagProps<HTMLElement>;
|
|
187
|
+
strike: TagProps<HTMLElement>;
|
|
188
|
+
strong: TagProps<HTMLElement>;
|
|
189
|
+
sub: TagProps<HTMLElement>;
|
|
190
|
+
sup: TagProps<HTMLElement>;
|
|
191
|
+
tt: TagProps<HTMLElement>;
|
|
192
|
+
u: TagProps<HTMLElement>;
|
|
193
|
+
var: TagProps<HTMLElement>;
|
|
194
|
+
wbr: TagProps<HTMLElement>;
|
|
195
|
+
xmp: TagProps<HTMLElement>;
|
|
122
196
|
|
|
123
197
|
// SVG elements
|
|
124
198
|
svg: SvgRootProps;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
text: SvgTagProps
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
199
|
+
polygon: SvgTagProps<SVGPolygonElement>;
|
|
200
|
+
circle: SvgTagProps<SVGCircleElement>;
|
|
201
|
+
clipPath: SvgTagProps<SVGClipPathElement>;
|
|
202
|
+
defs: SvgTagProps<SVGDefsElement>;
|
|
203
|
+
ellipse: SvgTagProps<SVGEllipseElement>;
|
|
204
|
+
g: SvgTagProps<SVGGElement>;
|
|
205
|
+
line: SvgTagProps<SVGLineElement>;
|
|
206
|
+
image: SvgTagProps<SVGImageElement>;
|
|
207
|
+
mask: SvgTagProps<SVGMaskElement>;
|
|
208
|
+
path: SvgTagProps<SVGPathElement>;
|
|
209
|
+
pattern: SvgTagProps<SVGPatternElement>;
|
|
210
|
+
polyline: SvgTagProps<SVGPolylineElement>;
|
|
211
|
+
rect: SvgTagProps<SVGRectElement>;
|
|
212
|
+
text: SvgTagProps<SVGTextElement>;
|
|
213
|
+
use: SvgTagProps<SVGUseElement>;
|
|
214
|
+
animate: SvgTagProps<SVGAnimateElement>;
|
|
215
|
+
animateMotion: SvgTagProps<SVGAnimateMotionElement>;
|
|
216
|
+
animateTransform: SvgTagProps<SVGAnimateTransformElement>;
|
|
217
|
+
set: SvgTagProps<SVGSetElement>;
|
|
218
|
+
desc: SvgTagProps<SVGDescElement>;
|
|
219
|
+
filter: SvgTagProps<SVGFilterElement>;
|
|
220
|
+
marker: SvgTagProps<SVGMarkerElement>;
|
|
221
|
+
foreignObject: SvgTagProps<SVGForeignObjectElement>;
|
|
222
|
+
linearGradient: SvgTagProps<SVGLinearGradientElement>;
|
|
223
|
+
radialGradient: SvgTagProps<SVGRadialGradientElement>;
|
|
224
|
+
gradient: SvgTagProps<SVGGradientElement>;
|
|
225
|
+
metadata: SvgTagProps<SVGMetadataElement>;
|
|
226
|
+
stop: SvgTagProps<SVGStopElement>;
|
|
227
|
+
switch: SvgTagProps<SVGSwitchElement>;
|
|
228
|
+
symbol: SvgTagProps<SVGSymbolElement>;
|
|
229
|
+
textPath: SvgTagProps<SVGTextPathElement>;
|
|
230
|
+
view: SvgTagProps<SVGViewElement>;
|
|
231
|
+
tspan: SvgTagProps<SVGTextContentElement>;
|
|
232
|
+
// No custom element
|
|
233
|
+
feBlend: SvgTagProps;
|
|
234
|
+
feColorMatrix: SvgTagProps;
|
|
235
|
+
feComponentTransfer: SvgTagProps;
|
|
236
|
+
feComposite: SvgTagProps;
|
|
237
|
+
feConvolveMatrix: SvgTagProps;
|
|
238
|
+
feDiffuseLighting: SvgTagProps;
|
|
239
|
+
feDisplacementMap: SvgTagProps;
|
|
240
|
+
feDistantLight: SvgTagProps;
|
|
241
|
+
feDropShadow: SvgTagProps;
|
|
242
|
+
feFlood: SvgTagProps;
|
|
243
|
+
feFuncA: SvgTagProps;
|
|
244
|
+
feFuncB: SvgTagProps;
|
|
245
|
+
feFuncG: SvgTagProps;
|
|
246
|
+
feFuncR: SvgTagProps;
|
|
247
|
+
feGaussianBlur: SvgTagProps;
|
|
248
|
+
feImage: SvgTagProps;
|
|
249
|
+
feMerge: SvgTagProps;
|
|
250
|
+
feMergeNode: SvgTagProps;
|
|
251
|
+
feMorphology: SvgTagProps;
|
|
252
|
+
feOffset: SvgTagProps;
|
|
253
|
+
fePointLight: SvgTagProps;
|
|
254
|
+
feSpecularLighting: SvgTagProps;
|
|
255
|
+
feSpotLight: SvgTagProps;
|
|
256
|
+
feTile: SvgTagProps;
|
|
257
|
+
feTurbulence: SvgTagProps;
|
|
258
|
+
mpath: SvgTagProps;
|
|
144
259
|
}
|
|
145
260
|
}
|
|
146
261
|
}
|
package/dist/mocks.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import type { ReactComponent, UnknownProps } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Currently a no-op that returns the component unchanged. In the future,
|
|
4
|
-
* ref forwarding won't be needed since refs will be passed as regular props
|
|
5
|
-
* to components.
|
|
6
|
-
*/
|
|
7
|
-
export declare const forwardRef: <T extends UnknownProps>(Component: ReactComponent<T>) => ReactComponent<T>;
|
|
8
1
|
/**
|
|
9
2
|
* Mock implementation of React's startTransition. This engine doesn't support
|
|
10
3
|
* concurrent features or update prioritization, so transitions are executed
|
package/dist/mocks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../src/mocks.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../src/mocks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,eAAe,0BAE3B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,0BAErB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,aAEpB,CAAC"}
|
package/dist/mocks.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Currently a no-op that returns the component unchanged. In the future,
|
|
3
|
-
* ref forwarding won't be needed since refs will be passed as regular props
|
|
4
|
-
* to components.
|
|
5
|
-
*/
|
|
6
|
-
export const forwardRef = (Component) => Component;
|
|
7
1
|
/**
|
|
8
2
|
* Mock implementation of React's startTransition. This engine doesn't support
|
|
9
3
|
* concurrent features or update prioritization, so transitions are executed
|
package/dist/mocks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.js","sourceRoot":"","sources":["../src/mocks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mocks.js","sourceRoot":"","sources":["../src/mocks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAc,EAAE,EAAE,CAAC;IACjD,EAAE,EAAE,CAAC;AAAA,CACN,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAc,EAAE,EAAE,CAAC;IAC3C,EAAE,EAAE,CAAC;AAAA,CACN,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC;IAC5B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;AAAA,CAC9C,CAAC"}
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as ns from './types/react';
|
|
2
|
+
import * as local from './types/index';
|
|
3
|
+
import { UnknownProps } from './types/index';
|
|
4
|
+
import type { FRAGMENT_TAG } from './core/reconciliation/fibers';
|
|
5
|
+
import type { Component, ComponentClass } from './core/classComponent';
|
|
6
|
+
|
|
7
|
+
export {};
|
|
8
|
+
|
|
9
|
+
declare global {
|
|
10
|
+
namespace React {
|
|
11
|
+
type FC<Props extends UnknownProps = UnknownProps> = ns.FC<Props>;
|
|
12
|
+
type ComponentType<Props extends UnknownProps = UnknownProps> =
|
|
13
|
+
| local.ReactComponent<Props>
|
|
14
|
+
| ComponentClass<Props, any>;
|
|
15
|
+
type ComponentProps<T> = local.ComponentProps<T>;
|
|
16
|
+
type ForwardRefExoticComponent<Props extends UnknownProps = UnknownProps> =
|
|
17
|
+
ns.ForwardRefExoticComponent<Props>;
|
|
18
|
+
type ErrorInfo = ns.ErrorInfo;
|
|
19
|
+
type ReactNode = ns.ReactNode;
|
|
20
|
+
type Context<T> = ns.Context<T>;
|
|
21
|
+
type CSSProperties = local.TagStyles;
|
|
22
|
+
|
|
23
|
+
// Attributes
|
|
24
|
+
type HTMLAttributes<T extends Element> = ns.HTMLAttributes<T>;
|
|
25
|
+
type TextareaHTMLAttributes<T extends Element> =
|
|
26
|
+
ns.TextareaHTMLAttributes<T>;
|
|
27
|
+
type InputHTMLAttributes<T extends Element> = ns.InputHTMLAttributes<T>;
|
|
28
|
+
type RefAttributes<T extends Element> = ns.RefAttributes<T>;
|
|
29
|
+
|
|
30
|
+
// Events
|
|
31
|
+
type SyntheticEvent<
|
|
32
|
+
T extends Element = Element,
|
|
33
|
+
E extends Event = Event,
|
|
34
|
+
> = ns.SyntheticEvent<T, E>;
|
|
35
|
+
type ClipboardEvent<T = Element> = ns.ClipboardEvent<T>;
|
|
36
|
+
type FormEvent<T extends Element = Element> = ns.FormEvent<T>;
|
|
37
|
+
type ChangeEvent<T extends Element = Element> = ns.ChangeEvent<T>;
|
|
38
|
+
type ChangeEventHandler<T extends Element = Element> =
|
|
39
|
+
ns.ChangeEventHandler<T>;
|
|
40
|
+
type KeyboardEvent<T extends Element = Element> = ns.KeyboardEvent<T>;
|
|
41
|
+
type ReactEventHandler<T extends Element = Element> =
|
|
42
|
+
ns.ReactEventHandler<T>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const React: { Fragment: typeof FRAGMENT_TAG };
|
|
46
|
+
}
|
package/dist/types/actions.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { CommentMode, UnknownProps } from './core';
|
|
2
2
|
import type { TagAttrValue } from './dom';
|
|
3
3
|
import type { FiberMap, FiberNode } from './fiber';
|
|
4
|
-
import type {
|
|
4
|
+
import type { RefObject, RefSetter } from './refs';
|
|
5
5
|
type CommonAction = {
|
|
6
6
|
fiber: FiberNode;
|
|
7
7
|
};
|
|
8
|
-
type CreateTagAction = CommonAction & {
|
|
8
|
+
export type CreateTagAction = CommonAction & {
|
|
9
9
|
type: 'CreateTag';
|
|
10
|
+
attrs: null | Record<string, TagAttrValue>;
|
|
11
|
+
ref: SetRefAction['ref'];
|
|
10
12
|
};
|
|
11
13
|
type CreateTextAction = CommonAction & {
|
|
12
14
|
type: 'CreateText';
|
|
@@ -15,7 +17,10 @@ export type CreateCommentAction = CommonAction & {
|
|
|
15
17
|
type: 'CreateComment';
|
|
16
18
|
mode: CommentMode;
|
|
17
19
|
};
|
|
18
|
-
type
|
|
20
|
+
export type CreateContainer = CommonAction & {
|
|
21
|
+
type: 'CreateContainer';
|
|
22
|
+
};
|
|
23
|
+
type CreateAction = CreateTagAction | CreateTextAction | CreateCommentAction | CreateContainer;
|
|
19
24
|
export type SetTextAction = CommonAction & {
|
|
20
25
|
type: 'SetText';
|
|
21
26
|
text: string;
|
|
@@ -24,10 +29,11 @@ export type SetAttrAction = CommonAction & {
|
|
|
24
29
|
type: 'SetAttr';
|
|
25
30
|
name: string;
|
|
26
31
|
value: TagAttrValue;
|
|
32
|
+
creation?: boolean;
|
|
27
33
|
};
|
|
28
34
|
export type SetRefAction = CommonAction & {
|
|
29
35
|
type: 'SetRef';
|
|
30
|
-
ref:
|
|
36
|
+
ref: RefObject<unknown> | RefSetter<unknown> | null;
|
|
31
37
|
dontUnsetRef?: boolean;
|
|
32
38
|
};
|
|
33
39
|
export type SetPropsAction = CommonAction & {
|
|
@@ -38,6 +44,7 @@ type UpdateAction = SetTextAction | SetAttrAction | SetPropsAction | SetRefActio
|
|
|
38
44
|
export type RemoveAction = CommonAction & {
|
|
39
45
|
type: 'Remove';
|
|
40
46
|
immediate?: boolean;
|
|
47
|
+
last?: boolean;
|
|
41
48
|
};
|
|
42
49
|
export type RelayoutAction = CommonAction & {
|
|
43
50
|
type: 'Relayout';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/types/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,KAAK,EAAE,
|
|
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EAAE,OAAO,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG;IACxC,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IAEpD,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AACF,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG;IAC1C,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,YAAY,CAAC;CACrB,CAAC;AACF,KAAK,YAAY,GACb,aAAa,GACb,aAAa,GACb,cAAc,GACd,YAAY,CAAC;AAGjB,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG;IACxC,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AACF,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG;IAC1C,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,QAAQ,CAAC;IACjB,KAAK,EAAE,QAAQ,CAAC;CACjB,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG;IACzC,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AACF,KAAK,YAAY,GAAG,YAAY,GAAG,cAAc,GAAG,aAAa,CAAC;AAElE,MAAM,MAAM,MAAM,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC"}
|
package/dist/types/app.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { FiberNode } from './fiber';
|
|
1
|
+
import type { FiberNode, JsxSource } from './fiber';
|
|
2
2
|
import type { EffectMode } from './hooks';
|
|
3
|
+
import type { Queue } from '../core/reconciliation/queue';
|
|
3
4
|
export type AppState =
|
|
4
5
|
/** Waiting for updates */
|
|
5
6
|
'idle'
|
|
@@ -54,9 +55,12 @@ export type App = {
|
|
|
54
55
|
/** The lists of pending effect handlers. */
|
|
55
56
|
effects: Record<EffectMode, Array<() => void>>;
|
|
56
57
|
/** The list of components to rerender. */
|
|
57
|
-
invalidatedComponents:
|
|
58
|
+
invalidatedComponents: Queue;
|
|
58
59
|
/** If `true`, extra validators are applied. */
|
|
59
60
|
testMode: boolean;
|
|
61
|
+
/** If given used to adjust JSX source to something else before adding them to
|
|
62
|
+
* a ReactError instance. */
|
|
63
|
+
transformSource?: (source: JsxSource) => JsxSource;
|
|
60
64
|
/**
|
|
61
65
|
* A special storage that contains invalidated context values. We need it to
|
|
62
66
|
* keep the "render" phase pure (so we don't update the existing fibers) and
|
|
@@ -71,6 +75,12 @@ export type AppOptions = {
|
|
|
71
75
|
* Warning: It slows down the app.
|
|
72
76
|
**/
|
|
73
77
|
testMode?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Provide a converter that accounts for nuances of your development
|
|
80
|
+
* build. The purpose of this converter is to convert the file path from
|
|
81
|
+
* JSX into something that browser dev tools can properly handle.
|
|
82
|
+
*/
|
|
83
|
+
transformSource?: (source: JsxSource) => JsxSource;
|
|
74
84
|
};
|
|
75
85
|
export type AppRoot = {
|
|
76
86
|
render: (element: JSX.Element) => void;
|
package/dist/types/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/types/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/types/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAEpE,MAAM,MAAM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