vuetify-swatches 0.0.2 → 0.0.3
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/style.css +2 -2
- package/dist/v-swatches.es.js +26651 -0
- package/dist/v-swatches.umd.js +23 -0
- package/package.json +36 -23
- package/src/components/VSwatches.vue +90 -69
- package/dist/VSwatches.es.js +0 -3144
- package/dist/VSwatches.umd.js +0 -33
- package/dist/components/VSwatches.vue.d.ts +0 -23
- package/dist/components/VSwatches.vue.d.ts.map +0 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +0 -1
- package/dist/index.esm.d.ts +0 -6
- package/dist/index.esm.d.ts.map +0 -1
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.3",
|
|
6
6
|
"description": "Color Swatch component for Vuetify.",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"vuejs",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"sideEffects": false,
|
|
54
54
|
"scripts": {
|
|
55
55
|
"dev": "vite",
|
|
56
|
+
"clean": "rimraf node_modules/.vite",
|
|
56
57
|
"build": "vite build & vue-tsc",
|
|
57
58
|
"build:clean": "rimraf dist && rimraf types",
|
|
58
59
|
"lint": "eslint . --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint && prettier . --write",
|
|
@@ -60,55 +61,67 @@
|
|
|
60
61
|
"lint:markup": "vue-tsc --noEmit",
|
|
61
62
|
"prepare": "husky install"
|
|
62
63
|
},
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"vue-demi": "latest"
|
|
66
|
+
},
|
|
67
|
+
"peerDependencies": {
|
|
68
|
+
"@vue/composition-api": "^1.4.9",
|
|
69
|
+
"vue": "^2.6.14 || ^3.2.31",
|
|
70
|
+
"vuetify": "^2.6.4"
|
|
71
|
+
},
|
|
72
|
+
"peerDependenciesMeta": {
|
|
73
|
+
"@vue/composition-api": {
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
63
77
|
"devDependencies": {
|
|
64
|
-
"@
|
|
65
|
-
"@
|
|
66
|
-
"@
|
|
67
|
-
"@
|
|
78
|
+
"@codemirror/basic-setup": "^0.19.3",
|
|
79
|
+
"@codemirror/lang-html": "^0.19.4",
|
|
80
|
+
"@modyqyw/vite-plugin-eslint": "^1.2.0",
|
|
81
|
+
"@types/node": "^17.0.25",
|
|
82
|
+
"@typescript-eslint/eslint-plugin": "^5.20.0",
|
|
83
|
+
"@typescript-eslint/parser": "^5.20.0",
|
|
84
|
+
"@vue/composition-api": "^1.4.9",
|
|
68
85
|
"@vue/eslint-config-typescript": "^10.0.0",
|
|
69
|
-
"eslint": "^8.
|
|
86
|
+
"eslint": "^8.13.0",
|
|
70
87
|
"eslint-config-google": "^0.14.0",
|
|
71
88
|
"eslint-config-prettier": "^8.5.0",
|
|
72
89
|
"eslint-config-vuetify": "^0.6.1",
|
|
73
90
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
74
|
-
"eslint-import-resolver-typescript": "^2.7.
|
|
75
|
-
"eslint-plugin-import": "^2.
|
|
91
|
+
"eslint-import-resolver-typescript": "^2.7.1",
|
|
92
|
+
"eslint-plugin-import": "^2.26.0",
|
|
76
93
|
"eslint-plugin-prettier": "^4.0.0",
|
|
77
94
|
"eslint-plugin-prettier-vue": "^3.1.0",
|
|
78
|
-
"eslint-plugin-tsdoc": "^0.2.
|
|
79
|
-
"eslint-plugin-vue": "^8.
|
|
95
|
+
"eslint-plugin-tsdoc": "^0.2.16",
|
|
96
|
+
"eslint-plugin-vue": "^8.6.0",
|
|
80
97
|
"eslint-plugin-vuejs-accessibility": "^1.1.1",
|
|
81
98
|
"eslint-plugin-vuetify": "^1.1.0",
|
|
82
99
|
"eslint-plugin-yaml": "^0.5.0",
|
|
83
100
|
"husky": "^7.0.4",
|
|
84
|
-
"lint-staged": "^12.3.
|
|
85
|
-
"postcss-html": "^1.
|
|
86
|
-
"prettier": "^2.6.
|
|
87
|
-
"prettier-plugin-jsdoc": "^0.3.
|
|
101
|
+
"lint-staged": "^12.3.8",
|
|
102
|
+
"postcss-html": "^1.4.1",
|
|
103
|
+
"prettier": "^2.6.2",
|
|
104
|
+
"prettier-plugin-jsdoc": "^0.3.38",
|
|
88
105
|
"prettier-plugin-md-nocjsp": "^1.2.0",
|
|
89
106
|
"prettier-plugin-sort-imports": "^1.6.0",
|
|
90
107
|
"rimraf": "^3.0.2",
|
|
91
108
|
"sass": "1.32.12",
|
|
92
|
-
"stylelint": "^14.
|
|
109
|
+
"stylelint": "^14.7.1",
|
|
93
110
|
"stylelint-config-prettier": "^9.0.3",
|
|
94
111
|
"stylelint-config-recommended-scss": "^6.0.0",
|
|
95
112
|
"stylelint-config-recommended-vue": "^1.4.0",
|
|
96
113
|
"stylelint-order": "^5.0.0",
|
|
97
114
|
"stylelint-prettier": "^2.0.0",
|
|
98
115
|
"typescript": "^4.6.3",
|
|
99
|
-
"unplugin-vue-components": "^0.
|
|
100
|
-
"vite": "^2.9.
|
|
101
|
-
"vite-plugin-eslint": "^1.3.0",
|
|
116
|
+
"unplugin-vue-components": "^0.19.3",
|
|
117
|
+
"vite": "^2.9.5",
|
|
102
118
|
"vite-plugin-stylelint": "^2.1.0",
|
|
103
119
|
"vite-plugin-vue2": "^1.9.3",
|
|
104
120
|
"vue": "^2.6.14",
|
|
105
|
-
"vue-
|
|
106
|
-
"vue-codemirror6": "0.1.0",
|
|
121
|
+
"vue-codemirror6": "0.1.3",
|
|
107
122
|
"vue-eslint-parser": "^8.3.0",
|
|
108
|
-
"vue-property-decorator": "^9.1.2",
|
|
109
123
|
"vue-template-compiler": "^2.6.14",
|
|
110
|
-
"vue-tsc": "^0.
|
|
111
|
-
"vuetify": "^2.6.4"
|
|
124
|
+
"vue-tsc": "^0.34.7"
|
|
112
125
|
},
|
|
113
126
|
"husky": {
|
|
114
127
|
"hooks": {
|
|
@@ -24,93 +24,114 @@
|
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script lang="ts">
|
|
27
|
-
import {
|
|
27
|
+
import { ref, defineComponent, type SetupContext, type Ref } from 'vue-demi';
|
|
28
28
|
|
|
29
29
|
import { VSheet, VIcon, VBtn } from 'vuetify/lib';
|
|
30
30
|
import colors from 'vuetify/lib/util/colors';
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
/** Vuetify Swatches */
|
|
33
|
+
export default defineComponent({
|
|
34
|
+
/** Component name */
|
|
33
35
|
name: 'VSwatches',
|
|
36
|
+
/** Components */
|
|
34
37
|
components: {
|
|
35
38
|
VSheet,
|
|
36
39
|
VBtn,
|
|
37
40
|
VIcon,
|
|
38
41
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
[
|
|
50
|
-
[
|
|
51
|
-
colors.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
42
|
+
/** Model Definition */
|
|
43
|
+
model: {
|
|
44
|
+
prop: 'modelValue',
|
|
45
|
+
event: 'update:modelValue',
|
|
46
|
+
},
|
|
47
|
+
props: {
|
|
48
|
+
/** Model value */
|
|
49
|
+
modelValue: { type: String, required: true },
|
|
50
|
+
/** Swatch colors */
|
|
51
|
+
swatches: {
|
|
52
|
+
type: Array as () => string[] | string[][],
|
|
53
|
+
default: () => [
|
|
54
|
+
[colors.shades.black, colors.shades.white],
|
|
55
|
+
[
|
|
56
|
+
colors.red.base,
|
|
57
|
+
colors.pink.base,
|
|
58
|
+
colors.purple.base,
|
|
59
|
+
colors.deepPurple.base,
|
|
60
|
+
colors.indigo.base,
|
|
61
|
+
colors.blue.base,
|
|
62
|
+
colors.lightBlue.base,
|
|
63
|
+
colors.cyan.base,
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
colors.teal.base,
|
|
67
|
+
colors.green.base,
|
|
68
|
+
colors.lightGreen.base,
|
|
69
|
+
colors.lime.base,
|
|
70
|
+
colors.yellow.base,
|
|
71
|
+
colors.amber.base,
|
|
72
|
+
colors.orange.base,
|
|
73
|
+
colors.deepOrange.base,
|
|
74
|
+
],
|
|
75
|
+
[colors.brown.base, colors.blueGrey.base, colors.grey.base],
|
|
69
76
|
],
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
},
|
|
78
|
+
/** Swatch sized */
|
|
79
|
+
size: { type: String, default: '2rem' },
|
|
80
|
+
/** selected icon */
|
|
81
|
+
icon: { type: String, default: 'mdi-checkbox-marked-circle' },
|
|
82
|
+
/** selected icon size */
|
|
83
|
+
iconSize: { type: String, default: '1rem' },
|
|
84
|
+
},
|
|
85
|
+
/** Emits */
|
|
86
|
+
emits: ['update:modelValue'],
|
|
87
|
+
/**
|
|
88
|
+
* Setup
|
|
89
|
+
* @param props - Props
|
|
90
|
+
* @param context - Context
|
|
91
|
+
*/
|
|
92
|
+
setup(props, context: SetupContext) {
|
|
93
|
+
/** チェックアイコンの表示制御 */
|
|
94
|
+
const checkedVisibilty: Ref<boolean> = ref(false);
|
|
78
95
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
readonly size!: string;
|
|
96
|
+
/** Palette */
|
|
97
|
+
const palette: Ref<string[] | string[][]> = ref(props.swatches);
|
|
82
98
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
readonly icon!: string;
|
|
99
|
+
/** Selected color */
|
|
100
|
+
const selected: Ref<string> = ref(props.modelValue);
|
|
86
101
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
102
|
+
/**
|
|
103
|
+
* ボタンがクリックされた
|
|
104
|
+
*
|
|
105
|
+
* @param e - イベント
|
|
106
|
+
*/
|
|
107
|
+
const onSwatchClick = (e: Event) => {
|
|
108
|
+
const value = (e.target as HTMLButtonElement).value;
|
|
109
|
+
if (!value || selected.value === value) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
selected.value = value;
|
|
113
|
+
context.emit('update:modelValue', value);
|
|
114
|
+
};
|
|
90
115
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
this.selected = value;
|
|
102
|
-
this.$emit('input', value);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
116
|
+
return {
|
|
117
|
+
checkedVisibilty,
|
|
118
|
+
palette,
|
|
119
|
+
selected,
|
|
120
|
+
onSwatchClick,
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
});
|
|
105
124
|
</script>
|
|
106
125
|
|
|
107
|
-
<style lang="scss"
|
|
108
|
-
.v-
|
|
109
|
-
|
|
110
|
-
|
|
126
|
+
<style lang="scss">
|
|
127
|
+
.v-swatches {
|
|
128
|
+
.v-btn {
|
|
129
|
+
padding: 0 !important;
|
|
130
|
+
margin: 0.1rem;
|
|
111
131
|
|
|
112
|
-
|
|
113
|
-
|
|
132
|
+
.v-icon {
|
|
133
|
+
filter: invert(100%);
|
|
134
|
+
}
|
|
114
135
|
}
|
|
115
136
|
}
|
|
116
137
|
</style>
|