@qwik.dev/core 2.0.0-beta.3 → 2.0.0-beta.31

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 (139) 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 +39 -0
  5. package/dist/backpatch-executor.js +1 -0
  6. package/dist/build/package.json +1 -1
  7. package/dist/cli.mjs +12961 -0
  8. package/dist/core-internal.d.ts +1117 -707
  9. package/dist/core.min.mjs +2 -1
  10. package/dist/core.mjs +12216 -8953
  11. package/dist/core.mjs.map +1 -1
  12. package/dist/core.prod.mjs +8677 -5376
  13. package/dist/insights/index.qwik.mjs +80 -57
  14. package/dist/insights/vite/index.mjs +36 -33
  15. package/dist/loader/index.mjs +2 -2
  16. package/dist/loader/package.json +1 -1
  17. package/dist/optimizer.d.ts +47 -278
  18. package/dist/optimizer.mjs +2427 -3791
  19. package/dist/preloader.mjs +212 -117
  20. package/dist/qwikloader.debug.js +173 -135
  21. package/dist/qwikloader.js +1 -1
  22. package/dist/server.d.ts +51 -203
  23. package/dist/server.mjs +1661 -1157
  24. package/dist/server.prod.mjs +3452 -0
  25. package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/{vite.config.mts → vite.config.ts} +2 -2
  26. package/dist/starters/adapters/aws-lambda/package.json +3 -2
  27. package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +2 -6
  28. package/dist/starters/adapters/azure-swa/adapters/azure-swa/{vite.config.mts → vite.config.ts} +2 -2
  29. package/dist/starters/adapters/azure-swa/package.json +3 -2
  30. package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +2 -3
  31. package/dist/starters/adapters/bun/adapters/bun/{vite.config.mts → vite.config.ts} +3 -3
  32. package/dist/starters/adapters/bun/package.json +3 -2
  33. package/dist/starters/adapters/bun/src/entry.bun.ts +0 -2
  34. package/dist/starters/adapters/cloud-run/adapters/cloud-run/{vite.config.mts → vite.config.ts} +2 -2
  35. package/dist/starters/adapters/cloud-run/package.json +3 -2
  36. package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +1 -3
  37. package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/{vite.config.mts → vite.config.ts} +2 -2
  38. package/dist/starters/adapters/cloudflare-pages/package.json +3 -2
  39. package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +2 -3
  40. package/dist/starters/adapters/cloudflare-workers/README.md +52 -0
  41. package/dist/starters/adapters/cloudflare-workers/adapters/cloudflare-workers/vite.config.ts +15 -0
  42. package/dist/starters/adapters/cloudflare-workers/gitignore +3 -0
  43. package/dist/starters/adapters/cloudflare-workers/package.json +31 -0
  44. package/dist/starters/adapters/cloudflare-workers/public/.assetsignore +4 -0
  45. package/dist/starters/adapters/cloudflare-workers/public/_headers +11 -0
  46. package/dist/starters/adapters/cloudflare-workers/public/_redirects +1 -0
  47. package/dist/starters/adapters/cloudflare-workers/src/entry.cloudflare-pages.tsx +23 -0
  48. package/dist/starters/adapters/cloudflare-workers/worker-configuration.d.ts +5 -0
  49. package/dist/starters/adapters/cloudflare-workers/wrangler.jsonc +41 -0
  50. package/dist/starters/adapters/deno/adapters/deno/{vite.config.mts → vite.config.ts} +2 -2
  51. package/dist/starters/adapters/deno/package.json +3 -2
  52. package/dist/starters/adapters/deno/src/entry.deno.ts +0 -2
  53. package/dist/starters/adapters/express/adapters/express/{vite.config.mts → vite.config.ts} +2 -2
  54. package/dist/starters/adapters/express/package.json +4 -3
  55. package/dist/starters/adapters/express/src/entry.express.tsx +1 -3
  56. package/dist/starters/adapters/fastify/adapters/fastify/{vite.config.mts → vite.config.ts} +2 -2
  57. package/dist/starters/adapters/fastify/package.json +4 -3
  58. package/dist/starters/adapters/fastify/src/entry.fastify.tsx +1 -1
  59. package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +1 -2
  60. package/dist/starters/adapters/firebase/adapters/firebase/{vite.config.mts → vite.config.ts} +2 -2
  61. package/dist/starters/adapters/firebase/package.json +3 -2
  62. package/dist/starters/adapters/firebase/src/entry-firebase.tsx +2 -3
  63. package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/{vite.config.mts → vite.config.ts} +2 -2
  64. package/dist/starters/adapters/netlify-edge/package.json +5 -4
  65. package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +2 -3
  66. package/dist/starters/adapters/node-server/adapters/node-server/{vite.config.mts → vite.config.ts} +2 -2
  67. package/dist/starters/adapters/node-server/package.json +3 -2
  68. package/dist/starters/adapters/node-server/src/entry.node-server.tsx +0 -2
  69. package/dist/starters/adapters/{static/adapters/static/vite.config.mts → ssg/adapters/ssg/vite.config.ts} +3 -3
  70. package/dist/starters/adapters/ssg/package.json +20 -0
  71. package/dist/starters/adapters/vercel-edge/README.md +2 -2
  72. package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/{vite.config.mts → vite.config.ts} +2 -2
  73. package/dist/starters/adapters/vercel-edge/package.json +3 -2
  74. package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +2 -3
  75. package/dist/starters/adapters/vercel-edge/vercel.json +1 -1
  76. package/dist/starters/features/auth/package.json +1 -1
  77. package/dist/starters/features/compiled-i18n/package.json +37 -0
  78. package/dist/starters/features/compiled-i18n/src/components/locale-selector/locale-selector.tsx +30 -0
  79. package/dist/starters/features/compiled-i18n/src/entry.ssr.tsx +31 -0
  80. package/dist/starters/features/compiled-i18n/src/routes/plugin@compiled-i18n.ts +28 -0
  81. package/dist/starters/features/csr/index.html +27 -0
  82. package/dist/starters/features/csr/package.json +29 -0
  83. package/dist/starters/features/csr/src/root.tsx +15 -0
  84. package/dist/starters/features/csr/vite.config.ts +13 -0
  85. package/dist/starters/features/cypress/src/actions/example.action.ts +5 -0
  86. package/dist/starters/features/cypress/src/components/example/example.cy.tsx +50 -8
  87. package/dist/starters/features/cypress/src/components/example/example.tsx +13 -3
  88. package/dist/starters/features/cypress/src/loaders/example.loader.ts +5 -0
  89. package/dist/starters/features/pandacss/package.json +1 -1
  90. package/dist/starters/features/postcss/postcss.config.js +1 -1
  91. package/dist/starters/features/storybook/.storybook/tsconfig.json +0 -1
  92. package/dist/starters/features/styled-vanilla-extract/package.json +2 -1
  93. package/dist/starters/features/tailwind/package.json +2 -2
  94. package/dist/starters/features/tailwind/prettier.config.js +10 -0
  95. package/dist/starters/features/tailwind-v3/package.json +1 -1
  96. package/dist/starters/features/tailwind-v3/prettier.config.js +10 -0
  97. package/dist/testing/index.d.ts +928 -6
  98. package/dist/testing/index.mjs +16212 -11578
  99. package/dist/testing/package.json +1 -1
  100. package/handlers.mjs +1 -1
  101. package/package.json +34 -56
  102. package/public.d.ts +5 -1
  103. package/{qwik-cli.cjs → qwik-cli.mjs} +1 -1
  104. package/server.d.ts +2 -0
  105. package/bindings/qwik.darwin-arm64.node +0 -0
  106. package/bindings/qwik.darwin-x64.node +0 -0
  107. package/bindings/qwik.linux-x64-gnu.node +0 -0
  108. package/bindings/qwik.wasm.cjs +0 -471
  109. package/bindings/qwik.wasm.mjs +0 -464
  110. package/bindings/qwik.win32-x64-msvc.node +0 -0
  111. package/bindings/qwik_wasm_bg.wasm +0 -0
  112. package/dist/build/index.cjs +0 -35
  113. package/dist/build/index.cjs.map +0 -7
  114. package/dist/build/index.dev.cjs +0 -37
  115. package/dist/build/index.dev.cjs.map +0 -7
  116. package/dist/build/index.prod.cjs +0 -37
  117. package/dist/build/index.prod.cjs.map +0 -7
  118. package/dist/cli.cjs +0 -5545
  119. package/dist/core.cjs +0 -11800
  120. package/dist/core.cjs.map +0 -1
  121. package/dist/core.prod.cjs +0 -5661
  122. package/dist/insights/index.qwik.cjs +0 -1
  123. package/dist/insights/vite/index.cjs +0 -1
  124. package/dist/loader/index.cjs +0 -4
  125. package/dist/optimizer.cjs +0 -4020
  126. package/dist/preloader.cjs +0 -269
  127. package/dist/server.cjs +0 -3037
  128. package/dist/starters/adapters/static/package.json +0 -19
  129. package/dist/starters/features/localize/package.json +0 -37
  130. package/dist/starters/features/localize/src/entry.ssr.tsx +0 -30
  131. package/dist/starters/features/localize/src/locales/message.en.json +0 -8
  132. package/dist/starters/features/localize/src/locales/message.it.json +0 -8
  133. package/dist/starters/features/localize/src/routes/[locale]/i18n-utils.ts +0 -94
  134. package/dist/starters/features/localize/src/routes/[locale]/index.tsx +0 -52
  135. package/dist/starters/features/localize/src/routes/[locale]/layout.tsx +0 -12
  136. package/dist/starters/features/playwright/playwright-report/index.html +0 -22026
  137. package/dist/starters/features/tailwind/.prettierrc.js +0 -3
  138. package/dist/testing/index.cjs +0 -33331
  139. /package/dist/starters/adapters/{static → ssg}/README.md +0 -0
@@ -1,11 +1,8 @@
1
- import * as CSS_2 from 'csstype';
1
+ import type * as CSS_2 from 'csstype';
2
2
  import { isBrowser } from './build';
3
3
  import { isDev } from './build';
4
4
  import { isServer } from './build';
5
- import { QRL as QRL_2 } from './qrl.public';
6
- import { ReadonlySignal as ReadonlySignal_2 } from '..';
7
- import type { StreamWriter as StreamWriter_2 } from '.';
8
- import { ValueOrPromise as ValueOrPromise_2 } from '..';
5
+ import { ResolvedManifest } from './optimizer';
9
6
 
10
7
  /**
11
8
  * Qwik Optimizer marker function.
@@ -83,23 +80,33 @@ import { ValueOrPromise as ValueOrPromise_2 } from '..';
83
80
  */
84
81
  export declare const $: <T>(expression: T) => QRL<T>;
85
82
 
83
+ /**
84
+ * Register an external projection on a parent component VNode.
85
+ *
86
+ * Creates a new VirtualVNode that will render the given component QRL with the given props. The
87
+ * VNode is stored as a projection on the parent, and a low-priority cursor is added so the cursor
88
+ * walker will process it.
89
+ *
90
+ * Use `_setProjectionTarget` to set the DOM target element before the cursor fires.
91
+ *
92
+ * @internal
93
+ */
94
+ export declare function _addProjection(container: _Container, parentVNode: _VirtualVNode, componentQRL: QRL<any>, props: Record<string, unknown>, slotName: string): _VirtualVNode;
95
+
96
+ declare interface AddRootFn {
97
+ (obj: unknown, returnRef?: never): number;
98
+ (obj: unknown, returnRef: true): SeenRef;
99
+ }
100
+
86
101
  declare type AllEventKeys = keyof AllEventsMap;
87
102
 
88
- declare type AllEventMapRaw = HTMLElementEventMap & DocumentEventMap & WindowEventHandlersEventMap & {
89
- qidle: QwikIdleEvent;
90
- qinit: QwikInitEvent;
91
- qsymbol: QwikSymbolEvent;
92
- qvisible: QwikVisibleEvent;
93
- qviewtransition: QwikViewTransitionEvent;
94
- };
103
+ declare type AllEventMapRaw = QwikHTMLElementEventMap & QwikDocumentEventMap & QwikWindowEventMap;
95
104
 
96
105
  declare type AllEventsMap = Omit<AllEventMapRaw, keyof EventCorrectionMap> & EventCorrectionMap;
97
106
 
98
107
  declare type _AllowPlainQrl<Q> = QRLEventHandlerMulti<any, any> extends Q ? Q extends QRLEventHandlerMulti<infer EV, infer EL> ? Q | (EL extends Element ? EventHandler<EV, EL> : never) : Q : Q extends QRL<infer U> ? Q | U : NonNullable<Q> extends never ? Q : QRL<Q> | Q;
99
108
 
100
- declare type AllPascalEventMaps = PascalMap<AllEventsMap>;
101
-
102
- declare type AllSignalFlags = SignalFlags | WrappedSignalFlags;
109
+ declare type AllSignalFlags = SignalFlags | WrappedSignalFlags | SerializationSignalFlags | AsyncSignalFlags;
103
110
 
104
111
  /**
105
112
  * TS defines these with the React syntax which is not compatible with Qwik. E.g. `ariaAtomic`
@@ -357,22 +364,248 @@ declare interface AriaAttributes {
357
364
  /** @public */
358
365
  declare type AriaRole = 'alert' | 'alertdialog' | 'application' | 'article' | 'banner' | 'button' | 'cell' | 'checkbox' | 'columnheader' | 'combobox' | 'complementary' | 'contentinfo' | 'definition' | 'dialog' | 'directory' | 'document' | 'feed' | 'figure' | 'form' | 'grid' | 'gridcell' | 'group' | 'heading' | 'img' | 'link' | 'list' | 'listbox' | 'listitem' | 'log' | 'main' | 'marquee' | 'math' | 'menu' | 'menubar' | 'menuitem' | 'menuitemcheckbox' | 'menuitemradio' | 'navigation' | 'none' | 'note' | 'option' | 'presentation' | 'progressbar' | 'radio' | 'radiogroup' | 'region' | 'row' | 'rowgroup' | 'rowheader' | 'scrollbar' | 'search' | 'searchbox' | 'separator' | 'slider' | 'spinbutton' | 'status' | 'switch' | 'tab' | 'table' | 'tablist' | 'tabpanel' | 'term' | 'textbox' | 'timer' | 'toolbar' | 'tooltip' | 'tree' | 'treegrid' | 'treeitem' | (string & {});
359
366
 
360
- declare type AsyncComputedCtx = {
367
+ declare type AsyncCtx<T = unknown> = {
361
368
  track: Tracker;
362
- cleanup: (callback: () => void) => void;
369
+ /**
370
+ * Register a cleanup callback to be called when the async computation is aborted or completed.
371
+ * The next invocation will await the previous cleanup. If you do not want this, do not return a
372
+ * Promise.
373
+ */
374
+ cleanup: (callback: () => void | Promise<void>) => void;
375
+ /**
376
+ * A lazily created AbortSignal, for interrupting the async computation when needed, e.g. when the
377
+ * component is unmounted or the computation is invalidated. Pass it to `fetch` or other APIs that
378
+ * support it to ensure that unnecessary work is not performed.
379
+ */
380
+ readonly abortSignal: AbortSignal;
381
+ /** The result of the previous computation, if any */
382
+ readonly previous: T | undefined;
383
+ /** Extra info passed to `invalidate(info)` for this computation, if any. */
384
+ readonly info: unknown;
363
385
  };
364
386
 
365
- /** @public */
366
- export declare type AsyncComputedFn<T> = (ctx: AsyncComputedCtx) => Promise<T>;
387
+ /**
388
+ * Note, we don't pass the generic type to AsyncCtx because it causes TypeScript to not infer the
389
+ * type of the resource correctly. The type is only used for the `previous` property, which is not
390
+ * commonly used, and can be easily cast if needed.
391
+ *
392
+ * @public
393
+ */
394
+ export declare type AsyncFn<T> = (ctx: AsyncCtx) => ValueOrPromise<T>;
395
+
396
+ /** Retains job metadata and also serves as the argument for the compute function */
397
+ declare class AsyncJob<T> implements AsyncCtx<T> {
398
+ readonly $signal$: AsyncSignalImpl<T>;
399
+ readonly info: unknown;
400
+ readonly $infoVersion$: number;
401
+ /** First holds the compute promise and then the cleanup promise */
402
+ $promise$: Promise<void> | null;
403
+ $cleanupRequested$: boolean;
404
+ $canWrite$: boolean;
405
+ $track$: AsyncCtx<T>['track'] | undefined;
406
+ $cleanups$: Parameters<AsyncCtx<T>['cleanup']>[0][] | undefined;
407
+ $abortController$: AbortController | undefined;
408
+ constructor($signal$: AsyncSignalImpl<T>, info: unknown, $infoVersion$: number);
409
+ get track(): AsyncCtx<T>['track'];
410
+ get abortSignal(): AbortSignal;
411
+ /** Backward compatible cache method for resource */
412
+ cache(): void;
413
+ get previous(): T | undefined;
414
+ cleanup(callback: () => void): void;
415
+ }
367
416
 
368
- /** @public */
369
- export declare interface AsyncComputedReadonlySignal<T = unknown> extends ReadonlySignal<T> {
417
+ declare type AsyncQRL<T> = _QRLInternal<AsyncFn<T>>;
418
+
419
+ /**
420
+ * An AsyncSignal holds the result of the given async function. If the function uses `track()` to
421
+ * track reactive state, and that state changes, the AsyncSignal is recalculated, and if the result
422
+ * changed, all tasks which are tracking the AsyncSignal will be re-run and all subscribers
423
+ * (components, tasks etc) that read the AsyncSignal will be updated.
424
+ *
425
+ * If the async function throws an error, the AsyncSignal will capture the error and set the `error`
426
+ * property. The error can be cleared by re-running the async function successfully.
427
+ *
428
+ * While the async function is running, the `.loading` property will be set to `true`. Once the
429
+ * function completes, `loading` will be set to `false`.
430
+ *
431
+ * If the value has not yet been resolved, reading the AsyncSignal will throw a Promise, which will
432
+ * retry the component or task once the value resolves.
433
+ *
434
+ * If the value has been resolved, but the async function is re-running, reading the AsyncSignal
435
+ * will subscribe to it and return the last resolved value until the new value is ready. As soon as
436
+ * the new value is ready, the subscribers will be updated.
437
+ *
438
+ * If the async function threw an error, reading the `.value` will throw that same error. Read from
439
+ * `.error` to check if there was an error.
440
+ *
441
+ * @public
442
+ */
443
+ export declare interface AsyncSignal<T = unknown> extends ComputedSignal<T> {
444
+ /**
445
+ * Whether the signal is currently loading. This will trigger lazy loading of the signal, so you
446
+ * can use it like this:
447
+ *
448
+ * ```tsx
449
+ * signal.loading ? <Loading /> : signal.error ? <Error /> : <Component
450
+ * value={signal.value} />
451
+ * ```
452
+ */
453
+ loading: boolean;
454
+ /**
455
+ * The error that occurred while computing the signal, if any. This will be cleared when the
456
+ * signal is successfully computed.
457
+ */
458
+ error: Error | undefined;
459
+ /**
460
+ * Staleness/poll interval in ms. Writable and immediately effective.
461
+ *
462
+ * - **Positive**: Poll — re-compute after this many ms when subscribers exist.
463
+ * - **Negative**: Stale-only — mark stale after `|interval|` ms, no auto-recompute.
464
+ * - **`0`**: No staleness tracking or polling.
465
+ */
466
+ interval: number;
467
+ /** A promise that resolves when the value is computed or rejected. */
468
+ promise(): Promise<void>;
469
+ /** Abort the current computation and run cleanups if needed. */
470
+ abort(reason?: any): void;
471
+ /**
472
+ * Use this to force recalculation. If you pass `info`, it will be provided to the calculation
473
+ * function.
474
+ */
475
+ invalidate(info?: unknown): void;
370
476
  }
371
477
 
372
- /** @public */
373
- export declare type AsyncComputedReturnType<T> = T extends Promise<infer T> ? AsyncComputedReadonlySignal<T> : AsyncComputedReadonlySignal<T>;
478
+ declare const enum AsyncSignalFlags {
479
+ EAGER_CLEANUP = 32,
480
+ CLIENT_ONLY = 64
481
+ }
374
482
 
375
- declare type AsyncComputeQRL<T> = QRLInternal<AsyncComputedFn<T>>;
483
+ /**
484
+ * # ================================
485
+ *
486
+ * AsyncSignalImpl
487
+ *
488
+ * # ================================
489
+ */
490
+ declare class AsyncSignalImpl<T> extends ComputedSignalImpl<T, AsyncQRL<T>> implements BackRef, AsyncSignal<T> {
491
+ $untrackedLoading$: boolean;
492
+ $untrackedError$: Error | undefined;
493
+ $loadingEffects$: undefined | Set<EffectSubscription>;
494
+ $errorEffects$: undefined | Set<EffectSubscription>;
495
+ $current$: AsyncJob<T> | null;
496
+ $jobs$: AsyncJob<T>[];
497
+ $concurrency$: number;
498
+ $interval$: number;
499
+ $timeoutMs$: number | undefined;
500
+ $info$: unknown;
501
+ $infoVersion$: number;
502
+ $pollTimeoutId$: ReturnType<typeof setTimeout> | undefined;
503
+ $computationTimeoutId$: ReturnType<typeof setTimeout> | undefined;
504
+ [_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
505
+ constructor(container: _Container | null, fn: AsyncQRL<T>, flags?: SignalFlags | SerializationSignalFlags, options?: AsyncSignalOptions<T>);
506
+ get untrackedValue(): T;
507
+ set untrackedValue(value: T);
508
+ /**
509
+ * Read the value, subscribing if in a tracking context. Triggers computation if needed.
510
+ *
511
+ * Setting the value will mark the signal as not loading and clear any error, and prevent any
512
+ * pending computations from writing their results.
513
+ *
514
+ * If you want to set the value without affecting loading or error state, set `untrackedValue`
515
+ * instead and make sure to trigger effects manually if needed.
516
+ *
517
+ * If you want to abort pending computations when setting, you have to call `abort()` manually.
518
+ */
519
+ get value(): T;
520
+ set value(value: T);
521
+ /**
522
+ * Loading is true if the signal is still waiting for the promise to resolve, false if the promise
523
+ * has resolved or rejected.
524
+ *
525
+ * Accessing .loading will trigger computation if needed, since it's often used like
526
+ * `signal.loading ? <Loading /> : signal.value`.
527
+ */
528
+ get loading(): boolean;
529
+ set untrackedLoading(value: boolean);
530
+ get untrackedLoading(): boolean;
531
+ /** The error that occurred when the signal was resolved. */
532
+ get error(): Error | undefined;
533
+ set untrackedError(value: Error | undefined);
534
+ get untrackedError(): Error | undefined;
535
+ get interval(): number;
536
+ set interval(value: number);
537
+ /** Invalidates the signal, causing it to re-compute its value. */
538
+ invalidate(info?: unknown): Promise<void>;
539
+ /** Abort the current computation and run cleanups if needed. */
540
+ abort(reason?: any): void;
541
+ /** Schedule eager cleanup on next macro task if no subscribers remain. */
542
+ $scheduleEagerCleanup$(): void;
543
+ /** Returns a promise resolves when the signal finished computing. */
544
+ promise(): Promise<void>;
545
+ /** Run the computation if needed */
546
+ $computeIfNeeded$(): void;
547
+ $runComputation$(running: AsyncJob<T>): Promise<void>;
548
+ /** Called after SSR/unmount */
549
+ $destroy$(): Promise<void>;
550
+ private $clearNextPoll$;
551
+ private $scheduleNextPoll$;
552
+ private $hasSubscribers$;
553
+ $requestCleanups$(job: AsyncJob<T>, reason?: any): Promise<void | null>;
554
+ /** Clean up and trigger signal compute once complete */
555
+ $runCleanups$(job: AsyncJob<T>): Promise<void>;
556
+ }
557
+
558
+ /** @public */
559
+ export declare interface AsyncSignalOptions<T> extends ComputedOptions {
560
+ /** Like useSignal's `initial`; prevents the throw on first read when uninitialized */
561
+ initial?: T | (() => T);
562
+ /**
563
+ * Maximum number of concurrent computations. Use `0` for unlimited.
564
+ *
565
+ * Defaults to `1`.
566
+ */
567
+ concurrency?: number;
568
+ /**
569
+ * When subscribers drop to 0, run cleanup in the next tick, instead of waiting for the function
570
+ * inputs to change.
571
+ *
572
+ * Defaults to `false`, meaning cleanup happens only when inputs change.
573
+ */
574
+ eagerCleanup?: boolean;
575
+ /**
576
+ * Wait for previous invocation to complete before running again.
577
+ *
578
+ * Defaults to `true`.
579
+ *
580
+ * @deprecated Not implemented yet
581
+ */
582
+ awaitPrevious?: boolean;
583
+ /**
584
+ * Controls staleness and polling behavior.
585
+ *
586
+ * - **Positive**: Re-run the function after `interval` ms if subscribers exist (polling).
587
+ * - **Negative**: Mark the value as stale after `|interval|` ms, but do NOT auto-recompute.
588
+ * Consumers can check staleness and manually trigger recomputation.
589
+ * - **`0`** (default): No staleness tracking or polling.
590
+ */
591
+ interval?: number;
592
+ /**
593
+ * When true, the async computation is postponed to the browser. On SSR, the signal remains
594
+ * INVALID and does not execute the function. On the client, it will compute on first read.
595
+ *
596
+ * Defaults to `false`.
597
+ */
598
+ clientOnly?: boolean;
599
+ /**
600
+ * Maximum time in milliseconds to wait for the async computation to complete. If exceeded, the
601
+ * computation is aborted and an error is thrown.
602
+ *
603
+ * If `0`, no timeout is applied.
604
+ *
605
+ * Defaults to `0`.
606
+ */
607
+ timeout?: number;
608
+ }
376
609
 
377
610
  /**
378
611
  * Replace given element's props with custom types and return all props specific to the element. Use
@@ -384,7 +617,7 @@ declare type Augmented<E, A = {}> = Prettify<Filtered<E, A> & A>;
384
617
 
385
618
  /** Class for back reference to the EffectSubscription */
386
619
  declare abstract class BackRef {
387
- [_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | null;
620
+ [_EFFECT_BACK_REF]: Map<any, any> | undefined;
388
621
  }
389
622
 
390
623
  declare type BivariantQrlFn<ARGS extends any[], RETURN> = {
@@ -400,21 +633,34 @@ declare type BivariantQrlFn<ARGS extends any[], RETURN> = {
400
633
  /** @public */
401
634
  declare type Booleanish = boolean | `${boolean}`;
402
635
 
403
- declare const enum ChoreType {
404
- MACRO = 240,
405
- MICRO = 15,
406
- /** Ensure that the QRL promise is resolved before processing next chores in the queue */
407
- QRL_RESOLVE = 1,
408
- RUN_QRL = 2,
409
- TASK = 3,
410
- NODE_DIFF = 4,
411
- NODE_PROP = 5,
412
- COMPONENT = 6,
413
- RECOMPUTE_AND_SCHEDULE_EFFECTS = 7,
414
- JOURNAL_FLUSH = 16,
415
- VISIBLE = 32,
416
- CLEANUP_VISIBLE = 48,
417
- WAIT_FOR_ALL = 255
636
+ /**
637
+ * The current captured scope during QRL invocation. This is used to provide the lexical scope for
638
+ * QRL functions. It is used one time per invocation, synchronously, so it is safe to store it in
639
+ * module scope.
640
+ *
641
+ * @internal
642
+ */
643
+ export declare let _captures: Readonly<unknown[]> | null;
644
+
645
+ /**
646
+ * Handles events for bind:checked
647
+ *
648
+ * @internal
649
+ */
650
+ export declare function _chk(this: string | undefined, _: any, element: HTMLInputElement): void;
651
+
652
+ declare const enum ChoreBits {
653
+ NONE = 0,
654
+ TASKS = 1,
655
+ NODE_DIFF = 2,
656
+ COMPONENT = 4,
657
+ NODE_PROPS = 8,
658
+ COMPUTE = 16,
659
+ CHILDREN = 32,
660
+ CLEANUP = 64,
661
+ RECONCILE = 128,
662
+ ERROR_WRAP = 256,
663
+ DIRTY_MASK = 511
418
664
  }
419
665
 
420
666
  /**
@@ -430,17 +676,14 @@ declare const enum ChoreType {
430
676
  export declare type ClassList = string | undefined | null | false | Record<string, boolean | string | number | null | undefined> | ClassList[];
431
677
 
432
678
  /** @internal */
433
- export declare interface ClientContainer extends Container {
679
+ export declare interface ClientContainer extends _Container {
434
680
  document: _QDocument;
435
681
  element: _ContainerElement;
436
682
  qContainer: string;
437
683
  $locale$: string;
438
684
  qManifestHash: string;
439
685
  rootVNode: _ElementVNode;
440
- $journal$: VNodeJournal;
441
- renderDone: Promise<void> | null;
442
686
  $forwardRefs$: Array<number> | null;
443
- $initialQRLsIndexes$: Array<number> | null;
444
687
  parseQRL<T = unknown>(qrl: string): QRL<T>;
445
688
  $setRawState$(id: number, vParent: _ElementVNode | _VirtualVNode): void;
446
689
  }
@@ -468,11 +711,11 @@ export declare interface ClientContainer extends Container {
468
711
  * step?: number;
469
712
  * }
470
713
  * export const Counter = component$((props: CounterProps) => {
471
- * const state = useStore({ count: props.initialValue || 0 });
714
+ * const state = useSignal(props.initialValue || 0);
472
715
  * return (
473
716
  * <div>
474
- * <span>{state.count}</span>
475
- * <button onClick$={() => (state.count += props.step || 1)}>+</button>
717
+ * <span>{state.value}</span>
718
+ * <button onClick$={() => (state.value += props.step || 1)}>+</button>
476
719
  * </div>
477
720
  * );
478
721
  * });
@@ -527,12 +770,6 @@ declare type ComponentChildren<PROPS> = PROPS extends {
527
770
  children?: JSXChildren;
528
771
  };
529
772
 
530
- /** @public */
531
- declare interface ComponentEntryStrategy {
532
- type: 'component';
533
- manual?: Record<string, string>;
534
- }
535
-
536
773
  /** @internal */
537
774
  export declare const componentQrl: <PROPS extends Record<any, any>>(componentQrl: QRL<OnRenderFn<PROPS>>) => Component<PROPS>;
538
775
 
@@ -540,7 +777,13 @@ export declare const componentQrl: <PROPS extends Record<any, any>>(componentQrl
540
777
  export declare type ComputedFn<T> = () => T;
541
778
 
542
779
  /** @public */
543
- export declare type ComputedReturnType<T> = T extends Promise<any> ? never : ReadonlySignal<T>;
780
+ export declare interface ComputedOptions {
781
+ serializationStrategy?: SerializationStrategy;
782
+ container?: _Container;
783
+ }
784
+
785
+ /** @public */
786
+ export declare type ComputedReturnType<T> = T extends Promise<any> ? never : ComputedSignal<T>;
544
787
 
545
788
  /**
546
789
  * A computed signal is a signal which is calculated from other signals. When the signals change,
@@ -549,12 +792,11 @@ export declare type ComputedReturnType<T> = T extends Promise<any> ? never : Rea
549
792
  *
550
793
  * @public
551
794
  */
552
- export declare interface ComputedSignal<T> extends ReadonlySignal<T> {
553
- /**
554
- * Use this to force recalculation and running subscribers, for example when the calculated value
555
- * mutates but remains the same object. Useful for third-party libraries.
556
- */
795
+ export declare interface ComputedSignal<T> extends Signal<T> {
796
+ /** @deprecated Use `trigger()` instead */
557
797
  force(): void;
798
+ /** Use this to force recalculation. */
799
+ invalidate(): void;
558
800
  }
559
801
 
560
802
  /**
@@ -562,7 +804,7 @@ export declare interface ComputedSignal<T> extends ReadonlySignal<T> {
562
804
  *
563
805
  * The value is available synchronously, but the computation is done lazily.
564
806
  */
565
- declare class ComputedSignalImpl<T, S extends QRLInternal = ComputeQRL<T>> extends SignalImpl<T> implements BackRef {
807
+ declare class ComputedSignalImpl<T, S extends _QRLInternal = ComputeQRL<T>> extends SignalImpl<T> implements BackRef {
566
808
  /**
567
809
  * The compute function is stored here.
568
810
  *
@@ -570,23 +812,16 @@ declare class ComputedSignalImpl<T, S extends QRLInternal = ComputeQRL<T>> exten
570
812
  * resolve the QRL during the mark dirty phase so that any call to it will be synchronous). )
571
813
  */
572
814
  $computeQrl$: S;
573
- $flags$: SignalFlags;
574
- $forceRunEffects$: boolean;
575
- [_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | null;
576
- constructor(container: Container | null, fn: S, flags?: SignalFlags);
577
- $invalidate$(): void;
578
- /**
579
- * Use this to force running subscribers, for example when the calculated value has mutated but
580
- * remained the same object
581
- */
582
- force(): void;
815
+ $flags$: SignalFlags | SerializationSignalFlags;
816
+ [_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
817
+ constructor(container: _Container | null, fn: S, flags?: SignalFlags | SerializationSignalFlags);
818
+ invalidate(): void;
583
819
  get untrackedValue(): T;
584
- $computeIfNeeded$(): boolean;
585
- set value(_: any);
586
- get value(): any;
820
+ set untrackedValue(value: T);
821
+ $computeIfNeeded$(): void;
587
822
  }
588
823
 
589
- declare type ComputeQRL<T> = QRLInternal<ComputedFn<T>>;
824
+ declare type ComputeQRL<T> = _QRLInternal<ComputedFn<T>>;
590
825
 
591
826
  /** @internal */
592
827
  export declare const _CONST_PROPS: unique symbol;
@@ -600,18 +835,22 @@ export declare const _CONST_PROPS: unique symbol;
600
835
  * - `VNode` and `ISsrNode`: Either a component or `<Signal>`
601
836
  * - `Signal2`: A derived signal which contains a computation function.
602
837
  */
603
- declare type Consumer = Task | _VNode | ISsrNode | SignalImpl;
838
+ declare type Consumer = Task | _VNode | SignalImpl | ISsrNode;
604
839
 
605
- declare interface Container {
840
+ /** @internal */
841
+ export declare interface _Container {
606
842
  readonly $version$: string;
607
- readonly $scheduler$: Scheduler;
608
843
  readonly $storeProxyMap$: ObjToProxyMap;
609
844
  readonly $locale$: string;
610
845
  readonly $getObjectById$: (id: number | string) => any;
611
846
  readonly $serverData$: Record<string, any>;
612
847
  $currentUniqueId$: number;
613
848
  $buildBase$: string | null;
614
- handleError(err: any, $host$: HostElement): void;
849
+ $renderPromise$: Promise<void> | null;
850
+ $resolveRenderPromise$: (() => void) | null;
851
+ $pendingCount$: number;
852
+ $checkPendingCount$(): void;
853
+ handleError(err: any, $host$: HostElement | null): void;
615
854
  getParentHost(host: HostElement): HostElement | null;
616
855
  setContext<T>(host: HostElement, context: ContextId<T>, value: T): void;
617
856
  resolveContext<T>(host: HostElement, contextId: ContextId<T>): T | undefined;
@@ -755,19 +994,13 @@ export declare interface CorePlatform {
755
994
  * @param symbol - The name of the symbol to import.
756
995
  * @returns A promise that resolves to the imported symbol.
757
996
  */
758
- importSymbol: (containerEl: Element | undefined, url: string | URL | undefined | null, symbol: string) => ValueOrPromise<any>;
997
+ importSymbol: (containerEl: Element | undefined, url: string | URL | undefined | null, symbol: string) => ValueOrPromise<unknown>;
759
998
  /**
760
999
  * Perform operation on next request-animation-frame.
761
1000
  *
762
1001
  * @param fn - The function to call when the next animation frame is ready.
763
1002
  */
764
1003
  raf: (fn: () => any) => Promise<any>;
765
- /**
766
- * Perform operation on next tick.
767
- *
768
- * @param fn - The function to call when the tick is ready.
769
- */
770
- nextTick: (fn: () => any) => Promise<any>;
771
1004
  /**
772
1005
  * Retrieve chunk name for the symbol.
773
1006
  *
@@ -789,6 +1022,17 @@ export declare interface CorrectedToggleEvent extends Event {
789
1022
  readonly prevState: 'open' | 'closed';
790
1023
  }
791
1024
 
1025
+ /**
1026
+ * Create a signal holding a `.value` which is calculated from the given async function (QRL). The
1027
+ * standalone version of `useAsync$`.
1028
+ *
1029
+ * @public
1030
+ */
1031
+ export declare const createAsync$: <T>(qrl: (arg: AsyncCtx<T>) => Promise<T>, options?: AsyncSignalOptions<T>) => AsyncSignal<T>;
1032
+
1033
+ /** @internal */
1034
+ export declare const createAsyncQrl: <T>(qrl: QRL<AsyncFn<T>>, options?: AsyncSignalOptions<T>) => AsyncSignalImpl<T>;
1035
+
792
1036
  /**
793
1037
  * Create a computed signal which is calculated from the given QRL. A computed signal is a signal
794
1038
  * which is calculated from other signals. When the signals change, the computed signal is
@@ -797,14 +1041,14 @@ export declare interface CorrectedToggleEvent extends Event {
797
1041
  * The QRL must be a function which returns the value of the signal. The function must not have side
798
1042
  * effects, and it must be synchronous.
799
1043
  *
800
- * If you need the function to be async, use `useSignal` and `useTask$` instead.
1044
+ * If you need the function to be async, use `createAsync$` instead (don't forget to use `track()`).
801
1045
  *
802
1046
  * @public
803
1047
  */
804
- export declare const createComputed$: <T>(qrl: () => T) => T extends Promise<any> ? never : ComputedSignal<T>;
1048
+ export declare const createComputed$: <T>(qrl: () => T, options?: ComputedOptions) => ComputedReturnType<T>;
805
1049
 
806
1050
  /** @internal */
807
- export declare const createComputedQrl: <T>(qrl: QRL<() => T>) => ComputedSignalImpl<T>;
1051
+ export declare const createComputedQrl: <T>(qrl: QRL<() => T>, options?: ComputedOptions) => ComputedSignalImpl<T>;
808
1052
 
809
1053
  /**
810
1054
  * Create a context ID to be used in your application. The name should be written with no spaces.
@@ -858,18 +1102,20 @@ export declare const createComputedQrl: <T>(qrl: QRL<() => T>) => ComputedSignal
858
1102
  */
859
1103
  export declare const createContextId: <STATE = unknown>(name: string) => ContextId<STATE>;
860
1104
 
861
- declare const createScheduler: (container: Container, scheduleDrain: () => void, journalFlush: () => void) => {
862
- (type: ChoreType.QRL_RESOLVE, ignore: null, target: ComputeQRL<any> | AsyncComputeQRL<any>): ValueOrPromise<void>;
863
- (type: ChoreType.JOURNAL_FLUSH): ValueOrPromise<void>;
864
- (type: ChoreType.WAIT_FOR_ALL): ValueOrPromise<void>;
865
- (type: ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, host: HostElement | null, target: Signal | StoreHandler, effects: Set<EffectSubscription> | null): ValueOrPromise<void>;
866
- (type: ChoreType.TASK | ChoreType.VISIBLE, task: Task): ValueOrPromise<void>;
867
- (type: ChoreType.RUN_QRL, host: HostElement, target: QRLInternal<(...args: unknown[]) => unknown>, args: unknown[]): ValueOrPromise<void>;
868
- (type: ChoreType.COMPONENT, host: HostElement, qrl: QRLInternal<OnRenderFn<unknown>>, props: Props | null): ValueOrPromise<JSXOutput>;
869
- (type: ChoreType.NODE_DIFF, host: HostElement, target: HostElement, value: JSXOutput | Signal): ValueOrPromise<void>;
870
- (type: ChoreType.NODE_PROP, host: HostElement, prop: string, value: any): ValueOrPromise<void>;
871
- (type: ChoreType.CLEANUP_VISIBLE, task: Task): ValueOrPromise<JSXOutput>;
872
- };
1105
+ /**
1106
+ * Creates a QRL instance to represent a lazily loaded value. Normally this is a function, but it
1107
+ * can be any value.
1108
+ *
1109
+ * When the value is a function, calling the returned qrl will load the underlying code when
1110
+ * invoked, and call it with the captured scope. This always returns a promise since the code may
1111
+ * not be loaded yet.
1112
+ *
1113
+ * To get the underlying function without invoking it, await `qrl.resolve()` and then `qrl.resolved`
1114
+ * holds the loaded function, wrapped with the captured scope.
1115
+ *
1116
+ * @internal
1117
+ */
1118
+ export declare const _createQRL: <TYPE>(chunk: string | null, symbol: string, symbolRef?: null | ValueOrPromise<TYPE>, symbolFn?: null | (() => Promise<Record<string, TYPE>>), captures?: Readonly<unknown[]> | string | null, container?: _Container) => _QRLInternal<TYPE>;
873
1119
 
874
1120
  /**
875
1121
  * Create a signal that holds a custom serializable value. See {@link useSerializer$} for more
@@ -909,24 +1155,22 @@ export declare interface CSSProperties extends CSS_2.Properties<string | number>
909
1155
  [v: `--${string}`]: string | number | undefined;
910
1156
  }
911
1157
 
912
- /** @public */
913
1158
  declare interface DescriptorBase<T = unknown, B = unknown> extends BackRef {
914
1159
  $flags$: number;
915
1160
  $index$: number;
916
1161
  $el$: HostElement;
917
- $qrl$: QRLInternal<T>;
1162
+ $qrl$: _QRLInternal<T>;
918
1163
  $state$: B | undefined;
919
- $destroy$: NoSerialize<() => void> | null;
1164
+ $destroy$: (() => void) | null;
920
1165
  }
921
1166
 
922
1167
  /**
923
1168
  * Deserialize data from string to an array of objects.
924
1169
  *
925
1170
  * @param rawStateData - Data to deserialize
926
- * @param element - Container element
927
1171
  * @internal
928
1172
  */
929
- export declare function _deserialize(rawStateData: string | null, element?: unknown): unknown[];
1173
+ export declare function _deserialize<T>(rawStateData: string): T;
930
1174
 
931
1175
  declare interface DeserializeContainer {
932
1176
  $getObjectById$: (id: number | string) => unknown;
@@ -935,8 +1179,6 @@ declare interface DeserializeContainer {
935
1179
  $state$?: unknown[];
936
1180
  $storeProxyMap$: ObjToProxyMap;
937
1181
  $forwardRefs$: Array<number> | null;
938
- $initialQRLsIndexes$: Array<number> | null;
939
- readonly $scheduler$: Scheduler | null;
940
1182
  }
941
1183
 
942
1184
  /** @public */
@@ -963,53 +1205,40 @@ declare class DomContainer extends _SharedContainer implements ClientContainer {
963
1205
  qManifestHash: string;
964
1206
  rootVNode: _ElementVNode;
965
1207
  document: _QDocument;
966
- $journal$: VNodeJournal;
967
- renderDone: Promise<void> | null;
968
- $rawStateData$: unknown[];
969
1208
  $storeProxyMap$: ObjToProxyMap;
970
1209
  $qFuncs$: Array<(...args: unknown[]) => unknown>;
971
1210
  $instanceHash$: string;
972
1211
  $forwardRefs$: Array<number> | null;
973
- $initialQRLsIndexes$: Array<number> | null;
974
1212
  vNodeLocate: (id: string | Element) => _VNode;
1213
+ private $rawStateData$;
975
1214
  private $stateData$;
976
1215
  private $styleIds$;
977
- private $renderCount$;
978
1216
  constructor(element: _ContainerElement);
979
- $setRawState$(id: number, vParent: _ElementVNode | _VirtualVNode): void;
980
- parseQRL<T = unknown>(qrl: string): QRL<T>;
981
- handleError(err: any, host: HostElement): void;
982
- setContext<T>(host: HostElement, context: ContextId<T>, value: T): void;
983
- resolveContext<T>(host: HostElement, contextId: ContextId<T>): T | undefined;
984
- getParentHost(host: HostElement): HostElement | null;
1217
+ /** Tear down this container so stale references fail gracefully. */
1218
+ $destroy$(): void;
1219
+ /**
1220
+ * The first time we render we need to hoist the styles. (Meaning we need to move all styles from
1221
+ * component inline to <head>)
1222
+ *
1223
+ * We bulk move all of the styles, because the expensive part is for the browser to recompute the
1224
+ * styles, (not the actual DOM manipulation.) By moving all of them at once we can minimize the
1225
+ * reflow.
1226
+ */
1227
+ $hoistStyles$(): void;
1228
+ $setRawState$(id: number, vParent: _VNode): void;
1229
+ parseQRL<T = unknown>(qrlStr: string): QRL<T>;
1230
+ handleError(err: any, host: _VNode | null): void;
1231
+ setContext<T>(host: _VNode, context: ContextId<T>, value: T): void;
1232
+ resolveContext<T>(host: _VNode, contextId: ContextId<T>): T | undefined;
1233
+ getParentHost(host: _VNode): _VNode | null;
985
1234
  setHostProp<T>(host: HostElement, name: string, value: T): void;
986
1235
  getHostProp<T>(host: HostElement, name: string): T | null;
987
- scheduleRender(): Promise<void>;
988
- private processChores;
989
1236
  ensureProjectionResolved(vNode: _VirtualVNode): void;
990
1237
  $getObjectById$: (id: number | string) => unknown;
991
1238
  getSyncFn(id: number): (...args: unknown[]) => unknown;
992
1239
  $appendStyle$(content: string, styleId: string, host: _VirtualVNode, scoped: boolean): void;
993
1240
  /** Set the server data for the Qwik Router. */
994
1241
  private $setServerData$;
995
- /**
996
- * Schedule the initial QRLs to be resolved.
997
- *
998
- * Schedules the QRLs that are defined in the state data as `PreloadQRL`.
999
- *
1000
- * This is done because when computed and custom serializer QRLs are called they need QRL to work.
1001
- * If the QRL is not resolved at this point, it will be resolved by throwing a promise and
1002
- * rerunning the whole wrapping function again. We want to avoid that, because it means that the
1003
- * function can execute twice.
1004
- *
1005
- * ```ts
1006
- * useVisibleTask$(() => {
1007
- * runHeavyLogic(); // This will be called again if the QRL of `computedOrCustomSerializer` is not resolved.
1008
- * console.log(computedOrCustomSerializer.value); // Throw a promise if QRL not resolved and execute visible task again.
1009
- * });
1010
- * ```
1011
- */
1012
- private $scheduleInitialQRLs$;
1013
1242
  }
1014
1243
  export { DomContainer }
1015
1244
  export { DomContainer as _DomContainer }
@@ -1021,9 +1250,28 @@ declare type DomRef = {
1021
1250
  /** @internal */
1022
1251
  export declare const _dumpState: (state: unknown[], color?: boolean, prefix?: string, limit?: number | null) => string;
1023
1252
 
1253
+ /** @internal */
1254
+ export declare const _eaC: (props: EachProps<any>) => JSXNode<unknown>;
1255
+
1256
+ /** @public @experimental */
1257
+ export declare const Each: EachComponent;
1258
+
1259
+ declare type EachComponent = <T, ITEM extends JSXOutput = JSXOutput>(props: PublicProps<EachProps<T, ITEM>>, key: string | null, flags: number, dev?: DevJSX) => JSXOutput;
1260
+
1261
+ declare interface EachProps<T, ITEM extends JSXOutput = JSXOutput> {
1262
+ items: readonly T[];
1263
+ item$: QRL<(item: T, index: number) => ITEM>;
1264
+ key$: QRL<(item: T, index: number) => string>;
1265
+ }
1266
+
1267
+ /** @internal */
1268
+ export declare const _eaT: ({ track }: TaskCtx) => Promise<void>;
1269
+
1024
1270
  /** @internal */
1025
1271
  export declare const _EFFECT_BACK_REF: unique symbol;
1026
1272
 
1273
+ declare type EffectBackRef = SignalImpl | StoreTarget | PropsProxy;
1274
+
1027
1275
  declare const enum EffectProperty {
1028
1276
  COMPONENT = ":",
1029
1277
  VNODE = "."
@@ -1065,42 +1313,26 @@ declare const enum EffectProperty {
1065
1313
  * - `EffectProperty.COMPONENT` if component
1066
1314
  * - `EffectProperty.VNODE` if VNode
1067
1315
  */
1068
- declare type EffectSubscription = [
1069
- Consumer,
1070
- // EffectSubscriptionProp.CONSUMER
1071
- EffectProperty | string,
1072
- // EffectSubscriptionProp.PROPERTY or string for attributes
1073
- Set<SignalImpl | StoreTarget> | null,
1074
- // EffectSubscriptionProp.BACK_REF
1075
- _SubscriptionData | null
1076
- ];
1316
+ declare class EffectSubscription {
1317
+ consumer: Consumer;
1318
+ property: EffectProperty | string;
1319
+ backRef: Set<EffectBackRef> | null;
1320
+ data: _SubscriptionData | null;
1321
+ constructor(consumer: Consumer, property: EffectProperty | string, backRef?: Set<EffectBackRef> | null, data?: _SubscriptionData | null);
1322
+ }
1077
1323
 
1078
1324
  /** @internal */
1079
- export declare type _ElementVNode = [
1080
- _VNodeFlags.Element,
1081
- ////////////// 0 - Flags
1082
- _VNode | null,
1083
- /////////////// 1 - Parent
1084
- _VNode | null,
1085
- /////////////// 2 - Previous sibling
1086
- _VNode | null,
1087
- /////////////// 3 - Next sibling
1088
- _VNode | null | undefined,
1089
- /// 4 - First child - undefined if children need to be materialize
1090
- _VNode | null | undefined,
1091
- Element,
1092
- //////////////////// 6 - Element
1093
- string | undefined,
1094
- (string | null)[]
1095
- ] & {
1096
- __brand__: 'ElementVNode';
1097
- };
1325
+ export declare class _ElementVNode extends _VirtualVNode {
1326
+ node: Element;
1327
+ elementName: string | undefined;
1328
+ constructor(key: string | null, flags: _VNodeFlags, parent: _ElementVNode | _VirtualVNode | null, previousSibling: _VNode | null | undefined, nextSibling: _VNode | null | undefined, props: Props | null, firstChild: _VNode | null | undefined, lastChild: _VNode | null | undefined, node: Element, elementName: string | undefined);
1329
+ }
1098
1330
 
1099
1331
  /** @internal */
1100
1332
  export declare const _EMPTY_ARRAY: any[];
1101
1333
 
1102
- /** @public */
1103
- declare type EntryStrategy = InlineEntryStrategy | HoistEntryStrategy | SingleEntryStrategy | HookEntryStrategy | SegmentEntryStrategy | ComponentEntryStrategy | SmartEntryStrategy;
1334
+ /** @internal */
1335
+ export declare const _EMPTY_OBJ: Record<string, any>;
1104
1336
 
1105
1337
  /** @public */
1106
1338
  export declare interface ErrorBoundaryStore {
@@ -1108,15 +1340,14 @@ export declare interface ErrorBoundaryStore {
1108
1340
  }
1109
1341
 
1110
1342
  /** @public */
1111
- export declare const event$: <T>(qrl: T) => QRL_2<T>;
1343
+ export declare const event$: <T>(qrl: T) => QRL<T>;
1112
1344
 
1113
1345
  declare type EventCorrectionMap = {
1114
1346
  auxclick: PointerEvent;
1115
- beforetoggle: CorrectedToggleEvent;
1116
1347
  click: PointerEvent;
1117
1348
  dblclick: PointerEvent;
1118
1349
  input: InputEvent;
1119
- toggle: CorrectedToggleEvent;
1350
+ qvisible: QwikVisibleEvent;
1120
1351
  };
1121
1352
 
1122
1353
  declare type EventFromName<T extends string> = LcEvent<T>;
@@ -1135,6 +1366,9 @@ declare type EventQRL<T extends string = AllEventKeys> = QRL<EventHandler<EventF
1135
1366
  /** @internal */
1136
1367
  export declare const eventQrl: <T>(qrl: QRL<T>) => QRL<T>;
1137
1368
 
1369
+ /** @internal */
1370
+ export declare function _executeSsrChores(container: SSRContainer, ssrNode: ISsrNode): ValueOrPromise<void>;
1371
+
1138
1372
  declare type FilterBase<T> = {
1139
1373
  [K in keyof T as K extends string ? K extends Uppercase<K> ? never : any extends T[K] ? never : false extends IsAcceptableDOMValue<T[K]> ? never : IsReadOnlyKey<T, K> extends true ? never : K extends UnwantedKeys ? never : K : never]?: T[K];
1140
1374
  };
@@ -1147,6 +1381,13 @@ declare type Filtered<T, A = {}> = {
1147
1381
  /** @internal */
1148
1382
  export declare const _fnSignal: <T extends (...args: any) => any>(fn: T, args: Parameters<T>, fnStr?: string) => WrappedSignalImpl<any>;
1149
1383
 
1384
+ /**
1385
+ * Force a store to recompute and schedule effects.
1386
+ *
1387
+ * @public
1388
+ */
1389
+ export declare const forceStoreEffects: (value: StoreTarget, prop: keyof StoreTarget) => void;
1390
+
1150
1391
  /** @public */
1151
1392
  export declare const Fragment: FunctionComponent<{
1152
1393
  children?: any;
@@ -1164,14 +1405,20 @@ export declare type FunctionComponent<P = unknown> = {
1164
1405
  renderFn(props: P, key: string | null, flags: number, dev?: DevJSX): JSXOutput;
1165
1406
  }['renderFn'];
1166
1407
 
1408
+ /** Used by the optimizer for spread props operations @internal */
1409
+ export declare const _getConstProps: (props: PropsProxy | Record<string, unknown> | null | undefined) => Props | null;
1410
+
1167
1411
  /** @internal */
1168
- export declare const _getContextElement: () => unknown;
1412
+ export declare const _getContextContainer: () => _Container | undefined;
1169
1413
 
1170
1414
  /** @internal */
1171
1415
  export declare const _getContextEvent: () => unknown;
1172
1416
 
1417
+ /** @internal */
1418
+ export declare const _getContextHostElement: () => HostElement | undefined;
1419
+
1173
1420
  /** @public */
1174
- declare function getDomContainer(element: Element | _VNode): ClientContainer;
1421
+ declare function getDomContainer(element: Element): ClientContainer;
1175
1422
  export { getDomContainer as _getDomContainer }
1176
1423
  export { getDomContainer }
1177
1424
 
@@ -1200,22 +1447,14 @@ export declare function getLocale(defaultLocale?: string): string;
1200
1447
  export declare const getPlatform: () => CorePlatform;
1201
1448
 
1202
1449
  /** @internal */
1203
- export declare function _getQContainerElement(element: Element | _VNode): Element | null;
1450
+ export declare function _getQContainerElement(element: Element): Element | null;
1204
1451
 
1205
- /** @public */
1206
- declare interface GlobalInjections {
1207
- tag: string;
1208
- attributes?: {
1209
- [key: string]: string;
1210
- };
1211
- location: 'head' | 'body';
1212
- }
1452
+ /** Used by the optimizer for spread props operations @internal */
1453
+ export declare const _getVarProps: (props: PropsProxy | Record<string, unknown> | null | undefined) => Props | null;
1213
1454
 
1214
1455
  /**
1215
- * The legacy transform, used in special cases like `<div {...props} key="key" />`. Note that the
1216
- * children are spread arguments, instead of a prop like in jsx() calls.
1217
- *
1218
- * Also note that this disables optimizations.
1456
+ * The legacy transform, used by some JSX transpilers. The optimizer normally replaces this with
1457
+ * optimized calls, with the same caveat as `jsx()`.
1219
1458
  *
1220
1459
  * @public
1221
1460
  */
@@ -1223,16 +1462,25 @@ declare function h<TYPE extends string | FunctionComponent<PROPS>, PROPS extends
1223
1462
  export { h as createElement }
1224
1463
  export { h }
1225
1464
 
1226
- /** @public */
1227
- declare interface HoistEntryStrategy {
1228
- type: 'hoist';
1229
- }
1465
+ /**
1466
+ * @returns True if the store has effects for the given prop
1467
+ * @internal
1468
+ */
1469
+ export declare const _hasStoreEffects: (value: StoreTarget, prop: keyof StoreTarget) => boolean;
1230
1470
 
1231
- /** @deprecated Use SegmentStrategy instead */
1232
- declare interface HookEntryStrategy {
1233
- type: 'hook';
1234
- manual?: Record<string, string>;
1235
- }
1471
+ /**
1472
+ * HMR event handler. The host VNode is captured at registration time via QRL captures.
1473
+ *
1474
+ * When called by the qwikloader or the test dispatch, `this` is the serialized captures string
1475
+ * which we deserialize to get the host VNode. When called through `_qDispatch` (client-rendered),
1476
+ * `_captures` is already set by `ensureQrlCaptures` in the QRL call chain.
1477
+ *
1478
+ * @internal
1479
+ */
1480
+ export declare const _hmr: (this: string | undefined, event: CustomEvent<{
1481
+ files: string[];
1482
+ t: number;
1483
+ }>, element: Element) => void;
1236
1484
 
1237
1485
  declare type HostElement = _VNode | ISsrNode;
1238
1486
 
@@ -1345,16 +1593,19 @@ export declare const _IMMUTABLE: unique symbol;
1345
1593
  */
1346
1594
  export declare const implicit$FirstArg: <FIRST, REST extends any[], RET>(fn: (qrl: QRL<FIRST>, ...rest: REST) => RET) => ((qrl: FIRST, ...rest: REST) => RET);
1347
1595
 
1348
- /** @internal */
1349
- export declare const inlinedQrl: <T>(symbol: T, symbolName: string, lexicalScopeCapture?: any[]) => QRL<T>;
1596
+ /**
1597
+ * Create an inlined QRL. This is mostly useful on the server side for serialization.
1598
+ *
1599
+ * @param symbol - The object/function to register, or `null` to retrieve a previously registered
1600
+ * one by hash
1601
+ * @param symbolName - The name of the symbol.
1602
+ * @param lexicalScopeCapture - A set of lexically scoped variables to capture.
1603
+ * @public
1604
+ */
1605
+ export declare const inlinedQrl: <T>(symbol: T | null, symbolName: string, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
1350
1606
 
1351
1607
  /** @internal */
1352
- export declare const inlinedQrlDEV: <T = any>(symbol: T, symbolName: string, opts: QRLDev, lexicalScopeCapture?: any[]) => QRL<T>;
1353
-
1354
- /** @public */
1355
- declare interface InlineEntryStrategy {
1356
- type: 'inline';
1357
- }
1608
+ export declare const inlinedQrlDEV: <T = any>(symbol: T, symbolName: string, opts: QRLDev, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
1358
1609
 
1359
1610
  /**
1360
1611
  * These are the HTML tags with handlers allowing plain callbacks, to be used for the JSX interface
@@ -1381,24 +1632,15 @@ declare type IntrinsicSVGElements = {
1381
1632
 
1382
1633
  /** The shared state during an invoke() call */
1383
1634
  declare interface InvokeContext {
1384
- $url$: URL | undefined;
1385
- /** The next available index for the sequentialScope array */
1386
- $i$: number;
1387
1635
  /** The Virtual parent component for the current component code */
1388
1636
  $hostElement$: HostElement | undefined;
1389
- /** The current DOM element */
1390
- $element$: Element | undefined;
1391
1637
  /** The event we're currently handling */
1392
1638
  $event$: PossibleEvents | undefined;
1393
- /** The QRL function we're currently executing */
1394
- $qrl$: QRL | undefined;
1395
1639
  $effectSubscriber$: EffectSubscription | undefined;
1396
1640
  $locale$: string | undefined;
1397
- $container$: Container | undefined;
1641
+ $container$: _Container | undefined;
1398
1642
  }
1399
1643
 
1400
- declare type InvokeTuple = [Element, Event, URL?];
1401
-
1402
1644
  declare type IsAcceptableDOMValue<T> = T extends boolean | number | string | null | undefined ? ((...args: any[]) => any) extends T ? false : true : false;
1403
1645
 
1404
1646
  declare type IsAny<T> = 0 extends T & 1 ? true : false;
@@ -1424,11 +1666,11 @@ export declare const isSignal: (value: any) => value is Signal<unknown>;
1424
1666
  /** @internal */
1425
1667
  export declare interface ISsrComponentFrame {
1426
1668
  componentNode: ISsrNode;
1669
+ slots: (string | JSXChildren)[];
1427
1670
  scopedStyleIds: Set<string>;
1428
1671
  projectionScopedStyle: string | null;
1429
1672
  projectionComponentFrame: ISsrComponentFrame | null;
1430
1673
  projectionDepth: number;
1431
- releaseUnclaimedProjections(unclaimedProjections: (ISsrComponentFrame | JSXChildren | string)[]): void;
1432
1674
  consumeChildrenForSlot(projectionNode: ISsrNode, slotName: string): JSXChildren | null;
1433
1675
  distributeChildrenIntoSlots(children: JSXChildren, parentScopedStyle: string | null, parentComponentFrame: ISsrComponentFrame | null): void;
1434
1676
  hasSlot(slotName: string): boolean;
@@ -1436,27 +1678,52 @@ export declare interface ISsrComponentFrame {
1436
1678
 
1437
1679
  declare interface ISsrNode {
1438
1680
  id: string;
1439
- parentSsrNode: ISsrNode | null;
1440
- vnodeData?: VNodeData;
1681
+ flags: SsrNodeFlags;
1682
+ dirty: ChoreBits;
1683
+ parentComponent: ISsrNode | null;
1684
+ vnodeData: VNodeData;
1685
+ currentFile: string | null;
1441
1686
  setProp(name: string, value: any): void;
1442
1687
  getProp(name: string): any;
1443
1688
  removeProp(name: string): void;
1444
1689
  addChild(child: ISsrNode): void;
1690
+ setTreeNonUpdatable(): void;
1445
1691
  }
1446
1692
 
1693
+ /** @internal */
1694
+ export declare const _isStore: (value: object) => boolean;
1695
+
1447
1696
  /** @internal */
1448
1697
  export declare function _isStringifiable(value: unknown): value is _Stringifiable;
1449
1698
 
1699
+ /** @internal */
1700
+ export declare const _isTask: (value: any) => value is Task;
1701
+
1702
+ /** @internal */
1703
+ declare interface IStreamHandler {
1704
+ flush(): void;
1705
+ streamBlockStart(): void;
1706
+ streamBlockEnd(): void;
1707
+ }
1708
+
1450
1709
  /**
1710
+ * Used by the JSX transpilers to create a JSXNode. Note that the optimizer will normally not use
1711
+ * this, instead using _jsxSplit and _jsxSorted directly.
1712
+ *
1713
+ * The optimizer will also replace all `jsx()` calls with the more optimized versions.
1714
+ *
1715
+ * The exception is when the props are not a literal object, which can only happen when the `jsx`
1716
+ * call is written directly.
1717
+ *
1451
1718
  * @public
1452
- * Used by the JSX transpilers to create a JSXNode.
1453
- * Note that the optimizer will not use this, instead using _jsxSplit and _jsxSorted directly.
1454
1719
  */
1455
- declare const jsx: <T extends string | FunctionComponent<any>>(type: T, props: T extends FunctionComponent<infer PROPS> ? PROPS : Props, key?: string | number | null) => JSXNode<T>;
1456
- export { jsx }
1457
- export { jsx as jsxs }
1720
+ export declare const jsx: <T extends string | FunctionComponent<any>>(type: T, props: T extends FunctionComponent<infer PROPS> ? PROPS : Props, key?: string | number | null, _isStatic?: boolean, dev?: JsxDevOpts) => JSXNode<T>;
1458
1721
 
1459
- /** @internal */
1722
+ /**
1723
+ * @deprecated
1724
+ * @internal
1725
+ * No longer used since v2
1726
+ */
1460
1727
  export declare const _jsxBranch: <T>(input?: T) => T | undefined;
1461
1728
 
1462
1729
  /** @internal @deprecated v1 compat */
@@ -1465,8 +1732,12 @@ export declare const _jsxC: (type: any, mutable: any, _flags: any, key: any) =>
1465
1732
  /** @public */
1466
1733
  export declare type JSXChildren = string | number | boolean | null | undefined | Function | RegExp | JSXChildren[] | Promise<JSXChildren> | Signal<JSXChildren> | JSXNode;
1467
1734
 
1468
- /** @public */
1469
- export declare const jsxDEV: <T extends string | FunctionComponent<Props>>(type: T, props: T extends FunctionComponent<infer PROPS> ? PROPS : Props, key: string | number | null | undefined, _isStatic: boolean, opts: JsxDevOpts, _ctx: unknown) => JSXNode<T>;
1735
+ /**
1736
+ * Alias of `jsx` for development purposes.
1737
+ *
1738
+ * @public
1739
+ */
1740
+ export declare const jsxDEV: <T extends string | FunctionComponent<any>>(type: T, props: T extends FunctionComponent<infer PROPS> ? PROPS : Props, key?: string | number | null, _isStatic?: boolean, dev?: JsxDevOpts) => JSXNode<T>;
1470
1741
 
1471
1742
  declare interface JsxDevOpts {
1472
1743
  fileName: string;
@@ -1474,6 +1745,14 @@ declare interface JsxDevOpts {
1474
1745
  columnNumber: number;
1475
1746
  }
1476
1747
 
1748
+ declare type JSXDocumentEvents = {
1749
+ [K in keyof QwikDocumentEventMap as `document:on${PascalCaseName<K>}$`]: QwikDocumentEventMap[K];
1750
+ };
1751
+
1752
+ declare type JSXElementEvents = {
1753
+ [K in keyof QwikHTMLElementEventMap as `on${PascalCaseName<K>}$`]: QwikHTMLElementEventMap[K];
1754
+ };
1755
+
1477
1756
  /**
1478
1757
  * A JSX Node, an internal structure. You probably want to use `JSXOutput` instead.
1479
1758
  *
@@ -1487,15 +1766,68 @@ export declare interface JSXNode<T extends string | FunctionComponent | unknown
1487
1766
  dev?: DevJSX;
1488
1767
  }
1489
1768
 
1769
+ declare const enum JSXNodeFlags {
1770
+ None = 0,
1771
+ StaticSubtree = 2,
1772
+ HasCapturedProps = 4
1773
+ }
1774
+
1775
+ declare class JSXNodeImpl<T = unknown> implements JSXNodeInternal<T> {
1776
+ type: T;
1777
+ children: JSXChildren;
1778
+ flags: JSXNodeFlags;
1779
+ toSort: boolean;
1780
+ key: string | null;
1781
+ varProps: Props;
1782
+ constProps: Props | null;
1783
+ dev?: DevJSX & {
1784
+ stack: string | undefined;
1785
+ };
1786
+ _proxy: Props | null;
1787
+ constructor(type: T, varProps: Props | null, constProps: Props | null, children: JSXChildren, flags: JSXNodeFlags, key: string | number | null | undefined, toSort?: boolean, dev?: DevJSX);
1788
+ get props(): T extends FunctionComponent<infer PROPS> ? PROPS : Props;
1789
+ }
1790
+
1490
1791
  /**
1491
1792
  * The internal representation of a JSX Node.
1492
1793
  *
1493
1794
  * @internal
1494
1795
  */
1495
1796
  export declare interface JSXNodeInternal<T extends string | FunctionComponent | unknown = unknown> extends JSXNode<T> {
1496
- varProps: Record<any, unknown>;
1497
- constProps: Record<any, unknown> | null;
1498
- flags: number;
1797
+ /** The type of node */
1798
+ type: T;
1799
+ /** Do the varProps need sorting */
1800
+ toSort: boolean;
1801
+ /** The key property */
1802
+ key: string | null;
1803
+ /** Flags */
1804
+ flags: JSXNodeFlags;
1805
+ /**
1806
+ * Props that are not guaranteed shallow equal across runs.
1807
+ *
1808
+ * Any prop that is in `constProps` takes precedence over `varProps`.
1809
+ *
1810
+ * Does not contain `children` or `key`.
1811
+ *
1812
+ * `onEvent$` props are normalized to the html `q-x:event` version
1813
+ */
1814
+ varProps: Props;
1815
+ /**
1816
+ * Props that will be shallow equal across runs. Does not contain any props that are in varProps.
1817
+ *
1818
+ * Any prop that is in `constProps` takes precedence over `varProps`.
1819
+ *
1820
+ * Does not contain `children` or `key`.
1821
+ *
1822
+ * `onEvent$` props are normalized to the html `q-x:event` version
1823
+ */
1824
+ constProps: Props | null;
1825
+ /** The children of the node */
1826
+ children: JSXChildren;
1827
+ /** Filename etc for debugging */
1828
+ dev?: DevJSX & {
1829
+ stack: string | undefined;
1830
+ };
1499
1831
  }
1500
1832
 
1501
1833
  /**
@@ -1511,6 +1843,13 @@ export declare const _jsxQ: (type: any, mutable: any, immutable: any, children:
1511
1843
  /** @internal @deprecated v1 compat */
1512
1844
  export declare const _jsxS: (type: any, mutable: any, immutable: any, _flags: any, key: any) => JSXNode<any>;
1513
1845
 
1846
+ /**
1847
+ * Alias of `jsx` to support JSX syntax.
1848
+ *
1849
+ * @public
1850
+ */
1851
+ export declare const jsxs: <T extends string | FunctionComponent<any>>(type: T, props: T extends FunctionComponent<infer PROPS> ? PROPS : Props, key?: string | number | null, _isStatic?: boolean, dev?: JsxDevOpts) => JSXNode<T>;
1852
+
1514
1853
  /**
1515
1854
  * Create a JSXNode with the properties fully split into variable and constant parts, and children
1516
1855
  * separated out. Furthermore, the varProps must be a sorted object, that is, the keys must be
@@ -1521,7 +1860,7 @@ export declare const _jsxS: (type: any, mutable: any, immutable: any, _flags: an
1521
1860
  * still update the attribute on the vnode.
1522
1861
  *
1523
1862
  * @param type - The JSX type
1524
- * @param varProps - The properties of the tag, sorted, excluding children, excluding any constProps
1863
+ * @param varProps - The properties of the tag, sorted, excluding children, key and any constProps
1525
1864
  * @param constProps - The properties of the tag that are known to be constant references and don't
1526
1865
  * need checking for changes on re-render
1527
1866
  * @param children - JSX children. Any `children` in the props objects are ignored.
@@ -1531,13 +1870,13 @@ export declare const _jsxSorted: <T>(type: T, varProps: Props | null, constProps
1531
1870
 
1532
1871
  /**
1533
1872
  * Create a JSXNode, with the properties split into variable and constant parts, but the variable
1534
- * parts could include keys from constProps, as well as `key` and `children`.
1873
+ * parts could include keys from `constProps`, as well as `key` and `children`.
1535
1874
  *
1536
- * The constant parts are expected to be the same on every render, and are not checked for changes.
1537
- * This means that they are constant scalars or refs. When the ref is a signal or a store, it can
1538
- * still update the attribute on the vnode.
1875
+ * `constProps` cannot include `key` or `children`. The constant parts are expected to be the same
1876
+ * on every render, and are not checked for changes. This means that they are constant scalars or
1877
+ * refs. When the ref is a signal or a store, it can still update the attribute on the vnode.
1539
1878
  *
1540
- * If `children` is defined, any `children` in the props will be ignored.
1879
+ * If `children` or `key` are defined, any `children`/`key` in the props will be ignored.
1541
1880
  *
1542
1881
  * @param type - The tag type
1543
1882
  * @param varProps - The properties of the tag that could change, including children
@@ -1545,11 +1884,15 @@ export declare const _jsxSorted: <T>(type: T, varProps: Props | null, constProps
1545
1884
  * for changes on re-render
1546
1885
  * @internal
1547
1886
  */
1548
- export declare const _jsxSplit: <T extends string | FunctionComponent<any>>(type: T, varProps: Props | null, constProps: Props | null, children: JSXChildren | null | undefined, flags: number, key: string | number | null, dev?: DevJSX) => JSXNodeInternal<T>;
1887
+ export declare const _jsxSplit: <T extends string | FunctionComponent<any>>(type: T, varProps: Props | null, constProps: Props | null, children: JSXChildren | null | undefined, flags: number, key?: string | number | null, dev?: DevJSX) => JSXNodeInternal<T>;
1549
1888
 
1550
1889
  /** @public */
1551
1890
  export declare type JSXTagName = keyof HTMLElementTagNameMap | Omit<string, keyof HTMLElementTagNameMap>;
1552
1891
 
1892
+ declare type JSXWindowEvents = {
1893
+ [K in keyof QwikWindowEventMap as `window:on${PascalCaseName<K>}$`]: QwikWindowEventMap[K];
1894
+ };
1895
+
1553
1896
  /**
1554
1897
  * The names of events that Qwik knows about. They are all lowercase, but on the JSX side, they are
1555
1898
  * PascalCase for nicer DX. (`onAuxClick$` vs `onauxclick$`)
@@ -1558,6 +1901,26 @@ export declare type JSXTagName = keyof HTMLElementTagNameMap | Omit<string, keyo
1558
1901
  */
1559
1902
  export declare type KnownEventNames = LiteralUnion<AllEventKeys, string>;
1560
1903
 
1904
+ /**
1905
+ * Shared lazy-loading reference that holds module loading metadata. Multiple QRLs pointing to the
1906
+ * same chunk+symbol can share a single LazyRef, differing only in their captured scope.
1907
+ */
1908
+ declare class LazyRef<TYPE = unknown> {
1909
+ readonly $chunk$: string | null;
1910
+ readonly $symbol$: string;
1911
+ readonly $symbolFn$: undefined | null | (() => Promise<Record<string, TYPE>>);
1912
+ $ref$?: (null | ValueOrPromise<TYPE>) | undefined;
1913
+ $container$: _Container | undefined;
1914
+ dev?: QRLDev | null | undefined;
1915
+ qrls?: Set<any>;
1916
+ constructor($chunk$: string | null, $symbol$: string, $symbolFn$: undefined | null | (() => Promise<Record<string, TYPE>>), $ref$?: (null | ValueOrPromise<TYPE>) | undefined, container?: _Container | null);
1917
+ /** We don't read hash very often so let's not allocate a string for every QRL */
1918
+ get $hash$(): string;
1919
+ $setRef$(ref: ValueOrPromise<TYPE>): void;
1920
+ /** Load the raw module export without capture binding. */
1921
+ $load$(): ValueOrPromise<TYPE>;
1922
+ }
1923
+
1561
1924
  declare type LcEvent<T extends string, C extends string = Lowercase<T>> = C extends keyof AllEventsMap ? AllEventsMap[C] : Event;
1562
1925
 
1563
1926
  declare type LcEventNameMap = {
@@ -1601,6 +1964,15 @@ declare interface LenientSVGProps<T extends Element> extends SVGAttributes, DOMA
1601
1964
  */
1602
1965
  declare type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
1603
1966
 
1967
+ /** @internal */
1968
+ export declare const _mapApp_findIndx: <T>(array: (T | null)[], key: string, start: number) => number;
1969
+
1970
+ /** @internal */
1971
+ export declare const _mapArray_get: <T>(array: (T | null)[], key: string, start: number) => T | null;
1972
+
1973
+ /** @internal */
1974
+ export declare const _mapArray_set: <T>(array: (T | null)[], key: string, value: T | null, start: number, allowNullValue?: boolean) => void;
1975
+
1604
1976
  declare type MediaSpecialAttrs = {
1605
1977
  crossOrigin?: HTMLCrossOriginAttribute;
1606
1978
  };
@@ -1647,10 +2019,10 @@ declare interface NodePropData {
1647
2019
  }
1648
2020
 
1649
2021
  /** @internal */
1650
- export declare const _noopQrl: <T>(symbolName: string, lexicalScopeCapture?: any[]) => QRL<T>;
2022
+ export declare const _noopQrl: <T>(symbolName: string, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
1651
2023
 
1652
2024
  /** @internal */
1653
- export declare const _noopQrlDEV: <T>(symbolName: string, opts: QRLDev, lexicalScopeCapture?: any[]) => QRL<T>;
2025
+ export declare const _noopQrlDEV: <T>(symbolName: string, opts: QRLDev, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
1654
2026
 
1655
2027
  /**
1656
2028
  * Returned type of the `noSerialize()` function. It will be TYPE or undefined.
@@ -1659,7 +2031,7 @@ export declare const _noopQrlDEV: <T>(symbolName: string, opts: QRLDev, lexicalS
1659
2031
  * @see noSerialize
1660
2032
  */
1661
2033
  export declare type NoSerialize<T> = (T & {
1662
- __no_serialize__: true;
2034
+ __no_serialize__?: true;
1663
2035
  }) | undefined;
1664
2036
 
1665
2037
  /**
@@ -1717,6 +2089,11 @@ export declare interface OnVisibleTaskOptions {
1717
2089
  strategy?: VisibleTaskStrategy;
1718
2090
  }
1719
2091
 
2092
+ /** @internal */
2093
+ declare const _OWNER: unique symbol;
2094
+
2095
+ declare type PascalCaseName<T extends string> = T extends keyof LcEventNameMap ? LcEventNameMap[T] : Capitalize<T>;
2096
+
1720
2097
  /**
1721
2098
  * Capitalized multi-word names of some known events so we have nicer qwik attributes. For example,
1722
2099
  * instead of `oncompositionEnd$` we can use `onCompositionEnd$`. Note that any capitalization
@@ -1724,19 +2101,11 @@ export declare interface OnVisibleTaskOptions {
1724
2101
  *
1725
2102
  * Add any multi-word event names to this list. Single word events are automatically converted.
1726
2103
  */
1727
- declare type PascalCaseNames = 'AnimationEnd' | 'AnimationIteration' | 'AnimationStart' | 'AuxClick' | 'BeforeToggle' | 'CanPlay' | 'CanPlayThrough' | 'CompositionEnd' | 'CompositionStart' | 'CompositionUpdate' | 'ContextMenu' | 'DblClick' | 'DragEnd' | 'DragEnter' | 'DragExit' | 'DragLeave' | 'DragOver' | 'DragStart' | 'DurationChange' | 'FocusIn' | 'FocusOut' | 'FullscreenChange' | 'FullscreenError' | 'GotPointerCapture' | 'KeyDown' | 'KeyPress' | 'KeyUp' | 'LoadedData' | 'LoadedMetadata' | 'LoadEnd' | 'LoadStart' | 'LostPointerCapture' | 'MouseDown' | 'MouseEnter' | 'MouseLeave' | 'MouseMove' | 'MouseOut' | 'MouseOver' | 'MouseUp' | 'PointerCancel' | 'PointerDown' | 'PointerEnter' | 'PointerLeave' | 'PointerMove' | 'PointerOut' | 'PointerOver' | 'PointerUp' | 'QIdle' | 'QInit' | 'QSymbol' | 'QVisible' | 'RateChange' | 'RateChange' | 'SecurityPolicyViolation' | 'SelectionChange' | 'SelectStart' | 'TimeUpdate' | 'TouchCancel' | 'TouchEnd' | 'TouchMove' | 'TouchStart' | 'TransitionCancel' | 'TransitionEnd' | 'TransitionRun' | 'TransitionStart' | 'VisibilityChange' | 'VolumeChange';
1728
-
1729
- /**
1730
- * Convert an event map to PascalCase. For example, `HTMLElementEventMap` contains lowercase keys,
1731
- * so this will capitalize them, and use the `LcEventNameMap` for multi-word events names.
1732
- */
1733
- declare type PascalMap<M> = {
1734
- [K in Extract<keyof M, string> as K extends keyof LcEventNameMap ? LcEventNameMap[K] : Capitalize<K>]: M[K];
1735
- };
2104
+ declare type PascalCaseNames = 'AnimationEnd' | 'AnimationIteration' | 'AnimationStart' | 'AuxClick' | 'BeforeToggle' | 'CanPlay' | 'CanPlayThrough' | 'CompositionEnd' | 'CompositionStart' | 'CompositionUpdate' | 'ContextMenu' | 'DblClick' | 'DragEnd' | 'DragEnter' | 'DragExit' | 'DragLeave' | 'DragOver' | 'DragStart' | 'DurationChange' | 'FocusIn' | 'FocusOut' | 'FullscreenChange' | 'FullscreenError' | 'GotPointerCapture' | 'KeyDown' | 'KeyPress' | 'KeyUp' | 'LoadedData' | 'LoadedMetadata' | 'LoadEnd' | 'LoadStart' | 'LostPointerCapture' | 'MouseDown' | 'MouseEnter' | 'MouseLeave' | 'MouseMove' | 'MouseOut' | 'MouseOver' | 'MouseUp' | 'PointerCancel' | 'PointerDown' | 'PointerEnter' | 'PointerLeave' | 'PointerMove' | 'PointerOut' | 'PointerOver' | 'PointerUp' | 'QIdle' | 'QInit' | 'QResume' | 'QSymbol' | 'QVisible' | 'QViewTransition' | 'RateChange' | 'RateChange' | 'SecurityPolicyViolation' | 'SelectionChange' | 'SelectStart' | 'TimeUpdate' | 'TouchCancel' | 'TouchEnd' | 'TouchMove' | 'TouchStart' | 'TransitionCancel' | 'TransitionEnd' | 'TransitionRun' | 'TransitionStart' | 'VisibilityChange' | 'VolumeChange';
1736
2105
 
1737
2106
  declare type PopoverTargetAction = 'hide' | 'show' | 'toggle';
1738
2107
 
1739
- declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof TaskEvent | typeof RenderEvent | typeof ResourceEvent;
2108
+ declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof TaskEvent | typeof RenderEvent;
1740
2109
 
1741
2110
  /**
1742
2111
  * @deprecated This is no longer needed as the preloading happens automatically in qrl-class. You
@@ -1834,6 +2203,9 @@ export declare type PropFunction<T> = QRL<T>;
1834
2203
 
1835
2204
  declare type Props = Record<string, unknown>;
1836
2205
 
2206
+ /** @internal */
2207
+ declare const _PROPS_HANDLER: unique symbol;
2208
+
1837
2209
  /**
1838
2210
  * Infers `Props` from the component or tag.
1839
2211
  *
@@ -1856,7 +2228,24 @@ export declare type PropsOf<COMP> = COMP extends string ? COMP extends keyof Qwi
1856
2228
  declare type PropsProxy = {
1857
2229
  [_VAR_PROPS]: Props;
1858
2230
  [_CONST_PROPS]: Props | null;
1859
- };
2231
+ [_OWNER]: JSXNodeInternal;
2232
+ [_PROPS_HANDLER]: PropsProxyHandler;
2233
+ } & Record<string | symbol, unknown>;
2234
+
2235
+ declare class PropsProxyHandler implements ProxyHandler<any> {
2236
+ owner: JSXNodeImpl;
2237
+ $effects$: undefined | Map<string | symbol, Set<EffectSubscription>>;
2238
+ $container$: _Container | null;
2239
+ constructor(owner: JSXNodeImpl);
2240
+ get(_: any, prop: string | symbol): any;
2241
+ set(_: any, prop: string | symbol, value: any): boolean;
2242
+ deleteProperty(_: any, prop: string | symbol): boolean;
2243
+ has(_: any, prop: string | symbol): boolean;
2244
+ getOwnPropertyDescriptor(_: any, p: string | symbol): PropertyDescriptor | undefined;
2245
+ ownKeys(): string[];
2246
+ }
2247
+
2248
+ declare type PropType<T extends object, P extends keyof T> = P extends keyof T ? T[P] : 'value' extends keyof T ? T['value'] : never;
1860
2249
 
1861
2250
  /**
1862
2251
  * Extends the defined component PROPS, adding the default ones (children and q:slot) and allowing
@@ -1972,7 +2361,7 @@ export declare interface _QDocument extends Document {
1972
2361
  *
1973
2362
  * ```
1974
2363
  * <div q:base="/build/">
1975
- * <button on:click="./chunk-abc.js#onClick">...</button>
2364
+ * <button q-e:click="./chunk-abc.js#onClick">...</button>
1976
2365
  * </div>
1977
2366
  * ```
1978
2367
  *
@@ -1995,7 +2384,7 @@ export declare interface _QDocument extends Document {
1995
2384
  */
1996
2385
  export declare type QRL<TYPE = unknown> = {
1997
2386
  __qwik_serializable__?: any;
1998
- __brand__QRL__: TYPE;
2387
+ __brand__QRL__?: TYPE;
1999
2388
  /** Resolve the QRL and return the actual value. */
2000
2389
  resolve(): Promise<TYPE>;
2001
2390
  /** The resolved value, once `resolve()` returns. */
@@ -2003,7 +2392,7 @@ export declare type QRL<TYPE = unknown> = {
2003
2392
  getCaptured(): unknown[] | null;
2004
2393
  getSymbol(): string;
2005
2394
  getHash(): string;
2006
- dev: QRLDev | null;
2395
+ dev?: QRLDev | null;
2007
2396
  } & BivariantQrlFn<QrlArgs<TYPE>, QrlReturn<TYPE>>;
2008
2397
 
2009
2398
  /**
@@ -2018,7 +2407,7 @@ export declare type QRL<TYPE = unknown> = {
2018
2407
  * @public
2019
2408
  * @see `QRL`, `$(...)`
2020
2409
  */
2021
- export declare const qrl: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, lexicalScopeCapture?: any[], stackOffset?: number) => QRL<T>;
2410
+ export declare const qrl: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, lexicalScopeCapture?: Readonly<unknown[]> | null, stackOffset?: number) => QRL<T>;
2022
2411
 
2023
2412
  declare type QrlArgs<T> = T extends (...args: infer ARGS) => any ? ARGS : unknown[];
2024
2413
 
@@ -2030,31 +2419,53 @@ declare interface QRLDev {
2030
2419
  }
2031
2420
 
2032
2421
  /** @internal */
2033
- export declare const qrlDEV: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, opts: QRLDev, lexicalScopeCapture?: any[]) => QRL<T>;
2422
+ export declare const qrlDEV: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, opts: QRLDev, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
2034
2423
 
2035
2424
  /**
2036
2425
  * An event handler for Qwik events, can be a handler QRL or an array of handler QRLs.
2037
2426
  *
2038
2427
  * @public
2039
2428
  */
2040
- export declare type QRLEventHandlerMulti<EV extends Event, EL> = QRL<EventHandler<EV, EL>> | undefined | null | QRLEventHandlerMulti<EV, EL>[] | EventHandler<EV, EL>;
2429
+ export declare type QRLEventHandlerMulti<EV extends Event, EL> = QRL<EventHandler<EV, EL>> | undefined | null | QRLEventHandlerMulti<EV, EL>[];
2041
2430
 
2042
- declare type QRLInternal<TYPE = unknown> = QRL<TYPE> & QRLInternalMethods<TYPE>;
2431
+ /** @internal */
2432
+ export declare type _QRLInternal<TYPE = unknown> = QRL<TYPE> & QRLInternalMethods<TYPE>;
2043
2433
 
2044
2434
  declare type QRLInternalMethods<TYPE> = {
2045
2435
  readonly $chunk$: string | null;
2046
2436
  readonly $symbol$: string;
2047
2437
  readonly $hash$: string;
2048
- $capture$: string[] | null;
2049
- $captureRef$: unknown[] | null;
2050
- dev: QRLDev | null;
2438
+ /** If it's a string it's serialized */
2439
+ readonly $captures$?: Readonly<unknown[]> | string | null;
2440
+ dev?: QRLDev | null;
2441
+ resolve(container?: _Container): Promise<TYPE>;
2051
2442
  resolved: undefined | TYPE;
2052
- resolve(containerEl?: Element): Promise<TYPE>;
2053
2443
  getSymbol(): string;
2054
2444
  getHash(): string;
2055
2445
  getCaptured(): unknown[] | null;
2056
- getFn(currentCtx?: InvokeContext | InvokeTuple, beforeFn?: () => void): TYPE extends (...args: any) => any ? (...args: Parameters<TYPE>) => ValueOrPromise<ReturnType<TYPE>> : unknown;
2057
- $setContainer$(containerEl: Element | undefined): Element | undefined;
2446
+ getFn(currentCtx?: InvokeContext,
2447
+ /** If this returns false, the function execution will be skipped */
2448
+ beforeFn?: () => void | false): TYPE extends (...args: any) => any ? (...args: Parameters<TYPE>) => ValueOrPromise<ReturnType<TYPE> | undefined> : unknown;
2449
+ $callFn$(withThis: unknown, ...args: QrlArgs<TYPE>): ValueOrPromise<QrlReturn<TYPE>>;
2450
+ $setDev$(dev: QRLDev | null): void;
2451
+ /**
2452
+ * "with captures" - Get a new QRL for these captures, reusing the lazy ref. It's an internal
2453
+ * method but we need to have a stable name because it gets called in user code by the optimizer,
2454
+ * after the $name$ props are mangled
2455
+ */
2456
+ w(captures: Readonly<unknown[]> | string | null): _QRLInternal<TYPE>;
2457
+ /**
2458
+ * "set ref" - Set the ref of the QRL. It's an internal method but we need to have a stable name
2459
+ * because it gets called in user code by the optimizer, after the $name$ props are mangled
2460
+ */
2461
+ s(ref: ValueOrPromise<TYPE>): void;
2462
+ /**
2463
+ * Needed for deserialization and importing. We don't always have the container while creating
2464
+ * qrls in async sections of code
2465
+ */
2466
+ readonly $container$?: _Container | null;
2467
+ /** The shared lazy-loading reference */
2468
+ readonly $lazy$: LazyRef<TYPE>;
2058
2469
  };
2059
2470
 
2060
2471
  declare type QrlReturn<T> = T extends (...args: any) => infer R ? Awaited<R> : unknown;
@@ -2071,50 +2482,20 @@ declare type QrlReturn<T> = T extends (...args: any) => infer R ? Awaited<R> : u
2071
2482
  */
2072
2483
  export declare const _qrlSync: <TYPE extends Function>(fn: TYPE, serializedFn?: string) => SyncQRL<TYPE>;
2073
2484
 
2485
+ /** @internal */
2486
+ export declare function _qrlToString(serializationContext: SerializationContext, qrl: _QRLInternal | SyncQRLInternal): string;
2487
+
2488
+ /** @internal */
2489
+ export declare function _qrlToString(serializationContext: SerializationContext, qrl: _QRLInternal | SyncQRLInternal, raw: true): [string, string, string | null];
2490
+
2074
2491
  /** @public @deprecated Use `AnimationEvent` and use the second argument to the handler function for the current event target */
2075
2492
  export declare type QwikAnimationEvent<T = Element> = NativeAnimationEvent;
2076
2493
 
2077
- /** @public */
2078
- declare interface QwikAsset {
2079
- /** Name of the asset */
2080
- name: string | undefined;
2081
- /** Size of the asset */
2082
- size: number;
2083
- }
2084
-
2085
2494
  /** The Qwik DOM attributes without plain handlers, for use as function parameters @public */
2086
2495
  export declare interface QwikAttributes<EL extends Element> extends DOMAttributesBase<EL>, QwikEvents<EL, false> {
2087
2496
  class?: ClassList | undefined;
2088
2497
  }
2089
2498
 
2090
- /** @public */
2091
- declare interface QwikBundle {
2092
- /** Size of the bundle */
2093
- size: number;
2094
- /** Total size of this bundle's static import graph */
2095
- total: number;
2096
- /** Interactivity score of the bundle */
2097
- interactivity?: number;
2098
- /** Symbols in the bundle */
2099
- symbols?: string[];
2100
- /** Direct imports */
2101
- imports?: string[];
2102
- /** Dynamic imports */
2103
- dynamicImports?: string[];
2104
- /** Source files of the bundle */
2105
- origins?: string[];
2106
- }
2107
-
2108
- /**
2109
- * Bundle graph.
2110
- *
2111
- * Format: [ 'bundle-a.js', 3, 5 // Depends on 'bundle-b.js' and 'bundle-c.js' 'bundle-b.js', 5, //
2112
- * Depends on 'bundle-c.js' 'bundle-c.js', ]
2113
- *
2114
- * @public
2115
- */
2116
- declare type QwikBundleGraph = Array<string | number>;
2117
-
2118
2499
  /** @public @deprecated Use `Event` and use the second argument to the handler function for the current event target. Also note that in Qwik, onInput$ with the InputEvent is the event that behaves like onChange in React. */
2119
2500
  export declare type QwikChangeEvent<T = Element> = Event;
2120
2501
 
@@ -2124,13 +2505,19 @@ export declare type QwikClipboardEvent<T = Element> = NativeClipboardEvent;
2124
2505
  /** @public @deprecated Use `CompositionEvent` and use the second argument to the handler function for the current event target */
2125
2506
  export declare type QwikCompositionEvent<T = Element> = NativeCompositionEvent;
2126
2507
 
2127
- declare type QwikCustomEvents<EL> = {};
2128
-
2129
2508
  declare type QwikCustomEventsPlain<EL> = {
2130
2509
  /** The handler */
2131
2510
  [key: `${'document:' | 'window:' | ''}on${string}$`]: QRLEventHandlerMulti<Event, EL> | EventHandler<Event, EL>;
2132
2511
  };
2133
2512
 
2513
+ declare type QwikDocumentEventMap = Omit<DocumentEventMap, keyof QwikHTMLElementEventMap> & Omit<QwikHTMLElementEventMap, 'qvisible' | 'focus' | 'blur'> & {
2514
+ qidle: QwikIdleEvent;
2515
+ qinit: QwikInitEvent;
2516
+ qsymbol: QwikSymbolEvent;
2517
+ qresume: QwikResumeEvent;
2518
+ qviewtransition: QwikViewTransitionEvent;
2519
+ };
2520
+
2134
2521
  /** @public */
2135
2522
  export declare interface QwikDOMAttributes extends DOMAttributes<Element> {
2136
2523
  }
@@ -2139,11 +2526,13 @@ export declare interface QwikDOMAttributes extends DOMAttributes<Element> {
2139
2526
  export declare type QwikDragEvent<T = Element> = NativeDragEvent;
2140
2527
 
2141
2528
  /** @public */
2142
- declare type QwikEvents<EL, Plain extends boolean = true> = Plain extends true ? QwikKnownEventsPlain<EL> & QwikCustomEventsPlain<EL> : QwikKnownEvents<EL> & QwikCustomEvents<EL>;
2529
+ declare type QwikEvents<EL, Plain extends boolean = true> = Plain extends true ? QwikKnownEventsPlain<EL> & QwikCustomEventsPlain<EL> : QwikKnownEvents<EL>;
2143
2530
 
2144
2531
  /** @public @deprecated Use `FocusEvent` and use the second argument to the handler function for the current event target */
2145
2532
  export declare type QwikFocusEvent<T = Element> = NativeFocusEvent;
2146
2533
 
2534
+ declare type QwikHTMLElementEventMap = Omit<HTMLElementEventMap, keyof EventCorrectionMap> & EventCorrectionMap;
2535
+
2147
2536
  /**
2148
2537
  * The DOM props without plain handlers, for use inside functions
2149
2538
  *
@@ -2214,71 +2603,18 @@ declare namespace QwikJSX {
2214
2603
  export { QwikJSX as JSX }
2215
2604
  export { QwikJSX }
2216
2605
 
2606
+ declare type QwikJSXEvents = JSXElementEvents & JSXDocumentEvents & JSXWindowEvents;
2607
+
2217
2608
  /** @public @deprecated Use `KeyboardEvent` and use the second argument to the handler function for the current event target */
2218
2609
  export declare type QwikKeyboardEvent<T = Element> = NativeKeyboardEvent;
2219
2610
 
2220
2611
  declare type QwikKnownEvents<EL> = {
2221
- [K in keyof AllPascalEventMaps as `${'document:' | 'window:' | ''}on${K}$`]?: QRLEventHandlerMulti<AllPascalEventMaps[K], EL>;
2612
+ [K in keyof QwikJSXEvents]?: QRLEventHandlerMulti<QwikJSXEvents[K], EL>;
2222
2613
  };
2223
2614
 
2224
2615
  declare type QwikKnownEventsPlain<EL> = {
2225
- [K in keyof AllPascalEventMaps as `${'document:' | 'window:' | ''}on${K}$`]?: QRLEventHandlerMulti<AllPascalEventMaps[K], EL> | EventHandler<AllPascalEventMaps[K], EL>;
2226
- };
2227
-
2228
- /**
2229
- * The metadata of the build. One of its uses is storing where QRL symbols are located.
2230
- *
2231
- * @public
2232
- */
2233
- declare interface QwikManifest {
2234
- /** Content hash of the manifest, if this changes, the code changed */
2235
- manifestHash: string;
2236
- /** QRL symbols */
2237
- symbols: {
2238
- [symbolName: string]: QwikSymbol;
2239
- };
2240
- /** Where QRLs are located. The key is the symbol name, the value is the bundle fileName */
2241
- mapping: {
2242
- [symbolName: string]: string;
2243
- };
2244
- /**
2245
- * All code bundles, used to know the import graph. The key is the bundle fileName relative to
2246
- * "build/"
2247
- */
2248
- bundles: {
2249
- [fileName: string]: QwikBundle;
2250
- };
2251
- /** All assets. The key is the fileName relative to the rootDir */
2252
- assets?: {
2253
- [fileName: string]: QwikAsset;
2254
- };
2255
- /** All bundles in a compact graph format with probabilities */
2256
- bundleGraph?: QwikBundleGraph;
2257
- /** The bundle graph fileName */
2258
- bundleGraphAsset?: string;
2259
- /** The preloader bundle fileName */
2260
- preloader?: string;
2261
- /** The Qwik core bundle fileName */
2262
- core?: string;
2263
- /** The Qwik loader bundle fileName */
2264
- qwikLoader?: string;
2265
- /** CSS etc to inject in the document head */
2266
- injections?: GlobalInjections[];
2267
- /** The version of the manifest */
2268
- version: string;
2269
- /** The options used to build the manifest */
2270
- options?: {
2271
- target?: string;
2272
- buildMode?: string;
2273
- entryStrategy?: {
2274
- type: EntryStrategy['type'];
2275
- };
2276
- };
2277
- /** The platform used to build the manifest */
2278
- platform?: {
2279
- [name: string]: string;
2280
- };
2281
- }
2616
+ [K in keyof QwikJSXEvents]?: QRLEventHandlerMulti<QwikJSXEvents[K], EL> | EventHandler<QwikJSXEvents[K], EL>;
2617
+ };
2282
2618
 
2283
2619
  /** @public @deprecated Use `MouseEvent` and use the second argument to the handler function for the current event target */
2284
2620
  export declare type QwikMouseEvent<T = Element, E = NativeMouseEvent> = E;
@@ -2286,6 +2622,12 @@ export declare type QwikMouseEvent<T = Element, E = NativeMouseEvent> = E;
2286
2622
  /** @public @deprecated Use `PointerEvent` and use the second argument to the handler function for the current event target */
2287
2623
  export declare type QwikPointerEvent<T = Element> = NativePointerEvent;
2288
2624
 
2625
+ /**
2626
+ * Emitted by qwik-core on the container element when it resumes from a paused state. You cannot put
2627
+ * a Qwik event handler on the container so you must listen on the document instead. @public
2628
+ */
2629
+ export declare type QwikResumeEvent = CustomEvent<{}>;
2630
+
2289
2631
  /** @public @deprecated Use `SubmitEvent` and use the second argument to the handler function for the current event target */
2290
2632
  export declare type QwikSubmitEvent<T = Element> = SubmitEvent;
2291
2633
 
@@ -2298,32 +2640,12 @@ export declare type QwikSVGElements = {
2298
2640
  [K in keyof Omit<SVGElementTagNameMap, keyof HTMLElementTagNameMap>]: SVGProps<SVGElementTagNameMap[K]>;
2299
2641
  };
2300
2642
 
2301
- /** @public */
2302
- declare interface QwikSymbol {
2303
- origin: string;
2304
- displayName: string;
2305
- hash: string;
2306
- canonicalFilename: string;
2307
- ctxKind: 'function' | 'eventHandler';
2308
- ctxName: string;
2309
- /** Whether the symbol captures a variable */
2310
- captures: boolean;
2311
- parent: string | null;
2312
- loc: [number, number];
2313
- /** The parameter names if it's a function with parameters */
2314
- paramNames?: string[];
2315
- /** The transformed names of scoped variables, if any */
2316
- captureNames?: string[];
2317
- }
2318
-
2319
- /** Emitted by qwik-loader when a module was lazily loaded @public */
2643
+ /** Emitted by qwik-loader on document when a module was lazily loaded @public */
2320
2644
  export declare type QwikSymbolEvent = CustomEvent<{
2321
2645
  symbol: string;
2322
2646
  element: Element;
2323
2647
  reqTime: number;
2324
2648
  qBase?: string;
2325
- qManifest?: string;
2326
- qVersion?: string;
2327
2649
  href?: string;
2328
2650
  }>;
2329
2651
 
@@ -2337,15 +2659,20 @@ export declare type QwikTransitionEvent<T = Element> = NativeTransitionEvent;
2337
2659
  export declare type QwikUIEvent<T = Element> = NativeUIEvent;
2338
2660
 
2339
2661
  /** Emitted by qwik-core on document when the a view transition start @public */
2340
- declare type QwikViewTransitionEvent = CustomEvent<ViewTransition>;
2662
+ export declare type QwikViewTransitionEvent = CustomEvent<ViewTransition>;
2341
2663
 
2342
- /** Emitted by qwik-loader when an element becomes visible. Used by `useVisibleTask$` @public */
2664
+ /**
2665
+ * Handled by qwik-loader when an element becomes visible. Used by `useVisibleTask$`. Does not
2666
+ * bubble. @public
2667
+ */
2343
2668
  export declare type QwikVisibleEvent = CustomEvent<IntersectionObserverEntry>;
2344
2669
 
2345
2670
  /** @public @deprecated Use `WheelEvent` and use the second argument to the handler function for the current event target */
2346
2671
  export declare type QwikWheelEvent<T = Element> = NativeWheelEvent;
2347
2672
 
2348
- /** @public */
2673
+ declare type QwikWindowEventMap = Omit<WindowEventHandlersEventMap, keyof QwikDocumentEventMap> & QwikDocumentEventMap;
2674
+
2675
+ /** @public @deprecated not used */
2349
2676
  export declare interface ReadonlySignal<T = unknown> {
2350
2677
  readonly value: T;
2351
2678
  }
@@ -2366,9 +2693,21 @@ declare type RefFnInterface<EL> = {
2366
2693
  (el: EL): void;
2367
2694
  };
2368
2695
 
2369
- /** @internal */
2696
+ /**
2697
+ * Register a QRL symbol globally for lookup by its hash. This is used by the optimizer to register
2698
+ * the names passed in `reg_ctx_name`.
2699
+ *
2700
+ * @internal
2701
+ */
2370
2702
  export declare const _regSymbol: (symbol: any, hash: string) => any;
2371
2703
 
2704
+ /**
2705
+ * Remove an external projection from its parent and clean up.
2706
+ *
2707
+ * @internal
2708
+ */
2709
+ export declare function _removeProjection(container: _Container, parentVNode: _VirtualVNode, vnode: _VirtualVNode, slotName: string): void;
2710
+
2372
2711
  /**
2373
2712
  * Render JSX.
2374
2713
  *
@@ -2392,6 +2731,8 @@ export declare const RenderOnce: FunctionComponent<{
2392
2731
  key?: string | number | null | undefined;
2393
2732
  }>;
2394
2733
 
2734
+ /** @internal */
2735
+ /** @internal */
2395
2736
  /** @public */
2396
2737
  export declare interface RenderOptions {
2397
2738
  serverData?: Record<string, any>;
@@ -2412,82 +2753,61 @@ export declare interface RenderSSROptions {
2412
2753
  manifestHash: string;
2413
2754
  }
2414
2755
 
2415
- /** @public */
2416
- declare interface ResolvedManifest {
2417
- mapper: SymbolMapper;
2418
- manifest: ServerQwikManifest;
2419
- injections?: GlobalInjections[];
2420
- bundleGraph?: QwikBundleGraph;
2421
- }
2422
-
2423
2756
  /**
2424
- * This method works like an async memoized function that runs whenever some tracked value changes
2425
- * and returns some data.
2426
- *
2427
- * `useResource` however returns immediate a `ResourceReturn` object that contains the data and a
2428
- * state that indicates if the data is available or not.
2429
- *
2430
- * The status can be one of the following:
2431
- *
2432
- * - `pending` - the data is not yet available.
2433
- * - `resolved` - the data is available.
2434
- * - `rejected` - the data is not available due to an error or timeout.
2435
- *
2436
- * Be careful when using a `try/catch` statement in `useResource$`. If you catch the error and don't
2437
- * re-throw it (or a new Error), the resource status will never be `rejected`.
2438
- *
2439
- * ### Example
2440
- *
2441
- * Example showing how `useResource` to perform a fetch to request the weather, whenever the input
2442
- * city name changes.
2757
+ * Resumes selected state (e.g. polling AsyncSignals) by deserializing captures. Used for
2758
+ * document:onQIdle to resume async signals with active polling.
2443
2759
  *
2760
+ * @internal
2761
+ */
2762
+ export declare function _res(this: string | undefined, _: any, element: Element): void;
2763
+
2764
+ /** @internal */
2765
+ export declare const _resolveContextWithoutSequentialScope: <STATE>(context: ContextId<STATE>) => STATE | undefined;
2766
+
2767
+ /**
2444
2768
  * ```tsx
2445
2769
  * const Cmp = component$(() => {
2446
- * const cityS = useSignal('');
2770
+ * const city = useSignal('');
2447
2771
  *
2448
- * const weatherResource = useResource$(async ({ track, cleanup }) => {
2449
- * const cityName = track(cityS);
2450
- * const abortController = new AbortController();
2451
- * cleanup(() => abortController.abort('cleanup'));
2772
+ * const weather = useAsync$(async ({ track, cleanup, abortSignal }) => {
2773
+ * const cityName = track(city);
2452
2774
  * const res = await fetch(`http://weatherdata.com?city=${cityName}`, {
2453
- * signal: abortController.signal,
2775
+ * signal: abortSignal,
2454
2776
  * });
2455
- * const data = await res.json();
2456
- * return data as { temp: number };
2777
+ * const temp = (await res.json()) as { temp: number };
2778
+ * return temp;
2457
2779
  * });
2458
2780
  *
2459
2781
  * return (
2460
2782
  * <div>
2461
- * <input name="city" bind:value={cityS} />
2462
- * <Resource
2463
- * value={weatherResource}
2464
- * onResolved={(weather) => {
2465
- * return <div>Temperature: {weather.temp}</div>;
2466
- * }}
2467
- * />
2783
+ * <input name="city" bind:value={city} />
2784
+ * <div>
2785
+ * Temperature:{' '}
2786
+ * {weather.loading
2787
+ * ? 'Loading...'
2788
+ * : weather.error
2789
+ * ? `Error: ${weather.error.message}`
2790
+ * : weather.value.temp}
2791
+ * </div>
2468
2792
  * </div>
2469
2793
  * );
2470
2794
  * });
2471
2795
  * ```
2472
2796
  *
2797
+ * @deprecated Use `useAsync$` instead, which is more efficient, and has a more flexible API. Just
2798
+ * read the `loading` and `error` properties from the returned signal to determine the status.
2473
2799
  * @public
2474
- * @see Resource
2475
- * @see ResourceReturn
2476
2800
  */
2477
- export declare const Resource: <T>(props: ResourceProps<T>) => JSXOutput;
2801
+ export declare const Resource: <T>({ value, onResolved, onPending, onRejected, }: ResourceProps<T>) => JSXOutput;
2478
2802
 
2479
2803
  /** @public */
2480
- export declare interface ResourceCtx<T> {
2481
- readonly track: Tracker;
2482
- cleanup(callback: () => void): void;
2804
+ export declare interface ResourceCtx<T = unknown> extends AsyncCtx<T> {
2805
+ /** @deprecated Does not do anything */
2483
2806
  cache(policyOrMilliseconds: number | 'immutable'): void;
2484
- readonly previous: T | undefined;
2485
2807
  }
2486
2808
 
2487
- declare const ResourceEvent = "qResource";
2488
-
2489
2809
  /** @public */
2490
- export declare type ResourceFn<T> = (ctx: ResourceCtx<unknown>) => ValueOrPromise<T>;
2810
+ export declare type ResourceFn<T> = (ctx: ResourceCtx) => ValueOrPromise<T>;
2491
2811
 
2492
2812
  /**
2493
2813
  * Options to pass to `useResource$()`
@@ -2504,71 +2824,64 @@ export declare interface ResourceOptions {
2504
2824
  }
2505
2825
 
2506
2826
  /** @public */
2507
- export declare interface ResourcePending<T> {
2508
- readonly value: Promise<T>;
2509
- readonly loading: boolean;
2510
- }
2827
+ export declare type ResourcePending<T> = ResourceReturn<T>;
2511
2828
 
2512
2829
  /** @public */
2513
2830
  export declare interface ResourceProps<T> {
2514
2831
  readonly value: ResourceReturn<T> | Signal<Promise<T> | T> | Promise<T>;
2515
- onResolved: (value: T) => JSXOutput;
2516
- onPending?: () => JSXOutput;
2517
- onRejected?: (reason: Error) => JSXOutput;
2832
+ onResolved: (value: T) => JSXOutput | Promise<JSXOutput>;
2833
+ onPending?: () => JSXOutput | Promise<JSXOutput>;
2834
+ onRejected?: (reason: Error) => JSXOutput | Promise<JSXOutput>;
2518
2835
  }
2519
2836
 
2520
2837
  /** @public */
2521
- export declare interface ResourceRejected<T> {
2522
- readonly value: Promise<T>;
2523
- readonly loading: boolean;
2524
- }
2838
+ export declare type ResourceRejected<T> = ResourceReturn<T>;
2525
2839
 
2526
2840
  /** @public */
2527
- export declare interface ResourceResolved<T> {
2528
- readonly value: Promise<T>;
2529
- readonly loading: boolean;
2530
- }
2841
+ export declare type ResourceResolved<T> = ResourceReturn<T>;
2531
2842
 
2532
2843
  /** @public */
2533
- export declare type ResourceReturn<T> = ResourcePending<T> | ResourceResolved<T> | ResourceRejected<T>;
2844
+ export declare type ResourceReturn<T> = {
2845
+ readonly value: Promise<T>;
2846
+ readonly loading: boolean;
2847
+ };
2534
2848
 
2535
2849
  declare interface ResourceReturnInternal<T> {
2536
2850
  __brand: 'resource';
2537
- _state: 'pending' | 'resolved' | 'rejected';
2538
- _resolved: T | undefined;
2539
- _error: Error | undefined;
2540
- _cache: number;
2541
- _timeout: number;
2542
2851
  value: Promise<T>;
2543
2852
  loading: boolean;
2853
+ signal: AsyncSignal<{
2854
+ r: T;
2855
+ }>;
2544
2856
  }
2545
2857
 
2546
2858
  /** @internal */
2547
- export declare const _restProps: (props: PropsProxy, omit: string[], target?: Props) => Props;
2859
+ export declare const _restProps: (props: PropsProxy, omit?: string[], target?: Props) => Props;
2548
2860
 
2549
2861
  /**
2550
- * This is called by qwik-loader to schedule a QRL. It has to be synchronous.
2862
+ * The resource function wrapper
2551
2863
  *
2552
2864
  * @internal
2553
2865
  */
2554
- export declare const _run: (...args: unknown[]) => ValueOrPromise_2<void>;
2866
+ export declare const _rsc: <T>(arg: ResourceCtx<T>) => Promise<{
2867
+ r: T;
2868
+ }>;
2555
2869
 
2556
- declare type Scheduler = ReturnType<typeof createScheduler>;
2870
+ /**
2871
+ * This is called by qwik-loader to run a QRL. It has to be synchronous when possible.
2872
+ *
2873
+ * @internal
2874
+ */
2875
+ export declare function _run(this: string, event: Event, element: Element): ValueOrPromise<unknown>;
2557
2876
 
2877
+ /** Stores the location of an object. If no parent, it's a root. */
2558
2878
  declare type SeenRef = {
2559
- $parent$: unknown | null;
2560
2879
  $index$: number;
2561
- $rootIndex$: number;
2880
+ $parent$?: SeenRef | null;
2562
2881
  };
2563
2882
 
2564
- /** @public */
2565
- declare interface SegmentEntryStrategy {
2566
- type: 'segment';
2567
- manual?: Record<string, string>;
2568
- }
2569
-
2570
2883
  declare interface SerializationContext {
2571
- $serialize$: () => void;
2884
+ $serialize$: () => ValueOrPromise<void>;
2572
2885
  $symbolToChunkResolver$: SymbolToChunkResolver;
2573
2886
  /**
2574
2887
  * Map from object to parent and index reference.
@@ -2580,49 +2893,64 @@ declare interface SerializationContext {
2580
2893
  * - `{ parent, index }` - The parent object and the index within that parent.
2581
2894
  * - `undefined` - Object has not been seen yet.
2582
2895
  */
2583
- $wasSeen$: (obj: unknown) => SeenRef | undefined;
2896
+ getSeenRef: (obj: unknown) => SeenRef | undefined;
2897
+ /** Returns the root index of the object, if it is a root. Otherwise returns undefined. */
2584
2898
  $hasRootId$: (obj: unknown) => number | undefined;
2585
2899
  /**
2586
2900
  * Root objects which need to be serialized.
2587
2901
  *
2588
2902
  * Roots are entry points into the object graph. Typically the roots are held by the listeners.
2589
2903
  *
2590
- * Returns a path string representing the path from roots through all parents to the object.
2591
- * Format: "3 2 0" where each number is the index within its parent, from root to leaf.
2592
- */
2593
- $addRoot$: (obj: unknown, parent?: unknown) => number;
2594
- /**
2595
- * Get root path of the object without creating a new root.
2596
- *
2597
- * This is used during serialization, as new roots can't be created during serialization.
2598
- *
2599
- * The function throws if the root was not found.
2904
+ * Returns the index of the root object.
2600
2905
  */
2601
- $addRootPath$: (obj: any) => string | number;
2602
- $seen$: (obj: unknown, parent: unknown | null, index: number) => void;
2906
+ $addRoot$: AddRootFn;
2907
+ /** Mark an object as seen during serialization. This is used to handle backreferences and cycles */
2908
+ $markSeen$: (obj: unknown, parent: SeenRef | undefined, index: number) => SeenRef;
2603
2909
  $roots$: unknown[];
2604
- $pathMap$: Map<unknown, string | number>;
2910
+ $promoteToRoot$: (ref: SeenRef, index?: number) => void;
2605
2911
  $addSyncFn$($funcStr$: string | null, argsCount: number, fn: Function): number;
2606
2912
  $isSsrNode$: (obj: unknown) => obj is SsrNode;
2607
2913
  $isDomRef$: (obj: unknown) => obj is DomRef;
2608
- $writer$: StreamWriter_2;
2914
+ $writer$: StreamWriter;
2609
2915
  $syncFns$: string[];
2610
2916
  $eventQrls$: Set<QRL>;
2611
2917
  $eventNames$: Set<string>;
2612
- $resources$: Set<ResourceReturnInternal<unknown>>;
2613
2918
  $renderSymbols$: Set<string>;
2614
2919
  $storeProxyMap$: ObjToProxyMap;
2615
- $getProp$: (obj: any, prop: string) => any;
2920
+ $eagerResume$: Set<unknown>;
2616
2921
  $setProp$: (obj: any, prop: string, value: any) => void;
2617
2922
  }
2618
2923
 
2924
+ declare const enum SerializationSignalFlags {
2925
+ SERIALIZATION_STRATEGY_NEVER = 8,
2926
+ SERIALIZATION_STRATEGY_ALWAYS = 16,
2927
+ SERIALIZATION_ALL_STRATEGIES = 24
2928
+ }
2929
+
2930
+ /**
2931
+ * Serialization strategy for computed and async signals. This determines whether to serialize their
2932
+ * value during SSR.
2933
+ *
2934
+ * - `never`: The value is never serialized. When the component is resumed, the value will be
2935
+ * recalculated when it is first read.
2936
+ * - `always`: The value is always serialized. This is the default.
2937
+ *
2938
+ * **IMPORTANT**: When you use `never`, your serialized HTML is smaller, but the recalculation will
2939
+ * trigger subscriptions, meaning that other signals using this signal will recalculate, even if
2940
+ * this signal didn't change.
2941
+ *
2942
+ * This is normally not a problem, but for async signals it may mean fetching something again.
2943
+ *
2944
+ * @public
2945
+ */
2946
+ export declare type SerializationStrategy = 'never' | 'always';
2947
+
2619
2948
  /**
2620
2949
  * Serialize data to string using SerializationContext.
2621
2950
  *
2622
- * @param data - Data to serialize
2623
2951
  * @internal
2624
2952
  */
2625
- export declare function _serialize(data: unknown[]): Promise<string>;
2953
+ export declare function _serialize<T>(data: T): Promise<string>;
2626
2954
 
2627
2955
  /**
2628
2956
  * Serialize and deserialize custom objects.
@@ -2685,9 +3013,9 @@ declare interface SerializerSignal<T> extends ComputedSignal<T> {
2685
3013
  * @public
2686
3014
  */
2687
3015
  declare class SerializerSignalImpl<T, S> extends ComputedSignalImpl<T> {
2688
- constructor(container: Container | null, argQrl: QRLInternal<SerializerArg<T, S>>);
3016
+ constructor(container: _Container | null, argQrl: _QRLInternal<SerializerArg<T, S>>);
2689
3017
  $didInitialize$: boolean;
2690
- $computeIfNeeded$(): boolean;
3018
+ $computeIfNeeded$(): void;
2691
3019
  }
2692
3020
 
2693
3021
  /**
@@ -2708,12 +3036,8 @@ declare class SerializerSignalImpl<T, S> extends ComputedSignalImpl<T> {
2708
3036
  */
2709
3037
  export declare const SerializerSymbol: unique symbol;
2710
3038
 
2711
- /**
2712
- * The manifest values that are needed for SSR.
2713
- *
2714
- * @public
2715
- */
2716
- declare type ServerQwikManifest = Pick<QwikManifest, 'manifestHash' | 'injections' | 'bundleGraph' | 'bundleGraphAsset' | 'mapping' | 'preloader' | 'core' | 'qwikLoader'>;
3039
+ /** @internal */
3040
+ export declare function _setEvent(serializationCtx: SerializationContext, key: string, rawValue: unknown, hasMovedCaptures: boolean): string | null;
2717
3041
 
2718
3042
  /**
2719
3043
  * Sets the `CorePlatform`.
@@ -2727,10 +3051,19 @@ declare type ServerQwikManifest = Pick<QwikManifest, 'manifestHash' | 'injection
2727
3051
  */
2728
3052
  export declare const setPlatform: (plt: CorePlatform) => CorePlatform;
2729
3053
 
3054
+ /**
3055
+ * Set the DOM target element for an external projection VNode.
3056
+ *
3057
+ * When the cursor walker processes this VNode, DOM operations will target this element instead of
3058
+ * walking the parent chain.
3059
+ *
3060
+ * @internal
3061
+ */
3062
+ export declare function _setProjectionTarget(vnode: _VirtualVNode, targetElement: Element): void;
3063
+
2730
3064
  /** @internal */
2731
- export declare abstract class _SharedContainer implements Container {
3065
+ export declare abstract class _SharedContainer implements _Container {
2732
3066
  readonly $version$: string;
2733
- readonly $scheduler$: Scheduler;
2734
3067
  readonly $storeProxyMap$: ObjToProxyMap;
2735
3068
  readonly $locale$: string;
2736
3069
  readonly $getObjectById$: (id: number | string) => any;
@@ -2738,7 +3071,10 @@ export declare abstract class _SharedContainer implements Container {
2738
3071
  $currentUniqueId$: number;
2739
3072
  $instanceHash$: string | null;
2740
3073
  $buildBase$: string | null;
2741
- constructor(scheduleDrain: () => void, journalFlush: () => void, serverData: Record<string, any>, locale: string);
3074
+ $renderPromise$: Promise<void> | null;
3075
+ $resolveRenderPromise$: (() => void) | null;
3076
+ $pendingCount$: number;
3077
+ constructor(serverData: Record<string, any>, locale: string);
2742
3078
  trackSignalValue<T>(signal: Signal, subscriber: HostElement, property: string, data: _SubscriptionData): T;
2743
3079
  serializationCtxFactory(NodeConstructor: {
2744
3080
  new (...rest: any[]): {
@@ -2749,8 +3085,9 @@ export declare abstract class _SharedContainer implements Container {
2749
3085
  __brand__: 'DomRef';
2750
3086
  };
2751
3087
  } | null, symbolToChunkResolver: SymbolToChunkResolver, writer?: StreamWriter): SerializationContext;
3088
+ $checkPendingCount$(): void;
2752
3089
  abstract ensureProjectionResolved(host: HostElement): void;
2753
- abstract handleError(err: any, $host$: HostElement): void;
3090
+ abstract handleError(err: any, $host$: HostElement | null): void;
2754
3091
  abstract getParentHost(host: HostElement): HostElement | null;
2755
3092
  abstract setContext<T>(host: HostElement, context: ContextId<T>, value: T): void;
2756
3093
  abstract resolveContext<T>(host: HostElement, contextId: ContextId<T>): T | undefined;
@@ -2771,20 +3108,37 @@ export declare abstract class _SharedContainer implements Container {
2771
3108
  *
2772
3109
  * @public
2773
3110
  */
2774
- export declare interface Signal<T = any> extends ReadonlySignal<T> {
3111
+ export declare interface Signal<T = any> {
3112
+ /** Reading from this subscribes to updates; writing to this triggers updates. */
2775
3113
  value: T;
3114
+ /** Reading from this does not subscribe to updates; writing to this does not trigger updates. */
3115
+ untrackedValue: T;
3116
+ /**
3117
+ * Use this to trigger running subscribers, for example when the value mutated but remained the
3118
+ * same object.
3119
+ */
3120
+ trigger(): void;
2776
3121
  }
2777
3122
 
2778
3123
  declare const enum SignalFlags {
2779
- INVALID = 1
3124
+ INVALID = 1,
3125
+ RUN_EFFECTS = 2
2780
3126
  }
2781
3127
 
2782
3128
  declare class SignalImpl<T = any> implements Signal<T> {
2783
3129
  $untrackedValue$: T;
2784
3130
  /** Store a list of effects which are dependent on this signal. */
2785
- $effects$: null | Set<EffectSubscription>;
2786
- $container$: Container | null;
2787
- constructor(container: Container | null, value: T);
3131
+ $effects$: undefined | Set<EffectSubscription>;
3132
+ $container$: _Container | null;
3133
+ $wrappedSignal$: WrappedSignalImpl<T> | null;
3134
+ constructor(container: _Container | null | undefined, value: T);
3135
+ /**
3136
+ * Use this to trigger running subscribers, for example when the calculated value has mutated but
3137
+ * remained the same object
3138
+ */
3139
+ trigger(): void;
3140
+ /** @deprecated Use `trigger()` instead */
3141
+ force(): void;
2788
3142
  get untrackedValue(): T;
2789
3143
  set untrackedValue(value: T);
2790
3144
  get value(): T;
@@ -2802,12 +3156,6 @@ declare interface SimplifiedServerRequestEvent<T = unknown> {
2802
3156
  request: Request;
2803
3157
  }
2804
3158
 
2805
- /** @public */
2806
- declare interface SingleEntryStrategy {
2807
- type: 'single';
2808
- manual?: Record<string, string>;
2809
- }
2810
-
2811
3159
  /** @public */
2812
3160
  declare type Size = number | string;
2813
3161
 
@@ -2825,12 +3173,6 @@ export declare const Slot: FunctionComponent<{
2825
3173
  children?: JSXChildren;
2826
3174
  }>;
2827
3175
 
2828
- /** @public */
2829
- declare interface SmartEntryStrategy {
2830
- type: 'smart';
2831
- manual?: Record<string, string>;
2832
- }
2833
-
2834
3176
  /** @public */
2835
3177
  export declare interface SnapshotListener {
2836
3178
  key: string;
@@ -3071,39 +3413,36 @@ declare type SpecialAttrs = {
3071
3413
  [key: string]: {};
3072
3414
  };
3073
3415
 
3074
- declare type SsrAttrKey = string;
3075
-
3076
- declare type SsrAttrs = Array<SsrAttrKey | SsrAttrValue>;
3077
-
3078
- declare type SsrAttrValue = string | Signal<any> | boolean | object | null;
3079
-
3080
3416
  /** @public */
3081
3417
  export declare const SSRComment: FunctionComponent<{
3082
3418
  data: string;
3083
3419
  }>;
3084
3420
 
3085
- declare interface SSRContainer extends Container {
3421
+ declare interface SSRContainer extends _Container {
3086
3422
  readonly tag: string;
3087
3423
  readonly isHtml: boolean;
3424
+ readonly size: number;
3088
3425
  readonly writer: StreamWriter;
3426
+ readonly streamHandler: IStreamHandler;
3089
3427
  readonly serializationCtx: SerializationContext;
3090
3428
  readonly symbolToChunkResolver: SymbolToChunkResolver;
3091
3429
  readonly resolvedManifest: ResolvedManifest;
3092
3430
  additionalHeadNodes: Array<JSXNodeInternal>;
3093
3431
  additionalBodyNodes: Array<JSXNodeInternal>;
3094
- unclaimedProjectionComponentFrameQueue: ISsrComponentFrame[];
3432
+ $noScriptHere$: number;
3433
+ write(text: string): void;
3095
3434
  openContainer(): void;
3096
3435
  closeContainer(): ValueOrPromise<void>;
3097
- openElement(elementName: string, varAttrs: SsrAttrs | null, constAttrs?: SsrAttrs | null, currentFile?: string | null): string | undefined;
3436
+ openElement(elementName: string, key: string | null, varAttrs: Props, constAttrs: Props | null, styleScopedId: string | null, currentFile: string | null, hasMovedCaptures?: boolean): string | undefined;
3098
3437
  closeElement(): ValueOrPromise<void>;
3099
- openFragment(attrs: SsrAttrs): void;
3438
+ openFragment(attrs: Props): void;
3100
3439
  closeFragment(): void;
3101
- openProjection(attrs: SsrAttrs): void;
3440
+ openProjection(attrs: Props): void;
3102
3441
  closeProjection(): void;
3103
- openComponent(attrs: SsrAttrs): void;
3442
+ openComponent(attrs: Props): void;
3104
3443
  getComponentFrame(projectionDepth: number): ISsrComponentFrame | null;
3105
3444
  getParentComponentFrame(): ISsrComponentFrame | null;
3106
- closeComponent(): void;
3445
+ closeComponent(): Promise<void>;
3107
3446
  textNode(text: string): void;
3108
3447
  htmlNode(rawHtml: string): void;
3109
3448
  commentNode(text: string): void;
@@ -3112,8 +3451,14 @@ declare interface SSRContainer extends Container {
3112
3451
  addUnclaimedProjection(frame: ISsrComponentFrame, name: string, children: JSXChildren): void;
3113
3452
  isStatic(): boolean;
3114
3453
  render(jsx: JSXOutput): Promise<void>;
3454
+ renderJSX(jsx: JSXOutput, options: {
3455
+ currentStyleScoped: string | null;
3456
+ parentComponentFrame: ISsrComponentFrame | null;
3457
+ }): Promise<void>;
3115
3458
  emitPreloaderPre(): void;
3116
3459
  emitQwikLoaderAtTopIfNeeded(): void;
3460
+ emitPatchDataIfNeeded(): void;
3461
+ addBackpatchEntry(ssrNodeId: string, attrName: string, serializedValue: string | boolean | null): void;
3117
3462
  }
3118
3463
 
3119
3464
  /** @public */
@@ -3129,6 +3474,10 @@ declare type SsrNode = {
3129
3474
  [_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | null;
3130
3475
  };
3131
3476
 
3477
+ declare const enum SsrNodeFlags {
3478
+ Updatable = 1
3479
+ }
3480
+
3132
3481
  /** @public */
3133
3482
  export declare const SSRRaw: FunctionComponent<{
3134
3483
  data: string;
@@ -3143,38 +3492,22 @@ export declare const SSRStreamBlock: FunctionComponent<{
3143
3492
  }>;
3144
3493
 
3145
3494
  /** @public */
3146
- export declare type SSRStreamChildren = AsyncGenerator<JSXChildren, void, any> | ((stream: StreamWriter) => Promise<void>) | (() => AsyncGenerator<JSXChildren, void, any>);
3495
+ export declare type SSRStreamChildren = AsyncGenerator<JSXChildren, void, any> | ((stream: SSRStreamWriter) => Promise<void>) | (() => AsyncGenerator<JSXChildren, void, any>);
3147
3496
 
3148
3497
  /** @public */
3149
3498
  export declare type SSRStreamProps = {
3150
3499
  children: SSRStreamChildren;
3151
3500
  };
3152
3501
 
3502
+ /** @public */
3503
+ export declare interface SSRStreamWriter {
3504
+ write(chunk: JSXOutput): void;
3505
+ }
3506
+
3153
3507
  declare type StopPropagation = {
3154
3508
  [K in keyof HTMLElementEventMap as `stoppropagation:${K}`]?: boolean;
3155
3509
  };
3156
3510
 
3157
- declare const enum StoreFlags {
3158
- NONE = 0,
3159
- RECURSIVE = 1,
3160
- IMMUTABLE = 2
3161
- }
3162
-
3163
- declare class StoreHandler implements ProxyHandler<StoreTarget> {
3164
- $flags$: StoreFlags;
3165
- $container$: Container | null;
3166
- $effects$: null | Map<string | symbol, Set<EffectSubscription>>;
3167
- constructor($flags$: StoreFlags, $container$: Container | null);
3168
- toString(): string;
3169
- get(target: StoreTarget, prop: string | symbol): any;
3170
- /** In the case of oldValue and value are the same, the effects are not triggered. */
3171
- set(target: StoreTarget, prop: string | symbol, value: any): boolean;
3172
- deleteProperty(target: StoreTarget, prop: string | symbol): boolean;
3173
- has(target: StoreTarget, prop: string | symbol): boolean;
3174
- ownKeys(target: StoreTarget): ArrayLike<string | symbol>;
3175
- getOwnPropertyDescriptor(target: StoreTarget, prop: string | symbol): PropertyDescriptor | undefined;
3176
- }
3177
-
3178
3511
  declare type StoreTarget = Record<string | symbol, any>;
3179
3512
 
3180
3513
  /** @internal */
@@ -3464,9 +3797,6 @@ export declare interface SVGAttributes<T extends Element = Element> extends Aria
3464
3797
  export declare interface SVGProps<T extends Element> extends SVGAttributes, QwikAttributes<T> {
3465
3798
  }
3466
3799
 
3467
- /** @public */
3468
- declare type SymbolMapper = Record<string, readonly [symbol: string, chunk: string]>;
3469
-
3470
3800
  declare type SymbolToChunkResolver = (symbol: string) => string;
3471
3801
 
3472
3802
  /**
@@ -3480,18 +3810,19 @@ declare type SymbolToChunkResolver = (symbol: string) => string;
3480
3810
  */
3481
3811
  export declare const sync$: <T extends Function>(fn: T) => SyncQRL<T>;
3482
3812
 
3813
+ declare const SYNC_QRL = "<sync>";
3814
+
3483
3815
  /** @public */
3484
- export declare interface SyncQRL<TYPE extends Function = any> extends QRL<TYPE> {
3816
+ export declare type SyncQRL<TYPE extends Function> = QRL<TYPE> & {
3485
3817
  __brand__SyncQRL__: TYPE;
3486
- /**
3487
- * Resolve the QRL of closure and invoke it.
3488
- *
3489
- * @param args - Closure arguments.
3490
- * @returns A return value of the closure.
3491
- */
3492
- (...args: TYPE extends (...args: infer ARGS) => any ? ARGS : never): TYPE extends (...args: any[]) => infer RETURN ? RETURN : never;
3493
3818
  resolved: TYPE;
3494
- dev: QRLDev | null;
3819
+ dev?: QRLDev | null;
3820
+ } & BivariantQrlFn<QrlArgs<TYPE>, QrlReturn<TYPE>>;
3821
+
3822
+ declare type SyncQRLInternal = _QRLInternal & SyncQRLSymbol;
3823
+
3824
+ declare interface SyncQRLSymbol {
3825
+ $symbol$: typeof SYNC_QRL;
3495
3826
  }
3496
3827
 
3497
3828
  declare type TableCellSpecialAttrs = {
@@ -3501,49 +3832,49 @@ declare type TableCellSpecialAttrs = {
3501
3832
  valign?: 'top' | 'middle' | 'bottom' | 'baseline' | undefined;
3502
3833
  };
3503
3834
 
3504
- declare class Task<T = unknown, B = T> extends BackRef implements DescriptorBase<unknown, Signal<B> | ResourceReturnInternal<B>> {
3835
+ declare class Task<T = unknown, B = T> extends BackRef implements DescriptorBase<unknown, Signal<B>> {
3505
3836
  $flags$: number;
3506
3837
  $index$: number;
3507
3838
  $el$: HostElement;
3508
- $qrl$: QRLInternal<T>;
3509
- $state$: Signal<B> | ResourceReturnInternal<B> | undefined;
3510
- $destroy$: NoSerialize<() => void> | null;
3511
- constructor($flags$: number, $index$: number, $el$: HostElement, $qrl$: QRLInternal<T>, $state$: Signal<B> | ResourceReturnInternal<B> | undefined, $destroy$: NoSerialize<() => void> | null);
3839
+ $qrl$: _QRLInternal<T>;
3840
+ $state$: Signal<B> | undefined;
3841
+ $destroy$: (() => void) | null;
3842
+ $destroyPromise$: Promise<void> | undefined;
3843
+ $taskPromise$: Promise<void> | null;
3844
+ constructor($flags$: number, $index$: number, $el$: HostElement, $qrl$: _QRLInternal<T>, $state$: Signal<B> | undefined, $destroy$: (() => void) | null);
3512
3845
  }
3513
3846
 
3514
3847
  /**
3515
- * Used internally as a qrl event handler to schedule a task.
3848
+ * Used internally as a qwikloader event handler to schedule a task. The `this` context is the
3849
+ * captures part of the QRL, provided by qwikloader.
3516
3850
  *
3517
3851
  * @internal
3518
3852
  */
3519
- export declare const _task: (_event: Event, element: Element) => void;
3853
+ export declare function _task(this: string, _event: Event, element: Element): void;
3520
3854
 
3521
3855
  /** @public */
3522
3856
  export declare interface TaskCtx {
3523
3857
  track: Tracker;
3524
- cleanup: (callback: () => void) => void;
3858
+ cleanup: (callback: () => ValueOrPromise<void>) => void;
3525
3859
  }
3526
3860
 
3527
3861
  declare const TaskEvent = "qTask";
3528
3862
 
3529
3863
  /** @public */
3530
- export declare type TaskFn = (ctx: TaskCtx) => ValueOrPromise<void | (() => void)>;
3864
+ export declare type TaskFn = (ctx: TaskCtx) => ValueOrPromise<void | (() => ValueOrPromise<void>)>;
3865
+
3866
+ /** @public */
3867
+ export declare interface TaskOptions {
3868
+ /** Block the rendering of the component until the task completes. Default is `true` */
3869
+ deferUpdates?: boolean;
3870
+ }
3531
3871
 
3532
3872
  /** @internal */
3533
- export declare type _TextVNode = [
3534
- _VNodeFlags.Text | _VNodeFlags.Inflated,
3535
- // 0 - Flags
3536
- _VNode | null,
3537
- ///////////////// 1 - Parent
3538
- _VNode | null,
3539
- ///////////////// 2 - Previous sibling
3540
- _VNode | null,
3541
- ///////////////// 3 - Next sibling
3542
- Text | null | undefined,
3543
- string
3544
- ] & {
3545
- __brand__: 'TextVNode';
3546
- };
3873
+ export declare class _TextVNode extends _VNode {
3874
+ node: Text | null;
3875
+ text: string | undefined;
3876
+ constructor(flags: _VNodeFlags, parent: _VNode | null, previousSibling: _VNode | null | undefined, nextSibling: _VNode | null | undefined, props: Props | null, node: Text | null, text: string | undefined);
3877
+ }
3547
3878
 
3548
3879
  /**
3549
3880
  * Used to signal to Qwik which state should be watched for changes.
@@ -3564,6 +3895,8 @@ string
3564
3895
  * useTask$(({ track }) => {
3565
3896
  * // Any signals or stores accessed inside the task will be tracked
3566
3897
  * const count = track(() => store.count);
3898
+ * // For stores you can also pass the store and specify the property
3899
+ * track(store, 'count');
3567
3900
  * // You can also pass a signal to track() directly
3568
3901
  * const signalCount = track(signal);
3569
3902
  * store.doubleCount = count + signalCount;
@@ -3630,12 +3963,22 @@ export declare interface Tracker {
3630
3963
  <T extends object, P extends keyof T>(obj: T, prop: P): T[P];
3631
3964
  }
3632
3965
 
3966
+ /** @internal */
3967
+ export declare const _UNINITIALIZED: unique symbol;
3968
+
3633
3969
  /**
3634
- * Don't track listeners for this callback
3970
+ * Get the value of the expression without tracking listeners. A function will be invoked, signals
3971
+ * will return their value, and stores will be unwrapped (they return the backing object).
3972
+ *
3973
+ * When you pass a function, you can also pass additional arguments that the function will receive.
3974
+ *
3975
+ * Note that stores are not unwrapped recursively.
3635
3976
  *
3977
+ * @param expr - The function or object to evaluate without tracking.
3978
+ * @param args - Additional arguments to pass when `expr` is a function.
3636
3979
  * @public
3637
3980
  */
3638
- export declare const untrack: <T>(fn: () => T) => T;
3981
+ export declare const untrack: <T, A extends any[]>(expr: ((...args: A) => T) | Signal<T> | T, ...args: A) => T;
3639
3982
 
3640
3983
  declare type UnwantedKeys = keyof HTMLAttributesBase | keyof DOMAttributes<any> | keyof ARIAMixin | keyof GlobalEventHandlers | 'enterKeyHint' | 'innerText' | 'innerHTML' | 'outerHTML' | 'inputMode' | 'outerText' | 'nodeValue' | 'textContent';
3641
3984
 
@@ -3648,19 +3991,37 @@ declare type UnwantedKeys = keyof HTMLAttributesBase | keyof DOMAttributes<any>
3648
3991
  export declare const unwrapStore: <T>(value: T) => T;
3649
3992
 
3650
3993
  /**
3651
- * Creates a computed signal which is calculated from the given function. A computed signal is a
3652
- * signal which is calculated from other signals. When the signals change, the computed signal is
3653
- * recalculated, and if the result changed, all tasks which are tracking the signal will be re-run
3654
- * and all components that read the signal will be re-rendered.
3994
+ * Update the props on an external projection VNode and trigger re-rendering.
3655
3995
  *
3656
- * The function must be synchronous and must not have any side effects.
3996
+ * @internal
3997
+ */
3998
+ export declare function _updateProjectionProps(container: _Container, vnode: _VirtualVNode, newProps: Record<string, unknown>): void;
3999
+
4000
+ /**
4001
+ * Creates an AsyncSignal which holds the result of the given async function. If the function uses
4002
+ * `track()` to track reactive state, and that state changes, the AsyncSignal is recalculated, and
4003
+ * if the result changed, all tasks which are tracking the AsyncSignal will be re-run and all
4004
+ * subscribers (components, tasks etc) that read the AsyncSignal will be updated.
4005
+ *
4006
+ * If the async function throws an error, the AsyncSignal will capture the error and set the `error`
4007
+ * property. The error can be cleared by re-running the async function successfully.
4008
+ *
4009
+ * While the async function is running, the `loading` property will be set to `true`. Once the
4010
+ * function completes, `loading` will be set to `false`.
4011
+ *
4012
+ * If the value has not yet been resolved, reading the AsyncSignal will throw a Promise, which will
4013
+ * retry the component or task once the value resolves.
4014
+ *
4015
+ * If the value has been resolved, but the async function is re-running, reading the AsyncSignal
4016
+ * will subscribe to it and return the last resolved value until the new value is ready. As soon as
4017
+ * the new value is ready, the subscribers will be updated.
3657
4018
  *
3658
4019
  * @public
3659
4020
  */
3660
- export declare const useAsyncComputed$: <T>(qrl: AsyncComputedFn<T>) => AsyncComputedReturnType<T>;
4021
+ export declare const useAsync$: <T>(qrl: AsyncFn<T>, options?: AsyncSignalOptions<T> | undefined) => AsyncSignal<T>;
3661
4022
 
3662
4023
  /** @internal */
3663
- export declare const useAsyncComputedQrl: <T>(qrl: QRL<AsyncComputedFn<T>>) => AsyncComputedReturnType<T>;
4024
+ export declare const useAsyncQrl: <T>(qrl: QRL<AsyncFn<T>>, options?: AsyncSignalOptions<T>) => AsyncSignal<T>;
3664
4025
 
3665
4026
  /**
3666
4027
  * Creates a computed signal which is calculated from the given function. A computed signal is a
@@ -3672,20 +4033,32 @@ export declare const useAsyncComputedQrl: <T>(qrl: QRL<AsyncComputedFn<T>>) => A
3672
4033
  *
3673
4034
  * @public
3674
4035
  */
3675
- export declare const useComputed$: <T>(qrl: ComputedFn<T>) => ComputedReturnType<T>;
4036
+ export declare const useComputed$: <T>(qrl: ComputedFn<T>, options?: ComputedOptions | undefined) => ComputedReturnType<T>;
3676
4037
 
3677
4038
  /** @internal */
3678
- export declare const useComputedQrl: <T>(qrl: QRL<ComputedFn<T>>) => ComputedReturnType<T>;
4039
+ export declare const useComputedQrl: <T>(qrl: QRL<ComputedFn<T>>, options?: ComputedOptions) => ComputedReturnType<T>;
3679
4040
 
3680
4041
  /**
3681
4042
  * Stores a value which is retained for the lifetime of the component. Subsequent calls to
3682
4043
  * `useConstant` will always return the first value given.
3683
4044
  *
3684
- * If the value is a function, the function is invoked once to calculate the actual value.
4045
+ * If the value is a function, the function is invoked once to calculate the actual value. You can
4046
+ * then also pass arguments to call the function with, so that you don't need to create a new
4047
+ * function on every render.
4048
+ *
4049
+ * @example
4050
+ *
4051
+ * ```tsx
4052
+ * const fixedRandomValue = useConstant(() => Math.random);
4053
+ * const otherFixedRandomValue = useConstant(Math.random);
4054
+ *
4055
+ * const getConfig = (env: string) => { ... }
4056
+ * const config = useConstant(getConfig, environment);
4057
+ * ```
3685
4058
  *
3686
4059
  * @public
3687
4060
  */
3688
- export declare const useConstant: <T>(value: (() => T) | T) => T;
4061
+ export declare const useConstant: <T, A extends any[]>(value: ((...args: A) => T) | T, ...args: A) => T;
3689
4062
 
3690
4063
  declare interface UseContext {
3691
4064
  <STATE, T>(context: ContextId<STATE>, transformer: (value: STATE) => T): T;
@@ -3797,6 +4170,14 @@ export declare const useContextProvider: <STATE>(context: ContextId<STATE>, newV
3797
4170
  /** @public */
3798
4171
  export declare const useErrorBoundary: () => ErrorBoundaryStore;
3799
4172
 
4173
+ /**
4174
+ * Injected by the optimizer into component$ bodies in HMR mode. Registers a document event listener
4175
+ * that triggers component re-render on HMR updates.
4176
+ *
4177
+ * @internal
4178
+ */
4179
+ export declare function _useHmr(devPath: string): void;
4180
+
3800
4181
  /** @public */
3801
4182
  export declare const useId: () => string;
3802
4183
 
@@ -3808,6 +4189,7 @@ export declare const useId: () => string;
3808
4189
  * NOTE: `useLexicalScope` method can only be used in the synchronous portion of the callback
3809
4190
  * (before any `await` statements.)
3810
4191
  *
4192
+ * @deprecated Use `_captures` instead.
3811
4193
  * @internal
3812
4194
  */
3813
4195
  export declare const useLexicalScope: <VARS extends any[]>() => VARS;
@@ -3818,6 +4200,8 @@ export declare const useLexicalScope: <VARS extends any[]>() => VARS;
3818
4200
  * Used to programmatically add event listeners. Useful from custom `use*` methods, which do not
3819
4201
  * have access to the JSX. Otherwise, it's adding a JSX listener in the `<div>` is a better idea.
3820
4202
  *
4203
+ * Events are case sensitive.
4204
+ *
3821
4205
  * @public
3822
4206
  * @see `useOn`, `useOnWindow`, `useOnDocument`.
3823
4207
  */
@@ -3829,6 +4213,8 @@ export declare const useOn: <T extends KnownEventNames>(event: T | T[], eventQrl
3829
4213
  * Used to programmatically add event listeners. Useful from custom `use*` methods, which do not
3830
4214
  * have access to the JSX.
3831
4215
  *
4216
+ * Events are case sensitive.
4217
+ *
3832
4218
  * @public
3833
4219
  * @see `useOn`, `useOnWindow`, `useOnDocument`.
3834
4220
  *
@@ -3856,6 +4242,8 @@ export declare const useOnDocument: <T extends KnownEventNames>(event: T | T[],
3856
4242
  * Used to programmatically add event listeners. Useful from custom `use*` methods, which do not
3857
4243
  * have access to the JSX.
3858
4244
  *
4245
+ * Events are case sensitive.
4246
+ *
3859
4247
  * @public
3860
4248
  * @see `useOn`, `useOnWindow`, `useOnDocument`.
3861
4249
  *
@@ -3894,45 +4282,15 @@ export declare const useOnWindow: <T extends KnownEventNames>(event: T | T[], ev
3894
4282
  * Be careful when using a `try/catch` statement in `useResource$`. If you catch the error and don't
3895
4283
  * re-throw it (or a new Error), the resource status will never be `rejected`.
3896
4284
  *
3897
- * ### Example
3898
- *
3899
- * Example showing how `useResource` to perform a fetch to request the weather, whenever the input
3900
- * city name changes.
3901
- *
3902
- * ```tsx
3903
- * const Cmp = component$(() => {
3904
- * const cityS = useSignal('');
3905
- *
3906
- * const weatherResource = useResource$(async ({ track, cleanup }) => {
3907
- * const cityName = track(cityS);
3908
- * const abortController = new AbortController();
3909
- * cleanup(() => abortController.abort('cleanup'));
3910
- * const res = await fetch(`http://weatherdata.com?city=${cityName}`, {
3911
- * signal: abortController.signal,
3912
- * });
3913
- * const data = await res.json();
3914
- * return data as { temp: number };
3915
- * });
3916
- *
3917
- * return (
3918
- * <div>
3919
- * <input name="city" bind:value={cityS} />
3920
- * <Resource
3921
- * value={weatherResource}
3922
- * onResolved={(weather) => {
3923
- * return <div>Temperature: {weather.temp}</div>;
3924
- * }}
3925
- * />
3926
- * </div>
3927
- * );
3928
- * });
3929
- * ```
3930
- *
4285
+ * @deprecated Use `useAsync$` instead, which is more powerful and flexible. `useResource$` is still
4286
+ * available for backward compatibility but it is recommended to migrate to `useAsync$` for new
4287
+ * code and when updating existing code.
3931
4288
  * @public
4289
+ * @see useAsync$
3932
4290
  * @see Resource
3933
4291
  * @see ResourceReturn
3934
4292
  */
3935
- export declare const useResource$: <T>(generatorFn: ResourceFn<T>, opts?: ResourceOptions) => ResourceReturn<T>;
4293
+ export declare const useResource$: <T>(qrl: ResourceFn<T>, opts?: ResourceOptions | undefined) => ResourceReturn<T>;
3936
4294
 
3937
4295
  /** @internal */
3938
4296
  export declare const useResourceQrl: <T>(qrl: QRL<ResourceFn<T>>, opts?: ResourceOptions) => ResourceReturn<T>;
@@ -4001,7 +4359,7 @@ export declare const useResourceQrl: <T>(qrl: QRL<ResourceFn<T>>, opts?: Resourc
4001
4359
  export declare const useSerializer$: typeof createSerializer$;
4002
4360
 
4003
4361
  /** @internal */
4004
- export declare const useSerializerQrl: <T, S>(qrl: QRL<SerializerArg<T, S>>) => ReadonlySignal_2<unknown>;
4362
+ export declare const useSerializerQrl: <T, S>(qrl: QRL<SerializerArg<T, S>>) => SerializerSignalImpl<T, S>;
4005
4363
 
4006
4364
  /** @public */
4007
4365
  export declare function useServerData<T>(key: string): T | undefined;
@@ -4015,14 +4373,61 @@ export declare interface UseSignal {
4015
4373
  <T>(value: T | (() => T)): Signal<T>;
4016
4374
  }
4017
4375
 
4018
- /** @public */
4376
+ /**
4377
+ * Creates an object with a single reactive `.value` property, that Qwik can track across
4378
+ * serializations.
4379
+ *
4380
+ * Use it to create state for your application. The object has a getter and setter to track reads
4381
+ * and writes of the `.value` property. When the value changes, any functions that read from it will
4382
+ * re-run.
4383
+ *
4384
+ * Prefer `useSignal` over `useStore` when possible, as it is more efficient.
4385
+ *
4386
+ * ### Example
4387
+ *
4388
+ * ```tsx
4389
+ * const Signals = component$(() => {
4390
+ * const counter = useSignal(1);
4391
+ * const text = useSignal('changeme');
4392
+ * const toggle = useSignal(false);
4393
+ *
4394
+ * // useSignal() can also accept a function to calculate the initial value
4395
+ * const state = useSignal(() => {
4396
+ * return expensiveInitialValue();
4397
+ * });
4398
+ *
4399
+ * return (
4400
+ * <div>
4401
+ * <button onClick$={() => counter.value++}>Counter: {counter.value}</button>
4402
+ * {
4403
+ * // pass signal values as the value, the optimizer will make it pass the signal
4404
+ * }
4405
+ * <Child state={state.value} />
4406
+ * {
4407
+ * // signals can be bound to inputs. A property named `bind:x` implies that the property
4408
+ * is a signal
4409
+ * }
4410
+ * <input type="text" bind:value={text} />
4411
+ * <input type="checkbox" bind:checked={toggle} />
4412
+ * </div>
4413
+ * );
4414
+ * });
4415
+ * ```
4416
+ *
4417
+ * @public
4418
+ */
4019
4419
  export declare const useSignal: UseSignal;
4020
4420
 
4021
4421
  /**
4022
- * Creates an object that Qwik can track across serializations.
4422
+ * Creates a reactive object that Qwik can track across serialization.
4423
+ *
4424
+ * Use it to create state for your application. The returned object is a Proxy that tracks reads and
4425
+ * writes. When any of the properties change, the functions that read those properties will re-run.
4426
+ *
4427
+ * `Store`s are deep by default, meaning that any objects assigned to properties will also become
4428
+ * `Store`s. This includes arrays.
4023
4429
  *
4024
- * Use `useStore` to create a state for your application. The returned object is a proxy that has a
4025
- * unique ID. The ID of the object is used in the `QRL`s to refer to the store.
4430
+ * Prefer `useSignal` over `useStore` when possible, as it is more efficient.
4026
4431
  *
4027
4432
  * ### Example
4028
4433
  *
@@ -4202,10 +4607,10 @@ export declare const useStylesScopedQrl: (styles: QRL<string>) => UseStylesScope
4202
4607
  * @public
4203
4608
  * @see `Tracker`
4204
4609
  */
4205
- export declare const useTask$: (fn: TaskFn) => void;
4610
+ export declare const useTask$: (fn: TaskFn, opts?: TaskOptions) => void;
4206
4611
 
4207
4612
  /** @internal */
4208
- export declare const useTaskQrl: (qrl: QRL<TaskFn>) => void;
4613
+ export declare const useTaskQrl: (qrl: QRL<TaskFn>, opts?: TaskOptions) => void;
4209
4614
 
4210
4615
  /**
4211
4616
  * ```tsx
@@ -4235,6 +4640,13 @@ export declare const useVisibleTask$: (fn: TaskFn, opts?: OnVisibleTaskOptions)
4235
4640
  /** @internal */
4236
4641
  export declare const useVisibleTaskQrl: (qrl: QRL<TaskFn>, opts?: OnVisibleTaskOptions) => void;
4237
4642
 
4643
+ /**
4644
+ * Handles events for bind:value
4645
+ *
4646
+ * @internal
4647
+ */
4648
+ export declare function _val(this: string | undefined, _: any, element: HTMLInputElement): void;
4649
+
4238
4650
  /**
4239
4651
  * Type representing a value which is either resolve or a promise.
4240
4652
  *
@@ -4249,38 +4661,59 @@ export declare const _VAR_PROPS: unique symbol;
4249
4661
  export declare const _verifySerializable: <T>(value: T, preMessage?: string) => T;
4250
4662
 
4251
4663
  /**
4252
- * 2.0.0-beta.3-dev+aa098fc
4664
+ * 2.0.0-beta.31-dev+906321a
4253
4665
  *
4254
4666
  * @public
4255
4667
  */
4256
4668
  export declare const version: string;
4257
4669
 
4258
4670
  /** @internal */
4259
- export declare type _VirtualVNode = [
4260
- _VNodeFlags.Virtual,
4261
- ///////////// 0 - Flags
4262
- _VNode | null,
4263
- /////////////// 1 - Parent
4264
- _VNode | null,
4265
- /////////////// 2 - Previous sibling
4266
- _VNode | null,
4267
- /////////////// 3 - Next sibling
4268
- _VNode | null,
4269
- /////////////// 4 - First child
4270
- _VNode | null,
4271
- (string | null | boolean)[]
4272
- ] & {
4273
- __brand__: 'FragmentNode' & 'HostElement';
4274
- };
4671
+ export declare class _VirtualVNode extends _VNode {
4672
+ key: string | null;
4673
+ firstChild: _VNode | null | undefined;
4674
+ lastChild: _VNode | null | undefined;
4675
+ constructor(key: string | null, flags: _VNodeFlags, parent: _ElementVNode | _VirtualVNode | null, previousSibling: _VNode | null | undefined, nextSibling: _VNode | null | undefined, props: Props | null, firstChild: _VNode | null | undefined, lastChild: _VNode | null | undefined);
4676
+ }
4275
4677
 
4276
4678
  /** @public */
4277
4679
  export declare type VisibleTaskStrategy = 'intersection-observer' | 'document-ready' | 'document-idle';
4278
4680
 
4279
4681
  /** @internal */
4280
- export declare type _VNode = _ElementVNode | _TextVNode | _VirtualVNode;
4682
+ export declare abstract class _VNode implements BackRef {
4683
+ flags: _VNodeFlags;
4684
+ parent: _VNode | null;
4685
+ previousSibling: _VNode | null | undefined;
4686
+ nextSibling: _VNode | null | undefined;
4687
+ props: Props | null;
4688
+ [_EFFECT_BACK_REF]: Map<any, any> | undefined;
4689
+ slotParent: _VNode | null;
4690
+ dirty: ChoreBits;
4691
+ dirtyChildren: _VNode[] | null;
4692
+ nextDirtyChildIndex: number;
4693
+ constructor(flags: _VNodeFlags, parent: _VNode | null, previousSibling: _VNode | null | undefined, nextSibling: _VNode | null | undefined, props: Props | null);
4694
+ toString(): string;
4695
+ }
4696
+
4697
+ /** @internal */
4698
+ export declare const _vnode_ensureElementInflated: (container: _Container, vnode: _VNode) => void;
4699
+
4700
+ /** @internal */
4701
+ export declare const _vnode_getAttrKeys: (container: _Container, vnode: _ElementVNode | _VirtualVNode) => string[];
4702
+
4703
+ /** @internal */
4704
+ export declare const _vnode_getFirstChild: (vnode: _VNode) => _VNode | null;
4281
4705
 
4282
4706
  /** @internal */
4283
- export declare function _vnode_toString(this: _VNode | null, depth?: number, offset?: string, materialize?: boolean, siblings?: boolean, colorize?: boolean): string;
4707
+ export declare const _vnode_isMaterialized: (vNode: _VNode) => boolean;
4708
+
4709
+ /** @internal */
4710
+ export declare const _vnode_isTextVNode: (vNode: _VNode) => vNode is _TextVNode;
4711
+
4712
+ /** @internal */
4713
+ export declare const _vnode_isVirtualVNode: (vNode: _VNode) => vNode is _VirtualVNode;
4714
+
4715
+ /** @internal */
4716
+ export declare function _vnode_toString(this: _VNode | null, depth?: number, offset?: string, materialize?: boolean, siblings?: boolean, colorize?: boolean, container?: _Container | null): string;
4284
4717
 
4285
4718
  /**
4286
4719
  * Array of numbers which describes virtual nodes in the tree.
@@ -4309,7 +4742,7 @@ export declare function _vnode_toString(this: _VNode | null, depth?: number, off
4309
4742
  * this data needs to be serialized into a string and stored in the DOM as a script tag which has
4310
4743
  * deferent serialization format.
4311
4744
  */
4312
- declare type VNodeData = [VNodeDataFlag, ...(SsrAttrs | number)[]];
4745
+ declare type VNodeData = [VNodeDataFlag, ...(Props | number)[]];
4313
4746
 
4314
4747
  /**
4315
4748
  * Flags for VNodeData (Flags con be bitwise combined)
@@ -4348,40 +4781,26 @@ export declare const enum _VNodeFlags {
4348
4781
  Element = 1,
4349
4782
  Virtual = 2,
4350
4783
  ELEMENT_OR_VIRTUAL_MASK = 3,
4784
+ Text = 4,
4351
4785
  ELEMENT_OR_TEXT_MASK = 5,
4352
4786
  TYPE_MASK = 7,
4353
4787
  INFLATED_TYPE_MASK = 15,
4354
- Text = 4,
4355
4788
  Inflated = 8,
4356
4789
  Resolved = 16,
4357
4790
  Deleted = 32,
4358
- NAMESPACE_MASK = 192,
4359
- NEGATED_NAMESPACE_MASK = -193,
4791
+ HasIterationItems = 64,
4792
+ InflatedIterationItems = 128,
4793
+ Cursor = 256,
4794
+ NAMESPACE_MASK = 1536,
4795
+ NEGATED_NAMESPACE_MASK = -1537,
4360
4796
  NS_html = 0,// http://www.w3.org/1999/xhtml
4361
- NS_svg = 64,// http://www.w3.org/2000/svg
4362
- NS_math = 128
4363
- }
4364
-
4365
- declare type VNodeJournal = Array<VNodeJournalOpCode | Document | Element | Text | string | boolean | null>;
4366
-
4367
- /**
4368
- * Fundamental DOM operations are:
4369
- *
4370
- * - Insert new DOM element/text
4371
- * - Remove DOM element/text
4372
- * - Set DOM element attributes
4373
- * - Set text node value
4374
- */
4375
- declare const enum VNodeJournalOpCode {
4376
- SetText = 1,// ------ [SetAttribute, target, text]
4377
- SetAttribute = 2,// - [SetAttribute, target, ...(key, values)]]
4378
- HoistStyles = 3,// -- [HoistStyles, document]
4379
- Remove = 4,// ------- [Insert, target(parent), ...nodes]
4380
- Insert = 5
4797
+ NS_svg = 512,// http://www.w3.org/2000/svg
4798
+ NS_math = 1024,// http://www.w3.org/1998/Math/MathML
4799
+ HasTargetElement = 2048
4381
4800
  }
4382
4801
 
4383
4802
  /** @internal */
4384
- export declare const _waitUntilRendered: (elm: Element) => Promise<void>;
4803
+ export declare const _waitUntilRendered: (container: _Container) => Promise<void>;
4385
4804
 
4386
4805
  /** @internal */
4387
4806
  export declare function _walkJSX(ssr: SSRContainer, value: JSXOutput, options: {
@@ -4389,9 +4808,6 @@ export declare function _walkJSX(ssr: SSRContainer, value: JSXOutput, options: {
4389
4808
  parentComponentFrame: ISsrComponentFrame | null;
4390
4809
  }): Promise<void>;
4391
4810
 
4392
- /** @internal */
4393
- export declare const _weakSerialize: <T extends object>(input: T) => Partial<T>;
4394
-
4395
4811
  /**
4396
4812
  * Override the `getLocale` with `lang` within the `fn` execution.
4397
4813
  *
@@ -4399,27 +4815,24 @@ export declare const _weakSerialize: <T extends object>(input: T) => Partial<T>;
4399
4815
  */
4400
4816
  export declare function withLocale<T>(locale: string, fn: () => T): T;
4401
4817
 
4818
+ declare type WrappedProp<T extends object, P extends keyof T> = T extends Signal ? WrappedSignalImpl<PropType<T, P>> : PropType<T, P>;
4819
+
4402
4820
  declare const enum WrappedSignalFlags {
4403
- UNWRAP = 2
4821
+ UNWRAP = 4
4404
4822
  }
4405
4823
 
4406
- declare class WrappedSignalImpl<T> extends SignalImpl<T> implements BackRef {
4824
+ declare class WrappedSignalImpl<T> extends SignalImpl<T> {
4407
4825
  $args$: any[];
4408
4826
  $func$: (...args: any[]) => T;
4409
4827
  $funcStr$: string | null;
4410
4828
  $flags$: AllSignalFlags;
4411
- $hostElement$: HostElement | null;
4412
- $forceRunEffects$: boolean;
4413
- [_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | null;
4414
- constructor(container: Container | null, fn: (...args: any[]) => T, args: any[], fnStr: string | null, flags?: SignalFlags);
4415
- $invalidate$(): void;
4416
- /**
4417
- * Use this to force running subscribers, for example when the calculated value has mutated but
4418
- * remained the same object.
4419
- */
4420
- force(): void;
4829
+ $hostElement$: HostElement | undefined;
4830
+ [_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
4831
+ constructor(container: _Container | null, fn: (...args: any[]) => T, args: any[], fnStr: string | null, flags?: SignalFlags);
4832
+ invalidate(): void;
4421
4833
  get untrackedValue(): T;
4422
- $computeIfNeeded$(): boolean;
4834
+ $computeIfNeeded$(): void;
4835
+ $unwrapIfSignal$(): SignalImpl<T> | WrappedSignalImpl<T>;
4423
4836
  set value(_: any);
4424
4837
  get value(): any;
4425
4838
  }
@@ -4435,12 +4848,9 @@ declare class WrappedSignalImpl<T> extends SignalImpl<T> implements BackRef {
4435
4848
  *
4436
4849
  * @internal
4437
4850
  */
4438
- export declare const _wrapProp: <T extends Record<any, any>, P extends keyof T>(...args: [T, P?]) => any;
4851
+ export declare const _wrapProp: <T extends object, P extends keyof T>(...args: [T, P?]) => WrappedProp<T, P>;
4439
4852
 
4440
4853
  /** @internal @deprecated v1 compat */
4441
- export declare const _wrapSignal: <T extends Record<any, any>, P extends keyof T>(obj: T, prop: P) => any;
4442
-
4443
- /** @internal */
4444
- export declare const _wrapStore: <T extends Record<any, any>, P extends keyof T>(obj: T, prop: P) => Signal<T>;
4854
+ export declare const _wrapSignal: <T extends object, P extends keyof T>(obj: T, prop: P) => T[P] | WrappedProp<T, P>;
4445
4855
 
4446
4856
  export { }