You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,9 @@ CSSX is a monorepo for a CSS-in-JS toolchain. Users write `css`, `styl`, or opti
32
32
- Compiled sheets are JSON-serializable IR. Runtime cache/tracking state must stay outside the sheet.
33
33
-`part='root'` maps to `style`; other parts map to `{partName}Style`.
34
34
-`:hover` and `:active` compile to `hoverStyle` and `activeStyle`.
35
+
- Provider/global `:root` custom properties compile to `sheet.rootVariables` and resolve as scoped defaults below runtime `variables` and above `defaultVariables`.
36
+
- Component tag selectors such as `Button` and `Button:part(text)` apply only inside components wrapped with `themed('Button', Component)` or explicit resolver tag options.
37
+
-`variables` and `defaultVariables` are validating proxies. Direct assignment/deletion works for valid `--name` keys; bulk updates use `.assign()`, `.set()`, and `.clear()`.
35
38
- Local JS template interpolation is lowered to synthetic `var(--__cssx_dynamic_N)` slots and passed as `values`.
36
39
-`cache: 'teamplay'` remains accepted as a Babel option for compatibility, but runtime caching is owned by `@cssxjs/css-to-rn`, not Teamplay.
Copy file name to clipboardExpand all lines: architecture.md
+23-10Lines changed: 23 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -230,14 +230,21 @@ Supported selectors:
230
230
-`.root`
231
231
-`.root.active`
232
232
-`.root:part(label)`
233
+
-`.root::part(label)`
233
234
-`.root.active:part(icon)`
234
235
-`.root:hover`
235
236
-`.root:active`
237
+
-`Button`
238
+
-`Button.primary`
239
+
-`Button:part(text)`
240
+
-`Button::part(text)`
241
+
-`Button.primary:part(text)`
236
242
-`:export`
243
+
- bare `:root` custom-property declarations
237
244
238
-
`:hover` maps to `hoverStyle`; `:active` maps to `activeStyle`. Unsupported selectors are ignored with diagnostics in runtime mode.
245
+
`:hover` maps to `hoverStyle`; `:active` maps to `activeStyle`. Tag selectors apply only when the current component tag is provided by `themed(tagName, Component)` or explicit resolver options. Unsupported selectors are ignored with diagnostics in runtime mode.
239
246
240
-
`:root` custom-property declarations and declaration-level custom properties are intentionally not used as defaults. Use `setDefaultVariables()` for defaults.
247
+
Bare `:root` custom-property declarations are compiled into `sheet.rootVariables`and become scoped defaults when the sheet is supplied through `CssxProvider style` or another layer. Declaration-level custom properties outside `:root` are ignored with diagnostics.
241
248
242
249
### Value Resolution
243
250
@@ -246,13 +253,17 @@ Supported selectors:
246
253
1. Replace interpolation slots from `values`.
247
254
2. Recursively resolve nested `var()`.
248
255
3. Resolve `u`, viewport units, and supported `calc()`.
249
-
4. Return dependencies for variables and dimensions.
256
+
4. Normalize supported modern color functions (`oklch()`, `oklab()`, `color-mix()`) to `rgba(...)`.
257
+
5. Return dependencies for variables and dimensions.
Unresolved variables, cycles, depth limits, invalid interpolations, and unsupported `calc()` invalidate only the containing declaration. Earlier fallback declarations in the same rule still apply.
258
269
@@ -288,7 +299,7 @@ Resolver order:
288
299
289
300
1. Normalize `styleName` with classcat-like semantics.
290
301
2. Normalize one or more sheet layers.
291
-
3. Match selectors by class set.
302
+
3. Match selectors by component tag and class set.
292
303
4. Filter inactive media rules.
293
304
5. Group by output prop: `style`, `{part}Style`, `hoverStyle`, `activeStyle`.
294
305
6. Apply cascade by layer, specificity, and source order.
@@ -307,14 +318,16 @@ Runtime caches are bounded. Static cache keys include sheet identity, style name
-`config.ts`: optional `CssxProvider`, `configureCssx()`, and `useCssxConfig()`.
324
+
-`hooks.ts`: `useCssxSheet()`, `useRuntimeCss()`, `useCssxTemplate()`, `useCssxLayer()`, `useCssVariable()`, `useCssVariableRaw()`, `getCssVariable()`, and `getCssVariableRaw()`.
325
+
-`config.ts`: optional `CssxProvider`, `configureCssx()`, `useCssxConfig()`, and `themed()`.
315
326
316
327
`useCssxSheet()` starts a render-local dependency collection before render and commits it in a layout/effect phase. If a render is aborted, for example because a component throws a promise into Suspense, the pending dependencies are not committed and do not leak global subscriptions.
317
328
329
+
`CssxProvider style` accepts raw CSS strings, compiled sheets, tracked sheets, layer objects, arrays, and falsey values. Provider layers are appended after parent provider layers and before component-local layers. Nested providers append additional `:root` variable scopes, with inner scopes winning over outer scopes. `themed()` adds the current component tag and a render-local dependency tracker so provider/global styles that read variables can update themed components even when they have no local sheet.
330
+
318
331
Variable writes and deletes notify subscribers once per microtask. Subscribers only rerender when a variable they actually used changes. Viewport-unit subscribers are tied to dimension changes. Media-query dependencies store the match value observed during the committed render; dimension changes and platform media adapter changes only rerender subscribers whose committed media result changed. Browser `matchMedia` is used on web when available, and tests can install a media-query adapter for non-DOM media features such as `prefers-color-scheme`, `hover`, and `pointer`. Web resize uses leading plus trailing debounced updates.
0 commit comments