@spectrum-web-components/color-wheel 0.3.0 → 0.3.3
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/custom-elements.json +6 -4
- package/package.json +6 -6
- package/src/ColorWheel.d.ts +2 -0
- package/src/ColorWheel.js +2 -0
- package/src/ColorWheel.js.map +1 -1
- package/src/color-wheel.css.js +8 -2
- package/src/color-wheel.css.js.map +1 -1
- package/src/spectrum-color-wheel.css.js +7 -1
- package/src/spectrum-color-wheel.css.js.map +1 -1
- package/test/color-wheel.test-vrt.js +0 -15
- package/test/color-wheel.test-vrt.js.map +0 -1
- package/test/color-wheel.test.js +0 -399
- package/test/color-wheel.test.js.map +0 -1
package/custom-elements.json
CHANGED
|
@@ -400,13 +400,15 @@
|
|
|
400
400
|
"name": "input",
|
|
401
401
|
"type": {
|
|
402
402
|
"text": "Event"
|
|
403
|
-
}
|
|
403
|
+
},
|
|
404
|
+
"description": "The value of the Color Wheel has changed."
|
|
404
405
|
},
|
|
405
406
|
{
|
|
406
407
|
"name": "change",
|
|
407
408
|
"type": {
|
|
408
409
|
"text": "Event"
|
|
409
|
-
}
|
|
410
|
+
},
|
|
411
|
+
"description": "An alteration to the value of the Color Wheel has been committed by the user."
|
|
410
412
|
}
|
|
411
413
|
],
|
|
412
414
|
"attributes": [
|
|
@@ -483,7 +485,7 @@
|
|
|
483
485
|
{
|
|
484
486
|
"kind": "variable",
|
|
485
487
|
"name": "styles",
|
|
486
|
-
"default": "css`\n:host{--spectrum-colorwheel-border-radius:100%;--spectrum-colorwheel-width:calc(var(--spectrum-global-dimension-size-125)*16);--spectrum-colorwheel-height:var(\n--spectrum-colorwheel-width,var(--spectrum-global-dimension-size-2400)\n)}:host([focused]) .handle{height:calc(var(\n--spectrum-colorhandle-size,\nvar(--spectrum-global-dimension-size-200)\n)*2);margin-left:calc(
|
|
488
|
+
"default": "css`\n:host{--spectrum-colorwheel-border-radius:100%;--spectrum-colorwheel-width:calc(var(--spectrum-global-dimension-size-125)*16);--spectrum-colorwheel-height:var(\n--spectrum-colorwheel-width,var(--spectrum-global-dimension-size-2400)\n)}:host([focused]) .handle{height:calc(var(\n--spectrum-colorhandle-size,\nvar(--spectrum-global-dimension-size-200)\n)*2);margin-left:calc(var(\n--spectrum-colorhandle-size,\nvar(--spectrum-global-dimension-size-200)\n)*-1);margin-top:calc(var(\n--spectrum-colorhandle-size,\nvar(--spectrum-global-dimension-size-200)\n)*-1);width:calc(var(\n--spectrum-colorhandle-size,\nvar(--spectrum-global-dimension-size-200)\n)*2)}.slider{height:100%;left:0;margin:0;opacity:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:0}:host{border-radius:var(--spectrum-colorwheel-border-radius);cursor:default;display:block;height:var(\n--spectrum-colorwheel-height,var(--spectrum-global-dimension-size-2400)\n);position:relative;-webkit-user-select:none;user-select:none;width:var(\n--spectrum-colorwheel-width,var(--spectrum-global-dimension-size-2400)\n)}:host([focused]){z-index:2}:host([disabled]){pointer-events:none}:host([dragged]){z-index:2}::slotted([slot=gradient]){border-radius:100%;border-style:solid;border-width:var(\n--spectrum-colorwheel-border-size,var(--spectrum-alias-border-size-thin)\n);box-sizing:border-box;height:var(\n--spectrum-colorwheel-height,var(--spectrum-global-dimension-size-2400)\n);position:relative;width:var(\n--spectrum-colorwheel-width,var(--spectrum-global-dimension-size-2400)\n);z-index:0}.wheel{position:relative;z-index:1}.innerCircle,.outerCircle{fill:transparent;stroke-width:var(\n--spectrum-colorwheel-border-size,var(--spectrum-alias-border-size-thin)\n)}.handle{left:50%;top:50%}:host{--spectrum-colorwheel-border-color:var(\n--spectrum-colorarea-border-color,var(--spectrum-alias-border-color-translucent)\n)}:host([disabled]) .innerCircle,:host([disabled]) .outerCircle{stroke:var(\n--spectrum-colorwheel-border-color-disabled,var(--spectrum-alias-track-color-disabled)\n)}:host([disabled]) .outerCircle{fill:var(\n--spectrum-colorwheel-fill-color-disabled,var(--spectrum-alias-track-color-disabled)\n)}:host([disabled]) .segment{display:none}::slotted([slot=gradient]){border-color:var(\n--spectrum-colorwheel-border-color,var(--spectrum-alias-border-color-translucent)\n)}.innerCircle,.outerCircle{stroke:var(\n--spectrum-colorwheel-border-color,var(--spectrum-alias-border-color-translucent)\n)}@media (forced-colors:active){:host{--spectrum-colorwheel-border-color-disabled:GrayText;--spectrum-colorwheel-fill-color-disabled:Canvas}:host{forced-color-adjust:none}}:host{touch-action:none}:host(:focus){outline:none}.wheel{background:conic-gradient(from 90deg,red,#ff8000,#ff0,#80ff00,#0f0,#00ff80,#0ff,#0080ff,#00f,#8000ff,#f0f,#ff0080,red);height:100%;width:100%}.wheel:after,.wheel:before{border:var(\n--spectrum-colorwheel-border-size,var(--spectrum-alias-border-size-thin)\n) solid var(--spectrum-colorwheel-border-color);border-radius:50%;content:\"\";position:absolute}.wheel:after{inset:0}.wheel:before{inset:24px}:host([disabled]) .wheel:after,:host([disabled]) .wheel:before{border-color:var(\n--spectrum-colorwheel-border-color-disabled,var(--spectrum-global-color-gray-300)\n)}:host([disabled]) .wheel{background:var(\n--spectrum-colorwheel-fill-color-disabled,var(--spectrum-global-color-gray-300)\n)}\n`"
|
|
487
489
|
}
|
|
488
490
|
],
|
|
489
491
|
"exports": [
|
|
@@ -519,7 +521,7 @@
|
|
|
519
521
|
{
|
|
520
522
|
"kind": "variable",
|
|
521
523
|
"name": "styles",
|
|
522
|
-
"default": "css`\n:host{--spectrum-colorwheel-border-radius:100%;--spectrum-colorwheel-width:calc(var(--spectrum-global-dimension-size-125)*16);--spectrum-colorwheel-height:var(\n--spectrum-colorwheel-width,var(--spectrum-global-dimension-size-2400)\n)}:host([focused]) .handle{height:calc(var(\n--spectrum-colorhandle-size,\nvar(--spectrum-global-dimension-size-200)\n)*2);margin-left:calc(
|
|
524
|
+
"default": "css`\n:host{--spectrum-colorwheel-border-radius:100%;--spectrum-colorwheel-width:calc(var(--spectrum-global-dimension-size-125)*16);--spectrum-colorwheel-height:var(\n--spectrum-colorwheel-width,var(--spectrum-global-dimension-size-2400)\n)}:host([focused]) .handle{height:calc(var(\n--spectrum-colorhandle-size,\nvar(--spectrum-global-dimension-size-200)\n)*2);margin-left:calc(var(\n--spectrum-colorhandle-size,\nvar(--spectrum-global-dimension-size-200)\n)*-1);margin-top:calc(var(\n--spectrum-colorhandle-size,\nvar(--spectrum-global-dimension-size-200)\n)*-1);width:calc(var(\n--spectrum-colorhandle-size,\nvar(--spectrum-global-dimension-size-200)\n)*2)}.slider{height:100%;left:0;margin:0;opacity:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:0}:host{border-radius:var(--spectrum-colorwheel-border-radius);cursor:default;display:block;height:var(\n--spectrum-colorwheel-height,var(--spectrum-global-dimension-size-2400)\n);position:relative;-webkit-user-select:none;user-select:none;width:var(\n--spectrum-colorwheel-width,var(--spectrum-global-dimension-size-2400)\n)}:host([focused]){z-index:2}:host([disabled]){pointer-events:none}:host([dragged]){z-index:2}::slotted([slot=gradient]){border-radius:100%;border-style:solid;border-width:var(\n--spectrum-colorwheel-border-size,var(--spectrum-alias-border-size-thin)\n);box-sizing:border-box;height:var(\n--spectrum-colorwheel-height,var(--spectrum-global-dimension-size-2400)\n);position:relative;width:var(\n--spectrum-colorwheel-width,var(--spectrum-global-dimension-size-2400)\n);z-index:0}.wheel{position:relative;z-index:1}.innerCircle,.outerCircle{fill:transparent;stroke-width:var(\n--spectrum-colorwheel-border-size,var(--spectrum-alias-border-size-thin)\n)}.handle{left:50%;top:50%}:host{--spectrum-colorwheel-border-color:var(\n--spectrum-colorarea-border-color,var(--spectrum-alias-border-color-translucent)\n)}:host([disabled]) .innerCircle,:host([disabled]) .outerCircle{stroke:var(\n--spectrum-colorwheel-border-color-disabled,var(--spectrum-alias-track-color-disabled)\n)}:host([disabled]) .outerCircle{fill:var(\n--spectrum-colorwheel-fill-color-disabled,var(--spectrum-alias-track-color-disabled)\n)}:host([disabled]) .segment{display:none}::slotted([slot=gradient]){border-color:var(\n--spectrum-colorwheel-border-color,var(--spectrum-alias-border-color-translucent)\n)}.innerCircle,.outerCircle{stroke:var(\n--spectrum-colorwheel-border-color,var(--spectrum-alias-border-color-translucent)\n)}@media (forced-colors:active){:host{--spectrum-colorwheel-border-color-disabled:GrayText;--spectrum-colorwheel-fill-color-disabled:Canvas}:host{forced-color-adjust:none}}\n`"
|
|
523
525
|
}
|
|
524
526
|
],
|
|
525
527
|
"exports": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/color-wheel",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -45,18 +45,18 @@
|
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@ctrl/tinycolor": "^3.3.3",
|
|
48
|
-
"@spectrum-web-components/base": "^0.5.
|
|
49
|
-
"@spectrum-web-components/color-handle": "^0.3.
|
|
50
|
-
"@spectrum-web-components/shared": "^0.13.
|
|
48
|
+
"@spectrum-web-components/base": "^0.5.1",
|
|
49
|
+
"@spectrum-web-components/color-handle": "^0.3.2",
|
|
50
|
+
"@spectrum-web-components/shared": "^0.13.3",
|
|
51
51
|
"tslib": "^2.0.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@spectrum-css/colorwheel": "^1.0.
|
|
54
|
+
"@spectrum-css/colorwheel": "^1.0.11"
|
|
55
55
|
},
|
|
56
56
|
"types": "./src/index.d.ts",
|
|
57
57
|
"customElements": "custom-elements.json",
|
|
58
58
|
"sideEffects": [
|
|
59
59
|
"./sp-*.js"
|
|
60
60
|
],
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "279380c6d72c0819fe224b405844af9ddcb87f8a"
|
|
62
62
|
}
|
package/src/ColorWheel.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { ColorValue } from '@spectrum-web-components/color-handle';
|
|
|
5
5
|
/**
|
|
6
6
|
* @element sp-color-wheel
|
|
7
7
|
* @slot gradient - a custom gradient visually outlining the available color values
|
|
8
|
+
* @fires input - The value of the Color Wheel has changed.
|
|
9
|
+
* @fires change - An alteration to the value of the Color Wheel has been committed by the user.
|
|
8
10
|
*/
|
|
9
11
|
export declare class ColorWheel extends Focusable {
|
|
10
12
|
static get styles(): CSSResultArray;
|
package/src/ColorWheel.js
CHANGED
|
@@ -22,6 +22,8 @@ import { TinyColor } from '@ctrl/tinycolor';
|
|
|
22
22
|
/**
|
|
23
23
|
* @element sp-color-wheel
|
|
24
24
|
* @slot gradient - a custom gradient visually outlining the available color values
|
|
25
|
+
* @fires input - The value of the Color Wheel has changed.
|
|
26
|
+
* @fires change - An alteration to the value of the Color Wheel has been committed by the user.
|
|
25
27
|
*/
|
|
26
28
|
export class ColorWheel extends Focusable {
|
|
27
29
|
constructor() {
|
package/src/ColorWheel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorWheel.js","sourceRoot":"","sources":["ColorWheel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EAEH,IAAI,GAGP,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iDAAiD,CAAC;AAC5E,OAAO,EACH,QAAQ,EACR,KAAK,GACR,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAE5F,OAAO,EAAE,SAAS,EAAE,MAAM,kDAAkD,CAAC;AAC7E,OAAO,0DAA0D,CAAC;AAClE,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,EAGH,6BAA6B,EAC7B,6BAA6B,GAChC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,SAAS;IAAzC;;QAMW,a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c,CAAC,CAAC,OAAiC,EAAE,EAAE;gBACnD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE;oBACzB,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC,WAAW,CAAC;iBAC/C;gBACD,IAAI,CAAC,aAAa,EAAE,CAAC;YACzB,CAAC,CAAC,CAAC;SACN;QACD,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAEM,oBAAoB;;QACvB,MAAA,IAAI,CAAC,QAAQ,0CAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QAC/B,KAAK,CAAC,oBAAoB,EAAE,CAAC;IACjC,CAAC;CACJ;AA/YG;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CACnB;AAGxB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CACpB;AAGvB;IADC,KAAK,CAAC,SAAS,CAAC;0CACY;AAG7B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCACN;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCACX;AAGhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAG1B;AAiBD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAiD1B;AA8DD;IADC,KAAK,CAAC,OAAO,CAAC;yCACiB","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 '@spectrum-web-components/color-handle/sp-color-handle.js';\nimport styles from './color-wheel.css.js';\nimport {\n ColorHandle,\n ColorValue,\n extractHueAndSaturationRegExp,\n replaceHueAndSaturationRegExp,\n} from '@spectrum-web-components/color-handle';\nimport { TinyColor } from '@ctrl/tinycolor';\n\n/**\n * @element sp-color-wheel\n * @slot gradient - a custom gradient visually outlining the available color values\n */\nexport class ColorWheel extends Focusable {\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n @property({ type: Boolean, reflect: true })\n public focused = false;\n\n @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 @property({ type: Number })\n public get value(): number {\n return this._value;\n }\n\n public set value(hue: number) {\n const value = Math.min(360, Math.max(0, hue));\n if (value === this.value) {\n return;\n }\n const oldValue = this.value;\n const { s, v } = this._color.toHsv();\n this._color = new TinyColor({ h: value, s, v });\n this._value = value;\n this.requestUpdate('value', oldValue);\n }\n\n private _value = 0;\n\n @property({ type: String })\n public get color(): ColorValue {\n switch (this._format.format) {\n case 'rgb':\n return this._format.isString\n ? this._color.toRgbString()\n : this._color.toRgb();\n case 'prgb':\n return this._format.isString\n ? this._color.toPercentageRgbString()\n : this._color.toPercentageRgb();\n case 'hex':\n case 'hex3':\n case 'hex4':\n case 'hex6':\n return this._format.isString\n ? this._color.toHexString()\n : this._color.toHex();\n case 'hex8':\n return this._format.isString\n ? this._color.toHex8String()\n : this._color.toHex8();\n case 'name':\n return this._color.toName() || this._color.toRgbString();\n case 'hsl':\n if (this._format.isString) {\n const hslString = this._color.toHslString();\n return hslString.replace(\n replaceHueAndSaturationRegExp,\n `$1${this.value}$2${this._saturation}`\n );\n } else {\n const { s, l, a } = this._color.toHsl();\n return { h: this.value, s, l, a };\n }\n case 'hsv':\n if (this._format.isString) {\n const hsvString = this._color.toHsvString();\n return hsvString.replace(\n replaceHueAndSaturationRegExp,\n `$1${this.value}$2${this._saturation}`\n );\n } else {\n const { s, v, a } = this._color.toHsv();\n return { h: this.value, s, v, a };\n }\n default:\n return 'No color format applied.';\n }\n }\n\n public set color(color: ColorValue) {\n if (color === this.color) {\n return;\n }\n const oldValue = this._color;\n this._color = new TinyColor(color);\n const format = this._color.format;\n let isString = typeof color === 'string' || color instanceof String;\n\n if (format.startsWith('hex')) {\n isString = (color as string).startsWith('#');\n }\n\n this._format = {\n format,\n isString,\n };\n\n if (isString && format.startsWith('hs')) {\n const values = extractHueAndSaturationRegExp.exec(color as string);\n\n if (values !== null) {\n const [, h, s] = values;\n this.value = Number(h);\n this._saturation = Number(s);\n }\n } else if (!isString && format.startsWith('hs')) {\n const colorInput = this._color.originalInput;\n const colorValues = Object.values(colorInput);\n this.value = colorValues[0];\n this._saturation = colorValues[1];\n } else {\n const { h } = this._color.toHsv();\n this.value = h;\n }\n this.requestUpdate('color', oldValue);\n }\n\n private _color = new TinyColor({ h: 0, s: 1, v: 1 });\n\n private _previousColor = new TinyColor({ h: 0, s: 1, v: 1 });\n\n private _saturation!: number;\n\n private _format: { format: string; isString: boolean } = {\n format: '',\n isString: false,\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 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._previousColor = this._color.clone();\n this._color = new TinyColor({ ...this._color.toHsl(), h: this.value });\n this.dispatchEvent(\n new Event('input', {\n bubbles: true,\n composed: true,\n })\n );\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n if (!applyDefault) {\n this._color = this._previousColor;\n }\n }\n\n private handleInput(event: Event & { target: HTMLInputElement }): void {\n const { valueAsNumber } = event.target;\n\n this.value = valueAsNumber;\n this._color = new TinyColor({ ...this._color.toHsl(), h: this.value });\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 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 handleFocusin(): void {\n this.focused = true;\n }\n\n private handleFocusout(): 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._previousColor = this._color.clone();\n this.boundingClientRect = this.getBoundingClientRect();\n (event.target as HTMLElement).setPointerCapture(event.pointerId);\n if (event.pointerType === 'mouse') {\n this.focused = true;\n }\n }\n\n private handlePointermove(event: PointerEvent): void {\n this.value = this.calculateHandlePosition(event);\n this._color = new TinyColor({ ...this._color.toHsl(), h: this.value });\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._color = this._previousColor;\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 + 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 this.handle.dispatchEvent(new PointerEvent('pointerdown', event));\n this.handlePointermove(event);\n }\n\n protected render(): TemplateResult {\n const { width: diameter = 160 } = this.boundingClientRect || {};\n\n const radius = diameter / 2;\n const trackWidth = 24;\n const innerRadius = radius - trackWidth;\n const innerDiameter = innerRadius * 2;\n const clipPath = `path(evenodd, \"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 handleLocationStyles = `transform: translate(${\n (radius - 12.5) * Math.cos((this.value * Math.PI) / 180)\n }px, ${(radius - 12.5) * Math.sin((this.value * Math.PI) / 180)}px);`;\n return html`\n <slot\n name=\"gradient\"\n @pointerdown=${this.handleGradientPointerdown}\n >\n <div class=\"wheel\" style=\"clip-path: ${clipPath}\"></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: [['pointerup', 'pointercancel'], this.handlePointerup],\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 @input=${this.handleInput}\n @change=${this.handleChange}\n @keydown=${this.handleKeydown}\n />\n `;\n }\n\n protected firstUpdated(changed: PropertyValues): void {\n super.firstUpdated(changed);\n this.boundingClientRect = this.getBoundingClientRect();\n this.addEventListener('focusin', this.handleFocusin);\n this.addEventListener('focusout', this.handleFocusout);\n }\n\n private observer?: WithSWCResizeObserver['ResizeObserver'];\n\n public 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 disconnectedCallback(): void {\n this.observer?.unobserve(this);\n super.disconnectedCallback();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ColorWheel.js","sourceRoot":"","sources":["ColorWheel.ts"],"names":[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,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCACN;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCACX;AAGhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAG1B;AAiBD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAiD1B;AA8DD;IADC,KAAK,CAAC,OAAO,CAAC;yCACiB","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 '@spectrum-web-components/color-handle/sp-color-handle.js';\nimport styles from './color-wheel.css.js';\nimport {\n ColorHandle,\n ColorValue,\n extractHueAndSaturationRegExp,\n replaceHueAndSaturationRegExp,\n} from '@spectrum-web-components/color-handle';\nimport { TinyColor } from '@ctrl/tinycolor';\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 get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n @property({ type: Boolean, reflect: true })\n public focused = false;\n\n @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 @property({ type: Number })\n public get value(): number {\n return this._value;\n }\n\n public set value(hue: number) {\n const value = Math.min(360, Math.max(0, hue));\n if (value === this.value) {\n return;\n }\n const oldValue = this.value;\n const { s, v } = this._color.toHsv();\n this._color = new TinyColor({ h: value, s, v });\n this._value = value;\n this.requestUpdate('value', oldValue);\n }\n\n private _value = 0;\n\n @property({ type: String })\n public get color(): ColorValue {\n switch (this._format.format) {\n case 'rgb':\n return this._format.isString\n ? this._color.toRgbString()\n : this._color.toRgb();\n case 'prgb':\n return this._format.isString\n ? this._color.toPercentageRgbString()\n : this._color.toPercentageRgb();\n case 'hex':\n case 'hex3':\n case 'hex4':\n case 'hex6':\n return this._format.isString\n ? this._color.toHexString()\n : this._color.toHex();\n case 'hex8':\n return this._format.isString\n ? this._color.toHex8String()\n : this._color.toHex8();\n case 'name':\n return this._color.toName() || this._color.toRgbString();\n case 'hsl':\n if (this._format.isString) {\n const hslString = this._color.toHslString();\n return hslString.replace(\n replaceHueAndSaturationRegExp,\n `$1${this.value}$2${this._saturation}`\n );\n } else {\n const { s, l, a } = this._color.toHsl();\n return { h: this.value, s, l, a };\n }\n case 'hsv':\n if (this._format.isString) {\n const hsvString = this._color.toHsvString();\n return hsvString.replace(\n replaceHueAndSaturationRegExp,\n `$1${this.value}$2${this._saturation}`\n );\n } else {\n const { s, v, a } = this._color.toHsv();\n return { h: this.value, s, v, a };\n }\n default:\n return 'No color format applied.';\n }\n }\n\n public set color(color: ColorValue) {\n if (color === this.color) {\n return;\n }\n const oldValue = this._color;\n this._color = new TinyColor(color);\n const format = this._color.format;\n let isString = typeof color === 'string' || color instanceof String;\n\n if (format.startsWith('hex')) {\n isString = (color as string).startsWith('#');\n }\n\n this._format = {\n format,\n isString,\n };\n\n if (isString && format.startsWith('hs')) {\n const values = extractHueAndSaturationRegExp.exec(color as string);\n\n if (values !== null) {\n const [, h, s] = values;\n this.value = Number(h);\n this._saturation = Number(s);\n }\n } else if (!isString && format.startsWith('hs')) {\n const colorInput = this._color.originalInput;\n const colorValues = Object.values(colorInput);\n this.value = colorValues[0];\n this._saturation = colorValues[1];\n } else {\n const { h } = this._color.toHsv();\n this.value = h;\n }\n this.requestUpdate('color', oldValue);\n }\n\n private _color = new TinyColor({ h: 0, s: 1, v: 1 });\n\n private _previousColor = new TinyColor({ h: 0, s: 1, v: 1 });\n\n private _saturation!: number;\n\n private _format: { format: string; isString: boolean } = {\n format: '',\n isString: false,\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 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._previousColor = this._color.clone();\n this._color = new TinyColor({ ...this._color.toHsl(), h: this.value });\n this.dispatchEvent(\n new Event('input', {\n bubbles: true,\n composed: true,\n })\n );\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n if (!applyDefault) {\n this._color = this._previousColor;\n }\n }\n\n private handleInput(event: Event & { target: HTMLInputElement }): void {\n const { valueAsNumber } = event.target;\n\n this.value = valueAsNumber;\n this._color = new TinyColor({ ...this._color.toHsl(), h: this.value });\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 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 handleFocusin(): void {\n this.focused = true;\n }\n\n private handleFocusout(): 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._previousColor = this._color.clone();\n this.boundingClientRect = this.getBoundingClientRect();\n (event.target as HTMLElement).setPointerCapture(event.pointerId);\n if (event.pointerType === 'mouse') {\n this.focused = true;\n }\n }\n\n private handlePointermove(event: PointerEvent): void {\n this.value = this.calculateHandlePosition(event);\n this._color = new TinyColor({ ...this._color.toHsl(), h: this.value });\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._color = this._previousColor;\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 + 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 this.handle.dispatchEvent(new PointerEvent('pointerdown', event));\n this.handlePointermove(event);\n }\n\n protected render(): TemplateResult {\n const { width: diameter = 160 } = this.boundingClientRect || {};\n\n const radius = diameter / 2;\n const trackWidth = 24;\n const innerRadius = radius - trackWidth;\n const innerDiameter = innerRadius * 2;\n const clipPath = `path(evenodd, \"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 handleLocationStyles = `transform: translate(${\n (radius - 12.5) * Math.cos((this.value * Math.PI) / 180)\n }px, ${(radius - 12.5) * Math.sin((this.value * Math.PI) / 180)}px);`;\n return html`\n <slot\n name=\"gradient\"\n @pointerdown=${this.handleGradientPointerdown}\n >\n <div class=\"wheel\" style=\"clip-path: ${clipPath}\"></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: [['pointerup', 'pointercancel'], this.handlePointerup],\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 @input=${this.handleInput}\n @change=${this.handleChange}\n @keydown=${this.handleKeydown}\n />\n `;\n }\n\n protected firstUpdated(changed: PropertyValues): void {\n super.firstUpdated(changed);\n this.boundingClientRect = this.getBoundingClientRect();\n this.addEventListener('focusin', this.handleFocusin);\n this.addEventListener('focusout', this.handleFocusout);\n }\n\n private observer?: WithSWCResizeObserver['ResizeObserver'];\n\n public 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 disconnectedCallback(): void {\n this.observer?.unobserve(this);\n super.disconnectedCallback();\n }\n}\n"]}
|
package/src/color-wheel.css.js
CHANGED
|
@@ -16,7 +16,13 @@ const styles = css `
|
|
|
16
16
|
)}:host([focused]) .handle{height:calc(var(
|
|
17
17
|
--spectrum-colorhandle-size,
|
|
18
18
|
var(--spectrum-global-dimension-size-200)
|
|
19
|
-
)*2);margin-left:calc(
|
|
19
|
+
)*2);margin-left:calc(var(
|
|
20
|
+
--spectrum-colorhandle-size,
|
|
21
|
+
var(--spectrum-global-dimension-size-200)
|
|
22
|
+
)*-1);margin-top:calc(var(
|
|
23
|
+
--spectrum-colorhandle-size,
|
|
24
|
+
var(--spectrum-global-dimension-size-200)
|
|
25
|
+
)*-1);width:calc(var(
|
|
20
26
|
--spectrum-colorhandle-size,
|
|
21
27
|
var(--spectrum-global-dimension-size-200)
|
|
22
28
|
)*2)}.slider{height:100%;left:0;margin:0;opacity:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:0}:host{border-radius:var(--spectrum-colorwheel-border-radius);cursor:default;display:block;height:var(
|
|
@@ -43,7 +49,7 @@ var(--spectrum-global-dimension-size-200)
|
|
|
43
49
|
--spectrum-colorwheel-border-color,var(--spectrum-alias-border-color-translucent)
|
|
44
50
|
)}@media (forced-colors:active){:host{--spectrum-colorwheel-border-color-disabled:GrayText;--spectrum-colorwheel-fill-color-disabled:Canvas}:host{forced-color-adjust:none}}:host{touch-action:none}:host(:focus){outline:none}.wheel{background:conic-gradient(from 90deg,red,#ff8000,#ff0,#80ff00,#0f0,#00ff80,#0ff,#0080ff,#00f,#8000ff,#f0f,#ff0080,red);height:100%;width:100%}.wheel:after,.wheel:before{border:var(
|
|
45
51
|
--spectrum-colorwheel-border-size,var(--spectrum-alias-border-size-thin)
|
|
46
|
-
) solid var(--spectrum-colorwheel-border-color);border-radius:50%;content:"";position:absolute}.wheel:after{
|
|
52
|
+
) solid var(--spectrum-colorwheel-border-color);border-radius:50%;content:"";position:absolute}.wheel:after{inset:0}.wheel:before{inset:24px}:host([disabled]) .wheel:after,:host([disabled]) .wheel:before{border-color:var(
|
|
47
53
|
--spectrum-colorwheel-border-color-disabled,var(--spectrum-global-color-gray-300)
|
|
48
54
|
)}:host([disabled]) .wheel{background:var(
|
|
49
55
|
--spectrum-colorwheel-fill-color-disabled,var(--spectrum-global-color-gray-300)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-wheel.css.js","sourceRoot":"","sources":["color-wheel.css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AACpD,MAAM,MAAM,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"color-wheel.css.js","sourceRoot":"","sources":["color-wheel.css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AACpD,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CjB,CAAC;AACF,eAAe,MAAM,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-colorwheel-border-radius:100%;--spectrum-colorwheel-width:calc(var(--spectrum-global-dimension-size-125)*16);--spectrum-colorwheel-height:var(\n--spectrum-colorwheel-width,var(--spectrum-global-dimension-size-2400)\n)}:host([focused]) .handle{height:calc(var(\n--spectrum-colorhandle-size,\nvar(--spectrum-global-dimension-size-200)\n)*2);margin-left:calc(var(\n--spectrum-colorhandle-size,\nvar(--spectrum-global-dimension-size-200)\n)*-1);margin-top:calc(var(\n--spectrum-colorhandle-size,\nvar(--spectrum-global-dimension-size-200)\n)*-1);width:calc(var(\n--spectrum-colorhandle-size,\nvar(--spectrum-global-dimension-size-200)\n)*2)}.slider{height:100%;left:0;margin:0;opacity:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:0}:host{border-radius:var(--spectrum-colorwheel-border-radius);cursor:default;display:block;height:var(\n--spectrum-colorwheel-height,var(--spectrum-global-dimension-size-2400)\n);position:relative;-webkit-user-select:none;user-select:none;width:var(\n--spectrum-colorwheel-width,var(--spectrum-global-dimension-size-2400)\n)}:host([focused]){z-index:2}:host([disabled]){pointer-events:none}:host([dragged]){z-index:2}::slotted([slot=gradient]){border-radius:100%;border-style:solid;border-width:var(\n--spectrum-colorwheel-border-size,var(--spectrum-alias-border-size-thin)\n);box-sizing:border-box;height:var(\n--spectrum-colorwheel-height,var(--spectrum-global-dimension-size-2400)\n);position:relative;width:var(\n--spectrum-colorwheel-width,var(--spectrum-global-dimension-size-2400)\n);z-index:0}.wheel{position:relative;z-index:1}.innerCircle,.outerCircle{fill:transparent;stroke-width:var(\n--spectrum-colorwheel-border-size,var(--spectrum-alias-border-size-thin)\n)}.handle{left:50%;top:50%}:host{--spectrum-colorwheel-border-color:var(\n--spectrum-colorarea-border-color,var(--spectrum-alias-border-color-translucent)\n)}:host([disabled]) .innerCircle,:host([disabled]) .outerCircle{stroke:var(\n--spectrum-colorwheel-border-color-disabled,var(--spectrum-alias-track-color-disabled)\n)}:host([disabled]) .outerCircle{fill:var(\n--spectrum-colorwheel-fill-color-disabled,var(--spectrum-alias-track-color-disabled)\n)}:host([disabled]) .segment{display:none}::slotted([slot=gradient]){border-color:var(\n--spectrum-colorwheel-border-color,var(--spectrum-alias-border-color-translucent)\n)}.innerCircle,.outerCircle{stroke:var(\n--spectrum-colorwheel-border-color,var(--spectrum-alias-border-color-translucent)\n)}@media (forced-colors:active){:host{--spectrum-colorwheel-border-color-disabled:GrayText;--spectrum-colorwheel-fill-color-disabled:Canvas}:host{forced-color-adjust:none}}:host{touch-action:none}:host(:focus){outline:none}.wheel{background:conic-gradient(from 90deg,red,#ff8000,#ff0,#80ff00,#0f0,#00ff80,#0ff,#0080ff,#00f,#8000ff,#f0f,#ff0080,red);height:100%;width:100%}.wheel:after,.wheel:before{border:var(\n--spectrum-colorwheel-border-size,var(--spectrum-alias-border-size-thin)\n) solid var(--spectrum-colorwheel-border-color);border-radius:50%;content:\"\";position:absolute}.wheel:after{inset:0}.wheel:before{inset:24px}:host([disabled]) .wheel:after,:host([disabled]) .wheel:before{border-color:var(\n--spectrum-colorwheel-border-color-disabled,var(--spectrum-global-color-gray-300)\n)}:host([disabled]) .wheel{background:var(\n--spectrum-colorwheel-fill-color-disabled,var(--spectrum-global-color-gray-300)\n)}\n`;\nexport default styles;"]}
|
|
@@ -16,7 +16,13 @@ const styles = css `
|
|
|
16
16
|
)}:host([focused]) .handle{height:calc(var(
|
|
17
17
|
--spectrum-colorhandle-size,
|
|
18
18
|
var(--spectrum-global-dimension-size-200)
|
|
19
|
-
)*2);margin-left:calc(
|
|
19
|
+
)*2);margin-left:calc(var(
|
|
20
|
+
--spectrum-colorhandle-size,
|
|
21
|
+
var(--spectrum-global-dimension-size-200)
|
|
22
|
+
)*-1);margin-top:calc(var(
|
|
23
|
+
--spectrum-colorhandle-size,
|
|
24
|
+
var(--spectrum-global-dimension-size-200)
|
|
25
|
+
)*-1);width:calc(var(
|
|
20
26
|
--spectrum-colorhandle-size,
|
|
21
27
|
var(--spectrum-global-dimension-size-200)
|
|
22
28
|
)*2)}.slider{height:100%;left:0;margin:0;opacity:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:0}:host{border-radius:var(--spectrum-colorwheel-border-radius);cursor:default;display:block;height:var(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spectrum-color-wheel.css.js","sourceRoot":"","sources":["spectrum-color-wheel.css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AACpD,MAAM,MAAM,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"spectrum-color-wheel.css.js","sourceRoot":"","sources":["spectrum-color-wheel.css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AACpD,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCjB,CAAC;AACF,eAAe,MAAM,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-colorwheel-border-radius:100%;--spectrum-colorwheel-width:calc(var(--spectrum-global-dimension-size-125)*16);--spectrum-colorwheel-height:var(\n--spectrum-colorwheel-width,var(--spectrum-global-dimension-size-2400)\n)}:host([focused]) .handle{height:calc(var(\n--spectrum-colorhandle-size,\nvar(--spectrum-global-dimension-size-200)\n)*2);margin-left:calc(var(\n--spectrum-colorhandle-size,\nvar(--spectrum-global-dimension-size-200)\n)*-1);margin-top:calc(var(\n--spectrum-colorhandle-size,\nvar(--spectrum-global-dimension-size-200)\n)*-1);width:calc(var(\n--spectrum-colorhandle-size,\nvar(--spectrum-global-dimension-size-200)\n)*2)}.slider{height:100%;left:0;margin:0;opacity:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:0}:host{border-radius:var(--spectrum-colorwheel-border-radius);cursor:default;display:block;height:var(\n--spectrum-colorwheel-height,var(--spectrum-global-dimension-size-2400)\n);position:relative;-webkit-user-select:none;user-select:none;width:var(\n--spectrum-colorwheel-width,var(--spectrum-global-dimension-size-2400)\n)}:host([focused]){z-index:2}:host([disabled]){pointer-events:none}:host([dragged]){z-index:2}::slotted([slot=gradient]){border-radius:100%;border-style:solid;border-width:var(\n--spectrum-colorwheel-border-size,var(--spectrum-alias-border-size-thin)\n);box-sizing:border-box;height:var(\n--spectrum-colorwheel-height,var(--spectrum-global-dimension-size-2400)\n);position:relative;width:var(\n--spectrum-colorwheel-width,var(--spectrum-global-dimension-size-2400)\n);z-index:0}.wheel{position:relative;z-index:1}.innerCircle,.outerCircle{fill:transparent;stroke-width:var(\n--spectrum-colorwheel-border-size,var(--spectrum-alias-border-size-thin)\n)}.handle{left:50%;top:50%}:host{--spectrum-colorwheel-border-color:var(\n--spectrum-colorarea-border-color,var(--spectrum-alias-border-color-translucent)\n)}:host([disabled]) .innerCircle,:host([disabled]) .outerCircle{stroke:var(\n--spectrum-colorwheel-border-color-disabled,var(--spectrum-alias-track-color-disabled)\n)}:host([disabled]) .outerCircle{fill:var(\n--spectrum-colorwheel-fill-color-disabled,var(--spectrum-alias-track-color-disabled)\n)}:host([disabled]) .segment{display:none}::slotted([slot=gradient]){border-color:var(\n--spectrum-colorwheel-border-color,var(--spectrum-alias-border-color-translucent)\n)}.innerCircle,.outerCircle{stroke:var(\n--spectrum-colorwheel-border-color,var(--spectrum-alias-border-color-translucent)\n)}@media (forced-colors:active){:host{--spectrum-colorwheel-border-color-disabled:GrayText;--spectrum-colorwheel-fill-color-disabled:Canvas}:host{forced-color-adjust:none}}\n`;\nexport default styles;"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import * as stories from '../stories/color-wheel.stories.js';
|
|
13
|
-
import { regressVisuals } from '../../../test/visual/test.js';
|
|
14
|
-
regressVisuals('ColorWheelStories', stories);
|
|
15
|
-
//# sourceMappingURL=color-wheel.test-vrt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"color-wheel.test-vrt.js","sourceRoot":"","sources":["color-wheel.test-vrt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,KAAK,OAAO,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,cAAc,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/color-wheel.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ColorWheelStories', stories);\n"]}
|
package/test/color-wheel.test.js
DELETED
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
|
|
13
|
-
import { arrowDownEvent, arrowDownKeyupEvent, arrowLeftEvent, arrowLeftKeyupEvent, arrowRightEvent, arrowRightKeyupEvent, arrowUpEvent, arrowUpKeyupEvent, } from '../../../test/testing-helpers.js';
|
|
14
|
-
import '../sp-color-wheel.js';
|
|
15
|
-
import { TinyColor } from '@ctrl/tinycolor';
|
|
16
|
-
import { sendKeys } from '@web/test-runner-commands';
|
|
17
|
-
import { spy } from 'sinon';
|
|
18
|
-
describe('ColorWheel', () => {
|
|
19
|
-
it('loads default color-wheel accessibly', async () => {
|
|
20
|
-
const el = await fixture(html `
|
|
21
|
-
<sp-color-wheel></sp-color-wheel>
|
|
22
|
-
`);
|
|
23
|
-
await elementUpdated(el);
|
|
24
|
-
await expect(el).to.be.accessible();
|
|
25
|
-
});
|
|
26
|
-
it('manages a single tab stop', async () => {
|
|
27
|
-
const test = await fixture(html `
|
|
28
|
-
<div>
|
|
29
|
-
<input type="text" id="test-input-1" />
|
|
30
|
-
<sp-color-wheel></sp-color-wheel>
|
|
31
|
-
<input type="text" id="test-input-2" />
|
|
32
|
-
</div>
|
|
33
|
-
`);
|
|
34
|
-
const el = test.querySelector('sp-color-wheel');
|
|
35
|
-
const input1 = test.querySelector('input:nth-of-type(1)');
|
|
36
|
-
const input2 = test.querySelector('input:nth-of-type(2)');
|
|
37
|
-
await elementUpdated(el);
|
|
38
|
-
input1.focus();
|
|
39
|
-
expect(document.activeElement).to.equal(input1);
|
|
40
|
-
await sendKeys({
|
|
41
|
-
press: 'Tab',
|
|
42
|
-
});
|
|
43
|
-
expect(document.activeElement).to.equal(el);
|
|
44
|
-
let value = el.value;
|
|
45
|
-
await sendKeys({
|
|
46
|
-
press: 'ArrowRight',
|
|
47
|
-
});
|
|
48
|
-
expect(el.value).to.not.equal(value);
|
|
49
|
-
await sendKeys({
|
|
50
|
-
press: 'Tab',
|
|
51
|
-
});
|
|
52
|
-
expect(document.activeElement).to.equal(input2);
|
|
53
|
-
await sendKeys({
|
|
54
|
-
press: 'Shift+Tab',
|
|
55
|
-
});
|
|
56
|
-
expect(document.activeElement).to.equal(el);
|
|
57
|
-
value = el.value;
|
|
58
|
-
await sendKeys({
|
|
59
|
-
press: 'ArrowDown',
|
|
60
|
-
});
|
|
61
|
-
expect(el.value).to.not.equal(value);
|
|
62
|
-
await sendKeys({
|
|
63
|
-
press: 'Shift+Tab',
|
|
64
|
-
});
|
|
65
|
-
expect(document.activeElement).to.equal(input1);
|
|
66
|
-
});
|
|
67
|
-
it('manages [focused]', async () => {
|
|
68
|
-
const el = await fixture(html `
|
|
69
|
-
<sp-color-wheel></sp-color-wheel>
|
|
70
|
-
`);
|
|
71
|
-
await elementUpdated(el);
|
|
72
|
-
el.dispatchEvent(new FocusEvent('focusin'));
|
|
73
|
-
await elementUpdated(el);
|
|
74
|
-
expect(el.focused).to.be.true;
|
|
75
|
-
el.dispatchEvent(new FocusEvent('focusout'));
|
|
76
|
-
await elementUpdated(el);
|
|
77
|
-
expect(el.focused).to.be.false;
|
|
78
|
-
});
|
|
79
|
-
it('dispatches input and change events in response to "Arrow*" keypresses', async () => {
|
|
80
|
-
const inputSpy = spy();
|
|
81
|
-
const changeSpy = spy();
|
|
82
|
-
const el = await fixture(html `
|
|
83
|
-
<sp-color-wheel
|
|
84
|
-
@change=${() => changeSpy()}
|
|
85
|
-
@input=${() => inputSpy()}
|
|
86
|
-
></sp-color-wheel>
|
|
87
|
-
`);
|
|
88
|
-
await elementUpdated(el);
|
|
89
|
-
el.focus();
|
|
90
|
-
await sendKeys({ press: 'ArrowRight' });
|
|
91
|
-
expect(inputSpy.callCount).to.equal(1);
|
|
92
|
-
expect(changeSpy.callCount).to.equal(1);
|
|
93
|
-
await sendKeys({ press: 'ArrowLeft' });
|
|
94
|
-
expect(inputSpy.callCount).to.equal(2);
|
|
95
|
-
expect(changeSpy.callCount).to.equal(2);
|
|
96
|
-
await sendKeys({ press: 'ArrowUp' });
|
|
97
|
-
expect(inputSpy.callCount).to.equal(3);
|
|
98
|
-
expect(changeSpy.callCount).to.equal(3);
|
|
99
|
-
await sendKeys({ press: 'ArrowDown' });
|
|
100
|
-
expect(inputSpy.callCount).to.equal(4);
|
|
101
|
-
expect(changeSpy.callCount).to.equal(4);
|
|
102
|
-
});
|
|
103
|
-
it('responds to events on the internal input element', async () => {
|
|
104
|
-
// screen reader interactions dispatch events as found in the following test
|
|
105
|
-
const inputSpy = spy();
|
|
106
|
-
const changeSpy = spy();
|
|
107
|
-
const el = await fixture(html `
|
|
108
|
-
<sp-color-wheel
|
|
109
|
-
@change=${() => changeSpy()}
|
|
110
|
-
@input=${() => inputSpy()}
|
|
111
|
-
></sp-color-wheel>
|
|
112
|
-
`);
|
|
113
|
-
await elementUpdated(el);
|
|
114
|
-
const input = el.focusElement;
|
|
115
|
-
el.focus();
|
|
116
|
-
input.dispatchEvent(new Event('input', {
|
|
117
|
-
bubbles: true,
|
|
118
|
-
composed: true,
|
|
119
|
-
}));
|
|
120
|
-
input.dispatchEvent(new Event('change', {
|
|
121
|
-
bubbles: true,
|
|
122
|
-
composed: false, // native change events do not compose themselves by default
|
|
123
|
-
}));
|
|
124
|
-
expect(inputSpy.callCount).to.equal(1);
|
|
125
|
-
expect(changeSpy.callCount).to.equal(1);
|
|
126
|
-
});
|
|
127
|
-
it('accepts "Arrow*" keypresses', async () => {
|
|
128
|
-
const el = await fixture(html `
|
|
129
|
-
<sp-color-wheel></sp-color-wheel>
|
|
130
|
-
`);
|
|
131
|
-
await elementUpdated(el);
|
|
132
|
-
expect(el.value).to.equal(0);
|
|
133
|
-
const input = el.focusElement;
|
|
134
|
-
input.dispatchEvent(arrowUpEvent);
|
|
135
|
-
input.dispatchEvent(arrowUpKeyupEvent);
|
|
136
|
-
input.dispatchEvent(arrowUpEvent);
|
|
137
|
-
input.dispatchEvent(arrowUpKeyupEvent);
|
|
138
|
-
await elementUpdated(el);
|
|
139
|
-
expect(el.value).to.equal(2);
|
|
140
|
-
input.dispatchEvent(arrowRightEvent);
|
|
141
|
-
input.dispatchEvent(arrowRightKeyupEvent);
|
|
142
|
-
input.dispatchEvent(arrowRightEvent);
|
|
143
|
-
input.dispatchEvent(arrowRightKeyupEvent);
|
|
144
|
-
await elementUpdated(el);
|
|
145
|
-
expect(el.value).to.equal(4);
|
|
146
|
-
input.dispatchEvent(arrowDownEvent);
|
|
147
|
-
input.dispatchEvent(arrowDownKeyupEvent);
|
|
148
|
-
input.dispatchEvent(arrowDownEvent);
|
|
149
|
-
input.dispatchEvent(arrowDownKeyupEvent);
|
|
150
|
-
await elementUpdated(el);
|
|
151
|
-
expect(el.value).to.equal(2);
|
|
152
|
-
input.dispatchEvent(arrowLeftEvent);
|
|
153
|
-
input.dispatchEvent(arrowLeftKeyupEvent);
|
|
154
|
-
input.dispatchEvent(arrowLeftEvent);
|
|
155
|
-
input.dispatchEvent(arrowLeftKeyupEvent);
|
|
156
|
-
await elementUpdated(el);
|
|
157
|
-
expect(el.value).to.equal(0);
|
|
158
|
-
});
|
|
159
|
-
it('accepts "Arrow*" keypresses in dir="rtl"', async () => {
|
|
160
|
-
const el = await fixture(html `
|
|
161
|
-
<sp-color-wheel dir="rtl"></sp-color-wheel>
|
|
162
|
-
`);
|
|
163
|
-
await elementUpdated(el);
|
|
164
|
-
expect(el.value).to.equal(0);
|
|
165
|
-
const input = el.focusElement;
|
|
166
|
-
input.dispatchEvent(arrowUpEvent);
|
|
167
|
-
input.dispatchEvent(arrowUpKeyupEvent);
|
|
168
|
-
input.dispatchEvent(arrowUpEvent);
|
|
169
|
-
input.dispatchEvent(arrowUpKeyupEvent);
|
|
170
|
-
await elementUpdated(el);
|
|
171
|
-
expect(el.value).to.equal(2);
|
|
172
|
-
input.dispatchEvent(arrowRightEvent);
|
|
173
|
-
input.dispatchEvent(arrowRightKeyupEvent);
|
|
174
|
-
input.dispatchEvent(arrowRightEvent);
|
|
175
|
-
input.dispatchEvent(arrowRightKeyupEvent);
|
|
176
|
-
await elementUpdated(el);
|
|
177
|
-
expect(el.value).to.equal(0);
|
|
178
|
-
input.dispatchEvent(arrowLeftEvent);
|
|
179
|
-
input.dispatchEvent(arrowLeftKeyupEvent);
|
|
180
|
-
input.dispatchEvent(arrowLeftEvent);
|
|
181
|
-
input.dispatchEvent(arrowLeftKeyupEvent);
|
|
182
|
-
await elementUpdated(el);
|
|
183
|
-
expect(el.value).to.equal(2);
|
|
184
|
-
input.dispatchEvent(arrowDownEvent);
|
|
185
|
-
input.dispatchEvent(arrowDownKeyupEvent);
|
|
186
|
-
input.dispatchEvent(arrowDownEvent);
|
|
187
|
-
input.dispatchEvent(arrowDownKeyupEvent);
|
|
188
|
-
await elementUpdated(el);
|
|
189
|
-
expect(el.value).to.equal(0);
|
|
190
|
-
});
|
|
191
|
-
it('accepts "Arrow*" keypresses with alteration', async () => {
|
|
192
|
-
const el = await fixture(html `
|
|
193
|
-
<sp-color-wheel></sp-color-wheel>
|
|
194
|
-
`);
|
|
195
|
-
await elementUpdated(el);
|
|
196
|
-
el.focus();
|
|
197
|
-
expect(el.value).to.equal(0);
|
|
198
|
-
await sendKeys({
|
|
199
|
-
down: 'Shift',
|
|
200
|
-
});
|
|
201
|
-
await sendKeys({
|
|
202
|
-
press: 'ArrowUp',
|
|
203
|
-
});
|
|
204
|
-
await sendKeys({
|
|
205
|
-
press: 'ArrowUp',
|
|
206
|
-
});
|
|
207
|
-
await elementUpdated(el);
|
|
208
|
-
expect(el.value).to.equal(20);
|
|
209
|
-
await sendKeys({
|
|
210
|
-
press: 'ArrowRight',
|
|
211
|
-
});
|
|
212
|
-
await sendKeys({
|
|
213
|
-
press: 'ArrowRight',
|
|
214
|
-
});
|
|
215
|
-
await elementUpdated(el);
|
|
216
|
-
expect(el.value).to.equal(40);
|
|
217
|
-
await sendKeys({
|
|
218
|
-
press: 'ArrowDown',
|
|
219
|
-
});
|
|
220
|
-
await sendKeys({
|
|
221
|
-
press: 'ArrowDown',
|
|
222
|
-
});
|
|
223
|
-
await elementUpdated(el);
|
|
224
|
-
expect(el.value).to.equal(20);
|
|
225
|
-
await sendKeys({
|
|
226
|
-
press: 'ArrowLeft',
|
|
227
|
-
});
|
|
228
|
-
await sendKeys({
|
|
229
|
-
press: 'ArrowLeft',
|
|
230
|
-
});
|
|
231
|
-
await sendKeys({
|
|
232
|
-
up: 'Shift',
|
|
233
|
-
});
|
|
234
|
-
await elementUpdated(el);
|
|
235
|
-
expect(el.value).to.equal(0);
|
|
236
|
-
});
|
|
237
|
-
it('accepts pointer events', async () => {
|
|
238
|
-
const color = new TinyColor({ h: '0', s: '20%', l: '70%' });
|
|
239
|
-
const el = await fixture(html `
|
|
240
|
-
<sp-color-wheel
|
|
241
|
-
.color=${color}
|
|
242
|
-
style="--spectrum-global-dimension-size-125: 10px;"
|
|
243
|
-
></sp-color-wheel>
|
|
244
|
-
`);
|
|
245
|
-
await elementUpdated(el);
|
|
246
|
-
const { handle } = el;
|
|
247
|
-
handle.setPointerCapture = () => {
|
|
248
|
-
return;
|
|
249
|
-
};
|
|
250
|
-
handle.releasePointerCapture = () => {
|
|
251
|
-
return;
|
|
252
|
-
};
|
|
253
|
-
expect(el.value).to.equal(0);
|
|
254
|
-
expect(el.color.s).to.be.within(0.19, 0.21);
|
|
255
|
-
expect(el.color.l).to.be.within(0.69, 0.71);
|
|
256
|
-
handle.dispatchEvent(new PointerEvent('pointerdown', {
|
|
257
|
-
button: 1,
|
|
258
|
-
pointerId: 1,
|
|
259
|
-
clientX: 80,
|
|
260
|
-
clientY: 15,
|
|
261
|
-
bubbles: true,
|
|
262
|
-
composed: true,
|
|
263
|
-
cancelable: true,
|
|
264
|
-
}));
|
|
265
|
-
await elementUpdated(el);
|
|
266
|
-
expect(el.value).to.equal(0);
|
|
267
|
-
expect(el.color.s).to.be.within(0.19, 0.21);
|
|
268
|
-
expect(el.color.l).to.be.within(0.69, 0.71);
|
|
269
|
-
const root = el.shadowRoot ? el.shadowRoot : el;
|
|
270
|
-
const gradient = root.querySelector('[name="gradient"]');
|
|
271
|
-
gradient.dispatchEvent(new PointerEvent('pointerdown', {
|
|
272
|
-
button: 1,
|
|
273
|
-
pointerId: 1,
|
|
274
|
-
clientX: 80,
|
|
275
|
-
clientY: 15,
|
|
276
|
-
bubbles: true,
|
|
277
|
-
composed: true,
|
|
278
|
-
cancelable: true,
|
|
279
|
-
}));
|
|
280
|
-
await elementUpdated(el);
|
|
281
|
-
expect(el.value).to.equal(0);
|
|
282
|
-
expect(el.color.s).to.be.within(0.19, 0.21);
|
|
283
|
-
expect(el.color.l).to.be.within(0.69, 0.71);
|
|
284
|
-
gradient.dispatchEvent(new PointerEvent('pointerdown', {
|
|
285
|
-
pointerId: 1,
|
|
286
|
-
clientX: 80,
|
|
287
|
-
clientY: 15,
|
|
288
|
-
bubbles: true,
|
|
289
|
-
composed: true,
|
|
290
|
-
cancelable: true,
|
|
291
|
-
}));
|
|
292
|
-
await elementUpdated(el);
|
|
293
|
-
expect(el.value).to.equal(263.74596725608353);
|
|
294
|
-
expect(el.color.s).to.be.within(0.19, 0.21);
|
|
295
|
-
expect(el.color.l).to.be.within(0.69, 0.71);
|
|
296
|
-
handle.dispatchEvent(new PointerEvent('pointermove', {
|
|
297
|
-
pointerId: 1,
|
|
298
|
-
clientX: 80,
|
|
299
|
-
clientY: 160,
|
|
300
|
-
bubbles: true,
|
|
301
|
-
composed: true,
|
|
302
|
-
cancelable: true,
|
|
303
|
-
}));
|
|
304
|
-
handle.dispatchEvent(new PointerEvent('pointerup', {
|
|
305
|
-
pointerId: 1,
|
|
306
|
-
clientX: 80,
|
|
307
|
-
clientY: 160,
|
|
308
|
-
bubbles: true,
|
|
309
|
-
composed: true,
|
|
310
|
-
cancelable: true,
|
|
311
|
-
}));
|
|
312
|
-
await elementUpdated(el);
|
|
313
|
-
expect(el.value).to.equal(96.34019174590992);
|
|
314
|
-
expect(el.color.s).to.be.within(0.19, 0.21);
|
|
315
|
-
expect(el.color.l).to.be.within(0.69, 0.71);
|
|
316
|
-
});
|
|
317
|
-
const colorFormats = [
|
|
318
|
-
//rgb
|
|
319
|
-
{ name: 'RGB String', color: 'rgb(204, 51, 204)' },
|
|
320
|
-
{ name: 'RGB', color: { r: 204, g: 51, b: 204, a: 1 } },
|
|
321
|
-
//prgb
|
|
322
|
-
{ name: 'PRGB String', color: 'rgb(80%, 20%, 80%)' },
|
|
323
|
-
{ name: 'PRGB', color: { r: '80%', g: '20%', b: '80%', a: 1 } },
|
|
324
|
-
// hex
|
|
325
|
-
{ name: 'Hex', color: 'cc33cc' },
|
|
326
|
-
{ name: 'Hex String', color: '#cc33cc' },
|
|
327
|
-
// hex8
|
|
328
|
-
{ name: 'Hex8', color: 'cc33ccff' },
|
|
329
|
-
{ name: 'Hex8 String', color: '#cc33ccff' },
|
|
330
|
-
// name
|
|
331
|
-
{ name: 'string', color: 'red' },
|
|
332
|
-
// hsl
|
|
333
|
-
{ name: 'HSL String', color: 'hsl(300, 60%, 50%)' },
|
|
334
|
-
{ name: 'HSL', color: { h: 300, s: 0.6000000000000001, l: 0.5, a: 1 } },
|
|
335
|
-
// hsv
|
|
336
|
-
{ name: 'HSV String', color: 'hsv(300, 75%, 100%)' },
|
|
337
|
-
{ name: 'HSV', color: { h: 300, s: 0.75, v: 1, a: 1 } },
|
|
338
|
-
];
|
|
339
|
-
colorFormats.map((format) => {
|
|
340
|
-
it(`maintains \`color\` format as ${format.name}`, async () => {
|
|
341
|
-
const el = await fixture(html `
|
|
342
|
-
<sp-color-wheel></sp-color-wheel>
|
|
343
|
-
`);
|
|
344
|
-
el.color = format.color;
|
|
345
|
-
if (format.name.startsWith('Hex')) {
|
|
346
|
-
expect(el.color).to.equal(format.color);
|
|
347
|
-
}
|
|
348
|
-
else
|
|
349
|
-
expect(el.color).to.deep.equal(format.color);
|
|
350
|
-
});
|
|
351
|
-
});
|
|
352
|
-
it(`maintains \`color\` format as TinyColor`, async () => {
|
|
353
|
-
const el = await fixture(html `
|
|
354
|
-
<sp-color-wheel></sp-color-wheel>
|
|
355
|
-
`);
|
|
356
|
-
const color = new TinyColor('rgb(204, 51, 204)');
|
|
357
|
-
el.color = color;
|
|
358
|
-
expect(color.equals(el.color));
|
|
359
|
-
});
|
|
360
|
-
it(`maintains hue value`, async () => {
|
|
361
|
-
const el = await fixture(html `
|
|
362
|
-
<sp-color-wheel></sp-color-wheel>
|
|
363
|
-
`);
|
|
364
|
-
const hue = 300;
|
|
365
|
-
const hsl = `hsl(${hue}, 60%, 100%)`;
|
|
366
|
-
el.color = hsl;
|
|
367
|
-
expect(el.value).to.equal(hue);
|
|
368
|
-
expect(el.color).to.equal(hsl);
|
|
369
|
-
const hsla = `hsla(${hue}, 60%, 100%, 0.9)`;
|
|
370
|
-
el.color = hsla;
|
|
371
|
-
expect(el.value).to.equal(hue);
|
|
372
|
-
expect(el.color).to.equal(hsla);
|
|
373
|
-
const hsv = `hsv(${hue}, 60%, 100%)`;
|
|
374
|
-
el.color = hsv;
|
|
375
|
-
expect(el.value).to.equal(hue);
|
|
376
|
-
expect(el.color).to.equal(hsv);
|
|
377
|
-
const hsva = `hsva(${hue}, 60%, 100%, 0.9)`;
|
|
378
|
-
el.color = hsva;
|
|
379
|
-
expect(el.value).to.equal(hue);
|
|
380
|
-
expect(el.color).to.equal(hsva);
|
|
381
|
-
const tinyHSV = new TinyColor({ h: hue, s: 60, v: 100 });
|
|
382
|
-
el.color = tinyHSV;
|
|
383
|
-
expect(el.value).to.equal(hue);
|
|
384
|
-
expect(tinyHSV.equals(el.color)).to.be.true;
|
|
385
|
-
const tinyHSVA = new TinyColor({ h: hue, s: 60, v: 100, a: 1 });
|
|
386
|
-
el.color = tinyHSVA;
|
|
387
|
-
expect(el.value).to.equal(hue);
|
|
388
|
-
expect(tinyHSVA.equals(el.color)).to.be.true;
|
|
389
|
-
const tinyHSL = new TinyColor({ h: hue, s: 60, l: 100 });
|
|
390
|
-
el.color = tinyHSL;
|
|
391
|
-
expect(el.value).to.equal(hue);
|
|
392
|
-
expect(tinyHSL.equals(el.color)).to.be.true;
|
|
393
|
-
const tinyHSLA = new TinyColor({ h: hue, s: 60, l: 100, a: 1 });
|
|
394
|
-
el.color = tinyHSLA;
|
|
395
|
-
expect(el.value).to.equal(hue);
|
|
396
|
-
expect(tinyHSLA.equals(el.color)).to.be.true;
|
|
397
|
-
});
|
|
398
|
-
});
|
|
399
|
-
//# sourceMappingURL=color-wheel.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"color-wheel.test.js","sourceRoot":"","sources":["color-wheel.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,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CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAChE,EAAE,CAAC,KAAK,GAAG,QAAQ,CAAC;QACpB,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IACjD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { 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} from '../../../test/testing-helpers.js';\n\nimport '../sp-color-wheel.js';\nimport { ColorWheel } from '../';\nimport { HSL, HSLA, HSV, HSVA, RGB, RGBA, TinyColor } from '@ctrl/tinycolor';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { spy } from 'sinon';\n\ndescribe('ColorWheel', () => {\n it('loads default color-wheel accessibly', async () => {\n const el = await fixture<ColorWheel>(\n html`\n <sp-color-wheel></sp-color-wheel>\n `\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>(\n 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 );\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>(\n html`\n <sp-color-wheel></sp-color-wheel>\n `\n );\n\n await elementUpdated(el);\n\n el.dispatchEvent(new FocusEvent('focusin'));\n await elementUpdated(el);\n\n expect(el.focused).to.be.true;\n\n el.dispatchEvent(new FocusEvent('focusout'));\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>(\n html`\n <sp-color-wheel\n @change=${() => changeSpy()}\n @input=${() => inputSpy()}\n ></sp-color-wheel>\n `\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>(\n html`\n <sp-color-wheel\n @change=${() => changeSpy()}\n @input=${() => inputSpy()}\n ></sp-color-wheel>\n `\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>(\n html`\n <sp-color-wheel></sp-color-wheel>\n `\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>(\n html`\n <sp-color-wheel dir=\"rtl\"></sp-color-wheel>\n `\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>(\n html`\n <sp-color-wheel></sp-color-wheel>\n `\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>(\n html`\n <sp-color-wheel\n .color=${color}\n style=\"--spectrum-global-dimension-size-125: 10px;\"\n ></sp-color-wheel>\n `\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 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>(\n html`\n <sp-color-wheel></sp-color-wheel>\n `\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>(\n html`\n <sp-color-wheel></sp-color-wheel>\n `\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>(\n html`\n <sp-color-wheel></sp-color-wheel>\n `\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});\n"]}
|