@vue/runtime-dom 3.5.0-alpha.4 → 3.5.0-beta.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/README.md +2 -2
- package/dist/runtime-dom.cjs.js +258 -48
- package/dist/runtime-dom.cjs.prod.js +215 -46
- package/dist/runtime-dom.d.ts +60 -40
- package/dist/runtime-dom.esm-browser.js +3106 -2668
- package/dist/runtime-dom.esm-browser.prod.js +2 -2
- package/dist/runtime-dom.esm-bundler.js +267 -53
- package/dist/runtime-dom.global.js +3102 -2664
- package/dist/runtime-dom.global.prod.js +2 -2
- package/package.json +7 -4
package/README.md
CHANGED
package/dist/runtime-dom.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.5.0-
|
|
2
|
+
* @vue/runtime-dom v3.5.0-beta.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -10,6 +10,18 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
10
10
|
var runtimeCore = require('@vue/runtime-core');
|
|
11
11
|
var shared = require('@vue/shared');
|
|
12
12
|
|
|
13
|
+
let policy = void 0;
|
|
14
|
+
const tt = typeof window !== "undefined" && window.trustedTypes;
|
|
15
|
+
if (tt) {
|
|
16
|
+
try {
|
|
17
|
+
policy = /* @__PURE__ */ tt.createPolicy("vue", {
|
|
18
|
+
createHTML: (val) => val
|
|
19
|
+
});
|
|
20
|
+
} catch (e) {
|
|
21
|
+
runtimeCore.warn(`Error creating trusted types policy: ${e}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
|
|
13
25
|
const svgNS = "http://www.w3.org/2000/svg";
|
|
14
26
|
const mathmlNS = "http://www.w3.org/1998/Math/MathML";
|
|
15
27
|
const doc = typeof document !== "undefined" ? document : null;
|
|
@@ -57,7 +69,9 @@ const nodeOps = {
|
|
|
57
69
|
if (start === end || !(start = start.nextSibling)) break;
|
|
58
70
|
}
|
|
59
71
|
} else {
|
|
60
|
-
templateContainer.innerHTML =
|
|
72
|
+
templateContainer.innerHTML = unsafeToTrustedHTML(
|
|
73
|
+
namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
|
|
74
|
+
);
|
|
61
75
|
const template = templateContainer.content;
|
|
62
76
|
if (namespace === "svg" || namespace === "mathml") {
|
|
63
77
|
const wrapper = template.firstChild;
|
|
@@ -724,16 +738,24 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
724
738
|
if (isNativeOn(key) && shared.isString(value)) {
|
|
725
739
|
return false;
|
|
726
740
|
}
|
|
727
|
-
|
|
741
|
+
if (key in el) {
|
|
742
|
+
return true;
|
|
743
|
+
}
|
|
744
|
+
if (el._isVueCE && (/[A-Z]/.test(key) || !shared.isString(value))) {
|
|
745
|
+
return true;
|
|
746
|
+
}
|
|
747
|
+
return false;
|
|
728
748
|
}
|
|
729
749
|
|
|
750
|
+
const REMOVAL = {};
|
|
730
751
|
/*! #__NO_SIDE_EFFECTS__ */
|
|
731
752
|
// @__NO_SIDE_EFFECTS__
|
|
732
|
-
function defineCustomElement(options, extraOptions,
|
|
753
|
+
function defineCustomElement(options, extraOptions, _createApp) {
|
|
733
754
|
const Comp = runtimeCore.defineComponent(options, extraOptions);
|
|
755
|
+
if (shared.isPlainObject(Comp)) shared.extend(Comp, extraOptions);
|
|
734
756
|
class VueCustomElement extends VueElement {
|
|
735
757
|
constructor(initialProps) {
|
|
736
|
-
super(Comp, initialProps,
|
|
758
|
+
super(Comp, initialProps, _createApp);
|
|
737
759
|
}
|
|
738
760
|
}
|
|
739
761
|
VueCustomElement.def = Comp;
|
|
@@ -741,47 +763,88 @@ function defineCustomElement(options, extraOptions, hydrate2) {
|
|
|
741
763
|
}
|
|
742
764
|
/*! #__NO_SIDE_EFFECTS__ */
|
|
743
765
|
const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
|
|
744
|
-
return /* @__PURE__ */ defineCustomElement(options, extraOptions,
|
|
766
|
+
return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
|
|
745
767
|
};
|
|
746
768
|
const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
|
|
747
769
|
};
|
|
748
770
|
class VueElement extends BaseClass {
|
|
749
|
-
constructor(_def, _props = {},
|
|
771
|
+
constructor(_def, _props = {}, _createApp = createApp) {
|
|
750
772
|
super();
|
|
751
773
|
this._def = _def;
|
|
752
774
|
this._props = _props;
|
|
775
|
+
this._createApp = _createApp;
|
|
776
|
+
this._isVueCE = true;
|
|
753
777
|
/**
|
|
754
778
|
* @internal
|
|
755
779
|
*/
|
|
756
780
|
this._instance = null;
|
|
781
|
+
/**
|
|
782
|
+
* @internal
|
|
783
|
+
*/
|
|
784
|
+
this._app = null;
|
|
785
|
+
/**
|
|
786
|
+
* @internal
|
|
787
|
+
*/
|
|
788
|
+
this._nonce = this._def.nonce;
|
|
757
789
|
this._connected = false;
|
|
758
790
|
this._resolved = false;
|
|
759
791
|
this._numberProps = null;
|
|
792
|
+
this._styleChildren = /* @__PURE__ */ new WeakSet();
|
|
760
793
|
this._ob = null;
|
|
761
|
-
if (this.shadowRoot &&
|
|
762
|
-
|
|
794
|
+
if (this.shadowRoot && _createApp !== createApp) {
|
|
795
|
+
this._root = this.shadowRoot;
|
|
796
|
+
this._mount(_def);
|
|
763
797
|
} else {
|
|
764
798
|
if (this.shadowRoot) {
|
|
765
799
|
runtimeCore.warn(
|
|
766
800
|
`Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
|
|
767
801
|
);
|
|
768
802
|
}
|
|
769
|
-
|
|
803
|
+
if (_def.shadowRoot !== false) {
|
|
804
|
+
this.attachShadow({ mode: "open" });
|
|
805
|
+
this._root = this.shadowRoot;
|
|
806
|
+
} else {
|
|
807
|
+
this._root = this;
|
|
808
|
+
}
|
|
770
809
|
if (!this._def.__asyncLoader) {
|
|
771
810
|
this._resolveProps(this._def);
|
|
772
811
|
}
|
|
773
812
|
}
|
|
774
813
|
}
|
|
775
814
|
connectedCallback() {
|
|
815
|
+
if (!this.shadowRoot) {
|
|
816
|
+
this._parseSlots();
|
|
817
|
+
}
|
|
776
818
|
this._connected = true;
|
|
819
|
+
let parent = this;
|
|
820
|
+
while (parent = parent && (parent.parentNode || parent.host)) {
|
|
821
|
+
if (parent instanceof VueElement) {
|
|
822
|
+
this._parent = parent;
|
|
823
|
+
break;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
777
826
|
if (!this._instance) {
|
|
778
827
|
if (this._resolved) {
|
|
828
|
+
this._setParent();
|
|
779
829
|
this._update();
|
|
780
830
|
} else {
|
|
781
|
-
|
|
831
|
+
if (parent && parent._pendingResolve) {
|
|
832
|
+
this._pendingResolve = parent._pendingResolve.then(() => {
|
|
833
|
+
this._pendingResolve = void 0;
|
|
834
|
+
this._resolveDef();
|
|
835
|
+
});
|
|
836
|
+
} else {
|
|
837
|
+
this._resolveDef();
|
|
838
|
+
}
|
|
782
839
|
}
|
|
783
840
|
}
|
|
784
841
|
}
|
|
842
|
+
_setParent(parent = this._parent) {
|
|
843
|
+
if (parent) {
|
|
844
|
+
this._instance.parent = parent._instance;
|
|
845
|
+
this._instance.provides = parent._instance.provides;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
785
848
|
disconnectedCallback() {
|
|
786
849
|
this._connected = false;
|
|
787
850
|
runtimeCore.nextTick(() => {
|
|
@@ -790,8 +853,9 @@ class VueElement extends BaseClass {
|
|
|
790
853
|
this._ob.disconnect();
|
|
791
854
|
this._ob = null;
|
|
792
855
|
}
|
|
793
|
-
|
|
794
|
-
this._instance =
|
|
856
|
+
this._app && this._app.unmount();
|
|
857
|
+
this._instance.ce = void 0;
|
|
858
|
+
this._app = this._instance = null;
|
|
795
859
|
}
|
|
796
860
|
});
|
|
797
861
|
}
|
|
@@ -799,7 +863,9 @@ class VueElement extends BaseClass {
|
|
|
799
863
|
* resolve inner component definition (handle possible async component)
|
|
800
864
|
*/
|
|
801
865
|
_resolveDef() {
|
|
802
|
-
this.
|
|
866
|
+
if (this._pendingResolve) {
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
803
869
|
for (let i = 0; i < this.attributes.length; i++) {
|
|
804
870
|
this._setAttr(this.attributes[i].name);
|
|
805
871
|
}
|
|
@@ -810,6 +876,8 @@ class VueElement extends BaseClass {
|
|
|
810
876
|
});
|
|
811
877
|
this._ob.observe(this, { attributes: true });
|
|
812
878
|
const resolve = (def, isAsync = false) => {
|
|
879
|
+
this._resolved = true;
|
|
880
|
+
this._pendingResolve = void 0;
|
|
813
881
|
const { props, styles } = def;
|
|
814
882
|
let numberProps;
|
|
815
883
|
if (props && !shared.isArray(props)) {
|
|
@@ -827,22 +895,53 @@ class VueElement extends BaseClass {
|
|
|
827
895
|
if (isAsync) {
|
|
828
896
|
this._resolveProps(def);
|
|
829
897
|
}
|
|
830
|
-
this.
|
|
831
|
-
|
|
898
|
+
if (this.shadowRoot) {
|
|
899
|
+
this._applyStyles(styles);
|
|
900
|
+
} else if (styles) {
|
|
901
|
+
runtimeCore.warn(
|
|
902
|
+
"Custom element style injection is not supported when using shadowRoot: false"
|
|
903
|
+
);
|
|
904
|
+
}
|
|
905
|
+
this._mount(def);
|
|
832
906
|
};
|
|
833
907
|
const asyncDef = this._def.__asyncLoader;
|
|
834
908
|
if (asyncDef) {
|
|
835
|
-
asyncDef().then(
|
|
909
|
+
this._pendingResolve = asyncDef().then(
|
|
910
|
+
(def) => resolve(this._def = def, true)
|
|
911
|
+
);
|
|
836
912
|
} else {
|
|
837
913
|
resolve(this._def);
|
|
838
914
|
}
|
|
839
915
|
}
|
|
916
|
+
_mount(def) {
|
|
917
|
+
if (!def.name) {
|
|
918
|
+
def.name = "VueElement";
|
|
919
|
+
}
|
|
920
|
+
this._app = this._createApp(def);
|
|
921
|
+
if (def.configureApp) {
|
|
922
|
+
def.configureApp(this._app);
|
|
923
|
+
}
|
|
924
|
+
this._app._ceVNode = this._createVNode();
|
|
925
|
+
this._app.mount(this._root);
|
|
926
|
+
const exposed = this._instance && this._instance.exposed;
|
|
927
|
+
if (!exposed) return;
|
|
928
|
+
for (const key in exposed) {
|
|
929
|
+
if (!shared.hasOwn(this, key)) {
|
|
930
|
+
Object.defineProperty(this, key, {
|
|
931
|
+
// unwrap ref to be consistent with public instance behavior
|
|
932
|
+
get: () => runtimeCore.unref(exposed[key])
|
|
933
|
+
});
|
|
934
|
+
} else {
|
|
935
|
+
runtimeCore.warn(`Exposed property "${key}" already exists on custom element.`);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
}
|
|
840
939
|
_resolveProps(def) {
|
|
841
940
|
const { props } = def;
|
|
842
941
|
const declaredPropKeys = shared.isArray(props) ? props : Object.keys(props || {});
|
|
843
942
|
for (const key of Object.keys(this)) {
|
|
844
943
|
if (key[0] !== "_" && declaredPropKeys.includes(key)) {
|
|
845
|
-
this._setProp(key, this[key]
|
|
944
|
+
this._setProp(key, this[key]);
|
|
846
945
|
}
|
|
847
946
|
}
|
|
848
947
|
for (const key of declaredPropKeys.map(shared.camelize)) {
|
|
@@ -851,18 +950,20 @@ class VueElement extends BaseClass {
|
|
|
851
950
|
return this._getProp(key);
|
|
852
951
|
},
|
|
853
952
|
set(val) {
|
|
854
|
-
this._setProp(key, val);
|
|
953
|
+
this._setProp(key, val, true, true);
|
|
855
954
|
}
|
|
856
955
|
});
|
|
857
956
|
}
|
|
858
957
|
}
|
|
859
958
|
_setAttr(key) {
|
|
860
|
-
|
|
959
|
+
if (key.startsWith("data-v-")) return;
|
|
960
|
+
const has = this.hasAttribute(key);
|
|
961
|
+
let value = has ? this.getAttribute(key) : REMOVAL;
|
|
861
962
|
const camelKey = shared.camelize(key);
|
|
862
|
-
if (this._numberProps && this._numberProps[camelKey]) {
|
|
963
|
+
if (has && this._numberProps && this._numberProps[camelKey]) {
|
|
863
964
|
value = shared.toNumber(value);
|
|
864
965
|
}
|
|
865
|
-
this._setProp(camelKey, value, false);
|
|
966
|
+
this._setProp(camelKey, value, false, true);
|
|
866
967
|
}
|
|
867
968
|
/**
|
|
868
969
|
* @internal
|
|
@@ -873,9 +974,13 @@ class VueElement extends BaseClass {
|
|
|
873
974
|
/**
|
|
874
975
|
* @internal
|
|
875
976
|
*/
|
|
876
|
-
_setProp(key, val, shouldReflect = true, shouldUpdate =
|
|
977
|
+
_setProp(key, val, shouldReflect = true, shouldUpdate = false) {
|
|
877
978
|
if (val !== this._props[key]) {
|
|
878
|
-
|
|
979
|
+
if (val === REMOVAL) {
|
|
980
|
+
delete this._props[key];
|
|
981
|
+
} else {
|
|
982
|
+
this._props[key] = val;
|
|
983
|
+
}
|
|
879
984
|
if (shouldUpdate && this._instance) {
|
|
880
985
|
this._update();
|
|
881
986
|
}
|
|
@@ -891,18 +996,22 @@ class VueElement extends BaseClass {
|
|
|
891
996
|
}
|
|
892
997
|
}
|
|
893
998
|
_update() {
|
|
894
|
-
render(this._createVNode(), this.
|
|
999
|
+
render(this._createVNode(), this._root);
|
|
895
1000
|
}
|
|
896
1001
|
_createVNode() {
|
|
897
|
-
const
|
|
1002
|
+
const baseProps = {};
|
|
1003
|
+
if (!this.shadowRoot) {
|
|
1004
|
+
baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
|
|
1005
|
+
}
|
|
1006
|
+
const vnode = runtimeCore.createVNode(this._def, shared.extend(baseProps, this._props));
|
|
898
1007
|
if (!this._instance) {
|
|
899
1008
|
vnode.ce = (instance) => {
|
|
900
1009
|
this._instance = instance;
|
|
901
|
-
instance.
|
|
1010
|
+
instance.ce = this;
|
|
902
1011
|
{
|
|
903
1012
|
instance.ceReload = (newStyles) => {
|
|
904
1013
|
if (this._styles) {
|
|
905
|
-
this._styles.forEach((s) => this.
|
|
1014
|
+
this._styles.forEach((s) => this._root.removeChild(s));
|
|
906
1015
|
this._styles.length = 0;
|
|
907
1016
|
}
|
|
908
1017
|
this._applyStyles(newStyles);
|
|
@@ -912,9 +1021,10 @@ class VueElement extends BaseClass {
|
|
|
912
1021
|
}
|
|
913
1022
|
const dispatch = (event, args) => {
|
|
914
1023
|
this.dispatchEvent(
|
|
915
|
-
new CustomEvent(
|
|
916
|
-
|
|
917
|
-
|
|
1024
|
+
new CustomEvent(
|
|
1025
|
+
event,
|
|
1026
|
+
shared.isPlainObject(args[0]) ? shared.extend({ detail: args }, args[0]) : { detail: args }
|
|
1027
|
+
)
|
|
918
1028
|
);
|
|
919
1029
|
};
|
|
920
1030
|
instance.emit = (event, ...args) => {
|
|
@@ -923,30 +1033,126 @@ class VueElement extends BaseClass {
|
|
|
923
1033
|
dispatch(shared.hyphenate(event), args);
|
|
924
1034
|
}
|
|
925
1035
|
};
|
|
926
|
-
|
|
927
|
-
while (parent = parent && (parent.parentNode || parent.host)) {
|
|
928
|
-
if (parent instanceof VueElement) {
|
|
929
|
-
instance.parent = parent._instance;
|
|
930
|
-
instance.provides = parent._instance.provides;
|
|
931
|
-
break;
|
|
932
|
-
}
|
|
933
|
-
}
|
|
1036
|
+
this._setParent();
|
|
934
1037
|
};
|
|
935
1038
|
}
|
|
936
1039
|
return vnode;
|
|
937
1040
|
}
|
|
938
|
-
_applyStyles(styles) {
|
|
939
|
-
if (styles)
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
1041
|
+
_applyStyles(styles, owner) {
|
|
1042
|
+
if (!styles) return;
|
|
1043
|
+
if (owner) {
|
|
1044
|
+
if (owner === this._def || this._styleChildren.has(owner)) {
|
|
1045
|
+
return;
|
|
1046
|
+
}
|
|
1047
|
+
this._styleChildren.add(owner);
|
|
1048
|
+
}
|
|
1049
|
+
const nonce = this._nonce;
|
|
1050
|
+
for (let i = styles.length - 1; i >= 0; i--) {
|
|
1051
|
+
const s = document.createElement("style");
|
|
1052
|
+
if (nonce) s.setAttribute("nonce", nonce);
|
|
1053
|
+
s.textContent = styles[i];
|
|
1054
|
+
this.shadowRoot.prepend(s);
|
|
1055
|
+
{
|
|
1056
|
+
if (owner) {
|
|
1057
|
+
if (owner.__hmrId) {
|
|
1058
|
+
if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
|
|
1059
|
+
let entry = this._childStyles.get(owner.__hmrId);
|
|
1060
|
+
if (!entry) {
|
|
1061
|
+
this._childStyles.set(owner.__hmrId, entry = []);
|
|
1062
|
+
}
|
|
1063
|
+
entry.push(s);
|
|
1064
|
+
}
|
|
1065
|
+
} else {
|
|
945
1066
|
(this._styles || (this._styles = [])).push(s);
|
|
946
1067
|
}
|
|
947
|
-
}
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Only called when shaddowRoot is false
|
|
1073
|
+
*/
|
|
1074
|
+
_parseSlots() {
|
|
1075
|
+
const slots = this._slots = {};
|
|
1076
|
+
let n;
|
|
1077
|
+
while (n = this.firstChild) {
|
|
1078
|
+
const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
|
|
1079
|
+
(slots[slotName] || (slots[slotName] = [])).push(n);
|
|
1080
|
+
this.removeChild(n);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* Only called when shaddowRoot is false
|
|
1085
|
+
*/
|
|
1086
|
+
_renderSlots() {
|
|
1087
|
+
const outlets = this.querySelectorAll("slot");
|
|
1088
|
+
const scopeId = this._instance.type.__scopeId;
|
|
1089
|
+
for (let i = 0; i < outlets.length; i++) {
|
|
1090
|
+
const o = outlets[i];
|
|
1091
|
+
const slotName = o.getAttribute("name") || "default";
|
|
1092
|
+
const content = this._slots[slotName];
|
|
1093
|
+
const parent = o.parentNode;
|
|
1094
|
+
if (content) {
|
|
1095
|
+
for (const n of content) {
|
|
1096
|
+
if (scopeId && n.nodeType === 1) {
|
|
1097
|
+
const id = scopeId + "-s";
|
|
1098
|
+
const walker = document.createTreeWalker(n, 1);
|
|
1099
|
+
n.setAttribute(id, "");
|
|
1100
|
+
let child;
|
|
1101
|
+
while (child = walker.nextNode()) {
|
|
1102
|
+
child.setAttribute(id, "");
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
parent.insertBefore(n, o);
|
|
1106
|
+
}
|
|
1107
|
+
} else {
|
|
1108
|
+
while (o.firstChild) parent.insertBefore(o.firstChild, o);
|
|
1109
|
+
}
|
|
1110
|
+
parent.removeChild(o);
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* @internal
|
|
1115
|
+
*/
|
|
1116
|
+
_injectChildStyle(comp) {
|
|
1117
|
+
this._applyStyles(comp.styles, comp);
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* @internal
|
|
1121
|
+
*/
|
|
1122
|
+
_removeChildStyle(comp) {
|
|
1123
|
+
{
|
|
1124
|
+
this._styleChildren.delete(comp);
|
|
1125
|
+
if (this._childStyles && comp.__hmrId) {
|
|
1126
|
+
const oldStyles = this._childStyles.get(comp.__hmrId);
|
|
1127
|
+
if (oldStyles) {
|
|
1128
|
+
oldStyles.forEach((s) => this._root.removeChild(s));
|
|
1129
|
+
oldStyles.length = 0;
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
function useHost(caller) {
|
|
1136
|
+
const instance = runtimeCore.getCurrentInstance();
|
|
1137
|
+
const el = instance && instance.ce;
|
|
1138
|
+
if (el) {
|
|
1139
|
+
return el;
|
|
1140
|
+
} else {
|
|
1141
|
+
if (!instance) {
|
|
1142
|
+
runtimeCore.warn(
|
|
1143
|
+
`${caller || "useHost"} called without an active component instance.`
|
|
1144
|
+
);
|
|
1145
|
+
} else {
|
|
1146
|
+
runtimeCore.warn(
|
|
1147
|
+
`${caller || "useHost"} can only be used in components defined via defineCustomElement.`
|
|
1148
|
+
);
|
|
948
1149
|
}
|
|
949
1150
|
}
|
|
1151
|
+
return null;
|
|
1152
|
+
}
|
|
1153
|
+
function useShadowRoot() {
|
|
1154
|
+
const el = useHost("useShadowRoot") ;
|
|
1155
|
+
return el && el.shadowRoot;
|
|
950
1156
|
}
|
|
951
1157
|
|
|
952
1158
|
function useCssModule(name = "$style") {
|
|
@@ -1461,7 +1667,9 @@ const createApp = (...args) => {
|
|
|
1461
1667
|
if (!shared.isFunction(component) && !component.render && !component.template) {
|
|
1462
1668
|
component.template = container.innerHTML;
|
|
1463
1669
|
}
|
|
1464
|
-
container.
|
|
1670
|
+
if (container.nodeType === 1) {
|
|
1671
|
+
container.textContent = "";
|
|
1672
|
+
}
|
|
1465
1673
|
const proxy = mount(container, false, resolveRootNamespace(container));
|
|
1466
1674
|
if (container instanceof Element) {
|
|
1467
1675
|
container.removeAttribute("v-cloak");
|
|
@@ -1567,6 +1775,8 @@ exports.initDirectivesForSSR = initDirectivesForSSR;
|
|
|
1567
1775
|
exports.render = render;
|
|
1568
1776
|
exports.useCssModule = useCssModule;
|
|
1569
1777
|
exports.useCssVars = useCssVars;
|
|
1778
|
+
exports.useHost = useHost;
|
|
1779
|
+
exports.useShadowRoot = useShadowRoot;
|
|
1570
1780
|
exports.vModelCheckbox = vModelCheckbox;
|
|
1571
1781
|
exports.vModelDynamic = vModelDynamic;
|
|
1572
1782
|
exports.vModelRadio = vModelRadio;
|