@vtj/materials 0.16.11 → 0.16.13

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,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.27
2
+ * vue v3.5.30
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -410,6 +410,7 @@ var Vue = (function (exports) {
410
410
 
411
411
  let activeEffectScope;
412
412
  class EffectScope {
413
+ // TODO isolatedDeclarations "__v_skip"
413
414
  constructor(detached = false) {
414
415
  this.detached = detached;
415
416
  /**
@@ -429,6 +430,7 @@ var Vue = (function (exports) {
429
430
  */
430
431
  this.cleanups = [];
431
432
  this._isPaused = false;
433
+ this.__v_skip = true;
432
434
  this.parent = activeEffectScope;
433
435
  if (!detached && activeEffectScope) {
434
436
  this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
@@ -1279,10 +1281,17 @@ var Vue = (function (exports) {
1279
1281
  }
1280
1282
  function reduce(self, method, fn, args) {
1281
1283
  const arr = shallowReadArray(self);
1284
+ const needsWrap = arr !== self && !isShallow(self);
1282
1285
  let wrappedFn = fn;
1286
+ let wrapInitialAccumulator = false;
1283
1287
  if (arr !== self) {
1284
- if (!isShallow(self)) {
1288
+ if (needsWrap) {
1289
+ wrapInitialAccumulator = args.length === 0;
1285
1290
  wrappedFn = function(acc, item, index) {
1291
+ if (wrapInitialAccumulator) {
1292
+ wrapInitialAccumulator = false;
1293
+ acc = toWrapped(self, acc);
1294
+ }
1286
1295
  return fn.call(this, acc, toWrapped(self, item), index, self);
1287
1296
  };
1288
1297
  } else if (fn.length > 3) {
@@ -1291,7 +1300,8 @@ var Vue = (function (exports) {
1291
1300
  };
1292
1301
  }
1293
1302
  }
1294
- return arr[method](wrappedFn, ...args);
1303
+ const result = arr[method](wrappedFn, ...args);
1304
+ return wrapInitialAccumulator ? toWrapped(self, result) : result;
1295
1305
  }
1296
1306
  function searchProxy(self, method, args) {
1297
1307
  const arr = toRaw(self);
@@ -1581,15 +1591,14 @@ var Vue = (function (exports) {
1581
1591
  clear: createReadonlyMethod("clear")
1582
1592
  } : {
1583
1593
  add(value) {
1584
- if (!shallow && !isShallow(value) && !isReadonly(value)) {
1585
- value = toRaw(value);
1586
- }
1587
1594
  const target = toRaw(this);
1588
1595
  const proto = getProto(target);
1589
- const hadKey = proto.has.call(target, value);
1596
+ const rawValue = toRaw(value);
1597
+ const valueToAdd = !shallow && !isShallow(value) && !isReadonly(value) ? rawValue : value;
1598
+ const hadKey = proto.has.call(target, valueToAdd) || hasChanged(value, valueToAdd) && proto.has.call(target, value) || hasChanged(rawValue, valueToAdd) && proto.has.call(target, rawValue);
1590
1599
  if (!hadKey) {
1591
- target.add(value);
1592
- trigger(target, "add", value, value);
1600
+ target.add(valueToAdd);
1601
+ trigger(target, "add", valueToAdd, valueToAdd);
1593
1602
  }
1594
1603
  return this;
1595
1604
  },
@@ -3485,7 +3494,22 @@ var Vue = (function (exports) {
3485
3494
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
3486
3495
  o: { nextSibling, parentNode, querySelector, insert, createText }
3487
3496
  }, hydrateChildren) {
3488
- function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) {
3497
+ function hydrateAnchor(target2, targetNode) {
3498
+ let targetAnchor = targetNode;
3499
+ while (targetAnchor) {
3500
+ if (targetAnchor && targetAnchor.nodeType === 8) {
3501
+ if (targetAnchor.data === "teleport start anchor") {
3502
+ vnode.targetStart = targetAnchor;
3503
+ } else if (targetAnchor.data === "teleport anchor") {
3504
+ vnode.targetAnchor = targetAnchor;
3505
+ target2._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
3506
+ break;
3507
+ }
3508
+ }
3509
+ targetAnchor = nextSibling(targetAnchor);
3510
+ }
3511
+ }
3512
+ function hydrateDisabledTeleport(node2, vnode2) {
3489
3513
  vnode2.anchor = hydrateChildren(
3490
3514
  nextSibling(node2),
3491
3515
  vnode2,
@@ -3495,8 +3519,6 @@ var Vue = (function (exports) {
3495
3519
  slotScopeIds,
3496
3520
  optimized
3497
3521
  );
3498
- vnode2.targetStart = targetStart;
3499
- vnode2.targetAnchor = targetAnchor;
3500
3522
  }
3501
3523
  const target = vnode.target = resolveTarget(
3502
3524
  vnode.props,
@@ -3507,27 +3529,22 @@ var Vue = (function (exports) {
3507
3529
  const targetNode = target._lpa || target.firstChild;
3508
3530
  if (vnode.shapeFlag & 16) {
3509
3531
  if (disabled) {
3510
- hydrateDisabledTeleport(
3511
- node,
3512
- vnode,
3513
- targetNode,
3514
- targetNode && nextSibling(targetNode)
3515
- );
3532
+ hydrateDisabledTeleport(node, vnode);
3533
+ hydrateAnchor(target, targetNode);
3534
+ if (!vnode.targetAnchor) {
3535
+ prepareAnchor(
3536
+ target,
3537
+ vnode,
3538
+ createText,
3539
+ insert,
3540
+ // if target is the same as the main view, insert anchors before current node
3541
+ // to avoid hydrating mismatch
3542
+ parentNode(node) === target ? node : null
3543
+ );
3544
+ }
3516
3545
  } else {
3517
3546
  vnode.anchor = nextSibling(node);
3518
- let targetAnchor = targetNode;
3519
- while (targetAnchor) {
3520
- if (targetAnchor && targetAnchor.nodeType === 8) {
3521
- if (targetAnchor.data === "teleport start anchor") {
3522
- vnode.targetStart = targetAnchor;
3523
- } else if (targetAnchor.data === "teleport anchor") {
3524
- vnode.targetAnchor = targetAnchor;
3525
- target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
3526
- break;
3527
- }
3528
- }
3529
- targetAnchor = nextSibling(targetAnchor);
3530
- }
3547
+ hydrateAnchor(target, targetNode);
3531
3548
  if (!vnode.targetAnchor) {
3532
3549
  prepareAnchor(target, vnode, createText, insert);
3533
3550
  }
@@ -3545,7 +3562,9 @@ var Vue = (function (exports) {
3545
3562
  updateCssVars(vnode, disabled);
3546
3563
  } else if (disabled) {
3547
3564
  if (vnode.shapeFlag & 16) {
3548
- hydrateDisabledTeleport(node, vnode, node, nextSibling(node));
3565
+ hydrateDisabledTeleport(node, vnode);
3566
+ vnode.targetStart = node;
3567
+ vnode.targetAnchor = nextSibling(node);
3549
3568
  }
3550
3569
  }
3551
3570
  return vnode.anchor && nextSibling(vnode.anchor);
@@ -3569,13 +3588,13 @@ var Vue = (function (exports) {
3569
3588
  ctx.ut();
3570
3589
  }
3571
3590
  }
3572
- function prepareAnchor(target, vnode, createText, insert) {
3591
+ function prepareAnchor(target, vnode, createText, insert, anchor = null) {
3573
3592
  const targetStart = vnode.targetStart = createText("");
3574
3593
  const targetAnchor = vnode.targetAnchor = createText("");
3575
3594
  targetStart[TeleportEndKey] = targetAnchor;
3576
3595
  if (target) {
3577
- insert(targetStart, target);
3578
- insert(targetAnchor, target);
3596
+ insert(targetStart, target, anchor);
3597
+ insert(targetAnchor, target, anchor);
3579
3598
  }
3580
3599
  return targetAnchor;
3581
3600
  }
@@ -3797,6 +3816,7 @@ var Vue = (function (exports) {
3797
3816
  callHook(hook, [el]);
3798
3817
  },
3799
3818
  enter(el) {
3819
+ if (leavingVNodesCache[key] === vnode) return;
3800
3820
  let hook = onEnter;
3801
3821
  let afterHook = onAfterEnter;
3802
3822
  let cancelHook = onEnterCancelled;
@@ -3810,7 +3830,7 @@ var Vue = (function (exports) {
3810
3830
  }
3811
3831
  }
3812
3832
  let called = false;
3813
- const done = el[enterCbKey$1] = (cancelled) => {
3833
+ el[enterCbKey$1] = (cancelled) => {
3814
3834
  if (called) return;
3815
3835
  called = true;
3816
3836
  if (cancelled) {
@@ -3823,6 +3843,7 @@ var Vue = (function (exports) {
3823
3843
  }
3824
3844
  el[enterCbKey$1] = void 0;
3825
3845
  };
3846
+ const done = el[enterCbKey$1].bind(null, false);
3826
3847
  if (hook) {
3827
3848
  callAsyncHook(hook, [el, done]);
3828
3849
  } else {
@@ -3842,7 +3863,7 @@ var Vue = (function (exports) {
3842
3863
  }
3843
3864
  callHook(onBeforeLeave, [el]);
3844
3865
  let called = false;
3845
- const done = el[leaveCbKey] = (cancelled) => {
3866
+ el[leaveCbKey] = (cancelled) => {
3846
3867
  if (called) return;
3847
3868
  called = true;
3848
3869
  remove();
@@ -3856,6 +3877,7 @@ var Vue = (function (exports) {
3856
3877
  delete leavingVNodesCache[key2];
3857
3878
  }
3858
3879
  };
3880
+ const done = el[leaveCbKey].bind(null, false);
3859
3881
  leavingVNodesCache[key2] = vnode;
3860
3882
  if (onLeave) {
3861
3883
  callAsyncHook(onLeave, [el, done]);
@@ -3968,8 +3990,7 @@ var Vue = (function (exports) {
3968
3990
  const r = shallowRef(null);
3969
3991
  if (i) {
3970
3992
  const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
3971
- let desc;
3972
- if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
3993
+ if (isTemplateRefKey(refs, key)) {
3973
3994
  warn$1(`useTemplateRef('${key}') already exists.`);
3974
3995
  } else {
3975
3996
  Object.defineProperty(refs, key, {
@@ -3989,6 +4010,10 @@ var Vue = (function (exports) {
3989
4010
  }
3990
4011
  return ret;
3991
4012
  }
4013
+ function isTemplateRefKey(refs, key) {
4014
+ let desc;
4015
+ return !!((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable);
4016
+ }
3992
4017
 
3993
4018
  const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
3994
4019
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
@@ -4034,10 +4059,19 @@ var Vue = (function (exports) {
4034
4059
  return false;
4035
4060
  }
4036
4061
  }
4062
+ if (isTemplateRefKey(refs, key)) {
4063
+ return false;
4064
+ }
4037
4065
  return hasOwn(rawSetupState, key);
4038
4066
  };
4039
- const canSetRef = (ref2) => {
4040
- return !knownTemplateRefs.has(ref2);
4067
+ const canSetRef = (ref2, key) => {
4068
+ if (knownTemplateRefs.has(ref2)) {
4069
+ return false;
4070
+ }
4071
+ if (key && isTemplateRefKey(refs, key)) {
4072
+ return false;
4073
+ }
4074
+ return true;
4041
4075
  };
4042
4076
  if (oldRef != null && oldRef !== ref) {
4043
4077
  invalidatePendingSetRef(oldRawRef);
@@ -4047,10 +4081,10 @@ var Vue = (function (exports) {
4047
4081
  setupState[oldRef] = null;
4048
4082
  }
4049
4083
  } else if (isRef(oldRef)) {
4050
- if (canSetRef(oldRef)) {
4084
+ const oldRawRefAtom = oldRawRef;
4085
+ if (canSetRef(oldRef, oldRawRefAtom.k)) {
4051
4086
  oldRef.value = null;
4052
4087
  }
4053
- const oldRawRefAtom = oldRawRef;
4054
4088
  if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
4055
4089
  }
4056
4090
  }
@@ -4074,7 +4108,7 @@ var Vue = (function (exports) {
4074
4108
  }
4075
4109
  } else {
4076
4110
  const newVal = [refValue];
4077
- if (canSetRef(ref)) {
4111
+ if (canSetRef(ref, rawRef.k)) {
4078
4112
  ref.value = newVal;
4079
4113
  }
4080
4114
  if (rawRef.k) refs[rawRef.k] = newVal;
@@ -4089,7 +4123,7 @@ var Vue = (function (exports) {
4089
4123
  setupState[ref] = value;
4090
4124
  }
4091
4125
  } else if (_isRef) {
4092
- if (canSetRef(ref)) {
4126
+ if (canSetRef(ref, rawRef.k)) {
4093
4127
  ref.value = value;
4094
4128
  }
4095
4129
  if (rawRef.k) refs[rawRef.k] = value;
@@ -5413,12 +5447,16 @@ If this is a native custom element, make sure to exclude it from component resol
5413
5447
  );
5414
5448
  }
5415
5449
  } else if (typeof source === "number") {
5416
- if (!Number.isInteger(source)) {
5417
- warn$1(`The v-for range expect an integer value but got ${source}.`);
5418
- }
5419
- ret = new Array(source);
5420
- for (let i = 0; i < source; i++) {
5421
- ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
5450
+ if (!Number.isInteger(source) || source < 0) {
5451
+ warn$1(
5452
+ `The v-for range expects a positive integer value but got ${source}.`
5453
+ );
5454
+ ret = [];
5455
+ } else {
5456
+ ret = new Array(source);
5457
+ for (let i = 0; i < source; i++) {
5458
+ ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
5459
+ }
5422
5460
  }
5423
5461
  } else if (isObject(source)) {
5424
5462
  if (source[Symbol.iterator]) {
@@ -5869,6 +5907,7 @@ If this is a native custom element, make sure to exclude it from component resol
5869
5907
  }
5870
5908
  function withAsyncContext(getAwaitable) {
5871
5909
  const ctx = getCurrentInstance();
5910
+ const inSSRSetup = isInSSRComponentSetup;
5872
5911
  if (!ctx) {
5873
5912
  warn$1(
5874
5913
  `withAsyncContext called without active current instance. This is likely a bug.`
@@ -5876,13 +5915,36 @@ If this is a native custom element, make sure to exclude it from component resol
5876
5915
  }
5877
5916
  let awaitable = getAwaitable();
5878
5917
  unsetCurrentInstance();
5918
+ if (inSSRSetup) {
5919
+ setInSSRSetupState(false);
5920
+ }
5921
+ const restore = () => {
5922
+ setCurrentInstance(ctx);
5923
+ if (inSSRSetup) {
5924
+ setInSSRSetupState(true);
5925
+ }
5926
+ };
5927
+ const cleanup = () => {
5928
+ if (getCurrentInstance() !== ctx) ctx.scope.off();
5929
+ unsetCurrentInstance();
5930
+ if (inSSRSetup) {
5931
+ setInSSRSetupState(false);
5932
+ }
5933
+ };
5879
5934
  if (isPromise(awaitable)) {
5880
5935
  awaitable = awaitable.catch((e) => {
5881
- setCurrentInstance(ctx);
5936
+ restore();
5937
+ Promise.resolve().then(() => Promise.resolve().then(cleanup));
5882
5938
  throw e;
5883
5939
  });
5884
5940
  }
5885
- return [awaitable, () => setCurrentInstance(ctx)];
5941
+ return [
5942
+ awaitable,
5943
+ () => {
5944
+ restore();
5945
+ Promise.resolve().then(cleanup);
5946
+ }
5947
+ ];
5886
5948
  }
5887
5949
 
5888
5950
  function createDuplicateChecker() {
@@ -6944,7 +7006,7 @@ If you want to remount the same app, move your app creation logic into a factory
6944
7006
  const dynamicProps = nextVNode.dynamicProps;
6945
7007
  for (let i = 0; i < dynamicProps.length; i++) {
6946
7008
  const key = dynamicProps[i];
6947
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
7009
+ if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emits, key)) {
6948
7010
  return true;
6949
7011
  }
6950
7012
  }
@@ -6975,12 +7037,20 @@ If you want to remount the same app, move your app creation logic into a factory
6975
7037
  }
6976
7038
  for (let i = 0; i < nextKeys.length; i++) {
6977
7039
  const key = nextKeys[i];
6978
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
7040
+ if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emitsOptions, key)) {
6979
7041
  return true;
6980
7042
  }
6981
7043
  }
6982
7044
  return false;
6983
7045
  }
7046
+ function hasPropValueChanged(nextProps, prevProps, key) {
7047
+ const nextProp = nextProps[key];
7048
+ const prevProp = prevProps[key];
7049
+ if (key === "style" && isObject(nextProp) && isObject(prevProp)) {
7050
+ return !looseEqual(nextProp, prevProp);
7051
+ }
7052
+ return nextProp !== prevProp;
7053
+ }
6984
7054
  function updateHOCHostEl({ vnode, parent }, el) {
6985
7055
  while (parent) {
6986
7056
  const root = parent.subTree;
@@ -7684,15 +7754,7 @@ If you want to remount the same app, move your app creation logic into a factory
7684
7754
  } else {
7685
7755
  const el = n2.el = n1.el;
7686
7756
  if (n2.children !== n1.children) {
7687
- if (isHmrUpdating && n2.patchFlag === -1 && "__elIndex" in n1) {
7688
- const childNodes = container.childNodes;
7689
- const newChild = hostCreateText(n2.children);
7690
- const oldChild = childNodes[n2.__elIndex = n1.__elIndex];
7691
- hostInsert(newChild, container, oldChild);
7692
- hostRemove(oldChild);
7693
- } else {
7694
- hostSetText(el, n2.children);
7695
- }
7757
+ hostSetText(el, n2.children);
7696
7758
  }
7697
7759
  }
7698
7760
  };
@@ -7768,7 +7830,7 @@ If you want to remount the same app, move your app creation logic into a factory
7768
7830
  optimized
7769
7831
  );
7770
7832
  } else {
7771
- const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
7833
+ const customElement = n1.el && n1.el._isVueCE ? n1.el : null;
7772
7834
  try {
7773
7835
  if (customElement) {
7774
7836
  customElement._beginPatch();
@@ -8250,9 +8312,11 @@ If you want to remount the same app, move your app creation logic into a factory
8250
8312
  hydrateSubTree();
8251
8313
  }
8252
8314
  } else {
8253
- if (root.ce && // @ts-expect-error _def is private
8254
- root.ce._def.shadowRoot !== false) {
8255
- root.ce._injectChildStyle(type);
8315
+ if (root.ce && root.ce._hasShadowRoot()) {
8316
+ root.ce._injectChildStyle(
8317
+ type,
8318
+ instance.parent ? instance.parent.type : void 0
8319
+ );
8256
8320
  }
8257
8321
  {
8258
8322
  startMeasure(instance, `render`);
@@ -8306,9 +8370,9 @@ If you want to remount the same app, move your app creation logic into a factory
8306
8370
  updateComponentPreRender(instance, next, optimized);
8307
8371
  }
8308
8372
  nonHydratedAsyncRoot.asyncDep.then(() => {
8309
- if (!instance.isUnmounted) {
8310
- componentUpdateFn();
8311
- }
8373
+ queuePostRenderEffect(() => {
8374
+ if (!instance.isUnmounted) update();
8375
+ }, parentSuspense);
8312
8376
  });
8313
8377
  return;
8314
8378
  }
@@ -9005,12 +9069,10 @@ If you want to remount the same app, move your app creation logic into a factory
9005
9069
  traverseStaticChildren(c1, c2);
9006
9070
  }
9007
9071
  if (c2.type === Text) {
9008
- if (c2.patchFlag !== -1) {
9009
- c2.el = c1.el;
9010
- } else {
9011
- c2.__elIndex = i + // take fragment start anchor into account
9012
- (n1.type === Fragment ? 1 : 0);
9072
+ if (c2.patchFlag === -1) {
9073
+ c2 = ch2[i] = cloneIfMounted(c2);
9013
9074
  }
9075
+ c2.el = c1.el;
9014
9076
  }
9015
9077
  if (c2.type === Comment && !c2.el) {
9016
9078
  c2.el = c1.el;
@@ -10722,7 +10784,7 @@ Component that was made reactive: `,
10722
10784
  return true;
10723
10785
  }
10724
10786
 
10725
- const version = "3.5.27";
10787
+ const version = "3.5.30";
10726
10788
  const warn = warn$1 ;
10727
10789
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10728
10790
  const devtools = devtools$1 ;
@@ -11500,7 +11562,9 @@ Expected function or array of functions, received type ${typeof value}.`
11500
11562
  }
11501
11563
  } else if (
11502
11564
  // #11081 force set props for possible async custom element
11503
- el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))
11565
+ el._isVueCE && // #12408 check if it's declared prop or it's async custom element
11566
+ (shouldSetAsPropForVueCE(el, key) || // @ts-expect-error _def is private
11567
+ el._def.__asyncLoader && (/[A-Z]/.test(key) || !isString(nextValue)))
11504
11568
  ) {
11505
11569
  patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
11506
11570
  } else {
@@ -11548,6 +11612,17 @@ Expected function or array of functions, received type ${typeof value}.`
11548
11612
  }
11549
11613
  return key in el;
11550
11614
  }
11615
+ function shouldSetAsPropForVueCE(el, key) {
11616
+ const props = (
11617
+ // @ts-expect-error _def is private
11618
+ el._def.props
11619
+ );
11620
+ if (!props) {
11621
+ return false;
11622
+ }
11623
+ const camelKey = camelize(key);
11624
+ return Array.isArray(props) ? props.some((prop) => camelize(prop) === camelKey) : Object.keys(props).some((prop) => camelize(prop) === camelKey);
11625
+ }
11551
11626
 
11552
11627
  const REMOVAL = {};
11553
11628
  // @__NO_SIDE_EFFECTS__
@@ -11592,6 +11667,7 @@ Expected function or array of functions, received type ${typeof value}.`
11592
11667
  this._dirty = false;
11593
11668
  this._numberProps = null;
11594
11669
  this._styleChildren = /* @__PURE__ */ new WeakSet();
11670
+ this._styleAnchors = /* @__PURE__ */ new WeakMap();
11595
11671
  this._ob = null;
11596
11672
  if (this.shadowRoot && _createApp !== createApp) {
11597
11673
  this._root = this.shadowRoot;
@@ -11620,7 +11696,8 @@ Expected function or array of functions, received type ${typeof value}.`
11620
11696
  }
11621
11697
  this._connected = true;
11622
11698
  let parent = this;
11623
- while (parent = parent && (parent.parentNode || parent.host)) {
11699
+ while (parent = parent && // #12479 should check assignedSlot first to get correct parent
11700
+ (parent.assignedSlot || parent.parentNode || parent.host)) {
11624
11701
  if (parent instanceof VueElement) {
11625
11702
  this._parent = parent;
11626
11703
  break;
@@ -11842,6 +11919,7 @@ Expected function or array of functions, received type ${typeof value}.`
11842
11919
  this._styles.forEach((s) => this._root.removeChild(s));
11843
11920
  this._styles.length = 0;
11844
11921
  }
11922
+ this._styleAnchors.delete(this._def);
11845
11923
  this._applyStyles(newStyles);
11846
11924
  this._instance = null;
11847
11925
  this._update();
@@ -11866,7 +11944,7 @@ Expected function or array of functions, received type ${typeof value}.`
11866
11944
  }
11867
11945
  return vnode;
11868
11946
  }
11869
- _applyStyles(styles, owner) {
11947
+ _applyStyles(styles, owner, parentComp) {
11870
11948
  if (!styles) return;
11871
11949
  if (owner) {
11872
11950
  if (owner === this._def || this._styleChildren.has(owner)) {
@@ -11875,11 +11953,19 @@ Expected function or array of functions, received type ${typeof value}.`
11875
11953
  this._styleChildren.add(owner);
11876
11954
  }
11877
11955
  const nonce = this._nonce;
11956
+ const root = this.shadowRoot;
11957
+ const insertionAnchor = parentComp ? this._getStyleAnchor(parentComp) || this._getStyleAnchor(this._def) : this._getRootStyleInsertionAnchor(root);
11958
+ let last = null;
11878
11959
  for (let i = styles.length - 1; i >= 0; i--) {
11879
11960
  const s = document.createElement("style");
11880
11961
  if (nonce) s.setAttribute("nonce", nonce);
11881
11962
  s.textContent = styles[i];
11882
- this.shadowRoot.prepend(s);
11963
+ root.insertBefore(s, last || insertionAnchor);
11964
+ last = s;
11965
+ if (i === 0) {
11966
+ if (!parentComp) this._styleAnchors.set(this._def, s);
11967
+ if (owner) this._styleAnchors.set(owner, s);
11968
+ }
11883
11969
  {
11884
11970
  if (owner) {
11885
11971
  if (owner.__hmrId) {
@@ -11896,6 +11982,28 @@ Expected function or array of functions, received type ${typeof value}.`
11896
11982
  }
11897
11983
  }
11898
11984
  }
11985
+ _getStyleAnchor(comp) {
11986
+ if (!comp) {
11987
+ return null;
11988
+ }
11989
+ const anchor = this._styleAnchors.get(comp);
11990
+ if (anchor && anchor.parentNode === this.shadowRoot) {
11991
+ return anchor;
11992
+ }
11993
+ if (anchor) {
11994
+ this._styleAnchors.delete(comp);
11995
+ }
11996
+ return null;
11997
+ }
11998
+ _getRootStyleInsertionAnchor(root) {
11999
+ for (let i = 0; i < root.childNodes.length; i++) {
12000
+ const node = root.childNodes[i];
12001
+ if (!(node instanceof HTMLStyleElement)) {
12002
+ return node;
12003
+ }
12004
+ }
12005
+ return null;
12006
+ }
11899
12007
  /**
11900
12008
  * Only called when shadowRoot is false
11901
12009
  */
@@ -11958,8 +12066,8 @@ Expected function or array of functions, received type ${typeof value}.`
11958
12066
  /**
11959
12067
  * @internal
11960
12068
  */
11961
- _injectChildStyle(comp) {
11962
- this._applyStyles(comp.styles, comp);
12069
+ _injectChildStyle(comp, parentComp) {
12070
+ this._applyStyles(comp.styles, comp, parentComp);
11963
12071
  }
11964
12072
  /**
11965
12073
  * @internal
@@ -11977,12 +12085,19 @@ Expected function or array of functions, received type ${typeof value}.`
11977
12085
  this._update();
11978
12086
  }
11979
12087
  }
12088
+ /**
12089
+ * @internal
12090
+ */
12091
+ _hasShadowRoot() {
12092
+ return this._def.shadowRoot !== false;
12093
+ }
11980
12094
  /**
11981
12095
  * @internal
11982
12096
  */
11983
12097
  _removeChildStyle(comp) {
11984
12098
  {
11985
12099
  this._styleChildren.delete(comp);
12100
+ this._styleAnchors.delete(comp);
11986
12101
  if (this._childStyles && comp.__hmrId) {
11987
12102
  const oldStyles = this._childStyles.get(comp.__hmrId);
11988
12103
  if (oldStyles) {
@@ -12099,10 +12214,7 @@ Expected function or array of functions, received type ${typeof value}.`
12099
12214
  instance
12100
12215
  )
12101
12216
  );
12102
- positionMap.set(child, {
12103
- left: child.el.offsetLeft,
12104
- top: child.el.offsetTop
12105
- });
12217
+ positionMap.set(child, getPosition(child.el));
12106
12218
  }
12107
12219
  }
12108
12220
  }
@@ -12133,10 +12245,7 @@ Expected function or array of functions, received type ${typeof value}.`
12133
12245
  }
12134
12246
  }
12135
12247
  function recordPosition(c) {
12136
- newPositionMap.set(c, {
12137
- left: c.el.offsetLeft,
12138
- top: c.el.offsetTop
12139
- });
12248
+ newPositionMap.set(c, getPosition(c.el));
12140
12249
  }
12141
12250
  function applyTranslation(c) {
12142
12251
  const oldPos = positionMap.get(c);
@@ -12144,12 +12253,29 @@ Expected function or array of functions, received type ${typeof value}.`
12144
12253
  const dx = oldPos.left - newPos.left;
12145
12254
  const dy = oldPos.top - newPos.top;
12146
12255
  if (dx || dy) {
12147
- const s = c.el.style;
12148
- s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
12256
+ const el = c.el;
12257
+ const s = el.style;
12258
+ const rect = el.getBoundingClientRect();
12259
+ let scaleX = 1;
12260
+ let scaleY = 1;
12261
+ if (el.offsetWidth) scaleX = rect.width / el.offsetWidth;
12262
+ if (el.offsetHeight) scaleY = rect.height / el.offsetHeight;
12263
+ if (!Number.isFinite(scaleX) || scaleX === 0) scaleX = 1;
12264
+ if (!Number.isFinite(scaleY) || scaleY === 0) scaleY = 1;
12265
+ if (Math.abs(scaleX - 1) < 0.01) scaleX = 1;
12266
+ if (Math.abs(scaleY - 1) < 0.01) scaleY = 1;
12267
+ s.transform = s.webkitTransform = `translate(${dx / scaleX}px,${dy / scaleY}px)`;
12149
12268
  s.transitionDuration = "0s";
12150
12269
  return c;
12151
12270
  }
12152
12271
  }
12272
+ function getPosition(el) {
12273
+ const rect = el.getBoundingClientRect();
12274
+ return {
12275
+ left: rect.left,
12276
+ top: rect.top
12277
+ };
12278
+ }
12153
12279
  function hasCSSTransform(el, root, moveClass) {
12154
12280
  const clone = el.cloneNode();
12155
12281
  const _vtc = el[vtcKey];
@@ -12426,6 +12552,7 @@ Expected function or array of functions, received type ${typeof value}.`
12426
12552
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
12427
12553
  };
12428
12554
  const withModifiers = (fn, modifiers) => {
12555
+ if (!fn) return fn;
12429
12556
  const cache = fn._withMods || (fn._withMods = {});
12430
12557
  const cacheKey = modifiers.join(".");
12431
12558
  return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {