@qwik.dev/core 2.0.0-beta.19 → 2.0.0-beta.21
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 +2 -2
- package/dist/core-internal.d.ts +175 -94
- package/dist/core.min.mjs +2 -1
- package/dist/core.mjs +969 -935
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +620 -666
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.mjs +841 -842
- package/dist/qwikloader.debug.js +144 -144
- package/dist/qwikloader.js +1 -1
- package/dist/server.mjs +55 -23
- package/dist/testing/index.d.ts +28 -20
- package/dist/testing/index.mjs +3547 -3572
- package/dist/testing/package.json +1 -1
- package/package.json +2 -2
- package/public.d.ts +2 -2
package/dist/core-internal.d.ts
CHANGED
|
@@ -350,35 +350,34 @@ 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
|
|
353
|
+
declare type AsyncCtx = {
|
|
354
354
|
track: Tracker;
|
|
355
355
|
cleanup: (callback: () => void) => void;
|
|
356
356
|
};
|
|
357
357
|
|
|
358
358
|
/** @public */
|
|
359
|
-
export declare type
|
|
359
|
+
export declare type AsyncFn<T> = (ctx: AsyncCtx) => Promise<T>;
|
|
360
|
+
|
|
361
|
+
declare type AsyncQRL<T> = _QRLInternal<AsyncFn<T>>;
|
|
360
362
|
|
|
361
363
|
/** @public */
|
|
362
|
-
export declare interface
|
|
364
|
+
export declare interface AsyncSignal<T = unknown> extends ComputedSignal<T> {
|
|
363
365
|
/** Whether the signal is currently loading. */
|
|
364
366
|
loading: boolean;
|
|
365
367
|
/** The error that occurred while computing the signal. */
|
|
366
|
-
error: Error |
|
|
368
|
+
error: Error | undefined;
|
|
367
369
|
/** A promise that resolves when the value is computed. */
|
|
368
370
|
promise(): Promise<T>;
|
|
369
371
|
}
|
|
370
372
|
|
|
371
|
-
/** @public */
|
|
372
|
-
export declare type AsyncComputedReturnType<T> = T extends Promise<infer T> ? AsyncComputedReadonlySignal<T> : AsyncComputedReadonlySignal<T>;
|
|
373
|
-
|
|
374
373
|
/**
|
|
375
374
|
* # ================================
|
|
376
375
|
*
|
|
377
|
-
*
|
|
376
|
+
* AsyncSignalImpl
|
|
378
377
|
*
|
|
379
378
|
* # ================================
|
|
380
379
|
*/
|
|
381
|
-
declare class
|
|
380
|
+
declare class AsyncSignalImpl<T> extends ComputedSignalImpl<T, AsyncQRL<T>> implements BackRef {
|
|
382
381
|
$untrackedLoading$: boolean;
|
|
383
382
|
$untrackedError$: Error | undefined;
|
|
384
383
|
$loadingEffects$: undefined | Set<EffectSubscription>;
|
|
@@ -387,7 +386,7 @@ declare class AsyncComputedSignalImpl<T> extends ComputedSignalImpl<T | undefine
|
|
|
387
386
|
$promiseValue$: T | typeof NEEDS_COMPUTATION;
|
|
388
387
|
private $promise$;
|
|
389
388
|
[_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
|
|
390
|
-
constructor(container:
|
|
389
|
+
constructor(container: _Container | null, fn: AsyncQRL<T>, flags?: SignalFlags | SerializationSignalFlags);
|
|
391
390
|
/**
|
|
392
391
|
* Loading is true if the signal is still waiting for the promise to resolve, false if the promise
|
|
393
392
|
* has resolved or rejected.
|
|
@@ -406,8 +405,6 @@ declare class AsyncComputedSignalImpl<T> extends ComputedSignalImpl<T | undefine
|
|
|
406
405
|
private setValue;
|
|
407
406
|
}
|
|
408
407
|
|
|
409
|
-
declare type AsyncComputeQRL<T> = _QRLInternal<AsyncComputedFn<T>>;
|
|
410
|
-
|
|
411
408
|
/**
|
|
412
409
|
* Replace given element's props with custom types and return all props specific to the element. Use
|
|
413
410
|
* this for known props that are incorrect or missing.
|
|
@@ -434,12 +431,21 @@ declare type BivariantQrlFn<ARGS extends any[], RETURN> = {
|
|
|
434
431
|
/** @public */
|
|
435
432
|
declare type Booleanish = boolean | `${boolean}`;
|
|
436
433
|
|
|
434
|
+
/**
|
|
435
|
+
* The current captured scope during QRL invocation. This is used to provide the lexical scope for
|
|
436
|
+
* QRL functions. It is used one time per invocation, synchronously, so it is safe to store it in
|
|
437
|
+
* module scope.
|
|
438
|
+
*
|
|
439
|
+
* @internal
|
|
440
|
+
*/
|
|
441
|
+
export declare let _captures: Readonly<unknown[]> | null;
|
|
442
|
+
|
|
437
443
|
/**
|
|
438
444
|
* Handles events for bind:checked
|
|
439
445
|
*
|
|
440
446
|
* @internal
|
|
441
447
|
*/
|
|
442
|
-
export declare
|
|
448
|
+
export declare function _chk(this: string | undefined, _: any, element: HTMLInputElement): void;
|
|
443
449
|
|
|
444
450
|
declare const enum ChoreBits {
|
|
445
451
|
NONE = 0,
|
|
@@ -466,7 +472,7 @@ declare const enum ChoreBits {
|
|
|
466
472
|
export declare type ClassList = string | undefined | null | false | Record<string, boolean | string | number | null | undefined> | ClassList[];
|
|
467
473
|
|
|
468
474
|
/** @internal */
|
|
469
|
-
export declare interface ClientContainer extends
|
|
475
|
+
export declare interface ClientContainer extends _Container {
|
|
470
476
|
document: _QDocument;
|
|
471
477
|
element: _ContainerElement;
|
|
472
478
|
qContainer: string;
|
|
@@ -501,11 +507,11 @@ export declare interface ClientContainer extends Container {
|
|
|
501
507
|
* step?: number;
|
|
502
508
|
* }
|
|
503
509
|
* export const Counter = component$((props: CounterProps) => {
|
|
504
|
-
* const state =
|
|
510
|
+
* const state = useSignal(props.initialValue || 0);
|
|
505
511
|
* return (
|
|
506
512
|
* <div>
|
|
507
|
-
* <span>{state.
|
|
508
|
-
* <button onClick$={() => (state.
|
|
513
|
+
* <span>{state.value}</span>
|
|
514
|
+
* <button onClick$={() => (state.value += props.step || 1)}>+</button>
|
|
509
515
|
* </div>
|
|
510
516
|
* );
|
|
511
517
|
* });
|
|
@@ -575,7 +581,7 @@ export declare type ComputedFn<T> = () => T;
|
|
|
575
581
|
/** @public */
|
|
576
582
|
export declare interface ComputedOptions {
|
|
577
583
|
serializationStrategy?: SerializationStrategy;
|
|
578
|
-
container?:
|
|
584
|
+
container?: _Container;
|
|
579
585
|
}
|
|
580
586
|
|
|
581
587
|
/** @public */
|
|
@@ -616,7 +622,7 @@ declare class ComputedSignalImpl<T, S extends _QRLInternal = ComputeQRL<T>> exte
|
|
|
616
622
|
$computeQrl$: S;
|
|
617
623
|
$flags$: SignalFlags | SerializationSignalFlags;
|
|
618
624
|
[_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
|
|
619
|
-
constructor(container:
|
|
625
|
+
constructor(container: _Container | null, fn: S, flags?: SignalFlags | SerializationSignalFlags);
|
|
620
626
|
invalidate(): void;
|
|
621
627
|
/**
|
|
622
628
|
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
@@ -625,8 +631,6 @@ declare class ComputedSignalImpl<T, S extends _QRLInternal = ComputeQRL<T>> exte
|
|
|
625
631
|
force(): void;
|
|
626
632
|
get untrackedValue(): T;
|
|
627
633
|
$computeIfNeeded$(): void;
|
|
628
|
-
set value(_: any);
|
|
629
|
-
get value(): any;
|
|
630
634
|
}
|
|
631
635
|
|
|
632
636
|
declare type ComputeQRL<T> = _QRLInternal<ComputedFn<T>>;
|
|
@@ -645,7 +649,8 @@ export declare const _CONST_PROPS: unique symbol;
|
|
|
645
649
|
*/
|
|
646
650
|
declare type Consumer = Task | _VNode | SignalImpl | ISsrNode;
|
|
647
651
|
|
|
648
|
-
|
|
652
|
+
/** @internal */
|
|
653
|
+
export declare interface _Container {
|
|
649
654
|
readonly $version$: string;
|
|
650
655
|
readonly $storeProxyMap$: ObjToProxyMap;
|
|
651
656
|
readonly $locale$: string;
|
|
@@ -801,7 +806,7 @@ export declare interface CorePlatform {
|
|
|
801
806
|
* @param symbol - The name of the symbol to import.
|
|
802
807
|
* @returns A promise that resolves to the imported symbol.
|
|
803
808
|
*/
|
|
804
|
-
importSymbol: (containerEl: Element | undefined, url: string | URL | undefined | null, symbol: string) => ValueOrPromise<
|
|
809
|
+
importSymbol: (containerEl: Element | undefined, url: string | URL | undefined | null, symbol: string) => ValueOrPromise<unknown>;
|
|
805
810
|
/**
|
|
806
811
|
* Perform operation on next request-animation-frame.
|
|
807
812
|
*
|
|
@@ -839,10 +844,10 @@ export declare interface CorrectedToggleEvent extends Event {
|
|
|
839
844
|
*
|
|
840
845
|
* @public
|
|
841
846
|
*/
|
|
842
|
-
export declare const
|
|
847
|
+
export declare const createAsync$: <T>(qrl: () => Promise<T>, options?: ComputedOptions) => AsyncSignal<T>;
|
|
843
848
|
|
|
844
849
|
/** @internal */
|
|
845
|
-
export declare const
|
|
850
|
+
export declare const createAsyncQrl: <T>(qrl: QRL<(ctx: AsyncCtx) => Promise<T>>, options?: ComputedOptions) => AsyncSignalImpl<T>;
|
|
846
851
|
|
|
847
852
|
/**
|
|
848
853
|
* Create a computed signal which is calculated from the given QRL. A computed signal is a signal
|
|
@@ -852,7 +857,7 @@ export declare const createAsyncComputedQrl: <T>(qrl: QRL<(ctx: AsyncComputedCtx
|
|
|
852
857
|
* The QRL must be a function which returns the value of the signal. The function must not have side
|
|
853
858
|
* effects, and it must be synchronous.
|
|
854
859
|
*
|
|
855
|
-
* If you need the function to be async, use `
|
|
860
|
+
* If you need the function to be async, use `useAsync$` instead.
|
|
856
861
|
*
|
|
857
862
|
* @public
|
|
858
863
|
*/
|
|
@@ -964,10 +969,9 @@ declare interface DescriptorBase<T = unknown, B = unknown> extends BackRef {
|
|
|
964
969
|
* Deserialize data from string to an array of objects.
|
|
965
970
|
*
|
|
966
971
|
* @param rawStateData - Data to deserialize
|
|
967
|
-
* @param element - Container element
|
|
968
972
|
* @internal
|
|
969
973
|
*/
|
|
970
|
-
export declare function _deserialize(rawStateData: string | null
|
|
974
|
+
export declare function _deserialize(rawStateData: string | null): unknown[];
|
|
971
975
|
|
|
972
976
|
declare interface DeserializeContainer {
|
|
973
977
|
$getObjectById$: (id: number | string) => unknown;
|
|
@@ -1021,7 +1025,7 @@ declare class DomContainer extends _SharedContainer implements ClientContainer {
|
|
|
1021
1025
|
*/
|
|
1022
1026
|
$hoistStyles$(): void;
|
|
1023
1027
|
$setRawState$(id: number, vParent: _VNode): void;
|
|
1024
|
-
parseQRL<T = unknown>(
|
|
1028
|
+
parseQRL<T = unknown>(qrlStr: string): QRL<T>;
|
|
1025
1029
|
handleError(err: any, host: _VNode | null): void;
|
|
1026
1030
|
setContext<T>(host: _VNode, context: ContextId<T>, value: T): void;
|
|
1027
1031
|
resolveContext<T>(host: _VNode, contextId: ContextId<T>): T | undefined;
|
|
@@ -1185,13 +1189,13 @@ export declare type FunctionComponent<P = unknown> = {
|
|
|
1185
1189
|
export declare const _getConstProps: (props: PropsProxy | Record<string, unknown> | null | undefined) => Props | null;
|
|
1186
1190
|
|
|
1187
1191
|
/** @internal */
|
|
1188
|
-
export declare const _getContextContainer: () =>
|
|
1192
|
+
export declare const _getContextContainer: () => _Container | undefined;
|
|
1189
1193
|
|
|
1190
1194
|
/** @internal */
|
|
1191
|
-
export declare const
|
|
1195
|
+
export declare const _getContextEvent: () => unknown;
|
|
1192
1196
|
|
|
1193
1197
|
/** @internal */
|
|
1194
|
-
export declare const
|
|
1198
|
+
export declare const _getContextHostElement: () => HostElement | undefined;
|
|
1195
1199
|
|
|
1196
1200
|
/** @public */
|
|
1197
1201
|
declare function getDomContainer(element: Element): ClientContainer;
|
|
@@ -1384,10 +1388,10 @@ export declare const implicit$FirstArg: <FIRST, REST extends any[], RET>(fn: (qr
|
|
|
1384
1388
|
* @param lexicalScopeCapture - A set of lexically scoped variables to capture.
|
|
1385
1389
|
* @public
|
|
1386
1390
|
*/
|
|
1387
|
-
export declare const inlinedQrl: <T>(symbol: T | null, symbolName: string, lexicalScopeCapture?:
|
|
1391
|
+
export declare const inlinedQrl: <T>(symbol: T | null, symbolName: string, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
1388
1392
|
|
|
1389
1393
|
/** @internal */
|
|
1390
|
-
export declare const inlinedQrlDEV: <T = any>(symbol: T, symbolName: string, opts: QRLDev, lexicalScopeCapture?:
|
|
1394
|
+
export declare const inlinedQrlDEV: <T = any>(symbol: T, symbolName: string, opts: QRLDev, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
1391
1395
|
|
|
1392
1396
|
/** @public */
|
|
1393
1397
|
declare interface InlineEntryStrategy {
|
|
@@ -1419,20 +1423,15 @@ declare type IntrinsicSVGElements = {
|
|
|
1419
1423
|
|
|
1420
1424
|
/** The shared state during an invoke() call */
|
|
1421
1425
|
declare interface InvokeContext {
|
|
1422
|
-
$url$: URL | undefined;
|
|
1423
1426
|
/** The Virtual parent component for the current component code */
|
|
1424
1427
|
$hostElement$: HostElement | undefined;
|
|
1425
1428
|
/** The event we're currently handling */
|
|
1426
1429
|
$event$: PossibleEvents | undefined;
|
|
1427
|
-
/** The QRL function we're currently executing */
|
|
1428
|
-
$qrl$: QRL | undefined;
|
|
1429
1430
|
$effectSubscriber$: EffectSubscription | undefined;
|
|
1430
1431
|
$locale$: string | undefined;
|
|
1431
|
-
$container$:
|
|
1432
|
+
$container$: _Container | undefined;
|
|
1432
1433
|
}
|
|
1433
1434
|
|
|
1434
|
-
declare type InvokeTuple = [Element, Event, URL?];
|
|
1435
|
-
|
|
1436
1435
|
declare type IsAcceptableDOMValue<T> = T extends boolean | number | string | null | undefined ? ((...args: any[]) => any) extends T ? false : true : false;
|
|
1437
1436
|
|
|
1438
1437
|
declare type IsAny<T> = 0 extends T & 1 ? true : false;
|
|
@@ -1585,7 +1584,7 @@ export declare interface JSXNodeInternal<T extends string | FunctionComponent |
|
|
|
1585
1584
|
*
|
|
1586
1585
|
* Does not contain `children` or `key`.
|
|
1587
1586
|
*
|
|
1588
|
-
* `onEvent$` props are normalized to the html `
|
|
1587
|
+
* `onEvent$` props are normalized to the html `q-x:event` version
|
|
1589
1588
|
*/
|
|
1590
1589
|
varProps: Props;
|
|
1591
1590
|
/**
|
|
@@ -1595,7 +1594,7 @@ export declare interface JSXNodeInternal<T extends string | FunctionComponent |
|
|
|
1595
1594
|
*
|
|
1596
1595
|
* Does not contain `children` or `key`.
|
|
1597
1596
|
*
|
|
1598
|
-
* `onEvent$` props are normalized to the html `
|
|
1597
|
+
* `onEvent$` props are normalized to the html `q-x:event` version
|
|
1599
1598
|
*/
|
|
1600
1599
|
constProps: Props | null;
|
|
1601
1600
|
/** The children of the node */
|
|
@@ -1781,10 +1780,10 @@ declare interface NodePropData {
|
|
|
1781
1780
|
}
|
|
1782
1781
|
|
|
1783
1782
|
/** @internal */
|
|
1784
|
-
export declare const _noopQrl: <T>(symbolName: string, lexicalScopeCapture?:
|
|
1783
|
+
export declare const _noopQrl: <T>(symbolName: string, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
1785
1784
|
|
|
1786
1785
|
/** @internal */
|
|
1787
|
-
export declare const _noopQrlDEV: <T>(symbolName: string, opts: QRLDev, lexicalScopeCapture?:
|
|
1786
|
+
export declare const _noopQrlDEV: <T>(symbolName: string, opts: QRLDev, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
1788
1787
|
|
|
1789
1788
|
/**
|
|
1790
1789
|
* Returned type of the `noSerialize()` function. It will be TYPE or undefined.
|
|
@@ -1997,7 +1996,7 @@ declare type PropsProxy = {
|
|
|
1997
1996
|
declare class PropsProxyHandler implements ProxyHandler<any> {
|
|
1998
1997
|
owner: JSXNodeImpl;
|
|
1999
1998
|
$effects$: undefined | Map<string | symbol, Set<EffectSubscription>>;
|
|
2000
|
-
$container$:
|
|
1999
|
+
$container$: _Container | null;
|
|
2001
2000
|
constructor(owner: JSXNodeImpl);
|
|
2002
2001
|
get(_: any, prop: string | symbol): any;
|
|
2003
2002
|
set(_: any, prop: string | symbol, value: any): boolean;
|
|
@@ -2123,7 +2122,7 @@ export declare interface _QDocument extends Document {
|
|
|
2123
2122
|
*
|
|
2124
2123
|
* ```
|
|
2125
2124
|
* <div q:base="/build/">
|
|
2126
|
-
* <button
|
|
2125
|
+
* <button q-e:click="./chunk-abc.js#onClick">...</button>
|
|
2127
2126
|
* </div>
|
|
2128
2127
|
* ```
|
|
2129
2128
|
*
|
|
@@ -2146,7 +2145,7 @@ export declare interface _QDocument extends Document {
|
|
|
2146
2145
|
*/
|
|
2147
2146
|
export declare type QRL<TYPE = unknown> = {
|
|
2148
2147
|
__qwik_serializable__?: any;
|
|
2149
|
-
__brand__QRL__
|
|
2148
|
+
__brand__QRL__?: TYPE;
|
|
2150
2149
|
/** Resolve the QRL and return the actual value. */
|
|
2151
2150
|
resolve(): Promise<TYPE>;
|
|
2152
2151
|
/** The resolved value, once `resolve()` returns. */
|
|
@@ -2169,7 +2168,7 @@ export declare type QRL<TYPE = unknown> = {
|
|
|
2169
2168
|
* @public
|
|
2170
2169
|
* @see `QRL`, `$(...)`
|
|
2171
2170
|
*/
|
|
2172
|
-
export declare const qrl: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, lexicalScopeCapture?:
|
|
2171
|
+
export declare const qrl: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, lexicalScopeCapture?: Readonly<unknown[]> | null, stackOffset?: number) => QRL<T>;
|
|
2173
2172
|
|
|
2174
2173
|
declare type QrlArgs<T> = T extends (...args: infer ARGS) => any ? ARGS : unknown[];
|
|
2175
2174
|
|
|
@@ -2181,7 +2180,7 @@ declare interface QRLDev {
|
|
|
2181
2180
|
}
|
|
2182
2181
|
|
|
2183
2182
|
/** @internal */
|
|
2184
|
-
export declare const qrlDEV: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, opts: QRLDev, lexicalScopeCapture?:
|
|
2183
|
+
export declare const qrlDEV: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, opts: QRLDev, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
2185
2184
|
|
|
2186
2185
|
/**
|
|
2187
2186
|
* An event handler for Qwik events, can be a handler QRL or an array of handler QRLs.
|
|
@@ -2197,16 +2196,22 @@ declare type QRLInternalMethods<TYPE> = {
|
|
|
2197
2196
|
readonly $chunk$: string | null;
|
|
2198
2197
|
readonly $symbol$: string;
|
|
2199
2198
|
readonly $hash$: string;
|
|
2200
|
-
|
|
2201
|
-
$
|
|
2199
|
+
/** If it's a string it's serialized */
|
|
2200
|
+
$captures$: Readonly<unknown[]> | string | null;
|
|
2202
2201
|
dev: QRLDev | null;
|
|
2202
|
+
resolve(container?: _Container): Promise<TYPE>;
|
|
2203
2203
|
resolved: undefined | TYPE;
|
|
2204
|
-
resolve(containerEl?: Element): Promise<TYPE>;
|
|
2205
2204
|
getSymbol(): string;
|
|
2206
2205
|
getHash(): string;
|
|
2207
2206
|
getCaptured(): unknown[] | null;
|
|
2208
|
-
getFn(currentCtx?: InvokeContext
|
|
2209
|
-
|
|
2207
|
+
getFn(currentCtx?: InvokeContext, beforeFn?: () => void): TYPE extends (...args: any) => any ? (...args: Parameters<TYPE>) => ValueOrPromise<ReturnType<TYPE>> : unknown;
|
|
2208
|
+
/**
|
|
2209
|
+
* Needed for deserialization and importing. We don't always have the container while creating
|
|
2210
|
+
* qrls in async sections of code
|
|
2211
|
+
*/
|
|
2212
|
+
$container$: _Container | null;
|
|
2213
|
+
/** Only in dev mode */
|
|
2214
|
+
$symbolRef$?: null | ValueOrPromise<TYPE>;
|
|
2210
2215
|
};
|
|
2211
2216
|
|
|
2212
2217
|
declare type QrlReturn<T> = T extends (...args: any) => infer R ? Awaited<R> : unknown;
|
|
@@ -2490,8 +2495,6 @@ export declare type QwikSymbolEvent = CustomEvent<{
|
|
|
2490
2495
|
element: Element;
|
|
2491
2496
|
reqTime: number;
|
|
2492
2497
|
qBase?: string;
|
|
2493
|
-
qManifest?: string;
|
|
2494
|
-
qVersion?: string;
|
|
2495
2498
|
href?: string;
|
|
2496
2499
|
}>;
|
|
2497
2500
|
|
|
@@ -2731,11 +2734,11 @@ declare interface ResourceReturnInternal<T> {
|
|
|
2731
2734
|
export declare const _restProps: (props: PropsProxy, omit?: string[], target?: Props) => Props;
|
|
2732
2735
|
|
|
2733
2736
|
/**
|
|
2734
|
-
* This is called by qwik-loader to run a QRL. It has to be synchronous.
|
|
2737
|
+
* This is called by qwik-loader to run a QRL. It has to be synchronous when possible.
|
|
2735
2738
|
*
|
|
2736
2739
|
* @internal
|
|
2737
2740
|
*/
|
|
2738
|
-
export declare
|
|
2741
|
+
export declare function _run(this: string, event: Event, element: Element): ValueOrPromise<unknown>;
|
|
2739
2742
|
|
|
2740
2743
|
/** Stores the location of an object. If no parent, it's a root. */
|
|
2741
2744
|
declare type SeenRef = {
|
|
@@ -2792,8 +2795,8 @@ declare interface SerializationContext {
|
|
|
2792
2795
|
}
|
|
2793
2796
|
|
|
2794
2797
|
declare const enum SerializationSignalFlags {
|
|
2795
|
-
SERIALIZATION_STRATEGY_NEVER =
|
|
2796
|
-
SERIALIZATION_STRATEGY_ALWAYS =
|
|
2798
|
+
SERIALIZATION_STRATEGY_NEVER = 8,
|
|
2799
|
+
SERIALIZATION_STRATEGY_ALWAYS = 16
|
|
2797
2800
|
}
|
|
2798
2801
|
|
|
2799
2802
|
/** @public */
|
|
@@ -2868,7 +2871,7 @@ declare interface SerializerSignal<T> extends ComputedSignal<T> {
|
|
|
2868
2871
|
* @public
|
|
2869
2872
|
*/
|
|
2870
2873
|
declare class SerializerSignalImpl<T, S> extends ComputedSignalImpl<T> {
|
|
2871
|
-
constructor(container:
|
|
2874
|
+
constructor(container: _Container | null, argQrl: _QRLInternal<SerializerArg<T, S>>);
|
|
2872
2875
|
$didInitialize$: boolean;
|
|
2873
2876
|
$computeIfNeeded$(): void;
|
|
2874
2877
|
}
|
|
@@ -2911,7 +2914,7 @@ declare type ServerQwikManifest = Pick<QwikManifest, 'manifestHash' | 'injection
|
|
|
2911
2914
|
export declare const setPlatform: (plt: CorePlatform) => CorePlatform;
|
|
2912
2915
|
|
|
2913
2916
|
/** @internal */
|
|
2914
|
-
export declare abstract class _SharedContainer implements
|
|
2917
|
+
export declare abstract class _SharedContainer implements _Container {
|
|
2915
2918
|
readonly $version$: string;
|
|
2916
2919
|
readonly $storeProxyMap$: ObjToProxyMap;
|
|
2917
2920
|
readonly $locale$: string;
|
|
@@ -2970,9 +2973,9 @@ declare class SignalImpl<T = any> implements Signal<T> {
|
|
|
2970
2973
|
$untrackedValue$: T;
|
|
2971
2974
|
/** Store a list of effects which are dependent on this signal. */
|
|
2972
2975
|
$effects$: undefined | Set<EffectSubscription>;
|
|
2973
|
-
$container$:
|
|
2976
|
+
$container$: _Container | null;
|
|
2974
2977
|
$wrappedSignal$: WrappedSignalImpl<T> | null;
|
|
2975
|
-
constructor(container:
|
|
2978
|
+
constructor(container: _Container | null, value: T);
|
|
2976
2979
|
/**
|
|
2977
2980
|
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
2978
2981
|
* remained the same object
|
|
@@ -2989,6 +2992,8 @@ declare class SignalImpl<T = any> implements Signal<T> {
|
|
|
2989
2992
|
};
|
|
2990
2993
|
}
|
|
2991
2994
|
|
|
2995
|
+
declare type SimpleSsrAttrValue = string | Signal<SimpleSsrAttrValue> | boolean | object | null;
|
|
2996
|
+
|
|
2992
2997
|
declare interface SimplifiedServerRequestEvent<T = unknown> {
|
|
2993
2998
|
url: URL;
|
|
2994
2999
|
locale: string | undefined;
|
|
@@ -3268,14 +3273,14 @@ declare type SsrAttrKey = string;
|
|
|
3268
3273
|
|
|
3269
3274
|
declare type SsrAttrs = Array<SsrAttrKey | SsrAttrValue>;
|
|
3270
3275
|
|
|
3271
|
-
declare type SsrAttrValue =
|
|
3276
|
+
declare type SsrAttrValue = SimpleSsrAttrValue | Promise<SimpleSsrAttrValue>;
|
|
3272
3277
|
|
|
3273
3278
|
/** @public */
|
|
3274
3279
|
export declare const SSRComment: FunctionComponent<{
|
|
3275
3280
|
data: string;
|
|
3276
3281
|
}>;
|
|
3277
3282
|
|
|
3278
|
-
declare interface SSRContainer extends
|
|
3283
|
+
declare interface SSRContainer extends _Container {
|
|
3279
3284
|
readonly tag: string;
|
|
3280
3285
|
readonly isHtml: boolean;
|
|
3281
3286
|
readonly size: number;
|
|
@@ -3689,11 +3694,12 @@ declare class Task<T = unknown, B = T> extends BackRef implements DescriptorBase
|
|
|
3689
3694
|
}
|
|
3690
3695
|
|
|
3691
3696
|
/**
|
|
3692
|
-
* Used internally as a
|
|
3697
|
+
* Used internally as a qwikloader event handler to schedule a task. The `this` context is the
|
|
3698
|
+
* captures part of the QRL, provided by qwikloader.
|
|
3693
3699
|
*
|
|
3694
3700
|
* @internal
|
|
3695
3701
|
*/
|
|
3696
|
-
export declare
|
|
3702
|
+
export declare function _task(this: string, _event: Event, element: Element): void;
|
|
3697
3703
|
|
|
3698
3704
|
/** @public */
|
|
3699
3705
|
export declare interface TaskCtx {
|
|
@@ -3738,6 +3744,8 @@ export declare class _TextVNode extends _VNode {
|
|
|
3738
3744
|
* useTask$(({ track }) => {
|
|
3739
3745
|
* // Any signals or stores accessed inside the task will be tracked
|
|
3740
3746
|
* const count = track(() => store.count);
|
|
3747
|
+
* // For stores you can also pass the store and specify the property
|
|
3748
|
+
* track(store, 'count');
|
|
3741
3749
|
* // You can also pass a signal to track() directly
|
|
3742
3750
|
* const signalCount = track(signal);
|
|
3743
3751
|
* store.doubleCount = count + signalCount;
|
|
@@ -3832,19 +3840,30 @@ declare type UnwantedKeys = keyof HTMLAttributesBase | keyof DOMAttributes<any>
|
|
|
3832
3840
|
export declare const unwrapStore: <T>(value: T) => T;
|
|
3833
3841
|
|
|
3834
3842
|
/**
|
|
3835
|
-
* Creates
|
|
3836
|
-
*
|
|
3837
|
-
*
|
|
3838
|
-
*
|
|
3843
|
+
* Creates an AsyncSignal which holds the result of the given async function. If the function uses
|
|
3844
|
+
* `track()` to track reactive state, and that state changes, the AsyncSignal is recalculated, and
|
|
3845
|
+
* if the result changed, all tasks which are tracking the AsyncSignal will be re-run and all
|
|
3846
|
+
* subscribers (components, tasks etc) that read the AsyncSignal will be updated.
|
|
3839
3847
|
*
|
|
3840
|
-
*
|
|
3848
|
+
* If the async function throws an error, the AsyncSignal will capture the error and set the `error`
|
|
3849
|
+
* property. The error can be cleared by re-running the async function successfully.
|
|
3850
|
+
*
|
|
3851
|
+
* While the async function is running, the `loading` property will be set to `true`. Once the
|
|
3852
|
+
* function completes, `loading` will be set to `false`.
|
|
3853
|
+
*
|
|
3854
|
+
* If the value has not yet been resolved, reading the AsyncSignal will throw a Promise, which will
|
|
3855
|
+
* retry the component or task once the value resolves.
|
|
3856
|
+
*
|
|
3857
|
+
* If the value has been resolved, but the async function is re-running, reading the AsyncSignal
|
|
3858
|
+
* will subscribe to it and return the last resolved value until the new value is ready. As soon as
|
|
3859
|
+
* the new value is ready, the subscribers will be updated.
|
|
3841
3860
|
*
|
|
3842
3861
|
* @public
|
|
3843
3862
|
*/
|
|
3844
|
-
export declare const
|
|
3863
|
+
export declare const useAsync$: <T>(qrl: AsyncFn<T>, options?: ComputedOptions | undefined) => AsyncSignal<T>;
|
|
3845
3864
|
|
|
3846
3865
|
/** @internal */
|
|
3847
|
-
export declare const
|
|
3866
|
+
export declare const useAsyncQrl: <T>(qrl: QRL<AsyncFn<T>>, options?: ComputedOptions) => AsyncSignal<T>;
|
|
3848
3867
|
|
|
3849
3868
|
/**
|
|
3850
3869
|
* Creates a computed signal which is calculated from the given function. A computed signal is a
|
|
@@ -3865,11 +3884,23 @@ export declare const useComputedQrl: <T>(qrl: QRL<ComputedFn<T>>, options?: Comp
|
|
|
3865
3884
|
* Stores a value which is retained for the lifetime of the component. Subsequent calls to
|
|
3866
3885
|
* `useConstant` will always return the first value given.
|
|
3867
3886
|
*
|
|
3868
|
-
* If the value is a function, the function is invoked once to calculate the actual value.
|
|
3887
|
+
* If the value is a function, the function is invoked once to calculate the actual value. You can
|
|
3888
|
+
* then also pass arguments to call the function with, so that you don't need to create a new
|
|
3889
|
+
* function on every render.
|
|
3890
|
+
*
|
|
3891
|
+
* @example
|
|
3892
|
+
*
|
|
3893
|
+
* ```tsx
|
|
3894
|
+
* const fixedRandomValue = useConstant(() => Math.random);
|
|
3895
|
+
* const otherFixedRandomValue = useConstant(Math.random);
|
|
3896
|
+
*
|
|
3897
|
+
* const getConfig = (env: string) => { ... }
|
|
3898
|
+
* const config = useConstant(getConfig, environment);
|
|
3899
|
+
* ```
|
|
3869
3900
|
*
|
|
3870
3901
|
* @public
|
|
3871
3902
|
*/
|
|
3872
|
-
export declare const useConstant: <T>(value: (() => T) | T) => T;
|
|
3903
|
+
export declare const useConstant: <T, A extends any[]>(value: ((...args: A) => T) | T, ...args: A) => T;
|
|
3873
3904
|
|
|
3874
3905
|
declare interface UseContext {
|
|
3875
3906
|
<STATE, T>(context: ContextId<STATE>, transformer: (value: STATE) => T): T;
|
|
@@ -3992,6 +4023,7 @@ export declare const useId: () => string;
|
|
|
3992
4023
|
* NOTE: `useLexicalScope` method can only be used in the synchronous portion of the callback
|
|
3993
4024
|
* (before any `await` statements.)
|
|
3994
4025
|
*
|
|
4026
|
+
* @deprecated Read from `_captures` directly instead.
|
|
3995
4027
|
* @internal
|
|
3996
4028
|
*/
|
|
3997
4029
|
export declare const useLexicalScope: <VARS extends any[]>() => VARS;
|
|
@@ -4191,7 +4223,7 @@ export declare const useResourceQrl: <T>(qrl: QRL<ResourceFn<T>>, opts?: Resourc
|
|
|
4191
4223
|
export declare const useSerializer$: typeof createSerializer$;
|
|
4192
4224
|
|
|
4193
4225
|
/** @internal */
|
|
4194
|
-
export declare const useSerializerQrl: <T, S>(qrl: QRL<SerializerArg<T, S>>) =>
|
|
4226
|
+
export declare const useSerializerQrl: <T, S>(qrl: QRL<SerializerArg<T, S>>) => SerializerSignalImpl<T, S>;
|
|
4195
4227
|
|
|
4196
4228
|
/** @public */
|
|
4197
4229
|
export declare function useServerData<T>(key: string): T | undefined;
|
|
@@ -4205,14 +4237,61 @@ export declare interface UseSignal {
|
|
|
4205
4237
|
<T>(value: T | (() => T)): Signal<T>;
|
|
4206
4238
|
}
|
|
4207
4239
|
|
|
4208
|
-
/**
|
|
4240
|
+
/**
|
|
4241
|
+
* Creates an object with a single reactive `.value` property, that Qwik can track across
|
|
4242
|
+
* serializations.
|
|
4243
|
+
*
|
|
4244
|
+
* Use it to create state for your application. The object has a getter and setter to track reads
|
|
4245
|
+
* and writes of the `.value` property. When the value changes, any functions that read from it will
|
|
4246
|
+
* re-run.
|
|
4247
|
+
*
|
|
4248
|
+
* Prefer `useSignal` over `useStore` when possible, as it is more efficient.
|
|
4249
|
+
*
|
|
4250
|
+
* ### Example
|
|
4251
|
+
*
|
|
4252
|
+
* ```tsx
|
|
4253
|
+
* const Signals = component$(() => {
|
|
4254
|
+
* const counter = useSignal(1);
|
|
4255
|
+
* const text = useSignal('changeme');
|
|
4256
|
+
* const toggle = useSignal(false);
|
|
4257
|
+
*
|
|
4258
|
+
* // useSignal() can also accept a function to calculate the initial value
|
|
4259
|
+
* const state = useSignal(() => {
|
|
4260
|
+
* return expensiveInitialValue();
|
|
4261
|
+
* });
|
|
4262
|
+
*
|
|
4263
|
+
* return (
|
|
4264
|
+
* <div>
|
|
4265
|
+
* <button onClick$={() => counter.value++}>Counter: {counter.value}</button>
|
|
4266
|
+
* {
|
|
4267
|
+
* // pass signal values as the value, the optimizer will make it pass the signal
|
|
4268
|
+
* }
|
|
4269
|
+
* <Child state={state.value} />
|
|
4270
|
+
* {
|
|
4271
|
+
* // signals can be bound to inputs. A property named `bind:x` implies that the property
|
|
4272
|
+
* is a signal
|
|
4273
|
+
* }
|
|
4274
|
+
* <input type="text" bind:value={text} />
|
|
4275
|
+
* <input type="checkbox" bind:checked={toggle} />
|
|
4276
|
+
* </div>
|
|
4277
|
+
* );
|
|
4278
|
+
* });
|
|
4279
|
+
* ```
|
|
4280
|
+
*
|
|
4281
|
+
* @public
|
|
4282
|
+
*/
|
|
4209
4283
|
export declare const useSignal: UseSignal;
|
|
4210
4284
|
|
|
4211
4285
|
/**
|
|
4212
|
-
* Creates
|
|
4286
|
+
* Creates a reactive object that Qwik can track across serialization.
|
|
4287
|
+
*
|
|
4288
|
+
* Use it to create state for your application. The returned object is a Proxy that tracks reads and
|
|
4289
|
+
* writes. When any of the properties change, the functions that read those properties will re-run.
|
|
4290
|
+
*
|
|
4291
|
+
* `Store`s are deep by default, meaning that any objects assigned to properties will also become
|
|
4292
|
+
* `Store`s. This includes arrays.
|
|
4213
4293
|
*
|
|
4214
|
-
*
|
|
4215
|
-
* unique ID. The ID of the object is used in the `QRL`s to refer to the store.
|
|
4294
|
+
* Prefer `useSignal` over `useStore` when possible, as it is more efficient.
|
|
4216
4295
|
*
|
|
4217
4296
|
* ### Example
|
|
4218
4297
|
*
|
|
@@ -4430,7 +4509,7 @@ export declare const useVisibleTaskQrl: (qrl: QRL<TaskFn>, opts?: OnVisibleTaskO
|
|
|
4430
4509
|
*
|
|
4431
4510
|
* @internal
|
|
4432
4511
|
*/
|
|
4433
|
-
export declare
|
|
4512
|
+
export declare function _val(this: string | undefined, _: any, element: HTMLInputElement): void;
|
|
4434
4513
|
|
|
4435
4514
|
/**
|
|
4436
4515
|
* Type representing a value which is either resolve or a promise.
|
|
@@ -4446,7 +4525,7 @@ export declare const _VAR_PROPS: unique symbol;
|
|
|
4446
4525
|
export declare const _verifySerializable: <T>(value: T, preMessage?: string) => T;
|
|
4447
4526
|
|
|
4448
4527
|
/**
|
|
4449
|
-
* 2.0.0-beta.
|
|
4528
|
+
* 2.0.0-beta.21-dev+c008e88
|
|
4450
4529
|
*
|
|
4451
4530
|
* @public
|
|
4452
4531
|
*/
|
|
@@ -4480,10 +4559,10 @@ export declare abstract class _VNode implements BackRef {
|
|
|
4480
4559
|
}
|
|
4481
4560
|
|
|
4482
4561
|
/** @internal */
|
|
4483
|
-
export declare const _vnode_ensureElementInflated: (vnode: _VNode) => void;
|
|
4562
|
+
export declare const _vnode_ensureElementInflated: (container: _Container, vnode: _VNode) => void;
|
|
4484
4563
|
|
|
4485
4564
|
/** @internal */
|
|
4486
|
-
export declare const _vnode_getAttrKeys: (vnode: _ElementVNode | _VirtualVNode) => string[];
|
|
4565
|
+
export declare const _vnode_getAttrKeys: (container: _Container, vnode: _ElementVNode | _VirtualVNode) => string[];
|
|
4487
4566
|
|
|
4488
4567
|
/** @internal */
|
|
4489
4568
|
export declare const _vnode_getFirstChild: (vnode: _VNode) => _VNode | null;
|
|
@@ -4498,7 +4577,7 @@ export declare const _vnode_isTextVNode: (vNode: _VNode) => vNode is _TextVNode;
|
|
|
4498
4577
|
export declare const _vnode_isVirtualVNode: (vNode: _VNode) => vNode is _VirtualVNode;
|
|
4499
4578
|
|
|
4500
4579
|
/** @internal */
|
|
4501
|
-
export declare function _vnode_toString(this: _VNode | null, depth?: number, offset?: string, materialize?: boolean, siblings?: boolean, colorize?: boolean): string;
|
|
4580
|
+
export declare function _vnode_toString(this: _VNode | null, depth?: number, offset?: string, materialize?: boolean, siblings?: boolean, colorize?: boolean, container?: ClientContainer | null): string;
|
|
4502
4581
|
|
|
4503
4582
|
/**
|
|
4504
4583
|
* Array of numbers which describes virtual nodes in the tree.
|
|
@@ -4573,16 +4652,18 @@ export declare const enum _VNodeFlags {
|
|
|
4573
4652
|
Inflated = 8,
|
|
4574
4653
|
Resolved = 16,
|
|
4575
4654
|
Deleted = 32,
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4655
|
+
HasIterationItems = 64,
|
|
4656
|
+
InflatedIterationItems = 128,
|
|
4657
|
+
Cursor = 256,
|
|
4658
|
+
NAMESPACE_MASK = 1536,
|
|
4659
|
+
NEGATED_NAMESPACE_MASK = -1537,
|
|
4579
4660
|
NS_html = 0,// http://www.w3.org/1999/xhtml
|
|
4580
|
-
NS_svg =
|
|
4581
|
-
NS_math =
|
|
4661
|
+
NS_svg = 512,// http://www.w3.org/2000/svg
|
|
4662
|
+
NS_math = 1024
|
|
4582
4663
|
}
|
|
4583
4664
|
|
|
4584
4665
|
/** @internal */
|
|
4585
|
-
export declare const _waitUntilRendered: (
|
|
4666
|
+
export declare const _waitUntilRendered: (container: _Container) => Promise<void>;
|
|
4586
4667
|
|
|
4587
4668
|
/** @internal */
|
|
4588
4669
|
export declare function _walkJSX(ssr: SSRContainer, value: JSXOutput, options: {
|
|
@@ -4610,7 +4691,7 @@ declare class WrappedSignalImpl<T> extends SignalImpl<T> implements BackRef {
|
|
|
4610
4691
|
$flags$: AllSignalFlags;
|
|
4611
4692
|
$hostElement$: HostElement | undefined;
|
|
4612
4693
|
[_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
|
|
4613
|
-
constructor(container:
|
|
4694
|
+
constructor(container: _Container | null, fn: (...args: any[]) => T, args: any[], fnStr: string | null, flags?: SignalFlags);
|
|
4614
4695
|
invalidate(): void;
|
|
4615
4696
|
/**
|
|
4616
4697
|
* Use this to force running subscribers, for example when the calculated value has mutated but
|