@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.
package/dist/vue.cjs.js CHANGED
@@ -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
  **/
@@ -7,7 +7,7 @@
7
7
 
8
8
  var parser = require('@babel/parser');
9
9
  var estreeWalker = require('estree-walker');
10
- var decode_js = require('entities/lib/decode.js');
10
+ var decode_js = require('entities/dist/decode.js');
11
11
  var sourceMapJs = require('source-map-js');
12
12
 
13
13
  /*! #__NO_SIDE_EFFECTS__ */
@@ -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++) {
@@ -437,6 +441,7 @@ class EffectScope {
437
441
  * @internal
438
442
  */
439
443
  this.cleanups = [];
444
+ this._isPaused = false;
440
445
  this.parent = activeEffectScope;
441
446
  if (!detached && activeEffectScope) {
442
447
  this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
@@ -447,6 +452,37 @@ class EffectScope {
447
452
  get active() {
448
453
  return this._active;
449
454
  }
455
+ pause() {
456
+ if (this._active) {
457
+ this._isPaused = true;
458
+ if (this.scopes) {
459
+ for (let i = 0, l = this.scopes.length; i < l; i++) {
460
+ this.scopes[i].pause();
461
+ }
462
+ }
463
+ for (let i = 0, l = this.effects.length; i < l; i++) {
464
+ this.effects[i].pause();
465
+ }
466
+ }
467
+ }
468
+ /**
469
+ * Resumes the effect scope, including all child scopes and effects.
470
+ */
471
+ resume() {
472
+ if (this._active) {
473
+ if (this._isPaused) {
474
+ this._isPaused = false;
475
+ if (this.scopes) {
476
+ for (let i = 0, l = this.scopes.length; i < l; i++) {
477
+ this.scopes[i].resume();
478
+ }
479
+ }
480
+ for (let i = 0, l = this.effects.length; i < l; i++) {
481
+ this.effects[i].resume();
482
+ }
483
+ }
484
+ }
485
+ }
450
486
  run(fn) {
451
487
  if (this._active) {
452
488
  const currentEffectScope = activeEffectScope;
@@ -517,6 +553,7 @@ function onScopeDispose(fn, failSilently = false) {
517
553
  }
518
554
 
519
555
  let activeSub;
556
+ const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
520
557
  class ReactiveEffect {
521
558
  constructor(fn) {
522
559
  this.fn = fn;
@@ -545,6 +582,18 @@ class ReactiveEffect {
545
582
  activeEffectScope.effects.push(this);
546
583
  }
547
584
  }
585
+ pause() {
586
+ this.flags |= 128;
587
+ }
588
+ resume() {
589
+ if (this.flags & 128) {
590
+ this.flags &= ~128;
591
+ if (pausedQueueEffects.has(this)) {
592
+ pausedQueueEffects.delete(this);
593
+ this.trigger();
594
+ }
595
+ }
596
+ }
548
597
  /**
549
598
  * @internal
550
599
  */
@@ -598,7 +647,9 @@ class ReactiveEffect {
598
647
  }
599
648
  }
600
649
  trigger() {
601
- if (this.scheduler) {
650
+ if (this.flags & 128) {
651
+ pausedQueueEffects.add(this);
652
+ } else if (this.scheduler) {
602
653
  this.scheduler();
603
654
  } else {
604
655
  this.runIfDirty();
@@ -918,9 +969,15 @@ function addSub(link) {
918
969
  link.dep.subs = link;
919
970
  }
920
971
  const targetMap = /* @__PURE__ */ new WeakMap();
921
- const ITERATE_KEY = Symbol("Object iterate" );
922
- const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
923
- const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
972
+ const ITERATE_KEY = Symbol(
973
+ "Object iterate"
974
+ );
975
+ const MAP_KEY_ITERATE_KEY = Symbol(
976
+ "Map keys iterate"
977
+ );
978
+ const ARRAY_ITERATE_KEY = Symbol(
979
+ "Array iterate"
980
+ );
924
981
  function track(target, type, key) {
925
982
  if (shouldTrack && activeSub) {
926
983
  let depsMap = targetMap.get(target);
@@ -1210,7 +1267,7 @@ class BaseReactiveHandler {
1210
1267
  return isShallow2;
1211
1268
  } else if (key === "__v_raw") {
1212
1269
  if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
1213
- // this means the reciever is a user proxy of the reactive proxy
1270
+ // this means the receiver is a user proxy of the reactive proxy
1214
1271
  Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
1215
1272
  return target;
1216
1273
  }
@@ -1334,9 +1391,7 @@ class ReadonlyReactiveHandler extends BaseReactiveHandler {
1334
1391
  }
1335
1392
  const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
1336
1393
  const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
1337
- const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
1338
- true
1339
- );
1394
+ const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
1340
1395
  const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
1341
1396
 
1342
1397
  const toShallow = (value) => value;
@@ -1831,13 +1886,14 @@ function proxyRefs(objectWithRefs) {
1831
1886
  class CustomRefImpl {
1832
1887
  constructor(factory) {
1833
1888
  this["__v_isRef"] = true;
1889
+ this._value = void 0;
1834
1890
  const dep = this.dep = new Dep();
1835
1891
  const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
1836
1892
  this._get = get;
1837
1893
  this._set = set;
1838
1894
  }
1839
1895
  get value() {
1840
- return this._get();
1896
+ return this._value = this._get();
1841
1897
  }
1842
1898
  set value(newVal) {
1843
1899
  this._set(newVal);
@@ -1862,10 +1918,11 @@ class ObjectRefImpl {
1862
1918
  this._key = _key;
1863
1919
  this._defaultValue = _defaultValue;
1864
1920
  this["__v_isRef"] = true;
1921
+ this._value = void 0;
1865
1922
  }
1866
1923
  get value() {
1867
1924
  const val = this._object[this._key];
1868
- return val === void 0 ? this._defaultValue : val;
1925
+ return this._value = val === void 0 ? this._defaultValue : val;
1869
1926
  }
1870
1927
  set value(newVal) {
1871
1928
  this._object[this._key] = newVal;
@@ -1879,9 +1936,10 @@ class GetterRefImpl {
1879
1936
  this._getter = _getter;
1880
1937
  this["__v_isRef"] = true;
1881
1938
  this["__v_isReadonly"] = true;
1939
+ this._value = void 0;
1882
1940
  }
1883
1941
  get value() {
1884
- return this._getter();
1942
+ return this._value = this._getter();
1885
1943
  }
1886
1944
  }
1887
1945
  function toRef(source, key, defaultValue) {
@@ -1915,7 +1973,8 @@ class ComputedRefImpl {
1915
1973
  /**
1916
1974
  * @internal
1917
1975
  */
1918
- this["__v_isRef"] = true;
1976
+ this.__v_isRef = true;
1977
+ // TODO isolatedDeclarations "__v_isReadonly"
1919
1978
  // A computed is also a subscriber that tracks other deps
1920
1979
  /**
1921
1980
  * @internal
@@ -2540,6 +2599,9 @@ function reload(id, newComp) {
2540
2599
  "[HMR] Root or manually mounted instance modified. Full reload required."
2541
2600
  );
2542
2601
  }
2602
+ if (instance.root.ce && instance !== instance.root) {
2603
+ instance.root.ce._removeChildStyle(oldComp);
2604
+ }
2543
2605
  }
2544
2606
  queuePostFlushCb(() => {
2545
2607
  hmrDirtyComponents.clear();
@@ -2619,9 +2681,7 @@ function devtoolsInitApp(app, version) {
2619
2681
  function devtoolsUnmountApp(app) {
2620
2682
  emit$2("app:unmount" /* APP_UNMOUNT */, app);
2621
2683
  }
2622
- const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
2623
- "component:added" /* COMPONENT_ADDED */
2624
- );
2684
+ const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
2625
2685
  const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
2626
2686
  const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
2627
2687
  "component:removed" /* COMPONENT_REMOVED */
@@ -2645,12 +2705,8 @@ function createDevtoolsComponentHook(hook) {
2645
2705
  );
2646
2706
  };
2647
2707
  }
2648
- const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
2649
- "perf:start" /* PERFORMANCE_START */
2650
- );
2651
- const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
2652
- "perf:end" /* PERFORMANCE_END */
2653
- );
2708
+ const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
2709
+ const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
2654
2710
  function createDevtoolsPerformanceHook(hook) {
2655
2711
  return (component, type, time) => {
2656
2712
  emit$2(hook, component.appContext.app, component.uid, component, type, time);
@@ -4359,6 +4415,7 @@ Server rendered element contains more child nodes than client vdom.`
4359
4415
  }
4360
4416
  if (props) {
4361
4417
  {
4418
+ const isCustomElement = el.tagName.includes("-");
4362
4419
  for (const key in props) {
4363
4420
  if (// #11189 skip if this node has directives that have created hooks
4364
4421
  // as it could have mutated the DOM in any possible way
@@ -4366,7 +4423,7 @@ Server rendered element contains more child nodes than client vdom.`
4366
4423
  logMismatchError();
4367
4424
  }
4368
4425
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4369
- key[0] === ".") {
4426
+ key[0] === "." || isCustomElement) {
4370
4427
  patchProp(el, key, null, props[key], void 0, parentComponent);
4371
4428
  }
4372
4429
  }
@@ -4691,24 +4748,19 @@ function isMismatchAllowed(el, allowedType) {
4691
4748
  }
4692
4749
  }
4693
4750
 
4694
- const hydrateOnIdle = () => (hydrate) => {
4695
- const id = requestIdleCallback(hydrate);
4751
+ const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
4752
+ const id = requestIdleCallback(hydrate, { timeout });
4696
4753
  return () => cancelIdleCallback(id);
4697
4754
  };
4698
- const hydrateOnVisible = (margin = 0) => (hydrate, forEach) => {
4699
- const ob = new IntersectionObserver(
4700
- (entries) => {
4701
- for (const e of entries) {
4702
- if (!e.isIntersecting) continue;
4703
- ob.disconnect();
4704
- hydrate();
4705
- break;
4706
- }
4707
- },
4708
- {
4709
- rootMargin: isString(margin) ? margin : margin + "px"
4755
+ const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4756
+ const ob = new IntersectionObserver((entries) => {
4757
+ for (const e of entries) {
4758
+ if (!e.isIntersecting) continue;
4759
+ ob.disconnect();
4760
+ hydrate();
4761
+ break;
4710
4762
  }
4711
- );
4763
+ }, opts);
4712
4764
  forEach((el) => ob.observe(el));
4713
4765
  return () => ob.disconnect();
4714
4766
  };
@@ -5023,7 +5075,7 @@ const KeepAliveImpl = {
5023
5075
  }
5024
5076
  function pruneCacheEntry(key) {
5025
5077
  const cached = cache.get(key);
5026
- if (!current || !isSameVNodeType(cached, current)) {
5078
+ if (cached && (!current || !isSameVNodeType(cached, current))) {
5027
5079
  unmount(cached);
5028
5080
  } else if (current) {
5029
5081
  resetShapeFlag(current);
@@ -5085,6 +5137,10 @@ const KeepAliveImpl = {
5085
5137
  return rawVNode;
5086
5138
  }
5087
5139
  let vnode = getInnerChild(rawVNode);
5140
+ if (vnode.type === Comment) {
5141
+ current = null;
5142
+ return vnode;
5143
+ }
5088
5144
  const comp = vnode.type;
5089
5145
  const name = getComponentName(
5090
5146
  isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
@@ -5217,17 +5273,19 @@ const createHook = (lifecycle) => (hook, target = currentInstance) => {
5217
5273
  };
5218
5274
  const onBeforeMount = createHook("bm");
5219
5275
  const onMounted = createHook("m");
5220
- const onBeforeUpdate = createHook("bu");
5276
+ const onBeforeUpdate = createHook(
5277
+ "bu"
5278
+ );
5221
5279
  const onUpdated = createHook("u");
5222
- const onBeforeUnmount = createHook("bum");
5223
- const onUnmounted = createHook("um");
5224
- const onServerPrefetch = createHook("sp");
5225
- const onRenderTriggered = createHook(
5226
- "rtg"
5280
+ const onBeforeUnmount = createHook(
5281
+ "bum"
5227
5282
  );
5228
- const onRenderTracked = createHook(
5229
- "rtc"
5283
+ const onUnmounted = createHook("um");
5284
+ const onServerPrefetch = createHook(
5285
+ "sp"
5230
5286
  );
5287
+ const onRenderTriggered = createHook("rtg");
5288
+ const onRenderTracked = createHook("rtc");
5231
5289
  function onErrorCaptured(hook, target = currentInstance) {
5232
5290
  injectHook("ec", hook, target);
5233
5291
  }
@@ -5641,9 +5699,14 @@ function createSlots(slots, dynamicSlots) {
5641
5699
  }
5642
5700
 
5643
5701
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5644
- if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
5702
+ if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5645
5703
  if (name !== "default") props.name = name;
5646
- return createVNode("slot", props, fallback && fallback());
5704
+ return openBlock(), createBlock(
5705
+ Fragment,
5706
+ null,
5707
+ [createVNode("slot", props, fallback && fallback())],
5708
+ 64
5709
+ );
5647
5710
  }
5648
5711
  let slot = slots[name];
5649
5712
  if (slot && slot.length > 1) {
@@ -5945,6 +6008,7 @@ const publicPropertiesMap = (
5945
6008
  $refs: (i) => shallowReadonly(i.refs) ,
5946
6009
  $parent: (i) => getPublicInstance(i.parent),
5947
6010
  $root: (i) => getPublicInstance(i.root),
6011
+ $host: (i) => i.ce,
5948
6012
  $emit: (i) => i.emit,
5949
6013
  $options: (i) => resolveMergedOptions(i) ,
5950
6014
  $forceUpdate: (i) => i.f || (i.f = () => {
@@ -6105,29 +6169,25 @@ const PublicInstanceProxyHandlers = {
6105
6169
  return Reflect.ownKeys(target);
6106
6170
  };
6107
6171
  }
6108
- const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
6109
- {},
6110
- PublicInstanceProxyHandlers,
6111
- {
6112
- get(target, key) {
6113
- if (key === Symbol.unscopables) {
6114
- return;
6115
- }
6116
- return PublicInstanceProxyHandlers.get(target, key, target);
6117
- },
6118
- has(_, key) {
6119
- const has = key[0] !== "_" && !isGloballyAllowed(key);
6120
- if (!has && PublicInstanceProxyHandlers.has(_, key)) {
6121
- warn$1(
6122
- `Property ${JSON.stringify(
6123
- key
6124
- )} should not start with _ which is a reserved prefix for Vue internals.`
6125
- );
6126
- }
6127
- return has;
6172
+ const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, {
6173
+ get(target, key) {
6174
+ if (key === Symbol.unscopables) {
6175
+ return;
6128
6176
  }
6177
+ return PublicInstanceProxyHandlers.get(target, key, target);
6178
+ },
6179
+ has(_, key) {
6180
+ const has = key[0] !== "_" && !isGloballyAllowed(key);
6181
+ if (!has && PublicInstanceProxyHandlers.has(_, key)) {
6182
+ warn$1(
6183
+ `Property ${JSON.stringify(
6184
+ key
6185
+ )} should not start with _ which is a reserved prefix for Vue internals.`
6186
+ );
6187
+ }
6188
+ return has;
6129
6189
  }
6130
- );
6190
+ });
6131
6191
  function createDevRenderContext(instance) {
6132
6192
  const target = {};
6133
6193
  Object.defineProperty(target, `_`, {
@@ -6814,7 +6874,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6814
6874
  return vm;
6815
6875
  }
6816
6876
  }
6817
- Vue.version = `2.6.14-compat:${"3.5.0-alpha.5"}`;
6877
+ Vue.version = `2.6.14-compat:${"3.5.0-beta.1"}`;
6818
6878
  Vue.config = singletonApp.config;
6819
6879
  Vue.use = (plugin, ...options) => {
6820
6880
  if (plugin && isFunction(plugin.install)) {
@@ -7087,7 +7147,7 @@ function installCompatMount(app, context, render) {
7087
7147
  /* skip options */
7088
7148
  );
7089
7149
  }
7090
- container.innerHTML = "";
7150
+ container.textContent = "";
7091
7151
  render(vnode, container, namespace);
7092
7152
  if (container instanceof Element) {
7093
7153
  container.removeAttribute("v-cloak");
@@ -7299,7 +7359,7 @@ function createAppAPI(render, hydrate) {
7299
7359
  If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
7300
7360
  );
7301
7361
  }
7302
- const vnode = createVNode(rootComponent, rootProps);
7362
+ const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
7303
7363
  vnode.appContext = context;
7304
7364
  if (namespace === true) {
7305
7365
  namespace = "svg";
@@ -7404,7 +7464,7 @@ function provide(key, value) {
7404
7464
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
7405
7465
  const instance = currentInstance || currentRenderingInstance;
7406
7466
  if (instance || currentApp) {
7407
- const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
7467
+ const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
7408
7468
  if (provides && key in provides) {
7409
7469
  return provides[key];
7410
7470
  } else if (arguments.length > 1) {
@@ -7678,6 +7738,9 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
7678
7738
  } else {
7679
7739
  value = defaultValue;
7680
7740
  }
7741
+ if (instance.ce) {
7742
+ instance.ce._setProp(key, value);
7743
+ }
7681
7744
  }
7682
7745
  if (opt[0 /* shouldCast */]) {
7683
7746
  if (isAbsent && !hasDefault) {
@@ -8680,8 +8743,8 @@ function baseCreateRenderer(options, createHydrationFns) {
8680
8743
  const componentUpdateFn = () => {
8681
8744
  if (!instance.isMounted) {
8682
8745
  let vnodeHook;
8683
- const { el, props, type } = initialVNode;
8684
- const { bm, m, parent } = instance;
8746
+ const { el, props } = initialVNode;
8747
+ const { bm, m, parent, root, type } = instance;
8685
8748
  const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
8686
8749
  toggleRecurse(instance, false);
8687
8750
  if (bm) {
@@ -8727,6 +8790,9 @@ function baseCreateRenderer(options, createHydrationFns) {
8727
8790
  hydrateSubTree();
8728
8791
  }
8729
8792
  } else {
8793
+ if (root.ce) {
8794
+ root.ce._injectChildStyle(type);
8795
+ }
8730
8796
  {
8731
8797
  startMeasure(instance, `render`);
8732
8798
  }
@@ -9430,13 +9496,13 @@ function baseCreateRenderer(options, createHydrationFns) {
9430
9496
  namespace
9431
9497
  );
9432
9498
  }
9499
+ container._vnode = vnode;
9433
9500
  if (!isFlushing) {
9434
9501
  isFlushing = true;
9435
9502
  flushPreFlushCbs();
9436
9503
  flushPostFlushCbs();
9437
9504
  isFlushing = false;
9438
9505
  }
9439
- container._vnode = vnode;
9440
9506
  };
9441
9507
  const internals = {
9442
9508
  p: patch,
@@ -9610,14 +9676,9 @@ function doWatch(source, cb, {
9610
9676
  const _cb = cb;
9611
9677
  cb = (...args) => {
9612
9678
  _cb(...args);
9613
- unwatch();
9679
+ watchHandle();
9614
9680
  };
9615
9681
  }
9616
- if (deep !== void 0 && typeof deep === "number") {
9617
- warn$1(
9618
- `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
9619
- );
9620
- }
9621
9682
  if (!cb) {
9622
9683
  if (immediate !== void 0) {
9623
9684
  warn$1(
@@ -9643,10 +9704,12 @@ function doWatch(source, cb, {
9643
9704
  );
9644
9705
  };
9645
9706
  const instance = currentInstance;
9646
- const reactiveGetter = (source2) => deep === true ? source2 : (
9647
- // for deep: false, only traverse root-level properties
9648
- traverse(source2, deep === false ? 1 : void 0)
9649
- );
9707
+ const reactiveGetter = (source2) => {
9708
+ if (deep) return source2;
9709
+ if (isShallow(source2) || deep === false || deep === 0)
9710
+ return traverse(source2, 1);
9711
+ return traverse(source2);
9712
+ };
9650
9713
  let getter;
9651
9714
  let forceTrigger = false;
9652
9715
  let isMultiSource = false;
@@ -9702,7 +9765,8 @@ function doWatch(source, cb, {
9702
9765
  }
9703
9766
  if (cb && deep) {
9704
9767
  const baseGetter = getter;
9705
- getter = () => traverse(baseGetter());
9768
+ const depth = deep === true ? Infinity : deep;
9769
+ getter = () => traverse(baseGetter(), depth);
9706
9770
  }
9707
9771
  let cleanup;
9708
9772
  let onCleanup = (fn) => {
@@ -9727,7 +9791,12 @@ function doWatch(source, cb, {
9727
9791
  const ctx = useSSRContext();
9728
9792
  ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
9729
9793
  } else {
9730
- return NOOP;
9794
+ const watchHandle2 = () => {
9795
+ };
9796
+ watchHandle2.stop = NOOP;
9797
+ watchHandle2.resume = NOOP;
9798
+ watchHandle2.pause = NOOP;
9799
+ return watchHandle2;
9731
9800
  }
9732
9801
  }
9733
9802
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -9768,12 +9837,15 @@ function doWatch(source, cb, {
9768
9837
  }
9769
9838
  effect.scheduler = scheduler;
9770
9839
  const scope = getCurrentScope();
9771
- const unwatch = () => {
9840
+ const watchHandle = () => {
9772
9841
  effect.stop();
9773
9842
  if (scope) {
9774
9843
  remove(scope.effects, effect);
9775
9844
  }
9776
9845
  };
9846
+ watchHandle.pause = effect.pause.bind(effect);
9847
+ watchHandle.resume = effect.resume.bind(effect);
9848
+ watchHandle.stop = watchHandle;
9777
9849
  {
9778
9850
  effect.onTrack = onTrack;
9779
9851
  effect.onTrigger = onTrigger;
@@ -9792,8 +9864,8 @@ function doWatch(source, cb, {
9792
9864
  } else {
9793
9865
  effect.run();
9794
9866
  }
9795
- if (ssrCleanup) ssrCleanup.push(unwatch);
9796
- return unwatch;
9867
+ if (ssrCleanup) ssrCleanup.push(watchHandle);
9868
+ return watchHandle;
9797
9869
  }
9798
9870
  function instanceWatch(source, value, options) {
9799
9871
  const publicThis = this.proxy;
@@ -9883,7 +9955,8 @@ function useModel(props, name, options = EMPTY_OBJ) {
9883
9955
  return options.get ? options.get(localValue) : localValue;
9884
9956
  },
9885
9957
  set(value) {
9886
- if (!hasChanged(value, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
9958
+ const emittedValue = options.set ? options.set(value) : value;
9959
+ if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
9887
9960
  return;
9888
9961
  }
9889
9962
  const rawProps = i.vnode.props;
@@ -9892,7 +9965,6 @@ function useModel(props, name, options = EMPTY_OBJ) {
9892
9965
  localValue = value;
9893
9966
  trigger();
9894
9967
  }
9895
- const emittedValue = options.set ? options.set(value) : value;
9896
9968
  i.emit(`update:${name}`, emittedValue);
9897
9969
  if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
9898
9970
  trigger();
@@ -9930,9 +10002,9 @@ function emit(instance, event, ...rawArgs) {
9930
10002
  } = instance;
9931
10003
  if (emitsOptions) {
9932
10004
  if (!(event in emitsOptions) && !(event.startsWith("hook:") || event.startsWith(compatModelEventPrefix))) {
9933
- if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
10005
+ if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
9934
10006
  warn$1(
9935
- `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
10007
+ `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
9936
10008
  );
9937
10009
  }
9938
10010
  } else {
@@ -11863,11 +11935,16 @@ function useTemplateRef(key) {
11863
11935
  const r = shallowRef(null);
11864
11936
  if (i) {
11865
11937
  const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
11866
- Object.defineProperty(refs, key, {
11867
- enumerable: true,
11868
- get: () => r.value,
11869
- set: (val) => r.value = val
11870
- });
11938
+ let desc;
11939
+ if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
11940
+ warn$1(`useTemplateRef('${key}') already exists.`);
11941
+ } else {
11942
+ Object.defineProperty(refs, key, {
11943
+ enumerable: true,
11944
+ get: () => r.value,
11945
+ set: (val) => r.value = val
11946
+ });
11947
+ }
11871
11948
  } else {
11872
11949
  warn$1(
11873
11950
  `useTemplateRef() is called when there is no active component instance to be associated with.`
@@ -12101,7 +12178,7 @@ function isMemoSame(cached, memo) {
12101
12178
  return true;
12102
12179
  }
12103
12180
 
12104
- const version = "3.5.0-alpha.5";
12181
+ const version = "3.5.0-beta.1";
12105
12182
  const warn = warn$1 ;
12106
12183
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12107
12184
  const devtools = devtools$1 ;
@@ -12113,7 +12190,8 @@ const _ssrUtils = {
12113
12190
  setCurrentRenderingInstance,
12114
12191
  isVNode: isVNode,
12115
12192
  normalizeVNode,
12116
- getComponentPublicInstance
12193
+ getComponentPublicInstance,
12194
+ ensureValidVNode
12117
12195
  };
12118
12196
  const ssrUtils = _ssrUtils ;
12119
12197
  const resolveFilter = resolveFilter$1 ;
@@ -12127,6 +12205,18 @@ const _compatUtils = {
12127
12205
  const compatUtils = _compatUtils ;
12128
12206
  const DeprecationTypes = DeprecationTypes$1 ;
12129
12207
 
12208
+ let policy = void 0;
12209
+ const tt = typeof window !== "undefined" && window.trustedTypes;
12210
+ if (tt) {
12211
+ try {
12212
+ policy = /* @__PURE__ */ tt.createPolicy("vue", {
12213
+ createHTML: (val) => val
12214
+ });
12215
+ } catch (e) {
12216
+ warn(`Error creating trusted types policy: ${e}`);
12217
+ }
12218
+ }
12219
+ const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
12130
12220
  const svgNS = "http://www.w3.org/2000/svg";
12131
12221
  const mathmlNS = "http://www.w3.org/1998/Math/MathML";
12132
12222
  const doc = typeof document !== "undefined" ? document : null;
@@ -12174,7 +12264,9 @@ const nodeOps = {
12174
12264
  if (start === end || !(start = start.nextSibling)) break;
12175
12265
  }
12176
12266
  } else {
12177
- templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
12267
+ templateContainer.innerHTML = unsafeToTrustedHTML(
12268
+ namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
12269
+ );
12178
12270
  const template = templateContainer.content;
12179
12271
  if (namespace === "svg" || namespace === "mathml") {
12180
12272
  const wrapper = template.firstChild;
@@ -12922,16 +13014,24 @@ function shouldSetAsProp(el, key, value, isSVG) {
12922
13014
  if (isNativeOn(key) && isString(value)) {
12923
13015
  return false;
12924
13016
  }
12925
- return key in el;
13017
+ if (key in el) {
13018
+ return true;
13019
+ }
13020
+ if (el._isVueCE && (/[A-Z]/.test(key) || !isString(value))) {
13021
+ return true;
13022
+ }
13023
+ return false;
12926
13024
  }
12927
13025
 
13026
+ const REMOVAL = {};
12928
13027
  /*! #__NO_SIDE_EFFECTS__ */
12929
13028
  // @__NO_SIDE_EFFECTS__
12930
- function defineCustomElement(options, extraOptions, hydrate2) {
13029
+ function defineCustomElement(options, extraOptions, _createApp) {
12931
13030
  const Comp = defineComponent(options, extraOptions);
13031
+ if (isPlainObject(Comp)) extend(Comp, extraOptions);
12932
13032
  class VueCustomElement extends VueElement {
12933
13033
  constructor(initialProps) {
12934
- super(Comp, initialProps, hydrate2);
13034
+ super(Comp, initialProps, _createApp);
12935
13035
  }
12936
13036
  }
12937
13037
  VueCustomElement.def = Comp;
@@ -12939,47 +13039,88 @@ function defineCustomElement(options, extraOptions, hydrate2) {
12939
13039
  }
12940
13040
  /*! #__NO_SIDE_EFFECTS__ */
12941
13041
  const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
12942
- return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
13042
+ return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
12943
13043
  };
12944
13044
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
12945
13045
  };
12946
13046
  class VueElement extends BaseClass {
12947
- constructor(_def, _props = {}, hydrate2) {
13047
+ constructor(_def, _props = {}, _createApp = createApp) {
12948
13048
  super();
12949
13049
  this._def = _def;
12950
13050
  this._props = _props;
13051
+ this._createApp = _createApp;
13052
+ this._isVueCE = true;
12951
13053
  /**
12952
13054
  * @internal
12953
13055
  */
12954
13056
  this._instance = null;
13057
+ /**
13058
+ * @internal
13059
+ */
13060
+ this._app = null;
13061
+ /**
13062
+ * @internal
13063
+ */
13064
+ this._nonce = this._def.nonce;
12955
13065
  this._connected = false;
12956
13066
  this._resolved = false;
12957
13067
  this._numberProps = null;
13068
+ this._styleChildren = /* @__PURE__ */ new WeakSet();
12958
13069
  this._ob = null;
12959
- if (this.shadowRoot && hydrate2) {
12960
- hydrate2(this._createVNode(), this.shadowRoot);
13070
+ if (this.shadowRoot && _createApp !== createApp) {
13071
+ this._root = this.shadowRoot;
13072
+ this._mount(_def);
12961
13073
  } else {
12962
13074
  if (this.shadowRoot) {
12963
13075
  warn(
12964
13076
  `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
12965
13077
  );
12966
13078
  }
12967
- this.attachShadow({ mode: "open" });
13079
+ if (_def.shadowRoot !== false) {
13080
+ this.attachShadow({ mode: "open" });
13081
+ this._root = this.shadowRoot;
13082
+ } else {
13083
+ this._root = this;
13084
+ }
12968
13085
  if (!this._def.__asyncLoader) {
12969
13086
  this._resolveProps(this._def);
12970
13087
  }
12971
13088
  }
12972
13089
  }
12973
13090
  connectedCallback() {
13091
+ if (!this.shadowRoot) {
13092
+ this._parseSlots();
13093
+ }
12974
13094
  this._connected = true;
13095
+ let parent = this;
13096
+ while (parent = parent && (parent.parentNode || parent.host)) {
13097
+ if (parent instanceof VueElement) {
13098
+ this._parent = parent;
13099
+ break;
13100
+ }
13101
+ }
12975
13102
  if (!this._instance) {
12976
13103
  if (this._resolved) {
13104
+ this._setParent();
12977
13105
  this._update();
12978
13106
  } else {
12979
- this._resolveDef();
13107
+ if (parent && parent._pendingResolve) {
13108
+ this._pendingResolve = parent._pendingResolve.then(() => {
13109
+ this._pendingResolve = void 0;
13110
+ this._resolveDef();
13111
+ });
13112
+ } else {
13113
+ this._resolveDef();
13114
+ }
12980
13115
  }
12981
13116
  }
12982
13117
  }
13118
+ _setParent(parent = this._parent) {
13119
+ if (parent) {
13120
+ this._instance.parent = parent._instance;
13121
+ this._instance.provides = parent._instance.provides;
13122
+ }
13123
+ }
12983
13124
  disconnectedCallback() {
12984
13125
  this._connected = false;
12985
13126
  nextTick(() => {
@@ -12988,8 +13129,9 @@ class VueElement extends BaseClass {
12988
13129
  this._ob.disconnect();
12989
13130
  this._ob = null;
12990
13131
  }
12991
- render(null, this.shadowRoot);
12992
- this._instance = null;
13132
+ this._app && this._app.unmount();
13133
+ this._instance.ce = void 0;
13134
+ this._app = this._instance = null;
12993
13135
  }
12994
13136
  });
12995
13137
  }
@@ -12997,7 +13139,9 @@ class VueElement extends BaseClass {
12997
13139
  * resolve inner component definition (handle possible async component)
12998
13140
  */
12999
13141
  _resolveDef() {
13000
- this._resolved = true;
13142
+ if (this._pendingResolve) {
13143
+ return;
13144
+ }
13001
13145
  for (let i = 0; i < this.attributes.length; i++) {
13002
13146
  this._setAttr(this.attributes[i].name);
13003
13147
  }
@@ -13008,6 +13152,8 @@ class VueElement extends BaseClass {
13008
13152
  });
13009
13153
  this._ob.observe(this, { attributes: true });
13010
13154
  const resolve = (def, isAsync = false) => {
13155
+ this._resolved = true;
13156
+ this._pendingResolve = void 0;
13011
13157
  const { props, styles } = def;
13012
13158
  let numberProps;
13013
13159
  if (props && !isArray(props)) {
@@ -13025,22 +13171,53 @@ class VueElement extends BaseClass {
13025
13171
  if (isAsync) {
13026
13172
  this._resolveProps(def);
13027
13173
  }
13028
- this._applyStyles(styles);
13029
- this._update();
13174
+ if (this.shadowRoot) {
13175
+ this._applyStyles(styles);
13176
+ } else if (styles) {
13177
+ warn(
13178
+ "Custom element style injection is not supported when using shadowRoot: false"
13179
+ );
13180
+ }
13181
+ this._mount(def);
13030
13182
  };
13031
13183
  const asyncDef = this._def.__asyncLoader;
13032
13184
  if (asyncDef) {
13033
- asyncDef().then((def) => resolve(def, true));
13185
+ this._pendingResolve = asyncDef().then(
13186
+ (def) => resolve(this._def = def, true)
13187
+ );
13034
13188
  } else {
13035
13189
  resolve(this._def);
13036
13190
  }
13037
13191
  }
13192
+ _mount(def) {
13193
+ if (!def.name) {
13194
+ def.name = "VueElement";
13195
+ }
13196
+ this._app = this._createApp(def);
13197
+ if (def.configureApp) {
13198
+ def.configureApp(this._app);
13199
+ }
13200
+ this._app._ceVNode = this._createVNode();
13201
+ this._app.mount(this._root);
13202
+ const exposed = this._instance && this._instance.exposed;
13203
+ if (!exposed) return;
13204
+ for (const key in exposed) {
13205
+ if (!hasOwn(this, key)) {
13206
+ Object.defineProperty(this, key, {
13207
+ // unwrap ref to be consistent with public instance behavior
13208
+ get: () => unref(exposed[key])
13209
+ });
13210
+ } else {
13211
+ warn(`Exposed property "${key}" already exists on custom element.`);
13212
+ }
13213
+ }
13214
+ }
13038
13215
  _resolveProps(def) {
13039
13216
  const { props } = def;
13040
13217
  const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
13041
13218
  for (const key of Object.keys(this)) {
13042
13219
  if (key[0] !== "_" && declaredPropKeys.includes(key)) {
13043
- this._setProp(key, this[key], true, false);
13220
+ this._setProp(key, this[key]);
13044
13221
  }
13045
13222
  }
13046
13223
  for (const key of declaredPropKeys.map(camelize)) {
@@ -13049,18 +13226,20 @@ class VueElement extends BaseClass {
13049
13226
  return this._getProp(key);
13050
13227
  },
13051
13228
  set(val) {
13052
- this._setProp(key, val);
13229
+ this._setProp(key, val, true, true);
13053
13230
  }
13054
13231
  });
13055
13232
  }
13056
13233
  }
13057
13234
  _setAttr(key) {
13058
- let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
13235
+ if (key.startsWith("data-v-")) return;
13236
+ const has = this.hasAttribute(key);
13237
+ let value = has ? this.getAttribute(key) : REMOVAL;
13059
13238
  const camelKey = camelize(key);
13060
- if (this._numberProps && this._numberProps[camelKey]) {
13239
+ if (has && this._numberProps && this._numberProps[camelKey]) {
13061
13240
  value = toNumber(value);
13062
13241
  }
13063
- this._setProp(camelKey, value, false);
13242
+ this._setProp(camelKey, value, false, true);
13064
13243
  }
13065
13244
  /**
13066
13245
  * @internal
@@ -13071,9 +13250,13 @@ class VueElement extends BaseClass {
13071
13250
  /**
13072
13251
  * @internal
13073
13252
  */
13074
- _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
13253
+ _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
13075
13254
  if (val !== this._props[key]) {
13076
- this._props[key] = val;
13255
+ if (val === REMOVAL) {
13256
+ delete this._props[key];
13257
+ } else {
13258
+ this._props[key] = val;
13259
+ }
13077
13260
  if (shouldUpdate && this._instance) {
13078
13261
  this._update();
13079
13262
  }
@@ -13089,18 +13272,22 @@ class VueElement extends BaseClass {
13089
13272
  }
13090
13273
  }
13091
13274
  _update() {
13092
- render(this._createVNode(), this.shadowRoot);
13275
+ render(this._createVNode(), this._root);
13093
13276
  }
13094
13277
  _createVNode() {
13095
- const vnode = createVNode(this._def, extend({}, this._props));
13278
+ const baseProps = {};
13279
+ if (!this.shadowRoot) {
13280
+ baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
13281
+ }
13282
+ const vnode = createVNode(this._def, extend(baseProps, this._props));
13096
13283
  if (!this._instance) {
13097
13284
  vnode.ce = (instance) => {
13098
13285
  this._instance = instance;
13099
- instance.isCE = true;
13286
+ instance.ce = this;
13100
13287
  {
13101
13288
  instance.ceReload = (newStyles) => {
13102
13289
  if (this._styles) {
13103
- this._styles.forEach((s) => this.shadowRoot.removeChild(s));
13290
+ this._styles.forEach((s) => this._root.removeChild(s));
13104
13291
  this._styles.length = 0;
13105
13292
  }
13106
13293
  this._applyStyles(newStyles);
@@ -13110,9 +13297,10 @@ class VueElement extends BaseClass {
13110
13297
  }
13111
13298
  const dispatch = (event, args) => {
13112
13299
  this.dispatchEvent(
13113
- new CustomEvent(event, {
13114
- detail: args
13115
- })
13300
+ new CustomEvent(
13301
+ event,
13302
+ isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
13303
+ )
13116
13304
  );
13117
13305
  };
13118
13306
  instance.emit = (event, ...args) => {
@@ -13121,31 +13309,127 @@ class VueElement extends BaseClass {
13121
13309
  dispatch(hyphenate(event), args);
13122
13310
  }
13123
13311
  };
13124
- let parent = this;
13125
- while (parent = parent && (parent.parentNode || parent.host)) {
13126
- if (parent instanceof VueElement) {
13127
- instance.parent = parent._instance;
13128
- instance.provides = parent._instance.provides;
13129
- break;
13130
- }
13131
- }
13312
+ this._setParent();
13132
13313
  };
13133
13314
  }
13134
13315
  return vnode;
13135
13316
  }
13136
- _applyStyles(styles) {
13137
- if (styles) {
13138
- styles.forEach((css) => {
13139
- const s = document.createElement("style");
13140
- s.textContent = css;
13141
- this.shadowRoot.appendChild(s);
13142
- {
13317
+ _applyStyles(styles, owner) {
13318
+ if (!styles) return;
13319
+ if (owner) {
13320
+ if (owner === this._def || this._styleChildren.has(owner)) {
13321
+ return;
13322
+ }
13323
+ this._styleChildren.add(owner);
13324
+ }
13325
+ const nonce = this._nonce;
13326
+ for (let i = styles.length - 1; i >= 0; i--) {
13327
+ const s = document.createElement("style");
13328
+ if (nonce) s.setAttribute("nonce", nonce);
13329
+ s.textContent = styles[i];
13330
+ this.shadowRoot.prepend(s);
13331
+ {
13332
+ if (owner) {
13333
+ if (owner.__hmrId) {
13334
+ if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
13335
+ let entry = this._childStyles.get(owner.__hmrId);
13336
+ if (!entry) {
13337
+ this._childStyles.set(owner.__hmrId, entry = []);
13338
+ }
13339
+ entry.push(s);
13340
+ }
13341
+ } else {
13143
13342
  (this._styles || (this._styles = [])).push(s);
13144
13343
  }
13145
- });
13344
+ }
13345
+ }
13346
+ }
13347
+ /**
13348
+ * Only called when shaddowRoot is false
13349
+ */
13350
+ _parseSlots() {
13351
+ const slots = this._slots = {};
13352
+ let n;
13353
+ while (n = this.firstChild) {
13354
+ const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
13355
+ (slots[slotName] || (slots[slotName] = [])).push(n);
13356
+ this.removeChild(n);
13357
+ }
13358
+ }
13359
+ /**
13360
+ * Only called when shaddowRoot is false
13361
+ */
13362
+ _renderSlots() {
13363
+ const outlets = this.querySelectorAll("slot");
13364
+ const scopeId = this._instance.type.__scopeId;
13365
+ for (let i = 0; i < outlets.length; i++) {
13366
+ const o = outlets[i];
13367
+ const slotName = o.getAttribute("name") || "default";
13368
+ const content = this._slots[slotName];
13369
+ const parent = o.parentNode;
13370
+ if (content) {
13371
+ for (const n of content) {
13372
+ if (scopeId && n.nodeType === 1) {
13373
+ const id = scopeId + "-s";
13374
+ const walker = document.createTreeWalker(n, 1);
13375
+ n.setAttribute(id, "");
13376
+ let child;
13377
+ while (child = walker.nextNode()) {
13378
+ child.setAttribute(id, "");
13379
+ }
13380
+ }
13381
+ parent.insertBefore(n, o);
13382
+ }
13383
+ } else {
13384
+ while (o.firstChild) parent.insertBefore(o.firstChild, o);
13385
+ }
13386
+ parent.removeChild(o);
13387
+ }
13388
+ }
13389
+ /**
13390
+ * @internal
13391
+ */
13392
+ _injectChildStyle(comp) {
13393
+ this._applyStyles(comp.styles, comp);
13394
+ }
13395
+ /**
13396
+ * @internal
13397
+ */
13398
+ _removeChildStyle(comp) {
13399
+ {
13400
+ this._styleChildren.delete(comp);
13401
+ if (this._childStyles && comp.__hmrId) {
13402
+ const oldStyles = this._childStyles.get(comp.__hmrId);
13403
+ if (oldStyles) {
13404
+ oldStyles.forEach((s) => this._root.removeChild(s));
13405
+ oldStyles.length = 0;
13406
+ }
13407
+ }
13146
13408
  }
13147
13409
  }
13148
13410
  }
13411
+ function useHost(caller) {
13412
+ const instance = getCurrentInstance();
13413
+ const el = instance && instance.ce;
13414
+ if (el) {
13415
+ return el;
13416
+ } else {
13417
+ if (!instance) {
13418
+ warn(
13419
+ `${caller || "useHost"} called without an active component instance.`
13420
+ );
13421
+ } else {
13422
+ warn(
13423
+ `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
13424
+ );
13425
+ }
13426
+ }
13427
+ return null;
13428
+ }
13429
+ function useShadowRoot() {
13430
+ const el = useHost("useShadowRoot") ;
13431
+ return el && el.shadowRoot;
13432
+ }
13149
13433
 
13150
13434
  function useCssModule(name = "$style") {
13151
13435
  {
@@ -13703,7 +13987,7 @@ const createApp = (...args) => {
13703
13987
  const component = app._component;
13704
13988
  if (!isFunction(component) && !component.render && !component.template) {
13705
13989
  component.template = container.innerHTML;
13706
- {
13990
+ if (container.nodeType === 1) {
13707
13991
  for (let i = 0; i < container.attributes.length; i++) {
13708
13992
  const attr = container.attributes[i];
13709
13993
  if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
@@ -13716,7 +14000,9 @@ const createApp = (...args) => {
13716
14000
  }
13717
14001
  }
13718
14002
  }
13719
- container.innerHTML = "";
14003
+ if (container.nodeType === 1) {
14004
+ container.textContent = "";
14005
+ }
13720
14006
  const proxy = mount(container, false, resolveRootNamespace(container));
13721
14007
  if (container instanceof Element) {
13722
14008
  container.removeAttribute("v-cloak");
@@ -13950,9 +14236,11 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
13950
14236
  useAttrs: useAttrs,
13951
14237
  useCssModule: useCssModule,
13952
14238
  useCssVars: useCssVars,
14239
+ useHost: useHost,
13953
14240
  useId: useId,
13954
14241
  useModel: useModel,
13955
14242
  useSSRContext: useSSRContext,
14243
+ useShadowRoot: useShadowRoot,
13956
14244
  useSlots: useSlots,
13957
14245
  useTemplateRef: useTemplateRef,
13958
14246
  useTransitionState: useTransitionState,
@@ -13999,36 +14287,70 @@ const FRAGMENT = Symbol(`Fragment` );
13999
14287
  const TELEPORT = Symbol(`Teleport` );
14000
14288
  const SUSPENSE = Symbol(`Suspense` );
14001
14289
  const KEEP_ALIVE = Symbol(`KeepAlive` );
14002
- const BASE_TRANSITION = Symbol(`BaseTransition` );
14290
+ const BASE_TRANSITION = Symbol(
14291
+ `BaseTransition`
14292
+ );
14003
14293
  const OPEN_BLOCK = Symbol(`openBlock` );
14004
14294
  const CREATE_BLOCK = Symbol(`createBlock` );
14005
- const CREATE_ELEMENT_BLOCK = Symbol(`createElementBlock` );
14295
+ const CREATE_ELEMENT_BLOCK = Symbol(
14296
+ `createElementBlock`
14297
+ );
14006
14298
  const CREATE_VNODE = Symbol(`createVNode` );
14007
- const CREATE_ELEMENT_VNODE = Symbol(`createElementVNode` );
14008
- const CREATE_COMMENT = Symbol(`createCommentVNode` );
14009
- const CREATE_TEXT = Symbol(`createTextVNode` );
14010
- const CREATE_STATIC = Symbol(`createStaticVNode` );
14011
- const RESOLVE_COMPONENT = Symbol(`resolveComponent` );
14299
+ const CREATE_ELEMENT_VNODE = Symbol(
14300
+ `createElementVNode`
14301
+ );
14302
+ const CREATE_COMMENT = Symbol(
14303
+ `createCommentVNode`
14304
+ );
14305
+ const CREATE_TEXT = Symbol(
14306
+ `createTextVNode`
14307
+ );
14308
+ const CREATE_STATIC = Symbol(
14309
+ `createStaticVNode`
14310
+ );
14311
+ const RESOLVE_COMPONENT = Symbol(
14312
+ `resolveComponent`
14313
+ );
14012
14314
  const RESOLVE_DYNAMIC_COMPONENT = Symbol(
14013
14315
  `resolveDynamicComponent`
14014
14316
  );
14015
- const RESOLVE_DIRECTIVE = Symbol(`resolveDirective` );
14016
- const RESOLVE_FILTER = Symbol(`resolveFilter` );
14017
- const WITH_DIRECTIVES = Symbol(`withDirectives` );
14317
+ const RESOLVE_DIRECTIVE = Symbol(
14318
+ `resolveDirective`
14319
+ );
14320
+ const RESOLVE_FILTER = Symbol(
14321
+ `resolveFilter`
14322
+ );
14323
+ const WITH_DIRECTIVES = Symbol(
14324
+ `withDirectives`
14325
+ );
14018
14326
  const RENDER_LIST = Symbol(`renderList` );
14019
14327
  const RENDER_SLOT = Symbol(`renderSlot` );
14020
14328
  const CREATE_SLOTS = Symbol(`createSlots` );
14021
- const TO_DISPLAY_STRING = Symbol(`toDisplayString` );
14329
+ const TO_DISPLAY_STRING = Symbol(
14330
+ `toDisplayString`
14331
+ );
14022
14332
  const MERGE_PROPS = Symbol(`mergeProps` );
14023
- const NORMALIZE_CLASS = Symbol(`normalizeClass` );
14024
- const NORMALIZE_STYLE = Symbol(`normalizeStyle` );
14025
- const NORMALIZE_PROPS = Symbol(`normalizeProps` );
14026
- const GUARD_REACTIVE_PROPS = Symbol(`guardReactiveProps` );
14333
+ const NORMALIZE_CLASS = Symbol(
14334
+ `normalizeClass`
14335
+ );
14336
+ const NORMALIZE_STYLE = Symbol(
14337
+ `normalizeStyle`
14338
+ );
14339
+ const NORMALIZE_PROPS = Symbol(
14340
+ `normalizeProps`
14341
+ );
14342
+ const GUARD_REACTIVE_PROPS = Symbol(
14343
+ `guardReactiveProps`
14344
+ );
14027
14345
  const TO_HANDLERS = Symbol(`toHandlers` );
14028
14346
  const CAMELIZE = Symbol(`camelize` );
14029
14347
  const CAPITALIZE = Symbol(`capitalize` );
14030
- const TO_HANDLER_KEY = Symbol(`toHandlerKey` );
14031
- const SET_BLOCK_TRACKING = Symbol(`setBlockTracking` );
14348
+ const TO_HANDLER_KEY = Symbol(
14349
+ `toHandlerKey`
14350
+ );
14351
+ const SET_BLOCK_TRACKING = Symbol(
14352
+ `setBlockTracking`
14353
+ );
14032
14354
  const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
14033
14355
  const POP_SCOPE_ID = Symbol(`popScopeId` );
14034
14356
  const WITH_CTX = Symbol(`withCtx` );
@@ -15272,6 +15594,16 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
15272
15594
  (id) => markScopeIdentifier(node, id, knownIds)
15273
15595
  );
15274
15596
  }
15597
+ } else if (node.type === "CatchClause" && node.param) {
15598
+ for (const id of extractIdentifiers(node.param)) {
15599
+ markScopeIdentifier(node, id, knownIds);
15600
+ }
15601
+ } else if (isForStatement(node)) {
15602
+ walkForStatement(
15603
+ node,
15604
+ false,
15605
+ (id) => markScopeIdentifier(node, id, knownIds)
15606
+ );
15275
15607
  }
15276
15608
  },
15277
15609
  leave(node, parent) {
@@ -15352,14 +15684,20 @@ function walkBlockDeclarations(block, onIdent) {
15352
15684
  } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
15353
15685
  if (stmt.declare || !stmt.id) continue;
15354
15686
  onIdent(stmt.id);
15355
- } else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
15356
- const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
15357
- if (variable && variable.type === "VariableDeclaration") {
15358
- for (const decl of variable.declarations) {
15359
- for (const id of extractIdentifiers(decl.id)) {
15360
- onIdent(id);
15361
- }
15362
- }
15687
+ } else if (isForStatement(stmt)) {
15688
+ walkForStatement(stmt, true, onIdent);
15689
+ }
15690
+ }
15691
+ }
15692
+ function isForStatement(stmt) {
15693
+ return stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement";
15694
+ }
15695
+ function walkForStatement(stmt, isVar, onIdent) {
15696
+ const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
15697
+ if (variable && variable.type === "VariableDeclaration" && (variable.kind === "var" ? isVar : !isVar)) {
15698
+ for (const decl of variable.declarations) {
15699
+ for (const id of extractIdentifiers(decl.id)) {
15700
+ onIdent(id);
15363
15701
  }
15364
15702
  }
15365
15703
  }
@@ -19075,7 +19413,7 @@ function resolveComponentType(node, context, ssr = false) {
19075
19413
  } else {
19076
19414
  exp = isProp.exp;
19077
19415
  if (!exp) {
19078
- exp = createSimpleExpression(`is`, false, isProp.loc);
19416
+ exp = createSimpleExpression(`is`, false, isProp.arg.loc);
19079
19417
  {
19080
19418
  exp = isProp.exp = processExpression(exp, context);
19081
19419
  }
@@ -20173,15 +20511,27 @@ function baseCompile(source, options = {}) {
20173
20511
  const noopDirectiveTransform = () => ({ props: [] });
20174
20512
 
20175
20513
  const V_MODEL_RADIO = Symbol(`vModelRadio` );
20176
- const V_MODEL_CHECKBOX = Symbol(`vModelCheckbox` );
20514
+ const V_MODEL_CHECKBOX = Symbol(
20515
+ `vModelCheckbox`
20516
+ );
20177
20517
  const V_MODEL_TEXT = Symbol(`vModelText` );
20178
- const V_MODEL_SELECT = Symbol(`vModelSelect` );
20179
- const V_MODEL_DYNAMIC = Symbol(`vModelDynamic` );
20180
- const V_ON_WITH_MODIFIERS = Symbol(`vOnModifiersGuard` );
20181
- const V_ON_WITH_KEYS = Symbol(`vOnKeysGuard` );
20518
+ const V_MODEL_SELECT = Symbol(
20519
+ `vModelSelect`
20520
+ );
20521
+ const V_MODEL_DYNAMIC = Symbol(
20522
+ `vModelDynamic`
20523
+ );
20524
+ const V_ON_WITH_MODIFIERS = Symbol(
20525
+ `vOnModifiersGuard`
20526
+ );
20527
+ const V_ON_WITH_KEYS = Symbol(
20528
+ `vOnKeysGuard`
20529
+ );
20182
20530
  const V_SHOW = Symbol(`vShow` );
20183
20531
  const TRANSITION = Symbol(`Transition` );
20184
- const TRANSITION_GROUP = Symbol(`TransitionGroup` );
20532
+ const TRANSITION_GROUP = Symbol(
20533
+ `TransitionGroup`
20534
+ );
20185
20535
  registerRuntimeHelpers({
20186
20536
  [V_MODEL_RADIO]: `vModelRadio`,
20187
20537
  [V_MODEL_CHECKBOX]: `vModelCheckbox`,