@hypercli/ui 0.1.1
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/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/capabilities/index.d.ts +62 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +182 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/colors.d.ts +32 -0
- package/dist/colors.d.ts.map +1 -0
- package/dist/colors.js +40 -0
- package/dist/colors.js.map +1 -0
- package/dist/components/columns.d.ts +28 -0
- package/dist/components/columns.d.ts.map +1 -0
- package/dist/components/columns.js +70 -0
- package/dist/components/columns.js.map +1 -0
- package/dist/components/confirmPrompt.d.ts +38 -0
- package/dist/components/confirmPrompt.d.ts.map +1 -0
- package/dist/components/confirmPrompt.js +109 -0
- package/dist/components/confirmPrompt.js.map +1 -0
- package/dist/components/diff.d.ts +37 -0
- package/dist/components/diff.d.ts.map +1 -0
- package/dist/components/diff.js +36 -0
- package/dist/components/diff.js.map +1 -0
- package/dist/components/helpLayout.d.ts +59 -0
- package/dist/components/helpLayout.d.ts.map +1 -0
- package/dist/components/helpLayout.js +103 -0
- package/dist/components/helpLayout.js.map +1 -0
- package/dist/components/index.d.ts +38 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +23 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/keyValue.d.ts +31 -0
- package/dist/components/keyValue.d.ts.map +1 -0
- package/dist/components/keyValue.js +36 -0
- package/dist/components/keyValue.js.map +1 -0
- package/dist/components/list.d.ts +30 -0
- package/dist/components/list.d.ts.map +1 -0
- package/dist/components/list.js +80 -0
- package/dist/components/list.js.map +1 -0
- package/dist/components/message.d.ts +33 -0
- package/dist/components/message.d.ts.map +1 -0
- package/dist/components/message.js +86 -0
- package/dist/components/message.js.map +1 -0
- package/dist/components/panel.d.ts +28 -0
- package/dist/components/panel.d.ts.map +1 -0
- package/dist/components/panel.js +30 -0
- package/dist/components/panel.js.map +1 -0
- package/dist/components/progressBar.d.ts +44 -0
- package/dist/components/progressBar.d.ts.map +1 -0
- package/dist/components/progressBar.js +154 -0
- package/dist/components/progressBar.js.map +1 -0
- package/dist/components/section.d.ts +22 -0
- package/dist/components/section.d.ts.map +1 -0
- package/dist/components/section.js +48 -0
- package/dist/components/section.js.map +1 -0
- package/dist/components/selectPrompt.d.ts +58 -0
- package/dist/components/selectPrompt.d.ts.map +1 -0
- package/dist/components/selectPrompt.js +206 -0
- package/dist/components/selectPrompt.js.map +1 -0
- package/dist/components/spinner.d.ts +38 -0
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/spinner.js +125 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/statusList.d.ts +22 -0
- package/dist/components/statusList.d.ts.map +1 -0
- package/dist/components/statusList.js +43 -0
- package/dist/components/statusList.js.map +1 -0
- package/dist/components/table.d.ts +39 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +132 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/textPrompt.d.ts +43 -0
- package/dist/components/textPrompt.d.ts.map +1 -0
- package/dist/components/textPrompt.js +123 -0
- package/dist/components/textPrompt.js.map +1 -0
- package/dist/components/tree.d.ts +30 -0
- package/dist/components/tree.d.ts.map +1 -0
- package/dist/components/tree.js +49 -0
- package/dist/components/tree.js.map +1 -0
- package/dist/ds-index.d.ts +113 -0
- package/dist/ds-index.d.ts.map +1 -0
- package/dist/ds-index.js +112 -0
- package/dist/ds-index.js.map +1 -0
- package/dist/help.d.ts +32 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/help.js +34 -0
- package/dist/help.js.map +1 -0
- package/dist/hyper-theme.d.ts +8 -0
- package/dist/hyper-theme.d.ts.map +1 -0
- package/dist/hyper-theme.js +30 -0
- package/dist/hyper-theme.js.map +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/md.d.ts +12 -0
- package/dist/md.d.ts.map +1 -0
- package/dist/md.js +19 -0
- package/dist/md.js.map +1 -0
- package/dist/messages.d.ts +20 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +65 -0
- package/dist/messages.js.map +1 -0
- package/dist/palette.d.ts +20 -0
- package/dist/palette.d.ts.map +1 -0
- package/dist/palette.js +22 -0
- package/dist/palette.js.map +1 -0
- package/dist/primitives/align.d.ts +23 -0
- package/dist/primitives/align.d.ts.map +1 -0
- package/dist/primitives/align.js +40 -0
- package/dist/primitives/align.js.map +1 -0
- package/dist/primitives/badge.d.ts +24 -0
- package/dist/primitives/badge.d.ts.map +1 -0
- package/dist/primitives/badge.js +40 -0
- package/dist/primitives/badge.js.map +1 -0
- package/dist/primitives/border.d.ts +29 -0
- package/dist/primitives/border.d.ts.map +1 -0
- package/dist/primitives/border.js +100 -0
- package/dist/primitives/border.js.map +1 -0
- package/dist/primitives/context.d.ts +48 -0
- package/dist/primitives/context.d.ts.map +1 -0
- package/dist/primitives/context.js +64 -0
- package/dist/primitives/context.js.map +1 -0
- package/dist/primitives/divider.d.ts +25 -0
- package/dist/primitives/divider.d.ts.map +1 -0
- package/dist/primitives/divider.js +56 -0
- package/dist/primitives/divider.js.map +1 -0
- package/dist/primitives/indent.d.ts +16 -0
- package/dist/primitives/indent.d.ts.map +1 -0
- package/dist/primitives/indent.js +25 -0
- package/dist/primitives/indent.js.map +1 -0
- package/dist/primitives/index.d.ts +32 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +22 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/primitives/line.d.ts +21 -0
- package/dist/primitives/line.d.ts.map +1 -0
- package/dist/primitives/line.js +29 -0
- package/dist/primitives/line.js.map +1 -0
- package/dist/primitives/markdown.d.ts +91 -0
- package/dist/primitives/markdown.d.ts.map +1 -0
- package/dist/primitives/markdown.js +62 -0
- package/dist/primitives/markdown.js.map +1 -0
- package/dist/primitives/pad.d.ts +24 -0
- package/dist/primitives/pad.d.ts.map +1 -0
- package/dist/primitives/pad.js +20 -0
- package/dist/primitives/pad.js.map +1 -0
- package/dist/primitives/stack.d.ts +22 -0
- package/dist/primitives/stack.d.ts.map +1 -0
- package/dist/primitives/stack.js +21 -0
- package/dist/primitives/stack.js.map +1 -0
- package/dist/primitives/styledText.d.ts +36 -0
- package/dist/primitives/styledText.d.ts.map +1 -0
- package/dist/primitives/styledText.js +42 -0
- package/dist/primitives/styledText.js.map +1 -0
- package/dist/primitives/symbol.d.ts +15 -0
- package/dist/primitives/symbol.d.ts.map +1 -0
- package/dist/primitives/symbol.js +18 -0
- package/dist/primitives/symbol.js.map +1 -0
- package/dist/primitives/truncate.d.ts +23 -0
- package/dist/primitives/truncate.d.ts.map +1 -0
- package/dist/primitives/truncate.js +99 -0
- package/dist/primitives/truncate.js.map +1 -0
- package/dist/primitives/wrap.d.ts +23 -0
- package/dist/primitives/wrap.d.ts.map +1 -0
- package/dist/primitives/wrap.js +30 -0
- package/dist/primitives/wrap.js.map +1 -0
- package/dist/render/ansi-utils.d.ts +49 -0
- package/dist/render/ansi-utils.d.ts.map +1 -0
- package/dist/render/ansi-utils.js +405 -0
- package/dist/render/ansi-utils.js.map +1 -0
- package/dist/render/index.d.ts +11 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +11 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/sgr.d.ts +60 -0
- package/dist/render/sgr.d.ts.map +1 -0
- package/dist/render/sgr.js +191 -0
- package/dist/render/sgr.js.map +1 -0
- package/dist/render/strip.d.ts +24 -0
- package/dist/render/strip.d.ts.map +1 -0
- package/dist/render/strip.js +81 -0
- package/dist/render/strip.js.map +1 -0
- package/dist/render/width.d.ts +30 -0
- package/dist/render/width.d.ts.map +1 -0
- package/dist/render/width.js +149 -0
- package/dist/render/width.js.map +1 -0
- package/dist/shortcuts.d.ts +76 -0
- package/dist/shortcuts.d.ts.map +1 -0
- package/dist/shortcuts.js +117 -0
- package/dist/shortcuts.js.map +1 -0
- package/dist/styles.d.ts +43 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +44 -0
- package/dist/styles.js.map +1 -0
- package/dist/symbols.d.ts +19 -0
- package/dist/symbols.d.ts.map +1 -0
- package/dist/symbols.js +21 -0
- package/dist/symbols.js.map +1 -0
- package/dist/test/compare.d.ts +28 -0
- package/dist/test/compare.d.ts.map +1 -0
- package/dist/test/compare.js +37 -0
- package/dist/test/compare.js.map +1 -0
- package/dist/test/index.d.ts +16 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +14 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/mock.d.ts +50 -0
- package/dist/test/mock.d.ts.map +1 -0
- package/dist/test/mock.js +135 -0
- package/dist/test/mock.js.map +1 -0
- package/dist/test/render.d.ts +29 -0
- package/dist/test/render.d.ts.map +1 -0
- package/dist/test/render.js +87 -0
- package/dist/test/render.js.map +1 -0
- package/dist/test/snapshot.d.ts +16 -0
- package/dist/test/snapshot.d.ts.map +1 -0
- package/dist/test/snapshot.js +216 -0
- package/dist/test/snapshot.js.map +1 -0
- package/dist/theme/builtins.d.ts +10 -0
- package/dist/theme/builtins.d.ts.map +1 -0
- package/dist/theme/builtins.js +102 -0
- package/dist/theme/builtins.js.map +1 -0
- package/dist/theme/engine.d.ts +51 -0
- package/dist/theme/engine.d.ts.map +1 -0
- package/dist/theme/engine.js +123 -0
- package/dist/theme/engine.js.map +1 -0
- package/dist/theme/index.d.ts +10 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +12 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/merge.d.ts +24 -0
- package/dist/theme/merge.d.ts.map +1 -0
- package/dist/theme/merge.js +66 -0
- package/dist/theme/merge.js.map +1 -0
- package/dist/theme/types.d.ts +44 -0
- package/dist/theme/types.d.ts.map +1 -0
- package/dist/theme/types.js +8 -0
- package/dist/theme/types.js.map +1 -0
- package/dist/theme.d.ts +9 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +53 -0
- package/dist/theme.js.map +1 -0
- package/dist/tokens/defaults.d.ts +13 -0
- package/dist/tokens/defaults.d.ts.map +1 -0
- package/dist/tokens/defaults.js +248 -0
- package/dist/tokens/defaults.js.map +1 -0
- package/dist/tokens/index.d.ts +10 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/index.js +10 -0
- package/dist/tokens/index.js.map +1 -0
- package/dist/tokens/resolver.d.ts +100 -0
- package/dist/tokens/resolver.d.ts.map +1 -0
- package/dist/tokens/resolver.js +138 -0
- package/dist/tokens/resolver.js.map +1 -0
- package/dist/tokens/types.d.ts +265 -0
- package/dist/tokens/types.d.ts.map +1 -0
- package/dist/tokens/types.js +10 -0
- package/dist/tokens/types.js.map +1 -0
- package/dist/tokens.d.ts +26 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +30 -0
- package/dist/tokens.js.map +1 -0
- package/dist/types.d.ts +38 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/package.json +78 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Saulo Vallory
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal Capability Detection
|
|
3
|
+
*
|
|
4
|
+
* Synchronously detects terminal capabilities by inspecting environment
|
|
5
|
+
* variables and process state. Returns a frozen, immutable object describing
|
|
6
|
+
* what the terminal supports.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Describes the color depth supported by the terminal.
|
|
10
|
+
*
|
|
11
|
+
* - `'none'` - No color support (e.g., piped output, `NO_COLOR` set, dumb terminal).
|
|
12
|
+
* - `'16'` - Basic 16-color ANSI support (standard TTY default).
|
|
13
|
+
* - `'256'` - 256-color extended palette (xterm-256color and similar).
|
|
14
|
+
* - `'truecolor'` - 24-bit RGB color support (16.7 million colors).
|
|
15
|
+
*/
|
|
16
|
+
export type ColorDepth = "none" | "16" | "256" | "truecolor";
|
|
17
|
+
/**
|
|
18
|
+
* An immutable snapshot of the terminal's detected capabilities.
|
|
19
|
+
*
|
|
20
|
+
* All properties are `readonly` and the object is frozen at creation time,
|
|
21
|
+
* ensuring capability information cannot be accidentally mutated.
|
|
22
|
+
*/
|
|
23
|
+
export type TerminalCapabilities = {
|
|
24
|
+
/** The detected color depth the terminal supports. */
|
|
25
|
+
readonly colorDepth: ColorDepth;
|
|
26
|
+
/** Whether the terminal supports Unicode characters (determined from locale settings). */
|
|
27
|
+
readonly unicode: boolean;
|
|
28
|
+
/** Whether `process.stdout` is connected to an interactive TTY. */
|
|
29
|
+
readonly isTTY: boolean;
|
|
30
|
+
/** Whether `process.stderr` is connected to an interactive TTY. */
|
|
31
|
+
readonly isStderrTTY: boolean;
|
|
32
|
+
/** Whether the process is running inside a known CI environment. */
|
|
33
|
+
readonly isCI: boolean;
|
|
34
|
+
/** Whether `TERM` is set to `'dumb'`, indicating a minimal terminal. */
|
|
35
|
+
readonly isDumb: boolean;
|
|
36
|
+
/** Whether the `NO_COLOR` environment variable is present (any value, including empty). */
|
|
37
|
+
readonly noColor: boolean;
|
|
38
|
+
/** The forced color depth from `FORCE_COLOR` env var, or `false` if not set. */
|
|
39
|
+
readonly forceColor: ColorDepth | false;
|
|
40
|
+
/** The terminal width in columns, defaulting to 80 if unavailable. */
|
|
41
|
+
readonly columns: number;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Synchronously detects terminal capabilities from environment variables
|
|
45
|
+
* and process state.
|
|
46
|
+
*
|
|
47
|
+
* Inspects `process.env`, `process.stdout`, and `process.stderr` to build
|
|
48
|
+
* a complete picture of what the current terminal supports.
|
|
49
|
+
*
|
|
50
|
+
* @returns A frozen, immutable {@link TerminalCapabilities} object.
|
|
51
|
+
*/
|
|
52
|
+
export declare function detectCapabilities(): TerminalCapabilities;
|
|
53
|
+
/**
|
|
54
|
+
* Creates a {@link TerminalCapabilities} object with explicit overrides
|
|
55
|
+
* merged over sensible defaults. Useful for testing or constructing
|
|
56
|
+
* capabilities without inspecting the real environment.
|
|
57
|
+
*
|
|
58
|
+
* @param overrides - Partial capability values to override the defaults.
|
|
59
|
+
* @returns A frozen, immutable {@link TerminalCapabilities} object.
|
|
60
|
+
*/
|
|
61
|
+
export declare function createCapabilities(overrides?: Partial<TerminalCapabilities>): TerminalCapabilities;
|
|
62
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/capabilities/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,KAAK,GAAG,WAAW,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAClC,sDAAsD;IACtD,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,0FAA0F;IAC1F,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,mEAAmE;IACnE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,wEAAwE;IACxE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,2FAA2F;IAC3F,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,gFAAgF;IAChF,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC;IACxC,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB,CAAC;AA6IF;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,oBAAoB,CAuBzD;AAcD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CACjC,SAAS,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,GACvC,oBAAoB,CAEtB"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal Capability Detection
|
|
3
|
+
*
|
|
4
|
+
* Synchronously detects terminal capabilities by inspecting environment
|
|
5
|
+
* variables and process state. Returns a frozen, immutable object describing
|
|
6
|
+
* what the terminal supports.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Environment variable names checked to determine whether
|
|
10
|
+
* the process is running inside a CI (Continuous Integration) system.
|
|
11
|
+
*/
|
|
12
|
+
const CI_ENV_VARS = [
|
|
13
|
+
"CI",
|
|
14
|
+
"GITHUB_ACTIONS",
|
|
15
|
+
"GITLAB_CI",
|
|
16
|
+
"CIRCLECI",
|
|
17
|
+
"TRAVIS",
|
|
18
|
+
"BUILDKITE",
|
|
19
|
+
"DRONE",
|
|
20
|
+
"TF_BUILD",
|
|
21
|
+
"JENKINS_URL",
|
|
22
|
+
"CODEBUILD_BUILD_ID",
|
|
23
|
+
];
|
|
24
|
+
/**
|
|
25
|
+
* Maps `FORCE_COLOR` environment variable string values to their
|
|
26
|
+
* corresponding {@link ColorDepth} levels.
|
|
27
|
+
*
|
|
28
|
+
* - `'0'` -> `'none'`
|
|
29
|
+
* - `'1'` -> `'16'`
|
|
30
|
+
* - `'2'` -> `'256'`
|
|
31
|
+
* - `'3'` -> `'truecolor'`
|
|
32
|
+
*/
|
|
33
|
+
const FORCE_COLOR_MAP = {
|
|
34
|
+
"0": "none",
|
|
35
|
+
"1": "16",
|
|
36
|
+
"2": "256",
|
|
37
|
+
"3": "truecolor",
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Parses the `FORCE_COLOR` environment variable into a {@link ColorDepth}.
|
|
41
|
+
*
|
|
42
|
+
* @param env - The environment variables record to inspect.
|
|
43
|
+
* @returns The forced {@link ColorDepth}, or `false` if `FORCE_COLOR` is unset or unrecognized.
|
|
44
|
+
*/
|
|
45
|
+
function parseForceColor(env) {
|
|
46
|
+
const val = env.FORCE_COLOR;
|
|
47
|
+
if (val === undefined)
|
|
48
|
+
return false;
|
|
49
|
+
return FORCE_COLOR_MAP[val] ?? false;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Determines the terminal's color depth from environment signals.
|
|
53
|
+
*
|
|
54
|
+
* @param env - The environment variables record to inspect.
|
|
55
|
+
* @param isTTY - Whether stdout is a TTY.
|
|
56
|
+
* @param forceColor - A forced color depth override, or `false` if none.
|
|
57
|
+
* @returns The resolved {@link ColorDepth}.
|
|
58
|
+
*/
|
|
59
|
+
function detectColorDepth(env, isTTY, forceColor) {
|
|
60
|
+
// FORCE_COLOR always wins when set
|
|
61
|
+
if (forceColor !== false) {
|
|
62
|
+
return forceColor;
|
|
63
|
+
}
|
|
64
|
+
// NO_COLOR set (any value including empty, but not undefined) → 'none'
|
|
65
|
+
if ("NO_COLOR" in env && env.NO_COLOR !== undefined) {
|
|
66
|
+
return "none";
|
|
67
|
+
}
|
|
68
|
+
// TERM=dumb → 'none'
|
|
69
|
+
if (env.TERM === "dumb") {
|
|
70
|
+
return "none";
|
|
71
|
+
}
|
|
72
|
+
// Not a TTY → 'none'
|
|
73
|
+
if (!isTTY) {
|
|
74
|
+
return "none";
|
|
75
|
+
}
|
|
76
|
+
// COLORTERM=truecolor or 24bit
|
|
77
|
+
const colorterm = env.COLORTERM?.toLowerCase();
|
|
78
|
+
if (colorterm === "truecolor" || colorterm === "24bit") {
|
|
79
|
+
return "truecolor";
|
|
80
|
+
}
|
|
81
|
+
// TERM_PROGRAM known truecolor terminals
|
|
82
|
+
const termProgram = env.TERM_PROGRAM;
|
|
83
|
+
if (termProgram === "iTerm.app" || termProgram === "WezTerm") {
|
|
84
|
+
return "truecolor";
|
|
85
|
+
}
|
|
86
|
+
// TERM ending in 256color
|
|
87
|
+
const term = env.TERM;
|
|
88
|
+
if (term && /256color$/i.test(term)) {
|
|
89
|
+
return "256";
|
|
90
|
+
}
|
|
91
|
+
// Default TTY
|
|
92
|
+
return "16";
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Detects Unicode support by inspecting locale environment variables.
|
|
96
|
+
*
|
|
97
|
+
* @param env - The environment variables record to inspect.
|
|
98
|
+
* @returns `true` if UTF-8 is detected in locale settings or the platform is macOS.
|
|
99
|
+
*/
|
|
100
|
+
function detectUnicode(env) {
|
|
101
|
+
// Check locale env vars for UTF-8
|
|
102
|
+
const localeVars = [env.LC_ALL, env.LC_CTYPE, env.LANG];
|
|
103
|
+
for (const val of localeVars) {
|
|
104
|
+
if (val && /utf-?8/i.test(val)) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// TERM=dumb or TERM=linux → false
|
|
109
|
+
const term = env.TERM;
|
|
110
|
+
if (term === "dumb" || term === "linux") {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
// Default true on macOS
|
|
114
|
+
if (process.platform === "darwin") {
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Checks whether any known CI environment variable is present.
|
|
121
|
+
*
|
|
122
|
+
* @param env - The environment variables record to inspect.
|
|
123
|
+
* @returns `true` if a CI environment is detected.
|
|
124
|
+
*/
|
|
125
|
+
function detectCI(env) {
|
|
126
|
+
return CI_ENV_VARS.some((key) => key in env && env[key] !== undefined);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Synchronously detects terminal capabilities from environment variables
|
|
130
|
+
* and process state.
|
|
131
|
+
*
|
|
132
|
+
* Inspects `process.env`, `process.stdout`, and `process.stderr` to build
|
|
133
|
+
* a complete picture of what the current terminal supports.
|
|
134
|
+
*
|
|
135
|
+
* @returns A frozen, immutable {@link TerminalCapabilities} object.
|
|
136
|
+
*/
|
|
137
|
+
export function detectCapabilities() {
|
|
138
|
+
const env = process.env;
|
|
139
|
+
const isTTY = !!process.stdout.isTTY;
|
|
140
|
+
const isStderrTTY = !!process.stderr.isTTY;
|
|
141
|
+
const forceColor = parseForceColor(env);
|
|
142
|
+
const noColor = "NO_COLOR" in env && env.NO_COLOR !== undefined;
|
|
143
|
+
const isDumb = env.TERM === "dumb";
|
|
144
|
+
const colorDepth = detectColorDepth(env, isTTY, forceColor);
|
|
145
|
+
const unicode = detectUnicode(env);
|
|
146
|
+
const isCI = detectCI(env);
|
|
147
|
+
const columns = process.stdout.columns || 80;
|
|
148
|
+
return Object.freeze({
|
|
149
|
+
colorDepth,
|
|
150
|
+
unicode,
|
|
151
|
+
isTTY,
|
|
152
|
+
isStderrTTY,
|
|
153
|
+
isCI,
|
|
154
|
+
isDumb,
|
|
155
|
+
noColor,
|
|
156
|
+
forceColor,
|
|
157
|
+
columns,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
const DEFAULT_CAPABILITIES = Object.freeze({
|
|
161
|
+
colorDepth: "16",
|
|
162
|
+
unicode: true,
|
|
163
|
+
isTTY: true,
|
|
164
|
+
isStderrTTY: true,
|
|
165
|
+
isCI: false,
|
|
166
|
+
isDumb: false,
|
|
167
|
+
noColor: false,
|
|
168
|
+
forceColor: false,
|
|
169
|
+
columns: 80,
|
|
170
|
+
});
|
|
171
|
+
/**
|
|
172
|
+
* Creates a {@link TerminalCapabilities} object with explicit overrides
|
|
173
|
+
* merged over sensible defaults. Useful for testing or constructing
|
|
174
|
+
* capabilities without inspecting the real environment.
|
|
175
|
+
*
|
|
176
|
+
* @param overrides - Partial capability values to override the defaults.
|
|
177
|
+
* @returns A frozen, immutable {@link TerminalCapabilities} object.
|
|
178
|
+
*/
|
|
179
|
+
export function createCapabilities(overrides) {
|
|
180
|
+
return Object.freeze({ ...DEFAULT_CAPABILITIES, ...overrides });
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/capabilities/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAuCH;;;GAGG;AACH,MAAM,WAAW,GAAG;IACnB,IAAI;IACJ,gBAAgB;IAChB,WAAW;IACX,UAAU;IACV,QAAQ;IACR,WAAW;IACX,OAAO;IACP,UAAU;IACV,aAAa;IACb,oBAAoB;CACX,CAAC;AAEX;;;;;;;;GAQG;AACH,MAAM,eAAe,GAA+B;IACnD,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,WAAW;CAChB,CAAC;AAEF;;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,CAAC;IAChE,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC;IACnC,MAAM,UAAU,GAAG,gBAAgB,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC3B,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IAE7C,OAAO,MAAM,CAAC,MAAM,CAAC;QACpB,UAAU;QACV,OAAO;QACP,KAAK;QACL,WAAW;QACX,IAAI;QACJ,MAAM;QACN,OAAO;QACP,UAAU;QACV,OAAO;KACP,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,oBAAoB,GAAyB,MAAM,CAAC,MAAM,CAAuB;IACtF,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,IAAI;IACX,WAAW,EAAE,IAAI;IACjB,IAAI,EAAE,KAAK;IACX,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,KAAK;IACjB,OAAO,EAAE,EAAE;CACX,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CACjC,SAAyC;IAEzC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,oBAAoB,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;AACjE,CAAC"}
|
package/dist/colors.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color functions — the `c` object.
|
|
3
|
+
*
|
|
4
|
+
* Each function wraps chalk to apply a semantic color.
|
|
5
|
+
* Merged from gen/lib/colors.ts + core/ui/styles.ts.
|
|
6
|
+
*/
|
|
7
|
+
export declare const c: {
|
|
8
|
+
success: (text: string) => string;
|
|
9
|
+
error: (text: string) => string;
|
|
10
|
+
warning: (text: string) => string;
|
|
11
|
+
info: (text: string) => string;
|
|
12
|
+
muted: (text: string) => string;
|
|
13
|
+
command: (text: string) => string;
|
|
14
|
+
danger: (text: string) => string;
|
|
15
|
+
highlight: (text: string) => string;
|
|
16
|
+
dim: (text: string) => string;
|
|
17
|
+
bold: (text: string) => string;
|
|
18
|
+
subtle: (text: string) => string;
|
|
19
|
+
text: (text: string) => string;
|
|
20
|
+
kit: (text: string) => string;
|
|
21
|
+
recipe: (text: string) => string;
|
|
22
|
+
cookbook: (text: string) => string;
|
|
23
|
+
helper: (text: string) => string;
|
|
24
|
+
property: (text: string) => string;
|
|
25
|
+
required: (text: string) => string;
|
|
26
|
+
default: (value: any) => string;
|
|
27
|
+
enum: (text: string) => string;
|
|
28
|
+
title: (text: string) => string;
|
|
29
|
+
heading: (text: string) => string;
|
|
30
|
+
version: (text: string) => string;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=colors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,eAAO,MAAM,CAAC;oBAEG,MAAM;kBACR,MAAM;oBACJ,MAAM;iBACT,MAAM;kBACL,MAAM;oBAGJ,MAAM;mBACP,MAAM;sBAGH,MAAM;gBACZ,MAAM;iBACL,MAAM;mBACJ,MAAM;iBACR,MAAM;gBAGP,MAAM;mBACH,MAAM;qBACJ,MAAM;mBACR,MAAM;qBAGJ,MAAM;qBACN,MAAM;qBACN,GAAG;iBACP,MAAM;kBAGL,MAAM;oBACJ,MAAM;oBACN,MAAM;CACtB,CAAC"}
|
package/dist/colors.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color functions — the `c` object.
|
|
3
|
+
*
|
|
4
|
+
* Each function wraps chalk to apply a semantic color.
|
|
5
|
+
* Merged from gen/lib/colors.ts + core/ui/styles.ts.
|
|
6
|
+
*/
|
|
7
|
+
import chalk from "chalk";
|
|
8
|
+
import { palette } from "./palette.js";
|
|
9
|
+
export const c = {
|
|
10
|
+
// Status colors
|
|
11
|
+
success: (text) => chalk.green(text),
|
|
12
|
+
error: (text) => chalk.red(text),
|
|
13
|
+
warning: (text) => chalk.yellow(text),
|
|
14
|
+
info: (text) => chalk.blue(text),
|
|
15
|
+
muted: (text) => chalk.gray(text),
|
|
16
|
+
// From core/ui/styles — hex-based
|
|
17
|
+
command: (text) => chalk.hex(palette.brand)(text),
|
|
18
|
+
danger: (text) => chalk.hex(palette.danger)(text),
|
|
19
|
+
// Formatting helpers
|
|
20
|
+
highlight: (text) => chalk.cyan(text),
|
|
21
|
+
dim: (text) => chalk.dim(text),
|
|
22
|
+
bold: (text) => chalk.bold(text),
|
|
23
|
+
subtle: (text) => chalk.gray(text),
|
|
24
|
+
text: (text) => text,
|
|
25
|
+
// CLI entity colors
|
|
26
|
+
kit: (text) => chalk.magenta(text),
|
|
27
|
+
recipe: (text) => chalk.cyan.bold(text),
|
|
28
|
+
cookbook: (text) => chalk.magenta.bold(text),
|
|
29
|
+
helper: (text) => chalk.yellow(text),
|
|
30
|
+
// Code/data colors
|
|
31
|
+
property: (text) => chalk.cyan(text),
|
|
32
|
+
required: (text) => chalk.red.bold(text),
|
|
33
|
+
default: (value) => chalk.gray(` (default: ${JSON.stringify(value)})`),
|
|
34
|
+
enum: (text) => chalk.yellow(text),
|
|
35
|
+
// Headings & labels
|
|
36
|
+
title: (text) => chalk.bold.cyan(text),
|
|
37
|
+
heading: (text) => chalk.bold.yellow(text),
|
|
38
|
+
version: (text) => chalk.gray(text),
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=colors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.js","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,O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,OAAO,CAAC,IAAI,CAAC;IAC1C,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IAC/C,QAAQ,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;IACpD,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;IAE5C,mBAAmB;IACnB,QAAQ,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;IAC5C,QAAQ,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;IAChD,OAAO,EAAE,CAAC,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC;IAC3E,IAAI,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;IAE1C,oBAAoB;IACpB,KAAK,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IAC9C,OAAO,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAClD,OAAO,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;CAC3C,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* columns Component
|
|
3
|
+
*
|
|
4
|
+
* Renders content in side-by-side columns with configurable widths and alignment.
|
|
5
|
+
*/
|
|
6
|
+
/** Definition of a single column in a multi-column layout. */
|
|
7
|
+
export type ColumnDef = {
|
|
8
|
+
/** Column content as a string or array of lines. */
|
|
9
|
+
content: string | string[];
|
|
10
|
+
/** Column width: fixed number, `'auto'` to fit content, or `'fill'` to consume remaining space. */
|
|
11
|
+
width?: number | "auto" | "fill";
|
|
12
|
+
/** Text alignment within the column. Defaults to `'left'`. */
|
|
13
|
+
align?: "left" | "right" | "center";
|
|
14
|
+
};
|
|
15
|
+
/** Options for the multi-column layout. */
|
|
16
|
+
export type ColumnsOptions = {
|
|
17
|
+
/** Gap between columns in characters. Defaults to the `space.gutter` token. */
|
|
18
|
+
gap?: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Renders content in a side-by-side multi-column layout.
|
|
22
|
+
*
|
|
23
|
+
* @param cols - Column definitions.
|
|
24
|
+
* @param options - Layout configuration.
|
|
25
|
+
* @returns The formatted columns as a multi-line string.
|
|
26
|
+
*/
|
|
27
|
+
export declare function columns(cols: ColumnDef[], options?: ColumnsOptions): string;
|
|
28
|
+
//# sourceMappingURL=columns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"columns.d.ts","sourceRoot":"","sources":["../../src/components/columns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,8DAA8D;AAC9D,MAAM,MAAM,SAAS,GAAG;IACvB,oDAAoD;IACpD,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,mGAAmG;IACnG,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACjC,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;CACpC,CAAC;AAEF,2CAA2C;AAC3C,MAAM,MAAM,cAAc,GAAG;IAC5B,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,CA8D3E"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* columns Component
|
|
3
|
+
*
|
|
4
|
+
* Renders content in side-by-side columns with configurable widths and alignment.
|
|
5
|
+
*/
|
|
6
|
+
import { getContext } from "../primitives/index.js";
|
|
7
|
+
import { ansiPad, stringWidth } from "../render/index.js";
|
|
8
|
+
/**
|
|
9
|
+
* Renders content in a side-by-side multi-column layout.
|
|
10
|
+
*
|
|
11
|
+
* @param cols - Column definitions.
|
|
12
|
+
* @param options - Layout configuration.
|
|
13
|
+
* @returns The formatted columns as a multi-line string.
|
|
14
|
+
*/
|
|
15
|
+
export function columns(cols, options) {
|
|
16
|
+
const ctx = getContext();
|
|
17
|
+
const gap = options?.gap ?? ctx.tokens.space.gutter;
|
|
18
|
+
const totalWidth = ctx.capabilities.columns ?? ctx.tokens.layout.defaultWidth;
|
|
19
|
+
// Normalize content to arrays of lines
|
|
20
|
+
const colLines = cols.map((col) => Array.isArray(col.content) ? col.content : col.content.split("\n"));
|
|
21
|
+
// Calculate column widths
|
|
22
|
+
const colWidths = cols.map((col, i) => {
|
|
23
|
+
if (typeof col.width === "number")
|
|
24
|
+
return col.width;
|
|
25
|
+
if (col.width === "auto" || col.width === undefined) {
|
|
26
|
+
// Auto: use the widest line in the column
|
|
27
|
+
let max = 0;
|
|
28
|
+
for (const line of colLines[i]) {
|
|
29
|
+
const w = stringWidth(line);
|
|
30
|
+
if (w > max)
|
|
31
|
+
max = w;
|
|
32
|
+
}
|
|
33
|
+
return max;
|
|
34
|
+
}
|
|
35
|
+
return 0; // fill — will be calculated below
|
|
36
|
+
});
|
|
37
|
+
// Calculate fill columns
|
|
38
|
+
const fillIndices = cols.map((col, i) => (col.width === "fill" ? i : -1)).filter((i) => i >= 0);
|
|
39
|
+
if (fillIndices.length > 0) {
|
|
40
|
+
const usedWidth = colWidths.reduce((sum, w) => sum + w, 0) + gap * (cols.length - 1);
|
|
41
|
+
const remaining = Math.max(0, totalWidth - usedWidth);
|
|
42
|
+
const perFill = Math.floor(remaining / fillIndices.length);
|
|
43
|
+
for (const i of fillIndices) {
|
|
44
|
+
colWidths[i] = perFill;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// Find the max number of lines
|
|
48
|
+
const maxLines = Math.max(...colLines.map((l) => l.length));
|
|
49
|
+
// Pad shorter columns with blank lines
|
|
50
|
+
for (const lines of colLines) {
|
|
51
|
+
while (lines.length < maxLines) {
|
|
52
|
+
lines.push("");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Build output rows
|
|
56
|
+
const gapStr = " ".repeat(gap);
|
|
57
|
+
const rows = [];
|
|
58
|
+
for (let row = 0; row < maxLines; row++) {
|
|
59
|
+
const parts = [];
|
|
60
|
+
for (let col = 0; col < cols.length; col++) {
|
|
61
|
+
const line = colLines[col][row] ?? "";
|
|
62
|
+
const alignment = cols[col].align ?? "left";
|
|
63
|
+
const padded = ansiPad(line, colWidths[col], alignment);
|
|
64
|
+
parts.push(padded);
|
|
65
|
+
}
|
|
66
|
+
rows.push(parts.join(gapStr));
|
|
67
|
+
}
|
|
68
|
+
return rows.join("\n");
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=columns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"columns.js","sourceRoot":"","sources":["../../src/components/columns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAkB1D;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAC,IAAiB,EAAE,OAAwB;IAClE,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;IACzB,MAAM,GAAG,GAAG,OAAO,EAAE,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;IACpD,MAAM,UAAU,GAAG,GAAG,CAAC,Y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AE,GAAG,EAAE,EAAE,CAAC;YAC5C,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YACvC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAE,CAAC,KAAK,IAAI,MAAM,CAAC;YAC7C,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,GAAG,CAAE,EAAE,SAAS,CAAC,CAAC;YACzD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpB,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConfirmPrompt Component
|
|
3
|
+
*
|
|
4
|
+
* Prompts the user for a yes/no confirmation.
|
|
5
|
+
* Uses Node's readline module for input handling.
|
|
6
|
+
* Falls back to simple stdin reading in non-TTY environments.
|
|
7
|
+
*/
|
|
8
|
+
/** Options for creating a confirmation prompt. */
|
|
9
|
+
export type ConfirmPromptOptions = {
|
|
10
|
+
/** The question displayed to the user. */
|
|
11
|
+
message: string;
|
|
12
|
+
/** Default value when the user presses Enter without typing. Defaults to `true`. */
|
|
13
|
+
defaultValue?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Formats the confirm question line.
|
|
17
|
+
* Returns: `? message (Y/n) > ` or `? message (y/N) > ` based on default.
|
|
18
|
+
*/
|
|
19
|
+
export declare function formatConfirmQuestion(message: string, defaultValue: boolean): string;
|
|
20
|
+
/**
|
|
21
|
+
* Formats the submitted answer line.
|
|
22
|
+
* Returns: `checkmark message Yes` or `checkmark message No`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function formatConfirmAnswer(message: string, value: boolean): string;
|
|
25
|
+
/**
|
|
26
|
+
* Parses a confirm input string to a boolean.
|
|
27
|
+
* Returns undefined if the input is not recognized.
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseConfirmInput(input: string, defaultValue: boolean): boolean | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Prompts the user for a yes/no confirmation.
|
|
32
|
+
* Falls back to stdin line reading in non-TTY environments.
|
|
33
|
+
*
|
|
34
|
+
* @param options - Prompt configuration.
|
|
35
|
+
* @returns `true` for yes, `false` for no.
|
|
36
|
+
*/
|
|
37
|
+
export declare function confirmPrompt(options: ConfirmPromptOptions): Promise<boolean>;
|
|
38
|
+
//# sourceMappingURL=confirmPrompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmPrompt.d.ts","sourceRoot":"","sources":["../../src/components/confirmPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,kDAAkD;AAClD,MAAM,MAAM,oBAAoB,GAAG;IAClC,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,MAAM,CAQpF;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAI3E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAM3F;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,CAmE7E"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConfirmPrompt Component
|
|
3
|
+
*
|
|
4
|
+
* Prompts the user for a yes/no confirmation.
|
|
5
|
+
* Uses Node's readline module for input handling.
|
|
6
|
+
* Falls back to simple stdin reading in non-TTY environments.
|
|
7
|
+
*/
|
|
8
|
+
import * as readline from "node:readline";
|
|
9
|
+
import { getContext, styledText, symbol } from "../primitives/index.js";
|
|
10
|
+
/**
|
|
11
|
+
* Formats the confirm question line.
|
|
12
|
+
* Returns: `? message (Y/n) > ` or `? message (y/N) > ` based on default.
|
|
13
|
+
*/
|
|
14
|
+
export function formatConfirmQuestion(message, defaultValue) {
|
|
15
|
+
const ctx = getContext();
|
|
16
|
+
const q = styledText("?", { color: "accent", bold: true });
|
|
17
|
+
const hint = defaultValue
|
|
18
|
+
? styledText("(Y/n)", { dim: true })
|
|
19
|
+
: styledText("(y/N)", { dim: true });
|
|
20
|
+
const sep = styledText("\u203a", { dim: true });
|
|
21
|
+
return `${q} ${message} ${hint} ${sep} `;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Formats the submitted answer line.
|
|
25
|
+
* Returns: `checkmark message Yes` or `checkmark message No`.
|
|
26
|
+
*/
|
|
27
|
+
export function formatConfirmAnswer(message, value) {
|
|
28
|
+
const icon = styledText(symbol("success"), { color: "success" });
|
|
29
|
+
const answer = styledText(value ? "Yes" : "No", { dim: true });
|
|
30
|
+
return `${icon} ${message} ${answer}`;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Parses a confirm input string to a boolean.
|
|
34
|
+
* Returns undefined if the input is not recognized.
|
|
35
|
+
*/
|
|
36
|
+
export function parseConfirmInput(input, defaultValue) {
|
|
37
|
+
const trimmed = input.trim().toLowerCase();
|
|
38
|
+
if (trimmed === "")
|
|
39
|
+
return defaultValue;
|
|
40
|
+
if (trimmed === "y" || trimmed === "yes")
|
|
41
|
+
return true;
|
|
42
|
+
if (trimmed === "n" || trimmed === "no")
|
|
43
|
+
return false;
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Prompts the user for a yes/no confirmation.
|
|
48
|
+
* Falls back to stdin line reading in non-TTY environments.
|
|
49
|
+
*
|
|
50
|
+
* @param options - Prompt configuration.
|
|
51
|
+
* @returns `true` for yes, `false` for no.
|
|
52
|
+
*/
|
|
53
|
+
export function confirmPrompt(options) {
|
|
54
|
+
const ctx = getContext();
|
|
55
|
+
const stream = process.stderr;
|
|
56
|
+
const defaultValue = options.defaultValue ?? true;
|
|
57
|
+
const isTTY = !!process.stdin.isTTY;
|
|
58
|
+
return new Promise((resolve, reject) => {
|
|
59
|
+
if (!isTTY) {
|
|
60
|
+
// Non-TTY: read a line from stdin
|
|
61
|
+
const rl = readline.createInterface({
|
|
62
|
+
input: process.stdin,
|
|
63
|
+
terminal: false,
|
|
64
|
+
});
|
|
65
|
+
const hint = defaultValue ? "(Y/n)" : "(y/N)";
|
|
66
|
+
stream.write(`${options.message} ${hint}: `);
|
|
67
|
+
rl.once("line", (line) => {
|
|
68
|
+
const result = parseConfirmInput(line, defaultValue);
|
|
69
|
+
rl.close();
|
|
70
|
+
if (result === undefined) {
|
|
71
|
+
reject(new Error(`Invalid input: "${line.trim()}". Expected y/yes/n/no.`));
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
resolve(result);
|
|
75
|
+
});
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
// Interactive TTY mode
|
|
79
|
+
function askQuestion() {
|
|
80
|
+
const promptLine = formatConfirmQuestion(options.message, defaultValue);
|
|
81
|
+
const rl = readline.createInterface({
|
|
82
|
+
input: process.stdin,
|
|
83
|
+
output: stream,
|
|
84
|
+
terminal: true,
|
|
85
|
+
});
|
|
86
|
+
stream.write("\r\x1b[K");
|
|
87
|
+
stream.write(promptLine);
|
|
88
|
+
rl.question("", (answer) => {
|
|
89
|
+
rl.close();
|
|
90
|
+
const result = parseConfirmInput(answer, defaultValue);
|
|
91
|
+
if (result === undefined) {
|
|
92
|
+
// Invalid input, re-prompt
|
|
93
|
+
stream.write("\n");
|
|
94
|
+
const icon = styledText(symbol("error"), { color: "error" });
|
|
95
|
+
stream.write(`${icon} ${styledText("Please answer y or n", { color: "error" })}\n`);
|
|
96
|
+
askQuestion();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
// Replace prompt with final answer
|
|
100
|
+
stream.write("\r\x1b[K");
|
|
101
|
+
stream.write("\x1b[A\r\x1b[K");
|
|
102
|
+
stream.write(`${formatConfirmAnswer(options.message, result)}\n`);
|
|
103
|
+
resolve(result);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
askQuestion();
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=confirmPrompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmPrompt.js","sourceRoot":"","sources":["../../src/components/confirmPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAUxE;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAe,EAAE,YAAqB;IAC3E,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;IACzB,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3D,MAAM,IAAI,GAAG,YAAY;QACxB,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;QACpC,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;IACtC,MAAM,GAAG,GAAG,UAAU,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,OAAO,GAAG,CAAC,IAAI,OAAO,IAAI,IAAI,IAAI,G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