arcli 0.1.2 → 1.2.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/CHANGELOG.md +78 -0
- package/LICENSE +21 -0
- package/README.md +169 -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 +18 -0
- package/dist/cli/commands/billing.command.interactive-preview.js +69 -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 +65 -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 +21 -0
- package/dist/cli/commands/billing.command.parser.js +170 -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 +99 -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/fce-obligation.command.d.ts +2 -0
- package/dist/cli/commands/fce-obligation.command.js +51 -0
- package/dist/cli/commands/fce-obligation.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 +11 -0
- package/dist/cli/help.js +534 -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 +30 -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 +6 -0
- package/dist/lib/dates/arca-date.js +45 -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 +19 -0
- package/dist/modules/billing/billing.amounts.js +72 -0
- package/dist/modules/billing/billing.amounts.js.map +1 -0
- package/dist/modules/billing/billing.associated-period.d.ts +8 -0
- package/dist/modules/billing/billing.associated-period.js +40 -0
- package/dist/modules/billing/billing.associated-period.js.map +1 -0
- package/dist/modules/billing/billing.associated-vouchers.d.ts +12 -0
- package/dist/modules/billing/billing.associated-vouchers.js +73 -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.currency.d.ts +18 -0
- package/dist/modules/billing/billing.currency.js +53 -0
- package/dist/modules/billing/billing.currency.js.map +1 -0
- package/dist/modules/billing/billing.date-range.d.ts +9 -0
- package/dist/modules/billing/billing.date-range.js +52 -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 +137 -0
- package/dist/modules/billing/billing.display.js.map +1 -0
- package/dist/modules/billing/billing.fce.d.ts +21 -0
- package/dist/modules/billing/billing.fce.js +59 -0
- package/dist/modules/billing/billing.fce.js.map +1 -0
- package/dist/modules/billing/billing.iva-receptor.d.ts +7 -0
- package/dist/modules/billing/billing.iva-receptor.js +58 -0
- package/dist/modules/billing/billing.iva-receptor.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 +60 -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 +107 -0
- package/dist/modules/billing/billing.schemas.js +106 -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 +53 -0
- package/dist/modules/billing/billing.serialize.js.map +1 -0
- package/dist/modules/billing/billing.service.d.ts +27 -0
- package/dist/modules/billing/billing.service.js +146 -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 +52 -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 +27 -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 +7 -0
- package/dist/modules/billing/billing.validation.js +80 -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 +99 -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 +88 -0
- package/dist/modules/config/config.presenter.js.map +1 -0
- package/dist/modules/config/config.schemas.d.ts +110 -0
- package/dist/modules/config/config.schemas.js +103 -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 +82 -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 +191 -0
- package/dist/modules/examples/examples.js.map +1 -0
- package/dist/modules/fce/fce-obligation.d.ts +20 -0
- package/dist/modules/fce/fce-obligation.js +33 -0
- package/dist/modules/fce/fce-obligation.js.map +1 -0
- package/dist/modules/fce/fce-obligation.presenter.d.ts +9 -0
- package/dist/modules/fce/fce-obligation.presenter.js +32 -0
- package/dist/modules/fce/fce-obligation.presenter.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 +10 -0
- package/dist/services/arca/arca-billing.gateway.js +22 -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/services/arca/arca-fce-obligation.gateway.d.ts +7 -0
- package/dist/services/arca/arca-fce-obligation.gateway.js +36 -0
- package/dist/services/arca/arca-fce-obligation.gateway.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 +103 -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 +161 -0
- package/package.json +99 -35
- package/.babelrc +0 -4
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -17
- package/.npmignore +0 -1
- package/lib/arcli.js +0 -275
- package/lib/arcli.min.js +0 -1
- package/src/config.js +0 -22
- package/src/consoler.js +0 -10
- package/src/index.js +0 -21
- package/src/init.js +0 -13
- package/src/run.js +0 -4
- package/src/spinner.js +0 -39
- package/tst/index.js +0 -26
- package/webpack.config.js +0 -47
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './renderDivider';
|
|
2
|
+
export * from './renderFooter';
|
|
3
|
+
export * from './renderJson';
|
|
4
|
+
export * from './renderKeyValue';
|
|
5
|
+
export * from './renderLogo';
|
|
6
|
+
export * from './renderObject';
|
|
7
|
+
export * from './renderPanel';
|
|
8
|
+
export * from './renderSubtitle';
|
|
9
|
+
export * from './renderTable';
|
|
10
|
+
export * from './text';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './renderDivider.js';
|
|
2
|
+
export * from './renderFooter.js';
|
|
3
|
+
export * from './renderJson.js';
|
|
4
|
+
export * from './renderKeyValue.js';
|
|
5
|
+
export * from './renderLogo.js';
|
|
6
|
+
export * from './renderObject.js';
|
|
7
|
+
export * from './renderPanel.js';
|
|
8
|
+
export * from './renderSubtitle.js';
|
|
9
|
+
export * from './renderTable.js';
|
|
10
|
+
export * from './text.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/primitives/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderDivider.js","sourceRoot":"","sources":["../../../src/ui/primitives/renderDivider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAOpC,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,OAAO,UAAU,CAAC,CAAC,KAAK,CAAC,SAAS,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderFooter.js","sourceRoot":"","sources":["../../../src/ui/primitives/renderFooter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAoB,MAAM,QAAQ,CAAC;AAQhE,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,IAAI,SAAS,CAAC;IAE3C,OAAO,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { colorize } from './text.js';
|
|
2
|
+
export function renderJson(value) {
|
|
3
|
+
return JSON.stringify(value, null, 2);
|
|
4
|
+
}
|
|
5
|
+
export function highlightJsonValues(content, target = 'stdout') {
|
|
6
|
+
return content.replace(/("(\\u[\da-fA-F]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)/g, (token) => {
|
|
7
|
+
if (token.startsWith('"') && token.endsWith(':')) {
|
|
8
|
+
return token;
|
|
9
|
+
}
|
|
10
|
+
if (token.startsWith('"')) {
|
|
11
|
+
return colorize(token, 'success', target);
|
|
12
|
+
}
|
|
13
|
+
if (token === 'true' || token === 'false' || token === 'null') {
|
|
14
|
+
return colorize(token, 'warning', target);
|
|
15
|
+
}
|
|
16
|
+
return colorize(token, 'warning', target);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=renderJson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderJson.js","sourceRoot":"","sources":["../../../src/ui/primitives/renderJson.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAqB,MAAM,QAAQ,CAAC;AAErD,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,SAAuB,QAAQ;IAClF,OAAO,OAAO,CAAC,OAAO,CACpB,sGAAsG,EACtG,CAAC,KAAK,EAAE,EAAE;QACR,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACjD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1B,OAAO,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAC5C,CAAC;QAED,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;YAC9D,OAAO,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type UiWidthPreset } from '../theme/theme';
|
|
2
|
+
export interface RenderKeyValueOptions {
|
|
3
|
+
readonly gap?: number;
|
|
4
|
+
readonly labelWidth?: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Ancho de columna de etiqueta como porcentaje del panel (columnWidths[0]),
|
|
8
|
+
* sin bajar de lo que necesita la etiqueta mas larga. Por defecto reparte
|
|
9
|
+
* el ancho en partes iguales entre las columnas (50/50 para las 2 columnas
|
|
10
|
+
* habituales de label/value).
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveKeyValueLabelWidth(preset: UiWidthPreset, rows: ReadonlyArray<readonly [string, ...unknown[]]>, columnWidths?: readonly number[]): number;
|
|
13
|
+
export declare function renderKeyValue(label: string, value: string | number | null | undefined, options?: RenderKeyValueOptions): string;
|
|
14
|
+
export declare function renderKeyValueRows(rows: ReadonlyArray<readonly [string, string | number | null | undefined]>, options?: RenderKeyValueOptions): string[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { UI_THEME } from '../theme/theme.js';
|
|
2
|
+
import { toneText } from './text.js';
|
|
3
|
+
const DEFAULT_COLUMN_WIDTHS = [50, 50];
|
|
4
|
+
/**
|
|
5
|
+
* Ancho de columna de etiqueta como porcentaje del panel (columnWidths[0]),
|
|
6
|
+
* sin bajar de lo que necesita la etiqueta mas larga. Por defecto reparte
|
|
7
|
+
* el ancho en partes iguales entre las columnas (50/50 para las 2 columnas
|
|
8
|
+
* habituales de label/value).
|
|
9
|
+
*/
|
|
10
|
+
export function resolveKeyValueLabelWidth(preset, rows, columnWidths = DEFAULT_COLUMN_WIDTHS) {
|
|
11
|
+
const innerWidth = UI_THEME.widths[preset].min -
|
|
12
|
+
(UI_THEME.spacing.panelPadding.left ?? 0) -
|
|
13
|
+
(UI_THEME.spacing.panelPadding.right ?? 0) -
|
|
14
|
+
2;
|
|
15
|
+
const labelPercentage = columnWidths[0] ?? 100 / columnWidths.length;
|
|
16
|
+
const proportionalWidth = Math.round(innerWidth * (labelPercentage / 100));
|
|
17
|
+
const naturalWidth = Math.max(...rows.map(([label]) => label.length), 0);
|
|
18
|
+
return Math.max(naturalWidth, proportionalWidth);
|
|
19
|
+
}
|
|
20
|
+
function normalizeValue(value) {
|
|
21
|
+
const normalizedValue = value === null || value === undefined || value === '' ? 'N/D' : String(value);
|
|
22
|
+
return normalizedValue;
|
|
23
|
+
}
|
|
24
|
+
export function renderKeyValue(label, value, options = {}) {
|
|
25
|
+
const labelWidth = options.labelWidth ?? UI_THEME.table.labelWidth;
|
|
26
|
+
const gap = ' '.repeat(options.gap ?? UI_THEME.table.gap);
|
|
27
|
+
return `${toneText(label.padEnd(labelWidth), 'neutral')}${gap}${normalizeValue(value)}`;
|
|
28
|
+
}
|
|
29
|
+
export function renderKeyValueRows(rows, options = {}) {
|
|
30
|
+
const widestLabel = Math.max(...rows.map(([label]) => label.length), 0);
|
|
31
|
+
const labelWidth = options.labelWidth ?? widestLabel;
|
|
32
|
+
return rows.map(([label, value]) => renderKeyValue(label, value, { ...options, labelWidth }));
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=renderKeyValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderKeyValue.js","sourceRoot":"","sources":["../../../src/ui/primitives/renderKeyValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAsB,MAAM,gBAAgB,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAOlC,MAAM,qBAAqB,GAAsB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAE1D;;;;;GAKG;AACH,M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AAC,GAAG,CAAC,CAAC;IAE1D,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,GAAG,GAAG,GAAG,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;AAC1F,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,IAA0E,EAC1E,UAAiC,EAAE;IAEnC,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,WAAW,CAAC;IAErD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;AAChG,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { colorize } from './text.js';
|
|
2
|
+
export const ARCLI_ASCII_BANNER = [
|
|
3
|
+
' d8888 8888888b. .d8888b. 888 8888888 ',
|
|
4
|
+
' d88888 888 Y88b d88P Y88b 888 888 ',
|
|
5
|
+
' d88P888 888 888 888 888 888 888 ',
|
|
6
|
+
' d88P 888 888 d88P 888 888 888 ',
|
|
7
|
+
' d88P 888 8888888P" 888 888 888 ',
|
|
8
|
+
' d88P 888 888 T88b 888 888 888 888 ',
|
|
9
|
+
' d8888888888 888 T88b Y88b d88P 888 888 ',
|
|
10
|
+
'd88P 888 888 T88b "Y8888P" 88888888 8888888 ',
|
|
11
|
+
].join('\n');
|
|
12
|
+
// Columna donde termina "AR" (con el espacio entre letras) y arranca "CLI",
|
|
13
|
+
// segun las columnas en blanco de ARCLI_ASCII_BANNER (letras separadas por
|
|
14
|
+
// una columna vacia en las 8 filas: 12, 23, 34, 43).
|
|
15
|
+
const ARCLI_BANNER_AR_CLI_SPLIT_COLUMN = 23;
|
|
16
|
+
function renderLogoWidth() {
|
|
17
|
+
return ARCLI_ASCII_BANNER.split('\n')[0]?.length ?? 0;
|
|
18
|
+
}
|
|
19
|
+
export function renderLogo() {
|
|
20
|
+
const logo = ARCLI_ASCII_BANNER.split('\n').map((line) => {
|
|
21
|
+
const ar = line.slice(0, ARCLI_BANNER_AR_CLI_SPLIT_COLUMN);
|
|
22
|
+
const cli = line.slice(ARCLI_BANNER_AR_CLI_SPLIT_COLUMN);
|
|
23
|
+
return `${colorize(ar, 'info')}${colorize(cli, 'neutral')}`;
|
|
24
|
+
});
|
|
25
|
+
const credit = '-LcsGrz'.padStart(renderLogoWidth() - 1);
|
|
26
|
+
return `\n\n${[...logo, credit].join('\n')}\n\n`;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=renderLogo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderLogo.js","sourceRoot":"","sources":["../../../src/ui/primitives/renderLogo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,sDAAsD;IACtD,sDAAsD;IACtD,sDAAsD;IACtD,sDAAsD;IACtD,sDAAsD;IACtD,sDAAsD;IACtD,sDAAsD;IACtD,sDAAsD;CACvD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,4EAA4E;AAC5E,2EAA2E;AAC3E,qDAAqD;AACrD,MAAM,gCAAgC,GAAG,EAAE,CAAC;AAE5C,SAAS,eAAe;IACtB,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,MAAM,IAAI,GAAG,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACvD,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,gCAAgC,CAAC,CAAC;QAC3D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAEzD,OAAO,GAAG,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,CAAC;IAEzD,OAAO,OAAO,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function renderObject(value: unknown): string;
|
|
@@ -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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C,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;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IAErE,OAAO,MAAM,CAAC,KAAK,KAAK,KAAK,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,SAAuB,QAAQ;IAC3D,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAA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AM,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 {};
|