vuetify-swatches 0.0.6 → 0.3.0

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/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "vuetify-swatches",
4
- "private": false,
5
- "version": "0.0.6",
6
- "description": "Color Swatch component for Vuetify.",
4
+ "version": "0.3.0",
5
+ "description": "Color Swatch component for Vuetify3.",
7
6
  "keywords": [
8
7
  "vuejs",
9
8
  "vue",
@@ -11,10 +10,11 @@
11
10
  "color-picker",
12
11
  "color-palette",
13
12
  "swatches",
14
- "vue2",
13
+ "vue3",
15
14
  "vue-plugin",
16
15
  "vue-resource",
17
16
  "vuetify",
17
+ "vuetify3",
18
18
  "vuetify-components"
19
19
  ],
20
20
  "author": {
@@ -31,18 +31,20 @@
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
  },
37
+ "packageManager": "yarn@3.2.1",
36
38
  "license": "MIT",
37
- "main": "./dist/v-swatches.umd.js",
38
- "module": "./dist/v-swatches.es.js",
39
+ "main": "./dist/index.umd.js",
40
+ "module": "./dist/index.es.js",
39
41
  "browser": {
40
42
  "./sfc": "./src/components/VSwatches.vue"
41
43
  },
42
44
  "exports": {
43
45
  ".": {
44
- "import": "./dist/v-swatches.es.js",
45
- "require": "./dist/v-swatches.umd.js"
46
+ "import": "./dist/index.es.js",
47
+ "require": "./dist/index.umd.js"
46
48
  },
47
49
  "./dist/style.css": {
48
50
  "import": "./dist/style.css",
@@ -57,7 +59,7 @@
57
59
  "sideEffects": false,
58
60
  "scripts": {
59
61
  "dev": "vite",
60
- "clean": "rimraf node_modules/.vite",
62
+ "clean": "rimraf node_modules/.vite ",
61
63
  "build": "vite build & vue-tsc --declaration --emitDeclarationOnly",
62
64
  "build:analyze": "vue-tsc --noEmit && vite build --mode analyze",
63
65
  "build:docs": "vite build --config vite.config.docs.ts",
@@ -66,73 +68,57 @@
66
68
  "lint:style": "stylelint . --cache --cache-location ./node_modules/.vite/vite-plugin-stylelint",
67
69
  "lint:markup": "vue-tsc --noEmit",
68
70
  "preview": "vite preview --config vite.config.docs.ts",
69
- "prepare": "husky install",
70
- "postinstall": "npx vue-demi-fix"
71
- },
72
- "dependencies": {
73
- "vue-demi": "latest"
71
+ "prepare": "husky install"
74
72
  },
75
73
  "peerDependencies": {
76
- "@vue/composition-api": "latest",
77
- "vue": "^2.6.14",
78
- "vuetify": "^2.6.6"
79
- },
80
- "peerDependenciesMeta": {
81
- "@vue/composition-api": {
82
- "optional": true
83
- }
74
+ "vue": "^3.2.37",
75
+ "vuetify": "^3.0.0-beta.4"
84
76
  },
85
77
  "devDependencies": {
86
- "@codemirror/basic-setup": "^0.20.0",
87
- "@codemirror/lang-html": "^0.20.0",
88
- "@modyqyw/vite-plugin-eslint": "^1.3.2",
89
- "@types/node": "^17.0.35",
90
- "@typescript-eslint/eslint-plugin": "^5.25.0",
91
- "@typescript-eslint/parser": "^5.25.0",
92
- "@vue/composition-api": "^1.6.1",
93
- "@vue/eslint-config-typescript": "^10.0.0",
94
- "eslint": "^8.15.0",
78
+ "@codemirror/lang-html": "^6.1.0",
79
+ "@codemirror/state": "^6.0.1",
80
+ "@codemirror/view": "^6.0.2",
81
+ "@types/node": "^18.0.0",
82
+ "@typescript-eslint/eslint-plugin": "^5.30.0",
83
+ "@typescript-eslint/parser": "^5.30.0",
84
+ "@vitejs/plugin-vue": "^2.3.3",
85
+ "eslint": "^8.18.0",
95
86
  "eslint-config-google": "^0.14.0",
96
87
  "eslint-config-prettier": "^8.5.0",
97
- "eslint-config-vuetify": "^0.6.1",
98
88
  "eslint-import-resolver-alias": "^1.1.2",
99
- "eslint-import-resolver-typescript": "^2.7.1",
89
+ "eslint-import-resolver-typescript": "^3.1.1",
100
90
  "eslint-plugin-import": "^2.26.0",
101
- "eslint-plugin-prettier": "^4.0.0",
102
- "eslint-plugin-prettier-vue": "^3.1.0",
91
+ "eslint-plugin-jsdoc": "^39.3.3",
103
92
  "eslint-plugin-tsdoc": "^0.2.16",
104
- "eslint-plugin-vue": "^9.0.1",
105
- "eslint-plugin-vuejs-accessibility": "^1.1.1",
93
+ "eslint-plugin-vue": "^9.1.1",
94
+ "eslint-plugin-vuejs-accessibility": "^1.2.0",
106
95
  "eslint-plugin-vuetify": "^1.1.0",
107
96
  "eslint-plugin-yaml": "^0.5.0",
108
97
  "husky": "^8.0.1",
109
- "lint-staged": "^12.4.1",
98
+ "lint-staged": "^13.0.3",
110
99
  "postcss-html": "^1.4.1",
111
- "prettier": "^2.6.2",
100
+ "prettier": "^2.7.1",
112
101
  "prettier-plugin-jsdoc": "^0.3.38",
113
102
  "prettier-plugin-md-nocjsp": "^1.2.0",
114
- "prettier-plugin-sort-imports": "^1.6.0",
103
+ "prettier-plugin-sort-imports": "^1.7.0",
115
104
  "rimraf": "^3.0.2",
116
105
  "rollup-plugin-visualizer": "^5.6.0",
117
- "sass": "1.32.12",
118
- "stylelint": "^14.8.2",
106
+ "sass": "1.53.0",
107
+ "stylelint": "^14.9.1",
119
108
  "stylelint-config-prettier": "^9.0.3",
120
109
  "stylelint-config-recommended-scss": "^6.0.0",
121
110
  "stylelint-config-recommended-vue": "^1.4.0",
122
111
  "stylelint-order": "^5.0.0",
123
112
  "stylelint-prettier": "^2.0.0",
124
- "typescript": "^4.6.4",
125
- "unplugin-vue-components": "^0.19.5",
126
- "vite": "^2.9.9",
113
+ "typescript": "^4.7.4",
114
+ "vite": "^2.9.13",
127
115
  "vite-plugin-checker": "^0.4.6",
128
- "vite-plugin-stylelint": "^2.2.3",
129
- "vite-plugin-vue2": "^2.0.1",
130
- "vue": "^2.6.14",
131
- "vue-codemirror6": "0.1.6",
132
- "vue-eslint-parser": "^9.0.2",
133
- "vue-template-compiler": "^2.6.14",
134
- "vue-tsc": "^0.34.15",
135
- "vuetify": "^2.6.6"
116
+ "vite-plugin-vuetify": "^1.0.0-alpha.12",
117
+ "vue": "^3.2.37",
118
+ "vue-codemirror6": "0.6.4",
119
+ "vue-eslint-parser": "^9.0.3",
120
+ "vue-tsc": "^0.38.2",
121
+ "vuetify": "^3.0.0-beta.4"
136
122
  },
137
123
  "husky": {
138
124
  "hooks": {
@@ -144,5 +130,8 @@
144
130
  "*.{js,ts,json,yml,yaml,vue,htm,html}": "eslint --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint",
145
131
  "*.{css,sass,scss,vue,htm,html}": "stylelint --fix --cache --cache-location ./node_modules/.vite/vite-plugin-stylelint",
146
132
  "*": "prettier -w -u"
133
+ },
134
+ "resolutions": {
135
+ "prettier": "^2.7.1"
147
136
  }
148
137
  }
@@ -1,16 +1,15 @@
1
1
  <template>
2
2
  <v-sheet class="v-swatches">
3
- <div v-for="(colors, rows) in palette" :key="rows">
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="1"
7
+ :elevation="elevation"
8
8
  :width="size"
9
9
  :height="size"
10
10
  :color="color"
11
- :value="color"
12
11
  min-width="auto"
13
- @click="onSwatchClick"
12
+ @click="onSwatchClick(color)"
14
13
  >
15
14
  <v-icon v-if="color === selected" :size="iconSize" :color="color">
16
15
  {{ icon }}
@@ -21,21 +20,21 @@
21
20
  </template>
22
21
 
23
22
  <script lang="ts">
24
- import { ref, defineComponent, type SetupContext, type Ref } from 'vue-demi';
23
+ import {
24
+ defineComponent,
25
+ ref,
26
+ type PropType,
27
+ type Ref,
28
+ type SetupContext,
29
+ } from 'vue';
25
30
 
26
- import { VSheet, VIcon, VBtn } from 'vuetify/lib';
27
- import colors from 'vuetify/lib/util/colors';
31
+ // eslint-disable-next-line import/no-unresolved
32
+ import colors from 'vuetify/lib/util/colors.mjs';
28
33
 
29
34
  /** Vuetify Swatches */
30
35
  export default defineComponent({
31
36
  /** Component name */
32
37
  name: 'VSwatches',
33
- /** Components */
34
- components: {
35
- VSheet,
36
- VBtn,
37
- VIcon,
38
- },
39
38
  /** Model Definition */
40
39
  model: {
41
40
  prop: 'modelValue',
@@ -46,7 +45,7 @@ export default defineComponent({
46
45
  modelValue: { type: String, required: true },
47
46
  /** Swatch colors */
48
47
  swatches: {
49
- type: Array as () => string[] | string[][],
48
+ type: Array as PropType<string[] | string[][]>,
50
49
  default: () => [
51
50
  [colors.shades.black, colors.shades.white],
52
51
  [
@@ -72,6 +71,8 @@ export default defineComponent({
72
71
  [colors.brown.base, colors.blueGrey.base, colors.grey.base],
73
72
  ],
74
73
  },
74
+ /** The size of the shadow of the button */
75
+ elevation: { type: Number, default: 1 },
75
76
  /** Swatch sized */
76
77
  size: { type: String, default: '2rem' },
77
78
  /** selected icon */
@@ -90,19 +91,15 @@ export default defineComponent({
90
91
  /** チェックアイコンの表示制御 */
91
92
  const checkedVisibilty: Ref<boolean> = ref(false);
92
93
 
93
- /** Palette */
94
- const palette: Ref<string[] | string[][]> = ref(props.swatches);
95
-
96
94
  /** Selected color */
97
95
  const selected: Ref<string> = ref(props.modelValue);
98
96
 
99
97
  /**
100
98
  * ボタンがクリックされた
101
99
  *
102
- * @param e - イベント
100
+ * @param value - 色
103
101
  */
104
- const onSwatchClick = (e: Event) => {
105
- const value = (e.target as HTMLButtonElement).value;
102
+ const onSwatchClick = (value: string) => {
106
103
  if (!value || selected.value === value) {
107
104
  return;
108
105
  }
@@ -112,7 +109,6 @@ export default defineComponent({
112
109
 
113
110
  return {
114
111
  checkedVisibilty,
115
- palette,
116
112
  selected,
117
113
  onSwatchClick,
118
114
  };