@vue/runtime-dom 3.6.0-alpha.7 → 3.6.0-beta.10

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