@vue/runtime-dom 3.6.0-rc.8 → 3.6.0-rc.9

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/runtime-dom v3.6.0-rc.8
2
+ * @vue/runtime-dom v3.6.0-rc.9
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -360,50 +360,20 @@ const CSS_VAR_TEXT = Symbol(!!(process.env.NODE_ENV !== "production") ? "CSS_VAR
360
360
  */
361
361
  function useCssVars(getter) {
362
362
  const instance = getCurrentInstance();
363
- const getVars = () => getter(instance.proxy);
364
- const setVars = (vars) => {
365
- if (instance.ce) setVarsOnNode(instance.ce, vars);
366
- else setVarsOnVNode(instance.subTree, vars);
367
- };
368
- baseUseCssVars(instance, () => instance.subTree.el.parentNode, getVars, setVars);
369
- }
370
- function setVarsOnVNode(vnode, vars) {
371
- if (vnode.shapeFlag & 128) {
372
- const suspense = vnode.suspense;
373
- vnode = suspense.activeBranch;
374
- if (suspense.pendingBranch && !suspense.isHydrating) suspense.effects.push(() => {
375
- setVarsOnVNode(suspense.activeBranch, vars);
376
- });
377
- }
378
- while (vnode.component) vnode = vnode.component.subTree;
379
- if (vnode.shapeFlag & 1 && vnode.el) setVarsOnNode(vnode.el, vars);
380
- else if (vnode.type === Fragment) vnode.children.forEach((c) => setVarsOnVNode(c, vars));
381
- else if (vnode.type === Static) {
382
- let { el, anchor } = vnode;
383
- while (el) {
384
- setVarsOnNode(el, vars);
385
- if (el === anchor) break;
386
- el = el.nextSibling;
387
- }
388
- }
389
- }
390
- /**
391
- * @internal
392
- * shared between vdom and vapor
393
- */
394
- function baseUseCssVars(instance, getParentNode, getVars, setVars) {
395
363
  /* v8 ignore start */
396
364
  if (!instance) {
397
365
  process.env.NODE_ENV !== "production" && warn(`useCssVars is called without current active component instance.`);
398
366
  return;
399
367
  }
400
368
  /* v8 ignore stop */
369
+ const getVars = () => getter(instance.proxy);
401
370
  if (!!(process.env.NODE_ENV !== "production")) instance.getCssVars = getVars;
402
371
  const updateTeleports = instance.ut = (vars = getVars()) => {
403
372
  Array.from(document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)).forEach((node) => setVarsOnNode(node, vars));
404
373
  };
405
374
  const applyCssVars = (vars = getVars()) => {
406
- setVars(vars);
375
+ if (instance.ce) setVarsOnNode(instance.ce, vars);
376
+ else setVarsOnVNode(instance.subTree, vars);
407
377
  updateTeleports(vars);
408
378
  };
409
379
  onBeforeUpdate(() => {
@@ -416,10 +386,37 @@ function baseUseCssVars(instance, getParentNode, getVars, setVars) {
416
386
  applyCssVars(vars);
417
387
  }, NOOP, { flush: "post" });
418
388
  const ob = new MutationObserver(() => applyCssVars());
419
- ob.observe(getParentNode(), { childList: true });
389
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
420
390
  onUnmounted(() => ob.disconnect());
421
391
  });
422
392
  }
393
+ function setVarsOnVNode(vnode, vars) {
394
+ if (vnode.shapeFlag & 128) {
395
+ const suspense = vnode.suspense;
396
+ vnode = suspense.activeBranch;
397
+ if (suspense.pendingBranch && !suspense.isHydrating) suspense.effects.push(() => {
398
+ setVarsOnVNode(suspense.activeBranch, vars);
399
+ });
400
+ }
401
+ while (vnode.component) {
402
+ const component = vnode.component;
403
+ if (component.vapor) {
404
+ component.appContext.vapor.applyCssVars(vnode, vars);
405
+ return;
406
+ }
407
+ vnode = vnode.component.subTree;
408
+ }
409
+ if (vnode.shapeFlag & 1 && vnode.el) setVarsOnNode(vnode.el, vars);
410
+ else if (vnode.type === Fragment) vnode.children.forEach((c) => setVarsOnVNode(c, vars));
411
+ else if (vnode.type === Static) {
412
+ let { el, anchor } = vnode;
413
+ while (el) {
414
+ setVarsOnNode(el, vars);
415
+ if (el === anchor) break;
416
+ el = el.nextSibling;
417
+ }
418
+ }
419
+ }
423
420
  /**
424
421
  * @internal
425
422
  * shared between vdom and vapor
@@ -1675,4 +1672,4 @@ const initDirectivesForSSR = () => {
1675
1672
  }
1676
1673
  };
1677
1674
  //#endregion
1678
- export { Transition, TransitionGroup, TransitionPropsValidators, VueElement, VueElementBase, baseApplyTranslation, baseUseCssVars, callPendingCbs, createApp, createSSRApp, defineCustomElement, defineSSRCustomElement, ensureHydrationRenderer, ensureRenderer, forceReflow, handleMovedChildren, hasCSSTransform, hydrate, initDirectivesForSSR, nodeOps, normalizeContainer, parseEventName, patchProp, patchStyle, render, resolveTransitionProps, setVarsOnNode, shouldSetAsProp, shouldSetAsPropForVueCE, svgNS, unsafeToTrustedHTML, useCssModule, useCssVars, useHost, useShadowRoot, vModelCheckbox, vModelCheckboxInit, vModelCheckboxUpdate, vModelDynamic, getValue as vModelGetValue, vModelRadio, vModelSelect, vModelSelectInit, vModelSetSelected, vModelText, vModelTextInit, vModelTextUpdate, vShow, vShowHidden, vShowOriginalDisplay, withKeys, withModifiers, xlinkNS };
1675
+ export { Transition, TransitionGroup, TransitionPropsValidators, VueElement, VueElementBase, baseApplyTranslation, callPendingCbs, createApp, createSSRApp, defineCustomElement, defineSSRCustomElement, ensureHydrationRenderer, ensureRenderer, forceReflow, handleMovedChildren, hasCSSTransform, hydrate, initDirectivesForSSR, nodeOps, normalizeContainer, parseEventName, patchClass, patchProp, patchStyle, render, resolveTransitionProps, setVarsOnNode, shouldSetAsProp, shouldSetAsPropForVueCE, svgNS, unsafeToTrustedHTML, useCssModule, useCssVars, useHost, useShadowRoot, vModelCheckbox, vModelCheckboxInit, vModelCheckboxUpdate, vModelDynamic, getValue as vModelGetValue, vModelRadio, vModelSelect, vModelSelectInit, vModelSetSelected, vModelText, vModelTextInit, vModelTextUpdate, vShow, vShowHidden, vShowOriginalDisplay, withKeys, withModifiers, xlinkNS };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.6.0-rc.8
2
+ * @vue/runtime-dom v3.6.0-rc.9
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -149,10 +149,10 @@ var VueRuntimeDOM = (function(exports) {
149
149
  }
150
150
  const listDelimiterRE = /;(?![^(]*\))/g;
151
151
  const propertyDelimiterRE = /:([^]+)/;
152
- const styleCommentRE = /\/\*[^]*?\*\//g;
152
+ const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
153
153
  function parseStringStyle(cssText) {
154
154
  const ret = {};
155
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
155
+ cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
156
156
  if (item) {
157
157
  const tmp = item.split(propertyDelimiterRE);
158
158
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -274,19 +274,19 @@ var VueRuntimeDOM = (function(exports) {
274
274
  }
275
275
  //#endregion
276
276
  //#region packages/shared/src/looseEqual.ts
277
- function looseCompareArrays(a, b) {
277
+ function looseCompareArrays(a, b, seen) {
278
278
  if (a.length !== b.length) return false;
279
279
  let equal = true;
280
- for (let i = 0; equal && i < a.length; i++) equal = looseEqual(a[i], b[i]);
280
+ for (let i = 0; equal && i < a.length; i++) equal = looseEqual(a[i], b[i], seen);
281
281
  return equal;
282
282
  }
283
- function looseCompareCollections(a, b) {
283
+ function looseCompareCollections(a, b, seen) {
284
284
  if (a.size !== b.size) return false;
285
285
  const candidates = Array.from(b);
286
286
  const matched = new Uint8Array(candidates.length);
287
287
  for (const item of a) {
288
288
  let index = -1;
289
- for (let i = 0; i < candidates.length; i++) if (!matched[i] && looseEqual(item, candidates[i])) {
289
+ for (let i = 0; i < candidates.length; i++) if (!matched[i] && looseEqual(item, candidates[i], seen)) {
290
290
  index = i;
291
291
  break;
292
292
  }
@@ -295,7 +295,33 @@ var VueRuntimeDOM = (function(exports) {
295
295
  }
296
296
  return true;
297
297
  }
298
- function looseEqual(a, b) {
298
+ function looseCompareObjects(a, b, seen) {
299
+ let aValidType = isMap(a);
300
+ let bValidType = isMap(b);
301
+ if (aValidType || bValidType) return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
302
+ aValidType = isSet(a);
303
+ bValidType = isSet(b);
304
+ if (aValidType || bValidType) return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
305
+ if (Object.keys(a).length !== Object.keys(b).length) return false;
306
+ for (const key in a) {
307
+ const aHasKey = a.hasOwnProperty(key);
308
+ const bHasKey = b.hasOwnProperty(key);
309
+ if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) return false;
310
+ }
311
+ return String(a) === String(b);
312
+ }
313
+ function looseCompareNested(a, b, seen, compare) {
314
+ if (!seen) seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
315
+ const [seenA, seenB] = seen;
316
+ if (seenA.has(a) || seenB.has(b)) return seenA.get(a) === b && seenB.get(b) === a;
317
+ seenA.set(a, b);
318
+ seenB.set(b, a);
319
+ const equal = compare(a, b, seen);
320
+ seenA.delete(a);
321
+ seenB.delete(b);
322
+ return equal;
323
+ }
324
+ function looseEqual(a, b, seen) {
299
325
  if (a === b) return true;
300
326
  let aValidType = isDate(a);
301
327
  let bValidType = isDate(b);
@@ -305,23 +331,12 @@ var VueRuntimeDOM = (function(exports) {
305
331
  if (aValidType || bValidType) return a === b;
306
332
  aValidType = isArray(a);
307
333
  bValidType = isArray(b);
308
- if (aValidType || bValidType) return aValidType && bValidType ? looseCompareArrays(a, b) : false;
334
+ if (aValidType || bValidType) return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
309
335
  aValidType = isObject(a);
310
336
  bValidType = isObject(b);
311
337
  if (aValidType || bValidType) {
312
338
  if (!aValidType || !bValidType) return false;
313
- aValidType = isMap(a);
314
- bValidType = isMap(b);
315
- if (aValidType || bValidType) return aValidType && bValidType ? looseCompareCollections(a, b) : false;
316
- aValidType = isSet(a);
317
- bValidType = isSet(b);
318
- if (aValidType || bValidType) return aValidType && bValidType ? looseCompareCollections(a, b) : false;
319
- if (Object.keys(a).length !== Object.keys(b).length) return false;
320
- for (const key in a) {
321
- const aHasKey = a.hasOwnProperty(key);
322
- const bHasKey = b.hasOwnProperty(key);
323
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) return false;
324
- }
339
+ return looseCompareNested(a, b, seen, looseCompareObjects);
325
340
  }
326
341
  return String(a) === String(b);
327
342
  }
@@ -779,13 +794,17 @@ var VueRuntimeDOM = (function(exports) {
779
794
  /**
780
795
  * Track array iteration and return:
781
796
  * - if input is reactive: a cloned raw array with reactive values
782
- * - if input is non-reactive or shallowReactive: the original raw array
797
+ * - if input is readonly: a cloned raw array with readonly values, preserving
798
+ * reactivity
799
+ * - if input is raw or shallow: the original raw array
783
800
  */
784
801
  function reactiveReadArray(array) {
785
802
  const raw = /* @__PURE__ */ toRaw(array);
786
803
  if (raw === array) return raw;
787
804
  track(raw, "iterate", ARRAY_ITERATE_KEY);
788
- return /* @__PURE__ */ isShallow(array) ? raw : raw.map(toReactive);
805
+ if (/* @__PURE__ */ isShallow(array)) return raw;
806
+ if (!/* @__PURE__ */ isReadonly(array)) return raw.map(toReactive);
807
+ return /* @__PURE__ */ isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);
789
808
  }
790
809
  /**
791
810
  * Track array iteration and return raw array
@@ -3941,12 +3960,12 @@ var VueRuntimeDOM = (function(exports) {
3941
3960
  } else {
3942
3961
  mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
3943
3962
  const component = vnode.component;
3944
- if (!component.subTree && (isAsyncWrapper(vnode) || component.asyncDep && !component.asyncResolved)) {
3963
+ if (!component.subTree && (isAsyncWrapper(vnode) || component.asyncDep)) {
3945
3964
  let subTree;
3946
3965
  if (isFragmentStart) {
3947
3966
  subTree = createVNode(Static);
3948
3967
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
3949
- } else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
3968
+ } else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(node.nodeType === 8 ? Comment : "div");
3950
3969
  subTree.el = node;
3951
3970
  component.subTree = subTree;
3952
3971
  }
@@ -6573,6 +6592,10 @@ var VueRuntimeDOM = (function(exports) {
6573
6592
  optimized = false;
6574
6593
  n2.dynamicChildren = null;
6575
6594
  }
6595
+ if (n2.dynamicChildren && n1 && n1.dynamicChildren && n1.dynamicChildren.hasOnce) {
6596
+ if (n2.dynamicChildren === EMPTY_ARR) n2.dynamicChildren = [];
6597
+ n2.dynamicChildren.hasOnce = true;
6598
+ }
6576
6599
  const { type, ref, shapeFlag } = n2;
6577
6600
  switch (type) {
6578
6601
  case Text:
@@ -6889,6 +6912,7 @@ var VueRuntimeDOM = (function(exports) {
6889
6912
  if (shouldUpdateComponent(n1, n2, optimized)) {
6890
6913
  if (instance.asyncDep && !instance.asyncResolved) {
6891
6914
  pushWarningContext(n2);
6915
+ n2.el = n1.el;
6892
6916
  updateComponentPreRender(instance, n2, optimized);
6893
6917
  popWarningContext();
6894
6918
  return;
@@ -7197,13 +7221,13 @@ var VueRuntimeDOM = (function(exports) {
7197
7221
  };
7198
7222
  const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
7199
7223
  const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex, memo } = vnode;
7200
- if (patchFlag === -2) optimized = false;
7224
+ if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) optimized = false;
7201
7225
  if (ref != null) {
7202
7226
  const prevSub = setActiveSub();
7203
7227
  setRef(ref, null, parentSuspense, vnode, true);
7204
7228
  setActiveSub(prevSub);
7205
7229
  }
7206
- if (cacheIndex != null) parentComponent.renderCache[cacheIndex] = void 0;
7230
+ if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) parentComponent.renderCache[cacheIndex] = void 0;
7207
7231
  if (shapeFlag & 256) {
7208
7232
  if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer(), parentSuspense);
7209
7233
  else parentComponent.ctx.deactivate(vnode);
@@ -7257,6 +7281,7 @@ var VueRuntimeDOM = (function(exports) {
7257
7281
  }
7258
7282
  if (type === Static) {
7259
7283
  removeStaticNode(vnode);
7284
+ if (transition && !transition.persisted && transition.afterLeave) transition.afterLeave();
7260
7285
  return;
7261
7286
  }
7262
7287
  if (transition) performTransitionLeave(el, transition, () => hostRemove(el), !!(vnode.shapeFlag & 1));
@@ -7281,7 +7306,10 @@ var VueRuntimeDOM = (function(exports) {
7281
7306
  if (effect) {
7282
7307
  effect.stop();
7283
7308
  unmount(subTree, instance, parentSuspense, doRemove);
7284
- } else if (doRemove && subTree && instance.vnode.el) remove(subTree);
7309
+ } else if (instance.vnode.el && subTree) {
7310
+ subTree.transition = instance.vnode.transition;
7311
+ unmount(subTree, instance, parentSuspense, doRemove);
7312
+ }
7285
7313
  if (um) queuePostRenderEffect(um, void 0, parentSuspense);
7286
7314
  queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
7287
7315
  devtoolsComponentRemoved(instance);
@@ -7487,7 +7515,7 @@ var VueRuntimeDOM = (function(exports) {
7487
7515
  process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
7488
7516
  if (n1 == null) mountSuspense(n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals);
7489
7517
  else {
7490
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
7518
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
7491
7519
  n2.suspense = n1.suspense;
7492
7520
  n2.suspense.vnode = n2;
7493
7521
  n2.el = n1.el;
@@ -7525,7 +7553,9 @@ var VueRuntimeDOM = (function(exports) {
7525
7553
  if (pendingBranch) {
7526
7554
  suspense.pendingBranch = newBranch;
7527
7555
  if (isSameVNodeType(pendingBranch, newBranch)) {
7528
- patch(pendingBranch, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, namespace, slotScopeIds, optimized);
7556
+ suspense.deps++;
7557
+ patch(pendingBranch, newBranch, isHydrating ? container : suspense.hiddenContainer, null, parentComponent, suspense, namespace, slotScopeIds, optimized);
7558
+ suspense.deps--;
7529
7559
  if (suspense.deps <= 0) suspense.resolve();
7530
7560
  else if (isInFallback) {
7531
7561
  if (!isHydrating && !suspense.isFallbackMountPending) {
@@ -7661,6 +7691,7 @@ var VueRuntimeDOM = (function(exports) {
7661
7691
  suspense.effects = [];
7662
7692
  if (isSuspensible) {
7663
7693
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
7694
+ parentSuspenseId = void 0;
7664
7695
  parentSuspense.deps--;
7665
7696
  if (parentSuspense.deps === 0 && !sync) parentSuspense.resolve();
7666
7697
  }
@@ -7698,11 +7729,16 @@ var VueRuntimeDOM = (function(exports) {
7698
7729
  registerDep(instance, onResolve) {
7699
7730
  const isInPendingSuspense = !!suspense.pendingBranch;
7700
7731
  if (isInPendingSuspense) suspense.deps++;
7732
+ const hydratedEl = instance.vnode && instance.vnode.el;
7701
7733
  instance.asyncDep.catch((err) => {
7702
7734
  handleError(err, instance, 0);
7703
7735
  }).then((asyncSetupResult) => {
7704
7736
  if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) return;
7705
7737
  setCurrentInstance(null, void 0);
7738
+ if (hydratedEl && !instance.scope.active) {
7739
+ if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
7740
+ return;
7741
+ }
7706
7742
  instance.asyncResolved = true;
7707
7743
  onResolve(asyncSetupResult);
7708
7744
  if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
@@ -8015,7 +8051,8 @@ var VueRuntimeDOM = (function(exports) {
8015
8051
  vs: cloneVaporSlotMeta(vnode),
8016
8052
  vb: vnode.vb,
8017
8053
  ibu: vnode.ibu,
8018
- iu: vnode.iu
8054
+ iu: vnode.iu,
8055
+ cacheIndex: vnode.cacheIndex
8019
8056
  };
8020
8057
  if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
8021
8058
  return cloned;
@@ -8715,7 +8752,7 @@ var VueRuntimeDOM = (function(exports) {
8715
8752
  }
8716
8753
  //#endregion
8717
8754
  //#region packages/runtime-core/src/index.ts
8718
- const version = "3.6.0-rc.8";
8755
+ const version = "3.6.0-rc.9";
8719
8756
  const warn = warn$1;
8720
8757
  /**
8721
8758
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -9088,49 +9125,20 @@ var VueRuntimeDOM = (function(exports) {
9088
9125
  */
9089
9126
  function useCssVars(getter) {
9090
9127
  const instance = getCurrentInstance();
9091
- const getVars = () => getter(instance.proxy);
9092
- const setVars = (vars) => {
9093
- if (instance.ce) setVarsOnNode(instance.ce, vars);
9094
- else setVarsOnVNode(instance.subTree, vars);
9095
- };
9096
- baseUseCssVars(instance, () => instance.subTree.el.parentNode, getVars, setVars);
9097
- }
9098
- function setVarsOnVNode(vnode, vars) {
9099
- if (vnode.shapeFlag & 128) {
9100
- const suspense = vnode.suspense;
9101
- vnode = suspense.activeBranch;
9102
- if (suspense.pendingBranch && !suspense.isHydrating) suspense.effects.push(() => {
9103
- setVarsOnVNode(suspense.activeBranch, vars);
9104
- });
9105
- }
9106
- while (vnode.component) vnode = vnode.component.subTree;
9107
- if (vnode.shapeFlag & 1 && vnode.el) setVarsOnNode(vnode.el, vars);
9108
- else if (vnode.type === Fragment) vnode.children.forEach((c) => setVarsOnVNode(c, vars));
9109
- else if (vnode.type === Static) {
9110
- let { el, anchor } = vnode;
9111
- while (el) {
9112
- setVarsOnNode(el, vars);
9113
- if (el === anchor) break;
9114
- el = el.nextSibling;
9115
- }
9116
- }
9117
- }
9118
- /**
9119
- * @internal
9120
- * shared between vdom and vapor
9121
- */
9122
- function baseUseCssVars(instance, getParentNode, getVars, setVars) {
9123
9128
  /* v8 ignore start */
9124
9129
  if (!instance) {
9125
9130
  warn(`useCssVars is called without current active component instance.`);
9126
9131
  return;
9127
9132
  }
9133
+ /* v8 ignore stop */
9134
+ const getVars = () => getter(instance.proxy);
9128
9135
  instance.getCssVars = getVars;
9129
9136
  const updateTeleports = instance.ut = (vars = getVars()) => {
9130
9137
  Array.from(document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)).forEach((node) => setVarsOnNode(node, vars));
9131
9138
  };
9132
9139
  const applyCssVars = (vars = getVars()) => {
9133
- setVars(vars);
9140
+ if (instance.ce) setVarsOnNode(instance.ce, vars);
9141
+ else setVarsOnVNode(instance.subTree, vars);
9134
9142
  updateTeleports(vars);
9135
9143
  };
9136
9144
  onBeforeUpdate(() => {
@@ -9143,10 +9151,37 @@ var VueRuntimeDOM = (function(exports) {
9143
9151
  applyCssVars(vars);
9144
9152
  }, NOOP, { flush: "post" });
9145
9153
  const ob = new MutationObserver(() => applyCssVars());
9146
- ob.observe(getParentNode(), { childList: true });
9154
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
9147
9155
  onUnmounted(() => ob.disconnect());
9148
9156
  });
9149
9157
  }
9158
+ function setVarsOnVNode(vnode, vars) {
9159
+ if (vnode.shapeFlag & 128) {
9160
+ const suspense = vnode.suspense;
9161
+ vnode = suspense.activeBranch;
9162
+ if (suspense.pendingBranch && !suspense.isHydrating) suspense.effects.push(() => {
9163
+ setVarsOnVNode(suspense.activeBranch, vars);
9164
+ });
9165
+ }
9166
+ while (vnode.component) {
9167
+ const component = vnode.component;
9168
+ if (component.vapor) {
9169
+ component.appContext.vapor.applyCssVars(vnode, vars);
9170
+ return;
9171
+ }
9172
+ vnode = vnode.component.subTree;
9173
+ }
9174
+ if (vnode.shapeFlag & 1 && vnode.el) setVarsOnNode(vnode.el, vars);
9175
+ else if (vnode.type === Fragment) vnode.children.forEach((c) => setVarsOnVNode(c, vars));
9176
+ else if (vnode.type === Static) {
9177
+ let { el, anchor } = vnode;
9178
+ while (el) {
9179
+ setVarsOnNode(el, vars);
9180
+ if (el === anchor) break;
9181
+ el = el.nextSibling;
9182
+ }
9183
+ }
9184
+ }
9150
9185
  /**
9151
9186
  * @internal
9152
9187
  * shared between vdom and vapor