@vue/compat 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/compat v3.5.0-alpha.5
2
+ * @vue/compat v3.5.0-beta.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -64,9 +64,11 @@ var Vue = (function () {
64
64
  };
65
65
  };
66
66
  const camelizeRE = /-(\w)/g;
67
- const camelize = cacheStringFunction((str) => {
68
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
69
- });
67
+ const camelize = cacheStringFunction(
68
+ (str) => {
69
+ return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
70
+ }
71
+ );
70
72
  const hyphenateRE = /\B([A-Z])/g;
71
73
  const hyphenate = cacheStringFunction(
72
74
  (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
@@ -74,10 +76,12 @@ var Vue = (function () {
74
76
  const capitalize = cacheStringFunction((str) => {
75
77
  return str.charAt(0).toUpperCase() + str.slice(1);
76
78
  });
77
- const toHandlerKey = cacheStringFunction((str) => {
78
- const s = str ? `on${capitalize(str)}` : ``;
79
- return s;
80
- });
79
+ const toHandlerKey = cacheStringFunction(
80
+ (str) => {
81
+ const s = str ? `on${capitalize(str)}` : ``;
82
+ return s;
83
+ }
84
+ );
81
85
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
82
86
  const invokeArrayFns = (fns, ...arg) => {
83
87
  for (let i = 0; i < fns.length; i++) {
@@ -322,6 +326,7 @@ var Vue = (function () {
322
326
  * @internal
323
327
  */
324
328
  this.cleanups = [];
329
+ this._isPaused = false;
325
330
  this.parent = activeEffectScope;
326
331
  if (!detached && activeEffectScope) {
327
332
  this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
@@ -332,6 +337,37 @@ var Vue = (function () {
332
337
  get active() {
333
338
  return this._active;
334
339
  }
340
+ pause() {
341
+ if (this._active) {
342
+ this._isPaused = true;
343
+ if (this.scopes) {
344
+ for (let i = 0, l = this.scopes.length; i < l; i++) {
345
+ this.scopes[i].pause();
346
+ }
347
+ }
348
+ for (let i = 0, l = this.effects.length; i < l; i++) {
349
+ this.effects[i].pause();
350
+ }
351
+ }
352
+ }
353
+ /**
354
+ * Resumes the effect scope, including all child scopes and effects.
355
+ */
356
+ resume() {
357
+ if (this._active) {
358
+ if (this._isPaused) {
359
+ this._isPaused = false;
360
+ if (this.scopes) {
361
+ for (let i = 0, l = this.scopes.length; i < l; i++) {
362
+ this.scopes[i].resume();
363
+ }
364
+ }
365
+ for (let i = 0, l = this.effects.length; i < l; i++) {
366
+ this.effects[i].resume();
367
+ }
368
+ }
369
+ }
370
+ }
335
371
  run(fn) {
336
372
  if (this._active) {
337
373
  const currentEffectScope = activeEffectScope;
@@ -402,6 +438,7 @@ var Vue = (function () {
402
438
  }
403
439
 
404
440
  let activeSub;
441
+ const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
405
442
  class ReactiveEffect {
406
443
  constructor(fn) {
407
444
  this.fn = fn;
@@ -430,6 +467,18 @@ var Vue = (function () {
430
467
  activeEffectScope.effects.push(this);
431
468
  }
432
469
  }
470
+ pause() {
471
+ this.flags |= 128;
472
+ }
473
+ resume() {
474
+ if (this.flags & 128) {
475
+ this.flags &= ~128;
476
+ if (pausedQueueEffects.has(this)) {
477
+ pausedQueueEffects.delete(this);
478
+ this.trigger();
479
+ }
480
+ }
481
+ }
433
482
  /**
434
483
  * @internal
435
484
  */
@@ -483,7 +532,9 @@ var Vue = (function () {
483
532
  }
484
533
  }
485
534
  trigger() {
486
- if (this.scheduler) {
535
+ if (this.flags & 128) {
536
+ pausedQueueEffects.add(this);
537
+ } else if (this.scheduler) {
487
538
  this.scheduler();
488
539
  } else {
489
540
  this.runIfDirty();
@@ -803,9 +854,15 @@ var Vue = (function () {
803
854
  link.dep.subs = link;
804
855
  }
805
856
  const targetMap = /* @__PURE__ */ new WeakMap();
806
- const ITERATE_KEY = Symbol("Object iterate" );
807
- const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
808
- const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
857
+ const ITERATE_KEY = Symbol(
858
+ "Object iterate"
859
+ );
860
+ const MAP_KEY_ITERATE_KEY = Symbol(
861
+ "Map keys iterate"
862
+ );
863
+ const ARRAY_ITERATE_KEY = Symbol(
864
+ "Array iterate"
865
+ );
809
866
  function track(target, type, key) {
810
867
  if (shouldTrack && activeSub) {
811
868
  let depsMap = targetMap.get(target);
@@ -1095,7 +1152,7 @@ var Vue = (function () {
1095
1152
  return isShallow2;
1096
1153
  } else if (key === "__v_raw") {
1097
1154
  if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
1098
- // this means the reciever is a user proxy of the reactive proxy
1155
+ // this means the receiver is a user proxy of the reactive proxy
1099
1156
  Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
1100
1157
  return target;
1101
1158
  }
@@ -1219,9 +1276,7 @@ var Vue = (function () {
1219
1276
  }
1220
1277
  const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
1221
1278
  const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
1222
- const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
1223
- true
1224
- );
1279
+ const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
1225
1280
  const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
1226
1281
 
1227
1282
  const toShallow = (value) => value;
@@ -1716,13 +1771,14 @@ var Vue = (function () {
1716
1771
  class CustomRefImpl {
1717
1772
  constructor(factory) {
1718
1773
  this["__v_isRef"] = true;
1774
+ this._value = void 0;
1719
1775
  const dep = this.dep = new Dep();
1720
1776
  const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
1721
1777
  this._get = get;
1722
1778
  this._set = set;
1723
1779
  }
1724
1780
  get value() {
1725
- return this._get();
1781
+ return this._value = this._get();
1726
1782
  }
1727
1783
  set value(newVal) {
1728
1784
  this._set(newVal);
@@ -1747,10 +1803,11 @@ var Vue = (function () {
1747
1803
  this._key = _key;
1748
1804
  this._defaultValue = _defaultValue;
1749
1805
  this["__v_isRef"] = true;
1806
+ this._value = void 0;
1750
1807
  }
1751
1808
  get value() {
1752
1809
  const val = this._object[this._key];
1753
- return val === void 0 ? this._defaultValue : val;
1810
+ return this._value = val === void 0 ? this._defaultValue : val;
1754
1811
  }
1755
1812
  set value(newVal) {
1756
1813
  this._object[this._key] = newVal;
@@ -1764,9 +1821,10 @@ var Vue = (function () {
1764
1821
  this._getter = _getter;
1765
1822
  this["__v_isRef"] = true;
1766
1823
  this["__v_isReadonly"] = true;
1824
+ this._value = void 0;
1767
1825
  }
1768
1826
  get value() {
1769
- return this._getter();
1827
+ return this._value = this._getter();
1770
1828
  }
1771
1829
  }
1772
1830
  function toRef(source, key, defaultValue) {
@@ -1800,7 +1858,8 @@ var Vue = (function () {
1800
1858
  /**
1801
1859
  * @internal
1802
1860
  */
1803
- this["__v_isRef"] = true;
1861
+ this.__v_isRef = true;
1862
+ // TODO isolatedDeclarations "__v_isReadonly"
1804
1863
  // A computed is also a subscriber that tracks other deps
1805
1864
  /**
1806
1865
  * @internal
@@ -2425,6 +2484,9 @@ var Vue = (function () {
2425
2484
  "[HMR] Root or manually mounted instance modified. Full reload required."
2426
2485
  );
2427
2486
  }
2487
+ if (instance.root.ce && instance !== instance.root) {
2488
+ instance.root.ce._removeChildStyle(oldComp);
2489
+ }
2428
2490
  }
2429
2491
  queuePostFlushCb(() => {
2430
2492
  hmrDirtyComponents.clear();
@@ -2504,9 +2566,7 @@ var Vue = (function () {
2504
2566
  function devtoolsUnmountApp(app) {
2505
2567
  emit$2("app:unmount" /* APP_UNMOUNT */, app);
2506
2568
  }
2507
- const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
2508
- "component:added" /* COMPONENT_ADDED */
2509
- );
2569
+ const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
2510
2570
  const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
2511
2571
  const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
2512
2572
  "component:removed" /* COMPONENT_REMOVED */
@@ -2530,12 +2590,8 @@ var Vue = (function () {
2530
2590
  );
2531
2591
  };
2532
2592
  }
2533
- const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
2534
- "perf:start" /* PERFORMANCE_START */
2535
- );
2536
- const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
2537
- "perf:end" /* PERFORMANCE_END */
2538
- );
2593
+ const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
2594
+ const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
2539
2595
  function createDevtoolsPerformanceHook(hook) {
2540
2596
  return (component, type, time) => {
2541
2597
  emit$2(hook, component.appContext.app, component.uid, component, type, time);
@@ -4244,6 +4300,7 @@ Server rendered element contains more child nodes than client vdom.`
4244
4300
  }
4245
4301
  if (props) {
4246
4302
  {
4303
+ const isCustomElement = el.tagName.includes("-");
4247
4304
  for (const key in props) {
4248
4305
  if (// #11189 skip if this node has directives that have created hooks
4249
4306
  // as it could have mutated the DOM in any possible way
@@ -4251,7 +4308,7 @@ Server rendered element contains more child nodes than client vdom.`
4251
4308
  logMismatchError();
4252
4309
  }
4253
4310
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4254
- key[0] === ".") {
4311
+ key[0] === "." || isCustomElement) {
4255
4312
  patchProp(el, key, null, props[key], void 0, parentComponent);
4256
4313
  }
4257
4314
  }
@@ -4576,24 +4633,19 @@ Server rendered element contains fewer child nodes than client vdom.`
4576
4633
  }
4577
4634
  }
4578
4635
 
4579
- const hydrateOnIdle = () => (hydrate) => {
4580
- const id = requestIdleCallback(hydrate);
4636
+ const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
4637
+ const id = requestIdleCallback(hydrate, { timeout });
4581
4638
  return () => cancelIdleCallback(id);
4582
4639
  };
4583
- const hydrateOnVisible = (margin = 0) => (hydrate, forEach) => {
4584
- const ob = new IntersectionObserver(
4585
- (entries) => {
4586
- for (const e of entries) {
4587
- if (!e.isIntersecting) continue;
4588
- ob.disconnect();
4589
- hydrate();
4590
- break;
4591
- }
4592
- },
4593
- {
4594
- rootMargin: isString(margin) ? margin : margin + "px"
4640
+ const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4641
+ const ob = new IntersectionObserver((entries) => {
4642
+ for (const e of entries) {
4643
+ if (!e.isIntersecting) continue;
4644
+ ob.disconnect();
4645
+ hydrate();
4646
+ break;
4595
4647
  }
4596
- );
4648
+ }, opts);
4597
4649
  forEach((el) => ob.observe(el));
4598
4650
  return () => ob.disconnect();
4599
4651
  };
@@ -4902,7 +4954,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4902
4954
  }
4903
4955
  function pruneCacheEntry(key) {
4904
4956
  const cached = cache.get(key);
4905
- if (!current || !isSameVNodeType(cached, current)) {
4957
+ if (cached && (!current || !isSameVNodeType(cached, current))) {
4906
4958
  unmount(cached);
4907
4959
  } else if (current) {
4908
4960
  resetShapeFlag(current);
@@ -4964,6 +5016,10 @@ Server rendered element contains fewer child nodes than client vdom.`
4964
5016
  return rawVNode;
4965
5017
  }
4966
5018
  let vnode = getInnerChild(rawVNode);
5019
+ if (vnode.type === Comment) {
5020
+ current = null;
5021
+ return vnode;
5022
+ }
4967
5023
  const comp = vnode.type;
4968
5024
  const name = getComponentName(
4969
5025
  isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
@@ -5096,17 +5152,19 @@ Server rendered element contains fewer child nodes than client vdom.`
5096
5152
  };
5097
5153
  const onBeforeMount = createHook("bm");
5098
5154
  const onMounted = createHook("m");
5099
- const onBeforeUpdate = createHook("bu");
5155
+ const onBeforeUpdate = createHook(
5156
+ "bu"
5157
+ );
5100
5158
  const onUpdated = createHook("u");
5101
- const onBeforeUnmount = createHook("bum");
5102
- const onUnmounted = createHook("um");
5103
- const onServerPrefetch = createHook("sp");
5104
- const onRenderTriggered = createHook(
5105
- "rtg"
5159
+ const onBeforeUnmount = createHook(
5160
+ "bum"
5106
5161
  );
5107
- const onRenderTracked = createHook(
5108
- "rtc"
5162
+ const onUnmounted = createHook("um");
5163
+ const onServerPrefetch = createHook(
5164
+ "sp"
5109
5165
  );
5166
+ const onRenderTriggered = createHook("rtg");
5167
+ const onRenderTracked = createHook("rtc");
5110
5168
  function onErrorCaptured(hook, target = currentInstance) {
5111
5169
  injectHook("ec", hook, target);
5112
5170
  }
@@ -5520,9 +5578,14 @@ If this is a native custom element, make sure to exclude it from component resol
5520
5578
  }
5521
5579
 
5522
5580
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5523
- if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
5581
+ if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5524
5582
  if (name !== "default") props.name = name;
5525
- return createVNode("slot", props, fallback && fallback());
5583
+ return openBlock(), createBlock(
5584
+ Fragment,
5585
+ null,
5586
+ [createVNode("slot", props, fallback && fallback())],
5587
+ 64
5588
+ );
5526
5589
  }
5527
5590
  let slot = slots[name];
5528
5591
  if (slot && slot.length > 1) {
@@ -5824,6 +5887,7 @@ If this is a native custom element, make sure to exclude it from component resol
5824
5887
  $refs: (i) => shallowReadonly(i.refs) ,
5825
5888
  $parent: (i) => getPublicInstance(i.parent),
5826
5889
  $root: (i) => getPublicInstance(i.root),
5890
+ $host: (i) => i.ce,
5827
5891
  $emit: (i) => i.emit,
5828
5892
  $options: (i) => resolveMergedOptions(i) ,
5829
5893
  $forceUpdate: (i) => i.f || (i.f = () => {
@@ -5984,29 +6048,25 @@ If this is a native custom element, make sure to exclude it from component resol
5984
6048
  return Reflect.ownKeys(target);
5985
6049
  };
5986
6050
  }
5987
- const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
5988
- {},
5989
- PublicInstanceProxyHandlers,
5990
- {
5991
- get(target, key) {
5992
- if (key === Symbol.unscopables) {
5993
- return;
5994
- }
5995
- return PublicInstanceProxyHandlers.get(target, key, target);
5996
- },
5997
- has(_, key) {
5998
- const has = key[0] !== "_" && !isGloballyAllowed(key);
5999
- if (!has && PublicInstanceProxyHandlers.has(_, key)) {
6000
- warn$1(
6001
- `Property ${JSON.stringify(
6002
- key
6003
- )} should not start with _ which is a reserved prefix for Vue internals.`
6004
- );
6005
- }
6006
- return has;
6051
+ const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, {
6052
+ get(target, key) {
6053
+ if (key === Symbol.unscopables) {
6054
+ return;
6055
+ }
6056
+ return PublicInstanceProxyHandlers.get(target, key, target);
6057
+ },
6058
+ has(_, key) {
6059
+ const has = key[0] !== "_" && !isGloballyAllowed(key);
6060
+ if (!has && PublicInstanceProxyHandlers.has(_, key)) {
6061
+ warn$1(
6062
+ `Property ${JSON.stringify(
6063
+ key
6064
+ )} should not start with _ which is a reserved prefix for Vue internals.`
6065
+ );
6007
6066
  }
6067
+ return has;
6008
6068
  }
6009
- );
6069
+ });
6010
6070
  function createDevRenderContext(instance) {
6011
6071
  const target = {};
6012
6072
  Object.defineProperty(target, `_`, {
@@ -6690,7 +6750,7 @@ If this is a native custom element, make sure to exclude it from component resol
6690
6750
  return vm;
6691
6751
  }
6692
6752
  }
6693
- Vue.version = `2.6.14-compat:${"3.5.0-alpha.5"}`;
6753
+ Vue.version = `2.6.14-compat:${"3.5.0-beta.1"}`;
6694
6754
  Vue.config = singletonApp.config;
6695
6755
  Vue.use = (plugin, ...options) => {
6696
6756
  if (plugin && isFunction(plugin.install)) {
@@ -6963,7 +7023,7 @@ If this is a native custom element, make sure to exclude it from component resol
6963
7023
  /* skip options */
6964
7024
  );
6965
7025
  }
6966
- container.innerHTML = "";
7026
+ container.textContent = "";
6967
7027
  render(vnode, container, namespace);
6968
7028
  if (container instanceof Element) {
6969
7029
  container.removeAttribute("v-cloak");
@@ -7175,7 +7235,7 @@ If this is a native custom element, make sure to exclude it from component resol
7175
7235
  If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
7176
7236
  );
7177
7237
  }
7178
- const vnode = createVNode(rootComponent, rootProps);
7238
+ const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
7179
7239
  vnode.appContext = context;
7180
7240
  if (namespace === true) {
7181
7241
  namespace = "svg";
@@ -7280,7 +7340,7 @@ If you want to remount the same app, move your app creation logic into a factory
7280
7340
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
7281
7341
  const instance = currentInstance || currentRenderingInstance;
7282
7342
  if (instance || currentApp) {
7283
- const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
7343
+ const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
7284
7344
  if (provides && key in provides) {
7285
7345
  return provides[key];
7286
7346
  } else if (arguments.length > 1) {
@@ -7554,6 +7614,9 @@ If you want to remount the same app, move your app creation logic into a factory
7554
7614
  } else {
7555
7615
  value = defaultValue;
7556
7616
  }
7617
+ if (instance.ce) {
7618
+ instance.ce._setProp(key, value);
7619
+ }
7557
7620
  }
7558
7621
  if (opt[0 /* shouldCast */]) {
7559
7622
  if (isAbsent && !hasDefault) {
@@ -8556,8 +8619,8 @@ If you want to remount the same app, move your app creation logic into a factory
8556
8619
  const componentUpdateFn = () => {
8557
8620
  if (!instance.isMounted) {
8558
8621
  let vnodeHook;
8559
- const { el, props, type } = initialVNode;
8560
- const { bm, m, parent } = instance;
8622
+ const { el, props } = initialVNode;
8623
+ const { bm, m, parent, root, type } = instance;
8561
8624
  const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
8562
8625
  toggleRecurse(instance, false);
8563
8626
  if (bm) {
@@ -8603,6 +8666,9 @@ If you want to remount the same app, move your app creation logic into a factory
8603
8666
  hydrateSubTree();
8604
8667
  }
8605
8668
  } else {
8669
+ if (root.ce) {
8670
+ root.ce._injectChildStyle(type);
8671
+ }
8606
8672
  {
8607
8673
  startMeasure(instance, `render`);
8608
8674
  }
@@ -9306,13 +9372,13 @@ If you want to remount the same app, move your app creation logic into a factory
9306
9372
  namespace
9307
9373
  );
9308
9374
  }
9375
+ container._vnode = vnode;
9309
9376
  if (!isFlushing) {
9310
9377
  isFlushing = true;
9311
9378
  flushPreFlushCbs();
9312
9379
  flushPostFlushCbs();
9313
9380
  isFlushing = false;
9314
9381
  }
9315
- container._vnode = vnode;
9316
9382
  };
9317
9383
  const internals = {
9318
9384
  p: patch,
@@ -9480,14 +9546,9 @@ If you want to remount the same app, move your app creation logic into a factory
9480
9546
  const _cb = cb;
9481
9547
  cb = (...args) => {
9482
9548
  _cb(...args);
9483
- unwatch();
9549
+ watchHandle();
9484
9550
  };
9485
9551
  }
9486
- if (deep !== void 0 && typeof deep === "number") {
9487
- warn$1(
9488
- `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
9489
- );
9490
- }
9491
9552
  if (!cb) {
9492
9553
  if (immediate !== void 0) {
9493
9554
  warn$1(
@@ -9513,10 +9574,12 @@ If you want to remount the same app, move your app creation logic into a factory
9513
9574
  );
9514
9575
  };
9515
9576
  const instance = currentInstance;
9516
- const reactiveGetter = (source2) => deep === true ? source2 : (
9517
- // for deep: false, only traverse root-level properties
9518
- traverse(source2, deep === false ? 1 : void 0)
9519
- );
9577
+ const reactiveGetter = (source2) => {
9578
+ if (deep) return source2;
9579
+ if (isShallow(source2) || deep === false || deep === 0)
9580
+ return traverse(source2, 1);
9581
+ return traverse(source2);
9582
+ };
9520
9583
  let getter;
9521
9584
  let forceTrigger = false;
9522
9585
  let isMultiSource = false;
@@ -9572,7 +9635,8 @@ If you want to remount the same app, move your app creation logic into a factory
9572
9635
  }
9573
9636
  if (cb && deep) {
9574
9637
  const baseGetter = getter;
9575
- getter = () => traverse(baseGetter());
9638
+ const depth = deep === true ? Infinity : deep;
9639
+ getter = () => traverse(baseGetter(), depth);
9576
9640
  }
9577
9641
  let cleanup;
9578
9642
  let onCleanup = (fn) => {
@@ -9619,12 +9683,15 @@ If you want to remount the same app, move your app creation logic into a factory
9619
9683
  }
9620
9684
  effect.scheduler = scheduler;
9621
9685
  const scope = getCurrentScope();
9622
- const unwatch = () => {
9686
+ const watchHandle = () => {
9623
9687
  effect.stop();
9624
9688
  if (scope) {
9625
9689
  remove(scope.effects, effect);
9626
9690
  }
9627
9691
  };
9692
+ watchHandle.pause = effect.pause.bind(effect);
9693
+ watchHandle.resume = effect.resume.bind(effect);
9694
+ watchHandle.stop = watchHandle;
9628
9695
  {
9629
9696
  effect.onTrack = onTrack;
9630
9697
  effect.onTrigger = onTrigger;
@@ -9643,7 +9710,7 @@ If you want to remount the same app, move your app creation logic into a factory
9643
9710
  } else {
9644
9711
  effect.run();
9645
9712
  }
9646
- return unwatch;
9713
+ return watchHandle;
9647
9714
  }
9648
9715
  function instanceWatch(source, value, options) {
9649
9716
  const publicThis = this.proxy;
@@ -9733,7 +9800,8 @@ If you want to remount the same app, move your app creation logic into a factory
9733
9800
  return options.get ? options.get(localValue) : localValue;
9734
9801
  },
9735
9802
  set(value) {
9736
- if (!hasChanged(value, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
9803
+ const emittedValue = options.set ? options.set(value) : value;
9804
+ if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
9737
9805
  return;
9738
9806
  }
9739
9807
  const rawProps = i.vnode.props;
@@ -9742,7 +9810,6 @@ If you want to remount the same app, move your app creation logic into a factory
9742
9810
  localValue = value;
9743
9811
  trigger();
9744
9812
  }
9745
- const emittedValue = options.set ? options.set(value) : value;
9746
9813
  i.emit(`update:${name}`, emittedValue);
9747
9814
  if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
9748
9815
  trigger();
@@ -9780,9 +9847,9 @@ If you want to remount the same app, move your app creation logic into a factory
9780
9847
  } = instance;
9781
9848
  if (emitsOptions) {
9782
9849
  if (!(event in emitsOptions) && !(event.startsWith("hook:") || event.startsWith(compatModelEventPrefix))) {
9783
- if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
9850
+ if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
9784
9851
  warn$1(
9785
- `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
9852
+ `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
9786
9853
  );
9787
9854
  }
9788
9855
  } else {
@@ -11699,11 +11766,16 @@ Component that was made reactive: `,
11699
11766
  const r = shallowRef(null);
11700
11767
  if (i) {
11701
11768
  const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
11702
- Object.defineProperty(refs, key, {
11703
- enumerable: true,
11704
- get: () => r.value,
11705
- set: (val) => r.value = val
11706
- });
11769
+ let desc;
11770
+ if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
11771
+ warn$1(`useTemplateRef('${key}') already exists.`);
11772
+ } else {
11773
+ Object.defineProperty(refs, key, {
11774
+ enumerable: true,
11775
+ get: () => r.value,
11776
+ set: (val) => r.value = val
11777
+ });
11778
+ }
11707
11779
  } else {
11708
11780
  warn$1(
11709
11781
  `useTemplateRef() is called when there is no active component instance to be associated with.`
@@ -11937,7 +12009,7 @@ Component that was made reactive: `,
11937
12009
  return true;
11938
12010
  }
11939
12011
 
11940
- const version = "3.5.0-alpha.5";
12012
+ const version = "3.5.0-beta.1";
11941
12013
  const warn = warn$1 ;
11942
12014
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11943
12015
  const devtools = devtools$1 ;
@@ -11954,6 +12026,18 @@ Component that was made reactive: `,
11954
12026
  const compatUtils = _compatUtils ;
11955
12027
  const DeprecationTypes = DeprecationTypes$1 ;
11956
12028
 
12029
+ let policy = void 0;
12030
+ const tt = typeof window !== "undefined" && window.trustedTypes;
12031
+ if (tt) {
12032
+ try {
12033
+ policy = /* @__PURE__ */ tt.createPolicy("vue", {
12034
+ createHTML: (val) => val
12035
+ });
12036
+ } catch (e) {
12037
+ warn(`Error creating trusted types policy: ${e}`);
12038
+ }
12039
+ }
12040
+ const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
11957
12041
  const svgNS = "http://www.w3.org/2000/svg";
11958
12042
  const mathmlNS = "http://www.w3.org/1998/Math/MathML";
11959
12043
  const doc = typeof document !== "undefined" ? document : null;
@@ -12001,7 +12085,9 @@ Component that was made reactive: `,
12001
12085
  if (start === end || !(start = start.nextSibling)) break;
12002
12086
  }
12003
12087
  } else {
12004
- templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
12088
+ templateContainer.innerHTML = unsafeToTrustedHTML(
12089
+ namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
12090
+ );
12005
12091
  const template = templateContainer.content;
12006
12092
  if (namespace === "svg" || namespace === "mathml") {
12007
12093
  const wrapper = template.firstChild;
@@ -12401,11 +12487,17 @@ Component that was made reactive: `,
12401
12487
  }
12402
12488
  const setVars = () => {
12403
12489
  const vars = getter(instance.proxy);
12404
- setVarsOnVNode(instance.subTree, vars);
12490
+ if (instance.ce) {
12491
+ setVarsOnNode(instance.ce, vars);
12492
+ } else {
12493
+ setVarsOnVNode(instance.subTree, vars);
12494
+ }
12405
12495
  updateTeleports(vars);
12406
12496
  };
12407
- onMounted(() => {
12497
+ onBeforeMount(() => {
12408
12498
  watchPostEffect(setVars);
12499
+ });
12500
+ onMounted(() => {
12409
12501
  const ob = new MutationObserver(setVars);
12410
12502
  ob.observe(instance.subTree.el.parentNode, { childList: true });
12411
12503
  onUnmounted(() => ob.disconnect());
@@ -12802,16 +12894,24 @@ Expected function or array of functions, received type ${typeof value}.`
12802
12894
  if (isNativeOn(key) && isString(value)) {
12803
12895
  return false;
12804
12896
  }
12805
- return key in el;
12897
+ if (key in el) {
12898
+ return true;
12899
+ }
12900
+ if (el._isVueCE && (/[A-Z]/.test(key) || !isString(value))) {
12901
+ return true;
12902
+ }
12903
+ return false;
12806
12904
  }
12807
12905
 
12906
+ const REMOVAL = {};
12808
12907
  /*! #__NO_SIDE_EFFECTS__ */
12809
12908
  // @__NO_SIDE_EFFECTS__
12810
- function defineCustomElement(options, extraOptions, hydrate2) {
12909
+ function defineCustomElement(options, extraOptions, _createApp) {
12811
12910
  const Comp = defineComponent(options, extraOptions);
12911
+ if (isPlainObject(Comp)) extend(Comp, extraOptions);
12812
12912
  class VueCustomElement extends VueElement {
12813
12913
  constructor(initialProps) {
12814
- super(Comp, initialProps, hydrate2);
12914
+ super(Comp, initialProps, _createApp);
12815
12915
  }
12816
12916
  }
12817
12917
  VueCustomElement.def = Comp;
@@ -12819,47 +12919,88 @@ Expected function or array of functions, received type ${typeof value}.`
12819
12919
  }
12820
12920
  /*! #__NO_SIDE_EFFECTS__ */
12821
12921
  const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
12822
- return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
12922
+ return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
12823
12923
  };
12824
12924
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
12825
12925
  };
12826
12926
  class VueElement extends BaseClass {
12827
- constructor(_def, _props = {}, hydrate2) {
12927
+ constructor(_def, _props = {}, _createApp = createApp) {
12828
12928
  super();
12829
12929
  this._def = _def;
12830
12930
  this._props = _props;
12931
+ this._createApp = _createApp;
12932
+ this._isVueCE = true;
12831
12933
  /**
12832
12934
  * @internal
12833
12935
  */
12834
12936
  this._instance = null;
12937
+ /**
12938
+ * @internal
12939
+ */
12940
+ this._app = null;
12941
+ /**
12942
+ * @internal
12943
+ */
12944
+ this._nonce = this._def.nonce;
12835
12945
  this._connected = false;
12836
12946
  this._resolved = false;
12837
12947
  this._numberProps = null;
12948
+ this._styleChildren = /* @__PURE__ */ new WeakSet();
12838
12949
  this._ob = null;
12839
- if (this.shadowRoot && hydrate2) {
12840
- hydrate2(this._createVNode(), this.shadowRoot);
12950
+ if (this.shadowRoot && _createApp !== createApp) {
12951
+ this._root = this.shadowRoot;
12952
+ this._mount(_def);
12841
12953
  } else {
12842
12954
  if (this.shadowRoot) {
12843
12955
  warn(
12844
12956
  `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
12845
12957
  );
12846
12958
  }
12847
- this.attachShadow({ mode: "open" });
12959
+ if (_def.shadowRoot !== false) {
12960
+ this.attachShadow({ mode: "open" });
12961
+ this._root = this.shadowRoot;
12962
+ } else {
12963
+ this._root = this;
12964
+ }
12848
12965
  if (!this._def.__asyncLoader) {
12849
12966
  this._resolveProps(this._def);
12850
12967
  }
12851
12968
  }
12852
12969
  }
12853
12970
  connectedCallback() {
12971
+ if (!this.shadowRoot) {
12972
+ this._parseSlots();
12973
+ }
12854
12974
  this._connected = true;
12975
+ let parent = this;
12976
+ while (parent = parent && (parent.parentNode || parent.host)) {
12977
+ if (parent instanceof VueElement) {
12978
+ this._parent = parent;
12979
+ break;
12980
+ }
12981
+ }
12855
12982
  if (!this._instance) {
12856
12983
  if (this._resolved) {
12984
+ this._setParent();
12857
12985
  this._update();
12858
12986
  } else {
12859
- this._resolveDef();
12987
+ if (parent && parent._pendingResolve) {
12988
+ this._pendingResolve = parent._pendingResolve.then(() => {
12989
+ this._pendingResolve = void 0;
12990
+ this._resolveDef();
12991
+ });
12992
+ } else {
12993
+ this._resolveDef();
12994
+ }
12860
12995
  }
12861
12996
  }
12862
12997
  }
12998
+ _setParent(parent = this._parent) {
12999
+ if (parent) {
13000
+ this._instance.parent = parent._instance;
13001
+ this._instance.provides = parent._instance.provides;
13002
+ }
13003
+ }
12863
13004
  disconnectedCallback() {
12864
13005
  this._connected = false;
12865
13006
  nextTick(() => {
@@ -12868,8 +13009,9 @@ Expected function or array of functions, received type ${typeof value}.`
12868
13009
  this._ob.disconnect();
12869
13010
  this._ob = null;
12870
13011
  }
12871
- render(null, this.shadowRoot);
12872
- this._instance = null;
13012
+ this._app && this._app.unmount();
13013
+ this._instance.ce = void 0;
13014
+ this._app = this._instance = null;
12873
13015
  }
12874
13016
  });
12875
13017
  }
@@ -12877,7 +13019,9 @@ Expected function or array of functions, received type ${typeof value}.`
12877
13019
  * resolve inner component definition (handle possible async component)
12878
13020
  */
12879
13021
  _resolveDef() {
12880
- this._resolved = true;
13022
+ if (this._pendingResolve) {
13023
+ return;
13024
+ }
12881
13025
  for (let i = 0; i < this.attributes.length; i++) {
12882
13026
  this._setAttr(this.attributes[i].name);
12883
13027
  }
@@ -12888,6 +13032,8 @@ Expected function or array of functions, received type ${typeof value}.`
12888
13032
  });
12889
13033
  this._ob.observe(this, { attributes: true });
12890
13034
  const resolve = (def, isAsync = false) => {
13035
+ this._resolved = true;
13036
+ this._pendingResolve = void 0;
12891
13037
  const { props, styles } = def;
12892
13038
  let numberProps;
12893
13039
  if (props && !isArray(props)) {
@@ -12905,22 +13051,53 @@ Expected function or array of functions, received type ${typeof value}.`
12905
13051
  if (isAsync) {
12906
13052
  this._resolveProps(def);
12907
13053
  }
12908
- this._applyStyles(styles);
12909
- this._update();
13054
+ if (this.shadowRoot) {
13055
+ this._applyStyles(styles);
13056
+ } else if (styles) {
13057
+ warn(
13058
+ "Custom element style injection is not supported when using shadowRoot: false"
13059
+ );
13060
+ }
13061
+ this._mount(def);
12910
13062
  };
12911
13063
  const asyncDef = this._def.__asyncLoader;
12912
13064
  if (asyncDef) {
12913
- asyncDef().then((def) => resolve(def, true));
13065
+ this._pendingResolve = asyncDef().then(
13066
+ (def) => resolve(this._def = def, true)
13067
+ );
12914
13068
  } else {
12915
13069
  resolve(this._def);
12916
13070
  }
12917
13071
  }
13072
+ _mount(def) {
13073
+ if (!def.name) {
13074
+ def.name = "VueElement";
13075
+ }
13076
+ this._app = this._createApp(def);
13077
+ if (def.configureApp) {
13078
+ def.configureApp(this._app);
13079
+ }
13080
+ this._app._ceVNode = this._createVNode();
13081
+ this._app.mount(this._root);
13082
+ const exposed = this._instance && this._instance.exposed;
13083
+ if (!exposed) return;
13084
+ for (const key in exposed) {
13085
+ if (!hasOwn(this, key)) {
13086
+ Object.defineProperty(this, key, {
13087
+ // unwrap ref to be consistent with public instance behavior
13088
+ get: () => unref(exposed[key])
13089
+ });
13090
+ } else {
13091
+ warn(`Exposed property "${key}" already exists on custom element.`);
13092
+ }
13093
+ }
13094
+ }
12918
13095
  _resolveProps(def) {
12919
13096
  const { props } = def;
12920
13097
  const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
12921
13098
  for (const key of Object.keys(this)) {
12922
13099
  if (key[0] !== "_" && declaredPropKeys.includes(key)) {
12923
- this._setProp(key, this[key], true, false);
13100
+ this._setProp(key, this[key]);
12924
13101
  }
12925
13102
  }
12926
13103
  for (const key of declaredPropKeys.map(camelize)) {
@@ -12929,18 +13106,20 @@ Expected function or array of functions, received type ${typeof value}.`
12929
13106
  return this._getProp(key);
12930
13107
  },
12931
13108
  set(val) {
12932
- this._setProp(key, val);
13109
+ this._setProp(key, val, true, true);
12933
13110
  }
12934
13111
  });
12935
13112
  }
12936
13113
  }
12937
13114
  _setAttr(key) {
12938
- let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
13115
+ if (key.startsWith("data-v-")) return;
13116
+ const has = this.hasAttribute(key);
13117
+ let value = has ? this.getAttribute(key) : REMOVAL;
12939
13118
  const camelKey = camelize(key);
12940
- if (this._numberProps && this._numberProps[camelKey]) {
13119
+ if (has && this._numberProps && this._numberProps[camelKey]) {
12941
13120
  value = toNumber(value);
12942
13121
  }
12943
- this._setProp(camelKey, value, false);
13122
+ this._setProp(camelKey, value, false, true);
12944
13123
  }
12945
13124
  /**
12946
13125
  * @internal
@@ -12951,9 +13130,13 @@ Expected function or array of functions, received type ${typeof value}.`
12951
13130
  /**
12952
13131
  * @internal
12953
13132
  */
12954
- _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
13133
+ _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
12955
13134
  if (val !== this._props[key]) {
12956
- this._props[key] = val;
13135
+ if (val === REMOVAL) {
13136
+ delete this._props[key];
13137
+ } else {
13138
+ this._props[key] = val;
13139
+ }
12957
13140
  if (shouldUpdate && this._instance) {
12958
13141
  this._update();
12959
13142
  }
@@ -12969,18 +13152,22 @@ Expected function or array of functions, received type ${typeof value}.`
12969
13152
  }
12970
13153
  }
12971
13154
  _update() {
12972
- render(this._createVNode(), this.shadowRoot);
13155
+ render(this._createVNode(), this._root);
12973
13156
  }
12974
13157
  _createVNode() {
12975
- const vnode = createVNode(this._def, extend({}, this._props));
13158
+ const baseProps = {};
13159
+ if (!this.shadowRoot) {
13160
+ baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
13161
+ }
13162
+ const vnode = createVNode(this._def, extend(baseProps, this._props));
12976
13163
  if (!this._instance) {
12977
13164
  vnode.ce = (instance) => {
12978
13165
  this._instance = instance;
12979
- instance.isCE = true;
13166
+ instance.ce = this;
12980
13167
  {
12981
13168
  instance.ceReload = (newStyles) => {
12982
13169
  if (this._styles) {
12983
- this._styles.forEach((s) => this.shadowRoot.removeChild(s));
13170
+ this._styles.forEach((s) => this._root.removeChild(s));
12984
13171
  this._styles.length = 0;
12985
13172
  }
12986
13173
  this._applyStyles(newStyles);
@@ -12990,9 +13177,10 @@ Expected function or array of functions, received type ${typeof value}.`
12990
13177
  }
12991
13178
  const dispatch = (event, args) => {
12992
13179
  this.dispatchEvent(
12993
- new CustomEvent(event, {
12994
- detail: args
12995
- })
13180
+ new CustomEvent(
13181
+ event,
13182
+ isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
13183
+ )
12996
13184
  );
12997
13185
  };
12998
13186
  instance.emit = (event, ...args) => {
@@ -13001,30 +13189,126 @@ Expected function or array of functions, received type ${typeof value}.`
13001
13189
  dispatch(hyphenate(event), args);
13002
13190
  }
13003
13191
  };
13004
- let parent = this;
13005
- while (parent = parent && (parent.parentNode || parent.host)) {
13006
- if (parent instanceof VueElement) {
13007
- instance.parent = parent._instance;
13008
- instance.provides = parent._instance.provides;
13009
- break;
13010
- }
13011
- }
13192
+ this._setParent();
13012
13193
  };
13013
13194
  }
13014
13195
  return vnode;
13015
13196
  }
13016
- _applyStyles(styles) {
13017
- if (styles) {
13018
- styles.forEach((css) => {
13019
- const s = document.createElement("style");
13020
- s.textContent = css;
13021
- this.shadowRoot.appendChild(s);
13022
- {
13197
+ _applyStyles(styles, owner) {
13198
+ if (!styles) return;
13199
+ if (owner) {
13200
+ if (owner === this._def || this._styleChildren.has(owner)) {
13201
+ return;
13202
+ }
13203
+ this._styleChildren.add(owner);
13204
+ }
13205
+ const nonce = this._nonce;
13206
+ for (let i = styles.length - 1; i >= 0; i--) {
13207
+ const s = document.createElement("style");
13208
+ if (nonce) s.setAttribute("nonce", nonce);
13209
+ s.textContent = styles[i];
13210
+ this.shadowRoot.prepend(s);
13211
+ {
13212
+ if (owner) {
13213
+ if (owner.__hmrId) {
13214
+ if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
13215
+ let entry = this._childStyles.get(owner.__hmrId);
13216
+ if (!entry) {
13217
+ this._childStyles.set(owner.__hmrId, entry = []);
13218
+ }
13219
+ entry.push(s);
13220
+ }
13221
+ } else {
13023
13222
  (this._styles || (this._styles = [])).push(s);
13024
13223
  }
13025
- });
13224
+ }
13225
+ }
13226
+ }
13227
+ /**
13228
+ * Only called when shaddowRoot is false
13229
+ */
13230
+ _parseSlots() {
13231
+ const slots = this._slots = {};
13232
+ let n;
13233
+ while (n = this.firstChild) {
13234
+ const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
13235
+ (slots[slotName] || (slots[slotName] = [])).push(n);
13236
+ this.removeChild(n);
13237
+ }
13238
+ }
13239
+ /**
13240
+ * Only called when shaddowRoot is false
13241
+ */
13242
+ _renderSlots() {
13243
+ const outlets = this.querySelectorAll("slot");
13244
+ const scopeId = this._instance.type.__scopeId;
13245
+ for (let i = 0; i < outlets.length; i++) {
13246
+ const o = outlets[i];
13247
+ const slotName = o.getAttribute("name") || "default";
13248
+ const content = this._slots[slotName];
13249
+ const parent = o.parentNode;
13250
+ if (content) {
13251
+ for (const n of content) {
13252
+ if (scopeId && n.nodeType === 1) {
13253
+ const id = scopeId + "-s";
13254
+ const walker = document.createTreeWalker(n, 1);
13255
+ n.setAttribute(id, "");
13256
+ let child;
13257
+ while (child = walker.nextNode()) {
13258
+ child.setAttribute(id, "");
13259
+ }
13260
+ }
13261
+ parent.insertBefore(n, o);
13262
+ }
13263
+ } else {
13264
+ while (o.firstChild) parent.insertBefore(o.firstChild, o);
13265
+ }
13266
+ parent.removeChild(o);
13267
+ }
13268
+ }
13269
+ /**
13270
+ * @internal
13271
+ */
13272
+ _injectChildStyle(comp) {
13273
+ this._applyStyles(comp.styles, comp);
13274
+ }
13275
+ /**
13276
+ * @internal
13277
+ */
13278
+ _removeChildStyle(comp) {
13279
+ {
13280
+ this._styleChildren.delete(comp);
13281
+ if (this._childStyles && comp.__hmrId) {
13282
+ const oldStyles = this._childStyles.get(comp.__hmrId);
13283
+ if (oldStyles) {
13284
+ oldStyles.forEach((s) => this._root.removeChild(s));
13285
+ oldStyles.length = 0;
13286
+ }
13287
+ }
13288
+ }
13289
+ }
13290
+ }
13291
+ function useHost(caller) {
13292
+ const instance = getCurrentInstance();
13293
+ const el = instance && instance.ce;
13294
+ if (el) {
13295
+ return el;
13296
+ } else {
13297
+ if (!instance) {
13298
+ warn(
13299
+ `${caller || "useHost"} called without an active component instance.`
13300
+ );
13301
+ } else {
13302
+ warn(
13303
+ `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
13304
+ );
13026
13305
  }
13027
13306
  }
13307
+ return null;
13308
+ }
13309
+ function useShadowRoot() {
13310
+ const el = useHost("useShadowRoot") ;
13311
+ return el && el.shadowRoot;
13028
13312
  }
13029
13313
 
13030
13314
  function useCssModule(name = "$style") {
@@ -13537,7 +13821,7 @@ Expected function or array of functions, received type ${typeof value}.`
13537
13821
  const component = app._component;
13538
13822
  if (!isFunction(component) && !component.render && !component.template) {
13539
13823
  component.template = container.innerHTML;
13540
- {
13824
+ if (container.nodeType === 1) {
13541
13825
  for (let i = 0; i < container.attributes.length; i++) {
13542
13826
  const attr = container.attributes[i];
13543
13827
  if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
@@ -13550,7 +13834,9 @@ Expected function or array of functions, received type ${typeof value}.`
13550
13834
  }
13551
13835
  }
13552
13836
  }
13553
- container.innerHTML = "";
13837
+ if (container.nodeType === 1) {
13838
+ container.textContent = "";
13839
+ }
13554
13840
  const proxy = mount(container, false, resolveRootNamespace(container));
13555
13841
  if (container instanceof Element) {
13556
13842
  container.removeAttribute("v-cloak");
@@ -13777,9 +14063,11 @@ Expected function or array of functions, received type ${typeof value}.`
13777
14063
  useAttrs: useAttrs,
13778
14064
  useCssModule: useCssModule,
13779
14065
  useCssVars: useCssVars,
14066
+ useHost: useHost,
13780
14067
  useId: useId,
13781
14068
  useModel: useModel,
13782
14069
  useSSRContext: useSSRContext,
14070
+ useShadowRoot: useShadowRoot,
13783
14071
  useSlots: useSlots,
13784
14072
  useTemplateRef: useTemplateRef,
13785
14073
  useTransitionState: useTransitionState,