@shell-shock/preset-cli 0.8.4 → 0.8.5
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/README.md +1 -1
- package/dist/components/{banner-function-declaration.cjs → banner-builtin.cjs} +47 -36
- package/dist/components/banner-builtin.d.cts +23 -0
- package/dist/components/banner-builtin.d.cts.map +1 -0
- package/dist/components/banner-builtin.d.mts +23 -0
- package/dist/components/banner-builtin.d.mts.map +1 -0
- package/dist/components/banner-builtin.mjs +88 -0
- package/dist/components/banner-builtin.mjs.map +1 -0
- package/dist/components/command-entry.cjs +182 -186
- package/dist/components/command-entry.d.cts +1 -1
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +182 -186
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +1 -1
- package/dist/components/command-router.mjs +1 -1
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/index.cjs +3 -2
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.mjs +2 -2
- package/dist/components/virtual-command-entry.cjs +18 -22
- package/dist/components/virtual-command-entry.d.cts +1 -1
- package/dist/components/virtual-command-entry.d.cts.map +1 -1
- package/dist/components/virtual-command-entry.d.mts.map +1 -1
- package/dist/components/virtual-command-entry.mjs +18 -22
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/index.cjs +37 -7
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +38 -8
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-banner/dist/components/banner-builtin.cjs +63 -0
- package/dist/plugin-banner/dist/components/banner-builtin.mjs +62 -0
- package/dist/plugin-banner/dist/components/banner-builtin.mjs.map +1 -0
- package/dist/plugin-banner/dist/components/banner-function-declaration.cjs +135 -0
- package/dist/plugin-banner/dist/components/banner-function-declaration.d.cts +45 -0
- package/dist/plugin-banner/dist/components/banner-function-declaration.d.cts.map +1 -0
- package/dist/plugin-banner/dist/components/banner-function-declaration.d.mts +45 -0
- package/dist/plugin-banner/dist/components/banner-function-declaration.d.mts.map +1 -0
- package/dist/plugin-banner/dist/components/banner-function-declaration.mjs +133 -0
- package/dist/plugin-banner/dist/components/banner-function-declaration.mjs.map +1 -0
- package/dist/plugin-help/dist/components/display.cjs +14 -0
- package/dist/plugin-help/dist/components/display.mjs +14 -0
- package/dist/plugin-help/dist/components/display.mjs.map +1 -1
- package/dist/plugin-help/dist/index.cjs +1 -1
- package/dist/plugin-help/dist/index.mjs +1 -1
- package/package.json +19 -19
- package/dist/components/banner-function-declaration.d.cts +0 -11
- package/dist/components/banner-function-declaration.d.cts.map +0 -1
- package/dist/components/banner-function-declaration.d.mts +0 -11
- package/dist/components/banner-function-declaration.d.mts.map +0 -1
- package/dist/components/banner-function-declaration.mjs +0 -78
- package/dist/components/banner-function-declaration.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ This package is part of the ⚡<b>Shell Shock</b> monorepo. The Shell Shock pack
|
|
|
27
27
|
|
|
28
28
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
29
29
|
|
|
30
|
-
[](https://stormsoftware.com/projects/shell-shock/) [](http://commitizen.github.io/cz-cli/)  
|
|
31
31
|
|
|
32
32
|
<!-- prettier-ignore-start -->
|
|
33
33
|
<!-- markdownlint-disable -->
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_banner_function_declaration = require('../plugin-banner/dist/components/banner-function-declaration.cjs');
|
|
4
|
+
const require_banner_builtin = require('../plugin-banner/dist/components/banner-builtin.cjs');
|
|
3
5
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
6
|
let _alloy_js_core = require("@alloy-js/core");
|
|
5
|
-
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
6
7
|
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
8
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
7
9
|
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
8
10
|
let _shell_shock_plugin_theme_contexts_theme = require("@shell-shock/plugin-theme/contexts/theme");
|
|
9
|
-
let _shell_shock_preset_script_components_banner_function_declaration = require("@shell-shock/preset-script/components/banner-function-declaration");
|
|
10
11
|
let cfonts = require("cfonts");
|
|
11
12
|
|
|
12
|
-
//#region src/components/banner-
|
|
13
|
+
//#region src/components/banner-builtin.tsx
|
|
13
14
|
/**
|
|
14
15
|
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
15
16
|
*/
|
|
16
|
-
function
|
|
17
|
+
function BannerFunctionBodyDeclaration(props) {
|
|
17
18
|
const { consoleFnName = "log", variant = "primary", command } = props;
|
|
18
19
|
const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
|
|
19
20
|
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
@@ -35,45 +36,55 @@ function BannerFunctionDeclaration(props) {
|
|
|
35
36
|
if (!result) return [`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} Command-Line Interface`];
|
|
36
37
|
return result.array;
|
|
37
38
|
});
|
|
38
|
-
const bannerPadding = (0, _alloy_js_core.computed)(() => Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.banner.outline[variant]
|
|
39
|
+
const bannerPadding = (0, _alloy_js_core.computed)(() => Math.max(theme.padding.app, 0) * 2 + (theme.borderStyles.banner.outline[variant]?.left.length ?? 0) + (theme.borderStyles.banner.outline[variant]?.right.length ?? 0));
|
|
39
40
|
const totalPadding = (0, _alloy_js_core.computed)(() => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value);
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
get doc() {
|
|
44
|
-
return `Write the ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} application banner ${command ? `for the ${command.title} command ` : ""}to the console.`;
|
|
41
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_banner_function_declaration.BannerFunctionBodyDeclaration, {
|
|
42
|
+
get header() {
|
|
43
|
+
return header.value;
|
|
45
44
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
get description() {
|
|
46
|
+
return description.value;
|
|
47
|
+
},
|
|
48
|
+
get footer() {
|
|
49
|
+
return footer.value;
|
|
50
|
+
},
|
|
51
|
+
variant,
|
|
52
|
+
consoleFnName,
|
|
53
|
+
command,
|
|
54
|
+
insertNewlineAfterDescription: true,
|
|
55
|
+
get children() {
|
|
56
|
+
return _alloy_js_core.code`const titleLines = [${titleLines.value.map((line) => JSON.stringify(line.trim())).join(", ")}];
|
|
57
|
+
const title = Math.max(...titleLines.map(line => stripAnsi(line).length)) > Math.max(process.stdout.columns - ${totalPadding.value}, 0) ? "${title.value}" : \`\\n\${titleLines.join("\\n")}\\n\`; `;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A built-in banner module for Shell Shock.
|
|
63
|
+
*/
|
|
64
|
+
function BannerBuiltin(props) {
|
|
65
|
+
const [{ command, children }, rest] = (0, _alloy_js_core.splitProps)(props, ["command", "children"]);
|
|
66
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_banner_builtin.BannerBuiltin, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
67
|
+
command,
|
|
51
68
|
get children() {
|
|
52
|
-
return
|
|
53
|
-
get header() {
|
|
54
|
-
return header.value;
|
|
55
|
-
},
|
|
56
|
-
get description() {
|
|
57
|
-
return description.value;
|
|
58
|
-
},
|
|
59
|
-
get footer() {
|
|
60
|
-
return footer.value;
|
|
61
|
-
},
|
|
62
|
-
variant,
|
|
63
|
-
consoleFnName,
|
|
69
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_banner_function_declaration.BannerFunctionDeclarationWrapper, {
|
|
64
70
|
command,
|
|
65
|
-
insertNewlineAfterDescription: true,
|
|
66
71
|
get children() {
|
|
67
|
-
return
|
|
68
|
-
|
|
72
|
+
return [
|
|
73
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(BannerFunctionBodyDeclaration, { command }),
|
|
74
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
75
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
76
|
+
get when() {
|
|
77
|
+
return Boolean(children);
|
|
78
|
+
},
|
|
79
|
+
children
|
|
80
|
+
})
|
|
81
|
+
];
|
|
69
82
|
}
|
|
70
|
-
})
|
|
71
|
-
condition: _alloy_js_core.code`isInteractive && !isHelp`,
|
|
72
|
-
children: _alloy_js_core.code`await sleep(pause);`
|
|
73
|
-
})];
|
|
83
|
+
});
|
|
74
84
|
}
|
|
75
|
-
})
|
|
85
|
+
}));
|
|
76
86
|
}
|
|
77
87
|
|
|
78
88
|
//#endregion
|
|
79
|
-
exports.
|
|
89
|
+
exports.BannerBuiltin = BannerBuiltin;
|
|
90
|
+
exports.BannerFunctionBodyDeclaration = BannerFunctionBodyDeclaration;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BannerFunctionBodyDeclarationProps } from "../plugin-banner/dist/components/banner-function-declaration.cjs";
|
|
2
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
3
|
+
import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
4
|
+
import { CommandTree } from "@shell-shock/core";
|
|
5
|
+
|
|
6
|
+
//#region src/components/banner-builtin.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
9
|
+
*/
|
|
10
|
+
declare function BannerFunctionBodyDeclaration(props: Omit<BannerFunctionBodyDeclarationProps, "header" | "description" | "footer">): _alloy_js_core0.Children;
|
|
11
|
+
type BannerBuiltinProps = Omit<BuiltinFileProps, "id" | "description"> & {
|
|
12
|
+
/**
|
|
13
|
+
* The command to generate the `banner` function declaration for.
|
|
14
|
+
*/
|
|
15
|
+
command: CommandTree;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* A built-in banner module for Shell Shock.
|
|
19
|
+
*/
|
|
20
|
+
declare function BannerBuiltin(props: BannerBuiltinProps): _alloy_js_core0.Children;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { BannerBuiltin, BannerBuiltinProps, BannerFunctionBodyDeclaration };
|
|
23
|
+
//# sourceMappingURL=banner-builtin.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner-builtin.d.cts","names":[],"sources":["../../src/components/banner-builtin.tsx"],"mappings":";;;;;;;;;iBAqCgB,6BAAA,CACd,KAAA,EAAO,IAAA,CACL,kCAAA,yCADS,eAAA,CAGV,QAAA;AAAA,KAuES,kBAAA,GAAqB,IAAA,CAC/B,gBAAA;;;;EAMA,OAAA,EAAS,WAAA;AAAA;;;;iBAMK,aAAA,CAAc,KAAA,EAAO,kBAAA,GAAkB,eAAA,CAAA,QAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BannerFunctionBodyDeclarationProps } from "../plugin-banner/dist/components/banner-function-declaration.mjs";
|
|
2
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
3
|
+
import { CommandTree } from "@shell-shock/core";
|
|
4
|
+
import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
5
|
+
|
|
6
|
+
//#region src/components/banner-builtin.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
9
|
+
*/
|
|
10
|
+
declare function BannerFunctionBodyDeclaration(props: Omit<BannerFunctionBodyDeclarationProps, "header" | "description" | "footer">): _alloy_js_core0.Children;
|
|
11
|
+
type BannerBuiltinProps = Omit<BuiltinFileProps, "id" | "description"> & {
|
|
12
|
+
/**
|
|
13
|
+
* The command to generate the `banner` function declaration for.
|
|
14
|
+
*/
|
|
15
|
+
command: CommandTree;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* A built-in banner module for Shell Shock.
|
|
19
|
+
*/
|
|
20
|
+
declare function BannerBuiltin(props: BannerBuiltinProps): _alloy_js_core0.Children;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { BannerBuiltin, BannerBuiltinProps, BannerFunctionBodyDeclaration };
|
|
23
|
+
//# sourceMappingURL=banner-builtin.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner-builtin.d.mts","names":[],"sources":["../../src/components/banner-builtin.tsx"],"mappings":";;;;;;;;;iBAqCgB,6BAAA,CACd,KAAA,EAAO,IAAA,CACL,kCAAA,yCADS,eAAA,CAGV,QAAA;AAAA,KAuES,kBAAA,GAAqB,IAAA,CAC/B,gBAAA;;;;EAMA,OAAA,EAAS,WAAA;AAAA;;;;iBAMK,aAAA,CAAc,KAAA,EAAO,kBAAA,GAAkB,eAAA,CAAA,QAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { BannerFunctionBodyDeclaration as BannerFunctionBodyDeclaration$1, BannerFunctionDeclarationWrapper } from "../plugin-banner/dist/components/banner-function-declaration.mjs";
|
|
2
|
+
import { BannerBuiltin as BannerBuiltin$1 } from "../plugin-banner/dist/components/banner-builtin.mjs";
|
|
3
|
+
import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
4
|
+
import { Show, code, computed, splitProps } from "@alloy-js/core";
|
|
5
|
+
import { getAppDescription, getAppTitle } from "@shell-shock/core/plugin-utils";
|
|
6
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
7
|
+
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
8
|
+
import { useTheme } from "@shell-shock/plugin-theme/contexts/theme";
|
|
9
|
+
import { render } from "cfonts";
|
|
10
|
+
|
|
11
|
+
//#region src/components/banner-builtin.tsx
|
|
12
|
+
/**
|
|
13
|
+
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
14
|
+
*/
|
|
15
|
+
function BannerFunctionBodyDeclaration(props) {
|
|
16
|
+
const { consoleFnName = "log", variant = "primary", command } = props;
|
|
17
|
+
const theme = useTheme();
|
|
18
|
+
const context = usePowerlines();
|
|
19
|
+
const header = computed(() => `${theme.labels.banner.header[variant] || getAppTitle(context)} v${context.packageJson.version || "1.0.0"}`);
|
|
20
|
+
const footer = computed(() => theme.labels.banner.footer[variant]);
|
|
21
|
+
const title = computed(() => getAppTitle(context, true).replace(`v${context.packageJson.version || "1.0.0"}`, ""));
|
|
22
|
+
const description = computed(() => command?.description || getAppDescription(context));
|
|
23
|
+
const titleLines = computed(() => {
|
|
24
|
+
const result = render(getAppTitle(context, true), {
|
|
25
|
+
font: "tiny",
|
|
26
|
+
align: "left",
|
|
27
|
+
background: "transparent",
|
|
28
|
+
letterSpacing: 1,
|
|
29
|
+
lineHeight: 1,
|
|
30
|
+
gradient: false,
|
|
31
|
+
transitionGradient: false,
|
|
32
|
+
env: "node"
|
|
33
|
+
});
|
|
34
|
+
if (!result) return [`${getAppTitle(context, true)} Command-Line Interface`];
|
|
35
|
+
return result.array;
|
|
36
|
+
});
|
|
37
|
+
const bannerPadding = computed(() => Math.max(theme.padding.app, 0) * 2 + (theme.borderStyles.banner.outline[variant]?.left.length ?? 0) + (theme.borderStyles.banner.outline[variant]?.right.length ?? 0));
|
|
38
|
+
const totalPadding = computed(() => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value);
|
|
39
|
+
return createComponent(BannerFunctionBodyDeclaration$1, {
|
|
40
|
+
get header() {
|
|
41
|
+
return header.value;
|
|
42
|
+
},
|
|
43
|
+
get description() {
|
|
44
|
+
return description.value;
|
|
45
|
+
},
|
|
46
|
+
get footer() {
|
|
47
|
+
return footer.value;
|
|
48
|
+
},
|
|
49
|
+
variant,
|
|
50
|
+
consoleFnName,
|
|
51
|
+
command,
|
|
52
|
+
insertNewlineAfterDescription: true,
|
|
53
|
+
get children() {
|
|
54
|
+
return code`const titleLines = [${titleLines.value.map((line) => JSON.stringify(line.trim())).join(", ")}];
|
|
55
|
+
const title = Math.max(...titleLines.map(line => stripAnsi(line).length)) > Math.max(process.stdout.columns - ${totalPadding.value}, 0) ? "${title.value}" : \`\\n\${titleLines.join("\\n")}\\n\`; `;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A built-in banner module for Shell Shock.
|
|
61
|
+
*/
|
|
62
|
+
function BannerBuiltin(props) {
|
|
63
|
+
const [{ command, children }, rest] = splitProps(props, ["command", "children"]);
|
|
64
|
+
return createComponent(BannerBuiltin$1, mergeProps(rest, {
|
|
65
|
+
command,
|
|
66
|
+
get children() {
|
|
67
|
+
return createComponent(BannerFunctionDeclarationWrapper, {
|
|
68
|
+
command,
|
|
69
|
+
get children() {
|
|
70
|
+
return [
|
|
71
|
+
createComponent(BannerFunctionBodyDeclaration, { command }),
|
|
72
|
+
createComponent(Spacing, {}),
|
|
73
|
+
createComponent(Show, {
|
|
74
|
+
get when() {
|
|
75
|
+
return Boolean(children);
|
|
76
|
+
},
|
|
77
|
+
children
|
|
78
|
+
})
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
//#endregion
|
|
87
|
+
export { BannerBuiltin, BannerFunctionBodyDeclaration };
|
|
88
|
+
//# sourceMappingURL=banner-builtin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner-builtin.mjs","names":[],"sources":["../../src/components/banner-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, Show, splitProps } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport type { CommandTree } from \"@shell-shock/core\";\nimport { getAppDescription, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { BannerBuiltin as BaseBannerBuiltin } from \"@shell-shock/plugin-banner/components/banner-builtin\";\nimport type { BannerFunctionBodyDeclarationProps } from \"@shell-shock/plugin-banner/components/banner-function-declaration\";\nimport {\n BannerFunctionDeclarationWrapper,\n BannerFunctionBodyDeclaration as BaseBannerFunctionBodyDeclaration\n} from \"@shell-shock/plugin-banner/components/banner-function-declaration\";\nimport { useTheme } from \"@shell-shock/plugin-theme/contexts/theme\";\nimport { render } from \"cfonts\";\nimport type { CLIPresetContext } from \"../types/plugin\";\n\n/**\n * A component to generate the `banner` function in the `shell-shock:console` builtin module.\n */\nexport function BannerFunctionBodyDeclaration(\n props: Omit<\n BannerFunctionBodyDeclarationProps,\n \"header\" | \"description\" | \"footer\"\n >\n) {\n const { consoleFnName = \"log\", variant = \"primary\", command } = props;\n\n const theme = useTheme();\n const context = usePowerlines<CLIPresetContext>();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context)} v${\n context.packageJson.version || \"1.0.0\"\n }`\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n const title = computed(() =>\n getAppTitle(context, true).replace(\n `v${context.packageJson.version || \"1.0.0\"}`,\n \"\"\n )\n );\n const description = computed(\n () => command?.description || getAppDescription(context)\n );\n\n const titleLines = computed(() => {\n const result = render(getAppTitle(context, true), {\n font: \"tiny\",\n align: \"left\",\n background: \"transparent\",\n letterSpacing: 1,\n lineHeight: 1,\n gradient: false,\n transitionGradient: false,\n env: \"node\"\n });\n if (!result) {\n return [`${getAppTitle(context, true)} Command-Line Interface`];\n }\n\n return result.array;\n });\n\n const bannerPadding = computed(\n () =>\n Math.max(theme.padding.app, 0) * 2 +\n (theme.borderStyles.banner.outline[variant]?.left.length ?? 0) +\n (theme.borderStyles.banner.outline[variant]?.right.length ?? 0)\n );\n const totalPadding = computed(\n () => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value\n );\n\n return (\n <BaseBannerFunctionBodyDeclaration\n header={header.value}\n description={description.value}\n footer={footer.value}\n variant={variant}\n consoleFnName={consoleFnName}\n command={command}\n insertNewlineAfterDescription>\n {code`const titleLines = [${titleLines.value\n .map(line => JSON.stringify(line.trim()))\n .join(\", \")}];\n const title = Math.max(...titleLines.map(line => stripAnsi(line).length)) > Math.max(process.stdout.columns - ${\n totalPadding.value\n }, 0) ? \"${title.value}\" : \\`\\\\n\\${titleLines.join(\"\\\\n\")}\\\\n\\`; `}\n </BaseBannerFunctionBodyDeclaration>\n );\n}\n\nexport type BannerBuiltinProps = Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> & {\n /**\n * The command to generate the `banner` function declaration for.\n */\n command: CommandTree;\n};\n\n/**\n * A built-in banner module for Shell Shock.\n */\nexport function BannerBuiltin(props: BannerBuiltinProps) {\n const [{ command, children }, rest] = splitProps(props, [\n \"command\",\n \"children\"\n ]);\n\n return (\n <BaseBannerBuiltin {...rest} command={command}>\n <BannerFunctionDeclarationWrapper command={command}>\n <BannerFunctionBodyDeclaration command={command} />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BannerFunctionDeclarationWrapper>\n </BaseBannerBuiltin>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAmCA,SAAe,8BAAyB,OAAoD;CAC1F,MAAA,EACF,gBAAgB,OACd,UAAW,WACT,YACC;CACH,MAAA,QAAA,UAAA;CACA,MAAA,UAAA,eAAA;CACA,MAAM,SAAE,eAAsB,GAAC,MAAQ,OAAG,OAAU,OAAQ,YAAS,YAAA,QAAA,CAAA,IAAA,QAAA,YAAA,WAAA,UAAA;;CAErE,MAAM,QAAQ,eAAU,YAAA,SAAA,KAAA,CAAA,QAAA,IAAA,QAAA,YAAA,WAAA,WAAA,GAAA,CAAA;CACxB,MAAM,cAAU,eAAc,SAAA,eAAmB,kBAAA,QAAA,CAAA;;EAEjD,MAAM,SAAS,OAAQ,YAAA,SAAA,KAAA,EAAA;GACnB,MAAE;GACF,OAAG;GACH,YAAU;GACV,eAAC;GACJ,YAAA;GACD,UAAc;GACd,oBAAwB;GACtB,KAAA;GACC,CAAC;AACF,MAAG,CAAA,OACH,QAAA,CAAA,GAAA,YAAA,SAAA,KAAA,CAAA,yBAAA;AAEF,SAAM,OAAA;GACJ;CACF,MAAC,gBAAA,eAAA,KAAA,IAAA,MAAA,QAAA,KAAA,EAAA,GAAA,KAAA,MAAA,aAAA,OAAA,QAAA,UAAA,KAAA,UAAA,MAAA,MAAA,aAAA,OAAA,QAAA,UAAA,MAAA,UAAA,GAAA;;AAED,QAAM,gBAAa,iCAAe;EAChC,IAAA,SAAa;AACX,UAAO,OAAK;;EAEd,IAAE,cAAa;AACb,UAAA,YAAgB;;EAElB,IAAE,SAAU;AACV,UAAA,OAAA;;EAEA;EACW;EACJ;EACT,+BAAA;;AAEA,UAAO,IAAM,uBAAM,WAAA,MAAA,KAAA,SAAA,KAAA,UAAA,KAAA,MAAA,CAAA,CAAA,CAAA,KAAA,KAAA,CAAA;wHACnB,aAAA,MAAA,UAAA,MAAA,MAAA;;EAEF,CAAA;;;;;AAYF,SAAc,cAAY,OAAA;CACxB,MAAI,CAAA,EACF,SACA,YACC,QAAC,WAAe,OAAA,CAAA,WAAa,WAAA,CAAA;AAChC,QAAI,gBAAgB,iBAAA,WAAA,MAAA;EAChB;EACF,IAAG,WAAW;AACZ,UAAO,gBAAa,kCAAsB;IAC/B;IACT,IAAA,WAAc;AACZ,YAAA;MAAA,gBAAa,+BAAA,EACJ,SACb,CAAA;MAAA,gBAAA,SAAiC,EAAA,CAAA;MAAA,gBAAA,MAAA;OACpC,IAAA,OAAA;AACH,eAAA,QAAA,SAAA;;OAEY;OACV,CAAA;MAAA;;IAEE,CAAA;;EAED,CAAC,CAAC"}
|