Skip to content

feat(ui): drop shorthand classname parser — object-form css() only#2795

Merged
viniciusdacal merged 4 commits into
mainfrom
feat/drop-classname-parser
Apr 18, 2026
Merged

feat(ui): drop shorthand classname parser — object-form css() only#2795
viniciusdacal merged 4 commits into
mainfrom
feat/drop-classname-parser

Conversation

@viniciusdacal
Copy link
Copy Markdown
Contributor

Summary

Phase 4 (final phase) of the drop-classname-utilities feature. Removes the legacy string-shorthand classname parser (['p:4', 'bg:background']) now that all call sites have been migrated to object-form css() + token.*.

Public API Changes

Breaking (pre-v1)

  • Removed exports from @vertz/ui: s, UtilityClass, StyleEntry, StyleValue, parseShorthand, resolveToken, ShorthandParseError, TokenResolveError, InlineStyleError, isKnownProperty, isValidColorToken
  • Removed compiler diagnostics: css-unknown-property, css-invalid-spacing, css-unknown-color-token, css-malformed-shorthand
  • css() and variants() now accept object-form only (StyleBlock). Array-form input no longer type-checks and is not extracted by the compiler.

Additions

  • None (Phase 4 is removal-only)

Migration

Already performed across first-party packages in Phase 3 (#2792). External users should migrate:

// Before
import { css } from '@vertz/ui';
const s = css({ panel: ['p:4', 'bg:background', 'rounded:lg'] });

// After
import { css, token } from '@vertz/ui';
const s = css({
  panel: {
    padding: token.spacing[4],
    backgroundColor: token.color.background,
    borderRadius: token.radius.lg,
  },
});

Deletions

TypeScript:

  • packages/ui/src/css/shorthand-parser.ts (~3.5 KB source)
  • packages/ui/src/css/token-resolver.ts (~18 KB source)
  • packages/ui/src/css/token-tables.ts (~18.6 KB source)
  • packages/ui/src/css/utility-types.ts (~6.3 KB source)
  • packages/ui/src/css/s.ts (~2 KB source)
  • scripts/migrate-classnames/ (migration tool — migration complete)

Rust:

  • native/vertz-compiler-core/src/css_diagnostics.rs
  • native/vertz-compiler-core/src/css_token_tables.rs

Tests:

  • native/vertz-compiler/__tests__/css-transform.test.ts and css-diagnostics.test.ts (exercised removed parser)
  • Transient back-compat tests in css-object-form.test.ts / variants-object-form.test.ts

Additions

  • packages/ui/src/__tests__/removed-exports.test-d.ts — 11 negative type tests proving each removed symbol is no longer importable from its former export paths.
  • compileTheme() regains a collision detector (Map-based) that throws when two color token paths would produce the same --color-* CSS variable (e.g. primary.foreground vs primary-foreground). Replaces the older check that depended on the deleted COLOR_NAMESPACES table.

Phases

Review

Local adversarial review at reviews/drop-classname-utilities/phase-04-delete.md. Three blockers (stale NAPI tests, transient back-compat tests, docs still teaching the removed API) and three should-fix items (architecture doc, ui-primitives README, theme collision regression) all addressed in follow-up commits.

Test plan

  • @vertz/ui — 2315 tests pass
  • @vertz/theme-shadcn — 136 tests pass
  • @vertz/ui-auth — 70 tests pass
  • packages/ui typecheck clean (tsgo --noEmit)
  • cargo test --all passes
  • cargo clippy --all-targets -- -D warnings clean
  • cargo fmt --all -- --check clean
  • oxlint packages/ — 0 errors
  • oxfmt --check packages/ clean
  • Pre-push lefthook passes (build-typecheck, test, lint, rust-fmt, rust-clippy, rust-test, trojan-source)
  • Grep repo for removed symbols — zero matches outside intentional negative type tests
  • Docs migrated (mint-docs, site, READMEs) — zero array-form examples remain

🤖 Generated with Claude Code

viniciusdacal and others added 4 commits April 18, 2026 08:14
Phase 4 of drop-classname-utilities:

- Delete packages/ui/src/css/{shorthand-parser,token-resolver,token-tables,utility-types,s}.ts
- Delete native/vertz-compiler-core/src/{css_diagnostics,css_token_tables}.rs
- Narrow css() and variants() public types to object form only (StyleBlock)
- Remove UtilityClass, StyleEntry, StyleValue, s, parseShorthand, resolveToken,
  ShorthandParseError, TokenResolveError, InlineStyleError, isKnownProperty,
  isValidColorToken from the @vertz/ui public surface
- Add packages/ui/src/__tests__/removed-exports.test-d.ts — negative type tests
  that prove each removed symbol is no longer importable
- Delete migration script scripts/migrate-classnames/ (migration complete)
- Update Rust test fixtures and module_server warning tests to use surviving
  diagnostics (W0763) and object-form css() sources
- Update packages/mint-docs and packages/site docs to reflect object-form only

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- B1: Delete stale NAPI tests (native/vertz-compiler/__tests__/css-transform.test.ts,
  css-diagnostics.test.ts) that exercised the removed shorthand parser
- B2: Delete transient back-compat tests in css-object-form/variants-object-form
  that silently rubber-stamped invalid array-form inputs
- B3: Migrate all user-facing docs and READMEs from array-form to object-form +
  token.* (mint-docs, site, ui README, ui-primitives README)
- S1: Update packages/ui/AUDIT-ARCHITECTURE.md to reflect current CSS architecture
  (remove references to deleted token-tables/token-resolver/shorthand-parser)
- S2: Update packages/ui-primitives/README.md example to object-form
- S3: Restore collision detection in compileTheme() without depending on the
  deleted COLOR_NAMESPACES table — throws on duplicate --color-* var names

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant