vuetify-swatches 0.0.4 → 0.0.5
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/dist/components/VSwatches.vue.d.ts +64 -0
- package/dist/components/VSwatches.vue.d.ts.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/dist/v-swatches.es.js +179 -0
- package/dist/v-swatches.umd.js +8 -0
- package/package.json +13 -9
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { 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
|
+
palette: Ref<string[] | string[][]>;
|
|
5
|
+
selected: Ref<string>;
|
|
6
|
+
onSwatchClick: (e: Event) => void;
|
|
7
|
+
}> & import("@vue/composition-api").Data, {}, {}, {
|
|
8
|
+
/** Model value */
|
|
9
|
+
modelValue: {
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
/** Swatch colors */
|
|
14
|
+
swatches: {
|
|
15
|
+
type: () => string[] | string[][];
|
|
16
|
+
default: () => string[][];
|
|
17
|
+
};
|
|
18
|
+
/** Swatch sized */
|
|
19
|
+
size: {
|
|
20
|
+
type: StringConstructor;
|
|
21
|
+
default: string;
|
|
22
|
+
};
|
|
23
|
+
/** selected icon */
|
|
24
|
+
icon: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
default: string;
|
|
27
|
+
};
|
|
28
|
+
/** selected icon size */
|
|
29
|
+
iconSize: {
|
|
30
|
+
type: StringConstructor;
|
|
31
|
+
default: string;
|
|
32
|
+
};
|
|
33
|
+
}, {
|
|
34
|
+
modelValue: string;
|
|
35
|
+
swatches: string[] | string[][];
|
|
36
|
+
size: string;
|
|
37
|
+
icon: string;
|
|
38
|
+
iconSize: string;
|
|
39
|
+
} & {}> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
40
|
+
modelValue: string;
|
|
41
|
+
swatches: string[] | string[][];
|
|
42
|
+
size: string;
|
|
43
|
+
icon: string;
|
|
44
|
+
iconSize: string;
|
|
45
|
+
} & {}, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
46
|
+
checkedVisibilty: Ref<boolean>;
|
|
47
|
+
palette: Ref<string[] | string[][]>;
|
|
48
|
+
selected: Ref<string>;
|
|
49
|
+
onSwatchClick: (e: Event) => void;
|
|
50
|
+
}>, import("@vue/composition-api").Data, {}, {}, {}, {}, {}, {
|
|
51
|
+
modelValue: string;
|
|
52
|
+
swatches: string[] | string[][];
|
|
53
|
+
size: string;
|
|
54
|
+
icon: string;
|
|
55
|
+
iconSize: string;
|
|
56
|
+
} & {}, {
|
|
57
|
+
swatches: string[] | string[][];
|
|
58
|
+
size: string;
|
|
59
|
+
icon: string;
|
|
60
|
+
iconSize: string;
|
|
61
|
+
}, true>);
|
|
62
|
+
/** Vuetify Swatches */
|
|
63
|
+
export default _default;
|
|
64
|
+
//# 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,EAA2C,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;;;;;uBAgF/C,KAAK;;IA3D/B,kBAAkB;;;;;IAElB,oBAAoB;;oBAEG,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE;;;IA0B5C,mBAAmB;;;;;IAEnB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;;;;;;;;;;;;;;;;;uBAyBC,KAAK;;;;;;;;;;;;;AA3EnC,uBAAuB;AACvB,wBA0FG"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
import { App } from 'vue-demi';
|
|
11
|
+
declare const installVSwatches: (app: App) => void;
|
|
12
|
+
export { VSwatches, installVSwatches as install };
|
|
13
|
+
export default VSwatches;
|
|
14
|
+
//# 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;AACnD,OAAO,EAAW,GAAG,EAAE,MAAM,UAAU,CAAC;AAIxC,QAAA,MAAM,gBAAgB,QAAS,GAAG,SAEjC,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,gBAAgB,IAAI,OAAO,EAAE,CAAC;AAClD,eAAe,SAAS,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,179 @@
|
|
|
1
|
+
import { defineComponent, ref, 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
|
+
size: { type: String, default: "2rem" },
|
|
45
|
+
icon: { type: String, default: "mdi-checkbox-marked-circle" },
|
|
46
|
+
iconSize: { type: String, default: "1rem" }
|
|
47
|
+
},
|
|
48
|
+
emits: ["update:modelValue"],
|
|
49
|
+
setup(props, context) {
|
|
50
|
+
const checkedVisibilty = ref(false);
|
|
51
|
+
const palette = ref(props.swatches);
|
|
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
|
+
palette,
|
|
64
|
+
selected,
|
|
65
|
+
onSwatchClick
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
var render = function() {
|
|
70
|
+
var _vm = this;
|
|
71
|
+
var _h = _vm.$createElement;
|
|
72
|
+
var _c = _vm._self._c || _h;
|
|
73
|
+
return _c(VSheet, {
|
|
74
|
+
staticClass: "v-swatches"
|
|
75
|
+
}, _vm._l(_vm.palette, function(colors2, rows) {
|
|
76
|
+
return _c("div", {
|
|
77
|
+
key: rows
|
|
78
|
+
}, _vm._l(colors2, function(color) {
|
|
79
|
+
return _c(VBtn, {
|
|
80
|
+
key: color,
|
|
81
|
+
attrs: {
|
|
82
|
+
"elevation": "1",
|
|
83
|
+
"width": _vm.size,
|
|
84
|
+
"height": _vm.size,
|
|
85
|
+
"color": color,
|
|
86
|
+
"value": color,
|
|
87
|
+
"min-width": "auto"
|
|
88
|
+
},
|
|
89
|
+
on: {
|
|
90
|
+
"click": _vm.onSwatchClick
|
|
91
|
+
}
|
|
92
|
+
}, [color === _vm.selected ? _c(VIcon, {
|
|
93
|
+
attrs: {
|
|
94
|
+
"size": _vm.iconSize,
|
|
95
|
+
"color": color
|
|
96
|
+
},
|
|
97
|
+
domProps: {
|
|
98
|
+
"textContent": _vm._s(_vm.icon)
|
|
99
|
+
}
|
|
100
|
+
}) : _vm._e()], 1);
|
|
101
|
+
}), 1);
|
|
102
|
+
}), 0);
|
|
103
|
+
};
|
|
104
|
+
var staticRenderFns = [];
|
|
105
|
+
var VSwatches_vue_vue_type_style_index_0_lang = "";
|
|
106
|
+
function normalizeComponent(scriptExports, render2, staticRenderFns2, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
107
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
108
|
+
if (render2) {
|
|
109
|
+
options.render = render2;
|
|
110
|
+
options.staticRenderFns = staticRenderFns2;
|
|
111
|
+
options._compiled = true;
|
|
112
|
+
}
|
|
113
|
+
if (functionalTemplate) {
|
|
114
|
+
options.functional = true;
|
|
115
|
+
}
|
|
116
|
+
if (scopeId) {
|
|
117
|
+
options._scopeId = "data-v-" + scopeId;
|
|
118
|
+
}
|
|
119
|
+
var hook;
|
|
120
|
+
if (moduleIdentifier) {
|
|
121
|
+
hook = function(context) {
|
|
122
|
+
context = context || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
|
|
123
|
+
if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
|
|
124
|
+
context = __VUE_SSR_CONTEXT__;
|
|
125
|
+
}
|
|
126
|
+
if (injectStyles) {
|
|
127
|
+
injectStyles.call(this, context);
|
|
128
|
+
}
|
|
129
|
+
if (context && context._registeredComponents) {
|
|
130
|
+
context._registeredComponents.add(moduleIdentifier);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
options._ssrRegister = hook;
|
|
134
|
+
} else if (injectStyles) {
|
|
135
|
+
hook = shadowMode ? function() {
|
|
136
|
+
injectStyles.call(this, (options.functional ? this.parent : this).$root.$options.shadowRoot);
|
|
137
|
+
} : injectStyles;
|
|
138
|
+
}
|
|
139
|
+
if (hook) {
|
|
140
|
+
if (options.functional) {
|
|
141
|
+
options._injectStyles = hook;
|
|
142
|
+
var originalRender = options.render;
|
|
143
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
144
|
+
hook.call(context);
|
|
145
|
+
return originalRender(h, context);
|
|
146
|
+
};
|
|
147
|
+
} else {
|
|
148
|
+
var existing = options.beforeCreate;
|
|
149
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
exports: scriptExports,
|
|
154
|
+
options
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
const __cssModules = {};
|
|
158
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles, null, null, null);
|
|
159
|
+
function __vue2_injectStyles(context) {
|
|
160
|
+
for (let o in __cssModules) {
|
|
161
|
+
this[o] = __cssModules[o];
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
var VSwatches = /* @__PURE__ */ function() {
|
|
165
|
+
return __component__.exports;
|
|
166
|
+
}();
|
|
167
|
+
/**
|
|
168
|
+
* Vuetify Swatches Component
|
|
169
|
+
*
|
|
170
|
+
* @license MIT
|
|
171
|
+
* @author Logue {@link logue@hotmail.co.jp}
|
|
172
|
+
* @copyright 2022 Masashi Yoshikawa {@link https://logue.dev/} All rights reserved.
|
|
173
|
+
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
174
|
+
*/
|
|
175
|
+
install();
|
|
176
|
+
const installVSwatches = (app) => {
|
|
177
|
+
app.component("VSwatches", VSwatches);
|
|
178
|
+
};
|
|
179
|
+
export { VSwatches, 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,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"}})});
|
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.5",
|
|
6
6
|
"description": "Color Swatch component for Vuetify.",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"vuejs",
|
|
@@ -34,21 +34,25 @@
|
|
|
34
34
|
"node": ">=16"
|
|
35
35
|
},
|
|
36
36
|
"license": "MIT",
|
|
37
|
-
"main": "./dist/
|
|
38
|
-
"module": "./dist/
|
|
37
|
+
"main": "./dist/v-swatches.umd.js",
|
|
38
|
+
"module": "./dist/v-swatches.es.js",
|
|
39
39
|
"browser": {
|
|
40
40
|
"./sfc": "./src/components/VSwatches.vue"
|
|
41
41
|
},
|
|
42
42
|
"exports": {
|
|
43
43
|
".": {
|
|
44
|
-
"import": "./dist/
|
|
45
|
-
"require": "./dist/
|
|
44
|
+
"import": "./dist/v-swatches.es.js",
|
|
45
|
+
"require": "./dist/v-swatches.umd.js"
|
|
46
|
+
},
|
|
47
|
+
"./dist/style.css": {
|
|
48
|
+
"import": "./dist/style.css",
|
|
49
|
+
"require": "./dist/style.css"
|
|
46
50
|
}
|
|
47
51
|
},
|
|
48
|
-
"types": "./
|
|
52
|
+
"types": "./dist/index.d.ts",
|
|
49
53
|
"files": [
|
|
50
|
-
"
|
|
51
|
-
"
|
|
54
|
+
"dist",
|
|
55
|
+
"src/components/VSwatches.vue"
|
|
52
56
|
],
|
|
53
57
|
"sideEffects": false,
|
|
54
58
|
"scripts": {
|
|
@@ -118,7 +122,7 @@
|
|
|
118
122
|
"vite-plugin-stylelint": "^2.2.0",
|
|
119
123
|
"vite-plugin-vue2": "^2.0.0",
|
|
120
124
|
"vue": "^2.6.14",
|
|
121
|
-
"vue-codemirror6": "0.1.
|
|
125
|
+
"vue-codemirror6": "0.1.4",
|
|
122
126
|
"vue-eslint-parser": "^8.3.0",
|
|
123
127
|
"vue-template-compiler": "^2.6.14",
|
|
124
128
|
"vue-tsc": "^0.34.10"
|