@vue/runtime-dom 3.2.43 → 3.2.45

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,4 +1,4 @@
1
- import { camelize, warn, callWithAsyncErrorHandling, defineComponent, nextTick, createVNode, getCurrentInstance, watchPostEffect, onMounted, onUnmounted, Fragment, Static, h, BaseTransition, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, createRenderer, isRuntimeOnly, createHydrationRenderer } from '@vue/runtime-core';
1
+ import { warn, camelize, callWithAsyncErrorHandling, defineComponent, nextTick, createVNode, getCurrentInstance, watchPostEffect, onMounted, onUnmounted, Fragment, Static, h, BaseTransition, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, createRenderer, isRuntimeOnly, createHydrationRenderer } from '@vue/runtime-core';
2
2
  export * from '@vue/runtime-core';
3
3
  import { isString, isArray, hyphenate, capitalize, isSpecialBooleanAttr, includeBooleanAttr, isOn, isModelListener, isFunction, camelize as camelize$1, toNumber, extend, EMPTY_OBJ, isObject, invokeArrayFns, looseIndexOf, isSet, looseEqual, isHTMLTag, isSVGTag } from '@vue/shared';
4
4
 
@@ -133,6 +133,7 @@ function patchStyle(el, prev, next) {
133
133
  }
134
134
  }
135
135
  }
136
+ const semicolonRE = /[^\\];\s*$/;
136
137
  const importantRE = /\s*!important$/;
137
138
  function setStyle(style, name, val) {
138
139
  if (isArray(val)) {
@@ -141,6 +142,11 @@ function setStyle(style, name, val) {
141
142
  else {
142
143
  if (val == null)
143
144
  val = '';
145
+ if ((process.env.NODE_ENV !== 'production')) {
146
+ if (semicolonRE.test(val)) {
147
+ warn(`Unexpected semicolon at the end of '${name}' style value: '${val}'`);
148
+ }
149
+ }
144
150
  if (name.startsWith('--')) {
145
151
  // custom property definition
146
152
  style.setProperty(name, val);
@@ -470,12 +476,21 @@ class VueElement extends BaseClass {
470
476
  `defined as hydratable. Use \`defineSSRCustomElement\`.`);
471
477
  }
472
478
  this.attachShadow({ mode: 'open' });
479
+ if (!this._def.__asyncLoader) {
480
+ // for sync component defs we can immediately resolve props
481
+ this._resolveProps(this._def);
482
+ }
473
483
  }
474
484
  }
475
485
  connectedCallback() {
476
486
  this._connected = true;
477
487
  if (!this._instance) {
478
- this._resolveDef();
488
+ if (this._resolved) {
489
+ this._update();
490
+ }
491
+ else {
492
+ this._resolveDef();
493
+ }
479
494
  }
480
495
  }
481
496
  disconnectedCallback() {
@@ -491,9 +506,6 @@ class VueElement extends BaseClass {
491
506
  * resolve inner component definition (handle possible async component)
492
507
  */
493
508
  _resolveDef() {
494
- if (this._resolved) {
495
- return;
496
- }
497
509
  this._resolved = true;
498
510
  // set initial attrs
499
511
  for (let i = 0; i < this.attributes.length; i++) {
@@ -505,38 +517,26 @@ class VueElement extends BaseClass {
505
517
  this._setAttr(m.attributeName);
506
518
  }
507
519
  }).observe(this, { attributes: true });
508
- const resolve = (def) => {
509
- const { props = {}, styles } = def;
510
- const hasOptions = !isArray(props);
511
- const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
520
+ const resolve = (def, isAsync = false) => {
521
+ const { props, styles } = def;
512
522
  // cast Number-type props set before resolve
513
523
  let numberProps;
514
- if (hasOptions) {
515
- for (const key in this._props) {
524
+ if (props && !isArray(props)) {
525
+ for (const key in props) {
516
526
  const opt = props[key];
517
527
  if (opt === Number || (opt && opt.type === Number)) {
518
- this._props[key] = toNumber(this._props[key]);
519
- (numberProps || (numberProps = Object.create(null)))[key] = true;
528
+ if (key in this._props) {
529
+ this._props[key] = toNumber(this._props[key]);
530
+ }
531
+ (numberProps || (numberProps = Object.create(null)))[camelize$1(key)] = true;
520
532
  }
521
533
  }
522
534
  }
523
535
  this._numberProps = numberProps;
524
- // check if there are props set pre-upgrade or connect
525
- for (const key of Object.keys(this)) {
526
- if (key[0] !== '_') {
527
- this._setProp(key, this[key], true, false);
528
- }
529
- }
530
- // defining getter/setters on prototype
531
- for (const key of rawKeys.map(camelize$1)) {
532
- Object.defineProperty(this, key, {
533
- get() {
534
- return this._getProp(key);
535
- },
536
- set(val) {
537
- this._setProp(key, val);
538
- }
539
- });
536
+ if (isAsync) {
537
+ // defining getter/setters on prototype
538
+ // for sync defs, this already happened in the constructor
539
+ this._resolveProps(def);
540
540
  }
541
541
  // apply CSS
542
542
  this._applyStyles(styles);
@@ -545,12 +545,33 @@ class VueElement extends BaseClass {
545
545
  };
546
546
  const asyncDef = this._def.__asyncLoader;
547
547
  if (asyncDef) {
548
- asyncDef().then(resolve);
548
+ asyncDef().then(def => resolve(def, true));
549
549
  }
550
550
  else {
551
551
  resolve(this._def);
552
552
  }
553
553
  }
554
+ _resolveProps(def) {
555
+ const { props } = def;
556
+ const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
557
+ // check if there are props set pre-upgrade or connect
558
+ for (const key of Object.keys(this)) {
559
+ if (key[0] !== '_' && declaredPropKeys.includes(key)) {
560
+ this._setProp(key, this[key], true, false);
561
+ }
562
+ }
563
+ // defining getter/setters on prototype
564
+ for (const key of declaredPropKeys.map(camelize$1)) {
565
+ Object.defineProperty(this, key, {
566
+ get() {
567
+ return this._getProp(key);
568
+ },
569
+ set(val) {
570
+ this._setProp(key, val);
571
+ }
572
+ });
573
+ }
574
+ }
554
575
  _setAttr(key) {
555
576
  let value = this.getAttribute(key);
556
577
  const camelKey = camelize$1(key);
@@ -606,27 +627,31 @@ class VueElement extends BaseClass {
606
627
  this._styles.length = 0;
607
628
  }
608
629
  this._applyStyles(newStyles);
609
- // if this is an async component, ceReload is called from the inner
610
- // component so no need to reload the async wrapper
611
- if (!this._def.__asyncLoader) {
612
- // reload
613
- this._instance = null;
614
- this._update();
615
- }
630
+ this._instance = null;
631
+ this._update();
616
632
  };
617
633
  }
618
- // intercept emit
619
- instance.emit = (event, ...args) => {
634
+ const dispatch = (event, args) => {
620
635
  this.dispatchEvent(new CustomEvent(event, {
621
636
  detail: args
622
637
  }));
623
638
  };
639
+ // intercept emit
640
+ instance.emit = (event, ...args) => {
641
+ // dispatch both the raw and hyphenated versions of an event
642
+ // to match Vue behavior
643
+ dispatch(event, args);
644
+ if (hyphenate(event) !== event) {
645
+ dispatch(hyphenate(event), args);
646
+ }
647
+ };
624
648
  // locate nearest Vue custom element parent for provide/inject
625
649
  let parent = this;
626
650
  while ((parent =
627
651
  parent && (parent.parentNode || parent.host))) {
628
652
  if (parent instanceof VueElement) {
629
653
  instance.parent = parent._instance;
654
+ instance.provides = parent._instance.provides;
630
655
  break;
631
656
  }
632
657
  }
@@ -684,7 +709,14 @@ function useCssVars(getter) {
684
709
  warn(`useCssVars is called without current active component instance.`);
685
710
  return;
686
711
  }
687
- const setVars = () => setVarsOnVNode(instance.subTree, getter(instance.proxy));
712
+ const updateTeleports = (instance.ut = (vars = getter(instance.proxy)) => {
713
+ Array.from(document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)).forEach(node => setVarsOnNode(node, vars));
714
+ });
715
+ const setVars = () => {
716
+ const vars = getter(instance.proxy);
717
+ setVarsOnVNode(instance.subTree, vars);
718
+ updateTeleports(vars);
719
+ };
688
720
  watchPostEffect(setVars);
689
721
  onMounted(() => {
690
722
  const ob = new MutationObserver(setVars);
@@ -2022,12 +2022,6 @@ var VueRuntimeDOM = (function (exports) {
2022
2022
  // components to be unmounted and re-mounted. Queue the update so that we
2023
2023
  // don't end up forcing the same parent to re-render multiple times.
2024
2024
  queueJob(instance.parent.update);
2025
- // instance is the inner component of an async custom element
2026
- // invoke to reset styles
2027
- if (instance.parent.type.__asyncLoader &&
2028
- instance.parent.ceReload) {
2029
- instance.parent.ceReload(newComp.styles);
2030
- }
2031
2025
  }
2032
2026
  else if (instance.appContext.reload) {
2033
2027
  // root instance mounted via createApp() has a reload method
@@ -3274,10 +3268,11 @@ var VueRuntimeDOM = (function (exports) {
3274
3268
  callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
3275
3269
  newValue,
3276
3270
  // pass undefined as the old value when it's changed for the first time
3277
- oldValue === INITIAL_WATCHER_VALUE ||
3278
- (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
3279
- ? []
3280
- : oldValue,
3271
+ oldValue === INITIAL_WATCHER_VALUE
3272
+ ? undefined
3273
+ : (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
3274
+ ? []
3275
+ : oldValue,
3281
3276
  onCleanup
3282
3277
  ]);
3283
3278
  oldValue = newValue;
@@ -3874,10 +3869,15 @@ var VueRuntimeDOM = (function (exports) {
3874
3869
  }
3875
3870
  });
3876
3871
  }
3877
- function createInnerComp(comp, { vnode: { ref, props, children, shapeFlag }, parent }) {
3872
+ function createInnerComp(comp, parent) {
3873
+ const { ref, props, children, ce } = parent.vnode;
3878
3874
  const vnode = createVNode(comp, props, children);
3879
3875
  // ensure inner component inherits the async wrapper's ref owner
3880
3876
  vnode.ref = ref;
3877
+ // pass the custom element callback on to the inner comp
3878
+ // and remove it from the async wrapper
3879
+ vnode.ce = ce;
3880
+ delete parent.vnode.ce;
3881
3881
  return vnode;
3882
3882
  }
3883
3883
 
@@ -4035,8 +4035,7 @@ var VueRuntimeDOM = (function (exports) {
4035
4035
  : comp);
4036
4036
  const { include, exclude, max } = props;
4037
4037
  if ((include && (!name || !matches(include, name))) ||
4038
- (exclude && name && matches(exclude, name)) ||
4039
- (hmrDirtyComponents.has(comp))) {
4038
+ (exclude && name && matches(exclude, name))) {
4040
4039
  current = vnode;
4041
4040
  return rawVNode;
4042
4041
  }
@@ -4146,14 +4145,9 @@ var VueRuntimeDOM = (function (exports) {
4146
4145
  }, target);
4147
4146
  }
4148
4147
  function resetShapeFlag(vnode) {
4149
- let shapeFlag = vnode.shapeFlag;
4150
- if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
4151
- shapeFlag -= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
4152
- }
4153
- if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
4154
- shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
4155
- }
4156
- vnode.shapeFlag = shapeFlag;
4148
+ // bitwise operations to remove keep alive flags
4149
+ vnode.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
4150
+ vnode.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
4157
4151
  }
4158
4152
  function getInnerChild(vnode) {
4159
4153
  return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
@@ -4452,7 +4446,9 @@ var VueRuntimeDOM = (function (exports) {
4452
4446
  (currentRenderingInstance.parent &&
4453
4447
  isAsyncWrapper(currentRenderingInstance.parent) &&
4454
4448
  currentRenderingInstance.parent.isCE)) {
4455
- return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
4449
+ if (name !== 'default')
4450
+ props.name = name;
4451
+ return createVNode('slot', props, fallback && fallback());
4456
4452
  }
4457
4453
  let slot = slots[name];
4458
4454
  if (slot && slot.length > 1) {
@@ -4552,6 +4548,7 @@ var VueRuntimeDOM = (function (exports) {
4552
4548
  $watch: i => (instanceWatch.bind(i) )
4553
4549
  });
4554
4550
  const isReservedPrefix = (key) => key === '_' || key === '$';
4551
+ const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
4555
4552
  const PublicInstanceProxyHandlers = {
4556
4553
  get({ _: instance }, key) {
4557
4554
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
@@ -4559,15 +4556,6 @@ var VueRuntimeDOM = (function (exports) {
4559
4556
  if (key === '__isVue') {
4560
4557
  return true;
4561
4558
  }
4562
- // prioritize <script setup> bindings during dev.
4563
- // this allows even properties that start with _ or $ to be used - so that
4564
- // it aligns with the production behavior where the render fn is inlined and
4565
- // indeed has access to all declared variables.
4566
- if (setupState !== EMPTY_OBJ &&
4567
- setupState.__isScriptSetup &&
4568
- hasOwn(setupState, key)) {
4569
- return setupState[key];
4570
- }
4571
4559
  // data / props / ctx
4572
4560
  // This getter gets called for every property access on the render context
4573
4561
  // during render and is a major hotspot. The most expensive part of this
@@ -4590,7 +4578,7 @@ var VueRuntimeDOM = (function (exports) {
4590
4578
  // default: just fallthrough
4591
4579
  }
4592
4580
  }
4593
- else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
4581
+ else if (hasSetupBinding(setupState, key)) {
4594
4582
  accessCache[key] = 1 /* AccessTypes.SETUP */;
4595
4583
  return setupState[key];
4596
4584
  }
@@ -4660,21 +4648,26 @@ var VueRuntimeDOM = (function (exports) {
4660
4648
  },
4661
4649
  set({ _: instance }, key, value) {
4662
4650
  const { data, setupState, ctx } = instance;
4663
- if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
4651
+ if (hasSetupBinding(setupState, key)) {
4664
4652
  setupState[key] = value;
4665
4653
  return true;
4666
4654
  }
4655
+ else if (setupState.__isScriptSetup &&
4656
+ hasOwn(setupState, key)) {
4657
+ warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
4658
+ return false;
4659
+ }
4667
4660
  else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
4668
4661
  data[key] = value;
4669
4662
  return true;
4670
4663
  }
4671
4664
  else if (hasOwn(instance.props, key)) {
4672
- warn$1(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
4665
+ warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
4673
4666
  return false;
4674
4667
  }
4675
4668
  if (key[0] === '$' && key.slice(1) in instance) {
4676
4669
  warn$1(`Attempting to mutate public property "${key}". ` +
4677
- `Properties starting with $ are reserved and readonly.`, instance);
4670
+ `Properties starting with $ are reserved and readonly.`);
4678
4671
  return false;
4679
4672
  }
4680
4673
  else {
@@ -4695,7 +4688,7 @@ var VueRuntimeDOM = (function (exports) {
4695
4688
  let normalizedProps;
4696
4689
  return (!!accessCache[key] ||
4697
4690
  (data !== EMPTY_OBJ && hasOwn(data, key)) ||
4698
- (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
4691
+ hasSetupBinding(setupState, key) ||
4699
4692
  ((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
4700
4693
  hasOwn(ctx, key) ||
4701
4694
  hasOwn(publicPropertiesMap, key) ||
@@ -7734,6 +7727,10 @@ var VueRuntimeDOM = (function (exports) {
7734
7727
  if (!shallow)
7735
7728
  traverseStaticChildren(c1, c2);
7736
7729
  }
7730
+ // #6852 also inherit for text nodes
7731
+ if (c2.type === Text) {
7732
+ c2.el = c1.el;
7733
+ }
7737
7734
  // also inherit for comment nodes, but not placeholders (e.g. v-if which
7738
7735
  // would have received .el during block patch)
7739
7736
  if (c2.type === Comment && !c2.el) {
@@ -7904,6 +7901,7 @@ var VueRuntimeDOM = (function (exports) {
7904
7901
  }
7905
7902
  }
7906
7903
  }
7904
+ updateCssVars(n2);
7907
7905
  },
7908
7906
  remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
7909
7907
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
@@ -7982,11 +7980,26 @@ var VueRuntimeDOM = (function (exports) {
7982
7980
  hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
7983
7981
  }
7984
7982
  }
7983
+ updateCssVars(vnode);
7985
7984
  }
7986
7985
  return vnode.anchor && nextSibling(vnode.anchor);
7987
7986
  }
7988
7987
  // Force-casted public typing for h and TSX props inference
7989
7988
  const Teleport = TeleportImpl;
7989
+ function updateCssVars(vnode) {
7990
+ // presence of .ut method indicates owner component uses css vars.
7991
+ // code path here can assume browser environment.
7992
+ const ctx = vnode.ctx;
7993
+ if (ctx && ctx.ut) {
7994
+ let node = vnode.children[0].el;
7995
+ while (node !== vnode.targetAnchor) {
7996
+ if (node.nodeType === 1)
7997
+ node.setAttribute('data-v-owner', ctx.uid);
7998
+ node = node.nextSibling;
7999
+ }
8000
+ ctx.ut();
8001
+ }
8002
+ }
7990
8003
 
7991
8004
  const Fragment = Symbol('Fragment' );
7992
8005
  const Text = Symbol('Text' );
@@ -8081,6 +8094,10 @@ var VueRuntimeDOM = (function (exports) {
8081
8094
  function isSameVNodeType(n1, n2) {
8082
8095
  if (n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
8083
8096
  hmrDirtyComponents.has(n2.type)) {
8097
+ // #7042, ensure the vnode being unmounted during HMR
8098
+ // bitwise operations to remove keep alive flags
8099
+ n1.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
8100
+ n2.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
8084
8101
  // HMR only: if the component has been hot-updated, force a reload.
8085
8102
  return false;
8086
8103
  }
@@ -8136,7 +8153,8 @@ var VueRuntimeDOM = (function (exports) {
8136
8153
  patchFlag,
8137
8154
  dynamicProps,
8138
8155
  dynamicChildren: null,
8139
- appContext: null
8156
+ appContext: null,
8157
+ ctx: currentRenderingInstance
8140
8158
  };
8141
8159
  if (needFullChildrenNormalization) {
8142
8160
  normalizeChildren(vnode, children);
@@ -8303,7 +8321,8 @@ var VueRuntimeDOM = (function (exports) {
8303
8321
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
8304
8322
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
8305
8323
  el: vnode.el,
8306
- anchor: vnode.anchor
8324
+ anchor: vnode.anchor,
8325
+ ctx: vnode.ctx
8307
8326
  };
8308
8327
  return cloned;
8309
8328
  }
@@ -9267,7 +9286,7 @@ var VueRuntimeDOM = (function (exports) {
9267
9286
  }
9268
9287
 
9269
9288
  // Core API ------------------------------------------------------------------
9270
- const version = "3.2.43";
9289
+ const version = "3.2.45";
9271
9290
  /**
9272
9291
  * SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
9273
9292
  * @internal
@@ -9413,6 +9432,7 @@ var VueRuntimeDOM = (function (exports) {
9413
9432
  }
9414
9433
  }
9415
9434
  }
9435
+ const semicolonRE = /[^\\];\s*$/;
9416
9436
  const importantRE = /\s*!important$/;
9417
9437
  function setStyle(style, name, val) {
9418
9438
  if (isArray(val)) {
@@ -9421,6 +9441,11 @@ var VueRuntimeDOM = (function (exports) {
9421
9441
  else {
9422
9442
  if (val == null)
9423
9443
  val = '';
9444
+ {
9445
+ if (semicolonRE.test(val)) {
9446
+ warn$1(`Unexpected semicolon at the end of '${name}' style value: '${val}'`);
9447
+ }
9448
+ }
9424
9449
  if (name.startsWith('--')) {
9425
9450
  // custom property definition
9426
9451
  style.setProperty(name, val);
@@ -9750,12 +9775,21 @@ var VueRuntimeDOM = (function (exports) {
9750
9775
  `defined as hydratable. Use \`defineSSRCustomElement\`.`);
9751
9776
  }
9752
9777
  this.attachShadow({ mode: 'open' });
9778
+ if (!this._def.__asyncLoader) {
9779
+ // for sync component defs we can immediately resolve props
9780
+ this._resolveProps(this._def);
9781
+ }
9753
9782
  }
9754
9783
  }
9755
9784
  connectedCallback() {
9756
9785
  this._connected = true;
9757
9786
  if (!this._instance) {
9758
- this._resolveDef();
9787
+ if (this._resolved) {
9788
+ this._update();
9789
+ }
9790
+ else {
9791
+ this._resolveDef();
9792
+ }
9759
9793
  }
9760
9794
  }
9761
9795
  disconnectedCallback() {
@@ -9771,9 +9805,6 @@ var VueRuntimeDOM = (function (exports) {
9771
9805
  * resolve inner component definition (handle possible async component)
9772
9806
  */
9773
9807
  _resolveDef() {
9774
- if (this._resolved) {
9775
- return;
9776
- }
9777
9808
  this._resolved = true;
9778
9809
  // set initial attrs
9779
9810
  for (let i = 0; i < this.attributes.length; i++) {
@@ -9785,38 +9816,26 @@ var VueRuntimeDOM = (function (exports) {
9785
9816
  this._setAttr(m.attributeName);
9786
9817
  }
9787
9818
  }).observe(this, { attributes: true });
9788
- const resolve = (def) => {
9789
- const { props = {}, styles } = def;
9790
- const hasOptions = !isArray(props);
9791
- const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
9819
+ const resolve = (def, isAsync = false) => {
9820
+ const { props, styles } = def;
9792
9821
  // cast Number-type props set before resolve
9793
9822
  let numberProps;
9794
- if (hasOptions) {
9795
- for (const key in this._props) {
9823
+ if (props && !isArray(props)) {
9824
+ for (const key in props) {
9796
9825
  const opt = props[key];
9797
9826
  if (opt === Number || (opt && opt.type === Number)) {
9798
- this._props[key] = toNumber(this._props[key]);
9799
- (numberProps || (numberProps = Object.create(null)))[key] = true;
9827
+ if (key in this._props) {
9828
+ this._props[key] = toNumber(this._props[key]);
9829
+ }
9830
+ (numberProps || (numberProps = Object.create(null)))[camelize(key)] = true;
9800
9831
  }
9801
9832
  }
9802
9833
  }
9803
9834
  this._numberProps = numberProps;
9804
- // check if there are props set pre-upgrade or connect
9805
- for (const key of Object.keys(this)) {
9806
- if (key[0] !== '_') {
9807
- this._setProp(key, this[key], true, false);
9808
- }
9809
- }
9810
- // defining getter/setters on prototype
9811
- for (const key of rawKeys.map(camelize)) {
9812
- Object.defineProperty(this, key, {
9813
- get() {
9814
- return this._getProp(key);
9815
- },
9816
- set(val) {
9817
- this._setProp(key, val);
9818
- }
9819
- });
9835
+ if (isAsync) {
9836
+ // defining getter/setters on prototype
9837
+ // for sync defs, this already happened in the constructor
9838
+ this._resolveProps(def);
9820
9839
  }
9821
9840
  // apply CSS
9822
9841
  this._applyStyles(styles);
@@ -9825,12 +9844,33 @@ var VueRuntimeDOM = (function (exports) {
9825
9844
  };
9826
9845
  const asyncDef = this._def.__asyncLoader;
9827
9846
  if (asyncDef) {
9828
- asyncDef().then(resolve);
9847
+ asyncDef().then(def => resolve(def, true));
9829
9848
  }
9830
9849
  else {
9831
9850
  resolve(this._def);
9832
9851
  }
9833
9852
  }
9853
+ _resolveProps(def) {
9854
+ const { props } = def;
9855
+ const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
9856
+ // check if there are props set pre-upgrade or connect
9857
+ for (const key of Object.keys(this)) {
9858
+ if (key[0] !== '_' && declaredPropKeys.includes(key)) {
9859
+ this._setProp(key, this[key], true, false);
9860
+ }
9861
+ }
9862
+ // defining getter/setters on prototype
9863
+ for (const key of declaredPropKeys.map(camelize)) {
9864
+ Object.defineProperty(this, key, {
9865
+ get() {
9866
+ return this._getProp(key);
9867
+ },
9868
+ set(val) {
9869
+ this._setProp(key, val);
9870
+ }
9871
+ });
9872
+ }
9873
+ }
9834
9874
  _setAttr(key) {
9835
9875
  let value = this.getAttribute(key);
9836
9876
  const camelKey = camelize(key);
@@ -9886,27 +9926,31 @@ var VueRuntimeDOM = (function (exports) {
9886
9926
  this._styles.length = 0;
9887
9927
  }
9888
9928
  this._applyStyles(newStyles);
9889
- // if this is an async component, ceReload is called from the inner
9890
- // component so no need to reload the async wrapper
9891
- if (!this._def.__asyncLoader) {
9892
- // reload
9893
- this._instance = null;
9894
- this._update();
9895
- }
9929
+ this._instance = null;
9930
+ this._update();
9896
9931
  };
9897
9932
  }
9898
- // intercept emit
9899
- instance.emit = (event, ...args) => {
9933
+ const dispatch = (event, args) => {
9900
9934
  this.dispatchEvent(new CustomEvent(event, {
9901
9935
  detail: args
9902
9936
  }));
9903
9937
  };
9938
+ // intercept emit
9939
+ instance.emit = (event, ...args) => {
9940
+ // dispatch both the raw and hyphenated versions of an event
9941
+ // to match Vue behavior
9942
+ dispatch(event, args);
9943
+ if (hyphenate(event) !== event) {
9944
+ dispatch(hyphenate(event), args);
9945
+ }
9946
+ };
9904
9947
  // locate nearest Vue custom element parent for provide/inject
9905
9948
  let parent = this;
9906
9949
  while ((parent =
9907
9950
  parent && (parent.parentNode || parent.host))) {
9908
9951
  if (parent instanceof VueElement) {
9909
9952
  instance.parent = parent._instance;
9953
+ instance.provides = parent._instance.provides;
9910
9954
  break;
9911
9955
  }
9912
9956
  }
@@ -9950,7 +9994,14 @@ var VueRuntimeDOM = (function (exports) {
9950
9994
  warn$1(`useCssVars is called without current active component instance.`);
9951
9995
  return;
9952
9996
  }
9953
- const setVars = () => setVarsOnVNode(instance.subTree, getter(instance.proxy));
9997
+ const updateTeleports = (instance.ut = (vars = getter(instance.proxy)) => {
9998
+ Array.from(document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)).forEach(node => setVarsOnNode(node, vars));
9999
+ });
10000
+ const setVars = () => {
10001
+ const vars = getter(instance.proxy);
10002
+ setVarsOnVNode(instance.subTree, vars);
10003
+ updateTeleports(vars);
10004
+ };
9954
10005
  watchPostEffect(setVars);
9955
10006
  onMounted(() => {
9956
10007
  const ob = new MutationObserver(setVars);