@qwik.dev/core 2.0.0-beta.1 → 2.0.0-beta.11

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 (100) hide show
  1. package/bindings/qwik.darwin-arm64.node +0 -0
  2. package/bindings/qwik.darwin-x64.node +0 -0
  3. package/bindings/qwik.linux-x64-gnu.node +0 -0
  4. package/bindings/qwik.win32-x64-msvc.node +0 -0
  5. package/bindings/qwik_wasm_bg.wasm +0 -0
  6. package/dist/backpatch/index.cjs +6 -0
  7. package/dist/backpatch/index.d.ts +2 -0
  8. package/dist/backpatch/index.mjs +5 -0
  9. package/dist/backpatch/package.json +8 -0
  10. package/dist/backpatch-executor.debug.js +34 -0
  11. package/dist/backpatch-executor.js +1 -0
  12. package/dist/build/package.json +1 -1
  13. package/dist/cli.cjs +3031 -763
  14. package/dist/core-internal.d.ts +285 -156
  15. package/dist/core.cjs +7546 -6628
  16. package/dist/core.cjs.map +1 -1
  17. package/dist/core.min.mjs +1 -1
  18. package/dist/core.mjs +7524 -6625
  19. package/dist/core.mjs.map +1 -1
  20. package/dist/core.prod.cjs +3088 -2624
  21. package/dist/core.prod.mjs +4453 -3916
  22. package/dist/insights/vite/index.cjs +1 -1
  23. package/dist/insights/vite/index.mjs +10 -10
  24. package/dist/loader/index.cjs +2 -2
  25. package/dist/loader/index.mjs +2 -2
  26. package/dist/loader/package.json +1 -1
  27. package/dist/optimizer.cjs +208 -4016
  28. package/dist/optimizer.d.ts +13 -38
  29. package/dist/optimizer.mjs +2592 -3715
  30. package/dist/preloader.cjs +8 -11
  31. package/dist/preloader.mjs +8 -11
  32. package/dist/qwikloader.debug.js +1 -15
  33. package/dist/qwikloader.js +1 -1
  34. package/dist/server.cjs +315 -122
  35. package/dist/server.d.ts +18 -3
  36. package/dist/server.mjs +294 -110
  37. package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/vite.config.mts +1 -1
  38. package/dist/starters/adapters/aws-lambda/package.json +1 -1
  39. package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +2 -6
  40. package/dist/starters/adapters/azure-swa/adapters/azure-swa/vite.config.mts +1 -1
  41. package/dist/starters/adapters/azure-swa/package.json +1 -1
  42. package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +2 -3
  43. package/dist/starters/adapters/bun/adapters/bun/vite.config.mts +2 -2
  44. package/dist/starters/adapters/bun/package.json +1 -1
  45. package/dist/starters/adapters/bun/src/entry.bun.ts +0 -2
  46. package/dist/starters/adapters/cloud-run/adapters/cloud-run/vite.config.mts +1 -1
  47. package/dist/starters/adapters/cloud-run/package.json +1 -1
  48. package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +1 -3
  49. package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/vite.config.mts +1 -1
  50. package/dist/starters/adapters/cloudflare-pages/package.json +1 -1
  51. package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +2 -3
  52. package/dist/starters/adapters/deno/adapters/deno/vite.config.mts +1 -1
  53. package/dist/starters/adapters/deno/package.json +1 -1
  54. package/dist/starters/adapters/deno/src/entry.deno.ts +0 -2
  55. package/dist/starters/adapters/express/adapters/express/vite.config.mts +1 -1
  56. package/dist/starters/adapters/express/package.json +1 -1
  57. package/dist/starters/adapters/express/src/entry.express.tsx +1 -3
  58. package/dist/starters/adapters/fastify/adapters/fastify/vite.config.mts +1 -1
  59. package/dist/starters/adapters/fastify/package.json +1 -1
  60. package/dist/starters/adapters/fastify/src/entry.fastify.tsx +1 -1
  61. package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +1 -2
  62. package/dist/starters/adapters/firebase/adapters/firebase/vite.config.mts +1 -1
  63. package/dist/starters/adapters/firebase/package.json +1 -1
  64. package/dist/starters/adapters/firebase/src/entry-firebase.tsx +2 -3
  65. package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/vite.config.mts +1 -1
  66. package/dist/starters/adapters/netlify-edge/package.json +1 -1
  67. package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +2 -3
  68. package/dist/starters/adapters/node-server/adapters/node-server/vite.config.mts +1 -1
  69. package/dist/starters/adapters/node-server/package.json +1 -1
  70. package/dist/starters/adapters/node-server/src/entry.node-server.tsx +0 -2
  71. package/dist/starters/adapters/{static/adapters/static → ssg/adapters/ssg}/vite.config.mts +2 -2
  72. package/dist/starters/adapters/ssg/package.json +19 -0
  73. package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/vite.config.mts +1 -1
  74. package/dist/starters/adapters/vercel-edge/package.json +1 -1
  75. package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +2 -3
  76. package/dist/starters/adapters/vercel-edge/vercel.json +1 -1
  77. package/dist/starters/features/auth/package.json +1 -1
  78. package/dist/starters/features/csr/index.html +23 -0
  79. package/dist/starters/features/csr/package.json +29 -0
  80. package/dist/starters/features/csr/src/root.tsx +15 -0
  81. package/dist/starters/features/csr/vite.config.mts +13 -0
  82. package/dist/starters/features/localize/package.json +3 -3
  83. package/dist/starters/features/localize/src/entry.ssr.tsx +17 -21
  84. package/dist/starters/features/pandacss/package.json +1 -1
  85. package/dist/starters/features/playwright/playwright-report/index.html +953 -911
  86. package/dist/starters/features/postcss/postcss.config.js +1 -1
  87. package/dist/starters/features/tailwind/package.json +2 -2
  88. package/dist/starters/features/tailwind/prettier.config.js +10 -0
  89. package/dist/starters/features/tailwind-v3/package.json +1 -1
  90. package/dist/starters/features/tailwind-v3/prettier.config.js +10 -0
  91. package/dist/testing/index.cjs +9898 -7478
  92. package/dist/testing/index.d.ts +953 -5
  93. package/dist/testing/index.mjs +10085 -7683
  94. package/dist/testing/package.json +1 -1
  95. package/package.json +16 -10
  96. package/public.d.ts +1 -0
  97. package/server.d.ts +2 -0
  98. package/dist/starters/adapters/static/package.json +0 -19
  99. package/dist/starters/features/tailwind/.prettierrc.js +0 -3
  100. /package/dist/starters/adapters/{static → ssg}/README.md +0 -0
@@ -1,4 +1,5 @@
1
- import { ClientContainer } from '../internal';
1
+ import { ClientContainer } from '..';
2
+ import type { ClientContainer as ClientContainer_2 } from '../internal';
2
3
  import type { CorePlatform } from '..';
3
4
  import type { _DomContainer } from '../internal';
4
5
  import type { _ElementVNode } from '../internal';
@@ -10,6 +11,186 @@ import type { _Stringifiable } from '../internal';
10
11
  import type { _VirtualVNode } from '../internal';
11
12
  import type { _VNode } from '../internal';
12
13
 
14
+ declare type AsyncComputedCtx = {
15
+ track: Tracker;
16
+ cleanup: (callback: () => void) => void;
17
+ };
18
+
19
+ /** @public */
20
+ declare type AsyncComputedFn<T> = (ctx: AsyncComputedCtx) => Promise<T>;
21
+
22
+ declare type AsyncComputeQRL<T> = QRLInternal<AsyncComputedFn<T>>;
23
+
24
+ /** Class for back reference to the EffectSubscription */
25
+ declare abstract class BackRef {
26
+ [_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | null;
27
+ }
28
+
29
+ declare type BivariantQrlFn<ARGS extends any[], RETURN> = {
30
+ /**
31
+ * Resolve the QRL of closure and invoke it.
32
+ *
33
+ * @param args - Closure arguments.
34
+ * @returns A promise of the return value of the closure.
35
+ */
36
+ bivarianceHack(...args: ARGS): Promise<RETURN>;
37
+ }['bivarianceHack'];
38
+
39
+ declare interface Chore<T extends ChoreType = ChoreType> {
40
+ $type$: T;
41
+ $idx$: number | string;
42
+ $host$: HostElement;
43
+ $target$: ChoreTarget | null;
44
+ $payload$: unknown;
45
+ $state$: ChoreState;
46
+ $blockedChores$: Chore[] | null;
47
+ $startTime$: number | undefined;
48
+ $endTime$: number | undefined;
49
+ $resolve$: ((value: any) => void) | undefined;
50
+ $reject$: ((reason?: any) => void) | undefined;
51
+ $returnValue$: ValueOrPromise<ChoreReturnValue<T>>;
52
+ }
53
+
54
+ declare class ChoreArray extends Array<Chore> {
55
+ add(value: Chore): number;
56
+ delete(value: Chore): number;
57
+ }
58
+
59
+ declare type ChoreReturnValue<T extends ChoreType = ChoreType> = T extends ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS | ChoreType.WAIT_FOR_QUEUE | ChoreType.NODE_PROP ? void : T extends ChoreType.NODE_DIFF | ChoreType.COMPONENT ? JSXOutput_2 : unknown;
60
+
61
+ declare enum ChoreState {
62
+ NONE = 0,
63
+ RUNNING = 1,
64
+ FAILED = 2,
65
+ DONE = 3
66
+ }
67
+
68
+ declare type ChoreTarget = HostElement | QRLInternal<(...args: unknown[]) => unknown> | Signal | StoreTarget;
69
+
70
+ declare const enum ChoreType {
71
+ MACRO = 240,
72
+ MICRO = 15,
73
+ /** Ensure that the QRL promise is resolved before processing next chores in the queue */
74
+ QRL_RESOLVE = 1,
75
+ RUN_QRL = 2,
76
+ TASK = 3,
77
+ NODE_DIFF = 4,
78
+ NODE_PROP = 5,
79
+ COMPONENT = 6,
80
+ RECOMPUTE_AND_SCHEDULE_EFFECTS = 7,
81
+ VISIBLE = 16,
82
+ CLEANUP_VISIBLE = 32,
83
+ WAIT_FOR_QUEUE = 255
84
+ }
85
+
86
+ /** @public */
87
+ declare type ComputedFn<T> = () => T;
88
+
89
+ declare type ComputeQRL<T> = QRLInternal<ComputedFn<T>>;
90
+
91
+ /**
92
+ * Effect is something which needs to happen (side-effect) due to signal value change.
93
+ *
94
+ * There are three types of effects:
95
+ *
96
+ * - `Task`: `useTask`, `useVisibleTask`, `useResource`
97
+ * - `VNode` and `ISsrNode`: Either a component or `<Signal>`
98
+ * - `Signal2`: A derived signal which contains a computation function.
99
+ */
100
+ declare type Consumer = Task | VNode | ISsrNode | SignalImpl;
101
+
102
+ declare interface Container {
103
+ readonly $version$: string;
104
+ readonly $scheduler$: Scheduler;
105
+ readonly $storeProxyMap$: ObjToProxyMap;
106
+ readonly $locale$: string;
107
+ readonly $getObjectById$: (id: number | string) => any;
108
+ readonly $serverData$: Record<string, any>;
109
+ $currentUniqueId$: number;
110
+ $buildBase$: string | null;
111
+ handleError(err: any, $host$: HostElement | null): void;
112
+ getParentHost(host: HostElement): HostElement | null;
113
+ setContext<T>(host: HostElement, context: ContextId<T>, value: T): void;
114
+ resolveContext<T>(host: HostElement, contextId: ContextId<T>): T | undefined;
115
+ setHostProp<T>(host: HostElement, name: string, value: T): void;
116
+ getHostProp<T>(host: HostElement, name: string): T | null;
117
+ $appendStyle$(content: string, styleId: string, host: HostElement, scoped: boolean): void;
118
+ /**
119
+ * When component is about to be executed, it may add/remove children. This can cause problems
120
+ * with the projection because deleting content will prevent the projection references from
121
+ * looking up vnodes. Therefore before we execute the component we need to ensure that all of its
122
+ * references to vnode are resolved.
123
+ *
124
+ * @param renderHost - Host element to ensure projection is resolved.
125
+ */
126
+ ensureProjectionResolved(host: HostElement): void;
127
+ serializationCtxFactory(NodeConstructor: {
128
+ new (...rest: any[]): {
129
+ __brand__: 'SsrNode';
130
+ };
131
+ } | null, DomRefConstructor: {
132
+ new (...rest: any[]): {
133
+ __brand__: 'DomRef';
134
+ };
135
+ } | null, symbolToChunkResolver: SymbolToChunkResolver, writer?: StreamWriter): SerializationContext;
136
+ }
137
+
138
+ /**
139
+ * ContextId is a typesafe ID for your context.
140
+ *
141
+ * Context is a way to pass stores to the child components without prop-drilling.
142
+ *
143
+ * Use `createContextId()` to create a `ContextId`. A `ContextId` is just a serializable identifier
144
+ * for the context. It is not the context value itself. See `useContextProvider()` and
145
+ * `useContext()` for the values. Qwik needs a serializable ID for the context so that the it can
146
+ * track context providers and consumers in a way that survives resumability.
147
+ *
148
+ * ### Example
149
+ *
150
+ * ```tsx
151
+ * // Declare the Context type.
152
+ * interface TodosStore {
153
+ * items: string[];
154
+ * }
155
+ * // Create a Context ID (no data is saved here.)
156
+ * // You will use this ID to both create and retrieve the Context.
157
+ * export const TodosContext = createContextId<TodosStore>('Todos');
158
+ *
159
+ * // Example of providing context to child components.
160
+ * export const App = component$(() => {
161
+ * useContextProvider(
162
+ * TodosContext,
163
+ * useStore<TodosStore>({
164
+ * items: ['Learn Qwik', 'Build Qwik app', 'Profit'],
165
+ * })
166
+ * );
167
+ *
168
+ * return <Items />;
169
+ * });
170
+ *
171
+ * // Example of retrieving the context provided by a parent component.
172
+ * export const Items = component$(() => {
173
+ * const todos = useContext(TodosContext);
174
+ * return (
175
+ * <ul>
176
+ * {todos.items.map((item) => (
177
+ * <li>{item}</li>
178
+ * ))}
179
+ * </ul>
180
+ * );
181
+ * });
182
+ *
183
+ * ```
184
+ *
185
+ * @public
186
+ */
187
+ declare interface ContextId<STATE> {
188
+ /** Design-time property to store type information for the context. */
189
+ readonly __brand_context_type__: STATE;
190
+ /** A unique ID for the context. */
191
+ readonly id: string;
192
+ }
193
+
13
194
  /**
14
195
  * Create emulated `Document` for server environment. Does not implement the full browser `document`
15
196
  * and `window` API. This api may be removed in the future.
@@ -31,6 +212,40 @@ export declare const createDOM: ({ html }?: {
31
212
  userEvent: (queryOrElement: string | Element | keyof HTMLElementTagNameMap | null, eventNameCamel: string | keyof WindowEventMap, eventPayload?: any) => Promise<void>;
32
213
  }>;
33
214
 
215
+ declare const createScheduler: (container: Container, journalFlush: () => void, choreQueue: ChoreArray, blockedChores: Set<Chore>, runningChores: Set<Chore>) => {
216
+ (type: ChoreType.QRL_RESOLVE, ignore: null, target: ComputeQRL<any> | AsyncComputeQRL<any>): Chore<ChoreType.QRL_RESOLVE>;
217
+ (type: ChoreType.WAIT_FOR_QUEUE): Chore<ChoreType.WAIT_FOR_QUEUE>;
218
+ (type: ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, host: HostElement | null, target: Signal<unknown> | StoreTarget, effects: Set<EffectSubscription> | null): Chore<ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS>;
219
+ (type: ChoreType.TASK | ChoreType.VISIBLE, task: Task): Chore<ChoreType.TASK | ChoreType.VISIBLE>;
220
+ (type: ChoreType.RUN_QRL, host: HostElement, target: QRLInternal<(...args: unknown[]) => unknown>, args: unknown[]): Chore<ChoreType.RUN_QRL>;
221
+ (type: ChoreType.COMPONENT, host: HostElement, qrl: QRLInternal<OnRenderFn<unknown>>, props: Props | null): Chore<ChoreType.COMPONENT>;
222
+ (type: ChoreType.NODE_DIFF, host: HostElement, target: HostElement, value: JSXOutput_2 | Signal): Chore<ChoreType.NODE_DIFF>;
223
+ (type: ChoreType.NODE_PROP, host: HostElement, prop: string, value: any): Chore<ChoreType.NODE_PROP>;
224
+ (type: ChoreType.CLEANUP_VISIBLE, task: Task): Chore<ChoreType.CLEANUP_VISIBLE>;
225
+ };
226
+
227
+ /** @public */
228
+ declare interface DescriptorBase<T = unknown, B = unknown> extends BackRef {
229
+ $flags$: number;
230
+ $index$: number;
231
+ $el$: HostElement;
232
+ $qrl$: QRLInternal<T>;
233
+ $state$: B | undefined;
234
+ $destroy$: NoSerialize<() => void> | null;
235
+ }
236
+
237
+ /** @public */
238
+ declare interface DevJSX {
239
+ fileName: string;
240
+ lineNumber: number;
241
+ columnNumber: number;
242
+ stack?: string;
243
+ }
244
+
245
+ declare type DomRef = {
246
+ $ssrNode$: SsrNode;
247
+ };
248
+
34
249
  /** @public */
35
250
  export declare function domRender(jsx: JSXOutput, opts?: {
36
251
  debug?: boolean;
@@ -41,6 +256,60 @@ export declare function domRender(jsx: JSXOutput, opts?: {
41
256
  getStyles: () => Record<string, string | string[]>;
42
257
  }>;
43
258
 
259
+ /** @internal */
260
+ declare const _EFFECT_BACK_REF: unique symbol;
261
+
262
+ declare const enum EffectProperty {
263
+ COMPONENT = ":",
264
+ VNODE = "."
265
+ }
266
+
267
+ /**
268
+ * An effect consumer plus type of effect, back references to producers and additional data
269
+ *
270
+ * An effect can be trigger by one or more of signal inputs. The first step of re-running an effect
271
+ * is to clear its subscriptions so that the effect can re add new set of subscriptions. In order to
272
+ * clear the subscriptions we need to store them here.
273
+ *
274
+ * Imagine you have effect such as:
275
+ *
276
+ * ```
277
+ * function effect1() {
278
+ * console.log(signalA.value ? signalB.value : 'default');
279
+ * }
280
+ * ```
281
+ *
282
+ * In the above case the `signalB` needs to be unsubscribed when `signalA` is falsy. We do this by
283
+ * always clearing all of the subscriptions
284
+ *
285
+ * The `EffectSubscription` stores
286
+ *
287
+ * ```
288
+ * subscription1 = [effectConsumer1, EffectProperty.COMPONENT, Set[(signalA, signalB)]];
289
+ * ```
290
+ *
291
+ * The `signal1` and `signal2` back references are needed to "clear" existing subscriptions.
292
+ *
293
+ * Both `signalA` as well as `signalB` will have a reference to `subscription` to the so that the
294
+ * effect can be scheduled if either `signalA` or `signalB` triggers. The `subscription1` is shared
295
+ * between the signals.
296
+ *
297
+ * The second position `EffectProperty|string` store the property name of the effect.
298
+ *
299
+ * - Property name of the VNode
300
+ * - `EffectProperty.COMPONENT` if component
301
+ * - `EffectProperty.VNODE` if VNode
302
+ */
303
+ declare type EffectSubscription = [
304
+ Consumer,
305
+ // EffectSubscriptionProp.CONSUMER
306
+ EffectProperty | string,
307
+ // EffectSubscriptionProp.PROPERTY or string for attributes
308
+ Set<SignalImpl | StoreTarget> | null,
309
+ // EffectSubscriptionProp.BACK_REF
310
+ SubscriptionData | null
311
+ ];
312
+
44
313
  /**
45
314
  * Creates a simple DOM structure for testing components.
46
315
  *
@@ -70,15 +339,93 @@ declare interface ElementFixtureOptions {
70
339
  html?: string;
71
340
  }
72
341
 
342
+ /** @internal */
343
+ declare class ElementVNode extends VNode {
344
+ firstChild: VNode | null | undefined;
345
+ lastChild: VNode | null | undefined;
346
+ element: Element;
347
+ elementName: string | undefined;
348
+ constructor(flags: VNodeFlags, parent: ElementVNode | VirtualVNode | null, previousSibling: VNode | null | undefined, nextSibling: VNode | null | undefined, firstChild: VNode | null | undefined, lastChild: VNode | null | undefined, element: Element, elementName: string | undefined);
349
+ }
350
+
73
351
  /** @public */
74
352
  export declare function emulateExecutionOfQwikFuncs(document: Document): void;
75
353
 
76
354
  /** @public */
77
355
  export declare function expectDOM(actual: Element, expected: string): Promise<void>;
78
356
 
357
+ /**
358
+ * Any function taking a props object that returns JSXOutput.
359
+ *
360
+ * The `key`, `flags` and `dev` parameters are for internal use.
361
+ *
362
+ * @public
363
+ */
364
+ declare type FunctionComponent<P = unknown> = {
365
+ renderFn(props: P, key: string | null, flags: number, dev?: DevJSX): JSXOutput_2;
366
+ }['renderFn'];
367
+
79
368
  /** @public */
80
369
  export declare function getTestPlatform(): TestPlatform;
81
370
 
371
+ declare type HostElement = VNode | ISsrNode;
372
+
373
+ /** The shared state during an invoke() call */
374
+ declare interface InvokeContext {
375
+ $url$: URL | undefined;
376
+ /** The next available index for the sequentialScope array */
377
+ $i$: number;
378
+ /** The Virtual parent component for the current component code */
379
+ $hostElement$: HostElement | undefined;
380
+ /** The current DOM element */
381
+ $element$: Element | undefined;
382
+ /** The event we're currently handling */
383
+ $event$: PossibleEvents | undefined;
384
+ /** The QRL function we're currently executing */
385
+ $qrl$: QRL | undefined;
386
+ $effectSubscriber$: EffectSubscription | undefined;
387
+ $locale$: string | undefined;
388
+ $container$: Container | undefined;
389
+ }
390
+
391
+ declare type InvokeTuple = [Element, Event, URL?];
392
+
393
+ declare interface ISsrNode {
394
+ id: string;
395
+ flags: SsrNodeFlags;
396
+ parentComponent: ISsrNode | null;
397
+ vnodeData: VNodeData;
398
+ currentFile: string | null;
399
+ setProp(name: string, value: any): void;
400
+ getProp(name: string): any;
401
+ removeProp(name: string): void;
402
+ addChild(child: ISsrNode): void;
403
+ setTreeNonUpdatable(): void;
404
+ }
405
+
406
+ /** @public */
407
+ declare type JSXChildren = string | number | boolean | null | undefined | Function | RegExp | JSXChildren[] | Promise<JSXChildren> | Signal<JSXChildren> | JSXNode;
408
+
409
+ /**
410
+ * A JSX Node, an internal structure. You probably want to use `JSXOutput` instead.
411
+ *
412
+ * @public
413
+ */
414
+ declare interface JSXNode<T extends string | FunctionComponent | unknown = unknown> {
415
+ type: T;
416
+ props: T extends FunctionComponent<infer P> ? P : Record<any, unknown>;
417
+ children: JSXChildren | null;
418
+ key: string | null;
419
+ dev?: DevJSX;
420
+ }
421
+
422
+ /**
423
+ * Any valid output for a component
424
+ *
425
+ * @public
426
+ */
427
+ declare type JSXOutput_2 = JSXNode | string | number | boolean | null | undefined | JSXOutput_2[];
428
+
82
429
  /** @public */
83
430
  declare interface MockDocument extends Document {
84
431
  }
@@ -98,6 +445,333 @@ declare interface MockWindow extends Window {
98
445
  document: MockDocument;
99
446
  }
100
447
 
448
+ declare interface NodePropData {
449
+ $scopedStyleIdPrefix$: string | null;
450
+ $isConst$: boolean;
451
+ }
452
+
453
+ /**
454
+ * Returned type of the `noSerialize()` function. It will be TYPE or undefined.
455
+ *
456
+ * @public
457
+ * @see noSerialize
458
+ */
459
+ declare type NoSerialize<T> = (T & {
460
+ __no_serialize__: true;
461
+ }) | undefined;
462
+
463
+ declare type ObjToProxyMap = WeakMap<any, any>;
464
+
465
+ /** @public */
466
+ declare type OnRenderFn<PROPS> = (props: PROPS) => JSXOutput_2;
467
+
468
+ declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof TaskEvent | typeof RenderEvent | typeof ResourceEvent;
469
+
470
+ declare type Props = Record<string, unknown>;
471
+
472
+ /**
473
+ * The `QRL` type represents a lazy-loadable AND serializable resource.
474
+ *
475
+ * QRL stands for Qwik URL.
476
+ *
477
+ * Use `QRL` when you want to refer to a lazy-loaded resource. `QRL`s are most often used for code
478
+ * (functions) but can also be used for other resources such as `string`s in the case of styles.
479
+ *
480
+ * `QRL` is an opaque token that is generated by the Qwik Optimizer. (Do not rely on any properties
481
+ * in `QRL` as it may change between versions.)
482
+ *
483
+ * ## Creating `QRL` references
484
+ *
485
+ * Creating `QRL` is done using `$(...)` function. `$(...)` is a special marker for the Qwik
486
+ * Optimizer that marks that the code should be extracted into a lazy-loaded symbol.
487
+ *
488
+ * ```tsx
489
+ * useOnDocument(
490
+ * 'mousemove',
491
+ * $((event) => console.log('mousemove', event))
492
+ * );
493
+ * ```
494
+ *
495
+ * In the above code, the Qwik Optimizer detects `$(...)` and transforms the code as shown below:
496
+ *
497
+ * ```tsx
498
+ * // FILE: <current file>
499
+ * useOnDocument('mousemove', qrl('./chunk-abc.js', 'onMousemove'));
500
+ *
501
+ * // FILE: chunk-abc.js
502
+ * export const onMousemove = () => console.log('mousemove');
503
+ * ```
504
+ *
505
+ * NOTE: `qrl(...)` is a result of Qwik Optimizer transformation. You should never have to invoke
506
+ * this function directly in your application. The `qrl(...)` function should be invoked only after
507
+ * the Qwik Optimizer transformation.
508
+ *
509
+ * ## Using `QRL`s
510
+ *
511
+ * Use `QRL` type in your application when you want to get a lazy-loadable reference to a resource
512
+ * (most likely a function).
513
+ *
514
+ * ```tsx
515
+ * // Example of declaring a custom functions which takes callback as QRL.
516
+ * export function useMyFunction(callback: QRL<() => void>) {
517
+ * doExtraStuff();
518
+ * // The callback passed to `onDocument` requires `QRL`.
519
+ * useOnDocument('mousemove', callback);
520
+ * }
521
+ * ```
522
+ *
523
+ * In the above example, the way to think about the code is that you are not asking for a callback
524
+ * function but rather a reference to a lazy-loadable callback function. Specifically, the function
525
+ * loading should be delayed until it is actually needed. In the above example, the function would
526
+ * not load until after a `mousemove` event on `document` fires.
527
+ *
528
+ * ## Resolving `QRL` references
529
+ *
530
+ * At times it may be necessary to resolve a `QRL` reference to the actual value. This can be
531
+ * performed using `QRL.resolve(..)` function.
532
+ *
533
+ * ```tsx
534
+ * // Assume you have QRL reference to a greet function
535
+ * const lazyGreet: QRL<() => void> = $(() => console.log('Hello World!'));
536
+ *
537
+ * // Use `qrlImport` to load / resolve the reference.
538
+ * const greet: () => void = await lazyGreet.resolve();
539
+ *
540
+ * // Invoke it
541
+ * greet();
542
+ * ```
543
+ *
544
+ * NOTE: `element` is needed because `QRL`s are relative and need a base location to resolve
545
+ * against. The base location is encoded in the HTML in the form of `<div q:base="/url">`.
546
+ *
547
+ * ## `QRL.resolved`
548
+ *
549
+ * Once `QRL.resolve()` returns, the value is stored under `QRL.resolved`. This allows the value to
550
+ * be used without having to await `QRL.resolve()` again.
551
+ *
552
+ * ## Question: Why not just use `import()`?
553
+ *
554
+ * At first glance, `QRL` serves the same purpose as `import()`. However, there are three subtle
555
+ * differences that need to be taken into account.
556
+ *
557
+ * 1. `QRL`s must be serializable into HTML.
558
+ * 2. `QRL`s must be resolved by framework relative to `q:base`.
559
+ * 3. `QRL`s must be able to capture lexically scoped variables.
560
+ * 4. `QRL`s encapsulate the difference between running with and without Qwik Optimizer.
561
+ * 5. `QRL`s allow expressing lazy-loaded boundaries without thinking about chunk and symbol names.
562
+ *
563
+ * Let's assume that you intend to write code such as this:
564
+ *
565
+ * ```tsx
566
+ * return <button onClick={() => (await import('./chunk-abc.js')).onClick}>
567
+ * ```
568
+ *
569
+ * The above code needs to be serialized into DOM such as:
570
+ *
571
+ * ```
572
+ * <div q:base="/build/">
573
+ * <button on:click="./chunk-abc.js#onClick">...</button>
574
+ * </div>
575
+ * ```
576
+ *
577
+ * 1. Notice there is no easy way to extract chunk (`./chunk-abc.js`) and symbol (`onClick`) into HTML.
578
+ * 2. Notice that even if you could extract it, the `import('./chunk-abc.js')` would become relative to
579
+ * where the `import()` file is declared. Because it is our framework doing the load, the
580
+ * `./chunk-abc.js` would become relative to the framework file. This is not correct, as it
581
+ * should be relative to the original file generated by the bundler.
582
+ * 3. Next, the framework needs to resolve the `./chunk-abc.js` and needs a base location that is
583
+ * encoded in the HTML.
584
+ * 4. The QRL needs to be able to capture lexically scoped variables. (`import()` only allows loading
585
+ * top-level symbols which don't capture variables.)
586
+ * 5. As a developer, you don't want to think about `import` and naming the chunks and symbols. You
587
+ * just want to say: "this should be lazy."
588
+ *
589
+ * These are the main reasons why Qwik introduces its own concept of `QRL`.
590
+ *
591
+ * @public
592
+ * @see `$`
593
+ */
594
+ declare type QRL<TYPE = unknown> = {
595
+ __qwik_serializable__?: any;
596
+ __brand__QRL__: TYPE;
597
+ /** Resolve the QRL and return the actual value. */
598
+ resolve(): Promise<TYPE>;
599
+ /** The resolved value, once `resolve()` returns. */
600
+ resolved: undefined | TYPE;
601
+ getCaptured(): unknown[] | null;
602
+ getSymbol(): string;
603
+ getHash(): string;
604
+ dev: QRLDev | null;
605
+ } & BivariantQrlFn<QrlArgs<TYPE>, QrlReturn<TYPE>>;
606
+
607
+ declare type QrlArgs<T> = T extends (...args: infer ARGS) => any ? ARGS : unknown[];
608
+
609
+ /** @public */
610
+ declare interface QRLDev {
611
+ file: string;
612
+ lo: number;
613
+ hi: number;
614
+ }
615
+
616
+ declare type QRLInternal<TYPE = unknown> = QRL<TYPE> & QRLInternalMethods<TYPE>;
617
+
618
+ declare type QRLInternalMethods<TYPE> = {
619
+ readonly $chunk$: string | null;
620
+ readonly $symbol$: string;
621
+ readonly $hash$: string;
622
+ $capture$: string[] | null;
623
+ $captureRef$: unknown[] | null;
624
+ dev: QRLDev | null;
625
+ resolved: undefined | TYPE;
626
+ resolve(containerEl?: Element): Promise<TYPE>;
627
+ getSymbol(): string;
628
+ getHash(): string;
629
+ getCaptured(): unknown[] | null;
630
+ getFn(currentCtx?: InvokeContext | InvokeTuple, beforeFn?: () => void): TYPE extends (...args: any) => any ? (...args: Parameters<TYPE>) => ValueOrPromise<ReturnType<TYPE>> : unknown;
631
+ $setContainer$(containerEl: Element | undefined): Element | undefined;
632
+ };
633
+
634
+ declare type QrlReturn<T> = T extends (...args: any) => infer R ? Awaited<R> : unknown;
635
+
636
+ /** @public */
637
+ declare interface ReadonlySignal<T = unknown> {
638
+ readonly value: T;
639
+ }
640
+
641
+ declare const RenderEvent = "qRender";
642
+
643
+ declare const ResourceEvent = "qResource";
644
+
645
+ declare interface ResourceReturnInternal<T> {
646
+ __brand: 'resource';
647
+ _state: 'pending' | 'resolved' | 'rejected';
648
+ _resolved: T | undefined;
649
+ _error: Error | undefined;
650
+ _cache: number;
651
+ _timeout: number;
652
+ value: Promise<T>;
653
+ loading: boolean;
654
+ }
655
+
656
+ declare type Scheduler = ReturnType<typeof createScheduler>;
657
+
658
+ declare type SeenRef = {
659
+ $parent$: unknown | null;
660
+ $index$: number;
661
+ $rootIndex$: number;
662
+ };
663
+
664
+ declare interface SerializationContext {
665
+ $serialize$: () => void;
666
+ $symbolToChunkResolver$: SymbolToChunkResolver;
667
+ /**
668
+ * Map from object to parent and index reference.
669
+ *
670
+ * If object is found in `objMap` will return the parent reference and index path.
671
+ *
672
+ * `objMap` return:
673
+ *
674
+ * - `{ parent, index }` - The parent object and the index within that parent.
675
+ * - `undefined` - Object has not been seen yet.
676
+ */
677
+ $wasSeen$: (obj: unknown) => SeenRef | undefined;
678
+ $hasRootId$: (obj: unknown) => number | undefined;
679
+ /**
680
+ * Root objects which need to be serialized.
681
+ *
682
+ * Roots are entry points into the object graph. Typically the roots are held by the listeners.
683
+ *
684
+ * Returns a path string representing the path from roots through all parents to the object.
685
+ * Format: "3 2 0" where each number is the index within its parent, from root to leaf.
686
+ */
687
+ $addRoot$: (obj: unknown, parent?: unknown) => number;
688
+ /**
689
+ * Get root path of the object without creating a new root.
690
+ *
691
+ * This is used during serialization, as new roots can't be created during serialization.
692
+ *
693
+ * The function throws if the root was not found.
694
+ */
695
+ $addRootPath$: (obj: any) => string | number;
696
+ $seen$: (obj: unknown, parent: unknown | null, index: number) => void;
697
+ $roots$: unknown[];
698
+ $objectPathStringCache$: Map<unknown, string | number>;
699
+ $addSyncFn$($funcStr$: string | null, argsCount: number, fn: Function): number;
700
+ $isSsrNode$: (obj: unknown) => obj is SsrNode;
701
+ $isDomRef$: (obj: unknown) => obj is DomRef;
702
+ $writer$: StreamWriter;
703
+ $syncFns$: string[];
704
+ $eventQrls$: Set<QRL>;
705
+ $eventNames$: Set<string>;
706
+ $resources$: Set<ResourceReturnInternal<unknown>>;
707
+ $renderSymbols$: Set<string>;
708
+ $storeProxyMap$: ObjToProxyMap;
709
+ $getProp$: (obj: any, prop: string) => any;
710
+ $setProp$: (obj: any, prop: string, value: any) => void;
711
+ }
712
+
713
+ /**
714
+ * A signal is a reactive value which can be read and written. When the signal is written, all tasks
715
+ * which are tracking the signal will be re-run and all components that read the signal will be
716
+ * re-rendered.
717
+ *
718
+ * Furthermore, when a signal value is passed as a prop to a component, the optimizer will
719
+ * automatically forward the signal. This means that `return <div title={signal.value}>hi</div>`
720
+ * will update the `title` attribute when the signal changes without having to re-render the
721
+ * component.
722
+ *
723
+ * @public
724
+ */
725
+ declare interface Signal<T = any> extends ReadonlySignal<T> {
726
+ value: T;
727
+ }
728
+
729
+ declare class SignalImpl<T = any> implements Signal<T> {
730
+ $untrackedValue$: T;
731
+ /** Store a list of effects which are dependent on this signal. */
732
+ $effects$: null | Set<EffectSubscription>;
733
+ $container$: Container | null;
734
+ constructor(container: Container | null, value: T);
735
+ /**
736
+ * Use this to force running subscribers, for example when the calculated value has mutated but
737
+ * remained the same object
738
+ */
739
+ force(): void;
740
+ get untrackedValue(): T;
741
+ set untrackedValue(value: T);
742
+ get value(): T;
743
+ set value(value: T);
744
+ valueOf(): void;
745
+ toString(): string;
746
+ toJSON(): {
747
+ value: T;
748
+ };
749
+ }
750
+
751
+ declare interface SimplifiedServerRequestEvent<T = unknown> {
752
+ url: URL;
753
+ locale: string | undefined;
754
+ request: Request;
755
+ }
756
+
757
+ declare type SsrAttrKey = string;
758
+
759
+ declare type SsrAttrs = Array<SsrAttrKey | SsrAttrValue>;
760
+
761
+ declare type SsrAttrValue = string | Signal<any> | boolean | object | null;
762
+
763
+ /** A selection of attributes of the real thing */
764
+ declare type SsrNode = {
765
+ id: string;
766
+ children: ISsrNode[] | null;
767
+ vnodeData: VNodeData;
768
+ [_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | null;
769
+ };
770
+
771
+ declare const enum SsrNodeFlags {
772
+ Updatable = 1
773
+ }
774
+
101
775
  /** @public */
102
776
  export declare function ssrRenderToDom(jsx: JSXOutput, opts?: {
103
777
  debug?: boolean;
@@ -105,15 +779,147 @@ export declare function ssrRenderToDom(jsx: JSXOutput, opts?: {
105
779
  }): Promise<{
106
780
  container: _DomContainer;
107
781
  document: Document;
108
- vNode: _VirtualVNode | null;
782
+ vNode: _VNode | null;
109
783
  getStyles: () => Record<string, string | string[]>;
110
784
  }>;
111
785
 
786
+ declare type StoreTarget = Record<string | symbol, any>;
787
+
788
+ /** @internal */
789
+ declare interface StreamWriter {
790
+ write(chunk: string): void;
791
+ }
792
+
793
+ /** @internal */
794
+ declare class SubscriptionData {
795
+ data: NodePropData;
796
+ constructor(data: NodePropData);
797
+ }
798
+
799
+ declare type SymbolToChunkResolver = (symbol: string) => string;
800
+
801
+ declare class Task<T = unknown, B = T> extends BackRef implements DescriptorBase<unknown, Signal<B> | ResourceReturnInternal<B>> {
802
+ $flags$: number;
803
+ $index$: number;
804
+ $el$: HostElement;
805
+ $qrl$: QRLInternal<T>;
806
+ $state$: Signal<B> | ResourceReturnInternal<B> | undefined;
807
+ $destroy$: NoSerialize<() => void> | null;
808
+ constructor($flags$: number, $index$: number, $el$: HostElement, $qrl$: QRLInternal<T>, $state$: Signal<B> | ResourceReturnInternal<B> | undefined, $destroy$: NoSerialize<() => void> | null);
809
+ }
810
+
811
+ declare const TaskEvent = "qTask";
812
+
112
813
  /** @public */
113
814
  declare interface TestPlatform extends CorePlatform {
815
+ /**
816
+ * @deprecated No longer used, please use {@link waitForDrain} instead.
817
+ * @example With `ssrRenderToDom`
818
+ *
819
+ * ```ts
820
+ * import { waitForDrain } from '@qwik.dev/testing';
821
+ *
822
+ * const { container } = ssrRenderToDom(...);
823
+ * await waitForDrain(container);
824
+ * ```
825
+ *
826
+ * @example With `domRender`
827
+ *
828
+ * ```ts
829
+ * import { waitForDrain } from '@qwik.dev/testing';
830
+ *
831
+ * const { container } = domRender(...);
832
+ * await waitForDrain(container);
833
+ * ```
834
+ */
114
835
  flush: () => Promise<void>;
115
836
  }
116
837
 
838
+ /**
839
+ * Used to signal to Qwik which state should be watched for changes.
840
+ *
841
+ * The `Tracker` is passed into the `taskFn` of `useTask`. It is intended to be used to wrap state
842
+ * objects in a read proxy which signals to Qwik which properties should be watched for changes. A
843
+ * change to any of the properties causes the `taskFn` to rerun.
844
+ *
845
+ * ### Example
846
+ *
847
+ * The `obs` passed into the `taskFn` is used to mark `state.count` as a property of interest. Any
848
+ * changes to the `state.count` property will cause the `taskFn` to rerun.
849
+ *
850
+ * ```tsx
851
+ * const Cmp = component$(() => {
852
+ * const store = useStore({ count: 0, doubleCount: 0 });
853
+ * const signal = useSignal(0);
854
+ * useTask$(({ track }) => {
855
+ * // Any signals or stores accessed inside the task will be tracked
856
+ * const count = track(() => store.count);
857
+ * // You can also pass a signal to track() directly
858
+ * const signalCount = track(signal);
859
+ * store.doubleCount = count + signalCount;
860
+ * });
861
+ * return (
862
+ * <div>
863
+ * <span>
864
+ * {store.count} / {store.doubleCount}
865
+ * </span>
866
+ * <button
867
+ * onClick$={() => {
868
+ * store.count++;
869
+ * signal.value++;
870
+ * }}
871
+ * >
872
+ * +
873
+ * </button>
874
+ * </div>
875
+ * );
876
+ * });
877
+ * ```
878
+ *
879
+ * @public
880
+ * @see `useTask`
881
+ */
882
+ declare interface Tracker {
883
+ /**
884
+ * Include the expression using stores / signals to track:
885
+ *
886
+ * ```tsx
887
+ * track(() => store.count);
888
+ * ```
889
+ *
890
+ * The `track()` function also returns the value of the scoped expression:
891
+ *
892
+ * ```tsx
893
+ * const count = track(() => store.count);
894
+ * ```
895
+ */
896
+ <T>(fn: () => T): T;
897
+ /**
898
+ * Used to track the whole object. If any property of the passed store changes, the task will be
899
+ * scheduled to run. Also accepts signals.
900
+ *
901
+ * Note that the change tracking is not deep. If you want to track changes to nested properties,
902
+ * you need to use `track` on each of them.
903
+ *
904
+ * ```tsx
905
+ * track(store); // returns store
906
+ * track(signal); // returns signal.value
907
+ * ```
908
+ */
909
+ <T extends object>(obj: T): T extends Signal<infer U> ? U : T;
910
+ /**
911
+ * Used to track to track a specific property of an object.
912
+ *
913
+ * Note that the change tracking is not deep. If you want to track changes to nested properties,
914
+ * you need to use `track` on each of them.
915
+ *
916
+ * ```tsx
917
+ * track(store, 'propA'); // returns store.propA
918
+ * ```
919
+ */
920
+ <T extends object, P extends keyof T>(obj: T, prop: P): T[P];
921
+ }
922
+
117
923
  /**
118
924
  * Trigger an event in unit tests on an element.
119
925
  *
@@ -121,16 +927,158 @@ declare interface TestPlatform extends CorePlatform {
121
927
  *
122
928
  * @public
123
929
  */
124
- export declare function trigger(root: Element, queryOrElement: string | Element | keyof HTMLElementTagNameMap | null, eventName: string, eventPayload?: any): Promise<void>;
930
+ export declare function trigger(root: Element, queryOrElement: string | Element | keyof HTMLElementTagNameMap | null, eventName: string, eventPayload?: any, options?: {
931
+ waitForIdle?: boolean;
932
+ }): Promise<void>;
933
+
934
+ /**
935
+ * Type representing a value which is either resolve or a promise.
936
+ *
937
+ * @public
938
+ */
939
+ declare type ValueOrPromise<T> = T | Promise<T>;
940
+
941
+ /** @internal */
942
+ declare class VirtualVNode extends VNode {
943
+ firstChild: VNode | null | undefined;
944
+ lastChild: VNode | null | undefined;
945
+ constructor(flags: VNodeFlags, parent: ElementVNode | VirtualVNode | null, previousSibling: VNode | null | undefined, nextSibling: VNode | null | undefined, firstChild: VNode | null | undefined, lastChild: VNode | null | undefined);
946
+ }
947
+
948
+ /** @internal */
949
+ declare abstract class VNode extends BackRef {
950
+ flags: VNodeFlags;
951
+ parent: ElementVNode | VirtualVNode | null;
952
+ previousSibling: VNode | null | undefined;
953
+ nextSibling: VNode | null | undefined;
954
+ props: unknown[] | null;
955
+ slotParent: VNode | null;
956
+ chores: ChoreArray | null;
957
+ blockedChores: ChoreArray | null;
958
+ constructor(flags: VNodeFlags, parent: ElementVNode | VirtualVNode | null, previousSibling: VNode | null | undefined, nextSibling: VNode | null | undefined);
959
+ getProp<T>(key: string, getObject: ((id: string) => any) | null): T | null;
960
+ setProp(key: string, value: any): void;
961
+ getAttr(key: string): string | null;
962
+ setAttr(key: string, value: string | null | boolean, journal: VNodeJournal | null): void;
963
+ toString(): string;
964
+ }
125
965
 
126
966
  /** @public */
127
967
  export declare function vnode_fromJSX(jsx: JSXOutput): {
128
- vParent: _ElementVNode;
968
+ vParent: _ElementVNode | _VirtualVNode;
129
969
  vNode: _VNode | null;
130
970
  document: _QDocument;
131
- container: ClientContainer;
971
+ container: ClientContainer_2;
132
972
  };
133
973
 
974
+ /**
975
+ * Array of numbers which describes virtual nodes in the tree.
976
+ *
977
+ * HTML can't account for:
978
+ *
979
+ * - Multiple text nodes in a row. (it treats it as a single text node)
980
+ * - Empty text nodes. (it ignores them)
981
+ * - And virtual nodes such as `<Fragment/>` or `<MyComponent/>`
982
+ *
983
+ * So we need to encode all of that information into the VNodeData.
984
+ *
985
+ * Encoding:
986
+ *
987
+ * - First position is special and encodes state information and stores VNodeDataFlag.
988
+ * - Positive numbers are text node lengths. (0 is a special case for empty text node)
989
+ * - Negative numbers are element counts.
990
+ * - `OPEN_FRAGMENT` is start of virtual node.
991
+ *
992
+ * - If `OPEN_FRAGMENT` than the previous node is an `Array` which contains the props (see
993
+ * `SsrAttrs`). NOTE: The array is never going to be the last item in the VNodeData, so we can
994
+ * always assume that the last item in `vNodeData` is a number.
995
+ * - `CLOSE_FRAGMENT` is end of virtual node.
996
+ *
997
+ * NOTE: This is how we store the information during the SSR streaming, once the SSR is complete
998
+ * this data needs to be serialized into a string and stored in the DOM as a script tag which has
999
+ * deferent serialization format.
1000
+ */
1001
+ declare type VNodeData = [VNodeDataFlag, ...(SsrAttrs | number)[]];
1002
+
1003
+ /**
1004
+ * Flags for VNodeData (Flags con be bitwise combined)
1005
+ *
1006
+ * @internal
1007
+ */
1008
+ declare const enum VNodeDataFlag {
1009
+ NONE = 0,
1010
+ TEXT_DATA = 1,
1011
+ VIRTUAL_NODE = 2,
1012
+ ELEMENT_NODE = 4,
1013
+ REFERENCE = 8,
1014
+ SERIALIZE = 16
1015
+ }
1016
+
1017
+ /**
1018
+ * Flags for VNode.
1019
+ *
1020
+ * # Materialize vs Inflation
1021
+ *
1022
+ * - Materialized: The node has all of its children. Specifically `firstChild`/`lastChild` are NOT
1023
+ * `undefined`. Materialization creates lazy instantiation of the children. NOTE: Only
1024
+ * ElementVNode need to be materialized.
1025
+ * - Inflation:
1026
+ *
1027
+ * - If Text: It means that it is safe to write to the node. When Text nodes are first Deserialized
1028
+ * multiple text nodes can share the same DOM node. On write the sibling text nodes need to be
1029
+ * converted into separate text nodes.
1030
+ * - If Element: It means that the element tag attributes have not yet been read from the DOM.
1031
+ *
1032
+ * Inflation and materialization are not the same, they are two independent things.
1033
+ *
1034
+ * @internal
1035
+ */
1036
+ declare const enum VNodeFlags {
1037
+ Element = 1,
1038
+ Virtual = 2,
1039
+ ELEMENT_OR_VIRTUAL_MASK = 3,
1040
+ Text = 4,
1041
+ ELEMENT_OR_TEXT_MASK = 5,
1042
+ TYPE_MASK = 7,
1043
+ INFLATED_TYPE_MASK = 15,
1044
+ Inflated = 8,
1045
+ Resolved = 16,
1046
+ Deleted = 32,
1047
+ NAMESPACE_MASK = 192,
1048
+ NEGATED_NAMESPACE_MASK = -193,
1049
+ NS_html = 0,// http://www.w3.org/1999/xhtml
1050
+ NS_svg = 64,// http://www.w3.org/2000/svg
1051
+ NS_math = 128
1052
+ }
1053
+
1054
+ declare type VNodeJournal = Array<VNodeJournalOpCode | Document | Element | Text | string | boolean | null>;
1055
+
1056
+ /**
1057
+ * Fundamental DOM operations are:
1058
+ *
1059
+ * - Insert new DOM element/text
1060
+ * - Remove DOM element/text
1061
+ * - Set DOM element attributes
1062
+ * - Set text node value
1063
+ */
1064
+ declare const enum VNodeJournalOpCode {
1065
+ SetText = 1,// ------ [SetAttribute, target, text]
1066
+ SetAttribute = 2,// - [SetAttribute, target, ...(key, values)]]
1067
+ HoistStyles = 3,// -- [HoistStyles, document]
1068
+ Remove = 4,// ------- [Insert, target(parent), ...nodes]
1069
+ Insert = 5
1070
+ }
1071
+
1072
+ /**
1073
+ * Wait for the scheduler to drain.
1074
+ *
1075
+ * This is useful when testing async code.
1076
+ *
1077
+ * @param container - The application container.
1078
+ * @public
1079
+ */
1080
+ export declare function waitForDrain(container: Container): Promise<void>;
1081
+
134
1082
  /** @public */
135
1083
  export declare function walkJSX(jsx: JSXOutput, apply: {
136
1084
  enter: (jsx: JSXNodeInternal) => void;