@gesslar/sassy 0.22.0 → 1.0.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/README.md CHANGED
@@ -98,7 +98,7 @@ npx @gesslar/sassy lint my-theme.yaml
98
98
  ### Build Command Options
99
99
 
100
100
  | Option | Description |
101
- |--------|-------------|
101
+ | -------- | ------------- |
102
102
  | `-w, --watch` | Watch files and rebuild on changes |
103
103
  | `-o, --output-dir <dir>` | Specify output directory |
104
104
  | `-n, --dry-run` | Print JSON to stdout instead of writing files |
@@ -132,7 +132,7 @@ output.
132
132
  ### Resolve Command Options
133
133
 
134
134
  | Option | Description |
135
- |--------|-------------|
135
+ | -------- | ------------- |
136
136
  | `-c, --color <key>` | Resolve a specific color property to its final value |
137
137
  | `-t, --tokenColor <scope>` | Resolve tokenColors for a specific scope |
138
138
  | `-s, --semanticTokenColor <token>` | Resolve semantic token colors for a specific token type |
@@ -222,7 +222,7 @@ to least specific.
222
222
  ### Lint Command Options
223
223
 
224
224
  | Option | Description |
225
- |--------|-------------|
225
+ | -------- | ------------- |
226
226
  | `--nerd` | Show detailed error traces if linting fails |
227
227
 
228
228
  ## Basic Theme Structure
@@ -297,33 +297,24 @@ functions in the [Culori documentation](https://culorijs.org/).
297
297
  Make colours that work together:
298
298
 
299
299
  | Function | Example | Result |
300
- |----------|---------|--------|
300
+ | ---------- | --------- | -------- |
301
301
  | `lighten(colour, %=0-100)` | `lighten($(bg), 25)` | 25% lighter background |
302
302
  | `darken(colour, %=0-100)` | `darken($(accent), 30)` | 30% darker accent |
303
- | || |
304
303
  | `alpha(colour, alpha=0-1)` | `alpha($(brand), 0.5)` | Set exact transparency |
305
304
  | `fade(colour, alpha=0-1)` | `fade($(accent), 0.5)` | Reduce opacity by 50% |
306
305
  | `solidify(colour, alpha=0-1)` | `solidify($(bg.accent), 0.3)` | Increase opacity by 30% |
307
- | || |
308
306
  | `mix(colour1, colour2, %=0-100)` | `mix($(fg), $(accent), 20)` | Blend 20% accent |
309
307
  | `mix(colour1, colour2)` | `mix($(fg), $(accent))` | Blend 50% accent |
310
- | || |
311
308
  | `invert(colour)` | `invert($(fg))` | Perfect opposite |
312
- | || |
313
309
  | `hsv(h=0-255, s=0-255, v=0-255)` | `hsv(50, 200, 180)` | HSV colour (hue 50, saturation 200, value 180) |
314
310
  | `hsva(h=0-255, s=0-255, v=0-255, a=0-1)` | `hsva(50, 200, 180, 0.5)` | HSV with 50% opacity |
315
- | || |
316
311
  | `hsl(h=0-360, s=0-100, l=0-100)` | `hsl(200, 50, 40)` | HSL colour (200° hue, 50% saturation, 40% lightness) |
317
312
  | `hsla(h=0-360, s=0-100, l=0-100, a=0-1)` | `hsla(200, 50, 40, 0.5)` | HSL with 50% opacity |
318
- | || |
319
313
  | `rgb(r=0-255, g=0-255, b=0-255)` | `rgb(139, 152, 255)` | RGB colour (139 red, 152 green, 255 blue) |
320
314
  | `rgba(r=0-255, g=0-255, b=0-255, a=0-1)` | `rgba(139, 152, 255, 0.5)` | RGB with 50% opacity |
321
- | || |
322
315
  | `oklch(l=0-1, c=0-100, h=0-360)` | `oklch(0.7, 25, 180)` | OKLCH colour (70% lightness, 25 chroma, 180° hue) |
323
316
  | `oklcha(l=0-1, c=0-100, h=0-360, a=0-1)` | `oklcha(0.5, 30, 45, 0.8)` | OKLCH with 80% opacity |
324
- | || |
325
317
  | `css(name)` | `css(tomato)` | CSS named colour (tomato, skyblue, etc.) |
326
- | || |
327
318
 
328
319
  > **Note:** In all of these functions, `colour` can be a raw hex (`#ff66cc`),
329
320
  a variable (`$(accent)`), a CSS named colour (`css(tomato)`), or another colour
@@ -452,7 +443,7 @@ Sassy supports importing different types of theme components:
452
443
  config:
453
444
  import:
454
445
  - "./shared/colours.yaml" # Variables and base config
455
- - "./shared/ui-colours.yaml" # VS Code color definitions
446
+ - "./shared/ui-colours.yaml" # VS Code color definitions
456
447
  - "./shared/syntax.yaml" # Syntax highlighting rules
457
448
  - "./shared/semantic.yaml" # Semantic token colours
458
449
  ```
package/package.json CHANGED
@@ -1,10 +1,29 @@
1
1
  {
2
2
  "name": "@gesslar/sassy",
3
- "version": "0.22.0",
4
- "displayName": "Sassy",
5
3
  "description": "Make gorgeous themes that speak as boldly as you do.",
6
- "publisher": "gesslar",
4
+ "author": {
5
+ "name": "gesslar",
6
+ "url": "https://gesslar.dev"
7
+ },
8
+ "version": "1.0.0",
7
9
  "license": "Unlicense",
10
+ "homepage": "https://github.com/gesslar/sassy#readme",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/gesslar/sassy.git"
14
+ },
15
+ "keywords": [
16
+ "asmr",
17
+ "generator",
18
+ "huffing",
19
+ "json5",
20
+ "sniffsniffsniff",
21
+ "taylorswift",
22
+ "theme",
23
+ "vs code",
24
+ "vscode",
25
+ "yaml"
26
+ ],
8
27
  "type": "module",
9
28
  "main": "src/index.js",
10
29
  "types": "types/index.d.ts",
@@ -20,56 +39,38 @@
20
39
  "types/",
21
40
  "UNLICENSE.txt"
22
41
  ],
23
- "scripts": {
24
- "clean": "rm -rfv ./dist",
25
- "clean-types": "rm -rfv ./types",
26
- "types": "npx tsc src/*.js types-helper.d.ts --allowJs --declaration --emitDeclarationOnly --outDir types --target ES2022 --module ESNext --moduleResolution Node --esModuleInterop --skipLibCheck --resolveJsonModule && node fix-types.js",
27
- "build": "npm run clean && npm run types && mkdir -pv ./dist && npm pack --pack-destination ./dist/",
28
- "exec": "node ./src/cli.js",
29
- "lint": "eslint src/",
30
- "submit": "npm run build && npm publish --access public",
31
- "examples": "node ./examples/validator.js",
32
- "test": "node -p \"require('fs').readFileSync('TESTING.txt', 'utf8')\"",
33
- "update": "npx npm-check-updates -u && npm install"
34
- },
35
42
  "engines": {
36
- "node": ">=20.0.0"
43
+ "node": ">=22"
37
44
  },
38
- "repository": {
39
- "type": "git",
40
- "url": "https://github.com/gesslar/sassy"
41
- },
42
- "keywords": [
43
- "asmr",
44
- "generator",
45
- "huffing",
46
- "json5",
47
- "sniffsniffsniff",
48
- "taylorswift",
49
- "theme",
50
- "vs code",
51
- "vscode",
52
- "yaml"
53
- ],
54
45
  "dependencies": {
55
- "@gesslar/colours": "^0.0.1",
56
- "@gesslar/toolkit": "^0.0.3",
57
- "chokidar": "^4.0.3",
46
+ "@gesslar/colours": "^0.8.0",
47
+ "@gesslar/toolkit": "^3.21.0",
48
+ "chokidar": "^5.0.0",
58
49
  "color-support": "^1.1.3",
59
- "commander": "^14.0.1",
50
+ "commander": "^14.0.2",
60
51
  "culori": "^4.0.2",
61
- "globby": "^14.1.0",
52
+ "globby": "^16.1.0",
62
53
  "json5": "^2.2.3",
63
- "yaml": "^2.8.1"
54
+ "yaml": "^2.8.2"
64
55
  },
65
56
  "devDependencies": {
66
- "@stylistic/eslint-plugin": "^5.4.0",
67
- "@types/vscode": "^1.104.0",
68
- "@typescript-eslint/eslint-plugin": "^8.44.0",
69
- "@typescript-eslint/parser": "^8.44.0",
70
- "esbuild": "^0.25.10",
71
- "eslint": "^9.36.0",
72
- "eslint-plugin-jsdoc": "^60.1.0",
73
- "typescript": "^5.9.2"
57
+ "@gesslar/uglier": "^1.0.0",
58
+ "eslint": "^9.39.2",
59
+ "typescript": "^5.9.3"
60
+ },
61
+ "scripts": {
62
+ "clean": "rm -rfv ./dist",
63
+ "build": "mkdir -pv ./dist && pnpm pack --pack-destination ./dist/",
64
+ "exec": "node ./src/cli.js",
65
+ "lint": "eslint src/",
66
+ "test": "node --test tests/**/*.test.js",
67
+ "test:coverage": "node --experimental-test-coverage --test tests/**/*.test.js",
68
+ "submit": "pnpm publish --access public --//registry.npmjs.org/:_authToken=\"${NPM_ACCESS_TOKEN}\"",
69
+ "examples": "node ./examples/validator.js",
70
+ "update": "pnpm self-update && pnpx npm-check-updates -u && pnpm install",
71
+ "pr": "gt submit -p --ai",
72
+ "patch": "pnpm version patch",
73
+ "minor": "pnpm version minor",
74
+ "major": "pnpm version major"
74
75
  }
75
- }
76
+ }
@@ -1,7 +1,7 @@
1
1
  import {EventEmitter} from "node:events"
2
2
  import process from "node:process"
3
3
 
4
- import {Sass, Term} from "@gesslar/toolkit"
4
+ import {Sass, Term, Util} from "@gesslar/toolkit"
5
5
  import Command from "./Command.js"
6
6
  import Session from "./Session.js"
7
7
  import Theme from "./Theme.js"
@@ -90,7 +90,7 @@ export default class BuildCommand extends Command {
90
90
  rejected.forEach(reject => Term.error(reject.reason))
91
91
 
92
92
  if(firstRun.length === rejected.length)
93
- await this.asyncEmit("quit")
93
+ await Util.asyncEmit(this.emitter, "quit")
94
94
  }
95
95
  }
96
96
 
package/src/Colour.js CHANGED
@@ -14,7 +14,6 @@ import {
14
14
  } from "culori"
15
15
 
16
16
  import {Util, Sass} from "@gesslar/toolkit"
17
- import ThemeToken from "./ThemeToken.js"
18
17
  // Cache for parsed colours to improve performance
19
18
  const _colourCache = new Map()
20
19
 
@@ -264,7 +263,7 @@ export default class Colour {
264
263
 
265
264
  const [_,hex] = matches
266
265
 
267
- return hex.split("").reduce((acc,curr) => acc + curr.repeat(2)).toLowerCase()
266
+ return hex.split("").reduce((acc,curr) => acc + curr.repeat(2), "").toLowerCase()
268
267
  }
269
268
 
270
269
  /**
package/src/Command.js CHANGED
@@ -1,4 +1,4 @@
1
- import {Sass, FileObject, DirectoryObject, Cache} from "@gesslar/toolkit"
1
+ import {Sass, FileObject} from "@gesslar/toolkit"
2
2
 
3
3
  /**
4
4
  * Base class for command-line interface commands.
package/src/Compiler.js CHANGED
@@ -11,9 +11,8 @@
11
11
  * Supports extension points for custom phases and output formats.
12
12
  */
13
13
 
14
- import {Sass, Data, File, FileObject, Term, Util} from "@gesslar/toolkit"
14
+ import {Collection, Data, FileObject, Sass, Term, Util} from "@gesslar/toolkit"
15
15
  import Evaluator from "./Evaluator.js"
16
- import Theme from "./Theme.js"
17
16
 
18
17
  /**
19
18
  * Main compiler class for processing theme source files.
@@ -149,7 +148,7 @@ export default class Compiler {
149
148
  ? [imports]
150
149
  : imports
151
150
 
152
- if(!Data.isArrayUniform(imports, "string"))
151
+ if(!Collection.isArrayUniform(imports, "string"))
153
152
  throw new Sass(
154
153
  `All import entries must be strings. Got ${JSON.stringify(imports)}`
155
154
  )
@@ -169,7 +168,7 @@ export default class Compiler {
169
168
  Term.status([
170
169
  ["muted", Util.rightAlignText(`${cost.toLocaleString()}ms`, 10), ["[","]"]],
171
170
  "",
172
- ["muted", `${File.relativeOrAbsolutePath(theme.getCwd(),file)}`],
171
+ ["muted", `${file.toString()}`],
173
172
  ["muted", `${theme.getName()}`,["(",")"]],
174
173
  ], theme.getOptions())
175
174
  }
@@ -22,7 +22,6 @@ import Command from "./Command.js"
22
22
  import Evaluator from "./Evaluator.js"
23
23
  import Theme from "./Theme.js"
24
24
  import {Term} from "@gesslar/toolkit"
25
- import ThemePool from "./ThemePool.js"
26
25
 
27
26
  // oops, need to have @gesslar/colours support this, too!
28
27
  // ansiColors.enabled = colorSupport.hasBasic
@@ -2,7 +2,7 @@ import c from "@gesslar/colours"
2
2
  // import colorSupport from "color-support"
3
3
 
4
4
  import Command from "./Command.js"
5
- import {Sass, Term, Util, Data} from "@gesslar/toolkit"
5
+ import {Collection, Sass, Term, Util} from "@gesslar/toolkit"
6
6
  import Colour from "./Colour.js"
7
7
  import Evaluator from "./Evaluator.js"
8
8
  import Theme from "./Theme.js"
@@ -41,7 +41,7 @@ export default class ResolveCommand extends Command {
41
41
  async execute(inputArg, options={}) {
42
42
  const cliOptionNames = this.getCliOptionNames()
43
43
  const intersection =
44
- Data.arrayIntersection(cliOptionNames, Object.keys(options))
44
+ Collection.intersection(cliOptionNames, Object.keys(options))
45
45
 
46
46
  if(intersection.length > 1)
47
47
  throw Sass.new(
package/src/Session.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import chokidar from "chokidar"
2
2
 
3
- import Command from "./Command.js"
4
- import {Sass, File, Term, Util} from "@gesslar/toolkit"
5
- import Theme from "./Theme.js"
3
+ import {Sass, Term, Util} from "@gesslar/toolkit"
6
4
 
7
5
  /**
8
6
  * @typedef {object} SessionOptions
@@ -219,7 +217,7 @@ export default class Session {
219
217
  */
220
218
 
221
219
  loadCost = (await Util.time(() => this.#theme.load())).cost
222
- const bytes = await File.fileSize(this.#theme.getSourceFile())
220
+ const bytes = await this.#theme.getSourceFile().size()
223
221
 
224
222
  Term.status([
225
223
  ["success", Util.rightAlignText(`${loadCost.toLocaleString()}ms`, 10), ["[","]"]],
@@ -244,10 +242,8 @@ export default class Session {
244
242
  throw new Error("Invalid dependency file object")
245
243
  }
246
244
 
247
- const fileName = File.relativeOrAbsolutePath(
248
- this.#command.getCwd(), fileObject
249
- )
250
- const fileSize = await File.fileSize(fileObject)
245
+ const fileName = fileObject.toString()
246
+ const fileSize = await fileObject.size()
251
247
 
252
248
  return [fileName, fileSize]
253
249
  }))
@@ -307,9 +303,7 @@ export default class Session {
307
303
  file: outputFile,
308
304
  bytes: writeBytes
309
305
  } = writeResult.result
310
- const outputFilename = File.relativeOrAbsolutePath(
311
- this.#command.getCwd(), outputFile
312
- )
306
+ const outputFilename = outputFile.toString()
313
307
  const status = [
314
308
  [
315
309
  "success",
@@ -383,9 +377,7 @@ export default class Session {
383
377
  if(!changedFile)
384
378
  return
385
379
 
386
- const fileName = File.relativeOrAbsolutePath(
387
- this.#command.getCwd(), changedFile
388
- )
380
+ const fileName = changedFile.toString()
389
381
 
390
382
  const message = [
391
383
  ["info", "REBUILDING", ["[","]"]],
package/src/Theme.js CHANGED
@@ -13,7 +13,7 @@
13
13
  * - Write output files, supporting dry-run and hash-based skip
14
14
  * - Support watch mode for live theme development
15
15
  */
16
- import {Sass, DirectoryObject, File, FileObject, Term, Util, Cache} from "@gesslar/toolkit"
16
+ import {Sass, DirectoryObject, FileObject, Term, Util} from "@gesslar/toolkit"
17
17
  import Compiler from "./Compiler.js"
18
18
  import ThemePool from "./ThemePool.js"
19
19
 
@@ -525,7 +525,7 @@ export default class Theme {
525
525
  if(!force) {
526
526
  const nextHash = this.#outputHash
527
527
  const lastHash = await file.exists
528
- ? Util.hashOf(await File.readFile(file))
528
+ ? Util.hashOf(await file.read())
529
529
  : obviouslyASentinelYouCantMissSoShutUpAboutIt
530
530
 
531
531
  if(lastHash === nextHash)
@@ -534,9 +534,9 @@ export default class Theme {
534
534
 
535
535
  // Real write (timed)
536
536
  if(!await outputDir.exists)
537
- await File.assureDirectory(outputDir, {recursive: true})
537
+ await outputDir.assureExists()
538
538
 
539
- await File.writeFile(file, output)
539
+ await file.write(output)
540
540
 
541
541
  return {status: WriteStatus.WRITTEN, bytes: output.length, file}
542
542
  }
@@ -1,40 +0,0 @@
1
- /**
2
- * Command handler for building VS Code themes from source files.
3
- * Handles compilation, watching for changes, and output generation.
4
- */
5
- export default class BuildCommand extends Command {
6
- /**
7
- * Creates a new BuildCommand instance.
8
- *
9
- * @param {object} base - Base configuration object
10
- * @param {string} base.cwd - Current working directory path
11
- * @param {object} base.packageJson - Package.json configuration data
12
- */
13
- constructor(base: {
14
- cwd: string;
15
- packageJson: object;
16
- });
17
- /** @type {EventEmitter} Internal event emitter for watch mode coordination */
18
- emitter: EventEmitter;
19
- /**
20
- * Executes the build command for the provided theme files.
21
- * Processes each file in parallel, optionally watching for changes.
22
- *
23
- * @param {string[]} fileNames - Array of theme file paths to process
24
- * @param {object} options - Build options
25
- * @param {boolean} [options.watch] - Enable watch mode for file changes
26
- * @param {string} [options.output-dir] - Custom output directory path
27
- * @param {boolean} [options.dry-run] - Print JSON to stdout without writing files
28
- * @param {boolean} [options.silent] - Silent mode, only show errors or dry-run output
29
- * @returns {Promise<void>} Resolves when all files are processed
30
- * @throws {Error} When theme compilation fails
31
- */
32
- execute(fileNames: string[], options: {
33
- watch?: boolean;
34
- output?: string;
35
- dry?: boolean;
36
- silent?: boolean;
37
- }): Promise<void>;
38
- #private;
39
- }
40
- import Command from "./Command.js";
package/types/Colour.d.ts DELETED
@@ -1,126 +0,0 @@
1
- /**
2
- * Colour manipulation utility class providing static methods for colour operations.
3
- * Handles hex colour parsing, alpha manipulation, mixing, and format conversions.
4
- */
5
- export default class Colour {
6
- /**
7
- * Regular expression for matching long hex colour codes with optional alpha.
8
- * Matches patterns like #ff0000 or #ff0000ff
9
- *
10
- * @type {RegExp}
11
- */
12
- static longHex: RegExp;
13
- /**
14
- * Regular expression for matching short hex colour codes with optional alpha.
15
- * Matches patterns like #f00 or #f00f
16
- *
17
- * @type {RegExp}
18
- */
19
- static shortHex: RegExp;
20
- /**
21
- * Lightens or darkens a hex colour by a specified amount.
22
- * Always uses OKLCH as the working color space for consistent perceptual results.
23
- *
24
- * @param {string} hex - The hex colour code (e.g., "#ff0000" or "#f00")
25
- * @param {number} amount - The amount to lighten (+) or darken (-) as a percentage
26
- * @returns {string} The modified hex colour with preserved alpha
27
- */
28
- static lightenOrDarken(hex: string, amount?: number): string;
29
- /**
30
- * Lightens or darkens a color using OKLCH as working space for consistent results.
31
- * Preserves original color information from tokens when available.
32
- *
33
- * @param {ThemeToken|object|string} tokenOrColor - ThemeToken, Culori color object, or hex string
34
- * @param {number} amount - The amount to lighten (+) or darken (-) as a percentage
35
- * @returns {string} The modified hex colour
36
- */
37
- static lightenOrDarkenWithToken(tokenOrColor: ThemeToken | object | string, amount?: number): string;
38
- /**
39
- * Inverts a hex colour by flipping its lightness value.
40
- * Preserves hue and saturation while inverting the lightness component.
41
- *
42
- * @param {string} hex - The hex colour code to invert
43
- * @returns {string} The inverted hex colour with preserved alpha
44
- */
45
- static invert(hex: string): string;
46
- /**
47
- * Converts a hex alpha value to a decimal percentage.
48
- * Takes a 2-digit hex alpha value and converts it to a percentage (0-100).
49
- *
50
- * @param {string} hex - The hex alpha value (e.g., "ff", "80")
51
- * @returns {number} The alpha as a percentage rounded to 2 decimal places
52
- */
53
- static hexAlphaToDecimal(hex: string): number;
54
- /**
55
- * Converts a decimal percentage to a hex alpha value.
56
- * Takes a percentage (0-100) and converts it to a 2-digit hex alpha value.
57
- *
58
- * @param {number} dec - The alpha percentage (0-100)
59
- * @returns {string} The hex alpha value (e.g., "ff", "80")
60
- */
61
- static decimalAlphaToHex(dec: number): string;
62
- static isHex(value: any): boolean;
63
- /**
64
- * Normalises a short hex colour code to a full 6-character format.
65
- * Converts 3-character hex codes like "#f00" to "#ff0000".
66
- *
67
- * @param {string} code - The short hex colour code
68
- * @returns {string} The normalized 6-character hex colour code
69
- */
70
- static normaliseHex(code: string): string;
71
- /**
72
- * Parses a hex colour string and extracts colour and alpha components.
73
- * Supports both short (#f00) and long (#ff0000) formats with optional alpha.
74
- *
75
- * @param {string} hex - The hex colour string to parse
76
- * @returns {object} Object containing colour and optional alpha information
77
- * @throws {Sass} If the hex value is invalid or missing
78
- */
79
- static parseHexColour(hex: string): object;
80
- /**
81
- * Sets the alpha transparency of a hex colour to a specific value.
82
- * Replaces any existing alpha with the new value.
83
- *
84
- * @param {string} hex - The hex colour code
85
- * @param {number} amount - The alpha value (0-1, where 0 is transparent and 1 is opaque)
86
- * @returns {string} The hex colour with the new alpha value
87
- */
88
- static setAlpha(hex: string, amount: number): string;
89
- /**
90
- * Adjusts the alpha transparency of a hex colour by a relative amount.
91
- * Multiplies the current alpha by (1 + amount) and clamps the result.
92
- *
93
- * @param {string} hex - The hex colour code
94
- * @param {number} amount - The relative amount to adjust alpha (-1 to make transparent, positive to increase)
95
- * @returns {string} The hex colour with adjusted alpha
96
- */
97
- static addAlpha(hex: string, amount: number): string;
98
- /**
99
- * Removes alpha channel from a hex colour, returning only the solid colour.
100
- *
101
- * @param {string} hex - The hex colour code with or without alpha
102
- * @returns {string} The solid hex colour without alpha
103
- */
104
- static solid(hex: string): string;
105
- /**
106
- * Mixes two hex colours together in a specified ratio.
107
- * Blends both the colours and their alpha channels if present.
108
- *
109
- * @param {string} colourA - The first hex colour
110
- * @param {string} colourB - The second hex colour
111
- * @param {number} ratio - The mixing ratio as percentage (0-100, where 50 is equal mix)
112
- * @returns {string} The mixed hex colour with blended alpha
113
- */
114
- static mix(colourA: string, colourB: string, ratio?: number): string;
115
- static getColourParser(name: any): Promise<any>;
116
- /**
117
- * Converts colour values from various formats to hex.
118
- * Supports RGB, RGBA, HSL, HSLA, OKLCH, and OKLCHA colour modes, and MORE!
119
- *
120
- * @param {string} input - The colour expression
121
- * @returns {string} The resulting hex colour
122
- * @throws {Sass} If the wrong function or value is provided
123
- */
124
- static toHex(input: string): string;
125
- }
126
- import ThemeToken from "./ThemeToken.js";
@@ -1,135 +0,0 @@
1
- import type { FileObject, DirectoryObject, Cache } from '@gesslar/toolkit';
2
- /**
3
- * Base class for command-line interface commands.
4
- * Provides common functionality for CLI option handling and file resolution.
5
- */
6
- export default class Command {
7
- /**
8
- * Creates a new Command instance.
9
- *
10
- * @param {object} config - Configuration object
11
- * @param {DirectoryObject} config.cwd - Current working directory object
12
- * @param {object} config.packageJson - Package.json data
13
- */
14
- constructor({ cwd, packageJson }: {
15
- cwd: DirectoryObject;
16
- packageJson: object;
17
- });
18
- /**
19
- * Gets the current working directory object.
20
- *
21
- * @returns {DirectoryObject} The current working directory
22
- */
23
- getCwd(): DirectoryObject;
24
- /**
25
- * Gets the package.json data.
26
- *
27
- * @returns {object} The package.json object
28
- */
29
- getPackageJson(): object;
30
- /**
31
- * Sets the cache instance for the command.
32
- *
33
- * @param {Cache} cache - The cache instance to set
34
- * @returns {this} Returns this instance for method chaining
35
- */
36
- setCache(cache: Cache): this;
37
- /**
38
- * Gets the cache instance.
39
- *
40
- * @returns {Cache|null} The cache instance or null if not set
41
- */
42
- getCache(): Cache | null;
43
- /**
44
- * Sets the CLI command string.
45
- *
46
- * @param {string} data - The CLI command string
47
- * @returns {this} Returns this instance for method chaining
48
- */
49
- setCliCommand(data: string): this;
50
- /**
51
- * Gets the CLI command string.
52
- *
53
- * @returns {string|null} The CLI command string
54
- */
55
- getCliCommand(): string | null;
56
- /**
57
- * Sets the CLI options object.
58
- *
59
- * @param {object} data - The CLI options configuration
60
- * @returns {this} Returns this instance for method chaining
61
- */
62
- setCliOptions(data: object): this;
63
- /**
64
- * Gets the CLI options object.
65
- *
66
- * @returns {object|null} The CLI options configuration
67
- */
68
- getCliOptions(): object | null;
69
- /**
70
- * Gets the array of CLI option names.
71
- *
72
- * @returns {string[]} Array of option names
73
- */
74
- getCliOptionNames(): string[];
75
- /**
76
- * Checks if the command has a cache instance.
77
- *
78
- * @returns {boolean} True if cache is available
79
- */
80
- hasCache(): boolean;
81
- /**
82
- * Checks if the command has a CLI command string configured.
83
- *
84
- * @returns {boolean} True if CLI command is set
85
- */
86
- hasCliCommand(): boolean;
87
- /**
88
- * Checks if the command has CLI options configured.
89
- *
90
- * @returns {boolean} True if CLI options are set
91
- */
92
- hasCliOptions(): boolean;
93
- /**
94
- * Checks if the command is ready to be built.
95
- * Requires both CLI command and options to be set.
96
- *
97
- * @returns {boolean} True if command can be built
98
- */
99
- canBuild(): boolean;
100
- /**
101
- * Builds the CLI command interface using the commander.js program instance.
102
- * Initializes the command with its options and action handler.
103
- *
104
- * @param {object} program - The commander.js program instance
105
- * @returns {Promise<this>} Returns this instance for method chaining
106
- */
107
- buildCli(program: object): Promise<this>;
108
- /**
109
- * Adds a single CLI option to the command.
110
- *
111
- * @param {string} name - The option name
112
- * @param {string[]} options - Array containing option flag and description
113
- * @param {boolean} preserve - Whether to preserve this option name in the list
114
- * @returns {Promise<this>} Returns this instance for method chaining
115
- */
116
- addCliOption(name: string, options: string[], preserve: boolean): Promise<this>;
117
- /**
118
- * Adds multiple CLI options to the command.
119
- *
120
- * @param {object} options - Object mapping option names to [flag, description] arrays
121
- * @param {boolean} preserve - Whether to preserve option names in the list
122
- * @returns {this} Returns this instance for method chaining
123
- */
124
- addCliOptions(options: object, preserve: boolean): this;
125
- /**
126
- * Resolves a theme file name to a FileObject and validates its existence.
127
- *
128
- * @param {string} fileName - The theme file name or path
129
- * @param {object} cwd - The current working directory object
130
- * @returns {Promise<FileObject>} The resolved and validated FileObject
131
- * @throws {Sass} If the file does not exist
132
- */
133
- resolveThemeFileName(fileName: string, cwd: object): Promise<FileObject>;
134
- #private;
135
- }