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

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.
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwik.dev/core/build",
3
- "version": "2.0.0-beta.3-dev+aa098fc",
3
+ "version": "2.0.0-beta.5-dev+8887f7e",
4
4
  "main": "index.mjs",
5
5
  "types": "index.d.ts",
6
6
  "private": true,
package/dist/cli.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/cli 2.0.0-beta.3-dev+aa098fc
3
+ * @qwik.dev/core/cli 2.0.0-beta.5-dev+8887f7e
4
4
  * Copyright QwikDev. All Rights Reserved.
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
@@ -5536,7 +5536,7 @@ async function printHelp(app) {
5536
5536
  await runCommand2(Object.assign(app, { task: args[0], args }));
5537
5537
  }
5538
5538
  function printVersion() {
5539
- console.log("2.0.0-beta.3-dev+aa098fc");
5539
+ console.log("2.0.0-beta.5-dev+8887f7e");
5540
5540
  }
5541
5541
  // Annotate the CommonJS export names for ESM import in node:
5542
5542
  0 && (module.exports = {
@@ -1,9 +1,9 @@
1
+ import { ComputedSignal as ComputedSignal_2 } from '..';
1
2
  import * as CSS_2 from 'csstype';
2
3
  import { isBrowser } from './build';
3
4
  import { isDev } from './build';
4
5
  import { isServer } from './build';
5
6
  import { QRL as QRL_2 } from './qrl.public';
6
- import { ReadonlySignal as ReadonlySignal_2 } from '..';
7
7
  import type { StreamWriter as StreamWriter_2 } from '.';
8
8
  import { ValueOrPromise as ValueOrPromise_2 } from '..';
9
9
 
@@ -99,7 +99,7 @@ declare type _AllowPlainQrl<Q> = QRLEventHandlerMulti<any, any> extends Q ? Q ex
99
99
 
100
100
  declare type AllPascalEventMaps = PascalMap<AllEventsMap>;
101
101
 
102
- declare type AllSignalFlags = SignalFlags | WrappedSignalFlags;
102
+ declare type AllSignalFlags = SignalFlags | WrappedSignalFlags | ComputedSignalFlags;
103
103
 
104
104
  /**
105
105
  * TS defines these with the React syntax which is not compatible with Qwik. E.g. `ariaAtomic`
@@ -366,12 +366,43 @@ declare type AsyncComputedCtx = {
366
366
  export declare type AsyncComputedFn<T> = (ctx: AsyncComputedCtx) => Promise<T>;
367
367
 
368
368
  /** @public */
369
- export declare interface AsyncComputedReadonlySignal<T = unknown> extends ReadonlySignal<T> {
369
+ export declare interface AsyncComputedReadonlySignal<T = unknown> extends ComputedSignal<T> {
370
370
  }
371
371
 
372
372
  /** @public */
373
373
  export declare type AsyncComputedReturnType<T> = T extends Promise<infer T> ? AsyncComputedReadonlySignal<T> : AsyncComputedReadonlySignal<T>;
374
374
 
375
+ /**
376
+ * # ================================
377
+ *
378
+ * AsyncComputedSignalImpl
379
+ *
380
+ * # ================================
381
+ */
382
+ declare class AsyncComputedSignalImpl<T> extends ComputedSignalImpl<T, AsyncComputeQRL<T>> implements BackRef {
383
+ $untrackedLoading$: boolean;
384
+ $untrackedError$: Error | null;
385
+ $loadingEffects$: null | Set<EffectSubscription>;
386
+ $errorEffects$: null | Set<EffectSubscription>;
387
+ $destroy$: NoSerialize<() => void> | null;
388
+ private $promiseValue$;
389
+ [_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | null;
390
+ constructor(container: Container | null, fn: AsyncComputeQRL<T>, flags?: SignalFlags | ComputedSignalFlags);
391
+ /**
392
+ * Loading is true if the signal is still waiting for the promise to resolve, false if the promise
393
+ * has resolved or rejected.
394
+ */
395
+ get loading(): boolean;
396
+ set untrackedLoading(value: boolean);
397
+ get untrackedLoading(): boolean;
398
+ /** The error that occurred when the signal was resolved. */
399
+ get error(): Error | null;
400
+ set untrackedError(value: Error | null);
401
+ get untrackedError(): Error | null;
402
+ invalidate(): void;
403
+ $computeIfNeeded$(): boolean;
404
+ }
405
+
375
406
  declare type AsyncComputeQRL<T> = QRLInternal<AsyncComputedFn<T>>;
376
407
 
377
408
  /**
@@ -540,7 +571,13 @@ export declare const componentQrl: <PROPS extends Record<any, any>>(componentQrl
540
571
  export declare type ComputedFn<T> = () => T;
541
572
 
542
573
  /** @public */
543
- export declare type ComputedReturnType<T> = T extends Promise<any> ? never : ReadonlySignal<T>;
574
+ export declare interface ComputedOptions {
575
+ serializationStrategy?: SerializationStrategy;
576
+ container?: Container;
577
+ }
578
+
579
+ /** @public */
580
+ export declare type ComputedReturnType<T> = T extends Promise<any> ? never : ComputedSignal<T>;
544
581
 
545
582
  /**
546
583
  * A computed signal is a signal which is calculated from other signals. When the signals change,
@@ -551,10 +588,20 @@ export declare type ComputedReturnType<T> = T extends Promise<any> ? never : Rea
551
588
  */
552
589
  export declare interface ComputedSignal<T> extends ReadonlySignal<T> {
553
590
  /**
554
- * Use this to force recalculation and running subscribers, for example when the calculated value
555
- * mutates but remains the same object. Useful for third-party libraries.
591
+ * Use this to force running subscribers, for example when the calculated value mutates but
592
+ * remains the same object.
556
593
  */
557
594
  force(): void;
595
+ /**
596
+ * Use this to force recalculation and running subscribers, for example when the calculated value
597
+ * mutates but remains the same object.
598
+ */
599
+ invalidate(): void;
600
+ }
601
+
602
+ declare const enum ComputedSignalFlags {
603
+ SERIALIZATION_STRATEGY_NEVER = 8,
604
+ SERIALIZATION_STRATEGY_ALWAYS = 16
558
605
  }
559
606
 
560
607
  /**
@@ -570,11 +617,11 @@ declare class ComputedSignalImpl<T, S extends QRLInternal = ComputeQRL<T>> exten
570
617
  * resolve the QRL during the mark dirty phase so that any call to it will be synchronous). )
571
618
  */
572
619
  $computeQrl$: S;
573
- $flags$: SignalFlags;
620
+ $flags$: SignalFlags | ComputedSignalFlags;
574
621
  $forceRunEffects$: boolean;
575
622
  [_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | null;
576
- constructor(container: Container | null, fn: S, flags?: SignalFlags);
577
- $invalidate$(): void;
623
+ constructor(container: Container | null, fn: S, flags?: SignalFlags | ComputedSignalFlags);
624
+ invalidate(): void;
578
625
  /**
579
626
  * Use this to force running subscribers, for example when the calculated value has mutated but
580
627
  * remained the same object
@@ -789,6 +836,21 @@ export declare interface CorrectedToggleEvent extends Event {
789
836
  readonly prevState: 'open' | 'closed';
790
837
  }
791
838
 
839
+ /**
840
+ * Create an async computed signal which is calculated from the given QRL. A computed signal is a
841
+ * signal which is calculated from other signals or async operation. When the signals change, the
842
+ * computed signal is recalculated.
843
+ *
844
+ * The QRL must be a function which returns the value of the signal. The function must not have side
845
+ * effects, and it can be async.
846
+ *
847
+ * @public
848
+ */
849
+ export declare const createAsyncComputed$: <T>(qrl: () => Promise<T>, options?: ComputedOptions) => AsyncComputedReturnType<T>;
850
+
851
+ /** @internal */
852
+ export declare const createAsyncComputedQrl: <T>(qrl: QRL<(ctx: AsyncComputedCtx) => Promise<T>>, options?: ComputedOptions) => AsyncComputedSignalImpl<T>;
853
+
792
854
  /**
793
855
  * Create a computed signal which is calculated from the given QRL. A computed signal is a signal
794
856
  * which is calculated from other signals. When the signals change, the computed signal is
@@ -797,14 +859,14 @@ export declare interface CorrectedToggleEvent extends Event {
797
859
  * The QRL must be a function which returns the value of the signal. The function must not have side
798
860
  * effects, and it must be synchronous.
799
861
  *
800
- * If you need the function to be async, use `useSignal` and `useTask$` instead.
862
+ * If you need the function to be async, use `useAsyncComputed$` instead.
801
863
  *
802
864
  * @public
803
865
  */
804
- export declare const createComputed$: <T>(qrl: () => T) => T extends Promise<any> ? never : ComputedSignal<T>;
866
+ export declare const createComputed$: <T>(qrl: () => T, options?: ComputedOptions) => ComputedReturnType<T>;
805
867
 
806
868
  /** @internal */
807
- export declare const createComputedQrl: <T>(qrl: QRL<() => T>) => ComputedSignalImpl<T>;
869
+ export declare const createComputedQrl: <T>(qrl: QRL<() => T>, options?: ComputedOptions) => ComputedSignalImpl<T>;
808
870
 
809
871
  /**
810
872
  * Create a context ID to be used in your application. The name should be written with no spaces.
@@ -1164,6 +1226,9 @@ export declare type FunctionComponent<P = unknown> = {
1164
1226
  renderFn(props: P, key: string | null, flags: number, dev?: DevJSX): JSXOutput;
1165
1227
  }['renderFn'];
1166
1228
 
1229
+ /** @internal */
1230
+ export declare const _getContextContainer: () => ClientContainer | undefined;
1231
+
1167
1232
  /** @internal */
1168
1233
  export declare const _getContextElement: () => unknown;
1169
1234
 
@@ -1293,7 +1358,7 @@ declare interface HTMLAttributesBase extends AriaAttributes {
1293
1358
  declare type HTMLCrossOriginAttribute = 'anonymous' | 'use-credentials' | '' | undefined;
1294
1359
 
1295
1360
  /** @public */
1296
- export declare interface HTMLElementAttrs extends HTMLAttributesBase, FilterBase<HTMLElement> {
1361
+ declare interface HTMLElementAttrs extends HTMLAttributesBase, FilterBase<HTMLElement> {
1297
1362
  }
1298
1363
 
1299
1364
  /** @public */
@@ -2386,6 +2451,13 @@ export declare const render: (parent: Element | Document, jsxNode: JSXOutput | F
2386
2451
 
2387
2452
  declare const RenderEvent = "qRender";
2388
2453
 
2454
+ declare interface RenderInvokeContext extends InvokeContext {
2455
+ $hostElement$: HostElement;
2456
+ $event$: PossibleEvents;
2457
+ $waitOn$: Promise<unknown>[];
2458
+ $container$: Container;
2459
+ }
2460
+
2389
2461
  /** @public */
2390
2462
  export declare const RenderOnce: FunctionComponent<{
2391
2463
  children?: unknown;
@@ -2601,7 +2673,7 @@ declare interface SerializationContext {
2601
2673
  $addRootPath$: (obj: any) => string | number;
2602
2674
  $seen$: (obj: unknown, parent: unknown | null, index: number) => void;
2603
2675
  $roots$: unknown[];
2604
- $pathMap$: Map<unknown, string | number>;
2676
+ $objectPathStringCache$: Map<unknown, string | number>;
2605
2677
  $addSyncFn$($funcStr$: string | null, argsCount: number, fn: Function): number;
2606
2678
  $isSsrNode$: (obj: unknown) => obj is SsrNode;
2607
2679
  $isDomRef$: (obj: unknown) => obj is DomRef;
@@ -2616,6 +2688,17 @@ declare interface SerializationContext {
2616
2688
  $setProp$: (obj: any, prop: string, value: any) => void;
2617
2689
  }
2618
2690
 
2691
+ /** @public */
2692
+ export declare type SerializationStrategy = 'never' | 'always';
2693
+
2694
+ declare class SerializationWeakRef {
2695
+ $obj$: unknown;
2696
+ constructor($obj$: unknown);
2697
+ }
2698
+
2699
+ /** @internal */
2700
+ export declare const _serializationWeakRef: (obj: unknown) => SerializationWeakRef;
2701
+
2619
2702
  /**
2620
2703
  * Serialize data to string using SerializationContext.
2621
2704
  *
@@ -3461,7 +3544,7 @@ export declare interface SVGAttributes<T extends Element = Element> extends Aria
3461
3544
  }
3462
3545
 
3463
3546
  /** @public */
3464
- export declare interface SVGProps<T extends Element> extends SVGAttributes, QwikAttributes<T> {
3547
+ declare interface SVGProps<T extends Element> extends SVGAttributes, QwikAttributes<T> {
3465
3548
  }
3466
3549
 
3467
3550
  /** @public */
@@ -3630,6 +3713,9 @@ export declare interface Tracker {
3630
3713
  <T extends object, P extends keyof T>(obj: T, prop: P): T[P];
3631
3714
  }
3632
3715
 
3716
+ /** @internal */
3717
+ export declare const _UNINITIALIZED: unique symbol;
3718
+
3633
3719
  /**
3634
3720
  * Don't track listeners for this callback
3635
3721
  *
@@ -3657,10 +3743,10 @@ export declare const unwrapStore: <T>(value: T) => T;
3657
3743
  *
3658
3744
  * @public
3659
3745
  */
3660
- export declare const useAsyncComputed$: <T>(qrl: AsyncComputedFn<T>) => AsyncComputedReturnType<T>;
3746
+ export declare const useAsyncComputed$: <T>(qrl: AsyncComputedFn<T>, options?: ComputedOptions | undefined) => AsyncComputedReturnType<T>;
3661
3747
 
3662
3748
  /** @internal */
3663
- export declare const useAsyncComputedQrl: <T>(qrl: QRL<AsyncComputedFn<T>>) => AsyncComputedReturnType<T>;
3749
+ export declare const useAsyncComputedQrl: <T>(qrl: QRL<AsyncComputedFn<T>>, options?: ComputedOptions) => AsyncComputedReturnType<T>;
3664
3750
 
3665
3751
  /**
3666
3752
  * Creates a computed signal which is calculated from the given function. A computed signal is a
@@ -3672,10 +3758,10 @@ export declare const useAsyncComputedQrl: <T>(qrl: QRL<AsyncComputedFn<T>>) => A
3672
3758
  *
3673
3759
  * @public
3674
3760
  */
3675
- export declare const useComputed$: <T>(qrl: ComputedFn<T>) => ComputedReturnType<T>;
3761
+ export declare const useComputed$: <T>(qrl: ComputedFn<T>, options?: ComputedOptions | undefined) => ComputedReturnType<T>;
3676
3762
 
3677
3763
  /** @internal */
3678
- export declare const useComputedQrl: <T>(qrl: QRL<ComputedFn<T>>) => ComputedReturnType<T>;
3764
+ export declare const useComputedQrl: <T>(qrl: QRL<ComputedFn<T>>, options?: ComputedOptions) => ComputedReturnType<T>;
3679
3765
 
3680
3766
  /**
3681
3767
  * Stores a value which is retained for the lifetime of the component. Subsequent calls to
@@ -3800,6 +3886,9 @@ export declare const useErrorBoundary: () => ErrorBoundaryStore;
3800
3886
  /** @public */
3801
3887
  export declare const useId: () => string;
3802
3888
 
3889
+ /** @internal */
3890
+ export declare const _useInvokeContext: () => RenderInvokeContext;
3891
+
3803
3892
  /**
3804
3893
  * Used by the Qwik Optimizer to restore the lexically scoped variables.
3805
3894
  *
@@ -4001,7 +4090,7 @@ export declare const useResourceQrl: <T>(qrl: QRL<ResourceFn<T>>, opts?: Resourc
4001
4090
  export declare const useSerializer$: typeof createSerializer$;
4002
4091
 
4003
4092
  /** @internal */
4004
- export declare const useSerializerQrl: <T, S>(qrl: QRL<SerializerArg<T, S>>) => ReadonlySignal_2<unknown>;
4093
+ export declare const useSerializerQrl: <T, S>(qrl: QRL<SerializerArg<T, S>>) => ComputedSignal_2<unknown>;
4005
4094
 
4006
4095
  /** @public */
4007
4096
  export declare function useServerData<T>(key: string): T | undefined;
@@ -4249,7 +4338,7 @@ export declare const _VAR_PROPS: unique symbol;
4249
4338
  export declare const _verifySerializable: <T>(value: T, preMessage?: string) => T;
4250
4339
 
4251
4340
  /**
4252
- * 2.0.0-beta.3-dev+aa098fc
4341
+ * 2.0.0-beta.5-dev+8887f7e
4253
4342
  *
4254
4343
  * @public
4255
4344
  */
@@ -4389,9 +4478,6 @@ export declare function _walkJSX(ssr: SSRContainer, value: JSXOutput, options: {
4389
4478
  parentComponentFrame: ISsrComponentFrame | null;
4390
4479
  }): Promise<void>;
4391
4480
 
4392
- /** @internal */
4393
- export declare const _weakSerialize: <T extends object>(input: T) => Partial<T>;
4394
-
4395
4481
  /**
4396
4482
  * Override the `getLocale` with `lang` within the `fn` execution.
4397
4483
  *
@@ -4412,7 +4498,7 @@ declare class WrappedSignalImpl<T> extends SignalImpl<T> implements BackRef {
4412
4498
  $forceRunEffects$: boolean;
4413
4499
  [_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | null;
4414
4500
  constructor(container: Container | null, fn: (...args: any[]) => T, args: any[], fnStr: string | null, flags?: SignalFlags);
4415
- $invalidate$(): void;
4501
+ invalidate(): void;
4416
4502
  /**
4417
4503
  * Use this to force running subscribers, for example when the calculated value has mutated but
4418
4504
  * remained the same object.
@@ -4440,7 +4526,4 @@ export declare const _wrapProp: <T extends Record<any, any>, P extends keyof T>(
4440
4526
  /** @internal @deprecated v1 compat */
4441
4527
  export declare const _wrapSignal: <T extends Record<any, any>, P extends keyof T>(obj: T, prop: P) => any;
4442
4528
 
4443
- /** @internal */
4444
- export declare const _wrapStore: <T extends Record<any, any>, P extends keyof T>(obj: T, prop: P) => Signal<T>;
4445
-
4446
4529
  export { }