arcli 0.1.1 → 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/LICENSE +21 -0
- package/README.md +164 -4
- package/dist/cli/commands/billing-family.command.d.ts +2 -0
- package/dist/cli/commands/billing-family.command.js +30 -0
- package/dist/cli/commands/billing-family.command.js.map +1 -0
- package/dist/cli/commands/billing-shortcuts.command.d.ts +2 -0
- package/dist/cli/commands/billing-shortcuts.command.js +18 -0
- package/dist/cli/commands/billing-shortcuts.command.js.map +1 -0
- package/dist/cli/commands/billing.command.interactive-preview.d.ts +17 -0
- package/dist/cli/commands/billing.command.interactive-preview.js +65 -0
- package/dist/cli/commands/billing.command.interactive-preview.js.map +1 -0
- package/dist/cli/commands/billing.command.options.d.ts +2 -0
- package/dist/cli/commands/billing.command.options.js +49 -0
- package/dist/cli/commands/billing.command.options.js.map +1 -0
- package/dist/cli/commands/billing.command.output.d.ts +12 -0
- package/dist/cli/commands/billing.command.output.js +33 -0
- package/dist/cli/commands/billing.command.output.js.map +1 -0
- package/dist/cli/commands/billing.command.parser.d.ts +18 -0
- package/dist/cli/commands/billing.command.parser.js +136 -0
- package/dist/cli/commands/billing.command.parser.js.map +1 -0
- package/dist/cli/commands/billing.command.shared.d.ts +7 -0
- package/dist/cli/commands/billing.command.shared.js +78 -0
- package/dist/cli/commands/billing.command.shared.js.map +1 -0
- package/dist/cli/commands/billing.command.shortcuts.d.ts +7 -0
- package/dist/cli/commands/billing.command.shortcuts.js +52 -0
- package/dist/cli/commands/billing.command.shortcuts.js.map +1 -0
- package/dist/cli/commands/config.command.d.ts +2 -0
- package/dist/cli/commands/config.command.js +125 -0
- package/dist/cli/commands/config.command.js.map +1 -0
- package/dist/cli/commands/examples.command.d.ts +2 -0
- package/dist/cli/commands/examples.command.js +14 -0
- package/dist/cli/commands/examples.command.js.map +1 -0
- package/dist/cli/commands/storybook.command.d.ts +2 -0
- package/dist/cli/commands/storybook.command.js +26 -0
- package/dist/cli/commands/storybook.command.js.map +1 -0
- package/dist/cli/help.d.ts +10 -0
- package/dist/cli/help.js +473 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +41 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/program.d.ts +2 -0
- package/dist/cli/program.js +28 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/types.d.ts +6 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/version.d.ts +1 -0
- package/dist/cli/version.js +2 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/dates/arca-date.d.ts +2 -0
- package/dist/lib/dates/arca-date.js +28 -0
- package/dist/lib/dates/arca-date.js.map +1 -0
- package/dist/lib/errors/app-error.d.ts +14 -0
- package/dist/lib/errors/app-error.js +29 -0
- package/dist/lib/errors/app-error.js.map +1 -0
- package/dist/lib/files/read-json-file.d.ts +1 -0
- package/dist/lib/files/read-json-file.js +21 -0
- package/dist/lib/files/read-json-file.js.map +1 -0
- package/dist/lib/paths/mask-path.d.ts +1 -0
- package/dist/lib/paths/mask-path.js +17 -0
- package/dist/lib/paths/mask-path.js.map +1 -0
- package/dist/lib/security/certificate.d.ts +7 -0
- package/dist/lib/security/certificate.js +16 -0
- package/dist/lib/security/certificate.js.map +1 -0
- package/dist/lib/security/pem.d.ts +5 -0
- package/dist/lib/security/pem.js +36 -0
- package/dist/lib/security/pem.js.map +1 -0
- package/dist/modules/billing/billing-response.d.ts +4 -0
- package/dist/modules/billing/billing-response.js +74 -0
- package/dist/modules/billing/billing-response.js.map +1 -0
- package/dist/modules/billing/billing.amounts.d.ts +9 -0
- package/dist/modules/billing/billing.amounts.js +30 -0
- package/dist/modules/billing/billing.amounts.js.map +1 -0
- package/dist/modules/billing/billing.associated-vouchers.d.ts +10 -0
- package/dist/modules/billing/billing.associated-vouchers.js +51 -0
- package/dist/modules/billing/billing.associated-vouchers.js.map +1 -0
- package/dist/modules/billing/billing.constants.d.ts +2 -0
- package/dist/modules/billing/billing.constants.js +3 -0
- package/dist/modules/billing/billing.constants.js.map +1 -0
- package/dist/modules/billing/billing.date-range.d.ts +8 -0
- package/dist/modules/billing/billing.date-range.js +45 -0
- package/dist/modules/billing/billing.date-range.js.map +1 -0
- package/dist/modules/billing/billing.display.d.ts +13 -0
- package/dist/modules/billing/billing.display.js +111 -0
- package/dist/modules/billing/billing.display.js.map +1 -0
- package/dist/modules/billing/billing.json-format.d.ts +6 -0
- package/dist/modules/billing/billing.json-format.js +5 -0
- package/dist/modules/billing/billing.json-format.js.map +1 -0
- package/dist/modules/billing/billing.labels.d.ts +9 -0
- package/dist/modules/billing/billing.labels.js +108 -0
- package/dist/modules/billing/billing.labels.js.map +1 -0
- package/dist/modules/billing/billing.mappers.d.ts +8 -0
- package/dist/modules/billing/billing.mappers.js +59 -0
- package/dist/modules/billing/billing.mappers.js.map +1 -0
- package/dist/modules/billing/billing.presenter.d.ts +7 -0
- package/dist/modules/billing/billing.presenter.js +3 -0
- package/dist/modules/billing/billing.presenter.js.map +1 -0
- package/dist/modules/billing/billing.schemas.d.ts +74 -0
- package/dist/modules/billing/billing.schemas.js +69 -0
- package/dist/modules/billing/billing.schemas.js.map +1 -0
- package/dist/modules/billing/billing.serialize.d.ts +8 -0
- package/dist/modules/billing/billing.serialize.js +51 -0
- package/dist/modules/billing/billing.serialize.js.map +1 -0
- package/dist/modules/billing/billing.service.d.ts +15 -0
- package/dist/modules/billing/billing.service.js +88 -0
- package/dist/modules/billing/billing.service.js.map +1 -0
- package/dist/modules/billing/billing.text.d.ts +8 -0
- package/dist/modules/billing/billing.text.js +44 -0
- package/dist/modules/billing/billing.text.js.map +1 -0
- package/dist/modules/billing/billing.types.d.ts +13 -0
- package/dist/modules/billing/billing.types.internal.d.ts +25 -0
- package/dist/modules/billing/billing.types.internal.js +2 -0
- package/dist/modules/billing/billing.types.internal.js.map +1 -0
- package/dist/modules/billing/billing.types.js +2 -0
- package/dist/modules/billing/billing.types.js.map +1 -0
- package/dist/modules/billing/billing.validation.d.ts +5 -0
- package/dist/modules/billing/billing.validation.js +45 -0
- package/dist/modules/billing/billing.validation.js.map +1 -0
- package/dist/modules/billing/voucher-kind-map.d.ts +9 -0
- package/dist/modules/billing/voucher-kind-map.js +180 -0
- package/dist/modules/billing/voucher-kind-map.js.map +1 -0
- package/dist/modules/config/config-doctor.d.ts +15 -0
- package/dist/modules/config/config-doctor.js +125 -0
- package/dist/modules/config/config-doctor.js.map +1 -0
- package/dist/modules/config/config-value-parser.d.ts +2 -0
- package/dist/modules/config/config-value-parser.js +71 -0
- package/dist/modules/config/config-value-parser.js.map +1 -0
- package/dist/modules/config/config.presenter.d.ts +7 -0
- package/dist/modules/config/config.presenter.js +80 -0
- package/dist/modules/config/config.presenter.js.map +1 -0
- package/dist/modules/config/config.schemas.d.ts +87 -0
- package/dist/modules/config/config.schemas.js +84 -0
- package/dist/modules/config/config.schemas.js.map +1 -0
- package/dist/modules/config/config.service.d.ts +20 -0
- package/dist/modules/config/config.service.js +78 -0
- package/dist/modules/config/config.service.js.map +1 -0
- package/dist/modules/examples/examples.d.ts +1 -0
- package/dist/modules/examples/examples.js +156 -0
- package/dist/modules/examples/examples.js.map +1 -0
- package/dist/modules/storybook/showcase-theme.d.ts +7 -0
- package/dist/modules/storybook/showcase-theme.js +6 -0
- package/dist/modules/storybook/showcase-theme.js.map +1 -0
- package/dist/modules/storybook/showcase.d.ts +2 -0
- package/dist/modules/storybook/showcase.js +310 -0
- package/dist/modules/storybook/showcase.js.map +1 -0
- package/dist/modules/update-check/update-check.presenter.d.ts +2 -0
- package/dist/modules/update-check/update-check.presenter.js +6 -0
- package/dist/modules/update-check/update-check.presenter.js.map +1 -0
- package/dist/modules/update-check/update-check.service.d.ts +8 -0
- package/dist/modules/update-check/update-check.service.js +72 -0
- package/dist/modules/update-check/update-check.service.js.map +1 -0
- package/dist/services/arca/arca-billing.gateway.d.ts +9 -0
- package/dist/services/arca/arca-billing.gateway.js +10 -0
- package/dist/services/arca/arca-billing.gateway.js.map +1 -0
- package/dist/services/arca/arca-client.factory.d.ts +5 -0
- package/dist/services/arca/arca-client.factory.js +7 -0
- package/dist/services/arca/arca-client.factory.js.map +1 -0
- package/dist/services/arca/arca-context.resolver.d.ts +44 -0
- package/dist/services/arca/arca-context.resolver.js +120 -0
- package/dist/services/arca/arca-context.resolver.js.map +1 -0
- package/dist/ui/components/contentPanel.d.ts +5 -0
- package/dist/ui/components/contentPanel.js +11 -0
- package/dist/ui/components/contentPanel.js.map +1 -0
- package/dist/ui/components/errorPanel.d.ts +1 -0
- package/dist/ui/components/errorPanel.js +13 -0
- package/dist/ui/components/errorPanel.js.map +1 -0
- package/dist/ui/components/index.d.ts +6 -0
- package/dist/ui/components/index.js +7 -0
- package/dist/ui/components/index.js.map +1 -0
- package/dist/ui/components/keyValuePanel.d.ts +3 -0
- package/dist/ui/components/keyValuePanel.js +14 -0
- package/dist/ui/components/keyValuePanel.js.map +1 -0
- package/dist/ui/components/noticePanel.d.ts +3 -0
- package/dist/ui/components/noticePanel.js +11 -0
- package/dist/ui/components/noticePanel.js.map +1 -0
- package/dist/ui/components/rawPanel.d.ts +1 -0
- package/dist/ui/components/rawPanel.js +5 -0
- package/dist/ui/components/rawPanel.js.map +1 -0
- package/dist/ui/components/statusPanel.d.ts +3 -0
- package/dist/ui/components/statusPanel.js +20 -0
- package/dist/ui/components/statusPanel.js.map +1 -0
- package/dist/ui/index.d.ts +5 -0
- package/dist/ui/index.js +6 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/presenters/billing.presenter.d.ts +2 -0
- package/dist/ui/presenters/billing.presenter.js +2 -0
- package/dist/ui/presenters/billing.presenter.js.map +1 -0
- package/dist/ui/presenters/config.presenter.d.ts +1 -0
- package/dist/ui/presenters/config.presenter.js +2 -0
- package/dist/ui/presenters/config.presenter.js.map +1 -0
- package/dist/ui/presenters/errors.presenter.d.ts +1 -0
- package/dist/ui/presenters/errors.presenter.js +89 -0
- package/dist/ui/presenters/errors.presenter.js.map +1 -0
- package/dist/ui/presenters/errors.zod-presenter.d.ts +2 -0
- package/dist/ui/presenters/errors.zod-presenter.js +82 -0
- package/dist/ui/presenters/errors.zod-presenter.js.map +1 -0
- package/dist/ui/presenters/index.d.ts +4 -0
- package/dist/ui/presenters/index.js +5 -0
- package/dist/ui/presenters/index.js.map +1 -0
- package/dist/ui/presenters/showcase.presenter.d.ts +1 -0
- package/dist/ui/presenters/showcase.presenter.js +2 -0
- package/dist/ui/presenters/showcase.presenter.js.map +1 -0
- package/dist/ui/primitives/index.d.ts +10 -0
- package/dist/ui/primitives/index.js +11 -0
- package/dist/ui/primitives/index.js.map +1 -0
- package/dist/ui/primitives/renderDivider.d.ts +5 -0
- package/dist/ui/primitives/renderDivider.js +5 -0
- package/dist/ui/primitives/renderDivider.js.map +1 -0
- package/dist/ui/primitives/renderFooter.d.ts +7 -0
- package/dist/ui/primitives/renderFooter.js +6 -0
- package/dist/ui/primitives/renderFooter.js.map +1 -0
- package/dist/ui/primitives/renderJson.d.ts +3 -0
- package/dist/ui/primitives/renderJson.js +19 -0
- package/dist/ui/primitives/renderJson.js.map +1 -0
- package/dist/ui/primitives/renderKeyValue.d.ts +14 -0
- package/dist/ui/primitives/renderKeyValue.js +34 -0
- package/dist/ui/primitives/renderKeyValue.js.map +1 -0
- package/dist/ui/primitives/renderLogo.d.ts +2 -0
- package/dist/ui/primitives/renderLogo.js +28 -0
- package/dist/ui/primitives/renderLogo.js.map +1 -0
- package/dist/ui/primitives/renderObject.d.ts +1 -0
- package/dist/ui/primitives/renderObject.js +19 -0
- package/dist/ui/primitives/renderObject.js.map +1 -0
- package/dist/ui/primitives/renderPanel.d.ts +23 -0
- package/dist/ui/primitives/renderPanel.js +114 -0
- package/dist/ui/primitives/renderPanel.js.map +1 -0
- package/dist/ui/primitives/renderSubtitle.d.ts +7 -0
- package/dist/ui/primitives/renderSubtitle.js +6 -0
- package/dist/ui/primitives/renderSubtitle.js.map +1 -0
- package/dist/ui/primitives/renderTable.d.ts +6 -0
- package/dist/ui/primitives/renderTable.js +14 -0
- package/dist/ui/primitives/renderTable.js.map +1 -0
- package/dist/ui/primitives/text.d.ts +18 -0
- package/dist/ui/primitives/text.js +154 -0
- package/dist/ui/primitives/text.js.map +1 -0
- package/dist/ui/stream/index.d.ts +1 -0
- package/dist/ui/stream/index.js +2 -0
- package/dist/ui/stream/index.js.map +1 -0
- package/dist/ui/stream/terminal-stream.d.ts +10 -0
- package/dist/ui/stream/terminal-stream.js +20 -0
- package/dist/ui/stream/terminal-stream.js.map +1 -0
- package/dist/ui/theme/index.d.ts +1 -0
- package/dist/ui/theme/index.js +2 -0
- package/dist/ui/theme/index.js.map +1 -0
- package/dist/ui/theme/theme.d.ts +27 -0
- package/dist/ui/theme/theme.js +41 -0
- package/dist/ui/theme/theme.js.map +1 -0
- package/llms.txt +157 -0
- package/package.json +98 -35
- package/.babelrc +0 -4
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -17
- package/.npmignore +0 -1
- package/lib/arcli.min.js +0 -1
- package/src/commander/index.js +0 -3
- package/src/config.js +0 -22
- package/src/index.js +0 -19
- package/src/init/index.js +0 -13
- package/src/logger/index.js +0 -8
- package/src/logger/winston.js +0 -55
- package/src/run.js +0 -4
- package/src/spinner/index.js +0 -8
- package/src/spinner/ora.js +0 -50
- package/tst/index.js +0 -29
- package/webpack.config.js +0 -47
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { inspect } from 'node:util';
|
|
2
|
+
import { highlightJsonValues, renderJson } from './renderJson.js';
|
|
3
|
+
import { shouldUseColor } from './text.js';
|
|
4
|
+
export function renderObject(value) {
|
|
5
|
+
try {
|
|
6
|
+
return highlightJsonValues(renderJson(value));
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return inspect(value, {
|
|
10
|
+
breakLength: 88,
|
|
11
|
+
colors: shouldUseColor(),
|
|
12
|
+
compact: false,
|
|
13
|
+
depth: null,
|
|
14
|
+
numericSeparator: false,
|
|
15
|
+
sorted: false,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=renderObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderObject.js","sourceRoot":"","sources":["../../../src/ui/primitives/renderObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,IAAI,CAAC;QACH,OAAO,mBAAmB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC,KAAK,EAAE;YACpB,WAAW,EAAE,EAAE;YACf,MAAM,EAAE,cAAc,EAAE;YACxB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,IAAI;YACX,gBAAgB,EAAE,KAAK;YACvB,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Options as BoxenOptions, type Spacing as BoxenSpacing } from 'boxen';
|
|
2
|
+
import { type UiBorderType, type UiWidthPreset } from '../theme/theme';
|
|
3
|
+
import { type UiTextColor } from './text';
|
|
4
|
+
type PanelAlignment = 'block-center' | 'center' | 'left';
|
|
5
|
+
export interface RenderPanelProps {
|
|
6
|
+
readonly borderColor?: BoxenOptions['borderColor'];
|
|
7
|
+
readonly borderType?: UiBorderType;
|
|
8
|
+
readonly content: string | readonly string[];
|
|
9
|
+
readonly contentAlign?: PanelAlignment;
|
|
10
|
+
readonly footer?: string;
|
|
11
|
+
readonly footerColor?: UiTextColor;
|
|
12
|
+
readonly footerDivider?: boolean | string;
|
|
13
|
+
readonly maxWidth?: UiWidthPreset | number;
|
|
14
|
+
readonly padding?: Partial<BoxenSpacing>;
|
|
15
|
+
readonly subtitle?: string;
|
|
16
|
+
readonly subtitleColor?: UiTextColor;
|
|
17
|
+
readonly title?: string;
|
|
18
|
+
readonly titleAlignment?: BoxenOptions['titleAlignment'];
|
|
19
|
+
readonly titleColor?: UiTextColor;
|
|
20
|
+
readonly width?: UiWidthPreset | number;
|
|
21
|
+
}
|
|
22
|
+
export declare function renderPanel(props: RenderPanelProps): string;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import boxen from 'boxen';
|
|
2
|
+
import { UI_THEME } from '../theme/theme.js';
|
|
3
|
+
import { renderDivider } from './renderDivider.js';
|
|
4
|
+
import { renderFooter } from './renderFooter.js';
|
|
5
|
+
import { renderSubtitle } from './renderSubtitle.js';
|
|
6
|
+
import { bold, centerLineBlock, centerLines, flattenVisibleLines, maxVisibleWidth, wrapIndentedPlainText, } from './text.js';
|
|
7
|
+
function resolvePadding(padding) {
|
|
8
|
+
const base = UI_THEME.spacing.panelPadding;
|
|
9
|
+
return {
|
|
10
|
+
bottom: padding?.bottom ?? base.bottom ?? 0,
|
|
11
|
+
left: padding?.left ?? base.left ?? 0,
|
|
12
|
+
right: padding?.right ?? base.right ?? 0,
|
|
13
|
+
top: padding?.top ?? base.top ?? 0,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function resolveWidth(width) {
|
|
17
|
+
if (typeof width === 'number') {
|
|
18
|
+
return width;
|
|
19
|
+
}
|
|
20
|
+
return UI_THEME.widths[width ?? 'standard'].min;
|
|
21
|
+
}
|
|
22
|
+
function resolveMaxWidth(width) {
|
|
23
|
+
if (width === undefined) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
if (typeof width === 'number') {
|
|
27
|
+
return width;
|
|
28
|
+
}
|
|
29
|
+
return UI_THEME.widths[width].max;
|
|
30
|
+
}
|
|
31
|
+
function alignLines(lines, width, align) {
|
|
32
|
+
if (align === 'left') {
|
|
33
|
+
return flattenVisibleLines(lines);
|
|
34
|
+
}
|
|
35
|
+
if (align === 'block-center') {
|
|
36
|
+
return centerLineBlock(lines, width);
|
|
37
|
+
}
|
|
38
|
+
return centerLines(lines, width);
|
|
39
|
+
}
|
|
40
|
+
function formatTitle(title, color) {
|
|
41
|
+
if (!title) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
const normalizedTitle = bold(title.toUpperCase());
|
|
45
|
+
if (!color) {
|
|
46
|
+
return normalizedTitle;
|
|
47
|
+
}
|
|
48
|
+
return normalizedTitle;
|
|
49
|
+
}
|
|
50
|
+
export function renderPanel(props) {
|
|
51
|
+
const padding = resolvePadding(props.padding);
|
|
52
|
+
const paddingLeft = padding.left ?? 0;
|
|
53
|
+
const paddingRight = padding.right ?? 0;
|
|
54
|
+
const minimumWidth = resolveWidth(props.width);
|
|
55
|
+
const configuredMaxWidth = props.maxWidth === undefined
|
|
56
|
+
? typeof props.width === 'number'
|
|
57
|
+
? null
|
|
58
|
+
: UI_THEME.widths[props.width ?? 'standard'].max
|
|
59
|
+
: resolveMaxWidth(props.maxWidth);
|
|
60
|
+
const maximumWidth = configuredMaxWidth === null ? Number.POSITIVE_INFINITY : Math.max(minimumWidth, configuredMaxWidth);
|
|
61
|
+
const contentLines = typeof props.content === 'string' ? props.content.split('\n') : [...props.content];
|
|
62
|
+
const visibleLines = [...contentLines];
|
|
63
|
+
const calculatedWidth = maxVisibleWidth(visibleLines) + paddingLeft + paddingRight + 2;
|
|
64
|
+
const panelWidth = Math.min(maximumWidth, Math.max(minimumWidth, calculatedWidth));
|
|
65
|
+
const innerWidth = Math.max(0, panelWidth - paddingLeft - paddingRight - 2);
|
|
66
|
+
const footerDivider = props.footerDivider === undefined ? false : props.footerDivider;
|
|
67
|
+
const footerDividerLine = footerDivider
|
|
68
|
+
? renderDivider({ character: typeof footerDivider === 'string' ? footerDivider : '═', width: innerWidth })
|
|
69
|
+
: null;
|
|
70
|
+
const footerLine = props.footer
|
|
71
|
+
? renderFooter({
|
|
72
|
+
text: props.footer,
|
|
73
|
+
textColor: props.footerColor,
|
|
74
|
+
width: innerWidth,
|
|
75
|
+
})
|
|
76
|
+
: null;
|
|
77
|
+
const wrappedContentLines = contentLines.flatMap((line) => wrapIndentedPlainText(line, innerWidth));
|
|
78
|
+
const lines = [];
|
|
79
|
+
const hasBodyContent = contentLines.length > 0;
|
|
80
|
+
const hasFooter = Boolean(footerLine);
|
|
81
|
+
const hasFooterDivider = Boolean(footerDividerLine);
|
|
82
|
+
if (props.subtitle) {
|
|
83
|
+
lines.push(...renderSubtitle({
|
|
84
|
+
text: props.subtitle,
|
|
85
|
+
textColor: props.subtitleColor,
|
|
86
|
+
width: innerWidth,
|
|
87
|
+
}));
|
|
88
|
+
if (hasBodyContent || hasFooter || hasFooterDivider) {
|
|
89
|
+
lines.push('');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (hasBodyContent) {
|
|
93
|
+
lines.push(...alignLines(wrappedContentLines, innerWidth, props.contentAlign ?? 'left'));
|
|
94
|
+
}
|
|
95
|
+
if (footerDividerLine) {
|
|
96
|
+
lines.push('', renderDivider({ character: typeof footerDivider === 'string' ? footerDivider : '═', width: innerWidth }));
|
|
97
|
+
}
|
|
98
|
+
if (footerLine) {
|
|
99
|
+
lines.push('', renderFooter({
|
|
100
|
+
text: props.footer ?? '',
|
|
101
|
+
textColor: props.footerColor,
|
|
102
|
+
width: innerWidth,
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
return boxen(lines.join('\n'), {
|
|
106
|
+
borderColor: props.borderColor,
|
|
107
|
+
borderStyle: UI_THEME.borderStyles[props.borderType ?? 'common'],
|
|
108
|
+
padding,
|
|
109
|
+
title: formatTitle(props.title, props.titleColor),
|
|
110
|
+
titleAlignment: props.titleAlignment ?? 'center',
|
|
111
|
+
width: panelWidth,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=renderPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderPanel.js","sourceRoot":"","sources":["../../../src/ui/primitives/renderPanel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAqE,MAAM,OAAO,CAAC;AAE1F,OAAO,EAAE,QAAQ,EAAyC,MAAM,gBAAgB,CAAC;AAEjF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,IAAI,EACJ,eAAe,EACf,WAAW,EACX,mBAAmB,EACnB,eAAe,EAEf,qBAAqB,GACtB,MAAM,QAAQ,CAAC;AAsBhB,SAAS,cAAc,CAAC,OAA+B;IACrD,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC;IAE3C,OAAO;QACL,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC;QAC3C,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC;QACrC,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC;QACxC,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC;KACnC,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,KAAgC;IACpD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,QAAQ,CAAC,MAAM,CAAC,KAAK,IAAI,UAAU,CAAC,CAAC,GAAG,CAAC;AAClD,CAAC;AAED,SAAS,eAAe,CAAC,KAAmC;IAC1D,IAAI,KA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aAAa,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CACzG,CAAC;IACJ,CAAC;IAED,IAAI,UAAU,EAAE,CAAC;QACf,KAAK,CAAC,IAAI,CACR,EAAE,EACF,YAAY,CAAC;YACX,IAAI,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE;YACxB,SAAS,EAAE,KAAK,CAAC,WAAW;YAC5B,KAAK,EAAE,UAAU;SAClB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAC7B,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,WAAW,EAAE,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,IAAI,QAAQ,CAAC;QAChE,OAAO;QACP,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC;QACjD,cAAc,EAAE,KAAK,CAAC,cAAc,IAAI,QAAQ;QAChD,KAAK,EAAE,UAAU;KAClB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { centerText, colorize, wrapPlainText } from './text.js';
|
|
2
|
+
export function renderSubtitle(props) {
|
|
3
|
+
const color = props.textColor ?? 'muted';
|
|
4
|
+
return wrapPlainText(props.text, props.width).map((line) => centerText(colorize(line, color), props.width));
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=renderSubtitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderSubtitle.js","sourceRoot":"","sources":["../../../src/ui/primitives/renderSubtitle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAoB,aAAa,EAAE,MAAM,QAAQ,CAAC;AAQ/E,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,IAAI,OAAO,CAAC;IAEzC,OAAO,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9G,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { UI_THEME } from '../theme/theme.js';
|
|
2
|
+
import { bold } from './text.js';
|
|
3
|
+
export function renderTable(rows, options = {}) {
|
|
4
|
+
const widestLabel = Math.max(...rows.map(([label]) => label.length), 0);
|
|
5
|
+
const labelWidth = options.labelWidth ?? Math.min(UI_THEME.table.labelWidth, widestLabel);
|
|
6
|
+
const gap = ' '.repeat(options.gap ?? UI_THEME.table.gap);
|
|
7
|
+
return rows
|
|
8
|
+
.map(([label, value]) => {
|
|
9
|
+
const renderedLabel = options.emphasizeKeys === false ? label.padEnd(labelWidth) : bold(label.padEnd(labelWidth));
|
|
10
|
+
return `${renderedLabel}${gap}${value}`;
|
|
11
|
+
})
|
|
12
|
+
.join('\n');
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=renderTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderTable.js","sourceRoot":"","sources":["../../../src/ui/primitives/renderTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAQ9B,MAAM,UAAU,WAAW,CAAC,IAA8C,EAAE,UAA8B,EAAE;IAC1G,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IACxE,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAC1F,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE1D,OAAO,IAAI;SACR,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE;QACtB,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;QAElH,OAAO,GAAG,aAAa,GAAG,GAAG,GAAG,KAAK,EAAE,CAAC;IAC1C,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type UiColorToken } from '../theme/theme';
|
|
2
|
+
export type OutputTarget = 'stderr' | 'stdout';
|
|
3
|
+
export type UiTextColor = UiColorToken | string;
|
|
4
|
+
export declare function shouldUseColor(target?: OutputTarget): boolean;
|
|
5
|
+
export declare function supportsColor(target?: OutputTarget): boolean;
|
|
6
|
+
export declare function resolveTextColor(color: UiTextColor): string;
|
|
7
|
+
export declare function colorize(value: string, color: UiTextColor, target?: OutputTarget): string;
|
|
8
|
+
export declare function bold(value: string, target?: OutputTarget): string;
|
|
9
|
+
export declare function badge(label: string, color: UiTextColor): string;
|
|
10
|
+
export declare function toneText(value: string, color: UiTextColor): string;
|
|
11
|
+
export declare function stripAnsi(value: string): string;
|
|
12
|
+
export declare function flattenVisibleLines(lines: readonly string[]): string[];
|
|
13
|
+
export declare function wrapPlainText(value: string, width: number): string[];
|
|
14
|
+
export declare function wrapIndentedPlainText(value: string, width: number): string[];
|
|
15
|
+
export declare function maxVisibleWidth(lines: readonly string[]): number;
|
|
16
|
+
export declare function centerText(value: string, width: number): string;
|
|
17
|
+
export declare function centerLines(lines: readonly string[], width: number): string[];
|
|
18
|
+
export declare function centerLineBlock(lines: readonly string[], width: number): string[];
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { UI_THEME } from '../theme/theme.js';
|
|
2
|
+
const BOLD = '\u001B[1m';
|
|
3
|
+
// Cierres puntuales (no un reset total) para no cortar un color ambiental en
|
|
4
|
+
// el que este texto quede anidado, por ejemplo un titulo dentro del borde
|
|
5
|
+
// coloreado que dibuja boxen.
|
|
6
|
+
const BOLD_OFF = '\u001B[22m';
|
|
7
|
+
const COLOR_OFF = '\u001B[39m';
|
|
8
|
+
export function shouldUseColor(target = 'stdout') {
|
|
9
|
+
if (process.env.NO_COLOR) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const stream = target === 'stderr' ? process.stderr : process.stdout;
|
|
13
|
+
return stream.isTTY !== false;
|
|
14
|
+
}
|
|
15
|
+
export function supportsColor(target = 'stdout') {
|
|
16
|
+
return shouldUseColor(target);
|
|
17
|
+
}
|
|
18
|
+
export function resolveTextColor(color) {
|
|
19
|
+
return UI_THEME.colors[color] ?? color;
|
|
20
|
+
}
|
|
21
|
+
// Envuelve cada linea por separado (en vez de todo el bloque de una vez) para
|
|
22
|
+
// que, si el contenido tiene varias lineas, el estilo no quede "abierto" en
|
|
23
|
+
// el salto de linea. Un panel que dibuja un borde entre cada linea de
|
|
24
|
+
// contenido insertaria ese borde dentro de un estilo todavia sin cerrar.
|
|
25
|
+
function wrapLines(value, open, close) {
|
|
26
|
+
return value
|
|
27
|
+
.split('\n')
|
|
28
|
+
.map((line) => `${open}${line}${close}`)
|
|
29
|
+
.join('\n');
|
|
30
|
+
}
|
|
31
|
+
export function colorize(value, color, target = 'stdout') {
|
|
32
|
+
if (!shouldUseColor(target)) {
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
return wrapLines(value, resolveTextColor(color), COLOR_OFF);
|
|
36
|
+
}
|
|
37
|
+
export function bold(value, target = 'stdout') {
|
|
38
|
+
if (!shouldUseColor(target)) {
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
return wrapLines(value, BOLD, BOLD_OFF);
|
|
42
|
+
}
|
|
43
|
+
export function badge(label, color) {
|
|
44
|
+
return bold(colorize(`${UI_THEME.badgeBrackets[0]}${label}${UI_THEME.badgeBrackets[1]}`, color));
|
|
45
|
+
}
|
|
46
|
+
export function toneText(value, color) {
|
|
47
|
+
return bold(colorize(value, color));
|
|
48
|
+
}
|
|
49
|
+
export function stripAnsi(value) {
|
|
50
|
+
// eslint-disable-next-line no-control-regex
|
|
51
|
+
return value.replace(/\u001B\[[0-9;]*m/g, '');
|
|
52
|
+
}
|
|
53
|
+
export function flattenVisibleLines(lines) {
|
|
54
|
+
return lines.flatMap((line) => line.split('\n'));
|
|
55
|
+
}
|
|
56
|
+
export function wrapPlainText(value, width) {
|
|
57
|
+
if (width <= 0) {
|
|
58
|
+
return [value];
|
|
59
|
+
}
|
|
60
|
+
return value.split('\n').flatMap((line) => {
|
|
61
|
+
if (line.length <= width) {
|
|
62
|
+
return [line];
|
|
63
|
+
}
|
|
64
|
+
const words = line.split(/\s+/);
|
|
65
|
+
const wrapped = [];
|
|
66
|
+
let currentLine = '';
|
|
67
|
+
for (const word of words) {
|
|
68
|
+
const candidate = currentLine ? `${currentLine} ${word}` : word;
|
|
69
|
+
if (stripAnsi(candidate).length <= width) {
|
|
70
|
+
currentLine = candidate;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (currentLine) {
|
|
74
|
+
wrapped.push(currentLine);
|
|
75
|
+
}
|
|
76
|
+
if (stripAnsi(word).length <= width) {
|
|
77
|
+
currentLine = word;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
let remaining = word;
|
|
81
|
+
while (stripAnsi(remaining).length > width) {
|
|
82
|
+
wrapped.push(remaining.slice(0, width));
|
|
83
|
+
remaining = remaining.slice(width);
|
|
84
|
+
}
|
|
85
|
+
currentLine = remaining;
|
|
86
|
+
}
|
|
87
|
+
if (currentLine) {
|
|
88
|
+
wrapped.push(currentLine);
|
|
89
|
+
}
|
|
90
|
+
return wrapped.length > 0 ? wrapped : [''];
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export function wrapIndentedPlainText(value, width) {
|
|
94
|
+
if (width <= 0) {
|
|
95
|
+
return [value];
|
|
96
|
+
}
|
|
97
|
+
return value.split('\n').flatMap((line) => {
|
|
98
|
+
if (stripAnsi(line).length <= width) {
|
|
99
|
+
return [line];
|
|
100
|
+
}
|
|
101
|
+
const indent = line.match(/^\s*/)?.[0] ?? '';
|
|
102
|
+
const content = line.slice(indent.length).trimStart();
|
|
103
|
+
const continuationIndent = indent;
|
|
104
|
+
const availableWidth = Math.max(1, width - stripAnsi(continuationIndent).length);
|
|
105
|
+
if (!content) {
|
|
106
|
+
return [line];
|
|
107
|
+
}
|
|
108
|
+
const words = content.split(/\s+/);
|
|
109
|
+
const wrapped = [];
|
|
110
|
+
let currentLine = indent;
|
|
111
|
+
for (const word of words) {
|
|
112
|
+
const candidate = currentLine.trim().length > 0 ? `${currentLine} ${word}` : `${indent}${word}`;
|
|
113
|
+
if (stripAnsi(candidate).length <= width) {
|
|
114
|
+
currentLine = candidate;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (currentLine.trim().length > 0) {
|
|
118
|
+
wrapped.push(currentLine);
|
|
119
|
+
}
|
|
120
|
+
if (stripAnsi(word).length <= availableWidth) {
|
|
121
|
+
currentLine = `${continuationIndent}${word}`;
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
let remaining = word;
|
|
125
|
+
while (stripAnsi(remaining).length > availableWidth) {
|
|
126
|
+
wrapped.push(`${continuationIndent}${remaining.slice(0, availableWidth)}`);
|
|
127
|
+
remaining = remaining.slice(availableWidth);
|
|
128
|
+
}
|
|
129
|
+
currentLine = `${continuationIndent}${remaining}`;
|
|
130
|
+
}
|
|
131
|
+
if (currentLine.trim().length > 0) {
|
|
132
|
+
wrapped.push(currentLine);
|
|
133
|
+
}
|
|
134
|
+
return wrapped.length > 0 ? wrapped : [line];
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
export function maxVisibleWidth(lines) {
|
|
138
|
+
return Math.max(...flattenVisibleLines(lines).map((line) => stripAnsi(line).length), 0);
|
|
139
|
+
}
|
|
140
|
+
export function centerText(value, width) {
|
|
141
|
+
const visibleWidth = stripAnsi(value).length;
|
|
142
|
+
const leftPadding = Math.max(0, Math.floor((width - visibleWidth) / 2));
|
|
143
|
+
return `${' '.repeat(leftPadding)}${value}`;
|
|
144
|
+
}
|
|
145
|
+
export function centerLines(lines, width) {
|
|
146
|
+
return flattenVisibleLines(lines).map((line) => centerText(line, width));
|
|
147
|
+
}
|
|
148
|
+
export function centerLineBlock(lines, width) {
|
|
149
|
+
const flattenedLines = flattenVisibleLines(lines);
|
|
150
|
+
const blockWidth = maxVisibleWidth(flattenedLines);
|
|
151
|
+
const leftPadding = Math.max(0, Math.floor((width - blockWidth) / 2));
|
|
152
|
+
return flattenedLines.map((line) => `${' '.repeat(leftPadding)}${line}`);
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/ui/primitives/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAqB,MAAM,gBAAgB,CAAC;AAE7D,MAAM,IAAI,GAAG,WAAW,CAAC;AACzB,6EAA6E;AAC7E,0EAA0E;AAC1E,8BAA8B;AAC9B,MAAM,QAAQ,GAAG,YAAY,CAAC;AAC9B,MAAM,SAAS,GAAG,YAAY,CAAC;AAK/B,MAAM,UAAU,cAAc,CAAC,SAAuB,QAAQ;IAC5D,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QACz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AAG,KAAK,EAAE,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAwB,EAAE,KAAa;IACjE,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAwB,EAAE,KAAa;IACrE,MAAM,cAAc,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,eAAe,CAAC,cAAc,CAAC,CAAC;IACnD,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAEtE,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;AAC3E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './terminal-stream';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/stream/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface TerminalStreamOptions {
|
|
2
|
+
readonly json?: boolean;
|
|
3
|
+
readonly target?: 'stderr' | 'stdout';
|
|
4
|
+
}
|
|
5
|
+
export declare function formatTerminalOutput(content: string, options?: TerminalStreamOptions): string;
|
|
6
|
+
export declare function writeTerminalOutput(content: string): void;
|
|
7
|
+
export declare function writeTerminalJson(content: string): void;
|
|
8
|
+
export declare function writeTerminalError(content: string): void;
|
|
9
|
+
export declare function writeTerminalJsonError(content: string): void;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { highlightJsonValues } from '../primitives/renderJson.js';
|
|
2
|
+
import { supportsColor } from '../primitives/text.js';
|
|
3
|
+
export function formatTerminalOutput(content, options = {}) {
|
|
4
|
+
const target = options.target ?? 'stdout';
|
|
5
|
+
const renderedContent = options.json && supportsColor(target) ? highlightJsonValues(content, target) : content;
|
|
6
|
+
return `\n${renderedContent}\n\n`;
|
|
7
|
+
}
|
|
8
|
+
export function writeTerminalOutput(content) {
|
|
9
|
+
process.stdout.write(formatTerminalOutput(content, { target: 'stdout' }));
|
|
10
|
+
}
|
|
11
|
+
export function writeTerminalJson(content) {
|
|
12
|
+
process.stdout.write(formatTerminalOutput(content, { json: true, target: 'stdout' }));
|
|
13
|
+
}
|
|
14
|
+
export function writeTerminalError(content) {
|
|
15
|
+
process.stderr.write(formatTerminalOutput(content, { target: 'stderr' }));
|
|
16
|
+
}
|
|
17
|
+
export function writeTerminalJsonError(content) {
|
|
18
|
+
process.stderr.write(formatTerminalOutput(content, { json: true, target: 'stderr' }));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=terminal-stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-stream.js","sourceRoot":"","sources":["../../../src/ui/stream/terminal-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAOnD,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,UAAiC,EAAE;IACvF,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,QAAQ,CAAC;IAC1C,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAE/G,OAAO,KAAK,eAAe,MAAM,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAe;IACjD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;AACxF,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,OAAe;IACpD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './theme';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Options as BoxenOptions, Spacing as BoxenSpacing } from 'boxen';
|
|
2
|
+
export type UiBorderType = 'arrow' | 'common' | 'debug' | 'note';
|
|
3
|
+
export type UiColorToken = 'danger' | 'debug' | 'info' | 'muted' | 'neutral' | 'success' | 'warning';
|
|
4
|
+
export type UiWidthPreset = 'compact' | 'standard' | 'wide';
|
|
5
|
+
export interface UiWidthRange {
|
|
6
|
+
readonly max: number;
|
|
7
|
+
readonly min: number;
|
|
8
|
+
}
|
|
9
|
+
export interface UiTheme {
|
|
10
|
+
readonly badgeBrackets: readonly [left: string, right: string];
|
|
11
|
+
readonly borderStyles: Readonly<Record<UiBorderType, BoxenOptions['borderStyle']>>;
|
|
12
|
+
readonly colors: Readonly<Record<UiColorToken, string>>;
|
|
13
|
+
readonly headingLineMinWidth: number;
|
|
14
|
+
readonly spacing: {
|
|
15
|
+
readonly gaps: {
|
|
16
|
+
readonly section: number;
|
|
17
|
+
readonly block: number;
|
|
18
|
+
};
|
|
19
|
+
readonly panelPadding: BoxenSpacing;
|
|
20
|
+
};
|
|
21
|
+
readonly table: {
|
|
22
|
+
readonly gap: number;
|
|
23
|
+
readonly labelWidth: number;
|
|
24
|
+
};
|
|
25
|
+
readonly widths: Readonly<Record<UiWidthPreset, UiWidthRange>>;
|
|
26
|
+
}
|
|
27
|
+
export declare const UI_THEME: UiTheme;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export const UI_THEME = {
|
|
2
|
+
badgeBrackets: ['[', ']'],
|
|
3
|
+
borderStyles: {
|
|
4
|
+
arrow: 'arrow',
|
|
5
|
+
common: 'doubleSingle',
|
|
6
|
+
debug: 'single',
|
|
7
|
+
note: 'classic',
|
|
8
|
+
},
|
|
9
|
+
colors: {
|
|
10
|
+
danger: '\u001B[31m',
|
|
11
|
+
debug: '\u001B[95m',
|
|
12
|
+
info: '\u001B[36m',
|
|
13
|
+
muted: '\u001B[2m',
|
|
14
|
+
neutral: '\u001B[37m',
|
|
15
|
+
success: '\u001B[32m',
|
|
16
|
+
warning: '\u001B[33m',
|
|
17
|
+
},
|
|
18
|
+
headingLineMinWidth: 18,
|
|
19
|
+
spacing: {
|
|
20
|
+
gaps: {
|
|
21
|
+
block: 1,
|
|
22
|
+
section: 2,
|
|
23
|
+
},
|
|
24
|
+
panelPadding: {
|
|
25
|
+
top: 1,
|
|
26
|
+
right: 2,
|
|
27
|
+
bottom: 1,
|
|
28
|
+
left: 2,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
table: {
|
|
32
|
+
gap: 2,
|
|
33
|
+
labelWidth: 30,
|
|
34
|
+
},
|
|
35
|
+
widths: {
|
|
36
|
+
compact: { min: 68, max: 80 },
|
|
37
|
+
standard: { min: 80, max: 100 },
|
|
38
|
+
wide: { min: 92, max: 116 },
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../src/ui/theme/theme.ts"],"names":[],"mappings":"AA6BA,MAAM,CAAC,MAAM,QAAQ,GAAY;IAC/B,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;IACzB,YAAY,EAAE;QACZ,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,cAAc;QACtB,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,SAAS;KAChB;IACD,MAAM,EAAE;QACN,MAAM,EAAE,YAAY;QACpB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,WAAW;QAClB,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE,YAAY;KACtB;IACD,mBAAmB,EAAE,EAAE;IACvB,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,KAAK,EAAE,CAAC;YACR,OAAO,EAAE,CAAC;SACX;QACD,YAAY,EAAE;YACZ,GAAG,EAAE,CAAC;YACN,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,IAAI,EAAE,CAAC;SACR;KACF;IACD,KAAK,EAAE;QACL,GAAG,EAAE,CAAC;QACN,UAAU,EAAE,EAAE;KACf;IACD,MAAM,EAAE;QACN,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;QAC7B,QAAQ,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;QAC/B,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;KAC5B;CACF,CAAC"}
|