Sync Primer view_components upstream through v0.51.6 - #502
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
…lector lists (primer#4095) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Syncs the fork with primer/view_components up to upstream commit 6733f3c (parent of Release Tracking primer#4098), the last release in this batch reaching v0.51.6. Notable upstream changes pulled in: - classnames.js Set export (primer#4096): static/classnames.{js,cjs,d.ts} plus the package.json exports subpath and files entries. - perf(css): removed universal `*` subjects and expanded merged `:is()` selector lists (primer#4095). Conflicts resolved keeping the fork's identity, scope and its higher dependency versions; upstream's new exports/files additions and the static class-name output were merged in and regenerated cleanly.
Extends the include glob so nested component sources (alpha/, beta/, open_project/) are matched, and excludes generated .d.ts files that would otherwise conflict with their sources. Fixes the Vite dev server in the demo app: its per-file tsconfig resolution honours include patterns, so unmatched files were transformed without experimentalDecorators. Catalyst @controller decorators then reached the browser untransformed, aborting the whole JS module graph - no custom elements were registered and ActionMenu overlays rendered as static in-flow content. (cherry picked from commit ba86b76) (cherry picked from commit 393f680)
🦋 Changeset detectedLatest commit: cd07172 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 |
There was a problem hiding this comment.
Pull request overview
Syncs this fork with upstream primer/view_components through v0.51.6, while preserving fork-specific TypeScript build behavior and incorporating upstream CSS performance improvements and a new classnames export intended for consumer/tooling use.
Changes:
- Expand CSS selectors (avoid universal subjects / merged
:is()lists) to improve style-recalc performance in a few components. - Add
static/classnames.{js,cjs,d.ts}pluspackage.jsonsubpath exports and updatescript/export-css-selectorsto generate the flat class-name set. - Update
tsconfig.jsonto include nested component TS files and exclude*.d.ts.
Reviewed changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Makes TS compilation include nested component sources; excludes *.d.ts. |
| static/classnames.js | New ESM Set export of all class names (generated). |
| static/classnames.d.ts | Types for the classnames subpath export. |
| static/classnames.cjs | New CJS Set export of all class names (generated). |
| static/classes.json | Regenerated classes-to-component mapping reflecting CSS selector expansion. |
| script/export-css-selectors | Updates selector export script to also emit the flat classnames set. |
| package.json | Adds exports (including ./classnames) and ships the new static artifacts. |
| app/components/primer/beta/popover.pcss | Expands caret selectors for better style-recalc performance. |
| app/components/primer/beta/breadcrumbs.pcss | Expands selectors to avoid merged :is(...) compilation. |
| app/components/primer/alpha/text_field.pcss | Adds stylelint disable/enable and expands selectors for performance. |
| app/components/primer/alpha/auto_complete.pcss | Removes universal descendant color override in favor of inheritance. |
| .devcontainer/Dockerfile | Removes Yarn apt source to avoid apt-key/GPG failures in devcontainer builds. |
| .changeset/fast-pumas-juggle.md | Changeset for CSS style-recalc performance improvements. |
| .changeset/classnames-export.md | Changeset for the new classnames export. |
| if (collectClassNames) { | ||
| parsed.forEach(compound => { | ||
| compound.forEach(token => { | ||
| if (token.type === 'attribute' && token.name === 'class' && token.action === 'element') { | ||
| allClassNames.add(token.value) | ||
| } | ||
| }) | ||
| }) | ||
| } |
| "./classnames": { | ||
| "types": "./static/classnames.d.ts", | ||
| "import": "./static/classnames.js", | ||
| "require": "./static/classnames.cjs" | ||
| }, |
|
🤖 Opened by an agent on Alex's behalf.
Syncs the fork with
primer/view_componentsthrough upstream v0.51.6 — merge target6733f3c0e(parent of Release Tracking primer#4098).Upstream changes included
classnames.jsSet export to the CSS build primer/view_components#4096) — addsstatic/classnames.{js,cjs,d.ts}, the./classnamespackage.json exports subpath, and the correspondingfilesentries.*subjects and expand merged:is()selector lists primer/view_components#4095) — removes universal*subjects and expands merged:is()selector lists.Fork-specific commits on top
include(app/components/primer/**/*.ts). The merge otherwise reverts it to upstream's top-level-only glob, so nested component TS transforms withoutexperimentalDecoratorsunder Vite 8/rolldown and the demo build dies on Catalyst@controller(terser: Unexpected character '@'), failing every chrome system test. Verified locally:tscclean, demo Vite build green (315ms).main(dd6de0efd), so the "Generate static files" job can push again.Notes
static/classes.jsonoutput and had a messy force-push / CI-autocommit history.static/classnames.*regenerated from the merged sources and confirmed idempotent.merge=ours.