@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.
@@ -16,7 +16,12 @@ declare interface AddRootFn {
16
16
  (obj: unknown, returnRef: true): SeenRef;
17
17
  }
18
18
 
19
- declare type AllSignalFlags = SignalFlags | WrappedSignalFlags | SerializationSignalFlags;
19
+ declare type AllSignalFlags = SignalFlags | WrappedSignalFlags | SerializationSignalFlags | AsyncSignalFlags;
20
+
21
+ declare const enum AsyncSignalFlags {
22
+ EAGER_CLEANUP = 32,
23
+ CLIENT_ONLY = 64
24
+ }
20
25
 
21
26
  /** Class for back reference to the EffectSubscription */
22
27
  declare abstract class BackRef {
@@ -67,8 +72,8 @@ declare interface Container {
67
72
  $buildBase$: string | null;
68
73
  $renderPromise$: Promise<void> | null;
69
74
  $resolveRenderPromise$: (() => void) | null;
70
- $cursorCount$: number;
71
- $pausedCursorCount$: number;
75
+ $pendingCount$: number;
76
+ $checkPendingCount$(): void;
72
77
  handleError(err: any, $host$: HostElement | null): void;
73
78
  getParentHost(host: HostElement): HostElement | null;
74
79
  setContext<T>(host: HostElement, context: ContextId<T>, value: T): void;
@@ -179,7 +184,7 @@ declare interface DescriptorBase<T = unknown, B = unknown> extends BackRef {
179
184
  $el$: HostElement;
180
185
  $qrl$: QRLInternal<T>;
181
186
  $state$: B | undefined;
182
- $destroy$: NoSerialize<() => void> | null;
187
+ $destroy$: (() => void) | null;
183
188
  }
184
189
 
185
190
  declare type DomRef = {
@@ -337,19 +342,9 @@ declare interface NodePropData {
337
342
  $isConst$: boolean;
338
343
  }
339
344
 
340
- /**
341
- * Returned type of the `noSerialize()` function. It will be TYPE or undefined.
342
- *
343
- * @public
344
- * @see noSerialize
345
- */
346
- declare type NoSerialize<T> = (T & {
347
- __no_serialize__: true;
348
- }) | undefined;
349
-
350
345
  declare type ObjToProxyMap = WeakMap<any, any>;
351
346
 
352
- declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof TaskEvent | typeof RenderEvent | typeof ResourceEvent;
347
+ declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof TaskEvent | typeof RenderEvent;
353
348
 
354
349
  declare type Props = Record<string, unknown>;
355
350
 
@@ -524,27 +519,8 @@ declare type QRLInternalMethods<TYPE> = {
524
519
 
525
520
  declare type QrlReturn<T> = T extends (...args: any) => infer R ? Awaited<R> : unknown;
526
521
 
527
- /** @public */
528
- declare interface ReadonlySignal<T = unknown> {
529
- readonly value: T;
530
- }
531
-
532
522
  declare const RenderEvent = "qRender";
533
523
 
534
- declare const ResourceEvent = "qResource";
535
-
536
- declare interface ResourceReturnInternal<T> {
537
- __brand: 'resource';
538
- _state: 'pending' | 'resolved' | 'rejected';
539
- _resolved: T | undefined;
540
- _error: Error | undefined;
541
- _cache: number;
542
- _timeout: number;
543
- _generation: number;
544
- value: Promise<T>;
545
- loading: boolean;
546
- }
547
-
548
524
  /** Stores the location of an object. If no parent, it's a root. */
549
525
  declare type SeenRef = {
550
526
  $index$: number;
@@ -552,7 +528,7 @@ declare type SeenRef = {
552
528
  };
553
529
 
554
530
  declare interface SerializationContext {
555
- $serialize$: () => void;
531
+ $serialize$: () => ValueOrPromise<void>;
556
532
  $symbolToChunkResolver$: SymbolToChunkResolver;
557
533
  /**
558
534
  * Map from object to parent and index reference.
@@ -586,16 +562,16 @@ declare interface SerializationContext {
586
562
  $syncFns$: string[];
587
563
  $eventQrls$: Set<QRL>;
588
564
  $eventNames$: Set<string>;
589
- $resources$: Set<ResourceReturnInternal<unknown>>;
590
565
  $renderSymbols$: Set<string>;
591
566
  $storeProxyMap$: ObjToProxyMap;
592
- $getProp$: (obj: any, prop: string) => any;
567
+ $eagerResume$: Set<unknown>;
593
568
  $setProp$: (obj: any, prop: string, value: any) => void;
594
569
  }
595
570
 
596
571
  declare const enum SerializationSignalFlags {
597
572
  SERIALIZATION_STRATEGY_NEVER = 8,
598
- SERIALIZATION_STRATEGY_ALWAYS = 16
573
+ SERIALIZATION_STRATEGY_ALWAYS = 16,
574
+ SERIALIZATION_ALL_STRATEGIES = 24
599
575
  }
600
576
 
601
577
  /**
@@ -610,8 +586,16 @@ declare const enum SerializationSignalFlags {
610
586
  *
611
587
  * @public
612
588
  */
613
- declare interface Signal<T = any> extends ReadonlySignal<T> {
589
+ declare interface Signal<T = any> {
590
+ /** Reading from this subscribes to updates; writing to this triggers updates. */
614
591
  value: T;
592
+ /** Reading from this does not subscribe to updates; writing to this does not trigger updates. */
593
+ untrackedValue: T;
594
+ /**
595
+ * Use this to trigger running subscribers, for example when the value mutated but remained the
596
+ * same object.
597
+ */
598
+ trigger(): void;
615
599
  }
616
600
 
617
601
  declare const enum SignalFlags {
@@ -627,9 +611,11 @@ declare class SignalImpl<T = any> implements Signal<T> {
627
611
  $wrappedSignal$: WrappedSignalImpl<T> | null;
628
612
  constructor(container: Container | null, value: T);
629
613
  /**
630
- * Use this to force running subscribers, for example when the calculated value has mutated but
614
+ * Use this to trigger running subscribers, for example when the calculated value has mutated but
631
615
  * remained the same object
632
616
  */
617
+ trigger(): void;
618
+ /** @deprecated Use `trigger()` instead */
633
619
  force(): void;
634
620
  get untrackedValue(): T;
635
621
  set untrackedValue(value: T);
@@ -642,20 +628,12 @@ declare class SignalImpl<T = any> implements Signal<T> {
642
628
  };
643
629
  }
644
630
 
645
- declare type SimpleSsrAttrValue = string | Signal<SimpleSsrAttrValue> | boolean | object | null;
646
-
647
631
  declare interface SimplifiedServerRequestEvent<T = unknown> {
648
632
  url: URL;
649
633
  locale: string | undefined;
650
634
  request: Request;
651
635
  }
652
636
 
653
- declare type SsrAttrKey = string;
654
-
655
- declare type SsrAttrs = Array<SsrAttrKey | SsrAttrValue>;
656
-
657
- declare type SsrAttrValue = SimpleSsrAttrValue | Promise<SimpleSsrAttrValue>;
658
-
659
637
  /** A selection of attributes of the real thing */
660
638
  declare type SsrNode = {
661
639
  id: string;
@@ -700,14 +678,14 @@ declare class SubscriptionData {
700
678
 
701
679
  declare type SymbolToChunkResolver = (symbol: string) => string;
702
680
 
703
- declare class Task<T = unknown, B = T> extends BackRef implements DescriptorBase<unknown, Signal<B> | ResourceReturnInternal<B>> {
681
+ declare class Task<T = unknown, B = T> extends BackRef implements DescriptorBase<unknown, Signal<B>> {
704
682
  $flags$: number;
705
683
  $index$: number;
706
684
  $el$: HostElement;
707
685
  $qrl$: QRLInternal<T>;
708
- $state$: Signal<B> | ResourceReturnInternal<B> | undefined;
709
- $destroy$: NoSerialize<() => void> | null;
710
- constructor($flags$: number, $index$: number, $el$: HostElement, $qrl$: QRLInternal<T>, $state$: Signal<B> | ResourceReturnInternal<B> | undefined, $destroy$: NoSerialize<() => void> | null);
686
+ $state$: Signal<B> | undefined;
687
+ $destroy$: (() => void) | null;
688
+ constructor($flags$: number, $index$: number, $el$: HostElement, $qrl$: QRLInternal<T>, $state$: Signal<B> | undefined, $destroy$: (() => void) | null);
711
689
  }
712
690
 
713
691
  declare const TaskEvent = "qTask";
@@ -809,7 +787,7 @@ export declare function vnode_fromJSX(jsx: JSXOutput): {
809
787
  * this data needs to be serialized into a string and stored in the DOM as a script tag which has
810
788
  * deferent serialization format.
811
789
  */
812
- declare type VNodeData = [VNodeDataFlag, ...(SsrAttrs | number)[]];
790
+ declare type VNodeData = [VNodeDataFlag, ...(Props | number)[]];
813
791
 
814
792
  /**
815
793
  * Flags for VNodeData (Flags con be bitwise combined)
@@ -886,7 +864,7 @@ declare const enum WrappedSignalFlags {
886
864
  UNWRAP = 4
887
865
  }
888
866
 
889
- declare class WrappedSignalImpl<T> extends SignalImpl<T> implements BackRef {
867
+ declare class WrappedSignalImpl<T> extends SignalImpl<T> {
890
868
  $args$: any[];
891
869
  $func$: (...args: any[]) => T;
892
870
  $funcStr$: string | null;
@@ -895,11 +873,6 @@ declare class WrappedSignalImpl<T> extends SignalImpl<T> implements BackRef {
895
873
  [_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
896
874
  constructor(container: Container | null, fn: (...args: any[]) => T, args: any[], fnStr: string | null, flags?: SignalFlags);
897
875
  invalidate(): void;
898
- /**
899
- * Use this to force running subscribers, for example when the calculated value has mutated but
900
- * remained the same object.
901
- */
902
- force(): void;
903
876
  get untrackedValue(): T;
904
877
  $computeIfNeeded$(): void;
905
878
  $unwrapIfSignal$(): SignalImpl<T> | WrappedSignalImpl<T>;