@bpmn-io/properties-panel 0.9.0 → 0.10.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 (180) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/index.esm.js +1607 -0
  3. package/dist/index.esm.js.map +1 -0
  4. package/dist/index.js +1648 -0
  5. package/dist/index.js.map +1 -0
  6. package/package.json +16 -7
  7. package/preact/LICENSE +21 -0
  8. package/preact/README.md +185 -0
  9. package/preact/compat/dist/compat.js +2 -0
  10. package/preact/compat/dist/compat.js.map +1 -0
  11. package/preact/compat/dist/compat.mjs +2 -0
  12. package/preact/compat/dist/compat.module.js +2 -0
  13. package/preact/compat/dist/compat.module.js.map +1 -0
  14. package/preact/compat/dist/compat.umd.js +2 -0
  15. package/preact/compat/dist/compat.umd.js.map +1 -0
  16. package/preact/compat/jsx-dev-runtime.js +1 -0
  17. package/preact/compat/jsx-dev-runtime.mjs +1 -0
  18. package/preact/compat/jsx-runtime.js +1 -0
  19. package/preact/compat/jsx-runtime.mjs +1 -0
  20. package/preact/compat/package.json +19 -0
  21. package/preact/compat/server.js +15 -0
  22. package/preact/compat/server.mjs +4 -0
  23. package/preact/compat/src/Children.js +21 -0
  24. package/preact/compat/src/PureComponent.js +15 -0
  25. package/preact/compat/src/forwardRef.js +51 -0
  26. package/preact/compat/src/index.d.ts +140 -0
  27. package/preact/compat/src/index.js +175 -0
  28. package/preact/compat/src/internal.d.ts +47 -0
  29. package/preact/compat/src/memo.js +34 -0
  30. package/preact/compat/src/portals.js +80 -0
  31. package/preact/compat/src/render.js +219 -0
  32. package/preact/compat/src/scheduler.js +24 -0
  33. package/preact/compat/src/suspense-list.d.ts +14 -0
  34. package/preact/compat/src/suspense-list.js +126 -0
  35. package/preact/compat/src/suspense.d.ts +15 -0
  36. package/preact/compat/src/suspense.js +270 -0
  37. package/preact/compat/src/util.js +28 -0
  38. package/preact/compat/test-utils.js +1 -0
  39. package/preact/debug/dist/debug.js +2 -0
  40. package/preact/debug/dist/debug.js.map +1 -0
  41. package/preact/debug/dist/debug.mjs +2 -0
  42. package/preact/debug/dist/debug.module.js +2 -0
  43. package/preact/debug/dist/debug.module.js.map +1 -0
  44. package/preact/debug/dist/debug.umd.js +2 -0
  45. package/preact/debug/dist/debug.umd.js.map +1 -0
  46. package/preact/debug/package.json +18 -0
  47. package/preact/debug/src/check-props.js +54 -0
  48. package/preact/debug/src/component-stack.js +146 -0
  49. package/preact/debug/src/constants.js +3 -0
  50. package/preact/debug/src/debug.js +442 -0
  51. package/preact/debug/src/index.js +6 -0
  52. package/preact/debug/src/internal.d.ts +82 -0
  53. package/preact/debug/src/util.js +11 -0
  54. package/preact/devtools/dist/devtools.js +2 -0
  55. package/preact/devtools/dist/devtools.js.map +1 -0
  56. package/preact/devtools/dist/devtools.mjs +2 -0
  57. package/preact/devtools/dist/devtools.module.js +2 -0
  58. package/preact/devtools/dist/devtools.module.js.map +1 -0
  59. package/preact/devtools/dist/devtools.umd.js +2 -0
  60. package/preact/devtools/dist/devtools.umd.js.map +1 -0
  61. package/preact/devtools/package.json +16 -0
  62. package/preact/devtools/src/devtools.js +10 -0
  63. package/preact/devtools/src/index.d.ts +8 -0
  64. package/preact/devtools/src/index.js +15 -0
  65. package/preact/dist/preact.js +2 -0
  66. package/preact/dist/preact.js.map +1 -0
  67. package/preact/dist/preact.min.js +2 -0
  68. package/preact/dist/preact.min.js.map +1 -0
  69. package/preact/dist/preact.mjs +2 -0
  70. package/preact/dist/preact.module.js +2 -0
  71. package/preact/dist/preact.module.js.map +1 -0
  72. package/preact/dist/preact.umd.js +2 -0
  73. package/preact/dist/preact.umd.js.map +1 -0
  74. package/preact/hooks/dist/hooks.js +2 -0
  75. package/preact/hooks/dist/hooks.js.map +1 -0
  76. package/preact/hooks/dist/hooks.mjs +2 -0
  77. package/preact/hooks/dist/hooks.module.js +2 -0
  78. package/preact/hooks/dist/hooks.module.js.map +1 -0
  79. package/preact/hooks/dist/hooks.umd.js +2 -0
  80. package/preact/hooks/dist/hooks.umd.js.map +1 -0
  81. package/preact/hooks/package.json +26 -0
  82. package/preact/hooks/src/index.d.ts +130 -0
  83. package/preact/hooks/src/index.js +386 -0
  84. package/preact/hooks/src/internal.d.ts +75 -0
  85. package/preact/jsx-runtime/dist/jsxRuntime.js +2 -0
  86. package/preact/jsx-runtime/dist/jsxRuntime.js.map +1 -0
  87. package/preact/jsx-runtime/dist/jsxRuntime.mjs +2 -0
  88. package/preact/jsx-runtime/dist/jsxRuntime.module.js +2 -0
  89. package/preact/jsx-runtime/dist/jsxRuntime.module.js.map +1 -0
  90. package/preact/jsx-runtime/dist/jsxRuntime.umd.js +2 -0
  91. package/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -0
  92. package/preact/jsx-runtime/package.json +19 -0
  93. package/preact/jsx-runtime/src/index.d.ts +50 -0
  94. package/preact/jsx-runtime/src/index.js +72 -0
  95. package/preact/package.json +268 -0
  96. package/preact/src/cjs.js +3 -0
  97. package/preact/src/clone-element.js +39 -0
  98. package/preact/src/component.js +225 -0
  99. package/preact/src/constants.js +3 -0
  100. package/preact/src/create-context.js +68 -0
  101. package/preact/src/create-element.js +100 -0
  102. package/preact/src/diff/catch-error.js +38 -0
  103. package/preact/src/diff/children.js +347 -0
  104. package/preact/src/diff/index.js +516 -0
  105. package/preact/src/diff/props.js +158 -0
  106. package/preact/src/index.d.ts +310 -0
  107. package/preact/src/index.js +13 -0
  108. package/preact/src/internal.d.ts +147 -0
  109. package/preact/src/jsx.d.ts +955 -0
  110. package/preact/src/options.js +17 -0
  111. package/preact/src/render.js +74 -0
  112. package/preact/src/util.js +23 -0
  113. package/preact/test-utils/dist/testUtils.js +2 -0
  114. package/preact/test-utils/dist/testUtils.js.map +1 -0
  115. package/preact/test-utils/dist/testUtils.mjs +2 -0
  116. package/preact/test-utils/dist/testUtils.module.js +2 -0
  117. package/preact/test-utils/dist/testUtils.module.js.map +1 -0
  118. package/preact/test-utils/dist/testUtils.umd.js +2 -0
  119. package/preact/test-utils/dist/testUtils.umd.js.map +1 -0
  120. package/preact/test-utils/package.json +19 -0
  121. package/preact/test-utils/src/index.d.ts +3 -0
  122. package/preact/test-utils/src/index.js +117 -0
  123. package/lib/PropertiesPanel.js +0 -166
  124. package/lib/PropertiesPanel.js.map +0 -1
  125. package/lib/components/DropdownButton.js +0 -109
  126. package/lib/components/DropdownButton.js.map +0 -1
  127. package/lib/components/Group.js +0 -75
  128. package/lib/components/Group.js.map +0 -1
  129. package/lib/components/Header.js +0 -49
  130. package/lib/components/Header.js.map +0 -1
  131. package/lib/components/HeaderButton.js +0 -16
  132. package/lib/components/HeaderButton.js.map +0 -1
  133. package/lib/components/ListGroup.js +0 -167
  134. package/lib/components/ListGroup.js.map +0 -1
  135. package/lib/components/ListItem.js +0 -37
  136. package/lib/components/ListItem.js.map +0 -1
  137. package/lib/components/entries/Checkbox.js +0 -83
  138. package/lib/components/entries/Checkbox.js.map +0 -1
  139. package/lib/components/entries/Collapsible.js +0 -48
  140. package/lib/components/entries/Collapsible.js.map +0 -1
  141. package/lib/components/entries/Description.js +0 -26
  142. package/lib/components/entries/Description.js.map +0 -1
  143. package/lib/components/entries/List.js +0 -204
  144. package/lib/components/entries/List.js.map +0 -1
  145. package/lib/components/entries/NumberField.js +0 -110
  146. package/lib/components/entries/NumberField.js.map +0 -1
  147. package/lib/components/entries/Select.js +0 -110
  148. package/lib/components/entries/Select.js.map +0 -1
  149. package/lib/components/entries/Simple.js +0 -56
  150. package/lib/components/entries/Simple.js.map +0 -1
  151. package/lib/components/entries/TextArea.js +0 -98
  152. package/lib/components/entries/TextArea.js.map +0 -1
  153. package/lib/components/entries/TextField.js +0 -123
  154. package/lib/components/entries/TextField.js.map +0 -1
  155. package/lib/components/entries/ToggleSwitch.js +0 -91
  156. package/lib/components/entries/ToggleSwitch.js.map +0 -1
  157. package/lib/components/icons/index.js +0 -51
  158. package/lib/components/icons/index.js.map +0 -1
  159. package/lib/context/DescriptionContext.js +0 -7
  160. package/lib/context/DescriptionContext.js.map +0 -1
  161. package/lib/context/LayoutContext.js +0 -9
  162. package/lib/context/LayoutContext.js.map +0 -1
  163. package/lib/context/index.js +0 -3
  164. package/lib/context/index.js.map +0 -1
  165. package/lib/features/debounce-input/debounceInput.js +0 -14
  166. package/lib/features/debounce-input/debounceInput.js.map +0 -1
  167. package/lib/features/debounce-input/index.js +0 -5
  168. package/lib/features/debounce-input/index.js.map +0 -1
  169. package/lib/hooks/index.js +0 -5
  170. package/lib/hooks/index.js.map +0 -1
  171. package/lib/hooks/useDescriptionContext.js +0 -25
  172. package/lib/hooks/useDescriptionContext.js.map +0 -1
  173. package/lib/hooks/useKeyFactory.js +0 -39
  174. package/lib/hooks/useKeyFactory.js.map +0 -1
  175. package/lib/hooks/useLayoutState.js +0 -36
  176. package/lib/hooks/useLayoutState.js.map +0 -1
  177. package/lib/hooks/usePrevious.js +0 -16
  178. package/lib/hooks/usePrevious.js.map +0 -1
  179. package/lib/index.js +0 -2
  180. package/lib/index.js.map +0 -1
@@ -0,0 +1,310 @@
1
+ export = preact;
2
+ export as namespace preact;
3
+
4
+ import { JSXInternal } from './jsx';
5
+
6
+ declare namespace preact {
7
+ export import JSX = JSXInternal;
8
+
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
+ // -----------------------------------
255
+
256
+ /**
257
+ * Global options for preact
258
+ */
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>;
310
+ }
@@ -0,0 +1,13 @@
1
+ export { render, hydrate } from './render';
2
+ export {
3
+ createElement,
4
+ createElement as h,
5
+ Fragment,
6
+ createRef,
7
+ isValidElement
8
+ } from './create-element';
9
+ export { Component } from './component';
10
+ export { cloneElement } from './clone-element';
11
+ export { createContext } from './create-context';
12
+ export { toChildArray } from './diff/children';
13
+ export { default as options } from './options';
@@ -0,0 +1,147 @@
1
+ import * as preact from './index';
2
+
3
+ export enum HookType {
4
+ useState = 1,
5
+ useReducer = 2,
6
+ useEffect = 3,
7
+ useLayoutEffect = 4,
8
+ useRef = 5,
9
+ useImperativeHandle = 6,
10
+ useMemo = 7,
11
+ useCallback = 8,
12
+ useContext = 9,
13
+ useErrorBoundary = 10,
14
+ // Not a real hook, but the devtools treat is as such
15
+ useDebugvalue = 11
16
+ }
17
+
18
+ export interface DevSource {
19
+ fileName: string;
20
+ lineNumber: number;
21
+ }
22
+
23
+ export interface Options extends preact.Options {
24
+ _vnodeId: number;
25
+ /** Attach a hook that is invoked before render, mainly to check the arguments. */
26
+ _root?(
27
+ vnode: ComponentChild,
28
+ parent: Element | Document | ShadowRoot | DocumentFragment
29
+ ): void;
30
+ /** Attach a hook that is invoked before a vnode is diffed. */
31
+ _diff?(vnode: VNode): void;
32
+ /** Attach a hook that is invoked after a tree was mounted or was updated. */
33
+ _commit?(vnode: VNode, commitQueue: Component[]): void;
34
+ /** Attach a hook that is invoked before a vnode has rendered. */
35
+ _render?(vnode: VNode): void;
36
+ /** Attach a hook that is invoked before a hook's state is queried. */
37
+ _hook?(component: Component, index: number, type: HookType): void;
38
+ /** Bypass effect execution. Currenty only used in devtools for hooks inspection */
39
+ _skipEffects?: boolean;
40
+ /** Attach a hook that is invoked after an error is caught in a component but before calling lifecycle hooks */
41
+ _catchError(error: any, vnode: VNode, oldVNode?: VNode | undefined): void;
42
+ }
43
+
44
+ export type ComponentChild =
45
+ | VNode<any>
46
+ | string
47
+ | number
48
+ | boolean
49
+ | null
50
+ | undefined;
51
+ export type ComponentChildren = ComponentChild[] | ComponentChild;
52
+
53
+ export interface FunctionComponent<P = {}> extends preact.FunctionComponent<P> {
54
+ // Internally, createContext uses `contextType` on a Function component to
55
+ // implement the Consumer component
56
+ contextType?: PreactContext;
57
+
58
+ // Internally, createContext stores a ref to the context object on the Provider
59
+ // Function component to help devtools
60
+ _contextRef?: PreactContext;
61
+
62
+ // Define these properties as undefined on FunctionComponent to get rid of
63
+ // some errors in `diff()`
64
+ getDerivedStateFromProps?: undefined;
65
+ getDerivedStateFromError?: undefined;
66
+ }
67
+
68
+ export interface ComponentClass<P = {}> extends preact.ComponentClass<P> {
69
+ _contextRef?: any;
70
+
71
+ // Override public contextType with internal PreactContext type
72
+ contextType?: PreactContext;
73
+ }
74
+
75
+ // Redefine ComponentType using our new internal FunctionComponent interface above
76
+ export type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
77
+
78
+ export interface PreactElement extends HTMLElement {
79
+ _children?: VNode<any> | null;
80
+ /** Event listeners to support event delegation */
81
+ _listeners?: Record<string, (e: Event) => void>;
82
+
83
+ // Preact uses this attribute to detect SVG nodes
84
+ ownerSVGElement?: SVGElement | null;
85
+
86
+ // style: HTMLElement["style"]; // From HTMLElement
87
+
88
+ data?: string | number; // From Text node
89
+ }
90
+
91
+ // We use the `current` property to differentiate between the two kinds of Refs so
92
+ // internally we'll define `current` on both to make TypeScript happy
93
+ type RefObject<T> = { current: T | null };
94
+ type RefCallback<T> = { (instance: T | null): void; current: undefined };
95
+ type Ref<T> = RefObject<T> | RefCallback<T>;
96
+
97
+ export interface VNode<P = {}> extends preact.VNode<P> {
98
+ // Redefine type here using our internal ComponentType type
99
+ type: string | ComponentType<P>;
100
+ props: P & { children: ComponentChildren };
101
+ ref?: Ref<any> | null;
102
+ _children: Array<VNode<any>> | null;
103
+ _parent: VNode | null;
104
+ _depth: number | null;
105
+ /**
106
+ * The [first (for Fragments)] DOM child of a VNode
107
+ */
108
+ _dom: PreactElement | null;
109
+ /**
110
+ * The last dom child of a Fragment, or components that return a Fragment
111
+ */
112
+ _nextDom: PreactElement | null;
113
+ _component: Component | null;
114
+ _hydrating: boolean | null;
115
+ constructor: undefined;
116
+ _original: number;
117
+ }
118
+
119
+ export interface Component<P = {}, S = {}> extends preact.Component<P, S> {
120
+ // When component is functional component, this is reset to functional component
121
+ constructor: ComponentType<P>;
122
+ state: S; // Override Component["state"] to not be readonly for internal use, specifically Hooks
123
+ base?: PreactElement;
124
+
125
+ _dirty: boolean;
126
+ _force?: boolean;
127
+ _renderCallbacks: Array<() => void>; // Only class components
128
+ _globalContext?: any;
129
+ _vnode?: VNode<P> | null;
130
+ _nextState?: S | null; // Only class components
131
+ /** Only used in the devtools to later dirty check if state has changed */
132
+ _prevState?: S | null;
133
+ /**
134
+ * Pointer to the parent dom node. This is only needed for top-level Fragment
135
+ * components or array returns.
136
+ */
137
+ _parentDom?: PreactElement | null;
138
+ // Always read, set only when handling error
139
+ _processingException?: Component<any, any> | null;
140
+ // Always read, set only when handling error. This is used to indicate at diffTime to set _processingException
141
+ _pendingError?: Component<any, any> | null;
142
+ }
143
+
144
+ export interface PreactContext extends preact.Context<any> {
145
+ _id: string;
146
+ _defaultValue: any;
147
+ }