@electrovir/color 1.7.10 → 1.7.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.
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type PartialWithUndefined } from '@augment-vir/common';
|
|
2
|
-
import { type RequireExactlyOne } from 'type-fest';
|
|
1
|
+
import { type PartialWithUndefined, type RequireExactlyOne } from '@augment-vir/common';
|
|
3
2
|
import { ColorFormatName, ColorSyntaxName, type ColorCoordsByFormat, type ColorValue, type HexColor } from './color-formats.js';
|
|
4
3
|
/**
|
|
5
4
|
* An update to an existing {@link Color} instance. Used in {@link Color.set}.
|
|
@@ -78,30 +78,36 @@ export const VirColorDetails = defineElement()({
|
|
|
78
78
|
value,
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
else {
|
|
82
|
+
return {
|
|
83
|
+
key,
|
|
84
|
+
value,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
85
87
|
});
|
|
86
88
|
if (state.inputColorString == undefined) {
|
|
87
89
|
updateState({
|
|
88
90
|
inputColorString: inputs.color,
|
|
89
91
|
});
|
|
90
92
|
}
|
|
91
|
-
const { rows } = defineTable(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
const { rows } = defineTable({
|
|
94
|
+
headers: [
|
|
95
|
+
{
|
|
96
|
+
key: 'colorFormat',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
key: 'formattedString',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
originalData: getObjectTypedEntries(colorStrings),
|
|
103
|
+
dataMap: ([colorFormat, value,]) => {
|
|
104
|
+
return {
|
|
105
|
+
colorFormat: `${colorFormat}:`,
|
|
106
|
+
formattedString: html `
|
|
102
107
|
<pre>${value}</pre>
|
|
103
108
|
`,
|
|
104
|
-
|
|
109
|
+
};
|
|
110
|
+
},
|
|
105
111
|
});
|
|
106
112
|
const inputTemplate = inputs.showInput
|
|
107
113
|
? html `
|
|
@@ -123,43 +123,50 @@ export const VirColorPairContrastSummary = defineElement()({
|
|
|
123
123
|
background: new Color(inputs.backgroundColor).toCss().rgb,
|
|
124
124
|
foreground: new Color(inputs.foregroundColor).toCss().rgb,
|
|
125
125
|
});
|
|
126
|
-
const { rows: colorPairRows } = defineTable(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
126
|
+
const { rows: colorPairRows } = defineTable({
|
|
127
|
+
headers: [
|
|
128
|
+
{
|
|
129
|
+
key: 'colorLayer',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
key: 'colorValue',
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
originalData: getObjectTypedEntries({
|
|
136
|
+
'Foreground:': new Color(inputs.foregroundColor).toFormattedStrings().hexString,
|
|
137
|
+
'Background:': new Color(inputs.backgroundColor).toFormattedStrings().hexString,
|
|
138
|
+
'Contrast:': `${contrast.contrast} Lc`.padEnd(9, ' '),
|
|
139
|
+
}),
|
|
140
|
+
dataMap: ([colorLayer, value,]) => {
|
|
141
|
+
return {
|
|
142
|
+
colorLayer,
|
|
143
|
+
colorValue: html `
|
|
141
144
|
<pre>${value}</pre>
|
|
142
145
|
`,
|
|
143
|
-
|
|
144
|
-
});
|
|
145
|
-
const { rows: weightRows } = defineTable([
|
|
146
|
-
{
|
|
147
|
-
key: 'weight',
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
key: 'size',
|
|
146
|
+
};
|
|
151
147
|
},
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
148
|
+
});
|
|
149
|
+
const { rows: weightRows } = defineTable({
|
|
150
|
+
headers: [
|
|
151
|
+
{
|
|
152
|
+
key: 'weight',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
key: 'size',
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
originalData: Object.entries(contrast.fontSizes).map(([weight, size,]) => {
|
|
159
|
+
return {
|
|
160
|
+
weight: Number(weight),
|
|
161
|
+
size,
|
|
162
|
+
};
|
|
163
|
+
}),
|
|
164
|
+
dataMap: ({ size, weight }) => {
|
|
165
|
+
return {
|
|
166
|
+
size: `${round(size, {
|
|
167
|
+
digits: 1,
|
|
168
|
+
})}px`,
|
|
169
|
+
weight: html `
|
|
163
170
|
<span
|
|
164
171
|
style=${css `
|
|
165
172
|
font-weight: ${weight};
|
|
@@ -168,20 +175,25 @@ export const VirColorPairContrastSummary = defineElement()({
|
|
|
168
175
|
${weight}
|
|
169
176
|
</span>
|
|
170
177
|
`,
|
|
171
|
-
|
|
172
|
-
});
|
|
173
|
-
const { rows: levelRows } = defineTable([
|
|
174
|
-
{
|
|
175
|
-
key: 'boundaryLc',
|
|
178
|
+
};
|
|
176
179
|
},
|
|
177
|
-
|
|
178
|
-
|
|
180
|
+
});
|
|
181
|
+
const { rows: levelRows } = defineTable({
|
|
182
|
+
headers: [
|
|
183
|
+
{
|
|
184
|
+
key: 'boundaryLc',
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
key: 'levelName',
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
originalData: contrastLevels,
|
|
191
|
+
dataMap: (contrastLevel) => {
|
|
192
|
+
return {
|
|
193
|
+
boundaryLc: `${contrastLevel.min} Lc`,
|
|
194
|
+
levelName: contrastLevelLabel[contrastLevel.name],
|
|
195
|
+
};
|
|
179
196
|
},
|
|
180
|
-
], contrastLevels, (contrastLevel) => {
|
|
181
|
-
return {
|
|
182
|
-
boundaryLc: `${contrastLevel.min} Lc`,
|
|
183
|
-
levelName: contrastLevelLabel[contrastLevel.name],
|
|
184
|
-
};
|
|
185
197
|
});
|
|
186
198
|
return html `
|
|
187
199
|
<div class="color-overlay">
|
|
@@ -17,10 +17,12 @@ import { Color } from '../data/color-class/color.js';
|
|
|
17
17
|
import { colorLocalStorageClient } from '../data/local-storage.client.js';
|
|
18
18
|
import { VirColorFormatSliders } from './vir-color-format-sliders.element.js';
|
|
19
19
|
import { VirColorSwatch } from './vir-color-swatch.element.js';
|
|
20
|
-
const colorFormatOptions = getObjectTypedValues(ColorFormatName).map((formatName) =>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const colorFormatOptions = getObjectTypedValues(ColorFormatName).map((formatName) => {
|
|
21
|
+
return {
|
|
22
|
+
value: formatName,
|
|
23
|
+
label: formatName.toUpperCase(),
|
|
24
|
+
};
|
|
25
|
+
});
|
|
24
26
|
/**
|
|
25
27
|
* A color picker element with a swatch that opens a popup with color format sliders.
|
|
26
28
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@electrovir/color",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.11",
|
|
4
4
|
"description": "A wrapper for culori with an extremely simple API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"color",
|
|
@@ -53,64 +53,63 @@
|
|
|
53
53
|
"@electrovir/color": "file:./"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@augment-vir/assert": "^
|
|
57
|
-
"@augment-vir/common": "^
|
|
58
|
-
"@augment-vir/web": "^
|
|
56
|
+
"@augment-vir/assert": "^32.2.1",
|
|
57
|
+
"@augment-vir/common": "^32.2.1",
|
|
58
|
+
"@augment-vir/web": "^32.2.1",
|
|
59
59
|
"@electrovir/local-storage-client": "^0.1.0",
|
|
60
60
|
"apca-w3": "^0.1.9",
|
|
61
|
-
"color-name": "^2.1.
|
|
61
|
+
"color-name": "^2.1.1",
|
|
62
62
|
"culori": "^4.0.2",
|
|
63
|
-
"object-shape-tester": "^6.
|
|
64
|
-
"type-fest": "^5.6.0"
|
|
63
|
+
"object-shape-tester": "^6.14.1"
|
|
65
64
|
},
|
|
66
65
|
"devDependencies": {
|
|
67
|
-
"@augment-vir/test": "^
|
|
68
|
-
"@eslint/eslintrc": "^3.3.
|
|
66
|
+
"@augment-vir/test": "^32.2.1",
|
|
67
|
+
"@eslint/eslintrc": "^3.3.6",
|
|
69
68
|
"@eslint/js": "10.0.1",
|
|
70
69
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
71
70
|
"@stylistic/eslint-plugin-ts": "^4.4.1",
|
|
72
71
|
"@types/color-name": "^2.0.0",
|
|
73
72
|
"@types/culori": "^4.0.1",
|
|
74
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
75
|
-
"@web/dev-server-esbuild": "^
|
|
76
|
-
"@web/test-runner": "^0.
|
|
77
|
-
"@web/test-runner-commands": "^0.
|
|
78
|
-
"@web/test-runner-playwright": "^0.
|
|
79
|
-
"@web/test-runner-visual-regression": "^0.
|
|
80
|
-
"cspell": "^10.0.
|
|
81
|
-
"dependency-cruiser": "^
|
|
73
|
+
"@typescript-eslint/eslint-plugin": "^8.65.0",
|
|
74
|
+
"@web/dev-server-esbuild": "^2.0.0",
|
|
75
|
+
"@web/test-runner": "^1.0.0",
|
|
76
|
+
"@web/test-runner-commands": "^1.0.1",
|
|
77
|
+
"@web/test-runner-playwright": "^1.0.0",
|
|
78
|
+
"@web/test-runner-visual-regression": "^1.0.1",
|
|
79
|
+
"cspell": "^10.0.1",
|
|
80
|
+
"dependency-cruiser": "^18.1.0",
|
|
82
81
|
"element-book": "^26.17.3",
|
|
83
|
-
"element-vir": "^26.17.
|
|
84
|
-
"esbuild": "^0.28.
|
|
85
|
-
"eslint": "^10.
|
|
82
|
+
"element-vir": "^26.17.1",
|
|
83
|
+
"esbuild": "^0.28.1",
|
|
84
|
+
"eslint": "^10.7.0",
|
|
86
85
|
"eslint-config-prettier": "^10.1.8",
|
|
87
|
-
"eslint-plugin-jsdoc": "^63.
|
|
86
|
+
"eslint-plugin-jsdoc": "^63.2.2",
|
|
88
87
|
"eslint-plugin-monorepo-cop": "^1.0.2",
|
|
89
|
-
"eslint-plugin-playwright": "^2.10.
|
|
88
|
+
"eslint-plugin-playwright": "^2.10.5",
|
|
90
89
|
"eslint-plugin-prettier": "^5.5.6",
|
|
91
90
|
"eslint-plugin-require-extensions": "^0.1.3",
|
|
92
|
-
"eslint-plugin-sonarjs": "^4.0
|
|
93
|
-
"eslint-plugin-unicorn": "^
|
|
91
|
+
"eslint-plugin-sonarjs": "^4.2.0",
|
|
92
|
+
"eslint-plugin-unicorn": "^72.0.0",
|
|
94
93
|
"execute-in-browser": "^1.0.9",
|
|
95
94
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
96
|
-
"lit-css-vars": "^3.6.
|
|
97
|
-
"markdown-code-example-inserter": "^3.0.
|
|
98
|
-
"npm-check-updates": "^22.2.
|
|
95
|
+
"lit-css-vars": "^3.6.3",
|
|
96
|
+
"markdown-code-example-inserter": "^3.0.6",
|
|
97
|
+
"npm-check-updates": "^22.2.9",
|
|
99
98
|
"prettier": "~3.3.3",
|
|
100
99
|
"prettier-plugin-interpolated-html-tags": "^2.0.1",
|
|
101
100
|
"prettier-plugin-jsdoc": "^1.8.1",
|
|
102
|
-
"prettier-plugin-multiline-arrays": "^4.1.
|
|
101
|
+
"prettier-plugin-multiline-arrays": "^4.1.10",
|
|
103
102
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
104
103
|
"prettier-plugin-packagejson": "^3.0.2",
|
|
105
104
|
"prettier-plugin-sort-json": "^4.2.0",
|
|
106
105
|
"prettier-plugin-toml": "^2.0.6",
|
|
107
|
-
"runstorm": "^1.0.
|
|
108
|
-
"typedoc": "^0.28.
|
|
106
|
+
"runstorm": "^1.0.6",
|
|
107
|
+
"typedoc": "^0.28.20",
|
|
109
108
|
"typescript": "^6.0.3",
|
|
110
|
-
"typescript-eslint": "^8.
|
|
111
|
-
"vira": "^31.
|
|
112
|
-
"virmator": "^14.
|
|
113
|
-
"vite": "^8.
|
|
109
|
+
"typescript-eslint": "^8.65.0",
|
|
110
|
+
"vira": "^31.28.1",
|
|
111
|
+
"virmator": "^14.30.0",
|
|
112
|
+
"vite": "^8.1.5"
|
|
114
113
|
},
|
|
115
114
|
"peerDependencies": {
|
|
116
115
|
"element-vir": ">=26",
|