@destyler/switch 0.0.1-beta.12
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/component.cjs +13 -0
- package/dist/component.d.cts +4 -0
- package/dist/component.d.mts +4 -0
- package/dist/component.d.ts +4 -0
- package/dist/component.mjs +6 -0
- package/dist/index.cjs +165 -0
- package/dist/index.d.cts +194 -0
- package/dist/index.d.mts +194 -0
- package/dist/index.d.ts +194 -0
- package/dist/index.mjs +162 -0
- package/dist/resolver.cjs +20 -0
- package/dist/resolver.d.cts +6 -0
- package/dist/resolver.d.mts +6 -0
- package/dist/resolver.d.ts +6 -0
- package/dist/resolver.mjs +17 -0
- package/package.json +45 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index.cjs');
|
|
4
|
+
require('vue');
|
|
5
|
+
require('@destyler/primitive');
|
|
6
|
+
require('@destyler/composition');
|
|
7
|
+
require('@destyler/shared');
|
|
8
|
+
require('@destyler/directives');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.DestylerSwitchRoot = index.DestylerSwitchRoot;
|
|
13
|
+
exports.DestylerSwitchThump = index.DestylerSwitchThump;
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const vue = require('vue');
|
|
4
|
+
const primitive = require('@destyler/primitive');
|
|
5
|
+
const composition = require('@destyler/composition');
|
|
6
|
+
const shared = require('@destyler/shared');
|
|
7
|
+
const directives = require('@destyler/directives');
|
|
8
|
+
|
|
9
|
+
const destylerSwitchRootProps = {
|
|
10
|
+
as: {
|
|
11
|
+
type: [String, Object],
|
|
12
|
+
required: false,
|
|
13
|
+
default: "button"
|
|
14
|
+
},
|
|
15
|
+
asChild: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
required: false,
|
|
18
|
+
default: false
|
|
19
|
+
},
|
|
20
|
+
defaultChecked: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
required: false
|
|
23
|
+
},
|
|
24
|
+
checked: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
required: false,
|
|
27
|
+
default: void 0
|
|
28
|
+
},
|
|
29
|
+
disabled: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
required: false
|
|
32
|
+
},
|
|
33
|
+
required: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
required: false
|
|
36
|
+
},
|
|
37
|
+
name: {
|
|
38
|
+
type: String,
|
|
39
|
+
required: false
|
|
40
|
+
},
|
|
41
|
+
id: {
|
|
42
|
+
type: String,
|
|
43
|
+
required: false
|
|
44
|
+
},
|
|
45
|
+
value: {
|
|
46
|
+
type: String,
|
|
47
|
+
required: false,
|
|
48
|
+
default: "on"
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const [injectSwitchRootContext, provideSwitchRootContext] = shared.createContext("DestylerSwitchRoot");
|
|
52
|
+
const DestylerSwitchRoot = vue.defineComponent({
|
|
53
|
+
name: "DestylerSwitchRoot",
|
|
54
|
+
props: destylerSwitchRootProps,
|
|
55
|
+
emits: ["update:checked"],
|
|
56
|
+
setup(props, { emit }) {
|
|
57
|
+
const { disabled } = vue.toRefs(props);
|
|
58
|
+
const checked = composition.useVModel(props, "checked", emit, {
|
|
59
|
+
defaultValue: props.defaultChecked,
|
|
60
|
+
passive: props.checked === void 0
|
|
61
|
+
});
|
|
62
|
+
function toggleCheck() {
|
|
63
|
+
if (disabled.value)
|
|
64
|
+
return;
|
|
65
|
+
checked.value = !checked.value;
|
|
66
|
+
}
|
|
67
|
+
const { forwardRef, currentElement } = composition.useForwardExpose();
|
|
68
|
+
const isFormControl = composition.useFormControl(currentElement);
|
|
69
|
+
const ariaLabel = vue.computed(() => props.id && currentElement.value ? document.querySelector(`[for="${props.id}"]`)?.textContent : void 0);
|
|
70
|
+
provideSwitchRootContext({
|
|
71
|
+
checked,
|
|
72
|
+
toggleCheck,
|
|
73
|
+
disabled
|
|
74
|
+
});
|
|
75
|
+
return {
|
|
76
|
+
forwardRef,
|
|
77
|
+
toggleCheck,
|
|
78
|
+
isFormControl,
|
|
79
|
+
ariaLabel,
|
|
80
|
+
checked,
|
|
81
|
+
disabled
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
render() {
|
|
85
|
+
return [
|
|
86
|
+
vue.withDirectives(vue.h(primitive.DestylerPrimitive, vue.mergeProps(this.$attrs, {
|
|
87
|
+
"role": "switch",
|
|
88
|
+
"type": this.$props.as === "button" ? "button" : void 0,
|
|
89
|
+
"value": this.value,
|
|
90
|
+
"aria-label": this.$attrs["aria-label"] || this.ariaLabel,
|
|
91
|
+
"aria-checked": this.checked,
|
|
92
|
+
"aria-required": this.$props.required,
|
|
93
|
+
"data-state": this.checked ? "checked" : "unchecked",
|
|
94
|
+
"data-disabled": this.disabled ? "" : void 0,
|
|
95
|
+
"as": this.$props.as,
|
|
96
|
+
"asChild": this.$props.asChild,
|
|
97
|
+
"disabled": this.disabled,
|
|
98
|
+
"onClick": () => {
|
|
99
|
+
this.toggleCheck();
|
|
100
|
+
},
|
|
101
|
+
"onKeydown": vue.withModifiers(() => {
|
|
102
|
+
this.toggleCheck();
|
|
103
|
+
}, ["enter", "prevent"])
|
|
104
|
+
}), {
|
|
105
|
+
default: () => this.$slots.default?.()
|
|
106
|
+
}), [
|
|
107
|
+
[directives.BindOnceDirective, { id: this.$props.id }]
|
|
108
|
+
]),
|
|
109
|
+
this.isFormControl ? vue.h("input", {
|
|
110
|
+
"type": "checkbox",
|
|
111
|
+
"name": this.$props.name,
|
|
112
|
+
"tabindex": -1,
|
|
113
|
+
"aria-hidden": "",
|
|
114
|
+
"disabled": this.disabled,
|
|
115
|
+
"required": this.$props.required,
|
|
116
|
+
"value": this.value,
|
|
117
|
+
"checked": !!this.checked,
|
|
118
|
+
"data-state": this.checked ? "checked" : "unchecked",
|
|
119
|
+
"data-disabled": this.disabled ? "" : void 0,
|
|
120
|
+
"style": {
|
|
121
|
+
transform: "translateX(-100%)",
|
|
122
|
+
position: "absolute",
|
|
123
|
+
pointerEvents: "none",
|
|
124
|
+
opacity: 0,
|
|
125
|
+
margin: 0
|
|
126
|
+
}
|
|
127
|
+
}) : null
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const destylerSwitchThumpProps = {
|
|
133
|
+
as: {
|
|
134
|
+
type: [String, Object],
|
|
135
|
+
required: false,
|
|
136
|
+
default: "span"
|
|
137
|
+
},
|
|
138
|
+
asChild: {
|
|
139
|
+
type: Boolean,
|
|
140
|
+
required: false,
|
|
141
|
+
default: false
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
const DestylerSwitchThump = vue.defineComponent({
|
|
145
|
+
name: "DestylerSwitchThump",
|
|
146
|
+
props: destylerSwitchThumpProps,
|
|
147
|
+
setup(_) {
|
|
148
|
+
const rootContext = injectSwitchRootContext();
|
|
149
|
+
composition.useForwardExpose();
|
|
150
|
+
return {
|
|
151
|
+
rootContext
|
|
152
|
+
};
|
|
153
|
+
},
|
|
154
|
+
render() {
|
|
155
|
+
return vue.h(primitive.DestylerPrimitive, {
|
|
156
|
+
"data-state": this.rootContext.checked?.value ? "checked" : "unchecked",
|
|
157
|
+
"data-disabled": this.rootContext.disabled.value ? "" : void 0,
|
|
158
|
+
"asChild": this.$props.asChild,
|
|
159
|
+
"as": this.$props.as
|
|
160
|
+
}, this.$slots.default?.());
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
exports.DestylerSwitchRoot = DestylerSwitchRoot;
|
|
165
|
+
exports.DestylerSwitchThump = DestylerSwitchThump;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { PropType, Component, Ref } from 'vue';
|
|
3
|
+
import { AsTag } from '@destyler/primitive';
|
|
4
|
+
import { ExtractPublicPropTypes } from '@destyler/shared';
|
|
5
|
+
|
|
6
|
+
declare const destylerSwitchRootProps: {
|
|
7
|
+
readonly as: {
|
|
8
|
+
readonly type: PropType<AsTag | Component>;
|
|
9
|
+
readonly required: false;
|
|
10
|
+
readonly default: "button";
|
|
11
|
+
};
|
|
12
|
+
readonly asChild: {
|
|
13
|
+
readonly type: PropType<boolean>;
|
|
14
|
+
readonly required: false;
|
|
15
|
+
readonly default: false;
|
|
16
|
+
};
|
|
17
|
+
readonly defaultChecked: {
|
|
18
|
+
readonly type: PropType<boolean>;
|
|
19
|
+
readonly required: false;
|
|
20
|
+
};
|
|
21
|
+
readonly checked: {
|
|
22
|
+
readonly type: PropType<boolean>;
|
|
23
|
+
readonly required: false;
|
|
24
|
+
readonly default: undefined;
|
|
25
|
+
};
|
|
26
|
+
readonly disabled: {
|
|
27
|
+
readonly type: PropType<boolean>;
|
|
28
|
+
readonly required: false;
|
|
29
|
+
};
|
|
30
|
+
readonly required: {
|
|
31
|
+
readonly type: PropType<boolean>;
|
|
32
|
+
readonly required: false;
|
|
33
|
+
};
|
|
34
|
+
readonly name: {
|
|
35
|
+
readonly type: PropType<string>;
|
|
36
|
+
readonly required: false;
|
|
37
|
+
};
|
|
38
|
+
readonly id: {
|
|
39
|
+
readonly type: PropType<string>;
|
|
40
|
+
readonly required: false;
|
|
41
|
+
};
|
|
42
|
+
readonly value: {
|
|
43
|
+
readonly type: PropType<string>;
|
|
44
|
+
readonly required: false;
|
|
45
|
+
readonly default: "on";
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
type DestylerSwitchRootProps = ExtractPublicPropTypes<typeof destylerSwitchRootProps>;
|
|
49
|
+
interface SwitchRootContext {
|
|
50
|
+
checked?: Ref<boolean>;
|
|
51
|
+
toggleCheck: () => void;
|
|
52
|
+
disabled: Ref<boolean | undefined>;
|
|
53
|
+
}
|
|
54
|
+
declare const DestylerSwitchRoot: vue.DefineComponent<{
|
|
55
|
+
readonly as: {
|
|
56
|
+
readonly type: PropType<AsTag | Component>;
|
|
57
|
+
readonly required: false;
|
|
58
|
+
readonly default: "button";
|
|
59
|
+
};
|
|
60
|
+
readonly asChild: {
|
|
61
|
+
readonly type: PropType<boolean>;
|
|
62
|
+
readonly required: false;
|
|
63
|
+
readonly default: false;
|
|
64
|
+
};
|
|
65
|
+
readonly defaultChecked: {
|
|
66
|
+
readonly type: PropType<boolean>;
|
|
67
|
+
readonly required: false;
|
|
68
|
+
};
|
|
69
|
+
readonly checked: {
|
|
70
|
+
readonly type: PropType<boolean>;
|
|
71
|
+
readonly required: false;
|
|
72
|
+
readonly default: undefined;
|
|
73
|
+
};
|
|
74
|
+
readonly disabled: {
|
|
75
|
+
readonly type: PropType<boolean>;
|
|
76
|
+
readonly required: false;
|
|
77
|
+
};
|
|
78
|
+
readonly required: {
|
|
79
|
+
readonly type: PropType<boolean>;
|
|
80
|
+
readonly required: false;
|
|
81
|
+
};
|
|
82
|
+
readonly name: {
|
|
83
|
+
readonly type: PropType<string>;
|
|
84
|
+
readonly required: false;
|
|
85
|
+
};
|
|
86
|
+
readonly id: {
|
|
87
|
+
readonly type: PropType<string>;
|
|
88
|
+
readonly required: false;
|
|
89
|
+
};
|
|
90
|
+
readonly value: {
|
|
91
|
+
readonly type: PropType<string>;
|
|
92
|
+
readonly required: false;
|
|
93
|
+
readonly default: "on";
|
|
94
|
+
};
|
|
95
|
+
}, {
|
|
96
|
+
forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
|
|
97
|
+
toggleCheck: () => void;
|
|
98
|
+
isFormControl: vue.ComputedRef<boolean>;
|
|
99
|
+
ariaLabel: vue.ComputedRef<string | null | undefined>;
|
|
100
|
+
checked: Ref<boolean>;
|
|
101
|
+
disabled: Ref<boolean | undefined>;
|
|
102
|
+
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "update:checked"[], "update:checked", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
103
|
+
readonly as: {
|
|
104
|
+
readonly type: PropType<AsTag | Component>;
|
|
105
|
+
readonly required: false;
|
|
106
|
+
readonly default: "button";
|
|
107
|
+
};
|
|
108
|
+
readonly asChild: {
|
|
109
|
+
readonly type: PropType<boolean>;
|
|
110
|
+
readonly required: false;
|
|
111
|
+
readonly default: false;
|
|
112
|
+
};
|
|
113
|
+
readonly defaultChecked: {
|
|
114
|
+
readonly type: PropType<boolean>;
|
|
115
|
+
readonly required: false;
|
|
116
|
+
};
|
|
117
|
+
readonly checked: {
|
|
118
|
+
readonly type: PropType<boolean>;
|
|
119
|
+
readonly required: false;
|
|
120
|
+
readonly default: undefined;
|
|
121
|
+
};
|
|
122
|
+
readonly disabled: {
|
|
123
|
+
readonly type: PropType<boolean>;
|
|
124
|
+
readonly required: false;
|
|
125
|
+
};
|
|
126
|
+
readonly required: {
|
|
127
|
+
readonly type: PropType<boolean>;
|
|
128
|
+
readonly required: false;
|
|
129
|
+
};
|
|
130
|
+
readonly name: {
|
|
131
|
+
readonly type: PropType<string>;
|
|
132
|
+
readonly required: false;
|
|
133
|
+
};
|
|
134
|
+
readonly id: {
|
|
135
|
+
readonly type: PropType<string>;
|
|
136
|
+
readonly required: false;
|
|
137
|
+
};
|
|
138
|
+
readonly value: {
|
|
139
|
+
readonly type: PropType<string>;
|
|
140
|
+
readonly required: false;
|
|
141
|
+
readonly default: "on";
|
|
142
|
+
};
|
|
143
|
+
}>> & {
|
|
144
|
+
"onUpdate:checked"?: ((...args: any[]) => any) | undefined;
|
|
145
|
+
}, {
|
|
146
|
+
readonly as: AsTag | Component;
|
|
147
|
+
readonly asChild: boolean;
|
|
148
|
+
readonly checked: boolean;
|
|
149
|
+
readonly value: string;
|
|
150
|
+
}, {}>;
|
|
151
|
+
|
|
152
|
+
declare const destylerSwitchThumpProps: {
|
|
153
|
+
readonly as: {
|
|
154
|
+
readonly type: PropType<AsTag | Component>;
|
|
155
|
+
readonly required: false;
|
|
156
|
+
readonly default: "span";
|
|
157
|
+
};
|
|
158
|
+
readonly asChild: {
|
|
159
|
+
readonly type: PropType<boolean>;
|
|
160
|
+
readonly required: false;
|
|
161
|
+
readonly default: false;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
type DestylerSwitchThumpProps = ExtractPublicPropTypes<typeof destylerSwitchThumpProps>;
|
|
165
|
+
declare const DestylerSwitchThump: vue.DefineComponent<{
|
|
166
|
+
readonly as: {
|
|
167
|
+
readonly type: PropType<AsTag | Component>;
|
|
168
|
+
readonly required: false;
|
|
169
|
+
readonly default: "span";
|
|
170
|
+
};
|
|
171
|
+
readonly asChild: {
|
|
172
|
+
readonly type: PropType<boolean>;
|
|
173
|
+
readonly required: false;
|
|
174
|
+
readonly default: false;
|
|
175
|
+
};
|
|
176
|
+
}, {
|
|
177
|
+
rootContext: SwitchRootContext;
|
|
178
|
+
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
179
|
+
readonly as: {
|
|
180
|
+
readonly type: PropType<AsTag | Component>;
|
|
181
|
+
readonly required: false;
|
|
182
|
+
readonly default: "span";
|
|
183
|
+
};
|
|
184
|
+
readonly asChild: {
|
|
185
|
+
readonly type: PropType<boolean>;
|
|
186
|
+
readonly required: false;
|
|
187
|
+
readonly default: false;
|
|
188
|
+
};
|
|
189
|
+
}>>, {
|
|
190
|
+
readonly as: AsTag | Component;
|
|
191
|
+
readonly asChild: boolean;
|
|
192
|
+
}, {}>;
|
|
193
|
+
|
|
194
|
+
export { DestylerSwitchRoot, type DestylerSwitchRootProps, DestylerSwitchThump, type DestylerSwitchThumpProps };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { PropType, Component, Ref } from 'vue';
|
|
3
|
+
import { AsTag } from '@destyler/primitive';
|
|
4
|
+
import { ExtractPublicPropTypes } from '@destyler/shared';
|
|
5
|
+
|
|
6
|
+
declare const destylerSwitchRootProps: {
|
|
7
|
+
readonly as: {
|
|
8
|
+
readonly type: PropType<AsTag | Component>;
|
|
9
|
+
readonly required: false;
|
|
10
|
+
readonly default: "button";
|
|
11
|
+
};
|
|
12
|
+
readonly asChild: {
|
|
13
|
+
readonly type: PropType<boolean>;
|
|
14
|
+
readonly required: false;
|
|
15
|
+
readonly default: false;
|
|
16
|
+
};
|
|
17
|
+
readonly defaultChecked: {
|
|
18
|
+
readonly type: PropType<boolean>;
|
|
19
|
+
readonly required: false;
|
|
20
|
+
};
|
|
21
|
+
readonly checked: {
|
|
22
|
+
readonly type: PropType<boolean>;
|
|
23
|
+
readonly required: false;
|
|
24
|
+
readonly default: undefined;
|
|
25
|
+
};
|
|
26
|
+
readonly disabled: {
|
|
27
|
+
readonly type: PropType<boolean>;
|
|
28
|
+
readonly required: false;
|
|
29
|
+
};
|
|
30
|
+
readonly required: {
|
|
31
|
+
readonly type: PropType<boolean>;
|
|
32
|
+
readonly required: false;
|
|
33
|
+
};
|
|
34
|
+
readonly name: {
|
|
35
|
+
readonly type: PropType<string>;
|
|
36
|
+
readonly required: false;
|
|
37
|
+
};
|
|
38
|
+
readonly id: {
|
|
39
|
+
readonly type: PropType<string>;
|
|
40
|
+
readonly required: false;
|
|
41
|
+
};
|
|
42
|
+
readonly value: {
|
|
43
|
+
readonly type: PropType<string>;
|
|
44
|
+
readonly required: false;
|
|
45
|
+
readonly default: "on";
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
type DestylerSwitchRootProps = ExtractPublicPropTypes<typeof destylerSwitchRootProps>;
|
|
49
|
+
interface SwitchRootContext {
|
|
50
|
+
checked?: Ref<boolean>;
|
|
51
|
+
toggleCheck: () => void;
|
|
52
|
+
disabled: Ref<boolean | undefined>;
|
|
53
|
+
}
|
|
54
|
+
declare const DestylerSwitchRoot: vue.DefineComponent<{
|
|
55
|
+
readonly as: {
|
|
56
|
+
readonly type: PropType<AsTag | Component>;
|
|
57
|
+
readonly required: false;
|
|
58
|
+
readonly default: "button";
|
|
59
|
+
};
|
|
60
|
+
readonly asChild: {
|
|
61
|
+
readonly type: PropType<boolean>;
|
|
62
|
+
readonly required: false;
|
|
63
|
+
readonly default: false;
|
|
64
|
+
};
|
|
65
|
+
readonly defaultChecked: {
|
|
66
|
+
readonly type: PropType<boolean>;
|
|
67
|
+
readonly required: false;
|
|
68
|
+
};
|
|
69
|
+
readonly checked: {
|
|
70
|
+
readonly type: PropType<boolean>;
|
|
71
|
+
readonly required: false;
|
|
72
|
+
readonly default: undefined;
|
|
73
|
+
};
|
|
74
|
+
readonly disabled: {
|
|
75
|
+
readonly type: PropType<boolean>;
|
|
76
|
+
readonly required: false;
|
|
77
|
+
};
|
|
78
|
+
readonly required: {
|
|
79
|
+
readonly type: PropType<boolean>;
|
|
80
|
+
readonly required: false;
|
|
81
|
+
};
|
|
82
|
+
readonly name: {
|
|
83
|
+
readonly type: PropType<string>;
|
|
84
|
+
readonly required: false;
|
|
85
|
+
};
|
|
86
|
+
readonly id: {
|
|
87
|
+
readonly type: PropType<string>;
|
|
88
|
+
readonly required: false;
|
|
89
|
+
};
|
|
90
|
+
readonly value: {
|
|
91
|
+
readonly type: PropType<string>;
|
|
92
|
+
readonly required: false;
|
|
93
|
+
readonly default: "on";
|
|
94
|
+
};
|
|
95
|
+
}, {
|
|
96
|
+
forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
|
|
97
|
+
toggleCheck: () => void;
|
|
98
|
+
isFormControl: vue.ComputedRef<boolean>;
|
|
99
|
+
ariaLabel: vue.ComputedRef<string | null | undefined>;
|
|
100
|
+
checked: Ref<boolean>;
|
|
101
|
+
disabled: Ref<boolean | undefined>;
|
|
102
|
+
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "update:checked"[], "update:checked", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
103
|
+
readonly as: {
|
|
104
|
+
readonly type: PropType<AsTag | Component>;
|
|
105
|
+
readonly required: false;
|
|
106
|
+
readonly default: "button";
|
|
107
|
+
};
|
|
108
|
+
readonly asChild: {
|
|
109
|
+
readonly type: PropType<boolean>;
|
|
110
|
+
readonly required: false;
|
|
111
|
+
readonly default: false;
|
|
112
|
+
};
|
|
113
|
+
readonly defaultChecked: {
|
|
114
|
+
readonly type: PropType<boolean>;
|
|
115
|
+
readonly required: false;
|
|
116
|
+
};
|
|
117
|
+
readonly checked: {
|
|
118
|
+
readonly type: PropType<boolean>;
|
|
119
|
+
readonly required: false;
|
|
120
|
+
readonly default: undefined;
|
|
121
|
+
};
|
|
122
|
+
readonly disabled: {
|
|
123
|
+
readonly type: PropType<boolean>;
|
|
124
|
+
readonly required: false;
|
|
125
|
+
};
|
|
126
|
+
readonly required: {
|
|
127
|
+
readonly type: PropType<boolean>;
|
|
128
|
+
readonly required: false;
|
|
129
|
+
};
|
|
130
|
+
readonly name: {
|
|
131
|
+
readonly type: PropType<string>;
|
|
132
|
+
readonly required: false;
|
|
133
|
+
};
|
|
134
|
+
readonly id: {
|
|
135
|
+
readonly type: PropType<string>;
|
|
136
|
+
readonly required: false;
|
|
137
|
+
};
|
|
138
|
+
readonly value: {
|
|
139
|
+
readonly type: PropType<string>;
|
|
140
|
+
readonly required: false;
|
|
141
|
+
readonly default: "on";
|
|
142
|
+
};
|
|
143
|
+
}>> & {
|
|
144
|
+
"onUpdate:checked"?: ((...args: any[]) => any) | undefined;
|
|
145
|
+
}, {
|
|
146
|
+
readonly as: AsTag | Component;
|
|
147
|
+
readonly asChild: boolean;
|
|
148
|
+
readonly checked: boolean;
|
|
149
|
+
readonly value: string;
|
|
150
|
+
}, {}>;
|
|
151
|
+
|
|
152
|
+
declare const destylerSwitchThumpProps: {
|
|
153
|
+
readonly as: {
|
|
154
|
+
readonly type: PropType<AsTag | Component>;
|
|
155
|
+
readonly required: false;
|
|
156
|
+
readonly default: "span";
|
|
157
|
+
};
|
|
158
|
+
readonly asChild: {
|
|
159
|
+
readonly type: PropType<boolean>;
|
|
160
|
+
readonly required: false;
|
|
161
|
+
readonly default: false;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
type DestylerSwitchThumpProps = ExtractPublicPropTypes<typeof destylerSwitchThumpProps>;
|
|
165
|
+
declare const DestylerSwitchThump: vue.DefineComponent<{
|
|
166
|
+
readonly as: {
|
|
167
|
+
readonly type: PropType<AsTag | Component>;
|
|
168
|
+
readonly required: false;
|
|
169
|
+
readonly default: "span";
|
|
170
|
+
};
|
|
171
|
+
readonly asChild: {
|
|
172
|
+
readonly type: PropType<boolean>;
|
|
173
|
+
readonly required: false;
|
|
174
|
+
readonly default: false;
|
|
175
|
+
};
|
|
176
|
+
}, {
|
|
177
|
+
rootContext: SwitchRootContext;
|
|
178
|
+
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
179
|
+
readonly as: {
|
|
180
|
+
readonly type: PropType<AsTag | Component>;
|
|
181
|
+
readonly required: false;
|
|
182
|
+
readonly default: "span";
|
|
183
|
+
};
|
|
184
|
+
readonly asChild: {
|
|
185
|
+
readonly type: PropType<boolean>;
|
|
186
|
+
readonly required: false;
|
|
187
|
+
readonly default: false;
|
|
188
|
+
};
|
|
189
|
+
}>>, {
|
|
190
|
+
readonly as: AsTag | Component;
|
|
191
|
+
readonly asChild: boolean;
|
|
192
|
+
}, {}>;
|
|
193
|
+
|
|
194
|
+
export { DestylerSwitchRoot, type DestylerSwitchRootProps, DestylerSwitchThump, type DestylerSwitchThumpProps };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { PropType, Component, Ref } from 'vue';
|
|
3
|
+
import { AsTag } from '@destyler/primitive';
|
|
4
|
+
import { ExtractPublicPropTypes } from '@destyler/shared';
|
|
5
|
+
|
|
6
|
+
declare const destylerSwitchRootProps: {
|
|
7
|
+
readonly as: {
|
|
8
|
+
readonly type: PropType<AsTag | Component>;
|
|
9
|
+
readonly required: false;
|
|
10
|
+
readonly default: "button";
|
|
11
|
+
};
|
|
12
|
+
readonly asChild: {
|
|
13
|
+
readonly type: PropType<boolean>;
|
|
14
|
+
readonly required: false;
|
|
15
|
+
readonly default: false;
|
|
16
|
+
};
|
|
17
|
+
readonly defaultChecked: {
|
|
18
|
+
readonly type: PropType<boolean>;
|
|
19
|
+
readonly required: false;
|
|
20
|
+
};
|
|
21
|
+
readonly checked: {
|
|
22
|
+
readonly type: PropType<boolean>;
|
|
23
|
+
readonly required: false;
|
|
24
|
+
readonly default: undefined;
|
|
25
|
+
};
|
|
26
|
+
readonly disabled: {
|
|
27
|
+
readonly type: PropType<boolean>;
|
|
28
|
+
readonly required: false;
|
|
29
|
+
};
|
|
30
|
+
readonly required: {
|
|
31
|
+
readonly type: PropType<boolean>;
|
|
32
|
+
readonly required: false;
|
|
33
|
+
};
|
|
34
|
+
readonly name: {
|
|
35
|
+
readonly type: PropType<string>;
|
|
36
|
+
readonly required: false;
|
|
37
|
+
};
|
|
38
|
+
readonly id: {
|
|
39
|
+
readonly type: PropType<string>;
|
|
40
|
+
readonly required: false;
|
|
41
|
+
};
|
|
42
|
+
readonly value: {
|
|
43
|
+
readonly type: PropType<string>;
|
|
44
|
+
readonly required: false;
|
|
45
|
+
readonly default: "on";
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
type DestylerSwitchRootProps = ExtractPublicPropTypes<typeof destylerSwitchRootProps>;
|
|
49
|
+
interface SwitchRootContext {
|
|
50
|
+
checked?: Ref<boolean>;
|
|
51
|
+
toggleCheck: () => void;
|
|
52
|
+
disabled: Ref<boolean | undefined>;
|
|
53
|
+
}
|
|
54
|
+
declare const DestylerSwitchRoot: vue.DefineComponent<{
|
|
55
|
+
readonly as: {
|
|
56
|
+
readonly type: PropType<AsTag | Component>;
|
|
57
|
+
readonly required: false;
|
|
58
|
+
readonly default: "button";
|
|
59
|
+
};
|
|
60
|
+
readonly asChild: {
|
|
61
|
+
readonly type: PropType<boolean>;
|
|
62
|
+
readonly required: false;
|
|
63
|
+
readonly default: false;
|
|
64
|
+
};
|
|
65
|
+
readonly defaultChecked: {
|
|
66
|
+
readonly type: PropType<boolean>;
|
|
67
|
+
readonly required: false;
|
|
68
|
+
};
|
|
69
|
+
readonly checked: {
|
|
70
|
+
readonly type: PropType<boolean>;
|
|
71
|
+
readonly required: false;
|
|
72
|
+
readonly default: undefined;
|
|
73
|
+
};
|
|
74
|
+
readonly disabled: {
|
|
75
|
+
readonly type: PropType<boolean>;
|
|
76
|
+
readonly required: false;
|
|
77
|
+
};
|
|
78
|
+
readonly required: {
|
|
79
|
+
readonly type: PropType<boolean>;
|
|
80
|
+
readonly required: false;
|
|
81
|
+
};
|
|
82
|
+
readonly name: {
|
|
83
|
+
readonly type: PropType<string>;
|
|
84
|
+
readonly required: false;
|
|
85
|
+
};
|
|
86
|
+
readonly id: {
|
|
87
|
+
readonly type: PropType<string>;
|
|
88
|
+
readonly required: false;
|
|
89
|
+
};
|
|
90
|
+
readonly value: {
|
|
91
|
+
readonly type: PropType<string>;
|
|
92
|
+
readonly required: false;
|
|
93
|
+
readonly default: "on";
|
|
94
|
+
};
|
|
95
|
+
}, {
|
|
96
|
+
forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
|
|
97
|
+
toggleCheck: () => void;
|
|
98
|
+
isFormControl: vue.ComputedRef<boolean>;
|
|
99
|
+
ariaLabel: vue.ComputedRef<string | null | undefined>;
|
|
100
|
+
checked: Ref<boolean>;
|
|
101
|
+
disabled: Ref<boolean | undefined>;
|
|
102
|
+
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "update:checked"[], "update:checked", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
103
|
+
readonly as: {
|
|
104
|
+
readonly type: PropType<AsTag | Component>;
|
|
105
|
+
readonly required: false;
|
|
106
|
+
readonly default: "button";
|
|
107
|
+
};
|
|
108
|
+
readonly asChild: {
|
|
109
|
+
readonly type: PropType<boolean>;
|
|
110
|
+
readonly required: false;
|
|
111
|
+
readonly default: false;
|
|
112
|
+
};
|
|
113
|
+
readonly defaultChecked: {
|
|
114
|
+
readonly type: PropType<boolean>;
|
|
115
|
+
readonly required: false;
|
|
116
|
+
};
|
|
117
|
+
readonly checked: {
|
|
118
|
+
readonly type: PropType<boolean>;
|
|
119
|
+
readonly required: false;
|
|
120
|
+
readonly default: undefined;
|
|
121
|
+
};
|
|
122
|
+
readonly disabled: {
|
|
123
|
+
readonly type: PropType<boolean>;
|
|
124
|
+
readonly required: false;
|
|
125
|
+
};
|
|
126
|
+
readonly required: {
|
|
127
|
+
readonly type: PropType<boolean>;
|
|
128
|
+
readonly required: false;
|
|
129
|
+
};
|
|
130
|
+
readonly name: {
|
|
131
|
+
readonly type: PropType<string>;
|
|
132
|
+
readonly required: false;
|
|
133
|
+
};
|
|
134
|
+
readonly id: {
|
|
135
|
+
readonly type: PropType<string>;
|
|
136
|
+
readonly required: false;
|
|
137
|
+
};
|
|
138
|
+
readonly value: {
|
|
139
|
+
readonly type: PropType<string>;
|
|
140
|
+
readonly required: false;
|
|
141
|
+
readonly default: "on";
|
|
142
|
+
};
|
|
143
|
+
}>> & {
|
|
144
|
+
"onUpdate:checked"?: ((...args: any[]) => any) | undefined;
|
|
145
|
+
}, {
|
|
146
|
+
readonly as: AsTag | Component;
|
|
147
|
+
readonly asChild: boolean;
|
|
148
|
+
readonly checked: boolean;
|
|
149
|
+
readonly value: string;
|
|
150
|
+
}, {}>;
|
|
151
|
+
|
|
152
|
+
declare const destylerSwitchThumpProps: {
|
|
153
|
+
readonly as: {
|
|
154
|
+
readonly type: PropType<AsTag | Component>;
|
|
155
|
+
readonly required: false;
|
|
156
|
+
readonly default: "span";
|
|
157
|
+
};
|
|
158
|
+
readonly asChild: {
|
|
159
|
+
readonly type: PropType<boolean>;
|
|
160
|
+
readonly required: false;
|
|
161
|
+
readonly default: false;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
type DestylerSwitchThumpProps = ExtractPublicPropTypes<typeof destylerSwitchThumpProps>;
|
|
165
|
+
declare const DestylerSwitchThump: vue.DefineComponent<{
|
|
166
|
+
readonly as: {
|
|
167
|
+
readonly type: PropType<AsTag | Component>;
|
|
168
|
+
readonly required: false;
|
|
169
|
+
readonly default: "span";
|
|
170
|
+
};
|
|
171
|
+
readonly asChild: {
|
|
172
|
+
readonly type: PropType<boolean>;
|
|
173
|
+
readonly required: false;
|
|
174
|
+
readonly default: false;
|
|
175
|
+
};
|
|
176
|
+
}, {
|
|
177
|
+
rootContext: SwitchRootContext;
|
|
178
|
+
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
179
|
+
readonly as: {
|
|
180
|
+
readonly type: PropType<AsTag | Component>;
|
|
181
|
+
readonly required: false;
|
|
182
|
+
readonly default: "span";
|
|
183
|
+
};
|
|
184
|
+
readonly asChild: {
|
|
185
|
+
readonly type: PropType<boolean>;
|
|
186
|
+
readonly required: false;
|
|
187
|
+
readonly default: false;
|
|
188
|
+
};
|
|
189
|
+
}>>, {
|
|
190
|
+
readonly as: AsTag | Component;
|
|
191
|
+
readonly asChild: boolean;
|
|
192
|
+
}, {}>;
|
|
193
|
+
|
|
194
|
+
export { DestylerSwitchRoot, type DestylerSwitchRootProps, DestylerSwitchThump, type DestylerSwitchThumpProps };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { defineComponent, toRefs, computed, withDirectives, h, mergeProps, withModifiers } from 'vue';
|
|
2
|
+
import { DestylerPrimitive } from '@destyler/primitive';
|
|
3
|
+
import { useVModel, useForwardExpose, useFormControl } from '@destyler/composition';
|
|
4
|
+
import { createContext } from '@destyler/shared';
|
|
5
|
+
import { BindOnceDirective } from '@destyler/directives';
|
|
6
|
+
|
|
7
|
+
const destylerSwitchRootProps = {
|
|
8
|
+
as: {
|
|
9
|
+
type: [String, Object],
|
|
10
|
+
required: false,
|
|
11
|
+
default: "button"
|
|
12
|
+
},
|
|
13
|
+
asChild: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
required: false,
|
|
16
|
+
default: false
|
|
17
|
+
},
|
|
18
|
+
defaultChecked: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
required: false
|
|
21
|
+
},
|
|
22
|
+
checked: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
required: false,
|
|
25
|
+
default: void 0
|
|
26
|
+
},
|
|
27
|
+
disabled: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
required: false
|
|
30
|
+
},
|
|
31
|
+
required: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
required: false
|
|
34
|
+
},
|
|
35
|
+
name: {
|
|
36
|
+
type: String,
|
|
37
|
+
required: false
|
|
38
|
+
},
|
|
39
|
+
id: {
|
|
40
|
+
type: String,
|
|
41
|
+
required: false
|
|
42
|
+
},
|
|
43
|
+
value: {
|
|
44
|
+
type: String,
|
|
45
|
+
required: false,
|
|
46
|
+
default: "on"
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const [injectSwitchRootContext, provideSwitchRootContext] = createContext("DestylerSwitchRoot");
|
|
50
|
+
const DestylerSwitchRoot = defineComponent({
|
|
51
|
+
name: "DestylerSwitchRoot",
|
|
52
|
+
props: destylerSwitchRootProps,
|
|
53
|
+
emits: ["update:checked"],
|
|
54
|
+
setup(props, { emit }) {
|
|
55
|
+
const { disabled } = toRefs(props);
|
|
56
|
+
const checked = useVModel(props, "checked", emit, {
|
|
57
|
+
defaultValue: props.defaultChecked,
|
|
58
|
+
passive: props.checked === void 0
|
|
59
|
+
});
|
|
60
|
+
function toggleCheck() {
|
|
61
|
+
if (disabled.value)
|
|
62
|
+
return;
|
|
63
|
+
checked.value = !checked.value;
|
|
64
|
+
}
|
|
65
|
+
const { forwardRef, currentElement } = useForwardExpose();
|
|
66
|
+
const isFormControl = useFormControl(currentElement);
|
|
67
|
+
const ariaLabel = computed(() => props.id && currentElement.value ? document.querySelector(`[for="${props.id}"]`)?.textContent : void 0);
|
|
68
|
+
provideSwitchRootContext({
|
|
69
|
+
checked,
|
|
70
|
+
toggleCheck,
|
|
71
|
+
disabled
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
forwardRef,
|
|
75
|
+
toggleCheck,
|
|
76
|
+
isFormControl,
|
|
77
|
+
ariaLabel,
|
|
78
|
+
checked,
|
|
79
|
+
disabled
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
render() {
|
|
83
|
+
return [
|
|
84
|
+
withDirectives(h(DestylerPrimitive, mergeProps(this.$attrs, {
|
|
85
|
+
"role": "switch",
|
|
86
|
+
"type": this.$props.as === "button" ? "button" : void 0,
|
|
87
|
+
"value": this.value,
|
|
88
|
+
"aria-label": this.$attrs["aria-label"] || this.ariaLabel,
|
|
89
|
+
"aria-checked": this.checked,
|
|
90
|
+
"aria-required": this.$props.required,
|
|
91
|
+
"data-state": this.checked ? "checked" : "unchecked",
|
|
92
|
+
"data-disabled": this.disabled ? "" : void 0,
|
|
93
|
+
"as": this.$props.as,
|
|
94
|
+
"asChild": this.$props.asChild,
|
|
95
|
+
"disabled": this.disabled,
|
|
96
|
+
"onClick": () => {
|
|
97
|
+
this.toggleCheck();
|
|
98
|
+
},
|
|
99
|
+
"onKeydown": withModifiers(() => {
|
|
100
|
+
this.toggleCheck();
|
|
101
|
+
}, ["enter", "prevent"])
|
|
102
|
+
}), {
|
|
103
|
+
default: () => this.$slots.default?.()
|
|
104
|
+
}), [
|
|
105
|
+
[BindOnceDirective, { id: this.$props.id }]
|
|
106
|
+
]),
|
|
107
|
+
this.isFormControl ? h("input", {
|
|
108
|
+
"type": "checkbox",
|
|
109
|
+
"name": this.$props.name,
|
|
110
|
+
"tabindex": -1,
|
|
111
|
+
"aria-hidden": "",
|
|
112
|
+
"disabled": this.disabled,
|
|
113
|
+
"required": this.$props.required,
|
|
114
|
+
"value": this.value,
|
|
115
|
+
"checked": !!this.checked,
|
|
116
|
+
"data-state": this.checked ? "checked" : "unchecked",
|
|
117
|
+
"data-disabled": this.disabled ? "" : void 0,
|
|
118
|
+
"style": {
|
|
119
|
+
transform: "translateX(-100%)",
|
|
120
|
+
position: "absolute",
|
|
121
|
+
pointerEvents: "none",
|
|
122
|
+
opacity: 0,
|
|
123
|
+
margin: 0
|
|
124
|
+
}
|
|
125
|
+
}) : null
|
|
126
|
+
];
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
const destylerSwitchThumpProps = {
|
|
131
|
+
as: {
|
|
132
|
+
type: [String, Object],
|
|
133
|
+
required: false,
|
|
134
|
+
default: "span"
|
|
135
|
+
},
|
|
136
|
+
asChild: {
|
|
137
|
+
type: Boolean,
|
|
138
|
+
required: false,
|
|
139
|
+
default: false
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
const DestylerSwitchThump = defineComponent({
|
|
143
|
+
name: "DestylerSwitchThump",
|
|
144
|
+
props: destylerSwitchThumpProps,
|
|
145
|
+
setup(_) {
|
|
146
|
+
const rootContext = injectSwitchRootContext();
|
|
147
|
+
useForwardExpose();
|
|
148
|
+
return {
|
|
149
|
+
rootContext
|
|
150
|
+
};
|
|
151
|
+
},
|
|
152
|
+
render() {
|
|
153
|
+
return h(DestylerPrimitive, {
|
|
154
|
+
"data-state": this.rootContext.checked?.value ? "checked" : "unchecked",
|
|
155
|
+
"data-disabled": this.rootContext.disabled.value ? "" : void 0,
|
|
156
|
+
"asChild": this.$props.asChild,
|
|
157
|
+
"as": this.$props.as
|
|
158
|
+
}, this.$slots.default?.());
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
export { DestylerSwitchRoot, DestylerSwitchThump };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const name = "@destyler/switch";
|
|
4
|
+
|
|
5
|
+
const packageName = name;
|
|
6
|
+
const switchComponentName = [
|
|
7
|
+
"DestylerTemplate"
|
|
8
|
+
];
|
|
9
|
+
function DestylerTemplateResolver() {
|
|
10
|
+
return {
|
|
11
|
+
type: "component",
|
|
12
|
+
resolve: (name2) => {
|
|
13
|
+
if (switchComponentName.includes(name2))
|
|
14
|
+
return { name: name2, from: packageName };
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.DestylerTemplateResolver = DestylerTemplateResolver;
|
|
20
|
+
exports.switchComponentName = switchComponentName;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const name = "@destyler/switch";
|
|
2
|
+
|
|
3
|
+
const packageName = name;
|
|
4
|
+
const switchComponentName = [
|
|
5
|
+
"DestylerTemplate"
|
|
6
|
+
];
|
|
7
|
+
function DestylerTemplateResolver() {
|
|
8
|
+
return {
|
|
9
|
+
type: "component",
|
|
10
|
+
resolve: (name2) => {
|
|
11
|
+
if (switchComponentName.includes(name2))
|
|
12
|
+
return { name: name2, from: packageName };
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { DestylerTemplateResolver, switchComponentName };
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@destyler/switch",
|
|
3
|
+
"version": "0.0.1-beta.12",
|
|
4
|
+
"description": "unstyled switch component for vue",
|
|
5
|
+
"author": "Elone Hoo <elonehoo@gmail.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.mjs",
|
|
11
|
+
"require": "./dist/index.cjs"
|
|
12
|
+
},
|
|
13
|
+
"./resolver": {
|
|
14
|
+
"types": "./dist/resolver.d.ts",
|
|
15
|
+
"import": "./dist/resolver.mjs",
|
|
16
|
+
"require": "./dist/resolver.cjs"
|
|
17
|
+
},
|
|
18
|
+
"./component": {
|
|
19
|
+
"types": "./dist/component.d.ts",
|
|
20
|
+
"import": "./dist/component.mjs",
|
|
21
|
+
"require": "./dist/component.cjs"
|
|
22
|
+
},
|
|
23
|
+
"./*": "./*"
|
|
24
|
+
},
|
|
25
|
+
"main": "dist/index.cjs",
|
|
26
|
+
"module": "dist/index.mjs",
|
|
27
|
+
"types": "dist/index.d.ts",
|
|
28
|
+
"files": [
|
|
29
|
+
"*.d.ts",
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"vue": ">=3.3.4"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@destyler/composition": "0.0.1-beta.12",
|
|
37
|
+
"@destyler/directives": "0.0.1-beta.12",
|
|
38
|
+
"@destyler/shared": "0.0.1-beta.12",
|
|
39
|
+
"@destyler/primitive": "0.0.1-beta.12"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"clear": "rimraf ./dist",
|
|
43
|
+
"build": "pnpm run clear && unbuild"
|
|
44
|
+
}
|
|
45
|
+
}
|