@spectrum-web-components/color-area 0.4.9 → 0.4.11-devmode.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/color-area",
3
- "version": "0.4.9",
3
+ "version": "0.4.11-devmode.7+8303f3a2a",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -20,11 +20,28 @@
20
20
  "module": "src/index.js",
21
21
  "type": "module",
22
22
  "exports": {
23
- ".": "./src/index.js",
24
- "./src/*": "./src/*",
23
+ ".": {
24
+ "development": "./src/index.dev.js",
25
+ "default": "./src/index.js"
26
+ },
25
27
  "./package.json": "./package.json",
26
- "./sp-color-area": "./sp-color-area.js",
27
- "./sp-color-area.js": "./sp-color-area.js"
28
+ "./src/ColorArea.js": {
29
+ "development": "./src/ColorArea.dev.js",
30
+ "default": "./src/ColorArea.js"
31
+ },
32
+ "./src/color-area.css.js": "./src/color-area.css.js",
33
+ "./src/index.js": {
34
+ "development": "./src/index.dev.js",
35
+ "default": "./src/index.js"
36
+ },
37
+ "./src/types.js": {
38
+ "development": "./src/types.dev.js",
39
+ "default": "./src/types.js"
40
+ },
41
+ "./sp-color-area.js": {
42
+ "development": "./sp-color-area.dev.js",
43
+ "default": "./sp-color-area.js"
44
+ }
28
45
  },
29
46
  "scripts": {
30
47
  "test": "echo \"Error: run tests from mono-repo root.\" && exit 1"
@@ -45,17 +62,17 @@
45
62
  ],
46
63
  "dependencies": {
47
64
  "@ctrl/tinycolor": "^3.3.3",
48
- "@spectrum-web-components/base": "^0.5.8",
49
- "@spectrum-web-components/color-handle": "^0.3.9",
65
+ "@spectrum-web-components/base": "^0.5.9-devmode.31+8303f3a2a",
66
+ "@spectrum-web-components/color-handle": "^0.3.11-devmode.7+8303f3a2a",
50
67
  "tslib": "^2.0.0"
51
68
  },
52
69
  "devDependencies": {
53
- "@spectrum-css/colorarea": "^1.0.20"
70
+ "@spectrum-css/colorarea": "^1.0.22"
54
71
  },
55
72
  "types": "./src/index.d.ts",
56
73
  "customElements": "custom-elements.json",
57
74
  "sideEffects": [
58
75
  "./sp-*.js"
59
76
  ],
60
- "gitHead": "e5cd4a0db2201b8126eb9133ac3c24172d086359"
77
+ "gitHead": "8303f3a2a90b0aedc15158797662ccfa8f4a2031"
61
78
  }
@@ -0,0 +1,3 @@
1
+ import { ColorArea } from "./src/ColorArea.dev.js";
2
+ customElements.define("sp-color-area", ColorArea);
3
+ //# sourceMappingURL=sp-color-area.dev.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["sp-color-area.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 { ColorArea } from './src/ColorArea.dev.js'\n\ncustomElements.define('sp-color-area', ColorArea);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-color-area': ColorArea;\n }\n}\n"],
5
+ "mappings": "AAYA;AAEA,eAAe,OAAO,iBAAiB,SAAS;",
6
+ "names": []
7
+ }
package/sp-color-area.js CHANGED
@@ -1,14 +1,3 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import { ColorArea } from './src/ColorArea.js';
13
- customElements.define('sp-color-area', ColorArea);
14
- //# sourceMappingURL=sp-color-area.js.map
1
+ import { ColorArea } from "./src/ColorArea.js";
2
+ customElements.define("sp-color-area", ColorArea);
3
+ //# sourceMappingURL=sp-color-area.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"sp-color-area.js","sourceRoot":"","sources":["sp-color-area.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,cAAc,CAAC,MAAM,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC","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 { ColorArea } from './src/ColorArea.js';\n\ncustomElements.define('sp-color-area', ColorArea);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-color-area': ColorArea;\n }\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["sp-color-area.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 { ColorArea } from './src/ColorArea.js';\n\ncustomElements.define('sp-color-area', ColorArea);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-color-area': ColorArea;\n }\n}\n"],
5
+ "mappings": "AAYA;AAEA,eAAe,OAAO,iBAAiB,SAAS;",
6
+ "names": []
7
+ }
@@ -0,0 +1,486 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
12
+ import {
13
+ html,
14
+ SpectrumElement
15
+ } from "@spectrum-web-components/base";
16
+ import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
17
+ import {
18
+ property,
19
+ query
20
+ } from "@spectrum-web-components/base/src/decorators.js";
21
+ import { streamingListener } from "@spectrum-web-components/base/src/streaming-listener.js";
22
+ import {
23
+ extractHueAndSaturationRegExp,
24
+ replaceHueRegExp
25
+ } from "@spectrum-web-components/color-handle";
26
+ import "@spectrum-web-components/color-handle/sp-color-handle.js";
27
+ import { TinyColor } from "@ctrl/tinycolor";
28
+ import styles from "./color-area.css.js";
29
+ export class ColorArea extends SpectrumElement {
30
+ constructor() {
31
+ super(...arguments);
32
+ this.disabled = false;
33
+ this.focused = false;
34
+ this.labelX = "saturation";
35
+ this.labelY = "luminosity";
36
+ this._hue = 0;
37
+ this._color = new TinyColor({ h: 0, s: 1, v: 1 });
38
+ this._previousColor = new TinyColor({ h: 0, s: 1, v: 1 });
39
+ this._format = {
40
+ format: "",
41
+ isString: false
42
+ };
43
+ this.activeAxis = "x";
44
+ this._x = 1;
45
+ this._y = 0;
46
+ this.step = 0.01;
47
+ this.altered = 0;
48
+ this.activeKeys = /* @__PURE__ */ new Set();
49
+ this._pointerDown = false;
50
+ }
51
+ static get styles() {
52
+ return [styles];
53
+ }
54
+ get hue() {
55
+ return this._hue;
56
+ }
57
+ set hue(value) {
58
+ const hue = Math.min(360, Math.max(0, value));
59
+ if (hue === this.hue) {
60
+ return;
61
+ }
62
+ const oldValue = this.hue;
63
+ const { s, v } = this._color.toHsv();
64
+ this._color = new TinyColor({ h: hue, s, v });
65
+ this._hue = hue;
66
+ this.requestUpdate("hue", oldValue);
67
+ }
68
+ get value() {
69
+ return this.color;
70
+ }
71
+ get color() {
72
+ switch (this._format.format) {
73
+ case "rgb":
74
+ return this._format.isString ? this._color.toRgbString() : this._color.toRgb();
75
+ case "prgb":
76
+ return this._format.isString ? this._color.toPercentageRgbString() : this._color.toPercentageRgb();
77
+ case "hex8":
78
+ return this._format.isString ? this._color.toHex8String() : this._color.toHex8();
79
+ case "name":
80
+ return this._color.toName() || this._color.toRgbString();
81
+ case "hsl":
82
+ if (this._format.isString) {
83
+ const hslString = this._color.toHslString();
84
+ return hslString.replace(replaceHueRegExp, `$1${this.hue}`);
85
+ } else {
86
+ const { s, l, a } = this._color.toHsl();
87
+ return { h: this.hue, s, l, a };
88
+ }
89
+ case "hsv":
90
+ if (this._format.isString) {
91
+ const hsvString = this._color.toHsvString();
92
+ return hsvString.replace(replaceHueRegExp, `$1${this.hue}`);
93
+ } else {
94
+ const { s, v, a } = this._color.toHsv();
95
+ return { h: this.hue, s, v, a };
96
+ }
97
+ case "hex":
98
+ case "hex3":
99
+ case "hex4":
100
+ case "hex6":
101
+ default:
102
+ return this._format.isString ? this._color.toHexString() : this._color.toHex();
103
+ }
104
+ }
105
+ set color(color) {
106
+ if (color === this.color) {
107
+ return;
108
+ }
109
+ const oldValue = this._color;
110
+ this._color = new TinyColor(color);
111
+ const format = this._color.format;
112
+ let isString = typeof color === "string" || color instanceof String;
113
+ if (format.startsWith("hex")) {
114
+ isString = color.startsWith("#");
115
+ }
116
+ this._format = {
117
+ format,
118
+ isString
119
+ };
120
+ const { h, s, v } = this._color.toHsv();
121
+ let originalHue = void 0;
122
+ if (isString && format.startsWith("hs")) {
123
+ const values = extractHueAndSaturationRegExp.exec(color);
124
+ if (values !== null) {
125
+ const [, h2] = values;
126
+ originalHue = Number(h2);
127
+ }
128
+ } else if (!isString && format.startsWith("hs")) {
129
+ const colorInput = this._color.originalInput;
130
+ const colorValues = Object.values(colorInput);
131
+ originalHue = colorValues[0];
132
+ }
133
+ this.hue = originalHue || h;
134
+ this.x = s;
135
+ this.y = 1 - v;
136
+ this.requestUpdate("color", oldValue);
137
+ }
138
+ get x() {
139
+ return this._x;
140
+ }
141
+ set x(x) {
142
+ if (x === this.x) {
143
+ return;
144
+ }
145
+ const oldValue = this.x;
146
+ if (this.inputX) {
147
+ this.inputX.value = x.toString();
148
+ this._x = this.inputX.valueAsNumber;
149
+ } else {
150
+ this._x = x;
151
+ }
152
+ this.requestUpdate("x", oldValue);
153
+ }
154
+ get y() {
155
+ return this._y;
156
+ }
157
+ set y(y) {
158
+ if (y === this.y) {
159
+ return;
160
+ }
161
+ const oldValue = this.y;
162
+ if (this.inputY) {
163
+ this.inputY.value = y.toString();
164
+ this._y = this.inputY.valueAsNumber;
165
+ } else {
166
+ this._y = y;
167
+ }
168
+ this.requestUpdate("y", oldValue);
169
+ }
170
+ focus(focusOptions = {}) {
171
+ super.focus(focusOptions);
172
+ this.forwardFocus();
173
+ }
174
+ forwardFocus() {
175
+ this.focused = this.hasVisibleFocusInTree();
176
+ if (this.activeAxis === "x") {
177
+ this.inputX.focus();
178
+ } else {
179
+ this.inputY.focus();
180
+ }
181
+ }
182
+ handleFocusin() {
183
+ this.focused = true;
184
+ }
185
+ handleFocusout() {
186
+ if (this._pointerDown) {
187
+ return;
188
+ }
189
+ this.focused = false;
190
+ }
191
+ handleKeydown(event) {
192
+ const { code } = event;
193
+ this.focused = true;
194
+ this.altered = [event.shiftKey, event.ctrlKey, event.altKey].filter((key) => !!key).length;
195
+ const isArrowKey = code.search("Arrow") === 0;
196
+ if (isArrowKey) {
197
+ event.preventDefault();
198
+ this.activeKeys.add(code);
199
+ this.handleKeypress();
200
+ }
201
+ }
202
+ handleKeypress() {
203
+ let deltaX = 0;
204
+ let deltaY = 0;
205
+ const step = Math.max(this.step, this.altered * 5 * this.step);
206
+ this.activeKeys.forEach((code) => {
207
+ switch (code) {
208
+ case "ArrowUp":
209
+ deltaY = step * -1;
210
+ break;
211
+ case "ArrowDown":
212
+ deltaY = step * 1;
213
+ break;
214
+ case "ArrowLeft":
215
+ deltaX = step * -1;
216
+ break;
217
+ case "ArrowRight":
218
+ deltaX = step * 1;
219
+ break;
220
+ default:
221
+ break;
222
+ }
223
+ });
224
+ if (deltaX != 0) {
225
+ this.activeAxis = "x";
226
+ this.inputX.focus();
227
+ } else if (deltaY != 0) {
228
+ this.activeAxis = "y";
229
+ this.inputY.focus();
230
+ }
231
+ this.x = Math.min(1, Math.max(this.x + deltaX, 0));
232
+ this.y = Math.min(1, Math.max(this.y + deltaY, 0));
233
+ this._previousColor = this._color.clone();
234
+ this._color = new TinyColor({ h: this.hue, s: this.x, v: 1 - this.y });
235
+ if (deltaX != 0 || deltaY != 0) {
236
+ this.dispatchEvent(new Event("input", {
237
+ bubbles: true,
238
+ composed: true
239
+ }));
240
+ const applyDefault = this.dispatchEvent(new Event("change", {
241
+ bubbles: true,
242
+ composed: true,
243
+ cancelable: true
244
+ }));
245
+ if (!applyDefault) {
246
+ this._color = this._previousColor;
247
+ }
248
+ }
249
+ }
250
+ handleKeyup(event) {
251
+ event.preventDefault();
252
+ const { code } = event;
253
+ this.activeKeys.delete(code);
254
+ }
255
+ handleInput(event) {
256
+ const { valueAsNumber, name } = event.target;
257
+ this[name] = valueAsNumber;
258
+ this._color = new TinyColor({ h: this.hue, s: this.x, v: 1 - this.y });
259
+ }
260
+ handleChange(event) {
261
+ this.handleInput(event);
262
+ this.dispatchEvent(new Event("change", {
263
+ bubbles: true,
264
+ composed: true,
265
+ cancelable: true
266
+ }));
267
+ }
268
+ handlePointerdown(event) {
269
+ if (event.button !== 0) {
270
+ event.preventDefault();
271
+ return;
272
+ }
273
+ this._pointerDown = true;
274
+ this._previousColor = this._color.clone();
275
+ this.boundingClientRect = this.getBoundingClientRect();
276
+ event.target.setPointerCapture(event.pointerId);
277
+ if (event.pointerType === "mouse") {
278
+ this.focused = true;
279
+ }
280
+ }
281
+ handlePointermove(event) {
282
+ const [x, y] = this.calculateHandlePosition(event);
283
+ this._color = new TinyColor({ h: this.hue, s: x, v: 1 - y });
284
+ this.x = x;
285
+ this.y = y;
286
+ this.dispatchEvent(new Event("input", {
287
+ bubbles: true,
288
+ composed: true,
289
+ cancelable: true
290
+ }));
291
+ }
292
+ handlePointerup(event) {
293
+ event.preventDefault();
294
+ this._pointerDown = false;
295
+ event.target.releasePointerCapture(event.pointerId);
296
+ const applyDefault = this.dispatchEvent(new Event("change", {
297
+ bubbles: true,
298
+ composed: true,
299
+ cancelable: true
300
+ }));
301
+ this.inputX.focus();
302
+ if (event.pointerType === "mouse") {
303
+ this.focused = false;
304
+ }
305
+ if (!applyDefault) {
306
+ this._color = this._previousColor;
307
+ }
308
+ }
309
+ calculateHandlePosition(event) {
310
+ if (!this.boundingClientRect) {
311
+ return [this.x, this.y];
312
+ }
313
+ const rect = this.boundingClientRect;
314
+ const minOffsetX = rect.left;
315
+ const minOffsetY = rect.top;
316
+ const offsetX = event.clientX;
317
+ const offsetY = event.clientY;
318
+ const width = rect.width;
319
+ const height = rect.height;
320
+ const percentX = Math.max(0, Math.min(1, (offsetX - minOffsetX) / width));
321
+ const percentY = Math.max(0, Math.min(1, (offsetY - minOffsetY) / height));
322
+ return [percentX, percentY];
323
+ }
324
+ handleAreaPointerdown(event) {
325
+ if (event.button !== 0) {
326
+ return;
327
+ }
328
+ event.stopPropagation();
329
+ event.preventDefault();
330
+ this.handle.dispatchEvent(new PointerEvent("pointerdown", event));
331
+ this.handlePointermove(event);
332
+ }
333
+ render() {
334
+ var _a, _b;
335
+ const { width = 0, height = 0 } = this.boundingClientRect || {};
336
+ return html`
337
+ <div
338
+ @pointerdown=${this.handleAreaPointerdown}
339
+ class="gradient"
340
+ style="background:
341
+ linear-gradient(to top, black 0%, hsla(${this.hue}, 100%, 0.01%, 0) 100%),
342
+ linear-gradient(to right, white 0%, hsla(${this.hue}, 100%, 0.01%, 0) 100%), hsl(${this.hue}, 100%, 50%);"
343
+ >
344
+ <slot name="gradient"></slot>
345
+ </div>
346
+
347
+ <sp-color-handle
348
+ tabindex=${ifDefined(this.focused ? void 0 : "0")}
349
+ @focus=${this.forwardFocus}
350
+ ?focused=${this.focused}
351
+ class="handle"
352
+ color=${this._color.toHslString()}
353
+ ?disabled=${this.disabled}
354
+ style="transform: translate(${this.x * width}px, ${this.y * height}px);"
355
+ ${streamingListener({
356
+ start: ["pointerdown", this.handlePointerdown],
357
+ streamInside: ["pointermove", this.handlePointermove],
358
+ end: [["pointerup", "pointercancel"], this.handlePointerup]
359
+ })}
360
+ ></sp-color-handle>
361
+
362
+ <div>
363
+ <input
364
+ type="range"
365
+ class="slider"
366
+ name="x"
367
+ aria-label=${(_a = this.label) != null ? _a : this.labelX}
368
+ min="0"
369
+ max="1"
370
+ step=${this.step}
371
+ tabindex="-1"
372
+ .value=${String(this.x)}
373
+ @input=${this.handleInput}
374
+ @change=${this.handleChange}
375
+ />
376
+ </div>
377
+ <div>
378
+ <input
379
+ type="range"
380
+ class="slider"
381
+ name="y"
382
+ aria-label=${(_b = this.label) != null ? _b : this.labelY}
383
+ min="0"
384
+ max="1"
385
+ step=${this.step}
386
+ tabindex="-1"
387
+ .value=${String(this.y)}
388
+ @input=${this.handleInput}
389
+ @change=${this.handleChange}
390
+ />
391
+ </div>
392
+ `;
393
+ }
394
+ firstUpdated(changed) {
395
+ super.firstUpdated(changed);
396
+ this.boundingClientRect = this.getBoundingClientRect();
397
+ this.addEventListener("focusin", this.handleFocusin);
398
+ this.addEventListener("focusout", this.handleFocusout);
399
+ this.addEventListener("keyup", this.handleKeyup);
400
+ this.addEventListener("keydown", this.handleKeydown);
401
+ }
402
+ updated(changed) {
403
+ super.updated(changed);
404
+ if (this.x !== this.inputX.valueAsNumber) {
405
+ this._x = this.inputX.valueAsNumber;
406
+ }
407
+ if (this.y !== this.inputY.valueAsNumber) {
408
+ this._y = this.inputY.valueAsNumber;
409
+ }
410
+ if (changed.has("focused") && this.focused) {
411
+ const parentX = this.inputX.parentElement;
412
+ const parentY = this.inputY.parentElement;
413
+ if (!parentX.shadowRoot && !parentY.shadowRoot) {
414
+ parentX.attachShadow({ mode: "open" });
415
+ parentY.attachShadow({ mode: "open" });
416
+ const slot = '<div tabindex="-1"><slot></slot></div>';
417
+ parentX.shadowRoot.innerHTML = slot;
418
+ parentY.shadowRoot.innerHTML = slot;
419
+ }
420
+ }
421
+ }
422
+ connectedCallback() {
423
+ var _a;
424
+ super.connectedCallback();
425
+ if (!this.observer && window.ResizeObserver) {
426
+ this.observer = new window.ResizeObserver((entries) => {
427
+ for (const entry of entries) {
428
+ this.boundingClientRect = entry.contentRect;
429
+ }
430
+ this.requestUpdate();
431
+ });
432
+ }
433
+ (_a = this.observer) == null ? void 0 : _a.observe(this);
434
+ }
435
+ disconnectedCallback() {
436
+ var _a;
437
+ (_a = this.observer) == null ? void 0 : _a.unobserve(this);
438
+ super.disconnectedCallback();
439
+ }
440
+ }
441
+ __decorateClass([
442
+ property({ type: Boolean, reflect: true })
443
+ ], ColorArea.prototype, "disabled", 2);
444
+ __decorateClass([
445
+ property({ type: Boolean, reflect: true })
446
+ ], ColorArea.prototype, "focused", 2);
447
+ __decorateClass([
448
+ property({ type: String })
449
+ ], ColorArea.prototype, "label", 2);
450
+ __decorateClass([
451
+ property({ type: String, attribute: "label-x" })
452
+ ], ColorArea.prototype, "labelX", 2);
453
+ __decorateClass([
454
+ property({ type: String, attribute: "label-y" })
455
+ ], ColorArea.prototype, "labelY", 2);
456
+ __decorateClass([
457
+ query(".handle")
458
+ ], ColorArea.prototype, "handle", 2);
459
+ __decorateClass([
460
+ property({ type: Number })
461
+ ], ColorArea.prototype, "hue", 1);
462
+ __decorateClass([
463
+ property({ type: String })
464
+ ], ColorArea.prototype, "value", 1);
465
+ __decorateClass([
466
+ property({ type: String })
467
+ ], ColorArea.prototype, "color", 1);
468
+ __decorateClass([
469
+ property({ attribute: false })
470
+ ], ColorArea.prototype, "activeAxis", 2);
471
+ __decorateClass([
472
+ property({ type: Number })
473
+ ], ColorArea.prototype, "x", 1);
474
+ __decorateClass([
475
+ property({ type: Number })
476
+ ], ColorArea.prototype, "y", 1);
477
+ __decorateClass([
478
+ property({ type: Number })
479
+ ], ColorArea.prototype, "step", 2);
480
+ __decorateClass([
481
+ query('[name="x"]')
482
+ ], ColorArea.prototype, "inputX", 2);
483
+ __decorateClass([
484
+ query('[name="y"]')
485
+ ], ColorArea.prototype, "inputY", 2);
486
+ //# sourceMappingURL=ColorArea.dev.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 { 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 {\n ColorHandle,\n ColorValue,\n extractHueAndSaturationRegExp,\n replaceHueRegExp,\n} from '@spectrum-web-components/color-handle';\nimport '@spectrum-web-components/color-handle/sp-color-handle.js';\nimport { TinyColor } from '@ctrl/tinycolor';\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: Boolean, reflect: true })\n public disabled = false;\n\n @property({ type: Boolean, reflect: true })\n public focused = false;\n\n @property({ type: String })\n public label: string | undefined;\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 @property({ type: Number })\n public get hue(): number {\n return this._hue;\n }\n\n public set hue(value: number) {\n const hue = Math.min(360, Math.max(0, value));\n if (hue === this.hue) {\n return;\n }\n const oldValue = this.hue;\n const { s, v } = this._color.toHsv();\n this._color = new TinyColor({ h: hue, s, v });\n this._hue = hue;\n this.requestUpdate('hue', oldValue);\n }\n\n private _hue = 0;\n\n @property({ type: String })\n public get value(): ColorValue {\n return this.color;\n }\n\n @property({ type: String })\n public get color(): ColorValue {\n switch (this._format.format) {\n case 'rgb':\n return this._format.isString\n ? this._color.toRgbString()\n : this._color.toRgb();\n case 'prgb':\n return this._format.isString\n ? this._color.toPercentageRgbString()\n : this._color.toPercentageRgb();\n case 'hex8':\n return this._format.isString\n ? this._color.toHex8String()\n : this._color.toHex8();\n case 'name':\n return this._color.toName() || this._color.toRgbString();\n case 'hsl':\n if (this._format.isString) {\n const hslString = this._color.toHslString();\n return hslString.replace(replaceHueRegExp, `$1${this.hue}`);\n } else {\n const { s, l, a } = this._color.toHsl();\n return { h: this.hue, s, l, a };\n }\n case 'hsv':\n if (this._format.isString) {\n const hsvString = this._color.toHsvString();\n return hsvString.replace(replaceHueRegExp, `$1${this.hue}`);\n } else {\n const { s, v, a } = this._color.toHsv();\n return { h: this.hue, s, v, a };\n }\n case 'hex':\n case 'hex3':\n case 'hex4':\n case 'hex6':\n default:\n return this._format.isString\n ? this._color.toHexString()\n : this._color.toHex();\n }\n }\n\n public set color(color: ColorValue) {\n if (color === this.color) {\n return;\n }\n const oldValue = this._color;\n this._color = new TinyColor(color);\n const format = this._color.format;\n let isString = typeof color === 'string' || color instanceof String;\n\n if (format.startsWith('hex')) {\n isString = (color as string).startsWith('#');\n }\n\n this._format = {\n format,\n isString,\n };\n\n const { h, s, v } = this._color.toHsv();\n let originalHue: number | undefined = undefined;\n\n if (isString && format.startsWith('hs')) {\n const values = extractHueAndSaturationRegExp.exec(color as string);\n\n if (values !== null) {\n const [, h] = values;\n originalHue = Number(h);\n }\n } else if (!isString && format.startsWith('hs')) {\n const colorInput = this._color.originalInput;\n const colorValues = Object.values(colorInput);\n originalHue = colorValues[0];\n }\n\n this.hue = originalHue || h;\n this.x = s;\n this.y = 1 - v;\n this.requestUpdate('color', oldValue);\n }\n\n private _color = new TinyColor({ h: 0, s: 1, v: 1 });\n\n private _previousColor = new TinyColor({ h: 0, s: 1, v: 1 });\n\n private _format: { format: string; isString: boolean } = {\n format: '',\n isString: false,\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 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 } else {\n this._x = x;\n }\n this.requestUpdate('x', oldValue);\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 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 } else {\n this._y = y;\n }\n this.requestUpdate('y', oldValue);\n }\n\n private _y = 0;\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 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 handleFocusin(): void {\n this.focused = true;\n }\n\n private handleFocusout(): void {\n if (this._pointerDown) {\n return;\n }\n this.focused = 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 = code.search('Arrow') === 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 * -1;\n break;\n case 'ArrowDown':\n deltaY = step * 1;\n break;\n case 'ArrowLeft':\n deltaX = step * -1;\n break;\n case 'ArrowRight':\n deltaX = step * 1;\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._previousColor = this._color.clone();\n this._color = new TinyColor({ h: this.hue, s: this.x, v: 1 - this.y });\n\n if (deltaX != 0 || deltaY != 0) {\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._color = this._previousColor;\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._color = new TinyColor({ h: this.hue, s: this.x, v: 1 - this.y });\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 private _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._previousColor = this._color.clone();\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 this._color = new TinyColor({ h: this.hue, s: x, v: 1 - y });\n\n this.x = x;\n this.y = y;\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._color = this._previousColor;\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 [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 return html`\n <div\n @pointerdown=${this.handleAreaPointerdown}\n class=\"gradient\"\n style=\"background:\n linear-gradient(to top, black 0%, hsla(${this\n .hue}, 100%, 0.01%, 0) 100%),\n linear-gradient(to right, white 0%, hsla(${this\n .hue}, 100%, 0.01%, 0) 100%), hsl(${this.hue}, 100%, 50%);\"\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._color.toHslString()}\n ?disabled=${this.disabled}\n style=\"transform: translate(${this.x * width}px, ${this.y *\n height}px);\"\n ${streamingListener({\n start: ['pointerdown', this.handlePointerdown],\n streamInside: ['pointermove', this.handlePointermove],\n end: [['pointerup', 'pointercancel'], this.handlePointerup],\n })}\n ></sp-color-handle>\n\n <div>\n <input\n type=\"range\"\n class=\"slider\"\n name=\"x\"\n aria-label=${this.label ?? this.labelX}\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>\n <input\n type=\"range\"\n class=\"slider\"\n name=\"y\"\n aria-label=${this.label ?? this.labelY}\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 `;\n }\n\n protected override firstUpdated(changed: PropertyValues): void {\n super.firstUpdated(changed);\n this.boundingClientRect = this.getBoundingClientRect();\n\n this.addEventListener('focusin', this.handleFocusin);\n this.addEventListener('focusout', this.handleFocusout);\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;A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