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