@vue/runtime-dom 3.5.0-alpha.5 → 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 +450 -158
- 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 +442 -154
- package/dist/runtime-dom.global.prod.js +2 -2
- package/package.json +7 -4
|
@@ -1,12 +1,24 @@
|
|
|
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
|
**/
|
|
6
|
-
import { h, BaseTransition, BaseTransitionPropsValidators, assertNumber, getCurrentInstance,
|
|
6
|
+
import { warn, h, BaseTransition, BaseTransitionPropsValidators, assertNumber, getCurrentInstance, onBeforeMount, watchPostEffect, onMounted, onUnmounted, Fragment, Static, camelize, callWithAsyncErrorHandling, defineComponent, nextTick, unref, createVNode, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, isRuntimeOnly, createRenderer, createHydrationRenderer } from '@vue/runtime-core';
|
|
7
7
|
export * from '@vue/runtime-core';
|
|
8
|
-
import { extend, isObject, toNumber, isArray, isString, hyphenate, capitalize, includeBooleanAttr, isSymbol, isSpecialBooleanAttr, isFunction, NOOP, isOn, isModelListener, camelize as camelize$1, EMPTY_OBJ, looseToNumber, looseIndexOf, isSet, looseEqual, invokeArrayFns, isHTMLTag, isSVGTag, isMathMLTag } from '@vue/shared';
|
|
8
|
+
import { extend, isObject, toNumber, isArray, isString, hyphenate, capitalize, includeBooleanAttr, isSymbol, isSpecialBooleanAttr, isFunction, NOOP, isOn, isModelListener, isPlainObject, hasOwn, camelize as camelize$1, EMPTY_OBJ, looseToNumber, looseIndexOf, isSet, looseEqual, invokeArrayFns, isHTMLTag, isSVGTag, isMathMLTag } from '@vue/shared';
|
|
9
9
|
|
|
10
|
+
let policy = void 0;
|
|
11
|
+
const tt = typeof window !== "undefined" && window.trustedTypes;
|
|
12
|
+
if (tt) {
|
|
13
|
+
try {
|
|
14
|
+
policy = /* @__PURE__ */ tt.createPolicy("vue", {
|
|
15
|
+
createHTML: (val) => val
|
|
16
|
+
});
|
|
17
|
+
} catch (e) {
|
|
18
|
+
!!(process.env.NODE_ENV !== "production") && warn(`Error creating trusted types policy: ${e}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
|
|
10
22
|
const svgNS = "http://www.w3.org/2000/svg";
|
|
11
23
|
const mathmlNS = "http://www.w3.org/1998/Math/MathML";
|
|
12
24
|
const doc = typeof document !== "undefined" ? document : null;
|
|
@@ -54,7 +66,9 @@ const nodeOps = {
|
|
|
54
66
|
if (start === end || !(start = start.nextSibling)) break;
|
|
55
67
|
}
|
|
56
68
|
} else {
|
|
57
|
-
templateContainer.innerHTML =
|
|
69
|
+
templateContainer.innerHTML = unsafeToTrustedHTML(
|
|
70
|
+
namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
|
|
71
|
+
);
|
|
58
72
|
const template = templateContainer.content;
|
|
59
73
|
if (namespace === "svg" || namespace === "mathml") {
|
|
60
74
|
const wrapper = template.firstChild;
|
|
@@ -424,11 +438,17 @@ function useCssVars(getter) {
|
|
|
424
438
|
}
|
|
425
439
|
const setVars = () => {
|
|
426
440
|
const vars = getter(instance.proxy);
|
|
427
|
-
|
|
441
|
+
if (instance.ce) {
|
|
442
|
+
setVarsOnNode(instance.ce, vars);
|
|
443
|
+
} else {
|
|
444
|
+
setVarsOnVNode(instance.subTree, vars);
|
|
445
|
+
}
|
|
428
446
|
updateTeleports(vars);
|
|
429
447
|
};
|
|
430
|
-
|
|
448
|
+
onBeforeMount(() => {
|
|
431
449
|
watchPostEffect(setVars);
|
|
450
|
+
});
|
|
451
|
+
onMounted(() => {
|
|
432
452
|
const ob = new MutationObserver(setVars);
|
|
433
453
|
ob.observe(instance.subTree.el.parentNode, { childList: true });
|
|
434
454
|
onUnmounted(() => ob.disconnect());
|
|
@@ -781,16 +801,24 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
781
801
|
if (isNativeOn(key) && isString(value)) {
|
|
782
802
|
return false;
|
|
783
803
|
}
|
|
784
|
-
|
|
804
|
+
if (key in el) {
|
|
805
|
+
return true;
|
|
806
|
+
}
|
|
807
|
+
if (el._isVueCE && (/[A-Z]/.test(key) || !isString(value))) {
|
|
808
|
+
return true;
|
|
809
|
+
}
|
|
810
|
+
return false;
|
|
785
811
|
}
|
|
786
812
|
|
|
813
|
+
const REMOVAL = {};
|
|
787
814
|
/*! #__NO_SIDE_EFFECTS__ */
|
|
788
815
|
// @__NO_SIDE_EFFECTS__
|
|
789
|
-
function defineCustomElement(options, extraOptions,
|
|
816
|
+
function defineCustomElement(options, extraOptions, _createApp) {
|
|
790
817
|
const Comp = defineComponent(options, extraOptions);
|
|
818
|
+
if (isPlainObject(Comp)) extend(Comp, extraOptions);
|
|
791
819
|
class VueCustomElement extends VueElement {
|
|
792
820
|
constructor(initialProps) {
|
|
793
|
-
super(Comp, initialProps,
|
|
821
|
+
super(Comp, initialProps, _createApp);
|
|
794
822
|
}
|
|
795
823
|
}
|
|
796
824
|
VueCustomElement.def = Comp;
|
|
@@ -798,47 +826,88 @@ function defineCustomElement(options, extraOptions, hydrate2) {
|
|
|
798
826
|
}
|
|
799
827
|
/*! #__NO_SIDE_EFFECTS__ */
|
|
800
828
|
const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
|
|
801
|
-
return /* @__PURE__ */ defineCustomElement(options, extraOptions,
|
|
829
|
+
return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
|
|
802
830
|
};
|
|
803
831
|
const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
|
|
804
832
|
};
|
|
805
833
|
class VueElement extends BaseClass {
|
|
806
|
-
constructor(_def, _props = {},
|
|
834
|
+
constructor(_def, _props = {}, _createApp = createApp) {
|
|
807
835
|
super();
|
|
808
836
|
this._def = _def;
|
|
809
837
|
this._props = _props;
|
|
838
|
+
this._createApp = _createApp;
|
|
839
|
+
this._isVueCE = true;
|
|
810
840
|
/**
|
|
811
841
|
* @internal
|
|
812
842
|
*/
|
|
813
843
|
this._instance = null;
|
|
844
|
+
/**
|
|
845
|
+
* @internal
|
|
846
|
+
*/
|
|
847
|
+
this._app = null;
|
|
848
|
+
/**
|
|
849
|
+
* @internal
|
|
850
|
+
*/
|
|
851
|
+
this._nonce = this._def.nonce;
|
|
814
852
|
this._connected = false;
|
|
815
853
|
this._resolved = false;
|
|
816
854
|
this._numberProps = null;
|
|
855
|
+
this._styleChildren = /* @__PURE__ */ new WeakSet();
|
|
817
856
|
this._ob = null;
|
|
818
|
-
if (this.shadowRoot &&
|
|
819
|
-
|
|
857
|
+
if (this.shadowRoot && _createApp !== createApp) {
|
|
858
|
+
this._root = this.shadowRoot;
|
|
859
|
+
this._mount(_def);
|
|
820
860
|
} else {
|
|
821
861
|
if (!!(process.env.NODE_ENV !== "production") && this.shadowRoot) {
|
|
822
862
|
warn(
|
|
823
863
|
`Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
|
|
824
864
|
);
|
|
825
865
|
}
|
|
826
|
-
|
|
866
|
+
if (_def.shadowRoot !== false) {
|
|
867
|
+
this.attachShadow({ mode: "open" });
|
|
868
|
+
this._root = this.shadowRoot;
|
|
869
|
+
} else {
|
|
870
|
+
this._root = this;
|
|
871
|
+
}
|
|
827
872
|
if (!this._def.__asyncLoader) {
|
|
828
873
|
this._resolveProps(this._def);
|
|
829
874
|
}
|
|
830
875
|
}
|
|
831
876
|
}
|
|
832
877
|
connectedCallback() {
|
|
878
|
+
if (!this.shadowRoot) {
|
|
879
|
+
this._parseSlots();
|
|
880
|
+
}
|
|
833
881
|
this._connected = true;
|
|
882
|
+
let parent = this;
|
|
883
|
+
while (parent = parent && (parent.parentNode || parent.host)) {
|
|
884
|
+
if (parent instanceof VueElement) {
|
|
885
|
+
this._parent = parent;
|
|
886
|
+
break;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
834
889
|
if (!this._instance) {
|
|
835
890
|
if (this._resolved) {
|
|
891
|
+
this._setParent();
|
|
836
892
|
this._update();
|
|
837
893
|
} else {
|
|
838
|
-
|
|
894
|
+
if (parent && parent._pendingResolve) {
|
|
895
|
+
this._pendingResolve = parent._pendingResolve.then(() => {
|
|
896
|
+
this._pendingResolve = void 0;
|
|
897
|
+
this._resolveDef();
|
|
898
|
+
});
|
|
899
|
+
} else {
|
|
900
|
+
this._resolveDef();
|
|
901
|
+
}
|
|
839
902
|
}
|
|
840
903
|
}
|
|
841
904
|
}
|
|
905
|
+
_setParent(parent = this._parent) {
|
|
906
|
+
if (parent) {
|
|
907
|
+
this._instance.parent = parent._instance;
|
|
908
|
+
this._instance.provides = parent._instance.provides;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
842
911
|
disconnectedCallback() {
|
|
843
912
|
this._connected = false;
|
|
844
913
|
nextTick(() => {
|
|
@@ -847,8 +916,9 @@ class VueElement extends BaseClass {
|
|
|
847
916
|
this._ob.disconnect();
|
|
848
917
|
this._ob = null;
|
|
849
918
|
}
|
|
850
|
-
|
|
851
|
-
this._instance =
|
|
919
|
+
this._app && this._app.unmount();
|
|
920
|
+
this._instance.ce = void 0;
|
|
921
|
+
this._app = this._instance = null;
|
|
852
922
|
}
|
|
853
923
|
});
|
|
854
924
|
}
|
|
@@ -856,7 +926,9 @@ class VueElement extends BaseClass {
|
|
|
856
926
|
* resolve inner component definition (handle possible async component)
|
|
857
927
|
*/
|
|
858
928
|
_resolveDef() {
|
|
859
|
-
this.
|
|
929
|
+
if (this._pendingResolve) {
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
860
932
|
for (let i = 0; i < this.attributes.length; i++) {
|
|
861
933
|
this._setAttr(this.attributes[i].name);
|
|
862
934
|
}
|
|
@@ -867,6 +939,8 @@ class VueElement extends BaseClass {
|
|
|
867
939
|
});
|
|
868
940
|
this._ob.observe(this, { attributes: true });
|
|
869
941
|
const resolve = (def, isAsync = false) => {
|
|
942
|
+
this._resolved = true;
|
|
943
|
+
this._pendingResolve = void 0;
|
|
870
944
|
const { props, styles } = def;
|
|
871
945
|
let numberProps;
|
|
872
946
|
if (props && !isArray(props)) {
|
|
@@ -884,22 +958,53 @@ class VueElement extends BaseClass {
|
|
|
884
958
|
if (isAsync) {
|
|
885
959
|
this._resolveProps(def);
|
|
886
960
|
}
|
|
887
|
-
this.
|
|
888
|
-
|
|
961
|
+
if (this.shadowRoot) {
|
|
962
|
+
this._applyStyles(styles);
|
|
963
|
+
} else if (!!(process.env.NODE_ENV !== "production") && styles) {
|
|
964
|
+
warn(
|
|
965
|
+
"Custom element style injection is not supported when using shadowRoot: false"
|
|
966
|
+
);
|
|
967
|
+
}
|
|
968
|
+
this._mount(def);
|
|
889
969
|
};
|
|
890
970
|
const asyncDef = this._def.__asyncLoader;
|
|
891
971
|
if (asyncDef) {
|
|
892
|
-
asyncDef().then(
|
|
972
|
+
this._pendingResolve = asyncDef().then(
|
|
973
|
+
(def) => resolve(this._def = def, true)
|
|
974
|
+
);
|
|
893
975
|
} else {
|
|
894
976
|
resolve(this._def);
|
|
895
977
|
}
|
|
896
978
|
}
|
|
979
|
+
_mount(def) {
|
|
980
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) && !def.name) {
|
|
981
|
+
def.name = "VueElement";
|
|
982
|
+
}
|
|
983
|
+
this._app = this._createApp(def);
|
|
984
|
+
if (def.configureApp) {
|
|
985
|
+
def.configureApp(this._app);
|
|
986
|
+
}
|
|
987
|
+
this._app._ceVNode = this._createVNode();
|
|
988
|
+
this._app.mount(this._root);
|
|
989
|
+
const exposed = this._instance && this._instance.exposed;
|
|
990
|
+
if (!exposed) return;
|
|
991
|
+
for (const key in exposed) {
|
|
992
|
+
if (!hasOwn(this, key)) {
|
|
993
|
+
Object.defineProperty(this, key, {
|
|
994
|
+
// unwrap ref to be consistent with public instance behavior
|
|
995
|
+
get: () => unref(exposed[key])
|
|
996
|
+
});
|
|
997
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
998
|
+
warn(`Exposed property "${key}" already exists on custom element.`);
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
897
1002
|
_resolveProps(def) {
|
|
898
1003
|
const { props } = def;
|
|
899
1004
|
const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
|
|
900
1005
|
for (const key of Object.keys(this)) {
|
|
901
1006
|
if (key[0] !== "_" && declaredPropKeys.includes(key)) {
|
|
902
|
-
this._setProp(key, this[key]
|
|
1007
|
+
this._setProp(key, this[key]);
|
|
903
1008
|
}
|
|
904
1009
|
}
|
|
905
1010
|
for (const key of declaredPropKeys.map(camelize$1)) {
|
|
@@ -908,18 +1013,20 @@ class VueElement extends BaseClass {
|
|
|
908
1013
|
return this._getProp(key);
|
|
909
1014
|
},
|
|
910
1015
|
set(val) {
|
|
911
|
-
this._setProp(key, val);
|
|
1016
|
+
this._setProp(key, val, true, true);
|
|
912
1017
|
}
|
|
913
1018
|
});
|
|
914
1019
|
}
|
|
915
1020
|
}
|
|
916
1021
|
_setAttr(key) {
|
|
917
|
-
|
|
1022
|
+
if (key.startsWith("data-v-")) return;
|
|
1023
|
+
const has = this.hasAttribute(key);
|
|
1024
|
+
let value = has ? this.getAttribute(key) : REMOVAL;
|
|
918
1025
|
const camelKey = camelize$1(key);
|
|
919
|
-
if (this._numberProps && this._numberProps[camelKey]) {
|
|
1026
|
+
if (has && this._numberProps && this._numberProps[camelKey]) {
|
|
920
1027
|
value = toNumber(value);
|
|
921
1028
|
}
|
|
922
|
-
this._setProp(camelKey, value, false);
|
|
1029
|
+
this._setProp(camelKey, value, false, true);
|
|
923
1030
|
}
|
|
924
1031
|
/**
|
|
925
1032
|
* @internal
|
|
@@ -930,9 +1037,13 @@ class VueElement extends BaseClass {
|
|
|
930
1037
|
/**
|
|
931
1038
|
* @internal
|
|
932
1039
|
*/
|
|
933
|
-
_setProp(key, val, shouldReflect = true, shouldUpdate =
|
|
1040
|
+
_setProp(key, val, shouldReflect = true, shouldUpdate = false) {
|
|
934
1041
|
if (val !== this._props[key]) {
|
|
935
|
-
|
|
1042
|
+
if (val === REMOVAL) {
|
|
1043
|
+
delete this._props[key];
|
|
1044
|
+
} else {
|
|
1045
|
+
this._props[key] = val;
|
|
1046
|
+
}
|
|
936
1047
|
if (shouldUpdate && this._instance) {
|
|
937
1048
|
this._update();
|
|
938
1049
|
}
|
|
@@ -948,18 +1059,22 @@ class VueElement extends BaseClass {
|
|
|
948
1059
|
}
|
|
949
1060
|
}
|
|
950
1061
|
_update() {
|
|
951
|
-
render(this._createVNode(), this.
|
|
1062
|
+
render(this._createVNode(), this._root);
|
|
952
1063
|
}
|
|
953
1064
|
_createVNode() {
|
|
954
|
-
const
|
|
1065
|
+
const baseProps = {};
|
|
1066
|
+
if (!this.shadowRoot) {
|
|
1067
|
+
baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
|
|
1068
|
+
}
|
|
1069
|
+
const vnode = createVNode(this._def, extend(baseProps, this._props));
|
|
955
1070
|
if (!this._instance) {
|
|
956
1071
|
vnode.ce = (instance) => {
|
|
957
1072
|
this._instance = instance;
|
|
958
|
-
instance.
|
|
1073
|
+
instance.ce = this;
|
|
959
1074
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
960
1075
|
instance.ceReload = (newStyles) => {
|
|
961
1076
|
if (this._styles) {
|
|
962
|
-
this._styles.forEach((s) => this.
|
|
1077
|
+
this._styles.forEach((s) => this._root.removeChild(s));
|
|
963
1078
|
this._styles.length = 0;
|
|
964
1079
|
}
|
|
965
1080
|
this._applyStyles(newStyles);
|
|
@@ -969,9 +1084,10 @@ class VueElement extends BaseClass {
|
|
|
969
1084
|
}
|
|
970
1085
|
const dispatch = (event, args) => {
|
|
971
1086
|
this.dispatchEvent(
|
|
972
|
-
new CustomEvent(
|
|
973
|
-
|
|
974
|
-
|
|
1087
|
+
new CustomEvent(
|
|
1088
|
+
event,
|
|
1089
|
+
isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
|
|
1090
|
+
)
|
|
975
1091
|
);
|
|
976
1092
|
};
|
|
977
1093
|
instance.emit = (event, ...args) => {
|
|
@@ -980,31 +1096,127 @@ class VueElement extends BaseClass {
|
|
|
980
1096
|
dispatch(hyphenate(event), args);
|
|
981
1097
|
}
|
|
982
1098
|
};
|
|
983
|
-
|
|
984
|
-
while (parent = parent && (parent.parentNode || parent.host)) {
|
|
985
|
-
if (parent instanceof VueElement) {
|
|
986
|
-
instance.parent = parent._instance;
|
|
987
|
-
instance.provides = parent._instance.provides;
|
|
988
|
-
break;
|
|
989
|
-
}
|
|
990
|
-
}
|
|
1099
|
+
this._setParent();
|
|
991
1100
|
};
|
|
992
1101
|
}
|
|
993
1102
|
return vnode;
|
|
994
1103
|
}
|
|
995
|
-
_applyStyles(styles) {
|
|
996
|
-
if (styles)
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1104
|
+
_applyStyles(styles, owner) {
|
|
1105
|
+
if (!styles) return;
|
|
1106
|
+
if (owner) {
|
|
1107
|
+
if (owner === this._def || this._styleChildren.has(owner)) {
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
this._styleChildren.add(owner);
|
|
1111
|
+
}
|
|
1112
|
+
const nonce = this._nonce;
|
|
1113
|
+
for (let i = styles.length - 1; i >= 0; i--) {
|
|
1114
|
+
const s = document.createElement("style");
|
|
1115
|
+
if (nonce) s.setAttribute("nonce", nonce);
|
|
1116
|
+
s.textContent = styles[i];
|
|
1117
|
+
this.shadowRoot.prepend(s);
|
|
1118
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1119
|
+
if (owner) {
|
|
1120
|
+
if (owner.__hmrId) {
|
|
1121
|
+
if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
|
|
1122
|
+
let entry = this._childStyles.get(owner.__hmrId);
|
|
1123
|
+
if (!entry) {
|
|
1124
|
+
this._childStyles.set(owner.__hmrId, entry = []);
|
|
1125
|
+
}
|
|
1126
|
+
entry.push(s);
|
|
1127
|
+
}
|
|
1128
|
+
} else {
|
|
1002
1129
|
(this._styles || (this._styles = [])).push(s);
|
|
1003
1130
|
}
|
|
1004
|
-
}
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* Only called when shaddowRoot is false
|
|
1136
|
+
*/
|
|
1137
|
+
_parseSlots() {
|
|
1138
|
+
const slots = this._slots = {};
|
|
1139
|
+
let n;
|
|
1140
|
+
while (n = this.firstChild) {
|
|
1141
|
+
const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
|
|
1142
|
+
(slots[slotName] || (slots[slotName] = [])).push(n);
|
|
1143
|
+
this.removeChild(n);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
/**
|
|
1147
|
+
* Only called when shaddowRoot is false
|
|
1148
|
+
*/
|
|
1149
|
+
_renderSlots() {
|
|
1150
|
+
const outlets = this.querySelectorAll("slot");
|
|
1151
|
+
const scopeId = this._instance.type.__scopeId;
|
|
1152
|
+
for (let i = 0; i < outlets.length; i++) {
|
|
1153
|
+
const o = outlets[i];
|
|
1154
|
+
const slotName = o.getAttribute("name") || "default";
|
|
1155
|
+
const content = this._slots[slotName];
|
|
1156
|
+
const parent = o.parentNode;
|
|
1157
|
+
if (content) {
|
|
1158
|
+
for (const n of content) {
|
|
1159
|
+
if (scopeId && n.nodeType === 1) {
|
|
1160
|
+
const id = scopeId + "-s";
|
|
1161
|
+
const walker = document.createTreeWalker(n, 1);
|
|
1162
|
+
n.setAttribute(id, "");
|
|
1163
|
+
let child;
|
|
1164
|
+
while (child = walker.nextNode()) {
|
|
1165
|
+
child.setAttribute(id, "");
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
parent.insertBefore(n, o);
|
|
1169
|
+
}
|
|
1170
|
+
} else {
|
|
1171
|
+
while (o.firstChild) parent.insertBefore(o.firstChild, o);
|
|
1172
|
+
}
|
|
1173
|
+
parent.removeChild(o);
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* @internal
|
|
1178
|
+
*/
|
|
1179
|
+
_injectChildStyle(comp) {
|
|
1180
|
+
this._applyStyles(comp.styles, comp);
|
|
1181
|
+
}
|
|
1182
|
+
/**
|
|
1183
|
+
* @internal
|
|
1184
|
+
*/
|
|
1185
|
+
_removeChildStyle(comp) {
|
|
1186
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1187
|
+
this._styleChildren.delete(comp);
|
|
1188
|
+
if (this._childStyles && comp.__hmrId) {
|
|
1189
|
+
const oldStyles = this._childStyles.get(comp.__hmrId);
|
|
1190
|
+
if (oldStyles) {
|
|
1191
|
+
oldStyles.forEach((s) => this._root.removeChild(s));
|
|
1192
|
+
oldStyles.length = 0;
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1005
1195
|
}
|
|
1006
1196
|
}
|
|
1007
1197
|
}
|
|
1198
|
+
function useHost(caller) {
|
|
1199
|
+
const instance = getCurrentInstance();
|
|
1200
|
+
const el = instance && instance.ce;
|
|
1201
|
+
if (el) {
|
|
1202
|
+
return el;
|
|
1203
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
1204
|
+
if (!instance) {
|
|
1205
|
+
warn(
|
|
1206
|
+
`${caller || "useHost"} called without an active component instance.`
|
|
1207
|
+
);
|
|
1208
|
+
} else {
|
|
1209
|
+
warn(
|
|
1210
|
+
`${caller || "useHost"} can only be used in components defined via defineCustomElement.`
|
|
1211
|
+
);
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
return null;
|
|
1215
|
+
}
|
|
1216
|
+
function useShadowRoot() {
|
|
1217
|
+
const el = !!(process.env.NODE_ENV !== "production") ? useHost("useShadowRoot") : useHost();
|
|
1218
|
+
return el && el.shadowRoot;
|
|
1219
|
+
}
|
|
1008
1220
|
|
|
1009
1221
|
function useCssModule(name = "$style") {
|
|
1010
1222
|
{
|
|
@@ -1518,7 +1730,9 @@ const createApp = (...args) => {
|
|
|
1518
1730
|
if (!isFunction(component) && !component.render && !component.template) {
|
|
1519
1731
|
component.template = container.innerHTML;
|
|
1520
1732
|
}
|
|
1521
|
-
container.
|
|
1733
|
+
if (container.nodeType === 1) {
|
|
1734
|
+
container.textContent = "";
|
|
1735
|
+
}
|
|
1522
1736
|
const proxy = mount(container, false, resolveRootNamespace(container));
|
|
1523
1737
|
if (container instanceof Element) {
|
|
1524
1738
|
container.removeAttribute("v-cloak");
|
|
@@ -1612,4 +1826,4 @@ const initDirectivesForSSR = () => {
|
|
|
1612
1826
|
}
|
|
1613
1827
|
} ;
|
|
1614
1828
|
|
|
1615
|
-
export { Transition, TransitionGroup, VueElement, createApp, createSSRApp, defineCustomElement, defineSSRCustomElement, hydrate, initDirectivesForSSR, render, useCssModule, useCssVars, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, withKeys, withModifiers };
|
|
1829
|
+
export { Transition, TransitionGroup, VueElement, createApp, createSSRApp, defineCustomElement, defineSSRCustomElement, hydrate, initDirectivesForSSR, render, useCssModule, useCssVars, useHost, useShadowRoot, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, withKeys, withModifiers };
|