@flyingrobots/bijou 0.9.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +33 -0
- package/dist/core/components/box.d.ts.map +1 -1
- package/dist/core/components/box.js +72 -23
- 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 +21 -0
- package/dist/core/text/clip.d.ts.map +1 -0
- package/dist/core/text/clip.js +75 -0
- package/dist/core/text/clip.js.map +1 -0
- 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 +8 -0
- package/dist/core/text/index.d.ts.map +1 -1
- package/dist/core/text/index.js +8 -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 +11 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -2
- 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,25 +1,80 @@
|
|
|
1
1
|
import type { BijouContext } from '../../ports/context.js';
|
|
2
2
|
import type { GradientStop } from '../theme/tokens.js';
|
|
3
|
+
/** Configuration for rendering a progress bar. */
|
|
3
4
|
export interface ProgressBarOptions {
|
|
5
|
+
/** Character-width of the bar (defaults to 20). */
|
|
4
6
|
width?: number;
|
|
7
|
+
/** Character used for filled segments (defaults to `\u2588` full block). */
|
|
5
8
|
filled?: string;
|
|
9
|
+
/** Character used for empty segments (defaults to `\u2810` braille dot). */
|
|
6
10
|
empty?: string;
|
|
11
|
+
/** Gradient color stops applied across filled segments. */
|
|
7
12
|
gradient?: GradientStop[];
|
|
13
|
+
/** Whether to prepend a percentage label (defaults to `true`). */
|
|
8
14
|
showPercent?: boolean;
|
|
15
|
+
/** Bijou context for I/O, styling, and mode detection. */
|
|
9
16
|
ctx?: BijouContext;
|
|
10
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Render a progress bar string for the given percentage.
|
|
20
|
+
*
|
|
21
|
+
* Output adapts to the current output mode:
|
|
22
|
+
* - `interactive` / `static` — visual bar using filled and empty characters,
|
|
23
|
+
* optionally colored with a gradient.
|
|
24
|
+
* - `pipe` — plain text like `Progress: 42%`.
|
|
25
|
+
* - `accessible` — screen-reader-friendly phrase like `42 percent complete.`.
|
|
26
|
+
*
|
|
27
|
+
* The percentage is clamped to the 0–100 range.
|
|
28
|
+
*
|
|
29
|
+
* @param percent - Completion percentage (0–100).
|
|
30
|
+
* @param options - Progress bar configuration.
|
|
31
|
+
* @returns The rendered progress bar string.
|
|
32
|
+
*/
|
|
11
33
|
export declare function progressBar(percent: number, options?: ProgressBarOptions): string;
|
|
34
|
+
/** Controller for managing a live or animated progress bar. */
|
|
12
35
|
export interface ProgressBarController {
|
|
36
|
+
/** Begin rendering the progress bar (hides cursor in interactive mode). */
|
|
13
37
|
start(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Set the progress bar to a new percentage.
|
|
40
|
+
* @param pct - New completion percentage (0–100).
|
|
41
|
+
*/
|
|
14
42
|
update(pct: number): void;
|
|
43
|
+
/**
|
|
44
|
+
* Stop the progress bar, restore the cursor, and optionally print a final message.
|
|
45
|
+
* @param finalMessage - Text written after stopping (followed by a newline).
|
|
46
|
+
*/
|
|
15
47
|
stop(finalMessage?: string): void;
|
|
16
48
|
}
|
|
49
|
+
/** Options for {@link createProgressBar}. Currently identical to {@link ProgressBarOptions}. */
|
|
17
50
|
export interface LiveProgressBarOptions extends ProgressBarOptions {
|
|
18
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Create a live progress bar that the caller updates by pushing new values.
|
|
54
|
+
*
|
|
55
|
+
* In interactive mode, each call to {@link ProgressBarController.update}
|
|
56
|
+
* overwrites the current line. Non-interactive modes emit a new line per update.
|
|
57
|
+
*
|
|
58
|
+
* @param options - Progress bar configuration.
|
|
59
|
+
* @returns A {@link ProgressBarController} for starting, updating, and stopping the bar.
|
|
60
|
+
*/
|
|
19
61
|
export declare function createProgressBar(options?: LiveProgressBarOptions): ProgressBarController;
|
|
62
|
+
/** Options for {@link createAnimatedProgressBar}. */
|
|
20
63
|
export interface AnimatedProgressBarOptions extends ProgressBarOptions {
|
|
64
|
+
/** Target frames per second for the interpolation animation (defaults to 30). */
|
|
21
65
|
fps?: number;
|
|
66
|
+
/** Duration in milliseconds to interpolate from current to target value (defaults to 300). */
|
|
22
67
|
duration?: number;
|
|
23
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Create an animated progress bar that smoothly interpolates between values.
|
|
71
|
+
*
|
|
72
|
+
* When {@link ProgressBarController.update} is called, the bar animates from
|
|
73
|
+
* its current percentage to the target over the configured duration using a
|
|
74
|
+
* fixed-step timer. Non-interactive modes skip animation entirely.
|
|
75
|
+
*
|
|
76
|
+
* @param options - Animated progress bar configuration.
|
|
77
|
+
* @returns A {@link ProgressBarController} for starting, updating, and stopping the bar.
|
|
78
|
+
*/
|
|
24
79
|
export declare function createAnimatedProgressBar(options?: AnimatedProgressBarOptions): ProgressBarController;
|
|
25
80
|
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/core/components/progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,GAAG,CAAC,EAAE,YAAY,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/core/components/progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD,kDAAkD;AAClD,MAAM,WAAW,kBAAkB;IACjC,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAC1B,kEAAkE;IAClE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,0DAA0D;IAC1D,GAAG,CAAC,EAAE,YAAY,CAAC;CACpB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,MAAM,CAqCrF;AAMD,+DAA+D;AAC/D,MAAM,WAAW,qBAAqB;IACpC,2EAA2E;IAC3E,KAAK,IAAI,IAAI,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,IAAI,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,gGAAgG;AAChG,MAAM,WAAW,sBAAuB,SAAQ,kBAAkB;CAEjE;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,sBAA2B,GAAG,qBAAqB,CAoC7F;AAMD,qDAAqD;AACrD,MAAM,WAAW,0BAA2B,SAAQ,kBAAkB;IACpE,iFAAiF;IACjF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,GAAE,0BAA+B,GAAG,qBAAqB,CA6EzG"}
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { lerp3 } from '../theme/gradient.js';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { resolveCtx } from '../resolve-ctx.js';
|
|
3
|
+
/**
|
|
4
|
+
* Render a progress bar string for the given percentage.
|
|
5
|
+
*
|
|
6
|
+
* Output adapts to the current output mode:
|
|
7
|
+
* - `interactive` / `static` — visual bar using filled and empty characters,
|
|
8
|
+
* optionally colored with a gradient.
|
|
9
|
+
* - `pipe` — plain text like `Progress: 42%`.
|
|
10
|
+
* - `accessible` — screen-reader-friendly phrase like `42 percent complete.`.
|
|
11
|
+
*
|
|
12
|
+
* The percentage is clamped to the 0–100 range.
|
|
13
|
+
*
|
|
14
|
+
* @param percent - Completion percentage (0–100).
|
|
15
|
+
* @param options - Progress bar configuration.
|
|
16
|
+
* @returns The rendered progress bar string.
|
|
17
|
+
*/
|
|
8
18
|
export function progressBar(percent, options = {}) {
|
|
9
19
|
const ctx = resolveCtx(options.ctx);
|
|
10
20
|
const pct = Math.max(0, Math.min(100, percent));
|
|
@@ -39,6 +49,15 @@ export function progressBar(percent, options = {}) {
|
|
|
39
49
|
const label = showPercent ? `${Math.round(pct)}%` : '';
|
|
40
50
|
return label ? `${label.padStart(4)} ${bar}` : bar;
|
|
41
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Create a live progress bar that the caller updates by pushing new values.
|
|
54
|
+
*
|
|
55
|
+
* In interactive mode, each call to {@link ProgressBarController.update}
|
|
56
|
+
* overwrites the current line. Non-interactive modes emit a new line per update.
|
|
57
|
+
*
|
|
58
|
+
* @param options - Progress bar configuration.
|
|
59
|
+
* @returns A {@link ProgressBarController} for starting, updating, and stopping the bar.
|
|
60
|
+
*/
|
|
42
61
|
export function createProgressBar(options = {}) {
|
|
43
62
|
const ctx = resolveCtx(options.ctx);
|
|
44
63
|
const mode = ctx.mode;
|
|
@@ -73,6 +92,16 @@ export function createProgressBar(options = {}) {
|
|
|
73
92
|
},
|
|
74
93
|
};
|
|
75
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Create an animated progress bar that smoothly interpolates between values.
|
|
97
|
+
*
|
|
98
|
+
* When {@link ProgressBarController.update} is called, the bar animates from
|
|
99
|
+
* its current percentage to the target over the configured duration using a
|
|
100
|
+
* fixed-step timer. Non-interactive modes skip animation entirely.
|
|
101
|
+
*
|
|
102
|
+
* @param options - Animated progress bar configuration.
|
|
103
|
+
* @returns A {@link ProgressBarController} for starting, updating, and stopping the bar.
|
|
104
|
+
*/
|
|
76
105
|
export function createAnimatedProgressBar(options = {}) {
|
|
77
106
|
const ctx = resolveCtx(options.ctx);
|
|
78
107
|
const mode = ctx.mode;
|
|
@@ -83,9 +112,11 @@ export function createAnimatedProgressBar(options = {}) {
|
|
|
83
112
|
let timer = null;
|
|
84
113
|
const frameMs = Math.round(1000 / fps);
|
|
85
114
|
const stepPerFrame = 100 / (duration / frameMs); // max pct change per frame
|
|
115
|
+
/** Write the current percentage bar to the terminal, overwriting the current line. */
|
|
86
116
|
function render() {
|
|
87
117
|
ctx.io.write(`\r\x1b[K${progressBar(currentPct, { ...options, ctx })}`);
|
|
88
118
|
}
|
|
119
|
+
/** Start the interpolation timer if it is not already running. */
|
|
89
120
|
function startAnimation() {
|
|
90
121
|
if (timer !== null)
|
|
91
122
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../../../src/core/components/progress.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../../../src/core/components/progress.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAkB/C;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe,EAAE,UAA8B,EAAE;IAC3E,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;IAEtB,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACpB,OAAO,aAAa,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;IACzC,CAAC;IACD,IAAI,IAAI,KAAK,YAAY,EAAE,CAAC;QAC1B,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAChD,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;IAClC,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,IAAI,QAAQ,CAAC;IAC9C,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,IAAI,QAAQ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E,CAAC;QACX,CAAC;QAED,MAAM,CAAC,GAAW;YAChB,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YAC5C,IAAI,IAAI,KAAK,aAAa,EAAE,CAAC;gBAC3B,UAAU,GAAG,SAAS,CAAC;gBACvB,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,UAAU,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;gBAClE,OAAO;YACT,CAAC;YACD,cAAc,EAAE,CAAC;QACnB,CAAC;QAED,IAAI,CAAC,YAAqB;YACxB,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBACnB,KAAK,CAAC,OAAO,EAAE,CAAC;gBAChB,KAAK,GAAG,IAAI,CAAC;YACf,CAAC;YACD,UAAU,GAAG,SAAS,CAAC;YACvB,IAAI,IAAI,KAAK,aAAa,EAAE,CAAC;gBAC3B,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;oBAC/B,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;gBACpC,CAAC;gBACD,OAAO;YACT,CAAC;YACD,MAAM,EAAE,CAAC;YACT,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACzB,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAC1B,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;gBAC/B,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
import type { BijouContext } from '../../ports/context.js';
|
|
2
2
|
import type { TokenValue } from '../theme/tokens.js';
|
|
3
|
+
/** Configuration for rendering a horizontal separator line. */
|
|
3
4
|
export interface SeparatorOptions {
|
|
5
|
+
/** Optional centered label text. */
|
|
4
6
|
label?: string;
|
|
7
|
+
/** Total width in characters (defaults to terminal column count). */
|
|
5
8
|
width?: number;
|
|
9
|
+
/** Theme token applied to the separator line. */
|
|
6
10
|
borderToken?: TokenValue;
|
|
11
|
+
/** Bijou context for I/O, styling, and mode detection. */
|
|
7
12
|
ctx?: BijouContext;
|
|
8
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Render a horizontal separator line, optionally centered around a label.
|
|
16
|
+
*
|
|
17
|
+
* Output adapts to the current output mode:
|
|
18
|
+
* - `interactive` / `static` — styled horizontal rule using `\u2500`.
|
|
19
|
+
* - `pipe` — dashes with or without label (`--- label ---`).
|
|
20
|
+
* - `accessible` — label with dashes, or empty string when no label.
|
|
21
|
+
*
|
|
22
|
+
* @param options - Separator configuration.
|
|
23
|
+
* @returns The rendered separator string.
|
|
24
|
+
*/
|
|
9
25
|
export declare function separator(options?: SeparatorOptions): string;
|
|
10
26
|
//# sourceMappingURL=separator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"separator.d.ts","sourceRoot":"","sources":["../../../src/core/components/separator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,GAAG,CAAC,EAAE,YAAY,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"separator.d.ts","sourceRoot":"","sources":["../../../src/core/components/separator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,+DAA+D;AAC/D,MAAM,WAAW,gBAAgB;IAC/B,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,0DAA0D;IAC1D,GAAG,CAAC,EAAE,YAAY,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,MAAM,CA2BhE"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { resolveCtx } from '../resolve-ctx.js';
|
|
2
|
+
/**
|
|
3
|
+
* Render a horizontal separator line, optionally centered around a label.
|
|
4
|
+
*
|
|
5
|
+
* Output adapts to the current output mode:
|
|
6
|
+
* - `interactive` / `static` — styled horizontal rule using `\u2500`.
|
|
7
|
+
* - `pipe` — dashes with or without label (`--- label ---`).
|
|
8
|
+
* - `accessible` — label with dashes, or empty string when no label.
|
|
9
|
+
*
|
|
10
|
+
* @param options - Separator configuration.
|
|
11
|
+
* @returns The rendered separator string.
|
|
12
|
+
*/
|
|
7
13
|
export function separator(options = {}) {
|
|
8
14
|
const ctx = resolveCtx(options.ctx);
|
|
9
15
|
const mode = ctx.mode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"separator.js","sourceRoot":"","sources":["../../../src/core/components/separator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"separator.js","sourceRoot":"","sources":["../../../src/core/components/separator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAc/C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,SAAS,CAAC,UAA4B,EAAE;IACtD,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CAAC,KAAK,CAAC,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
import type { BijouContext } from '../../ports/context.js';
|
|
2
|
+
/** Configuration for rendering a skeleton placeholder. */
|
|
2
3
|
export interface SkeletonOptions {
|
|
4
|
+
/** Character width of each skeleton line (defaults to 20). */
|
|
3
5
|
width?: number;
|
|
6
|
+
/** Number of placeholder lines to render (defaults to 1). */
|
|
4
7
|
lines?: number;
|
|
8
|
+
/** Bijou context for I/O, styling, and mode detection. */
|
|
5
9
|
ctx?: BijouContext;
|
|
6
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Render a skeleton loading placeholder.
|
|
13
|
+
*
|
|
14
|
+
* Output adapts to the current output mode:
|
|
15
|
+
* - `interactive` / `static` — muted light-shade block characters (`\u2591`).
|
|
16
|
+
* - `pipe` — empty string (no output).
|
|
17
|
+
* - `accessible` — `"Loading..."` text.
|
|
18
|
+
*
|
|
19
|
+
* @param options - Skeleton configuration.
|
|
20
|
+
* @returns The rendered skeleton string.
|
|
21
|
+
*/
|
|
7
22
|
export declare function skeleton(options?: SkeletonOptions): string;
|
|
8
23
|
//# sourceMappingURL=skeleton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skeleton.d.ts","sourceRoot":"","sources":["../../../src/core/components/skeleton.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG3D,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,YAAY,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"skeleton.d.ts","sourceRoot":"","sources":["../../../src/core/components/skeleton.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG3D,0DAA0D;AAC1D,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,GAAG,CAAC,EAAE,YAAY,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,OAAO,GAAE,eAAoB,GAAG,MAAM,CAa9D"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { resolveCtx } from '../resolve-ctx.js';
|
|
2
|
+
/**
|
|
3
|
+
* Render a skeleton loading placeholder.
|
|
4
|
+
*
|
|
5
|
+
* Output adapts to the current output mode:
|
|
6
|
+
* - `interactive` / `static` — muted light-shade block characters (`\u2591`).
|
|
7
|
+
* - `pipe` — empty string (no output).
|
|
8
|
+
* - `accessible` — `"Loading..."` text.
|
|
9
|
+
*
|
|
10
|
+
* @param options - Skeleton configuration.
|
|
11
|
+
* @returns The rendered skeleton string.
|
|
12
|
+
*/
|
|
7
13
|
export function skeleton(options = {}) {
|
|
8
14
|
const ctx = resolveCtx(options.ctx);
|
|
9
15
|
const mode = ctx.mode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skeleton.js","sourceRoot":"","sources":["../../../src/core/components/skeleton.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"skeleton.js","sourceRoot":"","sources":["../../../src/core/components/skeleton.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAY/C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,QAAQ,CAAC,UAA2B,EAAE;IACpD,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;IAEtB,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,EAAE,CAAC;IAC/B,IAAI,IAAI,KAAK,YAAY;QAAE,OAAO,YAAY,CAAC;IAE/C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;IAClC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC7C,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAE7D,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -1,15 +1,52 @@
|
|
|
1
1
|
import type { BijouContext } from '../../ports/context.js';
|
|
2
|
+
/** Configuration for spinner rendering and behavior. */
|
|
2
3
|
export interface SpinnerOptions {
|
|
4
|
+
/** Custom animation frames (defaults to braille dot pattern). */
|
|
3
5
|
frames?: string[];
|
|
6
|
+
/** Text label displayed alongside the spinner. */
|
|
4
7
|
label?: string;
|
|
8
|
+
/** Milliseconds between frame updates (defaults to 80). */
|
|
5
9
|
interval?: number;
|
|
10
|
+
/** Bijou context for I/O, styling, and mode detection. */
|
|
6
11
|
ctx?: BijouContext;
|
|
7
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Render a single spinner frame as a string.
|
|
15
|
+
*
|
|
16
|
+
* Output adapts to the current output mode:
|
|
17
|
+
* - `interactive` — animated braille frame + label.
|
|
18
|
+
* - `static` — static ellipsis prefix.
|
|
19
|
+
* - `pipe` — label followed by ellipsis.
|
|
20
|
+
* - `accessible` — descriptive "Please wait." suffix.
|
|
21
|
+
*
|
|
22
|
+
* @param tick - Zero-based frame counter used to select the current animation frame.
|
|
23
|
+
* @param options - Spinner configuration.
|
|
24
|
+
* @returns The rendered spinner frame string.
|
|
25
|
+
*/
|
|
8
26
|
export declare function spinnerFrame(tick: number, options?: SpinnerOptions): string;
|
|
27
|
+
/** Controller returned by {@link createSpinner} for managing a live spinner. */
|
|
9
28
|
export interface SpinnerController {
|
|
29
|
+
/** Begin rendering the spinner animation. In non-interactive modes, emit a single line. */
|
|
10
30
|
start(): void;
|
|
31
|
+
/** Update the spinner label text without restarting the animation.
|
|
32
|
+
* @param label - New label to display.
|
|
33
|
+
*/
|
|
11
34
|
update(label: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Stop the spinner, clear the line, and optionally print a final message.
|
|
37
|
+
* @param finalMessage - Text written after stopping (followed by a newline).
|
|
38
|
+
*/
|
|
12
39
|
stop(finalMessage?: string): void;
|
|
13
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Create a live spinner that animates in the terminal.
|
|
43
|
+
*
|
|
44
|
+
* In interactive mode the spinner uses an interval timer to cycle through
|
|
45
|
+
* animation frames, hiding the cursor while running. Non-interactive modes
|
|
46
|
+
* emit a single static line on {@link SpinnerController.start}.
|
|
47
|
+
*
|
|
48
|
+
* @param options - Spinner configuration.
|
|
49
|
+
* @returns A {@link SpinnerController} for starting, updating, and stopping the spinner.
|
|
50
|
+
*/
|
|
14
51
|
export declare function createSpinner(options?: SpinnerOptions): SpinnerController;
|
|
15
52
|
//# sourceMappingURL=spinner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/core/components/spinner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAK3D,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,YAAY,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/core/components/spinner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAK3D,wDAAwD;AACxD,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,GAAG,CAAC,EAAE,YAAY,CAAC;CACpB;AAKD;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,MAAM,CAkB/E;AAED,gFAAgF;AAChF,MAAM,WAAW,iBAAiB;IAChC,2FAA2F;IAC3F,KAAK,IAAI,IAAI,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;OAGG;IACH,IAAI,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,cAAmB,GAAG,iBAAiB,CA8C7E"}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveCtx } from '../resolve-ctx.js';
|
|
2
|
+
/** Default braille dot spinner frames. */
|
|
2
3
|
const DOTS = ['\u280b', '\u2819', '\u2839', '\u2838', '\u283c', '\u2834', '\u2826', '\u2827', '\u2807', '\u280f'];
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Render a single spinner frame as a string.
|
|
6
|
+
*
|
|
7
|
+
* Output adapts to the current output mode:
|
|
8
|
+
* - `interactive` — animated braille frame + label.
|
|
9
|
+
* - `static` — static ellipsis prefix.
|
|
10
|
+
* - `pipe` — label followed by ellipsis.
|
|
11
|
+
* - `accessible` — descriptive "Please wait." suffix.
|
|
12
|
+
*
|
|
13
|
+
* @param tick - Zero-based frame counter used to select the current animation frame.
|
|
14
|
+
* @param options - Spinner configuration.
|
|
15
|
+
* @returns The rendered spinner frame string.
|
|
16
|
+
*/
|
|
8
17
|
export function spinnerFrame(tick, options = {}) {
|
|
9
18
|
const ctx = resolveCtx(options.ctx);
|
|
10
19
|
const frames = options.frames ?? DOTS;
|
|
@@ -23,6 +32,16 @@ export function spinnerFrame(tick, options = {}) {
|
|
|
23
32
|
return `${label}. Please wait.`;
|
|
24
33
|
}
|
|
25
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Create a live spinner that animates in the terminal.
|
|
37
|
+
*
|
|
38
|
+
* In interactive mode the spinner uses an interval timer to cycle through
|
|
39
|
+
* animation frames, hiding the cursor while running. Non-interactive modes
|
|
40
|
+
* emit a single static line on {@link SpinnerController.start}.
|
|
41
|
+
*
|
|
42
|
+
* @param options - Spinner configuration.
|
|
43
|
+
* @returns A {@link SpinnerController} for starting, updating, and stopping the spinner.
|
|
44
|
+
*/
|
|
26
45
|
export function createSpinner(options = {}) {
|
|
27
46
|
const ctx = resolveCtx(options.ctx);
|
|
28
47
|
const frames = options.frames ?? DOTS;
|
|
@@ -31,6 +50,7 @@ export function createSpinner(options = {}) {
|
|
|
31
50
|
let timer = null;
|
|
32
51
|
let tick = 0;
|
|
33
52
|
const mode = ctx.mode;
|
|
53
|
+
/** Write the current frame to the terminal, overwriting the previous line. */
|
|
34
54
|
function render() {
|
|
35
55
|
const line = spinnerFrame(tick, { frames, label, ctx });
|
|
36
56
|
ctx.io.write(`\r\x1b[K${line}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../../src/core/components/spinner.ts"],"names":[],"mappings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CAAC,UAAU,CAAC,CAAC;gBACzB,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAC5B,CAAC;YACD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;gBAC/B,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import type { BijouContext } from '../../ports/context.js';
|
|
2
|
+
/** Represent a single step in a multi-step process. */
|
|
2
3
|
export interface StepperStep {
|
|
4
|
+
/** Display text for this step. */
|
|
3
5
|
label: string;
|
|
4
6
|
}
|
|
7
|
+
/** Configuration options for the {@link stepper} component. */
|
|
5
8
|
export interface StepperOptions {
|
|
9
|
+
/** Zero-based index of the current (active) step. */
|
|
6
10
|
current: number;
|
|
11
|
+
/** Bijou context for rendering mode and theme resolution. */
|
|
7
12
|
ctx?: BijouContext;
|
|
8
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Render a horizontal step-progress indicator.
|
|
16
|
+
*
|
|
17
|
+
* Steps before the current index are marked complete, the current step is
|
|
18
|
+
* highlighted, and remaining steps are shown as pending.
|
|
19
|
+
*
|
|
20
|
+
* Adapts output by mode:
|
|
21
|
+
* - `pipe`: `[x]`/`[*]`/`[ ]` markers joined by ` -- `.
|
|
22
|
+
* - `accessible`: `Step N of M: label (state), ...` format.
|
|
23
|
+
* - `interactive`/`static`: `✓`/`●`/`○` icons with themed colors and `──` connectors.
|
|
24
|
+
*
|
|
25
|
+
* @param steps - Array of steps to render.
|
|
26
|
+
* @param options - Rendering options including current step index and context.
|
|
27
|
+
* @returns The formatted stepper string.
|
|
28
|
+
*/
|
|
9
29
|
export declare function stepper(steps: StepperStep[], options: StepperOptions): string;
|
|
10
30
|
//# sourceMappingURL=stepper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stepper.d.ts","sourceRoot":"","sources":["../../../src/core/components/stepper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG3D,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,YAAY,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"stepper.d.ts","sourceRoot":"","sources":["../../../src/core/components/stepper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG3D,uDAAuD;AACvD,MAAM,WAAW,WAAW;IAC1B,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,+DAA+D;AAC/D,MAAM,WAAW,cAAc;IAC7B,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,GAAG,CAAC,EAAE,YAAY,CAAC;CACpB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,CAwC7E"}
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { resolveCtx } from '../resolve-ctx.js';
|
|
2
|
+
/**
|
|
3
|
+
* Render a horizontal step-progress indicator.
|
|
4
|
+
*
|
|
5
|
+
* Steps before the current index are marked complete, the current step is
|
|
6
|
+
* highlighted, and remaining steps are shown as pending.
|
|
7
|
+
*
|
|
8
|
+
* Adapts output by mode:
|
|
9
|
+
* - `pipe`: `[x]`/`[*]`/`[ ]` markers joined by ` -- `.
|
|
10
|
+
* - `accessible`: `Step N of M: label (state), ...` format.
|
|
11
|
+
* - `interactive`/`static`: `✓`/`●`/`○` icons with themed colors and `──` connectors.
|
|
12
|
+
*
|
|
13
|
+
* @param steps - Array of steps to render.
|
|
14
|
+
* @param options - Rendering options including current step index and context.
|
|
15
|
+
* @returns The formatted stepper string.
|
|
16
|
+
*/
|
|
7
17
|
export function stepper(steps, options) {
|
|
8
18
|
const ctx = resolveCtx(options.ctx);
|
|
9
19
|
const mode = ctx.mode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stepper.js","sourceRoot":"","sources":["../../../src/core/components/stepper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"stepper.js","sourceRoot":"","sources":["../../../src/core/components/stepper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAgB/C;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,OAAO,CAAC,KAAoB,EAAE,OAAuB;IACnE,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;IACtB,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAEhC,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACpB,OAAO,KAAK;aACT,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;YACf,MAAM,MAAM,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;YACnE,OAAO,GAAG,MAAM,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QACnC,CAAC,CAAC;aACD,IAAI,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,IAAI,KAAK,YAAY,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;QAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,G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AAO,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACtF,CAAC;QACD,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC7C,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;IAClF,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,SAAS,GAAG,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -1,15 +1,35 @@
|
|
|
1
1
|
import type { BijouContext } from '../../ports/context.js';
|
|
2
2
|
import type { TokenValue } from '../theme/tokens.js';
|
|
3
|
+
/** Definition for a single table column. */
|
|
3
4
|
export interface TableColumn {
|
|
5
|
+
/** Column header text. */
|
|
4
6
|
header: string;
|
|
7
|
+
/** Fixed column width in characters. When omitted, width is auto-calculated from content. */
|
|
5
8
|
width?: number;
|
|
6
9
|
}
|
|
10
|
+
/** Configuration for rendering a table. */
|
|
7
11
|
export interface TableOptions {
|
|
12
|
+
/** Column definitions (headers and optional widths). */
|
|
8
13
|
columns: TableColumn[];
|
|
14
|
+
/** Two-dimensional array of cell strings, one inner array per row. */
|
|
9
15
|
rows: string[][];
|
|
16
|
+
/** Theme token applied to header text. */
|
|
10
17
|
headerToken?: TokenValue;
|
|
18
|
+
/** Theme token applied to border characters. */
|
|
11
19
|
borderToken?: TokenValue;
|
|
20
|
+
/** Bijou context for I/O, styling, and mode detection. */
|
|
12
21
|
ctx?: BijouContext;
|
|
13
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Render a table with unicode box-drawing borders.
|
|
25
|
+
*
|
|
26
|
+
* Output adapts to the current output mode:
|
|
27
|
+
* - `interactive` / `static` — bordered table with styled headers.
|
|
28
|
+
* - `pipe` — tab-separated values (TSV).
|
|
29
|
+
* - `accessible` — key-value pairs per row for screen readers.
|
|
30
|
+
*
|
|
31
|
+
* @param options - Table configuration including columns and row data.
|
|
32
|
+
* @returns The rendered table string.
|
|
33
|
+
*/
|
|
14
34
|
export declare function table(options: TableOptions): string;
|
|
15
35
|
//# sourceMappingURL=table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/core/components/table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;IACjB,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,GAAG,CAAC,EAAE,YAAY,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/core/components/table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,4CAA4C;AAC5C,MAAM,WAAW,WAAW;IAC1B,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,6FAA6F;IAC7F,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,2CAA2C;AAC3C,MAAM,WAAW,YAAY;IAC3B,wDAAwD;IACxD,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,sEAAsE;IACtE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;IACjB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,gDAAgD;IAChD,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,0DAA0D;IAC1D,GAAG,CAAC,EAAE,YAAY,CAAC;CACpB;AAmCD;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CA0DnD"}
|
|
@@ -1,20 +1,45 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveCtx } from '../resolve-ctx.js';
|
|
2
|
+
/**
|
|
3
|
+
* Strip ANSI escape sequences from a string.
|
|
4
|
+
*
|
|
5
|
+
* @param str - Input string potentially containing ANSI codes.
|
|
6
|
+
* @returns The string with all ANSI SGR sequences removed.
|
|
7
|
+
*/
|
|
2
8
|
function stripAnsi(str) {
|
|
3
9
|
// eslint-disable-next-line no-control-regex
|
|
4
10
|
return str.replace(/\x1b\[[0-9;]*m/g, '');
|
|
5
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Calculate the visible (non-ANSI) character length of a string.
|
|
14
|
+
*
|
|
15
|
+
* @param str - Input string potentially containing ANSI codes.
|
|
16
|
+
* @returns The number of visible characters.
|
|
17
|
+
*/
|
|
6
18
|
function visibleLength(str) {
|
|
7
19
|
return stripAnsi(str).length;
|
|
8
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Right-pad a string to a target width, accounting for ANSI escape sequences.
|
|
23
|
+
*
|
|
24
|
+
* @param str - Input string to pad.
|
|
25
|
+
* @param width - Desired visible width.
|
|
26
|
+
* @returns The padded string.
|
|
27
|
+
*/
|
|
9
28
|
function padRight(str, width) {
|
|
10
29
|
const visible = visibleLength(str);
|
|
11
30
|
return visible >= width ? str : str + ' '.repeat(width - visible);
|
|
12
31
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Render a table with unicode box-drawing borders.
|
|
34
|
+
*
|
|
35
|
+
* Output adapts to the current output mode:
|
|
36
|
+
* - `interactive` / `static` — bordered table with styled headers.
|
|
37
|
+
* - `pipe` — tab-separated values (TSV).
|
|
38
|
+
* - `accessible` — key-value pairs per row for screen readers.
|
|
39
|
+
*
|
|
40
|
+
* @param options - Table configuration including columns and row data.
|
|
41
|
+
* @returns The rendered table string.
|
|
42
|
+
*/
|
|
18
43
|
export function table(options) {
|
|
19
44
|
const ctx = resolveCtx(options.ctx);
|
|
20
45
|
const mode = ctx.mode;
|