@qwik.dev/core 2.0.0-beta.10 → 2.0.0-beta.11

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.
@@ -1,4 +1,5 @@
1
- import { ClientContainer } from '../internal';
1
+ import { ClientContainer } from '..';
2
+ import type { ClientContainer as ClientContainer_2 } from '../internal';
2
3
  import type { CorePlatform } from '..';
3
4
  import type { _DomContainer } from '../internal';
4
5
  import type { _ElementVNode } from '../internal';
@@ -6,7 +7,6 @@ import type { JSXNodeInternal } from '../internal';
6
7
  import { JSXOutput } from '..';
7
8
  import type { _QDocument } from '../internal';
8
9
  import { RenderResult } from '..';
9
- import type { StreamWriter as StreamWriter_2 } from '..';
10
10
  import type { _Stringifiable } from '../internal';
11
11
  import type { _VirtualVNode } from '../internal';
12
12
  import type { _VNode } from '../internal';
@@ -51,6 +51,11 @@ declare interface Chore<T extends ChoreType = ChoreType> {
51
51
  $returnValue$: ValueOrPromise<ChoreReturnValue<T>>;
52
52
  }
53
53
 
54
+ declare class ChoreArray extends Array<Chore> {
55
+ add(value: Chore): number;
56
+ delete(value: Chore): number;
57
+ }
58
+
54
59
  declare type ChoreReturnValue<T extends ChoreType = ChoreType> = T extends ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS | ChoreType.WAIT_FOR_QUEUE | ChoreType.NODE_PROP ? void : T extends ChoreType.NODE_DIFF | ChoreType.COMPONENT ? JSXOutput_2 : unknown;
55
60
 
56
61
  declare enum ChoreState {
@@ -207,10 +212,10 @@ export declare const createDOM: ({ html }?: {
207
212
  userEvent: (queryOrElement: string | Element | keyof HTMLElementTagNameMap | null, eventNameCamel: string | keyof WindowEventMap, eventPayload?: any) => Promise<void>;
208
213
  }>;
209
214
 
210
- declare const createScheduler: (container: Container, journalFlush: () => void, choreQueue?: Chore[], blockedChores?: Set<Chore>, runningChores?: Set<Chore>) => {
215
+ declare const createScheduler: (container: Container, journalFlush: () => void, choreQueue: ChoreArray, blockedChores: Set<Chore>, runningChores: Set<Chore>) => {
211
216
  (type: ChoreType.QRL_RESOLVE, ignore: null, target: ComputeQRL<any> | AsyncComputeQRL<any>): Chore<ChoreType.QRL_RESOLVE>;
212
217
  (type: ChoreType.WAIT_FOR_QUEUE): Chore<ChoreType.WAIT_FOR_QUEUE>;
213
- (type: ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, host: HostElement | null, target: Signal | StoreHandler, effects: Set<EffectSubscription> | null): Chore<ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS>;
218
+ (type: ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, host: HostElement | null, target: Signal<unknown> | StoreTarget, effects: Set<EffectSubscription> | null): Chore<ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS>;
214
219
  (type: ChoreType.TASK | ChoreType.VISIBLE, task: Task): Chore<ChoreType.TASK | ChoreType.VISIBLE>;
215
220
  (type: ChoreType.RUN_QRL, host: HostElement, target: QRLInternal<(...args: unknown[]) => unknown>, args: unknown[]): Chore<ChoreType.RUN_QRL>;
216
221
  (type: ChoreType.COMPONENT, host: HostElement, qrl: QRLInternal<OnRenderFn<unknown>>, props: Props | null): Chore<ChoreType.COMPONENT>;
@@ -335,25 +340,13 @@ declare interface ElementFixtureOptions {
335
340
  }
336
341
 
337
342
  /** @internal */
338
- declare type ElementVNode = [
339
- VNodeFlags.Element,
340
- ////////////// 0 - Flags
341
- VNode | null,
342
- /////////////// 1 - Parent
343
- VNode | null,
344
- /////////////// 2 - Previous sibling
345
- VNode | null,
346
- /////////////// 3 - Next sibling
347
- VNode | null | undefined,
348
- /// 4 - First child - undefined if children need to be materialize
349
- VNode | null | undefined,
350
- Element,
351
- //////////////////// 6 - Element
352
- string | undefined,
353
- (string | null)[]
354
- ] & {
355
- __brand__: 'ElementVNode';
356
- };
343
+ declare class ElementVNode extends VNode {
344
+ firstChild: VNode | null | undefined;
345
+ lastChild: VNode | null | undefined;
346
+ element: Element;
347
+ elementName: string | undefined;
348
+ constructor(flags: VNodeFlags, parent: ElementVNode | VirtualVNode | null, previousSibling: VNode | null | undefined, nextSibling: VNode | null | undefined, firstChild: VNode | null | undefined, lastChild: VNode | null | undefined, element: Element, elementName: string | undefined);
349
+ }
357
350
 
358
351
  /** @public */
359
352
  export declare function emulateExecutionOfQwikFuncs(document: Document): void;
@@ -706,7 +699,7 @@ declare interface SerializationContext {
706
699
  $addSyncFn$($funcStr$: string | null, argsCount: number, fn: Function): number;
707
700
  $isSsrNode$: (obj: unknown) => obj is SsrNode;
708
701
  $isDomRef$: (obj: unknown) => obj is DomRef;
709
- $writer$: StreamWriter_2;
702
+ $writer$: StreamWriter;
710
703
  $syncFns$: string[];
711
704
  $eventQrls$: Set<QRL>;
712
705
  $eventNames$: Set<string>;
@@ -786,32 +779,10 @@ export declare function ssrRenderToDom(jsx: JSXOutput, opts?: {
786
779
  }): Promise<{
787
780
  container: _DomContainer;
788
781
  document: Document;
789
- vNode: _VirtualVNode | null;
782
+ vNode: _VNode | null;
790
783
  getStyles: () => Record<string, string | string[]>;
791
784
  }>;
792
785
 
793
- declare const enum StoreFlags {
794
- NONE = 0,
795
- RECURSIVE = 1,
796
- IMMUTABLE = 2
797
- }
798
-
799
- declare class StoreHandler implements ProxyHandler<StoreTarget> {
800
- $flags$: StoreFlags;
801
- $container$: Container | null;
802
- $effects$: null | Map<string | symbol, Set<EffectSubscription>>;
803
- constructor($flags$: StoreFlags, $container$: Container | null);
804
- toString(): string;
805
- force(prop: keyof StoreTarget): void;
806
- get(target: StoreTarget, prop: string | symbol): any;
807
- /** In the case of oldValue and value are the same, the effects are not triggered. */
808
- set(target: StoreTarget, prop: string | symbol, value: any): boolean;
809
- deleteProperty(target: StoreTarget, prop: string | symbol): boolean;
810
- has(target: StoreTarget, prop: string | symbol): boolean;
811
- ownKeys(target: StoreTarget): ArrayLike<string | symbol>;
812
- getOwnPropertyDescriptor(target: StoreTarget, prop: string | symbol): PropertyDescriptor | undefined;
813
- }
814
-
815
786
  declare type StoreTarget = Record<string | symbol, any>;
816
787
 
817
788
  /** @internal */
@@ -864,22 +835,6 @@ declare interface TestPlatform extends CorePlatform {
864
835
  flush: () => Promise<void>;
865
836
  }
866
837
 
867
- /** @internal */
868
- declare type TextVNode = [
869
- VNodeFlags.Text | VNodeFlags.Inflated,
870
- // 0 - Flags
871
- VNode | null,
872
- ///////////////// 1 - Parent
873
- VNode | null,
874
- ///////////////// 2 - Previous sibling
875
- VNode | null,
876
- ///////////////// 3 - Next sibling
877
- Text | null | undefined,
878
- string
879
- ] & {
880
- __brand__: 'TextVNode';
881
- };
882
-
883
838
  /**
884
839
  * Used to signal to Qwik which state should be watched for changes.
885
840
  *
@@ -984,32 +939,36 @@ export declare function trigger(root: Element, queryOrElement: string | Element
984
939
  declare type ValueOrPromise<T> = T | Promise<T>;
985
940
 
986
941
  /** @internal */
987
- declare type VirtualVNode = [
988
- VNodeFlags.Virtual,
989
- ///////////// 0 - Flags
990
- VNode | null,
991
- /////////////// 1 - Parent
992
- VNode | null,
993
- /////////////// 2 - Previous sibling
994
- VNode | null,
995
- /////////////// 3 - Next sibling
996
- VNode | null,
997
- /////////////// 4 - First child
998
- VNode | null,
999
- (string | null | boolean)[]
1000
- ] & {
1001
- __brand__: 'FragmentNode' & 'HostElement';
1002
- };
942
+ declare class VirtualVNode extends VNode {
943
+ firstChild: VNode | null | undefined;
944
+ lastChild: VNode | null | undefined;
945
+ constructor(flags: VNodeFlags, parent: ElementVNode | VirtualVNode | null, previousSibling: VNode | null | undefined, nextSibling: VNode | null | undefined, firstChild: VNode | null | undefined, lastChild: VNode | null | undefined);
946
+ }
1003
947
 
1004
948
  /** @internal */
1005
- declare type VNode = ElementVNode | TextVNode | VirtualVNode;
949
+ declare abstract class VNode extends BackRef {
950
+ flags: VNodeFlags;
951
+ parent: ElementVNode | VirtualVNode | null;
952
+ previousSibling: VNode | null | undefined;
953
+ nextSibling: VNode | null | undefined;
954
+ props: unknown[] | null;
955
+ slotParent: VNode | null;
956
+ chores: ChoreArray | null;
957
+ blockedChores: ChoreArray | null;
958
+ constructor(flags: VNodeFlags, parent: ElementVNode | VirtualVNode | null, previousSibling: VNode | null | undefined, nextSibling: VNode | null | undefined);
959
+ getProp<T>(key: string, getObject: ((id: string) => any) | null): T | null;
960
+ setProp(key: string, value: any): void;
961
+ getAttr(key: string): string | null;
962
+ setAttr(key: string, value: string | null | boolean, journal: VNodeJournal | null): void;
963
+ toString(): string;
964
+ }
1006
965
 
1007
966
  /** @public */
1008
967
  export declare function vnode_fromJSX(jsx: JSXOutput): {
1009
- vParent: _ElementVNode;
968
+ vParent: _ElementVNode | _VirtualVNode;
1010
969
  vNode: _VNode | null;
1011
970
  document: _QDocument;
1012
- container: ClientContainer;
971
+ container: ClientContainer_2;
1013
972
  };
1014
973
 
1015
974
  /**
@@ -1092,6 +1051,24 @@ declare const enum VNodeFlags {
1092
1051
  NS_math = 128
1093
1052
  }
1094
1053
 
1054
+ declare type VNodeJournal = Array<VNodeJournalOpCode | Document | Element | Text | string | boolean | null>;
1055
+
1056
+ /**
1057
+ * Fundamental DOM operations are:
1058
+ *
1059
+ * - Insert new DOM element/text
1060
+ * - Remove DOM element/text
1061
+ * - Set DOM element attributes
1062
+ * - Set text node value
1063
+ */
1064
+ declare const enum VNodeJournalOpCode {
1065
+ SetText = 1,// ------ [SetAttribute, target, text]
1066
+ SetAttribute = 2,// - [SetAttribute, target, ...(key, values)]]
1067
+ HoistStyles = 3,// -- [HoistStyles, document]
1068
+ Remove = 4,// ------- [Insert, target(parent), ...nodes]
1069
+ Insert = 5
1070
+ }
1071
+
1095
1072
  /**
1096
1073
  * Wait for the scheduler to drain.
1097
1074
  *