@vue/compat 3.5.28 → 3.5.30

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.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.28
2
+ * @vue/compat v3.5.30
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1331,10 +1331,17 @@ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1331
1331
  }
1332
1332
  function reduce(self, method, fn, args) {
1333
1333
  const arr = shallowReadArray(self);
1334
+ const needsWrap = arr !== self && !isShallow(self);
1334
1335
  let wrappedFn = fn;
1336
+ let wrapInitialAccumulator = false;
1335
1337
  if (arr !== self) {
1336
- if (!isShallow(self)) {
1338
+ if (needsWrap) {
1339
+ wrapInitialAccumulator = args.length === 0;
1337
1340
  wrappedFn = function(acc, item, index) {
1341
+ if (wrapInitialAccumulator) {
1342
+ wrapInitialAccumulator = false;
1343
+ acc = toWrapped(self, acc);
1344
+ }
1338
1345
  return fn.call(this, acc, toWrapped(self, item), index, self);
1339
1346
  };
1340
1347
  } else if (fn.length > 3) {
@@ -1343,7 +1350,8 @@ function reduce(self, method, fn, args) {
1343
1350
  };
1344
1351
  }
1345
1352
  }
1346
- return arr[method](wrappedFn, ...args);
1353
+ const result = arr[method](wrappedFn, ...args);
1354
+ return wrapInitialAccumulator ? toWrapped(self, result) : result;
1347
1355
  }
1348
1356
  function searchProxy(self, method, args) {
1349
1357
  const arr = toRaw(self);
@@ -1633,15 +1641,14 @@ function createInstrumentations(readonly, shallow) {
1633
1641
  clear: createReadonlyMethod("clear")
1634
1642
  } : {
1635
1643
  add(value) {
1636
- if (!shallow && !isShallow(value) && !isReadonly(value)) {
1637
- value = toRaw(value);
1638
- }
1639
1644
  const target = toRaw(this);
1640
1645
  const proto = getProto(target);
1641
- const hadKey = proto.has.call(target, value);
1646
+ const rawValue = toRaw(value);
1647
+ const valueToAdd = !shallow && !isShallow(value) && !isReadonly(value) ? rawValue : value;
1648
+ const hadKey = proto.has.call(target, valueToAdd) || hasChanged(value, valueToAdd) && proto.has.call(target, value) || hasChanged(rawValue, valueToAdd) && proto.has.call(target, rawValue);
1642
1649
  if (!hadKey) {
1643
- target.add(value);
1644
- trigger(target, "add", value, value);
1650
+ target.add(valueToAdd);
1651
+ trigger(target, "add", valueToAdd, valueToAdd);
1645
1652
  }
1646
1653
  return this;
1647
1654
  },
@@ -4359,6 +4366,7 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
4359
4366
  callHook(hook, [el]);
4360
4367
  },
4361
4368
  enter(el) {
4369
+ if (leavingVNodesCache[key] === vnode) return;
4362
4370
  let hook = onEnter;
4363
4371
  let afterHook = onAfterEnter;
4364
4372
  let cancelHook = onEnterCancelled;
@@ -6283,12 +6291,16 @@ function renderList(source, renderItem, cache, index) {
6283
6291
  );
6284
6292
  }
6285
6293
  } else if (typeof source === "number") {
6286
- if (!Number.isInteger(source)) {
6287
- warn$1(`The v-for range expect an integer value but got ${source}.`);
6288
- }
6289
- ret = new Array(source);
6290
- for (let i = 0; i < source; i++) {
6291
- ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
6294
+ if (!Number.isInteger(source) || source < 0) {
6295
+ warn$1(
6296
+ `The v-for range expects a positive integer value but got ${source}.`
6297
+ );
6298
+ ret = [];
6299
+ } else {
6300
+ ret = new Array(source);
6301
+ for (let i = 0; i < source; i++) {
6302
+ ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
6303
+ }
6292
6304
  }
6293
6305
  } else if (isObject(source)) {
6294
6306
  if (source[Symbol.iterator]) {
@@ -6991,6 +7003,7 @@ function createPropsRestProxy(props, excludedKeys) {
6991
7003
  }
6992
7004
  function withAsyncContext(getAwaitable) {
6993
7005
  const ctx = getCurrentInstance();
7006
+ const inSSRSetup = isInSSRComponentSetup;
6994
7007
  if (!ctx) {
6995
7008
  warn$1(
6996
7009
  `withAsyncContext called without active current instance. This is likely a bug.`
@@ -6998,13 +7011,36 @@ function withAsyncContext(getAwaitable) {
6998
7011
  }
6999
7012
  let awaitable = getAwaitable();
7000
7013
  unsetCurrentInstance();
7014
+ if (inSSRSetup) {
7015
+ setInSSRSetupState(false);
7016
+ }
7017
+ const restore = () => {
7018
+ setCurrentInstance(ctx);
7019
+ if (inSSRSetup) {
7020
+ setInSSRSetupState(true);
7021
+ }
7022
+ };
7023
+ const cleanup = () => {
7024
+ if (getCurrentInstance() !== ctx) ctx.scope.off();
7025
+ unsetCurrentInstance();
7026
+ if (inSSRSetup) {
7027
+ setInSSRSetupState(false);
7028
+ }
7029
+ };
7001
7030
  if (isPromise(awaitable)) {
7002
7031
  awaitable = awaitable.catch((e) => {
7003
- setCurrentInstance(ctx);
7032
+ restore();
7033
+ Promise.resolve().then(() => Promise.resolve().then(cleanup));
7004
7034
  throw e;
7005
7035
  });
7006
7036
  }
7007
- return [awaitable, () => setCurrentInstance(ctx)];
7037
+ return [
7038
+ awaitable,
7039
+ () => {
7040
+ restore();
7041
+ Promise.resolve().then(cleanup);
7042
+ }
7043
+ ];
7008
7044
  }
7009
7045
 
7010
7046
  function createDuplicateChecker() {
@@ -7525,7 +7561,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7525
7561
  return vm;
7526
7562
  }
7527
7563
  }
7528
- Vue.version = `2.6.14-compat:${"3.5.28"}`;
7564
+ Vue.version = `2.6.14-compat:${"3.5.30"}`;
7529
7565
  Vue.config = singletonApp.config;
7530
7566
  Vue.use = (plugin, ...options) => {
7531
7567
  if (plugin && isFunction(plugin.install)) {
@@ -10022,7 +10058,10 @@ function baseCreateRenderer(options, createHydrationFns) {
10022
10058
  }
10023
10059
  } else {
10024
10060
  if (root.ce && root.ce._hasShadowRoot()) {
10025
- root.ce._injectChildStyle(type);
10061
+ root.ce._injectChildStyle(
10062
+ type,
10063
+ instance.parent ? instance.parent.type : void 0
10064
+ );
10026
10065
  }
10027
10066
  {
10028
10067
  startMeasure(instance, `render`);
@@ -12613,7 +12652,7 @@ function isMemoSame(cached, memo) {
12613
12652
  return true;
12614
12653
  }
12615
12654
 
12616
- const version = "3.5.28";
12655
+ const version = "3.5.30";
12617
12656
  const warn = warn$1 ;
12618
12657
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12619
12658
  const devtools = devtools$1 ;
@@ -13430,7 +13469,9 @@ const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) =>
13430
13469
  }
13431
13470
  } else if (
13432
13471
  // #11081 force set props for possible async custom element
13433
- el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))
13472
+ el._isVueCE && // #12408 check if it's declared prop or it's async custom element
13473
+ (shouldSetAsPropForVueCE(el, key) || // @ts-expect-error _def is private
13474
+ el._def.__asyncLoader && (/[A-Z]/.test(key) || !isString(nextValue)))
13434
13475
  ) {
13435
13476
  patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
13436
13477
  } else {
@@ -13478,6 +13519,17 @@ function shouldSetAsProp(el, key, value, isSVG) {
13478
13519
  }
13479
13520
  return key in el;
13480
13521
  }
13522
+ function shouldSetAsPropForVueCE(el, key) {
13523
+ const props = (
13524
+ // @ts-expect-error _def is private
13525
+ el._def.props
13526
+ );
13527
+ if (!props) {
13528
+ return false;
13529
+ }
13530
+ const camelKey = camelize(key);
13531
+ return Array.isArray(props) ? props.some((prop) => camelize(prop) === camelKey) : Object.keys(props).some((prop) => camelize(prop) === camelKey);
13532
+ }
13481
13533
 
13482
13534
  const REMOVAL = {};
13483
13535
  // @__NO_SIDE_EFFECTS__
@@ -13522,6 +13574,7 @@ class VueElement extends BaseClass {
13522
13574
  this._dirty = false;
13523
13575
  this._numberProps = null;
13524
13576
  this._styleChildren = /* @__PURE__ */ new WeakSet();
13577
+ this._styleAnchors = /* @__PURE__ */ new WeakMap();
13525
13578
  this._ob = null;
13526
13579
  if (this.shadowRoot && _createApp !== createApp) {
13527
13580
  this._root = this.shadowRoot;
@@ -13550,7 +13603,8 @@ class VueElement extends BaseClass {
13550
13603
  }
13551
13604
  this._connected = true;
13552
13605
  let parent = this;
13553
- while (parent = parent && (parent.parentNode || parent.host)) {
13606
+ while (parent = parent && // #12479 should check assignedSlot first to get correct parent
13607
+ (parent.assignedSlot || parent.parentNode || parent.host)) {
13554
13608
  if (parent instanceof VueElement) {
13555
13609
  this._parent = parent;
13556
13610
  break;
@@ -13772,6 +13826,7 @@ class VueElement extends BaseClass {
13772
13826
  this._styles.forEach((s) => this._root.removeChild(s));
13773
13827
  this._styles.length = 0;
13774
13828
  }
13829
+ this._styleAnchors.delete(this._def);
13775
13830
  this._applyStyles(newStyles);
13776
13831
  this._instance = null;
13777
13832
  this._update();
@@ -13796,7 +13851,7 @@ class VueElement extends BaseClass {
13796
13851
  }
13797
13852
  return vnode;
13798
13853
  }
13799
- _applyStyles(styles, owner) {
13854
+ _applyStyles(styles, owner, parentComp) {
13800
13855
  if (!styles) return;
13801
13856
  if (owner) {
13802
13857
  if (owner === this._def || this._styleChildren.has(owner)) {
@@ -13805,11 +13860,19 @@ class VueElement extends BaseClass {
13805
13860
  this._styleChildren.add(owner);
13806
13861
  }
13807
13862
  const nonce = this._nonce;
13863
+ const root = this.shadowRoot;
13864
+ const insertionAnchor = parentComp ? this._getStyleAnchor(parentComp) || this._getStyleAnchor(this._def) : this._getRootStyleInsertionAnchor(root);
13865
+ let last = null;
13808
13866
  for (let i = styles.length - 1; i >= 0; i--) {
13809
13867
  const s = document.createElement("style");
13810
13868
  if (nonce) s.setAttribute("nonce", nonce);
13811
13869
  s.textContent = styles[i];
13812
- this.shadowRoot.prepend(s);
13870
+ root.insertBefore(s, last || insertionAnchor);
13871
+ last = s;
13872
+ if (i === 0) {
13873
+ if (!parentComp) this._styleAnchors.set(this._def, s);
13874
+ if (owner) this._styleAnchors.set(owner, s);
13875
+ }
13813
13876
  {
13814
13877
  if (owner) {
13815
13878
  if (owner.__hmrId) {
@@ -13826,6 +13889,28 @@ class VueElement extends BaseClass {
13826
13889
  }
13827
13890
  }
13828
13891
  }
13892
+ _getStyleAnchor(comp) {
13893
+ if (!comp) {
13894
+ return null;
13895
+ }
13896
+ const anchor = this._styleAnchors.get(comp);
13897
+ if (anchor && anchor.parentNode === this.shadowRoot) {
13898
+ return anchor;
13899
+ }
13900
+ if (anchor) {
13901
+ this._styleAnchors.delete(comp);
13902
+ }
13903
+ return null;
13904
+ }
13905
+ _getRootStyleInsertionAnchor(root) {
13906
+ for (let i = 0; i < root.childNodes.length; i++) {
13907
+ const node = root.childNodes[i];
13908
+ if (!(node instanceof HTMLStyleElement)) {
13909
+ return node;
13910
+ }
13911
+ }
13912
+ return null;
13913
+ }
13829
13914
  /**
13830
13915
  * Only called when shadowRoot is false
13831
13916
  */
@@ -13888,8 +13973,8 @@ class VueElement extends BaseClass {
13888
13973
  /**
13889
13974
  * @internal
13890
13975
  */
13891
- _injectChildStyle(comp) {
13892
- this._applyStyles(comp.styles, comp);
13976
+ _injectChildStyle(comp, parentComp) {
13977
+ this._applyStyles(comp.styles, comp, parentComp);
13893
13978
  }
13894
13979
  /**
13895
13980
  * @internal
@@ -13919,6 +14004,7 @@ class VueElement extends BaseClass {
13919
14004
  _removeChildStyle(comp) {
13920
14005
  {
13921
14006
  this._styleChildren.delete(comp);
14007
+ this._styleAnchors.delete(comp);
13922
14008
  if (this._childStyles && comp.__hmrId) {
13923
14009
  const oldStyles = this._childStyles.get(comp.__hmrId);
13924
14010
  if (oldStyles) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.28
2
+ * @vue/compat v3.5.30
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1176,10 +1176,17 @@ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1176
1176
  }
1177
1177
  function reduce(self, method, fn, args) {
1178
1178
  const arr = shallowReadArray(self);
1179
+ const needsWrap = arr !== self && !isShallow(self);
1179
1180
  let wrappedFn = fn;
1181
+ let wrapInitialAccumulator = false;
1180
1182
  if (arr !== self) {
1181
- if (!isShallow(self)) {
1183
+ if (needsWrap) {
1184
+ wrapInitialAccumulator = args.length === 0;
1182
1185
  wrappedFn = function(acc, item, index) {
1186
+ if (wrapInitialAccumulator) {
1187
+ wrapInitialAccumulator = false;
1188
+ acc = toWrapped(self, acc);
1189
+ }
1183
1190
  return fn.call(this, acc, toWrapped(self, item), index, self);
1184
1191
  };
1185
1192
  } else if (fn.length > 3) {
@@ -1188,7 +1195,8 @@ function reduce(self, method, fn, args) {
1188
1195
  };
1189
1196
  }
1190
1197
  }
1191
- return arr[method](wrappedFn, ...args);
1198
+ const result = arr[method](wrappedFn, ...args);
1199
+ return wrapInitialAccumulator ? toWrapped(self, result) : result;
1192
1200
  }
1193
1201
  function searchProxy(self, method, args) {
1194
1202
  const arr = toRaw(self);
@@ -1453,15 +1461,14 @@ function createInstrumentations(readonly, shallow) {
1453
1461
  clear: createReadonlyMethod("clear")
1454
1462
  } : {
1455
1463
  add(value) {
1456
- if (!shallow && !isShallow(value) && !isReadonly(value)) {
1457
- value = toRaw(value);
1458
- }
1459
1464
  const target = toRaw(this);
1460
1465
  const proto = getProto(target);
1461
- const hadKey = proto.has.call(target, value);
1466
+ const rawValue = toRaw(value);
1467
+ const valueToAdd = !shallow && !isShallow(value) && !isReadonly(value) ? rawValue : value;
1468
+ const hadKey = proto.has.call(target, valueToAdd) || hasChanged(value, valueToAdd) && proto.has.call(target, value) || hasChanged(rawValue, valueToAdd) && proto.has.call(target, rawValue);
1462
1469
  if (!hadKey) {
1463
- target.add(value);
1464
- trigger(target, "add", value, value);
1470
+ target.add(valueToAdd);
1471
+ trigger(target, "add", valueToAdd, valueToAdd);
1465
1472
  }
1466
1473
  return this;
1467
1474
  },
@@ -3384,6 +3391,7 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
3384
3391
  callHook(hook, [el]);
3385
3392
  },
3386
3393
  enter(el) {
3394
+ if (leavingVNodesCache[key] === vnode) return;
3387
3395
  let hook = onEnter;
3388
3396
  let afterHook = onAfterEnter;
3389
3397
  let cancelHook = onEnterCancelled;
@@ -5061,9 +5069,11 @@ function renderList(source, renderItem, cache, index) {
5061
5069
  );
5062
5070
  }
5063
5071
  } else if (typeof source === "number") {
5064
- ret = new Array(source);
5065
- for (let i = 0; i < source; i++) {
5066
- ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
5072
+ {
5073
+ ret = new Array(source);
5074
+ for (let i = 0; i < source; i++) {
5075
+ ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
5076
+ }
5067
5077
  }
5068
5078
  } else if (isObject(source)) {
5069
5079
  if (source[Symbol.iterator]) {
@@ -5615,15 +5625,39 @@ function createPropsRestProxy(props, excludedKeys) {
5615
5625
  }
5616
5626
  function withAsyncContext(getAwaitable) {
5617
5627
  const ctx = getCurrentInstance();
5628
+ const inSSRSetup = isInSSRComponentSetup;
5618
5629
  let awaitable = getAwaitable();
5619
5630
  unsetCurrentInstance();
5631
+ if (inSSRSetup) {
5632
+ setInSSRSetupState(false);
5633
+ }
5634
+ const restore = () => {
5635
+ setCurrentInstance(ctx);
5636
+ if (inSSRSetup) {
5637
+ setInSSRSetupState(true);
5638
+ }
5639
+ };
5640
+ const cleanup = () => {
5641
+ if (getCurrentInstance() !== ctx) ctx.scope.off();
5642
+ unsetCurrentInstance();
5643
+ if (inSSRSetup) {
5644
+ setInSSRSetupState(false);
5645
+ }
5646
+ };
5620
5647
  if (isPromise(awaitable)) {
5621
5648
  awaitable = awaitable.catch((e) => {
5622
- setCurrentInstance(ctx);
5649
+ restore();
5650
+ Promise.resolve().then(() => Promise.resolve().then(cleanup));
5623
5651
  throw e;
5624
5652
  });
5625
5653
  }
5626
- return [awaitable, () => setCurrentInstance(ctx)];
5654
+ return [
5655
+ awaitable,
5656
+ () => {
5657
+ restore();
5658
+ Promise.resolve().then(cleanup);
5659
+ }
5660
+ ];
5627
5661
  }
5628
5662
 
5629
5663
  let shouldCacheAccess = true;
@@ -6041,7 +6075,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6041
6075
  return vm;
6042
6076
  }
6043
6077
  }
6044
- Vue.version = `2.6.14-compat:${"3.5.28"}`;
6078
+ Vue.version = `2.6.14-compat:${"3.5.30"}`;
6045
6079
  Vue.config = singletonApp.config;
6046
6080
  Vue.use = (plugin, ...options) => {
6047
6081
  if (plugin && isFunction(plugin.install)) {
@@ -8015,7 +8049,10 @@ function baseCreateRenderer(options, createHydrationFns) {
8015
8049
  }
8016
8050
  } else {
8017
8051
  if (root.ce && root.ce._hasShadowRoot()) {
8018
- root.ce._injectChildStyle(type);
8052
+ root.ce._injectChildStyle(
8053
+ type,
8054
+ instance.parent ? instance.parent.type : void 0
8055
+ );
8019
8056
  }
8020
8057
  const subTree = instance.subTree = renderComponentRoot(instance);
8021
8058
  patch(
@@ -10153,7 +10190,7 @@ function isMemoSame(cached, memo) {
10153
10190
  return true;
10154
10191
  }
10155
10192
 
10156
- const version = "3.5.28";
10193
+ const version = "3.5.30";
10157
10194
  const warn$1 = NOOP;
10158
10195
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10159
10196
  const devtools = void 0;
@@ -10937,7 +10974,9 @@ const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) =>
10937
10974
  }
10938
10975
  } else if (
10939
10976
  // #11081 force set props for possible async custom element
10940
- el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))
10977
+ el._isVueCE && // #12408 check if it's declared prop or it's async custom element
10978
+ (shouldSetAsPropForVueCE(el, key) || // @ts-expect-error _def is private
10979
+ el._def.__asyncLoader && (/[A-Z]/.test(key) || !isString(nextValue)))
10941
10980
  ) {
10942
10981
  patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
10943
10982
  } else {
@@ -10985,6 +11024,17 @@ function shouldSetAsProp(el, key, value, isSVG) {
10985
11024
  }
10986
11025
  return key in el;
10987
11026
  }
11027
+ function shouldSetAsPropForVueCE(el, key) {
11028
+ const props = (
11029
+ // @ts-expect-error _def is private
11030
+ el._def.props
11031
+ );
11032
+ if (!props) {
11033
+ return false;
11034
+ }
11035
+ const camelKey = camelize(key);
11036
+ return Array.isArray(props) ? props.some((prop) => camelize(prop) === camelKey) : Object.keys(props).some((prop) => camelize(prop) === camelKey);
11037
+ }
10988
11038
 
10989
11039
  const REMOVAL = {};
10990
11040
  // @__NO_SIDE_EFFECTS__
@@ -11029,6 +11079,7 @@ class VueElement extends BaseClass {
11029
11079
  this._dirty = false;
11030
11080
  this._numberProps = null;
11031
11081
  this._styleChildren = /* @__PURE__ */ new WeakSet();
11082
+ this._styleAnchors = /* @__PURE__ */ new WeakMap();
11032
11083
  this._ob = null;
11033
11084
  if (this.shadowRoot && _createApp !== createApp) {
11034
11085
  this._root = this.shadowRoot;
@@ -11052,7 +11103,8 @@ class VueElement extends BaseClass {
11052
11103
  }
11053
11104
  this._connected = true;
11054
11105
  let parent = this;
11055
- while (parent = parent && (parent.parentNode || parent.host)) {
11106
+ while (parent = parent && // #12479 should check assignedSlot first to get correct parent
11107
+ (parent.assignedSlot || parent.parentNode || parent.host)) {
11056
11108
  if (parent instanceof VueElement) {
11057
11109
  this._parent = parent;
11058
11110
  break;
@@ -11278,7 +11330,7 @@ class VueElement extends BaseClass {
11278
11330
  }
11279
11331
  return vnode;
11280
11332
  }
11281
- _applyStyles(styles, owner) {
11333
+ _applyStyles(styles, owner, parentComp) {
11282
11334
  if (!styles) return;
11283
11335
  if (owner) {
11284
11336
  if (owner === this._def || this._styleChildren.has(owner)) {
@@ -11287,12 +11339,42 @@ class VueElement extends BaseClass {
11287
11339
  this._styleChildren.add(owner);
11288
11340
  }
11289
11341
  const nonce = this._nonce;
11342
+ const root = this.shadowRoot;
11343
+ const insertionAnchor = parentComp ? this._getStyleAnchor(parentComp) || this._getStyleAnchor(this._def) : this._getRootStyleInsertionAnchor(root);
11344
+ let last = null;
11290
11345
  for (let i = styles.length - 1; i >= 0; i--) {
11291
11346
  const s = document.createElement("style");
11292
11347
  if (nonce) s.setAttribute("nonce", nonce);
11293
11348
  s.textContent = styles[i];
11294
- this.shadowRoot.prepend(s);
11349
+ root.insertBefore(s, last || insertionAnchor);
11350
+ last = s;
11351
+ if (i === 0) {
11352
+ if (!parentComp) this._styleAnchors.set(this._def, s);
11353
+ if (owner) this._styleAnchors.set(owner, s);
11354
+ }
11355
+ }
11356
+ }
11357
+ _getStyleAnchor(comp) {
11358
+ if (!comp) {
11359
+ return null;
11295
11360
  }
11361
+ const anchor = this._styleAnchors.get(comp);
11362
+ if (anchor && anchor.parentNode === this.shadowRoot) {
11363
+ return anchor;
11364
+ }
11365
+ if (anchor) {
11366
+ this._styleAnchors.delete(comp);
11367
+ }
11368
+ return null;
11369
+ }
11370
+ _getRootStyleInsertionAnchor(root) {
11371
+ for (let i = 0; i < root.childNodes.length; i++) {
11372
+ const node = root.childNodes[i];
11373
+ if (!(node instanceof HTMLStyleElement)) {
11374
+ return node;
11375
+ }
11376
+ }
11377
+ return null;
11296
11378
  }
11297
11379
  /**
11298
11380
  * Only called when shadowRoot is false
@@ -11356,8 +11438,8 @@ class VueElement extends BaseClass {
11356
11438
  /**
11357
11439
  * @internal
11358
11440
  */
11359
- _injectChildStyle(comp) {
11360
- this._applyStyles(comp.styles, comp);
11441
+ _injectChildStyle(comp, parentComp) {
11442
+ this._applyStyles(comp.styles, comp, parentComp);
11361
11443
  }
11362
11444
  /**
11363
11445
  * @internal