@electrovir/color 1.7.9 → 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.
package/LICENSE-MIT CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 electrovir
3
+ Copyright (c) 2026 electrovir
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -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
- return {
82
- key,
83
- value,
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
- key: 'colorFormat',
94
- },
95
- {
96
- key: 'formattedString',
97
- },
98
- ], getObjectTypedEntries(colorStrings), ([colorFormat, value,]) => {
99
- return {
100
- colorFormat: `${colorFormat}:`,
101
- formattedString: html `
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
- key: 'colorLayer',
129
- },
130
- {
131
- key: 'colorValue',
132
- },
133
- ], getObjectTypedEntries({
134
- 'Foreground:': new Color(inputs.foregroundColor).toFormattedStrings().hexString,
135
- 'Background:': new Color(inputs.backgroundColor).toFormattedStrings().hexString,
136
- 'Contrast:': `${contrast.contrast} Lc`.padEnd(9, ' '),
137
- }), ([colorLayer, value,]) => {
138
- return {
139
- colorLayer,
140
- colorValue: html `
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
- ], Object.entries(contrast.fontSizes).map(([weight, size,]) => {
153
- return {
154
- weight: Number(weight),
155
- size,
156
- };
157
- }), ({ size, weight }) => {
158
- return {
159
- size: `${round(size, {
160
- digits: 1,
161
- })}px`,
162
- weight: html `
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
- key: 'levelName',
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
- value: formatName,
22
- label: formatName.toUpperCase(),
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
  *
@@ -243,7 +245,7 @@ export const VirColorPicker = defineElement()({
243
245
  })}>
244
246
  <button
245
247
  class="trigger"
246
- slot=${ViraPopUpTrigger.slotNames.trigger}
248
+ slot=${ViraPopUpTrigger.slotNames['vira-pop-up-trigger-trigger']}
247
249
  ${listen('mousedown', () => {
248
250
  const storedFormat = colorLocalStorageClient.get.lastFormat();
249
251
  if (storedFormat) {
@@ -255,7 +257,10 @@ export const VirColorPicker = defineElement()({
255
257
  >
256
258
  ${swatchTemplate}
257
259
  </button>
258
- <div class="pop-up" slot=${ViraPopUpTrigger.slotNames.popUp}>
260
+ <div
261
+ class="pop-up"
262
+ slot=${ViraPopUpTrigger.slotNames['vira-pop-up-trigger-pop-up']}
263
+ >
259
264
  ${pickerTemplate}
260
265
  </div>
261
266
  </${ViraPopUpTrigger}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electrovir/color",
3
- "version": "1.7.9",
3
+ "version": "1.7.11",
4
4
  "description": "A wrapper for culori with an extremely simple API.",
5
5
  "keywords": [
6
6
  "color",
@@ -21,7 +21,7 @@
21
21
  "type": "git",
22
22
  "url": "git+https://github.com/electrovir/color.git"
23
23
  },
24
- "license": "(MIT or CC0 1.0)",
24
+ "license": "(MIT OR CC0-1.0)",
25
25
  "author": {
26
26
  "name": "electrovir",
27
27
  "url": "https://github.com/electrovir"
@@ -53,64 +53,63 @@
53
53
  "@electrovir/color": "file:./"
54
54
  },
55
55
  "dependencies": {
56
- "@augment-vir/assert": "^31.68.1",
57
- "@augment-vir/common": "^31.68.1",
58
- "@augment-vir/web": "^31.68.1",
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.0",
61
+ "color-name": "^2.1.1",
62
62
  "culori": "^4.0.2",
63
- "object-shape-tester": "^6.11.0",
64
- "type-fest": "^5.4.4"
63
+ "object-shape-tester": "^6.14.1"
65
64
  },
66
65
  "devDependencies": {
67
- "@augment-vir/test": "^31.68.1",
68
- "@eslint/eslintrc": "^3.3.5",
69
- "@eslint/js": "^9.39.2",
66
+ "@augment-vir/test": "^32.2.1",
67
+ "@eslint/eslintrc": "^3.3.6",
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.56.1",
75
- "@web/dev-server-esbuild": "^1.0.5",
76
- "@web/test-runner": "^0.20.2",
77
- "@web/test-runner-commands": "^0.9.0",
78
- "@web/test-runner-playwright": "^0.11.1",
79
- "@web/test-runner-visual-regression": "^0.10.0",
80
- "cspell": "^9.7.0",
81
- "dependency-cruiser": "^17.3.8",
82
- "element-book": "^26.17.0",
83
- "element-vir": "^26.14.6",
84
- "esbuild": "^0.27.3",
85
- "eslint": "^9.39.2",
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",
81
+ "element-book": "^26.17.3",
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": "^62.7.1",
86
+ "eslint-plugin-jsdoc": "^63.2.2",
88
87
  "eslint-plugin-monorepo-cop": "^1.0.2",
89
- "eslint-plugin-playwright": "^2.9.0",
90
- "eslint-plugin-prettier": "^5.5.5",
88
+ "eslint-plugin-playwright": "^2.10.5",
89
+ "eslint-plugin-prettier": "^5.5.6",
91
90
  "eslint-plugin-require-extensions": "^0.1.3",
92
- "eslint-plugin-sonarjs": "^4.0.1",
93
- "eslint-plugin-unicorn": "^63.0.0",
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.2",
97
- "markdown-code-example-inserter": "^3.0.3",
98
- "npm-check-updates": "^19.6.3",
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
- "prettier-plugin-jsdoc": "^1.8.0",
102
- "prettier-plugin-multiline-arrays": "^4.1.4",
100
+ "prettier-plugin-jsdoc": "^1.8.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.0",
108
- "typedoc": "^0.28.17",
109
- "typescript": "^5.9.3",
110
- "typescript-eslint": "^8.56.1",
111
- "vira": "^31.5.2",
112
- "virmator": "^14.8.3",
113
- "vite": "^7.3.1"
106
+ "runstorm": "^1.0.6",
107
+ "typedoc": "^0.28.20",
108
+ "typescript": "^6.0.3",
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",