@chances-ai/tui 24.0.0 → 24.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.
- package/dist/theme.d.ts +11 -1
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +21 -2
- package/dist/theme.js.map +1 -1
- package/package.json +4 -4
package/dist/theme.d.ts
CHANGED
|
@@ -14,7 +14,17 @@ export declare const GLYPHS: Glyphs;
|
|
|
14
14
|
/** `NO_COLOR` check defaulting to `process.env` (TUI convenience over the pure
|
|
15
15
|
* ui-core `isNoColor(env)` — https://no-color.org). */
|
|
16
16
|
export declare function isNoColor(env?: NodeJS.ProcessEnv): boolean;
|
|
17
|
+
/** (7.3 §2.7) Map a resolved theme value to an Ink-renderable color. `rgb(r,g,b)`
|
|
18
|
+
* (the default/daltonized themes) passes through to Ink's truecolor; an
|
|
19
|
+
* `ansi:<name>` value (the ansi-16 accessibility theme) maps to the bare
|
|
20
|
+
* chalk/Ink color name (`ansi:greenBright` → `greenBright`), so the terminal's
|
|
21
|
+
* OWN 16-color palette carries the semantics. `undefined` (NO_COLOR) stays
|
|
22
|
+
* undefined. Components are unchanged — they still read `theme.accent` etc.;
|
|
23
|
+
* `resolveTheme` runs every value through this first. */
|
|
24
|
+
export declare function themeColorToInk(value: string | undefined): string | undefined;
|
|
17
25
|
/** Resolve a palette, defaulting the env to `process.env` (TUI convenience over
|
|
18
|
-
* the pure ui-core `resolveTheme(setting, env)`).
|
|
26
|
+
* the pure ui-core `resolveTheme(setting, env)`). The resolved values are run
|
|
27
|
+
* through {@link themeColorToInk} so the `ansi` theme's `ansi:<name>` roles
|
|
28
|
+
* become Ink color names (a no-op for the rgb-valued themes). */
|
|
19
29
|
export declare function resolveTheme(setting: ThemeSetting | undefined, env?: NodeJS.ProcessEnv): Theme;
|
|
20
30
|
//# sourceMappingURL=theme.d.ts.map
|
package/dist/theme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAIL,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEjF,+DAA+D;AAC/D,eAAO,MAAM,MAAM,EAAE,MAAqC,CAAC;AAE3D;wDACwD;AACxD,wBAAgB,SAAS,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAIvE;AAED;
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAIL,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEjF,+DAA+D;AAC/D,eAAO,MAAM,MAAM,EAAE,MAAqC,CAAC;AAE3D;wDACwD;AACxD,wBAAgB,SAAS,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAIvE;AAED;;;;;;0DAM0D;AAC1D,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAG7E;AAED;;;kEAGkE;AAClE,wBAAgB,YAAY,CAC1B,OAAO,EAAE,YAAY,GAAG,SAAS,EACjC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,KAAK,CAOP"}
|
package/dist/theme.js
CHANGED
|
@@ -17,9 +17,28 @@ export function isNoColor(env = process.env) {
|
|
|
17
17
|
// `process.env` (index-signature-only) isn't structurally assignable.
|
|
18
18
|
return isNoColorCore({ NO_COLOR: env.NO_COLOR });
|
|
19
19
|
}
|
|
20
|
+
/** (7.3 §2.7) Map a resolved theme value to an Ink-renderable color. `rgb(r,g,b)`
|
|
21
|
+
* (the default/daltonized themes) passes through to Ink's truecolor; an
|
|
22
|
+
* `ansi:<name>` value (the ansi-16 accessibility theme) maps to the bare
|
|
23
|
+
* chalk/Ink color name (`ansi:greenBright` → `greenBright`), so the terminal's
|
|
24
|
+
* OWN 16-color palette carries the semantics. `undefined` (NO_COLOR) stays
|
|
25
|
+
* undefined. Components are unchanged — they still read `theme.accent` etc.;
|
|
26
|
+
* `resolveTheme` runs every value through this first. */
|
|
27
|
+
export function themeColorToInk(value) {
|
|
28
|
+
if (value === undefined)
|
|
29
|
+
return undefined;
|
|
30
|
+
return value.startsWith("ansi:") ? value.slice("ansi:".length) : value;
|
|
31
|
+
}
|
|
20
32
|
/** Resolve a palette, defaulting the env to `process.env` (TUI convenience over
|
|
21
|
-
* the pure ui-core `resolveTheme(setting, env)`).
|
|
33
|
+
* the pure ui-core `resolveTheme(setting, env)`). The resolved values are run
|
|
34
|
+
* through {@link themeColorToInk} so the `ansi` theme's `ansi:<name>` roles
|
|
35
|
+
* become Ink color names (a no-op for the rgb-valued themes). */
|
|
22
36
|
export function resolveTheme(setting, env = process.env) {
|
|
23
|
-
|
|
37
|
+
const resolved = resolveThemeCore(setting, { NO_COLOR: env.NO_COLOR });
|
|
38
|
+
const out = {};
|
|
39
|
+
for (const [role, value] of Object.entries(resolved)) {
|
|
40
|
+
out[role] = themeColorToInk(value);
|
|
41
|
+
}
|
|
42
|
+
return out;
|
|
24
43
|
}
|
|
25
44
|
//# sourceMappingURL=theme.js.map
|
package/dist/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","source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,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACzE,CAAC;AAED;;;kEAGkE;AAClE,MAAM,UAAU,YAAY,CAC1B,OAAiC,EACjC,MAAyB,OAAO,CAAC,GAAG;IAEpC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IACvE,MAAM,GAAG,GAAuC,EAAE,CAAC;IACnD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrD,GAAG,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,KAA2B,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,GAAY,CAAC;AACtB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chances-ai/tui",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@chances-ai/engine": "24.
|
|
18
|
-
"@chances-ai/runtime": "24.
|
|
19
|
-
"@chances-ai/ui-core": "24.
|
|
17
|
+
"@chances-ai/engine": "24.1.0",
|
|
18
|
+
"@chances-ai/runtime": "24.1.0",
|
|
19
|
+
"@chances-ai/ui-core": "24.1.0",
|
|
20
20
|
"marked": "^18.0.0",
|
|
21
21
|
"highlight.js": "^11.11.1",
|
|
22
22
|
"diff": "^9.0.0",
|