@vue/runtime-dom 3.3.4 → 3.3.6
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 +560 -542
- package/dist/runtime-dom.cjs.prod.js +451 -433
- package/dist/runtime-dom.d.ts +15 -13
- package/dist/runtime-dom.esm-browser.js +510 -496
- package/dist/runtime-dom.esm-browser.prod.js +6 -1
- package/dist/runtime-dom.esm-bundler.js +449 -431
- package/dist/runtime-dom.global.js +510 -496
- package/dist/runtime-dom.global.prod.js +6 -1
- package/package.json +4 -4
package/dist/runtime-dom.cjs.js
CHANGED
|
@@ -72,114 +72,430 @@ const nodeOps = {
|
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
const TRANSITION = "transition";
|
|
76
|
+
const ANIMATION = "animation";
|
|
77
|
+
const vtcKey = Symbol("_vtc");
|
|
78
|
+
const Transition = (props, { slots }) => runtimeCore.h(runtimeCore.BaseTransition, resolveTransitionProps(props), slots);
|
|
79
|
+
Transition.displayName = "Transition";
|
|
80
|
+
const DOMTransitionPropsValidators = {
|
|
81
|
+
name: String,
|
|
82
|
+
type: String,
|
|
83
|
+
css: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: true
|
|
86
|
+
},
|
|
87
|
+
duration: [String, Number, Object],
|
|
88
|
+
enterFromClass: String,
|
|
89
|
+
enterActiveClass: String,
|
|
90
|
+
enterToClass: String,
|
|
91
|
+
appearFromClass: String,
|
|
92
|
+
appearActiveClass: String,
|
|
93
|
+
appearToClass: String,
|
|
94
|
+
leaveFromClass: String,
|
|
95
|
+
leaveActiveClass: String,
|
|
96
|
+
leaveToClass: String
|
|
97
|
+
};
|
|
98
|
+
const TransitionPropsValidators = Transition.props = /* @__PURE__ */ shared.extend(
|
|
99
|
+
{},
|
|
100
|
+
runtimeCore.BaseTransitionPropsValidators,
|
|
101
|
+
DOMTransitionPropsValidators
|
|
102
|
+
);
|
|
103
|
+
const callHook = (hook, args = []) => {
|
|
104
|
+
if (shared.isArray(hook)) {
|
|
105
|
+
hook.forEach((h2) => h2(...args));
|
|
106
|
+
} else if (hook) {
|
|
107
|
+
hook(...args);
|
|
79
108
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
109
|
+
};
|
|
110
|
+
const hasExplicitCallback = (hook) => {
|
|
111
|
+
return hook ? shared.isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
|
|
112
|
+
};
|
|
113
|
+
function resolveTransitionProps(rawProps) {
|
|
114
|
+
const baseProps = {};
|
|
115
|
+
for (const key in rawProps) {
|
|
116
|
+
if (!(key in DOMTransitionPropsValidators)) {
|
|
117
|
+
baseProps[key] = rawProps[key];
|
|
118
|
+
}
|
|
86
119
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
120
|
+
if (rawProps.css === false) {
|
|
121
|
+
return baseProps;
|
|
122
|
+
}
|
|
123
|
+
const {
|
|
124
|
+
name = "v",
|
|
125
|
+
type,
|
|
126
|
+
duration,
|
|
127
|
+
enterFromClass = `${name}-enter-from`,
|
|
128
|
+
enterActiveClass = `${name}-enter-active`,
|
|
129
|
+
enterToClass = `${name}-enter-to`,
|
|
130
|
+
appearFromClass = enterFromClass,
|
|
131
|
+
appearActiveClass = enterActiveClass,
|
|
132
|
+
appearToClass = enterToClass,
|
|
133
|
+
leaveFromClass = `${name}-leave-from`,
|
|
134
|
+
leaveActiveClass = `${name}-leave-active`,
|
|
135
|
+
leaveToClass = `${name}-leave-to`
|
|
136
|
+
} = rawProps;
|
|
137
|
+
const durations = normalizeDuration(duration);
|
|
138
|
+
const enterDuration = durations && durations[0];
|
|
139
|
+
const leaveDuration = durations && durations[1];
|
|
140
|
+
const {
|
|
141
|
+
onBeforeEnter,
|
|
142
|
+
onEnter,
|
|
143
|
+
onEnterCancelled,
|
|
144
|
+
onLeave,
|
|
145
|
+
onLeaveCancelled,
|
|
146
|
+
onBeforeAppear = onBeforeEnter,
|
|
147
|
+
onAppear = onEnter,
|
|
148
|
+
onAppearCancelled = onEnterCancelled
|
|
149
|
+
} = baseProps;
|
|
150
|
+
const finishEnter = (el, isAppear, done) => {
|
|
151
|
+
removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
|
152
|
+
removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
|
|
153
|
+
done && done();
|
|
154
|
+
};
|
|
155
|
+
const finishLeave = (el, done) => {
|
|
156
|
+
el._isLeaving = false;
|
|
157
|
+
removeTransitionClass(el, leaveFromClass);
|
|
158
|
+
removeTransitionClass(el, leaveToClass);
|
|
159
|
+
removeTransitionClass(el, leaveActiveClass);
|
|
160
|
+
done && done();
|
|
161
|
+
};
|
|
162
|
+
const makeEnterHook = (isAppear) => {
|
|
163
|
+
return (el, done) => {
|
|
164
|
+
const hook = isAppear ? onAppear : onEnter;
|
|
165
|
+
const resolve = () => finishEnter(el, isAppear, done);
|
|
166
|
+
callHook(hook, [el, resolve]);
|
|
167
|
+
nextFrame(() => {
|
|
168
|
+
removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
|
|
169
|
+
addTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
|
170
|
+
if (!hasExplicitCallback(hook)) {
|
|
171
|
+
whenTransitionEnds(el, type, enterDuration, resolve);
|
|
97
172
|
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
el
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
return shared.extend(baseProps, {
|
|
177
|
+
onBeforeEnter(el) {
|
|
178
|
+
callHook(onBeforeEnter, [el]);
|
|
179
|
+
addTransitionClass(el, enterFromClass);
|
|
180
|
+
addTransitionClass(el, enterActiveClass);
|
|
181
|
+
},
|
|
182
|
+
onBeforeAppear(el) {
|
|
183
|
+
callHook(onBeforeAppear, [el]);
|
|
184
|
+
addTransitionClass(el, appearFromClass);
|
|
185
|
+
addTransitionClass(el, appearActiveClass);
|
|
186
|
+
},
|
|
187
|
+
onEnter: makeEnterHook(false),
|
|
188
|
+
onAppear: makeEnterHook(true),
|
|
189
|
+
onLeave(el, done) {
|
|
190
|
+
el._isLeaving = true;
|
|
191
|
+
const resolve = () => finishLeave(el, done);
|
|
192
|
+
addTransitionClass(el, leaveFromClass);
|
|
193
|
+
forceReflow();
|
|
194
|
+
addTransitionClass(el, leaveActiveClass);
|
|
195
|
+
nextFrame(() => {
|
|
196
|
+
if (!el._isLeaving) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
removeTransitionClass(el, leaveFromClass);
|
|
200
|
+
addTransitionClass(el, leaveToClass);
|
|
201
|
+
if (!hasExplicitCallback(onLeave)) {
|
|
202
|
+
whenTransitionEnds(el, type, leaveDuration, resolve);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
callHook(onLeave, [el, resolve]);
|
|
206
|
+
},
|
|
207
|
+
onEnterCancelled(el) {
|
|
208
|
+
finishEnter(el, false);
|
|
209
|
+
callHook(onEnterCancelled, [el]);
|
|
210
|
+
},
|
|
211
|
+
onAppearCancelled(el) {
|
|
212
|
+
finishEnter(el, true);
|
|
213
|
+
callHook(onAppearCancelled, [el]);
|
|
214
|
+
},
|
|
215
|
+
onLeaveCancelled(el) {
|
|
216
|
+
finishLeave(el);
|
|
217
|
+
callHook(onLeaveCancelled, [el]);
|
|
114
218
|
}
|
|
115
|
-
}
|
|
219
|
+
});
|
|
116
220
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (shared.
|
|
121
|
-
|
|
221
|
+
function normalizeDuration(duration) {
|
|
222
|
+
if (duration == null) {
|
|
223
|
+
return null;
|
|
224
|
+
} else if (shared.isObject(duration)) {
|
|
225
|
+
return [NumberOf(duration.enter), NumberOf(duration.leave)];
|
|
122
226
|
} else {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
{
|
|
126
|
-
if (semicolonRE.test(val)) {
|
|
127
|
-
runtimeCore.warn(
|
|
128
|
-
`Unexpected semicolon at the end of '${name}' style value: '${val}'`
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (name.startsWith("--")) {
|
|
133
|
-
style.setProperty(name, val);
|
|
134
|
-
} else {
|
|
135
|
-
const prefixed = autoPrefix(style, name);
|
|
136
|
-
if (importantRE.test(val)) {
|
|
137
|
-
style.setProperty(
|
|
138
|
-
shared.hyphenate(prefixed),
|
|
139
|
-
val.replace(importantRE, ""),
|
|
140
|
-
"important"
|
|
141
|
-
);
|
|
142
|
-
} else {
|
|
143
|
-
style[prefixed] = val;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
227
|
+
const n = NumberOf(duration);
|
|
228
|
+
return [n, n];
|
|
146
229
|
}
|
|
147
230
|
}
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if (cached) {
|
|
153
|
-
return cached;
|
|
154
|
-
}
|
|
155
|
-
let name = runtimeCore.camelize(rawName);
|
|
156
|
-
if (name !== "filter" && name in style) {
|
|
157
|
-
return prefixCache[rawName] = name;
|
|
158
|
-
}
|
|
159
|
-
name = shared.capitalize(name);
|
|
160
|
-
for (let i = 0; i < prefixes.length; i++) {
|
|
161
|
-
const prefixed = prefixes[i] + name;
|
|
162
|
-
if (prefixed in style) {
|
|
163
|
-
return prefixCache[rawName] = prefixed;
|
|
164
|
-
}
|
|
231
|
+
function NumberOf(val) {
|
|
232
|
+
const res = shared.toNumber(val);
|
|
233
|
+
{
|
|
234
|
+
runtimeCore.assertNumber(res, "<transition> explicit duration");
|
|
165
235
|
}
|
|
166
|
-
return
|
|
236
|
+
return res;
|
|
167
237
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
238
|
+
function addTransitionClass(el, cls) {
|
|
239
|
+
cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
|
|
240
|
+
(el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
|
|
241
|
+
}
|
|
242
|
+
function removeTransitionClass(el, cls) {
|
|
243
|
+
cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
|
|
244
|
+
const _vtc = el[vtcKey];
|
|
245
|
+
if (_vtc) {
|
|
246
|
+
_vtc.delete(cls);
|
|
247
|
+
if (!_vtc.size) {
|
|
248
|
+
el[vtcKey] = void 0;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
function nextFrame(cb) {
|
|
253
|
+
requestAnimationFrame(() => {
|
|
254
|
+
requestAnimationFrame(cb);
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
let endId = 0;
|
|
258
|
+
function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
|
|
259
|
+
const id = el._endId = ++endId;
|
|
260
|
+
const resolveIfNotStale = () => {
|
|
261
|
+
if (id === el._endId) {
|
|
262
|
+
resolve();
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
if (explicitTimeout) {
|
|
266
|
+
return setTimeout(resolveIfNotStale, explicitTimeout);
|
|
267
|
+
}
|
|
268
|
+
const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
|
|
269
|
+
if (!type) {
|
|
270
|
+
return resolve();
|
|
271
|
+
}
|
|
272
|
+
const endEvent = type + "end";
|
|
273
|
+
let ended = 0;
|
|
274
|
+
const end = () => {
|
|
275
|
+
el.removeEventListener(endEvent, onEnd);
|
|
276
|
+
resolveIfNotStale();
|
|
277
|
+
};
|
|
278
|
+
const onEnd = (e) => {
|
|
279
|
+
if (e.target === el && ++ended >= propCount) {
|
|
280
|
+
end();
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
setTimeout(() => {
|
|
284
|
+
if (ended < propCount) {
|
|
285
|
+
end();
|
|
286
|
+
}
|
|
287
|
+
}, timeout + 1);
|
|
288
|
+
el.addEventListener(endEvent, onEnd);
|
|
289
|
+
}
|
|
290
|
+
function getTransitionInfo(el, expectedType) {
|
|
291
|
+
const styles = window.getComputedStyle(el);
|
|
292
|
+
const getStyleProperties = (key) => (styles[key] || "").split(", ");
|
|
293
|
+
const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
|
|
294
|
+
const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
|
|
295
|
+
const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
|
296
|
+
const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
|
|
297
|
+
const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
|
|
298
|
+
const animationTimeout = getTimeout(animationDelays, animationDurations);
|
|
299
|
+
let type = null;
|
|
300
|
+
let timeout = 0;
|
|
301
|
+
let propCount = 0;
|
|
302
|
+
if (expectedType === TRANSITION) {
|
|
303
|
+
if (transitionTimeout > 0) {
|
|
304
|
+
type = TRANSITION;
|
|
305
|
+
timeout = transitionTimeout;
|
|
306
|
+
propCount = transitionDurations.length;
|
|
307
|
+
}
|
|
308
|
+
} else if (expectedType === ANIMATION) {
|
|
309
|
+
if (animationTimeout > 0) {
|
|
310
|
+
type = ANIMATION;
|
|
311
|
+
timeout = animationTimeout;
|
|
312
|
+
propCount = animationDurations.length;
|
|
313
|
+
}
|
|
314
|
+
} else {
|
|
315
|
+
timeout = Math.max(transitionTimeout, animationTimeout);
|
|
316
|
+
type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
|
|
317
|
+
propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
|
|
318
|
+
}
|
|
319
|
+
const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test(
|
|
320
|
+
getStyleProperties(`${TRANSITION}Property`).toString()
|
|
321
|
+
);
|
|
322
|
+
return {
|
|
323
|
+
type,
|
|
324
|
+
timeout,
|
|
325
|
+
propCount,
|
|
326
|
+
hasTransform
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
function getTimeout(delays, durations) {
|
|
330
|
+
while (delays.length < durations.length) {
|
|
331
|
+
delays = delays.concat(delays);
|
|
332
|
+
}
|
|
333
|
+
return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
|
|
334
|
+
}
|
|
335
|
+
function toMs(s) {
|
|
336
|
+
if (s === "auto")
|
|
337
|
+
return 0;
|
|
338
|
+
return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
|
|
339
|
+
}
|
|
340
|
+
function forceReflow() {
|
|
341
|
+
return document.body.offsetHeight;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
function patchClass(el, value, isSVG) {
|
|
345
|
+
const transitionClasses = el[vtcKey];
|
|
346
|
+
if (transitionClasses) {
|
|
347
|
+
value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
|
|
348
|
+
}
|
|
349
|
+
if (value == null) {
|
|
350
|
+
el.removeAttribute("class");
|
|
351
|
+
} else if (isSVG) {
|
|
352
|
+
el.setAttribute("class", value);
|
|
353
|
+
} else {
|
|
354
|
+
el.className = value;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
const vShowOldKey = Symbol("_vod");
|
|
359
|
+
const vShow = {
|
|
360
|
+
beforeMount(el, { value }, { transition }) {
|
|
361
|
+
el[vShowOldKey] = el.style.display === "none" ? "" : el.style.display;
|
|
362
|
+
if (transition && value) {
|
|
363
|
+
transition.beforeEnter(el);
|
|
364
|
+
} else {
|
|
365
|
+
setDisplay(el, value);
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
mounted(el, { value }, { transition }) {
|
|
369
|
+
if (transition && value) {
|
|
370
|
+
transition.enter(el);
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
updated(el, { value, oldValue }, { transition }) {
|
|
374
|
+
if (!value === !oldValue)
|
|
375
|
+
return;
|
|
376
|
+
if (transition) {
|
|
377
|
+
if (value) {
|
|
378
|
+
transition.beforeEnter(el);
|
|
379
|
+
setDisplay(el, true);
|
|
380
|
+
transition.enter(el);
|
|
381
|
+
} else {
|
|
382
|
+
transition.leave(el, () => {
|
|
383
|
+
setDisplay(el, false);
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
} else {
|
|
387
|
+
setDisplay(el, value);
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
beforeUnmount(el, { value }) {
|
|
391
|
+
setDisplay(el, value);
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
function setDisplay(el, value) {
|
|
395
|
+
el.style.display = value ? el[vShowOldKey] : "none";
|
|
396
|
+
}
|
|
397
|
+
function initVShowForSSR() {
|
|
398
|
+
vShow.getSSRProps = ({ value }) => {
|
|
399
|
+
if (!value) {
|
|
400
|
+
return { style: { display: "none" } };
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function patchStyle(el, prev, next) {
|
|
406
|
+
const style = el.style;
|
|
407
|
+
const isCssString = shared.isString(next);
|
|
408
|
+
if (next && !isCssString) {
|
|
409
|
+
if (prev && !shared.isString(prev)) {
|
|
410
|
+
for (const key in prev) {
|
|
411
|
+
if (next[key] == null) {
|
|
412
|
+
setStyle(style, key, "");
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
for (const key in next) {
|
|
417
|
+
setStyle(style, key, next[key]);
|
|
418
|
+
}
|
|
419
|
+
} else {
|
|
420
|
+
const currentDisplay = style.display;
|
|
421
|
+
if (isCssString) {
|
|
422
|
+
if (prev !== next) {
|
|
423
|
+
style.cssText = next;
|
|
424
|
+
}
|
|
425
|
+
} else if (prev) {
|
|
426
|
+
el.removeAttribute("style");
|
|
427
|
+
}
|
|
428
|
+
if (vShowOldKey in el) {
|
|
429
|
+
style.display = currentDisplay;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
const semicolonRE = /[^\\];\s*$/;
|
|
434
|
+
const importantRE = /\s*!important$/;
|
|
435
|
+
function setStyle(style, name, val) {
|
|
436
|
+
if (shared.isArray(val)) {
|
|
437
|
+
val.forEach((v) => setStyle(style, name, v));
|
|
438
|
+
} else {
|
|
439
|
+
if (val == null)
|
|
440
|
+
val = "";
|
|
441
|
+
{
|
|
442
|
+
if (semicolonRE.test(val)) {
|
|
443
|
+
runtimeCore.warn(
|
|
444
|
+
`Unexpected semicolon at the end of '${name}' style value: '${val}'`
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
if (name.startsWith("--")) {
|
|
449
|
+
style.setProperty(name, val);
|
|
450
|
+
} else {
|
|
451
|
+
const prefixed = autoPrefix(style, name);
|
|
452
|
+
if (importantRE.test(val)) {
|
|
453
|
+
style.setProperty(
|
|
454
|
+
shared.hyphenate(prefixed),
|
|
455
|
+
val.replace(importantRE, ""),
|
|
456
|
+
"important"
|
|
457
|
+
);
|
|
458
|
+
} else {
|
|
459
|
+
style[prefixed] = val;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
const prefixes = ["Webkit", "Moz", "ms"];
|
|
465
|
+
const prefixCache = {};
|
|
466
|
+
function autoPrefix(style, rawName) {
|
|
467
|
+
const cached = prefixCache[rawName];
|
|
468
|
+
if (cached) {
|
|
469
|
+
return cached;
|
|
470
|
+
}
|
|
471
|
+
let name = runtimeCore.camelize(rawName);
|
|
472
|
+
if (name !== "filter" && name in style) {
|
|
473
|
+
return prefixCache[rawName] = name;
|
|
474
|
+
}
|
|
475
|
+
name = shared.capitalize(name);
|
|
476
|
+
for (let i = 0; i < prefixes.length; i++) {
|
|
477
|
+
const prefixed = prefixes[i] + name;
|
|
478
|
+
if (prefixed in style) {
|
|
479
|
+
return prefixCache[rawName] = prefixed;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return rawName;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
const xlinkNS = "http://www.w3.org/1999/xlink";
|
|
486
|
+
function patchAttr(el, key, value, isSVG, instance) {
|
|
487
|
+
if (isSVG && key.startsWith("xlink:")) {
|
|
488
|
+
if (value == null) {
|
|
489
|
+
el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
|
490
|
+
} else {
|
|
491
|
+
el.setAttributeNS(xlinkNS, key, value);
|
|
492
|
+
}
|
|
493
|
+
} else {
|
|
494
|
+
const isBoolean = shared.isSpecialBooleanAttr(key);
|
|
495
|
+
if (value == null || isBoolean && !shared.includeBooleanAttr(value)) {
|
|
496
|
+
el.removeAttribute(key);
|
|
497
|
+
} else {
|
|
498
|
+
el.setAttribute(key, isBoolean ? "" : value);
|
|
183
499
|
}
|
|
184
500
|
}
|
|
185
501
|
}
|
|
@@ -238,8 +554,9 @@ function addEventListener(el, event, handler, options) {
|
|
|
238
554
|
function removeEventListener(el, event, handler, options) {
|
|
239
555
|
el.removeEventListener(event, handler, options);
|
|
240
556
|
}
|
|
557
|
+
const veiKey = Symbol("_vei");
|
|
241
558
|
function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
242
|
-
const invokers = el
|
|
559
|
+
const invokers = el[veiKey] || (el[veiKey] = {});
|
|
243
560
|
const existingInvoker = invokers[rawName];
|
|
244
561
|
if (nextValue && existingInvoker) {
|
|
245
562
|
existingInvoker.value = nextValue;
|
|
@@ -359,6 +676,8 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
359
676
|
return key in el;
|
|
360
677
|
}
|
|
361
678
|
|
|
679
|
+
/*! #__NO_SIDE_EFFECTS__ */
|
|
680
|
+
// @__NO_SIDE_EFFECTS__
|
|
362
681
|
function defineCustomElement(options, hydrate2) {
|
|
363
682
|
const Comp = runtimeCore.defineComponent(options);
|
|
364
683
|
class VueCustomElement extends VueElement {
|
|
@@ -369,8 +688,9 @@ function defineCustomElement(options, hydrate2) {
|
|
|
369
688
|
VueCustomElement.def = Comp;
|
|
370
689
|
return VueCustomElement;
|
|
371
690
|
}
|
|
372
|
-
|
|
373
|
-
|
|
691
|
+
/*! #__NO_SIDE_EFFECTS__ */
|
|
692
|
+
const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options) => {
|
|
693
|
+
return /* @__PURE__ */ defineCustomElement(options, hydrate);
|
|
374
694
|
};
|
|
375
695
|
const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
|
|
376
696
|
};
|
|
@@ -386,6 +706,7 @@ class VueElement extends BaseClass {
|
|
|
386
706
|
this._connected = false;
|
|
387
707
|
this._resolved = false;
|
|
388
708
|
this._numberProps = null;
|
|
709
|
+
this._ob = null;
|
|
389
710
|
if (this.shadowRoot && hydrate2) {
|
|
390
711
|
hydrate2(this._createVNode(), this.shadowRoot);
|
|
391
712
|
} else {
|
|
@@ -412,6 +733,10 @@ class VueElement extends BaseClass {
|
|
|
412
733
|
}
|
|
413
734
|
disconnectedCallback() {
|
|
414
735
|
this._connected = false;
|
|
736
|
+
if (this._ob) {
|
|
737
|
+
this._ob.disconnect();
|
|
738
|
+
this._ob = null;
|
|
739
|
+
}
|
|
415
740
|
runtimeCore.nextTick(() => {
|
|
416
741
|
if (!this._connected) {
|
|
417
742
|
render(null, this.shadowRoot);
|
|
@@ -427,11 +752,12 @@ class VueElement extends BaseClass {
|
|
|
427
752
|
for (let i = 0; i < this.attributes.length; i++) {
|
|
428
753
|
this._setAttr(this.attributes[i].name);
|
|
429
754
|
}
|
|
430
|
-
new MutationObserver((mutations) => {
|
|
755
|
+
this._ob = new MutationObserver((mutations) => {
|
|
431
756
|
for (const m of mutations) {
|
|
432
757
|
this._setAttr(m.attributeName);
|
|
433
758
|
}
|
|
434
|
-
})
|
|
759
|
+
});
|
|
760
|
+
this._ob.observe(this, { attributes: true });
|
|
435
761
|
const resolve = (def, isAsync = false) => {
|
|
436
762
|
const { props, styles } = def;
|
|
437
763
|
let numberProps;
|
|
@@ -475,396 +801,132 @@ class VueElement extends BaseClass {
|
|
|
475
801
|
},
|
|
476
802
|
set(val) {
|
|
477
803
|
this._setProp(key, val);
|
|
478
|
-
}
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
_setAttr(key) {
|
|
483
|
-
let value = this.getAttribute(key);
|
|
484
|
-
const camelKey = shared.camelize(key);
|
|
485
|
-
if (this._numberProps && this._numberProps[camelKey]) {
|
|
486
|
-
value = shared.toNumber(value);
|
|
487
|
-
}
|
|
488
|
-
this._setProp(camelKey, value, false);
|
|
489
|
-
}
|
|
490
|
-
/**
|
|
491
|
-
* @internal
|
|
492
|
-
*/
|
|
493
|
-
_getProp(key) {
|
|
494
|
-
return this._props[key];
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* @internal
|
|
498
|
-
*/
|
|
499
|
-
_setProp(key, val, shouldReflect = true, shouldUpdate = true) {
|
|
500
|
-
if (val !== this._props[key]) {
|
|
501
|
-
this._props[key] = val;
|
|
502
|
-
if (shouldUpdate && this._instance) {
|
|
503
|
-
this._update();
|
|
504
|
-
}
|
|
505
|
-
if (shouldReflect) {
|
|
506
|
-
if (val === true) {
|
|
507
|
-
this.setAttribute(shared.hyphenate(key), "");
|
|
508
|
-
} else if (typeof val === "string" || typeof val === "number") {
|
|
509
|
-
this.setAttribute(shared.hyphenate(key), val + "");
|
|
510
|
-
} else if (!val) {
|
|
511
|
-
this.removeAttribute(shared.hyphenate(key));
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
_update() {
|
|
517
|
-
render(this._createVNode(), this.shadowRoot);
|
|
518
|
-
}
|
|
519
|
-
_createVNode() {
|
|
520
|
-
const vnode = runtimeCore.createVNode(this._def, shared.extend({}, this._props));
|
|
521
|
-
if (!this._instance) {
|
|
522
|
-
vnode.ce = (instance) => {
|
|
523
|
-
this._instance = instance;
|
|
524
|
-
instance.isCE = true;
|
|
525
|
-
{
|
|
526
|
-
instance.ceReload = (newStyles) => {
|
|
527
|
-
if (this._styles) {
|
|
528
|
-
this._styles.forEach((s) => this.shadowRoot.removeChild(s));
|
|
529
|
-
this._styles.length = 0;
|
|
530
|
-
}
|
|
531
|
-
this._applyStyles(newStyles);
|
|
532
|
-
this._instance = null;
|
|
533
|
-
this._update();
|
|
534
|
-
};
|
|
535
|
-
}
|
|
536
|
-
const dispatch = (event, args) => {
|
|
537
|
-
this.dispatchEvent(
|
|
538
|
-
new CustomEvent(event, {
|
|
539
|
-
detail: args
|
|
540
|
-
})
|
|
541
|
-
);
|
|
542
|
-
};
|
|
543
|
-
instance.emit = (event, ...args) => {
|
|
544
|
-
dispatch(event, args);
|
|
545
|
-
if (shared.hyphenate(event) !== event) {
|
|
546
|
-
dispatch(shared.hyphenate(event), args);
|
|
547
|
-
}
|
|
548
|
-
};
|
|
549
|
-
let parent = this;
|
|
550
|
-
while (parent = parent && (parent.parentNode || parent.host)) {
|
|
551
|
-
if (parent instanceof VueElement) {
|
|
552
|
-
instance.parent = parent._instance;
|
|
553
|
-
instance.provides = parent._instance.provides;
|
|
554
|
-
break;
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
};
|
|
558
|
-
}
|
|
559
|
-
return vnode;
|
|
560
|
-
}
|
|
561
|
-
_applyStyles(styles) {
|
|
562
|
-
if (styles) {
|
|
563
|
-
styles.forEach((css) => {
|
|
564
|
-
const s = document.createElement("style");
|
|
565
|
-
s.textContent = css;
|
|
566
|
-
this.shadowRoot.appendChild(s);
|
|
567
|
-
{
|
|
568
|
-
(this._styles || (this._styles = [])).push(s);
|
|
569
|
-
}
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
function useCssModule(name = "$style") {
|
|
576
|
-
{
|
|
577
|
-
const instance = runtimeCore.getCurrentInstance();
|
|
578
|
-
if (!instance) {
|
|
579
|
-
runtimeCore.warn(`useCssModule must be called inside setup()`);
|
|
580
|
-
return shared.EMPTY_OBJ;
|
|
581
|
-
}
|
|
582
|
-
const modules = instance.type.__cssModules;
|
|
583
|
-
if (!modules) {
|
|
584
|
-
runtimeCore.warn(`Current instance does not have CSS modules injected.`);
|
|
585
|
-
return shared.EMPTY_OBJ;
|
|
586
|
-
}
|
|
587
|
-
const mod = modules[name];
|
|
588
|
-
if (!mod) {
|
|
589
|
-
runtimeCore.warn(`Current instance does not have CSS module named "${name}".`);
|
|
590
|
-
return shared.EMPTY_OBJ;
|
|
591
|
-
}
|
|
592
|
-
return mod;
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
function useCssVars(getter) {
|
|
597
|
-
return;
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
const TRANSITION = "transition";
|
|
601
|
-
const ANIMATION = "animation";
|
|
602
|
-
const Transition = (props, { slots }) => runtimeCore.h(runtimeCore.BaseTransition, resolveTransitionProps(props), slots);
|
|
603
|
-
Transition.displayName = "Transition";
|
|
604
|
-
const DOMTransitionPropsValidators = {
|
|
605
|
-
name: String,
|
|
606
|
-
type: String,
|
|
607
|
-
css: {
|
|
608
|
-
type: Boolean,
|
|
609
|
-
default: true
|
|
610
|
-
},
|
|
611
|
-
duration: [String, Number, Object],
|
|
612
|
-
enterFromClass: String,
|
|
613
|
-
enterActiveClass: String,
|
|
614
|
-
enterToClass: String,
|
|
615
|
-
appearFromClass: String,
|
|
616
|
-
appearActiveClass: String,
|
|
617
|
-
appearToClass: String,
|
|
618
|
-
leaveFromClass: String,
|
|
619
|
-
leaveActiveClass: String,
|
|
620
|
-
leaveToClass: String
|
|
621
|
-
};
|
|
622
|
-
const TransitionPropsValidators = Transition.props = /* @__PURE__ */ shared.extend(
|
|
623
|
-
{},
|
|
624
|
-
runtimeCore.BaseTransitionPropsValidators,
|
|
625
|
-
DOMTransitionPropsValidators
|
|
626
|
-
);
|
|
627
|
-
const callHook = (hook, args = []) => {
|
|
628
|
-
if (shared.isArray(hook)) {
|
|
629
|
-
hook.forEach((h2) => h2(...args));
|
|
630
|
-
} else if (hook) {
|
|
631
|
-
hook(...args);
|
|
632
|
-
}
|
|
633
|
-
};
|
|
634
|
-
const hasExplicitCallback = (hook) => {
|
|
635
|
-
return hook ? shared.isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
|
|
636
|
-
};
|
|
637
|
-
function resolveTransitionProps(rawProps) {
|
|
638
|
-
const baseProps = {};
|
|
639
|
-
for (const key in rawProps) {
|
|
640
|
-
if (!(key in DOMTransitionPropsValidators)) {
|
|
641
|
-
baseProps[key] = rawProps[key];
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
if (rawProps.css === false) {
|
|
645
|
-
return baseProps;
|
|
646
|
-
}
|
|
647
|
-
const {
|
|
648
|
-
name = "v",
|
|
649
|
-
type,
|
|
650
|
-
duration,
|
|
651
|
-
enterFromClass = `${name}-enter-from`,
|
|
652
|
-
enterActiveClass = `${name}-enter-active`,
|
|
653
|
-
enterToClass = `${name}-enter-to`,
|
|
654
|
-
appearFromClass = enterFromClass,
|
|
655
|
-
appearActiveClass = enterActiveClass,
|
|
656
|
-
appearToClass = enterToClass,
|
|
657
|
-
leaveFromClass = `${name}-leave-from`,
|
|
658
|
-
leaveActiveClass = `${name}-leave-active`,
|
|
659
|
-
leaveToClass = `${name}-leave-to`
|
|
660
|
-
} = rawProps;
|
|
661
|
-
const durations = normalizeDuration(duration);
|
|
662
|
-
const enterDuration = durations && durations[0];
|
|
663
|
-
const leaveDuration = durations && durations[1];
|
|
664
|
-
const {
|
|
665
|
-
onBeforeEnter,
|
|
666
|
-
onEnter,
|
|
667
|
-
onEnterCancelled,
|
|
668
|
-
onLeave,
|
|
669
|
-
onLeaveCancelled,
|
|
670
|
-
onBeforeAppear = onBeforeEnter,
|
|
671
|
-
onAppear = onEnter,
|
|
672
|
-
onAppearCancelled = onEnterCancelled
|
|
673
|
-
} = baseProps;
|
|
674
|
-
const finishEnter = (el, isAppear, done) => {
|
|
675
|
-
removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
|
676
|
-
removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
|
|
677
|
-
done && done();
|
|
678
|
-
};
|
|
679
|
-
const finishLeave = (el, done) => {
|
|
680
|
-
el._isLeaving = false;
|
|
681
|
-
removeTransitionClass(el, leaveFromClass);
|
|
682
|
-
removeTransitionClass(el, leaveToClass);
|
|
683
|
-
removeTransitionClass(el, leaveActiveClass);
|
|
684
|
-
done && done();
|
|
685
|
-
};
|
|
686
|
-
const makeEnterHook = (isAppear) => {
|
|
687
|
-
return (el, done) => {
|
|
688
|
-
const hook = isAppear ? onAppear : onEnter;
|
|
689
|
-
const resolve = () => finishEnter(el, isAppear, done);
|
|
690
|
-
callHook(hook, [el, resolve]);
|
|
691
|
-
nextFrame(() => {
|
|
692
|
-
removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
|
|
693
|
-
addTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
|
694
|
-
if (!hasExplicitCallback(hook)) {
|
|
695
|
-
whenTransitionEnds(el, type, enterDuration, resolve);
|
|
696
|
-
}
|
|
697
|
-
});
|
|
698
|
-
};
|
|
699
|
-
};
|
|
700
|
-
return shared.extend(baseProps, {
|
|
701
|
-
onBeforeEnter(el) {
|
|
702
|
-
callHook(onBeforeEnter, [el]);
|
|
703
|
-
addTransitionClass(el, enterFromClass);
|
|
704
|
-
addTransitionClass(el, enterActiveClass);
|
|
705
|
-
},
|
|
706
|
-
onBeforeAppear(el) {
|
|
707
|
-
callHook(onBeforeAppear, [el]);
|
|
708
|
-
addTransitionClass(el, appearFromClass);
|
|
709
|
-
addTransitionClass(el, appearActiveClass);
|
|
710
|
-
},
|
|
711
|
-
onEnter: makeEnterHook(false),
|
|
712
|
-
onAppear: makeEnterHook(true),
|
|
713
|
-
onLeave(el, done) {
|
|
714
|
-
el._isLeaving = true;
|
|
715
|
-
const resolve = () => finishLeave(el, done);
|
|
716
|
-
addTransitionClass(el, leaveFromClass);
|
|
717
|
-
forceReflow();
|
|
718
|
-
addTransitionClass(el, leaveActiveClass);
|
|
719
|
-
nextFrame(() => {
|
|
720
|
-
if (!el._isLeaving) {
|
|
721
|
-
return;
|
|
722
|
-
}
|
|
723
|
-
removeTransitionClass(el, leaveFromClass);
|
|
724
|
-
addTransitionClass(el, leaveToClass);
|
|
725
|
-
if (!hasExplicitCallback(onLeave)) {
|
|
726
|
-
whenTransitionEnds(el, type, leaveDuration, resolve);
|
|
727
|
-
}
|
|
728
|
-
});
|
|
729
|
-
callHook(onLeave, [el, resolve]);
|
|
730
|
-
},
|
|
731
|
-
onEnterCancelled(el) {
|
|
732
|
-
finishEnter(el, false);
|
|
733
|
-
callHook(onEnterCancelled, [el]);
|
|
734
|
-
},
|
|
735
|
-
onAppearCancelled(el) {
|
|
736
|
-
finishEnter(el, true);
|
|
737
|
-
callHook(onAppearCancelled, [el]);
|
|
738
|
-
},
|
|
739
|
-
onLeaveCancelled(el) {
|
|
740
|
-
finishLeave(el);
|
|
741
|
-
callHook(onLeaveCancelled, [el]);
|
|
804
|
+
}
|
|
805
|
+
});
|
|
742
806
|
}
|
|
743
|
-
});
|
|
744
|
-
}
|
|
745
|
-
function normalizeDuration(duration) {
|
|
746
|
-
if (duration == null) {
|
|
747
|
-
return null;
|
|
748
|
-
} else if (shared.isObject(duration)) {
|
|
749
|
-
return [NumberOf(duration.enter), NumberOf(duration.leave)];
|
|
750
|
-
} else {
|
|
751
|
-
const n = NumberOf(duration);
|
|
752
|
-
return [n, n];
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
function NumberOf(val) {
|
|
756
|
-
const res = shared.toNumber(val);
|
|
757
|
-
{
|
|
758
|
-
runtimeCore.assertNumber(res, "<transition> explicit duration");
|
|
759
807
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
}
|
|
766
|
-
function removeTransitionClass(el, cls) {
|
|
767
|
-
cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
|
|
768
|
-
const { _vtc } = el;
|
|
769
|
-
if (_vtc) {
|
|
770
|
-
_vtc.delete(cls);
|
|
771
|
-
if (!_vtc.size) {
|
|
772
|
-
el._vtc = void 0;
|
|
808
|
+
_setAttr(key) {
|
|
809
|
+
let value = this.getAttribute(key);
|
|
810
|
+
const camelKey = shared.camelize(key);
|
|
811
|
+
if (this._numberProps && this._numberProps[camelKey]) {
|
|
812
|
+
value = shared.toNumber(value);
|
|
773
813
|
}
|
|
814
|
+
this._setProp(camelKey, value, false);
|
|
774
815
|
}
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
if (
|
|
786
|
-
|
|
816
|
+
/**
|
|
817
|
+
* @internal
|
|
818
|
+
*/
|
|
819
|
+
_getProp(key) {
|
|
820
|
+
return this._props[key];
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* @internal
|
|
824
|
+
*/
|
|
825
|
+
_setProp(key, val, shouldReflect = true, shouldUpdate = true) {
|
|
826
|
+
if (val !== this._props[key]) {
|
|
827
|
+
this._props[key] = val;
|
|
828
|
+
if (shouldUpdate && this._instance) {
|
|
829
|
+
this._update();
|
|
830
|
+
}
|
|
831
|
+
if (shouldReflect) {
|
|
832
|
+
if (val === true) {
|
|
833
|
+
this.setAttribute(shared.hyphenate(key), "");
|
|
834
|
+
} else if (typeof val === "string" || typeof val === "number") {
|
|
835
|
+
this.setAttribute(shared.hyphenate(key), val + "");
|
|
836
|
+
} else if (!val) {
|
|
837
|
+
this.removeAttribute(shared.hyphenate(key));
|
|
838
|
+
}
|
|
839
|
+
}
|
|
787
840
|
}
|
|
788
|
-
};
|
|
789
|
-
if (explicitTimeout) {
|
|
790
|
-
return setTimeout(resolveIfNotStale, explicitTimeout);
|
|
791
841
|
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
return resolve();
|
|
842
|
+
_update() {
|
|
843
|
+
render(this._createVNode(), this.shadowRoot);
|
|
795
844
|
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
845
|
+
_createVNode() {
|
|
846
|
+
const vnode = runtimeCore.createVNode(this._def, shared.extend({}, this._props));
|
|
847
|
+
if (!this._instance) {
|
|
848
|
+
vnode.ce = (instance) => {
|
|
849
|
+
this._instance = instance;
|
|
850
|
+
instance.isCE = true;
|
|
851
|
+
{
|
|
852
|
+
instance.ceReload = (newStyles) => {
|
|
853
|
+
if (this._styles) {
|
|
854
|
+
this._styles.forEach((s) => this.shadowRoot.removeChild(s));
|
|
855
|
+
this._styles.length = 0;
|
|
856
|
+
}
|
|
857
|
+
this._applyStyles(newStyles);
|
|
858
|
+
this._instance = null;
|
|
859
|
+
this._update();
|
|
860
|
+
};
|
|
861
|
+
}
|
|
862
|
+
const dispatch = (event, args) => {
|
|
863
|
+
this.dispatchEvent(
|
|
864
|
+
new CustomEvent(event, {
|
|
865
|
+
detail: args
|
|
866
|
+
})
|
|
867
|
+
);
|
|
868
|
+
};
|
|
869
|
+
instance.emit = (event, ...args) => {
|
|
870
|
+
dispatch(event, args);
|
|
871
|
+
if (shared.hyphenate(event) !== event) {
|
|
872
|
+
dispatch(shared.hyphenate(event), args);
|
|
873
|
+
}
|
|
874
|
+
};
|
|
875
|
+
let parent = this;
|
|
876
|
+
while (parent = parent && (parent.parentNode || parent.host)) {
|
|
877
|
+
if (parent instanceof VueElement) {
|
|
878
|
+
instance.parent = parent._instance;
|
|
879
|
+
instance.provides = parent._instance.provides;
|
|
880
|
+
break;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
};
|
|
805
884
|
}
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
885
|
+
return vnode;
|
|
886
|
+
}
|
|
887
|
+
_applyStyles(styles) {
|
|
888
|
+
if (styles) {
|
|
889
|
+
styles.forEach((css) => {
|
|
890
|
+
const s = document.createElement("style");
|
|
891
|
+
s.textContent = css;
|
|
892
|
+
this.shadowRoot.appendChild(s);
|
|
893
|
+
{
|
|
894
|
+
(this._styles || (this._styles = [])).push(s);
|
|
895
|
+
}
|
|
896
|
+
});
|
|
810
897
|
}
|
|
811
|
-
}
|
|
812
|
-
el.addEventListener(endEvent, onEnd);
|
|
898
|
+
}
|
|
813
899
|
}
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
|
|
822
|
-
const animationTimeout = getTimeout(animationDelays, animationDurations);
|
|
823
|
-
let type = null;
|
|
824
|
-
let timeout = 0;
|
|
825
|
-
let propCount = 0;
|
|
826
|
-
if (expectedType === TRANSITION) {
|
|
827
|
-
if (transitionTimeout > 0) {
|
|
828
|
-
type = TRANSITION;
|
|
829
|
-
timeout = transitionTimeout;
|
|
830
|
-
propCount = transitionDurations.length;
|
|
900
|
+
|
|
901
|
+
function useCssModule(name = "$style") {
|
|
902
|
+
{
|
|
903
|
+
const instance = runtimeCore.getCurrentInstance();
|
|
904
|
+
if (!instance) {
|
|
905
|
+
runtimeCore.warn(`useCssModule must be called inside setup()`);
|
|
906
|
+
return shared.EMPTY_OBJ;
|
|
831
907
|
}
|
|
832
|
-
|
|
833
|
-
if (
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
propCount = animationDurations.length;
|
|
908
|
+
const modules = instance.type.__cssModules;
|
|
909
|
+
if (!modules) {
|
|
910
|
+
runtimeCore.warn(`Current instance does not have CSS modules injected.`);
|
|
911
|
+
return shared.EMPTY_OBJ;
|
|
837
912
|
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
getStyleProperties(`${TRANSITION}Property`).toString()
|
|
845
|
-
);
|
|
846
|
-
return {
|
|
847
|
-
type,
|
|
848
|
-
timeout,
|
|
849
|
-
propCount,
|
|
850
|
-
hasTransform
|
|
851
|
-
};
|
|
852
|
-
}
|
|
853
|
-
function getTimeout(delays, durations) {
|
|
854
|
-
while (delays.length < durations.length) {
|
|
855
|
-
delays = delays.concat(delays);
|
|
913
|
+
const mod = modules[name];
|
|
914
|
+
if (!mod) {
|
|
915
|
+
runtimeCore.warn(`Current instance does not have CSS module named "${name}".`);
|
|
916
|
+
return shared.EMPTY_OBJ;
|
|
917
|
+
}
|
|
918
|
+
return mod;
|
|
856
919
|
}
|
|
857
|
-
return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
|
|
858
|
-
}
|
|
859
|
-
function toMs(s) {
|
|
860
|
-
return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
|
|
861
920
|
}
|
|
862
|
-
|
|
863
|
-
|
|
921
|
+
|
|
922
|
+
function useCssVars(getter) {
|
|
923
|
+
return;
|
|
864
924
|
}
|
|
865
925
|
|
|
866
926
|
const positionMap = /* @__PURE__ */ new WeakMap();
|
|
867
927
|
const newPositionMap = /* @__PURE__ */ new WeakMap();
|
|
928
|
+
const moveCbKey = Symbol("_moveCb");
|
|
929
|
+
const enterCbKey = Symbol("_enterCb");
|
|
868
930
|
const TransitionGroupImpl = {
|
|
869
931
|
name: "TransitionGroup",
|
|
870
932
|
props: /* @__PURE__ */ shared.extend({}, TransitionPropsValidators, {
|
|
@@ -897,13 +959,13 @@ const TransitionGroupImpl = {
|
|
|
897
959
|
const style = el.style;
|
|
898
960
|
addTransitionClass(el, moveClass);
|
|
899
961
|
style.transform = style.webkitTransform = style.transitionDuration = "";
|
|
900
|
-
const cb = el
|
|
962
|
+
const cb = el[moveCbKey] = (e) => {
|
|
901
963
|
if (e && e.target !== el) {
|
|
902
964
|
return;
|
|
903
965
|
}
|
|
904
966
|
if (!e || /transform$/.test(e.propertyName)) {
|
|
905
967
|
el.removeEventListener("transitionend", cb);
|
|
906
|
-
el
|
|
968
|
+
el[moveCbKey] = null;
|
|
907
969
|
removeTransitionClass(el, moveClass);
|
|
908
970
|
}
|
|
909
971
|
};
|
|
@@ -946,11 +1008,11 @@ const removeMode = (props) => delete props.mode;
|
|
|
946
1008
|
const TransitionGroup = TransitionGroupImpl;
|
|
947
1009
|
function callPendingCbs(c) {
|
|
948
1010
|
const el = c.el;
|
|
949
|
-
if (el
|
|
950
|
-
el
|
|
1011
|
+
if (el[moveCbKey]) {
|
|
1012
|
+
el[moveCbKey]();
|
|
951
1013
|
}
|
|
952
|
-
if (el
|
|
953
|
-
el
|
|
1014
|
+
if (el[enterCbKey]) {
|
|
1015
|
+
el[enterCbKey]();
|
|
954
1016
|
}
|
|
955
1017
|
}
|
|
956
1018
|
function recordPosition(c) {
|
|
@@ -970,8 +1032,9 @@ function applyTranslation(c) {
|
|
|
970
1032
|
}
|
|
971
1033
|
function hasCSSTransform(el, root, moveClass) {
|
|
972
1034
|
const clone = el.cloneNode();
|
|
973
|
-
|
|
974
|
-
|
|
1035
|
+
const _vtc = el[vtcKey];
|
|
1036
|
+
if (_vtc) {
|
|
1037
|
+
_vtc.forEach((cls) => {
|
|
975
1038
|
cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
|
|
976
1039
|
});
|
|
977
1040
|
}
|
|
@@ -998,9 +1061,10 @@ function onCompositionEnd(e) {
|
|
|
998
1061
|
target.dispatchEvent(new Event("input"));
|
|
999
1062
|
}
|
|
1000
1063
|
}
|
|
1064
|
+
const assignKey = Symbol("_assign");
|
|
1001
1065
|
const vModelText = {
|
|
1002
1066
|
created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
|
1003
|
-
el
|
|
1067
|
+
el[assignKey] = getModelAssigner(vnode);
|
|
1004
1068
|
const castToNumber = number || vnode.props && vnode.props.type === "number";
|
|
1005
1069
|
addEventListener(el, lazy ? "change" : "input", (e) => {
|
|
1006
1070
|
if (e.target.composing)
|
|
@@ -1012,7 +1076,7 @@ const vModelText = {
|
|
|
1012
1076
|
if (castToNumber) {
|
|
1013
1077
|
domValue = shared.looseToNumber(domValue);
|
|
1014
1078
|
}
|
|
1015
|
-
el
|
|
1079
|
+
el[assignKey](domValue);
|
|
1016
1080
|
});
|
|
1017
1081
|
if (trim) {
|
|
1018
1082
|
addEventListener(el, "change", () => {
|
|
@@ -1030,7 +1094,7 @@ const vModelText = {
|
|
|
1030
1094
|
el.value = value == null ? "" : value;
|
|
1031
1095
|
},
|
|
1032
1096
|
beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
|
|
1033
|
-
el
|
|
1097
|
+
el[assignKey] = getModelAssigner(vnode);
|
|
1034
1098
|
if (el.composing)
|
|
1035
1099
|
return;
|
|
1036
1100
|
if (document.activeElement === el && el.type !== "range") {
|
|
@@ -1054,12 +1118,12 @@ const vModelCheckbox = {
|
|
|
1054
1118
|
// #4096 array checkboxes need to be deep traversed
|
|
1055
1119
|
deep: true,
|
|
1056
1120
|
created(el, _, vnode) {
|
|
1057
|
-
el
|
|
1121
|
+
el[assignKey] = getModelAssigner(vnode);
|
|
1058
1122
|
addEventListener(el, "change", () => {
|
|
1059
1123
|
const modelValue = el._modelValue;
|
|
1060
1124
|
const elementValue = getValue(el);
|
|
1061
1125
|
const checked = el.checked;
|
|
1062
|
-
const assign = el
|
|
1126
|
+
const assign = el[assignKey];
|
|
1063
1127
|
if (shared.isArray(modelValue)) {
|
|
1064
1128
|
const index = shared.looseIndexOf(modelValue, elementValue);
|
|
1065
1129
|
const found = index !== -1;
|
|
@@ -1086,7 +1150,7 @@ const vModelCheckbox = {
|
|
|
1086
1150
|
// set initial checked on mount to wait for true-value/false-value
|
|
1087
1151
|
mounted: setChecked,
|
|
1088
1152
|
beforeUpdate(el, binding, vnode) {
|
|
1089
|
-
el
|
|
1153
|
+
el[assignKey] = getModelAssigner(vnode);
|
|
1090
1154
|
setChecked(el, binding, vnode);
|
|
1091
1155
|
}
|
|
1092
1156
|
};
|
|
@@ -1103,13 +1167,13 @@ function setChecked(el, { value, oldValue }, vnode) {
|
|
|
1103
1167
|
const vModelRadio = {
|
|
1104
1168
|
created(el, { value }, vnode) {
|
|
1105
1169
|
el.checked = shared.looseEqual(value, vnode.props.value);
|
|
1106
|
-
el
|
|
1170
|
+
el[assignKey] = getModelAssigner(vnode);
|
|
1107
1171
|
addEventListener(el, "change", () => {
|
|
1108
|
-
el
|
|
1172
|
+
el[assignKey](getValue(el));
|
|
1109
1173
|
});
|
|
1110
1174
|
},
|
|
1111
1175
|
beforeUpdate(el, { value, oldValue }, vnode) {
|
|
1112
|
-
el
|
|
1176
|
+
el[assignKey] = getModelAssigner(vnode);
|
|
1113
1177
|
if (value !== oldValue) {
|
|
1114
1178
|
el.checked = shared.looseEqual(value, vnode.props.value);
|
|
1115
1179
|
}
|
|
@@ -1124,11 +1188,11 @@ const vModelSelect = {
|
|
|
1124
1188
|
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
|
|
1125
1189
|
(o) => number ? shared.looseToNumber(getValue(o)) : getValue(o)
|
|
1126
1190
|
);
|
|
1127
|
-
el
|
|
1191
|
+
el[assignKey](
|
|
1128
1192
|
el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
|
|
1129
1193
|
);
|
|
1130
1194
|
});
|
|
1131
|
-
el
|
|
1195
|
+
el[assignKey] = getModelAssigner(vnode);
|
|
1132
1196
|
},
|
|
1133
1197
|
// set value in mounted & updated because <select> relies on its children
|
|
1134
1198
|
// <option>s.
|
|
@@ -1136,7 +1200,7 @@ const vModelSelect = {
|
|
|
1136
1200
|
setSelected(el, value);
|
|
1137
1201
|
},
|
|
1138
1202
|
beforeUpdate(el, _binding, vnode) {
|
|
1139
|
-
el
|
|
1203
|
+
el[assignKey] = getModelAssigner(vnode);
|
|
1140
1204
|
},
|
|
1141
1205
|
updated(el, { value }) {
|
|
1142
1206
|
setSelected(el, value);
|
|
@@ -1297,52 +1361,6 @@ const withKeys = (fn, modifiers) => {
|
|
|
1297
1361
|
};
|
|
1298
1362
|
};
|
|
1299
1363
|
|
|
1300
|
-
const vShow = {
|
|
1301
|
-
beforeMount(el, { value }, { transition }) {
|
|
1302
|
-
el._vod = el.style.display === "none" ? "" : el.style.display;
|
|
1303
|
-
if (transition && value) {
|
|
1304
|
-
transition.beforeEnter(el);
|
|
1305
|
-
} else {
|
|
1306
|
-
setDisplay(el, value);
|
|
1307
|
-
}
|
|
1308
|
-
},
|
|
1309
|
-
mounted(el, { value }, { transition }) {
|
|
1310
|
-
if (transition && value) {
|
|
1311
|
-
transition.enter(el);
|
|
1312
|
-
}
|
|
1313
|
-
},
|
|
1314
|
-
updated(el, { value, oldValue }, { transition }) {
|
|
1315
|
-
if (!value === !oldValue)
|
|
1316
|
-
return;
|
|
1317
|
-
if (transition) {
|
|
1318
|
-
if (value) {
|
|
1319
|
-
transition.beforeEnter(el);
|
|
1320
|
-
setDisplay(el, true);
|
|
1321
|
-
transition.enter(el);
|
|
1322
|
-
} else {
|
|
1323
|
-
transition.leave(el, () => {
|
|
1324
|
-
setDisplay(el, false);
|
|
1325
|
-
});
|
|
1326
|
-
}
|
|
1327
|
-
} else {
|
|
1328
|
-
setDisplay(el, value);
|
|
1329
|
-
}
|
|
1330
|
-
},
|
|
1331
|
-
beforeUnmount(el, { value }) {
|
|
1332
|
-
setDisplay(el, value);
|
|
1333
|
-
}
|
|
1334
|
-
};
|
|
1335
|
-
function setDisplay(el, value) {
|
|
1336
|
-
el.style.display = value ? el._vod : "none";
|
|
1337
|
-
}
|
|
1338
|
-
function initVShowForSSR() {
|
|
1339
|
-
vShow.getSSRProps = ({ value }) => {
|
|
1340
|
-
if (!value) {
|
|
1341
|
-
return { style: { display: "none" } };
|
|
1342
|
-
}
|
|
1343
|
-
};
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
1364
|
const rendererOptions = /* @__PURE__ */ shared.extend({ patchProp }, nodeOps);
|
|
1347
1365
|
let renderer;
|
|
1348
1366
|
let enabledHydration = false;
|
|
@@ -1482,5 +1500,5 @@ exports.vShow = vShow;
|
|
|
1482
1500
|
exports.withKeys = withKeys;
|
|
1483
1501
|
exports.withModifiers = withModifiers;
|
|
1484
1502
|
Object.keys(runtimeCore).forEach(function (k) {
|
|
1485
|
-
if (k !== 'default' && !
|
|
1503
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = runtimeCore[k];
|
|
1486
1504
|
});
|