argot-css 0.0.1 → 0.1.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.
Files changed (93) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +23 -244
  3. package/dist/cli/getConfig.d.ts +11 -0
  4. package/dist/cli/getConfig.js +37 -0
  5. package/dist/cli/getConfig.js.map +1 -0
  6. package/dist/cli/print.js +1 -1
  7. package/dist/cli/print.js.map +1 -1
  8. package/dist/cli/run.js +20 -7
  9. package/dist/cli/run.js.map +1 -1
  10. package/dist/cli/usage.d.ts +1 -1
  11. package/dist/cli/usage.js +8 -5
  12. package/dist/cli/usage.js.map +1 -1
  13. package/dist/config/getConfig.d.ts +1 -0
  14. package/dist/config/getConfig.js +38 -0
  15. package/dist/config/getConfig.js.map +1 -0
  16. package/dist/config/types.d.ts +31 -0
  17. package/dist/config/types.js +2 -0
  18. package/dist/config/types.js.map +1 -0
  19. package/dist/config/util.d.ts +2 -0
  20. package/dist/config/util.js +4 -0
  21. package/dist/config/util.js.map +1 -0
  22. package/dist/io/safeWrite.d.ts +24 -0
  23. package/dist/io/safeWrite.js +50 -0
  24. package/dist/io/safeWrite.js.map +1 -0
  25. package/dist/lib/writeOutput.d.ts +32 -0
  26. package/dist/lib/writeOutput.js +88 -0
  27. package/dist/lib/writeOutput.js.map +1 -0
  28. package/dist/palette/cli.d.ts +2 -1
  29. package/dist/palette/cli.js +23 -12
  30. package/dist/palette/cli.js.map +1 -1
  31. package/dist/palette/generateName.d.ts +1 -1
  32. package/dist/palette/generatePalette.d.ts +2 -1
  33. package/dist/palette/generatePalette.js +1 -2
  34. package/dist/palette/generatePalette.js.map +1 -1
  35. package/dist/palette/index.d.ts +3 -2
  36. package/dist/palette/index.js +1 -1
  37. package/dist/palette/index.js.map +1 -1
  38. package/dist/palette/node.d.ts +7 -6
  39. package/dist/palette/node.js +6 -33
  40. package/dist/palette/node.js.map +1 -1
  41. package/dist/palette/render.d.ts +2 -1
  42. package/dist/palette/render.js +8 -5
  43. package/dist/palette/render.js.map +1 -1
  44. package/dist/palette/types.d.ts +30 -23
  45. package/dist/palette/types.js +26 -1
  46. package/dist/palette/types.js.map +1 -1
  47. package/dist/palette/validation.d.ts +5 -6
  48. package/dist/palette/validation.js +68 -56
  49. package/dist/palette/validation.js.map +1 -1
  50. package/dist/processor/cli.d.ts +2 -1
  51. package/dist/processor/cli.js +20 -7
  52. package/dist/processor/cli.js.map +1 -1
  53. package/dist/processor/index.d.ts +2 -1
  54. package/dist/processor/index.js +37 -14
  55. package/dist/processor/index.js.map +1 -1
  56. package/dist/processor/stylelintDefault.d.ts +4 -0
  57. package/dist/processor/stylelintDefault.js +5 -14
  58. package/dist/processor/stylelintDefault.js.map +1 -1
  59. package/dist/scaffold/cli.d.ts +3 -0
  60. package/dist/scaffold/cli.js +32 -0
  61. package/dist/scaffold/cli.js.map +1 -0
  62. package/dist/scaffold/templates.d.ts +6 -0
  63. package/dist/scaffold/templates.js +57 -0
  64. package/dist/scaffold/templates.js.map +1 -0
  65. package/dist/scaffold/writeScaffold.d.ts +12 -0
  66. package/dist/scaffold/writeScaffold.js +49 -0
  67. package/dist/scaffold/writeScaffold.js.map +1 -0
  68. package/dist/semantics/cli.d.ts +2 -1
  69. package/dist/semantics/cli.js +36 -29
  70. package/dist/semantics/cli.js.map +1 -1
  71. package/dist/semantics/generate.d.ts +8 -1
  72. package/dist/semantics/generate.js +4 -7
  73. package/dist/semantics/generate.js.map +1 -1
  74. package/dist/semantics/load-tokens.d.ts +2 -2
  75. package/dist/semantics/load-tokens.js.map +1 -1
  76. package/dist/stylelint/config.d.ts +2 -2
  77. package/dist/stylelint/config.js +3 -5
  78. package/dist/stylelint/config.js.map +1 -1
  79. package/dist/stylelint/index.d.ts +2 -2
  80. package/dist/stylelint/index.js +2 -2
  81. package/dist/stylelint/index.js.map +1 -1
  82. package/dist/stylelint/rules/colorContrast.d.ts +4 -0
  83. package/dist/stylelint/rules/colorContrast.js +91 -0
  84. package/dist/stylelint/rules/colorContrast.js.map +1 -0
  85. package/dist/stylelint/rules/util.d.ts +13 -0
  86. package/dist/stylelint/rules/util.js +66 -0
  87. package/dist/stylelint/rules/util.js.map +1 -0
  88. package/dist/stylelint/rules/valid-token.js +1 -1
  89. package/dist/stylelint/rules/valid-token.js.map +1 -1
  90. package/package.json +7 -8
  91. package/templates/styles.css +3 -2
  92. package/docs/api.md +0 -514
  93. /package/templates/{semantics.css → semantics-core.css} +0 -0
package/docs/api.md DELETED
@@ -1,514 +0,0 @@
1
- # Argot public API
2
-
3
- The API is still in development and likely to change, prior to first published
4
- version.
5
-
6
- Node.js 22.18 or newer is required for the CLI and Node APIs. The package is
7
- native ESM with compiled JavaScript and TypeScript declarations. No TypeScript
8
- compiler is needed to consume it.
9
-
10
- All functions below are synchronous and throw on failure. Palette validation
11
- errors identify the invalid field. Error messages are human-readable; no
12
- machine-readable error-code API is currently provided. Unless noted, APIs do not
13
- mutate inputs or write files.
14
-
15
- ## Typical workflows
16
-
17
- **Primitive palette**
18
-
19
- 1. Build or load a palette seed definition (JSON or in memory).
20
- 2. Use `generatePalette()` to produce structured color shades for each seed in
21
- the palette, or `generatePaletteCss()` / `renderPaletteCss()` to generate CSS
22
- custom properties.
23
- 3. In Node, `writePalette()` or `argot palette` writes the CSS file.
24
-
25
- **Semantic templates**
26
-
27
- 1. `argot generate` or `writeTemplate()` emits a semantic custom properties
28
- template stylesheet.
29
- 2. Use the palette primitives to assign values to semantic properties in the
30
- stylesheet.
31
-
32
- ## Entrypoints
33
-
34
- - `argot-css/palette`: browser-safe palette calculation, CSS rendering,
35
- definition validation/serialization, and optional CSS color parsing.
36
- - `argot-css/palette/node`: synchronous definition-file loading and CSS file
37
- writing. Node only.
38
- - `argot-css/semantics`: semantic CSS template generation. Node only. Same
39
- behavior as [`argot semantics`](#semantic-templates).
40
- - `argot-css/stylelint`: optional Stylelint plugin array.
41
- - `argot-css/stylelint/config`: optional shareable Stylelint config.
42
- - `argot-css/tokens/*`: packaged DTCG-shaped JSON files.
43
- - `argot-css/templates/semantics.css` and
44
- `argot-css/templates/semantics-extended.css`: static semantic templates.
45
-
46
- There is no root JavaScript entrypoint. Import from the named subpaths rather
47
- than internal `src/` or `dist/` paths. Browser-safe means the palette entrypoint
48
- does not require Node built-ins or browser globals; use a bundler or other
49
- package-resolution setup to import the npm package in a browser.
50
-
51
- ## Palette definitions
52
-
53
- To generate a color palette, provide a PaletteDefinition with "seed" colors
54
- defined using numeric OKLCH values in this format:
55
-
56
- ```json
57
- {
58
- "version": 1,
59
- "colors": [
60
- { "name": "gray", "l": 0.6, "c": 0.015, "h": 250 },
61
- { "name": "brand", "l": 0.6, "c": 0.2, "h": 250 }
62
- ],
63
- "options": {
64
- "lightnessCurve": "inclusive",
65
- "chromaCurve": "weighted",
66
- "format": "oklch",
67
- "gamut": "p3"
68
- }
69
- }
70
- ```
71
-
72
- `version` must be the number `1`. `colors` must be a nonempty array. Each color
73
- requires:
74
-
75
- - `name`: a lowercase name matching `^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$`, such as
76
- `blue` or `brand-primary`. Do not include the leading `--`.
77
- - `l`: finite lightness from 0 through 1, not a percentage from 0 through 100.
78
- - `c`: finite, nonnegative chroma. There is no enforced upper bound; practical
79
- displayable values depend on lightness, hue, and output gamut (typically below
80
- 0.5).
81
- - `h`: a finite hue angle in degrees, including for neutral colors. Values are
82
- not wrapped, so negative angles and angles above 360 are retained.
83
-
84
- Unknown fields and unsupported versions are rejected, not silently ignored.
85
- Coordinates are not coerced from strings, clamped, rounded, or thresholded
86
- during definition validation. Definitions contain no alpha, CSS strings, browser
87
- state, or filesystem paths.
88
-
89
- Each color emits `--name`, `--name-1` … `--name-16`. Names must not collide with
90
- any of those properties for any color in the definition. For example, `blue` and
91
- `blue-1` cannot both be color names, because `blue` already reserves `--blue-1`.
92
-
93
- ### Options and defaults
94
-
95
- All options are optional:
96
-
97
- | Option | Values | Default |
98
- | ---------------- | ---------------------------------------- | ---------------------------------- |
99
- | `lightnessCurve` | `'uniform'`, `'inclusive'`, `'centered'` | `'uniform'` |
100
- | `chromaCurve` | `'centered'`, `'weighted'` | `'centered'` |
101
- | `format` | `'oklch'`, `'hex'` | `'oklch'` |
102
- | `gamut` | `'p3'`, `'srgb'` | `'p3'` for OKLCH; `'srgb'` for hex |
103
-
104
- OKLCH supports either gamut. Hex requires sRGB; `format: 'hex'` with
105
- `gamut: 'p3'` throws. A color's input space does not select its output gamut.
106
-
107
- ### How scales are built
108
-
109
- Argot generates palettes with 16 shades ("steps") from light to dark for each
110
- seed color you provide. Steps are numbered from 1 through 16. The exact colors
111
- produced are shaped by a lightness curve and a chroma curve, as specified in
112
- `options`:
113
-
114
- | Lightness curve | Behavior |
115
- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
116
- | **Uniform** | Prioritizes uniform lightness across all hues in the palette, based on a hand-crafted lightness scale. Seed color may be rounded slightly to conform. |
117
- | **Inclusive** | Ensures your seed color is in the final set of color shade, evenly spacing other shades around them. Use if the seeds include precise brand colors you want to preserve. |
118
- | **Centered** | Places seed color at the middle of each palette. |
119
-
120
- | Chroma curve | Behavior |
121
- | ------------ | ------------------------------------------------------------------------------------- |
122
- | **Centered** | Shades near the center of the scale have the highest chroma. |
123
- | **Weighted** | Shades near the seed color have the highest chroma. Useful for light/pastel palettes. |
124
-
125
- After shade calculation, gamut mapping and output rounding is applied to ensure
126
- all shades are usable on the web. Palette generation does not guarantee
127
- accessible contrast for semantic pairings.
128
-
129
- ## Browser-safe palette functions
130
-
131
- Import these from `argot-css/palette`.
132
-
133
- ### `normalizePaletteDefinition(value: unknown): NormalizedPaletteDefinition`
134
-
135
- Validate external input and return fresh color records with all option defaults
136
- explicit. Does not calculate steps or map gamut.
137
-
138
- ```js
139
- import { normalizePaletteDefinition } from 'argot-css/palette';
140
-
141
- const definition = normalizePaletteDefinition({
142
- version: 1,
143
- colors: [{ name: 'brand', l: 0.6, c: 0.2, h: 250 }],
144
- });
145
- // => {
146
- // version: 1,
147
- // colors: [{ name: 'brand', l: 0.6, c: 0.2, h: 250 }],
148
- // options: {
149
- // lightnessCurve: 'uniform',
150
- // chromaCurve: 'centered',
151
- // format: 'oklch',
152
- // gamut: 'p3',
153
- // },
154
- // }
155
- ```
156
-
157
- The result remains a version-1 definition suitable for generation or export. Use
158
- this boundary for data from JSON files, browser forms, or another tool.
159
-
160
- ### `serializePaletteDefinition(definition: PaletteDefinition): string`
161
-
162
- Validate/normalize the definition and return two-space-indented JSON with a
163
- trailing newline and explicit defaults. Serializes generation inputs, not
164
- generated steps or CSS.
165
-
166
- ```js
167
- import { serializePaletteDefinition } from 'argot-css/palette';
168
-
169
- const portableJson = serializePaletteDefinition({
170
- version: 1,
171
- colors: [{ name: 'brand', l: 0.6, c: 0.2, h: 250 }],
172
- });
173
- // => `{
174
- // "version": 1,
175
- // "colors": [
176
- // {
177
- // "name": "brand",
178
- // "l": 0.6,
179
- // "c": 0.2,
180
- // "h": 250
181
- // }
182
- // ],
183
- // "options": {
184
- // "lightnessCurve": "uniform",
185
- // "chromaCurve": "centered",
186
- // "format": "oklch",
187
- // "gamut": "p3"
188
- // }
189
- // }\n`
190
- ```
191
-
192
- ### `parseCssColor(value: string): OklchColor`
193
-
194
- Optional input adapter that converts a standalone opaque CSS color into numeric
195
- `{ l, c, h }`. It accepts supported CSS color syntax such as hex, named colors,
196
- and `oklch()`. It rejects transparent colors, malformed colors, and
197
- context-dependent values such as `currentColor` and `var(--brand)`.
198
-
199
- Achromatic CSS colors with no hue receive `h: 0`. Tiny floating-point excursions
200
- at the lightness endpoints caused by conversion are tolerated and clamped here,
201
- not in numeric definition validation. No output-gamut mapping is performed.
202
-
203
- ```js
204
- import { parseCssColor } from 'argot-css/palette';
205
-
206
- const seed = parseCssColor('#663399');
207
- // => { l: 0.4402…, c: 0.1602…, h: 303.37… }
208
-
209
- const definition = {
210
- version: 1,
211
- colors: [{ name: 'brand', ...seed }],
212
- };
213
- ```
214
-
215
- ### `generatePalette(definition: PaletteDefinition): Palette`
216
-
217
- Validate inputs and return a fresh structured palette. The result contains raw,
218
- unrounded OKLCH coordinates before gamut mapping:
219
-
220
- ```ts
221
- interface Palette {
222
- version: 1;
223
- options: Required<PaletteOptions>;
224
- colors: {
225
- name: string;
226
- baseStep: number;
227
- steps: { step: number; l: number; c: number; h: number }[];
228
- }[];
229
- }
230
- ```
231
-
232
- Color order follows input order. `step` and `baseStep` are **one-based**, from 1
233
- through 16. Array indexes remain zero-based.
234
-
235
- ```js
236
- import { generatePalette } from 'argot-css/palette';
237
-
238
- const palette = generatePalette({
239
- version: 1,
240
- colors: [{ name: 'brand', l: 0.6, c: 0.2, h: 250 }],
241
- options: { lightnessCurve: 'inclusive' },
242
- });
243
- // => {
244
- // version: 1,
245
- // options: { lightnessCurve: 'inclusive', chromaCurve: 'centered',
246
- // format: 'oklch', gamut: 'p3' },
247
- // colors: [{
248
- // name: 'brand',
249
- // baseStep: 8,
250
- // steps: [
251
- // { step: 1, l: 0.98, c: 0.028, h: 250 },
252
- // // ... steps 2–7 ...
253
- // { step: 8, l: 0.6, c: 0.2, h: 250 },
254
- // // ... steps 9–15 ...
255
- // { step: 16, l: 0.1, c: 0.048, h: 250 },
256
- // ],
257
- // }],
258
- // }
259
-
260
- const brand = palette.colors[0];
261
- const rawBaseColor = brand.steps[brand.baseStep - 1];
262
- // => { step: 8, l: 0.6, c: 0.2, h: 250 }
263
- ```
264
-
265
- Format/gamut options are retained in the result but do not change its raw steps.
266
-
267
- ### `renderPaletteCss(palette: Palette): string`
268
-
269
- Render a generated model to a `:root` block containing `--name-1` through
270
- `--name-16`, followed by `--name: var(--name-N)` using `baseStep`. Returns CSS
271
- with a generated-file comment and trailing newline.
272
-
273
- Colors are mapped to the selected gamut using Color.js's `css` mapping method.
274
- OKLCH serialization uses Color.js precision `6`; hex is six-digit sRGB. Rounding
275
- is deferred until serialization. A neutral hue may serialize as `none`, which is
276
- valid CSS.
277
-
278
- Pass a model from `generatePalette()`. This is not a general-purpose validator
279
- for arbitrary imported palette models; import portable definitions instead.
280
-
281
- ```js
282
- import { generatePalette, renderPaletteCss } from 'argot-css/palette';
283
-
284
- const css = renderPaletteCss(
285
- generatePalette({
286
- version: 1,
287
- colors: [{ name: 'brand', l: 0.6, c: 0.2, h: 250 }],
288
- options: { lightnessCurve: 'inclusive' },
289
- }),
290
- );
291
- // => `/* Generated by Argot. */
292
- // :root {
293
- // --brand-1: oklch(97.6518% 0.017936 219.617);
294
- // /* ... --brand-2 through --brand-15 ... */
295
- // --brand-16: oklch(10.219% 0.045256 256.462);
296
- // --brand: var(--brand-8);
297
- // }
298
- // `
299
- ```
300
-
301
- ### `generatePaletteCss(definition: PaletteDefinition): string`
302
-
303
- Convenience composition of `generatePalette()` and `renderPaletteCss()`:
304
-
305
- ```js
306
- import { generatePaletteCss } from 'argot-css/palette';
307
-
308
- const css = generatePaletteCss({
309
- version: 1,
310
- colors: [{ name: 'brand', l: 0.6, c: 0.2, h: 250 }],
311
- options: { format: 'hex' },
312
- });
313
- // => `/* Generated by Argot. */
314
- // :root {
315
- // --brand-1: #ebfaff;
316
- // /* ... --brand-2 through --brand-15 ... */
317
- // --brand-16: #000312;
318
- // --brand: var(--brand-8);
319
- // }
320
- // `
321
- ```
322
-
323
- ### Exported palette types
324
-
325
- - Inputs: `OklchColor`, `SeedColor`, `PaletteDefinition`, `PaletteOptions`.
326
- - Validated definitions: `NormalizedPaletteDefinition`,
327
- `NormalizedPaletteOptions`.
328
- - Generated models: `Palette`, `PaletteScale`, `PaletteStep`.
329
- - Option unions: `LightnessCurve`, `ChromaCurve`, `ColorFormat`, `ColorGamut`.
330
-
331
- ```ts
332
- import { generatePaletteCss, type PaletteDefinition } from 'argot-css/palette';
333
-
334
- const definition = {
335
- version: 1,
336
- colors: [{ name: 'brand', l: 0.6, c: 0.2, h: 250 }],
337
- } satisfies PaletteDefinition;
338
- const css: string = generatePaletteCss(definition);
339
- ```
340
-
341
- TypeScript types do not replace runtime validation of imported JSON.
342
-
343
- ## Node palette file functions
344
-
345
- Import these from `argot-css/palette/node`. Neither is part of the browser-safe
346
- entrypoint. Relative paths resolve against `process.cwd()`.
347
-
348
- ### `loadPaletteDefinition(filename: string): NormalizedPaletteDefinition`
349
-
350
- Read UTF-8 JSON synchronously, parse it, and validate/normalize it. Read, JSON,
351
- and definition errors include the resolved input path.
352
-
353
- ```js
354
- import { loadPaletteDefinition } from 'argot-css/palette/node';
355
-
356
- // ./palette.json:
357
- // {
358
- // "version": 1,
359
- // "colors": [{ "name": "brand", "l": 0.6, "c": 0.2, "h": 250 }]
360
- // }
361
-
362
- const definition = loadPaletteDefinition('./palette.json');
363
- // => {
364
- // version: 1,
365
- // colors: [{ name: 'brand', l: 0.6, c: 0.2, h: 250 }],
366
- // options: {
367
- // lightnessCurve: 'uniform',
368
- // chromaCurve: 'centered',
369
- // format: 'oklch',
370
- // gamut: 'p3',
371
- // },
372
- // }
373
- ```
374
-
375
- ### `writePalette(outPath, definition, options?): WritePaletteResult`
376
-
377
- Generate CSS and synchronously write it to the designated output file.
378
- Parameters are `outPath: string`, `definition: PaletteDefinition`, and optional
379
- `options: WritePaletteOptions`.
380
-
381
- ```ts
382
- interface WritePaletteOptions {
383
- force?: boolean; // default false
384
- dryRun?: boolean; // default false
385
- }
386
-
387
- interface WritePaletteResult {
388
- path: string; // absolute output path
389
- css: string; // generated CSS, including for a dry run
390
- written: boolean;
391
- }
392
- ```
393
-
394
- - Missing parent directories are created only for a real write.
395
- - Existing files are refused unless `force: true`. Dry runs use the same path
396
- checks, so previewing over an existing file still needs `force: true` even
397
- though nothing is written.
398
- - Output directories and final-path symlinks are refused even with `force`.
399
- - Dry runs validate and render but do not create directories or modify output.
400
- - Invalid definitions fail before output directories or files are created.
401
-
402
- Filesystem failures throw. This function does not save the definition or update
403
- other project files. Choose distinct input and output locations.
404
-
405
- ```js
406
- import { writeFileSync } from 'node:fs';
407
- import { serializePaletteDefinition } from 'argot-css/palette';
408
- import { loadPaletteDefinition, writePalette } from 'argot-css/palette/node';
409
-
410
- const definition = loadPaletteDefinition('./palette.json');
411
-
412
- const preview = writePalette('./styles/primitives.css', definition, {
413
- dryRun: true,
414
- });
415
- // => { path: '/absolute/path/to/styles/primitives.css', written: false, css: '…' }
416
-
417
- const result = writePalette('./styles/primitives.css', definition);
418
- // => { path: '/absolute/path/to/styles/primitives.css', written: true, css: '…' }
419
-
420
- // Optional export of the portable inputs, separate from the CSS output.
421
- writeFileSync('./palette-export.json', serializePaletteDefinition(definition));
422
- ```
423
-
424
- `WritePaletteOptions` and `WritePaletteResult` are exported types from this Node
425
- entrypoint.
426
-
427
- ## CLI
428
-
429
- Install the package and use `argot` in npm scripts, or invoke it with
430
- `npm exec --package=argot-css -- argot ...`.
431
-
432
- ```sh
433
- argot palette ./palette.json
434
- argot palette ./palette.json ./styles/primitives.css
435
- argot palette ./palette.json ./styles/primitives.css --dry-run
436
- argot palette ./palette.json ./styles/primitives.css --force
437
- argot palette --help
438
- ```
439
-
440
- The default palette output is `./primitives.css`. The CLI uses
441
- [`writePalette()`](#writepaletteoutpath-definition-options-writepaletteresult)'s
442
- overwrite and dry-run rules, rejects identical resolved input/output paths, and
443
- reports failures on stderr with a nonzero exit status. It never runs Stylelint
444
- or semantic generation as a side effect.
445
-
446
- From a source checkout, `npm run dev -- palette ...` runs the same command using
447
- native TypeScript. The installed executable uses compiled JavaScript.
448
-
449
- ### Semantic templates
450
-
451
- Same behavior as [`argot-css/semantics`](#semantic-generation-library):
452
-
453
- ```sh
454
- argot generate
455
- argot generate ./styles/semantics.css --extended
456
- ```
457
-
458
- Default output is `./semantics.css`, with core semantic names and empty values.
459
- `--extended` includes both tiers. Assign values in the consumer project;
460
- primitive generation does not automatically populate semantic mappings.
461
-
462
- **Unlike the palette command, semantic generation currently overwrites existing
463
- files without `--force`.** Its CLI refuses output directories.
464
-
465
- ## Semantic generation library
466
-
467
- Import from `argot-css/semantics` (CLI:
468
- [`argot generate`](#semantic-templates)):
469
-
470
- - `generateCss(options?: TokenOptions): string`: load packaged semantic tokens
471
- and render their CSS template. `extended` defaults to `false`.
472
- - `renderCss(sections: readonly TokenSection[]): string`: render already-loaded
473
- token sections in order.
474
- - `writeTemplate(outPath: string, options?: TokenOptions): string`: create
475
- parent directories, write the template, and return its absolute path. Existing
476
- files are overwritten; filesystem errors throw.
477
-
478
- This entrypoint exports `TokenOptions`, `TokenRecord`, and `TokenSection`.
479
- `TokenOptions` has optional boolean `extended`. A section has `file`, `label`,
480
- and `tokens`; token records carry `name`, `value`, `description`, `tier`,
481
- `type`, `usage`, `pairsWith`, and `related`. Empty/null values render as empty
482
- declarations. Loading and indexing internals are not public package exports.
483
-
484
- ## Optional Stylelint integration
485
-
486
- Requires the optional Stylelint 16 peer dependency:
487
-
488
- ```js
489
- export default {
490
- extends: ['argot-css/stylelint/config'],
491
- };
492
- ```
493
-
494
- `argot-css/stylelint` default-exports the plugin array. The config entrypoint
495
- registers it and enables `argot/valid-token`.
496
-
497
- **The rule is currently a no-op placeholder**, not token-name enforcement,
498
- contrast validation, or build-time linting.
499
-
500
- ## Static data and styles
501
-
502
- Token JSON uses the packaged DTCG-shaped vocabulary, including descriptions,
503
- tiers, and optional relationship metadata. It is not a promise of full DTCG
504
- interchange support.
505
-
506
- ```js
507
- import textTokens from 'argot-css/tokens/color-text.json' with { type: 'json' };
508
- ```
509
-
510
- The two CSS templates export core or core-plus-extended semantic property names
511
- for projects that prefer a static import over
512
- [`generate` / `writeTemplate`](#semantic-generation-library). CSS import
513
- resolution depends on the consumer's build tooling. No PostCSS preset or
514
- processing command is shipped.
File without changes