@qwik.dev/core 2.0.0-beta.30 → 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.
@@ -380,6 +380,8 @@ declare type AsyncCtx<T = unknown> = {
380
380
  readonly abortSignal: AbortSignal;
381
381
  /** The result of the previous computation, if any */
382
382
  readonly previous: T | undefined;
383
+ /** Extra info passed to `invalidate(info)` for this computation, if any. */
384
+ readonly info: unknown;
383
385
  };
384
386
 
385
387
  /**
@@ -394,6 +396,8 @@ export declare type AsyncFn<T> = (ctx: AsyncCtx) => ValueOrPromise<T>;
394
396
  /** Retains job metadata and also serves as the argument for the compute function */
395
397
  declare class AsyncJob<T> implements AsyncCtx<T> {
396
398
  readonly $signal$: AsyncSignalImpl<T>;
399
+ readonly info: unknown;
400
+ readonly $infoVersion$: number;
397
401
  /** First holds the compute promise and then the cleanup promise */
398
402
  $promise$: Promise<void> | null;
399
403
  $cleanupRequested$: boolean;
@@ -401,7 +405,7 @@ declare class AsyncJob<T> implements AsyncCtx<T> {
401
405
  $track$: AsyncCtx<T>['track'] | undefined;
402
406
  $cleanups$: Parameters<AsyncCtx<T>['cleanup']>[0][] | undefined;
403
407
  $abortController$: AbortController | undefined;
404
- constructor($signal$: AsyncSignalImpl<T>);
408
+ constructor($signal$: AsyncSignalImpl<T>, info: unknown, $infoVersion$: number);
405
409
  get track(): AsyncCtx<T>['track'];
406
410
  get abortSignal(): AbortSignal;
407
411
  /** Backward compatible cache method for resource */
@@ -453,14 +457,22 @@ export declare interface AsyncSignal<T = unknown> extends ComputedSignal<T> {
453
457
  */
454
458
  error: Error | undefined;
455
459
  /**
456
- * Poll interval in ms. Writable and immediately effective when the signal has consumers. If set
457
- * to `0`, polling stops.
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.
458
465
  */
459
466
  interval: number;
460
467
  /** A promise that resolves when the value is computed or rejected. */
461
468
  promise(): Promise<void>;
462
469
  /** Abort the current computation and run cleanups if needed. */
463
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;
464
476
  }
465
477
 
466
478
  declare const enum AsyncSignalFlags {
@@ -485,12 +497,27 @@ declare class AsyncSignalImpl<T> extends ComputedSignalImpl<T, AsyncQRL<T>> impl
485
497
  $concurrency$: number;
486
498
  $interval$: number;
487
499
  $timeoutMs$: number | undefined;
500
+ $info$: unknown;
501
+ $infoVersion$: number;
488
502
  $pollTimeoutId$: ReturnType<typeof setTimeout> | undefined;
489
503
  $computationTimeoutId$: ReturnType<typeof setTimeout> | undefined;
490
504
  [_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
491
505
  constructor(container: _Container | null, fn: AsyncQRL<T>, flags?: SignalFlags | SerializationSignalFlags, options?: AsyncSignalOptions<T>);
492
506
  get untrackedValue(): T;
493
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);
494
521
  /**
495
522
  * Loading is true if the signal is still waiting for the promise to resolve, false if the promise
496
523
  * has resolved or rejected.
@@ -508,7 +535,7 @@ declare class AsyncSignalImpl<T> extends ComputedSignalImpl<T, AsyncQRL<T>> impl
508
535
  get interval(): number;
509
536
  set interval(value: number);
510
537
  /** Invalidates the signal, causing it to re-compute its value. */
511
- invalidate(): Promise<void>;
538
+ invalidate(info?: unknown): Promise<void>;
512
539
  /** Abort the current computation and run cleanups if needed. */
513
540
  abort(reason?: any): void;
514
541
  /** Schedule eager cleanup on next macro task if no subscribers remain. */
@@ -554,10 +581,12 @@ export declare interface AsyncSignalOptions<T> extends ComputedOptions {
554
581
  */
555
582
  awaitPrevious?: boolean;
556
583
  /**
557
- * In the browser, re-run the function after `interval` ms if subscribers exist, even when no
558
- * input state changed. If `0`, does not poll.
584
+ * Controls staleness and polling behavior.
559
585
  *
560
- * Defaults to `0`.
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.
561
590
  */
562
591
  interval?: number;
563
592
  /**
@@ -630,7 +659,8 @@ declare const enum ChoreBits {
630
659
  CHILDREN = 32,
631
660
  CLEANUP = 64,
632
661
  RECONCILE = 128,
633
- DIRTY_MASK = 255
662
+ ERROR_WRAP = 256,
663
+ DIRTY_MASK = 511
634
664
  }
635
665
 
636
666
  /**
@@ -1439,11 +1469,18 @@ export { h }
1439
1469
  export declare const _hasStoreEffects: (value: StoreTarget, prop: keyof StoreTarget) => boolean;
1440
1470
 
1441
1471
  /**
1442
- * HMR event handler. Replaces the component QRL with a fresh one and marks dirty.
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.
1443
1477
  *
1444
1478
  * @internal
1445
1479
  */
1446
- export declare const _hmr: (event: Event, element: Element) => void;
1480
+ export declare const _hmr: (this: string | undefined, event: CustomEvent<{
1481
+ files: string[];
1482
+ t: number;
1483
+ }>, element: Element) => void;
1447
1484
 
1448
1485
  declare type HostElement = _VNode | ISsrNode;
1449
1486
 
@@ -1875,6 +1912,7 @@ declare class LazyRef<TYPE = unknown> {
1875
1912
  $ref$?: (null | ValueOrPromise<TYPE>) | undefined;
1876
1913
  $container$: _Container | undefined;
1877
1914
  dev?: QRLDev | null | undefined;
1915
+ qrls?: Set<any>;
1878
1916
  constructor($chunk$: string | null, $symbol$: string, $symbolFn$: undefined | null | (() => Promise<Record<string, TYPE>>), $ref$?: (null | ValueOrPromise<TYPE>) | undefined, container?: _Container | null);
1879
1917
  /** We don't read hash very often so let's not allocate a string for every QRL */
1880
1918
  get $hash$(): string;
@@ -2409,6 +2447,7 @@ declare type QRLInternalMethods<TYPE> = {
2409
2447
  /** If this returns false, the function execution will be skipped */
2410
2448
  beforeFn?: () => void | false): TYPE extends (...args: any) => any ? (...args: Parameters<TYPE>) => ValueOrPromise<ReturnType<TYPE> | undefined> : unknown;
2411
2449
  $callFn$(withThis: unknown, ...args: QrlArgs<TYPE>): ValueOrPromise<QrlReturn<TYPE>>;
2450
+ $setDev$(dev: QRLDev | null): void;
2412
2451
  /**
2413
2452
  * "with captures" - Get a new QRL for these captures, reusing the lazy ref. It's an internal
2414
2453
  * method but we need to have a stable name because it gets called in user code by the optimizer,
@@ -3390,6 +3429,7 @@ declare interface SSRContainer extends _Container {
3390
3429
  readonly resolvedManifest: ResolvedManifest;
3391
3430
  additionalHeadNodes: Array<JSXNodeInternal>;
3392
3431
  additionalBodyNodes: Array<JSXNodeInternal>;
3432
+ $noScriptHere$: number;
3393
3433
  write(text: string): void;
3394
3434
  openContainer(): void;
3395
3435
  closeContainer(): ValueOrPromise<void>;
@@ -4621,7 +4661,7 @@ export declare const _VAR_PROPS: unique symbol;
4621
4661
  export declare const _verifySerializable: <T>(value: T, preMessage?: string) => T;
4622
4662
 
4623
4663
  /**
4624
- * 2.0.0-beta.30-dev+5421ed4
4664
+ * 2.0.0-beta.31-dev+906321a
4625
4665
  *
4626
4666
  * @public
4627
4667
  */