maj de vuejs
This commit is contained in:
parent
10f55f5fe7
commit
a0ae5664ab
2 changed files with 91 additions and 83 deletions
172
js/vue.js
172
js/vue.js
|
@ -280,13 +280,15 @@ var Vue = (function (exports) {
|
|||
* @private
|
||||
*/
|
||||
const toDisplayString = (val) => {
|
||||
return val == null
|
||||
? ''
|
||||
: isArray(val) ||
|
||||
(isObject(val) &&
|
||||
(val.toString === objectToString || !isFunction(val.toString)))
|
||||
? JSON.stringify(val, replacer, 2)
|
||||
: String(val);
|
||||
return isString(val)
|
||||
? val
|
||||
: val == null
|
||||
? ''
|
||||
: isArray(val) ||
|
||||
(isObject(val) &&
|
||||
(val.toString === objectToString || !isFunction(val.toString)))
|
||||
? JSON.stringify(val, replacer, 2)
|
||||
: String(val);
|
||||
};
|
||||
const replacer = (_key, val) => {
|
||||
// can't use isRef here since @vue/shared has no deps
|
||||
|
@ -360,6 +362,7 @@ var Vue = (function (exports) {
|
|||
'onVnodeBeforeMount,onVnodeMounted,' +
|
||||
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
||||
'onVnodeBeforeUnmount,onVnodeUnmounted');
|
||||
const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
|
||||
const cacheStringFunction = (fn) => {
|
||||
const cache = Object.create(null);
|
||||
return ((str) => {
|
||||
|
@ -425,7 +428,6 @@ var Vue = (function (exports) {
|
|||
}
|
||||
|
||||
let activeEffectScope;
|
||||
const effectScopeStack = [];
|
||||
class EffectScope {
|
||||
constructor(detached = false) {
|
||||
this.active = true;
|
||||
|
@ -440,11 +442,11 @@ var Vue = (function (exports) {
|
|||
run(fn) {
|
||||
if (this.active) {
|
||||
try {
|
||||
this.on();
|
||||
activeEffectScope = this;
|
||||
return fn();
|
||||
}
|
||||
finally {
|
||||
this.off();
|
||||
activeEffectScope = this.parent;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -452,23 +454,24 @@ var Vue = (function (exports) {
|
|||
}
|
||||
}
|
||||
on() {
|
||||
if (this.active) {
|
||||
effectScopeStack.push(this);
|
||||
activeEffectScope = this;
|
||||
}
|
||||
activeEffectScope = this;
|
||||
}
|
||||
off() {
|
||||
if (this.active) {
|
||||
effectScopeStack.pop();
|
||||
activeEffectScope = effectScopeStack[effectScopeStack.length - 1];
|
||||
}
|
||||
activeEffectScope = this.parent;
|
||||
}
|
||||
stop(fromParent) {
|
||||
if (this.active) {
|
||||
this.effects.forEach(e => e.stop());
|
||||
this.cleanups.forEach(cleanup => cleanup());
|
||||
let i, l;
|
||||
for (i = 0, l = this.effects.length; i < l; i++) {
|
||||
this.effects[i].stop();
|
||||
}
|
||||
for (i = 0, l = this.cleanups.length; i < l; i++) {
|
||||
this.cleanups[i]();
|
||||
}
|
||||
if (this.scopes) {
|
||||
this.scopes.forEach(e => e.stop(true));
|
||||
for (i = 0, l = this.scopes.length; i < l; i++) {
|
||||
this.scopes[i].stop(true);
|
||||
}
|
||||
}
|
||||
// nested scope, dereference from parent to avoid memory leaks
|
||||
if (this.parent && !fromParent) {
|
||||
|
@ -486,8 +489,7 @@ var Vue = (function (exports) {
|
|||
function effectScope(detached) {
|
||||
return new EffectScope(detached);
|
||||
}
|
||||
function recordEffectScope(effect, scope) {
|
||||
scope = scope || activeEffectScope;
|
||||
function recordEffectScope(effect, scope = activeEffectScope) {
|
||||
if (scope && scope.active) {
|
||||
scope.effects.push(effect);
|
||||
}
|
||||
|
@ -550,7 +552,6 @@ var Vue = (function (exports) {
|
|||
* When recursion depth is greater, fall back to using a full cleanup.
|
||||
*/
|
||||
const maxMarkerBits = 30;
|
||||
const effectStack = [];
|
||||
let activeEffect;
|
||||
const ITERATE_KEY = Symbol('iterate' );
|
||||
const MAP_KEY_ITERATE_KEY = Symbol('Map key iterate' );
|
||||
|
@ -560,35 +561,42 @@ var Vue = (function (exports) {
|
|||
this.scheduler = scheduler;
|
||||
this.active = true;
|
||||
this.deps = [];
|
||||
this.parent = undefined;
|
||||
recordEffectScope(this, scope);
|
||||
}
|
||||
run() {
|
||||
if (!this.active) {
|
||||
return this.fn();
|
||||
}
|
||||
if (!effectStack.length || !effectStack.includes(this)) {
|
||||
try {
|
||||
effectStack.push((activeEffect = this));
|
||||
enableTracking();
|
||||
trackOpBit = 1 << ++effectTrackDepth;
|
||||
if (effectTrackDepth <= maxMarkerBits) {
|
||||
initDepMarkers(this);
|
||||
}
|
||||
else {
|
||||
cleanupEffect(this);
|
||||
}
|
||||
return this.fn();
|
||||
let parent = activeEffect;
|
||||
let lastShouldTrack = shouldTrack;
|
||||
while (parent) {
|
||||
if (parent === this) {
|
||||
return;
|
||||
}
|
||||
finally {
|
||||
if (effectTrackDepth <= maxMarkerBits) {
|
||||
finalizeDepMarkers(this);
|
||||
}
|
||||
trackOpBit = 1 << --effectTrackDepth;
|
||||
resetTracking();
|
||||
effectStack.pop();
|
||||
const n = effectStack.length;
|
||||
activeEffect = n > 0 ? effectStack[n - 1] : undefined;
|
||||
parent = parent.parent;
|
||||
}
|
||||
try {
|
||||
this.parent = activeEffect;
|
||||
activeEffect = this;
|
||||
shouldTrack = true;
|
||||
trackOpBit = 1 << ++effectTrackDepth;
|
||||
if (effectTrackDepth <= maxMarkerBits) {
|
||||
initDepMarkers(this);
|
||||
}
|
||||
else {
|
||||
cleanupEffect(this);
|
||||
}
|
||||
return this.fn();
|
||||
}
|
||||
finally {
|
||||
if (effectTrackDepth <= maxMarkerBits) {
|
||||
finalizeDepMarkers(this);
|
||||
}
|
||||
trackOpBit = 1 << --effectTrackDepth;
|
||||
activeEffect = this.parent;
|
||||
shouldTrack = lastShouldTrack;
|
||||
this.parent = undefined;
|
||||
}
|
||||
}
|
||||
stop() {
|
||||
|
@ -636,32 +644,24 @@ var Vue = (function (exports) {
|
|||
trackStack.push(shouldTrack);
|
||||
shouldTrack = false;
|
||||
}
|
||||
function enableTracking() {
|
||||
trackStack.push(shouldTrack);
|
||||
shouldTrack = true;
|
||||
}
|
||||
function resetTracking() {
|
||||
const last = trackStack.pop();
|
||||
shouldTrack = last === undefined ? true : last;
|
||||
}
|
||||
function track(target, type, key) {
|
||||
if (!isTracking()) {
|
||||
return;
|
||||
if (shouldTrack && activeEffect) {
|
||||
let depsMap = targetMap.get(target);
|
||||
if (!depsMap) {
|
||||
targetMap.set(target, (depsMap = new Map()));
|
||||
}
|
||||
let dep = depsMap.get(key);
|
||||
if (!dep) {
|
||||
depsMap.set(key, (dep = createDep()));
|
||||
}
|
||||
const eventInfo = { effect: activeEffect, target, type, key }
|
||||
;
|
||||
trackEffects(dep, eventInfo);
|
||||
}
|
||||
let depsMap = targetMap.get(target);
|
||||
if (!depsMap) {
|
||||
targetMap.set(target, (depsMap = new Map()));
|
||||
}
|
||||
let dep = depsMap.get(key);
|
||||
if (!dep) {
|
||||
depsMap.set(key, (dep = createDep()));
|
||||
}
|
||||
const eventInfo = { effect: activeEffect, target, type, key }
|
||||
;
|
||||
trackEffects(dep, eventInfo);
|
||||
}
|
||||
function isTracking() {
|
||||
return shouldTrack && activeEffect !== undefined;
|
||||
}
|
||||
function trackEffects(dep, debuggerEventExtraInfo) {
|
||||
let shouldTrack = false;
|
||||
|
@ -1346,13 +1346,10 @@ var Vue = (function (exports) {
|
|||
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
||||
|
||||
function trackRefValue(ref) {
|
||||
if (isTracking()) {
|
||||
if (shouldTrack && activeEffect) {
|
||||
ref = toRaw(ref);
|
||||
if (!ref.dep) {
|
||||
ref.dep = createDep();
|
||||
}
|
||||
{
|
||||
trackEffects(ref.dep, {
|
||||
trackEffects(ref.dep || (ref.dep = createDep()), {
|
||||
target: ref,
|
||||
type: "get" /* GET */,
|
||||
key: 'value'
|
||||
|
@ -1374,7 +1371,7 @@ var Vue = (function (exports) {
|
|||
}
|
||||
}
|
||||
function isRef(r) {
|
||||
return Boolean(r && r.__v_isRef === true);
|
||||
return !!(r && r.__v_isRef === true);
|
||||
}
|
||||
function ref(value) {
|
||||
return createRef(value, false);
|
||||
|
@ -5186,7 +5183,6 @@ var Vue = (function (exports) {
|
|||
[bar, this.y]
|
||||
])
|
||||
*/
|
||||
const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
|
||||
function validateDirectiveName(name) {
|
||||
if (isBuiltInDirective(name)) {
|
||||
warn$1('Do not use built-in directive ids as custom directive id: ' + name);
|
||||
|
@ -5667,7 +5663,8 @@ var Vue = (function (exports) {
|
|||
// e.g. <option :value="obj">, <input type="checkbox" :true-value="1">
|
||||
const forcePatchValue = (type === 'input' && dirs) || type === 'option';
|
||||
// skip props & children if this is hoisted static nodes
|
||||
if (forcePatchValue || patchFlag !== -1 /* HOISTED */) {
|
||||
// #5405 in dev, always hydrate children for HMR
|
||||
{
|
||||
if (dirs) {
|
||||
invokeDirectiveHook(vnode, null, parentComponent, 'created');
|
||||
}
|
||||
|
@ -8201,9 +8198,11 @@ var Vue = (function (exports) {
|
|||
const { data, setupState, ctx } = instance;
|
||||
if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
||||
setupState[key] = value;
|
||||
return true;
|
||||
}
|
||||
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
||||
data[key] = value;
|
||||
return true;
|
||||
}
|
||||
else if (hasOwn(instance.props, key)) {
|
||||
warn$1(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
|
||||
|
@ -8237,6 +8236,15 @@ var Vue = (function (exports) {
|
|||
hasOwn(ctx, key) ||
|
||||
hasOwn(publicPropertiesMap, key) ||
|
||||
hasOwn(appContext.config.globalProperties, key));
|
||||
},
|
||||
defineProperty(target, key, descriptor) {
|
||||
if (descriptor.get != null) {
|
||||
this.set(target, key, descriptor.get(), null);
|
||||
}
|
||||
else if (descriptor.value != null) {
|
||||
this.set(target, key, descriptor.value, null);
|
||||
}
|
||||
return Reflect.defineProperty(target, key, descriptor);
|
||||
}
|
||||
};
|
||||
{
|
||||
|
@ -9107,7 +9115,7 @@ var Vue = (function (exports) {
|
|||
}
|
||||
|
||||
// Core API ------------------------------------------------------------------
|
||||
const version = "3.2.29";
|
||||
const version = "3.2.31";
|
||||
/**
|
||||
* SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
|
||||
* @internal
|
||||
|
@ -11375,13 +11383,13 @@ var Vue = (function (exports) {
|
|||
message: `Platform-native elements with "is" prop will no longer be ` +
|
||||
`treated as components in Vue 3 unless the "is" value is explicitly ` +
|
||||
`prefixed with "vue:".`,
|
||||
link: `https://v3.vuejs.org/guide/migration/custom-elements-interop.html`
|
||||
link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html`
|
||||
},
|
||||
["COMPILER_V_BIND_SYNC" /* COMPILER_V_BIND_SYNC */]: {
|
||||
message: key => `.sync modifier for v-bind has been removed. Use v-model with ` +
|
||||
`argument instead. \`v-bind:${key}.sync\` should be changed to ` +
|
||||
`\`v-model:${key}\`.`,
|
||||
link: `https://v3.vuejs.org/guide/migration/v-model.html`
|
||||
link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
|
||||
},
|
||||
["COMPILER_V_BIND_PROP" /* COMPILER_V_BIND_PROP */]: {
|
||||
message: `.prop modifier for v-bind has been removed and no longer necessary. ` +
|
||||
|
@ -11393,11 +11401,11 @@ var Vue = (function (exports) {
|
|||
`that appears before v-bind in the case of conflict. ` +
|
||||
`To retain 2.x behavior, move v-bind to make it the first attribute. ` +
|
||||
`You can also suppress this warning if the usage is intended.`,
|
||||
link: `https://v3.vuejs.org/guide/migration/v-bind.html`
|
||||
link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
|
||||
},
|
||||
["COMPILER_V_ON_NATIVE" /* COMPILER_V_ON_NATIVE */]: {
|
||||
message: `.native modifier for v-on has been removed as is no longer necessary.`,
|
||||
link: `https://v3.vuejs.org/guide/migration/v-on-native-modifier-removed.html`
|
||||
link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html`
|
||||
},
|
||||
["COMPILER_V_IF_V_FOR_PRECEDENCE" /* COMPILER_V_IF_V_FOR_PRECEDENCE */]: {
|
||||
message: `v-if / v-for precedence when used on the same element has changed ` +
|
||||
|
@ -11405,7 +11413,7 @@ var Vue = (function (exports) {
|
|||
`access to v-for scope variables. It is best to avoid the ambiguity ` +
|
||||
`with <template> tags or use a computed property that filters v-for ` +
|
||||
`data source.`,
|
||||
link: `https://v3.vuejs.org/guide/migration/v-if-v-for.html`
|
||||
link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html`
|
||||
},
|
||||
["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
|
||||
message: `<template> with no special directives will render as a native template ` +
|
||||
|
@ -11413,13 +11421,13 @@ var Vue = (function (exports) {
|
|||
},
|
||||
["COMPILER_INLINE_TEMPLATE" /* COMPILER_INLINE_TEMPLATE */]: {
|
||||
message: `"inline-template" has been removed in Vue 3.`,
|
||||
link: `https://v3.vuejs.org/guide/migration/inline-template-attribute.html`
|
||||
link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
|
||||
},
|
||||
["COMPILER_FILTER" /* COMPILER_FILTERS */]: {
|
||||
message: `filters have been removed in Vue 3. ` +
|
||||
`The "|" symbol will be treated as native JavaScript bitwise OR operator. ` +
|
||||
`Use method calls or computed properties instead.`,
|
||||
link: `https://v3.vuejs.org/guide/migration/filters.html`
|
||||
link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
|
||||
}
|
||||
};
|
||||
function getCompatValue(key, context) {
|
||||
|
@ -14423,7 +14431,7 @@ var Vue = (function (exports) {
|
|||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if (!isBuiltInDirective(name)) {
|
||||
// no built-in transform, this is a user custom directive.
|
||||
runtimeDirectives.push(prop);
|
||||
// custom dirs may use beforeUpdate so they need to force blocks
|
||||
|
|
2
js/vue.min.js
vendored
2
js/vue.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue