@vue/runtime-dom 3.6.0-beta.7 → 3.6.0-beta.9
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 +52 -33
- package/dist/runtime-dom.cjs.prod.js +50 -33
- package/dist/runtime-dom.d.ts +122 -115
- package/dist/runtime-dom.esm-browser.js +167 -193
- package/dist/runtime-dom.esm-browser.prod.js +3 -3
- package/dist/runtime-dom.esm-bundler.js +43 -30
- package/dist/runtime-dom.global.js +528 -556
- package/dist/runtime-dom.global.prod.js +3 -3
- package/package.json +4 -4
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.6.0-beta.
|
|
2
|
+
* @vue/runtime-dom v3.6.0-beta.9
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
6
|
import { BaseTransition, BaseTransitionPropsValidators, Fragment, Static, Text, assertNumber, callWithAsyncErrorHandling, camelize, createHydrationRenderer, createRenderer, createVNode, defineComponent, getCurrentInstance, getTransitionRawChildren, h, isRuntimeOnly, nextTick, onBeforeUpdate, onMounted, onUnmounted, onUpdated, queuePostFlushCb, resolveTransitionHooks, setIsHydratingEnabled, setTransitionHooks, toRaw, unref, useInstanceOption, useTransitionState, warn, watch } from "@vue/runtime-core";
|
|
7
7
|
import { EMPTY_OBJ, NOOP, camelize as camelize$1, canSetValueDirectly, capitalize, extend, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isFunction, isHTMLTag, isMathMLTag, isModelListener, isNativeOn, isObject, isOn, isPlainObject, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, looseEqual, looseIndexOf, looseToNumber, normalizeCssVarValue, shouldSetAsAttr, toNumber } from "@vue/shared";
|
|
8
|
-
|
|
9
|
-
export * from "@vue/runtime-core"
|
|
10
|
-
|
|
8
|
+
export * from "@vue/runtime-core";
|
|
11
9
|
//#region packages/runtime-dom/src/nodeOps.ts
|
|
12
10
|
let policy = void 0;
|
|
13
11
|
const tt = typeof window !== "undefined" && window.trustedTypes;
|
|
@@ -67,7 +65,6 @@ const nodeOps = {
|
|
|
67
65
|
return [before ? before.nextSibling : parent.firstChild, anchor ? anchor.previousSibling : parent.lastChild];
|
|
68
66
|
}
|
|
69
67
|
};
|
|
70
|
-
|
|
71
68
|
//#endregion
|
|
72
69
|
//#region packages/runtime-dom/src/components/Transition.ts
|
|
73
70
|
const TRANSITION = "transition";
|
|
@@ -306,7 +303,6 @@ function toMs(s) {
|
|
|
306
303
|
function forceReflow(el) {
|
|
307
304
|
return (el ? el.ownerDocument : document).body.offsetHeight;
|
|
308
305
|
}
|
|
309
|
-
|
|
310
306
|
//#endregion
|
|
311
307
|
//#region packages/runtime-dom/src/modules/class.ts
|
|
312
308
|
function patchClass(el, value, isSVG) {
|
|
@@ -316,7 +312,6 @@ function patchClass(el, value, isSVG) {
|
|
|
316
312
|
else if (isSVG) el.setAttribute("class", value);
|
|
317
313
|
else el.className = value;
|
|
318
314
|
}
|
|
319
|
-
|
|
320
315
|
//#endregion
|
|
321
316
|
//#region packages/runtime-dom/src/directives/vShow.ts
|
|
322
317
|
const vShowOriginalDisplay = Symbol("_vod");
|
|
@@ -355,7 +350,6 @@ function initVShowForSSR() {
|
|
|
355
350
|
if (!value) return { style: { display: "none" } };
|
|
356
351
|
};
|
|
357
352
|
}
|
|
358
|
-
|
|
359
353
|
//#endregion
|
|
360
354
|
//#region packages/runtime-dom/src/helpers/useCssVars.ts
|
|
361
355
|
const CSS_VAR_TEXT = Symbol(!!(process.env.NODE_ENV !== "production") ? "CSS_VAR_TEXT" : "");
|
|
@@ -441,7 +435,6 @@ function setVarsOnNode(el, vars) {
|
|
|
441
435
|
style[CSS_VAR_TEXT] = cssText;
|
|
442
436
|
}
|
|
443
437
|
}
|
|
444
|
-
|
|
445
438
|
//#endregion
|
|
446
439
|
//#region packages/runtime-dom/src/modules/style.ts
|
|
447
440
|
const displayRE = /(?:^|;)\s*display\s*:/;
|
|
@@ -508,7 +501,6 @@ function autoPrefix(style, rawName) {
|
|
|
508
501
|
}
|
|
509
502
|
return rawName;
|
|
510
503
|
}
|
|
511
|
-
|
|
512
504
|
//#endregion
|
|
513
505
|
//#region packages/runtime-dom/src/modules/attrs.ts
|
|
514
506
|
const xlinkNS = "http://www.w3.org/1999/xlink";
|
|
@@ -518,7 +510,6 @@ function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBoolean
|
|
|
518
510
|
else if (value == null || isBoolean && !includeBooleanAttr(value)) el.removeAttribute(key);
|
|
519
511
|
else el.setAttribute(key, isBoolean ? "" : isSymbol(value) ? String(value) : value);
|
|
520
512
|
}
|
|
521
|
-
|
|
522
513
|
//#endregion
|
|
523
514
|
//#region packages/runtime-dom/src/modules/props.ts
|
|
524
515
|
function patchDOMProp(el, key, value, parentComponent, attrName) {
|
|
@@ -554,7 +545,6 @@ function patchDOMProp(el, key, value, parentComponent, attrName) {
|
|
|
554
545
|
}
|
|
555
546
|
needRemove && el.removeAttribute(attrName || key);
|
|
556
547
|
}
|
|
557
|
-
|
|
558
548
|
//#endregion
|
|
559
549
|
//#region packages/runtime-dom/src/modules/events.ts
|
|
560
550
|
function addEventListener(el, event, handler, options) {
|
|
@@ -618,7 +608,6 @@ function patchStopImmediatePropagation(e, value) {
|
|
|
618
608
|
return value.map((fn) => (e) => !e._stopped && fn && fn(e));
|
|
619
609
|
} else return value;
|
|
620
610
|
}
|
|
621
|
-
|
|
622
611
|
//#endregion
|
|
623
612
|
//#region packages/runtime-dom/src/patchProp.ts
|
|
624
613
|
const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
|
|
@@ -630,7 +619,7 @@ const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) =>
|
|
|
630
619
|
} else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
|
|
631
620
|
patchDOMProp(el, key, nextValue, parentComponent);
|
|
632
621
|
if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
|
|
633
|
-
} else if (el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))) patchDOMProp(el, camelize$1(key), nextValue, parentComponent, key);
|
|
622
|
+
} else if (el._isVueCE && (shouldSetAsPropForVueCE(el, key) || el._def.__asyncLoader && (/[A-Z]/.test(key) || !isString(nextValue)))) patchDOMProp(el, camelize$1(key), nextValue, parentComponent, key);
|
|
634
623
|
else {
|
|
635
624
|
if (key === "true-value") el._trueValue = nextValue;
|
|
636
625
|
else if (key === "false-value") el._falseValue = nextValue;
|
|
@@ -647,7 +636,12 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
647
636
|
if (isNativeOn(key) && isString(value)) return false;
|
|
648
637
|
return key in el;
|
|
649
638
|
}
|
|
650
|
-
|
|
639
|
+
function shouldSetAsPropForVueCE(el, key) {
|
|
640
|
+
const props = el._def.props;
|
|
641
|
+
if (!props) return false;
|
|
642
|
+
const camelKey = camelize$1(key);
|
|
643
|
+
return Array.isArray(props) ? props.some((prop) => camelize$1(prop) === camelKey) : Object.keys(props).some((prop) => camelize$1(prop) === camelKey);
|
|
644
|
+
}
|
|
651
645
|
//#endregion
|
|
652
646
|
//#region packages/runtime-dom/src/apiCustomElement.ts
|
|
653
647
|
const REMOVAL = {};
|
|
@@ -677,6 +671,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
677
671
|
this._resolved = false;
|
|
678
672
|
this._numberProps = null;
|
|
679
673
|
this._styleChildren = /* @__PURE__ */ new WeakSet();
|
|
674
|
+
this._styleAnchors = /* @__PURE__ */ new WeakMap();
|
|
680
675
|
this._patching = false;
|
|
681
676
|
this._dirty = false;
|
|
682
677
|
this._ob = null;
|
|
@@ -695,7 +690,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
695
690
|
if (!this.shadowRoot && !this._resolved) this._parseSlots();
|
|
696
691
|
this._connected = true;
|
|
697
692
|
let parent = this;
|
|
698
|
-
while (parent = parent && (parent.parentNode || parent.host)) if (parent instanceof VueElementBase) {
|
|
693
|
+
while (parent = parent && (parent.assignedSlot || parent.parentNode || parent.host)) if (parent instanceof VueElementBase) {
|
|
699
694
|
this._parent = parent;
|
|
700
695
|
break;
|
|
701
696
|
}
|
|
@@ -788,6 +783,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
788
783
|
this._styles.forEach((s) => this._root.removeChild(s));
|
|
789
784
|
this._styles.length = 0;
|
|
790
785
|
}
|
|
786
|
+
this._styleAnchors.delete(this._def);
|
|
791
787
|
this._applyStyles(newStyles);
|
|
792
788
|
if (!this._instance.vapor) this._instance = null;
|
|
793
789
|
this._update();
|
|
@@ -853,18 +849,26 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
853
849
|
}
|
|
854
850
|
}
|
|
855
851
|
}
|
|
856
|
-
_applyStyles(styles, owner) {
|
|
852
|
+
_applyStyles(styles, owner, parentComp) {
|
|
857
853
|
if (!styles) return;
|
|
858
854
|
if (owner) {
|
|
859
855
|
if (owner === this._def || this._styleChildren.has(owner)) return;
|
|
860
856
|
this._styleChildren.add(owner);
|
|
861
857
|
}
|
|
862
858
|
const nonce = this._nonce;
|
|
859
|
+
const root = this.shadowRoot;
|
|
860
|
+
const insertionAnchor = parentComp ? this._getStyleAnchor(parentComp) || this._getStyleAnchor(this._def) : this._getRootStyleInsertionAnchor(root);
|
|
861
|
+
let last = null;
|
|
863
862
|
for (let i = styles.length - 1; i >= 0; i--) {
|
|
864
863
|
const s = document.createElement("style");
|
|
865
864
|
if (nonce) s.setAttribute("nonce", nonce);
|
|
866
865
|
s.textContent = styles[i];
|
|
867
|
-
|
|
866
|
+
root.insertBefore(s, last || insertionAnchor);
|
|
867
|
+
last = s;
|
|
868
|
+
if (i === 0) {
|
|
869
|
+
if (!parentComp) this._styleAnchors.set(this._def, s);
|
|
870
|
+
if (owner) this._styleAnchors.set(owner, s);
|
|
871
|
+
}
|
|
868
872
|
if (!!(process.env.NODE_ENV !== "production")) if (owner) {
|
|
869
873
|
if (owner.__hmrId) {
|
|
870
874
|
if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
|
|
@@ -875,6 +879,20 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
875
879
|
} else (this._styles || (this._styles = [])).push(s);
|
|
876
880
|
}
|
|
877
881
|
}
|
|
882
|
+
_getStyleAnchor(comp) {
|
|
883
|
+
if (!comp) return null;
|
|
884
|
+
const anchor = this._styleAnchors.get(comp);
|
|
885
|
+
if (anchor && anchor.parentNode === this.shadowRoot) return anchor;
|
|
886
|
+
if (anchor) this._styleAnchors.delete(comp);
|
|
887
|
+
return null;
|
|
888
|
+
}
|
|
889
|
+
_getRootStyleInsertionAnchor(root) {
|
|
890
|
+
for (let i = 0; i < root.childNodes.length; i++) {
|
|
891
|
+
const node = root.childNodes[i];
|
|
892
|
+
if (!(node instanceof HTMLStyleElement)) return node;
|
|
893
|
+
}
|
|
894
|
+
return null;
|
|
895
|
+
}
|
|
878
896
|
/**
|
|
879
897
|
* Only called when shadowRoot is false
|
|
880
898
|
*/
|
|
@@ -937,8 +955,8 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
937
955
|
/**
|
|
938
956
|
* @internal
|
|
939
957
|
*/
|
|
940
|
-
_injectChildStyle(comp) {
|
|
941
|
-
this._applyStyles(comp.styles, comp);
|
|
958
|
+
_injectChildStyle(comp, parentComp) {
|
|
959
|
+
this._applyStyles(comp.styles, comp, parentComp);
|
|
942
960
|
}
|
|
943
961
|
/**
|
|
944
962
|
* @internal
|
|
@@ -966,6 +984,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
966
984
|
_removeChildStyle(comp) {
|
|
967
985
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
968
986
|
this._styleChildren.delete(comp);
|
|
987
|
+
this._styleAnchors.delete(comp);
|
|
969
988
|
if (this._childStyles && comp.__hmrId) {
|
|
970
989
|
const oldStyles = this._childStyles.get(comp.__hmrId);
|
|
971
990
|
if (oldStyles) {
|
|
@@ -1035,7 +1054,6 @@ function useShadowRoot() {
|
|
|
1035
1054
|
const el = !!(process.env.NODE_ENV !== "production") ? useHost("useShadowRoot") : useHost();
|
|
1036
1055
|
return el && el.shadowRoot;
|
|
1037
1056
|
}
|
|
1038
|
-
|
|
1039
1057
|
//#endregion
|
|
1040
1058
|
//#region packages/runtime-dom/src/helpers/useCssModule.ts
|
|
1041
1059
|
function useCssModule(name = "$style") {
|
|
@@ -1058,7 +1076,6 @@ function useCssModule(name = "$style") {
|
|
|
1058
1076
|
return mod;
|
|
1059
1077
|
}
|
|
1060
1078
|
}
|
|
1061
|
-
|
|
1062
1079
|
//#endregion
|
|
1063
1080
|
//#region packages/runtime-dom/src/components/TransitionGroup.ts
|
|
1064
1081
|
const positionMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -1073,7 +1090,7 @@ const decorate = (t) => {
|
|
|
1073
1090
|
delete t.props.mode;
|
|
1074
1091
|
return t;
|
|
1075
1092
|
};
|
|
1076
|
-
const
|
|
1093
|
+
const TransitionGroup = /* @__PURE__ */ decorate({
|
|
1077
1094
|
name: "TransitionGroup",
|
|
1078
1095
|
props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
|
|
1079
1096
|
tag: String,
|
|
@@ -1124,7 +1141,6 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
|
|
|
1124
1141
|
};
|
|
1125
1142
|
}
|
|
1126
1143
|
});
|
|
1127
|
-
const TransitionGroup = TransitionGroupImpl;
|
|
1128
1144
|
function callPendingCbs(el) {
|
|
1129
1145
|
if (el[moveCbKey]) el[moveCbKey]();
|
|
1130
1146
|
if (el[enterCbKey]) el[enterCbKey]();
|
|
@@ -1190,7 +1206,6 @@ const handleMovedChildren = (el, moveClass) => {
|
|
|
1190
1206
|
};
|
|
1191
1207
|
el.addEventListener("transitionend", cb);
|
|
1192
1208
|
};
|
|
1193
|
-
|
|
1194
1209
|
//#endregion
|
|
1195
1210
|
//#region packages/runtime-dom/src/directives/vModel.ts
|
|
1196
1211
|
const getModelAssigner = (vnode) => {
|
|
@@ -1251,7 +1266,8 @@ const vModelTextUpdate = (el, oldValue, value, trim, number, lazy) => {
|
|
|
1251
1266
|
const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
|
|
1252
1267
|
const newValue = value == null ? "" : value;
|
|
1253
1268
|
if (elValue === newValue) return;
|
|
1254
|
-
|
|
1269
|
+
const rootNode = el.getRootNode();
|
|
1270
|
+
if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement === el && el.type !== "range") {
|
|
1255
1271
|
if (lazy && value === oldValue) return;
|
|
1256
1272
|
if (trim && el.value.trim() === newValue) return;
|
|
1257
1273
|
}
|
|
@@ -1440,7 +1456,6 @@ function initVModelForSSR() {
|
|
|
1440
1456
|
if (modelToUse.getSSRProps) return modelToUse.getSSRProps(binding, vnode);
|
|
1441
1457
|
};
|
|
1442
1458
|
}
|
|
1443
|
-
|
|
1444
1459
|
//#endregion
|
|
1445
1460
|
//#region packages/runtime-dom/src/directives/vOn.ts
|
|
1446
1461
|
const systemModifiers = [
|
|
@@ -1498,7 +1513,6 @@ const withKeys = (fn, modifiers) => {
|
|
|
1498
1513
|
if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) return fn(event);
|
|
1499
1514
|
}));
|
|
1500
1515
|
};
|
|
1501
|
-
|
|
1502
1516
|
//#endregion
|
|
1503
1517
|
//#region packages/runtime-dom/src/index.ts
|
|
1504
1518
|
const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
|
|
@@ -1611,6 +1625,5 @@ const initDirectivesForSSR = () => {
|
|
|
1611
1625
|
initVShowForSSR();
|
|
1612
1626
|
}
|
|
1613
1627
|
};
|
|
1614
|
-
|
|
1615
1628
|
//#endregion
|
|
1616
|
-
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, 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 };
|
|
1629
|
+
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 };
|