Skip to content

refactor(theming): enforce non-empty theme _meta.name and centralize CSS var generation via config#528

Open
simeonoff wants to merge 9 commits intomasterfrom
simeonoff/schemas-meta
Open

refactor(theming): enforce non-empty theme _meta.name and centralize CSS var generation via config#528
simeonoff wants to merge 9 commits intomasterfrom
simeonoff/schemas-meta

Conversation

@simeonoff
Copy link
Contributor

@simeonoff simeonoff commented Feb 5, 2026

  • Migrated CSS variable prefix to a config-driven mechanism (configure-variable-prefix()) and updated all CSS variable generation to use the new prefix.
  • Replaced target-specific selectors with a unified element-prefix approach across charts, themes, and schema files.
  • Enhanced _meta.name handling with a guard to ensure themes have a non-empty name.
  • Added/adjusted imports of config in numerous Sass modules to support the new approach.
  • Broad alignment of light/dark chart schemas and component theming with the new prefixing strategy.

…ach and unify selectors

What changed (highlights)- Introduced config-driven CSS variable prefix:
- Added imports of config in many Sass files.  - Updated
css-vars-from-theme to generate variables using
var(--#{config.variable-prefix()}-<name>-<key>).  - Reworked logic to
derive the component name from _meta.name and added a guard for
missing/empty names.- Unified and simplified selectors:  - Replaced
per-target map-based selectors with element-prefix based selectors
(e.g., #{element-prefix()}-<name>).  - Updated multiple theme/chart
schema files to use the new prefix approach.- Scope and structure
tweaks:  - Various chart/theme mixins and schemas updated to align with
the new config-prefix approach.  - Minor documentation/comments updates
to reflect CSS variable naming changes (css vars vs CSS Vars wording,
etc.).
This reflects removing explicit theme name usage and ensuring the
variable prefix is configured before generating Tailwind theme
utilities.
…niversal fallback chain

Introduce a new `tokens` mixin that consolidates theme variable generation into
a single public API with two modes:

- **global** (default): Emits universal `--ig-*` CSS variable tokens that work
  across Angular and Web Components. Rewrites local var references to global
  token names so derived values (adaptive-contrast, dynamic-shade) resolve
  correctly at any scope. Silently skips sizable() expressions that depend on
  component-scoped variables.

- **scoped**: Replaces the previous `css-vars` behavior, generating
  component-scoped variables with the configured variable-prefix and a
  universal `--ig-*` fallback chain for cross-platform overrides.

Additional changes:
- Add `--ig-*` fallback chain in `css-vars-from-theme` so global tokens
  can override platform-specific variables without breaking changes
- Deprecate `css-vars` mixin (JSDoc-only, delegates to `tokens`)
- Deprecate `button-theme` and `icon-button-theme` compound functions
  in favor of variant-specific theme functions
- Fix undefined `$name` reference in button-theme and icon-button-theme
- Fix button/icon-button selector to use element-prefix() not variable-prefix()
- Fix typo 'unkown-compoenent' -> 'unknown-component'
- Add 'default-size' to ignored keys list
- Extract private helpers for clean code: _is-emittable(), _is-sizable(),
  _collect-emittable-keys(), _globalize-value(), _tokens-global()
- Add 10 new tests covering tokens mixin (global mode, scoped mode,
  var rewriting, sizable skipping, parity with css-vars)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants