@faiwer/react 0.9.0 → 19.0.2
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 +61 -10
- package/dist/core/actions/applyAction.d.ts.map +1 -1
- package/dist/core/actions/applyAction.js +4 -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/dom/value.d.ts +3 -2
- package/dist/core/actions/dom/value.d.ts.map +1 -1
- package/dist/core/actions/dom/value.js +20 -13
- package/dist/core/actions/dom/value.js.map +1 -1
- package/dist/core/actions/helpers.d.ts +6 -1
- package/dist/core/actions/helpers.d.ts.map +1 -1
- package/dist/core/actions/helpers.js +20 -3
- package/dist/core/actions/helpers.js.map +1 -1
- package/dist/core/actions/remove.action.d.ts.map +1 -1
- package/dist/core/actions/remove.action.js +4 -3
- package/dist/core/actions/remove.action.js.map +1 -1
- package/dist/core/actions/replace.action.d.ts.map +1 -1
- package/dist/core/actions/replace.action.js +4 -0
- 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.map +1 -1
- package/dist/core/actions/setAttr.action.js +2 -3
- package/dist/core/actions/setAttr.action.js.map +1 -1
- package/dist/core/actions/setRef.action.d.ts.map +1 -1
- package/dist/core/actions/setRef.action.js +1 -2
- package/dist/core/actions/setRef.action.js.map +1 -1
- package/dist/core/classComponent.d.ts +2 -1
- package/dist/core/classComponent.d.ts.map +1 -1
- package/dist/core/classComponent.js +17 -10
- package/dist/core/classComponent.js.map +1 -1
- package/dist/core/components.d.ts +5 -3
- package/dist/core/components.d.ts.map +1 -1
- package/dist/core/components.js +17 -4
- package/dist/core/components.js.map +1 -1
- package/dist/core/devTools/devTools.d.ts +2 -0
- package/dist/core/devTools/devTools.d.ts.map +1 -0
- package/dist/core/devTools/devTools.js +43 -0
- package/dist/core/devTools/devTools.js.map +1 -0
- package/dist/core/devTools/hmr.d.ts +6 -0
- package/dist/core/devTools/hmr.d.ts.map +1 -0
- package/dist/core/devTools/hmr.js +55 -0
- package/dist/core/devTools/hmr.js.map +1 -0
- package/dist/core/devTools/toRFiber.d.ts +7 -0
- package/dist/core/devTools/toRFiber.d.ts.map +1 -0
- package/dist/core/devTools/toRFiber.js +143 -0
- package/dist/core/devTools/toRFiber.js.map +1 -0
- package/dist/core/devTools/toRJsx.d.ts +10 -0
- package/dist/core/devTools/toRJsx.d.ts.map +1 -0
- package/dist/core/devTools/toRJsx.js +62 -0
- package/dist/core/devTools/toRJsx.js.map +1 -0
- package/dist/core/devTools/types.d.ts +157 -0
- package/dist/core/devTools/types.d.ts.map +1 -0
- package/dist/core/devTools/types.js +19 -0
- package/dist/core/devTools/types.js.map +1 -0
- package/dist/core/preact/connect.d.ts +3 -0
- package/dist/core/preact/connect.d.ts.map +1 -0
- package/dist/core/preact/connect.js +162 -0
- package/dist/core/preact/connect.js.map +1 -0
- package/dist/core/preact/helpers.d.ts +12 -0
- package/dist/core/preact/helpers.d.ts.map +1 -0
- package/dist/core/preact/helpers.js +52 -0
- package/dist/core/preact/helpers.js.map +1 -0
- package/dist/core/preact/inspect.d.ts +9 -0
- package/dist/core/preact/inspect.d.ts.map +1 -0
- package/dist/core/preact/inspect.js +169 -0
- package/dist/core/preact/inspect.js.map +1 -0
- package/dist/core/preact/toVNode.d.ts +11 -0
- package/dist/core/preact/toVNode.d.ts.map +1 -0
- package/dist/core/preact/toVNode.js +150 -0
- package/dist/core/preact/toVNode.js.map +1 -0
- package/dist/core/preact/types.d.ts +180 -0
- package/dist/core/preact/types.d.ts.map +1 -0
- package/dist/core/preact/types.js +29 -0
- package/dist/core/preact/types.js.map +1 -0
- package/dist/core/preact/update.d.ts +13 -0
- package/dist/core/preact/update.d.ts.map +1 -0
- package/dist/core/preact/update.js +40 -0
- package/dist/core/preact/update.js.map +1 -0
- package/dist/core/reactNodeToFiberNode.d.ts +3 -1
- package/dist/core/reactNodeToFiberNode.d.ts.map +1 -1
- package/dist/core/reactNodeToFiberNode.js +79 -16
- package/dist/core/reactNodeToFiberNode.js.map +1 -1
- package/dist/core/reconciliation/applyActions.d.ts.map +1 -1
- package/dist/core/reconciliation/applyActions.js +1 -0
- package/dist/core/reconciliation/applyActions.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 +15 -1
- 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 +26 -4
- package/dist/core/reconciliation/collect/fromChildrenPair.js.map +1 -1
- package/dist/core/reconciliation/collect/fromComponent.d.ts +2 -1
- package/dist/core/reconciliation/collect/fromComponent.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromComponent.js +25 -3
- 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 +6 -1
- package/dist/core/reconciliation/collect/fromFiberPair.js.map +1 -1
- package/dist/core/reconciliation/compare/areFiberNodesEq.d.ts.map +1 -1
- package/dist/core/reconciliation/compare/areFiberNodesEq.js +4 -0
- package/dist/core/reconciliation/compare/areFiberNodesEq.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 +53 -4
- package/dist/core/reconciliation/effects.js.map +1 -1
- package/dist/core/reconciliation/errors/ReactError.d.ts +8 -0
- package/dist/core/reconciliation/errors/ReactError.d.ts.map +1 -1
- package/dist/core/reconciliation/errors/ReactError.js +33 -0
- package/dist/core/reconciliation/errors/ReactError.js.map +1 -1
- package/dist/core/reconciliation/errors/stack.d.ts +1 -1
- package/dist/core/reconciliation/errors/stack.d.ts.map +1 -1
- package/dist/core/reconciliation/errors/stack.js +3 -3
- package/dist/core/reconciliation/errors/stack.js.map +1 -1
- package/dist/core/reconciliation/fibers.d.ts +12 -2
- package/dist/core/reconciliation/fibers.d.ts.map +1 -1
- package/dist/core/reconciliation/fibers.js +60 -1
- package/dist/core/reconciliation/fibers.js.map +1 -1
- package/dist/core/reconciliation/invalidateFiber.js +2 -2
- 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 +32 -2
- package/dist/core/reconciliation/mount.js.map +1 -1
- package/dist/core/reconciliation/postCommit.d.ts.map +1 -1
- package/dist/core/reconciliation/postCommit.js +1 -0
- package/dist/core/reconciliation/postCommit.js.map +1 -1
- package/dist/core/reconciliation/render.d.ts.map +1 -1
- package/dist/core/reconciliation/render.js +8 -2
- 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 +31 -4
- package/dist/core/reconciliation/runFiberComponents.js.map +1 -1
- package/dist/debug.d.ts +2 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +2 -0
- package/dist/debug.js.map +1 -0
- package/dist/hooks/helpers.d.ts +2 -2
- package/dist/hooks/helpers.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useEffect.d.ts.map +1 -1
- package/dist/hooks/useEffect.js +20 -6
- 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/useState.d.ts.map +1 -1
- package/dist/hooks/useState.js +0 -1
- package/dist/hooks/useState.js.map +1 -1
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/types/actions.d.ts +12 -1
- package/dist/types/actions.d.ts.map +1 -1
- package/dist/types/app.d.ts +14 -1
- package/dist/types/app.d.ts.map +1 -1
- package/dist/types/component.d.ts +8 -0
- package/dist/types/component.d.ts.map +1 -1
- package/dist/types/fiber.d.ts +1 -1
- package/dist/types/fiber.d.ts.map +1 -1
- package/dist/types/hooks.d.ts +12 -2
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/react.d.ts +0 -4
- package/dist/types/react.d.ts.map +1 -1
- package/package.json +14 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { App, ElementType, FiberNode, ReactComponent, ReactContext, ReactKey, UnknownProps } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* aka FiberRoot. React's createRoot()._internalRoot. Used in DevTools & HMR.
|
|
4
|
+
* https://github.com/facebook/react/blob/65eec428c40d542d4d5a9c1af5c3f406aecf3440/packages/react-reconciler/src/ReactFiberRoot.js
|
|
5
|
+
*/
|
|
6
|
+
export type RAppRoot = {
|
|
7
|
+
current: RFiber | null;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* A simple ref-like record that contains the freshest version of the given
|
|
11
|
+
* component. HMR engines internally map both old and new components to such a
|
|
12
|
+
* node.
|
|
13
|
+
*/
|
|
14
|
+
export type HMRFamily = {
|
|
15
|
+
/** Always leads to the freshest version of the given component family. */
|
|
16
|
+
current: ReactComponent<any>;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Hooks in React Dev Tools renderer used to provide Hot Module Replacement.
|
|
20
|
+
*/
|
|
21
|
+
export type HMRRendererApi = {
|
|
22
|
+
/**
|
|
23
|
+
* HMR code calls this method before `scheduleRefresh`. The provided callback
|
|
24
|
+
* is a way to get access to the HMR-family object of the given component
|
|
25
|
+
* family. The only argument must be any of the component versions.
|
|
26
|
+
*/
|
|
27
|
+
setRefreshHandler?: (fn: (type: ReactComponent) => HMRFamily | null) => void;
|
|
28
|
+
/**
|
|
29
|
+
* HMR code calls this method once it received component updates.
|
|
30
|
+
*/
|
|
31
|
+
scheduleRefresh?: (appRoot: RAppRoot, update: {
|
|
32
|
+
staleFamilies: Set<HMRFamily>;
|
|
33
|
+
updatedFamilies: Set<HMRFamily>;
|
|
34
|
+
}) => void;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* React Dev Tools extension in-page code.
|
|
38
|
+
* __PREACT_DEVTOOLS__.renderers<K, here>
|
|
39
|
+
*/
|
|
40
|
+
export type RRenderer = HMRRendererApi & {
|
|
41
|
+
/** React & ReactDOM version. */
|
|
42
|
+
version: string;
|
|
43
|
+
/** The same as `version`. */
|
|
44
|
+
reconcilerVersion: string;
|
|
45
|
+
/** 0 — prod, 1 — dev. */
|
|
46
|
+
bundleType: 0;
|
|
47
|
+
rendererPackageName: 'react-dom';
|
|
48
|
+
/** Should be called in the commit phase. */
|
|
49
|
+
onCommitFiberRoot?: (rendererId: number, appRoot: RAppRoot, priorityLevel?: number) => void;
|
|
50
|
+
/** Checked in hooks.inject. Should be presented to activate DevTools. */
|
|
51
|
+
currentDispatcherRef: {
|
|
52
|
+
current: null;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
/** Type of the fiber. aka as WorkTag. */
|
|
56
|
+
export declare enum RFiberTag {
|
|
57
|
+
Root = 3,
|
|
58
|
+
/** aka as HostComponent. */
|
|
59
|
+
Tag = 5,
|
|
60
|
+
/** FunctionComponent */
|
|
61
|
+
Component = 0,
|
|
62
|
+
/** HostText */
|
|
63
|
+
Text = 6,
|
|
64
|
+
/** Fragment */
|
|
65
|
+
Fragment = 7,
|
|
66
|
+
/** ContextProvider */
|
|
67
|
+
CtxProvider = 10
|
|
68
|
+
}
|
|
69
|
+
type AnyReactComponent = ReactComponent<any>;
|
|
70
|
+
export type RElementType = string
|
|
71
|
+
/** FN-component */
|
|
72
|
+
| AnyReactComponent
|
|
73
|
+
/** ContextProvider */
|
|
74
|
+
| {
|
|
75
|
+
$$typeof: typeof RCtxProviderSym;
|
|
76
|
+
_context: ReactContext;
|
|
77
|
+
}
|
|
78
|
+
/** Root node */
|
|
79
|
+
| null;
|
|
80
|
+
export type RStateNode = Node | RAppRoot | null;
|
|
81
|
+
export type RFiberProps = object | string | null | unknown[];
|
|
82
|
+
/**
|
|
83
|
+
* React's version of the FiberNode
|
|
84
|
+
*/
|
|
85
|
+
export type RFiber = {
|
|
86
|
+
/** Not a real field. Added it to be able to map our `fiber` by id. */
|
|
87
|
+
id: number;
|
|
88
|
+
/** Order. */
|
|
89
|
+
index: number;
|
|
90
|
+
/** Type of the fiber. */
|
|
91
|
+
tag: RFiberTag;
|
|
92
|
+
/** Jsx.Element['key'] */
|
|
93
|
+
key: string | null;
|
|
94
|
+
/** A tag name, a component fn or a special symbol. */
|
|
95
|
+
elementType: RElementType;
|
|
96
|
+
/** Seems to be an `elementType` dublicate */
|
|
97
|
+
type: RElementType;
|
|
98
|
+
stateNode: Node | null | RAppRoot;
|
|
99
|
+
/** Like FiberNode['parent']. Is set up by the dev tools. */
|
|
100
|
+
return: RFiber | null;
|
|
101
|
+
/** Like FiberNode['children'][0] */
|
|
102
|
+
child: RFiber | null;
|
|
103
|
+
/** The RFiber that lies right after this one within its parent. */
|
|
104
|
+
sibling: RFiber | null;
|
|
105
|
+
/** ? */
|
|
106
|
+
alternate: RFiber | null;
|
|
107
|
+
/** ? */
|
|
108
|
+
ref: unknown;
|
|
109
|
+
/** ? */
|
|
110
|
+
pendingProps: RFiberProps;
|
|
111
|
+
/** Props used in the last render. */
|
|
112
|
+
memoizedProps: RFiberProps;
|
|
113
|
+
memoizedState: null;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* `window.__REACT_DEVTOOLS_GLOBAL_HOOK__`.
|
|
117
|
+
*/
|
|
118
|
+
export type RDevToolsHook = {
|
|
119
|
+
renderers: Map<number, RRenderer>;
|
|
120
|
+
/**
|
|
121
|
+
* Should be called by React during start up. `renderer` is not a fully
|
|
122
|
+
* filled object. It should contain only some of the fields like `version`
|
|
123
|
+
* or HMR hooks. The rest will be filled by the React DevTools extension.
|
|
124
|
+
*/
|
|
125
|
+
inject?: (renderer: RRenderer) => number;
|
|
126
|
+
/**
|
|
127
|
+
* Should be called each time React runs the commit stage of the render.
|
|
128
|
+
*/
|
|
129
|
+
onCommitFiberRoot?: (rendererId: number, appRoot: RAppRoot, maybePriorityLevel: false, didError: boolean) => void;
|
|
130
|
+
};
|
|
131
|
+
export declare const RElementSym: unique symbol;
|
|
132
|
+
export declare const RCtxProviderSym: unique symbol;
|
|
133
|
+
/** React's JSX.ElementNode */
|
|
134
|
+
export type RJsxElementNode = {
|
|
135
|
+
$$typeof: typeof RElementSym;
|
|
136
|
+
key: ReactKey | null;
|
|
137
|
+
type: ElementType | string | typeof RElementSym;
|
|
138
|
+
props: UnknownProps;
|
|
139
|
+
ref: FiberNode['ref'];
|
|
140
|
+
};
|
|
141
|
+
/** `App['devTools']` */
|
|
142
|
+
export type AppDevTools = {
|
|
143
|
+
/** DevTools or HMR assigns a unique id (the return value from `hook.inject`) */
|
|
144
|
+
id: number | null;
|
|
145
|
+
/** window.__REACT_DEVTOOLS_GLOBAL_HOOK__. It's set by HMR or React DevTools */
|
|
146
|
+
hooks: RDevToolsHook;
|
|
147
|
+
/** Original React's `App` */
|
|
148
|
+
root: RAppRoot;
|
|
149
|
+
/** Map<old component, the freshest HMR version of it> */
|
|
150
|
+
remapped: null | WeakMap<ReactComponent, ReactComponent>;
|
|
151
|
+
/** The app's renderer object. Partly filled by us, partly by the Chrome extension. */
|
|
152
|
+
renderer: RRenderer;
|
|
153
|
+
/** A hook to be called in applyActions. */
|
|
154
|
+
onCommit: (app: App) => void;
|
|
155
|
+
};
|
|
156
|
+
export {};
|
|
157
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/devTools/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,GAAG,EACH,WAAW,EACX,SAAS,EACT,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,YAAY,EACb,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,0EAA0E;IAC1E,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;CAC9B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,SAAS,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7E;;OAEG;IACH,eAAe,CAAC,EAAE,CAChB,OAAO,EAAE,QAAQ,EACjB,MAAM,EAAE;QAEN,aAAa,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;QAE9B,eAAe,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;KACjC,KACE,IAAI,CAAC;CACX,CAAC;AAEF;;;GAGG;AACH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,EAAE,YAAY,CAAC;IACpB,GAAG,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;CACvB,CAAC;AAEF,wBAAwB;AACxB,MAAM,MAAM,WAAW,GAAG;IACxB,gFAAgF;IAChF,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,+EAA+E;IAC/E,KAAK,EAAE,aAAa,CAAC;IACrB,6BAA6B;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,yDAAyD;IACzD,QAAQ,EAAE,IAAI,GAAG,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IACzD,sFAAsF;IACtF,QAAQ,EAAE,SAAS,CAAC;IACpB,2CAA2C;IAC3C,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;CAC9B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { RFiberTag };
|
|
2
|
+
/** Type of the fiber. aka as WorkTag. */
|
|
3
|
+
var RFiberTag;
|
|
4
|
+
(function (RFiberTag) {
|
|
5
|
+
RFiberTag[RFiberTag["Root"] = 3] = "Root";
|
|
6
|
+
/** aka as HostComponent. */
|
|
7
|
+
RFiberTag[RFiberTag["Tag"] = 5] = "Tag";
|
|
8
|
+
/** FunctionComponent */
|
|
9
|
+
RFiberTag[RFiberTag["Component"] = 0] = "Component";
|
|
10
|
+
/** HostText */
|
|
11
|
+
RFiberTag[RFiberTag["Text"] = 6] = "Text";
|
|
12
|
+
/** Fragment */
|
|
13
|
+
RFiberTag[RFiberTag["Fragment"] = 7] = "Fragment";
|
|
14
|
+
/** ContextProvider */
|
|
15
|
+
RFiberTag[RFiberTag["CtxProvider"] = 10] = "CtxProvider";
|
|
16
|
+
})(RFiberTag || (RFiberTag = {}));
|
|
17
|
+
export const RElementSym = Symbol.for('react.element');
|
|
18
|
+
export const RCtxProviderSym = Symbol.for('react.provider');
|
|
19
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/devTools/types.ts"],"names":[],"mappings":"SAiFY,SAAS;AADrB,yCAAyC;AACzC,IAAY,SAYX;AAZD,WAAY,SAAS;IACnB,yCAAQ,CAAA;IACR,4BAA4B;IAC5B,uCAAO,CAAA;IACP,wBAAwB;IACxB,mDAAa,CAAA;IACb,eAAe;IACf,yCAAQ,CAAA;IACR,eAAe;IACf,iDAAY,CAAA;IACZ,sBAAsB;IACtB,wDAAgB,CAAA;AAAC,CACnB,EAZY,SAAS,KAAT,SAAS,QAYpB;AA4FD,MAAM,CAAC,MAAM,WAAW,GAAkB,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AACtE,MAAM,CAAC,MAAM,eAAe,GAAkB,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../../src/core/preact/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,GAAG,EAAkB,MAAM,oBAAoB,CAAC;AAkB5E,eAAO,MAAM,cAAc,oBAwB1B,CAAC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { containerSym } from '../../types';
|
|
2
|
+
import { PreactVNodeFields as F, PREACT_VERSION, PreactFragmentComponent, } from './types';
|
|
3
|
+
import { fiberToVNode } from './toVNode';
|
|
4
|
+
import { isContainerFiber } from '../reconciliation/typeGuards';
|
|
5
|
+
import { patchedPreactRendererInspect } from './inspect';
|
|
6
|
+
import { isJsxElementNode } from '../reconciliation/fibers';
|
|
7
|
+
import { patchedPreactRendererUpdate } from './update';
|
|
8
|
+
export const preactDevTools = (app) => {
|
|
9
|
+
const globalHook = window.__PREACT_DEVTOOLS__ ??
|
|
10
|
+
null;
|
|
11
|
+
if (!globalHook)
|
|
12
|
+
return;
|
|
13
|
+
const rendererId = globalHook.attachPreact(PREACT_VERSION, hooks, {
|
|
14
|
+
Fragment: PreactFragmentComponent,
|
|
15
|
+
// It's also possible to pass the Component class here, but since the lib
|
|
16
|
+
// doesn't support components directly it doesn't make sense.
|
|
17
|
+
});
|
|
18
|
+
const renderer = globalHook.renderers.get(rendererId);
|
|
19
|
+
patchRenderer(app, renderer);
|
|
20
|
+
const invalidated = new Set([app.root.id]);
|
|
21
|
+
app.preact = {
|
|
22
|
+
global: globalHook,
|
|
23
|
+
api: {},
|
|
24
|
+
invalidated,
|
|
25
|
+
userRootVNode: null,
|
|
26
|
+
renderer,
|
|
27
|
+
};
|
|
28
|
+
createPreactApi(app, invalidated);
|
|
29
|
+
};
|
|
30
|
+
const createPreactApi = (app, invalidated) => {
|
|
31
|
+
Object.assign(app.preact.api, {
|
|
32
|
+
afterRender: afterRenderHook.bind(null, app.preact, app.root, invalidated),
|
|
33
|
+
unmount: unmountHook,
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
const afterRenderHook = (adapter, rootFiber, invalidated) => {
|
|
37
|
+
if (!adapter.userRootVNode) {
|
|
38
|
+
adapter.userRootVNode = fiberToVNode(rootFiber.children[0], 0, false);
|
|
39
|
+
hooks._root(adapter.userRootVNode, rootFiber.element);
|
|
40
|
+
}
|
|
41
|
+
/** Root of what have been rerendered. On the 1st render is the root node. */
|
|
42
|
+
const topNodes = new Set();
|
|
43
|
+
// Traverse the whole fiber tree from the root. Consider every node to be
|
|
44
|
+
// intact unless `invalidated` has it or one of its parents.
|
|
45
|
+
iteratee(invalidated, topNodes, adapter.userRootVNode, rootFiber, 0, true);
|
|
46
|
+
// Top nodes is filled with the top-level rerendered nodes. Inform Preact
|
|
47
|
+
// DevTools about them. It'll traverse through the vnode tree and send a
|
|
48
|
+
// message to the Chrome DevTools app.
|
|
49
|
+
for (const vnode of topNodes) {
|
|
50
|
+
hooks._commit(vnode, []);
|
|
51
|
+
}
|
|
52
|
+
invalidated.clear();
|
|
53
|
+
};
|
|
54
|
+
const unmountHook = (fiber) => {
|
|
55
|
+
hooks.unmount(fiberToVNode(fiber, 0, false));
|
|
56
|
+
};
|
|
57
|
+
/** Handle a single fiber node. */
|
|
58
|
+
const iteratee = (
|
|
59
|
+
// Generic arguments
|
|
60
|
+
invalidated, topNodes, userRootVNode,
|
|
61
|
+
// Fiber arguments
|
|
62
|
+
fiber, idx,
|
|
63
|
+
/** If true we shouldn't care much about this node. Only about its invalidated
|
|
64
|
+
* children if it has any. */
|
|
65
|
+
skip) => {
|
|
66
|
+
if (fiber.type === 'null') {
|
|
67
|
+
// Unlike React Preact doesn't create a vnode object for the null values.
|
|
68
|
+
// It uses `null` instead.
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
// It might be a new node or the previously created node depending on the context.
|
|
72
|
+
const vnode = fiber.id === userRootVNode[F.id]
|
|
73
|
+
? // It's createRoot().render(userRootVNode). So it never changes. It's
|
|
74
|
+
// cached after `hooks._root` call on the dev tools side. Thus we'd better
|
|
75
|
+
// cache it too.
|
|
76
|
+
userRootVNode
|
|
77
|
+
: fiberToVNode(fiber, idx, !skip);
|
|
78
|
+
// Container-nodes must refer to their 1st real DOM child.
|
|
79
|
+
vnode[F.element] ??= find1stDomElement(fiber);
|
|
80
|
+
const isInvalidated = invalidated.has(fiber.id);
|
|
81
|
+
if (skip && isInvalidated) {
|
|
82
|
+
// We found a node that was invalidated in the previous render, whereas its
|
|
83
|
+
// parent nodes were intact. Thus we override `skip` to treat its children
|
|
84
|
+
// as changed too.
|
|
85
|
+
skip = false;
|
|
86
|
+
topNodes.add(vnode); // Run `_commit` for this node.
|
|
87
|
+
}
|
|
88
|
+
if (!skip) {
|
|
89
|
+
if (!vnode.registered) {
|
|
90
|
+
hooks.vnode(vnode);
|
|
91
|
+
vnode.registered = true;
|
|
92
|
+
}
|
|
93
|
+
hooks._diff(vnode);
|
|
94
|
+
}
|
|
95
|
+
if (isContainerFiber(fiber)) {
|
|
96
|
+
if (!skip) {
|
|
97
|
+
hooks._render(vnode);
|
|
98
|
+
}
|
|
99
|
+
vnode[F.children].length = 0;
|
|
100
|
+
for (const [idx, childFiber] of fiber.children.entries()) {
|
|
101
|
+
const childVNode = iteratee(invalidated, topNodes, userRootVNode, childFiber, idx, skip);
|
|
102
|
+
vnode[F.children].push(childVNode);
|
|
103
|
+
if (childVNode) {
|
|
104
|
+
childVNode[F.parent] = vnode;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (fiber.type === 'component') {
|
|
108
|
+
// After this hack the children nodes in props are shown as <Child/> & <div/>.
|
|
109
|
+
tryConvertComponentChildren(vnode);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (!skip) {
|
|
113
|
+
hooks.diffed(vnode);
|
|
114
|
+
}
|
|
115
|
+
return vnode;
|
|
116
|
+
};
|
|
117
|
+
const find1stDomElement = (fiber) => {
|
|
118
|
+
if (fiber.element instanceof Comment) {
|
|
119
|
+
return undefined; // Preact doesn't use HTML comments.
|
|
120
|
+
}
|
|
121
|
+
const [first] = fiber.children;
|
|
122
|
+
return first.element === containerSym
|
|
123
|
+
? find1stDomElement(first)
|
|
124
|
+
: first.element instanceof Comment
|
|
125
|
+
? undefined
|
|
126
|
+
: (first.element ?? undefined);
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Preact shows `props.children` in a neat way when they are vnodes.
|
|
130
|
+
*/
|
|
131
|
+
const tryConvertComponentChildren = (vnode) => {
|
|
132
|
+
const { props } = vnode;
|
|
133
|
+
if (!props || typeof props !== 'object' || !('children' in props)) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const children = Array.isArray(props.children)
|
|
137
|
+
? [...props.children]
|
|
138
|
+
: [props.children];
|
|
139
|
+
let replaced = false;
|
|
140
|
+
for (const [idx, child] of children.entries()) {
|
|
141
|
+
if (isJsxElementNode(child)) {
|
|
142
|
+
replaced = true;
|
|
143
|
+
children[idx] = {
|
|
144
|
+
// Minimal subset of PreactNode needed for preview in the props panel.
|
|
145
|
+
[F.element]: vnode[F.element],
|
|
146
|
+
type: child.type,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (replaced) {
|
|
151
|
+
props.children = Array.isArray(props.children) ? children : children[0];
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
/** Preact hooks. Preact fills this object with methods in the `attachPreact` call. */
|
|
155
|
+
const hooks = {};
|
|
156
|
+
const patchRenderer = (app, renderer) => {
|
|
157
|
+
// It's easier to wrap these methods than support their internals. Can be
|
|
158
|
+
// broken with new Preact DevTools releases though.
|
|
159
|
+
renderer.inspect = patchedPreactRendererInspect.bind(null, app, renderer);
|
|
160
|
+
renderer.update = patchedPreactRendererUpdate.bind(null, app, renderer);
|
|
161
|
+
};
|
|
162
|
+
//# sourceMappingURL=connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../../src/core/preact/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA4B,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EACL,iBAAiB,IAAI,CAAC,EACtB,cAAc,EACd,uBAAuB,GAOxB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAEvD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAQ,EAAQ,EAAE,CAAC;IAChD,MAAM,UAAU,GACb,MAAmD,CAAC,mBAAmB;QACxE,IAAI,CAAC;IACP,IAAI,CAAC,UAAU;QAAE,OAAO;IAExB,MAAM,UAAU,GAAG,UAAU,CAAC,YAAY,CAAC,cAAc,EAAE,KAAK,EAAE;QAChE,QAAQ,EAAE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AAC,GAAG;gBACd,sEAAsE;gBACtE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;gBAC7B,IAAI,EAAE,KAAK,CAAC,IAAc;aAC3B,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACb,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC;AAAA,CACF,CAAC;AAEF,sFAAsF;AACtF,MAAM,KAAK,GAAG,EAA8B,CAAC;AAE7C,MAAM,aAAa,GAAG,CAAC,GAAQ,EAAE,QAAwB,EAAQ,EAAE,CAAC;IAClE,yEAAyE;IACzE,mDAAmD;IACnD,QAAQ,CAAC,OAAO,GAAG,4BAA4B,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC1E,QAAQ,CAAC,MAAM,GAAG,2BAA2B,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;AAAA,CACzE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ElementNode } from '../../types';
|
|
2
|
+
/** Prepare the given arbitrary value to be send to the DevTools. */
|
|
3
|
+
export declare const marshall: (value: unknown) => unknown;
|
|
4
|
+
export declare const domNodeLabel: (node: Node) => {
|
|
5
|
+
type: string;
|
|
6
|
+
name: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const jsxNodeLabel: (jsx: ElementNode) => {
|
|
9
|
+
type: string;
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/core/preact/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,oEAAoE;AACpE,eAAO,MAAM,QAAQ,6BAqBpB,CAAC;AAWF,eAAO,MAAM,YAAY;;;CAUvB,CAAC;AAEH,eAAO,MAAM,YAAY;;;CAcxB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { isJsxElementNode } from '../reconciliation/fibers';
|
|
2
|
+
/** Prepare the given arbitrary value to be send to the DevTools. */
|
|
3
|
+
export const marshall = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
const result = iteratee(value);
|
|
6
|
+
if (result !== value) {
|
|
7
|
+
return result; // Custom presentation.
|
|
8
|
+
}
|
|
9
|
+
if (Array.isArray(value)) {
|
|
10
|
+
return value.map((v) => marshall(v));
|
|
11
|
+
}
|
|
12
|
+
if (typeof value === 'object' && !!value) {
|
|
13
|
+
return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, marshall(v)]));
|
|
14
|
+
}
|
|
15
|
+
return value; // Scalar value.
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return `Could not serialize data`; // E.g., circular references.
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const iteratee = (v) => v instanceof Node
|
|
22
|
+
? domNodeLabel(v)
|
|
23
|
+
: typeof v === 'function'
|
|
24
|
+
? { type: 'function', name: v.name ?? 'anonymous' }
|
|
25
|
+
: isJsxElementNode(v)
|
|
26
|
+
? jsxNodeLabel(v)
|
|
27
|
+
: v;
|
|
28
|
+
export const domNodeLabel = (node) => ({
|
|
29
|
+
type: 'html',
|
|
30
|
+
name: node instanceof Element
|
|
31
|
+
? `<${node.tagName.toLowerCase()} />`
|
|
32
|
+
: node instanceof Text
|
|
33
|
+
? `#(${node.textContent.slice(0, 30)}…)`
|
|
34
|
+
: node instanceof Comment
|
|
35
|
+
? `<!--${node.textContent.slice(0, 30)}…-->`
|
|
36
|
+
: `unknown DOM node`,
|
|
37
|
+
});
|
|
38
|
+
export const jsxNodeLabel = (jsx) => {
|
|
39
|
+
const tagName = typeof jsx.type === 'string'
|
|
40
|
+
? jsx.type // Tag name
|
|
41
|
+
: typeof jsx.type === 'function'
|
|
42
|
+
? jsx.type.name // Component name
|
|
43
|
+
: jsx.type
|
|
44
|
+
? `portal:${jsx.type.tagName.toLowerCase()}`
|
|
45
|
+
: `unknown`;
|
|
46
|
+
const props = Object.keys(jsx.props).join(' ');
|
|
47
|
+
return {
|
|
48
|
+
type: 'html',
|
|
49
|
+
name: `<${tagName}${props ? ` ${props}` : ''}/>`,
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/core/preact/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,oEAAoE;AACpE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAW,EAAE,CAAC;IACnD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC/B,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;YACrB,OAAO,MAAM,CAAC,CAAC,uBAAuB;QACxC,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC;QAED,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;YACzC,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,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,CAAC,IAAI,CAAC,WAAW;QACtB,CAAC,CAAC,OAAO,GAAG,CAAC,IAAI,KAAK,UAAU;YAC9B,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB;YACjC,CAAC,CAAC,GAAG,CAAC,IAAI;gBACR,CAAC,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE;gBAC5C,CAAC,CAAC,SAAS,CAAC;IACpB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,IAAI,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI;KACjD,CAAC;AAAA,CACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { App } from '../../types';
|
|
2
|
+
import { type PreactInspection, type PreactRenderer } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* A custom version of `PreactRenderer.inspect`. It is simpler to write our own
|
|
5
|
+
* implementation with the same signature and output shape than to support its
|
|
6
|
+
* internal hook detection approach.
|
|
7
|
+
*/
|
|
8
|
+
export declare const patchedPreactRendererInspect: (app: App, renderer: PreactRenderer, devToolsNodeId: number) => PreactInspection;
|
|
9
|
+
//# sourceMappingURL=inspect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../../src/core/preact/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,GAAG,EAOJ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AAOjB;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,kFA2BxC,CAAC"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { PREACT_VERSION, PreactVNodeType, } from './types';
|
|
2
|
+
import { findFiberById } from '../actions/helpers';
|
|
3
|
+
import { getPreactProps } from './toVNode';
|
|
4
|
+
import { nullthrows } from '../../utils';
|
|
5
|
+
import { marshall } from './helpers';
|
|
6
|
+
import { isJsxElementNode } from '../reconciliation/fibers';
|
|
7
|
+
/**
|
|
8
|
+
* A custom version of `PreactRenderer.inspect`. It is simpler to write our own
|
|
9
|
+
* implementation with the same signature and output shape than to support its
|
|
10
|
+
* internal hook detection approach.
|
|
11
|
+
*/
|
|
12
|
+
export const patchedPreactRendererInspect = (app, renderer, devToolsNodeId) => {
|
|
13
|
+
const vnode = nullthrows(renderer.getVNodeById(devToolsNodeId));
|
|
14
|
+
// prettier-ignore
|
|
15
|
+
const fiber = nullthrows(findFiberById(app.root, vnode.__v));
|
|
16
|
+
return {
|
|
17
|
+
canSuspend: false,
|
|
18
|
+
key: fiber.key,
|
|
19
|
+
id: devToolsNodeId,
|
|
20
|
+
state: null, // This lib doesn't support class components directly.
|
|
21
|
+
signals: null,
|
|
22
|
+
suspended: false,
|
|
23
|
+
props: marshall(getPreactProps(fiber)),
|
|
24
|
+
name: getFiberName(fiber),
|
|
25
|
+
version: PREACT_VERSION,
|
|
26
|
+
hooks: getHooksInfo(fiber),
|
|
27
|
+
context: null, // Probably for class components.
|
|
28
|
+
type: PreactVNodeType.FN_COMPONENT,
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
const getFiberName = (fiber) => {
|
|
32
|
+
return fiber.component
|
|
33
|
+
? (fiber.component.displayName ?? fiber.component.name)
|
|
34
|
+
: fiber.role === 'context'
|
|
35
|
+
? (fiber.data.ctx.displayName ?? 'Context')
|
|
36
|
+
: fiber.role === 'portal'
|
|
37
|
+
? 'Portal'
|
|
38
|
+
: 'unknown';
|
|
39
|
+
};
|
|
40
|
+
const getHooksInfo = (fiber) => {
|
|
41
|
+
if (fiber.type !== 'component') {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
const hooks = fiber.data.hooks.flatMap((hook, idx) => getHookInfo(fiber, hook, idx));
|
|
45
|
+
// Preact DevTools support capturing hooks as a tree. But it's too much hassle
|
|
46
|
+
// to support it properly.
|
|
47
|
+
return [
|
|
48
|
+
{
|
|
49
|
+
...ROOT_HOOK,
|
|
50
|
+
children: hooks.filter((h) => h.depth === 1).map((h) => h.id),
|
|
51
|
+
},
|
|
52
|
+
...hooks,
|
|
53
|
+
];
|
|
54
|
+
};
|
|
55
|
+
const getHookInfo = (fiber, hook, idx) => {
|
|
56
|
+
const hookType = hook.type === 'effect' && hook.mode === 'layout'
|
|
57
|
+
? 'layoutEffect'
|
|
58
|
+
: hook.type;
|
|
59
|
+
const type = 'use' + hookType[0].toUpperCase() + hookType.slice(1);
|
|
60
|
+
const id = `${fiber.id}:${idx}`;
|
|
61
|
+
const [value, subItems] = getHookValue(id, hook);
|
|
62
|
+
return [
|
|
63
|
+
{
|
|
64
|
+
children: subItems.map((si) => si.id),
|
|
65
|
+
depth: 1,
|
|
66
|
+
editable: false,
|
|
67
|
+
id,
|
|
68
|
+
name: type,
|
|
69
|
+
type: 'undefined', // For all internal hooks it's `undefined`.
|
|
70
|
+
value,
|
|
71
|
+
index: idx,
|
|
72
|
+
meta: { index: idx, type },
|
|
73
|
+
},
|
|
74
|
+
...subItems,
|
|
75
|
+
];
|
|
76
|
+
};
|
|
77
|
+
const getHookValue = (id, hook) => {
|
|
78
|
+
switch (hook.type) {
|
|
79
|
+
case 'state':
|
|
80
|
+
return valueToHooks(id, hook.state);
|
|
81
|
+
case 'memo':
|
|
82
|
+
return valueToHooks(id, hook.value);
|
|
83
|
+
case 'context':
|
|
84
|
+
const closest = hook.providerFiber;
|
|
85
|
+
return valueToHooks(id, closest ? closest.props.value : hook.ctx.__default);
|
|
86
|
+
case 'effect':
|
|
87
|
+
case 'error':
|
|
88
|
+
return [{ type: 'function', name: 'anonymous' }, []];
|
|
89
|
+
case 'ref': {
|
|
90
|
+
const value = hook.value.current;
|
|
91
|
+
return value instanceof Node
|
|
92
|
+
? [marshall(value), []]
|
|
93
|
+
: valueToHooks(id, value);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const valueToHooks = (parentId, data) => {
|
|
98
|
+
if (typeof data !== 'object' || data === null) {
|
|
99
|
+
return [marshall(data), []];
|
|
100
|
+
}
|
|
101
|
+
const path = [parentId];
|
|
102
|
+
const iteratee = (value) => {
|
|
103
|
+
const objHookId = path.join('|');
|
|
104
|
+
const objHook = {
|
|
105
|
+
...SCALAR_HOOK,
|
|
106
|
+
id: objHookId,
|
|
107
|
+
depth: path.length + 1,
|
|
108
|
+
type: Array.isArray(value) ? 'array' : 'object',
|
|
109
|
+
name: path.at(-1),
|
|
110
|
+
value: marshall(value), // Not used
|
|
111
|
+
};
|
|
112
|
+
const children = [];
|
|
113
|
+
for (const [k, v] of Array.isArray(value)
|
|
114
|
+
? value.entries()
|
|
115
|
+
: Object.entries(value)) {
|
|
116
|
+
if (typeof v === 'object' &&
|
|
117
|
+
v &&
|
|
118
|
+
!(v instanceof Node) &&
|
|
119
|
+
!isJsxElementNode(v) &&
|
|
120
|
+
path.length <= MAX_OBJ_DEPTH) {
|
|
121
|
+
path.push(String(k));
|
|
122
|
+
children.push(...iteratee(v));
|
|
123
|
+
path.pop();
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
children.push({
|
|
127
|
+
...SCALAR_HOOK,
|
|
128
|
+
id: `${objHookId}|${k}`,
|
|
129
|
+
depth: path.length + 2,
|
|
130
|
+
type: typeof v,
|
|
131
|
+
name: k,
|
|
132
|
+
value: marshall(v),
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
objHook.children = children
|
|
137
|
+
.filter((c) => c.depth === objHook.depth + 1)
|
|
138
|
+
.map((c) => c.id);
|
|
139
|
+
return [objHook, ...children];
|
|
140
|
+
};
|
|
141
|
+
const subhooks = iteratee(data)
|
|
142
|
+
// Skip the base hook.
|
|
143
|
+
.slice(1);
|
|
144
|
+
return [marshall(data), subhooks];
|
|
145
|
+
};
|
|
146
|
+
const MAX_OBJ_DEPTH = 4;
|
|
147
|
+
// A dummy node to extend with custom values.
|
|
148
|
+
const SCALAR_HOOK = {
|
|
149
|
+
children: [],
|
|
150
|
+
depth: -1,
|
|
151
|
+
editable: false,
|
|
152
|
+
id: '',
|
|
153
|
+
meta: null,
|
|
154
|
+
name: '',
|
|
155
|
+
type: '',
|
|
156
|
+
value: null,
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Preact DevTools renders a tree of hooks/values where this node is the root
|
|
160
|
+
* node.
|
|
161
|
+
*/
|
|
162
|
+
const ROOT_HOOK = {
|
|
163
|
+
...SCALAR_HOOK,
|
|
164
|
+
depth: 0,
|
|
165
|
+
id: 'root',
|
|
166
|
+
name: 'root',
|
|
167
|
+
type: 'object',
|
|
168
|
+
};
|
|
169
|
+
//# sourceMappingURL=inspect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect.js","sourceRoot":"","sources":["../../../src/core/preact/inspect.ts"],"names":[],"mappings":"AASA,OAAO,EACL,cAAc,EACd,eAAe,GAIhB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAC1C,GAAQ,EACR,QAAwB,EACxB,cAAsB,EACJ,EAAE,CAAC;IACrB,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,cAA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
+
import { type PreactVNode } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Converts the given fiber node to a Preact VNode.
|
|
5
|
+
*/
|
|
6
|
+
export declare const fiberToVNode: (fiber: FiberNode, idx: number, skipCache: boolean) => PreactVNode;
|
|
7
|
+
/**
|
|
8
|
+
* Returns `PreactVNode.props` + `__c.props`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const getPreactProps: (fiber: FiberNode) => UnknownProps;
|
|
11
|
+
//# sourceMappingURL=toVNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toVNode.d.ts","sourceRoot":"","sources":["../../../src/core/preact/toVNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EAGT,YAAY,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,SAAS,CAAC;AAKjB;;GAEG;AACH,eAAO,MAAM,YAAY,oEAgBxB,CAAC;AAwGF;;GAEG;AACH,eAAO,MAAM,cAAc,oCAuB1B,CAAC"}
|