vue 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.
@@ -1456,41 +1456,33 @@ function registerHMR(instance) {
1456
1456
  const id = instance.type.__hmrId;
1457
1457
  let record = map.get(id);
1458
1458
  if (!record) {
1459
- createRecord(id, instance.type);
1459
+ createRecord(id);
1460
1460
  record = map.get(id);
1461
1461
  }
1462
- record.instances.add(instance);
1462
+ record.add(instance);
1463
1463
  }
1464
1464
  function unregisterHMR(instance) {
1465
- map.get(instance.type.__hmrId).instances.delete(instance);
1465
+ map.get(instance.type.__hmrId).delete(instance);
1466
1466
  }
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
- }
1467
+ function createRecord(id) {
1474
1468
  if (map.has(id)) {
1475
1469
  return false;
1476
1470
  }
1477
- map.set(id, {
1478
- component: isClassComponent(component) ? component.__vccOpts : component,
1479
- instances: new Set()
1480
- });
1471
+ map.set(id, new Set());
1481
1472
  return true;
1482
1473
  }
1474
+ function normalizeClassComponent(component) {
1475
+ return isClassComponent(component) ? component.__vccOpts : component;
1476
+ }
1483
1477
  function rerender(id, newRender) {
1484
1478
  const record = map.get(id);
1485
- if (!record)
1479
+ if (!record) {
1486
1480
  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 => {
1481
+ }
1482
+ [...record].forEach(instance => {
1492
1483
  if (newRender) {
1493
1484
  instance.render = newRender;
1485
+ normalizeClassComponent(instance.type).render = newRender;
1494
1486
  }
1495
1487
  instance.renderCache = [];
1496
1488
  // this flag forces child components with slot content to update
@@ -1503,34 +1495,31 @@ function reload(id, newComp) {
1503
1495
  const record = map.get(id);
1504
1496
  if (!record)
1505
1497
  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
1498
+ newComp = normalizeClassComponent(newComp);
1499
+ // create a snapshot which avoids the set being mutated during updates
1500
+ const instances = [...record];
1501
+ for (const instance of instances) {
1502
+ const oldComp = normalizeClassComponent(instance.type);
1503
+ if (!hmrDirtyComponents.has(oldComp)) {
1504
+ // 1. Update existing comp definition to match new one
1505
+ extend(oldComp, newComp);
1506
+ for (const key in oldComp) {
1507
+ if (key !== '__file' && !(key in newComp)) {
1508
+ delete oldComp[key];
1509
+ }
1510
+ }
1511
+ // 2. mark definition dirty. This forces the renderer to replace the
1512
+ // component on patch.
1513
+ hmrDirtyComponents.add(oldComp);
1514
+ }
1515
+ // 3. invalidate options resolution cache
1528
1516
  instance.appContext.optionsCache.delete(instance.type);
1517
+ // 4. actually update
1529
1518
  if (instance.ceReload) {
1530
1519
  // custom element
1531
- hmrDirtyComponents.add(component);
1520
+ hmrDirtyComponents.add(oldComp);
1532
1521
  instance.ceReload(newComp.styles);
1533
- hmrDirtyComponents.delete(component);
1522
+ hmrDirtyComponents.delete(oldComp);
1534
1523
  }
1535
1524
  else if (instance.parent) {
1536
1525
  // 4. Force the parent instance to re-render. This will cause all updated
@@ -1555,6 +1544,12 @@ function reload(id, newComp) {
1555
1544
  else {
1556
1545
  console.warn('[HMR] Root or manually mounted instance modified. Full reload required.');
1557
1546
  }
1547
+ }
1548
+ // 5. make sure to cleanup dirty hmr components after update
1549
+ queuePostFlushCb(() => {
1550
+ for (const instance of instances) {
1551
+ hmrDirtyComponents.delete(normalizeClassComponent(instance.type));
1552
+ }
1558
1553
  });
1559
1554
  }
1560
1555
  function tryWrap(fn) {
@@ -1617,335 +1612,6 @@ function devtoolsComponentEmit(component, event, params) {
1617
1612
  devtools.emit("component:emit" /* COMPONENT_EMIT */, component.appContext.app, component, event, params);
1618
1613
  }
1619
1614
 
1620
- const deprecationData = {
1621
- ["GLOBAL_MOUNT" /* GLOBAL_MOUNT */]: {
1622
- message: `The global app bootstrapping API has changed: vm.$mount() and the "el" ` +
1623
- `option have been removed. Use createApp(RootComponent).mount() instead.`,
1624
- link: `https://v3.vuejs.org/guide/migration/global-api.html#mounting-app-instance`
1625
- },
1626
- ["GLOBAL_MOUNT_CONTAINER" /* GLOBAL_MOUNT_CONTAINER */]: {
1627
- message: `Vue detected directives on the mount container. ` +
1628
- `In Vue 3, the container is no longer considered part of the template ` +
1629
- `and will not be processed/replaced.`,
1630
- link: `https://v3.vuejs.org/guide/migration/mount-changes.html`
1631
- },
1632
- ["GLOBAL_EXTEND" /* GLOBAL_EXTEND */]: {
1633
- message: `Vue.extend() has been removed in Vue 3. ` +
1634
- `Use defineComponent() instead.`,
1635
- link: `https://v3.vuejs.org/api/global-api.html#definecomponent`
1636
- },
1637
- ["GLOBAL_PROTOTYPE" /* GLOBAL_PROTOTYPE */]: {
1638
- message: `Vue.prototype is no longer available in Vue 3. ` +
1639
- `Use app.config.globalProperties instead.`,
1640
- link: `https://v3.vuejs.org/guide/migration/global-api.html#vue-prototype-replaced-by-config-globalproperties`
1641
- },
1642
- ["GLOBAL_SET" /* GLOBAL_SET */]: {
1643
- message: `Vue.set() has been removed as it is no longer needed in Vue 3. ` +
1644
- `Simply use native JavaScript mutations.`
1645
- },
1646
- ["GLOBAL_DELETE" /* GLOBAL_DELETE */]: {
1647
- message: `Vue.delete() has been removed as it is no longer needed in Vue 3. ` +
1648
- `Simply use native JavaScript mutations.`
1649
- },
1650
- ["GLOBAL_OBSERVABLE" /* GLOBAL_OBSERVABLE */]: {
1651
- message: `Vue.observable() has been removed. ` +
1652
- `Use \`import { reactive } from "vue"\` from Composition API instead.`,
1653
- link: `https://v3.vuejs.org/api/basic-reactivity.html`
1654
- },
1655
- ["GLOBAL_PRIVATE_UTIL" /* GLOBAL_PRIVATE_UTIL */]: {
1656
- message: `Vue.util has been removed. Please refactor to avoid its usage ` +
1657
- `since it was an internal API even in Vue 2.`
1658
- },
1659
- ["CONFIG_SILENT" /* CONFIG_SILENT */]: {
1660
- message: `config.silent has been removed because it is not good practice to ` +
1661
- `intentionally suppress warnings. You can use your browser console's ` +
1662
- `filter features to focus on relevant messages.`
1663
- },
1664
- ["CONFIG_DEVTOOLS" /* CONFIG_DEVTOOLS */]: {
1665
- message: `config.devtools has been removed. To enable devtools for ` +
1666
- `production, configure the __VUE_PROD_DEVTOOLS__ compile-time flag.`,
1667
- link: `https://github.com/vuejs/vue-next/tree/master/packages/vue#bundler-build-feature-flags`
1668
- },
1669
- ["CONFIG_KEY_CODES" /* CONFIG_KEY_CODES */]: {
1670
- message: `config.keyCodes has been removed. ` +
1671
- `In Vue 3, you can directly use the kebab-case key names as v-on modifiers.`,
1672
- link: `https://v3.vuejs.org/guide/migration/keycode-modifiers.html`
1673
- },
1674
- ["CONFIG_PRODUCTION_TIP" /* CONFIG_PRODUCTION_TIP */]: {
1675
- message: `config.productionTip has been removed.`,
1676
- link: `https://v3.vuejs.org/guide/migration/global-api.html#config-productiontip-removed`
1677
- },
1678
- ["CONFIG_IGNORED_ELEMENTS" /* CONFIG_IGNORED_ELEMENTS */]: {
1679
- message: () => {
1680
- let msg = `config.ignoredElements has been removed.`;
1681
- if (isRuntimeOnly()) {
1682
- msg += ` Pass the "isCustomElement" option to @vue/compiler-dom instead.`;
1683
- }
1684
- else {
1685
- msg += ` Use config.isCustomElement instead.`;
1686
- }
1687
- return msg;
1688
- },
1689
- link: `https://v3.vuejs.org/guide/migration/global-api.html#config-ignoredelements-is-now-config-iscustomelement`
1690
- },
1691
- ["CONFIG_WHITESPACE" /* CONFIG_WHITESPACE */]: {
1692
- // this warning is only relevant in the full build when using runtime
1693
- // compilation, so it's put in the runtime compatConfig list.
1694
- message: `Vue 3 compiler's whitespace option will default to "condense" instead of ` +
1695
- `"preserve". To suppress this warning, provide an explicit value for ` +
1696
- `\`config.compilerOptions.whitespace\`.`
1697
- },
1698
- ["CONFIG_OPTION_MERGE_STRATS" /* CONFIG_OPTION_MERGE_STRATS */]: {
1699
- message: `config.optionMergeStrategies no longer exposes internal strategies. ` +
1700
- `Use custom merge functions instead.`
1701
- },
1702
- ["INSTANCE_SET" /* INSTANCE_SET */]: {
1703
- message: `vm.$set() has been removed as it is no longer needed in Vue 3. ` +
1704
- `Simply use native JavaScript mutations.`
1705
- },
1706
- ["INSTANCE_DELETE" /* INSTANCE_DELETE */]: {
1707
- message: `vm.$delete() has been removed as it is no longer needed in Vue 3. ` +
1708
- `Simply use native JavaScript mutations.`
1709
- },
1710
- ["INSTANCE_DESTROY" /* INSTANCE_DESTROY */]: {
1711
- message: `vm.$destroy() has been removed. Use app.unmount() instead.`,
1712
- link: `https://v3.vuejs.org/api/application-api.html#unmount`
1713
- },
1714
- ["INSTANCE_EVENT_EMITTER" /* INSTANCE_EVENT_EMITTER */]: {
1715
- message: `vm.$on/$once/$off() have been removed. ` +
1716
- `Use an external event emitter library instead.`,
1717
- link: `https://v3.vuejs.org/guide/migration/events-api.html`
1718
- },
1719
- ["INSTANCE_EVENT_HOOKS" /* INSTANCE_EVENT_HOOKS */]: {
1720
- message: event => `"${event}" lifecycle events are no longer supported. From templates, ` +
1721
- `use the "vnode" prefix instead of "hook:". For example, @${event} ` +
1722
- `should be changed to @vnode-${event.slice(5)}. ` +
1723
- `From JavaScript, use Composition API to dynamically register lifecycle ` +
1724
- `hooks.`,
1725
- link: `https://v3.vuejs.org/guide/migration/vnode-lifecycle-events.html`
1726
- },
1727
- ["INSTANCE_CHILDREN" /* INSTANCE_CHILDREN */]: {
1728
- message: `vm.$children has been removed. Consider refactoring your logic ` +
1729
- `to avoid relying on direct access to child components.`,
1730
- link: `https://v3.vuejs.org/guide/migration/children.html`
1731
- },
1732
- ["INSTANCE_LISTENERS" /* INSTANCE_LISTENERS */]: {
1733
- message: `vm.$listeners has been removed. In Vue 3, parent v-on listeners are ` +
1734
- `included in vm.$attrs and it is no longer necessary to separately use ` +
1735
- `v-on="$listeners" if you are already using v-bind="$attrs". ` +
1736
- `(Note: the Vue 3 behavior only applies if this compat config is disabled)`,
1737
- link: `https://v3.vuejs.org/guide/migration/listeners-removed.html`
1738
- },
1739
- ["INSTANCE_SCOPED_SLOTS" /* INSTANCE_SCOPED_SLOTS */]: {
1740
- message: `vm.$scopedSlots has been removed. Use vm.$slots instead.`,
1741
- link: `https://v3.vuejs.org/guide/migration/slots-unification.html`
1742
- },
1743
- ["INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */]: {
1744
- message: componentName => `Component <${componentName || 'Anonymous'}> has \`inheritAttrs: false\` but is ` +
1745
- `relying on class/style fallthrough from parent. In Vue 3, class/style ` +
1746
- `are now included in $attrs and will no longer fallthrough when ` +
1747
- `inheritAttrs is false. If you are already using v-bind="$attrs" on ` +
1748
- `component root it should render the same end result. ` +
1749
- `If you are binding $attrs to a non-root element and expecting ` +
1750
- `class/style to fallthrough on root, you will need to now manually bind ` +
1751
- `them on root via :class="$attrs.class".`,
1752
- link: `https://v3.vuejs.org/guide/migration/attrs-includes-class-style.html`
1753
- },
1754
- ["OPTIONS_DATA_FN" /* OPTIONS_DATA_FN */]: {
1755
- message: `The "data" option can no longer be a plain object. ` +
1756
- `Always use a function.`,
1757
- link: `https://v3.vuejs.org/guide/migration/data-option.html`
1758
- },
1759
- ["OPTIONS_DATA_MERGE" /* OPTIONS_DATA_MERGE */]: {
1760
- message: (key) => `Detected conflicting key "${key}" when merging data option values. ` +
1761
- `In Vue 3, data keys are merged shallowly and will override one another.`,
1762
- link: `https://v3.vuejs.org/guide/migration/data-option.html#mixin-merge-behavior-change`
1763
- },
1764
- ["OPTIONS_BEFORE_DESTROY" /* OPTIONS_BEFORE_DESTROY */]: {
1765
- message: `\`beforeDestroy\` has been renamed to \`beforeUnmount\`.`
1766
- },
1767
- ["OPTIONS_DESTROYED" /* OPTIONS_DESTROYED */]: {
1768
- message: `\`destroyed\` has been renamed to \`unmounted\`.`
1769
- },
1770
- ["WATCH_ARRAY" /* WATCH_ARRAY */]: {
1771
- message: `"watch" option or vm.$watch on an array value will no longer ` +
1772
- `trigger on array mutation unless the "deep" option is specified. ` +
1773
- `If current usage is intended, you can disable the compat behavior and ` +
1774
- `suppress this warning with:` +
1775
- `\n\n configureCompat({ ${"WATCH_ARRAY" /* WATCH_ARRAY */}: false })\n`,
1776
- link: `https://v3.vuejs.org/guide/migration/watch.html`
1777
- },
1778
- ["PROPS_DEFAULT_THIS" /* PROPS_DEFAULT_THIS */]: {
1779
- message: (key) => `props default value function no longer has access to "this". The compat ` +
1780
- `build only offers access to this.$options.` +
1781
- `(found in prop "${key}")`,
1782
- link: `https://v3.vuejs.org/guide/migration/props-default-this.html`
1783
- },
1784
- ["CUSTOM_DIR" /* CUSTOM_DIR */]: {
1785
- message: (legacyHook, newHook) => `Custom directive hook "${legacyHook}" has been removed. ` +
1786
- `Use "${newHook}" instead.`,
1787
- link: `https://v3.vuejs.org/guide/migration/custom-directives.html`
1788
- },
1789
- ["V_FOR_REF" /* V_FOR_REF */]: {
1790
- message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
1791
- `Consider using function refs or refactor to avoid ref usage altogether.`,
1792
- link: `https://v3.vuejs.org/guide/migration/array-refs.html`
1793
- },
1794
- ["V_ON_KEYCODE_MODIFIER" /* V_ON_KEYCODE_MODIFIER */]: {
1795
- message: `Using keyCode as v-on modifier is no longer supported. ` +
1796
- `Use kebab-case key name modifiers instead.`,
1797
- link: `https://v3.vuejs.org/guide/migration/keycode-modifiers.html`
1798
- },
1799
- ["ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */]: {
1800
- message: (name) => `Attribute "${name}" with v-bind value \`false\` will render ` +
1801
- `${name}="false" instead of removing it in Vue 3. To remove the attribute, ` +
1802
- `use \`null\` or \`undefined\` instead. If the usage is intended, ` +
1803
- `you can disable the compat behavior and suppress this warning with:` +
1804
- `\n\n configureCompat({ ${"ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */}: false })\n`,
1805
- link: `https://v3.vuejs.org/guide/migration/attribute-coercion.html`
1806
- },
1807
- ["ATTR_ENUMERATED_COERCION" /* ATTR_ENUMERATED_COERCION */]: {
1808
- message: (name, value, coerced) => `Enumerated attribute "${name}" with v-bind value \`${value}\` will ` +
1809
- `${value === null ? `be removed` : `render the value as-is`} instead of coercing the value to "${coerced}" in Vue 3. ` +
1810
- `Always use explicit "true" or "false" values for enumerated attributes. ` +
1811
- `If the usage is intended, ` +
1812
- `you can disable the compat behavior and suppress this warning with:` +
1813
- `\n\n configureCompat({ ${"ATTR_ENUMERATED_COERCION" /* ATTR_ENUMERATED_COERCION */}: false })\n`,
1814
- link: `https://v3.vuejs.org/guide/migration/attribute-coercion.html`
1815
- },
1816
- ["TRANSITION_CLASSES" /* TRANSITION_CLASSES */]: {
1817
- message: `` // this feature cannot be runtime-detected
1818
- },
1819
- ["TRANSITION_GROUP_ROOT" /* TRANSITION_GROUP_ROOT */]: {
1820
- message: `<TransitionGroup> no longer renders a root <span> element by ` +
1821
- `default if no "tag" prop is specified. If you do not rely on the span ` +
1822
- `for styling, you can disable the compat behavior and suppress this ` +
1823
- `warning with:` +
1824
- `\n\n configureCompat({ ${"TRANSITION_GROUP_ROOT" /* TRANSITION_GROUP_ROOT */}: false })\n`,
1825
- link: `https://v3.vuejs.org/guide/migration/transition-group.html`
1826
- },
1827
- ["COMPONENT_ASYNC" /* COMPONENT_ASYNC */]: {
1828
- message: (comp) => {
1829
- const name = getComponentName(comp);
1830
- return (`Async component${name ? ` <${name}>` : `s`} should be explicitly created via \`defineAsyncComponent()\` ` +
1831
- `in Vue 3. Plain functions will be treated as functional components in ` +
1832
- `non-compat build. If you have already migrated all async component ` +
1833
- `usage and intend to use plain functions for functional components, ` +
1834
- `you can disable the compat behavior and suppress this ` +
1835
- `warning with:` +
1836
- `\n\n configureCompat({ ${"COMPONENT_ASYNC" /* COMPONENT_ASYNC */}: false })\n`);
1837
- },
1838
- link: `https://v3.vuejs.org/guide/migration/async-components.html`
1839
- },
1840
- ["COMPONENT_FUNCTIONAL" /* COMPONENT_FUNCTIONAL */]: {
1841
- message: (comp) => {
1842
- const name = getComponentName(comp);
1843
- return (`Functional component${name ? ` <${name}>` : `s`} should be defined as a plain function in Vue 3. The "functional" ` +
1844
- `option has been removed. NOTE: Before migrating to use plain ` +
1845
- `functions for functional components, first make sure that all async ` +
1846
- `components usage have been migrated and its compat behavior has ` +
1847
- `been disabled.`);
1848
- },
1849
- link: `https://v3.vuejs.org/guide/migration/functional-components.html`
1850
- },
1851
- ["COMPONENT_V_MODEL" /* COMPONENT_V_MODEL */]: {
1852
- message: (comp) => {
1853
- const configMsg = `opt-in to ` +
1854
- `Vue 3 behavior on a per-component basis with \`compatConfig: { ${"COMPONENT_V_MODEL" /* COMPONENT_V_MODEL */}: false }\`.`;
1855
- if (comp.props &&
1856
- (isArray(comp.props)
1857
- ? comp.props.includes('modelValue')
1858
- : hasOwn(comp.props, 'modelValue'))) {
1859
- return (`Component delcares "modelValue" prop, which is Vue 3 usage, but ` +
1860
- `is running under Vue 2 compat v-model behavior. You can ${configMsg}`);
1861
- }
1862
- return (`v-model usage on component has changed in Vue 3. Component that expects ` +
1863
- `to work with v-model should now use the "modelValue" prop and emit the ` +
1864
- `"update:modelValue" event. You can update the usage and then ${configMsg}`);
1865
- },
1866
- link: `https://v3.vuejs.org/guide/migration/v-model.html`
1867
- },
1868
- ["RENDER_FUNCTION" /* RENDER_FUNCTION */]: {
1869
- message: `Vue 3's render function API has changed. ` +
1870
- `You can opt-in to the new API with:` +
1871
- `\n\n configureCompat({ ${"RENDER_FUNCTION" /* RENDER_FUNCTION */}: false })\n` +
1872
- `\n (This can also be done per-component via the "compatConfig" option.)`,
1873
- link: `https://v3.vuejs.org/guide/migration/render-function-api.html`
1874
- },
1875
- ["FILTERS" /* FILTERS */]: {
1876
- message: `filters have been removed in Vue 3. ` +
1877
- `The "|" symbol will be treated as native JavaScript bitwise OR operator. ` +
1878
- `Use method calls or computed properties instead.`,
1879
- link: `https://v3.vuejs.org/guide/migration/filters.html`
1880
- },
1881
- ["PRIVATE_APIS" /* PRIVATE_APIS */]: {
1882
- message: name => `"${name}" is a Vue 2 private API that no longer exists in Vue 3. ` +
1883
- `If you are seeing this warning only due to a dependency, you can ` +
1884
- `suppress this warning via { PRIVATE_APIS: 'supress-warning' }.`
1885
- }
1886
- };
1887
- const instanceWarned = Object.create(null);
1888
- const warnCount = Object.create(null);
1889
- function warnDeprecation(key, instance, ...args) {
1890
- instance = instance || getCurrentInstance();
1891
- // check user config
1892
- const config = getCompatConfigForKey(key, instance);
1893
- if (config === 'suppress-warning') {
1894
- return;
1895
- }
1896
- const dupKey = key + args.join('');
1897
- let compId = instance && formatComponentName(instance, instance.type);
1898
- if (compId === 'Anonymous' && instance) {
1899
- compId = instance.uid;
1900
- }
1901
- // skip if the same warning is emitted for the same component type
1902
- const componentDupKey = dupKey + compId;
1903
- if (componentDupKey in instanceWarned) {
1904
- return;
1905
- }
1906
- instanceWarned[componentDupKey] = true;
1907
- // same warning, but different component. skip the long message and just
1908
- // log the key and count.
1909
- if (dupKey in warnCount) {
1910
- warn$1(`(deprecation ${key}) (${++warnCount[dupKey] + 1})`);
1911
- return;
1912
- }
1913
- warnCount[dupKey] = 0;
1914
- const { message, link } = deprecationData[key];
1915
- warn$1(`(deprecation ${key}) ${typeof message === 'function' ? message(...args) : message}${link ? `\n Details: ${link}` : ``}`);
1916
- if (!isCompatEnabled(key, instance, true)) {
1917
- console.error(`^ The above deprecation's compat behavior is disabled and will likely ` +
1918
- `lead to runtime errors.`);
1919
- }
1920
- }
1921
- const globalCompatConfig = {
1922
- MODE: 2
1923
- };
1924
- function getCompatConfigForKey(key, instance) {
1925
- const instanceConfig = instance && instance.type.compatConfig;
1926
- if (instanceConfig && key in instanceConfig) {
1927
- return instanceConfig[key];
1928
- }
1929
- return globalCompatConfig[key];
1930
- }
1931
- function isCompatEnabled(key, instance, enableForBuiltIn = false) {
1932
- // skip compat for built-in components
1933
- if (!enableForBuiltIn && instance && instance.type.__isBuiltIn) {
1934
- return false;
1935
- }
1936
- const rawMode = getCompatConfigForKey('MODE', instance) || 2;
1937
- const val = getCompatConfigForKey(key, instance);
1938
- const mode = isFunction(rawMode)
1939
- ? rawMode(instance && instance.type)
1940
- : rawMode;
1941
- if (mode === 2) {
1942
- return val !== false;
1943
- }
1944
- else {
1945
- return val === true || val === 'suppress-warning';
1946
- }
1947
- }
1948
-
1949
1615
  function emit(instance, event, ...rawArgs) {
1950
1616
  const props = instance.vnode.props || EMPTY_OBJ;
1951
1617
  {
@@ -2171,12 +1837,12 @@ function markAttrsAccessed() {
2171
1837
  function renderComponentRoot(instance) {
2172
1838
  const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx, inheritAttrs } = instance;
2173
1839
  let result;
1840
+ let fallthroughAttrs;
2174
1841
  const prev = setCurrentRenderingInstance(instance);
2175
1842
  {
2176
1843
  accessedAttrs = false;
2177
1844
  }
2178
1845
  try {
2179
- let fallthroughAttrs;
2180
1846
  if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
2181
1847
  // withProxy is a proxy with a different `has` trap only for
2182
1848
  // runtime-compiled render functions using `with` block.
@@ -2207,97 +1873,91 @@ function renderComponentRoot(instance) {
2207
1873
  ? attrs
2208
1874
  : getFunctionalFallthrough(attrs);
2209
1875
  }
2210
- // attr merging
2211
- // in dev mode, comments are preserved, and it's possible for a template
2212
- // to have comments along side the root element which makes it a fragment
2213
- let root = result;
2214
- let setRoot = undefined;
2215
- if (true &&
2216
- result.patchFlag > 0 &&
2217
- result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
2218
- ;
2219
- [root, setRoot] = getChildRoot(result);
2220
- }
2221
- if (fallthroughAttrs && inheritAttrs !== false) {
2222
- const keys = Object.keys(fallthroughAttrs);
2223
- const { shapeFlag } = root;
2224
- if (keys.length) {
2225
- if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2226
- if (propsOptions && keys.some(isModelListener)) {
2227
- // If a v-model listener (onUpdate:xxx) has a corresponding declared
2228
- // prop, it indicates this component expects to handle v-model and
2229
- // it should not fallthrough.
2230
- // related: #1543, #1643, #1989
2231
- fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
2232
- }
2233
- root = cloneVNode(root, fallthroughAttrs);
2234
- }
2235
- else if (true && !accessedAttrs && root.type !== Comment) {
2236
- const allAttrs = Object.keys(attrs);
2237
- const eventAttrs = [];
2238
- const extraAttrs = [];
2239
- for (let i = 0, l = allAttrs.length; i < l; i++) {
2240
- const key = allAttrs[i];
2241
- if (isOn(key)) {
2242
- // ignore v-model handlers when they fail to fallthrough
2243
- if (!isModelListener(key)) {
2244
- // remove `on`, lowercase first letter to reflect event casing
2245
- // accurately
2246
- eventAttrs.push(key[2].toLowerCase() + key.slice(3));
2247
- }
2248
- }
2249
- else {
2250
- extraAttrs.push(key);
1876
+ }
1877
+ catch (err) {
1878
+ blockStack.length = 0;
1879
+ handleError(err, instance, 1 /* RENDER_FUNCTION */);
1880
+ result = createVNode(Comment);
1881
+ }
1882
+ // attr merging
1883
+ // in dev mode, comments are preserved, and it's possible for a template
1884
+ // to have comments along side the root element which makes it a fragment
1885
+ let root = result;
1886
+ let setRoot = undefined;
1887
+ if (result.patchFlag > 0 &&
1888
+ result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
1889
+ [root, setRoot] = getChildRoot(result);
1890
+ }
1891
+ if (fallthroughAttrs && inheritAttrs !== false) {
1892
+ const keys = Object.keys(fallthroughAttrs);
1893
+ const { shapeFlag } = root;
1894
+ if (keys.length) {
1895
+ if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
1896
+ if (propsOptions && keys.some(isModelListener)) {
1897
+ // If a v-model listener (onUpdate:xxx) has a corresponding declared
1898
+ // prop, it indicates this component expects to handle v-model and
1899
+ // it should not fallthrough.
1900
+ // related: #1543, #1643, #1989
1901
+ fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
1902
+ }
1903
+ root = cloneVNode(root, fallthroughAttrs);
1904
+ }
1905
+ else if (!accessedAttrs && root.type !== Comment) {
1906
+ const allAttrs = Object.keys(attrs);
1907
+ const eventAttrs = [];
1908
+ const extraAttrs = [];
1909
+ for (let i = 0, l = allAttrs.length; i < l; i++) {
1910
+ const key = allAttrs[i];
1911
+ if (isOn(key)) {
1912
+ // ignore v-model handlers when they fail to fallthrough
1913
+ if (!isModelListener(key)) {
1914
+ // remove `on`, lowercase first letter to reflect event casing
1915
+ // accurately
1916
+ eventAttrs.push(key[2].toLowerCase() + key.slice(3));
2251
1917
  }
2252
1918
  }
2253
- if (extraAttrs.length) {
2254
- warn$1(`Extraneous non-props attributes (` +
2255
- `${extraAttrs.join(', ')}) ` +
2256
- `were passed to component but could not be automatically inherited ` +
2257
- `because component renders fragment or text root nodes.`);
2258
- }
2259
- if (eventAttrs.length) {
2260
- warn$1(`Extraneous non-emits event listeners (` +
2261
- `${eventAttrs.join(', ')}) ` +
2262
- `were passed to component but could not be automatically inherited ` +
2263
- `because component renders fragment or text root nodes. ` +
2264
- `If the listener is intended to be a component custom event listener only, ` +
2265
- `declare it using the "emits" option.`);
1919
+ else {
1920
+ extraAttrs.push(key);
2266
1921
  }
2267
1922
  }
1923
+ if (extraAttrs.length) {
1924
+ warn$1(`Extraneous non-props attributes (` +
1925
+ `${extraAttrs.join(', ')}) ` +
1926
+ `were passed to component but could not be automatically inherited ` +
1927
+ `because component renders fragment or text root nodes.`);
1928
+ }
1929
+ if (eventAttrs.length) {
1930
+ warn$1(`Extraneous non-emits event listeners (` +
1931
+ `${eventAttrs.join(', ')}) ` +
1932
+ `were passed to component but could not be automatically inherited ` +
1933
+ `because component renders fragment or text root nodes. ` +
1934
+ `If the listener is intended to be a component custom event listener only, ` +
1935
+ `declare it using the "emits" option.`);
1936
+ }
2268
1937
  }
2269
1938
  }
2270
- if (false &&
2271
- isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
2272
- vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
2273
- root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) ;
2274
- // inherit directives
2275
- if (vnode.dirs) {
2276
- if (true && !isElementRoot(root)) {
2277
- warn$1(`Runtime directive used on component with non-element root node. ` +
2278
- `The directives will not function as intended.`);
2279
- }
2280
- root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2281
- }
2282
- // inherit transition data
2283
- if (vnode.transition) {
2284
- if (true && !isElementRoot(root)) {
2285
- warn$1(`Component inside <Transition> renders non-element root node ` +
2286
- `that cannot be animated.`);
2287
- }
2288
- root.transition = vnode.transition;
2289
- }
2290
- if (true && setRoot) {
2291
- setRoot(root);
1939
+ }
1940
+ // inherit directives
1941
+ if (vnode.dirs) {
1942
+ if (!isElementRoot(root)) {
1943
+ warn$1(`Runtime directive used on component with non-element root node. ` +
1944
+ `The directives will not function as intended.`);
2292
1945
  }
2293
- else {
2294
- result = root;
1946
+ root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
1947
+ }
1948
+ // inherit transition data
1949
+ if (vnode.transition) {
1950
+ if (!isElementRoot(root)) {
1951
+ warn$1(`Component inside <Transition> renders non-element root node ` +
1952
+ `that cannot be animated.`);
2295
1953
  }
1954
+ root.transition = vnode.transition;
2296
1955
  }
2297
- catch (err) {
2298
- blockStack.length = 0;
2299
- handleError(err, instance, 1 /* RENDER_FUNCTION */);
2300
- result = createVNode(Comment);
1956
+ if (setRoot) {
1957
+ setRoot(root);
1958
+ }
1959
+ else {
1960
+ result = root;
2301
1961
  }
2302
1962
  setCurrentRenderingInstance(prev);
2303
1963
  return result;
@@ -2832,8 +2492,8 @@ function normalizeSuspenseChildren(vnode) {
2832
2492
  function normalizeSuspenseSlot(s) {
2833
2493
  let block;
2834
2494
  if (isFunction(s)) {
2835
- const isCompiledSlot = s._c;
2836
- if (isCompiledSlot) {
2495
+ const trackBlock = isBlockTreeEnabled && s._c;
2496
+ if (trackBlock) {
2837
2497
  // disableTracking: false
2838
2498
  // allow block tracking for compiled slots
2839
2499
  // (see ./componentRenderContext.ts)
@@ -2841,7 +2501,7 @@ function normalizeSuspenseSlot(s) {
2841
2501
  openBlock();
2842
2502
  }
2843
2503
  s = s();
2844
- if (isCompiledSlot) {
2504
+ if (trackBlock) {
2845
2505
  s._d = true;
2846
2506
  block = currentBlock;
2847
2507
  closeBlock();
@@ -6937,7 +6597,11 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
6937
6597
  return Component;
6938
6598
  }
6939
6599
  if (warnMissing && !res) {
6940
- warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}`);
6600
+ const extra = type === COMPONENTS
6601
+ ? `\nIf this is a native custom element, make sure to exclude it from ` +
6602
+ `component resolution via compilerOptions.isCustomElement.`
6603
+ : ``;
6604
+ warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
6941
6605
  }
6942
6606
  return res;
6943
6607
  }
@@ -7792,17 +7456,19 @@ function exposePropsOnRenderContext(instance) {
7792
7456
  function exposeSetupStateOnRenderContext(instance) {
7793
7457
  const { ctx, setupState } = instance;
7794
7458
  Object.keys(toRaw(setupState)).forEach(key => {
7795
- if (!setupState.__isScriptSetup && (key[0] === '$' || key[0] === '_')) {
7796
- warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
7797
- `which are reserved prefixes for Vue internals.`);
7798
- return;
7459
+ if (!setupState.__isScriptSetup) {
7460
+ if (key[0] === '$' || key[0] === '_') {
7461
+ warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
7462
+ `which are reserved prefixes for Vue internals.`);
7463
+ return;
7464
+ }
7465
+ Object.defineProperty(ctx, key, {
7466
+ enumerable: true,
7467
+ configurable: true,
7468
+ get: () => setupState[key],
7469
+ set: NOOP
7470
+ });
7799
7471
  }
7800
- Object.defineProperty(ctx, key, {
7801
- enumerable: true,
7802
- configurable: true,
7803
- get: () => setupState[key],
7804
- set: NOOP
7805
- });
7806
7472
  });
7807
7473
  }
7808
7474
 
@@ -8546,11 +8212,18 @@ function flushJobs(seen) {
8546
8212
  // 2. If a component is unmounted during a parent component's update,
8547
8213
  // its update can be skipped.
8548
8214
  queue.sort((a, b) => getId(a) - getId(b));
8215
+ // conditional usage of checkRecursiveUpdate must be determined out of
8216
+ // try ... catch block since Rollup by default de-optimizes treeshaking
8217
+ // inside try-catch. This can leave all warning code unshaked. Although
8218
+ // they would get eventually shaken by a minifier like terser, some minifiers
8219
+ // would fail to do that (e.g. https://github.com/evanw/esbuild/issues/1610)
8220
+ const check = (job) => checkRecursiveUpdates(seen, job)
8221
+ ;
8549
8222
  try {
8550
8223
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
8551
8224
  const job = queue[flushIndex];
8552
8225
  if (job && job.active !== false) {
8553
- if (true && checkRecursiveUpdates(seen, job)) {
8226
+ if (true && check(job)) {
8554
8227
  continue;
8555
8228
  }
8556
8229
  // console.log(`running:`, job.id)
@@ -8881,7 +8554,7 @@ function defineExpose(exposed) {
8881
8554
  }
8882
8555
  /**
8883
8556
  * Vue `<script setup>` compiler macro for providing props default values when
8884
- * using type-based `defineProps` decalration.
8557
+ * using type-based `defineProps` declaration.
8885
8558
  *
8886
8559
  * Example usage:
8887
8560
  * ```ts
@@ -9230,7 +8903,7 @@ function isMemoSame(cached, memo) {
9230
8903
  }
9231
8904
 
9232
8905
  // Core API ------------------------------------------------------------------
9233
- const version = "3.2.8";
8906
+ const version = "3.2.12";
9234
8907
  /**
9235
8908
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
9236
8909
  * @internal
@@ -9352,19 +9025,13 @@ function patchClass(el, value, isSVG) {
9352
9025
 
9353
9026
  function patchStyle(el, prev, next) {
9354
9027
  const style = el.style;
9028
+ const currentDisplay = style.display;
9355
9029
  if (!next) {
9356
9030
  el.removeAttribute('style');
9357
9031
  }
9358
9032
  else if (isString(next)) {
9359
9033
  if (prev !== next) {
9360
- const current = style.display;
9361
9034
  style.cssText = next;
9362
- // indicates that the `display` of the element is controlled by `v-show`,
9363
- // so we always keep the current `display` value regardless of the `style` value,
9364
- // thus handing over control to `v-show`.
9365
- if ('_vod' in el) {
9366
- style.display = current;
9367
- }
9368
9035
  }
9369
9036
  }
9370
9037
  else {
@@ -9379,6 +9046,12 @@ function patchStyle(el, prev, next) {
9379
9046
  }
9380
9047
  }
9381
9048
  }
9049
+ // indicates that the `display` of the element is controlled by `v-show`,
9050
+ // so we always keep the current `display` value regardless of the `style` value,
9051
+ // thus handing over control to `v-show`.
9052
+ if ('_vod' in el) {
9053
+ style.display = currentDisplay;
9054
+ }
9382
9055
  }
9383
9056
  const importantRE = /\s*!important$/;
9384
9057
  function setStyle(style, name, val) {
@@ -9712,6 +9385,7 @@ class VueElement extends BaseClass {
9712
9385
  this._instance = null;
9713
9386
  this._connected = false;
9714
9387
  this._resolved = false;
9388
+ this._numberProps = null;
9715
9389
  if (this.shadowRoot && hydrate) {
9716
9390
  hydrate(this._createVNode(), this.shadowRoot);
9717
9391
  }
@@ -9727,18 +9401,17 @@ class VueElement extends BaseClass {
9727
9401
  this._setAttr(this.attributes[i].name);
9728
9402
  }
9729
9403
  // watch future attr changes
9730
- const observer = new MutationObserver(mutations => {
9404
+ new MutationObserver(mutations => {
9731
9405
  for (const m of mutations) {
9732
9406
  this._setAttr(m.attributeName);
9733
9407
  }
9734
- });
9735
- observer.observe(this, { attributes: true });
9408
+ }).observe(this, { attributes: true });
9736
9409
  }
9737
9410
  connectedCallback() {
9738
9411
  this._connected = true;
9739
9412
  if (!this._instance) {
9740
9413
  this._resolveDef();
9741
- render(this._createVNode(), this.shadowRoot);
9414
+ this._update();
9742
9415
  }
9743
9416
  }
9744
9417
  disconnectedCallback() {
@@ -9759,15 +9432,31 @@ class VueElement extends BaseClass {
9759
9432
  }
9760
9433
  const resolve = (def) => {
9761
9434
  this._resolved = true;
9435
+ const { props, styles } = def;
9436
+ const hasOptions = !isArray(props);
9437
+ const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
9438
+ // cast Number-type props set before resolve
9439
+ let numberProps;
9440
+ if (hasOptions) {
9441
+ for (const key in this._props) {
9442
+ const opt = props[key];
9443
+ if (opt === Number || (opt && opt.type === Number)) {
9444
+ this._props[key] = toNumber(this._props[key]);
9445
+ (numberProps || (numberProps = Object.create(null)))[key] = true;
9446
+ }
9447
+ }
9448
+ }
9449
+ if (numberProps) {
9450
+ this._numberProps = numberProps;
9451
+ this._update();
9452
+ }
9762
9453
  // check if there are props set pre-upgrade or connect
9763
9454
  for (const key of Object.keys(this)) {
9764
9455
  if (key[0] !== '_') {
9765
9456
  this._setProp(key, this[key]);
9766
9457
  }
9767
9458
  }
9768
- const { props, styles } = def;
9769
9459
  // defining getter/setters on prototype
9770
- const rawKeys = props ? (isArray(props) ? props : Object.keys(props)) : [];
9771
9460
  for (const key of rawKeys.map(camelize)) {
9772
9461
  Object.defineProperty(this, key, {
9773
9462
  get() {
@@ -9789,7 +9478,11 @@ class VueElement extends BaseClass {
9789
9478
  }
9790
9479
  }
9791
9480
  _setAttr(key) {
9792
- this._setProp(camelize(key), toNumber(this.getAttribute(key)), false);
9481
+ let value = this.getAttribute(key);
9482
+ if (this._numberProps && this._numberProps[key]) {
9483
+ value = toNumber(value);
9484
+ }
9485
+ this._setProp(camelize(key), value, false);
9793
9486
  }
9794
9487
  /**
9795
9488
  * @internal
@@ -9804,7 +9497,7 @@ class VueElement extends BaseClass {
9804
9497
  if (val !== this._props[key]) {
9805
9498
  this._props[key] = val;
9806
9499
  if (this._instance) {
9807
- render(this._createVNode(), this.shadowRoot);
9500
+ this._update();
9808
9501
  }
9809
9502
  // reflect
9810
9503
  if (shouldReflect) {
@@ -9820,6 +9513,9 @@ class VueElement extends BaseClass {
9820
9513
  }
9821
9514
  }
9822
9515
  }
9516
+ _update() {
9517
+ render(this._createVNode(), this.shadowRoot);
9518
+ }
9823
9519
  _createVNode() {
9824
9520
  const vnode = createVNode(this._def, extend({}, this._props));
9825
9521
  if (!this._instance) {
@@ -9840,7 +9536,7 @@ class VueElement extends BaseClass {
9840
9536
  if (!this._def.__asyncLoader) {
9841
9537
  // reload
9842
9538
  this._instance = null;
9843
- render(this._createVNode(), this.shadowRoot);
9539
+ this._update();
9844
9540
  }
9845
9541
  };
9846
9542
  }