Skip to content

feat(type): add data-attribute theme scoping for type custom properties AB#1612078 - #294

Merged
jason-capsule42 merged 17 commits into
masterfrom
jbaker/themeScoping
Aug 19, 2026
Merged

feat(type): add data-attribute theme scoping for type custom properties AB#1612078#294
jason-capsule42 merged 17 commits into
masterfrom
jbaker/themeScoping

Conversation

@jason-capsule42

@jason-capsule42 jason-capsule42 commented Aug 14, 2026

Copy link
Copy Markdown
Member

Post-Mortems

AB#1388992

Post-mortem discussion: #295

The WebCoreStyleSheets feature documentation pages linked out to the old Orion design system website for their "see the documentation" references. That site was retired when the team completed its move from Orion to Auro, so every one of those links returned a "page not found" error. This change repoints all of those references to the current, live WebCoreStyleSheets documentation site, so readers can once again follow them and land on the correct reference material.

Tracked in AB#1388992.

AB#1612078

Post-mortem discussion: #293

WebCoreStyleSheets (WCSS) previously shipped each visual theme's typography settings as a
separate stylesheet with no way to switch typography themes within a single page. This work
adds a standard "data attribute" hook so a consumer can activate any theme's typography on
part of a page — and bundles every theme's typography into each themed stylesheet so switching
between them no longer requires loading multiple files. The change is additive for typography:
existing pages render exactly as before unless they opt in to the new hook. It mirrors the same
scoping convention already shipped by AuroDesignTokens, keeping the two systems aligned.

A follow-up hardening pass closed a release-blocking gap that would have broken every downstream
Sass consumer on the next publish, and removed leftover files so the shipped package reflects the
new architecture cleanly.

Two follow-on decisions were made during the work at the team's direction: the Auro 2 theme
was fully removed from the build, and the Auro 1 theme's attribute code was set to atm.

Ticket: AB#1612078


Alaska Airlines Pull Request

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Resolves: # (issue, if applicable)

Summary:

Please summarize the scope of the changes you have submitted, what the intent of the work is and anything that describes the before/after state of the project.

Type of change:

Please delete options that are not relevant.

  • New capability
  • Revision of an existing capability
  • Infrastructure change (automation, etc.)
  • Other (please elaborate)

Checklist:

  • My update follows the CONTRIBUTING guidelines of this project
  • I have performed a self-review of my own update

By submitting this Pull Request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Pull Requests will be evaluated by their quality of update and whether it is consistent with the goals and values of this project. Any submission is to be considered a conversation between the submitter and the maintainers of this project and may require changes to your submission.

Thank you for your submission!

-- Auro Design System Team

Summary by Sourcery

Enable data-attribute-scoped typography themes with runtime switching while modernizing Sass module usage and preserving default theme behavior.

New Features:

  • Add data-attribute scoping for typography custom properties and include all supported themes in each bundled theme stylesheet, enabling runtime theme switching within a page.
  • Add shared typography classes that consume the scoped custom properties across bundled themes.

Bug Fixes:

  • Prevent unknown non-default themes from silently overriding the default typography configuration during generation.
  • Restore reliable Sass consumer compatibility while migrating stylesheet sources and examples to the Sass module system.

Enhancements:

  • Modernize Sass sources to use namespaced modules and explicit design-token dependencies across normalization, headings, grids, utilities, and theme generation.
  • Update the Auro 1 typography configuration to use the Atmos theme configuration and remove the obsolete Auro 2 theme from the generated architecture.
  • Improve typography fallbacks and ensure accent letter-spacing values are emitted consistently.

Documentation:

  • Regenerate SassDoc examples and generated documentation for the updated Sass module usage and theme scoping behavior.

Chores:

  • Refresh generated theme bundles and documentation artifacts to reflect the new typography architecture.

@jason-capsule42 jason-capsule42 self-assigned this Aug 14, 2026
@sourcery-ai

sourcery-ai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds data-attribute-based theme scoping for typography custom properties, generates multi-theme type bundles aligned with design-tokens theme codes, wires in a theme code build step, and removes the Auro 2 theme from all builds while overriding the Auro 1 theme code to atm.

File-Level Changes

Change Details Files
Introduce data-attribute theme scoping and multi-theme generation for typography custom properties.
  • Add wcss-type-scope-selector() function to build :root and [data-aag-theme="aag-theme-"] selectors for type custom properties.
  • Refactor type CSS-var generation into generate-type-css-vars() and generate-multi-theme-type-css-vars() to emit all themes' vars in a single stylesheet with a configurable default theme.
  • Update generate-theme-type-css-vars() and theme generator mixin to accept a theme name and use the new scoping function.
src/type/mixins/_type-generator.scss
src/type/mixins/_theme-generator.scss
Generate Sass map of theme codes from design-tokens and centralize excluded themes and overrides.
  • Add theme-codes.build.mjs script that reads THEME_DEFINITIONS, applies EXCLUDED_THEMES and THEME_CODE_OVERRIDES (auro-1 → atm), and writes _theme-codes.scss with $wcss-theme-codes.
  • Introduce excluded-themes.mjs with EXCLUDED_THEMES (auro-2) and a withoutExcludedThemes() helper shared by build scripts.
  • Integrate withoutExcludedThemes() into the global theme CSS config so excluded themes are not built.
scripts/theme-codes.build.mjs
scripts/excluded-themes.mjs
scripts/theme.global.css.config.mjs
Add per-theme multi-theme type bundles and wire them into the CSS build.
  • Create _all-theme-configs.scss aggregating all themes' type configs into $wcss-all-theme-configs.
  • Add per-theme bundled type entry files (alaska, alaska-classic, auro-1, hawaiian) that invoke generate-multi-theme-type-css-vars() with their theme as the default.
  • Extend type.classes.css.build.mjs to build per-theme type bundles from THEME_DEFINITIONS (filtered by withoutExcludedThemes) into dist/bundled/type/themes/*.css.
  • Update theme.global.template.scss to import the new per-theme type bundle and type-classes generator so each global bundle carries all themes' typography plus classes.
src/bundled/type/themes/_all-theme-configs.scss
src/bundled/type/themes/alaska.scss
src/bundled/type/themes/alaska-classic.scss
src/bundled/type/themes/auro-1.scss
src/bundled/type/themes/hawaiian.scss
scripts/type.classes.css.build.mjs
src/bundled/themes/theme.global.template.scss
Update build/test pipeline to generate theme codes before Sass compilation and modernize dependencies.
  • Add build:theme-codes npm script and invoke it from build, build:dist-bundle, build:dev, and test workflows so _theme-codes.scss exists before Sass runs.
  • Bump @aurodesignsystem/design-tokens and several devDependencies (sass, semantic-release, etc.) to newer versions.
  • Ensure dist/bundled/type/themes output directory exists before writing bundles.
  • Regenerate SassDoc docs index to reflect new version 11.1.3.
package.json
scripts/type.classes.css.build.mjs
docs/index.html
Remove Auro 2 theme from configuration and source and document post-mortem for AB#1612078.
  • Delete all Auro 2-specific config, base, type, theme, and font files, and remove its import from src/config/_index.scss so it no longer builds.
  • Add docs/post-mortem/1612078.md documenting the problem, root cause, fix, scope decisions, and learnings.
  • Adjust theme filtering via excluded-themes.mjs so auro-2 is systematically excluded from theme builds.
src/config/_index.scss
src/bundled/type/themes/auro-2/* (removed)
src/config/auro-2/**/* (removed)
src/essentials/themes/_auro-2.scss
src/fonts/themes/_auro-2.scss
src/type/themes/auro-2/index.scss
docs/post-mortem/1612078.md
scripts/excluded-themes.mjs
Add tests to lock in type theme scoping behavior.
  • Introduce sass-true test spec that asserts wcss-type-scope-selector() outputs for default, non-default, Auro 1 (atm), and unknown themes.
  • Import the new type generator mixins into the test harness to validate the generated selectors against $wcss-theme-codes.
tests/typeThemeScoping.spec.scss

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@jason-capsule42
jason-capsule42 force-pushed the jbaker/themeScoping branch 3 times, most recently from 06d6f45 to de65fd0 Compare August 14, 2026 18:43
@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown

🚀 PR Release Published! v0.0.0-pr294.17

To install:

npm install @aurodesignsystem-dev/webcorestylesheets@0.0.0-pr294.17

Install via alias:

npm install @aurodesignsystem@npm:@aurodesignsystem-dev/webcorestylesheets@0.0.0-pr294.17

View on npmjs.com

@jason-capsule42
jason-capsule42 marked this pull request as ready for review August 14, 2026 19:37
@jason-capsule42
jason-capsule42 requested a review from a team as a code owner August 14, 2026 19:37

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @jason-capsule42, your pull request is larger than the review limit of 150000 diff characters

@jason-capsule42
jason-capsule42 force-pushed the jbaker/themeScoping branch 5 times, most recently from 827bba9 to f5fe842 Compare August 17, 2026 15:47
jason-capsule42 added a commit that referenced this pull request Aug 17, 2026
…tility classes #294

Resolve code-review findings on the Sass module-system migration (PR #294).

- responsive: fix the `lg` breakpoint guard/token in _responsive.scss
  (`ds-breakpoint-lg` → `ds-grid-breakpoint-lg`). `.util_is-lgOnly` and
  `.util_is-lgOnly--inline` now emit their `@media (min-width: 1024px)` rules
  instead of nothing.
- fontStyles: fix the invalid custom property on `.util_fontWeightDefault`
  (`var(--$ds-text-body-default-weight)` → `var(--ds-text-body-default-weight,
  $ds-text-body-default-weight)`).
- Remove the now-constant `meta.variable-exists()` guards from _responsive.scss
  and _fontStyles.scss (behavior-preserving — the token SCSS is `@use`d directly
  post-migration) and drop the unused `sass:meta` import.
- Rename the non-descriptive `auro-classic2` aliases to descriptive names with a
  collision-explaining comment (bundled legacy globals and demo styles).
- Document `EXCLUDED_THEMES = ['auro-2']` as a forward-proofing no-op.
- MIGRATION.md: note the `generate-theme-type-css-vars` signature change and the
  `auro-1` → Atmos compat shim; regenerate SassDoc (docs/index.html).

Verified: all shipped `dist/bundled` outputs are byte-identical to the pre-change
build; the only compiled deltas are the two intended fixes above. jest 52/52,
scss/css lint clean.

Co-authored-by AI: Claude Opus 4.8
jason-capsule42 added a commit that referenced this pull request Aug 17, 2026
Correct two inaccurate pieces of guidance in the type-theme migration docs:

- MIGRATION.md pointed direct `@use` consumers of the auro-1 compat shim at
  `src/type/themes/atmos/`, which does not exist and would fail with a Sass
  "Can't find stylesheet" error. Repoint to the bundled multi-theme file
  `src/bundled/type/themes/atmos` (emits Atmos as the `:root` default) and
  note that no single-theme atmos partial exists, leaving auro-1 as the only
  direct path for now.
- The _all-theme-configs.scss maintenance comment claimed a newly added theme
  is "silently" omitted with no build-time error. Correct it to describe the
  real two-file manual step: a missing bundled `<dir>.scss` fails the build,
  and a missing manifest entry is caught by typeThemeScoping.spec.scss.

Co-authored-by AI: Claude Opus 4.8
jason-capsule42 added a commit that referenced this pull request Aug 17, 2026
Replace the legacy Sass @import system across all src/ partials, bundled
theme/type entrypoints, and tests with the Sass module system (@use / @forward).
Dart Sass has deprecated @import and will remove it in Dart Sass 3.0.0; this
moves WCSS — and downstream consumers — off the deprecation path.

The shipped src/ (and compiled dist/) partials are the package's public API,
so this changes how WCSS is consumed:

- Load WCSS partials with `@use` instead of `@import`. Members are namespaced
  by default; use `as *` for the closest match to the old global behavior.
- Scope/prefix is now configured by loading `libSupport/manageScope` with
  `@use ... with ($scope: true, $prefix: true)` rather than setting globals
  before the import. The configured `@use` must come first in the compilation.
- `!important` output is configured via `@use utilityVariables/important with
  ($important: true)` instead of a global `$important`.
- Design tokens are now an explicit dependency: partials `@use` values from
  `@aurodesignsystem/design-tokens` directly instead of detecting globals via
  `meta.variable-exists()`. The design-tokens peer must be installed; injecting
  token globals ahead of the WCSS import no longer overrides values.
- Tests use the module API (`@use 'true' as *;`, `@use '<partial>' as * with (...)`).

Also fixes the Atmos theme essentials/fonts partials, which self-referenced
under the module system and triggered "module is already being loaded"; the
orphaned fonts/themes/_auro-1.scss is folded into fonts/themes/_atmos.scss.

Adds MIGRATION.md documenting the full v11 → v12 upgrade path.

BREAKING CHANGE: WCSS partials must now be loaded with the Sass module system
(@use/@forward) instead of @import. Scope/prefix and !important are configured
via `@use ... with (...)` on manageScope / important rather than global
variables, and design-token defaults are resolved from
@aurodesignsystem/design-tokens directly. See MIGRATION.md for the full guide.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jason-capsule42 added a commit that referenced this pull request Aug 17, 2026
The PR release job published prerelease versions (e.g. 0.0.0-pr294.0) with a bare `npm publish`. Newer npm refuses to publish a prerelease without an explicit dist-tag, failing the job with "You must specify a tag using --tag when publishing a prerelease version."

Add `--tag pr<PR number>` to the publish step so each PR release gets its own PR-scoped dist-tag, fixing the failure while ensuring PR releases never move the shared `latest` tag.

Co-authored-by AI: Claude Opus 4.8
jason-capsule42 added a commit that referenced this pull request Aug 17, 2026
…() calls #294

Revert the five first-class `if(sass(...): ...; else: ...)` calls in
_type-generator.scss to the classic `if($cond, $a, $b)` ternary. The
first-class form requires Dart Sass >=1.90, but peerDependencies.sass allows
^1.42.1; the ternary compiles across the full declared range and emits
identical output (verified on 1.42.1, 1.77.0, and 1.102.0).

Also:
- Remove the dead `auro-1: atm` entry from THEME_CODE_OVERRIDES; it never
  fired against design-tokens 9.3.3 and would collide with atmos's native
  `atm` code if auro-1 ever returned. Add a collision-warning comment.
- Drop an unused `@use` of the alaska type index in
  _type-classes-alaska-generator.scss.
- Switch the four src/config/<theme>/type/index.scss files from `@use` to
  `@forward` for accent/body/display/heading, so the parent `@forward "type"`
  actually re-exports the type config API (with `@use` it re-exported nothing).
  Also drop the now-unused top-level `@use ... SCSSVariables--<theme> as v`
  from each index; the leaf partials @use their own design-tokens.
- Guard both directions of the manifest<->code mapping in
  typeThemeScoping.spec.scss: add a reverse check that every theme in
  $wcss-theme-codes also appears in $wcss-all-theme-configs, so a coded theme
  cannot be silently omitted from the multi-theme bundles. Rename the atmos
  scope test to reflect that `atm` is atmos's native design-tokens code now
  that the THEME_CODE_OVERRIDES entry is gone.
- Correct stale "Auro 1" comments to "Atmos" in the atmos config indexes.
- Document in MIGRATION.md the `$paragraph` opt-in via `@use ... with()` and
  the removed per-theme bundled type paths.

Co-authored-by AI: Claude Opus 4.8
jason-capsule42 added a commit that referenced this pull request Aug 17, 2026
…tility classes #294

Resolve code-review findings on the Sass module-system migration (PR #294).

- responsive: fix the `lg` breakpoint guard/token in _responsive.scss
  (`ds-breakpoint-lg` → `ds-grid-breakpoint-lg`). `.util_is-lgOnly` and
  `.util_is-lgOnly--inline` now emit their `@media (min-width: 1024px)` rules
  instead of nothing.
- fontStyles: fix the invalid custom property on `.util_fontWeightDefault`
  (`var(--$ds-text-body-default-weight)` → `var(--ds-text-body-default-weight,
  $ds-text-body-default-weight)`).
- Remove the now-constant `meta.variable-exists()` guards from _responsive.scss
  and _fontStyles.scss (behavior-preserving — the token SCSS is `@use`d directly
  post-migration) and drop the unused `sass:meta` import.
- Rename the non-descriptive `auro-classic2` aliases to descriptive names with a
  collision-explaining comment (bundled legacy globals and demo styles).
- Document `EXCLUDED_THEMES = ['auro-2']` as a forward-proofing no-op.
- MIGRATION.md: note the `generate-theme-type-css-vars` signature change and the
  `auro-1` → Atmos compat shim; regenerate SassDoc (docs/index.html).

Verified: all shipped `dist/bundled` outputs are byte-identical to the pre-change
build; the only compiled deltas are the two intended fixes above. jest 52/52,
scss/css lint clean.

Co-authored-by AI: Claude Opus 4.8
jason-capsule42 added a commit that referenced this pull request Aug 17, 2026
Correct two inaccurate pieces of guidance in the type-theme migration docs:

- MIGRATION.md pointed direct `@use` consumers of the auro-1 compat shim at
  `src/type/themes/atmos/`, which does not exist and would fail with a Sass
  "Can't find stylesheet" error. Repoint to the bundled multi-theme file
  `src/bundled/type/themes/atmos` (emits Atmos as the `:root` default) and
  note that no single-theme atmos partial exists, leaving auro-1 as the only
  direct path for now.
- The _all-theme-configs.scss maintenance comment claimed a newly added theme
  is "silently" omitted with no build-time error. Correct it to describe the
  real two-file manual step: a missing bundled `<dir>.scss` fails the build,
  and a missing manifest entry is caught by typeThemeScoping.spec.scss.

Co-authored-by AI: Claude Opus 4.8
jason-capsule42 added a commit that referenced this pull request Aug 17, 2026
Remove @use statements that were no longer referenced after the module
migration: the "sass:meta" import in _normalize.scss and the redundant
SCSSVariables (aliased as tokens) import in _anchor-roleButton.scss.
No behavioral change — these modules were imported but unused.
jason-capsule42 added a commit that referenced this pull request Aug 17, 2026
…precated if() #294

Restore the Hawaiian accent typography behavior that regressed under the AB#1612078 multi-theme migration. The single, theme-agnostic .accent-* classes now always reference var(--wcss-accent-*-letter-spacing), so a theme can no longer opt out by omitting the class declaration (the old $accent-uses-letter-spacing: false path). Hawaiian's accent config lacked a letter-spacing key, so the custom property emitted empty and the shared class applied an invalid/inherited value. Set Hawaiian's accent letter-spacing to an explicit normal, neutralizing the shared declaration while other themes keep their 0.05em tracking.

Also drop the classic if() ternaries in _type-generator.scss in favor of @if/@else. The peerDep floor (sass ^1.42.1) predates first-class if(), while classic if() is on the Sass deprecation-removal path; this clears the [if-function] deprecation warnings emitted on every build.

Add a spec guarding that Hawaiian accent letter-spacing resolves to normal for every accent size.

Co-authored-by AI: Claude Opus 4.8
jason-capsule42 added a commit that referenced this pull request Aug 17, 2026
Resolve documentation and code-quality findings from the PR #294 review;
no behavior change to compiled output.

- docs(MIGRATION.md): correct design-tokens from "peer" to a direct
  dependency installed automatically; document the per-theme \$paragraph
  opt-in via essentials/base; fix the v11 type-generator example to be
  unnamespaced (it loaded via @import).
- build: ship MIGRATION.md in the npm tarball (.npmignore override) and
  run build:theme-codes in the prepare script so fresh clones compile.
- refactor: remove the dead top-level SCSSVariables @use from both bundled
  legacy globals (each dependency @uses it directly); rename the Atmos
  config map \$alaska-base-config to \$atmos-base-config for accuracy.
- test: assert the alaska-classic type scope selector resolves to asc.

Co-authored-by AI: Claude Opus 4.8
jason-capsule42 added a commit that referenced this pull request Aug 17, 2026
#294

Address code-review nits on the Sass module migration / theme-scoping work.

- Add a sass-true output/expect assertion for generate-multi-theme-type-css-vars:
  compiles a two-theme stub (alaska default + hawaiian) and verifies the default
  theme emits under :root plus its attribute selectors while the non-default theme
  is scoped to attribute selectors only. Because both sides run the same partial
  generators, the type-var internals cancel out and only the selector composition
  is under test — making the previously @error-only invariant continuously verified.
- Fix the SassDoc "altered output values" example in _layoutPropertiesGenerator.scss
  to be module-system correct: load the design-tokens module as tokens and pass
  overrides through @use ... with (...) instead of the pre-module "set $var then
  @use" pattern, so the example compiles if copied verbatim.
- Add a cross-reference comment on Hawaiian's $accent-uses-letter-spacing: false
  explaining why it must stay false (single-theme bundle preserves the no-tracking
  output) and pointing to the accent config's letter-spacing: normal rationale.

Co-authored-by AI: Claude Opus 4.8
@jason-capsule42

Copy link
Copy Markdown
Member Author

Code Review — PR #294 (as of 23baec6)

Verdict: ✅ clear to merge. No code-correctness defects, no open blockers. Two independent reviewers (Opus + Sonnet, xhigh effort) plus orchestrator checks converged; all actionable findings are resolved.

✅ Resolved in 23baec6

  • Hawaiian bundle cross-reference commentsrc/type/themes/hawaiian/index.scss:15 now documents why $accent-uses-letter-spacing: false must stay false and points to the accent config's letter-spacing: normal rationale (prevents a future maintainer removing it as "redundant").
  • Machine-verifiable multi-theme scoping testtests/typeThemeScoping.spec.scss adds a sass-true output/expect assertion proving the default theme emits under :root (+ attribute selectors) while non-default themes are attribute-scoped only. The previously @error-only invariant is now continuously verified in CI.
  • Module-correct SassDoc examplesrc/utilityMixins/_layoutPropertiesGenerator.scss override example now loads the tokens module as tokens and configures via @use … with (…) instead of the pre-module "set $var then @use" pattern, so it compiles verbatim.

🟡 Advisory (no fix required)

  • The Auro-2 removal / auro-1 dist-path deletion lands in a non-! commit, but the PR's separate feat!: commit already forces the major bump and MIGRATION.md §7 documents every removed/renamed path. Surface-only — release outcome is correct.

Verified clean (no findings)

  • @use/@forward namespace migration across all touched files — consistent throughout.
  • Intended bug fixes correct: ds-breakpoint-lgds-grid-breakpoint-lg (_responsive.scss); var(--$ds-text-body-default-weight)var(--ds-text-body-default-weight, …) (_fontStyles.scss).
  • Config threading (@forward re-exports, _all-theme-configs.scss aliases, src/config/_index.scss collision avoidance) — sound.
  • essentials/fonts atmos self-reference + @forward 'base' hide $paragraph — correct.
  • Build/CI: --tag pr<number> safe (pull_request-triggered); build:theme-codes threaded through prepare/prepack/test/build; generated _theme-codes.scss gitignored but shipped via prepack.

Informational

🤖 Reconciled from Opus + Sonnet reviewer passes via /auro:code-review.

AB#1612078

Add data-attribute theme scoping for WCSS type custom properties, mirroring AuroDesignTokens' `[data-aag-theme="aag-theme-<code>"]` convention (additive; `:root` output retained, so existing typography rendering is unchanged).

- Generate `$wcss-theme-codes` at build time from design-tokens' THEME_DEFINITIONS via scripts/theme-codes.build.mjs (git-ignored partial), keeping codes drift-free.
- Add `wcss-type-scope-selector()` and `generate-multi-theme-type-css-vars` so each bundle emits its namesake theme under `:root` + attributes and every other theme under attributes only, enabling runtime theme switching within one stylesheet.
- Emit per-theme bundles to dist/bundled/type/themes/*.css and make each *.global.css multi-theme; add sass-true spec tests/typeThemeScoping.spec.scss.
- Remove the Auro 2 theme entirely via a shared scripts/excluded-themes.mjs filter and deletion of its source, and override Auro 1's emitted code to `atm`.

See post-mortem docs/post-mortem/1612078.md (lines 27–66) for the root cause and the fix.

Co-authored-by AI: Claude Opus 4.8
…precated if() #294

Restore the Hawaiian accent typography behavior that regressed under the AB#1612078 multi-theme migration. The single, theme-agnostic .accent-* classes now always reference var(--wcss-accent-*-letter-spacing), so a theme can no longer opt out by omitting the class declaration (the old $accent-uses-letter-spacing: false path). Hawaiian's accent config lacked a letter-spacing key, so the custom property emitted empty and the shared class applied an invalid/inherited value. Set Hawaiian's accent letter-spacing to an explicit normal, neutralizing the shared declaration while other themes keep their 0.05em tracking.

Also drop the classic if() ternaries in _type-generator.scss in favor of @if/@else. The peerDep floor (sass ^1.42.1) predates first-class if(), while classic if() is on the Sass deprecation-removal path; this clears the [if-function] deprecation warnings emitted on every build.

Add a spec guarding that Hawaiian accent letter-spacing resolves to normal for every accent size.

Co-authored-by AI: Claude Opus 4.8
Resolve documentation and code-quality findings from the PR #294 review;
no behavior change to compiled output.

- docs(MIGRATION.md): correct design-tokens from "peer" to a direct
  dependency installed automatically; document the per-theme \$paragraph
  opt-in via essentials/base; fix the v11 type-generator example to be
  unnamespaced (it loaded via @import).
- build: ship MIGRATION.md in the npm tarball (.npmignore override) and
  run build:theme-codes in the prepare script so fresh clones compile.
- refactor: remove the dead top-level SCSSVariables @use from both bundled
  legacy globals (each dependency @uses it directly); rename the Atmos
  config map \$alaska-base-config to \$atmos-base-config for accuracy.
- test: assert the alaska-classic type scope selector resolves to asc.

Co-authored-by AI: Claude Opus 4.8
#294

Address code-review nits on the Sass module migration / theme-scoping work.

- Add a sass-true output/expect assertion for generate-multi-theme-type-css-vars:
  compiles a two-theme stub (alaska default + hawaiian) and verifies the default
  theme emits under :root plus its attribute selectors while the non-default theme
  is scoped to attribute selectors only. Because both sides run the same partial
  generators, the type-var internals cancel out and only the selector composition
  is under test — making the previously @error-only invariant continuously verified.
- Fix the SassDoc "altered output values" example in _layoutPropertiesGenerator.scss
  to be module-system correct: load the design-tokens module as tokens and pass
  overrides through @use ... with (...) instead of the pre-module "set $var then
  @use" pattern, so the example compiles if copied verbatim.
- Add a cross-reference comment on Hawaiian's $accent-uses-letter-spacing: false
  explaining why it must stay false (single-theme bundle preserves the no-tracking
  output) and pointing to the accent config's letter-spacing: normal rationale.

Co-authored-by AI: Claude Opus 4.8

@chrisfalaska chrisfalaska left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pulled down locally and built.

Ran a single diff so far, just want to confirm this looks as expected before I do the others:

https://www.diffchecker.com/GpJR0wR0/

@jason-capsule42

Copy link
Copy Markdown
Member Author

Pulled down locally and built.

Ran a single diff so far, just want to confirm this looks as expected before I do the others:

https://www.diffchecker.com/GpJR0wR0/

yes, and already reviewed with @forrest-for-real

@chrisfalaska

Copy link
Copy Markdown
Contributor

I noticed commit cda6be03c933acc7562172e5da2ea9020ecab0f0 has the feat! cobention, but there's no explicit "BREAKING CHANGE" in the commit message.

@chrisfalaska

chrisfalaska commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Risks / things that could bite later

  • Committed dist/ has no freshness guardrail (biggest issue). Nothing rebuilds it on release (@semantic-release/git commits only CHANGELOG, package.json, and docs; prepack rebuilds only theme codes). It will drift from src/ and create merge noise.

    • Recommendation: Add a CI gate: npm run build && git diff --exit-code dist/, or revert to build-on-release.
  • _theme-codes.scss is git-ignored and generated. Direct Sass invocation without the prebuild step fails. This is mitigated by the npm lifecycle (build, test, prepare, and prepack run build:theme-codes first), but it's a build prerequisite worth knowing.

  • _all-theme-configs.scss is a hand-maintained manifest. Adding a theme requires two manual edits; a missing bundled entry only fails at global-build time.

  • Breaking renames: auro-1atmos, auro-2 dropped, generate-theme-type-css-vars has a new positional arg, and there are no @forward shims for old @import entry points.

    • All are justified/documented, but must ship in the intended major.

Test gaps

  • Add regression specs for the two 799c24b utility-class output fixes (.util_is-lgOnly, font-weight).

  • Add an assertion that the default-theme block precedes non-default blocks in source order. The cascade-correctness argument depends on it.

// Guards SOURCE ORDER specifically: the default theme's `:root` block must be
// emitted BEFORE any non-default attribute block. `:root` and `[data-aag-theme]`
// have equal specificity, so if a consumer sets a non-default theme attribute on
// the root element, the cascade resolves by source order — the non-default block
// only wins if it follows the default's `:root` block. This stub deliberately
// lists the default theme SECOND in the map; a mixin that emitted in map order
// (instead of hoisting the default first) would put the non-default block ahead
// of `:root` and fail this assertion.
@include it('emits the default theme first even when it is not first in the manifest map') {
  $stub-themes: (
    'hawaiian': map.get(all-theme-configs.$wcss-all-theme-configs, 'hawaiian'),
    'alaska': map.get(all-theme-configs.$wcss-all-theme-configs, 'alaska')
  );

  @include assert {
    @include output {
      @include generate-multi-theme-type-css-vars($stub-themes, 'alaska');
    }
    @include expect {
      @include generate-type-css-vars(
        map.get($stub-themes, 'alaska'),
        ':root, [data-aag-theme="aag-theme-as"], [data-aag-theme="aag-theme-as-type"]'
      );
      @include generate-type-css-vars(
        map.get($stub-themes, 'hawaiian'),
        '[data-aag-theme="aag-theme-ha"], [data-aag-theme="aag-theme-ha-type"]'
      );
    }
  }
}

…n CI #294

Make the generated _theme-codes.scss Sass partial a committed build artifact
and guard the committed generated output in CI.

- Commit src/type/mixins/_theme-codes.scss (generated by
  scripts/theme-codes.build.mjs from AuroDesignTokens theme definitions) and
  stop gitignoring it, so a direct `sass` invocation compiles without a
  prebuild step; add an explanatory comment on the `@use "theme-codes"` in
  _type-generator.scss.
- Add a CI build step that fails when the committed dist/ bundles or
  _theme-codes.scss drift from a fresh `npm run build`, preventing stale
  generated output from being merged.
- Document the committed-build-output contract in the README.
- Add a source-order regression test ensuring the default theme's :root block
  is emitted before non-default attribute blocks even when it is not first in
  the manifest map.
- Add tests/utilityClasses.spec.js regression coverage for the lg-breakpoint
  token and font-weight custom-property fixes by compiling the real
  utility-class partials and asserting on the emitted CSS.

Co-authored-by AI: Claude Opus 4.8
@jason-capsule42

Copy link
Copy Markdown
Member Author

All review comments address with code changes in latest commit per discussion with @chrisfalaska

@chrisfalaska chrisfalaska left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Built and tested locally. Feedback applied. 🚀

@jason-capsule42
jason-capsule42 merged commit 74baea1 into master Aug 19, 2026
7 checks passed
jason-capsule42 added a commit that referenced this pull request Aug 19, 2026
Replace the legacy Sass @import system across all src/ partials, bundled
theme/type entrypoints, and tests with the Sass module system (@use / @forward).
Dart Sass has deprecated @import and will remove it in Dart Sass 3.0.0; this
moves WCSS — and downstream consumers — off the deprecation path.

The shipped src/ (and compiled dist/) partials are the package's public API,
so this changes how WCSS is consumed:

- Load WCSS partials with `@use` instead of `@import`. Members are namespaced
  by default; use `as *` for the closest match to the old global behavior.
- Scope/prefix is now configured by loading `libSupport/manageScope` with
  `@use ... with ($scope: true, $prefix: true)` rather than setting globals
  before the import. The configured `@use` must come first in the compilation.
- `!important` output is configured via `@use utilityVariables/important with
  ($important: true)` instead of a global `$important`.
- Design tokens are now an explicit dependency: partials `@use` values from
  `@aurodesignsystem/design-tokens` directly instead of detecting globals via
  `meta.variable-exists()`. The design-tokens peer must be installed; injecting
  token globals ahead of the WCSS import no longer overrides values.
- Tests use the module API (`@use 'true' as *;`, `@use '<partial>' as * with (...)`).

Also fixes the Atmos theme essentials/fonts partials, which self-referenced
under the module system and triggered "module is already being loaded"; the
orphaned fonts/themes/_auro-1.scss is folded into fonts/themes/_atmos.scss.

Adds MIGRATION.md documenting the full v11 → v12 upgrade path.

BREAKING CHANGE: WCSS partials must now be loaded with the Sass module system
(@use/@forward) instead of @import. Scope/prefix and !important are configured
via `@use ... with (...)` on manageScope / important rather than global
variables, and design-token defaults are resolved from
@aurodesignsystem/design-tokens directly. See MIGRATION.md for the full guide.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jason-capsule42 added a commit that referenced this pull request Aug 19, 2026
The PR release job published prerelease versions (e.g. 0.0.0-pr294.0) with a bare `npm publish`. Newer npm refuses to publish a prerelease without an explicit dist-tag, failing the job with "You must specify a tag using --tag when publishing a prerelease version."

Add `--tag pr<PR number>` to the publish step so each PR release gets its own PR-scoped dist-tag, fixing the failure while ensuring PR releases never move the shared `latest` tag.

Co-authored-by AI: Claude Opus 4.8
jason-capsule42 added a commit that referenced this pull request Aug 19, 2026
…() calls #294

Revert the five first-class `if(sass(...): ...; else: ...)` calls in
_type-generator.scss to the classic `if($cond, $a, $b)` ternary. The
first-class form requires Dart Sass >=1.90, but peerDependencies.sass allows
^1.42.1; the ternary compiles across the full declared range and emits
identical output (verified on 1.42.1, 1.77.0, and 1.102.0).

Also:
- Remove the dead `auro-1: atm` entry from THEME_CODE_OVERRIDES; it never
  fired against design-tokens 9.3.3 and would collide with atmos's native
  `atm` code if auro-1 ever returned. Add a collision-warning comment.
- Drop an unused `@use` of the alaska type index in
  _type-classes-alaska-generator.scss.
- Switch the four src/config/<theme>/type/index.scss files from `@use` to
  `@forward` for accent/body/display/heading, so the parent `@forward "type"`
  actually re-exports the type config API (with `@use` it re-exported nothing).
  Also drop the now-unused top-level `@use ... SCSSVariables--<theme> as v`
  from each index; the leaf partials @use their own design-tokens.
- Guard both directions of the manifest<->code mapping in
  typeThemeScoping.spec.scss: add a reverse check that every theme in
  $wcss-theme-codes also appears in $wcss-all-theme-configs, so a coded theme
  cannot be silently omitted from the multi-theme bundles. Rename the atmos
  scope test to reflect that `atm` is atmos's native design-tokens code now
  that the THEME_CODE_OVERRIDES entry is gone.
- Correct stale "Auro 1" comments to "Atmos" in the atmos config indexes.
- Document in MIGRATION.md the `$paragraph` opt-in via `@use ... with()` and
  the removed per-theme bundled type paths.

Co-authored-by AI: Claude Opus 4.8
jason-capsule42 added a commit that referenced this pull request Aug 19, 2026
…tility classes #294

Resolve code-review findings on the Sass module-system migration (PR #294).

- responsive: fix the `lg` breakpoint guard/token in _responsive.scss
  (`ds-breakpoint-lg` → `ds-grid-breakpoint-lg`). `.util_is-lgOnly` and
  `.util_is-lgOnly--inline` now emit their `@media (min-width: 1024px)` rules
  instead of nothing.
- fontStyles: fix the invalid custom property on `.util_fontWeightDefault`
  (`var(--$ds-text-body-default-weight)` → `var(--ds-text-body-default-weight,
  $ds-text-body-default-weight)`).
- Remove the now-constant `meta.variable-exists()` guards from _responsive.scss
  and _fontStyles.scss (behavior-preserving — the token SCSS is `@use`d directly
  post-migration) and drop the unused `sass:meta` import.
- Rename the non-descriptive `auro-classic2` aliases to descriptive names with a
  collision-explaining comment (bundled legacy globals and demo styles).
- Document `EXCLUDED_THEMES = ['auro-2']` as a forward-proofing no-op.
- MIGRATION.md: note the `generate-theme-type-css-vars` signature change and the
  `auro-1` → Atmos compat shim; regenerate SassDoc (docs/index.html).

Verified: all shipped `dist/bundled` outputs are byte-identical to the pre-change
build; the only compiled deltas are the two intended fixes above. jest 52/52,
scss/css lint clean.

Co-authored-by AI: Claude Opus 4.8
jason-capsule42 added a commit that referenced this pull request Aug 19, 2026
Correct two inaccurate pieces of guidance in the type-theme migration docs:

- MIGRATION.md pointed direct `@use` consumers of the auro-1 compat shim at
  `src/type/themes/atmos/`, which does not exist and would fail with a Sass
  "Can't find stylesheet" error. Repoint to the bundled multi-theme file
  `src/bundled/type/themes/atmos` (emits Atmos as the `:root` default) and
  note that no single-theme atmos partial exists, leaving auro-1 as the only
  direct path for now.
- The _all-theme-configs.scss maintenance comment claimed a newly added theme
  is "silently" omitted with no build-time error. Correct it to describe the
  real two-file manual step: a missing bundled `<dir>.scss` fails the build,
  and a missing manifest entry is caught by typeThemeScoping.spec.scss.

Co-authored-by AI: Claude Opus 4.8
@jason-capsule42
jason-capsule42 deleted the jbaker/themeScoping branch August 19, 2026 19:57
jason-capsule42 added a commit that referenced this pull request Aug 19, 2026
Remove @use statements that were no longer referenced after the module
migration: the "sass:meta" import in _normalize.scss and the redundant
SCSSVariables (aliased as tokens) import in _anchor-roleButton.scss.
No behavioral change — these modules were imported but unused.
jason-capsule42 added a commit that referenced this pull request Aug 19, 2026
…precated if() #294

Restore the Hawaiian accent typography behavior that regressed under the AB#1612078 multi-theme migration. The single, theme-agnostic .accent-* classes now always reference var(--wcss-accent-*-letter-spacing), so a theme can no longer opt out by omitting the class declaration (the old $accent-uses-letter-spacing: false path). Hawaiian's accent config lacked a letter-spacing key, so the custom property emitted empty and the shared class applied an invalid/inherited value. Set Hawaiian's accent letter-spacing to an explicit normal, neutralizing the shared declaration while other themes keep their 0.05em tracking.

Also drop the classic if() ternaries in _type-generator.scss in favor of @if/@else. The peerDep floor (sass ^1.42.1) predates first-class if(), while classic if() is on the Sass deprecation-removal path; this clears the [if-function] deprecation warnings emitted on every build.

Add a spec guarding that Hawaiian accent letter-spacing resolves to normal for every accent size.

Co-authored-by AI: Claude Opus 4.8
jason-capsule42 added a commit that referenced this pull request Aug 19, 2026
Resolve documentation and code-quality findings from the PR #294 review;
no behavior change to compiled output.

- docs(MIGRATION.md): correct design-tokens from "peer" to a direct
  dependency installed automatically; document the per-theme \$paragraph
  opt-in via essentials/base; fix the v11 type-generator example to be
  unnamespaced (it loaded via @import).
- build: ship MIGRATION.md in the npm tarball (.npmignore override) and
  run build:theme-codes in the prepare script so fresh clones compile.
- refactor: remove the dead top-level SCSSVariables @use from both bundled
  legacy globals (each dependency @uses it directly); rename the Atmos
  config map \$alaska-base-config to \$atmos-base-config for accuracy.
- test: assert the alaska-classic type scope selector resolves to asc.

Co-authored-by AI: Claude Opus 4.8
jason-capsule42 added a commit that referenced this pull request Aug 19, 2026
#294

Address code-review nits on the Sass module migration / theme-scoping work.

- Add a sass-true output/expect assertion for generate-multi-theme-type-css-vars:
  compiles a two-theme stub (alaska default + hawaiian) and verifies the default
  theme emits under :root plus its attribute selectors while the non-default theme
  is scoped to attribute selectors only. Because both sides run the same partial
  generators, the type-var internals cancel out and only the selector composition
  is under test — making the previously @error-only invariant continuously verified.
- Fix the SassDoc "altered output values" example in _layoutPropertiesGenerator.scss
  to be module-system correct: load the design-tokens module as tokens and pass
  overrides through @use ... with (...) instead of the pre-module "set $var then
  @use" pattern, so the example compiles if copied verbatim.
- Add a cross-reference comment on Hawaiian's $accent-uses-letter-spacing: false
  explaining why it must stay false (single-theme bundle preserves the no-tracking
  output) and pointing to the accent config's letter-spacing: normal rationale.

Co-authored-by AI: Claude Opus 4.8
rmenner pushed a commit that referenced this pull request Aug 19, 2026
# [12.0.0](v11.1.3...v12.0.0) (2026-08-19)

* feat!: migrate Sass [@import](https://github.com/import) to the module system (@use/[@forward](https://github.com/forward)) [#294](#294) ([f6d2989](f6d2989))

### Bug Fixes

* correct lg breakpoint token and font-weight custom property in utility classes [#294](#294) ([be1d204](be1d204))
* **deps:** drop chalk runtime dependency by de-chalking postinstall banner AB[#1502836](https://github.com/AlaskaAirlines/WebCoreStyleSheets/issues/1502836) ([ab5a8e6](ab5a8e6)), closes [#f26135](https://github.com/AlaskaAirlines/WebCoreStyleSheets/issues/f26135) [#ffd200](https://github.com/AlaskaAirlines/WebCoreStyleSheets/issues/ffd200)
* **engines:** loosen node engine to >=20 to match other Auro repos AB[#1559488](https://github.com/AlaskaAirlines/WebCoreStyleSheets/issues/1559488) ([5c7793c](5c7793c))
* **type:** restore Dart Sass <1.90 compatibility in type-generator if() calls [#294](#294) ([8b2c3d0](8b2c3d0))
* **type:** restore Hawaiian accent letter-spacing opt-out and drop deprecated if() [#294](#294) ([0851b16](0851b16)), closes [AB#1612078](https://github.com/AB/issues/1612078)

### Features

* **type:** add data-attribute theme scoping for type custom properties AB[#1612078](https://github.com/AlaskaAirlines/WebCoreStyleSheets/issues/1612078) ([852891b](852891b))

### BREAKING CHANGES

* WCSS partials must now be loaded with the Sass module system
(@use/@forward) instead of @import. Scope/prefix and !important are configured
via `@use ... with (...)` on manageScope / important rather than global
variables, and design-token defaults are resolved from
@aurodesignsystem/design-tokens directly. See MIGRATION.md for the full guide.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rmenner

rmenner commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 12.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@rmenner rmenner added the released Completed work has been released label Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Completed work has been released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants