@qwik.dev/core 2.0.0-beta.25 → 2.0.0-beta.26

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.25-dev+2677279
3
+ * @qwik.dev/core 2.0.0-beta.26-dev+c693cf5
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
@@ -523,7 +523,7 @@ const isObjectEmpty = obj => {
523
523
  return !0;
524
524
  };
525
525
 
526
- const version = "2.0.0-beta.25-dev+2677279";
526
+ const version = "2.0.0-beta.26-dev+c693cf5";
527
527
 
528
528
  const createPlatform = () => ({
529
529
  isServer,
@@ -534,6 +534,7 @@ const createPlatform = () => ({
534
534
  if (regSym) {
535
535
  return regSym;
536
536
  }
537
+ throw qError(6, [ symbolName ]);
537
538
  }
538
539
  if (!url) {
539
540
  throw qError(14, [ symbolName ]);
@@ -2224,7 +2225,11 @@ const cleanupDestroyable = destroyable => {
2224
2225
  }
2225
2226
  };
2226
2227
 
2227
- function runEventHandlerQRL(handler, event, element, ctx = newInvokeContextFromDOM(event, element)) {
2228
+ function runEventHandlerQRL(handler, event, element, ctx) {
2229
+ if (!element.isConnected) {
2230
+ return;
2231
+ }
2232
+ ctx || (ctx = newInvokeContextFromDOM(event, element));
2228
2233
  const container = ctx.$container$;
2229
2234
  const hostElement = ctx.$hostElement$;
2230
2235
  vnode_ensureElementInflated(container, hostElement);
@@ -2275,37 +2280,39 @@ function setAttribute(journal, vnode, key, value, scopedStyleIdPrefix, originalV
2275
2280
  }
2276
2281
 
2277
2282
  const vnode_diff = (container, journal, jsxNode, vStartNode, cursor, scopedStyleIdPrefix) => {
2278
- const diffContext = {
2279
- container,
2280
- journal,
2281
- cursor,
2282
- scopedStyleIdPrefix,
2283
- stack: [],
2284
- asyncQueue: [],
2285
- asyncAttributePromises: [],
2286
- vParent: null,
2287
- vCurrent: null,
2288
- vNewNode: null,
2289
- vSiblings: null,
2290
- vSiblingsArray: null,
2291
- vSideBuffer: null,
2292
- jsxChildren: null,
2293
- jsxValue: null,
2294
- jsxIdx: 0,
2295
- jsxCount: 0,
2296
- shouldAdvance: !0,
2297
- isCreationMode: !1,
2298
- subscriptionData: {
2299
- const: new SubscriptionData({
2300
- $scopedStyleIdPrefix$: scopedStyleIdPrefix,
2301
- $isConst$: !0
2302
- }),
2303
- var: new SubscriptionData({
2304
- $scopedStyleIdPrefix$: scopedStyleIdPrefix,
2305
- $isConst$: !1
2306
- })
2307
- }
2308
- };
2283
+ const diffContext = function createDiffContext(container, journal, cursor, scopedStyleIdPrefix) {
2284
+ return {
2285
+ container,
2286
+ journal,
2287
+ cursor,
2288
+ scopedStyleIdPrefix,
2289
+ stack: [],
2290
+ asyncQueue: [],
2291
+ asyncAttributePromises: [],
2292
+ vParent: null,
2293
+ vCurrent: null,
2294
+ vNewNode: null,
2295
+ vSiblings: null,
2296
+ vSiblingsArray: null,
2297
+ vSideBuffer: null,
2298
+ jsxChildren: null,
2299
+ jsxValue: null,
2300
+ jsxIdx: 0,
2301
+ jsxCount: 0,
2302
+ shouldAdvance: !0,
2303
+ isCreationMode: !1,
2304
+ subscriptionData: {
2305
+ const: new SubscriptionData({
2306
+ $scopedStyleIdPrefix$: scopedStyleIdPrefix,
2307
+ $isConst$: !0
2308
+ }),
2309
+ var: new SubscriptionData({
2310
+ $scopedStyleIdPrefix$: scopedStyleIdPrefix,
2311
+ $isConst$: !1
2312
+ })
2313
+ }
2314
+ };
2315
+ }(container, journal, cursor, scopedStyleIdPrefix);
2309
2316
  diff(diffContext, jsxNode, vStartNode);
2310
2317
  const result = drainAsyncQueue(diffContext);
2311
2318
  if (isPromise(result)) {
@@ -2522,6 +2529,7 @@ function expectSlot(diffContext) {
2522
2529
  vnode_setProp(diffContext.vNewNode, QSlot, slotNameKey);
2523
2530
  vHost && vnode_setProp(vHost, slotNameKey, diffContext.vNewNode);
2524
2531
  isDev && vnode_setProp(diffContext.vNewNode, "q:type", "P");
2532
+ vnode_inflateProjectionTrailingText(diffContext.journal, diffContext.vNewNode);
2525
2533
  vnode_insertBefore(diffContext.journal, diffContext.vParent, diffContext.vNewNode, diffContext.vCurrent && getInsertBefore(diffContext));
2526
2534
  oldParent && vnode_isElementVNode(oldParent) && !oldParent.firstChild && vnode_getElementName(oldParent) === "q:template" && vnode_remove(diffContext.journal, oldParent.parent, oldParent, !0);
2527
2535
  }
@@ -2939,7 +2947,7 @@ function expectComponent(diffContext, component) {
2939
2947
  const lookupKeysAreEqual = lookupKey === vNodeLookupKey;
2940
2948
  const hashesAreEqual = componentHash === vNodeComponentHash;
2941
2949
  if (lookupKeysAreEqual) {
2942
- if (hashesAreEqual && jsxNode.key) {
2950
+ if (hashesAreEqual) {
2943
2951
  deleteFromSideBuffer(diffContext, null, lookupKey);
2944
2952
  } else {
2945
2953
  insertNewComponent(diffContext, host, componentQRL, jsxProps);
@@ -2955,20 +2963,28 @@ function expectComponent(diffContext, component) {
2955
2963
  }
2956
2964
  if (host) {
2957
2965
  const vNodeProps = vnode_getProp(host, "q:props", diffContext.container.$getObjectById$);
2958
- shouldRender || (shouldRender ||= function handleProps(host, jsxProps, vNodeProps, container) {
2959
- let shouldRender = !1;
2960
- if (vNodeProps) {
2961
- const constPropsDifferent = handleChangedProps(jsxProps[_CONST_PROPS], vNodeProps[_CONST_PROPS], vNodeProps[_PROPS_HANDLER], container, !1);
2962
- shouldRender ||= constPropsDifferent;
2963
- const varPropsDifferent = handleChangedProps(jsxProps[_VAR_PROPS], vNodeProps[_VAR_PROPS], vNodeProps[_PROPS_HANDLER], container, !0);
2964
- shouldRender ||= varPropsDifferent;
2965
- vNodeProps[_OWNER] = jsxProps[_OWNER];
2966
- } else if (jsxProps) {
2967
- vnode_setProp(host, "q:props", jsxProps);
2968
- vNodeProps = jsxProps;
2966
+ if (!shouldRender) {
2967
+ const propsChanged = function handleProps(host, jsxProps, vNodeProps, container) {
2968
+ let shouldRender = !1;
2969
+ if (vNodeProps) {
2970
+ const constPropsDifferent = handleChangedProps(jsxProps[_CONST_PROPS], vNodeProps[_CONST_PROPS], vNodeProps[_PROPS_HANDLER], container, !1);
2971
+ shouldRender ||= constPropsDifferent;
2972
+ const varPropsDifferent = handleChangedProps(jsxProps[_VAR_PROPS], vNodeProps[_VAR_PROPS], vNodeProps[_PROPS_HANDLER], container, !0);
2973
+ shouldRender ||= varPropsDifferent;
2974
+ vNodeProps[_OWNER] = jsxProps[_OWNER];
2975
+ } else if (jsxProps) {
2976
+ vnode_setProp(host, "q:props", jsxProps);
2977
+ vNodeProps = jsxProps;
2978
+ }
2979
+ return shouldRender;
2980
+ }(host, jsxProps, vNodeProps, diffContext.container);
2981
+ if (propsChanged && jsxNode.key == null) {
2982
+ insertNewComponent(diffContext, host, componentQRL, jsxProps);
2983
+ host = diffContext.vNewNode;
2984
+ shouldRender = !0;
2969
2985
  }
2970
- return shouldRender;
2971
- }(host, jsxProps, vNodeProps, diffContext.container));
2986
+ shouldRender ||= propsChanged;
2987
+ }
2972
2988
  if (shouldRender) {
2973
2989
  vnode_setProp(host, "q:renderFn", componentQRL);
2974
2990
  host.flags &= -33;
@@ -3013,7 +3029,7 @@ function expectComponent(diffContext, component) {
3013
3029
  const lookupKeysAreEqual = lookupKey === vNodeLookupKey;
3014
3030
  const vNodeComponentHash = getComponentHash(host, diffContext.container.$getObjectById$);
3015
3031
  const isInlineComponent = vNodeComponentHash == null;
3016
- if (host && !isInlineComponent || lookupKey == null) {
3032
+ if (host && !isInlineComponent || !host) {
3017
3033
  insertNewInlineComponent(diffContext);
3018
3034
  host = diffContext.vNewNode;
3019
3035
  } else if (lookupKeysAreEqual) {
@@ -3519,7 +3535,7 @@ function walkCursor(cursor, options) {
3519
3535
  });
3520
3536
  return;
3521
3537
  }
3522
- if (!isRunningOnServer && !import.meta.env.TEST) {
3538
+ if (isBrowser) {
3523
3539
  const elapsed = performance.now() - startTime;
3524
3540
  if (elapsed >= timeBudget) {
3525
3541
  scheduleYield();
@@ -3694,7 +3710,7 @@ function getNextVNode(vNode, cursor) {
3694
3710
  return null;
3695
3711
  }
3696
3712
  let parent = null;
3697
- vNode.parent && vNode.parent.dirty & 32 ? parent = vNode.parent : vNode.slotParent && vNode.slotParent.dirty & 32 && (parent = vNode.slotParent);
3713
+ vNode.slotParent && vNode.slotParent.dirty & 32 ? parent = vNode.slotParent : vNode.parent && vNode.parent.dirty & 32 && (parent = vNode.parent);
3698
3714
  if (!parent) {
3699
3715
  if (cursor.dirty & 127) {
3700
3716
  return cursor;
@@ -3780,7 +3796,7 @@ function propagatePath(target) {
3780
3796
  const parent = reusablePath[i + 1] || target;
3781
3797
  parent.dirty |= 32;
3782
3798
  parent.dirtyChildren ||= [];
3783
- parent.dirtyChildren.push(child);
3799
+ parent.dirtyChildren.includes(child) || parent.dirtyChildren.push(child);
3784
3800
  }
3785
3801
  }
3786
3802
 
@@ -3798,11 +3814,11 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
3798
3814
  if ((isRealDirty ? prevDirty & 127 : prevDirty) || vNode === cursorRoot) {
3799
3815
  return;
3800
3816
  }
3801
- const parent = vNode.parent || vNode.slotParent;
3817
+ const parent = vNode.slotParent || vNode.parent;
3802
3818
  if (cursorRoot && isRealDirty && parent && !parent.dirty) {
3803
3819
  (function propagateToCursorRoot(vNode, cursorRoot) {
3804
3820
  reusablePath.push(vNode);
3805
- let current = vNode.parent || vNode.slotParent;
3821
+ let current = vNode.slotParent || vNode.parent;
3806
3822
  for (;current; ) {
3807
3823
  const isDirty = current.dirty & 127;
3808
3824
  const currentIsCursor = isCursor(current);
@@ -3820,7 +3836,7 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
3820
3836
  cursorData.position !== current && (cursorData.position = vNode);
3821
3837
  }
3822
3838
  reusablePath.push(current);
3823
- current = current.parent || current.slotParent;
3839
+ current = current.slotParent || current.parent;
3824
3840
  }
3825
3841
  reusablePath.length = 0;
3826
3842
  throwErrorAndStop("Cursor root not found in current path!");
@@ -3830,7 +3846,7 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
3830
3846
  if (parent && parent.dirty & 127) {
3831
3847
  isRealDirty && (parent.dirty |= 32);
3832
3848
  parent.dirtyChildren ||= [];
3833
- parent.dirtyChildren.push(vNode);
3849
+ parent.dirtyChildren.includes(vNode) || parent.dirtyChildren.push(vNode);
3834
3850
  if (isRealDirty && vNode.dirtyChildren) {
3835
3851
  const cursor = function findCursor(vNode) {
3836
3852
  for (;vNode; ) {
@@ -3846,7 +3862,7 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
3846
3862
  let cursorPosition = cursorData.position;
3847
3863
  if (cursorPosition) {
3848
3864
  for (;cursorPosition !== cursor; ) {
3849
- cursorPosition = cursorPosition.parent || cursorPosition.slotParent;
3865
+ cursorPosition = cursorPosition.slotParent || cursorPosition.parent;
3850
3866
  if (cursorPosition === vNode) {
3851
3867
  cursorData.position = vNode;
3852
3868
  break;
@@ -3858,7 +3874,7 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
3858
3874
  } else {
3859
3875
  isCursor(vNode) || function findAndPropagateToBlockingCursor(vNode) {
3860
3876
  reusablePath.push(vNode);
3861
- let current = vNode.parent || vNode.slotParent;
3877
+ let current = vNode.slotParent || vNode.parent;
3862
3878
  for (;current; ) {
3863
3879
  const currentIsCursor = isCursor(current);
3864
3880
  if (currentIsCursor) {
@@ -3867,7 +3883,7 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
3867
3883
  return !0;
3868
3884
  }
3869
3885
  reusablePath.push(current);
3870
- current = current.parent || current.slotParent;
3886
+ current = current.slotParent || current.parent;
3871
3887
  }
3872
3888
  reusablePath.length = 0;
3873
3889
  return !1;
@@ -4088,6 +4104,7 @@ function vnode_walkDirectChildren(journal, vParent, callback) {
4088
4104
  function vnode_walkVNode(vNode, callback) {
4089
4105
  let vCursor = vNode;
4090
4106
  if (vnode_isTextVNode(vNode)) {
4107
+ callback?.(vNode, null);
4091
4108
  return;
4092
4109
  }
4093
4110
  let vParent = null;
@@ -4459,9 +4476,7 @@ const vnode_insertVirtualBefore = (journal, parent, newChild, insertBefore) => {
4459
4476
  const vnode_findInsertBefore = (journal, parent, insertBefore) => {
4460
4477
  let adjustedInsertBefore = null;
4461
4478
  insertBefore == null ? vnode_isVirtualVNode(parent) && (adjustedInsertBefore = vnode_getDomSibling(parent, !0, !1)) : adjustedInsertBefore = vnode_isVirtualVNode(insertBefore) ? vnode_getDomSibling(insertBefore, !0, !0) : insertBefore;
4462
- adjustedInsertBefore && ((journal, vNode) => {
4463
- vnode_isTextVNode(vNode) && vnode_ensureTextInflated(journal, vNode);
4464
- })(journal, adjustedInsertBefore);
4479
+ adjustedInsertBefore && vnode_isTextVNode(adjustedInsertBefore) && vnode_ensureTextInflated(journal, adjustedInsertBefore);
4465
4480
  return adjustedInsertBefore;
4466
4481
  };
4467
4482
 
@@ -4478,6 +4493,14 @@ const vnode_unlinkFromOldParent = (journal, currentParent, newParent, newChild)
4478
4493
  currentParent && (newChild.previousSibling || newChild.nextSibling || currentParent !== newParent) && vnode_remove(journal, currentParent, newChild, !1);
4479
4494
  };
4480
4495
 
4496
+ const vnode_inflateProjectionTrailingText = (journal, projection) => {
4497
+ let last = projection;
4498
+ for (;last && vnode_isVirtualVNode(last); ) {
4499
+ last = last.lastChild;
4500
+ }
4501
+ last && vnode_isTextVNode(last) && (last.flags & 8) === 0 && vnode_ensureTextInflated(journal, last);
4502
+ };
4503
+
4481
4504
  const vnode_insertBefore = (journal, parent, newChild, insertBefore) => {
4482
4505
  vnode_isElementOrTextVNode(newChild) ? vnode_insertElementBefore(journal, parent, newChild, insertBefore) : vnode_insertVirtualBefore(journal, parent, newChild, insertBefore);
4483
4506
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwik.dev/core/loader",
3
- "version": "2.0.0-beta.25-dev+2677279",
3
+ "version": "2.0.0-beta.26-dev+c693cf5",
4
4
  "main": "index.mjs",
5
5
  "types": "index.d.ts",
6
6
  "private": true,