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

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