color-elements 0.0.3 → 0.0.5

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.
Files changed (45) hide show
  1. package/.claude/settings.local.json +30 -0
  2. package/.editorconfig +8 -0
  3. package/.prettierrc +17 -0
  4. package/.vscode/settings.json +7 -0
  5. package/README.md +27 -18
  6. package/_build/copy-config.js +15 -14
  7. package/_build/copy-config.json +4 -9
  8. package/_build/eleventy.js +8 -8
  9. package/_includes/component.njk +9 -14
  10. package/_includes/partials/_nav-links.njk +1 -0
  11. package/_includes/plain.njk +5 -0
  12. package/_redirects +1 -1
  13. package/assets/css/style.css +4 -4
  14. package/debug.html +38 -439
  15. package/package.json +24 -8
  16. package/src/channel-picker/channel-picker.css +4 -4
  17. package/src/channel-picker/channel-picker.js +16 -12
  18. package/src/channel-slider/channel-slider.css +14 -7
  19. package/src/channel-slider/channel-slider.js +14 -6
  20. package/src/color-chart/README.md +36 -5
  21. package/src/color-chart/color-chart-global.css +19 -14
  22. package/src/color-chart/color-chart-shadow.css +123 -0
  23. package/src/color-chart/color-chart.css +2 -112
  24. package/src/color-chart/color-chart.js +309 -107
  25. package/src/color-inline/color-inline.css +21 -16
  26. package/src/color-inline/color-inline.js +3 -4
  27. package/src/color-inline/style.css +1 -1
  28. package/src/color-picker/color-picker.css +3 -3
  29. package/src/color-picker/color-picker.js +15 -8
  30. package/src/color-scale/README.md +42 -2
  31. package/src/color-scale/color-scale.css +8 -13
  32. package/src/color-scale/color-scale.js +14 -11
  33. package/src/color-slider/README.md +17 -3
  34. package/src/color-slider/color-slider.css +54 -33
  35. package/src/color-slider/color-slider.js +10 -8
  36. package/src/color-swatch/color-swatch.css +52 -34
  37. package/src/color-swatch/color-swatch.js +20 -10
  38. package/src/common/color-element.js +63 -51
  39. package/src/common/dom.js +4 -2
  40. package/src/common/util.js +66 -1
  41. package/src/gamut-badge/gamut-badge.css +33 -13
  42. package/src/gamut-badge/gamut-badge.js +10 -8
  43. package/src/space-picker/space-picker.css +3 -3
  44. package/src/space-picker/space-picker.js +29 -11
  45. package/src/src.json +1 -1
@@ -1,9 +1,9 @@
1
1
  :host {
2
2
  --border-width: 1px;
3
- --border-color: rgb(0 0 0 / .2);
4
- --border-radius: .2em;
3
+ --border-color: rgb(0 0 0 / 0.2);
4
+ --border-radius: 0.2em;
5
5
 
6
- padding: .3em .5em;
6
+ padding: 0.3em 0.5em;
7
7
 
8
8
  border-radius: var(--border-radius);
9
9
  border: var(--border-width) solid var(--border-color);
@@ -3,7 +3,7 @@ import ColorElement from "../common/color-element.js";
3
3
  const Self = class SpacePicker extends ColorElement {
4
4
  static tagName = "space-picker";
5
5
  static url = import.meta.url;
6
- static shadowStyle = true;
6
+ static styles = "./space-picker.css";
7
7
  static shadowTemplate = `<select id="picker" part="base"></select>`;
8
8
 
9
9
  constructor () {
@@ -29,11 +29,14 @@ const Self = class SpacePicker extends ColorElement {
29
29
  }
30
30
  }
31
31
 
32
- propChangedCallback ({name, prop, detail: change}) {
32
+ propChangedCallback ({ name, prop, detail: change }) {
33
33
  if (name === "spaces") {
34
34
  if (!this.groups) {
35
35
  this._el.picker.innerHTML = Object.entries(this.spaces)
36
- .map(([id, space]) => `<option value="${ id }">${ this.getSpaceLabel(space) }</option>`)
36
+ .map(
37
+ ([id, space]) =>
38
+ `<option value="${id}">${this.getSpaceLabel(space)}</option>`,
39
+ )
37
40
  .join("\n");
38
41
  }
39
42
  else {
@@ -42,7 +45,9 @@ const Self = class SpacePicker extends ColorElement {
42
45
  // Remove empty groups
43
46
  groups = Object.entries(groups).filter(([type, spaces]) => {
44
47
  if (Object.keys(spaces).length === 0) {
45
- console.warn(`Removed empty group of color spaces with the label "${type}."`);
48
+ console.warn(
49
+ `Removed empty group of color spaces with the label "${type}."`,
50
+ );
46
51
  return false;
47
52
  }
48
53
 
@@ -50,17 +55,26 @@ const Self = class SpacePicker extends ColorElement {
50
55
  });
51
56
 
52
57
  if (!groups.length) {
53
- console.warn("All provided groups of color spaces are empty. Falling back to default grouping.");
58
+ console.warn(
59
+ "All provided groups of color spaces are empty. Falling back to default grouping.",
60
+ );
54
61
  groups = [["All spaces", this.spaces]];
55
62
  }
56
63
 
57
- this._el.picker.innerHTML = groups.map(([type, spaces]) => `
64
+ this._el.picker.innerHTML = groups
65
+ .map(
66
+ ([type, spaces]) => `
58
67
  <optgroup label="${type}">
59
68
  ${Object.entries(spaces)
60
- .map(([id, space]) => `<option value="${ id }">${ this.getSpaceLabel(space) }</option>`)
69
+ .map(
70
+ ([id, space]) =>
71
+ `<option value="${id}">${this.getSpaceLabel(space)}</option>`,
72
+ )
61
73
  .join("\n")}
62
74
  </optgroup>
63
- `).join("\n");
75
+ `,
76
+ )
77
+ .join("\n");
64
78
  }
65
79
 
66
80
  this._el.picker.value = this.value;
@@ -76,7 +90,9 @@ const Self = class SpacePicker extends ColorElement {
76
90
  let currentSpace = this._el.picker.value;
77
91
  let fallback = spaces.includes(currentSpace) ? currentSpace : firstSpace;
78
92
 
79
- console.warn(`No color space found with id = "${ value }". Choose one of the following: ${ spaces.join(", ") }. Falling back to "${ fallback }".`);
93
+ console.warn(
94
+ `No color space found with id = "${value}". Choose one of the following: ${spaces.join(", ")}. Falling back to "${fallback}".`,
95
+ );
80
96
  this.value = value = fallback;
81
97
  }
82
98
 
@@ -140,7 +156,9 @@ const Self = class SpacePicker extends ColorElement {
140
156
  return value;
141
157
  },
142
158
  stringify (value) {
143
- return Object.entries(value).map(([id, space]) => id).join(", ");
159
+ return Object.entries(value)
160
+ .map(([id, space]) => id)
161
+ .join(", ");
144
162
  },
145
163
  },
146
164
 
@@ -201,7 +219,7 @@ const Self = class SpacePicker extends ColorElement {
201
219
  },
202
220
  };
203
221
 
204
- static formAssociated = {
222
+ static formBehavior = {
205
223
  like: el => el._el.picker,
206
224
  role: "combobox",
207
225
  changeEvent: "change",
package/src/src.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
2
  "layout": "component"
3
- }
3
+ }