@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
  **/
@@ -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$2("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$2(hook, component.appContext.app, component.uid, component, type, time);
@@ -4241,6 +4297,7 @@ Server rendered element contains more child nodes than client vdom.`
4241
4297
  }
4242
4298
  if (props) {
4243
4299
  {
4300
+ const isCustomElement = el.tagName.includes("-");
4244
4301
  for (const key in props) {
4245
4302
  if (// #11189 skip if this node has directives that have created hooks
4246
4303
  // as it could have mutated the DOM in any possible way
@@ -4248,7 +4305,7 @@ Server rendered element contains more child nodes than client vdom.`
4248
4305
  logMismatchError();
4249
4306
  }
4250
4307
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4251
- key[0] === ".") {
4308
+ key[0] === "." || isCustomElement) {
4252
4309
  patchProp(el, key, null, props[key], void 0, parentComponent);
4253
4310
  }
4254
4311
  }
@@ -4573,24 +4630,19 @@ function isMismatchAllowed(el, allowedType) {
4573
4630
  }
4574
4631
  }
4575
4632
 
4576
- const hydrateOnIdle = () => (hydrate) => {
4577
- const id = requestIdleCallback(hydrate);
4633
+ const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
4634
+ const id = requestIdleCallback(hydrate, { timeout });
4578
4635
  return () => cancelIdleCallback(id);
4579
4636
  };
4580
- const hydrateOnVisible = (margin = 0) => (hydrate, forEach) => {
4581
- const ob = new IntersectionObserver(
4582
- (entries) => {
4583
- for (const e of entries) {
4584
- if (!e.isIntersecting) continue;
4585
- ob.disconnect();
4586
- hydrate();
4587
- break;
4588
- }
4589
- },
4590
- {
4591
- rootMargin: isString(margin) ? margin : margin + "px"
4637
+ const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4638
+ const ob = new IntersectionObserver((entries) => {
4639
+ for (const e of entries) {
4640
+ if (!e.isIntersecting) continue;
4641
+ ob.disconnect();
4642
+ hydrate();
4643
+ break;
4592
4644
  }
4593
- );
4645
+ }, opts);
4594
4646
  forEach((el) => ob.observe(el));
4595
4647
  return () => ob.disconnect();
4596
4648
  };
@@ -4905,7 +4957,7 @@ const KeepAliveImpl = {
4905
4957
  }
4906
4958
  function pruneCacheEntry(key) {
4907
4959
  const cached = cache.get(key);
4908
- if (!current || !isSameVNodeType(cached, current)) {
4960
+ if (cached && (!current || !isSameVNodeType(cached, current))) {
4909
4961
  unmount(cached);
4910
4962
  } else if (current) {
4911
4963
  resetShapeFlag(current);
@@ -4967,6 +5019,10 @@ const KeepAliveImpl = {
4967
5019
  return rawVNode;
4968
5020
  }
4969
5021
  let vnode = getInnerChild(rawVNode);
5022
+ if (vnode.type === Comment) {
5023
+ current = null;
5024
+ return vnode;
5025
+ }
4970
5026
  const comp = vnode.type;
4971
5027
  const name = getComponentName(
4972
5028
  isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
@@ -5099,17 +5155,19 @@ const createHook = (lifecycle) => (hook, target = currentInstance) => {
5099
5155
  };
5100
5156
  const onBeforeMount = createHook("bm");
5101
5157
  const onMounted = createHook("m");
5102
- const onBeforeUpdate = createHook("bu");
5158
+ const onBeforeUpdate = createHook(
5159
+ "bu"
5160
+ );
5103
5161
  const onUpdated = createHook("u");
5104
- const onBeforeUnmount = createHook("bum");
5105
- const onUnmounted = createHook("um");
5106
- const onServerPrefetch = createHook("sp");
5107
- const onRenderTriggered = createHook(
5108
- "rtg"
5162
+ const onBeforeUnmount = createHook(
5163
+ "bum"
5109
5164
  );
5110
- const onRenderTracked = createHook(
5111
- "rtc"
5165
+ const onUnmounted = createHook("um");
5166
+ const onServerPrefetch = createHook(
5167
+ "sp"
5112
5168
  );
5169
+ const onRenderTriggered = createHook("rtg");
5170
+ const onRenderTracked = createHook("rtc");
5113
5171
  function onErrorCaptured(hook, target = currentInstance) {
5114
5172
  injectHook("ec", hook, target);
5115
5173
  }
@@ -5523,9 +5581,14 @@ function createSlots(slots, dynamicSlots) {
5523
5581
  }
5524
5582
 
5525
5583
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5526
- if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
5584
+ if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5527
5585
  if (name !== "default") props.name = name;
5528
- return createVNode("slot", props, fallback && fallback());
5586
+ return openBlock(), createBlock(
5587
+ Fragment,
5588
+ null,
5589
+ [createVNode("slot", props, fallback && fallback())],
5590
+ 64
5591
+ );
5529
5592
  }
5530
5593
  let slot = slots[name];
5531
5594
  if (slot && slot.length > 1) {
@@ -5827,6 +5890,7 @@ const publicPropertiesMap = (
5827
5890
  $refs: (i) => shallowReadonly(i.refs) ,
5828
5891
  $parent: (i) => getPublicInstance(i.parent),
5829
5892
  $root: (i) => getPublicInstance(i.root),
5893
+ $host: (i) => i.ce,
5830
5894
  $emit: (i) => i.emit,
5831
5895
  $options: (i) => resolveMergedOptions(i) ,
5832
5896
  $forceUpdate: (i) => i.f || (i.f = () => {
@@ -5987,29 +6051,25 @@ const PublicInstanceProxyHandlers = {
5987
6051
  return Reflect.ownKeys(target);
5988
6052
  };
5989
6053
  }
5990
- const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
5991
- {},
5992
- PublicInstanceProxyHandlers,
5993
- {
5994
- get(target, key) {
5995
- if (key === Symbol.unscopables) {
5996
- return;
5997
- }
5998
- return PublicInstanceProxyHandlers.get(target, key, target);
5999
- },
6000
- has(_, key) {
6001
- const has = key[0] !== "_" && !isGloballyAllowed(key);
6002
- if (!has && PublicInstanceProxyHandlers.has(_, key)) {
6003
- warn$1(
6004
- `Property ${JSON.stringify(
6005
- key
6006
- )} should not start with _ which is a reserved prefix for Vue internals.`
6007
- );
6008
- }
6009
- return has;
6054
+ const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, {
6055
+ get(target, key) {
6056
+ if (key === Symbol.unscopables) {
6057
+ return;
6058
+ }
6059
+ return PublicInstanceProxyHandlers.get(target, key, target);
6060
+ },
6061
+ has(_, key) {
6062
+ const has = key[0] !== "_" && !isGloballyAllowed(key);
6063
+ if (!has && PublicInstanceProxyHandlers.has(_, key)) {
6064
+ warn$1(
6065
+ `Property ${JSON.stringify(
6066
+ key
6067
+ )} should not start with _ which is a reserved prefix for Vue internals.`
6068
+ );
6010
6069
  }
6070
+ return has;
6011
6071
  }
6012
- );
6072
+ });
6013
6073
  function createDevRenderContext(instance) {
6014
6074
  const target = {};
6015
6075
  Object.defineProperty(target, `_`, {
@@ -6696,7 +6756,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6696
6756
  return vm;
6697
6757
  }
6698
6758
  }
6699
- Vue.version = `2.6.14-compat:${"3.5.0-alpha.5"}`;
6759
+ Vue.version = `2.6.14-compat:${"3.5.0-beta.1"}`;
6700
6760
  Vue.config = singletonApp.config;
6701
6761
  Vue.use = (plugin, ...options) => {
6702
6762
  if (plugin && isFunction(plugin.install)) {
@@ -6969,7 +7029,7 @@ function installCompatMount(app, context, render) {
6969
7029
  /* skip options */
6970
7030
  );
6971
7031
  }
6972
- container.innerHTML = "";
7032
+ container.textContent = "";
6973
7033
  render(vnode, container, namespace);
6974
7034
  if (container instanceof Element) {
6975
7035
  container.removeAttribute("v-cloak");
@@ -7181,7 +7241,7 @@ function createAppAPI(render, hydrate) {
7181
7241
  If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
7182
7242
  );
7183
7243
  }
7184
- const vnode = createVNode(rootComponent, rootProps);
7244
+ const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
7185
7245
  vnode.appContext = context;
7186
7246
  if (namespace === true) {
7187
7247
  namespace = "svg";
@@ -7286,7 +7346,7 @@ function provide(key, value) {
7286
7346
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
7287
7347
  const instance = currentInstance || currentRenderingInstance;
7288
7348
  if (instance || currentApp) {
7289
- const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
7349
+ const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
7290
7350
  if (provides && key in provides) {
7291
7351
  return provides[key];
7292
7352
  } else if (arguments.length > 1) {
@@ -7560,6 +7620,9 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
7560
7620
  } else {
7561
7621
  value = defaultValue;
7562
7622
  }
7623
+ if (instance.ce) {
7624
+ instance.ce._setProp(key, value);
7625
+ }
7563
7626
  }
7564
7627
  if (opt[0 /* shouldCast */]) {
7565
7628
  if (isAbsent && !hasDefault) {
@@ -8562,8 +8625,8 @@ function baseCreateRenderer(options, createHydrationFns) {
8562
8625
  const componentUpdateFn = () => {
8563
8626
  if (!instance.isMounted) {
8564
8627
  let vnodeHook;
8565
- const { el, props, type } = initialVNode;
8566
- const { bm, m, parent } = instance;
8628
+ const { el, props } = initialVNode;
8629
+ const { bm, m, parent, root, type } = instance;
8567
8630
  const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
8568
8631
  toggleRecurse(instance, false);
8569
8632
  if (bm) {
@@ -8609,6 +8672,9 @@ function baseCreateRenderer(options, createHydrationFns) {
8609
8672
  hydrateSubTree();
8610
8673
  }
8611
8674
  } else {
8675
+ if (root.ce) {
8676
+ root.ce._injectChildStyle(type);
8677
+ }
8612
8678
  {
8613
8679
  startMeasure(instance, `render`);
8614
8680
  }
@@ -9312,13 +9378,13 @@ function baseCreateRenderer(options, createHydrationFns) {
9312
9378
  namespace
9313
9379
  );
9314
9380
  }
9381
+ container._vnode = vnode;
9315
9382
  if (!isFlushing) {
9316
9383
  isFlushing = true;
9317
9384
  flushPreFlushCbs();
9318
9385
  flushPostFlushCbs();
9319
9386
  isFlushing = false;
9320
9387
  }
9321
- container._vnode = vnode;
9322
9388
  };
9323
9389
  const internals = {
9324
9390
  p: patch,
@@ -9492,14 +9558,9 @@ function doWatch(source, cb, {
9492
9558
  const _cb = cb;
9493
9559
  cb = (...args) => {
9494
9560
  _cb(...args);
9495
- unwatch();
9561
+ watchHandle();
9496
9562
  };
9497
9563
  }
9498
- if (deep !== void 0 && typeof deep === "number") {
9499
- warn$1(
9500
- `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
9501
- );
9502
- }
9503
9564
  if (!cb) {
9504
9565
  if (immediate !== void 0) {
9505
9566
  warn$1(
@@ -9525,10 +9586,12 @@ function doWatch(source, cb, {
9525
9586
  );
9526
9587
  };
9527
9588
  const instance = currentInstance;
9528
- const reactiveGetter = (source2) => deep === true ? source2 : (
9529
- // for deep: false, only traverse root-level properties
9530
- traverse(source2, deep === false ? 1 : void 0)
9531
- );
9589
+ const reactiveGetter = (source2) => {
9590
+ if (deep) return source2;
9591
+ if (isShallow(source2) || deep === false || deep === 0)
9592
+ return traverse(source2, 1);
9593
+ return traverse(source2);
9594
+ };
9532
9595
  let getter;
9533
9596
  let forceTrigger = false;
9534
9597
  let isMultiSource = false;
@@ -9584,7 +9647,8 @@ function doWatch(source, cb, {
9584
9647
  }
9585
9648
  if (cb && deep) {
9586
9649
  const baseGetter = getter;
9587
- getter = () => traverse(baseGetter());
9650
+ const depth = deep === true ? Infinity : deep;
9651
+ getter = () => traverse(baseGetter(), depth);
9588
9652
  }
9589
9653
  let cleanup;
9590
9654
  let onCleanup = (fn) => {
@@ -9609,7 +9673,12 @@ function doWatch(source, cb, {
9609
9673
  const ctx = useSSRContext();
9610
9674
  ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
9611
9675
  } else {
9612
- return NOOP;
9676
+ const watchHandle2 = () => {
9677
+ };
9678
+ watchHandle2.stop = NOOP;
9679
+ watchHandle2.resume = NOOP;
9680
+ watchHandle2.pause = NOOP;
9681
+ return watchHandle2;
9613
9682
  }
9614
9683
  }
9615
9684
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -9650,12 +9719,15 @@ function doWatch(source, cb, {
9650
9719
  }
9651
9720
  effect.scheduler = scheduler;
9652
9721
  const scope = getCurrentScope();
9653
- const unwatch = () => {
9722
+ const watchHandle = () => {
9654
9723
  effect.stop();
9655
9724
  if (scope) {
9656
9725
  remove(scope.effects, effect);
9657
9726
  }
9658
9727
  };
9728
+ watchHandle.pause = effect.pause.bind(effect);
9729
+ watchHandle.resume = effect.resume.bind(effect);
9730
+ watchHandle.stop = watchHandle;
9659
9731
  {
9660
9732
  effect.onTrack = onTrack;
9661
9733
  effect.onTrigger = onTrigger;
@@ -9674,8 +9746,8 @@ function doWatch(source, cb, {
9674
9746
  } else {
9675
9747
  effect.run();
9676
9748
  }
9677
- if (ssrCleanup) ssrCleanup.push(unwatch);
9678
- return unwatch;
9749
+ if (ssrCleanup) ssrCleanup.push(watchHandle);
9750
+ return watchHandle;
9679
9751
  }
9680
9752
  function instanceWatch(source, value, options) {
9681
9753
  const publicThis = this.proxy;
@@ -9765,7 +9837,8 @@ function useModel(props, name, options = EMPTY_OBJ) {
9765
9837
  return options.get ? options.get(localValue) : localValue;
9766
9838
  },
9767
9839
  set(value) {
9768
- if (!hasChanged(value, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
9840
+ const emittedValue = options.set ? options.set(value) : value;
9841
+ if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
9769
9842
  return;
9770
9843
  }
9771
9844
  const rawProps = i.vnode.props;
@@ -9774,7 +9847,6 @@ function useModel(props, name, options = EMPTY_OBJ) {
9774
9847
  localValue = value;
9775
9848
  trigger();
9776
9849
  }
9777
- const emittedValue = options.set ? options.set(value) : value;
9778
9850
  i.emit(`update:${name}`, emittedValue);
9779
9851
  if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
9780
9852
  trigger();
@@ -9812,9 +9884,9 @@ function emit(instance, event, ...rawArgs) {
9812
9884
  } = instance;
9813
9885
  if (emitsOptions) {
9814
9886
  if (!(event in emitsOptions) && !(event.startsWith("hook:") || event.startsWith(compatModelEventPrefix))) {
9815
- if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
9887
+ if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
9816
9888
  warn$1(
9817
- `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
9889
+ `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
9818
9890
  );
9819
9891
  }
9820
9892
  } else {
@@ -11745,11 +11817,16 @@ function useTemplateRef(key) {
11745
11817
  const r = shallowRef(null);
11746
11818
  if (i) {
11747
11819
  const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
11748
- Object.defineProperty(refs, key, {
11749
- enumerable: true,
11750
- get: () => r.value,
11751
- set: (val) => r.value = val
11752
- });
11820
+ let desc;
11821
+ if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
11822
+ warn$1(`useTemplateRef('${key}') already exists.`);
11823
+ } else {
11824
+ Object.defineProperty(refs, key, {
11825
+ enumerable: true,
11826
+ get: () => r.value,
11827
+ set: (val) => r.value = val
11828
+ });
11829
+ }
11753
11830
  } else {
11754
11831
  warn$1(
11755
11832
  `useTemplateRef() is called when there is no active component instance to be associated with.`
@@ -11983,7 +12060,7 @@ function isMemoSame(cached, memo) {
11983
12060
  return true;
11984
12061
  }
11985
12062
 
11986
- const version = "3.5.0-alpha.5";
12063
+ const version = "3.5.0-beta.1";
11987
12064
  const warn = warn$1 ;
11988
12065
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11989
12066
  const devtools = devtools$1 ;
@@ -11995,7 +12072,8 @@ const _ssrUtils = {
11995
12072
  setCurrentRenderingInstance,
11996
12073
  isVNode: isVNode,
11997
12074
  normalizeVNode,
11998
- getComponentPublicInstance
12075
+ getComponentPublicInstance,
12076
+ ensureValidVNode
11999
12077
  };
12000
12078
  const ssrUtils = _ssrUtils ;
12001
12079
  const resolveFilter = resolveFilter$1 ;
@@ -12009,6 +12087,18 @@ const _compatUtils = {
12009
12087
  const compatUtils = _compatUtils ;
12010
12088
  const DeprecationTypes = DeprecationTypes$1 ;
12011
12089
 
12090
+ let policy = void 0;
12091
+ const tt = typeof window !== "undefined" && window.trustedTypes;
12092
+ if (tt) {
12093
+ try {
12094
+ policy = /* @__PURE__ */ tt.createPolicy("vue", {
12095
+ createHTML: (val) => val
12096
+ });
12097
+ } catch (e) {
12098
+ warn(`Error creating trusted types policy: ${e}`);
12099
+ }
12100
+ }
12101
+ const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
12012
12102
  const svgNS = "http://www.w3.org/2000/svg";
12013
12103
  const mathmlNS = "http://www.w3.org/1998/Math/MathML";
12014
12104
  const doc = typeof document !== "undefined" ? document : null;
@@ -12056,7 +12146,9 @@ const nodeOps = {
12056
12146
  if (start === end || !(start = start.nextSibling)) break;
12057
12147
  }
12058
12148
  } else {
12059
- templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
12149
+ templateContainer.innerHTML = unsafeToTrustedHTML(
12150
+ namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
12151
+ );
12060
12152
  const template = templateContainer.content;
12061
12153
  if (namespace === "svg" || namespace === "mathml") {
12062
12154
  const wrapper = template.firstChild;
@@ -12463,11 +12555,17 @@ function useCssVars(getter) {
12463
12555
  }
12464
12556
  const setVars = () => {
12465
12557
  const vars = getter(instance.proxy);
12466
- setVarsOnVNode(instance.subTree, vars);
12558
+ if (instance.ce) {
12559
+ setVarsOnNode(instance.ce, vars);
12560
+ } else {
12561
+ setVarsOnVNode(instance.subTree, vars);
12562
+ }
12467
12563
  updateTeleports(vars);
12468
12564
  };
12469
- onMounted(() => {
12565
+ onBeforeMount(() => {
12470
12566
  watchPostEffect(setVars);
12567
+ });
12568
+ onMounted(() => {
12471
12569
  const ob = new MutationObserver(setVars);
12472
12570
  ob.observe(instance.subTree.el.parentNode, { childList: true });
12473
12571
  onUnmounted(() => ob.disconnect());
@@ -12864,16 +12962,24 @@ function shouldSetAsProp(el, key, value, isSVG) {
12864
12962
  if (isNativeOn(key) && isString(value)) {
12865
12963
  return false;
12866
12964
  }
12867
- return key in el;
12965
+ if (key in el) {
12966
+ return true;
12967
+ }
12968
+ if (el._isVueCE && (/[A-Z]/.test(key) || !isString(value))) {
12969
+ return true;
12970
+ }
12971
+ return false;
12868
12972
  }
12869
12973
 
12974
+ const REMOVAL = {};
12870
12975
  /*! #__NO_SIDE_EFFECTS__ */
12871
12976
  // @__NO_SIDE_EFFECTS__
12872
- function defineCustomElement(options, extraOptions, hydrate2) {
12977
+ function defineCustomElement(options, extraOptions, _createApp) {
12873
12978
  const Comp = defineComponent(options, extraOptions);
12979
+ if (isPlainObject(Comp)) extend(Comp, extraOptions);
12874
12980
  class VueCustomElement extends VueElement {
12875
12981
  constructor(initialProps) {
12876
- super(Comp, initialProps, hydrate2);
12982
+ super(Comp, initialProps, _createApp);
12877
12983
  }
12878
12984
  }
12879
12985
  VueCustomElement.def = Comp;
@@ -12881,47 +12987,88 @@ function defineCustomElement(options, extraOptions, hydrate2) {
12881
12987
  }
12882
12988
  /*! #__NO_SIDE_EFFECTS__ */
12883
12989
  const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
12884
- return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
12990
+ return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
12885
12991
  };
12886
12992
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
12887
12993
  };
12888
12994
  class VueElement extends BaseClass {
12889
- constructor(_def, _props = {}, hydrate2) {
12995
+ constructor(_def, _props = {}, _createApp = createApp) {
12890
12996
  super();
12891
12997
  this._def = _def;
12892
12998
  this._props = _props;
12999
+ this._createApp = _createApp;
13000
+ this._isVueCE = true;
12893
13001
  /**
12894
13002
  * @internal
12895
13003
  */
12896
13004
  this._instance = null;
13005
+ /**
13006
+ * @internal
13007
+ */
13008
+ this._app = null;
13009
+ /**
13010
+ * @internal
13011
+ */
13012
+ this._nonce = this._def.nonce;
12897
13013
  this._connected = false;
12898
13014
  this._resolved = false;
12899
13015
  this._numberProps = null;
13016
+ this._styleChildren = /* @__PURE__ */ new WeakSet();
12900
13017
  this._ob = null;
12901
- if (this.shadowRoot && hydrate2) {
12902
- hydrate2(this._createVNode(), this.shadowRoot);
13018
+ if (this.shadowRoot && _createApp !== createApp) {
13019
+ this._root = this.shadowRoot;
13020
+ this._mount(_def);
12903
13021
  } else {
12904
13022
  if (this.shadowRoot) {
12905
13023
  warn(
12906
13024
  `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
12907
13025
  );
12908
13026
  }
12909
- this.attachShadow({ mode: "open" });
13027
+ if (_def.shadowRoot !== false) {
13028
+ this.attachShadow({ mode: "open" });
13029
+ this._root = this.shadowRoot;
13030
+ } else {
13031
+ this._root = this;
13032
+ }
12910
13033
  if (!this._def.__asyncLoader) {
12911
13034
  this._resolveProps(this._def);
12912
13035
  }
12913
13036
  }
12914
13037
  }
12915
13038
  connectedCallback() {
13039
+ if (!this.shadowRoot) {
13040
+ this._parseSlots();
13041
+ }
12916
13042
  this._connected = true;
13043
+ let parent = this;
13044
+ while (parent = parent && (parent.parentNode || parent.host)) {
13045
+ if (parent instanceof VueElement) {
13046
+ this._parent = parent;
13047
+ break;
13048
+ }
13049
+ }
12917
13050
  if (!this._instance) {
12918
13051
  if (this._resolved) {
13052
+ this._setParent();
12919
13053
  this._update();
12920
13054
  } else {
12921
- this._resolveDef();
13055
+ if (parent && parent._pendingResolve) {
13056
+ this._pendingResolve = parent._pendingResolve.then(() => {
13057
+ this._pendingResolve = void 0;
13058
+ this._resolveDef();
13059
+ });
13060
+ } else {
13061
+ this._resolveDef();
13062
+ }
12922
13063
  }
12923
13064
  }
12924
13065
  }
13066
+ _setParent(parent = this._parent) {
13067
+ if (parent) {
13068
+ this._instance.parent = parent._instance;
13069
+ this._instance.provides = parent._instance.provides;
13070
+ }
13071
+ }
12925
13072
  disconnectedCallback() {
12926
13073
  this._connected = false;
12927
13074
  nextTick(() => {
@@ -12930,8 +13077,9 @@ class VueElement extends BaseClass {
12930
13077
  this._ob.disconnect();
12931
13078
  this._ob = null;
12932
13079
  }
12933
- render(null, this.shadowRoot);
12934
- this._instance = null;
13080
+ this._app && this._app.unmount();
13081
+ this._instance.ce = void 0;
13082
+ this._app = this._instance = null;
12935
13083
  }
12936
13084
  });
12937
13085
  }
@@ -12939,7 +13087,9 @@ class VueElement extends BaseClass {
12939
13087
  * resolve inner component definition (handle possible async component)
12940
13088
  */
12941
13089
  _resolveDef() {
12942
- this._resolved = true;
13090
+ if (this._pendingResolve) {
13091
+ return;
13092
+ }
12943
13093
  for (let i = 0; i < this.attributes.length; i++) {
12944
13094
  this._setAttr(this.attributes[i].name);
12945
13095
  }
@@ -12950,6 +13100,8 @@ class VueElement extends BaseClass {
12950
13100
  });
12951
13101
  this._ob.observe(this, { attributes: true });
12952
13102
  const resolve = (def, isAsync = false) => {
13103
+ this._resolved = true;
13104
+ this._pendingResolve = void 0;
12953
13105
  const { props, styles } = def;
12954
13106
  let numberProps;
12955
13107
  if (props && !isArray(props)) {
@@ -12967,22 +13119,53 @@ class VueElement extends BaseClass {
12967
13119
  if (isAsync) {
12968
13120
  this._resolveProps(def);
12969
13121
  }
12970
- this._applyStyles(styles);
12971
- this._update();
13122
+ if (this.shadowRoot) {
13123
+ this._applyStyles(styles);
13124
+ } else if (styles) {
13125
+ warn(
13126
+ "Custom element style injection is not supported when using shadowRoot: false"
13127
+ );
13128
+ }
13129
+ this._mount(def);
12972
13130
  };
12973
13131
  const asyncDef = this._def.__asyncLoader;
12974
13132
  if (asyncDef) {
12975
- asyncDef().then((def) => resolve(def, true));
13133
+ this._pendingResolve = asyncDef().then(
13134
+ (def) => resolve(this._def = def, true)
13135
+ );
12976
13136
  } else {
12977
13137
  resolve(this._def);
12978
13138
  }
12979
13139
  }
13140
+ _mount(def) {
13141
+ if (!def.name) {
13142
+ def.name = "VueElement";
13143
+ }
13144
+ this._app = this._createApp(def);
13145
+ if (def.configureApp) {
13146
+ def.configureApp(this._app);
13147
+ }
13148
+ this._app._ceVNode = this._createVNode();
13149
+ this._app.mount(this._root);
13150
+ const exposed = this._instance && this._instance.exposed;
13151
+ if (!exposed) return;
13152
+ for (const key in exposed) {
13153
+ if (!hasOwn(this, key)) {
13154
+ Object.defineProperty(this, key, {
13155
+ // unwrap ref to be consistent with public instance behavior
13156
+ get: () => unref(exposed[key])
13157
+ });
13158
+ } else {
13159
+ warn(`Exposed property "${key}" already exists on custom element.`);
13160
+ }
13161
+ }
13162
+ }
12980
13163
  _resolveProps(def) {
12981
13164
  const { props } = def;
12982
13165
  const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
12983
13166
  for (const key of Object.keys(this)) {
12984
13167
  if (key[0] !== "_" && declaredPropKeys.includes(key)) {
12985
- this._setProp(key, this[key], true, false);
13168
+ this._setProp(key, this[key]);
12986
13169
  }
12987
13170
  }
12988
13171
  for (const key of declaredPropKeys.map(camelize)) {
@@ -12991,18 +13174,20 @@ class VueElement extends BaseClass {
12991
13174
  return this._getProp(key);
12992
13175
  },
12993
13176
  set(val) {
12994
- this._setProp(key, val);
13177
+ this._setProp(key, val, true, true);
12995
13178
  }
12996
13179
  });
12997
13180
  }
12998
13181
  }
12999
13182
  _setAttr(key) {
13000
- let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
13183
+ if (key.startsWith("data-v-")) return;
13184
+ const has = this.hasAttribute(key);
13185
+ let value = has ? this.getAttribute(key) : REMOVAL;
13001
13186
  const camelKey = camelize(key);
13002
- if (this._numberProps && this._numberProps[camelKey]) {
13187
+ if (has && this._numberProps && this._numberProps[camelKey]) {
13003
13188
  value = toNumber(value);
13004
13189
  }
13005
- this._setProp(camelKey, value, false);
13190
+ this._setProp(camelKey, value, false, true);
13006
13191
  }
13007
13192
  /**
13008
13193
  * @internal
@@ -13013,9 +13198,13 @@ class VueElement extends BaseClass {
13013
13198
  /**
13014
13199
  * @internal
13015
13200
  */
13016
- _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
13201
+ _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
13017
13202
  if (val !== this._props[key]) {
13018
- this._props[key] = val;
13203
+ if (val === REMOVAL) {
13204
+ delete this._props[key];
13205
+ } else {
13206
+ this._props[key] = val;
13207
+ }
13019
13208
  if (shouldUpdate && this._instance) {
13020
13209
  this._update();
13021
13210
  }
@@ -13031,18 +13220,22 @@ class VueElement extends BaseClass {
13031
13220
  }
13032
13221
  }
13033
13222
  _update() {
13034
- render(this._createVNode(), this.shadowRoot);
13223
+ render(this._createVNode(), this._root);
13035
13224
  }
13036
13225
  _createVNode() {
13037
- const vnode = createVNode(this._def, extend({}, this._props));
13226
+ const baseProps = {};
13227
+ if (!this.shadowRoot) {
13228
+ baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
13229
+ }
13230
+ const vnode = createVNode(this._def, extend(baseProps, this._props));
13038
13231
  if (!this._instance) {
13039
13232
  vnode.ce = (instance) => {
13040
13233
  this._instance = instance;
13041
- instance.isCE = true;
13234
+ instance.ce = this;
13042
13235
  {
13043
13236
  instance.ceReload = (newStyles) => {
13044
13237
  if (this._styles) {
13045
- this._styles.forEach((s) => this.shadowRoot.removeChild(s));
13238
+ this._styles.forEach((s) => this._root.removeChild(s));
13046
13239
  this._styles.length = 0;
13047
13240
  }
13048
13241
  this._applyStyles(newStyles);
@@ -13052,9 +13245,10 @@ class VueElement extends BaseClass {
13052
13245
  }
13053
13246
  const dispatch = (event, args) => {
13054
13247
  this.dispatchEvent(
13055
- new CustomEvent(event, {
13056
- detail: args
13057
- })
13248
+ new CustomEvent(
13249
+ event,
13250
+ isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
13251
+ )
13058
13252
  );
13059
13253
  };
13060
13254
  instance.emit = (event, ...args) => {
@@ -13063,30 +13257,126 @@ class VueElement extends BaseClass {
13063
13257
  dispatch(hyphenate(event), args);
13064
13258
  }
13065
13259
  };
13066
- let parent = this;
13067
- while (parent = parent && (parent.parentNode || parent.host)) {
13068
- if (parent instanceof VueElement) {
13069
- instance.parent = parent._instance;
13070
- instance.provides = parent._instance.provides;
13071
- break;
13072
- }
13073
- }
13260
+ this._setParent();
13074
13261
  };
13075
13262
  }
13076
13263
  return vnode;
13077
13264
  }
13078
- _applyStyles(styles) {
13079
- if (styles) {
13080
- styles.forEach((css) => {
13081
- const s = document.createElement("style");
13082
- s.textContent = css;
13083
- this.shadowRoot.appendChild(s);
13084
- {
13265
+ _applyStyles(styles, owner) {
13266
+ if (!styles) return;
13267
+ if (owner) {
13268
+ if (owner === this._def || this._styleChildren.has(owner)) {
13269
+ return;
13270
+ }
13271
+ this._styleChildren.add(owner);
13272
+ }
13273
+ const nonce = this._nonce;
13274
+ for (let i = styles.length - 1; i >= 0; i--) {
13275
+ const s = document.createElement("style");
13276
+ if (nonce) s.setAttribute("nonce", nonce);
13277
+ s.textContent = styles[i];
13278
+ this.shadowRoot.prepend(s);
13279
+ {
13280
+ if (owner) {
13281
+ if (owner.__hmrId) {
13282
+ if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
13283
+ let entry = this._childStyles.get(owner.__hmrId);
13284
+ if (!entry) {
13285
+ this._childStyles.set(owner.__hmrId, entry = []);
13286
+ }
13287
+ entry.push(s);
13288
+ }
13289
+ } else {
13085
13290
  (this._styles || (this._styles = [])).push(s);
13086
13291
  }
13087
- });
13292
+ }
13293
+ }
13294
+ }
13295
+ /**
13296
+ * Only called when shaddowRoot is false
13297
+ */
13298
+ _parseSlots() {
13299
+ const slots = this._slots = {};
13300
+ let n;
13301
+ while (n = this.firstChild) {
13302
+ const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
13303
+ (slots[slotName] || (slots[slotName] = [])).push(n);
13304
+ this.removeChild(n);
13088
13305
  }
13089
13306
  }
13307
+ /**
13308
+ * Only called when shaddowRoot is false
13309
+ */
13310
+ _renderSlots() {
13311
+ const outlets = this.querySelectorAll("slot");
13312
+ const scopeId = this._instance.type.__scopeId;
13313
+ for (let i = 0; i < outlets.length; i++) {
13314
+ const o = outlets[i];
13315
+ const slotName = o.getAttribute("name") || "default";
13316
+ const content = this._slots[slotName];
13317
+ const parent = o.parentNode;
13318
+ if (content) {
13319
+ for (const n of content) {
13320
+ if (scopeId && n.nodeType === 1) {
13321
+ const id = scopeId + "-s";
13322
+ const walker = document.createTreeWalker(n, 1);
13323
+ n.setAttribute(id, "");
13324
+ let child;
13325
+ while (child = walker.nextNode()) {
13326
+ child.setAttribute(id, "");
13327
+ }
13328
+ }
13329
+ parent.insertBefore(n, o);
13330
+ }
13331
+ } else {
13332
+ while (o.firstChild) parent.insertBefore(o.firstChild, o);
13333
+ }
13334
+ parent.removeChild(o);
13335
+ }
13336
+ }
13337
+ /**
13338
+ * @internal
13339
+ */
13340
+ _injectChildStyle(comp) {
13341
+ this._applyStyles(comp.styles, comp);
13342
+ }
13343
+ /**
13344
+ * @internal
13345
+ */
13346
+ _removeChildStyle(comp) {
13347
+ {
13348
+ this._styleChildren.delete(comp);
13349
+ if (this._childStyles && comp.__hmrId) {
13350
+ const oldStyles = this._childStyles.get(comp.__hmrId);
13351
+ if (oldStyles) {
13352
+ oldStyles.forEach((s) => this._root.removeChild(s));
13353
+ oldStyles.length = 0;
13354
+ }
13355
+ }
13356
+ }
13357
+ }
13358
+ }
13359
+ function useHost(caller) {
13360
+ const instance = getCurrentInstance();
13361
+ const el = instance && instance.ce;
13362
+ if (el) {
13363
+ return el;
13364
+ } else {
13365
+ if (!instance) {
13366
+ warn(
13367
+ `${caller || "useHost"} called without an active component instance.`
13368
+ );
13369
+ } else {
13370
+ warn(
13371
+ `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
13372
+ );
13373
+ }
13374
+ }
13375
+ return null;
13376
+ }
13377
+ function useShadowRoot() {
13378
+ const el = useHost("useShadowRoot") ;
13379
+ return el && el.shadowRoot;
13090
13380
  }
13091
13381
 
13092
13382
  function useCssModule(name = "$style") {
@@ -13645,7 +13935,7 @@ const createApp = (...args) => {
13645
13935
  const component = app._component;
13646
13936
  if (!isFunction(component) && !component.render && !component.template) {
13647
13937
  component.template = container.innerHTML;
13648
- {
13938
+ if (container.nodeType === 1) {
13649
13939
  for (let i = 0; i < container.attributes.length; i++) {
13650
13940
  const attr = container.attributes[i];
13651
13941
  if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
@@ -13658,7 +13948,9 @@ const createApp = (...args) => {
13658
13948
  }
13659
13949
  }
13660
13950
  }
13661
- container.innerHTML = "";
13951
+ if (container.nodeType === 1) {
13952
+ container.textContent = "";
13953
+ }
13662
13954
  const proxy = mount(container, false, resolveRootNamespace(container));
13663
13955
  if (container instanceof Element) {
13664
13956
  container.removeAttribute("v-cloak");
@@ -13892,9 +14184,11 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
13892
14184
  useAttrs: useAttrs,
13893
14185
  useCssModule: useCssModule,
13894
14186
  useCssVars: useCssVars,
14187
+ useHost: useHost,
13895
14188
  useId: useId,
13896
14189
  useModel: useModel,
13897
14190
  useSSRContext: useSSRContext,
14191
+ useShadowRoot: useShadowRoot,
13898
14192
  useSlots: useSlots,
13899
14193
  useTemplateRef: useTemplateRef,
13900
14194
  useTransitionState: useTransitionState,
@@ -13961,6 +14255,6 @@ Vue.compile = () => {
13961
14255
  }
13962
14256
  };
13963
14257
 
13964
- const { configureCompat } = Vue;
14258
+ const configureCompat = Vue.configureCompat;
13965
14259
 
13966
- 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, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue as default, 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 };
14260
+ 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, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue as default, 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 };