@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++) {
@@ -386,6 +390,7 @@ class EffectScope {
386
390
  * @internal
387
391
  */
388
392
  this.cleanups = [];
393
+ this._isPaused = false;
389
394
  this.parent = activeEffectScope;
390
395
  if (!detached && activeEffectScope) {
391
396
  this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
@@ -396,6 +401,37 @@ class EffectScope {
396
401
  get active() {
397
402
  return this._active;
398
403
  }
404
+ pause() {
405
+ if (this._active) {
406
+ this._isPaused = true;
407
+ if (this.scopes) {
408
+ for (let i = 0, l = this.scopes.length; i < l; i++) {
409
+ this.scopes[i].pause();
410
+ }
411
+ }
412
+ for (let i = 0, l = this.effects.length; i < l; i++) {
413
+ this.effects[i].pause();
414
+ }
415
+ }
416
+ }
417
+ /**
418
+ * Resumes the effect scope, including all child scopes and effects.
419
+ */
420
+ resume() {
421
+ if (this._active) {
422
+ if (this._isPaused) {
423
+ this._isPaused = false;
424
+ if (this.scopes) {
425
+ for (let i = 0, l = this.scopes.length; i < l; i++) {
426
+ this.scopes[i].resume();
427
+ }
428
+ }
429
+ for (let i = 0, l = this.effects.length; i < l; i++) {
430
+ this.effects[i].resume();
431
+ }
432
+ }
433
+ }
434
+ }
399
435
  run(fn) {
400
436
  if (this._active) {
401
437
  const currentEffectScope = activeEffectScope;
@@ -466,6 +502,7 @@ function onScopeDispose(fn, failSilently = false) {
466
502
  }
467
503
 
468
504
  let activeSub;
505
+ const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
469
506
  class ReactiveEffect {
470
507
  constructor(fn) {
471
508
  this.fn = fn;
@@ -494,6 +531,18 @@ class ReactiveEffect {
494
531
  activeEffectScope.effects.push(this);
495
532
  }
496
533
  }
534
+ pause() {
535
+ this.flags |= 128;
536
+ }
537
+ resume() {
538
+ if (this.flags & 128) {
539
+ this.flags &= ~128;
540
+ if (pausedQueueEffects.has(this)) {
541
+ pausedQueueEffects.delete(this);
542
+ this.trigger();
543
+ }
544
+ }
545
+ }
497
546
  /**
498
547
  * @internal
499
548
  */
@@ -547,7 +596,9 @@ class ReactiveEffect {
547
596
  }
548
597
  }
549
598
  trigger() {
550
- if (this.scheduler) {
599
+ if (this.flags & 128) {
600
+ pausedQueueEffects.add(this);
601
+ } else if (this.scheduler) {
551
602
  this.scheduler();
552
603
  } else {
553
604
  this.runIfDirty();
@@ -867,9 +918,15 @@ function addSub(link) {
867
918
  link.dep.subs = link;
868
919
  }
869
920
  const targetMap = /* @__PURE__ */ new WeakMap();
870
- const ITERATE_KEY = Symbol("Object iterate" );
871
- const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
872
- const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
921
+ const ITERATE_KEY = Symbol(
922
+ "Object iterate"
923
+ );
924
+ const MAP_KEY_ITERATE_KEY = Symbol(
925
+ "Map keys iterate"
926
+ );
927
+ const ARRAY_ITERATE_KEY = Symbol(
928
+ "Array iterate"
929
+ );
873
930
  function track(target, type, key) {
874
931
  if (shouldTrack && activeSub) {
875
932
  let depsMap = targetMap.get(target);
@@ -1159,7 +1216,7 @@ class BaseReactiveHandler {
1159
1216
  return isShallow2;
1160
1217
  } else if (key === "__v_raw") {
1161
1218
  if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
1162
- // this means the reciever is a user proxy of the reactive proxy
1219
+ // this means the receiver is a user proxy of the reactive proxy
1163
1220
  Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
1164
1221
  return target;
1165
1222
  }
@@ -1283,9 +1340,7 @@ class ReadonlyReactiveHandler extends BaseReactiveHandler {
1283
1340
  }
1284
1341
  const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
1285
1342
  const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
1286
- const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
1287
- true
1288
- );
1343
+ const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
1289
1344
  const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
1290
1345
 
1291
1346
  const toShallow = (value) => value;
@@ -1780,13 +1835,14 @@ function proxyRefs(objectWithRefs) {
1780
1835
  class CustomRefImpl {
1781
1836
  constructor(factory) {
1782
1837
  this["__v_isRef"] = true;
1838
+ this._value = void 0;
1783
1839
  const dep = this.dep = new Dep();
1784
1840
  const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
1785
1841
  this._get = get;
1786
1842
  this._set = set;
1787
1843
  }
1788
1844
  get value() {
1789
- return this._get();
1845
+ return this._value = this._get();
1790
1846
  }
1791
1847
  set value(newVal) {
1792
1848
  this._set(newVal);
@@ -1811,10 +1867,11 @@ class ObjectRefImpl {
1811
1867
  this._key = _key;
1812
1868
  this._defaultValue = _defaultValue;
1813
1869
  this["__v_isRef"] = true;
1870
+ this._value = void 0;
1814
1871
  }
1815
1872
  get value() {
1816
1873
  const val = this._object[this._key];
1817
- return val === void 0 ? this._defaultValue : val;
1874
+ return this._value = val === void 0 ? this._defaultValue : val;
1818
1875
  }
1819
1876
  set value(newVal) {
1820
1877
  this._object[this._key] = newVal;
@@ -1828,9 +1885,10 @@ class GetterRefImpl {
1828
1885
  this._getter = _getter;
1829
1886
  this["__v_isRef"] = true;
1830
1887
  this["__v_isReadonly"] = true;
1888
+ this._value = void 0;
1831
1889
  }
1832
1890
  get value() {
1833
- return this._getter();
1891
+ return this._value = this._getter();
1834
1892
  }
1835
1893
  }
1836
1894
  function toRef(source, key, defaultValue) {
@@ -1864,7 +1922,8 @@ class ComputedRefImpl {
1864
1922
  /**
1865
1923
  * @internal
1866
1924
  */
1867
- this["__v_isRef"] = true;
1925
+ this.__v_isRef = true;
1926
+ // TODO isolatedDeclarations "__v_isReadonly"
1868
1927
  // A computed is also a subscriber that tracks other deps
1869
1928
  /**
1870
1929
  * @internal
@@ -2489,6 +2548,9 @@ function reload(id, newComp) {
2489
2548
  "[HMR] Root or manually mounted instance modified. Full reload required."
2490
2549
  );
2491
2550
  }
2551
+ if (instance.root.ce && instance !== instance.root) {
2552
+ instance.root.ce._removeChildStyle(oldComp);
2553
+ }
2492
2554
  }
2493
2555
  queuePostFlushCb(() => {
2494
2556
  hmrDirtyComponents.clear();
@@ -2568,9 +2630,7 @@ function devtoolsInitApp(app, version) {
2568
2630
  function devtoolsUnmountApp(app) {
2569
2631
  emit$2("app:unmount" /* APP_UNMOUNT */, app);
2570
2632
  }
2571
- const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
2572
- "component:added" /* COMPONENT_ADDED */
2573
- );
2633
+ const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
2574
2634
  const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
2575
2635
  const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
2576
2636
  "component:removed" /* COMPONENT_REMOVED */
@@ -2594,12 +2654,8 @@ function createDevtoolsComponentHook(hook) {
2594
2654
  );
2595
2655
  };
2596
2656
  }
2597
- const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
2598
- "perf:start" /* PERFORMANCE_START */
2599
- );
2600
- const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
2601
- "perf:end" /* PERFORMANCE_END */
2602
- );
2657
+ const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
2658
+ const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
2603
2659
  function createDevtoolsPerformanceHook(hook) {
2604
2660
  return (component, type, time) => {
2605
2661
  emit$2(hook, component.appContext.app, component.uid, component, type, time);
@@ -4308,6 +4364,7 @@ Server rendered element contains more child nodes than client vdom.`
4308
4364
  }
4309
4365
  if (props) {
4310
4366
  {
4367
+ const isCustomElement = el.tagName.includes("-");
4311
4368
  for (const key in props) {
4312
4369
  if (// #11189 skip if this node has directives that have created hooks
4313
4370
  // as it could have mutated the DOM in any possible way
@@ -4315,7 +4372,7 @@ Server rendered element contains more child nodes than client vdom.`
4315
4372
  logMismatchError();
4316
4373
  }
4317
4374
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4318
- key[0] === ".") {
4375
+ key[0] === "." || isCustomElement) {
4319
4376
  patchProp(el, key, null, props[key], void 0, parentComponent);
4320
4377
  }
4321
4378
  }
@@ -4640,24 +4697,19 @@ function isMismatchAllowed(el, allowedType) {
4640
4697
  }
4641
4698
  }
4642
4699
 
4643
- const hydrateOnIdle = () => (hydrate) => {
4644
- const id = requestIdleCallback(hydrate);
4700
+ const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
4701
+ const id = requestIdleCallback(hydrate, { timeout });
4645
4702
  return () => cancelIdleCallback(id);
4646
4703
  };
4647
- const hydrateOnVisible = (margin = 0) => (hydrate, forEach) => {
4648
- const ob = new IntersectionObserver(
4649
- (entries) => {
4650
- for (const e of entries) {
4651
- if (!e.isIntersecting) continue;
4652
- ob.disconnect();
4653
- hydrate();
4654
- break;
4655
- }
4656
- },
4657
- {
4658
- rootMargin: isString(margin) ? margin : margin + "px"
4704
+ const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4705
+ const ob = new IntersectionObserver((entries) => {
4706
+ for (const e of entries) {
4707
+ if (!e.isIntersecting) continue;
4708
+ ob.disconnect();
4709
+ hydrate();
4710
+ break;
4659
4711
  }
4660
- );
4712
+ }, opts);
4661
4713
  forEach((el) => ob.observe(el));
4662
4714
  return () => ob.disconnect();
4663
4715
  };
@@ -4972,7 +5024,7 @@ const KeepAliveImpl = {
4972
5024
  }
4973
5025
  function pruneCacheEntry(key) {
4974
5026
  const cached = cache.get(key);
4975
- if (!current || !isSameVNodeType(cached, current)) {
5027
+ if (cached && (!current || !isSameVNodeType(cached, current))) {
4976
5028
  unmount(cached);
4977
5029
  } else if (current) {
4978
5030
  resetShapeFlag(current);
@@ -5034,6 +5086,10 @@ const KeepAliveImpl = {
5034
5086
  return rawVNode;
5035
5087
  }
5036
5088
  let vnode = getInnerChild(rawVNode);
5089
+ if (vnode.type === Comment) {
5090
+ current = null;
5091
+ return vnode;
5092
+ }
5037
5093
  const comp = vnode.type;
5038
5094
  const name = getComponentName(
5039
5095
  isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
@@ -5166,17 +5222,19 @@ const createHook = (lifecycle) => (hook, target = currentInstance) => {
5166
5222
  };
5167
5223
  const onBeforeMount = createHook("bm");
5168
5224
  const onMounted = createHook("m");
5169
- const onBeforeUpdate = createHook("bu");
5225
+ const onBeforeUpdate = createHook(
5226
+ "bu"
5227
+ );
5170
5228
  const onUpdated = createHook("u");
5171
- const onBeforeUnmount = createHook("bum");
5172
- const onUnmounted = createHook("um");
5173
- const onServerPrefetch = createHook("sp");
5174
- const onRenderTriggered = createHook(
5175
- "rtg"
5229
+ const onBeforeUnmount = createHook(
5230
+ "bum"
5176
5231
  );
5177
- const onRenderTracked = createHook(
5178
- "rtc"
5232
+ const onUnmounted = createHook("um");
5233
+ const onServerPrefetch = createHook(
5234
+ "sp"
5179
5235
  );
5236
+ const onRenderTriggered = createHook("rtg");
5237
+ const onRenderTracked = createHook("rtc");
5180
5238
  function onErrorCaptured(hook, target = currentInstance) {
5181
5239
  injectHook("ec", hook, target);
5182
5240
  }
@@ -5590,9 +5648,14 @@ function createSlots(slots, dynamicSlots) {
5590
5648
  }
5591
5649
 
5592
5650
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5593
- if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
5651
+ if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5594
5652
  if (name !== "default") props.name = name;
5595
- return createVNode("slot", props, fallback && fallback());
5653
+ return openBlock(), createBlock(
5654
+ Fragment,
5655
+ null,
5656
+ [createVNode("slot", props, fallback && fallback())],
5657
+ 64
5658
+ );
5596
5659
  }
5597
5660
  let slot = slots[name];
5598
5661
  if (slot && slot.length > 1) {
@@ -5894,6 +5957,7 @@ const publicPropertiesMap = (
5894
5957
  $refs: (i) => shallowReadonly(i.refs) ,
5895
5958
  $parent: (i) => getPublicInstance(i.parent),
5896
5959
  $root: (i) => getPublicInstance(i.root),
5960
+ $host: (i) => i.ce,
5897
5961
  $emit: (i) => i.emit,
5898
5962
  $options: (i) => resolveMergedOptions(i) ,
5899
5963
  $forceUpdate: (i) => i.f || (i.f = () => {
@@ -6054,29 +6118,25 @@ const PublicInstanceProxyHandlers = {
6054
6118
  return Reflect.ownKeys(target);
6055
6119
  };
6056
6120
  }
6057
- const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
6058
- {},
6059
- PublicInstanceProxyHandlers,
6060
- {
6061
- get(target, key) {
6062
- if (key === Symbol.unscopables) {
6063
- return;
6064
- }
6065
- return PublicInstanceProxyHandlers.get(target, key, target);
6066
- },
6067
- has(_, key) {
6068
- const has = key[0] !== "_" && !isGloballyAllowed(key);
6069
- if (!has && PublicInstanceProxyHandlers.has(_, key)) {
6070
- warn$1(
6071
- `Property ${JSON.stringify(
6072
- key
6073
- )} should not start with _ which is a reserved prefix for Vue internals.`
6074
- );
6075
- }
6076
- return has;
6121
+ const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, {
6122
+ get(target, key) {
6123
+ if (key === Symbol.unscopables) {
6124
+ return;
6125
+ }
6126
+ return PublicInstanceProxyHandlers.get(target, key, target);
6127
+ },
6128
+ has(_, key) {
6129
+ const has = key[0] !== "_" && !isGloballyAllowed(key);
6130
+ if (!has && PublicInstanceProxyHandlers.has(_, key)) {
6131
+ warn$1(
6132
+ `Property ${JSON.stringify(
6133
+ key
6134
+ )} should not start with _ which is a reserved prefix for Vue internals.`
6135
+ );
6077
6136
  }
6137
+ return has;
6078
6138
  }
6079
- );
6139
+ });
6080
6140
  function createDevRenderContext(instance) {
6081
6141
  const target = {};
6082
6142
  Object.defineProperty(target, `_`, {
@@ -6763,7 +6823,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6763
6823
  return vm;
6764
6824
  }
6765
6825
  }
6766
- Vue.version = `2.6.14-compat:${"3.5.0-alpha.5"}`;
6826
+ Vue.version = `2.6.14-compat:${"3.5.0-beta.1"}`;
6767
6827
  Vue.config = singletonApp.config;
6768
6828
  Vue.use = (plugin, ...options) => {
6769
6829
  if (plugin && isFunction(plugin.install)) {
@@ -7036,7 +7096,7 @@ function installCompatMount(app, context, render) {
7036
7096
  /* skip options */
7037
7097
  );
7038
7098
  }
7039
- container.innerHTML = "";
7099
+ container.textContent = "";
7040
7100
  render(vnode, container, namespace);
7041
7101
  if (container instanceof Element) {
7042
7102
  container.removeAttribute("v-cloak");
@@ -7248,7 +7308,7 @@ function createAppAPI(render, hydrate) {
7248
7308
  If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
7249
7309
  );
7250
7310
  }
7251
- const vnode = createVNode(rootComponent, rootProps);
7311
+ const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
7252
7312
  vnode.appContext = context;
7253
7313
  if (namespace === true) {
7254
7314
  namespace = "svg";
@@ -7353,7 +7413,7 @@ function provide(key, value) {
7353
7413
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
7354
7414
  const instance = currentInstance || currentRenderingInstance;
7355
7415
  if (instance || currentApp) {
7356
- const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
7416
+ const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
7357
7417
  if (provides && key in provides) {
7358
7418
  return provides[key];
7359
7419
  } else if (arguments.length > 1) {
@@ -7627,6 +7687,9 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
7627
7687
  } else {
7628
7688
  value = defaultValue;
7629
7689
  }
7690
+ if (instance.ce) {
7691
+ instance.ce._setProp(key, value);
7692
+ }
7630
7693
  }
7631
7694
  if (opt[0 /* shouldCast */]) {
7632
7695
  if (isAbsent && !hasDefault) {
@@ -8629,8 +8692,8 @@ function baseCreateRenderer(options, createHydrationFns) {
8629
8692
  const componentUpdateFn = () => {
8630
8693
  if (!instance.isMounted) {
8631
8694
  let vnodeHook;
8632
- const { el, props, type } = initialVNode;
8633
- const { bm, m, parent } = instance;
8695
+ const { el, props } = initialVNode;
8696
+ const { bm, m, parent, root, type } = instance;
8634
8697
  const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
8635
8698
  toggleRecurse(instance, false);
8636
8699
  if (bm) {
@@ -8676,6 +8739,9 @@ function baseCreateRenderer(options, createHydrationFns) {
8676
8739
  hydrateSubTree();
8677
8740
  }
8678
8741
  } else {
8742
+ if (root.ce) {
8743
+ root.ce._injectChildStyle(type);
8744
+ }
8679
8745
  {
8680
8746
  startMeasure(instance, `render`);
8681
8747
  }
@@ -9379,13 +9445,13 @@ function baseCreateRenderer(options, createHydrationFns) {
9379
9445
  namespace
9380
9446
  );
9381
9447
  }
9448
+ container._vnode = vnode;
9382
9449
  if (!isFlushing) {
9383
9450
  isFlushing = true;
9384
9451
  flushPreFlushCbs();
9385
9452
  flushPostFlushCbs();
9386
9453
  isFlushing = false;
9387
9454
  }
9388
- container._vnode = vnode;
9389
9455
  };
9390
9456
  const internals = {
9391
9457
  p: patch,
@@ -9559,14 +9625,9 @@ function doWatch(source, cb, {
9559
9625
  const _cb = cb;
9560
9626
  cb = (...args) => {
9561
9627
  _cb(...args);
9562
- unwatch();
9628
+ watchHandle();
9563
9629
  };
9564
9630
  }
9565
- if (deep !== void 0 && typeof deep === "number") {
9566
- warn$1(
9567
- `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
9568
- );
9569
- }
9570
9631
  if (!cb) {
9571
9632
  if (immediate !== void 0) {
9572
9633
  warn$1(
@@ -9592,10 +9653,12 @@ function doWatch(source, cb, {
9592
9653
  );
9593
9654
  };
9594
9655
  const instance = currentInstance;
9595
- const reactiveGetter = (source2) => deep === true ? source2 : (
9596
- // for deep: false, only traverse root-level properties
9597
- traverse(source2, deep === false ? 1 : void 0)
9598
- );
9656
+ const reactiveGetter = (source2) => {
9657
+ if (deep) return source2;
9658
+ if (isShallow(source2) || deep === false || deep === 0)
9659
+ return traverse(source2, 1);
9660
+ return traverse(source2);
9661
+ };
9599
9662
  let getter;
9600
9663
  let forceTrigger = false;
9601
9664
  let isMultiSource = false;
@@ -9651,7 +9714,8 @@ function doWatch(source, cb, {
9651
9714
  }
9652
9715
  if (cb && deep) {
9653
9716
  const baseGetter = getter;
9654
- getter = () => traverse(baseGetter());
9717
+ const depth = deep === true ? Infinity : deep;
9718
+ getter = () => traverse(baseGetter(), depth);
9655
9719
  }
9656
9720
  let cleanup;
9657
9721
  let onCleanup = (fn) => {
@@ -9676,7 +9740,12 @@ function doWatch(source, cb, {
9676
9740
  const ctx = useSSRContext();
9677
9741
  ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
9678
9742
  } else {
9679
- return NOOP;
9743
+ const watchHandle2 = () => {
9744
+ };
9745
+ watchHandle2.stop = NOOP;
9746
+ watchHandle2.resume = NOOP;
9747
+ watchHandle2.pause = NOOP;
9748
+ return watchHandle2;
9680
9749
  }
9681
9750
  }
9682
9751
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -9717,12 +9786,15 @@ function doWatch(source, cb, {
9717
9786
  }
9718
9787
  effect.scheduler = scheduler;
9719
9788
  const scope = getCurrentScope();
9720
- const unwatch = () => {
9789
+ const watchHandle = () => {
9721
9790
  effect.stop();
9722
9791
  if (scope) {
9723
9792
  remove(scope.effects, effect);
9724
9793
  }
9725
9794
  };
9795
+ watchHandle.pause = effect.pause.bind(effect);
9796
+ watchHandle.resume = effect.resume.bind(effect);
9797
+ watchHandle.stop = watchHandle;
9726
9798
  {
9727
9799
  effect.onTrack = onTrack;
9728
9800
  effect.onTrigger = onTrigger;
@@ -9741,8 +9813,8 @@ function doWatch(source, cb, {
9741
9813
  } else {
9742
9814
  effect.run();
9743
9815
  }
9744
- if (ssrCleanup) ssrCleanup.push(unwatch);
9745
- return unwatch;
9816
+ if (ssrCleanup) ssrCleanup.push(watchHandle);
9817
+ return watchHandle;
9746
9818
  }
9747
9819
  function instanceWatch(source, value, options) {
9748
9820
  const publicThis = this.proxy;
@@ -9832,7 +9904,8 @@ function useModel(props, name, options = EMPTY_OBJ) {
9832
9904
  return options.get ? options.get(localValue) : localValue;
9833
9905
  },
9834
9906
  set(value) {
9835
- if (!hasChanged(value, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
9907
+ const emittedValue = options.set ? options.set(value) : value;
9908
+ if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
9836
9909
  return;
9837
9910
  }
9838
9911
  const rawProps = i.vnode.props;
@@ -9841,7 +9914,6 @@ function useModel(props, name, options = EMPTY_OBJ) {
9841
9914
  localValue = value;
9842
9915
  trigger();
9843
9916
  }
9844
- const emittedValue = options.set ? options.set(value) : value;
9845
9917
  i.emit(`update:${name}`, emittedValue);
9846
9918
  if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
9847
9919
  trigger();
@@ -9879,9 +9951,9 @@ function emit(instance, event, ...rawArgs) {
9879
9951
  } = instance;
9880
9952
  if (emitsOptions) {
9881
9953
  if (!(event in emitsOptions) && !(event.startsWith("hook:") || event.startsWith(compatModelEventPrefix))) {
9882
- if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
9954
+ if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
9883
9955
  warn$1(
9884
- `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
9956
+ `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
9885
9957
  );
9886
9958
  }
9887
9959
  } else {
@@ -11812,11 +11884,16 @@ function useTemplateRef(key) {
11812
11884
  const r = shallowRef(null);
11813
11885
  if (i) {
11814
11886
  const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
11815
- Object.defineProperty(refs, key, {
11816
- enumerable: true,
11817
- get: () => r.value,
11818
- set: (val) => r.value = val
11819
- });
11887
+ let desc;
11888
+ if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
11889
+ warn$1(`useTemplateRef('${key}') already exists.`);
11890
+ } else {
11891
+ Object.defineProperty(refs, key, {
11892
+ enumerable: true,
11893
+ get: () => r.value,
11894
+ set: (val) => r.value = val
11895
+ });
11896
+ }
11820
11897
  } else {
11821
11898
  warn$1(
11822
11899
  `useTemplateRef() is called when there is no active component instance to be associated with.`
@@ -12050,7 +12127,7 @@ function isMemoSame(cached, memo) {
12050
12127
  return true;
12051
12128
  }
12052
12129
 
12053
- const version = "3.5.0-alpha.5";
12130
+ const version = "3.5.0-beta.1";
12054
12131
  const warn = warn$1 ;
12055
12132
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12056
12133
  const devtools = devtools$1 ;
@@ -12062,7 +12139,8 @@ const _ssrUtils = {
12062
12139
  setCurrentRenderingInstance,
12063
12140
  isVNode: isVNode,
12064
12141
  normalizeVNode,
12065
- getComponentPublicInstance
12142
+ getComponentPublicInstance,
12143
+ ensureValidVNode
12066
12144
  };
12067
12145
  const ssrUtils = _ssrUtils ;
12068
12146
  const resolveFilter = resolveFilter$1 ;
@@ -12076,6 +12154,18 @@ const _compatUtils = {
12076
12154
  const compatUtils = _compatUtils ;
12077
12155
  const DeprecationTypes = DeprecationTypes$1 ;
12078
12156
 
12157
+ let policy = void 0;
12158
+ const tt = typeof window !== "undefined" && window.trustedTypes;
12159
+ if (tt) {
12160
+ try {
12161
+ policy = /* @__PURE__ */ tt.createPolicy("vue", {
12162
+ createHTML: (val) => val
12163
+ });
12164
+ } catch (e) {
12165
+ warn(`Error creating trusted types policy: ${e}`);
12166
+ }
12167
+ }
12168
+ const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
12079
12169
  const svgNS = "http://www.w3.org/2000/svg";
12080
12170
  const mathmlNS = "http://www.w3.org/1998/Math/MathML";
12081
12171
  const doc = typeof document !== "undefined" ? document : null;
@@ -12123,7 +12213,9 @@ const nodeOps = {
12123
12213
  if (start === end || !(start = start.nextSibling)) break;
12124
12214
  }
12125
12215
  } else {
12126
- templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
12216
+ templateContainer.innerHTML = unsafeToTrustedHTML(
12217
+ namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
12218
+ );
12127
12219
  const template = templateContainer.content;
12128
12220
  if (namespace === "svg" || namespace === "mathml") {
12129
12221
  const wrapper = template.firstChild;
@@ -12530,11 +12622,17 @@ function useCssVars(getter) {
12530
12622
  }
12531
12623
  const setVars = () => {
12532
12624
  const vars = getter(instance.proxy);
12533
- setVarsOnVNode(instance.subTree, vars);
12625
+ if (instance.ce) {
12626
+ setVarsOnNode(instance.ce, vars);
12627
+ } else {
12628
+ setVarsOnVNode(instance.subTree, vars);
12629
+ }
12534
12630
  updateTeleports(vars);
12535
12631
  };
12536
- onMounted(() => {
12632
+ onBeforeMount(() => {
12537
12633
  watchPostEffect(setVars);
12634
+ });
12635
+ onMounted(() => {
12538
12636
  const ob = new MutationObserver(setVars);
12539
12637
  ob.observe(instance.subTree.el.parentNode, { childList: true });
12540
12638
  onUnmounted(() => ob.disconnect());
@@ -12931,16 +13029,24 @@ function shouldSetAsProp(el, key, value, isSVG) {
12931
13029
  if (isNativeOn(key) && isString(value)) {
12932
13030
  return false;
12933
13031
  }
12934
- return key in el;
13032
+ if (key in el) {
13033
+ return true;
13034
+ }
13035
+ if (el._isVueCE && (/[A-Z]/.test(key) || !isString(value))) {
13036
+ return true;
13037
+ }
13038
+ return false;
12935
13039
  }
12936
13040
 
13041
+ const REMOVAL = {};
12937
13042
  /*! #__NO_SIDE_EFFECTS__ */
12938
13043
  // @__NO_SIDE_EFFECTS__
12939
- function defineCustomElement(options, extraOptions, hydrate2) {
13044
+ function defineCustomElement(options, extraOptions, _createApp) {
12940
13045
  const Comp = defineComponent(options, extraOptions);
13046
+ if (isPlainObject(Comp)) extend(Comp, extraOptions);
12941
13047
  class VueCustomElement extends VueElement {
12942
13048
  constructor(initialProps) {
12943
- super(Comp, initialProps, hydrate2);
13049
+ super(Comp, initialProps, _createApp);
12944
13050
  }
12945
13051
  }
12946
13052
  VueCustomElement.def = Comp;
@@ -12948,47 +13054,88 @@ function defineCustomElement(options, extraOptions, hydrate2) {
12948
13054
  }
12949
13055
  /*! #__NO_SIDE_EFFECTS__ */
12950
13056
  const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
12951
- return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
13057
+ return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
12952
13058
  };
12953
13059
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
12954
13060
  };
12955
13061
  class VueElement extends BaseClass {
12956
- constructor(_def, _props = {}, hydrate2) {
13062
+ constructor(_def, _props = {}, _createApp = createApp) {
12957
13063
  super();
12958
13064
  this._def = _def;
12959
13065
  this._props = _props;
13066
+ this._createApp = _createApp;
13067
+ this._isVueCE = true;
12960
13068
  /**
12961
13069
  * @internal
12962
13070
  */
12963
13071
  this._instance = null;
13072
+ /**
13073
+ * @internal
13074
+ */
13075
+ this._app = null;
13076
+ /**
13077
+ * @internal
13078
+ */
13079
+ this._nonce = this._def.nonce;
12964
13080
  this._connected = false;
12965
13081
  this._resolved = false;
12966
13082
  this._numberProps = null;
13083
+ this._styleChildren = /* @__PURE__ */ new WeakSet();
12967
13084
  this._ob = null;
12968
- if (this.shadowRoot && hydrate2) {
12969
- hydrate2(this._createVNode(), this.shadowRoot);
13085
+ if (this.shadowRoot && _createApp !== createApp) {
13086
+ this._root = this.shadowRoot;
13087
+ this._mount(_def);
12970
13088
  } else {
12971
13089
  if (this.shadowRoot) {
12972
13090
  warn(
12973
13091
  `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
12974
13092
  );
12975
13093
  }
12976
- this.attachShadow({ mode: "open" });
13094
+ if (_def.shadowRoot !== false) {
13095
+ this.attachShadow({ mode: "open" });
13096
+ this._root = this.shadowRoot;
13097
+ } else {
13098
+ this._root = this;
13099
+ }
12977
13100
  if (!this._def.__asyncLoader) {
12978
13101
  this._resolveProps(this._def);
12979
13102
  }
12980
13103
  }
12981
13104
  }
12982
13105
  connectedCallback() {
13106
+ if (!this.shadowRoot) {
13107
+ this._parseSlots();
13108
+ }
12983
13109
  this._connected = true;
13110
+ let parent = this;
13111
+ while (parent = parent && (parent.parentNode || parent.host)) {
13112
+ if (parent instanceof VueElement) {
13113
+ this._parent = parent;
13114
+ break;
13115
+ }
13116
+ }
12984
13117
  if (!this._instance) {
12985
13118
  if (this._resolved) {
13119
+ this._setParent();
12986
13120
  this._update();
12987
13121
  } else {
12988
- this._resolveDef();
13122
+ if (parent && parent._pendingResolve) {
13123
+ this._pendingResolve = parent._pendingResolve.then(() => {
13124
+ this._pendingResolve = void 0;
13125
+ this._resolveDef();
13126
+ });
13127
+ } else {
13128
+ this._resolveDef();
13129
+ }
12989
13130
  }
12990
13131
  }
12991
13132
  }
13133
+ _setParent(parent = this._parent) {
13134
+ if (parent) {
13135
+ this._instance.parent = parent._instance;
13136
+ this._instance.provides = parent._instance.provides;
13137
+ }
13138
+ }
12992
13139
  disconnectedCallback() {
12993
13140
  this._connected = false;
12994
13141
  nextTick(() => {
@@ -12997,8 +13144,9 @@ class VueElement extends BaseClass {
12997
13144
  this._ob.disconnect();
12998
13145
  this._ob = null;
12999
13146
  }
13000
- render(null, this.shadowRoot);
13001
- this._instance = null;
13147
+ this._app && this._app.unmount();
13148
+ this._instance.ce = void 0;
13149
+ this._app = this._instance = null;
13002
13150
  }
13003
13151
  });
13004
13152
  }
@@ -13006,7 +13154,9 @@ class VueElement extends BaseClass {
13006
13154
  * resolve inner component definition (handle possible async component)
13007
13155
  */
13008
13156
  _resolveDef() {
13009
- this._resolved = true;
13157
+ if (this._pendingResolve) {
13158
+ return;
13159
+ }
13010
13160
  for (let i = 0; i < this.attributes.length; i++) {
13011
13161
  this._setAttr(this.attributes[i].name);
13012
13162
  }
@@ -13017,6 +13167,8 @@ class VueElement extends BaseClass {
13017
13167
  });
13018
13168
  this._ob.observe(this, { attributes: true });
13019
13169
  const resolve = (def, isAsync = false) => {
13170
+ this._resolved = true;
13171
+ this._pendingResolve = void 0;
13020
13172
  const { props, styles } = def;
13021
13173
  let numberProps;
13022
13174
  if (props && !isArray(props)) {
@@ -13034,22 +13186,53 @@ class VueElement extends BaseClass {
13034
13186
  if (isAsync) {
13035
13187
  this._resolveProps(def);
13036
13188
  }
13037
- this._applyStyles(styles);
13038
- this._update();
13189
+ if (this.shadowRoot) {
13190
+ this._applyStyles(styles);
13191
+ } else if (styles) {
13192
+ warn(
13193
+ "Custom element style injection is not supported when using shadowRoot: false"
13194
+ );
13195
+ }
13196
+ this._mount(def);
13039
13197
  };
13040
13198
  const asyncDef = this._def.__asyncLoader;
13041
13199
  if (asyncDef) {
13042
- asyncDef().then((def) => resolve(def, true));
13200
+ this._pendingResolve = asyncDef().then(
13201
+ (def) => resolve(this._def = def, true)
13202
+ );
13043
13203
  } else {
13044
13204
  resolve(this._def);
13045
13205
  }
13046
13206
  }
13207
+ _mount(def) {
13208
+ if (!def.name) {
13209
+ def.name = "VueElement";
13210
+ }
13211
+ this._app = this._createApp(def);
13212
+ if (def.configureApp) {
13213
+ def.configureApp(this._app);
13214
+ }
13215
+ this._app._ceVNode = this._createVNode();
13216
+ this._app.mount(this._root);
13217
+ const exposed = this._instance && this._instance.exposed;
13218
+ if (!exposed) return;
13219
+ for (const key in exposed) {
13220
+ if (!hasOwn(this, key)) {
13221
+ Object.defineProperty(this, key, {
13222
+ // unwrap ref to be consistent with public instance behavior
13223
+ get: () => unref(exposed[key])
13224
+ });
13225
+ } else {
13226
+ warn(`Exposed property "${key}" already exists on custom element.`);
13227
+ }
13228
+ }
13229
+ }
13047
13230
  _resolveProps(def) {
13048
13231
  const { props } = def;
13049
13232
  const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
13050
13233
  for (const key of Object.keys(this)) {
13051
13234
  if (key[0] !== "_" && declaredPropKeys.includes(key)) {
13052
- this._setProp(key, this[key], true, false);
13235
+ this._setProp(key, this[key]);
13053
13236
  }
13054
13237
  }
13055
13238
  for (const key of declaredPropKeys.map(camelize)) {
@@ -13058,18 +13241,20 @@ class VueElement extends BaseClass {
13058
13241
  return this._getProp(key);
13059
13242
  },
13060
13243
  set(val) {
13061
- this._setProp(key, val);
13244
+ this._setProp(key, val, true, true);
13062
13245
  }
13063
13246
  });
13064
13247
  }
13065
13248
  }
13066
13249
  _setAttr(key) {
13067
- let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
13250
+ if (key.startsWith("data-v-")) return;
13251
+ const has = this.hasAttribute(key);
13252
+ let value = has ? this.getAttribute(key) : REMOVAL;
13068
13253
  const camelKey = camelize(key);
13069
- if (this._numberProps && this._numberProps[camelKey]) {
13254
+ if (has && this._numberProps && this._numberProps[camelKey]) {
13070
13255
  value = toNumber(value);
13071
13256
  }
13072
- this._setProp(camelKey, value, false);
13257
+ this._setProp(camelKey, value, false, true);
13073
13258
  }
13074
13259
  /**
13075
13260
  * @internal
@@ -13080,9 +13265,13 @@ class VueElement extends BaseClass {
13080
13265
  /**
13081
13266
  * @internal
13082
13267
  */
13083
- _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
13268
+ _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
13084
13269
  if (val !== this._props[key]) {
13085
- this._props[key] = val;
13270
+ if (val === REMOVAL) {
13271
+ delete this._props[key];
13272
+ } else {
13273
+ this._props[key] = val;
13274
+ }
13086
13275
  if (shouldUpdate && this._instance) {
13087
13276
  this._update();
13088
13277
  }
@@ -13098,18 +13287,22 @@ class VueElement extends BaseClass {
13098
13287
  }
13099
13288
  }
13100
13289
  _update() {
13101
- render(this._createVNode(), this.shadowRoot);
13290
+ render(this._createVNode(), this._root);
13102
13291
  }
13103
13292
  _createVNode() {
13104
- const vnode = createVNode(this._def, extend({}, this._props));
13293
+ const baseProps = {};
13294
+ if (!this.shadowRoot) {
13295
+ baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
13296
+ }
13297
+ const vnode = createVNode(this._def, extend(baseProps, this._props));
13105
13298
  if (!this._instance) {
13106
13299
  vnode.ce = (instance) => {
13107
13300
  this._instance = instance;
13108
- instance.isCE = true;
13301
+ instance.ce = this;
13109
13302
  {
13110
13303
  instance.ceReload = (newStyles) => {
13111
13304
  if (this._styles) {
13112
- this._styles.forEach((s) => this.shadowRoot.removeChild(s));
13305
+ this._styles.forEach((s) => this._root.removeChild(s));
13113
13306
  this._styles.length = 0;
13114
13307
  }
13115
13308
  this._applyStyles(newStyles);
@@ -13119,9 +13312,10 @@ class VueElement extends BaseClass {
13119
13312
  }
13120
13313
  const dispatch = (event, args) => {
13121
13314
  this.dispatchEvent(
13122
- new CustomEvent(event, {
13123
- detail: args
13124
- })
13315
+ new CustomEvent(
13316
+ event,
13317
+ isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
13318
+ )
13125
13319
  );
13126
13320
  };
13127
13321
  instance.emit = (event, ...args) => {
@@ -13130,30 +13324,126 @@ class VueElement extends BaseClass {
13130
13324
  dispatch(hyphenate(event), args);
13131
13325
  }
13132
13326
  };
13133
- let parent = this;
13134
- while (parent = parent && (parent.parentNode || parent.host)) {
13135
- if (parent instanceof VueElement) {
13136
- instance.parent = parent._instance;
13137
- instance.provides = parent._instance.provides;
13138
- break;
13139
- }
13140
- }
13327
+ this._setParent();
13141
13328
  };
13142
13329
  }
13143
13330
  return vnode;
13144
13331
  }
13145
- _applyStyles(styles) {
13146
- if (styles) {
13147
- styles.forEach((css) => {
13148
- const s = document.createElement("style");
13149
- s.textContent = css;
13150
- this.shadowRoot.appendChild(s);
13151
- {
13332
+ _applyStyles(styles, owner) {
13333
+ if (!styles) return;
13334
+ if (owner) {
13335
+ if (owner === this._def || this._styleChildren.has(owner)) {
13336
+ return;
13337
+ }
13338
+ this._styleChildren.add(owner);
13339
+ }
13340
+ const nonce = this._nonce;
13341
+ for (let i = styles.length - 1; i >= 0; i--) {
13342
+ const s = document.createElement("style");
13343
+ if (nonce) s.setAttribute("nonce", nonce);
13344
+ s.textContent = styles[i];
13345
+ this.shadowRoot.prepend(s);
13346
+ {
13347
+ if (owner) {
13348
+ if (owner.__hmrId) {
13349
+ if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
13350
+ let entry = this._childStyles.get(owner.__hmrId);
13351
+ if (!entry) {
13352
+ this._childStyles.set(owner.__hmrId, entry = []);
13353
+ }
13354
+ entry.push(s);
13355
+ }
13356
+ } else {
13152
13357
  (this._styles || (this._styles = [])).push(s);
13153
13358
  }
13154
- });
13359
+ }
13360
+ }
13361
+ }
13362
+ /**
13363
+ * Only called when shaddowRoot is false
13364
+ */
13365
+ _parseSlots() {
13366
+ const slots = this._slots = {};
13367
+ let n;
13368
+ while (n = this.firstChild) {
13369
+ const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
13370
+ (slots[slotName] || (slots[slotName] = [])).push(n);
13371
+ this.removeChild(n);
13372
+ }
13373
+ }
13374
+ /**
13375
+ * Only called when shaddowRoot is false
13376
+ */
13377
+ _renderSlots() {
13378
+ const outlets = this.querySelectorAll("slot");
13379
+ const scopeId = this._instance.type.__scopeId;
13380
+ for (let i = 0; i < outlets.length; i++) {
13381
+ const o = outlets[i];
13382
+ const slotName = o.getAttribute("name") || "default";
13383
+ const content = this._slots[slotName];
13384
+ const parent = o.parentNode;
13385
+ if (content) {
13386
+ for (const n of content) {
13387
+ if (scopeId && n.nodeType === 1) {
13388
+ const id = scopeId + "-s";
13389
+ const walker = document.createTreeWalker(n, 1);
13390
+ n.setAttribute(id, "");
13391
+ let child;
13392
+ while (child = walker.nextNode()) {
13393
+ child.setAttribute(id, "");
13394
+ }
13395
+ }
13396
+ parent.insertBefore(n, o);
13397
+ }
13398
+ } else {
13399
+ while (o.firstChild) parent.insertBefore(o.firstChild, o);
13400
+ }
13401
+ parent.removeChild(o);
13402
+ }
13403
+ }
13404
+ /**
13405
+ * @internal
13406
+ */
13407
+ _injectChildStyle(comp) {
13408
+ this._applyStyles(comp.styles, comp);
13409
+ }
13410
+ /**
13411
+ * @internal
13412
+ */
13413
+ _removeChildStyle(comp) {
13414
+ {
13415
+ this._styleChildren.delete(comp);
13416
+ if (this._childStyles && comp.__hmrId) {
13417
+ const oldStyles = this._childStyles.get(comp.__hmrId);
13418
+ if (oldStyles) {
13419
+ oldStyles.forEach((s) => this._root.removeChild(s));
13420
+ oldStyles.length = 0;
13421
+ }
13422
+ }
13423
+ }
13424
+ }
13425
+ }
13426
+ function useHost(caller) {
13427
+ const instance = getCurrentInstance();
13428
+ const el = instance && instance.ce;
13429
+ if (el) {
13430
+ return el;
13431
+ } else {
13432
+ if (!instance) {
13433
+ warn(
13434
+ `${caller || "useHost"} called without an active component instance.`
13435
+ );
13436
+ } else {
13437
+ warn(
13438
+ `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
13439
+ );
13155
13440
  }
13156
13441
  }
13442
+ return null;
13443
+ }
13444
+ function useShadowRoot() {
13445
+ const el = useHost("useShadowRoot") ;
13446
+ return el && el.shadowRoot;
13157
13447
  }
13158
13448
 
13159
13449
  function useCssModule(name = "$style") {
@@ -13712,7 +14002,7 @@ const createApp = (...args) => {
13712
14002
  const component = app._component;
13713
14003
  if (!isFunction(component) && !component.render && !component.template) {
13714
14004
  component.template = container.innerHTML;
13715
- {
14005
+ if (container.nodeType === 1) {
13716
14006
  for (let i = 0; i < container.attributes.length; i++) {
13717
14007
  const attr = container.attributes[i];
13718
14008
  if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
@@ -13725,7 +14015,9 @@ const createApp = (...args) => {
13725
14015
  }
13726
14016
  }
13727
14017
  }
13728
- container.innerHTML = "";
14018
+ if (container.nodeType === 1) {
14019
+ container.textContent = "";
14020
+ }
13729
14021
  const proxy = mount(container, false, resolveRootNamespace(container));
13730
14022
  if (container instanceof Element) {
13731
14023
  container.removeAttribute("v-cloak");
@@ -13959,9 +14251,11 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
13959
14251
  useAttrs: useAttrs,
13960
14252
  useCssModule: useCssModule,
13961
14253
  useCssVars: useCssVars,
14254
+ useHost: useHost,
13962
14255
  useId: useId,
13963
14256
  useModel: useModel,
13964
14257
  useSSRContext: useSSRContext,
14258
+ useShadowRoot: useShadowRoot,
13965
14259
  useSlots: useSlots,
13966
14260
  useTemplateRef: useTemplateRef,
13967
14261
  useTransitionState: useTransitionState,
@@ -14023,36 +14317,70 @@ const FRAGMENT = Symbol(`Fragment` );
14023
14317
  const TELEPORT = Symbol(`Teleport` );
14024
14318
  const SUSPENSE = Symbol(`Suspense` );
14025
14319
  const KEEP_ALIVE = Symbol(`KeepAlive` );
14026
- const BASE_TRANSITION = Symbol(`BaseTransition` );
14320
+ const BASE_TRANSITION = Symbol(
14321
+ `BaseTransition`
14322
+ );
14027
14323
  const OPEN_BLOCK = Symbol(`openBlock` );
14028
14324
  const CREATE_BLOCK = Symbol(`createBlock` );
14029
- const CREATE_ELEMENT_BLOCK = Symbol(`createElementBlock` );
14325
+ const CREATE_ELEMENT_BLOCK = Symbol(
14326
+ `createElementBlock`
14327
+ );
14030
14328
  const CREATE_VNODE = Symbol(`createVNode` );
14031
- const CREATE_ELEMENT_VNODE = Symbol(`createElementVNode` );
14032
- const CREATE_COMMENT = Symbol(`createCommentVNode` );
14033
- const CREATE_TEXT = Symbol(`createTextVNode` );
14034
- const CREATE_STATIC = Symbol(`createStaticVNode` );
14035
- const RESOLVE_COMPONENT = Symbol(`resolveComponent` );
14329
+ const CREATE_ELEMENT_VNODE = Symbol(
14330
+ `createElementVNode`
14331
+ );
14332
+ const CREATE_COMMENT = Symbol(
14333
+ `createCommentVNode`
14334
+ );
14335
+ const CREATE_TEXT = Symbol(
14336
+ `createTextVNode`
14337
+ );
14338
+ const CREATE_STATIC = Symbol(
14339
+ `createStaticVNode`
14340
+ );
14341
+ const RESOLVE_COMPONENT = Symbol(
14342
+ `resolveComponent`
14343
+ );
14036
14344
  const RESOLVE_DYNAMIC_COMPONENT = Symbol(
14037
14345
  `resolveDynamicComponent`
14038
14346
  );
14039
- const RESOLVE_DIRECTIVE = Symbol(`resolveDirective` );
14040
- const RESOLVE_FILTER = Symbol(`resolveFilter` );
14041
- const WITH_DIRECTIVES = Symbol(`withDirectives` );
14347
+ const RESOLVE_DIRECTIVE = Symbol(
14348
+ `resolveDirective`
14349
+ );
14350
+ const RESOLVE_FILTER = Symbol(
14351
+ `resolveFilter`
14352
+ );
14353
+ const WITH_DIRECTIVES = Symbol(
14354
+ `withDirectives`
14355
+ );
14042
14356
  const RENDER_LIST = Symbol(`renderList` );
14043
14357
  const RENDER_SLOT = Symbol(`renderSlot` );
14044
14358
  const CREATE_SLOTS = Symbol(`createSlots` );
14045
- const TO_DISPLAY_STRING = Symbol(`toDisplayString` );
14359
+ const TO_DISPLAY_STRING = Symbol(
14360
+ `toDisplayString`
14361
+ );
14046
14362
  const MERGE_PROPS = Symbol(`mergeProps` );
14047
- const NORMALIZE_CLASS = Symbol(`normalizeClass` );
14048
- const NORMALIZE_STYLE = Symbol(`normalizeStyle` );
14049
- const NORMALIZE_PROPS = Symbol(`normalizeProps` );
14050
- const GUARD_REACTIVE_PROPS = Symbol(`guardReactiveProps` );
14363
+ const NORMALIZE_CLASS = Symbol(
14364
+ `normalizeClass`
14365
+ );
14366
+ const NORMALIZE_STYLE = Symbol(
14367
+ `normalizeStyle`
14368
+ );
14369
+ const NORMALIZE_PROPS = Symbol(
14370
+ `normalizeProps`
14371
+ );
14372
+ const GUARD_REACTIVE_PROPS = Symbol(
14373
+ `guardReactiveProps`
14374
+ );
14051
14375
  const TO_HANDLERS = Symbol(`toHandlers` );
14052
14376
  const CAMELIZE = Symbol(`camelize` );
14053
14377
  const CAPITALIZE = Symbol(`capitalize` );
14054
- const TO_HANDLER_KEY = Symbol(`toHandlerKey` );
14055
- const SET_BLOCK_TRACKING = Symbol(`setBlockTracking` );
14378
+ const TO_HANDLER_KEY = Symbol(
14379
+ `toHandlerKey`
14380
+ );
14381
+ const SET_BLOCK_TRACKING = Symbol(
14382
+ `setBlockTracking`
14383
+ );
14056
14384
  const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
14057
14385
  const POP_SCOPE_ID = Symbol(`popScopeId` );
14058
14386
  const WITH_CTX = Symbol(`withCtx` );
@@ -18274,7 +18602,7 @@ function resolveComponentType(node, context, ssr = false) {
18274
18602
  } else {
18275
18603
  exp = isProp.exp;
18276
18604
  if (!exp) {
18277
- exp = createSimpleExpression(`is`, false, isProp.loc);
18605
+ exp = createSimpleExpression(`is`, false, isProp.arg.loc);
18278
18606
  }
18279
18607
  }
18280
18608
  if (exp) {
@@ -19247,15 +19575,27 @@ function baseCompile(source, options = {}) {
19247
19575
  const noopDirectiveTransform = () => ({ props: [] });
19248
19576
 
19249
19577
  const V_MODEL_RADIO = Symbol(`vModelRadio` );
19250
- const V_MODEL_CHECKBOX = Symbol(`vModelCheckbox` );
19578
+ const V_MODEL_CHECKBOX = Symbol(
19579
+ `vModelCheckbox`
19580
+ );
19251
19581
  const V_MODEL_TEXT = Symbol(`vModelText` );
19252
- const V_MODEL_SELECT = Symbol(`vModelSelect` );
19253
- const V_MODEL_DYNAMIC = Symbol(`vModelDynamic` );
19254
- const V_ON_WITH_MODIFIERS = Symbol(`vOnModifiersGuard` );
19255
- const V_ON_WITH_KEYS = Symbol(`vOnKeysGuard` );
19582
+ const V_MODEL_SELECT = Symbol(
19583
+ `vModelSelect`
19584
+ );
19585
+ const V_MODEL_DYNAMIC = Symbol(
19586
+ `vModelDynamic`
19587
+ );
19588
+ const V_ON_WITH_MODIFIERS = Symbol(
19589
+ `vOnModifiersGuard`
19590
+ );
19591
+ const V_ON_WITH_KEYS = Symbol(
19592
+ `vOnKeysGuard`
19593
+ );
19256
19594
  const V_SHOW = Symbol(`vShow` );
19257
19595
  const TRANSITION = Symbol(`Transition` );
19258
- const TRANSITION_GROUP = Symbol(`TransitionGroup` );
19596
+ const TRANSITION_GROUP = Symbol(
19597
+ `TransitionGroup`
19598
+ );
19259
19599
  registerRuntimeHelpers({
19260
19600
  [V_MODEL_RADIO]: `vModelRadio`,
19261
19601
  [V_MODEL_CHECKBOX]: `vModelCheckbox`,
@@ -19939,6 +20279,6 @@ registerRuntimeCompiler(compileToFunction);
19939
20279
  const Vue = createCompatVue();
19940
20280
  Vue.compile = compileToFunction;
19941
20281
 
19942
- const { configureCompat } = Vue;
20282
+ const configureCompat = Vue.configureCompat;
19943
20283
 
19944
- 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 };
20284
+ 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 };