@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,48 +0,0 @@
1
- import { assign, slice } from './util';
2
- import { createVNode } from './create-element';
3
- import { NULL, UNDEFINED } from './constants';
4
-
5
- /**
6
- * Clones the given VNode, optionally adding attributes/props and replacing its
7
- * children.
8
- * @param {import('./internal').VNode} vnode The virtual DOM element to clone
9
- * @param {object} props Attributes/props to add when cloning
10
- * @param {Array<import('./internal').ComponentChildren>} rest Any additional arguments will be used
11
- * as replacement children.
12
- * @returns {import('./internal').VNode}
13
- */
14
- export function cloneElement(vnode, props, children) {
15
- let normalizedProps = assign({}, vnode.props),
16
- key,
17
- ref,
18
- i;
19
-
20
- let defaultProps;
21
-
22
- if (vnode.type && vnode.type.defaultProps) {
23
- defaultProps = vnode.type.defaultProps;
24
- }
25
-
26
- for (i in props) {
27
- if (i == 'key') key = props[i];
28
- else if (i == 'ref') ref = props[i];
29
- else if (props[i] === UNDEFINED && defaultProps != UNDEFINED) {
30
- normalizedProps[i] = defaultProps[i];
31
- } else {
32
- normalizedProps[i] = props[i];
33
- }
34
- }
35
-
36
- if (arguments.length > 2) {
37
- normalizedProps.children =
38
- arguments.length > 3 ? slice.call(arguments, 2) : children;
39
- }
40
-
41
- return createVNode(
42
- vnode.type,
43
- normalizedProps,
44
- key || vnode.key,
45
- ref || vnode.ref,
46
- NULL
47
- );
48
- }
@@ -1,399 +0,0 @@
1
- export as namespace preact;
2
-
3
- import { JSXInternal } from './jsx';
4
-
5
- export import JSX = JSXInternal;
6
-
7
- //
8
- // Preact Virtual DOM
9
- // -----------------------------------
10
-
11
- export interface VNode<P = {}> {
12
- type: ComponentType<P> | string;
13
- props: P & { children: ComponentChildren };
14
- key: Key;
15
- /**
16
- * ref is not guaranteed by React.ReactElement, for compatibility reasons
17
- * with popular react libs we define it as optional too
18
- */
19
- ref?: Ref<any> | null;
20
- /**
21
- * The time this `vnode` started rendering. Will only be set when
22
- * the devtools are attached.
23
- * Default value: `0`
24
- */
25
- startTime?: number;
26
- /**
27
- * The time that the rendering of this `vnode` was completed. Will only be
28
- * set when the devtools are attached.
29
- * Default value: `-1`
30
- */
31
- endTime?: number;
32
- }
33
-
34
- //
35
- // Preact Component interface
36
- // -----------------------------------
37
-
38
- export type Key = string | number | any;
39
-
40
- export type RefObject<T> = { current: T | null };
41
- export type RefCallback<T> = (instance: T | null) => void | (() => void);
42
- export type Ref<T> = RefObject<T> | RefCallback<T> | null;
43
-
44
- export type ComponentChild =
45
- | VNode<any>
46
- | object
47
- | string
48
- | number
49
- | bigint
50
- | boolean
51
- | null
52
- | undefined;
53
- export type ComponentChildren = ComponentChild[] | ComponentChild;
54
-
55
- export interface Attributes {
56
- key?: Key | undefined;
57
- jsx?: boolean | undefined;
58
- }
59
-
60
- export interface ClassAttributes<T> extends Attributes {
61
- ref?: Ref<T>;
62
- }
63
-
64
- export interface PreactDOMAttributes {
65
- children?: ComponentChildren;
66
- dangerouslySetInnerHTML?: {
67
- __html: string;
68
- };
69
- }
70
-
71
- export interface ErrorInfo {
72
- componentStack?: string;
73
- }
74
-
75
- export type RenderableProps<P, RefType = any> = P &
76
- Readonly<Attributes & { children?: ComponentChildren; ref?: Ref<RefType> }>;
77
-
78
- export type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
79
- export type ComponentFactory<P = {}> = ComponentType<P>;
80
-
81
- export type ComponentProps<
82
- C extends ComponentType<any> | keyof JSXInternal.IntrinsicElements
83
- > =
84
- C extends ComponentType<infer P>
85
- ? P
86
- : C extends keyof JSXInternal.IntrinsicElements
87
- ? JSXInternal.IntrinsicElements[C]
88
- : {};
89
-
90
- export interface FunctionComponent<P = {}> {
91
- (props: RenderableProps<P>, context?: any): VNode | null;
92
- displayName?: string;
93
- defaultProps?: Partial<P> | undefined;
94
- }
95
- export interface FunctionalComponent<P = {}> extends FunctionComponent<P> {}
96
-
97
- export interface ComponentClass<P = {}, S = {}> {
98
- new (props: P, context?: any): Component<P, S>;
99
- displayName?: string;
100
- defaultProps?: Partial<P>;
101
- contextType?: Context<any>;
102
- getDerivedStateFromProps?(
103
- props: Readonly<P>,
104
- state: Readonly<S>
105
- ): Partial<S> | null;
106
- getDerivedStateFromError?(error: any): Partial<S> | null;
107
- }
108
- export interface ComponentConstructor<P = {}, S = {}> extends ComponentClass<
109
- P,
110
- S
111
- > {}
112
-
113
- // Type alias for a component instance considered generally, whether stateless or stateful.
114
- export type AnyComponent<P = {}, S = {}> =
115
- | FunctionComponent<P>
116
- | ComponentConstructor<P, S>;
117
-
118
- export interface Component<P = {}, S = {}> {
119
- componentWillMount?(): void;
120
- componentDidMount?(): void;
121
- componentWillUnmount?(): void;
122
- getChildContext?(): object;
123
- componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
124
- shouldComponentUpdate?(
125
- nextProps: Readonly<P>,
126
- nextState: Readonly<S>,
127
- nextContext: any
128
- ): boolean;
129
- componentWillUpdate?(
130
- nextProps: Readonly<P>,
131
- nextState: Readonly<S>,
132
- nextContext: any
133
- ): void;
134
- getSnapshotBeforeUpdate?(oldProps: Readonly<P>, oldState: Readonly<S>): any;
135
- componentDidUpdate?(
136
- previousProps: Readonly<P>,
137
- previousState: Readonly<S>,
138
- snapshot: any
139
- ): void;
140
- componentDidCatch?(error: any, errorInfo: ErrorInfo): void;
141
- }
142
-
143
- export abstract class Component<P, S> {
144
- constructor(props?: P, context?: any);
145
-
146
- static displayName?: string;
147
- static defaultProps?: any;
148
- static contextType?: Context<any>;
149
-
150
- // Static members cannot reference class type parameters. This is not
151
- // supported in TypeScript. Reusing the same type arguments from `Component`
152
- // will lead to an impossible state where one cannot satisfy the type
153
- // constraint under no circumstances, see #1356.In general type arguments
154
- // seem to be a bit buggy and not supported well at the time of this
155
- // writing with TS 3.3.3333.
156
- static getDerivedStateFromProps?(
157
- props: Readonly<object>,
158
- state: Readonly<object>
159
- ): object | null;
160
- static getDerivedStateFromError?(error: any): object | null;
161
-
162
- state: Readonly<S>;
163
- props: RenderableProps<P>;
164
- context: any;
165
- base?: Element | Text;
166
-
167
- // From https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e836acc75a78cf0655b5dfdbe81d69fdd4d8a252/types/react/index.d.ts#L402
168
- // // We MUST keep setState() as a unified signature because it allows proper checking of the method return type.
169
- // // See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
170
- setState<K extends keyof S>(
171
- state:
172
- | ((
173
- prevState: Readonly<S>,
174
- props: Readonly<P>
175
- ) => Pick<S, K> | Partial<S> | null)
176
- | (Pick<S, K> | Partial<S> | null),
177
- callback?: () => void
178
- ): void;
179
-
180
- forceUpdate(callback?: () => void): void;
181
-
182
- abstract render(
183
- props?: RenderableProps<P>,
184
- state?: Readonly<S>,
185
- context?: any
186
- ): ComponentChild;
187
- }
188
-
189
- //
190
- // Preact createElement
191
- // -----------------------------------
192
-
193
- export function createElement(
194
- type: 'input',
195
- props:
196
- | (JSXInternal.DOMAttributes<HTMLInputElement> &
197
- ClassAttributes<HTMLInputElement>)
198
- | null,
199
- ...children: ComponentChildren[]
200
- ): VNode<
201
- JSXInternal.DOMAttributes<HTMLInputElement> &
202
- ClassAttributes<HTMLInputElement>
203
- >;
204
- export function createElement<
205
- P extends JSXInternal.HTMLAttributes<T>,
206
- T extends HTMLElement
207
- >(
208
- type: keyof JSXInternal.IntrinsicElements,
209
- props: (ClassAttributes<T> & P) | null,
210
- ...children: ComponentChildren[]
211
- ): VNode<ClassAttributes<T> & P>;
212
- export function createElement<
213
- P extends JSXInternal.SVGAttributes<T>,
214
- T extends HTMLElement
215
- >(
216
- type: keyof JSXInternal.IntrinsicElements,
217
- props: (ClassAttributes<T> & P) | null,
218
- ...children: ComponentChildren[]
219
- ): VNode<ClassAttributes<T> & P>;
220
- export function createElement<T extends HTMLElement>(
221
- type: string,
222
- props:
223
- | (ClassAttributes<T> &
224
- JSXInternal.HTMLAttributes &
225
- JSXInternal.SVGAttributes)
226
- | null,
227
- ...children: ComponentChildren[]
228
- ): VNode<
229
- ClassAttributes<T> & JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes
230
- >;
231
- export function createElement<P>(
232
- type: ComponentType<P> | string,
233
- props: (Attributes & P) | null,
234
- ...children: ComponentChildren[]
235
- ): VNode<P>;
236
- export namespace createElement {
237
- export import JSX = JSXInternal;
238
- }
239
-
240
- export function h(
241
- type: 'input',
242
- props:
243
- | (JSXInternal.DOMAttributes<HTMLInputElement> &
244
- ClassAttributes<HTMLInputElement>)
245
- | null,
246
- ...children: ComponentChildren[]
247
- ): VNode<
248
- JSXInternal.DOMAttributes<HTMLInputElement> &
249
- ClassAttributes<HTMLInputElement>
250
- >;
251
- export function h<
252
- P extends JSXInternal.HTMLAttributes<T>,
253
- T extends HTMLElement
254
- >(
255
- type: keyof JSXInternal.IntrinsicElements,
256
- props: (ClassAttributes<T> & P) | null,
257
- ...children: ComponentChildren[]
258
- ): VNode<ClassAttributes<T> & P>;
259
- export function h<
260
- P extends JSXInternal.SVGAttributes<T>,
261
- T extends HTMLElement
262
- >(
263
- type: keyof JSXInternal.IntrinsicElements,
264
- props: (ClassAttributes<T> & P) | null,
265
- ...children: ComponentChildren[]
266
- ): VNode<ClassAttributes<T> & P>;
267
- export function h<T extends HTMLElement>(
268
- type: string,
269
- props:
270
- | (ClassAttributes<T> &
271
- JSXInternal.HTMLAttributes &
272
- JSXInternal.SVGAttributes)
273
- | null,
274
- ...children: ComponentChildren[]
275
- ): VNode<
276
- | (ClassAttributes<T> &
277
- JSXInternal.HTMLAttributes &
278
- JSXInternal.SVGAttributes)
279
- | null
280
- >;
281
- export function h<P>(
282
- type: ComponentType<P> | string,
283
- props: (Attributes & P) | null,
284
- ...children: ComponentChildren[]
285
- ): VNode<Attributes & P>;
286
- export namespace h {
287
- export import JSX = JSXInternal;
288
- }
289
-
290
- //
291
- // Preact render
292
- // -----------------------------------
293
- interface ContainerNode {
294
- readonly nodeType: number;
295
- readonly parentNode: ContainerNode | null;
296
- readonly firstChild: ContainerNode | null;
297
- readonly childNodes: ArrayLike<ContainerNode>;
298
-
299
- contains(other: ContainerNode | null): boolean;
300
- insertBefore(node: ContainerNode, child: ContainerNode | null): ContainerNode;
301
- appendChild(node: ContainerNode): ContainerNode;
302
- removeChild(child: ContainerNode): ContainerNode;
303
- }
304
-
305
- export function render(vnode: ComponentChild, parent: ContainerNode): void;
306
- /**
307
- * @deprecated The `replaceNode` parameter will be removed in v11.
308
- *
309
- * Replacement Preact 10+ implementation can be found in the `preact-root-fragment` package.
310
- * Docs: https://github.com/preactjs/preact-root-fragment
311
- */
312
- export function render(
313
- vnode: ComponentChild,
314
- parent: ContainerNode,
315
- replaceNode?: Element | Text
316
- ): void;
317
- export function hydrate(vnode: ComponentChild, parent: ContainerNode): void;
318
- export function cloneElement(
319
- vnode: VNode<any>,
320
- props?: any,
321
- ...children: ComponentChildren[]
322
- ): VNode<any>;
323
- export function cloneElement<P>(
324
- vnode: VNode<P>,
325
- props?: any,
326
- ...children: ComponentChildren[]
327
- ): VNode<P>;
328
-
329
- //
330
- // Preact Built-in Components
331
- // -----------------------------------
332
-
333
- // TODO: Revisit what the public type of this is...
334
- export const Fragment: FunctionComponent<{}>;
335
-
336
- //
337
- // Preact options
338
- // -----------------------------------
339
-
340
- /**
341
- * Global options for preact
342
- */
343
- export interface Options {
344
- /** Attach a hook that is invoked whenever a VNode is created. */
345
- vnode?(vnode: VNode): void;
346
- /** Attach a hook that is invoked immediately before a vnode is unmounted. */
347
- unmount?(vnode: VNode): void;
348
- /** Attach a hook that is invoked after a vnode has rendered. */
349
- diffed?(vnode: VNode): void;
350
- event?(e: Event): any;
351
- requestAnimationFrame?(callback: () => void): void;
352
- debounceRendering?(cb: () => void): void;
353
- useDebugValue?(value: string | number): void;
354
- _addHookName?(name: string | number): void;
355
- __suspenseDidResolve?(vnode: VNode, cb: () => void): void;
356
- // __canSuspenseResolve?(vnode: VNode, cb: () => void): void;
357
-
358
- /**
359
- * Customize attribute serialization when a precompiled JSX transform
360
- * is used.
361
- */
362
- attr?(name: string, value: any): string | void;
363
- }
364
-
365
- export const options: Options;
366
-
367
- //
368
- // Preact helpers
369
- // -----------------------------------
370
- export function createRef<T = any>(): RefObject<T>;
371
- export function toChildArray(
372
- children: ComponentChildren
373
- ): Array<VNode | string | number>;
374
- export function isValidElement(vnode: any): vnode is VNode;
375
-
376
- //
377
- // Context
378
- // -----------------------------------
379
- export interface Consumer<T> extends FunctionComponent<{
380
- children: (value: T) => ComponentChildren;
381
- }> {}
382
- export interface PreactConsumer<T> extends Consumer<T> {}
383
-
384
- export interface Provider<T> extends FunctionComponent<{
385
- value: T;
386
- children?: ComponentChildren;
387
- }> {}
388
- export interface PreactProvider<T> extends Provider<T> {}
389
- export type ContextType<C extends Context<any>> =
390
- C extends Context<infer T> ? T : never;
391
-
392
- export interface Context<T> {
393
- Consumer: Consumer<T>;
394
- Provider: Provider<T>;
395
- displayName?: string;
396
- }
397
- export interface PreactContext<T> extends Context<T> {}
398
-
399
- export function createContext<T>(defaultValue: T): Context<T>;
@@ -1,2 +0,0 @@
1
- var r=require("../..");function t(){return r.options.t=r.options.debounceRendering,r.options.debounceRendering=function(t){return r.options.o=t},function(){return r.options.o&&r.options.o()}}var n=function(r){return null!=r&&"function"==typeof r.then},o=0;function e(){r.options.o&&(r.options.o(),delete r.options.o),void 0!==r.options.t?(r.options.debounceRendering=r.options.t,delete r.options.t):r.options.debounceRendering=void 0}exports.act=function(u){if(++o>1){try{var i=u();if(n(i))return i.then(function(){--o},function(r){throw--o,r})}catch(r){throw--o,r}return--o,Promise.resolve()}var c,f=r.options.requestAnimationFrame,a=t(),h=[];r.options.requestAnimationFrame=function(r){return h.push(r)};var v,l,p=function(){try{for(a();h.length;)c=h,h=[],c.forEach(function(r){return r()}),a()}catch(r){v||(v=r)}finally{e()}r.options.requestAnimationFrame=f,--o};try{l=u()}catch(r){v=r}if(n(l))return l.then(p,function(r){throw p(),r});if(p(),v)throw v;return Promise.resolve()},exports.setupRerender=t,exports.teardown=e;
2
- //# sourceMappingURL=testUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"testUtils.js","sources":["../src/index.js"],"sourcesContent":["import { options } from '../..';\n\n/**\n * Setup a rerender function that will drain the queue of pending renders\n * @returns {() => void}\n */\nexport function setupRerender() {\n\toptions.__test__previousDebounce = options.debounceRendering;\n\toptions.debounceRendering = cb => (options.__test__drainQueue = cb);\n\treturn () => options.__test__drainQueue && options.__test__drainQueue();\n}\n\nconst isThenable = value => value != null && typeof value.then == 'function';\n\n/** Depth of nested calls to `act`. */\nlet actDepth = 0;\n\n/**\n * Run a test function, and flush all effects and rerenders after invoking it.\n *\n * Returns a Promise which resolves \"immediately\" if the callback is\n * synchronous or when the callback's result resolves if it is asynchronous.\n *\n * @param {() => void|Promise<void>} cb The function under test. This may be sync or async.\n * @return {Promise<void>}\n */\nexport function act(cb) {\n\tif (++actDepth > 1) {\n\t\t// If calls to `act` are nested, a flush happens only when the\n\t\t// outermost call returns. In the inner call, we just execute the\n\t\t// callback and return since the infrastructure for flushing has already\n\t\t// been set up.\n\t\t//\n\t\t// If an exception occurs, the outermost `act` will handle cleanup.\n\t\ttry {\n\t\t\tconst result = cb();\n\t\t\tif (isThenable(result)) {\n\t\t\t\treturn result.then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\t--actDepth;\n\t\t\t\t\t},\n\t\t\t\t\te => {\n\t\t\t\t\t\t--actDepth;\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t--actDepth;\n\t\t\tthrow e;\n\t\t}\n\t\t--actDepth;\n\t\treturn Promise.resolve();\n\t}\n\n\tconst previousRequestAnimationFrame = options.requestAnimationFrame;\n\tconst rerender = setupRerender();\n\n\t/** @type {() => void} */\n\tlet flushes = [],\n\t\ttoFlush;\n\n\t// Override requestAnimationFrame so we can flush pending hooks.\n\toptions.requestAnimationFrame = fc => flushes.push(fc);\n\n\tconst finish = () => {\n\t\ttry {\n\t\t\trerender();\n\t\t\twhile (flushes.length) {\n\t\t\t\ttoFlush = flushes;\n\t\t\t\tflushes = [];\n\n\t\t\t\ttoFlush.forEach(x => x());\n\t\t\t\trerender();\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!err) {\n\t\t\t\terr = e;\n\t\t\t}\n\t\t} finally {\n\t\t\tteardown();\n\t\t}\n\n\t\toptions.requestAnimationFrame = previousRequestAnimationFrame;\n\t\t--actDepth;\n\t};\n\n\tlet err;\n\tlet result;\n\n\ttry {\n\t\tresult = cb();\n\t} catch (e) {\n\t\terr = e;\n\t}\n\n\tif (isThenable(result)) {\n\t\treturn result.then(finish, err => {\n\t\t\tfinish();\n\t\t\tthrow err;\n\t\t});\n\t}\n\n\t// nb. If the callback is synchronous, effects must be flushed before\n\t// `act` returns, so that the caller does not have to await the result,\n\t// even though React recommends this.\n\tfinish();\n\tif (err) {\n\t\tthrow err;\n\t}\n\treturn Promise.resolve();\n}\n\n/**\n * Teardown test environment and reset preact's internal state\n */\nexport function teardown() {\n\tif (options.__test__drainQueue) {\n\t\t// Flush any pending updates leftover by test\n\t\toptions.__test__drainQueue();\n\t\tdelete options.__test__drainQueue;\n\t}\n\n\tif (typeof options.__test__previousDebounce != 'undefined') {\n\t\toptions.debounceRendering = options.__test__previousDebounce;\n\t\tdelete options.__test__previousDebounce;\n\t} else {\n\t\toptions.debounceRendering = undefined;\n\t}\n}\n"],"names":["setupRerender","options","__test__previousDebounce","debounceRendering","cb","__test__drainQueue","isThenable","value","then","actDepth","teardown","undefined","result","e","Promise","resolve","toFlush","previousRequestAnimationFrame","requestAnimationFrame","rerender","flushes","fc","push","err","finish","length","forEach","x"],"mappings":"wBAMgB,SAAAA,IAGf,OAFAC,UAAQC,EAA2BD,EAAOA,QAACE,kBAC3CF,UAAQE,kBAAoB,SAAAC,GAAE,OAAKH,EAAOA,QAACI,EAAqBD,CAAE,oBACrDH,UAAQI,GAAsBJ,EAAOA,QAACI,GAAoB,CACxE,CAEA,IAAMC,EAAa,SAAAC,UAAkB,MAATA,GAAsC,mBAAdA,EAAMC,IAAkB,EAGxEC,EAAW,EAqGC,SAAAC,IACXT,EAAOA,QAACI,IAEXJ,UAAQI,WACDJ,UAAQI,QAG+B,IAApCJ,UAAQC,GAClBD,EAAAA,QAAQE,kBAAoBF,UAAQC,SAC7BD,EAAAA,QAAQC,GAEfD,EAAAA,QAAQE,uBAAoBQ,CAE9B,aAvGO,SAAaP,GACnB,KAAMK,EAAW,EAAG,CAOnB,IACC,IAAMG,EAASR,IACf,GAAIE,EAAWM,GACd,OAAOA,EAAOJ,KACb,aACGC,CACH,EACA,SAAAI,GAEC,OADEJ,EACII,CACP,EAMH,CAHE,MAAOA,GAER,OADEJ,EACII,CACP,CAEA,QADEJ,EACKK,QAAQC,SAChB,CAEA,IAKCC,EALKC,EAAgChB,UAAQiB,sBACxCC,EAAWnB,IAGboB,EAAU,GAIdnB,UAAQiB,sBAAwB,SAAAG,GAAE,OAAID,EAAQE,KAAKD,EAAG,EAEtD,IAsBIE,EACAX,EAvBEY,EAAS,WACd,IAEC,IADAL,IACOC,EAAQK,QACdT,EAAUI,EACVA,EAAU,GAEVJ,EAAQU,QAAQ,SAAAC,UAAKA,GAAG,GACxBR,GAQF,CANE,MAAON,GACHU,IACJA,EAAMV,EAER,CAAC,QACAH,GACD,CAEAT,UAAQiB,sBAAwBD,IAC9BR,CACH,EAKA,IACCG,EAASR,GAGV,CAFE,MAAOS,GACRU,EAAMV,CACP,CAEA,GAAIP,EAAWM,GACd,OAAOA,EAAOJ,KAAKgB,EAAQ,SAAAD,GAE1B,MADAC,IACMD,CACP,GAOD,GADAC,IACID,EACH,MAAMA,EAEP,OAAOT,QAAQC,SAChB"}
@@ -1,2 +0,0 @@
1
- import{options as t}from"../..";function n(){return t.t=t.debounceRendering,t.debounceRendering=function(n){return t.o=n},function(){return t.o&&t.o()}}var r=function(t){return null!=t&&"function"==typeof t.then},o=0;function u(u){if(++o>1){try{var e=u();if(r(e))return e.then(function(){--o},function(t){throw--o,t})}catch(t){throw--o,t}return--o,Promise.resolve()}var f,c=t.requestAnimationFrame,a=n(),h=[];t.requestAnimationFrame=function(t){return h.push(t)};var l,v,y=function(){try{for(a();h.length;)f=h,h=[],f.forEach(function(t){return t()}),a()}catch(t){l||(l=t)}finally{i()}t.requestAnimationFrame=c,--o};try{v=u()}catch(t){l=t}if(r(v))return v.then(y,function(t){throw y(),t});if(y(),l)throw l;return Promise.resolve()}function i(){t.o&&(t.o(),delete t.o),void 0!==t.t?(t.debounceRendering=t.t,delete t.t):t.debounceRendering=void 0}export{u as act,n as setupRerender,i as teardown};
2
- //# sourceMappingURL=testUtils.module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"testUtils.module.js","sources":["../src/index.js"],"sourcesContent":["import { options } from '../..';\n\n/**\n * Setup a rerender function that will drain the queue of pending renders\n * @returns {() => void}\n */\nexport function setupRerender() {\n\toptions.__test__previousDebounce = options.debounceRendering;\n\toptions.debounceRendering = cb => (options.__test__drainQueue = cb);\n\treturn () => options.__test__drainQueue && options.__test__drainQueue();\n}\n\nconst isThenable = value => value != null && typeof value.then == 'function';\n\n/** Depth of nested calls to `act`. */\nlet actDepth = 0;\n\n/**\n * Run a test function, and flush all effects and rerenders after invoking it.\n *\n * Returns a Promise which resolves \"immediately\" if the callback is\n * synchronous or when the callback's result resolves if it is asynchronous.\n *\n * @param {() => void|Promise<void>} cb The function under test. This may be sync or async.\n * @return {Promise<void>}\n */\nexport function act(cb) {\n\tif (++actDepth > 1) {\n\t\t// If calls to `act` are nested, a flush happens only when the\n\t\t// outermost call returns. In the inner call, we just execute the\n\t\t// callback and return since the infrastructure for flushing has already\n\t\t// been set up.\n\t\t//\n\t\t// If an exception occurs, the outermost `act` will handle cleanup.\n\t\ttry {\n\t\t\tconst result = cb();\n\t\t\tif (isThenable(result)) {\n\t\t\t\treturn result.then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\t--actDepth;\n\t\t\t\t\t},\n\t\t\t\t\te => {\n\t\t\t\t\t\t--actDepth;\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t--actDepth;\n\t\t\tthrow e;\n\t\t}\n\t\t--actDepth;\n\t\treturn Promise.resolve();\n\t}\n\n\tconst previousRequestAnimationFrame = options.requestAnimationFrame;\n\tconst rerender = setupRerender();\n\n\t/** @type {() => void} */\n\tlet flushes = [],\n\t\ttoFlush;\n\n\t// Override requestAnimationFrame so we can flush pending hooks.\n\toptions.requestAnimationFrame = fc => flushes.push(fc);\n\n\tconst finish = () => {\n\t\ttry {\n\t\t\trerender();\n\t\t\twhile (flushes.length) {\n\t\t\t\ttoFlush = flushes;\n\t\t\t\tflushes = [];\n\n\t\t\t\ttoFlush.forEach(x => x());\n\t\t\t\trerender();\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!err) {\n\t\t\t\terr = e;\n\t\t\t}\n\t\t} finally {\n\t\t\tteardown();\n\t\t}\n\n\t\toptions.requestAnimationFrame = previousRequestAnimationFrame;\n\t\t--actDepth;\n\t};\n\n\tlet err;\n\tlet result;\n\n\ttry {\n\t\tresult = cb();\n\t} catch (e) {\n\t\terr = e;\n\t}\n\n\tif (isThenable(result)) {\n\t\treturn result.then(finish, err => {\n\t\t\tfinish();\n\t\t\tthrow err;\n\t\t});\n\t}\n\n\t// nb. If the callback is synchronous, effects must be flushed before\n\t// `act` returns, so that the caller does not have to await the result,\n\t// even though React recommends this.\n\tfinish();\n\tif (err) {\n\t\tthrow err;\n\t}\n\treturn Promise.resolve();\n}\n\n/**\n * Teardown test environment and reset preact's internal state\n */\nexport function teardown() {\n\tif (options.__test__drainQueue) {\n\t\t// Flush any pending updates leftover by test\n\t\toptions.__test__drainQueue();\n\t\tdelete options.__test__drainQueue;\n\t}\n\n\tif (typeof options.__test__previousDebounce != 'undefined') {\n\t\toptions.debounceRendering = options.__test__previousDebounce;\n\t\tdelete options.__test__previousDebounce;\n\t} else {\n\t\toptions.debounceRendering = undefined;\n\t}\n}\n"],"names":["setupRerender","options","__test__previousDebounce","debounceRendering","cb","__test__drainQueue","isThenable","value","then","actDepth","act","result","e","Promise","resolve","toFlush","previousRequestAnimationFrame","requestAnimationFrame","rerender","flushes","fc","push","err","finish","length","forEach","x","teardown","undefined"],"mappings":"iCAMgB,SAAAA,IAGf,OAFAC,EAAQC,EAA2BD,EAAQE,kBAC3CF,EAAQE,kBAAoB,SAAAC,GAAE,OAAKH,EAAQI,EAAqBD,CAAE,oBACrDH,EAAQI,GAAsBJ,EAAQI,GAAoB,CACxE,CAEA,IAAMC,EAAa,SAAAC,UAAkB,MAATA,GAAsC,mBAAdA,EAAMC,IAAkB,EAGxEC,EAAW,EAWR,SAASC,EAAIN,GACnB,KAAMK,EAAW,EAAG,CAOnB,IACC,IAAME,EAASP,IACf,GAAIE,EAAWK,GACd,OAAOA,EAAOH,KACb,aACGC,CACH,EACA,SAAAG,GAEC,OADEH,EACIG,CACP,EAMH,CAHE,MAAOA,GAER,OADEH,EACIG,CACP,CAEA,QADEH,EACKI,QAAQC,SAChB,CAEA,IAKCC,EALKC,EAAgCf,EAAQgB,sBACxCC,EAAWlB,IAGbmB,EAAU,GAIdlB,EAAQgB,sBAAwB,SAAAG,GAAE,OAAID,EAAQE,KAAKD,EAAG,EAEtD,IAsBIE,EACAX,EAvBEY,EAAS,WACd,IAEC,IADAL,IACOC,EAAQK,QACdT,EAAUI,EACVA,EAAU,GAEVJ,EAAQU,QAAQ,SAAAC,UAAKA,GAAG,GACxBR,GAQF,CANE,MAAON,GACHU,IACJA,EAAMV,EAER,CAAC,QACAe,GACD,CAEA1B,EAAQgB,sBAAwBD,IAC9BP,CACH,EAKA,IACCE,EAASP,GAGV,CAFE,MAAOQ,GACRU,EAAMV,CACP,CAEA,GAAIN,EAAWK,GACd,OAAOA,EAAOH,KAAKe,EAAQ,SAAAD,GAE1B,MADAC,IACMD,CACP,GAOD,GADAC,IACID,EACH,MAAMA,EAEP,OAAOT,QAAQC,SAChB,CAKgB,SAAAa,IACX1B,EAAQI,IAEXJ,EAAQI,WACDJ,EAAQI,QAG+B,IAApCJ,EAAQC,GAClBD,EAAQE,kBAAoBF,EAAQC,SAC7BD,EAAQC,GAEfD,EAAQE,uBAAoByB,CAE9B"}
@@ -1,2 +0,0 @@
1
- !function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("../..")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t((n||self).preactTestUtils={},n.preact)}(this,function(n,t){function e(){return t.options.t=t.options.debounceRendering,t.options.debounceRendering=function(n){return t.options.o=n},function(){return t.options.o&&t.options.o()}}var r=function(n){return null!=n&&"function"==typeof n.then},o=0;function i(){t.options.o&&(t.options.o(),delete t.options.o),void 0!==t.options.t?(t.options.debounceRendering=t.options.t,delete t.options.t):t.options.debounceRendering=void 0}n.act=function(n){if(++o>1){try{var f=n();if(r(f))return f.then(function(){--o},function(n){throw--o,n})}catch(n){throw--o,n}return--o,Promise.resolve()}var u,c=t.options.requestAnimationFrame,a=e(),d=[];t.options.requestAnimationFrame=function(n){return d.push(n)};var l,h,p=function(){try{for(a();d.length;)u=d,d=[],u.forEach(function(n){return n()}),a()}catch(n){l||(l=n)}finally{i()}t.options.requestAnimationFrame=c,--o};try{h=n()}catch(n){l=n}if(r(h))return h.then(p,function(n){throw p(),n});if(p(),l)throw l;return Promise.resolve()},n.setupRerender=e,n.teardown=i});
2
- //# sourceMappingURL=testUtils.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"testUtils.umd.js","sources":["../src/index.js"],"sourcesContent":["import { options } from '../..';\n\n/**\n * Setup a rerender function that will drain the queue of pending renders\n * @returns {() => void}\n */\nexport function setupRerender() {\n\toptions.__test__previousDebounce = options.debounceRendering;\n\toptions.debounceRendering = cb => (options.__test__drainQueue = cb);\n\treturn () => options.__test__drainQueue && options.__test__drainQueue();\n}\n\nconst isThenable = value => value != null && typeof value.then == 'function';\n\n/** Depth of nested calls to `act`. */\nlet actDepth = 0;\n\n/**\n * Run a test function, and flush all effects and rerenders after invoking it.\n *\n * Returns a Promise which resolves \"immediately\" if the callback is\n * synchronous or when the callback's result resolves if it is asynchronous.\n *\n * @param {() => void|Promise<void>} cb The function under test. This may be sync or async.\n * @return {Promise<void>}\n */\nexport function act(cb) {\n\tif (++actDepth > 1) {\n\t\t// If calls to `act` are nested, a flush happens only when the\n\t\t// outermost call returns. In the inner call, we just execute the\n\t\t// callback and return since the infrastructure for flushing has already\n\t\t// been set up.\n\t\t//\n\t\t// If an exception occurs, the outermost `act` will handle cleanup.\n\t\ttry {\n\t\t\tconst result = cb();\n\t\t\tif (isThenable(result)) {\n\t\t\t\treturn result.then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\t--actDepth;\n\t\t\t\t\t},\n\t\t\t\t\te => {\n\t\t\t\t\t\t--actDepth;\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t--actDepth;\n\t\t\tthrow e;\n\t\t}\n\t\t--actDepth;\n\t\treturn Promise.resolve();\n\t}\n\n\tconst previousRequestAnimationFrame = options.requestAnimationFrame;\n\tconst rerender = setupRerender();\n\n\t/** @type {() => void} */\n\tlet flushes = [],\n\t\ttoFlush;\n\n\t// Override requestAnimationFrame so we can flush pending hooks.\n\toptions.requestAnimationFrame = fc => flushes.push(fc);\n\n\tconst finish = () => {\n\t\ttry {\n\t\t\trerender();\n\t\t\twhile (flushes.length) {\n\t\t\t\ttoFlush = flushes;\n\t\t\t\tflushes = [];\n\n\t\t\t\ttoFlush.forEach(x => x());\n\t\t\t\trerender();\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!err) {\n\t\t\t\terr = e;\n\t\t\t}\n\t\t} finally {\n\t\t\tteardown();\n\t\t}\n\n\t\toptions.requestAnimationFrame = previousRequestAnimationFrame;\n\t\t--actDepth;\n\t};\n\n\tlet err;\n\tlet result;\n\n\ttry {\n\t\tresult = cb();\n\t} catch (e) {\n\t\terr = e;\n\t}\n\n\tif (isThenable(result)) {\n\t\treturn result.then(finish, err => {\n\t\t\tfinish();\n\t\t\tthrow err;\n\t\t});\n\t}\n\n\t// nb. If the callback is synchronous, effects must be flushed before\n\t// `act` returns, so that the caller does not have to await the result,\n\t// even though React recommends this.\n\tfinish();\n\tif (err) {\n\t\tthrow err;\n\t}\n\treturn Promise.resolve();\n}\n\n/**\n * Teardown test environment and reset preact's internal state\n */\nexport function teardown() {\n\tif (options.__test__drainQueue) {\n\t\t// Flush any pending updates leftover by test\n\t\toptions.__test__drainQueue();\n\t\tdelete options.__test__drainQueue;\n\t}\n\n\tif (typeof options.__test__previousDebounce != 'undefined') {\n\t\toptions.debounceRendering = options.__test__previousDebounce;\n\t\tdelete options.__test__previousDebounce;\n\t} else {\n\t\toptions.debounceRendering = undefined;\n\t}\n}\n"],"names":["setupRerender","options","__test__previousDebounce","debounceRendering","cb","__test__drainQueue","isThenable","value","then","actDepth","teardown","undefined","result","e","Promise","resolve","toFlush","previousRequestAnimationFrame","requestAnimationFrame","rerender","flushes","fc","push","err","finish","length","forEach","x"],"mappings":"+QAMgB,SAAAA,IAGf,OAFAC,UAAQC,EAA2BD,EAAOA,QAACE,kBAC3CF,UAAQE,kBAAoB,SAAAC,GAAE,OAAKH,EAAOA,QAACI,EAAqBD,CAAE,oBACrDH,UAAQI,GAAsBJ,EAAOA,QAACI,GAAoB,CACxE,CAEA,IAAMC,EAAa,SAAAC,UAAkB,MAATA,GAAsC,mBAAdA,EAAMC,IAAkB,EAGxEC,EAAW,EAqGC,SAAAC,IACXT,EAAOA,QAACI,IAEXJ,UAAQI,WACDJ,UAAQI,QAG+B,IAApCJ,UAAQC,GAClBD,EAAAA,QAAQE,kBAAoBF,UAAQC,SAC7BD,EAAAA,QAAQC,GAEfD,EAAAA,QAAQE,uBAAoBQ,CAE9B,OAvGO,SAAaP,GACnB,KAAMK,EAAW,EAAG,CAOnB,IACC,IAAMG,EAASR,IACf,GAAIE,EAAWM,GACd,OAAOA,EAAOJ,KACb,aACGC,CACH,EACA,SAAAI,GAEC,OADEJ,EACII,CACP,EAMH,CAHE,MAAOA,GAER,OADEJ,EACII,CACP,CAEA,QADEJ,EACKK,QAAQC,SAChB,CAEA,IAKCC,EALKC,EAAgChB,UAAQiB,sBACxCC,EAAWnB,IAGboB,EAAU,GAIdnB,UAAQiB,sBAAwB,SAAAG,GAAE,OAAID,EAAQE,KAAKD,EAAG,EAEtD,IAsBIE,EACAX,EAvBEY,EAAS,WACd,IAEC,IADAL,IACOC,EAAQK,QACdT,EAAUI,EACVA,EAAU,GAEVJ,EAAQU,QAAQ,SAAAC,UAAKA,GAAG,GACxBR,GAQF,CANE,MAAON,GACHU,IACJA,EAAMV,EAER,CAAC,QACAH,GACD,CAEAT,UAAQiB,sBAAwBD,IAC9BR,CACH,EAKA,IACCG,EAASR,GAGV,CAFE,MAAOS,GACRU,EAAMV,CACP,CAEA,GAAIP,EAAWM,GACd,OAAOA,EAAOJ,KAAKgB,EAAQ,SAAAD,GAE1B,MADAC,IACMD,CACP,GAOD,GADAC,IACID,EACH,MAAMA,EAEP,OAAOT,QAAQC,SAChB"}