@faiwer/react 0.8.4 → 19.0.1
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 +43 -21
- package/dist/core/actions/applyAction.d.ts.map +1 -1
- package/dist/core/actions/applyAction.js +6 -0
- package/dist/core/actions/applyAction.js.map +1 -1
- package/dist/core/actions/catchError.action.d.ts +10 -0
- package/dist/core/actions/catchError.action.d.ts.map +1 -0
- package/dist/core/actions/catchError.action.js +51 -0
- package/dist/core/actions/catchError.action.js.map +1 -0
- 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 +18 -0
- package/dist/core/actions/dom/value.d.ts.map +1 -0
- package/dist/core/actions/dom/value.js +211 -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 +64 -70
- 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 -17
- 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 +34 -23
- package/dist/core/actions/replace.action.js.map +1 -1
- package/dist/core/actions/scheduleEffect.action.d.ts +7 -0
- package/dist/core/actions/scheduleEffect.action.d.ts.map +1 -0
- package/dist/core/actions/scheduleEffect.action.js +8 -0
- package/dist/core/actions/scheduleEffect.action.js.map +1 -0
- 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 +47 -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 +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 +2 -1
- package/dist/core/classComponent.d.ts.map +1 -1
- package/dist/core/classComponent.js +20 -12
- 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 +6 -4
- package/dist/core/components.d.ts.map +1 -1
- package/dist/core/components.js +26 -8
- 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 +3 -1
- package/dist/core/reactNodeToFiberNode.d.ts.map +1 -1
- package/dist/core/reactNodeToFiberNode.js +80 -17
- 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 +2 -1
- package/dist/core/reconciliation/collect/fromApp.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromApp.js +7 -26
- package/dist/core/reconciliation/collect/fromApp.js.map +1 -1
- package/dist/core/reconciliation/collect/fromChildrenPair.d.ts +2 -1
- package/dist/core/reconciliation/collect/fromChildrenPair.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromChildrenPair.js +37 -10
- package/dist/core/reconciliation/collect/fromChildrenPair.js.map +1 -1
- package/dist/core/reconciliation/collect/fromComponent.d.ts +3 -2
- package/dist/core/reconciliation/collect/fromComponent.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromComponent.js +27 -9
- package/dist/core/reconciliation/collect/fromComponent.js.map +1 -1
- package/dist/core/reconciliation/collect/fromFiberPair.d.ts +2 -1
- package/dist/core/reconciliation/collect/fromFiberPair.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromFiberPair.js +8 -5
- 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 +2 -2
- package/dist/core/reconciliation/effects.d.ts.map +1 -1
- package/dist/core/reconciliation/effects.js +52 -4
- package/dist/core/reconciliation/effects.js.map +1 -1
- package/dist/core/reconciliation/errors/ReactError.d.ts +15 -0
- package/dist/core/reconciliation/errors/ReactError.d.ts.map +1 -0
- package/dist/core/reconciliation/errors/ReactError.js +56 -0
- package/dist/core/reconciliation/errors/ReactError.js.map +1 -0
- package/dist/core/reconciliation/errors/stack.d.ts +8 -2
- package/dist/core/reconciliation/errors/stack.d.ts.map +1 -1
- package/dist/core/reconciliation/errors/stack.js +65 -8
- 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 +24 -6
- 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.d.ts.map +1 -1
- package/dist/core/reconciliation/render.js +9 -3
- package/dist/core/reconciliation/render.js.map +1 -1
- package/dist/core/reconciliation/runFiberComponents.d.ts +3 -1
- package/dist/core/reconciliation/runFiberComponents.d.ts.map +1 -1
- package/dist/core/reconciliation/runFiberComponents.js +33 -5
- 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 +3 -3
- 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 +2 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -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 +21 -7
- package/dist/hooks/useEffect.js.map +1 -1
- package/dist/hooks/useError.d.ts +5 -0
- package/dist/hooks/useError.d.ts.map +1 -0
- package/dist/hooks/useError.js +19 -0
- package/dist/hooks/useError.js.map +1 -0
- package/dist/hooks/useReducer.d.ts +7 -0
- package/dist/hooks/useReducer.d.ts.map +1 -0
- package/dist/hooks/useReducer.js +10 -0
- package/dist/hooks/useReducer.js.map +1 -0
- 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 +3 -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 +23 -5
- package/dist/types/actions.d.ts.map +1 -1
- package/dist/types/app.d.ts +17 -3
- 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 +11 -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 +30 -12
- 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 +16 -6
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/react.d.ts +31 -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
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,34 +1,35 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TagNativeProps } from './attributes';
|
|
2
|
+
import type { ReplaceIn } from './common';
|
|
2
3
|
import type { ElementCommonAttrs, ScalarNode } from './core';
|
|
3
|
-
import type {
|
|
4
|
-
import type { HtmlRef, RefSetter } from './refs';
|
|
4
|
+
import type { Ref } from './refs';
|
|
5
5
|
/** The list of possible DOM tree node types. */
|
|
6
6
|
export type DomNode = Element | Text | Comment;
|
|
7
7
|
export type TagAttrValue = string | number | boolean | null | undefined | Function | TagStyles;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
type
|
|
21
|
-
|
|
22
|
-
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>;
|
|
23
22
|
style?: string | null | undefined | TagStyles;
|
|
24
|
-
} & Record<`data-${string}`, ScalarNode> & {
|
|
25
23
|
children?: JSX.Element;
|
|
26
|
-
|
|
24
|
+
dangerouslySetInnerHTML?: {
|
|
25
|
+
__html: string;
|
|
26
|
+
};
|
|
27
|
+
} & Record<`data-${string}`, ScalarNode>>;
|
|
27
28
|
/** A map like { fontSize: '12px' }. */
|
|
28
29
|
export type TagStyles = {
|
|
29
30
|
[K in keyof CSSStyleDeclaration]?: string | number;
|
|
30
31
|
} & {
|
|
31
|
-
[K in `--${string}`]: string | number;
|
|
32
|
+
[K in `--${string}`]: string | number | null;
|
|
32
33
|
};
|
|
33
34
|
export type SvgRootProps = TagProps<HTMLElement> & {
|
|
34
35
|
xmlns?: string;
|
|
@@ -41,7 +42,7 @@ export type SvgRootProps = TagProps<HTMLElement> & {
|
|
|
41
42
|
* way to get it from the default DOM types, so I left a fallback that at least
|
|
42
43
|
* doesn't block SVG tags.
|
|
43
44
|
*/
|
|
44
|
-
export type SvgTagProps = {
|
|
45
|
+
export type SvgTagProps<T extends SVGElement = SVGElement> = {
|
|
45
46
|
[K in string]?: unknown;
|
|
46
47
|
} & {
|
|
47
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"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M,MAAM,QAAQ,CAAC,CAAC,SAAS,OAAO,GAAG,WAAW,IAClD,SAAS,CAAC,CAAC,EACP,cAAc,CAAC,CAAC,CAAC,GACjB,kBAAkB,GAClB;IACA,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACvB,uBAAuB,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9C,GACC,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,UAAU,CAAC,CACvC,CAAA;AAEH,uCAAuC;AACvC,MAAM,MAAM,SAAS,GACjB;KAAG,CAAC,IAAI,MAAM,mBAAmB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;CAAG,GACvD;KAAG,CAAC,IAAI,KAAK,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI;CAAE,CAAC;AAErD,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;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"}
|
package/dist/types/events.d.ts
CHANGED
|
@@ -1,24 +1,31 @@
|
|
|
1
|
-
import type { RemoveIndexSignature } from './common';
|
|
2
|
-
type
|
|
3
|
-
|
|
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;
|
|
4
6
|
};
|
|
5
|
-
type EventHandler<E extends Event> = (event: E) => void;
|
|
6
|
-
type
|
|
7
|
-
type
|
|
8
|
-
type
|
|
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> = {
|
|
9
12
|
[K in keyof RemoveIndexSignature<T>]: K extends `on${string}` ? K : never;
|
|
10
13
|
}[keyof RemoveIndexSignature<T>];
|
|
11
|
-
type EventHandlers<T extends
|
|
12
|
-
[K in EventKeys<T>]: DomEventHandlerX<K>;
|
|
14
|
+
type EventHandlers<T extends Element> = {
|
|
15
|
+
[K in EventKeys<T>]: DomEventHandlerX<T, K>;
|
|
13
16
|
};
|
|
14
|
-
type
|
|
17
|
+
type MapLowerCaseToCamelCase<T extends Element> = {
|
|
15
18
|
[K in EventKeys<T>]: ToCamelCase<K>;
|
|
16
19
|
};
|
|
20
|
+
type CaptureEvents<T> = {
|
|
21
|
+
[K in keyof T as `${string & K}Capture`]: T[K];
|
|
22
|
+
};
|
|
23
|
+
type WithCapture<T> = T & CaptureEvents<T>;
|
|
17
24
|
/**
|
|
18
25
|
* A map of events for the given HTMLElement-based type
|
|
19
26
|
* @example
|
|
20
27
|
* { onClick: (evt: PointerEvents) => void }
|
|
21
28
|
*/
|
|
22
|
-
export type TagEventHandlers<T extends
|
|
29
|
+
export type TagEventHandlers<T extends Element> = WithCapture<RemapKeys<EventHandlers<T>, MapLowerCaseToCamelCase<RemoveIndexSignature<T>>>>;
|
|
23
30
|
export {};
|
|
24
31
|
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"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extState } 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;
|
|
@@ -97,7 +114,7 @@ export type PortalFiberNode = CommonFiber & {
|
|
|
97
114
|
data: HTMLElement;
|
|
98
115
|
key: ReactKey | null;
|
|
99
116
|
role: 'portal';
|
|
100
|
-
element:
|
|
117
|
+
element: Comment | null;
|
|
101
118
|
tag: string;
|
|
102
119
|
props: null;
|
|
103
120
|
component: 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;
|
|
@@ -142,6 +159,7 @@ export type TagState = {
|
|
|
142
159
|
name: string;
|
|
143
160
|
wrapper: EventListener;
|
|
144
161
|
handler: Function | null;
|
|
162
|
+
capture: boolean;
|
|
145
163
|
}>>;
|
|
146
164
|
styles: TagStyles | null;
|
|
147
165
|
};
|
|
@@ -154,7 +172,7 @@ export type TagFiberNode<T = Element> = CommonFiber & {
|
|
|
154
172
|
key: ReactKey | null;
|
|
155
173
|
element: T | null;
|
|
156
174
|
data: TagState;
|
|
157
|
-
ref: RefSetter<T
|
|
175
|
+
ref: RefSetter<T> | RefObject<T | null> | null;
|
|
158
176
|
props: Record<PropertyKey, unknown>;
|
|
159
177
|
role: null;
|
|
160
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,MAAM,MAAM,SAAS,GAAG;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC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;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"}
|
package/dist/types/hooks.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactContext } from './context';
|
|
2
|
-
import type { ContextFiberNode, FiberNode } from './fiber';
|
|
3
|
-
import type {
|
|
2
|
+
import type { ContextFiberNode, FiberNode, TagState } from './fiber';
|
|
3
|
+
import type { RefObject } from './refs';
|
|
4
4
|
export type UseStateItem<T = unknown> = {
|
|
5
5
|
type: 'state';
|
|
6
6
|
state: T;
|
|
@@ -15,7 +15,7 @@ export type UseMemoItem = {
|
|
|
15
15
|
};
|
|
16
16
|
export type UseRefItem<T = unknown> = {
|
|
17
17
|
type: 'ref';
|
|
18
|
-
value:
|
|
18
|
+
value: RefObject<T>;
|
|
19
19
|
};
|
|
20
20
|
export type UseEffectItem = {
|
|
21
21
|
type: 'effect';
|
|
@@ -31,7 +31,15 @@ export type UseContextItem<T = unknown> = {
|
|
|
31
31
|
move: (newFiber: FiberNode) => void;
|
|
32
32
|
providerFiber: ContextFiberNode | null;
|
|
33
33
|
};
|
|
34
|
-
export type
|
|
34
|
+
export type ErrorInfo = {
|
|
35
|
+
componentStack: string;
|
|
36
|
+
};
|
|
37
|
+
export type ErrorHandler = (error: unknown, info: ErrorInfo) => void;
|
|
38
|
+
export type UseErrorItem = {
|
|
39
|
+
type: 'error';
|
|
40
|
+
fn: ErrorHandler;
|
|
41
|
+
};
|
|
42
|
+
export type HookStateItem = UseStateItem | UseMemoItem | UseRefItem | UseEffectItem | UseContextItem | UseErrorItem;
|
|
35
43
|
export type HookStore = HookStateItem[];
|
|
36
44
|
/**
|
|
37
45
|
* Deps used to invalidate the hook.
|
|
@@ -39,12 +47,14 @@ export type HookStore = HookStateItem[];
|
|
|
39
47
|
*/
|
|
40
48
|
export type HookDeps = unknown[];
|
|
41
49
|
/** const [, setter] = useState(...) */
|
|
42
|
-
export type StateSetter<T> = (valueOrFn:
|
|
50
|
+
export type StateSetter<T> = (valueOrFn: T | ((prev: T) => T)) => void;
|
|
43
51
|
/**
|
|
44
52
|
* In this library useEffect & useLayoutEffect are a little more complex. They
|
|
45
53
|
* support async functions and abort signals. But they are still back-compatible
|
|
46
54
|
* with the original React ones.
|
|
47
55
|
*/
|
|
48
56
|
export type EffectHandler = (signal: AbortSignal) => void | Promise<void> | (() => void);
|
|
49
|
-
export type EffectMode = '
|
|
57
|
+
export type EffectMode = 'afterActions' | 'refsUnmount' | 'refsMount' | 'layout' | 'normal';
|
|
58
|
+
export type Reducer<TState, TAction> = (state: TState, action: TAction) => TagState;
|
|
59
|
+
export type Dispatch<A> = (action: A) => void;
|
|
50
60
|
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/types/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/types/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS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,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;AACrE,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,YAAY,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,aAAa,GACrB,YAAY,GACZ,WAAW,GACX,UAAU,GACV,aAAa,GACb,cAAc,GACd,YAAY,CAAC;AAEjB,MAAM,MAAM,SAAS,GAAG,aAAa,EAAE,CAAC;AAExC;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,EAAE,CAAC;AAEjC,uCAAuC;AACvC,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC;AAEvE;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,CAC1B,MAAM,EAAE,WAAW,KAChB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;AAEzC,MAAM,MAAM,UAAU,GAElB,cAAc,GAEd,aAAa,GACb,WAAW,GAEX,QAAQ,GAER,QAAQ,CAAC;AAEb,MAAM,MAAM,OAAO,CAAC,MAAM,EAAE,OAAO,IAAI,CACrC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,OAAO,KACZ,QAAQ,CAAC;AAEd,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ReactContext } from './context';
|
|
2
|
+
import { type ReactComponent } from './component';
|
|
3
|
+
import type { ElementCommonAttrs, UnknownProps } from './core';
|
|
4
|
+
import type { EventHandler, PatchEvent } from './events';
|
|
5
|
+
import type { TagNativeProps } from './attributes';
|
|
6
|
+
import type { TagProps, TagStyles } from './dom';
|
|
7
|
+
import type { Ref } from './refs';
|
|
8
|
+
export type FC<Props extends UnknownProps = UnknownProps> = ReactComponent<Props>;
|
|
9
|
+
export type ReactNode = JSX.Element;
|
|
10
|
+
export type Context<T> = ReactContext<T>;
|
|
11
|
+
export type CSSProperties = TagStyles;
|
|
12
|
+
export type ComponentType<Props extends UnknownProps = UnknownProps> = ReactComponent<Props>;
|
|
13
|
+
export type ForwardRefExoticComponent<Props extends UnknownProps = UnknownProps> = FC<Props>;
|
|
14
|
+
export type SyntheticEvent<T extends Element = Element, E extends Event = Event> = PatchEvent<T, E>;
|
|
15
|
+
export type ClipboardEvent<T extends Element = Element> = SyntheticEvent<T> & {
|
|
16
|
+
clipboardData: DataTransfer;
|
|
17
|
+
};
|
|
18
|
+
export type FormEvent<T extends Element = Element> = SyntheticEvent<T>;
|
|
19
|
+
export type ChangeEvent<T extends Element = Element> = Omit<SyntheticEvent<T>, 'target'> & {
|
|
20
|
+
target: EventTarget & T;
|
|
21
|
+
};
|
|
22
|
+
export type ChangeEventHandler<T extends Element = Element> = EventHandler<T, Event>;
|
|
23
|
+
export type KeyboardEvent<T extends Element = Element> = PatchEvent<T, globalThis.KeyboardEvent>;
|
|
24
|
+
export type ReactEventHandler<T extends Element = Element> = EventHandler<T, Event>;
|
|
25
|
+
export type HTMLAttributes<T extends Element> = TagNativeProps<T>;
|
|
26
|
+
export type TextareaHTMLAttributes<T extends Element = HTMLTextAreaElement> = TagProps<T>;
|
|
27
|
+
export type InputHTMLAttributes<T extends Element = HTMLInputElement> = TagProps<T>;
|
|
28
|
+
export type RefAttributes<T extends Element> = {
|
|
29
|
+
ref?: Ref<T>;
|
|
30
|
+
} & ElementCommonAttrs;
|
|
31
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/types/react.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MA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MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAC/C,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,GACjC;IAAE,MAAM,EAAE,WAAW,GAAG,CAAC,CAAC;CAAE,CAAC;AACjC,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IACxD,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AACzB,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IACnD,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;AAC1C,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IACvD,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAMzB,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,OAAO,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC;AAClE,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,OAAO,GAAG,mBAAmB,IACxE,QAAQ,CAAC,CAAC,CAAC,CAAC;AACd,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,OAAO,GAAG,gBAAgB,IAClE,QAAQ,CAAC,CAAC,CAAC,CAAC;AACd,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,OAAO,IACvC;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GACjB,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/types/react.ts"],"names":[],"mappings":""}
|
package/dist/types/refs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** A ref produced in `useRef(default)` */
|
|
2
|
-
export type
|
|
2
|
+
export type RefObject<T> = {
|
|
3
3
|
current: T;
|
|
4
4
|
};
|
|
5
5
|
/**
|
|
@@ -8,12 +8,9 @@ export type Ref<T> = {
|
|
|
8
8
|
* <div ref={(node: HTMLDivElement | null) => …}
|
|
9
9
|
* // ^ RefSetter<HTMLDivElement | null>
|
|
10
10
|
**/
|
|
11
|
-
export type RefSetter<T> = (v: T) => void;
|
|
11
|
+
export type RefSetter<T> = (v: T | null) => void;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* <div ref={ref}/>
|
|
17
|
-
**/
|
|
18
|
-
export type HtmlRef<T extends HTMLElement | SVGElement> = Ref<T | null | undefined>;
|
|
13
|
+
* Both `RefSetter` or `RefObject`.
|
|
14
|
+
*/
|
|
15
|
+
export type Ref<T> = RefObject<T | null> | RefSetter<T>;
|
|
19
16
|
//# sourceMappingURL=refs.d.ts.map
|
package/dist/types/refs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../src/types/refs.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../src/types/refs.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC;AAE1C;;;;;IAKI;AACJ,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faiwer/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "19.0.1",
|
|
4
4
|
"description": "A hobby project. A naive and simplified React implementation",
|
|
5
|
-
"keywords": [
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"jsx",
|
|
8
|
+
"hooks",
|
|
9
|
+
"virtual-dom",
|
|
10
|
+
"frontend",
|
|
11
|
+
"ui-library"
|
|
12
|
+
],
|
|
6
13
|
"repository": {
|
|
7
14
|
"type": "git",
|
|
8
15
|
"url": "https://github.com/faiwer/faiwer-react.git"
|
|
@@ -39,7 +46,8 @@
|
|
|
39
46
|
}
|
|
40
47
|
},
|
|
41
48
|
"scripts": {
|
|
42
|
-
"build": "npm run clean && npx tsgo -p tsconfig.build.json && npx tsc-alias -p tsconfig.build.json && cp src/jsx.d.ts dist/jsx.d.ts",
|
|
49
|
+
"build": "npm run clean && npx tsgo -p tsconfig.build.json && npx tsc-alias -p tsconfig.build.json && cp src/jsx.d.ts dist/jsx.d.ts && npm run prepend-dts",
|
|
50
|
+
"prepend-dts": "cp ./src/react.d.ts ./dist && printf '/// <reference path=\"./jsx.d.ts\" />\n/// <reference path=\"./react.d.ts\" />\n' | cat - ./dist/index.d.ts > temp && mv temp ./dist/index.d.ts",
|
|
43
51
|
"clean": "rm -rf dist",
|
|
44
52
|
"prepublishOnly": "npm run build",
|
|
45
53
|
"test": "jest",
|