@spectrum-web-components/color-area 1.2.0-beta.8 → 1.2.0

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.
@@ -102,7 +102,11 @@
102
102
  "kind": "field",
103
103
  "name": "colorController",
104
104
  "privacy": "private",
105
- "default": "new ColorController(this, {\n extractColorFromState: () => ({\n h: this.hue,\n s: this.x,\n v: this.y,\n }),\n applyColorToState: ({ s, v }) => {\n this._x = s;\n this._y = v;\n this.requestUpdate();\n },\n })"
105
+ "default": "new ColorController(this, { manageAs: 'hsv' })",
106
+ "description": "A controller for managing color interactions within the ColorArea component.\n\nThe `ColorController` is instantiated with the `manageAs` option set to `hsv`\nbecause the ColorArea component is designed to manipulate the saturation (`s`)\nand value (`v`) components of the HSV color model along the x and y axes,\nrespectively. In the HSV color model:\n\n- The `hue` (h) represents the color type and is typically controlled by a separate input.\n- The `saturation` (s) represents the intensity of the color, ranging from 0% (gray) to 100% (full color).\n- The `value` (v) represents the brightness of the color, ranging from 0% (black) to 100% (full brightness).\n\nIn the ColorArea component:\n\n- The x-axis controls the saturation (`s`), allowing users to adjust the intensity of the color.\n- The y-axis controls the value (`v`), allowing users to adjust the brightness of the color.\n\nBy managing the color as `hsv`, the ColorController can efficiently handle the changes in saturation and value\nas the user interacts with the ColorArea component.",
107
+ "type": {
108
+ "text": "ColorController"
109
+ }
106
110
  },
107
111
  {
108
112
  "kind": "field",
@@ -117,7 +121,7 @@
117
121
  "kind": "field",
118
122
  "name": "value",
119
123
  "type": {
120
- "text": "ColorValue"
124
+ "text": "ColorTypes"
121
125
  },
122
126
  "privacy": "public",
123
127
  "readonly": true,
@@ -127,7 +131,7 @@
127
131
  "kind": "field",
128
132
  "name": "color",
129
133
  "type": {
130
- "text": "ColorValue"
134
+ "text": "ColorTypes"
131
135
  },
132
136
  "privacy": "public",
133
137
  "attribute": "color"
@@ -150,15 +154,6 @@
150
154
  "privacy": "public",
151
155
  "attribute": "x"
152
156
  },
153
- {
154
- "kind": "field",
155
- "name": "_x",
156
- "type": {
157
- "text": "number"
158
- },
159
- "privacy": "private",
160
- "default": "1"
161
- },
162
157
  {
163
158
  "kind": "field",
164
159
  "name": "y",
@@ -168,15 +163,6 @@
168
163
  "privacy": "public",
169
164
  "attribute": "y"
170
165
  },
171
- {
172
- "kind": "field",
173
- "name": "_y",
174
- "type": {
175
- "text": "number"
176
- },
177
- "privacy": "private",
178
- "default": "1"
179
- },
180
166
  {
181
167
  "kind": "field",
182
168
  "name": "step",
@@ -545,7 +531,7 @@
545
531
  {
546
532
  "name": "value",
547
533
  "type": {
548
- "text": "ColorValue"
534
+ "text": "ColorTypes"
549
535
  },
550
536
  "readonly": true,
551
537
  "fieldName": "value"
@@ -553,7 +539,7 @@
553
539
  {
554
540
  "name": "color",
555
541
  "type": {
556
- "text": "ColorValue"
542
+ "text": "ColorTypes"
557
543
  },
558
544
  "fieldName": "color"
559
545
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/color-area",
3
- "version": "1.2.0-beta.8",
3
+ "version": "1.2.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -62,12 +62,11 @@
62
62
  "lit-html"
63
63
  ],
64
64
  "dependencies": {
65
- "@ctrl/tinycolor": "^4.0.3",
66
- "@spectrum-web-components/base": "^1.2.0-beta.8",
67
- "@spectrum-web-components/color-handle": "^1.2.0-beta.8",
68
- "@spectrum-web-components/opacity-checkerboard": "^1.2.0-beta.8",
69
- "@spectrum-web-components/reactive-controllers": "^1.2.0-beta.8",
70
- "@spectrum-web-components/shared": "^1.2.0-beta.8"
65
+ "@spectrum-web-components/base": "^1.2.0",
66
+ "@spectrum-web-components/color-handle": "^1.2.0",
67
+ "@spectrum-web-components/opacity-checkerboard": "^1.2.0",
68
+ "@spectrum-web-components/reactive-controllers": "^1.2.0",
69
+ "@spectrum-web-components/shared": "^1.2.0"
71
70
  },
72
71
  "devDependencies": {
73
72
  "@spectrum-css/colorarea": "6.0.0-s2-foundations.15"
@@ -78,5 +77,5 @@
78
77
  "./sp-*.js",
79
78
  "./**/*.dev.js"
80
79
  ],
81
- "gitHead": "740377aa5f17e15650d4871e3034bd9c9a2f5c35"
80
+ "gitHead": "e4aec7b389e6209984e4df74f9b86b3ee0c485dd"
82
81
  }
@@ -1,6 +1,6 @@
1
1
  import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
2
2
  import '@spectrum-web-components/color-handle/sp-color-handle.js';
3
- import { ColorValue } from '@spectrum-web-components/reactive-controllers/src/Color.js';
3
+ import { ColorTypes } from '@spectrum-web-components/reactive-controllers/src/ColorController.js';
4
4
  /**
5
5
  * @element sp-color-area
6
6
  * @slot gradient - a custom gradient visually outlining the available color values
@@ -16,19 +16,45 @@ export declare class ColorArea extends SpectrumElement {
16
16
  labelY: string;
17
17
  private handle;
18
18
  private languageResolver;
19
+ /**
20
+ * A controller for managing color interactions within the ColorArea component.
21
+ *
22
+ * The `ColorController` is instantiated with the `manageAs` option set to `hsv`
23
+ * because the ColorArea component is designed to manipulate the saturation (`s`)
24
+ * and value (`v`) components of the HSV color model along the x and y axes,
25
+ * respectively. In the HSV color model:
26
+ *
27
+ * - The `hue` (h) represents the color type and is typically controlled by a separate input.
28
+ * - The `saturation` (s) represents the intensity of the color, ranging from 0% (gray) to 100% (full color).
29
+ * - The `value` (v) represents the brightness of the color, ranging from 0% (black) to 100% (full brightness).
30
+ *
31
+ * In the ColorArea component:
32
+ *
33
+ * - The x-axis controls the saturation (`s`), allowing users to adjust the intensity of the color.
34
+ * - The y-axis controls the value (`v`), allowing users to adjust the brightness of the color.
35
+ *
36
+ * By managing the color as `hsv`, the ColorController can efficiently handle the changes in saturation and value
37
+ * as the user interacts with the ColorArea component.
38
+ *
39
+ * @private
40
+ * @type {ColorController}
41
+ * @memberof ColorArea
42
+ *
43
+ * @property {ColorArea} this - The instance of the ColorArea component.
44
+ * @property {Object} options - Configuration options for the ColorController.
45
+ * @property {string} options.manageAs - Specifies the color model to manage, in this case 'hsv'.
46
+ */
19
47
  private colorController;
20
48
  get hue(): number;
21
49
  set hue(value: number);
22
- get value(): ColorValue;
23
- get color(): ColorValue;
24
- set color(color: ColorValue);
50
+ get value(): ColorTypes;
51
+ get color(): ColorTypes;
52
+ set color(color: ColorTypes);
25
53
  private activeAxis;
26
54
  get x(): number;
27
55
  set x(x: number);
28
- private _x;
29
56
  get y(): number;
30
57
  set y(y: number);
31
- private _y;
32
58
  step: number;
33
59
  inputX: HTMLInputElement;
34
60
  inputY: HTMLInputElement;
@@ -58,6 +84,18 @@ export declare class ColorArea extends SpectrumElement {
58
84
  private handleAreaPointerdown;
59
85
  protected render(): TemplateResult;
60
86
  protected firstUpdated(changed: PropertyValues): void;
87
+ /**
88
+ * Overrides the `updated` method to handle changes in property values.
89
+ *
90
+ * @param changed - A map of changed properties with their previous values.
91
+ *
92
+ * This method performs the following actions:
93
+ * - Updates the saturation (`s`) of the color if `x` has changed.
94
+ * - Updates the value (`v`) of the color if `y` has changed.
95
+ * - If the `focused` property has changed and is now true, it lazily binds
96
+ * the `input[type="range"]` elements in shadow roots to prevent multiple
97
+ * tab stops within the Color Area for certain browser settings (e.g., Webkit).
98
+ */
61
99
  protected updated(changed: PropertyValues): void;
62
100
  private observer?;
63
101
  connectedCallback(): void;
@@ -13,10 +13,7 @@ import {
13
13
  html,
14
14
  SpectrumElement
15
15
  } from "@spectrum-web-components/base";
16
- import {
17
- ifDefined,
18
- styleMap
19
- } from "@spectrum-web-components/base/src/directives.js";
16
+ import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
20
17
  import {
21
18
  property,
22
19
  query
@@ -25,7 +22,7 @@ import { streamingListener } from "@spectrum-web-components/base/src/streaming-l
25
22
  import "@spectrum-web-components/color-handle/sp-color-handle.js";
26
23
  import {
27
24
  ColorController
28
- } from "@spectrum-web-components/reactive-controllers/src/Color.js";
25
+ } from "@spectrum-web-components/reactive-controllers/src/ColorController.js";
29
26
  import { LanguageResolutionController } from "@spectrum-web-components/reactive-controllers/src/LanguageResolution.js";
30
27
  import {
31
28
  isAndroid,
@@ -40,21 +37,36 @@ export class ColorArea extends SpectrumElement {
40
37
  this.labelX = "saturation";
41
38
  this.labelY = "luminosity";
42
39
  this.languageResolver = new LanguageResolutionController(this);
43
- this.colorController = new ColorController(this, {
44
- extractColorFromState: () => ({
45
- h: this.hue,
46
- s: this.x,
47
- v: this.y
48
- }),
49
- applyColorToState: ({ s, v }) => {
50
- this._x = s;
51
- this._y = v;
52
- this.requestUpdate();
53
- }
54
- });
40
+ /**
41
+ * A controller for managing color interactions within the ColorArea component.
42
+ *
43
+ * The `ColorController` is instantiated with the `manageAs` option set to `hsv`
44
+ * because the ColorArea component is designed to manipulate the saturation (`s`)
45
+ * and value (`v`) components of the HSV color model along the x and y axes,
46
+ * respectively. In the HSV color model:
47
+ *
48
+ * - The `hue` (h) represents the color type and is typically controlled by a separate input.
49
+ * - The `saturation` (s) represents the intensity of the color, ranging from 0% (gray) to 100% (full color).
50
+ * - The `value` (v) represents the brightness of the color, ranging from 0% (black) to 100% (full brightness).
51
+ *
52
+ * In the ColorArea component:
53
+ *
54
+ * - The x-axis controls the saturation (`s`), allowing users to adjust the intensity of the color.
55
+ * - The y-axis controls the value (`v`), allowing users to adjust the brightness of the color.
56
+ *
57
+ * By managing the color as `hsv`, the ColorController can efficiently handle the changes in saturation and value
58
+ * as the user interacts with the ColorArea component.
59
+ *
60
+ * @private
61
+ * @type {ColorController}
62
+ * @memberof ColorArea
63
+ *
64
+ * @property {ColorArea} this - The instance of the ColorArea component.
65
+ * @property {Object} options - Configuration options for the ColorController.
66
+ * @property {string} options.manageAs - Specifies the color model to manage, in this case 'hsv'.
67
+ */
68
+ this.colorController = new ColorController(this, { manageAs: "hsv" });
55
69
  this.activeAxis = "x";
56
- this._x = 1;
57
- this._y = 1;
58
70
  this.step = 0.01;
59
71
  this.altered = 0;
60
72
  this.activeKeys = /* @__PURE__ */ new Set();
@@ -71,45 +83,49 @@ export class ColorArea extends SpectrumElement {
71
83
  this.colorController.hue = value;
72
84
  }
73
85
  get value() {
74
- return this.colorController.color;
86
+ return this.colorController.colorValue;
75
87
  }
76
88
  get color() {
77
- return this.colorController.color;
89
+ return this.colorController.colorValue;
78
90
  }
79
91
  set color(color) {
80
92
  this.colorController.color = color;
81
93
  }
82
94
  get x() {
83
- return this._x;
95
+ return this.colorController.color.hsv.s / 100;
84
96
  }
85
97
  set x(x) {
86
98
  if (x === this.x) {
87
99
  return;
88
100
  }
89
101
  const oldValue = this.x;
90
- this._x = x;
91
102
  if (this.inputX) {
92
103
  this.inputX.value = x.toString();
93
- this._x = this.inputX.valueAsNumber;
104
+ this.colorController.color.set(
105
+ "s",
106
+ this.inputX.valueAsNumber * 100
107
+ );
108
+ } else {
109
+ this.colorController.color.set("s", x * 100);
94
110
  }
95
111
  this.requestUpdate("x", oldValue);
96
- this.colorController.applyColorFromState();
97
112
  }
98
113
  get y() {
99
- return this._y;
114
+ return this.colorController.color.hsv.v / 100;
100
115
  }
101
116
  set y(y) {
102
117
  if (y === this.y) {
103
118
  return;
104
119
  }
105
120
  const oldValue = this.y;
106
- this._y = y;
107
121
  if (this.inputY) {
108
122
  this.inputY.value = y.toString();
109
- this._y = this.inputY.valueAsNumber;
123
+ this.colorController.color.set(
124
+ "v",
125
+ this.inputY.valueAsNumber * 100
126
+ );
110
127
  }
111
128
  this.requestUpdate("y", oldValue);
112
- this.colorController.applyColorFromState();
113
129
  }
114
130
  focus(focusOptions = {}) {
115
131
  super.focus(focusOptions);
@@ -192,7 +208,6 @@ export class ColorArea extends SpectrumElement {
192
208
  this.x = Math.min(1, Math.max(this.x + deltaX, 0));
193
209
  this.y = Math.min(1, Math.max(this.y + deltaY, 0));
194
210
  this.colorController.savePreviousColor();
195
- this.colorController.applyColorFromState();
196
211
  if (deltaX != 0 || deltaY != 0) {
197
212
  this._valueChanged = true;
198
213
  this.dispatchEvent(
@@ -221,7 +236,6 @@ export class ColorArea extends SpectrumElement {
221
236
  handleInput(event) {
222
237
  const { valueAsNumber, name } = event.target;
223
238
  this[name] = valueAsNumber;
224
- this.colorController.applyColorFromState();
225
239
  }
226
240
  handleChange(event) {
227
241
  this.handleInput(event);
@@ -250,8 +264,7 @@ export class ColorArea extends SpectrumElement {
250
264
  const [x, y] = this.calculateHandlePosition(event);
251
265
  this._valueChanged = false;
252
266
  this.x = x;
253
- this.y = 1 - y;
254
- this.colorController.applyColorFromState();
267
+ this.y = y;
255
268
  this.dispatchEvent(
256
269
  new Event("input", {
257
270
  bubbles: true,
@@ -303,7 +316,7 @@ export class ColorArea extends SpectrumElement {
303
316
  0,
304
317
  Math.min(1, (offsetY - minOffsetY) / height)
305
318
  );
306
- return [this.isLTR ? percentX : 1 - percentX, percentY];
319
+ return [this.isLTR ? percentX : 1 - percentX, 1 - percentY];
307
320
  }
308
321
  handleAreaPointerdown(event) {
309
322
  if (event.button !== 0) {
@@ -345,7 +358,7 @@ export class ColorArea extends SpectrumElement {
345
358
  <div
346
359
  @pointerdown=${this.handleAreaPointerdown}
347
360
  class="gradient"
348
- style=${styleMap(style)}
361
+ style="background: ${style.background};"
349
362
  >
350
363
  <slot name="gradient"></slot>
351
364
  </div>
@@ -420,13 +433,31 @@ export class ColorArea extends SpectrumElement {
420
433
  this.addEventListener("keyup", this.handleKeyup);
421
434
  this.addEventListener("keydown", this.handleKeydown);
422
435
  }
436
+ /**
437
+ * Overrides the `updated` method to handle changes in property values.
438
+ *
439
+ * @param changed - A map of changed properties with their previous values.
440
+ *
441
+ * This method performs the following actions:
442
+ * - Updates the saturation (`s`) of the color if `x` has changed.
443
+ * - Updates the value (`v`) of the color if `y` has changed.
444
+ * - If the `focused` property has changed and is now true, it lazily binds
445
+ * the `input[type="range"]` elements in shadow roots to prevent multiple
446
+ * tab stops within the Color Area for certain browser settings (e.g., Webkit).
447
+ */
423
448
  updated(changed) {
424
449
  super.updated(changed);
425
450
  if (this.x !== this.inputX.valueAsNumber) {
426
- this._x = this.inputX.valueAsNumber;
451
+ this.colorController.color.set(
452
+ "s",
453
+ this.inputX.valueAsNumber * 100
454
+ );
427
455
  }
428
456
  if (this.y !== this.inputY.valueAsNumber) {
429
- this._y = this.inputY.valueAsNumber;
457
+ this.colorController.color.set(
458
+ "v",
459
+ (1 - this.inputY.valueAsNumber) * 100
460
+ );
430
461
  }
431
462
  if (changed.has("focused") && this.focused) {
432
463
  const parentX = this.inputX.parentElement;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["ColorArea.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n ifDefined,\n styleMap,\n} from '@spectrum-web-components/base/src/directives.js';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { streamingListener } from '@spectrum-web-components/base/src/streaming-listener.js';\nimport { SWCResizeObserverEntry, WithSWCResizeObserver } from './types';\nimport type { ColorHandle } from '@spectrum-web-components/color-handle';\nimport '@spectrum-web-components/color-handle/sp-color-handle.js';\nimport {\n ColorController,\n ColorValue,\n} from '@spectrum-web-components/reactive-controllers/src/Color.js';\nimport { LanguageResolutionController } from '@spectrum-web-components/reactive-controllers/src/LanguageResolution.js';\nimport {\n isAndroid,\n isIOS,\n} from '@spectrum-web-components/shared/src/platform.js';\n\nimport styles from './color-area.css.js';\n\n/**\n * @element sp-color-area\n * @slot gradient - a custom gradient visually outlining the available color values\n * @fires input - The value of the Color Area has changed.\n * @fires change - An alteration to the value of the Color Area has been committed by the user.\n */\nexport class ColorArea extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: String, reflect: true })\n public override dir!: 'ltr' | 'rtl';\n\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n @property({ type: Boolean, reflect: true })\n public focused = false;\n\n @property({ type: String, attribute: 'label-x' })\n public labelX = 'saturation';\n\n @property({ type: String, attribute: 'label-y' })\n public labelY = 'luminosity';\n\n @query('.handle')\n private handle!: ColorHandle;\n\n private languageResolver = new LanguageResolutionController(this);\n\n private colorController = new ColorController(this, {\n extractColorFromState: () => ({\n h: this.hue,\n s: this.x,\n v: this.y,\n }),\n applyColorToState: ({ s, v }) => {\n this._x = s;\n this._y = v;\n this.requestUpdate();\n },\n });\n\n @property({ type: Number })\n public get hue(): number {\n return this.colorController.hue;\n }\n\n public set hue(value: number) {\n this.colorController.hue = value;\n }\n\n @property({ type: String })\n public get value(): ColorValue {\n return this.colorController.color;\n }\n\n @property({ type: String })\n public get color(): ColorValue {\n return this.colorController.color;\n }\n\n public set color(color: ColorValue) {\n this.colorController.color = color;\n }\n\n @property({ attribute: false })\n private activeAxis = 'x';\n\n @property({ type: Number })\n public get x(): number {\n return this._x;\n }\n\n public set x(x: number) {\n if (x === this.x) {\n return;\n }\n const oldValue = this.x;\n this._x = x;\n if (this.inputX) {\n // Use the native `input[type='range']` control to validate this value after `firstUpdate`\n this.inputX.value = x.toString();\n this._x = this.inputX.valueAsNumber;\n }\n this.requestUpdate('x', oldValue);\n this.colorController.applyColorFromState();\n }\n\n private _x = 1;\n\n @property({ type: Number })\n public get y(): number {\n return this._y;\n }\n\n public set y(y: number) {\n if (y === this.y) {\n return;\n }\n const oldValue = this.y;\n this._y = y;\n if (this.inputY) {\n // Use the native `input[type='range']` control to validate this value after `firstUpdate`\n this.inputY.value = y.toString();\n this._y = this.inputY.valueAsNumber;\n }\n this.requestUpdate('y', oldValue);\n this.colorController.applyColorFromState();\n }\n\n private _y = 1;\n\n @property({ type: Number })\n public step = 0.01;\n\n @query('[name=\"x\"]')\n public inputX!: HTMLInputElement;\n\n @query('[name=\"y\"]')\n public inputY!: HTMLInputElement;\n\n private altered = 0;\n\n private activeKeys = new Set();\n\n private _valueChanged = false;\n\n public override focus(focusOptions: FocusOptions = {}): void {\n super.focus(focusOptions);\n this.forwardFocus();\n }\n\n private forwardFocus(): void {\n this.focused = this.hasVisibleFocusInTree();\n if (this.activeAxis === 'x') {\n this.inputX.focus();\n } else {\n this.inputY.focus();\n }\n }\n\n private handleFocus(): void {\n this.focused = true;\n this._valueChanged = false;\n }\n\n public handleBlur(): void {\n if (this._pointerDown) {\n return;\n }\n this.altered = 0;\n this.focused = false;\n this._valueChanged = false;\n }\n\n private handleKeydown(event: KeyboardEvent): void {\n const { code } = event;\n this.focused = true;\n this.altered = [event.shiftKey, event.ctrlKey, event.altKey].filter(\n (key) => !!key\n ).length;\n const isArrowKey =\n code.search('Arrow') === 0 ||\n code.search('Page') === 0 ||\n code.search('Home') === 0 ||\n code.search('End') === 0;\n if (isArrowKey) {\n event.preventDefault();\n this.activeKeys.add(code);\n this.handleKeypress();\n }\n }\n\n private handleKeypress(): void {\n let deltaX = 0;\n let deltaY = 0;\n const step = Math.max(this.step, this.altered * 5 * this.step);\n this.activeKeys.forEach((code) => {\n switch (code) {\n case 'ArrowUp':\n deltaY = step;\n break;\n case 'ArrowDown':\n deltaY = step * -1;\n break;\n case 'ArrowLeft':\n deltaX = this.step * (this.isLTR ? -1 : 1);\n break;\n case 'ArrowRight':\n deltaX = this.step * (this.isLTR ? 1 : -1);\n break;\n case 'PageUp':\n deltaY = step * 10;\n break;\n case 'PageDown':\n deltaY = step * -10;\n break;\n case 'Home':\n deltaX = step * (this.isLTR ? -10 : 10);\n break;\n case 'End':\n deltaX = step * (this.isLTR ? 10 : -10);\n break;\n /* c8 ignore next 2 */\n default:\n break;\n }\n });\n if (deltaX != 0) {\n this.activeAxis = 'x';\n this.inputX.focus();\n } else if (deltaY != 0) {\n this.activeAxis = 'y';\n this.inputY.focus();\n }\n this.x = Math.min(1, Math.max(this.x + deltaX, 0));\n this.y = Math.min(1, Math.max(this.y + deltaY, 0));\n\n this.colorController.savePreviousColor();\n this.colorController.applyColorFromState();\n\n if (deltaX != 0 || deltaY != 0) {\n this._valueChanged = true;\n this.dispatchEvent(\n new Event('input', {\n bubbles: true,\n composed: true,\n })\n );\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n if (!applyDefault) {\n this.colorController.restorePreviousColor();\n }\n }\n }\n\n private handleKeyup(event: KeyboardEvent): void {\n event.preventDefault();\n const { code } = event;\n this.activeKeys.delete(code);\n }\n\n private handleInput(event: Event & { target: HTMLInputElement }): void {\n const { valueAsNumber, name } = event.target;\n\n this[name as 'x' | 'y'] = valueAsNumber;\n this.colorController.applyColorFromState();\n }\n\n private handleChange(event: Event & { target: HTMLInputElement }): void {\n this.handleInput(event);\n this.dispatchEvent(\n new Event('change', {\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n }\n\n private boundingClientRect!: DOMRect;\n public _pointerDown = false;\n\n private handlePointerdown(event: PointerEvent): void {\n if (event.button !== 0) {\n event.preventDefault();\n return;\n }\n this._pointerDown = true;\n this.colorController.savePreviousColor();\n this.boundingClientRect = this.getBoundingClientRect();\n (event.target as HTMLElement).setPointerCapture(event.pointerId);\n if (event.pointerType === 'mouse') {\n this.focused = true;\n }\n }\n\n private handlePointermove(event: PointerEvent): void {\n const [x, y] = this.calculateHandlePosition(event);\n\n this._valueChanged = false;\n\n this.x = x;\n this.y = 1 - y;\n this.colorController.applyColorFromState();\n this.dispatchEvent(\n new Event('input', {\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n }\n\n private handlePointerup(event: PointerEvent): void {\n event.preventDefault();\n this._pointerDown = false;\n (event.target as HTMLElement).releasePointerCapture(event.pointerId);\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n this.inputX.focus();\n if (event.pointerType === 'mouse') {\n this.focused = false;\n }\n if (!applyDefault) {\n this.colorController.restorePreviousColor();\n }\n }\n\n /**\n * Returns the value under the cursor\n * @param: PointerEvent on slider\n * @return: Slider value that correlates to the position under the pointer\n */\n private calculateHandlePosition(event: PointerEvent): [number, number] {\n /* c8 ignore next 3 */\n if (!this.boundingClientRect) {\n return [this.x, this.y];\n }\n const rect = this.boundingClientRect;\n const minOffsetX = rect.left;\n const minOffsetY = rect.top;\n const offsetX = event.clientX;\n const offsetY = event.clientY;\n const width = rect.width;\n const height = rect.height;\n\n const percentX = Math.max(\n 0,\n Math.min(1, (offsetX - minOffsetX) / width)\n );\n const percentY = Math.max(\n 0,\n Math.min(1, (offsetY - minOffsetY) / height)\n );\n\n return [this.isLTR ? percentX : 1 - percentX, percentY];\n }\n\n private handleAreaPointerdown(event: PointerEvent): void {\n if (event.button !== 0) {\n return;\n }\n event.stopPropagation();\n event.preventDefault();\n this.handle.dispatchEvent(new PointerEvent('pointerdown', event));\n this.handlePointermove(event);\n }\n\n protected override render(): TemplateResult {\n const { width = 0, height = 0 } = this.boundingClientRect || {};\n\n const isMobile = isAndroid() || isIOS();\n const defaultAriaLabel = 'Color Picker';\n const ariaLabel = defaultAriaLabel;\n const ariaRoleDescription = ifDefined(\n isMobile ? undefined : '2d slider'\n );\n\n const ariaLabelX = this.labelX;\n const ariaLabelY = this.labelY;\n const ariaValueX = new Intl.NumberFormat(\n this.languageResolver.language,\n {\n style: 'percent',\n unitDisplay: 'narrow',\n }\n ).format(this.x);\n const ariaValueY = new Intl.NumberFormat(\n this.languageResolver.language,\n {\n style: 'percent',\n unitDisplay: 'narrow',\n }\n ).format(this.y);\n\n const style = {\n background: `linear-gradient(to top, black 0%, hsla(${this.hue}, 100%, 0.01%, 0) 100%),linear-gradient(to right, white 0%, hsla(${this.hue}, 100%, 0.01%, 0) 100%), hsl(${this.hue}, 100%, 50%);`,\n };\n\n return html`\n <div\n @pointerdown=${this.handleAreaPointerdown}\n class=\"gradient\"\n style=${styleMap(style)}\n >\n <slot name=\"gradient\"></slot>\n </div>\n\n <sp-color-handle\n tabindex=${ifDefined(this.focused ? undefined : '0')}\n @focus=${this.forwardFocus}\n ?focused=${this.focused}\n class=\"handle\"\n color=${this.colorController.getHslString()}\n ?disabled=${this.disabled}\n style=${`transform: translate(${\n (this.isLTR ? this.x : 1 - this.x) * width\n }px, ${height - this.y * height}px);`}\n ${streamingListener({\n start: ['pointerdown', this.handlePointerdown],\n streamInside: ['pointermove', this.handlePointermove],\n end: [\n ['pointerup', 'pointercancel', 'pointerleave'],\n this.handlePointerup,\n ],\n })}\n ></sp-color-handle>\n\n <fieldset\n class=\"fieldset\"\n aria-label=${ifDefined(isMobile ? ariaLabel : undefined)}\n >\n <div role=\"presentation\">\n <input\n type=\"range\"\n class=\"slider\"\n name=\"x\"\n aria-label=${isMobile\n ? ariaLabelX\n : `${ariaLabelX} ${ariaLabel}`}\n aria-roledescription=${ariaRoleDescription}\n aria-orientation=\"horizontal\"\n aria-valuetext=${isMobile\n ? ariaValueX\n : `${ariaValueX}, ${ariaLabelX}${\n this._valueChanged\n ? ''\n : `, ${ariaValueY}, ${ariaLabelY}`\n }`}\n min=\"0\"\n max=\"1\"\n step=${this.step}\n tabindex=\"-1\"\n .value=${String(this.x)}\n @input=${this.handleInput}\n @change=${this.handleChange}\n />\n </div>\n <div role=\"presentation\">\n <input\n type=\"range\"\n class=\"slider\"\n name=\"y\"\n aria-label=${isMobile\n ? ariaLabelY\n : `${ariaLabelY} ${ariaLabel}`}\n aria-roledescription=${ariaRoleDescription}\n aria-orientation=\"vertical\"\n aria-valuetext=${isMobile\n ? ariaValueY\n : `${ariaValueY}, ${ariaLabelY}${\n this._valueChanged\n ? ''\n : `, ${ariaValueX}, ${ariaLabelX}`\n }`}\n orient=\"vertical\"\n min=\"0\"\n max=\"1\"\n step=${this.step}\n tabindex=\"-1\"\n .value=${String(this.y)}\n @input=${this.handleInput}\n @change=${this.handleChange}\n />\n </div>\n </fieldset>\n `;\n }\n\n protected override firstUpdated(changed: PropertyValues): void {\n super.firstUpdated(changed);\n this.boundingClientRect = this.getBoundingClientRect();\n\n this.addEventListener('focus', this.handleFocus);\n this.addEventListener('blur', this.handleBlur);\n this.addEventListener('keyup', this.handleKeyup);\n this.addEventListener('keydown', this.handleKeydown);\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n if (this.x !== this.inputX.valueAsNumber) {\n this._x = this.inputX.valueAsNumber;\n }\n if (this.y !== this.inputY.valueAsNumber) {\n this._y = this.inputY.valueAsNumber;\n }\n if (changed.has('focused') && this.focused) {\n // Lazily bind the `input[type=\"range\"]` elements in shadow roots\n // so that browsers with certain settings (Webkit) aren't allowed\n // multiple tab stops within the Color Area.\n const parentX = this.inputX.parentElement as HTMLDivElement;\n const parentY = this.inputY.parentElement as HTMLDivElement;\n if (!parentX.shadowRoot && !parentY.shadowRoot) {\n parentX.attachShadow({ mode: 'open' });\n parentY.attachShadow({ mode: 'open' });\n const slot = '<div tabindex=\"-1\"><slot></slot></div>';\n (parentX.shadowRoot as unknown as ShadowRoot).innerHTML = slot;\n (parentY.shadowRoot as unknown as ShadowRoot).innerHTML = slot;\n }\n }\n }\n\n private observer?: WithSWCResizeObserver['ResizeObserver'];\n\n public override connectedCallback(): void {\n super.connectedCallback();\n if (\n !this.observer &&\n (window as unknown as WithSWCResizeObserver).ResizeObserver\n ) {\n this.observer = new (\n window as unknown as WithSWCResizeObserver\n ).ResizeObserver((entries: SWCResizeObserverEntry[]) => {\n for (const entry of entries) {\n this.boundingClientRect = entry.contentRect;\n }\n this.requestUpdate();\n });\n }\n this.observer?.observe(this);\n }\n\n public override disconnectedCallback(): void {\n this.observer?.unobserve(this);\n super.disconnectedCallback();\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EAEA;AAAA,OAE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AC/B;AACJ;AAjhBoB;AAAA,EADf,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GALhC,UAMO;AAGT;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GARjC,UASF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAXjC,UAYF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,WAAW,UAAU,CAAC;AAAA,GAdvC,UAeF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,WAAW,UAAU,CAAC;AAAA,GAjBvC,UAkBF;AAGC;AAAA,EADP,MAAM,SAAS;AAAA,GApBP,UAqBD;AAkBG;AAAA,EADV,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAtCjB,UAuCE;AASA;AAAA,EADV,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GA/CjB,UAgDE;AAKA;AAAA,EADV,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GApDjB,UAqDE;AASH;AAAA,EADP,SAAS,EAAE,WAAW,MAAM,CAAC;AAAA,GA7DrB,UA8DD;AAGG;AAAA,EADV,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAhEjB,UAiEE;AAsBA;AAAA,EADV,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAtFjB,UAuFE;AAsBJ;AAAA,EADN,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GA5GjB,UA6GF;AAGA;AAAA,EADN,MAAM,YAAY;AAAA,GA/GV,UAgHF;AAGA;AAAA,EADN,MAAM,YAAY;AAAA,GAlHV,UAmHF;",
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { streamingListener } from '@spectrum-web-components/base/src/streaming-listener.js';\nimport { SWCResizeObserverEntry, WithSWCResizeObserver } from './types';\nimport type { ColorHandle } from '@spectrum-web-components/color-handle';\nimport '@spectrum-web-components/color-handle/sp-color-handle.js';\n\nimport {\n ColorController,\n ColorTypes,\n} from '@spectrum-web-components/reactive-controllers/src/ColorController.js';\nimport { LanguageResolutionController } from '@spectrum-web-components/reactive-controllers/src/LanguageResolution.js';\nimport {\n isAndroid,\n isIOS,\n} from '@spectrum-web-components/shared/src/platform.js';\n\nimport styles from './color-area.css.js';\n\n/**\n * @element sp-color-area\n * @slot gradient - a custom gradient visually outlining the available color values\n * @fires input - The value of the Color Area has changed.\n * @fires change - An alteration to the value of the Color Area has been committed by the user.\n */\nexport class ColorArea extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: String, reflect: true })\n public override dir!: 'ltr' | 'rtl';\n\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n @property({ type: Boolean, reflect: true })\n public focused = false;\n\n @property({ type: String, attribute: 'label-x' })\n public labelX = 'saturation';\n\n @property({ type: String, attribute: 'label-y' })\n public labelY = 'luminosity';\n\n @query('.handle')\n private handle!: ColorHandle;\n\n private languageResolver = new LanguageResolutionController(this);\n\n /**\n * A controller for managing color interactions within the ColorArea component.\n *\n * The `ColorController` is instantiated with the `manageAs` option set to `hsv`\n * because the ColorArea component is designed to manipulate the saturation (`s`)\n * and value (`v`) components of the HSV color model along the x and y axes,\n * respectively. In the HSV color model:\n *\n * - The `hue` (h) represents the color type and is typically controlled by a separate input.\n * - The `saturation` (s) represents the intensity of the color, ranging from 0% (gray) to 100% (full color).\n * - The `value` (v) represents the brightness of the color, ranging from 0% (black) to 100% (full brightness).\n *\n * In the ColorArea component:\n *\n * - The x-axis controls the saturation (`s`), allowing users to adjust the intensity of the color.\n * - The y-axis controls the value (`v`), allowing users to adjust the brightness of the color.\n *\n * By managing the color as `hsv`, the ColorController can efficiently handle the changes in saturation and value\n * as the user interacts with the ColorArea component.\n *\n * @private\n * @type {ColorController}\n * @memberof ColorArea\n *\n * @property {ColorArea} this - The instance of the ColorArea component.\n * @property {Object} options - Configuration options for the ColorController.\n * @property {string} options.manageAs - Specifies the color model to manage, in this case 'hsv'.\n */\n private colorController = new ColorController(this, { manageAs: 'hsv' });\n\n @property({ type: Number })\n public get hue(): number {\n return this.colorController.hue;\n }\n\n public set hue(value: number) {\n this.colorController.hue = value;\n }\n\n @property({ type: String })\n public get value(): ColorTypes {\n return this.colorController.colorValue;\n }\n\n @property({ type: String })\n public get color(): ColorTypes {\n return this.colorController.colorValue;\n }\n\n public set color(color: ColorTypes) {\n this.colorController.color = color;\n }\n\n @property({ attribute: false })\n private activeAxis = 'x';\n\n @property({ type: Number })\n public get x(): number {\n return this.colorController.color.hsv.s / 100;\n }\n\n public set x(x: number) {\n if (x === this.x) {\n return;\n }\n const oldValue = this.x;\n if (this.inputX) {\n // Use the native `input[type='range']` control to validate this value after `firstUpdate`\n this.inputX.value = x.toString();\n this.colorController.color.set(\n 's',\n this.inputX.valueAsNumber * 100\n );\n } else {\n this.colorController.color.set('s', x * 100);\n }\n this.requestUpdate('x', oldValue);\n }\n\n @property({ type: Number })\n public get y(): number {\n return this.colorController.color.hsv.v / 100;\n }\n\n public set y(y: number) {\n if (y === this.y) {\n return;\n }\n const oldValue = this.y;\n if (this.inputY) {\n // Use the native `input[type='range']` control to validate this value after `firstUpdate`\n this.inputY.value = y.toString();\n this.colorController.color.set(\n 'v',\n this.inputY.valueAsNumber * 100\n );\n }\n this.requestUpdate('y', oldValue);\n }\n\n @property({ type: Number })\n public step = 0.01;\n\n @query('[name=\"x\"]')\n public inputX!: HTMLInputElement;\n\n @query('[name=\"y\"]')\n public inputY!: HTMLInputElement;\n\n private altered = 0;\n\n private activeKeys = new Set();\n\n private _valueChanged = false;\n\n public override focus(focusOptions: FocusOptions = {}): void {\n super.focus(focusOptions);\n this.forwardFocus();\n }\n\n private forwardFocus(): void {\n this.focused = this.hasVisibleFocusInTree();\n if (this.activeAxis === 'x') {\n this.inputX.focus();\n } else {\n this.inputY.focus();\n }\n }\n\n private handleFocus(): void {\n this.focused = true;\n this._valueChanged = false;\n }\n\n public handleBlur(): void {\n if (this._pointerDown) {\n return;\n }\n this.altered = 0;\n this.focused = false;\n this._valueChanged = false;\n }\n\n private handleKeydown(event: KeyboardEvent): void {\n const { code } = event;\n this.focused = true;\n\n this.altered = [event.shiftKey, event.ctrlKey, event.altKey].filter(\n (key) => !!key\n ).length;\n const isArrowKey =\n code.search('Arrow') === 0 ||\n code.search('Page') === 0 ||\n code.search('Home') === 0 ||\n code.search('End') === 0;\n if (isArrowKey) {\n event.preventDefault();\n this.activeKeys.add(code);\n this.handleKeypress();\n }\n }\n\n private handleKeypress(): void {\n let deltaX = 0;\n let deltaY = 0;\n const step = Math.max(this.step, this.altered * 5 * this.step);\n this.activeKeys.forEach((code) => {\n switch (code) {\n case 'ArrowUp':\n deltaY = step;\n break;\n case 'ArrowDown':\n deltaY = step * -1;\n break;\n case 'ArrowLeft':\n deltaX = this.step * (this.isLTR ? -1 : 1);\n break;\n case 'ArrowRight':\n deltaX = this.step * (this.isLTR ? 1 : -1);\n break;\n case 'PageUp':\n deltaY = step * 10;\n break;\n case 'PageDown':\n deltaY = step * -10;\n break;\n case 'Home':\n deltaX = step * (this.isLTR ? -10 : 10);\n break;\n case 'End':\n deltaX = step * (this.isLTR ? 10 : -10);\n break;\n /* c8 ignore next 2 */\n default:\n break;\n }\n });\n if (deltaX != 0) {\n this.activeAxis = 'x';\n this.inputX.focus();\n } else if (deltaY != 0) {\n this.activeAxis = 'y';\n this.inputY.focus();\n }\n this.x = Math.min(1, Math.max(this.x + deltaX, 0));\n this.y = Math.min(1, Math.max(this.y + deltaY, 0));\n\n this.colorController.savePreviousColor();\n\n if (deltaX != 0 || deltaY != 0) {\n this._valueChanged = true;\n this.dispatchEvent(\n new Event('input', {\n bubbles: true,\n composed: true,\n })\n );\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n if (!applyDefault) {\n this.colorController.restorePreviousColor();\n }\n }\n }\n\n private handleKeyup(event: KeyboardEvent): void {\n event.preventDefault();\n const { code } = event;\n this.activeKeys.delete(code);\n }\n\n private handleInput(event: Event & { target: HTMLInputElement }): void {\n const { valueAsNumber, name } = event.target;\n\n this[name as 'x' | 'y'] = valueAsNumber;\n }\n\n private handleChange(event: Event & { target: HTMLInputElement }): void {\n this.handleInput(event);\n this.dispatchEvent(\n new Event('change', {\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n }\n\n private boundingClientRect!: DOMRect;\n public _pointerDown = false;\n\n private handlePointerdown(event: PointerEvent): void {\n if (event.button !== 0) {\n event.preventDefault();\n return;\n }\n this._pointerDown = true;\n this.colorController.savePreviousColor();\n this.boundingClientRect = this.getBoundingClientRect();\n (event.target as HTMLElement).setPointerCapture(event.pointerId);\n if (event.pointerType === 'mouse') {\n this.focused = true;\n }\n }\n\n private handlePointermove(event: PointerEvent): void {\n const [x, y] = this.calculateHandlePosition(event);\n\n this._valueChanged = false;\n\n this.x = x;\n this.y = y;\n\n this.dispatchEvent(\n new Event('input', {\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n }\n\n private handlePointerup(event: PointerEvent): void {\n event.preventDefault();\n this._pointerDown = false;\n (event.target as HTMLElement).releasePointerCapture(event.pointerId);\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n this.inputX.focus();\n if (event.pointerType === 'mouse') {\n this.focused = false;\n }\n if (!applyDefault) {\n this.colorController.restorePreviousColor();\n }\n }\n\n /**\n * Returns the value under the cursor\n * @param: PointerEvent on slider\n * @return: Slider value that correlates to the position under the pointer\n */\n private calculateHandlePosition(event: PointerEvent): [number, number] {\n /* c8 ignore next 3 */\n if (!this.boundingClientRect) {\n return [this.x, this.y];\n }\n const rect = this.boundingClientRect;\n const minOffsetX = rect.left;\n const minOffsetY = rect.top;\n const offsetX = event.clientX;\n const offsetY = event.clientY;\n const width = rect.width;\n const height = rect.height;\n\n const percentX = Math.max(\n 0,\n Math.min(1, (offsetX - minOffsetX) / width)\n );\n const percentY = Math.max(\n 0,\n Math.min(1, (offsetY - minOffsetY) / height)\n );\n\n return [this.isLTR ? percentX : 1 - percentX, 1 - percentY];\n }\n\n private handleAreaPointerdown(event: PointerEvent): void {\n if (event.button !== 0) {\n return;\n }\n event.stopPropagation();\n event.preventDefault();\n this.handle.dispatchEvent(new PointerEvent('pointerdown', event));\n this.handlePointermove(event);\n }\n\n protected override render(): TemplateResult {\n const { width = 0, height = 0 } = this.boundingClientRect || {};\n\n const isMobile = isAndroid() || isIOS();\n const defaultAriaLabel = 'Color Picker';\n const ariaLabel = defaultAriaLabel;\n const ariaRoleDescription = ifDefined(\n isMobile ? undefined : '2d slider'\n );\n\n const ariaLabelX = this.labelX;\n const ariaLabelY = this.labelY;\n const ariaValueX = new Intl.NumberFormat(\n this.languageResolver.language,\n {\n style: 'percent',\n unitDisplay: 'narrow',\n }\n ).format(this.x);\n const ariaValueY = new Intl.NumberFormat(\n this.languageResolver.language,\n {\n style: 'percent',\n unitDisplay: 'narrow',\n }\n ).format(this.y);\n\n const style = {\n background: `linear-gradient(to top, black 0%, hsla(${this.hue}, 100%, 0.01%, 0) 100%),linear-gradient(to right, white 0%, hsla(${this.hue}, 100%, 0.01%, 0) 100%), hsl(${this.hue}, 100%, 50%);`,\n };\n\n return html`\n <div\n @pointerdown=${this.handleAreaPointerdown}\n class=\"gradient\"\n style=\"background: ${style.background};\"\n >\n <slot name=\"gradient\"></slot>\n </div>\n\n <sp-color-handle\n tabindex=${ifDefined(this.focused ? undefined : '0')}\n @focus=${this.forwardFocus}\n ?focused=${this.focused}\n class=\"handle\"\n color=${this.colorController.getHslString()}\n ?disabled=${this.disabled}\n style=${`transform: translate(${\n (this.isLTR ? this.x : 1 - this.x) * width\n }px, ${height - this.y * height}px);`}\n ${streamingListener({\n start: ['pointerdown', this.handlePointerdown],\n streamInside: ['pointermove', this.handlePointermove],\n end: [\n ['pointerup', 'pointercancel', 'pointerleave'],\n this.handlePointerup,\n ],\n })}\n ></sp-color-handle>\n\n <fieldset\n class=\"fieldset\"\n aria-label=${ifDefined(isMobile ? ariaLabel : undefined)}\n >\n <div role=\"presentation\">\n <input\n type=\"range\"\n class=\"slider\"\n name=\"x\"\n aria-label=${isMobile\n ? ariaLabelX\n : `${ariaLabelX} ${ariaLabel}`}\n aria-roledescription=${ariaRoleDescription}\n aria-orientation=\"horizontal\"\n aria-valuetext=${isMobile\n ? ariaValueX\n : `${ariaValueX}, ${ariaLabelX}${\n this._valueChanged\n ? ''\n : `, ${ariaValueY}, ${ariaLabelY}`\n }`}\n min=\"0\"\n max=\"1\"\n step=${this.step}\n tabindex=\"-1\"\n .value=${String(this.x)}\n @input=${this.handleInput}\n @change=${this.handleChange}\n />\n </div>\n <div role=\"presentation\">\n <input\n type=\"range\"\n class=\"slider\"\n name=\"y\"\n aria-label=${isMobile\n ? ariaLabelY\n : `${ariaLabelY} ${ariaLabel}`}\n aria-roledescription=${ariaRoleDescription}\n aria-orientation=\"vertical\"\n aria-valuetext=${isMobile\n ? ariaValueY\n : `${ariaValueY}, ${ariaLabelY}${\n this._valueChanged\n ? ''\n : `, ${ariaValueX}, ${ariaLabelX}`\n }`}\n orient=\"vertical\"\n min=\"0\"\n max=\"1\"\n step=${this.step}\n tabindex=\"-1\"\n .value=${String(this.y)}\n @input=${this.handleInput}\n @change=${this.handleChange}\n />\n </div>\n </fieldset>\n `;\n }\n\n protected override firstUpdated(changed: PropertyValues): void {\n super.firstUpdated(changed);\n this.boundingClientRect = this.getBoundingClientRect();\n\n this.addEventListener('focus', this.handleFocus);\n this.addEventListener('blur', this.handleBlur);\n this.addEventListener('keyup', this.handleKeyup);\n this.addEventListener('keydown', this.handleKeydown);\n }\n\n /**\n * Overrides the `updated` method to handle changes in property values.\n *\n * @param changed - A map of changed properties with their previous values.\n *\n * This method performs the following actions:\n * - Updates the saturation (`s`) of the color if `x` has changed.\n * - Updates the value (`v`) of the color if `y` has changed.\n * - If the `focused` property has changed and is now true, it lazily binds\n * the `input[type=\"range\"]` elements in shadow roots to prevent multiple\n * tab stops within the Color Area for certain browser settings (e.g., Webkit).\n */\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n if (this.x !== this.inputX.valueAsNumber) {\n this.colorController.color.set(\n 's',\n this.inputX.valueAsNumber * 100\n );\n }\n if (this.y !== this.inputY.valueAsNumber) {\n this.colorController.color.set(\n 'v',\n (1 - this.inputY.valueAsNumber) * 100\n );\n }\n if (changed.has('focused') && this.focused) {\n // Lazily bind the `input[type=\"range\"]` elements in shadow roots\n // so that browsers with certain settings (Webkit) aren't allowed\n // multiple tab stops within the Color Area.\n const parentX = this.inputX.parentElement as HTMLDivElement;\n const parentY = this.inputY.parentElement as HTMLDivElement;\n if (!parentX.shadowRoot && !parentY.shadowRoot) {\n parentX.attachShadow({ mode: 'open' });\n parentY.attachShadow({ mode: 'open' });\n const slot = '<div tabindex=\"-1\"><slot></slot></div>';\n (parentX.shadowRoot as unknown as ShadowRoot).innerHTML = slot;\n (parentY.shadowRoot as unknown as ShadowRoot).innerHTML = slot;\n }\n }\n }\n\n private observer?: WithSWCResizeObserver['ResizeObserver'];\n\n public override connectedCallback(): void {\n super.connectedCallback();\n if (\n !this.observer &&\n (window as unknown as WithSWCResizeObserver).ResizeObserver\n ) {\n this.observer = new (\n window as unknown as WithSWCResizeObserver\n ).ResizeObserver((entries: SWCResizeObserverEntry[]) => {\n for (const entry of entries) {\n this.boundingClientRect = entry.contentRect;\n }\n this.requestUpdate();\n });\n }\n this.observer?.observe(this);\n }\n\n public override disconnectedCallback(): void {\n this.observer?.unobserve(this);\n super.disconnectedCallback();\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EAEA;AAAA,OAEG;AACP,SAAS,iBAAiB;AAC1B;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,SAAS,yBAAyB;AAGlC,OAAO;AAEP;AAAA,EACI;AAAA,OAEG;AACP,SAAS,oCAAoC;AAC7C;AAAA,EACI;AAAA,EACA;AAAA,OACG;AAEP,OAAO,YAAY;AAQZ,aAAM,kBAAkB,gBAAgB;AAAA,EAAxC;AAAA;AASH,SAAO,WAAW;AAGlB,SAAO,UAAU;AAGjB,SAAO,SAAS;AAGhB,SAAO,SAAS;AAKhB,SAAQ,mBAAmB,IAAI,6BAA6B,IAAI;AA8BhE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAQ,kBAAkB,IAAI,gBAAgB,MAAM,EAAE,UAAU,MAAM,CAAC;AA0BvE,SAAQ,aAAa;AA+CrB,SAAO,OAAO;AAQd,SAAQ,UAAU;AAElB,SAAQ,aAAa,oBAAI,IAAI;AAE7B,SAAQ,gBAAgB;AA6IxB,SAAO,eAAe;AAAA;AAAA,EAtRtB,WAA2B,SAAyB;AAChD,WAAO,CAAC,MAAM;AAAA,EAClB;AAAA,EAqDA,IAAW,MAAc;AACrB,WAAO,KAAK,gBAAgB;AAAA,EAChC;AAAA,EAEA,IAAW,IAAI,OAAe;AAC1B,SAAK,gBAAgB,MAAM;AAAA,EAC/B;AAAA,EAGA,IAAW,QAAoB;AAC3B,WAAO,KAAK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