Repository navigation
fix(gen2): stop bundling icons, keep DEBUG: false, and fix docs links - #6910
Conversation
…dling them The swc library build resolved `@adobe/spectrum-wc-icons` to the icons source and did not mark it external, so `dist/icons/src/` shipped a second copy of `swc-icon-alert-triangle` (used by text-field) and the chevron icons (used by prompt-field). A page that also loaded the icon from `@adobe/spectrum-wc-icons` defined `swc-icon-alert-triangle` twice and threw. Mark the icons package external, like core, and make it a runtime dependency of `@adobe/spectrum-wc`.
…docs Dev mode overwrote `window.__swc.DEBUG` with `true`, so the documented way to turn it off (set `DEBUG: false` before the first component loads) did not work. Keep a `DEBUG` value the page set, and skip the dev mode notice when it is off. The setup moves into `installDevMode()` so a test can run it as a first load would. Dev mode warnings also linked to the wrong or a missing docs page: - Shared code hard-coded one component's page: the linear progress mixin sent progress-bar warnings to the meter docs, and the pending mixin and button base sent action, close, and infield button warnings to the button docs. They now derive the page from the element's tag name. - action-group, prompt-field, the dev mode notice, and the redefinition warning used 1st-gen style URLs that return 404, and dropzone and status-light used page ids that do not exist. The debug validation style guide taught the 404 URL format; update it.
… stories file The docs header built the "View source on GitHub" link and the getting started snippets from the last segment of the sidebar title. Titles do not match folders, tags, or class names everywhere, so controller, mixin, and pattern pages linked to folders that do not exist, and pages such as "Drop zone", "UI icons", and the focus group navigation controller showed imports that fail. Derive the source folder from `parameters.fileName`, the tag from `meta.component`, and the core entry (`controllers` or `mixins`) from where the stories file lives. Pages that document no single element show no snippet. The pattern stories' `packagePath` overrides are no longer needed.
The Gen1 agent skill is published from spectrum-web-components.adobe.com like the other skills, so its `website` now points there too. The Build with AI page said gen2 had no `llms.txt`; the gen2 site now serves one (and `llms-full.txt`), so link to it.
|
📚 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 |
…odebase # Conflicts: # gen2/packages/swc/package.json # yarn.lock
Description
Four fixes from a structural audit of
gen2/, plus two gen2 docs links.@adobe/spectrum-wcno longer bundles workflow icons. The swc library build aliased@adobe/spectrum-wc-iconsto its source but didn't mark it external, sodist/icons/src/shipped a second copy ofswc-icon-alert-triangle(used by<swc-text-field>) and the chevron icons (used by<swc-prompt-field>). The build now treats the icons package like core: it's external, and it's a runtime dependency (2.0.0-beta.6, same linked version as core).DEBUG: falseset before load is kept. The dev mode setup incore/element/spectrum-element.tsoverwrotewindow.__swc.DEBUGwithtrue. It now keeps a value the page set before the first component loaded, and it skips the "in dev mode" notice whenDEBUGis off. The setup moved into an@internalinstallDevMode()function, which the sameNODE_ENVcheck calls, so a test can run it like a first load.componentDocsHref(this.localName). Action group, prompt field, drop zone, status light, the dev mode notice, and the duplicate element warning linked to pages that return 404 or don't exist; they now link to existing pages on spectrum-web-components.adobe.com. The debug validation style guide taught the 404 URL format, so it's updated, and the dev mode guide now explains the duplicate element warning that links to it.parameters.fileName, the tag frommeta.component, and the core entry (controllersormixins) from where the stories file lives. Pages that don't document a single element show no snippet. The 12packagePathoverrides in the AI Toolkit stories aren't needed anymore.websitenow points to spectrum-web-components.adobe.com, like the other two skills published there, and the Build with AI page links to the gen2llms.txt(it said there wasn't one yet). Links that describe Gen1 itself still point to the Gen1 site, because that content isn't on the gen2 site: the Gen1 Storybook ref in.storybook/main.ts(spectrum-web-components.adobe.com/storybook/returns 404), the Gen1 column of the docs site row in "Gen1 vs Gen2", and the "Gen1 documentation site" link on the Build with AI page.Validation
yarn type-check:gen2: passed, 0 errors.npx cem analyze --config cem.config.js && npx vitest --run --project storybookon the 12 affected test files ingen2/packages/swc(spectrum-element, dev-validation, progress-bar, meter, action-button, button, close-button, infield-button, action-group, dropzone, status-light, prompt-field): 12 files and 167 tests passed.Install Dev Mode Test,Enum Warning Docs Link Test, and the action button pending and icon-only warning tests).npx vite buildingen2/packages/swcandgen2/packages/icons:swc/disthas noicons/folder anymore, and it imports@adobe/spectrum-wc-icons/swc-icon-alert-triangle.js,ChevronLeft.js, andChevronRight.js, which the icons build provides through its./*.jsexport.https://spectrum-web-components.adobe.com/index.json: only the unusedalert-bannerbase class still links to a missing page (there's no gen2 alert banner).sourceLocation()helper over all 60 stories files: every source folder exists, every registration import and type import resolves, and every controller and mixin export is in its published barrel.Cross-model review
gpt-6.1-solandgemini-4-argon, as adversarial "merge challenge" reviewers.OverviewStoryreadfileNamefromcsfFile.metaandGettingStartedfrompreparedMeta. Both readpreparedMetanow. (Storybook setsfileNameon both today, so this was consistency, not a bug.)installDevMode()resetsissuedWarningsand logs the notice again if it runs twice. It's@internal, not re-exported from the element barrel, and runs once at module load; only the test calls it again.<DocsHeader />. It doesn't today, and its MDX has its own import examples.Motivation and context
<swc-text-field>and@adobe/spectrum-wc-icons/swc-icon-alert-triangle.jsthrewNotSupportedError, because the element was defined twice.<swc-progress-bar>warning linked to the meter docs.import '@adobe/spectrum-wc/components/drop-zone/swc-drop-zone.js'andimport { FocusGroupNavigationController } from '@adobe/spectrum-wc-core/controllers/focus-group-navigation-controller.js', and "View source on GitHub" opened folders that don't exist on controller, mixin, and pattern pages.Related issue(s)
gen2/.Screenshots (if appropriate)
Not applicable: no visual change to components. Docs snippets, before and after:
import '@adobe/spectrum-wc/components/drop-zone/swc-drop-zone.js';import '@adobe/spectrum-wc/components/dropzone/swc-dropzone.js';import type { UiIcons } …import type { UiIcon } from '@adobe/spectrum-wc/components/ui-icons';import { FocusGroupNavigationController } from '@adobe/spectrum-wc-core/controllers/focus-group-navigation-controller.js';import { FocusgroupNavigationController } from '@adobe/spectrum-wc-core/controllers';import { LabellingMixin } from '@adobe/spectrum-wc-core/controllers/labelling-mixin.js';import { LabellingMixin } from '@adobe/spectrum-wc-core/mixins';Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
swc doesn't bundle icon elements
yarn buildingen2/packages/swcdist/icons/doesn't existdist/components/text-field/TextField.jsto import@adobe/spectrum-wc-icons/swc-icon-alert-triangle.jsDEBUG: falseset before load turns dev mode offwindow.__swc = { DEBUG: false };before importing@adobe/spectrum-wc/components/badge/swc-badge.js<swc-badge variant="banana">Badge</swc-badge>Warnings link to the element's own docs
label-positionto an unsupported value in the console, for exampledocument.querySelector('swc-progress-bar').labelPosition = 'nope'?path=/docs/components-progress-bar--docs, not the meter docsDocs pages show working imports and source links
import '@adobe/spectrum-wc/components/dropzone/swc-dropzone.js';, and "View source on GitHub" opensgen2/packages/swc/components/dropzonegen2/packages/swc/patterns/ai-toolkit/prompt-fieldimport { FocusgroupNavigationController } from '@adobe/spectrum-wc-core/controllers';and a source link togen2/packages/core/controllers/focusgroup-navigation-controllerDevice review
Accessibility testing checklist
Required: Complete each applicable item and document your testing steps (replace the placeholders with your component-specific instructions).
Keyboard (required — document steps below) — What to test for: Focus order is logical; Tab reaches the component and all interactive descendants; Enter/Space activate where appropriate; arrow keys work for tabs, menus, sliders, etc.; no focus traps; Escape dismisses when applicable; focus indicator is visible.
?path=/story/components-text-field--invalid)Screen reader (required — document steps below) — What to test for: Role and name are announced correctly; state changes (e.g. expanded, selected) are announced; labels and relationships are clear; no unnecessary or duplicate announcements.