@qwik.dev/core 2.0.0-beta.4 → 2.0.0-beta.41

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 (151) hide show
  1. package/dist/backpatch/index.d.ts +2 -0
  2. package/dist/backpatch/index.mjs +5 -0
  3. package/dist/backpatch/package.json +8 -0
  4. package/dist/backpatch-executor.debug.js +59 -0
  5. package/dist/backpatch-executor.js +1 -0
  6. package/dist/build/package.json +1 -1
  7. package/dist/cli.mjs +12974 -0
  8. package/dist/core-internal.d.ts +1579 -818
  9. package/dist/core.min.mjs +9 -1
  10. package/dist/core.mjs +14777 -9194
  11. package/dist/core.mjs.map +1 -1
  12. package/dist/core.prod.mjs +10480 -5372
  13. package/dist/insights/index.qwik.mjs +82 -71
  14. package/dist/insights/vite/index.mjs +79 -81
  15. package/dist/loader/index.mjs +2 -2
  16. package/dist/loader/package.json +1 -1
  17. package/dist/optimizer.d.ts +78 -295
  18. package/dist/optimizer.mjs +2948 -4088
  19. package/dist/out-of-order-executor.debug.js +140 -0
  20. package/dist/out-of-order-executor.js +1 -0
  21. package/dist/preloader.mjs +172 -192
  22. package/dist/qwikloader.debug.js +403 -244
  23. package/dist/qwikloader.js +1 -1
  24. package/dist/server-modules.d.ts +1 -0
  25. package/dist/server.d.ts +54 -249
  26. package/dist/server.mjs +2332 -1407
  27. package/dist/server.prod.mjs +3844 -0
  28. package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/{vite.config.mts → vite.config.ts} +3 -3
  29. package/dist/starters/adapters/aws-lambda/package.json +3 -2
  30. package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +2 -6
  31. package/dist/starters/adapters/azure-swa/adapters/azure-swa/{vite.config.mts → vite.config.ts} +3 -3
  32. package/dist/starters/adapters/azure-swa/package.json +3 -2
  33. package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +2 -3
  34. package/dist/starters/adapters/bun/adapters/bun/{vite.config.mts → vite.config.ts} +4 -4
  35. package/dist/starters/adapters/bun/package.json +3 -2
  36. package/dist/starters/adapters/bun/src/entry.bun.ts +37 -10
  37. package/dist/starters/adapters/cloud-run/adapters/cloud-run/{vite.config.mts → vite.config.ts} +3 -3
  38. package/dist/starters/adapters/cloud-run/package.json +3 -2
  39. package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +23 -7
  40. package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/{vite.config.mts → vite.config.ts} +3 -3
  41. package/dist/starters/adapters/cloudflare-pages/package.json +3 -2
  42. package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +2 -3
  43. package/dist/starters/adapters/cloudflare-workers/README.md +52 -0
  44. package/dist/starters/adapters/cloudflare-workers/adapters/cloudflare-workers/vite.config.ts +15 -0
  45. package/dist/starters/adapters/cloudflare-workers/gitignore +3 -0
  46. package/dist/starters/adapters/cloudflare-workers/package.json +31 -0
  47. package/dist/starters/adapters/cloudflare-workers/public/.assetsignore +4 -0
  48. package/dist/starters/adapters/cloudflare-workers/public/_headers +11 -0
  49. package/dist/starters/adapters/cloudflare-workers/public/_redirects +1 -0
  50. package/dist/starters/adapters/cloudflare-workers/src/entry.cloudflare-pages.tsx +22 -0
  51. package/dist/starters/adapters/cloudflare-workers/worker-configuration.d.ts +5 -0
  52. package/dist/starters/adapters/cloudflare-workers/wrangler.jsonc +41 -0
  53. package/dist/starters/adapters/deno/adapters/deno/{vite.config.mts → vite.config.ts} +3 -3
  54. package/dist/starters/adapters/deno/package.json +3 -2
  55. package/dist/starters/adapters/deno/src/entry.deno.ts +43 -10
  56. package/dist/starters/adapters/express/adapters/express/{vite.config.mts → vite.config.ts} +3 -3
  57. package/dist/starters/adapters/express/package.json +4 -3
  58. package/dist/starters/adapters/express/src/entry.express.tsx +22 -7
  59. package/dist/starters/adapters/fastify/adapters/fastify/{vite.config.mts → vite.config.ts} +3 -3
  60. package/dist/starters/adapters/fastify/package.json +5 -4
  61. package/dist/starters/adapters/fastify/src/entry.fastify.tsx +21 -1
  62. package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +11 -4
  63. package/dist/starters/adapters/firebase/adapters/firebase/{vite.config.mts → vite.config.ts} +3 -3
  64. package/dist/starters/adapters/firebase/package.json +3 -2
  65. package/dist/starters/adapters/firebase/src/entry-firebase.tsx +2 -3
  66. package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/{vite.config.mts → vite.config.ts} +3 -3
  67. package/dist/starters/adapters/netlify-edge/package.json +5 -4
  68. package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +2 -3
  69. package/dist/starters/adapters/node-server/adapters/node-server/{vite.config.mts → vite.config.ts} +3 -3
  70. package/dist/starters/adapters/node-server/package.json +3 -2
  71. package/dist/starters/adapters/node-server/src/entry.node-server.tsx +22 -6
  72. package/dist/starters/adapters/{static/adapters/static/vite.config.mts → ssg/adapters/ssg/vite.config.ts} +4 -4
  73. package/dist/starters/adapters/ssg/package.json +20 -0
  74. package/dist/starters/adapters/vercel-edge/README.md +2 -2
  75. package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/{vite.config.mts → vite.config.ts} +3 -3
  76. package/dist/starters/adapters/vercel-edge/package.json +3 -2
  77. package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +2 -3
  78. package/dist/starters/adapters/vercel-edge/vercel.json +1 -1
  79. package/dist/starters/features/auth/package.json +1 -1
  80. package/dist/starters/features/compiled-i18n/package.json +37 -0
  81. package/dist/starters/features/compiled-i18n/src/components/locale-selector/locale-selector.tsx +30 -0
  82. package/dist/starters/features/compiled-i18n/src/entry.ssr.tsx +31 -0
  83. package/dist/starters/features/compiled-i18n/src/routes/plugin@compiled-i18n.ts +28 -0
  84. package/dist/starters/features/csr/index.html +27 -0
  85. package/dist/starters/features/csr/package.json +29 -0
  86. package/dist/starters/features/csr/src/root.tsx +15 -0
  87. package/dist/starters/features/csr/vite.config.ts +13 -0
  88. package/dist/starters/features/cypress/src/actions/example.action.ts +5 -0
  89. package/dist/starters/features/cypress/src/components/example/example.cy.tsx +50 -8
  90. package/dist/starters/features/cypress/src/components/example/example.tsx +13 -3
  91. package/dist/starters/features/cypress/src/loaders/example.loader.ts +5 -0
  92. package/dist/starters/features/drizzle/package.json +1 -1
  93. package/dist/starters/features/pandacss/package.json +1 -1
  94. package/dist/starters/features/postcss/postcss.config.js +1 -1
  95. package/dist/starters/features/storybook/.storybook/tsconfig.json +0 -1
  96. package/dist/starters/features/styled-vanilla-extract/package.json +2 -1
  97. package/dist/starters/features/tailwind/package.json +2 -2
  98. package/dist/starters/features/tailwind/prettier.config.js +10 -0
  99. package/dist/starters/features/tailwind-v3/package.json +1 -1
  100. package/dist/starters/features/tailwind-v3/prettier.config.js +10 -0
  101. package/dist/starters/features/vitest/package.json +1 -1
  102. package/dist/testing/index.d.ts +1000 -7
  103. package/dist/testing/index.mjs +16487 -11656
  104. package/dist/testing/package.json +1 -1
  105. package/dist/worker/index.d.mts +21 -0
  106. package/dist/worker/index.mjs +251 -0
  107. package/dist/worker/package.json +9 -0
  108. package/dist/worker/worker.js +13 -0
  109. package/dist/worker/worker.node.js +15 -0
  110. package/dist/worker/worker.shared.js +63 -0
  111. package/handlers.mjs +21 -1
  112. package/package.json +40 -56
  113. package/public.d.ts +12 -2
  114. package/{qwik-cli.cjs → qwik-cli.mjs} +1 -1
  115. package/server.d.ts +2 -0
  116. package/worker.d.ts +2 -0
  117. package/bindings/qwik.darwin-arm64.node +0 -0
  118. package/bindings/qwik.darwin-x64.node +0 -0
  119. package/bindings/qwik.linux-x64-gnu.node +0 -0
  120. package/bindings/qwik.wasm.cjs +0 -471
  121. package/bindings/qwik.wasm.mjs +0 -464
  122. package/bindings/qwik.win32-x64-msvc.node +0 -0
  123. package/bindings/qwik_wasm_bg.wasm +0 -0
  124. package/dist/build/index.cjs +0 -35
  125. package/dist/build/index.cjs.map +0 -7
  126. package/dist/build/index.dev.cjs +0 -37
  127. package/dist/build/index.dev.cjs.map +0 -7
  128. package/dist/build/index.prod.cjs +0 -37
  129. package/dist/build/index.prod.cjs.map +0 -7
  130. package/dist/cli.cjs +0 -5545
  131. package/dist/core.cjs +0 -11870
  132. package/dist/core.cjs.map +0 -1
  133. package/dist/core.prod.cjs +0 -5723
  134. package/dist/insights/index.qwik.cjs +0 -1
  135. package/dist/insights/vite/index.cjs +0 -1
  136. package/dist/loader/index.cjs +0 -4
  137. package/dist/optimizer.cjs +0 -4020
  138. package/dist/preloader.cjs +0 -269
  139. package/dist/server.cjs +0 -3040
  140. package/dist/starters/adapters/static/package.json +0 -19
  141. package/dist/starters/features/localize/package.json +0 -37
  142. package/dist/starters/features/localize/src/entry.ssr.tsx +0 -30
  143. package/dist/starters/features/localize/src/locales/message.en.json +0 -8
  144. package/dist/starters/features/localize/src/locales/message.it.json +0 -8
  145. package/dist/starters/features/localize/src/routes/[locale]/i18n-utils.ts +0 -94
  146. package/dist/starters/features/localize/src/routes/[locale]/index.tsx +0 -52
  147. package/dist/starters/features/localize/src/routes/[locale]/layout.tsx +0 -12
  148. package/dist/starters/features/playwright/playwright-report/index.html +0 -22026
  149. package/dist/starters/features/tailwind/.prettierrc.js +0 -3
  150. package/dist/testing/index.cjs +0 -33388
  151. /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';
@@ -6,10 +7,176 @@ import type { JSXNodeInternal } from '../internal';
6
7
  import { JSXOutput } from '..';
7
8
  import type { _QDocument } from '../internal';
8
9
  import { RenderResult } from '..';
10
+ import { StreamWriter } from '..';
9
11
  import type { _Stringifiable } from '../internal';
10
12
  import type { _VirtualVNode } from '../internal';
11
13
  import type { _VNode } from '../internal';
12
14
 
15
+ declare interface AddRootFn {
16
+ (obj: unknown, returnRef?: never): number;
17
+ (obj: unknown, returnRef: true): SeenRef;
18
+ }
19
+
20
+ declare type AllSignalFlags = ComputedSignalFlags | SerializationSignalFlags | AsyncSignalFlags;
21
+
22
+ declare const enum AsyncSignalFlags {
23
+ EAGER_CLEANUP = 32,
24
+ CLIENT_ONLY = 64,
25
+ /** The compute fn is async: the async engine (jobs, loading, error) is active */
26
+ ASYNC_MODE = 512,
27
+ /** Invoke the compute fn AsyncSignal-style: pass the ComputeCtx argument, no auto-tracking */
28
+ CTX_ARG = 1024
29
+ }
30
+
31
+ /** Class for back reference to the EffectSubscription */
32
+ declare abstract class BackRef {
33
+ [_EFFECT_BACK_REF]: Map<any, any> | undefined;
34
+ }
35
+
36
+ declare type BivariantQrlFn<ARGS extends any[], RETURN> = {
37
+ /**
38
+ * Resolve the QRL of closure and invoke it.
39
+ *
40
+ * @param args - Closure arguments.
41
+ * @returns A promise of the return value of the closure.
42
+ */
43
+ bivarianceHack(...args: ARGS): Promise<RETURN>;
44
+ }['bivarianceHack'];
45
+
46
+ declare const enum ChoreBits {
47
+ NONE = 0,
48
+ TASKS = 1,
49
+ NODE_DIFF = 2,
50
+ COMPONENT = 4,
51
+ INLINE_COMPONENT = 8,
52
+ NODE_PROPS = 16,
53
+ COMPUTE = 32,
54
+ CHILDREN = 64,
55
+ CLEANUP = 128,
56
+ RECONCILE = 256,
57
+ ERROR_WRAP = 512,
58
+ DIRTY_MASK = 1023
59
+ }
60
+
61
+ declare const enum ComputedSignalFlags {
62
+ INVALID = 1,
63
+ RUN_EFFECTS = 2,
64
+ PRESERVE_ON_SEQ_CLEANUP = 4
65
+ }
66
+
67
+ /** @internal */
68
+ declare const _CONST_PROPS: unique symbol;
69
+
70
+ /**
71
+ * Effect is something which needs to happen (side-effect) due to signal value change.
72
+ *
73
+ * There are three types of effects:
74
+ *
75
+ * - `Task`: `useTask`, `useVisibleTask`, `useResource`
76
+ * - `VNode` and `ISsrNode`: Either a component or `<Signal>`
77
+ * - `Signal2`: A derived signal which contains a computation function.
78
+ */
79
+ declare type Consumer = Task | VNode | SignalImpl | ISsrNode;
80
+
81
+ /** @internal */
82
+ declare interface Container {
83
+ readonly $version$: string;
84
+ readonly $storeProxyMap$: ObjToProxyMap;
85
+ $rootContainer$: Container | null;
86
+ $isOutOfOrderSegment$: boolean;
87
+ readonly $locale$: string;
88
+ readonly $getObjectById$: (id: number | string) => any;
89
+ readonly $serverData$: Record<string, any>;
90
+ readonly $instanceHash$: string | null;
91
+ $currentUniqueId$: number;
92
+ $buildBase$: string | null;
93
+ $renderPromise$: Promise<void> | null;
94
+ $resolveRenderPromise$: (() => void) | null;
95
+ $pendingCount$: number;
96
+ $checkPendingCount$(): void;
97
+ handleError(err: any, $host$: HostElement | null): void;
98
+ getParentHost(host: HostElement): HostElement | null;
99
+ setContext<T>(host: HostElement, context: ContextId<T>, value: T): void;
100
+ resolveContext<T>(host: HostElement, contextId: ContextId<T>): T | undefined;
101
+ setHostProp<T>(host: HostElement, name: string, value: T): void;
102
+ getHostProp<T>(host: HostElement, name: string): T | null;
103
+ $appendStyle$(content: string, styleId: string, host: HostElement, scoped: boolean): void;
104
+ /**
105
+ * When component is about to be executed, it may add/remove children. This can cause problems
106
+ * with the projection because deleting content will prevent the projection references from
107
+ * looking up vnodes. Therefore before we execute the component we need to ensure that all of its
108
+ * references to vnode are resolved.
109
+ *
110
+ * @param renderHost - Host element to ensure projection is resolved.
111
+ */
112
+ ensureProjectionResolved(host: HostElement): void;
113
+ serializationCtxFactory(NodeConstructor: {
114
+ new (...rest: any[]): {
115
+ __brand__: 'SsrNode';
116
+ };
117
+ } | null, DomRefConstructor: {
118
+ new (...rest: any[]): {
119
+ __brand__: 'DomRef';
120
+ };
121
+ } | null, symbolToChunkResolver: SymbolToChunkResolver, writer?: StreamWriter_2): SerializationContext;
122
+ }
123
+
124
+ /**
125
+ * ContextId is a typesafe ID for your context.
126
+ *
127
+ * Context is a way to pass stores to the child components without prop-drilling.
128
+ *
129
+ * Use `createContextId()` to create a `ContextId`. A `ContextId` is just a serializable identifier
130
+ * for the context. It is not the context value itself. See `useContextProvider()` and
131
+ * `useContext()` for the values. Qwik needs a serializable ID for the context so that the it can
132
+ * track context providers and consumers in a way that survives resumability.
133
+ *
134
+ * ### Example
135
+ *
136
+ * ```tsx
137
+ * // Declare the Context type.
138
+ * interface TodosStore {
139
+ * items: string[];
140
+ * }
141
+ * // Create a Context ID (no data is saved here.)
142
+ * // You will use this ID to both create and retrieve the Context.
143
+ * export const TodosContext = createContextId<TodosStore>('Todos');
144
+ *
145
+ * // Example of providing context to child components.
146
+ * export const App = component$(() => {
147
+ * useContextProvider(
148
+ * TodosContext,
149
+ * useStore<TodosStore>({
150
+ * items: ['Learn Qwik', 'Build Qwik app', 'Profit'],
151
+ * })
152
+ * );
153
+ *
154
+ * return <Items />;
155
+ * });
156
+ *
157
+ * // Example of retrieving the context provided by a parent component.
158
+ * export const Items = component$(() => {
159
+ * const todos = useContext(TodosContext);
160
+ * return (
161
+ * <ul>
162
+ * {todos.items.map((item) => (
163
+ * <li>{item}</li>
164
+ * ))}
165
+ * </ul>
166
+ * );
167
+ * });
168
+ *
169
+ * ```
170
+ *
171
+ * @public
172
+ */
173
+ declare interface ContextId<STATE> {
174
+ /** Design-time property to store type information for the context. */
175
+ readonly __brand_context_type__: STATE;
176
+ /** A unique ID for the context. */
177
+ readonly id: string;
178
+ }
179
+
13
180
  /**
14
181
  * Create emulated `Document` for server environment. Does not implement the full browser `document`
15
182
  * and `window` API. This api may be removed in the future.
@@ -28,9 +195,21 @@ export declare const createDOM: ({ html }?: {
28
195
  }) => Promise<{
29
196
  render: (jsxElement: JSXOutput) => Promise<RenderResult>;
30
197
  screen: HTMLElement;
31
- userEvent: (queryOrElement: string | Element | keyof HTMLElementTagNameMap | null, eventNameCamel: string | keyof WindowEventMap, eventPayload?: any) => Promise<void>;
198
+ userEvent: (queryOrElement: string | Element | keyof HTMLElementTagNameMap | null, eventNameCamel: string | keyof WindowEventMap, eventPayload?: any) => Promise<Event | null>;
32
199
  }>;
33
200
 
201
+ /** @public */
202
+ declare interface DevJSX {
203
+ fileName: string;
204
+ lineNumber: number;
205
+ columnNumber: number;
206
+ stack?: string;
207
+ }
208
+
209
+ declare type DomRef = {
210
+ $ssrNode$: ISsrNode;
211
+ };
212
+
34
213
  /** @public */
35
214
  export declare function domRender(jsx: JSXOutput, opts?: {
36
215
  debug?: boolean;
@@ -41,6 +220,61 @@ export declare function domRender(jsx: JSXOutput, opts?: {
41
220
  getStyles: () => Record<string, string | string[]>;
42
221
  }>;
43
222
 
223
+ /** @internal */
224
+ declare const _EFFECT_BACK_REF: unique symbol;
225
+
226
+ declare type EffectBackRef = SignalImpl | StoreTarget | PropsProxy;
227
+
228
+ /** @internal */
229
+ declare const enum EffectProperty {
230
+ COMPONENT = ":",
231
+ VNODE = "."
232
+ }
233
+
234
+ /**
235
+ * An effect consumer plus type of effect, back references to producers and additional data
236
+ *
237
+ * An effect can be trigger by one or more of signal inputs. The first step of re-running an effect
238
+ * is to clear its subscriptions so that the effect can re add new set of subscriptions. In order to
239
+ * clear the subscriptions we need to store them here.
240
+ *
241
+ * Imagine you have effect such as:
242
+ *
243
+ * ```
244
+ * function effect1() {
245
+ * console.log(signalA.value ? signalB.value : 'default');
246
+ * }
247
+ * ```
248
+ *
249
+ * In the above case the `signalB` needs to be unsubscribed when `signalA` is falsy. We do this by
250
+ * always clearing all of the subscriptions
251
+ *
252
+ * The `EffectSubscription` stores
253
+ *
254
+ * ```
255
+ * subscription1 = [effectConsumer1, EffectProperty.COMPONENT, Set[(signalA, signalB)]];
256
+ * ```
257
+ *
258
+ * The `signal1` and `signal2` back references are needed to "clear" existing subscriptions.
259
+ *
260
+ * Both `signalA` as well as `signalB` will have a reference to `subscription` to the so that the
261
+ * effect can be scheduled if either `signalA` or `signalB` triggers. The `subscription1` is shared
262
+ * between the signals.
263
+ *
264
+ * The second position `EffectProperty|string` store the property name of the effect.
265
+ *
266
+ * - Property name of the VNode
267
+ * - `EffectProperty.COMPONENT` if component
268
+ * - `EffectProperty.VNODE` if VNode
269
+ */
270
+ declare class EffectSubscription {
271
+ consumer: Consumer;
272
+ property: EffectProperty | string;
273
+ backRef: Set<EffectBackRef> | null;
274
+ data: SubscriptionData | null;
275
+ constructor(consumer: Consumer, property: EffectProperty | string, backRef?: Set<EffectBackRef> | null, data?: SubscriptionData | null);
276
+ }
277
+
44
278
  /**
45
279
  * Creates a simple DOM structure for testing components.
46
280
  *
@@ -76,9 +310,178 @@ export declare function emulateExecutionOfQwikFuncs(document: Document): void;
76
310
  /** @public */
77
311
  export declare function expectDOM(actual: Element, expected: string): Promise<void>;
78
312
 
313
+ /**
314
+ * Any function taking a props object that returns JSXOutput.
315
+ *
316
+ * The `key`, `flags` and `dev` parameters are for internal use.
317
+ *
318
+ * @public
319
+ */
320
+ declare type FunctionComponent<P = unknown> = {
321
+ renderFn(props: P, key: string | null, flags: number, dev?: DevJSX): JSXOutput_2;
322
+ }['renderFn'];
323
+
79
324
  /** @public */
80
325
  export declare function getTestPlatform(): TestPlatform;
81
326
 
327
+ /** @internal */
328
+ declare type HostElement = VNode | ISsrNode;
329
+
330
+ /** @public */
331
+ export declare interface InOrderAuto {
332
+ strategy: 'auto';
333
+ maximumInitialChunk?: number;
334
+ maximumChunk?: number;
335
+ }
336
+
337
+ /** @public */
338
+ export declare interface InOrderDirect {
339
+ strategy: 'direct';
340
+ }
341
+
342
+ /** @public */
343
+ export declare interface InOrderDisabled {
344
+ strategy: 'disabled';
345
+ }
346
+
347
+ /** @public */
348
+ export declare type InOrderStreaming = InOrderAuto | InOrderDisabled | InOrderDirect;
349
+
350
+ /** The shared state during an invoke() call */
351
+ declare interface InvokeContext {
352
+ /** The Virtual parent component for the current component code */
353
+ $hostElement$: HostElement | undefined;
354
+ /** The event we're currently handling */
355
+ $event$: PossibleEvents | undefined;
356
+ $effectSubscriber$: EffectSubscription | undefined;
357
+ $locale$: string | undefined;
358
+ $container$: Container | undefined;
359
+ }
360
+
361
+ declare interface ISsrNode {
362
+ id: string;
363
+ flags: SsrNodeFlags;
364
+ dirty: ChoreBits;
365
+ parentComponent: ISsrNode | null;
366
+ children: ISsrNode[] | null;
367
+ vnodeData: VNodeData;
368
+ currentFile: string | null;
369
+ readonly [_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | null;
370
+ setProp(name: string, value: any): void;
371
+ getProp(name: string): any;
372
+ removeProp(name: string): void;
373
+ addChild(child: ISsrNode): void;
374
+ setTreeNonUpdatable(): void;
375
+ }
376
+
377
+ /** @public */
378
+ declare type JSXChildren = string | number | boolean | null | undefined | Function | RegExp | JSXChildren[] | Promise<JSXChildren> | Signal<JSXChildren> | JSXNode;
379
+
380
+ /**
381
+ * A JSX Node, an internal structure. You probably want to use `JSXOutput` instead.
382
+ *
383
+ * @public
384
+ */
385
+ declare interface JSXNode<T extends string | FunctionComponent | unknown = unknown> {
386
+ type: T;
387
+ props: T extends FunctionComponent<infer P> ? P : Record<any, unknown>;
388
+ children: JSXChildren | null;
389
+ key: string | null;
390
+ dev?: DevJSX;
391
+ }
392
+
393
+ declare const enum JSXNodeFlags {
394
+ None = 0,
395
+ StaticSubtree = 2,
396
+ HasCapturedProps = 4
397
+ }
398
+
399
+ declare class JSXNodeImpl<T = unknown> implements JSXNodeInternal_2<T> {
400
+ type: T;
401
+ children: JSXChildren;
402
+ flags: JSXNodeFlags;
403
+ toSort: boolean;
404
+ key: string | null;
405
+ varProps: Props;
406
+ constProps: Props | null;
407
+ dev?: DevJSX & {
408
+ stack: string | undefined;
409
+ };
410
+ _proxy: Props | null;
411
+ constructor(type: T, varProps: Props | null, constProps: Props | null, children: JSXChildren, flags: JSXNodeFlags, key: string | number | null | undefined, toSort?: boolean, dev?: DevJSX);
412
+ get props(): T extends FunctionComponent<infer PROPS> ? PROPS : Props;
413
+ }
414
+
415
+ /**
416
+ * The internal representation of a JSX Node.
417
+ *
418
+ * @internal
419
+ */
420
+ declare interface JSXNodeInternal_2<T extends string | FunctionComponent | unknown = unknown> extends JSXNode<T> {
421
+ /** The type of node */
422
+ type: T;
423
+ /** Do the varProps need sorting */
424
+ toSort: boolean;
425
+ /** The key property */
426
+ key: string | null;
427
+ /** Flags */
428
+ flags: JSXNodeFlags;
429
+ /**
430
+ * Props that are not guaranteed shallow equal across runs.
431
+ *
432
+ * Any prop that is in `constProps` takes precedence over `varProps`.
433
+ *
434
+ * Does not contain `children` or `key`.
435
+ *
436
+ * `onEvent$` props are normalized to the html `q-x:event` version
437
+ */
438
+ varProps: Props;
439
+ /**
440
+ * Props that will be shallow equal across runs. Does not contain any props that are in varProps.
441
+ *
442
+ * Any prop that is in `constProps` takes precedence over `varProps`.
443
+ *
444
+ * Does not contain `children` or `key`.
445
+ *
446
+ * `onEvent$` props are normalized to the html `q-x:event` version
447
+ */
448
+ constProps: Props | null;
449
+ /** The children of the node */
450
+ children: JSXChildren;
451
+ /** Filename etc for debugging */
452
+ dev?: DevJSX & {
453
+ stack: string | undefined;
454
+ };
455
+ }
456
+
457
+ /**
458
+ * Any valid output for a component
459
+ *
460
+ * @public
461
+ */
462
+ declare type JSXOutput_2 = JSXNode | string | number | boolean | null | undefined | JSXOutput_2[];
463
+
464
+ /**
465
+ * Shared lazy-loading reference that holds module loading metadata. Multiple QRLs pointing to the
466
+ * same chunk+symbol can share a single LazyRef, differing only in their captured scope.
467
+ */
468
+ declare class LazyRef<TYPE = unknown> {
469
+ readonly $chunk$: string | null;
470
+ readonly $symbol$: string;
471
+ readonly $symbolFn$: undefined | null | (() => Promise<Record<string, TYPE>>);
472
+ $ref$?: (null | ValueOrPromise<TYPE>) | undefined;
473
+ $container$: Container | undefined;
474
+ $hasMovedCaptures$?: boolean;
475
+ dev?: QRLDev | null | undefined;
476
+ qrls?: Set<any>;
477
+ constructor($chunk$: string | null, $symbol$: string, $symbolFn$: undefined | null | (() => Promise<Record<string, TYPE>>), $ref$?: (null | ValueOrPromise<TYPE>) | undefined, container?: Container | null);
478
+ /** We don't read hash very often so let's not allocate a string for every QRL */
479
+ get $hash$(): string;
480
+ $setRef$(ref: ValueOrPromise<TYPE>): void;
481
+ /** Load the raw module export without capture binding. */
482
+ $load$(): ValueOrPromise<TYPE>;
483
+ }
484
+
82
485
  /** @public */
83
486
  declare interface MockDocument extends Document {
84
487
  }
@@ -98,39 +501,613 @@ declare interface MockWindow extends Window {
98
501
  document: MockDocument;
99
502
  }
100
503
 
504
+ declare interface NodePropData {
505
+ $scopedStyleIdPrefix$: string | null;
506
+ $isConst$: boolean;
507
+ }
508
+
509
+ declare type ObjToProxyMap = WeakMap<any, any>;
510
+
511
+ /** @public */
512
+ export declare type OutOfOrderStreaming = boolean;
513
+
514
+ /** @internal */
515
+ declare const _OWNER: unique symbol;
516
+
517
+ declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof TaskEvent | typeof RenderEvent;
518
+
519
+ declare type Props = Record<string, unknown>;
520
+
521
+ /** @internal */
522
+ declare const _PROPS_HANDLER: unique symbol;
523
+
524
+ declare type PropsProxy = {
525
+ [_VAR_PROPS]: Props;
526
+ [_CONST_PROPS]: Props | null;
527
+ [_OWNER]: JSXNodeInternal_2;
528
+ [_PROPS_HANDLER]: PropsProxyHandler;
529
+ } & Record<string | symbol, unknown>;
530
+
531
+ declare class PropsProxyHandler implements ProxyHandler<any> {
532
+ owner: JSXNodeImpl;
533
+ $effects$: undefined | Map<string | symbol, Set<EffectSubscription>>;
534
+ $container$: Container | null;
535
+ constructor(owner: JSXNodeImpl);
536
+ get(_: any, prop: string | symbol): any;
537
+ set(_: any, prop: string | symbol, value: any): boolean;
538
+ deleteProperty(_: any, prop: string | symbol): boolean;
539
+ has(_: any, prop: string | symbol): boolean;
540
+ getOwnPropertyDescriptor(_: any, p: string | symbol): PropertyDescriptor | undefined;
541
+ ownKeys(): string[];
542
+ }
543
+
544
+ /**
545
+ * The `QRL` type represents a lazy-loadable AND serializable resource.
546
+ *
547
+ * QRL stands for Qwik URL.
548
+ *
549
+ * Use `QRL` when you want to refer to a lazy-loaded resource. `QRL`s are most often used for code
550
+ * (functions) but can also be used for other resources such as `string`s in the case of styles.
551
+ *
552
+ * `QRL` is an opaque token that is generated by the Qwik Optimizer. (Do not rely on any properties
553
+ * in `QRL` as it may change between versions.)
554
+ *
555
+ * ## Creating `QRL` references
556
+ *
557
+ * Creating `QRL` is done using `$(...)` function. `$(...)` is a special marker for the Qwik
558
+ * Optimizer that marks that the code should be extracted into a lazy-loaded symbol.
559
+ *
560
+ * ```tsx
561
+ * useOnDocument(
562
+ * 'mousemove',
563
+ * $((event) => console.log('mousemove', event))
564
+ * );
565
+ * ```
566
+ *
567
+ * In the above code, the Qwik Optimizer detects `$(...)` and transforms the code as shown below:
568
+ *
569
+ * ```tsx
570
+ * // FILE: <current file>
571
+ * useOnDocument('mousemove', qrl('./chunk-abc.js', 'onMousemove'));
572
+ *
573
+ * // FILE: chunk-abc.js
574
+ * export const onMousemove = () => console.log('mousemove');
575
+ * ```
576
+ *
577
+ * NOTE: `qrl(...)` is a result of Qwik Optimizer transformation. You should never have to invoke
578
+ * this function directly in your application. The `qrl(...)` function should be invoked only after
579
+ * the Qwik Optimizer transformation.
580
+ *
581
+ * ## Using `QRL`s
582
+ *
583
+ * Use `QRL` type in your application when you want to get a lazy-loadable reference to a resource
584
+ * (most likely a function).
585
+ *
586
+ * ```tsx
587
+ * // Example of declaring a custom functions which takes callback as QRL.
588
+ * export function useMyFunction(callback: QRL<() => void>) {
589
+ * doExtraStuff();
590
+ * // The callback passed to `onDocument` requires `QRL`.
591
+ * useOnDocument('mousemove', callback);
592
+ * }
593
+ * ```
594
+ *
595
+ * In the above example, the way to think about the code is that you are not asking for a callback
596
+ * function but rather a reference to a lazy-loadable callback function. Specifically, the function
597
+ * loading should be delayed until it is actually needed. In the above example, the function would
598
+ * not load until after a `mousemove` event on `document` fires.
599
+ *
600
+ * ## Resolving `QRL` references
601
+ *
602
+ * At times it may be necessary to resolve a `QRL` reference to the actual value. This can be
603
+ * performed using `QRL.resolve(..)` function.
604
+ *
605
+ * ```tsx
606
+ * // Assume you have QRL reference to a greet function
607
+ * const lazyGreet: QRL<() => void> = $(() => console.log('Hello World!'));
608
+ *
609
+ * // Use `qrlImport` to load / resolve the reference.
610
+ * const greet: () => void = await lazyGreet.resolve();
611
+ *
612
+ * // Invoke it
613
+ * greet();
614
+ * ```
615
+ *
616
+ * NOTE: `element` is needed because `QRL`s are relative and need a base location to resolve
617
+ * against. The base location is encoded in the HTML in the form of `<div q:base="/url">`.
618
+ *
619
+ * ## `QRL.resolved`
620
+ *
621
+ * Once `QRL.resolve()` returns, the value is stored under `QRL.resolved`. This allows the value to
622
+ * be used without having to await `QRL.resolve()` again.
623
+ *
624
+ * ## Question: Why not just use `import()`?
625
+ *
626
+ * At first glance, `QRL` serves the same purpose as `import()`. However, there are three subtle
627
+ * differences that need to be taken into account.
628
+ *
629
+ * 1. `QRL`s must be serializable into HTML.
630
+ * 2. `QRL`s must be resolved by framework relative to `q:base`.
631
+ * 3. `QRL`s must be able to capture lexically scoped variables.
632
+ * 4. `QRL`s encapsulate the difference between running with and without Qwik Optimizer.
633
+ * 5. `QRL`s allow expressing lazy-loaded boundaries without thinking about chunk and symbol names.
634
+ *
635
+ * Let's assume that you intend to write code such as this:
636
+ *
637
+ * ```tsx
638
+ * return <button onClick={() => (await import('./chunk-abc.js')).onClick}>
639
+ * ```
640
+ *
641
+ * The above code needs to be serialized into DOM such as:
642
+ *
643
+ * ```
644
+ * <div q:base="/build/">
645
+ * <button q-e:click="./chunk-abc.js#onClick">...</button>
646
+ * </div>
647
+ * ```
648
+ *
649
+ * 1. Notice there is no easy way to extract chunk (`./chunk-abc.js`) and symbol (`onClick`) into HTML.
650
+ * 2. Notice that even if you could extract it, the `import('./chunk-abc.js')` would become relative to
651
+ * where the `import()` file is declared. Because it is our framework doing the load, the
652
+ * `./chunk-abc.js` would become relative to the framework file. This is not correct, as it
653
+ * should be relative to the original file generated by the bundler.
654
+ * 3. Next, the framework needs to resolve the `./chunk-abc.js` and needs a base location that is
655
+ * encoded in the HTML.
656
+ * 4. The QRL needs to be able to capture lexically scoped variables. (`import()` only allows loading
657
+ * top-level symbols which don't capture variables.)
658
+ * 5. As a developer, you don't want to think about `import` and naming the chunks and symbols. You
659
+ * just want to say: "this should be lazy."
660
+ *
661
+ * These are the main reasons why Qwik introduces its own concept of `QRL`.
662
+ *
663
+ * @public
664
+ * @see `$`
665
+ */
666
+ declare type QRL<TYPE = unknown> = {
667
+ __qwik_serializable__?: any;
668
+ __brand__QRL__?: TYPE;
669
+ /** Resolve the QRL and return the actual value. */
670
+ resolve(): Promise<TYPE>;
671
+ /** The resolved value, once `resolve()` returns. */
672
+ resolved: undefined | TYPE;
673
+ getCaptured(): unknown[] | null;
674
+ getSymbol(): string;
675
+ getHash(): string;
676
+ dev?: QRLDev | null;
677
+ } & BivariantQrlFn<QrlArgs<TYPE>, QrlReturn<TYPE>>;
678
+
679
+ declare type QrlArgs<T> = T extends (...args: infer ARGS) => any ? ARGS : unknown[];
680
+
681
+ declare type QrlCaptures = Readonly<unknown[]> | string | null;
682
+
683
+ /** @public */
684
+ declare interface QRLDev {
685
+ file: string;
686
+ lo: number;
687
+ hi: number;
688
+ }
689
+
690
+ /** @internal */
691
+ declare type QRLInternal<TYPE = unknown> = QRL<TYPE> & QRLInternalMethods<TYPE>;
692
+
693
+ declare type QRLInternalMethods<TYPE> = {
694
+ readonly $chunk$: string | null;
695
+ readonly $symbol$: string;
696
+ readonly $hash$: string;
697
+ /** Captures are stored lazily after deserialization. */
698
+ readonly $captures$?: QrlCaptures;
699
+ readonly $hasMovedCaptures$?: boolean;
700
+ dev?: QRLDev | null;
701
+ resolve(container?: Container): Promise<TYPE>;
702
+ resolved: undefined | TYPE;
703
+ getSymbol(): string;
704
+ getHash(): string;
705
+ getCaptured(): unknown[] | null;
706
+ getFn(currentCtx?: InvokeContext,
707
+ /** If this returns false, the function execution will be skipped */
708
+ beforeFn?: () => void | false): TYPE extends (...args: any) => any ? (...args: Parameters<TYPE>) => ValueOrPromise<ReturnType<TYPE> | undefined> : unknown;
709
+ $callFn$(withThis: unknown, ...args: QrlArgs<TYPE>): ValueOrPromise<QrlReturn<TYPE>>;
710
+ $setDev$(dev: QRLDev | null): void;
711
+ /**
712
+ * "with captures" - Get a new QRL for these captures, reusing the lazy ref. It's an internal
713
+ * method but we need to have a stable name because it gets called in user code by the optimizer,
714
+ * after the $name$ props are mangled
715
+ */
716
+ w(captures: QrlCaptures): QRLInternal<TYPE>;
717
+ /** Mark that the handler receives captures moved to its element. */
718
+ m(): QRLInternal<TYPE>;
719
+ /**
720
+ * "set ref" - Set the ref of the QRL. It's an internal method but we need to have a stable name
721
+ * because it gets called in user code by the optimizer, after the $name$ props are mangled
722
+ */
723
+ s(ref: ValueOrPromise<TYPE>): void;
724
+ /**
725
+ * Needed for deserialization and importing. We don't always have the container while creating
726
+ * qrls in async sections of code
727
+ */
728
+ readonly $container$?: Container | null;
729
+ /** The shared lazy-loading reference */
730
+ readonly $lazy$: LazyRef<TYPE>;
731
+ };
732
+
733
+ declare type QrlReturn<T> = T extends (...args: any) => infer R ? Awaited<R> : unknown;
734
+
735
+ declare const RenderEvent = "qRender";
736
+
737
+ /** Stores the location of an object. If no parent, it's a root. */
738
+ declare type SeenRef = {
739
+ $index$: number;
740
+ $parent$?: SeenRef | null;
741
+ };
742
+
743
+ declare interface SerializationContext {
744
+ $serialize$: () => ValueOrPromise<void>;
745
+ $serializePatch$: (rootStart: number, rootIds: number[], extraRootId?: number | string | number[], streamedRootLimit?: number) => ValueOrPromise<void>;
746
+ $symbolToChunkResolver$: SymbolToChunkResolver;
747
+ /**
748
+ * Map from object to parent and index reference.
749
+ *
750
+ * If object is found in `objMap` will return the parent reference and index path.
751
+ *
752
+ * `objMap` return:
753
+ *
754
+ * - `{ parent, index }` - The parent object and the index within that parent.
755
+ * - `undefined` - Object has not been seen yet.
756
+ */
757
+ getSeenRef: (obj: unknown) => SeenRef | undefined;
758
+ /** Returns the root index of the object, if it is a root. Otherwise returns undefined. */
759
+ $hasRootId$: (obj: unknown) => number | undefined;
760
+ /**
761
+ * Root objects which need to be serialized.
762
+ *
763
+ * Roots are entry points into the object graph. Typically the roots are held by the listeners.
764
+ *
765
+ * Returns the index of the root object.
766
+ */
767
+ $addRoot$: AddRootFn;
768
+ $addDuplicateRoot$: (obj: unknown) => SeenRef;
769
+ $commitRoot$: (root: unknown, obj: unknown) => number;
770
+ /** Mark an object as seen during serialization. This is used to handle backreferences and cycles */
771
+ $markSeen$: (obj: unknown, parent: SeenRef | undefined, index: number) => SeenRef;
772
+ $roots$: unknown[];
773
+ $rootObjs$: unknown[];
774
+ $onAddRoot$?: (id: number, root: unknown, obj: unknown) => void;
775
+ $forwardRefOffset$: number;
776
+ $serializedRootCount$: number;
777
+ $serializedForwardRefCount$: number;
778
+ $rootStateRootCount$: number;
779
+ $hasRootStateForwardRefs$: boolean;
780
+ $promoteToRoot$: (ref: SeenRef, obj: unknown, index?: number) => void;
781
+ $addSyncFn$($funcStr$: string | null, argsCount: number, fn: Function): number;
782
+ $setSyncFnOffset$(offset: number, existingFns?: string[]): void;
783
+ $isSsrNode$: (obj: unknown) => obj is ISsrNode;
784
+ $isDomRef$: (obj: unknown) => obj is DomRef;
785
+ $markSsrNodeForSerialization$: (node: ISsrNode, flags: number) => void;
786
+ $writer$: SSRInternalStreamWriter;
787
+ $setWriter$(writer: SSRInternalStreamWriter): void;
788
+ $syncFns$: string[];
789
+ $eventQrls$: Set<QRL>;
790
+ $eventNames$: Set<string>;
791
+ $renderSymbols$: Set<string>;
792
+ $storeProxyMap$: ObjToProxyMap;
793
+ $eagerResume$: Set<unknown>;
794
+ $setProp$: (obj: any, prop: string, value: any) => void;
795
+ }
796
+
797
+ declare const enum SerializationSignalFlags {
798
+ SERIALIZATION_STRATEGY_NEVER = 8,
799
+ SERIALIZATION_STRATEGY_ALWAYS = 16,
800
+ SERIALIZATION_ALL_STRATEGIES = 24
801
+ }
802
+
803
+ /**
804
+ * A signal is a reactive value which can be read and written. When the signal is written, all tasks
805
+ * which are tracking the signal will be re-run and all components that read the signal will be
806
+ * re-rendered.
807
+ *
808
+ * Furthermore, when a signal value is passed as a prop to a component, the optimizer will
809
+ * automatically forward the signal. This means that `return <div title={signal.value}>hi</div>`
810
+ * will update the `title` attribute when the signal changes without having to re-render the
811
+ * component.
812
+ *
813
+ * @public
814
+ */
815
+ declare interface Signal<T = any> {
816
+ /** Reading from this subscribes to updates; writing to this triggers updates. */
817
+ value: T;
818
+ /** Reading from this does not subscribe to updates; writing to this does not trigger updates. */
819
+ untrackedValue: T;
820
+ /**
821
+ * Use this to trigger running subscribers, for example when the value mutated but remained the
822
+ * same object.
823
+ */
824
+ trigger(): void;
825
+ }
826
+
827
+ declare class SignalImpl<T = any> implements Signal<T> {
828
+ $untrackedValue$: T;
829
+ /** Store a list of effects which are dependent on this signal. */
830
+ $effects$: undefined | Set<EffectSubscription>;
831
+ $container$: Container | null;
832
+ $wrappedSignal$: WrappedSignalImpl<T> | null;
833
+ constructor(container: Container | null | undefined, value: T);
834
+ /**
835
+ * Use this to trigger running subscribers, for example when the calculated value has mutated but
836
+ * remained the same object
837
+ */
838
+ trigger(): void;
839
+ /** @deprecated Use `trigger()` instead */
840
+ force(): void;
841
+ get untrackedValue(): T;
842
+ set untrackedValue(value: T);
843
+ get value(): T;
844
+ set value(value: T);
845
+ valueOf(): void;
846
+ toString(): string;
847
+ toJSON(): {
848
+ value: T;
849
+ };
850
+ }
851
+
852
+ declare interface SimplifiedServerRequestEvent<T = unknown> {
853
+ url: URL;
854
+ locale: string | undefined;
855
+ request: Request;
856
+ }
857
+
858
+ /** @internal */
859
+ declare interface SSRInternalStreamWriter extends StreamWriter_2 {
860
+ writeRootRef(id: number): ValueOrPromise<void>;
861
+ writeRootRefPath(path: number[]): ValueOrPromise<void>;
862
+ writeRootRefDelta(id: number, base: number): ValueOrPromise<void>;
863
+ toString(remap?: number[]): string;
864
+ }
865
+
866
+ declare const enum SsrNodeFlags {
867
+ Updatable = 1,
868
+ WarnedStreamedChore = 2
869
+ }
870
+
101
871
  /** @public */
102
872
  export declare function ssrRenderToDom(jsx: JSXOutput, opts?: {
873
+ /** Print debug information to console. */
103
874
  debug?: boolean;
875
+ /** Treat JSX as raw, (don't wrap in in head/body) */
104
876
  raw?: boolean;
877
+ /** Include QwikLoader */
878
+ qwikLoader?: boolean;
879
+ /** Override the SSR container tag name. */
880
+ containerTagName?: string;
881
+ /** Root-count threshold for eager yielded state prewarm during client resume. */
882
+ statePrewarm?: number | false;
883
+ /** Stream rendered chunks while still collecting the final HTML. */
884
+ stream?: StreamWriter;
885
+ /** Configure SSR streaming. */
886
+ streaming?: StreamingOptions;
887
+ /** Skip client resume emulation after SSR. */
888
+ resume?: boolean;
889
+ /** Inject nodes into the document before test runs (for testing purposes) */
890
+ onBeforeResume?: (document: Document) => void;
105
891
  }): Promise<{
106
892
  container: _DomContainer;
107
893
  document: Document;
108
- vNode: _VirtualVNode | null;
894
+ vNode: _VNode | null;
109
895
  getStyles: () => Record<string, string | string[]>;
110
896
  }>;
111
897
 
898
+ declare type StoreTarget = Record<string | symbol, any>;
899
+
900
+ /** @public */
901
+ export declare interface StreamingOptions {
902
+ inOrder?: InOrderStreaming;
903
+ outOfOrder?: OutOfOrderStreaming;
904
+ }
905
+
906
+ /** @internal */
907
+ declare interface StreamWriter_2 {
908
+ write(chunk: string): ValueOrPromise<void>;
909
+ waitForDrain?(): ValueOrPromise<void>;
910
+ }
911
+
912
+ /** @internal */
913
+ declare class SubscriptionData {
914
+ data: NodePropData;
915
+ constructor(data: NodePropData);
916
+ }
917
+
918
+ declare type SymbolToChunkResolver = (symbol: string) => string;
919
+
920
+ /** @internal */
921
+ declare class Task<T = unknown, B = T> extends BackRef {
922
+ $flags$: TaskFlags;
923
+ $index$: number;
924
+ $el$: HostElement;
925
+ $qrl$: QRLInternal<T>;
926
+ $destroy$: (() => void) | null;
927
+ $destroyPromise$: Promise<void> | undefined;
928
+ $taskPromise$: Promise<void> | null;
929
+ constructor($flags$: TaskFlags, $index$: number, $el$: HostElement, $qrl$: QRLInternal<T>, $destroy$: (() => void) | null);
930
+ }
931
+
932
+ declare const TaskEvent = "qTask";
933
+
934
+ /** @internal */
935
+ declare const enum TaskFlags {
936
+ VISIBLE_TASK = 1,
937
+ TASK = 2,
938
+ DIRTY = 4,
939
+ RENDER_BLOCKING = 8,
940
+ NEEDS_CLEANUP = 16,
941
+ EVENTS_REGISTERED = 32
942
+ }
943
+
112
944
  /** @public */
113
945
  declare interface TestPlatform extends CorePlatform {
946
+ /**
947
+ * @deprecated No longer used, please use {@link waitForDrain} instead.
948
+ * @example With `ssrRenderToDom`
949
+ *
950
+ * ```ts
951
+ * import { waitForDrain } from '@qwik.dev/testing';
952
+ *
953
+ * const { container } = ssrRenderToDom(...);
954
+ * await waitForDrain(container);
955
+ * ```
956
+ *
957
+ * @example With `domRender`
958
+ *
959
+ * ```ts
960
+ * import { waitForDrain } from '@qwik.dev/testing';
961
+ *
962
+ * const { container } = domRender(...);
963
+ * await waitForDrain(container);
964
+ * ```
965
+ */
114
966
  flush: () => Promise<void>;
115
967
  }
116
968
 
117
969
  /**
118
- * Trigger an event in unit tests on an element.
970
+ * Trigger an event in unit tests on an element. Needs to be kept in sync with the Qwik Loader event
971
+ * dispatching.
972
+ *
973
+ * Events can be either case sensitive element-scoped events or scoped kebab-case.
119
974
  *
120
975
  * Future deprecation candidate.
121
976
  *
122
977
  * @public
123
978
  */
124
- export declare function trigger(root: Element, queryOrElement: string | Element | keyof HTMLElementTagNameMap | null, eventName: string, eventPayload?: any): Promise<void>;
979
+ export declare function trigger(root: Element, queryOrElement: string | Element | keyof HTMLElementTagNameMap | null, eventName: string, eventPayload?: any, options?: {
980
+ waitForIdle?: boolean;
981
+ }): Promise<Event | null>;
982
+
983
+ /**
984
+ * Type representing a value which is either resolve or a promise.
985
+ *
986
+ * @public
987
+ */
988
+ declare type ValueOrPromise<T> = T | Promise<T>;
989
+
990
+ /** @internal */
991
+ declare const _VAR_PROPS: unique symbol;
992
+
993
+ /** @internal */
994
+ declare abstract class VNode implements BackRef {
995
+ flags: VNodeFlags;
996
+ parent: VNode | null;
997
+ previousSibling: VNode | null | undefined;
998
+ nextSibling: VNode | null | undefined;
999
+ props: Props | null;
1000
+ [_EFFECT_BACK_REF]: Map<any, any> | undefined;
1001
+ slotParent: VNode | null;
1002
+ dirty: ChoreBits;
1003
+ dirtyChildren: VNode[] | null;
1004
+ nextDirtyChildIndex: number;
1005
+ constructor(flags: VNodeFlags, parent: VNode | null, previousSibling: VNode | null | undefined, nextSibling: VNode | null | undefined, props: Props | null);
1006
+ toString(): string;
1007
+ }
125
1008
 
126
1009
  /** @public */
127
1010
  export declare function vnode_fromJSX(jsx: JSXOutput): {
128
- vParent: _ElementVNode;
1011
+ vParent: _ElementVNode | _VirtualVNode;
129
1012
  vNode: _VNode | null;
130
1013
  document: _QDocument;
131
- container: ClientContainer;
1014
+ container: ClientContainer_2;
132
1015
  };
133
1016
 
1017
+ /**
1018
+ * Array of numbers which describes virtual nodes in the tree.
1019
+ *
1020
+ * HTML can't account for:
1021
+ *
1022
+ * - Multiple text nodes in a row. (it treats it as a single text node)
1023
+ * - Empty text nodes. (it ignores them)
1024
+ * - And virtual nodes such as `<Fragment/>` or `<MyComponent/>`
1025
+ *
1026
+ * So we need to encode all of that information into the VNodeData.
1027
+ *
1028
+ * Encoding:
1029
+ *
1030
+ * - First position is special and encodes state information and stores VNodeDataFlag.
1031
+ * - Positive numbers are text node lengths. (0 is a special case for empty text node)
1032
+ * - Negative numbers are element counts.
1033
+ * - `OPEN_FRAGMENT` is start of virtual node.
1034
+ *
1035
+ * - If `OPEN_FRAGMENT` than the previous node is an `Array` which contains the props (see
1036
+ * `SsrAttrs`). NOTE: The array is never going to be the last item in the VNodeData, so we can
1037
+ * always assume that the last item in `vNodeData` is a number.
1038
+ * - `CLOSE_FRAGMENT` is end of virtual node.
1039
+ *
1040
+ * NOTE: This is how we store the information during the SSR streaming, once the SSR is complete
1041
+ * this data needs to be serialized into a string and stored in the DOM as a script tag which has
1042
+ * deferent serialization format.
1043
+ */
1044
+ declare type VNodeData = [VNodeDataFlag, ...(Props | number)[]];
1045
+
1046
+ /**
1047
+ * Flags for VNodeData (Flags con be bitwise combined)
1048
+ *
1049
+ * @internal
1050
+ */
1051
+ declare const enum VNodeDataFlag {
1052
+ NONE = 0,
1053
+ TEXT_DATA = 1,
1054
+ VIRTUAL_NODE = 2,
1055
+ ELEMENT_NODE = 4,
1056
+ REFERENCE = 8,
1057
+ SERIALIZE = 16
1058
+ }
1059
+
1060
+ /**
1061
+ * Flags for VNode.
1062
+ *
1063
+ * # Materialize vs Inflation
1064
+ *
1065
+ * - Materialized: The node has all of its children. Specifically `firstChild`/`lastChild` are NOT
1066
+ * `undefined`. Materialization creates lazy instantiation of the children. NOTE: Only
1067
+ * ElementVNode need to be materialized.
1068
+ * - Inflation:
1069
+ *
1070
+ * - If Text: It means that it is safe to write to the node. When Text nodes are first Deserialized
1071
+ * multiple text nodes can share the same DOM node. On write the sibling text nodes need to be
1072
+ * converted into separate text nodes.
1073
+ * - If Element: It means that the element tag attributes have not yet been read from the DOM.
1074
+ *
1075
+ * Inflation and materialization are not the same, they are two independent things.
1076
+ *
1077
+ * @internal
1078
+ */
1079
+ declare const enum VNodeFlags {
1080
+ Element = 1,
1081
+ Virtual = 2,
1082
+ ELEMENT_OR_VIRTUAL_MASK = 3,
1083
+ Text = 4,
1084
+ ELEMENT_OR_TEXT_MASK = 5,
1085
+ TYPE_MASK = 7,
1086
+ INFLATED_TYPE_MASK = 15,
1087
+ Inflated = 8,
1088
+ Resolved = 16,
1089
+ Deleted = 32,
1090
+ HasIterationItems = 64,
1091
+ InflatedIterationItems = 128,
1092
+ Cursor = 256,
1093
+ NAMESPACE_MASK = 1536,
1094
+ NEGATED_NAMESPACE_MASK = -1537,
1095
+ NS_html = 0,// http://www.w3.org/1999/xhtml
1096
+ NS_svg = 512,// http://www.w3.org/2000/svg
1097
+ NS_math = 1024,// http://www.w3.org/1998/Math/MathML
1098
+ HasTargetElement = 2048
1099
+ }
1100
+
1101
+ /**
1102
+ * Wait for the scheduler to drain.
1103
+ *
1104
+ * This is useful when testing async code.
1105
+ *
1106
+ * @param container - The application container.
1107
+ * @public
1108
+ */
1109
+ export declare function waitForDrain(container: Container): Promise<void>;
1110
+
134
1111
  /** @public */
135
1112
  export declare function walkJSX(jsx: JSXOutput, apply: {
136
1113
  enter: (jsx: JSXNodeInternal) => void;
@@ -138,4 +1115,20 @@ export declare function walkJSX(jsx: JSXOutput, apply: {
138
1115
  text: (text: _Stringifiable) => void;
139
1116
  }): void;
140
1117
 
1118
+ declare class WrappedSignalImpl<T> extends SignalImpl<T> {
1119
+ $args$: any[];
1120
+ $func$: (...args: any[]) => T;
1121
+ $funcStr$: string | null;
1122
+ $flags$: AllSignalFlags;
1123
+ $hostElement$: HostElement | undefined;
1124
+ [_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
1125
+ constructor(container: Container | null, fn: (...args: any[]) => T, args: any[], fnStr: string | null, flags?: AllSignalFlags);
1126
+ invalidate(): void;
1127
+ get untrackedValue(): T;
1128
+ $computeIfNeeded$(): void;
1129
+ $unwrapIfSignal$(): SignalImpl<T> | WrappedSignalImpl<T>;
1130
+ set value(_: any);
1131
+ get value(): any;
1132
+ }
1133
+
141
1134
  export { }