@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,5 +1,5 @@
|
|
|
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
|
**/
|
|
@@ -216,11 +216,11 @@ function resolveTransitionProps(rawProps) {
|
|
|
216
216
|
const resolve = () => finishLeave(el, done);
|
|
217
217
|
addTransitionClass(el, leaveFromClass);
|
|
218
218
|
if (!el._enterCancelled) {
|
|
219
|
-
forceReflow();
|
|
219
|
+
forceReflow(el);
|
|
220
220
|
addTransitionClass(el, leaveActiveClass);
|
|
221
221
|
} else {
|
|
222
222
|
addTransitionClass(el, leaveActiveClass);
|
|
223
|
-
forceReflow();
|
|
223
|
+
forceReflow(el);
|
|
224
224
|
}
|
|
225
225
|
nextFrame(() => {
|
|
226
226
|
if (!el._isLeaving) {
|
|
@@ -343,7 +343,7 @@ function getTransitionInfo(el, expectedType) {
|
|
|
343
343
|
type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
|
|
344
344
|
propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
|
|
345
345
|
}
|
|
346
|
-
const hasTransform = type === TRANSITION && /\b(transform|all)(
|
|
346
|
+
const hasTransform = type === TRANSITION && /\b(?:transform|all)(?:,|$)/.test(
|
|
347
347
|
getStyleProperties(`${TRANSITION}Property`).toString()
|
|
348
348
|
);
|
|
349
349
|
return {
|
|
@@ -363,8 +363,9 @@ function toMs(s) {
|
|
|
363
363
|
if (s === "auto") return 0;
|
|
364
364
|
return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
|
|
365
365
|
}
|
|
366
|
-
function forceReflow() {
|
|
367
|
-
|
|
366
|
+
function forceReflow(el) {
|
|
367
|
+
const targetDocument = el ? el.ownerDocument : document;
|
|
368
|
+
return targetDocument.body.offsetHeight;
|
|
368
369
|
}
|
|
369
370
|
|
|
370
371
|
function patchClass(el, value, isSVG) {
|
|
@@ -384,6 +385,8 @@ function patchClass(el, value, isSVG) {
|
|
|
384
385
|
const vShowOriginalDisplay = Symbol("_vod");
|
|
385
386
|
const vShowHidden = Symbol("_vsh");
|
|
386
387
|
const vShow = {
|
|
388
|
+
// used for prop mismatch check during hydration
|
|
389
|
+
name: "show",
|
|
387
390
|
beforeMount(el, { value }, { transition }) {
|
|
388
391
|
el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
|
|
389
392
|
if (transition && value) {
|
|
@@ -434,7 +437,7 @@ function useCssVars(getter) {
|
|
|
434
437
|
return;
|
|
435
438
|
}
|
|
436
439
|
|
|
437
|
-
const displayRE = /(
|
|
440
|
+
const displayRE = /(?:^|;)\s*display\s*:/;
|
|
438
441
|
function patchStyle(el, prev, next) {
|
|
439
442
|
const style = el.style;
|
|
440
443
|
const isCssString = shared.isString(next);
|
|
@@ -715,11 +718,10 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
715
718
|
}
|
|
716
719
|
|
|
717
720
|
const REMOVAL = {};
|
|
718
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
719
721
|
// @__NO_SIDE_EFFECTS__
|
|
720
722
|
function defineCustomElement(options, extraOptions, _createApp) {
|
|
721
|
-
|
|
722
|
-
if (shared.isPlainObject(Comp)) shared.extend(Comp, extraOptions);
|
|
723
|
+
let Comp = runtimeCore.defineComponent(options, extraOptions);
|
|
724
|
+
if (shared.isPlainObject(Comp)) Comp = shared.extend({}, Comp, extraOptions);
|
|
723
725
|
class VueCustomElement extends VueElement {
|
|
724
726
|
constructor(initialProps) {
|
|
725
727
|
super(Comp, initialProps, _createApp);
|
|
@@ -728,18 +730,14 @@ function defineCustomElement(options, extraOptions, _createApp) {
|
|
|
728
730
|
VueCustomElement.def = Comp;
|
|
729
731
|
return VueCustomElement;
|
|
730
732
|
}
|
|
731
|
-
|
|
732
|
-
const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
|
|
733
|
+
const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
|
|
733
734
|
return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
|
|
734
|
-
};
|
|
735
|
+
});
|
|
735
736
|
const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
|
|
736
737
|
};
|
|
737
|
-
class
|
|
738
|
-
constructor(
|
|
738
|
+
class VueElementBase extends BaseClass {
|
|
739
|
+
constructor(def, props = {}, createAppFn) {
|
|
739
740
|
super();
|
|
740
|
-
this._def = _def;
|
|
741
|
-
this._props = _props;
|
|
742
|
-
this._createApp = _createApp;
|
|
743
741
|
this._isVueCE = true;
|
|
744
742
|
/**
|
|
745
743
|
* @internal
|
|
@@ -749,20 +747,26 @@ class VueElement extends BaseClass {
|
|
|
749
747
|
* @internal
|
|
750
748
|
*/
|
|
751
749
|
this._app = null;
|
|
752
|
-
/**
|
|
753
|
-
* @internal
|
|
754
|
-
*/
|
|
755
|
-
this._nonce = this._def.nonce;
|
|
756
750
|
this._connected = false;
|
|
757
751
|
this._resolved = false;
|
|
758
752
|
this._numberProps = null;
|
|
759
753
|
this._styleChildren = /* @__PURE__ */ new WeakSet();
|
|
754
|
+
this._patching = false;
|
|
755
|
+
this._dirty = false;
|
|
760
756
|
this._ob = null;
|
|
761
|
-
|
|
757
|
+
this._def = def;
|
|
758
|
+
this._props = props;
|
|
759
|
+
this._createApp = createAppFn;
|
|
760
|
+
this._nonce = def.nonce;
|
|
761
|
+
if (this._needsHydration()) {
|
|
762
762
|
this._root = this.shadowRoot;
|
|
763
763
|
} else {
|
|
764
|
-
if (
|
|
765
|
-
this.attachShadow(
|
|
764
|
+
if (def.shadowRoot !== false) {
|
|
765
|
+
this.attachShadow(
|
|
766
|
+
shared.extend({}, def.shadowRootOptions, {
|
|
767
|
+
mode: "open"
|
|
768
|
+
})
|
|
769
|
+
);
|
|
766
770
|
this._root = this.shadowRoot;
|
|
767
771
|
} else {
|
|
768
772
|
this._root = this;
|
|
@@ -777,14 +781,14 @@ class VueElement extends BaseClass {
|
|
|
777
781
|
this._connected = true;
|
|
778
782
|
let parent = this;
|
|
779
783
|
while (parent = parent && (parent.parentNode || parent.host)) {
|
|
780
|
-
if (parent instanceof
|
|
784
|
+
if (parent instanceof VueElementBase) {
|
|
781
785
|
this._parent = parent;
|
|
782
786
|
break;
|
|
783
787
|
}
|
|
784
788
|
}
|
|
785
789
|
if (!this._instance) {
|
|
786
790
|
if (this._resolved) {
|
|
787
|
-
this.
|
|
791
|
+
this._mountComponent(this._def);
|
|
788
792
|
} else {
|
|
789
793
|
if (parent && parent._pendingResolve) {
|
|
790
794
|
this._pendingResolve = parent._pendingResolve.then(() => {
|
|
@@ -797,8 +801,24 @@ class VueElement extends BaseClass {
|
|
|
797
801
|
}
|
|
798
802
|
}
|
|
799
803
|
}
|
|
804
|
+
disconnectedCallback() {
|
|
805
|
+
this._connected = false;
|
|
806
|
+
runtimeCore.nextTick(() => {
|
|
807
|
+
if (!this._connected) {
|
|
808
|
+
if (this._ob) {
|
|
809
|
+
this._ob.disconnect();
|
|
810
|
+
this._ob = null;
|
|
811
|
+
}
|
|
812
|
+
this._unmount();
|
|
813
|
+
if (this._teleportTargets) {
|
|
814
|
+
this._teleportTargets.clear();
|
|
815
|
+
this._teleportTargets = void 0;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
});
|
|
819
|
+
}
|
|
800
820
|
_setParent(parent = this._parent) {
|
|
801
|
-
if (parent) {
|
|
821
|
+
if (parent && this._instance) {
|
|
802
822
|
this._instance.parent = parent._instance;
|
|
803
823
|
this._inheritParentContext(parent);
|
|
804
824
|
}
|
|
@@ -811,19 +831,10 @@ class VueElement extends BaseClass {
|
|
|
811
831
|
);
|
|
812
832
|
}
|
|
813
833
|
}
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
if (this._ob) {
|
|
819
|
-
this._ob.disconnect();
|
|
820
|
-
this._ob = null;
|
|
821
|
-
}
|
|
822
|
-
this._app && this._app.unmount();
|
|
823
|
-
if (this._instance) this._instance.ce = void 0;
|
|
824
|
-
this._app = this._instance = null;
|
|
825
|
-
}
|
|
826
|
-
});
|
|
834
|
+
_processMutations(mutations) {
|
|
835
|
+
for (const m of mutations) {
|
|
836
|
+
this._setAttr(m.attributeName);
|
|
837
|
+
}
|
|
827
838
|
}
|
|
828
839
|
/**
|
|
829
840
|
* resolve inner component definition (handle possible async component)
|
|
@@ -835,13 +846,9 @@ class VueElement extends BaseClass {
|
|
|
835
846
|
for (let i = 0; i < this.attributes.length; i++) {
|
|
836
847
|
this._setAttr(this.attributes[i].name);
|
|
837
848
|
}
|
|
838
|
-
this._ob = new MutationObserver((
|
|
839
|
-
for (const m of mutations) {
|
|
840
|
-
this._setAttr(m.attributeName);
|
|
841
|
-
}
|
|
842
|
-
});
|
|
849
|
+
this._ob = new MutationObserver(this._processMutations.bind(this));
|
|
843
850
|
this._ob.observe(this, { attributes: true });
|
|
844
|
-
const resolve = (def
|
|
851
|
+
const resolve = (def) => {
|
|
845
852
|
this._resolved = true;
|
|
846
853
|
this._pendingResolve = void 0;
|
|
847
854
|
const { props, styles } = def;
|
|
@@ -862,26 +869,25 @@ class VueElement extends BaseClass {
|
|
|
862
869
|
if (this.shadowRoot) {
|
|
863
870
|
this._applyStyles(styles);
|
|
864
871
|
}
|
|
865
|
-
this.
|
|
872
|
+
this._mountComponent(def);
|
|
866
873
|
};
|
|
867
874
|
const asyncDef = this._def.__asyncLoader;
|
|
868
875
|
if (asyncDef) {
|
|
876
|
+
const { configureApp } = this._def;
|
|
869
877
|
this._pendingResolve = asyncDef().then((def) => {
|
|
870
|
-
def.configureApp =
|
|
871
|
-
|
|
878
|
+
def.configureApp = configureApp;
|
|
879
|
+
this._def = def;
|
|
880
|
+
resolve(def);
|
|
872
881
|
});
|
|
873
882
|
} else {
|
|
874
883
|
resolve(this._def);
|
|
875
884
|
}
|
|
876
885
|
}
|
|
877
|
-
|
|
878
|
-
this.
|
|
879
|
-
this.
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
}
|
|
883
|
-
this._app._ceVNode = this._createVNode();
|
|
884
|
-
this._app.mount(this._root);
|
|
886
|
+
_mountComponent(def) {
|
|
887
|
+
this._mount(def);
|
|
888
|
+
this._processExposed();
|
|
889
|
+
}
|
|
890
|
+
_processExposed() {
|
|
885
891
|
const exposed = this._instance && this._instance.exposed;
|
|
886
892
|
if (!exposed) return;
|
|
887
893
|
for (const key in exposed) {
|
|
@@ -893,6 +899,25 @@ class VueElement extends BaseClass {
|
|
|
893
899
|
}
|
|
894
900
|
}
|
|
895
901
|
}
|
|
902
|
+
_processInstance() {
|
|
903
|
+
this._instance.ce = this;
|
|
904
|
+
this._instance.isCE = true;
|
|
905
|
+
const dispatch = (event, args) => {
|
|
906
|
+
this.dispatchEvent(
|
|
907
|
+
new CustomEvent(
|
|
908
|
+
event,
|
|
909
|
+
shared.isPlainObject(args[0]) ? shared.extend({ detail: args }, args[0]) : { detail: args }
|
|
910
|
+
)
|
|
911
|
+
);
|
|
912
|
+
};
|
|
913
|
+
this._instance.emit = (event, ...args) => {
|
|
914
|
+
dispatch(event, args);
|
|
915
|
+
if (shared.hyphenate(event) !== event) {
|
|
916
|
+
dispatch(shared.hyphenate(event), args);
|
|
917
|
+
}
|
|
918
|
+
};
|
|
919
|
+
this._setParent();
|
|
920
|
+
}
|
|
896
921
|
_resolveProps(def) {
|
|
897
922
|
const { props } = def;
|
|
898
923
|
const declaredPropKeys = shared.isArray(props) ? props : Object.keys(props || {});
|
|
@@ -907,7 +932,7 @@ class VueElement extends BaseClass {
|
|
|
907
932
|
return this._getProp(key);
|
|
908
933
|
},
|
|
909
934
|
set(val) {
|
|
910
|
-
this._setProp(key, val, true,
|
|
935
|
+
this._setProp(key, val, true, !this._patching);
|
|
911
936
|
}
|
|
912
937
|
});
|
|
913
938
|
}
|
|
@@ -933,11 +958,12 @@ class VueElement extends BaseClass {
|
|
|
933
958
|
*/
|
|
934
959
|
_setProp(key, val, shouldReflect = true, shouldUpdate = false) {
|
|
935
960
|
if (val !== this._props[key]) {
|
|
961
|
+
this._dirty = true;
|
|
936
962
|
if (val === REMOVAL) {
|
|
937
963
|
delete this._props[key];
|
|
938
964
|
} else {
|
|
939
965
|
this._props[key] = val;
|
|
940
|
-
if (key === "key" && this._app) {
|
|
966
|
+
if (key === "key" && this._app && this._app._ceVNode) {
|
|
941
967
|
this._app._ceVNode.key = val;
|
|
942
968
|
}
|
|
943
969
|
}
|
|
@@ -946,7 +972,10 @@ class VueElement extends BaseClass {
|
|
|
946
972
|
}
|
|
947
973
|
if (shouldReflect) {
|
|
948
974
|
const ob = this._ob;
|
|
949
|
-
|
|
975
|
+
if (ob) {
|
|
976
|
+
this._processMutations(ob.takeRecords());
|
|
977
|
+
ob.disconnect();
|
|
978
|
+
}
|
|
950
979
|
if (val === true) {
|
|
951
980
|
this.setAttribute(shared.hyphenate(key), "");
|
|
952
981
|
} else if (typeof val === "string" || typeof val === "number") {
|
|
@@ -958,41 +987,6 @@ class VueElement extends BaseClass {
|
|
|
958
987
|
}
|
|
959
988
|
}
|
|
960
989
|
}
|
|
961
|
-
_update() {
|
|
962
|
-
const vnode = this._createVNode();
|
|
963
|
-
if (this._app) vnode.appContext = this._app._context;
|
|
964
|
-
render(vnode, this._root);
|
|
965
|
-
}
|
|
966
|
-
_createVNode() {
|
|
967
|
-
const baseProps = {};
|
|
968
|
-
if (!this.shadowRoot) {
|
|
969
|
-
baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
|
|
970
|
-
}
|
|
971
|
-
const vnode = runtimeCore.createVNode(this._def, shared.extend(baseProps, this._props));
|
|
972
|
-
if (!this._instance) {
|
|
973
|
-
vnode.ce = (instance) => {
|
|
974
|
-
this._instance = instance;
|
|
975
|
-
instance.ce = this;
|
|
976
|
-
instance.isCE = true;
|
|
977
|
-
const dispatch = (event, args) => {
|
|
978
|
-
this.dispatchEvent(
|
|
979
|
-
new CustomEvent(
|
|
980
|
-
event,
|
|
981
|
-
shared.isPlainObject(args[0]) ? shared.extend({ detail: args }, args[0]) : { detail: args }
|
|
982
|
-
)
|
|
983
|
-
);
|
|
984
|
-
};
|
|
985
|
-
instance.emit = (event, ...args) => {
|
|
986
|
-
dispatch(event, args);
|
|
987
|
-
if (shared.hyphenate(event) !== event) {
|
|
988
|
-
dispatch(shared.hyphenate(event), args);
|
|
989
|
-
}
|
|
990
|
-
};
|
|
991
|
-
this._setParent();
|
|
992
|
-
};
|
|
993
|
-
}
|
|
994
|
-
return vnode;
|
|
995
|
-
}
|
|
996
990
|
_applyStyles(styles, owner) {
|
|
997
991
|
if (!styles) return;
|
|
998
992
|
if (owner) {
|
|
@@ -1025,13 +1019,15 @@ class VueElement extends BaseClass {
|
|
|
1025
1019
|
* Only called when shadowRoot is false
|
|
1026
1020
|
*/
|
|
1027
1021
|
_renderSlots() {
|
|
1028
|
-
const outlets =
|
|
1022
|
+
const outlets = this._getSlots();
|
|
1029
1023
|
const scopeId = this._instance.type.__scopeId;
|
|
1024
|
+
const slotReplacements = /* @__PURE__ */ new Map();
|
|
1030
1025
|
for (let i = 0; i < outlets.length; i++) {
|
|
1031
1026
|
const o = outlets[i];
|
|
1032
1027
|
const slotName = o.getAttribute("name") || "default";
|
|
1033
1028
|
const content = this._slots[slotName];
|
|
1034
1029
|
const parent = o.parentNode;
|
|
1030
|
+
const replacementNodes = [];
|
|
1035
1031
|
if (content) {
|
|
1036
1032
|
for (const n of content) {
|
|
1037
1033
|
if (scopeId && n.nodeType === 1) {
|
|
@@ -1044,12 +1040,36 @@ class VueElement extends BaseClass {
|
|
|
1044
1040
|
}
|
|
1045
1041
|
}
|
|
1046
1042
|
parent.insertBefore(n, o);
|
|
1043
|
+
replacementNodes.push(n);
|
|
1047
1044
|
}
|
|
1048
1045
|
} else {
|
|
1049
|
-
while (o.firstChild)
|
|
1046
|
+
while (o.firstChild) {
|
|
1047
|
+
const child = o.firstChild;
|
|
1048
|
+
parent.insertBefore(child, o);
|
|
1049
|
+
replacementNodes.push(child);
|
|
1050
|
+
}
|
|
1050
1051
|
}
|
|
1051
1052
|
parent.removeChild(o);
|
|
1053
|
+
slotReplacements.set(o, replacementNodes);
|
|
1052
1054
|
}
|
|
1055
|
+
this._updateSlotNodes(slotReplacements);
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* @internal
|
|
1059
|
+
*/
|
|
1060
|
+
_getSlots() {
|
|
1061
|
+
const roots = [this];
|
|
1062
|
+
if (this._teleportTargets) {
|
|
1063
|
+
roots.push(...this._teleportTargets);
|
|
1064
|
+
}
|
|
1065
|
+
const slots = /* @__PURE__ */ new Set();
|
|
1066
|
+
for (const root of roots) {
|
|
1067
|
+
const found = root.querySelectorAll("slot");
|
|
1068
|
+
for (let i = 0; i < found.length; i++) {
|
|
1069
|
+
slots.add(found[i]);
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
return Array.from(slots);
|
|
1053
1073
|
}
|
|
1054
1074
|
/**
|
|
1055
1075
|
* @internal
|
|
@@ -1057,15 +1077,85 @@ class VueElement extends BaseClass {
|
|
|
1057
1077
|
_injectChildStyle(comp) {
|
|
1058
1078
|
this._applyStyles(comp.styles, comp);
|
|
1059
1079
|
}
|
|
1080
|
+
/**
|
|
1081
|
+
* @internal
|
|
1082
|
+
*/
|
|
1083
|
+
_beginPatch() {
|
|
1084
|
+
this._patching = true;
|
|
1085
|
+
this._dirty = false;
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* @internal
|
|
1089
|
+
*/
|
|
1090
|
+
_endPatch() {
|
|
1091
|
+
this._patching = false;
|
|
1092
|
+
if (this._dirty && this._instance) {
|
|
1093
|
+
this._update();
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1060
1096
|
/**
|
|
1061
1097
|
* @internal
|
|
1062
1098
|
*/
|
|
1063
1099
|
_removeChildStyle(comp) {
|
|
1064
1100
|
}
|
|
1065
1101
|
}
|
|
1102
|
+
class VueElement extends VueElementBase {
|
|
1103
|
+
constructor(def, props = {}, createAppFn = createApp) {
|
|
1104
|
+
super(def, props, createAppFn);
|
|
1105
|
+
}
|
|
1106
|
+
_needsHydration() {
|
|
1107
|
+
if (this.shadowRoot && this._createApp !== createApp) {
|
|
1108
|
+
return true;
|
|
1109
|
+
}
|
|
1110
|
+
return false;
|
|
1111
|
+
}
|
|
1112
|
+
_mount(def) {
|
|
1113
|
+
this._app = this._createApp(def);
|
|
1114
|
+
this._inheritParentContext();
|
|
1115
|
+
if (def.configureApp) {
|
|
1116
|
+
def.configureApp(this._app);
|
|
1117
|
+
}
|
|
1118
|
+
this._app._ceVNode = this._createVNode();
|
|
1119
|
+
this._app.mount(this._root);
|
|
1120
|
+
}
|
|
1121
|
+
_update() {
|
|
1122
|
+
if (!this._app) return;
|
|
1123
|
+
const vnode = this._createVNode();
|
|
1124
|
+
vnode.appContext = this._app._context;
|
|
1125
|
+
render(vnode, this._root);
|
|
1126
|
+
}
|
|
1127
|
+
_unmount() {
|
|
1128
|
+
if (this._app) {
|
|
1129
|
+
this._app.unmount();
|
|
1130
|
+
}
|
|
1131
|
+
if (this._instance && this._instance.ce) {
|
|
1132
|
+
this._instance.ce = void 0;
|
|
1133
|
+
}
|
|
1134
|
+
this._app = this._instance = null;
|
|
1135
|
+
}
|
|
1136
|
+
/**
|
|
1137
|
+
* Only called when shadowRoot is false
|
|
1138
|
+
*/
|
|
1139
|
+
_updateSlotNodes(replacements) {
|
|
1140
|
+
}
|
|
1141
|
+
_createVNode() {
|
|
1142
|
+
const baseProps = {};
|
|
1143
|
+
if (!this.shadowRoot) {
|
|
1144
|
+
baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
|
|
1145
|
+
}
|
|
1146
|
+
const vnode = runtimeCore.createVNode(this._def, shared.extend(baseProps, this._props));
|
|
1147
|
+
if (!this._instance) {
|
|
1148
|
+
vnode.ce = (instance) => {
|
|
1149
|
+
this._instance = instance;
|
|
1150
|
+
this._processInstance();
|
|
1151
|
+
};
|
|
1152
|
+
}
|
|
1153
|
+
return vnode;
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1066
1156
|
function useHost(caller) {
|
|
1067
|
-
const
|
|
1068
|
-
const el =
|
|
1157
|
+
const { hasInstance, value } = runtimeCore.useInstanceOption("ce", true);
|
|
1158
|
+
const el = value;
|
|
1069
1159
|
if (el) {
|
|
1070
1160
|
return el;
|
|
1071
1161
|
}
|
|
@@ -1078,11 +1168,11 @@ function useShadowRoot() {
|
|
|
1078
1168
|
|
|
1079
1169
|
function useCssModule(name = "$style") {
|
|
1080
1170
|
{
|
|
1081
|
-
const
|
|
1082
|
-
if (!
|
|
1171
|
+
const { hasInstance, value: type } = runtimeCore.useInstanceOption("type", true);
|
|
1172
|
+
if (!hasInstance) {
|
|
1083
1173
|
return shared.EMPTY_OBJ;
|
|
1084
1174
|
}
|
|
1085
|
-
const modules =
|
|
1175
|
+
const modules = type.__cssModules;
|
|
1086
1176
|
if (!modules) {
|
|
1087
1177
|
return shared.EMPTY_OBJ;
|
|
1088
1178
|
}
|
|
@@ -1126,26 +1216,13 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
|
|
|
1126
1216
|
prevChildren = [];
|
|
1127
1217
|
return;
|
|
1128
1218
|
}
|
|
1129
|
-
prevChildren.forEach(callPendingCbs);
|
|
1219
|
+
prevChildren.forEach((vnode) => callPendingCbs(vnode.el));
|
|
1130
1220
|
prevChildren.forEach(recordPosition);
|
|
1131
1221
|
const movedChildren = prevChildren.filter(applyTranslation);
|
|
1132
|
-
forceReflow();
|
|
1222
|
+
forceReflow(instance.vnode.el);
|
|
1133
1223
|
movedChildren.forEach((c) => {
|
|
1134
1224
|
const el = c.el;
|
|
1135
|
-
|
|
1136
|
-
addTransitionClass(el, moveClass);
|
|
1137
|
-
style.transform = style.webkitTransform = style.transitionDuration = "";
|
|
1138
|
-
const cb = el[moveCbKey] = (e) => {
|
|
1139
|
-
if (e && e.target !== el) {
|
|
1140
|
-
return;
|
|
1141
|
-
}
|
|
1142
|
-
if (!e || /transform$/.test(e.propertyName)) {
|
|
1143
|
-
el.removeEventListener("transitionend", cb);
|
|
1144
|
-
el[moveCbKey] = null;
|
|
1145
|
-
removeTransitionClass(el, moveClass);
|
|
1146
|
-
}
|
|
1147
|
-
};
|
|
1148
|
-
el.addEventListener("transitionend", cb);
|
|
1225
|
+
handleMovedChildren(el, moveClass);
|
|
1149
1226
|
});
|
|
1150
1227
|
prevChildren = [];
|
|
1151
1228
|
});
|
|
@@ -1168,10 +1245,10 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
|
|
|
1168
1245
|
instance
|
|
1169
1246
|
)
|
|
1170
1247
|
);
|
|
1171
|
-
positionMap.set(
|
|
1172
|
-
child,
|
|
1173
|
-
child.el.
|
|
1174
|
-
);
|
|
1248
|
+
positionMap.set(child, {
|
|
1249
|
+
left: child.el.offsetLeft,
|
|
1250
|
+
top: child.el.offsetTop
|
|
1251
|
+
});
|
|
1175
1252
|
}
|
|
1176
1253
|
}
|
|
1177
1254
|
}
|
|
@@ -1190,8 +1267,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
|
|
|
1190
1267
|
}
|
|
1191
1268
|
});
|
|
1192
1269
|
const TransitionGroup = TransitionGroupImpl;
|
|
1193
|
-
function callPendingCbs(
|
|
1194
|
-
const el = c.el;
|
|
1270
|
+
function callPendingCbs(el) {
|
|
1195
1271
|
if (el[moveCbKey]) {
|
|
1196
1272
|
el[moveCbKey]();
|
|
1197
1273
|
}
|
|
@@ -1200,19 +1276,30 @@ function callPendingCbs(c) {
|
|
|
1200
1276
|
}
|
|
1201
1277
|
}
|
|
1202
1278
|
function recordPosition(c) {
|
|
1203
|
-
newPositionMap.set(c,
|
|
1279
|
+
newPositionMap.set(c, {
|
|
1280
|
+
left: c.el.offsetLeft,
|
|
1281
|
+
top: c.el.offsetTop
|
|
1282
|
+
});
|
|
1204
1283
|
}
|
|
1205
1284
|
function applyTranslation(c) {
|
|
1206
|
-
|
|
1207
|
-
|
|
1285
|
+
if (baseApplyTranslation(
|
|
1286
|
+
positionMap.get(c),
|
|
1287
|
+
newPositionMap.get(c),
|
|
1288
|
+
c.el
|
|
1289
|
+
)) {
|
|
1290
|
+
return c;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
function baseApplyTranslation(oldPos, newPos, el) {
|
|
1208
1294
|
const dx = oldPos.left - newPos.left;
|
|
1209
1295
|
const dy = oldPos.top - newPos.top;
|
|
1210
1296
|
if (dx || dy) {
|
|
1211
|
-
const s =
|
|
1297
|
+
const s = el.style;
|
|
1212
1298
|
s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
|
|
1213
1299
|
s.transitionDuration = "0s";
|
|
1214
|
-
return
|
|
1300
|
+
return true;
|
|
1215
1301
|
}
|
|
1302
|
+
return false;
|
|
1216
1303
|
}
|
|
1217
1304
|
function hasCSSTransform(el, root, moveClass) {
|
|
1218
1305
|
const clone = el.cloneNode();
|
|
@@ -1230,6 +1317,22 @@ function hasCSSTransform(el, root, moveClass) {
|
|
|
1230
1317
|
container.removeChild(clone);
|
|
1231
1318
|
return hasTransform;
|
|
1232
1319
|
}
|
|
1320
|
+
const handleMovedChildren = (el, moveClass) => {
|
|
1321
|
+
const style = el.style;
|
|
1322
|
+
addTransitionClass(el, moveClass);
|
|
1323
|
+
style.transform = style.webkitTransform = style.transitionDuration = "";
|
|
1324
|
+
const cb = el[moveCbKey] = (e) => {
|
|
1325
|
+
if (e && e.target !== el) {
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
if (!e || e.propertyName.endsWith("transform")) {
|
|
1329
|
+
el.removeEventListener("transitionend", cb);
|
|
1330
|
+
el[moveCbKey] = null;
|
|
1331
|
+
removeTransitionClass(el, moveClass);
|
|
1332
|
+
}
|
|
1333
|
+
};
|
|
1334
|
+
el.addEventListener("transitionend", cb);
|
|
1335
|
+
};
|
|
1233
1336
|
|
|
1234
1337
|
const getModelAssigner = (vnode) => {
|
|
1235
1338
|
const fn = vnode.props["onUpdate:modelValue"] || false;
|
|
@@ -1265,21 +1368,21 @@ const vModelText = {
|
|
|
1265
1368
|
vModelTextUpdate(el, oldValue, value, trim, number, lazy);
|
|
1266
1369
|
}
|
|
1267
1370
|
};
|
|
1371
|
+
function castValue(value, trim, number) {
|
|
1372
|
+
if (trim) value = value.trim();
|
|
1373
|
+
if (number) value = shared.looseToNumber(value);
|
|
1374
|
+
return value;
|
|
1375
|
+
}
|
|
1268
1376
|
const vModelTextInit = (el, trim, number, lazy, set) => {
|
|
1269
1377
|
addEventListener(el, lazy ? "change" : "input", (e) => {
|
|
1270
1378
|
if (e.target.composing) return;
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
}
|
|
1275
|
-
if (number || el.type === "number") {
|
|
1276
|
-
domValue = shared.looseToNumber(domValue);
|
|
1277
|
-
}
|
|
1278
|
-
(0, el[assignKey])(domValue);
|
|
1379
|
+
(0, el[assignKey])(
|
|
1380
|
+
castValue(el.value, trim, number || el.type === "number")
|
|
1381
|
+
);
|
|
1279
1382
|
});
|
|
1280
|
-
if (trim) {
|
|
1383
|
+
if (trim || number) {
|
|
1281
1384
|
addEventListener(el, "change", () => {
|
|
1282
|
-
el.value = el.value.
|
|
1385
|
+
el.value = castValue(el.value, trim, number || el.type === "number");
|
|
1283
1386
|
});
|
|
1284
1387
|
}
|
|
1285
1388
|
if (!lazy) {
|
|
@@ -1559,13 +1662,13 @@ const modifierGuards = {
|
|
|
1559
1662
|
const withModifiers = (fn, modifiers) => {
|
|
1560
1663
|
const cache = fn._withMods || (fn._withMods = {});
|
|
1561
1664
|
const cacheKey = modifiers.join(".");
|
|
1562
|
-
return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
|
|
1665
|
+
return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
|
|
1563
1666
|
for (let i = 0; i < modifiers.length; i++) {
|
|
1564
1667
|
const guard = modifierGuards[modifiers[i]];
|
|
1565
1668
|
if (guard && guard(event, modifiers)) return;
|
|
1566
1669
|
}
|
|
1567
1670
|
return fn(event, ...args);
|
|
1568
|
-
});
|
|
1671
|
+
}));
|
|
1569
1672
|
};
|
|
1570
1673
|
const keyNames = {
|
|
1571
1674
|
esc: "escape",
|
|
@@ -1579,7 +1682,7 @@ const keyNames = {
|
|
|
1579
1682
|
const withKeys = (fn, modifiers) => {
|
|
1580
1683
|
const cache = fn._withKeys || (fn._withKeys = {});
|
|
1581
1684
|
const cacheKey = modifiers.join(".");
|
|
1582
|
-
return cache[cacheKey] || (cache[cacheKey] = (event) => {
|
|
1685
|
+
return cache[cacheKey] || (cache[cacheKey] = ((event) => {
|
|
1583
1686
|
if (!("key" in event)) {
|
|
1584
1687
|
return;
|
|
1585
1688
|
}
|
|
@@ -1589,7 +1692,7 @@ const withKeys = (fn, modifiers) => {
|
|
|
1589
1692
|
)) {
|
|
1590
1693
|
return fn(event);
|
|
1591
1694
|
}
|
|
1592
|
-
});
|
|
1695
|
+
}));
|
|
1593
1696
|
};
|
|
1594
1697
|
|
|
1595
1698
|
const rendererOptions = /* @__PURE__ */ shared.extend({ patchProp }, nodeOps);
|
|
@@ -1603,13 +1706,13 @@ function ensureHydrationRenderer() {
|
|
|
1603
1706
|
enabledHydration = true;
|
|
1604
1707
|
return renderer;
|
|
1605
1708
|
}
|
|
1606
|
-
const render = (...args) => {
|
|
1709
|
+
const render = ((...args) => {
|
|
1607
1710
|
ensureRenderer().render(...args);
|
|
1608
|
-
};
|
|
1609
|
-
const hydrate = (...args) => {
|
|
1711
|
+
});
|
|
1712
|
+
const hydrate = ((...args) => {
|
|
1610
1713
|
ensureHydrationRenderer().hydrate(...args);
|
|
1611
|
-
};
|
|
1612
|
-
const createApp = (...args) => {
|
|
1714
|
+
});
|
|
1715
|
+
const createApp = ((...args) => {
|
|
1613
1716
|
const app = ensureRenderer().createApp(...args);
|
|
1614
1717
|
const { mount } = app;
|
|
1615
1718
|
app.mount = (containerOrSelector) => {
|
|
@@ -1630,8 +1733,8 @@ const createApp = (...args) => {
|
|
|
1630
1733
|
return proxy;
|
|
1631
1734
|
};
|
|
1632
1735
|
return app;
|
|
1633
|
-
};
|
|
1634
|
-
const createSSRApp = (...args) => {
|
|
1736
|
+
});
|
|
1737
|
+
const createSSRApp = ((...args) => {
|
|
1635
1738
|
const app = ensureHydrationRenderer().createApp(...args);
|
|
1636
1739
|
const { mount } = app;
|
|
1637
1740
|
app.mount = (containerOrSelector) => {
|
|
@@ -1641,7 +1744,7 @@ const createSSRApp = (...args) => {
|
|
|
1641
1744
|
}
|
|
1642
1745
|
};
|
|
1643
1746
|
return app;
|
|
1644
|
-
};
|
|
1747
|
+
});
|
|
1645
1748
|
function resolveRootNamespace(container) {
|
|
1646
1749
|
if (container instanceof SVGElement) {
|
|
1647
1750
|
return "svg";
|
|
@@ -1669,12 +1772,15 @@ const initDirectivesForSSR = () => {
|
|
|
1669
1772
|
exports.Transition = Transition;
|
|
1670
1773
|
exports.TransitionGroup = TransitionGroup;
|
|
1671
1774
|
exports.VueElement = VueElement;
|
|
1775
|
+
exports.VueElementBase = VueElementBase;
|
|
1672
1776
|
exports.createApp = createApp;
|
|
1673
1777
|
exports.createSSRApp = createSSRApp;
|
|
1674
1778
|
exports.defineCustomElement = defineCustomElement;
|
|
1675
1779
|
exports.defineSSRCustomElement = defineSSRCustomElement;
|
|
1676
1780
|
exports.hydrate = hydrate;
|
|
1677
1781
|
exports.initDirectivesForSSR = initDirectivesForSSR;
|
|
1782
|
+
exports.nodeOps = nodeOps;
|
|
1783
|
+
exports.patchProp = patchProp;
|
|
1678
1784
|
exports.render = render;
|
|
1679
1785
|
exports.useCssModule = useCssModule;
|
|
1680
1786
|
exports.useCssVars = useCssVars;
|