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
|
* @private
|
||||||
*/
|
*/
|
||||||
const toDisplayString = (val) => {
|
const toDisplayString = (val) => {
|
||||||
return val == null
|
return isString(val)
|
||||||
? ''
|
? val
|
||||||
: isArray(val) ||
|
: val == null
|
||||||
(isObject(val) &&
|
? ''
|
||||||
(val.toString === objectToString || !isFunction(val.toString)))
|
: isArray(val) ||
|
||||||
? JSON.stringify(val, replacer, 2)
|
(isObject(val) &&
|
||||||
: String(val);
|
(val.toString === objectToString || !isFunction(val.toString)))
|
||||||
|
? JSON.stringify(val, replacer, 2)
|
||||||
|
: String(val);
|
||||||
};
|
};
|
||||||
const replacer = (_key, val) => {
|
const replacer = (_key, val) => {
|
||||||
// can't use isRef here since @vue/shared has no deps
|
// can't use isRef here since @vue/shared has no deps
|
||||||
|
@ -360,6 +362,7 @@ var Vue = (function (exports) {
|
||||||
'onVnodeBeforeMount,onVnodeMounted,' +
|
'onVnodeBeforeMount,onVnodeMounted,' +
|
||||||
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
||||||
'onVnodeBeforeUnmount,onVnodeUnmounted');
|
'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 cacheStringFunction = (fn) => {
|
||||||
const cache = Object.create(null);
|
const cache = Object.create(null);
|
||||||
return ((str) => {
|
return ((str) => {
|
||||||
|
@ -425,7 +428,6 @@ var Vue = (function (exports) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let activeEffectScope;
|
let activeEffectScope;
|
||||||
const effectScopeStack = [];
|
|
||||||
class EffectScope {
|
class EffectScope {
|
||||||
constructor(detached = false) {
|
constructor(detached = false) {
|
||||||
this.active = true;
|
this.active = true;
|
||||||
|
@ -440,11 +442,11 @@ var Vue = (function (exports) {
|
||||||
run(fn) {
|
run(fn) {
|
||||||
if (this.active) {
|
if (this.active) {
|
||||||
try {
|
try {
|
||||||
this.on();
|
activeEffectScope = this;
|
||||||
return fn();
|
return fn();
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
this.off();
|
activeEffectScope = this.parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -452,23 +454,24 @@ var Vue = (function (exports) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
on() {
|
on() {
|
||||||
if (this.active) {
|
activeEffectScope = this;
|
||||||
effectScopeStack.push(this);
|
|
||||||
activeEffectScope = this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
off() {
|
off() {
|
||||||
if (this.active) {
|
activeEffectScope = this.parent;
|
||||||
effectScopeStack.pop();
|
|
||||||
activeEffectScope = effectScopeStack[effectScopeStack.length - 1];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
stop(fromParent) {
|
stop(fromParent) {
|
||||||
if (this.active) {
|
if (this.active) {
|
||||||
this.effects.forEach(e => e.stop());
|
let i, l;
|
||||||
this.cleanups.forEach(cleanup => cleanup());
|
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) {
|
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
|
// nested scope, dereference from parent to avoid memory leaks
|
||||||
if (this.parent && !fromParent) {
|
if (this.parent && !fromParent) {
|
||||||
|
@ -486,8 +489,7 @@ var Vue = (function (exports) {
|
||||||
function effectScope(detached) {
|
function effectScope(detached) {
|
||||||
return new EffectScope(detached);
|
return new EffectScope(detached);
|
||||||
}
|
}
|
||||||
function recordEffectScope(effect, scope) {
|
function recordEffectScope(effect, scope = activeEffectScope) {
|
||||||
scope = scope || activeEffectScope;
|
|
||||||
if (scope && scope.active) {
|
if (scope && scope.active) {
|
||||||
scope.effects.push(effect);
|
scope.effects.push(effect);
|
||||||
}
|
}
|
||||||
|
@ -550,7 +552,6 @@ var Vue = (function (exports) {
|
||||||
* When recursion depth is greater, fall back to using a full cleanup.
|
* When recursion depth is greater, fall back to using a full cleanup.
|
||||||
*/
|
*/
|
||||||
const maxMarkerBits = 30;
|
const maxMarkerBits = 30;
|
||||||
const effectStack = [];
|
|
||||||
let activeEffect;
|
let activeEffect;
|
||||||
const ITERATE_KEY = Symbol('iterate' );
|
const ITERATE_KEY = Symbol('iterate' );
|
||||||
const MAP_KEY_ITERATE_KEY = Symbol('Map key iterate' );
|
const MAP_KEY_ITERATE_KEY = Symbol('Map key iterate' );
|
||||||
|
@ -560,35 +561,42 @@ var Vue = (function (exports) {
|
||||||
this.scheduler = scheduler;
|
this.scheduler = scheduler;
|
||||||
this.active = true;
|
this.active = true;
|
||||||
this.deps = [];
|
this.deps = [];
|
||||||
|
this.parent = undefined;
|
||||||
recordEffectScope(this, scope);
|
recordEffectScope(this, scope);
|
||||||
}
|
}
|
||||||
run() {
|
run() {
|
||||||
if (!this.active) {
|
if (!this.active) {
|
||||||
return this.fn();
|
return this.fn();
|
||||||
}
|
}
|
||||||
if (!effectStack.length || !effectStack.includes(this)) {
|
let parent = activeEffect;
|
||||||
try {
|
let lastShouldTrack = shouldTrack;
|
||||||
effectStack.push((activeEffect = this));
|
while (parent) {
|
||||||
enableTracking();
|
if (parent === this) {
|
||||||
trackOpBit = 1 << ++effectTrackDepth;
|
return;
|
||||||
if (effectTrackDepth <= maxMarkerBits) {
|
|
||||||
initDepMarkers(this);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cleanupEffect(this);
|
|
||||||
}
|
|
||||||
return this.fn();
|
|
||||||
}
|
}
|
||||||
finally {
|
parent = parent.parent;
|
||||||
if (effectTrackDepth <= maxMarkerBits) {
|
}
|
||||||
finalizeDepMarkers(this);
|
try {
|
||||||
}
|
this.parent = activeEffect;
|
||||||
trackOpBit = 1 << --effectTrackDepth;
|
activeEffect = this;
|
||||||
resetTracking();
|
shouldTrack = true;
|
||||||
effectStack.pop();
|
trackOpBit = 1 << ++effectTrackDepth;
|
||||||
const n = effectStack.length;
|
if (effectTrackDepth <= maxMarkerBits) {
|
||||||
activeEffect = n > 0 ? effectStack[n - 1] : undefined;
|
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() {
|
stop() {
|
||||||
|
@ -636,32 +644,24 @@ var Vue = (function (exports) {
|
||||||
trackStack.push(shouldTrack);
|
trackStack.push(shouldTrack);
|
||||||
shouldTrack = false;
|
shouldTrack = false;
|
||||||
}
|
}
|
||||||
function enableTracking() {
|
|
||||||
trackStack.push(shouldTrack);
|
|
||||||
shouldTrack = true;
|
|
||||||
}
|
|
||||||
function resetTracking() {
|
function resetTracking() {
|
||||||
const last = trackStack.pop();
|
const last = trackStack.pop();
|
||||||
shouldTrack = last === undefined ? true : last;
|
shouldTrack = last === undefined ? true : last;
|
||||||
}
|
}
|
||||||
function track(target, type, key) {
|
function track(target, type, key) {
|
||||||
if (!isTracking()) {
|
if (shouldTrack && activeEffect) {
|
||||||
return;
|
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) {
|
function trackEffects(dep, debuggerEventExtraInfo) {
|
||||||
let shouldTrack = false;
|
let shouldTrack = false;
|
||||||
|
@ -1346,13 +1346,10 @@ var Vue = (function (exports) {
|
||||||
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
||||||
|
|
||||||
function trackRefValue(ref) {
|
function trackRefValue(ref) {
|
||||||
if (isTracking()) {
|
if (shouldTrack && activeEffect) {
|
||||||
ref = toRaw(ref);
|
ref = toRaw(ref);
|
||||||
if (!ref.dep) {
|
|
||||||
ref.dep = createDep();
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
trackEffects(ref.dep, {
|
trackEffects(ref.dep || (ref.dep = createDep()), {
|
||||||
target: ref,
|
target: ref,
|
||||||
type: "get" /* GET */,
|
type: "get" /* GET */,
|
||||||
key: 'value'
|
key: 'value'
|
||||||
|
@ -1374,7 +1371,7 @@ var Vue = (function (exports) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function isRef(r) {
|
function isRef(r) {
|
||||||
return Boolean(r && r.__v_isRef === true);
|
return !!(r && r.__v_isRef === true);
|
||||||
}
|
}
|
||||||
function ref(value) {
|
function ref(value) {
|
||||||
return createRef(value, false);
|
return createRef(value, false);
|
||||||
|
@ -5186,7 +5183,6 @@ var Vue = (function (exports) {
|
||||||
[bar, this.y]
|
[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) {
|
function validateDirectiveName(name) {
|
||||||
if (isBuiltInDirective(name)) {
|
if (isBuiltInDirective(name)) {
|
||||||
warn$1('Do not use built-in directive ids as custom directive id: ' + 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">
|
// e.g. <option :value="obj">, <input type="checkbox" :true-value="1">
|
||||||
const forcePatchValue = (type === 'input' && dirs) || type === 'option';
|
const forcePatchValue = (type === 'input' && dirs) || type === 'option';
|
||||||
// skip props & children if this is hoisted static nodes
|
// skip props & children if this is hoisted static nodes
|
||||||
if (forcePatchValue || patchFlag !== -1 /* HOISTED */) {
|
// #5405 in dev, always hydrate children for HMR
|
||||||
|
{
|
||||||
if (dirs) {
|
if (dirs) {
|
||||||
invokeDirectiveHook(vnode, null, parentComponent, 'created');
|
invokeDirectiveHook(vnode, null, parentComponent, 'created');
|
||||||
}
|
}
|
||||||
|
@ -8201,9 +8198,11 @@ var Vue = (function (exports) {
|
||||||
const { data, setupState, ctx } = instance;
|
const { data, setupState, ctx } = instance;
|
||||||
if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
||||||
setupState[key] = value;
|
setupState[key] = value;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
||||||
data[key] = value;
|
data[key] = value;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else if (hasOwn(instance.props, key)) {
|
else if (hasOwn(instance.props, key)) {
|
||||||
warn$1(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
|
warn$1(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
|
||||||
|
@ -8237,6 +8236,15 @@ var Vue = (function (exports) {
|
||||||
hasOwn(ctx, key) ||
|
hasOwn(ctx, key) ||
|
||||||
hasOwn(publicPropertiesMap, key) ||
|
hasOwn(publicPropertiesMap, key) ||
|
||||||
hasOwn(appContext.config.globalProperties, 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 ------------------------------------------------------------------
|
// Core API ------------------------------------------------------------------
|
||||||
const version = "3.2.29";
|
const version = "3.2.31";
|
||||||
/**
|
/**
|
||||||
* SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
|
* SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
|
||||||
* @internal
|
* @internal
|
||||||
|
@ -11375,13 +11383,13 @@ var Vue = (function (exports) {
|
||||||
message: `Platform-native elements with "is" prop will no longer be ` +
|
message: `Platform-native elements with "is" prop will no longer be ` +
|
||||||
`treated as components in Vue 3 unless the "is" value is explicitly ` +
|
`treated as components in Vue 3 unless the "is" value is explicitly ` +
|
||||||
`prefixed with "vue:".`,
|
`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 */]: {
|
["COMPILER_V_BIND_SYNC" /* COMPILER_V_BIND_SYNC */]: {
|
||||||
message: key => `.sync modifier for v-bind has been removed. Use v-model with ` +
|
message: key => `.sync modifier for v-bind has been removed. Use v-model with ` +
|
||||||
`argument instead. \`v-bind:${key}.sync\` should be changed to ` +
|
`argument instead. \`v-bind:${key}.sync\` should be changed to ` +
|
||||||
`\`v-model:${key}\`.`,
|
`\`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 */]: {
|
["COMPILER_V_BIND_PROP" /* COMPILER_V_BIND_PROP */]: {
|
||||||
message: `.prop modifier for v-bind has been removed and no longer necessary. ` +
|
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. ` +
|
`that appears before v-bind in the case of conflict. ` +
|
||||||
`To retain 2.x behavior, move v-bind to make it the first attribute. ` +
|
`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.`,
|
`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 */]: {
|
["COMPILER_V_ON_NATIVE" /* COMPILER_V_ON_NATIVE */]: {
|
||||||
message: `.native modifier for v-on has been removed as is no longer necessary.`,
|
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 */]: {
|
["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 ` +
|
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 ` +
|
`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 ` +
|
`with <template> tags or use a computed property that filters v-for ` +
|
||||||
`data source.`,
|
`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 */]: {
|
["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
|
||||||
message: `<template> with no special directives will render as a 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 */]: {
|
["COMPILER_INLINE_TEMPLATE" /* COMPILER_INLINE_TEMPLATE */]: {
|
||||||
message: `"inline-template" has been removed in Vue 3.`,
|
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 */]: {
|
["COMPILER_FILTER" /* COMPILER_FILTERS */]: {
|
||||||
message: `filters have been removed in Vue 3. ` +
|
message: `filters have been removed in Vue 3. ` +
|
||||||
`The "|" symbol will be treated as native JavaScript bitwise OR operator. ` +
|
`The "|" symbol will be treated as native JavaScript bitwise OR operator. ` +
|
||||||
`Use method calls or computed properties instead.`,
|
`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) {
|
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.
|
// no built-in transform, this is a user custom directive.
|
||||||
runtimeDirectives.push(prop);
|
runtimeDirectives.push(prop);
|
||||||
// custom dirs may use beforeUpdate so they need to force blocks
|
// 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