Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(reactive-controllers): Migrate to Colorjs from Tinycolor #4713

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

blunteshwar
Copy link
Collaborator

@blunteshwar blunteshwar commented Sep 2, 2024

This PR marks the initial steps in our color library migration for Spectrum Web Components. As part of this effort, I have implemented an abstraction layer that includes the following key elements:

Color Types: Defined standardized types to ensure consistent handling of color data across components.
Transformation Functions: Created functions to handle color conversions and transformations, making it easier to work with various color formats.
This abstraction layer is designed to facilitate a smoother migration process and minimize the impact on our consumers. By isolating the color logic, we can easily adapt to future changes in the underlying color library.

Stay tuned for more details—there's much more to come! 🚀

Related issue(s)

#3950 ✅ (Solved)
#3883 ✅ (Solved)
#3655 ✅ (Solved)
#3071 ✅ (Solved)
#3058 ✅ (Solved)

Motivation and context

  • Did it pass in Desktop?
  • Did it pass in Mobile?
  • Did it pass in iPad?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (minor updates related to the tooling or maintenance of the repository, does not impact compiled assets)

Checklist

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • If my change required a change to the documentation, I have updated the documentation in this pull request.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices

Best practices

This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against main.

@blunteshwar blunteshwar marked this pull request as ready for review September 4, 2024 13:53
@blunteshwar blunteshwar requested a review from a team as a code owner September 4, 2024 13:53
Copy link

github-actions bot commented Sep 4, 2024

Branch preview

Review the following VRT differences

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

@coveralls
Copy link
Collaborator

coveralls commented Sep 4, 2024

Pull Request Test Coverage Report for Build 11897289030

Details

  • 598 of 600 (99.67%) changed or added relevant lines in 5 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.005%) to 98.2%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/color-area/src/ColorArea.ts 32 33 96.97%
tools/reactive-controllers/src/ColorController.ts 520 521 99.81%
Files with Coverage Reduction New Missed Lines %
packages/color-area/src/ColorArea.ts 1 95.41%
Totals Coverage Status
Change from base Build 11859867829: 0.005%
Covered Lines: 32488
Relevant Lines: 32907

💛 - Coveralls

Copy link

github-actions bot commented Sep 4, 2024

Tachometer results

Chrome

accordion permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 678 kB 89.42ms - 91.84ms - faster ✔
5% - 8%
4.59ms - 7.62ms
branch 654 kB 95.82ms - 97.66ms slower ❌
5% - 8%
4.59ms - 7.62ms
-

action-bar permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 739 kB 54.07ms - 55.06ms - faster ✔
3% - 5%
1.56ms - 2.89ms
branch 715 kB 56.34ms - 57.24ms slower ❌
3% - 5%
1.56ms - 2.89ms
-

action-group permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 836 kB 49.23ms - 51.13ms - faster ✔
6% - 11%
3.07ms - 5.84ms
branch 793 kB 53.62ms - 55.64ms slower ❌
6% - 12%
3.07ms - 5.84ms
-

action-menu permalink

test-basic

Version Bytes Avg Time vs remote vs branch
npm latest 959 kB 140.51ms - 143.42ms - faster ✔
4% - 7%
6.06ms - 10.32ms
branch 916 kB 148.60ms - 151.71ms slower ❌
4% - 7%
6.06ms - 10.32ms
-

test-directive permalink

Version Bytes Avg Time vs remote vs branch
npm latest 917 kB 69.40ms - 72.74ms - faster ✔
3% - 7%
1.95ms - 5.54ms
branch 874 kB 74.16ms - 75.47ms slower ❌
3% - 8%
1.95ms - 5.54ms
-

test-lazy permalink

Version Bytes Avg Time vs remote vs branch
npm latest 916 kB 68.70ms - 69.78ms - faster ✔
5% - 7%
3.70ms - 5.36ms
branch 873 kB 73.14ms - 74.40ms slower ❌
5% - 8%
3.70ms - 5.36ms
-

test-open-close-directive permalink

Version Bytes Avg Time vs remote vs branch
npm latest 1.09 MB 1874.35ms - 1877.15ms - unsure 🔍
-0% - +0%
-2.16ms - +1.99ms
branch 1.05 MB 1874.30ms - 1877.37ms unsure 🔍
-0% - +0%
-1.99ms - +2.16ms
-

test-open-close permalink

Version Bytes Avg Time vs remote vs branch
npm latest 1.09 MB 1880.07ms - 1882.76ms - unsure 🔍
-0% - +0%
-1.39ms - +2.52ms
branch 1.05 MB 1879.42ms - 1882.27ms unsure 🔍
-0% - +0%
-2.52ms - +1.39ms
-

breadcrumbs permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 979 kB 514.31ms - 520.25ms - faster ✔
2% - 4%
10.82ms - 18.67ms
branch 935 kB 529.47ms - 534.59ms slower ❌
2% - 4%
10.82ms - 18.67ms
-

coachmark permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 910 kB 91.37ms - 92.86ms - faster ✔
6% - 9%
5.68ms - 8.65ms
branch 864 kB 97.99ms - 100.57ms slower ❌
6% - 9%
5.68ms - 8.65ms
-

color-area permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 711 kB 126.65ms - 127.72ms - faster ✔
11% - 13%
15.94ms - 19.40ms
branch 798 kB 143.21ms - 146.50ms slower ❌
13% - 15%
15.94ms - 19.40ms
-

color-field permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 748 kB 46.08ms - 47.35ms - slower ❌
7% - 11%
2.86ms - 4.77ms
branch 839 kB 42.19ms - 43.62ms faster ✔
6% - 10%
2.86ms - 4.77ms
-

color-slider permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 713 kB 109.47ms - 110.79ms - faster ✔
8% - 9%
9.74ms - 11.44ms
branch 800 kB 120.17ms - 121.27ms slower ❌
9% - 10%
9.74ms - 11.44ms
-

color-wheel permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 714 kB 105.33ms - 107.44ms - faster ✔
8% - 10%
9.79ms - 12.12ms
branch 801 kB 116.85ms - 117.83ms slower ❌
9% - 11%
9.79ms - 12.12ms
-

combobox permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 1 MB 41.92ms - 42.39ms - faster ✔
2% - 3%
0.69ms - 1.35ms
branch 957 kB 42.94ms - 43.40ms slower ❌
2% - 3%
0.69ms - 1.35ms
-

light-dom-test permalink

Version Bytes Avg Time vs remote vs branch
npm latest 1 MB 396.17ms - 401.74ms - faster ✔
1% - 3%
3.93ms - 12.46ms
branch 957 kB 403.92ms - 410.39ms slower ❌
1% - 3%
3.93ms - 12.46ms
-

contextual-help permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 944 kB 53.19ms - 54.37ms - faster ✔
6% - 10%
3.37ms - 5.80ms
branch 898 kB 57.30ms - 59.43ms slower ❌
6% - 11%
3.37ms - 5.80ms
-

field-label permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 651 kB 22.53ms - 22.85ms - faster ✔
1% - 3%
0.34ms - 0.77ms
branch 627 kB 23.10ms - 23.39ms slower ❌
2% - 3%
0.34ms - 0.77ms
-

grid permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 716 kB 44.01ms - 44.68ms - slower ❌
1% - 3%
0.44ms - 1.30ms
branch 672 kB 43.21ms - 43.73ms faster ✔
1% - 3%
0.44ms - 1.30ms
-

menu permalink

test-basic

Version Bytes Avg Time vs remote vs branch
npm latest 741 kB 209.20ms - 213.87ms - faster ✔
1% - 3%
2.04ms - 7.17ms
branch 716 kB 215.08ms - 217.21ms slower ❌
1% - 3%
2.04ms - 7.17ms
-

meter permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 668 kB 49.63ms - 50.26ms - faster ✔
4% - 6%
2.19ms - 3.25ms
branch 643 kB 52.24ms - 53.10ms slower ❌
4% - 7%
2.19ms - 3.25ms
-

number-field permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 795 kB 73.68ms - 74.92ms - faster ✔
9% - 11%
7.59ms - 9.52ms
branch 770 kB 82.11ms - 83.59ms slower ❌
10% - 13%
7.59ms - 9.52ms
-

overlay permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 982 kB 429.81ms - 434.64ms - faster ✔
1% - 2%
2.23ms - 8.18ms
branch 939 kB 435.70ms - 439.16ms slower ❌
1% - 2%
2.23ms - 8.18ms
-

directive-test permalink

Version Bytes Avg Time vs remote vs branch
npm latest 1.06 MB 26.39ms - 26.98ms - faster ✔
5% - 8%
1.38ms - 2.17ms
branch 1.02 MB 28.20ms - 28.72ms slower ❌
5% - 8%
1.38ms - 2.17ms
-

element-test permalink

Version Bytes Avg Time vs remote vs branch
npm latest 1.05 MB 353.05ms - 356.76ms - faster ✔
2% - 4%
8.76ms - 13.78ms
branch 1.01 MB 364.48ms - 367.87ms slower ❌
2% - 4%
8.76ms - 13.78ms
-

lazy-test permalink

Version Bytes Avg Time vs remote vs branch
npm latest 851 kB 44.70ms - 45.58ms - faster ✔
6% - 10%
3.10ms - 4.93ms
branch 805 kB 48.35ms - 49.95ms slower ❌
7% - 11%
3.10ms - 4.93ms
-

picker permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 817 kB 505.36ms - 512.03ms - faster ✔
3% - 5%
18.25ms - 28.50ms
branch 774 kB 528.18ms - 535.96ms slower ❌
4% - 6%
18.25ms - 28.50ms
-

popover permalink

test-basic

Version Bytes Avg Time vs remote vs branch
npm latest 817 kB 107.36ms - 109.76ms - unsure 🔍
-2% - +0%
-2.72ms - +0.07ms
branch 774 kB 109.18ms - 110.60ms unsure 🔍
-0% - +3%
-0.07ms - +2.72ms
-

progress-bar permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 666 kB 29.80ms - 30.25ms - faster ✔
3% - 5%
0.89ms - 1.58ms
branch 642 kB 31.00ms - 31.52ms slower ❌
3% - 5%
0.89ms - 1.58ms
-

radio permalink

test-basic

Version Bytes Avg Time vs remote vs branch
npm latest 663 kB 38.12ms - 38.90ms - faster ✔
2% - 5%
0.98ms - 2.17ms
branch 639 kB 39.63ms - 40.54ms slower ❌
3% - 6%
0.98ms - 2.17ms
-

sidenav permalink

test-basic

Version Bytes Avg Time vs remote vs branch
npm latest 688 kB 153.52ms - 156.20ms - faster ✔
8% - 9%
12.86ms - 16.13ms
branch 663 kB 168.42ms - 170.30ms slower ❌
8% - 10%
12.86ms - 16.13ms
-

slider permalink

test-basic

Version Bytes Avg Time vs remote vs branch
npm latest 741 kB 78.04ms - 79.62ms - faster ✔
3% - 6%
2.79ms - 4.77ms
branch 717 kB 82.02ms - 83.20ms slower ❌
3% - 6%
2.79ms - 4.77ms
-

swatch permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 669 kB 15.51ms - 15.89ms - faster ✔
6% - 10%
1.04ms - 1.65ms
branch 645 kB 16.81ms - 17.29ms slower ❌
7% - 11%
1.04ms - 1.65ms
-

tabs permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 683 kB 113.95ms - 115.51ms - faster ✔
1% - 4%
0.72ms - 4.48ms
branch 658 kB 115.62ms - 119.04ms slower ❌
1% - 4%
0.72ms - 4.48ms
-

tags permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 712 kB 14.77ms - 14.94ms - unsure 🔍
-1% - +2%
-0.20ms - +0.24ms
branch 688 kB 14.64ms - 15.04ms unsure 🔍
-2% - +1%
-0.24ms - +0.20ms
-

tooltip permalink

test-basic

Version Bytes Avg Time vs remote vs branch
npm latest 874 kB 36.03ms - 36.58ms - faster ✔
3% - 5%
1.13ms - 1.97ms
branch 827 kB 37.53ms - 38.18ms slower ❌
3% - 5%
1.13ms - 1.97ms
-

test-directive permalink

Version Bytes Avg Time vs remote vs branch
npm latest 831 kB 25.42ms - 26.04ms - faster ✔
8% - 12%
2.33ms - 3.57ms
branch 788 kB 28.15ms - 29.21ms slower ❌
9% - 14%
2.33ms - 3.57ms
-

test-element permalink

Version Bytes Avg Time vs remote vs branch
npm latest 956 kB 53.46ms - 56.05ms - faster ✔
2% - 7%
1.40ms - 4.26ms
branch 910 kB 56.97ms - 58.19ms slower ❌
2% - 8%
1.40ms - 4.26ms
-

test-lazy permalink

Version Bytes Avg Time vs remote vs branch
npm latest 932 kB 44.13ms - 45.14ms - faster ✔
5% - 8%
2.58ms - 3.99ms
branch 886 kB 47.43ms - 48.41ms slower ❌
6% - 9%
2.58ms - 3.99ms
-

top-nav permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 689 kB 39.67ms - 40.83ms - faster ✔
4% - 9%
1.88ms - 3.85ms
branch 664 kB 42.31ms - 43.91ms slower ❌
5% - 10%
1.88ms - 3.85ms
-

tray permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 817 kB 102.46ms - 104.22ms - faster ✔
0% - 2%
0.18ms - 2.14ms
branch 774 kB 104.07ms - 104.92ms slower ❌
0% - 2%
0.18ms - 2.14ms
-

truncated permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 789 kB 62.47ms - 63.84ms - faster ✔
3% - 5%
1.68ms - 3.49ms
branch 761 kB 65.14ms - 66.33ms slower ❌
3% - 6%
1.68ms - 3.49ms
-
Firefox

accordion permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 678 kB 188.33ms - 194.99ms - faster ✔
5% - 9%
10.16ms - 18.88ms
branch 654 kB 203.37ms - 208.99ms slower ❌
5% - 10%
10.16ms - 18.88ms
-

action-bar permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 739 kB 119.57ms - 126.63ms - faster ✔
0% - 7%
0.36ms - 9.44ms
branch 715 kB 125.13ms - 130.87ms slower ❌
0% - 8%
0.36ms - 9.44ms
-

action-group permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 836 kB 117.95ms - 126.49ms - unsure 🔍
-7% - +2%
-9.19ms - +2.47ms
branch 793 kB 121.61ms - 129.55ms unsure 🔍
-2% - +8%
-2.47ms - +9.19ms
-

action-menu permalink

test-basic

Version Bytes Avg Time vs remote vs branch
npm latest 959 kB 283.74ms - 286.74ms - faster ✔
15% - 17%
50.20ms - 56.28ms
branch 916 kB 335.84ms - 341.12ms slower ❌
18% - 20%
50.20ms - 56.28ms
-

test-directive permalink

Version Bytes Avg Time vs remote vs branch
npm latest 917 kB 155.95ms - 159.45ms - slower ❌
7% - 9%
9.76ms - 13.72ms
branch 874 kB 145.03ms - 146.89ms faster ✔
6% - 9%
9.76ms - 13.72ms
-

test-lazy permalink

Version Bytes Avg Time vs remote vs branch
npm latest 916 kB 142.23ms - 146.45ms - unsure 🔍
-4% - +0%
-5.69ms - +0.17ms
branch 873 kB 145.07ms - 149.13ms unsure 🔍
-0% - +4%
-0.17ms - +5.69ms
-

test-open-close-directive permalink

Version Bytes Avg Time vs remote vs branch
npm latest 1.09 MB 1890.10ms - 1897.02ms - faster ✔
0% - 1%
7.05ms - 18.63ms
branch 1.05 MB 1901.76ms - 1911.04ms slower ❌
0% - 1%
7.05ms - 18.63ms
-

test-open-close permalink

Version Bytes Avg Time vs remote vs branch
npm latest 1.09 MB 1895.90ms - 1899.90ms - unsure 🔍
-0% - +0%
-4.88ms - +0.68ms
branch 1.05 MB 1898.07ms - 1901.93ms unsure 🔍
-0% - +0%
-0.68ms - +4.88ms
-

breadcrumbs permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 979 kB 827.89ms - 846.67ms - faster ✔
1% - 4%
10.29ms - 31.91ms
branch 935 kB 853.04ms - 863.72ms slower ❌
1% - 4%
10.29ms - 31.91ms
-

coachmark permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 910 kB 202.42ms - 209.46ms - faster ✔
2% - 6%
3.48ms - 13.44ms
branch 864 kB 210.88ms - 217.92ms slower ❌
2% - 7%
3.48ms - 13.44ms
-

color-area permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 711 kB 190.15ms - 198.37ms - faster ✔
8% - 13%
16.36ms - 27.60ms
branch 798 kB 212.42ms - 220.06ms slower ❌
8% - 14%
16.36ms - 27.60ms
-

color-field permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 756 kB 85.03ms - 89.73ms - slower ❌
5% - 18%
4.53ms - 13.39ms
branch 847 kB 74.66ms - 82.18ms faster ✔
5% - 15%
4.53ms - 13.39ms
-

color-slider permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 713 kB 169.50ms - 177.46ms - faster ✔
3% - 8%
4.63ms - 15.33ms
branch 800 kB 179.89ms - 187.03ms slower ❌
3% - 9%
4.63ms - 15.33ms
-

color-wheel permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 714 kB 162.15ms - 168.73ms - faster ✔
5% - 10%
8.70ms - 19.06ms
branch 801 kB 175.32ms - 183.32ms slower ❌
5% - 12%
8.70ms - 19.06ms
-

combobox permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 1 MB 73.34ms - 78.78ms - slower ❌
1% - 9%
0.64ms - 6.40ms
branch 957 kB 71.59ms - 73.49ms faster ✔
1% - 8%
0.64ms - 6.40ms
-

light-dom-test permalink

Version Bytes Avg Time vs remote vs branch
npm latest 1 MB 730.39ms - 742.93ms - slower ❌
1% - 6%
10.71ms - 39.05ms
branch 957 kB 699.07ms - 724.49ms faster ✔
1% - 5%
10.71ms - 39.05ms
-

contextual-help permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 944 kB 111.45ms - 118.55ms - faster ✔
2% - 10%
2.19ms - 12.73ms
branch 898 kB 118.56ms - 126.36ms slower ❌
2% - 11%
2.19ms - 12.73ms
-

field-label permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 651 kB 55.97ms - 60.67ms - unsure 🔍
-9% - +4%
-5.28ms - +2.32ms
branch 627 kB 56.81ms - 62.79ms unsure 🔍
-4% - +9%
-2.32ms - +5.28ms
-

grid permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 716 kB 92.97ms - 98.79ms - unsure 🔍
-2% - +6%
-2.19ms - +5.99ms
branch 672 kB 91.11ms - 96.85ms unsure 🔍
-6% - +2%
-5.99ms - +2.19ms
-

menu permalink

test-basic

Version Bytes Avg Time vs remote vs branch
npm latest 741 kB 396.07ms - 406.97ms - faster ✔
2% - 6%
6.00ms - 25.92ms
branch 716 kB 409.15ms - 425.81ms slower ❌
1% - 6%
6.00ms - 25.92ms
-

meter permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 668 kB 86.65ms - 93.03ms - unsure 🔍
-6% - +3%
-5.76ms - +2.76ms
branch 643 kB 88.51ms - 94.17ms unsure 🔍
-3% - +6%
-2.76ms - +5.76ms
-

number-field permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 795 kB 155.31ms - 163.21ms - faster ✔
6% - 12%
10.25ms - 22.19ms
branch 770 kB 171.01ms - 179.95ms slower ❌
6% - 14%
10.25ms - 22.19ms
-

overlay permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 1.06 MB 677.68ms - 697.52ms - slower ❌
6% - 10%
39.35ms - 60.73ms
branch 1.01 MB 633.58ms - 641.54ms faster ✔
6% - 9%
39.35ms - 60.73ms
-

directive-test permalink

Version Bytes Avg Time vs remote vs branch
npm latest 1.06 MB 53.07ms - 54.41ms - faster ✔
2% - 5%
0.92ms - 2.72ms
branch 1.02 MB 54.96ms - 56.16ms slower ❌
2% - 5%
0.92ms - 2.72ms
-

element-test permalink

Version Bytes Avg Time vs remote vs branch
npm latest 1.05 MB 688.24ms - 701.96ms - slower ❌
6% - 9%
42.09ms - 58.11ms
branch 1.01 MB 640.87ms - 649.13ms faster ✔
6% - 8%
42.09ms - 58.11ms
-

lazy-test permalink

Version Bytes Avg Time vs remote vs branch
npm latest 851 kB 94.53ms - 102.23ms - unsure 🔍
-7% - +1%
-7.33ms - +0.97ms
branch 805 kB 100.02ms - 103.10ms unsure 🔍
-1% - +8%
-0.97ms - +7.33ms
-

picker permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 817 kB 1024.81ms - 1034.55ms - faster ✔
5% - 8%
48.38ms - 83.86ms
branch 774 kB 1078.74ms - 1112.86ms slower ❌
5% - 8%
48.38ms - 83.86ms
-

popover permalink

test-basic

Version Bytes Avg Time vs remote vs branch
npm latest 817 kB 148.24ms - 157.52ms - unsure 🔍
-7% - +0%
-11.12ms - +0.48ms
branch 774 kB 154.72ms - 161.68ms unsure 🔍
-0% - +7%
-0.48ms - +11.12ms
-

progress-bar permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 666 kB 62.17ms - 66.95ms - unsure 🔍
-6% - +3%
-4.01ms - +1.89ms
branch 642 kB 63.89ms - 67.35ms unsure 🔍
-3% - +6%
-1.89ms - +4.01ms
-

radio permalink

test-basic

Version Bytes Avg Time vs remote vs branch
npm latest 663 kB 77.01ms - 82.71ms - unsure 🔍
-6% - +3%
-5.13ms - +2.69ms
branch 639 kB 78.40ms - 83.76ms unsure 🔍
-3% - +6%
-2.69ms - +5.13ms
-

sidenav permalink

test-basic

Version Bytes Avg Time vs remote vs branch
npm latest 688 kB 342.91ms - 355.49ms - faster ✔
5% - 9%
18.23ms - 34.33ms
branch 663 kB 370.46ms - 380.50ms slower ❌
5% - 10%
18.23ms - 34.33ms
-

slider permalink

test-basic

Version Bytes Avg Time vs remote vs branch
npm latest 741 kB 164.20ms - 173.68ms - unsure 🔍
-6% - +2%
-10.25ms - +2.69ms
branch 717 kB 168.32ms - 177.12ms unsure 🔍
-2% - +6%
-2.69ms - +10.25ms
-

swatch permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 669 kB 38.58ms - 42.98ms - unsure 🔍
-7% - +6%
-2.98ms - +2.50ms
branch 645 kB 39.39ms - 42.65ms unsure 🔍
-6% - +7%
-2.50ms - +2.98ms
-

tabs permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 683 kB 204.71ms - 214.53ms - unsure 🔍
-5% - +1%
-11.04ms - +2.64ms
branch 658 kB 209.06ms - 218.58ms unsure 🔍
-1% - +5%
-2.64ms - +11.04ms
-

tags permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 712 kB 32.83ms - 35.89ms - unsure 🔍
-1% - +12%
-0.40ms - +3.84ms
branch 688 kB 31.17ms - 34.11ms unsure 🔍
-11% - +1%
-3.84ms - +0.40ms
-

tooltip permalink

test-basic

Version Bytes Avg Time vs remote vs branch
npm latest 956 kB 88.69ms - 92.35ms - slower ❌
13% - 19%
10.12ms - 14.84ms
branch 910 kB 76.55ms - 79.53ms faster ✔
11% - 16%
10.12ms - 14.84ms
-

test-directive permalink

Version Bytes Avg Time vs remote vs branch
npm latest 831 kB 51.44ms - 54.20ms - unsure 🔍
-4% - +1%
-2.35ms - +0.55ms
branch 788 kB 53.28ms - 54.16ms unsure 🔍
-1% - +4%
-0.55ms - +2.35ms
-

test-element permalink

Version Bytes Avg Time vs remote vs branch
npm latest 956 kB 149.15ms - 154.45ms - slower ❌
11% - 17%
15.37ms - 21.95ms
branch 910 kB 131.18ms - 135.10ms faster ✔
10% - 14%
15.37ms - 21.95ms
-

test-lazy permalink

Version Bytes Avg Time vs remote vs branch
npm latest 932 kB 89.64ms - 91.68ms - faster ✔
31% - 36%
40.91ms - 49.97ms
branch 886 kB 131.69ms - 140.51ms slower ❌
45% - 55%
40.91ms - 49.97ms
-

top-nav permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 689 kB 101.50ms - 109.90ms - unsure 🔍
-9% - +2%
-9.49ms - +2.25ms
branch 664 kB 105.23ms - 113.41ms unsure 🔍
-2% - +9%
-2.25ms - +9.49ms
-

tray permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 817 kB 173.93ms - 182.07ms - unsure 🔍
-5% - +2%
-9.95ms - +3.19ms
branch 774 kB 176.23ms - 186.53ms unsure 🔍
-2% - +6%
-3.19ms - +9.95ms
-

truncated permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 789 kB 115.25ms - 122.63ms - unsure 🔍
-8% - +1%
-10.57ms - +1.77ms
branch 761 kB 118.40ms - 128.28ms unsure 🔍
-2% - +9%
-1.77ms - +10.57ms
-

Copy link

github-actions bot commented Sep 17, 2024

Lighthouse scores

Category Latest (report) Main (report) Branch (report)
Performance 0.99 0.98 0.98
Accessibility 1 1 1
Best Practices 1 1 1
SEO 1 0.92 0.92
PWA 1 1 1
What is this?

Lighthouse scores comparing the documentation site built from the PR ("Branch") to that of the production documentation site ("Latest") and the build currently on main ("Main"). Higher scores are better, but note that the SEO scores on Netlify URLs are artifically constrained to 0.92.

Transfer Size

Category Latest Main Branch
Total 250.632 kB 236.357 kB 🏆 236.816 kB
Scripts 60.657 kB 54.055 kB 🏆 54.413 kB
Stylesheet 54.066 kB 47.889 kB 🏆 47.936 kB
Document 6.239 kB 5.468 kB 🏆 5.494 kB
Font 126.814 kB 126.596 kB 🏆 126.623 kB

Request Count

Category Latest Main Branch
Total 52 52 52
Scripts 41 41 41
Stylesheet 5 5 5
Document 1 1 1
Font 2 2 2

@blunteshwar blunteshwar changed the title feat(reactive-controllers): added color orchestration layer feat(reactive-controllers): Migrate to Colorjs from Tinycolor Sep 30, 2024
@blunteshwar blunteshwar linked an issue Nov 12, 2024 that may be closed by this pull request
1 task
Copy link
Contributor

@Rajdeepc Rajdeepc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good progress! Added few comments. Please let me know if you have any questions!

@@ -113,48 +103,48 @@ export class ColorArea extends SpectrumElement {

@property({ type: Number })
public get x(): number {
return this._x;
return this.colorController.color.hsv.s / 100;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be simplified?

Copy link
Collaborator Author

@blunteshwar blunteshwar Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, this can't be more simplified because to to access the s coordinate value we have to access the color via colorController. After fetching this s coordinate value we divide it by 100 to convert it into decimal from percentage and then this converted s value our x coordinate for color-area.

this.inputX.valueAsNumber * 100
);
} else {
this.colorController.color.set('s', x * 100);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a lot of multiplier with 100. Is this something cannot be overriden out of the box?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we are multiplying x and y coordinates by 100 to convert coordinate values into saturation and value respectively. We are doing this 4 times in the code, Twice for x coordinate and twice for y coordinates.
Thus it can't be overriden out of the box.

@@ -164,7 +154,7 @@ export class ColorArea extends SpectrumElement {
@query('[name="y"]')
public inputY!: HTMLInputElement;

private altered = 0;
public altered = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be access outside of this class! Do we need it to be like this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!
Done!

@@ -145,10 +145,15 @@ describe('ColorArea', () => {
await sendKeys({
press: 'ArrowDown',
});
await sendKeys({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you need to repeat it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because of the fact that hsl color space can have multiple corresponding hsv values, for instance hsv(100°, 68%, 75%) and hsv(100°, 68%, 74%) both corresponds to hsl(100°, 52%, 49%). Thus before first await sendKeys({press: 'ArrowDown',}); the value of color in hsv is hsv(100°, 68%, 75%) and when we press ArrowDown once the value of s coordinate decreases from 75 to 74 and color becomes hsv(100°, 68%, 74%) but as stated above this color value also corresponds to hsl(100°, 52%, 49%). Therefore the solution is either to press ArrowDown again test this in hsv color space instead of hsl

el.y = 0.7;
await el.updateComplete;
expect(handle.color).to.equal('hsl(0, 100%, 35%)');
expect(handle.color).to.equal('hsl(0 100% 35%)');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add like this it should pass also! 'hsl(0, 100%, 35%)'

Copy link
Collaborator Author

@blunteshwar blunteshwar Nov 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, our color controller accepts colors in a flexible formats but it outputs them in a specific std. format, either in a CSS string (using color.js native toString() method which converts native color objects into css strings) or in object format.
Since sp-color-handle does not leverage any color library and merely requires a css color string to assign itself a color value, thus sp-color-area assigns a css color string to sp-color-handle by leveraging the toString() method of color.js which returns colors in space separated format.
For more info:https://colorjs.io/docs/output

@@ -799,7 +802,7 @@ describe('ColorArea', () => {
await elementUpdated(el);

let outputColor = el.color as { h: number; s: number; l: number };
const variance = 0.00005;
const variance = 0.004;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we need to change the variance value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Internally sp-color-area is managed by hsv color space where for a color area h: hue value is constant and s: saturation value varies along "x" axis and v: value varies across "y" axis of sp-color-area. Now when we initialise it's color value in hsl format (line 796), the colorController internally converts it to hsv which is very very less lossy but still lossy. Then on line 804 we are again fetching the color value in hsl format so the colotController again converts the internal color object (which is in hsv) to hsl. Thus these very very minor losses are still losses due to which we have to reduce the variance value. Earlier the tests were passing because sp-color-area was not properly implemented using hsv color space.
Now we either have to reduce the variance value(which was also done by westbrook in hus pr line 705) or we should test this in hsv color-space.

| HSL
| HSLA;
color: ColorTypes;
test?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is a test color Format?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are leveraging this test to test for a string color, for eg when color='red' we need some source of truth or quantifiable value to test for red. This quantifiable value is being stored inside test variable.(line 901 and 923)

? html`
<sp-color-handle
size="m"
color="${this.getColorValue()}"
color="${this.colorController
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a getter method for this!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getColor is already a getter method inside colorController.

if (!this.valid) {
return '';
}
return this.colorController.getColor('srgb').toString();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are you making sure that this.colorController.getColor('srgb') always returns something? Can it return undefined?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add an if else condition in getColor

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@@ -47,22 +61,22 @@ describe('ColorField', () => {
// Initial value
el.value = '#ff0000';
await elementUpdated(el);
expect(el.getColorValue()).to.equal('rgb(255, 0, 0)');
expect(el.getColorValue()).to.equal('rgb(100% 0% 0%)');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users can add rgb values comma separated. This test is skipping that check! Do you feel you accomodate that also here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is again due to the fact that color-field uses sp-color-handle which merely neeeds css color strings. These css color strings are provided by native toString() API from colorjs which provides color in string format (space separated instead of comma separated).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants