vuetify-swatches 0.0.4 → 0.0.7
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 +1 -0
- package/dist/components/VSwatches.vue.d.ts +71 -0
- package/dist/components/VSwatches.vue.d.ts.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/dist/v-swatches.es.js +174 -0
- package/dist/v-swatches.umd.js +8 -0
- package/package.json +45 -33
- package/src/components/VSwatches.vue +15 -14
package/README.md
CHANGED
|
@@ -125,6 +125,7 @@ export default Vue.extend({
|
|
|
125
125
|
|
|
126
126
|
| Variables | Type | Default | Info |
|
|
127
127
|
| --------- | ------ | -------------------------- | ------------------ |
|
|
128
|
+
| elevation | number | 1 | shadow size |
|
|
128
129
|
| size | string | 2rem | Swatch Button size |
|
|
129
130
|
| icon | string | mdi-checkbox-marked-circle | checked icon |
|
|
130
131
|
| icon-size | string | 1rem | checked icon size |
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type PropType, type Ref } from 'vue-demi';
|
|
2
|
+
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
3
|
+
checkedVisibilty: Ref<boolean>;
|
|
4
|
+
selected: Ref<string>;
|
|
5
|
+
onSwatchClick: (e: Event) => void;
|
|
6
|
+
}> & import("@vue/composition-api").Data, {}, {}, {
|
|
7
|
+
/** Model value */
|
|
8
|
+
modelValue: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
/** Swatch colors */
|
|
13
|
+
swatches: {
|
|
14
|
+
type: PropType<string[] | string[][]>;
|
|
15
|
+
default: () => string[][];
|
|
16
|
+
};
|
|
17
|
+
/** The size of the shadow of the button */
|
|
18
|
+
elevation: {
|
|
19
|
+
type: NumberConstructor;
|
|
20
|
+
default: number;
|
|
21
|
+
};
|
|
22
|
+
/** Swatch sized */
|
|
23
|
+
size: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
27
|
+
/** selected icon */
|
|
28
|
+
icon: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
default: string;
|
|
31
|
+
};
|
|
32
|
+
/** selected icon size */
|
|
33
|
+
iconSize: {
|
|
34
|
+
type: StringConstructor;
|
|
35
|
+
default: string;
|
|
36
|
+
};
|
|
37
|
+
}, {
|
|
38
|
+
modelValue: string;
|
|
39
|
+
swatches: string[] | string[][];
|
|
40
|
+
elevation: number;
|
|
41
|
+
size: string;
|
|
42
|
+
icon: string;
|
|
43
|
+
iconSize: string;
|
|
44
|
+
} & {}> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
45
|
+
modelValue: string;
|
|
46
|
+
swatches: string[] | string[][];
|
|
47
|
+
elevation: number;
|
|
48
|
+
size: string;
|
|
49
|
+
icon: string;
|
|
50
|
+
iconSize: string;
|
|
51
|
+
} & {}, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
52
|
+
checkedVisibilty: Ref<boolean>;
|
|
53
|
+
selected: Ref<string>;
|
|
54
|
+
onSwatchClick: (e: Event) => void;
|
|
55
|
+
}>, import("@vue/composition-api").Data, {}, {}, {}, {}, {}, {
|
|
56
|
+
modelValue: string;
|
|
57
|
+
swatches: string[] | string[][];
|
|
58
|
+
elevation: number;
|
|
59
|
+
size: string;
|
|
60
|
+
icon: string;
|
|
61
|
+
iconSize: string;
|
|
62
|
+
} & {}, {
|
|
63
|
+
swatches: string[] | string[][];
|
|
64
|
+
elevation: number;
|
|
65
|
+
size: string;
|
|
66
|
+
icon: string;
|
|
67
|
+
iconSize: string;
|
|
68
|
+
}, true>);
|
|
69
|
+
/** Vuetify Swatches */
|
|
70
|
+
export default _default;
|
|
71
|
+
//# sourceMappingURL=VSwatches.vue.d.ts.map
|
|
@@ -0,0 +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;;;;uBA+EY,KAAK;;IA1D/B,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,2CAA2C;;;;;IAE3C,mBAAmB;;;;;IAEnB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;;;;;;;;;;;;;;;;;;uBAsBC,KAAK;;;;;;;;;;;;;;;AA1EnC,uBAAuB;AACvB,wBAwFG"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vuetify 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
|
+
import VSwatches from './components/VSwatches.vue';
|
|
10
|
+
declare const installVSwatches: void | ((app: any) => void);
|
|
11
|
+
export { VSwatches as default, installVSwatches as install };
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,SAAS,MAAM,4BAA4B,CAAC;AAGnD,QAAA,MAAM,gBAAgB,6BAIT,CAAC;AAEd,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,gBAAgB,IAAI,OAAO,EAAE,CAAC"}
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.v-swatches .v-btn{padding:0!important;margin:.1rem}.v-swatches .v-btn .v-icon{filter:invert(100%)}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { defineComponent, ref, isVue2, install } from "vue-demi";
|
|
2
|
+
import { VSheet, VBtn, VIcon } from "vuetify/lib";
|
|
3
|
+
import colors from "vuetify/lib/util/colors";
|
|
4
|
+
var __vue2_script = defineComponent({
|
|
5
|
+
name: "VSwatches",
|
|
6
|
+
components: {
|
|
7
|
+
VSheet,
|
|
8
|
+
VBtn,
|
|
9
|
+
VIcon
|
|
10
|
+
},
|
|
11
|
+
model: {
|
|
12
|
+
prop: "modelValue",
|
|
13
|
+
event: "update:modelValue"
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
modelValue: { type: String, required: true },
|
|
17
|
+
swatches: {
|
|
18
|
+
type: Array,
|
|
19
|
+
default: () => [
|
|
20
|
+
[colors.shades.black, colors.shades.white],
|
|
21
|
+
[
|
|
22
|
+
colors.red.base,
|
|
23
|
+
colors.pink.base,
|
|
24
|
+
colors.purple.base,
|
|
25
|
+
colors.deepPurple.base,
|
|
26
|
+
colors.indigo.base,
|
|
27
|
+
colors.blue.base,
|
|
28
|
+
colors.lightBlue.base,
|
|
29
|
+
colors.cyan.base
|
|
30
|
+
],
|
|
31
|
+
[
|
|
32
|
+
colors.teal.base,
|
|
33
|
+
colors.green.base,
|
|
34
|
+
colors.lightGreen.base,
|
|
35
|
+
colors.lime.base,
|
|
36
|
+
colors.yellow.base,
|
|
37
|
+
colors.amber.base,
|
|
38
|
+
colors.orange.base,
|
|
39
|
+
colors.deepOrange.base
|
|
40
|
+
],
|
|
41
|
+
[colors.brown.base, colors.blueGrey.base, colors.grey.base]
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
elevation: { type: Number, default: 1 },
|
|
45
|
+
size: { type: String, default: "2rem" },
|
|
46
|
+
icon: { type: String, default: "mdi-checkbox-marked-circle" },
|
|
47
|
+
iconSize: { type: String, default: "1rem" }
|
|
48
|
+
},
|
|
49
|
+
emits: ["update:modelValue"],
|
|
50
|
+
setup(props, context) {
|
|
51
|
+
const checkedVisibilty = ref(false);
|
|
52
|
+
const selected = ref(props.modelValue);
|
|
53
|
+
const onSwatchClick = (e) => {
|
|
54
|
+
const value = e.target.value;
|
|
55
|
+
if (!value || selected.value === value) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
selected.value = value;
|
|
59
|
+
context.emit("update:modelValue", value);
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
checkedVisibilty,
|
|
63
|
+
selected,
|
|
64
|
+
onSwatchClick
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
});
|
|
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
|
+
}
|
|
159
|
+
}
|
|
160
|
+
var VSwatches = /* @__PURE__ */ function() {
|
|
161
|
+
return __component__.exports;
|
|
162
|
+
}();
|
|
163
|
+
/**
|
|
164
|
+
* Vuetify Swatches Component
|
|
165
|
+
*
|
|
166
|
+
* @license MIT
|
|
167
|
+
* @author Logue {@link logue@hotmail.co.jp}
|
|
168
|
+
* @copyright 2022 Masashi Yoshikawa {@link https://logue.dev/} All rights reserved.
|
|
169
|
+
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
170
|
+
*/
|
|
171
|
+
const installVSwatches = isVue2 ? (app) => {
|
|
172
|
+
app.component("VSwatches", VSwatches);
|
|
173
|
+
} : install();
|
|
174
|
+
export { VSwatches as default, installVSwatches as install };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
(function(n,l){typeof exports=="object"&&typeof module<"u"?l(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"],l):(n=typeof globalThis<"u"?globalThis:n||self,l(n.VSwatches={},n.VueDemi,n.Vuetify,n.colors))})(this,function(n,l,_,b){"use strict";function y(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var t=y(b),V=l.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 r=l.ref(!1),f=l.ref(e.modelValue);return{checkedVisibilty:r,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,r=e._self._c||u;return r(_.VSheet,{staticClass:"v-swatches"},e._l(e.swatches,function(f,o){return r("div",{key:o},e._l(f,function(i){return r(_.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?r(_.VIcon,{attrs:{size:e.iconSize,color:i}},[e._v(" "+e._s(e.icon)+" ")]):e._e()],1)}),1)}),0)},w=[],q="";function g(e,u,r,f,o,i,c,T){var a=typeof e=="function"?e.options:e;u&&(a.render=u,a.staticRenderFns=r,a._compiled=!0),f&&(a.functional=!0),i&&(a._scopeId="data-v-"+i);var d;if(c?(d=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__),o&&o.call(this,s),s&&s._registeredComponents&&s._registeredComponents.add(c)},a._ssrRegister=d):o&&(d=T?function(){o.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:o),d)if(a.functional){a._injectStyles=d;var $=a.render;a.render=function(R,m){return d.call(m),$(R,m)}}else{var v=a.beforeCreate;a.beforeCreate=v?[].concat(v,d):[d]}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
|
|
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
|
+
*/const z=l.isVue2?e=>{e.component("VSwatches",p)}:l.install();n.default=p,n.install=z,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "vuetify-swatches",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.7",
|
|
6
6
|
"description": "Color Swatch component for Vuetify.",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"vuejs",
|
|
@@ -31,43 +31,52 @@
|
|
|
31
31
|
"url": "https://github.com/logue/vuetify-swatches/issues"
|
|
32
32
|
},
|
|
33
33
|
"engines": {
|
|
34
|
-
"node": ">=16"
|
|
34
|
+
"node": ">=16.15.0",
|
|
35
|
+
"yarn": ">=1.22.4"
|
|
35
36
|
},
|
|
36
37
|
"license": "MIT",
|
|
37
|
-
"main": "./dist/
|
|
38
|
-
"module": "./dist/
|
|
38
|
+
"main": "./dist/v-swatches.umd.js",
|
|
39
|
+
"module": "./dist/v-swatches.es.js",
|
|
39
40
|
"browser": {
|
|
40
41
|
"./sfc": "./src/components/VSwatches.vue"
|
|
41
42
|
},
|
|
42
43
|
"exports": {
|
|
43
44
|
".": {
|
|
44
|
-
"import": "./dist/
|
|
45
|
-
"require": "./dist/
|
|
45
|
+
"import": "./dist/v-swatches.es.js",
|
|
46
|
+
"require": "./dist/v-swatches.umd.js"
|
|
47
|
+
},
|
|
48
|
+
"./dist/style.css": {
|
|
49
|
+
"import": "./dist/style.css",
|
|
50
|
+
"require": "./dist/style.css"
|
|
46
51
|
}
|
|
47
52
|
},
|
|
48
|
-
"types": "./
|
|
53
|
+
"types": "./dist/index.d.ts",
|
|
49
54
|
"files": [
|
|
50
|
-
"
|
|
51
|
-
"
|
|
55
|
+
"dist",
|
|
56
|
+
"src/components/VSwatches.vue"
|
|
52
57
|
],
|
|
53
58
|
"sideEffects": false,
|
|
54
59
|
"scripts": {
|
|
55
60
|
"dev": "vite",
|
|
56
61
|
"clean": "rimraf node_modules/.vite",
|
|
57
62
|
"build": "vite build & vue-tsc --declaration --emitDeclarationOnly",
|
|
58
|
-
"build:
|
|
59
|
-
"
|
|
60
|
-
"
|
|
63
|
+
"build:analyze": "vue-tsc --noEmit && vite build --mode analyze",
|
|
64
|
+
"build:docs": "vite build --config vite.config.docs.ts",
|
|
65
|
+
"build:clean": "rimraf dist",
|
|
66
|
+
"lint": "eslint . --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint && prettier . -w -u",
|
|
67
|
+
"lint:style": "stylelint . --cache --cache-location ./node_modules/.vite/vite-plugin-stylelint",
|
|
61
68
|
"lint:markup": "vue-tsc --noEmit",
|
|
62
|
-
"
|
|
69
|
+
"preview": "vite preview --config vite.config.docs.ts",
|
|
70
|
+
"prepare": "husky install",
|
|
71
|
+
"postinstall": "npx vue-demi-fix"
|
|
63
72
|
},
|
|
64
73
|
"dependencies": {
|
|
65
74
|
"vue-demi": "latest"
|
|
66
75
|
},
|
|
67
76
|
"peerDependencies": {
|
|
68
|
-
"@vue/composition-api": "
|
|
77
|
+
"@vue/composition-api": "latest",
|
|
69
78
|
"vue": "^2.6.14",
|
|
70
|
-
"vuetify": "^2.6.
|
|
79
|
+
"vuetify": "^2.6.6"
|
|
71
80
|
},
|
|
72
81
|
"peerDependenciesMeta": {
|
|
73
82
|
"@vue/composition-api": {
|
|
@@ -77,13 +86,13 @@
|
|
|
77
86
|
"devDependencies": {
|
|
78
87
|
"@codemirror/basic-setup": "^0.20.0",
|
|
79
88
|
"@codemirror/lang-html": "^0.20.0",
|
|
80
|
-
"@modyqyw/vite-plugin-eslint": "^1.3.
|
|
81
|
-
"@types/node": "^17.0.
|
|
82
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
83
|
-
"@typescript-eslint/parser": "^5.
|
|
84
|
-
"@vue/composition-api": "^1.
|
|
89
|
+
"@modyqyw/vite-plugin-eslint": "^1.3.2",
|
|
90
|
+
"@types/node": "^17.0.35",
|
|
91
|
+
"@typescript-eslint/eslint-plugin": "^5.25.0",
|
|
92
|
+
"@typescript-eslint/parser": "^5.25.0",
|
|
93
|
+
"@vue/composition-api": "^1.6.1",
|
|
85
94
|
"@vue/eslint-config-typescript": "^10.0.0",
|
|
86
|
-
"eslint": "^8.
|
|
95
|
+
"eslint": "^8.16.0",
|
|
87
96
|
"eslint-config-google": "^0.14.0",
|
|
88
97
|
"eslint-config-prettier": "^8.5.0",
|
|
89
98
|
"eslint-config-vuetify": "^0.6.1",
|
|
@@ -93,35 +102,38 @@
|
|
|
93
102
|
"eslint-plugin-prettier": "^4.0.0",
|
|
94
103
|
"eslint-plugin-prettier-vue": "^3.1.0",
|
|
95
104
|
"eslint-plugin-tsdoc": "^0.2.16",
|
|
96
|
-
"eslint-plugin-vue": "^
|
|
105
|
+
"eslint-plugin-vue": "^9.0.1",
|
|
97
106
|
"eslint-plugin-vuejs-accessibility": "^1.1.1",
|
|
98
107
|
"eslint-plugin-vuetify": "^1.1.0",
|
|
99
108
|
"eslint-plugin-yaml": "^0.5.0",
|
|
100
|
-
"husky": "^
|
|
101
|
-
"lint-staged": "^12.4.
|
|
109
|
+
"husky": "^8.0.1",
|
|
110
|
+
"lint-staged": "^12.4.1",
|
|
102
111
|
"postcss-html": "^1.4.1",
|
|
103
112
|
"prettier": "^2.6.2",
|
|
104
113
|
"prettier-plugin-jsdoc": "^0.3.38",
|
|
105
114
|
"prettier-plugin-md-nocjsp": "^1.2.0",
|
|
106
115
|
"prettier-plugin-sort-imports": "^1.6.0",
|
|
107
116
|
"rimraf": "^3.0.2",
|
|
117
|
+
"rollup-plugin-visualizer": "^5.6.0",
|
|
108
118
|
"sass": "1.32.12",
|
|
109
|
-
"stylelint": "^14.
|
|
119
|
+
"stylelint": "^14.8.3",
|
|
110
120
|
"stylelint-config-prettier": "^9.0.3",
|
|
111
121
|
"stylelint-config-recommended-scss": "^6.0.0",
|
|
112
122
|
"stylelint-config-recommended-vue": "^1.4.0",
|
|
113
123
|
"stylelint-order": "^5.0.0",
|
|
114
124
|
"stylelint-prettier": "^2.0.0",
|
|
115
|
-
"typescript": "^4.6.
|
|
116
|
-
"unplugin-vue-components": "^0.19.
|
|
117
|
-
"vite": "^2.9.
|
|
118
|
-
"vite-plugin-
|
|
119
|
-
"vite-plugin-
|
|
125
|
+
"typescript": "^4.6.4",
|
|
126
|
+
"unplugin-vue-components": "^0.19.5",
|
|
127
|
+
"vite": "^2.9.9",
|
|
128
|
+
"vite-plugin-checker": "^0.4.6",
|
|
129
|
+
"vite-plugin-stylelint": "^2.2.3",
|
|
130
|
+
"vite-plugin-vue2": "^2.0.1",
|
|
120
131
|
"vue": "^2.6.14",
|
|
121
|
-
"vue-codemirror6": "0.1.
|
|
122
|
-
"vue-eslint-parser": "^
|
|
132
|
+
"vue-codemirror6": "0.1.6",
|
|
133
|
+
"vue-eslint-parser": "^9.0.2",
|
|
123
134
|
"vue-template-compiler": "^2.6.14",
|
|
124
|
-
"vue-tsc": "^0.34.
|
|
135
|
+
"vue-tsc": "^0.34.15",
|
|
136
|
+
"vuetify": "^2.6.6"
|
|
125
137
|
},
|
|
126
138
|
"husky": {
|
|
127
139
|
"hooks": {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-sheet class="v-swatches">
|
|
3
|
-
<div v-for="(colors, rows) in
|
|
3
|
+
<div v-for="(colors, rows) in swatches" :key="rows">
|
|
4
4
|
<v-btn
|
|
5
5
|
v-for="color in colors"
|
|
6
6
|
:key="color"
|
|
7
|
-
elevation="
|
|
7
|
+
:elevation="elevation"
|
|
8
8
|
:width="size"
|
|
9
9
|
:height="size"
|
|
10
10
|
:color="color"
|
|
@@ -12,19 +12,22 @@
|
|
|
12
12
|
min-width="auto"
|
|
13
13
|
@click="onSwatchClick"
|
|
14
14
|
>
|
|
15
|
-
<v-icon
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
:color="color"
|
|
19
|
-
v-text="icon"
|
|
20
|
-
/>
|
|
15
|
+
<v-icon v-if="color === selected" :size="iconSize" :color="color">
|
|
16
|
+
{{ icon }}
|
|
17
|
+
</v-icon>
|
|
21
18
|
</v-btn>
|
|
22
19
|
</div>
|
|
23
20
|
</v-sheet>
|
|
24
21
|
</template>
|
|
25
22
|
|
|
26
23
|
<script lang="ts">
|
|
27
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
defineComponent,
|
|
26
|
+
ref,
|
|
27
|
+
type PropType,
|
|
28
|
+
type Ref,
|
|
29
|
+
type SetupContext,
|
|
30
|
+
} from 'vue-demi';
|
|
28
31
|
|
|
29
32
|
import { VSheet, VIcon, VBtn } from 'vuetify/lib';
|
|
30
33
|
import colors from 'vuetify/lib/util/colors';
|
|
@@ -49,7 +52,7 @@ export default defineComponent({
|
|
|
49
52
|
modelValue: { type: String, required: true },
|
|
50
53
|
/** Swatch colors */
|
|
51
54
|
swatches: {
|
|
52
|
-
type: Array as
|
|
55
|
+
type: Array as PropType<string[] | string[][]>,
|
|
53
56
|
default: () => [
|
|
54
57
|
[colors.shades.black, colors.shades.white],
|
|
55
58
|
[
|
|
@@ -75,6 +78,8 @@ export default defineComponent({
|
|
|
75
78
|
[colors.brown.base, colors.blueGrey.base, colors.grey.base],
|
|
76
79
|
],
|
|
77
80
|
},
|
|
81
|
+
/** The size of the shadow of the button */
|
|
82
|
+
elevation: { type: Number, default: 1 },
|
|
78
83
|
/** Swatch sized */
|
|
79
84
|
size: { type: String, default: '2rem' },
|
|
80
85
|
/** selected icon */
|
|
@@ -93,9 +98,6 @@ export default defineComponent({
|
|
|
93
98
|
/** チェックアイコンの表示制御 */
|
|
94
99
|
const checkedVisibilty: Ref<boolean> = ref(false);
|
|
95
100
|
|
|
96
|
-
/** Palette */
|
|
97
|
-
const palette: Ref<string[] | string[][]> = ref(props.swatches);
|
|
98
|
-
|
|
99
101
|
/** Selected color */
|
|
100
102
|
const selected: Ref<string> = ref(props.modelValue);
|
|
101
103
|
|
|
@@ -115,7 +117,6 @@ export default defineComponent({
|
|
|
115
117
|
|
|
116
118
|
return {
|
|
117
119
|
checkedVisibilty,
|
|
118
|
-
palette,
|
|
119
120
|
selected,
|
|
120
121
|
onSwatchClick,
|
|
121
122
|
};
|