vuetify-swatches 0.0.5 → 0.0.8
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 +43 -12
- package/dist/components/VSwatches.vue.d.ts.map +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/{v-swatches.es.js → index.es.js} +7 -14
- package/dist/index.umd.js +8 -0
- package/package.json +40 -41
- package/src/components/VSwatches.vue +15 -14
- package/dist/v-swatches.umd.js +0 -8
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 |
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type Ref } from 'vue-demi';
|
|
1
|
+
import { type PropType, type Ref } from 'vue-demi';
|
|
2
|
+
/** Vuetify Swatches */
|
|
2
3
|
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
3
4
|
checkedVisibilty: Ref<boolean>;
|
|
4
|
-
palette: Ref<string[] | string[][]>;
|
|
5
5
|
selected: Ref<string>;
|
|
6
6
|
onSwatchClick: (e: Event) => void;
|
|
7
7
|
}> & import("@vue/composition-api").Data, {}, {}, {
|
|
@@ -12,9 +12,14 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
12
12
|
};
|
|
13
13
|
/** Swatch colors */
|
|
14
14
|
swatches: {
|
|
15
|
-
type:
|
|
15
|
+
type: PropType<string[] | string[][]>;
|
|
16
16
|
default: () => string[][];
|
|
17
17
|
};
|
|
18
|
+
/** The size of the shadow of the button */
|
|
19
|
+
elevation: {
|
|
20
|
+
type: NumberConstructor;
|
|
21
|
+
default: number;
|
|
22
|
+
};
|
|
18
23
|
/** Swatch sized */
|
|
19
24
|
size: {
|
|
20
25
|
type: StringConstructor;
|
|
@@ -30,35 +35,61 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
30
35
|
type: StringConstructor;
|
|
31
36
|
default: string;
|
|
32
37
|
};
|
|
33
|
-
}, {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
}, import("@vue/composition-api").ExtractPropTypes<{
|
|
39
|
+
/** Model value */
|
|
40
|
+
modelValue: {
|
|
41
|
+
type: StringConstructor;
|
|
42
|
+
required: true;
|
|
43
|
+
};
|
|
44
|
+
/** Swatch colors */
|
|
45
|
+
swatches: {
|
|
46
|
+
type: PropType<string[] | string[][]>;
|
|
47
|
+
default: () => string[][];
|
|
48
|
+
};
|
|
49
|
+
/** The size of the shadow of the button */
|
|
50
|
+
elevation: {
|
|
51
|
+
type: NumberConstructor;
|
|
52
|
+
default: number;
|
|
53
|
+
};
|
|
54
|
+
/** Swatch sized */
|
|
55
|
+
size: {
|
|
56
|
+
type: StringConstructor;
|
|
57
|
+
default: string;
|
|
58
|
+
};
|
|
59
|
+
/** selected icon */
|
|
60
|
+
icon: {
|
|
61
|
+
type: StringConstructor;
|
|
62
|
+
default: string;
|
|
63
|
+
};
|
|
64
|
+
/** selected icon size */
|
|
65
|
+
iconSize: {
|
|
66
|
+
type: StringConstructor;
|
|
67
|
+
default: string;
|
|
68
|
+
};
|
|
69
|
+
}>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
40
70
|
modelValue: string;
|
|
41
71
|
swatches: string[] | string[][];
|
|
72
|
+
elevation: number;
|
|
42
73
|
size: string;
|
|
43
74
|
icon: string;
|
|
44
75
|
iconSize: string;
|
|
45
76
|
} & {}, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
46
77
|
checkedVisibilty: Ref<boolean>;
|
|
47
|
-
palette: Ref<string[] | string[][]>;
|
|
48
78
|
selected: Ref<string>;
|
|
49
79
|
onSwatchClick: (e: Event) => void;
|
|
50
80
|
}>, import("@vue/composition-api").Data, {}, {}, {}, {}, {}, {
|
|
51
81
|
modelValue: string;
|
|
52
82
|
swatches: string[] | string[][];
|
|
83
|
+
elevation: number;
|
|
53
84
|
size: string;
|
|
54
85
|
icon: string;
|
|
55
86
|
iconSize: string;
|
|
56
87
|
} & {}, {
|
|
57
88
|
swatches: string[] | string[][];
|
|
89
|
+
elevation: number;
|
|
58
90
|
size: string;
|
|
59
91
|
icon: string;
|
|
60
92
|
iconSize: string;
|
|
61
93
|
}, true>);
|
|
62
|
-
/** Vuetify Swatches */
|
|
63
94
|
export default _default;
|
|
64
95
|
//# 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,
|
|
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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
8
8
|
*/
|
|
9
9
|
import VSwatches from './components/VSwatches.vue';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export { VSwatches, installVSwatches as install };
|
|
13
|
-
export default VSwatches;
|
|
10
|
+
declare const installVSwatches: (app: any) => any;
|
|
11
|
+
export { VSwatches as default, installVSwatches as install };
|
|
14
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,SAAS,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,SAAS,MAAM,4BAA4B,CAAC;AAEnD,QAAA,MAAM,gBAAgB,mBAA+C,CAAC;AAEtE,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,gBAAgB,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref
|
|
1
|
+
import { defineComponent, ref } from "vue-demi";
|
|
2
2
|
import { VSheet, VBtn, VIcon } from "vuetify/lib";
|
|
3
3
|
import colors from "vuetify/lib/util/colors";
|
|
4
4
|
var __vue2_script = defineComponent({
|
|
@@ -41,6 +41,7 @@ var __vue2_script = defineComponent({
|
|
|
41
41
|
[colors.brown.base, colors.blueGrey.base, colors.grey.base]
|
|
42
42
|
]
|
|
43
43
|
},
|
|
44
|
+
elevation: { type: Number, default: 1 },
|
|
44
45
|
size: { type: String, default: "2rem" },
|
|
45
46
|
icon: { type: String, default: "mdi-checkbox-marked-circle" },
|
|
46
47
|
iconSize: { type: String, default: "1rem" }
|
|
@@ -48,7 +49,6 @@ var __vue2_script = defineComponent({
|
|
|
48
49
|
emits: ["update:modelValue"],
|
|
49
50
|
setup(props, context) {
|
|
50
51
|
const checkedVisibilty = ref(false);
|
|
51
|
-
const palette = ref(props.swatches);
|
|
52
52
|
const selected = ref(props.modelValue);
|
|
53
53
|
const onSwatchClick = (e) => {
|
|
54
54
|
const value = e.target.value;
|
|
@@ -60,7 +60,6 @@ var __vue2_script = defineComponent({
|
|
|
60
60
|
};
|
|
61
61
|
return {
|
|
62
62
|
checkedVisibilty,
|
|
63
|
-
palette,
|
|
64
63
|
selected,
|
|
65
64
|
onSwatchClick
|
|
66
65
|
};
|
|
@@ -72,14 +71,14 @@ var render = function() {
|
|
|
72
71
|
var _c = _vm._self._c || _h;
|
|
73
72
|
return _c(VSheet, {
|
|
74
73
|
staticClass: "v-swatches"
|
|
75
|
-
}, _vm._l(_vm.
|
|
74
|
+
}, _vm._l(_vm.swatches, function(colors2, rows) {
|
|
76
75
|
return _c("div", {
|
|
77
76
|
key: rows
|
|
78
77
|
}, _vm._l(colors2, function(color) {
|
|
79
78
|
return _c(VBtn, {
|
|
80
79
|
key: color,
|
|
81
80
|
attrs: {
|
|
82
|
-
"elevation":
|
|
81
|
+
"elevation": _vm.elevation,
|
|
83
82
|
"width": _vm.size,
|
|
84
83
|
"height": _vm.size,
|
|
85
84
|
"color": color,
|
|
@@ -93,11 +92,8 @@ var render = function() {
|
|
|
93
92
|
attrs: {
|
|
94
93
|
"size": _vm.iconSize,
|
|
95
94
|
"color": color
|
|
96
|
-
},
|
|
97
|
-
domProps: {
|
|
98
|
-
"textContent": _vm._s(_vm.icon)
|
|
99
95
|
}
|
|
100
|
-
}) : _vm._e()], 1);
|
|
96
|
+
}, [_vm._v(" " + _vm._s(_vm.icon) + " ")]) : _vm._e()], 1);
|
|
101
97
|
}), 1);
|
|
102
98
|
}), 0);
|
|
103
99
|
};
|
|
@@ -172,8 +168,5 @@ var VSwatches = /* @__PURE__ */ function() {
|
|
|
172
168
|
* @copyright 2022 Masashi Yoshikawa {@link https://logue.dev/} All rights reserved.
|
|
173
169
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
174
170
|
*/
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
app.component("VSwatches", VSwatches);
|
|
178
|
-
};
|
|
179
|
-
export { VSwatches, VSwatches as default, installVSwatches as install };
|
|
171
|
+
const installVSwatches = (app) => app.component("VSwatches", VSwatches);
|
|
172
|
+
export { VSwatches as default, installVSwatches as install };
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
|
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=e=>e.component("VSwatches",p);n.default=p,n.install=z,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "vuetify-swatches",
|
|
4
|
-
"
|
|
5
|
-
"version": "0.0.5",
|
|
4
|
+
"version": "0.0.8",
|
|
6
5
|
"description": "Color Swatch component for Vuetify.",
|
|
7
6
|
"keywords": [
|
|
8
7
|
"vuejs",
|
|
@@ -31,18 +30,20 @@
|
|
|
31
30
|
"url": "https://github.com/logue/vuetify-swatches/issues"
|
|
32
31
|
},
|
|
33
32
|
"engines": {
|
|
34
|
-
"node": ">=16"
|
|
33
|
+
"node": ">=16.15.0",
|
|
34
|
+
"yarn": ">=1.22.4"
|
|
35
35
|
},
|
|
36
|
+
"packageManager": "yarn@3.2.1",
|
|
36
37
|
"license": "MIT",
|
|
37
|
-
"main": "./dist/
|
|
38
|
-
"module": "./dist/
|
|
38
|
+
"main": "./dist/index.umd.js",
|
|
39
|
+
"module": "./dist/index.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/index.es.js",
|
|
46
|
+
"require": "./dist/index.umd.js"
|
|
46
47
|
},
|
|
47
48
|
"./dist/style.css": {
|
|
48
49
|
"import": "./dist/style.css",
|
|
@@ -57,75 +58,73 @@
|
|
|
57
58
|
"sideEffects": false,
|
|
58
59
|
"scripts": {
|
|
59
60
|
"dev": "vite",
|
|
60
|
-
"clean": "rimraf node_modules/.vite",
|
|
61
|
+
"clean": "rimraf node_modules/.vite ",
|
|
61
62
|
"build": "vite build & vue-tsc --declaration --emitDeclarationOnly",
|
|
62
|
-
"build:
|
|
63
|
-
"
|
|
64
|
-
"
|
|
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",
|
|
65
68
|
"lint:markup": "vue-tsc --noEmit",
|
|
69
|
+
"preview": "vite preview --config vite.config.docs.ts",
|
|
66
70
|
"prepare": "husky install"
|
|
67
71
|
},
|
|
68
72
|
"dependencies": {
|
|
73
|
+
"@vue/composition-api": "latest",
|
|
69
74
|
"vue-demi": "latest"
|
|
70
75
|
},
|
|
71
76
|
"peerDependencies": {
|
|
72
|
-
"@vue/composition-api": "^1.5.0",
|
|
73
77
|
"vue": "^2.6.14",
|
|
74
|
-
"vuetify": "^2.6.
|
|
75
|
-
},
|
|
76
|
-
"peerDependenciesMeta": {
|
|
77
|
-
"@vue/composition-api": {
|
|
78
|
-
"optional": true
|
|
79
|
-
}
|
|
78
|
+
"vuetify": "^2.6.6"
|
|
80
79
|
},
|
|
81
80
|
"devDependencies": {
|
|
82
81
|
"@codemirror/basic-setup": "^0.20.0",
|
|
83
82
|
"@codemirror/lang-html": "^0.20.0",
|
|
84
|
-
"@
|
|
85
|
-
"@
|
|
86
|
-
"@
|
|
87
|
-
"@typescript-eslint/
|
|
88
|
-
"@
|
|
89
|
-
"
|
|
90
|
-
"eslint": "^8.14.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",
|
|
91
89
|
"eslint-config-google": "^0.14.0",
|
|
92
90
|
"eslint-config-prettier": "^8.5.0",
|
|
93
|
-
"eslint-config-vuetify": "^0.6.1",
|
|
94
91
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
95
92
|
"eslint-import-resolver-typescript": "^2.7.1",
|
|
96
93
|
"eslint-plugin-import": "^2.26.0",
|
|
97
|
-
"eslint-plugin-
|
|
98
|
-
"eslint-plugin-prettier-vue": "^3.1.0",
|
|
94
|
+
"eslint-plugin-jsdoc": "^39.3.2",
|
|
99
95
|
"eslint-plugin-tsdoc": "^0.2.16",
|
|
100
|
-
"eslint-plugin-vue": "^
|
|
96
|
+
"eslint-plugin-vue": "^9.0.1",
|
|
101
97
|
"eslint-plugin-vuejs-accessibility": "^1.1.1",
|
|
102
98
|
"eslint-plugin-vuetify": "^1.1.0",
|
|
103
99
|
"eslint-plugin-yaml": "^0.5.0",
|
|
104
|
-
"husky": "^
|
|
105
|
-
"lint-staged": "^12.4.
|
|
100
|
+
"husky": "^8.0.1",
|
|
101
|
+
"lint-staged": "^12.4.2",
|
|
106
102
|
"postcss-html": "^1.4.1",
|
|
107
103
|
"prettier": "^2.6.2",
|
|
108
104
|
"prettier-plugin-jsdoc": "^0.3.38",
|
|
109
105
|
"prettier-plugin-md-nocjsp": "^1.2.0",
|
|
110
|
-
"prettier-plugin-sort-imports": "^1.6.
|
|
106
|
+
"prettier-plugin-sort-imports": "^1.6.1",
|
|
111
107
|
"rimraf": "^3.0.2",
|
|
108
|
+
"rollup-plugin-visualizer": "^5.6.0",
|
|
112
109
|
"sass": "1.32.12",
|
|
113
|
-
"stylelint": "^14.
|
|
110
|
+
"stylelint": "^14.8.5",
|
|
114
111
|
"stylelint-config-prettier": "^9.0.3",
|
|
115
112
|
"stylelint-config-recommended-scss": "^6.0.0",
|
|
116
113
|
"stylelint-config-recommended-vue": "^1.4.0",
|
|
117
114
|
"stylelint-order": "^5.0.0",
|
|
118
115
|
"stylelint-prettier": "^2.0.0",
|
|
119
|
-
"typescript": "^4.
|
|
120
|
-
"unplugin-vue-components": "^0.19.
|
|
121
|
-
"vite": "^2.9.
|
|
122
|
-
"vite-plugin-
|
|
123
|
-
"vite-plugin-
|
|
116
|
+
"typescript": "^4.7.2",
|
|
117
|
+
"unplugin-vue-components": "^0.19.6",
|
|
118
|
+
"vite": "^2.9.9",
|
|
119
|
+
"vite-plugin-checker": "^0.4.6",
|
|
120
|
+
"vite-plugin-stylelint": "^2.2.3",
|
|
121
|
+
"vite-plugin-vue2": "^2.0.1",
|
|
124
122
|
"vue": "^2.6.14",
|
|
125
|
-
"vue-codemirror6": "0.1.
|
|
126
|
-
"vue-eslint-parser": "^
|
|
123
|
+
"vue-codemirror6": "0.1.6",
|
|
124
|
+
"vue-eslint-parser": "^9.0.2",
|
|
127
125
|
"vue-template-compiler": "^2.6.14",
|
|
128
|
-
"vue-tsc": "^0.34.
|
|
126
|
+
"vue-tsc": "^0.34.17",
|
|
127
|
+
"vuetify": "^2.6.6"
|
|
129
128
|
},
|
|
130
129
|
"husky": {
|
|
131
130
|
"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
|
};
|
package/dist/v-swatches.umd.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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,f,V){"use strict";function y(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var t=y(V),S=l.defineComponent({name:"VSwatches",components:{VSheet:f.VSheet,VBtn:f.VBtn,VIcon:f.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]]},size:{type:String,default:"2rem"},icon:{type:String,default:"mdi-checkbox-marked-circle"},iconSize:{type:String,default:"1rem"}},emits:["update:modelValue"],setup(e,s){const o=l.ref(!1),_=l.ref(e.swatches),i=l.ref(e.modelValue);return{checkedVisibilty:o,palette:_,selected:i,onSwatchClick:h=>{const c=h.target.value;!c||i.value===c||(i.value=c,s.emit("update:modelValue",c))}}}}),w=function(){var e=this,s=e.$createElement,o=e._self._c||s;return o(f.VSheet,{staticClass:"v-swatches"},e._l(e.palette,function(_,i){return o("div",{key:i},e._l(_,function(u){return o(f.VBtn,{key:u,attrs:{elevation:"1",width:e.size,height:e.size,color:u,value:u,"min-width":"auto"},on:{click:e.onSwatchClick}},[u===e.selected?o(f.VIcon,{attrs:{size:e.iconSize,color:u},domProps:{textContent:e._s(e.icon)}}):e._e()],1)}),1)}),0)},g=[],q="";function C(e,s,o,_,i,u,h,c){var a=typeof e=="function"?e.options:e;s&&(a.render=s,a.staticRenderFns=o,a._compiled=!0),_&&(a.functional=!0),u&&(a._scopeId="data-v-"+u);var d;if(h?(d=function(r){r=r||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!r&&typeof __VUE_SSR_CONTEXT__<"u"&&(r=__VUE_SSR_CONTEXT__),i&&i.call(this,r),r&&r._registeredComponents&&r._registeredComponents.add(h)},a._ssrRegister=d):i&&(d=c?function(){i.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:i),d)if(a.functional){a._injectStyles=d;var $=a.render;a.render=function(R,b){return d.call(b),$(R,b)}}else{var m=a.beforeCreate;a.beforeCreate=m?[].concat(m,d):[d]}return{exports:e,options:a}}const v={};var k=C(S,w,g,!1,z,null,null,null);function z(e){for(let s in v)this[s]=v[s]}var p=function(){return k.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
|
-
*/l.install();const T=e=>{e.component("VSwatches",p)};n.VSwatches=p,n.default=p,n.install=T,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|