vuetify-swatches 0.0.8 → 0.3.0

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.
@@ -1,10 +1,6 @@
1
- import { type PropType, type Ref } from 'vue-demi';
1
+ import { type PropType, type Ref } from 'vue';
2
2
  /** Vuetify Swatches */
3
- declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
4
- checkedVisibilty: Ref<boolean>;
5
- selected: Ref<string>;
6
- onSwatchClick: (e: Event) => void;
7
- }> & import("@vue/composition-api").Data, {}, {}, {
3
+ declare const _default: import("vue").DefineComponent<{
8
4
  /** Model value */
9
5
  modelValue: {
10
6
  type: StringConstructor;
@@ -13,7 +9,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
13
9
  /** Swatch colors */
14
10
  swatches: {
15
11
  type: PropType<string[] | string[][]>;
16
- default: () => string[][];
12
+ default: () => any[][];
17
13
  };
18
14
  /** The size of the shadow of the button */
19
15
  elevation: {
@@ -35,7 +31,11 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
35
31
  type: StringConstructor;
36
32
  default: string;
37
33
  };
38
- }, import("@vue/composition-api").ExtractPropTypes<{
34
+ }, {
35
+ checkedVisibilty: Ref<boolean>;
36
+ selected: Ref<string>;
37
+ onSwatchClick: (value: string) => void;
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<{
39
39
  /** Model value */
40
40
  modelValue: {
41
41
  type: StringConstructor;
@@ -44,7 +44,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
44
44
  /** Swatch colors */
45
45
  swatches: {
46
46
  type: PropType<string[] | string[][]>;
47
- default: () => string[][];
47
+ default: () => any[][];
48
48
  };
49
49
  /** The size of the shadow of the button */
50
50
  elevation: {
@@ -66,30 +66,12 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
66
66
  type: StringConstructor;
67
67
  default: string;
68
68
  };
69
- }>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
70
- modelValue: string;
71
- swatches: string[] | string[][];
72
- elevation: number;
73
- size: string;
74
- icon: string;
75
- iconSize: string;
76
- } & {}, import("@vue/composition-api").ShallowUnwrapRef<{
77
- checkedVisibilty: Ref<boolean>;
78
- selected: Ref<string>;
79
- onSwatchClick: (e: Event) => void;
80
- }>, import("@vue/composition-api").Data, {}, {}, {}, {}, {}, {
81
- modelValue: string;
82
- swatches: string[] | string[][];
83
- elevation: number;
84
- size: string;
85
- icon: string;
86
- iconSize: string;
87
- } & {}, {
69
+ }>>, {
88
70
  swatches: string[] | string[][];
89
71
  elevation: number;
90
72
  size: string;
91
73
  icon: string;
92
74
  iconSize: string;
93
- }, true>);
75
+ }>;
94
76
  export default _default;
95
77
  //# sourceMappingURL=VSwatches.vue.d.ts.map
@@ -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,UAAU,CAAC;AAKlB,uBAAuB;;;;uBA0EO,KAAK;;IA1D/B,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,2CAA2C;;;;;IAE3C,mBAAmB;;;;;IAEnB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;;IApCzB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,2CAA2C;;;;;IAE3C,mBAAmB;;;;;IAEnB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;;;;;;;;;;;uBAsBC,KAAK;;;;;;;;;;;;;;;AAzEnC,wBAwFG"}
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;;IAUnB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,2CAA2C;;;;;IAE3C,mBAAmB;;;;;IAEnB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;;;;2BAsBK,MAAM;;IA1DpC,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,2CAA2C;;;;;IAE3C,mBAAmB;;;;;IAEnB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;;;;;;;;AA7C7B,wBAiFG"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Vuetify Swatches Component
2
+ * Vuetify3 Swatches Component
3
3
  *
4
4
  * @license MIT
5
5
  * @author Logue {@link logue@hotmail.co.jp}
package/dist/index.es.js CHANGED
@@ -1,13 +1,333 @@
1
- import { defineComponent, ref } from "vue-demi";
2
- import { VSheet, VBtn, VIcon } from "vuetify/lib";
3
- import colors from "vuetify/lib/util/colors";
4
- var __vue2_script = defineComponent({
1
+ import { defineComponent, ref, resolveComponent, openBlock, createBlock, withCtx, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, createCommentVNode } from "vue";
2
+ const red = Object.freeze({
3
+ base: "#f44336",
4
+ lighten5: "#ffebee",
5
+ lighten4: "#ffcdd2",
6
+ lighten3: "#ef9a9a",
7
+ lighten2: "#e57373",
8
+ lighten1: "#ef5350",
9
+ darken1: "#e53935",
10
+ darken2: "#d32f2f",
11
+ darken3: "#c62828",
12
+ darken4: "#b71c1c",
13
+ accent1: "#ff8a80",
14
+ accent2: "#ff5252",
15
+ accent3: "#ff1744",
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({
5
330
  name: "VSwatches",
6
- components: {
7
- VSheet,
8
- VBtn,
9
- VIcon
10
- },
11
331
  model: {
12
332
  prop: "modelValue",
13
333
  event: "update:modelValue"
@@ -50,8 +370,7 @@ var __vue2_script = defineComponent({
50
370
  setup(props, context) {
51
371
  const checkedVisibilty = ref(false);
52
372
  const selected = ref(props.modelValue);
53
- const onSwatchClick = (e) => {
54
- const value = e.target.value;
373
+ const onSwatchClick = (value) => {
55
374
  if (!value || selected.value === value) {
56
375
  return;
57
376
  }
@@ -65,103 +384,48 @@ var __vue2_script = defineComponent({
65
384
  };
66
385
  }
67
386
  });
68
- var render = function() {
69
- var _vm = this;
70
- var _h = _vm.$createElement;
71
- var _c = _vm._self._c || _h;
72
- return _c(VSheet, {
73
- staticClass: "v-swatches"
74
- }, _vm._l(_vm.swatches, function(colors2, rows) {
75
- return _c("div", {
76
- key: rows
77
- }, _vm._l(colors2, function(color) {
78
- return _c(VBtn, {
79
- key: color,
80
- attrs: {
81
- "elevation": _vm.elevation,
82
- "width": _vm.size,
83
- "height": _vm.size,
84
- "color": color,
85
- "value": color,
86
- "min-width": "auto"
87
- },
88
- on: {
89
- "click": _vm.onSwatchClick
90
- }
91
- }, [color === _vm.selected ? _c(VIcon, {
92
- attrs: {
93
- "size": _vm.iconSize,
94
- "color": color
95
- }
96
- }, [_vm._v(" " + _vm._s(_vm.icon) + " ")]) : _vm._e()], 1);
97
- }), 1);
98
- }), 0);
99
- };
100
- var staticRenderFns = [];
101
- var VSwatches_vue_vue_type_style_index_0_lang = "";
102
- function normalizeComponent(scriptExports, render2, staticRenderFns2, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
103
- var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
104
- if (render2) {
105
- options.render = render2;
106
- options.staticRenderFns = staticRenderFns2;
107
- options._compiled = true;
108
- }
109
- if (functionalTemplate) {
110
- options.functional = true;
111
- }
112
- if (scopeId) {
113
- options._scopeId = "data-v-" + scopeId;
114
- }
115
- var hook;
116
- if (moduleIdentifier) {
117
- hook = function(context) {
118
- context = context || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
119
- if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
120
- context = __VUE_SSR_CONTEXT__;
121
- }
122
- if (injectStyles) {
123
- injectStyles.call(this, context);
124
- }
125
- if (context && context._registeredComponents) {
126
- context._registeredComponents.add(moduleIdentifier);
127
- }
128
- };
129
- options._ssrRegister = hook;
130
- } else if (injectStyles) {
131
- hook = shadowMode ? function() {
132
- injectStyles.call(this, (options.functional ? this.parent : this).$root.$options.shadowRoot);
133
- } : injectStyles;
134
- }
135
- if (hook) {
136
- if (options.functional) {
137
- options._injectStyles = hook;
138
- var originalRender = options.render;
139
- options.render = function renderWithStyleInjection(h, context) {
140
- hook.call(context);
141
- return originalRender(h, context);
142
- };
143
- } else {
144
- var existing = options.beforeCreate;
145
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
146
- }
147
- }
148
- return {
149
- exports: scriptExports,
150
- options
151
- };
152
- }
153
- const __cssModules = {};
154
- var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles, null, null, null);
155
- function __vue2_injectStyles(context) {
156
- for (let o in __cssModules) {
157
- this[o] = __cssModules[o];
158
- }
387
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
388
+ const _component_v_icon = resolveComponent("v-icon");
389
+ const _component_v_btn = resolveComponent("v-btn");
390
+ const _component_v_sheet = resolveComponent("v-sheet");
391
+ return openBlock(), createBlock(_component_v_sheet, { class: "v-swatches" }, {
392
+ default: withCtx(() => [
393
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.swatches, (colors2, rows) => {
394
+ return openBlock(), createElementBlock("div", { key: rows }, [
395
+ (openBlock(true), createElementBlock(Fragment, null, renderList(colors2, (color) => {
396
+ return openBlock(), createBlock(_component_v_btn, {
397
+ key: color,
398
+ elevation: _ctx.elevation,
399
+ width: _ctx.size,
400
+ height: _ctx.size,
401
+ color,
402
+ "min-width": "auto",
403
+ onClick: ($event) => _ctx.onSwatchClick(color)
404
+ }, {
405
+ default: withCtx(() => [
406
+ color === _ctx.selected ? (openBlock(), createBlock(_component_v_icon, {
407
+ key: 0,
408
+ size: _ctx.iconSize,
409
+ color
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
+ });
159
425
  }
160
- var VSwatches = /* @__PURE__ */ function() {
161
- return __component__.exports;
162
- }();
426
+ var VSwatches = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
163
427
  /**
164
- * Vuetify Swatches Component
428
+ * Vuetify3 Swatches Component
165
429
  *
166
430
  * @license MIT
167
431
  * @author Logue {@link logue@hotmail.co.jp}
package/dist/index.umd.js CHANGED
@@ -1,8 +1,9 @@
1
- (function(n,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("vue-demi"),require("vuetify/lib"),require("vuetify/lib/util/colors")):typeof define=="function"&&define.amd?define(["exports","vue-demi","vuetify/lib","vuetify/lib/util/colors"],d):(n=typeof globalThis<"u"?globalThis:n||self,d(n.VSwatches={},n.VueDemi,n.Vuetify,n.colors))})(this,function(n,d,_,b){"use strict";function y(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var t=y(b),V=d.defineComponent({name:"VSwatches",components:{VSheet:_.VSheet,VBtn:_.VBtn,VIcon:_.VIcon},model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:String,required:!0},swatches:{type:Array,default:()=>[[t.default.shades.black,t.default.shades.white],[t.default.red.base,t.default.pink.base,t.default.purple.base,t.default.deepPurple.base,t.default.indigo.base,t.default.blue.base,t.default.lightBlue.base,t.default.cyan.base],[t.default.teal.base,t.default.green.base,t.default.lightGreen.base,t.default.lime.base,t.default.yellow.base,t.default.amber.base,t.default.orange.base,t.default.deepOrange.base],[t.default.brown.base,t.default.blueGrey.base,t.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(e,u){const s=d.ref(!1),f=d.ref(e.modelValue);return{checkedVisibilty:s,selected:f,onSwatchClick:i=>{const c=i.target.value;!c||f.value===c||(f.value=c,u.emit("update:modelValue",c))}}}}),S=function(){var e=this,u=e.$createElement,s=e._self._c||u;return s(_.VSheet,{staticClass:"v-swatches"},e._l(e.swatches,function(f,r){return s("div",{key:r},e._l(f,function(i){return s(_.VBtn,{key:i,attrs:{elevation:e.elevation,width:e.size,height:e.size,color:i,value:i,"min-width":"auto"},on:{click:e.onSwatchClick}},[i===e.selected?s(_.VIcon,{attrs:{size:e.iconSize,color:i}},[e._v(" "+e._s(e.icon)+" ")]):e._e()],1)}),1)}),0)},w=[],q="";function g(e,u,s,f,r,i,c,T){var a=typeof e=="function"?e.options:e;u&&(a.render=u,a.staticRenderFns=s,a._compiled=!0),f&&(a.functional=!0),i&&(a._scopeId="data-v-"+i);var o;if(c?(o=function(l){l=l||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!l&&typeof __VUE_SSR_CONTEXT__<"u"&&(l=__VUE_SSR_CONTEXT__),r&&r.call(this,l),l&&l._registeredComponents&&l._registeredComponents.add(c)},a._ssrRegister=o):r&&(o=T?function(){r.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:r),o)if(a.functional){a._injectStyles=o;var $=a.render;a.render=function(R,m){return o.call(m),$(R,m)}}else{var v=a.beforeCreate;a.beforeCreate=v?[].concat(v,o):[o]}return{exports:e,options:a}}const h={};var C=g(V,S,w,!1,k,null,null,null);function k(e){for(let u in h)this[u]=h[u]}var p=function(){return C.exports}();/**
2
- * Vuetify Swatches Component
1
+ (function(a,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis<"u"?globalThis:a||self,e(a.VSwatches={},a.Vue))})(this,function(a,e){"use strict";const h=Object.freeze({base:"#f44336",lighten5:"#ffebee",lighten4:"#ffcdd2",lighten3:"#ef9a9a",lighten2:"#e57373",lighten1:"#ef5350",darken1:"#e53935",darken2:"#d32f2f",darken3:"#c62828",darken4:"#b71c1c",accent1:"#ff8a80",accent2:"#ff5252",accent3:"#ff1744",accent4:"#d50000"}),s=Object.freeze({base:"#e91e63",lighten5:"#fce4ec",lighten4:"#f8bbd0",lighten3:"#f48fb1",lighten2:"#f06292",lighten1:"#ec407a",darken1:"#d81b60",darken2:"#c2185b",darken3:"#ad1457",darken4:"#880e4f",accent1:"#ff80ab",accent2:"#ff4081",accent3:"#f50057",accent4:"#c51162"}),o=Object.freeze({base:"#9c27b0",lighten5:"#f3e5f5",lighten4:"#e1bee7",lighten3:"#ce93d8",lighten2:"#ba68c8",lighten1:"#ab47bc",darken1:"#8e24aa",darken2:"#7b1fa2",darken3:"#6a1b9a",darken4:"#4a148c",accent1:"#ea80fc",accent2:"#e040fb",accent3:"#d500f9",accent4:"#aa00ff"}),g=Object.freeze({base:"#673ab7",lighten5:"#ede7f6",lighten4:"#d1c4e9",lighten3:"#b39ddb",lighten2:"#9575cd",lighten1:"#7e57c2",darken1:"#5e35b1",darken2:"#512da8",darken3:"#4527a0",darken4:"#311b92",accent1:"#b388ff",accent2:"#7c4dff",accent3:"#651fff",accent4:"#6200ea"}),k=Object.freeze({base:"#3f51b5",lighten5:"#e8eaf6",lighten4:"#c5cae9",lighten3:"#9fa8da",lighten2:"#7986cb",lighten1:"#5c6bc0",darken1:"#3949ab",darken2:"#303f9f",darken3:"#283593",darken4:"#1a237e",accent1:"#8c9eff",accent2:"#536dfe",accent3:"#3d5afe",accent4:"#304ffe"}),p=Object.freeze({base:"#2196f3",lighten5:"#e3f2fd",lighten4:"#bbdefb",lighten3:"#90caf9",lighten2:"#64b5f6",lighten1:"#42a5f5",darken1:"#1e88e5",darken2:"#1976d2",darken3:"#1565c0",darken4:"#0d47a1",accent1:"#82b1ff",accent2:"#448aff",accent3:"#2979ff",accent4:"#2962ff"}),m=Object.freeze({base:"#03a9f4",lighten5:"#e1f5fe",lighten4:"#b3e5fc",lighten3:"#81d4fa",lighten2:"#4fc3f7",lighten1:"#29b6f6",darken1:"#039be5",darken2:"#0288d1",darken3:"#0277bd",darken4:"#01579b",accent1:"#80d8ff",accent2:"#40c4ff",accent3:"#00b0ff",accent4:"#0091ea"}),u=Object.freeze({base:"#00bcd4",lighten5:"#e0f7fa",lighten4:"#b2ebf2",lighten3:"#80deea",lighten2:"#4dd0e1",lighten1:"#26c6da",darken1:"#00acc1",darken2:"#0097a7",darken3:"#00838f",darken4:"#006064",accent1:"#84ffff",accent2:"#18ffff",accent3:"#00e5ff",accent4:"#00b8d4"}),z=Object.freeze({base:"#009688",lighten5:"#e0f2f1",lighten4:"#b2dfdb",lighten3:"#80cbc4",lighten2:"#4db6ac",lighten1:"#26a69a",darken1:"#00897b",darken2:"#00796b",darken3:"#00695c",darken4:"#004d40",accent1:"#a7ffeb",accent2:"#64ffda",accent3:"#1de9b6",accent4:"#00bfa5"}),w=Object.freeze({base:"#4caf50",lighten5:"#e8f5e9",lighten4:"#c8e6c9",lighten3:"#a5d6a7",lighten2:"#81c784",lighten1:"#66bb6a",darken1:"#43a047",darken2:"#388e3c",darken3:"#2e7d32",darken4:"#1b5e20",accent1:"#b9f6ca",accent2:"#69f0ae",accent3:"#00e676",accent4:"#00c853"}),y=Object.freeze({base:"#8bc34a",lighten5:"#f1f8e9",lighten4:"#dcedc8",lighten3:"#c5e1a5",lighten2:"#aed581",lighten1:"#9ccc65",darken1:"#7cb342",darken2:"#689f38",darken3:"#558b2f",darken4:"#33691e",accent1:"#ccff90",accent2:"#b2ff59",accent3:"#76ff03",accent4:"#64dd17"}),O=Object.freeze({base:"#cddc39",lighten5:"#f9fbe7",lighten4:"#f0f4c3",lighten3:"#e6ee9c",lighten2:"#dce775",lighten1:"#d4e157",darken1:"#c0ca33",darken2:"#afb42b",darken3:"#9e9d24",darken4:"#827717",accent1:"#f4ff81",accent2:"#eeff41",accent3:"#c6ff00",accent4:"#aeea00"}),j=Object.freeze({base:"#ffeb3b",lighten5:"#fffde7",lighten4:"#fff9c4",lighten3:"#fff59d",lighten2:"#fff176",lighten1:"#ffee58",darken1:"#fdd835",darken2:"#fbc02d",darken3:"#f9a825",darken4:"#f57f17",accent1:"#ffff8d",accent2:"#ffff00",accent3:"#ffea00",accent4:"#ffd600"}),_=Object.freeze({base:"#ffc107",lighten5:"#fff8e1",lighten4:"#ffecb3",lighten3:"#ffe082",lighten2:"#ffd54f",lighten1:"#ffca28",darken1:"#ffb300",darken2:"#ffa000",darken3:"#ff8f00",darken4:"#ff6f00",accent1:"#ffe57f",accent2:"#ffd740",accent3:"#ffc400",accent4:"#ffab00"}),S=Object.freeze({base:"#ff9800",lighten5:"#fff3e0",lighten4:"#ffe0b2",lighten3:"#ffcc80",lighten2:"#ffb74d",lighten1:"#ffa726",darken1:"#fb8c00",darken2:"#f57c00",darken3:"#ef6c00",darken4:"#e65100",accent1:"#ffd180",accent2:"#ffab40",accent3:"#ff9100",accent4:"#ff6d00"}),V=Object.freeze({base:"#ff5722",lighten5:"#fbe9e7",lighten4:"#ffccbc",lighten3:"#ffab91",lighten2:"#ff8a65",lighten1:"#ff7043",darken1:"#f4511e",darken2:"#e64a19",darken3:"#d84315",darken4:"#bf360c",accent1:"#ff9e80",accent2:"#ff6e40",accent3:"#ff3d00",accent4:"#dd2c00"}),B=Object.freeze({base:"#795548",lighten5:"#efebe9",lighten4:"#d7ccc8",lighten3:"#bcaaa4",lighten2:"#a1887f",lighten1:"#8d6e63",darken1:"#6d4c41",darken2:"#5d4037",darken3:"#4e342e",darken4:"#3e2723"}),C=Object.freeze({base:"#607d8b",lighten5:"#eceff1",lighten4:"#cfd8dc",lighten3:"#b0bec5",lighten2:"#90a4ae",lighten1:"#78909c",darken1:"#546e7a",darken2:"#455a64",darken3:"#37474f",darken4:"#263238"}),v=Object.freeze({base:"#9e9e9e",lighten5:"#fafafa",lighten4:"#f5f5f5",lighten3:"#eeeeee",lighten2:"#e0e0e0",lighten1:"#bdbdbd",darken1:"#757575",darken2:"#616161",darken3:"#424242",darken4:"#212121"}),$=Object.freeze({black:"#000000",white:"#ffffff",transparent:"transparent"});var n=Object.freeze({red:h,pink:s,purple:o,deepPurple:g,indigo:k,blue:p,lightBlue:m,cyan:u,teal:z,green:w,lightGreen:y,lime:O,yellow:j,amber:_,orange:S,deepOrange:V,brown:B,blueGrey:C,grey:v,shades:$}),x=(()=>`.v-swatches .v-btn{padding:0!important;margin:.1rem}.v-swatches .v-btn .v-icon{filter:invert(100%)}
2
+ `)(),G=(t,l)=>{const f=t.__vccOpts||t;for(const[c,i]of l)f[c]=i;return f};const T=e.defineComponent({name:"VSwatches",model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:String,required:!0},swatches:{type:Array,default:()=>[[n.shades.black,n.shades.white],[n.red.base,n.pink.base,n.purple.base,n.deepPurple.base,n.indigo.base,n.blue.base,n.lightBlue.base,n.cyan.base],[n.teal.base,n.green.base,n.lightGreen.base,n.lime.base,n.yellow.base,n.amber.base,n.orange.base,n.deepOrange.base],[n.brown.base,n.blueGrey.base,n.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(t,l){const f=e.ref(!1),c=e.ref(t.modelValue);return{checkedVisibilty:f,selected:c,onSwatchClick:d=>{!d||c.value===d||(c.value=d,l.emit("update:modelValue",d))}}}});function E(t,l,f,c,i,d){const P=e.resolveComponent("v-icon"),q=e.resolveComponent("v-btn"),F=e.resolveComponent("v-sheet");return e.openBlock(),e.createBlock(F,{class:"v-swatches"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.swatches,(L,M)=>(e.openBlock(),e.createElementBlock("div",{key:M},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(L,r=>(e.openBlock(),e.createBlock(q,{key:r,elevation:t.elevation,width:t.size,height:t.size,color:r,"min-width":"auto",onClick:A=>t.onSwatchClick(r)},{default:e.withCtx(()=>[r===t.selected?(e.openBlock(),e.createBlock(P,{key:0,size:t.iconSize,color:r},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.icon),1)]),_:2},1032,["size","color"])):e.createCommentVNode("",!0)]),_:2},1032,["elevation","width","height","color","onClick"]))),128))]))),128))]),_:1})}var b=G(T,[["render",E]]);/**
3
+ * Vuetify3 Swatches Component
3
4
  *
4
5
  * @license MIT
5
6
  * @author Logue {@link logue@hotmail.co.jp}
6
7
  * @copyright 2022 Masashi Yoshikawa {@link https://logue.dev/} All rights reserved.
7
8
  * @see {@link https://github.com/logue/vuetify-swatches}
8
- */const z=e=>e.component("VSwatches",p);n.default=p,n.install=z,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
9
+ */const N=t=>t.component("VSwatches",b);a.default=b,a.install=N,Object.defineProperties(a,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "vuetify-swatches",
4
- "version": "0.0.8",
5
- "description": "Color Swatch component for Vuetify.",
4
+ "version": "0.3.0",
5
+ "description": "Color Swatch component for Vuetify3.",
6
6
  "keywords": [
7
7
  "vuejs",
8
8
  "vue",
@@ -10,10 +10,11 @@
10
10
  "color-picker",
11
11
  "color-palette",
12
12
  "swatches",
13
- "vue2",
13
+ "vue3",
14
14
  "vue-plugin",
15
15
  "vue-resource",
16
16
  "vuetify",
17
+ "vuetify3",
17
18
  "vuetify-components"
18
19
  ],
19
20
  "author": {
@@ -69,62 +70,55 @@
69
70
  "preview": "vite preview --config vite.config.docs.ts",
70
71
  "prepare": "husky install"
71
72
  },
72
- "dependencies": {
73
- "@vue/composition-api": "latest",
74
- "vue-demi": "latest"
75
- },
76
73
  "peerDependencies": {
77
- "vue": "^2.6.14",
78
- "vuetify": "^2.6.6"
74
+ "vue": "^3.2.37",
75
+ "vuetify": "^3.0.0-beta.4"
79
76
  },
80
77
  "devDependencies": {
81
- "@codemirror/basic-setup": "^0.20.0",
82
- "@codemirror/lang-html": "^0.20.0",
83
- "@codemirror/state": "^0.20.0",
84
- "@codemirror/view": "^0.20.6",
85
- "@types/node": "^17.0.36",
86
- "@typescript-eslint/eslint-plugin": "^5.26.0",
87
- "@typescript-eslint/parser": "^5.26.0",
88
- "eslint": "^8.16.0",
78
+ "@codemirror/lang-html": "^6.1.0",
79
+ "@codemirror/state": "^6.0.1",
80
+ "@codemirror/view": "^6.0.2",
81
+ "@types/node": "^18.0.0",
82
+ "@typescript-eslint/eslint-plugin": "^5.30.0",
83
+ "@typescript-eslint/parser": "^5.30.0",
84
+ "@vitejs/plugin-vue": "^2.3.3",
85
+ "eslint": "^8.18.0",
89
86
  "eslint-config-google": "^0.14.0",
90
87
  "eslint-config-prettier": "^8.5.0",
91
88
  "eslint-import-resolver-alias": "^1.1.2",
92
- "eslint-import-resolver-typescript": "^2.7.1",
89
+ "eslint-import-resolver-typescript": "^3.1.1",
93
90
  "eslint-plugin-import": "^2.26.0",
94
- "eslint-plugin-jsdoc": "^39.3.2",
91
+ "eslint-plugin-jsdoc": "^39.3.3",
95
92
  "eslint-plugin-tsdoc": "^0.2.16",
96
- "eslint-plugin-vue": "^9.0.1",
97
- "eslint-plugin-vuejs-accessibility": "^1.1.1",
93
+ "eslint-plugin-vue": "^9.1.1",
94
+ "eslint-plugin-vuejs-accessibility": "^1.2.0",
98
95
  "eslint-plugin-vuetify": "^1.1.0",
99
96
  "eslint-plugin-yaml": "^0.5.0",
100
97
  "husky": "^8.0.1",
101
- "lint-staged": "^12.4.2",
98
+ "lint-staged": "^13.0.3",
102
99
  "postcss-html": "^1.4.1",
103
- "prettier": "^2.6.2",
100
+ "prettier": "^2.7.1",
104
101
  "prettier-plugin-jsdoc": "^0.3.38",
105
102
  "prettier-plugin-md-nocjsp": "^1.2.0",
106
- "prettier-plugin-sort-imports": "^1.6.1",
103
+ "prettier-plugin-sort-imports": "^1.7.0",
107
104
  "rimraf": "^3.0.2",
108
105
  "rollup-plugin-visualizer": "^5.6.0",
109
- "sass": "1.32.12",
110
- "stylelint": "^14.8.5",
106
+ "sass": "1.53.0",
107
+ "stylelint": "^14.9.1",
111
108
  "stylelint-config-prettier": "^9.0.3",
112
109
  "stylelint-config-recommended-scss": "^6.0.0",
113
110
  "stylelint-config-recommended-vue": "^1.4.0",
114
111
  "stylelint-order": "^5.0.0",
115
112
  "stylelint-prettier": "^2.0.0",
116
- "typescript": "^4.7.2",
117
- "unplugin-vue-components": "^0.19.6",
118
- "vite": "^2.9.9",
113
+ "typescript": "^4.7.4",
114
+ "vite": "^2.9.13",
119
115
  "vite-plugin-checker": "^0.4.6",
120
- "vite-plugin-stylelint": "^2.2.3",
121
- "vite-plugin-vue2": "^2.0.1",
122
- "vue": "^2.6.14",
123
- "vue-codemirror6": "0.1.6",
124
- "vue-eslint-parser": "^9.0.2",
125
- "vue-template-compiler": "^2.6.14",
126
- "vue-tsc": "^0.34.17",
127
- "vuetify": "^2.6.6"
116
+ "vite-plugin-vuetify": "^1.0.0-alpha.12",
117
+ "vue": "^3.2.37",
118
+ "vue-codemirror6": "0.6.4",
119
+ "vue-eslint-parser": "^9.0.3",
120
+ "vue-tsc": "^0.38.2",
121
+ "vuetify": "^3.0.0-beta.4"
128
122
  },
129
123
  "husky": {
130
124
  "hooks": {
@@ -136,5 +130,8 @@
136
130
  "*.{js,ts,json,yml,yaml,vue,htm,html}": "eslint --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint",
137
131
  "*.{css,sass,scss,vue,htm,html}": "stylelint --fix --cache --cache-location ./node_modules/.vite/vite-plugin-stylelint",
138
132
  "*": "prettier -w -u"
133
+ },
134
+ "resolutions": {
135
+ "prettier": "^2.7.1"
139
136
  }
140
137
  }
@@ -8,9 +8,8 @@
8
8
  :width="size"
9
9
  :height="size"
10
10
  :color="color"
11
- :value="color"
12
11
  min-width="auto"
13
- @click="onSwatchClick"
12
+ @click="onSwatchClick(color)"
14
13
  >
15
14
  <v-icon v-if="color === selected" :size="iconSize" :color="color">
16
15
  {{ icon }}
@@ -27,21 +26,15 @@ import {
27
26
  type PropType,
28
27
  type Ref,
29
28
  type SetupContext,
30
- } from 'vue-demi';
29
+ } from 'vue';
31
30
 
32
- import { VSheet, VIcon, VBtn } from 'vuetify/lib';
33
- import colors from 'vuetify/lib/util/colors';
31
+ // eslint-disable-next-line import/no-unresolved
32
+ import colors from 'vuetify/lib/util/colors.mjs';
34
33
 
35
34
  /** Vuetify Swatches */
36
35
  export default defineComponent({
37
36
  /** Component name */
38
37
  name: 'VSwatches',
39
- /** Components */
40
- components: {
41
- VSheet,
42
- VBtn,
43
- VIcon,
44
- },
45
38
  /** Model Definition */
46
39
  model: {
47
40
  prop: 'modelValue',
@@ -104,10 +97,9 @@ export default defineComponent({
104
97
  /**
105
98
  * ボタンがクリックされた
106
99
  *
107
- * @param e - イベント
100
+ * @param value - 色
108
101
  */
109
- const onSwatchClick = (e: Event) => {
110
- const value = (e.target as HTMLButtonElement).value;
102
+ const onSwatchClick = (value: string) => {
111
103
  if (!value || selected.value === value) {
112
104
  return;
113
105
  }