@qwik.dev/core 2.0.0-alpha.2 → 2.0.0-alpha.3

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,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/testing 2.0.0-alpha.2-dev+58b6f8d
3
+ * @qwik.dev/core/testing 2.0.0-alpha.3-dev+418fd6d
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
@@ -24367,46 +24367,45 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
24367
24367
  }
24368
24368
  }
24369
24369
  function descendContentToProject(children, host) {
24370
- if (!Array.isArray(children)) {
24371
- children = [children];
24372
- }
24373
- if (children.length) {
24374
- const createProjectionJSXNode = (slotName) => {
24375
- return new JSXNodeImpl(Projection, EMPTY_OBJ, null, [], 0, slotName);
24376
- };
24377
- const projections = [];
24378
- if (host) {
24379
- for (let i = vnode_getPropStartIndex(host); i < host.length; i = i + 2) {
24380
- const prop = host[i];
24381
- if (isSlotProp(prop)) {
24382
- const slotName = prop;
24383
- projections.push(slotName);
24384
- projections.push(createProjectionJSXNode(slotName));
24385
- }
24370
+ const projectionChildren = Array.isArray(children) ? children : [children];
24371
+ const createProjectionJSXNode = (slotName) => {
24372
+ return new JSXNodeImpl(Projection, EMPTY_OBJ, null, [], 0, slotName);
24373
+ };
24374
+ const projections = [];
24375
+ if (host) {
24376
+ for (let i = vnode_getPropStartIndex(host); i < host.length; i = i + 2) {
24377
+ const prop = host[i];
24378
+ if (isSlotProp(prop)) {
24379
+ const slotName = prop;
24380
+ projections.push(slotName);
24381
+ projections.push(createProjectionJSXNode(slotName));
24386
24382
  }
24387
24383
  }
24388
- for (let i = 0; i < children.length; i++) {
24389
- const child = children[i];
24390
- const slotName = String(
24391
- isJSXNode(child) && directGetPropsProxyProp(child, QSlot) || QDefaultSlot
24392
- );
24393
- const idx = mapApp_findIndx(projections, slotName, 0);
24394
- let jsxBucket;
24395
- if (idx >= 0) {
24396
- jsxBucket = projections[idx + 1];
24397
- } else {
24398
- projections.splice(~idx, 0, slotName, jsxBucket = createProjectionJSXNode(slotName));
24399
- }
24400
- const removeProjection = child === false;
24401
- if (!removeProjection) {
24402
- jsxBucket.children.push(child);
24403
- }
24384
+ }
24385
+ if (projections.length === 0 && children == null) {
24386
+ return;
24387
+ }
24388
+ for (let i = 0; i < projectionChildren.length; i++) {
24389
+ const child = projectionChildren[i];
24390
+ const slotName = String(
24391
+ isJSXNode(child) && directGetPropsProxyProp(child, QSlot) || QDefaultSlot
24392
+ );
24393
+ const idx = mapApp_findIndx(projections, slotName, 0);
24394
+ let jsxBucket;
24395
+ if (idx >= 0) {
24396
+ jsxBucket = projections[idx + 1];
24397
+ } else {
24398
+ projections.splice(~idx, 0, slotName, jsxBucket = createProjectionJSXNode(slotName));
24404
24399
  }
24405
- for (let i = projections.length - 2; i >= 0; i = i - 2) {
24406
- projections.splice(i, 1);
24400
+ const removeProjection = child === false;
24401
+ if (!removeProjection) {
24402
+ jsxBucket.children.push(child);
24407
24403
  }
24408
- descend(projections, true);
24409
24404
  }
24405
+ for (let i = projections.length - 2; i >= 0; i = i - 2) {
24406
+ projections.splice(i, 1);
24407
+ }
24408
+ descend(projections, true);
24410
24409
  }
24411
24410
  function expectProjection() {
24412
24411
  const jsxNode2 = jsxValue;
@@ -24858,7 +24857,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
24858
24857
  container.$scheduler$(7 /* COMPONENT */, host, componentQRL, jsxProps);
24859
24858
  }
24860
24859
  }
24861
- jsxNode2.children != null && descendContentToProject(jsxNode2.children, host);
24860
+ descendContentToProject(jsxNode2.children, host);
24862
24861
  } else {
24863
24862
  const lookupKey = jsxNode2.key;
24864
24863
  const vNodeLookupKey = getKey(host);
@@ -25172,7 +25171,17 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
25172
25171
  chore.$payload$
25173
25172
  ),
25174
25173
  (jsx5) => {
25175
- return chore.$type$ === 7 /* COMPONENT */ ? maybeThen(container.processJsx(host, jsx5), () => jsx5) : jsx5;
25174
+ if (chore.$type$ === 7 /* COMPONENT */) {
25175
+ const styleScopedId = container.getHostProp(host, QScopedStyle);
25176
+ return vnode_diff(
25177
+ container,
25178
+ jsx5,
25179
+ host,
25180
+ addComponentStylePrefix(styleScopedId)
25181
+ );
25182
+ } else {
25183
+ return jsx5;
25184
+ }
25176
25185
  },
25177
25186
  (err) => container.handleError(err, host)
25178
25187
  );
@@ -26026,10 +26035,6 @@ var DomContainer = class extends _SharedContainer {
26026
26035
  parseQRL(qrl2) {
26027
26036
  return inflateQRL(this, parseQRL(qrl2));
26028
26037
  }
26029
- processJsx(host, jsx4) {
26030
- const styleScopedId = this.getHostProp(host, QScopedStyle);
26031
- return vnode_diff(this, jsx4, host, addComponentStylePrefix(styleScopedId));
26032
- }
26033
26038
  handleError(err, host) {
26034
26039
  if (qDev) {
26035
26040
  if (typeof document !== "undefined") {
@@ -27912,9 +27917,8 @@ var SsrNode = class {
27912
27917
  }
27913
27918
  };
27914
27919
  var DomRef = class {
27915
- /** @id is the same id as for SsrNode */
27916
- constructor(id) {
27917
- this.id = id;
27920
+ constructor($ssrNode$) {
27921
+ this.$ssrNode$ = $ssrNode$;
27918
27922
  }
27919
27923
  };
27920
27924
  var SsrComponentFrame = class {
@@ -28189,7 +28193,9 @@ var inflate = (container, target, typeId, data) => {
28189
28193
  if (valType === 0 /* RootRef */ || valType >= 12 /* Error */) {
28190
28194
  Object.defineProperty(target, key, {
28191
28195
  get() {
28192
- return deserializeData(container, valType, valData);
28196
+ const value = deserializeData(container, valType, valData);
28197
+ target[key] = value;
28198
+ return value;
28193
28199
  },
28194
28200
  set(value) {
28195
28201
  Object.defineProperty(target, key, {
@@ -28531,6 +28537,7 @@ function inflateQRL(container, qrl2) {
28531
28537
  }
28532
28538
  return qrl2;
28533
28539
  }
28540
+ var isDomRef = (obj) => false;
28534
28541
  var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
28535
28542
  if (!writer) {
28536
28543
  const buffer = [];
@@ -28555,7 +28562,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
28555
28562
  return id;
28556
28563
  };
28557
28564
  const isSsrNode = NodeConstructor ? (obj) => obj instanceof NodeConstructor : () => false;
28558
- const isDomRef = DomRefConstructor ? (obj) => obj instanceof DomRefConstructor : () => false;
28565
+ isDomRef = DomRefConstructor ? (obj) => obj instanceof DomRefConstructor : () => false;
28559
28566
  return {
28560
28567
  $serialize$() {
28561
28568
  serialize(this);
@@ -28671,7 +28678,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
28671
28678
  } else if (isSsrNode(obj)) {
28672
28679
  discoveredValues.push(obj.vnodeData);
28673
28680
  } else if (isDomRef(obj)) {
28674
- discoveredValues.push(obj.id);
28681
+ discoveredValues.push(obj.$ssrNode$.id);
28675
28682
  } else if (isJSXNode(obj)) {
28676
28683
  discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
28677
28684
  } else if (Array.isArray(obj)) {
@@ -28896,7 +28903,8 @@ function serialize(serializationContext) {
28896
28903
  output(13 /* Object */, out);
28897
28904
  }
28898
28905
  } else if ($isDomRef$(value)) {
28899
- output(9 /* RefVNode */, value.id);
28906
+ value.$ssrNode$.vnodeData[0] |= 8 /* SERIALIZE */;
28907
+ output(9 /* RefVNode */, value.$ssrNode$.id);
28900
28908
  } else if (value instanceof Signal) {
28901
28909
  const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
28902
28910
  if (value instanceof WrappedSignal) {
@@ -29161,6 +29169,8 @@ var canSerialize = (value) => {
29161
29169
  return true;
29162
29170
  } else if (value instanceof Uint8Array) {
29163
29171
  return true;
29172
+ } else if (isDomRef == null ? void 0 : isDomRef(value)) {
29173
+ return true;
29164
29174
  }
29165
29175
  } else if (typeof value === "function") {
29166
29176
  if (isQrl2(value) || isQwikComponent(value)) {
@@ -31197,9 +31207,6 @@ var SSRContainer = class extends import_core5._SharedContainer {
31197
31207
  }
31198
31208
  ensureProjectionResolved(host) {
31199
31209
  }
31200
- processJsx(host, jsx4) {
31201
- throw new Error("Should not get here.");
31202
- }
31203
31210
  handleError(err, $host$) {
31204
31211
  throw err;
31205
31212
  }
@@ -31955,10 +31962,10 @@ var SSRContainer = class extends import_core5._SharedContainer {
31955
31962
  if (key === "ref") {
31956
31963
  const lastNode = this.getLastNode();
31957
31964
  if ((0, import_core5.isSignal)(value)) {
31958
- value.value = new DomRef(lastNode.id);
31965
+ value.value = new DomRef(lastNode);
31959
31966
  continue;
31960
31967
  } else if (typeof value === "function") {
31961
- value(new DomRef(lastNode.id));
31968
+ value(new DomRef(lastNode));
31962
31969
  continue;
31963
31970
  }
31964
31971
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/testing 2.0.0-alpha.2-dev+58b6f8d
3
+ * @qwik.dev/core/testing 2.0.0-alpha.3-dev+418fd6d
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
@@ -24349,46 +24349,45 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
24349
24349
  }
24350
24350
  }
24351
24351
  function descendContentToProject(children, host) {
24352
- if (!Array.isArray(children)) {
24353
- children = [children];
24354
- }
24355
- if (children.length) {
24356
- const createProjectionJSXNode = (slotName) => {
24357
- return new JSXNodeImpl(Projection, EMPTY_OBJ, null, [], 0, slotName);
24358
- };
24359
- const projections = [];
24360
- if (host) {
24361
- for (let i = vnode_getPropStartIndex(host); i < host.length; i = i + 2) {
24362
- const prop = host[i];
24363
- if (isSlotProp(prop)) {
24364
- const slotName = prop;
24365
- projections.push(slotName);
24366
- projections.push(createProjectionJSXNode(slotName));
24367
- }
24352
+ const projectionChildren = Array.isArray(children) ? children : [children];
24353
+ const createProjectionJSXNode = (slotName) => {
24354
+ return new JSXNodeImpl(Projection, EMPTY_OBJ, null, [], 0, slotName);
24355
+ };
24356
+ const projections = [];
24357
+ if (host) {
24358
+ for (let i = vnode_getPropStartIndex(host); i < host.length; i = i + 2) {
24359
+ const prop = host[i];
24360
+ if (isSlotProp(prop)) {
24361
+ const slotName = prop;
24362
+ projections.push(slotName);
24363
+ projections.push(createProjectionJSXNode(slotName));
24368
24364
  }
24369
24365
  }
24370
- for (let i = 0; i < children.length; i++) {
24371
- const child = children[i];
24372
- const slotName = String(
24373
- isJSXNode(child) && directGetPropsProxyProp(child, QSlot) || QDefaultSlot
24374
- );
24375
- const idx = mapApp_findIndx(projections, slotName, 0);
24376
- let jsxBucket;
24377
- if (idx >= 0) {
24378
- jsxBucket = projections[idx + 1];
24379
- } else {
24380
- projections.splice(~idx, 0, slotName, jsxBucket = createProjectionJSXNode(slotName));
24381
- }
24382
- const removeProjection = child === false;
24383
- if (!removeProjection) {
24384
- jsxBucket.children.push(child);
24385
- }
24366
+ }
24367
+ if (projections.length === 0 && children == null) {
24368
+ return;
24369
+ }
24370
+ for (let i = 0; i < projectionChildren.length; i++) {
24371
+ const child = projectionChildren[i];
24372
+ const slotName = String(
24373
+ isJSXNode(child) && directGetPropsProxyProp(child, QSlot) || QDefaultSlot
24374
+ );
24375
+ const idx = mapApp_findIndx(projections, slotName, 0);
24376
+ let jsxBucket;
24377
+ if (idx >= 0) {
24378
+ jsxBucket = projections[idx + 1];
24379
+ } else {
24380
+ projections.splice(~idx, 0, slotName, jsxBucket = createProjectionJSXNode(slotName));
24386
24381
  }
24387
- for (let i = projections.length - 2; i >= 0; i = i - 2) {
24388
- projections.splice(i, 1);
24382
+ const removeProjection = child === false;
24383
+ if (!removeProjection) {
24384
+ jsxBucket.children.push(child);
24389
24385
  }
24390
- descend(projections, true);
24391
24386
  }
24387
+ for (let i = projections.length - 2; i >= 0; i = i - 2) {
24388
+ projections.splice(i, 1);
24389
+ }
24390
+ descend(projections, true);
24392
24391
  }
24393
24392
  function expectProjection() {
24394
24393
  const jsxNode2 = jsxValue;
@@ -24840,7 +24839,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
24840
24839
  container.$scheduler$(7 /* COMPONENT */, host, componentQRL, jsxProps);
24841
24840
  }
24842
24841
  }
24843
- jsxNode2.children != null && descendContentToProject(jsxNode2.children, host);
24842
+ descendContentToProject(jsxNode2.children, host);
24844
24843
  } else {
24845
24844
  const lookupKey = jsxNode2.key;
24846
24845
  const vNodeLookupKey = getKey(host);
@@ -25154,7 +25153,17 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
25154
25153
  chore.$payload$
25155
25154
  ),
25156
25155
  (jsx5) => {
25157
- return chore.$type$ === 7 /* COMPONENT */ ? maybeThen(container.processJsx(host, jsx5), () => jsx5) : jsx5;
25156
+ if (chore.$type$ === 7 /* COMPONENT */) {
25157
+ const styleScopedId = container.getHostProp(host, QScopedStyle);
25158
+ return vnode_diff(
25159
+ container,
25160
+ jsx5,
25161
+ host,
25162
+ addComponentStylePrefix(styleScopedId)
25163
+ );
25164
+ } else {
25165
+ return jsx5;
25166
+ }
25158
25167
  },
25159
25168
  (err) => container.handleError(err, host)
25160
25169
  );
@@ -26015,10 +26024,6 @@ var DomContainer = class extends _SharedContainer {
26015
26024
  parseQRL(qrl2) {
26016
26025
  return inflateQRL(this, parseQRL(qrl2));
26017
26026
  }
26018
- processJsx(host, jsx4) {
26019
- const styleScopedId = this.getHostProp(host, QScopedStyle);
26020
- return vnode_diff(this, jsx4, host, addComponentStylePrefix(styleScopedId));
26021
- }
26022
26027
  handleError(err, host) {
26023
26028
  if (qDev) {
26024
26029
  if (typeof document !== "undefined") {
@@ -27884,9 +27889,8 @@ __publicField(SsrNode, "TEXT_NODE", 3);
27884
27889
  __publicField(SsrNode, "DOCUMENT_NODE", 9);
27885
27890
  __publicField(SsrNode, "DOCUMENT_FRAGMENT_NODE", 11);
27886
27891
  var DomRef = class {
27887
- /** @id is the same id as for SsrNode */
27888
- constructor(id) {
27889
- this.id = id;
27892
+ constructor($ssrNode$) {
27893
+ this.$ssrNode$ = $ssrNode$;
27890
27894
  }
27891
27895
  };
27892
27896
  var SsrComponentFrame = class {
@@ -28160,7 +28164,9 @@ var inflate = (container, target, typeId, data) => {
28160
28164
  if (valType === 0 /* RootRef */ || valType >= 12 /* Error */) {
28161
28165
  Object.defineProperty(target, key, {
28162
28166
  get() {
28163
- return deserializeData(container, valType, valData);
28167
+ const value = deserializeData(container, valType, valData);
28168
+ target[key] = value;
28169
+ return value;
28164
28170
  },
28165
28171
  set(value) {
28166
28172
  Object.defineProperty(target, key, {
@@ -28500,6 +28506,7 @@ function inflateQRL(container, qrl2) {
28500
28506
  }
28501
28507
  return qrl2;
28502
28508
  }
28509
+ var isDomRef = (obj) => false;
28503
28510
  var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
28504
28511
  if (!writer) {
28505
28512
  const buffer = [];
@@ -28524,7 +28531,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
28524
28531
  return id;
28525
28532
  };
28526
28533
  const isSsrNode = NodeConstructor ? (obj) => obj instanceof NodeConstructor : () => false;
28527
- const isDomRef = DomRefConstructor ? (obj) => obj instanceof DomRefConstructor : () => false;
28534
+ isDomRef = DomRefConstructor ? (obj) => obj instanceof DomRefConstructor : () => false;
28528
28535
  return {
28529
28536
  $serialize$() {
28530
28537
  serialize(this);
@@ -28640,7 +28647,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
28640
28647
  } else if (isSsrNode(obj)) {
28641
28648
  discoveredValues.push(obj.vnodeData);
28642
28649
  } else if (isDomRef(obj)) {
28643
- discoveredValues.push(obj.id);
28650
+ discoveredValues.push(obj.$ssrNode$.id);
28644
28651
  } else if (isJSXNode(obj)) {
28645
28652
  discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
28646
28653
  } else if (Array.isArray(obj)) {
@@ -28864,7 +28871,8 @@ function serialize(serializationContext) {
28864
28871
  output(13 /* Object */, out);
28865
28872
  }
28866
28873
  } else if ($isDomRef$(value)) {
28867
- output(9 /* RefVNode */, value.id);
28874
+ value.$ssrNode$.vnodeData[0] |= 8 /* SERIALIZE */;
28875
+ output(9 /* RefVNode */, value.$ssrNode$.id);
28868
28876
  } else if (value instanceof Signal) {
28869
28877
  const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
28870
28878
  if (value instanceof WrappedSignal) {
@@ -29128,6 +29136,8 @@ var canSerialize = (value) => {
29128
29136
  return true;
29129
29137
  } else if (value instanceof Uint8Array) {
29130
29138
  return true;
29139
+ } else if (isDomRef?.(value)) {
29140
+ return true;
29131
29141
  }
29132
29142
  } else if (typeof value === "function") {
29133
29143
  if (isQrl2(value) || isQwikComponent(value)) {
@@ -31175,9 +31185,6 @@ var SSRContainer = class extends _SharedContainer2 {
31175
31185
  }
31176
31186
  ensureProjectionResolved(host) {
31177
31187
  }
31178
- processJsx(host, jsx4) {
31179
- throw new Error("Should not get here.");
31180
- }
31181
31188
  handleError(err, $host$) {
31182
31189
  throw err;
31183
31190
  }
@@ -31923,10 +31930,10 @@ var SSRContainer = class extends _SharedContainer2 {
31923
31930
  if (key === "ref") {
31924
31931
  const lastNode = this.getLastNode();
31925
31932
  if (isSignal3(value)) {
31926
- value.value = new DomRef(lastNode.id);
31933
+ value.value = new DomRef(lastNode);
31927
31934
  continue;
31928
31935
  } else if (typeof value === "function") {
31929
- value(new DomRef(lastNode.id));
31936
+ value(new DomRef(lastNode));
31930
31937
  continue;
31931
31938
  }
31932
31939
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwik.dev/core/testing",
3
- "version": "2.0.0-alpha.2-dev+58b6f8d",
3
+ "version": "2.0.0-alpha.3-dev+418fd6d",
4
4
  "main": "index.mjs",
5
5
  "types": "index.d.ts",
6
6
  "private": true,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qwik.dev/core",
3
3
  "description": "An open source framework for building instant loading web apps at any scale, without the extra effort.",
4
- "version": "2.0.0-alpha.2",
4
+ "version": "2.0.0-alpha.3",
5
5
  "author": "Qwik Team",
6
6
  "bin": {
7
7
  "qwik": "./qwik-cli.cjs"
@@ -17,7 +17,7 @@
17
17
  "prettier": "3.3.3",
18
18
  "ts-morph": "23.0.0",
19
19
  "vitest": "2.1.4",
20
- "@qwik.dev/core": "2.0.0-alpha.2",
20
+ "@qwik.dev/core": "2.0.0-alpha.3",
21
21
  "@qwik.dev/dom": "2.1.19"
22
22
  },
23
23
  "engines": {
@@ -134,7 +134,7 @@
134
134
  "./qwikloader.debug.js": "./dist/qwikloader.debug.js",
135
135
  "./qwik-prefetch.js": "./dist/qwik-prefetch.js",
136
136
  "./qwik-prefetch.debug.js": "./dist/qwik-prefetch.debug.js",
137
- "./package.json": "./dist/package.json"
137
+ "./package.json": "./package.json"
138
138
  },
139
139
  "exports_annotation": "We use the build for the optimizer because esbuild doesn't like the html?raw imports in the server plugin and it's only used in the vite configs",
140
140
  "files": [
@@ -191,7 +191,7 @@
191
191
  "directory": "packages/qwik"
192
192
  },
193
193
  "type": "module",
194
- "types": "./dist/core.d.ts",
194
+ "types": "./public.d.ts",
195
195
  "scripts": {
196
196
  "build.insights": "cd src/insights && vite build --mode lib --emptyOutDir"
197
197
  }