cssints 0.8.0 → 0.10.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/docs/API.md +49 -0
- package/package.json +2 -2
package/docs/API.md
CHANGED
|
@@ -1218,6 +1218,55 @@ More plugins on `scope()`, each a package of its own with its rules and limits i
|
|
|
1218
1218
|
| [`@cssints/rybitten`](../packages/rybitten/README.md) | `color(hue, { cube })`, `wheel(steps, { cube })`, `shades(hue, lightness)`, `overrides(group)` | RYBitten's red-yellow-blue colours (36 historical cubes) as DTCG data for `createTokens`: a hue, a wheel of hues, a hue at several lightnesses |
|
|
1219
1219
|
| [`@cssints/skeleton`](../packages/skeleton/README.md) | `skeleton().radius().color().highlight()` | Loading placeholders whose shimmer is in phase across the page (one clock on `:root`), static under reduced motion |
|
|
1220
1220
|
|
|
1221
|
+
### Headless: `createField` and `createConfirm` (`@cssints/headless`)
|
|
1222
|
+
|
|
1223
|
+
Two primitives with no APG pattern behind them, so no Quint spec: `createField` is the ARIA contract of a form field, `createConfirm` a promise over `createDialogModal({ role: "alertdialog" })`. Like the rest of the package they return state and attribute objects, no elements, no styling; the README has the examples.
|
|
1224
|
+
|
|
1225
|
+
```ts skip
|
|
1226
|
+
createField(options?: {
|
|
1227
|
+
id?: string | undefined;
|
|
1228
|
+
required?: boolean | undefined;
|
|
1229
|
+
invalid?: boolean | string | undefined; // a string is the flag and the message; false wins over an error
|
|
1230
|
+
hint?: string | undefined;
|
|
1231
|
+
error?: string | undefined;
|
|
1232
|
+
describedby?: string | readonly string[] | undefined; // host-owned ids, after the hint and the error
|
|
1233
|
+
}): {
|
|
1234
|
+
invalid(): boolean;
|
|
1235
|
+
hint(): string | undefined;
|
|
1236
|
+
error(): string | undefined; // only while invalid
|
|
1237
|
+
describedIds(): readonly string[]; // hint, then error (the ones that are shown), then describedby
|
|
1238
|
+
controlProps: { id; "aria-describedby"; "aria-invalid"; "aria-required"; required };
|
|
1239
|
+
labelProps: { id; for };
|
|
1240
|
+
hintProps: { id; hidden };
|
|
1241
|
+
errorProps: { id; hidden; role }; // role "alert" while the error is shown, else undefined
|
|
1242
|
+
};
|
|
1243
|
+
```
|
|
1244
|
+
|
|
1245
|
+
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`.
|
|
1246
|
+
|
|
1247
|
+
```ts skip
|
|
1248
|
+
createConfirm(options?: { id?: string | undefined; onOpenChange?(open: boolean): void }): {
|
|
1249
|
+
confirm(request: {
|
|
1250
|
+
title: string;
|
|
1251
|
+
description?: string | undefined;
|
|
1252
|
+
confirmLabel?: string | undefined; // "Confirm": English; a translating host passes both labels
|
|
1253
|
+
cancelLabel?: string | undefined; // "Cancel"
|
|
1254
|
+
destructive?: boolean | undefined;
|
|
1255
|
+
}): Promise<boolean>;
|
|
1256
|
+
open(): boolean;
|
|
1257
|
+
request(): ConfirmView | undefined; // the request with its defaults, kept after it settles
|
|
1258
|
+
triggerProps: { id; "aria-haspopup"; "aria-expanded"; "aria-controls" }; // dialog-modal's, without the handlers
|
|
1259
|
+
dialogProps: DialogContentProps; // role alertdialog, aria-labelledby the title, aria-describedby always the description
|
|
1260
|
+
backdropProps: DialogBackdropProps;
|
|
1261
|
+
titleProps: { id };
|
|
1262
|
+
descriptionProps: { id; hidden }; // render it always
|
|
1263
|
+
cancelProps: { id; type; onClick };
|
|
1264
|
+
confirmProps: { id; type; onClick };
|
|
1265
|
+
};
|
|
1266
|
+
```
|
|
1267
|
+
|
|
1268
|
+
`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.
|
|
1269
|
+
|
|
1221
1270
|
### Publishing a library (decided 2026-10-02, cssints-0l3f)
|
|
1222
1271
|
|
|
1223
1272
|
A package written on cssints ships JavaScript that still has the attribute, and its `.d.ts`. The app that installs it evaluates the package with its own engine: one sheet, the app's browserslist and themes, and a token, a kernel or an `@property` of the package is made once however many modules use it. Nothing is declared: the engine recognises a file by `with { type: "cssints" }`, the same marker as in app code.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cssints",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.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.10.0",
|
|
72
72
|
"culori": "^4.0.2",
|
|
73
73
|
"effect": "4.0.6",
|
|
74
74
|
"happy-dom": "^20.14.5",
|