@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/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 & {
|
|
@@ -37,6 +43,8 @@ export type SetPropsAction = CommonAction & {
|
|
|
37
43
|
type UpdateAction = SetTextAction | SetAttrAction | SetPropsAction | SetRefAction;
|
|
38
44
|
export type RemoveAction = CommonAction & {
|
|
39
45
|
type: 'Remove';
|
|
46
|
+
immediate?: boolean;
|
|
47
|
+
last?: boolean;
|
|
40
48
|
};
|
|
41
49
|
export type RelayoutAction = CommonAction & {
|
|
42
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,
|
|
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,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnD,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC;AAGF,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG;IAC3C,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC3C,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;CAC1B,CAAC;AACF,KAAK,gBAAgB,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC;AAC9D,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG;IAC/C,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AM,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'
|
|
@@ -23,6 +24,11 @@ export type AppState =
|
|
|
23
24
|
* tree. Some of the actions may schedule extra effects.
|
|
24
25
|
*/
|
|
25
26
|
| 'commit'
|
|
27
|
+
/**
|
|
28
|
+
* The same as `refEffects`, but is executed one step earlier. It contains
|
|
29
|
+
* calls to ref handlers.
|
|
30
|
+
*/
|
|
31
|
+
| 'refEffects'
|
|
26
32
|
/**
|
|
27
33
|
* Runs scheduled normal effects. It's guaranteed that the browser didn't
|
|
28
34
|
* update the UI since the render started. Effect handlers may update
|
|
@@ -49,9 +55,12 @@ export type App = {
|
|
|
49
55
|
/** The lists of pending effect handlers. */
|
|
50
56
|
effects: Record<EffectMode, Array<() => void>>;
|
|
51
57
|
/** The list of components to rerender. */
|
|
52
|
-
invalidatedComponents:
|
|
58
|
+
invalidatedComponents: Queue;
|
|
53
59
|
/** If `true`, extra validators are applied. */
|
|
54
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;
|
|
55
64
|
/**
|
|
56
65
|
* A special storage that contains invalidated context values. We need it to
|
|
57
66
|
* keep the "render" phase pure (so we don't update the existing fibers) and
|
|
@@ -66,6 +75,12 @@ export type AppOptions = {
|
|
|
66
75
|
* Warning: It slows down the app.
|
|
67
76
|
**/
|
|
68
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;
|
|
69
84
|
};
|
|
70
85
|
export type AppRoot = {
|
|
71
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,QAAQ;AAClB,0BAA0B;AACxB,MAAM;AACR;;;IAGI;GACF,WAAW;AACb;;;;;;;;GAQG;GACD,QAAQ;AACV;;;GAGG;GACD,QAAQ;AACV;;;GAGG;GACD,YAAY;AACd;;;;;GAKG;GACD,eAAe;AACjB;;;GAGG;GACD,SAAS;AACX;;GAEG;GACD,QAAQ,CAAC;AAEb,MAAM,MAAM,GAAG,GAAG;IAChB,yBAAyB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,iDAAiD;IACjD,IAAI,EAAE,SAAS,CAAC;IAChB,oDAAoD;IACpD,KAAK,EAAE,QAAQ,CAAC;IAChB,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;IAC/C,0CAA0C;IAC1C,qBAAqB,EAAE,KAAK,CAAC;IAC7B,+CAA+C;IAC/C,QAAQ,EAAE,OAAO,CAAC;IAClB;gCAC4B;IAC5B,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,SAAS,CAAC;IACnD;;;;;OAKG;IACH,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB;;;QAGI;IACJ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,SAAS,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,KAAK,IAAI,CAAC;IACvC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { RemapKeys, RemoveIndexSignature } from './common';
|
|
2
|
+
import type { TagEventHandlers } from './events';
|
|
3
|
+
type ToCamel = {
|
|
4
|
+
autofocus: 'autoFocus';
|
|
5
|
+
autoplay: 'autoPlay';
|
|
6
|
+
autocomplete: 'autoComplete';
|
|
7
|
+
readonly: 'readOnly';
|
|
8
|
+
maxlength: 'maxLength';
|
|
9
|
+
minlength: 'minLength';
|
|
10
|
+
contenteditable: 'contentEditable';
|
|
11
|
+
spellcheck: 'spellCheck';
|
|
12
|
+
crossorigin: 'crossOrigin';
|
|
13
|
+
colspan: 'colSpan';
|
|
14
|
+
rowspan: 'rowSpan';
|
|
15
|
+
tabindex: 'tabIndex';
|
|
16
|
+
formaction: 'formAction';
|
|
17
|
+
formenctype: 'formEncType';
|
|
18
|
+
formmethod: 'formMethod';
|
|
19
|
+
formnovalidate: 'formNoValidate';
|
|
20
|
+
formtarget: 'formTarget';
|
|
21
|
+
inputmode: 'inputMode';
|
|
22
|
+
novalidate: 'noValidate';
|
|
23
|
+
fetchpriority: 'fetchPriority';
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Each HTMLElement contains a ton of properties. Most of them shouldn't be used
|
|
27
|
+
* in JSX tag nodes. This type matches most inapplicable generic properties.
|
|
28
|
+
*/
|
|
29
|
+
type GeneralRemove = `DOCUMENT_${string}` | `${string}_NODE` | `client${string}` | `offset${string}` | `node${string}` | `inner${string}` | `scroll${string}` | `set${string}` | `outer${string}` | 'children' | 'attributes' | 'childNodes' | 'classList' | 'tagName' | 'style' | `key` | `dataset` | 'textContent' | 'shadowRoot';
|
|
30
|
+
type RemapAttrs<T> = RemapKeys<T, ToCamel>;
|
|
31
|
+
/**
|
|
32
|
+
* Returns a list of tag-based properties that can probably be set via a JSX tag
|
|
33
|
+
* node.
|
|
34
|
+
**/
|
|
35
|
+
type PropertiesOnly<T extends Element> = {
|
|
36
|
+
[K in keyof RemoveIndexSignature<T>]: K extends `on${string}` ? never : ChildNode extends T[K] ? never : Element extends T[K] ? never : HTMLElement extends T[K] ? never : K;
|
|
37
|
+
}[keyof RemoveIndexSignature<T>];
|
|
38
|
+
export type TagNativeProps<T extends Element> = {
|
|
39
|
+
className?: string;
|
|
40
|
+
} & RemapAttrs<Partial<Omit<Pick<T, PropertiesOnly<T>>, GeneralRemove>>> & TagEventHandlers<T>;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=attributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/types/attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,KAAK,OAAO,GAAG;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KAAK,GACL,SAAS,SAAS,CAAC,CAAC,CAAC,CAAC,GACpB,KAAK,GACL,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,GAClB,KAAK,GACL,WAAW,SAAS,CAAC,CAAC,CAAC,CAAC,GACtB,KAAK,GACL,CAAC;CACZ,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;AAGjC,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,OAAO,IACxC;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACtB,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,GACpE,gBAAgB,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributes.js","sourceRoot":"","sources":["../../src/types/attributes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type RemoveIndexSignature<T> = {
|
|
2
|
+
[K in keyof T as string extends K ? never : number extends K ? never : typeof Symbol.iterator extends K ? never : K]: T[K];
|
|
3
|
+
};
|
|
4
|
+
export type RemapKeys<T, KeyMap extends Record<keyof any, keyof any>> = {
|
|
5
|
+
[K in keyof T as K extends keyof KeyMap ? KeyMap[K] : K]?: T[K];
|
|
6
|
+
};
|
|
7
|
+
export type Ensure<T, K extends keyof T> = Exclude<T, K> & {
|
|
8
|
+
[Key in K]: NonNullable<T[K]>;
|
|
9
|
+
};
|
|
10
|
+
export type ReplaceIn<T, M> = {
|
|
11
|
+
[K in keyof T]: K extends keyof M ? M[K] : T[K];
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI;KACnC,CAAC,IAAI,MAAM,CAAC,IAAI,MAAM,SAAS,CAAC,GAC7B,KAAK,GACL,MAAM,SAAS,CAAC,GACd,KAAK,GACL,OAAO,MAAM,CAAC,QAAQ,SAAS,CAAC,GAC9B,KAAK,GACL,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,GAAG,EAAE,MAAM,GAAG,CAAC,IAAI;KACrE,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IACnC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,GACb;KAAG,GAAG,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAEtC,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI;KAC3B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAChD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":""}
|
|
@@ -3,9 +3,13 @@ import type { HookStore } from './hooks';
|
|
|
3
3
|
export type ComponentState = {
|
|
4
4
|
hooks: HookStore | null;
|
|
5
5
|
};
|
|
6
|
-
export type ReactComponent<TProps extends UnknownProps = UnknownProps> =
|
|
6
|
+
export type ReactComponent<TProps extends UnknownProps = UnknownProps> = {
|
|
7
|
+
(props: TProps & ElementCommonAttrs): JSX.Element;
|
|
8
|
+
displayName?: string;
|
|
9
|
+
};
|
|
7
10
|
export type PropsWithChildren<TProps extends UnknownProps = UnknownProps> = TProps & {
|
|
8
11
|
children?: JSX.Element;
|
|
9
12
|
};
|
|
10
13
|
export type ReactComponentWithChildren<TProps extends UnknownProps = UnknownProps> = ReactComponent<PropsWithChildren<TProps>>;
|
|
14
|
+
export type ComponentProps<T> = T extends (props: infer Props) => JSX.Element ? Props : never;
|
|
11
15
|
//# sourceMappingURL=component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/types/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,SAAS,GAAG,IAAI,CAA4B;CACpD,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,MAAM,SAAS,YAAY,GAAG,YAAY,IAAI,
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/types/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,SAAS,GAAG,IAAI,CAA4B;CACpD,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,MAAM,SAAS,YAAY,GAAG,YAAY,IAAI;IACvE,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAAC;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,MAAM,SAAS,YAAY,GAAG,YAAY,IACtE,MAAM,GAAG;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CAAE,CAAC;AAEtC,MAAM,MAAM,0BAA0B,CACpC,MAAM,SAAS,YAAY,GAAG,YAAY,IACxC,cAAc,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAE9C,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,KAAK,KAAK,GAAG,CAAC,OAAO,GACzE,KAAK,GACL,KAAK,CAAC"}
|
package/dist/types/context.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactComponent } from './component';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentFiberNode } from './fiber';
|
|
3
3
|
export type ReactContextProvider<T = unknown> = ReactComponent<{
|
|
4
4
|
children: JSX.Element;
|
|
5
5
|
value: T;
|
|
@@ -19,10 +19,11 @@ export type ReactContext<T = unknown> = {
|
|
|
19
19
|
*/
|
|
20
20
|
__id: number;
|
|
21
21
|
__default: T;
|
|
22
|
+
displayName?: string;
|
|
22
23
|
};
|
|
23
24
|
/** `.data` of the `ContextFiberNode` */
|
|
24
25
|
export type ContextState<T = unknown> = {
|
|
25
26
|
ctx: ReactContext<T>;
|
|
26
|
-
consumers: Set<
|
|
27
|
+
consumers: Set<ComponentFiberNode>;
|
|
27
28
|
};
|
|
28
29
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/types/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/types/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,MAAM,oBAAoB,CAAC,CAAC,GAAG,OAAO,IAIxC,cAAc,CAAC;IAAE,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC,GACnD;IAAE,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC;AAE/B,MAAM,MAAM,oBAAoB,CAAC,CAAC,GAAG,OAAO,IAAI,cAAc,CAAC;IAC7D,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC;CACrC,CAAC,CAAC;AAEH,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,OAAO,IAAI;IACtC,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAClC,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAClC;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,CAAC,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wCAAwC;AACxC,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,OAAO,IAAI;IACtC,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IACrB,SAAS,EAAE,GAAG,CAAC,kBAAkB,CAAC,CAAC;CACpC,CAAC"}
|
package/dist/types/core.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Component } from '../core/classComponent';
|
|
2
2
|
import type { ReactContextProvider } from './context';
|
|
3
|
+
import type { JsxSource } from './fiber';
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* recreate the given node by purpose.
|
|
5
|
+
* Unique identifier for a node, used by the reconciliation algorithm to
|
|
6
|
+
* distinguish nodes. Changing the key will force React to recreate the node.
|
|
7
7
|
*/
|
|
8
8
|
export type ReactKey = string | number;
|
|
9
9
|
/**
|
|
@@ -12,13 +12,17 @@ export type ReactKey = string | number;
|
|
|
12
12
|
*/
|
|
13
13
|
export type UnknownProps = Record<PropertyKey, unknown> & ElementCommonAttrs;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* All possible types that can be used as the first argument to `createElement`:
|
|
16
|
+
* - tag names
|
|
17
|
+
* - function components
|
|
18
|
+
* - class components
|
|
19
|
+
* - fragments
|
|
20
|
+
* - or context providers.
|
|
18
21
|
*/
|
|
19
|
-
export type ElementType = string |
|
|
22
|
+
export type ElementType = string | ((props: any) => JsxElement) | (new (props: any) => Component<any, any>);
|
|
20
23
|
/**
|
|
21
|
-
*
|
|
24
|
+
* Primitive values in JSX that are not passed to `createElement` and are
|
|
25
|
+
* rendered as-is.
|
|
22
26
|
*/
|
|
23
27
|
export type ScalarNode = string | number | boolean | null | undefined;
|
|
24
28
|
/**
|
|
@@ -30,6 +34,7 @@ export type ElementNode = {
|
|
|
30
34
|
props: UnknownProps;
|
|
31
35
|
key: ReactKey | null | undefined;
|
|
32
36
|
children: JsxElement[];
|
|
37
|
+
source: null | JsxSource;
|
|
33
38
|
};
|
|
34
39
|
/**
|
|
35
40
|
* Common props for <tag/>s and <Component/>s.
|
|
@@ -38,14 +43,13 @@ export type ElementCommonAttrs = {
|
|
|
38
43
|
key?: ReactKey | null;
|
|
39
44
|
};
|
|
40
45
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* type-issues, so I didn't repeat the same.
|
|
46
|
+
* Implementation of `JSX.Element` for this React version. Unlike React's
|
|
47
|
+
* `ReactNode`, this type avoids type issues.
|
|
44
48
|
*/
|
|
45
49
|
export type JsxElement = ElementNode | ScalarNode | JsxElement[];
|
|
46
50
|
/**
|
|
47
51
|
* Available !--comment types.
|
|
48
52
|
* E.g. <!--r:null:14-->
|
|
49
53
|
*/
|
|
50
|
-
export type CommentMode = 'null' | '
|
|
54
|
+
export type CommentMode = 'null' | 'portal' | 'empty';
|
|
51
55
|
//# sourceMappingURL=core.d.ts.map
|
package/dist/types/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/types/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/types/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvC;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,GAAG,kBAAkB,CAAC;AAE7E;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAEnB,MAAM,GAEN,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK,UAAU,CAAC,GAE5B,CAAC,KAAK,KAAK,EAAE,GAAG,KAAK,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAE9C;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAEtE;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,WAAW,GAAG,oBAAoB,GAAG,WAAW,CAAC;IACvD,KAAK,EAAE,YAAY,CAAC;IACpB,GAAG,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC;IACjC,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,MAAM,EAAE,IAAI,GAAG,SAAS,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAAE,GAAG,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAA;CAAE,CAAC;AAE3D;;;GAGG;AACH,MAAM,MAAM,UAAU,GAElB,WAAW,GAEX,UAAU,GAEV,UAAU,EAAE,CAAC;AAEjB;;;GAGG;AACH,MAAM,MAAM,WAAW,GAEnB,MAAM,GAEN,QAAQ,GAER,OAAO,CAAC"}
|
package/dist/types/dom.d.ts
CHANGED
|
@@ -1,39 +1,35 @@
|
|
|
1
|
+
import type { TagNativeProps } from './attributes';
|
|
2
|
+
import type { ReplaceIn } from './common';
|
|
1
3
|
import type { ElementCommonAttrs, ScalarNode } from './core';
|
|
2
|
-
import type {
|
|
4
|
+
import type { Ref } from './refs';
|
|
3
5
|
/** The list of possible DOM tree node types. */
|
|
4
6
|
export type DomNode = Element | Text | Comment;
|
|
5
7
|
export type TagAttrValue = string | number | boolean | null | undefined | Function | TagStyles;
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
type
|
|
19
|
-
|
|
20
|
-
}[keyof T];
|
|
21
|
-
type TagNativeProps<T extends HTMLElement> = Partial<Omit<Pick<T, PropertiesOnly<T>>, GeneralRemove>> & {
|
|
22
|
-
[K in EventKeys<T>]?: DomEventHandlerX<K>;
|
|
23
|
-
};
|
|
24
|
-
type EventHandler<E extends Event> = (event: E) => boolean | void;
|
|
25
|
-
type DomEventHandlerX<E extends string> = E extends `ondrag${string}` ? EventHandler<DragEvent> : E extends `onmouse${string}` ? EventHandler<MouseEvent> : E extends `onkey${string}` ? EventHandler<KeyboardEvent> : E extends `onfocus` | `onblur` ? EventHandler<FocusEvent> : E extends `onwheel` ? EventHandler<WheelEvent> : E extends `onpointer${string}` ? EventHandler<PointerEvent> : E extends `ontouch${string}` ? EventHandler<TouchEvent> : E extends `onanimation${string}` ? EventHandler<AnimationEvent> : E extends `ontransition${string}` ? EventHandler<TransitionEvent> : E extends `onload` | `onerror` | `onabort` ? EventHandler<ProgressEvent> : E extends `oninput` | `onchange` | `onsubmit` | `onreset` ? EventHandler<Event> : EventHandler<Event>;
|
|
26
|
-
export type TagProps<T extends HTMLElement = HTMLElement> = TagNativeProps<T> & ElementCommonAttrs & {
|
|
27
|
-
ref?: HtmlRef<T> | RefSetter<T | null>;
|
|
8
|
+
type Overrides<T extends Element, O> = T extends HTMLInputElement | HTMLTextAreaElement ? ReplaceIn<O, {
|
|
9
|
+
value?: string | number;
|
|
10
|
+
} & {
|
|
11
|
+
defaultValue?: string | number;
|
|
12
|
+
defaultChecked?: boolean;
|
|
13
|
+
}> : T extends HTMLSelectElement ? ReplaceIn<O, {
|
|
14
|
+
value?: string | number | Array<number | string>;
|
|
15
|
+
}> & {
|
|
16
|
+
defaultValue?: string | number | Array<string | number>;
|
|
17
|
+
} : T extends HTMLOptionElement ? ReplaceIn<O, {
|
|
18
|
+
value?: string | number;
|
|
19
|
+
}> : O;
|
|
20
|
+
export type TagProps<T extends Element = HTMLElement> = Overrides<T, TagNativeProps<T> & ElementCommonAttrs & {
|
|
21
|
+
ref?: Ref<T>;
|
|
28
22
|
style?: string | null | undefined | TagStyles;
|
|
29
|
-
} & Record<`data-${string}`, ScalarNode> & {
|
|
30
23
|
children?: JSX.Element;
|
|
31
|
-
|
|
24
|
+
dangerouslySetInnerHTML?: {
|
|
25
|
+
__html: string;
|
|
26
|
+
};
|
|
27
|
+
} & Record<`data-${string}`, ScalarNode>>;
|
|
32
28
|
/** A map like { fontSize: '12px' }. */
|
|
33
29
|
export type TagStyles = {
|
|
34
30
|
[K in keyof CSSStyleDeclaration]?: string | number;
|
|
35
31
|
} & {
|
|
36
|
-
[K in `--${string}`]: string | number;
|
|
32
|
+
[K in `--${string}`]: string | number | null;
|
|
37
33
|
};
|
|
38
34
|
export type SvgRootProps = TagProps<HTMLElement> & {
|
|
39
35
|
xmlns?: string;
|
|
@@ -46,7 +42,7 @@ export type SvgRootProps = TagProps<HTMLElement> & {
|
|
|
46
42
|
* way to get it from the default DOM types, so I left a fallback that at least
|
|
47
43
|
* doesn't block SVG tags.
|
|
48
44
|
*/
|
|
49
|
-
export type SvgTagProps = {
|
|
45
|
+
export type SvgTagProps<T extends SVGElement = SVGElement> = {
|
|
50
46
|
[K in string]?: unknown;
|
|
51
47
|
} & {
|
|
52
48
|
children?: JSX.Element;
|
package/dist/types/dom.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/types/dom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC7D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/types/dom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC7D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAElC,gDAAgD;AAChD,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,IAAI,GAAG,OAAO,CAAC;AAE/C,MAAM,MAAM,YAAY,GAEpB,MAAM,GACN,MAAM,GACN,OAAO,GAEP,IAAI,GACJ,SAAS,GAET,QAAQ,GACR,SAAS,CAAC;AAEd,KAAK,SAAS,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,IAAI,CAAC,SACpC,gBAAgB,GAChB,mBAAmB,GACnB,SAAS,CACP,CAAC,EACD;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG;IAC5B,YAAY,CAA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;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;GAIG;AAEH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,IAAI;KAC1D,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,OAAO;CACxB,GAAG;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Ensure, RemapKeys, RemoveIndexSignature } from './common';
|
|
2
|
+
export type PatchEvent<T extends Element, E extends Event = Event> = E & {
|
|
3
|
+
target: T;
|
|
4
|
+
currentTarget: Element;
|
|
5
|
+
nativeEvent: E;
|
|
6
|
+
};
|
|
7
|
+
export type EventHandler<T extends Element, E extends Event> = (event: PatchEvent<T, E>) => void;
|
|
8
|
+
type EventByName<E extends string> = E extends `onpaste` | 'oncopy' | 'oncut' ? Ensure<ClipboardEvent, 'clipboardData'> : E extends `ondrag${string}` ? DragEvent : E extends `mouse${string}` ? MouseEvent : E extends `onkey${string}` ? KeyboardEvent : E extends `ontouch${string}` ? TouchEvent : E extends `onwheel` ? WheelEvent : Event;
|
|
9
|
+
type DomEventHandlerX<T extends Element, E extends string> = E extends `ondrag${string}` ? EventHandler<T, DragEvent> : E extends `onmouse${string}` ? EventHandler<T, MouseEvent> : E extends `onkey${string}` ? EventHandler<T, KeyboardEvent> : E extends `onfocus` | `onblur` ? EventHandler<T, FocusEvent> : E extends `onwheel` ? EventHandler<T, WheelEvent> : E extends 'onclick' | `onpointer${string}` ? EventHandler<T, PointerEvent> : E extends `ontouch${string}` ? EventHandler<T, TouchEvent> : E extends `onanimation${string}` ? EventHandler<T, AnimationEvent> : E extends `ontransition${string}` ? EventHandler<T, TransitionEvent> : E extends `onload` | `onerror` | `onabort` ? EventHandler<T, ProgressEvent> : EventHandler<T, EventByName<E>>;
|
|
10
|
+
type ToCamelCase<T extends string> = T extends `onmouse${infer Rest}` ? `onMouse${Capitalize<Rest>}` : T extends `onfullscreen${infer Rest}` ? `onFullscreen${Capitalize<Rest>}` : T extends `onkey${infer Rest}` ? `onKey${Capitalize<Rest>}` : T extends `ondrag${infer Rest}` ? `onDrag${Capitalize<Rest>}` : T extends `ontouch${infer Rest}` ? `onTouch${Capitalize<Rest>}` : T extends `onpointer${infer Rest}` ? `onPointer${Capitalize<Rest>}` : T extends `onanimation${infer Rest}` ? `onAnimation${Capitalize<Rest>}` : T extends `ontransition${infer Rest}` ? `onTransition${Capitalize<Rest>}` : T extends `oncanplay${infer Rest}` ? `onCanPlay${Capitalize<Rest>}` : T extends `on${infer Rest}` ? `on${Capitalize<Rest>}` : T;
|
|
11
|
+
type EventKeys<T extends Element> = {
|
|
12
|
+
[K in keyof RemoveIndexSignature<T>]: K extends `on${string}` ? K : never;
|
|
13
|
+
}[keyof RemoveIndexSignature<T>];
|
|
14
|
+
type EventHandlers<T extends Element> = {
|
|
15
|
+
[K in EventKeys<T>]: DomEventHandlerX<T, K>;
|
|
16
|
+
};
|
|
17
|
+
type MapLowerCaseToCamelCase<T extends Element> = {
|
|
18
|
+
[K in EventKeys<T>]: ToCamelCase<K>;
|
|
19
|
+
};
|
|
20
|
+
type CaptureEvents<T> = {
|
|
21
|
+
[K in keyof T as `${string & K}Capture`]: T[K];
|
|
22
|
+
};
|
|
23
|
+
type WithCapture<T> = T & CaptureEvents<T>;
|
|
24
|
+
/**
|
|
25
|
+
* A map of events for the given HTMLElement-based type
|
|
26
|
+
* @example
|
|
27
|
+
* { onClick: (evt: PointerEvents) => void }
|
|
28
|
+
*/
|
|
29
|
+
export type TagEventHandlers<T extends Element> = WithCapture<RemapKeys<EventHandlers<T>, MapLowerCaseToCamelCase<RemoveIndexSignature<T>>>>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
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|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":""}
|
package/dist/types/fiber.d.ts
CHANGED
|
@@ -2,11 +2,20 @@ import type { ComponentState, ReactComponent } from './component';
|
|
|
2
2
|
import type { ContextState } from './context';
|
|
3
3
|
import type { UnknownProps, ReactKey } from './core';
|
|
4
4
|
import type { DomNode, TagStyles } from './dom';
|
|
5
|
-
import type {
|
|
5
|
+
import type { RefObject, RefSetter } from './refs';
|
|
6
6
|
/**
|
|
7
7
|
* A single node in the Fiber tree.
|
|
8
8
|
*/
|
|
9
9
|
export type FiberNode = NullFiberNode | FragmentFiberNode | TextFiberNode | TagFiberNode | ComponentFiberNode | ContextFiberNode | PortalFiberNode;
|
|
10
|
+
/**
|
|
11
|
+
* A source in the dev's file system of the given JSX node. Available only in
|
|
12
|
+
* some dev-builds.
|
|
13
|
+
*/
|
|
14
|
+
export type JsxSource = {
|
|
15
|
+
columnNumber: number;
|
|
16
|
+
lineNumber: number;
|
|
17
|
+
fileName: string;
|
|
18
|
+
};
|
|
10
19
|
type CommonFiber = {
|
|
11
20
|
/** Unique (within the given app) ID of the fiber. */
|
|
12
21
|
id: number;
|
|
@@ -30,6 +39,8 @@ type CommonFiber = {
|
|
|
30
39
|
* tree. Not the fiber props.
|
|
31
40
|
*/
|
|
32
41
|
children: FiberNode[];
|
|
42
|
+
/** The source in the user's file system where the given JSX node was defined. */
|
|
43
|
+
source: null | JsxSource;
|
|
33
44
|
};
|
|
34
45
|
/**
|
|
35
46
|
* false, null, undefined.
|
|
@@ -46,6 +57,12 @@ export type NullFiberNode = CommonFiber & {
|
|
|
46
57
|
tag: null;
|
|
47
58
|
ref: null;
|
|
48
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* When `fiber.element` is `containerSym` it means it's a fragment or a
|
|
62
|
+
* component with more than 1 children.
|
|
63
|
+
*/
|
|
64
|
+
export declare const containerSym: unique symbol;
|
|
65
|
+
export type Container = typeof containerSym;
|
|
49
66
|
/**
|
|
50
67
|
* <Component/>
|
|
51
68
|
*/
|
|
@@ -55,16 +72,16 @@ export type ComponentFiberNode = CommonFiber & {
|
|
|
55
72
|
data: ComponentState;
|
|
56
73
|
props: UnknownProps;
|
|
57
74
|
/**
|
|
58
|
-
* Since components can render everything we never know the element.
|
|
59
|
-
*
|
|
60
|
-
* Note: when component is rendered in the compact mode `element` refers to
|
|
61
|
-
* the only rendered DOM node of one of its child fiber nodes.
|
|
75
|
+
* Since components can render everything we never know the element. Each
|
|
76
|
+
* component might be in on of the following modes:
|
|
62
77
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
78
|
+
* - empty: it has no children, so that we render an !--empty comment.
|
|
79
|
+
* - single-child: it has exact one direct DOM-child. .element refers to that
|
|
80
|
+
* child.
|
|
81
|
+
* - auto-container: it has more than one direct DOM children. These children
|
|
82
|
+
* are inlined into the parent's DOM container. .element === containerSym.
|
|
66
83
|
*/
|
|
67
|
-
element: DomNode | null;
|
|
84
|
+
element: Container | DomNode | null;
|
|
68
85
|
key: ReactKey | null;
|
|
69
86
|
role: null;
|
|
70
87
|
tag: null;
|
|
@@ -113,7 +130,7 @@ export type FragmentFiberNode = CommonFiber & {
|
|
|
113
130
|
type: 'fragment';
|
|
114
131
|
key: ReactKey | null;
|
|
115
132
|
/** The same as in ComponentFiberNode. */
|
|
116
|
-
element: Comment | null;
|
|
133
|
+
element: Comment | Container | null;
|
|
117
134
|
role: null;
|
|
118
135
|
props: null;
|
|
119
136
|
data: null;
|
|
@@ -138,8 +155,11 @@ export type TagState = {
|
|
|
138
155
|
* render, when the event handler is not yet set up but is presented in JSX.
|
|
139
156
|
*/
|
|
140
157
|
events: Partial<Record<string, {
|
|
158
|
+
/** Adapted event name. The value that is passed to .add|removeEventListener. */
|
|
159
|
+
name: string;
|
|
141
160
|
wrapper: EventListener;
|
|
142
161
|
handler: Function | null;
|
|
162
|
+
capture: boolean;
|
|
143
163
|
}>>;
|
|
144
164
|
styles: TagStyles | null;
|
|
145
165
|
};
|
|
@@ -152,7 +172,7 @@ export type TagFiberNode<T = Element> = CommonFiber & {
|
|
|
152
172
|
key: ReactKey | null;
|
|
153
173
|
element: T | null;
|
|
154
174
|
data: TagState;
|
|
155
|
-
ref: RefSetter<T
|
|
175
|
+
ref: RefSetter<T> | RefObject<T | null> | null;
|
|
156
176
|
props: Record<PropertyKey, unknown>;
|
|
157
177
|
role: null;
|
|
158
178
|
component: null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fiber.d.ts","sourceRoot":"","sources":["../../src/types/fiber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"fiber.d.ts","sourceRoot":"","sources":["../../src/types/fiber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,aAAa,GACb,iBAAiB,GACjB,aAAa,GACb,YAAY,GACZ,kBAAkB,GAClB,gBAAgB,GAChB,eAAe,CAAC;AAEpB;;;GAGG;AACH,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I;IACtD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC"}
|
package/dist/types/fiber.js
CHANGED
package/dist/types/fiber.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fiber.js","sourceRoot":"","sources":["../../src/types/fiber.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"fiber.js","sourceRoot":"","sources":["../../src/types/fiber.ts"],"names":[],"mappings":"AAwEA;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAkB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC"}
|