@qwik.dev/core 2.0.0-beta.21 → 2.0.0-beta.24
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.
- package/bindings/qwik.darwin-arm64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/dist/backpatch/package.json +1 -1
- package/dist/build/package.json +1 -1
- package/dist/cli.mjs +7714 -431
- package/dist/core-internal.d.ts +341 -194
- package/dist/core.min.mjs +1 -2
- package/dist/core.mjs +2222 -1966
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +4731 -3518
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.mjs +1306 -1308
- package/dist/qwikloader.debug.js +0 -2
- package/dist/qwikloader.js +1 -1
- package/dist/server.d.ts +11 -7
- package/dist/server.mjs +452 -390
- package/dist/testing/index.d.ts +32 -59
- package/dist/testing/index.mjs +1894 -1695
- package/dist/testing/package.json +1 -1
- package/handlers.mjs +1 -1
- package/package.json +2 -2
package/dist/core-internal.d.ts
CHANGED
|
@@ -92,7 +92,7 @@ declare type AllEventsMap = Omit<AllEventMapRaw, keyof EventCorrectionMap> & Eve
|
|
|
92
92
|
|
|
93
93
|
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;
|
|
94
94
|
|
|
95
|
-
declare type AllSignalFlags = SignalFlags | WrappedSignalFlags | SerializationSignalFlags;
|
|
95
|
+
declare type AllSignalFlags = SignalFlags | WrappedSignalFlags | SerializationSignalFlags | AsyncSignalFlags;
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
98
|
* TS defines these with the React syntax which is not compatible with Qwik. E.g. `ariaAtomic`
|
|
@@ -350,24 +350,108 @@ declare interface AriaAttributes {
|
|
|
350
350
|
/** @public */
|
|
351
351
|
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 & {});
|
|
352
352
|
|
|
353
|
-
declare type AsyncCtx = {
|
|
353
|
+
declare type AsyncCtx<T = unknown> = {
|
|
354
354
|
track: Tracker;
|
|
355
|
-
|
|
355
|
+
/**
|
|
356
|
+
* Register a cleanup callback to be called when the async computation is aborted or completed.
|
|
357
|
+
* The next invocation will await the previous cleanup. If you do not want this, do not return a
|
|
358
|
+
* Promise.
|
|
359
|
+
*/
|
|
360
|
+
cleanup: (callback: () => void | Promise<void>) => void;
|
|
361
|
+
/**
|
|
362
|
+
* A lazily created AbortSignal, for interrupting the async computation when needed, e.g. when the
|
|
363
|
+
* component is unmounted or the computation is invalidated. Pass it to `fetch` or other APIs that
|
|
364
|
+
* support it to ensure that unnecessary work is not performed.
|
|
365
|
+
*/
|
|
366
|
+
readonly abortSignal: AbortSignal;
|
|
367
|
+
/** The result of the previous computation, if any */
|
|
368
|
+
readonly previous: T | undefined;
|
|
356
369
|
};
|
|
357
370
|
|
|
358
|
-
/**
|
|
359
|
-
|
|
371
|
+
/**
|
|
372
|
+
* Note, we don't pass the generic type to AsyncCtx because it causes TypeScript to not infer the
|
|
373
|
+
* type of the resource correctly. The type is only used for the `previous` property, which is not
|
|
374
|
+
* commonly used, and can be easily cast if needed.
|
|
375
|
+
*
|
|
376
|
+
* @public
|
|
377
|
+
*/
|
|
378
|
+
export declare type AsyncFn<T> = (ctx: AsyncCtx) => ValueOrPromise<T>;
|
|
379
|
+
|
|
380
|
+
/** Retains job metadata and also serves as the argument for the compute function */
|
|
381
|
+
declare class AsyncJob<T> implements AsyncCtx<T> {
|
|
382
|
+
readonly $signal$: AsyncSignalImpl<T>;
|
|
383
|
+
/** First holds the compute promise and then the cleanup promise */
|
|
384
|
+
$promise$: Promise<void> | null;
|
|
385
|
+
$cleanupRequested$: boolean;
|
|
386
|
+
$canWrite$: boolean;
|
|
387
|
+
$track$: AsyncCtx<T>['track'] | undefined;
|
|
388
|
+
$cleanups$: Parameters<AsyncCtx<T>['cleanup']>[0][] | undefined;
|
|
389
|
+
$abortController$: AbortController | undefined;
|
|
390
|
+
constructor($signal$: AsyncSignalImpl<T>);
|
|
391
|
+
get track(): AsyncCtx<T>['track'];
|
|
392
|
+
get abortSignal(): AbortSignal;
|
|
393
|
+
/** Backward compatible cache method for resource */
|
|
394
|
+
cache(): void;
|
|
395
|
+
get previous(): T | undefined;
|
|
396
|
+
cleanup(callback: () => void): void;
|
|
397
|
+
}
|
|
360
398
|
|
|
361
399
|
declare type AsyncQRL<T> = _QRLInternal<AsyncFn<T>>;
|
|
362
400
|
|
|
363
|
-
/**
|
|
401
|
+
/**
|
|
402
|
+
* An AsyncSignal holds the result of the given async function. If the function uses `track()` to
|
|
403
|
+
* track reactive state, and that state changes, the AsyncSignal is recalculated, and if the result
|
|
404
|
+
* changed, all tasks which are tracking the AsyncSignal will be re-run and all subscribers
|
|
405
|
+
* (components, tasks etc) that read the AsyncSignal will be updated.
|
|
406
|
+
*
|
|
407
|
+
* If the async function throws an error, the AsyncSignal will capture the error and set the `error`
|
|
408
|
+
* property. The error can be cleared by re-running the async function successfully.
|
|
409
|
+
*
|
|
410
|
+
* While the async function is running, the `.loading` property will be set to `true`. Once the
|
|
411
|
+
* function completes, `loading` will be set to `false`.
|
|
412
|
+
*
|
|
413
|
+
* If the value has not yet been resolved, reading the AsyncSignal will throw a Promise, which will
|
|
414
|
+
* retry the component or task once the value resolves.
|
|
415
|
+
*
|
|
416
|
+
* If the value has been resolved, but the async function is re-running, reading the AsyncSignal
|
|
417
|
+
* will subscribe to it and return the last resolved value until the new value is ready. As soon as
|
|
418
|
+
* the new value is ready, the subscribers will be updated.
|
|
419
|
+
*
|
|
420
|
+
* If the async function threw an error, reading the `.value` will throw that same error. Read from
|
|
421
|
+
* `.error` to check if there was an error.
|
|
422
|
+
*
|
|
423
|
+
* @public
|
|
424
|
+
*/
|
|
364
425
|
export declare interface AsyncSignal<T = unknown> extends ComputedSignal<T> {
|
|
365
|
-
/**
|
|
426
|
+
/**
|
|
427
|
+
* Whether the signal is currently loading. This will trigger lazy loading of the signal, so you
|
|
428
|
+
* can use it like this:
|
|
429
|
+
*
|
|
430
|
+
* ```tsx
|
|
431
|
+
* signal.loading ? <Loading /> : signal.error ? <Error /> : <Component
|
|
432
|
+
* value={signal.value} />
|
|
433
|
+
* ```
|
|
434
|
+
*/
|
|
366
435
|
loading: boolean;
|
|
367
|
-
/**
|
|
436
|
+
/**
|
|
437
|
+
* The error that occurred while computing the signal, if any. This will be cleared when the
|
|
438
|
+
* signal is successfully computed.
|
|
439
|
+
*/
|
|
368
440
|
error: Error | undefined;
|
|
369
|
-
/**
|
|
370
|
-
|
|
441
|
+
/**
|
|
442
|
+
* Poll interval in ms. Writable and immediately effective when the signal has consumers. If set
|
|
443
|
+
* to `0`, polling stops.
|
|
444
|
+
*/
|
|
445
|
+
interval: number;
|
|
446
|
+
/** A promise that resolves when the value is computed or rejected. */
|
|
447
|
+
promise(): Promise<void>;
|
|
448
|
+
/** Abort the current computation and run cleanups if needed. */
|
|
449
|
+
abort(reason?: any): void;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
declare const enum AsyncSignalFlags {
|
|
453
|
+
EAGER_CLEANUP = 32,
|
|
454
|
+
CLIENT_ONLY = 64
|
|
371
455
|
}
|
|
372
456
|
|
|
373
457
|
/**
|
|
@@ -377,19 +461,28 @@ export declare interface AsyncSignal<T = unknown> extends ComputedSignal<T> {
|
|
|
377
461
|
*
|
|
378
462
|
* # ================================
|
|
379
463
|
*/
|
|
380
|
-
declare class AsyncSignalImpl<T> extends ComputedSignalImpl<T, AsyncQRL<T>> implements BackRef {
|
|
464
|
+
declare class AsyncSignalImpl<T> extends ComputedSignalImpl<T, AsyncQRL<T>> implements BackRef, AsyncSignal<T> {
|
|
381
465
|
$untrackedLoading$: boolean;
|
|
382
466
|
$untrackedError$: Error | undefined;
|
|
383
467
|
$loadingEffects$: undefined | Set<EffectSubscription>;
|
|
384
468
|
$errorEffects$: undefined | Set<EffectSubscription>;
|
|
385
|
-
$
|
|
386
|
-
$
|
|
387
|
-
|
|
469
|
+
$current$: AsyncJob<T> | null;
|
|
470
|
+
$jobs$: AsyncJob<T>[];
|
|
471
|
+
$concurrency$: number;
|
|
472
|
+
$interval$: number;
|
|
473
|
+
$timeoutMs$: number | undefined;
|
|
474
|
+
$pollTimeoutId$: ReturnType<typeof setTimeout> | undefined;
|
|
475
|
+
$computationTimeoutId$: ReturnType<typeof setTimeout> | undefined;
|
|
388
476
|
[_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
|
|
389
|
-
constructor(container: _Container | null, fn: AsyncQRL<T>, flags?: SignalFlags | SerializationSignalFlags);
|
|
477
|
+
constructor(container: _Container | null, fn: AsyncQRL<T>, flags?: SignalFlags | SerializationSignalFlags, options?: AsyncSignalOptions<T>);
|
|
478
|
+
get untrackedValue(): T;
|
|
479
|
+
set untrackedValue(value: T);
|
|
390
480
|
/**
|
|
391
481
|
* Loading is true if the signal is still waiting for the promise to resolve, false if the promise
|
|
392
482
|
* has resolved or rejected.
|
|
483
|
+
*
|
|
484
|
+
* Accessing .loading will trigger computation if needed, since it's often used like
|
|
485
|
+
* `signal.loading ? <Loading /> : signal.value`.
|
|
393
486
|
*/
|
|
394
487
|
get loading(): boolean;
|
|
395
488
|
set untrackedLoading(value: boolean);
|
|
@@ -398,11 +491,77 @@ declare class AsyncSignalImpl<T> extends ComputedSignalImpl<T, AsyncQRL<T>> impl
|
|
|
398
491
|
get error(): Error | undefined;
|
|
399
492
|
set untrackedError(value: Error | undefined);
|
|
400
493
|
get untrackedError(): Error | undefined;
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
494
|
+
get interval(): number;
|
|
495
|
+
set interval(value: number);
|
|
496
|
+
/** Invalidates the signal, causing it to re-compute its value. */
|
|
497
|
+
invalidate(): Promise<void>;
|
|
498
|
+
/** Abort the current computation and run cleanups if needed. */
|
|
499
|
+
abort(reason?: any): void;
|
|
500
|
+
/** Schedule eager cleanup on next macro task if no subscribers remain. */
|
|
501
|
+
$scheduleEagerCleanup$(): void;
|
|
502
|
+
/** Returns a promise resolves when the signal finished computing. */
|
|
503
|
+
promise(): Promise<void>;
|
|
504
|
+
/** Run the computation if needed */
|
|
505
|
+
$computeIfNeeded$(): void;
|
|
506
|
+
$runComputation$(running: AsyncJob<T>): Promise<void>;
|
|
507
|
+
/** Called after SSR/unmount */
|
|
508
|
+
$destroy$(): Promise<void>;
|
|
509
|
+
private $clearNextPoll$;
|
|
510
|
+
private $scheduleNextPoll$;
|
|
511
|
+
private $hasSubscribers$;
|
|
512
|
+
$requestCleanups$(job: AsyncJob<T>, reason?: any): Promise<void | null>;
|
|
513
|
+
/** Clean up and trigger signal compute once complete */
|
|
514
|
+
$runCleanups$(job: AsyncJob<T>): Promise<void>;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/** @public */
|
|
518
|
+
export declare interface AsyncSignalOptions<T> extends ComputedOptions {
|
|
519
|
+
/** Like useSignal's `initial`; prevents the throw on first read when uninitialized */
|
|
520
|
+
initial?: T | (() => T);
|
|
521
|
+
/**
|
|
522
|
+
* Maximum number of concurrent computations. Use `0` for unlimited.
|
|
523
|
+
*
|
|
524
|
+
* Defaults to `1`.
|
|
525
|
+
*/
|
|
526
|
+
concurrency?: number;
|
|
527
|
+
/**
|
|
528
|
+
* When subscribers drop to 0, run cleanup in the next tick, instead of waiting for the function
|
|
529
|
+
* inputs to change.
|
|
530
|
+
*
|
|
531
|
+
* Defaults to `false`, meaning cleanup happens only when inputs change.
|
|
532
|
+
*/
|
|
533
|
+
eagerCleanup?: boolean;
|
|
534
|
+
/**
|
|
535
|
+
* Wait for previous invocation to complete before running again.
|
|
536
|
+
*
|
|
537
|
+
* Defaults to `true`.
|
|
538
|
+
*
|
|
539
|
+
* @deprecated Not implemented yet
|
|
540
|
+
*/
|
|
541
|
+
awaitPrevious?: boolean;
|
|
542
|
+
/**
|
|
543
|
+
* In the browser, re-run the function after `interval` ms if subscribers exist, even when no
|
|
544
|
+
* input state changed. If `0`, does not poll.
|
|
545
|
+
*
|
|
546
|
+
* Defaults to `0`.
|
|
547
|
+
*/
|
|
548
|
+
interval?: number;
|
|
549
|
+
/**
|
|
550
|
+
* When true, the async computation is postponed to the browser. On SSR, the signal remains
|
|
551
|
+
* INVALID and does not execute the function. On the client, it will compute on first read.
|
|
552
|
+
*
|
|
553
|
+
* Defaults to `false`.
|
|
554
|
+
*/
|
|
555
|
+
clientOnly?: boolean;
|
|
556
|
+
/**
|
|
557
|
+
* Maximum time in milliseconds to wait for the async computation to complete. If exceeded, the
|
|
558
|
+
* computation is aborted and an error is thrown.
|
|
559
|
+
*
|
|
560
|
+
* If `0`, no timeout is applied.
|
|
561
|
+
*
|
|
562
|
+
* Defaults to `0`.
|
|
563
|
+
*/
|
|
564
|
+
timeout?: number;
|
|
406
565
|
}
|
|
407
566
|
|
|
408
567
|
/**
|
|
@@ -594,16 +753,10 @@ export declare type ComputedReturnType<T> = T extends Promise<any> ? never : Com
|
|
|
594
753
|
*
|
|
595
754
|
* @public
|
|
596
755
|
*/
|
|
597
|
-
export declare interface ComputedSignal<T> extends
|
|
598
|
-
/**
|
|
599
|
-
* Use this to force running subscribers, for example when the calculated value mutates but
|
|
600
|
-
* remains the same object.
|
|
601
|
-
*/
|
|
756
|
+
export declare interface ComputedSignal<T> extends Signal<T> {
|
|
757
|
+
/** @deprecated Use `trigger()` instead */
|
|
602
758
|
force(): void;
|
|
603
|
-
/**
|
|
604
|
-
* Use this to force recalculation and running subscribers, for example when the calculated value
|
|
605
|
-
* mutates but remains the same object.
|
|
606
|
-
*/
|
|
759
|
+
/** Use this to force recalculation. */
|
|
607
760
|
invalidate(): void;
|
|
608
761
|
}
|
|
609
762
|
|
|
@@ -624,12 +777,8 @@ declare class ComputedSignalImpl<T, S extends _QRLInternal = ComputeQRL<T>> exte
|
|
|
624
777
|
[_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
|
|
625
778
|
constructor(container: _Container | null, fn: S, flags?: SignalFlags | SerializationSignalFlags);
|
|
626
779
|
invalidate(): void;
|
|
627
|
-
/**
|
|
628
|
-
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
629
|
-
* remained the same object
|
|
630
|
-
*/
|
|
631
|
-
force(): void;
|
|
632
780
|
get untrackedValue(): T;
|
|
781
|
+
set untrackedValue(value: T);
|
|
633
782
|
$computeIfNeeded$(): void;
|
|
634
783
|
}
|
|
635
784
|
|
|
@@ -660,8 +809,8 @@ export declare interface _Container {
|
|
|
660
809
|
$buildBase$: string | null;
|
|
661
810
|
$renderPromise$: Promise<void> | null;
|
|
662
811
|
$resolveRenderPromise$: (() => void) | null;
|
|
663
|
-
$
|
|
664
|
-
$
|
|
812
|
+
$pendingCount$: number;
|
|
813
|
+
$checkPendingCount$(): void;
|
|
665
814
|
handleError(err: any, $host$: HostElement | null): void;
|
|
666
815
|
getParentHost(host: HostElement): HostElement | null;
|
|
667
816
|
setContext<T>(host: HostElement, context: ContextId<T>, value: T): void;
|
|
@@ -835,19 +984,15 @@ export declare interface CorrectedToggleEvent extends Event {
|
|
|
835
984
|
}
|
|
836
985
|
|
|
837
986
|
/**
|
|
838
|
-
* Create
|
|
839
|
-
*
|
|
840
|
-
* computed signal is recalculated.
|
|
841
|
-
*
|
|
842
|
-
* The QRL must be a function which returns the value of the signal. The function must not have side
|
|
843
|
-
* effects, and it can be async.
|
|
987
|
+
* Create a signal holding a `.value` which is calculated from the given async function (QRL). The
|
|
988
|
+
* standalone version of `useAsync$`.
|
|
844
989
|
*
|
|
845
990
|
* @public
|
|
846
991
|
*/
|
|
847
|
-
export declare const createAsync$: <T>(qrl: () => Promise<T>, options?:
|
|
992
|
+
export declare const createAsync$: <T>(qrl: (arg: AsyncCtx<T>) => Promise<T>, options?: AsyncSignalOptions<T>) => AsyncSignal<T>;
|
|
848
993
|
|
|
849
994
|
/** @internal */
|
|
850
|
-
export declare const createAsyncQrl: <T>(qrl: QRL<
|
|
995
|
+
export declare const createAsyncQrl: <T>(qrl: QRL<AsyncFn<T>>, options?: AsyncSignalOptions<T>) => AsyncSignalImpl<T>;
|
|
851
996
|
|
|
852
997
|
/**
|
|
853
998
|
* Create a computed signal which is calculated from the given QRL. A computed signal is a signal
|
|
@@ -857,7 +1002,7 @@ export declare const createAsyncQrl: <T>(qrl: QRL<(ctx: AsyncCtx) => Promise<T>>
|
|
|
857
1002
|
* The QRL must be a function which returns the value of the signal. The function must not have side
|
|
858
1003
|
* effects, and it must be synchronous.
|
|
859
1004
|
*
|
|
860
|
-
* If you need the function to be async, use `
|
|
1005
|
+
* If you need the function to be async, use `createAsync$` instead (don't forget to use `track()`).
|
|
861
1006
|
*
|
|
862
1007
|
* @public
|
|
863
1008
|
*/
|
|
@@ -918,6 +1063,21 @@ export declare const createComputedQrl: <T>(qrl: QRL<() => T>, options?: Compute
|
|
|
918
1063
|
*/
|
|
919
1064
|
export declare const createContextId: <STATE = unknown>(name: string) => ContextId<STATE>;
|
|
920
1065
|
|
|
1066
|
+
/**
|
|
1067
|
+
* Creates a QRL instance to represent a lazily loaded value. Normally this is a function, but it
|
|
1068
|
+
* can be any value.
|
|
1069
|
+
*
|
|
1070
|
+
* When the value is a function, calling the returned qrl will load the underlying code when
|
|
1071
|
+
* invoked, and call it with the captured scope. This always returns a promise since the code may
|
|
1072
|
+
* not be loaded yet.
|
|
1073
|
+
*
|
|
1074
|
+
* To get the underlying function without invoking it, await `qrl.resolve()` and then `qrl.resolved`
|
|
1075
|
+
* holds the loaded function, wrapped with the captured scope.
|
|
1076
|
+
*
|
|
1077
|
+
* @internal
|
|
1078
|
+
*/
|
|
1079
|
+
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) => _QRLInternal<TYPE>;
|
|
1080
|
+
|
|
921
1081
|
/**
|
|
922
1082
|
* Create a signal that holds a custom serializable value. See {@link useSerializer$} for more
|
|
923
1083
|
* details.
|
|
@@ -962,7 +1122,7 @@ declare interface DescriptorBase<T = unknown, B = unknown> extends BackRef {
|
|
|
962
1122
|
$el$: HostElement;
|
|
963
1123
|
$qrl$: _QRLInternal<T>;
|
|
964
1124
|
$state$: B | undefined;
|
|
965
|
-
$destroy$:
|
|
1125
|
+
$destroy$: (() => void) | null;
|
|
966
1126
|
}
|
|
967
1127
|
|
|
968
1128
|
/**
|
|
@@ -971,7 +1131,7 @@ declare interface DescriptorBase<T = unknown, B = unknown> extends BackRef {
|
|
|
971
1131
|
* @param rawStateData - Data to deserialize
|
|
972
1132
|
* @internal
|
|
973
1133
|
*/
|
|
974
|
-
export declare function _deserialize(rawStateData: string
|
|
1134
|
+
export declare function _deserialize<T>(rawStateData: string): T;
|
|
975
1135
|
|
|
976
1136
|
declare interface DeserializeContainer {
|
|
977
1137
|
$getObjectById$: (id: number | string) => unknown;
|
|
@@ -1111,6 +1271,9 @@ export declare class _ElementVNode extends _VirtualVNode {
|
|
|
1111
1271
|
/** @internal */
|
|
1112
1272
|
export declare const _EMPTY_ARRAY: any[];
|
|
1113
1273
|
|
|
1274
|
+
/** @internal */
|
|
1275
|
+
export declare const _EMPTY_OBJ: Record<string, any>;
|
|
1276
|
+
|
|
1114
1277
|
/** @public */
|
|
1115
1278
|
declare type EntryStrategy = InlineEntryStrategy | HoistEntryStrategy | SingleEntryStrategy | HookEntryStrategy | SegmentEntryStrategy | ComponentEntryStrategy | SmartEntryStrategy;
|
|
1116
1279
|
|
|
@@ -1482,7 +1645,7 @@ declare interface ISsrNode {
|
|
|
1482
1645
|
}
|
|
1483
1646
|
|
|
1484
1647
|
/** @internal */
|
|
1485
|
-
export declare const _isStore: (value:
|
|
1648
|
+
export declare const _isStore: (value: object) => boolean;
|
|
1486
1649
|
|
|
1487
1650
|
/** @internal */
|
|
1488
1651
|
export declare function _isStringifiable(value: unknown): value is _Stringifiable;
|
|
@@ -1490,6 +1653,13 @@ export declare function _isStringifiable(value: unknown): value is _Stringifiabl
|
|
|
1490
1653
|
/** @internal */
|
|
1491
1654
|
export declare const _isTask: (value: any) => value is Task;
|
|
1492
1655
|
|
|
1656
|
+
/** @internal */
|
|
1657
|
+
declare interface IStreamHandler {
|
|
1658
|
+
flush(): void;
|
|
1659
|
+
streamBlockStart(): void;
|
|
1660
|
+
streamBlockEnd(): void;
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1493
1663
|
/**
|
|
1494
1664
|
* Used by the JSX transpilers to create a JSXNode. Note that the optimizer will normally not use
|
|
1495
1665
|
* this, instead using _jsxSplit and _jsxSorted directly.
|
|
@@ -1768,12 +1938,6 @@ export declare type NativeUIEvent = UIEvent;
|
|
|
1768
1938
|
/** @public @deprecated Use `WheelEvent` and use the second argument to the handler function for the current event target */
|
|
1769
1939
|
export declare type NativeWheelEvent = WheelEvent;
|
|
1770
1940
|
|
|
1771
|
-
/**
|
|
1772
|
-
* Special value used to mark that a given signal needs to be computed. This is essentially a
|
|
1773
|
-
* "marked as dirty" flag.
|
|
1774
|
-
*/
|
|
1775
|
-
declare const NEEDS_COMPUTATION: any;
|
|
1776
|
-
|
|
1777
1941
|
declare interface NodePropData {
|
|
1778
1942
|
$scopedStyleIdPrefix$: string | null;
|
|
1779
1943
|
$isConst$: boolean;
|
|
@@ -1866,7 +2030,7 @@ declare type PascalCaseNames = 'AnimationEnd' | 'AnimationIteration' | 'Animatio
|
|
|
1866
2030
|
|
|
1867
2031
|
declare type PopoverTargetAction = 'hide' | 'show' | 'toggle';
|
|
1868
2032
|
|
|
1869
|
-
declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof TaskEvent | typeof RenderEvent
|
|
2033
|
+
declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof TaskEvent | typeof RenderEvent;
|
|
1870
2034
|
|
|
1871
2035
|
/**
|
|
1872
2036
|
* @deprecated This is no longer needed as the preloading happens automatically in qrl-class. You
|
|
@@ -2228,6 +2392,12 @@ declare type QrlReturn<T> = T extends (...args: any) => infer R ? Awaited<R> : u
|
|
|
2228
2392
|
*/
|
|
2229
2393
|
export declare const _qrlSync: <TYPE extends Function>(fn: TYPE, serializedFn?: string) => SyncQRL<TYPE>;
|
|
2230
2394
|
|
|
2395
|
+
/** @internal */
|
|
2396
|
+
export declare function _qrlToString(serializationContext: SerializationContext, qrl: _QRLInternal | SyncQRLInternal): string;
|
|
2397
|
+
|
|
2398
|
+
/** @internal */
|
|
2399
|
+
export declare function _qrlToString(serializationContext: SerializationContext, qrl: _QRLInternal | SyncQRLInternal, raw: true): [string, string, string | null];
|
|
2400
|
+
|
|
2231
2401
|
/** @public @deprecated Use `AnimationEvent` and use the second argument to the handler function for the current event target */
|
|
2232
2402
|
export declare type QwikAnimationEvent<T = Element> = NativeAnimationEvent;
|
|
2233
2403
|
|
|
@@ -2521,7 +2691,7 @@ export declare type QwikWheelEvent<T = Element> = NativeWheelEvent;
|
|
|
2521
2691
|
|
|
2522
2692
|
declare type QwikWindowEventMap = Omit<WindowEventHandlersEventMap, keyof QwikDocumentEventMap> & QwikDocumentEventMap;
|
|
2523
2693
|
|
|
2524
|
-
/** @public */
|
|
2694
|
+
/** @public @deprecated not used */
|
|
2525
2695
|
export declare interface ReadonlySignal<T = unknown> {
|
|
2526
2696
|
readonly value: T;
|
|
2527
2697
|
}
|
|
@@ -2595,6 +2765,14 @@ export declare interface RenderSSROptions {
|
|
|
2595
2765
|
manifestHash: string;
|
|
2596
2766
|
}
|
|
2597
2767
|
|
|
2768
|
+
/**
|
|
2769
|
+
* Resumes selected state (e.g. polling AsyncSignals) by deserializing captures. Used for
|
|
2770
|
+
* document:onQIdle to resume async signals with active polling.
|
|
2771
|
+
*
|
|
2772
|
+
* @internal
|
|
2773
|
+
*/
|
|
2774
|
+
export declare function _res(this: string | undefined, _: any, element: Element): void;
|
|
2775
|
+
|
|
2598
2776
|
/** @internal */
|
|
2599
2777
|
export declare const _resolveContextWithoutSequentialScope: <STATE>(context: ContextId<STATE>) => STATE | undefined;
|
|
2600
2778
|
|
|
@@ -2607,73 +2785,49 @@ declare interface ResolvedManifest {
|
|
|
2607
2785
|
}
|
|
2608
2786
|
|
|
2609
2787
|
/**
|
|
2610
|
-
* This method works like an async memoized function that runs whenever some tracked value changes
|
|
2611
|
-
* and returns some data.
|
|
2612
|
-
*
|
|
2613
|
-
* `useResource` however returns immediate a `ResourceReturn` object that contains the data and a
|
|
2614
|
-
* state that indicates if the data is available or not.
|
|
2615
|
-
*
|
|
2616
|
-
* The status can be one of the following:
|
|
2617
|
-
*
|
|
2618
|
-
* - `pending` - the data is not yet available.
|
|
2619
|
-
* - `resolved` - the data is available.
|
|
2620
|
-
* - `rejected` - the data is not available due to an error or timeout.
|
|
2621
|
-
*
|
|
2622
|
-
* Be careful when using a `try/catch` statement in `useResource$`. If you catch the error and don't
|
|
2623
|
-
* re-throw it (or a new Error), the resource status will never be `rejected`.
|
|
2624
|
-
*
|
|
2625
|
-
* ### Example
|
|
2626
|
-
*
|
|
2627
|
-
* Example showing how `useResource` to perform a fetch to request the weather, whenever the input
|
|
2628
|
-
* city name changes.
|
|
2629
|
-
*
|
|
2630
2788
|
* ```tsx
|
|
2631
2789
|
* const Cmp = component$(() => {
|
|
2632
|
-
* const
|
|
2790
|
+
* const city = useSignal('');
|
|
2633
2791
|
*
|
|
2634
|
-
* const
|
|
2635
|
-
* const cityName = track(
|
|
2636
|
-
* const abortController = new AbortController();
|
|
2637
|
-
* cleanup(() => abortController.abort('cleanup'));
|
|
2792
|
+
* const weather = useAsync$(async ({ track, cleanup, abortSignal }) => {
|
|
2793
|
+
* const cityName = track(city);
|
|
2638
2794
|
* const res = await fetch(`http://weatherdata.com?city=${cityName}`, {
|
|
2639
|
-
* signal:
|
|
2795
|
+
* signal: abortSignal,
|
|
2640
2796
|
* });
|
|
2641
|
-
* const
|
|
2642
|
-
* return
|
|
2797
|
+
* const temp = (await res.json()) as { temp: number };
|
|
2798
|
+
* return temp;
|
|
2643
2799
|
* });
|
|
2644
2800
|
*
|
|
2645
2801
|
* return (
|
|
2646
2802
|
* <div>
|
|
2647
|
-
* <input name="city" bind:value={
|
|
2648
|
-
* <
|
|
2649
|
-
*
|
|
2650
|
-
*
|
|
2651
|
-
*
|
|
2652
|
-
*
|
|
2653
|
-
*
|
|
2803
|
+
* <input name="city" bind:value={city} />
|
|
2804
|
+
* <div>
|
|
2805
|
+
* Temperature:{' '}
|
|
2806
|
+
* {weather.loading
|
|
2807
|
+
* ? 'Loading...'
|
|
2808
|
+
* : weather.error
|
|
2809
|
+
* ? `Error: ${weather.error.message}`
|
|
2810
|
+
* : weather.value.temp}
|
|
2811
|
+
* </div>
|
|
2654
2812
|
* </div>
|
|
2655
2813
|
* );
|
|
2656
2814
|
* });
|
|
2657
2815
|
* ```
|
|
2658
2816
|
*
|
|
2817
|
+
* @deprecated Use `useAsync$` instead, which is more efficient, and has a more flexible API. Just
|
|
2818
|
+
* read the `loading` and `error` properties from the returned signal to determine the status.
|
|
2659
2819
|
* @public
|
|
2660
|
-
* @see Resource
|
|
2661
|
-
* @see ResourceReturn
|
|
2662
2820
|
*/
|
|
2663
|
-
export declare const Resource: <T>(
|
|
2821
|
+
export declare const Resource: <T>({ value, onResolved, onPending, onRejected, }: ResourceProps<T>) => JSXOutput;
|
|
2664
2822
|
|
|
2665
2823
|
/** @public */
|
|
2666
|
-
export declare interface ResourceCtx<T> {
|
|
2667
|
-
|
|
2668
|
-
cleanup(callback: () => void): void;
|
|
2824
|
+
export declare interface ResourceCtx<T = unknown> extends AsyncCtx<T> {
|
|
2825
|
+
/** @deprecated Does not do anything */
|
|
2669
2826
|
cache(policyOrMilliseconds: number | 'immutable'): void;
|
|
2670
|
-
readonly previous: T | undefined;
|
|
2671
2827
|
}
|
|
2672
2828
|
|
|
2673
|
-
declare const ResourceEvent = "qResource";
|
|
2674
|
-
|
|
2675
2829
|
/** @public */
|
|
2676
|
-
export declare type ResourceFn<T> = (ctx: ResourceCtx
|
|
2830
|
+
export declare type ResourceFn<T> = (ctx: ResourceCtx) => ValueOrPromise<T>;
|
|
2677
2831
|
|
|
2678
2832
|
/**
|
|
2679
2833
|
* Options to pass to `useResource$()`
|
|
@@ -2690,10 +2844,7 @@ export declare interface ResourceOptions {
|
|
|
2690
2844
|
}
|
|
2691
2845
|
|
|
2692
2846
|
/** @public */
|
|
2693
|
-
export declare
|
|
2694
|
-
readonly value: Promise<T>;
|
|
2695
|
-
readonly loading: boolean;
|
|
2696
|
-
}
|
|
2847
|
+
export declare type ResourcePending<T> = ResourceReturn<T>;
|
|
2697
2848
|
|
|
2698
2849
|
/** @public */
|
|
2699
2850
|
export declare interface ResourceProps<T> {
|
|
@@ -2704,35 +2855,38 @@ export declare interface ResourceProps<T> {
|
|
|
2704
2855
|
}
|
|
2705
2856
|
|
|
2706
2857
|
/** @public */
|
|
2707
|
-
export declare
|
|
2708
|
-
readonly value: Promise<T>;
|
|
2709
|
-
readonly loading: boolean;
|
|
2710
|
-
}
|
|
2858
|
+
export declare type ResourceRejected<T> = ResourceReturn<T>;
|
|
2711
2859
|
|
|
2712
2860
|
/** @public */
|
|
2713
|
-
export declare
|
|
2714
|
-
readonly value: Promise<T>;
|
|
2715
|
-
readonly loading: boolean;
|
|
2716
|
-
}
|
|
2861
|
+
export declare type ResourceResolved<T> = ResourceReturn<T>;
|
|
2717
2862
|
|
|
2718
2863
|
/** @public */
|
|
2719
|
-
export declare type ResourceReturn<T> =
|
|
2864
|
+
export declare type ResourceReturn<T> = {
|
|
2865
|
+
readonly value: Promise<T>;
|
|
2866
|
+
readonly loading: boolean;
|
|
2867
|
+
};
|
|
2720
2868
|
|
|
2721
2869
|
declare interface ResourceReturnInternal<T> {
|
|
2722
2870
|
__brand: 'resource';
|
|
2723
|
-
_state: 'pending' | 'resolved' | 'rejected';
|
|
2724
|
-
_resolved: T | undefined;
|
|
2725
|
-
_error: Error | undefined;
|
|
2726
|
-
_cache: number;
|
|
2727
|
-
_timeout: number;
|
|
2728
|
-
_generation: number;
|
|
2729
2871
|
value: Promise<T>;
|
|
2730
2872
|
loading: boolean;
|
|
2873
|
+
signal: AsyncSignal<{
|
|
2874
|
+
r: T;
|
|
2875
|
+
}>;
|
|
2731
2876
|
}
|
|
2732
2877
|
|
|
2733
2878
|
/** @internal */
|
|
2734
2879
|
export declare const _restProps: (props: PropsProxy, omit?: string[], target?: Props) => Props;
|
|
2735
2880
|
|
|
2881
|
+
/**
|
|
2882
|
+
* The resource function wrapper
|
|
2883
|
+
*
|
|
2884
|
+
* @internal
|
|
2885
|
+
*/
|
|
2886
|
+
export declare const _rsc: <T>(arg: ResourceCtx<T>) => Promise<{
|
|
2887
|
+
r: T;
|
|
2888
|
+
}>;
|
|
2889
|
+
|
|
2736
2890
|
/**
|
|
2737
2891
|
* This is called by qwik-loader to run a QRL. It has to be synchronous when possible.
|
|
2738
2892
|
*
|
|
@@ -2753,7 +2907,7 @@ declare interface SegmentEntryStrategy {
|
|
|
2753
2907
|
}
|
|
2754
2908
|
|
|
2755
2909
|
declare interface SerializationContext {
|
|
2756
|
-
$serialize$: () => void
|
|
2910
|
+
$serialize$: () => ValueOrPromise<void>;
|
|
2757
2911
|
$symbolToChunkResolver$: SymbolToChunkResolver;
|
|
2758
2912
|
/**
|
|
2759
2913
|
* Map from object to parent and index reference.
|
|
@@ -2787,28 +2941,42 @@ declare interface SerializationContext {
|
|
|
2787
2941
|
$syncFns$: string[];
|
|
2788
2942
|
$eventQrls$: Set<QRL>;
|
|
2789
2943
|
$eventNames$: Set<string>;
|
|
2790
|
-
$resources$: Set<ResourceReturnInternal<unknown>>;
|
|
2791
2944
|
$renderSymbols$: Set<string>;
|
|
2792
2945
|
$storeProxyMap$: ObjToProxyMap;
|
|
2793
|
-
$
|
|
2946
|
+
$eagerResume$: Set<unknown>;
|
|
2794
2947
|
$setProp$: (obj: any, prop: string, value: any) => void;
|
|
2795
2948
|
}
|
|
2796
2949
|
|
|
2797
2950
|
declare const enum SerializationSignalFlags {
|
|
2798
2951
|
SERIALIZATION_STRATEGY_NEVER = 8,
|
|
2799
|
-
SERIALIZATION_STRATEGY_ALWAYS = 16
|
|
2952
|
+
SERIALIZATION_STRATEGY_ALWAYS = 16,
|
|
2953
|
+
SERIALIZATION_ALL_STRATEGIES = 24
|
|
2800
2954
|
}
|
|
2801
2955
|
|
|
2802
|
-
/**
|
|
2956
|
+
/**
|
|
2957
|
+
* Serialization strategy for computed and async signals. This determines whether to serialize their
|
|
2958
|
+
* value during SSR.
|
|
2959
|
+
*
|
|
2960
|
+
* - `never`: The value is never serialized. When the component is resumed, the value will be
|
|
2961
|
+
* recalculated when it is first read.
|
|
2962
|
+
* - `always`: The value is always serialized. This is the default.
|
|
2963
|
+
*
|
|
2964
|
+
* **IMPORTANT**: When you use `never`, your serialized HTML is smaller, but the recalculation will
|
|
2965
|
+
* trigger subscriptions, meaning that other signals using this signal will recalculate, even if
|
|
2966
|
+
* this signal didn't change.
|
|
2967
|
+
*
|
|
2968
|
+
* This is normally not a problem, but for async signals it may mean fetching something again.
|
|
2969
|
+
*
|
|
2970
|
+
* @public
|
|
2971
|
+
*/
|
|
2803
2972
|
export declare type SerializationStrategy = 'never' | 'always';
|
|
2804
2973
|
|
|
2805
2974
|
/**
|
|
2806
2975
|
* Serialize data to string using SerializationContext.
|
|
2807
2976
|
*
|
|
2808
|
-
* @param data - Data to serialize
|
|
2809
2977
|
* @internal
|
|
2810
2978
|
*/
|
|
2811
|
-
export declare function _serialize(data:
|
|
2979
|
+
export declare function _serialize<T>(data: T): Promise<string>;
|
|
2812
2980
|
|
|
2813
2981
|
/**
|
|
2814
2982
|
* Serialize and deserialize custom objects.
|
|
@@ -2901,6 +3069,9 @@ export declare const SerializerSymbol: unique symbol;
|
|
|
2901
3069
|
*/
|
|
2902
3070
|
declare type ServerQwikManifest = Pick<QwikManifest, 'manifestHash' | 'injections' | 'bundleGraph' | 'bundleGraphAsset' | 'mapping' | 'preloader' | 'core' | 'qwikLoader'>;
|
|
2903
3071
|
|
|
3072
|
+
/** @internal */
|
|
3073
|
+
export declare function _setEvent(serializationCtx: SerializationContext, key: string, rawValue: unknown, isLoopElement: boolean): string | null;
|
|
3074
|
+
|
|
2904
3075
|
/**
|
|
2905
3076
|
* Sets the `CorePlatform`.
|
|
2906
3077
|
*
|
|
@@ -2925,8 +3096,7 @@ export declare abstract class _SharedContainer implements _Container {
|
|
|
2925
3096
|
$buildBase$: string | null;
|
|
2926
3097
|
$renderPromise$: Promise<void> | null;
|
|
2927
3098
|
$resolveRenderPromise$: (() => void) | null;
|
|
2928
|
-
$
|
|
2929
|
-
$pausedCursorCount$: number;
|
|
3099
|
+
$pendingCount$: number;
|
|
2930
3100
|
constructor(serverData: Record<string, any>, locale: string);
|
|
2931
3101
|
trackSignalValue<T>(signal: Signal, subscriber: HostElement, property: string, data: _SubscriptionData): T;
|
|
2932
3102
|
serializationCtxFactory(NodeConstructor: {
|
|
@@ -2938,6 +3108,7 @@ export declare abstract class _SharedContainer implements _Container {
|
|
|
2938
3108
|
__brand__: 'DomRef';
|
|
2939
3109
|
};
|
|
2940
3110
|
} | null, symbolToChunkResolver: SymbolToChunkResolver, writer?: StreamWriter): SerializationContext;
|
|
3111
|
+
$checkPendingCount$(): void;
|
|
2941
3112
|
abstract ensureProjectionResolved(host: HostElement): void;
|
|
2942
3113
|
abstract handleError(err: any, $host$: HostElement | null): void;
|
|
2943
3114
|
abstract getParentHost(host: HostElement): HostElement | null;
|
|
@@ -2960,8 +3131,16 @@ export declare abstract class _SharedContainer implements _Container {
|
|
|
2960
3131
|
*
|
|
2961
3132
|
* @public
|
|
2962
3133
|
*/
|
|
2963
|
-
export declare interface Signal<T = any>
|
|
3134
|
+
export declare interface Signal<T = any> {
|
|
3135
|
+
/** Reading from this subscribes to updates; writing to this triggers updates. */
|
|
2964
3136
|
value: T;
|
|
3137
|
+
/** Reading from this does not subscribe to updates; writing to this does not trigger updates. */
|
|
3138
|
+
untrackedValue: T;
|
|
3139
|
+
/**
|
|
3140
|
+
* Use this to trigger running subscribers, for example when the value mutated but remained the
|
|
3141
|
+
* same object.
|
|
3142
|
+
*/
|
|
3143
|
+
trigger(): void;
|
|
2965
3144
|
}
|
|
2966
3145
|
|
|
2967
3146
|
declare const enum SignalFlags {
|
|
@@ -2977,9 +3156,11 @@ declare class SignalImpl<T = any> implements Signal<T> {
|
|
|
2977
3156
|
$wrappedSignal$: WrappedSignalImpl<T> | null;
|
|
2978
3157
|
constructor(container: _Container | null, value: T);
|
|
2979
3158
|
/**
|
|
2980
|
-
* Use this to
|
|
3159
|
+
* Use this to trigger running subscribers, for example when the calculated value has mutated but
|
|
2981
3160
|
* remained the same object
|
|
2982
3161
|
*/
|
|
3162
|
+
trigger(): void;
|
|
3163
|
+
/** @deprecated Use `trigger()` instead */
|
|
2983
3164
|
force(): void;
|
|
2984
3165
|
get untrackedValue(): T;
|
|
2985
3166
|
set untrackedValue(value: T);
|
|
@@ -2992,8 +3173,6 @@ declare class SignalImpl<T = any> implements Signal<T> {
|
|
|
2992
3173
|
};
|
|
2993
3174
|
}
|
|
2994
3175
|
|
|
2995
|
-
declare type SimpleSsrAttrValue = string | Signal<SimpleSsrAttrValue> | boolean | object | null;
|
|
2996
|
-
|
|
2997
3176
|
declare interface SimplifiedServerRequestEvent<T = unknown> {
|
|
2998
3177
|
url: URL;
|
|
2999
3178
|
locale: string | undefined;
|
|
@@ -3269,12 +3448,6 @@ declare type SpecialAttrs = {
|
|
|
3269
3448
|
[key: string]: {};
|
|
3270
3449
|
};
|
|
3271
3450
|
|
|
3272
|
-
declare type SsrAttrKey = string;
|
|
3273
|
-
|
|
3274
|
-
declare type SsrAttrs = Array<SsrAttrKey | SsrAttrValue>;
|
|
3275
|
-
|
|
3276
|
-
declare type SsrAttrValue = SimpleSsrAttrValue | Promise<SimpleSsrAttrValue>;
|
|
3277
|
-
|
|
3278
3451
|
/** @public */
|
|
3279
3452
|
export declare const SSRComment: FunctionComponent<{
|
|
3280
3453
|
data: string;
|
|
@@ -3285,6 +3458,7 @@ declare interface SSRContainer extends _Container {
|
|
|
3285
3458
|
readonly isHtml: boolean;
|
|
3286
3459
|
readonly size: number;
|
|
3287
3460
|
readonly writer: StreamWriter;
|
|
3461
|
+
readonly streamHandler: IStreamHandler;
|
|
3288
3462
|
readonly serializationCtx: SerializationContext;
|
|
3289
3463
|
readonly symbolToChunkResolver: SymbolToChunkResolver;
|
|
3290
3464
|
readonly resolvedManifest: ResolvedManifest;
|
|
@@ -3293,13 +3467,13 @@ declare interface SSRContainer extends _Container {
|
|
|
3293
3467
|
write(text: string): void;
|
|
3294
3468
|
openContainer(): void;
|
|
3295
3469
|
closeContainer(): ValueOrPromise<void>;
|
|
3296
|
-
openElement(elementName: string, key: string | null, varAttrs:
|
|
3470
|
+
openElement(elementName: string, key: string | null, varAttrs: Props, constAttrs: Props | null, styleScopedId: string | null, currentFile: string | null): string | undefined;
|
|
3297
3471
|
closeElement(): ValueOrPromise<void>;
|
|
3298
|
-
openFragment(attrs:
|
|
3472
|
+
openFragment(attrs: Props): void;
|
|
3299
3473
|
closeFragment(): void;
|
|
3300
|
-
openProjection(attrs:
|
|
3474
|
+
openProjection(attrs: Props): void;
|
|
3301
3475
|
closeProjection(): void;
|
|
3302
|
-
openComponent(attrs:
|
|
3476
|
+
openComponent(attrs: Props): void;
|
|
3303
3477
|
getComponentFrame(projectionDepth: number): ISsrComponentFrame | null;
|
|
3304
3478
|
getParentComponentFrame(): ISsrComponentFrame | null;
|
|
3305
3479
|
closeComponent(): Promise<void>;
|
|
@@ -3669,6 +3843,8 @@ declare type SymbolToChunkResolver = (symbol: string) => string;
|
|
|
3669
3843
|
*/
|
|
3670
3844
|
export declare const sync$: <T extends Function>(fn: T) => SyncQRL<T>;
|
|
3671
3845
|
|
|
3846
|
+
declare const SYNC_QRL = "<sync>";
|
|
3847
|
+
|
|
3672
3848
|
/** @public */
|
|
3673
3849
|
export declare type SyncQRL<TYPE extends Function> = QRL<TYPE> & {
|
|
3674
3850
|
__brand__SyncQRL__: TYPE;
|
|
@@ -3676,6 +3852,12 @@ export declare type SyncQRL<TYPE extends Function> = QRL<TYPE> & {
|
|
|
3676
3852
|
dev?: QRLDev | null;
|
|
3677
3853
|
} & BivariantQrlFn<QrlArgs<TYPE>, QrlReturn<TYPE>>;
|
|
3678
3854
|
|
|
3855
|
+
declare type SyncQRLInternal = _QRLInternal & SyncQRLSymbol;
|
|
3856
|
+
|
|
3857
|
+
declare interface SyncQRLSymbol {
|
|
3858
|
+
$symbol$: typeof SYNC_QRL;
|
|
3859
|
+
}
|
|
3860
|
+
|
|
3679
3861
|
declare type TableCellSpecialAttrs = {
|
|
3680
3862
|
align?: 'left' | 'center' | 'right' | 'justify' | 'char' | undefined;
|
|
3681
3863
|
height?: Size | undefined;
|
|
@@ -3683,14 +3865,14 @@ declare type TableCellSpecialAttrs = {
|
|
|
3683
3865
|
valign?: 'top' | 'middle' | 'bottom' | 'baseline' | undefined;
|
|
3684
3866
|
};
|
|
3685
3867
|
|
|
3686
|
-
declare class Task<T = unknown, B = T> extends BackRef implements DescriptorBase<unknown, Signal<B
|
|
3868
|
+
declare class Task<T = unknown, B = T> extends BackRef implements DescriptorBase<unknown, Signal<B>> {
|
|
3687
3869
|
$flags$: number;
|
|
3688
3870
|
$index$: number;
|
|
3689
3871
|
$el$: HostElement;
|
|
3690
3872
|
$qrl$: _QRLInternal<T>;
|
|
3691
|
-
$state$: Signal<B> |
|
|
3692
|
-
$destroy$:
|
|
3693
|
-
constructor($flags$: number, $index$: number, $el$: HostElement, $qrl$: _QRLInternal<T>, $state$: Signal<B> |
|
|
3873
|
+
$state$: Signal<B> | undefined;
|
|
3874
|
+
$destroy$: (() => void) | null;
|
|
3875
|
+
constructor($flags$: number, $index$: number, $el$: HostElement, $qrl$: _QRLInternal<T>, $state$: Signal<B> | undefined, $destroy$: (() => void) | null);
|
|
3694
3876
|
}
|
|
3695
3877
|
|
|
3696
3878
|
/**
|
|
@@ -3860,10 +4042,10 @@ export declare const unwrapStore: <T>(value: T) => T;
|
|
|
3860
4042
|
*
|
|
3861
4043
|
* @public
|
|
3862
4044
|
*/
|
|
3863
|
-
export declare const useAsync$: <T>(qrl: AsyncFn<T>, options?:
|
|
4045
|
+
export declare const useAsync$: <T>(qrl: AsyncFn<T>, options?: AsyncSignalOptions<T> | undefined) => AsyncSignal<T>;
|
|
3864
4046
|
|
|
3865
4047
|
/** @internal */
|
|
3866
|
-
export declare const useAsyncQrl: <T>(qrl: QRL<AsyncFn<T>>, options?:
|
|
4048
|
+
export declare const useAsyncQrl: <T>(qrl: QRL<AsyncFn<T>>, options?: AsyncSignalOptions<T>) => AsyncSignal<T>;
|
|
3867
4049
|
|
|
3868
4050
|
/**
|
|
3869
4051
|
* Creates a computed signal which is calculated from the given function. A computed signal is a
|
|
@@ -4023,7 +4205,7 @@ export declare const useId: () => string;
|
|
|
4023
4205
|
* NOTE: `useLexicalScope` method can only be used in the synchronous portion of the callback
|
|
4024
4206
|
* (before any `await` statements.)
|
|
4025
4207
|
*
|
|
4026
|
-
* @deprecated
|
|
4208
|
+
* @deprecated Use `_captures` instead.
|
|
4027
4209
|
* @internal
|
|
4028
4210
|
*/
|
|
4029
4211
|
export declare const useLexicalScope: <VARS extends any[]>() => VARS;
|
|
@@ -4116,45 +4298,15 @@ export declare const useOnWindow: <T extends KnownEventNames>(event: T | T[], ev
|
|
|
4116
4298
|
* Be careful when using a `try/catch` statement in `useResource$`. If you catch the error and don't
|
|
4117
4299
|
* re-throw it (or a new Error), the resource status will never be `rejected`.
|
|
4118
4300
|
*
|
|
4119
|
-
*
|
|
4120
|
-
*
|
|
4121
|
-
*
|
|
4122
|
-
* city name changes.
|
|
4123
|
-
*
|
|
4124
|
-
* ```tsx
|
|
4125
|
-
* const Cmp = component$(() => {
|
|
4126
|
-
* const cityS = useSignal('');
|
|
4127
|
-
*
|
|
4128
|
-
* const weatherResource = useResource$(async ({ track, cleanup }) => {
|
|
4129
|
-
* const cityName = track(cityS);
|
|
4130
|
-
* const abortController = new AbortController();
|
|
4131
|
-
* cleanup(() => abortController.abort('cleanup'));
|
|
4132
|
-
* const res = await fetch(`http://weatherdata.com?city=${cityName}`, {
|
|
4133
|
-
* signal: abortController.signal,
|
|
4134
|
-
* });
|
|
4135
|
-
* const data = await res.json();
|
|
4136
|
-
* return data as { temp: number };
|
|
4137
|
-
* });
|
|
4138
|
-
*
|
|
4139
|
-
* return (
|
|
4140
|
-
* <div>
|
|
4141
|
-
* <input name="city" bind:value={cityS} />
|
|
4142
|
-
* <Resource
|
|
4143
|
-
* value={weatherResource}
|
|
4144
|
-
* onResolved={(weather) => {
|
|
4145
|
-
* return <div>Temperature: {weather.temp}</div>;
|
|
4146
|
-
* }}
|
|
4147
|
-
* />
|
|
4148
|
-
* </div>
|
|
4149
|
-
* );
|
|
4150
|
-
* });
|
|
4151
|
-
* ```
|
|
4152
|
-
*
|
|
4301
|
+
* @deprecated Use `useAsync$` instead, which is more powerful and flexible. `useResource$` is still
|
|
4302
|
+
* available for backward compatibility but it is recommended to migrate to `useAsync$` for new
|
|
4303
|
+
* code and when updating existing code.
|
|
4153
4304
|
* @public
|
|
4305
|
+
* @see useAsync$
|
|
4154
4306
|
* @see Resource
|
|
4155
4307
|
* @see ResourceReturn
|
|
4156
4308
|
*/
|
|
4157
|
-
export declare const useResource$: <T>(
|
|
4309
|
+
export declare const useResource$: <T>(qrl: ResourceFn<T>, opts?: ResourceOptions | undefined) => ResourceReturn<T>;
|
|
4158
4310
|
|
|
4159
4311
|
/** @internal */
|
|
4160
4312
|
export declare const useResourceQrl: <T>(qrl: QRL<ResourceFn<T>>, opts?: ResourceOptions) => ResourceReturn<T>;
|
|
@@ -4525,7 +4677,7 @@ export declare const _VAR_PROPS: unique symbol;
|
|
|
4525
4677
|
export declare const _verifySerializable: <T>(value: T, preMessage?: string) => T;
|
|
4526
4678
|
|
|
4527
4679
|
/**
|
|
4528
|
-
* 2.0.0-beta.
|
|
4680
|
+
* 2.0.0-beta.24-dev+314726b
|
|
4529
4681
|
*
|
|
4530
4682
|
* @public
|
|
4531
4683
|
*/
|
|
@@ -4577,7 +4729,7 @@ export declare const _vnode_isTextVNode: (vNode: _VNode) => vNode is _TextVNode;
|
|
|
4577
4729
|
export declare const _vnode_isVirtualVNode: (vNode: _VNode) => vNode is _VirtualVNode;
|
|
4578
4730
|
|
|
4579
4731
|
/** @internal */
|
|
4580
|
-
export declare function _vnode_toString(this: _VNode | null, depth?: number, offset?: string, materialize?: boolean, siblings?: boolean, colorize?: boolean, container?:
|
|
4732
|
+
export declare function _vnode_toString(this: _VNode | null, depth?: number, offset?: string, materialize?: boolean, siblings?: boolean, colorize?: boolean, container?: _Container | null): string;
|
|
4581
4733
|
|
|
4582
4734
|
/**
|
|
4583
4735
|
* Array of numbers which describes virtual nodes in the tree.
|
|
@@ -4606,7 +4758,7 @@ export declare function _vnode_toString(this: _VNode | null, depth?: number, off
|
|
|
4606
4758
|
* this data needs to be serialized into a string and stored in the DOM as a script tag which has
|
|
4607
4759
|
* deferent serialization format.
|
|
4608
4760
|
*/
|
|
4609
|
-
declare type VNodeData = [VNodeDataFlag, ...(
|
|
4761
|
+
declare type VNodeData = [VNodeDataFlag, ...(Props | number)[]];
|
|
4610
4762
|
|
|
4611
4763
|
/**
|
|
4612
4764
|
* Flags for VNodeData (Flags con be bitwise combined)
|
|
@@ -4684,7 +4836,7 @@ declare const enum WrappedSignalFlags {
|
|
|
4684
4836
|
UNWRAP = 4
|
|
4685
4837
|
}
|
|
4686
4838
|
|
|
4687
|
-
declare class WrappedSignalImpl<T> extends SignalImpl<T>
|
|
4839
|
+
declare class WrappedSignalImpl<T> extends SignalImpl<T> {
|
|
4688
4840
|
$args$: any[];
|
|
4689
4841
|
$func$: (...args: any[]) => T;
|
|
4690
4842
|
$funcStr$: string | null;
|
|
@@ -4693,11 +4845,6 @@ declare class WrappedSignalImpl<T> extends SignalImpl<T> implements BackRef {
|
|
|
4693
4845
|
[_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
|
|
4694
4846
|
constructor(container: _Container | null, fn: (...args: any[]) => T, args: any[], fnStr: string | null, flags?: SignalFlags);
|
|
4695
4847
|
invalidate(): void;
|
|
4696
|
-
/**
|
|
4697
|
-
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
4698
|
-
* remained the same object.
|
|
4699
|
-
*/
|
|
4700
|
-
force(): void;
|
|
4701
4848
|
get untrackedValue(): T;
|
|
4702
4849
|
$computeIfNeeded$(): void;
|
|
4703
4850
|
$unwrapIfSignal$(): SignalImpl<T> | WrappedSignalImpl<T>;
|