@qwik.dev/core 2.0.0-alpha.4 → 2.0.0-alpha.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/testing 2.0.0-alpha.4-dev+374e0d6
3
+ * @qwik.dev/core/testing 2.0.0-alpha.5-dev+cb53bbd
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
@@ -22309,7 +22309,7 @@ See https://qwik.dev/docs/components/tasks/#use-method-rules`,
22309
22309
  // 30
22310
22310
  "QRLs can not be dynamically resolved, because it does not have a chunk path",
22311
22311
  // 31
22312
- "The JSX ref attribute must be a Signal",
22312
+ "{{0}}\nThe JSX ref attribute must be a Signal",
22313
22313
  // 32
22314
22314
  "Serialization Error: Deserialization of data type {{0}} is not implemented",
22315
22315
  // 33
@@ -22325,7 +22325,7 @@ See https://qwik.dev/docs/components/tasks/#use-method-rules`,
22325
22325
  // 38
22326
22326
  "Serialization Error: Missing QRL chunk for {{0}}",
22327
22327
  // 39
22328
- "The value of the textarea must be a string",
22328
+ "{{0}}\nThe value of the textarea must be a string found {{1}}",
22329
22329
  // 40
22330
22330
  "Unable to find q:container",
22331
22331
  // 41
@@ -23058,7 +23058,6 @@ var StoreHandler = class {
23058
23058
  }
23059
23059
  /** In the case of oldValue and value are the same, the effects are not triggered. */
23060
23060
  set(target, prop, value) {
23061
- target = unwrapDeserializerProxy(target);
23062
23061
  if (typeof prop === "symbol") {
23063
23062
  target[prop] = value;
23064
23063
  return true;
@@ -23126,6 +23125,11 @@ function addEffect(target, prop, store, effectSubscriber) {
23126
23125
  const effects = Object.prototype.hasOwnProperty.call(effectsMap, prop) && effectsMap[prop] || (effectsMap[prop] = []);
23127
23126
  ensureContainsEffect(effects, effectSubscriber);
23128
23127
  ensureContains(effectSubscriber, target);
23128
+ ensureEffectContainsSubscriber(
23129
+ effectSubscriber[0 /* EFFECT */],
23130
+ target,
23131
+ store.$container$
23132
+ );
23129
23133
  DEBUG && log("sub", pad("\n" + store.$effects$.toString(), " "));
23130
23134
  }
23131
23135
  function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
@@ -23195,32 +23199,39 @@ function clearVNodeEffectDependencies(container, value) {
23195
23199
  }
23196
23200
  for (let i = effects.length - 1; i >= 0; i--) {
23197
23201
  const subscriber = effects[i];
23198
- const subscriptionRemoved = clearEffects(subscriber, value);
23199
- if (subscriptionRemoved) {
23200
- effects.splice(i, 1);
23201
- }
23202
+ clearEffects(subscriber, value, effects, i, container);
23203
+ }
23204
+ if (effects.length === 0) {
23205
+ vnode_setProp(value, QSubscribers, null);
23202
23206
  }
23203
23207
  }
23204
- function clearSubscriberEffectDependencies(value) {
23208
+ function clearSubscriberEffectDependencies(container, value) {
23205
23209
  if (value.$effectDependencies$) {
23206
23210
  for (let i = value.$effectDependencies$.length - 1; i >= 0; i--) {
23207
23211
  const subscriber = value.$effectDependencies$[i];
23208
- const subscriptionRemoved = clearEffects(subscriber, value);
23209
- if (subscriptionRemoved) {
23210
- value.$effectDependencies$.splice(i, 1);
23211
- }
23212
+ clearEffects(subscriber, value, value.$effectDependencies$, i, container);
23213
+ }
23214
+ if (value.$effectDependencies$.length === 0) {
23215
+ value.$effectDependencies$ = null;
23212
23216
  }
23213
23217
  }
23214
23218
  }
23215
- function clearEffects(subscriber, value) {
23216
- if (!isSignal(subscriber)) {
23217
- return false;
23219
+ function clearEffects(subscriber, value, effectArray, indexToRemove, container) {
23220
+ let subscriptionRemoved = false;
23221
+ const seenSet = /* @__PURE__ */ new Set();
23222
+ if (subscriber instanceof WrappedSignal) {
23223
+ subscriptionRemoved = clearSignalEffects(subscriber, value, seenSet);
23224
+ } else if (container.$storeProxyMap$.has(subscriber)) {
23225
+ const store = container.$storeProxyMap$.get(subscriber);
23226
+ const handler = getStoreHandler(store);
23227
+ subscriptionRemoved = clearStoreEffects(handler, value);
23218
23228
  }
23219
- const effectSubscriptions = subscriber.$effects$;
23220
- const hostElement = subscriber.$hostElement$;
23221
- if (hostElement && hostElement === value) {
23222
- subscriber.$hostElement$ = null;
23229
+ if (subscriptionRemoved) {
23230
+ effectArray.splice(indexToRemove, 1);
23223
23231
  }
23232
+ }
23233
+ function clearSignalEffects(subscriber, value, seenSet) {
23234
+ const effectSubscriptions = subscriber.$effects$;
23224
23235
  let subscriptionRemoved = false;
23225
23236
  if (effectSubscriptions) {
23226
23237
  for (let i = effectSubscriptions.length - 1; i >= 0; i--) {
@@ -23231,14 +23242,65 @@ function clearEffects(subscriber, value) {
23231
23242
  }
23232
23243
  }
23233
23244
  }
23234
- const args = subscriber.$args$;
23235
- if (args) {
23236
- for (let i = args.length - 1; i >= 0; i--) {
23237
- clearEffects(args[i], subscriber);
23245
+ if (subscriber instanceof WrappedSignal) {
23246
+ const hostElement = subscriber.$hostElement$;
23247
+ if (hostElement && hostElement === value) {
23248
+ subscriber.$hostElement$ = null;
23249
+ }
23250
+ const args = subscriber.$args$;
23251
+ if (args) {
23252
+ clearArgsEffects(args, subscriber, seenSet);
23253
+ }
23254
+ }
23255
+ return subscriptionRemoved;
23256
+ }
23257
+ function clearStoreEffects(storeHandler, value) {
23258
+ const effectSubscriptions = storeHandler.$effects$;
23259
+ if (!effectSubscriptions) {
23260
+ return false;
23261
+ }
23262
+ let subscriptionRemoved = false;
23263
+ for (const key in effectSubscriptions) {
23264
+ const effects = effectSubscriptions[key];
23265
+ for (let i = effects.length - 1; i >= 0; i--) {
23266
+ const effect = effects[i];
23267
+ if (effect[0 /* EFFECT */] === value) {
23268
+ effects.splice(i, 1);
23269
+ subscriptionRemoved = true;
23270
+ }
23271
+ }
23272
+ if (effects.length === 0) {
23273
+ delete effectSubscriptions[key];
23238
23274
  }
23239
23275
  }
23240
23276
  return subscriptionRemoved;
23241
23277
  }
23278
+ function clearArgsEffects(args, subscriber, seenSet) {
23279
+ for (let i = args.length - 1; i >= 0; i--) {
23280
+ const arg = args[i];
23281
+ clearArgEffect(arg, subscriber, seenSet);
23282
+ }
23283
+ }
23284
+ function clearArgEffect(arg, subscriber, seenSet) {
23285
+ if (seenSet.has(arg)) {
23286
+ return;
23287
+ }
23288
+ seenSet.add(arg);
23289
+ if (isSignal(arg)) {
23290
+ clearSignalEffects(arg, subscriber, seenSet);
23291
+ } else if (typeof arg === "object" && arg !== null) {
23292
+ if (isStore(arg)) {
23293
+ clearStoreEffects(getStoreHandler(arg), subscriber);
23294
+ } else {
23295
+ for (const key in arg) {
23296
+ clearArgEffect(arg[key], subscriber, seenSet);
23297
+ }
23298
+ }
23299
+ } else if (Array.isArray(arg)) {
23300
+ clearArgsEffects(arg, subscriber, seenSet);
23301
+ } else {
23302
+ }
23303
+ }
23242
23304
 
23243
23305
  // packages/qwik/src/core/use/use-resource.ts
23244
23306
  var _createResourceReturn = (opts) => {
@@ -23264,7 +23326,7 @@ var runResource = (task, container, host) => {
23264
23326
  cleanupTask(task);
23265
23327
  const iCtx = newInvokeContext(container.$locale$, host, void 0, ResourceEvent);
23266
23328
  iCtx.$container$ = container;
23267
- const taskFn = task.$qrl$.getFn(iCtx, () => clearSubscriberEffectDependencies(task));
23329
+ const taskFn = task.$qrl$.getFn(iCtx, () => clearSubscriberEffectDependencies(container, task));
23268
23330
  const resource = task.$state$;
23269
23331
  assertDefined(
23270
23332
  resource,
@@ -23752,6 +23814,19 @@ function escapeHTML(html) {
23752
23814
  }
23753
23815
  }
23754
23816
 
23817
+ // packages/qwik/src/core/shared/utils/jsx-filename.ts
23818
+ function getFileLocationFromJsx(jsxDev) {
23819
+ var _a;
23820
+ if (!jsxDev) {
23821
+ return null;
23822
+ }
23823
+ const sanitizedFileName = (_a = jsxDev.fileName) == null ? void 0 : _a.replace(/\\/g, "/");
23824
+ if (sanitizedFileName) {
23825
+ return `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}`;
23826
+ }
23827
+ return null;
23828
+ }
23829
+
23755
23830
  // packages/qwik/src/core/client/vnode-diff.ts
23756
23831
  var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
23757
23832
  let journal = container.$journal$;
@@ -24092,7 +24167,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
24092
24167
  vnode_remove(journal, vParent, toRemove, true);
24093
24168
  }
24094
24169
  }
24095
- function createNewElement(jsx4, elementName) {
24170
+ function createNewElement(jsx4, elementName, currentFile) {
24096
24171
  const element = createElementWithNamespace(elementName);
24097
24172
  const { constProps } = jsx4;
24098
24173
  let needsQDispatchEventPatch = false;
@@ -24120,6 +24195,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
24120
24195
  } else if (typeof value === "function") {
24121
24196
  value(element);
24122
24197
  continue;
24198
+ } else {
24199
+ throw qError(32 /* invalidRefValue */, [currentFile]);
24123
24200
  }
24124
24201
  }
24125
24202
  if (isSignal(value)) {
@@ -24141,13 +24218,13 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
24141
24218
  continue;
24142
24219
  }
24143
24220
  if (elementName === "textarea" && key2 === "value") {
24144
- if (typeof value !== "string") {
24221
+ if (value && typeof value !== "string") {
24145
24222
  if (import_build4.isDev) {
24146
- throw qError(40 /* wrongTextareaValue */);
24223
+ throw qError(40 /* wrongTextareaValue */, [currentFile, value]);
24147
24224
  }
24148
24225
  continue;
24149
24226
  }
24150
- element.value = escapeHTML(value);
24227
+ element.value = escapeHTML(value || "");
24151
24228
  continue;
24152
24229
  }
24153
24230
  value = serializeAttribute(key2, value, scopedStyleIdPrefix);
@@ -24183,19 +24260,24 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
24183
24260
  const isSameElementName = vCurrent && vnode_isElementVNode(vCurrent) && elementName === vnode_getElementName(vCurrent);
24184
24261
  const jsxKey = jsx4.key;
24185
24262
  let needsQDispatchEventPatch = false;
24263
+ const currentFile = getFileLocationFromJsx(jsx4.dev);
24186
24264
  if (!isSameElementName || jsxKey !== getKey(vCurrent)) {
24187
24265
  vNewNode = retrieveChildWithKey(elementName, jsxKey);
24188
24266
  if (vNewNode === null) {
24189
24267
  needsQDispatchEventPatch = createNewElement(jsx4, elementName);
24190
24268
  } else {
24191
24269
  vnode_insertBefore(journal, vParent, vNewNode, vCurrent);
24270
+ vCurrent = vNewNode;
24271
+ vNewNode = null;
24272
+ if (vSiblings !== null) {
24273
+ vSiblingsIdx -= 3 /* Size */;
24274
+ }
24192
24275
  }
24193
24276
  }
24194
24277
  const jsxAttrs = [];
24195
24278
  const props = jsx4.varProps;
24196
24279
  for (const key in props) {
24197
- let value = props[key];
24198
- value = serializeAttribute(key, value, scopedStyleIdPrefix);
24280
+ const value = props[key];
24199
24281
  if (value != null) {
24200
24282
  mapArray_set(jsxAttrs, key, value, 0);
24201
24283
  }
@@ -24204,7 +24286,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
24204
24286
  mapArray_set(jsxAttrs, ELEMENT_KEY, jsxKey, 0);
24205
24287
  }
24206
24288
  const vNode = vNewNode || vCurrent;
24207
- needsQDispatchEventPatch = setBulkProps(vNode, jsxAttrs) || needsQDispatchEventPatch;
24289
+ needsQDispatchEventPatch = setBulkProps(vNode, jsxAttrs, currentFile) || needsQDispatchEventPatch;
24208
24290
  if (needsQDispatchEventPatch) {
24209
24291
  const element = vnode_getNode(vNode);
24210
24292
  if (!element.qDispatchEvent) {
@@ -24227,7 +24309,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
24227
24309
  }
24228
24310
  }
24229
24311
  }
24230
- function setBulkProps(vnode, srcAttrs) {
24312
+ function setBulkProps(vnode, srcAttrs, currentFile) {
24231
24313
  vnode_ensureElementInflated(vnode);
24232
24314
  const dstAttrs = vnode;
24233
24315
  let srcIdx = 0;
@@ -24250,12 +24332,18 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
24250
24332
  } else if (typeof value === "function") {
24251
24333
  value(element);
24252
24334
  return;
24335
+ } else {
24336
+ throw qError(32 /* invalidRefValue */, [currentFile]);
24253
24337
  }
24254
24338
  }
24255
24339
  if (isSignal(value)) {
24256
- value = untrack(() => value.value);
24340
+ const signalData = new EffectPropData({
24341
+ $scopedStyleIdPrefix$: scopedStyleIdPrefix,
24342
+ $isConst$: false
24343
+ });
24344
+ value = trackSignalAndAssignHost(value, vnode, key, container, signalData);
24257
24345
  }
24258
- vnode_setAttr(journal, vnode, key, value);
24346
+ vnode_setAttr(journal, vnode, key, serializeAttribute(key, value, scopedStyleIdPrefix));
24259
24347
  if (value === null) {
24260
24348
  dstLength = dstAttrs.length;
24261
24349
  }
@@ -24297,6 +24385,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
24297
24385
  }
24298
24386
  srcIdx++;
24299
24387
  srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null;
24388
+ dstIdx++;
24389
+ dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
24300
24390
  } else if (srcKey == dstKey) {
24301
24391
  const srcValue = srcAttrs[srcIdx++];
24302
24392
  const dstValue = dstAttrs[dstIdx++];
@@ -24373,7 +24463,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
24373
24463
  vnode_insertBefore(
24374
24464
  journal,
24375
24465
  vParent,
24376
- vNewNode = vnode_newVirtual(),
24466
+ vNewNode,
24377
24467
  vCurrent && getInsertBefore()
24378
24468
  );
24379
24469
  return;
@@ -24571,7 +24661,7 @@ function cleanup(container, vNode) {
24571
24661
  const obj = seq[i];
24572
24662
  if (isTask(obj)) {
24573
24663
  const task = obj;
24574
- clearSubscriberEffectDependencies(task);
24664
+ clearSubscriberEffectDependencies(container, task);
24575
24665
  if (task.$flags$ & 1 /* VISIBLE_TASK */) {
24576
24666
  container.$scheduler$(48 /* CLEANUP_VISIBLE */, task);
24577
24667
  } else {
@@ -24689,7 +24779,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
24689
24779
  };
24690
24780
  chore.$promise$ = new Promise((resolve) => chore.$resolve$ = resolve);
24691
24781
  DEBUG2 && debugTrace("schedule", chore, currentChore, choreQueue);
24692
- chore = sortedInsert(choreQueue, chore);
24782
+ chore = sortedInsert(choreQueue, chore, container.rootVNode || null);
24693
24783
  if (!journalFlushScheduled && runLater) {
24694
24784
  journalFlushScheduled = true;
24695
24785
  schedule(16 /* JOURNAL_FLUSH */);
@@ -24698,10 +24788,10 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
24698
24788
  if (runLater) {
24699
24789
  return chore.$promise$;
24700
24790
  } else {
24701
- return drainUpTo(chore);
24791
+ return drainUpTo(chore, container.rootVNode || null);
24702
24792
  }
24703
24793
  }
24704
- function drainUpTo(runUptoChore) {
24794
+ function drainUpTo(runUptoChore, rootVNode) {
24705
24795
  if (runUptoChore.$executed$) {
24706
24796
  return runUptoChore.$returnValue$;
24707
24797
  }
@@ -24710,7 +24800,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
24710
24800
  }
24711
24801
  while (choreQueue.length) {
24712
24802
  const nextChore = choreQueue.shift();
24713
- const order = choreComparator(nextChore, runUptoChore, false);
24803
+ const order = choreComparator(nextChore, runUptoChore, rootVNode, false);
24714
24804
  if (order === null) {
24715
24805
  continue;
24716
24806
  }
@@ -24725,7 +24815,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
24725
24815
  }
24726
24816
  const returnValue = executeChore(nextChore);
24727
24817
  if (isPromise(returnValue)) {
24728
- const promise = returnValue.then(() => drainUpTo(runUptoChore));
24818
+ const promise = returnValue.then(() => drainUpTo(runUptoChore, rootVNode));
24729
24819
  return promise;
24730
24820
  }
24731
24821
  }
@@ -24852,7 +24942,7 @@ var choreUpdate = (existing, newChore) => {
24852
24942
  function vNodeAlreadyDeleted(chore) {
24853
24943
  return !!(chore.$host$ && vnode_isVNode(chore.$host$) && chore.$host$[0 /* flags */] & 32 /* Deleted */);
24854
24944
  }
24855
- function choreComparator(a, b, shouldThrowOnHostMismatch) {
24945
+ function choreComparator(a, b, rootVNode, shouldThrowOnHostMismatch) {
24856
24946
  const macroTypeDiff = (a.$type$ & 240 /* MACRO */) - (b.$type$ & 240 /* MACRO */);
24857
24947
  if (macroTypeDiff !== 0) {
24858
24948
  return macroTypeDiff;
@@ -24862,7 +24952,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
24862
24952
  const bHost = b.$host$;
24863
24953
  if (aHost !== bHost && aHost !== null && bHost !== null) {
24864
24954
  if (vnode_isVNode(aHost) && vnode_isVNode(bHost)) {
24865
- const hostDiff = vnode_documentPosition(aHost, bHost);
24955
+ const hostDiff = vnode_documentPosition(aHost, bHost, rootVNode);
24866
24956
  if (hostDiff !== 0) {
24867
24957
  return hostDiff;
24868
24958
  }
@@ -24892,13 +24982,13 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
24892
24982
  }
24893
24983
  return 0;
24894
24984
  }
24895
- function sortedFindIndex(sortedArray, value) {
24985
+ function sortedFindIndex(sortedArray, value, rootVNode) {
24896
24986
  let bottom = 0;
24897
24987
  let top = sortedArray.length;
24898
24988
  while (bottom < top) {
24899
24989
  const middle = bottom + (top - bottom >> 1);
24900
24990
  const midChore = sortedArray[middle];
24901
- const comp = choreComparator(value, midChore, true);
24991
+ const comp = choreComparator(value, midChore, rootVNode, true);
24902
24992
  if (comp < 0) {
24903
24993
  top = middle;
24904
24994
  } else if (comp > 0) {
@@ -24909,8 +24999,8 @@ function sortedFindIndex(sortedArray, value) {
24909
24999
  }
24910
25000
  return ~bottom;
24911
25001
  }
24912
- function sortedInsert(sortedArray, value) {
24913
- const idx = sortedFindIndex(sortedArray, value);
25002
+ function sortedInsert(sortedArray, value, rootVNode) {
25003
+ const idx = sortedFindIndex(sortedArray, value, rootVNode);
24914
25004
  if (idx < 0) {
24915
25005
  sortedArray.splice(~idx, 0, value);
24916
25006
  return value;
@@ -24963,7 +25053,10 @@ var runTask = (task, container, host) => {
24963
25053
  cleanupTask(task);
24964
25054
  const iCtx = newInvokeContext(container.$locale$, host, void 0, TaskEvent);
24965
25055
  iCtx.$container$ = container;
24966
- const taskFn = task.$qrl$.getFn(iCtx, () => clearSubscriberEffectDependencies(task));
25056
+ const taskFn = task.$qrl$.getFn(
25057
+ iCtx,
25058
+ () => clearSubscriberEffectDependencies(container, task)
25059
+ );
24967
25060
  const track = (obj, prop) => {
24968
25061
  const ctx = newInvokeContext();
24969
25062
  ctx.$effectSubscriber$ = [task, ":" /* COMPONENT */];
@@ -27014,7 +27107,7 @@ var vnode_getNode = (vnode) => {
27014
27107
  assertTrue(vnode_isTextVNode(vnode), "Expecting Text Node.");
27015
27108
  return vnode[4 /* node */];
27016
27109
  };
27017
- function vnode_toString(depth = 10, offset = "", materialize2 = false, siblings = false) {
27110
+ function vnode_toString(depth = 20, offset = "", materialize2 = false, siblings = false) {
27018
27111
  var _a;
27019
27112
  let vnode = this;
27020
27113
  if (depth === 0) {
@@ -27213,17 +27306,19 @@ var isElement = (node) => node && typeof node == "object" && fastNodeType(node)
27213
27306
  1;
27214
27307
  var aPath = [];
27215
27308
  var bPath = [];
27216
- var vnode_documentPosition = (a, b) => {
27309
+ var vnode_documentPosition = (a, b, rootVNode) => {
27217
27310
  if (a === b) {
27218
27311
  return 0;
27219
27312
  }
27220
27313
  let aDepth = -1;
27221
27314
  let bDepth = -1;
27222
27315
  while (a) {
27223
- a = (aPath[++aDepth] = a)[1 /* parent */];
27316
+ const vNode = aPath[++aDepth] = a;
27317
+ a = vNode[1 /* parent */] || rootVNode && vnode_getProp(a, QSlotParent, (id) => vnode_locate(rootVNode, id));
27224
27318
  }
27225
27319
  while (b) {
27226
- b = (bPath[++bDepth] = b)[1 /* parent */];
27320
+ const vNode = bPath[++bDepth] = b;
27321
+ b = vNode[1 /* parent */] || rootVNode && vnode_getProp(b, QSlotParent, (id) => vnode_locate(rootVNode, id));
27227
27322
  }
27228
27323
  while (aDepth >= 0 && bDepth >= 0) {
27229
27324
  a = aPath[aDepth];
@@ -27246,6 +27341,9 @@ var vnode_documentPosition = (a, b) => {
27246
27341
  return -1;
27247
27342
  }
27248
27343
  } while (cursor);
27344
+ if (rootVNode && vnode_getProp(b, QSlotParent, (id) => vnode_locate(rootVNode, id))) {
27345
+ return -1;
27346
+ }
27249
27347
  return 1;
27250
27348
  }
27251
27349
  }
@@ -27255,8 +27353,11 @@ var vnode_getProjectionParentComponent = (vHost, rootVNode) => {
27255
27353
  let projectionDepth = 1;
27256
27354
  while (projectionDepth--) {
27257
27355
  while (vHost && (vnode_isVirtualVNode(vHost) ? vnode_getProp(vHost, OnRenderProp, null) === null : true)) {
27258
- const qSlotParentProp = vnode_getProp(vHost, QSlotParent, null);
27259
- const qSlotParent = qSlotParentProp && (typeof qSlotParentProp === "string" ? vnode_locate(rootVNode, qSlotParentProp) : qSlotParentProp);
27356
+ const qSlotParent = vnode_getProp(
27357
+ vHost,
27358
+ QSlotParent,
27359
+ (id) => vnode_locate(rootVNode, id)
27360
+ );
27260
27361
  const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
27261
27362
  if (vProjectionParent) {
27262
27363
  projectionDepth++;
@@ -27834,13 +27935,11 @@ var DomContainer = class extends _SharedContainer {
27834
27935
  if (vnode_getProp(vNode, OnRenderProp, null) !== null) {
27835
27936
  return vNode;
27836
27937
  }
27837
- const parent = vnode_getProp(vNode, QSlotParent, this.$vnodeLocate$);
27838
- if (parent) {
27839
- vNode = parent;
27840
- continue;
27841
- }
27938
+ vNode = vnode_getParent(vNode) || // If virtual node, than it could be a slot so we need to read its parent.
27939
+ vnode_getProp(vNode, QSlotParent, this.$vnodeLocate$);
27940
+ } else {
27941
+ vNode = vnode_getParent(vNode);
27842
27942
  }
27843
- vNode = vnode_getParent(vNode);
27844
27943
  }
27845
27944
  return null;
27846
27945
  }
@@ -27943,10 +28042,6 @@ var DomContainer = class extends _SharedContainer {
27943
28042
 
27944
28043
  // packages/qwik/src/core/shared/shared-serialization.ts
27945
28044
  var deserializedProxyMap = /* @__PURE__ */ new WeakMap();
27946
- var unwrapDeserializerProxy = (value) => {
27947
- const unwrapped = typeof value === "object" && value !== null && value[SERIALIZER_PROXY_UNWRAP];
27948
- return unwrapped ? unwrapped : value;
27949
- };
27950
28045
  var isDeserializerProxy = (value) => {
27951
28046
  return typeof value === "object" && value !== null && SERIALIZER_PROXY_UNWRAP in value;
27952
28047
  };
@@ -27988,13 +28083,13 @@ var DeserializationHandler = class {
27988
28083
  return value;
27989
28084
  }
27990
28085
  const container = this.$container$;
27991
- const propValue = allocate(container, typeId, value);
28086
+ let propValue = allocate(container, typeId, value);
28087
+ if (typeId >= 12 /* Error */) {
28088
+ propValue = inflate(container, propValue, typeId, value);
28089
+ }
27992
28090
  Reflect.set(target, property, propValue);
27993
28091
  this.$data$[idx] = void 0;
27994
28092
  this.$data$[idx + 1] = propValue;
27995
- if (typeId >= 12 /* Error */) {
27996
- inflate(container, propValue, typeId, value);
27997
- }
27998
28093
  return propValue;
27999
28094
  }
28000
28095
  has(target, property) {
@@ -28029,7 +28124,7 @@ var resolvers = /* @__PURE__ */ new WeakMap();
28029
28124
  var inflate = (container, target, typeId, data) => {
28030
28125
  var _a;
28031
28126
  if (typeId === void 0) {
28032
- return;
28127
+ return target;
28033
28128
  }
28034
28129
  if (typeId !== 13 /* Object */ && Array.isArray(data)) {
28035
28130
  data = _eagerDeserializeArray(container, data);
@@ -28100,14 +28195,13 @@ var inflate = (container, target, typeId, data) => {
28100
28195
  case 25 /* Store */:
28101
28196
  case 26 /* StoreArray */: {
28102
28197
  const [value, flags, effects2, storeEffect] = data;
28103
- const handler = getStoreHandler(target);
28104
- handler.$flags$ = flags;
28105
- Object.assign(getStoreTarget(target), value);
28198
+ const store = getOrCreateStore(value, flags, container);
28199
+ const storeHandler = getStoreHandler(store);
28106
28200
  if (storeEffect) {
28107
28201
  effects2[STORE_ARRAY_PROP] = storeEffect;
28108
28202
  }
28109
- handler.$effects$ = effects2;
28110
- container.$storeProxyMap$.set(value, target);
28203
+ storeHandler.$effects$ = effects2;
28204
+ target = store;
28111
28205
  break;
28112
28206
  }
28113
28207
  case 22 /* Signal */: {
@@ -28229,6 +28323,7 @@ var inflate = (container, target, typeId, data) => {
28229
28323
  default:
28230
28324
  throw qError(33 /* serializeErrorNotImplemented */, [typeId]);
28231
28325
  }
28326
+ return target;
28232
28327
  };
28233
28328
  var _constants = [
28234
28329
  void 0,
@@ -28314,9 +28409,8 @@ var allocate = (container, typeId, value) => {
28314
28409
  case 24 /* ComputedSignal */:
28315
28410
  return new ComputedSignal(container, null);
28316
28411
  case 25 /* Store */:
28317
- return createStore(container, {}, 0);
28318
28412
  case 26 /* StoreArray */:
28319
- return createStore(container, [], 0);
28413
+ return null;
28320
28414
  case 11 /* URLSearchParams */:
28321
28415
  return new URLSearchParams(value);
28322
28416
  case 27 /* FormData */:
@@ -28968,15 +29062,15 @@ function qrlToString(serializationContext, value) {
28968
29062
  }
28969
29063
  return qrlStringInline;
28970
29064
  }
28971
- function deserializeData(container, typeId, propValue) {
29065
+ function deserializeData(container, typeId, value) {
28972
29066
  if (typeId === void 0) {
28973
- return propValue;
29067
+ return value;
28974
29068
  }
28975
- const value = allocate(container, typeId, propValue);
29069
+ let propValue = allocate(container, typeId, value);
28976
29070
  if (typeId >= 12 /* Error */) {
28977
- inflate(container, value, typeId, propValue);
29071
+ propValue = inflate(container, propValue, typeId, value);
28978
29072
  }
28979
- return value;
29073
+ return propValue;
28980
29074
  }
28981
29075
  function shouldTrackObj(obj) {
28982
29076
  return (
@@ -30828,7 +30922,7 @@ var SsrComponentFrame = class {
30828
30922
  if ((0, import_core4._isJSXNode)(children)) {
30829
30923
  const slotName = this.getSlotName(children);
30830
30924
  mapArray_set(this.slots, slotName, children, 0);
30831
- } else if (Array.isArray(children)) {
30925
+ } else if (Array.isArray(children) && children.length > 0) {
30832
30926
  const defaultSlot = [];
30833
30927
  for (let i = 0; i < children.length; i++) {
30834
30928
  const child = children[i];
@@ -30843,7 +30937,7 @@ var SsrComponentFrame = class {
30843
30937
  defaultSlot.push(child);
30844
30938
  }
30845
30939
  }
30846
- defaultSlot.length && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
30940
+ defaultSlot.length > 0 && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
30847
30941
  } else {
30848
30942
  mapArray_set(this.slots, QDefaultSlot, children, 0);
30849
30943
  }
@@ -31457,12 +31551,12 @@ var SSRContainer = class extends import_core6._SharedContainer {
31457
31551
  this.write("<");
31458
31552
  this.write(elementName);
31459
31553
  if (varAttrs) {
31460
- innerHTML = this.writeAttrs(elementName, varAttrs, false);
31554
+ innerHTML = this.writeAttrs(elementName, varAttrs, false, currentFile);
31461
31555
  }
31462
31556
  this.write(" " + Q_PROPS_SEPARATOR);
31463
31557
  import_build12.isDev && this.write('=""');
31464
31558
  if (constAttrs && constAttrs.length) {
31465
- innerHTML = this.writeAttrs(elementName, constAttrs, true) || innerHTML;
31559
+ innerHTML = this.writeAttrs(elementName, constAttrs, true, currentFile) || innerHTML;
31466
31560
  }
31467
31561
  this.write(">");
31468
31562
  this.lastNode = null;
@@ -31537,14 +31631,10 @@ var SSRContainer = class extends import_core6._SharedContainer {
31537
31631
  }
31538
31632
  }
31539
31633
  openProjection(attrs) {
31540
- var _a;
31541
31634
  this.openFragment(attrs);
31542
- const vNode = (_a = this.currentElementFrame) == null ? void 0 : _a.vNodeData;
31543
- if (vNode) {
31544
- vNode[0] |= 16 /* SERIALIZE */;
31545
- }
31546
31635
  const componentFrame = this.getComponentFrame();
31547
31636
  if (componentFrame) {
31637
+ this.serializationCtx.$addRoot$(componentFrame.componentNode);
31548
31638
  componentFrame.projectionDepth++;
31549
31639
  }
31550
31640
  }
@@ -32110,7 +32200,7 @@ var SSRContainer = class extends import_core6._SharedContainer {
32110
32200
  this.write(element);
32111
32201
  }
32112
32202
  }
32113
- writeAttrs(tag, attrs, isConst) {
32203
+ writeAttrs(tag, attrs, isConst, currentFile) {
32114
32204
  let innerHTML = void 0;
32115
32205
  if (attrs.length) {
32116
32206
  for (let i = 0; i < attrs.length; i++) {
@@ -32137,7 +32227,7 @@ var SSRContainer = class extends import_core6._SharedContainer {
32137
32227
  value(new DomRef(lastNode));
32138
32228
  continue;
32139
32229
  } else {
32140
- throw qError(32 /* invalidRefValue */);
32230
+ throw qError(32 /* invalidRefValue */, [currentFile]);
32141
32231
  }
32142
32232
  }
32143
32233
  if ((0, import_core6.isSignal)(value)) {
@@ -32157,13 +32247,13 @@ var SSRContainer = class extends import_core6._SharedContainer {
32157
32247
  }
32158
32248
  }
32159
32249
  if (tag === "textarea" && key === "value") {
32160
- if (typeof value !== "string") {
32250
+ if (value && typeof value !== "string") {
32161
32251
  if (import_build12.isDev) {
32162
- throw qError(40 /* wrongTextareaValue */);
32252
+ throw qError(40 /* wrongTextareaValue */, [currentFile, value]);
32163
32253
  }
32164
32254
  continue;
32165
32255
  }
32166
- innerHTML = escapeHTML(value);
32256
+ innerHTML = escapeHTML(value || "");
32167
32257
  key = QContainerAttr;
32168
32258
  value = "text" /* TEXT */;
32169
32259
  }