@wrongstack/tui 0.305.0 → 0.306.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/theme.d.ts CHANGED
@@ -10,6 +10,8 @@ export declare const pastel: Readonly<{
10
10
  readonly white: '#cdd6f4';
11
11
  readonly gray: '#7f849c';
12
12
  readonly grey: '#7f849c';
13
+ readonly grayBright: '#a6adc8';
14
+ readonly greyBright: '#a6adc8';
13
15
  readonly blackBright: '#585b70';
14
16
  readonly redBright: '#eba0ac';
15
17
  readonly greenBright: '#b8e8b0';
@@ -40,6 +42,8 @@ export declare const catppuccin: Readonly<{
40
42
  readonly white: '#cdd6f4';
41
43
  readonly gray: '#7f849c';
42
44
  readonly grey: '#7f849c';
45
+ readonly grayBright: '#a6adc8';
46
+ readonly greyBright: '#a6adc8';
43
47
  readonly blackBright: '#585b70';
44
48
  readonly redBright: '#eba0ac';
45
49
  readonly greenBright: '#b8e8b0';
@@ -55,11 +59,34 @@ export declare const catppuccin: Readonly<{
55
59
  readonly subtext0: '#a6adc8';
56
60
  readonly flamingo: '#f2cdcd';
57
61
  }>;
62
+ /** The distinct things `highlightLine` can color. */
63
+ export type SyntaxRole = 'keyword' | 'string' | 'comment' | 'commentOnWash' | 'number' | 'literal' | 'property' | 'variable' | 'command' | 'flag' | 'decorator' | 'diffAdd' | 'diffDel' | 'diffMeta';
64
+ export type SyntaxPalette = Record<SyntaxRole, string>;
58
65
  /**
59
- * Resolve a color value to its pastel equivalent. Known ANSI names map to the
60
- * {@link pastel} hex; hex/rgb strings and unknown values (e.g. Ink's `'dim'`)
61
- * pass through unchanged. `undefined` stays `undefined` so callers can spread
62
- * it without forcing a color.
66
+ * Resolve one syntax role against a palette. A preset may pin any role
67
+ * explicitly via its optional `syntax` field (e.g. a scheme whose strings are
68
+ * orange rather than green); otherwise the role borrows the token named in
69
+ * {@link SYNTAX_TOKEN}. O(1) and allocation-free — this runs once per token
70
+ * per rendered line.
71
+ */
72
+ export declare function resolveSyntaxColor(role: SyntaxRole, palette?: Theme): string;
73
+ /** Materialize the full syntax palette for a theme. Used by tests and tooling. */
74
+ export declare function resolveSyntaxPalette(palette?: Theme): SyntaxPalette;
75
+ /**
76
+ * Resolve a color value to a concrete color.
77
+ *
78
+ * Three cases, in order:
79
+ * - `syntax.<role>` resolves against the ACTIVE theme, so highlighting
80
+ * follows `/theme` (see {@link resolveSyntaxColor}).
81
+ * - A known ANSI name maps to its {@link pastel} hex. This map is frozen and
82
+ * theme-independent by design — it is the floor for the ~177 call sites
83
+ * that still pass bare names like `color="red"`.
84
+ * - Anything else (hex, rgb, Ink's `'dim'`, an unknown name) passes through.
85
+ *
86
+ * `undefined` stays `undefined` so callers can spread it without forcing a
87
+ * color. NOTE: an unknown name that reaches Ink is silently DROPPED by chalk —
88
+ * the token renders with no color at all. Never emit a name that isn't
89
+ * resolvable here.
63
90
  */
64
91
  export declare function softColor(color?: string): string | undefined;
65
92
  /**
@@ -154,6 +181,14 @@ export interface Theme {
154
181
  */
155
182
  diffAddBg: string;
156
183
  diffDelBg: string;
184
+ /**
185
+ * Per-preset syntax-highlight overrides. OPTIONAL and normally omitted —
186
+ * every role has a sensible default derived from the tokens above (see
187
+ * `SYNTAX_TOKEN`), so a preset only pins a role when its scheme genuinely
188
+ * disagrees. Example: VS Code Dark+ colors strings orange, not green, so
189
+ * `dark-plus` pins `string`.
190
+ */
191
+ syntax?: Partial<SyntaxPalette> | undefined;
157
192
  }
158
193
  export declare const theme: Theme;
159
194
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/tui",
3
- "version": "0.305.0",
3
+ "version": "0.306.0",
4
4
  "license": "MIT",
5
5
  "description": "WrongStack terminal UI: Ink-based interactive renderer with history, pickers, and slash menus.",
6
6
  "repository": {
@@ -29,12 +29,12 @@
29
29
  "ink": "7.1.1",
30
30
  "react": "^19.2.8",
31
31
  "string-width": "8.2.2",
32
- "@wrongstack/core": "0.305.0",
33
- "@wrongstack/kanban": "0.305.0",
34
- "@wrongstack/sage": "0.305.0",
35
- "@wrongstack/runtime": "0.305.0",
36
- "@wrongstack/sdd": "0.305.0",
37
- "@wrongstack/tools": "0.305.0"
32
+ "@wrongstack/runtime": "0.306.0",
33
+ "@wrongstack/core": "0.306.0",
34
+ "@wrongstack/tools": "0.306.0",
35
+ "@wrongstack/sage": "0.306.0",
36
+ "@wrongstack/sdd": "0.306.0",
37
+ "@wrongstack/kanban": "0.306.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@testing-library/dom": "^10.4.1",