feat(icon): S2 public workflow icons — @adobe/spectrum-wc-icons package + generator - #6562
feat(icon): S2 public workflow icons — @adobe/spectrum-wc-icons package + generator#6562caseyisonit wants to merge 13 commits into
Conversation
🦋 Changeset detectedLatest commit: 62dbc10 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📚 Branch Preview Links🔍 Gen1 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 |
Coverage Report for CI Build 30507697911Coverage increased (+0.002%) to 96.241%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
cdransf
left a comment
There was a problem hiding this comment.
Looks rad! Just a couple of small things. ✨
9a3ebad to
5f8086c
Compare
6d3bac6 to
c9c0a27
Compare
149b4ab to
dd616fc
Compare
Split toKebab on acronym and camel boundaries so digit-led A4U names read cleanly (3DAsset -> 3d-asset -> <swc-icon-3d-asset>). Output is unchanged for every existing UI icon name, verified over the full workflow set.
…ention Add generate-workflow-icons.mjs, which reuses the shared icon-source/utils cleanup and parses the S2_Icon_<Name>_20_N.svg workflow convention (one drawing per icon, no optical step). It emits, per icon, an Icon_<Name>() SVG-string function and an <swc-icon-<kebab>> element into the icons package, plus index, elements, and manifest barrels. Documents the convention in the icon-source READMEs and records the pulled workflow set version in icon-source.json. SWC-2442
…flow art Ship the public workflow icons as a dedicated package depending only on core: per-icon SVG-string functions and IconBase-extending custom elements, with per-icon subpath exports for tree-shaking and a generated custom-elements manifest. Includes a package-local workflow-scale icon-base.css (core has no CSS processing) and a tree-shaking verification script. Registers the package in the 2nd-gen build and TypeScript project references. SWC-2441
Add the public workflow-icons Storybook gallery (stories + MDX docs page) and full test coverage: unit and accessibility play functions, a Playwright ARIA a11y spec, and VRT stories (size/color permutations, the full-set gallery snapshot, and forced colors). Wires the icons stories into swc's Storybook and Vitest, adds the swc devDependency and generate:workflow-icons script, and extends the Playwright a11y testMatch to the icons package. SWC-2441
Record the Icon_<Name> function-naming decision in the icon strategy RFC (kept distinct from the element class, valid identifiers for digit-led names) and mark phases 0-4 implemented. Add the changeset announcing @adobe/spectrum-wc-icons.
The stories' `import '../src/elements.js'` side-effect was tree-shaken out of production (Storybook/Chromatic) builds because the package sideEffects globs matched only .js, while the source-consumed build resolves them to .ts source. The custom elements then never registered and rendered as empty, unupgraded tags. Match the .ts source (and barrel) so registration is preserved. SWC-2441
Assert exactly one image named "Warning" and that the decorative icon is aria-hidden, instead of counting every img role. Chromium can expose the inner shadow <svg> as an implicit img, so an unscoped count is brittle.
verify-tree-shaking.mjs imports esbuild directly; it was only resolving via Vite's transitive copy. Declare it explicitly so the script does not depend on hoisting. SWC-2441
Mark the generated per-icon workflow modules as linguist-generated so the ~826 files collapse in PR diffs and are excluded from language stats. GitHub-only; local git diff/blame are unaffected.
The filter now matches only 1st-gen/**, so root-level and shared changes no longer trigger the 1st-gen coverage report; update the comment to match.
dd616fc to
62dbc10
Compare
Description
Delivers RFC phases 3 and 4 of the 2nd-gen icon strategy: the public workflow icons and a dedicated package to ship them.
@adobe/spectrum-wc-icons(2nd-gen/packages/icons/) — a sibling of core/swc that depends only on@adobe/spectrum-wc-core. Each of the 413 workflow icons ships two ways, neither coupling a consumer to Lit:<swc-icon-star>) extendingIconBase, andIcon_Star()) as the tree-shakeable substrate (usable viainnerHTML, ReactdangerouslySetInnerHTML, Vuev-html, or LitunsafeSVG).swc/scripts/generate-workflow-icons.mjs) reuses the Phase 0 sharedicon-source/utils/cleanup (no duplicated SVGO/fill logic) and parses the confirmedS2_Icon_<Name>_20_N.svgconvention (one drawing per icon, no optical step). It emits the functions, elements, andindex/elements/manifestbarrels into the package.Icon_<Name>(), element classIcon<Name>, tagswc-icon-<kebab>. The sharedtoKebabwas improved so digit-led names read cleanly (3DAsset→<swc-icon-3d-asset>); output is unchanged for every existing UI-icon name. TheIcon_prefix keeps functions as valid identifiers for digit-led names and distinct from the element class.scripts/verify-tree-shaking.mjs). Per-icon subpath exports (@adobe/spectrum-wc-icons/swc-icon-star.js,@adobe/spectrum-wc-icons/Star.js), a register-allelements.js, and amanifest.js(name + tag list) for galleries/pickers.swcdevDependson the package for stories.Motivation and context
Workflow icons are public and framework-agnostic, so they ship in their own package that consumers can adopt without taking SWC or Lit. This completes the icon pipeline started by the Phase 0 UI-icon POC (#6552): UI icons stay internal to components; workflow icons become the public, tree-shakeable art.
Related issue(s)
@adobe/spectrum-wc-iconspackaging & tree-shaking)Screenshots (if appropriate)
The Storybook gallery (Icons → Workflow icons) renders the full set with size/color/accessibility examples.
Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
Workflow icon renders as an element in plain HTML
swc-icon-<kebab>tagsizeTree-shaking ships only imported icons
2nd-gen/packages/icons, runyarn buildyarn verify:tree-shakingFunction substrate works without Lit
Icon_Starfrom@adobe/spectrum-wc-icons/Star.jselement.innerHTML = Icon_Star()<svg>markup filled viavar(--swc-icon-color, currentColor)Device review
Accessibility testing checklist
Keyboard (required — document steps below)
Screen reader (required — document steps below)
accessible-label="Warning") and the decorative icon (no label)