@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
  **/
@@ -64,9 +64,11 @@ var Vue = (function () {
64
64
  };
65
65
  };
66
66
  const camelizeRE = /-(\w)/g;
67
- const camelize = cacheStringFunction((str) => {
68
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
69
- });
67
+ const camelize = cacheStringFunction(
68
+ (str) => {
69
+ return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
70
+ }
71
+ );
70
72
  const hyphenateRE = /\B([A-Z])/g;
71
73
  const hyphenate = cacheStringFunction(
72
74
  (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
@@ -74,10 +76,12 @@ var Vue = (function () {
74
76
  const capitalize = cacheStringFunction((str) => {
75
77
  return str.charAt(0).toUpperCase() + str.slice(1);
76
78
  });
77
- const toHandlerKey = cacheStringFunction((str) => {
78
- const s = str ? `on${capitalize(str)}` : ``;
79
- return s;
80
- });
79
+ const toHandlerKey = cacheStringFunction(
80
+ (str) => {
81
+ const s = str ? `on${capitalize(str)}` : ``;
82
+ return s;
83
+ }
84
+ );
81
85
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
82
86
  const invokeArrayFns = (fns, ...arg) => {
83
87
  for (let i = 0; i < fns.length; i++) {
@@ -322,6 +326,7 @@ var Vue = (function () {
322
326
  * @internal
323
327
  */
324
328
  this.cleanups = [];
329
+ this._isPaused = false;
325
330
  this.parent = activeEffectScope;
326
331
  if (!detached && activeEffectScope) {
327
332
  this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
@@ -332,6 +337,37 @@ var Vue = (function () {
332
337
  get active() {
333
338
  return this._active;
334
339
  }
340
+ pause() {
341
+ if (this._active) {
342
+ this._isPaused = true;
343
+ if (this.scopes) {
344
+ for (let i = 0, l = this.scopes.length; i < l; i++) {
345
+ this.scopes[i].pause();
346
+ }
347
+ }
348
+ for (let i = 0, l = this.effects.length; i < l; i++) {
349
+ this.effects[i].pause();
350
+ }
351
+ }
352
+ }
353
+ /**
354
+ * Resumes the effect scope, including all child scopes and effects.
355
+ */
356
+ resume() {
357
+ if (this._active) {
358
+ if (this._isPaused) {
359
+ this._isPaused = false;
360
+ if (this.scopes) {
361
+ for (let i = 0, l = this.scopes.length; i < l; i++) {
362
+ this.scopes[i].resume();
363
+ }
364
+ }
365
+ for (let i = 0, l = this.effects.length; i < l; i++) {
366
+ this.effects[i].resume();
367
+ }
368
+ }
369
+ }
370
+ }
335
371
  run(fn) {
336
372
  if (this._active) {
337
373
  const currentEffectScope = activeEffectScope;
@@ -402,6 +438,7 @@ var Vue = (function () {
402
438
  }
403
439
 
404
440
  let activeSub;
441
+ const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
405
442
  class ReactiveEffect {
406
443
  constructor(fn) {
407
444
  this.fn = fn;
@@ -430,6 +467,18 @@ var Vue = (function () {
430
467
  activeEffectScope.effects.push(this);
431
468
  }
432
469
  }
470
+ pause() {
471
+ this.flags |= 64;
472
+ }
473
+ resume() {
474
+ if (this.flags & 64) {
475
+ this.flags &= ~64;
476
+ if (pausedQueueEffects.has(this)) {
477
+ pausedQueueEffects.delete(this);
478
+ this.trigger();
479
+ }
480
+ }
481
+ }
433
482
  /**
434
483
  * @internal
435
484
  */
@@ -437,9 +486,6 @@ var Vue = (function () {
437
486
  if (this.flags & 2 && !(this.flags & 32)) {
438
487
  return;
439
488
  }
440
- if (this.flags & 64) {
441
- return this.trigger();
442
- }
443
489
  if (!(this.flags & 8)) {
444
490
  this.flags |= 8;
445
491
  this.nextEffect = batchedEffect;
@@ -483,7 +529,9 @@ var Vue = (function () {
483
529
  }
484
530
  }
485
531
  trigger() {
486
- if (this.scheduler) {
532
+ if (this.flags & 64) {
533
+ pausedQueueEffects.add(this);
534
+ } else if (this.scheduler) {
487
535
  this.scheduler();
488
536
  } else {
489
537
  this.runIfDirty();
@@ -511,6 +559,7 @@ var Vue = (function () {
511
559
  batchDepth--;
512
560
  return;
513
561
  }
562
+ batchDepth--;
514
563
  let error;
515
564
  while (batchedEffect) {
516
565
  let e = batchedEffect;
@@ -529,7 +578,6 @@ var Vue = (function () {
529
578
  e = next;
530
579
  }
531
580
  }
532
- batchDepth--;
533
581
  if (error) throw error;
534
582
  }
535
583
  function prepareDeps(sub) {
@@ -803,9 +851,15 @@ var Vue = (function () {
803
851
  link.dep.subs = link;
804
852
  }
805
853
  const targetMap = /* @__PURE__ */ new WeakMap();
806
- const ITERATE_KEY = Symbol("Object iterate" );
807
- const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
808
- const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
854
+ const ITERATE_KEY = Symbol(
855
+ "Object iterate"
856
+ );
857
+ const MAP_KEY_ITERATE_KEY = Symbol(
858
+ "Map keys iterate"
859
+ );
860
+ const ARRAY_ITERATE_KEY = Symbol(
861
+ "Array iterate"
862
+ );
809
863
  function track(target, type, key) {
810
864
  if (shouldTrack && activeSub) {
811
865
  let depsMap = targetMap.get(target);
@@ -926,26 +980,26 @@ var Vue = (function () {
926
980
  });
927
981
  },
928
982
  every(fn, thisArg) {
929
- return apply(this, "every", fn, thisArg);
983
+ return apply(this, "every", fn, thisArg, void 0, arguments);
930
984
  },
931
985
  filter(fn, thisArg) {
932
- return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive));
986
+ return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
933
987
  },
934
988
  find(fn, thisArg) {
935
- return apply(this, "find", fn, thisArg, toReactive);
989
+ return apply(this, "find", fn, thisArg, toReactive, arguments);
936
990
  },
937
991
  findIndex(fn, thisArg) {
938
- return apply(this, "findIndex", fn, thisArg);
992
+ return apply(this, "findIndex", fn, thisArg, void 0, arguments);
939
993
  },
940
994
  findLast(fn, thisArg) {
941
- return apply(this, "findLast", fn, thisArg, toReactive);
995
+ return apply(this, "findLast", fn, thisArg, toReactive, arguments);
942
996
  },
943
997
  findLastIndex(fn, thisArg) {
944
- return apply(this, "findLastIndex", fn, thisArg);
998
+ return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
945
999
  },
946
1000
  // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
947
1001
  forEach(fn, thisArg) {
948
- return apply(this, "forEach", fn, thisArg);
1002
+ return apply(this, "forEach", fn, thisArg, void 0, arguments);
949
1003
  },
950
1004
  includes(...args) {
951
1005
  return searchProxy(this, "includes", args);
@@ -961,7 +1015,7 @@ var Vue = (function () {
961
1015
  return searchProxy(this, "lastIndexOf", args);
962
1016
  },
963
1017
  map(fn, thisArg) {
964
- return apply(this, "map", fn, thisArg);
1018
+ return apply(this, "map", fn, thisArg, void 0, arguments);
965
1019
  },
966
1020
  pop() {
967
1021
  return noTracking(this, "pop");
@@ -980,7 +1034,7 @@ var Vue = (function () {
980
1034
  },
981
1035
  // slice could use ARRAY_ITERATE but also seems to beg for range tracking
982
1036
  some(fn, thisArg) {
983
- return apply(this, "some", fn, thisArg);
1037
+ return apply(this, "some", fn, thisArg, void 0, arguments);
984
1038
  },
985
1039
  splice(...args) {
986
1040
  return noTracking(this, "splice", args);
@@ -1016,8 +1070,13 @@ var Vue = (function () {
1016
1070
  }
1017
1071
  return iter;
1018
1072
  }
1019
- function apply(self, method, fn, thisArg, wrappedRetFn) {
1073
+ const arrayProto = Array.prototype;
1074
+ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1020
1075
  const arr = shallowReadArray(self);
1076
+ let methodFn;
1077
+ if ((methodFn = arr[method]) !== arrayProto[method]) {
1078
+ return methodFn.apply(arr, args);
1079
+ }
1021
1080
  let needsWrap = false;
1022
1081
  let wrappedFn = fn;
1023
1082
  if (arr !== self) {
@@ -1032,7 +1091,7 @@ var Vue = (function () {
1032
1091
  };
1033
1092
  }
1034
1093
  }
1035
- const result = arr[method](wrappedFn, thisArg);
1094
+ const result = methodFn.call(arr, wrappedFn, thisArg);
1036
1095
  return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
1037
1096
  }
1038
1097
  function reduce(self, method, fn, args) {
@@ -1095,7 +1154,7 @@ var Vue = (function () {
1095
1154
  return isShallow2;
1096
1155
  } else if (key === "__v_raw") {
1097
1156
  if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
1098
- // this means the reciever is a user proxy of the reactive proxy
1157
+ // this means the receiver is a user proxy of the reactive proxy
1099
1158
  Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
1100
1159
  return target;
1101
1160
  }
@@ -1219,9 +1278,7 @@ var Vue = (function () {
1219
1278
  }
1220
1279
  const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
1221
1280
  const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
1222
- const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
1223
- true
1224
- );
1281
+ const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
1225
1282
  const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
1226
1283
 
1227
1284
  const toShallow = (value) => value;
@@ -1716,13 +1773,14 @@ var Vue = (function () {
1716
1773
  class CustomRefImpl {
1717
1774
  constructor(factory) {
1718
1775
  this["__v_isRef"] = true;
1776
+ this._value = void 0;
1719
1777
  const dep = this.dep = new Dep();
1720
1778
  const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
1721
1779
  this._get = get;
1722
1780
  this._set = set;
1723
1781
  }
1724
1782
  get value() {
1725
- return this._get();
1783
+ return this._value = this._get();
1726
1784
  }
1727
1785
  set value(newVal) {
1728
1786
  this._set(newVal);
@@ -1747,10 +1805,11 @@ var Vue = (function () {
1747
1805
  this._key = _key;
1748
1806
  this._defaultValue = _defaultValue;
1749
1807
  this["__v_isRef"] = true;
1808
+ this._value = void 0;
1750
1809
  }
1751
1810
  get value() {
1752
1811
  const val = this._object[this._key];
1753
- return val === void 0 ? this._defaultValue : val;
1812
+ return this._value = val === void 0 ? this._defaultValue : val;
1754
1813
  }
1755
1814
  set value(newVal) {
1756
1815
  this._object[this._key] = newVal;
@@ -1764,9 +1823,10 @@ var Vue = (function () {
1764
1823
  this._getter = _getter;
1765
1824
  this["__v_isRef"] = true;
1766
1825
  this["__v_isReadonly"] = true;
1826
+ this._value = void 0;
1767
1827
  }
1768
1828
  get value() {
1769
- return this._getter();
1829
+ return this._value = this._getter();
1770
1830
  }
1771
1831
  }
1772
1832
  function toRef(source, key, defaultValue) {
@@ -1800,7 +1860,8 @@ var Vue = (function () {
1800
1860
  /**
1801
1861
  * @internal
1802
1862
  */
1803
- this["__v_isRef"] = true;
1863
+ this.__v_isRef = true;
1864
+ // TODO isolatedDeclarations "__v_isReadonly"
1804
1865
  // A computed is also a subscriber that tracks other deps
1805
1866
  /**
1806
1867
  * @internal
@@ -2425,6 +2486,9 @@ var Vue = (function () {
2425
2486
  "[HMR] Root or manually mounted instance modified. Full reload required."
2426
2487
  );
2427
2488
  }
2489
+ if (instance.root.ce && instance !== instance.root) {
2490
+ instance.root.ce._removeChildStyle(oldComp);
2491
+ }
2428
2492
  }
2429
2493
  queuePostFlushCb(() => {
2430
2494
  hmrDirtyComponents.clear();
@@ -2504,9 +2568,7 @@ var Vue = (function () {
2504
2568
  function devtoolsUnmountApp(app) {
2505
2569
  emit$2("app:unmount" /* APP_UNMOUNT */, app);
2506
2570
  }
2507
- const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
2508
- "component:added" /* COMPONENT_ADDED */
2509
- );
2571
+ const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
2510
2572
  const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
2511
2573
  const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
2512
2574
  "component:removed" /* COMPONENT_REMOVED */
@@ -2530,12 +2592,8 @@ var Vue = (function () {
2530
2592
  );
2531
2593
  };
2532
2594
  }
2533
- const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
2534
- "perf:start" /* PERFORMANCE_START */
2535
- );
2536
- const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
2537
- "perf:end" /* PERFORMANCE_END */
2538
- );
2595
+ const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
2596
+ const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
2539
2597
  function createDevtoolsPerformanceHook(hook) {
2540
2598
  return (component, type, time) => {
2541
2599
  emit$2(hook, component.appContext.app, component.uid, component, type, time);
@@ -3969,6 +4027,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3969
4027
  const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
3970
4028
  const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
3971
4029
  const getContainerType = (container) => {
4030
+ if (container.nodeType !== 1) return void 0;
3972
4031
  if (isSVGContainer(container)) return "svg";
3973
4032
  if (isMathMLContainer(container)) return "mathml";
3974
4033
  return void 0;
@@ -4244,6 +4303,7 @@ Server rendered element contains more child nodes than client vdom.`
4244
4303
  }
4245
4304
  if (props) {
4246
4305
  {
4306
+ const isCustomElement = el.tagName.includes("-");
4247
4307
  for (const key in props) {
4248
4308
  if (// #11189 skip if this node has directives that have created hooks
4249
4309
  // as it could have mutated the DOM in any possible way
@@ -4251,7 +4311,7 @@ Server rendered element contains more child nodes than client vdom.`
4251
4311
  logMismatchError();
4252
4312
  }
4253
4313
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4254
- key[0] === ".") {
4314
+ key[0] === "." || isCustomElement) {
4255
4315
  patchProp(el, key, null, props[key], void 0, parentComponent);
4256
4316
  }
4257
4317
  }
@@ -4576,24 +4636,19 @@ Server rendered element contains fewer child nodes than client vdom.`
4576
4636
  }
4577
4637
  }
4578
4638
 
4579
- const hydrateOnIdle = () => (hydrate) => {
4580
- const id = requestIdleCallback(hydrate);
4639
+ const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
4640
+ const id = requestIdleCallback(hydrate, { timeout });
4581
4641
  return () => cancelIdleCallback(id);
4582
4642
  };
4583
- const hydrateOnVisible = (margin = 0) => (hydrate, forEach) => {
4584
- const ob = new IntersectionObserver(
4585
- (entries) => {
4586
- for (const e of entries) {
4587
- if (!e.isIntersecting) continue;
4588
- ob.disconnect();
4589
- hydrate();
4590
- break;
4591
- }
4592
- },
4593
- {
4594
- rootMargin: isString(margin) ? margin : margin + "px"
4643
+ const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4644
+ const ob = new IntersectionObserver((entries) => {
4645
+ for (const e of entries) {
4646
+ if (!e.isIntersecting) continue;
4647
+ ob.disconnect();
4648
+ hydrate();
4649
+ break;
4595
4650
  }
4596
- );
4651
+ }, opts);
4597
4652
  forEach((el) => ob.observe(el));
4598
4653
  return () => ob.disconnect();
4599
4654
  };
@@ -4895,14 +4950,14 @@ Server rendered element contains fewer child nodes than client vdom.`
4895
4950
  function pruneCache(filter) {
4896
4951
  cache.forEach((vnode, key) => {
4897
4952
  const name = getComponentName(vnode.type);
4898
- if (name && (!filter || !filter(name))) {
4953
+ if (name && !filter(name)) {
4899
4954
  pruneCacheEntry(key);
4900
4955
  }
4901
4956
  });
4902
4957
  }
4903
4958
  function pruneCacheEntry(key) {
4904
4959
  const cached = cache.get(key);
4905
- if (!current || !isSameVNodeType(cached, current)) {
4960
+ if (cached && (!current || !isSameVNodeType(cached, current))) {
4906
4961
  unmount(cached);
4907
4962
  } else if (current) {
4908
4963
  resetShapeFlag(current);
@@ -4964,6 +5019,10 @@ Server rendered element contains fewer child nodes than client vdom.`
4964
5019
  return rawVNode;
4965
5020
  }
4966
5021
  let vnode = getInnerChild(rawVNode);
5022
+ if (vnode.type === Comment) {
5023
+ current = null;
5024
+ return vnode;
5025
+ }
4967
5026
  const comp = vnode.type;
4968
5027
  const name = getComponentName(
4969
5028
  isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
@@ -5013,6 +5072,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5013
5072
  } else if (isString(pattern)) {
5014
5073
  return pattern.split(",").includes(name);
5015
5074
  } else if (isRegExp(pattern)) {
5075
+ pattern.lastIndex = 0;
5016
5076
  return pattern.test(name);
5017
5077
  }
5018
5078
  return false;
@@ -5096,17 +5156,19 @@ Server rendered element contains fewer child nodes than client vdom.`
5096
5156
  };
5097
5157
  const onBeforeMount = createHook("bm");
5098
5158
  const onMounted = createHook("m");
5099
- const onBeforeUpdate = createHook("bu");
5159
+ const onBeforeUpdate = createHook(
5160
+ "bu"
5161
+ );
5100
5162
  const onUpdated = createHook("u");
5101
- const onBeforeUnmount = createHook("bum");
5102
- const onUnmounted = createHook("um");
5103
- const onServerPrefetch = createHook("sp");
5104
- const onRenderTriggered = createHook(
5105
- "rtg"
5163
+ const onBeforeUnmount = createHook(
5164
+ "bum"
5106
5165
  );
5107
- const onRenderTracked = createHook(
5108
- "rtc"
5166
+ const onUnmounted = createHook("um");
5167
+ const onServerPrefetch = createHook(
5168
+ "sp"
5109
5169
  );
5170
+ const onRenderTriggered = createHook("rtg");
5171
+ const onRenderTracked = createHook("rtc");
5110
5172
  function onErrorCaptured(hook, target = currentInstance) {
5111
5173
  injectHook("ec", hook, target);
5112
5174
  }
@@ -5520,9 +5582,14 @@ If this is a native custom element, make sure to exclude it from component resol
5520
5582
  }
5521
5583
 
5522
5584
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5523
- if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
5585
+ if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5524
5586
  if (name !== "default") props.name = name;
5525
- return createVNode("slot", props, fallback && fallback());
5587
+ return openBlock(), createBlock(
5588
+ Fragment,
5589
+ null,
5590
+ [createVNode("slot", props, fallback && fallback())],
5591
+ 64
5592
+ );
5526
5593
  }
5527
5594
  let slot = slots[name];
5528
5595
  if (slot && slot.length > 1) {
@@ -5824,6 +5891,7 @@ If this is a native custom element, make sure to exclude it from component resol
5824
5891
  $refs: (i) => shallowReadonly(i.refs) ,
5825
5892
  $parent: (i) => getPublicInstance(i.parent),
5826
5893
  $root: (i) => getPublicInstance(i.root),
5894
+ $host: (i) => i.ce,
5827
5895
  $emit: (i) => i.emit,
5828
5896
  $options: (i) => resolveMergedOptions(i) ,
5829
5897
  $forceUpdate: (i) => i.f || (i.f = () => {
@@ -5984,29 +6052,25 @@ If this is a native custom element, make sure to exclude it from component resol
5984
6052
  return Reflect.ownKeys(target);
5985
6053
  };
5986
6054
  }
5987
- const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
5988
- {},
5989
- PublicInstanceProxyHandlers,
5990
- {
5991
- get(target, key) {
5992
- if (key === Symbol.unscopables) {
5993
- return;
5994
- }
5995
- return PublicInstanceProxyHandlers.get(target, key, target);
5996
- },
5997
- has(_, key) {
5998
- const has = key[0] !== "_" && !isGloballyAllowed(key);
5999
- if (!has && PublicInstanceProxyHandlers.has(_, key)) {
6000
- warn$1(
6001
- `Property ${JSON.stringify(
6002
- key
6003
- )} should not start with _ which is a reserved prefix for Vue internals.`
6004
- );
6005
- }
6006
- return has;
6055
+ const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, {
6056
+ get(target, key) {
6057
+ if (key === Symbol.unscopables) {
6058
+ return;
6059
+ }
6060
+ return PublicInstanceProxyHandlers.get(target, key, target);
6061
+ },
6062
+ has(_, key) {
6063
+ const has = key[0] !== "_" && !isGloballyAllowed(key);
6064
+ if (!has && PublicInstanceProxyHandlers.has(_, key)) {
6065
+ warn$1(
6066
+ `Property ${JSON.stringify(
6067
+ key
6068
+ )} should not start with _ which is a reserved prefix for Vue internals.`
6069
+ );
6007
6070
  }
6071
+ return has;
6008
6072
  }
6009
- );
6073
+ });
6010
6074
  function createDevRenderContext(instance) {
6011
6075
  const target = {};
6012
6076
  Object.defineProperty(target, `_`, {
@@ -6690,7 +6754,7 @@ If this is a native custom element, make sure to exclude it from component resol
6690
6754
  return vm;
6691
6755
  }
6692
6756
  }
6693
- Vue.version = `2.6.14-compat:${"3.5.0-alpha.5"}`;
6757
+ Vue.version = `2.6.14-compat:${"3.5.0-beta.2"}`;
6694
6758
  Vue.config = singletonApp.config;
6695
6759
  Vue.use = (plugin, ...options) => {
6696
6760
  if (plugin && isFunction(plugin.install)) {
@@ -6963,7 +7027,7 @@ If this is a native custom element, make sure to exclude it from component resol
6963
7027
  /* skip options */
6964
7028
  );
6965
7029
  }
6966
- container.innerHTML = "";
7030
+ container.textContent = "";
6967
7031
  render(vnode, container, namespace);
6968
7032
  if (container instanceof Element) {
6969
7033
  container.removeAttribute("v-cloak");
@@ -7175,7 +7239,7 @@ If this is a native custom element, make sure to exclude it from component resol
7175
7239
  If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
7176
7240
  );
7177
7241
  }
7178
- const vnode = createVNode(rootComponent, rootProps);
7242
+ const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
7179
7243
  vnode.appContext = context;
7180
7244
  if (namespace === true) {
7181
7245
  namespace = "svg";
@@ -7280,7 +7344,7 @@ If you want to remount the same app, move your app creation logic into a factory
7280
7344
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
7281
7345
  const instance = currentInstance || currentRenderingInstance;
7282
7346
  if (instance || currentApp) {
7283
- const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
7347
+ const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
7284
7348
  if (provides && key in provides) {
7285
7349
  return provides[key];
7286
7350
  } else if (arguments.length > 1) {
@@ -7554,6 +7618,9 @@ If you want to remount the same app, move your app creation logic into a factory
7554
7618
  } else {
7555
7619
  value = defaultValue;
7556
7620
  }
7621
+ if (instance.ce) {
7622
+ instance.ce._setProp(key, value);
7623
+ }
7557
7624
  }
7558
7625
  if (opt[0 /* shouldCast */]) {
7559
7626
  if (isAbsent && !hasDefault) {
@@ -8556,8 +8623,8 @@ If you want to remount the same app, move your app creation logic into a factory
8556
8623
  const componentUpdateFn = () => {
8557
8624
  if (!instance.isMounted) {
8558
8625
  let vnodeHook;
8559
- const { el, props, type } = initialVNode;
8560
- const { bm, m, parent } = instance;
8626
+ const { el, props } = initialVNode;
8627
+ const { bm, m, parent, root, type } = instance;
8561
8628
  const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
8562
8629
  toggleRecurse(instance, false);
8563
8630
  if (bm) {
@@ -8603,6 +8670,9 @@ If you want to remount the same app, move your app creation logic into a factory
8603
8670
  hydrateSubTree();
8604
8671
  }
8605
8672
  } else {
8673
+ if (root.ce) {
8674
+ root.ce._injectChildStyle(type);
8675
+ }
8606
8676
  {
8607
8677
  startMeasure(instance, `render`);
8608
8678
  }
@@ -9306,13 +9376,13 @@ If you want to remount the same app, move your app creation logic into a factory
9306
9376
  namespace
9307
9377
  );
9308
9378
  }
9379
+ container._vnode = vnode;
9309
9380
  if (!isFlushing) {
9310
9381
  isFlushing = true;
9311
9382
  flushPreFlushCbs();
9312
9383
  flushPostFlushCbs();
9313
9384
  isFlushing = false;
9314
9385
  }
9315
- container._vnode = vnode;
9316
9386
  };
9317
9387
  const internals = {
9318
9388
  p: patch,
@@ -9480,14 +9550,9 @@ If you want to remount the same app, move your app creation logic into a factory
9480
9550
  const _cb = cb;
9481
9551
  cb = (...args) => {
9482
9552
  _cb(...args);
9483
- unwatch();
9553
+ watchHandle();
9484
9554
  };
9485
9555
  }
9486
- if (deep !== void 0 && typeof deep === "number") {
9487
- warn$1(
9488
- `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
9489
- );
9490
- }
9491
9556
  if (!cb) {
9492
9557
  if (immediate !== void 0) {
9493
9558
  warn$1(
@@ -9513,10 +9578,12 @@ If you want to remount the same app, move your app creation logic into a factory
9513
9578
  );
9514
9579
  };
9515
9580
  const instance = currentInstance;
9516
- const reactiveGetter = (source2) => deep === true ? source2 : (
9517
- // for deep: false, only traverse root-level properties
9518
- traverse(source2, deep === false ? 1 : void 0)
9519
- );
9581
+ const reactiveGetter = (source2) => {
9582
+ if (deep) return source2;
9583
+ if (isShallow(source2) || deep === false || deep === 0)
9584
+ return traverse(source2, 1);
9585
+ return traverse(source2);
9586
+ };
9520
9587
  let getter;
9521
9588
  let forceTrigger = false;
9522
9589
  let isMultiSource = false;
@@ -9572,7 +9639,8 @@ If you want to remount the same app, move your app creation logic into a factory
9572
9639
  }
9573
9640
  if (cb && deep) {
9574
9641
  const baseGetter = getter;
9575
- getter = () => traverse(baseGetter());
9642
+ const depth = deep === true ? Infinity : deep;
9643
+ getter = () => traverse(baseGetter(), depth);
9576
9644
  }
9577
9645
  let cleanup;
9578
9646
  let onCleanup = (fn) => {
@@ -9608,7 +9676,6 @@ If you want to remount the same app, move your app creation logic into a factory
9608
9676
  const effect = new ReactiveEffect(getter);
9609
9677
  let scheduler;
9610
9678
  if (flush === "sync") {
9611
- effect.flags |= 64;
9612
9679
  scheduler = job;
9613
9680
  } else if (flush === "post") {
9614
9681
  scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
@@ -9619,12 +9686,15 @@ If you want to remount the same app, move your app creation logic into a factory
9619
9686
  }
9620
9687
  effect.scheduler = scheduler;
9621
9688
  const scope = getCurrentScope();
9622
- const unwatch = () => {
9689
+ const watchHandle = () => {
9623
9690
  effect.stop();
9624
9691
  if (scope) {
9625
9692
  remove(scope.effects, effect);
9626
9693
  }
9627
9694
  };
9695
+ watchHandle.pause = effect.pause.bind(effect);
9696
+ watchHandle.resume = effect.resume.bind(effect);
9697
+ watchHandle.stop = watchHandle;
9628
9698
  {
9629
9699
  effect.onTrack = onTrack;
9630
9700
  effect.onTrigger = onTrigger;
@@ -9643,7 +9713,7 @@ If you want to remount the same app, move your app creation logic into a factory
9643
9713
  } else {
9644
9714
  effect.run();
9645
9715
  }
9646
- return unwatch;
9716
+ return watchHandle;
9647
9717
  }
9648
9718
  function instanceWatch(source, value, options) {
9649
9719
  const publicThis = this.proxy;
@@ -9733,7 +9803,8 @@ If you want to remount the same app, move your app creation logic into a factory
9733
9803
  return options.get ? options.get(localValue) : localValue;
9734
9804
  },
9735
9805
  set(value) {
9736
- if (!hasChanged(value, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
9806
+ const emittedValue = options.set ? options.set(value) : value;
9807
+ if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
9737
9808
  return;
9738
9809
  }
9739
9810
  const rawProps = i.vnode.props;
@@ -9742,7 +9813,6 @@ If you want to remount the same app, move your app creation logic into a factory
9742
9813
  localValue = value;
9743
9814
  trigger();
9744
9815
  }
9745
- const emittedValue = options.set ? options.set(value) : value;
9746
9816
  i.emit(`update:${name}`, emittedValue);
9747
9817
  if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
9748
9818
  trigger();
@@ -9780,9 +9850,9 @@ If you want to remount the same app, move your app creation logic into a factory
9780
9850
  } = instance;
9781
9851
  if (emitsOptions) {
9782
9852
  if (!(event in emitsOptions) && !(event.startsWith("hook:") || event.startsWith(compatModelEventPrefix))) {
9783
- if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
9853
+ if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
9784
9854
  warn$1(
9785
- `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
9855
+ `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
9786
9856
  );
9787
9857
  }
9788
9858
  } else {
@@ -11699,11 +11769,16 @@ Component that was made reactive: `,
11699
11769
  const r = shallowRef(null);
11700
11770
  if (i) {
11701
11771
  const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
11702
- Object.defineProperty(refs, key, {
11703
- enumerable: true,
11704
- get: () => r.value,
11705
- set: (val) => r.value = val
11706
- });
11772
+ let desc;
11773
+ if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
11774
+ warn$1(`useTemplateRef('${key}') already exists.`);
11775
+ } else {
11776
+ Object.defineProperty(refs, key, {
11777
+ enumerable: true,
11778
+ get: () => r.value,
11779
+ set: (val) => r.value = val
11780
+ });
11781
+ }
11707
11782
  } else {
11708
11783
  warn$1(
11709
11784
  `useTemplateRef() is called when there is no active component instance to be associated with.`
@@ -11937,7 +12012,7 @@ Component that was made reactive: `,
11937
12012
  return true;
11938
12013
  }
11939
12014
 
11940
- const version = "3.5.0-alpha.5";
12015
+ const version = "3.5.0-beta.2";
11941
12016
  const warn = warn$1 ;
11942
12017
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11943
12018
  const devtools = devtools$1 ;
@@ -11954,6 +12029,18 @@ Component that was made reactive: `,
11954
12029
  const compatUtils = _compatUtils ;
11955
12030
  const DeprecationTypes = DeprecationTypes$1 ;
11956
12031
 
12032
+ let policy = void 0;
12033
+ const tt = typeof window !== "undefined" && window.trustedTypes;
12034
+ if (tt) {
12035
+ try {
12036
+ policy = /* @__PURE__ */ tt.createPolicy("vue", {
12037
+ createHTML: (val) => val
12038
+ });
12039
+ } catch (e) {
12040
+ warn(`Error creating trusted types policy: ${e}`);
12041
+ }
12042
+ }
12043
+ const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
11957
12044
  const svgNS = "http://www.w3.org/2000/svg";
11958
12045
  const mathmlNS = "http://www.w3.org/1998/Math/MathML";
11959
12046
  const doc = typeof document !== "undefined" ? document : null;
@@ -12001,7 +12088,9 @@ Component that was made reactive: `,
12001
12088
  if (start === end || !(start = start.nextSibling)) break;
12002
12089
  }
12003
12090
  } else {
12004
- templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
12091
+ templateContainer.innerHTML = unsafeToTrustedHTML(
12092
+ namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
12093
+ );
12005
12094
  const template = templateContainer.content;
12006
12095
  if (namespace === "svg" || namespace === "mathml") {
12007
12096
  const wrapper = template.firstChild;
@@ -12401,11 +12490,17 @@ Component that was made reactive: `,
12401
12490
  }
12402
12491
  const setVars = () => {
12403
12492
  const vars = getter(instance.proxy);
12404
- setVarsOnVNode(instance.subTree, vars);
12493
+ if (instance.ce) {
12494
+ setVarsOnNode(instance.ce, vars);
12495
+ } else {
12496
+ setVarsOnVNode(instance.subTree, vars);
12497
+ }
12405
12498
  updateTeleports(vars);
12406
12499
  };
12407
- onMounted(() => {
12500
+ onBeforeMount(() => {
12408
12501
  watchPostEffect(setVars);
12502
+ });
12503
+ onMounted(() => {
12409
12504
  const ob = new MutationObserver(setVars);
12410
12505
  ob.observe(instance.subTree.el.parentNode, { childList: true });
12411
12506
  onUnmounted(() => ob.disconnect());
@@ -12802,16 +12897,24 @@ Expected function or array of functions, received type ${typeof value}.`
12802
12897
  if (isNativeOn(key) && isString(value)) {
12803
12898
  return false;
12804
12899
  }
12805
- return key in el;
12900
+ if (key in el) {
12901
+ return true;
12902
+ }
12903
+ if (el._isVueCE && (/[A-Z]/.test(key) || !isString(value))) {
12904
+ return true;
12905
+ }
12906
+ return false;
12806
12907
  }
12807
12908
 
12909
+ const REMOVAL = {};
12808
12910
  /*! #__NO_SIDE_EFFECTS__ */
12809
12911
  // @__NO_SIDE_EFFECTS__
12810
- function defineCustomElement(options, extraOptions, hydrate2) {
12912
+ function defineCustomElement(options, extraOptions, _createApp) {
12811
12913
  const Comp = defineComponent(options, extraOptions);
12914
+ if (isPlainObject(Comp)) extend(Comp, extraOptions);
12812
12915
  class VueCustomElement extends VueElement {
12813
12916
  constructor(initialProps) {
12814
- super(Comp, initialProps, hydrate2);
12917
+ super(Comp, initialProps, _createApp);
12815
12918
  }
12816
12919
  }
12817
12920
  VueCustomElement.def = Comp;
@@ -12819,47 +12922,87 @@ Expected function or array of functions, received type ${typeof value}.`
12819
12922
  }
12820
12923
  /*! #__NO_SIDE_EFFECTS__ */
12821
12924
  const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
12822
- return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
12925
+ return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
12823
12926
  };
12824
12927
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
12825
12928
  };
12826
12929
  class VueElement extends BaseClass {
12827
- constructor(_def, _props = {}, hydrate2) {
12930
+ constructor(_def, _props = {}, _createApp = createApp) {
12828
12931
  super();
12829
12932
  this._def = _def;
12830
12933
  this._props = _props;
12934
+ this._createApp = _createApp;
12935
+ this._isVueCE = true;
12831
12936
  /**
12832
12937
  * @internal
12833
12938
  */
12834
12939
  this._instance = null;
12940
+ /**
12941
+ * @internal
12942
+ */
12943
+ this._app = null;
12944
+ /**
12945
+ * @internal
12946
+ */
12947
+ this._nonce = this._def.nonce;
12835
12948
  this._connected = false;
12836
12949
  this._resolved = false;
12837
12950
  this._numberProps = null;
12951
+ this._styleChildren = /* @__PURE__ */ new WeakSet();
12838
12952
  this._ob = null;
12839
- if (this.shadowRoot && hydrate2) {
12840
- hydrate2(this._createVNode(), this.shadowRoot);
12953
+ if (this.shadowRoot && _createApp !== createApp) {
12954
+ this._root = this.shadowRoot;
12841
12955
  } else {
12842
12956
  if (this.shadowRoot) {
12843
12957
  warn(
12844
12958
  `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
12845
12959
  );
12846
12960
  }
12847
- this.attachShadow({ mode: "open" });
12848
- if (!this._def.__asyncLoader) {
12849
- this._resolveProps(this._def);
12961
+ if (_def.shadowRoot !== false) {
12962
+ this.attachShadow({ mode: "open" });
12963
+ this._root = this.shadowRoot;
12964
+ } else {
12965
+ this._root = this;
12850
12966
  }
12851
12967
  }
12968
+ if (!this._def.__asyncLoader) {
12969
+ this._resolveProps(this._def);
12970
+ }
12852
12971
  }
12853
12972
  connectedCallback() {
12973
+ if (!this.shadowRoot) {
12974
+ this._parseSlots();
12975
+ }
12854
12976
  this._connected = true;
12977
+ let parent = this;
12978
+ while (parent = parent && (parent.parentNode || parent.host)) {
12979
+ if (parent instanceof VueElement) {
12980
+ this._parent = parent;
12981
+ break;
12982
+ }
12983
+ }
12855
12984
  if (!this._instance) {
12856
12985
  if (this._resolved) {
12986
+ this._setParent();
12857
12987
  this._update();
12858
12988
  } else {
12859
- this._resolveDef();
12989
+ if (parent && parent._pendingResolve) {
12990
+ this._pendingResolve = parent._pendingResolve.then(() => {
12991
+ this._pendingResolve = void 0;
12992
+ this._resolveDef();
12993
+ });
12994
+ } else {
12995
+ this._resolveDef();
12996
+ }
12860
12997
  }
12861
12998
  }
12862
12999
  }
13000
+ _setParent(parent = this._parent) {
13001
+ if (parent) {
13002
+ this._instance.parent = parent._instance;
13003
+ this._instance.provides = parent._instance.provides;
13004
+ }
13005
+ }
12863
13006
  disconnectedCallback() {
12864
13007
  this._connected = false;
12865
13008
  nextTick(() => {
@@ -12868,8 +13011,9 @@ Expected function or array of functions, received type ${typeof value}.`
12868
13011
  this._ob.disconnect();
12869
13012
  this._ob = null;
12870
13013
  }
12871
- render(null, this.shadowRoot);
12872
- this._instance = null;
13014
+ this._app && this._app.unmount();
13015
+ this._instance.ce = void 0;
13016
+ this._app = this._instance = null;
12873
13017
  }
12874
13018
  });
12875
13019
  }
@@ -12877,7 +13021,9 @@ Expected function or array of functions, received type ${typeof value}.`
12877
13021
  * resolve inner component definition (handle possible async component)
12878
13022
  */
12879
13023
  _resolveDef() {
12880
- this._resolved = true;
13024
+ if (this._pendingResolve) {
13025
+ return;
13026
+ }
12881
13027
  for (let i = 0; i < this.attributes.length; i++) {
12882
13028
  this._setAttr(this.attributes[i].name);
12883
13029
  }
@@ -12888,6 +13034,8 @@ Expected function or array of functions, received type ${typeof value}.`
12888
13034
  });
12889
13035
  this._ob.observe(this, { attributes: true });
12890
13036
  const resolve = (def, isAsync = false) => {
13037
+ this._resolved = true;
13038
+ this._pendingResolve = void 0;
12891
13039
  const { props, styles } = def;
12892
13040
  let numberProps;
12893
13041
  if (props && !isArray(props)) {
@@ -12905,22 +13053,53 @@ Expected function or array of functions, received type ${typeof value}.`
12905
13053
  if (isAsync) {
12906
13054
  this._resolveProps(def);
12907
13055
  }
12908
- this._applyStyles(styles);
12909
- this._update();
13056
+ if (this.shadowRoot) {
13057
+ this._applyStyles(styles);
13058
+ } else if (styles) {
13059
+ warn(
13060
+ "Custom element style injection is not supported when using shadowRoot: false"
13061
+ );
13062
+ }
13063
+ this._mount(def);
12910
13064
  };
12911
13065
  const asyncDef = this._def.__asyncLoader;
12912
13066
  if (asyncDef) {
12913
- asyncDef().then((def) => resolve(def, true));
13067
+ this._pendingResolve = asyncDef().then(
13068
+ (def) => resolve(this._def = def, true)
13069
+ );
12914
13070
  } else {
12915
13071
  resolve(this._def);
12916
13072
  }
12917
13073
  }
13074
+ _mount(def) {
13075
+ if (!def.name) {
13076
+ def.name = "VueElement";
13077
+ }
13078
+ this._app = this._createApp(def);
13079
+ if (def.configureApp) {
13080
+ def.configureApp(this._app);
13081
+ }
13082
+ this._app._ceVNode = this._createVNode();
13083
+ this._app.mount(this._root);
13084
+ const exposed = this._instance && this._instance.exposed;
13085
+ if (!exposed) return;
13086
+ for (const key in exposed) {
13087
+ if (!hasOwn(this, key)) {
13088
+ Object.defineProperty(this, key, {
13089
+ // unwrap ref to be consistent with public instance behavior
13090
+ get: () => unref(exposed[key])
13091
+ });
13092
+ } else {
13093
+ warn(`Exposed property "${key}" already exists on custom element.`);
13094
+ }
13095
+ }
13096
+ }
12918
13097
  _resolveProps(def) {
12919
13098
  const { props } = def;
12920
13099
  const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
12921
13100
  for (const key of Object.keys(this)) {
12922
13101
  if (key[0] !== "_" && declaredPropKeys.includes(key)) {
12923
- this._setProp(key, this[key], true, false);
13102
+ this._setProp(key, this[key]);
12924
13103
  }
12925
13104
  }
12926
13105
  for (const key of declaredPropKeys.map(camelize)) {
@@ -12929,18 +13108,20 @@ Expected function or array of functions, received type ${typeof value}.`
12929
13108
  return this._getProp(key);
12930
13109
  },
12931
13110
  set(val) {
12932
- this._setProp(key, val);
13111
+ this._setProp(key, val, true, true);
12933
13112
  }
12934
13113
  });
12935
13114
  }
12936
13115
  }
12937
13116
  _setAttr(key) {
12938
- let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
13117
+ if (key.startsWith("data-v-")) return;
13118
+ const has = this.hasAttribute(key);
13119
+ let value = has ? this.getAttribute(key) : REMOVAL;
12939
13120
  const camelKey = camelize(key);
12940
- if (this._numberProps && this._numberProps[camelKey]) {
13121
+ if (has && this._numberProps && this._numberProps[camelKey]) {
12941
13122
  value = toNumber(value);
12942
13123
  }
12943
- this._setProp(camelKey, value, false);
13124
+ this._setProp(camelKey, value, false, true);
12944
13125
  }
12945
13126
  /**
12946
13127
  * @internal
@@ -12951,9 +13132,13 @@ Expected function or array of functions, received type ${typeof value}.`
12951
13132
  /**
12952
13133
  * @internal
12953
13134
  */
12954
- _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
13135
+ _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
12955
13136
  if (val !== this._props[key]) {
12956
- this._props[key] = val;
13137
+ if (val === REMOVAL) {
13138
+ delete this._props[key];
13139
+ } else {
13140
+ this._props[key] = val;
13141
+ }
12957
13142
  if (shouldUpdate && this._instance) {
12958
13143
  this._update();
12959
13144
  }
@@ -12969,18 +13154,23 @@ Expected function or array of functions, received type ${typeof value}.`
12969
13154
  }
12970
13155
  }
12971
13156
  _update() {
12972
- render(this._createVNode(), this.shadowRoot);
13157
+ render(this._createVNode(), this._root);
12973
13158
  }
12974
13159
  _createVNode() {
12975
- const vnode = createVNode(this._def, extend({}, this._props));
13160
+ const baseProps = {};
13161
+ if (!this.shadowRoot) {
13162
+ baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
13163
+ }
13164
+ const vnode = createVNode(this._def, extend(baseProps, this._props));
12976
13165
  if (!this._instance) {
12977
13166
  vnode.ce = (instance) => {
12978
13167
  this._instance = instance;
13168
+ instance.ce = this;
12979
13169
  instance.isCE = true;
12980
13170
  {
12981
13171
  instance.ceReload = (newStyles) => {
12982
13172
  if (this._styles) {
12983
- this._styles.forEach((s) => this.shadowRoot.removeChild(s));
13173
+ this._styles.forEach((s) => this._root.removeChild(s));
12984
13174
  this._styles.length = 0;
12985
13175
  }
12986
13176
  this._applyStyles(newStyles);
@@ -12990,9 +13180,10 @@ Expected function or array of functions, received type ${typeof value}.`
12990
13180
  }
12991
13181
  const dispatch = (event, args) => {
12992
13182
  this.dispatchEvent(
12993
- new CustomEvent(event, {
12994
- detail: args
12995
- })
13183
+ new CustomEvent(
13184
+ event,
13185
+ isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
13186
+ )
12996
13187
  );
12997
13188
  };
12998
13189
  instance.emit = (event, ...args) => {
@@ -13001,31 +13192,127 @@ Expected function or array of functions, received type ${typeof value}.`
13001
13192
  dispatch(hyphenate(event), args);
13002
13193
  }
13003
13194
  };
13004
- let parent = this;
13005
- while (parent = parent && (parent.parentNode || parent.host)) {
13006
- if (parent instanceof VueElement) {
13007
- instance.parent = parent._instance;
13008
- instance.provides = parent._instance.provides;
13009
- break;
13010
- }
13011
- }
13195
+ this._setParent();
13012
13196
  };
13013
13197
  }
13014
13198
  return vnode;
13015
13199
  }
13016
- _applyStyles(styles) {
13017
- if (styles) {
13018
- styles.forEach((css) => {
13019
- const s = document.createElement("style");
13020
- s.textContent = css;
13021
- this.shadowRoot.appendChild(s);
13022
- {
13200
+ _applyStyles(styles, owner) {
13201
+ if (!styles) return;
13202
+ if (owner) {
13203
+ if (owner === this._def || this._styleChildren.has(owner)) {
13204
+ return;
13205
+ }
13206
+ this._styleChildren.add(owner);
13207
+ }
13208
+ const nonce = this._nonce;
13209
+ for (let i = styles.length - 1; i >= 0; i--) {
13210
+ const s = document.createElement("style");
13211
+ if (nonce) s.setAttribute("nonce", nonce);
13212
+ s.textContent = styles[i];
13213
+ this.shadowRoot.prepend(s);
13214
+ {
13215
+ if (owner) {
13216
+ if (owner.__hmrId) {
13217
+ if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
13218
+ let entry = this._childStyles.get(owner.__hmrId);
13219
+ if (!entry) {
13220
+ this._childStyles.set(owner.__hmrId, entry = []);
13221
+ }
13222
+ entry.push(s);
13223
+ }
13224
+ } else {
13023
13225
  (this._styles || (this._styles = [])).push(s);
13024
13226
  }
13025
- });
13227
+ }
13228
+ }
13229
+ }
13230
+ /**
13231
+ * Only called when shaddowRoot is false
13232
+ */
13233
+ _parseSlots() {
13234
+ const slots = this._slots = {};
13235
+ let n;
13236
+ while (n = this.firstChild) {
13237
+ const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
13238
+ (slots[slotName] || (slots[slotName] = [])).push(n);
13239
+ this.removeChild(n);
13240
+ }
13241
+ }
13242
+ /**
13243
+ * Only called when shaddowRoot is false
13244
+ */
13245
+ _renderSlots() {
13246
+ const outlets = this.querySelectorAll("slot");
13247
+ const scopeId = this._instance.type.__scopeId;
13248
+ for (let i = 0; i < outlets.length; i++) {
13249
+ const o = outlets[i];
13250
+ const slotName = o.getAttribute("name") || "default";
13251
+ const content = this._slots[slotName];
13252
+ const parent = o.parentNode;
13253
+ if (content) {
13254
+ for (const n of content) {
13255
+ if (scopeId && n.nodeType === 1) {
13256
+ const id = scopeId + "-s";
13257
+ const walker = document.createTreeWalker(n, 1);
13258
+ n.setAttribute(id, "");
13259
+ let child;
13260
+ while (child = walker.nextNode()) {
13261
+ child.setAttribute(id, "");
13262
+ }
13263
+ }
13264
+ parent.insertBefore(n, o);
13265
+ }
13266
+ } else {
13267
+ while (o.firstChild) parent.insertBefore(o.firstChild, o);
13268
+ }
13269
+ parent.removeChild(o);
13270
+ }
13271
+ }
13272
+ /**
13273
+ * @internal
13274
+ */
13275
+ _injectChildStyle(comp) {
13276
+ this._applyStyles(comp.styles, comp);
13277
+ }
13278
+ /**
13279
+ * @internal
13280
+ */
13281
+ _removeChildStyle(comp) {
13282
+ {
13283
+ this._styleChildren.delete(comp);
13284
+ if (this._childStyles && comp.__hmrId) {
13285
+ const oldStyles = this._childStyles.get(comp.__hmrId);
13286
+ if (oldStyles) {
13287
+ oldStyles.forEach((s) => this._root.removeChild(s));
13288
+ oldStyles.length = 0;
13289
+ }
13290
+ }
13026
13291
  }
13027
13292
  }
13028
13293
  }
13294
+ function useHost(caller) {
13295
+ const instance = getCurrentInstance();
13296
+ const el = instance && instance.ce;
13297
+ if (el) {
13298
+ return el;
13299
+ } else {
13300
+ if (!instance) {
13301
+ warn(
13302
+ `${caller || "useHost"} called without an active component instance.`
13303
+ );
13304
+ } else {
13305
+ warn(
13306
+ `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
13307
+ );
13308
+ }
13309
+ }
13310
+ return null;
13311
+ }
13312
+ function useShadowRoot() {
13313
+ const el = useHost("useShadowRoot") ;
13314
+ return el && el.shadowRoot;
13315
+ }
13029
13316
 
13030
13317
  function useCssModule(name = "$style") {
13031
13318
  {
@@ -13537,7 +13824,7 @@ Expected function or array of functions, received type ${typeof value}.`
13537
13824
  const component = app._component;
13538
13825
  if (!isFunction(component) && !component.render && !component.template) {
13539
13826
  component.template = container.innerHTML;
13540
- {
13827
+ if (container.nodeType === 1) {
13541
13828
  for (let i = 0; i < container.attributes.length; i++) {
13542
13829
  const attr = container.attributes[i];
13543
13830
  if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
@@ -13550,7 +13837,9 @@ Expected function or array of functions, received type ${typeof value}.`
13550
13837
  }
13551
13838
  }
13552
13839
  }
13553
- container.innerHTML = "";
13840
+ if (container.nodeType === 1) {
13841
+ container.textContent = "";
13842
+ }
13554
13843
  const proxy = mount(container, false, resolveRootNamespace(container));
13555
13844
  if (container instanceof Element) {
13556
13845
  container.removeAttribute("v-cloak");
@@ -13777,9 +14066,11 @@ Expected function or array of functions, received type ${typeof value}.`
13777
14066
  useAttrs: useAttrs,
13778
14067
  useCssModule: useCssModule,
13779
14068
  useCssVars: useCssVars,
14069
+ useHost: useHost,
13780
14070
  useId: useId,
13781
14071
  useModel: useModel,
13782
14072
  useSSRContext: useSSRContext,
14073
+ useShadowRoot: useShadowRoot,
13783
14074
  useSlots: useSlots,
13784
14075
  useTemplateRef: useTemplateRef,
13785
14076
  useTransitionState: useTransitionState,