@vue/runtime-dom 3.6.0-beta.8 → 3.6.0-rc.1
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 +49 -29
- package/dist/runtime-dom.cjs.prod.js +49 -29
- package/dist/runtime-dom.d.ts +8 -2
- package/dist/runtime-dom.esm-browser.js +440 -209
- package/dist/runtime-dom.esm-browser.prod.js +3 -3
- package/dist/runtime-dom.esm-bundler.js +50 -30
- package/dist/runtime-dom.global.js +440 -209
- package/dist/runtime-dom.global.prod.js +3 -3
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.6.0-
|
|
2
|
+
* @vue/runtime-dom v3.6.0-rc.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -451,7 +451,10 @@ function patchStyle(el, prev, next) {
|
|
|
451
451
|
}
|
|
452
452
|
for (const key in next) {
|
|
453
453
|
if (key === "display") hasControlledDisplay = true;
|
|
454
|
-
|
|
454
|
+
const value = next[key];
|
|
455
|
+
if (value != null) {
|
|
456
|
+
if (!shouldPreserveTextareaResizeStyle(el, key, !isString(prev) && prev ? prev[key] : void 0, value)) setStyle(style, key, value);
|
|
457
|
+
} else setStyle(style, key, "");
|
|
455
458
|
}
|
|
456
459
|
} else if (isCssString) {
|
|
457
460
|
if (prev !== next) {
|
|
@@ -501,6 +504,14 @@ function autoPrefix(style, rawName) {
|
|
|
501
504
|
}
|
|
502
505
|
return rawName;
|
|
503
506
|
}
|
|
507
|
+
/**
|
|
508
|
+
* Browsers update textarea width/height directly during native resize.
|
|
509
|
+
* Only special-case this common textarea path for now; other resize scenarios
|
|
510
|
+
* still follow normal vnode style patching.
|
|
511
|
+
*/
|
|
512
|
+
function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
|
|
513
|
+
return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && isString(next) && prev === next;
|
|
514
|
+
}
|
|
504
515
|
//#endregion
|
|
505
516
|
//#region packages/runtime-dom/src/modules/attrs.ts
|
|
506
517
|
const xlinkNS = "http://www.w3.org/1999/xlink";
|
|
@@ -559,7 +570,7 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
|
559
570
|
const existingInvoker = invokers[rawName];
|
|
560
571
|
if (nextValue && existingInvoker) existingInvoker.value = !!(process.env.NODE_ENV !== "production") ? sanitizeEventValue(nextValue, rawName) : nextValue;
|
|
561
572
|
else {
|
|
562
|
-
const [name, options] =
|
|
573
|
+
const [name, options] = parseEventName(rawName);
|
|
563
574
|
if (nextValue) addEventListener(el, name, invokers[rawName] = createInvoker(!!(process.env.NODE_ENV !== "production") ? sanitizeEventValue(nextValue, rawName) : nextValue, instance), options);
|
|
564
575
|
else if (existingInvoker) {
|
|
565
576
|
removeEventListener(el, name, existingInvoker, options);
|
|
@@ -567,16 +578,15 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
|
567
578
|
}
|
|
568
579
|
}
|
|
569
580
|
}
|
|
570
|
-
const optionsModifierRE = /(
|
|
571
|
-
|
|
581
|
+
const optionsModifierRE = /(Once|Passive|Capture)$/;
|
|
582
|
+
const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
|
|
583
|
+
function parseEventName(name) {
|
|
572
584
|
let options;
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
options[m[0].toLowerCase()] = true;
|
|
579
|
-
}
|
|
585
|
+
let m;
|
|
586
|
+
while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
|
|
587
|
+
if (!options) options = {};
|
|
588
|
+
name = name.slice(0, name.length - m[1].length);
|
|
589
|
+
options[m[1].toLowerCase()] = true;
|
|
580
590
|
}
|
|
581
591
|
return [name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)), options];
|
|
582
592
|
}
|
|
@@ -587,7 +597,21 @@ function createInvoker(initialValue, instance) {
|
|
|
587
597
|
const invoker = (e) => {
|
|
588
598
|
if (!e._vts) e._vts = Date.now();
|
|
589
599
|
else if (e._vts <= invoker.attached) return;
|
|
590
|
-
|
|
600
|
+
const value = invoker.value;
|
|
601
|
+
if (isArray(value)) {
|
|
602
|
+
const originalStop = e.stopImmediatePropagation;
|
|
603
|
+
e.stopImmediatePropagation = () => {
|
|
604
|
+
originalStop.call(e);
|
|
605
|
+
e._stopped = true;
|
|
606
|
+
};
|
|
607
|
+
const handlers = value.slice();
|
|
608
|
+
const args = [e];
|
|
609
|
+
for (let i = 0; i < handlers.length; i++) {
|
|
610
|
+
if (e._stopped) break;
|
|
611
|
+
const handler = handlers[i];
|
|
612
|
+
if (handler) callWithAsyncErrorHandling(handler, instance, 5, args);
|
|
613
|
+
}
|
|
614
|
+
} else callWithAsyncErrorHandling(value, instance, 5, [e]);
|
|
591
615
|
};
|
|
592
616
|
invoker.value = initialValue;
|
|
593
617
|
invoker.attached = getNow();
|
|
@@ -598,16 +622,6 @@ function sanitizeEventValue(value, propName) {
|
|
|
598
622
|
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}.`);
|
|
599
623
|
return NOOP;
|
|
600
624
|
}
|
|
601
|
-
function patchStopImmediatePropagation(e, value) {
|
|
602
|
-
if (isArray(value)) {
|
|
603
|
-
const originalStop = e.stopImmediatePropagation;
|
|
604
|
-
e.stopImmediatePropagation = () => {
|
|
605
|
-
originalStop.call(e);
|
|
606
|
-
e._stopped = true;
|
|
607
|
-
};
|
|
608
|
-
return value.map((fn) => (e) => !e._stopped && fn && fn(e));
|
|
609
|
-
} else return value;
|
|
610
|
-
}
|
|
611
625
|
//#endregion
|
|
612
626
|
//#region packages/runtime-dom/src/patchProp.ts
|
|
613
627
|
const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
|
|
@@ -935,7 +949,10 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
935
949
|
replacementNodes.push(child);
|
|
936
950
|
}
|
|
937
951
|
parent.removeChild(o);
|
|
938
|
-
slotReplacements.set(o,
|
|
952
|
+
slotReplacements.set(o, {
|
|
953
|
+
nodes: replacementNodes,
|
|
954
|
+
usedFallback: !content
|
|
955
|
+
});
|
|
939
956
|
}
|
|
940
957
|
this._updateSlotNodes(slotReplacements);
|
|
941
958
|
}
|
|
@@ -1125,7 +1142,7 @@ const TransitionGroup = /* @__PURE__ */ decorate({
|
|
|
1125
1142
|
prevChildren = [];
|
|
1126
1143
|
if (children) for (let i = 0; i < children.length; i++) {
|
|
1127
1144
|
const child = children[i];
|
|
1128
|
-
if (child.el && child.el instanceof Element) {
|
|
1145
|
+
if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
|
|
1129
1146
|
prevChildren.push(child);
|
|
1130
1147
|
setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
|
|
1131
1148
|
positionMap.set(child, getPosition(child.el));
|
|
@@ -1266,7 +1283,8 @@ const vModelTextUpdate = (el, oldValue, value, trim, number, lazy) => {
|
|
|
1266
1283
|
const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
|
|
1267
1284
|
const newValue = value == null ? "" : value;
|
|
1268
1285
|
if (elValue === newValue) return;
|
|
1269
|
-
|
|
1286
|
+
const rootNode = el.getRootNode();
|
|
1287
|
+
if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement === el && el.type !== "range") {
|
|
1270
1288
|
if (lazy && value === oldValue) return;
|
|
1271
1289
|
if (trim && el.value.trim() === newValue) return;
|
|
1272
1290
|
}
|
|
@@ -1348,7 +1366,8 @@ const vModelSelect = {
|
|
|
1348
1366
|
mounted(el, { value }) {
|
|
1349
1367
|
vModelSetSelected(el, value);
|
|
1350
1368
|
},
|
|
1351
|
-
beforeUpdate(el,
|
|
1369
|
+
beforeUpdate(el, { value }, vnode) {
|
|
1370
|
+
el._modelValue = value;
|
|
1352
1371
|
el[assignKey] = getModelAssigner(vnode);
|
|
1353
1372
|
},
|
|
1354
1373
|
updated(el, { value }) {
|
|
@@ -1359,10 +1378,10 @@ const vModelSelect = {
|
|
|
1359
1378
|
* @internal
|
|
1360
1379
|
*/
|
|
1361
1380
|
const vModelSelectInit = (el, value, number, set) => {
|
|
1362
|
-
|
|
1381
|
+
el._modelValue = value;
|
|
1363
1382
|
addEventListener(el, "change", () => {
|
|
1364
1383
|
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map((o) => number ? looseToNumber(getValue(o)) : getValue(o));
|
|
1365
|
-
(set || el[assignKey])(el.multiple ?
|
|
1384
|
+
(set || el[assignKey])(el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]);
|
|
1366
1385
|
el._assigning = true;
|
|
1367
1386
|
nextTick(() => {
|
|
1368
1387
|
el._assigning = false;
|
|
@@ -1373,6 +1392,7 @@ const vModelSelectInit = (el, value, number, set) => {
|
|
|
1373
1392
|
* @internal
|
|
1374
1393
|
*/
|
|
1375
1394
|
const vModelSetSelected = (el, value) => {
|
|
1395
|
+
el._modelValue = value;
|
|
1376
1396
|
if (el._assigning) return;
|
|
1377
1397
|
const isMultiple = el.multiple;
|
|
1378
1398
|
const isArrayValue = isArray(value);
|
|
@@ -1625,4 +1645,4 @@ const initDirectivesForSSR = () => {
|
|
|
1625
1645
|
}
|
|
1626
1646
|
};
|
|
1627
1647
|
//#endregion
|
|
1628
|
-
export { Transition, TransitionGroup, TransitionPropsValidators, VueElement, VueElementBase, baseApplyTranslation, baseUseCssVars, callPendingCbs, createApp, createSSRApp, defineCustomElement, defineSSRCustomElement, ensureHydrationRenderer, ensureRenderer, forceReflow, handleMovedChildren, hasCSSTransform, hydrate, initDirectivesForSSR, nodeOps, normalizeContainer, patchProp, patchStyle, render, resolveTransitionProps, setVarsOnNode, shouldSetAsProp, shouldSetAsPropForVueCE, svgNS, unsafeToTrustedHTML, useCssModule, useCssVars, useHost, useShadowRoot, vModelCheckbox, vModelCheckboxInit, vModelCheckboxUpdate, vModelDynamic, getValue as vModelGetValue, vModelRadio, vModelSelect, vModelSelectInit, vModelSetSelected, vModelText, vModelTextInit, vModelTextUpdate, vShow, vShowHidden, vShowOriginalDisplay, withKeys, withModifiers, xlinkNS };
|
|
1648
|
+
export { Transition, TransitionGroup, TransitionPropsValidators, VueElement, VueElementBase, baseApplyTranslation, baseUseCssVars, callPendingCbs, createApp, createSSRApp, defineCustomElement, defineSSRCustomElement, ensureHydrationRenderer, ensureRenderer, forceReflow, handleMovedChildren, hasCSSTransform, hydrate, initDirectivesForSSR, nodeOps, normalizeContainer, parseEventName, patchProp, patchStyle, render, resolveTransitionProps, setVarsOnNode, shouldSetAsProp, shouldSetAsPropForVueCE, svgNS, unsafeToTrustedHTML, useCssModule, useCssVars, useHost, useShadowRoot, vModelCheckbox, vModelCheckboxInit, vModelCheckboxUpdate, vModelDynamic, getValue as vModelGetValue, vModelRadio, vModelSelect, vModelSelectInit, vModelSetSelected, vModelText, vModelTextInit, vModelTextUpdate, vShow, vShowHidden, vShowOriginalDisplay, withKeys, withModifiers, xlinkNS };
|