@vuact/runtime-dom 3.5.45-vuact.0 → 3.6.0-rc.17-vuact.0
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 +1486 -1865
- package/dist/runtime-dom.cjs.prod.js +1392 -1718
- package/dist/runtime-dom.d.ts +1266 -1255
- package/dist/runtime-dom.esm-browser.js +10246 -12585
- package/dist/runtime-dom.esm-browser.prod.js +8 -7
- package/dist/runtime-dom.esm-bundler.js +1626 -1938
- package/dist/runtime-dom.global.js +11208 -13532
- package/dist/runtime-dom.global.prod.js +8 -7
- package/package.json +5 -5
package/dist/runtime-dom.cjs.js
CHANGED
|
@@ -1,2051 +1,1667 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.
|
|
3
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
|
-
* @license MIT
|
|
5
|
-
**/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
* @vue/runtime-dom v3.6.0-rc.17
|
|
3
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
|
+
* @license MIT
|
|
5
|
+
**/
|
|
6
|
+
Object.defineProperties(exports, {
|
|
7
|
+
__esModule: { value: true },
|
|
8
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
9
|
+
});
|
|
10
|
+
let _vue_runtime_core = require("@vue/runtime-core");
|
|
11
|
+
let _vue_shared = require("@vue/shared");
|
|
12
|
+
//#region packages/runtime-dom/src/nodeOps.ts
|
|
13
13
|
let policy = void 0;
|
|
14
14
|
const tt = typeof window !== "undefined" && window.trustedTypes;
|
|
15
|
-
if (tt) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
} catch (e) {
|
|
21
|
-
runtimeCore.warn(`Error creating trusted types policy: ${e}`);
|
|
22
|
-
}
|
|
15
|
+
if (tt) try {
|
|
16
|
+
policy = /*@__PURE__*/ tt.createPolicy("vue", { createHTML: (val) => val });
|
|
17
|
+
} catch (e) {
|
|
18
|
+
(0, _vue_runtime_core.warn)(`Error creating trusted types policy: ${e}`);
|
|
23
19
|
}
|
|
24
20
|
const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
|
|
25
21
|
const svgNS = "http://www.w3.org/2000/svg";
|
|
26
22
|
const mathmlNS = "http://www.w3.org/1998/Math/MathML";
|
|
27
23
|
const doc = typeof document !== "undefined" ? document : null;
|
|
28
|
-
const templateContainer = doc &&
|
|
24
|
+
const templateContainer = doc && /*@__PURE__*/ doc.createElement("template");
|
|
29
25
|
const nodeOps = {
|
|
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
|
-
);
|
|
75
|
-
const template = templateContainer.content;
|
|
76
|
-
if (namespace === "svg" || namespace === "mathml") {
|
|
77
|
-
const wrapper = template.firstChild;
|
|
78
|
-
while (wrapper.firstChild) {
|
|
79
|
-
template.appendChild(wrapper.firstChild);
|
|
80
|
-
}
|
|
81
|
-
template.removeChild(wrapper);
|
|
82
|
-
}
|
|
83
|
-
parent.insertBefore(template, anchor);
|
|
84
|
-
}
|
|
85
|
-
return [
|
|
86
|
-
// first
|
|
87
|
-
before ? before.nextSibling : parent.firstChild,
|
|
88
|
-
// last
|
|
89
|
-
anchor ? anchor.previousSibling : parent.lastChild
|
|
90
|
-
];
|
|
91
|
-
}
|
|
26
|
+
insert: (child, parent, anchor) => {
|
|
27
|
+
parent.insertBefore(child, anchor || null);
|
|
28
|
+
},
|
|
29
|
+
remove: (child) => {
|
|
30
|
+
const parent = child.parentNode;
|
|
31
|
+
if (parent) parent.removeChild(child);
|
|
32
|
+
},
|
|
33
|
+
createElement: (tag, namespace, is, props) => {
|
|
34
|
+
const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
|
|
35
|
+
if (tag === "select" && props && props.multiple != null) el.setAttribute("multiple", props.multiple);
|
|
36
|
+
return el;
|
|
37
|
+
},
|
|
38
|
+
createText: (text) => doc.createTextNode(text),
|
|
39
|
+
createComment: (text) => doc.createComment(text),
|
|
40
|
+
setText: (node, text) => {
|
|
41
|
+
node.nodeValue = text;
|
|
42
|
+
},
|
|
43
|
+
setElementText: (el, text) => {
|
|
44
|
+
el.textContent = text;
|
|
45
|
+
},
|
|
46
|
+
parentNode: (node) => node.parentNode,
|
|
47
|
+
nextSibling: (node) => node.nextSibling,
|
|
48
|
+
querySelector: (selector) => doc.querySelector(selector),
|
|
49
|
+
setScopeId(el, id) {
|
|
50
|
+
el.setAttribute(id, "");
|
|
51
|
+
},
|
|
52
|
+
insertStaticContent(content, parent, anchor, namespace, start, end) {
|
|
53
|
+
const before = anchor ? anchor.previousSibling : parent.lastChild;
|
|
54
|
+
if (start && (start === end || start.nextSibling)) while (true) {
|
|
55
|
+
parent.insertBefore(start.cloneNode(true), anchor);
|
|
56
|
+
if (start === end || !(start = start.nextSibling)) break;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
templateContainer.innerHTML = unsafeToTrustedHTML(namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content);
|
|
60
|
+
const template = templateContainer.content;
|
|
61
|
+
if (namespace === "svg" || namespace === "mathml") {
|
|
62
|
+
const wrapper = template.firstChild;
|
|
63
|
+
while (wrapper.firstChild) template.appendChild(wrapper.firstChild);
|
|
64
|
+
template.removeChild(wrapper);
|
|
65
|
+
}
|
|
66
|
+
parent.insertBefore(template, anchor);
|
|
67
|
+
}
|
|
68
|
+
return [before ? before.nextSibling : parent.firstChild, anchor ? anchor.previousSibling : parent.lastChild];
|
|
69
|
+
}
|
|
92
70
|
};
|
|
93
|
-
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region packages/runtime-dom/src/components/Transition.ts
|
|
94
73
|
const TRANSITION = "transition";
|
|
95
74
|
const ANIMATION = "animation";
|
|
96
|
-
const vtcKey =
|
|
75
|
+
const vtcKey = Symbol("_vtc");
|
|
97
76
|
const DOMTransitionPropsValidators = {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
77
|
+
name: String,
|
|
78
|
+
type: String,
|
|
79
|
+
css: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: true
|
|
82
|
+
},
|
|
83
|
+
duration: [
|
|
84
|
+
String,
|
|
85
|
+
Number,
|
|
86
|
+
Object
|
|
87
|
+
],
|
|
88
|
+
enterFromClass: String,
|
|
89
|
+
enterActiveClass: String,
|
|
90
|
+
enterToClass: String,
|
|
91
|
+
appearFromClass: String,
|
|
92
|
+
appearActiveClass: String,
|
|
93
|
+
appearToClass: String,
|
|
94
|
+
leaveFromClass: String,
|
|
95
|
+
leaveActiveClass: String,
|
|
96
|
+
leaveToClass: String
|
|
114
97
|
};
|
|
115
|
-
const TransitionPropsValidators =
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
98
|
+
const TransitionPropsValidators = /*@__PURE__*/ (0, _vue_shared.extend)({}, _vue_runtime_core.BaseTransitionPropsValidators, DOMTransitionPropsValidators);
|
|
99
|
+
/**
|
|
100
|
+
* Wrap logic that attaches extra properties to Transition in a function
|
|
101
|
+
* so that it can be annotated as pure
|
|
102
|
+
*/
|
|
120
103
|
const decorate$1 = (t) => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
104
|
+
t.displayName = "Transition";
|
|
105
|
+
t.props = TransitionPropsValidators;
|
|
106
|
+
return t;
|
|
124
107
|
};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
108
|
+
/**
|
|
109
|
+
* DOM Transition is a higher-order-component based on the platform-agnostic
|
|
110
|
+
* base Transition component, with DOM-specific logic.
|
|
111
|
+
*/
|
|
112
|
+
const Transition = /*@__PURE__*/ decorate$1((props, { slots }) => (0, _vue_runtime_core.h)(_vue_runtime_core.BaseTransition, resolveTransitionProps(props), slots));
|
|
113
|
+
/**
|
|
114
|
+
* #3227 Incoming hooks may be merged into arrays when wrapping Transition
|
|
115
|
+
* with custom HOCs.
|
|
116
|
+
*/
|
|
128
117
|
const callHook = (hook, args = []) => {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
} else if (hook) {
|
|
132
|
-
hook(...args);
|
|
133
|
-
}
|
|
118
|
+
if ((0, _vue_shared.isArray)(hook)) hook.forEach((h) => h(...args));
|
|
119
|
+
else if (hook) hook(...args);
|
|
134
120
|
};
|
|
121
|
+
/**
|
|
122
|
+
* Check if a hook expects a callback (2nd arg), which means the user
|
|
123
|
+
* intends to explicitly control the end of the transition.
|
|
124
|
+
*/
|
|
135
125
|
const hasExplicitCallback = (hook) => {
|
|
136
|
-
|
|
126
|
+
return hook ? (0, _vue_shared.isArray)(hook) ? hook.some((h) => h.length > 1) : hook.length > 1 : false;
|
|
137
127
|
};
|
|
138
128
|
function resolveTransitionProps(rawProps) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
nextFrame(() => {
|
|
227
|
-
if (!el._isLeaving) {
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
removeTransitionClass(el, leaveFromClass);
|
|
231
|
-
addTransitionClass(el, leaveToClass);
|
|
232
|
-
if (!hasExplicitCallback(onLeave)) {
|
|
233
|
-
whenTransitionEnds(el, type, leaveDuration, resolve);
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
callHook(onLeave, [el, resolve]);
|
|
237
|
-
},
|
|
238
|
-
onEnterCancelled(el) {
|
|
239
|
-
finishEnter(el, false, void 0, true);
|
|
240
|
-
callHook(onEnterCancelled, [el]);
|
|
241
|
-
},
|
|
242
|
-
onAppearCancelled(el) {
|
|
243
|
-
finishEnter(el, true, void 0, true);
|
|
244
|
-
callHook(onAppearCancelled, [el]);
|
|
245
|
-
},
|
|
246
|
-
onLeaveCancelled(el) {
|
|
247
|
-
finishLeave(el);
|
|
248
|
-
callHook(onLeaveCancelled, [el]);
|
|
249
|
-
}
|
|
250
|
-
});
|
|
129
|
+
const baseProps = {};
|
|
130
|
+
for (const key in rawProps) if (!(key in DOMTransitionPropsValidators)) baseProps[key] = rawProps[key];
|
|
131
|
+
if (rawProps.css === false) return baseProps;
|
|
132
|
+
const { name = "v", type, duration, enterFromClass = `${name}-enter-from`, enterActiveClass = `${name}-enter-active`, enterToClass = `${name}-enter-to`, appearFromClass = enterFromClass, appearActiveClass = enterActiveClass, appearToClass = enterToClass, leaveFromClass = `${name}-leave-from`, leaveActiveClass = `${name}-leave-active`, leaveToClass = `${name}-leave-to` } = rawProps;
|
|
133
|
+
const durations = normalizeDuration(duration);
|
|
134
|
+
const enterDuration = durations && durations[0];
|
|
135
|
+
const leaveDuration = durations && durations[1];
|
|
136
|
+
const { onBeforeEnter, onEnter, onEnterCancelled, onLeave, onLeaveCancelled, onBeforeAppear = onBeforeEnter, onAppear = onEnter, onAppearCancelled = onEnterCancelled } = baseProps;
|
|
137
|
+
const finishEnter = (el, isAppear, done, isCancelled) => {
|
|
138
|
+
el._enterResolve = void 0;
|
|
139
|
+
el._enterCancelled = isCancelled;
|
|
140
|
+
removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
|
141
|
+
removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
|
|
142
|
+
done && done();
|
|
143
|
+
};
|
|
144
|
+
const finishLeave = (el, done) => {
|
|
145
|
+
el._leaveResolve = void 0;
|
|
146
|
+
el._isLeaving = false;
|
|
147
|
+
removeTransitionClass(el, leaveFromClass);
|
|
148
|
+
removeTransitionClass(el, leaveToClass);
|
|
149
|
+
removeTransitionClass(el, leaveActiveClass);
|
|
150
|
+
done && done();
|
|
151
|
+
};
|
|
152
|
+
const makeEnterHook = (isAppear) => {
|
|
153
|
+
return (el, done) => {
|
|
154
|
+
const hook = isAppear ? onAppear : onEnter;
|
|
155
|
+
const resolve = () => {
|
|
156
|
+
if (el._enterResolve === resolve) finishEnter(el, isAppear, done);
|
|
157
|
+
};
|
|
158
|
+
el._enterResolve = resolve;
|
|
159
|
+
callHook(hook, [el, resolve]);
|
|
160
|
+
nextFrame(() => {
|
|
161
|
+
removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
|
|
162
|
+
if (el._enterResolve !== resolve) return;
|
|
163
|
+
addTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
|
164
|
+
if (!hasExplicitCallback(hook)) whenTransitionEnds(el, type, enterDuration, resolve);
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
return (0, _vue_shared.extend)(baseProps, {
|
|
169
|
+
onBeforeEnter(el) {
|
|
170
|
+
callHook(onBeforeEnter, [el]);
|
|
171
|
+
addTransitionClass(el, enterFromClass);
|
|
172
|
+
addTransitionClass(el, enterActiveClass);
|
|
173
|
+
},
|
|
174
|
+
onBeforeAppear(el) {
|
|
175
|
+
callHook(onBeforeAppear, [el]);
|
|
176
|
+
addTransitionClass(el, appearFromClass);
|
|
177
|
+
addTransitionClass(el, appearActiveClass);
|
|
178
|
+
},
|
|
179
|
+
onEnter: makeEnterHook(false),
|
|
180
|
+
onAppear: makeEnterHook(true),
|
|
181
|
+
onLeave(el, done) {
|
|
182
|
+
el._isLeaving = true;
|
|
183
|
+
const resolve = () => {
|
|
184
|
+
if (el._leaveResolve === resolve) finishLeave(el, done);
|
|
185
|
+
};
|
|
186
|
+
el._leaveResolve = resolve;
|
|
187
|
+
addTransitionClass(el, leaveFromClass);
|
|
188
|
+
if (!el._enterCancelled) {
|
|
189
|
+
forceReflow(el);
|
|
190
|
+
addTransitionClass(el, leaveActiveClass);
|
|
191
|
+
} else {
|
|
192
|
+
addTransitionClass(el, leaveActiveClass);
|
|
193
|
+
forceReflow(el);
|
|
194
|
+
}
|
|
195
|
+
nextFrame(() => {
|
|
196
|
+
if (el._leaveResolve !== resolve) return;
|
|
197
|
+
removeTransitionClass(el, leaveFromClass);
|
|
198
|
+
addTransitionClass(el, leaveToClass);
|
|
199
|
+
if (!hasExplicitCallback(onLeave)) whenTransitionEnds(el, type, leaveDuration, resolve);
|
|
200
|
+
});
|
|
201
|
+
callHook(onLeave, [el, resolve]);
|
|
202
|
+
},
|
|
203
|
+
onEnterCancelled(el) {
|
|
204
|
+
finishEnter(el, false, void 0, true);
|
|
205
|
+
callHook(onEnterCancelled, [el]);
|
|
206
|
+
},
|
|
207
|
+
onAppearCancelled(el) {
|
|
208
|
+
finishEnter(el, true, void 0, true);
|
|
209
|
+
callHook(onAppearCancelled, [el]);
|
|
210
|
+
},
|
|
211
|
+
onLeaveCancelled(el) {
|
|
212
|
+
finishLeave(el);
|
|
213
|
+
callHook(onLeaveCancelled, [el]);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
251
216
|
}
|
|
252
217
|
function normalizeDuration(duration) {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
return [n, n];
|
|
260
|
-
}
|
|
218
|
+
if (duration == null) return null;
|
|
219
|
+
else if ((0, _vue_shared.isObject)(duration)) return [NumberOf(duration.enter), NumberOf(duration.leave)];
|
|
220
|
+
else {
|
|
221
|
+
const n = NumberOf(duration);
|
|
222
|
+
return [n, n];
|
|
223
|
+
}
|
|
261
224
|
}
|
|
262
225
|
function NumberOf(val) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}
|
|
267
|
-
return res;
|
|
226
|
+
const res = (0, _vue_shared.toNumber)(val);
|
|
227
|
+
(0, _vue_runtime_core.assertNumber)(res, "<transition> explicit duration");
|
|
228
|
+
return res;
|
|
268
229
|
}
|
|
269
230
|
function addTransitionClass(el, cls) {
|
|
270
|
-
|
|
271
|
-
|
|
231
|
+
cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
|
|
232
|
+
(el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
|
|
272
233
|
}
|
|
273
234
|
function removeTransitionClass(el, cls) {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
}
|
|
235
|
+
cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
|
|
236
|
+
const _vtc = el[vtcKey];
|
|
237
|
+
if (_vtc) {
|
|
238
|
+
_vtc.delete(cls);
|
|
239
|
+
if (!_vtc.size) el[vtcKey] = void 0;
|
|
240
|
+
}
|
|
282
241
|
}
|
|
283
242
|
function nextFrame(cb) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
243
|
+
requestAnimationFrame(() => {
|
|
244
|
+
requestAnimationFrame(cb);
|
|
245
|
+
});
|
|
287
246
|
}
|
|
288
247
|
let endId = 0;
|
|
289
248
|
function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
if (e.target === el && ++ended >= propCount) {
|
|
311
|
-
end();
|
|
312
|
-
}
|
|
313
|
-
};
|
|
314
|
-
setTimeout(() => {
|
|
315
|
-
if (ended < propCount) {
|
|
316
|
-
end();
|
|
317
|
-
}
|
|
318
|
-
}, timeout + 1);
|
|
319
|
-
el.addEventListener(endEvent, onEnd);
|
|
249
|
+
const id = el._endId = ++endId;
|
|
250
|
+
const resolveIfNotStale = () => {
|
|
251
|
+
if (id === el._endId) resolve();
|
|
252
|
+
};
|
|
253
|
+
if (explicitTimeout != null) return setTimeout(resolveIfNotStale, explicitTimeout);
|
|
254
|
+
const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
|
|
255
|
+
if (!type) return resolve();
|
|
256
|
+
const endEvent = type + "end";
|
|
257
|
+
let ended = 0;
|
|
258
|
+
const end = () => {
|
|
259
|
+
el.removeEventListener(endEvent, onEnd);
|
|
260
|
+
resolveIfNotStale();
|
|
261
|
+
};
|
|
262
|
+
const onEnd = (e) => {
|
|
263
|
+
if (e.target === el && ++ended >= propCount) end();
|
|
264
|
+
};
|
|
265
|
+
setTimeout(() => {
|
|
266
|
+
if (ended < propCount) end();
|
|
267
|
+
}, timeout + 1);
|
|
268
|
+
el.addEventListener(endEvent, onEnd);
|
|
320
269
|
}
|
|
321
270
|
function getTransitionInfo(el, expectedType) {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
hasTransform
|
|
358
|
-
};
|
|
271
|
+
const styles = window.getComputedStyle(el);
|
|
272
|
+
const getStyleProperties = (key) => (styles[key] || "").split(", ");
|
|
273
|
+
const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
|
|
274
|
+
const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
|
|
275
|
+
const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
|
276
|
+
const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
|
|
277
|
+
const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
|
|
278
|
+
const animationTimeout = getTimeout(animationDelays, animationDurations);
|
|
279
|
+
let type = null;
|
|
280
|
+
let timeout = 0;
|
|
281
|
+
let propCount = 0;
|
|
282
|
+
if (expectedType === TRANSITION) {
|
|
283
|
+
if (transitionTimeout > 0) {
|
|
284
|
+
type = TRANSITION;
|
|
285
|
+
timeout = transitionTimeout;
|
|
286
|
+
propCount = transitionDurations.length;
|
|
287
|
+
}
|
|
288
|
+
} else if (expectedType === ANIMATION) {
|
|
289
|
+
if (animationTimeout > 0) {
|
|
290
|
+
type = ANIMATION;
|
|
291
|
+
timeout = animationTimeout;
|
|
292
|
+
propCount = animationDurations.length;
|
|
293
|
+
}
|
|
294
|
+
} else {
|
|
295
|
+
timeout = Math.max(transitionTimeout, animationTimeout);
|
|
296
|
+
type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
|
|
297
|
+
propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
|
|
298
|
+
}
|
|
299
|
+
const hasTransform = type === TRANSITION && /\b(?:transform|all)(?:,|$)/.test(getStyleProperties(`${TRANSITION}Property`).toString());
|
|
300
|
+
return {
|
|
301
|
+
type,
|
|
302
|
+
timeout,
|
|
303
|
+
propCount,
|
|
304
|
+
hasTransform
|
|
305
|
+
};
|
|
359
306
|
}
|
|
360
307
|
function getTimeout(delays, durations) {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
}
|
|
364
|
-
return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
|
|
308
|
+
while (delays.length < durations.length) delays = delays.concat(delays);
|
|
309
|
+
return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
|
|
365
310
|
}
|
|
366
311
|
function toMs(s) {
|
|
367
|
-
|
|
368
|
-
|
|
312
|
+
if (s === "auto") return 0;
|
|
313
|
+
return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
|
|
369
314
|
}
|
|
370
315
|
function forceReflow(el) {
|
|
371
|
-
|
|
372
|
-
return targetDocument.body.offsetHeight;
|
|
316
|
+
return (el ? el.ownerDocument : document).body.offsetHeight;
|
|
373
317
|
}
|
|
374
|
-
|
|
318
|
+
//#endregion
|
|
319
|
+
//#region packages/runtime-dom/src/modules/class.ts
|
|
375
320
|
function patchClass(el, value, isSVG) {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
el.removeAttribute("class");
|
|
382
|
-
} else if (isSVG) {
|
|
383
|
-
el.setAttribute("class", value);
|
|
384
|
-
} else {
|
|
385
|
-
el.className = value;
|
|
386
|
-
}
|
|
321
|
+
const transitionClasses = el[vtcKey];
|
|
322
|
+
if (transitionClasses) value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
|
|
323
|
+
if (value == null) el.removeAttribute("class");
|
|
324
|
+
else if (isSVG) el.setAttribute("class", value);
|
|
325
|
+
else el.className = value;
|
|
387
326
|
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
const
|
|
327
|
+
//#endregion
|
|
328
|
+
//#region packages/runtime-dom/src/directives/vShow.ts
|
|
329
|
+
const vShowOriginalDisplay = Symbol("_vod");
|
|
330
|
+
const vShowHidden = Symbol("_vsh");
|
|
391
331
|
const vShow = {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
setDisplay(el, false);
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
} else {
|
|
420
|
-
setDisplay(el, value);
|
|
421
|
-
}
|
|
422
|
-
},
|
|
423
|
-
beforeUnmount(el, { value }) {
|
|
424
|
-
setDisplay(el, value);
|
|
425
|
-
}
|
|
332
|
+
name: "show",
|
|
333
|
+
beforeMount(el, { value }, { transition }) {
|
|
334
|
+
el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
|
|
335
|
+
if (transition && value) transition.beforeEnter(el);
|
|
336
|
+
else setDisplay(el, value);
|
|
337
|
+
},
|
|
338
|
+
mounted(el, { value }, { transition }) {
|
|
339
|
+
if (transition && value) transition.enter(el);
|
|
340
|
+
},
|
|
341
|
+
updated(el, { value, oldValue }, { transition }) {
|
|
342
|
+
if (!value === !oldValue) return;
|
|
343
|
+
if (transition) {
|
|
344
|
+
if (value) {
|
|
345
|
+
transition.beforeEnter(el);
|
|
346
|
+
setDisplay(el, true);
|
|
347
|
+
transition.enter(el);
|
|
348
|
+
} else transition.leave(el, () => {
|
|
349
|
+
setDisplay(el, false);
|
|
350
|
+
});
|
|
351
|
+
} else setDisplay(el, value);
|
|
352
|
+
},
|
|
353
|
+
beforeUnmount(el, { value }) {
|
|
354
|
+
setDisplay(el, value);
|
|
355
|
+
}
|
|
426
356
|
};
|
|
427
357
|
function setDisplay(el, value) {
|
|
428
|
-
|
|
429
|
-
|
|
358
|
+
el.style.display = value ? el[vShowOriginalDisplay] : "none";
|
|
359
|
+
el[vShowHidden] = !value;
|
|
430
360
|
}
|
|
431
361
|
function initVShowForSSR() {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
}
|
|
436
|
-
};
|
|
362
|
+
vShow.getSSRProps = ({ value }) => {
|
|
363
|
+
if (!value) return { style: { display: "none" } };
|
|
364
|
+
};
|
|
437
365
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
366
|
+
//#endregion
|
|
367
|
+
//#region packages/runtime-dom/src/helpers/useCssVars.ts
|
|
368
|
+
const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT");
|
|
369
|
+
/**
|
|
370
|
+
* Runtime helper for SFC's CSS variable injection feature.
|
|
371
|
+
* @private
|
|
372
|
+
*/
|
|
373
|
+
function useCssVars(getter) {}
|
|
374
|
+
//#endregion
|
|
375
|
+
//#region packages/runtime-dom/src/modules/style.ts
|
|
444
376
|
const displayRE = /(?:^|;)\s*display\s*:/;
|
|
445
377
|
function patchStyle(el, prev, next) {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
setStyle(style, key, "");
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
} else {
|
|
485
|
-
if (isCssString) {
|
|
486
|
-
if (prev !== next) {
|
|
487
|
-
const cssVarText = style[CSS_VAR_TEXT];
|
|
488
|
-
if (cssVarText) {
|
|
489
|
-
next += ";" + cssVarText;
|
|
490
|
-
}
|
|
491
|
-
style.cssText = next;
|
|
492
|
-
hasControlledDisplay = displayRE.test(next);
|
|
493
|
-
}
|
|
494
|
-
} else if (prev) {
|
|
495
|
-
el.removeAttribute("style");
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
if (vShowOriginalDisplay in el) {
|
|
499
|
-
if (!isCssString || prev !== next) {
|
|
500
|
-
el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
|
|
501
|
-
}
|
|
502
|
-
if (el[vShowHidden]) {
|
|
503
|
-
style.display = "none";
|
|
504
|
-
}
|
|
505
|
-
}
|
|
378
|
+
const style = el.style;
|
|
379
|
+
const isCssString = (0, _vue_shared.isString)(next);
|
|
380
|
+
let hasControlledDisplay = false;
|
|
381
|
+
if (next && !isCssString) {
|
|
382
|
+
if (prev) {
|
|
383
|
+
if (!(0, _vue_shared.isString)(prev)) {
|
|
384
|
+
for (const key in prev) if (next[key] == null) setStyle(style, key, "");
|
|
385
|
+
} else for (const prevStyle of prev.split(";")) {
|
|
386
|
+
const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
|
|
387
|
+
if (next[key] == null) setStyle(style, key, "");
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
for (const key in next) {
|
|
391
|
+
if (key === "display") hasControlledDisplay = true;
|
|
392
|
+
const value = next[key];
|
|
393
|
+
if (value != null) {
|
|
394
|
+
if (!shouldPreserveTextareaResizeStyle(el, key, !(0, _vue_shared.isString)(prev) && prev ? prev[key] : void 0, value)) setStyle(style, key, value);
|
|
395
|
+
} else setStyle(style, key, "");
|
|
396
|
+
}
|
|
397
|
+
} else if (isCssString) {
|
|
398
|
+
if (prev !== next) {
|
|
399
|
+
const cssVarText = style[CSS_VAR_TEXT];
|
|
400
|
+
if (cssVarText) next += ";" + cssVarText;
|
|
401
|
+
style.cssText = next;
|
|
402
|
+
hasControlledDisplay = displayRE.test(next);
|
|
403
|
+
}
|
|
404
|
+
} else if (prev) {
|
|
405
|
+
const cssVarText = style[CSS_VAR_TEXT];
|
|
406
|
+
if (cssVarText) style.cssText = cssVarText;
|
|
407
|
+
else el.removeAttribute("style");
|
|
408
|
+
}
|
|
409
|
+
if (vShowOriginalDisplay in el) {
|
|
410
|
+
if (!isCssString || prev !== next) el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
|
|
411
|
+
if (el[vShowHidden]) style.display = "none";
|
|
412
|
+
}
|
|
506
413
|
}
|
|
507
414
|
const semicolonRE = /[^\\];\s*$/;
|
|
508
415
|
const importantRE = /\s*!important$/;
|
|
509
|
-
function setStyle(style, name,
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
style.setProperty(name, val.replace(importantRE, ""), "important");
|
|
524
|
-
} else {
|
|
525
|
-
style.setProperty(name, val);
|
|
526
|
-
}
|
|
527
|
-
} else {
|
|
528
|
-
const prefixed = autoPrefix(style, name);
|
|
529
|
-
if (importantRE.test(val)) {
|
|
530
|
-
style.setProperty(
|
|
531
|
-
shared.hyphenate(prefixed),
|
|
532
|
-
val.replace(importantRE, ""),
|
|
533
|
-
"important"
|
|
534
|
-
);
|
|
535
|
-
} else {
|
|
536
|
-
style[prefixed] = val;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
}
|
|
416
|
+
function setStyle(style, name, rawVal) {
|
|
417
|
+
if ((0, _vue_shared.isArray)(rawVal)) rawVal.forEach((v) => setStyle(style, name, v));
|
|
418
|
+
else {
|
|
419
|
+
const val = rawVal == null ? "" : String(rawVal);
|
|
420
|
+
if (semicolonRE.test(val)) (0, _vue_runtime_core.warn)(`Unexpected semicolon at the end of '${name}' style value: '${val}'`);
|
|
421
|
+
if (name.startsWith("--")) {
|
|
422
|
+
if (importantRE.test(val)) style.setProperty(name, val.replace(importantRE, ""), "important");
|
|
423
|
+
else style.setProperty(name, val);
|
|
424
|
+
} else {
|
|
425
|
+
const prefixed = autoPrefix(style, name);
|
|
426
|
+
if (importantRE.test(val)) style.setProperty((0, _vue_shared.hyphenate)(prefixed), val.replace(importantRE, ""), "important");
|
|
427
|
+
else style[prefixed] = val;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
540
430
|
}
|
|
541
|
-
const prefixes = [
|
|
431
|
+
const prefixes = [
|
|
432
|
+
"Webkit",
|
|
433
|
+
"Moz",
|
|
434
|
+
"ms"
|
|
435
|
+
];
|
|
542
436
|
const prefixCache = {};
|
|
543
437
|
function autoPrefix(style, rawName) {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
const prefixed = prefixes[i] + name;
|
|
555
|
-
if (prefixed in style) {
|
|
556
|
-
return prefixCache[rawName] = prefixed;
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
return rawName;
|
|
438
|
+
const cached = prefixCache[rawName];
|
|
439
|
+
if (cached) return cached;
|
|
440
|
+
let name = (0, _vue_runtime_core.camelize)(rawName);
|
|
441
|
+
if (name !== "filter" && name in style) return prefixCache[rawName] = name;
|
|
442
|
+
name = (0, _vue_shared.capitalize)(name);
|
|
443
|
+
for (let i = 0; i < prefixes.length; i++) {
|
|
444
|
+
const prefixed = prefixes[i] + name;
|
|
445
|
+
if (prefixed in style) return prefixCache[rawName] = prefixed;
|
|
446
|
+
}
|
|
447
|
+
return rawName;
|
|
560
448
|
}
|
|
449
|
+
/**
|
|
450
|
+
* Browsers update textarea width/height directly during native resize.
|
|
451
|
+
* Only special-case this common textarea path for now; other resize scenarios
|
|
452
|
+
* still follow normal vnode style patching.
|
|
453
|
+
*/
|
|
561
454
|
function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
|
|
562
|
-
|
|
455
|
+
return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && (0, _vue_shared.isString)(next) && prev === next;
|
|
563
456
|
}
|
|
564
|
-
|
|
457
|
+
//#endregion
|
|
458
|
+
//#region packages/runtime-dom/src/modules/attrs.ts
|
|
565
459
|
const xlinkNS = "http://www.w3.org/1999/xlink";
|
|
566
|
-
function patchAttr(el, key, value, isSVG, instance, isBoolean =
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
}
|
|
573
|
-
} else {
|
|
574
|
-
if (value == null || isBoolean && !shared.includeBooleanAttr(value)) {
|
|
575
|
-
el.removeAttribute(key);
|
|
576
|
-
} else {
|
|
577
|
-
el.setAttribute(
|
|
578
|
-
key,
|
|
579
|
-
isBoolean ? "" : shared.isSymbol(value) ? String(value) : value
|
|
580
|
-
);
|
|
581
|
-
}
|
|
582
|
-
}
|
|
460
|
+
function patchAttr(el, key, value, isSVG, instance, isBoolean = (0, _vue_shared.isSpecialBooleanAttr)(key)) {
|
|
461
|
+
if (isSVG && key.startsWith("xlink:")) {
|
|
462
|
+
if (value == null) el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
|
463
|
+
else el.setAttributeNS(xlinkNS, key, value);
|
|
464
|
+
} else if (value == null || isBoolean && !(0, _vue_shared.includeBooleanAttr)(value)) el.removeAttribute(key);
|
|
465
|
+
else el.setAttribute(key, isBoolean ? "" : (0, _vue_shared.isSymbol)(value) ? String(value) : value);
|
|
583
466
|
}
|
|
584
|
-
|
|
467
|
+
//#endregion
|
|
468
|
+
//#region packages/runtime-dom/src/modules/props.ts
|
|
585
469
|
function patchDOMProp(el, key, value, parentComponent, attrName) {
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
needRemove = true;
|
|
618
|
-
} else if (type === "number") {
|
|
619
|
-
value = 0;
|
|
620
|
-
needRemove = true;
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
try {
|
|
624
|
-
el[key] = value;
|
|
625
|
-
} catch (e) {
|
|
626
|
-
if (!needRemove) {
|
|
627
|
-
runtimeCore.warn(
|
|
628
|
-
`Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
|
|
629
|
-
e
|
|
630
|
-
);
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
needRemove && el.removeAttribute(attrName || key);
|
|
470
|
+
if (key === "innerHTML" || key === "textContent") {
|
|
471
|
+
if (value != null) el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
const tag = el.tagName;
|
|
475
|
+
if (key === "value" && (0, _vue_shared.canSetValueDirectly)(tag)) {
|
|
476
|
+
const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
|
|
477
|
+
const newValue = value == null ? el.type === "checkbox" ? "on" : "" : String(value);
|
|
478
|
+
if (oldValue !== newValue || !("_value" in el)) el.value = newValue;
|
|
479
|
+
if (value == null) el.removeAttribute(key);
|
|
480
|
+
el._value = value;
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
let needRemove = false;
|
|
484
|
+
if (value === "" || value == null) {
|
|
485
|
+
const type = typeof el[key];
|
|
486
|
+
if (type === "boolean") value = (0, _vue_shared.includeBooleanAttr)(value);
|
|
487
|
+
else if (value == null && type === "string") {
|
|
488
|
+
value = "";
|
|
489
|
+
needRemove = true;
|
|
490
|
+
} else if (type === "number") {
|
|
491
|
+
value = 0;
|
|
492
|
+
needRemove = true;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
try {
|
|
496
|
+
el[key] = value;
|
|
497
|
+
} catch (e) {
|
|
498
|
+
if (!needRemove) (0, _vue_runtime_core.warn)(`Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`, e);
|
|
499
|
+
}
|
|
500
|
+
needRemove && el.removeAttribute(attrName || key);
|
|
634
501
|
}
|
|
635
|
-
|
|
502
|
+
//#endregion
|
|
503
|
+
//#region packages/runtime-dom/src/modules/events.ts
|
|
636
504
|
function addEventListener(el, event, handler, options) {
|
|
637
|
-
|
|
505
|
+
el.addEventListener(event, handler, options);
|
|
638
506
|
}
|
|
639
507
|
function removeEventListener(el, event, handler, options) {
|
|
640
|
-
|
|
508
|
+
el.removeEventListener(event, handler, options);
|
|
641
509
|
}
|
|
642
|
-
const veiKey =
|
|
510
|
+
const veiKey = Symbol("_vei");
|
|
643
511
|
function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
addEventListener(el, name, invoker, options);
|
|
656
|
-
} else if (existingInvoker) {
|
|
657
|
-
removeEventListener(el, name, existingInvoker, options);
|
|
658
|
-
invokers[rawName] = void 0;
|
|
659
|
-
}
|
|
660
|
-
}
|
|
512
|
+
const invokers = el[veiKey] || (el[veiKey] = {});
|
|
513
|
+
const existingInvoker = invokers[rawName];
|
|
514
|
+
if (nextValue && existingInvoker) existingInvoker.value = sanitizeEventValue(nextValue, rawName);
|
|
515
|
+
else {
|
|
516
|
+
const [name, options] = parseEventName(rawName);
|
|
517
|
+
if (nextValue) addEventListener(el, name, invokers[rawName] = createInvoker(sanitizeEventValue(nextValue, rawName), instance), options);
|
|
518
|
+
else if (existingInvoker) {
|
|
519
|
+
removeEventListener(el, name, existingInvoker, options);
|
|
520
|
+
invokers[rawName] = void 0;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
661
523
|
}
|
|
662
524
|
const optionsModifierRE = /(Once|Passive|Capture)$/;
|
|
663
525
|
const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
|
|
664
|
-
function
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
return [event, options];
|
|
526
|
+
function parseEventName(name) {
|
|
527
|
+
let options;
|
|
528
|
+
let m;
|
|
529
|
+
while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
|
|
530
|
+
if (!options) options = {};
|
|
531
|
+
name = name.slice(0, name.length - m[1].length);
|
|
532
|
+
options[m[1].toLowerCase()] = true;
|
|
533
|
+
}
|
|
534
|
+
return [name[2] === ":" ? name.slice(3) : (0, _vue_shared.hyphenate)(name.slice(2)), options];
|
|
674
535
|
}
|
|
675
536
|
let cachedNow = 0;
|
|
676
|
-
const p =
|
|
537
|
+
const p = /*@__PURE__*/ Promise.resolve();
|
|
677
538
|
const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
|
|
678
539
|
function createInvoker(initialValue, instance) {
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
handler,
|
|
702
|
-
instance,
|
|
703
|
-
5,
|
|
704
|
-
args
|
|
705
|
-
);
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
} else {
|
|
709
|
-
runtimeCore.callWithAsyncErrorHandling(
|
|
710
|
-
value,
|
|
711
|
-
instance,
|
|
712
|
-
5,
|
|
713
|
-
[e]
|
|
714
|
-
);
|
|
715
|
-
}
|
|
716
|
-
};
|
|
717
|
-
invoker.value = initialValue;
|
|
718
|
-
invoker.attached = getNow();
|
|
719
|
-
return invoker;
|
|
540
|
+
const invoker = (e) => {
|
|
541
|
+
if (!e._vts) e._vts = Date.now();
|
|
542
|
+
else if (e._vts <= invoker.attached) return;
|
|
543
|
+
const value = invoker.value;
|
|
544
|
+
if ((0, _vue_shared.isArray)(value)) {
|
|
545
|
+
const originalStop = e.stopImmediatePropagation;
|
|
546
|
+
e.stopImmediatePropagation = () => {
|
|
547
|
+
originalStop.call(e);
|
|
548
|
+
e._stopped = true;
|
|
549
|
+
};
|
|
550
|
+
const handlers = value.slice();
|
|
551
|
+
const args = [e];
|
|
552
|
+
for (let i = 0; i < handlers.length; i++) {
|
|
553
|
+
if (e._stopped) break;
|
|
554
|
+
const handler = handlers[i];
|
|
555
|
+
if (handler) (0, _vue_runtime_core.callWithAsyncErrorHandling)(handler, instance, 5, args);
|
|
556
|
+
}
|
|
557
|
+
} else (0, _vue_runtime_core.callWithAsyncErrorHandling)(value, instance, 5, [e]);
|
|
558
|
+
};
|
|
559
|
+
invoker.value = initialValue;
|
|
560
|
+
invoker.attached = getNow();
|
|
561
|
+
return invoker;
|
|
720
562
|
}
|
|
721
563
|
function sanitizeEventValue(value, propName) {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
runtimeCore.warn(
|
|
726
|
-
`Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
|
|
727
|
-
Expected function or array of functions, received type ${typeof value}.`
|
|
728
|
-
);
|
|
729
|
-
return shared.NOOP;
|
|
564
|
+
if ((0, _vue_shared.isFunction)(value) || (0, _vue_shared.isArray)(value)) return value;
|
|
565
|
+
(0, _vue_runtime_core.warn)(`Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?\nExpected function or array of functions, received type ${typeof value}.`);
|
|
566
|
+
return _vue_shared.NOOP;
|
|
730
567
|
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
|
|
568
|
+
//#endregion
|
|
569
|
+
//#region packages/runtime-dom/src/patchProp.ts
|
|
734
570
|
const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
} else if (
|
|
750
|
-
// #11081 force set props for possible async custom element
|
|
751
|
-
el._isVueCE && // #12408 check if it's declared prop or it's async custom element
|
|
752
|
-
(shouldSetAsPropForVueCE(el, key) || // @ts-expect-error _def is private
|
|
753
|
-
el._def.__asyncLoader && (/[A-Z]/.test(key) || !shared.isString(nextValue)))
|
|
754
|
-
) {
|
|
755
|
-
patchDOMProp(el, shared.camelize(key), nextValue, parentComponent, key);
|
|
756
|
-
} else {
|
|
757
|
-
if (key === "true-value") {
|
|
758
|
-
el._trueValue = nextValue;
|
|
759
|
-
} else if (key === "false-value") {
|
|
760
|
-
el._falseValue = nextValue;
|
|
761
|
-
}
|
|
762
|
-
patchAttr(el, key, nextValue, isSVG);
|
|
763
|
-
}
|
|
571
|
+
const isSVG = namespace === "svg";
|
|
572
|
+
if (key === "class") patchClass(el, nextValue, isSVG);
|
|
573
|
+
else if (key === "style") patchStyle(el, prevValue, nextValue);
|
|
574
|
+
else if ((0, _vue_shared.isOn)(key)) {
|
|
575
|
+
if (!(0, _vue_shared.isModelListener)(key)) patchEvent(el, key, prevValue, nextValue, parentComponent);
|
|
576
|
+
} else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
|
|
577
|
+
patchDOMProp(el, key, nextValue, parentComponent);
|
|
578
|
+
if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
|
|
579
|
+
} else if (el._isVueCE && (shouldSetAsPropForVueCE(el, key) || el._def.__asyncLoader && (/[A-Z]/.test(key) || !(0, _vue_shared.isString)(nextValue)))) patchDOMProp(el, (0, _vue_shared.camelize)(key), nextValue, parentComponent, key);
|
|
580
|
+
else {
|
|
581
|
+
if (key === "true-value") el._trueValue = nextValue;
|
|
582
|
+
else if (key === "false-value") el._falseValue = nextValue;
|
|
583
|
+
patchAttr(el, key, nextValue, isSVG, parentComponent);
|
|
584
|
+
}
|
|
764
585
|
};
|
|
765
586
|
function shouldSetAsProp(el, key, value, isSVG) {
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
}
|
|
775
|
-
if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
|
|
776
|
-
return false;
|
|
777
|
-
}
|
|
778
|
-
if (key === "sandbox" && el.tagName === "IFRAME") {
|
|
779
|
-
return false;
|
|
780
|
-
}
|
|
781
|
-
if (key === "form") {
|
|
782
|
-
return false;
|
|
783
|
-
}
|
|
784
|
-
if (key === "list" && el.tagName === "INPUT") {
|
|
785
|
-
return false;
|
|
786
|
-
}
|
|
787
|
-
if (key === "type" && el.tagName === "TEXTAREA") {
|
|
788
|
-
return false;
|
|
789
|
-
}
|
|
790
|
-
if (key === "width" || key === "height") {
|
|
791
|
-
const tag = el.tagName;
|
|
792
|
-
if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
|
|
793
|
-
return false;
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
if (isNativeOn(key) && shared.isString(value)) {
|
|
797
|
-
return false;
|
|
798
|
-
}
|
|
799
|
-
return key in el;
|
|
587
|
+
if (isSVG) {
|
|
588
|
+
if (key === "innerHTML" || key === "textContent") return true;
|
|
589
|
+
if (key in el && (0, _vue_shared.isNativeOn)(key) && (0, _vue_shared.isFunction)(value)) return true;
|
|
590
|
+
return false;
|
|
591
|
+
}
|
|
592
|
+
if ((0, _vue_shared.shouldSetAsAttr)(el.tagName, key)) return false;
|
|
593
|
+
if ((0, _vue_shared.isNativeOn)(key) && (0, _vue_shared.isString)(value)) return false;
|
|
594
|
+
return key in el;
|
|
800
595
|
}
|
|
801
596
|
function shouldSetAsPropForVueCE(el, key) {
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
if (!props) {
|
|
807
|
-
return false;
|
|
808
|
-
}
|
|
809
|
-
const camelKey = shared.camelize(key);
|
|
810
|
-
return Array.isArray(props) ? props.some((prop) => shared.camelize(prop) === camelKey) : Object.keys(props).some((prop) => shared.camelize(prop) === camelKey);
|
|
597
|
+
const props = el._def.props;
|
|
598
|
+
if (!props) return false;
|
|
599
|
+
const camelKey = (0, _vue_shared.camelize)(key);
|
|
600
|
+
return Array.isArray(props) ? props.some((prop) => (0, _vue_shared.camelize)(prop) === camelKey) : Object.keys(props).some((prop) => (0, _vue_shared.camelize)(prop) === camelKey);
|
|
811
601
|
}
|
|
812
|
-
|
|
602
|
+
//#endregion
|
|
603
|
+
//#region packages/runtime-dom/src/apiCustomElement.ts
|
|
813
604
|
const REMOVAL = {};
|
|
814
|
-
|
|
605
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
815
606
|
function defineCustomElement(options, extraOptions, _createApp) {
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
607
|
+
let Comp = (0, _vue_runtime_core.defineComponent)(options, extraOptions);
|
|
608
|
+
if ((0, _vue_shared.isPlainObject)(Comp)) Comp = (0, _vue_shared.extend)({}, Comp, extraOptions);
|
|
609
|
+
class VueCustomElement extends VueElement {
|
|
610
|
+
constructor(initialProps) {
|
|
611
|
+
super(Comp, initialProps, _createApp);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
VueCustomElement.def = Comp;
|
|
615
|
+
return VueCustomElement;
|
|
825
616
|
}
|
|
826
|
-
const defineSSRCustomElement = (
|
|
827
|
-
|
|
617
|
+
const defineSSRCustomElement = ((options, extraOptions) => {
|
|
618
|
+
return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
|
|
828
619
|
});
|
|
829
|
-
const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
|
|
620
|
+
const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {};
|
|
621
|
+
var VueElementBase = class VueElementBase extends BaseClass {
|
|
622
|
+
constructor(def, props = {}, createAppFn) {
|
|
623
|
+
super();
|
|
624
|
+
this._isVueCE = true;
|
|
625
|
+
this._instance = null;
|
|
626
|
+
this._app = null;
|
|
627
|
+
this._connected = false;
|
|
628
|
+
this._resolved = false;
|
|
629
|
+
this._numberProps = null;
|
|
630
|
+
this._styleChildren = /* @__PURE__ */ new WeakSet();
|
|
631
|
+
this._styleAnchors = /* @__PURE__ */ new WeakMap();
|
|
632
|
+
this._patching = false;
|
|
633
|
+
this._dirty = false;
|
|
634
|
+
this._ob = null;
|
|
635
|
+
this._def = def;
|
|
636
|
+
this._props = props;
|
|
637
|
+
this._createApp = createAppFn;
|
|
638
|
+
this._nonce = def.nonce;
|
|
639
|
+
if (this._needsHydration()) this._root = this.shadowRoot;
|
|
640
|
+
else if (def.shadowRoot !== false) {
|
|
641
|
+
this.attachShadow((0, _vue_shared.extend)({}, def.shadowRootOptions, { mode: "open" }));
|
|
642
|
+
this._root = this.shadowRoot;
|
|
643
|
+
} else this._root = this;
|
|
644
|
+
}
|
|
645
|
+
connectedCallback() {
|
|
646
|
+
if (!this.isConnected) return;
|
|
647
|
+
if (!this.shadowRoot && !this._resolved) this._parseSlots();
|
|
648
|
+
this._connected = true;
|
|
649
|
+
let parent = this;
|
|
650
|
+
while (parent = parent && (parent.assignedSlot || parent.parentNode || parent.host)) if (parent instanceof VueElementBase) {
|
|
651
|
+
this._parent = parent;
|
|
652
|
+
break;
|
|
653
|
+
}
|
|
654
|
+
if (!this._instance) {
|
|
655
|
+
if (this._resolved) this._mountComponent(this._def);
|
|
656
|
+
else if (parent && parent._pendingResolve) this._pendingResolve = parent._pendingResolve.then(() => {
|
|
657
|
+
this._pendingResolve = void 0;
|
|
658
|
+
if (this.isConnected) return this._resolveDef();
|
|
659
|
+
});
|
|
660
|
+
else this._resolveDef();
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
disconnectedCallback() {
|
|
664
|
+
this._connected = false;
|
|
665
|
+
(0, _vue_runtime_core.nextTick)(() => {
|
|
666
|
+
if (!this._connected) {
|
|
667
|
+
if (this._ob) {
|
|
668
|
+
this._ob.disconnect();
|
|
669
|
+
this._ob = null;
|
|
670
|
+
}
|
|
671
|
+
this._unmount();
|
|
672
|
+
if (this._teleportTargets) {
|
|
673
|
+
this._teleportTargets.clear();
|
|
674
|
+
this._teleportTargets = void 0;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
_setParent(parent = this._parent) {
|
|
680
|
+
if (parent && this._instance) {
|
|
681
|
+
this._instance.parent = parent._instance;
|
|
682
|
+
this._inheritParentContext(parent);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
_inheritParentContext(parent = this._parent) {
|
|
686
|
+
if (parent && this._app) Object.setPrototypeOf(this._app._context.provides, parent._instance.provides);
|
|
687
|
+
}
|
|
688
|
+
_processMutations(mutations) {
|
|
689
|
+
for (const m of mutations) this._setAttr(m.attributeName);
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* resolve inner component definition (handle possible async component)
|
|
693
|
+
*/
|
|
694
|
+
_resolveDef() {
|
|
695
|
+
if (this._pendingResolve) return this._pendingResolve;
|
|
696
|
+
for (let i = 0; i < this.attributes.length; i++) this._setAttr(this.attributes[i].name);
|
|
697
|
+
this._ob = new MutationObserver(this._processMutations.bind(this));
|
|
698
|
+
this._ob.observe(this, { attributes: true });
|
|
699
|
+
const resolve = (def) => {
|
|
700
|
+
this._resolved = true;
|
|
701
|
+
this._pendingResolve = void 0;
|
|
702
|
+
const { props, styles } = def;
|
|
703
|
+
let numberProps;
|
|
704
|
+
if (props && !(0, _vue_shared.isArray)(props)) for (const key in props) {
|
|
705
|
+
const opt = props[key];
|
|
706
|
+
if (opt === Number || opt && opt.type === Number) {
|
|
707
|
+
if (key in this._props) this._props[key] = (0, _vue_shared.toNumber)(this._props[key]);
|
|
708
|
+
(numberProps || (numberProps = Object.create(null)))[(0, _vue_shared.camelize)(key)] = true;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
this._numberProps = numberProps;
|
|
712
|
+
this._resolveProps(def);
|
|
713
|
+
if (this.shadowRoot) this._applyStyles(styles);
|
|
714
|
+
else if (styles) (0, _vue_runtime_core.warn)("Custom element style injection is not supported when using shadowRoot: false");
|
|
715
|
+
if (this._connected) this._mountComponent(def);
|
|
716
|
+
};
|
|
717
|
+
const asyncDef = this._def.__asyncLoader;
|
|
718
|
+
if (asyncDef) {
|
|
719
|
+
const { configureApp } = this._def;
|
|
720
|
+
this._pendingResolve = asyncDef().then((def) => {
|
|
721
|
+
def.configureApp = configureApp;
|
|
722
|
+
this._def = def;
|
|
723
|
+
resolve(def);
|
|
724
|
+
});
|
|
725
|
+
return this._pendingResolve;
|
|
726
|
+
} else resolve(this._def);
|
|
727
|
+
}
|
|
728
|
+
_mountComponent(def) {
|
|
729
|
+
this._mount(def);
|
|
730
|
+
this._processExposed();
|
|
731
|
+
}
|
|
732
|
+
_processExposed() {
|
|
733
|
+
const exposed = this._instance && this._instance.exposed;
|
|
734
|
+
if (!exposed) return;
|
|
735
|
+
for (const key in exposed) if (!(0, _vue_shared.hasOwn)(this, key)) Object.defineProperty(this, key, { get: () => (0, _vue_runtime_core.unref)(exposed[key]) });
|
|
736
|
+
else (0, _vue_runtime_core.warn)(`Exposed property "${key}" already exists on custom element.`);
|
|
737
|
+
}
|
|
738
|
+
_processInstance() {
|
|
739
|
+
this._instance.ce = this;
|
|
740
|
+
this._instance.isCE = true;
|
|
741
|
+
this._instance.ceReload = (newStyles) => {
|
|
742
|
+
if (this._styles) {
|
|
743
|
+
this._styles.forEach((s) => this._root.removeChild(s));
|
|
744
|
+
this._styles.length = 0;
|
|
745
|
+
}
|
|
746
|
+
this._styleAnchors.delete(this._def);
|
|
747
|
+
this._applyStyles(newStyles);
|
|
748
|
+
this._instance = null;
|
|
749
|
+
this._update();
|
|
750
|
+
};
|
|
751
|
+
const dispatch = (event, args) => {
|
|
752
|
+
this.dispatchEvent(new CustomEvent(event, (0, _vue_shared.isPlainObject)(args[0]) ? (0, _vue_shared.extend)({ detail: args }, args[0]) : { detail: args }));
|
|
753
|
+
};
|
|
754
|
+
this._instance.emit = (event, ...args) => {
|
|
755
|
+
dispatch(event, args);
|
|
756
|
+
if ((0, _vue_shared.hyphenate)(event) !== event) dispatch((0, _vue_shared.hyphenate)(event), args);
|
|
757
|
+
};
|
|
758
|
+
this._setParent();
|
|
759
|
+
}
|
|
760
|
+
_resolveProps(def) {
|
|
761
|
+
const { props } = def;
|
|
762
|
+
const declaredPropKeys = (0, _vue_shared.isArray)(props) ? props : Object.keys(props || {});
|
|
763
|
+
for (const key of Object.keys(this)) if (key[0] !== "_" && declaredPropKeys.includes(key)) this._setProp(key, this[key]);
|
|
764
|
+
for (const key of declaredPropKeys.map(_vue_shared.camelize)) {
|
|
765
|
+
if (key in Object.getPrototypeOf(this)) (0, _vue_runtime_core.warn)(`Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`);
|
|
766
|
+
Object.defineProperty(this, key, {
|
|
767
|
+
get() {
|
|
768
|
+
return this._getProp(key);
|
|
769
|
+
},
|
|
770
|
+
set(val) {
|
|
771
|
+
this._setProp(key, val, true, !this._patching);
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
_setAttr(key) {
|
|
777
|
+
if (key.startsWith("data-v-")) return;
|
|
778
|
+
const has = this.hasAttribute(key);
|
|
779
|
+
let value = has ? this.getAttribute(key) : REMOVAL;
|
|
780
|
+
const camelKey = (0, _vue_shared.camelize)(key);
|
|
781
|
+
if (has && this._numberProps && this._numberProps[camelKey]) value = (0, _vue_shared.toNumber)(value);
|
|
782
|
+
this._setProp(camelKey, value, false, true);
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* @internal
|
|
786
|
+
*/
|
|
787
|
+
_getProp(key) {
|
|
788
|
+
return this._props[key];
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* @internal
|
|
792
|
+
*/
|
|
793
|
+
_setProp(key, val, shouldReflect = true, shouldUpdate = false) {
|
|
794
|
+
if (val !== this._props[key]) {
|
|
795
|
+
this._dirty = true;
|
|
796
|
+
if (val === REMOVAL) delete this._props[key];
|
|
797
|
+
else {
|
|
798
|
+
this._props[key] = val;
|
|
799
|
+
if (key === "key" && this._app && this._app._ceVNode) this._app._ceVNode.key = val;
|
|
800
|
+
}
|
|
801
|
+
if (shouldUpdate && this._instance) this._update();
|
|
802
|
+
if (shouldReflect) {
|
|
803
|
+
const ob = this._ob;
|
|
804
|
+
if (ob) {
|
|
805
|
+
this._processMutations(ob.takeRecords());
|
|
806
|
+
ob.disconnect();
|
|
807
|
+
}
|
|
808
|
+
if (val === true) this.setAttribute((0, _vue_shared.hyphenate)(key), "");
|
|
809
|
+
else if (typeof val === "string" || typeof val === "number") this.setAttribute((0, _vue_shared.hyphenate)(key), val + "");
|
|
810
|
+
else if (!val) this.removeAttribute((0, _vue_shared.hyphenate)(key));
|
|
811
|
+
ob && ob.observe(this, { attributes: true });
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
_applyStyles(styles, owner, parentComp) {
|
|
816
|
+
if (!styles) return;
|
|
817
|
+
if (owner) {
|
|
818
|
+
if (owner === this._def || this._styleChildren.has(owner)) return;
|
|
819
|
+
this._styleChildren.add(owner);
|
|
820
|
+
}
|
|
821
|
+
const nonce = this._nonce;
|
|
822
|
+
const root = this.shadowRoot;
|
|
823
|
+
const insertionAnchor = parentComp ? this._getStyleAnchor(parentComp) || this._getStyleAnchor(this._def) : this._getRootStyleInsertionAnchor(root);
|
|
824
|
+
let last = null;
|
|
825
|
+
for (let i = styles.length - 1; i >= 0; i--) {
|
|
826
|
+
const s = document.createElement("style");
|
|
827
|
+
if (nonce) s.setAttribute("nonce", nonce);
|
|
828
|
+
s.textContent = styles[i];
|
|
829
|
+
root.insertBefore(s, last || insertionAnchor);
|
|
830
|
+
last = s;
|
|
831
|
+
if (i === 0) {
|
|
832
|
+
if (!parentComp) this._styleAnchors.set(this._def, s);
|
|
833
|
+
if (owner) this._styleAnchors.set(owner, s);
|
|
834
|
+
}
|
|
835
|
+
if (owner) {
|
|
836
|
+
if (owner.__hmrId) {
|
|
837
|
+
if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
|
|
838
|
+
let entry = this._childStyles.get(owner.__hmrId);
|
|
839
|
+
if (!entry) this._childStyles.set(owner.__hmrId, entry = []);
|
|
840
|
+
entry.push(s);
|
|
841
|
+
}
|
|
842
|
+
} else (this._styles || (this._styles = [])).push(s);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
_getStyleAnchor(comp) {
|
|
846
|
+
if (!comp) return null;
|
|
847
|
+
const anchor = this._styleAnchors.get(comp);
|
|
848
|
+
if (anchor && anchor.parentNode === this.shadowRoot) return anchor;
|
|
849
|
+
if (anchor) this._styleAnchors.delete(comp);
|
|
850
|
+
return null;
|
|
851
|
+
}
|
|
852
|
+
_getRootStyleInsertionAnchor(root) {
|
|
853
|
+
for (let i = 0; i < root.childNodes.length; i++) {
|
|
854
|
+
const node = root.childNodes[i];
|
|
855
|
+
if (!(node instanceof HTMLStyleElement)) return node;
|
|
856
|
+
}
|
|
857
|
+
return null;
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* Only called when shadowRoot is false
|
|
861
|
+
*/
|
|
862
|
+
_parseSlots() {
|
|
863
|
+
const slots = this._slots = {};
|
|
864
|
+
let n;
|
|
865
|
+
while (n = this.firstChild) {
|
|
866
|
+
const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
|
|
867
|
+
(slots[slotName] || (slots[slotName] = [])).push(n);
|
|
868
|
+
this.removeChild(n);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Only called when shadowRoot is false
|
|
873
|
+
*/
|
|
874
|
+
_renderSlots() {
|
|
875
|
+
const outlets = this._getSlots();
|
|
876
|
+
const scopeId = this._instance.type.__scopeId;
|
|
877
|
+
for (let i = 0; i < outlets.length; i++) {
|
|
878
|
+
const o = outlets[i];
|
|
879
|
+
const slotName = o.getAttribute("name") || "default";
|
|
880
|
+
const content = this._slots[slotName];
|
|
881
|
+
const parent = o.parentNode;
|
|
882
|
+
if (content) for (const n of content) {
|
|
883
|
+
if (scopeId && n.nodeType === 1) {
|
|
884
|
+
const id = scopeId + "-s";
|
|
885
|
+
const walker = document.createTreeWalker(n, 1);
|
|
886
|
+
n.setAttribute(id, "");
|
|
887
|
+
let child;
|
|
888
|
+
while (child = walker.nextNode()) child.setAttribute(id, "");
|
|
889
|
+
}
|
|
890
|
+
parent.insertBefore(n, o);
|
|
891
|
+
}
|
|
892
|
+
else while (o.firstChild) parent.insertBefore(o.firstChild, o);
|
|
893
|
+
parent.removeChild(o);
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* @internal
|
|
898
|
+
*/
|
|
899
|
+
_getSlots() {
|
|
900
|
+
const roots = [this];
|
|
901
|
+
if (this._teleportTargets) roots.push(...this._teleportTargets);
|
|
902
|
+
const slots = /* @__PURE__ */ new Set();
|
|
903
|
+
for (const root of roots) {
|
|
904
|
+
const found = root.querySelectorAll("slot");
|
|
905
|
+
for (let i = 0; i < found.length; i++) slots.add(found[i]);
|
|
906
|
+
}
|
|
907
|
+
return Array.from(slots);
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* @internal
|
|
911
|
+
*/
|
|
912
|
+
_injectChildStyle(comp, parentComp) {
|
|
913
|
+
this._applyStyles(comp.styles, comp, parentComp);
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* @internal
|
|
917
|
+
*/
|
|
918
|
+
_beginPatch() {
|
|
919
|
+
this._patching = true;
|
|
920
|
+
this._dirty = false;
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* @internal
|
|
924
|
+
*/
|
|
925
|
+
_endPatch() {
|
|
926
|
+
this._patching = false;
|
|
927
|
+
if (this._dirty && this._instance) this._update();
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* @internal
|
|
931
|
+
*/
|
|
932
|
+
_hasShadowRoot() {
|
|
933
|
+
return this._root !== this;
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* @internal
|
|
937
|
+
*/
|
|
938
|
+
_removeChildStyle(comp) {
|
|
939
|
+
this._styleChildren.delete(comp);
|
|
940
|
+
this._styleAnchors.delete(comp);
|
|
941
|
+
if (this._childStyles && comp.__hmrId) {
|
|
942
|
+
const oldStyles = this._childStyles.get(comp.__hmrId);
|
|
943
|
+
if (oldStyles) {
|
|
944
|
+
oldStyles.forEach((s) => this._root.removeChild(s));
|
|
945
|
+
oldStyles.length = 0;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
var VueElement = class extends VueElementBase {
|
|
951
|
+
constructor(def, props = {}, createAppFn = createApp) {
|
|
952
|
+
super(def, props, createAppFn);
|
|
953
|
+
}
|
|
954
|
+
_needsHydration() {
|
|
955
|
+
if (this.shadowRoot && this._createApp !== createApp) return true;
|
|
956
|
+
else if (this.shadowRoot) (0, _vue_runtime_core.warn)("Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use `defineSSRCustomElement`.");
|
|
957
|
+
return false;
|
|
958
|
+
}
|
|
959
|
+
_mount(def) {
|
|
960
|
+
if (!def.name) def.name = "VueElement";
|
|
961
|
+
this._app = this._createApp(def);
|
|
962
|
+
this._inheritParentContext();
|
|
963
|
+
if (def.configureApp) def.configureApp(this._app);
|
|
964
|
+
this._app._ceVNode = this._createVNode();
|
|
965
|
+
this._app.mount(this._root);
|
|
966
|
+
}
|
|
967
|
+
_update() {
|
|
968
|
+
if (!this._app) return;
|
|
969
|
+
const vnode = this._createVNode();
|
|
970
|
+
vnode.appContext = this._app._context;
|
|
971
|
+
render(vnode, this._root);
|
|
972
|
+
}
|
|
973
|
+
_unmount() {
|
|
974
|
+
if (this._app) this._app.unmount();
|
|
975
|
+
if (this._instance && this._instance.ce) this._instance.ce = void 0;
|
|
976
|
+
this._app = this._instance = null;
|
|
977
|
+
}
|
|
978
|
+
_createVNode() {
|
|
979
|
+
const baseProps = {};
|
|
980
|
+
if (!this.shadowRoot) baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
|
|
981
|
+
const vnode = (0, _vue_runtime_core.createVNode)(this._def, (0, _vue_shared.extend)(baseProps, this._props));
|
|
982
|
+
if (!this._instance) vnode.ce = (instance) => {
|
|
983
|
+
this._instance = instance;
|
|
984
|
+
this._processInstance();
|
|
985
|
+
};
|
|
986
|
+
return vnode;
|
|
987
|
+
}
|
|
830
988
|
};
|
|
831
|
-
class VueElement extends BaseClass {
|
|
832
|
-
constructor(_def, _props = {}, _createApp = createApp) {
|
|
833
|
-
super();
|
|
834
|
-
this._def = _def;
|
|
835
|
-
this._props = _props;
|
|
836
|
-
this._createApp = _createApp;
|
|
837
|
-
this._isVueCE = true;
|
|
838
|
-
/**
|
|
839
|
-
* @internal
|
|
840
|
-
*/
|
|
841
|
-
this._instance = null;
|
|
842
|
-
/**
|
|
843
|
-
* @internal
|
|
844
|
-
*/
|
|
845
|
-
this._app = null;
|
|
846
|
-
/**
|
|
847
|
-
* @internal
|
|
848
|
-
*/
|
|
849
|
-
this._nonce = this._def.nonce;
|
|
850
|
-
this._connected = false;
|
|
851
|
-
this._resolved = false;
|
|
852
|
-
this._patching = false;
|
|
853
|
-
this._dirty = false;
|
|
854
|
-
this._numberProps = null;
|
|
855
|
-
this._styleChildren = /* @__PURE__ */ new WeakSet();
|
|
856
|
-
this._styleAnchors = /* @__PURE__ */ new WeakMap();
|
|
857
|
-
this._ob = null;
|
|
858
|
-
if (this.shadowRoot && _createApp !== createApp) {
|
|
859
|
-
this._root = this.shadowRoot;
|
|
860
|
-
} else {
|
|
861
|
-
if (this.shadowRoot) {
|
|
862
|
-
runtimeCore.warn(
|
|
863
|
-
`Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
|
|
864
|
-
);
|
|
865
|
-
}
|
|
866
|
-
if (_def.shadowRoot !== false) {
|
|
867
|
-
this.attachShadow(
|
|
868
|
-
shared.extend({}, _def.shadowRootOptions, {
|
|
869
|
-
mode: "open"
|
|
870
|
-
})
|
|
871
|
-
);
|
|
872
|
-
this._root = this.shadowRoot;
|
|
873
|
-
} else {
|
|
874
|
-
this._root = this;
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
connectedCallback() {
|
|
879
|
-
if (!this.isConnected) return;
|
|
880
|
-
if (!this.shadowRoot && !this._resolved) {
|
|
881
|
-
this._parseSlots();
|
|
882
|
-
}
|
|
883
|
-
this._connected = true;
|
|
884
|
-
let parent = this;
|
|
885
|
-
while (parent = parent && // #12479 should check assignedSlot first to get correct parent
|
|
886
|
-
(parent.assignedSlot || parent.parentNode || parent.host)) {
|
|
887
|
-
if (parent instanceof VueElement) {
|
|
888
|
-
this._parent = parent;
|
|
889
|
-
break;
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
if (!this._instance) {
|
|
893
|
-
if (this._resolved) {
|
|
894
|
-
this._mount(this._def);
|
|
895
|
-
} else {
|
|
896
|
-
if (parent && parent._pendingResolve) {
|
|
897
|
-
this._pendingResolve = parent._pendingResolve.then(() => {
|
|
898
|
-
this._pendingResolve = void 0;
|
|
899
|
-
if (this.isConnected) {
|
|
900
|
-
return this._resolveDef();
|
|
901
|
-
}
|
|
902
|
-
});
|
|
903
|
-
} else {
|
|
904
|
-
this._resolveDef();
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
_setParent(parent = this._parent) {
|
|
910
|
-
if (parent) {
|
|
911
|
-
this._instance.parent = parent._instance;
|
|
912
|
-
this._inheritParentContext(parent);
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
_inheritParentContext(parent = this._parent) {
|
|
916
|
-
if (parent && this._app) {
|
|
917
|
-
Object.setPrototypeOf(
|
|
918
|
-
this._app._context.provides,
|
|
919
|
-
parent._instance.provides
|
|
920
|
-
);
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
disconnectedCallback() {
|
|
924
|
-
this._connected = false;
|
|
925
|
-
runtimeCore.nextTick(() => {
|
|
926
|
-
if (!this._connected) {
|
|
927
|
-
if (this._ob) {
|
|
928
|
-
this._ob.disconnect();
|
|
929
|
-
this._ob = null;
|
|
930
|
-
}
|
|
931
|
-
this._app && this._app.unmount();
|
|
932
|
-
if (this._instance) this._instance.ce = void 0;
|
|
933
|
-
this._app = this._instance = null;
|
|
934
|
-
if (this._teleportTargets) {
|
|
935
|
-
this._teleportTargets.clear();
|
|
936
|
-
this._teleportTargets = void 0;
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
});
|
|
940
|
-
}
|
|
941
|
-
_processMutations(mutations) {
|
|
942
|
-
for (const m of mutations) {
|
|
943
|
-
this._setAttr(m.attributeName);
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
/**
|
|
947
|
-
* resolve inner component definition (handle possible async component)
|
|
948
|
-
*/
|
|
949
|
-
_resolveDef() {
|
|
950
|
-
if (this._pendingResolve) {
|
|
951
|
-
return this._pendingResolve;
|
|
952
|
-
}
|
|
953
|
-
for (let i = 0; i < this.attributes.length; i++) {
|
|
954
|
-
this._setAttr(this.attributes[i].name);
|
|
955
|
-
}
|
|
956
|
-
this._ob = new MutationObserver(this._processMutations.bind(this));
|
|
957
|
-
this._ob.observe(this, { attributes: true });
|
|
958
|
-
const resolve = (def, isAsync = false) => {
|
|
959
|
-
this._resolved = true;
|
|
960
|
-
this._pendingResolve = void 0;
|
|
961
|
-
const { props, styles } = def;
|
|
962
|
-
let numberProps;
|
|
963
|
-
if (props && !shared.isArray(props)) {
|
|
964
|
-
for (const key in props) {
|
|
965
|
-
const opt = props[key];
|
|
966
|
-
if (opt === Number || opt && opt.type === Number) {
|
|
967
|
-
if (key in this._props) {
|
|
968
|
-
this._props[key] = shared.toNumber(this._props[key]);
|
|
969
|
-
}
|
|
970
|
-
(numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[shared.camelize(key)] = true;
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
this._numberProps = numberProps;
|
|
975
|
-
this._resolveProps(def);
|
|
976
|
-
if (this.shadowRoot) {
|
|
977
|
-
this._applyStyles(styles);
|
|
978
|
-
} else if (styles) {
|
|
979
|
-
runtimeCore.warn(
|
|
980
|
-
"Custom element style injection is not supported when using shadowRoot: false"
|
|
981
|
-
);
|
|
982
|
-
}
|
|
983
|
-
if (this._connected) {
|
|
984
|
-
this._mount(def);
|
|
985
|
-
}
|
|
986
|
-
};
|
|
987
|
-
const asyncDef = this._def.__asyncLoader;
|
|
988
|
-
if (asyncDef) {
|
|
989
|
-
this._pendingResolve = asyncDef().then((def) => {
|
|
990
|
-
def.configureApp = this._def.configureApp;
|
|
991
|
-
resolve(this._def = def, true);
|
|
992
|
-
});
|
|
993
|
-
return this._pendingResolve;
|
|
994
|
-
} else {
|
|
995
|
-
resolve(this._def);
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
_mount(def) {
|
|
999
|
-
if (!def.name) {
|
|
1000
|
-
def.name = "VueElement";
|
|
1001
|
-
}
|
|
1002
|
-
this._app = this._createApp(def);
|
|
1003
|
-
this._inheritParentContext();
|
|
1004
|
-
if (def.configureApp) {
|
|
1005
|
-
def.configureApp(this._app);
|
|
1006
|
-
}
|
|
1007
|
-
this._app._ceVNode = this._createVNode();
|
|
1008
|
-
this._app.mount(this._root);
|
|
1009
|
-
const exposed = this._instance && this._instance.exposed;
|
|
1010
|
-
if (!exposed) return;
|
|
1011
|
-
for (const key in exposed) {
|
|
1012
|
-
if (!shared.hasOwn(this, key)) {
|
|
1013
|
-
Object.defineProperty(this, key, {
|
|
1014
|
-
// unwrap ref to be consistent with public instance behavior
|
|
1015
|
-
get: () => runtimeCore.unref(exposed[key])
|
|
1016
|
-
});
|
|
1017
|
-
} else {
|
|
1018
|
-
runtimeCore.warn(`Exposed property "${key}" already exists on custom element.`);
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
_resolveProps(def) {
|
|
1023
|
-
const { props } = def;
|
|
1024
|
-
const declaredPropKeys = shared.isArray(props) ? props : Object.keys(props || {});
|
|
1025
|
-
for (const key of Object.keys(this)) {
|
|
1026
|
-
if (key[0] !== "_" && declaredPropKeys.includes(key)) {
|
|
1027
|
-
this._setProp(key, this[key]);
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
for (const key of declaredPropKeys.map(shared.camelize)) {
|
|
1031
|
-
if (key in Object.getPrototypeOf(this)) {
|
|
1032
|
-
runtimeCore.warn(
|
|
1033
|
-
`Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`
|
|
1034
|
-
);
|
|
1035
|
-
}
|
|
1036
|
-
Object.defineProperty(this, key, {
|
|
1037
|
-
get() {
|
|
1038
|
-
return this._getProp(key);
|
|
1039
|
-
},
|
|
1040
|
-
set(val) {
|
|
1041
|
-
this._setProp(key, val, true, !this._patching);
|
|
1042
|
-
}
|
|
1043
|
-
});
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
_setAttr(key) {
|
|
1047
|
-
if (key.startsWith("data-v-")) return;
|
|
1048
|
-
const has = this.hasAttribute(key);
|
|
1049
|
-
let value = has ? this.getAttribute(key) : REMOVAL;
|
|
1050
|
-
const camelKey = shared.camelize(key);
|
|
1051
|
-
if (has && this._numberProps && this._numberProps[camelKey]) {
|
|
1052
|
-
value = shared.toNumber(value);
|
|
1053
|
-
}
|
|
1054
|
-
this._setProp(camelKey, value, false, true);
|
|
1055
|
-
}
|
|
1056
|
-
/**
|
|
1057
|
-
* @internal
|
|
1058
|
-
*/
|
|
1059
|
-
_getProp(key) {
|
|
1060
|
-
return this._props[key];
|
|
1061
|
-
}
|
|
1062
|
-
/**
|
|
1063
|
-
* @internal
|
|
1064
|
-
*/
|
|
1065
|
-
_setProp(key, val, shouldReflect = true, shouldUpdate = false) {
|
|
1066
|
-
if (val !== this._props[key]) {
|
|
1067
|
-
this._dirty = true;
|
|
1068
|
-
if (val === REMOVAL) {
|
|
1069
|
-
delete this._props[key];
|
|
1070
|
-
} else {
|
|
1071
|
-
this._props[key] = val;
|
|
1072
|
-
if (key === "key" && this._app) {
|
|
1073
|
-
this._app._ceVNode.key = val;
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
if (shouldUpdate && this._instance) {
|
|
1077
|
-
this._update();
|
|
1078
|
-
}
|
|
1079
|
-
if (shouldReflect) {
|
|
1080
|
-
const ob = this._ob;
|
|
1081
|
-
if (ob) {
|
|
1082
|
-
this._processMutations(ob.takeRecords());
|
|
1083
|
-
ob.disconnect();
|
|
1084
|
-
}
|
|
1085
|
-
if (val === true) {
|
|
1086
|
-
this.setAttribute(shared.hyphenate(key), "");
|
|
1087
|
-
} else if (typeof val === "string" || typeof val === "number") {
|
|
1088
|
-
this.setAttribute(shared.hyphenate(key), val + "");
|
|
1089
|
-
} else if (!val) {
|
|
1090
|
-
this.removeAttribute(shared.hyphenate(key));
|
|
1091
|
-
}
|
|
1092
|
-
ob && ob.observe(this, { attributes: true });
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
_update() {
|
|
1097
|
-
const vnode = this._createVNode();
|
|
1098
|
-
if (this._app) vnode.appContext = this._app._context;
|
|
1099
|
-
render(vnode, this._root);
|
|
1100
|
-
}
|
|
1101
|
-
_createVNode() {
|
|
1102
|
-
const baseProps = {};
|
|
1103
|
-
if (!this.shadowRoot) {
|
|
1104
|
-
baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
|
|
1105
|
-
}
|
|
1106
|
-
const vnode = runtimeCore.createVNode(this._def, shared.extend(baseProps, this._props));
|
|
1107
|
-
if (!this._instance) {
|
|
1108
|
-
vnode.ce = (instance) => {
|
|
1109
|
-
this._instance = instance;
|
|
1110
|
-
instance.ce = this;
|
|
1111
|
-
instance.isCE = true;
|
|
1112
|
-
{
|
|
1113
|
-
instance.ceReload = (newStyles) => {
|
|
1114
|
-
if (this._styles) {
|
|
1115
|
-
this._styles.forEach((s) => this._root.removeChild(s));
|
|
1116
|
-
this._styles.length = 0;
|
|
1117
|
-
}
|
|
1118
|
-
this._styleAnchors.delete(this._def);
|
|
1119
|
-
this._applyStyles(newStyles);
|
|
1120
|
-
this._instance = null;
|
|
1121
|
-
this._update();
|
|
1122
|
-
};
|
|
1123
|
-
}
|
|
1124
|
-
const dispatch = (event, args) => {
|
|
1125
|
-
this.dispatchEvent(
|
|
1126
|
-
new CustomEvent(
|
|
1127
|
-
event,
|
|
1128
|
-
shared.isPlainObject(args[0]) ? shared.extend({ detail: args }, args[0]) : { detail: args }
|
|
1129
|
-
)
|
|
1130
|
-
);
|
|
1131
|
-
};
|
|
1132
|
-
instance.emit = (event, ...args) => {
|
|
1133
|
-
dispatch(event, args);
|
|
1134
|
-
if (shared.hyphenate(event) !== event) {
|
|
1135
|
-
dispatch(shared.hyphenate(event), args);
|
|
1136
|
-
}
|
|
1137
|
-
};
|
|
1138
|
-
this._setParent();
|
|
1139
|
-
};
|
|
1140
|
-
}
|
|
1141
|
-
return vnode;
|
|
1142
|
-
}
|
|
1143
|
-
_applyStyles(styles, owner, parentComp) {
|
|
1144
|
-
if (!styles) return;
|
|
1145
|
-
if (owner) {
|
|
1146
|
-
if (owner === this._def || this._styleChildren.has(owner)) {
|
|
1147
|
-
return;
|
|
1148
|
-
}
|
|
1149
|
-
this._styleChildren.add(owner);
|
|
1150
|
-
}
|
|
1151
|
-
const nonce = this._nonce;
|
|
1152
|
-
const root = this.shadowRoot;
|
|
1153
|
-
const insertionAnchor = parentComp ? this._getStyleAnchor(parentComp) || this._getStyleAnchor(this._def) : this._getRootStyleInsertionAnchor(root);
|
|
1154
|
-
let last = null;
|
|
1155
|
-
for (let i = styles.length - 1; i >= 0; i--) {
|
|
1156
|
-
const s = document.createElement("style");
|
|
1157
|
-
if (nonce) s.setAttribute("nonce", nonce);
|
|
1158
|
-
s.textContent = styles[i];
|
|
1159
|
-
root.insertBefore(s, last || insertionAnchor);
|
|
1160
|
-
last = s;
|
|
1161
|
-
if (i === 0) {
|
|
1162
|
-
if (!parentComp) this._styleAnchors.set(this._def, s);
|
|
1163
|
-
if (owner) this._styleAnchors.set(owner, s);
|
|
1164
|
-
}
|
|
1165
|
-
{
|
|
1166
|
-
if (owner) {
|
|
1167
|
-
if (owner.__hmrId) {
|
|
1168
|
-
if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
|
|
1169
|
-
let entry = this._childStyles.get(owner.__hmrId);
|
|
1170
|
-
if (!entry) {
|
|
1171
|
-
this._childStyles.set(owner.__hmrId, entry = []);
|
|
1172
|
-
}
|
|
1173
|
-
entry.push(s);
|
|
1174
|
-
}
|
|
1175
|
-
} else {
|
|
1176
|
-
(this._styles || (this._styles = [])).push(s);
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
_getStyleAnchor(comp) {
|
|
1182
|
-
if (!comp) {
|
|
1183
|
-
return null;
|
|
1184
|
-
}
|
|
1185
|
-
const anchor = this._styleAnchors.get(comp);
|
|
1186
|
-
if (anchor && anchor.parentNode === this.shadowRoot) {
|
|
1187
|
-
return anchor;
|
|
1188
|
-
}
|
|
1189
|
-
if (anchor) {
|
|
1190
|
-
this._styleAnchors.delete(comp);
|
|
1191
|
-
}
|
|
1192
|
-
return null;
|
|
1193
|
-
}
|
|
1194
|
-
_getRootStyleInsertionAnchor(root) {
|
|
1195
|
-
for (let i = 0; i < root.childNodes.length; i++) {
|
|
1196
|
-
const node = root.childNodes[i];
|
|
1197
|
-
if (!(node instanceof HTMLStyleElement)) {
|
|
1198
|
-
return node;
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
|
-
return null;
|
|
1202
|
-
}
|
|
1203
|
-
/**
|
|
1204
|
-
* Only called when shadowRoot is false
|
|
1205
|
-
*/
|
|
1206
|
-
_parseSlots() {
|
|
1207
|
-
const slots = this._slots = {};
|
|
1208
|
-
let n;
|
|
1209
|
-
while (n = this.firstChild) {
|
|
1210
|
-
const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
|
|
1211
|
-
(slots[slotName] || (slots[slotName] = [])).push(n);
|
|
1212
|
-
this.removeChild(n);
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
|
-
/**
|
|
1216
|
-
* Only called when shadowRoot is false
|
|
1217
|
-
*/
|
|
1218
|
-
_renderSlots() {
|
|
1219
|
-
const outlets = this._getSlots();
|
|
1220
|
-
const scopeId = this._instance.type.__scopeId;
|
|
1221
|
-
for (let i = 0; i < outlets.length; i++) {
|
|
1222
|
-
const o = outlets[i];
|
|
1223
|
-
const slotName = o.getAttribute("name") || "default";
|
|
1224
|
-
const content = this._slots[slotName];
|
|
1225
|
-
const parent = o.parentNode;
|
|
1226
|
-
if (content) {
|
|
1227
|
-
for (const n of content) {
|
|
1228
|
-
if (scopeId && n.nodeType === 1) {
|
|
1229
|
-
const id = scopeId + "-s";
|
|
1230
|
-
const walker = document.createTreeWalker(n, 1);
|
|
1231
|
-
n.setAttribute(id, "");
|
|
1232
|
-
let child;
|
|
1233
|
-
while (child = walker.nextNode()) {
|
|
1234
|
-
child.setAttribute(id, "");
|
|
1235
|
-
}
|
|
1236
|
-
}
|
|
1237
|
-
parent.insertBefore(n, o);
|
|
1238
|
-
}
|
|
1239
|
-
} else {
|
|
1240
|
-
while (o.firstChild) parent.insertBefore(o.firstChild, o);
|
|
1241
|
-
}
|
|
1242
|
-
parent.removeChild(o);
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
/**
|
|
1246
|
-
* @internal
|
|
1247
|
-
*/
|
|
1248
|
-
_getSlots() {
|
|
1249
|
-
const roots = [this];
|
|
1250
|
-
if (this._teleportTargets) {
|
|
1251
|
-
roots.push(...this._teleportTargets);
|
|
1252
|
-
}
|
|
1253
|
-
const slots = /* @__PURE__ */ new Set();
|
|
1254
|
-
for (const root of roots) {
|
|
1255
|
-
const found = root.querySelectorAll("slot");
|
|
1256
|
-
for (let i = 0; i < found.length; i++) {
|
|
1257
|
-
slots.add(found[i]);
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
return Array.from(slots);
|
|
1261
|
-
}
|
|
1262
|
-
/**
|
|
1263
|
-
* @internal
|
|
1264
|
-
*/
|
|
1265
|
-
_injectChildStyle(comp, parentComp) {
|
|
1266
|
-
this._applyStyles(comp.styles, comp, parentComp);
|
|
1267
|
-
}
|
|
1268
|
-
/**
|
|
1269
|
-
* @internal
|
|
1270
|
-
*/
|
|
1271
|
-
_beginPatch() {
|
|
1272
|
-
this._patching = true;
|
|
1273
|
-
this._dirty = false;
|
|
1274
|
-
}
|
|
1275
|
-
/**
|
|
1276
|
-
* @internal
|
|
1277
|
-
*/
|
|
1278
|
-
_endPatch() {
|
|
1279
|
-
this._patching = false;
|
|
1280
|
-
if (this._dirty && this._instance) {
|
|
1281
|
-
this._update();
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
/**
|
|
1285
|
-
* @internal
|
|
1286
|
-
*/
|
|
1287
|
-
_hasShadowRoot() {
|
|
1288
|
-
return this._def.shadowRoot !== false;
|
|
1289
|
-
}
|
|
1290
|
-
/**
|
|
1291
|
-
* @internal
|
|
1292
|
-
*/
|
|
1293
|
-
_removeChildStyle(comp) {
|
|
1294
|
-
{
|
|
1295
|
-
this._styleChildren.delete(comp);
|
|
1296
|
-
this._styleAnchors.delete(comp);
|
|
1297
|
-
if (this._childStyles && comp.__hmrId) {
|
|
1298
|
-
const oldStyles = this._childStyles.get(comp.__hmrId);
|
|
1299
|
-
if (oldStyles) {
|
|
1300
|
-
oldStyles.forEach((s) => this._root.removeChild(s));
|
|
1301
|
-
oldStyles.length = 0;
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
989
|
function useHost(caller) {
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
runtimeCore.warn(
|
|
1315
|
-
`${caller || "useHost"} called without an active component instance.`
|
|
1316
|
-
);
|
|
1317
|
-
} else {
|
|
1318
|
-
runtimeCore.warn(
|
|
1319
|
-
`${caller || "useHost"} can only be used in components defined via defineCustomElement.`
|
|
1320
|
-
);
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
return null;
|
|
990
|
+
const instance = (0, _vue_runtime_core.useInstanceInfo)();
|
|
991
|
+
const el = instance && instance.ce;
|
|
992
|
+
if (el) return el;
|
|
993
|
+
else if (!instance) (0, _vue_runtime_core.warn)(`${caller || "useHost"} called without an active component instance.`);
|
|
994
|
+
else (0, _vue_runtime_core.warn)(`${caller || "useHost"} can only be used in components defined via defineCustomElement.`);
|
|
995
|
+
return null;
|
|
1324
996
|
}
|
|
997
|
+
/**
|
|
998
|
+
* Retrieve the shadowRoot of the current custom element. Only usable in setup()
|
|
999
|
+
* of a `defineCustomElement` component.
|
|
1000
|
+
*/
|
|
1325
1001
|
function useShadowRoot() {
|
|
1326
|
-
|
|
1327
|
-
|
|
1002
|
+
const el = useHost("useShadowRoot");
|
|
1003
|
+
return el && el.shadowRoot;
|
|
1328
1004
|
}
|
|
1329
|
-
|
|
1005
|
+
//#endregion
|
|
1006
|
+
//#region packages/runtime-dom/src/helpers/useCssModule.ts
|
|
1330
1007
|
function useCssModule(name = "$style") {
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1008
|
+
{
|
|
1009
|
+
const instance = (0, _vue_runtime_core.useInstanceInfo)();
|
|
1010
|
+
if (!instance) {
|
|
1011
|
+
(0, _vue_runtime_core.warn)(`useCssModule must be called inside setup()`);
|
|
1012
|
+
return _vue_shared.EMPTY_OBJ;
|
|
1013
|
+
}
|
|
1014
|
+
const modules = instance.type.__cssModules;
|
|
1015
|
+
if (!modules) {
|
|
1016
|
+
(0, _vue_runtime_core.warn)(`Current instance does not have CSS modules injected.`);
|
|
1017
|
+
return _vue_shared.EMPTY_OBJ;
|
|
1018
|
+
}
|
|
1019
|
+
const mod = modules[name];
|
|
1020
|
+
if (!mod) {
|
|
1021
|
+
(0, _vue_runtime_core.warn)(`Current instance does not have CSS module named "${name}".`);
|
|
1022
|
+
return _vue_shared.EMPTY_OBJ;
|
|
1023
|
+
}
|
|
1024
|
+
return mod;
|
|
1025
|
+
}
|
|
1349
1026
|
}
|
|
1350
|
-
|
|
1027
|
+
//#endregion
|
|
1028
|
+
//#region packages/runtime-dom/src/components/TransitionGroup.ts
|
|
1351
1029
|
const positionMap = /* @__PURE__ */ new WeakMap();
|
|
1352
1030
|
const newPositionMap = /* @__PURE__ */ new WeakMap();
|
|
1353
|
-
const moveCbKey =
|
|
1354
|
-
const enterCbKey =
|
|
1031
|
+
const moveCbKey = Symbol("_moveCb");
|
|
1032
|
+
const enterCbKey = Symbol("_enterCb");
|
|
1355
1033
|
const pendingGroups = /* @__PURE__ */ new WeakMap();
|
|
1034
|
+
/**
|
|
1035
|
+
* Wrap logic that modifies TransitionGroup properties in a function
|
|
1036
|
+
* so that it can be annotated as pure
|
|
1037
|
+
*/
|
|
1356
1038
|
const decorate = (t) => {
|
|
1357
|
-
|
|
1358
|
-
|
|
1039
|
+
delete t.props.mode;
|
|
1040
|
+
return t;
|
|
1359
1041
|
};
|
|
1360
|
-
const TransitionGroupImpl =
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
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
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
}
|
|
1439
|
-
}
|
|
1440
|
-
}
|
|
1441
|
-
children = slots.default ? runtimeCore.getTransitionRawChildren(slots.default()) : [];
|
|
1442
|
-
for (let i = 0; i < children.length; i++) {
|
|
1443
|
-
const child = children[i];
|
|
1444
|
-
if (child.key != null) {
|
|
1445
|
-
runtimeCore.setTransitionHooks(
|
|
1446
|
-
child,
|
|
1447
|
-
runtimeCore.resolveTransitionHooks(child, cssTransitionProps, state, instance)
|
|
1448
|
-
);
|
|
1449
|
-
} else if (child.type !== runtimeCore.Text) {
|
|
1450
|
-
runtimeCore.warn(`<TransitionGroup> children must be keyed.`);
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
if (prevChildren.length) {
|
|
1454
|
-
origins = getOrigins(instance);
|
|
1455
|
-
pendingGroups.set(instance, willMove);
|
|
1456
|
-
}
|
|
1457
|
-
return runtimeCore.createVNode(tag, null, children);
|
|
1458
|
-
};
|
|
1459
|
-
}
|
|
1042
|
+
const TransitionGroupImpl = /*@__PURE__*/ decorate({
|
|
1043
|
+
name: "TransitionGroup",
|
|
1044
|
+
props: /*@__PURE__*/ (0, _vue_shared.extend)({}, TransitionPropsValidators, {
|
|
1045
|
+
tag: String,
|
|
1046
|
+
moveClass: String
|
|
1047
|
+
}),
|
|
1048
|
+
setup(props, { slots }) {
|
|
1049
|
+
const instance = (0, _vue_runtime_core.getCurrentInstance)();
|
|
1050
|
+
const state = (0, _vue_runtime_core.useTransitionState)();
|
|
1051
|
+
const group = {
|
|
1052
|
+
props: {},
|
|
1053
|
+
state,
|
|
1054
|
+
instance
|
|
1055
|
+
};
|
|
1056
|
+
let prevChildren;
|
|
1057
|
+
let children;
|
|
1058
|
+
let origins;
|
|
1059
|
+
let moves;
|
|
1060
|
+
const willMove = () => {
|
|
1061
|
+
if (moves === void 0) moves = prevChildren.length > 0 && hasCSSTransform(prevChildren[0].el, instance.vnode.el, resolveMoveClass(props));
|
|
1062
|
+
return moves;
|
|
1063
|
+
};
|
|
1064
|
+
(0, _vue_runtime_core.onUpdated)(() => {
|
|
1065
|
+
pendingGroups.delete(instance);
|
|
1066
|
+
if (!willMove()) {
|
|
1067
|
+
prevChildren = [];
|
|
1068
|
+
origins = void 0;
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1071
|
+
const moveClass = resolveMoveClass(props);
|
|
1072
|
+
prevChildren.forEach((vnode) => callPendingCbs(vnode.el));
|
|
1073
|
+
const shift = origins && getOriginShift(origins, instance.vnode.el);
|
|
1074
|
+
origins = void 0;
|
|
1075
|
+
prevChildren.forEach((c) => recordPosition(c, shift));
|
|
1076
|
+
const movedChildren = prevChildren.filter(applyTranslation);
|
|
1077
|
+
forceReflow(instance.vnode.el);
|
|
1078
|
+
movedChildren.forEach((c) => {
|
|
1079
|
+
const el = c.el;
|
|
1080
|
+
handleMovedChildren(el, moveClass);
|
|
1081
|
+
});
|
|
1082
|
+
prevChildren = [];
|
|
1083
|
+
});
|
|
1084
|
+
return () => {
|
|
1085
|
+
const rawProps = (0, _vue_runtime_core.toRaw)(props);
|
|
1086
|
+
const cssTransitionProps = group.props = resolveTransitionProps(rawProps);
|
|
1087
|
+
let tag = rawProps.tag || _vue_runtime_core.Fragment;
|
|
1088
|
+
prevChildren = [];
|
|
1089
|
+
moves = void 0;
|
|
1090
|
+
if (children) for (let i = 0; i < children.length; i++) {
|
|
1091
|
+
const child = children[i];
|
|
1092
|
+
if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
|
|
1093
|
+
prevChildren.push(child);
|
|
1094
|
+
(0, _vue_runtime_core.setTransitionHooks)(child, (0, _vue_runtime_core.resolveTransitionHooks)(child, cssTransitionProps, state, instance));
|
|
1095
|
+
positionMap.set(child, getPosition(child.el));
|
|
1096
|
+
} else if (_vue_runtime_core.isVaporInteropEnabled && child.vs && child.vb) instance.appContext.vapor.forEachGroupChild(child, (el) => {
|
|
1097
|
+
const row = { el };
|
|
1098
|
+
prevChildren.push(row);
|
|
1099
|
+
positionMap.set(row, getPosition(el));
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
children = slots.default ? (0, _vue_runtime_core.getTransitionRawChildren)(slots.default()) : [];
|
|
1103
|
+
for (let i = 0; i < children.length; i++) {
|
|
1104
|
+
const child = children[i];
|
|
1105
|
+
if (_vue_runtime_core.isVaporInteropEnabled && child.vs) child.vs.group = group;
|
|
1106
|
+
else if (child.key != null) (0, _vue_runtime_core.setTransitionHooks)(child, (0, _vue_runtime_core.resolveTransitionHooks)(child, cssTransitionProps, state, instance));
|
|
1107
|
+
else if (child.type !== _vue_runtime_core.Text) (0, _vue_runtime_core.warn)(`<TransitionGroup> children must be keyed.`);
|
|
1108
|
+
}
|
|
1109
|
+
if (prevChildren.length) {
|
|
1110
|
+
const root = instance.vnode.el;
|
|
1111
|
+
origins = getOrigins(instance, root);
|
|
1112
|
+
pendingGroups.set(instance, {
|
|
1113
|
+
root,
|
|
1114
|
+
willMove
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
return (0, _vue_runtime_core.createVNode)(tag, null, children);
|
|
1118
|
+
};
|
|
1119
|
+
}
|
|
1460
1120
|
});
|
|
1461
|
-
const TransitionGroup = TransitionGroupImpl;
|
|
1462
|
-
function callPendingCbs(
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
el[moveCbKey]();
|
|
1466
|
-
}
|
|
1467
|
-
if (el[enterCbKey]) {
|
|
1468
|
-
el[enterCbKey]();
|
|
1469
|
-
}
|
|
1121
|
+
const TransitionGroup = /*@__PURE__*/ (0, _vue_runtime_core.withTransitionEnabled)(TransitionGroupImpl);
|
|
1122
|
+
function callPendingCbs(el) {
|
|
1123
|
+
if (el[moveCbKey]) el[moveCbKey]();
|
|
1124
|
+
if (el[enterCbKey]) el[enterCbKey]();
|
|
1470
1125
|
}
|
|
1471
1126
|
function resolveMoveClass(props) {
|
|
1472
|
-
|
|
1127
|
+
return props.moveClass || `${props.name || "v"}-move`;
|
|
1473
1128
|
}
|
|
1474
1129
|
function recordPosition(c, shift) {
|
|
1475
|
-
|
|
1130
|
+
newPositionMap.set(c, getPosition(c.el, shift));
|
|
1476
1131
|
}
|
|
1477
1132
|
function applyTranslation(c) {
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1133
|
+
if (baseApplyTranslation(positionMap.get(c), newPositionMap.get(c), c.el)) return c;
|
|
1134
|
+
}
|
|
1135
|
+
function baseApplyTranslation(oldPos, newPos, el) {
|
|
1136
|
+
const dx = oldPos.left - newPos.left;
|
|
1137
|
+
const dy = oldPos.top - newPos.top;
|
|
1138
|
+
if (dx || dy) {
|
|
1139
|
+
const s = el.style;
|
|
1140
|
+
const rect = el.getBoundingClientRect();
|
|
1141
|
+
let scaleX = 1;
|
|
1142
|
+
let scaleY = 1;
|
|
1143
|
+
if (el.offsetWidth) scaleX = rect.width / el.offsetWidth;
|
|
1144
|
+
if (el.offsetHeight) scaleY = rect.height / el.offsetHeight;
|
|
1145
|
+
if (!Number.isFinite(scaleX) || scaleX === 0) scaleX = 1;
|
|
1146
|
+
if (!Number.isFinite(scaleY) || scaleY === 0) scaleY = 1;
|
|
1147
|
+
if (Math.abs(scaleX - 1) < .01) scaleX = 1;
|
|
1148
|
+
if (Math.abs(scaleY - 1) < .01) scaleY = 1;
|
|
1149
|
+
s.transform = s.webkitTransform = `translate(${dx / scaleX}px,${dy / scaleY}px)`;
|
|
1150
|
+
s.transitionDuration = "0s";
|
|
1151
|
+
return true;
|
|
1152
|
+
}
|
|
1153
|
+
return false;
|
|
1498
1154
|
}
|
|
1499
1155
|
function getPosition(el, shift) {
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1156
|
+
const rect = el.getBoundingClientRect();
|
|
1157
|
+
return {
|
|
1158
|
+
left: rect.left - (shift ? shift.left : 0),
|
|
1159
|
+
top: rect.top - (shift ? shift.top : 0)
|
|
1160
|
+
};
|
|
1505
1161
|
}
|
|
1506
|
-
function getOrigins(instance) {
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
return origins;
|
|
1162
|
+
function getOrigins(instance, root) {
|
|
1163
|
+
let origins;
|
|
1164
|
+
for (let group = instance.parent; group; group = group.parent) {
|
|
1165
|
+
const pending = pendingGroups.get(group);
|
|
1166
|
+
if (pending) {
|
|
1167
|
+
const item = findItem(pending.root, root);
|
|
1168
|
+
if (item) (origins || (origins = [])).push((0, _vue_shared.extend)(getPosition(item), {
|
|
1169
|
+
item,
|
|
1170
|
+
willMove: pending.willMove
|
|
1171
|
+
}));
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
return origins;
|
|
1520
1175
|
}
|
|
1521
1176
|
function findItem(root, node) {
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
}
|
|
1526
|
-
if (node && node.nodeType === 1) {
|
|
1527
|
-
return node;
|
|
1528
|
-
}
|
|
1177
|
+
const container = root.nodeType === 1 ? root : root.parentNode;
|
|
1178
|
+
while (node && node.parentNode !== container) node = node.parentNode;
|
|
1179
|
+
if (node && node.nodeType === 1) return node;
|
|
1529
1180
|
}
|
|
1530
1181
|
function getOriginShift(origins, root) {
|
|
1531
|
-
|
|
1532
|
-
|
|
1182
|
+
const origin = origins.find((o) => o.willMove() && o.item.contains(root));
|
|
1183
|
+
return origin && getPosition(origin.item, origin);
|
|
1533
1184
|
}
|
|
1534
1185
|
function hasCSSTransform(el, root, moveClass) {
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
container.removeChild(clone);
|
|
1548
|
-
return hasTransform;
|
|
1186
|
+
const clone = el.cloneNode();
|
|
1187
|
+
const _vtc = el[vtcKey];
|
|
1188
|
+
if (_vtc) _vtc.forEach((cls) => {
|
|
1189
|
+
cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
|
|
1190
|
+
});
|
|
1191
|
+
moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
|
|
1192
|
+
clone.style.display = "none";
|
|
1193
|
+
const container = root.nodeType === 1 ? root : root.parentNode;
|
|
1194
|
+
container.appendChild(clone);
|
|
1195
|
+
const { hasTransform } = getTransitionInfo(clone);
|
|
1196
|
+
container.removeChild(clone);
|
|
1197
|
+
return hasTransform;
|
|
1549
1198
|
}
|
|
1550
|
-
|
|
1199
|
+
const handleMovedChildren = (el, moveClass) => {
|
|
1200
|
+
const style = el.style;
|
|
1201
|
+
addTransitionClass(el, moveClass);
|
|
1202
|
+
style.transform = style.webkitTransform = style.transitionDuration = "";
|
|
1203
|
+
const cb = el[moveCbKey] = (e) => {
|
|
1204
|
+
if (e && e.target !== el) return;
|
|
1205
|
+
if (!e || e.propertyName.endsWith("transform")) {
|
|
1206
|
+
el.removeEventListener("transitionend", cb);
|
|
1207
|
+
el[moveCbKey] = null;
|
|
1208
|
+
removeTransitionClass(el, moveClass);
|
|
1209
|
+
}
|
|
1210
|
+
};
|
|
1211
|
+
el.addEventListener("transitionend", cb);
|
|
1212
|
+
};
|
|
1213
|
+
//#endregion
|
|
1214
|
+
//#region packages/runtime-dom/src/directives/vModel.ts
|
|
1551
1215
|
const getModelAssigner = (vnode) => {
|
|
1552
|
-
|
|
1553
|
-
|
|
1216
|
+
const fn = vnode.props["onUpdate:modelValue"] || false;
|
|
1217
|
+
return (0, _vue_shared.isArray)(fn) ? (value) => (0, _vue_shared.invokeArrayFns)(fn, value) : fn;
|
|
1554
1218
|
};
|
|
1555
1219
|
function onCompositionStart(e) {
|
|
1556
|
-
|
|
1220
|
+
e.target.composing = true;
|
|
1557
1221
|
}
|
|
1558
1222
|
function onCompositionEnd(e) {
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1223
|
+
const target = e.target;
|
|
1224
|
+
if (target.composing) {
|
|
1225
|
+
target.composing = false;
|
|
1226
|
+
target.dispatchEvent(new Event("input"));
|
|
1227
|
+
}
|
|
1564
1228
|
}
|
|
1565
|
-
const assignKey =
|
|
1566
|
-
const initialValueKey =
|
|
1229
|
+
const assignKey = Symbol("_assign");
|
|
1230
|
+
const initialValueKey = Symbol("_initialValue");
|
|
1231
|
+
const vModelText = {
|
|
1232
|
+
created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
|
1233
|
+
if (el.parentNode) {
|
|
1234
|
+
if (el.type === "text") el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
|
|
1235
|
+
else if (el.type === "textarea") el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
|
|
1236
|
+
}
|
|
1237
|
+
el[assignKey] = getModelAssigner(vnode);
|
|
1238
|
+
vModelTextInit(el, trim, number || !!(vnode.props && vnode.props.type === "number"), lazy);
|
|
1239
|
+
},
|
|
1240
|
+
mounted(el, { value, modifiers: { trim, number } }) {
|
|
1241
|
+
const newValue = value == null ? "" : value;
|
|
1242
|
+
const initialValue = el[initialValueKey];
|
|
1243
|
+
delete el[initialValueKey];
|
|
1244
|
+
if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) el[assignKey](castValue(el.value, trim, number));
|
|
1245
|
+
else el.value = newValue;
|
|
1246
|
+
},
|
|
1247
|
+
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
|
|
1248
|
+
el[assignKey] = getModelAssigner(vnode);
|
|
1249
|
+
vModelTextUpdate(el, oldValue, value, trim, number, lazy);
|
|
1250
|
+
}
|
|
1251
|
+
};
|
|
1567
1252
|
function castValue(value, trim, number) {
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1253
|
+
if (trim) value = value.trim();
|
|
1254
|
+
if (number) value = (0, _vue_shared.looseToNumber)(value);
|
|
1255
|
+
return value;
|
|
1571
1256
|
}
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
|
|
1604
|
-
el[assignKey](castValue(el.value, trim, number));
|
|
1605
|
-
} else {
|
|
1606
|
-
el.value = newValue;
|
|
1607
|
-
}
|
|
1608
|
-
},
|
|
1609
|
-
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
|
|
1610
|
-
el[assignKey] = getModelAssigner(vnode);
|
|
1611
|
-
if (el.composing) return;
|
|
1612
|
-
const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? shared.looseToNumber(el.value) : el.value;
|
|
1613
|
-
const newValue = value == null ? "" : value;
|
|
1614
|
-
if (elValue === newValue) {
|
|
1615
|
-
return;
|
|
1616
|
-
}
|
|
1617
|
-
const rootNode = el.getRootNode();
|
|
1618
|
-
if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement === el && el.type !== "range") {
|
|
1619
|
-
if (lazy && value === oldValue) {
|
|
1620
|
-
return;
|
|
1621
|
-
}
|
|
1622
|
-
if (trim && el.value.trim() === newValue) {
|
|
1623
|
-
return;
|
|
1624
|
-
}
|
|
1625
|
-
}
|
|
1626
|
-
el.value = newValue;
|
|
1627
|
-
}
|
|
1257
|
+
/**
|
|
1258
|
+
* @internal
|
|
1259
|
+
*/
|
|
1260
|
+
const vModelTextInit = (el, trim, number, lazy, set) => {
|
|
1261
|
+
addEventListener(el, lazy ? "change" : "input", (e) => {
|
|
1262
|
+
if (e.target.composing) return;
|
|
1263
|
+
(set || el[assignKey])(castValue(el.value, trim, number || el.type === "number"));
|
|
1264
|
+
});
|
|
1265
|
+
if (trim || number || el.type === "number") addEventListener(el, "change", () => {
|
|
1266
|
+
el.value = castValue(el.value, trim, number || el.type === "number");
|
|
1267
|
+
});
|
|
1268
|
+
if (!lazy) {
|
|
1269
|
+
addEventListener(el, "compositionstart", onCompositionStart);
|
|
1270
|
+
addEventListener(el, "compositionend", onCompositionEnd);
|
|
1271
|
+
addEventListener(el, "change", onCompositionEnd);
|
|
1272
|
+
}
|
|
1273
|
+
};
|
|
1274
|
+
/**
|
|
1275
|
+
* @internal
|
|
1276
|
+
*/
|
|
1277
|
+
const vModelTextUpdate = (el, oldValue, value, trim, number, lazy) => {
|
|
1278
|
+
if (el.composing) return;
|
|
1279
|
+
const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? (0, _vue_shared.looseToNumber)(el.value) : el.value;
|
|
1280
|
+
const newValue = value == null ? "" : value;
|
|
1281
|
+
if (elValue === newValue) return;
|
|
1282
|
+
const rootNode = el.getRootNode();
|
|
1283
|
+
if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement === el && el.type !== "range") {
|
|
1284
|
+
if (lazy && value === oldValue) return;
|
|
1285
|
+
if (trim && el.value.trim() === newValue) return;
|
|
1286
|
+
}
|
|
1287
|
+
el.value = newValue;
|
|
1628
1288
|
};
|
|
1629
1289
|
const vModelCheckbox = {
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1290
|
+
deep: true,
|
|
1291
|
+
created(el, _, vnode) {
|
|
1292
|
+
el[assignKey] = getModelAssigner(vnode);
|
|
1293
|
+
vModelCheckboxInit(el);
|
|
1294
|
+
},
|
|
1295
|
+
mounted(el, binding, vnode) {
|
|
1296
|
+
vModelCheckboxUpdate(el, binding.oldValue, binding.value, vnode.props.value);
|
|
1297
|
+
},
|
|
1298
|
+
beforeUpdate(el, binding, vnode) {
|
|
1299
|
+
el[assignKey] = getModelAssigner(vnode);
|
|
1300
|
+
vModelCheckboxUpdate(el, binding.oldValue, binding.value, vnode.props.value);
|
|
1301
|
+
}
|
|
1302
|
+
};
|
|
1303
|
+
/**
|
|
1304
|
+
* @internal
|
|
1305
|
+
*/
|
|
1306
|
+
const vModelCheckboxInit = (el, set) => {
|
|
1307
|
+
addEventListener(el, "change", () => {
|
|
1308
|
+
const assign = set || el[assignKey];
|
|
1309
|
+
const modelValue = el._modelValue;
|
|
1310
|
+
const elementValue = getValue(el);
|
|
1311
|
+
const checked = el.checked;
|
|
1312
|
+
if ((0, _vue_shared.isArray)(modelValue)) {
|
|
1313
|
+
const index = (0, _vue_shared.looseIndexOf)(modelValue, elementValue);
|
|
1314
|
+
const found = index !== -1;
|
|
1315
|
+
if (checked && !found) assign(modelValue.concat(elementValue));
|
|
1316
|
+
else if (!checked && found) {
|
|
1317
|
+
const filtered = [...modelValue];
|
|
1318
|
+
filtered.splice(index, 1);
|
|
1319
|
+
assign(filtered);
|
|
1320
|
+
}
|
|
1321
|
+
} else if ((0, _vue_shared.isSet)(modelValue)) {
|
|
1322
|
+
const cloned = new Set(modelValue);
|
|
1323
|
+
if (checked) cloned.add(elementValue);
|
|
1324
|
+
else cloned.delete(elementValue);
|
|
1325
|
+
assign(cloned);
|
|
1326
|
+
} else assign(getCheckboxValue(el, checked));
|
|
1327
|
+
});
|
|
1328
|
+
};
|
|
1329
|
+
/**
|
|
1330
|
+
* @internal
|
|
1331
|
+
*/
|
|
1332
|
+
const vModelCheckboxUpdate = (el, oldValue, value, rawValue = getValue(el)) => {
|
|
1333
|
+
el._modelValue = value;
|
|
1334
|
+
let checked;
|
|
1335
|
+
if ((0, _vue_shared.isArray)(value)) checked = (0, _vue_shared.looseIndexOf)(value, rawValue) > -1;
|
|
1336
|
+
else if ((0, _vue_shared.isSet)(value)) checked = value.has(rawValue);
|
|
1337
|
+
else {
|
|
1338
|
+
if (value === oldValue) return;
|
|
1339
|
+
checked = (0, _vue_shared.looseEqual)(value, getCheckboxValue(el, true));
|
|
1340
|
+
}
|
|
1341
|
+
if (el.checked !== checked) el.checked = checked;
|
|
1668
1342
|
};
|
|
1669
|
-
function setChecked(el, { value, oldValue }, vnode) {
|
|
1670
|
-
el._modelValue = value;
|
|
1671
|
-
let checked;
|
|
1672
|
-
if (shared.isArray(value)) {
|
|
1673
|
-
checked = shared.looseIndexOf(value, vnode.props.value) > -1;
|
|
1674
|
-
} else if (shared.isSet(value)) {
|
|
1675
|
-
checked = value.has(vnode.props.value);
|
|
1676
|
-
} else {
|
|
1677
|
-
if (value === oldValue) return;
|
|
1678
|
-
checked = shared.looseEqual(value, getCheckboxValue(el, true));
|
|
1679
|
-
}
|
|
1680
|
-
if (el.checked !== checked) {
|
|
1681
|
-
el.checked = checked;
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
1343
|
const vModelRadio = {
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1344
|
+
created(el, { value }, vnode) {
|
|
1345
|
+
el.checked = (0, _vue_shared.looseEqual)(value, vnode.props.value);
|
|
1346
|
+
el[assignKey] = getModelAssigner(vnode);
|
|
1347
|
+
addEventListener(el, "change", () => {
|
|
1348
|
+
el[assignKey](getValue(el));
|
|
1349
|
+
});
|
|
1350
|
+
},
|
|
1351
|
+
beforeUpdate(el, { value, oldValue }, vnode) {
|
|
1352
|
+
el[assignKey] = getModelAssigner(vnode);
|
|
1353
|
+
if (value !== oldValue) el.checked = (0, _vue_shared.looseEqual)(value, vnode.props.value);
|
|
1354
|
+
}
|
|
1698
1355
|
};
|
|
1699
1356
|
const vModelSelect = {
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
},
|
|
1735
|
-
updated(el, { value, modifiers: { number } }) {
|
|
1736
|
-
const pending = el._pendingValue;
|
|
1737
|
-
el._pendingValue = void 0;
|
|
1738
|
-
if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
|
|
1739
|
-
setSelected(el, value, number);
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1357
|
+
deep: true,
|
|
1358
|
+
created(el, { value, modifiers: { number } }, vnode) {
|
|
1359
|
+
vModelSelectInit(el, value, number);
|
|
1360
|
+
el[assignKey] = getModelAssigner(vnode);
|
|
1361
|
+
},
|
|
1362
|
+
mounted(el, { value, modifiers: { number } }) {
|
|
1363
|
+
vModelSetSelected(el, value, number);
|
|
1364
|
+
},
|
|
1365
|
+
beforeUpdate(el, { value }, vnode) {
|
|
1366
|
+
el._modelValue = value;
|
|
1367
|
+
el[assignKey] = getModelAssigner(vnode);
|
|
1368
|
+
},
|
|
1369
|
+
updated(el, { value, modifiers: { number } }) {
|
|
1370
|
+
vModelSetSelected(el, value, number);
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
/**
|
|
1374
|
+
* @internal
|
|
1375
|
+
*/
|
|
1376
|
+
const vModelSelectInit = (el, value, number, set) => {
|
|
1377
|
+
el._modelValue = value;
|
|
1378
|
+
addEventListener(el, "change", () => {
|
|
1379
|
+
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map((o) => number ? (0, _vue_shared.looseToNumber)(getValue(o)) : getValue(o));
|
|
1380
|
+
const multiple = el.multiple;
|
|
1381
|
+
const assignedValue = multiple ? (0, _vue_shared.isSet)(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
|
|
1382
|
+
const pending = el._pendingValue = [multiple, multiple ? (0, _vue_shared.isArray)(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue];
|
|
1383
|
+
try {
|
|
1384
|
+
(set || el[assignKey])(assignedValue);
|
|
1385
|
+
} finally {
|
|
1386
|
+
(0, _vue_runtime_core.nextTick)(() => {
|
|
1387
|
+
if (el._pendingValue === pending) el._pendingValue = void 0;
|
|
1388
|
+
});
|
|
1389
|
+
}
|
|
1390
|
+
});
|
|
1742
1391
|
};
|
|
1743
1392
|
function isSameSelectValue(value, assignedValue, multiple) {
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
}
|
|
1753
|
-
return false;
|
|
1393
|
+
if (!multiple) return (0, _vue_shared.looseEqual)(value, assignedValue);
|
|
1394
|
+
if ((0, _vue_shared.isArray)(value)) return (0, _vue_shared.looseEqual)(value, assignedValue);
|
|
1395
|
+
if ((0, _vue_shared.isSet)(value)) {
|
|
1396
|
+
if (value.size !== assignedValue.length) return false;
|
|
1397
|
+
for (const item of assignedValue) if (!value.has(item)) return false;
|
|
1398
|
+
return true;
|
|
1399
|
+
}
|
|
1400
|
+
return false;
|
|
1754
1401
|
}
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1402
|
+
/**
|
|
1403
|
+
* @internal
|
|
1404
|
+
*/
|
|
1405
|
+
const vModelSetSelected = (el, value, number = false) => {
|
|
1406
|
+
el._modelValue = value;
|
|
1407
|
+
const pending = el._pendingValue;
|
|
1408
|
+
el._pendingValue = void 0;
|
|
1409
|
+
if (pending && pending[0] === el.multiple && isSameSelectValue(value, pending[1], pending[0])) return;
|
|
1410
|
+
setSelected(el, value, number);
|
|
1411
|
+
};
|
|
1412
|
+
function setSelected(el, value, number) {
|
|
1413
|
+
const isMultiple = el.multiple;
|
|
1414
|
+
const isArrayValue = (0, _vue_shared.isArray)(value);
|
|
1415
|
+
if (isMultiple && !isArrayValue && !(0, _vue_shared.isSet)(value)) {
|
|
1416
|
+
(0, _vue_runtime_core.warn)(`<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`);
|
|
1417
|
+
return;
|
|
1418
|
+
}
|
|
1419
|
+
for (let i = 0, l = el.options.length; i < l; i++) {
|
|
1420
|
+
const option = el.options[i];
|
|
1421
|
+
const optionValue = getValue(option);
|
|
1422
|
+
if (isMultiple) {
|
|
1423
|
+
if (isArrayValue) {
|
|
1424
|
+
const optionType = typeof optionValue;
|
|
1425
|
+
if (optionType === "string" || optionType === "number") option.selected = value.some((v) => String(v) === String(optionValue));
|
|
1426
|
+
else option.selected = (0, _vue_shared.looseIndexOf)(value, optionValue) > -1;
|
|
1427
|
+
} else option.selected = value.has(optionValue) || number && typeof optionValue === "string" && value.has((0, _vue_shared.looseToNumber)(optionValue));
|
|
1428
|
+
} else if ((0, _vue_shared.looseEqual)(getValue(option), value)) {
|
|
1429
|
+
if (el.selectedIndex !== i) el.selectedIndex = i;
|
|
1430
|
+
return;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
if (!isMultiple && el.selectedIndex !== -1) el.selectedIndex = -1;
|
|
1786
1434
|
}
|
|
1435
|
+
/**
|
|
1436
|
+
* @internal retrieve raw value set via :value bindings
|
|
1437
|
+
*/
|
|
1787
1438
|
function getValue(el) {
|
|
1788
|
-
|
|
1439
|
+
return "_value" in el ? el._value : el.value;
|
|
1789
1440
|
}
|
|
1790
1441
|
function getCheckboxValue(el, checked) {
|
|
1791
|
-
|
|
1792
|
-
|
|
1442
|
+
const key = checked ? "_trueValue" : "_falseValue";
|
|
1443
|
+
if (key in el) return el[key];
|
|
1444
|
+
const attr = checked ? "true-value" : "false-value";
|
|
1445
|
+
if (el.hasAttribute(attr)) return el.getAttribute(attr);
|
|
1446
|
+
return checked;
|
|
1793
1447
|
}
|
|
1794
1448
|
const vModelDynamic = {
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1449
|
+
created(el, binding, vnode) {
|
|
1450
|
+
callModelHook(el, binding, vnode, null, "created");
|
|
1451
|
+
},
|
|
1452
|
+
mounted(el, binding, vnode) {
|
|
1453
|
+
callModelHook(el, binding, vnode, null, "mounted");
|
|
1454
|
+
},
|
|
1455
|
+
beforeUpdate(el, binding, vnode, prevVNode) {
|
|
1456
|
+
callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
|
|
1457
|
+
},
|
|
1458
|
+
updated(el, binding, vnode, prevVNode) {
|
|
1459
|
+
callModelHook(el, binding, vnode, prevVNode, "updated");
|
|
1460
|
+
}
|
|
1807
1461
|
};
|
|
1808
1462
|
function resolveDynamicModel(tagName, type) {
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
case "radio":
|
|
1819
|
-
return vModelRadio;
|
|
1820
|
-
default:
|
|
1821
|
-
return vModelText;
|
|
1822
|
-
}
|
|
1823
|
-
}
|
|
1463
|
+
switch (tagName) {
|
|
1464
|
+
case "SELECT": return vModelSelect;
|
|
1465
|
+
case "TEXTAREA": return vModelText;
|
|
1466
|
+
default: switch (type) {
|
|
1467
|
+
case "checkbox": return vModelCheckbox;
|
|
1468
|
+
case "radio": return vModelRadio;
|
|
1469
|
+
default: return vModelText;
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1824
1472
|
}
|
|
1825
1473
|
function callModelHook(el, binding, vnode, prevVNode, hook) {
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
vnode.props && vnode.props.type
|
|
1829
|
-
);
|
|
1830
|
-
const fn = modelToUse[hook];
|
|
1831
|
-
fn && fn(el, binding, vnode, prevVNode);
|
|
1474
|
+
const fn = resolveDynamicModel(el.tagName, vnode.props && vnode.props.type)[hook];
|
|
1475
|
+
fn && fn(el, binding, vnode, prevVNode);
|
|
1832
1476
|
}
|
|
1833
1477
|
function initVModelForSSR() {
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
return { checked: true };
|
|
1851
|
-
}
|
|
1852
|
-
};
|
|
1853
|
-
vModelDynamic.getSSRProps = (binding, vnode) => {
|
|
1854
|
-
if (typeof vnode.type !== "string") {
|
|
1855
|
-
return;
|
|
1856
|
-
}
|
|
1857
|
-
const modelToUse = resolveDynamicModel(
|
|
1858
|
-
// resolveDynamicModel expects an uppercase tag name, but vnode.type is lowercase
|
|
1859
|
-
vnode.type.toUpperCase(),
|
|
1860
|
-
vnode.props && vnode.props.type
|
|
1861
|
-
);
|
|
1862
|
-
if (modelToUse.getSSRProps) {
|
|
1863
|
-
return modelToUse.getSSRProps(binding, vnode);
|
|
1864
|
-
}
|
|
1865
|
-
};
|
|
1478
|
+
vModelText.getSSRProps = ({ value }) => ({ value });
|
|
1479
|
+
vModelRadio.getSSRProps = ({ value }, vnode) => {
|
|
1480
|
+
if (vnode.props && (0, _vue_shared.looseEqual)(vnode.props.value, value)) return { checked: true };
|
|
1481
|
+
};
|
|
1482
|
+
vModelCheckbox.getSSRProps = ({ value }, vnode) => {
|
|
1483
|
+
if ((0, _vue_shared.isArray)(value)) {
|
|
1484
|
+
if (vnode.props && (0, _vue_shared.looseIndexOf)(value, vnode.props.value) > -1) return { checked: true };
|
|
1485
|
+
} else if ((0, _vue_shared.isSet)(value)) {
|
|
1486
|
+
if (vnode.props && value.has(vnode.props.value)) return { checked: true };
|
|
1487
|
+
} else if (value) return { checked: true };
|
|
1488
|
+
};
|
|
1489
|
+
vModelDynamic.getSSRProps = (binding, vnode) => {
|
|
1490
|
+
if (typeof vnode.type !== "string") return;
|
|
1491
|
+
const modelToUse = resolveDynamicModel(vnode.type.toUpperCase(), vnode.props && vnode.props.type);
|
|
1492
|
+
if (modelToUse.getSSRProps) return modelToUse.getSSRProps(binding, vnode);
|
|
1493
|
+
};
|
|
1866
1494
|
}
|
|
1867
|
-
|
|
1868
|
-
|
|
1495
|
+
//#endregion
|
|
1496
|
+
//#region packages/runtime-dom/src/directives/vOn.ts
|
|
1497
|
+
const systemModifiers = [
|
|
1498
|
+
"ctrl",
|
|
1499
|
+
"shift",
|
|
1500
|
+
"alt",
|
|
1501
|
+
"meta"
|
|
1502
|
+
];
|
|
1869
1503
|
const modifierGuards = {
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1504
|
+
stop: (e) => e.stopPropagation(),
|
|
1505
|
+
prevent: (e) => e.preventDefault(),
|
|
1506
|
+
self: (e) => e.target !== e.currentTarget,
|
|
1507
|
+
ctrl: (e) => !e.ctrlKey,
|
|
1508
|
+
shift: (e) => !e.shiftKey,
|
|
1509
|
+
alt: (e) => !e.altKey,
|
|
1510
|
+
meta: (e) => !e.metaKey,
|
|
1511
|
+
left: (e) => "button" in e && e.button !== 0,
|
|
1512
|
+
middle: (e) => "button" in e && e.button !== 1,
|
|
1513
|
+
right: (e) => "button" in e && e.button !== 2,
|
|
1514
|
+
exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
|
|
1881
1515
|
};
|
|
1516
|
+
/**
|
|
1517
|
+
* @private
|
|
1518
|
+
*/
|
|
1882
1519
|
const withModifiers = (fn, modifiers) => {
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1520
|
+
if (!fn) return fn;
|
|
1521
|
+
const cache = fn._withMods || (fn._withMods = {});
|
|
1522
|
+
const cacheKey = modifiers.join(".");
|
|
1523
|
+
return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
|
|
1524
|
+
for (let i = 0; i < modifiers.length; i++) {
|
|
1525
|
+
const guard = modifierGuards[modifiers[i]];
|
|
1526
|
+
if (guard && guard(event, modifiers)) return;
|
|
1527
|
+
}
|
|
1528
|
+
return fn(event, ...args);
|
|
1529
|
+
}));
|
|
1893
1530
|
};
|
|
1894
1531
|
const keyNames = {
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1532
|
+
esc: "escape",
|
|
1533
|
+
space: " ",
|
|
1534
|
+
up: "arrow-up",
|
|
1535
|
+
left: "arrow-left",
|
|
1536
|
+
right: "arrow-right",
|
|
1537
|
+
down: "arrow-down",
|
|
1538
|
+
delete: "backspace"
|
|
1902
1539
|
};
|
|
1540
|
+
/**
|
|
1541
|
+
* @private
|
|
1542
|
+
*/
|
|
1903
1543
|
const withKeys = (fn, modifiers) => {
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
if (modifiers.some(
|
|
1912
|
-
(k) => k === eventKey || keyNames[k] === eventKey
|
|
1913
|
-
)) {
|
|
1914
|
-
return fn(event);
|
|
1915
|
-
}
|
|
1916
|
-
}));
|
|
1544
|
+
const cache = fn._withKeys || (fn._withKeys = {});
|
|
1545
|
+
const cacheKey = modifiers.join(".");
|
|
1546
|
+
return cache[cacheKey] || (cache[cacheKey] = ((event) => {
|
|
1547
|
+
if (!("key" in event)) return;
|
|
1548
|
+
const eventKey = (0, _vue_shared.hyphenate)(event.key);
|
|
1549
|
+
if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) return fn(event);
|
|
1550
|
+
}));
|
|
1917
1551
|
};
|
|
1918
|
-
|
|
1919
|
-
|
|
1552
|
+
//#endregion
|
|
1553
|
+
//#region packages/runtime-dom/src/index.ts
|
|
1554
|
+
const rendererOptions = /*@__PURE__*/ (0, _vue_shared.extend)({ patchProp }, nodeOps);
|
|
1920
1555
|
let renderer;
|
|
1921
1556
|
let enabledHydration = false;
|
|
1922
1557
|
function ensureRenderer() {
|
|
1923
|
-
|
|
1558
|
+
return renderer || (renderer = (0, _vue_runtime_core.createRenderer)(rendererOptions));
|
|
1924
1559
|
}
|
|
1925
1560
|
function ensureHydrationRenderer() {
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1561
|
+
renderer = enabledHydration ? renderer : (0, _vue_runtime_core.createHydrationRenderer)(rendererOptions);
|
|
1562
|
+
enabledHydration = true;
|
|
1563
|
+
return renderer;
|
|
1929
1564
|
}
|
|
1930
1565
|
const render = ((...args) => {
|
|
1931
|
-
|
|
1566
|
+
ensureRenderer().render(...args);
|
|
1932
1567
|
});
|
|
1933
1568
|
const hydrate = ((...args) => {
|
|
1934
|
-
|
|
1569
|
+
ensureHydrationRenderer().hydrate(...args);
|
|
1935
1570
|
});
|
|
1936
1571
|
const createApp = ((...args) => {
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
container.removeAttribute("v-cloak");
|
|
1956
|
-
container.setAttribute("data-v-app", "");
|
|
1957
|
-
}
|
|
1958
|
-
return proxy;
|
|
1959
|
-
};
|
|
1960
|
-
return app;
|
|
1572
|
+
const app = ensureRenderer().createApp(...args);
|
|
1573
|
+
injectNativeTagCheck(app);
|
|
1574
|
+
injectCompilerOptionsCheck(app);
|
|
1575
|
+
const { mount } = app;
|
|
1576
|
+
app.mount = (containerOrSelector) => {
|
|
1577
|
+
const container = normalizeContainer(containerOrSelector);
|
|
1578
|
+
if (!container) return;
|
|
1579
|
+
const component = app._component;
|
|
1580
|
+
if (!(0, _vue_shared.isFunction)(component) && !component.render && !component.template) component.template = container.innerHTML;
|
|
1581
|
+
if (container.nodeType === 1) container.textContent = "";
|
|
1582
|
+
const proxy = mount(container, false, resolveRootNamespace(container));
|
|
1583
|
+
if (container instanceof Element) {
|
|
1584
|
+
container.removeAttribute("v-cloak");
|
|
1585
|
+
container.setAttribute("data-v-app", "");
|
|
1586
|
+
}
|
|
1587
|
+
return proxy;
|
|
1588
|
+
};
|
|
1589
|
+
return app;
|
|
1961
1590
|
});
|
|
1962
1591
|
const createSSRApp = ((...args) => {
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
}
|
|
1974
|
-
};
|
|
1975
|
-
return app;
|
|
1592
|
+
(0, _vue_runtime_core.setIsHydratingEnabled)(true);
|
|
1593
|
+
const app = ensureHydrationRenderer().createApp(...args);
|
|
1594
|
+
injectNativeTagCheck(app);
|
|
1595
|
+
injectCompilerOptionsCheck(app);
|
|
1596
|
+
const { mount } = app;
|
|
1597
|
+
app.mount = (containerOrSelector) => {
|
|
1598
|
+
const container = normalizeContainer(containerOrSelector);
|
|
1599
|
+
if (container) return mount(container, true, resolveRootNamespace(container));
|
|
1600
|
+
};
|
|
1601
|
+
return app;
|
|
1976
1602
|
});
|
|
1977
1603
|
function resolveRootNamespace(container) {
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
}
|
|
1981
|
-
if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
|
|
1982
|
-
return "mathml";
|
|
1983
|
-
}
|
|
1604
|
+
if (container instanceof SVGElement) return "svg";
|
|
1605
|
+
if (typeof MathMLElement === "function" && container instanceof MathMLElement) return "mathml";
|
|
1984
1606
|
}
|
|
1985
1607
|
function injectNativeTagCheck(app) {
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1608
|
+
Object.defineProperty(app.config, "isNativeTag", {
|
|
1609
|
+
value: (tag) => (0, _vue_shared.isHTMLTag)(tag) || (0, _vue_shared.isSVGTag)(tag) || (0, _vue_shared.isMathMLTag)(tag),
|
|
1610
|
+
writable: false
|
|
1611
|
+
});
|
|
1990
1612
|
}
|
|
1991
1613
|
function injectCompilerOptionsCheck(app) {
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
set() {
|
|
2015
|
-
runtimeCore.warn(msg);
|
|
2016
|
-
}
|
|
2017
|
-
});
|
|
2018
|
-
}
|
|
1614
|
+
if ((0, _vue_runtime_core.isRuntimeOnly)()) {
|
|
1615
|
+
const isCustomElement = app.config.isCustomElement;
|
|
1616
|
+
Object.defineProperty(app.config, "isCustomElement", {
|
|
1617
|
+
get() {
|
|
1618
|
+
return isCustomElement;
|
|
1619
|
+
},
|
|
1620
|
+
set() {
|
|
1621
|
+
(0, _vue_runtime_core.warn)("The `isCustomElement` config option is deprecated. Use `compilerOptions.isCustomElement` instead.");
|
|
1622
|
+
}
|
|
1623
|
+
});
|
|
1624
|
+
const compilerOptions = app.config.compilerOptions;
|
|
1625
|
+
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.\n- For vue-loader: pass it via vue-loader's `compilerOptions` loader option.\n- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader\n- For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-sfc";
|
|
1626
|
+
Object.defineProperty(app.config, "compilerOptions", {
|
|
1627
|
+
get() {
|
|
1628
|
+
(0, _vue_runtime_core.warn)(msg);
|
|
1629
|
+
return compilerOptions;
|
|
1630
|
+
},
|
|
1631
|
+
set() {
|
|
1632
|
+
(0, _vue_runtime_core.warn)(msg);
|
|
1633
|
+
}
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
2019
1636
|
}
|
|
1637
|
+
/**
|
|
1638
|
+
* @internal
|
|
1639
|
+
*/
|
|
2020
1640
|
function normalizeContainer(container) {
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
return res;
|
|
2029
|
-
}
|
|
2030
|
-
if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
|
|
2031
|
-
runtimeCore.warn(
|
|
2032
|
-
`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
|
|
2033
|
-
);
|
|
2034
|
-
}
|
|
2035
|
-
return container;
|
|
1641
|
+
if ((0, _vue_shared.isString)(container)) {
|
|
1642
|
+
const res = document.querySelector(container);
|
|
1643
|
+
if (!res) (0, _vue_runtime_core.warn)(`Failed to mount app: mount target selector "${container}" returned null.`);
|
|
1644
|
+
return res;
|
|
1645
|
+
}
|
|
1646
|
+
if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") (0, _vue_runtime_core.warn)(`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`);
|
|
1647
|
+
return container;
|
|
2036
1648
|
}
|
|
2037
1649
|
let ssrDirectiveInitialized = false;
|
|
1650
|
+
/**
|
|
1651
|
+
* @internal
|
|
1652
|
+
*/
|
|
2038
1653
|
const initDirectivesForSSR = () => {
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
}
|
|
2045
|
-
|
|
1654
|
+
if (!ssrDirectiveInitialized) {
|
|
1655
|
+
ssrDirectiveInitialized = true;
|
|
1656
|
+
initVModelForSSR();
|
|
1657
|
+
initVShowForSSR();
|
|
1658
|
+
}
|
|
1659
|
+
};
|
|
1660
|
+
//#endregion
|
|
2046
1661
|
exports.Transition = Transition;
|
|
2047
1662
|
exports.TransitionGroup = TransitionGroup;
|
|
2048
1663
|
exports.VueElement = VueElement;
|
|
1664
|
+
exports.VueElementBase = VueElementBase;
|
|
2049
1665
|
exports.createApp = createApp;
|
|
2050
1666
|
exports.createSSRApp = createSSRApp;
|
|
2051
1667
|
exports.defineCustomElement = defineCustomElement;
|
|
@@ -2068,6 +1684,11 @@ exports.vModelText = vModelText;
|
|
|
2068
1684
|
exports.vShow = vShow;
|
|
2069
1685
|
exports.withKeys = withKeys;
|
|
2070
1686
|
exports.withModifiers = withModifiers;
|
|
2071
|
-
Object.keys(
|
|
2072
|
-
|
|
1687
|
+
Object.keys(_vue_runtime_core).forEach(function(k) {
|
|
1688
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
1689
|
+
enumerable: true,
|
|
1690
|
+
get: function() {
|
|
1691
|
+
return _vue_runtime_core[k];
|
|
1692
|
+
}
|
|
1693
|
+
});
|
|
2073
1694
|
});
|