vuetify-swatches 2.0.0 → 2.1.1

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.
@@ -0,0 +1,81 @@
1
+ import { Variant } from 'vuetify/lib/composables/variant.d.ts';
2
+ import { Anchor } from 'vuetify/lib/util/index.d.ts';
3
+ /** Swatches prop type */
4
+ type SwatchesProp = (string | undefined)[] | (string | undefined)[][] | Record<string, (string | undefined)[]> | readonly (string | undefined)[] | readonly (readonly (string | undefined)[])[];
5
+ /** Props */
6
+ type __VLS_Props = {
7
+ /** Model value */
8
+ modelValue?: string;
9
+ /** Swatch colors */
10
+ swatches?: SwatchesProp;
11
+ /** Swatch size */
12
+ size?: string;
13
+ /**
14
+ * Selected icon
15
+ * @see {@link https://vuetifyjs.com/en/components/icons/#usage}
16
+ */
17
+ icon?: string;
18
+ /** Selected icon size */
19
+ iconSize?: string;
20
+ /** Display swatches in a single row */
21
+ inline?: boolean;
22
+ /**
23
+ * The variant prop gives you easy access to several different button styles.
24
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#variant}
25
+ */
26
+ variant?: Variant;
27
+ /**
28
+ * Removes the ability to click or target the component.
29
+ * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
30
+ */
31
+ disabled?: boolean;
32
+ /**
33
+ * Applies a large border radius on the button.
34
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#rounded}
35
+ */
36
+ rounded?: string | number | boolean;
37
+ /**
38
+ * Applies border styles to component.
39
+ * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-border}
40
+ */
41
+ border?: string | number | boolean;
42
+ /**
43
+ * Designates an elevation applied to the component between 0 and 24.
44
+ * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-elevation}
45
+ */
46
+ elevation?: string | number;
47
+ /** Swap cols and rows */
48
+ transpose?: boolean;
49
+ /**
50
+ * Tooltip
51
+ * @see {@link https://vuetifyjs.com/en/components/tooltips/}
52
+ */
53
+ tooltip?: boolean;
54
+ /**
55
+ * Tooltip location
56
+ * @see {@link https://vuetifyjs.com/en/components/tooltips/#props-location}
57
+ */
58
+ tooltipLocation?: Anchor;
59
+ };
60
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
61
+ "update:modelValue": (value: string) => any;
62
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
63
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
64
+ }>, {
65
+ size: string;
66
+ icon: string;
67
+ iconSize: string;
68
+ variant: Variant;
69
+ disabled: boolean;
70
+ rounded: string | number | boolean;
71
+ border: string | number | boolean;
72
+ elevation: string | number;
73
+ tooltip: boolean;
74
+ tooltipLocation: Anchor;
75
+ modelValue: string;
76
+ swatches: SwatchesProp;
77
+ inline: boolean;
78
+ transpose: boolean;
79
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
80
+ declare const _default: typeof __VLS_export;
81
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { default as VSwatches } from './components/VSwatches.vue';
2
+ declare const installVSwatches: (app: any) => void;
3
+ export { VSwatches as default, installVSwatches as install };
@@ -0,0 +1,7 @@
1
+ /** Build information meta data */
2
+ export default interface MetaInterface {
3
+ /** Version */
4
+ version: string;
5
+ /** Build date */
6
+ date: string;
7
+ }
@@ -3,10 +3,11 @@
3
3
  *
4
4
  * @description Color Swatch component for Vuetify3.
5
5
  * @author Logue <logue@hotmail.co.jp>
6
- * @copyright 2022-2025 By Masashi Yoshikawa All rights reserved.
6
+ * @copyright 2022-2026 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 2.0.0
8
+ * @version 2.1.1
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
- .v-swatches .v-btn{margin:.1rem}.v-swatches .v-btn .v-icon{filter:invert(100%) grayscale(100%) contrast(100)}.v-swatches .v-btn.bg-transparent{background:linear-gradient(to top left,transparent 0,transparent calc(50% - .1rem),rgb(var(--v-theme-error)) 50%,transparent calc(50% + .1rem),transparent)}.v-swatches .v-btn.bg-transparent .v-icon{filter:none}
12
+ .v-swatches .v-btn{margin:.1rem}.v-swatches .v-btn .v-icon{filter:invert()grayscale()contrast(100)}.v-swatches .v-btn.bg-transparent{background:linear-gradient(to top left, transparent 0, transparent calc(50% - .1rem), rgb(var(--v-theme-error)) 50%, transparent calc(50% + .1rem), transparent)}.v-swatches .v-btn.bg-transparent .v-icon{filter:none}
13
+ /*$vite$:1*/
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
- "$schema": "https://schemastore.org/package.json",
3
2
  "name": "vuetify-swatches",
4
- "version": "2.0.0",
3
+ "version": "2.1.1",
5
4
  "description": "Color Swatch component for Vuetify3.",
6
5
  "keywords": [
7
6
  "vue",
@@ -66,74 +65,95 @@
66
65
  "src/components/VSwatches.vue"
67
66
  ],
68
67
  "engines": {
69
- "node": ">=24.11.1"
68
+ "node": "^20.19.0 || >=22.12.0"
70
69
  },
71
- "packageManager": "pnpm@10.24.0",
72
- "sideEffects": false,
70
+ "packageManager": "pnpm@11.9.0",
73
71
  "scripts": {
74
72
  "dev": "vite",
75
- "clean": "rimraf node_modules/.vite",
76
- "type-check": "vue-tsc --build --force",
77
- "build": "run-s type-check build-only build:presets",
78
- "build:analyze": "vite build --mode=analyze",
79
- "build:clean": "rimraf dist docs",
73
+ "clean": "rimraf ./node_modules/.vite",
74
+ "build": "run-s build:lib build:presets",
75
+ "build:lib": "run-p type-check build-only",
80
76
  "build:docs": "vite build --mode=docs",
81
- "build-only": "vite build",
82
77
  "build:presets": "vite build --config vite.config.presets.ts",
83
- "lint": "eslint . --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint && prettier . --write",
84
- "preview": "vite preview --mode=docs",
85
- "test": "vitest",
86
- "test:run": "vitest run",
78
+ "build:analyze": "vite build --mode analyze",
79
+ "build:clean": "rimraf dist",
80
+ "lint": "run-s lint:*",
81
+ "lint:oxlint": "oxlint . --fix",
82
+ "lint:eslint": "eslint . --fix --cache --cache-location ./node_modules/.vite/eslint-cache",
83
+ "lint:prettier": "prettier \"./**/*.{js,ts,json,css,sass,scss,htm,html,vue,md}\" -w -u",
84
+ "lint:style": "stylelint \"./**/*.{css,sass,scss,htm,html,vue}\" --fix --cache-location ./node_modules/.vite/stylelint-cache && prettier \"./**/*.{css,sass,scss,htm,html,vue}\" -w -u",
85
+ "preview": "vite preview",
86
+ "test:unit": "vitest",
87
87
  "test:coverage": "vitest run --coverage",
88
- "test:ui": "vitest --ui",
89
- "prepare": "husky",
90
- "version": "auto-changelog -p && git add CHANGELOG.md"
88
+ "test:e2e": "playwright test",
89
+ "build-only": "vite build",
90
+ "type-check": "vue-tsc --build",
91
+ "prepare": "husky"
91
92
  },
92
93
  "peerDependencies": {
93
- "vue": ">=3.5.25",
94
- "vuetify": ">=3.11.0"
94
+ "vue": ">=3.5",
95
+ "vuetify": ">=4"
95
96
  },
96
97
  "dependencies": {
97
- "es-toolkit": "^1.42.0"
98
+ "es-toolkit": "^1.49.0"
98
99
  },
99
100
  "devDependencies": {
100
- "@codemirror/lang-vue": "0.1.3",
101
+ "@codemirror/lang-vue": "^0.1.3",
102
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.7.2",
103
+ "@eslint/markdown": "^8.0.3",
104
+ "@mdi/font": "^7.4.47",
105
+ "@playwright/test": "^1.61.1",
101
106
  "@tsconfig/node-lts": "^24.0.0",
102
- "@types/jsdom": "^27.0.0",
103
- "@types/node": "^24.10.1",
104
- "@vitejs/plugin-vue": "^6.0.2",
105
- "@vitest/coverage-v8": "^4.0.15",
107
+ "@types/jsdom": "^28.0.3",
108
+ "@types/node": "^26.1.0",
109
+ "@vitejs/plugin-vue": "^6.0.7",
110
+ "@vitest/coverage-v8": "^4.1.9",
111
+ "@vitest/eslint-plugin": "1.6.20",
106
112
  "@vue/eslint-config-prettier": "^10.2.0",
107
- "@vue/eslint-config-typescript": "^14.6.0",
108
- "@vue/test-utils": "^2.4.6",
109
- "@vue/tsconfig": "^0.8.1",
110
- "eslint": "^9.39.1",
113
+ "@vue/eslint-config-typescript": "^14.9.0",
114
+ "@vue/test-utils": "^2.4.11",
115
+ "@vue/tsconfig": "^0.9.1",
116
+ "esbuild": "^0.28.1",
117
+ "eslint": "^10.6.0",
111
118
  "eslint-import-resolver-custom-alias": "^1.3.2",
112
- "eslint-import-resolver-typescript": "^4.4.4",
113
- "eslint-plugin-import": "^2.32.0",
114
- "eslint-plugin-vue": "^10.6.2",
115
- "eslint-plugin-vuejs-accessibility": "^2.4.1",
116
- "eslint-plugin-vuetify": "^2.5.3",
119
+ "eslint-import-resolver-typescript": "^4.4.5",
120
+ "eslint-plugin-import-x": "^4.17.1",
121
+ "eslint-plugin-node": "^11.1.0",
122
+ "eslint-plugin-oxlint": "^1.72.0",
123
+ "eslint-plugin-playwright": "^2.10.4",
124
+ "eslint-plugin-security": "^4.0.1",
125
+ "eslint-plugin-vue": "^10.9.2",
126
+ "eslint-plugin-vuejs-accessibility": "^2.5.0",
127
+ "eslint-plugin-vuetify": "^2.7.2",
117
128
  "husky": "^9.1.7",
118
- "jsdom": "^27.2.0",
119
- "lint-staged": "^16.2.7",
120
- "npm-run-all2": "^8.0.4",
121
- "prettier": "^3.7.4",
122
- "rimraf": "^6.1.2",
123
- "rollup-plugin-visualizer": "^6.0.5",
124
- "sass-embedded": "^1.93.3",
125
- "typescript": "^5.9.3",
126
- "typescript-eslint": "^8.48.1",
127
- "vite": "^7.2.6",
129
+ "jiti": "^2.7.0",
130
+ "jsdom": "29.1.1",
131
+ "lint-staged": "^17.0.8",
132
+ "npm-run-all2": "^9.0.2",
133
+ "oxlint": "^1.72.0",
134
+ "postcss-html": "^1.8.1",
135
+ "prettier": "^3.9.4",
136
+ "resize-observer-polyfill": "^1.5.1",
137
+ "rimraf": "^6.1.3",
138
+ "rollup-plugin-visualizer": "^7.0.1",
139
+ "sass-embedded": "^1.100.0",
140
+ "stylelint": "^17.14.0",
141
+ "stylelint-config-html": "^1.1.0",
142
+ "stylelint-config-recommended-scss": "^17.0.1",
143
+ "stylelint-config-recommended-vue": "^1.6.1",
144
+ "stylelint-order": "^8.1.1",
145
+ "stylelint-scss": "^7.2.0",
146
+ "typescript": "^6.0.3",
147
+ "typescript-eslint": "^8.62.1",
148
+ "vite": "^8.1.3",
128
149
  "vite-plugin-banner": "^0.8.1",
129
- "vite-plugin-checker": "^0.11.0",
130
- "vite-plugin-dts": "^4.5.4",
131
- "vite-plugin-vuetify": "^2.1.2",
132
- "vitest": "^4.0.15",
133
- "vue": "^3.5.25",
134
- "vue-codemirror6": "^1.4.1",
135
- "vue-eslint-parser": "^10.2.0",
136
- "vue-tsc": "^3.1.5"
150
+ "vite-plugin-checker": "0.14.4",
151
+ "vite-plugin-dts": "^5.0.3",
152
+ "vite-plugin-vue-devtools": "^8.1.5",
153
+ "vite-plugin-vuetify": "^2.1.3",
154
+ "vitest": "^4.1.9",
155
+ "vue-codemirror6": "^1.5.2",
156
+ "vue-tsc": "^3.3.6"
137
157
  },
138
158
  "husky": {
139
159
  "hooks": {
@@ -141,12 +161,12 @@
141
161
  }
142
162
  },
143
163
  "lint-staged": {
144
- "*.{js,ts,vue}": "eslint --fix --cache",
145
- "*.{css,sass,scss,vue}": "stylelint --fix --cache",
146
- "*": "prettier -w -u"
164
+ "*": "run-s lint:*"
147
165
  },
148
166
  "resolutions": {
149
- "json5": ">=2.2.3",
150
- "yaml": ">=2.3.2"
167
+ "js-yaml": ">=4.1.1"
168
+ },
169
+ "stackblitz": {
170
+ "startCommand": "pnpm run test:unit"
151
171
  }
152
- }
172
+ }
@@ -1,13 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  /** Vuetify Swatches */
3
- import {
4
- computed,
5
- ref,
6
- watch,
7
- type ComputedRef,
8
- type PropType,
9
- type Ref,
10
- } from 'vue';
3
+ import { computed, ref, watch, type ComputedRef, type Ref } from 'vue';
11
4
 
12
5
  import { zip } from 'es-toolkit';
13
6
  import { VItem, VItemGroup } from 'vuetify/components';
@@ -18,117 +11,92 @@ import SwatchButton from './SwatchButton.vue';
18
11
  import type { Variant } from 'vuetify/lib/composables/variant.d.ts';
19
12
  import type { Anchor } from 'vuetify/lib/util/index.d.ts';
20
13
 
14
+ /** Swatches prop type */
15
+ type SwatchesProp =
16
+ | (string | undefined)[]
17
+ | (string | undefined)[][]
18
+ | Record<string, (string | undefined)[]>
19
+ | readonly (string | undefined)[]
20
+ | readonly (readonly (string | undefined)[])[];
21
+
21
22
  /** Emits */
22
- const emits = defineEmits({
23
- // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
24
- 'update:modelValue': (_value: string) => true,
25
- });
23
+ const emit = defineEmits<{
24
+ 'update:modelValue': [value: string];
25
+ }>();
26
26
 
27
27
  /** Props */
28
- const props = defineProps({
29
- /** Model value */
30
- modelValue: { type: String, default: colors.shades.white },
31
- /** Swatch colors */
32
- swatches: {
33
- type: Array as PropType<
34
- | (string | undefined)[]
35
- | (string | undefined)[][]
36
- | Record<string, (string | undefined)[]>
37
- | readonly (string | undefined)[]
38
- | readonly (readonly (string | undefined)[])[]
39
- >,
40
- default: () => [],
41
- },
42
- /** Swatch size */
43
- size: {
44
- type: String,
45
- default: '2rem',
46
- },
47
- /**
48
- * Selected icon
49
- * @see {@link https://vuetifyjs.com/en/components/icons/#usage
50
- */
51
- icon: {
52
- type: String,
53
- default: 'mdi-checkbox-marked-circle',
54
- },
55
- /** selected icon size */
56
- iconSize: {
57
- type: String,
58
- default: '1rem',
59
- },
60
- /** Display swatches in a single row */
61
- inline: {
62
- type: Boolean,
63
- default: false,
64
- },
65
- /**
66
- * The variant prop gives you easy access to several different button styles..
67
- *
68
- * @see {@link https://vuetifyjs.com/en/components/buttons/#variant}
69
- */
70
- variant: {
71
- type: String as PropType<Variant>,
72
- default: undefined,
73
- },
74
- /**
75
- * Removes the ability to click or target the component.
76
- *
77
- * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
78
- */
79
- disabled: {
80
- type: Boolean,
81
- default: false,
82
- },
83
- /**
84
- * Applies a large border radius on the button.
85
- *
86
- * @see {@link https://vuetifyjs.com/en/components/buttons/#rounded}
87
- */
88
- rounded: {
89
- type: [String, Number, Boolean],
90
- default: undefined,
91
- },
92
- /**
93
- * Applies border styles to component.
94
- *
95
- * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-border}
96
- */
97
- border: {
98
- type: [String, Number, Boolean],
99
- default: false,
100
- },
101
- /**
102
- * Designates an elevation applied to the component between 0 and 24.
103
- *
104
- * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-elevation}
105
- */
106
- elevation: {
107
- type: [String, Number],
108
- default: undefined,
109
- },
110
- /** Swap cols and rows */
111
- transpose: {
112
- type: Boolean,
113
- default: false,
114
- },
115
- /**
116
- * Tooltip
117
- * @see {@link https://vuetifyjs.com/en/components/tooltips/}
118
- */
119
- tooltip: {
120
- type: Boolean,
121
- default: false,
122
- },
123
- /**
124
- * Tooltip location
125
- * @see {@link https://vuetifyjs.com/en/components/tooltips/#props-location}
126
- */
127
- tooltipLocation: {
128
- type: String as PropType<Anchor>,
129
- default: undefined,
130
- },
131
- });
28
+ const props = withDefaults(
29
+ defineProps<{
30
+ /** Model value */
31
+ modelValue?: string;
32
+ /** Swatch colors */
33
+ swatches?: SwatchesProp;
34
+ /** Swatch size */
35
+ size?: string;
36
+ /**
37
+ * Selected icon
38
+ * @see {@link https://vuetifyjs.com/en/components/icons/#usage}
39
+ */
40
+ icon?: string;
41
+ /** Selected icon size */
42
+ iconSize?: string;
43
+ /** Display swatches in a single row */
44
+ inline?: boolean;
45
+ /**
46
+ * The variant prop gives you easy access to several different button styles.
47
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#variant}
48
+ */
49
+ variant?: Variant;
50
+ /**
51
+ * Removes the ability to click or target the component.
52
+ * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
53
+ */
54
+ disabled?: boolean;
55
+ /**
56
+ * Applies a large border radius on the button.
57
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#rounded}
58
+ */
59
+ rounded?: string | number | boolean;
60
+ /**
61
+ * Applies border styles to component.
62
+ * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-border}
63
+ */
64
+ border?: string | number | boolean;
65
+ /**
66
+ * Designates an elevation applied to the component between 0 and 24.
67
+ * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-elevation}
68
+ */
69
+ elevation?: string | number;
70
+ /** Swap cols and rows */
71
+ transpose?: boolean;
72
+ /**
73
+ * Tooltip
74
+ * @see {@link https://vuetifyjs.com/en/components/tooltips/}
75
+ */
76
+ tooltip?: boolean;
77
+ /**
78
+ * Tooltip location
79
+ * @see {@link https://vuetifyjs.com/en/components/tooltips/#props-location}
80
+ */
81
+ tooltipLocation?: Anchor;
82
+ }>(),
83
+ {
84
+ modelValue: colors.shades.white,
85
+ swatches: () => [],
86
+ size: '2rem',
87
+ icon: 'mdi-checkbox-marked-circle',
88
+ iconSize: '1rem',
89
+ inline: false,
90
+ variant: undefined,
91
+ disabled: false,
92
+ rounded: undefined,
93
+ border: false,
94
+ elevation: undefined,
95
+ transpose: false,
96
+ tooltip: false,
97
+ tooltipLocation: undefined,
98
+ }
99
+ );
132
100
 
133
101
  /** Normalized swatches structure for rendering */
134
102
  const normalizedSwatches: ComputedRef<string[][]> = computed(() => {
@@ -156,7 +124,7 @@ const selected: Ref<string> = ref(colors.shades.white);
156
124
 
157
125
  watch(
158
126
  () => selected.value,
159
- s => emits('update:modelValue', s)
127
+ s => emit('update:modelValue', s)
160
128
  );
161
129
 
162
130
  watch(