Skip to content

fix(theme): map spacing multiplier scale on inset utilities#299

Merged
alexgrozav merged 2 commits into
mainfrom
agent/mere/48bce9be
Jul 12, 2026
Merged

fix(theme): map spacing multiplier scale on inset utilities#299
alexgrozav merged 2 commits into
mainfrom
agent/mere/48bce9be

Conversation

@alexgrozav

Copy link
Copy Markdown
Contributor

Summary

Insets were plain createUseUtility, so a numeric ref like @0.5 fell through to a bare token lookup for a non-existent 0.5 variable and silently emitted an undefined var(--0--5). This swaps all 9 inset composables (inset, inset-x, inset-y, inset-inline-start, inset-inline-end, top, right, bottom, left) to createUseSpacingUtility(..., { namespace: "spacing" }) — written exactly like useMarginUtility — so insets map the spacing multiplier scale like margin/padding/height.

  • @0.5 on an inset → calc(var(--spacing, 1rem) * 0.5), consistent with margin/padding/height.
  • Object-syntax literals ({ "0": "0", auto: "auto" }) and the preset's undefined calls are unchanged — the composable signature is identical.

Output-shape note for review: existing @spacing.xs inset usages now shorten the utility class key spacing.xsxs (same as margin); the resolved var is identical.

Test plan

  • pnpm --filter @styleframe/theme test — 3267 passed (incl. 3 new inset multiplier tests asserting calc(...) and no var(--0--5))
  • pnpm typecheck — green
  • pnpm lint — green (exit 0, no new warnings)

Refs SF-12.

Insets were plain createUseUtility, so a numeric ref like @0.5 fell
through to a bare token lookup for a non-existent "0.5" variable and
silently emitted an undefined var(--0--5). Swap all 9 inset composables
to createUseSpacingUtility(..., { namespace: "spacing" }) — matching
margin/padding/height — so @0.5 resolves to calc(var(--spacing) * 0.5).

Object-syntax literals and undefined preset calls are unchanged; the
composable signature is identical. Adds multiplier tests asserting
insets emit calc() and no dead vars.

Refs SF-12
@changeset-bot

changeset-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: aea569f

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

This PR includes changesets to release 3 packages
Name Type
@styleframe/theme Patch
styleframe Patch
@styleframe/playground 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

@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
storybook-styleframe-dev Ready Ready Preview, Comment Jul 12, 2026 10:24am
styleframe-dev Ready Ready Preview, Comment Jul 12, 2026 10:24am

Request Review

@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Patch @styleframe/theme and styleframe for the inset spacing-scale fix.
@alexgrozav alexgrozav merged commit a22a813 into main Jul 12, 2026
15 checks passed
@alexgrozav alexgrozav deleted the agent/mere/48bce9be branch July 12, 2026 14:19
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