@vue/compat 3.2.8 → 3.2.12

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.
@@ -1473,41 +1473,33 @@ function registerHMR(instance) {
1473
1473
  const id = instance.type.__hmrId;
1474
1474
  let record = map.get(id);
1475
1475
  if (!record) {
1476
- createRecord(id, instance.type);
1476
+ createRecord(id);
1477
1477
  record = map.get(id);
1478
1478
  }
1479
- record.instances.add(instance);
1479
+ record.add(instance);
1480
1480
  }
1481
1481
  function unregisterHMR(instance) {
1482
- map.get(instance.type.__hmrId).instances.delete(instance);
1482
+ map.get(instance.type.__hmrId).delete(instance);
1483
1483
  }
1484
- function createRecord(id, component) {
1485
- if (!component) {
1486
- warn$1(`HMR API usage is out of date.\n` +
1487
- `Please upgrade vue-loader/vite/rollup-plugin-vue or other relevant ` +
1488
- `dependency that handles Vue SFC compilation.`);
1489
- component = {};
1490
- }
1484
+ function createRecord(id) {
1491
1485
  if (map.has(id)) {
1492
1486
  return false;
1493
1487
  }
1494
- map.set(id, {
1495
- component: isClassComponent(component) ? component.__vccOpts : component,
1496
- instances: new Set()
1497
- });
1488
+ map.set(id, new Set());
1498
1489
  return true;
1499
1490
  }
1491
+ function normalizeClassComponent(component) {
1492
+ return isClassComponent(component) ? component.__vccOpts : component;
1493
+ }
1500
1494
  function rerender(id, newRender) {
1501
1495
  const record = map.get(id);
1502
- if (!record)
1496
+ if (!record) {
1503
1497
  return;
1504
- if (newRender)
1505
- record.component.render = newRender;
1506
- // Array.from creates a snapshot which avoids the set being mutated during
1507
- // updates
1508
- Array.from(record.instances).forEach(instance => {
1498
+ }
1499
+ [...record].forEach(instance => {
1509
1500
  if (newRender) {
1510
1501
  instance.render = newRender;
1502
+ normalizeClassComponent(instance.type).render = newRender;
1511
1503
  }
1512
1504
  instance.renderCache = [];
1513
1505
  // this flag forces child components with slot content to update
@@ -1520,34 +1512,31 @@ function reload(id, newComp) {
1520
1512
  const record = map.get(id);
1521
1513
  if (!record)
1522
1514
  return;
1523
- // Array.from creates a snapshot which avoids the set being mutated during
1524
- // updates
1525
- const { component, instances } = record;
1526
- if (!hmrDirtyComponents.has(component)) {
1527
- // 1. Update existing comp definition to match new one
1528
- newComp = isClassComponent(newComp) ? newComp.__vccOpts : newComp;
1529
- extend(component, newComp);
1530
- for (const key in component) {
1531
- if (key !== '__file' && !(key in newComp)) {
1532
- delete component[key];
1533
- }
1534
- }
1535
- // 2. Mark component dirty. This forces the renderer to replace the component
1536
- // on patch.
1537
- hmrDirtyComponents.add(component);
1538
- // 3. Make sure to unmark the component after the reload.
1539
- queuePostFlushCb(() => {
1540
- hmrDirtyComponents.delete(component);
1541
- });
1542
- }
1543
- Array.from(instances).forEach(instance => {
1544
- // invalidate options resolution cache
1515
+ newComp = normalizeClassComponent(newComp);
1516
+ // create a snapshot which avoids the set being mutated during updates
1517
+ const instances = [...record];
1518
+ for (const instance of instances) {
1519
+ const oldComp = normalizeClassComponent(instance.type);
1520
+ if (!hmrDirtyComponents.has(oldComp)) {
1521
+ // 1. Update existing comp definition to match new one
1522
+ extend(oldComp, newComp);
1523
+ for (const key in oldComp) {
1524
+ if (key !== '__file' && !(key in newComp)) {
1525
+ delete oldComp[key];
1526
+ }
1527
+ }
1528
+ // 2. mark definition dirty. This forces the renderer to replace the
1529
+ // component on patch.
1530
+ hmrDirtyComponents.add(oldComp);
1531
+ }
1532
+ // 3. invalidate options resolution cache
1545
1533
  instance.appContext.optionsCache.delete(instance.type);
1534
+ // 4. actually update
1546
1535
  if (instance.ceReload) {
1547
1536
  // custom element
1548
- hmrDirtyComponents.add(component);
1537
+ hmrDirtyComponents.add(oldComp);
1549
1538
  instance.ceReload(newComp.styles);
1550
- hmrDirtyComponents.delete(component);
1539
+ hmrDirtyComponents.delete(oldComp);
1551
1540
  }
1552
1541
  else if (instance.parent) {
1553
1542
  // 4. Force the parent instance to re-render. This will cause all updated
@@ -1572,6 +1561,12 @@ function reload(id, newComp) {
1572
1561
  else {
1573
1562
  console.warn('[HMR] Root or manually mounted instance modified. Full reload required.');
1574
1563
  }
1564
+ }
1565
+ // 5. make sure to cleanup dirty hmr components after update
1566
+ queuePostFlushCb(() => {
1567
+ for (const instance of instances) {
1568
+ hmrDirtyComponents.delete(normalizeClassComponent(instance.type));
1569
+ }
1575
1570
  });
1576
1571
  }
1577
1572
  function tryWrap(fn) {
@@ -2388,12 +2383,12 @@ function markAttrsAccessed() {
2388
2383
  function renderComponentRoot(instance) {
2389
2384
  const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx, inheritAttrs } = instance;
2390
2385
  let result;
2386
+ let fallthroughAttrs;
2391
2387
  const prev = setCurrentRenderingInstance(instance);
2392
2388
  if ((process.env.NODE_ENV !== 'production')) {
2393
2389
  accessedAttrs = false;
2394
2390
  }
2395
2391
  try {
2396
- let fallthroughAttrs;
2397
2392
  if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
2398
2393
  // withProxy is a proxy with a different `has` trap only for
2399
2394
  // runtime-compiled render functions using `with` block.
@@ -2424,108 +2419,106 @@ function renderComponentRoot(instance) {
2424
2419
  ? attrs
2425
2420
  : getFunctionalFallthrough(attrs);
2426
2421
  }
2427
- // attr merging
2428
- // in dev mode, comments are preserved, and it's possible for a template
2429
- // to have comments along side the root element which makes it a fragment
2430
- let root = result;
2431
- let setRoot = undefined;
2432
- if ((process.env.NODE_ENV !== 'production') &&
2433
- result.patchFlag > 0 &&
2434
- result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
2435
- ;
2436
- [root, setRoot] = getChildRoot(result);
2437
- }
2438
- if (fallthroughAttrs && inheritAttrs !== false) {
2439
- const keys = Object.keys(fallthroughAttrs);
2440
- const { shapeFlag } = root;
2441
- if (keys.length) {
2442
- if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2443
- if (propsOptions && keys.some(isModelListener)) {
2444
- // If a v-model listener (onUpdate:xxx) has a corresponding declared
2445
- // prop, it indicates this component expects to handle v-model and
2446
- // it should not fallthrough.
2447
- // related: #1543, #1643, #1989
2448
- fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
2449
- }
2450
- root = cloneVNode(root, fallthroughAttrs);
2451
- }
2452
- else if ((process.env.NODE_ENV !== 'production') && !accessedAttrs && root.type !== Comment) {
2453
- const allAttrs = Object.keys(attrs);
2454
- const eventAttrs = [];
2455
- const extraAttrs = [];
2456
- for (let i = 0, l = allAttrs.length; i < l; i++) {
2457
- const key = allAttrs[i];
2458
- if (isOn(key)) {
2459
- // ignore v-model handlers when they fail to fallthrough
2460
- if (!isModelListener(key)) {
2461
- // remove `on`, lowercase first letter to reflect event casing
2462
- // accurately
2463
- eventAttrs.push(key[2].toLowerCase() + key.slice(3));
2464
- }
2465
- }
2466
- else {
2467
- extraAttrs.push(key);
2422
+ }
2423
+ catch (err) {
2424
+ blockStack.length = 0;
2425
+ handleError(err, instance, 1 /* RENDER_FUNCTION */);
2426
+ result = createVNode(Comment);
2427
+ }
2428
+ // attr merging
2429
+ // in dev mode, comments are preserved, and it's possible for a template
2430
+ // to have comments along side the root element which makes it a fragment
2431
+ let root = result;
2432
+ let setRoot = undefined;
2433
+ if ((process.env.NODE_ENV !== 'production') &&
2434
+ result.patchFlag > 0 &&
2435
+ result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
2436
+ [root, setRoot] = getChildRoot(result);
2437
+ }
2438
+ if (fallthroughAttrs && inheritAttrs !== false) {
2439
+ const keys = Object.keys(fallthroughAttrs);
2440
+ const { shapeFlag } = root;
2441
+ if (keys.length) {
2442
+ if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2443
+ if (propsOptions && keys.some(isModelListener)) {
2444
+ // If a v-model listener (onUpdate:xxx) has a corresponding declared
2445
+ // prop, it indicates this component expects to handle v-model and
2446
+ // it should not fallthrough.
2447
+ // related: #1543, #1643, #1989
2448
+ fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
2449
+ }
2450
+ root = cloneVNode(root, fallthroughAttrs);
2451
+ }
2452
+ else if ((process.env.NODE_ENV !== 'production') && !accessedAttrs && root.type !== Comment) {
2453
+ const allAttrs = Object.keys(attrs);
2454
+ const eventAttrs = [];
2455
+ const extraAttrs = [];
2456
+ for (let i = 0, l = allAttrs.length; i < l; i++) {
2457
+ const key = allAttrs[i];
2458
+ if (isOn(key)) {
2459
+ // ignore v-model handlers when they fail to fallthrough
2460
+ if (!isModelListener(key)) {
2461
+ // remove `on`, lowercase first letter to reflect event casing
2462
+ // accurately
2463
+ eventAttrs.push(key[2].toLowerCase() + key.slice(3));
2468
2464
  }
2469
2465
  }
2470
- if (extraAttrs.length) {
2471
- warn$1(`Extraneous non-props attributes (` +
2472
- `${extraAttrs.join(', ')}) ` +
2473
- `were passed to component but could not be automatically inherited ` +
2474
- `because component renders fragment or text root nodes.`);
2475
- }
2476
- if (eventAttrs.length) {
2477
- warn$1(`Extraneous non-emits event listeners (` +
2478
- `${eventAttrs.join(', ')}) ` +
2479
- `were passed to component but could not be automatically inherited ` +
2480
- `because component renders fragment or text root nodes. ` +
2481
- `If the listener is intended to be a component custom event listener only, ` +
2482
- `declare it using the "emits" option.`);
2466
+ else {
2467
+ extraAttrs.push(key);
2483
2468
  }
2484
2469
  }
2485
- }
2486
- }
2487
- if (true &&
2488
- isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
2489
- vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
2490
- root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2491
- const { class: cls, style } = vnode.props || {};
2492
- if (cls || style) {
2493
- if ((process.env.NODE_ENV !== 'production') && inheritAttrs === false) {
2494
- warnDeprecation("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance, getComponentName(instance.type));
2470
+ if (extraAttrs.length) {
2471
+ warn$1(`Extraneous non-props attributes (` +
2472
+ `${extraAttrs.join(', ')}) ` +
2473
+ `were passed to component but could not be automatically inherited ` +
2474
+ `because component renders fragment or text root nodes.`);
2475
+ }
2476
+ if (eventAttrs.length) {
2477
+ warn$1(`Extraneous non-emits event listeners (` +
2478
+ `${eventAttrs.join(', ')}) ` +
2479
+ `were passed to component but could not be automatically inherited ` +
2480
+ `because component renders fragment or text root nodes. ` +
2481
+ `If the listener is intended to be a component custom event listener only, ` +
2482
+ `declare it using the "emits" option.`);
2495
2483
  }
2496
- root = cloneVNode(root, {
2497
- class: cls,
2498
- style: style
2499
- });
2500
- }
2501
- }
2502
- // inherit directives
2503
- if (vnode.dirs) {
2504
- if ((process.env.NODE_ENV !== 'production') && !isElementRoot(root)) {
2505
- warn$1(`Runtime directive used on component with non-element root node. ` +
2506
- `The directives will not function as intended.`);
2507
2484
  }
2508
- root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2509
2485
  }
2510
- // inherit transition data
2511
- if (vnode.transition) {
2512
- if ((process.env.NODE_ENV !== 'production') && !isElementRoot(root)) {
2513
- warn$1(`Component inside <Transition> renders non-element root node ` +
2514
- `that cannot be animated.`);
2486
+ }
2487
+ if (isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
2488
+ vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
2489
+ root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2490
+ const { class: cls, style } = vnode.props || {};
2491
+ if (cls || style) {
2492
+ if ((process.env.NODE_ENV !== 'production') && inheritAttrs === false) {
2493
+ warnDeprecation("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance, getComponentName(instance.type));
2515
2494
  }
2516
- root.transition = vnode.transition;
2495
+ root = cloneVNode(root, {
2496
+ class: cls,
2497
+ style: style
2498
+ });
2517
2499
  }
2518
- if ((process.env.NODE_ENV !== 'production') && setRoot) {
2519
- setRoot(root);
2500
+ }
2501
+ // inherit directives
2502
+ if (vnode.dirs) {
2503
+ if ((process.env.NODE_ENV !== 'production') && !isElementRoot(root)) {
2504
+ warn$1(`Runtime directive used on component with non-element root node. ` +
2505
+ `The directives will not function as intended.`);
2520
2506
  }
2521
- else {
2522
- result = root;
2507
+ root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2508
+ }
2509
+ // inherit transition data
2510
+ if (vnode.transition) {
2511
+ if ((process.env.NODE_ENV !== 'production') && !isElementRoot(root)) {
2512
+ warn$1(`Component inside <Transition> renders non-element root node ` +
2513
+ `that cannot be animated.`);
2523
2514
  }
2515
+ root.transition = vnode.transition;
2524
2516
  }
2525
- catch (err) {
2526
- blockStack.length = 0;
2527
- handleError(err, instance, 1 /* RENDER_FUNCTION */);
2528
- result = createVNode(Comment);
2517
+ if ((process.env.NODE_ENV !== 'production') && setRoot) {
2518
+ setRoot(root);
2519
+ }
2520
+ else {
2521
+ result = root;
2529
2522
  }
2530
2523
  setCurrentRenderingInstance(prev);
2531
2524
  return result;
@@ -3060,8 +3053,8 @@ function normalizeSuspenseChildren(vnode) {
3060
3053
  function normalizeSuspenseSlot(s) {
3061
3054
  let block;
3062
3055
  if (isFunction(s)) {
3063
- const isCompiledSlot = s._c;
3064
- if (isCompiledSlot) {
3056
+ const trackBlock = isBlockTreeEnabled && s._c;
3057
+ if (trackBlock) {
3065
3058
  // disableTracking: false
3066
3059
  // allow block tracking for compiled slots
3067
3060
  // (see ./componentRenderContext.ts)
@@ -3069,7 +3062,7 @@ function normalizeSuspenseSlot(s) {
3069
3062
  openBlock();
3070
3063
  }
3071
3064
  s = s();
3072
- if (isCompiledSlot) {
3065
+ if (trackBlock) {
3073
3066
  s._d = true;
3074
3067
  block = currentBlock;
3075
3068
  closeBlock();
@@ -5234,7 +5227,7 @@ function createCompatVue(createApp, createSingletonApp) {
5234
5227
  return vm;
5235
5228
  }
5236
5229
  }
5237
- Vue.version = "3.2.8";
5230
+ Vue.version = "3.2.12";
5238
5231
  Vue.config = singletonApp.config;
5239
5232
  Vue.use = (p, ...options) => {
5240
5233
  if (p && isFunction(p.install)) {
@@ -7935,7 +7928,11 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
7935
7928
  return Component;
7936
7929
  }
7937
7930
  if ((process.env.NODE_ENV !== 'production') && warnMissing && !res) {
7938
- warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}`);
7931
+ const extra = type === COMPONENTS
7932
+ ? `\nIf this is a native custom element, make sure to exclude it from ` +
7933
+ `component resolution via compilerOptions.isCustomElement.`
7934
+ : ``;
7935
+ warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
7939
7936
  }
7940
7937
  return res;
7941
7938
  }
@@ -9382,17 +9379,19 @@ function exposePropsOnRenderContext(instance) {
9382
9379
  function exposeSetupStateOnRenderContext(instance) {
9383
9380
  const { ctx, setupState } = instance;
9384
9381
  Object.keys(toRaw(setupState)).forEach(key => {
9385
- if (!setupState.__isScriptSetup && (key[0] === '$' || key[0] === '_')) {
9386
- warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
9387
- `which are reserved prefixes for Vue internals.`);
9388
- return;
9382
+ if (!setupState.__isScriptSetup) {
9383
+ if (key[0] === '$' || key[0] === '_') {
9384
+ warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
9385
+ `which are reserved prefixes for Vue internals.`);
9386
+ return;
9387
+ }
9388
+ Object.defineProperty(ctx, key, {
9389
+ enumerable: true,
9390
+ configurable: true,
9391
+ get: () => setupState[key],
9392
+ set: NOOP
9393
+ });
9389
9394
  }
9390
- Object.defineProperty(ctx, key, {
9391
- enumerable: true,
9392
- configurable: true,
9393
- get: () => setupState[key],
9394
- set: NOOP
9395
- });
9396
9395
  });
9397
9396
  }
9398
9397
 
@@ -10176,11 +10175,19 @@ function flushJobs(seen) {
10176
10175
  // 2. If a component is unmounted during a parent component's update,
10177
10176
  // its update can be skipped.
10178
10177
  queue.sort((a, b) => getId(a) - getId(b));
10178
+ // conditional usage of checkRecursiveUpdate must be determined out of
10179
+ // try ... catch block since Rollup by default de-optimizes treeshaking
10180
+ // inside try-catch. This can leave all warning code unshaked. Although
10181
+ // they would get eventually shaken by a minifier like terser, some minifiers
10182
+ // would fail to do that (e.g. https://github.com/evanw/esbuild/issues/1610)
10183
+ const check = (process.env.NODE_ENV !== 'production')
10184
+ ? (job) => checkRecursiveUpdates(seen, job)
10185
+ : NOOP;
10179
10186
  try {
10180
10187
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
10181
10188
  const job = queue[flushIndex];
10182
10189
  if (job && job.active !== false) {
10183
- if ((process.env.NODE_ENV !== 'production') && checkRecursiveUpdates(seen, job)) {
10190
+ if ((process.env.NODE_ENV !== 'production') && check(job)) {
10184
10191
  continue;
10185
10192
  }
10186
10193
  // console.log(`running:`, job.id)
@@ -10526,7 +10533,7 @@ function defineExpose(exposed) {
10526
10533
  }
10527
10534
  /**
10528
10535
  * Vue `<script setup>` compiler macro for providing props default values when
10529
- * using type-based `defineProps` decalration.
10536
+ * using type-based `defineProps` declaration.
10530
10537
  *
10531
10538
  * Example usage:
10532
10539
  * ```ts
@@ -10875,7 +10882,7 @@ function isMemoSame(cached, memo) {
10875
10882
  }
10876
10883
 
10877
10884
  // Core API ------------------------------------------------------------------
10878
- const version = "3.2.8";
10885
+ const version = "3.2.12";
10879
10886
  const _ssrUtils = {
10880
10887
  createComponentInstance,
10881
10888
  setupComponent,
@@ -11012,19 +11019,13 @@ function patchClass(el, value, isSVG) {
11012
11019
 
11013
11020
  function patchStyle(el, prev, next) {
11014
11021
  const style = el.style;
11022
+ const currentDisplay = style.display;
11015
11023
  if (!next) {
11016
11024
  el.removeAttribute('style');
11017
11025
  }
11018
11026
  else if (isString(next)) {
11019
11027
  if (prev !== next) {
11020
- const current = style.display;
11021
11028
  style.cssText = next;
11022
- // indicates that the `display` of the element is controlled by `v-show`,
11023
- // so we always keep the current `display` value regardless of the `style` value,
11024
- // thus handing over control to `v-show`.
11025
- if ('_vod' in el) {
11026
- style.display = current;
11027
- }
11028
11029
  }
11029
11030
  }
11030
11031
  else {
@@ -11039,6 +11040,12 @@ function patchStyle(el, prev, next) {
11039
11040
  }
11040
11041
  }
11041
11042
  }
11043
+ // indicates that the `display` of the element is controlled by `v-show`,
11044
+ // so we always keep the current `display` value regardless of the `style` value,
11045
+ // thus handing over control to `v-show`.
11046
+ if ('_vod' in el) {
11047
+ style.display = currentDisplay;
11048
+ }
11042
11049
  }
11043
11050
  const importantRE = /\s*!important$/;
11044
11051
  function setStyle(style, name, val) {
@@ -11410,6 +11417,7 @@ class VueElement extends BaseClass {
11410
11417
  this._instance = null;
11411
11418
  this._connected = false;
11412
11419
  this._resolved = false;
11420
+ this._numberProps = null;
11413
11421
  if (this.shadowRoot && hydrate) {
11414
11422
  hydrate(this._createVNode(), this.shadowRoot);
11415
11423
  }
@@ -11425,18 +11433,17 @@ class VueElement extends BaseClass {
11425
11433
  this._setAttr(this.attributes[i].name);
11426
11434
  }
11427
11435
  // watch future attr changes
11428
- const observer = new MutationObserver(mutations => {
11436
+ new MutationObserver(mutations => {
11429
11437
  for (const m of mutations) {
11430
11438
  this._setAttr(m.attributeName);
11431
11439
  }
11432
- });
11433
- observer.observe(this, { attributes: true });
11440
+ }).observe(this, { attributes: true });
11434
11441
  }
11435
11442
  connectedCallback() {
11436
11443
  this._connected = true;
11437
11444
  if (!this._instance) {
11438
11445
  this._resolveDef();
11439
- render(this._createVNode(), this.shadowRoot);
11446
+ this._update();
11440
11447
  }
11441
11448
  }
11442
11449
  disconnectedCallback() {
@@ -11457,15 +11464,31 @@ class VueElement extends BaseClass {
11457
11464
  }
11458
11465
  const resolve = (def) => {
11459
11466
  this._resolved = true;
11467
+ const { props, styles } = def;
11468
+ const hasOptions = !isArray(props);
11469
+ const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
11470
+ // cast Number-type props set before resolve
11471
+ let numberProps;
11472
+ if (hasOptions) {
11473
+ for (const key in this._props) {
11474
+ const opt = props[key];
11475
+ if (opt === Number || (opt && opt.type === Number)) {
11476
+ this._props[key] = toNumber(this._props[key]);
11477
+ (numberProps || (numberProps = Object.create(null)))[key] = true;
11478
+ }
11479
+ }
11480
+ }
11481
+ if (numberProps) {
11482
+ this._numberProps = numberProps;
11483
+ this._update();
11484
+ }
11460
11485
  // check if there are props set pre-upgrade or connect
11461
11486
  for (const key of Object.keys(this)) {
11462
11487
  if (key[0] !== '_') {
11463
11488
  this._setProp(key, this[key]);
11464
11489
  }
11465
11490
  }
11466
- const { props, styles } = def;
11467
11491
  // defining getter/setters on prototype
11468
- const rawKeys = props ? (isArray(props) ? props : Object.keys(props)) : [];
11469
11492
  for (const key of rawKeys.map(camelize)) {
11470
11493
  Object.defineProperty(this, key, {
11471
11494
  get() {
@@ -11487,7 +11510,11 @@ class VueElement extends BaseClass {
11487
11510
  }
11488
11511
  }
11489
11512
  _setAttr(key) {
11490
- this._setProp(camelize(key), toNumber(this.getAttribute(key)), false);
11513
+ let value = this.getAttribute(key);
11514
+ if (this._numberProps && this._numberProps[key]) {
11515
+ value = toNumber(value);
11516
+ }
11517
+ this._setProp(camelize(key), value, false);
11491
11518
  }
11492
11519
  /**
11493
11520
  * @internal
@@ -11502,7 +11529,7 @@ class VueElement extends BaseClass {
11502
11529
  if (val !== this._props[key]) {
11503
11530
  this._props[key] = val;
11504
11531
  if (this._instance) {
11505
- render(this._createVNode(), this.shadowRoot);
11532
+ this._update();
11506
11533
  }
11507
11534
  // reflect
11508
11535
  if (shouldReflect) {
@@ -11518,6 +11545,9 @@ class VueElement extends BaseClass {
11518
11545
  }
11519
11546
  }
11520
11547
  }
11548
+ _update() {
11549
+ render(this._createVNode(), this.shadowRoot);
11550
+ }
11521
11551
  _createVNode() {
11522
11552
  const vnode = createVNode(this._def, extend({}, this._props));
11523
11553
  if (!this._instance) {
@@ -11538,7 +11568,7 @@ class VueElement extends BaseClass {
11538
11568
  if (!this._def.__asyncLoader) {
11539
11569
  // reload
11540
11570
  this._instance = null;
11541
- render(this._createVNode(), this.shadowRoot);
11571
+ this._update();
11542
11572
  }
11543
11573
  };
11544
11574
  }