Skip to content

Debug label carrier on the CSS.styles, not className - #594

Open
davesnx wants to merge 5 commits into
mainfrom
styles-label-carrier
Open

Debug label carrier on the CSS.styles, not className#594
davesnx wants to merge 5 commits into
mainfrom
styles-label-carrier

Conversation

@davesnx

@davesnx davesnx commented Jul 22, 2026

Copy link
Copy Markdown
Owner

No description provided.

@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
styled-ppx Ready Ready Preview, Comment Jul 22, 2026 9:49pm

davesnx added 5 commits July 22, 2026 21:27
[%styled.<tag>] (static and dynamic) passed the binding label to
Css_file.push unconditionally, bypassing the minify gate that [%css]
uses. In production the label suffix forked identical declarations into
per-binding atoms (css-k008qs-Card vs css-k008qs) and broke
cross-binding dedup in the extracted stylesheet.
- queryOrder/queryOrderReversed: same color atom under @media,
  @container and @supports, declared in both orders
- linkFirst/nthFirst: a:link vs a:nth-child(odd) equal-specificity ties
- build the demo with --minify so class names carry no label suffix

Documents the findings and the deterministic-buckets proposal in
documents/atomic-css-ordering.md.
…ples

The styles carrier grows a third slot: (className, vars, label), with
CSS.label to read it back. The label is the let-binding or module name
the styles came from — dev-only metadata for debugging/tooling (e.g. a
future data-label attribute).

- Runtime (melange + native): styles is now a 3-tuple; CSS.label and
  CSS.make_labeled added; merge joins labels. make deliberately keeps
  no optional argument so production call sites stay byte-identical
  (melange saturates optionals with undefined).
- PPX: dev mode emits CSS.make_labeled(label, ...); minify/production
  emits plain CSS.make with zero label bytes. Generated component code
  reads the carrier through CSS.className/CSS.styles.
- The styles= JSX expansion is now owned by styled-ppx
  (Styles_prop.ml, ported from server-reason-react's styles-attribute)
  and emits accessor calls instead of fst/snd, so the carrier
  representation stays internal to the runtime.
- Requires server-reason-react's styles-attribute to emit accessors
  too (its ~preprocess_impl runs before us on native); patched on the
  local pin, branch styles-attribute-accessors, to be upstreamed.
- Runtime tests migrated to accessors + CSS.label coverage; snapshot
  churn promoted; docs updated (runtime.mdx, atomic-css-ordering.md).
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