cssints 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clay-types.d.mts +1 -1
- package/dist/clay.mjs +1 -1
- package/dist/group-common-DeOjPus2.d.mts +1 -0
- package/dist/{group-types-D1m9Whs0.d.mts → group-types-e0K9k9bI.d.mts} +1 -1
- package/dist/groups/baseline-2015/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2015.d.mts +3 -3
- package/dist/groups/baseline-2016/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2016.d.mts +3 -3
- package/dist/groups/baseline-2017/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2017.d.mts +3 -3
- package/dist/groups/baseline-2018/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2018.d.mts +3 -3
- package/dist/groups/baseline-2019/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2019.d.mts +3 -3
- package/dist/groups/baseline-2020/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2020.d.mts +3 -3
- package/dist/groups/baseline-2021/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2021.d.mts +3 -3
- package/dist/groups/baseline-2022/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2022.d.mts +3 -3
- package/dist/groups/baseline-2023/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2023.d.mts +3 -3
- package/dist/groups/baseline-2024/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2024.d.mts +3 -3
- package/dist/groups/baseline-2025/with-downstream.d.mts +3 -3
- package/dist/groups/baseline-2025.d.mts +3 -3
- package/dist/groups/baseline-2026/with-downstream.d.mts +1 -1
- package/dist/groups/baseline-2026.d.mts +1 -1
- package/dist/groups/compositing-2.d.mts +3 -3
- package/dist/groups/css-align-3.d.mts +3 -3
- package/dist/groups/css-anchor-position-1.d.mts +3 -3
- package/dist/groups/css-anchor-position-2.d.mts +3 -3
- package/dist/groups/css-animations-1.d.mts +3 -3
- package/dist/groups/css-animations-2.d.mts +3 -3
- package/dist/groups/css-backgrounds-3.d.mts +3 -3
- package/dist/groups/css-backgrounds-4.d.mts +3 -3
- package/dist/groups/css-borders-4.d.mts +3 -3
- package/dist/groups/css-box-4.d.mts +3 -3
- package/dist/groups/css-break-4.d.mts +3 -3
- package/dist/groups/css-cascade-5.d.mts +3 -3
- package/dist/groups/css-cascade-6.d.mts +3 -3
- package/dist/groups/css-color-4.d.mts +3 -3
- package/dist/groups/css-color-5.d.mts +3 -3
- package/dist/groups/css-color-6.d.mts +3 -3
- package/dist/groups/css-color-adjust-1.d.mts +3 -3
- package/dist/groups/css-color-hdr-1.d.mts +3 -3
- package/dist/groups/css-conditional-3.d.mts +3 -3
- package/dist/groups/css-conditional-4.d.mts +3 -3
- package/dist/groups/css-conditional-5.d.mts +3 -3
- package/dist/groups/css-contain-2.d.mts +3 -3
- package/dist/groups/css-content-3.d.mts +3 -3
- package/dist/groups/css-counter-styles-3.d.mts +3 -3
- package/dist/groups/css-display-4.d.mts +3 -3
- package/dist/groups/css-easing-2.d.mts +3 -3
- package/dist/groups/css-env-1.d.mts +3 -3
- package/dist/groups/css-flexbox-1.d.mts +3 -3
- package/dist/groups/css-fonts-4.d.mts +3 -3
- package/dist/groups/css-fonts-5.d.mts +3 -3
- package/dist/groups/css-forms-1.d.mts +3 -3
- package/dist/groups/css-gaps-1.d.mts +3 -3
- package/dist/groups/css-gcpm-3.d.mts +3 -3
- package/dist/groups/css-gcpm-4.d.mts +3 -3
- package/dist/groups/css-grid-2.d.mts +3 -3
- package/dist/groups/css-grid-3.d.mts +3 -3
- package/dist/groups/css-images-3.d.mts +3 -3
- package/dist/groups/css-images-4.d.mts +3 -3
- package/dist/groups/css-images-5.d.mts +3 -3
- package/dist/groups/css-inline-3.d.mts +3 -3
- package/dist/groups/css-lists-3.d.mts +3 -3
- package/dist/groups/css-logical-1.d.mts +3 -3
- package/dist/groups/css-masking-1.d.mts +3 -3
- package/dist/groups/css-multicol-2.d.mts +3 -3
- package/dist/groups/css-overflow-3.d.mts +3 -3
- package/dist/groups/css-overflow-4.d.mts +3 -3
- package/dist/groups/css-overflow-5.d.mts +3 -3
- package/dist/groups/css-overscroll-1.d.mts +3 -3
- package/dist/groups/css-page-3.d.mts +3 -3
- package/dist/groups/css-page-floats-3.d.mts +3 -3
- package/dist/groups/css-position-3.d.mts +3 -3
- package/dist/groups/css-position-4.d.mts +3 -3
- package/dist/groups/css-rhythm-1.d.mts +3 -3
- package/dist/groups/css-round-display-1.d.mts +3 -3
- package/dist/groups/css-ruby-1.d.mts +3 -3
- package/dist/groups/css-scroll-anchoring-1.d.mts +3 -3
- package/dist/groups/css-scroll-snap-1.d.mts +3 -3
- package/dist/groups/css-scroll-snap-2.d.mts +3 -3
- package/dist/groups/css-scrollbars-1.d.mts +3 -3
- package/dist/groups/css-shapes-1.d.mts +3 -3
- package/dist/groups/css-shapes-2.d.mts +3 -3
- package/dist/groups/css-size-adjust-1.d.mts +3 -3
- package/dist/groups/css-sizing-3.d.mts +3 -3
- package/dist/groups/css-sizing-4.d.mts +3 -3
- package/dist/groups/css-speech-1.d.mts +3 -3
- package/dist/groups/css-tables-3.d.mts +3 -3
- package/dist/groups/css-text-3.d.mts +3 -3
- package/dist/groups/css-text-4.d.mts +3 -3
- package/dist/groups/css-text-decor-3.d.mts +3 -3
- package/dist/groups/css-text-decor-4.d.mts +3 -3
- package/dist/groups/css-transforms-1.d.mts +3 -3
- package/dist/groups/css-transforms-2.d.mts +3 -3
- package/dist/groups/css-transitions-1.d.mts +3 -3
- package/dist/groups/css-transitions-2.d.mts +3 -3
- package/dist/groups/css-ui-4.d.mts +3 -3
- package/dist/groups/css-values-4.d.mts +3 -3
- package/dist/groups/css-values-5.d.mts +3 -3
- package/dist/groups/css-variables-2.d.mts +2 -2
- package/dist/groups/css-view-transitions-2.d.mts +3 -3
- package/dist/groups/css-viewport.d.mts +3 -3
- package/dist/groups/css-will-change-1.d.mts +3 -3
- package/dist/groups/css-writing-modes-4.d.mts +3 -3
- package/dist/groups/css2.d.mts +3 -3
- package/dist/groups/fill-stroke-3.d.mts +3 -3
- package/dist/groups/filter-effects-1.d.mts +3 -3
- package/dist/groups/filter-effects-2.d.mts +3 -3
- package/dist/groups/limited-availability.d.mts +1 -1
- package/dist/groups/mediaqueries-4.d.mts +3 -3
- package/dist/groups/mediaqueries-5.d.mts +3 -3
- package/dist/groups/motion-1.d.mts +3 -3
- package/dist/groups/newly-available/with-downstream.d.mts +3 -3
- package/dist/groups/newly-available.d.mts +3 -3
- package/dist/groups/not-discouraged.d.mts +3 -3
- package/dist/groups/scroll-animations-1.d.mts +3 -3
- package/dist/groups/selectors-4.d.mts +2 -2
- package/dist/groups/selectors-5.d.mts +2 -2
- package/dist/groups/widely-available/with-downstream.d.mts +3 -3
- package/dist/groups/widely-available.d.mts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/plugin-types.d.mts +1 -1
- package/dist/plugin.d.mts +1 -1
- package/dist/{scope-xUS8MykU.d.mts → scope-CYtpn6RD.d.mts} +10 -8
- package/dist/surface.d.mts +1 -1
- package/dist/{theme-C5cmxs1-.mjs → theme-DtEALNIY.mjs} +11 -1
- package/dist/{theme-types-C5OAtybo.d.mts → theme-types-D8PVAr7H.d.mts} +10 -8
- package/dist/tui-types.d.mts +1 -1
- package/dist/tui.mjs +1 -1
- package/dist/types.d.mts +1 -1
- package/docs/API.md +39 -14
- package/package.json +2 -2
- package/dist/group-common-ClVCSlR6.d.mts +0 -1
package/docs/API.md
CHANGED
|
@@ -327,7 +327,31 @@ css.createGlobalTheme(t, css.hover, { color: { bg: "red" } }); // error: a pseud
|
|
|
327
327
|
```
|
|
328
328
|
|
|
329
329
|
- **Types:** `$type` is inherited through groups, and a token needs one (it is not guessed from the value). It maps to a token type: `color` to `color`, `dimension` to `length`, `number` to `number`, `duration` to `time`, `fontWeight` to `number` (keywords such as `bold` become 700), `cubicBezier` to `easingFunction`, `shadow` to `shadow`. `fontFamily`, `strokeStyle` and the other composite types (`border`, `transition`, `gradient`, `typography`) are an error. A value is a CSS string of the type's grammar, or the DTCG form: `{ colorSpace, components, alpha? }`, `{ value, unit }` (`px` or `rem`, `ms` or `s`), a number, `[x1, y1, x2, y2]` (`cubic-bezier(x1, y1, x2, y2)`), `{ color, offsetX, offsetY, blur, spread, inset? }` or an array of them (the parts are DTCG values or CSS strings, without references). The initial value follows the rule of "Tokens": `{ value: 1, unit: "rem" }` is `initial-value:16px` and `:root{--space-md:1rem}`.
|
|
330
|
+
- **A leaf may be its value:** when the group's `$type` is in scope, a token is the value itself, as a theme's overrides take it — `color: { $type: "color", bg: "#fff", link: "{color.accent}" }`. A string is a value of the group's type, an alias `{path}` included, and a number is one for `number` and `fontWeight`; anything else stays `{ $value }` as in DTCG: a DTCG object (`{ colorSpace, components }`, `{ value, unit }`, a shadow), and a token with its own `$type`, `$description` or `$extensions`. A value with no `$type` in its group is an error, in the types and at build time (a type is not guessed from the value). The same tokens, spelled both ways:
|
|
331
|
+
|
|
332
|
+
```ts
|
|
333
|
+
import * as css from "cssints" with { type: "cssints" };
|
|
334
|
+
|
|
335
|
+
const short = css.createTokens({
|
|
336
|
+
color: { $type: "color", bg: "#fff", edge: "oklch(80% 0.02 259)" },
|
|
337
|
+
space: { $type: "dimension", sm: "4px", md: "8px" },
|
|
338
|
+
hue: { $type: "number", accent: 345 },
|
|
339
|
+
});
|
|
340
|
+
const long = css.createTokens({
|
|
341
|
+
color: {
|
|
342
|
+
$type: "color",
|
|
343
|
+
bg: { $value: "#fff" },
|
|
344
|
+
edge: { $value: "oklch(80% 0.02 259)" },
|
|
345
|
+
},
|
|
346
|
+
space: { $type: "dimension", sm: { $value: "4px" }, md: { $value: { value: 8, unit: "px" } } },
|
|
347
|
+
hue: { $type: "number", accent: { $value: 345 } },
|
|
348
|
+
});
|
|
349
|
+
css.padding(short.space.md, long.space.md);
|
|
350
|
+
css.createTokens({ color: { bg: "#fff" } }); // error: no $type in scope
|
|
351
|
+
```
|
|
352
|
+
|
|
330
353
|
- **Names:** the variable name is the kebab-case path (`--color-bg`). A second argument to `createTokens` maps a path (an array of names) to a name, or to `{ var, inherit }`.
|
|
354
|
+
|
|
331
355
|
- **Support warnings** (cssints-tuyw): a token value goes through the same support check as a property value, since it reaches the same browsers: the initial value of `token.<type>()` and of a `createTokens()` leaf, an override of `createGlobalTheme()` (its references replaced by their literals) and a `token.set()` value. It is checked as a value of a property that takes its type (`color` for a colour, `width` for a length, `transform` for a transform list; `custom-ident` and `resolution` have none), so `oklch()` warns for a target without it, like `color: oklch(...)`. A warning is given once per token (or theme value) and BCD feature per build, and a dev server gives it again after each edit, as for properties. It names the token path and, for a theme, the theme: `createTokens(): color.accent value: "oklch()" in "oklch(0.62 0.19 259)" is not supported by chrome 109 (css.types.color.oklch)`, `createGlobalTheme(): color.accent value in .light: "oklch()" in ...`, `token.color() initial value of --name: ...`, `token.set() value of --name: ...`. An alias has the same warning for its own token, since its `@property` rule holds the same literal. A value that goes into the sheet gets no warning when a fallback below handles it for the targets (the bullet "No warning for what LightningCSS lowers" below says what LightningCSS lowers); an inline `token.set()` value never goes through LightningCSS and keeps the warning, as does a value LightningCSS cannot lower (`color-mix()` over a token in a class).
|
|
332
356
|
- **Fallbacks for older targets** (cssints-33pa): a browser that cannot parse the initial value of an `@property` rule (`oklch()` in Chrome 109) drops the rule, and the token has no value at all. When some target lacks a value, the engine writes it for that target (transforming `--x:value` through LightningCSS with the lacking targets and taking the first declaration, `#db4aa7` for `oklch(0.637 0.203 345)`) and nothing changes for a target set that has it, byte for byte:
|
|
333
357
|
- **A plain token** (`token.color("oklch(0.637 0.203 345)", "accent")`, a `createTokens()` leaf): `@property --accent{…initial-value:#db4aa7}` and `:root{--accent:oklch(0.637 0.203 345)}`, which LightningCSS lowers like any custom property (`--accent:#db4aa7`, then the wide-gamut `lab()` under `@supports (color: lab(0% 0 0))`). A browser that parses the value gets the wide one, so a modern browser reads the same colour as before, written as `lab()` (`:where(*)` stands for `:root` when the token does not inherit).
|
|
@@ -1224,33 +1248,34 @@ Two primitives with no APG pattern behind them, so no Quint spec: `createField`
|
|
|
1224
1248
|
|
|
1225
1249
|
```ts skip
|
|
1226
1250
|
createField(options?: {
|
|
1227
|
-
id?: string;
|
|
1228
|
-
required?: boolean;
|
|
1229
|
-
invalid?: boolean | string; // a string is the flag and the message; false wins over an error
|
|
1230
|
-
hint?: string;
|
|
1231
|
-
error?: string;
|
|
1251
|
+
id?: string | undefined;
|
|
1252
|
+
required?: boolean | undefined;
|
|
1253
|
+
invalid?: boolean | string | undefined; // a string is the flag and the message; false wins over an error
|
|
1254
|
+
hint?: string | undefined;
|
|
1255
|
+
error?: string | undefined;
|
|
1256
|
+
describedby?: string | readonly string[] | undefined; // host-owned ids, after the hint and the error
|
|
1232
1257
|
}): {
|
|
1233
1258
|
invalid(): boolean;
|
|
1234
1259
|
hint(): string | undefined;
|
|
1235
1260
|
error(): string | undefined; // only while invalid
|
|
1236
|
-
describedIds(): readonly string[]; // hint, then error
|
|
1261
|
+
describedIds(): readonly string[]; // hint, then error (the ones that are shown), then describedby
|
|
1237
1262
|
controlProps: { id; "aria-describedby"; "aria-invalid"; "aria-required"; required };
|
|
1238
1263
|
labelProps: { id; for };
|
|
1239
1264
|
hintProps: { id; hidden };
|
|
1240
|
-
errorProps: { id; hidden };
|
|
1265
|
+
errorProps: { id; hidden; role }; // role "alert" while the error is shown, else undefined
|
|
1241
1266
|
};
|
|
1242
1267
|
```
|
|
1243
1268
|
|
|
1244
|
-
The hint and the error are both listed in `aria-describedby` (hint first; the error does not replace it), `aria-invalid` is set only when invalid, and no attribute names an id that is hidden.
|
|
1269
|
+
The hint and the error are both listed in `aria-describedby` (hint first; the error does not replace it), `aria-invalid` is set only when invalid, and no attribute names an id that is hidden. `errorProps.role` is `"alert"` only while the error is shown; `hintProps` has no role. `describedby` is for one refusal that belongs to two controls: a form-level error element, with its own id and role, whose id is passed to both fields (a getter, so the id is there only while the element is shown); it follows the field's own ids in `aria-describedby` and is dropped when empty. Every option accepts `undefined`, so a getter over an optional prop typechecks under `exactOptionalPropertyTypes`.
|
|
1245
1270
|
|
|
1246
1271
|
```ts skip
|
|
1247
|
-
createConfirm(options?: { id?: string; onOpenChange?(open: boolean): void }): {
|
|
1272
|
+
createConfirm(options?: { id?: string | undefined; onOpenChange?(open: boolean): void }): {
|
|
1248
1273
|
confirm(request: {
|
|
1249
1274
|
title: string;
|
|
1250
|
-
description?: string;
|
|
1251
|
-
confirmLabel?: string; // "Confirm"
|
|
1252
|
-
cancelLabel?: string; // "Cancel"
|
|
1253
|
-
destructive?: boolean;
|
|
1275
|
+
description?: string | undefined;
|
|
1276
|
+
confirmLabel?: string | undefined; // "Confirm": English; a translating host passes both labels
|
|
1277
|
+
cancelLabel?: string | undefined; // "Cancel"
|
|
1278
|
+
destructive?: boolean | undefined;
|
|
1254
1279
|
}): Promise<boolean>;
|
|
1255
1280
|
open(): boolean;
|
|
1256
1281
|
request(): ConfirmView | undefined; // the request with its defaults, kept after it settles
|
|
@@ -1264,7 +1289,7 @@ createConfirm(options?: { id?: string; onOpenChange?(open: boolean): void }): {
|
|
|
1264
1289
|
};
|
|
1265
1290
|
```
|
|
1266
1291
|
|
|
1267
|
-
`confirm()` resolves `true` on confirm and `false` on cancel, Escape and a backdrop click. A second request while one is pending rejects with `ConfirmPendingError` (it is not queued). Focus goes to the cancel button on open and back to the element that had it when `confirm()` was called.
|
|
1292
|
+
`confirm()` resolves `true` on confirm and `false` on cancel, Escape and a backdrop click. A second request while one is pending rejects with `ConfirmPendingError` (it is not queued). Focus goes to the cancel button on open and back to the element that had it when `confirm()` was called. While it is open the dialog has a shell: Tab and Shift+Tab cycle inside it, `overflow: hidden` is set on `document.documentElement` (restored on close; counted, so nested confirms restore it once), and Escape is read from the document in the capture phase, so it works with the focus outside the dialog. Confirms from different `createConfirm` calls may be open together: the last opened gets Escape and Tab. The default labels stay English; a translating host passes `confirmLabel` and `cancelLabel` with each request.
|
|
1268
1293
|
|
|
1269
1294
|
### Publishing a library (decided 2026-10-02, cssints-0l3f)
|
|
1270
1295
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cssints",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "CSS in TypeScript: typed css.* calls compiled to atomic CSS at build time (a Vite plugin)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@cssints/css-grammar": "^0.
|
|
71
|
+
"@cssints/css-grammar": "^0.11.0",
|
|
72
72
|
"culori": "^4.0.2",
|
|
73
73
|
"effect": "4.0.6",
|
|
74
74
|
"happy-dom": "^20.14.5",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./theme-types-C5OAtybo.mjs";
|