@three-flatland/devtools 0.1.0-alpha.3 → 1.0.0-alpha.6

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 (172) hide show
  1. package/README.md +1 -1
  2. package/dist/buffers-modal.d.ts +16 -52
  3. package/dist/buffers-modal.d.ts.map +1 -0
  4. package/dist/buffers-modal.js +459 -464
  5. package/dist/buffers-modal.js.map +1 -1
  6. package/dist/buffers-view.d.ts +22 -34
  7. package/dist/buffers-view.d.ts.map +1 -0
  8. package/dist/buffers-view.js +252 -240
  9. package/dist/buffers-view.js.map +1 -1
  10. package/dist/create-pane.d.ts +38 -37
  11. package/dist/create-pane.d.ts.map +1 -0
  12. package/dist/create-pane.js +197 -166
  13. package/dist/create-pane.js.map +1 -1
  14. package/dist/dashboard/app.tsx +2 -0
  15. package/dist/dashboard/export.ts +1 -3
  16. package/dist/dashboard/frame-cursor.ts +81 -0
  17. package/dist/dashboard/hooks.ts +10 -2
  18. package/dist/dashboard/index.html +61 -0
  19. package/dist/dashboard/panels/batches.tsx +5 -18
  20. package/dist/dashboard/panels/buffers.tsx +52 -26
  21. package/dist/dashboard/panels/env.tsx +5 -6
  22. package/dist/dashboard/panels/protocol-log.tsx +146 -58
  23. package/dist/dashboard/panels/registry.tsx +55 -69
  24. package/dist/dashboard/panels/scrubber.tsx +100 -0
  25. package/dist/dashboard/panels/stats.tsx +60 -32
  26. package/dist/dashboard/protocol-store.ts +25 -8
  27. package/dist/dashboard/vendor/hooks.module.d.ts +146 -0
  28. package/dist/dashboard/vendor/jsx-runtime.d.ts +55 -0
  29. package/dist/dashboard/vendor/jsx.d.ts +3123 -0
  30. package/dist/dashboard/vendor/preact.module.d.ts +397 -0
  31. package/dist/devtools-client.d.ts +312 -300
  32. package/dist/devtools-client.d.ts.map +1 -0
  33. package/dist/devtools-client.js +866 -838
  34. package/dist/devtools-client.js.map +1 -1
  35. package/dist/index.d.ts +6 -8
  36. package/dist/index.js +5 -12
  37. package/dist/perf-trace.d.ts +6 -4
  38. package/dist/perf-trace.d.ts.map +1 -0
  39. package/dist/perf-trace.js +80 -66
  40. package/dist/perf-trace.js.map +1 -1
  41. package/dist/plugins.d.ts +6 -6
  42. package/dist/plugins.d.ts.map +1 -0
  43. package/dist/plugins.js +5 -5
  44. package/dist/plugins.js.map +1 -1
  45. package/dist/provider-switcher.d.ts +8 -15
  46. package/dist/provider-switcher.d.ts.map +1 -0
  47. package/dist/provider-switcher.js +68 -68
  48. package/dist/provider-switcher.js.map +1 -1
  49. package/dist/react/devtools-provider.d.ts +11 -10
  50. package/dist/react/devtools-provider.d.ts.map +1 -0
  51. package/dist/react/devtools-provider.js +60 -32
  52. package/dist/react/devtools-provider.js.map +1 -1
  53. package/dist/react/use-fps-graph.d.ts +7 -7
  54. package/dist/react/use-fps-graph.d.ts.map +1 -0
  55. package/dist/react/use-fps-graph.js +27 -21
  56. package/dist/react/use-fps-graph.js.map +1 -1
  57. package/dist/react/use-pane-button.d.ts +4 -4
  58. package/dist/react/use-pane-button.d.ts.map +1 -0
  59. package/dist/react/use-pane-button.js +35 -30
  60. package/dist/react/use-pane-button.js.map +1 -1
  61. package/dist/react/use-pane-folder.d.ts +5 -4
  62. package/dist/react/use-pane-folder.d.ts.map +1 -0
  63. package/dist/react/use-pane-folder.js +33 -20
  64. package/dist/react/use-pane-folder.js.map +1 -1
  65. package/dist/react/use-pane-input.d.ts +31 -30
  66. package/dist/react/use-pane-input.d.ts.map +1 -0
  67. package/dist/react/use-pane-input.js +46 -42
  68. package/dist/react/use-pane-input.js.map +1 -1
  69. package/dist/react/use-pane-radio-grid.d.ts +20 -20
  70. package/dist/react/use-pane-radio-grid.d.ts.map +1 -0
  71. package/dist/react/use-pane-radio-grid.js +72 -50
  72. package/dist/react/use-pane-radio-grid.js.map +1 -1
  73. package/dist/react/use-pane.d.ts +4 -4
  74. package/dist/react/use-pane.d.ts.map +1 -0
  75. package/dist/react/use-pane.js +52 -17
  76. package/dist/react/use-pane.js.map +1 -1
  77. package/dist/react.d.ts +10 -12
  78. package/dist/react.js +2 -12
  79. package/dist/registry-view.d.ts +8 -21
  80. package/dist/registry-view.d.ts.map +1 -0
  81. package/dist/registry-view.js +357 -338
  82. package/dist/registry-view.js.map +1 -1
  83. package/dist/relay.d.ts +16 -0
  84. package/dist/relay.d.ts.map +1 -0
  85. package/dist/relay.js +189 -0
  86. package/dist/relay.js.map +1 -0
  87. package/dist/remote.d.ts +10 -0
  88. package/dist/remote.d.ts.map +1 -0
  89. package/dist/remote.js +28 -0
  90. package/dist/remote.js.map +1 -0
  91. package/dist/stats-graph.d.ts +23 -31
  92. package/dist/stats-graph.d.ts.map +1 -0
  93. package/dist/stats-graph.js +323 -264
  94. package/dist/stats-graph.js.map +1 -1
  95. package/dist/stats-row.d.ts +8 -21
  96. package/dist/stats-row.d.ts.map +1 -0
  97. package/dist/stats-row.js +99 -101
  98. package/dist/stats-row.js.map +1 -1
  99. package/dist/theme.d.ts +3 -1
  100. package/dist/theme.d.ts.map +1 -0
  101. package/dist/theme.js +43 -54
  102. package/dist/theme.js.map +1 -1
  103. package/dist/vite-plugin.d.ts +7 -6
  104. package/dist/vite-plugin.d.ts.map +1 -0
  105. package/dist/vite-plugin.js +87 -78
  106. package/dist/vite-plugin.js.map +1 -1
  107. package/package.json +33 -29
  108. package/dist/buffers-modal.cjs +0 -491
  109. package/dist/buffers-modal.cjs.map +0 -1
  110. package/dist/buffers-modal.d.cts +0 -62
  111. package/dist/buffers-view.cjs +0 -269
  112. package/dist/buffers-view.cjs.map +0 -1
  113. package/dist/buffers-view.d.cts +0 -39
  114. package/dist/create-pane.cjs +0 -203
  115. package/dist/create-pane.cjs.map +0 -1
  116. package/dist/create-pane.d.cts +0 -66
  117. package/dist/devtools-client.cjs +0 -870
  118. package/dist/devtools-client.cjs.map +0 -1
  119. package/dist/devtools-client.d.cts +0 -362
  120. package/dist/index.cjs +0 -42
  121. package/dist/index.cjs.map +0 -1
  122. package/dist/index.d.cts +0 -8
  123. package/dist/index.js.map +0 -1
  124. package/dist/perf-trace.cjs +0 -103
  125. package/dist/perf-trace.cjs.map +0 -1
  126. package/dist/perf-trace.d.cts +0 -27
  127. package/dist/plugins.cjs +0 -44
  128. package/dist/plugins.cjs.map +0 -1
  129. package/dist/plugins.d.cts +0 -7
  130. package/dist/provider-switcher.cjs +0 -95
  131. package/dist/provider-switcher.cjs.map +0 -1
  132. package/dist/provider-switcher.d.cts +0 -18
  133. package/dist/react/devtools-provider.cjs +0 -59
  134. package/dist/react/devtools-provider.cjs.map +0 -1
  135. package/dist/react/devtools-provider.d.cts +0 -39
  136. package/dist/react/use-fps-graph.cjs +0 -49
  137. package/dist/react/use-fps-graph.cjs.map +0 -1
  138. package/dist/react/use-fps-graph.d.cts +0 -15
  139. package/dist/react/use-pane-button.cjs +0 -58
  140. package/dist/react/use-pane-button.cjs.map +0 -1
  141. package/dist/react/use-pane-button.d.cts +0 -10
  142. package/dist/react/use-pane-folder.cjs +0 -48
  143. package/dist/react/use-pane-folder.cjs.map +0 -1
  144. package/dist/react/use-pane-folder.d.cts +0 -15
  145. package/dist/react/use-pane-input.cjs +0 -70
  146. package/dist/react/use-pane-input.cjs.map +0 -1
  147. package/dist/react/use-pane-input.d.cts +0 -44
  148. package/dist/react/use-pane-radio-grid.cjs +0 -78
  149. package/dist/react/use-pane-radio-grid.cjs.map +0 -1
  150. package/dist/react/use-pane-radio-grid.d.cts +0 -35
  151. package/dist/react/use-pane.cjs +0 -45
  152. package/dist/react/use-pane.cjs.map +0 -1
  153. package/dist/react/use-pane.d.cts +0 -40
  154. package/dist/react.cjs +0 -50
  155. package/dist/react.cjs.map +0 -1
  156. package/dist/react.d.cts +0 -12
  157. package/dist/react.js.map +0 -1
  158. package/dist/registry-view.cjs +0 -371
  159. package/dist/registry-view.cjs.map +0 -1
  160. package/dist/registry-view.d.cts +0 -24
  161. package/dist/stats-graph.cjs +0 -297
  162. package/dist/stats-graph.cjs.map +0 -1
  163. package/dist/stats-graph.d.cts +0 -40
  164. package/dist/stats-row.cjs +0 -153
  165. package/dist/stats-row.cjs.map +0 -1
  166. package/dist/stats-row.d.cts +0 -24
  167. package/dist/theme.cjs +0 -260
  168. package/dist/theme.cjs.map +0 -1
  169. package/dist/theme.d.cts +0 -10
  170. package/dist/vite-plugin.cjs +0 -113
  171. package/dist/vite-plugin.cjs.map +0 -1
  172. package/dist/vite-plugin.d.cts +0 -9
@@ -0,0 +1,397 @@
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;
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;
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<
198
+ | JSXInternal.DOMAttributes<HTMLInputElement> &
199
+ ClassAttributes<HTMLInputElement>
200
+ >;
201
+ export function createElement<
202
+ P extends JSXInternal.HTMLAttributes<T>,
203
+ T extends HTMLElement
204
+ >(
205
+ type: keyof JSXInternal.IntrinsicElements,
206
+ props: (ClassAttributes<T> & P) | null,
207
+ ...children: ComponentChildren[]
208
+ ): VNode<ClassAttributes<T> & P>;
209
+ export function createElement<
210
+ P extends JSXInternal.SVGAttributes<T>,
211
+ T extends HTMLElement
212
+ >(
213
+ type: keyof JSXInternal.IntrinsicElements,
214
+ props: (ClassAttributes<T> & P) | null,
215
+ ...children: ComponentChildren[]
216
+ ): VNode<ClassAttributes<T> & P>;
217
+ export function createElement<T extends HTMLElement>(
218
+ type: string,
219
+ props:
220
+ | (ClassAttributes<T> &
221
+ JSXInternal.HTMLAttributes &
222
+ JSXInternal.SVGAttributes)
223
+ | null,
224
+ ...children: ComponentChildren[]
225
+ ): VNode<
226
+ ClassAttributes<T> & JSXInternal.HTMLAttributes & JSXInternal.SVGAttributes
227
+ >;
228
+ export function createElement<P>(
229
+ type: ComponentType<P>,
230
+ props: (Attributes & P) | null,
231
+ ...children: ComponentChildren[]
232
+ ): VNode<P>;
233
+ export namespace createElement {
234
+ export import JSX = JSXInternal;
235
+ }
236
+
237
+ export function h(
238
+ type: 'input',
239
+ props:
240
+ | (JSXInternal.DOMAttributes<HTMLInputElement> &
241
+ ClassAttributes<HTMLInputElement>)
242
+ | null,
243
+ ...children: ComponentChildren[]
244
+ ): VNode<
245
+ | JSXInternal.DOMAttributes<HTMLInputElement> &
246
+ ClassAttributes<HTMLInputElement>
247
+ >;
248
+ export function h<
249
+ P extends JSXInternal.HTMLAttributes<T>,
250
+ T extends HTMLElement
251
+ >(
252
+ type: keyof JSXInternal.IntrinsicElements,
253
+ props: (ClassAttributes<T> & P) | null,
254
+ ...children: ComponentChildren[]
255
+ ): VNode<ClassAttributes<T> & P>;
256
+ export function h<
257
+ P extends JSXInternal.SVGAttributes<T>,
258
+ T extends HTMLElement
259
+ >(
260
+ type: keyof JSXInternal.IntrinsicElements,
261
+ props: (ClassAttributes<T> & P) | null,
262
+ ...children: ComponentChildren[]
263
+ ): VNode<ClassAttributes<T> & P>;
264
+ export function h<T extends HTMLElement>(
265
+ type: string,
266
+ props:
267
+ | (ClassAttributes<T> &
268
+ JSXInternal.HTMLAttributes &
269
+ JSXInternal.SVGAttributes)
270
+ | null,
271
+ ...children: ComponentChildren[]
272
+ ): VNode<
273
+ | (ClassAttributes<T> &
274
+ JSXInternal.HTMLAttributes &
275
+ JSXInternal.SVGAttributes)
276
+ | null
277
+ >;
278
+ export function h<P>(
279
+ type: ComponentType<P>,
280
+ props: (Attributes & P) | null,
281
+ ...children: ComponentChildren[]
282
+ ): VNode<Attributes & P>;
283
+ export namespace h {
284
+ export import JSX = JSXInternal;
285
+ }
286
+
287
+ //
288
+ // Preact render
289
+ // -----------------------------------
290
+ interface ContainerNode {
291
+ readonly nodeType: number;
292
+ readonly parentNode: ContainerNode | null;
293
+ readonly firstChild: ContainerNode | null;
294
+ readonly childNodes: ArrayLike<ContainerNode>;
295
+
296
+ insertBefore(node: ContainerNode, child: ContainerNode | null): ContainerNode;
297
+ appendChild(node: ContainerNode): ContainerNode;
298
+ removeChild(child: ContainerNode): ContainerNode;
299
+ }
300
+
301
+ export function render(vnode: ComponentChild, parent: ContainerNode): void;
302
+ /**
303
+ * @deprecated Will be removed in v11.
304
+ *
305
+ * Replacement Preact 10+ implementation can be found here: https://gist.github.com/developit/f4c67a2ede71dc2fab7f357f39cff28c
306
+ */
307
+ export function render(
308
+ vnode: ComponentChild,
309
+ parent: ContainerNode,
310
+ replaceNode?: Element | Text
311
+ ): void;
312
+ export function hydrate(vnode: ComponentChild, parent: ContainerNode): void;
313
+ export function cloneElement(
314
+ vnode: VNode<any>,
315
+ props?: any,
316
+ ...children: ComponentChildren[]
317
+ ): VNode<any>;
318
+ export function cloneElement<P>(
319
+ vnode: VNode<P>,
320
+ props?: any,
321
+ ...children: ComponentChildren[]
322
+ ): VNode<P>;
323
+
324
+ //
325
+ // Preact Built-in Components
326
+ // -----------------------------------
327
+
328
+ // TODO: Revisit what the public type of this is...
329
+ export const Fragment: FunctionComponent<{}>;
330
+
331
+ //
332
+ // Preact options
333
+ // -----------------------------------
334
+
335
+ /**
336
+ * Global options for preact
337
+ */
338
+ export interface Options {
339
+ /** Attach a hook that is invoked whenever a VNode is created. */
340
+ vnode?(vnode: VNode): void;
341
+ /** Attach a hook that is invoked immediately before a vnode is unmounted. */
342
+ unmount?(vnode: VNode): void;
343
+ /** Attach a hook that is invoked after a vnode has rendered. */
344
+ diffed?(vnode: VNode): void;
345
+ event?(e: Event): any;
346
+ requestAnimationFrame?(callback: () => void): void;
347
+ debounceRendering?(cb: () => void): void;
348
+ useDebugValue?(value: string | number): void;
349
+ _addHookName?(name: string | number): void;
350
+ __suspenseDidResolve?(vnode: VNode, cb: () => void): void;
351
+ // __canSuspenseResolve?(vnode: VNode, cb: () => void): void;
352
+
353
+ /**
354
+ * Customize attribute serialization when a precompiled JSX transform
355
+ * is used.
356
+ */
357
+ attr?(name: string, value: any): string | void;
358
+ }
359
+
360
+ export const options: Options;
361
+
362
+ //
363
+ // Preact helpers
364
+ // -----------------------------------
365
+ export function createRef<T = any>(): RefObject<T>;
366
+ export function toChildArray(
367
+ children: ComponentChildren
368
+ ): Array<VNode | string | number>;
369
+ export function isValidElement(vnode: any): vnode is VNode;
370
+
371
+ //
372
+ // Context
373
+ // -----------------------------------
374
+ export interface Consumer<T>
375
+ extends FunctionComponent<{
376
+ children: (value: T) => ComponentChildren;
377
+ }> {}
378
+ export interface PreactConsumer<T> extends Consumer<T> {}
379
+
380
+ export interface Provider<T>
381
+ extends FunctionComponent<{
382
+ value: T;
383
+ children?: ComponentChildren;
384
+ }> {}
385
+ export interface PreactProvider<T> extends Provider<T> {}
386
+ export type ContextType<C extends Context<any>> = C extends Context<infer T>
387
+ ? T
388
+ : never;
389
+
390
+ export interface Context<T> {
391
+ Consumer: Consumer<T>;
392
+ Provider: Provider<T>;
393
+ displayName?: string;
394
+ }
395
+ export interface PreactContext<T> extends Context<T> {}
396
+
397
+ export function createContext<T>(defaultValue: T): Context<T>;