@vue/compat 3.2.9 → 3.2.13

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.
@@ -1410,7 +1410,8 @@ class ComputedRefImpl {
1410
1410
  function computed(getterOrOptions, debugOptions) {
1411
1411
  let getter;
1412
1412
  let setter;
1413
- if (isFunction(getterOrOptions)) {
1413
+ const onlyGetter = isFunction(getterOrOptions);
1414
+ if (onlyGetter) {
1414
1415
  getter = getterOrOptions;
1415
1416
  setter = () => {
1416
1417
  console.warn('Write operation failed: computed value is readonly');
@@ -1421,7 +1422,7 @@ function computed(getterOrOptions, debugOptions) {
1421
1422
  getter = getterOrOptions.get;
1422
1423
  setter = getterOrOptions.set;
1423
1424
  }
1424
- const cRef = new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set);
1425
+ const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter);
1425
1426
  if (debugOptions) {
1426
1427
  cRef.effect.onTrack = debugOptions.onTrack;
1427
1428
  cRef.effect.onTrigger = debugOptions.onTrigger;
@@ -1456,41 +1457,33 @@ function registerHMR(instance) {
1456
1457
  const id = instance.type.__hmrId;
1457
1458
  let record = map.get(id);
1458
1459
  if (!record) {
1459
- createRecord(id, instance.type);
1460
+ createRecord(id);
1460
1461
  record = map.get(id);
1461
1462
  }
1462
- record.instances.add(instance);
1463
+ record.add(instance);
1463
1464
  }
1464
1465
  function unregisterHMR(instance) {
1465
- map.get(instance.type.__hmrId).instances.delete(instance);
1466
+ map.get(instance.type.__hmrId).delete(instance);
1466
1467
  }
1467
- function createRecord(id, component) {
1468
- if (!component) {
1469
- warn$1(`HMR API usage is out of date.\n` +
1470
- `Please upgrade vue-loader/vite/rollup-plugin-vue or other relevant ` +
1471
- `dependency that handles Vue SFC compilation.`);
1472
- component = {};
1473
- }
1468
+ function createRecord(id) {
1474
1469
  if (map.has(id)) {
1475
1470
  return false;
1476
1471
  }
1477
- map.set(id, {
1478
- component: isClassComponent(component) ? component.__vccOpts : component,
1479
- instances: new Set()
1480
- });
1472
+ map.set(id, new Set());
1481
1473
  return true;
1482
1474
  }
1475
+ function normalizeClassComponent(component) {
1476
+ return isClassComponent(component) ? component.__vccOpts : component;
1477
+ }
1483
1478
  function rerender(id, newRender) {
1484
1479
  const record = map.get(id);
1485
- if (!record)
1480
+ if (!record) {
1486
1481
  return;
1487
- if (newRender)
1488
- record.component.render = newRender;
1489
- // Array.from creates a snapshot which avoids the set being mutated during
1490
- // updates
1491
- Array.from(record.instances).forEach(instance => {
1482
+ }
1483
+ [...record].forEach(instance => {
1492
1484
  if (newRender) {
1493
1485
  instance.render = newRender;
1486
+ normalizeClassComponent(instance.type).render = newRender;
1494
1487
  }
1495
1488
  instance.renderCache = [];
1496
1489
  // this flag forces child components with slot content to update
@@ -1503,34 +1496,31 @@ function reload(id, newComp) {
1503
1496
  const record = map.get(id);
1504
1497
  if (!record)
1505
1498
  return;
1506
- // Array.from creates a snapshot which avoids the set being mutated during
1507
- // updates
1508
- const { component, instances } = record;
1509
- if (!hmrDirtyComponents.has(component)) {
1510
- // 1. Update existing comp definition to match new one
1511
- newComp = isClassComponent(newComp) ? newComp.__vccOpts : newComp;
1512
- extend(component, newComp);
1513
- for (const key in component) {
1514
- if (key !== '__file' && !(key in newComp)) {
1515
- delete component[key];
1516
- }
1517
- }
1518
- // 2. Mark component dirty. This forces the renderer to replace the component
1519
- // on patch.
1520
- hmrDirtyComponents.add(component);
1521
- // 3. Make sure to unmark the component after the reload.
1522
- queuePostFlushCb(() => {
1523
- hmrDirtyComponents.delete(component);
1524
- });
1525
- }
1526
- Array.from(instances).forEach(instance => {
1527
- // invalidate options resolution cache
1499
+ newComp = normalizeClassComponent(newComp);
1500
+ // create a snapshot which avoids the set being mutated during updates
1501
+ const instances = [...record];
1502
+ for (const instance of instances) {
1503
+ const oldComp = normalizeClassComponent(instance.type);
1504
+ if (!hmrDirtyComponents.has(oldComp)) {
1505
+ // 1. Update existing comp definition to match new one
1506
+ extend(oldComp, newComp);
1507
+ for (const key in oldComp) {
1508
+ if (key !== '__file' && !(key in newComp)) {
1509
+ delete oldComp[key];
1510
+ }
1511
+ }
1512
+ // 2. mark definition dirty. This forces the renderer to replace the
1513
+ // component on patch.
1514
+ hmrDirtyComponents.add(oldComp);
1515
+ }
1516
+ // 3. invalidate options resolution cache
1528
1517
  instance.appContext.optionsCache.delete(instance.type);
1518
+ // 4. actually update
1529
1519
  if (instance.ceReload) {
1530
1520
  // custom element
1531
- hmrDirtyComponents.add(component);
1521
+ hmrDirtyComponents.add(oldComp);
1532
1522
  instance.ceReload(newComp.styles);
1533
- hmrDirtyComponents.delete(component);
1523
+ hmrDirtyComponents.delete(oldComp);
1534
1524
  }
1535
1525
  else if (instance.parent) {
1536
1526
  // 4. Force the parent instance to re-render. This will cause all updated
@@ -1555,6 +1545,12 @@ function reload(id, newComp) {
1555
1545
  else {
1556
1546
  console.warn('[HMR] Root or manually mounted instance modified. Full reload required.');
1557
1547
  }
1548
+ }
1549
+ // 5. make sure to cleanup dirty hmr components after update
1550
+ queuePostFlushCb(() => {
1551
+ for (const instance of instances) {
1552
+ hmrDirtyComponents.delete(normalizeClassComponent(instance.type));
1553
+ }
1558
1554
  });
1559
1555
  }
1560
1556
  function tryWrap(fn) {
@@ -1881,7 +1877,7 @@ const deprecationData = {
1881
1877
  ["PRIVATE_APIS" /* PRIVATE_APIS */]: {
1882
1878
  message: name => `"${name}" is a Vue 2 private API that no longer exists in Vue 3. ` +
1883
1879
  `If you are seeing this warning only due to a dependency, you can ` +
1884
- `suppress this warning via { PRIVATE_APIS: 'supress-warning' }.`
1880
+ `suppress this warning via { PRIVATE_APIS: 'suppress-warning' }.`
1885
1881
  }
1886
1882
  };
1887
1883
  const instanceWarned = Object.create(null);
@@ -2368,12 +2364,12 @@ function markAttrsAccessed() {
2368
2364
  function renderComponentRoot(instance) {
2369
2365
  const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx, inheritAttrs } = instance;
2370
2366
  let result;
2367
+ let fallthroughAttrs;
2371
2368
  const prev = setCurrentRenderingInstance(instance);
2372
2369
  {
2373
2370
  accessedAttrs = false;
2374
2371
  }
2375
2372
  try {
2376
- let fallthroughAttrs;
2377
2373
  if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
2378
2374
  // withProxy is a proxy with a different `has` trap only for
2379
2375
  // runtime-compiled render functions using `with` block.
@@ -2404,108 +2400,105 @@ function renderComponentRoot(instance) {
2404
2400
  ? attrs
2405
2401
  : getFunctionalFallthrough(attrs);
2406
2402
  }
2407
- // attr merging
2408
- // in dev mode, comments are preserved, and it's possible for a template
2409
- // to have comments along side the root element which makes it a fragment
2410
- let root = result;
2411
- let setRoot = undefined;
2412
- if (true &&
2413
- result.patchFlag > 0 &&
2414
- result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
2415
- ;
2416
- [root, setRoot] = getChildRoot(result);
2417
- }
2418
- if (fallthroughAttrs && inheritAttrs !== false) {
2419
- const keys = Object.keys(fallthroughAttrs);
2420
- const { shapeFlag } = root;
2421
- if (keys.length) {
2422
- if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2423
- if (propsOptions && keys.some(isModelListener)) {
2424
- // If a v-model listener (onUpdate:xxx) has a corresponding declared
2425
- // prop, it indicates this component expects to handle v-model and
2426
- // it should not fallthrough.
2427
- // related: #1543, #1643, #1989
2428
- fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
2429
- }
2430
- root = cloneVNode(root, fallthroughAttrs);
2431
- }
2432
- else if (true && !accessedAttrs && root.type !== Comment) {
2433
- const allAttrs = Object.keys(attrs);
2434
- const eventAttrs = [];
2435
- const extraAttrs = [];
2436
- for (let i = 0, l = allAttrs.length; i < l; i++) {
2437
- const key = allAttrs[i];
2438
- if (isOn(key)) {
2439
- // ignore v-model handlers when they fail to fallthrough
2440
- if (!isModelListener(key)) {
2441
- // remove `on`, lowercase first letter to reflect event casing
2442
- // accurately
2443
- eventAttrs.push(key[2].toLowerCase() + key.slice(3));
2444
- }
2445
- }
2446
- else {
2447
- extraAttrs.push(key);
2403
+ }
2404
+ catch (err) {
2405
+ blockStack.length = 0;
2406
+ handleError(err, instance, 1 /* RENDER_FUNCTION */);
2407
+ result = createVNode(Comment);
2408
+ }
2409
+ // attr merging
2410
+ // in dev mode, comments are preserved, and it's possible for a template
2411
+ // to have comments along side the root element which makes it a fragment
2412
+ let root = result;
2413
+ let setRoot = undefined;
2414
+ if (result.patchFlag > 0 &&
2415
+ result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
2416
+ [root, setRoot] = getChildRoot(result);
2417
+ }
2418
+ if (fallthroughAttrs && inheritAttrs !== false) {
2419
+ const keys = Object.keys(fallthroughAttrs);
2420
+ const { shapeFlag } = root;
2421
+ if (keys.length) {
2422
+ if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2423
+ if (propsOptions && keys.some(isModelListener)) {
2424
+ // If a v-model listener (onUpdate:xxx) has a corresponding declared
2425
+ // prop, it indicates this component expects to handle v-model and
2426
+ // it should not fallthrough.
2427
+ // related: #1543, #1643, #1989
2428
+ fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
2429
+ }
2430
+ root = cloneVNode(root, fallthroughAttrs);
2431
+ }
2432
+ else if (!accessedAttrs && root.type !== Comment) {
2433
+ const allAttrs = Object.keys(attrs);
2434
+ const eventAttrs = [];
2435
+ const extraAttrs = [];
2436
+ for (let i = 0, l = allAttrs.length; i < l; i++) {
2437
+ const key = allAttrs[i];
2438
+ if (isOn(key)) {
2439
+ // ignore v-model handlers when they fail to fallthrough
2440
+ if (!isModelListener(key)) {
2441
+ // remove `on`, lowercase first letter to reflect event casing
2442
+ // accurately
2443
+ eventAttrs.push(key[2].toLowerCase() + key.slice(3));
2448
2444
  }
2449
2445
  }
2450
- if (extraAttrs.length) {
2451
- warn$1(`Extraneous non-props attributes (` +
2452
- `${extraAttrs.join(', ')}) ` +
2453
- `were passed to component but could not be automatically inherited ` +
2454
- `because component renders fragment or text root nodes.`);
2455
- }
2456
- if (eventAttrs.length) {
2457
- warn$1(`Extraneous non-emits event listeners (` +
2458
- `${eventAttrs.join(', ')}) ` +
2459
- `were passed to component but could not be automatically inherited ` +
2460
- `because component renders fragment or text root nodes. ` +
2461
- `If the listener is intended to be a component custom event listener only, ` +
2462
- `declare it using the "emits" option.`);
2446
+ else {
2447
+ extraAttrs.push(key);
2463
2448
  }
2464
2449
  }
2465
- }
2466
- }
2467
- if (true &&
2468
- isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
2469
- vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
2470
- root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2471
- const { class: cls, style } = vnode.props || {};
2472
- if (cls || style) {
2473
- if (true && inheritAttrs === false) {
2474
- warnDeprecation("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance, getComponentName(instance.type));
2450
+ if (extraAttrs.length) {
2451
+ warn$1(`Extraneous non-props attributes (` +
2452
+ `${extraAttrs.join(', ')}) ` +
2453
+ `were passed to component but could not be automatically inherited ` +
2454
+ `because component renders fragment or text root nodes.`);
2455
+ }
2456
+ if (eventAttrs.length) {
2457
+ warn$1(`Extraneous non-emits event listeners (` +
2458
+ `${eventAttrs.join(', ')}) ` +
2459
+ `were passed to component but could not be automatically inherited ` +
2460
+ `because component renders fragment or text root nodes. ` +
2461
+ `If the listener is intended to be a component custom event listener only, ` +
2462
+ `declare it using the "emits" option.`);
2475
2463
  }
2476
- root = cloneVNode(root, {
2477
- class: cls,
2478
- style: style
2479
- });
2480
- }
2481
- }
2482
- // inherit directives
2483
- if (vnode.dirs) {
2484
- if (true && !isElementRoot(root)) {
2485
- warn$1(`Runtime directive used on component with non-element root node. ` +
2486
- `The directives will not function as intended.`);
2487
2464
  }
2488
- root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2489
2465
  }
2490
- // inherit transition data
2491
- if (vnode.transition) {
2492
- if (true && !isElementRoot(root)) {
2493
- warn$1(`Component inside <Transition> renders non-element root node ` +
2494
- `that cannot be animated.`);
2466
+ }
2467
+ if (isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
2468
+ vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
2469
+ root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2470
+ const { class: cls, style } = vnode.props || {};
2471
+ if (cls || style) {
2472
+ if (inheritAttrs === false) {
2473
+ warnDeprecation("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance, getComponentName(instance.type));
2495
2474
  }
2496
- root.transition = vnode.transition;
2475
+ root = cloneVNode(root, {
2476
+ class: cls,
2477
+ style: style
2478
+ });
2497
2479
  }
2498
- if (true && setRoot) {
2499
- setRoot(root);
2480
+ }
2481
+ // inherit directives
2482
+ if (vnode.dirs) {
2483
+ if (!isElementRoot(root)) {
2484
+ warn$1(`Runtime directive used on component with non-element root node. ` +
2485
+ `The directives will not function as intended.`);
2500
2486
  }
2501
- else {
2502
- result = root;
2487
+ root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2488
+ }
2489
+ // inherit transition data
2490
+ if (vnode.transition) {
2491
+ if (!isElementRoot(root)) {
2492
+ warn$1(`Component inside <Transition> renders non-element root node ` +
2493
+ `that cannot be animated.`);
2503
2494
  }
2495
+ root.transition = vnode.transition;
2504
2496
  }
2505
- catch (err) {
2506
- blockStack.length = 0;
2507
- handleError(err, instance, 1 /* RENDER_FUNCTION */);
2508
- result = createVNode(Comment);
2497
+ if (setRoot) {
2498
+ setRoot(root);
2499
+ }
2500
+ else {
2501
+ result = root;
2509
2502
  }
2510
2503
  setCurrentRenderingInstance(prev);
2511
2504
  return result;
@@ -3040,8 +3033,8 @@ function normalizeSuspenseChildren(vnode) {
3040
3033
  function normalizeSuspenseSlot(s) {
3041
3034
  let block;
3042
3035
  if (isFunction(s)) {
3043
- const isCompiledSlot = s._c;
3044
- if (isCompiledSlot) {
3036
+ const trackBlock = isBlockTreeEnabled && s._c;
3037
+ if (trackBlock) {
3045
3038
  // disableTracking: false
3046
3039
  // allow block tracking for compiled slots
3047
3040
  // (see ./componentRenderContext.ts)
@@ -3049,7 +3042,7 @@ function normalizeSuspenseSlot(s) {
3049
3042
  openBlock();
3050
3043
  }
3051
3044
  s = s();
3052
- if (isCompiledSlot) {
3045
+ if (trackBlock) {
3053
3046
  s._d = true;
3054
3047
  block = currentBlock;
3055
3048
  closeBlock();
@@ -5205,7 +5198,7 @@ function createCompatVue(createApp, createSingletonApp) {
5205
5198
  return vm;
5206
5199
  }
5207
5200
  }
5208
- Vue.version = "3.2.9";
5201
+ Vue.version = "3.2.13";
5209
5202
  Vue.config = singletonApp.config;
5210
5203
  Vue.use = (p, ...options) => {
5211
5204
  if (p && isFunction(p.install)) {
@@ -5736,7 +5729,7 @@ function createAppAPI(render, hydrate) {
5736
5729
  app._instance = vnode.component;
5737
5730
  devtoolsInitApp(app, version);
5738
5731
  }
5739
- return vnode.component.proxy;
5732
+ return getExposeProxy(vnode.component) || vnode.component.proxy;
5740
5733
  }
5741
5734
  else {
5742
5735
  warn$1(`App has already been mounted.\n` +
@@ -5945,14 +5938,14 @@ function createHydrationFunctions(rendererInternals) {
5945
5938
  for (const key in props) {
5946
5939
  if ((forcePatchValue && key.endsWith('value')) ||
5947
5940
  (isOn(key) && !isReservedProp(key))) {
5948
- patchProp(el, key, null, props[key]);
5941
+ patchProp(el, key, null, props[key], false, undefined, parentComponent);
5949
5942
  }
5950
5943
  }
5951
5944
  }
5952
5945
  else if (props.onClick) {
5953
5946
  // Fast path for click listeners (which is most often) to avoid
5954
5947
  // iterating through props.
5955
- patchProp(el, 'onClick', null, props.onClick);
5948
+ patchProp(el, 'onClick', null, props.onClick, false, undefined, parentComponent);
5956
5949
  }
5957
5950
  }
5958
5951
  // vnode / directive hooks
@@ -7853,7 +7846,11 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
7853
7846
  return Component;
7854
7847
  }
7855
7848
  if (warnMissing && !res) {
7856
- warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}`);
7849
+ const extra = type === COMPONENTS
7850
+ ? `\nIf this is a native custom element, make sure to exclude it from ` +
7851
+ `component resolution via compilerOptions.isCustomElement.`
7852
+ : ``;
7853
+ warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
7857
7854
  }
7858
7855
  return res;
7859
7856
  }
@@ -9295,17 +9292,19 @@ function exposePropsOnRenderContext(instance) {
9295
9292
  function exposeSetupStateOnRenderContext(instance) {
9296
9293
  const { ctx, setupState } = instance;
9297
9294
  Object.keys(toRaw(setupState)).forEach(key => {
9298
- if (!setupState.__isScriptSetup && (key[0] === '$' || key[0] === '_')) {
9299
- warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
9300
- `which are reserved prefixes for Vue internals.`);
9301
- return;
9295
+ if (!setupState.__isScriptSetup) {
9296
+ if (key[0] === '$' || key[0] === '_') {
9297
+ warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
9298
+ `which are reserved prefixes for Vue internals.`);
9299
+ return;
9300
+ }
9301
+ Object.defineProperty(ctx, key, {
9302
+ enumerable: true,
9303
+ configurable: true,
9304
+ get: () => setupState[key],
9305
+ set: NOOP
9306
+ });
9302
9307
  }
9303
- Object.defineProperty(ctx, key, {
9304
- enumerable: true,
9305
- configurable: true,
9306
- get: () => setupState[key],
9307
- set: NOOP
9308
- });
9309
9308
  });
9310
9309
  }
9311
9310
 
@@ -10064,11 +10063,18 @@ function flushJobs(seen) {
10064
10063
  // 2. If a component is unmounted during a parent component's update,
10065
10064
  // its update can be skipped.
10066
10065
  queue.sort((a, b) => getId(a) - getId(b));
10066
+ // conditional usage of checkRecursiveUpdate must be determined out of
10067
+ // try ... catch block since Rollup by default de-optimizes treeshaking
10068
+ // inside try-catch. This can leave all warning code unshaked. Although
10069
+ // they would get eventually shaken by a minifier like terser, some minifiers
10070
+ // would fail to do that (e.g. https://github.com/evanw/esbuild/issues/1610)
10071
+ const check = (job) => checkRecursiveUpdates(seen, job)
10072
+ ;
10067
10073
  try {
10068
10074
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
10069
10075
  const job = queue[flushIndex];
10070
10076
  if (job && job.active !== false) {
10071
- if (true && checkRecursiveUpdates(seen, job)) {
10077
+ if (true && check(job)) {
10072
10078
  continue;
10073
10079
  }
10074
10080
  // console.log(`running:`, job.id)
@@ -10345,7 +10351,7 @@ function createPathGetter(ctx, path) {
10345
10351
  return cur;
10346
10352
  };
10347
10353
  }
10348
- function traverse(value, seen = new Set()) {
10354
+ function traverse(value, seen) {
10349
10355
  if (!isObject(value) || value["__v_skip" /* SKIP */]) {
10350
10356
  return value;
10351
10357
  }
@@ -10761,7 +10767,7 @@ function isMemoSame(cached, memo) {
10761
10767
  }
10762
10768
 
10763
10769
  // Core API ------------------------------------------------------------------
10764
- const version = "3.2.9";
10770
+ const version = "3.2.13";
10765
10771
  /**
10766
10772
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10767
10773
  * @internal
@@ -10890,19 +10896,13 @@ function patchClass(el, value, isSVG) {
10890
10896
 
10891
10897
  function patchStyle(el, prev, next) {
10892
10898
  const style = el.style;
10899
+ const currentDisplay = style.display;
10893
10900
  if (!next) {
10894
10901
  el.removeAttribute('style');
10895
10902
  }
10896
10903
  else if (isString(next)) {
10897
10904
  if (prev !== next) {
10898
- const current = style.display;
10899
10905
  style.cssText = next;
10900
- // indicates that the `display` of the element is controlled by `v-show`,
10901
- // so we always keep the current `display` value regardless of the `style` value,
10902
- // thus handing over control to `v-show`.
10903
- if ('_vod' in el) {
10904
- style.display = current;
10905
- }
10906
10906
  }
10907
10907
  }
10908
10908
  else {
@@ -10917,6 +10917,12 @@ function patchStyle(el, prev, next) {
10917
10917
  }
10918
10918
  }
10919
10919
  }
10920
+ // indicates that the `display` of the element is controlled by `v-show`,
10921
+ // so we always keep the current `display` value regardless of the `style` value,
10922
+ // thus handing over control to `v-show`.
10923
+ if ('_vod' in el) {
10924
+ style.display = currentDisplay;
10925
+ }
10920
10926
  }
10921
10927
  const importantRE = /\s*!important$/;
10922
10928
  function setStyle(style, name, val) {
@@ -11287,6 +11293,7 @@ class VueElement extends BaseClass {
11287
11293
  this._instance = null;
11288
11294
  this._connected = false;
11289
11295
  this._resolved = false;
11296
+ this._numberProps = null;
11290
11297
  if (this.shadowRoot && hydrate) {
11291
11298
  hydrate(this._createVNode(), this.shadowRoot);
11292
11299
  }
@@ -11302,18 +11309,17 @@ class VueElement extends BaseClass {
11302
11309
  this._setAttr(this.attributes[i].name);
11303
11310
  }
11304
11311
  // watch future attr changes
11305
- const observer = new MutationObserver(mutations => {
11312
+ new MutationObserver(mutations => {
11306
11313
  for (const m of mutations) {
11307
11314
  this._setAttr(m.attributeName);
11308
11315
  }
11309
- });
11310
- observer.observe(this, { attributes: true });
11316
+ }).observe(this, { attributes: true });
11311
11317
  }
11312
11318
  connectedCallback() {
11313
11319
  this._connected = true;
11314
11320
  if (!this._instance) {
11315
11321
  this._resolveDef();
11316
- render(this._createVNode(), this.shadowRoot);
11322
+ this._update();
11317
11323
  }
11318
11324
  }
11319
11325
  disconnectedCallback() {
@@ -11334,15 +11340,31 @@ class VueElement extends BaseClass {
11334
11340
  }
11335
11341
  const resolve = (def) => {
11336
11342
  this._resolved = true;
11343
+ const { props, styles } = def;
11344
+ const hasOptions = !isArray(props);
11345
+ const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
11346
+ // cast Number-type props set before resolve
11347
+ let numberProps;
11348
+ if (hasOptions) {
11349
+ for (const key in this._props) {
11350
+ const opt = props[key];
11351
+ if (opt === Number || (opt && opt.type === Number)) {
11352
+ this._props[key] = toNumber(this._props[key]);
11353
+ (numberProps || (numberProps = Object.create(null)))[key] = true;
11354
+ }
11355
+ }
11356
+ }
11357
+ if (numberProps) {
11358
+ this._numberProps = numberProps;
11359
+ this._update();
11360
+ }
11337
11361
  // check if there are props set pre-upgrade or connect
11338
11362
  for (const key of Object.keys(this)) {
11339
11363
  if (key[0] !== '_') {
11340
11364
  this._setProp(key, this[key]);
11341
11365
  }
11342
11366
  }
11343
- const { props, styles } = def;
11344
11367
  // defining getter/setters on prototype
11345
- const rawKeys = props ? (isArray(props) ? props : Object.keys(props)) : [];
11346
11368
  for (const key of rawKeys.map(camelize)) {
11347
11369
  Object.defineProperty(this, key, {
11348
11370
  get() {
@@ -11364,7 +11386,11 @@ class VueElement extends BaseClass {
11364
11386
  }
11365
11387
  }
11366
11388
  _setAttr(key) {
11367
- this._setProp(camelize(key), toNumber(this.getAttribute(key)), false);
11389
+ let value = this.getAttribute(key);
11390
+ if (this._numberProps && this._numberProps[key]) {
11391
+ value = toNumber(value);
11392
+ }
11393
+ this._setProp(camelize(key), value, false);
11368
11394
  }
11369
11395
  /**
11370
11396
  * @internal
@@ -11379,7 +11405,7 @@ class VueElement extends BaseClass {
11379
11405
  if (val !== this._props[key]) {
11380
11406
  this._props[key] = val;
11381
11407
  if (this._instance) {
11382
- render(this._createVNode(), this.shadowRoot);
11408
+ this._update();
11383
11409
  }
11384
11410
  // reflect
11385
11411
  if (shouldReflect) {
@@ -11395,6 +11421,9 @@ class VueElement extends BaseClass {
11395
11421
  }
11396
11422
  }
11397
11423
  }
11424
+ _update() {
11425
+ render(this._createVNode(), this.shadowRoot);
11426
+ }
11398
11427
  _createVNode() {
11399
11428
  const vnode = createVNode(this._def, extend({}, this._props));
11400
11429
  if (!this._instance) {
@@ -11415,7 +11444,7 @@ class VueElement extends BaseClass {
11415
11444
  if (!this._def.__asyncLoader) {
11416
11445
  // reload
11417
11446
  this._instance = null;
11418
- render(this._createVNode(), this.shadowRoot);
11447
+ this._update();
11419
11448
  }
11420
11449
  };
11421
11450
  }