@vue/runtime-dom 3.5.0-alpha.1 → 3.5.0-alpha.3
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 +35 -49
- package/dist/runtime-dom.cjs.prod.js +35 -49
- package/dist/runtime-dom.d.ts +10 -5
- package/dist/runtime-dom.esm-browser.js +4905 -4715
- package/dist/runtime-dom.esm-browser.prod.js +2 -9
- package/dist/runtime-dom.esm-bundler.js +37 -52
- package/dist/runtime-dom.global.js +5427 -5335
- package/dist/runtime-dom.global.prod.js +2 -9
- package/package.json +4 -3
package/dist/runtime-dom.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.5.0-alpha.
|
|
2
|
+
* @vue/runtime-dom v3.5.0-alpha.3
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -25,7 +25,7 @@ const nodeOps = {
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
createElement: (tag, namespace, is, props) => {
|
|
28
|
-
const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : doc.createElement(tag,
|
|
28
|
+
const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
|
|
29
29
|
if (tag === "select" && props && props.multiple != null) {
|
|
30
30
|
el.setAttribute("multiple", props.multiple);
|
|
31
31
|
}
|
|
@@ -54,8 +54,7 @@ const nodeOps = {
|
|
|
54
54
|
if (start && (start === end || start.nextSibling)) {
|
|
55
55
|
while (true) {
|
|
56
56
|
parent.insertBefore(start.cloneNode(true), anchor);
|
|
57
|
-
if (start === end || !(start = start.nextSibling))
|
|
58
|
-
break;
|
|
57
|
+
if (start === end || !(start = start.nextSibling)) break;
|
|
59
58
|
}
|
|
60
59
|
} else {
|
|
61
60
|
templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
|
|
@@ -339,8 +338,7 @@ function getTimeout(delays, durations) {
|
|
|
339
338
|
return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
|
|
340
339
|
}
|
|
341
340
|
function toMs(s) {
|
|
342
|
-
if (s === "auto")
|
|
343
|
-
return 0;
|
|
341
|
+
if (s === "auto") return 0;
|
|
344
342
|
return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
|
|
345
343
|
}
|
|
346
344
|
function forceReflow() {
|
|
@@ -378,8 +376,7 @@ const vShow = {
|
|
|
378
376
|
}
|
|
379
377
|
},
|
|
380
378
|
updated(el, { value, oldValue }, { transition }) {
|
|
381
|
-
if (!value === !oldValue)
|
|
382
|
-
return;
|
|
379
|
+
if (!value === !oldValue) return;
|
|
383
380
|
if (transition) {
|
|
384
381
|
if (value) {
|
|
385
382
|
transition.beforeEnter(el);
|
|
@@ -473,8 +470,7 @@ function setStyle(style, name, val) {
|
|
|
473
470
|
if (shared.isArray(val)) {
|
|
474
471
|
val.forEach((v) => setStyle(style, name, v));
|
|
475
472
|
} else {
|
|
476
|
-
if (val == null)
|
|
477
|
-
val = "";
|
|
473
|
+
if (val == null) val = "";
|
|
478
474
|
{
|
|
479
475
|
if (semicolonRE.test(val)) {
|
|
480
476
|
runtimeCore.warn(
|
|
@@ -520,7 +516,7 @@ function autoPrefix(style, rawName) {
|
|
|
520
516
|
}
|
|
521
517
|
|
|
522
518
|
const xlinkNS = "http://www.w3.org/1999/xlink";
|
|
523
|
-
function patchAttr(el, key, value, isSVG, instance) {
|
|
519
|
+
function patchAttr(el, key, value, isSVG, instance, isBoolean = shared.isSpecialBooleanAttr(key)) {
|
|
524
520
|
if (isSVG && key.startsWith("xlink:")) {
|
|
525
521
|
if (value == null) {
|
|
526
522
|
el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
|
@@ -528,28 +524,28 @@ function patchAttr(el, key, value, isSVG, instance) {
|
|
|
528
524
|
el.setAttributeNS(xlinkNS, key, value);
|
|
529
525
|
}
|
|
530
526
|
} else {
|
|
531
|
-
const isBoolean = shared.isSpecialBooleanAttr(key);
|
|
532
527
|
if (value == null || isBoolean && !shared.includeBooleanAttr(value)) {
|
|
533
528
|
el.removeAttribute(key);
|
|
534
529
|
} else {
|
|
535
|
-
el.setAttribute(
|
|
530
|
+
el.setAttribute(
|
|
531
|
+
key,
|
|
532
|
+
isBoolean ? "" : shared.isSymbol(value) ? String(value) : value
|
|
533
|
+
);
|
|
536
534
|
}
|
|
537
535
|
}
|
|
538
536
|
}
|
|
539
537
|
|
|
540
|
-
function patchDOMProp(el, key, value,
|
|
538
|
+
function patchDOMProp(el, key, value, parentComponent) {
|
|
541
539
|
if (key === "innerHTML" || key === "textContent") {
|
|
542
|
-
if (
|
|
543
|
-
|
|
544
|
-
}
|
|
545
|
-
el[key] = value == null ? "" : value;
|
|
540
|
+
if (value == null) return;
|
|
541
|
+
el[key] = value;
|
|
546
542
|
return;
|
|
547
543
|
}
|
|
548
544
|
const tag = el.tagName;
|
|
549
545
|
if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
|
|
550
546
|
!tag.includes("-")) {
|
|
551
547
|
const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
|
|
552
|
-
const newValue = value == null ? "" : value;
|
|
548
|
+
const newValue = value == null ? "" : String(value);
|
|
553
549
|
if (oldValue !== newValue || !("_value" in el)) {
|
|
554
550
|
el.value = newValue;
|
|
555
551
|
}
|
|
@@ -673,7 +669,7 @@ function patchStopImmediatePropagation(e, value) {
|
|
|
673
669
|
|
|
674
670
|
const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
|
|
675
671
|
key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
|
|
676
|
-
const patchProp = (el, key, prevValue, nextValue, namespace,
|
|
672
|
+
const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
|
|
677
673
|
const isSVG = namespace === "svg";
|
|
678
674
|
if (key === "class") {
|
|
679
675
|
patchClass(el, nextValue, isSVG);
|
|
@@ -684,15 +680,10 @@ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, paren
|
|
|
684
680
|
patchEvent(el, key, prevValue, nextValue, parentComponent);
|
|
685
681
|
}
|
|
686
682
|
} else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
|
|
687
|
-
patchDOMProp(
|
|
688
|
-
|
|
689
|
-
key,
|
|
690
|
-
|
|
691
|
-
prevChildren,
|
|
692
|
-
parentComponent,
|
|
693
|
-
parentSuspense,
|
|
694
|
-
unmountChildren
|
|
695
|
-
);
|
|
683
|
+
patchDOMProp(el, key, nextValue);
|
|
684
|
+
if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
|
|
685
|
+
patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
|
|
686
|
+
}
|
|
696
687
|
} else {
|
|
697
688
|
if (key === "true-value") {
|
|
698
689
|
el._trueValue = nextValue;
|
|
@@ -738,8 +729,8 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
738
729
|
|
|
739
730
|
/*! #__NO_SIDE_EFFECTS__ */
|
|
740
731
|
// @__NO_SIDE_EFFECTS__
|
|
741
|
-
function defineCustomElement(options, hydrate2) {
|
|
742
|
-
const Comp = runtimeCore.defineComponent(options);
|
|
732
|
+
function defineCustomElement(options, extraOptions, hydrate2) {
|
|
733
|
+
const Comp = runtimeCore.defineComponent(options, extraOptions);
|
|
743
734
|
class VueCustomElement extends VueElement {
|
|
744
735
|
constructor(initialProps) {
|
|
745
736
|
super(Comp, initialProps, hydrate2);
|
|
@@ -749,8 +740,8 @@ function defineCustomElement(options, hydrate2) {
|
|
|
749
740
|
return VueCustomElement;
|
|
750
741
|
}
|
|
751
742
|
/*! #__NO_SIDE_EFFECTS__ */
|
|
752
|
-
const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options) => {
|
|
753
|
-
return /* @__PURE__ */ defineCustomElement(options, hydrate);
|
|
743
|
+
const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
|
|
744
|
+
return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
|
|
754
745
|
};
|
|
755
746
|
const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
|
|
756
747
|
};
|
|
@@ -793,12 +784,12 @@ class VueElement extends BaseClass {
|
|
|
793
784
|
}
|
|
794
785
|
disconnectedCallback() {
|
|
795
786
|
this._connected = false;
|
|
796
|
-
if (this._ob) {
|
|
797
|
-
this._ob.disconnect();
|
|
798
|
-
this._ob = null;
|
|
799
|
-
}
|
|
800
787
|
runtimeCore.nextTick(() => {
|
|
801
788
|
if (!this._connected) {
|
|
789
|
+
if (this._ob) {
|
|
790
|
+
this._ob.disconnect();
|
|
791
|
+
this._ob = null;
|
|
792
|
+
}
|
|
802
793
|
render(null, this.shadowRoot);
|
|
803
794
|
this._instance = null;
|
|
804
795
|
}
|
|
@@ -1134,8 +1125,7 @@ const vModelText = {
|
|
|
1134
1125
|
el[assignKey] = getModelAssigner(vnode);
|
|
1135
1126
|
const castToNumber = number || vnode.props && vnode.props.type === "number";
|
|
1136
1127
|
addEventListener(el, lazy ? "change" : "input", (e) => {
|
|
1137
|
-
if (e.target.composing)
|
|
1138
|
-
return;
|
|
1128
|
+
if (e.target.composing) return;
|
|
1139
1129
|
let domValue = el.value;
|
|
1140
1130
|
if (trim) {
|
|
1141
1131
|
domValue = domValue.trim();
|
|
@@ -1160,17 +1150,16 @@ const vModelText = {
|
|
|
1160
1150
|
mounted(el, { value }) {
|
|
1161
1151
|
el.value = value == null ? "" : value;
|
|
1162
1152
|
},
|
|
1163
|
-
beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
|
|
1153
|
+
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
|
|
1164
1154
|
el[assignKey] = getModelAssigner(vnode);
|
|
1165
|
-
if (el.composing)
|
|
1166
|
-
return;
|
|
1155
|
+
if (el.composing) return;
|
|
1167
1156
|
const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? shared.looseToNumber(el.value) : el.value;
|
|
1168
1157
|
const newValue = value == null ? "" : value;
|
|
1169
1158
|
if (elValue === newValue) {
|
|
1170
1159
|
return;
|
|
1171
1160
|
}
|
|
1172
1161
|
if (document.activeElement === el && el.type !== "range") {
|
|
1173
|
-
if (lazy) {
|
|
1162
|
+
if (lazy && value === oldValue) {
|
|
1174
1163
|
return;
|
|
1175
1164
|
}
|
|
1176
1165
|
if (trim && el.value.trim() === newValue) {
|
|
@@ -1302,8 +1291,7 @@ function setSelected(el, value, number) {
|
|
|
1302
1291
|
option.selected = value.has(optionValue);
|
|
1303
1292
|
}
|
|
1304
1293
|
} else if (shared.looseEqual(getValue(option), value)) {
|
|
1305
|
-
if (el.selectedIndex !== i)
|
|
1306
|
-
el.selectedIndex = i;
|
|
1294
|
+
if (el.selectedIndex !== i) el.selectedIndex = i;
|
|
1307
1295
|
return;
|
|
1308
1296
|
}
|
|
1309
1297
|
}
|
|
@@ -1412,8 +1400,7 @@ const withModifiers = (fn, modifiers) => {
|
|
|
1412
1400
|
return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
|
|
1413
1401
|
for (let i = 0; i < modifiers.length; i++) {
|
|
1414
1402
|
const guard = modifierGuards[modifiers[i]];
|
|
1415
|
-
if (guard && guard(event, modifiers))
|
|
1416
|
-
return;
|
|
1403
|
+
if (guard && guard(event, modifiers)) return;
|
|
1417
1404
|
}
|
|
1418
1405
|
return fn(event, ...args);
|
|
1419
1406
|
});
|
|
@@ -1469,8 +1456,7 @@ const createApp = (...args) => {
|
|
|
1469
1456
|
const { mount } = app;
|
|
1470
1457
|
app.mount = (containerOrSelector) => {
|
|
1471
1458
|
const container = normalizeContainer(containerOrSelector);
|
|
1472
|
-
if (!container)
|
|
1473
|
-
return;
|
|
1459
|
+
if (!container) return;
|
|
1474
1460
|
const component = app._component;
|
|
1475
1461
|
if (!shared.isFunction(component) && !component.render && !component.template) {
|
|
1476
1462
|
component.template = container.innerHTML;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.5.0-alpha.
|
|
2
|
+
* @vue/runtime-dom v3.5.0-alpha.3
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -25,7 +25,7 @@ const nodeOps = {
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
createElement: (tag, namespace, is, props) => {
|
|
28
|
-
const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : doc.createElement(tag,
|
|
28
|
+
const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
|
|
29
29
|
if (tag === "select" && props && props.multiple != null) {
|
|
30
30
|
el.setAttribute("multiple", props.multiple);
|
|
31
31
|
}
|
|
@@ -54,8 +54,7 @@ const nodeOps = {
|
|
|
54
54
|
if (start && (start === end || start.nextSibling)) {
|
|
55
55
|
while (true) {
|
|
56
56
|
parent.insertBefore(start.cloneNode(true), anchor);
|
|
57
|
-
if (start === end || !(start = start.nextSibling))
|
|
58
|
-
break;
|
|
57
|
+
if (start === end || !(start = start.nextSibling)) break;
|
|
59
58
|
}
|
|
60
59
|
} else {
|
|
61
60
|
templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
|
|
@@ -336,8 +335,7 @@ function getTimeout(delays, durations) {
|
|
|
336
335
|
return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
|
|
337
336
|
}
|
|
338
337
|
function toMs(s) {
|
|
339
|
-
if (s === "auto")
|
|
340
|
-
return 0;
|
|
338
|
+
if (s === "auto") return 0;
|
|
341
339
|
return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
|
|
342
340
|
}
|
|
343
341
|
function forceReflow() {
|
|
@@ -375,8 +373,7 @@ const vShow = {
|
|
|
375
373
|
}
|
|
376
374
|
},
|
|
377
375
|
updated(el, { value, oldValue }, { transition }) {
|
|
378
|
-
if (!value === !oldValue)
|
|
379
|
-
return;
|
|
376
|
+
if (!value === !oldValue) return;
|
|
380
377
|
if (transition) {
|
|
381
378
|
if (value) {
|
|
382
379
|
transition.beforeEnter(el);
|
|
@@ -466,8 +463,7 @@ function setStyle(style, name, val) {
|
|
|
466
463
|
if (shared.isArray(val)) {
|
|
467
464
|
val.forEach((v) => setStyle(style, name, v));
|
|
468
465
|
} else {
|
|
469
|
-
if (val == null)
|
|
470
|
-
val = "";
|
|
466
|
+
if (val == null) val = "";
|
|
471
467
|
if (name.startsWith("--")) {
|
|
472
468
|
style.setProperty(name, val);
|
|
473
469
|
} else {
|
|
@@ -506,7 +502,7 @@ function autoPrefix(style, rawName) {
|
|
|
506
502
|
}
|
|
507
503
|
|
|
508
504
|
const xlinkNS = "http://www.w3.org/1999/xlink";
|
|
509
|
-
function patchAttr(el, key, value, isSVG, instance) {
|
|
505
|
+
function patchAttr(el, key, value, isSVG, instance, isBoolean = shared.isSpecialBooleanAttr(key)) {
|
|
510
506
|
if (isSVG && key.startsWith("xlink:")) {
|
|
511
507
|
if (value == null) {
|
|
512
508
|
el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
|
@@ -514,28 +510,28 @@ function patchAttr(el, key, value, isSVG, instance) {
|
|
|
514
510
|
el.setAttributeNS(xlinkNS, key, value);
|
|
515
511
|
}
|
|
516
512
|
} else {
|
|
517
|
-
const isBoolean = shared.isSpecialBooleanAttr(key);
|
|
518
513
|
if (value == null || isBoolean && !shared.includeBooleanAttr(value)) {
|
|
519
514
|
el.removeAttribute(key);
|
|
520
515
|
} else {
|
|
521
|
-
el.setAttribute(
|
|
516
|
+
el.setAttribute(
|
|
517
|
+
key,
|
|
518
|
+
isBoolean ? "" : shared.isSymbol(value) ? String(value) : value
|
|
519
|
+
);
|
|
522
520
|
}
|
|
523
521
|
}
|
|
524
522
|
}
|
|
525
523
|
|
|
526
|
-
function patchDOMProp(el, key, value,
|
|
524
|
+
function patchDOMProp(el, key, value, parentComponent) {
|
|
527
525
|
if (key === "innerHTML" || key === "textContent") {
|
|
528
|
-
if (
|
|
529
|
-
|
|
530
|
-
}
|
|
531
|
-
el[key] = value == null ? "" : value;
|
|
526
|
+
if (value == null) return;
|
|
527
|
+
el[key] = value;
|
|
532
528
|
return;
|
|
533
529
|
}
|
|
534
530
|
const tag = el.tagName;
|
|
535
531
|
if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
|
|
536
532
|
!tag.includes("-")) {
|
|
537
533
|
const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
|
|
538
|
-
const newValue = value == null ? "" : value;
|
|
534
|
+
const newValue = value == null ? "" : String(value);
|
|
539
535
|
if (oldValue !== newValue || !("_value" in el)) {
|
|
540
536
|
el.value = newValue;
|
|
541
537
|
}
|
|
@@ -643,7 +639,7 @@ function patchStopImmediatePropagation(e, value) {
|
|
|
643
639
|
|
|
644
640
|
const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
|
|
645
641
|
key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
|
|
646
|
-
const patchProp = (el, key, prevValue, nextValue, namespace,
|
|
642
|
+
const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
|
|
647
643
|
const isSVG = namespace === "svg";
|
|
648
644
|
if (key === "class") {
|
|
649
645
|
patchClass(el, nextValue, isSVG);
|
|
@@ -654,15 +650,10 @@ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, paren
|
|
|
654
650
|
patchEvent(el, key, prevValue, nextValue, parentComponent);
|
|
655
651
|
}
|
|
656
652
|
} else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
|
|
657
|
-
patchDOMProp(
|
|
658
|
-
|
|
659
|
-
key,
|
|
660
|
-
|
|
661
|
-
prevChildren,
|
|
662
|
-
parentComponent,
|
|
663
|
-
parentSuspense,
|
|
664
|
-
unmountChildren
|
|
665
|
-
);
|
|
653
|
+
patchDOMProp(el, key, nextValue);
|
|
654
|
+
if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
|
|
655
|
+
patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
|
|
656
|
+
}
|
|
666
657
|
} else {
|
|
667
658
|
if (key === "true-value") {
|
|
668
659
|
el._trueValue = nextValue;
|
|
@@ -708,8 +699,8 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
708
699
|
|
|
709
700
|
/*! #__NO_SIDE_EFFECTS__ */
|
|
710
701
|
// @__NO_SIDE_EFFECTS__
|
|
711
|
-
function defineCustomElement(options, hydrate2) {
|
|
712
|
-
const Comp = runtimeCore.defineComponent(options);
|
|
702
|
+
function defineCustomElement(options, extraOptions, hydrate2) {
|
|
703
|
+
const Comp = runtimeCore.defineComponent(options, extraOptions);
|
|
713
704
|
class VueCustomElement extends VueElement {
|
|
714
705
|
constructor(initialProps) {
|
|
715
706
|
super(Comp, initialProps, hydrate2);
|
|
@@ -719,8 +710,8 @@ function defineCustomElement(options, hydrate2) {
|
|
|
719
710
|
return VueCustomElement;
|
|
720
711
|
}
|
|
721
712
|
/*! #__NO_SIDE_EFFECTS__ */
|
|
722
|
-
const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options) => {
|
|
723
|
-
return /* @__PURE__ */ defineCustomElement(options, hydrate);
|
|
713
|
+
const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
|
|
714
|
+
return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
|
|
724
715
|
};
|
|
725
716
|
const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
|
|
726
717
|
};
|
|
@@ -758,12 +749,12 @@ class VueElement extends BaseClass {
|
|
|
758
749
|
}
|
|
759
750
|
disconnectedCallback() {
|
|
760
751
|
this._connected = false;
|
|
761
|
-
if (this._ob) {
|
|
762
|
-
this._ob.disconnect();
|
|
763
|
-
this._ob = null;
|
|
764
|
-
}
|
|
765
752
|
runtimeCore.nextTick(() => {
|
|
766
753
|
if (!this._connected) {
|
|
754
|
+
if (this._ob) {
|
|
755
|
+
this._ob.disconnect();
|
|
756
|
+
this._ob = null;
|
|
757
|
+
}
|
|
767
758
|
render(null, this.shadowRoot);
|
|
768
759
|
this._instance = null;
|
|
769
760
|
}
|
|
@@ -1080,8 +1071,7 @@ const vModelText = {
|
|
|
1080
1071
|
el[assignKey] = getModelAssigner(vnode);
|
|
1081
1072
|
const castToNumber = number || vnode.props && vnode.props.type === "number";
|
|
1082
1073
|
addEventListener(el, lazy ? "change" : "input", (e) => {
|
|
1083
|
-
if (e.target.composing)
|
|
1084
|
-
return;
|
|
1074
|
+
if (e.target.composing) return;
|
|
1085
1075
|
let domValue = el.value;
|
|
1086
1076
|
if (trim) {
|
|
1087
1077
|
domValue = domValue.trim();
|
|
@@ -1106,17 +1096,16 @@ const vModelText = {
|
|
|
1106
1096
|
mounted(el, { value }) {
|
|
1107
1097
|
el.value = value == null ? "" : value;
|
|
1108
1098
|
},
|
|
1109
|
-
beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
|
|
1099
|
+
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
|
|
1110
1100
|
el[assignKey] = getModelAssigner(vnode);
|
|
1111
|
-
if (el.composing)
|
|
1112
|
-
return;
|
|
1101
|
+
if (el.composing) return;
|
|
1113
1102
|
const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? shared.looseToNumber(el.value) : el.value;
|
|
1114
1103
|
const newValue = value == null ? "" : value;
|
|
1115
1104
|
if (elValue === newValue) {
|
|
1116
1105
|
return;
|
|
1117
1106
|
}
|
|
1118
1107
|
if (document.activeElement === el && el.type !== "range") {
|
|
1119
|
-
if (lazy) {
|
|
1108
|
+
if (lazy && value === oldValue) {
|
|
1120
1109
|
return;
|
|
1121
1110
|
}
|
|
1122
1111
|
if (trim && el.value.trim() === newValue) {
|
|
@@ -1245,8 +1234,7 @@ function setSelected(el, value, number) {
|
|
|
1245
1234
|
option.selected = value.has(optionValue);
|
|
1246
1235
|
}
|
|
1247
1236
|
} else if (shared.looseEqual(getValue(option), value)) {
|
|
1248
|
-
if (el.selectedIndex !== i)
|
|
1249
|
-
el.selectedIndex = i;
|
|
1237
|
+
if (el.selectedIndex !== i) el.selectedIndex = i;
|
|
1250
1238
|
return;
|
|
1251
1239
|
}
|
|
1252
1240
|
}
|
|
@@ -1355,8 +1343,7 @@ const withModifiers = (fn, modifiers) => {
|
|
|
1355
1343
|
return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
|
|
1356
1344
|
for (let i = 0; i < modifiers.length; i++) {
|
|
1357
1345
|
const guard = modifierGuards[modifiers[i]];
|
|
1358
|
-
if (guard && guard(event, modifiers))
|
|
1359
|
-
return;
|
|
1346
|
+
if (guard && guard(event, modifiers)) return;
|
|
1360
1347
|
}
|
|
1361
1348
|
return fn(event, ...args);
|
|
1362
1349
|
});
|
|
@@ -1408,8 +1395,7 @@ const createApp = (...args) => {
|
|
|
1408
1395
|
const { mount } = app;
|
|
1409
1396
|
app.mount = (containerOrSelector) => {
|
|
1410
1397
|
const container = normalizeContainer(containerOrSelector);
|
|
1411
|
-
if (!container)
|
|
1412
|
-
return;
|
|
1398
|
+
if (!container) return;
|
|
1413
1399
|
const component = app._component;
|
|
1414
1400
|
if (!shared.isFunction(component) && !component.render && !component.template) {
|
|
1415
1401
|
component.template = container.innerHTML;
|
package/dist/runtime-dom.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseTransitionProps, FunctionalComponent, ObjectDirective, Directive, SetupContext, RenderFunction, ComponentObjectPropsOptions, EmitsOptions, ComputedOptions, MethodOptions, ComponentOptionsMixin, ComponentInjectOptions, SlotsType, Component, ComponentProvideOptions, ExtractPropTypes, EmitsToProps, ComponentOptionsBase,
|
|
1
|
+
import { BaseTransitionProps, FunctionalComponent, ObjectDirective, Directive, SetupContext, RenderFunction, ComponentOptions, ComponentObjectPropsOptions, EmitsOptions, ComputedOptions, MethodOptions, ComponentOptionsMixin, ComponentInjectOptions, SlotsType, Component, ComponentProvideOptions, ExtractPropTypes, EmitsToProps, ComponentOptionsBase, CreateComponentPublicInstanceWithMixins, DefineComponent, RootHydrateFunction, ConcreteComponent, VNodeRef, RootRenderFunction, CreateAppFunction } from '@vue/runtime-core';
|
|
2
2
|
export * from '@vue/runtime-core';
|
|
3
3
|
import * as CSS from 'csstype';
|
|
4
4
|
|
|
@@ -104,13 +104,18 @@ type VModelDirective = typeof vModelText | typeof vModelCheckbox | typeof vModel
|
|
|
104
104
|
export type VueElementConstructor<P = {}> = {
|
|
105
105
|
new (initialProps?: Record<string, any>): VueElement & P;
|
|
106
106
|
};
|
|
107
|
-
export declare function defineCustomElement<Props, RawBindings = object>(setup: (props:
|
|
107
|
+
export declare function defineCustomElement<Props, RawBindings = object>(setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs' | 'emits'> & {
|
|
108
|
+
props?: (keyof Props)[];
|
|
109
|
+
}): VueElementConstructor<Props>;
|
|
110
|
+
export declare function defineCustomElement<Props, RawBindings = object>(setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs' | 'emits'> & {
|
|
111
|
+
props?: ComponentObjectPropsOptions<Props>;
|
|
112
|
+
}): VueElementConstructor<Props>;
|
|
108
113
|
export declare function defineCustomElement<RuntimePropsOptions extends ComponentObjectPropsOptions = ComponentObjectPropsOptions, PropsKeys extends string = string, RuntimeEmitsOptions extends EmitsOptions = {}, EmitsKeys extends string = string, Data = {}, SetupBindings = {}, Computed extends ComputedOptions = {}, Methods extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, InjectOptions extends ComponentInjectOptions = {}, InjectKeys extends string = string, Slots extends SlotsType = {}, LocalComponents extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, InferredProps = string extends PropsKeys ? ComponentObjectPropsOptions extends RuntimePropsOptions ? {} : ExtractPropTypes<RuntimePropsOptions> : {
|
|
109
114
|
[key in PropsKeys]?: any;
|
|
110
115
|
}, ResolvedProps = InferredProps & EmitsToProps<RuntimeEmitsOptions>>(options: {
|
|
111
116
|
props?: (RuntimePropsOptions & ThisType<void>) | PropsKeys[];
|
|
112
117
|
} & ComponentOptionsBase<ResolvedProps, SetupBindings, Data, Computed, Methods, Mixin, Extends, RuntimeEmitsOptions, EmitsKeys, {}, // Defaults
|
|
113
|
-
InjectOptions, InjectKeys, Slots, LocalComponents, Directives, Exposed, Provide> & ThisType<
|
|
118
|
+
InjectOptions, InjectKeys, Slots, LocalComponents, Directives, Exposed, Provide> & ThisType<CreateComponentPublicInstanceWithMixins<Readonly<ResolvedProps>, SetupBindings, Data, Computed, Methods, Mixin, Extends, RuntimeEmitsOptions, EmitsKeys, {}, false, InjectOptions, Slots, LocalComponents, Directives, Exposed>>): VueElementConstructor<ResolvedProps>;
|
|
114
119
|
export declare function defineCustomElement<P>(options: DefineComponent<P, any, any, any>): VueElementConstructor<ExtractPropTypes<P>>;
|
|
115
120
|
/*! #__NO_SIDE_EFFECTS__ */
|
|
116
121
|
export declare const defineSSRCustomElement: typeof defineCustomElement;
|
|
@@ -464,7 +469,7 @@ export interface DataHTMLAttributes extends HTMLAttributes {
|
|
|
464
469
|
}
|
|
465
470
|
export interface DetailsHTMLAttributes extends HTMLAttributes {
|
|
466
471
|
open?: Booleanish;
|
|
467
|
-
onToggle?:
|
|
472
|
+
onToggle?: (payload: ToggleEvent) => void;
|
|
468
473
|
}
|
|
469
474
|
export interface DelHTMLAttributes extends HTMLAttributes {
|
|
470
475
|
cite?: string;
|
|
@@ -1317,7 +1322,7 @@ type EventHandlers<E> = {
|
|
|
1317
1322
|
};
|
|
1318
1323
|
|
|
1319
1324
|
export type ReservedProps = {
|
|
1320
|
-
key?:
|
|
1325
|
+
key?: PropertyKey;
|
|
1321
1326
|
ref?: VNodeRef;
|
|
1322
1327
|
ref_for?: boolean;
|
|
1323
1328
|
ref_key?: string;
|