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