feat(color-loupe): migrate sp-color-loupe component to 2nd-gen#6147
feat(color-loupe): migrate sp-color-loupe component to 2nd-gen#6147blunteshwar wants to merge 9 commits intocolor-loupe-migrationfrom
Conversation
|
|
@blunteshwar Anything blocking this migration? |
📚 Branch Preview Links🔍 First Generation Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
5t3ph
left a comment
There was a problem hiding this comment.
Requesting changes because it looks like the implementation could be upgraded to match S2 Spectrum CSS as noted.
| class="swc-ColorLoupe-colorFill swc-ColorLoupe--clipped" | ||
| style="background: ${this.color}" | ||
| ></div> | ||
| <svg aria-hidden="true" class="swc-ColorLoupe-svg" overflow="visible"> |
There was a problem hiding this comment.
There are some rendering issues with this SVG - I wonder if you could copy in from the Spectrum CSS spectrum-two version instead?
The loupe-path is not positioned correctly in this current version. Removing the transform at least in browser caused a different issue. I hid the color and checkerboard for this screenshot to better see the issue.
| * OF ANY KIND, either express or implied. See the License for the specific language | ||
| * governing permissions and limitations under the License. | ||
| */ | ||
|
|
There was a problem hiding this comment.
As noted in the main file, consider updating the SVG implementation from the spectrum-two branch which also simplifies the CSS.
Description
Migrates the
color-loupecomponent from 1st-gen (sp-color-loupe) to 2nd-gen (swc-color-loupe) following the washing machine workflow. All 7 migration steps are complete and the status table has been updated.What changed
Core package (
2nd-gen/packages/core/components/color-loupe/)ColorLoupe.types.ts— minimal types file with the default color constantColorLoupe.base.ts— abstract base class extendingSpectrumElement; holds the two public properties (open,color)index.ts— re-exportsSWC package (
2nd-gen/packages/swc/components/color-loupe/)ColorLoupe.ts— concrete class withrender()andstylescolor-loupe.css— token-based CSS following the S2 migration guideindex.ts—defineElement('swc-color-loupe', ColorLoupe)registrationstories/color-loupe.stories.ts— Playground, Overview, Anatomy, States, ColorDisplay (behaviors), and Accessibility storiestest/color-loupe.test.ts— Storybook play-function tests (defaults,openreflection,colorproperty)test/color-loupe.a11y.spec.ts— Playwright attribute test assertingaria-hidden="true"on the SVG (replaced the unusable emptytoMatchAriaSnapshotwhich Playwright rejects even for legitimately empty trees)Migration docs (
CONTRIBUTOR-DOCS/03_project-planning/03_components/color-loupe/)rendering-and-styling-migration-analysis.md— full API surface, DOM structure, factor assessment, and gen-2 delta notes (moved from1st-gen/packages/color-loupe/MIGRATION_ANALYSIS.md)accessibility-migration-analysis.md— updatedmigration-checklist.md— all 7 steps marked completeStatus table
CONTRIBUTOR-DOCS/.../01_status.md— all 7 columns marked for Color LoupeNotable changes from 1st-gen
61.575ZZ→61.575Z)xlink:href="#path"→href="#loupe-path")xlink:hrefxlink:hrefto modernhrefthroughout the SVG@spectrum-web-components/opacity-checkerboardimport with an inlinerepeating-conic-gradientusing--swc-opacity-checkerboard-*tokens andlight-dark()for theme support--spectrum-drop-shadow-xto S2token("drop-shadow-elevated-*")--spectrum-color-loupe-*/--mod-colorloupe-*chains replaced withtoken()and--swc-color-loupe-*exposed overridesdiv.swc-ColorLoupe-colorFillwithbackground: ${this.color}instead of setting--spectrum-picked-coloron the SVG inline styleMotivation and context
sp-color-loupeis a dependency of the color picker family. Migrating it to 2nd-gen unblocks downstream component migrations (swc-color-field,swc-color-slider,swc-color-area) and ensures it consumes Spectrum 2 design tokens.Related issue(s)
Screenshots (if appropriate)
Visual verification via the
color-loupe--overviewStorybook story. No screenshot attached; teardrop shape, checkerboard, and color fill are visually unchanged from 1st-gen.Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
Loupe renders correctly in Storybook
sp-color-loupeOpen/close animation works
opencontrol in the Storybook controls panelColor fill updates correctly
colorcontrol to a color with alpha (e.g.,rgba(255, 0, 0, 0.5))Lint and unit tests pass
yarn lint:2nd-genyarn test:unit:2ndPlaywright a11y tests pass
yarn test:a11y:2ndcolor-loupe.a11y.spec.tstests to pass — they assertaria-hidden="true"on the SVG elementDevice review
Accessibility testing checklist
Required: Complete each applicable item and document your testing steps.
Keyboard (non-interactive component — no focusable parts)
tabindexScreen reader (visual-only component — SVG is
aria-hidden)swc-color-loupecustom element itself is not announced as an interactive control