@bpmn-io/properties-panel 2.2.1 → 3.0.0

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 (113) hide show
  1. package/dist/index.esm.js +12 -64
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/index.js +12 -64
  4. package/dist/index.js.map +1 -1
  5. package/package.json +7 -7
  6. package/preact/README.md +56 -51
  7. package/preact/compat/client.js +19 -0
  8. package/preact/compat/client.mjs +22 -0
  9. package/preact/compat/dist/compat.js +1 -1
  10. package/preact/compat/dist/compat.js.map +1 -1
  11. package/preact/compat/dist/compat.mjs +1 -1
  12. package/preact/compat/dist/compat.module.js +1 -1
  13. package/preact/compat/dist/compat.module.js.map +1 -1
  14. package/preact/compat/dist/compat.umd.js +1 -1
  15. package/preact/compat/dist/compat.umd.js.map +1 -1
  16. package/preact/compat/jsx-dev-runtime.js +2 -0
  17. package/preact/compat/jsx-dev-runtime.mjs +2 -0
  18. package/preact/compat/jsx-runtime.js +2 -0
  19. package/preact/compat/jsx-runtime.mjs +2 -0
  20. package/preact/compat/package.json +31 -0
  21. package/preact/compat/scheduler.js +15 -0
  22. package/preact/compat/{src/scheduler.js → scheduler.mjs} +8 -9
  23. package/preact/compat/server.browser.js +4 -0
  24. package/preact/compat/src/PureComponent.js +1 -1
  25. package/preact/compat/src/forwardRef.js +2 -9
  26. package/preact/compat/src/index.d.ts +58 -4
  27. package/preact/compat/src/index.js +73 -2
  28. package/preact/compat/src/portals.js +4 -2
  29. package/preact/compat/src/render.js +133 -76
  30. package/preact/compat/src/suspense-list.d.ts +2 -2
  31. package/preact/compat/src/suspense-list.js +14 -13
  32. package/preact/compat/src/suspense.d.ts +4 -4
  33. package/preact/compat/src/suspense.js +6 -6
  34. package/preact/compat/src/util.js +10 -0
  35. package/preact/debug/dist/debug.js +1 -1
  36. package/preact/debug/dist/debug.js.map +1 -1
  37. package/preact/debug/dist/debug.mjs +1 -1
  38. package/preact/debug/dist/debug.module.js +1 -1
  39. package/preact/debug/dist/debug.module.js.map +1 -1
  40. package/preact/debug/dist/debug.umd.js +1 -1
  41. package/preact/debug/dist/debug.umd.js.map +1 -1
  42. package/preact/debug/package.json +9 -0
  43. package/preact/debug/src/check-props.js +3 -3
  44. package/preact/debug/src/debug.js +38 -17
  45. package/preact/debug/src/index.d.ts +4 -0
  46. package/preact/debug/src/util.js +4 -0
  47. package/preact/devtools/dist/devtools.js +1 -1
  48. package/preact/devtools/dist/devtools.js.map +1 -1
  49. package/preact/devtools/dist/devtools.mjs +1 -1
  50. package/preact/devtools/dist/devtools.module.js +1 -1
  51. package/preact/devtools/dist/devtools.module.js.map +1 -1
  52. package/preact/devtools/dist/devtools.umd.js +1 -1
  53. package/preact/devtools/dist/devtools.umd.js.map +1 -1
  54. package/preact/devtools/package.json +23 -14
  55. package/preact/devtools/src/devtools.js +1 -1
  56. package/preact/dist/preact.js +1 -1
  57. package/preact/dist/preact.js.map +1 -1
  58. package/preact/dist/preact.min.js +1 -1
  59. package/preact/dist/preact.min.js.map +1 -1
  60. package/preact/dist/preact.min.module.js +2 -0
  61. package/preact/dist/preact.min.module.js.map +1 -0
  62. package/preact/dist/preact.min.umd.js +2 -0
  63. package/preact/dist/preact.min.umd.js.map +1 -0
  64. package/preact/dist/preact.mjs +1 -1
  65. package/preact/dist/preact.module.js +1 -1
  66. package/preact/dist/preact.module.js.map +1 -1
  67. package/preact/dist/preact.umd.js +1 -1
  68. package/preact/dist/preact.umd.js.map +1 -1
  69. package/preact/hooks/dist/hooks.js +1 -1
  70. package/preact/hooks/dist/hooks.js.map +1 -1
  71. package/preact/hooks/dist/hooks.mjs +1 -1
  72. package/preact/hooks/dist/hooks.module.js +1 -1
  73. package/preact/hooks/dist/hooks.module.js.map +1 -1
  74. package/preact/hooks/dist/hooks.umd.js +1 -1
  75. package/preact/hooks/dist/hooks.umd.js.map +1 -1
  76. package/preact/hooks/package.json +9 -0
  77. package/preact/hooks/src/index.d.ts +26 -14
  78. package/preact/hooks/src/index.js +169 -44
  79. package/preact/hooks/src/internal.d.ts +12 -2
  80. package/preact/jsx-runtime/dist/jsxRuntime.js +1 -1
  81. package/preact/jsx-runtime/dist/jsxRuntime.js.map +1 -1
  82. package/preact/jsx-runtime/dist/jsxRuntime.mjs +1 -1
  83. package/preact/jsx-runtime/dist/jsxRuntime.module.js +1 -1
  84. package/preact/jsx-runtime/dist/jsxRuntime.module.js.map +1 -1
  85. package/preact/jsx-runtime/dist/jsxRuntime.umd.js +1 -1
  86. package/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -1
  87. package/preact/jsx-runtime/package.json +26 -17
  88. package/preact/jsx-runtime/src/index.js +19 -13
  89. package/preact/package.json +315 -262
  90. package/preact/src/clone-element.js +16 -10
  91. package/preact/src/component.js +33 -23
  92. package/preact/src/constants.js +2 -1
  93. package/preact/src/create-context.js +8 -3
  94. package/preact/src/create-element.js +9 -11
  95. package/preact/src/diff/catch-error.js +4 -2
  96. package/preact/src/diff/children.js +41 -32
  97. package/preact/src/diff/index.js +81 -34
  98. package/preact/src/diff/props.js +15 -14
  99. package/preact/src/index.d.ts +369 -301
  100. package/preact/src/internal.d.ts +11 -2
  101. package/preact/src/jsx.d.ts +1862 -626
  102. package/preact/src/options.js +1 -2
  103. package/preact/src/render.js +5 -6
  104. package/preact/src/util.js +6 -0
  105. package/preact/test-utils/dist/testUtils.js +1 -1
  106. package/preact/test-utils/dist/testUtils.js.map +1 -1
  107. package/preact/test-utils/dist/testUtils.mjs +1 -1
  108. package/preact/test-utils/dist/testUtils.module.js +1 -1
  109. package/preact/test-utils/dist/testUtils.module.js.map +1 -1
  110. package/preact/test-utils/dist/testUtils.umd.js +1 -1
  111. package/preact/test-utils/dist/testUtils.umd.js.map +1 -1
  112. package/preact/test-utils/package.json +9 -0
  113. package/preact/test-utils/src/index.js +2 -1
@@ -1,310 +1,378 @@
1
- export = preact;
2
1
  export as namespace preact;
3
2
 
4
3
  import { JSXInternal } from './jsx';
5
4
 
6
- declare namespace preact {
7
- export import JSX = JSXInternal;
5
+ export import JSX = JSXInternal;
8
6
 
9
- //
10
- // Preact Virtual DOM
11
- // -----------------------------------
12
-
13
- interface VNode<P = {}> {
14
- type: ComponentType<P> | string;
15
- props: P & { children: ComponentChildren };
16
- key: Key;
17
- /**
18
- * ref is not guaranteed by React.ReactElement, for compatibility reasons
19
- * with popular react libs we define it as optional too
20
- */
21
- ref?: Ref<any> | null;
22
- /**
23
- * The time this `vnode` started rendering. Will only be set when
24
- * the devtools are attached.
25
- * Default value: `0`
26
- */
27
- startTime?: number;
28
- /**
29
- * The time that the rendering of this `vnode` was completed. Will only be
30
- * set when the devtools are attached.
31
- * Default value: `-1`
32
- */
33
- endTime?: number;
34
- }
35
-
36
- //
37
- // Preact Component interface
38
- // -----------------------------------
39
-
40
- type Key = string | number | any;
41
-
42
- type RefObject<T> = { current: T | null };
43
- type RefCallback<T> = (instance: T | null) => void;
44
- type Ref<T> = RefObject<T> | RefCallback<T>;
45
-
46
- type ComponentChild =
47
- | VNode<any>
48
- | object
49
- | string
50
- | number
51
- | bigint
52
- | boolean
53
- | null
54
- | undefined;
55
- type ComponentChildren = ComponentChild[] | ComponentChild;
56
-
57
- interface Attributes {
58
- key?: Key;
59
- jsx?: boolean;
60
- }
61
-
62
- interface ClassAttributes<T> extends Attributes {
63
- ref?: Ref<T>;
64
- }
65
-
66
- interface PreactDOMAttributes {
67
- children?: ComponentChildren;
68
- dangerouslySetInnerHTML?: {
69
- __html: string;
70
- };
71
- }
72
-
73
- type RenderableProps<P, RefType = any> = P &
74
- Readonly<Attributes & { children?: ComponentChildren; ref?: Ref<RefType> }>;
75
-
76
- type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
77
- type ComponentFactory<P = {}> = ComponentType<P>;
78
-
79
- type ComponentProps<
80
- C extends ComponentType<any> | keyof JSXInternal.IntrinsicElements
81
- > = C extends ComponentType<infer P>
82
- ? P
83
- : C extends keyof JSXInternal.IntrinsicElements
84
- ? JSXInternal.IntrinsicElements[C]
85
- : never;
86
-
87
- interface FunctionComponent<P = {}> {
88
- (props: RenderableProps<P>, context?: any): VNode<any> | null;
89
- displayName?: string;
90
- defaultProps?: Partial<P>;
91
- }
92
- interface FunctionalComponent<P = {}> extends FunctionComponent<P> {}
93
-
94
- interface ComponentClass<P = {}, S = {}> {
95
- new (props: P, context?: any): Component<P, S>;
96
- displayName?: string;
97
- defaultProps?: Partial<P>;
98
- contextType?: Context<any>;
99
- getDerivedStateFromProps?(
100
- props: Readonly<P>,
101
- state: Readonly<S>
102
- ): Partial<S> | null;
103
- getDerivedStateFromError?(error: any): Partial<S> | null;
104
- }
105
- interface ComponentConstructor<P = {}, S = {}> extends ComponentClass<P, S> {}
106
-
107
- // Type alias for a component instance considered generally, whether stateless or stateful.
108
- type AnyComponent<P = {}, S = {}> = FunctionComponent<P> | Component<P, S>;
109
-
110
- interface Component<P = {}, S = {}> {
111
- componentWillMount?(): void;
112
- componentDidMount?(): void;
113
- componentWillUnmount?(): void;
114
- getChildContext?(): object;
115
- componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
116
- shouldComponentUpdate?(
117
- nextProps: Readonly<P>,
118
- nextState: Readonly<S>,
119
- nextContext: any
120
- ): boolean;
121
- componentWillUpdate?(
122
- nextProps: Readonly<P>,
123
- nextState: Readonly<S>,
124
- nextContext: any
125
- ): void;
126
- getSnapshotBeforeUpdate?(oldProps: Readonly<P>, oldState: Readonly<S>): any;
127
- componentDidUpdate?(
128
- previousProps: Readonly<P>,
129
- previousState: Readonly<S>,
130
- snapshot: any
131
- ): void;
132
- componentDidCatch?(error: any, errorInfo: any): void;
133
- }
134
-
135
- abstract class Component<P, S> {
136
- constructor(props?: P, context?: any);
137
-
138
- static displayName?: string;
139
- static defaultProps?: any;
140
- static contextType?: Context<any>;
141
-
142
- // Static members cannot reference class type parameters. This is not
143
- // supported in TypeScript. Reusing the same type arguments from `Component`
144
- // will lead to an impossible state where one cannot satisfy the type
145
- // constraint under no circumstances, see #1356.In general type arguments
146
- // seem to be a bit buggy and not supported well at the time of this
147
- // writing with TS 3.3.3333.
148
- static getDerivedStateFromProps?(
149
- props: Readonly<object>,
150
- state: Readonly<object>
151
- ): object | null;
152
- static getDerivedStateFromError?(error: any): object | null;
153
-
154
- state: Readonly<S>;
155
- props: RenderableProps<P>;
156
- context: any;
157
- base?: Element | Text;
158
-
159
- // From https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e836acc75a78cf0655b5dfdbe81d69fdd4d8a252/types/react/index.d.ts#L402
160
- // // We MUST keep setState() as a unified signature because it allows proper checking of the method return type.
161
- // // See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
162
- setState<K extends keyof S>(
163
- state:
164
- | ((
165
- prevState: Readonly<S>,
166
- props: Readonly<P>
167
- ) => Pick<S, K> | Partial<S> | null)
168
- | (Pick<S, K> | Partial<S> | null),
169
- callback?: () => void
170
- ): void;
171
-
172
- forceUpdate(callback?: () => void): void;
173
-
174
- abstract render(
175
- props?: RenderableProps<P>,
176
- state?: Readonly<S>,
177
- context?: any
178
- ): ComponentChild;
179
- }
180
-
181
- //
182
- // Preact createElement
183
- // -----------------------------------
184
-
185
- function createElement(
186
- type: string,
187
- props:
188
- | (JSXInternal.HTMLAttributes &
189
- JSXInternal.SVGAttributes &
190
- Record<string, any>)
191
- | null,
192
- ...children: ComponentChildren[]
193
- ): VNode<any>;
194
- function createElement<P>(
195
- type: ComponentType<P>,
196
- props: (Attributes & P) | null,
197
- ...children: ComponentChildren[]
198
- ): VNode<any>;
199
- namespace createElement {
200
- export import JSX = JSXInternal;
201
- }
202
-
203
- function h(
204
- type: string,
205
- props:
206
- | (JSXInternal.HTMLAttributes &
207
- JSXInternal.SVGAttributes &
208
- Record<string, any>)
209
- | null,
210
- ...children: ComponentChildren[]
211
- ): VNode<any>;
212
- function h<P>(
213
- type: ComponentType<P>,
214
- props: (Attributes & P) | null,
215
- ...children: ComponentChildren[]
216
- ): VNode<any>;
217
- namespace h {
218
- export import JSX = JSXInternal;
219
- }
220
-
221
- //
222
- // Preact render
223
- // -----------------------------------
224
-
225
- function render(
226
- vnode: ComponentChild,
227
- parent: Element | Document | ShadowRoot | DocumentFragment,
228
- replaceNode?: Element | Text
229
- ): void;
230
- function hydrate(
231
- vnode: ComponentChild,
232
- parent: Element | Document | ShadowRoot | DocumentFragment
233
- ): void;
234
- function cloneElement(
235
- vnode: VNode<any>,
236
- props?: any,
237
- ...children: ComponentChildren[]
238
- ): VNode<any>;
239
- function cloneElement<P>(
240
- vnode: VNode<P>,
241
- props?: any,
242
- ...children: ComponentChildren[]
243
- ): VNode<P>;
244
-
245
- //
246
- // Preact Built-in Components
247
- // -----------------------------------
248
-
249
- // TODO: Revisit what the public type of this is...
250
- const Fragment: ComponentClass<{}, {}>;
251
-
252
- //
253
- // Preact options
254
- // -----------------------------------
7
+ //
8
+ // Preact Virtual DOM
9
+ // -----------------------------------
255
10
 
11
+ export interface VNode<P = {}> {
12
+ type: ComponentType<P> | string;
13
+ props: P & { children: ComponentChildren };
14
+ key: Key;
256
15
  /**
257
- * Global options for preact
16
+ * ref is not guaranteed by React.ReactElement, for compatibility reasons
17
+ * with popular react libs we define it as optional too
258
18
  */
259
- interface Options {
260
- /** Attach a hook that is invoked whenever a VNode is created. */
261
- vnode?(vnode: VNode): void;
262
- /** Attach a hook that is invoked immediately before a vnode is unmounted. */
263
- unmount?(vnode: VNode): void;
264
- /** Attach a hook that is invoked after a vnode has rendered. */
265
- diffed?(vnode: VNode): void;
266
- event?(e: Event): any;
267
- requestAnimationFrame?: typeof requestAnimationFrame;
268
- debounceRendering?(cb: () => void): void;
269
- useDebugValue?(value: string | number): void;
270
- _addHookName?(name: string | number): void;
271
- __suspenseDidResolve?(vnode: VNode, cb: () => void): void;
272
- // __canSuspenseResolve?(vnode: VNode, cb: () => void): void;
273
- }
274
-
275
- const options: Options;
276
-
277
- //
278
- // Preact helpers
279
- // -----------------------------------
280
- function createRef<T = any>(): RefObject<T>;
281
- function toChildArray(
282
- children: ComponentChildren
283
- ): Array<VNode | string | number>;
284
- function isValidElement(vnode: any): vnode is VNode;
285
-
286
- //
287
- // Context
288
- // -----------------------------------
289
- interface Consumer<T>
290
- extends FunctionComponent<{
291
- children: (value: T) => ComponentChildren;
292
- }> {}
293
- interface PreactConsumer<T> extends Consumer<T> {}
294
-
295
- interface Provider<T>
296
- extends FunctionComponent<{
297
- value: T;
298
- children: ComponentChildren;
299
- }> {}
300
- interface PreactProvider<T> extends Provider<T> {}
301
-
302
- interface Context<T> {
303
- Consumer: Consumer<T>;
304
- Provider: Provider<T>;
305
- displayName?: string;
306
- }
307
- interface PreactContext<T> extends Context<T> {}
308
-
309
- function createContext<T>(defaultValue: T): Context<T>;
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;
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
+ > = C extends ComponentType<infer P>
84
+ ? P
85
+ : C extends keyof JSXInternal.IntrinsicElements
86
+ ? JSXInternal.IntrinsicElements[C]
87
+ : never;
88
+
89
+ export interface FunctionComponent<P = {}> {
90
+ (props: RenderableProps<P>, context?: any): VNode<any> | null;
91
+ displayName?: string;
92
+ defaultProps?: Partial<P> | undefined;
93
+ }
94
+ export interface FunctionalComponent<P = {}> extends FunctionComponent<P> {}
95
+
96
+ export interface ComponentClass<P = {}, S = {}> {
97
+ new (props: P, context?: any): Component<P, S>;
98
+ displayName?: string;
99
+ defaultProps?: Partial<P>;
100
+ contextType?: Context<any>;
101
+ getDerivedStateFromProps?(
102
+ props: Readonly<P>,
103
+ state: Readonly<S>
104
+ ): Partial<S> | null;
105
+ getDerivedStateFromError?(error: any): Partial<S> | null;
310
106
  }
107
+ export interface ComponentConstructor<P = {}, S = {}>
108
+ extends ComponentClass<P, S> {}
109
+
110
+ // Type alias for a component instance considered generally, whether stateless or stateful.
111
+ export type AnyComponent<P = {}, S = {}> =
112
+ | FunctionComponent<P>
113
+ | Component<P, S>;
114
+
115
+ export interface Component<P = {}, S = {}> {
116
+ componentWillMount?(): void;
117
+ componentDidMount?(): void;
118
+ componentWillUnmount?(): void;
119
+ getChildContext?(): object;
120
+ componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
121
+ shouldComponentUpdate?(
122
+ nextProps: Readonly<P>,
123
+ nextState: Readonly<S>,
124
+ nextContext: any
125
+ ): boolean;
126
+ componentWillUpdate?(
127
+ nextProps: Readonly<P>,
128
+ nextState: Readonly<S>,
129
+ nextContext: any
130
+ ): void;
131
+ getSnapshotBeforeUpdate?(oldProps: Readonly<P>, oldState: Readonly<S>): any;
132
+ componentDidUpdate?(
133
+ previousProps: Readonly<P>,
134
+ previousState: Readonly<S>,
135
+ snapshot: any
136
+ ): void;
137
+ componentDidCatch?(error: any, errorInfo: ErrorInfo): void;
138
+ }
139
+
140
+ export abstract class Component<P, S> {
141
+ constructor(props?: P, context?: any);
142
+
143
+ static displayName?: string;
144
+ static defaultProps?: any;
145
+ static contextType?: Context<any>;
146
+
147
+ // Static members cannot reference class type parameters. This is not
148
+ // supported in TypeScript. Reusing the same type arguments from `Component`
149
+ // will lead to an impossible state where one cannot satisfy the type
150
+ // constraint under no circumstances, see #1356.In general type arguments
151
+ // seem to be a bit buggy and not supported well at the time of this
152
+ // writing with TS 3.3.3333.
153
+ static getDerivedStateFromProps?(
154
+ props: Readonly<object>,
155
+ state: Readonly<object>
156
+ ): object | null;
157
+ static getDerivedStateFromError?(error: any): object | null;
158
+
159
+ state: Readonly<S>;
160
+ props: RenderableProps<P>;
161
+ context: any;
162
+ base?: Element | Text;
163
+
164
+ // From https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e836acc75a78cf0655b5dfdbe81d69fdd4d8a252/types/react/index.d.ts#L402
165
+ // // We MUST keep setState() as a unified signature because it allows proper checking of the method return type.
166
+ // // See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
167
+ setState<K extends keyof S>(
168
+ state:
169
+ | ((
170
+ prevState: Readonly<S>,
171
+ props: Readonly<P>
172
+ ) => Pick<S, K> | Partial<S> | null)
173
+ | (Pick<S, K> | Partial<S> | null),
174
+ callback?: () => void
175
+ ): void;
176
+
177
+ forceUpdate(callback?: () => void): void;
178
+
179
+ abstract render(
180
+ props?: RenderableProps<P>,
181
+ state?: Readonly<S>,
182
+ context?: any
183
+ ): ComponentChild;
184
+ }
185
+
186
+ //
187
+ // Preact createElement
188
+ // -----------------------------------
189
+
190
+ export function createElement(
191
+ type: 'input',
192
+ props:
193
+ | (JSXInternal.DOMAttributes<HTMLInputElement> &
194
+ ClassAttributes<HTMLInputElement>)
195
+ | null,
196
+ ...children: ComponentChildren[]
197
+ ): VNode<any>;
198
+ export function createElement<
199
+ P extends JSXInternal.HTMLAttributes<T>,
200
+ T extends HTMLElement
201
+ >(
202
+ type: keyof JSXInternal.IntrinsicElements,
203
+ props: (ClassAttributes<T> & P) | null,
204
+ ...children: ComponentChildren[]
205
+ ): VNode<any>;
206
+ export function createElement<
207
+ P extends JSXInternal.SVGAttributes<T>,
208
+ T extends HTMLElement
209
+ >(
210
+ type: keyof JSXInternal.IntrinsicElements,
211
+ props: (ClassAttributes<T> & P) | null,
212
+ ...children: ComponentChildren[]
213
+ ): VNode<any>;
214
+ export function createElement<T extends HTMLElement>(
215
+ type: string,
216
+ props:
217
+ | (ClassAttributes<T> &
218
+ JSXInternal.HTMLAttributes &
219
+ JSXInternal.SVGAttributes)
220
+ | null,
221
+ ...children: ComponentChildren[]
222
+ ): VNode<any>;
223
+ export function createElement<P>(
224
+ type: ComponentType<P>,
225
+ props: (Attributes & P) | null,
226
+ ...children: ComponentChildren[]
227
+ ): VNode<any>;
228
+ export namespace createElement {
229
+ export import JSX = JSXInternal;
230
+ }
231
+
232
+ export function h(
233
+ type: 'input',
234
+ props:
235
+ | (JSXInternal.DOMAttributes<HTMLInputElement> &
236
+ ClassAttributes<HTMLInputElement>)
237
+ | null,
238
+ ...children: ComponentChildren[]
239
+ ): VNode<any>;
240
+ export function h<
241
+ P extends JSXInternal.HTMLAttributes<T>,
242
+ T extends HTMLElement
243
+ >(
244
+ type: keyof JSXInternal.IntrinsicElements,
245
+ props: (ClassAttributes<T> & P) | null,
246
+ ...children: ComponentChildren[]
247
+ ): VNode<any>;
248
+ export function h<
249
+ P extends JSXInternal.SVGAttributes<T>,
250
+ T extends HTMLElement
251
+ >(
252
+ type: keyof JSXInternal.IntrinsicElements,
253
+ props: (ClassAttributes<T> & P) | null,
254
+ ...children: ComponentChildren[]
255
+ ): VNode<any>;
256
+ export function h<T extends HTMLElement>(
257
+ type: string,
258
+ props:
259
+ | (ClassAttributes<T> &
260
+ JSXInternal.HTMLAttributes &
261
+ JSXInternal.SVGAttributes)
262
+ | null,
263
+ ...children: ComponentChildren[]
264
+ ): VNode<any>;
265
+ export function h<P>(
266
+ type: ComponentType<P>,
267
+ props: (Attributes & P) | null,
268
+ ...children: ComponentChildren[]
269
+ ): VNode<any>;
270
+ export namespace h {
271
+ export import JSX = JSXInternal;
272
+ }
273
+
274
+ //
275
+ // Preact render
276
+ // -----------------------------------
277
+
278
+ interface ContainerNode {
279
+ nodeType: Node['nodeType'];
280
+ parentNode: Node['parentNode'];
281
+ firstChild: Node['firstChild'];
282
+ insertBefore: Node['insertBefore'];
283
+ appendChild: Node['appendChild'];
284
+ removeChild: Node['removeChild'];
285
+ childNodes: ArrayLike<Node>;
286
+ }
287
+
288
+ export function render(vnode: ComponentChild, parent: ContainerNode): void;
289
+ /**
290
+ * @deprecated Will be removed in v11.
291
+ *
292
+ * Replacement Preact 10+ implementation can be found here: https://gist.github.com/developit/f4c67a2ede71dc2fab7f357f39cff28c
293
+ */
294
+ export function render(
295
+ vnode: ComponentChild,
296
+ parent: ContainerNode,
297
+ replaceNode?: Element | Text
298
+ ): void;
299
+ export function hydrate(vnode: ComponentChild, parent: ContainerNode): void;
300
+ export function cloneElement(
301
+ vnode: VNode<any>,
302
+ props?: any,
303
+ ...children: ComponentChildren[]
304
+ ): VNode<any>;
305
+ export function cloneElement<P>(
306
+ vnode: VNode<P>,
307
+ props?: any,
308
+ ...children: ComponentChildren[]
309
+ ): VNode<P>;
310
+
311
+ //
312
+ // Preact Built-in Components
313
+ // -----------------------------------
314
+
315
+ // TODO: Revisit what the public type of this is...
316
+ export const Fragment: FunctionComponent<{}>;
317
+
318
+ //
319
+ // Preact options
320
+ // -----------------------------------
321
+
322
+ /**
323
+ * Global options for preact
324
+ */
325
+ export interface Options {
326
+ /** Attach a hook that is invoked whenever a VNode is created. */
327
+ vnode?(vnode: VNode): void;
328
+ /** Attach a hook that is invoked immediately before a vnode is unmounted. */
329
+ unmount?(vnode: VNode): void;
330
+ /** Attach a hook that is invoked after a vnode has rendered. */
331
+ diffed?(vnode: VNode): void;
332
+ event?(e: Event): any;
333
+ requestAnimationFrame?(callback: () => void): void;
334
+ debounceRendering?(cb: () => void): void;
335
+ useDebugValue?(value: string | number): void;
336
+ _addHookName?(name: string | number): void;
337
+ __suspenseDidResolve?(vnode: VNode, cb: () => void): void;
338
+ // __canSuspenseResolve?(vnode: VNode, cb: () => void): void;
339
+ }
340
+
341
+ export const options: Options;
342
+
343
+ //
344
+ // Preact helpers
345
+ // -----------------------------------
346
+ export function createRef<T = any>(): RefObject<T>;
347
+ export function toChildArray(
348
+ children: ComponentChildren
349
+ ): Array<VNode | string | number>;
350
+ export function isValidElement(vnode: any): vnode is VNode;
351
+
352
+ //
353
+ // Context
354
+ // -----------------------------------
355
+ export interface Consumer<T>
356
+ extends FunctionComponent<{
357
+ children: (value: T) => ComponentChildren;
358
+ }> {}
359
+ export interface PreactConsumer<T> extends Consumer<T> {}
360
+
361
+ export interface Provider<T>
362
+ extends FunctionComponent<{
363
+ value: T;
364
+ children: ComponentChildren;
365
+ }> {}
366
+ export interface PreactProvider<T> extends Provider<T> {}
367
+ export type ContextType<C extends Context<any>> = C extends Context<infer T>
368
+ ? T
369
+ : never;
370
+
371
+ export interface Context<T> {
372
+ Consumer: Consumer<T>;
373
+ Provider: Provider<T>;
374
+ displayName?: string;
375
+ }
376
+ export interface PreactContext<T> extends Context<T> {}
377
+
378
+ export function createContext<T>(defaultValue: T): Context<T>;