@vuact/runtime-dom 3.5.46-vuact.0 → 3.6.0-rc.17-vuact.0

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