vuetify-swatches 0.3.0 → 0.3.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 -0
- package/dist/components/VSwatches.vue.d.ts +8 -8
- package/dist/components/VSwatches.vue.d.ts.map +1 -1
- package/dist/index.d.ts +0 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +84 -410
- package/dist/index.umd.js +9 -6
- package/dist/style.css +11 -0
- package/package.json +34 -32
- package/src/components/VSwatches.vue +11 -16
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|

|
|
10
10
|
|
|
11
|
+
This branch is for vuetify3. Not usable for production, experimental use only. Bidirectional binding (select swatch button by value) does not work due to a problem on the Vuetify3 side.
|
|
12
|
+
|
|
11
13
|
This project is a remake of [saintplay's vue-swatches](https://saintplay.github.io/vue-swatches/) with [Vuetify](https://vuetifyjs.com/).
|
|
12
14
|
|
|
13
15
|
Unlike the original version, it provides a UI based on Vuetify, such as ripple effects and dark mode.
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { type PropType, type Ref } from 'vue';
|
|
2
2
|
/** Vuetify Swatches */
|
|
3
|
-
declare const _default: import("vue").DefineComponent<{
|
|
3
|
+
declare const _default: import("vue/types/v3-define-component").DefineComponent<{
|
|
4
4
|
/** Model value */
|
|
5
5
|
modelValue: {
|
|
6
6
|
type: StringConstructor;
|
|
7
|
-
|
|
7
|
+
default: string;
|
|
8
8
|
};
|
|
9
9
|
/** Swatch colors */
|
|
10
10
|
swatches: {
|
|
11
11
|
type: PropType<string[] | string[][]>;
|
|
12
|
-
default: () =>
|
|
12
|
+
default: () => string[][];
|
|
13
13
|
};
|
|
14
14
|
/** The size of the shadow of the button */
|
|
15
15
|
elevation: {
|
|
@@ -33,18 +33,17 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
33
33
|
};
|
|
34
34
|
}, {
|
|
35
35
|
checkedVisibilty: Ref<boolean>;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
36
|
+
onSwatchClick: (e: Event) => void;
|
|
37
|
+
}, import("vue").Data, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{
|
|
39
38
|
/** Model value */
|
|
40
39
|
modelValue: {
|
|
41
40
|
type: StringConstructor;
|
|
42
|
-
|
|
41
|
+
default: string;
|
|
43
42
|
};
|
|
44
43
|
/** Swatch colors */
|
|
45
44
|
swatches: {
|
|
46
45
|
type: PropType<string[] | string[][]>;
|
|
47
|
-
default: () =>
|
|
46
|
+
default: () => string[][];
|
|
48
47
|
};
|
|
49
48
|
/** The size of the shadow of the button */
|
|
50
49
|
elevation: {
|
|
@@ -67,6 +66,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
67
66
|
default: string;
|
|
68
67
|
};
|
|
69
68
|
}>>, {
|
|
69
|
+
modelValue: string;
|
|
70
70
|
swatches: string[] | string[][];
|
|
71
71
|
elevation: number;
|
|
72
72
|
size: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VSwatches.vue.d.ts","sourceRoot":"","sources":["../../src/components/VSwatches.vue.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,GAAG,EAET,MAAM,KAAK,CAAC;AAKb,uBAAuB;;
|
|
1
|
+
{"version":3,"file":"VSwatches.vue.d.ts","sourceRoot":"","sources":["../../src/components/VSwatches.vue.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,GAAG,EAET,MAAM,KAAK,CAAC;AAKb,uBAAuB;;IAgBnB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,2CAA2C;;;;;IAE3C,mBAAmB;;;;;IAEnB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;;;uBAmBC,KAAK;;IAvD/B,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,2CAA2C;;;;;IAE3C,mBAAmB;;;;;IAEnB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;;;;;;;;;AAnD7B,wBAmFG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vuetify3 Swatches Component
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @author Logue {@link logue@hotmail.co.jp}
|
|
6
|
-
* @copyright 2022 Masashi Yoshikawa {@link https://logue.dev/} All rights reserved.
|
|
7
|
-
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
8
|
-
*/
|
|
9
1
|
import VSwatches from './components/VSwatches.vue';
|
|
10
2
|
declare const installVSwatches: (app: any) => any;
|
|
11
3
|
export { VSwatches as default, installVSwatches as install };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,4BAA4B,CAAC;AAEnD,QAAA,MAAM,gBAAgB,mBAA+C,CAAC;AAEtE,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,gBAAgB,IAAI,OAAO,EAAE,CAAC"}
|
package/dist/index.es.js
CHANGED
|
@@ -1,364 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
accent4: "#d50000"
|
|
17
|
-
});
|
|
18
|
-
const pink = Object.freeze({
|
|
19
|
-
base: "#e91e63",
|
|
20
|
-
lighten5: "#fce4ec",
|
|
21
|
-
lighten4: "#f8bbd0",
|
|
22
|
-
lighten3: "#f48fb1",
|
|
23
|
-
lighten2: "#f06292",
|
|
24
|
-
lighten1: "#ec407a",
|
|
25
|
-
darken1: "#d81b60",
|
|
26
|
-
darken2: "#c2185b",
|
|
27
|
-
darken3: "#ad1457",
|
|
28
|
-
darken4: "#880e4f",
|
|
29
|
-
accent1: "#ff80ab",
|
|
30
|
-
accent2: "#ff4081",
|
|
31
|
-
accent3: "#f50057",
|
|
32
|
-
accent4: "#c51162"
|
|
33
|
-
});
|
|
34
|
-
const purple = Object.freeze({
|
|
35
|
-
base: "#9c27b0",
|
|
36
|
-
lighten5: "#f3e5f5",
|
|
37
|
-
lighten4: "#e1bee7",
|
|
38
|
-
lighten3: "#ce93d8",
|
|
39
|
-
lighten2: "#ba68c8",
|
|
40
|
-
lighten1: "#ab47bc",
|
|
41
|
-
darken1: "#8e24aa",
|
|
42
|
-
darken2: "#7b1fa2",
|
|
43
|
-
darken3: "#6a1b9a",
|
|
44
|
-
darken4: "#4a148c",
|
|
45
|
-
accent1: "#ea80fc",
|
|
46
|
-
accent2: "#e040fb",
|
|
47
|
-
accent3: "#d500f9",
|
|
48
|
-
accent4: "#aa00ff"
|
|
49
|
-
});
|
|
50
|
-
const deepPurple = Object.freeze({
|
|
51
|
-
base: "#673ab7",
|
|
52
|
-
lighten5: "#ede7f6",
|
|
53
|
-
lighten4: "#d1c4e9",
|
|
54
|
-
lighten3: "#b39ddb",
|
|
55
|
-
lighten2: "#9575cd",
|
|
56
|
-
lighten1: "#7e57c2",
|
|
57
|
-
darken1: "#5e35b1",
|
|
58
|
-
darken2: "#512da8",
|
|
59
|
-
darken3: "#4527a0",
|
|
60
|
-
darken4: "#311b92",
|
|
61
|
-
accent1: "#b388ff",
|
|
62
|
-
accent2: "#7c4dff",
|
|
63
|
-
accent3: "#651fff",
|
|
64
|
-
accent4: "#6200ea"
|
|
65
|
-
});
|
|
66
|
-
const indigo = Object.freeze({
|
|
67
|
-
base: "#3f51b5",
|
|
68
|
-
lighten5: "#e8eaf6",
|
|
69
|
-
lighten4: "#c5cae9",
|
|
70
|
-
lighten3: "#9fa8da",
|
|
71
|
-
lighten2: "#7986cb",
|
|
72
|
-
lighten1: "#5c6bc0",
|
|
73
|
-
darken1: "#3949ab",
|
|
74
|
-
darken2: "#303f9f",
|
|
75
|
-
darken3: "#283593",
|
|
76
|
-
darken4: "#1a237e",
|
|
77
|
-
accent1: "#8c9eff",
|
|
78
|
-
accent2: "#536dfe",
|
|
79
|
-
accent3: "#3d5afe",
|
|
80
|
-
accent4: "#304ffe"
|
|
81
|
-
});
|
|
82
|
-
const blue = Object.freeze({
|
|
83
|
-
base: "#2196f3",
|
|
84
|
-
lighten5: "#e3f2fd",
|
|
85
|
-
lighten4: "#bbdefb",
|
|
86
|
-
lighten3: "#90caf9",
|
|
87
|
-
lighten2: "#64b5f6",
|
|
88
|
-
lighten1: "#42a5f5",
|
|
89
|
-
darken1: "#1e88e5",
|
|
90
|
-
darken2: "#1976d2",
|
|
91
|
-
darken3: "#1565c0",
|
|
92
|
-
darken4: "#0d47a1",
|
|
93
|
-
accent1: "#82b1ff",
|
|
94
|
-
accent2: "#448aff",
|
|
95
|
-
accent3: "#2979ff",
|
|
96
|
-
accent4: "#2962ff"
|
|
97
|
-
});
|
|
98
|
-
const lightBlue = Object.freeze({
|
|
99
|
-
base: "#03a9f4",
|
|
100
|
-
lighten5: "#e1f5fe",
|
|
101
|
-
lighten4: "#b3e5fc",
|
|
102
|
-
lighten3: "#81d4fa",
|
|
103
|
-
lighten2: "#4fc3f7",
|
|
104
|
-
lighten1: "#29b6f6",
|
|
105
|
-
darken1: "#039be5",
|
|
106
|
-
darken2: "#0288d1",
|
|
107
|
-
darken3: "#0277bd",
|
|
108
|
-
darken4: "#01579b",
|
|
109
|
-
accent1: "#80d8ff",
|
|
110
|
-
accent2: "#40c4ff",
|
|
111
|
-
accent3: "#00b0ff",
|
|
112
|
-
accent4: "#0091ea"
|
|
113
|
-
});
|
|
114
|
-
const cyan = Object.freeze({
|
|
115
|
-
base: "#00bcd4",
|
|
116
|
-
lighten5: "#e0f7fa",
|
|
117
|
-
lighten4: "#b2ebf2",
|
|
118
|
-
lighten3: "#80deea",
|
|
119
|
-
lighten2: "#4dd0e1",
|
|
120
|
-
lighten1: "#26c6da",
|
|
121
|
-
darken1: "#00acc1",
|
|
122
|
-
darken2: "#0097a7",
|
|
123
|
-
darken3: "#00838f",
|
|
124
|
-
darken4: "#006064",
|
|
125
|
-
accent1: "#84ffff",
|
|
126
|
-
accent2: "#18ffff",
|
|
127
|
-
accent3: "#00e5ff",
|
|
128
|
-
accent4: "#00b8d4"
|
|
129
|
-
});
|
|
130
|
-
const teal = Object.freeze({
|
|
131
|
-
base: "#009688",
|
|
132
|
-
lighten5: "#e0f2f1",
|
|
133
|
-
lighten4: "#b2dfdb",
|
|
134
|
-
lighten3: "#80cbc4",
|
|
135
|
-
lighten2: "#4db6ac",
|
|
136
|
-
lighten1: "#26a69a",
|
|
137
|
-
darken1: "#00897b",
|
|
138
|
-
darken2: "#00796b",
|
|
139
|
-
darken3: "#00695c",
|
|
140
|
-
darken4: "#004d40",
|
|
141
|
-
accent1: "#a7ffeb",
|
|
142
|
-
accent2: "#64ffda",
|
|
143
|
-
accent3: "#1de9b6",
|
|
144
|
-
accent4: "#00bfa5"
|
|
145
|
-
});
|
|
146
|
-
const green = Object.freeze({
|
|
147
|
-
base: "#4caf50",
|
|
148
|
-
lighten5: "#e8f5e9",
|
|
149
|
-
lighten4: "#c8e6c9",
|
|
150
|
-
lighten3: "#a5d6a7",
|
|
151
|
-
lighten2: "#81c784",
|
|
152
|
-
lighten1: "#66bb6a",
|
|
153
|
-
darken1: "#43a047",
|
|
154
|
-
darken2: "#388e3c",
|
|
155
|
-
darken3: "#2e7d32",
|
|
156
|
-
darken4: "#1b5e20",
|
|
157
|
-
accent1: "#b9f6ca",
|
|
158
|
-
accent2: "#69f0ae",
|
|
159
|
-
accent3: "#00e676",
|
|
160
|
-
accent4: "#00c853"
|
|
161
|
-
});
|
|
162
|
-
const lightGreen = Object.freeze({
|
|
163
|
-
base: "#8bc34a",
|
|
164
|
-
lighten5: "#f1f8e9",
|
|
165
|
-
lighten4: "#dcedc8",
|
|
166
|
-
lighten3: "#c5e1a5",
|
|
167
|
-
lighten2: "#aed581",
|
|
168
|
-
lighten1: "#9ccc65",
|
|
169
|
-
darken1: "#7cb342",
|
|
170
|
-
darken2: "#689f38",
|
|
171
|
-
darken3: "#558b2f",
|
|
172
|
-
darken4: "#33691e",
|
|
173
|
-
accent1: "#ccff90",
|
|
174
|
-
accent2: "#b2ff59",
|
|
175
|
-
accent3: "#76ff03",
|
|
176
|
-
accent4: "#64dd17"
|
|
177
|
-
});
|
|
178
|
-
const lime = Object.freeze({
|
|
179
|
-
base: "#cddc39",
|
|
180
|
-
lighten5: "#f9fbe7",
|
|
181
|
-
lighten4: "#f0f4c3",
|
|
182
|
-
lighten3: "#e6ee9c",
|
|
183
|
-
lighten2: "#dce775",
|
|
184
|
-
lighten1: "#d4e157",
|
|
185
|
-
darken1: "#c0ca33",
|
|
186
|
-
darken2: "#afb42b",
|
|
187
|
-
darken3: "#9e9d24",
|
|
188
|
-
darken4: "#827717",
|
|
189
|
-
accent1: "#f4ff81",
|
|
190
|
-
accent2: "#eeff41",
|
|
191
|
-
accent3: "#c6ff00",
|
|
192
|
-
accent4: "#aeea00"
|
|
193
|
-
});
|
|
194
|
-
const yellow = Object.freeze({
|
|
195
|
-
base: "#ffeb3b",
|
|
196
|
-
lighten5: "#fffde7",
|
|
197
|
-
lighten4: "#fff9c4",
|
|
198
|
-
lighten3: "#fff59d",
|
|
199
|
-
lighten2: "#fff176",
|
|
200
|
-
lighten1: "#ffee58",
|
|
201
|
-
darken1: "#fdd835",
|
|
202
|
-
darken2: "#fbc02d",
|
|
203
|
-
darken3: "#f9a825",
|
|
204
|
-
darken4: "#f57f17",
|
|
205
|
-
accent1: "#ffff8d",
|
|
206
|
-
accent2: "#ffff00",
|
|
207
|
-
accent3: "#ffea00",
|
|
208
|
-
accent4: "#ffd600"
|
|
209
|
-
});
|
|
210
|
-
const amber = Object.freeze({
|
|
211
|
-
base: "#ffc107",
|
|
212
|
-
lighten5: "#fff8e1",
|
|
213
|
-
lighten4: "#ffecb3",
|
|
214
|
-
lighten3: "#ffe082",
|
|
215
|
-
lighten2: "#ffd54f",
|
|
216
|
-
lighten1: "#ffca28",
|
|
217
|
-
darken1: "#ffb300",
|
|
218
|
-
darken2: "#ffa000",
|
|
219
|
-
darken3: "#ff8f00",
|
|
220
|
-
darken4: "#ff6f00",
|
|
221
|
-
accent1: "#ffe57f",
|
|
222
|
-
accent2: "#ffd740",
|
|
223
|
-
accent3: "#ffc400",
|
|
224
|
-
accent4: "#ffab00"
|
|
225
|
-
});
|
|
226
|
-
const orange = Object.freeze({
|
|
227
|
-
base: "#ff9800",
|
|
228
|
-
lighten5: "#fff3e0",
|
|
229
|
-
lighten4: "#ffe0b2",
|
|
230
|
-
lighten3: "#ffcc80",
|
|
231
|
-
lighten2: "#ffb74d",
|
|
232
|
-
lighten1: "#ffa726",
|
|
233
|
-
darken1: "#fb8c00",
|
|
234
|
-
darken2: "#f57c00",
|
|
235
|
-
darken3: "#ef6c00",
|
|
236
|
-
darken4: "#e65100",
|
|
237
|
-
accent1: "#ffd180",
|
|
238
|
-
accent2: "#ffab40",
|
|
239
|
-
accent3: "#ff9100",
|
|
240
|
-
accent4: "#ff6d00"
|
|
241
|
-
});
|
|
242
|
-
const deepOrange = Object.freeze({
|
|
243
|
-
base: "#ff5722",
|
|
244
|
-
lighten5: "#fbe9e7",
|
|
245
|
-
lighten4: "#ffccbc",
|
|
246
|
-
lighten3: "#ffab91",
|
|
247
|
-
lighten2: "#ff8a65",
|
|
248
|
-
lighten1: "#ff7043",
|
|
249
|
-
darken1: "#f4511e",
|
|
250
|
-
darken2: "#e64a19",
|
|
251
|
-
darken3: "#d84315",
|
|
252
|
-
darken4: "#bf360c",
|
|
253
|
-
accent1: "#ff9e80",
|
|
254
|
-
accent2: "#ff6e40",
|
|
255
|
-
accent3: "#ff3d00",
|
|
256
|
-
accent4: "#dd2c00"
|
|
257
|
-
});
|
|
258
|
-
const brown = Object.freeze({
|
|
259
|
-
base: "#795548",
|
|
260
|
-
lighten5: "#efebe9",
|
|
261
|
-
lighten4: "#d7ccc8",
|
|
262
|
-
lighten3: "#bcaaa4",
|
|
263
|
-
lighten2: "#a1887f",
|
|
264
|
-
lighten1: "#8d6e63",
|
|
265
|
-
darken1: "#6d4c41",
|
|
266
|
-
darken2: "#5d4037",
|
|
267
|
-
darken3: "#4e342e",
|
|
268
|
-
darken4: "#3e2723"
|
|
269
|
-
});
|
|
270
|
-
const blueGrey = Object.freeze({
|
|
271
|
-
base: "#607d8b",
|
|
272
|
-
lighten5: "#eceff1",
|
|
273
|
-
lighten4: "#cfd8dc",
|
|
274
|
-
lighten3: "#b0bec5",
|
|
275
|
-
lighten2: "#90a4ae",
|
|
276
|
-
lighten1: "#78909c",
|
|
277
|
-
darken1: "#546e7a",
|
|
278
|
-
darken2: "#455a64",
|
|
279
|
-
darken3: "#37474f",
|
|
280
|
-
darken4: "#263238"
|
|
281
|
-
});
|
|
282
|
-
const grey = Object.freeze({
|
|
283
|
-
base: "#9e9e9e",
|
|
284
|
-
lighten5: "#fafafa",
|
|
285
|
-
lighten4: "#f5f5f5",
|
|
286
|
-
lighten3: "#eeeeee",
|
|
287
|
-
lighten2: "#e0e0e0",
|
|
288
|
-
lighten1: "#bdbdbd",
|
|
289
|
-
darken1: "#757575",
|
|
290
|
-
darken2: "#616161",
|
|
291
|
-
darken3: "#424242",
|
|
292
|
-
darken4: "#212121"
|
|
293
|
-
});
|
|
294
|
-
const shades = Object.freeze({
|
|
295
|
-
black: "#000000",
|
|
296
|
-
white: "#ffffff",
|
|
297
|
-
transparent: "transparent"
|
|
298
|
-
});
|
|
299
|
-
var colors = Object.freeze({
|
|
300
|
-
red,
|
|
301
|
-
pink,
|
|
302
|
-
purple,
|
|
303
|
-
deepPurple,
|
|
304
|
-
indigo,
|
|
305
|
-
blue,
|
|
306
|
-
lightBlue,
|
|
307
|
-
cyan,
|
|
308
|
-
teal,
|
|
309
|
-
green,
|
|
310
|
-
lightGreen,
|
|
311
|
-
lime,
|
|
312
|
-
yellow,
|
|
313
|
-
amber,
|
|
314
|
-
orange,
|
|
315
|
-
deepOrange,
|
|
316
|
-
brown,
|
|
317
|
-
blueGrey,
|
|
318
|
-
grey,
|
|
319
|
-
shades
|
|
320
|
-
});
|
|
321
|
-
var VSwatches_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => ".v-swatches .v-btn{padding:0!important;margin:.1rem}.v-swatches .v-btn .v-icon{filter:invert(100%)}\n")();
|
|
322
|
-
var _export_sfc = (sfc, props) => {
|
|
323
|
-
const target = sfc.__vccOpts || sfc;
|
|
324
|
-
for (const [key, val] of props) {
|
|
325
|
-
target[key] = val;
|
|
326
|
-
}
|
|
327
|
-
return target;
|
|
328
|
-
};
|
|
329
|
-
const _sfc_main = defineComponent({
|
|
1
|
+
/**
|
|
2
|
+
* vuetify-swatches
|
|
3
|
+
*
|
|
4
|
+
* @description Color Swatch component for Vuetify.
|
|
5
|
+
* @author Logue <logue@hotmail.co.jp>
|
|
6
|
+
* @copyright 2022 By Masashi Yoshikawa All rights reserved.
|
|
7
|
+
* @license MIT
|
|
8
|
+
* @version 0.0.11
|
|
9
|
+
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { defineComponent as b, ref as v } from "vue";
|
|
13
|
+
import { VSheet as w, VBtn as V, VIcon as y } from "vuetify/lib/components";
|
|
14
|
+
import e from "vuetify/lib/util/colors";
|
|
15
|
+
const S = b({
|
|
330
16
|
name: "VSwatches",
|
|
17
|
+
components: {
|
|
18
|
+
VSheet: w,
|
|
19
|
+
VBtn: V,
|
|
20
|
+
VIcon: y
|
|
21
|
+
},
|
|
331
22
|
model: {
|
|
332
23
|
prop: "modelValue",
|
|
333
24
|
event: "update:modelValue"
|
|
334
25
|
},
|
|
335
26
|
props: {
|
|
336
|
-
modelValue: { type: String,
|
|
27
|
+
modelValue: { type: String, default: "#ffffff" },
|
|
337
28
|
swatches: {
|
|
338
29
|
type: Array,
|
|
339
30
|
default: () => [
|
|
340
|
-
[
|
|
31
|
+
[e.shades.black, e.shades.white],
|
|
341
32
|
[
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
33
|
+
e.red.base,
|
|
34
|
+
e.pink.base,
|
|
35
|
+
e.purple.base,
|
|
36
|
+
e.deepPurple.base,
|
|
37
|
+
e.indigo.base,
|
|
38
|
+
e.blue.base,
|
|
39
|
+
e.lightBlue.base,
|
|
40
|
+
e.cyan.base
|
|
350
41
|
],
|
|
351
42
|
[
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
43
|
+
e.teal.base,
|
|
44
|
+
e.green.base,
|
|
45
|
+
e.lightGreen.base,
|
|
46
|
+
e.lime.base,
|
|
47
|
+
e.yellow.base,
|
|
48
|
+
e.amber.base,
|
|
49
|
+
e.orange.base,
|
|
50
|
+
e.deepOrange.base
|
|
360
51
|
],
|
|
361
|
-
[
|
|
52
|
+
[e.brown.base, e.blueGrey.base, e.grey.base]
|
|
362
53
|
]
|
|
363
54
|
},
|
|
364
55
|
elevation: { type: Number, default: 1 },
|
|
@@ -367,70 +58,53 @@ const _sfc_main = defineComponent({
|
|
|
367
58
|
iconSize: { type: String, default: "1rem" }
|
|
368
59
|
},
|
|
369
60
|
emits: ["update:modelValue"],
|
|
370
|
-
setup(
|
|
371
|
-
const checkedVisibilty = ref(false);
|
|
372
|
-
const selected = ref(props.modelValue);
|
|
373
|
-
const onSwatchClick = (value) => {
|
|
374
|
-
if (!value || selected.value === value) {
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
|
-
selected.value = value;
|
|
378
|
-
context.emit("update:modelValue", value);
|
|
379
|
-
};
|
|
61
|
+
setup(s, t) {
|
|
380
62
|
return {
|
|
381
|
-
checkedVisibilty,
|
|
382
|
-
|
|
383
|
-
|
|
63
|
+
checkedVisibilty: v(!1),
|
|
64
|
+
onSwatchClick: (i) => {
|
|
65
|
+
const a = i.target.value;
|
|
66
|
+
!a || s.modelValue === a || t.emit("update:modelValue", a);
|
|
67
|
+
}
|
|
384
68
|
};
|
|
385
69
|
}
|
|
386
70
|
});
|
|
387
|
-
function
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
}, {
|
|
411
|
-
default: withCtx(() => [
|
|
412
|
-
createTextVNode(toDisplayString(_ctx.icon), 1)
|
|
413
|
-
]),
|
|
414
|
-
_: 2
|
|
415
|
-
}, 1032, ["size", "color"])) : createCommentVNode("", true)
|
|
416
|
-
]),
|
|
417
|
-
_: 2
|
|
418
|
-
}, 1032, ["elevation", "width", "height", "color", "onClick"]);
|
|
419
|
-
}), 128))
|
|
420
|
-
]);
|
|
421
|
-
}), 128))
|
|
422
|
-
]),
|
|
423
|
-
_: 1
|
|
424
|
-
});
|
|
71
|
+
function g(s, t, l, u, i, a, d, p) {
|
|
72
|
+
var n = typeof s == "function" ? s.options : s;
|
|
73
|
+
t && (n.render = t, n.staticRenderFns = l, n._compiled = !0), u && (n.functional = !0), a && (n._scopeId = "data-v-" + a);
|
|
74
|
+
var r;
|
|
75
|
+
if (d ? (r = function(o) {
|
|
76
|
+
o = o || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !o && typeof __VUE_SSR_CONTEXT__ < "u" && (o = __VUE_SSR_CONTEXT__), i && i.call(this, o), o && o._registeredComponents && o._registeredComponents.add(d);
|
|
77
|
+
}, n._ssrRegister = r) : i && (r = p ? function() {
|
|
78
|
+
i.call(this, (n.functional ? this.parent : this).$root.$options.shadowRoot);
|
|
79
|
+
} : i), r)
|
|
80
|
+
if (n.functional) {
|
|
81
|
+
n._injectStyles = r;
|
|
82
|
+
var h = n.render;
|
|
83
|
+
n.render = function(m, c) {
|
|
84
|
+
return r.call(c), h(m, c);
|
|
85
|
+
};
|
|
86
|
+
} else {
|
|
87
|
+
var f = n.beforeCreate;
|
|
88
|
+
n.beforeCreate = f ? [].concat(f, r) : [r];
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
exports: s,
|
|
92
|
+
options: n
|
|
93
|
+
};
|
|
425
94
|
}
|
|
426
|
-
var
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
95
|
+
var C = function() {
|
|
96
|
+
var t = this, l = t._self._c;
|
|
97
|
+
return t._self._setupProxy, l("v-sheet", { staticClass: "v-swatches" }, t._l(t.swatches, function(u, i) {
|
|
98
|
+
return l("div", { key: i }, t._l(u, function(a) {
|
|
99
|
+
return l("v-btn", { key: a, attrs: { elevation: t.elevation, width: t.size, height: t.size, color: a, value: a, "min-width": "auto" }, on: { click: function(d) {
|
|
100
|
+
return t.onSwatchClick(d);
|
|
101
|
+
} } }, [a === t.modelValue ? l("v-icon", { attrs: { size: t.iconSize, color: a } }, [t._v(" " + t._s(t.icon) + " ")]) : t._e()], 1);
|
|
102
|
+
}), 1);
|
|
103
|
+
}), 0);
|
|
104
|
+
}, k = [], z = /* @__PURE__ */ g(S, C, k, !1, null, null, null, null);
|
|
105
|
+
const _ = z.exports, N = (s) => s.component("VSwatches", _);
|
|
106
|
+
typeof window < "u" && window.Vue && window.Vue.use(_);
|
|
107
|
+
export {
|
|
108
|
+
_ as default,
|
|
109
|
+
N as install
|
|
110
|
+
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Vuetify3 Swatches Component
|
|
1
|
+
/**
|
|
2
|
+
* vuetify-swatches
|
|
4
3
|
*
|
|
4
|
+
* @description Color Swatch component for Vuetify.
|
|
5
|
+
* @author Logue <logue@hotmail.co.jp>
|
|
6
|
+
* @copyright 2022 By Masashi Yoshikawa All rights reserved.
|
|
5
7
|
* @license MIT
|
|
6
|
-
* @
|
|
7
|
-
* @copyright 2022 Masashi Yoshikawa {@link https://logue.dev/} All rights reserved.
|
|
8
|
+
* @version 0.0.11
|
|
8
9
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
9
|
-
*/
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
(function(l,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue"),require("vuetify/lib/components"),require("vuetify/lib/util/colors")):typeof define=="function"&&define.amd?define(["exports","vue","vuetify/lib/components","vuetify/lib/util/colors"],r):(l=typeof globalThis<"u"?globalThis:l||self,r(l.VSwatches={},l.Vue,l.Vuetify,l.colors))})(this,function(l,r,_,v){"use strict";const e=(n=>n&&typeof n=="object"&&"default"in n?n:{default:n})(v),m=r.defineComponent({name:"VSwatches",components:{VSheet:_.VSheet,VBtn:_.VBtn,VIcon:_.VIcon},model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:String,default:"#ffffff"},swatches:{type:Array,default:()=>[[e.default.shades.black,e.default.shades.white],[e.default.red.base,e.default.pink.base,e.default.purple.base,e.default.deepPurple.base,e.default.indigo.base,e.default.blue.base,e.default.lightBlue.base,e.default.cyan.base],[e.default.teal.base,e.default.green.base,e.default.lightGreen.base,e.default.lime.base,e.default.yellow.base,e.default.amber.base,e.default.orange.base,e.default.deepOrange.base],[e.default.brown.base,e.default.blueGrey.base,e.default.grey.base]]},elevation:{type:Number,default:1},size:{type:String,default:"2rem"},icon:{type:String,default:"mdi-checkbox-marked-circle"},iconSize:{type:String,default:"1rem"}},emits:["update:modelValue"],setup(n,t){return{checkedVisibilty:r.ref(!1),onSwatchClick:u=>{const i=u.target.value;!i||n.modelValue===i||t.emit("update:modelValue",i)}}}}),R="";function y(n,t,f,d,u,i,c,C){var a=typeof n=="function"?n.options:n;t&&(a.render=t,a.staticRenderFns=f,a._compiled=!0),d&&(a.functional=!0),i&&(a._scopeId="data-v-"+i);var o;if(c?(o=function(s){s=s||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!s&&typeof __VUE_SSR_CONTEXT__<"u"&&(s=__VUE_SSR_CONTEXT__),u&&u.call(this,s),s&&s._registeredComponents&&s._registeredComponents.add(c)},a._ssrRegister=o):u&&(o=C?function(){u.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:u),o)if(a.functional){a._injectStyles=o;var k=a.render;a.render=function(z,b){return o.call(b),k(z,b)}}else{var h=a.beforeCreate;a.beforeCreate=h?[].concat(h,o):[o]}return{exports:n,options:a}}var V=function(){var t=this,f=t._self._c;return t._self._setupProxy,f("v-sheet",{staticClass:"v-swatches"},t._l(t.swatches,function(d,u){return f("div",{key:u},t._l(d,function(i){return f("v-btn",{key:i,attrs:{elevation:t.elevation,width:t.size,height:t.size,color:i,value:i,"min-width":"auto"},on:{click:function(c){return t.onSwatchClick(c)}}},[i===t.modelValue?f("v-icon",{attrs:{size:t.iconSize,color:i}},[t._v(" "+t._s(t.icon)+" ")]):t._e()],1)}),1)}),0)},w=[],S=y(m,V,w,!1,null,null,null,null);const p=S.exports,g=n=>n.component("VSwatches",p);typeof window<"u"&&window.Vue&&window.Vue.use(p),l.default=p,l.install=g,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vuetify-swatches
|
|
3
|
+
*
|
|
4
|
+
* @description Color Swatch component for Vuetify.
|
|
5
|
+
* @author Logue <logue@hotmail.co.jp>
|
|
6
|
+
* @copyright 2022 By Masashi Yoshikawa All rights reserved.
|
|
7
|
+
* @license MIT
|
|
8
|
+
* @version 0.0.11
|
|
9
|
+
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
|
+
*/
|
|
11
|
+
|
|
1
12
|
.v-swatches .v-btn{padding:0!important;margin:.1rem}.v-swatches .v-btn .v-icon{filter:invert(100%)}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "vuetify-swatches",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.1",
|
|
5
5
|
"description": "Color Swatch component for Vuetify3.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"vuejs",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"vuetify3",
|
|
18
18
|
"vuetify-components"
|
|
19
19
|
],
|
|
20
|
+
"license": "MIT",
|
|
20
21
|
"author": {
|
|
21
22
|
"name": "Logue",
|
|
22
23
|
"email": "logue@hotmail.co.jp",
|
|
@@ -30,14 +31,10 @@
|
|
|
30
31
|
"bugs": {
|
|
31
32
|
"url": "https://github.com/logue/vuetify-swatches/issues"
|
|
32
33
|
},
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"packageManager": "yarn@3.2.1",
|
|
38
|
-
"license": "MIT",
|
|
39
|
-
"main": "./dist/index.umd.js",
|
|
40
|
-
"module": "./dist/index.es.js",
|
|
34
|
+
"main": "dist/index.umd.js",
|
|
35
|
+
"module": "dist/index.es.js",
|
|
36
|
+
"types": "dist/index.d.ts",
|
|
37
|
+
"style": "dist/style.css",
|
|
41
38
|
"browser": {
|
|
42
39
|
"./sfc": "./src/components/VSwatches.vue"
|
|
43
40
|
},
|
|
@@ -51,11 +48,15 @@
|
|
|
51
48
|
"require": "./dist/style.css"
|
|
52
49
|
}
|
|
53
50
|
},
|
|
54
|
-
"types": "./dist/index.d.ts",
|
|
55
51
|
"files": [
|
|
56
52
|
"dist",
|
|
57
53
|
"src/components/VSwatches.vue"
|
|
58
54
|
],
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=16.15.0",
|
|
57
|
+
"yarn": ">=1.22.4"
|
|
58
|
+
},
|
|
59
|
+
"packageManager": "yarn@3.2.1",
|
|
59
60
|
"sideEffects": false,
|
|
60
61
|
"scripts": {
|
|
61
62
|
"dev": "vite",
|
|
@@ -72,53 +73,54 @@
|
|
|
72
73
|
},
|
|
73
74
|
"peerDependencies": {
|
|
74
75
|
"vue": "^3.2.37",
|
|
75
|
-
"vuetify": "^3.0.0-beta.
|
|
76
|
+
"vuetify": "^3.0.0-beta.6"
|
|
76
77
|
},
|
|
77
78
|
"devDependencies": {
|
|
78
79
|
"@codemirror/lang-html": "^6.1.0",
|
|
79
|
-
"@
|
|
80
|
-
"@
|
|
81
|
-
"@
|
|
82
|
-
"@
|
|
83
|
-
"@
|
|
84
|
-
"
|
|
85
|
-
"eslint": "^8.
|
|
80
|
+
"@types/node": "^18.6.3",
|
|
81
|
+
"@typescript-eslint/eslint-plugin": "^5.32.0",
|
|
82
|
+
"@typescript-eslint/parser": "^5.32.0",
|
|
83
|
+
"@vitejs/plugin-vue": "^3.0.1",
|
|
84
|
+
"@vue/tsconfig": "^0.1.3",
|
|
85
|
+
"codemirror": "^6.0.1",
|
|
86
|
+
"eslint": "^8.21.0",
|
|
86
87
|
"eslint-config-google": "^0.14.0",
|
|
87
88
|
"eslint-config-prettier": "^8.5.0",
|
|
88
89
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
89
|
-
"eslint-import-resolver-typescript": "^3.
|
|
90
|
+
"eslint-import-resolver-typescript": "^3.4.0",
|
|
90
91
|
"eslint-plugin-import": "^2.26.0",
|
|
91
|
-
"eslint-plugin-jsdoc": "^39.3.
|
|
92
|
+
"eslint-plugin-jsdoc": "^39.3.4",
|
|
92
93
|
"eslint-plugin-tsdoc": "^0.2.16",
|
|
93
|
-
"eslint-plugin-vue": "^9.
|
|
94
|
+
"eslint-plugin-vue": "^9.3.0",
|
|
94
95
|
"eslint-plugin-vuejs-accessibility": "^1.2.0",
|
|
95
96
|
"eslint-plugin-vuetify": "^1.1.0",
|
|
96
97
|
"eslint-plugin-yaml": "^0.5.0",
|
|
97
98
|
"husky": "^8.0.1",
|
|
98
99
|
"lint-staged": "^13.0.3",
|
|
99
|
-
"postcss-html": "^1.
|
|
100
|
+
"postcss-html": "^1.5.0",
|
|
100
101
|
"prettier": "^2.7.1",
|
|
101
102
|
"prettier-plugin-jsdoc": "^0.3.38",
|
|
102
|
-
"prettier-plugin-md-nocjsp": "^1.
|
|
103
|
+
"prettier-plugin-md-nocjsp": "^1.3.0",
|
|
103
104
|
"prettier-plugin-sort-imports": "^1.7.0",
|
|
104
105
|
"rimraf": "^3.0.2",
|
|
105
|
-
"rollup-plugin-visualizer": "^5.
|
|
106
|
-
"sass": "1.
|
|
106
|
+
"rollup-plugin-visualizer": "^5.7.1",
|
|
107
|
+
"sass": "1.54.0",
|
|
107
108
|
"stylelint": "^14.9.1",
|
|
108
109
|
"stylelint-config-prettier": "^9.0.3",
|
|
109
|
-
"stylelint-config-recommended-scss": "^
|
|
110
|
+
"stylelint-config-recommended-scss": "^7.0.0",
|
|
110
111
|
"stylelint-config-recommended-vue": "^1.4.0",
|
|
111
112
|
"stylelint-order": "^5.0.0",
|
|
112
113
|
"stylelint-prettier": "^2.0.0",
|
|
113
114
|
"typescript": "^4.7.4",
|
|
114
|
-
"vite": "^
|
|
115
|
-
"vite-plugin-
|
|
116
|
-
"vite-plugin-
|
|
115
|
+
"vite": "^3.0.4",
|
|
116
|
+
"vite-plugin-banner": "^0.3.0",
|
|
117
|
+
"vite-plugin-checker": "^0.4.9",
|
|
118
|
+
"vite-plugin-vuetify": "^1.0.0-alpha.14",
|
|
117
119
|
"vue": "^3.2.37",
|
|
118
|
-
"vue-codemirror6": "0.6.
|
|
120
|
+
"vue-codemirror6": "0.6.8",
|
|
119
121
|
"vue-eslint-parser": "^9.0.3",
|
|
120
|
-
"vue-tsc": "^0.
|
|
121
|
-
"vuetify": "^3.0.0-beta.
|
|
122
|
+
"vue-tsc": "^0.39.4",
|
|
123
|
+
"vuetify": "^3.0.0-beta.6"
|
|
122
124
|
},
|
|
123
125
|
"husky": {
|
|
124
126
|
"hooks": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-sheet class="v-swatches">
|
|
3
|
-
<div v-for="(colors, rows) in swatches" :key="rows">
|
|
3
|
+
<div v-for="(colors, rows) in swatches" :key="rows" class="d-flex">
|
|
4
4
|
<v-btn
|
|
5
5
|
v-for="color in colors"
|
|
6
6
|
:key="color"
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
:width="size"
|
|
9
9
|
:height="size"
|
|
10
10
|
:color="color"
|
|
11
|
+
:data-value="color"
|
|
11
12
|
min-width="auto"
|
|
12
|
-
@click="onSwatchClick(
|
|
13
|
+
@click="onSwatchClick($event)"
|
|
13
14
|
>
|
|
14
|
-
<v-icon v-if="color ===
|
|
15
|
+
<v-icon v-if="color === modelValue" :size="iconSize" :color="color">
|
|
15
16
|
{{ icon }}
|
|
16
17
|
</v-icon>
|
|
17
18
|
</v-btn>
|
|
@@ -42,7 +43,7 @@ export default defineComponent({
|
|
|
42
43
|
},
|
|
43
44
|
props: {
|
|
44
45
|
/** Model value */
|
|
45
|
-
modelValue: { type: String,
|
|
46
|
+
modelValue: { type: String, default: '#ffffff' },
|
|
46
47
|
/** Swatch colors */
|
|
47
48
|
swatches: {
|
|
48
49
|
type: Array as PropType<string[] | string[][]>,
|
|
@@ -88,28 +89,22 @@ export default defineComponent({
|
|
|
88
89
|
* @param context - Context
|
|
89
90
|
*/
|
|
90
91
|
setup(props, context: SetupContext) {
|
|
91
|
-
/**
|
|
92
|
+
/** Check icon visibility */
|
|
92
93
|
const checkedVisibilty: Ref<boolean> = ref(false);
|
|
93
|
-
|
|
94
|
-
/** Selected color */
|
|
95
|
-
const selected: Ref<string> = ref(props.modelValue);
|
|
96
|
-
|
|
97
94
|
/**
|
|
98
95
|
* ボタンがクリックされた
|
|
99
96
|
*
|
|
100
|
-
* @param
|
|
97
|
+
* @param e - イベント
|
|
101
98
|
*/
|
|
102
|
-
const onSwatchClick = (
|
|
103
|
-
|
|
99
|
+
const onSwatchClick = (e: Event) => {
|
|
100
|
+
const value = (e.target as HTMLButtonElement).dataset.value;
|
|
101
|
+
if (!value || props.modelValue === value) {
|
|
104
102
|
return;
|
|
105
103
|
}
|
|
106
|
-
selected.value = value;
|
|
107
104
|
context.emit('update:modelValue', value);
|
|
108
105
|
};
|
|
109
|
-
|
|
110
106
|
return {
|
|
111
107
|
checkedVisibilty,
|
|
112
|
-
selected,
|
|
113
108
|
onSwatchClick,
|
|
114
109
|
};
|
|
115
110
|
},
|
|
@@ -123,7 +118,7 @@ export default defineComponent({
|
|
|
123
118
|
margin: 0.1rem;
|
|
124
119
|
|
|
125
120
|
.v-icon {
|
|
126
|
-
filter: invert(100%);
|
|
121
|
+
filter: invert(100%) grayscale(100%) contrast(100);
|
|
127
122
|
}
|
|
128
123
|
}
|
|
129
124
|
}
|