@vue/runtime-dom 3.2.47 → 3.3.0-alpha.2
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-dom.cjs.js +1279 -1456
- package/dist/runtime-dom.cjs.prod.js +1192 -1367
- package/dist/runtime-dom.d.ts +137 -180
- package/dist/runtime-dom.esm-browser.js +9244 -9907
- package/dist/runtime-dom.esm-browser.prod.js +1 -1
- package/dist/runtime-dom.esm-bundler.js +1333 -1516
- package/dist/runtime-dom.global.js +9230 -9895
- package/dist/runtime-dom.global.prod.js +1 -1
- package/package.json +3 -3
package/dist/runtime-dom.cjs.js
CHANGED
|
@@ -5,1639 +5,1462 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var runtimeCore = require('@vue/runtime-core');
|
|
6
6
|
var shared = require('@vue/shared');
|
|
7
7
|
|
|
8
|
-
const svgNS =
|
|
9
|
-
const doc =
|
|
10
|
-
const templateContainer = doc &&
|
|
8
|
+
const svgNS = "http://www.w3.org/2000/svg";
|
|
9
|
+
const doc = typeof document !== "undefined" ? document : null;
|
|
10
|
+
const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
|
|
11
11
|
const nodeOps = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
parent.insertBefore(template, anchor);
|
|
75
|
-
}
|
|
76
|
-
return [
|
|
77
|
-
// first
|
|
78
|
-
before ? before.nextSibling : parent.firstChild,
|
|
79
|
-
// last
|
|
80
|
-
anchor ? anchor.previousSibling : parent.lastChild
|
|
81
|
-
];
|
|
82
|
-
}
|
|
12
|
+
insert: (child, parent, anchor) => {
|
|
13
|
+
parent.insertBefore(child, anchor || null);
|
|
14
|
+
},
|
|
15
|
+
remove: (child) => {
|
|
16
|
+
const parent = child.parentNode;
|
|
17
|
+
if (parent) {
|
|
18
|
+
parent.removeChild(child);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
createElement: (tag, isSVG, is, props) => {
|
|
22
|
+
const el = isSVG ? doc.createElementNS(svgNS, tag) : doc.createElement(tag, is ? { is } : void 0);
|
|
23
|
+
if (tag === "select" && props && props.multiple != null) {
|
|
24
|
+
el.setAttribute("multiple", props.multiple);
|
|
25
|
+
}
|
|
26
|
+
return el;
|
|
27
|
+
},
|
|
28
|
+
createText: (text) => doc.createTextNode(text),
|
|
29
|
+
createComment: (text) => doc.createComment(text),
|
|
30
|
+
setText: (node, text) => {
|
|
31
|
+
node.nodeValue = text;
|
|
32
|
+
},
|
|
33
|
+
setElementText: (el, text) => {
|
|
34
|
+
el.textContent = text;
|
|
35
|
+
},
|
|
36
|
+
parentNode: (node) => node.parentNode,
|
|
37
|
+
nextSibling: (node) => node.nextSibling,
|
|
38
|
+
querySelector: (selector) => doc.querySelector(selector),
|
|
39
|
+
setScopeId(el, id) {
|
|
40
|
+
el.setAttribute(id, "");
|
|
41
|
+
},
|
|
42
|
+
// __UNSAFE__
|
|
43
|
+
// Reason: innerHTML.
|
|
44
|
+
// Static content here can only come from compiled templates.
|
|
45
|
+
// As long as the user only uses trusted templates, this is safe.
|
|
46
|
+
insertStaticContent(content, parent, anchor, isSVG, start, end) {
|
|
47
|
+
const before = anchor ? anchor.previousSibling : parent.lastChild;
|
|
48
|
+
if (start && (start === end || start.nextSibling)) {
|
|
49
|
+
while (true) {
|
|
50
|
+
parent.insertBefore(start.cloneNode(true), anchor);
|
|
51
|
+
if (start === end || !(start = start.nextSibling))
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
templateContainer.innerHTML = isSVG ? `<svg>${content}</svg>` : content;
|
|
56
|
+
const template = templateContainer.content;
|
|
57
|
+
if (isSVG) {
|
|
58
|
+
const wrapper = template.firstChild;
|
|
59
|
+
while (wrapper.firstChild) {
|
|
60
|
+
template.appendChild(wrapper.firstChild);
|
|
61
|
+
}
|
|
62
|
+
template.removeChild(wrapper);
|
|
63
|
+
}
|
|
64
|
+
parent.insertBefore(template, anchor);
|
|
65
|
+
}
|
|
66
|
+
return [
|
|
67
|
+
// first
|
|
68
|
+
before ? before.nextSibling : parent.firstChild,
|
|
69
|
+
// last
|
|
70
|
+
anchor ? anchor.previousSibling : parent.lastChild
|
|
71
|
+
];
|
|
72
|
+
}
|
|
83
73
|
};
|
|
84
74
|
|
|
85
|
-
// compiler should normalize class + :class bindings on the same element
|
|
86
|
-
// into a single binding ['staticClass', dynamic]
|
|
87
75
|
function patchClass(el, value, isSVG) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
el.setAttribute('class', value);
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
el.className = value;
|
|
103
|
-
}
|
|
76
|
+
const transitionClasses = el._vtc;
|
|
77
|
+
if (transitionClasses) {
|
|
78
|
+
value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
|
|
79
|
+
}
|
|
80
|
+
if (value == null) {
|
|
81
|
+
el.removeAttribute("class");
|
|
82
|
+
} else if (isSVG) {
|
|
83
|
+
el.setAttribute("class", value);
|
|
84
|
+
} else {
|
|
85
|
+
el.className = value;
|
|
86
|
+
}
|
|
104
87
|
}
|
|
105
88
|
|
|
106
89
|
function patchStyle(el, prev, next) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
// value, thus handing over control to `v-show`.
|
|
134
|
-
if ('_vod' in el) {
|
|
135
|
-
style.display = currentDisplay;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
90
|
+
const style = el.style;
|
|
91
|
+
const isCssString = shared.isString(next);
|
|
92
|
+
if (next && !isCssString) {
|
|
93
|
+
if (prev && !shared.isString(prev)) {
|
|
94
|
+
for (const key in prev) {
|
|
95
|
+
if (next[key] == null) {
|
|
96
|
+
setStyle(style, key, "");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
for (const key in next) {
|
|
101
|
+
setStyle(style, key, next[key]);
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
const currentDisplay = style.display;
|
|
105
|
+
if (isCssString) {
|
|
106
|
+
if (prev !== next) {
|
|
107
|
+
style.cssText = next;
|
|
108
|
+
}
|
|
109
|
+
} else if (prev) {
|
|
110
|
+
el.removeAttribute("style");
|
|
111
|
+
}
|
|
112
|
+
if ("_vod" in el) {
|
|
113
|
+
style.display = currentDisplay;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
138
116
|
}
|
|
139
117
|
const semicolonRE = /[^\\];\s*$/;
|
|
140
118
|
const importantRE = /\s*!important$/;
|
|
141
119
|
function setStyle(style, name, val) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
120
|
+
if (shared.isArray(val)) {
|
|
121
|
+
val.forEach((v) => setStyle(style, name, v));
|
|
122
|
+
} else {
|
|
123
|
+
if (val == null)
|
|
124
|
+
val = "";
|
|
125
|
+
{
|
|
126
|
+
if (semicolonRE.test(val)) {
|
|
127
|
+
runtimeCore.warn(
|
|
128
|
+
`Unexpected semicolon at the end of '${name}' style value: '${val}'`
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (name.startsWith("--")) {
|
|
133
|
+
style.setProperty(name, val);
|
|
134
|
+
} else {
|
|
135
|
+
const prefixed = autoPrefix(style, name);
|
|
136
|
+
if (importantRE.test(val)) {
|
|
137
|
+
style.setProperty(
|
|
138
|
+
shared.hyphenate(prefixed),
|
|
139
|
+
val.replace(importantRE, ""),
|
|
140
|
+
"important"
|
|
141
|
+
);
|
|
142
|
+
} else {
|
|
143
|
+
style[prefixed] = val;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
168
147
|
}
|
|
169
|
-
const prefixes = [
|
|
148
|
+
const prefixes = ["Webkit", "Moz", "ms"];
|
|
170
149
|
const prefixCache = {};
|
|
171
150
|
function autoPrefix(style, rawName) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
151
|
+
const cached = prefixCache[rawName];
|
|
152
|
+
if (cached) {
|
|
153
|
+
return cached;
|
|
154
|
+
}
|
|
155
|
+
let name = runtimeCore.camelize(rawName);
|
|
156
|
+
if (name !== "filter" && name in style) {
|
|
157
|
+
return prefixCache[rawName] = name;
|
|
158
|
+
}
|
|
159
|
+
name = shared.capitalize(name);
|
|
160
|
+
for (let i = 0; i < prefixes.length; i++) {
|
|
161
|
+
const prefixed = prefixes[i] + name;
|
|
162
|
+
if (prefixed in style) {
|
|
163
|
+
return prefixCache[rawName] = prefixed;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return rawName;
|
|
188
167
|
}
|
|
189
168
|
|
|
190
|
-
const xlinkNS =
|
|
169
|
+
const xlinkNS = "http://www.w3.org/1999/xlink";
|
|
191
170
|
function patchAttr(el, key, value, isSVG, instance) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
else {
|
|
208
|
-
el.setAttribute(key, isBoolean ? '' : value);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
171
|
+
if (isSVG && key.startsWith("xlink:")) {
|
|
172
|
+
if (value == null) {
|
|
173
|
+
el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
|
174
|
+
} else {
|
|
175
|
+
el.setAttributeNS(xlinkNS, key, value);
|
|
176
|
+
}
|
|
177
|
+
} else {
|
|
178
|
+
const isBoolean = shared.isSpecialBooleanAttr(key);
|
|
179
|
+
if (value == null || isBoolean && !shared.includeBooleanAttr(value)) {
|
|
180
|
+
el.removeAttribute(key);
|
|
181
|
+
} else {
|
|
182
|
+
el.setAttribute(key, isBoolean ? "" : value);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
211
185
|
}
|
|
212
186
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
// overriding existing VNodes, in which case the old tree must be properly
|
|
218
|
-
// unmounted.
|
|
219
|
-
prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
|
220
|
-
if (key === 'innerHTML' || key === 'textContent') {
|
|
221
|
-
if (prevChildren) {
|
|
222
|
-
unmountChildren(prevChildren, parentComponent, parentSuspense);
|
|
223
|
-
}
|
|
224
|
-
el[key] = value == null ? '' : value;
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
if (key === 'value' &&
|
|
228
|
-
el.tagName !== 'PROGRESS' &&
|
|
229
|
-
// custom elements may use _value internally
|
|
230
|
-
!el.tagName.includes('-')) {
|
|
231
|
-
// store value as _value as well since
|
|
232
|
-
// non-string values will be stringified.
|
|
233
|
-
el._value = value;
|
|
234
|
-
const newValue = value == null ? '' : value;
|
|
235
|
-
if (el.value !== newValue ||
|
|
236
|
-
// #4956: always set for OPTION elements because its value falls back to
|
|
237
|
-
// textContent if no value attribute is present. And setting .value for
|
|
238
|
-
// OPTION has no side effect
|
|
239
|
-
el.tagName === 'OPTION') {
|
|
240
|
-
el.value = newValue;
|
|
241
|
-
}
|
|
242
|
-
if (value == null) {
|
|
243
|
-
el.removeAttribute(key);
|
|
244
|
-
}
|
|
245
|
-
return;
|
|
187
|
+
function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
|
188
|
+
if (key === "innerHTML" || key === "textContent") {
|
|
189
|
+
if (prevChildren) {
|
|
190
|
+
unmountChildren(prevChildren, parentComponent, parentSuspense);
|
|
246
191
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
else if (type === 'number') {
|
|
260
|
-
// e.g. <img :width="null">
|
|
261
|
-
value = 0;
|
|
262
|
-
needRemove = true;
|
|
263
|
-
}
|
|
192
|
+
el[key] = value == null ? "" : value;
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (key === "value" && el.tagName !== "PROGRESS" && // custom elements may use _value internally
|
|
196
|
+
!el.tagName.includes("-")) {
|
|
197
|
+
el._value = value;
|
|
198
|
+
const newValue = value == null ? "" : value;
|
|
199
|
+
if (el.value !== newValue || // #4956: always set for OPTION elements because its value falls back to
|
|
200
|
+
// textContent if no value attribute is present. And setting .value for
|
|
201
|
+
// OPTION has no side effect
|
|
202
|
+
el.tagName === "OPTION") {
|
|
203
|
+
el.value = newValue;
|
|
264
204
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
// eg. <select :type="null"></select> <select :willValidate="null"></select>
|
|
268
|
-
try {
|
|
269
|
-
el[key] = value;
|
|
270
|
-
}
|
|
271
|
-
catch (e) {
|
|
272
|
-
// do not warn if value is auto-coerced from nullish values
|
|
273
|
-
if (!needRemove) {
|
|
274
|
-
runtimeCore.warn(`Failed setting prop "${key}" on <${el.tagName.toLowerCase()}>: ` +
|
|
275
|
-
`value ${value} is invalid.`, e);
|
|
276
|
-
}
|
|
205
|
+
if (value == null) {
|
|
206
|
+
el.removeAttribute(key);
|
|
277
207
|
}
|
|
278
|
-
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
let needRemove = false;
|
|
211
|
+
if (value === "" || value == null) {
|
|
212
|
+
const type = typeof el[key];
|
|
213
|
+
if (type === "boolean") {
|
|
214
|
+
value = shared.includeBooleanAttr(value);
|
|
215
|
+
} else if (value == null && type === "string") {
|
|
216
|
+
value = "";
|
|
217
|
+
needRemove = true;
|
|
218
|
+
} else if (type === "number") {
|
|
219
|
+
value = 0;
|
|
220
|
+
needRemove = true;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
try {
|
|
224
|
+
el[key] = value;
|
|
225
|
+
} catch (e) {
|
|
226
|
+
if (!needRemove) {
|
|
227
|
+
runtimeCore.warn(
|
|
228
|
+
`Failed setting prop "${key}" on <${el.tagName.toLowerCase()}>: value ${value} is invalid.`,
|
|
229
|
+
e
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
needRemove && el.removeAttribute(key);
|
|
279
234
|
}
|
|
280
235
|
|
|
281
236
|
function addEventListener(el, event, handler, options) {
|
|
282
|
-
|
|
237
|
+
el.addEventListener(event, handler, options);
|
|
283
238
|
}
|
|
284
239
|
function removeEventListener(el, event, handler, options) {
|
|
285
|
-
|
|
240
|
+
el.removeEventListener(event, handler, options);
|
|
286
241
|
}
|
|
287
242
|
function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
else if (existingInvoker) {
|
|
303
|
-
// remove
|
|
304
|
-
removeEventListener(el, name, existingInvoker, options);
|
|
305
|
-
invokers[rawName] = undefined;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
243
|
+
const invokers = el._vei || (el._vei = {});
|
|
244
|
+
const existingInvoker = invokers[rawName];
|
|
245
|
+
if (nextValue && existingInvoker) {
|
|
246
|
+
existingInvoker.value = nextValue;
|
|
247
|
+
} else {
|
|
248
|
+
const [name, options] = parseName(rawName);
|
|
249
|
+
if (nextValue) {
|
|
250
|
+
const invoker = invokers[rawName] = createInvoker(nextValue, instance);
|
|
251
|
+
addEventListener(el, name, invoker, options);
|
|
252
|
+
} else if (existingInvoker) {
|
|
253
|
+
removeEventListener(el, name, existingInvoker, options);
|
|
254
|
+
invokers[rawName] = void 0;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
308
257
|
}
|
|
309
258
|
const optionsModifierRE = /(?:Once|Passive|Capture)$/;
|
|
310
259
|
function parseName(name) {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
260
|
+
let options;
|
|
261
|
+
if (optionsModifierRE.test(name)) {
|
|
262
|
+
options = {};
|
|
263
|
+
let m;
|
|
264
|
+
while (m = name.match(optionsModifierRE)) {
|
|
265
|
+
name = name.slice(0, name.length - m[0].length);
|
|
266
|
+
options[m[0].toLowerCase()] = true;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const event = name[2] === ":" ? name.slice(3) : shared.hyphenate(name.slice(2));
|
|
270
|
+
return [event, options];
|
|
322
271
|
}
|
|
323
|
-
// To avoid the overhead of repeatedly calling Date.now(), we cache
|
|
324
|
-
// and use the same timestamp for all event listeners attached in the same tick.
|
|
325
272
|
let cachedNow = 0;
|
|
326
|
-
const p =
|
|
327
|
-
const getNow = () => cachedNow || (p.then(() =>
|
|
273
|
+
const p = /* @__PURE__ */ Promise.resolve();
|
|
274
|
+
const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
|
|
328
275
|
function createInvoker(initialValue, instance) {
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
else if (e._vts <= invoker.attached) {
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
runtimeCore.callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5 /* ErrorCodes.NATIVE_EVENT_HANDLER */, [e]);
|
|
349
|
-
};
|
|
350
|
-
invoker.value = initialValue;
|
|
351
|
-
invoker.attached = getNow();
|
|
352
|
-
return invoker;
|
|
276
|
+
const invoker = (e) => {
|
|
277
|
+
if (!e._vts) {
|
|
278
|
+
e._vts = Date.now();
|
|
279
|
+
} else if (e._vts <= invoker.attached) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
runtimeCore.callWithAsyncErrorHandling(
|
|
283
|
+
patchStopImmediatePropagation(e, invoker.value),
|
|
284
|
+
instance,
|
|
285
|
+
5,
|
|
286
|
+
[e]
|
|
287
|
+
);
|
|
288
|
+
};
|
|
289
|
+
invoker.value = initialValue;
|
|
290
|
+
invoker.attached = getNow();
|
|
291
|
+
return invoker;
|
|
353
292
|
}
|
|
354
293
|
function patchStopImmediatePropagation(e, value) {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
}
|
|
294
|
+
if (shared.isArray(value)) {
|
|
295
|
+
const originalStop = e.stopImmediatePropagation;
|
|
296
|
+
e.stopImmediatePropagation = () => {
|
|
297
|
+
originalStop.call(e);
|
|
298
|
+
e._stopped = true;
|
|
299
|
+
};
|
|
300
|
+
return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2));
|
|
301
|
+
} else {
|
|
302
|
+
return value;
|
|
303
|
+
}
|
|
366
304
|
}
|
|
367
305
|
|
|
368
306
|
const nativeOnRE = /^on[a-z]/;
|
|
369
307
|
const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}
|
|
397
|
-
else if (key === 'false-value') {
|
|
398
|
-
el._falseValue = nextValue;
|
|
399
|
-
}
|
|
400
|
-
patchAttr(el, key, nextValue, isSVG);
|
|
401
|
-
}
|
|
308
|
+
if (key === "class") {
|
|
309
|
+
patchClass(el, nextValue, isSVG);
|
|
310
|
+
} else if (key === "style") {
|
|
311
|
+
patchStyle(el, prevValue, nextValue);
|
|
312
|
+
} else if (shared.isOn(key)) {
|
|
313
|
+
if (!shared.isModelListener(key)) {
|
|
314
|
+
patchEvent(el, key, prevValue, nextValue, parentComponent);
|
|
315
|
+
}
|
|
316
|
+
} else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
|
|
317
|
+
patchDOMProp(
|
|
318
|
+
el,
|
|
319
|
+
key,
|
|
320
|
+
nextValue,
|
|
321
|
+
prevChildren,
|
|
322
|
+
parentComponent,
|
|
323
|
+
parentSuspense,
|
|
324
|
+
unmountChildren
|
|
325
|
+
);
|
|
326
|
+
} else {
|
|
327
|
+
if (key === "true-value") {
|
|
328
|
+
el._trueValue = nextValue;
|
|
329
|
+
} else if (key === "false-value") {
|
|
330
|
+
el._falseValue = nextValue;
|
|
331
|
+
}
|
|
332
|
+
patchAttr(el, key, nextValue, isSVG);
|
|
333
|
+
}
|
|
402
334
|
};
|
|
403
335
|
function shouldSetAsProp(el, key, value, isSVG) {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
}
|
|
430
|
-
// #1526 <input list> must be set as attribute
|
|
431
|
-
if (key === 'list' && el.tagName === 'INPUT') {
|
|
432
|
-
return false;
|
|
433
|
-
}
|
|
434
|
-
// #2766 <textarea type> must be set as attribute
|
|
435
|
-
if (key === 'type' && el.tagName === 'TEXTAREA') {
|
|
436
|
-
return false;
|
|
437
|
-
}
|
|
438
|
-
// native onclick with string value, must be set as attribute
|
|
439
|
-
if (nativeOnRE.test(key) && shared.isString(value)) {
|
|
440
|
-
return false;
|
|
441
|
-
}
|
|
442
|
-
return key in el;
|
|
336
|
+
if (isSVG) {
|
|
337
|
+
if (key === "innerHTML" || key === "textContent") {
|
|
338
|
+
return true;
|
|
339
|
+
}
|
|
340
|
+
if (key in el && nativeOnRE.test(key) && shared.isFunction(value)) {
|
|
341
|
+
return true;
|
|
342
|
+
}
|
|
343
|
+
return false;
|
|
344
|
+
}
|
|
345
|
+
if (key === "spellcheck" || key === "draggable" || key === "translate") {
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
if (key === "form") {
|
|
349
|
+
return false;
|
|
350
|
+
}
|
|
351
|
+
if (key === "list" && el.tagName === "INPUT") {
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
if (key === "type" && el.tagName === "TEXTAREA") {
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
if (nativeOnRE.test(key) && shared.isString(value)) {
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
360
|
+
return key in el;
|
|
443
361
|
}
|
|
444
362
|
|
|
445
|
-
function defineCustomElement(options,
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
363
|
+
function defineCustomElement(options, hydrate2) {
|
|
364
|
+
const Comp = runtimeCore.defineComponent(options);
|
|
365
|
+
class VueCustomElement extends VueElement {
|
|
366
|
+
constructor(initialProps) {
|
|
367
|
+
super(Comp, initialProps, hydrate2);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
VueCustomElement.def = Comp;
|
|
371
|
+
return VueCustomElement;
|
|
454
372
|
}
|
|
455
|
-
const defineSSRCustomElement = (
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
});
|
|
373
|
+
const defineSSRCustomElement = (options) => {
|
|
374
|
+
return defineCustomElement(options, hydrate);
|
|
375
|
+
};
|
|
376
|
+
const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
|
|
377
|
+
};
|
|
461
378
|
class VueElement extends BaseClass {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
/**
|
|
467
|
-
* @internal
|
|
468
|
-
*/
|
|
469
|
-
this._instance = null;
|
|
470
|
-
this._connected = false;
|
|
471
|
-
this._resolved = false;
|
|
472
|
-
this._numberProps = null;
|
|
473
|
-
if (this.shadowRoot && hydrate) {
|
|
474
|
-
hydrate(this._createVNode(), this.shadowRoot);
|
|
475
|
-
}
|
|
476
|
-
else {
|
|
477
|
-
if (this.shadowRoot) {
|
|
478
|
-
runtimeCore.warn(`Custom element has pre-rendered declarative shadow root but is not ` +
|
|
479
|
-
`defined as hydratable. Use \`defineSSRCustomElement\`.`);
|
|
480
|
-
}
|
|
481
|
-
this.attachShadow({ mode: 'open' });
|
|
482
|
-
if (!this._def.__asyncLoader) {
|
|
483
|
-
// for sync component defs we can immediately resolve props
|
|
484
|
-
this._resolveProps(this._def);
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
connectedCallback() {
|
|
489
|
-
this._connected = true;
|
|
490
|
-
if (!this._instance) {
|
|
491
|
-
if (this._resolved) {
|
|
492
|
-
this._update();
|
|
493
|
-
}
|
|
494
|
-
else {
|
|
495
|
-
this._resolveDef();
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
disconnectedCallback() {
|
|
500
|
-
this._connected = false;
|
|
501
|
-
runtimeCore.nextTick(() => {
|
|
502
|
-
if (!this._connected) {
|
|
503
|
-
render(null, this.shadowRoot);
|
|
504
|
-
this._instance = null;
|
|
505
|
-
}
|
|
506
|
-
});
|
|
507
|
-
}
|
|
379
|
+
constructor(_def, _props = {}, hydrate2) {
|
|
380
|
+
super();
|
|
381
|
+
this._def = _def;
|
|
382
|
+
this._props = _props;
|
|
508
383
|
/**
|
|
509
|
-
*
|
|
384
|
+
* @internal
|
|
510
385
|
*/
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
386
|
+
this._instance = null;
|
|
387
|
+
this._connected = false;
|
|
388
|
+
this._resolved = false;
|
|
389
|
+
this._numberProps = null;
|
|
390
|
+
if (this.shadowRoot && hydrate2) {
|
|
391
|
+
hydrate2(this._createVNode(), this.shadowRoot);
|
|
392
|
+
} else {
|
|
393
|
+
if (this.shadowRoot) {
|
|
394
|
+
runtimeCore.warn(
|
|
395
|
+
`Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
this.attachShadow({ mode: "open" });
|
|
399
|
+
if (!this._def.__asyncLoader) {
|
|
400
|
+
this._resolveProps(this._def);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
connectedCallback() {
|
|
405
|
+
this._connected = true;
|
|
406
|
+
if (!this._instance) {
|
|
407
|
+
if (this._resolved) {
|
|
408
|
+
this._update();
|
|
409
|
+
} else {
|
|
410
|
+
this._resolveDef();
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
disconnectedCallback() {
|
|
415
|
+
this._connected = false;
|
|
416
|
+
runtimeCore.nextTick(() => {
|
|
417
|
+
if (!this._connected) {
|
|
418
|
+
render(null, this.shadowRoot);
|
|
419
|
+
this._instance = null;
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* resolve inner component definition (handle possible async component)
|
|
425
|
+
*/
|
|
426
|
+
_resolveDef() {
|
|
427
|
+
this._resolved = true;
|
|
428
|
+
for (let i = 0; i < this.attributes.length; i++) {
|
|
429
|
+
this._setAttr(this.attributes[i].name);
|
|
430
|
+
}
|
|
431
|
+
new MutationObserver((mutations) => {
|
|
432
|
+
for (const m of mutations) {
|
|
433
|
+
this._setAttr(m.attributeName);
|
|
434
|
+
}
|
|
435
|
+
}).observe(this, { attributes: true });
|
|
436
|
+
const resolve = (def, isAsync = false) => {
|
|
437
|
+
const { props, styles } = def;
|
|
438
|
+
let numberProps;
|
|
439
|
+
if (props && !shared.isArray(props)) {
|
|
440
|
+
for (const key in props) {
|
|
441
|
+
const opt = props[key];
|
|
442
|
+
if (opt === Number || opt && opt.type === Number) {
|
|
443
|
+
if (key in this._props) {
|
|
444
|
+
this._props[key] = shared.toNumber(this._props[key]);
|
|
537
445
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
446
|
+
(numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[shared.camelize(key)] = true;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
this._numberProps = numberProps;
|
|
451
|
+
if (isAsync) {
|
|
452
|
+
this._resolveProps(def);
|
|
453
|
+
}
|
|
454
|
+
this._applyStyles(styles);
|
|
455
|
+
this._update();
|
|
456
|
+
};
|
|
457
|
+
const asyncDef = this._def.__asyncLoader;
|
|
458
|
+
if (asyncDef) {
|
|
459
|
+
asyncDef().then((def) => resolve(def, true));
|
|
460
|
+
} else {
|
|
461
|
+
resolve(this._def);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
_resolveProps(def) {
|
|
465
|
+
const { props } = def;
|
|
466
|
+
const declaredPropKeys = shared.isArray(props) ? props : Object.keys(props || {});
|
|
467
|
+
for (const key of Object.keys(this)) {
|
|
468
|
+
if (key[0] !== "_" && declaredPropKeys.includes(key)) {
|
|
469
|
+
this._setProp(key, this[key], true, false);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
for (const key of declaredPropKeys.map(shared.camelize)) {
|
|
473
|
+
Object.defineProperty(this, key, {
|
|
474
|
+
get() {
|
|
475
|
+
return this._getProp(key);
|
|
476
|
+
},
|
|
477
|
+
set(val) {
|
|
478
|
+
this._setProp(key, val);
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
_setAttr(key) {
|
|
484
|
+
let value = this.getAttribute(key);
|
|
485
|
+
const camelKey = shared.camelize(key);
|
|
486
|
+
if (this._numberProps && this._numberProps[camelKey]) {
|
|
487
|
+
value = shared.toNumber(value);
|
|
488
|
+
}
|
|
489
|
+
this._setProp(camelKey, value, false);
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* @internal
|
|
493
|
+
*/
|
|
494
|
+
_getProp(key) {
|
|
495
|
+
return this._props[key];
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* @internal
|
|
499
|
+
*/
|
|
500
|
+
_setProp(key, val, shouldReflect = true, shouldUpdate = true) {
|
|
501
|
+
if (val !== this._props[key]) {
|
|
502
|
+
this._props[key] = val;
|
|
503
|
+
if (shouldUpdate && this._instance) {
|
|
504
|
+
this._update();
|
|
505
|
+
}
|
|
506
|
+
if (shouldReflect) {
|
|
507
|
+
if (val === true) {
|
|
508
|
+
this.setAttribute(shared.hyphenate(key), "");
|
|
509
|
+
} else if (typeof val === "string" || typeof val === "number") {
|
|
510
|
+
this.setAttribute(shared.hyphenate(key), val + "");
|
|
511
|
+
} else if (!val) {
|
|
512
|
+
this.removeAttribute(shared.hyphenate(key));
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
_update() {
|
|
518
|
+
render(this._createVNode(), this.shadowRoot);
|
|
519
|
+
}
|
|
520
|
+
_createVNode() {
|
|
521
|
+
const vnode = runtimeCore.createVNode(this._def, shared.extend({}, this._props));
|
|
522
|
+
if (!this._instance) {
|
|
523
|
+
vnode.ce = (instance) => {
|
|
524
|
+
this._instance = instance;
|
|
525
|
+
instance.isCE = true;
|
|
526
|
+
{
|
|
527
|
+
instance.ceReload = (newStyles) => {
|
|
528
|
+
if (this._styles) {
|
|
529
|
+
this._styles.forEach((s) => this.shadowRoot.removeChild(s));
|
|
530
|
+
this._styles.length = 0;
|
|
543
531
|
}
|
|
544
|
-
|
|
545
|
-
this.
|
|
546
|
-
// initial render
|
|
532
|
+
this._applyStyles(newStyles);
|
|
533
|
+
this._instance = null;
|
|
547
534
|
this._update();
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
const dispatch = (event, args) => {
|
|
538
|
+
this.dispatchEvent(
|
|
539
|
+
new CustomEvent(event, {
|
|
540
|
+
detail: args
|
|
541
|
+
})
|
|
542
|
+
);
|
|
548
543
|
};
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
});
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
_setAttr(key) {
|
|
579
|
-
let value = this.getAttribute(key);
|
|
580
|
-
const camelKey = shared.camelize(key);
|
|
581
|
-
if (this._numberProps && this._numberProps[camelKey]) {
|
|
582
|
-
value = shared.toNumber(value);
|
|
583
|
-
}
|
|
584
|
-
this._setProp(camelKey, value, false);
|
|
585
|
-
}
|
|
586
|
-
/**
|
|
587
|
-
* @internal
|
|
588
|
-
*/
|
|
589
|
-
_getProp(key) {
|
|
590
|
-
return this._props[key];
|
|
591
|
-
}
|
|
592
|
-
/**
|
|
593
|
-
* @internal
|
|
594
|
-
*/
|
|
595
|
-
_setProp(key, val, shouldReflect = true, shouldUpdate = true) {
|
|
596
|
-
if (val !== this._props[key]) {
|
|
597
|
-
this._props[key] = val;
|
|
598
|
-
if (shouldUpdate && this._instance) {
|
|
599
|
-
this._update();
|
|
600
|
-
}
|
|
601
|
-
// reflect
|
|
602
|
-
if (shouldReflect) {
|
|
603
|
-
if (val === true) {
|
|
604
|
-
this.setAttribute(shared.hyphenate(key), '');
|
|
605
|
-
}
|
|
606
|
-
else if (typeof val === 'string' || typeof val === 'number') {
|
|
607
|
-
this.setAttribute(shared.hyphenate(key), val + '');
|
|
608
|
-
}
|
|
609
|
-
else if (!val) {
|
|
610
|
-
this.removeAttribute(shared.hyphenate(key));
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
_update() {
|
|
616
|
-
render(this._createVNode(), this.shadowRoot);
|
|
617
|
-
}
|
|
618
|
-
_createVNode() {
|
|
619
|
-
const vnode = runtimeCore.createVNode(this._def, shared.extend({}, this._props));
|
|
620
|
-
if (!this._instance) {
|
|
621
|
-
vnode.ce = instance => {
|
|
622
|
-
this._instance = instance;
|
|
623
|
-
instance.isCE = true;
|
|
624
|
-
// HMR
|
|
625
|
-
{
|
|
626
|
-
instance.ceReload = newStyles => {
|
|
627
|
-
// always reset styles
|
|
628
|
-
if (this._styles) {
|
|
629
|
-
this._styles.forEach(s => this.shadowRoot.removeChild(s));
|
|
630
|
-
this._styles.length = 0;
|
|
631
|
-
}
|
|
632
|
-
this._applyStyles(newStyles);
|
|
633
|
-
this._instance = null;
|
|
634
|
-
this._update();
|
|
635
|
-
};
|
|
636
|
-
}
|
|
637
|
-
const dispatch = (event, args) => {
|
|
638
|
-
this.dispatchEvent(new CustomEvent(event, {
|
|
639
|
-
detail: args
|
|
640
|
-
}));
|
|
641
|
-
};
|
|
642
|
-
// intercept emit
|
|
643
|
-
instance.emit = (event, ...args) => {
|
|
644
|
-
// dispatch both the raw and hyphenated versions of an event
|
|
645
|
-
// to match Vue behavior
|
|
646
|
-
dispatch(event, args);
|
|
647
|
-
if (shared.hyphenate(event) !== event) {
|
|
648
|
-
dispatch(shared.hyphenate(event), args);
|
|
649
|
-
}
|
|
650
|
-
};
|
|
651
|
-
// locate nearest Vue custom element parent for provide/inject
|
|
652
|
-
let parent = this;
|
|
653
|
-
while ((parent =
|
|
654
|
-
parent && (parent.parentNode || parent.host))) {
|
|
655
|
-
if (parent instanceof VueElement) {
|
|
656
|
-
instance.parent = parent._instance;
|
|
657
|
-
instance.provides = parent._instance.provides;
|
|
658
|
-
break;
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
};
|
|
662
|
-
}
|
|
663
|
-
return vnode;
|
|
664
|
-
}
|
|
665
|
-
_applyStyles(styles) {
|
|
666
|
-
if (styles) {
|
|
667
|
-
styles.forEach(css => {
|
|
668
|
-
const s = document.createElement('style');
|
|
669
|
-
s.textContent = css;
|
|
670
|
-
this.shadowRoot.appendChild(s);
|
|
671
|
-
// record for HMR
|
|
672
|
-
{
|
|
673
|
-
(this._styles || (this._styles = [])).push(s);
|
|
674
|
-
}
|
|
675
|
-
});
|
|
544
|
+
instance.emit = (event, ...args) => {
|
|
545
|
+
dispatch(event, args);
|
|
546
|
+
if (shared.hyphenate(event) !== event) {
|
|
547
|
+
dispatch(shared.hyphenate(event), args);
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
let parent = this;
|
|
551
|
+
while (parent = parent && (parent.parentNode || parent.host)) {
|
|
552
|
+
if (parent instanceof VueElement) {
|
|
553
|
+
instance.parent = parent._instance;
|
|
554
|
+
instance.provides = parent._instance.provides;
|
|
555
|
+
break;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
return vnode;
|
|
561
|
+
}
|
|
562
|
+
_applyStyles(styles) {
|
|
563
|
+
if (styles) {
|
|
564
|
+
styles.forEach((css) => {
|
|
565
|
+
const s = document.createElement("style");
|
|
566
|
+
s.textContent = css;
|
|
567
|
+
this.shadowRoot.appendChild(s);
|
|
568
|
+
{
|
|
569
|
+
(this._styles || (this._styles = [])).push(s);
|
|
676
570
|
}
|
|
571
|
+
});
|
|
677
572
|
}
|
|
573
|
+
}
|
|
678
574
|
}
|
|
679
575
|
|
|
680
|
-
function useCssModule(name =
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
}
|
|
576
|
+
function useCssModule(name = "$style") {
|
|
577
|
+
{
|
|
578
|
+
const instance = runtimeCore.getCurrentInstance();
|
|
579
|
+
if (!instance) {
|
|
580
|
+
runtimeCore.warn(`useCssModule must be called inside setup()`);
|
|
581
|
+
return shared.EMPTY_OBJ;
|
|
582
|
+
}
|
|
583
|
+
const modules = instance.type.__cssModules;
|
|
584
|
+
if (!modules) {
|
|
585
|
+
runtimeCore.warn(`Current instance does not have CSS modules injected.`);
|
|
586
|
+
return shared.EMPTY_OBJ;
|
|
587
|
+
}
|
|
588
|
+
const mod = modules[name];
|
|
589
|
+
if (!mod) {
|
|
590
|
+
runtimeCore.warn(`Current instance does not have CSS module named "${name}".`);
|
|
591
|
+
return shared.EMPTY_OBJ;
|
|
592
|
+
}
|
|
593
|
+
return mod;
|
|
594
|
+
}
|
|
700
595
|
}
|
|
701
596
|
|
|
702
|
-
/**
|
|
703
|
-
* Runtime helper for SFC's CSS variable injection feature.
|
|
704
|
-
* @private
|
|
705
|
-
*/
|
|
706
597
|
function useCssVars(getter) {
|
|
707
|
-
|
|
598
|
+
return;
|
|
708
599
|
}
|
|
709
600
|
|
|
710
|
-
const TRANSITION =
|
|
711
|
-
const ANIMATION =
|
|
712
|
-
// DOM Transition is a higher-order-component based on the platform-agnostic
|
|
713
|
-
// base Transition component, with DOM-specific logic.
|
|
601
|
+
const TRANSITION = "transition";
|
|
602
|
+
const ANIMATION = "animation";
|
|
714
603
|
const Transition = (props, { slots }) => runtimeCore.h(runtimeCore.BaseTransition, resolveTransitionProps(props), slots);
|
|
715
|
-
Transition.displayName =
|
|
604
|
+
Transition.displayName = "Transition";
|
|
716
605
|
const DOMTransitionPropsValidators = {
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
606
|
+
name: String,
|
|
607
|
+
type: String,
|
|
608
|
+
css: {
|
|
609
|
+
type: Boolean,
|
|
610
|
+
default: true
|
|
611
|
+
},
|
|
612
|
+
duration: [String, Number, Object],
|
|
613
|
+
enterFromClass: String,
|
|
614
|
+
enterActiveClass: String,
|
|
615
|
+
enterToClass: String,
|
|
616
|
+
appearFromClass: String,
|
|
617
|
+
appearActiveClass: String,
|
|
618
|
+
appearToClass: String,
|
|
619
|
+
leaveFromClass: String,
|
|
620
|
+
leaveActiveClass: String,
|
|
621
|
+
leaveToClass: String
|
|
733
622
|
};
|
|
734
|
-
const TransitionPropsValidators =
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
*/
|
|
623
|
+
const TransitionPropsValidators = Transition.props = /* @__PURE__ */ shared.extend(
|
|
624
|
+
{},
|
|
625
|
+
runtimeCore.BaseTransitionPropsValidators,
|
|
626
|
+
DOMTransitionPropsValidators
|
|
627
|
+
);
|
|
740
628
|
const callHook = (hook, args = []) => {
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
}
|
|
629
|
+
if (shared.isArray(hook)) {
|
|
630
|
+
hook.forEach((h2) => h2(...args));
|
|
631
|
+
} else if (hook) {
|
|
632
|
+
hook(...args);
|
|
633
|
+
}
|
|
747
634
|
};
|
|
748
|
-
/**
|
|
749
|
-
* Check if a hook expects a callback (2nd arg), which means the user
|
|
750
|
-
* intends to explicitly control the end of the transition.
|
|
751
|
-
*/
|
|
752
635
|
const hasExplicitCallback = (hook) => {
|
|
753
|
-
|
|
754
|
-
? shared.isArray(hook)
|
|
755
|
-
? hook.some(h => h.length > 1)
|
|
756
|
-
: hook.length > 1
|
|
757
|
-
: false;
|
|
636
|
+
return hook ? shared.isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
|
|
758
637
|
};
|
|
759
638
|
function resolveTransitionProps(rawProps) {
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
639
|
+
const baseProps = {};
|
|
640
|
+
for (const key in rawProps) {
|
|
641
|
+
if (!(key in DOMTransitionPropsValidators)) {
|
|
642
|
+
baseProps[key] = rawProps[key];
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
if (rawProps.css === false) {
|
|
646
|
+
return baseProps;
|
|
647
|
+
}
|
|
648
|
+
const {
|
|
649
|
+
name = "v",
|
|
650
|
+
type,
|
|
651
|
+
duration,
|
|
652
|
+
enterFromClass = `${name}-enter-from`,
|
|
653
|
+
enterActiveClass = `${name}-enter-active`,
|
|
654
|
+
enterToClass = `${name}-enter-to`,
|
|
655
|
+
appearFromClass = enterFromClass,
|
|
656
|
+
appearActiveClass = enterActiveClass,
|
|
657
|
+
appearToClass = enterToClass,
|
|
658
|
+
leaveFromClass = `${name}-leave-from`,
|
|
659
|
+
leaveActiveClass = `${name}-leave-active`,
|
|
660
|
+
leaveToClass = `${name}-leave-to`
|
|
661
|
+
} = rawProps;
|
|
662
|
+
const durations = normalizeDuration(duration);
|
|
663
|
+
const enterDuration = durations && durations[0];
|
|
664
|
+
const leaveDuration = durations && durations[1];
|
|
665
|
+
const {
|
|
666
|
+
onBeforeEnter,
|
|
667
|
+
onEnter,
|
|
668
|
+
onEnterCancelled,
|
|
669
|
+
onLeave,
|
|
670
|
+
onLeaveCancelled,
|
|
671
|
+
onBeforeAppear = onBeforeEnter,
|
|
672
|
+
onAppear = onEnter,
|
|
673
|
+
onAppearCancelled = onEnterCancelled
|
|
674
|
+
} = baseProps;
|
|
675
|
+
const finishEnter = (el, isAppear, done) => {
|
|
676
|
+
removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
|
677
|
+
removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
|
|
678
|
+
done && done();
|
|
679
|
+
};
|
|
680
|
+
const finishLeave = (el, done) => {
|
|
681
|
+
el._isLeaving = false;
|
|
682
|
+
removeTransitionClass(el, leaveFromClass);
|
|
683
|
+
removeTransitionClass(el, leaveToClass);
|
|
684
|
+
removeTransitionClass(el, leaveActiveClass);
|
|
685
|
+
done && done();
|
|
686
|
+
};
|
|
687
|
+
const makeEnterHook = (isAppear) => {
|
|
688
|
+
return (el, done) => {
|
|
689
|
+
const hook = isAppear ? onAppear : onEnter;
|
|
690
|
+
const resolve = () => finishEnter(el, isAppear, done);
|
|
691
|
+
callHook(hook, [el, resolve]);
|
|
692
|
+
nextFrame(() => {
|
|
693
|
+
removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
|
|
694
|
+
addTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
|
695
|
+
if (!hasExplicitCallback(hook)) {
|
|
696
|
+
whenTransitionEnds(el, type, enterDuration, resolve);
|
|
697
|
+
}
|
|
698
|
+
});
|
|
778
699
|
};
|
|
779
|
-
|
|
780
|
-
|
|
700
|
+
};
|
|
701
|
+
return shared.extend(baseProps, {
|
|
702
|
+
onBeforeEnter(el) {
|
|
703
|
+
callHook(onBeforeEnter, [el]);
|
|
704
|
+
addTransitionClass(el, enterFromClass);
|
|
705
|
+
addTransitionClass(el, enterActiveClass);
|
|
706
|
+
},
|
|
707
|
+
onBeforeAppear(el) {
|
|
708
|
+
callHook(onBeforeAppear, [el]);
|
|
709
|
+
addTransitionClass(el, appearFromClass);
|
|
710
|
+
addTransitionClass(el, appearActiveClass);
|
|
711
|
+
},
|
|
712
|
+
onEnter: makeEnterHook(false),
|
|
713
|
+
onAppear: makeEnterHook(true),
|
|
714
|
+
onLeave(el, done) {
|
|
715
|
+
el._isLeaving = true;
|
|
716
|
+
const resolve = () => finishLeave(el, done);
|
|
717
|
+
addTransitionClass(el, leaveFromClass);
|
|
718
|
+
forceReflow();
|
|
719
|
+
addTransitionClass(el, leaveActiveClass);
|
|
720
|
+
nextFrame(() => {
|
|
721
|
+
if (!el._isLeaving) {
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
781
724
|
removeTransitionClass(el, leaveFromClass);
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
};
|
|
786
|
-
const makeEnterHook = (isAppear) => {
|
|
787
|
-
return (el, done) => {
|
|
788
|
-
const hook = isAppear ? onAppear : onEnter;
|
|
789
|
-
const resolve = () => finishEnter(el, isAppear, done);
|
|
790
|
-
callHook(hook, [el, resolve]);
|
|
791
|
-
nextFrame(() => {
|
|
792
|
-
removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
|
|
793
|
-
addTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
|
794
|
-
if (!hasExplicitCallback(hook)) {
|
|
795
|
-
whenTransitionEnds(el, type, enterDuration, resolve);
|
|
796
|
-
}
|
|
797
|
-
});
|
|
798
|
-
};
|
|
799
|
-
};
|
|
800
|
-
return shared.extend(baseProps, {
|
|
801
|
-
onBeforeEnter(el) {
|
|
802
|
-
callHook(onBeforeEnter, [el]);
|
|
803
|
-
addTransitionClass(el, enterFromClass);
|
|
804
|
-
addTransitionClass(el, enterActiveClass);
|
|
805
|
-
},
|
|
806
|
-
onBeforeAppear(el) {
|
|
807
|
-
callHook(onBeforeAppear, [el]);
|
|
808
|
-
addTransitionClass(el, appearFromClass);
|
|
809
|
-
addTransitionClass(el, appearActiveClass);
|
|
810
|
-
},
|
|
811
|
-
onEnter: makeEnterHook(false),
|
|
812
|
-
onAppear: makeEnterHook(true),
|
|
813
|
-
onLeave(el, done) {
|
|
814
|
-
el._isLeaving = true;
|
|
815
|
-
const resolve = () => finishLeave(el, done);
|
|
816
|
-
addTransitionClass(el, leaveFromClass);
|
|
817
|
-
// force reflow so *-leave-from classes immediately take effect (#2593)
|
|
818
|
-
forceReflow();
|
|
819
|
-
addTransitionClass(el, leaveActiveClass);
|
|
820
|
-
nextFrame(() => {
|
|
821
|
-
if (!el._isLeaving) {
|
|
822
|
-
// cancelled
|
|
823
|
-
return;
|
|
824
|
-
}
|
|
825
|
-
removeTransitionClass(el, leaveFromClass);
|
|
826
|
-
addTransitionClass(el, leaveToClass);
|
|
827
|
-
if (!hasExplicitCallback(onLeave)) {
|
|
828
|
-
whenTransitionEnds(el, type, leaveDuration, resolve);
|
|
829
|
-
}
|
|
830
|
-
});
|
|
831
|
-
callHook(onLeave, [el, resolve]);
|
|
832
|
-
},
|
|
833
|
-
onEnterCancelled(el) {
|
|
834
|
-
finishEnter(el, false);
|
|
835
|
-
callHook(onEnterCancelled, [el]);
|
|
836
|
-
},
|
|
837
|
-
onAppearCancelled(el) {
|
|
838
|
-
finishEnter(el, true);
|
|
839
|
-
callHook(onAppearCancelled, [el]);
|
|
840
|
-
},
|
|
841
|
-
onLeaveCancelled(el) {
|
|
842
|
-
finishLeave(el);
|
|
843
|
-
callHook(onLeaveCancelled, [el]);
|
|
725
|
+
addTransitionClass(el, leaveToClass);
|
|
726
|
+
if (!hasExplicitCallback(onLeave)) {
|
|
727
|
+
whenTransitionEnds(el, type, leaveDuration, resolve);
|
|
844
728
|
}
|
|
845
|
-
|
|
729
|
+
});
|
|
730
|
+
callHook(onLeave, [el, resolve]);
|
|
731
|
+
},
|
|
732
|
+
onEnterCancelled(el) {
|
|
733
|
+
finishEnter(el, false);
|
|
734
|
+
callHook(onEnterCancelled, [el]);
|
|
735
|
+
},
|
|
736
|
+
onAppearCancelled(el) {
|
|
737
|
+
finishEnter(el, true);
|
|
738
|
+
callHook(onAppearCancelled, [el]);
|
|
739
|
+
},
|
|
740
|
+
onLeaveCancelled(el) {
|
|
741
|
+
finishLeave(el);
|
|
742
|
+
callHook(onLeaveCancelled, [el]);
|
|
743
|
+
}
|
|
744
|
+
});
|
|
846
745
|
}
|
|
847
746
|
function normalizeDuration(duration) {
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
return [n, n];
|
|
857
|
-
}
|
|
747
|
+
if (duration == null) {
|
|
748
|
+
return null;
|
|
749
|
+
} else if (shared.isObject(duration)) {
|
|
750
|
+
return [NumberOf(duration.enter), NumberOf(duration.leave)];
|
|
751
|
+
} else {
|
|
752
|
+
const n = NumberOf(duration);
|
|
753
|
+
return [n, n];
|
|
754
|
+
}
|
|
858
755
|
}
|
|
859
756
|
function NumberOf(val) {
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
757
|
+
const res = shared.toNumber(val);
|
|
758
|
+
{
|
|
759
|
+
runtimeCore.assertNumber(res, "<transition> explicit duration");
|
|
760
|
+
}
|
|
761
|
+
return res;
|
|
865
762
|
}
|
|
866
763
|
function addTransitionClass(el, cls) {
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
(el._vtc = new Set())).add(cls);
|
|
764
|
+
cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
|
|
765
|
+
(el._vtc || (el._vtc = /* @__PURE__ */ new Set())).add(cls);
|
|
870
766
|
}
|
|
871
767
|
function removeTransitionClass(el, cls) {
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
768
|
+
cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
|
|
769
|
+
const { _vtc } = el;
|
|
770
|
+
if (_vtc) {
|
|
771
|
+
_vtc.delete(cls);
|
|
772
|
+
if (!_vtc.size) {
|
|
773
|
+
el._vtc = void 0;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
880
776
|
}
|
|
881
777
|
function nextFrame(cb) {
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
778
|
+
requestAnimationFrame(() => {
|
|
779
|
+
requestAnimationFrame(cb);
|
|
780
|
+
});
|
|
885
781
|
}
|
|
886
782
|
let endId = 0;
|
|
887
783
|
function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
784
|
+
const id = el._endId = ++endId;
|
|
785
|
+
const resolveIfNotStale = () => {
|
|
786
|
+
if (id === el._endId) {
|
|
787
|
+
resolve();
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
if (explicitTimeout) {
|
|
791
|
+
return setTimeout(resolveIfNotStale, explicitTimeout);
|
|
792
|
+
}
|
|
793
|
+
const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
|
|
794
|
+
if (!type) {
|
|
795
|
+
return resolve();
|
|
796
|
+
}
|
|
797
|
+
const endEvent = type + "end";
|
|
798
|
+
let ended = 0;
|
|
799
|
+
const end = () => {
|
|
800
|
+
el.removeEventListener(endEvent, onEnd);
|
|
801
|
+
resolveIfNotStale();
|
|
802
|
+
};
|
|
803
|
+
const onEnd = (e) => {
|
|
804
|
+
if (e.target === el && ++ended >= propCount) {
|
|
805
|
+
end();
|
|
806
|
+
}
|
|
807
|
+
};
|
|
808
|
+
setTimeout(() => {
|
|
809
|
+
if (ended < propCount) {
|
|
810
|
+
end();
|
|
811
|
+
}
|
|
812
|
+
}, timeout + 1);
|
|
813
|
+
el.addEventListener(endEvent, onEnd);
|
|
918
814
|
}
|
|
919
815
|
function getTransitionInfo(el, expectedType) {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
? transitionDurations.length
|
|
958
|
-
: animationDurations.length
|
|
959
|
-
: 0;
|
|
960
|
-
}
|
|
961
|
-
const hasTransform = type === TRANSITION &&
|
|
962
|
-
/\b(transform|all)(,|$)/.test(getStyleProperties(`${TRANSITION}Property`).toString());
|
|
963
|
-
return {
|
|
964
|
-
type,
|
|
965
|
-
timeout,
|
|
966
|
-
propCount,
|
|
967
|
-
hasTransform
|
|
968
|
-
};
|
|
816
|
+
const styles = window.getComputedStyle(el);
|
|
817
|
+
const getStyleProperties = (key) => (styles[key] || "").split(", ");
|
|
818
|
+
const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
|
|
819
|
+
const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
|
|
820
|
+
const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
|
821
|
+
const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
|
|
822
|
+
const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
|
|
823
|
+
const animationTimeout = getTimeout(animationDelays, animationDurations);
|
|
824
|
+
let type = null;
|
|
825
|
+
let timeout = 0;
|
|
826
|
+
let propCount = 0;
|
|
827
|
+
if (expectedType === TRANSITION) {
|
|
828
|
+
if (transitionTimeout > 0) {
|
|
829
|
+
type = TRANSITION;
|
|
830
|
+
timeout = transitionTimeout;
|
|
831
|
+
propCount = transitionDurations.length;
|
|
832
|
+
}
|
|
833
|
+
} else if (expectedType === ANIMATION) {
|
|
834
|
+
if (animationTimeout > 0) {
|
|
835
|
+
type = ANIMATION;
|
|
836
|
+
timeout = animationTimeout;
|
|
837
|
+
propCount = animationDurations.length;
|
|
838
|
+
}
|
|
839
|
+
} else {
|
|
840
|
+
timeout = Math.max(transitionTimeout, animationTimeout);
|
|
841
|
+
type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
|
|
842
|
+
propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
|
|
843
|
+
}
|
|
844
|
+
const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test(
|
|
845
|
+
getStyleProperties(`${TRANSITION}Property`).toString()
|
|
846
|
+
);
|
|
847
|
+
return {
|
|
848
|
+
type,
|
|
849
|
+
timeout,
|
|
850
|
+
propCount,
|
|
851
|
+
hasTransform
|
|
852
|
+
};
|
|
969
853
|
}
|
|
970
854
|
function getTimeout(delays, durations) {
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
855
|
+
while (delays.length < durations.length) {
|
|
856
|
+
delays = delays.concat(delays);
|
|
857
|
+
}
|
|
858
|
+
return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
|
|
975
859
|
}
|
|
976
|
-
// Old versions of Chromium (below 61.0.3163.100) formats floating pointer
|
|
977
|
-
// numbers in a locale-dependent way, using a comma instead of a dot.
|
|
978
|
-
// If comma is not replaced with a dot, the input will be rounded down
|
|
979
|
-
// (i.e. acting as a floor function) causing unexpected behaviors
|
|
980
860
|
function toMs(s) {
|
|
981
|
-
|
|
861
|
+
return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
|
|
982
862
|
}
|
|
983
|
-
// synchronously force layout to put elements into a certain state
|
|
984
863
|
function forceReflow() {
|
|
985
|
-
|
|
864
|
+
return document.body.offsetHeight;
|
|
986
865
|
}
|
|
987
866
|
|
|
988
|
-
const positionMap = new WeakMap();
|
|
989
|
-
const newPositionMap = new WeakMap();
|
|
867
|
+
const positionMap = /* @__PURE__ */ new WeakMap();
|
|
868
|
+
const newPositionMap = /* @__PURE__ */ new WeakMap();
|
|
990
869
|
const TransitionGroupImpl = {
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
});
|
|
1032
|
-
el.addEventListener('transitionend', cb);
|
|
1033
|
-
});
|
|
1034
|
-
});
|
|
1035
|
-
return () => {
|
|
1036
|
-
const rawProps = runtimeCore.toRaw(props);
|
|
1037
|
-
const cssTransitionProps = resolveTransitionProps(rawProps);
|
|
1038
|
-
let tag = rawProps.tag || runtimeCore.Fragment;
|
|
1039
|
-
prevChildren = children;
|
|
1040
|
-
children = slots.default ? runtimeCore.getTransitionRawChildren(slots.default()) : [];
|
|
1041
|
-
for (let i = 0; i < children.length; i++) {
|
|
1042
|
-
const child = children[i];
|
|
1043
|
-
if (child.key != null) {
|
|
1044
|
-
runtimeCore.setTransitionHooks(child, runtimeCore.resolveTransitionHooks(child, cssTransitionProps, state, instance));
|
|
1045
|
-
}
|
|
1046
|
-
else {
|
|
1047
|
-
runtimeCore.warn(`<TransitionGroup> children must be keyed.`);
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
if (prevChildren) {
|
|
1051
|
-
for (let i = 0; i < prevChildren.length; i++) {
|
|
1052
|
-
const child = prevChildren[i];
|
|
1053
|
-
runtimeCore.setTransitionHooks(child, runtimeCore.resolveTransitionHooks(child, cssTransitionProps, state, instance));
|
|
1054
|
-
positionMap.set(child, child.el.getBoundingClientRect());
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
return runtimeCore.createVNode(tag, null, children);
|
|
870
|
+
name: "TransitionGroup",
|
|
871
|
+
props: /* @__PURE__ */ shared.extend({}, TransitionPropsValidators, {
|
|
872
|
+
tag: String,
|
|
873
|
+
moveClass: String
|
|
874
|
+
}),
|
|
875
|
+
setup(props, { slots }) {
|
|
876
|
+
const instance = runtimeCore.getCurrentInstance();
|
|
877
|
+
const state = runtimeCore.useTransitionState();
|
|
878
|
+
let prevChildren;
|
|
879
|
+
let children;
|
|
880
|
+
runtimeCore.onUpdated(() => {
|
|
881
|
+
if (!prevChildren.length) {
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
884
|
+
const moveClass = props.moveClass || `${props.name || "v"}-move`;
|
|
885
|
+
if (!hasCSSTransform(
|
|
886
|
+
prevChildren[0].el,
|
|
887
|
+
instance.vnode.el,
|
|
888
|
+
moveClass
|
|
889
|
+
)) {
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
prevChildren.forEach(callPendingCbs);
|
|
893
|
+
prevChildren.forEach(recordPosition);
|
|
894
|
+
const movedChildren = prevChildren.filter(applyTranslation);
|
|
895
|
+
forceReflow();
|
|
896
|
+
movedChildren.forEach((c) => {
|
|
897
|
+
const el = c.el;
|
|
898
|
+
const style = el.style;
|
|
899
|
+
addTransitionClass(el, moveClass);
|
|
900
|
+
style.transform = style.webkitTransform = style.transitionDuration = "";
|
|
901
|
+
const cb = el._moveCb = (e) => {
|
|
902
|
+
if (e && e.target !== el) {
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
905
|
+
if (!e || /transform$/.test(e.propertyName)) {
|
|
906
|
+
el.removeEventListener("transitionend", cb);
|
|
907
|
+
el._moveCb = null;
|
|
908
|
+
removeTransitionClass(el, moveClass);
|
|
909
|
+
}
|
|
1058
910
|
};
|
|
1059
|
-
|
|
911
|
+
el.addEventListener("transitionend", cb);
|
|
912
|
+
});
|
|
913
|
+
});
|
|
914
|
+
return () => {
|
|
915
|
+
const rawProps = runtimeCore.toRaw(props);
|
|
916
|
+
const cssTransitionProps = resolveTransitionProps(rawProps);
|
|
917
|
+
let tag = rawProps.tag || runtimeCore.Fragment;
|
|
918
|
+
prevChildren = children;
|
|
919
|
+
children = slots.default ? runtimeCore.getTransitionRawChildren(slots.default()) : [];
|
|
920
|
+
for (let i = 0; i < children.length; i++) {
|
|
921
|
+
const child = children[i];
|
|
922
|
+
if (child.key != null) {
|
|
923
|
+
runtimeCore.setTransitionHooks(
|
|
924
|
+
child,
|
|
925
|
+
runtimeCore.resolveTransitionHooks(child, cssTransitionProps, state, instance)
|
|
926
|
+
);
|
|
927
|
+
} else {
|
|
928
|
+
runtimeCore.warn(`<TransitionGroup> children must be keyed.`);
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
if (prevChildren) {
|
|
932
|
+
for (let i = 0; i < prevChildren.length; i++) {
|
|
933
|
+
const child = prevChildren[i];
|
|
934
|
+
runtimeCore.setTransitionHooks(
|
|
935
|
+
child,
|
|
936
|
+
runtimeCore.resolveTransitionHooks(child, cssTransitionProps, state, instance)
|
|
937
|
+
);
|
|
938
|
+
positionMap.set(child, child.el.getBoundingClientRect());
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
return runtimeCore.createVNode(tag, null, children);
|
|
942
|
+
};
|
|
943
|
+
}
|
|
1060
944
|
};
|
|
1061
|
-
/**
|
|
1062
|
-
* TransitionGroup does not support "mode" so we need to remove it from the
|
|
1063
|
-
* props declarations, but direct delete operation is considered a side effect
|
|
1064
|
-
* and will make the entire transition feature non-tree-shakeable, so we do it
|
|
1065
|
-
* in a function and mark the function's invocation as pure.
|
|
1066
|
-
*/
|
|
1067
945
|
const removeMode = (props) => delete props.mode;
|
|
1068
|
-
|
|
946
|
+
/* @__PURE__ */ removeMode(TransitionGroupImpl.props);
|
|
1069
947
|
const TransitionGroup = TransitionGroupImpl;
|
|
1070
948
|
function callPendingCbs(c) {
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
949
|
+
const el = c.el;
|
|
950
|
+
if (el._moveCb) {
|
|
951
|
+
el._moveCb();
|
|
952
|
+
}
|
|
953
|
+
if (el._enterCb) {
|
|
954
|
+
el._enterCb();
|
|
955
|
+
}
|
|
1078
956
|
}
|
|
1079
957
|
function recordPosition(c) {
|
|
1080
|
-
|
|
958
|
+
newPositionMap.set(c, c.el.getBoundingClientRect());
|
|
1081
959
|
}
|
|
1082
960
|
function applyTranslation(c) {
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
961
|
+
const oldPos = positionMap.get(c);
|
|
962
|
+
const newPos = newPositionMap.get(c);
|
|
963
|
+
const dx = oldPos.left - newPos.left;
|
|
964
|
+
const dy = oldPos.top - newPos.top;
|
|
965
|
+
if (dx || dy) {
|
|
966
|
+
const s = c.el.style;
|
|
967
|
+
s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
|
|
968
|
+
s.transitionDuration = "0s";
|
|
969
|
+
return c;
|
|
970
|
+
}
|
|
1093
971
|
}
|
|
1094
972
|
function hasCSSTransform(el, root, moveClass) {
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
const container = (root.nodeType === 1 ? root : root.parentNode);
|
|
1109
|
-
container.appendChild(clone);
|
|
1110
|
-
const { hasTransform } = getTransitionInfo(clone);
|
|
1111
|
-
container.removeChild(clone);
|
|
1112
|
-
return hasTransform;
|
|
973
|
+
const clone = el.cloneNode();
|
|
974
|
+
if (el._vtc) {
|
|
975
|
+
el._vtc.forEach((cls) => {
|
|
976
|
+
cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
|
|
980
|
+
clone.style.display = "none";
|
|
981
|
+
const container = root.nodeType === 1 ? root : root.parentNode;
|
|
982
|
+
container.appendChild(clone);
|
|
983
|
+
const { hasTransform } = getTransitionInfo(clone);
|
|
984
|
+
container.removeChild(clone);
|
|
985
|
+
return hasTransform;
|
|
1113
986
|
}
|
|
1114
987
|
|
|
1115
988
|
const getModelAssigner = (vnode) => {
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
return shared.isArray(fn) ? value => shared.invokeArrayFns(fn, value) : fn;
|
|
989
|
+
const fn = vnode.props["onUpdate:modelValue"] || false;
|
|
990
|
+
return shared.isArray(fn) ? (value) => shared.invokeArrayFns(fn, value) : fn;
|
|
1119
991
|
};
|
|
1120
992
|
function onCompositionStart(e) {
|
|
1121
|
-
|
|
993
|
+
e.target.composing = true;
|
|
1122
994
|
}
|
|
1123
995
|
function onCompositionEnd(e) {
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
996
|
+
const target = e.target;
|
|
997
|
+
if (target.composing) {
|
|
998
|
+
target.composing = false;
|
|
999
|
+
target.dispatchEvent(new Event("input"));
|
|
1000
|
+
}
|
|
1129
1001
|
}
|
|
1130
|
-
// We are exporting the v-model runtime directly as vnode hooks so that it can
|
|
1131
|
-
// be tree-shaken in case v-model is never used.
|
|
1132
1002
|
const vModelText = {
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
return;
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
const newValue = value == null ? '' : value;
|
|
1185
|
-
if (el.value !== newValue) {
|
|
1186
|
-
el.value = newValue;
|
|
1187
|
-
}
|
|
1003
|
+
created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
|
1004
|
+
el._assign = getModelAssigner(vnode);
|
|
1005
|
+
const castToNumber = number || vnode.props && vnode.props.type === "number";
|
|
1006
|
+
addEventListener(el, lazy ? "change" : "input", (e) => {
|
|
1007
|
+
if (e.target.composing)
|
|
1008
|
+
return;
|
|
1009
|
+
let domValue = el.value;
|
|
1010
|
+
if (trim) {
|
|
1011
|
+
domValue = domValue.trim();
|
|
1012
|
+
}
|
|
1013
|
+
if (castToNumber) {
|
|
1014
|
+
domValue = shared.looseToNumber(domValue);
|
|
1015
|
+
}
|
|
1016
|
+
el._assign(domValue);
|
|
1017
|
+
});
|
|
1018
|
+
if (trim) {
|
|
1019
|
+
addEventListener(el, "change", () => {
|
|
1020
|
+
el.value = el.value.trim();
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
if (!lazy) {
|
|
1024
|
+
addEventListener(el, "compositionstart", onCompositionStart);
|
|
1025
|
+
addEventListener(el, "compositionend", onCompositionEnd);
|
|
1026
|
+
addEventListener(el, "change", onCompositionEnd);
|
|
1027
|
+
}
|
|
1028
|
+
},
|
|
1029
|
+
// set value on mounted so it's after min/max for type="range"
|
|
1030
|
+
mounted(el, { value }) {
|
|
1031
|
+
el.value = value == null ? "" : value;
|
|
1032
|
+
},
|
|
1033
|
+
beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
|
|
1034
|
+
el._assign = getModelAssigner(vnode);
|
|
1035
|
+
if (el.composing)
|
|
1036
|
+
return;
|
|
1037
|
+
if (document.activeElement === el && el.type !== "range") {
|
|
1038
|
+
if (lazy) {
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
1041
|
+
if (trim && el.value.trim() === value) {
|
|
1042
|
+
return;
|
|
1043
|
+
}
|
|
1044
|
+
if ((number || el.type === "number") && shared.looseToNumber(el.value) === value) {
|
|
1045
|
+
return;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
const newValue = value == null ? "" : value;
|
|
1049
|
+
if (el.value !== newValue) {
|
|
1050
|
+
el.value = newValue;
|
|
1188
1051
|
}
|
|
1052
|
+
}
|
|
1189
1053
|
};
|
|
1190
1054
|
const vModelCheckbox = {
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
beforeUpdate(el, binding, vnode) {
|
|
1230
|
-
el._assign = getModelAssigner(vnode);
|
|
1231
|
-
setChecked(el, binding, vnode);
|
|
1232
|
-
}
|
|
1055
|
+
// #4096 array checkboxes need to be deep traversed
|
|
1056
|
+
deep: true,
|
|
1057
|
+
created(el, _, vnode) {
|
|
1058
|
+
el._assign = getModelAssigner(vnode);
|
|
1059
|
+
addEventListener(el, "change", () => {
|
|
1060
|
+
const modelValue = el._modelValue;
|
|
1061
|
+
const elementValue = getValue(el);
|
|
1062
|
+
const checked = el.checked;
|
|
1063
|
+
const assign = el._assign;
|
|
1064
|
+
if (shared.isArray(modelValue)) {
|
|
1065
|
+
const index = shared.looseIndexOf(modelValue, elementValue);
|
|
1066
|
+
const found = index !== -1;
|
|
1067
|
+
if (checked && !found) {
|
|
1068
|
+
assign(modelValue.concat(elementValue));
|
|
1069
|
+
} else if (!checked && found) {
|
|
1070
|
+
const filtered = [...modelValue];
|
|
1071
|
+
filtered.splice(index, 1);
|
|
1072
|
+
assign(filtered);
|
|
1073
|
+
}
|
|
1074
|
+
} else if (shared.isSet(modelValue)) {
|
|
1075
|
+
const cloned = new Set(modelValue);
|
|
1076
|
+
if (checked) {
|
|
1077
|
+
cloned.add(elementValue);
|
|
1078
|
+
} else {
|
|
1079
|
+
cloned.delete(elementValue);
|
|
1080
|
+
}
|
|
1081
|
+
assign(cloned);
|
|
1082
|
+
} else {
|
|
1083
|
+
assign(getCheckboxValue(el, checked));
|
|
1084
|
+
}
|
|
1085
|
+
});
|
|
1086
|
+
},
|
|
1087
|
+
// set initial checked on mount to wait for true-value/false-value
|
|
1088
|
+
mounted: setChecked,
|
|
1089
|
+
beforeUpdate(el, binding, vnode) {
|
|
1090
|
+
el._assign = getModelAssigner(vnode);
|
|
1091
|
+
setChecked(el, binding, vnode);
|
|
1092
|
+
}
|
|
1233
1093
|
};
|
|
1234
1094
|
function setChecked(el, { value, oldValue }, vnode) {
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
el.checked = shared.looseEqual(value, getCheckboxValue(el, true));
|
|
1244
|
-
}
|
|
1095
|
+
el._modelValue = value;
|
|
1096
|
+
if (shared.isArray(value)) {
|
|
1097
|
+
el.checked = shared.looseIndexOf(value, vnode.props.value) > -1;
|
|
1098
|
+
} else if (shared.isSet(value)) {
|
|
1099
|
+
el.checked = value.has(vnode.props.value);
|
|
1100
|
+
} else if (value !== oldValue) {
|
|
1101
|
+
el.checked = shared.looseEqual(value, getCheckboxValue(el, true));
|
|
1102
|
+
}
|
|
1245
1103
|
}
|
|
1246
1104
|
const vModelRadio = {
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
}
|
|
1105
|
+
created(el, { value }, vnode) {
|
|
1106
|
+
el.checked = shared.looseEqual(value, vnode.props.value);
|
|
1107
|
+
el._assign = getModelAssigner(vnode);
|
|
1108
|
+
addEventListener(el, "change", () => {
|
|
1109
|
+
el._assign(getValue(el));
|
|
1110
|
+
});
|
|
1111
|
+
},
|
|
1112
|
+
beforeUpdate(el, { value, oldValue }, vnode) {
|
|
1113
|
+
el._assign = getModelAssigner(vnode);
|
|
1114
|
+
if (value !== oldValue) {
|
|
1115
|
+
el.checked = shared.looseEqual(value, vnode.props.value);
|
|
1259
1116
|
}
|
|
1117
|
+
}
|
|
1260
1118
|
};
|
|
1261
1119
|
const vModelSelect = {
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
setSelected(el, value);
|
|
1288
|
-
}
|
|
1120
|
+
// <select multiple> value need to be deep traversed
|
|
1121
|
+
deep: true,
|
|
1122
|
+
created(el, { value, modifiers: { number } }, vnode) {
|
|
1123
|
+
const isSetModel = shared.isSet(value);
|
|
1124
|
+
addEventListener(el, "change", () => {
|
|
1125
|
+
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
|
|
1126
|
+
(o) => number ? shared.looseToNumber(getValue(o)) : getValue(o)
|
|
1127
|
+
);
|
|
1128
|
+
el._assign(
|
|
1129
|
+
el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
|
|
1130
|
+
);
|
|
1131
|
+
});
|
|
1132
|
+
el._assign = getModelAssigner(vnode);
|
|
1133
|
+
},
|
|
1134
|
+
// set value in mounted & updated because <select> relies on its children
|
|
1135
|
+
// <option>s.
|
|
1136
|
+
mounted(el, { value }) {
|
|
1137
|
+
setSelected(el, value);
|
|
1138
|
+
},
|
|
1139
|
+
beforeUpdate(el, _binding, vnode) {
|
|
1140
|
+
el._assign = getModelAssigner(vnode);
|
|
1141
|
+
},
|
|
1142
|
+
updated(el, { value }) {
|
|
1143
|
+
setSelected(el, value);
|
|
1144
|
+
}
|
|
1289
1145
|
};
|
|
1290
1146
|
function setSelected(el, value) {
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1147
|
+
const isMultiple = el.multiple;
|
|
1148
|
+
if (isMultiple && !shared.isArray(value) && !shared.isSet(value)) {
|
|
1149
|
+
runtimeCore.warn(
|
|
1150
|
+
`<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
|
|
1151
|
+
);
|
|
1152
|
+
return;
|
|
1153
|
+
}
|
|
1154
|
+
for (let i = 0, l = el.options.length; i < l; i++) {
|
|
1155
|
+
const option = el.options[i];
|
|
1156
|
+
const optionValue = getValue(option);
|
|
1157
|
+
if (isMultiple) {
|
|
1158
|
+
if (shared.isArray(value)) {
|
|
1159
|
+
option.selected = shared.looseIndexOf(value, optionValue) > -1;
|
|
1160
|
+
} else {
|
|
1161
|
+
option.selected = value.has(optionValue);
|
|
1162
|
+
}
|
|
1163
|
+
} else {
|
|
1164
|
+
if (shared.looseEqual(getValue(option), value)) {
|
|
1165
|
+
if (el.selectedIndex !== i)
|
|
1166
|
+
el.selectedIndex = i;
|
|
1295
1167
|
return;
|
|
1168
|
+
}
|
|
1296
1169
|
}
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
if (shared.isArray(value)) {
|
|
1302
|
-
option.selected = shared.looseIndexOf(value, optionValue) > -1;
|
|
1303
|
-
}
|
|
1304
|
-
else {
|
|
1305
|
-
option.selected = value.has(optionValue);
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
else {
|
|
1309
|
-
if (shared.looseEqual(getValue(option), value)) {
|
|
1310
|
-
if (el.selectedIndex !== i)
|
|
1311
|
-
el.selectedIndex = i;
|
|
1312
|
-
return;
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
}
|
|
1316
|
-
if (!isMultiple && el.selectedIndex !== -1) {
|
|
1317
|
-
el.selectedIndex = -1;
|
|
1318
|
-
}
|
|
1170
|
+
}
|
|
1171
|
+
if (!isMultiple && el.selectedIndex !== -1) {
|
|
1172
|
+
el.selectedIndex = -1;
|
|
1173
|
+
}
|
|
1319
1174
|
}
|
|
1320
|
-
// retrieve raw value set via :value bindings
|
|
1321
1175
|
function getValue(el) {
|
|
1322
|
-
|
|
1176
|
+
return "_value" in el ? el._value : el.value;
|
|
1323
1177
|
}
|
|
1324
|
-
// retrieve raw value for true-value and false-value set via :true-value or :false-value bindings
|
|
1325
1178
|
function getCheckboxValue(el, checked) {
|
|
1326
|
-
|
|
1327
|
-
|
|
1179
|
+
const key = checked ? "_trueValue" : "_falseValue";
|
|
1180
|
+
return key in el ? el[key] : checked;
|
|
1328
1181
|
}
|
|
1329
1182
|
const vModelDynamic = {
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1183
|
+
created(el, binding, vnode) {
|
|
1184
|
+
callModelHook(el, binding, vnode, null, "created");
|
|
1185
|
+
},
|
|
1186
|
+
mounted(el, binding, vnode) {
|
|
1187
|
+
callModelHook(el, binding, vnode, null, "mounted");
|
|
1188
|
+
},
|
|
1189
|
+
beforeUpdate(el, binding, vnode, prevVNode) {
|
|
1190
|
+
callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
|
|
1191
|
+
},
|
|
1192
|
+
updated(el, binding, vnode, prevVNode) {
|
|
1193
|
+
callModelHook(el, binding, vnode, prevVNode, "updated");
|
|
1194
|
+
}
|
|
1342
1195
|
};
|
|
1343
1196
|
function resolveDynamicModel(tagName, type) {
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1197
|
+
switch (tagName) {
|
|
1198
|
+
case "SELECT":
|
|
1199
|
+
return vModelSelect;
|
|
1200
|
+
case "TEXTAREA":
|
|
1201
|
+
return vModelText;
|
|
1202
|
+
default:
|
|
1203
|
+
switch (type) {
|
|
1204
|
+
case "checkbox":
|
|
1205
|
+
return vModelCheckbox;
|
|
1206
|
+
case "radio":
|
|
1207
|
+
return vModelRadio;
|
|
1349
1208
|
default:
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
case 'radio':
|
|
1354
|
-
return vModelRadio;
|
|
1355
|
-
default:
|
|
1356
|
-
return vModelText;
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1209
|
+
return vModelText;
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1359
1212
|
}
|
|
1360
1213
|
function callModelHook(el, binding, vnode, prevVNode, hook) {
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1214
|
+
const modelToUse = resolveDynamicModel(
|
|
1215
|
+
el.tagName,
|
|
1216
|
+
vnode.props && vnode.props.type
|
|
1217
|
+
);
|
|
1218
|
+
const fn = modelToUse[hook];
|
|
1219
|
+
fn && fn(el, binding, vnode, prevVNode);
|
|
1364
1220
|
}
|
|
1365
|
-
// SSR vnode transforms, only used when user includes client-oriented render
|
|
1366
|
-
// function in SSR
|
|
1367
1221
|
function initVModelForSSR() {
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1222
|
+
vModelText.getSSRProps = ({ value }) => ({ value });
|
|
1223
|
+
vModelRadio.getSSRProps = ({ value }, vnode) => {
|
|
1224
|
+
if (vnode.props && shared.looseEqual(vnode.props.value, value)) {
|
|
1225
|
+
return { checked: true };
|
|
1226
|
+
}
|
|
1227
|
+
};
|
|
1228
|
+
vModelCheckbox.getSSRProps = ({ value }, vnode) => {
|
|
1229
|
+
if (shared.isArray(value)) {
|
|
1230
|
+
if (vnode.props && shared.looseIndexOf(value, vnode.props.value) > -1) {
|
|
1231
|
+
return { checked: true };
|
|
1232
|
+
}
|
|
1233
|
+
} else if (shared.isSet(value)) {
|
|
1234
|
+
if (vnode.props && value.has(vnode.props.value)) {
|
|
1235
|
+
return { checked: true };
|
|
1236
|
+
}
|
|
1237
|
+
} else if (value) {
|
|
1238
|
+
return { checked: true };
|
|
1239
|
+
}
|
|
1240
|
+
};
|
|
1241
|
+
vModelDynamic.getSSRProps = (binding, vnode) => {
|
|
1242
|
+
if (typeof vnode.type !== "string") {
|
|
1243
|
+
return;
|
|
1244
|
+
}
|
|
1245
|
+
const modelToUse = resolveDynamicModel(
|
|
1246
|
+
// resolveDynamicModel expects an uppercase tag name, but vnode.type is lowercase
|
|
1247
|
+
vnode.type.toUpperCase(),
|
|
1248
|
+
vnode.props && vnode.props.type
|
|
1249
|
+
);
|
|
1250
|
+
if (modelToUse.getSSRProps) {
|
|
1251
|
+
return modelToUse.getSSRProps(binding, vnode);
|
|
1252
|
+
}
|
|
1253
|
+
};
|
|
1400
1254
|
}
|
|
1401
1255
|
|
|
1402
|
-
const systemModifiers = [
|
|
1256
|
+
const systemModifiers = ["ctrl", "shift", "alt", "meta"];
|
|
1403
1257
|
const modifierGuards = {
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1258
|
+
stop: (e) => e.stopPropagation(),
|
|
1259
|
+
prevent: (e) => e.preventDefault(),
|
|
1260
|
+
self: (e) => e.target !== e.currentTarget,
|
|
1261
|
+
ctrl: (e) => !e.ctrlKey,
|
|
1262
|
+
shift: (e) => !e.shiftKey,
|
|
1263
|
+
alt: (e) => !e.altKey,
|
|
1264
|
+
meta: (e) => !e.metaKey,
|
|
1265
|
+
left: (e) => "button" in e && e.button !== 0,
|
|
1266
|
+
middle: (e) => "button" in e && e.button !== 1,
|
|
1267
|
+
right: (e) => "button" in e && e.button !== 2,
|
|
1268
|
+
exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
|
|
1415
1269
|
};
|
|
1416
|
-
/**
|
|
1417
|
-
* @private
|
|
1418
|
-
*/
|
|
1419
1270
|
const withModifiers = (fn, modifiers) => {
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1271
|
+
return (event, ...args) => {
|
|
1272
|
+
for (let i = 0; i < modifiers.length; i++) {
|
|
1273
|
+
const guard = modifierGuards[modifiers[i]];
|
|
1274
|
+
if (guard && guard(event, modifiers))
|
|
1275
|
+
return;
|
|
1276
|
+
}
|
|
1277
|
+
return fn(event, ...args);
|
|
1278
|
+
};
|
|
1428
1279
|
};
|
|
1429
|
-
// Kept for 2.x compat.
|
|
1430
|
-
// Note: IE11 compat for `spacebar` and `del` is removed for now.
|
|
1431
1280
|
const keyNames = {
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1281
|
+
esc: "escape",
|
|
1282
|
+
space: " ",
|
|
1283
|
+
up: "arrow-up",
|
|
1284
|
+
left: "arrow-left",
|
|
1285
|
+
right: "arrow-right",
|
|
1286
|
+
down: "arrow-down",
|
|
1287
|
+
delete: "backspace"
|
|
1439
1288
|
};
|
|
1440
|
-
/**
|
|
1441
|
-
* @private
|
|
1442
|
-
*/
|
|
1443
1289
|
const withKeys = (fn, modifiers) => {
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1290
|
+
return (event) => {
|
|
1291
|
+
if (!("key" in event)) {
|
|
1292
|
+
return;
|
|
1293
|
+
}
|
|
1294
|
+
const eventKey = shared.hyphenate(event.key);
|
|
1295
|
+
if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
|
|
1296
|
+
return fn(event);
|
|
1297
|
+
}
|
|
1298
|
+
};
|
|
1453
1299
|
};
|
|
1454
1300
|
|
|
1455
1301
|
const vShow = {
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
beforeUnmount(el, { value }) {
|
|
1490
|
-
setDisplay(el, value);
|
|
1491
|
-
}
|
|
1302
|
+
beforeMount(el, { value }, { transition }) {
|
|
1303
|
+
el._vod = el.style.display === "none" ? "" : el.style.display;
|
|
1304
|
+
if (transition && value) {
|
|
1305
|
+
transition.beforeEnter(el);
|
|
1306
|
+
} else {
|
|
1307
|
+
setDisplay(el, value);
|
|
1308
|
+
}
|
|
1309
|
+
},
|
|
1310
|
+
mounted(el, { value }, { transition }) {
|
|
1311
|
+
if (transition && value) {
|
|
1312
|
+
transition.enter(el);
|
|
1313
|
+
}
|
|
1314
|
+
},
|
|
1315
|
+
updated(el, { value, oldValue }, { transition }) {
|
|
1316
|
+
if (!value === !oldValue)
|
|
1317
|
+
return;
|
|
1318
|
+
if (transition) {
|
|
1319
|
+
if (value) {
|
|
1320
|
+
transition.beforeEnter(el);
|
|
1321
|
+
setDisplay(el, true);
|
|
1322
|
+
transition.enter(el);
|
|
1323
|
+
} else {
|
|
1324
|
+
transition.leave(el, () => {
|
|
1325
|
+
setDisplay(el, false);
|
|
1326
|
+
});
|
|
1327
|
+
}
|
|
1328
|
+
} else {
|
|
1329
|
+
setDisplay(el, value);
|
|
1330
|
+
}
|
|
1331
|
+
},
|
|
1332
|
+
beforeUnmount(el, { value }) {
|
|
1333
|
+
setDisplay(el, value);
|
|
1334
|
+
}
|
|
1492
1335
|
};
|
|
1493
1336
|
function setDisplay(el, value) {
|
|
1494
|
-
|
|
1337
|
+
el.style.display = value ? el._vod : "none";
|
|
1495
1338
|
}
|
|
1496
|
-
// SSR vnode transforms, only used when user includes client-oriented render
|
|
1497
|
-
// function in SSR
|
|
1498
1339
|
function initVShowForSSR() {
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1340
|
+
vShow.getSSRProps = ({ value }) => {
|
|
1341
|
+
if (!value) {
|
|
1342
|
+
return { style: { display: "none" } };
|
|
1343
|
+
}
|
|
1344
|
+
};
|
|
1504
1345
|
}
|
|
1505
1346
|
|
|
1506
|
-
const rendererOptions =
|
|
1507
|
-
// lazy create the renderer - this makes core renderer logic tree-shakable
|
|
1508
|
-
// in case the user only imports reactivity utilities from Vue.
|
|
1347
|
+
const rendererOptions = /* @__PURE__ */ shared.extend({ patchProp }, nodeOps);
|
|
1509
1348
|
let renderer;
|
|
1510
1349
|
let enabledHydration = false;
|
|
1511
1350
|
function ensureRenderer() {
|
|
1512
|
-
|
|
1513
|
-
(renderer = runtimeCore.createRenderer(rendererOptions)));
|
|
1351
|
+
return renderer || (renderer = runtimeCore.createRenderer(rendererOptions));
|
|
1514
1352
|
}
|
|
1515
1353
|
function ensureHydrationRenderer() {
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
enabledHydration = true;
|
|
1520
|
-
return renderer;
|
|
1354
|
+
renderer = enabledHydration ? renderer : runtimeCore.createHydrationRenderer(rendererOptions);
|
|
1355
|
+
enabledHydration = true;
|
|
1356
|
+
return renderer;
|
|
1521
1357
|
}
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
const
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
}
|
|
1559
|
-
const
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
}
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
if (container) {
|
|
1569
|
-
return mount(container, true, container instanceof SVGElement);
|
|
1570
|
-
}
|
|
1571
|
-
};
|
|
1572
|
-
return app;
|
|
1573
|
-
});
|
|
1358
|
+
const render = (...args) => {
|
|
1359
|
+
ensureRenderer().render(...args);
|
|
1360
|
+
};
|
|
1361
|
+
const hydrate = (...args) => {
|
|
1362
|
+
ensureHydrationRenderer().hydrate(...args);
|
|
1363
|
+
};
|
|
1364
|
+
const createApp = (...args) => {
|
|
1365
|
+
const app = ensureRenderer().createApp(...args);
|
|
1366
|
+
{
|
|
1367
|
+
injectNativeTagCheck(app);
|
|
1368
|
+
injectCompilerOptionsCheck(app);
|
|
1369
|
+
}
|
|
1370
|
+
const { mount } = app;
|
|
1371
|
+
app.mount = (containerOrSelector) => {
|
|
1372
|
+
const container = normalizeContainer(containerOrSelector);
|
|
1373
|
+
if (!container)
|
|
1374
|
+
return;
|
|
1375
|
+
const component = app._component;
|
|
1376
|
+
if (!shared.isFunction(component) && !component.render && !component.template) {
|
|
1377
|
+
component.template = container.innerHTML;
|
|
1378
|
+
}
|
|
1379
|
+
container.innerHTML = "";
|
|
1380
|
+
const proxy = mount(container, false, container instanceof SVGElement);
|
|
1381
|
+
if (container instanceof Element) {
|
|
1382
|
+
container.removeAttribute("v-cloak");
|
|
1383
|
+
container.setAttribute("data-v-app", "");
|
|
1384
|
+
}
|
|
1385
|
+
return proxy;
|
|
1386
|
+
};
|
|
1387
|
+
return app;
|
|
1388
|
+
};
|
|
1389
|
+
const createSSRApp = (...args) => {
|
|
1390
|
+
const app = ensureHydrationRenderer().createApp(...args);
|
|
1391
|
+
{
|
|
1392
|
+
injectNativeTagCheck(app);
|
|
1393
|
+
injectCompilerOptionsCheck(app);
|
|
1394
|
+
}
|
|
1395
|
+
const { mount } = app;
|
|
1396
|
+
app.mount = (containerOrSelector) => {
|
|
1397
|
+
const container = normalizeContainer(containerOrSelector);
|
|
1398
|
+
if (container) {
|
|
1399
|
+
return mount(container, true, container instanceof SVGElement);
|
|
1400
|
+
}
|
|
1401
|
+
};
|
|
1402
|
+
return app;
|
|
1403
|
+
};
|
|
1574
1404
|
function injectNativeTagCheck(app) {
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
writable: false
|
|
1580
|
-
});
|
|
1405
|
+
Object.defineProperty(app.config, "isNativeTag", {
|
|
1406
|
+
value: (tag) => shared.isHTMLTag(tag) || shared.isSVGTag(tag),
|
|
1407
|
+
writable: false
|
|
1408
|
+
});
|
|
1581
1409
|
}
|
|
1582
|
-
// dev only
|
|
1583
1410
|
function injectCompilerOptionsCheck(app) {
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
});
|
|
1612
|
-
}
|
|
1411
|
+
if (runtimeCore.isRuntimeOnly()) {
|
|
1412
|
+
const isCustomElement = app.config.isCustomElement;
|
|
1413
|
+
Object.defineProperty(app.config, "isCustomElement", {
|
|
1414
|
+
get() {
|
|
1415
|
+
return isCustomElement;
|
|
1416
|
+
},
|
|
1417
|
+
set() {
|
|
1418
|
+
runtimeCore.warn(
|
|
1419
|
+
`The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
|
|
1420
|
+
);
|
|
1421
|
+
}
|
|
1422
|
+
});
|
|
1423
|
+
const compilerOptions = app.config.compilerOptions;
|
|
1424
|
+
const msg = `The \`compilerOptions\` config option is only respected when using a build of Vue.js that includes the runtime compiler (aka "full build"). Since you are using the runtime-only build, \`compilerOptions\` must be passed to \`@vue/compiler-dom\` in the build setup instead.
|
|
1425
|
+
- For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
|
|
1426
|
+
- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
|
|
1427
|
+
- For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-dom`;
|
|
1428
|
+
Object.defineProperty(app.config, "compilerOptions", {
|
|
1429
|
+
get() {
|
|
1430
|
+
runtimeCore.warn(msg);
|
|
1431
|
+
return compilerOptions;
|
|
1432
|
+
},
|
|
1433
|
+
set() {
|
|
1434
|
+
runtimeCore.warn(msg);
|
|
1435
|
+
}
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1613
1438
|
}
|
|
1614
1439
|
function normalizeContainer(container) {
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
}
|
|
1620
|
-
|
|
1621
|
-
}
|
|
1622
|
-
if (window.ShadowRoot &&
|
|
1623
|
-
container instanceof window.ShadowRoot &&
|
|
1624
|
-
container.mode === 'closed') {
|
|
1625
|
-
runtimeCore.warn(`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`);
|
|
1440
|
+
if (shared.isString(container)) {
|
|
1441
|
+
const res = document.querySelector(container);
|
|
1442
|
+
if (!res) {
|
|
1443
|
+
runtimeCore.warn(
|
|
1444
|
+
`Failed to mount app: mount target selector "${container}" returned null.`
|
|
1445
|
+
);
|
|
1626
1446
|
}
|
|
1627
|
-
return
|
|
1447
|
+
return res;
|
|
1448
|
+
}
|
|
1449
|
+
if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
|
|
1450
|
+
runtimeCore.warn(
|
|
1451
|
+
`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
|
|
1452
|
+
);
|
|
1453
|
+
}
|
|
1454
|
+
return container;
|
|
1628
1455
|
}
|
|
1629
1456
|
let ssrDirectiveInitialized = false;
|
|
1630
|
-
/**
|
|
1631
|
-
* @internal
|
|
1632
|
-
*/
|
|
1633
1457
|
const initDirectivesForSSR = () => {
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
;
|
|
1458
|
+
if (!ssrDirectiveInitialized) {
|
|
1459
|
+
ssrDirectiveInitialized = true;
|
|
1460
|
+
initVModelForSSR();
|
|
1461
|
+
initVShowForSSR();
|
|
1462
|
+
}
|
|
1463
|
+
} ;
|
|
1641
1464
|
|
|
1642
1465
|
exports.Transition = Transition;
|
|
1643
1466
|
exports.TransitionGroup = TransitionGroup;
|