@kunpeng-js/properties-panel 2026.0.0-alpha2 → 2026.10.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/LICENSE +9 -2
- package/dist/index.esm.js +3760 -3762
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3724 -3804
- package/dist/index.js.map +1 -1
- package/package.json +22 -48
- package/preact/README.md +5 -5
- package/preact/compat/client.d.ts +1 -3
- package/preact/compat/dist/compat.mjs +2 -2
- package/preact/compat/dist/compat.mjs.map +1 -0
- package/preact/compat/package.json +2 -41
- package/preact/compat/scheduler.d.ts +12 -0
- package/preact/compat/server.d.ts +17 -0
- package/preact/compat/src/Children.js +3 -3
- package/preact/compat/src/PureComponent.js +20 -12
- package/preact/compat/src/forwardRef.js +4 -17
- package/preact/compat/src/hooks.js +17 -51
- package/preact/compat/src/index.d.ts +249 -164
- package/preact/compat/src/index.js +52 -43
- package/preact/compat/src/internal.d.ts +1 -2
- package/preact/compat/src/memo.js +2 -2
- package/preact/compat/src/portals.js +2 -68
- package/preact/compat/src/render.js +182 -73
- package/preact/compat/src/suspense.d.ts +1 -3
- package/preact/compat/src/suspense.js +169 -179
- package/preact/compat/src/util.js +5 -22
- package/preact/debug/dist/debug.mjs +2 -2
- package/preact/debug/dist/debug.mjs.map +1 -0
- package/preact/debug/package.json +3 -14
- package/preact/debug/src/check-props.js +2 -6
- package/preact/debug/src/component-stack.js +67 -16
- package/preact/debug/src/debug.js +80 -35
- package/preact/debug/src/index.d.ts +11 -1
- package/preact/debug/src/index.js +3 -1
- package/preact/debug/src/util.js +1 -11
- package/preact/devtools/dist/devtools.mjs +2 -2
- package/preact/devtools/dist/devtools.mjs.map +1 -0
- package/preact/devtools/package.json +3 -15
- package/preact/devtools/src/devtools.js +1 -1
- package/preact/dist/preact.mjs +2 -2
- package/preact/dist/preact.mjs.map +1 -0
- package/preact/hooks/dist/hooks.mjs +2 -2
- package/preact/hooks/dist/hooks.mjs.map +1 -0
- package/preact/hooks/package.json +5 -24
- package/preact/hooks/src/index.d.ts +6 -13
- package/preact/hooks/src/index.js +95 -73
- package/preact/hooks/src/internal.d.ts +8 -3
- package/preact/jsx-runtime/dist/jsxRuntime.mjs +2 -2
- package/preact/jsx-runtime/dist/jsxRuntime.mjs.map +1 -0
- package/preact/jsx-runtime/package.json +4 -16
- package/preact/jsx-runtime/src/index.d.ts +11 -11
- package/preact/jsx-runtime/src/index.js +25 -40
- package/preact/jsx-runtime/src/utils.js +3 -3
- package/preact/package.json +59 -115
- package/preact/src/component.js +54 -47
- package/preact/src/constants.js +17 -2
- package/preact/src/create-context.js +4 -14
- package/preact/src/create-element.js +42 -17
- package/preact/src/create-portal.js +20 -0
- package/preact/src/diff/catch-error.js +26 -8
- package/preact/src/diff/children.js +158 -96
- package/preact/src/diff/index.js +265 -146
- package/preact/src/diff/props.js +39 -50
- package/preact/src/dom.d.ts +796 -147
- package/preact/src/index.d.ts +7 -18
- package/preact/src/index.js +2 -1
- package/preact/src/internal.d.ts +16 -24
- package/preact/src/jsx.d.ts +222 -2910
- package/preact/src/render.js +30 -34
- package/preact/src/util.js +5 -20
- package/preact/test-utils/dist/testUtils.mjs +1 -1
- package/preact/test-utils/dist/testUtils.mjs.map +1 -0
- package/preact/test-utils/package.json +5 -17
- package/README.md +0 -35
- package/preact/compat/dist/compat.js +0 -2
- package/preact/compat/dist/compat.js.map +0 -1
- package/preact/compat/dist/compat.module.js +0 -2
- package/preact/compat/dist/compat.module.js.map +0 -1
- package/preact/compat/dist/compat.umd.js +0 -2
- package/preact/compat/dist/compat.umd.js.map +0 -1
- package/preact/compat/src/suspense-list.d.ts +0 -16
- package/preact/compat/src/suspense-list.js +0 -127
- package/preact/debug/dist/debug.js +0 -2
- package/preact/debug/dist/debug.js.map +0 -1
- package/preact/debug/dist/debug.module.js +0 -2
- package/preact/debug/dist/debug.module.js.map +0 -1
- package/preact/debug/dist/debug.umd.js +0 -2
- package/preact/debug/dist/debug.umd.js.map +0 -1
- package/preact/devtools/dist/devtools.js +0 -2
- package/preact/devtools/dist/devtools.js.map +0 -1
- package/preact/devtools/dist/devtools.module.js +0 -2
- package/preact/devtools/dist/devtools.module.js.map +0 -1
- package/preact/devtools/dist/devtools.umd.js +0 -2
- package/preact/devtools/dist/devtools.umd.js.map +0 -1
- package/preact/dist/preact.js +0 -2
- package/preact/dist/preact.js.map +0 -1
- package/preact/dist/preact.min.js +0 -2
- package/preact/dist/preact.min.js.map +0 -1
- package/preact/dist/preact.min.module.js +0 -2
- package/preact/dist/preact.min.module.js.map +0 -1
- package/preact/dist/preact.min.umd.js +0 -2
- package/preact/dist/preact.min.umd.js.map +0 -1
- package/preact/dist/preact.module.js +0 -2
- package/preact/dist/preact.module.js.map +0 -1
- package/preact/dist/preact.umd.js +0 -2
- package/preact/dist/preact.umd.js.map +0 -1
- package/preact/hooks/dist/hooks.js +0 -2
- package/preact/hooks/dist/hooks.js.map +0 -1
- package/preact/hooks/dist/hooks.module.js +0 -2
- package/preact/hooks/dist/hooks.module.js.map +0 -1
- package/preact/hooks/dist/hooks.umd.js +0 -2
- package/preact/hooks/dist/hooks.umd.js.map +0 -1
- package/preact/jsx-runtime/dist/jsxRuntime.js +0 -2
- package/preact/jsx-runtime/dist/jsxRuntime.js.map +0 -1
- package/preact/jsx-runtime/dist/jsxRuntime.module.js +0 -2
- package/preact/jsx-runtime/dist/jsxRuntime.module.js.map +0 -1
- package/preact/jsx-runtime/dist/jsxRuntime.umd.js +0 -2
- package/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +0 -1
- package/preact/src/cjs.js +0 -3
- package/preact/src/clone-element.js +0 -48
- package/preact/src/index-5.d.ts +0 -399
- package/preact/test-utils/dist/testUtils.js +0 -2
- package/preact/test-utils/dist/testUtils.js.map +0 -1
- package/preact/test-utils/dist/testUtils.module.js +0 -2
- package/preact/test-utils/dist/testUtils.module.js.map +0 -1
- package/preact/test-utils/dist/testUtils.umd.js +0 -2
- package/preact/test-utils/dist/testUtils.umd.js.map +0 -1
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "preact-debug",
|
|
3
|
-
"amdName": "preactDebug",
|
|
4
|
-
"version": "1.0.0",
|
|
5
3
|
"private": true,
|
|
6
4
|
"description": "Preact extensions for development",
|
|
7
|
-
"main": "dist/debug.
|
|
8
|
-
"module": "dist/debug.
|
|
9
|
-
"umd:main": "dist/debug.umd.js",
|
|
5
|
+
"main": "dist/debug.mjs",
|
|
6
|
+
"module": "dist/debug.mjs",
|
|
10
7
|
"source": "src/index.js",
|
|
8
|
+
"types": "src/index.d.ts",
|
|
11
9
|
"license": "MIT",
|
|
12
10
|
"mangle": {
|
|
13
11
|
"regex": "^(?!_renderer)^_"
|
|
14
12
|
},
|
|
15
13
|
"peerDependencies": {
|
|
16
14
|
"preact": "^10.0.0"
|
|
17
|
-
},
|
|
18
|
-
"exports": {
|
|
19
|
-
".": {
|
|
20
|
-
"types": "./src/index.d.ts",
|
|
21
|
-
"browser": "./dist/debug.module.js",
|
|
22
|
-
"umd": "./dist/debug.umd.js",
|
|
23
|
-
"import": "./dist/debug.mjs",
|
|
24
|
-
"require": "./dist/debug.js"
|
|
25
|
-
}
|
|
26
15
|
}
|
|
27
16
|
}
|
|
@@ -19,7 +19,7 @@ export function resetPropWarnings() {
|
|
|
19
19
|
* @param {object} values Runtime values that need to be type-checked
|
|
20
20
|
* @param {string} location e.g. "prop", "context", "child context"
|
|
21
21
|
* @param {string} componentName Name of the component for error messages.
|
|
22
|
-
* @param {
|
|
22
|
+
* @param {Function} getStack Returns the component stack.
|
|
23
23
|
*/
|
|
24
24
|
export function checkPropTypes(
|
|
25
25
|
typeSpecs,
|
|
@@ -44,11 +44,7 @@ export function checkPropTypes(
|
|
|
44
44
|
}
|
|
45
45
|
if (error && !(error.message in loggedTypeFailures)) {
|
|
46
46
|
loggedTypeFailures[error.message] = true;
|
|
47
|
-
console.error(
|
|
48
|
-
`Failed ${location} type: ${error.message}${
|
|
49
|
-
(getStack && `\n${getStack()}`) || ''
|
|
50
|
-
}`
|
|
51
|
-
);
|
|
47
|
+
console.error(`Failed ${location} type: ${error.message}\n${getStack()}`);
|
|
52
48
|
}
|
|
53
49
|
});
|
|
54
50
|
}
|
|
@@ -2,7 +2,7 @@ import { options, Fragment } from '../..';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Get human readable name of the component/dom node
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* @param {import('./internal').VNode} vnode
|
|
7
7
|
* @returns {string}
|
|
8
8
|
*/
|
|
@@ -40,10 +40,20 @@ let renderStack = [];
|
|
|
40
40
|
* ```
|
|
41
41
|
*
|
|
42
42
|
* Note: A `vnode` may be hoisted to the root scope due to compiler
|
|
43
|
-
* optimiztions. In these cases the
|
|
43
|
+
* optimiztions. In these cases the owner will be different.
|
|
44
44
|
*/
|
|
45
45
|
let ownerStack = [];
|
|
46
46
|
|
|
47
|
+
const ownerMap = new WeakMap();
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The stack lengths from before each component `vnode` that is still being
|
|
51
|
+
* diffed. Restoring them afterwards, rather than popping, keeps the stacks
|
|
52
|
+
* right when a descendant threw or the component didn't render.
|
|
53
|
+
* @type {WeakMap<import('./internal').VNode, [number, number]>}
|
|
54
|
+
*/
|
|
55
|
+
const stackLevels = new WeakMap();
|
|
56
|
+
|
|
47
57
|
/**
|
|
48
58
|
* Get the currently rendered `vnode`
|
|
49
59
|
* @returns {import('./internal').VNode | null}
|
|
@@ -76,9 +86,8 @@ function isPossibleOwner(vnode) {
|
|
|
76
86
|
export function getOwnerStack(vnode) {
|
|
77
87
|
const stack = [vnode];
|
|
78
88
|
let next = vnode;
|
|
79
|
-
while (next.
|
|
80
|
-
stack.push(next
|
|
81
|
-
next = next._owner;
|
|
89
|
+
while ((next = ownerMap.get(next)) != null) {
|
|
90
|
+
stack.push(next);
|
|
82
91
|
}
|
|
83
92
|
|
|
84
93
|
return stack.reduce((acc, owner) => {
|
|
@@ -106,33 +115,66 @@ export function getOwnerStack(vnode) {
|
|
|
106
115
|
export function setupComponentStack() {
|
|
107
116
|
let oldDiff = options._diff;
|
|
108
117
|
let oldDiffed = options.diffed;
|
|
109
|
-
let oldRoot = options._root;
|
|
110
118
|
let oldVNode = options.vnode;
|
|
111
119
|
let oldRender = options._render;
|
|
120
|
+
let oldCatchError = options._catchError;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @param {[number, number]} level
|
|
124
|
+
* @param {number} renderLength
|
|
125
|
+
* @param {number} ownerLength
|
|
126
|
+
*/
|
|
127
|
+
const restore = (level, renderLength, ownerLength) => {
|
|
128
|
+
renderStack.length = Math.min(renderStack.length, level[0] + renderLength);
|
|
129
|
+
ownerStack.length = Math.min(ownerStack.length, level[1] + ownerLength);
|
|
130
|
+
};
|
|
112
131
|
|
|
113
132
|
options.diffed = vnode => {
|
|
114
|
-
|
|
115
|
-
|
|
133
|
+
const level = stackLevels.get(vnode);
|
|
134
|
+
if (level) {
|
|
135
|
+
stackLevels.delete(vnode);
|
|
136
|
+
restore(level, 0, 0);
|
|
116
137
|
}
|
|
117
|
-
renderStack.pop();
|
|
118
138
|
if (oldDiffed) oldDiffed(vnode);
|
|
119
139
|
};
|
|
120
140
|
|
|
121
141
|
options._diff = vnode => {
|
|
122
|
-
if (
|
|
123
|
-
|
|
142
|
+
if (typeof vnode.type == 'function') {
|
|
143
|
+
stackLevels.set(vnode, [renderStack.length, ownerStack.length]);
|
|
144
|
+
if (vnode.type != Fragment) renderStack.push(vnode);
|
|
124
145
|
}
|
|
125
146
|
if (oldDiff) oldDiff(vnode);
|
|
126
147
|
};
|
|
127
148
|
|
|
128
|
-
options.
|
|
129
|
-
|
|
130
|
-
|
|
149
|
+
options._catchError = (error, vnode, oldVNode, errorInfo) => {
|
|
150
|
+
// Errors from commits and effects arrive for components that aren't
|
|
151
|
+
// being diffed, and leave the stacks alone.
|
|
152
|
+
const level = stackLevels.get(vnode);
|
|
153
|
+
if (level) {
|
|
154
|
+
// Drop what the components below `vnode` pushed before throwing.
|
|
155
|
+
restore(
|
|
156
|
+
level,
|
|
157
|
+
+(renderStack[level[0]] == vnode),
|
|
158
|
+
+(ownerStack[level[1]] == vnode)
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
oldCatchError(error, vnode, oldVNode, errorInfo);
|
|
163
|
+
} catch (e) {
|
|
164
|
+
// The error escapes `vnode` too, so its `diffed` won't run.
|
|
165
|
+
if (level) {
|
|
166
|
+
stackLevels.delete(vnode);
|
|
167
|
+
restore(level, 0, 0);
|
|
168
|
+
}
|
|
169
|
+
throw e;
|
|
170
|
+
}
|
|
131
171
|
};
|
|
132
172
|
|
|
133
173
|
options.vnode = vnode => {
|
|
134
|
-
|
|
135
|
-
|
|
174
|
+
ownerMap.set(
|
|
175
|
+
vnode,
|
|
176
|
+
ownerStack.length > 0 ? ownerStack[ownerStack.length - 1] : null
|
|
177
|
+
);
|
|
136
178
|
if (oldVNode) oldVNode(vnode);
|
|
137
179
|
};
|
|
138
180
|
|
|
@@ -144,3 +186,12 @@ export function setupComponentStack() {
|
|
|
144
186
|
if (oldRender) oldRender(vnode);
|
|
145
187
|
};
|
|
146
188
|
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Return the owner stack captured for the current render, or null when unavailable.
|
|
192
|
+
* @returns {string | null}
|
|
193
|
+
*/
|
|
194
|
+
export function captureOwnerStack() {
|
|
195
|
+
const vnode = getCurrentVNode();
|
|
196
|
+
return vnode ? getOwnerStack(vnode) : null;
|
|
197
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { checkPropTypes } from './check-props';
|
|
2
|
-
import { options, Component } from '../..';
|
|
2
|
+
import { options, Component, Fragment } from '../..';
|
|
3
3
|
import {
|
|
4
4
|
ELEMENT_NODE,
|
|
5
5
|
DOCUMENT_NODE,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getCurrentVNode,
|
|
12
12
|
getDisplayName
|
|
13
13
|
} from './component-stack';
|
|
14
|
-
import {
|
|
14
|
+
import { isNaN } from './util';
|
|
15
15
|
|
|
16
16
|
const isWeakMapSupported = typeof WeakMap == 'function';
|
|
17
17
|
|
|
@@ -26,6 +26,9 @@ function getDomChildren(vnode) {
|
|
|
26
26
|
|
|
27
27
|
vnode._children.forEach(child => {
|
|
28
28
|
if (child && typeof child.type === 'function') {
|
|
29
|
+
// Portal children are mounted into another DOM parent (v11 keeps
|
|
30
|
+
// them in the vnode tree), so they are not DOM children of `vnode`.
|
|
31
|
+
if (child.props._parentDom) return;
|
|
29
32
|
domChildren.push.apply(domChildren, getDomChildren(child));
|
|
30
33
|
} else if (child && typeof child.type === 'string') {
|
|
31
34
|
domChildren.push(child.type);
|
|
@@ -42,6 +45,11 @@ function getDomChildren(vnode) {
|
|
|
42
45
|
function getClosestDomNodeParentName(parent) {
|
|
43
46
|
if (!parent) return '';
|
|
44
47
|
if (typeof parent.type == 'function') {
|
|
48
|
+
// Crossing a portal boundary: the DOM parent is the portal container.
|
|
49
|
+
// ShadowRoot/DocumentFragment containers have no localName -> skip.
|
|
50
|
+
if (parent.props._parentDom) {
|
|
51
|
+
return parent.props._parentDom.localName || '';
|
|
52
|
+
}
|
|
45
53
|
if (parent._parent == null) {
|
|
46
54
|
if (parent._dom != null && parent._dom.parentNode != null) {
|
|
47
55
|
return parent._dom.parentNode.localName;
|
|
@@ -53,6 +61,20 @@ function getClosestDomNodeParentName(parent) {
|
|
|
53
61
|
return /** @type {string} */ (parent.type);
|
|
54
62
|
}
|
|
55
63
|
|
|
64
|
+
/**
|
|
65
|
+
* The closest component to `vnode`: errors from refs and from unmounted
|
|
66
|
+
* components' cleanups arrive with a DOM or placeholder vnode.
|
|
67
|
+
* @param {import('./internal').VNode} vnode
|
|
68
|
+
* @returns {import('./internal').VNode}
|
|
69
|
+
*/
|
|
70
|
+
function getOwningComponent(vnode) {
|
|
71
|
+
let owner = vnode;
|
|
72
|
+
while (owner && (typeof owner.type != 'function' || owner.type == Fragment)) {
|
|
73
|
+
owner = owner._parent;
|
|
74
|
+
}
|
|
75
|
+
return owner || vnode;
|
|
76
|
+
}
|
|
77
|
+
|
|
56
78
|
export function initDebug() {
|
|
57
79
|
setupComponentStack();
|
|
58
80
|
|
|
@@ -74,46 +96,69 @@ export function initDebug() {
|
|
|
74
96
|
lazyPropTypes: new WeakMap()
|
|
75
97
|
};
|
|
76
98
|
const deprecations = [];
|
|
99
|
+
/** @type {{ error: any, vnode: import('./internal').VNode, done?: boolean }} */
|
|
100
|
+
let escaping;
|
|
77
101
|
|
|
78
102
|
options._catchError = (error, vnode, oldVNode, errorInfo) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
`Missing Suspense. The throwing component was: ${getDisplayName(vnode)}`
|
|
84
|
-
);
|
|
103
|
+
// A frame below already reported this error as escaping, and this one
|
|
104
|
+
// gets to decide what happens to it now.
|
|
105
|
+
const previous = escaping && escaping.error === error && escaping;
|
|
106
|
+
if (previous) previous.done = true;
|
|
85
107
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
108
|
+
try {
|
|
109
|
+
let component = vnode && vnode._component;
|
|
110
|
+
if (component && typeof error.then == 'function') {
|
|
111
|
+
const promise = error;
|
|
112
|
+
error = new Error(
|
|
113
|
+
`Missing Suspense. The throwing component was: ${getDisplayName(vnode)}`
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
let parent = vnode;
|
|
117
|
+
for (; parent; parent = parent._parent) {
|
|
118
|
+
if (parent._component && parent._component._childDidSuspend) {
|
|
119
|
+
error = promise;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
91
122
|
}
|
|
92
|
-
}
|
|
93
123
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
124
|
+
// We haven't recovered and we know at this point that there is no
|
|
125
|
+
// Suspense component higher up in the tree
|
|
126
|
+
if (error instanceof Error) {
|
|
127
|
+
throw error;
|
|
128
|
+
}
|
|
98
129
|
}
|
|
99
|
-
}
|
|
100
130
|
|
|
101
|
-
try {
|
|
102
131
|
errorInfo = errorInfo || {};
|
|
103
132
|
errorInfo.componentStack = getOwnerStack(vnode);
|
|
104
133
|
oldCatchError(error, vnode, oldVNode, errorInfo);
|
|
105
|
-
|
|
106
|
-
// when an error was handled by an ErrorBoundary we will nonetheless emit an error
|
|
107
|
-
// event on the window object. This is to make up for react compatibility in dev mode
|
|
108
|
-
// and thus make the Next.js dev overlay work.
|
|
109
|
-
if (typeof error.then != 'function') {
|
|
110
|
-
setTimeout(() => {
|
|
111
|
-
throw error;
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
134
|
} catch (e) {
|
|
135
|
+
const report = (escaping = {
|
|
136
|
+
error: e,
|
|
137
|
+
// Keep pointing at the component that threw while the error passes
|
|
138
|
+
// unchanged through the frames above it.
|
|
139
|
+
vnode: previous && e === previous.error ? previous.vnode : vnode
|
|
140
|
+
});
|
|
141
|
+
// Logged once the throw has unwound, so that an outer tree catching it
|
|
142
|
+
// (around a nested `render()`) can still cancel the report. Its own
|
|
143
|
+
// stack only points into Preact, so name the component it came from.
|
|
144
|
+
queueMicrotask(() => {
|
|
145
|
+
if (!report.done) {
|
|
146
|
+
const owner = getOwningComponent(report.vnode);
|
|
147
|
+
console.error(
|
|
148
|
+
`An error occurred in the <${getDisplayName(owner)}> component, and no error boundary handled it.\n\n${getOwnerStack(owner)}`
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
if (escaping == report) escaping = undefined;
|
|
152
|
+
});
|
|
115
153
|
throw e;
|
|
116
154
|
}
|
|
155
|
+
|
|
156
|
+
// when an error was handled by an ErrorBoundary we still log it, matching what
|
|
157
|
+
// React does in development. Errors that were not handled are rethrown by the
|
|
158
|
+
// core and thus surface as regular uncaught errors.
|
|
159
|
+
if (typeof error.then != 'function') {
|
|
160
|
+
console.error(error);
|
|
161
|
+
}
|
|
117
162
|
};
|
|
118
163
|
|
|
119
164
|
options._root = (vnode, parentNode) => {
|
|
@@ -146,6 +191,9 @@ export function initDebug() {
|
|
|
146
191
|
};
|
|
147
192
|
|
|
148
193
|
options._diff = vnode => {
|
|
194
|
+
// Unwinding never diffs, so whatever was escaping has finished doing so.
|
|
195
|
+
escaping = undefined;
|
|
196
|
+
|
|
149
197
|
let { type } = vnode;
|
|
150
198
|
|
|
151
199
|
hooksAllowed = true;
|
|
@@ -229,15 +277,12 @@ export function initDebug() {
|
|
|
229
277
|
}
|
|
230
278
|
}
|
|
231
279
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
values = assign({}, values);
|
|
235
|
-
delete values.ref;
|
|
236
|
-
}
|
|
280
|
+
/* eslint-disable-next-line */
|
|
281
|
+
const { ref: _ref, ...props } = vnode.props;
|
|
237
282
|
|
|
238
283
|
checkPropTypes(
|
|
239
284
|
vnode.type.propTypes,
|
|
240
|
-
|
|
285
|
+
props,
|
|
241
286
|
'prop',
|
|
242
287
|
getDisplayName(vnode),
|
|
243
288
|
() => getOwnerStack(vnode)
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import { VNode } from '
|
|
1
|
+
import { VNode } from '../../src/index';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Return the owner stack captured for the current render, or null when unavailable.
|
|
5
|
+
*/
|
|
6
|
+
export function captureOwnerStack(): string | null;
|
|
2
7
|
|
|
3
8
|
/**
|
|
4
9
|
* Get the currently rendered `vnode`
|
|
5
10
|
*/
|
|
6
11
|
export function getCurrentVNode(): VNode | null;
|
|
7
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Get human readable name of the component/dom node
|
|
15
|
+
*/
|
|
16
|
+
export function getDisplayName(vnode: VNode): string;
|
|
17
|
+
|
|
8
18
|
/**
|
|
9
19
|
* Return the component stack that was captured up to this point.
|
|
10
20
|
*/
|
package/preact/debug/src/util.js
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Assign properties from `props` to `obj`
|
|
3
|
-
* @template O, P The obj and props types
|
|
4
|
-
* @param {O} obj The object to copy properties to
|
|
5
|
-
* @param {P} props The object to copy properties from
|
|
6
|
-
* @returns {O & P}
|
|
7
|
-
*/
|
|
8
|
-
export function assign(obj, props) {
|
|
9
|
-
for (let i in props) obj[i] = props[i];
|
|
10
|
-
return /** @type {O & P} */ (obj);
|
|
11
|
-
}
|
|
1
|
+
export const assign = Object.assign;
|
|
12
2
|
|
|
13
3
|
export function isNaN(value) {
|
|
14
4
|
return value !== value;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{options as n,
|
|
2
|
-
//# sourceMappingURL=devtools.
|
|
1
|
+
import{options as n,Component as o,Fragment as e}from"../..";var i;function t(o,e){return n.__a&&n.__a(e),o}null!=(i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0)&&i.__PREACT_DEVTOOLS__&&i.__PREACT_DEVTOOLS__.attachPreact("11.0.1",n,{Fragment:e,Component:o});export{t as addHookName};
|
|
2
|
+
//# sourceMappingURL=devtools.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devtools.mjs","sources":["../src/devtools.js","../src/index.js"],"sourcesContent":["import { Component, Fragment, options } from 'preact';\n\nexport function initDevTools() {\n\tconst globalVar =\n\t\ttypeof globalThis !== 'undefined'\n\t\t\t? globalThis\n\t\t\t: typeof window !== 'undefined'\n\t\t\t\t? window\n\t\t\t\t: undefined;\n\n\tif (\n\t\tglobalVar !== null &&\n\t\tglobalVar !== undefined &&\n\t\tglobalVar.__PREACT_DEVTOOLS__\n\t) {\n\t\tglobalVar.__PREACT_DEVTOOLS__.attachPreact('11.0.1', options, {\n\t\t\tFragment,\n\t\t\tComponent\n\t\t});\n\t}\n}\n","import { options } from 'preact';\nimport { initDevTools } from './devtools';\n\ninitDevTools();\n\n/**\n * Display a custom label for a custom hook for the devtools panel\n * @type {<T>(value: T, name: string) => T}\n */\nexport function addHookName(value, name) {\n\tif (options._addHookName) {\n\t\toptions._addHookName(name);\n\t}\n\treturn value;\n}\n"],"names":["globalVar","addHookName","value","name","options","__a","globalThis","window","undefined","__PREACT_DEVTOOLS__","attachPreact","Fragment","Component"],"mappings":"8DAEO,IACAA,ECMA,SAASC,EAAYC,EAAOC,GAIlC,OAHIC,EAAOC,KACVD,EAAOC,IAAcF,GAEfD,CACR,CDHEF,OARKA,EACiB,oBAAfM,WACJA,WACkB,oBAAXC,OACNA,YACAC,IAKJR,EAAUS,qBAEVT,EAAUS,oBAAoBC,aAAa,SAAUN,EAAS,CAC7DO,SAAAA,EACAC,UAAAA"}
|
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "preact-devtools",
|
|
3
|
-
"amdName": "preactDevtools",
|
|
4
|
-
"version": "1.0.0",
|
|
5
3
|
"private": true,
|
|
6
4
|
"description": "Preact bridge for Preact devtools",
|
|
7
|
-
"main": "dist/devtools.
|
|
8
|
-
"module": "dist/devtools.
|
|
9
|
-
"umd:main": "dist/devtools.umd.js",
|
|
5
|
+
"main": "dist/devtools.mjs",
|
|
6
|
+
"module": "dist/devtools.mjs",
|
|
10
7
|
"source": "src/index.js",
|
|
11
|
-
"license": "MIT",
|
|
12
8
|
"types": "src/index.d.ts",
|
|
9
|
+
"license": "MIT",
|
|
13
10
|
"peerDependencies": {
|
|
14
11
|
"preact": "^10.0.0"
|
|
15
|
-
},
|
|
16
|
-
"exports": {
|
|
17
|
-
".": {
|
|
18
|
-
"types": "./src/index.d.ts",
|
|
19
|
-
"browser": "./dist/devtools.module.js",
|
|
20
|
-
"umd": "./dist/devtools.umd.js",
|
|
21
|
-
"import": "./dist/devtools.mjs",
|
|
22
|
-
"require": "./dist/devtools.js"
|
|
23
|
-
}
|
|
24
12
|
}
|
|
25
13
|
}
|
|
@@ -13,7 +13,7 @@ export function initDevTools() {
|
|
|
13
13
|
globalVar !== undefined &&
|
|
14
14
|
globalVar.__PREACT_DEVTOOLS__
|
|
15
15
|
) {
|
|
16
|
-
globalVar.__PREACT_DEVTOOLS__.attachPreact('
|
|
16
|
+
globalVar.__PREACT_DEVTOOLS__.attachPreact('11.0.1', options, {
|
|
17
17
|
Fragment,
|
|
18
18
|
Component
|
|
19
19
|
});
|
package/preact/dist/preact.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var n,l,u,t,i,r,o,e,f,c,a,s,h,p,v,y,d={},w=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,g=Array.isArray;function m(n,l){for(var u in l)n[u]=l[u];return n}function b(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function k(l,u,t){var i,r,o,e={};for(o in u)"key"==o?i=u[o]:"ref"==o?r=u[o]:e[o]=u[o];if(arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps)void 0===e[o]&&(e[o]=l.defaultProps[o]);return x(l,e,i,r,null)}function x(n,t,i,r,o){var e={type:n,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++u:o,__i:-1,__u:0};return null==o&&null!=l.vnode&&l.vnode(e),e}function M(){return{current:null}}function S(n){return n.children}function C(n,l){this.props=n,this.context=l}function $(n,l){if(null==l)return n.__?$(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return"function"==typeof n.type?$(n):null}function I(n){if(n.__P&&n.__d){var u=n.__v,t=u.__e,i=[],r=[],o=m({},u);o.__v=u.__v+1,l.vnode&&l.vnode(o),q(n.__P,o,u,n.__n,n.__P.namespaceURI,32&u.__u?[t]:null,i,null==t?$(u):t,!!(32&u.__u),r),o.__v=u.__v,o.__.__k[o.__i]=o,D(i,o,r),u.__e=u.__=null,o.__e!=t&&P(o)}}function P(n){if(null!=(n=n.__)&&null!=n.__c)return n.__e=n.__c.base=null,n.__k.some(function(l){if(null!=l&&null!=l.__e)return n.__e=n.__c.base=l.__e}),P(n)}function A(n){(!n.__d&&(n.__d=!0)&&i.push(n)&&!H.__r++||r!=l.debounceRendering)&&((r=l.debounceRendering)||o)(H)}function H(){try{for(var n,l=1;i.length;)i.length>l&&i.sort(e),n=i.shift(),l=i.length,I(n)}finally{i.length=H.__r=0}}function L(n,l,u,t,i,r,o,e,f,c,a){var s,h,p,v,y,_,g=t&&t.__k||w,m=l.length;for(f=T(u,l,g,f,m),s=0;s<m;s++)null!=(p=u.__k[s])&&(h=-1!=p.__i&&g[p.__i]||d,p.__i=s,_=q(n,p,h,i,r,o,e,f,c,a),v=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&J(h.ref,null,p),a.push(p.ref,p.__c||v,p)),null==y&&null!=v&&(y=v),4&p.__u?(f=j(p,f,n),h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==_?f=_:v&&(f=v.nextSibling),p.__u&=-7);return u.__e=y,f}function T(n,l,u,t,i){var r,o,e,f,c,a=u.length,s=a,h=0;for(n.__k=new Array(i),r=0;r<i;r++)null!=(o=l[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=n.__k[r]=x(null,o,null,null,null):g(o)?o=n.__k[r]=x(S,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=n.__k[r]=x(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):n.__k[r]=o,f=r+h,o.__=n,o.__b=n.__b+1,e=null,-1!=(c=o.__i=O(o,u,f,s))&&(s--,(e=u[c])&&(e.__u|=2)),null==e||null==e.__v?(-1==c&&(i>a?h--:i<a&&h++),"function"!=typeof o.type&&(o.__u|=4)):c!=f&&(c==f-1?h--:c==f+1?h++:(c>f?h--:h++,o.__u|=4))):n.__k[r]=null;if(s)for(r=0;r<a;r++)null!=(e=u[r])&&0==(2&e.__u)&&(e.__e==t&&(t=$(e)),K(e,e));return t}function j(n,l,u){var t,i;if("function"==typeof n.type){for(t=n.__k,i=0;t&&i<t.length;i++)t[i]&&(t[i].__=n,l=j(t[i],l,u));return l}n.__e!=l&&(l&&n.type&&!l.parentNode&&(l=$(n)),l=u.insertBefore(n.__e,l||null));do{l=l&&l.nextSibling}while(null!=l&&8==l.nodeType);return l}function F(n,l){return l=l||[],null==n||"boolean"==typeof n||(g(n)?n.some(function(n){F(n,l)}):l.push(n)),l}function O(n,l,u,t){var i,r,o,e=n.key,f=n.type,c=l[u],a=null!=c&&0==(2&c.__u);if(null===c&&null==e||a&&e==c.key&&f==c.type)return u;if(t>(a?1:0))for(i=u-1,r=u+1;i>=0||r<l.length;)if(null!=(c=l[o=i>=0?i--:r++])&&0==(2&c.__u)&&e==c.key&&f==c.type)return o;return-1}function z(n,l,u){"-"==l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||_.test(l)?u:u+"px"}function N(n,l,u,t,i){var r,o;n:if("style"==l)if("string"==typeof u)n.style.cssText=u;else{if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||z(n.style,l,"");if(u)for(l in u)t&&u[l]==t[l]||z(n.style,l,u[l])}else if("o"==l[0]&&"n"==l[1])r=l!=(l=l.replace(s,"$1")),o=l.toLowerCase(),l=o in n||"onFocusOut"==l||"onFocusIn"==l?o.slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=u,u?t?u[a]=t[a]:(u[a]=h,n.addEventListener(l,r?v:p,r)):n.removeEventListener(l,r?v:p,r);else{if("http://www.w3.org/2000/svg"==i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=l&&"height"!=l&&"href"!=l&&"list"!=l&&"form"!=l&&"tabIndex"!=l&&"download"!=l&&"rowSpan"!=l&&"colSpan"!=l&&"role"!=l&&"popover"!=l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&"-"!=l[4]?n.removeAttribute(l):n.setAttribute(l,"popover"==l&&1==u?"":u))}}function V(n){return function(u){if(this.l){var t=this.l[u.type+n];if(null==u[c])u[c]=h++;else if(u[c]<t[a])return;return t(l.event?l.event(u):u)}}}function q(n,u,t,i,r,o,e,f,c,a){var s,h,p,v,y,d,_,k,x,M,I,P,A,H,T,j,F=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),o=[f=u.__e=t.__e]),(s=l.__b)&&s(u);n:if("function"==typeof F){h=e.length;try{if(x=u.props,M=F.prototype&&F.prototype.render,I=(s=F.contextType)&&i[s.__c],P=s?I?I.props.value:s.__:i,t.__c?k=(p=u.__c=t.__c).__=p.__E:(M?u.__c=p=new F(x,P):(u.__c=p=new C(x,P),p.constructor=F,p.render=Q),I&&I.sub(p),p.state||(p.state={}),p.__n=i,v=p.__d=!0,p.__h=[],p._sb=[]),M&&null==p.__s&&(p.__s=p.state),M&&null!=F.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=m({},p.__s)),m(p.__s,F.getDerivedStateFromProps(x,p.__s))),y=p.props,d=p.state,p.__v=u,v)M&&null==F.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),M&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(M&&null==F.getDerivedStateFromProps&&x!==y&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(x,P),u.__v==t.__v||!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(x,p.__s,P)){u.__v!=t.__v&&(p.props=x,p.state=p.__s,p.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.some(function(n){n&&(n.__=u)}),w.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&e.push(p),f=$(t);break n}null!=p.componentWillUpdate&&p.componentWillUpdate(x,p.__s,P),M&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(y,d,_)})}if(p.context=P,p.props=x,p.__P=n,p.__e=!1,A=l.__r,H=0,M)p.state=p.__s,p.__d=!1,A&&A(u),s=p.render(p.props,p.state,p.context),w.push.apply(p.__h,p._sb),p._sb=[];else do{p.__d=!1,A&&A(u),s=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++H<25);p.state=p.__s,null!=p.getChildContext&&(i=m(m({},i),p.getChildContext())),M&&!v&&null!=p.getSnapshotBeforeUpdate&&(_=p.getSnapshotBeforeUpdate(y,d)),T=null!=s&&s.type===S&&null==s.key?E(s.props.children):s,f=L(n,g(T)?T:[T],u,t,i,r,o,e,f,c,a),p.base=u.__e,u.__u&=-161,p.__h.length&&e.push(p),k&&(p.__E=p.__=null)}catch(n){if(e.length=h,u.__v=null,c||null!=o){if(n.then){for(u.__u|=c?160:128;f&&8==f.nodeType&&f.nextSibling;)f=f.nextSibling;null!=o&&(o[o.indexOf(f)]=null),u.__e=f}else if(null!=o)for(j=o.length;j--;)b(o[j])}else u.__e=t.__e;null==u.__k&&(u.__k=t.__k||[]),n.then||B(u),l.__e(n,u,t)}}else null==o&&u.__v==t.__v?(u.__k=t.__k,u.__e=t.__e):f=u.__e=G(t.__e,u,t,i,r,o,e,c,a);return(s=l.diffed)&&s(u),128&u.__u?void 0:f}function B(n){n&&(n.__c&&(n.__c.__e=!0),n.__k&&n.__k.some(B))}function D(n,u,t){for(var i=0;i<t.length;i++)J(t[i],t[++i],t[++i]);l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function E(n){return"object"!=typeof n||null==n||n.__b>0?n:g(n)?n.map(E):void 0!==n.constructor?null:m({},n)}function G(u,t,i,r,o,e,f,c,a){var s,h,p,v,y,w,_,m=i.props||d,k=t.props,x=t.type;if("svg"==x?o="http://www.w3.org/2000/svg":"math"==x?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=e)for(s=0;s<e.length;s++)if((y=e[s])&&"setAttribute"in y==!!x&&(x?y.localName==x:3==y.nodeType)){u=y,e[s]=null;break}if(null==u){if(null==x)return document.createTextNode(k);u=document.createElementNS(o,x,k.is&&k),c&&(l.__m&&l.__m(t,e),c=!1),e=null}if(null==x)m===k||c&&u.data==k||(u.data=k);else{if(e="textarea"==x&&null!=k.defaultValue?null:e&&n.call(u.childNodes),!c&&null!=e)for(m={},s=0;s<u.attributes.length;s++)m[(y=u.attributes[s]).name]=y.value;for(s in m)y=m[s],"dangerouslySetInnerHTML"==s?p=y:"children"==s||s in k||"value"==s&&"defaultValue"in k||"checked"==s&&"defaultChecked"in k||N(u,s,null,y,o);for(s in k)y=k[s],"children"==s?v=y:"dangerouslySetInnerHTML"==s?h=y:"value"==s?w=y:"checked"==s?_=y:c&&"function"!=typeof y||m[s]===y||N(u,s,y,m[s],o);if(h)c||p&&(h.__html==p.__html||h.__html==u.innerHTML)||(u.innerHTML=h.__html),t.__k=[];else if(p&&(u.innerHTML=""),L("template"==t.type?u.content:u,g(v)?v:[v],t,i,r,"foreignObject"==x?"http://www.w3.org/1999/xhtml":o,e,f,e?e[0]:i.__k&&$(i,0),c,a),null!=e)for(s=e.length;s--;)b(e[s]);c&&"textarea"!=x||(s="value","progress"==x&&null==w?u.removeAttribute("value"):null!=w&&(w!==u[s]||"progress"==x&&!w||"option"==x&&w!=m[s])&&N(u,s,w,m[s],o),s="checked",null!=_&&_!=u[s]&&N(u,s,_,m[s],o))}return u}function J(n,u,t){try{if("function"==typeof n){var i="function"==typeof n.__u;i&&n.__u(),i&&null==u||(n.__u=n(u))}else n.current=u}catch(n){l.__e(n,t)}}function K(n,u,t){var i,r;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!=n.__e||J(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(n){l.__e(n,u)}i.base=i.__P=i.__n=null}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&K(i[r],u,t||"function"!=typeof n.type);t||b(n.__e),n.__c=n.__=n.__e=void 0}function Q(n,l,u){return this.constructor(n,u)}function R(u,t,i){var r,o,e,f;t==document&&(t=document.documentElement),l.__&&l.__(u,t),o=(r="function"==typeof i)?null:i&&i.__k||t.__k,e=[],f=[],q(t,u=(!r&&i||t).__k=k(S,null,[u]),o||d,d,t.namespaceURI,!r&&i?[i]:o?null:t.firstChild?n.call(t.childNodes):null,e,!r&&i?i:o?o.__e:t.firstChild,r,f),D(e,u,f),u.props.children=null}function U(n,l){R(n,l,U)}function W(l,u,t){var i,r,o,e,f=m({},l.props);for(o in l.type&&l.type.defaultProps&&(e=l.type.defaultProps),u)"key"==o?i=u[o]:"ref"==o?r=u[o]:f[o]=void 0===u[o]&&null!=e?e[o]:u[o];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),x(l.type,f,i||l.key,r||l.ref,null)}function X(n){function l(n){var u,t;return this.getChildContext||(u=new Set,(t={})[l.__c]=this,this.getChildContext=function(){return t},this.componentWillUnmount=function(){u=null},this.shouldComponentUpdate=function(n){this.props.value!=n.value&&u.forEach(function(n){n.__e=!0,A(n)})},this.sub=function(n){u.add(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u&&u.delete(n),l&&l.call(n)}}),n.children}return l.__c="__cC"+y++,l.__=n,l.Provider=l.__l=(l.Consumer=function(n,l){return n.children(l)}).contextType=l,l}n=w.slice,l={__e:function(n,l,u,t){for(var i,r,o;l=l.__;)if((i=l.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(n)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),o=i.__d),o)return i.__E=i}catch(l){n=l}throw n}},u=0,t=function(n){return null!=n&&void 0===n.constructor},C.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=m({},this.state),"function"==typeof n&&(n=n(m({},u),this.props)),n&&m(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),A(this))},C.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),A(this))},C.prototype.render=S,i=[],o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e=function(n,l){return n.__v.__b-l.__v.__b},H.__r=0,f=Math.random().toString(8),c="__d"+f,a="__a"+f,s=/(PointerCapture)$|Capture$/i,h=0,p=V(!1),v=V(!0),y=0;export{C as Component,S as Fragment,W as cloneElement,X as createContext,k as createElement,M as createRef,k as h,U as hydrate,t as isValidElement,l as options,R as render,F as toChildArray};
|
|
2
|
-
//# sourceMappingURL=preact.
|
|
1
|
+
var n,t,i,r,u,f,o,e,l,c,a,s,h={},p=[],v=/^m(i|n|o|s|text|space)$/,y=Array.isArray,d=p.slice,w=Object.assign;function _(n){n&&n.parentNode&&n.remove()}function g(n,t,i){var r,u,f,o={},e=arguments.length;for(f in t)"key"==f?r=t[f]:"ref"==f&&"function"!=typeof n?u=t[f]:o[f]=t[f];return e>2&&(o.children=e>3?d.call(arguments,2):i),b(n,o,r,u,null)}function k(n,t,i){var r,u,f,o=w({},n.props),e=arguments.length;for(f in t)"key"==f?r=t[f]:"ref"==f&&"function"!=typeof n.type?u=t[f]:o[f]=t[f];return e>2&&(o.children=e>3?d.call(arguments,2):i),b(n.type,o,void 0!==r?r:n.key,void 0!==u?u:n.ref,null)}function b(i,r,u,f,o){var e={type:i,props:r,key:u,ref:f,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o||++t,__i:-1,__u:0};return!o&&n.vnode&&n.vnode(e),e}function m(){return{current:null}}function M(n){return n.children}function $(n,t){this.props=n,this.context=t,this.__g=0}function x(n,t){if(null==t)return n.__?x(n.__,n.__i+1):null;for(var i;t<n.__k.length;t++)if((i=n.__k[t])&&i.__e)return i.__e;return"function"!=typeof n.type||n.props.__P?null:x(n)}function S(n){if((n=n.__)&&n.__c&&!n.props.__P)return n.__e=null,n.__k.some(function(t){return t&&(n.__e=t.__e)}),S(n)}function C(t){(8&t.__g||!(t.__g|=8)||!r.push(t)||f++)&&u==n.debounceRendering||((u=n.debounceRendering)||queueMicrotask)(j)}function j(){var t,i,u,e,l,c,a,s,h;try{for(i=1;r.length;)r.length>i&&r.sort(o),t=r.shift(),i=r.length,8&t.__g&&(e=void 0,l=void 0,c=(l=(u=t).__v).__e,a=[],s=[],(h=u.__P)&&((e=w({constructor:void 0},l)).__v=l.__v+1,n.vnode&&n.vnode(e),N(h,e,l,u.__n,h.namespaceURI,32&l.__u?[c]:null,a,c||x(l),32&l.__u,s),e.__v=l.__v,e.__.__k[e.__i]=e,z(a,e,s),l.__=l.__e=null,e.__e!=c&&S(e)))}finally{r.length=f=0}}function L(n,t,i,r,u,f,o,e,l,c,a){var s,v,y,d,w,_,g=r.__k||p,k=t.length;for(l=H(i,t,g,l,k),s=0;s<k;s++)null!=(y=i.__k[s])&&(v=~y.__i&&g[y.__i]||h,y.__i=s,_=N(n,y,v,u,f,o,e,l,c,a),d=y.__e,(v.ref!=y.ref||8&v.__u)&&(v.ref&&D(v.ref,null,y,v),y.ref&&a.push(y.ref,y.__c||d,y)),w=w||d,4&y.__u?(l=I(y,l,n,!v.__v),v.__e&&(v.__e=null)):"function"==typeof y.type&&void 0!==_?l=_:d&&(l=d.nextSibling),y.__u&=-7);return i.__e=w,l}function H(n,t,i,r,u){var f,o,e,l,c,a,s,h,p,v,d=i.length,w=d,_=0,g=!1,k=n.__k=Array(u);for(f=0;f<u;f++)null!=(o=t[f])&&"boolean"!=typeof o&&"function"!=typeof o?("object"!=typeof o||o.constructor==String?o=k[f]=b(null,o):y(o)?o=k[f]=b(M,{children:o}):void 0===o.constructor&&o.__b?o=k[f]=b(o.type,o.props,o.key,o.ref,o.__v):k[f]=o,l=f+_,o.__=n,o.__b=n.__b+1,e=null,~(c=o.__i=O(o,i,l,w))&&(w--,(e=i[c])&&(e.__u|=2)),e&&e.__v?(o.__u|=2,c==l-1?_--:c==l+1?_++:c!=l&&(c>l?_--:_++,g=!0)):(~c||(u>d?_--:u<d&&_++),"function"!=typeof o.type&&(o.__u|=4))):k[f]=null;if(g){for(a=[],s=[],f=0;f<u;f++)if((o=k[f])&&2&o.__u){for(h=0,p=a.length;h<p;)a[v=h+p>>1]<o.__i?h=v+1:p=v;a[h]=o.__i,s[f]=h+1}for(_=a.length;f--;)s[f]&&(s[f]==_?_--:k[f].__u|=4)}if(w)for(f=0;f<d;f++)!(e=i[f])||2&e.__u||(e.__e==r&&(r=x(e)),E(e,e));return r}function I(n,t,i,r){var u,f,o;if("function"==typeof n.type){if(n.props.__P)return t;if(u=n.__k)for(f=0;f<u.length;f++)u[f]&&(u[f].__=n,t=I(u[f],t,i,!1));return t}for(t&&!t.parentNode&&(t=x(n))&&!t.parentNode&&(t=null),o=t;o&&8==o.nodeType;)o=o.nextSibling;for(n.__e!=o&&(!r&&i.moveBefore&&n.__e.parentNode?i.moveBefore(n.__e,t):i.insertBefore(n.__e,t||null)),t=n.__e;(t=t&&t.nextSibling)&&8==t.nodeType;);return t}function A(n,t){return t=t||[],null!=n&&"boolean"!=typeof n&&(y(n)?n.some(function(n){A(n,t)}):t.push(n)),t}function O(n,t,i,r){var u,f,o,e=n.key,l=n.type,c=t[i],a=c&&!(2&c.__u);if(null===c&&null==e||a&&e==c.key&&l==c.type)return i;if(r>(a?1:0))for(u=i-1,f=i+1;u>=0||f<t.length;)if((c=t[o=u>=0?u--:f++])&&!(2&c.__u)&&e==c.key&&l==c.type)return o;return-1}function P(n,t,i){null==i&&(i=""),"-"==t[0]?n.setProperty(t,i):n[t]=i}function T(n,t,i,r,u){var f,o;n:if("style"==t)if("string"==typeof i)n.style.cssText=i;else{if("string"==typeof r&&(n.style.cssText=r=""),r)for(t in r)i&&t in i||P(n.style,t,"");if(i)for(t in i)r&&i[t]==r[t]||P(n.style,t,i[t])}else if("o"==t[0]&&"n"==t[1])(n.__e||(n.__e={}))[t]=i,i&&r||(o=a[t]||(a[t]=q(t)),(n.__a||(n.__a={}))[t]=c,f=t!=(t=t.replace(l,"$1")),(t=t.slice(2))[0]<"a"&&(t=t.toLowerCase()),i?n.addEventListener(t,o,f):n.removeEventListener(t,o,f));else{if("http://www.w3.org/2000/svg"==u)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in n)try{n[t]=null==i?"":i;break n}catch(n){}"function"==typeof i||(null==i||!1===i&&"-"!=t[4]?n.removeAttribute(t):n.setAttribute(t,"popover"==t&&1==i?"":i))}}function q(t){return function(i){if(this.__e){var r=this.__e[t];if(null==i[e])i[e]=c++;else if(i[e]<this.__a[t])return;return r(n.event?n.event(i):i)}}}function N(t,i,r,u,f,o,e,l,c,a){var s,h,v,d,g,k,b,m,S,C,j,H,I,A,O,P,T,q,N,z,D=i.type;if(void 0!==i.constructor)return null;if(128&r.__u&&(c=32&r.__u,s=r.__c.__z)){if(i.__u|=c,h=o=[],8==s.nodeType)for(v=1,d=s.nextSibling;d;d=d.nextSibling){if(8==d.nodeType)if(d.data.startsWith("$s"))v++;else if(d.data.startsWith("/$s")&&!--v)break;o.push(d)}else o.push(s);l=o[0]}(s=n.__b)&&s(i);n:if("function"==typeof D){g=e.length;try{if(C=i.props,j=(s=D.prototype)&&s.render,H=(s=D.contextType)&&u[s.__c],I=s?H?H.props.value:s.__:u,r.__c?2&(k=i.__c=r.__c).__g&&(k.__g|=1):(j?i.__c=k=new D(C,I):(i.__c=k=new $(C,I),k.constructor=D,k.render=F),H&&H.sub(k),k.state||(k.state={}),k.__n=u,k.__g|=8,k.__h=[],k.__k=[]),j&&(k.__s||(k.__s=k.state),D.getDerivedStateFromProps&&(k.__s==k.state&&(k.__s=w({},k.__s)),w(k.__s,D.getDerivedStateFromProps(C,k.__s)))),b=k.props,m=k.state,k.__v=i,r.__c){if(j&&!D.getDerivedStateFromProps&&C!==b&&k.componentWillReceiveProps&&k.componentWillReceiveProps(C,I),i.__v==r.__v&&!(8&k.__g)||!(4&k.__g)&&k.shouldComponentUpdate&&!1===k.shouldComponentUpdate(C,k.__s,I)){i.__v!=r.__v&&(k.props=C,k.state=k.__s,k.__g&=-9),i.__e=r.__e,i.__k=r.__k,i.__k.some(function(n){n&&(n.__=i)}),p.push.apply(k.__h,k.__k),k.__k=[],k.__h.length&&e.push(k),l=x(r);break n}k.componentWillUpdate&&k.componentWillUpdate(C,k.__s,I),j&&k.componentDidUpdate&&k.__h.push(function(){k.componentDidUpdate(b,m,S)})}else j&&!D.getDerivedStateFromProps&&k.componentWillMount&&k.componentWillMount(),j&&k.componentDidMount&&k.__h.push(k.componentDidMount);if(k.context=I,k.props=C,k.__P=t,k.__g&=-5,A=n.__r,O=0,j)k.state=k.__s,k.__g&=-9,A&&A(i),s=k.render(k.props,k.state,k.context),p.push.apply(k.__h,k.__k),k.__k=[];else do{k.__g&=-9,A&&A(i),s=k.render(k.props,k.state,k.context),k.state=k.__s}while(8&k.__g&&++O<25);k.state=k.__s,k.getChildContext&&(u=w({},u,k.getChildContext())),j&&r.__c&&k.getSnapshotBeforeUpdate&&(S=k.getSnapshotBeforeUpdate(b,m)),P=s&&s.type===M&&null==s.key?s.props.children:s,C.__P&&(s=l,f=(t=C.__P).namespaceURI,c=o=null,r.props&&r.props.__P!=t&&(r.__k.some(function(n){n&&E(n,n)}),r.__k=null),l=r.__k?x(r,0):null),l=L(t,y(P)?P:[P],i,r,u,f,o,e,l,c,a),C.__P&&(i.__e=null,l=s),i.__u&=-161,128&r.__u&&(k.__z=null),h&&h.some(_),k.__h.length&&e.push(k),1&k.__g&&(k.__g&=-4)}catch(t){if(e.length=g,i.__v=null,c||o)if(t.then){if(T=0,i.__u|=c?160:128,o){for(~(N=o.indexOf(l||void 0))||(N=o.length);(z=o[N-1])&&8==z.nodeType;)N--;for(;N<o.length;N++)if(z=o[N])if(o[N]=null,8==z.nodeType){if(z.data.startsWith("$s"))T++||(q=z);else if(T&&z.data.startsWith("/$s")&&!--T){l=z;break}}else if(!T)break}if(!q){for(;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;q=l}i.__c.__z||(i.__c.__z=q),i.__e=l}else o&&o.some(_);else i.__e=r.__e;i.__k||(i.__k=r.__k||[]),t.then||V(i),n.__e(t,i,r)}}else l=i.__e=B(r.__e,i,r,u,f,o,e,c,a,t);return(s=n.diffed)&&s(i),128&i.__u?void 0:l}function V(n){n&&(n.__c&&(n.__c.__g|=4),n.__k&&n.__k.some(V))}function z(t,i,r){for(var u=0;u<r.length;)D(r[u++],r[u++],r[u++]);n.__c&&n.__c(i,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(n){n.call(i)})}catch(t){n.__e(t,i.__v)}})}function B(t,i,r,u,f,o,e,l,c,a){var s,p,w,g,k,b,m,M,$,S=r.props||h,C=i.props,j=i.type;if("svg"==j?f="http://www.w3.org/2000/svg":"math"==j?f="http://www.w3.org/1998/Math/MathML":f||(f="http://www.w3.org/1999/xhtml"),o)for(s=0;s<o.length;s++)if((k=o[s])&&(j?k.localName==j:3==k.nodeType)){t=k,o[s]=null;break}if(!t){if(M=a.ownerDocument||document,!j)return M.createTextNode(C);t=M.createElementNS(f,j,C.is&&C),l&&(n.__m&&n.__m(i,o),l=!1),o=null}if(j){if(a="template"==j?t.content:t,o="textarea"==j&&null!=C.defaultValue?null:o&&d.call(a.childNodes),!l&&o)for(S={},s=0;s<t.attributes.length;s++)S[(k=t.attributes[s]).name]=k.value;for(s in S)k=S[s],"dangerouslySetInnerHTML"==s?w=k:"children"==s||s in C||"value"==s&&"defaultValue"in C||"checked"==s&&"defaultChecked"in C||T(t,s,null,k,f);for(s in $=1&r.__u,C)k=C[s],"children"==s?g=k:"dangerouslySetInnerHTML"==s?p=k:"value"==s?b=k:"checked"==s?m=k:l&&"function"!=typeof k||!(S[s]!==k||$&&null!=k)||T(t,s,k,S[s],f);p?(l||w&&(p.__html==w.__html||p.__html==t.innerHTML)||(t.innerHTML=p.__html),i.__k=[]):(w&&(t.textContent=""),("foreignObject"==j||"http://www.w3.org/1998/Math/MathML"==f&&v.test(j))&&(f="http://www.w3.org/1999/xhtml"),L(a,y(g)?g:[g],i,r,u,f,o,e,o?o[0]:r.__k&&x(r,0),l,c),o&&o.some(_)),l&&"textarea"!=j||(s="value","progress"==j&&null==b?t.removeAttribute(s):null==b||b===t[s]&&("progress"!=j||b)||T(t,s,b,S[s],f),s="checked",null!=m&&m!=t[s]&&T(t,s,m,S[s],f))}else S===C||l&&t.data==C||(t.data=C);return t}function D(t,i,r,u){try{"function"==typeof t?i?i.__x=t(i)||1:u&&(u=u.__c||u.__e)&&(i=u.__x)&&(u.__x=null,"function"==typeof i?i():t(null)):t.current=i}catch(t){n.__e(t,r)}}function E(t,i,r){var u,f;if(n.unmount&&n.unmount(t),!(u=t.ref)||u.current&&u.current!=t.__e||D(u,null,i,t),u=t.__c){if(u.componentWillUnmount)try{u.componentWillUnmount()}catch(t){n.__e(t,i)}u.__P=u.__n=null}if(u=t.__k)for(f=0;f<u.length;f++)u[f]&&E(u[f],i,"function"!=typeof t.type||r&&!t.props.__P);(u=t.__e)&&(r||_(u),u.__e&&(u.__e=null)),t.__e=t.__c=t.__=null}function F(n,t,i){return this.constructor(n,i)}function G(t,i){var r,u,f,o;n.__&&n.__(t,i),9==i.nodeType&&(i=i.documentElement),u=(r=t&&32&t.__u)?null:i.__k,i.__k=b(M,{children:[t]}),f=[],o=[],N(i,i.__k,u||h,h,i.namespaceURI,u?null:i.firstChild?d.call(i.childNodes):null,f,u?u.__e:i.firstChild,r,o),z(f,i.__k,o),i.__k.props.children=null}function J(n,t){n&&"object"==typeof n&&(n.__u|=32),G(n,t)}function K(n){function t(n){var i,r;return this.getChildContext||(i=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(n){this.props.value!=n.value&&i.forEach(function(n){n.__g|=4,C(n)})},this.sub=function(n){i.add(n);var t=n.componentWillUnmount;n.componentWillUnmount=function(){i.delete(n),t&&t.call(n)}}),n.children}return t.__c="__cC"+s++,t.__=n,t.Provider=(t.Consumer=function(n,t){return n.children(t)}).contextType=t,t}function Q(n){return n.children}function R(n,t){return b(Q,{__P:t,children:n})}n={__e:function(n,t,i,r){for(var u,o,e;t=t.__;)if((u=t.__c)&&!(1&u.__g)){u.__g|=4;try{if((o=u.constructor)&&o.getDerivedStateFromError&&(u.setState(o.getDerivedStateFromError(n)),e=8&u.__g),u.componentDidCatch&&(u.componentDidCatch(n,r||{}),e=8&u.__g),e)return void(u.__g|=2)}catch(t){n=t,e=0}}throw f=0,n}},t=0,i=function(n){return null!=n&&void 0===n.constructor},$.prototype.setState=function(n,t){var i=this.__s;i&&i!=this.state||(i=this.__s=w({},this.state)),"function"==typeof n&&(n=n(w({},i),this.props)),n&&(w(i,n),this.__v&&(t&&this.__k.push(t),C(this)))},$.prototype.forceUpdate=function(n){this.__v&&(this.__g|=4,n&&this.__h.push(n),C(this))},$.prototype.render=M,r=[],f=0,o=function(n,t){return n.__v.__b-t.__v.__b},e=Symbol(),l=/(PointerCapture)$|Capture$/i,c=0,a={},s=0;export{$ as Component,M as Fragment,k as cloneElement,K as createContext,g as createElement,R as createPortal,m as createRef,g as h,J as hydrate,i as isValidElement,n as options,G as render,A as toChildArray};
|
|
2
|
+
//# sourceMappingURL=preact.mjs.map
|