@electrovir/color 1.6.2 → 1.6.4

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,7 +1,7 @@
1
1
  /* node:coverage disable */
2
2
  import { checkWrap } from '@augment-vir/assert';
3
3
  import { getObjectTypedValues } from '@augment-vir/common';
4
- import { css, defineElement, defineElementEvent, html, listen, nothing } from 'element-vir';
4
+ import { css, defineElement, defineElementEvent, html, listen, nothing, onDomCreated, } from 'element-vir';
5
5
  import { Copy24Icon, noNativeFormStyles, viraFontCssVars, viraFormCssVars, ViraIcon, ViraInput, ViraPopUpTrigger, ViraSelect, viraShadows, } from 'vira';
6
6
  import { ColorFormatName, colorFormats } from '../data/color-class/color-formats.js';
7
7
  import { Color } from '../data/color-class/color.js';
@@ -108,6 +108,7 @@ export const VirColorPicker = defineElement()({
108
108
  }
109
109
 
110
110
  .raw-input-wrapper {
111
+ text-align: left;
111
112
  display: flex;
112
113
  align-items: center;
113
114
  justify-content: center;
@@ -140,8 +141,9 @@ export const VirColorPicker = defineElement()({
140
141
  value: rawInput,
141
142
  })}
142
143
  ${listen(ViraInput.events.valueChange, (event) => {
144
+ const rawInput = event.detail;
143
145
  updateState({
144
- rawInput: event.detail,
146
+ rawInput,
145
147
  });
146
148
  if (Color.isValidColorString(rawInput)) {
147
149
  dispatch(new events.colorChange(rawInput));
@@ -188,6 +190,14 @@ export const VirColorPicker = defineElement()({
188
190
  <${ViraSelect.assign({
189
191
  options: colorFormatOptions,
190
192
  value: state.selectedFormatName,
193
+ })}
194
+ ${onDomCreated(() => {
195
+ const storedFormat = colorLocalStorageClient.get.lastFormat();
196
+ if (storedFormat) {
197
+ updateState({
198
+ selectedFormatName: storedFormat,
199
+ });
200
+ }
191
201
  })}
192
202
  ${listen(ViraSelect.events.valueChange, (event) => {
193
203
  const selectedFormat = checkWrap.isEnumValue(event.detail, ColorFormatName);
@@ -207,6 +217,9 @@ export const VirColorPicker = defineElement()({
207
217
  })}
208
218
  ${listen(VirColorFormatSliders.events.colorChange, (event) => {
209
219
  dispatch(new events.colorChange(event.detail));
220
+ updateState({
221
+ rawInput: undefined,
222
+ });
210
223
  })}
211
224
  ></${VirColorFormatSliders}>
212
225
  </div>
@@ -232,15 +245,17 @@ export const VirColorPicker = defineElement()({
232
245
  }
233
246
  },
234
247
  });
235
- CSS.registerProperty({
236
- name: String(VirColorPicker.cssVars['vir-color-picker-swatch-width'].name),
237
- syntax: '<length>',
238
- inherits: true,
239
- initialValue: VirColorPicker.cssVars['vir-color-picker-swatch-width'].default,
240
- });
241
- CSS.registerProperty({
242
- name: String(VirColorPicker.cssVars['vir-color-picker-swatch-height'].name),
243
- syntax: '<length>',
244
- inherits: true,
245
- initialValue: VirColorPicker.cssVars['vir-color-picker-swatch-height'].default,
246
- });
248
+ if ('CSS' in globalThis) {
249
+ globalThis.CSS.registerProperty({
250
+ name: String(VirColorPicker.cssVars['vir-color-picker-swatch-width'].name),
251
+ syntax: '<length>',
252
+ inherits: true,
253
+ initialValue: VirColorPicker.cssVars['vir-color-picker-swatch-width'].default,
254
+ });
255
+ globalThis.CSS.registerProperty({
256
+ name: String(VirColorPicker.cssVars['vir-color-picker-swatch-height'].name),
257
+ syntax: '<length>',
258
+ inherits: true,
259
+ initialValue: VirColorPicker.cssVars['vir-color-picker-swatch-height'].default,
260
+ });
261
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electrovir/color",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "description": "A wrapper for culori with an extremely simple API.",
5
5
  "keywords": [
6
6
  "color",
@@ -53,7 +53,7 @@
53
53
  "@augment-vir/assert": "^31.57.5",
54
54
  "@augment-vir/common": "^31.57.5",
55
55
  "@augment-vir/web": "^31.57.5",
56
- "@electrovir/local-storage-client": "^0.0.1",
56
+ "@electrovir/local-storage-client": "^0.0.2",
57
57
  "apca-w3": "^0.1.9",
58
58
  "color-name": "^2.1.0",
59
59
  "culori": "^4.0.2",
@@ -64,7 +64,7 @@
64
64
  "@augment-vir/test": "^31.57.5",
65
65
  "@eslint/eslintrc": "^3.3.3",
66
66
  "@eslint/js": "^9.39.2",
67
- "@stylistic/eslint-plugin": "^5.6.1",
67
+ "@stylistic/eslint-plugin": "^5.7.0",
68
68
  "@stylistic/eslint-plugin-ts": "^4.4.1",
69
69
  "@types/color-name": "^2.0.0",
70
70
  "@types/culori": "^4.0.1",
@@ -81,9 +81,9 @@
81
81
  "esbuild": "^0.27.2",
82
82
  "eslint": "^9.39.2",
83
83
  "eslint-config-prettier": "^10.1.8",
84
- "eslint-plugin-jsdoc": "^61.5.0",
84
+ "eslint-plugin-jsdoc": "^62.0.0",
85
85
  "eslint-plugin-monorepo-cop": "^1.0.2",
86
- "eslint-plugin-playwright": "^2.4.0",
86
+ "eslint-plugin-playwright": "^2.4.1",
87
87
  "eslint-plugin-prettier": "^5.5.4",
88
88
  "eslint-plugin-require-extensions": "^0.1.3",
89
89
  "eslint-plugin-sonarjs": "^3.0.5",
@@ -105,7 +105,7 @@
105
105
  "typedoc": "^0.28.15",
106
106
  "typescript": "^5.9.3",
107
107
  "typescript-eslint": "^8.52.0",
108
- "vira": "^28.19.0",
108
+ "vira": "^28.19.2",
109
109
  "virmator": "^14.4.2",
110
110
  "vite": "^7.3.1"
111
111
  },