@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
package/preact/src/diff/props.js
CHANGED
|
@@ -1,26 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NULL, SVG_NAMESPACE } from '../constants';
|
|
2
2
|
import options from '../options';
|
|
3
3
|
|
|
4
|
-
// Per-instance unique key for event clock
|
|
5
|
-
// gets its own
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
// you deserve some weird bugs.
|
|
9
|
-
// In 11 we can replace this with a
|
|
10
|
-
// Symbol
|
|
11
|
-
let _id = Math.random().toString(8),
|
|
12
|
-
EVENT_DISPATCHED = '__d' + _id,
|
|
13
|
-
EVENT_ATTACHED = '__a' + _id;
|
|
4
|
+
// Per-instance unique key for the event clock stamp. Each Preact copy on the
|
|
5
|
+
// page gets its own Symbol so that stamps on shared event objects can never
|
|
6
|
+
// collide across instances.
|
|
7
|
+
let EVENT_DISPATCHED = Symbol();
|
|
14
8
|
|
|
15
9
|
function setStyle(style, key, value) {
|
|
10
|
+
if (value == NULL) value = '';
|
|
16
11
|
if (key[0] == '-') {
|
|
17
|
-
style.setProperty(key, value
|
|
18
|
-
} else if (value == NULL) {
|
|
19
|
-
style[key] = '';
|
|
20
|
-
} else if (typeof value != 'number' || IS_NON_DIMENSIONAL.test(key)) {
|
|
21
|
-
style[key] = value;
|
|
12
|
+
style.setProperty(key, value);
|
|
22
13
|
} else {
|
|
23
|
-
style[key] = value
|
|
14
|
+
style[key] = value;
|
|
24
15
|
}
|
|
25
16
|
}
|
|
26
17
|
|
|
@@ -77,34 +68,32 @@ export function setProperty(dom, name, value, oldValue, namespace) {
|
|
|
77
68
|
}
|
|
78
69
|
// Benchmark for comparison: https://esbench.com/bench/574c954bdb965b9a00965ac6
|
|
79
70
|
else if (name[0] == 'o' && name[1] == 'n') {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
71
|
+
// Handlers are keyed by prop name and every prop name gets its own proxy,
|
|
72
|
+
// so swapping one (e.g. an inline arrow function on every render) is a
|
|
73
|
+
// single store. The event name is only derived to attach or remove it.
|
|
74
|
+
(dom._listeners || (dom._listeners = {}))[name] = value;
|
|
75
|
+
|
|
76
|
+
if (!value || !oldValue) {
|
|
77
|
+
const proxy =
|
|
78
|
+
eventProxies[name] || (eventProxies[name] = createEventProxy(name));
|
|
79
|
+
// The attach time belongs to the listener, not to the handler: one
|
|
80
|
+
// function can back several listeners that were attached at different
|
|
81
|
+
// times. It lives outside `_listeners`, which unmount resets even when
|
|
82
|
+
// a re-suspended Suspense boundary keeps the DOM and its listeners.
|
|
83
|
+
(dom._attached || (dom._attached = {}))[name] = eventClock;
|
|
84
|
+
useCapture = name != (name = name.replace(CAPTURE_REGEX, '$1'));
|
|
85
|
+
|
|
86
|
+
// Infer correct casing for DOM built-in events: `onClick` -> `click`.
|
|
87
|
+
// Only names starting with an uppercase letter are lowercased, so
|
|
88
|
+
// camelCase custom events keep their casing: `onionChange` -> `ionChange`.
|
|
89
|
+
name = name.slice(2);
|
|
90
|
+
if (name[0] < 'a') name = name.toLowerCase();
|
|
91
|
+
|
|
92
|
+
if (value) {
|
|
93
|
+
dom.addEventListener(name, proxy, useCapture);
|
|
99
94
|
} else {
|
|
100
|
-
|
|
95
|
+
dom.removeEventListener(name, proxy, useCapture);
|
|
101
96
|
}
|
|
102
|
-
} else {
|
|
103
|
-
dom.removeEventListener(
|
|
104
|
-
name,
|
|
105
|
-
useCapture ? eventProxyCapture : eventProxy,
|
|
106
|
-
useCapture
|
|
107
|
-
);
|
|
108
97
|
}
|
|
109
98
|
} else {
|
|
110
99
|
if (namespace == SVG_NAMESPACE) {
|
|
@@ -154,10 +143,10 @@ export function setProperty(dom, name, value, oldValue, namespace) {
|
|
|
154
143
|
|
|
155
144
|
/**
|
|
156
145
|
* Create an event proxy function.
|
|
157
|
-
* @param {
|
|
146
|
+
* @param {string} name The prop name the handler is stored under.
|
|
158
147
|
* @private
|
|
159
148
|
*/
|
|
160
|
-
function createEventProxy(
|
|
149
|
+
function createEventProxy(name) {
|
|
161
150
|
/**
|
|
162
151
|
* Proxy an event to hooked event handlers
|
|
163
152
|
* @param {import('../internal').PreactEvent} e The event object from the browser
|
|
@@ -165,14 +154,14 @@ function createEventProxy(useCapture) {
|
|
|
165
154
|
*/
|
|
166
155
|
return function (e) {
|
|
167
156
|
if (this._listeners) {
|
|
168
|
-
const eventHandler = this._listeners[
|
|
157
|
+
const eventHandler = this._listeners[name];
|
|
169
158
|
if (e[EVENT_DISPATCHED] == NULL) {
|
|
170
159
|
e[EVENT_DISPATCHED] = eventClock++;
|
|
171
160
|
|
|
172
161
|
// When `e[EVENT_DISPATCHED]` is smaller than the time when the targeted event
|
|
173
|
-
//
|
|
162
|
+
// listener was attached we know we have bubbled up to an element that was added
|
|
174
163
|
// during patching the DOM.
|
|
175
|
-
} else if (e[EVENT_DISPATCHED] <
|
|
164
|
+
} else if (e[EVENT_DISPATCHED] < this._attached[name]) {
|
|
176
165
|
return;
|
|
177
166
|
}
|
|
178
167
|
return eventHandler(options.event ? options.event(e) : e);
|
|
@@ -180,5 +169,5 @@ function createEventProxy(useCapture) {
|
|
|
180
169
|
};
|
|
181
170
|
}
|
|
182
171
|
|
|
183
|
-
|
|
184
|
-
const
|
|
172
|
+
/** @type {Record<string, (e: Event) => any>} */
|
|
173
|
+
const eventProxies = {};
|