@vue/runtime-dom 3.5.28 → 3.5.30
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 +54 -7
- package/dist/runtime-dom.cjs.prod.js +52 -7
- package/dist/runtime-dom.d.ts +111 -103
- package/dist/runtime-dom.esm-browser.js +111 -25
- package/dist/runtime-dom.esm-browser.prod.js +3 -3
- package/dist/runtime-dom.esm-bundler.js +54 -7
- package/dist/runtime-dom.global.js +111 -25
- package/dist/runtime-dom.global.prod.js +3 -3
- package/package.json +4 -4
package/dist/runtime-dom.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.5.
|
|
2
|
+
* @vue/runtime-dom v3.5.30
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -717,7 +717,9 @@ const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) =>
|
|
|
717
717
|
}
|
|
718
718
|
} else if (
|
|
719
719
|
// #11081 force set props for possible async custom element
|
|
720
|
-
el._isVueCE &&
|
|
720
|
+
el._isVueCE && // #12408 check if it's declared prop or it's async custom element
|
|
721
|
+
(shouldSetAsPropForVueCE(el, key) || // @ts-expect-error _def is private
|
|
722
|
+
el._def.__asyncLoader && (/[A-Z]/.test(key) || !shared.isString(nextValue)))
|
|
721
723
|
) {
|
|
722
724
|
patchDOMProp(el, shared.camelize(key), nextValue, parentComponent, key);
|
|
723
725
|
} else {
|
|
@@ -765,6 +767,17 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
765
767
|
}
|
|
766
768
|
return key in el;
|
|
767
769
|
}
|
|
770
|
+
function shouldSetAsPropForVueCE(el, key) {
|
|
771
|
+
const props = (
|
|
772
|
+
// @ts-expect-error _def is private
|
|
773
|
+
el._def.props
|
|
774
|
+
);
|
|
775
|
+
if (!props) {
|
|
776
|
+
return false;
|
|
777
|
+
}
|
|
778
|
+
const camelKey = shared.camelize(key);
|
|
779
|
+
return Array.isArray(props) ? props.some((prop) => shared.camelize(prop) === camelKey) : Object.keys(props).some((prop) => shared.camelize(prop) === camelKey);
|
|
780
|
+
}
|
|
768
781
|
|
|
769
782
|
const REMOVAL = {};
|
|
770
783
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -809,6 +822,7 @@ class VueElement extends BaseClass {
|
|
|
809
822
|
this._dirty = false;
|
|
810
823
|
this._numberProps = null;
|
|
811
824
|
this._styleChildren = /* @__PURE__ */ new WeakSet();
|
|
825
|
+
this._styleAnchors = /* @__PURE__ */ new WeakMap();
|
|
812
826
|
this._ob = null;
|
|
813
827
|
if (this.shadowRoot && _createApp !== createApp) {
|
|
814
828
|
this._root = this.shadowRoot;
|
|
@@ -837,7 +851,8 @@ class VueElement extends BaseClass {
|
|
|
837
851
|
}
|
|
838
852
|
this._connected = true;
|
|
839
853
|
let parent = this;
|
|
840
|
-
while (parent = parent &&
|
|
854
|
+
while (parent = parent && // #12479 should check assignedSlot first to get correct parent
|
|
855
|
+
(parent.assignedSlot || parent.parentNode || parent.host)) {
|
|
841
856
|
if (parent instanceof VueElement) {
|
|
842
857
|
this._parent = parent;
|
|
843
858
|
break;
|
|
@@ -1059,6 +1074,7 @@ class VueElement extends BaseClass {
|
|
|
1059
1074
|
this._styles.forEach((s) => this._root.removeChild(s));
|
|
1060
1075
|
this._styles.length = 0;
|
|
1061
1076
|
}
|
|
1077
|
+
this._styleAnchors.delete(this._def);
|
|
1062
1078
|
this._applyStyles(newStyles);
|
|
1063
1079
|
this._instance = null;
|
|
1064
1080
|
this._update();
|
|
@@ -1083,7 +1099,7 @@ class VueElement extends BaseClass {
|
|
|
1083
1099
|
}
|
|
1084
1100
|
return vnode;
|
|
1085
1101
|
}
|
|
1086
|
-
_applyStyles(styles, owner) {
|
|
1102
|
+
_applyStyles(styles, owner, parentComp) {
|
|
1087
1103
|
if (!styles) return;
|
|
1088
1104
|
if (owner) {
|
|
1089
1105
|
if (owner === this._def || this._styleChildren.has(owner)) {
|
|
@@ -1092,11 +1108,19 @@ class VueElement extends BaseClass {
|
|
|
1092
1108
|
this._styleChildren.add(owner);
|
|
1093
1109
|
}
|
|
1094
1110
|
const nonce = this._nonce;
|
|
1111
|
+
const root = this.shadowRoot;
|
|
1112
|
+
const insertionAnchor = parentComp ? this._getStyleAnchor(parentComp) || this._getStyleAnchor(this._def) : this._getRootStyleInsertionAnchor(root);
|
|
1113
|
+
let last = null;
|
|
1095
1114
|
for (let i = styles.length - 1; i >= 0; i--) {
|
|
1096
1115
|
const s = document.createElement("style");
|
|
1097
1116
|
if (nonce) s.setAttribute("nonce", nonce);
|
|
1098
1117
|
s.textContent = styles[i];
|
|
1099
|
-
|
|
1118
|
+
root.insertBefore(s, last || insertionAnchor);
|
|
1119
|
+
last = s;
|
|
1120
|
+
if (i === 0) {
|
|
1121
|
+
if (!parentComp) this._styleAnchors.set(this._def, s);
|
|
1122
|
+
if (owner) this._styleAnchors.set(owner, s);
|
|
1123
|
+
}
|
|
1100
1124
|
{
|
|
1101
1125
|
if (owner) {
|
|
1102
1126
|
if (owner.__hmrId) {
|
|
@@ -1113,6 +1137,28 @@ class VueElement extends BaseClass {
|
|
|
1113
1137
|
}
|
|
1114
1138
|
}
|
|
1115
1139
|
}
|
|
1140
|
+
_getStyleAnchor(comp) {
|
|
1141
|
+
if (!comp) {
|
|
1142
|
+
return null;
|
|
1143
|
+
}
|
|
1144
|
+
const anchor = this._styleAnchors.get(comp);
|
|
1145
|
+
if (anchor && anchor.parentNode === this.shadowRoot) {
|
|
1146
|
+
return anchor;
|
|
1147
|
+
}
|
|
1148
|
+
if (anchor) {
|
|
1149
|
+
this._styleAnchors.delete(comp);
|
|
1150
|
+
}
|
|
1151
|
+
return null;
|
|
1152
|
+
}
|
|
1153
|
+
_getRootStyleInsertionAnchor(root) {
|
|
1154
|
+
for (let i = 0; i < root.childNodes.length; i++) {
|
|
1155
|
+
const node = root.childNodes[i];
|
|
1156
|
+
if (!(node instanceof HTMLStyleElement)) {
|
|
1157
|
+
return node;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
return null;
|
|
1161
|
+
}
|
|
1116
1162
|
/**
|
|
1117
1163
|
* Only called when shadowRoot is false
|
|
1118
1164
|
*/
|
|
@@ -1175,8 +1221,8 @@ class VueElement extends BaseClass {
|
|
|
1175
1221
|
/**
|
|
1176
1222
|
* @internal
|
|
1177
1223
|
*/
|
|
1178
|
-
_injectChildStyle(comp) {
|
|
1179
|
-
this._applyStyles(comp.styles, comp);
|
|
1224
|
+
_injectChildStyle(comp, parentComp) {
|
|
1225
|
+
this._applyStyles(comp.styles, comp, parentComp);
|
|
1180
1226
|
}
|
|
1181
1227
|
/**
|
|
1182
1228
|
* @internal
|
|
@@ -1206,6 +1252,7 @@ class VueElement extends BaseClass {
|
|
|
1206
1252
|
_removeChildStyle(comp) {
|
|
1207
1253
|
{
|
|
1208
1254
|
this._styleChildren.delete(comp);
|
|
1255
|
+
this._styleAnchors.delete(comp);
|
|
1209
1256
|
if (this._childStyles && comp.__hmrId) {
|
|
1210
1257
|
const oldStyles = this._childStyles.get(comp.__hmrId);
|
|
1211
1258
|
if (oldStyles) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.5.
|
|
2
|
+
* @vue/runtime-dom v3.5.30
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -689,7 +689,9 @@ const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) =>
|
|
|
689
689
|
}
|
|
690
690
|
} else if (
|
|
691
691
|
// #11081 force set props for possible async custom element
|
|
692
|
-
el._isVueCE &&
|
|
692
|
+
el._isVueCE && // #12408 check if it's declared prop or it's async custom element
|
|
693
|
+
(shouldSetAsPropForVueCE(el, key) || // @ts-expect-error _def is private
|
|
694
|
+
el._def.__asyncLoader && (/[A-Z]/.test(key) || !shared.isString(nextValue)))
|
|
693
695
|
) {
|
|
694
696
|
patchDOMProp(el, shared.camelize(key), nextValue, parentComponent, key);
|
|
695
697
|
} else {
|
|
@@ -737,6 +739,17 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
737
739
|
}
|
|
738
740
|
return key in el;
|
|
739
741
|
}
|
|
742
|
+
function shouldSetAsPropForVueCE(el, key) {
|
|
743
|
+
const props = (
|
|
744
|
+
// @ts-expect-error _def is private
|
|
745
|
+
el._def.props
|
|
746
|
+
);
|
|
747
|
+
if (!props) {
|
|
748
|
+
return false;
|
|
749
|
+
}
|
|
750
|
+
const camelKey = shared.camelize(key);
|
|
751
|
+
return Array.isArray(props) ? props.some((prop) => shared.camelize(prop) === camelKey) : Object.keys(props).some((prop) => shared.camelize(prop) === camelKey);
|
|
752
|
+
}
|
|
740
753
|
|
|
741
754
|
const REMOVAL = {};
|
|
742
755
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -781,6 +794,7 @@ class VueElement extends BaseClass {
|
|
|
781
794
|
this._dirty = false;
|
|
782
795
|
this._numberProps = null;
|
|
783
796
|
this._styleChildren = /* @__PURE__ */ new WeakSet();
|
|
797
|
+
this._styleAnchors = /* @__PURE__ */ new WeakMap();
|
|
784
798
|
this._ob = null;
|
|
785
799
|
if (this.shadowRoot && _createApp !== createApp) {
|
|
786
800
|
this._root = this.shadowRoot;
|
|
@@ -804,7 +818,8 @@ class VueElement extends BaseClass {
|
|
|
804
818
|
}
|
|
805
819
|
this._connected = true;
|
|
806
820
|
let parent = this;
|
|
807
|
-
while (parent = parent &&
|
|
821
|
+
while (parent = parent && // #12479 should check assignedSlot first to get correct parent
|
|
822
|
+
(parent.assignedSlot || parent.parentNode || parent.host)) {
|
|
808
823
|
if (parent instanceof VueElement) {
|
|
809
824
|
this._parent = parent;
|
|
810
825
|
break;
|
|
@@ -1030,7 +1045,7 @@ class VueElement extends BaseClass {
|
|
|
1030
1045
|
}
|
|
1031
1046
|
return vnode;
|
|
1032
1047
|
}
|
|
1033
|
-
_applyStyles(styles, owner) {
|
|
1048
|
+
_applyStyles(styles, owner, parentComp) {
|
|
1034
1049
|
if (!styles) return;
|
|
1035
1050
|
if (owner) {
|
|
1036
1051
|
if (owner === this._def || this._styleChildren.has(owner)) {
|
|
@@ -1039,12 +1054,42 @@ class VueElement extends BaseClass {
|
|
|
1039
1054
|
this._styleChildren.add(owner);
|
|
1040
1055
|
}
|
|
1041
1056
|
const nonce = this._nonce;
|
|
1057
|
+
const root = this.shadowRoot;
|
|
1058
|
+
const insertionAnchor = parentComp ? this._getStyleAnchor(parentComp) || this._getStyleAnchor(this._def) : this._getRootStyleInsertionAnchor(root);
|
|
1059
|
+
let last = null;
|
|
1042
1060
|
for (let i = styles.length - 1; i >= 0; i--) {
|
|
1043
1061
|
const s = document.createElement("style");
|
|
1044
1062
|
if (nonce) s.setAttribute("nonce", nonce);
|
|
1045
1063
|
s.textContent = styles[i];
|
|
1046
|
-
|
|
1064
|
+
root.insertBefore(s, last || insertionAnchor);
|
|
1065
|
+
last = s;
|
|
1066
|
+
if (i === 0) {
|
|
1067
|
+
if (!parentComp) this._styleAnchors.set(this._def, s);
|
|
1068
|
+
if (owner) this._styleAnchors.set(owner, s);
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
_getStyleAnchor(comp) {
|
|
1073
|
+
if (!comp) {
|
|
1074
|
+
return null;
|
|
1047
1075
|
}
|
|
1076
|
+
const anchor = this._styleAnchors.get(comp);
|
|
1077
|
+
if (anchor && anchor.parentNode === this.shadowRoot) {
|
|
1078
|
+
return anchor;
|
|
1079
|
+
}
|
|
1080
|
+
if (anchor) {
|
|
1081
|
+
this._styleAnchors.delete(comp);
|
|
1082
|
+
}
|
|
1083
|
+
return null;
|
|
1084
|
+
}
|
|
1085
|
+
_getRootStyleInsertionAnchor(root) {
|
|
1086
|
+
for (let i = 0; i < root.childNodes.length; i++) {
|
|
1087
|
+
const node = root.childNodes[i];
|
|
1088
|
+
if (!(node instanceof HTMLStyleElement)) {
|
|
1089
|
+
return node;
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
return null;
|
|
1048
1093
|
}
|
|
1049
1094
|
/**
|
|
1050
1095
|
* Only called when shadowRoot is false
|
|
@@ -1108,8 +1153,8 @@ class VueElement extends BaseClass {
|
|
|
1108
1153
|
/**
|
|
1109
1154
|
* @internal
|
|
1110
1155
|
*/
|
|
1111
|
-
_injectChildStyle(comp) {
|
|
1112
|
-
this._applyStyles(comp.styles, comp);
|
|
1156
|
+
_injectChildStyle(comp, parentComp) {
|
|
1157
|
+
this._applyStyles(comp.styles, comp, parentComp);
|
|
1113
1158
|
}
|
|
1114
1159
|
/**
|
|
1115
1160
|
* @internal
|
package/dist/runtime-dom.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RendererOptions, BaseTransitionProps, FunctionalComponent, ObjectDirective, Directive, App, ComponentCustomElementInterface, ConcreteComponent, CreateAppFunction, SetupContext, RenderFunction, ComponentOptions, ComponentObjectPropsOptions, EmitsOptions, ComputedOptions, MethodOptions, ComponentOptionsMixin, ComponentInjectOptions, SlotsType, Component, ComponentProvideOptions, ExtractPropTypes, EmitsToProps, ComponentOptionsBase, CreateComponentPublicInstanceWithMixins, ComponentPublicInstance, DefineComponent,
|
|
1
|
+
import { RendererOptions, BaseTransitionProps, FunctionalComponent, ObjectDirective, Directive, VNodeRef, App, ComponentCustomElementInterface, ConcreteComponent, CreateAppFunction, SetupContext, RenderFunction, ComponentOptions, ComponentObjectPropsOptions, EmitsOptions, ComputedOptions, MethodOptions, ComponentOptionsMixin, ComponentInjectOptions, SlotsType, Component, ComponentProvideOptions, ExtractPropTypes, EmitsToProps, ComponentOptionsBase, CreateComponentPublicInstanceWithMixins, ComponentPublicInstance, DefineComponent, RootHydrateFunction, RootRenderFunction } from '@vue/runtime-core';
|
|
2
2
|
export * from '@vue/runtime-core';
|
|
3
3
|
import * as CSS from 'csstype';
|
|
4
4
|
|
|
@@ -91,106 +91,6 @@ export declare const vModelSelect: ModelDirective<HTMLSelectElement, 'number'>;
|
|
|
91
91
|
export declare const vModelDynamic: ObjectDirective<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>;
|
|
92
92
|
type VModelDirective = typeof vModelText | typeof vModelCheckbox | typeof vModelSelect | typeof vModelRadio | typeof vModelDynamic;
|
|
93
93
|
|
|
94
|
-
export type VueElementConstructor<P = {}> = {
|
|
95
|
-
new (initialProps?: Record<string, any>): VueElement & P;
|
|
96
|
-
};
|
|
97
|
-
export interface CustomElementOptions {
|
|
98
|
-
styles?: string[];
|
|
99
|
-
shadowRoot?: boolean;
|
|
100
|
-
shadowRootOptions?: Omit<ShadowRootInit, 'mode'>;
|
|
101
|
-
nonce?: string;
|
|
102
|
-
configureApp?: (app: App) => void;
|
|
103
|
-
}
|
|
104
|
-
export declare function defineCustomElement<Props, RawBindings = object>(setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs' | 'emits'> & CustomElementOptions & {
|
|
105
|
-
props?: (keyof Props)[];
|
|
106
|
-
}): VueElementConstructor<Props>;
|
|
107
|
-
export declare function defineCustomElement<Props, RawBindings = object>(setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs' | 'emits'> & CustomElementOptions & {
|
|
108
|
-
props?: ComponentObjectPropsOptions<Props>;
|
|
109
|
-
}): VueElementConstructor<Props>;
|
|
110
|
-
export declare function defineCustomElement<RuntimePropsOptions extends ComponentObjectPropsOptions = ComponentObjectPropsOptions, PropsKeys extends string = string, RuntimeEmitsOptions extends EmitsOptions = {}, EmitsKeys extends string = string, Data = {}, SetupBindings = {}, Computed extends ComputedOptions = {}, Methods extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, InjectOptions extends ComponentInjectOptions = {}, InjectKeys extends string = string, Slots extends SlotsType = {}, LocalComponents extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, InferredProps = string extends PropsKeys ? ComponentObjectPropsOptions extends RuntimePropsOptions ? {} : ExtractPropTypes<RuntimePropsOptions> : {
|
|
111
|
-
[key in PropsKeys]?: any;
|
|
112
|
-
}, ResolvedProps = InferredProps & EmitsToProps<RuntimeEmitsOptions>>(options: CustomElementOptions & {
|
|
113
|
-
props?: (RuntimePropsOptions & ThisType<void>) | PropsKeys[];
|
|
114
|
-
} & ComponentOptionsBase<ResolvedProps, SetupBindings, Data, Computed, Methods, Mixin, Extends, RuntimeEmitsOptions, EmitsKeys, {}, // Defaults
|
|
115
|
-
InjectOptions, InjectKeys, Slots, LocalComponents, Directives, Exposed, Provide> & ThisType<CreateComponentPublicInstanceWithMixins<Readonly<ResolvedProps>, SetupBindings, Data, Computed, Methods, Mixin, Extends, RuntimeEmitsOptions, EmitsKeys, {}, false, InjectOptions, Slots, LocalComponents, Directives, Exposed>>, extraOptions?: CustomElementOptions): VueElementConstructor<ResolvedProps>;
|
|
116
|
-
export declare function defineCustomElement<T extends {
|
|
117
|
-
new (...args: any[]): ComponentPublicInstance<any>;
|
|
118
|
-
}>(options: T, extraOptions?: CustomElementOptions): VueElementConstructor<T extends DefineComponent<infer P, any, any, any> ? P : unknown>;
|
|
119
|
-
export declare const defineSSRCustomElement: typeof defineCustomElement;
|
|
120
|
-
declare const BaseClass: typeof HTMLElement;
|
|
121
|
-
type InnerComponentDef = ConcreteComponent & CustomElementOptions;
|
|
122
|
-
export declare class VueElement extends BaseClass implements ComponentCustomElementInterface {
|
|
123
|
-
/**
|
|
124
|
-
* Component def - note this may be an AsyncWrapper, and this._def will
|
|
125
|
-
* be overwritten by the inner component when resolved.
|
|
126
|
-
*/
|
|
127
|
-
private _def;
|
|
128
|
-
private _props;
|
|
129
|
-
private _createApp;
|
|
130
|
-
_isVueCE: boolean;
|
|
131
|
-
private _connected;
|
|
132
|
-
private _resolved;
|
|
133
|
-
private _patching;
|
|
134
|
-
private _dirty;
|
|
135
|
-
private _numberProps;
|
|
136
|
-
private _styleChildren;
|
|
137
|
-
private _pendingResolve;
|
|
138
|
-
private _parent;
|
|
139
|
-
/**
|
|
140
|
-
* dev only
|
|
141
|
-
*/
|
|
142
|
-
private _styles?;
|
|
143
|
-
/**
|
|
144
|
-
* dev only
|
|
145
|
-
*/
|
|
146
|
-
private _childStyles?;
|
|
147
|
-
private _ob?;
|
|
148
|
-
private _slots?;
|
|
149
|
-
constructor(
|
|
150
|
-
/**
|
|
151
|
-
* Component def - note this may be an AsyncWrapper, and this._def will
|
|
152
|
-
* be overwritten by the inner component when resolved.
|
|
153
|
-
*/
|
|
154
|
-
_def: InnerComponentDef, _props?: Record<string, any>, _createApp?: CreateAppFunction<Element>);
|
|
155
|
-
connectedCallback(): void;
|
|
156
|
-
private _setParent;
|
|
157
|
-
private _inheritParentContext;
|
|
158
|
-
disconnectedCallback(): void;
|
|
159
|
-
private _processMutations;
|
|
160
|
-
/**
|
|
161
|
-
* resolve inner component definition (handle possible async component)
|
|
162
|
-
*/
|
|
163
|
-
private _resolveDef;
|
|
164
|
-
private _mount;
|
|
165
|
-
private _resolveProps;
|
|
166
|
-
protected _setAttr(key: string): void;
|
|
167
|
-
private _update;
|
|
168
|
-
private _createVNode;
|
|
169
|
-
private _applyStyles;
|
|
170
|
-
/**
|
|
171
|
-
* Only called when shadowRoot is false
|
|
172
|
-
*/
|
|
173
|
-
private _parseSlots;
|
|
174
|
-
/**
|
|
175
|
-
* Only called when shadowRoot is false
|
|
176
|
-
*/
|
|
177
|
-
private _renderSlots;
|
|
178
|
-
}
|
|
179
|
-
export declare function useHost(caller?: string): VueElement | null;
|
|
180
|
-
/**
|
|
181
|
-
* Retrieve the shadowRoot of the current custom element. Only usable in setup()
|
|
182
|
-
* of a `defineCustomElement` component.
|
|
183
|
-
*/
|
|
184
|
-
export declare function useShadowRoot(): ShadowRoot | null;
|
|
185
|
-
|
|
186
|
-
export declare function useCssModule(name?: string): Record<string, string>;
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Runtime helper for SFC's CSS variable injection feature.
|
|
190
|
-
* @private
|
|
191
|
-
*/
|
|
192
|
-
export declare function useCssVars(getter: (ctx: any) => Record<string, unknown>): void;
|
|
193
|
-
|
|
194
94
|
export interface CSSProperties extends CSS.Properties<string | number>, CSS.PropertiesHyphen<string | number> {
|
|
195
95
|
/**
|
|
196
96
|
* The index signature was removed to enable closed typing for style
|
|
@@ -391,9 +291,10 @@ export interface AriaAttributes {
|
|
|
391
291
|
'aria-valuetext'?: string | undefined;
|
|
392
292
|
}
|
|
393
293
|
export type StyleValue = false | null | undefined | string | CSSProperties | Array<StyleValue>;
|
|
294
|
+
export type ClassValue = false | null | undefined | string | Record<string, any> | Array<ClassValue>;
|
|
394
295
|
export interface HTMLAttributes extends AriaAttributes, EventHandlers<Events> {
|
|
395
296
|
innerHTML?: string | undefined;
|
|
396
|
-
class?:
|
|
297
|
+
class?: ClassValue | undefined;
|
|
397
298
|
style?: StyleValue | undefined;
|
|
398
299
|
accesskey?: string | undefined;
|
|
399
300
|
contenteditable?: Booleanish | 'inherit' | 'plaintext-only' | undefined;
|
|
@@ -867,7 +768,7 @@ export interface SVGAttributes extends AriaAttributes, EventHandlers<Events> {
|
|
|
867
768
|
* SVG Styling Attributes
|
|
868
769
|
* @see https://www.w3.org/TR/SVG/styling.html#ElementSpecificStyling
|
|
869
770
|
*/
|
|
870
|
-
class?:
|
|
771
|
+
class?: ClassValue | undefined;
|
|
871
772
|
style?: StyleValue | undefined;
|
|
872
773
|
color?: string | undefined;
|
|
873
774
|
height?: Numberish | undefined;
|
|
@@ -1407,6 +1308,109 @@ export type NativeElements = {
|
|
|
1407
1308
|
[K in keyof IntrinsicElementAttributes]: IntrinsicElementAttributes[K] & ReservedProps;
|
|
1408
1309
|
};
|
|
1409
1310
|
|
|
1311
|
+
export type VueElementConstructor<P = {}> = {
|
|
1312
|
+
new (initialProps?: Record<string, any>): VueElement & P;
|
|
1313
|
+
};
|
|
1314
|
+
export interface CustomElementOptions {
|
|
1315
|
+
styles?: string[];
|
|
1316
|
+
shadowRoot?: boolean;
|
|
1317
|
+
shadowRootOptions?: Omit<ShadowRootInit, 'mode'>;
|
|
1318
|
+
nonce?: string;
|
|
1319
|
+
configureApp?: (app: App) => void;
|
|
1320
|
+
}
|
|
1321
|
+
export declare function defineCustomElement<Props, RawBindings = object>(setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs' | 'emits'> & CustomElementOptions & {
|
|
1322
|
+
props?: (keyof Props)[];
|
|
1323
|
+
}): VueElementConstructor<Props>;
|
|
1324
|
+
export declare function defineCustomElement<Props, RawBindings = object>(setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs' | 'emits'> & CustomElementOptions & {
|
|
1325
|
+
props?: ComponentObjectPropsOptions<Props>;
|
|
1326
|
+
}): VueElementConstructor<Props>;
|
|
1327
|
+
export declare function defineCustomElement<RuntimePropsOptions extends ComponentObjectPropsOptions = ComponentObjectPropsOptions, PropsKeys extends string = string, RuntimeEmitsOptions extends EmitsOptions = {}, EmitsKeys extends string = string, Data = {}, SetupBindings = {}, Computed extends ComputedOptions = {}, Methods extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, InjectOptions extends ComponentInjectOptions = {}, InjectKeys extends string = string, Slots extends SlotsType = {}, LocalComponents extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, InferredProps = string extends PropsKeys ? ComponentObjectPropsOptions extends RuntimePropsOptions ? {} : ExtractPropTypes<RuntimePropsOptions> : {
|
|
1328
|
+
[key in PropsKeys]?: any;
|
|
1329
|
+
}, ResolvedProps = InferredProps & EmitsToProps<RuntimeEmitsOptions>>(options: CustomElementOptions & {
|
|
1330
|
+
props?: (RuntimePropsOptions & ThisType<void>) | PropsKeys[];
|
|
1331
|
+
} & ComponentOptionsBase<ResolvedProps, SetupBindings, Data, Computed, Methods, Mixin, Extends, RuntimeEmitsOptions, EmitsKeys, {}, // Defaults
|
|
1332
|
+
InjectOptions, InjectKeys, Slots, LocalComponents, Directives, Exposed, Provide> & ThisType<CreateComponentPublicInstanceWithMixins<Readonly<ResolvedProps>, SetupBindings, Data, Computed, Methods, Mixin, Extends, RuntimeEmitsOptions, EmitsKeys, {}, false, InjectOptions, Slots, LocalComponents, Directives, Exposed>>, extraOptions?: CustomElementOptions): VueElementConstructor<ResolvedProps>;
|
|
1333
|
+
export declare function defineCustomElement<T extends {
|
|
1334
|
+
new (...args: any[]): ComponentPublicInstance<any>;
|
|
1335
|
+
}>(options: T, extraOptions?: CustomElementOptions): VueElementConstructor<T extends DefineComponent<infer P, any, any, any> ? P : unknown>;
|
|
1336
|
+
export declare const defineSSRCustomElement: typeof defineCustomElement;
|
|
1337
|
+
declare const BaseClass: typeof HTMLElement;
|
|
1338
|
+
type InnerComponentDef = ConcreteComponent & CustomElementOptions;
|
|
1339
|
+
export declare class VueElement extends BaseClass implements ComponentCustomElementInterface {
|
|
1340
|
+
/**
|
|
1341
|
+
* Component def - note this may be an AsyncWrapper, and this._def will
|
|
1342
|
+
* be overwritten by the inner component when resolved.
|
|
1343
|
+
*/
|
|
1344
|
+
private _def;
|
|
1345
|
+
private _props;
|
|
1346
|
+
private _createApp;
|
|
1347
|
+
_isVueCE: boolean;
|
|
1348
|
+
private _connected;
|
|
1349
|
+
private _resolved;
|
|
1350
|
+
private _patching;
|
|
1351
|
+
private _dirty;
|
|
1352
|
+
private _numberProps;
|
|
1353
|
+
private _styleChildren;
|
|
1354
|
+
private _pendingResolve;
|
|
1355
|
+
private _parent;
|
|
1356
|
+
private _styleAnchors;
|
|
1357
|
+
/**
|
|
1358
|
+
* dev only
|
|
1359
|
+
*/
|
|
1360
|
+
private _styles?;
|
|
1361
|
+
/**
|
|
1362
|
+
* dev only
|
|
1363
|
+
*/
|
|
1364
|
+
private _childStyles?;
|
|
1365
|
+
private _ob?;
|
|
1366
|
+
private _slots?;
|
|
1367
|
+
constructor(
|
|
1368
|
+
/**
|
|
1369
|
+
* Component def - note this may be an AsyncWrapper, and this._def will
|
|
1370
|
+
* be overwritten by the inner component when resolved.
|
|
1371
|
+
*/
|
|
1372
|
+
_def: InnerComponentDef, _props?: Record<string, any>, _createApp?: CreateAppFunction<Element>);
|
|
1373
|
+
connectedCallback(): void;
|
|
1374
|
+
private _setParent;
|
|
1375
|
+
private _inheritParentContext;
|
|
1376
|
+
disconnectedCallback(): void;
|
|
1377
|
+
private _processMutations;
|
|
1378
|
+
/**
|
|
1379
|
+
* resolve inner component definition (handle possible async component)
|
|
1380
|
+
*/
|
|
1381
|
+
private _resolveDef;
|
|
1382
|
+
private _mount;
|
|
1383
|
+
private _resolveProps;
|
|
1384
|
+
protected _setAttr(key: string): void;
|
|
1385
|
+
private _update;
|
|
1386
|
+
private _createVNode;
|
|
1387
|
+
private _applyStyles;
|
|
1388
|
+
private _getStyleAnchor;
|
|
1389
|
+
private _getRootStyleInsertionAnchor;
|
|
1390
|
+
/**
|
|
1391
|
+
* Only called when shadowRoot is false
|
|
1392
|
+
*/
|
|
1393
|
+
private _parseSlots;
|
|
1394
|
+
/**
|
|
1395
|
+
* Only called when shadowRoot is false
|
|
1396
|
+
*/
|
|
1397
|
+
private _renderSlots;
|
|
1398
|
+
}
|
|
1399
|
+
export declare function useHost(caller?: string): VueElement | null;
|
|
1400
|
+
/**
|
|
1401
|
+
* Retrieve the shadowRoot of the current custom element. Only usable in setup()
|
|
1402
|
+
* of a `defineCustomElement` component.
|
|
1403
|
+
*/
|
|
1404
|
+
export declare function useShadowRoot(): ShadowRoot | null;
|
|
1405
|
+
|
|
1406
|
+
export declare function useCssModule(name?: string): Record<string, string>;
|
|
1407
|
+
|
|
1408
|
+
/**
|
|
1409
|
+
* Runtime helper for SFC's CSS variable injection feature.
|
|
1410
|
+
* @private
|
|
1411
|
+
*/
|
|
1412
|
+
export declare function useCssVars(getter: (ctx: any) => Record<string, unknown>): void;
|
|
1413
|
+
|
|
1410
1414
|
/**
|
|
1411
1415
|
* This is a stub implementation to prevent the need to use dom types.
|
|
1412
1416
|
*
|
|
@@ -1421,6 +1425,10 @@ declare module '@vue/reactivity' {
|
|
|
1421
1425
|
}
|
|
1422
1426
|
}
|
|
1423
1427
|
declare module '@vue/runtime-core' {
|
|
1428
|
+
interface AllowedAttrs {
|
|
1429
|
+
class?: ClassValue;
|
|
1430
|
+
style?: StyleValue;
|
|
1431
|
+
}
|
|
1424
1432
|
interface GlobalComponents {
|
|
1425
1433
|
Transition: DefineComponent<TransitionProps>;
|
|
1426
1434
|
TransitionGroup: DefineComponent<TransitionGroupProps>;
|