@qwik.dev/core 2.0.0-beta.14 → 2.0.0-beta.15

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 2.0.0-beta.14-dev+1e7496d
3
+ * @qwik.dev/core 2.0.0-beta.15-dev+920f1a4
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
@@ -11,7 +11,7 @@ export { isBrowser, isDev, isServer } from "@qwik.dev/core/build";
11
11
 
12
12
  import { p } from "@qwik.dev/core/preloader";
13
13
 
14
- const version = "2.0.0-beta.14-dev+1e7496d";
14
+ const version = "2.0.0-beta.15-dev+920f1a4";
15
15
 
16
16
  const qDev = !1;
17
17
 
@@ -178,8 +178,6 @@ const ELEMENT_SEQ = "q:seq";
178
178
 
179
179
  const ELEMENT_SEQ_IDX = "q:seqIdx";
180
180
 
181
- const Q_PREFIX = "q:";
182
-
183
181
  const NON_SERIALIZABLE_MARKER_PREFIX = ":";
184
182
 
185
183
  const USE_ON_LOCAL = ":on";
@@ -608,14 +606,14 @@ const STORE_ALL_PROPS = Symbol("store.all");
608
606
 
609
607
  class SignalImpl {
610
608
  $untrackedValue$;
611
- $effects$=null;
609
+ $effects$=void 0;
612
610
  $container$=null;
613
611
  $wrappedSignal$=null;
614
612
  constructor(container, value) {
615
613
  this.$container$ = container, this.$untrackedValue$ = value;
616
614
  }
617
615
  force() {
618
- this.$container$?.$scheduler$(7, null, this, this.$effects$);
616
+ this.$container$?.$scheduler$(7, void 0, this, this.$effects$);
619
617
  }
620
618
  get untrackedValue() {
621
619
  return this.$untrackedValue$;
@@ -627,7 +625,7 @@ class SignalImpl {
627
625
  return setupSignalValueAccess(this, () => this.$effects$ ||= new Set, () => this.untrackedValue);
628
626
  }
629
627
  set value(value) {
630
- value !== this.$untrackedValue$ && (this.$untrackedValue$ = value, this.$container$?.$scheduler$(7, null, this, this.$effects$));
628
+ value !== this.$untrackedValue$ && (this.$untrackedValue$ = value, this.$container$?.$scheduler$(7, void 0, this, this.$effects$));
631
629
  }
632
630
  valueOf() {
633
631
  qDev;
@@ -670,6 +668,8 @@ const _VAR_PROPS = Symbol("VAR");
670
668
 
671
669
  const _OWNER = Symbol("OWNER");
672
670
 
671
+ const _PROPS_HANDLER = Symbol("PROPS_HANDLER");
672
+
673
673
  const _IMMUTABLE = Symbol("IMMUTABLE");
674
674
 
675
675
  const _UNINITIALIZED = Symbol("UNINITIALIZED");
@@ -709,6 +709,13 @@ const fromCamelToKebabCase = text => text.replace(/([A-Z-])/g, a => "-" + a.toLo
709
709
 
710
710
  const getEventDataFromHtmlAttribute = htmlKey => htmlKey.startsWith("on:") ? [ "", htmlKey.substring(3) ] : htmlKey.startsWith("on-window:") ? [ "window", htmlKey.substring(10) ] : [ "document", htmlKey.substring(12) ];
711
711
 
712
+ const getScopedEventName = (scope, eventName) => {
713
+ const suffix = ":" + eventName;
714
+ return scope ? scope + suffix : suffix;
715
+ };
716
+
717
+ const getLoaderScopedEventName = (scope, scopedEvent) => scope ? "-" + scopedEvent : scopedEvent;
718
+
712
719
  const EMPTY_ARRAY = [];
713
720
 
714
721
  const EMPTY_OBJ = {};
@@ -721,6 +728,8 @@ Object.freeze(EMPTY_ARRAY), Object.freeze(EMPTY_OBJ);
721
728
 
722
729
  class PropsProxyHandler {
723
730
  owner;
731
+ $effects$=void 0;
732
+ $container$=null;
724
733
  constructor(owner) {
725
734
  this.owner = owner;
726
735
  }
@@ -734,6 +743,9 @@ class PropsProxyHandler {
734
743
  if (prop === _OWNER) {
735
744
  return this.owner;
736
745
  }
746
+ if (prop === _PROPS_HANDLER) {
747
+ return this;
748
+ }
737
749
  let value;
738
750
  if ("children" === prop) {
739
751
  value = this.owner.children;
@@ -742,7 +754,7 @@ class PropsProxyHandler {
742
754
  const attr = jsxEventToHtmlAttribute(prop);
743
755
  attr && (prop = attr);
744
756
  }
745
- value = directGetPropsProxyProp(this.owner, prop);
757
+ value = directGetPropsProxyProp(this.owner, prop), prop in this.owner.varProps && addPropsProxyEffect(this, prop);
746
758
  }
747
759
  return value instanceof WrappedSignalImpl && 4 & value.$flags$ ? value.value : value;
748
760
  }
@@ -751,6 +763,10 @@ class PropsProxyHandler {
751
763
  this.owner = value;
752
764
  } else if ("children" === prop) {
753
765
  this.owner.children = value;
766
+ } else if (prop === _CONST_PROPS) {
767
+ this.owner.constProps = value;
768
+ } else if (prop === _VAR_PROPS) {
769
+ this.owner.varProps = value;
754
770
  } else {
755
771
  if ("string" == typeof prop && "string" == typeof this.owner.type) {
756
772
  const attr = jsxEventToHtmlAttribute(prop);
@@ -758,13 +774,13 @@ class PropsProxyHandler {
758
774
  }
759
775
  this.owner.constProps && prop in this.owner.constProps && delete this.owner.constProps[prop],
760
776
  this.owner.varProps === EMPTY_OBJ ? this.owner.varProps = {} : prop in this.owner.varProps || (this.owner.toSort = !0),
761
- this.owner.varProps[prop] = value;
777
+ this.owner.varProps[prop] !== value && (this.owner.varProps[prop] = value, triggerPropsProxyEffect(this, prop));
762
778
  }
763
779
  return !0;
764
780
  }
765
781
  deleteProperty(_, prop) {
766
782
  let didDelete = delete this.owner.varProps[prop];
767
- return this.owner.constProps && (didDelete = delete this.owner.constProps[prop] || didDelete),
783
+ return didDelete && triggerPropsProxyEffect(this, prop), this.owner.constProps && (didDelete = delete this.owner.constProps[prop] || didDelete),
768
784
  null != this.owner.children && "children" === prop && (this.owner.children = null,
769
785
  didDelete = !0), didDelete;
770
786
  }
@@ -775,11 +791,12 @@ class PropsProxyHandler {
775
791
  if (prop === _CONST_PROPS || prop === _VAR_PROPS) {
776
792
  return !0;
777
793
  }
778
- if ("string" == typeof prop && "string" == typeof this.owner.type) {
794
+ const inVarProps = prop in this.owner.varProps;
795
+ if ("string" == typeof prop && (inVarProps && addPropsProxyEffect(this, prop), "string" == typeof this.owner.type)) {
779
796
  const attr = jsxEventToHtmlAttribute(prop);
780
797
  attr && (prop = attr);
781
798
  }
782
- return prop in this.owner.varProps || !!this.owner.constProps && prop in this.owner.constProps;
799
+ return inVarProps || !!this.owner.constProps && prop in this.owner.constProps;
783
800
  }
784
801
  getOwnPropertyDescriptor(_, p) {
785
802
  return {
@@ -799,6 +816,22 @@ class PropsProxyHandler {
799
816
  }
800
817
  }
801
818
 
819
+ const addPropsProxyEffect = (propsProxy, prop) => {
820
+ const ctx = tryGetInvokeContext();
821
+ ctx && (null === propsProxy.$container$ ? ctx.$container$ && (propsProxy.$container$ = ctx.$container$) : assertTrue(!ctx.$container$ || ctx.$container$ === propsProxy.$container$, "Do not use props across containers"));
822
+ const effectSubscriber = ctx?.$effectSubscriber$;
823
+ effectSubscriber && addStoreEffect(propsProxy.owner._proxy, prop, propsProxy, effectSubscriber);
824
+ };
825
+
826
+ const triggerPropsProxyEffect = (propsProxy, prop) => {
827
+ const effects = getEffects$1(propsProxy.$effects$, prop);
828
+ effects && propsProxy.$container$?.$scheduler$(7, void 0, propsProxy, effects);
829
+ };
830
+
831
+ function getEffects$1(effects, prop) {
832
+ return effects?.get(prop);
833
+ }
834
+
802
835
  const directGetPropsProxyProp = (jsx, prop) => jsx.constProps && prop in jsx.constProps ? jsx.constProps[prop] : jsx.varProps[prop];
803
836
 
804
837
  const _getVarProps = props => props ? _VAR_PROPS in props ? "children" in props ? {
@@ -878,12 +911,12 @@ const log = (...args) => console.log("COMPUTED SIGNAL", ...args.map(qwikDebugToS
878
911
  class ComputedSignalImpl extends SignalImpl {
879
912
  $computeQrl$;
880
913
  $flags$;
881
- [_EFFECT_BACK_REF]=null;
914
+ [_EFFECT_BACK_REF]=void 0;
882
915
  constructor(container, fn, flags = 33) {
883
916
  super(container, NEEDS_COMPUTATION), this.$computeQrl$ = fn, this.$flags$ = flags;
884
917
  }
885
918
  invalidate() {
886
- this.$flags$ |= 1, this.$container$?.$scheduler$(7, null, this, this.$effects$);
919
+ this.$flags$ |= 1, this.$container$?.$scheduler$(7, void 0, this, this.$effects$);
887
920
  }
888
921
  force() {
889
922
  this.$flags$ |= 2, super.force();
@@ -923,13 +956,13 @@ class ComputedSignalImpl extends SignalImpl {
923
956
 
924
957
  class AsyncComputedSignalImpl extends ComputedSignalImpl {
925
958
  $untrackedLoading$=!1;
926
- $untrackedError$=null;
927
- $loadingEffects$=null;
928
- $errorEffects$=null;
959
+ $untrackedError$=void 0;
960
+ $loadingEffects$=void 0;
961
+ $errorEffects$=void 0;
929
962
  $destroy$;
930
963
  $promiseValue$=NEEDS_COMPUTATION;
931
964
  $promise$=null;
932
- [_EFFECT_BACK_REF]=null;
965
+ [_EFFECT_BACK_REF]=void 0;
933
966
  constructor(container, fn, flags = 1) {
934
967
  super(container, fn, flags);
935
968
  }
@@ -937,7 +970,7 @@ class AsyncComputedSignalImpl extends ComputedSignalImpl {
937
970
  return setupSignalValueAccess(this, () => this.$loadingEffects$ ||= new Set, () => this.untrackedLoading);
938
971
  }
939
972
  set untrackedLoading(value) {
940
- value !== this.$untrackedLoading$ && (this.$untrackedLoading$ = value, this.$container$?.$scheduler$(7, null, this, this.$loadingEffects$));
973
+ value !== this.$untrackedLoading$ && (this.$untrackedLoading$ = value, this.$container$?.$scheduler$(7, void 0, this, this.$loadingEffects$));
941
974
  }
942
975
  get untrackedLoading() {
943
976
  return this.$untrackedLoading$;
@@ -946,7 +979,7 @@ class AsyncComputedSignalImpl extends ComputedSignalImpl {
946
979
  return setupSignalValueAccess(this, () => this.$errorEffects$ ||= new Set, () => this.untrackedError);
947
980
  }
948
981
  set untrackedError(value) {
949
- value !== this.$untrackedError$ && (this.$untrackedError$ = value, this.$container$?.$scheduler$(7, null, this, this.$errorEffects$));
982
+ value !== this.$untrackedError$ && (this.$untrackedError$ = value, this.$container$?.$scheduler$(7, void 0, this, this.$errorEffects$));
950
983
  }
951
984
  get untrackedError() {
952
985
  return this.$untrackedError$;
@@ -965,9 +998,9 @@ class AsyncComputedSignalImpl extends ComputedSignalImpl {
965
998
  const untrackedValue = this.$promiseValue$ === NEEDS_COMPUTATION || null === this.$promise$ ? this.$promiseComputation$() : this.$promiseValue$;
966
999
  if (isPromise(untrackedValue)) {
967
1000
  const isFirstComputation = this.$promiseValue$ === NEEDS_COMPUTATION;
968
- this.untrackedLoading = !0, this.untrackedError = null, this.$promiseValue$ !== NEEDS_COMPUTATION && cleanupDestroyable(this);
1001
+ this.untrackedLoading = !0, this.untrackedError = void 0, this.$promiseValue$ !== NEEDS_COMPUTATION && cleanupDestroyable(this);
969
1002
  const promise = untrackedValue.then(promiseValue => {
970
- this.$promiseValue$ = promiseValue, this.untrackedLoading = !1, this.untrackedError = null,
1003
+ this.$promiseValue$ = promiseValue, this.untrackedLoading = !1, this.untrackedError = void 0,
971
1004
  this.setValue(promiseValue) && scheduleEffects(this.$container$, this, this.$effects$);
972
1005
  }).catch(err => {
973
1006
  isPromise(err) || (this.$promiseValue$ = err, this.untrackedLoading = !1, this.untrackedError = err);
@@ -1056,19 +1089,24 @@ const _wrapProp = (...args) => {
1056
1089
  }
1057
1090
  if (isPropsProxy(obj)) {
1058
1091
  const constProps = obj[_CONST_PROPS];
1092
+ const varProps = obj[_VAR_PROPS];
1059
1093
  if (constProps && prop in constProps) {
1060
1094
  return constProps[prop];
1061
1095
  }
1096
+ if (prop in varProps) {
1097
+ return wrapIfNotSignal(varProps[prop], args);
1098
+ }
1062
1099
  } else {
1063
1100
  const target = getStoreTarget(obj);
1064
1101
  if (target) {
1065
- const value = target[prop];
1066
- return isSignal(value) ? value : getWrapped(args);
1102
+ return wrapIfNotSignal(target[prop], args);
1067
1103
  }
1068
1104
  }
1069
1105
  return obj[prop];
1070
1106
  };
1071
1107
 
1108
+ const wrapIfNotSignal = (value, args) => isSignal(value) ? value : getWrapped(args);
1109
+
1072
1110
  const _wrapSignal = (obj, prop) => {
1073
1111
  const r = _wrapProp(obj, prop);
1074
1112
  return r === _IMMUTABLE ? obj[prop] : r;
@@ -1079,8 +1117,8 @@ class WrappedSignalImpl extends SignalImpl {
1079
1117
  $func$;
1080
1118
  $funcStr$;
1081
1119
  $flags$;
1082
- $hostElement$=null;
1083
- [_EFFECT_BACK_REF]=null;
1120
+ $hostElement$=void 0;
1121
+ [_EFFECT_BACK_REF]=void 0;
1084
1122
  constructor(container, fn, args, fnStr, flags = 5) {
1085
1123
  super(container, NEEDS_COMPUTATION), this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr,
1086
1124
  this.$flags$ = flags;
@@ -1121,7 +1159,7 @@ class WrappedSignalImpl extends SignalImpl {
1121
1159
  }
1122
1160
 
1123
1161
  let BackRef$1 = class {
1124
- [_EFFECT_BACK_REF]=null;
1162
+ [_EFFECT_BACK_REF]=void 0;
1125
1163
  };
1126
1164
 
1127
1165
  function clearAllEffects(container, consumer) {
@@ -1131,6 +1169,7 @@ function clearAllEffects(container, consumer) {
1131
1169
  for (const [, effect] of effects) {
1132
1170
  clearEffectSubscription(container, effect);
1133
1171
  }
1172
+ effects.clear();
1134
1173
  }
1135
1174
  }
1136
1175
 
@@ -1142,17 +1181,20 @@ function clearEffectSubscription(container, effect) {
1142
1181
  clearSignal(container, producer, effect);
1143
1182
  } else if (producer instanceof AsyncComputedSignalImpl) {
1144
1183
  clearAsyncComputedSignal(producer, effect);
1184
+ } else if (isPropsProxy(producer)) {
1185
+ clearStoreOrProps(producer[_PROPS_HANDLER], effect);
1145
1186
  } else if (container.$storeProxyMap$.has(producer)) {
1146
1187
  const target = container.$storeProxyMap$.get(producer);
1147
- clearStore(getStoreHandler(target), effect);
1188
+ clearStoreOrProps(getStoreHandler(target), effect);
1148
1189
  }
1149
1190
  }
1191
+ backRefs.clear();
1150
1192
  }
1151
1193
  }
1152
1194
 
1153
1195
  function clearSignal(container, producer, effect) {
1154
1196
  const effects = producer.$effects$;
1155
- effects && effects.has(effect) && effects.delete(effect), producer instanceof WrappedSignalImpl && (producer.$hostElement$ = null,
1197
+ effects && effects.has(effect) && effects.delete(effect), producer instanceof WrappedSignalImpl && (producer.$hostElement$ = void 0,
1156
1198
  clearAllEffects(container, producer));
1157
1199
  }
1158
1200
 
@@ -1163,11 +1205,11 @@ function clearAsyncComputedSignal(producer, effect) {
1163
1205
  pendingEffects && pendingEffects.has(effect) && pendingEffects.delete(effect);
1164
1206
  }
1165
1207
 
1166
- function clearStore(producer, effect) {
1208
+ function clearStoreOrProps(producer, effect) {
1167
1209
  const effects = producer?.$effects$;
1168
1210
  if (effects) {
1169
- for (const [propKey, propEffects] of effects.entries()) {
1170
- propEffects.has(effect) && (propEffects.delete(effect), 0 === propEffects.size && effects.delete(propKey));
1211
+ for (const [prop, propEffects] of effects.entries()) {
1212
+ propEffects.has(effect) && (propEffects.delete(effect), 0 === propEffects.size && effects.delete(prop));
1171
1213
  }
1172
1214
  }
1173
1215
  }
@@ -1624,8 +1666,9 @@ const vnode_applyJournal = journal => {
1624
1666
  let key = journal[idx++];
1625
1667
  "className" === key && (key = "class");
1626
1668
  const value = journal[idx++];
1627
- isBooleanAttr(element, key) ? element[key] = parseBoolean(value) : "value" === key && key in element ? element.value = String(value) : key === dangerouslySetInnerHTML ? (element.innerHTML = value,
1628
- element.setAttribute("q:container", "html")) : null == value || !1 === value ? element.removeAttribute(key) : element.setAttribute(key, String(value));
1669
+ const shouldRemove = null == value || !1 === value;
1670
+ isBooleanAttr(element, key) ? element[key] = parseBoolean(value) : key === dangerouslySetInnerHTML ? (element.innerHTML = value,
1671
+ element.setAttribute("q:container", "html")) : shouldRemove ? element.removeAttribute(key) : "value" === key && key in element ? element.value = String(value) : element.setAttribute(key, String(value));
1629
1672
  break;
1630
1673
 
1631
1674
  case 3:
@@ -2083,7 +2126,8 @@ function materializeFromVNodeData(vParent, vData, element, child) {
2083
2126
  const nodeIsElement = isElement(node);
2084
2127
  return !nodeIsElement || nodeIsElement && shouldSkipElement(node);
2085
2128
  };
2086
- return processVNodeData$1(vData, (peek, consumeValue, consume, getChar, nextToConsumeIdx) => {
2129
+ let components = null;
2130
+ if (processVNodeData$1(vData, (peek, consumeValue, consume, getChar, nextToConsumeIdx) => {
2087
2131
  if (isNumber(peek())) {
2088
2132
  for (;shouldSkipNode(child); ) {
2089
2133
  if (!(child = fastNextSibling(child))) {
@@ -2101,7 +2145,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
2101
2145
  } else if (peek() === VNodeDataChar.SCOPED_STYLE) {
2102
2146
  vParent.setAttr("q:sstyle", consumeValue(), null);
2103
2147
  } else if (peek() === VNodeDataChar.RENDER_FN) {
2104
- vParent.setAttr("q:renderFn", consumeValue(), null);
2148
+ (components ||= []).push(vParent), vParent.setAttr("q:renderFn", consumeValue(), null);
2105
2149
  } else if (peek() === VNodeDataChar.ID) {
2106
2150
  container || (container = getDomContainer(element));
2107
2151
  const id = consumeValue();
@@ -2149,7 +2193,14 @@ function materializeFromVNodeData(vParent, vData, element, child) {
2149
2193
  addVNode(previousTextNode = vnode_newSharedText(previousTextNode, textNode, text)),
2150
2194
  textIdx += length;
2151
2195
  }
2152
- }), vParent.lastChild = vLast, vFirst;
2196
+ }), components) {
2197
+ container || (container = getDomContainer(element));
2198
+ for (const component of components) {
2199
+ container.ensureProjectionResolved(component);
2200
+ }
2201
+ components = null;
2202
+ }
2203
+ return vParent.lastChild = vLast, vFirst;
2153
2204
  }
2154
2205
 
2155
2206
  const vnode_getType = vnode => {
@@ -2494,8 +2545,8 @@ const _jsxSorted = (type, varProps, constProps, children, flags, key, dev) => un
2494
2545
  const _jsxSplit = (type, varProps, constProps, children, flags, key, dev) => untrack(() => {
2495
2546
  if (varProps) {
2496
2547
  for (const k in varProps) {
2497
- "children" === k ? (children ||= varProps.children, varProps.children = void 0) : "key" === k ? (key ||= varProps.key,
2498
- varProps.key = void 0) : constProps && k in constProps && (varProps[k] = void 0);
2548
+ "children" === k ? (children ||= varProps.children, delete varProps.children) : "key" === k ? (key ||= varProps.key,
2549
+ delete varProps.key) : constProps && k in constProps && delete varProps[k];
2499
2550
  }
2500
2551
  }
2501
2552
  return new JSXNodeImpl(type, varProps, constProps, children, key, !0, dev);
@@ -3324,8 +3375,8 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
3324
3375
  } else if (isSignal(jsxValue)) {
3325
3376
  expectVirtual("S", null);
3326
3377
  const unwrappedSignal = jsxValue instanceof WrappedSignalImpl ? jsxValue.$unwrapIfSignal$() : jsxValue;
3327
- const currentSignal = vCurrent?.[_EFFECT_BACK_REF]?.get(".")?.[0];
3328
- if (currentSignal !== unwrappedSignal) {
3378
+ const hasUnwrappedSignal = vCurrent?.[_EFFECT_BACK_REF]?.get(".")?.[2]?.has(unwrappedSignal);
3379
+ if (!hasUnwrappedSignal) {
3329
3380
  const vHost = vNewNode || vCurrent;
3330
3381
  descend(resolveSignalAndDescend(() => trackSignalAndAssignHost(unwrappedSignal, vHost, ".", container)), !0);
3331
3382
  }
@@ -3488,10 +3539,11 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
3488
3539
  if (isHtmlAttributeAnEventName(key)) {
3489
3540
  const data = getEventDataFromHtmlAttribute(key);
3490
3541
  if (data) {
3491
- const scope = data[0];
3492
- const eventName = data[1];
3493
- eventName && (vNewNode.setProp(HANDLER_PREFIX + ":" + scope + ":" + eventName, value),
3494
- scope && vNewNode.setAttr(key, "", journal), registerQwikLoaderEvent(eventName));
3542
+ const [scope, eventName] = data;
3543
+ const scopedEvent = getScopedEventName(scope, eventName);
3544
+ const loaderScopedEvent = getLoaderScopedEventName(scope, scopedEvent);
3545
+ eventName && (vNewNode.setProp(HANDLER_PREFIX + ":" + scopedEvent, value), scope && vNewNode.setAttr(key, "", journal),
3546
+ registerQwikLoaderEvent(loaderScopedEvent));
3495
3547
  }
3496
3548
  needsQDispatchEventPatch = !0;
3497
3549
  continue;
@@ -3578,10 +3630,14 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
3578
3630
  let srcIdx = 0;
3579
3631
  let dstIdx = 0;
3580
3632
  let patchEventDispatch = !1;
3581
- const setAttribute = (key, value, vHost) => {
3582
- vHost.setAttr(key, null !== value ? serializeAttribute(key, value, scopedStyleIdPrefix) : null, journal);
3633
+ const setAttributeDirect = (vnode, key, value, dstIdx, isNewKey) => {
3634
+ const serializedValue = null != value ? serializeAttribute(key, value, scopedStyleIdPrefix) : null;
3635
+ isNewKey ? null != serializedValue && (dstAttrs.splice(dstIdx, 0, key, serializedValue),
3636
+ journal.push(2, vnode.element, key, serializedValue)) : null != serializedValue ? (dstAttrs[dstIdx + 1] = serializedValue,
3637
+ journal.push(2, vnode.element, key, serializedValue)) : (dstAttrs.splice(dstIdx, 2),
3638
+ journal.push(2, vnode.element, key, null));
3583
3639
  };
3584
- const record = (key, value) => {
3640
+ const record = (key, value, dstIdx, isNewKey) => {
3585
3641
  if (key.startsWith(":")) {
3586
3642
  return void vnode.setProp(key, value);
3587
3643
  }
@@ -3610,42 +3666,48 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
3610
3666
  }
3611
3667
  if (isPromise(value)) {
3612
3668
  const vHost = vnode;
3613
- const attributePromise = value.then(resolvedValue => setAttribute(key, resolvedValue, vHost));
3669
+ const attributePromise = value.then(resolvedValue => {
3670
+ const idx = mapApp_findIndx(dstAttrs, key, 0);
3671
+ const isNewKey = idx < 0;
3672
+ setAttributeDirect(vHost, key, resolvedValue, isNewKey ? -1 ^ idx : idx, isNewKey);
3673
+ });
3614
3674
  return void asyncAttributePromises.push(attributePromise);
3615
3675
  }
3616
- setAttribute(key, value, vnode);
3676
+ setAttributeDirect(vnode, key, value, dstIdx, isNewKey);
3617
3677
  };
3618
3678
  const recordJsxEvent = (key, value) => {
3619
3679
  const data = getEventDataFromHtmlAttribute(key);
3620
3680
  if (data) {
3621
3681
  const [scope, eventName] = data;
3622
- record(":" + scope + ":" + eventName, value), registerQwikLoaderEvent(eventName),
3682
+ const scopedEvent = getScopedEventName(scope, eventName);
3683
+ const loaderScopedEvent = getLoaderScopedEventName(scope, scopedEvent);
3684
+ record(":" + scopedEvent, value, 0, !1), registerQwikLoaderEvent(loaderScopedEvent),
3623
3685
  patchEventDispatch = !0;
3624
3686
  }
3625
3687
  };
3626
3688
  for (;srcIdx < srcAttrs.length || dstIdx < dstAttrs.length; ) {
3627
3689
  const srcKey = srcIdx < srcAttrs.length ? srcAttrs[srcIdx] : void 0;
3628
3690
  const dstKey = dstIdx < dstAttrs.length ? dstAttrs[dstIdx] : void 0;
3629
- if (dstKey?.startsWith(HANDLER_PREFIX) || dstKey?.startsWith("q:")) {
3691
+ if (dstKey?.startsWith(HANDLER_PREFIX)) {
3630
3692
  dstIdx += 2;
3631
3693
  } else if (void 0 === srcKey) {
3632
- isHtmlAttributeAnEventName(dstKey) ? dstIdx += 2 : record(dstKey, null);
3694
+ isHtmlAttributeAnEventName(dstKey) ? dstIdx += 2 : record(dstKey, null, dstIdx, !1);
3633
3695
  } else if (void 0 === dstKey) {
3634
3696
  const srcValue = srcAttrs[srcIdx + 1];
3635
- isHtmlAttributeAnEventName(srcKey) ? recordJsxEvent(srcKey, srcValue) : record(srcKey, srcValue),
3697
+ isHtmlAttributeAnEventName(srcKey) ? recordJsxEvent(srcKey, srcValue) : record(srcKey, srcValue, dstIdx, !0),
3636
3698
  srcIdx += 2, dstIdx += 2;
3637
3699
  } else if (srcKey === dstKey) {
3638
3700
  const srcValue = srcAttrs[srcIdx + 1];
3639
3701
  const dstValue = dstAttrs[dstIdx + 1];
3640
3702
  const isEventHandler = isHtmlAttributeAnEventName(srcKey);
3641
- srcValue !== dstValue ? isEventHandler ? recordJsxEvent(srcKey, srcValue) : record(srcKey, srcValue) : isEventHandler && !vnode.element.qDispatchEvent && recordJsxEvent(srcKey, srcValue),
3703
+ srcValue !== dstValue ? isEventHandler ? recordJsxEvent(srcKey, srcValue) : record(srcKey, srcValue, dstIdx, !1) : isEventHandler && !vnode.element.qDispatchEvent && recordJsxEvent(srcKey, srcValue),
3642
3704
  srcIdx += 2, dstIdx += 2;
3643
3705
  } else if (srcKey < dstKey) {
3644
3706
  const srcValue = srcAttrs[srcIdx + 1];
3645
- isHtmlAttributeAnEventName(srcKey) ? recordJsxEvent(srcKey, srcValue) : record(srcKey, srcValue),
3707
+ isHtmlAttributeAnEventName(srcKey) ? recordJsxEvent(srcKey, srcValue) : record(srcKey, srcValue, dstIdx, !0),
3646
3708
  srcIdx += 2, dstIdx += 2;
3647
3709
  } else {
3648
- isHtmlAttributeAnEventName(dstKey) ? dstIdx += 2 : record(dstKey, null);
3710
+ isHtmlAttributeAnEventName(dstKey) ? dstIdx += 2 : record(dstKey, null, dstIdx, !1);
3649
3711
  }
3650
3712
  }
3651
3713
  return patchEventDispatch;
@@ -3776,13 +3838,9 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
3776
3838
  }), host = vNewNode || vCurrent;
3777
3839
  }
3778
3840
  if (host) {
3779
- let vNodeProps = host.getProp("q:props", container.$getObjectById$);
3780
- let propsAreDifferent = !1;
3781
- shouldRender || (propsAreDifferent = propsDiffer(jsxProps[_CONST_PROPS], vNodeProps?.[_CONST_PROPS]) || propsDiffer(jsxProps[_VAR_PROPS], vNodeProps?.[_VAR_PROPS]),
3782
- shouldRender = shouldRender || propsAreDifferent), shouldRender && (propsAreDifferent && (vNodeProps ? (vNodeProps[_CONST_PROPS] = jsxProps[_CONST_PROPS],
3783
- vNodeProps[_VAR_PROPS] = jsxProps[_VAR_PROPS], vNodeProps[_OWNER] = jsxProps[_OWNER]) : jsxProps && (host.setProp("q:props", jsxProps),
3784
- vNodeProps = jsxProps)), host.setProp("q:renderFn", componentQRL), host.flags &= -33,
3785
- container.$scheduler$(6, host, componentQRL, vNodeProps));
3841
+ const vNodeProps = host.getProp("q:props", container.$getObjectById$);
3842
+ shouldRender || (shouldRender ||= handleProps(host, jsxProps, vNodeProps, container)),
3843
+ shouldRender && (host.setProp("q:renderFn", componentQRL), host.flags &= -33, container.$scheduler$(6, host, componentQRL, vNodeProps));
3786
3844
  }
3787
3845
  !function(children, host) {
3788
3846
  const projectionChildren = Array.isArray(children) ? children : [ children ];
@@ -3872,7 +3930,23 @@ function getComponentHash(vNode, getObject) {
3872
3930
 
3873
3931
  function Projection() {}
3874
3932
 
3875
- function propsDiffer(src, dst) {
3933
+ function handleProps(host, jsxProps, vNodeProps, container) {
3934
+ let shouldRender = !1;
3935
+ let propsAreDifferent = !1;
3936
+ if (vNodeProps) {
3937
+ const effects = vNodeProps[_PROPS_HANDLER].$effects$;
3938
+ const constPropsDifferent = handleChangedProps(jsxProps[_CONST_PROPS], vNodeProps[_CONST_PROPS], vNodeProps[_PROPS_HANDLER], container, !1);
3939
+ if (propsAreDifferent = constPropsDifferent, shouldRender ||= constPropsDifferent,
3940
+ effects && effects.size > 0) {
3941
+ const varPropsDifferent = handleChangedProps(jsxProps[_VAR_PROPS], vNodeProps[_VAR_PROPS], vNodeProps[_PROPS_HANDLER], container);
3942
+ propsAreDifferent ||= varPropsDifferent;
3943
+ }
3944
+ }
3945
+ return propsAreDifferent && (vNodeProps ? vNodeProps[_OWNER] = jsxProps[_OWNER] : jsxProps && (host.setProp("q:props", jsxProps),
3946
+ vNodeProps = jsxProps)), shouldRender;
3947
+ }
3948
+
3949
+ function handleChangedProps(src, dst, propsHandler, container, triggerEffects = !0) {
3876
3950
  const srcEmpty = isPropsEmpty(src);
3877
3951
  const dstEmpty = isPropsEmpty(dst);
3878
3952
  if (srcEmpty && dstEmpty) {
@@ -3889,12 +3963,17 @@ function propsDiffer(src, dst) {
3889
3963
  "q:brefs" in dst && dstLen--, srcLen !== dstLen) {
3890
3964
  return !0;
3891
3965
  }
3966
+ let changed = !1;
3967
+ propsHandler.$container$ = container;
3892
3968
  for (const key of srcKeys) {
3893
3969
  if ("children" !== key && "q:brefs" !== key && (!Object.prototype.hasOwnProperty.call(dst, key) || src[key] !== dst[key])) {
3894
- return !0;
3970
+ if (changed = !0, !triggerEffects) {
3971
+ return !0;
3972
+ }
3973
+ triggerPropsProxyEffect(propsHandler, key);
3895
3974
  }
3896
3975
  }
3897
- return !1;
3976
+ return changed;
3898
3977
  }
3899
3978
 
3900
3979
  function isPropsEmpty(props) {
@@ -4082,7 +4161,7 @@ function findAncestorBlockingChore(chore, type) {
4082
4161
  const blockingChores = isNormalQueue ? current.chores : current.blockedChores;
4083
4162
  if (blockingChores) {
4084
4163
  for (const blockingChore of blockingChores) {
4085
- if (blockingChore.$type$ < 16 && 3 !== blockingChore.$type$ && 1 !== blockingChore.$type$ && 2 !== blockingChore.$type$) {
4164
+ if (blockingChore.$type$ < 16 && 3 !== blockingChore.$type$ && 1 !== blockingChore.$type$ && 2 !== blockingChore.$type$ && blockingChore.$state$ === ChoreState.NONE) {
4086
4165
  return blockingChore;
4087
4166
  }
4088
4167
  }
@@ -4104,17 +4183,17 @@ function findBlockingChore(chore, choreQueue, blockedChores, runningChores, cont
4104
4183
  for (const rule of BLOCKING_RULES) {
4105
4184
  if (chore.$type$ === rule.blockedType) {
4106
4185
  for (const candidate of choreQueue) {
4107
- if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container)) {
4186
+ if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container) && candidate.$state$ === ChoreState.NONE) {
4108
4187
  return candidate;
4109
4188
  }
4110
4189
  }
4111
4190
  for (const candidate of blockedChores) {
4112
- if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container)) {
4191
+ if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container) && candidate.$state$ === ChoreState.NONE) {
4113
4192
  return candidate;
4114
4193
  }
4115
4194
  }
4116
4195
  for (const candidate of runningChores) {
4117
- if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container)) {
4196
+ if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container) && candidate.$state$ !== ChoreState.FAILED) {
4118
4197
  return candidate;
4119
4198
  }
4120
4199
  }
@@ -4141,7 +4220,7 @@ function findBlockingChoreForVisible(chore, runningChores, container) {
4141
4220
  for (const rule of VISIBLE_BLOCKING_RULES) {
4142
4221
  if (chore.$type$ === rule.blockedType) {
4143
4222
  for (const candidate of runningChores) {
4144
- if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container)) {
4223
+ if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container) && candidate.$state$ !== ChoreState.FAILED) {
4145
4224
  return candidate;
4146
4225
  }
4147
4226
  }
@@ -4294,7 +4373,7 @@ function choreComparator(a, b) {
4294
4373
  return microTypeDiff;
4295
4374
  }
4296
4375
  const idxDiff = toNumber(a.$idx$) - toNumber(b.$idx$);
4297
- return 0 !== idxDiff ? idxDiff : a.$target$ !== b.$target$ ? isQrl(a.$target$) && isQrl(b.$target$) && a.$target$.$hash$ === b.$target$.$hash$ ? 0 : 1 : 7 === a.$type$ && 7 === b.$type$ && (a.$target$ instanceof StoreHandler && b.$target$ instanceof StoreHandler || a.$target$ instanceof AsyncComputedSignalImpl && b.$target$ instanceof AsyncComputedSignalImpl) && a.$payload$ !== b.$payload$ ? 1 : 0;
4376
+ return 0 !== idxDiff ? idxDiff : a.$target$ !== b.$target$ ? isQrl(a.$target$) && isQrl(b.$target$) && a.$target$.$hash$ === b.$target$.$hash$ ? 0 : 1 : 7 === a.$type$ && 7 === b.$type$ && (a.$target$ instanceof StoreHandler && b.$target$ instanceof StoreHandler || a.$target$ instanceof PropsProxyHandler && b.$target$ instanceof PropsProxyHandler || a.$target$ instanceof AsyncComputedSignalImpl && b.$target$ instanceof AsyncComputedSignalImpl) && a.$payload$ !== b.$payload$ ? 1 : 0;
4298
4377
  }
4299
4378
 
4300
4379
  function toNumber(value) {
@@ -4365,10 +4444,6 @@ const createScheduler = (container, journalFlush, choreQueue, blockedChores, run
4365
4444
  }
4366
4445
  }
4367
4446
  if (1 !== chore.$type$ && 2 !== chore.$type$) {
4368
- const blockingChore = findBlockingChore(chore, choreQueue, blockedChores, runningChores, container);
4369
- if (blockingChore) {
4370
- return addBlockedChore(chore, blockingChore, blockedChores), chore;
4371
- }
4372
4447
  const runningChore = function(chore) {
4373
4448
  if (runningChores.size) {
4374
4449
  for (const runningChore of runningChores) {
@@ -4380,7 +4455,12 @@ const createScheduler = (container, journalFlush, choreQueue, blockedChores, run
4380
4455
  return null;
4381
4456
  }(chore);
4382
4457
  if (runningChore) {
4383
- return addBlockedChore(chore, runningChore, blockedChores), chore;
4458
+ return isResourceChore(runningChore) && addBlockedChore(chore, runningChore, blockedChores),
4459
+ chore;
4460
+ }
4461
+ const blockingChore = findBlockingChore(chore, choreQueue, blockedChores, runningChores, container);
4462
+ if (blockingChore) {
4463
+ return addBlockedChore(chore, blockingChore, blockedChores), chore;
4384
4464
  }
4385
4465
  }
4386
4466
  addChoreAndIncrementBlockingCounter(chore, choreQueue);
@@ -4453,7 +4533,7 @@ const createScheduler = (container, journalFlush, choreQueue, blockedChores, run
4453
4533
  applyJournalFlush();
4454
4534
  const blockingChore = findBlockingChoreForVisible(chore, runningChores, container);
4455
4535
  if (blockingChore && blockingChore.$state$ === ChoreState.RUNNING) {
4456
- addBlockedChore(chore, blockingChore, blockedChores);
4536
+ (blockingChore.$blockedChores$ ||= new ChoreArray).add(chore);
4457
4537
  continue;
4458
4538
  }
4459
4539
  }
@@ -4610,9 +4690,13 @@ function vNodeAlreadyDeleted(chore) {
4610
4690
  return !!(chore.$host$ && vnode_isVNode(chore.$host$) && 32 & chore.$host$.flags);
4611
4691
  }
4612
4692
 
4693
+ function isResourceChore(chore) {
4694
+ return 3 === chore.$type$ && !!chore.$payload$ && !!(4 & chore.$payload$.$flags$);
4695
+ }
4696
+
4613
4697
  function addBlockedChore(blockedChore, blockingChore, blockedChores) {
4614
- (blockingChore.$blockedChores$ ||= new ChoreArray).add(blockedChore), blockedChores.add(blockedChore),
4615
- vnode_isVNode(blockedChore.$host$) && (blockedChore.$host$.blockedChores ||= new ChoreArray).add(blockedChore);
4698
+ (isResourceChore(blockedChore) || 0 !== choreComparator(blockedChore, blockingChore)) && ((blockingChore.$blockedChores$ ||= new ChoreArray).add(blockedChore),
4699
+ blockedChores.add(blockedChore), vnode_isVNode(blockedChore.$host$) && (blockedChore.$host$.blockedChores ||= new ChoreArray).add(blockedChore));
4616
4700
  }
4617
4701
 
4618
4702
  function isRenderBlocking(type) {
@@ -4687,7 +4771,7 @@ function debugTrace(action, arg, queue, blockedChores) {
4687
4771
  lines.push(`${activeMarker}${state} ${type} ${1 === chore.$type$ || 2 === chore.$type$ ? qrlTarget : host} ${chore.$idx$}`);
4688
4772
  }
4689
4773
  }
4690
- blockedChores && blockedChores.size > 0 && (lines.push(""), lines.push(`🚫 Blocked Chores (${blockedChores.size} items):`),
4774
+ blockedChores && blockedChores.length > 0 && (lines.push(""), lines.push(`🚫 Blocked Chores (${blockedChores.length} items):`),
4691
4775
  Array.from(blockedChores).forEach((chore, index) => {
4692
4776
  const type = debugChoreTypeToString(chore.$type$);
4693
4777
  const host = String(chore.$host$).replaceAll(/\n.*/gim, "");
@@ -4727,14 +4811,14 @@ async function serialize(serializationContext) {
4727
4811
  const s11nWeakRefs = new Map;
4728
4812
  let parent;
4729
4813
  const qrlMap = new Map;
4730
- const outputArray = (value, keepNulls, writeFn) => {
4814
+ const outputArray = (value, keepUndefined, writeFn) => {
4731
4815
  $writer$.write("[");
4732
4816
  let separator = !1;
4733
4817
  let length;
4734
- if (keepNulls) {
4818
+ if (keepUndefined) {
4735
4819
  length = value.length;
4736
4820
  } else {
4737
- for (length = value.length - 1; length >= 0 && null === value[length]; ) {
4821
+ for (length = value.length - 1; length >= 0 && void 0 === value[length]; ) {
4738
4822
  length--;
4739
4823
  }
4740
4824
  length++;
@@ -4744,7 +4828,7 @@ async function serialize(serializationContext) {
4744
4828
  }
4745
4829
  $writer$.write("]");
4746
4830
  };
4747
- const output = (type, value, keepNulls) => {
4831
+ const output = (type, value, keepUndefined) => {
4748
4832
  if ($writer$.write(`${type},`), "number" == typeof value) {
4749
4833
  $writer$.write(value.toString());
4750
4834
  } else if ("string" == typeof value) {
@@ -4756,7 +4840,7 @@ async function serialize(serializationContext) {
4756
4840
  }
4757
4841
  $writer$.write(0 === lastIdx ? s : s.slice(lastIdx));
4758
4842
  } else {
4759
- outputArray(value, keepNulls, (valueItem, idx) => {
4843
+ outputArray(value, !!keepUndefined, (valueItem, idx) => {
4760
4844
  writeValue(valueItem, idx);
4761
4845
  });
4762
4846
  }
@@ -4874,7 +4958,7 @@ async function serialize(serializationContext) {
4874
4958
  const writeObjectValue = value => {
4875
4959
  if (isPropsProxy(value)) {
4876
4960
  const owner = value[_OWNER];
4877
- output(32, [ _serializationWeakRef(owner), owner.varProps, owner.constProps ]);
4961
+ output(32, [ _serializationWeakRef(owner), owner.varProps, owner.constProps, value[_PROPS_HANDLER].$effects$ ]);
4878
4962
  } else if (value instanceof SubscriptionData) {
4879
4963
  output(33, [ value.data.$scopedStyleIdPrefix$, value.data.$isConst$ ]);
4880
4964
  } else if (isStore(value)) {
@@ -4893,7 +4977,7 @@ async function serialize(serializationContext) {
4893
4977
  innerStore && innerStores.push(innerStore);
4894
4978
  }
4895
4979
  const out = [ storeTarget, flags, effects, ...innerStores ];
4896
- for (;null == out[out.length - 1]; ) {
4980
+ for (;void 0 === out[out.length - 1]; ) {
4897
4981
  out.pop();
4898
4982
  }
4899
4983
  output(29, out);
@@ -4901,7 +4985,7 @@ async function serialize(serializationContext) {
4901
4985
  } else if (isSerializerObj(value)) {
4902
4986
  const result = value[SerializerSymbol](value);
4903
4987
  if (isPromise(result)) {
4904
- const forwardRef = resolvePromise(result, $addRoot$, (resolved, resolvedValue) => new PromiseResult(28, resolved, resolvedValue, null, null));
4988
+ const forwardRef = resolvePromise(result, $addRoot$, (resolved, resolvedValue) => new PromiseResult(28, resolved, resolvedValue, void 0, void 0));
4905
4989
  output(2, forwardRef);
4906
4990
  } else {
4907
4991
  const index = parent.$index$;
@@ -4925,8 +5009,14 @@ async function serialize(serializationContext) {
4925
5009
  } else if (value instanceof SignalImpl) {
4926
5010
  if (value instanceof SerializerSignalImpl) {
4927
5011
  addPreloadQrl(value.$computeQrl$);
4928
- const forwardRefId = resolvePromise(getCustomSerializerPromise(value, value.$untrackedValue$), $addRoot$, (resolved, resolvedValue) => new PromiseResult(28, resolved, resolvedValue, value.$effects$, value.$computeQrl$));
4929
- return void output(2, forwardRefId);
5012
+ const maybeValue = getCustomSerializerPromise(value, value.$untrackedValue$);
5013
+ if (isPromise(maybeValue)) {
5014
+ const forwardRefId = resolvePromise(maybeValue, $addRoot$, (resolved, resolvedValue) => new PromiseResult(28, resolved, resolvedValue, value.$effects$, value.$computeQrl$));
5015
+ output(2, forwardRefId);
5016
+ } else {
5017
+ output(28, [ value.$computeQrl$, value.$effects$, maybeValue ]);
5018
+ }
5019
+ return;
4930
5020
  }
4931
5021
  if (value instanceof WrappedSignalImpl) {
4932
5022
  output(25, [ ...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), value.$flags$, value.$hostElement$, ...value.$effects$ || [] ]);
@@ -4940,10 +5030,15 @@ async function serialize(serializationContext) {
4940
5030
  addPreloadQrl(value.$computeQrl$);
4941
5031
  const out = [ value.$computeQrl$, value.$effects$ ];
4942
5032
  const isAsync = value instanceof AsyncComputedSignalImpl;
4943
- isAsync && out.push(value.$loadingEffects$, value.$errorEffects$, value.$untrackedLoading$, value.$untrackedError$),
4944
- v !== NEEDS_COMPUTATION && out.push(v), output(isAsync ? 27 : 26, out);
5033
+ isAsync && out.push(value.$loadingEffects$, value.$errorEffects$, value.$untrackedLoading$, value.$untrackedError$);
5034
+ let keepUndefined = !1;
5035
+ v !== NEEDS_COMPUTATION && (out.push(v), isAsync || void 0 !== v || (keepUndefined = !0)),
5036
+ output(isAsync ? 27 : 26, out, keepUndefined);
4945
5037
  } else {
4946
- output(24, [ value.$untrackedValue$, ...value.$effects$ || [] ]);
5038
+ const v = value.$untrackedValue$;
5039
+ const keepUndefined = void 0 === v;
5040
+ const out = [ v ];
5041
+ value.$effects$ && out.push(...value.$effects$), output(24, out, keepUndefined);
4947
5042
  }
4948
5043
  } else if (value instanceof URL) {
4949
5044
  output(6, value.href);
@@ -4990,14 +5085,14 @@ async function serialize(serializationContext) {
4990
5085
  }
4991
5086
  output(17, combined);
4992
5087
  } else if (isJSXNode(value)) {
4993
- const out = [ value.type, value.key, value.varProps, value.constProps, value.children, value.toSort || null ];
4994
- for (;null == out[out.length - 1]; ) {
5088
+ const out = [ value.type, value.key, value.varProps, value.constProps, value.children, value.toSort || void 0 ];
5089
+ for (;void 0 === out[out.length - 1]; ) {
4995
5090
  out.pop();
4996
5091
  }
4997
5092
  output(31, out);
4998
5093
  } else if (value instanceof Task) {
4999
5094
  const out = [ value.$qrl$, value.$flags$, value.$index$, value.$el$, value[_EFFECT_BACK_REF], value.$state$ ];
5000
- for (;null == out[out.length - 1]; ) {
5095
+ for (;void 0 === out[out.length - 1]; ) {
5001
5096
  out.pop();
5002
5097
  }
5003
5098
  output(21, out);
@@ -5089,19 +5184,17 @@ class PromiseResult {
5089
5184
  $value$;
5090
5185
  $effects$;
5091
5186
  $qrl$;
5092
- constructor($type$, $resolved$, $value$, $effects$ = null, $qrl$ = null) {
5187
+ constructor($type$, $resolved$, $value$, $effects$, $qrl$) {
5093
5188
  this.$type$ = $type$, this.$resolved$ = $resolved$, this.$value$ = $value$, this.$effects$ = $effects$,
5094
5189
  this.$qrl$ = $qrl$;
5095
5190
  }
5096
5191
  }
5097
5192
 
5098
5193
  function getCustomSerializerPromise(signal, value) {
5099
- return new Promise(resolve => {
5100
- signal.$computeQrl$.resolve().then(arg => {
5101
- let data;
5102
- arg.serialize ? data = arg.serialize(value) : SerializerSymbol in value && (data = value[SerializerSymbol](value)),
5103
- void 0 === data && (data = NEEDS_COMPUTATION), resolve(data);
5104
- });
5194
+ return value === NEEDS_COMPUTATION ? value : maybeThen(signal.$computeQrl$.resolved || signal.$computeQrl$.resolve(), arg => {
5195
+ let data;
5196
+ return "function" == typeof arg && (arg = arg()), arg.serialize ? data = arg.serialize(value) : "object" == typeof value && SerializerSymbol in value && (data = value[SerializerSymbol](value)),
5197
+ void 0 === data && (data = NEEDS_COMPUTATION), data;
5105
5198
  });
5106
5199
  }
5107
5200
 
@@ -5133,7 +5226,7 @@ function serializeWrappingFn(serializationContext, value) {
5133
5226
  }
5134
5227
 
5135
5228
  function filterEffectBackRefs(effectBackRef) {
5136
- let effectBackRefToSerialize = null;
5229
+ let effectBackRefToSerialize;
5137
5230
  if (effectBackRef) {
5138
5231
  for (const [effectProp, effect] of effectBackRef) {
5139
5232
  effect[2] && (effectBackRefToSerialize ||= new Map, effectBackRefToSerialize.set(effectProp, effect));
@@ -5260,7 +5353,7 @@ class _SharedContainer {
5260
5353
  throw Error("Not implemented");
5261
5354
  };
5262
5355
  const choreQueue = new ChoreArray;
5263
- const blockedChores = new Set;
5356
+ const blockedChores = new ChoreArray;
5264
5357
  const runningChores = new Set;
5265
5358
  this.$scheduler$ = createScheduler(this, journalFlush, choreQueue, blockedChores, runningChores);
5266
5359
  }
@@ -5371,12 +5464,12 @@ function processJSXNode(ssr, enqueue, value, options) {
5371
5464
  appendClassIfScopedStyleExists(jsx, options.styleScoped);
5372
5465
  let qwikInspectorAttrValue = null;
5373
5466
  isDev && jsx.dev && "head" !== jsx.type && (qwikInspectorAttrValue = getFileLocationFromJsx(jsx.dev));
5374
- const innerHTML = ssr.openElement(type, varPropsToSsrAttrs(jsx.varProps, jsx.constProps, {
5467
+ const innerHTML = ssr.openElement(type, toSsrAttrs(jsx.varProps, {
5375
5468
  serializationCtx: ssr.serializationCtx,
5376
5469
  styleScopedId: options.styleScoped,
5377
5470
  key: jsx.key,
5378
5471
  toSort: jsx.toSort
5379
- }), constPropsToSsrAttrs(jsx.constProps, jsx.varProps, {
5472
+ }), toSsrAttrs(jsx.constProps, {
5380
5473
  serializationCtx: ssr.serializationCtx,
5381
5474
  styleScopedId: options.styleScoped
5382
5475
  }), qwikInspectorAttrValue);
@@ -5430,10 +5523,18 @@ function processJSXNode(ssr, enqueue, value, options) {
5430
5523
  const componentFrame = ssr.getParentComponentFrame();
5431
5524
  componentFrame.distributeChildrenIntoSlots(jsx.children, options.styleScoped, options.parentComponentFrame);
5432
5525
  const jsxOutput = applyQwikComponentBody(ssr, jsx, type);
5433
- const compStyleComponentId = addComponentStylePrefix(host.getProp("q:sstyle"));
5434
- enqueue(new ParentComponentData(options.styleScoped, options.parentComponentFrame)),
5435
- enqueue(ssr.closeComponent), enqueue(jsxOutput), isPromise(jsxOutput) && enqueue(Promise),
5436
- enqueue(new ParentComponentData(compStyleComponentId, componentFrame));
5526
+ if (enqueue(new ParentComponentData(options.styleScoped, options.parentComponentFrame)),
5527
+ enqueue(ssr.closeComponent), isPromise(jsxOutput)) {
5528
+ enqueue(async () => {
5529
+ const resolvedOutput = await jsxOutput;
5530
+ const compStyleComponentId = addComponentStylePrefix(host.getProp("q:sstyle"));
5531
+ enqueue(resolvedOutput), enqueue(new ParentComponentData(compStyleComponentId, componentFrame));
5532
+ });
5533
+ } else {
5534
+ enqueue(jsxOutput);
5535
+ const compStyleComponentId = addComponentStylePrefix(host.getProp("q:sstyle"));
5536
+ enqueue(new ParentComponentData(compStyleComponentId, componentFrame));
5537
+ }
5437
5538
  } else {
5438
5539
  const inlineComponentProps = [ "q:key", jsx.key ];
5439
5540
  ssr.openFragment(isDev ? [ "q:type", "I", ...inlineComponentProps ] : inlineComponentProps),
@@ -5447,14 +5548,6 @@ function processJSXNode(ssr, enqueue, value, options) {
5447
5548
  }
5448
5549
  }
5449
5550
 
5450
- function varPropsToSsrAttrs(varProps, constProps, options) {
5451
- return toSsrAttrs(varProps, options);
5452
- }
5453
-
5454
- function constPropsToSsrAttrs(constProps, varProps, options) {
5455
- return toSsrAttrs(constProps, options);
5456
- }
5457
-
5458
5551
  function toSsrAttrs(record, options) {
5459
5552
  if (null == record) {
5460
5553
  return null;
@@ -5510,12 +5603,15 @@ function setEvent(serializationCtx, key, rawValue) {
5510
5603
  function addQwikEventToSerializationContext(serializationCtx, key, qrl) {
5511
5604
  const data = getEventDataFromHtmlAttribute(key);
5512
5605
  if (data) {
5513
- serializationCtx.$eventNames$.add(data[1]), serializationCtx.$eventQrls$.add(qrl);
5606
+ const [scope, eventName] = data;
5607
+ const scopedEvent = getScopedEventName(scope, eventName);
5608
+ const loaderScopedEvent = getLoaderScopedEventName(scope, scopedEvent);
5609
+ serializationCtx.$eventNames$.add(loaderScopedEvent), serializationCtx.$eventQrls$.add(qrl);
5514
5610
  }
5515
5611
  }
5516
5612
 
5517
5613
  function addPreventDefaultEventToSerializationContext(serializationCtx, key) {
5518
- const eventName = key.substring(15);
5614
+ const eventName = key.substring(14);
5519
5615
  eventName && serializationCtx.$eventNames$.add(eventName);
5520
5616
  }
5521
5617
 
@@ -5615,7 +5711,7 @@ const inflate = (container, target, typeId, data) => {
5615
5711
  const d = data;
5616
5712
  asyncComputed.$computeQrl$ = d[0], asyncComputed.$effects$ = new Set(d[1]), asyncComputed.$loadingEffects$ = new Set(d[2]),
5617
5713
  asyncComputed.$errorEffects$ = new Set(d[3]), asyncComputed.$untrackedLoading$ = d[4],
5618
- asyncComputed.$untrackedError$ = d[5] || null;
5714
+ asyncComputed.$untrackedError$ = d[5];
5619
5715
  d.length > 6 && (asyncComputed.$untrackedValue$ = d[6], asyncComputed.$promiseValue$ = d[6]),
5620
5716
  asyncComputed.$flags$ |= 1;
5621
5717
  break;
@@ -5626,7 +5722,7 @@ const inflate = (container, target, typeId, data) => {
5626
5722
  {
5627
5723
  const computed = target;
5628
5724
  const d = data;
5629
- computed.$computeQrl$ = d[0], computed.$effects$ = new Set(d[1]);
5725
+ computed.$computeQrl$ = d[0], d[1] && (computed.$effects$ = new Set(d[1]));
5630
5726
  d.length > 2 ? (computed.$untrackedValue$ = d[2], 28 === typeId && (computed.$flags$ |= 1)) : (computed.$flags$ |= 1,
5631
5727
  computed.$computeQrl$.resolve(), container.$scheduler$(1, null, computed.$computeQrl$));
5632
5728
  break;
@@ -5701,9 +5797,10 @@ const inflate = (container, target, typeId, data) => {
5701
5797
 
5702
5798
  case 32:
5703
5799
  const propsProxy = target;
5704
- let owner = data[0];
5705
- owner === _UNINITIALIZED && (owner = new JSXNodeImpl(Fragment, data[1], data[2]),
5706
- owner._proxy = propsProxy), propsProxy[_OWNER] = owner;
5800
+ const d = data;
5801
+ let owner = d[0];
5802
+ owner === _UNINITIALIZED && (owner = new JSXNodeImpl(Fragment, d[1], d[2]), owner._proxy = propsProxy),
5803
+ propsProxy[_OWNER] = owner, propsProxy[_PROPS_HANDLER].$effects$ = d[3];
5707
5804
  break;
5708
5805
 
5709
5806
  case 33:
@@ -6035,15 +6132,15 @@ class DomContainer extends _SharedContainer {
6035
6132
  this.$rawStateData$ = [], this.$stateData$ = [];
6036
6133
  const document = this.element.ownerDocument;
6037
6134
  document.qVNodeData || processVNodeData(document), this.$qFuncs$ = getQFuncs(document, this.$instanceHash$) || EMPTY_ARRAY,
6038
- this.$setServerData$(), element.setAttribute("q:container", "resumed"), element.qContainer = this,
6039
- element.isConnected && element.dispatchEvent(new CustomEvent("qresume", {
6040
- bubbles: !0
6041
- }));
6135
+ this.$setServerData$(), element.setAttribute("q:container", "resumed"), element.qContainer = this;
6042
6136
  const qwikStates = element.querySelectorAll('script[type="qwik/state"]');
6043
6137
  if (0 !== qwikStates.length) {
6044
6138
  this.$rawStateData$ = JSON.parse(qwikStates[qwikStates.length - 1].textContent),
6045
6139
  preprocessState(this.$rawStateData$, this), this.$stateData$ = wrapDeserializerProxy(this, this.$rawStateData$);
6046
6140
  }
6141
+ element.isConnected && element.dispatchEvent(new CustomEvent("qresume", {
6142
+ bubbles: !0
6143
+ }));
6047
6144
  }
6048
6145
  $setRawState$(id, vParent) {
6049
6146
  this.$stateData$[id] = vParent;
@@ -6338,7 +6435,7 @@ const getOrCreateStore = (obj, flags, container) => {
6338
6435
  class StoreHandler {
6339
6436
  $flags$;
6340
6437
  $container$;
6341
- $effects$=null;
6438
+ $effects$=void 0;
6342
6439
  constructor($flags$, $container$) {
6343
6440
  this.$flags$ = $flags$, this.$container$ = $container$;
6344
6441
  }
@@ -6347,7 +6444,7 @@ class StoreHandler {
6347
6444
  }
6348
6445
  force(prop) {
6349
6446
  const target = getStoreTarget(this);
6350
- this.$container$?.$scheduler$(7, null, this, getEffects(target, prop, this.$effects$));
6447
+ this.$container$?.$scheduler$(7, void 0, this, getEffects(target, prop, this.$effects$));
6351
6448
  }
6352
6449
  get(target, prop) {
6353
6450
  if ("symbol" == typeof prop) {
@@ -6385,7 +6482,7 @@ class StoreHandler {
6385
6482
  return !0;
6386
6483
  }
6387
6484
  deleteProperty(target, prop) {
6388
- return "string" == typeof prop && delete target[prop] && (Array.isArray(target) || this.$container$?.$scheduler$(7, null, this, getEffects(target, prop, this.$effects$)),
6485
+ return "string" == typeof prop && delete target[prop] && (Array.isArray(target) || this.$container$?.$scheduler$(7, void 0, this, getEffects(target, prop, this.$effects$)),
6389
6486
  !0);
6390
6487
  }
6391
6488
  has(target, prop) {
@@ -6426,7 +6523,7 @@ function addStoreEffect(target, prop, store, effectSubscription) {
6426
6523
  function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
6427
6524
  target[prop] = value;
6428
6525
  const effects = getEffects(target, prop, currentStore.$effects$);
6429
- effects && currentStore.$container$?.$scheduler$(7, null, currentStore, effects);
6526
+ effects && currentStore.$container$?.$scheduler$(7, void 0, currentStore, effects);
6430
6527
  }
6431
6528
 
6432
6529
  function getEffects(target, prop, storeEffects) {
@@ -6450,7 +6547,7 @@ function getEffects(target, prop, storeEffects) {
6450
6547
  effectsToTrigger.add(effect);
6451
6548
  }
6452
6549
  }
6453
- return effectsToTrigger || null;
6550
+ return effectsToTrigger;
6454
6551
  }
6455
6552
 
6456
6553
  const canSerialize = (value, seen = new WeakSet) => {
@@ -7266,15 +7363,15 @@ const useVisibleTaskQrl = (qrl, opts) => {
7266
7363
  const {val, set, i, iCtx} = useSequentialScope();
7267
7364
  const eagerness = opts?.strategy ?? "intersection-observer";
7268
7365
  if (val) {
7269
- return void (isServerPlatform() && useRunTask(val, eagerness));
7366
+ return void (32 & val.$flags$ || isServerPlatform() || (val.$flags$ |= 32, useRegisterTaskEvents(val, eagerness)));
7270
7367
  }
7271
7368
  assertQrl(qrl);
7272
7369
  const task = new Task(1, i, iCtx.$hostElement$, qrl, void 0, null);
7273
- set(task), useRunTask(task, eagerness), isServerPlatform() || (qrl.resolve(iCtx.$element$),
7370
+ set(task), useRegisterTaskEvents(task, eagerness), isServerPlatform() || (qrl.resolve(iCtx.$element$),
7274
7371
  iCtx.$container$.$scheduler$(16, task));
7275
7372
  };
7276
7373
 
7277
- const useRunTask = (task, eagerness) => {
7374
+ const useRegisterTaskEvents = (task, eagerness) => {
7278
7375
  "intersection-observer" === eagerness ? useOn("qvisible", getTaskHandlerQrl(task)) : "document-ready" === eagerness ? useOnDocument("qinit", getTaskHandlerQrl(task)) : "document-idle" === eagerness && useOnDocument("qidle", getTaskHandlerQrl(task));
7279
7376
  };
7280
7377