@vue/compat 3.5.0-alpha.5 → 3.5.0-beta.2

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.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -68,9 +68,11 @@ const cacheStringFunction = (fn) => {
68
68
  };
69
69
  };
70
70
  const camelizeRE = /-(\w)/g;
71
- const camelize = cacheStringFunction((str) => {
72
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
73
- });
71
+ const camelize = cacheStringFunction(
72
+ (str) => {
73
+ return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
74
+ }
75
+ );
74
76
  const hyphenateRE = /\B([A-Z])/g;
75
77
  const hyphenate = cacheStringFunction(
76
78
  (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
@@ -78,10 +80,12 @@ const hyphenate = cacheStringFunction(
78
80
  const capitalize = cacheStringFunction((str) => {
79
81
  return str.charAt(0).toUpperCase() + str.slice(1);
80
82
  });
81
- const toHandlerKey = cacheStringFunction((str) => {
82
- const s = str ? `on${capitalize(str)}` : ``;
83
- return s;
84
- });
83
+ const toHandlerKey = cacheStringFunction(
84
+ (str) => {
85
+ const s = str ? `on${capitalize(str)}` : ``;
86
+ return s;
87
+ }
88
+ );
85
89
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
86
90
  const invokeArrayFns = (fns, ...arg) => {
87
91
  for (let i = 0; i < fns.length; i++) {
@@ -361,6 +365,7 @@ class EffectScope {
361
365
  * @internal
362
366
  */
363
367
  this.cleanups = [];
368
+ this._isPaused = false;
364
369
  this.parent = activeEffectScope;
365
370
  if (!detached && activeEffectScope) {
366
371
  this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
@@ -371,6 +376,37 @@ class EffectScope {
371
376
  get active() {
372
377
  return this._active;
373
378
  }
379
+ pause() {
380
+ if (this._active) {
381
+ this._isPaused = true;
382
+ if (this.scopes) {
383
+ for (let i = 0, l = this.scopes.length; i < l; i++) {
384
+ this.scopes[i].pause();
385
+ }
386
+ }
387
+ for (let i = 0, l = this.effects.length; i < l; i++) {
388
+ this.effects[i].pause();
389
+ }
390
+ }
391
+ }
392
+ /**
393
+ * Resumes the effect scope, including all child scopes and effects.
394
+ */
395
+ resume() {
396
+ if (this._active) {
397
+ if (this._isPaused) {
398
+ this._isPaused = false;
399
+ if (this.scopes) {
400
+ for (let i = 0, l = this.scopes.length; i < l; i++) {
401
+ this.scopes[i].resume();
402
+ }
403
+ }
404
+ for (let i = 0, l = this.effects.length; i < l; i++) {
405
+ this.effects[i].resume();
406
+ }
407
+ }
408
+ }
409
+ }
374
410
  run(fn) {
375
411
  if (this._active) {
376
412
  const currentEffectScope = activeEffectScope;
@@ -435,6 +471,7 @@ function onScopeDispose(fn, failSilently = false) {
435
471
  }
436
472
 
437
473
  let activeSub;
474
+ const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
438
475
  class ReactiveEffect {
439
476
  constructor(fn) {
440
477
  this.fn = fn;
@@ -463,6 +500,18 @@ class ReactiveEffect {
463
500
  activeEffectScope.effects.push(this);
464
501
  }
465
502
  }
503
+ pause() {
504
+ this.flags |= 64;
505
+ }
506
+ resume() {
507
+ if (this.flags & 64) {
508
+ this.flags &= ~64;
509
+ if (pausedQueueEffects.has(this)) {
510
+ pausedQueueEffects.delete(this);
511
+ this.trigger();
512
+ }
513
+ }
514
+ }
466
515
  /**
467
516
  * @internal
468
517
  */
@@ -470,9 +519,6 @@ class ReactiveEffect {
470
519
  if (this.flags & 2 && !(this.flags & 32)) {
471
520
  return;
472
521
  }
473
- if (this.flags & 64) {
474
- return this.trigger();
475
- }
476
522
  if (!(this.flags & 8)) {
477
523
  this.flags |= 8;
478
524
  this.nextEffect = batchedEffect;
@@ -511,7 +557,9 @@ class ReactiveEffect {
511
557
  }
512
558
  }
513
559
  trigger() {
514
- if (this.scheduler) {
560
+ if (this.flags & 64) {
561
+ pausedQueueEffects.add(this);
562
+ } else if (this.scheduler) {
515
563
  this.scheduler();
516
564
  } else {
517
565
  this.runIfDirty();
@@ -539,6 +587,7 @@ function endBatch() {
539
587
  batchDepth--;
540
588
  return;
541
589
  }
590
+ batchDepth--;
542
591
  let error;
543
592
  while (batchedEffect) {
544
593
  let e = batchedEffect;
@@ -557,7 +606,6 @@ function endBatch() {
557
606
  e = next;
558
607
  }
559
608
  }
560
- batchDepth--;
561
609
  if (error) throw error;
562
610
  }
563
611
  function prepareDeps(sub) {
@@ -802,9 +850,15 @@ function addSub(link) {
802
850
  link.dep.subs = link;
803
851
  }
804
852
  const targetMap = /* @__PURE__ */ new WeakMap();
805
- const ITERATE_KEY = Symbol("");
806
- const MAP_KEY_ITERATE_KEY = Symbol("");
807
- const ARRAY_ITERATE_KEY = Symbol("");
853
+ const ITERATE_KEY = Symbol(
854
+ ""
855
+ );
856
+ const MAP_KEY_ITERATE_KEY = Symbol(
857
+ ""
858
+ );
859
+ const ARRAY_ITERATE_KEY = Symbol(
860
+ ""
861
+ );
808
862
  function track(target, type, key) {
809
863
  if (shouldTrack && activeSub) {
810
864
  let depsMap = targetMap.get(target);
@@ -914,26 +968,26 @@ const arrayInstrumentations = {
914
968
  });
915
969
  },
916
970
  every(fn, thisArg) {
917
- return apply(this, "every", fn, thisArg);
971
+ return apply(this, "every", fn, thisArg, void 0, arguments);
918
972
  },
919
973
  filter(fn, thisArg) {
920
- return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive));
974
+ return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
921
975
  },
922
976
  find(fn, thisArg) {
923
- return apply(this, "find", fn, thisArg, toReactive);
977
+ return apply(this, "find", fn, thisArg, toReactive, arguments);
924
978
  },
925
979
  findIndex(fn, thisArg) {
926
- return apply(this, "findIndex", fn, thisArg);
980
+ return apply(this, "findIndex", fn, thisArg, void 0, arguments);
927
981
  },
928
982
  findLast(fn, thisArg) {
929
- return apply(this, "findLast", fn, thisArg, toReactive);
983
+ return apply(this, "findLast", fn, thisArg, toReactive, arguments);
930
984
  },
931
985
  findLastIndex(fn, thisArg) {
932
- return apply(this, "findLastIndex", fn, thisArg);
986
+ return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
933
987
  },
934
988
  // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
935
989
  forEach(fn, thisArg) {
936
- return apply(this, "forEach", fn, thisArg);
990
+ return apply(this, "forEach", fn, thisArg, void 0, arguments);
937
991
  },
938
992
  includes(...args) {
939
993
  return searchProxy(this, "includes", args);
@@ -949,7 +1003,7 @@ const arrayInstrumentations = {
949
1003
  return searchProxy(this, "lastIndexOf", args);
950
1004
  },
951
1005
  map(fn, thisArg) {
952
- return apply(this, "map", fn, thisArg);
1006
+ return apply(this, "map", fn, thisArg, void 0, arguments);
953
1007
  },
954
1008
  pop() {
955
1009
  return noTracking(this, "pop");
@@ -968,7 +1022,7 @@ const arrayInstrumentations = {
968
1022
  },
969
1023
  // slice could use ARRAY_ITERATE but also seems to beg for range tracking
970
1024
  some(fn, thisArg) {
971
- return apply(this, "some", fn, thisArg);
1025
+ return apply(this, "some", fn, thisArg, void 0, arguments);
972
1026
  },
973
1027
  splice(...args) {
974
1028
  return noTracking(this, "splice", args);
@@ -1004,8 +1058,13 @@ function iterator(self, method, wrapValue) {
1004
1058
  }
1005
1059
  return iter;
1006
1060
  }
1007
- function apply(self, method, fn, thisArg, wrappedRetFn) {
1061
+ const arrayProto = Array.prototype;
1062
+ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1008
1063
  const arr = shallowReadArray(self);
1064
+ let methodFn;
1065
+ if ((methodFn = arr[method]) !== arrayProto[method]) {
1066
+ return methodFn.apply(arr, args);
1067
+ }
1009
1068
  let needsWrap = false;
1010
1069
  let wrappedFn = fn;
1011
1070
  if (arr !== self) {
@@ -1020,7 +1079,7 @@ function apply(self, method, fn, thisArg, wrappedRetFn) {
1020
1079
  };
1021
1080
  }
1022
1081
  }
1023
- const result = arr[method](wrappedFn, thisArg);
1082
+ const result = methodFn.call(arr, wrappedFn, thisArg);
1024
1083
  return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
1025
1084
  }
1026
1085
  function reduce(self, method, fn, args) {
@@ -1083,7 +1142,7 @@ class BaseReactiveHandler {
1083
1142
  return isShallow2;
1084
1143
  } else if (key === "__v_raw") {
1085
1144
  if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
1086
- // this means the reciever is a user proxy of the reactive proxy
1145
+ // this means the receiver is a user proxy of the reactive proxy
1087
1146
  Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
1088
1147
  return target;
1089
1148
  }
@@ -1195,9 +1254,7 @@ class ReadonlyReactiveHandler extends BaseReactiveHandler {
1195
1254
  }
1196
1255
  const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
1197
1256
  const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
1198
- const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
1199
- true
1200
- );
1257
+ const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
1201
1258
  const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
1202
1259
 
1203
1260
  const toShallow = (value) => value;
@@ -1649,13 +1706,14 @@ function proxyRefs(objectWithRefs) {
1649
1706
  class CustomRefImpl {
1650
1707
  constructor(factory) {
1651
1708
  this["__v_isRef"] = true;
1709
+ this._value = void 0;
1652
1710
  const dep = this.dep = new Dep();
1653
1711
  const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
1654
1712
  this._get = get;
1655
1713
  this._set = set;
1656
1714
  }
1657
1715
  get value() {
1658
- return this._get();
1716
+ return this._value = this._get();
1659
1717
  }
1660
1718
  set value(newVal) {
1661
1719
  this._set(newVal);
@@ -1677,10 +1735,11 @@ class ObjectRefImpl {
1677
1735
  this._key = _key;
1678
1736
  this._defaultValue = _defaultValue;
1679
1737
  this["__v_isRef"] = true;
1738
+ this._value = void 0;
1680
1739
  }
1681
1740
  get value() {
1682
1741
  const val = this._object[this._key];
1683
- return val === void 0 ? this._defaultValue : val;
1742
+ return this._value = val === void 0 ? this._defaultValue : val;
1684
1743
  }
1685
1744
  set value(newVal) {
1686
1745
  this._object[this._key] = newVal;
@@ -1694,9 +1753,10 @@ class GetterRefImpl {
1694
1753
  this._getter = _getter;
1695
1754
  this["__v_isRef"] = true;
1696
1755
  this["__v_isReadonly"] = true;
1756
+ this._value = void 0;
1697
1757
  }
1698
1758
  get value() {
1699
- return this._getter();
1759
+ return this._value = this._getter();
1700
1760
  }
1701
1761
  }
1702
1762
  function toRef(source, key, defaultValue) {
@@ -1730,7 +1790,8 @@ class ComputedRefImpl {
1730
1790
  /**
1731
1791
  * @internal
1732
1792
  */
1733
- this["__v_isRef"] = true;
1793
+ this.__v_isRef = true;
1794
+ // TODO isolatedDeclarations "__v_isReadonly"
1734
1795
  // A computed is also a subscriber that tracks other deps
1735
1796
  /**
1736
1797
  * @internal
@@ -3170,6 +3231,7 @@ const logMismatchError = () => {
3170
3231
  const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
3171
3232
  const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
3172
3233
  const getContainerType = (container) => {
3234
+ if (container.nodeType !== 1) return void 0;
3173
3235
  if (isSVGContainer(container)) return "svg";
3174
3236
  if (isMathMLContainer(container)) return "mathml";
3175
3237
  return void 0;
@@ -3410,9 +3472,10 @@ function createHydrationFunctions(rendererInternals) {
3410
3472
  }
3411
3473
  if (props) {
3412
3474
  if (forcePatch || !optimized || patchFlag & (16 | 32)) {
3475
+ const isCustomElement = el.tagName.includes("-");
3413
3476
  for (const key in props) {
3414
3477
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
3415
- key[0] === ".") {
3478
+ key[0] === "." || isCustomElement) {
3416
3479
  patchProp(el, key, null, props[key], void 0, parentComponent);
3417
3480
  }
3418
3481
  }
@@ -3612,24 +3675,19 @@ function isMismatchAllowed(el, allowedType) {
3612
3675
  }
3613
3676
  }
3614
3677
 
3615
- const hydrateOnIdle = () => (hydrate) => {
3616
- const id = requestIdleCallback(hydrate);
3678
+ const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
3679
+ const id = requestIdleCallback(hydrate, { timeout });
3617
3680
  return () => cancelIdleCallback(id);
3618
3681
  };
3619
- const hydrateOnVisible = (margin = 0) => (hydrate, forEach) => {
3620
- const ob = new IntersectionObserver(
3621
- (entries) => {
3622
- for (const e of entries) {
3623
- if (!e.isIntersecting) continue;
3624
- ob.disconnect();
3625
- hydrate();
3626
- break;
3627
- }
3628
- },
3629
- {
3630
- rootMargin: isString(margin) ? margin : margin + "px"
3682
+ const hydrateOnVisible = (opts) => (hydrate, forEach) => {
3683
+ const ob = new IntersectionObserver((entries) => {
3684
+ for (const e of entries) {
3685
+ if (!e.isIntersecting) continue;
3686
+ ob.disconnect();
3687
+ hydrate();
3688
+ break;
3631
3689
  }
3632
- );
3690
+ }, opts);
3633
3691
  forEach((el) => ob.observe(el));
3634
3692
  return () => ob.disconnect();
3635
3693
  };
@@ -3920,14 +3978,14 @@ const KeepAliveImpl = {
3920
3978
  function pruneCache(filter) {
3921
3979
  cache.forEach((vnode, key) => {
3922
3980
  const name = getComponentName(vnode.type);
3923
- if (name && (!filter || !filter(name))) {
3981
+ if (name && !filter(name)) {
3924
3982
  pruneCacheEntry(key);
3925
3983
  }
3926
3984
  });
3927
3985
  }
3928
3986
  function pruneCacheEntry(key) {
3929
3987
  const cached = cache.get(key);
3930
- if (!current || !isSameVNodeType(cached, current)) {
3988
+ if (cached && (!current || !isSameVNodeType(cached, current))) {
3931
3989
  unmount(cached);
3932
3990
  } else if (current) {
3933
3991
  resetShapeFlag(current);
@@ -3986,6 +4044,10 @@ const KeepAliveImpl = {
3986
4044
  return rawVNode;
3987
4045
  }
3988
4046
  let vnode = getInnerChild(rawVNode);
4047
+ if (vnode.type === Comment) {
4048
+ current = null;
4049
+ return vnode;
4050
+ }
3989
4051
  const comp = vnode.type;
3990
4052
  const name = getComponentName(
3991
4053
  isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
@@ -4035,6 +4097,7 @@ function matches(pattern, name) {
4035
4097
  } else if (isString(pattern)) {
4036
4098
  return pattern.split(",").includes(name);
4037
4099
  } else if (isRegExp(pattern)) {
4100
+ pattern.lastIndex = 0;
4038
4101
  return pattern.test(name);
4039
4102
  }
4040
4103
  return false;
@@ -4113,17 +4176,19 @@ const createHook = (lifecycle) => (hook, target = currentInstance) => {
4113
4176
  };
4114
4177
  const onBeforeMount = createHook("bm");
4115
4178
  const onMounted = createHook("m");
4116
- const onBeforeUpdate = createHook("bu");
4179
+ const onBeforeUpdate = createHook(
4180
+ "bu"
4181
+ );
4117
4182
  const onUpdated = createHook("u");
4118
- const onBeforeUnmount = createHook("bum");
4119
- const onUnmounted = createHook("um");
4120
- const onServerPrefetch = createHook("sp");
4121
- const onRenderTriggered = createHook(
4122
- "rtg"
4183
+ const onBeforeUnmount = createHook(
4184
+ "bum"
4123
4185
  );
4124
- const onRenderTracked = createHook(
4125
- "rtc"
4186
+ const onUnmounted = createHook("um");
4187
+ const onServerPrefetch = createHook(
4188
+ "sp"
4126
4189
  );
4190
+ const onRenderTriggered = createHook("rtg");
4191
+ const onRenderTracked = createHook("rtc");
4127
4192
  function onErrorCaptured(hook, target = currentInstance) {
4128
4193
  injectHook("ec", hook, target);
4129
4194
  }
@@ -4525,9 +4590,14 @@ function createSlots(slots, dynamicSlots) {
4525
4590
  }
4526
4591
 
4527
4592
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
4528
- if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
4593
+ if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
4529
4594
  if (name !== "default") props.name = name;
4530
- return createVNode("slot", props, fallback && fallback());
4595
+ return openBlock(), createBlock(
4596
+ Fragment,
4597
+ null,
4598
+ [createVNode("slot", props, fallback && fallback())],
4599
+ 64
4600
+ );
4531
4601
  }
4532
4602
  let slot = slots[name];
4533
4603
  if (slot && slot._c) {
@@ -4813,6 +4883,7 @@ const publicPropertiesMap = (
4813
4883
  $refs: (i) => i.refs,
4814
4884
  $parent: (i) => getPublicInstance(i.parent),
4815
4885
  $root: (i) => getPublicInstance(i.root),
4886
+ $host: (i) => i.ce,
4816
4887
  $emit: (i) => i.emit,
4817
4888
  $options: (i) => resolveMergedOptions(i) ,
4818
4889
  $forceUpdate: (i) => i.f || (i.f = () => {
@@ -4931,22 +5002,18 @@ const PublicInstanceProxyHandlers = {
4931
5002
  return Reflect.defineProperty(target, key, descriptor);
4932
5003
  }
4933
5004
  };
4934
- const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend$1(
4935
- {},
4936
- PublicInstanceProxyHandlers,
4937
- {
4938
- get(target, key) {
4939
- if (key === Symbol.unscopables) {
4940
- return;
4941
- }
4942
- return PublicInstanceProxyHandlers.get(target, key, target);
4943
- },
4944
- has(_, key) {
4945
- const has = key[0] !== "_" && !isGloballyAllowed(key);
4946
- return has;
5005
+ const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend$1({}, PublicInstanceProxyHandlers, {
5006
+ get(target, key) {
5007
+ if (key === Symbol.unscopables) {
5008
+ return;
4947
5009
  }
5010
+ return PublicInstanceProxyHandlers.get(target, key, target);
5011
+ },
5012
+ has(_, key) {
5013
+ const has = key[0] !== "_" && !isGloballyAllowed(key);
5014
+ return has;
4948
5015
  }
4949
- );
5016
+ });
4950
5017
 
4951
5018
  function deepMergeData(to, from) {
4952
5019
  for (const key in from) {
@@ -5439,7 +5506,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5439
5506
  return vm;
5440
5507
  }
5441
5508
  }
5442
- Vue.version = `2.6.14-compat:${"3.5.0-alpha.5"}`;
5509
+ Vue.version = `2.6.14-compat:${"3.5.0-beta.2"}`;
5443
5510
  Vue.config = singletonApp.config;
5444
5511
  Vue.use = (plugin, ...options) => {
5445
5512
  if (plugin && isFunction(plugin.install)) {
@@ -5680,7 +5747,7 @@ function installCompatMount(app, context, render) {
5680
5747
  /* skip options */
5681
5748
  );
5682
5749
  }
5683
- container.innerHTML = "";
5750
+ container.textContent = "";
5684
5751
  render(vnode, container, namespace);
5685
5752
  if (container instanceof Element) {
5686
5753
  container.removeAttribute("v-cloak");
@@ -5852,7 +5919,7 @@ function createAppAPI(render, hydrate) {
5852
5919
  },
5853
5920
  mount(rootContainer, isHydrate, namespace) {
5854
5921
  if (!isMounted) {
5855
- const vnode = createVNode(rootComponent, rootProps);
5922
+ const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
5856
5923
  vnode.appContext = context;
5857
5924
  if (namespace === true) {
5858
5925
  namespace = "svg";
@@ -5919,7 +5986,7 @@ function provide(key, value) {
5919
5986
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
5920
5987
  const instance = currentInstance || currentRenderingInstance;
5921
5988
  if (instance || currentApp) {
5922
- const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
5989
+ const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
5923
5990
  if (provides && key in provides) {
5924
5991
  return provides[key];
5925
5992
  } else if (arguments.length > 1) {
@@ -6176,6 +6243,9 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
6176
6243
  } else {
6177
6244
  value = defaultValue;
6178
6245
  }
6246
+ if (instance.ce) {
6247
+ instance.ce._setProp(key, value);
6248
+ }
6179
6249
  }
6180
6250
  if (opt[0 /* shouldCast */]) {
6181
6251
  if (isAbsent && !hasDefault) {
@@ -6939,8 +7009,8 @@ function baseCreateRenderer(options, createHydrationFns) {
6939
7009
  const componentUpdateFn = () => {
6940
7010
  if (!instance.isMounted) {
6941
7011
  let vnodeHook;
6942
- const { el, props, type } = initialVNode;
6943
- const { bm, m, parent } = instance;
7012
+ const { el, props } = initialVNode;
7013
+ const { bm, m, parent, root, type } = instance;
6944
7014
  const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
6945
7015
  toggleRecurse(instance, false);
6946
7016
  if (bm) {
@@ -6974,6 +7044,9 @@ function baseCreateRenderer(options, createHydrationFns) {
6974
7044
  hydrateSubTree();
6975
7045
  }
6976
7046
  } else {
7047
+ if (root.ce) {
7048
+ root.ce._injectChildStyle(type);
7049
+ }
6977
7050
  const subTree = instance.subTree = renderComponentRoot(instance);
6978
7051
  patch(
6979
7052
  null,
@@ -7616,13 +7689,13 @@ function baseCreateRenderer(options, createHydrationFns) {
7616
7689
  namespace
7617
7690
  );
7618
7691
  }
7692
+ container._vnode = vnode;
7619
7693
  if (!isFlushing) {
7620
7694
  isFlushing = true;
7621
7695
  flushPreFlushCbs();
7622
7696
  flushPostFlushCbs();
7623
7697
  isFlushing = false;
7624
7698
  }
7625
- container._vnode = vnode;
7626
7699
  };
7627
7700
  const internals = {
7628
7701
  p: patch,
@@ -7783,14 +7856,16 @@ function doWatch(source, cb, {
7783
7856
  const _cb = cb;
7784
7857
  cb = (...args) => {
7785
7858
  _cb(...args);
7786
- unwatch();
7859
+ watchHandle();
7787
7860
  };
7788
7861
  }
7789
7862
  const instance = currentInstance;
7790
- const reactiveGetter = (source2) => deep === true ? source2 : (
7791
- // for deep: false, only traverse root-level properties
7792
- traverse(source2, deep === false ? 1 : void 0)
7793
- );
7863
+ const reactiveGetter = (source2) => {
7864
+ if (deep) return source2;
7865
+ if (isShallow(source2) || deep === false || deep === 0)
7866
+ return traverse(source2, 1);
7867
+ return traverse(source2);
7868
+ };
7794
7869
  let getter;
7795
7870
  let forceTrigger = false;
7796
7871
  let isMultiSource = false;
@@ -7843,7 +7918,8 @@ function doWatch(source, cb, {
7843
7918
  }
7844
7919
  if (cb && deep) {
7845
7920
  const baseGetter = getter;
7846
- getter = () => traverse(baseGetter());
7921
+ const depth = deep === true ? Infinity : deep;
7922
+ getter = () => traverse(baseGetter(), depth);
7847
7923
  }
7848
7924
  let cleanup;
7849
7925
  let onCleanup = (fn) => {
@@ -7868,7 +7944,12 @@ function doWatch(source, cb, {
7868
7944
  const ctx = useSSRContext();
7869
7945
  ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
7870
7946
  } else {
7871
- return NOOP;
7947
+ const watchHandle2 = () => {
7948
+ };
7949
+ watchHandle2.stop = NOOP;
7950
+ watchHandle2.resume = NOOP;
7951
+ watchHandle2.pause = NOOP;
7952
+ return watchHandle2;
7872
7953
  }
7873
7954
  }
7874
7955
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -7898,7 +7979,6 @@ function doWatch(source, cb, {
7898
7979
  const effect = new ReactiveEffect(getter);
7899
7980
  let scheduler;
7900
7981
  if (flush === "sync") {
7901
- effect.flags |= 64;
7902
7982
  scheduler = job;
7903
7983
  } else if (flush === "post") {
7904
7984
  scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
@@ -7909,12 +7989,15 @@ function doWatch(source, cb, {
7909
7989
  }
7910
7990
  effect.scheduler = scheduler;
7911
7991
  const scope = getCurrentScope();
7912
- const unwatch = () => {
7992
+ const watchHandle = () => {
7913
7993
  effect.stop();
7914
7994
  if (scope) {
7915
7995
  remove(scope.effects, effect);
7916
7996
  }
7917
7997
  };
7998
+ watchHandle.pause = effect.pause.bind(effect);
7999
+ watchHandle.resume = effect.resume.bind(effect);
8000
+ watchHandle.stop = watchHandle;
7918
8001
  if (cb) {
7919
8002
  if (immediate) {
7920
8003
  job(true);
@@ -7929,8 +8012,8 @@ function doWatch(source, cb, {
7929
8012
  } else {
7930
8013
  effect.run();
7931
8014
  }
7932
- if (ssrCleanup) ssrCleanup.push(unwatch);
7933
- return unwatch;
8015
+ if (ssrCleanup) ssrCleanup.push(watchHandle);
8016
+ return watchHandle;
7934
8017
  }
7935
8018
  function instanceWatch(source, value, options) {
7936
8019
  const publicThis = this.proxy;
@@ -8012,7 +8095,8 @@ function useModel(props, name, options = EMPTY_OBJ) {
8012
8095
  return options.get ? options.get(localValue) : localValue;
8013
8096
  },
8014
8097
  set(value) {
8015
- if (!hasChanged(value, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
8098
+ const emittedValue = options.set ? options.set(value) : value;
8099
+ if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
8016
8100
  return;
8017
8101
  }
8018
8102
  const rawProps = i.vnode.props;
@@ -8021,7 +8105,6 @@ function useModel(props, name, options = EMPTY_OBJ) {
8021
8105
  localValue = value;
8022
8106
  trigger();
8023
8107
  }
8024
- const emittedValue = options.set ? options.set(value) : value;
8025
8108
  i.emit(`update:${name}`, emittedValue);
8026
8109
  if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
8027
8110
  trigger();
@@ -9649,11 +9732,13 @@ function useTemplateRef(key) {
9649
9732
  const r = shallowRef(null);
9650
9733
  if (i) {
9651
9734
  const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
9652
- Object.defineProperty(refs, key, {
9653
- enumerable: true,
9654
- get: () => r.value,
9655
- set: (val) => r.value = val
9656
- });
9735
+ {
9736
+ Object.defineProperty(refs, key, {
9737
+ enumerable: true,
9738
+ get: () => r.value,
9739
+ set: (val) => r.value = val
9740
+ });
9741
+ }
9657
9742
  }
9658
9743
  return r;
9659
9744
  }
@@ -9711,7 +9796,7 @@ function isMemoSame(cached, memo) {
9711
9796
  return true;
9712
9797
  }
9713
9798
 
9714
- const version = "3.5.0-alpha.5";
9799
+ const version = "3.5.0-beta.2";
9715
9800
  const warn$1 = NOOP;
9716
9801
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9717
9802
  const devtools = void 0;
@@ -9723,7 +9808,8 @@ const _ssrUtils = {
9723
9808
  setCurrentRenderingInstance,
9724
9809
  isVNode: isVNode,
9725
9810
  normalizeVNode,
9726
- getComponentPublicInstance
9811
+ getComponentPublicInstance,
9812
+ ensureValidVNode
9727
9813
  };
9728
9814
  const ssrUtils = _ssrUtils ;
9729
9815
  const resolveFilter = resolveFilter$1 ;
@@ -9737,6 +9823,17 @@ const _compatUtils = {
9737
9823
  const compatUtils = _compatUtils ;
9738
9824
  const DeprecationTypes = DeprecationTypes$1 ;
9739
9825
 
9826
+ let policy = void 0;
9827
+ const tt = typeof window !== "undefined" && window.trustedTypes;
9828
+ if (tt) {
9829
+ try {
9830
+ policy = /* @__PURE__ */ tt.createPolicy("vue", {
9831
+ createHTML: (val) => val
9832
+ });
9833
+ } catch (e) {
9834
+ }
9835
+ }
9836
+ const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
9740
9837
  const svgNS = "http://www.w3.org/2000/svg";
9741
9838
  const mathmlNS = "http://www.w3.org/1998/Math/MathML";
9742
9839
  const doc = typeof document !== "undefined" ? document : null;
@@ -9784,7 +9881,9 @@ const nodeOps = {
9784
9881
  if (start === end || !(start = start.nextSibling)) break;
9785
9882
  }
9786
9883
  } else {
9787
- templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
9884
+ templateContainer.innerHTML = unsafeToTrustedHTML(
9885
+ namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
9886
+ );
9788
9887
  const template = templateContainer.content;
9789
9888
  if (namespace === "svg" || namespace === "mathml") {
9790
9889
  const wrapper = template.firstChild;
@@ -10497,16 +10596,24 @@ function shouldSetAsProp(el, key, value, isSVG) {
10497
10596
  if (isNativeOn(key) && isString(value)) {
10498
10597
  return false;
10499
10598
  }
10500
- return key in el;
10599
+ if (key in el) {
10600
+ return true;
10601
+ }
10602
+ if (el._isVueCE && (/[A-Z]/.test(key) || !isString(value))) {
10603
+ return true;
10604
+ }
10605
+ return false;
10501
10606
  }
10502
10607
 
10608
+ const REMOVAL = {};
10503
10609
  /*! #__NO_SIDE_EFFECTS__ */
10504
10610
  // @__NO_SIDE_EFFECTS__
10505
- function defineCustomElement(options, extraOptions, hydrate2) {
10611
+ function defineCustomElement(options, extraOptions, _createApp) {
10506
10612
  const Comp = defineComponent(options, extraOptions);
10613
+ if (isPlainObject(Comp)) extend$1(Comp, extraOptions);
10507
10614
  class VueCustomElement extends VueElement {
10508
10615
  constructor(initialProps) {
10509
- super(Comp, initialProps, hydrate2);
10616
+ super(Comp, initialProps, _createApp);
10510
10617
  }
10511
10618
  }
10512
10619
  VueCustomElement.def = Comp;
@@ -10514,42 +10621,82 @@ function defineCustomElement(options, extraOptions, hydrate2) {
10514
10621
  }
10515
10622
  /*! #__NO_SIDE_EFFECTS__ */
10516
10623
  const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
10517
- return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
10624
+ return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
10518
10625
  };
10519
10626
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
10520
10627
  };
10521
10628
  class VueElement extends BaseClass {
10522
- constructor(_def, _props = {}, hydrate2) {
10629
+ constructor(_def, _props = {}, _createApp = createApp) {
10523
10630
  super();
10524
10631
  this._def = _def;
10525
10632
  this._props = _props;
10633
+ this._createApp = _createApp;
10634
+ this._isVueCE = true;
10526
10635
  /**
10527
10636
  * @internal
10528
10637
  */
10529
10638
  this._instance = null;
10639
+ /**
10640
+ * @internal
10641
+ */
10642
+ this._app = null;
10643
+ /**
10644
+ * @internal
10645
+ */
10646
+ this._nonce = this._def.nonce;
10530
10647
  this._connected = false;
10531
10648
  this._resolved = false;
10532
10649
  this._numberProps = null;
10650
+ this._styleChildren = /* @__PURE__ */ new WeakSet();
10533
10651
  this._ob = null;
10534
- if (this.shadowRoot && hydrate2) {
10535
- hydrate2(this._createVNode(), this.shadowRoot);
10652
+ if (this.shadowRoot && _createApp !== createApp) {
10653
+ this._root = this.shadowRoot;
10536
10654
  } else {
10537
- this.attachShadow({ mode: "open" });
10538
- if (!this._def.__asyncLoader) {
10539
- this._resolveProps(this._def);
10655
+ if (_def.shadowRoot !== false) {
10656
+ this.attachShadow({ mode: "open" });
10657
+ this._root = this.shadowRoot;
10658
+ } else {
10659
+ this._root = this;
10540
10660
  }
10541
10661
  }
10662
+ if (!this._def.__asyncLoader) {
10663
+ this._resolveProps(this._def);
10664
+ }
10542
10665
  }
10543
10666
  connectedCallback() {
10667
+ if (!this.shadowRoot) {
10668
+ this._parseSlots();
10669
+ }
10544
10670
  this._connected = true;
10671
+ let parent = this;
10672
+ while (parent = parent && (parent.parentNode || parent.host)) {
10673
+ if (parent instanceof VueElement) {
10674
+ this._parent = parent;
10675
+ break;
10676
+ }
10677
+ }
10545
10678
  if (!this._instance) {
10546
10679
  if (this._resolved) {
10680
+ this._setParent();
10547
10681
  this._update();
10548
10682
  } else {
10549
- this._resolveDef();
10683
+ if (parent && parent._pendingResolve) {
10684
+ this._pendingResolve = parent._pendingResolve.then(() => {
10685
+ this._pendingResolve = void 0;
10686
+ this._resolveDef();
10687
+ });
10688
+ } else {
10689
+ this._resolveDef();
10690
+ }
10550
10691
  }
10551
10692
  }
10552
10693
  }
10694
+ _setParent(parent = this._parent) {
10695
+ if (parent) {
10696
+ this._instance.parent = parent._instance;
10697
+ this._instance.provides = parent._instance.provides;
10698
+ }
10699
+ }
10553
10700
  disconnectedCallback() {
10554
10701
  this._connected = false;
10555
10702
  nextTick(() => {
@@ -10558,8 +10705,9 @@ class VueElement extends BaseClass {
10558
10705
  this._ob.disconnect();
10559
10706
  this._ob = null;
10560
10707
  }
10561
- render(null, this.shadowRoot);
10562
- this._instance = null;
10708
+ this._app && this._app.unmount();
10709
+ this._instance.ce = void 0;
10710
+ this._app = this._instance = null;
10563
10711
  }
10564
10712
  });
10565
10713
  }
@@ -10567,7 +10715,9 @@ class VueElement extends BaseClass {
10567
10715
  * resolve inner component definition (handle possible async component)
10568
10716
  */
10569
10717
  _resolveDef() {
10570
- this._resolved = true;
10718
+ if (this._pendingResolve) {
10719
+ return;
10720
+ }
10571
10721
  for (let i = 0; i < this.attributes.length; i++) {
10572
10722
  this._setAttr(this.attributes[i].name);
10573
10723
  }
@@ -10578,6 +10728,8 @@ class VueElement extends BaseClass {
10578
10728
  });
10579
10729
  this._ob.observe(this, { attributes: true });
10580
10730
  const resolve = (def, isAsync = false) => {
10731
+ this._resolved = true;
10732
+ this._pendingResolve = void 0;
10581
10733
  const { props, styles } = def;
10582
10734
  let numberProps;
10583
10735
  if (props && !isArray(props)) {
@@ -10595,22 +10747,44 @@ class VueElement extends BaseClass {
10595
10747
  if (isAsync) {
10596
10748
  this._resolveProps(def);
10597
10749
  }
10598
- this._applyStyles(styles);
10599
- this._update();
10750
+ if (this.shadowRoot) {
10751
+ this._applyStyles(styles);
10752
+ }
10753
+ this._mount(def);
10600
10754
  };
10601
10755
  const asyncDef = this._def.__asyncLoader;
10602
10756
  if (asyncDef) {
10603
- asyncDef().then((def) => resolve(def, true));
10757
+ this._pendingResolve = asyncDef().then(
10758
+ (def) => resolve(this._def = def, true)
10759
+ );
10604
10760
  } else {
10605
10761
  resolve(this._def);
10606
10762
  }
10607
10763
  }
10764
+ _mount(def) {
10765
+ this._app = this._createApp(def);
10766
+ if (def.configureApp) {
10767
+ def.configureApp(this._app);
10768
+ }
10769
+ this._app._ceVNode = this._createVNode();
10770
+ this._app.mount(this._root);
10771
+ const exposed = this._instance && this._instance.exposed;
10772
+ if (!exposed) return;
10773
+ for (const key in exposed) {
10774
+ if (!hasOwn(this, key)) {
10775
+ Object.defineProperty(this, key, {
10776
+ // unwrap ref to be consistent with public instance behavior
10777
+ get: () => unref(exposed[key])
10778
+ });
10779
+ }
10780
+ }
10781
+ }
10608
10782
  _resolveProps(def) {
10609
10783
  const { props } = def;
10610
10784
  const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
10611
10785
  for (const key of Object.keys(this)) {
10612
10786
  if (key[0] !== "_" && declaredPropKeys.includes(key)) {
10613
- this._setProp(key, this[key], true, false);
10787
+ this._setProp(key, this[key]);
10614
10788
  }
10615
10789
  }
10616
10790
  for (const key of declaredPropKeys.map(camelize)) {
@@ -10619,18 +10793,20 @@ class VueElement extends BaseClass {
10619
10793
  return this._getProp(key);
10620
10794
  },
10621
10795
  set(val) {
10622
- this._setProp(key, val);
10796
+ this._setProp(key, val, true, true);
10623
10797
  }
10624
10798
  });
10625
10799
  }
10626
10800
  }
10627
10801
  _setAttr(key) {
10628
- let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
10802
+ if (key.startsWith("data-v-")) return;
10803
+ const has = this.hasAttribute(key);
10804
+ let value = has ? this.getAttribute(key) : REMOVAL;
10629
10805
  const camelKey = camelize(key);
10630
- if (this._numberProps && this._numberProps[camelKey]) {
10806
+ if (has && this._numberProps && this._numberProps[camelKey]) {
10631
10807
  value = toNumber(value);
10632
10808
  }
10633
- this._setProp(camelKey, value, false);
10809
+ this._setProp(camelKey, value, false, true);
10634
10810
  }
10635
10811
  /**
10636
10812
  * @internal
@@ -10641,9 +10817,13 @@ class VueElement extends BaseClass {
10641
10817
  /**
10642
10818
  * @internal
10643
10819
  */
10644
- _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
10820
+ _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
10645
10821
  if (val !== this._props[key]) {
10646
- this._props[key] = val;
10822
+ if (val === REMOVAL) {
10823
+ delete this._props[key];
10824
+ } else {
10825
+ this._props[key] = val;
10826
+ }
10647
10827
  if (shouldUpdate && this._instance) {
10648
10828
  this._update();
10649
10829
  }
@@ -10659,19 +10839,25 @@ class VueElement extends BaseClass {
10659
10839
  }
10660
10840
  }
10661
10841
  _update() {
10662
- render(this._createVNode(), this.shadowRoot);
10842
+ render(this._createVNode(), this._root);
10663
10843
  }
10664
10844
  _createVNode() {
10665
- const vnode = createVNode(this._def, extend$1({}, this._props));
10845
+ const baseProps = {};
10846
+ if (!this.shadowRoot) {
10847
+ baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
10848
+ }
10849
+ const vnode = createVNode(this._def, extend$1(baseProps, this._props));
10666
10850
  if (!this._instance) {
10667
10851
  vnode.ce = (instance) => {
10668
10852
  this._instance = instance;
10853
+ instance.ce = this;
10669
10854
  instance.isCE = true;
10670
10855
  const dispatch = (event, args) => {
10671
10856
  this.dispatchEvent(
10672
- new CustomEvent(event, {
10673
- detail: args
10674
- })
10857
+ new CustomEvent(
10858
+ event,
10859
+ isPlainObject(args[0]) ? extend$1({ detail: args }, args[0]) : { detail: args }
10860
+ )
10675
10861
  );
10676
10862
  };
10677
10863
  instance.emit = (event, ...args) => {
@@ -10680,27 +10866,92 @@ class VueElement extends BaseClass {
10680
10866
  dispatch(hyphenate(event), args);
10681
10867
  }
10682
10868
  };
10683
- let parent = this;
10684
- while (parent = parent && (parent.parentNode || parent.host)) {
10685
- if (parent instanceof VueElement) {
10686
- instance.parent = parent._instance;
10687
- instance.provides = parent._instance.provides;
10688
- break;
10689
- }
10690
- }
10869
+ this._setParent();
10691
10870
  };
10692
10871
  }
10693
10872
  return vnode;
10694
10873
  }
10695
- _applyStyles(styles) {
10696
- if (styles) {
10697
- styles.forEach((css) => {
10698
- const s = document.createElement("style");
10699
- s.textContent = css;
10700
- this.shadowRoot.appendChild(s);
10701
- });
10874
+ _applyStyles(styles, owner) {
10875
+ if (!styles) return;
10876
+ if (owner) {
10877
+ if (owner === this._def || this._styleChildren.has(owner)) {
10878
+ return;
10879
+ }
10880
+ this._styleChildren.add(owner);
10881
+ }
10882
+ const nonce = this._nonce;
10883
+ for (let i = styles.length - 1; i >= 0; i--) {
10884
+ const s = document.createElement("style");
10885
+ if (nonce) s.setAttribute("nonce", nonce);
10886
+ s.textContent = styles[i];
10887
+ this.shadowRoot.prepend(s);
10888
+ }
10889
+ }
10890
+ /**
10891
+ * Only called when shaddowRoot is false
10892
+ */
10893
+ _parseSlots() {
10894
+ const slots = this._slots = {};
10895
+ let n;
10896
+ while (n = this.firstChild) {
10897
+ const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
10898
+ (slots[slotName] || (slots[slotName] = [])).push(n);
10899
+ this.removeChild(n);
10900
+ }
10901
+ }
10902
+ /**
10903
+ * Only called when shaddowRoot is false
10904
+ */
10905
+ _renderSlots() {
10906
+ const outlets = this.querySelectorAll("slot");
10907
+ const scopeId = this._instance.type.__scopeId;
10908
+ for (let i = 0; i < outlets.length; i++) {
10909
+ const o = outlets[i];
10910
+ const slotName = o.getAttribute("name") || "default";
10911
+ const content = this._slots[slotName];
10912
+ const parent = o.parentNode;
10913
+ if (content) {
10914
+ for (const n of content) {
10915
+ if (scopeId && n.nodeType === 1) {
10916
+ const id = scopeId + "-s";
10917
+ const walker = document.createTreeWalker(n, 1);
10918
+ n.setAttribute(id, "");
10919
+ let child;
10920
+ while (child = walker.nextNode()) {
10921
+ child.setAttribute(id, "");
10922
+ }
10923
+ }
10924
+ parent.insertBefore(n, o);
10925
+ }
10926
+ } else {
10927
+ while (o.firstChild) parent.insertBefore(o.firstChild, o);
10928
+ }
10929
+ parent.removeChild(o);
10702
10930
  }
10703
10931
  }
10932
+ /**
10933
+ * @internal
10934
+ */
10935
+ _injectChildStyle(comp) {
10936
+ this._applyStyles(comp.styles, comp);
10937
+ }
10938
+ /**
10939
+ * @internal
10940
+ */
10941
+ _removeChildStyle(comp) {
10942
+ }
10943
+ }
10944
+ function useHost(caller) {
10945
+ const instance = getCurrentInstance();
10946
+ const el = instance && instance.ce;
10947
+ if (el) {
10948
+ return el;
10949
+ }
10950
+ return null;
10951
+ }
10952
+ function useShadowRoot() {
10953
+ const el = useHost();
10954
+ return el && el.shadowRoot;
10704
10955
  }
10705
10956
 
10706
10957
  function useCssModule(name = "$style") {
@@ -11242,7 +11493,9 @@ const createApp = (...args) => {
11242
11493
  if (!isFunction(component) && !component.render && !component.template) {
11243
11494
  component.template = container.innerHTML;
11244
11495
  }
11245
- container.innerHTML = "";
11496
+ if (container.nodeType === 1) {
11497
+ container.textContent = "";
11498
+ }
11246
11499
  const proxy = mount(container, false, resolveRootNamespace(container));
11247
11500
  if (container instanceof Element) {
11248
11501
  container.removeAttribute("v-cloak");
@@ -11427,9 +11680,11 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
11427
11680
  useAttrs: useAttrs,
11428
11681
  useCssModule: useCssModule,
11429
11682
  useCssVars: useCssVars,
11683
+ useHost: useHost,
11430
11684
  useId: useId,
11431
11685
  useModel: useModel,
11432
11686
  useSSRContext: useSSRContext,
11687
+ useShadowRoot: useShadowRoot,
11433
11688
  useSlots: useSlots,
11434
11689
  useTemplateRef: useTemplateRef,
11435
11690
  useTransitionState: useTransitionState,
@@ -11476,36 +11731,70 @@ const FRAGMENT = Symbol(``);
11476
11731
  const TELEPORT = Symbol(``);
11477
11732
  const SUSPENSE = Symbol(``);
11478
11733
  const KEEP_ALIVE = Symbol(``);
11479
- const BASE_TRANSITION = Symbol(``);
11734
+ const BASE_TRANSITION = Symbol(
11735
+ ``
11736
+ );
11480
11737
  const OPEN_BLOCK = Symbol(``);
11481
11738
  const CREATE_BLOCK = Symbol(``);
11482
- const CREATE_ELEMENT_BLOCK = Symbol(``);
11739
+ const CREATE_ELEMENT_BLOCK = Symbol(
11740
+ ``
11741
+ );
11483
11742
  const CREATE_VNODE = Symbol(``);
11484
- const CREATE_ELEMENT_VNODE = Symbol(``);
11485
- const CREATE_COMMENT = Symbol(``);
11486
- const CREATE_TEXT = Symbol(``);
11487
- const CREATE_STATIC = Symbol(``);
11488
- const RESOLVE_COMPONENT = Symbol(``);
11743
+ const CREATE_ELEMENT_VNODE = Symbol(
11744
+ ``
11745
+ );
11746
+ const CREATE_COMMENT = Symbol(
11747
+ ``
11748
+ );
11749
+ const CREATE_TEXT = Symbol(
11750
+ ``
11751
+ );
11752
+ const CREATE_STATIC = Symbol(
11753
+ ``
11754
+ );
11755
+ const RESOLVE_COMPONENT = Symbol(
11756
+ ``
11757
+ );
11489
11758
  const RESOLVE_DYNAMIC_COMPONENT = Symbol(
11490
11759
  ``
11491
11760
  );
11492
- const RESOLVE_DIRECTIVE = Symbol(``);
11493
- const RESOLVE_FILTER = Symbol(``);
11494
- const WITH_DIRECTIVES = Symbol(``);
11761
+ const RESOLVE_DIRECTIVE = Symbol(
11762
+ ``
11763
+ );
11764
+ const RESOLVE_FILTER = Symbol(
11765
+ ``
11766
+ );
11767
+ const WITH_DIRECTIVES = Symbol(
11768
+ ``
11769
+ );
11495
11770
  const RENDER_LIST = Symbol(``);
11496
11771
  const RENDER_SLOT = Symbol(``);
11497
11772
  const CREATE_SLOTS = Symbol(``);
11498
- const TO_DISPLAY_STRING = Symbol(``);
11773
+ const TO_DISPLAY_STRING = Symbol(
11774
+ ``
11775
+ );
11499
11776
  const MERGE_PROPS = Symbol(``);
11500
- const NORMALIZE_CLASS = Symbol(``);
11501
- const NORMALIZE_STYLE = Symbol(``);
11502
- const NORMALIZE_PROPS = Symbol(``);
11503
- const GUARD_REACTIVE_PROPS = Symbol(``);
11777
+ const NORMALIZE_CLASS = Symbol(
11778
+ ``
11779
+ );
11780
+ const NORMALIZE_STYLE = Symbol(
11781
+ ``
11782
+ );
11783
+ const NORMALIZE_PROPS = Symbol(
11784
+ ``
11785
+ );
11786
+ const GUARD_REACTIVE_PROPS = Symbol(
11787
+ ``
11788
+ );
11504
11789
  const TO_HANDLERS = Symbol(``);
11505
11790
  const CAMELIZE = Symbol(``);
11506
11791
  const CAPITALIZE = Symbol(``);
11507
- const TO_HANDLER_KEY = Symbol(``);
11508
- const SET_BLOCK_TRACKING = Symbol(``);
11792
+ const TO_HANDLER_KEY = Symbol(
11793
+ ``
11794
+ );
11795
+ const SET_BLOCK_TRACKING = Symbol(
11796
+ ``
11797
+ );
11509
11798
  const PUSH_SCOPE_ID = Symbol(``);
11510
11799
  const POP_SCOPE_ID = Symbol(``);
11511
11800
  const WITH_CTX = Symbol(``);
@@ -12699,6 +12988,16 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
12699
12988
  (id) => markScopeIdentifier(node, id, knownIds)
12700
12989
  );
12701
12990
  }
12991
+ } else if (node.type === "CatchClause" && node.param) {
12992
+ for (const id of extractIdentifiers(node.param)) {
12993
+ markScopeIdentifier(node, id, knownIds);
12994
+ }
12995
+ } else if (isForStatement(node)) {
12996
+ walkForStatement(
12997
+ node,
12998
+ false,
12999
+ (id) => markScopeIdentifier(node, id, knownIds)
13000
+ );
12702
13001
  }
12703
13002
  },
12704
13003
  leave(node, parent) {
@@ -12779,14 +13078,20 @@ function walkBlockDeclarations(block, onIdent) {
12779
13078
  } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
12780
13079
  if (stmt.declare || !stmt.id) continue;
12781
13080
  onIdent(stmt.id);
12782
- } else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
12783
- const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
12784
- if (variable && variable.type === "VariableDeclaration") {
12785
- for (const decl of variable.declarations) {
12786
- for (const id of extractIdentifiers(decl.id)) {
12787
- onIdent(id);
12788
- }
12789
- }
13081
+ } else if (isForStatement(stmt)) {
13082
+ walkForStatement(stmt, true, onIdent);
13083
+ }
13084
+ }
13085
+ }
13086
+ function isForStatement(stmt) {
13087
+ return stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement";
13088
+ }
13089
+ function walkForStatement(stmt, isVar, onIdent) {
13090
+ const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
13091
+ if (variable && variable.type === "VariableDeclaration" && (variable.kind === "var" ? isVar : !isVar)) {
13092
+ for (const decl of variable.declarations) {
13093
+ for (const id of extractIdentifiers(decl.id)) {
13094
+ onIdent(id);
12790
13095
  }
12791
13096
  }
12792
13097
  }
@@ -12969,10 +13274,11 @@ function isCoreComponent(tag) {
12969
13274
  }
12970
13275
  const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
12971
13276
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
12972
- const isMemberExpressionNode = (path, context) => {
13277
+ const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
13278
+ const isMemberExpressionNode = (exp, context) => {
12973
13279
  try {
12974
- let ret = parser.parseExpression(path, {
12975
- plugins: context.expressionPlugins
13280
+ let ret = exp.ast || parser.parseExpression(getExpSource(exp), {
13281
+ plugins: context.expressionPlugins ? [...context.expressionPlugins, "typescript"] : ["typescript"]
12976
13282
  });
12977
13283
  ret = unwrapTSNode(ret);
12978
13284
  return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier" && ret.name !== "undefined";
@@ -12981,6 +13287,24 @@ const isMemberExpressionNode = (path, context) => {
12981
13287
  }
12982
13288
  };
12983
13289
  const isMemberExpression = isMemberExpressionNode;
13290
+ const isFnExpressionNode = (exp, context) => {
13291
+ try {
13292
+ let ret = exp.ast || parser.parseExpression(getExpSource(exp), {
13293
+ plugins: context.expressionPlugins ? [...context.expressionPlugins, "typescript"] : ["typescript"]
13294
+ });
13295
+ if (ret.type === "Program") {
13296
+ ret = ret.body[0];
13297
+ if (ret.type === "ExpressionStatement") {
13298
+ ret = ret.expression;
13299
+ }
13300
+ }
13301
+ ret = unwrapTSNode(ret);
13302
+ return ret.type === "FunctionExpression" || ret.type === "ArrowFunctionExpression";
13303
+ } catch (e) {
13304
+ return false;
13305
+ }
13306
+ };
13307
+ const isFnExpression = isFnExpressionNode;
12984
13308
  function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
12985
13309
  return advancePositionWithMutation(
12986
13310
  {
@@ -16404,7 +16728,7 @@ function resolveComponentType(node, context, ssr = false) {
16404
16728
  } else {
16405
16729
  exp = isProp.exp;
16406
16730
  if (!exp) {
16407
- exp = createSimpleExpression(`is`, false, isProp.loc);
16731
+ exp = createSimpleExpression(`is`, false, isProp.arg.loc);
16408
16732
  {
16409
16733
  exp = isProp.exp = processExpression(exp, context);
16410
16734
  }
@@ -16963,7 +17287,6 @@ function processSlotOutlet(node, context) {
16963
17287
  };
16964
17288
  }
16965
17289
 
16966
- const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
16967
17290
  const transformOn$1 = (dir, node, context, augmentor) => {
16968
17291
  const { loc, modifiers, arg } = dir;
16969
17292
  if (!dir.exp && !modifiers.length) {
@@ -17004,8 +17327,8 @@ const transformOn$1 = (dir, node, context, augmentor) => {
17004
17327
  }
17005
17328
  let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
17006
17329
  if (exp) {
17007
- const isMemberExp = isMemberExpression(exp.content, context);
17008
- const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content));
17330
+ const isMemberExp = isMemberExpression(exp, context);
17331
+ const isInlineStatement = !(isMemberExp || isFnExpression(exp, context));
17009
17332
  const hasMultipleStatements = exp.content.includes(`;`);
17010
17333
  if (context.prefixIdentifiers) {
17011
17334
  isInlineStatement && context.addIdentifiers(`$event`);
@@ -17175,7 +17498,7 @@ const transformModel$1 = (dir, node, context) => {
17175
17498
  return createTransformProps();
17176
17499
  }
17177
17500
  const maybeRef = context.inline && (bindingType === "setup-let" || bindingType === "setup-ref" || bindingType === "setup-maybe-ref");
17178
- if (!expString.trim() || !isMemberExpression(expString, context) && !maybeRef) {
17501
+ if (!expString.trim() || !isMemberExpression(exp, context) && !maybeRef) {
17179
17502
  context.onError(
17180
17503
  createCompilerError(42, exp.loc)
17181
17504
  );
@@ -17473,15 +17796,27 @@ function baseCompile(source, options = {}) {
17473
17796
  const noopDirectiveTransform = () => ({ props: [] });
17474
17797
 
17475
17798
  const V_MODEL_RADIO = Symbol(``);
17476
- const V_MODEL_CHECKBOX = Symbol(``);
17799
+ const V_MODEL_CHECKBOX = Symbol(
17800
+ ``
17801
+ );
17477
17802
  const V_MODEL_TEXT = Symbol(``);
17478
- const V_MODEL_SELECT = Symbol(``);
17479
- const V_MODEL_DYNAMIC = Symbol(``);
17480
- const V_ON_WITH_MODIFIERS = Symbol(``);
17481
- const V_ON_WITH_KEYS = Symbol(``);
17803
+ const V_MODEL_SELECT = Symbol(
17804
+ ``
17805
+ );
17806
+ const V_MODEL_DYNAMIC = Symbol(
17807
+ ``
17808
+ );
17809
+ const V_ON_WITH_MODIFIERS = Symbol(
17810
+ ``
17811
+ );
17812
+ const V_ON_WITH_KEYS = Symbol(
17813
+ ``
17814
+ );
17482
17815
  const V_SHOW = Symbol(``);
17483
17816
  const TRANSITION = Symbol(``);
17484
- const TRANSITION_GROUP = Symbol(``);
17817
+ const TRANSITION_GROUP = Symbol(
17818
+ ``
17819
+ );
17485
17820
  registerRuntimeHelpers({
17486
17821
  [V_MODEL_RADIO]: `vModelRadio`,
17487
17822
  [V_MODEL_CHECKBOX]: `vModelCheckbox`,