vuetify-swatches 0.0.10 → 0.0.11
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.
|
@@ -4,7 +4,7 @@ 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: {
|
|
@@ -33,13 +33,12 @@ declare const _default: import("vue/types/v3-define-component").DefineComponent<
|
|
|
33
33
|
};
|
|
34
34
|
}, {
|
|
35
35
|
checkedVisibilty: Ref<boolean>;
|
|
36
|
-
selected: Ref<string>;
|
|
37
36
|
onSwatchClick: (e: Event) => void;
|
|
38
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: {
|
|
@@ -67,6 +66,7 @@ declare const _default: import("vue/types/v3-define-component").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;;IAgBnB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,2CAA2C;;;;;IAE3C,mBAAmB;;;;;IAEnB,oBAAoB;;;;;IAEpB,yBAAyB
|
|
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.es.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2022 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 0.
|
|
8
|
+
* @version 0.0.11
|
|
9
9
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -24,7 +24,7 @@ var _sfc_main = defineComponent({
|
|
|
24
24
|
event: "update:modelValue"
|
|
25
25
|
},
|
|
26
26
|
props: {
|
|
27
|
-
modelValue: { type: String,
|
|
27
|
+
modelValue: { type: String, default: "#ffffff" },
|
|
28
28
|
swatches: {
|
|
29
29
|
type: Array,
|
|
30
30
|
default: () => [
|
|
@@ -60,18 +60,15 @@ var _sfc_main = defineComponent({
|
|
|
60
60
|
emits: ["update:modelValue"],
|
|
61
61
|
setup(props, context) {
|
|
62
62
|
const checkedVisibilty = ref(false);
|
|
63
|
-
const selected = ref(props.modelValue);
|
|
64
63
|
const onSwatchClick = (e) => {
|
|
65
64
|
const value = e.target.value;
|
|
66
|
-
if (!value ||
|
|
65
|
+
if (!value || props.modelValue === value) {
|
|
67
66
|
return;
|
|
68
67
|
}
|
|
69
|
-
selected.value = value;
|
|
70
68
|
context.emit("update:modelValue", value);
|
|
71
69
|
};
|
|
72
70
|
return {
|
|
73
71
|
checkedVisibilty,
|
|
74
|
-
selected,
|
|
75
72
|
onSwatchClick
|
|
76
73
|
};
|
|
77
74
|
}
|
|
@@ -133,7 +130,9 @@ var _sfc_render = function render() {
|
|
|
133
130
|
_vm._self._setupProxy;
|
|
134
131
|
return _c(VSheet, { staticClass: "v-swatches" }, _vm._l(_vm.swatches, function(colors2, rows) {
|
|
135
132
|
return _c("div", { key: rows }, _vm._l(colors2, function(color) {
|
|
136
|
-
return _c(VBtn, { key: color, attrs: { "elevation": _vm.elevation, "width": _vm.size, "height": _vm.size, "color": color, "value": color, "min-width": "auto" }, on: { "click":
|
|
133
|
+
return _c(VBtn, { key: color, attrs: { "elevation": _vm.elevation, "width": _vm.size, "height": _vm.size, "color": color, "value": color, "min-width": "auto" }, on: { "click": function($event) {
|
|
134
|
+
return _vm.onSwatchClick($event);
|
|
135
|
+
} } }, [color === _vm.modelValue ? _c(VIcon, { attrs: { "size": _vm.iconSize, "color": color } }, [_vm._v(" " + _vm._s(_vm.icon) + " ")]) : _vm._e()], 1);
|
|
137
136
|
}), 1);
|
|
138
137
|
}), 0);
|
|
139
138
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2022 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 0.
|
|
8
|
+
* @version 0.0.11
|
|
9
9
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
(function(
|
|
13
|
-
`)();function
|
|
12
|
+
(function(u,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vuetify/lib"),require("vue"),require("vuetify/lib/util/colors")):typeof define=="function"&&define.amd?define(["exports","vuetify/lib","vue","vuetify/lib/util/colors"],l):(u=typeof globalThis<"u"?globalThis:u||self,l(u.VSwatches={},u.Vuetify,u.Vue,u.colors))})(this,function(u,l,p,m){"use strict";function b(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var e=b(m),V=p.defineComponent({name:"VSwatches",components:{VSheet:l.VSheet,VBtn:l.VBtn,VIcon:l.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:p.ref(!1),onSwatchClick:s=>{const i=s.target.value;!i||n.modelValue===i||t.emit("update:modelValue",i)}}}}),R=(()=>`.v-swatches .v-btn{padding:0!important;margin:.1rem}.v-swatches .v-btn .v-icon{filter:invert(100%)}
|
|
13
|
+
`)();function y(n,t,f,d,s,i,c,k){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 r;if(c?(r=function(o){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__),s&&s.call(this,o),o&&o._registeredComponents&&o._registeredComponents.add(c)},a._ssrRegister=r):s&&(r=k?function(){s.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:s),r)if(a.functional){a._injectStyles=r;var z=a.render;a.render=function(T,v){return r.call(v),z(T,v)}}else{var h=a.beforeCreate;a.beforeCreate=h?[].concat(h,r):[r]}return{exports:n,options:a}}var w=function(){var t=this,f=t._self._c;return t._self._setupProxy,f(l.VSheet,{staticClass:"v-swatches"},t._l(t.swatches,function(d,s){return f("div",{key:s},t._l(d,function(i){return f(l.VBtn,{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(l.VIcon,{attrs:{size:t.iconSize,color:i}},[t._v(" "+t._s(t.icon)+" ")]):t._e()],1)}),1)}),0)},S=[],g=y(V,w,S,!1,null,null,null,null),_=g.exports;const C=n=>n.component("VSwatches",_);typeof window<"u"&&window.Vue&&window.Vue.use(_),u.default=_,u.install=C,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/style.css
CHANGED
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.0.
|
|
4
|
+
"version": "0.0.11",
|
|
5
5
|
"description": "Color Swatch component for Vuetify.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"vuejs",
|
|
@@ -70,26 +70,28 @@
|
|
|
70
70
|
"prepare": "husky install"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"vue": "^2.7.
|
|
73
|
+
"vue": "^2.7.3",
|
|
74
74
|
"vuetify": "^2.6.7"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
+
"@codemirror/basic-setup": "^0.20.0",
|
|
77
78
|
"@codemirror/lang-html": "^6.1.0",
|
|
78
|
-
"@types/node": "^18.0.
|
|
79
|
+
"@types/node": "^18.0.3",
|
|
79
80
|
"@typescript-eslint/eslint-plugin": "^5.30.5",
|
|
80
81
|
"@typescript-eslint/parser": "^5.30.5",
|
|
81
82
|
"@vitejs/plugin-vue2": "^1.1.2",
|
|
82
83
|
"@vue/eslint-config-prettier": "^7.0.0",
|
|
84
|
+
"codemirror": "^6.0.1",
|
|
83
85
|
"eslint": "^8.19.0",
|
|
84
86
|
"eslint-config-google": "^0.14.0",
|
|
85
87
|
"eslint-config-prettier": "^8.5.0",
|
|
86
88
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
87
|
-
"eslint-import-resolver-typescript": "^3.2.
|
|
89
|
+
"eslint-import-resolver-typescript": "^3.2.4",
|
|
88
90
|
"eslint-plugin-html": "^6.2.0",
|
|
89
91
|
"eslint-plugin-import": "^2.26.0",
|
|
90
92
|
"eslint-plugin-jsdoc": "^39.3.3",
|
|
91
93
|
"eslint-plugin-tsdoc": "^0.2.16",
|
|
92
|
-
"eslint-plugin-vue": "^9.
|
|
94
|
+
"eslint-plugin-vue": "^9.2.0",
|
|
93
95
|
"eslint-plugin-vuejs-accessibility": "^1.2.0",
|
|
94
96
|
"eslint-plugin-vuetify": "^1.1.0",
|
|
95
97
|
"eslint-plugin-yaml": "^0.5.0",
|
|
@@ -107,14 +109,14 @@
|
|
|
107
109
|
"stylelint-order": "^5.0.0",
|
|
108
110
|
"stylelint-prettier": "^2.0.0",
|
|
109
111
|
"typescript": "^4.7.4",
|
|
110
|
-
"unplugin-vue-components": "^0.21.
|
|
112
|
+
"unplugin-vue-components": "^0.21.1",
|
|
111
113
|
"vite": "^2.9.13",
|
|
112
114
|
"vite-plugin-banner": "^0.3.0",
|
|
113
115
|
"vite-plugin-checker": "^0.4.8",
|
|
114
|
-
"vue": "^2.7.
|
|
115
|
-
"vue-codemirror6": "0.6.
|
|
116
|
+
"vue": "^2.7.3",
|
|
117
|
+
"vue-codemirror6": "0.6.6",
|
|
116
118
|
"vue-eslint-parser": "^9.0.3",
|
|
117
|
-
"vue-template-compiler": "^2.7.
|
|
119
|
+
"vue-template-compiler": "^2.7.3",
|
|
118
120
|
"vue-tsc": "^0.38.2",
|
|
119
121
|
"vuetify": "^2.6.7"
|
|
120
122
|
},
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
:color="color"
|
|
11
11
|
:value="color"
|
|
12
12
|
min-width="auto"
|
|
13
|
-
@click="onSwatchClick"
|
|
13
|
+
@click="onSwatchClick($event)"
|
|
14
14
|
>
|
|
15
|
-
<v-icon v-if="color ===
|
|
15
|
+
<v-icon v-if="color === modelValue" :size="iconSize" :color="color">
|
|
16
16
|
{{ icon }}
|
|
17
17
|
</v-icon>
|
|
18
18
|
</v-btn>
|
|
@@ -49,7 +49,7 @@ export default defineComponent({
|
|
|
49
49
|
},
|
|
50
50
|
props: {
|
|
51
51
|
/** Model value */
|
|
52
|
-
modelValue: { type: String,
|
|
52
|
+
modelValue: { type: String, default: '#ffffff' },
|
|
53
53
|
/** Swatch colors */
|
|
54
54
|
swatches: {
|
|
55
55
|
type: Array as PropType<string[] | string[][]>,
|
|
@@ -95,12 +95,9 @@ export default defineComponent({
|
|
|
95
95
|
* @param context - Context
|
|
96
96
|
*/
|
|
97
97
|
setup(props, context: SetupContext) {
|
|
98
|
-
/**
|
|
98
|
+
/** Check icon visibility */
|
|
99
99
|
const checkedVisibilty: Ref<boolean> = ref(false);
|
|
100
100
|
|
|
101
|
-
/** Selected color */
|
|
102
|
-
const selected: Ref<string> = ref(props.modelValue);
|
|
103
|
-
|
|
104
101
|
/**
|
|
105
102
|
* ボタンがクリックされた
|
|
106
103
|
*
|
|
@@ -108,16 +105,14 @@ export default defineComponent({
|
|
|
108
105
|
*/
|
|
109
106
|
const onSwatchClick = (e: Event) => {
|
|
110
107
|
const value = (e.target as HTMLButtonElement).value;
|
|
111
|
-
if (!value ||
|
|
108
|
+
if (!value || props.modelValue === value) {
|
|
112
109
|
return;
|
|
113
110
|
}
|
|
114
|
-
selected.value = value;
|
|
115
111
|
context.emit('update:modelValue', value);
|
|
116
112
|
};
|
|
117
113
|
|
|
118
114
|
return {
|
|
119
115
|
checkedVisibilty,
|
|
120
|
-
selected,
|
|
121
116
|
onSwatchClick,
|
|
122
117
|
};
|
|
123
118
|
},
|