@spectrum-web-components/color-wheel 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.
- package/README.md +1 -1
- package/custom-elements.json +3 -3
- package/package.json +6 -7
- package/src/ColorWheel.d.ts +3 -3
- package/src/ColorWheel.dev.js +3 -16
- package/src/ColorWheel.dev.js.map +2 -2
- package/src/ColorWheel.js +1 -1
- package/src/ColorWheel.js.map +3 -3
- package/test/color-wheel.test.js +46 -43
- package/test/color-wheel.test.js.map +2 -2
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ The current color formats supported are as follows:
|
|
|
37
37
|
- Strings (eg "red", "blue")
|
|
38
38
|
|
|
39
39
|
**Please note for the following formats: HSV, HSVA, HSL, HSLA**
|
|
40
|
-
When using the HSL or HSV formats, and a color's value (in HSV) is set to 0, or its luminosity (in HSL) is set to 0 or 1, the hue and saturation values may not be preserved by the element's `color` property. This is detailed in the [
|
|
40
|
+
When using the HSL or HSV formats, and a color's value (in HSV) is set to 0, or its luminosity (in HSL) is set to 0 or 1, the hue and saturation values may not be preserved by the element's `color` property. This is detailed in the [colorjs documentation](https://colorjs.io/docs/). Seperately, the element's `value` property is directly managed by the hue as represented in the interface.
|
|
41
41
|
|
|
42
42
|
## Example
|
|
43
43
|
|
package/custom-elements.json
CHANGED
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"kind": "field",
|
|
103
103
|
"name": "colorController",
|
|
104
104
|
"privacy": "private",
|
|
105
|
-
"default": "new ColorController(this, {
|
|
105
|
+
"default": "new ColorController(this, { manageAs: 'hsv' })"
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
"kind": "field",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"kind": "field",
|
|
118
118
|
"name": "color",
|
|
119
119
|
"type": {
|
|
120
|
-
"text": "
|
|
120
|
+
"text": "ColorTypes"
|
|
121
121
|
},
|
|
122
122
|
"privacy": "public",
|
|
123
123
|
"attribute": "color"
|
|
@@ -455,7 +455,7 @@
|
|
|
455
455
|
{
|
|
456
456
|
"name": "color",
|
|
457
457
|
"type": {
|
|
458
|
-
"text": "
|
|
458
|
+
"text": "ColorTypes"
|
|
459
459
|
},
|
|
460
460
|
"fieldName": "color"
|
|
461
461
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/color-wheel",
|
|
3
|
-
"version": "1.2.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -62,11 +62,10 @@
|
|
|
62
62
|
"lit-html"
|
|
63
63
|
],
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@
|
|
66
|
-
"@spectrum-web-components/
|
|
67
|
-
"@spectrum-web-components/
|
|
68
|
-
"@spectrum-web-components/
|
|
69
|
-
"@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/reactive-controllers": "^1.2.0",
|
|
68
|
+
"@spectrum-web-components/shared": "^1.2.0"
|
|
70
69
|
},
|
|
71
70
|
"devDependencies": {
|
|
72
71
|
"@spectrum-css/colorwheel": "5.0.0-s2-foundations.15"
|
|
@@ -77,5 +76,5 @@
|
|
|
77
76
|
"./sp-*.js",
|
|
78
77
|
"./**/*.dev.js"
|
|
79
78
|
],
|
|
80
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "e4aec7b389e6209984e4df74f9b86b3ee0c485dd"
|
|
81
80
|
}
|
package/src/ColorWheel.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSResultArray, PropertyValues, TemplateResult } from '@spectrum-web-components/base';
|
|
2
2
|
import { Focusable } from '@spectrum-web-components/shared/src/focusable.js';
|
|
3
3
|
import '@spectrum-web-components/color-handle/sp-color-handle.js';
|
|
4
|
-
import {
|
|
4
|
+
import { ColorTypes } from '@spectrum-web-components/reactive-controllers/src/ColorController.js';
|
|
5
5
|
/**
|
|
6
6
|
* @element sp-color-wheel
|
|
7
7
|
* @slot gradient - a custom gradient visually outlining the available color values
|
|
@@ -20,8 +20,8 @@ export declare class ColorWheel extends Focusable {
|
|
|
20
20
|
private colorController;
|
|
21
21
|
get value(): number;
|
|
22
22
|
set value(hue: number);
|
|
23
|
-
get color():
|
|
24
|
-
set color(color:
|
|
23
|
+
get color(): ColorTypes;
|
|
24
|
+
set color(color: ColorTypes);
|
|
25
25
|
private get altered();
|
|
26
26
|
private set altered(value);
|
|
27
27
|
private _altered;
|
package/src/ColorWheel.dev.js
CHANGED
|
@@ -22,7 +22,7 @@ import { Focusable } from "@spectrum-web-components/shared/src/focusable.js";
|
|
|
22
22
|
import "@spectrum-web-components/color-handle/sp-color-handle.js";
|
|
23
23
|
import {
|
|
24
24
|
ColorController
|
|
25
|
-
} from "@spectrum-web-components/reactive-controllers/src/
|
|
25
|
+
} from "@spectrum-web-components/reactive-controllers/src/ColorController.js";
|
|
26
26
|
import { LanguageResolutionController } from "@spectrum-web-components/reactive-controllers/src/LanguageResolution.js";
|
|
27
27
|
import styles from "./color-wheel.css.js";
|
|
28
28
|
export class ColorWheel extends Focusable {
|
|
@@ -33,17 +33,7 @@ export class ColorWheel extends Focusable {
|
|
|
33
33
|
this.label = "hue";
|
|
34
34
|
this.step = 1;
|
|
35
35
|
this.languageResolver = new LanguageResolutionController(this);
|
|
36
|
-
this.colorController = new ColorController(this, {
|
|
37
|
-
/* c8 ignore next 3 */
|
|
38
|
-
applyColorToState: () => {
|
|
39
|
-
return;
|
|
40
|
-
},
|
|
41
|
-
extractColorFromState: (controller) => ({
|
|
42
|
-
...controller.getColor("hsl"),
|
|
43
|
-
h: this.value
|
|
44
|
-
}),
|
|
45
|
-
maintains: "saturation"
|
|
46
|
-
});
|
|
36
|
+
this.colorController = new ColorController(this, { manageAs: "hsv" });
|
|
47
37
|
this._altered = 0;
|
|
48
38
|
this._pointerDown = false;
|
|
49
39
|
}
|
|
@@ -57,7 +47,7 @@ export class ColorWheel extends Focusable {
|
|
|
57
47
|
this.colorController.hue = hue;
|
|
58
48
|
}
|
|
59
49
|
get color() {
|
|
60
|
-
return this.colorController.
|
|
50
|
+
return this.colorController.colorValue;
|
|
61
51
|
}
|
|
62
52
|
set color(color) {
|
|
63
53
|
this.colorController.color = color;
|
|
@@ -98,7 +88,6 @@ export class ColorWheel extends Focusable {
|
|
|
98
88
|
event.preventDefault();
|
|
99
89
|
this.value = (360 + this.value + delta) % 360;
|
|
100
90
|
this.colorController.savePreviousColor();
|
|
101
|
-
this.colorController.applyColorFromState();
|
|
102
91
|
this.dispatchEvent(
|
|
103
92
|
new Event("input", {
|
|
104
93
|
bubbles: true,
|
|
@@ -119,7 +108,6 @@ export class ColorWheel extends Focusable {
|
|
|
119
108
|
handleInput(event) {
|
|
120
109
|
const { valueAsNumber } = event.target;
|
|
121
110
|
this.value = valueAsNumber;
|
|
122
|
-
this.colorController.applyColorFromState();
|
|
123
111
|
}
|
|
124
112
|
handleChange(event) {
|
|
125
113
|
this.handleInput(event);
|
|
@@ -163,7 +151,6 @@ export class ColorWheel extends Focusable {
|
|
|
163
151
|
}
|
|
164
152
|
handlePointermove(event) {
|
|
165
153
|
this.value = this.calculateHandlePosition(event);
|
|
166
|
-
this.colorController.applyColorFromState();
|
|
167
154
|
this.dispatchEvent(
|
|
168
155
|
new Event("input", {
|
|
169
156
|
bubbles: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["ColorWheel.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 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 { Focusable } from '@spectrum-web-components/shared/src/focusable.js';\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 HSL,\n} from '@spectrum-web-components/reactive-controllers/src/Color.js';\nimport { LanguageResolutionController } from '@spectrum-web-components/reactive-controllers/src/LanguageResolution.js';\n\nimport styles from './color-wheel.css.js';\n\n/**\n * @element sp-color-wheel\n * @slot gradient - a custom gradient visually outlining the available color values\n * @fires input - The value of the Color Wheel has changed.\n * @fires change - An alteration to the value of the Color Wheel has been committed by the user.\n */\nexport class ColorWheel extends Focusable {\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 override disabled = false;\n\n @property({ type: Boolean, reflect: true })\n public focused = false;\n\n @query('.handle')\n private handle!: ColorHandle;\n\n @property({ type: String })\n public label = 'hue';\n\n @property({ type: Number })\n public step = 1;\n\n private languageResolver = new LanguageResolutionController(this);\n\n private colorController = new ColorController(this, {\n /* c8 ignore next 3 */\n applyColorToState: () => {\n return;\n },\n extractColorFromState: (controller) => ({\n ...(controller.getColor('hsl') as HSL),\n h: this.value,\n }),\n maintains: 'saturation',\n });\n\n @property({ type: Number })\n public get value(): number {\n return this.colorController.hue;\n }\n\n public set value(hue: number) {\n this.colorController.hue = hue;\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 private get altered(): number {\n return this._altered;\n }\n\n private set altered(altered: number) {\n this._altered = altered;\n this.step = Math.max(1, this.altered * 10);\n }\n\n private _altered = 0;\n\n @query('input')\n public input!: HTMLInputElement;\n\n public override get focusElement(): HTMLInputElement {\n return this.input;\n }\n\n private handleKeydown(event: KeyboardEvent): void {\n const { key } = event;\n this.focused = true;\n this.altered = [event.shiftKey, event.ctrlKey, event.altKey].filter(\n (key) => !!key\n ).length;\n let delta = 0;\n switch (key) {\n case 'ArrowUp':\n delta = this.step;\n break;\n case 'ArrowDown':\n delta = -this.step;\n break;\n case 'ArrowLeft':\n delta = this.step * (this.isLTR ? -1 : 1);\n break;\n case 'ArrowRight':\n delta = this.step * (this.isLTR ? 1 : -1);\n break;\n default:\n return;\n }\n event.preventDefault();\n this.value = (360 + this.value + delta) % 360;\n this.colorController.savePreviousColor();\n this.colorController.applyColorFromState();\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 private handleInput(event: Event & { target: HTMLInputElement }): void {\n const { valueAsNumber } = event.target;\n\n this.value = 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 })\n );\n }\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 this.input.focus();\n }\n\n private handleFocus(): void {\n this.focused = true;\n }\n\n private handleBlur(): void {\n if (this._pointerDown) {\n return;\n }\n this.altered = 0;\n this.focused = false;\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.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 this.value = this.calculateHandlePosition(event);\n this.colorController.applyColorFromState();\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 this._pointerDown = false;\n (event.target as HTMLElement).releasePointerCapture(event.pointerId);\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 // Retain focus on input element after mouse up to enable keyboard interactions\n this.focus();\n if (event.pointerType === 'mouse') {\n this.focused = false;\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 {\n /* c8 ignore next 3 */\n if (!this.boundingClientRect) {\n return this.value;\n }\n const rect = this.boundingClientRect;\n const { width, height, left, top } = rect;\n const centerX = left + width / 2;\n const centerY = top + height / 2;\n const pointX = event.clientX - centerX;\n const pointY = event.clientY - centerY;\n const value = (Math.atan2(pointY, pointX) * 180) / Math.PI;\n\n return (360 + (360 + (this.isLTR ? value : 180 - value))) % 360;\n }\n\n private handleGradientPointerdown(event: PointerEvent): void {\n if (\n event.button !== 0 ||\n (event.target as SVGElement).classList.contains('innerCircle')\n ) {\n return;\n }\n event.stopPropagation();\n event.preventDefault();\n const { button, pointerId, pointerType } = event;\n this.handle.dispatchEvent(\n new PointerEvent('pointerdown', {\n button,\n pointerId,\n pointerType,\n })\n );\n this.handlePointermove(event);\n }\n\n calculateStyleData(): {\n clipPath: string;\n clipPathBorders: string;\n diameter: number;\n handleLocationStyles: string;\n } {\n // Extract values from element.\n const { width: diameter = 160 } = this.boundingClientRect || {};\n const styles = getComputedStyle(this);\n const borderWidth = parseFloat(\n styles.getPropertyValue('--_border-width')\n );\n const trackWidth = parseFloat(\n styles.getPropertyValue('--_track-width')\n );\n\n // Calculate wheel data.\n const radius = diameter / 2;\n const diameterAfterBoarder = diameter - borderWidth * 2;\n const radiusAfterBoarder = radius - borderWidth;\n const innerRadius = radius - trackWidth;\n const innerDiameter = innerRadius * 2;\n const innerRadiusAfterBorder = innerRadius + borderWidth;\n const innerDiameterAfterBorder = innerDiameter + borderWidth * 2;\n const clipPathBorders = `\"M ${radius} ${radius} m -${radius} 0 a ${radius} ${radius} 0 1 0 ${diameter} 0 a ${radius} ${radius} 0 1 0 -${diameter} 0 M ${radius} ${radius} m -${innerRadius} 0 a ${innerRadius} ${innerRadius} 0 1 0 ${innerDiameter} 0 a ${innerRadius} ${innerRadius} 0 1 0 -${innerDiameter} 0\"`;\n const clipPath = `\"M ${radiusAfterBoarder} ${radiusAfterBoarder} m -${radiusAfterBoarder} 0 a ${radiusAfterBoarder} ${radiusAfterBoarder} 0 1 0 ${diameterAfterBoarder} 0 a ${radiusAfterBoarder} ${radiusAfterBoarder} 0 1 0 -${diameterAfterBoarder} 0 M ${radiusAfterBoarder} ${radiusAfterBoarder} m -${innerRadiusAfterBorder} 0 a ${innerRadiusAfterBorder} ${innerRadiusAfterBorder} 0 1 0 ${innerDiameterAfterBorder} 0 a ${innerRadiusAfterBorder} ${innerRadiusAfterBorder} 0 1 0 -${innerDiameterAfterBorder} 0\"`;\n\n // Calculate handle position on the wheel.\n const translateX =\n (this.isLTR ? 1 : -1) *\n (radius - trackWidth / 2) *\n Math.cos((this.value * Math.PI) / 180);\n const translateY =\n (radius - trackWidth / 2) * Math.sin((this.value * Math.PI) / 180);\n const handleLocationStyles = `transform: translate(${translateX}px, ${translateY}px);`;\n\n return {\n clipPath,\n clipPathBorders,\n diameter,\n handleLocationStyles,\n };\n }\n\n protected override render(): TemplateResult {\n const { clipPath, clipPathBorders, diameter, handleLocationStyles } =\n this.calculateStyleData();\n\n return html`\n <slot\n name=\"gradient\"\n @pointerdown=${this.handleGradientPointerdown}\n style=\"\n --spectrum-colorwheel-colorarea-container-size: ${diameter}px;\n --spectrum-colorwheel-height: ${diameter}px;\n --spectrum-colorwheel-width: ${diameter}px;\n --spectrum-colorwheel-path-borders: ${clipPathBorders};\n --spectrum-colorwheel-path: ${clipPath};\n \"\n >\n <div class=\"inner\">\n <div class=\"colorarea-container\"></div>\n </div>\n <div class=\"border\">\n <div class=\"wheel\"></div>\n </div>\n </slot>\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=\"hsl(${this.value}, 100%, 50%)\"\n ?disabled=${this.disabled}\n style=${handleLocationStyles}\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 <input\n type=\"range\"\n class=\"slider\"\n aria-label=${this.label}\n min=\"0\"\n max=\"360\"\n step=${this.step}\n .value=${String(this.value)}\n aria-valuetext=${`${new Intl.NumberFormat(\n this.languageResolver.language,\n {\n maximumFractionDigits: 0,\n minimumIntegerDigits: 1,\n style: 'unit',\n unit: 'degree',\n unitDisplay: 'narrow',\n }\n ).format(this.value)}`}\n @input=${this.handleInput}\n @change=${this.handleChange}\n @keydown=${this.handleKeydown}\n />\n `;\n }\n\n protected override firstUpdated(changed: PropertyValues): void {\n super.firstUpdated(changed);\n this.boundingClientRect = this.getBoundingClientRect();\n this.addEventListener('focus', this.handleFocus);\n this.addEventListener('blur', this.handleBlur);\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,OAGG;AACP,SAAS,iBAAiB;AAC1B;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,SAAS,yBAAyB;AAElC,SAAS,iBAAiB;AAE1B,OAAO;AACP;AAAA,EACI;AAAA,
|
|
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 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 { Focusable } from '@spectrum-web-components/shared/src/focusable.js';\nimport type { ColorHandle } from '@spectrum-web-components/color-handle';\nimport '@spectrum-web-components/color-handle/sp-color-handle.js';\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';\n\nimport styles from './color-wheel.css.js';\n\n/**\n * @element sp-color-wheel\n * @slot gradient - a custom gradient visually outlining the available color values\n * @fires input - The value of the Color Wheel has changed.\n * @fires change - An alteration to the value of the Color Wheel has been committed by the user.\n */\nexport class ColorWheel extends Focusable {\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 override disabled = false;\n\n @property({ type: Boolean, reflect: true })\n public focused = false;\n\n @query('.handle')\n private handle!: ColorHandle;\n\n @property({ type: String })\n public label = 'hue';\n\n @property({ type: Number })\n public step = 1;\n\n private languageResolver = new LanguageResolutionController(this);\n\n private colorController = new ColorController(this, { manageAs: 'hsv' });\n\n @property({ type: Number })\n public get value(): number {\n return this.colorController.hue;\n }\n\n public set value(hue: number) {\n this.colorController.hue = hue;\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 private get altered(): number {\n return this._altered;\n }\n\n private set altered(altered: number) {\n this._altered = altered;\n this.step = Math.max(1, this.altered * 10);\n }\n\n private _altered = 0;\n\n @query('input')\n public input!: HTMLInputElement;\n\n public override get focusElement(): HTMLInputElement {\n return this.input;\n }\n\n private handleKeydown(event: KeyboardEvent): void {\n const { key } = event;\n this.focused = true;\n this.altered = [event.shiftKey, event.ctrlKey, event.altKey].filter(\n (key) => !!key\n ).length;\n let delta = 0;\n switch (key) {\n case 'ArrowUp':\n delta = this.step;\n break;\n case 'ArrowDown':\n delta = -this.step;\n break;\n case 'ArrowLeft':\n delta = this.step * (this.isLTR ? -1 : 1);\n break;\n case 'ArrowRight':\n delta = this.step * (this.isLTR ? 1 : -1);\n break;\n default:\n return;\n }\n event.preventDefault();\n this.value = (360 + this.value + delta) % 360;\n this.colorController.savePreviousColor();\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 private handleInput(event: Event & { target: HTMLInputElement }): void {\n const { valueAsNumber } = event.target;\n\n this.value = 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 })\n );\n }\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 this.input.focus();\n }\n\n private handleFocus(): void {\n this.focused = true;\n }\n\n private handleBlur(): void {\n if (this._pointerDown) {\n return;\n }\n this.altered = 0;\n this.focused = false;\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.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 this.value = this.calculateHandlePosition(event);\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 this._pointerDown = false;\n (event.target as HTMLElement).releasePointerCapture(event.pointerId);\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 // Retain focus on input element after mouse up to enable keyboard interactions\n this.focus();\n if (event.pointerType === 'mouse') {\n this.focused = false;\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 {\n /* c8 ignore next 3 */\n if (!this.boundingClientRect) {\n return this.value;\n }\n const rect = this.boundingClientRect;\n const { width, height, left, top } = rect;\n const centerX = left + width / 2;\n const centerY = top + height / 2;\n const pointX = event.clientX - centerX;\n const pointY = event.clientY - centerY;\n const value = (Math.atan2(pointY, pointX) * 180) / Math.PI;\n\n return (360 + (360 + (this.isLTR ? value : 180 - value))) % 360;\n }\n\n private handleGradientPointerdown(event: PointerEvent): void {\n if (\n event.button !== 0 ||\n (event.target as SVGElement).classList.contains('innerCircle')\n ) {\n return;\n }\n event.stopPropagation();\n event.preventDefault();\n const { button, pointerId, pointerType } = event;\n this.handle.dispatchEvent(\n new PointerEvent('pointerdown', {\n button,\n pointerId,\n pointerType,\n })\n );\n this.handlePointermove(event);\n }\n\n calculateStyleData(): {\n clipPath: string;\n clipPathBorders: string;\n diameter: number;\n handleLocationStyles: string;\n } {\n // Extract values from element.\n const { width: diameter = 160 } = this.boundingClientRect || {};\n const styles = getComputedStyle(this);\n const borderWidth = parseFloat(\n styles.getPropertyValue('--_border-width')\n );\n const trackWidth = parseFloat(\n styles.getPropertyValue('--_track-width')\n );\n\n // Calculate wheel data.\n const radius = diameter / 2;\n const diameterAfterBoarder = diameter - borderWidth * 2;\n const radiusAfterBoarder = radius - borderWidth;\n const innerRadius = radius - trackWidth;\n const innerDiameter = innerRadius * 2;\n const innerRadiusAfterBorder = innerRadius + borderWidth;\n const innerDiameterAfterBorder = innerDiameter + borderWidth * 2;\n const clipPathBorders = `\"M ${radius} ${radius} m -${radius} 0 a ${radius} ${radius} 0 1 0 ${diameter} 0 a ${radius} ${radius} 0 1 0 -${diameter} 0 M ${radius} ${radius} m -${innerRadius} 0 a ${innerRadius} ${innerRadius} 0 1 0 ${innerDiameter} 0 a ${innerRadius} ${innerRadius} 0 1 0 -${innerDiameter} 0\"`;\n const clipPath = `\"M ${radiusAfterBoarder} ${radiusAfterBoarder} m -${radiusAfterBoarder} 0 a ${radiusAfterBoarder} ${radiusAfterBoarder} 0 1 0 ${diameterAfterBoarder} 0 a ${radiusAfterBoarder} ${radiusAfterBoarder} 0 1 0 -${diameterAfterBoarder} 0 M ${radiusAfterBoarder} ${radiusAfterBoarder} m -${innerRadiusAfterBorder} 0 a ${innerRadiusAfterBorder} ${innerRadiusAfterBorder} 0 1 0 ${innerDiameterAfterBorder} 0 a ${innerRadiusAfterBorder} ${innerRadiusAfterBorder} 0 1 0 -${innerDiameterAfterBorder} 0\"`;\n\n // Calculate handle position on the wheel.\n const translateX =\n (this.isLTR ? 1 : -1) *\n (radius - trackWidth / 2) *\n Math.cos((this.value * Math.PI) / 180);\n const translateY =\n (radius - trackWidth / 2) * Math.sin((this.value * Math.PI) / 180);\n const handleLocationStyles = `transform: translate(${translateX}px, ${translateY}px);`;\n\n return {\n clipPath,\n clipPathBorders,\n diameter,\n handleLocationStyles,\n };\n }\n\n protected override render(): TemplateResult {\n const { clipPath, clipPathBorders, diameter, handleLocationStyles } =\n this.calculateStyleData();\n\n return html`\n <slot\n name=\"gradient\"\n @pointerdown=${this.handleGradientPointerdown}\n style=\"\n --spectrum-colorwheel-colorarea-container-size: ${diameter}px;\n --spectrum-colorwheel-height: ${diameter}px;\n --spectrum-colorwheel-width: ${diameter}px;\n --spectrum-colorwheel-path-borders: ${clipPathBorders};\n --spectrum-colorwheel-path: ${clipPath};\n \"\n >\n <div class=\"inner\">\n <div class=\"colorarea-container\"></div>\n </div>\n <div class=\"border\">\n <div class=\"wheel\"></div>\n </div>\n </slot>\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=\"hsl(${this.value}, 100%, 50%)\"\n ?disabled=${this.disabled}\n style=${handleLocationStyles}\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 <input\n type=\"range\"\n class=\"slider\"\n aria-label=${this.label}\n min=\"0\"\n max=\"360\"\n step=${this.step}\n .value=${String(this.value)}\n aria-valuetext=${`${new Intl.NumberFormat(\n this.languageResolver.language,\n {\n maximumFractionDigits: 0,\n minimumIntegerDigits: 1,\n style: 'unit',\n unit: 'degree',\n unitDisplay: 'narrow',\n }\n ).format(this.value)}`}\n @input=${this.handleInput}\n @change=${this.handleChange}\n @keydown=${this.handleKeydown}\n />\n `;\n }\n\n protected override firstUpdated(changed: PropertyValues): void {\n super.firstUpdated(changed);\n this.boundingClientRect = this.getBoundingClientRect();\n this.addEventListener('focus', this.handleFocus);\n this.addEventListener('blur', this.handleBlur);\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,OAGG;AACP,SAAS,iBAAiB;AAC1B;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,SAAS,yBAAyB;AAElC,SAAS,iBAAiB;AAE1B,OAAO;AACP;AAAA,EACI;AAAA,OAEG;AACP,SAAS,oCAAoC;AAE7C,OAAO,YAAY;AAQZ,aAAM,mBAAmB,UAAU;AAAA,EAAnC;AAAA;AASH,SAAgB,WAAW;AAG3B,SAAO,UAAU;AAMjB,SAAO,QAAQ;AAGf,SAAO,OAAO;AAEd,SAAQ,mBAAmB,IAAI,6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;AASA;AAAA,EADV,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GApCjB,WAqCE;AAoBJ;AAAA,EADN,MAAM,OAAO;AAAA,GAxDL,WAyDF;",
|
|
6
6
|
"names": ["key", "styles"]
|
|
7
7
|
}
|
package/src/ColorWheel.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var y=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var n=(v,c,e,i)=>{for(var t=i>1?void 0:i?C(c,e):c,o=v.length-1,r;o>=0;o--)(r=v[o])&&(t=(i?r(c,e,t):r(t))||t);return i&&t&&y(c,e,t),t};import{html as P}from"@spectrum-web-components/base";import{ifDefined as R}from"@spectrum-web-components/base/src/directives.js";import{property as u,query as b}from"@spectrum-web-components/base/src/decorators.js";import{streamingListener as E}from"@spectrum-web-components/base/src/streaming-listener.js";import{Focusable as
|
|
1
|
+
"use strict";var y=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var n=(v,c,e,i)=>{for(var t=i>1?void 0:i?C(c,e):c,o=v.length-1,r;o>=0;o--)(r=v[o])&&(t=(i?r(c,e,t):r(t))||t);return i&&t&&y(c,e,t),t};import{html as P}from"@spectrum-web-components/base";import{ifDefined as R}from"@spectrum-web-components/base/src/directives.js";import{property as u,query as b}from"@spectrum-web-components/base/src/decorators.js";import{streamingListener as E}from"@spectrum-web-components/base/src/streaming-listener.js";import{Focusable as D}from"@spectrum-web-components/shared/src/focusable.js";import"@spectrum-web-components/color-handle/sp-color-handle.js";import{ColorController as S}from"@spectrum-web-components/reactive-controllers/src/ColorController.js";import{LanguageResolutionController as L}from"@spectrum-web-components/reactive-controllers/src/LanguageResolution.js";import T from"./color-wheel.css.js";export class ColorWheel extends D{constructor(){super(...arguments);this.disabled=!1;this.focused=!1;this.label="hue";this.step=1;this.languageResolver=new L(this);this.colorController=new S(this,{manageAs:"hsv"});this._altered=0;this._pointerDown=!1}static get styles(){return[T]}get value(){return this.colorController.hue}set value(e){this.colorController.hue=e}get color(){return this.colorController.colorValue}set color(e){this.colorController.color=e}get altered(){return this._altered}set altered(e){this._altered=e,this.step=Math.max(1,this.altered*10)}get focusElement(){return this.input}handleKeydown(e){const{key:i}=e;this.focused=!0,this.altered=[e.shiftKey,e.ctrlKey,e.altKey].filter(r=>!!r).length;let t=0;switch(i){case"ArrowUp":t=this.step;break;case"ArrowDown":t=-this.step;break;case"ArrowLeft":t=this.step*(this.isLTR?-1:1);break;case"ArrowRight":t=this.step*(this.isLTR?1:-1);break;default:return}e.preventDefault(),this.value=(360+this.value+t)%360,this.colorController.savePreviousColor(),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0,cancelable:!0}))||this.colorController.restorePreviousColor()}handleInput(e){const{valueAsNumber:i}=e.target;this.value=i}handleChange(e){this.handleInput(e),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}focus(e={}){super.focus(e),this.forwardFocus()}forwardFocus(){this.focused=this.hasVisibleFocusInTree(),this.input.focus()}handleFocus(){this.focused=!0}handleBlur(){this._pointerDown||(this.altered=0,this.focused=!1)}handlePointerdown(e){if(e.button!==0){e.preventDefault();return}this._pointerDown=!0,this.colorController.savePreviousColor(),this.boundingClientRect=this.getBoundingClientRect(),e.target.setPointerCapture(e.pointerId),e.pointerType==="mouse"&&(this.focused=!0)}handlePointermove(e){this.value=this.calculateHandlePosition(e),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0,cancelable:!0}))}handlePointerup(e){this._pointerDown=!1,e.target.releasePointerCapture(e.pointerId),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0,cancelable:!0}))||this.colorController.restorePreviousColor(),this.focus(),e.pointerType==="mouse"&&(this.focused=!1)}calculateHandlePosition(e){if(!this.boundingClientRect)return this.value;const i=this.boundingClientRect,{width:t,height:o,left:r,top:h}=i,s=r+t/2,a=h+o/2,d=e.clientX-s,l=e.clientY-a,p=Math.atan2(l,d)*180/Math.PI;return(360+(360+(this.isLTR?p:180-p)))%360}handleGradientPointerdown(e){if(e.button!==0||e.target.classList.contains("innerCircle"))return;e.stopPropagation(),e.preventDefault();const{button:i,pointerId:t,pointerType:o}=e;this.handle.dispatchEvent(new PointerEvent("pointerdown",{button:i,pointerId:t,pointerType:o})),this.handlePointermove(e)}calculateStyleData(){const{width:e=160}=this.boundingClientRect||{},i=getComputedStyle(this),t=parseFloat(i.getPropertyValue("--_border-width")),o=parseFloat(i.getPropertyValue("--_track-width")),r=e/2,h=e-t*2,s=r-t,a=r-o,d=a*2,l=a+t,p=d+t*2,m=`"M ${r} ${r} m -${r} 0 a ${r} ${r} 0 1 0 ${e} 0 a ${r} ${r} 0 1 0 -${e} 0 M ${r} ${r} m -${a} 0 a ${a} ${a} 0 1 0 ${d} 0 a ${a} ${a} 0 1 0 -${d} 0"`,f=`"M ${s} ${s} m -${s} 0 a ${s} ${s} 0 1 0 ${h} 0 a ${s} ${s} 0 1 0 -${h} 0 M ${s} ${s} m -${l} 0 a ${l} ${l} 0 1 0 ${p} 0 a ${l} ${l} 0 1 0 -${p} 0"`,g=(this.isLTR?1:-1)*(r-o/2)*Math.cos(this.value*Math.PI/180),$=(r-o/2)*Math.sin(this.value*Math.PI/180),w=`transform: translate(${g}px, ${$}px);`;return{clipPath:f,clipPathBorders:m,diameter:e,handleLocationStyles:w}}render(){const{clipPath:e,clipPathBorders:i,diameter:t,handleLocationStyles:o}=this.calculateStyleData();return P`
|
|
2
2
|
<slot
|
|
3
3
|
name="gradient"
|
|
4
4
|
@pointerdown=${this.handleGradientPointerdown}
|
package/src/ColorWheel.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["ColorWheel.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 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 { Focusable } from '@spectrum-web-components/shared/src/focusable.js';\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 HSL,\n} from '@spectrum-web-components/reactive-controllers/src/Color.js';\nimport { LanguageResolutionController } from '@spectrum-web-components/reactive-controllers/src/LanguageResolution.js';\n\nimport styles from './color-wheel.css.js';\n\n/**\n * @element sp-color-wheel\n * @slot gradient - a custom gradient visually outlining the available color values\n * @fires input - The value of the Color Wheel has changed.\n * @fires change - An alteration to the value of the Color Wheel has been committed by the user.\n */\nexport class ColorWheel extends Focusable {\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 override disabled = false;\n\n @property({ type: Boolean, reflect: true })\n public focused = false;\n\n @query('.handle')\n private handle!: ColorHandle;\n\n @property({ type: String })\n public label = 'hue';\n\n @property({ type: Number })\n public step = 1;\n\n private languageResolver = new LanguageResolutionController(this);\n\n private colorController = new ColorController(this, {\n /* c8 ignore next 3 */\n applyColorToState: () => {\n return;\n },\n extractColorFromState: (controller) => ({\n ...(controller.getColor('hsl') as HSL),\n h: this.value,\n }),\n maintains: 'saturation',\n });\n\n @property({ type: Number })\n public get value(): number {\n return this.colorController.hue;\n }\n\n public set value(hue: number) {\n this.colorController.hue = hue;\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 private get altered(): number {\n return this._altered;\n }\n\n private set altered(altered: number) {\n this._altered = altered;\n this.step = Math.max(1, this.altered * 10);\n }\n\n private _altered = 0;\n\n @query('input')\n public input!: HTMLInputElement;\n\n public override get focusElement(): HTMLInputElement {\n return this.input;\n }\n\n private handleKeydown(event: KeyboardEvent): void {\n const { key } = event;\n this.focused = true;\n this.altered = [event.shiftKey, event.ctrlKey, event.altKey].filter(\n (key) => !!key\n ).length;\n let delta = 0;\n switch (key) {\n case 'ArrowUp':\n delta = this.step;\n break;\n case 'ArrowDown':\n delta = -this.step;\n break;\n case 'ArrowLeft':\n delta = this.step * (this.isLTR ? -1 : 1);\n break;\n case 'ArrowRight':\n delta = this.step * (this.isLTR ? 1 : -1);\n break;\n default:\n return;\n }\n event.preventDefault();\n this.value = (360 + this.value + delta) % 360;\n this.colorController.savePreviousColor();\n this.colorController.applyColorFromState();\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 private handleInput(event: Event & { target: HTMLInputElement }): void {\n const { valueAsNumber } = event.target;\n\n this.value = 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 })\n );\n }\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 this.input.focus();\n }\n\n private handleFocus(): void {\n this.focused = true;\n }\n\n private handleBlur(): void {\n if (this._pointerDown) {\n return;\n }\n this.altered = 0;\n this.focused = false;\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.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 this.value = this.calculateHandlePosition(event);\n this.colorController.applyColorFromState();\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 this._pointerDown = false;\n (event.target as HTMLElement).releasePointerCapture(event.pointerId);\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 // Retain focus on input element after mouse up to enable keyboard interactions\n this.focus();\n if (event.pointerType === 'mouse') {\n this.focused = false;\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 {\n /* c8 ignore next 3 */\n if (!this.boundingClientRect) {\n return this.value;\n }\n const rect = this.boundingClientRect;\n const { width, height, left, top } = rect;\n const centerX = left + width / 2;\n const centerY = top + height / 2;\n const pointX = event.clientX - centerX;\n const pointY = event.clientY - centerY;\n const value = (Math.atan2(pointY, pointX) * 180) / Math.PI;\n\n return (360 + (360 + (this.isLTR ? value : 180 - value))) % 360;\n }\n\n private handleGradientPointerdown(event: PointerEvent): void {\n if (\n event.button !== 0 ||\n (event.target as SVGElement).classList.contains('innerCircle')\n ) {\n return;\n }\n event.stopPropagation();\n event.preventDefault();\n const { button, pointerId, pointerType } = event;\n this.handle.dispatchEvent(\n new PointerEvent('pointerdown', {\n button,\n pointerId,\n pointerType,\n })\n );\n this.handlePointermove(event);\n }\n\n calculateStyleData(): {\n clipPath: string;\n clipPathBorders: string;\n diameter: number;\n handleLocationStyles: string;\n } {\n // Extract values from element.\n const { width: diameter = 160 } = this.boundingClientRect || {};\n const styles = getComputedStyle(this);\n const borderWidth = parseFloat(\n styles.getPropertyValue('--_border-width')\n );\n const trackWidth = parseFloat(\n styles.getPropertyValue('--_track-width')\n );\n\n // Calculate wheel data.\n const radius = diameter / 2;\n const diameterAfterBoarder = diameter - borderWidth * 2;\n const radiusAfterBoarder = radius - borderWidth;\n const innerRadius = radius - trackWidth;\n const innerDiameter = innerRadius * 2;\n const innerRadiusAfterBorder = innerRadius + borderWidth;\n const innerDiameterAfterBorder = innerDiameter + borderWidth * 2;\n const clipPathBorders = `\"M ${radius} ${radius} m -${radius} 0 a ${radius} ${radius} 0 1 0 ${diameter} 0 a ${radius} ${radius} 0 1 0 -${diameter} 0 M ${radius} ${radius} m -${innerRadius} 0 a ${innerRadius} ${innerRadius} 0 1 0 ${innerDiameter} 0 a ${innerRadius} ${innerRadius} 0 1 0 -${innerDiameter} 0\"`;\n const clipPath = `\"M ${radiusAfterBoarder} ${radiusAfterBoarder} m -${radiusAfterBoarder} 0 a ${radiusAfterBoarder} ${radiusAfterBoarder} 0 1 0 ${diameterAfterBoarder} 0 a ${radiusAfterBoarder} ${radiusAfterBoarder} 0 1 0 -${diameterAfterBoarder} 0 M ${radiusAfterBoarder} ${radiusAfterBoarder} m -${innerRadiusAfterBorder} 0 a ${innerRadiusAfterBorder} ${innerRadiusAfterBorder} 0 1 0 ${innerDiameterAfterBorder} 0 a ${innerRadiusAfterBorder} ${innerRadiusAfterBorder} 0 1 0 -${innerDiameterAfterBorder} 0\"`;\n\n // Calculate handle position on the wheel.\n const translateX =\n (this.isLTR ? 1 : -1) *\n (radius - trackWidth / 2) *\n Math.cos((this.value * Math.PI) / 180);\n const translateY =\n (radius - trackWidth / 2) * Math.sin((this.value * Math.PI) / 180);\n const handleLocationStyles = `transform: translate(${translateX}px, ${translateY}px);`;\n\n return {\n clipPath,\n clipPathBorders,\n diameter,\n handleLocationStyles,\n };\n }\n\n protected override render(): TemplateResult {\n const { clipPath, clipPathBorders, diameter, handleLocationStyles } =\n this.calculateStyleData();\n\n return html`\n <slot\n name=\"gradient\"\n @pointerdown=${this.handleGradientPointerdown}\n style=\"\n --spectrum-colorwheel-colorarea-container-size: ${diameter}px;\n --spectrum-colorwheel-height: ${diameter}px;\n --spectrum-colorwheel-width: ${diameter}px;\n --spectrum-colorwheel-path-borders: ${clipPathBorders};\n --spectrum-colorwheel-path: ${clipPath};\n \"\n >\n <div class=\"inner\">\n <div class=\"colorarea-container\"></div>\n </div>\n <div class=\"border\">\n <div class=\"wheel\"></div>\n </div>\n </slot>\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=\"hsl(${this.value}, 100%, 50%)\"\n ?disabled=${this.disabled}\n style=${handleLocationStyles}\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 <input\n type=\"range\"\n class=\"slider\"\n aria-label=${this.label}\n min=\"0\"\n max=\"360\"\n step=${this.step}\n .value=${String(this.value)}\n aria-valuetext=${`${new Intl.NumberFormat(\n this.languageResolver.language,\n {\n maximumFractionDigits: 0,\n minimumIntegerDigits: 1,\n style: 'unit',\n unit: 'degree',\n unitDisplay: 'narrow',\n }\n ).format(this.value)}`}\n @input=${this.handleInput}\n @change=${this.handleChange}\n @keydown=${this.handleKeydown}\n />\n `;\n }\n\n protected override firstUpdated(changed: PropertyValues): void {\n super.firstUpdated(changed);\n this.boundingClientRect = this.getBoundingClientRect();\n this.addEventListener('focus', this.handleFocus);\n this.addEventListener('blur', this.handleBlur);\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": "qNAYA,OAEI,QAAAA,MAGG,gCACP,OAAS,aAAAC,MAAiB,kDAC1B,OACI,YAAAC,EACA,SAAAC,MACG,kDACP,OAAS,qBAAAC,MAAyB,0DAElC,OAAS,aAAAC,MAAiB,mDAE1B,MAAO,2DACP,OACI,mBAAAC,
|
|
6
|
-
"names": ["html", "ifDefined", "property", "query", "streamingListener", "Focusable", "ColorController", "LanguageResolutionController", "styles", "
|
|
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 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 { Focusable } from '@spectrum-web-components/shared/src/focusable.js';\nimport type { ColorHandle } from '@spectrum-web-components/color-handle';\nimport '@spectrum-web-components/color-handle/sp-color-handle.js';\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';\n\nimport styles from './color-wheel.css.js';\n\n/**\n * @element sp-color-wheel\n * @slot gradient - a custom gradient visually outlining the available color values\n * @fires input - The value of the Color Wheel has changed.\n * @fires change - An alteration to the value of the Color Wheel has been committed by the user.\n */\nexport class ColorWheel extends Focusable {\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 override disabled = false;\n\n @property({ type: Boolean, reflect: true })\n public focused = false;\n\n @query('.handle')\n private handle!: ColorHandle;\n\n @property({ type: String })\n public label = 'hue';\n\n @property({ type: Number })\n public step = 1;\n\n private languageResolver = new LanguageResolutionController(this);\n\n private colorController = new ColorController(this, { manageAs: 'hsv' });\n\n @property({ type: Number })\n public get value(): number {\n return this.colorController.hue;\n }\n\n public set value(hue: number) {\n this.colorController.hue = hue;\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 private get altered(): number {\n return this._altered;\n }\n\n private set altered(altered: number) {\n this._altered = altered;\n this.step = Math.max(1, this.altered * 10);\n }\n\n private _altered = 0;\n\n @query('input')\n public input!: HTMLInputElement;\n\n public override get focusElement(): HTMLInputElement {\n return this.input;\n }\n\n private handleKeydown(event: KeyboardEvent): void {\n const { key } = event;\n this.focused = true;\n this.altered = [event.shiftKey, event.ctrlKey, event.altKey].filter(\n (key) => !!key\n ).length;\n let delta = 0;\n switch (key) {\n case 'ArrowUp':\n delta = this.step;\n break;\n case 'ArrowDown':\n delta = -this.step;\n break;\n case 'ArrowLeft':\n delta = this.step * (this.isLTR ? -1 : 1);\n break;\n case 'ArrowRight':\n delta = this.step * (this.isLTR ? 1 : -1);\n break;\n default:\n return;\n }\n event.preventDefault();\n this.value = (360 + this.value + delta) % 360;\n this.colorController.savePreviousColor();\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 private handleInput(event: Event & { target: HTMLInputElement }): void {\n const { valueAsNumber } = event.target;\n\n this.value = 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 })\n );\n }\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 this.input.focus();\n }\n\n private handleFocus(): void {\n this.focused = true;\n }\n\n private handleBlur(): void {\n if (this._pointerDown) {\n return;\n }\n this.altered = 0;\n this.focused = false;\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.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 this.value = this.calculateHandlePosition(event);\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 this._pointerDown = false;\n (event.target as HTMLElement).releasePointerCapture(event.pointerId);\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 // Retain focus on input element after mouse up to enable keyboard interactions\n this.focus();\n if (event.pointerType === 'mouse') {\n this.focused = false;\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 {\n /* c8 ignore next 3 */\n if (!this.boundingClientRect) {\n return this.value;\n }\n const rect = this.boundingClientRect;\n const { width, height, left, top } = rect;\n const centerX = left + width / 2;\n const centerY = top + height / 2;\n const pointX = event.clientX - centerX;\n const pointY = event.clientY - centerY;\n const value = (Math.atan2(pointY, pointX) * 180) / Math.PI;\n\n return (360 + (360 + (this.isLTR ? value : 180 - value))) % 360;\n }\n\n private handleGradientPointerdown(event: PointerEvent): void {\n if (\n event.button !== 0 ||\n (event.target as SVGElement).classList.contains('innerCircle')\n ) {\n return;\n }\n event.stopPropagation();\n event.preventDefault();\n const { button, pointerId, pointerType } = event;\n this.handle.dispatchEvent(\n new PointerEvent('pointerdown', {\n button,\n pointerId,\n pointerType,\n })\n );\n this.handlePointermove(event);\n }\n\n calculateStyleData(): {\n clipPath: string;\n clipPathBorders: string;\n diameter: number;\n handleLocationStyles: string;\n } {\n // Extract values from element.\n const { width: diameter = 160 } = this.boundingClientRect || {};\n const styles = getComputedStyle(this);\n const borderWidth = parseFloat(\n styles.getPropertyValue('--_border-width')\n );\n const trackWidth = parseFloat(\n styles.getPropertyValue('--_track-width')\n );\n\n // Calculate wheel data.\n const radius = diameter / 2;\n const diameterAfterBoarder = diameter - borderWidth * 2;\n const radiusAfterBoarder = radius - borderWidth;\n const innerRadius = radius - trackWidth;\n const innerDiameter = innerRadius * 2;\n const innerRadiusAfterBorder = innerRadius + borderWidth;\n const innerDiameterAfterBorder = innerDiameter + borderWidth * 2;\n const clipPathBorders = `\"M ${radius} ${radius} m -${radius} 0 a ${radius} ${radius} 0 1 0 ${diameter} 0 a ${radius} ${radius} 0 1 0 -${diameter} 0 M ${radius} ${radius} m -${innerRadius} 0 a ${innerRadius} ${innerRadius} 0 1 0 ${innerDiameter} 0 a ${innerRadius} ${innerRadius} 0 1 0 -${innerDiameter} 0\"`;\n const clipPath = `\"M ${radiusAfterBoarder} ${radiusAfterBoarder} m -${radiusAfterBoarder} 0 a ${radiusAfterBoarder} ${radiusAfterBoarder} 0 1 0 ${diameterAfterBoarder} 0 a ${radiusAfterBoarder} ${radiusAfterBoarder} 0 1 0 -${diameterAfterBoarder} 0 M ${radiusAfterBoarder} ${radiusAfterBoarder} m -${innerRadiusAfterBorder} 0 a ${innerRadiusAfterBorder} ${innerRadiusAfterBorder} 0 1 0 ${innerDiameterAfterBorder} 0 a ${innerRadiusAfterBorder} ${innerRadiusAfterBorder} 0 1 0 -${innerDiameterAfterBorder} 0\"`;\n\n // Calculate handle position on the wheel.\n const translateX =\n (this.isLTR ? 1 : -1) *\n (radius - trackWidth / 2) *\n Math.cos((this.value * Math.PI) / 180);\n const translateY =\n (radius - trackWidth / 2) * Math.sin((this.value * Math.PI) / 180);\n const handleLocationStyles = `transform: translate(${translateX}px, ${translateY}px);`;\n\n return {\n clipPath,\n clipPathBorders,\n diameter,\n handleLocationStyles,\n };\n }\n\n protected override render(): TemplateResult {\n const { clipPath, clipPathBorders, diameter, handleLocationStyles } =\n this.calculateStyleData();\n\n return html`\n <slot\n name=\"gradient\"\n @pointerdown=${this.handleGradientPointerdown}\n style=\"\n --spectrum-colorwheel-colorarea-container-size: ${diameter}px;\n --spectrum-colorwheel-height: ${diameter}px;\n --spectrum-colorwheel-width: ${diameter}px;\n --spectrum-colorwheel-path-borders: ${clipPathBorders};\n --spectrum-colorwheel-path: ${clipPath};\n \"\n >\n <div class=\"inner\">\n <div class=\"colorarea-container\"></div>\n </div>\n <div class=\"border\">\n <div class=\"wheel\"></div>\n </div>\n </slot>\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=\"hsl(${this.value}, 100%, 50%)\"\n ?disabled=${this.disabled}\n style=${handleLocationStyles}\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 <input\n type=\"range\"\n class=\"slider\"\n aria-label=${this.label}\n min=\"0\"\n max=\"360\"\n step=${this.step}\n .value=${String(this.value)}\n aria-valuetext=${`${new Intl.NumberFormat(\n this.languageResolver.language,\n {\n maximumFractionDigits: 0,\n minimumIntegerDigits: 1,\n style: 'unit',\n unit: 'degree',\n unitDisplay: 'narrow',\n }\n ).format(this.value)}`}\n @input=${this.handleInput}\n @change=${this.handleChange}\n @keydown=${this.handleKeydown}\n />\n `;\n }\n\n protected override firstUpdated(changed: PropertyValues): void {\n super.firstUpdated(changed);\n this.boundingClientRect = this.getBoundingClientRect();\n this.addEventListener('focus', this.handleFocus);\n this.addEventListener('blur', this.handleBlur);\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": "qNAYA,OAEI,QAAAA,MAGG,gCACP,OAAS,aAAAC,MAAiB,kDAC1B,OACI,YAAAC,EACA,SAAAC,MACG,kDACP,OAAS,qBAAAC,MAAyB,0DAElC,OAAS,aAAAC,MAAiB,mDAE1B,MAAO,2DACP,OACI,mBAAAC,MAEG,uEACP,OAAS,gCAAAC,MAAoC,0EAE7C,OAAOC,MAAY,uBAQZ,aAAM,mBAAmBH,CAAU,CAAnC,k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,qBAAqB,CAC/B,CACJ,CApXoBG,EAAA,CADf/C,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GALhC,WAMO,mBAGA+C,EAAA,CADf/C,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GARjC,WASO,wBAGT+C,EAAA,CADN/C,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAXjC,WAYF,uBAGC+C,EAAA,CADP9C,EAAM,SAAS,GAdP,WAeD,sBAGD8C,EAAA,CADN/C,EAAS,CAAE,KAAM,MAAO,CAAC,GAjBjB,WAkBF,qBAGA+C,EAAA,CADN/C,EAAS,CAAE,KAAM,MAAO,CAAC,GApBjB,WAqBF,oBAOI+C,EAAA,CADV/C,EAAS,CAAE,KAAM,MAAO,CAAC,GA3BjB,WA4BE,qBASA+C,EAAA,CADV/C,EAAS,CAAE,KAAM,MAAO,CAAC,GApCjB,WAqCE,qBAoBJ+C,EAAA,CADN9C,EAAM,OAAO,GAxDL,WAyDF",
|
|
6
|
+
"names": ["html", "ifDefined", "property", "query", "streamingListener", "Focusable", "ColorController", "LanguageResolutionController", "styles", "hue", "color", "altered", "event", "key", "delta", "valueAsNumber", "focusOptions", "rect", "width", "height", "left", "top", "centerX", "centerY", "pointX", "pointY", "value", "button", "pointerId", "pointerType", "diameter", "borderWidth", "trackWidth", "radius", "diameterAfterBoarder", "radiusAfterBoarder", "innerRadius", "innerDiameter", "innerRadiusAfterBorder", "innerDiameterAfterBorder", "clipPathBorders", "clipPath", "translateX", "translateY", "handleLocationStyles", "changed", "_a", "entries", "entry", "__decorateClass"]
|
|
7
7
|
}
|
package/test/color-wheel.test.js
CHANGED
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
testForLitDevWarnings
|
|
14
14
|
} from "../../../test/testing-helpers.js";
|
|
15
15
|
import "@spectrum-web-components/color-wheel/sp-color-wheel.js";
|
|
16
|
-
import { TinyColor } from "@ctrl/tinycolor";
|
|
17
16
|
import { sendKeys } from "@web/test-runner-commands";
|
|
18
17
|
import { sendMouse } from "../../../test/plugins/browser.js";
|
|
19
18
|
import { spy } from "sinon";
|
|
@@ -258,7 +257,7 @@ describe("ColorWheel", () => {
|
|
|
258
257
|
expect(el.value).to.equal(0);
|
|
259
258
|
});
|
|
260
259
|
it("accepts pointer events", async () => {
|
|
261
|
-
const color =
|
|
260
|
+
const color = { h: "0", s: "20%", l: "70%" };
|
|
262
261
|
const el = await fixture(html`
|
|
263
262
|
<sp-color-wheel
|
|
264
263
|
.color=${color}
|
|
@@ -274,8 +273,12 @@ describe("ColorWheel", () => {
|
|
|
274
273
|
return;
|
|
275
274
|
};
|
|
276
275
|
expect(el.value).to.equal(0);
|
|
277
|
-
expect(
|
|
278
|
-
|
|
276
|
+
expect(
|
|
277
|
+
el.color.s
|
|
278
|
+
).to.be.within(0.19, 0.21);
|
|
279
|
+
expect(
|
|
280
|
+
el.color.l
|
|
281
|
+
).to.be.within(0.69, 0.71);
|
|
279
282
|
handle.dispatchEvent(
|
|
280
283
|
new PointerEvent("pointerdown", {
|
|
281
284
|
button: 1,
|
|
@@ -289,8 +292,12 @@ describe("ColorWheel", () => {
|
|
|
289
292
|
);
|
|
290
293
|
await elementUpdated(el);
|
|
291
294
|
expect(el.value).to.equal(0);
|
|
292
|
-
expect(
|
|
293
|
-
|
|
295
|
+
expect(
|
|
296
|
+
el.color.s
|
|
297
|
+
).to.be.within(0.19, 0.21);
|
|
298
|
+
expect(
|
|
299
|
+
el.color.l
|
|
300
|
+
).to.be.within(0.69, 0.71);
|
|
294
301
|
const root = el.shadowRoot ? el.shadowRoot : el;
|
|
295
302
|
const gradient = root.querySelector('[name="gradient"]');
|
|
296
303
|
gradient.dispatchEvent(
|
|
@@ -306,8 +313,12 @@ describe("ColorWheel", () => {
|
|
|
306
313
|
);
|
|
307
314
|
await elementUpdated(el);
|
|
308
315
|
expect(el.value).to.equal(0);
|
|
309
|
-
expect(
|
|
310
|
-
|
|
316
|
+
expect(
|
|
317
|
+
el.color.s
|
|
318
|
+
).to.be.within(0.19, 0.21);
|
|
319
|
+
expect(
|
|
320
|
+
el.color.l
|
|
321
|
+
).to.be.within(0.69, 0.71);
|
|
311
322
|
gradient.dispatchEvent(
|
|
312
323
|
new PointerEvent("pointerdown", {
|
|
313
324
|
pointerId: 1,
|
|
@@ -320,8 +331,12 @@ describe("ColorWheel", () => {
|
|
|
320
331
|
);
|
|
321
332
|
await elementUpdated(el);
|
|
322
333
|
expect(el.value).to.equal(263.74596725608353);
|
|
323
|
-
expect(
|
|
324
|
-
|
|
334
|
+
expect(
|
|
335
|
+
el.color.s
|
|
336
|
+
).to.be.within(0.19, 0.21);
|
|
337
|
+
expect(
|
|
338
|
+
el.color.l
|
|
339
|
+
).to.be.within(0.69, 0.71);
|
|
325
340
|
handle.dispatchEvent(
|
|
326
341
|
new PointerEvent("pointermove", {
|
|
327
342
|
pointerId: 1,
|
|
@@ -344,17 +359,22 @@ describe("ColorWheel", () => {
|
|
|
344
359
|
);
|
|
345
360
|
await elementUpdated(el);
|
|
346
361
|
expect(el.value).to.equal(96.34019174590992);
|
|
347
|
-
expect(
|
|
348
|
-
|
|
362
|
+
expect(
|
|
363
|
+
el.color.s
|
|
364
|
+
).to.be.within(0.19, 0.21);
|
|
365
|
+
expect(
|
|
366
|
+
el.color.l
|
|
367
|
+
).to.be.within(0.69, 0.71);
|
|
349
368
|
});
|
|
350
369
|
it("can have `change` events prevented", async () => {
|
|
351
|
-
const color =
|
|
370
|
+
const color = { h: "0", s: "20%", l: "70%" };
|
|
352
371
|
const el = await fixture(html`
|
|
353
372
|
<sp-color-wheel
|
|
354
373
|
.color=${color}
|
|
355
374
|
@change=${(event) => {
|
|
356
375
|
event == null ? void 0 : event.preventDefault();
|
|
357
376
|
}}
|
|
377
|
+
style="--spectrum-global-dimension-size-125: 10px;"
|
|
358
378
|
></sp-color-wheel>
|
|
359
379
|
`);
|
|
360
380
|
await elementUpdated(el);
|
|
@@ -399,7 +419,7 @@ describe("ColorWheel", () => {
|
|
|
399
419
|
{ name: "Hex8", color: "cc33ccff" },
|
|
400
420
|
{ name: "Hex8 String", color: "#cc33ccff" },
|
|
401
421
|
// name
|
|
402
|
-
{ name: "string", color: "red" },
|
|
422
|
+
{ name: "string", color: "red", test: "ff0000" },
|
|
403
423
|
// hsl
|
|
404
424
|
{ name: "HSL String", color: "hsl(300, 60%, 50%)" },
|
|
405
425
|
{ name: "HSL", color: { h: 300, s: 0.6000000000000001, l: 0.5, a: 1 } },
|
|
@@ -412,57 +432,40 @@ describe("ColorWheel", () => {
|
|
|
412
432
|
const el = await fixture(html`
|
|
413
433
|
<sp-color-wheel></sp-color-wheel>
|
|
414
434
|
`);
|
|
415
|
-
|
|
435
|
+
if (typeof format.color === "string") {
|
|
436
|
+
el.color = format.color;
|
|
437
|
+
} else {
|
|
438
|
+
el.color = { ...format.color };
|
|
439
|
+
}
|
|
416
440
|
if (format.name.startsWith("Hex")) {
|
|
417
441
|
expect(el.color).to.equal(format.color);
|
|
442
|
+
} else if (format.name === "string") {
|
|
443
|
+
expect(el.color).to.equal(format.test);
|
|
418
444
|
} else expect(el.color).to.deep.equal(format.color);
|
|
419
445
|
});
|
|
420
446
|
});
|
|
421
|
-
it(`maintains \`color\` format as TinyColor`, async () => {
|
|
422
|
-
const el = await fixture(html`
|
|
423
|
-
<sp-color-wheel></sp-color-wheel>
|
|
424
|
-
`);
|
|
425
|
-
const color = new TinyColor("rgb(204, 51, 204)");
|
|
426
|
-
el.color = color;
|
|
427
|
-
expect(color.equals(el.color));
|
|
428
|
-
});
|
|
429
447
|
it(`maintains hue value`, async () => {
|
|
430
448
|
const el = await fixture(html`
|
|
431
449
|
<sp-color-wheel></sp-color-wheel>
|
|
432
450
|
`);
|
|
433
451
|
const hue = 300;
|
|
434
|
-
const hsl = `hsl(${hue}, 60%,
|
|
452
|
+
const hsl = `hsl(${hue}, 60%, 56%)`;
|
|
435
453
|
el.color = hsl;
|
|
454
|
+
await elementUpdated(el);
|
|
436
455
|
expect(el.value).to.equal(hue);
|
|
437
456
|
expect(el.color).to.equal(hsl);
|
|
438
|
-
const hsla = `hsla(${hue}, 60%,
|
|
457
|
+
const hsla = `hsla(${hue}, 60%, 56%, 0.9)`;
|
|
439
458
|
el.color = hsla;
|
|
440
459
|
expect(el.value).to.equal(hue);
|
|
441
460
|
expect(el.color).to.equal(hsla);
|
|
442
|
-
const hsv = `hsv(${hue}, 60%,
|
|
461
|
+
const hsv = `hsv(${hue}, 60%, 56%)`;
|
|
443
462
|
el.color = hsv;
|
|
444
463
|
expect(el.value).to.equal(hue);
|
|
445
464
|
expect(el.color).to.equal(hsv);
|
|
446
|
-
const hsva = `hsva(${hue}, 60%,
|
|
465
|
+
const hsva = `hsva(${hue}, 60%, 56%, 0.9)`;
|
|
447
466
|
el.color = hsva;
|
|
448
467
|
expect(el.value).to.equal(hue);
|
|
449
468
|
expect(el.color).to.equal(hsva);
|
|
450
|
-
const tinyHSV = new TinyColor({ h: hue, s: 60, v: 100 });
|
|
451
|
-
el.color = tinyHSV;
|
|
452
|
-
expect(el.value).to.equal(hue);
|
|
453
|
-
expect(tinyHSV.equals(el.color)).to.be.true;
|
|
454
|
-
const tinyHSVA = new TinyColor({ h: hue, s: 60, v: 100, a: 1 });
|
|
455
|
-
el.color = tinyHSVA;
|
|
456
|
-
expect(el.value).to.equal(hue);
|
|
457
|
-
expect(tinyHSVA.equals(el.color)).to.be.true;
|
|
458
|
-
const tinyHSL = new TinyColor({ h: hue, s: 60, l: 100 });
|
|
459
|
-
el.color = tinyHSL;
|
|
460
|
-
expect(el.value).to.equal(hue);
|
|
461
|
-
expect(tinyHSL.equals(el.color)).to.be.true;
|
|
462
|
-
const tinyHSLA = new TinyColor({ h: hue, s: 60, l: 100, a: 1 });
|
|
463
|
-
el.color = tinyHSLA;
|
|
464
|
-
expect(el.value).to.equal(hue);
|
|
465
|
-
expect(tinyHSLA.equals(el.color)).to.be.true;
|
|
466
469
|
});
|
|
467
470
|
it('should flip orientation with dir="rtl"', async () => {
|
|
468
471
|
const el = await fixture(html`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["color-wheel.test.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 { elementUpdated, expect, fixture, html } from '@open-wc/testing';\nimport {\n arrowDownEvent,\n arrowDownKeyupEvent,\n arrowLeftEvent,\n arrowLeftKeyupEvent,\n arrowRightEvent,\n arrowRightKeyupEvent,\n arrowUpEvent,\n arrowUpKeyupEvent,\n ignoreResizeObserverLoopError,\n testForLitDevWarnings,\n} from '../../../test/testing-helpers.js';\n\nimport '@spectrum-web-components/color-wheel/sp-color-wheel.js';\nimport { ColorWheel } from '@spectrum-web-components/color-wheel';\nimport { HSL, HSLA, HSV, HSVA, RGB, RGBA, TinyColor } from '@ctrl/tinycolor';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { sendMouse } from '../../../test/plugins/browser.js';\nimport { spy } from 'sinon';\n\nignoreResizeObserverLoopError(before, after);\n\ndescribe('ColorWheel', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<ColorWheel>(html`\n <sp-color-wheel></sp-color-wheel>\n `)\n );\n it('loads default color-wheel accessibly', async () => {\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n\n it('manages a single tab stop', async () => {\n const test = await fixture<HTMLDivElement>(html`\n <div>\n <input type=\"text\" id=\"test-input-1\" />\n <sp-color-wheel></sp-color-wheel>\n <input type=\"text\" id=\"test-input-2\" />\n </div>\n `);\n const el = test.querySelector('sp-color-wheel') as ColorWheel;\n const input1 = test.querySelector(\n 'input:nth-of-type(1)'\n ) as HTMLInputElement;\n const input2 = test.querySelector(\n 'input:nth-of-type(2)'\n ) as HTMLInputElement;\n\n await elementUpdated(el);\n\n input1.focus();\n\n expect(document.activeElement).to.equal(input1);\n\n await sendKeys({\n press: 'Tab',\n });\n\n expect(document.activeElement).to.equal(el);\n\n let value = el.value;\n await sendKeys({\n press: 'ArrowRight',\n });\n expect(el.value).to.not.equal(value);\n await sendKeys({\n press: 'Tab',\n });\n\n expect(document.activeElement).to.equal(input2);\n\n await sendKeys({\n press: 'Shift+Tab',\n });\n\n expect(document.activeElement).to.equal(el);\n\n value = el.value;\n await sendKeys({\n press: 'ArrowDown',\n });\n expect(el.value).to.not.equal(value);\n await sendKeys({\n press: 'Shift+Tab',\n });\n\n expect(document.activeElement).to.equal(input1);\n });\n it('manages [focused]', async () => {\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n\n expect(el.focused).to.be.false;\n\n await sendKeys({ press: 'Tab' });\n await elementUpdated(el);\n\n expect(el.focused).to.be.true;\n\n el.blur();\n await elementUpdated(el);\n\n expect(el.focused).to.be.false;\n\n el.dispatchEvent(new FocusEvent('focus'));\n await elementUpdated(el);\n\n expect(el.focused).to.be.true;\n\n el.dispatchEvent(new FocusEvent('blur'));\n await elementUpdated(el);\n\n expect(el.focused).to.be.false;\n });\n it('dispatches input and change events in response to \"Arrow*\" keypresses', async () => {\n const inputSpy = spy();\n const changeSpy = spy();\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel\n @change=${() => changeSpy()}\n @input=${() => inputSpy()}\n ></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n el.focus();\n\n await sendKeys({ press: 'ArrowRight' });\n expect(inputSpy.callCount).to.equal(1);\n expect(changeSpy.callCount).to.equal(1);\n\n await sendKeys({ press: 'ArrowLeft' });\n expect(inputSpy.callCount).to.equal(2);\n expect(changeSpy.callCount).to.equal(2);\n\n await sendKeys({ press: 'ArrowUp' });\n expect(inputSpy.callCount).to.equal(3);\n expect(changeSpy.callCount).to.equal(3);\n\n await sendKeys({ press: 'ArrowDown' });\n expect(inputSpy.callCount).to.equal(4);\n expect(changeSpy.callCount).to.equal(4);\n });\n it('responds to events on the internal input element', async () => {\n // screen reader interactions dispatch events as found in the following test\n const inputSpy = spy();\n const changeSpy = spy();\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel\n @change=${() => changeSpy()}\n @input=${() => inputSpy()}\n ></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n\n const input = el.focusElement;\n\n el.focus();\n\n input.dispatchEvent(\n new Event('input', {\n bubbles: true,\n composed: true,\n })\n );\n input.dispatchEvent(\n new Event('change', {\n bubbles: true,\n composed: false, // native change events do not compose themselves by default\n })\n );\n\n expect(inputSpy.callCount).to.equal(1);\n expect(changeSpy.callCount).to.equal(1);\n });\n it('accepts \"Arrow*\" keypresses', async () => {\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(0);\n\n const input = el.focusElement;\n\n input.dispatchEvent(arrowUpEvent());\n input.dispatchEvent(arrowUpKeyupEvent());\n input.dispatchEvent(arrowUpEvent());\n input.dispatchEvent(arrowUpKeyupEvent());\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(2);\n\n input.dispatchEvent(arrowRightEvent());\n input.dispatchEvent(arrowRightKeyupEvent());\n input.dispatchEvent(arrowRightEvent());\n input.dispatchEvent(arrowRightKeyupEvent());\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(4);\n\n input.dispatchEvent(arrowDownEvent());\n input.dispatchEvent(arrowDownKeyupEvent());\n input.dispatchEvent(arrowDownEvent());\n input.dispatchEvent(arrowDownKeyupEvent());\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(2);\n\n input.dispatchEvent(arrowLeftEvent());\n input.dispatchEvent(arrowLeftKeyupEvent());\n input.dispatchEvent(arrowLeftEvent());\n input.dispatchEvent(arrowLeftKeyupEvent());\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(0);\n });\n it('accepts \"Arrow*\" keypresses in dir=\"rtl\"', async () => {\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel dir=\"rtl\"></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(0);\n\n const input = el.focusElement;\n\n input.dispatchEvent(arrowUpEvent());\n input.dispatchEvent(arrowUpKeyupEvent());\n input.dispatchEvent(arrowUpEvent());\n input.dispatchEvent(arrowUpKeyupEvent());\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(2);\n\n input.dispatchEvent(arrowRightEvent());\n input.dispatchEvent(arrowRightKeyupEvent());\n input.dispatchEvent(arrowRightEvent());\n input.dispatchEvent(arrowRightKeyupEvent());\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(0);\n\n input.dispatchEvent(arrowLeftEvent());\n input.dispatchEvent(arrowLeftKeyupEvent());\n input.dispatchEvent(arrowLeftEvent());\n input.dispatchEvent(arrowLeftKeyupEvent());\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(2);\n\n input.dispatchEvent(arrowDownEvent());\n input.dispatchEvent(arrowDownKeyupEvent());\n input.dispatchEvent(arrowDownEvent());\n input.dispatchEvent(arrowDownKeyupEvent());\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(0);\n });\n it('accepts \"Arrow*\" keypresses with alteration', async () => {\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n el.focus();\n expect(el.value).to.equal(0);\n\n await sendKeys({\n down: 'Shift',\n });\n await sendKeys({\n press: 'ArrowUp',\n });\n await sendKeys({\n press: 'ArrowUp',\n });\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(20);\n\n await sendKeys({\n press: 'ArrowRight',\n });\n await sendKeys({\n press: 'ArrowRight',\n });\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(40);\n\n await sendKeys({\n press: 'ArrowDown',\n });\n await sendKeys({\n press: 'ArrowDown',\n });\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(20);\n\n await sendKeys({\n press: 'ArrowLeft',\n });\n await sendKeys({\n press: 'ArrowLeft',\n });\n await sendKeys({\n up: 'Shift',\n });\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(0);\n });\n it('accepts pointer events', async () => {\n const color = new TinyColor({ h: '0', s: '20%', l: '70%' });\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel\n .color=${color}\n style=\"--mod-colorwheel-width: 160px; --mod-colorwheel-height: 160px;\"\n ></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n\n const { handle } = el as unknown as { handle: HTMLElement };\n\n handle.setPointerCapture = () => {\n return;\n };\n handle.releasePointerCapture = () => {\n return;\n };\n\n expect(el.value).to.equal(0);\n expect((el.color as HSLA).s).to.be.within(0.19, 0.21);\n expect((el.color as HSLA).l).to.be.within(0.69, 0.71);\n\n handle.dispatchEvent(\n new PointerEvent('pointerdown', {\n button: 1,\n pointerId: 1,\n clientX: 80,\n clientY: 15,\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(0);\n expect((el.color as HSLA).s).to.be.within(0.19, 0.21);\n expect((el.color as HSLA).l).to.be.within(0.69, 0.71);\n\n const root = el.shadowRoot ? el.shadowRoot : el;\n const gradient = root.querySelector('[name=\"gradient\"]') as HTMLElement;\n gradient.dispatchEvent(\n new PointerEvent('pointerdown', {\n button: 1,\n pointerId: 1,\n clientX: 80,\n clientY: 15,\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(0);\n expect((el.color as HSLA).s).to.be.within(0.19, 0.21);\n expect((el.color as HSLA).l).to.be.within(0.69, 0.71);\n\n gradient.dispatchEvent(\n new PointerEvent('pointerdown', {\n pointerId: 1,\n clientX: 80,\n clientY: 15,\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(263.74596725608353);\n expect((el.color as HSLA).s).to.be.within(0.19, 0.21);\n expect((el.color as HSLA).l).to.be.within(0.69, 0.71);\n\n handle.dispatchEvent(\n new PointerEvent('pointermove', {\n pointerId: 1,\n clientX: 80,\n clientY: 160,\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n handle.dispatchEvent(\n new PointerEvent('pointerup', {\n pointerId: 1,\n clientX: 80,\n clientY: 160,\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(96.34019174590992);\n expect((el.color as HSLA).s).to.be.within(0.19, 0.21);\n expect((el.color as HSLA).l).to.be.within(0.69, 0.71);\n });\n it('can have `change` events prevented', async () => {\n const color = new TinyColor({ h: '0', s: '20%', l: '70%' });\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel\n .color=${color}\n @change=${(event: Event) => {\n event?.preventDefault();\n }}\n ></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(0);\n\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [80, 15],\n },\n {\n type: 'down',\n },\n {\n type: 'move',\n position: [80, 160],\n },\n ],\n });\n\n await elementUpdated(el);\n\n await sendMouse({\n steps: [\n {\n type: 'up',\n },\n ],\n });\n\n await elementUpdated(el);\n expect(el.value).to.equal(0);\n });\n const colorFormats: {\n name: string;\n color:\n | string\n | number\n | TinyColor\n | HSVA\n | HSV\n | RGB\n | RGBA\n | HSL\n | HSLA;\n }[] = [\n //rgb\n { name: 'RGB String', color: 'rgb(204, 51, 204)' },\n { name: 'RGB', color: { r: 204, g: 51, b: 204, a: 1 } },\n //prgb\n { name: 'PRGB String', color: 'rgb(80%, 20%, 80%)' },\n { name: 'PRGB', color: { r: '80%', g: '20%', b: '80%', a: 1 } },\n // hex\n { name: 'Hex', color: 'cc33cc' },\n { name: 'Hex String', color: '#cc33cc' },\n // hex8\n { name: 'Hex8', color: 'cc33ccff' },\n { name: 'Hex8 String', color: '#cc33ccff' },\n // name\n { name: 'string', color: 'red' },\n // hsl\n { name: 'HSL String', color: 'hsl(300, 60%, 50%)' },\n { name: 'HSL', color: { h: 300, s: 0.6000000000000001, l: 0.5, a: 1 } },\n // hsv\n { name: 'HSV String', color: 'hsv(300, 75%, 100%)' },\n { name: 'HSV', color: { h: 300, s: 0.75, v: 1, a: 1 } },\n ];\n colorFormats.map((format) => {\n it(`maintains \\`color\\` format as ${format.name}`, async () => {\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel></sp-color-wheel>\n `);\n\n el.color = format.color;\n if (format.name.startsWith('Hex')) {\n expect(el.color).to.equal(format.color);\n } else expect(el.color).to.deep.equal(format.color);\n });\n });\n it(`maintains \\`color\\` format as TinyColor`, async () => {\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel></sp-color-wheel>\n `);\n const color = new TinyColor('rgb(204, 51, 204)');\n el.color = color;\n expect(color.equals(el.color));\n });\n it(`maintains hue value`, async () => {\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel></sp-color-wheel>\n `);\n const hue = 300;\n const hsl = `hsl(${hue}, 60%, 100%)`;\n el.color = hsl;\n expect(el.value).to.equal(hue);\n expect(el.color).to.equal(hsl);\n\n const hsla = `hsla(${hue}, 60%, 100%, 0.9)`;\n el.color = hsla;\n expect(el.value).to.equal(hue);\n expect(el.color).to.equal(hsla);\n\n const hsv = `hsv(${hue}, 60%, 100%)`;\n el.color = hsv;\n expect(el.value).to.equal(hue);\n expect(el.color).to.equal(hsv);\n\n const hsva = `hsva(${hue}, 60%, 100%, 0.9)`;\n el.color = hsva;\n expect(el.value).to.equal(hue);\n expect(el.color).to.equal(hsva);\n\n const tinyHSV = new TinyColor({ h: hue, s: 60, v: 100 });\n el.color = tinyHSV;\n expect(el.value).to.equal(hue);\n expect(tinyHSV.equals(el.color)).to.be.true;\n\n const tinyHSVA = new TinyColor({ h: hue, s: 60, v: 100, a: 1 });\n el.color = tinyHSVA;\n expect(el.value).to.equal(hue);\n expect(tinyHSVA.equals(el.color)).to.be.true;\n\n const tinyHSL = new TinyColor({ h: hue, s: 60, l: 100 });\n el.color = tinyHSL;\n expect(el.value).to.equal(hue);\n expect(tinyHSL.equals(el.color)).to.be.true;\n\n const tinyHSLA = new TinyColor({ h: hue, s: 60, l: 100, a: 1 });\n el.color = tinyHSLA;\n expect(el.value).to.equal(hue);\n expect(tinyHSLA.equals(el.color)).to.be.true;\n });\n it('should flip orientation with dir=\"rtl\"', async () => {\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n\n const root = el.shadowRoot ? el.shadowRoot : el;\n expect(\n getComputedStyle(root.querySelector('.wheel') as HTMLElement)\n .transform\n ).to.equal('none');\n\n el.setAttribute('dir', 'rtl');\n\n await elementUpdated(el);\n expect(\n getComputedStyle(root.querySelector('.wheel') as HTMLElement)\n .transform\n ).to.equal('matrix(-1, 0, 0, 1, 0, 0)');\n });\n});\n"],
|
|
5
|
-
"mappings": ";AAYA,SAAS,gBAAgB,QAAQ,SAAS,YAAY;AACtD;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAEP,OAAO;AAEP,SAA0C,iBAAiB;AAC3D,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,WAAW;AAEpB,8BAA8B,QAAQ,KAAK;AAE3C,SAAS,cAAc,MAAM;AACzB;AAAA,IACI,YACI,MAAM,QAAoB;AAAA;AAAA,aAEzB;AAAA,EACT;AACA,KAAG,wCAAwC,YAAY;AACnD,UAAM,KAAK,MAAM,QAAoB;AAAA;AAAA,SAEpC;AAED,UAAM,eAAe,EAAE;AA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AAc,QAAQ,CAAgB,EACvD;AAAA,IACT,EAAE,GAAG,MAAM,MAAM;AAEjB,OAAG,aAAa,OAAO,KAAK;AAE5B,UAAM,eAAe,EAAE;AACvB;AAAA,MACI,iBAAiB,KAAK,cAAc,QAAQ,CAAgB,EACvD;AAAA,IACT,EAAE,GAAG,MAAM,2BAA2B;AAAA,EAC1C,CAAC;AACL,CAAC;",
|
|
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 { elementUpdated, expect, fixture, html } from '@open-wc/testing';\nimport {\n arrowDownEvent,\n arrowDownKeyupEvent,\n arrowLeftEvent,\n arrowLeftKeyupEvent,\n arrowRightEvent,\n arrowRightKeyupEvent,\n arrowUpEvent,\n arrowUpKeyupEvent,\n ignoreResizeObserverLoopError,\n testForLitDevWarnings,\n} from '../../../test/testing-helpers.js';\n\nimport '@spectrum-web-components/color-wheel/sp-color-wheel.js';\nimport { ColorWheel } from '@spectrum-web-components/color-wheel';\nimport { ColorTypes } from '@spectrum-web-components/reactive-controllers/src/ColorController.js';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { sendMouse } from '../../../test/plugins/browser.js';\nimport { spy } from 'sinon';\n\nignoreResizeObserverLoopError(before, after);\n\ndescribe('ColorWheel', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<ColorWheel>(html`\n <sp-color-wheel></sp-color-wheel>\n `)\n );\n it('loads default color-wheel accessibly', async () => {\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n\n it('manages a single tab stop', async () => {\n const test = await fixture<HTMLDivElement>(html`\n <div>\n <input type=\"text\" id=\"test-input-1\" />\n <sp-color-wheel></sp-color-wheel>\n <input type=\"text\" id=\"test-input-2\" />\n </div>\n `);\n const el = test.querySelector('sp-color-wheel') as ColorWheel;\n const input1 = test.querySelector(\n 'input:nth-of-type(1)'\n ) as HTMLInputElement;\n const input2 = test.querySelector(\n 'input:nth-of-type(2)'\n ) as HTMLInputElement;\n\n await elementUpdated(el);\n\n input1.focus();\n\n expect(document.activeElement).to.equal(input1);\n\n await sendKeys({\n press: 'Tab',\n });\n\n expect(document.activeElement).to.equal(el);\n\n let value = el.value;\n await sendKeys({\n press: 'ArrowRight',\n });\n expect(el.value).to.not.equal(value);\n await sendKeys({\n press: 'Tab',\n });\n\n expect(document.activeElement).to.equal(input2);\n\n await sendKeys({\n press: 'Shift+Tab',\n });\n\n expect(document.activeElement).to.equal(el);\n\n value = el.value;\n await sendKeys({\n press: 'ArrowDown',\n });\n expect(el.value).to.not.equal(value);\n await sendKeys({\n press: 'Shift+Tab',\n });\n\n expect(document.activeElement).to.equal(input1);\n });\n it('manages [focused]', async () => {\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n\n expect(el.focused).to.be.false;\n\n await sendKeys({ press: 'Tab' });\n await elementUpdated(el);\n\n expect(el.focused).to.be.true;\n\n el.blur();\n await elementUpdated(el);\n\n expect(el.focused).to.be.false;\n\n el.dispatchEvent(new FocusEvent('focus'));\n await elementUpdated(el);\n\n expect(el.focused).to.be.true;\n\n el.dispatchEvent(new FocusEvent('blur'));\n await elementUpdated(el);\n\n expect(el.focused).to.be.false;\n });\n it('dispatches input and change events in response to \"Arrow*\" keypresses', async () => {\n const inputSpy = spy();\n const changeSpy = spy();\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel\n @change=${() => changeSpy()}\n @input=${() => inputSpy()}\n ></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n el.focus();\n\n await sendKeys({ press: 'ArrowRight' });\n expect(inputSpy.callCount).to.equal(1);\n expect(changeSpy.callCount).to.equal(1);\n\n await sendKeys({ press: 'ArrowLeft' });\n expect(inputSpy.callCount).to.equal(2);\n expect(changeSpy.callCount).to.equal(2);\n\n await sendKeys({ press: 'ArrowUp' });\n expect(inputSpy.callCount).to.equal(3);\n expect(changeSpy.callCount).to.equal(3);\n\n await sendKeys({ press: 'ArrowDown' });\n expect(inputSpy.callCount).to.equal(4);\n expect(changeSpy.callCount).to.equal(4);\n });\n it('responds to events on the internal input element', async () => {\n // screen reader interactions dispatch events as found in the following test\n const inputSpy = spy();\n const changeSpy = spy();\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel\n @change=${() => changeSpy()}\n @input=${() => inputSpy()}\n ></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n\n const input = el.focusElement;\n\n el.focus();\n\n input.dispatchEvent(\n new Event('input', {\n bubbles: true,\n composed: true,\n })\n );\n input.dispatchEvent(\n new Event('change', {\n bubbles: true,\n composed: false, // native change events do not compose themselves by default\n })\n );\n\n expect(inputSpy.callCount).to.equal(1);\n expect(changeSpy.callCount).to.equal(1);\n });\n it('accepts \"Arrow*\" keypresses', async () => {\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(0);\n\n const input = el.focusElement;\n\n input.dispatchEvent(arrowUpEvent());\n input.dispatchEvent(arrowUpKeyupEvent());\n input.dispatchEvent(arrowUpEvent());\n input.dispatchEvent(arrowUpKeyupEvent());\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(2);\n\n input.dispatchEvent(arrowRightEvent());\n input.dispatchEvent(arrowRightKeyupEvent());\n input.dispatchEvent(arrowRightEvent());\n input.dispatchEvent(arrowRightKeyupEvent());\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(4);\n\n input.dispatchEvent(arrowDownEvent());\n input.dispatchEvent(arrowDownKeyupEvent());\n input.dispatchEvent(arrowDownEvent());\n input.dispatchEvent(arrowDownKeyupEvent());\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(2);\n\n input.dispatchEvent(arrowLeftEvent());\n input.dispatchEvent(arrowLeftKeyupEvent());\n input.dispatchEvent(arrowLeftEvent());\n input.dispatchEvent(arrowLeftKeyupEvent());\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(0);\n });\n it('accepts \"Arrow*\" keypresses in dir=\"rtl\"', async () => {\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel dir=\"rtl\"></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(0);\n\n const input = el.focusElement;\n\n input.dispatchEvent(arrowUpEvent());\n input.dispatchEvent(arrowUpKeyupEvent());\n input.dispatchEvent(arrowUpEvent());\n input.dispatchEvent(arrowUpKeyupEvent());\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(2);\n\n input.dispatchEvent(arrowRightEvent());\n input.dispatchEvent(arrowRightKeyupEvent());\n input.dispatchEvent(arrowRightEvent());\n input.dispatchEvent(arrowRightKeyupEvent());\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(0);\n\n input.dispatchEvent(arrowLeftEvent());\n input.dispatchEvent(arrowLeftKeyupEvent());\n input.dispatchEvent(arrowLeftEvent());\n input.dispatchEvent(arrowLeftKeyupEvent());\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(2);\n\n input.dispatchEvent(arrowDownEvent());\n input.dispatchEvent(arrowDownKeyupEvent());\n input.dispatchEvent(arrowDownEvent());\n input.dispatchEvent(arrowDownKeyupEvent());\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(0);\n });\n it('accepts \"Arrow*\" keypresses with alteration', async () => {\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n el.focus();\n expect(el.value).to.equal(0);\n\n await sendKeys({\n down: 'Shift',\n });\n await sendKeys({\n press: 'ArrowUp',\n });\n await sendKeys({\n press: 'ArrowUp',\n });\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(20);\n\n await sendKeys({\n press: 'ArrowRight',\n });\n await sendKeys({\n press: 'ArrowRight',\n });\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(40);\n\n await sendKeys({\n press: 'ArrowDown',\n });\n await sendKeys({\n press: 'ArrowDown',\n });\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(20);\n\n await sendKeys({\n press: 'ArrowLeft',\n });\n await sendKeys({\n press: 'ArrowLeft',\n });\n await sendKeys({\n up: 'Shift',\n });\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(0);\n });\n it('accepts pointer events', async () => {\n const color = { h: '0', s: '20%', l: '70%' };\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel\n .color=${color}\n style=\"--mod-colorwheel-width: 160px; --mod-colorwheel-height: 160px;\"\n ></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n\n const { handle } = el as unknown as { handle: HTMLElement };\n\n handle.setPointerCapture = () => {\n return;\n };\n handle.releasePointerCapture = () => {\n return;\n };\n\n expect(el.value).to.equal(0);\n expect(\n (el.color as { h: number; s: number; l: number; a: number }).s\n ).to.be.within(0.19, 0.21);\n expect(\n (el.color as { h: number; s: number; l: number; a: number }).l\n ).to.be.within(0.69, 0.71);\n\n handle.dispatchEvent(\n new PointerEvent('pointerdown', {\n button: 1,\n pointerId: 1,\n clientX: 80,\n clientY: 15,\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(0);\n expect(\n (el.color as { h: number; s: number; l: number; a: number }).s\n ).to.be.within(0.19, 0.21);\n expect(\n (el.color as { h: number; s: number; l: number; a: number }).l\n ).to.be.within(0.69, 0.71);\n\n const root = el.shadowRoot ? el.shadowRoot : el;\n const gradient = root.querySelector('[name=\"gradient\"]') as HTMLElement;\n gradient.dispatchEvent(\n new PointerEvent('pointerdown', {\n button: 1,\n pointerId: 1,\n clientX: 80,\n clientY: 15,\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(0);\n expect(\n (el.color as { h: number; s: number; l: number; a: number }).s\n ).to.be.within(0.19, 0.21);\n expect(\n (el.color as { h: number; s: number; l: number; a: number }).l\n ).to.be.within(0.69, 0.71);\n\n gradient.dispatchEvent(\n new PointerEvent('pointerdown', {\n pointerId: 1,\n clientX: 80,\n clientY: 15,\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(263.74596725608353);\n expect(\n (el.color as { h: number; s: number; l: number; a: number }).s\n ).to.be.within(0.19, 0.21);\n expect(\n (el.color as { h: number; s: number; l: number; a: number }).l\n ).to.be.within(0.69, 0.71);\n\n handle.dispatchEvent(\n new PointerEvent('pointermove', {\n pointerId: 1,\n clientX: 80,\n clientY: 160,\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n handle.dispatchEvent(\n new PointerEvent('pointerup', {\n pointerId: 1,\n clientX: 80,\n clientY: 160,\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(96.34019174590992);\n expect(\n (el.color as { h: number; s: number; l: number; a: number }).s\n ).to.be.within(0.19, 0.21);\n expect(\n (el.color as { h: number; s: number; l: number; a: number }).l\n ).to.be.within(0.69, 0.71);\n });\n it('can have `change` events prevented', async () => {\n const color = { h: '0', s: '20%', l: '70%' };\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel\n .color=${color}\n @change=${(event: Event) => {\n event?.preventDefault();\n }}\n style=\"--spectrum-global-dimension-size-125: 10px;\"\n ></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n\n expect(el.value).to.equal(0);\n\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [80, 15],\n },\n {\n type: 'down',\n },\n {\n type: 'move',\n position: [80, 160],\n },\n ],\n });\n\n await elementUpdated(el);\n\n await sendMouse({\n steps: [\n {\n type: 'up',\n },\n ],\n });\n\n await elementUpdated(el);\n expect(el.value).to.equal(0);\n });\n const colorFormats: {\n name: string;\n color: ColorTypes;\n test?: string;\n }[] = [\n //rgb\n { name: 'RGB String', color: 'rgb(204, 51, 204)' },\n { name: 'RGB', color: { r: 204, g: 51, b: 204, a: 1 } },\n //prgb\n { name: 'PRGB String', color: 'rgb(80%, 20%, 80%)' },\n { name: 'PRGB', color: { r: '80%', g: '20%', b: '80%', a: 1 } },\n // hex\n { name: 'Hex', color: 'cc33cc' },\n { name: 'Hex String', color: '#cc33cc' },\n // hex8\n { name: 'Hex8', color: 'cc33ccff' },\n { name: 'Hex8 String', color: '#cc33ccff' },\n // name\n { name: 'string', color: 'red', test: 'ff0000' },\n // hsl\n { name: 'HSL String', color: 'hsl(300, 60%, 50%)' },\n { name: 'HSL', color: { h: 300, s: 0.6000000000000001, l: 0.5, a: 1 } },\n // hsv\n { name: 'HSV String', color: 'hsv(300, 75%, 100%)' },\n { name: 'HSV', color: { h: 300, s: 0.75, v: 1, a: 1 } },\n ];\n colorFormats.map((format) => {\n it(`maintains \\`color\\` format as ${format.name}`, async () => {\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel></sp-color-wheel>\n `);\n\n if (typeof format.color === 'string') {\n el.color = format.color;\n } else {\n el.color = { ...format.color } as ColorTypes;\n }\n if (format.name.startsWith('Hex')) {\n expect(el.color).to.equal(format.color);\n } else if (format.name === 'string') {\n expect(el.color).to.equal(format.test);\n } else expect(el.color).to.deep.equal(format.color);\n });\n });\n it(`maintains hue value`, async () => {\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel></sp-color-wheel>\n `);\n const hue = 300;\n const hsl = `hsl(${hue}, 60%, 56%)`;\n\n el.color = hsl;\n await elementUpdated(el);\n\n expect(el.value).to.equal(hue);\n expect(el.color).to.equal(hsl);\n\n const hsla = `hsla(${hue}, 60%, 56%, 0.9)`;\n el.color = hsla;\n expect(el.value).to.equal(hue);\n expect(el.color).to.equal(hsla);\n\n const hsv = `hsv(${hue}, 60%, 56%)`;\n el.color = hsv;\n expect(el.value).to.equal(hue);\n expect(el.color).to.equal(hsv);\n\n const hsva = `hsva(${hue}, 60%, 56%, 0.9)`;\n el.color = hsva;\n expect(el.value).to.equal(hue);\n expect(el.color).to.equal(hsva);\n });\n it('should flip orientation with dir=\"rtl\"', async () => {\n const el = await fixture<ColorWheel>(html`\n <sp-color-wheel></sp-color-wheel>\n `);\n\n await elementUpdated(el);\n\n const root = el.shadowRoot ? el.shadowRoot : el;\n expect(\n getComputedStyle(root.querySelector('.wheel') as HTMLElement)\n .transform\n ).to.equal('none');\n\n el.setAttribute('dir', 'rtl');\n\n await elementUpdated(el);\n expect(\n getComputedStyle(root.querySelector('.wheel') as HTMLElement)\n .transform\n ).to.equal('matrix(-1, 0, 0, 1, 0, 0)');\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,gBAAgB,QAAQ,SAAS,YAAY;AACtD;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAEP,OAAO;AAGP,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,WAAW;AAEpB,8BAA8B,QAAQ,KAAK;AAE3C,SAAS,cAAc,MAAM;AACzB;AAAA,IACI,YACI,MAAM,QAAoB;AAAA;AAAA,aAEzB;AAAA,EACT;AACA,KAAG,wCAAwC,YAAY;AACnD,UAAM,KAAK,MAAM,QAAoB;AAAA;AAAA,SAEpC;AAED,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AAED,KAAG,6BAA6B,YAAY;AACxC,UAAM,OAAO,MAAM,QAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAM1C;AACD,UAAM,KAAK,KAAK,cAAc,gBAAgB;AAC9C,UA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