@vue/runtime-dom 3.6.0-rc.1 → 3.6.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime-dom.cjs.js +106 -76
- package/dist/runtime-dom.cjs.prod.js +95 -68
- package/dist/runtime-dom.d.ts +147 -157
- package/dist/runtime-dom.esm-browser.js +929 -648
- package/dist/runtime-dom.esm-browser.prod.js +4 -3
- package/dist/runtime-dom.esm-bundler.js +153 -121
- package/dist/runtime-dom.global.js +929 -648
- package/dist/runtime-dom.global.prod.js +4 -3
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.6.0-rc.
|
|
2
|
+
* @vue/runtime-dom v3.6.0-rc.10
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -13,13 +13,13 @@ let _vue_shared = require("@vue/shared");
|
|
|
13
13
|
let policy = void 0;
|
|
14
14
|
const tt = typeof window !== "undefined" && window.trustedTypes;
|
|
15
15
|
if (tt) try {
|
|
16
|
-
policy =
|
|
16
|
+
policy = /*@__PURE__*/ tt.createPolicy("vue", { createHTML: (val) => val });
|
|
17
17
|
} catch (e) {}
|
|
18
18
|
const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
|
|
19
19
|
const svgNS = "http://www.w3.org/2000/svg";
|
|
20
20
|
const mathmlNS = "http://www.w3.org/1998/Math/MathML";
|
|
21
21
|
const doc = typeof document !== "undefined" ? document : null;
|
|
22
|
-
const templateContainer = doc &&
|
|
22
|
+
const templateContainer = doc && /*@__PURE__*/ doc.createElement("template");
|
|
23
23
|
const nodeOps = {
|
|
24
24
|
insert: (child, parent, anchor) => {
|
|
25
25
|
parent.insertBefore(child, anchor || null);
|
|
@@ -93,7 +93,7 @@ const DOMTransitionPropsValidators = {
|
|
|
93
93
|
leaveActiveClass: String,
|
|
94
94
|
leaveToClass: String
|
|
95
95
|
};
|
|
96
|
-
const TransitionPropsValidators =
|
|
96
|
+
const TransitionPropsValidators = /*@__PURE__*/ (0, _vue_shared.extend)({}, _vue_runtime_core.BaseTransitionPropsValidators, DOMTransitionPropsValidators);
|
|
97
97
|
/**
|
|
98
98
|
* Wrap logic that attaches extra properties to Transition in a function
|
|
99
99
|
* so that it can be annotated as pure
|
|
@@ -107,7 +107,7 @@ const decorate$1 = (t) => {
|
|
|
107
107
|
* DOM Transition is a higher-order-component based on the platform-agnostic
|
|
108
108
|
* base Transition component, with DOM-specific logic.
|
|
109
109
|
*/
|
|
110
|
-
const Transition =
|
|
110
|
+
const Transition = /*@__PURE__*/ decorate$1((props, { slots }) => (0, _vue_runtime_core.h)(_vue_runtime_core.BaseTransition, resolveTransitionProps(props), slots));
|
|
111
111
|
/**
|
|
112
112
|
* #3227 Incoming hooks may be merged into arrays when wrapping Transition
|
|
113
113
|
* with custom HOCs.
|
|
@@ -327,14 +327,15 @@ const vShow = {
|
|
|
327
327
|
},
|
|
328
328
|
updated(el, { value, oldValue }, { transition }) {
|
|
329
329
|
if (!value === !oldValue) return;
|
|
330
|
-
if (transition)
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
330
|
+
if (transition) {
|
|
331
|
+
if (value) {
|
|
332
|
+
transition.beforeEnter(el);
|
|
333
|
+
setDisplay(el, true);
|
|
334
|
+
transition.enter(el);
|
|
335
|
+
} else transition.leave(el, () => {
|
|
336
|
+
setDisplay(el, false);
|
|
337
|
+
});
|
|
338
|
+
} else setDisplay(el, value);
|
|
338
339
|
},
|
|
339
340
|
beforeUnmount(el, { value }) {
|
|
340
341
|
setDisplay(el, value);
|
|
@@ -365,11 +366,13 @@ function patchStyle(el, prev, next) {
|
|
|
365
366
|
const isCssString = (0, _vue_shared.isString)(next);
|
|
366
367
|
let hasControlledDisplay = false;
|
|
367
368
|
if (next && !isCssString) {
|
|
368
|
-
if (prev)
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
369
|
+
if (prev) {
|
|
370
|
+
if (!(0, _vue_shared.isString)(prev)) {
|
|
371
|
+
for (const key in prev) if (next[key] == null) setStyle(style, key, "");
|
|
372
|
+
} else for (const prevStyle of prev.split(";")) {
|
|
373
|
+
const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
|
|
374
|
+
if (next[key] == null) setStyle(style, key, "");
|
|
375
|
+
}
|
|
373
376
|
}
|
|
374
377
|
for (const key in next) {
|
|
375
378
|
if (key === "display") hasControlledDisplay = true;
|
|
@@ -385,7 +388,11 @@ function patchStyle(el, prev, next) {
|
|
|
385
388
|
style.cssText = next;
|
|
386
389
|
hasControlledDisplay = displayRE.test(next);
|
|
387
390
|
}
|
|
388
|
-
} else if (prev)
|
|
391
|
+
} else if (prev) {
|
|
392
|
+
const cssVarText = style[CSS_VAR_TEXT];
|
|
393
|
+
if (cssVarText) style.cssText = cssVarText;
|
|
394
|
+
else el.removeAttribute("style");
|
|
395
|
+
}
|
|
389
396
|
if (vShowOriginalDisplay in el) {
|
|
390
397
|
el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
|
|
391
398
|
if (el[vShowHidden]) style.display = "none";
|
|
@@ -396,8 +403,10 @@ function setStyle(style, name, rawVal) {
|
|
|
396
403
|
if ((0, _vue_shared.isArray)(rawVal)) rawVal.forEach((v) => setStyle(style, name, v));
|
|
397
404
|
else {
|
|
398
405
|
const val = rawVal == null ? "" : String(rawVal);
|
|
399
|
-
if (name.startsWith("--"))
|
|
400
|
-
|
|
406
|
+
if (name.startsWith("--")) {
|
|
407
|
+
if (importantRE.test(val)) style.setProperty(name, val.replace(importantRE, ""), "important");
|
|
408
|
+
else style.setProperty(name, val);
|
|
409
|
+
} else {
|
|
401
410
|
const prefixed = autoPrefix(style, name);
|
|
402
411
|
if (importantRE.test(val)) style.setProperty((0, _vue_shared.hyphenate)(prefixed), val.replace(importantRE, ""), "important");
|
|
403
412
|
else style[prefixed] = val;
|
|
@@ -434,9 +443,10 @@ function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
|
|
|
434
443
|
//#region packages/runtime-dom/src/modules/attrs.ts
|
|
435
444
|
const xlinkNS = "http://www.w3.org/1999/xlink";
|
|
436
445
|
function patchAttr(el, key, value, isSVG, instance, isBoolean = (0, _vue_shared.isSpecialBooleanAttr)(key)) {
|
|
437
|
-
if (isSVG && key.startsWith("xlink:"))
|
|
438
|
-
|
|
439
|
-
|
|
446
|
+
if (isSVG && key.startsWith("xlink:")) {
|
|
447
|
+
if (value == null) el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
|
448
|
+
else el.setAttributeNS(xlinkNS, key, value);
|
|
449
|
+
} else if (value == null || isBoolean && !(0, _vue_shared.includeBooleanAttr)(value)) el.removeAttribute(key);
|
|
440
450
|
else el.setAttribute(key, isBoolean ? "" : (0, _vue_shared.isSymbol)(value) ? String(value) : value);
|
|
441
451
|
}
|
|
442
452
|
//#endregion
|
|
@@ -507,7 +517,7 @@ function parseEventName(name) {
|
|
|
507
517
|
return [name[2] === ":" ? name.slice(3) : (0, _vue_shared.hyphenate)(name.slice(2)), options];
|
|
508
518
|
}
|
|
509
519
|
let cachedNow = 0;
|
|
510
|
-
const p =
|
|
520
|
+
const p = /*@__PURE__*/ Promise.resolve();
|
|
511
521
|
const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
|
|
512
522
|
function createInvoker(initialValue, instance) {
|
|
513
523
|
const invoker = (e) => {
|
|
@@ -570,7 +580,7 @@ function shouldSetAsPropForVueCE(el, key) {
|
|
|
570
580
|
//#endregion
|
|
571
581
|
//#region packages/runtime-dom/src/apiCustomElement.ts
|
|
572
582
|
const REMOVAL = {};
|
|
573
|
-
|
|
583
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
574
584
|
function defineCustomElement(options, extraOptions, _createApp) {
|
|
575
585
|
let Comp = (0, _vue_runtime_core.defineComponent)(options, extraOptions);
|
|
576
586
|
if ((0, _vue_shared.isPlainObject)(Comp)) Comp = (0, _vue_shared.extend)({}, Comp, extraOptions);
|
|
@@ -619,12 +629,14 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
619
629
|
this._parent = parent;
|
|
620
630
|
break;
|
|
621
631
|
}
|
|
622
|
-
if (!this._instance)
|
|
623
|
-
|
|
624
|
-
this._pendingResolve =
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
632
|
+
if (!this._instance) {
|
|
633
|
+
if (this._resolved) this._mountComponent(this._def);
|
|
634
|
+
else if (parent && parent._pendingResolve) this._pendingResolve = parent._pendingResolve.then(() => {
|
|
635
|
+
this._pendingResolve = void 0;
|
|
636
|
+
if (this.isConnected) return this._resolveDef();
|
|
637
|
+
});
|
|
638
|
+
else this._resolveDef();
|
|
639
|
+
}
|
|
628
640
|
}
|
|
629
641
|
disconnectedCallback() {
|
|
630
642
|
this._connected = false;
|
|
@@ -658,7 +670,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
658
670
|
* resolve inner component definition (handle possible async component)
|
|
659
671
|
*/
|
|
660
672
|
_resolveDef() {
|
|
661
|
-
if (this._pendingResolve) return;
|
|
673
|
+
if (this._pendingResolve) return this._pendingResolve;
|
|
662
674
|
for (let i = 0; i < this.attributes.length; i++) this._setAttr(this.attributes[i].name);
|
|
663
675
|
this._ob = new MutationObserver(this._processMutations.bind(this));
|
|
664
676
|
this._ob.observe(this, { attributes: true });
|
|
@@ -687,6 +699,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
687
699
|
this._def = def;
|
|
688
700
|
resolve(def);
|
|
689
701
|
});
|
|
702
|
+
return this._pendingResolve;
|
|
690
703
|
} else resolve(this._def);
|
|
691
704
|
}
|
|
692
705
|
_mountComponent(def) {
|
|
@@ -816,13 +829,11 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
816
829
|
_renderSlots() {
|
|
817
830
|
const outlets = this._getSlots();
|
|
818
831
|
const scopeId = this._instance.type.__scopeId;
|
|
819
|
-
const slotReplacements = /* @__PURE__ */ new Map();
|
|
820
832
|
for (let i = 0; i < outlets.length; i++) {
|
|
821
833
|
const o = outlets[i];
|
|
822
834
|
const slotName = o.getAttribute("name") || "default";
|
|
823
835
|
const content = this._slots[slotName];
|
|
824
836
|
const parent = o.parentNode;
|
|
825
|
-
const replacementNodes = [];
|
|
826
837
|
if (content) for (const n of content) {
|
|
827
838
|
if (scopeId && n.nodeType === 1) {
|
|
828
839
|
const id = scopeId + "-s";
|
|
@@ -832,20 +843,10 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
832
843
|
while (child = walker.nextNode()) child.setAttribute(id, "");
|
|
833
844
|
}
|
|
834
845
|
parent.insertBefore(n, o);
|
|
835
|
-
replacementNodes.push(n);
|
|
836
|
-
}
|
|
837
|
-
else while (o.firstChild) {
|
|
838
|
-
const child = o.firstChild;
|
|
839
|
-
parent.insertBefore(child, o);
|
|
840
|
-
replacementNodes.push(child);
|
|
841
846
|
}
|
|
847
|
+
else while (o.firstChild) parent.insertBefore(o.firstChild, o);
|
|
842
848
|
parent.removeChild(o);
|
|
843
|
-
slotReplacements.set(o, {
|
|
844
|
-
nodes: replacementNodes,
|
|
845
|
-
usedFallback: !content
|
|
846
|
-
});
|
|
847
849
|
}
|
|
848
|
-
this._updateSlotNodes(slotReplacements);
|
|
849
850
|
}
|
|
850
851
|
/**
|
|
851
852
|
* @internal
|
|
@@ -884,7 +885,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
884
885
|
* @internal
|
|
885
886
|
*/
|
|
886
887
|
_hasShadowRoot() {
|
|
887
|
-
return this.
|
|
888
|
+
return this._root !== this;
|
|
888
889
|
}
|
|
889
890
|
/**
|
|
890
891
|
* @internal
|
|
@@ -917,10 +918,6 @@ var VueElement = class extends VueElementBase {
|
|
|
917
918
|
if (this._instance && this._instance.ce) this._instance.ce = void 0;
|
|
918
919
|
this._app = this._instance = null;
|
|
919
920
|
}
|
|
920
|
-
/**
|
|
921
|
-
* Only called when shadowRoot is false
|
|
922
|
-
*/
|
|
923
|
-
_updateSlotNodes(replacements) {}
|
|
924
921
|
_createVNode() {
|
|
925
922
|
const baseProps = {};
|
|
926
923
|
if (!this.shadowRoot) baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
|
|
@@ -975,7 +972,7 @@ const decorate = (t) => {
|
|
|
975
972
|
};
|
|
976
973
|
const TransitionGroup = /* @__PURE__ */ decorate({
|
|
977
974
|
name: "TransitionGroup",
|
|
978
|
-
props:
|
|
975
|
+
props: /*@__PURE__*/ (0, _vue_shared.extend)({}, TransitionPropsValidators, {
|
|
979
976
|
tag: String,
|
|
980
977
|
moveClass: String
|
|
981
978
|
}),
|
|
@@ -1105,13 +1102,22 @@ function onCompositionEnd(e) {
|
|
|
1105
1102
|
}
|
|
1106
1103
|
}
|
|
1107
1104
|
const assignKey = Symbol("_assign");
|
|
1105
|
+
const initialValueKey = Symbol("_initialValue");
|
|
1108
1106
|
const vModelText = {
|
|
1109
1107
|
created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
|
1108
|
+
if (el.parentNode) {
|
|
1109
|
+
if (el.type === "text") el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
|
|
1110
|
+
else if (el.type === "textarea") el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
|
|
1111
|
+
}
|
|
1110
1112
|
el[assignKey] = getModelAssigner(vnode);
|
|
1111
1113
|
vModelTextInit(el, trim, number || !!(vnode.props && vnode.props.type === "number"), lazy);
|
|
1112
1114
|
},
|
|
1113
|
-
mounted(el, { value }) {
|
|
1114
|
-
|
|
1115
|
+
mounted(el, { value, modifiers: { trim, number } }) {
|
|
1116
|
+
const newValue = value == null ? "" : value;
|
|
1117
|
+
const initialValue = el[initialValueKey];
|
|
1118
|
+
delete el[initialValueKey];
|
|
1119
|
+
if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) el[assignKey](castValue(el.value, trim, number));
|
|
1120
|
+
else el.value = newValue;
|
|
1115
1121
|
},
|
|
1116
1122
|
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
|
|
1117
1123
|
el[assignKey] = getModelAssigner(vnode);
|
|
@@ -1246,37 +1252,58 @@ const vModelSelectInit = (el, value, number, set) => {
|
|
|
1246
1252
|
el._modelValue = value;
|
|
1247
1253
|
addEventListener(el, "change", () => {
|
|
1248
1254
|
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map((o) => number ? (0, _vue_shared.looseToNumber)(getValue(o)) : getValue(o));
|
|
1249
|
-
|
|
1250
|
-
el.
|
|
1251
|
-
(0,
|
|
1252
|
-
|
|
1253
|
-
|
|
1255
|
+
const multiple = el.multiple;
|
|
1256
|
+
const assignedValue = multiple ? (0, _vue_shared.isSet)(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
|
|
1257
|
+
const pending = el._pendingValue = [multiple, multiple ? (0, _vue_shared.isArray)(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue];
|
|
1258
|
+
try {
|
|
1259
|
+
(set || el[assignKey])(assignedValue);
|
|
1260
|
+
} finally {
|
|
1261
|
+
(0, _vue_runtime_core.nextTick)(() => {
|
|
1262
|
+
if (el._pendingValue === pending) el._pendingValue = void 0;
|
|
1263
|
+
});
|
|
1264
|
+
}
|
|
1254
1265
|
});
|
|
1255
1266
|
};
|
|
1267
|
+
function isSameSelectValue(value, assignedValue, multiple) {
|
|
1268
|
+
if (!multiple) return (0, _vue_shared.looseEqual)(value, assignedValue);
|
|
1269
|
+
if ((0, _vue_shared.isArray)(value)) return (0, _vue_shared.looseEqual)(value, assignedValue);
|
|
1270
|
+
if ((0, _vue_shared.isSet)(value)) {
|
|
1271
|
+
if (value.size !== assignedValue.length) return false;
|
|
1272
|
+
for (const item of assignedValue) if (!value.has(item)) return false;
|
|
1273
|
+
return true;
|
|
1274
|
+
}
|
|
1275
|
+
return false;
|
|
1276
|
+
}
|
|
1256
1277
|
/**
|
|
1257
1278
|
* @internal
|
|
1258
1279
|
*/
|
|
1259
1280
|
const vModelSetSelected = (el, value) => {
|
|
1260
1281
|
el._modelValue = value;
|
|
1261
|
-
|
|
1282
|
+
const pending = el._pendingValue;
|
|
1283
|
+
el._pendingValue = void 0;
|
|
1284
|
+
if (pending && pending[0] === el.multiple && isSameSelectValue(value, pending[1], pending[0])) return;
|
|
1285
|
+
setSelected(el, value);
|
|
1286
|
+
};
|
|
1287
|
+
function setSelected(el, value) {
|
|
1262
1288
|
const isMultiple = el.multiple;
|
|
1263
1289
|
const isArrayValue = (0, _vue_shared.isArray)(value);
|
|
1264
1290
|
if (isMultiple && !isArrayValue && !(0, _vue_shared.isSet)(value)) return;
|
|
1265
1291
|
for (let i = 0, l = el.options.length; i < l; i++) {
|
|
1266
1292
|
const option = el.options[i];
|
|
1267
1293
|
const optionValue = getValue(option);
|
|
1268
|
-
if (isMultiple)
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1294
|
+
if (isMultiple) {
|
|
1295
|
+
if (isArrayValue) {
|
|
1296
|
+
const optionType = typeof optionValue;
|
|
1297
|
+
if (optionType === "string" || optionType === "number") option.selected = value.some((v) => String(v) === String(optionValue));
|
|
1298
|
+
else option.selected = (0, _vue_shared.looseIndexOf)(value, optionValue) > -1;
|
|
1299
|
+
} else option.selected = value.has(optionValue);
|
|
1300
|
+
} else if ((0, _vue_shared.looseEqual)(getValue(option), value)) {
|
|
1274
1301
|
if (el.selectedIndex !== i) el.selectedIndex = i;
|
|
1275
1302
|
return;
|
|
1276
1303
|
}
|
|
1277
1304
|
}
|
|
1278
1305
|
if (!isMultiple && el.selectedIndex !== -1) el.selectedIndex = -1;
|
|
1279
|
-
}
|
|
1306
|
+
}
|
|
1280
1307
|
/**
|
|
1281
1308
|
* @internal retrieve raw value set via :value bindings
|
|
1282
1309
|
*/
|
|
@@ -1396,7 +1423,7 @@ const withKeys = (fn, modifiers) => {
|
|
|
1396
1423
|
};
|
|
1397
1424
|
//#endregion
|
|
1398
1425
|
//#region packages/runtime-dom/src/index.ts
|
|
1399
|
-
const rendererOptions =
|
|
1426
|
+
const rendererOptions = /*@__PURE__*/ (0, _vue_shared.extend)({ patchProp }, nodeOps);
|
|
1400
1427
|
let renderer;
|
|
1401
1428
|
let enabledHydration = false;
|
|
1402
1429
|
function ensureRenderer() {
|