@vue/runtime-dom 3.6.0-beta.9 → 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 +47 -28
- package/dist/runtime-dom.cjs.prod.js +47 -28
- package/dist/runtime-dom.d.ts +8 -2
- package/dist/runtime-dom.esm-browser.js +395 -193
- package/dist/runtime-dom.esm-browser.prod.js +3 -3
- package/dist/runtime-dom.esm-bundler.js +48 -29
- package/dist/runtime-dom.global.js +395 -193
- package/dist/runtime-dom.global.prod.js +3 -3
- package/package.json +4 -4
package/dist/runtime-dom.cjs.js
CHANGED
|
@@ -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
|
**/
|
|
@@ -377,7 +377,10 @@ function patchStyle(el, prev, next) {
|
|
|
377
377
|
}
|
|
378
378
|
for (const key in next) {
|
|
379
379
|
if (key === "display") hasControlledDisplay = true;
|
|
380
|
-
|
|
380
|
+
const value = next[key];
|
|
381
|
+
if (value != null) {
|
|
382
|
+
if (!shouldPreserveTextareaResizeStyle(el, key, !(0, _vue_shared.isString)(prev) && prev ? prev[key] : void 0, value)) setStyle(style, key, value);
|
|
383
|
+
} else setStyle(style, key, "");
|
|
381
384
|
}
|
|
382
385
|
} else if (isCssString) {
|
|
383
386
|
if (prev !== next) {
|
|
@@ -425,6 +428,14 @@ function autoPrefix(style, rawName) {
|
|
|
425
428
|
}
|
|
426
429
|
return rawName;
|
|
427
430
|
}
|
|
431
|
+
/**
|
|
432
|
+
* Browsers update textarea width/height directly during native resize.
|
|
433
|
+
* Only special-case this common textarea path for now; other resize scenarios
|
|
434
|
+
* still follow normal vnode style patching.
|
|
435
|
+
*/
|
|
436
|
+
function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
|
|
437
|
+
return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && (0, _vue_shared.isString)(next) && prev === next;
|
|
438
|
+
}
|
|
428
439
|
//#endregion
|
|
429
440
|
//#region packages/runtime-dom/src/modules/attrs.ts
|
|
430
441
|
const xlinkNS = "http://www.w3.org/1999/xlink";
|
|
@@ -483,7 +494,7 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
|
483
494
|
const existingInvoker = invokers[rawName];
|
|
484
495
|
if (nextValue && existingInvoker) existingInvoker.value = sanitizeEventValue(nextValue, rawName);
|
|
485
496
|
else {
|
|
486
|
-
const [name, options] =
|
|
497
|
+
const [name, options] = parseEventName(rawName);
|
|
487
498
|
if (nextValue) addEventListener(el, name, invokers[rawName] = createInvoker(sanitizeEventValue(nextValue, rawName), instance), options);
|
|
488
499
|
else if (existingInvoker) {
|
|
489
500
|
removeEventListener(el, name, existingInvoker, options);
|
|
@@ -491,16 +502,15 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
|
491
502
|
}
|
|
492
503
|
}
|
|
493
504
|
}
|
|
494
|
-
const optionsModifierRE = /(
|
|
495
|
-
|
|
505
|
+
const optionsModifierRE = /(Once|Passive|Capture)$/;
|
|
506
|
+
const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
|
|
507
|
+
function parseEventName(name) {
|
|
496
508
|
let options;
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
options[m[0].toLowerCase()] = true;
|
|
503
|
-
}
|
|
509
|
+
let m;
|
|
510
|
+
while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
|
|
511
|
+
if (!options) options = {};
|
|
512
|
+
name = name.slice(0, name.length - m[1].length);
|
|
513
|
+
options[m[1].toLowerCase()] = true;
|
|
504
514
|
}
|
|
505
515
|
return [name[2] === ":" ? name.slice(3) : (0, _vue_shared.hyphenate)(name.slice(2)), options];
|
|
506
516
|
}
|
|
@@ -511,7 +521,21 @@ function createInvoker(initialValue, instance) {
|
|
|
511
521
|
const invoker = (e) => {
|
|
512
522
|
if (!e._vts) e._vts = Date.now();
|
|
513
523
|
else if (e._vts <= invoker.attached) return;
|
|
514
|
-
|
|
524
|
+
const value = invoker.value;
|
|
525
|
+
if ((0, _vue_shared.isArray)(value)) {
|
|
526
|
+
const originalStop = e.stopImmediatePropagation;
|
|
527
|
+
e.stopImmediatePropagation = () => {
|
|
528
|
+
originalStop.call(e);
|
|
529
|
+
e._stopped = true;
|
|
530
|
+
};
|
|
531
|
+
const handlers = value.slice();
|
|
532
|
+
const args = [e];
|
|
533
|
+
for (let i = 0; i < handlers.length; i++) {
|
|
534
|
+
if (e._stopped) break;
|
|
535
|
+
const handler = handlers[i];
|
|
536
|
+
if (handler) (0, _vue_runtime_core.callWithAsyncErrorHandling)(handler, instance, 5, args);
|
|
537
|
+
}
|
|
538
|
+
} else (0, _vue_runtime_core.callWithAsyncErrorHandling)(value, instance, 5, [e]);
|
|
515
539
|
};
|
|
516
540
|
invoker.value = initialValue;
|
|
517
541
|
invoker.attached = getNow();
|
|
@@ -522,16 +546,6 @@ function sanitizeEventValue(value, propName) {
|
|
|
522
546
|
(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}.`);
|
|
523
547
|
return _vue_shared.NOOP;
|
|
524
548
|
}
|
|
525
|
-
function patchStopImmediatePropagation(e, value) {
|
|
526
|
-
if ((0, _vue_shared.isArray)(value)) {
|
|
527
|
-
const originalStop = e.stopImmediatePropagation;
|
|
528
|
-
e.stopImmediatePropagation = () => {
|
|
529
|
-
originalStop.call(e);
|
|
530
|
-
e._stopped = true;
|
|
531
|
-
};
|
|
532
|
-
return value.map((fn) => (e) => !e._stopped && fn && fn(e));
|
|
533
|
-
} else return value;
|
|
534
|
-
}
|
|
535
549
|
//#endregion
|
|
536
550
|
//#region packages/runtime-dom/src/patchProp.ts
|
|
537
551
|
const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
|
|
@@ -859,7 +873,10 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
859
873
|
replacementNodes.push(child);
|
|
860
874
|
}
|
|
861
875
|
parent.removeChild(o);
|
|
862
|
-
slotReplacements.set(o,
|
|
876
|
+
slotReplacements.set(o, {
|
|
877
|
+
nodes: replacementNodes,
|
|
878
|
+
usedFallback: !content
|
|
879
|
+
});
|
|
863
880
|
}
|
|
864
881
|
this._updateSlotNodes(slotReplacements);
|
|
865
882
|
}
|
|
@@ -1047,7 +1064,7 @@ const TransitionGroup = /* @__PURE__ */ decorate({
|
|
|
1047
1064
|
prevChildren = [];
|
|
1048
1065
|
if (children) for (let i = 0; i < children.length; i++) {
|
|
1049
1066
|
const child = children[i];
|
|
1050
|
-
if (child.el && child.el instanceof Element) {
|
|
1067
|
+
if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
|
|
1051
1068
|
prevChildren.push(child);
|
|
1052
1069
|
(0, _vue_runtime_core.setTransitionHooks)(child, (0, _vue_runtime_core.resolveTransitionHooks)(child, cssTransitionProps, state, instance));
|
|
1053
1070
|
positionMap.set(child, getPosition(child.el));
|
|
@@ -1271,7 +1288,8 @@ const vModelSelect = {
|
|
|
1271
1288
|
mounted(el, { value }) {
|
|
1272
1289
|
vModelSetSelected(el, value);
|
|
1273
1290
|
},
|
|
1274
|
-
beforeUpdate(el,
|
|
1291
|
+
beforeUpdate(el, { value }, vnode) {
|
|
1292
|
+
el._modelValue = value;
|
|
1275
1293
|
el[assignKey] = getModelAssigner(vnode);
|
|
1276
1294
|
},
|
|
1277
1295
|
updated(el, { value }) {
|
|
@@ -1282,10 +1300,10 @@ const vModelSelect = {
|
|
|
1282
1300
|
* @internal
|
|
1283
1301
|
*/
|
|
1284
1302
|
const vModelSelectInit = (el, value, number, set) => {
|
|
1285
|
-
|
|
1303
|
+
el._modelValue = value;
|
|
1286
1304
|
addEventListener(el, "change", () => {
|
|
1287
1305
|
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map((o) => number ? (0, _vue_shared.looseToNumber)(getValue(o)) : getValue(o));
|
|
1288
|
-
(set || el[assignKey])(el.multiple ?
|
|
1306
|
+
(set || el[assignKey])(el.multiple ? (0, _vue_shared.isSet)(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]);
|
|
1289
1307
|
el._assigning = true;
|
|
1290
1308
|
(0, _vue_runtime_core.nextTick)(() => {
|
|
1291
1309
|
el._assigning = false;
|
|
@@ -1296,6 +1314,7 @@ const vModelSelectInit = (el, value, number, set) => {
|
|
|
1296
1314
|
* @internal
|
|
1297
1315
|
*/
|
|
1298
1316
|
const vModelSetSelected = (el, value) => {
|
|
1317
|
+
el._modelValue = value;
|
|
1299
1318
|
if (el._assigning) return;
|
|
1300
1319
|
const isMultiple = el.multiple;
|
|
1301
1320
|
const isArrayValue = (0, _vue_shared.isArray)(value);
|
|
@@ -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
|
**/
|
|
@@ -373,7 +373,10 @@ function patchStyle(el, prev, next) {
|
|
|
373
373
|
}
|
|
374
374
|
for (const key in next) {
|
|
375
375
|
if (key === "display") hasControlledDisplay = true;
|
|
376
|
-
|
|
376
|
+
const value = next[key];
|
|
377
|
+
if (value != null) {
|
|
378
|
+
if (!shouldPreserveTextareaResizeStyle(el, key, !(0, _vue_shared.isString)(prev) && prev ? prev[key] : void 0, value)) setStyle(style, key, value);
|
|
379
|
+
} else setStyle(style, key, "");
|
|
377
380
|
}
|
|
378
381
|
} else if (isCssString) {
|
|
379
382
|
if (prev !== next) {
|
|
@@ -419,6 +422,14 @@ function autoPrefix(style, rawName) {
|
|
|
419
422
|
}
|
|
420
423
|
return rawName;
|
|
421
424
|
}
|
|
425
|
+
/**
|
|
426
|
+
* Browsers update textarea width/height directly during native resize.
|
|
427
|
+
* Only special-case this common textarea path for now; other resize scenarios
|
|
428
|
+
* still follow normal vnode style patching.
|
|
429
|
+
*/
|
|
430
|
+
function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
|
|
431
|
+
return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && (0, _vue_shared.isString)(next) && prev === next;
|
|
432
|
+
}
|
|
422
433
|
//#endregion
|
|
423
434
|
//#region packages/runtime-dom/src/modules/attrs.ts
|
|
424
435
|
const xlinkNS = "http://www.w3.org/1999/xlink";
|
|
@@ -475,7 +486,7 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
|
475
486
|
const existingInvoker = invokers[rawName];
|
|
476
487
|
if (nextValue && existingInvoker) existingInvoker.value = nextValue;
|
|
477
488
|
else {
|
|
478
|
-
const [name, options] =
|
|
489
|
+
const [name, options] = parseEventName(rawName);
|
|
479
490
|
if (nextValue) addEventListener(el, name, invokers[rawName] = createInvoker(nextValue, instance), options);
|
|
480
491
|
else if (existingInvoker) {
|
|
481
492
|
removeEventListener(el, name, existingInvoker, options);
|
|
@@ -483,16 +494,15 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
|
483
494
|
}
|
|
484
495
|
}
|
|
485
496
|
}
|
|
486
|
-
const optionsModifierRE = /(
|
|
487
|
-
|
|
497
|
+
const optionsModifierRE = /(Once|Passive|Capture)$/;
|
|
498
|
+
const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
|
|
499
|
+
function parseEventName(name) {
|
|
488
500
|
let options;
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
options[m[0].toLowerCase()] = true;
|
|
495
|
-
}
|
|
501
|
+
let m;
|
|
502
|
+
while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
|
|
503
|
+
if (!options) options = {};
|
|
504
|
+
name = name.slice(0, name.length - m[1].length);
|
|
505
|
+
options[m[1].toLowerCase()] = true;
|
|
496
506
|
}
|
|
497
507
|
return [name[2] === ":" ? name.slice(3) : (0, _vue_shared.hyphenate)(name.slice(2)), options];
|
|
498
508
|
}
|
|
@@ -503,22 +513,26 @@ function createInvoker(initialValue, instance) {
|
|
|
503
513
|
const invoker = (e) => {
|
|
504
514
|
if (!e._vts) e._vts = Date.now();
|
|
505
515
|
else if (e._vts <= invoker.attached) return;
|
|
506
|
-
|
|
516
|
+
const value = invoker.value;
|
|
517
|
+
if ((0, _vue_shared.isArray)(value)) {
|
|
518
|
+
const originalStop = e.stopImmediatePropagation;
|
|
519
|
+
e.stopImmediatePropagation = () => {
|
|
520
|
+
originalStop.call(e);
|
|
521
|
+
e._stopped = true;
|
|
522
|
+
};
|
|
523
|
+
const handlers = value.slice();
|
|
524
|
+
const args = [e];
|
|
525
|
+
for (let i = 0; i < handlers.length; i++) {
|
|
526
|
+
if (e._stopped) break;
|
|
527
|
+
const handler = handlers[i];
|
|
528
|
+
if (handler) (0, _vue_runtime_core.callWithAsyncErrorHandling)(handler, instance, 5, args);
|
|
529
|
+
}
|
|
530
|
+
} else (0, _vue_runtime_core.callWithAsyncErrorHandling)(value, instance, 5, [e]);
|
|
507
531
|
};
|
|
508
532
|
invoker.value = initialValue;
|
|
509
533
|
invoker.attached = getNow();
|
|
510
534
|
return invoker;
|
|
511
535
|
}
|
|
512
|
-
function patchStopImmediatePropagation(e, value) {
|
|
513
|
-
if ((0, _vue_shared.isArray)(value)) {
|
|
514
|
-
const originalStop = e.stopImmediatePropagation;
|
|
515
|
-
e.stopImmediatePropagation = () => {
|
|
516
|
-
originalStop.call(e);
|
|
517
|
-
e._stopped = true;
|
|
518
|
-
};
|
|
519
|
-
return value.map((fn) => (e) => !e._stopped && fn && fn(e));
|
|
520
|
-
} else return value;
|
|
521
|
-
}
|
|
522
536
|
//#endregion
|
|
523
537
|
//#region packages/runtime-dom/src/patchProp.ts
|
|
524
538
|
const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
|
|
@@ -826,7 +840,10 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
826
840
|
replacementNodes.push(child);
|
|
827
841
|
}
|
|
828
842
|
parent.removeChild(o);
|
|
829
|
-
slotReplacements.set(o,
|
|
843
|
+
slotReplacements.set(o, {
|
|
844
|
+
nodes: replacementNodes,
|
|
845
|
+
usedFallback: !content
|
|
846
|
+
});
|
|
830
847
|
}
|
|
831
848
|
this._updateSlotNodes(slotReplacements);
|
|
832
849
|
}
|
|
@@ -991,7 +1008,7 @@ const TransitionGroup = /* @__PURE__ */ decorate({
|
|
|
991
1008
|
prevChildren = [];
|
|
992
1009
|
if (children) for (let i = 0; i < children.length; i++) {
|
|
993
1010
|
const child = children[i];
|
|
994
|
-
if (child.el && child.el instanceof Element) {
|
|
1011
|
+
if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
|
|
995
1012
|
prevChildren.push(child);
|
|
996
1013
|
(0, _vue_runtime_core.setTransitionHooks)(child, (0, _vue_runtime_core.resolveTransitionHooks)(child, cssTransitionProps, state, instance));
|
|
997
1014
|
positionMap.set(child, getPosition(child.el));
|
|
@@ -1214,7 +1231,8 @@ const vModelSelect = {
|
|
|
1214
1231
|
mounted(el, { value }) {
|
|
1215
1232
|
vModelSetSelected(el, value);
|
|
1216
1233
|
},
|
|
1217
|
-
beforeUpdate(el,
|
|
1234
|
+
beforeUpdate(el, { value }, vnode) {
|
|
1235
|
+
el._modelValue = value;
|
|
1218
1236
|
el[assignKey] = getModelAssigner(vnode);
|
|
1219
1237
|
},
|
|
1220
1238
|
updated(el, { value }) {
|
|
@@ -1225,10 +1243,10 @@ const vModelSelect = {
|
|
|
1225
1243
|
* @internal
|
|
1226
1244
|
*/
|
|
1227
1245
|
const vModelSelectInit = (el, value, number, set) => {
|
|
1228
|
-
|
|
1246
|
+
el._modelValue = value;
|
|
1229
1247
|
addEventListener(el, "change", () => {
|
|
1230
1248
|
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map((o) => number ? (0, _vue_shared.looseToNumber)(getValue(o)) : getValue(o));
|
|
1231
|
-
(set || el[assignKey])(el.multiple ?
|
|
1249
|
+
(set || el[assignKey])(el.multiple ? (0, _vue_shared.isSet)(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]);
|
|
1232
1250
|
el._assigning = true;
|
|
1233
1251
|
(0, _vue_runtime_core.nextTick)(() => {
|
|
1234
1252
|
el._assigning = false;
|
|
@@ -1239,6 +1257,7 @@ const vModelSelectInit = (el, value, number, set) => {
|
|
|
1239
1257
|
* @internal
|
|
1240
1258
|
*/
|
|
1241
1259
|
const vModelSetSelected = (el, value) => {
|
|
1260
|
+
el._modelValue = value;
|
|
1242
1261
|
if (el._assigning) return;
|
|
1243
1262
|
const isMultiple = el.multiple;
|
|
1244
1263
|
const isArrayValue = (0, _vue_shared.isArray)(value);
|
package/dist/runtime-dom.d.ts
CHANGED
|
@@ -1371,7 +1371,10 @@ export declare abstract class VueElementBase<E = Element, C = Component, Def ext
|
|
|
1371
1371
|
protected abstract _mount(def: Def): void;
|
|
1372
1372
|
protected abstract _update(): void;
|
|
1373
1373
|
protected abstract _unmount(): void;
|
|
1374
|
-
protected abstract _updateSlotNodes(slot: Map<Node,
|
|
1374
|
+
protected abstract _updateSlotNodes(slot: Map<Node, {
|
|
1375
|
+
nodes: Node[];
|
|
1376
|
+
usedFallback: boolean;
|
|
1377
|
+
}>): void;
|
|
1375
1378
|
constructor(def: Def, props: Record<string, any> | undefined, createAppFn: CreateAppFunction<E, C>);
|
|
1376
1379
|
connectedCallback(): void;
|
|
1377
1380
|
disconnectedCallback(): void;
|
|
@@ -1408,7 +1411,10 @@ export declare class VueElement extends VueElementBase<Element, Component, Inner
|
|
|
1408
1411
|
/**
|
|
1409
1412
|
* Only called when shadowRoot is false
|
|
1410
1413
|
*/
|
|
1411
|
-
protected _updateSlotNodes(replacements: Map<Node,
|
|
1414
|
+
protected _updateSlotNodes(replacements: Map<Node, {
|
|
1415
|
+
nodes: Node[];
|
|
1416
|
+
usedFallback: boolean;
|
|
1417
|
+
}>): void;
|
|
1412
1418
|
private _createVNode;
|
|
1413
1419
|
}
|
|
1414
1420
|
export declare function useHost(caller?: string): VueElementBase | null;
|