@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.
Files changed (127) hide show
  1. package/LICENSE +9 -2
  2. package/dist/index.esm.js +3760 -3762
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.js +3724 -3804
  5. package/dist/index.js.map +1 -1
  6. package/package.json +22 -48
  7. package/preact/README.md +5 -5
  8. package/preact/compat/client.d.ts +1 -3
  9. package/preact/compat/dist/compat.mjs +2 -2
  10. package/preact/compat/dist/compat.mjs.map +1 -0
  11. package/preact/compat/package.json +2 -41
  12. package/preact/compat/scheduler.d.ts +12 -0
  13. package/preact/compat/server.d.ts +17 -0
  14. package/preact/compat/src/Children.js +3 -3
  15. package/preact/compat/src/PureComponent.js +20 -12
  16. package/preact/compat/src/forwardRef.js +4 -17
  17. package/preact/compat/src/hooks.js +17 -51
  18. package/preact/compat/src/index.d.ts +249 -164
  19. package/preact/compat/src/index.js +52 -43
  20. package/preact/compat/src/internal.d.ts +1 -2
  21. package/preact/compat/src/memo.js +2 -2
  22. package/preact/compat/src/portals.js +2 -68
  23. package/preact/compat/src/render.js +182 -73
  24. package/preact/compat/src/suspense.d.ts +1 -3
  25. package/preact/compat/src/suspense.js +169 -179
  26. package/preact/compat/src/util.js +5 -22
  27. package/preact/debug/dist/debug.mjs +2 -2
  28. package/preact/debug/dist/debug.mjs.map +1 -0
  29. package/preact/debug/package.json +3 -14
  30. package/preact/debug/src/check-props.js +2 -6
  31. package/preact/debug/src/component-stack.js +67 -16
  32. package/preact/debug/src/debug.js +80 -35
  33. package/preact/debug/src/index.d.ts +11 -1
  34. package/preact/debug/src/index.js +3 -1
  35. package/preact/debug/src/util.js +1 -11
  36. package/preact/devtools/dist/devtools.mjs +2 -2
  37. package/preact/devtools/dist/devtools.mjs.map +1 -0
  38. package/preact/devtools/package.json +3 -15
  39. package/preact/devtools/src/devtools.js +1 -1
  40. package/preact/dist/preact.mjs +2 -2
  41. package/preact/dist/preact.mjs.map +1 -0
  42. package/preact/hooks/dist/hooks.mjs +2 -2
  43. package/preact/hooks/dist/hooks.mjs.map +1 -0
  44. package/preact/hooks/package.json +5 -24
  45. package/preact/hooks/src/index.d.ts +6 -13
  46. package/preact/hooks/src/index.js +95 -73
  47. package/preact/hooks/src/internal.d.ts +8 -3
  48. package/preact/jsx-runtime/dist/jsxRuntime.mjs +2 -2
  49. package/preact/jsx-runtime/dist/jsxRuntime.mjs.map +1 -0
  50. package/preact/jsx-runtime/package.json +4 -16
  51. package/preact/jsx-runtime/src/index.d.ts +11 -11
  52. package/preact/jsx-runtime/src/index.js +25 -40
  53. package/preact/jsx-runtime/src/utils.js +3 -3
  54. package/preact/package.json +59 -115
  55. package/preact/src/component.js +54 -47
  56. package/preact/src/constants.js +17 -2
  57. package/preact/src/create-context.js +4 -14
  58. package/preact/src/create-element.js +42 -17
  59. package/preact/src/create-portal.js +20 -0
  60. package/preact/src/diff/catch-error.js +26 -8
  61. package/preact/src/diff/children.js +158 -96
  62. package/preact/src/diff/index.js +265 -146
  63. package/preact/src/diff/props.js +39 -50
  64. package/preact/src/dom.d.ts +796 -147
  65. package/preact/src/index.d.ts +7 -18
  66. package/preact/src/index.js +2 -1
  67. package/preact/src/internal.d.ts +16 -24
  68. package/preact/src/jsx.d.ts +222 -2910
  69. package/preact/src/render.js +30 -34
  70. package/preact/src/util.js +5 -20
  71. package/preact/test-utils/dist/testUtils.mjs +1 -1
  72. package/preact/test-utils/dist/testUtils.mjs.map +1 -0
  73. package/preact/test-utils/package.json +5 -17
  74. package/README.md +0 -35
  75. package/preact/compat/dist/compat.js +0 -2
  76. package/preact/compat/dist/compat.js.map +0 -1
  77. package/preact/compat/dist/compat.module.js +0 -2
  78. package/preact/compat/dist/compat.module.js.map +0 -1
  79. package/preact/compat/dist/compat.umd.js +0 -2
  80. package/preact/compat/dist/compat.umd.js.map +0 -1
  81. package/preact/compat/src/suspense-list.d.ts +0 -16
  82. package/preact/compat/src/suspense-list.js +0 -127
  83. package/preact/debug/dist/debug.js +0 -2
  84. package/preact/debug/dist/debug.js.map +0 -1
  85. package/preact/debug/dist/debug.module.js +0 -2
  86. package/preact/debug/dist/debug.module.js.map +0 -1
  87. package/preact/debug/dist/debug.umd.js +0 -2
  88. package/preact/debug/dist/debug.umd.js.map +0 -1
  89. package/preact/devtools/dist/devtools.js +0 -2
  90. package/preact/devtools/dist/devtools.js.map +0 -1
  91. package/preact/devtools/dist/devtools.module.js +0 -2
  92. package/preact/devtools/dist/devtools.module.js.map +0 -1
  93. package/preact/devtools/dist/devtools.umd.js +0 -2
  94. package/preact/devtools/dist/devtools.umd.js.map +0 -1
  95. package/preact/dist/preact.js +0 -2
  96. package/preact/dist/preact.js.map +0 -1
  97. package/preact/dist/preact.min.js +0 -2
  98. package/preact/dist/preact.min.js.map +0 -1
  99. package/preact/dist/preact.min.module.js +0 -2
  100. package/preact/dist/preact.min.module.js.map +0 -1
  101. package/preact/dist/preact.min.umd.js +0 -2
  102. package/preact/dist/preact.min.umd.js.map +0 -1
  103. package/preact/dist/preact.module.js +0 -2
  104. package/preact/dist/preact.module.js.map +0 -1
  105. package/preact/dist/preact.umd.js +0 -2
  106. package/preact/dist/preact.umd.js.map +0 -1
  107. package/preact/hooks/dist/hooks.js +0 -2
  108. package/preact/hooks/dist/hooks.js.map +0 -1
  109. package/preact/hooks/dist/hooks.module.js +0 -2
  110. package/preact/hooks/dist/hooks.module.js.map +0 -1
  111. package/preact/hooks/dist/hooks.umd.js +0 -2
  112. package/preact/hooks/dist/hooks.umd.js.map +0 -1
  113. package/preact/jsx-runtime/dist/jsxRuntime.js +0 -2
  114. package/preact/jsx-runtime/dist/jsxRuntime.js.map +0 -1
  115. package/preact/jsx-runtime/dist/jsxRuntime.module.js +0 -2
  116. package/preact/jsx-runtime/dist/jsxRuntime.module.js.map +0 -1
  117. package/preact/jsx-runtime/dist/jsxRuntime.umd.js +0 -2
  118. package/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +0 -1
  119. package/preact/src/cjs.js +0 -3
  120. package/preact/src/clone-element.js +0 -48
  121. package/preact/src/index-5.d.ts +0 -399
  122. package/preact/test-utils/dist/testUtils.js +0 -2
  123. package/preact/test-utils/dist/testUtils.js.map +0 -1
  124. package/preact/test-utils/dist/testUtils.module.js +0 -2
  125. package/preact/test-utils/dist/testUtils.module.js.map +0 -1
  126. package/preact/test-utils/dist/testUtils.umd.js +0 -2
  127. package/preact/test-utils/dist/testUtils.umd.js.map +0 -1
@@ -1,26 +1,17 @@
1
- import { IS_NON_DIMENSIONAL, NULL, SVG_NAMESPACE } from '../constants';
1
+ import { NULL, SVG_NAMESPACE } from '../constants';
2
2
  import options from '../options';
3
3
 
4
- // Per-instance unique key for event clock stamps. Each Preact copy on the page
5
- // gets its own random suffix so that `_dispatched` / `_attached` properties on
6
- // shared event objects and handler functions cannot collide across instances.
7
- // ~1 in 60M collision odds - if you have that many praect versions on the page,
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 == NULL ? '' : 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 + 'px';
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
- useCapture = name != (name = name.replace(CAPTURE_REGEX, '$1'));
81
- const lowerCaseName = name.toLowerCase();
82
-
83
- // Infer correct casing for DOM built-in events:
84
- if (lowerCaseName in dom || name == 'onFocusOut' || name == 'onFocusIn')
85
- name = lowerCaseName.slice(2);
86
- else name = name.slice(2);
87
-
88
- if (!dom._listeners) dom._listeners = {};
89
- dom._listeners[name + useCapture] = value;
90
-
91
- if (value) {
92
- if (!oldValue) {
93
- value[EVENT_ATTACHED] = eventClock;
94
- dom.addEventListener(
95
- name,
96
- useCapture ? eventProxyCapture : eventProxy,
97
- useCapture
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
- value[EVENT_ATTACHED] = oldValue[EVENT_ATTACHED];
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 {boolean} useCapture Is the event handler for the capture phase.
146
+ * @param {string} name The prop name the handler is stored under.
158
147
  * @private
159
148
  */
160
- function createEventProxy(useCapture) {
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[e.type + useCapture];
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
- // handler was attached we know we have bubbled up to an element that was added
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] < eventHandler[EVENT_ATTACHED]) {
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
- const eventProxy = createEventProxy(false);
184
- const eventProxyCapture = createEventProxy(true);
172
+ /** @type {Record<string, (e: Event) => any>} */
173
+ const eventProxies = {};