@shell-shock/plugin-banner 0.1.34 → 0.1.37
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.
|
@@ -1 +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 { Show, splitProps } from \"@alloy-js/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport { BuiltinFile } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport type { CommandTree } from \"@shell-shock/core\";\nimport {\n getAppTitle,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport defu from \"defu\";\nimport type { BannerPluginContext } from \"../types\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\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 const context = usePowerlines<BannerPluginContext>();\n\n return (\n <BuiltinFile\n id={joinPaths(\n \"banner\",\n ...command.segments.filter(segment => !isDynamicPathSegment(segment))\n )}\n description={\n command.path\n ? `A collection of utility functions that assist in displaying banner information for the ${command.title} command.`\n : `A collection of utility functions that assist in displaying banner information for the ${getAppTitle(\n context,\n true\n )} command-line interface application.`\n }\n {...rest}\n builtinImports={defu(rest.builtinImports ?? {}, {\n utils: [\n \"isUnicodeSupported\",\n \"isMinimal\",\n \"sleep\",\n \"isInteractive\",\n \"getTerminalSize\"\n ],\n state: [\"useGlobal\", \"hasFlag\", \"isHelp\", \"useMeta\"],\n console: [\n \"splitText\",\n \"writeLine\",\n \"help\",\n \"bold\",\n \"table\",\n \"stripAnsi\",\n \"textColors\",\n \"borderColors\"\n ]\n })}>\n <Show\n when={Boolean(children)}\n fallback={<BannerFunctionDeclaration command={command} />}>\n {children}\n </Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;
|
|
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 { Show, splitProps } from \"@alloy-js/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport { BuiltinFile } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport type { CommandTree } from \"@shell-shock/core\";\nimport {\n getAppTitle,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport defu from \"defu\";\nimport type { BannerPluginContext } from \"../types\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\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 const context = usePowerlines<BannerPluginContext>();\n\n return (\n <BuiltinFile\n id={joinPaths(\n \"banner\",\n ...command.segments.filter(segment => !isDynamicPathSegment(segment))\n )}\n description={\n command.path\n ? `A collection of utility functions that assist in displaying banner information for the ${command.title} command.`\n : `A collection of utility functions that assist in displaying banner information for the ${getAppTitle(\n context,\n true\n )} command-line interface application.`\n }\n {...rest}\n builtinImports={defu(rest.builtinImports ?? {}, {\n utils: [\n \"isUnicodeSupported\",\n \"isMinimal\",\n \"sleep\",\n \"isInteractive\",\n \"getTerminalSize\"\n ],\n state: [\"useGlobal\", \"hasFlag\", \"isHelp\", \"useMeta\"],\n console: [\n \"splitText\",\n \"writeLine\",\n \"help\",\n \"bold\",\n \"table\",\n \"stripAnsi\",\n \"textColors\",\n \"borderColors\"\n ]\n })}>\n <Show\n when={Boolean(children)}\n fallback={<BannerFunctionDeclaration command={command} />}>\n {children}\n </Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA6BA,SAAc,cAAA,OAAsB;CACpC,MAAQ,CAAC,WAET,YACE,QAAA,WAAgB,OAAA,CAAA,WAAA,WAAA,CAAA;CAChB,MAAM,UAAE,eAAW;AACnB,QAAE,gBAAA,aAAA,WAAA;EACA,IAAA,KAAA;AACC,UAAI,UAAW,UAAa,GAAC,QAAQ,SAAS,QAAA,YAAe,CAAA,qBAAA,QAAA,CAAA,CAAA;;EAEhE,IAAA,cAAoB;AACrB,UAAA,WAAA,CAAA,CAAA,QAAA,KAAA,EAAA,GAAA,0FAAA,QAAA,MAAA,aAAA,0FAAA,YAAA,SAAA,KAAA,CAAA;;EAEC,EAAA,MAAA;EACE,IAAC,iBAAgB;AACnB,UAAA,KAAA,KAAA,kBAAA,EAAA,EAAA;IACK,OAAQ;KAAC;KAAqB;KAAA;KAAoB;KAAA;KAAA;IACjD,OAAG;KAAA;KAAkB;KAAW;KAAU;KAAQ;IACrD,SAAQ;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IACR,CAAA;;EAEH,IAAM,WAAU;;IAEV,IAAC,OAAA;AACJ,YAAA,QAAA,SAAA;;IAEG,IAAC,WAAO;AACN,YAAC,gBAAwB,2BAAY,EACxC,SACD,CAAA;;IAES;IACR,CAAC;;EAEL,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner-function-declaration.mjs","names":[],"sources":["../../src/components/banner-function-declaration.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 type { Children } from \"@alloy-js/core\";\nimport { code, computed, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration, IfStatement } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n TSDoc,\n TSDocParam\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport {\n formatDescription,\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { useTheme } from \"@shell-shock/plugin-theme/contexts/theme\";\nimport type { ThemeColorVariant } from \"@shell-shock/plugin-theme/types/theme\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type { BannerPluginContext } from \"../types\";\n\nexport interface BannerFunctionDeclarationWrapperProps {\n command?: CommandTree;\n children?: Children;\n}\n\n/**\n * A component to generate the `banner` function for a specific command or application.\n *\n * @remarks\n * This function will display a banner in the console with the application's name, version, and description. It can be customized with different variants for styling and supports conditional rendering based on flags or environment variables.\n */\nexport function BannerFunctionDeclarationWrapper(\n props: BannerFunctionDeclarationWrapperProps\n) {\n const { command, children } = props;\n\n const context = usePowerlines<BannerPluginContext>();\n\n return (\n <>\n <TSDoc\n heading={`Write the ${getAppTitle(context, true)} command-line interface application banner ${\n command ? `for the ${command.title} command ` : \"\"\n }to the console.`}>\n <TSDocParam name=\"sleepTimeoutMs\">\n {`The amount of time in milliseconds to sleep before displaying the banner. This can be used to create a delay before the banner is shown, allowing for any necessary setup or initialization to occur first. The default value is 500 milliseconds.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"showBanner\"\n parameters={[{ name: \"sleepTimeoutMs\", type: \"number\", default: 500 }]}>\n {children}\n <IfStatement condition={code`isInteractive && !isHelp()`}>\n {code`await sleep(sleepTimeoutMs);`}\n </IfStatement>\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface BannerFunctionBodyDeclarationProps extends BannerFunctionDeclarationProps {\n title?: string;\n header?: string;\n footer?: string;\n description: string;\n insertNewlineBeforeCommand?: boolean;\n insertNewlineBeforeBanner?: boolean;\n insertNewlineAfterDescription?: boolean;\n}\n\n/**\n * A component to generate the `banner` function's body for a specific command or application.\n *\n * @remarks\n * This function will display a banner in the console with the application's name, version, and description. It can be customized with different variants for styling and supports conditional rendering based on flags or environment variables.\n */\nexport function BannerFunctionBodyDeclaration(\n props: BannerFunctionBodyDeclarationProps\n) {\n const {\n consoleFnName = \"log\",\n variant = \"primary\",\n title,\n header,\n footer,\n description,\n command,\n children,\n insertNewlineBeforeCommand = false,\n insertNewlineBeforeBanner = true,\n insertNewlineAfterDescription = false\n } = props;\n\n const theme = useTheme();\n\n const borderStyle = theme.borderStyles.banner.outline[variant];\n const icon = theme.icons.banner.header[variant];\n\n const bannerPadding = computed(\n () =>\n Math.max(theme.padding.app, 0) * 2 +\n borderStyle.left.length +\n borderStyle.right.length\n );\n const innerPadding = computed(() => Math.max(theme.padding.banner, 2));\n const totalPadding = computed(\n () => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value\n );\n const headerRepeat = computed(() =>\n Math.max(Math.floor(innerPadding.value / 2) - 1, 2)\n );\n const headerStaticWidth = computed(\n () =>\n borderStyle.topLeft.length +\n headerRepeat.value +\n (icon ? 1 + icon.length + 1 + borderStyle.top.length + 1 : 1) +\n (header ? header.length : 0) +\n 1 +\n borderStyle.topRight.length\n );\n const footerStaticWidth = computed(\n () =>\n borderStyle.bottomLeft.length +\n 1 +\n (footer ? footer.length : 0) +\n 1 +\n headerRepeat.value +\n borderStyle.bottomRight.length\n );\n\n return (\n <>\n {code`\n if (useMeta().get(\"banner\") || hasFlag(\"no-banner\") || hasFlag(\"hide-banner\") || isMinimal) {\n return;\n }\n\n useMeta().set(\"banner\", true); `}\n <Spacing />\n <Show when={insertNewlineBeforeBanner}>{code`writeLine(\"\"); `}</Show>\n <Spacing />\n {code`writeLine(borderColors.banner.outline.${variant}(\"${\n borderStyle.topLeft\n }\") + borderColors.banner.outline.${\n variant\n }(\"${borderStyle.top}\".repeat(${headerRepeat.value}))${\n icon\n ? ` + \" \" + textColors.banner.header.${\n variant\n }(\"${icon}\") + \" \" + borderColors.banner.outline.${variant}(\"${\n borderStyle.top\n }\")`\n : \"\"\n } + \" \" + bold(textColors.banner.header.${variant}(\"${formatDescription(\n header || \"\"\n )}\")) + \" \" + borderColors.banner.outline.${\n variant\n }(\"${borderStyle.top}\".repeat(Math.max(getTerminalSize().columns - ${\n headerStaticWidth.value\n }, 0))) + borderColors.banner.outline.${\n variant\n }(\"${borderStyle.topRight}\"), { consoleFn: console.${consoleFnName} }); `}\n <Spacing />\n <Show when={isSetString(title) && !children}>\n {code`splitText(\"${formatDescription(\n title || \"\"\n )}\", Math.max(getTerminalSize().columns - ${\n totalPadding.value\n }, 20)).forEach((line) => {\n writeLine(borderColors.banner.outline.${variant}(\"${\n borderStyle.left\n }\") + \" \".repeat(Math.max(Math.floor((getTerminalSize().columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + bold(textColors.banner.title.${\n variant\n }(line)) + \" \".repeat(Math.max(Math.ceil((getTerminalSize().columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + borderColors.banner.outline.${variant}(\"${\n borderStyle.right\n }\"), { consoleFn: console.${consoleFnName} });\n }); `}\n </Show>\n {children}\n <Show when={isSetString(command?.title)}>\n <Show when={insertNewlineBeforeCommand}>\n {code`writeLine(borderColors.banner.outline.${variant}(\"${\n borderStyle.left\n }\") + \" \".repeat(Math.max(getTerminalSize().columns - ${\n bannerPadding.value\n }, 0)) + borderColors.banner.outline.${variant}(\"${\n borderStyle.right\n }\"), { consoleFn: console.${consoleFnName} }); `}\n </Show>\n {code`writeLine(borderColors.banner.outline.${variant}(\"${\n borderStyle.left\n }\") + \" \".repeat(Math.max(Math.floor((getTerminalSize().columns - (stripAnsi(\"${formatDescription(\n command?.title || \"\"\n )}\").length + ${\n bannerPadding.value\n })) / 2), 0)) + bold(textColors.banner.command.${\n variant\n }(\"${formatDescription(\n command?.title || \"\"\n )}\")) + \" \".repeat(Math.max(Math.ceil((getTerminalSize().columns - (stripAnsi(\"${formatDescription(\n command?.title || \"\"\n )}\").length + ${\n bannerPadding.value\n })) / 2), 0)) + borderColors.banner.outline.${variant}(\"${\n borderStyle.right\n }\"), { consoleFn: console.${consoleFnName} }); `}\n </Show>\n <Spacing />\n {code`splitText(bold(textColors.banner.${\n command ? \"description\" : \"command\"\n }.${variant}(\\`${formatDescription(description)}\\`)), Math.max(${\n command\n ? `${\n totalPadding.value * 2\n } > getTerminalSize().columns / 2 ? getTerminalSize().columns - ${Math.max(\n bannerPadding.value + 4,\n 6\n )} : `\n : \"\"\n }getTerminalSize().columns - ${\n totalPadding.value\n }, 20)).forEach((line) => {\n writeLine(borderColors.banner.outline.${\n variant\n }(\"${borderStyle.left}\") + \" \".repeat(Math.max(Math.floor((getTerminalSize().columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + textColors.banner.description.${\n variant\n }(line) + \" \".repeat(Math.max(Math.ceil((getTerminalSize().columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + borderColors.banner.outline.${variant}(\"${\n borderStyle.right\n }\"), { consoleFn: console.${consoleFnName} });\n }); `}\n <Spacing />\n <Show when={insertNewlineAfterDescription}>\n {code`writeLine(borderColors.banner.outline.${variant}(\"${\n borderStyle.left\n }\") + \" \".repeat(Math.max(getTerminalSize().columns - ${\n bannerPadding.value\n }, 0)) + borderColors.banner.outline.${variant}(\"${\n borderStyle.right\n }\"), { consoleFn: console.${consoleFnName} }); `}\n </Show>\n <Spacing />\n {code`writeLine(borderColors.banner.outline.${variant}(\"${\n borderStyle.bottomLeft\n }\") + ${\n footer\n ? `borderColors.banner.outline.${variant}(\"${\n borderStyle.bottom\n }\".repeat(Math.max(getTerminalSize().columns - ${\n footerStaticWidth.value\n }, 0))) + \" \" + bold(textColors.banner.footer.${\n variant\n }(\"${formatDescription(\n footer\n )}\")) + \" \" + borderColors.banner.outline.${variant}(\"${\n borderStyle.bottom\n }\".repeat(${headerRepeat.value}))`\n : `borderColors.banner.outline.${variant}(\"${\n borderStyle.bottom\n }\".repeat(Math.max(getTerminalSize().columns - ${\n borderStyle.bottomLeft.length + borderStyle.bottomRight.length\n }, 0)))`\n } + borderColors.banner.outline.${variant}(\"${\n borderStyle.bottomRight\n }\"), { consoleFn: console.${consoleFnName} }); `}\n <Spacing />\n {code`writeLine(\"\"); `}\n </>\n );\n}\n\nexport interface BannerFunctionDeclarationProps extends BannerFunctionDeclarationWrapperProps {\n variant?: ThemeColorVariant;\n consoleFnName?: \"log\" | \"info\" | \"warn\" | \"error\" | \"debug\";\n insertNewlineBeforeBanner?: boolean;\n}\n\n/**\n * A component to generate the `banner` function for a specific command or application.\n *\n * @remarks\n * This function will display a banner in the console with the application's name, version, and description. It can be customized with different variants for styling and supports conditional rendering based on flags or environment variables.\n */\nexport function BannerFunctionDeclaration(\n props: BannerFunctionDeclarationProps\n) {\n const {\n consoleFnName = \"log\",\n variant = \"primary\",\n command,\n children,\n insertNewlineBeforeBanner = true\n } = props;\n\n const theme = useTheme();\n const context = usePowerlines<BannerPluginContext>();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context, false)} v${\n context.packageJson.version || \"1.0.0\"\n }`\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n const title = computed(\n () =>\n context.config.banner.title ||\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 return (\n <BannerFunctionDeclarationWrapper command={command}>\n <BannerFunctionBodyDeclaration\n title={!children ? title.value : undefined}\n header={header.value}\n description={description.value}\n footer={footer.value}\n variant={variant}\n consoleFnName={consoleFnName}\n command={command}\n insertNewlineBeforeCommand\n insertNewlineBeforeBanner={insertNewlineBeforeBanner}>\n {children}\n </BannerFunctionBodyDeclaration>\n </BannerFunctionDeclarationWrapper>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;CA2CE,MAAA,EACE,SACH,aACG;CACF,MAAM,UAAS,eAAqC;AACpD,QAAA,CAAA,gBAAA,OAAA;EACF,IAAO,UAAS;AACd,UAAO,aAAA,YAAA,SAAA,KAAA,CAAA,6CAAA,UAAA,WAAA,QAAA,MAAA,aAAA,GAAA;;EAEP,IAAM,WAAW;;IAEX,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A,SAAA,YAAA,SAAA,KAAA,CAAA,QAAA,IAAA,QAAA,YAAA,WAAA,WAAA,GAAA,CAAA;CACN,MAAM,cAAc,eAAc,SAAS,eAAgB,kBAAa,QAAA,CAAA;AACxE,QAAM,gBAAkB,kCAAA;EACb;EACT,IAAI,WAAA;AACF,UAAK,gBAAoB,+BAA4B;IACpD,IAAA,QAAS;AACT,YAAU,CAAC,WAAW,MAAM,QAAM;;IAEjC,IAAE,SAAU;AACV,YAAO,OAAK;;IAEd,IAAG,cAAc;AACrB,YAAU,YAAa;;IAEnB,IAAI,SAAS;AACf,YAAA,OAAc;;IAEd;IACa;IACb;IACE,4BAAyB;IACf;IACP;IACJ,CAAA;;EAEJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"banner-function-declaration.mjs","names":[],"sources":["../../src/components/banner-function-declaration.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 type { Children } from \"@alloy-js/core\";\nimport { code, computed, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration, IfStatement } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n TSDoc,\n TSDocParam\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport {\n formatDescription,\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { useTheme } from \"@shell-shock/plugin-theme/contexts/theme\";\nimport type { ThemeColorVariant } from \"@shell-shock/plugin-theme/types/theme\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type { BannerPluginContext } from \"../types\";\n\nexport interface BannerFunctionDeclarationWrapperProps {\n command?: CommandTree;\n children?: Children;\n}\n\n/**\n * A component to generate the `banner` function for a specific command or application.\n *\n * @remarks\n * This function will display a banner in the console with the application's name, version, and description. It can be customized with different variants for styling and supports conditional rendering based on flags or environment variables.\n */\nexport function BannerFunctionDeclarationWrapper(\n props: BannerFunctionDeclarationWrapperProps\n) {\n const { command, children } = props;\n\n const context = usePowerlines<BannerPluginContext>();\n\n return (\n <>\n <TSDoc\n heading={`Write the ${getAppTitle(context, true)} command-line interface application banner ${\n command ? `for the ${command.title} command ` : \"\"\n }to the console.`}>\n <TSDocParam name=\"sleepTimeoutMs\">\n {`The amount of time in milliseconds to sleep before displaying the banner. This can be used to create a delay before the banner is shown, allowing for any necessary setup or initialization to occur first. The default value is 500 milliseconds.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"showBanner\"\n parameters={[{ name: \"sleepTimeoutMs\", type: \"number\", default: 500 }]}>\n {children}\n <IfStatement condition={code`isInteractive && !isHelp()`}>\n {code`await sleep(sleepTimeoutMs);`}\n </IfStatement>\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface BannerFunctionBodyDeclarationProps extends BannerFunctionDeclarationProps {\n title?: string;\n header?: string;\n footer?: string;\n description: string;\n insertNewlineBeforeCommand?: boolean;\n insertNewlineBeforeBanner?: boolean;\n insertNewlineAfterDescription?: boolean;\n}\n\n/**\n * A component to generate the `banner` function's body for a specific command or application.\n *\n * @remarks\n * This function will display a banner in the console with the application's name, version, and description. It can be customized with different variants for styling and supports conditional rendering based on flags or environment variables.\n */\nexport function BannerFunctionBodyDeclaration(\n props: BannerFunctionBodyDeclarationProps\n) {\n const {\n consoleFnName = \"log\",\n variant = \"primary\",\n title,\n header,\n footer,\n description,\n command,\n children,\n insertNewlineBeforeCommand = false,\n insertNewlineBeforeBanner = true,\n insertNewlineAfterDescription = false\n } = props;\n\n const theme = useTheme();\n\n const borderStyle = theme.borderStyles.banner.outline[variant];\n const icon = theme.icons.banner.header[variant];\n\n const bannerPadding = computed(\n () =>\n Math.max(theme.padding.app, 0) * 2 +\n borderStyle.left.length +\n borderStyle.right.length\n );\n const innerPadding = computed(() => Math.max(theme.padding.banner, 2));\n const totalPadding = computed(\n () => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value\n );\n const headerRepeat = computed(() =>\n Math.max(Math.floor(innerPadding.value / 2) - 1, 2)\n );\n const headerStaticWidth = computed(\n () =>\n borderStyle.topLeft.length +\n headerRepeat.value +\n (icon ? 1 + icon.length + 1 + borderStyle.top.length + 1 : 1) +\n (header ? header.length : 0) +\n 1 +\n borderStyle.topRight.length\n );\n const footerStaticWidth = computed(\n () =>\n borderStyle.bottomLeft.length +\n 1 +\n (footer ? footer.length : 0) +\n 1 +\n headerRepeat.value +\n borderStyle.bottomRight.length\n );\n\n return (\n <>\n {code`\n if (useMeta().get(\"banner\") || hasFlag(\"no-banner\") || hasFlag(\"hide-banner\") || isMinimal) {\n return;\n }\n\n useMeta().set(\"banner\", true); `}\n <Spacing />\n <Show when={insertNewlineBeforeBanner}>{code`writeLine(\"\"); `}</Show>\n <Spacing />\n {code`writeLine(borderColors.banner.outline.${variant}(\"${\n borderStyle.topLeft\n }\") + borderColors.banner.outline.${\n variant\n }(\"${borderStyle.top}\".repeat(${headerRepeat.value}))${\n icon\n ? ` + \" \" + textColors.banner.header.${\n variant\n }(\"${icon}\") + \" \" + borderColors.banner.outline.${variant}(\"${\n borderStyle.top\n }\")`\n : \"\"\n } + \" \" + bold(textColors.banner.header.${variant}(\"${formatDescription(\n header || \"\"\n )}\")) + \" \" + borderColors.banner.outline.${\n variant\n }(\"${borderStyle.top}\".repeat(Math.max(getTerminalSize().columns - ${\n headerStaticWidth.value\n }, 0))) + borderColors.banner.outline.${\n variant\n }(\"${borderStyle.topRight}\"), { consoleFn: console.${consoleFnName} }); `}\n <Spacing />\n <Show when={isSetString(title) && !children}>\n {code`splitText(\"${formatDescription(\n title || \"\"\n )}\", Math.max(getTerminalSize().columns - ${\n totalPadding.value\n }, 20)).forEach((line) => {\n writeLine(borderColors.banner.outline.${variant}(\"${\n borderStyle.left\n }\") + \" \".repeat(Math.max(Math.floor((getTerminalSize().columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + bold(textColors.banner.title.${\n variant\n }(line)) + \" \".repeat(Math.max(Math.ceil((getTerminalSize().columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + borderColors.banner.outline.${variant}(\"${\n borderStyle.right\n }\"), { consoleFn: console.${consoleFnName} });\n }); `}\n </Show>\n {children}\n <Show when={isSetString(command?.title)}>\n <Show when={insertNewlineBeforeCommand}>\n {code`writeLine(borderColors.banner.outline.${variant}(\"${\n borderStyle.left\n }\") + \" \".repeat(Math.max(getTerminalSize().columns - ${\n bannerPadding.value\n }, 0)) + borderColors.banner.outline.${variant}(\"${\n borderStyle.right\n }\"), { consoleFn: console.${consoleFnName} }); `}\n </Show>\n {code`writeLine(borderColors.banner.outline.${variant}(\"${\n borderStyle.left\n }\") + \" \".repeat(Math.max(Math.floor((getTerminalSize().columns - (stripAnsi(\"${formatDescription(\n command?.title || \"\"\n )}\").length + ${\n bannerPadding.value\n })) / 2), 0)) + bold(textColors.banner.command.${\n variant\n }(\"${formatDescription(\n command?.title || \"\"\n )}\")) + \" \".repeat(Math.max(Math.ceil((getTerminalSize().columns - (stripAnsi(\"${formatDescription(\n command?.title || \"\"\n )}\").length + ${\n bannerPadding.value\n })) / 2), 0)) + borderColors.banner.outline.${variant}(\"${\n borderStyle.right\n }\"), { consoleFn: console.${consoleFnName} }); `}\n </Show>\n <Spacing />\n {code`splitText(bold(textColors.banner.${\n command ? \"description\" : \"command\"\n }.${variant}(\\`${formatDescription(description)}\\`)), Math.max(${\n command\n ? `${\n totalPadding.value * 2\n } > getTerminalSize().columns / 2 ? getTerminalSize().columns - ${Math.max(\n bannerPadding.value + 4,\n 6\n )} : `\n : \"\"\n }getTerminalSize().columns - ${\n totalPadding.value\n }, 20)).forEach((line) => {\n writeLine(borderColors.banner.outline.${\n variant\n }(\"${borderStyle.left}\") + \" \".repeat(Math.max(Math.floor((getTerminalSize().columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + textColors.banner.description.${\n variant\n }(line) + \" \".repeat(Math.max(Math.ceil((getTerminalSize().columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + borderColors.banner.outline.${variant}(\"${\n borderStyle.right\n }\"), { consoleFn: console.${consoleFnName} });\n }); `}\n <Spacing />\n <Show when={insertNewlineAfterDescription}>\n {code`writeLine(borderColors.banner.outline.${variant}(\"${\n borderStyle.left\n }\") + \" \".repeat(Math.max(getTerminalSize().columns - ${\n bannerPadding.value\n }, 0)) + borderColors.banner.outline.${variant}(\"${\n borderStyle.right\n }\"), { consoleFn: console.${consoleFnName} }); `}\n </Show>\n <Spacing />\n {code`writeLine(borderColors.banner.outline.${variant}(\"${\n borderStyle.bottomLeft\n }\") + ${\n footer\n ? `borderColors.banner.outline.${variant}(\"${\n borderStyle.bottom\n }\".repeat(Math.max(getTerminalSize().columns - ${\n footerStaticWidth.value\n }, 0))) + \" \" + bold(textColors.banner.footer.${\n variant\n }(\"${formatDescription(\n footer\n )}\")) + \" \" + borderColors.banner.outline.${variant}(\"${\n borderStyle.bottom\n }\".repeat(${headerRepeat.value}))`\n : `borderColors.banner.outline.${variant}(\"${\n borderStyle.bottom\n }\".repeat(Math.max(getTerminalSize().columns - ${\n borderStyle.bottomLeft.length + borderStyle.bottomRight.length\n }, 0)))`\n } + borderColors.banner.outline.${variant}(\"${\n borderStyle.bottomRight\n }\"), { consoleFn: console.${consoleFnName} }); `}\n <Spacing />\n {code`writeLine(\"\"); `}\n </>\n );\n}\n\nexport interface BannerFunctionDeclarationProps extends BannerFunctionDeclarationWrapperProps {\n variant?: ThemeColorVariant;\n consoleFnName?: \"log\" | \"info\" | \"warn\" | \"error\" | \"debug\";\n insertNewlineBeforeBanner?: boolean;\n}\n\n/**\n * A component to generate the `banner` function for a specific command or application.\n *\n * @remarks\n * This function will display a banner in the console with the application's name, version, and description. It can be customized with different variants for styling and supports conditional rendering based on flags or environment variables.\n */\nexport function BannerFunctionDeclaration(\n props: BannerFunctionDeclarationProps\n) {\n const {\n consoleFnName = \"log\",\n variant = \"primary\",\n command,\n children,\n insertNewlineBeforeBanner = true\n } = props;\n\n const theme = useTheme();\n const context = usePowerlines<BannerPluginContext>();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context, false)} v${\n context.packageJson.version || \"1.0.0\"\n }`\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n const title = computed(\n () =>\n context.config.banner.title ||\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 return (\n <BannerFunctionDeclarationWrapper command={command}>\n <BannerFunctionBodyDeclaration\n title={!children ? title.value : undefined}\n header={header.value}\n description={description.value}\n footer={footer.value}\n variant={variant}\n consoleFnName={consoleFnName}\n command={command}\n insertNewlineBeforeCommand\n insertNewlineBeforeBanner={insertNewlineBeforeBanner}>\n {children}\n </BannerFunctionBodyDeclaration>\n </BannerFunctionDeclarationWrapper>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiCA,SAAS,iCAAqC,OAAM;CACpD,MAAO,EACP,SACA;CAEA,MAAO,UAAU,eAAA;AACf,QAAO,CAAC,gBAAa,OAAA;EACrB,IAAA,UAAW;AACb,UAAA,aAAA,YAAA,SAAA,KAAA,CAAA,6CAAA,UAAA,WAAA,QAAA,MAAA,aAAA,GAAA;;EAEE,IAAA,WAAA;AACG,UAAA,gBAA0B,YAAS;IACvC,MAAA;IACG,UAAA;IACG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D;EACN,IAAI,WAAA;;IAEA,IAAA,QAAU;AACX,YAAS,CAAA,WAAA,MAAA,QAAA;;IAET,IAAA,SAAS;AACT,YAAK,OAAU;;IAEd,IAAI,cAAa;AACjB,YAAA,YAAA;;IAEA,IAAA,SAAA;AACE,YAAO,OAAK;;IAEL;IACH;IACC;IACP,4BAAK;IACmB;IACd;IACX,CAAC;;EAEL,CAAC"}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.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 { For } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport { computeBin, getCommandList } from \"@shell-shock/core/plugin-utils\";\nimport console from \"@shell-shock/plugin-console\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport type { Plugin } from \"powerlines\";\nimport { BannerBuiltin } from \"./components\";\nimport type { BannerPluginContext, BannerPluginOptions } from \"./types/plugin\";\n\nexport type * from \"./types\";\n\n/**\n * The Banner - Shell Shock plugin to add a banner command to the application.\n */\nexport const plugin = <\n TContext extends BannerPluginContext = BannerPluginContext\n>(\n options: BannerPluginOptions = {}\n) => {\n return [\n ...theme(options.theme),\n console(options.console),\n {\n name: \"shell-shock:banner\",\n enforce: \"post\",\n config() {\n return {\n banner: {\n title: options.title\n }\n };\n },\n prepare: {\n async handler() {\n const commands = await getCommandList(this);\n this.debug(\n `Rendering \\`banner\\` built-ins for each of the ${\n commands.length\n } command modules.`\n );\n\n return render(\n this,\n <>\n <BannerBuiltin command={computeBin(this)} />\n <Spacing />\n <For\n each={commands.sort((a, b) => a.name.localeCompare(b.name))}\n doubleHardline>\n {command => <BannerBuiltin command={command} />}\n </For>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.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 { For } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport { computeBin, getCommandList } from \"@shell-shock/core/plugin-utils\";\nimport console from \"@shell-shock/plugin-console\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport type { Plugin } from \"powerlines\";\nimport { BannerBuiltin } from \"./components\";\nimport type { BannerPluginContext, BannerPluginOptions } from \"./types/plugin\";\n\nexport type * from \"./types\";\n\n/**\n * The Banner - Shell Shock plugin to add a banner command to the application.\n */\nexport const plugin = <\n TContext extends BannerPluginContext = BannerPluginContext\n>(\n options: BannerPluginOptions = {}\n) => {\n return [\n ...theme(options.theme),\n console(options.console),\n {\n name: \"shell-shock:banner\",\n enforce: \"post\",\n config() {\n return {\n banner: {\n title: options.title\n }\n };\n },\n prepare: {\n async handler() {\n const commands = await getCommandList(this);\n this.debug(\n `Rendering \\`banner\\` built-ins for each of the ${\n commands.length\n } command modules.`\n );\n\n return render(\n this,\n <>\n <BannerBuiltin command={computeBin(this)} />\n <Spacing />\n <For\n each={commands.sort((a, b) => a.name.localeCompare(b.name))}\n doubleHardline>\n {command => <BannerBuiltin command={command} />}\n </For>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;AA8BE,QAAA;EAAA,GAAA,MAAA,QAAA,MAAA;EAAA,QAAA,QAAA,QAAA;EAAA;GACC,MAAI;GACL,SAAA;GACF,SAAa;AACX,WAAS,EACV,QAAA,EACS,OAAC,QAAA,OACN,EACH;;GAEE,SAAQ,EACR,MAAA,UAAA;IACE,MAAO,SAAM;IACb,MAAQ,WAAO,MAAA,eAAA,KAAA;AACf,SAAO,MAAE,kDAAA,SAAA,OAAA,mBAAA;AACP,WAAO,OAAA,MAAA;KAAA,gBAAA,eAAA,EACL,IAAA,UAAQ;AACN,aAAO,WAAQ,OAAA;QAElB,CAAA;KAAA,gBAAA,SAAA,EAAA,CAAA;KAAA,gBAAA,KAAA;MACF,IAAA,OAAA;AACD,cAAS,SAAA,MAAA,GAAA,MAAA,EAAA,KAAA,cAAA,EAAA,KAAA,CAAA;;MAEL,gBAAgB;MAChB,WAAU,YAAA,gBAAA,eAAA,EACP,SACF,CAAC;MACH,CAAC;KAAC,CAAC;;GAGT;EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/plugin-banner",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.37",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing a Shell Shock plugin to generate banner built-in modules that display information about the application.",
|
|
6
6
|
"keywords": [
|
|
@@ -52,19 +52,19 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@alloy-js/core": "0.23.0-dev.8",
|
|
54
54
|
"@alloy-js/typescript": "0.23.0-dev.4",
|
|
55
|
-
"@powerlines/deepkit": "^0.8.
|
|
56
|
-
"@powerlines/plugin-alloy": "^0.26.
|
|
57
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
58
|
-
"@shell-shock/core": "^0.17.
|
|
59
|
-
"@shell-shock/plugin-theme": "^0.4.
|
|
60
|
-
"@shell-shock/plugin-console": "^0.2.
|
|
61
|
-
"@stryke/path": "^0.
|
|
62
|
-
"@stryke/type-checks": "^0.6.
|
|
55
|
+
"@powerlines/deepkit": "^0.8.64",
|
|
56
|
+
"@powerlines/plugin-alloy": "^0.26.84",
|
|
57
|
+
"@powerlines/plugin-plugin": "^0.12.416",
|
|
58
|
+
"@shell-shock/core": "^0.17.10",
|
|
59
|
+
"@shell-shock/plugin-theme": "^0.4.23",
|
|
60
|
+
"@shell-shock/plugin-console": "^0.2.14",
|
|
61
|
+
"@stryke/path": "^0.28.2",
|
|
62
|
+
"@stryke/type-checks": "^0.6.5",
|
|
63
63
|
"defu": "^6.1.7",
|
|
64
|
-
"powerlines": "^0.
|
|
64
|
+
"powerlines": "^0.47.4"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@powerlines/plugin-deepkit": "^0.11.
|
|
67
|
+
"@powerlines/plugin-deepkit": "^0.11.347",
|
|
68
68
|
"@types/node": "^25.6.0"
|
|
69
69
|
},
|
|
70
70
|
"publishConfig": { "access": "public" },
|
|
@@ -155,5 +155,5 @@
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
},
|
|
158
|
-
"gitHead": "
|
|
158
|
+
"gitHead": "7b4030fd6be000c960e8cc4c4f7b4db205054e69"
|
|
159
159
|
}
|