@vue/runtime-core 3.2.19 → 3.2.23
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/runtime-core.cjs.js +103 -49
- package/dist/runtime-core.cjs.prod.js +71 -31
- package/dist/runtime-core.d.ts +13 -3
- package/dist/runtime-core.esm-bundler.js +164 -111
- package/package.json +3 -3
package/dist/runtime-core.cjs.js
CHANGED
|
@@ -25,19 +25,22 @@ function registerHMR(instance) {
|
|
|
25
25
|
const id = instance.type.__hmrId;
|
|
26
26
|
let record = map.get(id);
|
|
27
27
|
if (!record) {
|
|
28
|
-
createRecord(id);
|
|
28
|
+
createRecord(id, instance.type);
|
|
29
29
|
record = map.get(id);
|
|
30
30
|
}
|
|
31
|
-
record.add(instance);
|
|
31
|
+
record.instances.add(instance);
|
|
32
32
|
}
|
|
33
33
|
function unregisterHMR(instance) {
|
|
34
|
-
map.get(instance.type.__hmrId).delete(instance);
|
|
34
|
+
map.get(instance.type.__hmrId).instances.delete(instance);
|
|
35
35
|
}
|
|
36
|
-
function createRecord(id) {
|
|
36
|
+
function createRecord(id, initialDef) {
|
|
37
37
|
if (map.has(id)) {
|
|
38
38
|
return false;
|
|
39
39
|
}
|
|
40
|
-
map.set(id,
|
|
40
|
+
map.set(id, {
|
|
41
|
+
initialDef: normalizeClassComponent(initialDef),
|
|
42
|
+
instances: new Set()
|
|
43
|
+
});
|
|
41
44
|
return true;
|
|
42
45
|
}
|
|
43
46
|
function normalizeClassComponent(component) {
|
|
@@ -48,7 +51,9 @@ function rerender(id, newRender) {
|
|
|
48
51
|
if (!record) {
|
|
49
52
|
return;
|
|
50
53
|
}
|
|
51
|
-
|
|
54
|
+
// update initial record (for not-yet-rendered component)
|
|
55
|
+
record.initialDef.render = newRender;
|
|
56
|
+
[...record.instances].forEach(instance => {
|
|
52
57
|
if (newRender) {
|
|
53
58
|
instance.render = newRender;
|
|
54
59
|
normalizeClassComponent(instance.type).render = newRender;
|
|
@@ -65,17 +70,16 @@ function reload(id, newComp) {
|
|
|
65
70
|
if (!record)
|
|
66
71
|
return;
|
|
67
72
|
newComp = normalizeClassComponent(newComp);
|
|
73
|
+
// update initial def (for not-yet-rendered components)
|
|
74
|
+
updateComponentDef(record.initialDef, newComp);
|
|
68
75
|
// create a snapshot which avoids the set being mutated during updates
|
|
69
|
-
const instances = [...record];
|
|
76
|
+
const instances = [...record.instances];
|
|
70
77
|
for (const instance of instances) {
|
|
71
78
|
const oldComp = normalizeClassComponent(instance.type);
|
|
72
79
|
if (!hmrDirtyComponents.has(oldComp)) {
|
|
73
80
|
// 1. Update existing comp definition to match new one
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (key !== '__file' && !(key in newComp)) {
|
|
77
|
-
delete oldComp[key];
|
|
78
|
-
}
|
|
81
|
+
if (oldComp !== record.initialDef) {
|
|
82
|
+
updateComponentDef(oldComp, newComp);
|
|
79
83
|
}
|
|
80
84
|
// 2. mark definition dirty. This forces the renderer to replace the
|
|
81
85
|
// component on patch.
|
|
@@ -121,6 +125,14 @@ function reload(id, newComp) {
|
|
|
121
125
|
}
|
|
122
126
|
});
|
|
123
127
|
}
|
|
128
|
+
function updateComponentDef(oldComp, newComp) {
|
|
129
|
+
shared.extend(oldComp, newComp);
|
|
130
|
+
for (const key in oldComp) {
|
|
131
|
+
if (key !== '__file' && !(key in newComp)) {
|
|
132
|
+
delete oldComp[key];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
124
136
|
function tryWrap(fn) {
|
|
125
137
|
return (id, arg) => {
|
|
126
138
|
try {
|
|
@@ -135,27 +147,52 @@ function tryWrap(fn) {
|
|
|
135
147
|
}
|
|
136
148
|
|
|
137
149
|
let buffer = [];
|
|
150
|
+
let devtoolsNotInstalled = false;
|
|
138
151
|
function emit(event, ...args) {
|
|
139
152
|
if (exports.devtools) {
|
|
140
153
|
exports.devtools.emit(event, ...args);
|
|
141
154
|
}
|
|
142
|
-
else {
|
|
155
|
+
else if (!devtoolsNotInstalled) {
|
|
143
156
|
buffer.push({ event, args });
|
|
144
157
|
}
|
|
145
158
|
}
|
|
146
159
|
function setDevtoolsHook(hook, target) {
|
|
160
|
+
var _a, _b;
|
|
147
161
|
exports.devtools = hook;
|
|
148
162
|
if (exports.devtools) {
|
|
149
163
|
exports.devtools.enabled = true;
|
|
150
164
|
buffer.forEach(({ event, args }) => exports.devtools.emit(event, ...args));
|
|
151
165
|
buffer = [];
|
|
152
166
|
}
|
|
153
|
-
else
|
|
167
|
+
else if (
|
|
168
|
+
// handle late devtools injection - only do this if we are in an actual
|
|
169
|
+
// browser environment to avoid the timer handle stalling test runner exit
|
|
170
|
+
// (#4815)
|
|
171
|
+
// eslint-disable-next-line no-restricted-globals
|
|
172
|
+
typeof window !== 'undefined' &&
|
|
173
|
+
// some envs mock window but not fully
|
|
174
|
+
window.HTMLElement &&
|
|
175
|
+
// also exclude jsdom
|
|
176
|
+
!((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.includes('jsdom'))) {
|
|
154
177
|
const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
|
|
155
178
|
target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
|
|
156
179
|
replay.push((newHook) => {
|
|
157
180
|
setDevtoolsHook(newHook, target);
|
|
158
181
|
});
|
|
182
|
+
// clear buffer after 3s - the user probably doesn't have devtools installed
|
|
183
|
+
// at all, and keeping the buffer will cause memory leaks (#4738)
|
|
184
|
+
setTimeout(() => {
|
|
185
|
+
if (!exports.devtools) {
|
|
186
|
+
target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
|
|
187
|
+
devtoolsNotInstalled = true;
|
|
188
|
+
buffer = [];
|
|
189
|
+
}
|
|
190
|
+
}, 3000);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
// non-browser env, assume not installed
|
|
194
|
+
devtoolsNotInstalled = true;
|
|
195
|
+
buffer = [];
|
|
159
196
|
}
|
|
160
197
|
}
|
|
161
198
|
function devtoolsInitApp(app, version) {
|
|
@@ -1230,7 +1267,8 @@ const BaseTransitionImpl = {
|
|
|
1230
1267
|
const rawProps = reactivity.toRaw(props);
|
|
1231
1268
|
const { mode } = rawProps;
|
|
1232
1269
|
// check mode
|
|
1233
|
-
if (mode &&
|
|
1270
|
+
if (mode &&
|
|
1271
|
+
mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
|
|
1234
1272
|
warn(`invalid <transition> mode: ${mode}`);
|
|
1235
1273
|
}
|
|
1236
1274
|
// at this point children has a guaranteed length of 1.
|
|
@@ -1870,7 +1908,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
|
1870
1908
|
}
|
|
1871
1909
|
current = current.parent;
|
|
1872
1910
|
}
|
|
1873
|
-
hook();
|
|
1911
|
+
return hook();
|
|
1874
1912
|
});
|
|
1875
1913
|
injectHook(type, wrappedHook, target);
|
|
1876
1914
|
// In addition to registering it on the target instance, we walk up the parent
|
|
@@ -2944,7 +2982,7 @@ return withDirectives(h(comp), [
|
|
|
2944
2982
|
[bar, this.y]
|
|
2945
2983
|
])
|
|
2946
2984
|
*/
|
|
2947
|
-
const isBuiltInDirective = /*#__PURE__*/ shared.makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text');
|
|
2985
|
+
const isBuiltInDirective = /*#__PURE__*/ shared.makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
|
|
2948
2986
|
function validateDirectiveName(name) {
|
|
2949
2987
|
if (isBuiltInDirective(name)) {
|
|
2950
2988
|
warn('Do not use built-in directive ids as custom directive id: ' + name);
|
|
@@ -4861,8 +4899,8 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
|
4861
4899
|
*
|
|
4862
4900
|
* #2080
|
|
4863
4901
|
* Inside keyed `template` fragment static children, if a fragment is moved,
|
|
4864
|
-
* the children will always moved
|
|
4865
|
-
*
|
|
4902
|
+
* the children will always be moved. Therefore, in order to ensure correct move
|
|
4903
|
+
* position, el should be inherited from previous nodes.
|
|
4866
4904
|
*/
|
|
4867
4905
|
function traverseStaticChildren(n1, n2, shallow = false) {
|
|
4868
4906
|
const ch1 = n1.children;
|
|
@@ -5642,7 +5680,8 @@ function mergeProps(...args) {
|
|
|
5642
5680
|
else if (shared.isOn(key)) {
|
|
5643
5681
|
const existing = ret[key];
|
|
5644
5682
|
const incoming = toMerge[key];
|
|
5645
|
-
if (existing !== incoming
|
|
5683
|
+
if (existing !== incoming &&
|
|
5684
|
+
!(shared.isArray(existing) && existing.includes(incoming))) {
|
|
5646
5685
|
ret[key] = existing
|
|
5647
5686
|
? [].concat(existing, incoming)
|
|
5648
5687
|
: incoming;
|
|
@@ -5845,23 +5884,23 @@ const PublicInstanceProxyHandlers = {
|
|
|
5845
5884
|
const n = accessCache[key];
|
|
5846
5885
|
if (n !== undefined) {
|
|
5847
5886
|
switch (n) {
|
|
5848
|
-
case
|
|
5887
|
+
case 1 /* SETUP */:
|
|
5849
5888
|
return setupState[key];
|
|
5850
|
-
case
|
|
5889
|
+
case 2 /* DATA */:
|
|
5851
5890
|
return data[key];
|
|
5852
|
-
case
|
|
5891
|
+
case 4 /* CONTEXT */:
|
|
5853
5892
|
return ctx[key];
|
|
5854
|
-
case
|
|
5893
|
+
case 3 /* PROPS */:
|
|
5855
5894
|
return props[key];
|
|
5856
5895
|
// default: just fallthrough
|
|
5857
5896
|
}
|
|
5858
5897
|
}
|
|
5859
5898
|
else if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
|
|
5860
|
-
accessCache[key] =
|
|
5899
|
+
accessCache[key] = 1 /* SETUP */;
|
|
5861
5900
|
return setupState[key];
|
|
5862
5901
|
}
|
|
5863
5902
|
else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
|
|
5864
|
-
accessCache[key] =
|
|
5903
|
+
accessCache[key] = 2 /* DATA */;
|
|
5865
5904
|
return data[key];
|
|
5866
5905
|
}
|
|
5867
5906
|
else if (
|
|
@@ -5869,15 +5908,15 @@ const PublicInstanceProxyHandlers = {
|
|
|
5869
5908
|
// props
|
|
5870
5909
|
(normalizedProps = instance.propsOptions[0]) &&
|
|
5871
5910
|
shared.hasOwn(normalizedProps, key)) {
|
|
5872
|
-
accessCache[key] =
|
|
5911
|
+
accessCache[key] = 3 /* PROPS */;
|
|
5873
5912
|
return props[key];
|
|
5874
5913
|
}
|
|
5875
5914
|
else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
5876
|
-
accessCache[key] =
|
|
5915
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
5877
5916
|
return ctx[key];
|
|
5878
5917
|
}
|
|
5879
5918
|
else if (shouldCacheAccess) {
|
|
5880
|
-
accessCache[key] =
|
|
5919
|
+
accessCache[key] = 0 /* OTHER */;
|
|
5881
5920
|
}
|
|
5882
5921
|
}
|
|
5883
5922
|
const publicGetter = publicPropertiesMap[key];
|
|
@@ -5898,7 +5937,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
5898
5937
|
}
|
|
5899
5938
|
else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
5900
5939
|
// user may set custom properties to `this` that start with `$`
|
|
5901
|
-
accessCache[key] =
|
|
5940
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
5902
5941
|
return ctx[key];
|
|
5903
5942
|
}
|
|
5904
5943
|
else if (
|
|
@@ -5959,7 +5998,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
5959
5998
|
},
|
|
5960
5999
|
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
5961
6000
|
let normalizedProps;
|
|
5962
|
-
return (accessCache[key]
|
|
6001
|
+
return (!!accessCache[key] ||
|
|
5963
6002
|
(data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) ||
|
|
5964
6003
|
(setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) ||
|
|
5965
6004
|
((normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key)) ||
|
|
@@ -7118,15 +7157,6 @@ function traverse(value, seen) {
|
|
|
7118
7157
|
return value;
|
|
7119
7158
|
}
|
|
7120
7159
|
|
|
7121
|
-
Object.freeze({})
|
|
7122
|
-
;
|
|
7123
|
-
Object.freeze([]) ;
|
|
7124
|
-
const isFunction = (val) => typeof val === 'function';
|
|
7125
|
-
const isObject = (val) => val !== null && typeof val === 'object';
|
|
7126
|
-
const isPromise = (val) => {
|
|
7127
|
-
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
7128
|
-
};
|
|
7129
|
-
|
|
7130
7160
|
// dev only
|
|
7131
7161
|
const warnRuntimeUsage = (method) => warn(`${method}() is a compiler-hint helper that is only usable inside ` +
|
|
7132
7162
|
`<script setup> of a single file component. Its arguments should be ` +
|
|
@@ -7204,15 +7234,21 @@ function getContext() {
|
|
|
7204
7234
|
* only.
|
|
7205
7235
|
* @internal
|
|
7206
7236
|
*/
|
|
7207
|
-
function mergeDefaults(
|
|
7208
|
-
|
|
7209
|
-
|
|
7237
|
+
function mergeDefaults(raw, defaults) {
|
|
7238
|
+
const props = shared.isArray(raw)
|
|
7239
|
+
? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {})
|
|
7240
|
+
: raw;
|
|
7210
7241
|
for (const key in defaults) {
|
|
7211
|
-
const
|
|
7212
|
-
if (
|
|
7213
|
-
|
|
7242
|
+
const opt = props[key];
|
|
7243
|
+
if (opt) {
|
|
7244
|
+
if (shared.isArray(opt) || shared.isFunction(opt)) {
|
|
7245
|
+
props[key] = { type: opt, default: defaults[key] };
|
|
7246
|
+
}
|
|
7247
|
+
else {
|
|
7248
|
+
opt.default = defaults[key];
|
|
7249
|
+
}
|
|
7214
7250
|
}
|
|
7215
|
-
else if (
|
|
7251
|
+
else if (opt === null) {
|
|
7216
7252
|
props[key] = { default: defaults[key] };
|
|
7217
7253
|
}
|
|
7218
7254
|
else {
|
|
@@ -7221,6 +7257,23 @@ props, defaults) {
|
|
|
7221
7257
|
}
|
|
7222
7258
|
return props;
|
|
7223
7259
|
}
|
|
7260
|
+
/**
|
|
7261
|
+
* Used to create a proxy for the rest element when destructuring props with
|
|
7262
|
+
* defineProps().
|
|
7263
|
+
* @internal
|
|
7264
|
+
*/
|
|
7265
|
+
function createPropsRestProxy(props, excludedKeys) {
|
|
7266
|
+
const ret = {};
|
|
7267
|
+
for (const key in props) {
|
|
7268
|
+
if (!excludedKeys.includes(key)) {
|
|
7269
|
+
Object.defineProperty(ret, key, {
|
|
7270
|
+
enumerable: true,
|
|
7271
|
+
get: () => props[key]
|
|
7272
|
+
});
|
|
7273
|
+
}
|
|
7274
|
+
}
|
|
7275
|
+
return ret;
|
|
7276
|
+
}
|
|
7224
7277
|
/**
|
|
7225
7278
|
* `<script setup>` helper for persisting the current instance context over
|
|
7226
7279
|
* async/await flows.
|
|
@@ -7247,7 +7300,7 @@ function withAsyncContext(getAwaitable) {
|
|
|
7247
7300
|
}
|
|
7248
7301
|
let awaitable = getAwaitable();
|
|
7249
7302
|
unsetCurrentInstance();
|
|
7250
|
-
if (isPromise(awaitable)) {
|
|
7303
|
+
if (shared.isPromise(awaitable)) {
|
|
7251
7304
|
awaitable = awaitable.catch(e => {
|
|
7252
7305
|
setCurrentInstance(ctx);
|
|
7253
7306
|
throw e;
|
|
@@ -7513,7 +7566,7 @@ function isMemoSame(cached, memo) {
|
|
|
7513
7566
|
}
|
|
7514
7567
|
|
|
7515
7568
|
// Core API ------------------------------------------------------------------
|
|
7516
|
-
const version = "3.2.
|
|
7569
|
+
const version = "3.2.23";
|
|
7517
7570
|
const _ssrUtils = {
|
|
7518
7571
|
createComponentInstance,
|
|
7519
7572
|
setupComponent,
|
|
@@ -7586,6 +7639,7 @@ exports.createCommentVNode = createCommentVNode;
|
|
|
7586
7639
|
exports.createElementBlock = createElementBlock;
|
|
7587
7640
|
exports.createElementVNode = createBaseVNode;
|
|
7588
7641
|
exports.createHydrationRenderer = createHydrationRenderer;
|
|
7642
|
+
exports.createPropsRestProxy = createPropsRestProxy;
|
|
7589
7643
|
exports.createRenderer = createRenderer;
|
|
7590
7644
|
exports.createSlots = createSlots;
|
|
7591
7645
|
exports.createStaticVNode = createStaticVNode;
|
|
@@ -7,18 +7,39 @@ var shared = require('@vue/shared');
|
|
|
7
7
|
|
|
8
8
|
let buffer = [];
|
|
9
9
|
function setDevtoolsHook(hook, target) {
|
|
10
|
+
var _a, _b;
|
|
10
11
|
exports.devtools = hook;
|
|
11
12
|
if (exports.devtools) {
|
|
12
13
|
exports.devtools.enabled = true;
|
|
13
14
|
buffer.forEach(({ event, args }) => exports.devtools.emit(event, ...args));
|
|
14
15
|
buffer = [];
|
|
15
16
|
}
|
|
16
|
-
else
|
|
17
|
+
else if (
|
|
18
|
+
// handle late devtools injection - only do this if we are in an actual
|
|
19
|
+
// browser environment to avoid the timer handle stalling test runner exit
|
|
20
|
+
// (#4815)
|
|
21
|
+
// eslint-disable-next-line no-restricted-globals
|
|
22
|
+
typeof window !== 'undefined' &&
|
|
23
|
+
// some envs mock window but not fully
|
|
24
|
+
window.HTMLElement &&
|
|
25
|
+
// also exclude jsdom
|
|
26
|
+
!((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.includes('jsdom'))) {
|
|
17
27
|
const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
|
|
18
28
|
target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
|
|
19
29
|
replay.push((newHook) => {
|
|
20
30
|
setDevtoolsHook(newHook, target);
|
|
21
31
|
});
|
|
32
|
+
// clear buffer after 3s - the user probably doesn't have devtools installed
|
|
33
|
+
// at all, and keeping the buffer will cause memory leaks (#4738)
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
if (!exports.devtools) {
|
|
36
|
+
target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
|
|
37
|
+
buffer = [];
|
|
38
|
+
}
|
|
39
|
+
}, 3000);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
buffer = [];
|
|
22
43
|
}
|
|
23
44
|
}
|
|
24
45
|
|
|
@@ -1502,7 +1523,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
|
1502
1523
|
}
|
|
1503
1524
|
current = current.parent;
|
|
1504
1525
|
}
|
|
1505
|
-
hook();
|
|
1526
|
+
return hook();
|
|
1506
1527
|
});
|
|
1507
1528
|
injectHook(type, wrappedHook, target);
|
|
1508
1529
|
// In addition to registering it on the target instance, we walk up the parent
|
|
@@ -3958,8 +3979,8 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
|
3958
3979
|
*
|
|
3959
3980
|
* #2080
|
|
3960
3981
|
* Inside keyed `template` fragment static children, if a fragment is moved,
|
|
3961
|
-
* the children will always moved
|
|
3962
|
-
*
|
|
3982
|
+
* the children will always be moved. Therefore, in order to ensure correct move
|
|
3983
|
+
* position, el should be inherited from previous nodes.
|
|
3963
3984
|
*/
|
|
3964
3985
|
function traverseStaticChildren(n1, n2, shallow = false) {
|
|
3965
3986
|
const ch1 = n1.children;
|
|
@@ -4659,7 +4680,8 @@ function mergeProps(...args) {
|
|
|
4659
4680
|
else if (shared.isOn(key)) {
|
|
4660
4681
|
const existing = ret[key];
|
|
4661
4682
|
const incoming = toMerge[key];
|
|
4662
|
-
if (existing !== incoming
|
|
4683
|
+
if (existing !== incoming &&
|
|
4684
|
+
!(shared.isArray(existing) && existing.includes(incoming))) {
|
|
4663
4685
|
ret[key] = existing
|
|
4664
4686
|
? [].concat(existing, incoming)
|
|
4665
4687
|
: incoming;
|
|
@@ -4835,23 +4857,23 @@ const PublicInstanceProxyHandlers = {
|
|
|
4835
4857
|
const n = accessCache[key];
|
|
4836
4858
|
if (n !== undefined) {
|
|
4837
4859
|
switch (n) {
|
|
4838
|
-
case
|
|
4860
|
+
case 1 /* SETUP */:
|
|
4839
4861
|
return setupState[key];
|
|
4840
|
-
case
|
|
4862
|
+
case 2 /* DATA */:
|
|
4841
4863
|
return data[key];
|
|
4842
|
-
case
|
|
4864
|
+
case 4 /* CONTEXT */:
|
|
4843
4865
|
return ctx[key];
|
|
4844
|
-
case
|
|
4866
|
+
case 3 /* PROPS */:
|
|
4845
4867
|
return props[key];
|
|
4846
4868
|
// default: just fallthrough
|
|
4847
4869
|
}
|
|
4848
4870
|
}
|
|
4849
4871
|
else if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
|
|
4850
|
-
accessCache[key] =
|
|
4872
|
+
accessCache[key] = 1 /* SETUP */;
|
|
4851
4873
|
return setupState[key];
|
|
4852
4874
|
}
|
|
4853
4875
|
else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
|
|
4854
|
-
accessCache[key] =
|
|
4876
|
+
accessCache[key] = 2 /* DATA */;
|
|
4855
4877
|
return data[key];
|
|
4856
4878
|
}
|
|
4857
4879
|
else if (
|
|
@@ -4859,15 +4881,15 @@ const PublicInstanceProxyHandlers = {
|
|
|
4859
4881
|
// props
|
|
4860
4882
|
(normalizedProps = instance.propsOptions[0]) &&
|
|
4861
4883
|
shared.hasOwn(normalizedProps, key)) {
|
|
4862
|
-
accessCache[key] =
|
|
4884
|
+
accessCache[key] = 3 /* PROPS */;
|
|
4863
4885
|
return props[key];
|
|
4864
4886
|
}
|
|
4865
4887
|
else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
4866
|
-
accessCache[key] =
|
|
4888
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
4867
4889
|
return ctx[key];
|
|
4868
4890
|
}
|
|
4869
4891
|
else if (shouldCacheAccess) {
|
|
4870
|
-
accessCache[key] =
|
|
4892
|
+
accessCache[key] = 0 /* OTHER */;
|
|
4871
4893
|
}
|
|
4872
4894
|
}
|
|
4873
4895
|
const publicGetter = publicPropertiesMap[key];
|
|
@@ -4887,7 +4909,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
4887
4909
|
}
|
|
4888
4910
|
else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
4889
4911
|
// user may set custom properties to `this` that start with `$`
|
|
4890
|
-
accessCache[key] =
|
|
4912
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
4891
4913
|
return ctx[key];
|
|
4892
4914
|
}
|
|
4893
4915
|
else if (
|
|
@@ -4923,7 +4945,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
4923
4945
|
},
|
|
4924
4946
|
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
4925
4947
|
let normalizedProps;
|
|
4926
|
-
return (accessCache[key]
|
|
4948
|
+
return (!!accessCache[key] ||
|
|
4927
4949
|
(data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) ||
|
|
4928
4950
|
(setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) ||
|
|
4929
4951
|
((normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key)) ||
|
|
@@ -5811,12 +5833,6 @@ function traverse(value, seen) {
|
|
|
5811
5833
|
return value;
|
|
5812
5834
|
}
|
|
5813
5835
|
|
|
5814
|
-
const isFunction = (val) => typeof val === 'function';
|
|
5815
|
-
const isObject = (val) => val !== null && typeof val === 'object';
|
|
5816
|
-
const isPromise = (val) => {
|
|
5817
|
-
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
5818
|
-
};
|
|
5819
|
-
|
|
5820
5836
|
// implementation
|
|
5821
5837
|
function defineProps() {
|
|
5822
5838
|
return null;
|
|
@@ -5875,21 +5891,44 @@ function getContext() {
|
|
|
5875
5891
|
* only.
|
|
5876
5892
|
* @internal
|
|
5877
5893
|
*/
|
|
5878
|
-
function mergeDefaults(
|
|
5879
|
-
|
|
5880
|
-
|
|
5894
|
+
function mergeDefaults(raw, defaults) {
|
|
5895
|
+
const props = shared.isArray(raw)
|
|
5896
|
+
? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {})
|
|
5897
|
+
: raw;
|
|
5881
5898
|
for (const key in defaults) {
|
|
5882
|
-
const
|
|
5883
|
-
if (
|
|
5884
|
-
|
|
5899
|
+
const opt = props[key];
|
|
5900
|
+
if (opt) {
|
|
5901
|
+
if (shared.isArray(opt) || shared.isFunction(opt)) {
|
|
5902
|
+
props[key] = { type: opt, default: defaults[key] };
|
|
5903
|
+
}
|
|
5904
|
+
else {
|
|
5905
|
+
opt.default = defaults[key];
|
|
5906
|
+
}
|
|
5885
5907
|
}
|
|
5886
|
-
else if (
|
|
5908
|
+
else if (opt === null) {
|
|
5887
5909
|
props[key] = { default: defaults[key] };
|
|
5888
5910
|
}
|
|
5889
5911
|
else ;
|
|
5890
5912
|
}
|
|
5891
5913
|
return props;
|
|
5892
5914
|
}
|
|
5915
|
+
/**
|
|
5916
|
+
* Used to create a proxy for the rest element when destructuring props with
|
|
5917
|
+
* defineProps().
|
|
5918
|
+
* @internal
|
|
5919
|
+
*/
|
|
5920
|
+
function createPropsRestProxy(props, excludedKeys) {
|
|
5921
|
+
const ret = {};
|
|
5922
|
+
for (const key in props) {
|
|
5923
|
+
if (!excludedKeys.includes(key)) {
|
|
5924
|
+
Object.defineProperty(ret, key, {
|
|
5925
|
+
enumerable: true,
|
|
5926
|
+
get: () => props[key]
|
|
5927
|
+
});
|
|
5928
|
+
}
|
|
5929
|
+
}
|
|
5930
|
+
return ret;
|
|
5931
|
+
}
|
|
5893
5932
|
/**
|
|
5894
5933
|
* `<script setup>` helper for persisting the current instance context over
|
|
5895
5934
|
* async/await flows.
|
|
@@ -5912,7 +5951,7 @@ function withAsyncContext(getAwaitable) {
|
|
|
5912
5951
|
const ctx = getCurrentInstance();
|
|
5913
5952
|
let awaitable = getAwaitable();
|
|
5914
5953
|
unsetCurrentInstance();
|
|
5915
|
-
if (isPromise(awaitable)) {
|
|
5954
|
+
if (shared.isPromise(awaitable)) {
|
|
5916
5955
|
awaitable = awaitable.catch(e => {
|
|
5917
5956
|
setCurrentInstance(ctx);
|
|
5918
5957
|
throw e;
|
|
@@ -5996,7 +6035,7 @@ function isMemoSame(cached, memo) {
|
|
|
5996
6035
|
}
|
|
5997
6036
|
|
|
5998
6037
|
// Core API ------------------------------------------------------------------
|
|
5999
|
-
const version = "3.2.
|
|
6038
|
+
const version = "3.2.23";
|
|
6000
6039
|
const _ssrUtils = {
|
|
6001
6040
|
createComponentInstance,
|
|
6002
6041
|
setupComponent,
|
|
@@ -6069,6 +6108,7 @@ exports.createCommentVNode = createCommentVNode;
|
|
|
6069
6108
|
exports.createElementBlock = createElementBlock;
|
|
6070
6109
|
exports.createElementVNode = createBaseVNode;
|
|
6071
6110
|
exports.createHydrationRenderer = createHydrationRenderer;
|
|
6111
|
+
exports.createPropsRestProxy = createPropsRestProxy;
|
|
6072
6112
|
exports.createRenderer = createRenderer;
|
|
6073
6113
|
exports.createSlots = createSlots;
|
|
6074
6114
|
exports.createStaticVNode = createStaticVNode;
|
package/dist/runtime-core.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { camelize } from '@vue/shared';
|
|
2
2
|
import { capitalize } from '@vue/shared';
|
|
3
|
+
import { ComponentPropsOptions as ComponentPropsOptions_2 } from '@vue/runtime-core';
|
|
3
4
|
import { computed } from '@vue/reactivity';
|
|
4
5
|
import { ComputedGetter } from '@vue/reactivity';
|
|
5
6
|
import { ComputedRef } from '@vue/reactivity';
|
|
@@ -28,6 +29,7 @@ import { ReactiveFlags } from '@vue/reactivity';
|
|
|
28
29
|
import { readonly } from '@vue/reactivity';
|
|
29
30
|
import { Ref } from '@vue/reactivity';
|
|
30
31
|
import { ref } from '@vue/reactivity';
|
|
32
|
+
import { ShallowReactive } from '@vue/reactivity';
|
|
31
33
|
import { shallowReactive } from '@vue/reactivity';
|
|
32
34
|
import { shallowReadonly } from '@vue/reactivity';
|
|
33
35
|
import { shallowRef } from '@vue/reactivity';
|
|
@@ -547,7 +549,9 @@ export declare function createElementVNode(type: VNodeTypes | ClassComponent | t
|
|
|
547
549
|
|
|
548
550
|
export declare function createHydrationRenderer(options: RendererOptions<Node, Element>): HydrationRenderer;
|
|
549
551
|
|
|
550
|
-
|
|
552
|
+
/* Excluded from this release type: createPropsRestProxy */
|
|
553
|
+
|
|
554
|
+
declare function createRecord(id: string, initialDef: HMRComponent): boolean;
|
|
551
555
|
|
|
552
556
|
/**
|
|
553
557
|
* The createRenderer function accepts two generic arguments:
|
|
@@ -941,8 +945,12 @@ export declare interface HydrationRenderer extends Renderer<Element | ShadowRoot
|
|
|
941
945
|
hydrate: RootHydrateFunction;
|
|
942
946
|
}
|
|
943
947
|
|
|
948
|
+
declare type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N;
|
|
949
|
+
|
|
950
|
+
declare type InferDefault<P, T> = T extends null | number | string | boolean | symbol | Function ? T : (props: P) => T;
|
|
951
|
+
|
|
944
952
|
declare type InferDefaults<T> = {
|
|
945
|
-
[K in keyof T]?:
|
|
953
|
+
[K in keyof T]?: InferDefault<T, NotUndefined<T[K]>>;
|
|
946
954
|
};
|
|
947
955
|
|
|
948
956
|
declare type InferPropType<T> = [T] extends [null] ? any : [T] extends [{
|
|
@@ -955,7 +963,7 @@ declare type InferPropType<T> = [T] extends [null] ? any : [T] extends [{
|
|
|
955
963
|
type: DateConstructor;
|
|
956
964
|
}] ? Date : [T] extends [(infer U)[] | {
|
|
957
965
|
type: (infer U)[];
|
|
958
|
-
}] ? U extends DateConstructor ? Date | InferPropType<U> : InferPropType<U> : [T] extends [Prop<infer V, infer D>] ? unknown extends V ? D : V : T;
|
|
966
|
+
}] ? U extends DateConstructor ? Date | InferPropType<U> : InferPropType<U> : [T] extends [Prop<infer V, infer D>] ? unknown extends V ? IfAny<V, V, D> : V : T;
|
|
959
967
|
|
|
960
968
|
export declare function initCustomFormatter(): void;
|
|
961
969
|
|
|
@@ -1592,6 +1600,8 @@ export declare interface SetupContext<E = EmitsOptions> {
|
|
|
1592
1600
|
|
|
1593
1601
|
declare type SetupRenderEffectFn = (instance: ComponentInternalInstance, initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentSuspense: SuspenseBoundary | null, isSVG: boolean, optimized: boolean) => void;
|
|
1594
1602
|
|
|
1603
|
+
export { ShallowReactive }
|
|
1604
|
+
|
|
1595
1605
|
export { shallowReactive }
|
|
1596
1606
|
|
|
1597
1607
|
export { shallowReadonly }
|