@bpmn-io/properties-panel 3.42.0 → 3.43.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.
@@ -0,0 +1,399 @@
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>;