Skip to content

feat(typography): emit every fluid type scale as both clamp() and pow() tokens - #90

Merged
Hebilicious merged 6 commits into
feat/issue-81-type-checksfrom
feat/issue-82-pow-scale
Oct 8, 2026
Merged

Hebilicious merged 6 commits into
feat/issue-81-type-checksfrom
feat/issue-82-pow-scale

Conversation

@Hebilicious

@Hebilicious Hebilicious commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Closes #82.

Every fluid type scale is written in two forms, side by side, in every output (CSS, JSON, TS, Style Dictionary). There is no option, and no output differs from another.

Custom property Path
clamp step --typography_fluid-<scale>[-<prefix>]-<label> typography_fluid.<scale>@<label>
pow input / helper --typography_fluid-<scale>[-<prefix>]-pow-<name> typography_fluid.<scale>.pow.<name>
pow step --typography_fluid-<scale>[-<prefix>]-pow-<label> typography_fluid.<scale>.pow@<label>
  • clamp gives each step a self-contained clamp(). Steps 0 and above are byte-identical to utopia.
  • pow follows good-css's six-input scale: min-width, max-width, min-font-size, max-font-size, min-type-scale and max-type-scale (named after the config keys they come from, as plain numbers), plus the progress, at-min and at-max helpers, with every step derived through pow(). Changing an input at :root changes the whole scale at runtime.
  • One per-step size model drives both forms and the feat(typography): fluid type checks for WCAG 1.4.4, static clamps, and a legibility floor #81 checks, which run once per scale. Step -n = step 0 / minTypeScale^n, so small sizes never shrink as the screen grows.
  • The pow tokens are ordinary tokens that can be referenced from primitives. Helpers and steps record their referencePaths.
  • relativeTo maps to vw, vi or cqi in both forms.
  • A step label of pow is rejected, because Style Dictionary would merge it with the pow tokens.
  • Tests evaluate both forms numerically at both widths against independently derived sizes, negative steps included.

pow() support: Chrome 120, Firefox 118, Safari 15.4.

🤖 Generated with Claude Code

@changeset-bot

changeset-bot Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 56bd3b3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@hebilicious/cssforge Minor
@hebilicious/cssforge-unplugin Patch

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

@Hebilicious
Hebilicious added this pull request to stack #93 October 7, 2026 21:03
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
cssforge 56bd3b3 Commit Preview URL

Branch Preview URL
Oct 08 2026, 08:16 AM

Hebilicious and others added 2 commits October 8, 2026 05:44
Add settings.output: "clamp" | "pow" to fluid type scales. Pow mode emits
the six scale inputs and the fluid, at-narrow and at-wide helpers as
scale-prefixed tokens and derives each step with pow(). Steps keep their
clamp-mode names and paths, steps below 0 divide step 0 by the narrow
ratio, and the fluid type checks use the sizes pow produces. relativeTo
maps to 100vw, 100vi or 100cqi.

Closes #82

Co-Authored-By: Claude <noreply@anthropic.com>
Refs #82

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Hebilicious
Hebilicious force-pushed the feat/issue-82-pow-scale branch from 7e0d858 to 503c65f Compare October 7, 2026 22:45
Hebilicious and others added 2 commits October 8, 2026 11:54
…fault

The CSS function is a CSS generation option, not token data:
`GenerateCSSOptions.fluidTypeFunction` ("pow" by default, or "clamp"),
passed to generateCSS and set by the --fluid-type-function CLI flag.
`settings.output` is removed from the token config.

Every step has one canonical size at minWidth and maxWidth. Steps 0 and
above are utopia's; step -n is step 0 / minTypeScale^n, so a small size
never shrinks. The checks, both CSS functions and the tokens use it.

JSON, TypeScript and Style Dictionary are identical for both functions:
each step token holds its clamp(), and the pow inputs and helpers are
CSS-only declarations (Output.cssOnly) that the CSS key collision check
still covers.

Refs #82

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #82

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Hebilicious Hebilicious changed the title feat(typography): pow() fluid scale output with container support feat(typography): write fluid type scales with pow() in the CSS by default Oct 8, 2026
…okens

Replace the CSS-only fluidTypeFunction option, the --fluid-type-function
flag and Output.cssOnly. Every output now holds both representations of
each fluid type scale, built in one loop from the canonical step sizes:

- clamp() steps keep their names and paths,
  --typography_fluid-<scale>[-<prefix>]-<label> at
  typography_fluid.<scale>@<label>; steps 0 and above match utopia.
- pow tokens: inputs and helpers at typography_fluid.<scale>.pow.<name>,
  steps at typography_fluid.<scale>.pow@<label>, keyed
  --typography_fluid-<scale>[-<prefix>]-pow-<name|label>. Helpers and
  steps are semantic and carry referencePaths through getReferencePaths.

A label that gives a pow key fails the key collision check, and the
label "pow" is rejected because it names the pow segment.

Refs #82

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Hebilicious Hebilicious changed the title feat(typography): write fluid type scales with pow() in the CSS by default feat(typography): emit every fluid type scale as both clamp() and pow() tokens Oct 8, 2026
… from

minWidth, maxWidth, minFontSize, maxFontSize, minTypeScale and
maxTypeScale become pow-min-width, pow-max-width, pow-min-font-size,
pow-max-font-size, pow-min-type-scale and pow-max-type-scale. The
helpers become pow-progress, pow-at-min and pow-at-max.

Refs #82

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Hebilicious
Hebilicious marked this pull request as ready for review October 8, 2026 08:24
@Hebilicious
Hebilicious merged commit b2636df into main Oct 8, 2026
5 checks passed
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.

feat(typography): emit every fluid type scale as both clamp() and pow() tokens

1 participant