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/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # The MIT License
2
2
 
3
- Copyright (c) 2026 Keith J. Grant
3
+ Copyright (c) 2026 Keith J. Grant and contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the “Software”), to deal in
package/README.md CHANGED
@@ -1,260 +1,39 @@
1
1
  # Argot
2
2
 
3
- A CSS preprocessor, streamlined for an era when we barely need preprocessors
4
- anymore.
3
+ A modular CSS toolset for modern CSS: processor, semantic tokens, palette
4
+ generation, optional linting, and a stylesheet scaffold. Published on npm as
5
+ **`argot-css`**; the CLI command is **`argot`**.
5
6
 
6
- Usage:
7
+ **Documentation:** [https://argot-css.dev/](https://argot-css.dev/)
7
8
 
8
- ```
9
- argot <input.css> <output.css> [--lint-config="path/to/stylelint-config"]
10
- ```
9
+ Argot is in active development. Semantic token names may still change; feedback
10
+ from real projects is welcome.
11
11
 
12
- What the processor does:
12
+ ## Quick start
13
13
 
14
- - Assemble — Embed CSS file partials using `@import`
15
- - Lint — uses [stylelint](https://stylelint.io/)
16
- - Minify — uses[cssnano](https://cssnano.github.io/cssnano/)
14
+ Requires **Node.js 22.18+** (native ESM).
17
15
 
18
- The `@import` at-rule can be used anywhere in your stylesheets. It supports all
19
- _preludes_ the native CSS `@import` supports:
20
-
21
- ```
22
- @import 'partial.css';
23
- @import 'partial.css' layer(modules);
24
- @import 'partial.css' supports(contrast-color(#ccc));
25
- @import 'partial.css' scope(.aside);
26
- @import 'partial.css' (min-width: 500px);
16
+ ```bash
17
+ npm install --save-dev argot-css
18
+ npx argot styles/index.css dist/styles.css
27
19
  ```
28
20
 
29
- Layer, supports, and scope may be specified in any order. Media queries must be
30
- listed last.
31
-
32
- ## Project scaffolding
33
-
34
- In addition to the preprocessor, Argot offers a number of tools for project
35
- scaffolding and design. The full pipeline is still very much under construction,
36
- but some of the pieces below are working.
37
-
38
- ## Semantic CSS custom properties
39
-
40
- A standardized set of **semantic design token names**, plus headless **primitive
41
- color palette generation**, packaged for modern CSS projects. Use either
42
- independently, or generate a palette and map semantic properties to it.
43
-
44
- See the [public API and CLI reference](./docs/api.md) for package imports,
45
- portable definitions, options, return values, and file-writing behavior.
46
-
47
- Argot is ready for beta use. The token set is deliberately defined; real-world
48
- adoption will help prove it out and refine it. Names may change during beta.
49
-
50
- ## Why this exists
51
-
52
- With modern CSS, preprocessors do less of the work we once needed them for.
53
- What’s still hard is _design architecture_: agreeing on which tokens mean what,
54
- and using them consistently.
55
-
56
- The expectation here is for CSS custom properties to
57
- [fall into three tiers](https://keithjgrant.com/posts/2024/06/a-structured-approach-to-custom-properties/):
58
-
59
- 1. **Primitive** — raw values providing theme colors, fonts, etc.
60
- 2. **Semantic** — building blocks applying primitive values to specific design
61
- intent
62
- 3. **Module** — variables scoped to a single component
63
-
64
- The semantic layer provides a carefully chosen set of names that could cover
65
- most of what most projects need, with only the _values_ changing per design. The
66
- palette engine supplies primitive color scales from numeric OKLCH seeds.
67
- Scaffold generation and CSS processing are planned, not currently shipped.
68
-
69
- ## What’s in this repo
70
-
71
- | Path | Purpose |
72
- | -------------------------- | -------------------------------------------------------------------------------------------------- |
73
- | [`tokens/`](./tokens/) | **Source of truth** — DTCG-shaped JSON for semantic token names, descriptions, and core/extended |
74
- | [`src/`](./src/) | TypeScript library and CLI source (+ optional Stylelint plugin) |
75
- | [`examples/`](./examples/) | Variable names pulled from existing frameworks for comparison/inspiration |
76
- | [`docs/`](./docs/) | [Public API](./docs/api.md) and planning notes, including [product scope](./docs/product-scope.md) |
77
-
78
- Tokens are grouped for backgrounds, text, brand/accent, status, typography,
79
- spacing, borders, shadow, focus, motion, layout, and charts. Tokens are marked
80
- with either "core" or "extended" tier.
81
-
82
- The examples are **reference material only** — Bootstrap, Bulma, PatternFly,
83
- Materialize, and others — to see how established systems name similar concepts.
84
- They are not dependencies and are not meant to be copied wholesale into the
85
- template.
86
-
87
- ## How to use the template (for now)
88
-
89
- The CLI requires Node.js 22.18 or newer. Argot uses native ES modules; no
90
- CommonJS build is provided. Published entrypoints contain JavaScript and
91
- TypeScript declarations, so consumers do not need a TypeScript compiler.
92
-
93
- 1. Emit a template into your project:
94
-
95
- ```bash
96
- npx argot-css semantics # core tokens → ./semantics.css
97
- npx argot-css semantics --extended # core + extended
98
- npx argot-css semantics ./tokens.css # custom output path
99
- ```
100
-
101
- 2. Assign values — typically by mapping to your own primitive palette.
102
- 3. Style with semantic names (`var(--text-primary)`) instead of primitives
103
- (`var(--gray-6)`).
104
-
105
- ### Stylelint rule
106
-
107
- Noop lint rule for now. Functionality remains TODO.
21
+ Other common commands:
108
22
 
109
- Requires Stylelint 16. This example uses an ESM configuration (a `.js` file in a
110
- project with `"type": "module"`, or a `stylelint.config.mjs` file).
111
-
112
- ```js
113
- // stylelint.config.js
114
- export default {
115
- extends: ['argot-css/stylelint/config'],
116
- };
23
+ ```bash
24
+ npx argot semantics ./styles/vars-semantic.css
25
+ npx argot palette ./palette.json ./styles/vars-primitive.css
26
+ npx argot scaffold
117
27
  ```
118
28
 
119
- Example shape:
120
-
121
- ```css
122
- :root {
123
- /* primitives (yours) */
124
- --gray-3: oklch(93% 0.006 245deg);
125
- --gray-6: oklch(55% 0.02 245deg);
126
-
127
- /* semantic (shared names) */
128
- --text-primary: var(--gray-3);
129
- --text-secondary: var(--gray-6);
130
- --bg-body: /* … */;
131
- }
132
- ```
133
-
134
- ## Primitive palette definitions
135
-
136
- Palette inputs use numeric OKLCH coordinates. Each color has a required name and
137
- `l`, `c`, `h`:
138
-
139
- - `l`: finite lightness from 0 through 1 (not 0 through 100).
140
- - `c`: finite, nonnegative chroma (0.0 through 0.42 for reasonable range).
141
- - `h`: a finite hue angle in degrees, including for neutral colors.
142
-
143
- Coordinates are retained as supplied, without hue wrapping, chroma thresholding,
144
- or rounding. Gamut mapping and final precision limiting happen during CSS
145
- output.
146
-
147
- ```json
148
- {
149
- "version": 1,
150
- "colors": [{ "name": "brand", "l": 0.6, "c": 0.2, "h": 250 }],
151
- "options": {
152
- "lightnessCurve": "inclusive",
153
- "chromaCurve": "weighted"
154
- }
155
- }
156
- ```
157
-
158
- In a checkout, try
159
- `npm run dev -- palette scripts/fixtures/palette.json ./primitives.css` using
160
- the [sample definition](./scripts/fixtures/palette.json). Existing output
161
- requires `--force` to replace; `--dry-run` validates without writing.
162
-
163
- The browser-safe `argot-css/palette` entrypoint exports `SeedColor`,
164
- `OklchColor`, `PaletteDefinition`, and the generation functions. If an input
165
- interface accepts CSS strings, call the separate `parseCssColor()` helper and
166
- compose a numeric seed such as `{ name: 'brand', ...parseCssColor('#663399') }`.
167
- Definitions themselves do not accept CSS strings. JSON loading and serialization
168
- preserve numeric generation inputs rather than converting them to CSS and
169
- reparsing them.
170
-
171
- ## Development
172
-
173
- Library source lives in `src/*.ts` and `src/` subdirectories. Node 22.18+
174
- executes this source natively by stripping types; it does not check types. Use
175
- `.ts` extensions for relative source imports, `import type` for type-only
176
- imports, and erasable syntax (no runtime enums or parameter properties).
177
-
178
- - `npm run dev -- help` — run the CLI from TypeScript source, without a build.
179
- - `npm run dev -- generate ./semantics.css` — generate a semantic template
180
- directly from source.
181
- - `npm run typecheck` — strictly check the library without emitting files.
182
- - `npm run build` — emit ESM JavaScript, declarations, and source maps into
183
- ignored `dist/`. Relative runtime imports are rewritten to `.js`.
184
- - `npm test` — build, check public declarations, and run runtime and
185
- packed-package tests, including the palette curve regressions.
186
- - `npm run test:types` — check Node and browser consumer types against an
187
- existing build.
188
- - `npm run test:package` — build through the pack hook and check the archive
189
- outside the checkout; no publishing or registry access is involved.
190
- - `npm run build:template` — regenerate checked-in semantic CSS using native
191
- TypeScript execution.
192
- - `npm run prettier` / `npm run prettier:fix` — check or apply formatting.
193
-
194
- `npm pack` and publishing run the build automatically through `prepack`.
195
- Published exports and `bin/argot.js` use `dist/`; run the build before invoking
196
- that executable directly from a checkout. For normal development use
197
- `npm run dev -- ...` instead. Tests and website files remain JavaScript. The
198
- `./palette` entrypoint is browser-safe and exports its public types; filesystem
199
- adapters live separately at `./palette/node`.
200
-
201
- ## Documentation website
202
-
203
- The Eleventy site lives in `website/`. Token reference pages are generated at
204
- build time from `tokens/*.json`, using the same loader as the CSS generator.
205
- Group introductions and CSS examples live separately in `website/lib/guides.js`.
206
- The site imports the token loader directly from TypeScript source: website
207
- development, tests, and builds do not require `dist/` or a compiler-watch
208
- process. An explicit watch hook reloads the native token loader when TypeScript
209
- source changes, avoiding Eleventy's JavaScript-only dependency parser.
210
-
211
- - `npm run website:dev` — serve locally with live reload, including token edits.
212
- - `npm run website:build` — build static files into `website/_site/`.
213
- - `npm run website:test` — check metadata, token coverage, links, URL prefixes,
214
- and filtering behavior.
215
- - `npm run website:format` — format supported website files with Prettier.
216
- - `npm run website:lint` — check website CSS with Stylelint.
217
- - `npm run website:lint:fix` — apply available Stylelint fixes.
218
-
219
- Edit CSS in `website/content/assets/`. The entrypoint, `site.css`, imports
220
- underscore-prefixed partials such as `_theme.css` and `_base.css` in cascade
221
- order. Add a partial with a local import such as `@import './_buttons.css';`.
222
- The PostCSS plugin recognizes the underscore prefix and does not emit partials
223
- as separate stylesheets.
224
-
225
- `@jgarber/eleventy-plugin-postcss` processes the CSS entrypoint using the root
226
- `postcss.config.js` and `postcss-import`, producing a single `assets/site.css`.
227
- Partial edits rebuild automatically during `website:dev`; missing imports fail
228
- the CSS build. Restart the dev server after changing the PostCSS config.
229
-
230
- Stylelint runs separately via `website:lint`, and automatically before
231
- `npm run website:build` using an npm pre-script. Dev builds do not run lint on
232
- every save. Prettier handles formatting; CSS is otherwise left native, without
233
- prefixing, transpilation, or minification.
234
-
235
- To build for hosting under `/argot/`, run
236
- `npm run website:build -- --pathprefix=/argot/`. This prefixes internal URLs;
237
- place the contents of `website/_site/` in the host's `argot/` directory.
238
- `WEBSITE_PATH_PREFIX` can also supply the prefix in build environments.
239
-
240
- The reference works without JavaScript; JavaScript adds search and tier
241
- filtering. Website files and dependencies are not included in the published
242
- library package.
243
-
244
- ## Contributing / discussion
29
+ See [Getting started](https://argot-css.dev/docs/getting-started/) on the site.
245
30
 
246
- Help is welcome — especially bikeshedding names, deciding what belongs in the
247
- “core” set vs. project-specific extras, and comparing against real design
248
- systems.
31
+ ## Programmatic API
249
32
 
250
- Open a [GitHub issue](https://github.com/keithjgrant/argot/issues) or
251
- [discussion](https://github.com/keithjgrant/argot/discussions). Useful feedback
252
- includes:
33
+ Library entrypoints, options, and return types:
34
+ [JavaScript API](https://argot-css.dev/docs/reference/api/).
253
35
 
254
- - Tokens that are missing for common UI needs
255
- - Tokens that feel too vague, redundant, or framework-specific
256
- - Naming that collides with how you already think about a design
257
- - Gaps revealed by comparing against the files in `examples/`
36
+ ## Contributing
258
37
 
259
- The aim is a list general enough for many projects, not tailored to one person’s
260
- stylesheet. Feedback grounded in real-world use is especially helpful.
38
+ Issues, discussions, and how to work in this repo:
39
+ [`CONTRIBUTING.md`](./CONTRIBUTING.md).
@@ -0,0 +1,11 @@
1
+ export type SeedColor = string | [name: string, color: string];
2
+ export interface ArgotConfig {
3
+ cssSource?: string;
4
+ cssDest?: string;
5
+ lintConfig?: string;
6
+ minify?: boolean | 'both';
7
+ seedColors?: SeedColor[];
8
+ semanticSet?: 'core' | 'extended';
9
+ scaffoldBaseDir?: string;
10
+ }
11
+ export declare function getConfig(): Promise<any>;
@@ -0,0 +1,37 @@
1
+ import { createRequire } from 'module';
2
+ import { FileSearcher } from 'search-closest';
3
+ const CONFIG_FILES = [
4
+ {
5
+ name: 'package.json',
6
+ async filter({ path }) {
7
+ try {
8
+ return Boolean(await loadConfigFromPackageJson(path));
9
+ }
10
+ catch {
11
+ return false;
12
+ }
13
+ },
14
+ },
15
+ '.argot.json',
16
+ '.argotrc.json',
17
+ 'argot.config.json',
18
+ ];
19
+ const require = createRequire(import.meta.url);
20
+ async function loadConfigFromPackageJson(path) {
21
+ const json = require(path);
22
+ return !!json.argot;
23
+ }
24
+ export async function getConfig() {
25
+ const searcher = new FileSearcher(CONFIG_FILES);
26
+ const startDirectory = process.cwd();
27
+ const path = await searcher.search(startDirectory);
28
+ if (path === undefined) {
29
+ return undefined;
30
+ }
31
+ const result = require(path);
32
+ if (path.endsWith('package.json')) {
33
+ return result.argot;
34
+ }
35
+ return result;
36
+ }
37
+ //# sourceMappingURL=getConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getConfig.js","sourceRoot":"","sources":["../../src/cli/getConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AAgBpE,MAAM,YAAY,GAAmB;IACnC;QACE,IAAI,EAAE,cAAc;QACpB,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAoB;YACrC,IAAI,CAAC;gBACH,OAAO,OAAO,CAAC,MAAM,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC;YACxD,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;KACF;IACD,aAAa;IACb,eAAe;IACf,mBAAmB;CACpB,CAAC;AAEF,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,KAAK,UAAU,yBAAyB,CAAC,IAAY;IACnD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;AACtB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,MAAM,QAAQ,GAAG,IAAI,YAAY,CAAC,YAAY,CAAC,CAAC;IAEhD,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACrC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAEnD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7B,IAAI,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { createRequire } from 'module';\nimport { FileSearcher, type SearcherOptions } from 'search-closest';\n\nexport type SeedColor = string | [name: string, color: string];\nexport interface ArgotConfig {\n cssSource?: string;\n cssDest?: string;\n lintConfig?: string;\n minify?: boolean | 'both';\n seedColors?: SeedColor[];\n semanticSet?: 'core' | 'extended';\n scaffoldBaseDir?: string;\n}\n\ntype SearchTarget =\n string | { name: string; filter: SearcherOptions['filter'] };\n\nconst CONFIG_FILES: SearchTarget[] = [\n {\n name: 'package.json',\n async filter({ path }: { path: string }) {\n try {\n return Boolean(await loadConfigFromPackageJson(path));\n } catch {\n return false;\n }\n },\n },\n '.argot.json',\n '.argotrc.json',\n 'argot.config.json',\n];\n\nconst require = createRequire(import.meta.url);\n\nasync function loadConfigFromPackageJson(path: string) {\n const json = require(path);\n return !!json.argot;\n}\n\nexport async function getConfig() {\n const searcher = new FileSearcher(CONFIG_FILES);\n\n const startDirectory = process.cwd();\n const path = await searcher.search(startDirectory);\n\n if (path === undefined) {\n return undefined;\n }\n const result = require(path);\n\n if (path.endsWith('package.json')) {\n return result.argot;\n }\n\n return result;\n}\n"]}
package/dist/cli/print.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ANSI_WHITE, ANSI_RED } from "./ansiColors.js";
2
2
  export function print(message, color = ANSI_WHITE) {
3
- console.log(`${color}${message}${ANSI_WHITE}\n`);
3
+ console.log(`${color}${message}${ANSI_WHITE}`);
4
4
  }
5
5
  export function printError(error) {
6
6
  const isError = error instanceof Error;
@@ -1 +1 @@
1
- {"version":3,"file":"print.js","sourceRoot":"","sources":["../../src/cli/print.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,UAAU,KAAK,CAAC,OAAe,EAAE,QAAgB,UAAU;IAC/D,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,OAAO,GAAG,UAAU,IAAI,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC;IACvC,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IAEpE,OAAO,CAAC,KAAK,CAAC,GAAG,QAAQ,UAAU,OAAO,GAAG,UAAU,IAAI,CAAC,CAAC;IAE7D,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;AACH,CAAC","sourcesContent":["import { ANSI_WHITE, ANSI_RED } from './ansiColors.ts';\n\nexport function print(message: string, color: string = ANSI_WHITE): void {\n console.log(`${color}${message}${ANSI_WHITE}\\n`);\n}\n\nexport function printError(error: unknown): void {\n const isError = error instanceof Error;\n const message = isError ? `${error.name}: ${error.message}` : error;\n\n console.error(`${ANSI_RED}argot: ${message}${ANSI_WHITE}\\n`);\n\n if (isError && process.argv.includes('--verbose')) {\n console.log(error);\n }\n}\n"]}
1
+ {"version":3,"file":"print.js","sourceRoot":"","sources":["../../src/cli/print.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,UAAU,KAAK,CAAC,OAAe,EAAE,QAAgB,UAAU;IAC/D,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,OAAO,GAAG,UAAU,EAAE,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC;IACvC,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IAEpE,OAAO,CAAC,KAAK,CAAC,GAAG,QAAQ,UAAU,OAAO,GAAG,UAAU,IAAI,CAAC,CAAC;IAE7D,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;AACH,CAAC","sourcesContent":["import { ANSI_WHITE, ANSI_RED } from './ansiColors.ts';\n\nexport function print(message: string, color: string = ANSI_WHITE): void {\n console.log(`${color}${message}${ANSI_WHITE}`);\n}\n\nexport function printError(error: unknown): void {\n const isError = error instanceof Error;\n const message = isError ? `${error.name}: ${error.message}` : error;\n\n console.error(`${ANSI_RED}argot: ${message}${ANSI_WHITE}\\n`);\n\n if (isError && process.argv.includes('--verbose')) {\n console.log(error);\n }\n}\n"]}
package/dist/cli/run.js CHANGED
@@ -1,31 +1,44 @@
1
1
  import { USAGE } from "./usage.js";
2
2
  import { runSemantics } from "../semantics/cli.js";
3
3
  import { runPalette } from "../palette/cli.js";
4
+ import { runScaffold } from "../scaffold/cli.js";
4
5
  import { runProcessor } from "../processor/cli.js";
5
6
  import { printError } from "./print.js";
7
+ import { getConfig } from "../config/getConfig.js";
6
8
  async function run() {
7
9
  try {
8
- await handleArgs(process.argv.slice(2));
10
+ await routeArgs(process.argv.slice(2));
9
11
  }
10
12
  catch (e) {
11
13
  printError(e);
12
14
  process.exit(1);
13
15
  }
14
16
  }
15
- async function handleArgs(args) {
17
+ async function routeArgs(args) {
16
18
  const [command, ...rest] = args;
17
- if (!command || ['help', '--help', '-h'].includes(command)) {
19
+ const config = await getConfig();
20
+ if (!command && !config) {
21
+ process.stdout.write(USAGE);
22
+ return;
23
+ }
24
+ if (['help', '--help', '-h'].includes(command)) {
18
25
  process.stdout.write(USAGE);
19
26
  return;
20
27
  }
21
28
  if (command === 'semantics') {
22
- return await runSemantics(rest);
29
+ return await runSemantics(rest, config);
23
30
  }
24
31
  if (command === 'palette') {
25
- return await runPalette(rest);
32
+ return await runPalette(rest, config);
33
+ }
34
+ if (command === 'process') {
35
+ return await runProcessor(rest, config);
36
+ }
37
+ if (command === 'scaffold') {
38
+ return await runScaffold(rest, config);
26
39
  }
27
- if (command.endsWith('.css')) {
28
- return await runProcessor(args);
40
+ if (!command || command.endsWith('.css')) {
41
+ return await runProcessor(args, config);
29
42
  }
30
43
  printError(`Unknown command: ${command}`);
31
44
  process.exit(1);
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,KAAK,UAAU,GAAG;IAChB,IAAI,CAAC;QACH,MAAM,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,UAAU,CAAC,CAAC,CAAC,CAAC;QACd,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,IAAc;IACtC,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAEhC,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5B,OAAO;IACT,CAAC;IAED,IAAI,OAAO,KAAK,WAAW,EAAE,CAAC;QAC5B,OAAO,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,OAAO,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,UAAU,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,OAAO,EAAE,GAAG,EAAE,CAAC","sourcesContent":["import { USAGE } from './usage.ts';\nimport { runSemantics } from '../semantics/cli.ts';\nimport { runPalette } from '../palette/cli.ts';\nimport { runProcessor } from '../processor/cli.ts';\nimport { printError } from './print.ts';\n\nasync function run() {\n try {\n await handleArgs(process.argv.slice(2));\n } catch (e) {\n printError(e);\n process.exit(1);\n }\n}\n\nasync function handleArgs(args: string[]) {\n const [command, ...rest] = args;\n\n if (!command || ['help', '--help', '-h'].includes(command)) {\n process.stdout.write(USAGE);\n return;\n }\n\n if (command === 'semantics') {\n return await runSemantics(rest);\n }\n\n if (command === 'palette') {\n return await runPalette(rest);\n }\n\n if (command.endsWith('.css')) {\n return await runProcessor(args);\n }\n\n printError(`Unknown command: ${command}`);\n process.exit(1);\n}\n\nexport { run };\n"]}
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,KAAK,UAAU,GAAG;IAChB,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,UAAU,CAAC,CAAC,CAAC,CAAC;QACd,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,KAAK,UAAU,SAAS,CAAC,IAAc;IACrC,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAChC,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC;IAEjC,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;QACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5B,OAAO;IACT,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5B,OAAO;IACT,CAAC;IAED,IAAI,OAAO,KAAK,WAAW,EAAE,CAAC;QAC5B,OAAO,MAAM,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,MAAM,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,MAAM,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,OAAO,KAAK,UAAU,EAAE,CAAC;QAC3B,OAAO,MAAM,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACzC,OAAO,MAAM,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED,UAAU,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,OAAO,EAAE,GAAG,EAAE,CAAC","sourcesContent":["import { USAGE } from './usage.ts';\nimport { runSemantics } from '../semantics/cli.ts';\nimport { runPalette } from '../palette/cli.ts';\nimport { runScaffold } from '../scaffold/cli.ts';\nimport { runProcessor } from '../processor/cli.ts';\nimport { printError } from './print.ts';\nimport { getConfig } from '../config/getConfig.ts';\n\nasync function run() {\n try {\n await routeArgs(process.argv.slice(2));\n } catch (e) {\n printError(e);\n process.exit(1);\n }\n}\n\nasync function routeArgs(args: string[]) {\n const [command, ...rest] = args;\n const config = await getConfig();\n\n if (!command && !config) {\n process.stdout.write(USAGE);\n return;\n }\n\n if (['help', '--help', '-h'].includes(command)) {\n process.stdout.write(USAGE);\n return;\n }\n\n if (command === 'semantics') {\n return await runSemantics(rest, config);\n }\n\n if (command === 'palette') {\n return await runPalette(rest, config);\n }\n\n if (command === 'process') {\n return await runProcessor(rest, config);\n }\n\n if (command === 'scaffold') {\n return await runScaffold(rest, config);\n }\n\n if (!command || command.endsWith('.css')) {\n return await runProcessor(args, config);\n }\n\n printError(`Unknown command: ${command}`);\n process.exit(1);\n}\n\nexport { run };\n"]}
@@ -1,2 +1,2 @@
1
- declare const USAGE = "Usage:\n argot [sourceFile.css] [destFile.css] Process CSS\n argot semantics [path] [--extended] Write semantic CSS template (default: ./semantics.css)\n argot palette <definition.json> [output.css] [--force] [--dry-run]\n Write primitive CSS (default: ./primitives.css)\n argot help Show this help\n\nOptions:\n --extended Include extended-tier tokens (default: core only)\n\nExamples:\n npx argot-css semantics\n npx argot-css semantics --extended\n npx argot-css semantics ./styles/tokens.css --extended\n";
1
+ declare const USAGE = "Usage:\n argot [sourceFile.css] [destFile.css] Process CSS\n argot scaffold [--directory \"./path/to/directory\"] [--force] [--dry-run]\n Write new project CSS scaffold\n argot semantics [path] [--extended] [--force] [--dry-run]\n Write semantic CSS template (default: ./vars-semantic.css)\n argot palette [output.css] [--force] [--dry-run]\n Write primitive CSS (default: ./vars-primitive.css)\n argot help Show this help\n\nOptions:\n --extended Include extended-tier tokens (default: core only)\n\nExamples:\n npx argot-css semantics\n npx argot-css semantics --extended\n npx argot-css semantics ./styles/tokens.css --extended\n";
2
2
  export { USAGE };
package/dist/cli/usage.js CHANGED
@@ -1,9 +1,12 @@
1
1
  const USAGE = `Usage:
2
- argot [sourceFile.css] [destFile.css] Process CSS
3
- argot semantics [path] [--extended] Write semantic CSS template (default: ./semantics.css)
4
- argot palette <definition.json> [output.css] [--force] [--dry-run]
5
- Write primitive CSS (default: ./primitives.css)
6
- argot help Show this help
2
+ argot [sourceFile.css] [destFile.css] Process CSS
3
+ argot scaffold [--directory "./path/to/directory"] [--force] [--dry-run]
4
+ Write new project CSS scaffold
5
+ argot semantics [path] [--extended] [--force] [--dry-run]
6
+ Write semantic CSS template (default: ./vars-semantic.css)
7
+ argot palette [output.css] [--force] [--dry-run]
8
+ Write primitive CSS (default: ./vars-primitive.css)
9
+ argot help Show this help
7
10
 
8
11
  Options:
9
12
  --extended Include extended-tier tokens (default: core only)
@@ -1 +1 @@
1
- {"version":3,"file":"usage.js","sourceRoot":"","sources":["../../src/cli/usage.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GAAG;;;;;;;;;;;;;;CAcb,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC","sourcesContent":["const USAGE = `Usage:\n argot [sourceFile.css] [destFile.css] Process CSS\n argot semantics [path] [--extended] Write semantic CSS template (default: ./semantics.css)\n argot palette <definition.json> [output.css] [--force] [--dry-run]\n Write primitive CSS (default: ./primitives.css)\n argot help Show this help\n\nOptions:\n --extended Include extended-tier tokens (default: core only)\n\nExamples:\n npx argot-css semantics\n npx argot-css semantics --extended\n npx argot-css semantics ./styles/tokens.css --extended\n`;\n\nexport { USAGE };\n"]}
1
+ {"version":3,"file":"usage.js","sourceRoot":"","sources":["../../src/cli/usage.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;CAiBb,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC","sourcesContent":["const USAGE = `Usage:\n argot [sourceFile.css] [destFile.css] Process CSS\n argot scaffold [--directory \"./path/to/directory\"] [--force] [--dry-run]\n Write new project CSS scaffold\n argot semantics [path] [--extended] [--force] [--dry-run]\n Write semantic CSS template (default: ./vars-semantic.css)\n argot palette [output.css] [--force] [--dry-run]\n Write primitive CSS (default: ./vars-primitive.css)\n argot help Show this help\n\nOptions:\n --extended Include extended-tier tokens (default: core only)\n\nExamples:\n npx argot-css semantics\n npx argot-css semantics --extended\n npx argot-css semantics ./styles/tokens.css --extended\n`;\n\nexport { USAGE };\n"]}
@@ -0,0 +1 @@
1
+ export declare function getConfig(): Promise<any>;
@@ -0,0 +1,38 @@
1
+ import { createRequire } from 'module';
2
+ import { FileSearcher } from 'search-closest';
3
+ const CONFIG_FILES = [
4
+ {
5
+ name: 'package.json',
6
+ async filter({ path }) {
7
+ try {
8
+ return Boolean(await loadConfigFromPackageJson(path));
9
+ }
10
+ catch {
11
+ return false;
12
+ }
13
+ },
14
+ },
15
+ '.argot.json',
16
+ 'argot.json',
17
+ '.argotrc.json',
18
+ 'argot.config.json',
19
+ ];
20
+ const require = createRequire(import.meta.url);
21
+ async function loadConfigFromPackageJson(path) {
22
+ const json = require(path);
23
+ return !!json.argot;
24
+ }
25
+ export async function getConfig() {
26
+ const searcher = new FileSearcher(CONFIG_FILES);
27
+ const startDirectory = process.cwd();
28
+ const path = await searcher.search(startDirectory);
29
+ if (path === undefined) {
30
+ return undefined;
31
+ }
32
+ const result = require(path);
33
+ if (path.endsWith('package.json')) {
34
+ return result.argot;
35
+ }
36
+ return result;
37
+ }
38
+ //# sourceMappingURL=getConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getConfig.js","sourceRoot":"","sources":["../../src/config/getConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AAKpE,MAAM,YAAY,GAAmB;IACnC;QACE,IAAI,EAAE,cAAc;QACpB,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAoB;YACrC,IAAI,CAAC;gBACH,OAAO,OAAO,CAAC,MAAM,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC;YACxD,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;KACF;IACD,aAAa;IACb,YAAY;IACZ,eAAe;IACf,mBAAmB;CACpB,CAAC;AAEF,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,KAAK,UAAU,yBAAyB,CAAC,IAAY;IACnD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;AACtB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,MAAM,QAAQ,GAAG,IAAI,YAAY,CAAC,YAAY,CAAC,CAAC;IAEhD,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACrC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAEnD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7B,IAAI,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { createRequire } from 'module';\nimport { FileSearcher, type SearcherOptions } from 'search-closest';\n\ntype SearchTarget =\n string | { name: string; filter: SearcherOptions['filter'] };\n\nconst CONFIG_FILES: SearchTarget[] = [\n {\n name: 'package.json',\n async filter({ path }: { path: string }) {\n try {\n return Boolean(await loadConfigFromPackageJson(path));\n } catch {\n return false;\n }\n },\n },\n '.argot.json',\n 'argot.json',\n '.argotrc.json',\n 'argot.config.json',\n];\n\nconst require = createRequire(import.meta.url);\n\nasync function loadConfigFromPackageJson(path: string) {\n const json = require(path);\n return !!json.argot;\n}\n\nexport async function getConfig() {\n const searcher = new FileSearcher(CONFIG_FILES);\n\n const startDirectory = process.cwd();\n const path = await searcher.search(startDirectory);\n\n if (path === undefined) {\n return undefined;\n }\n const result = require(path);\n\n if (path.endsWith('package.json')) {\n return result.argot;\n }\n\n return result;\n}\n"]}
@@ -0,0 +1,31 @@
1
+ import type { LightnessCurveEnum, ChromaCurveEnum, ColorFormatEnum } from '../palette/types.ts';
2
+ export interface ProcessorConfig {
3
+ source?: string;
4
+ destination?: string;
5
+ lintConfig?: string;
6
+ minify?: boolean | 'both';
7
+ }
8
+ export type SeedColor = string | {
9
+ name?: string;
10
+ color: string;
11
+ };
12
+ export interface PaletteDefinition {
13
+ version?: 1;
14
+ seedColors?: readonly SeedColor[];
15
+ lightnessCurve?: LightnessCurveEnum;
16
+ chromaCurve?: ChromaCurveEnum;
17
+ format?: ColorFormatEnum;
18
+ }
19
+ export interface PaletteConfig extends PaletteDefinition {
20
+ output?: string;
21
+ }
22
+ export interface SemanticDefinition {
23
+ output?: string;
24
+ set: 'core' | 'extended';
25
+ }
26
+ export interface ArgotConfig {
27
+ processor?: ProcessorConfig;
28
+ scaffoldDirectory?: string;
29
+ palette?: PaletteConfig;
30
+ semantics?: SemanticDefinition;
31
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n LightnessCurveEnum,\n ChromaCurveEnum,\n ColorFormatEnum,\n} from '../palette/types.ts';\n\nexport interface ProcessorConfig {\n source?: string;\n destination?: string;\n lintConfig?: string;\n minify?: boolean | 'both';\n}\n\nexport type SeedColor =\n | string\n | {\n name?: string;\n color: string;\n };\n\nexport interface PaletteDefinition {\n version?: 1;\n seedColors?: readonly SeedColor[];\n lightnessCurve?: LightnessCurveEnum;\n chromaCurve?: ChromaCurveEnum;\n format?: ColorFormatEnum;\n}\n\nexport interface PaletteConfig extends PaletteDefinition {\n output?: string;\n}\n\nexport interface SemanticDefinition {\n output?: string;\n set: 'core' | 'extended';\n}\n\nexport interface ArgotConfig {\n processor?: ProcessorConfig;\n scaffoldDirectory?: string;\n palette?: PaletteConfig;\n semantics?: SemanticDefinition;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import type { ArgotConfig } from './types.ts';
2
+ export declare function getScaffoldDirectory(config: ArgotConfig): string;
@@ -0,0 +1,4 @@
1
+ export function getScaffoldDirectory(config) {
2
+ return config?.scaffoldDirectory ?? 'styles';
3
+ }
4
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/config/util.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,oBAAoB,CAAC,MAAmB;IACtD,OAAO,MAAM,EAAE,iBAAiB,IAAI,QAAQ,CAAC;AAC/C,CAAC","sourcesContent":["import type { ArgotConfig } from './types.ts';\n\nexport function getScaffoldDirectory(config: ArgotConfig) {\n return config?.scaffoldDirectory ?? 'styles';\n}\n"]}
@@ -0,0 +1,24 @@
1
+ export type ExistsMessage = (resolved: string) => string;
2
+ export interface WriteOutputOptions {
3
+ force?: boolean;
4
+ dryRun?: boolean;
5
+ /** When true, skip preflight (caller already checked all targets). */
6
+ skipAssert?: boolean;
7
+ }
8
+ export interface AssertWritableOptions {
9
+ force?: boolean;
10
+ existsMessage?: ExistsMessage;
11
+ }
12
+ export interface WriteOutputResult {
13
+ path: string;
14
+ written: boolean;
15
+ }
16
+ declare function defaultExistsMessage(resolved: string): string;
17
+ declare function assertWritableOutputFile(resolved: string, { force, existsMessage, }?: AssertWritableOptions): void;
18
+ declare function writeOutputFile(resolved: string, contents: string, { force }?: {
19
+ force?: boolean;
20
+ }): void;
21
+ declare function writeOutput(outPath: string, contents: string, { force, dryRun, skipAssert, existsMessage, }?: WriteOutputOptions & {
22
+ existsMessage?: ExistsMessage;
23
+ }): WriteOutputResult;
24
+ export { assertWritableOutputFile, defaultExistsMessage, writeOutput, writeOutputFile, };