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