@qwik.dev/core 2.0.0-alpha.7 → 2.0.0-alpha.8

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.
@@ -2,7 +2,7 @@
2
2
  var __defProp = Object.defineProperty;
3
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- var _a, _b, _c;
5
+ var _a, _b, _c, _d, _e;
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
7
  const core = require("@qwik.dev/core");
8
8
  var isBrowser = /* @__PURE__ */ (() => typeof window !== "undefined" && typeof HTMLElement !== "undefined" && !!window.document && String(HTMLElement).includes("[native code]"))();
@@ -10,7 +10,7 @@ var isServer = !isBrowser;
10
10
  var isDev = false;
11
11
  /**
12
12
  * @license
13
- * @qwik.dev/core 2.0.0-alpha.7-dev+a26598a
13
+ * @qwik.dev/core 2.0.0-alpha.8-dev+66037b5
14
14
  * Copyright QwikDev. All Rights Reserved.
15
15
  * Use of this source code is governed by an MIT-style license that can be
16
16
  * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
@@ -316,7 +316,7 @@ function isAriaAttribute(prop) {
316
316
  }
317
317
  const STORE_TARGET = Symbol("store.target");
318
318
  const STORE_HANDLER = Symbol("store.handler");
319
- const STORE_ARRAY_PROP = Symbol("store.array");
319
+ const STORE_ALL_PROPS = Symbol("store.all");
320
320
  var StoreFlags;
321
321
  !function(StoreFlags2) {
322
322
  StoreFlags2[StoreFlags2.NONE = 0] = "NONE", StoreFlags2[StoreFlags2.RECURSIVE = 1] = "RECURSIVE", StoreFlags2[StoreFlags2.IMMUTABLE = 2] = "IMMUTABLE";
@@ -361,7 +361,7 @@ class StoreHandler {
361
361
  assertTrue(!ctx.$container$ || ctx.$container$ === this.$container$);
362
362
  }
363
363
  const effectSubscriber = ctx.$effectSubscriber$;
364
- effectSubscriber && addEffect(target, Array.isArray(target) ? STORE_ARRAY_PROP : prop, this, effectSubscriber);
364
+ effectSubscriber && addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
365
365
  }
366
366
  if ("toString" === prop && value === Object.prototype.toString) {
367
367
  return this.toString;
@@ -391,7 +391,7 @@ class StoreHandler {
391
391
  const ctx = tryGetInvokeContext();
392
392
  if (ctx) {
393
393
  const effectSubscriber = ctx.$effectSubscriber$;
394
- effectSubscriber && addEffect(target, Array.isArray(target) ? STORE_ARRAY_PROP : prop, this, effectSubscriber);
394
+ effectSubscriber && addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
395
395
  }
396
396
  }
397
397
  return Object.prototype.hasOwnProperty.call(target, prop);
@@ -399,7 +399,7 @@ class StoreHandler {
399
399
  ownKeys(target) {
400
400
  const ctx = tryGetInvokeContext();
401
401
  const effectSubscriber = ctx?.$effectSubscriber$;
402
- return effectSubscriber && addEffect(target, STORE_ARRAY_PROP, this, effectSubscriber), Reflect.ownKeys(target);
402
+ return effectSubscriber && addStoreEffect(target, STORE_ALL_PROPS, this, effectSubscriber), Reflect.ownKeys(target);
403
403
  }
404
404
  getOwnPropertyDescriptor(target, prop) {
405
405
  const descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
@@ -409,7 +409,7 @@ class StoreHandler {
409
409
  };
410
410
  }
411
411
  }
412
- function addEffect(target, prop, store, effectSubscription) {
412
+ function addStoreEffect(target, prop, store, effectSubscription) {
413
413
  const effectsMap = store.$effects$ || (store.$effects$ = /* @__PURE__ */ new Map());
414
414
  let effects = effectsMap.get(prop);
415
415
  effects || (effects = /* @__PURE__ */ new Set(), effectsMap.set(prop, effects)), ensureContainsSubscription(effects, effectSubscription), ensureContainsBackRef(effectSubscription, target), addQrlToSerializationCtx(effectSubscription, store.$container$);
@@ -431,7 +431,7 @@ function getEffects(target, prop, storeEffects) {
431
431
  effectsToTrigger = storeEffects.get(prop);
432
432
  }
433
433
  }
434
- const storeArrayValue = storeEffects?.get(STORE_ARRAY_PROP);
434
+ const storeArrayValue = storeEffects?.get(STORE_ALL_PROPS);
435
435
  if (storeArrayValue) {
436
436
  effectsToTrigger || (effectsToTrigger = /* @__PURE__ */ new Set());
437
437
  for (const effect of storeArrayValue) {
@@ -523,6 +523,9 @@ const runTask = (task, container, host) => {
523
523
  if (isSignal(obj)) {
524
524
  return obj.value;
525
525
  }
526
+ if (isStore(obj)) {
527
+ return addStoreEffect(getStoreTarget(obj), STORE_ALL_PROPS, getStoreHandler(obj), ctx.$effectSubscriber$), obj;
528
+ }
526
529
  throw qError(QError.trackObjectWithoutProp);
527
530
  });
528
531
  },
@@ -578,12 +581,12 @@ var VirtualVNodeProps;
578
581
  }(TextVNodeProps || (TextVNodeProps = {})), function(VirtualVNodeProps2) {
579
582
  VirtualVNodeProps2[VirtualVNodeProps2.firstChild = 4] = "firstChild", VirtualVNodeProps2[VirtualVNodeProps2.lastChild = 5] = "lastChild", VirtualVNodeProps2[VirtualVNodeProps2.PROPS_OFFSET = 6] = "PROPS_OFFSET";
580
583
  }(VirtualVNodeProps || (VirtualVNodeProps = {}));
581
- const mapApp_findIndx = (elementVNode, key, start) => {
584
+ const mapApp_findIndx = (array, key, start) => {
582
585
  let bottom = start >> 1;
583
- let top = elementVNode.length - 2 >> 1;
586
+ let top = array.length - 2 >> 1;
584
587
  for (; bottom <= top; ) {
585
588
  const mid = bottom + (top - bottom >> 1);
586
- const midKey = elementVNode[mid << 1];
589
+ const midKey = array[mid << 1];
587
590
  if (midKey === key) {
588
591
  return mid << 1;
589
592
  }
@@ -591,13 +594,13 @@ const mapApp_findIndx = (elementVNode, key, start) => {
591
594
  }
592
595
  return ~(bottom << 1);
593
596
  };
594
- const mapArray_set = (elementVNode, key, value, start) => {
595
- const indx = mapApp_findIndx(elementVNode, key, start);
596
- indx >= 0 ? null == value ? elementVNode.splice(indx, 2) : elementVNode[indx + 1] = value : null != value && elementVNode.splice(~indx, 0, key, value);
597
+ const mapArray_set = (array, key, value, start) => {
598
+ const indx = mapApp_findIndx(array, key, start);
599
+ indx >= 0 ? null == value ? array.splice(indx, 2) : array[indx + 1] = value : null != value && array.splice(~indx, 0, key, value);
597
600
  };
598
- const mapArray_get = (elementVNode, key, start) => {
599
- const indx = mapApp_findIndx(elementVNode, key, start);
600
- return indx >= 0 ? elementVNode[indx + 1] : null;
601
+ const mapArray_get = (array, key, start) => {
602
+ const indx = mapApp_findIndx(array, key, start);
603
+ return indx >= 0 ? array[indx + 1] : null;
601
604
  };
602
605
  const isForeignObjectElement = (elementName) => "foreignObject" === elementName;
603
606
  const isSvgElement = (elementName) => "svg" === elementName || isForeignObjectElement(elementName);
@@ -825,9 +828,6 @@ const _VAR_PROPS = Symbol("VAR");
825
828
  function isSlotProp(prop) {
826
829
  return !prop.startsWith("q:") && !prop.startsWith(":");
827
830
  }
828
- function isParentSlotProp(prop) {
829
- return prop.startsWith(":");
830
- }
831
831
  function escapeHTML(html) {
832
832
  let escapedHTML = "";
833
833
  const length = html.length;
@@ -955,7 +955,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
955
955
  }
956
956
  function expectProjection() {
957
957
  const slotName = jsxValue.key;
958
- vCurrent = vnode_getProp(vParent, slotName, (id) => vnode_locate(container.rootVNode, id)), null == vCurrent && (vNewNode = vnode_newVirtual(), vnode_setProp(vNewNode, QSlot, slotName), vnode_setProp(vNewNode, ":", vParent), vnode_setProp(vParent, slotName, vNewNode));
958
+ vCurrent = vnode_getProp(vParent, slotName, (id) => vnode_locate(container.rootVNode, id)), vCurrent = vCurrent && vCurrent[VNodeProps.flags] & VNodeFlags.Deleted ? null : vCurrent, null == vCurrent && (vNewNode = vnode_newVirtual(), vnode_setProp(vNewNode, QSlot, slotName), vnode_setProp(vNewNode, "q:sparent", vParent), vnode_setProp(vParent, slotName, vNewNode));
959
959
  }
960
960
  function expectSlot() {
961
961
  const vHost = vnode_getProjectionParentComponent(vParent, container.rootVNode);
@@ -971,13 +971,21 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
971
971
  return directGetPropsProxyProp(jsxNode2, "name") || "";
972
972
  }(vHost);
973
973
  const vProjectedNode = vHost ? vnode_getProp(vHost, slotNameKey, null) : null;
974
- return null == vProjectedNode ? (vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore()), vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode), false) : (vProjectedNode === vCurrent || (vnode_insertBefore(journal, vParent, vNewNode = vProjectedNode, vCurrent && getInsertBefore()), vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode), isDev), true);
974
+ if (null == vProjectedNode) {
975
+ return vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore()), vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode), false;
976
+ }
977
+ if (vProjectedNode === vCurrent) ;
978
+ else {
979
+ const parent = vnode_getParent(vProjectedNode);
980
+ !(!parent || vnode_isElementVNode(parent) && vnode_getElementName(parent) === QTemplate) && vParent !== parent && vnode_remove(journal, parent, vProjectedNode, false), vnode_insertBefore(journal, vParent, vNewNode = vProjectedNode, vCurrent && getInsertBefore()), vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode);
981
+ }
982
+ return true;
975
983
  }
976
984
  function expectNoMore() {
977
985
  if (null !== vCurrent) {
978
986
  for (; vCurrent; ) {
979
987
  const toRemove = vCurrent;
980
- advanceToNextSibling(), cleanup(container, toRemove), vParent === vnode_getParent(toRemove) && vnode_remove(journal, vParent, toRemove, true);
988
+ advanceToNextSibling(), vParent === vnode_getParent(toRemove) && (cleanup(container, toRemove), vnode_remove(journal, vParent, toRemove, true));
981
989
  }
982
990
  }
983
991
  }
@@ -1177,7 +1185,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1177
1185
  const componentHash = componentQRL.$hash$;
1178
1186
  const vNodeComponentHash = getComponentHash(host, container.$getObjectById$);
1179
1187
  const lookupKey = jsxNode2.key || componentHash;
1180
- if (lookupKey === (getKey(host) || vNodeComponentHash) ? componentHash === vNodeComponentHash || (insertNewComponent(host, componentQRL, jsxProps), vNewNode && (host = vNewNode, shouldRender = true)) : (vNewNode = retrieveChildWithKey(null, lookupKey), vNewNode ? vnode_insertBefore(journal, vParent, vNewNode, vCurrent) : insertNewComponent(host, componentQRL, jsxProps), host = vNewNode, shouldRender = true), host) {
1188
+ if (lookupKey === (getKey(host) || vNodeComponentHash) ? componentHash === vNodeComponentHash || (insertNewComponent(host, componentQRL, jsxProps), host = vNewNode, shouldRender = true) : (vNewNode = retrieveChildWithKey(null, lookupKey), vNewNode ? vnode_insertBefore(journal, vParent, vNewNode, vCurrent) : insertNewComponent(host, componentQRL, jsxProps), host = vNewNode, shouldRender = true), host) {
1181
1189
  const vNodeProps = vnode_getProp(host, "q:props", container.$getObjectById$);
1182
1190
  shouldRender = shouldRender || propsDiffer(jsxProps, vNodeProps), shouldRender && (host[VNodeProps.flags] &= ~VNodeFlags.Deleted, container.$scheduler$(ChoreType.COMPONENT, host, componentQRL, jsxProps));
1183
1191
  }
@@ -1211,11 +1219,9 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1211
1219
  }(jsxNode2.children, host);
1212
1220
  } else {
1213
1221
  const lookupKey = jsxNode2.key;
1214
- if (lookupKey === getKey(host) || (vNewNode = retrieveChildWithKey(null, lookupKey), vNewNode ? vnode_insertBefore(journal, vParent, vNewNode, vCurrent) : function() {
1215
- vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore());
1216
- const jsxNode3 = jsxValue;
1217
- vnode_setProp(vNewNode, "q:props", jsxNode3.props), jsxNode3.key && vnode_setProp(vNewNode, "q:key", jsxNode3.key);
1218
- }(), host = vNewNode), host) {
1222
+ const lookupKeysAreEqual = lookupKey === getKey(host);
1223
+ const vNodeComponentHash = getComponentHash(host, container.$getObjectById$);
1224
+ if (lookupKeysAreEqual ? null != vNodeComponentHash && (insertNewInlineComponent(), host = vNewNode) : (vNewNode = retrieveChildWithKey(null, lookupKey), vNewNode ? vnode_insertBefore(journal, vParent, vNewNode, vCurrent) : insertNewInlineComponent(), host = vNewNode), host) {
1219
1225
  let componentHost = host;
1220
1226
  for (; componentHost && (!vnode_isVirtualVNode(componentHost) || null === vnode_getProp(componentHost, "q:renderFn", null)); ) {
1221
1227
  componentHost = vnode_getParent(componentHost);
@@ -1230,6 +1236,11 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1230
1236
  const jsxNode2 = jsxValue;
1231
1237
  container.setHostProp(vNewNode, "q:renderFn", componentQRL), container.setHostProp(vNewNode, "q:props", jsxProps), container.setHostProp(vNewNode, "q:key", jsxNode2.key);
1232
1238
  }
1239
+ function insertNewInlineComponent() {
1240
+ vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore());
1241
+ const jsxNode2 = jsxValue;
1242
+ vnode_setProp(vNewNode, "q:props", jsxNode2.props), jsxNode2.key && vnode_setProp(vNewNode, "q:key", jsxNode2.key);
1243
+ }
1233
1244
  function expectText(text) {
1234
1245
  if (null !== vCurrent) {
1235
1246
  if (3 === vnode_getType(vCurrent)) {
@@ -1280,7 +1291,7 @@ function removePropsKeys(keys, propKeys) {
1280
1291
  function cleanup(container, vNode) {
1281
1292
  let vCursor = vNode;
1282
1293
  if (vnode_isTextVNode(vNode)) {
1283
- return;
1294
+ return void markVNodeAsDeleted(vCursor);
1284
1295
  }
1285
1296
  let vParent = null;
1286
1297
  for (; ; ) {
@@ -1301,8 +1312,7 @@ function cleanup(container, vNode) {
1301
1312
  if (type & VNodeFlags.Virtual && null !== vnode_getProp(vCursor, "q:renderFn", null)) {
1302
1313
  const attrs = vnode_getProps(vCursor);
1303
1314
  for (let i = 0; i < attrs.length; i += 2) {
1304
- const key = attrs[i];
1305
- if (!isParentSlotProp(key) && isSlotProp(key)) {
1315
+ if (isSlotProp(attrs[i])) {
1306
1316
  const value = attrs[i + 1];
1307
1317
  if (value) {
1308
1318
  attrs[i + 1] = null;
@@ -1316,7 +1326,7 @@ function cleanup(container, vNode) {
1316
1326
  }
1317
1327
  }
1318
1328
  }
1319
- if (type & VNodeFlags.Virtual && null !== vnode_getProp(vCursor, QSlot, null)) {
1329
+ if (vnode_isProjection(vCursor)) {
1320
1330
  if (vCursor === vNode) {
1321
1331
  const vFirstChild = vnode_getFirstChild(vCursor);
1322
1332
  if (vFirstChild) {
@@ -1330,6 +1340,8 @@ function cleanup(container, vNode) {
1330
1340
  continue;
1331
1341
  }
1332
1342
  }
1343
+ } else {
1344
+ type & VNodeFlags.Text && markVNodeAsDeleted(vCursor);
1333
1345
  }
1334
1346
  if (vCursor === vNode) {
1335
1347
  return;
@@ -1453,10 +1465,10 @@ const vnode_documentPosition = (a2, b, rootVNode) => {
1453
1465
  let aDepth = -1;
1454
1466
  let bDepth = -1;
1455
1467
  for (; a2; ) {
1456
- a2 = (aVNodePath[++aDepth] = a2)[VNodeProps.parent] || rootVNode && vnode_getProp(a2, ":", (id) => vnode_locate(rootVNode, id));
1468
+ a2 = (aVNodePath[++aDepth] = a2)[VNodeProps.parent] || rootVNode && vnode_getProp(a2, "q:sparent", (id) => vnode_locate(rootVNode, id));
1457
1469
  }
1458
1470
  for (; b; ) {
1459
- b = (bVNodePath[++bDepth] = b)[VNodeProps.parent] || rootVNode && vnode_getProp(b, ":", (id) => vnode_locate(rootVNode, id));
1471
+ b = (bVNodePath[++bDepth] = b)[VNodeProps.parent] || rootVNode && vnode_getProp(b, "q:sparent", (id) => vnode_locate(rootVNode, id));
1460
1472
  }
1461
1473
  for (; aDepth >= 0 && bDepth >= 0; ) {
1462
1474
  if ((a2 = aVNodePath[aDepth]) !== (b = bVNodePath[bDepth])) {
@@ -1472,7 +1484,7 @@ const vnode_documentPosition = (a2, b, rootVNode) => {
1472
1484
  return -1;
1473
1485
  }
1474
1486
  } while (cursor);
1475
- return rootVNode && vnode_getProp(b, ":", (id) => vnode_locate(rootVNode, id)) ? -1 : 1;
1487
+ return rootVNode && vnode_getProp(b, "q:sparent", (id) => vnode_locate(rootVNode, id)) ? -1 : 1;
1476
1488
  }
1477
1489
  aDepth--, bDepth--;
1478
1490
  }
@@ -1718,6 +1730,13 @@ const toNumber = (value) => "number" == typeof value ? value : -1;
1718
1730
  function vNodeAlreadyDeleted(chore) {
1719
1731
  return !!(chore.$host$ && vnode_isVNode(chore.$host$) && chore.$host$[VNodeProps.flags] & VNodeFlags.Deleted);
1720
1732
  }
1733
+ var SignalFlags;
1734
+ var WrappedSignalFlags;
1735
+ !function(SignalFlags2) {
1736
+ SignalFlags2[SignalFlags2.INVALID = 1] = "INVALID";
1737
+ }(SignalFlags || (SignalFlags = {})), function(WrappedSignalFlags2) {
1738
+ WrappedSignalFlags2[WrappedSignalFlags2.UNWRAP = 2] = "UNWRAP";
1739
+ }(WrappedSignalFlags || (WrappedSignalFlags = {}));
1721
1740
  const throwIfQRLNotResolved = (qrl2) => {
1722
1741
  if (!qrl2.resolved) {
1723
1742
  throw qrl2.resolve();
@@ -1775,7 +1794,7 @@ class Signal {
1775
1794
  valueOf() {
1776
1795
  }
1777
1796
  toString() {
1778
- return `[${this.constructor.name}${this.$invalid$ ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (Array.from(this.$effects$ || []).map((e) => "\n -> " + pad(qwikDebugToString(e[0]), " ")).join("\n") || "");
1797
+ return `[${this.constructor.name}${this.$flags$ & SignalFlags.INVALID ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (Array.from(this.$effects$ || []).map((e) => "\n -> " + pad(qwikDebugToString(e[0]), " ")).join("\n") || "");
1779
1798
  }
1780
1799
  toJSON() {
1781
1800
  return {
@@ -1835,26 +1854,27 @@ const triggerEffects = (container, signal, effects) => {
1835
1854
  }
1836
1855
  }
1837
1856
  };
1838
- class ComputedSignal extends Signal {
1839
- constructor(container, fn) {
1857
+ class ComputedSignal extends (_c = Signal, _b = _EFFECT_BACK_REF, _c) {
1858
+ constructor(container, fn, flags = SignalFlags.INVALID) {
1840
1859
  super(container, NEEDS_COMPUTATION);
1841
1860
  __publicField(this, "$computeQrl$");
1842
- __publicField(this, "$invalid$", true);
1861
+ __publicField(this, "$flags$");
1843
1862
  __publicField(this, "$forceRunEffects$", false);
1844
- this.$computeQrl$ = fn;
1863
+ __publicField(this, _b, null);
1864
+ this.$computeQrl$ = fn, this.$flags$ = flags;
1845
1865
  }
1846
1866
  $invalidate$() {
1847
- this.$invalid$ = true, this.$forceRunEffects$ = false, this.$container$?.$scheduler$(ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, null, this);
1867
+ this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = false, this.$container$?.$scheduler$(ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, null, this);
1848
1868
  }
1849
1869
  force() {
1850
- this.$invalid$ = true, this.$forceRunEffects$ = false, triggerEffects(this.$container$, this, this.$effects$);
1870
+ this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = false, triggerEffects(this.$container$, this, this.$effects$);
1851
1871
  }
1852
1872
  get untrackedValue() {
1853
1873
  const didChange = this.$computeIfNeeded$();
1854
1874
  return didChange && (this.$forceRunEffects$ = didChange), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION), this.$untrackedValue$;
1855
1875
  }
1856
1876
  $computeIfNeeded$() {
1857
- if (!this.$invalid$) {
1877
+ if (!(this.$flags$ & SignalFlags.INVALID)) {
1858
1878
  return false;
1859
1879
  }
1860
1880
  const computeQrl = this.$computeQrl$;
@@ -1867,7 +1887,7 @@ class ComputedSignal extends Signal {
1867
1887
  if (isPromise(untrackedValue)) {
1868
1888
  throw qError(QError.computedNotSync, [computeQrl.dev ? computeQrl.dev.file : "", computeQrl.$hash$]);
1869
1889
  }
1870
- this.$invalid$ = false;
1890
+ this.$flags$ &= ~SignalFlags.INVALID;
1871
1891
  const didChange = untrackedValue !== this.$untrackedValue$;
1872
1892
  return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
1873
1893
  } finally {
@@ -1881,30 +1901,30 @@ class ComputedSignal extends Signal {
1881
1901
  throw qError(QError.computedReadOnly);
1882
1902
  }
1883
1903
  }
1884
- class WrappedSignal extends (_c = Signal, _b = _EFFECT_BACK_REF, _c) {
1885
- constructor(container, fn, args, fnStr) {
1904
+ class WrappedSignal extends (_e = Signal, _d = _EFFECT_BACK_REF, _e) {
1905
+ constructor(container, fn, args, fnStr, flags = SignalFlags.INVALID | WrappedSignalFlags.UNWRAP) {
1886
1906
  super(container, NEEDS_COMPUTATION);
1887
1907
  __publicField(this, "$args$");
1888
1908
  __publicField(this, "$func$");
1889
1909
  __publicField(this, "$funcStr$");
1890
- __publicField(this, "$invalid$", true);
1910
+ __publicField(this, "$flags$");
1891
1911
  __publicField(this, "$hostElement$", null);
1892
1912
  __publicField(this, "$forceRunEffects$", false);
1893
- __publicField(this, _b, null);
1894
- this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr;
1913
+ __publicField(this, _d, null);
1914
+ this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr, this.$flags$ = flags;
1895
1915
  }
1896
1916
  $invalidate$() {
1897
- this.$invalid$ = true, this.$forceRunEffects$ = false, this.$container$?.$scheduler$(ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, this.$hostElement$, this);
1917
+ this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = false, this.$container$?.$scheduler$(ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, this.$hostElement$, this);
1898
1918
  }
1899
1919
  force() {
1900
- this.$invalid$ = true, this.$forceRunEffects$ = false, triggerEffects(this.$container$, this, this.$effects$);
1920
+ this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = false, triggerEffects(this.$container$, this, this.$effects$);
1901
1921
  }
1902
1922
  get untrackedValue() {
1903
1923
  const didChange = this.$computeIfNeeded$();
1904
1924
  return didChange && (this.$forceRunEffects$ = didChange), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION), this.$untrackedValue$;
1905
1925
  }
1906
1926
  $computeIfNeeded$() {
1907
- if (!this.$invalid$) {
1927
+ if (!(this.$flags$ & SignalFlags.INVALID)) {
1908
1928
  return false;
1909
1929
  }
1910
1930
  const untrackedValue = trackSignal(() => this.$func$(...this.$args$), this, EffectProperty.VNODE, this.$container$);
@@ -1918,7 +1938,7 @@ class WrappedSignal extends (_c = Signal, _b = _EFFECT_BACK_REF, _c) {
1918
1938
  throw qError(QError.wrappedReadOnly);
1919
1939
  }
1920
1940
  }
1921
- const version = "2.0.0-alpha.7-dev+a26598a";
1941
+ const version = "2.0.0-alpha.8-dev+66037b5";
1922
1942
  class _SharedContainer {
1923
1943
  constructor(scheduleDrain, journalFlush, serverData, locale) {
1924
1944
  __publicField(this, "$version$");
@@ -1994,7 +2014,7 @@ class PropsProxyHandler {
1994
2014
  return this.$children$;
1995
2015
  }
1996
2016
  const value = this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] : this.$varProps$[prop];
1997
- return value instanceof WrappedSignal ? value.value : value;
2017
+ return value instanceof WrappedSignal && value.$flags$ & WrappedSignalFlags.UNWRAP ? value.value : value;
1998
2018
  }
1999
2019
  set(_, prop, value) {
2000
2020
  return prop === _CONST_PROPS ? (this.$constProps$ = value, true) : prop === _VAR_PROPS ? (this.$varProps$ = value, true) : (this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] = value : this.$varProps$[prop] = value, true);
@@ -2134,8 +2154,8 @@ const VNodeDataChar = {
2134
2154
  ID_CHAR: "=",
2135
2155
  PROPS: 62,
2136
2156
  PROPS_CHAR: ">",
2137
- SLOT_REF: 63,
2138
- SLOT_REF_CHAR: "?",
2157
+ SLOT_PARENT: 63,
2158
+ SLOT_PARENT_CHAR: "?",
2139
2159
  KEY: 64,
2140
2160
  KEY_CHAR: "@",
2141
2161
  SEQ: 91,
@@ -2199,6 +2219,9 @@ const vnode_isTextVNode = (vNode) => {
2199
2219
  const vnode_isVirtualVNode = (vNode) => {
2200
2220
  return (vNode[VNodeProps.flags] & VNodeFlags.Virtual) === VNodeFlags.Virtual;
2201
2221
  };
2222
+ const vnode_isProjection = (vNode) => {
2223
+ return (vNode[VNodeProps.flags] & VNodeFlags.Virtual) === VNodeFlags.Virtual && null !== vnode_getProp(vNode, QSlot, null);
2224
+ };
2202
2225
  const ensureTextVNode = (vNode) => (assertTrue(vnode_isTextVNode(vNode), "Expecting TextVNode was: " + vnode_getNodeTypeName(vNode)), vNode);
2203
2226
  const ensureElementOrVirtualVNode = (vNode) => {
2204
2227
  assertTrue(!!(vNode[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK), "Expecting ElementVNode or VirtualVNode was: " + vnode_getNodeTypeName(vNode));
@@ -2447,7 +2470,7 @@ const vnode_applyJournal = (journal) => {
2447
2470
  let key = journal[idx++];
2448
2471
  "className" === key && (key = "class");
2449
2472
  const value = journal[idx++];
2450
- isBooleanAttr(element, key) ? element[key] = parseBoolean(value) : "value" === key && key in element ? element.value = escapeHTML(String(value)) : key === dangerouslySetInnerHTML ? element.innerHTML = value : null == value || false === value ? element.removeAttribute(key) : element.setAttribute(key, String(value));
2473
+ isBooleanAttr(element, key) ? element[key] = parseBoolean(value) : "value" === key && key in element ? element.value = String(value) : key === dangerouslySetInnerHTML ? element.innerHTML = value : null == value || false === value ? element.removeAttribute(key) : element.setAttribute(key, String(value));
2451
2474
  break;
2452
2475
  case VNodeJournalOpCode.HoistStyles:
2453
2476
  const document2 = journal[idx++];
@@ -2800,8 +2823,6 @@ function materializeFromVNodeData(vParent, vData, element, child) {
2800
2823
  container.$setRawState$(parseInt(id), vParent);
2801
2824
  } else if (peek() === VNodeDataChar.PROPS) {
2802
2825
  vnode_setAttr(null, vParent, "q:props", consumeValue());
2803
- } else if (peek() === VNodeDataChar.SLOT_REF) {
2804
- vnode_setAttr(null, vParent, "q:sref", consumeValue());
2805
2826
  } else if (peek() === VNodeDataChar.KEY) {
2806
2827
  vnode_setAttr(null, vParent, "q:key", consumeValue());
2807
2828
  } else if (peek() === VNodeDataChar.SEQ) {
@@ -2810,6 +2831,8 @@ function materializeFromVNodeData(vParent, vData, element, child) {
2810
2831
  vnode_setAttr(null, vParent, "q:seqIdx", consumeValue());
2811
2832
  } else if (peek() === VNodeDataChar.BACK_REFS) {
2812
2833
  container || (container = getDomContainer(element)), setEffectBackRefFromVNodeData(vParent, consumeValue(), container);
2834
+ } else if (peek() === VNodeDataChar.SLOT_PARENT) {
2835
+ vnode_setProp(vParent, "q:sparent", consumeValue());
2813
2836
  } else if (peek() === VNodeDataChar.CONTEXT) {
2814
2837
  vnode_setAttr(null, vParent, "q:ctx", consumeValue());
2815
2838
  } else if (peek() === VNodeDataChar.OPEN) {
@@ -2853,7 +2876,7 @@ const vnode_getProjectionParentComponent = (vHost, rootVNode) => {
2853
2876
  let projectionDepth = 1;
2854
2877
  for (; projectionDepth--; ) {
2855
2878
  for (; vHost && (!vnode_isVirtualVNode(vHost) || null === vnode_getProp(vHost, "q:renderFn", null)); ) {
2856
- const qSlotParent = vnode_getProp(vHost, ":", (id) => vnode_locate(rootVNode, id));
2879
+ const qSlotParent = vnode_getProp(vHost, "q:sparent", (id) => vnode_locate(rootVNode, id));
2857
2880
  const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
2858
2881
  vProjectionParent && projectionDepth++, vHost = vProjectionParent || vnode_getParent(vHost);
2859
2882
  }
@@ -3199,7 +3222,7 @@ class DomContainer extends _SharedContainer {
3199
3222
  if (null !== vnode_getProp(vNode, "q:renderFn", null)) {
3200
3223
  return vNode;
3201
3224
  }
3202
- vNode = vnode_getParent(vNode) || vnode_getProp(vNode, ":", this.vNodeLocate);
3225
+ vNode = vnode_getParent(vNode) || vnode_getProp(vNode, "q:sparent", this.vNodeLocate);
3203
3226
  } else {
3204
3227
  vNode = vnode_getParent(vNode);
3205
3228
  }
@@ -3399,13 +3422,13 @@ const inflate = (container, target, typeId, data) => {
3399
3422
  case TypeIds.WrappedSignal: {
3400
3423
  const signal = target;
3401
3424
  const d = data;
3402
- signal.$func$ = container.getSyncFn(d[0]), signal.$args$ = d[1], signal[_EFFECT_BACK_REF] = d[2], signal.$untrackedValue$ = d[3], signal.$hostElement$ = d[4], signal.$effects$ = new Set(d.slice(5));
3425
+ signal.$func$ = container.getSyncFn(d[0]), signal.$args$ = d[1], signal[_EFFECT_BACK_REF] = d[2], signal.$untrackedValue$ = d[3], signal.$flags$ = d[4], signal.$hostElement$ = d[5], signal.$effects$ = new Set(d.slice(6));
3403
3426
  break;
3404
3427
  }
3405
3428
  case TypeIds.ComputedSignal: {
3406
3429
  const computed = target;
3407
3430
  const d = data;
3408
- computed.$computeQrl$ = d[0], computed.$effects$ = d[1], 3 === d.length ? computed.$untrackedValue$ = d[2] : (computed.$invalid$ = true, computed.$computeQrl$.resolve(), container.$scheduler$?.(ChoreType.QRL_RESOLVE, null, computed.$computeQrl$));
3431
+ computed.$computeQrl$ = d[0], computed.$effects$ = d[1], 3 === d.length ? computed.$untrackedValue$ = d[2] : (computed.$flags$ |= SignalFlags.INVALID, computed.$computeQrl$.resolve(), container.$scheduler$?.(ChoreType.QRL_RESOLVE, null, computed.$computeQrl$));
3409
3432
  break;
3410
3433
  }
3411
3434
  case TypeIds.Error: {
@@ -3481,7 +3504,7 @@ const inflate = (container, target, typeId, data) => {
3481
3504
  }
3482
3505
  return target;
3483
3506
  };
3484
- const _constants = [void 0, null, true, false, "", EMPTY_ARRAY, EMPTY_OBJ, NEEDS_COMPUTATION, STORE_ARRAY_PROP, Slot, Fragment, NaN, 1 / 0, -1 / 0, Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER - 1, Number.MIN_SAFE_INTEGER];
3507
+ const _constants = [void 0, null, true, false, "", EMPTY_ARRAY, EMPTY_OBJ, NEEDS_COMPUTATION, STORE_ALL_PROPS, Slot, Fragment, NaN, 1 / 0, -1 / 0, Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER - 1, Number.MIN_SAFE_INTEGER];
3485
3508
  const allocate = (container, typeId, value) => {
3486
3509
  if (void 0 === value) {
3487
3510
  return typeId;
@@ -3678,8 +3701,8 @@ const createSerializationContext = (NodeConstructor, DomRefConstructor, symbolTo
3678
3701
  discoveredValues.push(k, v);
3679
3702
  });
3680
3703
  } else if (obj instanceof Signal) {
3681
- const v = obj instanceof WrappedSignal ? obj.untrackedValue : obj instanceof ComputedSignal && (obj.$invalid$ || fastSkipSerialize(obj)) ? NEEDS_COMPUTATION : obj.$untrackedValue$;
3682
- v !== NEEDS_COMPUTATION && discoveredValues.push(v), obj.$effects$ && discoveredValues.push(...obj.$effects$), obj instanceof WrappedSignal ? (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues), obj.$args$ && discoveredValues.push(...obj.$args$), obj.$hostElement$ && discoveredValues.push(obj.$hostElement$)) : obj instanceof ComputedSignal && discoveredValues.push(obj.$computeQrl$);
3704
+ const v = obj instanceof WrappedSignal ? obj.untrackedValue : obj instanceof ComputedSignal && (obj.$flags$ & SignalFlags.INVALID || fastSkipSerialize(obj)) ? NEEDS_COMPUTATION : obj.$untrackedValue$;
3705
+ v !== NEEDS_COMPUTATION && discoveredValues.push(v), obj.$effects$ && discoveredValues.push(obj.$effects$), obj instanceof WrappedSignal ? (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues), obj.$args$ && discoveredValues.push(...obj.$args$), obj.$hostElement$ && discoveredValues.push(obj.$hostElement$)) : obj instanceof ComputedSignal && (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues), discoveredValues.push(obj.$computeQrl$));
3683
3706
  } else if (obj instanceof Task) {
3684
3707
  discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$), discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues);
3685
3708
  } else if (isSsrNode2(obj)) {
@@ -3752,16 +3775,7 @@ const discoverValuesForVNodeData = (vnodeData, discoveredValues) => {
3752
3775
  }
3753
3776
  };
3754
3777
  const discoverEffectBackRefs = (effectsBackRefs, discoveredValues) => {
3755
- if (effectsBackRefs) {
3756
- let hasBackRefs = false;
3757
- for (const [, effect] of effectsBackRefs) {
3758
- if (effect[EffectSubscriptionProp.BACK_REF]) {
3759
- hasBackRefs = true;
3760
- break;
3761
- }
3762
- }
3763
- hasBackRefs && discoveredValues.push(effectsBackRefs);
3764
- }
3778
+ effectsBackRefs && discoveredValues.push(effectsBackRefs);
3765
3779
  };
3766
3780
  const promiseResults = /* @__PURE__ */ new WeakMap();
3767
3781
  function serialize(serializationContext) {
@@ -3826,10 +3840,10 @@ function serialize(serializationContext) {
3826
3840
  } else if (value === NEEDS_COMPUTATION) {
3827
3841
  output(TypeIds.Constant, Constants.NEEDS_COMPUTATION);
3828
3842
  } else {
3829
- if (value !== STORE_ARRAY_PROP) {
3843
+ if (value !== STORE_ALL_PROPS) {
3830
3844
  throw qError(QError.serializeErrorUnknownType, [typeof value]);
3831
3845
  }
3832
- output(TypeIds.Constant, Constants.STORE_ARRAY_PROP);
3846
+ output(TypeIds.Constant, Constants.STORE_ALL_PROPS);
3833
3847
  }
3834
3848
  };
3835
3849
  const writeObjectValue = (value, idx) => {
@@ -3887,9 +3901,9 @@ function serialize(serializationContext) {
3887
3901
  } else if ($isDomRef$(value)) {
3888
3902
  value.$ssrNode$.vnodeData[0] |= VNodeDataFlag.SERIALIZE, output(TypeIds.RefVNode, value.$ssrNode$.id);
3889
3903
  } else if (value instanceof Signal) {
3890
- const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
3904
+ const v = value instanceof ComputedSignal && (value.$flags$ & SignalFlags.INVALID || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
3891
3905
  if (value instanceof WrappedSignal) {
3892
- output(TypeIds.WrappedSignal, [...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), v, value.$hostElement$, ...value.$effects$ || []]);
3906
+ output(TypeIds.WrappedSignal, [...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), v, value.$flags$, value.$hostElement$, ...value.$effects$ || []]);
3893
3907
  } else if (value instanceof ComputedSignal) {
3894
3908
  const out = [value.$computeQrl$, value.$effects$];
3895
3909
  v !== NEEDS_COMPUTATION && out.push(v), output(TypeIds.ComputedSignal, out);
@@ -4033,7 +4047,7 @@ var Constants;
4033
4047
  !function(TypeIds2) {
4034
4048
  TypeIds2[TypeIds2.RootRef = 0] = "RootRef", TypeIds2[TypeIds2.Constant = 1] = "Constant", TypeIds2[TypeIds2.Number = 2] = "Number", TypeIds2[TypeIds2.String = 3] = "String", TypeIds2[TypeIds2.Array = 4] = "Array", TypeIds2[TypeIds2.URL = 5] = "URL", TypeIds2[TypeIds2.Date = 6] = "Date", TypeIds2[TypeIds2.Regex = 7] = "Regex", TypeIds2[TypeIds2.VNode = 8] = "VNode", TypeIds2[TypeIds2.RefVNode = 9] = "RefVNode", TypeIds2[TypeIds2.BigInt = 10] = "BigInt", TypeIds2[TypeIds2.URLSearchParams = 11] = "URLSearchParams", TypeIds2[TypeIds2.Error = 12] = "Error", TypeIds2[TypeIds2.Object = 13] = "Object", TypeIds2[TypeIds2.Promise = 14] = "Promise", TypeIds2[TypeIds2.Set = 15] = "Set", TypeIds2[TypeIds2.Map = 16] = "Map", TypeIds2[TypeIds2.Uint8Array = 17] = "Uint8Array", TypeIds2[TypeIds2.QRL = 18] = "QRL", TypeIds2[TypeIds2.Task = 19] = "Task", TypeIds2[TypeIds2.Resource = 20] = "Resource", TypeIds2[TypeIds2.Component = 21] = "Component", TypeIds2[TypeIds2.Signal = 22] = "Signal", TypeIds2[TypeIds2.WrappedSignal = 23] = "WrappedSignal", TypeIds2[TypeIds2.ComputedSignal = 24] = "ComputedSignal", TypeIds2[TypeIds2.Store = 25] = "Store", TypeIds2[TypeIds2.StoreArray = 26] = "StoreArray", TypeIds2[TypeIds2.FormData = 27] = "FormData", TypeIds2[TypeIds2.JSXNode = 28] = "JSXNode", TypeIds2[TypeIds2.PropsProxy = 29] = "PropsProxy", TypeIds2[TypeIds2.EffectData = 30] = "EffectData";
4035
4049
  }(TypeIds || (TypeIds = {})), function(Constants2) {
4036
- Constants2[Constants2.Undefined = 0] = "Undefined", Constants2[Constants2.Null = 1] = "Null", Constants2[Constants2.True = 2] = "True", Constants2[Constants2.False = 3] = "False", Constants2[Constants2.EmptyString = 4] = "EmptyString", Constants2[Constants2.EMPTY_ARRAY = 5] = "EMPTY_ARRAY", Constants2[Constants2.EMPTY_OBJ = 6] = "EMPTY_OBJ", Constants2[Constants2.NEEDS_COMPUTATION = 7] = "NEEDS_COMPUTATION", Constants2[Constants2.STORE_ARRAY_PROP = 8] = "STORE_ARRAY_PROP", Constants2[Constants2.Slot = 9] = "Slot", Constants2[Constants2.Fragment = 10] = "Fragment", Constants2[Constants2.NaN = 11] = "NaN", Constants2[Constants2.PositiveInfinity = 12] = "PositiveInfinity", Constants2[Constants2.NegativeInfinity = 13] = "NegativeInfinity", Constants2[Constants2.MaxSafeInt = 14] = "MaxSafeInt", Constants2[Constants2.AlmostMaxSafeInt = 15] = "AlmostMaxSafeInt", Constants2[Constants2.MinSafeInt = 16] = "MinSafeInt";
4050
+ Constants2[Constants2.Undefined = 0] = "Undefined", Constants2[Constants2.Null = 1] = "Null", Constants2[Constants2.True = 2] = "True", Constants2[Constants2.False = 3] = "False", Constants2[Constants2.EmptyString = 4] = "EmptyString", Constants2[Constants2.EMPTY_ARRAY = 5] = "EMPTY_ARRAY", Constants2[Constants2.EMPTY_OBJ = 6] = "EMPTY_OBJ", Constants2[Constants2.NEEDS_COMPUTATION = 7] = "NEEDS_COMPUTATION", Constants2[Constants2.STORE_ALL_PROPS = 8] = "STORE_ALL_PROPS", Constants2[Constants2.Slot = 9] = "Slot", Constants2[Constants2.Fragment = 10] = "Fragment", Constants2[Constants2.NaN = 11] = "NaN", Constants2[Constants2.PositiveInfinity = 12] = "PositiveInfinity", Constants2[Constants2.NegativeInfinity = 13] = "NegativeInfinity", Constants2[Constants2.MaxSafeInt = 14] = "MaxSafeInt", Constants2[Constants2.AlmostMaxSafeInt = 15] = "AlmostMaxSafeInt", Constants2[Constants2.MinSafeInt = 16] = "MinSafeInt";
4037
4051
  }(Constants || (Constants = {}));
4038
4052
  const noSerializeSet = /* @__PURE__ */ new WeakSet();
4039
4053
  const fastSkipSerialize = (obj) => noSerializeSet.has(obj);