@flyingrobots/bijou 0.10.0 → 1.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/adapters/test/assertions.d.ts +51 -0
- package/dist/adapters/test/assertions.d.ts.map +1 -0
- package/dist/adapters/test/assertions.js +67 -0
- package/dist/adapters/test/assertions.js.map +1 -0
- package/dist/adapters/test/audit-style.d.ts +28 -7
- package/dist/adapters/test/audit-style.d.ts.map +1 -1
- package/dist/adapters/test/audit-style.js +61 -4
- package/dist/adapters/test/audit-style.js.map +1 -1
- package/dist/adapters/test/index.d.ts +36 -1
- package/dist/adapters/test/index.d.ts.map +1 -1
- package/dist/adapters/test/index.js +12 -1
- package/dist/adapters/test/index.js.map +1 -1
- package/dist/adapters/test/io.d.ts +27 -0
- package/dist/adapters/test/io.d.ts.map +1 -1
- package/dist/adapters/test/io.js +56 -0
- package/dist/adapters/test/io.js.map +1 -1
- package/dist/adapters/test/runtime.d.ts +17 -0
- package/dist/adapters/test/runtime.d.ts.map +1 -1
- package/dist/adapters/test/runtime.js +14 -0
- package/dist/adapters/test/runtime.js.map +1 -1
- package/dist/adapters/test/style.d.ts +9 -0
- package/dist/adapters/test/style.d.ts.map +1 -1
- package/dist/adapters/test/style.js +54 -0
- package/dist/adapters/test/style.js.map +1 -1
- package/dist/context.d.ts +21 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +21 -0
- package/dist/context.js.map +1 -1
- package/dist/core/bg-fill.d.ts +32 -0
- package/dist/core/bg-fill.d.ts.map +1 -0
- package/dist/core/bg-fill.js +42 -0
- package/dist/core/bg-fill.js.map +1 -0
- package/dist/core/components/accordion.d.ts +20 -0
- package/dist/core/components/accordion.d.ts.map +1 -1
- package/dist/core/components/accordion.js +13 -6
- package/dist/core/components/accordion.js.map +1 -1
- package/dist/core/components/alert.d.ts +16 -0
- package/dist/core/components/alert.d.ts.map +1 -1
- package/dist/core/components/alert.js +17 -6
- package/dist/core/components/alert.js.map +1 -1
- package/dist/core/components/badge.d.ts +18 -0
- package/dist/core/components/badge.d.ts.map +1 -1
- package/dist/core/components/badge.js +15 -11
- package/dist/core/components/badge.js.map +1 -1
- package/dist/core/components/box.d.ts +31 -0
- package/dist/core/components/box.d.ts.map +1 -1
- package/dist/core/components/box.js +45 -10
- package/dist/core/components/box.js.map +1 -1
- package/dist/core/components/breadcrumb.d.ts +15 -0
- package/dist/core/components/breadcrumb.d.ts.map +1 -1
- package/dist/core/components/breadcrumb.js +13 -6
- package/dist/core/components/breadcrumb.js.map +1 -1
- package/dist/core/components/dag-source.d.ts +52 -9
- package/dist/core/components/dag-source.d.ts.map +1 -1
- package/dist/core/components/dag-source.js +53 -9
- package/dist/core/components/dag-source.js.map +1 -1
- package/dist/core/components/dag-stats.d.ts +2 -0
- package/dist/core/components/dag-stats.d.ts.map +1 -1
- package/dist/core/components/dag-stats.js.map +1 -1
- package/dist/core/components/dag.d.ts +88 -1
- package/dist/core/components/dag.d.ts.map +1 -1
- package/dist/core/components/dag.js +127 -6
- package/dist/core/components/dag.js.map +1 -1
- package/dist/core/components/enumerated-list.d.ts +30 -0
- package/dist/core/components/enumerated-list.d.ts.map +1 -1
- package/dist/core/components/enumerated-list.js +50 -11
- package/dist/core/components/enumerated-list.js.map +1 -1
- package/dist/core/components/hyperlink.d.ts +16 -0
- package/dist/core/components/hyperlink.d.ts.map +1 -1
- package/dist/core/components/hyperlink.js +22 -11
- package/dist/core/components/hyperlink.js.map +1 -1
- package/dist/core/components/index.d.ts +7 -0
- package/dist/core/components/index.d.ts.map +1 -1
- package/dist/core/components/index.js +7 -0
- package/dist/core/components/index.js.map +1 -1
- package/dist/core/components/kbd.d.ts +14 -0
- package/dist/core/components/kbd.d.ts.map +1 -1
- package/dist/core/components/kbd.js +13 -6
- package/dist/core/components/kbd.js.map +1 -1
- package/dist/core/components/log.d.ts +20 -0
- package/dist/core/components/log.d.ts.map +1 -1
- package/dist/core/components/log.js +24 -11
- package/dist/core/components/log.js.map +1 -1
- package/dist/core/components/logo.d.ts +32 -0
- package/dist/core/components/logo.d.ts.map +1 -1
- package/dist/core/components/logo.js +38 -0
- package/dist/core/components/logo.js.map +1 -1
- package/dist/core/components/markdown.d.ts +7 -1
- package/dist/core/components/markdown.d.ts.map +1 -1
- package/dist/core/components/markdown.js +76 -0
- package/dist/core/components/markdown.js.map +1 -1
- package/dist/core/components/paginator.d.ts +16 -0
- package/dist/core/components/paginator.d.ts.map +1 -1
- package/dist/core/components/paginator.js +12 -6
- package/dist/core/components/paginator.js.map +1 -1
- package/dist/core/components/progress.d.ts +55 -0
- package/dist/core/components/progress.d.ts.map +1 -1
- package/dist/core/components/progress.js +37 -6
- package/dist/core/components/progress.js.map +1 -1
- package/dist/core/components/separator.d.ts +16 -0
- package/dist/core/components/separator.d.ts.map +1 -1
- package/dist/core/components/separator.js +12 -6
- package/dist/core/components/separator.js.map +1 -1
- package/dist/core/components/skeleton.d.ts +15 -0
- package/dist/core/components/skeleton.d.ts.map +1 -1
- package/dist/core/components/skeleton.js +12 -6
- package/dist/core/components/skeleton.js.map +1 -1
- package/dist/core/components/spinner.d.ts +37 -0
- package/dist/core/components/spinner.d.ts.map +1 -1
- package/dist/core/components/spinner.js +26 -6
- package/dist/core/components/spinner.js.map +1 -1
- package/dist/core/components/stepper.d.ts +20 -0
- package/dist/core/components/stepper.d.ts.map +1 -1
- package/dist/core/components/stepper.js +16 -6
- package/dist/core/components/stepper.js.map +1 -1
- package/dist/core/components/table.d.ts +20 -0
- package/dist/core/components/table.d.ts.map +1 -1
- package/dist/core/components/table.js +31 -6
- package/dist/core/components/table.js.map +1 -1
- package/dist/core/components/tabs.d.ts +19 -0
- package/dist/core/components/tabs.d.ts.map +1 -1
- package/dist/core/components/tabs.js +19 -6
- package/dist/core/components/tabs.js.map +1 -1
- package/dist/core/components/timeline.d.ts +19 -0
- package/dist/core/components/timeline.d.ts.map +1 -1
- package/dist/core/components/timeline.js +20 -6
- package/dist/core/components/timeline.js.map +1 -1
- package/dist/core/components/tree.d.ts +19 -0
- package/dist/core/components/tree.d.ts.map +1 -1
- package/dist/core/components/tree.js +49 -11
- package/dist/core/components/tree.js.map +1 -1
- package/dist/core/detect/index.d.ts +8 -2
- package/dist/core/detect/index.d.ts.map +1 -1
- package/dist/core/detect/index.js +7 -1
- package/dist/core/detect/index.js.map +1 -1
- package/dist/core/detect/tty.d.ts +36 -0
- package/dist/core/detect/tty.d.ts.map +1 -1
- package/dist/core/detect/tty.js +34 -0
- package/dist/core/detect/tty.js.map +1 -1
- package/dist/core/forms/confirm.d.ts +14 -0
- package/dist/core/forms/confirm.d.ts.map +1 -1
- package/dist/core/forms/confirm.js +15 -5
- package/dist/core/forms/confirm.js.map +1 -1
- package/dist/core/forms/filter.d.ts +30 -0
- package/dist/core/forms/filter.d.ts.map +1 -1
- package/dist/core/forms/filter.js +67 -49
- package/dist/core/forms/filter.js.map +1 -1
- package/dist/core/forms/form-utils.d.ts +103 -0
- package/dist/core/forms/form-utils.d.ts.map +1 -0
- package/dist/core/forms/form-utils.js +135 -0
- package/dist/core/forms/form-utils.js.map +1 -0
- package/dist/core/forms/group.d.ts +12 -0
- package/dist/core/forms/group.d.ts.map +1 -1
- package/dist/core/forms/group.js +7 -0
- package/dist/core/forms/group.js.map +1 -1
- package/dist/core/forms/index.d.ts +6 -0
- package/dist/core/forms/index.d.ts.map +1 -1
- package/dist/core/forms/index.js +6 -0
- package/dist/core/forms/index.js.map +1 -1
- package/dist/core/forms/input.d.ts +17 -0
- package/dist/core/forms/input.d.ts.map +1 -1
- package/dist/core/forms/input.js +27 -15
- package/dist/core/forms/input.js.map +1 -1
- package/dist/core/forms/multiselect.d.ts +16 -0
- package/dist/core/forms/multiselect.d.ts.map +1 -1
- package/dist/core/forms/multiselect.js +54 -38
- package/dist/core/forms/multiselect.js.map +1 -1
- package/dist/core/forms/select.d.ts +17 -0
- package/dist/core/forms/select.d.ts.map +1 -1
- package/dist/core/forms/select.js +51 -37
- package/dist/core/forms/select.js.map +1 -1
- package/dist/core/forms/textarea.d.ts +19 -0
- package/dist/core/forms/textarea.d.ts.map +1 -1
- package/dist/core/forms/textarea.js +51 -47
- package/dist/core/forms/textarea.js.map +1 -1
- package/dist/core/forms/types.d.ts +41 -2
- package/dist/core/forms/types.d.ts.map +1 -1
- package/dist/core/forms/wizard.d.ts +19 -0
- package/dist/core/forms/wizard.d.ts.map +1 -1
- package/dist/core/forms/wizard.js +4 -0
- package/dist/core/forms/wizard.js.map +1 -1
- package/dist/core/resolve-ctx.d.ts +30 -0
- package/dist/core/resolve-ctx.d.ts.map +1 -0
- package/dist/core/resolve-ctx.js +43 -0
- package/dist/core/resolve-ctx.js.map +1 -0
- package/dist/core/text/clip.d.ts +6 -1
- package/dist/core/text/clip.d.ts.map +1 -1
- package/dist/core/text/clip.js +12 -3
- package/dist/core/text/clip.js.map +1 -1
- package/dist/core/text/grapheme.d.ts +15 -3
- package/dist/core/text/grapheme.d.ts.map +1 -1
- package/dist/core/text/grapheme.js +21 -3
- package/dist/core/text/grapheme.js.map +1 -1
- package/dist/core/text/index.d.ts +7 -0
- package/dist/core/text/index.d.ts.map +1 -1
- package/dist/core/text/index.js +7 -0
- package/dist/core/text/index.js.map +1 -1
- package/dist/core/theme/color.d.ts +47 -8
- package/dist/core/theme/color.d.ts.map +1 -1
- package/dist/core/theme/color.js +77 -8
- package/dist/core/theme/color.js.map +1 -1
- package/dist/core/theme/downsample.d.ts +24 -6
- package/dist/core/theme/downsample.d.ts.map +1 -1
- package/dist/core/theme/downsample.js +41 -10
- package/dist/core/theme/downsample.js.map +1 -1
- package/dist/core/theme/dtcg.d.ts +28 -2
- package/dist/core/theme/dtcg.d.ts.map +1 -1
- package/dist/core/theme/dtcg.js +112 -9
- package/dist/core/theme/dtcg.js.map +1 -1
- package/dist/core/theme/extend.d.ts +14 -0
- package/dist/core/theme/extend.d.ts.map +1 -1
- package/dist/core/theme/extend.js +14 -0
- package/dist/core/theme/extend.js.map +1 -1
- package/dist/core/theme/gradient.d.ts +16 -0
- package/dist/core/theme/gradient.d.ts.map +1 -1
- package/dist/core/theme/gradient.js +13 -0
- package/dist/core/theme/gradient.js.map +1 -1
- package/dist/core/theme/index.d.ts +7 -0
- package/dist/core/theme/index.d.ts.map +1 -1
- package/dist/core/theme/index.js +7 -0
- package/dist/core/theme/index.js.map +1 -1
- package/dist/core/theme/presets.d.ts +6 -1
- package/dist/core/theme/presets.d.ts.map +1 -1
- package/dist/core/theme/presets.js +34 -1
- package/dist/core/theme/presets.js.map +1 -1
- package/dist/core/theme/resolve.d.ts +59 -13
- package/dist/core/theme/resolve.d.ts.map +1 -1
- package/dist/core/theme/resolve.js +36 -9
- package/dist/core/theme/resolve.js.map +1 -1
- package/dist/core/theme/styled.d.ts +12 -0
- package/dist/core/theme/styled.d.ts.map +1 -1
- package/dist/core/theme/styled.js +12 -0
- package/dist/core/theme/styled.js.map +1 -1
- package/dist/core/theme/tokens.d.ts +29 -0
- package/dist/core/theme/tokens.d.ts.map +1 -1
- package/dist/factory.d.ts +18 -0
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +11 -0
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/ports/context.d.ts +11 -0
- package/dist/ports/context.d.ts.map +1 -1
- package/dist/ports/index.d.ts +6 -1
- package/dist/ports/index.d.ts.map +1 -1
- package/dist/ports/index.js +5 -0
- package/dist/ports/index.js.map +1 -1
- package/dist/ports/io.d.ts +66 -2
- package/dist/ports/io.d.ts.map +1 -1
- package/dist/ports/runtime.d.ts +11 -0
- package/dist/ports/runtime.d.ts.map +1 -1
- package/dist/ports/style.d.ts +14 -0
- package/dist/ports/style.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,40 +1,86 @@
|
|
|
1
1
|
import type { Theme, TokenValue, InkColor } from './tokens.js';
|
|
2
2
|
import type { RuntimePort } from '../../ports/runtime.js';
|
|
3
|
-
|
|
3
|
+
import type { ColorScheme } from '../detect/tty.js';
|
|
4
|
+
/**
|
|
5
|
+
* Check the no-color.org spec: `NO_COLOR` defined (any value) means no color.
|
|
6
|
+
* @param runtime - Optional RuntimePort for reading env vars; falls back to `process.env`.
|
|
7
|
+
* @returns True if the `NO_COLOR` environment variable is set.
|
|
8
|
+
*/
|
|
4
9
|
export declare function isNoColor(runtime?: RuntimePort): boolean;
|
|
10
|
+
/** A theme bundled with its noColor flag and convenience accessor methods. */
|
|
5
11
|
export interface ResolvedTheme {
|
|
12
|
+
/** The underlying Theme object. */
|
|
6
13
|
theme: Theme;
|
|
14
|
+
/** Whether color output is disabled (per `NO_COLOR`). */
|
|
7
15
|
noColor: boolean;
|
|
8
|
-
/**
|
|
16
|
+
/** Detected terminal color scheme (light or dark background). */
|
|
17
|
+
colorScheme: ColorScheme;
|
|
18
|
+
/**
|
|
19
|
+
* Return a hex string for Ink's `color=` prop, or `undefined` when noColor.
|
|
20
|
+
* @param token - Token to read the color from.
|
|
21
|
+
* @returns Hex string or `undefined`.
|
|
22
|
+
*/
|
|
9
23
|
ink(token: TokenValue): InkColor;
|
|
10
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Return a hex string for a status key, or `undefined` when noColor.
|
|
26
|
+
* @param status - Status key string to look up.
|
|
27
|
+
* @returns Hex string or `undefined`.
|
|
28
|
+
*/
|
|
11
29
|
inkStatus(status: string): InkColor;
|
|
12
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Return the raw hex string from a token (for chalk.hex() or boxen borderColor).
|
|
32
|
+
* @param token - Token to read the color from.
|
|
33
|
+
* @returns Hex string.
|
|
34
|
+
*/
|
|
13
35
|
hex(token: TokenValue): string;
|
|
14
36
|
}
|
|
15
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Create a ResolvedTheme from a Theme and a noColor flag.
|
|
39
|
+
* @param theme - The theme to wrap.
|
|
40
|
+
* @param noColor - Whether color output should be suppressed.
|
|
41
|
+
* @param colorScheme - Terminal color scheme. Defaults to `'dark'`.
|
|
42
|
+
* @returns ResolvedTheme with convenience accessors.
|
|
43
|
+
*/
|
|
44
|
+
export declare function createResolved(theme: Theme, noColor: boolean, colorScheme?: ColorScheme): ResolvedTheme;
|
|
45
|
+
/** Configuration options for creating a ThemeResolver. */
|
|
16
46
|
export interface ThemeResolverOptions {
|
|
17
|
-
/** Environment variable name to read theme from. Default: 'BIJOU_THEME'
|
|
47
|
+
/** Environment variable name to read theme from. Default: `'BIJOU_THEME'`. */
|
|
18
48
|
envVar?: string;
|
|
19
|
-
/** Preset registry. Default: bijou built-in PRESETS. */
|
|
49
|
+
/** Preset registry to look up theme names against. Default: bijou built-in PRESETS. */
|
|
20
50
|
presets?: Record<string, Theme>;
|
|
21
51
|
/** Fallback theme when env var / name doesn't match. Default: CYAN_MAGENTA. */
|
|
22
52
|
fallback?: Theme;
|
|
23
|
-
/** Optional RuntimePort for reading env vars. Falls back to process.env
|
|
53
|
+
/** Optional RuntimePort for reading env vars. Falls back to `process.env`. */
|
|
24
54
|
runtime?: RuntimePort;
|
|
25
55
|
}
|
|
56
|
+
/** A stateful theme resolver that caches the resolved theme and reads env vars. */
|
|
26
57
|
export interface ThemeResolver {
|
|
27
|
-
/**
|
|
58
|
+
/** Return the current resolved theme (cached singleton). */
|
|
28
59
|
getTheme(): ResolvedTheme;
|
|
29
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Resolve a theme by name, bypassing the singleton cache.
|
|
62
|
+
* @param name - Theme name to look up. Falls back to env var, then the default.
|
|
63
|
+
*/
|
|
30
64
|
resolveTheme(name?: string): ResolvedTheme;
|
|
31
|
-
/**
|
|
65
|
+
/** Reset the cached singleton. For tests only. */
|
|
32
66
|
_resetForTesting(): void;
|
|
33
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Create a ThemeResolver that reads theme name from an env var and looks it up in a preset registry.
|
|
70
|
+
* @param options - Resolver configuration (env var name, presets, fallback, runtime port).
|
|
71
|
+
* @returns ThemeResolver with `getTheme`, `resolveTheme`, and `_resetForTesting` methods.
|
|
72
|
+
*/
|
|
34
73
|
export declare function createThemeResolver(options?: ThemeResolverOptions): ThemeResolver;
|
|
35
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* Return the current resolved theme (singleton) using the default resolver.
|
|
76
|
+
* @returns Cached ResolvedTheme from the default resolver.
|
|
77
|
+
*/
|
|
36
78
|
export declare function getTheme(): ResolvedTheme;
|
|
37
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Resolve a theme by name using the default resolver (bypasses cache).
|
|
81
|
+
* @param name - Theme name to look up.
|
|
82
|
+
* @returns ResolvedTheme for the given name.
|
|
83
|
+
*/
|
|
38
84
|
export declare function resolveTheme(name?: string): ResolvedTheme;
|
|
39
85
|
/** Resets the default resolver's cached singleton. For tests only. */
|
|
40
86
|
export declare function _resetThemeForTesting(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/core/theme/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/core/theme/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIpD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAGxD;AAED,8EAA8E;AAC9E,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,KAAK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
|
@@ -1,14 +1,27 @@
|
|
|
1
|
+
import { detectColorScheme } from '../detect/tty.js';
|
|
1
2
|
import { PRESETS, CYAN_MAGENTA } from './presets.js';
|
|
2
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Check the no-color.org spec: `NO_COLOR` defined (any value) means no color.
|
|
5
|
+
* @param runtime - Optional RuntimePort for reading env vars; falls back to `process.env`.
|
|
6
|
+
* @returns True if the `NO_COLOR` environment variable is set.
|
|
7
|
+
*/
|
|
3
8
|
export function isNoColor(runtime) {
|
|
4
9
|
if (runtime)
|
|
5
10
|
return runtime.env('NO_COLOR') !== undefined;
|
|
6
11
|
return process.env['NO_COLOR'] !== undefined;
|
|
7
12
|
}
|
|
8
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Create a ResolvedTheme from a Theme and a noColor flag.
|
|
15
|
+
* @param theme - The theme to wrap.
|
|
16
|
+
* @param noColor - Whether color output should be suppressed.
|
|
17
|
+
* @param colorScheme - Terminal color scheme. Defaults to `'dark'`.
|
|
18
|
+
* @returns ResolvedTheme with convenience accessors.
|
|
19
|
+
*/
|
|
20
|
+
export function createResolved(theme, noColor, colorScheme = 'dark') {
|
|
9
21
|
return {
|
|
10
22
|
theme,
|
|
11
23
|
noColor,
|
|
24
|
+
colorScheme,
|
|
12
25
|
ink(token) {
|
|
13
26
|
return noColor ? undefined : token.hex;
|
|
14
27
|
},
|
|
@@ -24,6 +37,11 @@ export function createResolved(theme, noColor) {
|
|
|
24
37
|
},
|
|
25
38
|
};
|
|
26
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Create a ThemeResolver that reads theme name from an env var and looks it up in a preset registry.
|
|
42
|
+
* @param options - Resolver configuration (env var name, presets, fallback, runtime port).
|
|
43
|
+
* @returns ThemeResolver with `getTheme`, `resolveTheme`, and `_resetForTesting` methods.
|
|
44
|
+
*/
|
|
27
45
|
export function createThemeResolver(options = {}) {
|
|
28
46
|
const envVar = options.envVar ?? 'BIJOU_THEME';
|
|
29
47
|
const presets = options.presets ?? PRESETS;
|
|
@@ -37,39 +55,48 @@ export function createThemeResolver(options = {}) {
|
|
|
37
55
|
if (cached !== null)
|
|
38
56
|
return cached;
|
|
39
57
|
const noColor = isNoColor(runtime);
|
|
58
|
+
const colorScheme = detectColorScheme(runtime);
|
|
40
59
|
const themeName = readEnv(envVar) ?? fallback.name;
|
|
41
60
|
const theme = presets[themeName];
|
|
42
61
|
if (theme === undefined) {
|
|
43
62
|
console.warn(`[bijou] Unknown ${envVar}="${themeName}", falling back to "${fallback.name}".`);
|
|
44
|
-
cached = createResolved(fallback, noColor);
|
|
63
|
+
cached = createResolved(fallback, noColor, colorScheme);
|
|
45
64
|
}
|
|
46
65
|
else {
|
|
47
|
-
cached = createResolved(theme, noColor);
|
|
66
|
+
cached = createResolved(theme, noColor, colorScheme);
|
|
48
67
|
}
|
|
49
68
|
return cached;
|
|
50
69
|
}
|
|
51
70
|
function resolveTheme(name) {
|
|
52
71
|
const noColor = isNoColor(runtime);
|
|
72
|
+
const colorScheme = detectColorScheme(runtime);
|
|
53
73
|
const themeName = name ?? readEnv(envVar) ?? fallback.name;
|
|
54
74
|
const theme = presets[themeName];
|
|
55
75
|
if (theme === undefined) {
|
|
56
76
|
console.warn(`[bijou] Unknown theme "${themeName}", falling back to "${fallback.name}".`);
|
|
57
|
-
return createResolved(fallback, noColor);
|
|
77
|
+
return createResolved(fallback, noColor, colorScheme);
|
|
58
78
|
}
|
|
59
|
-
return createResolved(theme, noColor);
|
|
79
|
+
return createResolved(theme, noColor, colorScheme);
|
|
60
80
|
}
|
|
61
81
|
function _resetForTesting() {
|
|
62
82
|
cached = null;
|
|
63
83
|
}
|
|
64
84
|
return { getTheme, resolveTheme, _resetForTesting };
|
|
65
85
|
}
|
|
66
|
-
|
|
86
|
+
/** Default resolver — uses `BIJOU_THEME` env var and built-in presets. */
|
|
67
87
|
const defaultResolver = createThemeResolver();
|
|
68
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* Return the current resolved theme (singleton) using the default resolver.
|
|
90
|
+
* @returns Cached ResolvedTheme from the default resolver.
|
|
91
|
+
*/
|
|
69
92
|
export function getTheme() {
|
|
70
93
|
return defaultResolver.getTheme();
|
|
71
94
|
}
|
|
72
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* Resolve a theme by name using the default resolver (bypasses cache).
|
|
97
|
+
* @param name - Theme name to look up.
|
|
98
|
+
* @returns ResolvedTheme for the given name.
|
|
99
|
+
*/
|
|
73
100
|
export function resolveTheme(name) {
|
|
74
101
|
return defaultResolver.resolveTheme(name);
|
|
75
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../src/core/theme/resolve.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../src/core/theme/resolve.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAErD;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,OAAqB;IAC7C,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,SAAS,CAAC;IAC1D,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,SAAS,CAAC;AAC/C,CAAC;AAiCD;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,KAAY,EAAE,OAAgB,EAAE,cAA2B,MAAM;IAC9F,OAAO;QACL,KAAK;QACL,OAAO;QACP,WAAW;QAEX,GAAG,CAAC,KAAiB;YACnB,OAAO,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;QACzC,CAAC;QAED,SAAS,CAAC,MAAc;YACtB,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,MAAmC,CAA2B,CAAC;YAC1F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AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,IAAa;IACxC,OAAO,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,qBAAqB;IACnC,eAAe,CAAC,gBAAgB,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import type { TokenValue } from './tokens.js';
|
|
2
|
+
/**
|
|
3
|
+
* Apply a token's color and modifiers to a string using the default context's style port.
|
|
4
|
+
* @param token - Token whose hex color and modifiers are applied.
|
|
5
|
+
* @param text - Text to style.
|
|
6
|
+
* @returns Styled text string.
|
|
7
|
+
*/
|
|
2
8
|
export declare function styled(token: TokenValue, text: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Style text using the token for a given status key, falling back to `muted` if the key is unknown.
|
|
11
|
+
* @param status - Status key to look up in the current theme.
|
|
12
|
+
* @param text - Text to display (defaults to the status key itself).
|
|
13
|
+
* @returns Styled text string.
|
|
14
|
+
*/
|
|
3
15
|
export declare function styledStatus(status: string, text?: string): string;
|
|
4
16
|
//# sourceMappingURL=styled.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/core/theme/styled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,wBAAgB,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAQlE"}
|
|
1
|
+
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/core/theme/styled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAQlE"}
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { getDefaultContext } from '../../context.js';
|
|
2
|
+
/**
|
|
3
|
+
* Apply a token's color and modifiers to a string using the default context's style port.
|
|
4
|
+
* @param token - Token whose hex color and modifiers are applied.
|
|
5
|
+
* @param text - Text to style.
|
|
6
|
+
* @returns Styled text string.
|
|
7
|
+
*/
|
|
2
8
|
export function styled(token, text) {
|
|
3
9
|
return getDefaultContext().style.styled(token, text);
|
|
4
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Style text using the token for a given status key, falling back to `muted` if the key is unknown.
|
|
13
|
+
* @param status - Status key to look up in the current theme.
|
|
14
|
+
* @param text - Text to display (defaults to the status key itself).
|
|
15
|
+
* @returns Styled text string.
|
|
16
|
+
*/
|
|
5
17
|
export function styledStatus(status, text) {
|
|
6
18
|
const theme = getDefaultContext().theme;
|
|
7
19
|
const token = theme.theme.status[status];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","sourceRoot":"","sources":["../../../src/core/theme/styled.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,UAAU,MAAM,CAAC,KAAiB,EAAE,IAAY;IACpD,OAAO,iBAAiB,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,IAAa;IACxD,MAAM,KAAK,GAAG,iBAAiB,EAAE,CAAC,KAAK,CAAC;IACxC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAyC,CAA2B,CAAC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deterministic across
|
|
5
5
|
* terminals (unlike named ANSI colors which depend on terminal palette).
|
|
6
6
|
*/
|
|
7
|
+
/** Red, green, blue channel values as a three-element tuple (0–255 each). */
|
|
7
8
|
export type RGB = [number, number, number];
|
|
9
|
+
/** A single color stop in a gradient, positioned at a normalized value (0–1). */
|
|
8
10
|
export interface GradientStop {
|
|
11
|
+
/** Normalized position along the gradient (0 = start, 1 = end). */
|
|
9
12
|
pos: number;
|
|
13
|
+
/** RGB color at this stop. */
|
|
10
14
|
color: RGB;
|
|
11
15
|
}
|
|
16
|
+
/** Supported text style modifiers that can be applied alongside a color. */
|
|
12
17
|
export type TextModifier = 'bold' | 'dim' | 'strikethrough' | 'inverse';
|
|
18
|
+
/** A theme token value: a hex color with optional text modifiers. */
|
|
13
19
|
export interface TokenValue {
|
|
20
|
+
/** Foreground color as a `#rrggbb` hex string. */
|
|
14
21
|
hex: string;
|
|
22
|
+
/** Optional background color as a `#rrggbb` hex string. */
|
|
23
|
+
bg?: string;
|
|
24
|
+
/** Optional text style modifiers to apply alongside the color. */
|
|
15
25
|
modifiers?: TextModifier[];
|
|
16
26
|
}
|
|
17
27
|
/** Color returned for Ink components — `undefined` means "use default terminal color" (NO_COLOR). */
|
|
@@ -40,8 +50,11 @@ export type BaseGradientKey = 'brand' | 'progress';
|
|
|
40
50
|
* ```
|
|
41
51
|
*/
|
|
42
52
|
export interface Theme<S extends string = BaseStatusKey, U extends string = BaseUiKey, G extends string = BaseGradientKey> {
|
|
53
|
+
/** Human-readable theme name (used as a registry key in presets). */
|
|
43
54
|
name: string;
|
|
55
|
+
/** Status tokens mapped by status key (e.g. success, error). */
|
|
44
56
|
status: Record<S, TokenValue>;
|
|
57
|
+
/** Semantic color tokens for general-purpose UI coloring. */
|
|
45
58
|
semantic: {
|
|
46
59
|
success: TokenValue;
|
|
47
60
|
error: TokenValue;
|
|
@@ -51,7 +64,9 @@ export interface Theme<S extends string = BaseStatusKey, U extends string = Base
|
|
|
51
64
|
muted: TokenValue;
|
|
52
65
|
primary: TokenValue;
|
|
53
66
|
};
|
|
67
|
+
/** Named gradient definitions, each as an array of color stops. */
|
|
54
68
|
gradient: Record<G, GradientStop[]>;
|
|
69
|
+
/** Border color tokens for box and container outlines. */
|
|
55
70
|
border: {
|
|
56
71
|
primary: TokenValue;
|
|
57
72
|
secondary: TokenValue;
|
|
@@ -60,6 +75,20 @@ export interface Theme<S extends string = BaseStatusKey, U extends string = Base
|
|
|
60
75
|
error: TokenValue;
|
|
61
76
|
muted: TokenValue;
|
|
62
77
|
};
|
|
78
|
+
/** UI element tokens (cursors, scroll bars, headers, etc.). */
|
|
63
79
|
ui: Record<U, TokenValue>;
|
|
80
|
+
/** Background surface tokens for panels, regions, and overlays. */
|
|
81
|
+
surface: {
|
|
82
|
+
/** Default content background. */
|
|
83
|
+
primary: TokenValue;
|
|
84
|
+
/** Secondary/sidebar background. */
|
|
85
|
+
secondary: TokenValue;
|
|
86
|
+
/** Elevated surface (cards, dropdowns). */
|
|
87
|
+
elevated: TokenValue;
|
|
88
|
+
/** Overlay/scrim background (modals, drawers). */
|
|
89
|
+
overlay: TokenValue;
|
|
90
|
+
/** Muted/disabled region background. */
|
|
91
|
+
muted: TokenValue;
|
|
92
|
+
};
|
|
64
93
|
}
|
|
65
94
|
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/core/theme/tokens.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3C,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,GAAG,CAAC;CACZ;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,eAAe,GAAG,SAAS,CAAC;AAExE,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,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AAC,SAAS,MAAM,GAAG,eAAe;IAElC,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IAEb,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IAE9B,6DAA6D;IAC7D,QAAQ,EAAE;QACR,OAAO,EAAE,UAAU,CAAC;QACpB,KAAK,EAAE,UAAU,CAAC;QAClB,OAAO,EAAE,UAAU,CAAC;QACpB,IAAI,EAAE,UAAU,CAAC;QACjB,MAAM,EAAE,UAAU,CAAC;QACnB,KAAK,EAAE,UAAU,CAAC;QAClB,OAAO,EAAE,UAAU,CAAC;KACrB,CAAC;IAEF,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;IAEpC,0DAA0D;IAC1D,MAAM,EAAE;QACN,OAAO,EAAE,UAAU,CAAC;QACpB,SAAS,EAAE,UAAU,CAAC;QACtB,OAAO,EAAE,UAAU,CAAC;QACpB,OAAO,EAAE,UAAU,CAAC;QACpB,KAAK,EAAE,UAAU,CAAC;QAClB,KAAK,EAAE,UAAU,CAAC;KACnB,CAAC;IAEF,+DAA+D;IAC/D,EAAE,EAAE,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IAE1B,mEAAmE;IACnE,OAAO,EAAE;QACP,kCAAkC;QAClC,OAAO,EAAE,UAAU,CAAC;QACpB,oCAAoC;QACpC,SAAS,EAAE,UAAU,CAAC;QACtB,2CAA2C;QAC3C,QAAQ,EAAE,UAAU,CAAC;QACrB,kDAAkD;QAClD,OAAO,EAAE,UAAU,CAAC;QACpB,wCAAwC;QACxC,KAAK,EAAE,UAAU,CAAC;KACnB,CAAC;CACH"}
|
package/dist/factory.d.ts
CHANGED
|
@@ -3,13 +3,31 @@ import type { RuntimePort } from './ports/runtime.js';
|
|
|
3
3
|
import type { IOPort } from './ports/io.js';
|
|
4
4
|
import type { StylePort } from './ports/style.js';
|
|
5
5
|
import type { Theme } from './core/theme/tokens.js';
|
|
6
|
+
/** Options for {@link createBijou}. */
|
|
6
7
|
export interface CreateBijouOptions {
|
|
8
|
+
/** Runtime environment adapter. */
|
|
7
9
|
runtime: RuntimePort;
|
|
10
|
+
/** I/O adapter (stdin/stdout, filesystem). */
|
|
8
11
|
io: IOPort;
|
|
12
|
+
/** Style adapter (chalk, plain-text, etc.). */
|
|
9
13
|
style: StylePort;
|
|
14
|
+
/** Explicit theme object. Defaults to {@link CYAN_MAGENTA}. */
|
|
10
15
|
theme?: Theme;
|
|
16
|
+
/** Named preset themes, keyed by name. Defaults to built-in {@link PRESETS}. */
|
|
11
17
|
presets?: Record<string, Theme>;
|
|
18
|
+
/** Environment variable that selects a preset or JSON path. Defaults to `"BIJOU_THEME"`. */
|
|
12
19
|
envVar?: string;
|
|
13
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Create a fully-wired {@link BijouContext} from adapter ports.
|
|
23
|
+
*
|
|
24
|
+
* Theme resolution order:
|
|
25
|
+
* 1. If the env-var points to a `.json` file, load and parse it as a DTCG document.
|
|
26
|
+
* 2. Otherwise look the env-var value up in `presets`.
|
|
27
|
+
* 3. Fall back to the explicit `theme` option (or the built-in default).
|
|
28
|
+
*
|
|
29
|
+
* @param options - Adapter ports and optional theme overrides.
|
|
30
|
+
* @returns A context object ready to pass to any bijou component.
|
|
31
|
+
*/
|
|
14
32
|
export declare function createBijou(options: CreateBijouOptions): BijouContext;
|
|
15
33
|
//# sourceMappingURL=factory.d.ts.map
|
package/dist/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KA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BrE"}
|
package/dist/factory.js
CHANGED
|
@@ -3,6 +3,17 @@ import { CYAN_MAGENTA } from './core/theme/presets.js';
|
|
|
3
3
|
import { PRESETS } from './core/theme/presets.js';
|
|
4
4
|
import { fromDTCG } from './core/theme/dtcg.js';
|
|
5
5
|
import { detectOutputMode } from './core/detect/tty.js';
|
|
6
|
+
/**
|
|
7
|
+
* Create a fully-wired {@link BijouContext} from adapter ports.
|
|
8
|
+
*
|
|
9
|
+
* Theme resolution order:
|
|
10
|
+
* 1. If the env-var points to a `.json` file, load and parse it as a DTCG document.
|
|
11
|
+
* 2. Otherwise look the env-var value up in `presets`.
|
|
12
|
+
* 3. Fall back to the explicit `theme` option (or the built-in default).
|
|
13
|
+
*
|
|
14
|
+
* @param options - Adapter ports and optional theme overrides.
|
|
15
|
+
* @returns A context object ready to pass to any bijou component.
|
|
16
|
+
*/
|
|
6
17
|
export function createBijou(options) {
|
|
7
18
|
const { runtime, io, style } = options;
|
|
8
19
|
const envVar = options.envVar ?? 'BIJOU_THEME';
|
package/dist/factory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAsB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAqB,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAsB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,C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,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;AAC7C,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module @flyingrobots/bijou
|
|
3
|
+
*
|
|
4
|
+
* Themed terminal components for CLIs, loggers, and scripts —
|
|
5
|
+
* with graceful degradation across output modes.
|
|
6
|
+
*/
|
|
7
|
+
export type { RuntimePort, WritePort, QueryPort, InteractivePort, FilePort, IOPort, RawInputHandle, TimerHandle, StylePort, BijouContext, } from './ports/index.js';
|
|
2
8
|
export { getDefaultContext, setDefaultContext, _resetDefaultContextForTesting, } from './context.js';
|
|
9
|
+
export { resolveCtx, resolveSafeCtx } from './core/resolve-ctx.js';
|
|
10
|
+
export { shouldApplyBg, makeBgFill } from './core/bg-fill.js';
|
|
3
11
|
export { createBijou, type CreateBijouOptions } from './factory.js';
|
|
4
12
|
export { type RGB, type GradientStop, type TextModifier, type TokenValue, type InkColor, type BaseStatusKey, type BaseUiKey, type BaseGradientKey, type Theme, CYAN_MAGENTA, TEAL_ORANGE_PINK, PRESETS, tv, styled, styledStatus, extendTheme, lerp3, gradientText, type GradientTextOptions, isNoColor, getTheme, resolveTheme, _resetThemeForTesting, createThemeResolver, createResolved, type ResolvedTheme, type ThemeResolver, type ThemeResolverOptions, fromDTCG, toDTCG, type DTCGDocument, type DTCGToken, type DTCGGroup, rgbToAnsi256, nearestAnsi256, rgbToAnsi16, ansi256ToAnsi16, type ColorLevel, hexToRgb, rgbToHex, lighten, darken, mix, complementary, saturate, desaturate, } from './core/theme/index.js';
|
|
5
13
|
export { isWideChar, segmentGraphemes, graphemeClusterWidth, graphemeWidth, clipToWidth, } from './core/text/index.js';
|
|
6
|
-
export { detectOutputMode, type OutputMode } from './core/detect/index.js';
|
|
14
|
+
export { detectOutputMode, detectColorScheme, type OutputMode, type ColorScheme, } from './core/detect/index.js';
|
|
7
15
|
export { spinnerFrame, createSpinner, type SpinnerOptions, type SpinnerController, progressBar, createProgressBar, createAnimatedProgressBar, type ProgressBarOptions, type LiveProgressBarOptions, type AnimatedProgressBarOptions, type ProgressBarController, table, type TableColumn, type TableOptions, box, headerBox, type BoxOptions, type HeaderBoxOptions, selectLogoSize, loadRandomLogo, type LogoSize, type LogoResult, type LogoConstraints, type LogoOptions, separator, type SeparatorOptions, badge, type BadgeVariant, type BadgeOptions, alert, type AlertVariant, type AlertOptions, skeleton, type SkeletonOptions, kbd, type KbdOptions, tree, type TreeNode, type TreeOptions, accordion, type AccordionSection, type AccordionOptions, timeline, type TimelineEvent, type TimelineOptions, tabs, type TabItem, type TabsOptions, breadcrumb, type BreadcrumbOptions, paginator, type PaginatorOptions, stepper, type StepperStep, type StepperOptions, dag, dagSlice, dagLayout, type DagNode, type DagOptions, type DagNodePosition, type DagLayout, arraySource, isDagSource, isSlicedDagSource, type DagSource, type SlicedDagSource, type DagSliceOptions, dagStats, type DagStats, enumeratedList, type BulletStyle, type EnumeratedListOptions, hyperlink, type HyperlinkOptions, log, type LogLevel, type LogOptions, markdown, type MarkdownOptions, } from './core/components/index.js';
|
|
8
16
|
export { type ValidationResult, type Validator, type FieldOptions, type SelectOption, type SelectFieldOptions, type ConfirmFieldOptions, type GroupFieldResult, type InputOptions, input, select, multiselect, confirm, group, textarea, type TextareaOptions, filter, type FilterOption, type FilterOptions, wizard, type WizardStep, type WizardOptions, } from './core/forms/index.js';
|
|
9
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,eAAe,EACf,QAAQ,EACR,MAAM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,KAAK,UAAU,EACf,QAAQ,EACR,KAAK,eAAe,GACrB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,EACL,MAAM,EACN,WAAW,EACX,OAAO,EACP,KAAK,EACL,QAAQ,EACR,KAAK,eAAe,EACpB,MAAM,EACN,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,MAAM,EACN,KAAK,UAAU,EACf,KAAK,aAAa,GACnB,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @flyingrobots/bijou
|
|
3
|
+
*
|
|
4
|
+
* Themed terminal components for CLIs, loggers, and scripts —
|
|
5
|
+
* with graceful degradation across output modes.
|
|
6
|
+
*/
|
|
1
7
|
// Context
|
|
2
8
|
export { getDefaultContext, setDefaultContext, _resetDefaultContextForTesting, } from './context.js';
|
|
9
|
+
// Context resolution helpers
|
|
10
|
+
export { resolveCtx, resolveSafeCtx } from './core/resolve-ctx.js';
|
|
11
|
+
// Background fill utilities
|
|
12
|
+
export { shouldApplyBg, makeBgFill } from './core/bg-fill.js';
|
|
3
13
|
// Factory
|
|
4
14
|
export { createBijou } from './factory.js';
|
|
5
15
|
// Theme engine
|
|
@@ -23,7 +33,7 @@ hexToRgb, rgbToHex, lighten, darken, mix, complementary, saturate, desaturate, }
|
|
|
23
33
|
// Text / grapheme utilities
|
|
24
34
|
export { isWideChar, segmentGraphemes, graphemeClusterWidth, graphemeWidth, clipToWidth, } from './core/text/index.js';
|
|
25
35
|
// Detection
|
|
26
|
-
export { detectOutputMode } from './core/detect/index.js';
|
|
36
|
+
export { detectOutputMode, detectColorScheme, } from './core/detect/index.js';
|
|
27
37
|
// Components
|
|
28
38
|
export { spinnerFrame, createSpinner, progressBar, createProgressBar, createAnimatedProgressBar, table, box, headerBox, selectLogoSize, loadRandomLogo, separator, badge, alert, skeleton, kbd, tree, accordion, timeline, tabs, breadcrumb, paginator, stepper, dag, dagSlice, dagLayout, arraySource, isDagSource, isSlicedDagSource, dagStats, enumeratedList, hyperlink, log, markdown, } from './core/components/index.js';
|
|
29
39
|
// Forms
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgBH,UAAU;AACV,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,8BAA8B,GAC/B,MAAM,cAAc,CAAC;AAEtB,6BAA6B;AAC7B,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEnE,4BAA4B;AAC5B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE9D,UAAU;AACV,OAAO,EAAE,WAAW,EAA2B,MAAM,cAAc,CAAC;AAEpE,eAAe;AACf,OAAO;AAWL,UAAU;AACV,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,EAAE;AACF,8BAA8B;AAC9B,MAAM,EACN,YAAY;AACZ,kBAAkB;AAClB,WAAW;AACX,WAAW;AACX,KAAK,EACL,YAAY;AAGZ,WAAW;AACX,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,cAAc;AAId,eAAe;AACf,QAAQ,EACR,MAAM;AAIN,qBAAqB;AACrB,YAAY,EACZ,cAAc,EACd,WAAW,EACX,eAAe;AAEf,qBAAqB;AACrB,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,MAAM,EACN,GAAG,EACH,aAAa,EACb,QAAQ,EACR,UAAU,GACX,MAAM,uBAAuB,CAAC;AAE/B,4BAA4B;AAC5B,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAE9B,YAAY;AACZ,OAAO,EACL,gBAAgB,EAChB,iBAAiB,GAGlB,MAAM,wBAAwB,CAAC;AAEhC,aAAa;AACb,OAAO,EACL,YAAY,EACZ,aAAa,EAGb,WAAW,EACX,iBAAiB,EACjB,yBAAyB,EAKzB,KAAK,EAGL,GAAG,EACH,SAAS,EAGT,cAAc,EACd,cAAc,EAKd,SAAS,EAET,KAAK,EAGL,KAAK,EAGL,QAAQ,EAER,GAAG,EAEH,IAAI,EAGJ,SAAS,EAGT,QAAQ,EAGR,IAAI,EAGJ,UAAU,EAEV,SAAS,EAET,OAAO,EAGP,GAAG,EACH,QAAQ,EACR,SAAS,EAKT,WAAW,EACX,WAAW,EACX,iBAAiB,EAIjB,QAAQ,EAER,cAAc,EAGd,SAAS,EAET,GAAG,EAGH,QAAQ,GAET,MAAM,4BAA4B,CAAC;AAEpC,QAAQ;AACR,OAAO,EASL,KAAK,EACL,MAAM,EACN,WAAW,EACX,OAAO,EACP,KAAK,EACL,QAAQ,EAER,MAAM,EAGN,MAAM,GAGP,MAAM,uBAAuB,CAAC"}
|
package/dist/ports/context.d.ts
CHANGED
|
@@ -3,11 +3,22 @@ import type { OutputMode } from '../core/detect/tty.js';
|
|
|
3
3
|
import type { RuntimePort } from './runtime.js';
|
|
4
4
|
import type { IOPort } from './io.js';
|
|
5
5
|
import type { StylePort } from './style.js';
|
|
6
|
+
/**
|
|
7
|
+
* Top-level dependency-injection context threaded through every bijou component.
|
|
8
|
+
*
|
|
9
|
+
* Bundles the resolved theme, output mode, and all port adapters so that
|
|
10
|
+
* components never reach for Node.js globals directly.
|
|
11
|
+
*/
|
|
6
12
|
export interface BijouContext {
|
|
13
|
+
/** Fully-resolved theme with color tokens ready for rendering. */
|
|
7
14
|
readonly theme: ResolvedTheme;
|
|
15
|
+
/** Current output fidelity: `'interactive'`, `'static'`, `'pipe'`, or `'accessible'`. */
|
|
8
16
|
readonly mode: OutputMode;
|
|
17
|
+
/** Environment / terminal dimensions adapter. */
|
|
9
18
|
readonly runtime: RuntimePort;
|
|
19
|
+
/** I/O adapter (stdin/stdout, filesystem). */
|
|
10
20
|
readonly io: IOPort;
|
|
21
|
+
/** Color / text-decoration adapter. */
|
|
11
22
|
readonly style: StylePort;
|
|
12
23
|
}
|
|
13
24
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/ports/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;CAC3B"}
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/ports/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,yFAAyF;IACzF,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,iDAAiD;IACjD,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;CAC3B"}
|
package/dist/ports/index.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hexagonal-architecture port interfaces for bijou.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
1
6
|
export type { RuntimePort } from './runtime.js';
|
|
2
|
-
export type { IOPort, RawInputHandle, TimerHandle } from './io.js';
|
|
7
|
+
export type { WritePort, QueryPort, InteractivePort, FilePort, IOPort, RawInputHandle, TimerHandle } from './io.js';
|
|
3
8
|
export type { StylePort } from './style.js';
|
|
4
9
|
export type { BijouContext } from './context.js';
|
|
5
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ports/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ports/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACpH,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/ports/index.js
CHANGED
package/dist/ports/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ports/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ports/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|