@vue/runtime-dom 3.2.27 → 3.2.28

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.
@@ -377,7 +377,7 @@ function patchStopImmediatePropagation(e, value) {
377
377
  originalStop.call(e);
378
378
  e._stopped = true;
379
379
  };
380
- return value.map(fn => (e) => !e._stopped && fn(e));
380
+ return value.map(fn => (e) => !e._stopped && fn && fn(e));
381
381
  }
382
382
  else {
383
383
  return value;
@@ -373,7 +373,7 @@ function patchStopImmediatePropagation(e, value) {
373
373
  originalStop.call(e);
374
374
  e._stopped = true;
375
375
  };
376
- return value.map(fn => (e) => !e._stopped && fn(e));
376
+ return value.map(fn => (e) => !e._stopped && fn && fn(e));
377
377
  }
378
378
  else {
379
379
  return value;
@@ -132,7 +132,15 @@ const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,col
132
132
  'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
133
133
  'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
134
134
  'text,textPath,title,tspan,unknown,use,view';
135
+ /**
136
+ * Compiler only.
137
+ * Do NOT use in runtime code paths unless behind `true` flag.
138
+ */
135
139
  const isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);
140
+ /**
141
+ * Compiler only.
142
+ * Do NOT use in runtime code paths unless behind `true` flag.
143
+ */
136
144
  const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
137
145
 
138
146
  function looseCompareArrays(a, b) {
@@ -476,7 +484,7 @@ class ReactiveEffect {
476
484
  if (!this.active) {
477
485
  return this.fn();
478
486
  }
479
- if (!effectStack.includes(this)) {
487
+ if (!effectStack.length || !effectStack.includes(this)) {
480
488
  try {
481
489
  effectStack.push((activeEffect = this));
482
490
  enableTracking();
@@ -732,6 +740,9 @@ function createGetter(isReadonly = false, shallow = false) {
732
740
  else if (key === "__v_isReadonly" /* IS_READONLY */) {
733
741
  return isReadonly;
734
742
  }
743
+ else if (key === "__v_isShallow" /* IS_SHALLOW */) {
744
+ return shallow;
745
+ }
735
746
  else if (key === "__v_raw" /* RAW */ &&
736
747
  receiver ===
737
748
  (isReadonly
@@ -776,9 +787,14 @@ const shallowSet = /*#__PURE__*/ createSetter(true);
776
787
  function createSetter(shallow = false) {
777
788
  return function set(target, key, value, receiver) {
778
789
  let oldValue = target[key];
790
+ if (isReadonly(oldValue) && isRef(oldValue)) {
791
+ return false;
792
+ }
779
793
  if (!shallow && !isReadonly(value)) {
780
- value = toRaw(value);
781
- oldValue = toRaw(oldValue);
794
+ if (!isShallow(value)) {
795
+ value = toRaw(value);
796
+ oldValue = toRaw(oldValue);
797
+ }
782
798
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
783
799
  oldValue.value = value;
784
800
  return true;
@@ -1165,7 +1181,7 @@ function getTargetType(value) {
1165
1181
  }
1166
1182
  function reactive(target) {
1167
1183
  // if trying to observe a readonly proxy, return the readonly version.
1168
- if (target && target["__v_isReadonly" /* IS_READONLY */]) {
1184
+ if (isReadonly(target)) {
1169
1185
  return target;
1170
1186
  }
1171
1187
  return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
@@ -1230,6 +1246,9 @@ function isReactive(value) {
1230
1246
  function isReadonly(value) {
1231
1247
  return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
1232
1248
  }
1249
+ function isShallow(value) {
1250
+ return !!(value && value["__v_isShallow" /* IS_SHALLOW */]);
1251
+ }
1233
1252
  function isProxy(value) {
1234
1253
  return isReactive(value) || isReadonly(value);
1235
1254
  }
@@ -1288,22 +1307,22 @@ function createRef(rawValue, shallow) {
1288
1307
  return new RefImpl(rawValue, shallow);
1289
1308
  }
1290
1309
  class RefImpl {
1291
- constructor(value, _shallow) {
1292
- this._shallow = _shallow;
1310
+ constructor(value, __v_isShallow) {
1311
+ this.__v_isShallow = __v_isShallow;
1293
1312
  this.dep = undefined;
1294
1313
  this.__v_isRef = true;
1295
- this._rawValue = _shallow ? value : toRaw(value);
1296
- this._value = _shallow ? value : toReactive(value);
1314
+ this._rawValue = __v_isShallow ? value : toRaw(value);
1315
+ this._value = __v_isShallow ? value : toReactive(value);
1297
1316
  }
1298
1317
  get value() {
1299
1318
  trackRefValue(this);
1300
1319
  return this._value;
1301
1320
  }
1302
1321
  set value(newVal) {
1303
- newVal = this._shallow ? newVal : toRaw(newVal);
1322
+ newVal = this.__v_isShallow ? newVal : toRaw(newVal);
1304
1323
  if (hasChanged(newVal, this._rawValue)) {
1305
1324
  this._rawValue = newVal;
1306
- this._value = this._shallow ? newVal : toReactive(newVal);
1325
+ this._value = this.__v_isShallow ? newVal : toReactive(newVal);
1307
1326
  triggerRefValue(this, newVal);
1308
1327
  }
1309
1328
  }
@@ -1386,22 +1405,23 @@ class ComputedRefImpl {
1386
1405
  constructor(getter, _setter, isReadonly, isSSR) {
1387
1406
  this._setter = _setter;
1388
1407
  this.dep = undefined;
1389
- this._dirty = true;
1390
1408
  this.__v_isRef = true;
1409
+ this._dirty = true;
1391
1410
  this.effect = new ReactiveEffect(getter, () => {
1392
1411
  if (!this._dirty) {
1393
1412
  this._dirty = true;
1394
1413
  triggerRefValue(this);
1395
1414
  }
1396
1415
  });
1397
- this.effect.active = !isSSR;
1416
+ this.effect.computed = this;
1417
+ this.effect.active = this._cacheable = !isSSR;
1398
1418
  this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
1399
1419
  }
1400
1420
  get value() {
1401
1421
  // the computed ref may get wrapped by other proxies e.g. readonly() #3376
1402
1422
  const self = toRaw(this);
1403
1423
  trackRefValue(self);
1404
- if (self._dirty) {
1424
+ if (self._dirty || !self._cacheable) {
1405
1425
  self._dirty = false;
1406
1426
  self._value = self.effect.run();
1407
1427
  }
@@ -1578,7 +1598,7 @@ const ErrorTypeStrings = {
1578
1598
  [12 /* FUNCTION_REF */]: 'ref function',
1579
1599
  [13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
1580
1600
  [14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
1581
- 'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/vue-next'
1601
+ 'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core'
1582
1602
  };
1583
1603
  function callWithErrorHandling(fn, instance, type, args) {
1584
1604
  let res;
@@ -3040,7 +3060,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
3040
3060
  if (instance) {
3041
3061
  // #2400
3042
3062
  // to support `app.use` plugins,
3043
- // fallback to appContext's `provides` if the intance is at root
3063
+ // fallback to appContext's `provides` if the instance is at root
3044
3064
  const provides = instance.parent == null
3045
3065
  ? instance.vnode.appContext && instance.vnode.appContext.provides
3046
3066
  : instance.parent.provides;
@@ -3106,7 +3126,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3106
3126
  let isMultiSource = false;
3107
3127
  if (isRef(source)) {
3108
3128
  getter = () => source.value;
3109
- forceTrigger = !!source._shallow;
3129
+ forceTrigger = isShallow(source);
3110
3130
  }
3111
3131
  else if (isReactive(source)) {
3112
3132
  getter = () => source;
@@ -3981,7 +4001,7 @@ function matches(pattern, name) {
3981
4001
  return pattern.some((p) => matches(p, name));
3982
4002
  }
3983
4003
  else if (isString(pattern)) {
3984
- return pattern.split(',').indexOf(name) > -1;
4004
+ return pattern.split(',').includes(name);
3985
4005
  }
3986
4006
  else if (pattern.test) {
3987
4007
  return pattern.test(name);
@@ -4234,7 +4254,7 @@ function applyOptions(instance) {
4234
4254
  warn$1(`Write operation failed: computed property "${key}" is readonly.`);
4235
4255
  }
4236
4256
  ;
4237
- const c = computed({
4257
+ const c = computed$1({
4238
4258
  get,
4239
4259
  set
4240
4260
  });
@@ -4633,7 +4653,9 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
4633
4653
  // attrs point to the same object so it should already have been updated.
4634
4654
  if (attrs !== rawCurrentProps) {
4635
4655
  for (const key in attrs) {
4636
- if (!rawProps || !hasOwn(rawProps, key)) {
4656
+ if (!rawProps ||
4657
+ (!hasOwn(rawProps, key) &&
4658
+ (!false ))) {
4637
4659
  delete attrs[key];
4638
4660
  hasAttrsChanged = true;
4639
4661
  }
@@ -5729,6 +5751,7 @@ function createHydrationFunctions(rendererInternals) {
5729
5751
  return [hydrate, hydrateNode];
5730
5752
  }
5731
5753
 
5754
+ /* eslint-disable no-restricted-globals */
5732
5755
  let supported;
5733
5756
  let perf;
5734
5757
  function startMeasure(instance, type) {
@@ -5756,7 +5779,6 @@ function isSupported() {
5756
5779
  if (supported !== undefined) {
5757
5780
  return supported;
5758
5781
  }
5759
- /* eslint-disable no-restricted-globals */
5760
5782
  if (typeof window !== 'undefined' && window.performance) {
5761
5783
  supported = true;
5762
5784
  perf = window.performance;
@@ -5764,7 +5786,6 @@ function isSupported() {
5764
5786
  else {
5765
5787
  supported = false;
5766
5788
  }
5767
- /* eslint-enable no-restricted-globals */
5768
5789
  return supported;
5769
5790
  }
5770
5791
 
@@ -7641,7 +7662,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
7641
7662
  shapeFlag: vnode.shapeFlag,
7642
7663
  // if the vnode is cloned with extra props, we can no longer assume its
7643
7664
  // existing patch flag to be reliable and need to add the FULL_PROPS flag.
7644
- // note: perserve flag for fragments since they use the flag for children
7665
+ // note: preserve flag for fragments since they use the flag for children
7645
7666
  // fast paths only.
7646
7667
  patchFlag: extraProps && vnode.type !== Fragment
7647
7668
  ? patchFlag === -1 // hoisted node
@@ -7803,7 +7824,8 @@ function mergeProps(...args) {
7803
7824
  else if (isOn(key)) {
7804
7825
  const existing = ret[key];
7805
7826
  const incoming = toMerge[key];
7806
- if (existing !== incoming &&
7827
+ if (incoming &&
7828
+ existing !== incoming &&
7807
7829
  !(isArray(existing) && existing.includes(incoming))) {
7808
7830
  ret[key] = existing
7809
7831
  ? [].concat(existing, incoming)
@@ -8623,7 +8645,7 @@ function defineEmits() {
8623
8645
  * instance properties when it is accessed by a parent component via template
8624
8646
  * refs.
8625
8647
  *
8626
- * `<script setup>` components are closed by default - i.e. varaibles inside
8648
+ * `<script setup>` components are closed by default - i.e. variables inside
8627
8649
  * the `<script setup>` scope is not exposed to parent unless explicitly exposed
8628
8650
  * via `defineExpose`.
8629
8651
  *
@@ -8826,7 +8848,7 @@ function initCustomFormatter() {
8826
8848
  return [
8827
8849
  'div',
8828
8850
  {},
8829
- ['span', vueStyle, 'Reactive'],
8851
+ ['span', vueStyle, isShallow(obj) ? 'ShallowReactive' : 'Reactive'],
8830
8852
  '<',
8831
8853
  formatValue(obj),
8832
8854
  `>${isReadonly(obj) ? ` (readonly)` : ``}`
@@ -8836,7 +8858,7 @@ function initCustomFormatter() {
8836
8858
  return [
8837
8859
  'div',
8838
8860
  {},
8839
- ['span', vueStyle, 'Readonly'],
8861
+ ['span', vueStyle, isShallow(obj) ? 'ShallowReadonly' : 'Readonly'],
8840
8862
  '<',
8841
8863
  formatValue(obj),
8842
8864
  '>'
@@ -8965,7 +8987,7 @@ function initCustomFormatter() {
8965
8987
  }
8966
8988
  }
8967
8989
  function genRefFlag(v) {
8968
- if (v._shallow) {
8990
+ if (isShallow(v)) {
8969
8991
  return `ShallowRef`;
8970
8992
  }
8971
8993
  if (v.effect) {
@@ -9009,7 +9031,7 @@ function isMemoSame(cached, memo) {
9009
9031
  }
9010
9032
 
9011
9033
  // Core API ------------------------------------------------------------------
9012
- const version = "3.2.27";
9034
+ const version = "3.2.28";
9013
9035
  /**
9014
9036
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
9015
9037
  * @internal
@@ -9396,7 +9418,7 @@ function patchStopImmediatePropagation(e, value) {
9396
9418
  originalStop.call(e);
9397
9419
  e._stopped = true;
9398
9420
  };
9399
- return value.map(fn => (e) => !e._stopped && fn(e));
9421
+ return value.map(fn => (e) => !e._stopped && fn && fn(e));
9400
9422
  }
9401
9423
  else {
9402
9424
  return value;
@@ -10652,4 +10674,4 @@ function normalizeContainer(container) {
10652
10674
  */
10653
10675
  const initDirectivesForSSR = NOOP;
10654
10676
 
10655
- export { BaseTransition, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed$1 as computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineProps, defineSSRCustomElement, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn$1 as warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
10677
+ export { BaseTransition, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed$1 as computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineProps, defineSSRCustomElement, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn$1 as warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };