@faiwer/react 0.8.3 → 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 -14
- 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/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 +107 -5
- 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 +4 -0
- package/dist/core/actions/dom/attributes.d.ts.map +1 -0
- package/dist/core/actions/dom/attributes.js +56 -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 +54 -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 +45 -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/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 +18 -11
- package/dist/core/actions/helpers.d.ts.map +1 -1
- package/dist/core/actions/helpers.js +78 -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 +3 -2
- package/dist/core/actions/remove.action.d.ts.map +1 -1
- package/dist/core/actions/remove.action.js +22 -18
- 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 +36 -11
- 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 +55 -87
- package/dist/core/actions/setAttr.action.js.map +1 -1
- package/dist/core/actions/setProps.action.d.ts.map +1 -1
- package/dist/core/actions/setProps.action.js +2 -1
- package/dist/core/actions/setProps.action.js.map +1 -1
- package/dist/core/actions/setRef.action.d.ts +1 -1
- package/dist/core/actions/setRef.action.d.ts.map +1 -1
- package/dist/core/actions/setRef.action.js +5 -6
- package/dist/core/actions/setRef.action.js.map +1 -1
- package/dist/core/actions/setText.action.d.ts.map +1 -1
- package/dist/core/actions/setText.action.js +3 -3
- package/dist/core/actions/setText.action.js.map +1 -1
- package/dist/core/classComponent.d.ts +33 -0
- package/dist/core/classComponent.d.ts.map +1 -0
- package/dist/core/classComponent.js +127 -0
- package/dist/core/classComponent.js.map +1 -0
- 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 +22 -5
- package/dist/core/components.js.map +1 -1
- package/dist/core/createElement.d.ts +9 -9
- package/dist/core/createElement.d.ts.map +1 -1
- package/dist/core/createElement.js +19 -3
- package/dist/core/createElement.js.map +1 -1
- package/dist/core/createRoot.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 +24 -15
- 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 +6 -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/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/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 +9 -0
- package/dist/core/reconciliation/errors/stack.d.ts.map +1 -0
- package/dist/core/reconciliation/errors/stack.js +80 -0
- package/dist/core/reconciliation/errors/stack.js.map +1 -0
- package/dist/core/reconciliation/fibers.d.ts +7 -0
- package/dist/core/reconciliation/fibers.d.ts.map +1 -1
- package/dist/core/reconciliation/fibers.js +9 -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 +10 -4
- 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 +17 -7
- 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 +19 -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 +5 -5
- 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 +9 -1
- package/dist/core/reconciliation/typeGuards.d.ts.map +1 -1
- package/dist/core/reconciliation/typeGuards.js +25 -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/validateApp.js +74 -0
- package/dist/core/reconciliation/validateApp.js.map +1 -0
- 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 +16 -0
- 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 +24 -1
- package/dist/hooks/useState.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -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/dist/jsx.d.ts +176 -36
- package/dist/mocks.d.ts +21 -0
- package/dist/mocks.d.ts.map +1 -0
- package/dist/mocks.js +27 -0
- package/dist/mocks.js.map +1 -0
- package/dist/react.d.ts +46 -0
- package/dist/types/actions.d.ts +12 -4
- package/dist/types/actions.d.ts.map +1 -1
- package/dist/types/app.d.ts +17 -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 +13 -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 +5 -1
- 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 -27
- package/dist/types/dom.d.ts.map +1 -1
- package/dist/types/events.d.ts +31 -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 +31 -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 +8 -5
- 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 +15 -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 +0 -48
- package/dist/core/reconciliation/validateTree.js.map +0 -1
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
|
@@ -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.
|
|
@@ -16,13 +17,35 @@ export const useState = (
|
|
|
16
17
|
/** The initial state value or a function that returns the initial state. If a
|
|
17
18
|
* function is provided, it will only be called once during initialization. */
|
|
18
19
|
initValue) => {
|
|
19
|
-
const item = getNextHookOrCreate('state', (
|
|
20
|
+
const item = getNextHookOrCreate('state', (initFiber) => {
|
|
21
|
+
let fiber = initFiber;
|
|
22
|
+
const app = getAppByFiber(fiber);
|
|
20
23
|
const item = {
|
|
21
24
|
type: 'state',
|
|
22
25
|
state: (typeof initValue === 'function'
|
|
23
26
|
? initValue()
|
|
24
27
|
: initValue),
|
|
28
|
+
move: (newFiber) => {
|
|
29
|
+
fiber = newFiber;
|
|
30
|
+
},
|
|
31
|
+
destructor: () => {
|
|
32
|
+
// Help GC.
|
|
33
|
+
item.state = null;
|
|
34
|
+
fiber = null;
|
|
35
|
+
},
|
|
25
36
|
setter: function setState(valueOrFn) {
|
|
37
|
+
if (!fiber) {
|
|
38
|
+
// When a component is removed, we clean up all of its children and
|
|
39
|
+
// their refs. This setState function may be used as a ref handler.
|
|
40
|
+
// The ref handler gets scheduled before the parent node is removed,
|
|
41
|
+
// but executes after removal. In this case, we should skip the
|
|
42
|
+
// warning since it's expected behavior.
|
|
43
|
+
if (app.state !== 'refEffects') {
|
|
44
|
+
console.warn(`Component has been removed. State cannot be updated`);
|
|
45
|
+
// TODO: add a test ^.
|
|
46
|
+
}
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
26
49
|
const v = (typeof valueOrFn === 'function'
|
|
27
50
|
? valueOrFn(item.state)
|
|
28
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;
|
|
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,SAAsC,EACjB,EAAE,CAAC;IACxB,MAAM,IAAI,GAAG,mBAAmB,CAAC,OAAO,EAAE,CAAC,SAAS,EAAgB,EAAE,CAAC;QACrE,IAAI,KAAK,GAAqB,SAAS,CAAC;QACxC,MAAM,GAAG,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QACjC,MAAM,IAAI,GAAoB;YAC5B,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,CAAC,OAAO,SAAS,KAAK,UAAU;gBACrC,CAAC,CAAE,SAAqB,EAAE;gBAC1B,CAAC,CAAC,SAAS,CAAM;YACnB,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;gBAClB,KAAK,GAAG,QAAQ,CAAC;YAAA,CAClB;YACD,UAAU,EAAE,GAAG,EAAE,CAAC;gBAChB,WAAW;gBACX,IAAI,CAAC,KAAK,GAAG,IAAS,CAAC;gBACvB,KAAK,GAAG,IAAI,CAAC;YAAA,CACd;YACD,MAAM,EAAE,SAAS,QAAQ,CAAC,SAAS,EAAE;gBACnC,IAAI,CAAC,KAAK,EAAE,CAAC;oBACX,mEAAmE;oBACnE,mEAAmE;oBACnE,oEAAoE;oBACpE,+DAA+D;oBAC/D,wCAAwC;oBACxC,IAAI,GAAG,CAAC,KAAK,KAAK,YAAY,EAAE,CAAC;wBAC/B,OAAO,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;wBACpE,sBAAsB;oBACxB,CAAC;oBACD,OAAO;gBACT,CAAC;gBAED,MAAM,CAAC,GAAG,CACR,OAAO,SAAS,KAAK,UAAU;oBAC7B,CAAC,CAAE,SAA4B,CAAC,IAAI,CAAC,KAAK,CAAC;oBAC3C,CAAC,CAAC,SAAS,CACT,CAAC;gBAEP,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC;oBAAE,OAAO;gBAC7B,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;gBACf,eAAe,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
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
/// <reference path="./jsx.d.ts" />
|
|
2
|
+
/// <reference path="./react.d.ts" />
|
|
1
3
|
export * from './types';
|
|
4
|
+
export * from './types/react';
|
|
2
5
|
export * from './hooks/index';
|
|
3
6
|
export * from './core/createRoot';
|
|
4
7
|
export * from './core/createElement';
|
|
5
|
-
export
|
|
8
|
+
export { Component, Component as PureComponent } from './core/classComponent';
|
|
9
|
+
export * from './mocks';
|
|
10
|
+
export { isValidElement } from './core/reconciliation/typeGuards';
|
|
11
|
+
export { Children } from './core/Children';
|
|
12
|
+
export declare function memo<T>(Comp: T, isEq?: unknown): T;
|
|
6
13
|
/** <Fragment/> */
|
|
7
14
|
export { FRAGMENT_TAG as Fragment } from './core/reconciliation/fibers';
|
|
8
15
|
//# 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,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
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
export * from './types';
|
|
2
|
+
export * from './types/react';
|
|
2
3
|
export * from './hooks/index';
|
|
3
4
|
export * from './core/createRoot';
|
|
4
5
|
export * from './core/createElement';
|
|
6
|
+
export { Component, Component as PureComponent } from './core/classComponent';
|
|
7
|
+
export * from './mocks';
|
|
8
|
+
export { isValidElement } from './core/reconciliation/typeGuards';
|
|
9
|
+
export { Children } from './core/Children';
|
|
5
10
|
export function memo(Comp, isEq) {
|
|
6
11
|
if (isEq) {
|
|
7
12
|
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,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/dist/jsx.d.ts
CHANGED
|
@@ -1,18 +1,64 @@
|
|
|
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 ReactKey,
|
|
8
|
+
type ElementType as ET,
|
|
9
|
+
type FiberNode,
|
|
6
10
|
} from './types';
|
|
7
11
|
|
|
8
12
|
export {};
|
|
9
13
|
|
|
10
14
|
declare global {
|
|
15
|
+
interface Element {
|
|
16
|
+
__fiber?: FiberNode;
|
|
17
|
+
}
|
|
18
|
+
interface Text {
|
|
19
|
+
__fiber?: FiberNode;
|
|
20
|
+
}
|
|
21
|
+
interface Comment {
|
|
22
|
+
__fiber?: FiberNode;
|
|
23
|
+
}
|
|
24
|
+
|
|
11
25
|
namespace JSX {
|
|
12
26
|
type Element = JsxElement;
|
|
27
|
+
type ElementType = ET;
|
|
28
|
+
|
|
29
|
+
interface ElementClass extends Component<any, any> {
|
|
30
|
+
render: () => JSX.Element;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface IntrinsicAttributes {
|
|
34
|
+
key?: ReactKey | null;
|
|
35
|
+
}
|
|
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
|
+
|
|
49
|
+
type LibraryManagedAttributes<Component, Props> = Component extends {
|
|
50
|
+
defaultProps: infer Defaults;
|
|
51
|
+
}
|
|
52
|
+
? Defaults extends Partial<Props>
|
|
53
|
+
? Partial<Pick<Props, keyof Defaults & keyof Props>> &
|
|
54
|
+
Pick<Props, Exclude<keyof Props, keyof Defaults>>
|
|
55
|
+
: Props
|
|
56
|
+
: Props;
|
|
13
57
|
|
|
14
58
|
interface IntrinsicElements {
|
|
15
|
-
|
|
59
|
+
['x-fragment']: IntrinsicAttributes & { children: JSX.Element };
|
|
60
|
+
|
|
61
|
+
// HTML Elements
|
|
16
62
|
html: TagProps<HTMLHtmlElement>;
|
|
17
63
|
head: TagProps<HTMLHeadElement>;
|
|
18
64
|
body: TagProps<HTMLBodyElement>;
|
|
@@ -21,16 +67,13 @@ declare global {
|
|
|
21
67
|
link: TagProps<HTMLLinkElement>;
|
|
22
68
|
script: TagProps<HTMLScriptElement>;
|
|
23
69
|
style: TagProps<HTMLStyleElement>;
|
|
24
|
-
|
|
25
|
-
// Content sectioning
|
|
70
|
+
article: TagProps<HTMLElement>;
|
|
26
71
|
h1: TagProps<HTMLHeadingElement>;
|
|
27
72
|
h2: TagProps<HTMLHeadingElement>;
|
|
28
73
|
h3: TagProps<HTMLHeadingElement>;
|
|
29
74
|
h4: TagProps<HTMLHeadingElement>;
|
|
30
75
|
h5: TagProps<HTMLHeadingElement>;
|
|
31
76
|
h6: TagProps<HTMLHeadingElement>;
|
|
32
|
-
|
|
33
|
-
// Text content
|
|
34
77
|
div: TagProps<HTMLDivElement>;
|
|
35
78
|
p: TagProps<HTMLParagraphElement>;
|
|
36
79
|
span: TagProps<HTMLSpanElement>;
|
|
@@ -40,29 +83,26 @@ declare global {
|
|
|
40
83
|
ol: TagProps<HTMLOListElement>;
|
|
41
84
|
li: TagProps<HTMLLIElement>;
|
|
42
85
|
dl: TagProps<HTMLDListElement>;
|
|
86
|
+
dt: TagProps<HTMLElement>;
|
|
87
|
+
dd: TagProps<HTMLElement>;
|
|
43
88
|
hr: TagProps<HTMLHRElement>;
|
|
44
89
|
br: TagProps<HTMLBRElement>;
|
|
45
|
-
|
|
46
|
-
|
|
90
|
+
em: TagProps<HTMLElement>;
|
|
91
|
+
i: TagProps<HTMLElement>;
|
|
92
|
+
b: TagProps<HTMLElement>;
|
|
47
93
|
a: TagProps<HTMLAnchorElement>;
|
|
48
94
|
q: TagProps<HTMLQuoteElement>;
|
|
49
95
|
time: TagProps<HTMLTimeElement>;
|
|
50
|
-
|
|
51
|
-
// Image and multimedia
|
|
52
96
|
img: TagProps<HTMLImageElement>;
|
|
53
97
|
video: TagProps<HTMLVideoElement>;
|
|
54
98
|
audio: TagProps<HTMLAudioElement>;
|
|
55
99
|
source: TagProps<HTMLSourceElement>;
|
|
56
100
|
track: TagProps<HTMLTrackElement>;
|
|
57
101
|
canvas: TagProps<HTMLCanvasElement>;
|
|
58
|
-
|
|
59
|
-
// Embedded content
|
|
60
102
|
iframe: TagProps<HTMLIFrameElement>;
|
|
61
103
|
embed: TagProps<HTMLEmbedElement>;
|
|
62
104
|
object: TagProps<HTMLObjectElement>;
|
|
63
105
|
param: TagProps<HTMLParamElement>;
|
|
64
|
-
|
|
65
|
-
// Forms
|
|
66
106
|
form: TagProps<HTMLFormElement>;
|
|
67
107
|
input: TagProps<HTMLInputElement>;
|
|
68
108
|
button: TagProps<HTMLButtonElement>;
|
|
@@ -77,13 +117,9 @@ declare global {
|
|
|
77
117
|
output: TagProps<HTMLOutputElement>;
|
|
78
118
|
progress: TagProps<HTMLProgressElement>;
|
|
79
119
|
meter: TagProps<HTMLMeterElement>;
|
|
80
|
-
|
|
81
|
-
// Interactive elements
|
|
82
120
|
details: TagProps<HTMLDetailsElement>;
|
|
83
121
|
summary: TagProps<HTMLElement>;
|
|
84
122
|
dialog: TagProps<HTMLDialogElement>;
|
|
85
|
-
|
|
86
|
-
// Tables
|
|
87
123
|
table: TagProps<HTMLTableElement>;
|
|
88
124
|
thead: TagProps<HTMLTableSectionElement>;
|
|
89
125
|
tbody: TagProps<HTMLTableSectionElement>;
|
|
@@ -94,28 +130,132 @@ declare global {
|
|
|
94
130
|
caption: TagProps<HTMLTableCaptionElement>;
|
|
95
131
|
colgroup: TagProps<HTMLTableColElement>;
|
|
96
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>;
|
|
97
196
|
|
|
98
197
|
// SVG elements
|
|
99
198
|
svg: SvgRootProps;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
text: SvgTagProps
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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;
|
|
119
259
|
}
|
|
120
260
|
}
|
|
121
261
|
}
|
package/dist/mocks.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mock implementation of React's startTransition. This engine doesn't support
|
|
3
|
+
* concurrent features or update prioritization, so transitions are executed
|
|
4
|
+
* immediately without deferring.
|
|
5
|
+
*/
|
|
6
|
+
export declare const startTransition: (fn: () => void) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Mock implementation of React's flushSync. Unlike React, this engine's
|
|
9
|
+
* scheduler renders in the next JS tick, so this is a simplified version
|
|
10
|
+
* that executes the callback but doesn't force synchronous rendering.
|
|
11
|
+
*
|
|
12
|
+
* Note: True flushSync behavior would require bypassing the scheduler
|
|
13
|
+
* and rendering immediately, which is not currently implemented.
|
|
14
|
+
*/
|
|
15
|
+
export declare const flushSync: (fn: () => void) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Suspense is not supported and likely never will be, as it requires complex
|
|
18
|
+
* async rendering capabilities. Throws an error when used.
|
|
19
|
+
*/
|
|
20
|
+
export declare const Suspense: () => never;
|
|
21
|
+
//# sourceMappingURL=mocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mock implementation of React's startTransition. This engine doesn't support
|
|
3
|
+
* concurrent features or update prioritization, so transitions are executed
|
|
4
|
+
* immediately without deferring.
|
|
5
|
+
*/
|
|
6
|
+
export const startTransition = (fn) => {
|
|
7
|
+
fn();
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Mock implementation of React's flushSync. Unlike React, this engine's
|
|
11
|
+
* scheduler renders in the next JS tick, so this is a simplified version
|
|
12
|
+
* that executes the callback but doesn't force synchronous rendering.
|
|
13
|
+
*
|
|
14
|
+
* Note: True flushSync behavior would require bypassing the scheduler
|
|
15
|
+
* and rendering immediately, which is not currently implemented.
|
|
16
|
+
*/
|
|
17
|
+
export const flushSync = (fn) => {
|
|
18
|
+
fn();
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Suspense is not supported and likely never will be, as it requires complex
|
|
22
|
+
* async rendering capabilities. Throws an error when used.
|
|
23
|
+
*/
|
|
24
|
+
export const Suspense = () => {
|
|
25
|
+
throw new Error(`Suspense is not supported`);
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=mocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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
|
+
}
|