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