@vue/runtime-dom 3.5.0-alpha.5 → 3.5.0-beta.1

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.5.0-alpha.5
2
+ * @vue/runtime-dom v3.5.0-beta.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -61,9 +61,11 @@ const cacheStringFunction = (fn) => {
61
61
  };
62
62
  };
63
63
  const camelizeRE = /-(\w)/g;
64
- const camelize = cacheStringFunction((str) => {
65
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
66
- });
64
+ const camelize = cacheStringFunction(
65
+ (str) => {
66
+ return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
67
+ }
68
+ );
67
69
  const hyphenateRE = /\B([A-Z])/g;
68
70
  const hyphenate = cacheStringFunction(
69
71
  (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
@@ -71,10 +73,12 @@ const hyphenate = cacheStringFunction(
71
73
  const capitalize = cacheStringFunction((str) => {
72
74
  return str.charAt(0).toUpperCase() + str.slice(1);
73
75
  });
74
- const toHandlerKey = cacheStringFunction((str) => {
75
- const s = str ? `on${capitalize(str)}` : ``;
76
- return s;
77
- });
76
+ const toHandlerKey = cacheStringFunction(
77
+ (str) => {
78
+ const s = str ? `on${capitalize(str)}` : ``;
79
+ return s;
80
+ }
81
+ );
78
82
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
79
83
  const invokeArrayFns = (fns, ...arg) => {
80
84
  for (let i = 0; i < fns.length; i++) {
@@ -319,6 +323,7 @@ class EffectScope {
319
323
  * @internal
320
324
  */
321
325
  this.cleanups = [];
326
+ this._isPaused = false;
322
327
  this.parent = activeEffectScope;
323
328
  if (!detached && activeEffectScope) {
324
329
  this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
@@ -329,6 +334,37 @@ class EffectScope {
329
334
  get active() {
330
335
  return this._active;
331
336
  }
337
+ pause() {
338
+ if (this._active) {
339
+ this._isPaused = true;
340
+ if (this.scopes) {
341
+ for (let i = 0, l = this.scopes.length; i < l; i++) {
342
+ this.scopes[i].pause();
343
+ }
344
+ }
345
+ for (let i = 0, l = this.effects.length; i < l; i++) {
346
+ this.effects[i].pause();
347
+ }
348
+ }
349
+ }
350
+ /**
351
+ * Resumes the effect scope, including all child scopes and effects.
352
+ */
353
+ resume() {
354
+ if (this._active) {
355
+ if (this._isPaused) {
356
+ this._isPaused = false;
357
+ if (this.scopes) {
358
+ for (let i = 0, l = this.scopes.length; i < l; i++) {
359
+ this.scopes[i].resume();
360
+ }
361
+ }
362
+ for (let i = 0, l = this.effects.length; i < l; i++) {
363
+ this.effects[i].resume();
364
+ }
365
+ }
366
+ }
367
+ }
332
368
  run(fn) {
333
369
  if (this._active) {
334
370
  const currentEffectScope = activeEffectScope;
@@ -399,6 +435,7 @@ function onScopeDispose(fn, failSilently = false) {
399
435
  }
400
436
 
401
437
  let activeSub;
438
+ const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
402
439
  class ReactiveEffect {
403
440
  constructor(fn) {
404
441
  this.fn = fn;
@@ -427,6 +464,18 @@ class ReactiveEffect {
427
464
  activeEffectScope.effects.push(this);
428
465
  }
429
466
  }
467
+ pause() {
468
+ this.flags |= 128;
469
+ }
470
+ resume() {
471
+ if (this.flags & 128) {
472
+ this.flags &= ~128;
473
+ if (pausedQueueEffects.has(this)) {
474
+ pausedQueueEffects.delete(this);
475
+ this.trigger();
476
+ }
477
+ }
478
+ }
430
479
  /**
431
480
  * @internal
432
481
  */
@@ -480,7 +529,9 @@ class ReactiveEffect {
480
529
  }
481
530
  }
482
531
  trigger() {
483
- if (this.scheduler) {
532
+ if (this.flags & 128) {
533
+ pausedQueueEffects.add(this);
534
+ } else if (this.scheduler) {
484
535
  this.scheduler();
485
536
  } else {
486
537
  this.runIfDirty();
@@ -800,9 +851,15 @@ function addSub(link) {
800
851
  link.dep.subs = link;
801
852
  }
802
853
  const targetMap = /* @__PURE__ */ new WeakMap();
803
- const ITERATE_KEY = Symbol("Object iterate" );
804
- const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
805
- const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
854
+ const ITERATE_KEY = Symbol(
855
+ "Object iterate"
856
+ );
857
+ const MAP_KEY_ITERATE_KEY = Symbol(
858
+ "Map keys iterate"
859
+ );
860
+ const ARRAY_ITERATE_KEY = Symbol(
861
+ "Array iterate"
862
+ );
806
863
  function track(target, type, key) {
807
864
  if (shouldTrack && activeSub) {
808
865
  let depsMap = targetMap.get(target);
@@ -1092,7 +1149,7 @@ class BaseReactiveHandler {
1092
1149
  return isShallow2;
1093
1150
  } else if (key === "__v_raw") {
1094
1151
  if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
1095
- // this means the reciever is a user proxy of the reactive proxy
1152
+ // this means the receiver is a user proxy of the reactive proxy
1096
1153
  Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
1097
1154
  return target;
1098
1155
  }
@@ -1216,9 +1273,7 @@ class ReadonlyReactiveHandler extends BaseReactiveHandler {
1216
1273
  }
1217
1274
  const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
1218
1275
  const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
1219
- const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
1220
- true
1221
- );
1276
+ const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
1222
1277
  const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
1223
1278
 
1224
1279
  const toShallow = (value) => value;
@@ -1713,13 +1768,14 @@ function proxyRefs(objectWithRefs) {
1713
1768
  class CustomRefImpl {
1714
1769
  constructor(factory) {
1715
1770
  this["__v_isRef"] = true;
1771
+ this._value = void 0;
1716
1772
  const dep = this.dep = new Dep();
1717
1773
  const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
1718
1774
  this._get = get;
1719
1775
  this._set = set;
1720
1776
  }
1721
1777
  get value() {
1722
- return this._get();
1778
+ return this._value = this._get();
1723
1779
  }
1724
1780
  set value(newVal) {
1725
1781
  this._set(newVal);
@@ -1744,10 +1800,11 @@ class ObjectRefImpl {
1744
1800
  this._key = _key;
1745
1801
  this._defaultValue = _defaultValue;
1746
1802
  this["__v_isRef"] = true;
1803
+ this._value = void 0;
1747
1804
  }
1748
1805
  get value() {
1749
1806
  const val = this._object[this._key];
1750
- return val === void 0 ? this._defaultValue : val;
1807
+ return this._value = val === void 0 ? this._defaultValue : val;
1751
1808
  }
1752
1809
  set value(newVal) {
1753
1810
  this._object[this._key] = newVal;
@@ -1761,9 +1818,10 @@ class GetterRefImpl {
1761
1818
  this._getter = _getter;
1762
1819
  this["__v_isRef"] = true;
1763
1820
  this["__v_isReadonly"] = true;
1821
+ this._value = void 0;
1764
1822
  }
1765
1823
  get value() {
1766
- return this._getter();
1824
+ return this._value = this._getter();
1767
1825
  }
1768
1826
  }
1769
1827
  function toRef(source, key, defaultValue) {
@@ -1797,7 +1855,8 @@ class ComputedRefImpl {
1797
1855
  /**
1798
1856
  * @internal
1799
1857
  */
1800
- this["__v_isRef"] = true;
1858
+ this.__v_isRef = true;
1859
+ // TODO isolatedDeclarations "__v_isReadonly"
1801
1860
  // A computed is also a subscriber that tracks other deps
1802
1861
  /**
1803
1862
  * @internal
@@ -2422,6 +2481,9 @@ function reload(id, newComp) {
2422
2481
  "[HMR] Root or manually mounted instance modified. Full reload required."
2423
2482
  );
2424
2483
  }
2484
+ if (instance.root.ce && instance !== instance.root) {
2485
+ instance.root.ce._removeChildStyle(oldComp);
2486
+ }
2425
2487
  }
2426
2488
  queuePostFlushCb(() => {
2427
2489
  hmrDirtyComponents.clear();
@@ -2501,9 +2563,7 @@ function devtoolsInitApp(app, version) {
2501
2563
  function devtoolsUnmountApp(app) {
2502
2564
  emit$1("app:unmount" /* APP_UNMOUNT */, app);
2503
2565
  }
2504
- const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
2505
- "component:added" /* COMPONENT_ADDED */
2506
- );
2566
+ const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
2507
2567
  const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
2508
2568
  const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
2509
2569
  "component:removed" /* COMPONENT_REMOVED */
@@ -2527,12 +2587,8 @@ function createDevtoolsComponentHook(hook) {
2527
2587
  );
2528
2588
  };
2529
2589
  }
2530
- const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
2531
- "perf:start" /* PERFORMANCE_START */
2532
- );
2533
- const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
2534
- "perf:end" /* PERFORMANCE_END */
2535
- );
2590
+ const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
2591
+ const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
2536
2592
  function createDevtoolsPerformanceHook(hook) {
2537
2593
  return (component, type, time) => {
2538
2594
  emit$1(hook, component.appContext.app, component.uid, component, type, time);
@@ -3710,6 +3766,7 @@ Server rendered element contains more child nodes than client vdom.`
3710
3766
  }
3711
3767
  if (props) {
3712
3768
  {
3769
+ const isCustomElement = el.tagName.includes("-");
3713
3770
  for (const key in props) {
3714
3771
  if (// #11189 skip if this node has directives that have created hooks
3715
3772
  // as it could have mutated the DOM in any possible way
@@ -3717,7 +3774,7 @@ Server rendered element contains more child nodes than client vdom.`
3717
3774
  logMismatchError();
3718
3775
  }
3719
3776
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
3720
- key[0] === ".") {
3777
+ key[0] === "." || isCustomElement) {
3721
3778
  patchProp(el, key, null, props[key], void 0, parentComponent);
3722
3779
  }
3723
3780
  }
@@ -4042,24 +4099,19 @@ function isMismatchAllowed(el, allowedType) {
4042
4099
  }
4043
4100
  }
4044
4101
 
4045
- const hydrateOnIdle = () => (hydrate) => {
4046
- const id = requestIdleCallback(hydrate);
4102
+ const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
4103
+ const id = requestIdleCallback(hydrate, { timeout });
4047
4104
  return () => cancelIdleCallback(id);
4048
4105
  };
4049
- const hydrateOnVisible = (margin = 0) => (hydrate, forEach) => {
4050
- const ob = new IntersectionObserver(
4051
- (entries) => {
4052
- for (const e of entries) {
4053
- if (!e.isIntersecting) continue;
4054
- ob.disconnect();
4055
- hydrate();
4056
- break;
4057
- }
4058
- },
4059
- {
4060
- rootMargin: isString(margin) ? margin : margin + "px"
4106
+ const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4107
+ const ob = new IntersectionObserver((entries) => {
4108
+ for (const e of entries) {
4109
+ if (!e.isIntersecting) continue;
4110
+ ob.disconnect();
4111
+ hydrate();
4112
+ break;
4061
4113
  }
4062
- );
4114
+ }, opts);
4063
4115
  forEach((el) => ob.observe(el));
4064
4116
  return () => ob.disconnect();
4065
4117
  };
@@ -4374,7 +4426,7 @@ const KeepAliveImpl = {
4374
4426
  }
4375
4427
  function pruneCacheEntry(key) {
4376
4428
  const cached = cache.get(key);
4377
- if (!current || !isSameVNodeType(cached, current)) {
4429
+ if (cached && (!current || !isSameVNodeType(cached, current))) {
4378
4430
  unmount(cached);
4379
4431
  } else if (current) {
4380
4432
  resetShapeFlag(current);
@@ -4436,6 +4488,10 @@ const KeepAliveImpl = {
4436
4488
  return rawVNode;
4437
4489
  }
4438
4490
  let vnode = getInnerChild(rawVNode);
4491
+ if (vnode.type === Comment) {
4492
+ current = null;
4493
+ return vnode;
4494
+ }
4439
4495
  const comp = vnode.type;
4440
4496
  const name = getComponentName(
4441
4497
  isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
@@ -4565,17 +4621,19 @@ const createHook = (lifecycle) => (hook, target = currentInstance) => {
4565
4621
  };
4566
4622
  const onBeforeMount = createHook("bm");
4567
4623
  const onMounted = createHook("m");
4568
- const onBeforeUpdate = createHook("bu");
4624
+ const onBeforeUpdate = createHook(
4625
+ "bu"
4626
+ );
4569
4627
  const onUpdated = createHook("u");
4570
- const onBeforeUnmount = createHook("bum");
4571
- const onUnmounted = createHook("um");
4572
- const onServerPrefetch = createHook("sp");
4573
- const onRenderTriggered = createHook(
4574
- "rtg"
4628
+ const onBeforeUnmount = createHook(
4629
+ "bum"
4575
4630
  );
4576
- const onRenderTracked = createHook(
4577
- "rtc"
4631
+ const onUnmounted = createHook("um");
4632
+ const onServerPrefetch = createHook(
4633
+ "sp"
4578
4634
  );
4635
+ const onRenderTriggered = createHook("rtg");
4636
+ const onRenderTracked = createHook("rtc");
4579
4637
  function onErrorCaptured(hook, target = currentInstance) {
4580
4638
  injectHook("ec", hook, target);
4581
4639
  }
@@ -4702,9 +4760,14 @@ function createSlots(slots, dynamicSlots) {
4702
4760
  }
4703
4761
 
4704
4762
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
4705
- if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
4763
+ if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
4706
4764
  if (name !== "default") props.name = name;
4707
- return createVNode("slot", props, fallback && fallback());
4765
+ return openBlock(), createBlock(
4766
+ Fragment,
4767
+ null,
4768
+ [createVNode("slot", props, fallback && fallback())],
4769
+ 64
4770
+ );
4708
4771
  }
4709
4772
  let slot = slots[name];
4710
4773
  if (slot && slot.length > 1) {
@@ -4777,6 +4840,7 @@ const publicPropertiesMap = (
4777
4840
  $refs: (i) => shallowReadonly(i.refs) ,
4778
4841
  $parent: (i) => getPublicInstance(i.parent),
4779
4842
  $root: (i) => getPublicInstance(i.root),
4843
+ $host: (i) => i.ce,
4780
4844
  $emit: (i) => i.emit,
4781
4845
  $options: (i) => resolveMergedOptions(i) ,
4782
4846
  $forceUpdate: (i) => i.f || (i.f = () => {
@@ -4928,29 +4992,25 @@ const PublicInstanceProxyHandlers = {
4928
4992
  return Reflect.ownKeys(target);
4929
4993
  };
4930
4994
  }
4931
- const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
4932
- {},
4933
- PublicInstanceProxyHandlers,
4934
- {
4935
- get(target, key) {
4936
- if (key === Symbol.unscopables) {
4937
- return;
4938
- }
4939
- return PublicInstanceProxyHandlers.get(target, key, target);
4940
- },
4941
- has(_, key) {
4942
- const has = key[0] !== "_" && !isGloballyAllowed(key);
4943
- if (!has && PublicInstanceProxyHandlers.has(_, key)) {
4944
- warn$1(
4945
- `Property ${JSON.stringify(
4946
- key
4947
- )} should not start with _ which is a reserved prefix for Vue internals.`
4948
- );
4949
- }
4950
- return has;
4995
+ const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, {
4996
+ get(target, key) {
4997
+ if (key === Symbol.unscopables) {
4998
+ return;
4951
4999
  }
5000
+ return PublicInstanceProxyHandlers.get(target, key, target);
5001
+ },
5002
+ has(_, key) {
5003
+ const has = key[0] !== "_" && !isGloballyAllowed(key);
5004
+ if (!has && PublicInstanceProxyHandlers.has(_, key)) {
5005
+ warn$1(
5006
+ `Property ${JSON.stringify(
5007
+ key
5008
+ )} should not start with _ which is a reserved prefix for Vue internals.`
5009
+ );
5010
+ }
5011
+ return has;
4952
5012
  }
4953
- );
5013
+ });
4954
5014
  function createDevRenderContext(instance) {
4955
5015
  const target = {};
4956
5016
  Object.defineProperty(target, `_`, {
@@ -5652,7 +5712,7 @@ function createAppAPI(render, hydrate) {
5652
5712
  If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
5653
5713
  );
5654
5714
  }
5655
- const vnode = createVNode(rootComponent, rootProps);
5715
+ const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
5656
5716
  vnode.appContext = context;
5657
5717
  if (namespace === true) {
5658
5718
  namespace = "svg";
@@ -5754,7 +5814,7 @@ function provide(key, value) {
5754
5814
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
5755
5815
  const instance = currentInstance || currentRenderingInstance;
5756
5816
  if (instance || currentApp) {
5757
- const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
5817
+ const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
5758
5818
  if (provides && key in provides) {
5759
5819
  return provides[key];
5760
5820
  } else if (arguments.length > 1) {
@@ -5959,6 +6019,9 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
5959
6019
  } else {
5960
6020
  value = defaultValue;
5961
6021
  }
6022
+ if (instance.ce) {
6023
+ instance.ce._setProp(key, value);
6024
+ }
5962
6025
  }
5963
6026
  if (opt[0 /* shouldCast */]) {
5964
6027
  if (isAbsent && !hasDefault) {
@@ -6957,8 +7020,8 @@ function baseCreateRenderer(options, createHydrationFns) {
6957
7020
  const componentUpdateFn = () => {
6958
7021
  if (!instance.isMounted) {
6959
7022
  let vnodeHook;
6960
- const { el, props, type } = initialVNode;
6961
- const { bm, m, parent } = instance;
7023
+ const { el, props } = initialVNode;
7024
+ const { bm, m, parent, root, type } = instance;
6962
7025
  const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
6963
7026
  toggleRecurse(instance, false);
6964
7027
  if (bm) {
@@ -7001,6 +7064,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7001
7064
  hydrateSubTree();
7002
7065
  }
7003
7066
  } else {
7067
+ if (root.ce) {
7068
+ root.ce._injectChildStyle(type);
7069
+ }
7004
7070
  {
7005
7071
  startMeasure(instance, `render`);
7006
7072
  }
@@ -7674,13 +7740,13 @@ function baseCreateRenderer(options, createHydrationFns) {
7674
7740
  namespace
7675
7741
  );
7676
7742
  }
7743
+ container._vnode = vnode;
7677
7744
  if (!isFlushing) {
7678
7745
  isFlushing = true;
7679
7746
  flushPreFlushCbs();
7680
7747
  flushPostFlushCbs();
7681
7748
  isFlushing = false;
7682
7749
  }
7683
- container._vnode = vnode;
7684
7750
  };
7685
7751
  const internals = {
7686
7752
  p: patch,
@@ -7854,14 +7920,9 @@ function doWatch(source, cb, {
7854
7920
  const _cb = cb;
7855
7921
  cb = (...args) => {
7856
7922
  _cb(...args);
7857
- unwatch();
7923
+ watchHandle();
7858
7924
  };
7859
7925
  }
7860
- if (deep !== void 0 && typeof deep === "number") {
7861
- warn$1(
7862
- `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
7863
- );
7864
- }
7865
7926
  if (!cb) {
7866
7927
  if (immediate !== void 0) {
7867
7928
  warn$1(
@@ -7887,10 +7948,12 @@ function doWatch(source, cb, {
7887
7948
  );
7888
7949
  };
7889
7950
  const instance = currentInstance;
7890
- const reactiveGetter = (source2) => deep === true ? source2 : (
7891
- // for deep: false, only traverse root-level properties
7892
- traverse(source2, deep === false ? 1 : void 0)
7893
- );
7951
+ const reactiveGetter = (source2) => {
7952
+ if (deep) return source2;
7953
+ if (isShallow(source2) || deep === false || deep === 0)
7954
+ return traverse(source2, 1);
7955
+ return traverse(source2);
7956
+ };
7894
7957
  let getter;
7895
7958
  let forceTrigger = false;
7896
7959
  let isMultiSource = false;
@@ -7936,7 +7999,8 @@ function doWatch(source, cb, {
7936
7999
  }
7937
8000
  if (cb && deep) {
7938
8001
  const baseGetter = getter;
7939
- getter = () => traverse(baseGetter());
8002
+ const depth = deep === true ? Infinity : deep;
8003
+ getter = () => traverse(baseGetter(), depth);
7940
8004
  }
7941
8005
  let cleanup;
7942
8006
  let onCleanup = (fn) => {
@@ -7961,7 +8025,12 @@ function doWatch(source, cb, {
7961
8025
  const ctx = useSSRContext();
7962
8026
  ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
7963
8027
  } else {
7964
- return NOOP;
8028
+ const watchHandle2 = () => {
8029
+ };
8030
+ watchHandle2.stop = NOOP;
8031
+ watchHandle2.resume = NOOP;
8032
+ watchHandle2.pause = NOOP;
8033
+ return watchHandle2;
7965
8034
  }
7966
8035
  }
7967
8036
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -8002,12 +8071,15 @@ function doWatch(source, cb, {
8002
8071
  }
8003
8072
  effect.scheduler = scheduler;
8004
8073
  const scope = getCurrentScope();
8005
- const unwatch = () => {
8074
+ const watchHandle = () => {
8006
8075
  effect.stop();
8007
8076
  if (scope) {
8008
8077
  remove(scope.effects, effect);
8009
8078
  }
8010
8079
  };
8080
+ watchHandle.pause = effect.pause.bind(effect);
8081
+ watchHandle.resume = effect.resume.bind(effect);
8082
+ watchHandle.stop = watchHandle;
8011
8083
  {
8012
8084
  effect.onTrack = onTrack;
8013
8085
  effect.onTrigger = onTrigger;
@@ -8026,8 +8098,8 @@ function doWatch(source, cb, {
8026
8098
  } else {
8027
8099
  effect.run();
8028
8100
  }
8029
- if (ssrCleanup) ssrCleanup.push(unwatch);
8030
- return unwatch;
8101
+ if (ssrCleanup) ssrCleanup.push(watchHandle);
8102
+ return watchHandle;
8031
8103
  }
8032
8104
  function instanceWatch(source, value, options) {
8033
8105
  const publicThis = this.proxy;
@@ -8117,7 +8189,8 @@ function useModel(props, name, options = EMPTY_OBJ) {
8117
8189
  return options.get ? options.get(localValue) : localValue;
8118
8190
  },
8119
8191
  set(value) {
8120
- if (!hasChanged(value, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
8192
+ const emittedValue = options.set ? options.set(value) : value;
8193
+ if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
8121
8194
  return;
8122
8195
  }
8123
8196
  const rawProps = i.vnode.props;
@@ -8126,7 +8199,6 @@ function useModel(props, name, options = EMPTY_OBJ) {
8126
8199
  localValue = value;
8127
8200
  trigger();
8128
8201
  }
8129
- const emittedValue = options.set ? options.set(value) : value;
8130
8202
  i.emit(`update:${name}`, emittedValue);
8131
8203
  if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
8132
8204
  trigger();
@@ -8164,9 +8236,9 @@ function emit(instance, event, ...rawArgs) {
8164
8236
  } = instance;
8165
8237
  if (emitsOptions) {
8166
8238
  if (!(event in emitsOptions) && true) {
8167
- if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
8239
+ if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
8168
8240
  warn$1(
8169
- `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
8241
+ `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
8170
8242
  );
8171
8243
  }
8172
8244
  } else {
@@ -9990,11 +10062,16 @@ function useTemplateRef(key) {
9990
10062
  const r = shallowRef(null);
9991
10063
  if (i) {
9992
10064
  const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
9993
- Object.defineProperty(refs, key, {
9994
- enumerable: true,
9995
- get: () => r.value,
9996
- set: (val) => r.value = val
9997
- });
10065
+ let desc;
10066
+ if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
10067
+ warn$1(`useTemplateRef('${key}') already exists.`);
10068
+ } else {
10069
+ Object.defineProperty(refs, key, {
10070
+ enumerable: true,
10071
+ get: () => r.value,
10072
+ set: (val) => r.value = val
10073
+ });
10074
+ }
9998
10075
  } else {
9999
10076
  warn$1(
10000
10077
  `useTemplateRef() is called when there is no active component instance to be associated with.`
@@ -10228,7 +10305,7 @@ function isMemoSame(cached, memo) {
10228
10305
  return true;
10229
10306
  }
10230
10307
 
10231
- const version = "3.5.0-alpha.5";
10308
+ const version = "3.5.0-beta.1";
10232
10309
  const warn = warn$1 ;
10233
10310
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10234
10311
  const devtools = devtools$1 ;
@@ -10240,13 +10317,26 @@ const _ssrUtils = {
10240
10317
  setCurrentRenderingInstance,
10241
10318
  isVNode: isVNode,
10242
10319
  normalizeVNode,
10243
- getComponentPublicInstance
10320
+ getComponentPublicInstance,
10321
+ ensureValidVNode
10244
10322
  };
10245
10323
  const ssrUtils = _ssrUtils ;
10246
10324
  const resolveFilter = null;
10247
10325
  const compatUtils = null;
10248
10326
  const DeprecationTypes = null;
10249
10327
 
10328
+ let policy = void 0;
10329
+ const tt = typeof window !== "undefined" && window.trustedTypes;
10330
+ if (tt) {
10331
+ try {
10332
+ policy = /* @__PURE__ */ tt.createPolicy("vue", {
10333
+ createHTML: (val) => val
10334
+ });
10335
+ } catch (e) {
10336
+ warn(`Error creating trusted types policy: ${e}`);
10337
+ }
10338
+ }
10339
+ const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
10250
10340
  const svgNS = "http://www.w3.org/2000/svg";
10251
10341
  const mathmlNS = "http://www.w3.org/1998/Math/MathML";
10252
10342
  const doc = typeof document !== "undefined" ? document : null;
@@ -10294,7 +10384,9 @@ const nodeOps = {
10294
10384
  if (start === end || !(start = start.nextSibling)) break;
10295
10385
  }
10296
10386
  } else {
10297
- templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
10387
+ templateContainer.innerHTML = unsafeToTrustedHTML(
10388
+ namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
10389
+ );
10298
10390
  const template = templateContainer.content;
10299
10391
  if (namespace === "svg" || namespace === "mathml") {
10300
10392
  const wrapper = template.firstChild;
@@ -10664,11 +10756,17 @@ function useCssVars(getter) {
10664
10756
  }
10665
10757
  const setVars = () => {
10666
10758
  const vars = getter(instance.proxy);
10667
- setVarsOnVNode(instance.subTree, vars);
10759
+ if (instance.ce) {
10760
+ setVarsOnNode(instance.ce, vars);
10761
+ } else {
10762
+ setVarsOnVNode(instance.subTree, vars);
10763
+ }
10668
10764
  updateTeleports(vars);
10669
10765
  };
10670
- onMounted(() => {
10766
+ onBeforeMount(() => {
10671
10767
  watchPostEffect(setVars);
10768
+ });
10769
+ onMounted(() => {
10672
10770
  const ob = new MutationObserver(setVars);
10673
10771
  ob.observe(instance.subTree.el.parentNode, { childList: true });
10674
10772
  onUnmounted(() => ob.disconnect());
@@ -11021,16 +11119,24 @@ function shouldSetAsProp(el, key, value, isSVG) {
11021
11119
  if (isNativeOn(key) && isString(value)) {
11022
11120
  return false;
11023
11121
  }
11024
- return key in el;
11122
+ if (key in el) {
11123
+ return true;
11124
+ }
11125
+ if (el._isVueCE && (/[A-Z]/.test(key) || !isString(value))) {
11126
+ return true;
11127
+ }
11128
+ return false;
11025
11129
  }
11026
11130
 
11131
+ const REMOVAL = {};
11027
11132
  /*! #__NO_SIDE_EFFECTS__ */
11028
11133
  // @__NO_SIDE_EFFECTS__
11029
- function defineCustomElement(options, extraOptions, hydrate2) {
11134
+ function defineCustomElement(options, extraOptions, _createApp) {
11030
11135
  const Comp = defineComponent(options, extraOptions);
11136
+ if (isPlainObject(Comp)) extend(Comp, extraOptions);
11031
11137
  class VueCustomElement extends VueElement {
11032
11138
  constructor(initialProps) {
11033
- super(Comp, initialProps, hydrate2);
11139
+ super(Comp, initialProps, _createApp);
11034
11140
  }
11035
11141
  }
11036
11142
  VueCustomElement.def = Comp;
@@ -11038,47 +11144,88 @@ function defineCustomElement(options, extraOptions, hydrate2) {
11038
11144
  }
11039
11145
  /*! #__NO_SIDE_EFFECTS__ */
11040
11146
  const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
11041
- return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
11147
+ return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
11042
11148
  };
11043
11149
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
11044
11150
  };
11045
11151
  class VueElement extends BaseClass {
11046
- constructor(_def, _props = {}, hydrate2) {
11152
+ constructor(_def, _props = {}, _createApp = createApp) {
11047
11153
  super();
11048
11154
  this._def = _def;
11049
11155
  this._props = _props;
11156
+ this._createApp = _createApp;
11157
+ this._isVueCE = true;
11050
11158
  /**
11051
11159
  * @internal
11052
11160
  */
11053
11161
  this._instance = null;
11162
+ /**
11163
+ * @internal
11164
+ */
11165
+ this._app = null;
11166
+ /**
11167
+ * @internal
11168
+ */
11169
+ this._nonce = this._def.nonce;
11054
11170
  this._connected = false;
11055
11171
  this._resolved = false;
11056
11172
  this._numberProps = null;
11173
+ this._styleChildren = /* @__PURE__ */ new WeakSet();
11057
11174
  this._ob = null;
11058
- if (this.shadowRoot && hydrate2) {
11059
- hydrate2(this._createVNode(), this.shadowRoot);
11175
+ if (this.shadowRoot && _createApp !== createApp) {
11176
+ this._root = this.shadowRoot;
11177
+ this._mount(_def);
11060
11178
  } else {
11061
11179
  if (this.shadowRoot) {
11062
11180
  warn(
11063
11181
  `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
11064
11182
  );
11065
11183
  }
11066
- this.attachShadow({ mode: "open" });
11184
+ if (_def.shadowRoot !== false) {
11185
+ this.attachShadow({ mode: "open" });
11186
+ this._root = this.shadowRoot;
11187
+ } else {
11188
+ this._root = this;
11189
+ }
11067
11190
  if (!this._def.__asyncLoader) {
11068
11191
  this._resolveProps(this._def);
11069
11192
  }
11070
11193
  }
11071
11194
  }
11072
11195
  connectedCallback() {
11196
+ if (!this.shadowRoot) {
11197
+ this._parseSlots();
11198
+ }
11073
11199
  this._connected = true;
11200
+ let parent = this;
11201
+ while (parent = parent && (parent.parentNode || parent.host)) {
11202
+ if (parent instanceof VueElement) {
11203
+ this._parent = parent;
11204
+ break;
11205
+ }
11206
+ }
11074
11207
  if (!this._instance) {
11075
11208
  if (this._resolved) {
11209
+ this._setParent();
11076
11210
  this._update();
11077
11211
  } else {
11078
- this._resolveDef();
11212
+ if (parent && parent._pendingResolve) {
11213
+ this._pendingResolve = parent._pendingResolve.then(() => {
11214
+ this._pendingResolve = void 0;
11215
+ this._resolveDef();
11216
+ });
11217
+ } else {
11218
+ this._resolveDef();
11219
+ }
11079
11220
  }
11080
11221
  }
11081
11222
  }
11223
+ _setParent(parent = this._parent) {
11224
+ if (parent) {
11225
+ this._instance.parent = parent._instance;
11226
+ this._instance.provides = parent._instance.provides;
11227
+ }
11228
+ }
11082
11229
  disconnectedCallback() {
11083
11230
  this._connected = false;
11084
11231
  nextTick(() => {
@@ -11087,8 +11234,9 @@ class VueElement extends BaseClass {
11087
11234
  this._ob.disconnect();
11088
11235
  this._ob = null;
11089
11236
  }
11090
- render(null, this.shadowRoot);
11091
- this._instance = null;
11237
+ this._app && this._app.unmount();
11238
+ this._instance.ce = void 0;
11239
+ this._app = this._instance = null;
11092
11240
  }
11093
11241
  });
11094
11242
  }
@@ -11096,7 +11244,9 @@ class VueElement extends BaseClass {
11096
11244
  * resolve inner component definition (handle possible async component)
11097
11245
  */
11098
11246
  _resolveDef() {
11099
- this._resolved = true;
11247
+ if (this._pendingResolve) {
11248
+ return;
11249
+ }
11100
11250
  for (let i = 0; i < this.attributes.length; i++) {
11101
11251
  this._setAttr(this.attributes[i].name);
11102
11252
  }
@@ -11107,6 +11257,8 @@ class VueElement extends BaseClass {
11107
11257
  });
11108
11258
  this._ob.observe(this, { attributes: true });
11109
11259
  const resolve = (def, isAsync = false) => {
11260
+ this._resolved = true;
11261
+ this._pendingResolve = void 0;
11110
11262
  const { props, styles } = def;
11111
11263
  let numberProps;
11112
11264
  if (props && !isArray(props)) {
@@ -11124,22 +11276,53 @@ class VueElement extends BaseClass {
11124
11276
  if (isAsync) {
11125
11277
  this._resolveProps(def);
11126
11278
  }
11127
- this._applyStyles(styles);
11128
- this._update();
11279
+ if (this.shadowRoot) {
11280
+ this._applyStyles(styles);
11281
+ } else if (styles) {
11282
+ warn(
11283
+ "Custom element style injection is not supported when using shadowRoot: false"
11284
+ );
11285
+ }
11286
+ this._mount(def);
11129
11287
  };
11130
11288
  const asyncDef = this._def.__asyncLoader;
11131
11289
  if (asyncDef) {
11132
- asyncDef().then((def) => resolve(def, true));
11290
+ this._pendingResolve = asyncDef().then(
11291
+ (def) => resolve(this._def = def, true)
11292
+ );
11133
11293
  } else {
11134
11294
  resolve(this._def);
11135
11295
  }
11136
11296
  }
11297
+ _mount(def) {
11298
+ if (!def.name) {
11299
+ def.name = "VueElement";
11300
+ }
11301
+ this._app = this._createApp(def);
11302
+ if (def.configureApp) {
11303
+ def.configureApp(this._app);
11304
+ }
11305
+ this._app._ceVNode = this._createVNode();
11306
+ this._app.mount(this._root);
11307
+ const exposed = this._instance && this._instance.exposed;
11308
+ if (!exposed) return;
11309
+ for (const key in exposed) {
11310
+ if (!hasOwn(this, key)) {
11311
+ Object.defineProperty(this, key, {
11312
+ // unwrap ref to be consistent with public instance behavior
11313
+ get: () => unref(exposed[key])
11314
+ });
11315
+ } else {
11316
+ warn(`Exposed property "${key}" already exists on custom element.`);
11317
+ }
11318
+ }
11319
+ }
11137
11320
  _resolveProps(def) {
11138
11321
  const { props } = def;
11139
11322
  const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
11140
11323
  for (const key of Object.keys(this)) {
11141
11324
  if (key[0] !== "_" && declaredPropKeys.includes(key)) {
11142
- this._setProp(key, this[key], true, false);
11325
+ this._setProp(key, this[key]);
11143
11326
  }
11144
11327
  }
11145
11328
  for (const key of declaredPropKeys.map(camelize)) {
@@ -11148,18 +11331,20 @@ class VueElement extends BaseClass {
11148
11331
  return this._getProp(key);
11149
11332
  },
11150
11333
  set(val) {
11151
- this._setProp(key, val);
11334
+ this._setProp(key, val, true, true);
11152
11335
  }
11153
11336
  });
11154
11337
  }
11155
11338
  }
11156
11339
  _setAttr(key) {
11157
- let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
11340
+ if (key.startsWith("data-v-")) return;
11341
+ const has = this.hasAttribute(key);
11342
+ let value = has ? this.getAttribute(key) : REMOVAL;
11158
11343
  const camelKey = camelize(key);
11159
- if (this._numberProps && this._numberProps[camelKey]) {
11344
+ if (has && this._numberProps && this._numberProps[camelKey]) {
11160
11345
  value = toNumber(value);
11161
11346
  }
11162
- this._setProp(camelKey, value, false);
11347
+ this._setProp(camelKey, value, false, true);
11163
11348
  }
11164
11349
  /**
11165
11350
  * @internal
@@ -11170,9 +11355,13 @@ class VueElement extends BaseClass {
11170
11355
  /**
11171
11356
  * @internal
11172
11357
  */
11173
- _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
11358
+ _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
11174
11359
  if (val !== this._props[key]) {
11175
- this._props[key] = val;
11360
+ if (val === REMOVAL) {
11361
+ delete this._props[key];
11362
+ } else {
11363
+ this._props[key] = val;
11364
+ }
11176
11365
  if (shouldUpdate && this._instance) {
11177
11366
  this._update();
11178
11367
  }
@@ -11188,18 +11377,22 @@ class VueElement extends BaseClass {
11188
11377
  }
11189
11378
  }
11190
11379
  _update() {
11191
- render(this._createVNode(), this.shadowRoot);
11380
+ render(this._createVNode(), this._root);
11192
11381
  }
11193
11382
  _createVNode() {
11194
- const vnode = createVNode(this._def, extend({}, this._props));
11383
+ const baseProps = {};
11384
+ if (!this.shadowRoot) {
11385
+ baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
11386
+ }
11387
+ const vnode = createVNode(this._def, extend(baseProps, this._props));
11195
11388
  if (!this._instance) {
11196
11389
  vnode.ce = (instance) => {
11197
11390
  this._instance = instance;
11198
- instance.isCE = true;
11391
+ instance.ce = this;
11199
11392
  {
11200
11393
  instance.ceReload = (newStyles) => {
11201
11394
  if (this._styles) {
11202
- this._styles.forEach((s) => this.shadowRoot.removeChild(s));
11395
+ this._styles.forEach((s) => this._root.removeChild(s));
11203
11396
  this._styles.length = 0;
11204
11397
  }
11205
11398
  this._applyStyles(newStyles);
@@ -11209,9 +11402,10 @@ class VueElement extends BaseClass {
11209
11402
  }
11210
11403
  const dispatch = (event, args) => {
11211
11404
  this.dispatchEvent(
11212
- new CustomEvent(event, {
11213
- detail: args
11214
- })
11405
+ new CustomEvent(
11406
+ event,
11407
+ isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
11408
+ )
11215
11409
  );
11216
11410
  };
11217
11411
  instance.emit = (event, ...args) => {
@@ -11220,30 +11414,126 @@ class VueElement extends BaseClass {
11220
11414
  dispatch(hyphenate(event), args);
11221
11415
  }
11222
11416
  };
11223
- let parent = this;
11224
- while (parent = parent && (parent.parentNode || parent.host)) {
11225
- if (parent instanceof VueElement) {
11226
- instance.parent = parent._instance;
11227
- instance.provides = parent._instance.provides;
11228
- break;
11229
- }
11230
- }
11417
+ this._setParent();
11231
11418
  };
11232
11419
  }
11233
11420
  return vnode;
11234
11421
  }
11235
- _applyStyles(styles) {
11236
- if (styles) {
11237
- styles.forEach((css) => {
11238
- const s = document.createElement("style");
11239
- s.textContent = css;
11240
- this.shadowRoot.appendChild(s);
11241
- {
11422
+ _applyStyles(styles, owner) {
11423
+ if (!styles) return;
11424
+ if (owner) {
11425
+ if (owner === this._def || this._styleChildren.has(owner)) {
11426
+ return;
11427
+ }
11428
+ this._styleChildren.add(owner);
11429
+ }
11430
+ const nonce = this._nonce;
11431
+ for (let i = styles.length - 1; i >= 0; i--) {
11432
+ const s = document.createElement("style");
11433
+ if (nonce) s.setAttribute("nonce", nonce);
11434
+ s.textContent = styles[i];
11435
+ this.shadowRoot.prepend(s);
11436
+ {
11437
+ if (owner) {
11438
+ if (owner.__hmrId) {
11439
+ if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
11440
+ let entry = this._childStyles.get(owner.__hmrId);
11441
+ if (!entry) {
11442
+ this._childStyles.set(owner.__hmrId, entry = []);
11443
+ }
11444
+ entry.push(s);
11445
+ }
11446
+ } else {
11242
11447
  (this._styles || (this._styles = [])).push(s);
11243
11448
  }
11244
- });
11449
+ }
11450
+ }
11451
+ }
11452
+ /**
11453
+ * Only called when shaddowRoot is false
11454
+ */
11455
+ _parseSlots() {
11456
+ const slots = this._slots = {};
11457
+ let n;
11458
+ while (n = this.firstChild) {
11459
+ const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
11460
+ (slots[slotName] || (slots[slotName] = [])).push(n);
11461
+ this.removeChild(n);
11462
+ }
11463
+ }
11464
+ /**
11465
+ * Only called when shaddowRoot is false
11466
+ */
11467
+ _renderSlots() {
11468
+ const outlets = this.querySelectorAll("slot");
11469
+ const scopeId = this._instance.type.__scopeId;
11470
+ for (let i = 0; i < outlets.length; i++) {
11471
+ const o = outlets[i];
11472
+ const slotName = o.getAttribute("name") || "default";
11473
+ const content = this._slots[slotName];
11474
+ const parent = o.parentNode;
11475
+ if (content) {
11476
+ for (const n of content) {
11477
+ if (scopeId && n.nodeType === 1) {
11478
+ const id = scopeId + "-s";
11479
+ const walker = document.createTreeWalker(n, 1);
11480
+ n.setAttribute(id, "");
11481
+ let child;
11482
+ while (child = walker.nextNode()) {
11483
+ child.setAttribute(id, "");
11484
+ }
11485
+ }
11486
+ parent.insertBefore(n, o);
11487
+ }
11488
+ } else {
11489
+ while (o.firstChild) parent.insertBefore(o.firstChild, o);
11490
+ }
11491
+ parent.removeChild(o);
11492
+ }
11493
+ }
11494
+ /**
11495
+ * @internal
11496
+ */
11497
+ _injectChildStyle(comp) {
11498
+ this._applyStyles(comp.styles, comp);
11499
+ }
11500
+ /**
11501
+ * @internal
11502
+ */
11503
+ _removeChildStyle(comp) {
11504
+ {
11505
+ this._styleChildren.delete(comp);
11506
+ if (this._childStyles && comp.__hmrId) {
11507
+ const oldStyles = this._childStyles.get(comp.__hmrId);
11508
+ if (oldStyles) {
11509
+ oldStyles.forEach((s) => this._root.removeChild(s));
11510
+ oldStyles.length = 0;
11511
+ }
11512
+ }
11513
+ }
11514
+ }
11515
+ }
11516
+ function useHost(caller) {
11517
+ const instance = getCurrentInstance();
11518
+ const el = instance && instance.ce;
11519
+ if (el) {
11520
+ return el;
11521
+ } else {
11522
+ if (!instance) {
11523
+ warn(
11524
+ `${caller || "useHost"} called without an active component instance.`
11525
+ );
11526
+ } else {
11527
+ warn(
11528
+ `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
11529
+ );
11245
11530
  }
11246
11531
  }
11532
+ return null;
11533
+ }
11534
+ function useShadowRoot() {
11535
+ const el = useHost("useShadowRoot") ;
11536
+ return el && el.shadowRoot;
11247
11537
  }
11248
11538
 
11249
11539
  function useCssModule(name = "$style") {
@@ -11758,7 +12048,9 @@ const createApp = (...args) => {
11758
12048
  if (!isFunction(component) && !component.render && !component.template) {
11759
12049
  component.template = container.innerHTML;
11760
12050
  }
11761
- container.innerHTML = "";
12051
+ if (container.nodeType === 1) {
12052
+ container.textContent = "";
12053
+ }
11762
12054
  const proxy = mount(container, false, resolveRootNamespace(container));
11763
12055
  if (container instanceof Element) {
11764
12056
  container.removeAttribute("v-cloak");
@@ -11852,4 +12144,4 @@ const initDirectivesForSSR = () => {
11852
12144
  }
11853
12145
  } ;
11854
12146
 
11855
- export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, TrackOpTypes, Transition, TransitionGroup, TriggerOpTypes, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useId, useModel, useSSRContext, useSlots, useTemplateRef, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
12147
+ export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, TrackOpTypes, Transition, TransitionGroup, TriggerOpTypes, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useHost, useId, useModel, useSSRContext, useShadowRoot, useSlots, useTemplateRef, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };