@hypercli/ui 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/capabilities/index.d.ts +62 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +182 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/colors.d.ts +32 -0
- package/dist/colors.d.ts.map +1 -0
- package/dist/colors.js +40 -0
- package/dist/colors.js.map +1 -0
- package/dist/components/columns.d.ts +28 -0
- package/dist/components/columns.d.ts.map +1 -0
- package/dist/components/columns.js +70 -0
- package/dist/components/columns.js.map +1 -0
- package/dist/components/confirmPrompt.d.ts +38 -0
- package/dist/components/confirmPrompt.d.ts.map +1 -0
- package/dist/components/confirmPrompt.js +109 -0
- package/dist/components/confirmPrompt.js.map +1 -0
- package/dist/components/diff.d.ts +37 -0
- package/dist/components/diff.d.ts.map +1 -0
- package/dist/components/diff.js +36 -0
- package/dist/components/diff.js.map +1 -0
- package/dist/components/helpLayout.d.ts +59 -0
- package/dist/components/helpLayout.d.ts.map +1 -0
- package/dist/components/helpLayout.js +103 -0
- package/dist/components/helpLayout.js.map +1 -0
- package/dist/components/index.d.ts +38 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +23 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/keyValue.d.ts +31 -0
- package/dist/components/keyValue.d.ts.map +1 -0
- package/dist/components/keyValue.js +36 -0
- package/dist/components/keyValue.js.map +1 -0
- package/dist/components/list.d.ts +30 -0
- package/dist/components/list.d.ts.map +1 -0
- package/dist/components/list.js +80 -0
- package/dist/components/list.js.map +1 -0
- package/dist/components/message.d.ts +33 -0
- package/dist/components/message.d.ts.map +1 -0
- package/dist/components/message.js +86 -0
- package/dist/components/message.js.map +1 -0
- package/dist/components/panel.d.ts +28 -0
- package/dist/components/panel.d.ts.map +1 -0
- package/dist/components/panel.js +30 -0
- package/dist/components/panel.js.map +1 -0
- package/dist/components/progressBar.d.ts +44 -0
- package/dist/components/progressBar.d.ts.map +1 -0
- package/dist/components/progressBar.js +154 -0
- package/dist/components/progressBar.js.map +1 -0
- package/dist/components/section.d.ts +22 -0
- package/dist/components/section.d.ts.map +1 -0
- package/dist/components/section.js +48 -0
- package/dist/components/section.js.map +1 -0
- package/dist/components/selectPrompt.d.ts +58 -0
- package/dist/components/selectPrompt.d.ts.map +1 -0
- package/dist/components/selectPrompt.js +206 -0
- package/dist/components/selectPrompt.js.map +1 -0
- package/dist/components/spinner.d.ts +38 -0
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/spinner.js +125 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/statusList.d.ts +22 -0
- package/dist/components/statusList.d.ts.map +1 -0
- package/dist/components/statusList.js +43 -0
- package/dist/components/statusList.js.map +1 -0
- package/dist/components/table.d.ts +39 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +132 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/textPrompt.d.ts +43 -0
- package/dist/components/textPrompt.d.ts.map +1 -0
- package/dist/components/textPrompt.js +123 -0
- package/dist/components/textPrompt.js.map +1 -0
- package/dist/components/tree.d.ts +30 -0
- package/dist/components/tree.d.ts.map +1 -0
- package/dist/components/tree.js +49 -0
- package/dist/components/tree.js.map +1 -0
- package/dist/ds-index.d.ts +113 -0
- package/dist/ds-index.d.ts.map +1 -0
- package/dist/ds-index.js +112 -0
- package/dist/ds-index.js.map +1 -0
- package/dist/help.d.ts +32 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/help.js +34 -0
- package/dist/help.js.map +1 -0
- package/dist/hyper-theme.d.ts +8 -0
- package/dist/hyper-theme.d.ts.map +1 -0
- package/dist/hyper-theme.js +30 -0
- package/dist/hyper-theme.js.map +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/md.d.ts +12 -0
- package/dist/md.d.ts.map +1 -0
- package/dist/md.js +19 -0
- package/dist/md.js.map +1 -0
- package/dist/messages.d.ts +20 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +65 -0
- package/dist/messages.js.map +1 -0
- package/dist/palette.d.ts +20 -0
- package/dist/palette.d.ts.map +1 -0
- package/dist/palette.js +22 -0
- package/dist/palette.js.map +1 -0
- package/dist/primitives/align.d.ts +23 -0
- package/dist/primitives/align.d.ts.map +1 -0
- package/dist/primitives/align.js +40 -0
- package/dist/primitives/align.js.map +1 -0
- package/dist/primitives/badge.d.ts +24 -0
- package/dist/primitives/badge.d.ts.map +1 -0
- package/dist/primitives/badge.js +40 -0
- package/dist/primitives/badge.js.map +1 -0
- package/dist/primitives/border.d.ts +29 -0
- package/dist/primitives/border.d.ts.map +1 -0
- package/dist/primitives/border.js +100 -0
- package/dist/primitives/border.js.map +1 -0
- package/dist/primitives/context.d.ts +48 -0
- package/dist/primitives/context.d.ts.map +1 -0
- package/dist/primitives/context.js +64 -0
- package/dist/primitives/context.js.map +1 -0
- package/dist/primitives/divider.d.ts +25 -0
- package/dist/primitives/divider.d.ts.map +1 -0
- package/dist/primitives/divider.js +56 -0
- package/dist/primitives/divider.js.map +1 -0
- package/dist/primitives/indent.d.ts +16 -0
- package/dist/primitives/indent.d.ts.map +1 -0
- package/dist/primitives/indent.js +25 -0
- package/dist/primitives/indent.js.map +1 -0
- package/dist/primitives/index.d.ts +32 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +22 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/primitives/line.d.ts +21 -0
- package/dist/primitives/line.d.ts.map +1 -0
- package/dist/primitives/line.js +29 -0
- package/dist/primitives/line.js.map +1 -0
- package/dist/primitives/markdown.d.ts +91 -0
- package/dist/primitives/markdown.d.ts.map +1 -0
- package/dist/primitives/markdown.js +62 -0
- package/dist/primitives/markdown.js.map +1 -0
- package/dist/primitives/pad.d.ts +24 -0
- package/dist/primitives/pad.d.ts.map +1 -0
- package/dist/primitives/pad.js +20 -0
- package/dist/primitives/pad.js.map +1 -0
- package/dist/primitives/stack.d.ts +22 -0
- package/dist/primitives/stack.d.ts.map +1 -0
- package/dist/primitives/stack.js +21 -0
- package/dist/primitives/stack.js.map +1 -0
- package/dist/primitives/styledText.d.ts +36 -0
- package/dist/primitives/styledText.d.ts.map +1 -0
- package/dist/primitives/styledText.js +42 -0
- package/dist/primitives/styledText.js.map +1 -0
- package/dist/primitives/symbol.d.ts +15 -0
- package/dist/primitives/symbol.d.ts.map +1 -0
- package/dist/primitives/symbol.js +18 -0
- package/dist/primitives/symbol.js.map +1 -0
- package/dist/primitives/truncate.d.ts +23 -0
- package/dist/primitives/truncate.d.ts.map +1 -0
- package/dist/primitives/truncate.js +99 -0
- package/dist/primitives/truncate.js.map +1 -0
- package/dist/primitives/wrap.d.ts +23 -0
- package/dist/primitives/wrap.d.ts.map +1 -0
- package/dist/primitives/wrap.js +30 -0
- package/dist/primitives/wrap.js.map +1 -0
- package/dist/render/ansi-utils.d.ts +49 -0
- package/dist/render/ansi-utils.d.ts.map +1 -0
- package/dist/render/ansi-utils.js +405 -0
- package/dist/render/ansi-utils.js.map +1 -0
- package/dist/render/index.d.ts +11 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +11 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/sgr.d.ts +60 -0
- package/dist/render/sgr.d.ts.map +1 -0
- package/dist/render/sgr.js +191 -0
- package/dist/render/sgr.js.map +1 -0
- package/dist/render/strip.d.ts +24 -0
- package/dist/render/strip.d.ts.map +1 -0
- package/dist/render/strip.js +81 -0
- package/dist/render/strip.js.map +1 -0
- package/dist/render/width.d.ts +30 -0
- package/dist/render/width.d.ts.map +1 -0
- package/dist/render/width.js +149 -0
- package/dist/render/width.js.map +1 -0
- package/dist/shortcuts.d.ts +76 -0
- package/dist/shortcuts.d.ts.map +1 -0
- package/dist/shortcuts.js +117 -0
- package/dist/shortcuts.js.map +1 -0
- package/dist/styles.d.ts +43 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +44 -0
- package/dist/styles.js.map +1 -0
- package/dist/symbols.d.ts +19 -0
- package/dist/symbols.d.ts.map +1 -0
- package/dist/symbols.js +21 -0
- package/dist/symbols.js.map +1 -0
- package/dist/test/compare.d.ts +28 -0
- package/dist/test/compare.d.ts.map +1 -0
- package/dist/test/compare.js +37 -0
- package/dist/test/compare.js.map +1 -0
- package/dist/test/index.d.ts +16 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +14 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/mock.d.ts +50 -0
- package/dist/test/mock.d.ts.map +1 -0
- package/dist/test/mock.js +135 -0
- package/dist/test/mock.js.map +1 -0
- package/dist/test/render.d.ts +29 -0
- package/dist/test/render.d.ts.map +1 -0
- package/dist/test/render.js +87 -0
- package/dist/test/render.js.map +1 -0
- package/dist/test/snapshot.d.ts +16 -0
- package/dist/test/snapshot.d.ts.map +1 -0
- package/dist/test/snapshot.js +216 -0
- package/dist/test/snapshot.js.map +1 -0
- package/dist/theme/builtins.d.ts +10 -0
- package/dist/theme/builtins.d.ts.map +1 -0
- package/dist/theme/builtins.js +102 -0
- package/dist/theme/builtins.js.map +1 -0
- package/dist/theme/engine.d.ts +51 -0
- package/dist/theme/engine.d.ts.map +1 -0
- package/dist/theme/engine.js +123 -0
- package/dist/theme/engine.js.map +1 -0
- package/dist/theme/index.d.ts +10 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +12 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/merge.d.ts +24 -0
- package/dist/theme/merge.d.ts.map +1 -0
- package/dist/theme/merge.js +66 -0
- package/dist/theme/merge.js.map +1 -0
- package/dist/theme/types.d.ts +44 -0
- package/dist/theme/types.d.ts.map +1 -0
- package/dist/theme/types.js +8 -0
- package/dist/theme/types.js.map +1 -0
- package/dist/theme.d.ts +9 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +53 -0
- package/dist/theme.js.map +1 -0
- package/dist/tokens/defaults.d.ts +13 -0
- package/dist/tokens/defaults.d.ts.map +1 -0
- package/dist/tokens/defaults.js +248 -0
- package/dist/tokens/defaults.js.map +1 -0
- package/dist/tokens/index.d.ts +10 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/index.js +10 -0
- package/dist/tokens/index.js.map +1 -0
- package/dist/tokens/resolver.d.ts +100 -0
- package/dist/tokens/resolver.d.ts.map +1 -0
- package/dist/tokens/resolver.js +138 -0
- package/dist/tokens/resolver.js.map +1 -0
- package/dist/tokens/types.d.ts +265 -0
- package/dist/tokens/types.d.ts.map +1 -0
- package/dist/tokens/types.js +10 -0
- package/dist/tokens/types.js.map +1 -0
- package/dist/tokens.d.ts +26 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +30 -0
- package/dist/tokens.js.map +1 -0
- package/dist/types.d.ts +38 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hyper Theme — HyperDev CLI brand theme
|
|
3
|
+
*
|
|
4
|
+
* Encodes all of HyperDev's visual opinions as a DS theme object.
|
|
5
|
+
*/
|
|
6
|
+
export const hyperTheme = {
|
|
7
|
+
name: "hyper",
|
|
8
|
+
meta: { description: "HyperDev CLI brand theme" },
|
|
9
|
+
color: {
|
|
10
|
+
// Map Hyper's palette to DS token roles
|
|
11
|
+
code: { ansi16: "cyan", ansi256: 37, truecolor: "#4EC9B0" },
|
|
12
|
+
error: { ansi16: "red", ansi256: 196, truecolor: "#f87171" },
|
|
13
|
+
warning: { ansi16: "yellow", ansi256: 214, truecolor: "#fbbf24" },
|
|
14
|
+
success: { ansi16: "green", ansi256: 34, truecolor: "#4ade80" },
|
|
15
|
+
info: { ansi16: "blue", ansi256: 33, truecolor: "#60a5fa" },
|
|
16
|
+
accent: { ansi16: "blue", ansi256: 33, truecolor: "#60a5fa" },
|
|
17
|
+
},
|
|
18
|
+
symbol: {
|
|
19
|
+
// Match current UI symbols exactly
|
|
20
|
+
error: { unicode: "\u00d7", ascii: "[FAIL]" },
|
|
21
|
+
warning: { unicode: "\u25b2", ascii: "[WARN]" },
|
|
22
|
+
success: { unicode: "\u2714", ascii: "[OK]" },
|
|
23
|
+
info: { unicode: "\u25cf", ascii: "[INFO]" },
|
|
24
|
+
tip: { unicode: "\u25c6", ascii: "[TIP]" },
|
|
25
|
+
},
|
|
26
|
+
space: {
|
|
27
|
+
iconGap: 1,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=hyper-theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyper-theme.js","sourceRoot":"","sources":["../src/hyper-theme.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,CAAC,MAAM,UAAU,GAAU;IAChC,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,EAAE,WAAW,EAAE,0BAA0B,EAAE;IACjD,KAAK,EAAE;QACN,wCAAwC;QACxC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE;QAC3D,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE;QAC5D,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE;QACjE,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE;QAC/D,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE;QAC3D,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE;KAC7D;IACD,MAAM,EAAE;QACP,mCAAmC;QACnC,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;QAC7C,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;QAC/C,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE;QAC7C,IAAI,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;QAC5C,GAAG,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE;KAC1C;IACD,KAAK,EAAE;QACN,OAAO,EAAE,CAAC;KACV;CACD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hypercli/ui — CLI Design System for HyperDev
|
|
3
|
+
*
|
|
4
|
+
* Two consumption modes:
|
|
5
|
+
* 1. Full DS API: `import { createSystem, styledText, message } from '@hypercli/ui'`
|
|
6
|
+
* 2. Quick shortcuts: `import { c, s, msg, md } from '@hypercli/ui/shortcuts'`
|
|
7
|
+
* 3. Markdown rendering: `import { markdown } from '@hypercli/ui'`
|
|
8
|
+
*/
|
|
9
|
+
export { createSystem } from "./ds-index.ts";
|
|
10
|
+
export type { SystemOptions, DesignSystem } from "./ds-index.ts";
|
|
11
|
+
export { styledText, symbol, pad, truncate, align, line, stack, indent, wrap, border, divider, badge, markdown, defaultMarkdownTheme, } from "./primitives/index.ts";
|
|
12
|
+
export { message, statusList, table, list, tree, keyValue, diff, panel, columns, section, helpLayout, } from "./components/index.ts";
|
|
13
|
+
export { spinner, progressBar, } from "./components/index.ts";
|
|
14
|
+
export type { TerminalCapabilities, ColorDepth } from "./capabilities/index.ts";
|
|
15
|
+
export { createCapabilities } from "./capabilities/index.ts";
|
|
16
|
+
export type { Theme, ThemeInput, BuiltinThemeName } from "./theme/index.ts";
|
|
17
|
+
export type { ResolvedTokens } from "./tokens/index.ts";
|
|
18
|
+
export type { StyleSpec } from "./render/index.ts";
|
|
19
|
+
export { stripAnsi, stringWidth } from "./render/index.ts";
|
|
20
|
+
export { getContext, setContext, createContext } from "./primitives/index.ts";
|
|
21
|
+
export type { SystemContext } from "./primitives/index.ts";
|
|
22
|
+
export type { MessageOptions } from "./components/index.ts";
|
|
23
|
+
export type { StatusListItem } from "./components/index.ts";
|
|
24
|
+
export type { TableColumn, TableOptions } from "./components/index.ts";
|
|
25
|
+
export type { ListItem, ListOptions } from "./components/index.ts";
|
|
26
|
+
export type { TreeNode, TreeOptions } from "./components/index.ts";
|
|
27
|
+
export type { KeyValueEntry, KeyValueOptions } from "./components/index.ts";
|
|
28
|
+
export type { DiffLine, DiffHunk, DiffOptions } from "./components/index.ts";
|
|
29
|
+
export type { PanelOptions } from "./components/index.ts";
|
|
30
|
+
export type { ColumnDef, ColumnsOptions } from "./components/index.ts";
|
|
31
|
+
export type { SectionOptions } from "./components/index.ts";
|
|
32
|
+
export type { HelpLayoutOptions } from "./components/index.ts";
|
|
33
|
+
export type { SpinnerOptions, SpinnerHandle } from "./components/index.ts";
|
|
34
|
+
export type { ProgressBarOptions, ProgressBarHandle } from "./components/index.ts";
|
|
35
|
+
export type { StyledTextOptions } from "./primitives/index.ts";
|
|
36
|
+
export type { PadOptions } from "./primitives/index.ts";
|
|
37
|
+
export type { TruncateOptions } from "./primitives/index.ts";
|
|
38
|
+
export type { AlignOptions } from "./primitives/index.ts";
|
|
39
|
+
export type { LinePart } from "./primitives/index.ts";
|
|
40
|
+
export type { StackOptions } from "./primitives/index.ts";
|
|
41
|
+
export type { WrapOptions } from "./primitives/index.ts";
|
|
42
|
+
export type { BorderOptions } from "./primitives/index.ts";
|
|
43
|
+
export type { DividerOptions } from "./primitives/index.ts";
|
|
44
|
+
export type { BadgeOptions } from "./primitives/index.ts";
|
|
45
|
+
export { hyperTheme } from "./hyper-theme.ts";
|
|
46
|
+
export { c, s, msg, md } from "./shortcuts.ts";
|
|
47
|
+
export type { MarkdownTheme, MarkdownOptions, HeadingStyle } from "./primitives/index.ts";
|
|
48
|
+
export { renderHelp, renderMarkdown, helpTheme } from "./help.ts";
|
|
49
|
+
export type { HelpThemeConfig } from "./help.ts";
|
|
50
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiBH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGjE,OAAO,EACN,UAAU,EACV,MAAM,EACN,GAAG,EACH,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,KAAK,EACL,MAAM,EACN,IAAI,EACJ,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,oBAAoB,GACpB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACN,OAAO,EACP,UAAU,EACV,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EACP,UAAU,GACV,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACN,OAAO,EACP,WAAW,GACX,MAAM,uBAAuB,CAAC;AAG/B,YAAY,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG7D,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAG5E,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,YAAY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,YAAY,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAM1D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAG/C,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG1F,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAClE,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hypercli/ui — CLI Design System for HyperDev
|
|
3
|
+
*
|
|
4
|
+
* Two consumption modes:
|
|
5
|
+
* 1. Full DS API: `import { createSystem, styledText, message } from '@hypercli/ui'`
|
|
6
|
+
* 2. Quick shortcuts: `import { c, s, msg, md } from '@hypercli/ui/shortcuts'`
|
|
7
|
+
* 3. Markdown rendering: `import { markdown } from '@hypercli/ui'`
|
|
8
|
+
*/
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Auto-initialize the design system with Hyper's brand theme
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
import { createSystem } from "./ds-index.js";
|
|
13
|
+
import { hyperTheme } from "./hyper-theme.js";
|
|
14
|
+
// Initialize on import — sets the global context so standalone functions work
|
|
15
|
+
createSystem({ theme: hyperTheme });
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Re-export everything from the DS core
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
// Core factory
|
|
20
|
+
export { createSystem } from "./ds-index.js";
|
|
21
|
+
// Primitives
|
|
22
|
+
export { styledText, symbol, pad, truncate, align, line, stack, indent, wrap, border, divider, badge, markdown, defaultMarkdownTheme, } from "./primitives/index.js";
|
|
23
|
+
// Components (static) — excluding prompt components
|
|
24
|
+
export { message, statusList, table, list, tree, keyValue, diff, panel, columns, section, helpLayout, } from "./components/index.js";
|
|
25
|
+
// Interactive components (excluding prompts — those stay with clack)
|
|
26
|
+
export { spinner, progressBar, } from "./components/index.js";
|
|
27
|
+
export { createCapabilities } from "./capabilities/index.js";
|
|
28
|
+
export { stripAnsi, stringWidth } from "./render/index.js";
|
|
29
|
+
// Context
|
|
30
|
+
export { getContext, setContext, createContext } from "./primitives/index.js";
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Hyper-specific exports
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
export { hyperTheme } from "./hyper-theme.js";
|
|
35
|
+
// Convenience: re-export shortcuts at top level for backwards compat
|
|
36
|
+
export { c, s, msg, md } from "./shortcuts.js";
|
|
37
|
+
// Help system (convenience re-exports)
|
|
38
|
+
export { renderHelp, renderMarkdown, helpTheme } from "./help.js";
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,8EAA8E;AAC9E,6DAA6D;AAC7D,8EAA8E;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,8EAA8E;AAC9E,YAAY,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;AAEpC,8EAA8E;AAC9E,wCAAwC;AACxC,8EAA8E;AAE9E,eAAe;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,aAAa;AACb,OAAO,EACN,UAAU,EACV,MAAM,EACN,GAAG,EACH,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,KAAK,EACL,MAAM,EACN,IAAI,EACJ,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,oBAAoB,GACpB,MAAM,uBAAuB,CAAC;AAE/B,oDAAoD;AACpD,OAAO,EACN,OAAO,EACP,UAAU,EACV,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EACP,UAAU,GACV,MAAM,uBAAuB,CAAC;AAE/B,qEAAqE;AACrE,OAAO,EACN,OAAO,EACP,WAAW,GACX,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAU7D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE3D,UAAU;AACV,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AA8B9E,8EAA8E;AAC9E,yBAAyB;AACzB,8EAA8E;AAE9E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,qEAAqE;AACrE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAK/C,uCAAuC;AACvC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/md.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline markdown processor for CLI strings.
|
|
3
|
+
*
|
|
4
|
+
* Transforms a subset of markdown into chalk-styled terminal output:
|
|
5
|
+
* - `code` → command color (palette.brand)
|
|
6
|
+
* - **bold** → chalk.bold
|
|
7
|
+
* - *dim* → chalk.dim
|
|
8
|
+
*
|
|
9
|
+
* Opt-in only — not auto-applied to other functions.
|
|
10
|
+
*/
|
|
11
|
+
export declare function md(text: string): string;
|
|
12
|
+
//# sourceMappingURL=md.d.ts.map
|
package/dist/md.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"md.d.ts","sourceRoot":"","sources":["../src/md.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,wBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKvC"}
|
package/dist/md.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline markdown processor for CLI strings.
|
|
3
|
+
*
|
|
4
|
+
* Transforms a subset of markdown into chalk-styled terminal output:
|
|
5
|
+
* - `code` → command color (palette.brand)
|
|
6
|
+
* - **bold** → chalk.bold
|
|
7
|
+
* - *dim* → chalk.dim
|
|
8
|
+
*
|
|
9
|
+
* Opt-in only — not auto-applied to other functions.
|
|
10
|
+
*/
|
|
11
|
+
import chalk from "chalk";
|
|
12
|
+
import { palette } from "./palette.js";
|
|
13
|
+
export function md(text) {
|
|
14
|
+
return text
|
|
15
|
+
.replace(/`([^`]+)`/g, (_, code) => chalk.hex(palette.brand)(code))
|
|
16
|
+
.replace(/\*\*([^*]+)\*\*/g, (_, bold) => chalk.bold(bold))
|
|
17
|
+
.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g, (_, dim) => chalk.dim(dim));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=md.js.map
|
package/dist/md.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"md.js","sourceRoot":"","sources":["../src/md.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,UAAU,EAAE,CAAC,IAAY;IAC9B,OAAO,IAAI;SACT,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;SAClE,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC1D,OAAO,CAAC,2BAA2B,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured message blocks — the `msg` namespace.
|
|
3
|
+
*
|
|
4
|
+
* Produces formatted multi-line messages with icons, bars, and indentation.
|
|
5
|
+
* Supports both props objects and simple string shorthand.
|
|
6
|
+
*/
|
|
7
|
+
interface MessageProps {
|
|
8
|
+
title?: string;
|
|
9
|
+
summary: string;
|
|
10
|
+
body?: string | string[];
|
|
11
|
+
}
|
|
12
|
+
export declare const msg: {
|
|
13
|
+
error: (input: string | MessageProps) => string;
|
|
14
|
+
warning: (input: string | MessageProps) => string;
|
|
15
|
+
success: (input: string | MessageProps) => string;
|
|
16
|
+
info: (input: string | MessageProps) => string;
|
|
17
|
+
tip: (input: string | MessageProps) => string;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,UAAU,YAAY;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB;AAwDD,eAAO,MAAM,GAAG;mBANA,MAAM,GAAG,YAAY,KAAG,MAAM;qBAA9B,MAAM,GAAG,YAAY,KAAG,MAAM;qBAA9B,MAAM,GAAG,YAAY,KAAG,MAAM;kBAA9B,MAAM,GAAG,YAAY,KAAG,MAAM;iBAA9B,MAAM,GAAG,YAAY,KAAG,MAAM;CAY7C,CAAC"}
|
package/dist/messages.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured message blocks — the `msg` namespace.
|
|
3
|
+
*
|
|
4
|
+
* Produces formatted multi-line messages with icons, bars, and indentation.
|
|
5
|
+
* Supports both props objects and simple string shorthand.
|
|
6
|
+
*/
|
|
7
|
+
import chalk from "chalk";
|
|
8
|
+
import { md } from "./md.js";
|
|
9
|
+
import { symbols } from "./symbols.js";
|
|
10
|
+
import { tokens } from "./tokens.js";
|
|
11
|
+
const INDENT = " ";
|
|
12
|
+
const ICON_GAP = " ";
|
|
13
|
+
const types = {
|
|
14
|
+
error: { prefix: "Error:", icon: symbols.error, color: chalk.red },
|
|
15
|
+
warning: { prefix: "Warning:", icon: symbols.warning, color: chalk.yellow },
|
|
16
|
+
success: { prefix: "Success:", icon: symbols.success, color: chalk.green },
|
|
17
|
+
info: { prefix: "Info:", icon: symbols.info, color: chalk.blue },
|
|
18
|
+
tip: { prefix: "Tip:", icon: symbols.tip, color: chalk.hex(tokens.tip) },
|
|
19
|
+
};
|
|
20
|
+
function formatMessage(type, props) {
|
|
21
|
+
const { prefix, icon, color } = types[type];
|
|
22
|
+
const { title, summary, body } = props;
|
|
23
|
+
const lines = [];
|
|
24
|
+
// Don't add leading indent for tip messages
|
|
25
|
+
const leadingIndent = type === "tip" ? "" : INDENT;
|
|
26
|
+
const contentIndent = type === "tip" ? INDENT : `${INDENT}${INDENT}`;
|
|
27
|
+
const styledSummary = md(summary);
|
|
28
|
+
if (!title) {
|
|
29
|
+
// summary-only: just icon + summary
|
|
30
|
+
lines.push(`${leadingIndent}${color(icon)}${ICON_GAP}${styledSummary}`);
|
|
31
|
+
}
|
|
32
|
+
else if (!body) {
|
|
33
|
+
// title + summary
|
|
34
|
+
lines.push(`${leadingIndent}${color(prefix)} ${title}`);
|
|
35
|
+
lines.push("");
|
|
36
|
+
lines.push(`${contentIndent}${color(icon)}${ICON_GAP}${styledSummary}`);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
// title + summary + body
|
|
40
|
+
const bodyLines = Array.isArray(body) ? body : body.split("\n");
|
|
41
|
+
lines.push(`${leadingIndent}${color(prefix)} ${title}`);
|
|
42
|
+
lines.push("");
|
|
43
|
+
lines.push(`${contentIndent}${color(icon)}${ICON_GAP}${styledSummary}`);
|
|
44
|
+
lines.push(`${contentIndent}${color(symbols.bar)}`);
|
|
45
|
+
for (const bodyLine of bodyLines) {
|
|
46
|
+
lines.push(`${contentIndent}${color(symbols.bar)}${ICON_GAP}${chalk.dim(bodyLine)}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
lines.push("");
|
|
50
|
+
return lines.join("\n");
|
|
51
|
+
}
|
|
52
|
+
function makeMessageFn(type) {
|
|
53
|
+
return (input) => {
|
|
54
|
+
const props = typeof input === "string" ? { summary: input } : input;
|
|
55
|
+
return formatMessage(type, props);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export const msg = {
|
|
59
|
+
error: makeMessageFn("error"),
|
|
60
|
+
warning: makeMessageFn("warning"),
|
|
61
|
+
success: makeMessageFn("success"),
|
|
62
|
+
info: makeMessageFn("info"),
|
|
63
|
+
tip: makeMessageFn("tip"),
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,EAAE,EAA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Q,IAAI,SAAS,EAAE,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,GAAG,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACtF,CAAC;IACF,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,aAAa,CAAC,IAAY;IAClC,OAAO,CAAC,KAA4B,EAAU,EAAE;QAC/C,MAAM,KAAK,GAAiB,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QACnF,OAAO,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,GAAG,GAAG;IAClB,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC;IAC7B,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC;IACjC,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC;IACjC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC;IAC3B,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC;CACzB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raw color values — single source of truth for the HyperDev CLI palette.
|
|
3
|
+
*
|
|
4
|
+
* All hex values and terminal color names live here.
|
|
5
|
+
* No chalk imports, no logic — just constants.
|
|
6
|
+
*/
|
|
7
|
+
export declare const palette: {
|
|
8
|
+
readonly brand: "#4EC9B0";
|
|
9
|
+
readonly danger: "#F67280";
|
|
10
|
+
readonly tipBlue: "#7FB3D5";
|
|
11
|
+
readonly red: "red";
|
|
12
|
+
readonly green: "green";
|
|
13
|
+
readonly yellow: "yellow";
|
|
14
|
+
readonly blue: "blue";
|
|
15
|
+
readonly magenta: "magenta";
|
|
16
|
+
readonly cyan: "cyan";
|
|
17
|
+
readonly gray: "gray";
|
|
18
|
+
readonly white: "white";
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=palette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../src/palette.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO;;;;;;;;;;;;CAeV,CAAC"}
|
package/dist/palette.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raw color values — single source of truth for the HyperDev CLI palette.
|
|
3
|
+
*
|
|
4
|
+
* All hex values and terminal color names live here.
|
|
5
|
+
* No chalk imports, no logic — just constants.
|
|
6
|
+
*/
|
|
7
|
+
export const palette = {
|
|
8
|
+
// Brand colors (hex)
|
|
9
|
+
brand: "#4EC9B0", // teal — commands, code
|
|
10
|
+
danger: "#F67280", // coral — destructive actions
|
|
11
|
+
tipBlue: "#7FB3D5", // pastel blue — tips
|
|
12
|
+
// Terminal builtins (named for chalk compatibility)
|
|
13
|
+
red: "red",
|
|
14
|
+
green: "green",
|
|
15
|
+
yellow: "yellow",
|
|
16
|
+
blue: "blue",
|
|
17
|
+
magenta: "magenta",
|
|
18
|
+
cyan: "cyan",
|
|
19
|
+
gray: "gray",
|
|
20
|
+
white: "white",
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=palette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.js","sourceRoot":"","sources":["../src/palette.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG;IACtB,qBAAqB;IACrB,KAAK,EAAE,SAAS,EAAE,wBAAwB;IAC1C,MAAM,EAAE,SAAS,EAAE,8BAA8B;IACjD,OAAO,EAAE,SAAS,EAAE,qBAAqB;IAEzC,oDAAoD;IACpD,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;CACL,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* align Primitive
|
|
3
|
+
*
|
|
4
|
+
* Aligns text within a given width using left, right, or center alignment.
|
|
5
|
+
* Supports a custom fill character.
|
|
6
|
+
*/
|
|
7
|
+
/** Options for aligning text within a fixed width. */
|
|
8
|
+
export type AlignOptions = {
|
|
9
|
+
/** Horizontal alignment direction. Defaults to `'left'`. */
|
|
10
|
+
alignment?: "left" | "right" | "center";
|
|
11
|
+
/** Character used to fill remaining space. Defaults to `' '`. */
|
|
12
|
+
fill?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Aligns text within a fixed column width, padding with a fill character.
|
|
16
|
+
*
|
|
17
|
+
* @param text - The text to align.
|
|
18
|
+
* @param width - The total column width to align within.
|
|
19
|
+
* @param options - Alignment configuration.
|
|
20
|
+
* @returns The aligned text string padded to the specified width.
|
|
21
|
+
*/
|
|
22
|
+
export declare function align(text: string, width: number, options?: AlignOptions): string;
|
|
23
|
+
//# sourceMappingURL=align.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"align.d.ts","sourceRoot":"","sources":["../../src/primitives/align.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,sDAAsD;AACtD,MAAM,MAAM,YAAY,GAAG;IAC1B,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IACxC,iEAAiE;IACjE,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,CA0BjF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* align Primitive
|
|
3
|
+
*
|
|
4
|
+
* Aligns text within a given width using left, right, or center alignment.
|
|
5
|
+
* Supports a custom fill character.
|
|
6
|
+
*/
|
|
7
|
+
import { ansiPad, stringWidth } from "../render/index.js";
|
|
8
|
+
/**
|
|
9
|
+
* Aligns text within a fixed column width, padding with a fill character.
|
|
10
|
+
*
|
|
11
|
+
* @param text - The text to align.
|
|
12
|
+
* @param width - The total column width to align within.
|
|
13
|
+
* @param options - Alignment configuration.
|
|
14
|
+
* @returns The aligned text string padded to the specified width.
|
|
15
|
+
*/
|
|
16
|
+
export function align(text, width, options) {
|
|
17
|
+
const alignment = options?.alignment ?? "left";
|
|
18
|
+
const fill = options?.fill;
|
|
19
|
+
// Default space fill: delegate to ansiPad
|
|
20
|
+
if (!fill || fill === " ") {
|
|
21
|
+
return ansiPad(text, width, alignment);
|
|
22
|
+
}
|
|
23
|
+
// Custom fill character: implement manually
|
|
24
|
+
const currentWidth = stringWidth(text);
|
|
25
|
+
if (currentWidth >= width)
|
|
26
|
+
return text;
|
|
27
|
+
const padding = width - currentWidth;
|
|
28
|
+
switch (alignment) {
|
|
29
|
+
case "right":
|
|
30
|
+
return fill.repeat(padding) + text;
|
|
31
|
+
case "center": {
|
|
32
|
+
const left = Math.floor(padding / 2);
|
|
33
|
+
const right = padding - left;
|
|
34
|
+
return fill.repeat(left) + text + fill.repeat(right);
|
|
35
|
+
}
|
|
36
|
+
default:
|
|
37
|
+
return text + fill.repeat(padding);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=align.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"align.js","sourceRoot":"","sources":["../../src/primitives/align.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAU1D;;;;;;;GAOG;AACH,MAAM,UAAU,KAAK,CAAC,IAAY,EAAE,KAAa,EAAE,OAAsB;IACxE,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,MAAM,CAAC;IAC/C,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,CAAC;IAE3B,0CAA0C;IAC1C,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;QAC3B,OAAO,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACxC,CAAC;IAED,4CAA4C;IAC5C,MAAM,YAAY,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,YAAY,IAAI,KAAK;QAAE,OAAO,IAAI,CAAC;IAEvC,MAAM,OAAO,GAAG,KAAK,GAAG,YAAY,CAAC;IAErC,QAAQ,SAAS,EAAE,CAAC;QACnB,KAAK,OAAO;YACX,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;QACpC,KAAK,QAAQ,CAAC,CAAC,CAAC;YACf,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;YACrC,MAAM,KAAK,GAAG,OAAO,GAAG,IAAI,CAAC;YAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtD,CAAC;QACD;YACC,OAAO,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* badge Primitive
|
|
3
|
+
*
|
|
4
|
+
* Renders a short label with a background color badge style.
|
|
5
|
+
* Falls back to [TEXT] brackets when color is unavailable.
|
|
6
|
+
*/
|
|
7
|
+
import type { ColorTokens } from "../tokens/index.ts";
|
|
8
|
+
/** Options for rendering a badge label. */
|
|
9
|
+
export type BadgeOptions = {
|
|
10
|
+
/** Background color token name. Defaults to `'bgInfo'`. */
|
|
11
|
+
color?: keyof ColorTokens;
|
|
12
|
+
/** Foreground (text) color token name. Uses the terminal default when omitted. */
|
|
13
|
+
textColor?: keyof ColorTokens;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Renders a short label as a colored badge.
|
|
17
|
+
* Falls back to `[text]` brackets on dumb or no-color terminals.
|
|
18
|
+
*
|
|
19
|
+
* @param text - The label text to display.
|
|
20
|
+
* @param options - Badge color configuration.
|
|
21
|
+
* @returns The styled badge string.
|
|
22
|
+
*/
|
|
23
|
+
export declare function badge(text: string, options?: BadgeOptions): string;
|
|
24
|
+
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/primitives/badge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,2CAA2C;AAC3C,MAAM,MAAM,YAAY,GAAG;IAC1B,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,WAAW,CAAC;IAC1B,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,WAAW,CAAC;CAC9B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,CA6BlE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* badge Primitive
|
|
3
|
+
*
|
|
4
|
+
* Renders a short label with a background color badge style.
|
|
5
|
+
* Falls back to [TEXT] brackets when color is unavailable.
|
|
6
|
+
*/
|
|
7
|
+
import { applyStyle } from "../render/index.js";
|
|
8
|
+
import { getContext } from "./context.js";
|
|
9
|
+
/**
|
|
10
|
+
* Renders a short label as a colored badge.
|
|
11
|
+
* Falls back to `[text]` brackets on dumb or no-color terminals.
|
|
12
|
+
*
|
|
13
|
+
* @param text - The label text to display.
|
|
14
|
+
* @param options - Badge color configuration.
|
|
15
|
+
* @returns The styled badge string.
|
|
16
|
+
*/
|
|
17
|
+
export function badge(text, options) {
|
|
18
|
+
const ctx = getContext();
|
|
19
|
+
// Dumb terminal: plain brackets
|
|
20
|
+
if (ctx.capabilities.isDumb) {
|
|
21
|
+
return `[${text}]`;
|
|
22
|
+
}
|
|
23
|
+
// No color support: brackets
|
|
24
|
+
if (ctx.capabilities.noColor || ctx.capabilities.colorDepth === "none") {
|
|
25
|
+
return `[${text}]`;
|
|
26
|
+
}
|
|
27
|
+
const bgTokenName = options?.color ?? "bgInfo";
|
|
28
|
+
const bgColor = ctx.tokens.color[bgTokenName];
|
|
29
|
+
const fgTokenName = options?.textColor;
|
|
30
|
+
const fgColor = fgTokenName ? ctx.tokens.color[fgTokenName] : null;
|
|
31
|
+
const spec = {
|
|
32
|
+
bg: bgColor,
|
|
33
|
+
};
|
|
34
|
+
if (fgColor) {
|
|
35
|
+
spec.color = fgColor;
|
|
36
|
+
}
|
|
37
|
+
// Pad with single space each side
|
|
38
|
+
return applyStyle(` ${text} `, spec);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.js","sourceRoot":"","sources":["../../src/primitives/badge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAU1C;;;;;;;GAOG;AACH,MAAM,UAAU,KAAK,CAAC,IAAY,EAAE,OAAsB;IACzD,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;IAEzB,gCAAgC;IAChC,IAAI,GAAG,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;QAC7B,OAAO,IAAI,IAAI,GAAG,CAAC;IACpB,CAAC;IAED,6BAA6B;IAC7B,IAAI,GAAG,CAAC,YAAY,CAAC,OAAO,IAAI,GAAG,CAAC,YAAY,CAAC,UAAU,KAAK,MAAM,EAAE,CAAC;QACxE,OAAO,IAAI,IAAI,GAAG,CAAC;IACpB,CAAC;IAED,MAAM,WAAW,GAAG,OAAO,EAAE,KAAK,IAAI,QAAQ,CAAC;IAC/C,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAE9C,MAAM,WAAW,GAAG,OAAO,EAAE,SAAS,CAAC;IACvC,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAEnE,MAAM,IAAI,GAAc;QACvB,EAAE,EAAE,OAAO;KACX,CAAC;IAEF,IAAI,OAAO,EAAE,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC;IACtB,CAAC;IAED,kCAAkC;IAClC,OAAO,UAAU,CAAC,IAAI,IAAI,GAAG,EAAE,IAAI,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* border Primitive
|
|
3
|
+
*
|
|
4
|
+
* Draws a box around content using resolved border character sets.
|
|
5
|
+
* Supports titles, configurable padding, and explicit or auto width.
|
|
6
|
+
*/
|
|
7
|
+
import type { BorderStyleName } from "../tokens/index.ts";
|
|
8
|
+
/** Options for rendering a border box around content. */
|
|
9
|
+
export type BorderOptions = {
|
|
10
|
+
/** Border character style name. Falls back to `'ascii'` when unicode is unavailable. */
|
|
11
|
+
style?: BorderStyleName;
|
|
12
|
+
/** Title text displayed in the top border. */
|
|
13
|
+
title?: string;
|
|
14
|
+
/** Alignment of the title within the top border. Defaults to `'left'`. */
|
|
15
|
+
titleAlign?: "left" | "center" | "right";
|
|
16
|
+
/** Number of horizontal padding characters inside the border on each side. Defaults to `1`. */
|
|
17
|
+
padding?: number;
|
|
18
|
+
/** Total box width including borders, or `'auto'` to fit content. Defaults to `'auto'`. */
|
|
19
|
+
width?: number | "auto";
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Draws a box border around content lines.
|
|
23
|
+
*
|
|
24
|
+
* @param content - A string (split on newlines) or array of lines to enclose.
|
|
25
|
+
* @param options - Border configuration.
|
|
26
|
+
* @returns The bordered content as a multi-line string.
|
|
27
|
+
*/
|
|
28
|
+
export declare function border(content: string | string[], options?: BorderOptions): string;
|
|
29
|
+
//# sourceMappingURL=border.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"border.d.ts","sourceRoot":"","sources":["../../src/primitives/border.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,yDAAyD;AACzD,MAAM,MAAM,aAAa,GAAG;IAC3B,wFAAwF;IACxF,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IACzC,+FAA+F;IAC/F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2FAA2F;IAC3F,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAqFlF"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* border Primitive
|
|
3
|
+
*
|
|
4
|
+
* Draws a box around content using resolved border character sets.
|
|
5
|
+
* Supports titles, configurable padding, and explicit or auto width.
|
|
6
|
+
*/
|
|
7
|
+
import { ansiPad, stringWidth } from "../render/index.js";
|
|
8
|
+
import { getContext } from "./context.js";
|
|
9
|
+
/**
|
|
10
|
+
* Draws a box border around content lines.
|
|
11
|
+
*
|
|
12
|
+
* @param content - A string (split on newlines) or array of lines to enclose.
|
|
13
|
+
* @param options - Border configuration.
|
|
14
|
+
* @returns The bordered content as a multi-line string.
|
|
15
|
+
*/
|
|
16
|
+
export function border(content, options) {
|
|
17
|
+
const ctx = getContext();
|
|
18
|
+
const paddingSize = options?.padding ?? 1;
|
|
19
|
+
const titleAlign = options?.titleAlign ?? "left";
|
|
20
|
+
// Resolve border character set
|
|
21
|
+
let chars = ctx.tokens.border.chars;
|
|
22
|
+
if (options?.style) {
|
|
23
|
+
// If not unicode capable, force ascii
|
|
24
|
+
const effectiveStyle = ctx.capabilities.unicode ? options.style : "ascii";
|
|
25
|
+
chars = ctx.tokens.border.styles[effectiveStyle];
|
|
26
|
+
}
|
|
27
|
+
else if (!ctx.capabilities.unicode) {
|
|
28
|
+
chars = ctx.tokens.border.styles.ascii;
|
|
29
|
+
}
|
|
30
|
+
const lines = Array.isArray(content) ? content : content.split("\n");
|
|
31
|
+
const paddingStr = " ".repeat(paddingSize);
|
|
32
|
+
// Calculate inner width (content area between vertical bars, including padding)
|
|
33
|
+
let innerWidth;
|
|
34
|
+
if (options?.width && options.width !== "auto") {
|
|
35
|
+
// Explicit width is the total box width including borders
|
|
36
|
+
// innerWidth = totalWidth - 2 (for vertical bars)
|
|
37
|
+
innerWidth = options.width - 2;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
// Auto: find the widest line
|
|
41
|
+
let maxLineWidth = 0;
|
|
42
|
+
for (const line of lines) {
|
|
43
|
+
const w = stringWidth(line);
|
|
44
|
+
if (w > maxLineWidth)
|
|
45
|
+
maxLineWidth = w;
|
|
46
|
+
}
|
|
47
|
+
innerWidth = maxLineWidth + paddingSize * 2;
|
|
48
|
+
}
|
|
49
|
+
// Content width is innerWidth minus padding on both sides
|
|
50
|
+
const contentWidth = innerWidth - paddingSize * 2;
|
|
51
|
+
// Build top border
|
|
52
|
+
let topLine;
|
|
53
|
+
if (options?.title) {
|
|
54
|
+
const title = ` ${options.title} `;
|
|
55
|
+
const titleWidth = stringWidth(title);
|
|
56
|
+
const available = innerWidth - titleWidth;
|
|
57
|
+
if (available <= 0) {
|
|
58
|
+
topLine = chars.topLeft + title.slice(0, innerWidth) + chars.topRight;
|
|
59
|
+
}
|
|
60
|
+
else if (titleAlign === "left") {
|
|
61
|
+
topLine =
|
|
62
|
+
chars.topLeft +
|
|
63
|
+
chars.horizontal +
|
|
64
|
+
title +
|
|
65
|
+
chars.horizontal.repeat(available - 1) +
|
|
66
|
+
chars.topRight;
|
|
67
|
+
}
|
|
68
|
+
else if (titleAlign === "right") {
|
|
69
|
+
topLine =
|
|
70
|
+
chars.topLeft +
|
|
71
|
+
chars.horizontal.repeat(available - 1) +
|
|
72
|
+
title +
|
|
73
|
+
chars.horizontal +
|
|
74
|
+
chars.topRight;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
// center
|
|
78
|
+
const left = Math.floor(available / 2);
|
|
79
|
+
const right = available - left;
|
|
80
|
+
topLine =
|
|
81
|
+
chars.topLeft +
|
|
82
|
+
chars.horizontal.repeat(left) +
|
|
83
|
+
title +
|
|
84
|
+
chars.horizontal.repeat(right) +
|
|
85
|
+
chars.topRight;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
topLine = chars.topLeft + chars.horizontal.repeat(innerWidth) + chars.topRight;
|
|
90
|
+
}
|
|
91
|
+
// Build bottom border
|
|
92
|
+
const bottomLine = chars.bottomLeft + chars.horizontal.repeat(innerWidth) + chars.bottomRight;
|
|
93
|
+
// Build content lines
|
|
94
|
+
const contentLines = lines.map((line) => {
|
|
95
|
+
const padded = ansiPad(line, contentWidth);
|
|
96
|
+
return chars.vertical + paddingStr + padded + paddingStr + chars.vertical;
|
|
97
|
+
});
|
|
98
|
+
return [topLine, ...contentLines, bottomLine].join("\n");
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=border.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"border.js","sourceRoot":"","sources":["../../src/primitives/border.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAgB1C;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,OAA0B,EAAE,OAAuB;IACzE,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;IACzB,MAAM,WAAW,GAAG,OAAO,EAAE,OAAO,IAAI,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,MAAM,CAAC;IAEjD,+BAA+B;IAC/B,IAAI,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;IACpC,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;QACpB,sCAAsC;QACtC,MAAM,cAAc,GAAoB,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;QAC3F,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAClD,CAAC;SAAM,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QACtC,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;IACxC,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,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