@vue/compat 3.2.32 → 3.2.33

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.
package/dist/vue.cjs.js CHANGED
@@ -749,10 +749,17 @@ class ReactiveEffect {
749
749
  activeEffect = this.parent;
750
750
  shouldTrack = lastShouldTrack;
751
751
  this.parent = undefined;
752
+ if (this.deferStop) {
753
+ this.stop();
754
+ }
752
755
  }
753
756
  }
754
757
  stop() {
755
- if (this.active) {
758
+ // stopped while running itself - defer the cleanup
759
+ if (activeEffect === this) {
760
+ this.deferStop = true;
761
+ }
762
+ else if (this.active) {
756
763
  cleanupEffect(this);
757
764
  if (this.onStop) {
758
765
  this.onStop();
@@ -927,7 +934,9 @@ function triggerEffects(dep, debuggerEventExtraInfo) {
927
934
  }
928
935
 
929
936
  const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
930
- const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
937
+ const builtInSymbols = new Set(
938
+ /*#__PURE__*/
939
+ Object.getOwnPropertyNames(Symbol)
931
940
  .map(key => Symbol[key])
932
941
  .filter(isSymbol));
933
942
  const get = /*#__PURE__*/ createGetter();
@@ -1079,13 +1088,13 @@ const readonlyHandlers = {
1079
1088
  get: readonlyGet,
1080
1089
  set(target, key) {
1081
1090
  {
1082
- console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
1091
+ warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
1083
1092
  }
1084
1093
  return true;
1085
1094
  },
1086
1095
  deleteProperty(target, key) {
1087
1096
  {
1088
- console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
1097
+ warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
1089
1098
  }
1090
1099
  return true;
1091
1100
  }
@@ -1913,7 +1922,7 @@ let preFlushIndex = 0;
1913
1922
  const pendingPostFlushCbs = [];
1914
1923
  let activePostFlushCbs = null;
1915
1924
  let postFlushIndex = 0;
1916
- const resolvedPromise = Promise.resolve();
1925
+ const resolvedPromise = /*#__PURE__*/ Promise.resolve();
1917
1926
  let currentFlushPromise = null;
1918
1927
  let currentPreFlushParentJob = null;
1919
1928
  const RECURSION_LIMIT = 100;
@@ -2847,6 +2856,8 @@ function compatModelEmit(instance, event, args) {
2847
2856
  }
2848
2857
 
2849
2858
  function emit$2(instance, event, ...rawArgs) {
2859
+ if (instance.isUnmounted)
2860
+ return;
2850
2861
  const props = instance.vnode.props || EMPTY_OBJ;
2851
2862
  {
2852
2863
  const { emitsOptions, propsOptions: [propsOptions] } = instance;
@@ -4183,10 +4194,22 @@ const BaseTransitionImpl = {
4183
4194
  if (!children || !children.length) {
4184
4195
  return;
4185
4196
  }
4186
- // warn multiple elements
4197
+ let child = children[0];
4187
4198
  if (children.length > 1) {
4188
- warn$1('<transition> can only be used on a single element or component. Use ' +
4189
- '<transition-group> for lists.');
4199
+ let hasFound = false;
4200
+ // locate first non-comment child
4201
+ for (const c of children) {
4202
+ if (c.type !== Comment) {
4203
+ if (hasFound) {
4204
+ // warn more than one non-comment child
4205
+ warn$1('<transition> can only be used on a single element or component. ' +
4206
+ 'Use <transition-group> for lists.');
4207
+ break;
4208
+ }
4209
+ child = c;
4210
+ hasFound = true;
4211
+ }
4212
+ }
4190
4213
  }
4191
4214
  // there's no need to track reactivity for these props so use the raw
4192
4215
  // props for a bit better perf
@@ -4199,8 +4222,6 @@ const BaseTransitionImpl = {
4199
4222
  mode !== 'default') {
4200
4223
  warn$1(`invalid <transition> mode: ${mode}`);
4201
4224
  }
4202
- // at this point children has a guaranteed length of 1.
4203
- const child = children[0];
4204
4225
  if (state.isLeaving) {
4205
4226
  return emptyPlaceholder(child);
4206
4227
  }
@@ -6211,7 +6232,7 @@ function createCompatVue(createApp, createSingletonApp) {
6211
6232
  return vm;
6212
6233
  }
6213
6234
  }
6214
- Vue.version = `2.6.14-compat:${"3.2.32"}`;
6235
+ Vue.version = `2.6.14-compat:${"3.2.33"}`;
6215
6236
  Vue.config = singletonApp.config;
6216
6237
  Vue.use = (p, ...options) => {
6217
6238
  if (p && isFunction(p.install)) {
@@ -8375,7 +8396,22 @@ function baseCreateRenderer(options, createHydrationFns) {
8375
8396
  const remove = vnode => {
8376
8397
  const { type, el, anchor, transition } = vnode;
8377
8398
  if (type === Fragment) {
8378
- removeFragment(el, anchor);
8399
+ if (vnode.patchFlag > 0 &&
8400
+ vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
8401
+ transition &&
8402
+ !transition.persisted) {
8403
+ vnode.children.forEach(child => {
8404
+ if (child.type === Comment) {
8405
+ hostRemove(child.el);
8406
+ }
8407
+ else {
8408
+ remove(child);
8409
+ }
8410
+ });
8411
+ }
8412
+ else {
8413
+ removeFragment(el, anchor);
8414
+ }
8379
8415
  return;
8380
8416
  }
8381
8417
  if (type === Static) {
@@ -9768,7 +9804,10 @@ function renderSlot(slots, name, props = {},
9768
9804
  // this is not a user-facing function, so the fallback is always generated by
9769
9805
  // the compiler and guaranteed to be a function returning an array
9770
9806
  fallback, noSlotted) {
9771
- if (currentRenderingInstance.isCE) {
9807
+ if (currentRenderingInstance.isCE ||
9808
+ (currentRenderingInstance.parent &&
9809
+ isAsyncWrapper(currentRenderingInstance.parent) &&
9810
+ currentRenderingInstance.parent.isCE)) {
9772
9811
  return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
9773
9812
  }
9774
9813
  let slot = slots[name];
@@ -10058,7 +10097,10 @@ const getPublicInstance = (i) => {
10058
10097
  return getExposeProxy(i) || i.proxy;
10059
10098
  return getPublicInstance(i.parent);
10060
10099
  };
10061
- const publicPropertiesMap = extend(Object.create(null), {
10100
+ const publicPropertiesMap =
10101
+ // Move PURE marker to new line to workaround compiler discarding it
10102
+ // due to type annotation
10103
+ /*#__PURE__*/ extend(Object.create(null), {
10062
10104
  $: i => i,
10063
10105
  $el: i => i.vnode.el,
10064
10106
  $data: i => i.data,
@@ -10171,7 +10213,9 @@ const PublicInstanceProxyHandlers = {
10171
10213
  }
10172
10214
  else {
10173
10215
  const val = globalProperties[key];
10174
- return isFunction(val) ? val.bind(instance.proxy) : val;
10216
+ return isFunction(val)
10217
+ ? Object.assign(val.bind(instance.proxy), val)
10218
+ : val;
10175
10219
  }
10176
10220
  }
10177
10221
  }
@@ -10238,7 +10282,7 @@ const PublicInstanceProxyHandlers = {
10238
10282
  defineProperty(target, key, descriptor) {
10239
10283
  if (descriptor.get != null) {
10240
10284
  // invalidate key cache of a getter based property #5417
10241
- target.$.accessCache[key] = 0;
10285
+ target._.accessCache[key] = 0;
10242
10286
  }
10243
10287
  else if (hasOwn(descriptor, 'value')) {
10244
10288
  this.set(target, key, descriptor.value, null);
@@ -10446,6 +10490,7 @@ function setupComponent(instance, isSSR = false) {
10446
10490
  return setupResult;
10447
10491
  }
10448
10492
  function setupStatefulComponent(instance, isSSR) {
10493
+ var _a;
10449
10494
  const Component = instance.type;
10450
10495
  {
10451
10496
  if (Component.name) {
@@ -10503,6 +10548,13 @@ function setupStatefulComponent(instance, isSSR) {
10503
10548
  // async setup returned Promise.
10504
10549
  // bail here and wait for re-entry.
10505
10550
  instance.asyncDep = setupResult;
10551
+ if (!instance.suspense) {
10552
+ const name = (_a = Component.name) !== null && _a !== void 0 ? _a : 'Anonymous';
10553
+ warn$1(`Component <${name}>: setup function returned a promise, but no ` +
10554
+ `<Suspense> boundary was found in the parent component tree. ` +
10555
+ `A component with async setup() must be nested in a <Suspense> ` +
10556
+ `in order to be rendered.`);
10557
+ }
10506
10558
  }
10507
10559
  }
10508
10560
  else {
@@ -11138,7 +11190,7 @@ function isMemoSame(cached, memo) {
11138
11190
  }
11139
11191
 
11140
11192
  // Core API ------------------------------------------------------------------
11141
- const version = "3.2.32";
11193
+ const version = "3.2.33";
11142
11194
  const _ssrUtils = {
11143
11195
  createComponentInstance,
11144
11196
  setupComponent,
@@ -11170,7 +11222,7 @@ const compatUtils = (_compatUtils );
11170
11222
 
11171
11223
  const svgNS = 'http://www.w3.org/2000/svg';
11172
11224
  const doc = (typeof document !== 'undefined' ? document : null);
11173
- const templateContainer = doc && doc.createElement('template');
11225
+ const templateContainer = doc && /*#__PURE__*/ doc.createElement('template');
11174
11226
  const nodeOps = {
11175
11227
  insert: (child, parent, anchor) => {
11176
11228
  parent.insertBefore(child, anchor || null);
@@ -11321,6 +11373,8 @@ function setStyle(style, name, val) {
11321
11373
  val.forEach(v => setStyle(style, name, v));
11322
11374
  }
11323
11375
  else {
11376
+ if (val == null)
11377
+ val = '';
11324
11378
  if (name.startsWith('--')) {
11325
11379
  // custom property definition
11326
11380
  style.setProperty(name, val);
@@ -11442,41 +11496,39 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
11442
11496
  }
11443
11497
  return;
11444
11498
  }
11499
+ let needRemove = false;
11445
11500
  if (value === '' || value == null) {
11446
11501
  const type = typeof el[key];
11447
11502
  if (type === 'boolean') {
11448
11503
  // e.g. <select multiple> compiles to { multiple: '' }
11449
- el[key] = includeBooleanAttr(value);
11450
- return;
11504
+ value = includeBooleanAttr(value);
11451
11505
  }
11452
11506
  else if (value == null && type === 'string') {
11453
11507
  // e.g. <div :id="null">
11454
- el[key] = '';
11455
- el.removeAttribute(key);
11456
- return;
11508
+ value = '';
11509
+ needRemove = true;
11457
11510
  }
11458
11511
  else if (type === 'number') {
11459
11512
  // e.g. <img :width="null">
11460
11513
  // the value of some IDL attr must be greater than 0, e.g. input.size = 0 -> error
11461
- try {
11462
- el[key] = 0;
11463
- }
11464
- catch (_a) { }
11465
- el.removeAttribute(key);
11466
- return;
11514
+ value = 0;
11515
+ needRemove = true;
11467
11516
  }
11468
11517
  }
11469
- if (value === false &&
11470
- compatUtils.isCompatEnabled("ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */, parentComponent)) {
11471
- const type = typeof el[key];
11472
- if (type === 'string' || type === 'number') {
11473
- compatUtils.warnDeprecation("ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */, parentComponent, key);
11474
- el[key] = type === 'number' ? 0 : '';
11475
- el.removeAttribute(key);
11476
- return;
11518
+ else {
11519
+ if (value === false &&
11520
+ compatUtils.isCompatEnabled("ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */, parentComponent)) {
11521
+ const type = typeof el[key];
11522
+ if (type === 'string' || type === 'number') {
11523
+ compatUtils.warnDeprecation("ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */, parentComponent, key);
11524
+ value = type === 'number' ? 0 : '';
11525
+ needRemove = true;
11526
+ }
11477
11527
  }
11478
11528
  }
11479
- // some properties perform value validation and throw
11529
+ // some properties perform value validation and throw,
11530
+ // some properties has getter, no setter, will error in 'use strict'
11531
+ // eg. <select :type="null"></select> <select :willValidate="null"></select>
11480
11532
  try {
11481
11533
  el[key] = value;
11482
11534
  }
@@ -11486,31 +11538,35 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
11486
11538
  `value ${value} is invalid.`, e);
11487
11539
  }
11488
11540
  }
11541
+ needRemove && el.removeAttribute(key);
11489
11542
  }
11490
11543
 
11491
11544
  // Async edge case fix requires storing an event listener's attach timestamp.
11492
- let _getNow = Date.now;
11493
- let skipTimestampCheck = false;
11494
- if (typeof window !== 'undefined') {
11495
- // Determine what event timestamp the browser is using. Annoyingly, the
11496
- // timestamp can either be hi-res (relative to page load) or low-res
11497
- // (relative to UNIX epoch), so in order to compare time we have to use the
11498
- // same timestamp type when saving the flush timestamp.
11499
- if (_getNow() > document.createEvent('Event').timeStamp) {
11500
- // if the low-res timestamp which is bigger than the event timestamp
11501
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
11502
- // and we need to use the hi-res version for event listeners as well.
11503
- _getNow = () => performance.now();
11504
- }
11505
- // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
11506
- // and does not fire microtasks in between event propagation, so safe to exclude.
11507
- const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
11508
- skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
11509
- }
11545
+ const [_getNow, skipTimestampCheck] = /*#__PURE__*/ (() => {
11546
+ let _getNow = Date.now;
11547
+ let skipTimestampCheck = false;
11548
+ if (typeof window !== 'undefined') {
11549
+ // Determine what event timestamp the browser is using. Annoyingly, the
11550
+ // timestamp can either be hi-res (relative to page load) or low-res
11551
+ // (relative to UNIX epoch), so in order to compare time we have to use the
11552
+ // same timestamp type when saving the flush timestamp.
11553
+ if (Date.now() > document.createEvent('Event').timeStamp) {
11554
+ // if the low-res timestamp which is bigger than the event timestamp
11555
+ // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
11556
+ // and we need to use the hi-res version for event listeners as well.
11557
+ _getNow = () => performance.now();
11558
+ }
11559
+ // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
11560
+ // and does not fire microtasks in between event propagation, so safe to exclude.
11561
+ const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
11562
+ skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
11563
+ }
11564
+ return [_getNow, skipTimestampCheck];
11565
+ })();
11510
11566
  // To avoid the overhead of repeatedly calling performance.now(), we cache
11511
11567
  // and use the same timestamp for all event listeners attached in the same tick.
11512
11568
  let cachedNow = 0;
11513
- const p = Promise.resolve();
11569
+ const p = /*#__PURE__*/ Promise.resolve();
11514
11570
  const reset = () => {
11515
11571
  cachedNow = 0;
11516
11572
  };
@@ -11635,13 +11691,13 @@ function shouldSetAsProp(el, key, value, isSVG) {
11635
11691
  }
11636
11692
  return false;
11637
11693
  }
11638
- // spellcheck and draggable are numerated attrs, however their
11639
- // corresponding DOM properties are actually booleans - this leads to
11640
- // setting it with a string "false" value leading it to be coerced to
11641
- // `true`, so we need to always treat them as attributes.
11694
+ // these are enumerated attrs, however their corresponding DOM properties
11695
+ // are actually booleans - this leads to setting it with a string "false"
11696
+ // value leading it to be coerced to `true`, so we need to always treat
11697
+ // them as attributes.
11642
11698
  // Note that `contentEditable` doesn't have this problem: its DOM
11643
11699
  // property is also enumerated string values.
11644
- if (key === 'spellcheck' || key === 'draggable') {
11700
+ if (key === 'spellcheck' || key === 'draggable' || key === 'translate') {
11645
11701
  return false;
11646
11702
  }
11647
11703
  // #1787, #2840 form property on form elements is readonly and must be set as
@@ -12767,7 +12823,7 @@ function initVShowForSSR() {
12767
12823
  };
12768
12824
  }
12769
12825
 
12770
- const rendererOptions = extend({ patchProp }, nodeOps);
12826
+ const rendererOptions = /*#__PURE__*/ extend({ patchProp }, nodeOps);
12771
12827
  // lazy create the renderer - this makes core renderer logic tree-shakable
12772
12828
  // in case the user only imports reactivity utilities from Vue.
12773
12829
  let renderer;
@@ -664,10 +664,17 @@ class ReactiveEffect {
664
664
  activeEffect = this.parent;
665
665
  shouldTrack = lastShouldTrack;
666
666
  this.parent = undefined;
667
+ if (this.deferStop) {
668
+ this.stop();
669
+ }
667
670
  }
668
671
  }
669
672
  stop() {
670
- if (this.active) {
673
+ // stopped while running itself - defer the cleanup
674
+ if (activeEffect === this) {
675
+ this.deferStop = true;
676
+ }
677
+ else if (this.active) {
671
678
  cleanupEffect(this);
672
679
  if (this.onStop) {
673
680
  this.onStop();
@@ -832,7 +839,9 @@ function triggerEffects(dep, debuggerEventExtraInfo) {
832
839
  }
833
840
 
834
841
  const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
835
- const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
842
+ const builtInSymbols = new Set(
843
+ /*#__PURE__*/
844
+ Object.getOwnPropertyNames(Symbol)
836
845
  .map(key => Symbol[key])
837
846
  .filter(isSymbol));
838
847
  const get = /*#__PURE__*/ createGetter();
@@ -1714,7 +1723,7 @@ let preFlushIndex = 0;
1714
1723
  const pendingPostFlushCbs = [];
1715
1724
  let activePostFlushCbs = null;
1716
1725
  let postFlushIndex = 0;
1717
- const resolvedPromise = Promise.resolve();
1726
+ const resolvedPromise = /*#__PURE__*/ Promise.resolve();
1718
1727
  let currentFlushPromise = null;
1719
1728
  let currentPreFlushParentJob = null;
1720
1729
  function nextTick(fn) {
@@ -2084,6 +2093,8 @@ function compatModelEmit(instance, event, args) {
2084
2093
  }
2085
2094
 
2086
2095
  function emit$1(instance, event, ...rawArgs) {
2096
+ if (instance.isUnmounted)
2097
+ return;
2087
2098
  const props = instance.vnode.props || EMPTY_OBJ;
2088
2099
  let args = rawArgs;
2089
2100
  const isModelListener = event.startsWith('update:');
@@ -3220,12 +3231,20 @@ const BaseTransitionImpl = {
3220
3231
  if (!children || !children.length) {
3221
3232
  return;
3222
3233
  }
3234
+ let child = children[0];
3235
+ if (children.length > 1) {
3236
+ // locate first non-comment child
3237
+ for (const c of children) {
3238
+ if (c.type !== Comment) {
3239
+ child = c;
3240
+ break;
3241
+ }
3242
+ }
3243
+ }
3223
3244
  // there's no need to track reactivity for these props so use the raw
3224
3245
  // props for a bit better perf
3225
3246
  const rawProps = toRaw(props);
3226
3247
  const { mode } = rawProps;
3227
- // at this point children has a guaranteed length of 1.
3228
- const child = children[0];
3229
3248
  if (state.isLeaving) {
3230
3249
  return emptyPlaceholder(child);
3231
3250
  }
@@ -4919,7 +4938,7 @@ function createCompatVue(createApp, createSingletonApp) {
4919
4938
  return vm;
4920
4939
  }
4921
4940
  }
4922
- Vue.version = `2.6.14-compat:${"3.2.32"}`;
4941
+ Vue.version = `2.6.14-compat:${"3.2.33"}`;
4923
4942
  Vue.config = singletonApp.config;
4924
4943
  Vue.use = (p, ...options) => {
4925
4944
  if (p && isFunction(p.install)) {
@@ -6781,7 +6800,9 @@ function baseCreateRenderer(options, createHydrationFns) {
6781
6800
  const remove = vnode => {
6782
6801
  const { type, el, anchor, transition } = vnode;
6783
6802
  if (type === Fragment) {
6784
- removeFragment(el, anchor);
6803
+ {
6804
+ removeFragment(el, anchor);
6805
+ }
6785
6806
  return;
6786
6807
  }
6787
6808
  if (type === Static) {
@@ -8084,7 +8105,10 @@ function renderSlot(slots, name, props = {},
8084
8105
  // this is not a user-facing function, so the fallback is always generated by
8085
8106
  // the compiler and guaranteed to be a function returning an array
8086
8107
  fallback, noSlotted) {
8087
- if (currentRenderingInstance.isCE) {
8108
+ if (currentRenderingInstance.isCE ||
8109
+ (currentRenderingInstance.parent &&
8110
+ isAsyncWrapper(currentRenderingInstance.parent) &&
8111
+ currentRenderingInstance.parent.isCE)) {
8088
8112
  return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
8089
8113
  }
8090
8114
  let slot = slots[name];
@@ -8364,7 +8388,10 @@ const getPublicInstance = (i) => {
8364
8388
  return getExposeProxy(i) || i.proxy;
8365
8389
  return getPublicInstance(i.parent);
8366
8390
  };
8367
- const publicPropertiesMap = extend(Object.create(null), {
8391
+ const publicPropertiesMap =
8392
+ // Move PURE marker to new line to workaround compiler discarding it
8393
+ // due to type annotation
8394
+ /*#__PURE__*/ extend(Object.create(null), {
8368
8395
  $: i => i,
8369
8396
  $el: i => i.vnode.el,
8370
8397
  $data: i => i.data,
@@ -8463,7 +8490,9 @@ const PublicInstanceProxyHandlers = {
8463
8490
  }
8464
8491
  else {
8465
8492
  const val = globalProperties[key];
8466
- return isFunction(val) ? val.bind(instance.proxy) : val;
8493
+ return isFunction(val)
8494
+ ? Object.assign(val.bind(instance.proxy), val)
8495
+ : val;
8467
8496
  }
8468
8497
  }
8469
8498
  }
@@ -8505,7 +8534,7 @@ const PublicInstanceProxyHandlers = {
8505
8534
  defineProperty(target, key, descriptor) {
8506
8535
  if (descriptor.get != null) {
8507
8536
  // invalidate key cache of a getter based property #5417
8508
- target.$.accessCache[key] = 0;
8537
+ target._.accessCache[key] = 0;
8509
8538
  }
8510
8539
  else if (hasOwn(descriptor, 'value')) {
8511
8540
  this.set(target, key, descriptor.value, null);
@@ -9043,7 +9072,7 @@ function isMemoSame(cached, memo) {
9043
9072
  }
9044
9073
 
9045
9074
  // Core API ------------------------------------------------------------------
9046
- const version = "3.2.32";
9075
+ const version = "3.2.33";
9047
9076
  const _ssrUtils = {
9048
9077
  createComponentInstance,
9049
9078
  setupComponent,
@@ -9075,7 +9104,7 @@ const compatUtils = (_compatUtils );
9075
9104
 
9076
9105
  const svgNS = 'http://www.w3.org/2000/svg';
9077
9106
  const doc = (typeof document !== 'undefined' ? document : null);
9078
- const templateContainer = doc && doc.createElement('template');
9107
+ const templateContainer = doc && /*#__PURE__*/ doc.createElement('template');
9079
9108
  const nodeOps = {
9080
9109
  insert: (child, parent, anchor) => {
9081
9110
  parent.insertBefore(child, anchor || null);
@@ -9226,6 +9255,8 @@ function setStyle(style, name, val) {
9226
9255
  val.forEach(v => setStyle(style, name, v));
9227
9256
  }
9228
9257
  else {
9258
+ if (val == null)
9259
+ val = '';
9229
9260
  if (name.startsWith('--')) {
9230
9261
  // custom property definition
9231
9262
  style.setProperty(name, val);
@@ -9347,70 +9378,72 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
9347
9378
  }
9348
9379
  return;
9349
9380
  }
9381
+ let needRemove = false;
9350
9382
  if (value === '' || value == null) {
9351
9383
  const type = typeof el[key];
9352
9384
  if (type === 'boolean') {
9353
9385
  // e.g. <select multiple> compiles to { multiple: '' }
9354
- el[key] = includeBooleanAttr(value);
9355
- return;
9386
+ value = includeBooleanAttr(value);
9356
9387
  }
9357
9388
  else if (value == null && type === 'string') {
9358
9389
  // e.g. <div :id="null">
9359
- el[key] = '';
9360
- el.removeAttribute(key);
9361
- return;
9390
+ value = '';
9391
+ needRemove = true;
9362
9392
  }
9363
9393
  else if (type === 'number') {
9364
9394
  // e.g. <img :width="null">
9365
9395
  // the value of some IDL attr must be greater than 0, e.g. input.size = 0 -> error
9366
- try {
9367
- el[key] = 0;
9368
- }
9369
- catch (_a) { }
9370
- el.removeAttribute(key);
9371
- return;
9396
+ value = 0;
9397
+ needRemove = true;
9372
9398
  }
9373
9399
  }
9374
- if (value === false &&
9375
- compatUtils.isCompatEnabled("ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */, parentComponent)) {
9376
- const type = typeof el[key];
9377
- if (type === 'string' || type === 'number') {
9378
- el[key] = type === 'number' ? 0 : '';
9379
- el.removeAttribute(key);
9380
- return;
9400
+ else {
9401
+ if (value === false &&
9402
+ compatUtils.isCompatEnabled("ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */, parentComponent)) {
9403
+ const type = typeof el[key];
9404
+ if (type === 'string' || type === 'number') {
9405
+ value = type === 'number' ? 0 : '';
9406
+ needRemove = true;
9407
+ }
9381
9408
  }
9382
9409
  }
9383
- // some properties perform value validation and throw
9410
+ // some properties perform value validation and throw,
9411
+ // some properties has getter, no setter, will error in 'use strict'
9412
+ // eg. <select :type="null"></select> <select :willValidate="null"></select>
9384
9413
  try {
9385
9414
  el[key] = value;
9386
9415
  }
9387
9416
  catch (e) {
9388
9417
  }
9418
+ needRemove && el.removeAttribute(key);
9389
9419
  }
9390
9420
 
9391
9421
  // Async edge case fix requires storing an event listener's attach timestamp.
9392
- let _getNow = Date.now;
9393
- let skipTimestampCheck = false;
9394
- if (typeof window !== 'undefined') {
9395
- // Determine what event timestamp the browser is using. Annoyingly, the
9396
- // timestamp can either be hi-res (relative to page load) or low-res
9397
- // (relative to UNIX epoch), so in order to compare time we have to use the
9398
- // same timestamp type when saving the flush timestamp.
9399
- if (_getNow() > document.createEvent('Event').timeStamp) {
9400
- // if the low-res timestamp which is bigger than the event timestamp
9401
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
9402
- // and we need to use the hi-res version for event listeners as well.
9403
- _getNow = () => performance.now();
9404
- }
9405
- // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
9406
- // and does not fire microtasks in between event propagation, so safe to exclude.
9407
- const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
9408
- skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
9409
- }
9422
+ const [_getNow, skipTimestampCheck] = /*#__PURE__*/ (() => {
9423
+ let _getNow = Date.now;
9424
+ let skipTimestampCheck = false;
9425
+ if (typeof window !== 'undefined') {
9426
+ // Determine what event timestamp the browser is using. Annoyingly, the
9427
+ // timestamp can either be hi-res (relative to page load) or low-res
9428
+ // (relative to UNIX epoch), so in order to compare time we have to use the
9429
+ // same timestamp type when saving the flush timestamp.
9430
+ if (Date.now() > document.createEvent('Event').timeStamp) {
9431
+ // if the low-res timestamp which is bigger than the event timestamp
9432
+ // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
9433
+ // and we need to use the hi-res version for event listeners as well.
9434
+ _getNow = () => performance.now();
9435
+ }
9436
+ // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
9437
+ // and does not fire microtasks in between event propagation, so safe to exclude.
9438
+ const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
9439
+ skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
9440
+ }
9441
+ return [_getNow, skipTimestampCheck];
9442
+ })();
9410
9443
  // To avoid the overhead of repeatedly calling performance.now(), we cache
9411
9444
  // and use the same timestamp for all event listeners attached in the same tick.
9412
9445
  let cachedNow = 0;
9413
- const p = Promise.resolve();
9446
+ const p = /*#__PURE__*/ Promise.resolve();
9414
9447
  const reset = () => {
9415
9448
  cachedNow = 0;
9416
9449
  };
@@ -9535,13 +9568,13 @@ function shouldSetAsProp(el, key, value, isSVG) {
9535
9568
  }
9536
9569
  return false;
9537
9570
  }
9538
- // spellcheck and draggable are numerated attrs, however their
9539
- // corresponding DOM properties are actually booleans - this leads to
9540
- // setting it with a string "false" value leading it to be coerced to
9541
- // `true`, so we need to always treat them as attributes.
9571
+ // these are enumerated attrs, however their corresponding DOM properties
9572
+ // are actually booleans - this leads to setting it with a string "false"
9573
+ // value leading it to be coerced to `true`, so we need to always treat
9574
+ // them as attributes.
9542
9575
  // Note that `contentEditable` doesn't have this problem: its DOM
9543
9576
  // property is also enumerated string values.
9544
- if (key === 'spellcheck' || key === 'draggable') {
9577
+ if (key === 'spellcheck' || key === 'draggable' || key === 'translate') {
9545
9578
  return false;
9546
9579
  }
9547
9580
  // #1787, #2840 form property on form elements is readonly and must be set as
@@ -10619,7 +10652,7 @@ function initVShowForSSR() {
10619
10652
  };
10620
10653
  }
10621
10654
 
10622
- const rendererOptions = extend({ patchProp }, nodeOps);
10655
+ const rendererOptions = /*#__PURE__*/ extend({ patchProp }, nodeOps);
10623
10656
  // lazy create the renderer - this makes core renderer logic tree-shakable
10624
10657
  // in case the user only imports reactivity utilities from Vue.
10625
10658
  let renderer;