@vue/runtime-dom 3.6.0-alpha.2 → 3.6.0-alpha.4
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 +280 -174
- package/dist/runtime-dom.cjs.prod.js +258 -152
- package/dist/runtime-dom.d.ts +709 -670
- package/dist/runtime-dom.esm-browser.js +989 -621
- package/dist/runtime-dom.esm-browser.prod.js +4 -3
- package/dist/runtime-dom.esm-bundler.js +280 -177
- package/dist/runtime-dom.global.js +989 -617
- package/dist/runtime-dom.global.prod.js +4 -3
- package/package.json +4 -4
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.6.0-alpha.
|
|
2
|
+
* @vue/runtime-dom v3.6.0-alpha.4
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
|
-
import { warn, BaseTransitionPropsValidators, h, BaseTransition,
|
|
6
|
+
import { warn, BaseTransitionPropsValidators, assertNumber, h, BaseTransition, getCurrentInstance, onBeforeUpdate, queuePostFlushCb, onMounted, watch, onUnmounted, Fragment, Static, camelize, callWithAsyncErrorHandling, defineComponent, useInstanceOption, createVNode, nextTick, unref, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, Text, createRenderer, createHydrationRenderer, isRuntimeOnly } from '@vue/runtime-core';
|
|
7
7
|
export * from '@vue/runtime-core';
|
|
8
|
-
import { extend, isObject,
|
|
8
|
+
import { extend, isObject, isArray, toNumber, NOOP, normalizeCssVarValue, isString, hyphenate, capitalize, isSpecialBooleanAttr, includeBooleanAttr, isSymbol, canSetValueDirectly, isFunction, isOn, isModelListener, camelize as camelize$1, isNativeOn, shouldSetAsAttr, isPlainObject, hasOwn, EMPTY_OBJ, looseEqual, looseToNumber, looseIndexOf, isSet, invokeArrayFns, isHTMLTag, isSVGTag, isMathMLTag } from '@vue/shared';
|
|
9
9
|
|
|
10
10
|
let policy = void 0;
|
|
11
11
|
const tt = typeof window !== "undefined" && window.trustedTypes;
|
|
@@ -214,11 +214,11 @@ function resolveTransitionProps(rawProps) {
|
|
|
214
214
|
const resolve = () => finishLeave(el, done);
|
|
215
215
|
addTransitionClass(el, leaveFromClass);
|
|
216
216
|
if (!el._enterCancelled) {
|
|
217
|
-
forceReflow();
|
|
217
|
+
forceReflow(el);
|
|
218
218
|
addTransitionClass(el, leaveActiveClass);
|
|
219
219
|
} else {
|
|
220
220
|
addTransitionClass(el, leaveActiveClass);
|
|
221
|
-
forceReflow();
|
|
221
|
+
forceReflow(el);
|
|
222
222
|
}
|
|
223
223
|
nextFrame(() => {
|
|
224
224
|
if (!el._isLeaving) {
|
|
@@ -344,7 +344,7 @@ function getTransitionInfo(el, expectedType) {
|
|
|
344
344
|
type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
|
|
345
345
|
propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
|
|
346
346
|
}
|
|
347
|
-
const hasTransform = type === TRANSITION && /\b(transform|all)(
|
|
347
|
+
const hasTransform = type === TRANSITION && /\b(?:transform|all)(?:,|$)/.test(
|
|
348
348
|
getStyleProperties(`${TRANSITION}Property`).toString()
|
|
349
349
|
);
|
|
350
350
|
return {
|
|
@@ -364,8 +364,9 @@ function toMs(s) {
|
|
|
364
364
|
if (s === "auto") return 0;
|
|
365
365
|
return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
|
|
366
366
|
}
|
|
367
|
-
function forceReflow() {
|
|
368
|
-
|
|
367
|
+
function forceReflow(el) {
|
|
368
|
+
const targetDocument = el ? el.ownerDocument : document;
|
|
369
|
+
return targetDocument.body.offsetHeight;
|
|
369
370
|
}
|
|
370
371
|
|
|
371
372
|
function patchClass(el, value, isSVG) {
|
|
@@ -385,6 +386,8 @@ function patchClass(el, value, isSVG) {
|
|
|
385
386
|
const vShowOriginalDisplay = Symbol("_vod");
|
|
386
387
|
const vShowHidden = Symbol("_vsh");
|
|
387
388
|
const vShow = {
|
|
389
|
+
// used for prop mismatch check during hydration
|
|
390
|
+
name: "show",
|
|
388
391
|
beforeMount(el, { value }, { transition }) {
|
|
389
392
|
el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
|
|
390
393
|
if (transition && value) {
|
|
@@ -418,9 +421,6 @@ const vShow = {
|
|
|
418
421
|
setDisplay(el, value);
|
|
419
422
|
}
|
|
420
423
|
};
|
|
421
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
422
|
-
vShow.name = "show";
|
|
423
|
-
}
|
|
424
424
|
function setDisplay(el, value) {
|
|
425
425
|
el.style.display = value ? el[vShowOriginalDisplay] : "none";
|
|
426
426
|
el[vShowHidden] = !value;
|
|
@@ -506,7 +506,7 @@ function setVarsOnNode(el, vars) {
|
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
508
|
|
|
509
|
-
const displayRE = /(
|
|
509
|
+
const displayRE = /(?:^|;)\s*display\s*:/;
|
|
510
510
|
function patchStyle(el, prev, next) {
|
|
511
511
|
const style = el.style;
|
|
512
512
|
const isCssString = isString(next);
|
|
@@ -811,11 +811,10 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
811
811
|
}
|
|
812
812
|
|
|
813
813
|
const REMOVAL = {};
|
|
814
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
815
814
|
// @__NO_SIDE_EFFECTS__
|
|
816
815
|
function defineCustomElement(options, extraOptions, _createApp) {
|
|
817
|
-
|
|
818
|
-
if (isPlainObject(Comp)) extend(Comp, extraOptions);
|
|
816
|
+
let Comp = defineComponent(options, extraOptions);
|
|
817
|
+
if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions);
|
|
819
818
|
class VueCustomElement extends VueElement {
|
|
820
819
|
constructor(initialProps) {
|
|
821
820
|
super(Comp, initialProps, _createApp);
|
|
@@ -824,18 +823,14 @@ function defineCustomElement(options, extraOptions, _createApp) {
|
|
|
824
823
|
VueCustomElement.def = Comp;
|
|
825
824
|
return VueCustomElement;
|
|
826
825
|
}
|
|
827
|
-
|
|
828
|
-
const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
|
|
826
|
+
const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
|
|
829
827
|
return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
|
|
830
|
-
};
|
|
828
|
+
});
|
|
831
829
|
const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
|
|
832
830
|
};
|
|
833
|
-
class
|
|
834
|
-
constructor(
|
|
831
|
+
class VueElementBase extends BaseClass {
|
|
832
|
+
constructor(def, props = {}, createAppFn) {
|
|
835
833
|
super();
|
|
836
|
-
this._def = _def;
|
|
837
|
-
this._props = _props;
|
|
838
|
-
this._createApp = _createApp;
|
|
839
834
|
this._isVueCE = true;
|
|
840
835
|
/**
|
|
841
836
|
* @internal
|
|
@@ -845,25 +840,26 @@ class VueElement extends BaseClass {
|
|
|
845
840
|
* @internal
|
|
846
841
|
*/
|
|
847
842
|
this._app = null;
|
|
848
|
-
/**
|
|
849
|
-
* @internal
|
|
850
|
-
*/
|
|
851
|
-
this._nonce = this._def.nonce;
|
|
852
843
|
this._connected = false;
|
|
853
844
|
this._resolved = false;
|
|
854
845
|
this._numberProps = null;
|
|
855
846
|
this._styleChildren = /* @__PURE__ */ new WeakSet();
|
|
847
|
+
this._patching = false;
|
|
848
|
+
this._dirty = false;
|
|
856
849
|
this._ob = null;
|
|
857
|
-
|
|
850
|
+
this._def = def;
|
|
851
|
+
this._props = props;
|
|
852
|
+
this._createApp = createAppFn;
|
|
853
|
+
this._nonce = def.nonce;
|
|
854
|
+
if (this._needsHydration()) {
|
|
858
855
|
this._root = this.shadowRoot;
|
|
859
856
|
} else {
|
|
860
|
-
if (
|
|
861
|
-
|
|
862
|
-
|
|
857
|
+
if (def.shadowRoot !== false) {
|
|
858
|
+
this.attachShadow(
|
|
859
|
+
extend({}, def.shadowRootOptions, {
|
|
860
|
+
mode: "open"
|
|
861
|
+
})
|
|
863
862
|
);
|
|
864
|
-
}
|
|
865
|
-
if (_def.shadowRoot !== false) {
|
|
866
|
-
this.attachShadow({ mode: "open" });
|
|
867
863
|
this._root = this.shadowRoot;
|
|
868
864
|
} else {
|
|
869
865
|
this._root = this;
|
|
@@ -878,14 +874,14 @@ class VueElement extends BaseClass {
|
|
|
878
874
|
this._connected = true;
|
|
879
875
|
let parent = this;
|
|
880
876
|
while (parent = parent && (parent.parentNode || parent.host)) {
|
|
881
|
-
if (parent instanceof
|
|
877
|
+
if (parent instanceof VueElementBase) {
|
|
882
878
|
this._parent = parent;
|
|
883
879
|
break;
|
|
884
880
|
}
|
|
885
881
|
}
|
|
886
882
|
if (!this._instance) {
|
|
887
883
|
if (this._resolved) {
|
|
888
|
-
this.
|
|
884
|
+
this._mountComponent(this._def);
|
|
889
885
|
} else {
|
|
890
886
|
if (parent && parent._pendingResolve) {
|
|
891
887
|
this._pendingResolve = parent._pendingResolve.then(() => {
|
|
@@ -898,8 +894,24 @@ class VueElement extends BaseClass {
|
|
|
898
894
|
}
|
|
899
895
|
}
|
|
900
896
|
}
|
|
897
|
+
disconnectedCallback() {
|
|
898
|
+
this._connected = false;
|
|
899
|
+
nextTick(() => {
|
|
900
|
+
if (!this._connected) {
|
|
901
|
+
if (this._ob) {
|
|
902
|
+
this._ob.disconnect();
|
|
903
|
+
this._ob = null;
|
|
904
|
+
}
|
|
905
|
+
this._unmount();
|
|
906
|
+
if (this._teleportTargets) {
|
|
907
|
+
this._teleportTargets.clear();
|
|
908
|
+
this._teleportTargets = void 0;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
});
|
|
912
|
+
}
|
|
901
913
|
_setParent(parent = this._parent) {
|
|
902
|
-
if (parent) {
|
|
914
|
+
if (parent && this._instance) {
|
|
903
915
|
this._instance.parent = parent._instance;
|
|
904
916
|
this._inheritParentContext(parent);
|
|
905
917
|
}
|
|
@@ -912,19 +924,10 @@ class VueElement extends BaseClass {
|
|
|
912
924
|
);
|
|
913
925
|
}
|
|
914
926
|
}
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
if (this._ob) {
|
|
920
|
-
this._ob.disconnect();
|
|
921
|
-
this._ob = null;
|
|
922
|
-
}
|
|
923
|
-
this._app && this._app.unmount();
|
|
924
|
-
if (this._instance) this._instance.ce = void 0;
|
|
925
|
-
this._app = this._instance = null;
|
|
926
|
-
}
|
|
927
|
-
});
|
|
927
|
+
_processMutations(mutations) {
|
|
928
|
+
for (const m of mutations) {
|
|
929
|
+
this._setAttr(m.attributeName);
|
|
930
|
+
}
|
|
928
931
|
}
|
|
929
932
|
/**
|
|
930
933
|
* resolve inner component definition (handle possible async component)
|
|
@@ -936,13 +939,9 @@ class VueElement extends BaseClass {
|
|
|
936
939
|
for (let i = 0; i < this.attributes.length; i++) {
|
|
937
940
|
this._setAttr(this.attributes[i].name);
|
|
938
941
|
}
|
|
939
|
-
this._ob = new MutationObserver((
|
|
940
|
-
for (const m of mutations) {
|
|
941
|
-
this._setAttr(m.attributeName);
|
|
942
|
-
}
|
|
943
|
-
});
|
|
942
|
+
this._ob = new MutationObserver(this._processMutations.bind(this));
|
|
944
943
|
this._ob.observe(this, { attributes: true });
|
|
945
|
-
const resolve = (def
|
|
944
|
+
const resolve = (def) => {
|
|
946
945
|
this._resolved = true;
|
|
947
946
|
this._pendingResolve = void 0;
|
|
948
947
|
const { props, styles } = def;
|
|
@@ -967,29 +966,25 @@ class VueElement extends BaseClass {
|
|
|
967
966
|
"Custom element style injection is not supported when using shadowRoot: false"
|
|
968
967
|
);
|
|
969
968
|
}
|
|
970
|
-
this.
|
|
969
|
+
this._mountComponent(def);
|
|
971
970
|
};
|
|
972
971
|
const asyncDef = this._def.__asyncLoader;
|
|
973
972
|
if (asyncDef) {
|
|
973
|
+
const { configureApp } = this._def;
|
|
974
974
|
this._pendingResolve = asyncDef().then((def) => {
|
|
975
|
-
def.configureApp =
|
|
976
|
-
|
|
975
|
+
def.configureApp = configureApp;
|
|
976
|
+
this._def = def;
|
|
977
|
+
resolve(def);
|
|
977
978
|
});
|
|
978
979
|
} else {
|
|
979
980
|
resolve(this._def);
|
|
980
981
|
}
|
|
981
982
|
}
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
this._inheritParentContext();
|
|
988
|
-
if (def.configureApp) {
|
|
989
|
-
def.configureApp(this._app);
|
|
990
|
-
}
|
|
991
|
-
this._app._ceVNode = this._createVNode();
|
|
992
|
-
this._app.mount(this._root);
|
|
983
|
+
_mountComponent(def) {
|
|
984
|
+
this._mount(def);
|
|
985
|
+
this._processExposed();
|
|
986
|
+
}
|
|
987
|
+
_processExposed() {
|
|
993
988
|
const exposed = this._instance && this._instance.exposed;
|
|
994
989
|
if (!exposed) return;
|
|
995
990
|
for (const key in exposed) {
|
|
@@ -1003,6 +998,38 @@ class VueElement extends BaseClass {
|
|
|
1003
998
|
}
|
|
1004
999
|
}
|
|
1005
1000
|
}
|
|
1001
|
+
_processInstance() {
|
|
1002
|
+
this._instance.ce = this;
|
|
1003
|
+
this._instance.isCE = true;
|
|
1004
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1005
|
+
this._instance.ceReload = (newStyles) => {
|
|
1006
|
+
if (this._styles) {
|
|
1007
|
+
this._styles.forEach((s) => this._root.removeChild(s));
|
|
1008
|
+
this._styles.length = 0;
|
|
1009
|
+
}
|
|
1010
|
+
this._applyStyles(newStyles);
|
|
1011
|
+
if (!this._instance.vapor) {
|
|
1012
|
+
this._instance = null;
|
|
1013
|
+
}
|
|
1014
|
+
this._update();
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
const dispatch = (event, args) => {
|
|
1018
|
+
this.dispatchEvent(
|
|
1019
|
+
new CustomEvent(
|
|
1020
|
+
event,
|
|
1021
|
+
isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
|
|
1022
|
+
)
|
|
1023
|
+
);
|
|
1024
|
+
};
|
|
1025
|
+
this._instance.emit = (event, ...args) => {
|
|
1026
|
+
dispatch(event, args);
|
|
1027
|
+
if (hyphenate(event) !== event) {
|
|
1028
|
+
dispatch(hyphenate(event), args);
|
|
1029
|
+
}
|
|
1030
|
+
};
|
|
1031
|
+
this._setParent();
|
|
1032
|
+
}
|
|
1006
1033
|
_resolveProps(def) {
|
|
1007
1034
|
const { props } = def;
|
|
1008
1035
|
const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
|
|
@@ -1017,7 +1044,7 @@ class VueElement extends BaseClass {
|
|
|
1017
1044
|
return this._getProp(key);
|
|
1018
1045
|
},
|
|
1019
1046
|
set(val) {
|
|
1020
|
-
this._setProp(key, val, true,
|
|
1047
|
+
this._setProp(key, val, true, !this._patching);
|
|
1021
1048
|
}
|
|
1022
1049
|
});
|
|
1023
1050
|
}
|
|
@@ -1043,11 +1070,12 @@ class VueElement extends BaseClass {
|
|
|
1043
1070
|
*/
|
|
1044
1071
|
_setProp(key, val, shouldReflect = true, shouldUpdate = false) {
|
|
1045
1072
|
if (val !== this._props[key]) {
|
|
1073
|
+
this._dirty = true;
|
|
1046
1074
|
if (val === REMOVAL) {
|
|
1047
1075
|
delete this._props[key];
|
|
1048
1076
|
} else {
|
|
1049
1077
|
this._props[key] = val;
|
|
1050
|
-
if (key === "key" && this._app) {
|
|
1078
|
+
if (key === "key" && this._app && this._app._ceVNode) {
|
|
1051
1079
|
this._app._ceVNode.key = val;
|
|
1052
1080
|
}
|
|
1053
1081
|
}
|
|
@@ -1056,7 +1084,10 @@ class VueElement extends BaseClass {
|
|
|
1056
1084
|
}
|
|
1057
1085
|
if (shouldReflect) {
|
|
1058
1086
|
const ob = this._ob;
|
|
1059
|
-
|
|
1087
|
+
if (ob) {
|
|
1088
|
+
this._processMutations(ob.takeRecords());
|
|
1089
|
+
ob.disconnect();
|
|
1090
|
+
}
|
|
1060
1091
|
if (val === true) {
|
|
1061
1092
|
this.setAttribute(hyphenate(key), "");
|
|
1062
1093
|
} else if (typeof val === "string" || typeof val === "number") {
|
|
@@ -1068,52 +1099,6 @@ class VueElement extends BaseClass {
|
|
|
1068
1099
|
}
|
|
1069
1100
|
}
|
|
1070
1101
|
}
|
|
1071
|
-
_update() {
|
|
1072
|
-
const vnode = this._createVNode();
|
|
1073
|
-
if (this._app) vnode.appContext = this._app._context;
|
|
1074
|
-
render(vnode, this._root);
|
|
1075
|
-
}
|
|
1076
|
-
_createVNode() {
|
|
1077
|
-
const baseProps = {};
|
|
1078
|
-
if (!this.shadowRoot) {
|
|
1079
|
-
baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
|
|
1080
|
-
}
|
|
1081
|
-
const vnode = createVNode(this._def, extend(baseProps, this._props));
|
|
1082
|
-
if (!this._instance) {
|
|
1083
|
-
vnode.ce = (instance) => {
|
|
1084
|
-
this._instance = instance;
|
|
1085
|
-
instance.ce = this;
|
|
1086
|
-
instance.isCE = true;
|
|
1087
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1088
|
-
instance.ceReload = (newStyles) => {
|
|
1089
|
-
if (this._styles) {
|
|
1090
|
-
this._styles.forEach((s) => this._root.removeChild(s));
|
|
1091
|
-
this._styles.length = 0;
|
|
1092
|
-
}
|
|
1093
|
-
this._applyStyles(newStyles);
|
|
1094
|
-
this._instance = null;
|
|
1095
|
-
this._update();
|
|
1096
|
-
};
|
|
1097
|
-
}
|
|
1098
|
-
const dispatch = (event, args) => {
|
|
1099
|
-
this.dispatchEvent(
|
|
1100
|
-
new CustomEvent(
|
|
1101
|
-
event,
|
|
1102
|
-
isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
|
|
1103
|
-
)
|
|
1104
|
-
);
|
|
1105
|
-
};
|
|
1106
|
-
instance.emit = (event, ...args) => {
|
|
1107
|
-
dispatch(event, args);
|
|
1108
|
-
if (hyphenate(event) !== event) {
|
|
1109
|
-
dispatch(hyphenate(event), args);
|
|
1110
|
-
}
|
|
1111
|
-
};
|
|
1112
|
-
this._setParent();
|
|
1113
|
-
};
|
|
1114
|
-
}
|
|
1115
|
-
return vnode;
|
|
1116
|
-
}
|
|
1117
1102
|
_applyStyles(styles, owner) {
|
|
1118
1103
|
if (!styles) return;
|
|
1119
1104
|
if (owner) {
|
|
@@ -1160,13 +1145,15 @@ class VueElement extends BaseClass {
|
|
|
1160
1145
|
* Only called when shadowRoot is false
|
|
1161
1146
|
*/
|
|
1162
1147
|
_renderSlots() {
|
|
1163
|
-
const outlets =
|
|
1148
|
+
const outlets = this._getSlots();
|
|
1164
1149
|
const scopeId = this._instance.type.__scopeId;
|
|
1150
|
+
const slotReplacements = /* @__PURE__ */ new Map();
|
|
1165
1151
|
for (let i = 0; i < outlets.length; i++) {
|
|
1166
1152
|
const o = outlets[i];
|
|
1167
1153
|
const slotName = o.getAttribute("name") || "default";
|
|
1168
1154
|
const content = this._slots[slotName];
|
|
1169
1155
|
const parent = o.parentNode;
|
|
1156
|
+
const replacementNodes = [];
|
|
1170
1157
|
if (content) {
|
|
1171
1158
|
for (const n of content) {
|
|
1172
1159
|
if (scopeId && n.nodeType === 1) {
|
|
@@ -1179,12 +1166,36 @@ class VueElement extends BaseClass {
|
|
|
1179
1166
|
}
|
|
1180
1167
|
}
|
|
1181
1168
|
parent.insertBefore(n, o);
|
|
1169
|
+
replacementNodes.push(n);
|
|
1182
1170
|
}
|
|
1183
1171
|
} else {
|
|
1184
|
-
while (o.firstChild)
|
|
1172
|
+
while (o.firstChild) {
|
|
1173
|
+
const child = o.firstChild;
|
|
1174
|
+
parent.insertBefore(child, o);
|
|
1175
|
+
replacementNodes.push(child);
|
|
1176
|
+
}
|
|
1185
1177
|
}
|
|
1186
1178
|
parent.removeChild(o);
|
|
1179
|
+
slotReplacements.set(o, replacementNodes);
|
|
1187
1180
|
}
|
|
1181
|
+
this._updateSlotNodes(slotReplacements);
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* @internal
|
|
1185
|
+
*/
|
|
1186
|
+
_getSlots() {
|
|
1187
|
+
const roots = [this];
|
|
1188
|
+
if (this._teleportTargets) {
|
|
1189
|
+
roots.push(...this._teleportTargets);
|
|
1190
|
+
}
|
|
1191
|
+
const slots = /* @__PURE__ */ new Set();
|
|
1192
|
+
for (const root of roots) {
|
|
1193
|
+
const found = root.querySelectorAll("slot");
|
|
1194
|
+
for (let i = 0; i < found.length; i++) {
|
|
1195
|
+
slots.add(found[i]);
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
return Array.from(slots);
|
|
1188
1199
|
}
|
|
1189
1200
|
/**
|
|
1190
1201
|
* @internal
|
|
@@ -1192,6 +1203,22 @@ class VueElement extends BaseClass {
|
|
|
1192
1203
|
_injectChildStyle(comp) {
|
|
1193
1204
|
this._applyStyles(comp.styles, comp);
|
|
1194
1205
|
}
|
|
1206
|
+
/**
|
|
1207
|
+
* @internal
|
|
1208
|
+
*/
|
|
1209
|
+
_beginPatch() {
|
|
1210
|
+
this._patching = true;
|
|
1211
|
+
this._dirty = false;
|
|
1212
|
+
}
|
|
1213
|
+
/**
|
|
1214
|
+
* @internal
|
|
1215
|
+
*/
|
|
1216
|
+
_endPatch() {
|
|
1217
|
+
this._patching = false;
|
|
1218
|
+
if (this._dirty && this._instance) {
|
|
1219
|
+
this._update();
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1195
1222
|
/**
|
|
1196
1223
|
* @internal
|
|
1197
1224
|
*/
|
|
@@ -1208,13 +1235,76 @@ class VueElement extends BaseClass {
|
|
|
1208
1235
|
}
|
|
1209
1236
|
}
|
|
1210
1237
|
}
|
|
1238
|
+
class VueElement extends VueElementBase {
|
|
1239
|
+
constructor(def, props = {}, createAppFn = createApp) {
|
|
1240
|
+
super(def, props, createAppFn);
|
|
1241
|
+
}
|
|
1242
|
+
_needsHydration() {
|
|
1243
|
+
if (this.shadowRoot && this._createApp !== createApp) {
|
|
1244
|
+
return true;
|
|
1245
|
+
} else {
|
|
1246
|
+
if (!!(process.env.NODE_ENV !== "production") && this.shadowRoot) {
|
|
1247
|
+
warn(
|
|
1248
|
+
`Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
|
|
1249
|
+
);
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
return false;
|
|
1253
|
+
}
|
|
1254
|
+
_mount(def) {
|
|
1255
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) && !def.name) {
|
|
1256
|
+
def.name = "VueElement";
|
|
1257
|
+
}
|
|
1258
|
+
this._app = this._createApp(def);
|
|
1259
|
+
this._inheritParentContext();
|
|
1260
|
+
if (def.configureApp) {
|
|
1261
|
+
def.configureApp(this._app);
|
|
1262
|
+
}
|
|
1263
|
+
this._app._ceVNode = this._createVNode();
|
|
1264
|
+
this._app.mount(this._root);
|
|
1265
|
+
}
|
|
1266
|
+
_update() {
|
|
1267
|
+
if (!this._app) return;
|
|
1268
|
+
const vnode = this._createVNode();
|
|
1269
|
+
vnode.appContext = this._app._context;
|
|
1270
|
+
render(vnode, this._root);
|
|
1271
|
+
}
|
|
1272
|
+
_unmount() {
|
|
1273
|
+
if (this._app) {
|
|
1274
|
+
this._app.unmount();
|
|
1275
|
+
}
|
|
1276
|
+
if (this._instance && this._instance.ce) {
|
|
1277
|
+
this._instance.ce = void 0;
|
|
1278
|
+
}
|
|
1279
|
+
this._app = this._instance = null;
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Only called when shadowRoot is false
|
|
1283
|
+
*/
|
|
1284
|
+
_updateSlotNodes(replacements) {
|
|
1285
|
+
}
|
|
1286
|
+
_createVNode() {
|
|
1287
|
+
const baseProps = {};
|
|
1288
|
+
if (!this.shadowRoot) {
|
|
1289
|
+
baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
|
|
1290
|
+
}
|
|
1291
|
+
const vnode = createVNode(this._def, extend(baseProps, this._props));
|
|
1292
|
+
if (!this._instance) {
|
|
1293
|
+
vnode.ce = (instance) => {
|
|
1294
|
+
this._instance = instance;
|
|
1295
|
+
this._processInstance();
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1298
|
+
return vnode;
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1211
1301
|
function useHost(caller) {
|
|
1212
|
-
const
|
|
1213
|
-
const el =
|
|
1302
|
+
const { hasInstance, value } = useInstanceOption("ce", true);
|
|
1303
|
+
const el = value;
|
|
1214
1304
|
if (el) {
|
|
1215
1305
|
return el;
|
|
1216
1306
|
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
1217
|
-
if (!
|
|
1307
|
+
if (!hasInstance) {
|
|
1218
1308
|
warn(
|
|
1219
1309
|
`${caller || "useHost"} called without an active component instance.`
|
|
1220
1310
|
);
|
|
@@ -1233,12 +1323,12 @@ function useShadowRoot() {
|
|
|
1233
1323
|
|
|
1234
1324
|
function useCssModule(name = "$style") {
|
|
1235
1325
|
{
|
|
1236
|
-
const
|
|
1237
|
-
if (!
|
|
1326
|
+
const { hasInstance, value: type } = useInstanceOption("type", true);
|
|
1327
|
+
if (!hasInstance) {
|
|
1238
1328
|
!!(process.env.NODE_ENV !== "production") && warn(`useCssModule must be called inside setup()`);
|
|
1239
1329
|
return EMPTY_OBJ;
|
|
1240
1330
|
}
|
|
1241
|
-
const modules =
|
|
1331
|
+
const modules = type.__cssModules;
|
|
1242
1332
|
if (!modules) {
|
|
1243
1333
|
!!(process.env.NODE_ENV !== "production") && warn(`Current instance does not have CSS modules injected.`);
|
|
1244
1334
|
return EMPTY_OBJ;
|
|
@@ -1284,26 +1374,13 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
|
|
|
1284
1374
|
prevChildren = [];
|
|
1285
1375
|
return;
|
|
1286
1376
|
}
|
|
1287
|
-
prevChildren.forEach(callPendingCbs);
|
|
1377
|
+
prevChildren.forEach((vnode) => callPendingCbs(vnode.el));
|
|
1288
1378
|
prevChildren.forEach(recordPosition);
|
|
1289
1379
|
const movedChildren = prevChildren.filter(applyTranslation);
|
|
1290
|
-
forceReflow();
|
|
1380
|
+
forceReflow(instance.vnode.el);
|
|
1291
1381
|
movedChildren.forEach((c) => {
|
|
1292
1382
|
const el = c.el;
|
|
1293
|
-
|
|
1294
|
-
addTransitionClass(el, moveClass);
|
|
1295
|
-
style.transform = style.webkitTransform = style.transitionDuration = "";
|
|
1296
|
-
const cb = el[moveCbKey] = (e) => {
|
|
1297
|
-
if (e && e.target !== el) {
|
|
1298
|
-
return;
|
|
1299
|
-
}
|
|
1300
|
-
if (!e || /transform$/.test(e.propertyName)) {
|
|
1301
|
-
el.removeEventListener("transitionend", cb);
|
|
1302
|
-
el[moveCbKey] = null;
|
|
1303
|
-
removeTransitionClass(el, moveClass);
|
|
1304
|
-
}
|
|
1305
|
-
};
|
|
1306
|
-
el.addEventListener("transitionend", cb);
|
|
1383
|
+
handleMovedChildren(el, moveClass);
|
|
1307
1384
|
});
|
|
1308
1385
|
prevChildren = [];
|
|
1309
1386
|
});
|
|
@@ -1326,10 +1403,10 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
|
|
|
1326
1403
|
instance
|
|
1327
1404
|
)
|
|
1328
1405
|
);
|
|
1329
|
-
positionMap.set(
|
|
1330
|
-
child,
|
|
1331
|
-
child.el.
|
|
1332
|
-
);
|
|
1406
|
+
positionMap.set(child, {
|
|
1407
|
+
left: child.el.offsetLeft,
|
|
1408
|
+
top: child.el.offsetTop
|
|
1409
|
+
});
|
|
1333
1410
|
}
|
|
1334
1411
|
}
|
|
1335
1412
|
}
|
|
@@ -1350,8 +1427,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
|
|
|
1350
1427
|
}
|
|
1351
1428
|
});
|
|
1352
1429
|
const TransitionGroup = TransitionGroupImpl;
|
|
1353
|
-
function callPendingCbs(
|
|
1354
|
-
const el = c.el;
|
|
1430
|
+
function callPendingCbs(el) {
|
|
1355
1431
|
if (el[moveCbKey]) {
|
|
1356
1432
|
el[moveCbKey]();
|
|
1357
1433
|
}
|
|
@@ -1360,19 +1436,30 @@ function callPendingCbs(c) {
|
|
|
1360
1436
|
}
|
|
1361
1437
|
}
|
|
1362
1438
|
function recordPosition(c) {
|
|
1363
|
-
newPositionMap.set(c,
|
|
1439
|
+
newPositionMap.set(c, {
|
|
1440
|
+
left: c.el.offsetLeft,
|
|
1441
|
+
top: c.el.offsetTop
|
|
1442
|
+
});
|
|
1364
1443
|
}
|
|
1365
1444
|
function applyTranslation(c) {
|
|
1366
|
-
|
|
1367
|
-
|
|
1445
|
+
if (baseApplyTranslation(
|
|
1446
|
+
positionMap.get(c),
|
|
1447
|
+
newPositionMap.get(c),
|
|
1448
|
+
c.el
|
|
1449
|
+
)) {
|
|
1450
|
+
return c;
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
function baseApplyTranslation(oldPos, newPos, el) {
|
|
1368
1454
|
const dx = oldPos.left - newPos.left;
|
|
1369
1455
|
const dy = oldPos.top - newPos.top;
|
|
1370
1456
|
if (dx || dy) {
|
|
1371
|
-
const s =
|
|
1457
|
+
const s = el.style;
|
|
1372
1458
|
s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
|
|
1373
1459
|
s.transitionDuration = "0s";
|
|
1374
|
-
return
|
|
1460
|
+
return true;
|
|
1375
1461
|
}
|
|
1462
|
+
return false;
|
|
1376
1463
|
}
|
|
1377
1464
|
function hasCSSTransform(el, root, moveClass) {
|
|
1378
1465
|
const clone = el.cloneNode();
|
|
@@ -1390,6 +1477,22 @@ function hasCSSTransform(el, root, moveClass) {
|
|
|
1390
1477
|
container.removeChild(clone);
|
|
1391
1478
|
return hasTransform;
|
|
1392
1479
|
}
|
|
1480
|
+
const handleMovedChildren = (el, moveClass) => {
|
|
1481
|
+
const style = el.style;
|
|
1482
|
+
addTransitionClass(el, moveClass);
|
|
1483
|
+
style.transform = style.webkitTransform = style.transitionDuration = "";
|
|
1484
|
+
const cb = el[moveCbKey] = (e) => {
|
|
1485
|
+
if (e && e.target !== el) {
|
|
1486
|
+
return;
|
|
1487
|
+
}
|
|
1488
|
+
if (!e || e.propertyName.endsWith("transform")) {
|
|
1489
|
+
el.removeEventListener("transitionend", cb);
|
|
1490
|
+
el[moveCbKey] = null;
|
|
1491
|
+
removeTransitionClass(el, moveClass);
|
|
1492
|
+
}
|
|
1493
|
+
};
|
|
1494
|
+
el.addEventListener("transitionend", cb);
|
|
1495
|
+
};
|
|
1393
1496
|
|
|
1394
1497
|
const getModelAssigner = (vnode) => {
|
|
1395
1498
|
const fn = vnode.props["onUpdate:modelValue"] || false;
|
|
@@ -1425,21 +1528,21 @@ const vModelText = {
|
|
|
1425
1528
|
vModelTextUpdate(el, oldValue, value, trim, number, lazy);
|
|
1426
1529
|
}
|
|
1427
1530
|
};
|
|
1531
|
+
function castValue(value, trim, number) {
|
|
1532
|
+
if (trim) value = value.trim();
|
|
1533
|
+
if (number) value = looseToNumber(value);
|
|
1534
|
+
return value;
|
|
1535
|
+
}
|
|
1428
1536
|
const vModelTextInit = (el, trim, number, lazy, set) => {
|
|
1429
1537
|
addEventListener(el, lazy ? "change" : "input", (e) => {
|
|
1430
1538
|
if (e.target.composing) return;
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
}
|
|
1435
|
-
if (number || el.type === "number") {
|
|
1436
|
-
domValue = looseToNumber(domValue);
|
|
1437
|
-
}
|
|
1438
|
-
(set || el[assignKey])(domValue);
|
|
1539
|
+
(set || el[assignKey])(
|
|
1540
|
+
castValue(el.value, trim, number || el.type === "number")
|
|
1541
|
+
);
|
|
1439
1542
|
});
|
|
1440
|
-
if (trim) {
|
|
1543
|
+
if (trim || number) {
|
|
1441
1544
|
addEventListener(el, "change", () => {
|
|
1442
|
-
el.value = el.value.
|
|
1545
|
+
el.value = castValue(el.value, trim, number || el.type === "number");
|
|
1443
1546
|
});
|
|
1444
1547
|
}
|
|
1445
1548
|
if (!lazy) {
|
|
@@ -1722,13 +1825,13 @@ const modifierGuards = {
|
|
|
1722
1825
|
const withModifiers = (fn, modifiers) => {
|
|
1723
1826
|
const cache = fn._withMods || (fn._withMods = {});
|
|
1724
1827
|
const cacheKey = modifiers.join(".");
|
|
1725
|
-
return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
|
|
1828
|
+
return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
|
|
1726
1829
|
for (let i = 0; i < modifiers.length; i++) {
|
|
1727
1830
|
const guard = modifierGuards[modifiers[i]];
|
|
1728
1831
|
if (guard && guard(event, modifiers)) return;
|
|
1729
1832
|
}
|
|
1730
1833
|
return fn(event, ...args);
|
|
1731
|
-
});
|
|
1834
|
+
}));
|
|
1732
1835
|
};
|
|
1733
1836
|
const keyNames = {
|
|
1734
1837
|
esc: "escape",
|
|
@@ -1742,7 +1845,7 @@ const keyNames = {
|
|
|
1742
1845
|
const withKeys = (fn, modifiers) => {
|
|
1743
1846
|
const cache = fn._withKeys || (fn._withKeys = {});
|
|
1744
1847
|
const cacheKey = modifiers.join(".");
|
|
1745
|
-
return cache[cacheKey] || (cache[cacheKey] = (event) => {
|
|
1848
|
+
return cache[cacheKey] || (cache[cacheKey] = ((event) => {
|
|
1746
1849
|
if (!("key" in event)) {
|
|
1747
1850
|
return;
|
|
1748
1851
|
}
|
|
@@ -1752,7 +1855,7 @@ const withKeys = (fn, modifiers) => {
|
|
|
1752
1855
|
)) {
|
|
1753
1856
|
return fn(event);
|
|
1754
1857
|
}
|
|
1755
|
-
});
|
|
1858
|
+
}));
|
|
1756
1859
|
};
|
|
1757
1860
|
|
|
1758
1861
|
const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
|
|
@@ -1766,13 +1869,13 @@ function ensureHydrationRenderer() {
|
|
|
1766
1869
|
enabledHydration = true;
|
|
1767
1870
|
return renderer;
|
|
1768
1871
|
}
|
|
1769
|
-
const render = (...args) => {
|
|
1872
|
+
const render = ((...args) => {
|
|
1770
1873
|
ensureRenderer().render(...args);
|
|
1771
|
-
};
|
|
1772
|
-
const hydrate = (...args) => {
|
|
1874
|
+
});
|
|
1875
|
+
const hydrate = ((...args) => {
|
|
1773
1876
|
ensureHydrationRenderer().hydrate(...args);
|
|
1774
|
-
};
|
|
1775
|
-
const createApp = (...args) => {
|
|
1877
|
+
});
|
|
1878
|
+
const createApp = ((...args) => {
|
|
1776
1879
|
const app = ensureRenderer().createApp(...args);
|
|
1777
1880
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1778
1881
|
injectNativeTagCheck(app);
|
|
@@ -1797,8 +1900,8 @@ const createApp = (...args) => {
|
|
|
1797
1900
|
return proxy;
|
|
1798
1901
|
};
|
|
1799
1902
|
return app;
|
|
1800
|
-
};
|
|
1801
|
-
const createSSRApp = (...args) => {
|
|
1903
|
+
});
|
|
1904
|
+
const createSSRApp = ((...args) => {
|
|
1802
1905
|
const app = ensureHydrationRenderer().createApp(...args);
|
|
1803
1906
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1804
1907
|
injectNativeTagCheck(app);
|
|
@@ -1812,7 +1915,7 @@ const createSSRApp = (...args) => {
|
|
|
1812
1915
|
}
|
|
1813
1916
|
};
|
|
1814
1917
|
return app;
|
|
1815
|
-
};
|
|
1918
|
+
});
|
|
1816
1919
|
function resolveRootNamespace(container) {
|
|
1817
1920
|
if (container instanceof SVGElement) {
|
|
1818
1921
|
return "svg";
|
|
@@ -1882,4 +1985,4 @@ const initDirectivesForSSR = () => {
|
|
|
1882
1985
|
}
|
|
1883
1986
|
} ;
|
|
1884
1987
|
|
|
1885
|
-
export { Transition, TransitionGroup, VueElement, createApp, createSSRApp, defineCustomElement, defineSSRCustomElement, ensureRenderer, hydrate, initDirectivesForSSR, normalizeContainer, patchStyle, render, shouldSetAsProp, useCssModule, useCssVars, useHost, useShadowRoot, vModelCheckbox, vModelCheckboxInit, vModelCheckboxUpdate, vModelDynamic, getValue as vModelGetValue, vModelRadio, vModelSelect, vModelSelectInit, vModelSetSelected, vModelText, vModelTextInit, vModelTextUpdate, vShow, vShowHidden, vShowOriginalDisplay, withKeys, withModifiers };
|
|
1988
|
+
export { Transition, TransitionGroup, TransitionPropsValidators, VueElement, VueElementBase, baseApplyTranslation, callPendingCbs, createApp, createSSRApp, defineCustomElement, defineSSRCustomElement, ensureHydrationRenderer, ensureRenderer, forceReflow, handleMovedChildren, hasCSSTransform, hydrate, initDirectivesForSSR, nodeOps, normalizeContainer, patchProp, patchStyle, render, resolveTransitionProps, 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 };
|