@shell-shock/preset-script 0.2.1 → 0.3.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.
Files changed (58) hide show
  1. package/README.md +1 -1
  2. package/dist/components/args-parser-logic.d.cts +7 -7
  3. package/dist/components/args-parser-logic.d.mts +7 -7
  4. package/dist/components/args-parser-logic.d.mts.map +1 -1
  5. package/dist/components/bin-entry.cjs +0 -1
  6. package/dist/components/bin-entry.cjs.map +1 -1
  7. package/dist/components/bin-entry.d.cts.map +1 -1
  8. package/dist/components/bin-entry.d.mts.map +1 -1
  9. package/dist/components/bin-entry.mjs +0 -1
  10. package/dist/components/bin-entry.mjs.map +1 -1
  11. package/dist/components/command-entry.d.cts +4 -4
  12. package/dist/components/command-entry.d.mts +4 -4
  13. package/dist/components/command-router.cjs +2 -2
  14. package/dist/components/command-router.cjs.map +1 -1
  15. package/dist/components/command-router.mjs +2 -2
  16. package/dist/components/command-router.mjs.map +1 -1
  17. package/dist/components/console-builtin.cjs +246 -34
  18. package/dist/components/console-builtin.cjs.map +1 -1
  19. package/dist/components/console-builtin.d.cts +12 -2
  20. package/dist/components/console-builtin.d.cts.map +1 -1
  21. package/dist/components/console-builtin.d.mts +12 -2
  22. package/dist/components/console-builtin.d.mts.map +1 -1
  23. package/dist/components/console-builtin.mjs +247 -36
  24. package/dist/components/console-builtin.mjs.map +1 -1
  25. package/dist/components/help.cjs +4 -4
  26. package/dist/components/help.cjs.map +1 -1
  27. package/dist/components/help.d.mts +5 -5
  28. package/dist/components/help.mjs +4 -4
  29. package/dist/components/help.mjs.map +1 -1
  30. package/dist/components/index.cjs +1 -0
  31. package/dist/components/index.d.cts +2 -2
  32. package/dist/components/index.d.mts +2 -2
  33. package/dist/components/index.mjs +2 -2
  34. package/dist/components/utils-builtin.cjs +18 -16
  35. package/dist/components/utils-builtin.cjs.map +1 -1
  36. package/dist/components/utils-builtin.d.cts.map +1 -1
  37. package/dist/components/utils-builtin.d.mts +7 -7
  38. package/dist/components/utils-builtin.d.mts.map +1 -1
  39. package/dist/components/utils-builtin.mjs +18 -16
  40. package/dist/components/utils-builtin.mjs.map +1 -1
  41. package/dist/components/virtual-command-entry.d.mts +3 -3
  42. package/dist/components/virtual-command-entry.d.mts.map +1 -1
  43. package/dist/helpers/ansi-utils.cjs +74 -10
  44. package/dist/helpers/ansi-utils.cjs.map +1 -1
  45. package/dist/helpers/ansi-utils.mjs +74 -10
  46. package/dist/helpers/ansi-utils.mjs.map +1 -1
  47. package/dist/helpers/get-default-options.cjs +20 -0
  48. package/dist/helpers/get-default-options.cjs.map +1 -1
  49. package/dist/helpers/get-default-options.mjs +20 -0
  50. package/dist/helpers/get-default-options.mjs.map +1 -1
  51. package/dist/index.cjs +10 -8
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.d.cts.map +1 -1
  54. package/dist/index.d.mts.map +1 -1
  55. package/dist/index.mjs +11 -9
  56. package/dist/index.mjs.map +1 -1
  57. package/dist/types/plugin.d.mts.map +1 -1
  58. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"file":"utils-builtin.mjs","names":["code","Show","splitProps","FunctionDeclaration","InterfaceDeclaration","InterfaceMember","VarDeclaration","usePowerlines","BuiltinFile","TSDoc","TSDocLink","TSDocParam","TSDocReturns","getAppTitle","defu","EnvSupportUtilities","_$createComponent","name","doc","initializer","_$createIntrinsic","ColorSupportUtilities","children","type","heading","parameters","default","HyperlinkSupportUtilities","returnType","ArgsUtilities","ExitFunctionDeclaration","context","optional","async","UtilsBuiltin","props","rest","_$mergeProps","id","description","imports","builtinImports","console","env","when","Boolean"],"sources":["../../src/components/utils-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, Show, splitProps } from \"@alloy-js/core\";\nimport {\n FunctionDeclaration,\n InterfaceDeclaration,\n InterfaceMember,\n VarDeclaration\n} from \"@alloy-js/typescript\";\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 {\n TSDoc,\n TSDocLink,\n TSDocParam,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\nexport interface UtilsBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\n\nexport function EnvSupportUtilities() {\n return (\n <>\n <VarDeclaration\n export\n const\n name=\"isTTY\"\n doc=\"Detect if stdout.TTY is available\"\n initializer={code`Boolean(process.stdout && process.stdout.isTTY);`}\n />\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"isMinimal\"\n doc=\"Detect if the current environment is minimal (CI, non-TTY, etc.)\"\n initializer={code` env.MINIMAL || isCI || isTest || !isTTY; `}\n />\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"isInteractive\"\n doc=\"Detect if the current environment is interactive\"\n initializer={code` !isMinimal && process.stdin?.isTTY && env.TERM !== \"dumb\"; `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ColorSupportUtilities() {\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"GetColorSupportLevelOptions\"\n doc=\"Options for the getColorSupportLevel function\">\n <InterfaceMember\n name=\"ignoreFlags\"\n type=\"boolean\"\n doc=\"Indicates if the function should skip checking command-line flags for color support\"\n />\n </InterfaceDeclaration>\n <hbr />\n <hbr />\n <TSDoc heading=\"Checks if a specific flag is present in the command line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {'The flag to check for, e.g., \"color\", \"no-color\".'}\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getColorSupportLevel\"\n parameters={[\n { name: \"stream\", type: \"NodeJS.WriteStream & { fd: 1 | 2; }\" },\n {\n name: \"options\",\n type: \"GetColorSupportLevelOptions\",\n default: \"{ ignoreFlags: false }\"\n }\n ]}>\n {code`const { ignoreFlags } = options;\n\n let forceColor: number | undefined;\n if (env.FORCE_COLOR !== undefined) {\n forceColor = !env.FORCE_COLOR\n ? 0\n : typeof env.FORCE_COLOR === \"boolean\"\n ? 1\n : typeof env.FORCE_COLOR === \"number\" &&\n [0, 1, 2, 3].includes(Math.min(env.FORCE_COLOR as number, 3))\n ? Math.min(env.FORCE_COLOR as number, 3)\n : undefined;\n }\n\n if (ignoreFlags !== true && forceColor === undefined) {\n forceColor = hasFlag(\"no-color\") ||\n hasFlag(\"no-colors\") ||\n hasFlag(\"color=false\") ||\n hasFlag(\"color=never\")\n ? 0\n : hasFlag(\"color\") ||\n hasFlag(\"colors\") ||\n hasFlag(\"color=true\") ||\n hasFlag(\"color=always\")\n ? 1\n : 0;\n }\n\n if (forceColor === 0) {\n return 0;\n }\n\n if (ignoreFlags !== true) {\n if (hasFlag(\"color=16m\") ||\n hasFlag(\"color=full\") ||\n hasFlag(\"color=truecolor\")) {\n return 3;\n }\n\n if (hasFlag(\"color=256\")) {\n return 2;\n }\n }\n\n const level = Boolean(env.TF_BUILD) || Boolean(env.AGENT_NAME)\n ? 1\n : stream &&\n !(isTTY || (stream && stream.isTTY)) &&\n forceColor === undefined\n ? 0\n : env.TERM === \"dumb\"\n ? forceColor || 0\n : isWindows\n ? Number(os.release().split(\".\")[0]) >= 10 &&\n Number(os.release().split(\".\")[2]) >= 10_586\n ? Number(os.release().split(\".\")[2]) >= 14_931\n ? 3\n : 2\n : 1\n : isCI\n ? Boolean(env.GITHUB_ACTIONS) ||\n Boolean(env.GITEA_ACTIONS) ||\n Boolean(env.CIRCLECI)\n ? 3\n : Boolean(env.TRAVIS) ||\n Boolean(env.APPVEYOR) ||\n Boolean(env.GITLAB_CI) ||\n Boolean(env.BUILDKITE) ||\n Boolean(env.DRONE) ||\n env.CI_NAME === \"codeship\"\n ? 1\n : forceColor || 0\n : Boolean(env.TEAMCITY_VERSION)\n ? /^(?:9\\.0*[1-9]\\d*\\.|\\d{2,}\\.)/.test(String(env.TEAMCITY_VERSION) || \"\")\n ? 1\n : 0\n : String(env.COLORTERM) === \"truecolor\" ||\n env.TERM === \"xterm-kitty\"\n ? 3\n : Boolean(env.TERM_PROGRAM)\n ? env.TERM_PROGRAM === \"iTerm.app\"\n ? Number.parseInt(\n (env.TERM_PROGRAM_VERSION || \"\").split(\".\")[0] as string,\n 10\n ) >= 3\n ? 3\n : 2\n : env.TERM_PROGRAM === \"Apple_Terminal\"\n ? 2\n : 0\n : /-256(?:color)?$/i.test(env.TERM || \"\")\n ? 2\n : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(\n env.TERM || \"\"\n )\n ? 1\n : Boolean(env.COLORTERM);\n\n return typeof level === \"boolean\" || level === 0\n ? false\n : {\n level,\n hasBasic: true,\n has256: level >= 2,\n has16m: level >= 3,\n };\n\n `}\n </FunctionDeclaration>\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"colorSupportLevels\"\n doc=\"Detect the terminal color support level in the current environment\"\n initializer={code` {\n stdout: getColorSupportLevel(process.stdout),\n stderr: getColorSupportLevel(process.stderr),\n }; `}\n />\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"isColorSupported\"\n doc=\"Detect if terminal color is supported in the current environment\"\n initializer={code` Boolean(colorSupportLevels.stdout); `}\n />\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"isUnicodeSupported\"\n doc=\"Detect if Unicode characters are supported in the current environment\"\n initializer={code` !isWindows\n ? env.TERM !== \"linux\"\n : Boolean(env.WT_SESSION) ||\n Boolean(env.TERMINUS_SUBLIME) ||\n env.ConEmuTask === \"{cmd::Cmder}\" ||\n env.TERM_PROGRAM === \"Terminus-Sublime\" ||\n env.TERM_PROGRAM === \"vscode\" ||\n env.TERM === \"xterm-256color\" ||\n env.TERM === \"alacritty\" ||\n env.TERM === \"rxvt-unicode\" ||\n env.TERM === \"rxvt-unicode-256color\" ||\n env.TERMINAL_EMULATOR === \"JetBrains-JediTerm\"; `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\n\nexport function HyperlinkSupportUtilities() {\n return (\n <>\n <FunctionDeclaration\n name=\"parseVersion\"\n parameters={[{ name: \"version\", type: \"string\", default: '\"\"' }]}>\n {code`if (/^\\d{3,4}$/.test(version)) {\n const match = /(\\d{1,2})(\\d{2})/.exec(version) ?? [];\n\n return {\n major: 0,\n minor: Number.parseInt(match[1]!, 10),\n patch: Number.parseInt(match[2]!, 10)\n };\n }\n\n const versionParts = (version ?? \"\")\n .split(\".\")\n .map(n => Number.parseInt(n, 10));\n\n return {\n major: versionParts[0],\n minor: versionParts[1],\n patch: versionParts[2]\n }; `}\n </FunctionDeclaration>\n <hbr />\n <hbr />\n <TSDoc heading=\"Check if the current environment/terminal supports hyperlinks in the terminal.\">\n <TSDocReturns>\n {\"True if the current environment/terminal supports hyperlinks.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"isHyperlinkSupported\"\n returnType=\"boolean\">\n {code`if (Boolean(env.FORCE_HYPERLINK)) {\n return true;\n }\n\n if (Boolean(env.NETLIFY)) {\n return true;\n } else if (isColorSupported || isTTY) {\n return false;\n } else if (Boolean(env.WT_SESSION)) {\n return true;\n } else if (isWindows || isMinimal || Boolean(env.TEAMCITY_VERSION)) {\n return false;\n } else if (Boolean(env.TERM_PROGRAM)) {\n const version = parseVersion(env.TERM_PROGRAM_VERSION);\n\n switch (String(env.TERM_PROGRAM)) {\n case \"iTerm.app\": {\n if (version.major === 3) {\n return version.minor !== undefined && version.minor >= 1;\n }\n\n return version.major !== undefined && version.major > 3;\n }\n case \"WezTerm\": {\n return version.major !== undefined && version.major >= 20_200_620;\n }\n\n case \"vscode\": {\n if (Boolean(env.CURSOR_TRACE_ID)) {\n return true;\n }\n\n return (\n version.minor !== undefined &&\n version.major !== undefined &&\n (version.major > 1 || (version.major === 1 && version.minor >= 72))\n );\n }\n\n case \"ghostty\": {\n return true;\n }\n }\n }\n\n if (Boolean(env.VTE_VERSION)) {\n if (env.VTE_VERSION === \"0.50.0\") {\n return false;\n }\n\n const version = parseVersion(env.VTE_VERSION);\n return (\n (version.major !== undefined && version.major > 0) ||\n (version.minor !== undefined && version.minor >= 50)\n );\n }\n\n if (String(env.TERM) === \"alacritty\") {\n return true;\n }\n\n return false; `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ArgsUtilities() {\n return (\n <>\n <TSDoc heading=\"Retrieves the command line arguments from Deno or Node.js environments.\">\n <TSDocReturns>\n {\n \"An array of command line arguments from Deno or Node.js environments.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"getArgs\">\n {code`return ((globalThis as { Deno?: { args: string[] } })?.Deno?.args ?? process.argv ?? []) as string[];`}\n </FunctionDeclaration>\n <hbr />\n <hbr />\n <TSDoc heading=\"Checks if a specific flag is present in the command line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {\n 'The flag (or an array of flags/aliases) to check for, e.g., \"color\", \"no-color\".'\n }\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"hasFlag\"\n parameters={[\n { name: \"flag\", type: \"string | string[]\" },\n {\n name: \"argv\",\n type: \"string[]\",\n default: \"getArgs()\"\n }\n ]}>\n <VarDeclaration\n const\n name=\"position\"\n type=\"number\"\n initializer={code`(Array.isArray(flag) ? flag : [flag]).reduce((ret, f) => {\n const pos = argv.findIndex(arg => (f.startsWith(\"-\") ? \"\" : (f.length === 1 ? \"-\" : \"--\") + f)?.toLowerCase() === arg?.toLowerCase() || arg?.toLowerCase().startsWith((f.length === 1 ? \"-\" : \"--\") + f + \"=\"));\n return pos !== -1 ? pos : ret;\n }, -1);`}\n />\n <hbr />\n {code`return position !== -1 && argv.indexOf(\"--\") === -1 || position < argv.indexOf(\"--\");`}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * The `exit` handler function declaration code for the Shell Shock project.\n */\nexport function ExitFunctionDeclaration() {\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"ExitOptions\"\n doc=\"Options for the exit handler function.\">\n <InterfaceMember\n name=\"exception\"\n optional\n type=\"string | Error\"\n doc=\"An optional exception that caused the exit. This can be a string message or an Error object.\"\n />\n <hbr />\n <InterfaceMember\n name=\"skipProcessExit\"\n optional\n type=\"boolean\"\n doc=\"Indicates whether the exit function should manually exit the process or not. If set to true, the exit function will not call process.exit() and will allow the application to continue running. If set to false or not specified, the exit function will call process.exit() to terminate the application.\"\n />\n <hbr />\n <InterfaceMember\n name=\"isSynchronous\"\n optional\n type=\"boolean\"\n doc=\"Indicates whether the exit function should perform synchronous operations only. If set to true, the exit function will avoid any asynchronous operations during exit. If set to false or not specified, the exit function may perform asynchronous operations as needed.\"\n />\n <hbr />\n <InterfaceMember\n name=\"signal\"\n optional\n type=\"number\"\n doc=\"The signal number that triggered the exit. This is typically used when the shutdown is initiated by a system signal (e.g., SIGINT, SIGTERM).\"\n />\n </InterfaceDeclaration>\n <hbr />\n <hbr />\n <VarDeclaration\n let\n name=\"isExiting\"\n type=\"boolean\"\n initializer={code`false;`}\n />\n <VarDeclaration\n const\n name=\"callbackAsyncQueue\"\n type=\"Array<[(code: number | string) => Promise<void> | void, number]>\"\n initializer={code`[];`}\n />\n <VarDeclaration\n const\n name=\"callbackSyncQueue\"\n type=\"Array<(code: number | string) => void>\"\n initializer={code`[];`}\n />\n <hbr />\n <hbr />\n <FunctionDeclaration\n export\n async\n name=\"exit\"\n parameters={[\n {\n name: \"options\",\n type: \"ExitOptions\",\n default: \"{}\"\n }\n ]}>\n {code`\n try {\n if (isExiting) {\n return;\n }\n\n isExiting = true;\n\n let exitCode: number | string = 0;\n if ((options.signal !== undefined && options.signal > 0) || options.exception) {\n exitCode = 128 + (options.signal ?? 1);\n } else if (typeof process.exitCode === \"number\" || typeof process.exitCode === \"string\") {\n exitCode = process.exitCode;\n }\n\n if (options.exception) {\n error(\\`A fatal error occured while running the application - please contact the ${getAppTitle(\n context\n )} support team: \\\\n\\${typeof options.exception === \"string\" ? options.exception : options.exception.message}\\`);\n }\n\n const terminate = (force = false) => {\n verbose(\\`The ${getAppTitle(\n context\n )} application exited \\${options.exception ? \\`early due to an exception\\` : \"successfully\"}...\\`);\n if (!options.skipProcessExit) {\n process.exit(exitCode);\n }\n };\n\n for (const callbackSync of callbackSyncQueue) {\n callbackSync(exitCode);\n }\n\n if (!options.isSynchronous) {\n const promises = [];\n let forceAfter = 0;\n for (const [callbackAsync, wait] of callbackAsyncQueue) {\n forceAfter = Math.max(forceAfter, wait);\n promises.push(Promise.resolve(callbackAsync(exitCode)));\n }\n\n const asyncTimer = setTimeout(() => {\n terminate(true);\n }, forceAfter);\n await Promise.all(promises);\n clearTimeout(asyncTimer);\n }\n\n terminate();\n } catch (err) {\n error(\\`The exit process failed to complete\\${(err as Error).message ? \\` - (err as Error).message\\` : \"\"}. Please contact the ${getAppTitle(\n context\n )} support team.\\`);\n\n if (!options.skipProcessExit) {\n process.exit(1);\n }\n }\n `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A built-in utilities module for Shell Shock.\n */\nexport function UtilsBuiltin(props: UtilsBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <BuiltinFile\n id=\"utils\"\n description=\"A collection of helper utilities that ease command-line application development.\"\n {...rest}\n imports={defu(rest.imports ?? {}, {\n \"node:os\": \"os\",\n \"node:process\": \"process\"\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n console: [\"error\", \"verbose\"],\n env: [\"env\", \"isCI\", \"isTest\", \"isWindows\"]\n })}>\n <hbr />\n <hbr />\n <ArgsUtilities />\n <hbr />\n <hbr />\n <EnvSupportUtilities />\n <hbr />\n <hbr />\n <HyperlinkSupportUtilities />\n <hbr />\n <hbr />\n <ColorSupportUtilities />\n <hbr />\n <hbr />\n <ExitFunctionDeclaration />\n <hbr />\n <hbr />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA+CA,SAAgBe,sBAAsB;AACpC,QAAA;EAAAC,gBAEKV,gBAAc;GAAA,UAAA;GAAA,SAAA;GAGbW,MAAI;GACJC,KAAG;GACHC,aAAanB,IAAI;GAAkD,CAAA;EAAAoB,gBAAA,OAAA,EAAA,CAAA;EAAAA,gBAAA,OAAA,EAAA,CAAA;EAAAJ,gBAIpEV,gBAAc;GAAA,UAAA;GAAA,SAAA;GAGbW,MAAI;GACJC,KAAG;GACHC,aAAanB,IAAI;GAA4C,CAAA;EAAAoB,gBAAA,OAAA,EAAA,CAAA;EAAAA,gBAAA,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AAU;KAAW;IAC3C,CAAC;;EAAA,IAAArB,WAAA;AAAA,UAAA;IAAAF,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAJ,gBAGDa,eAAa,EAAA,CAAA;IAAAT,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAJ,gBAGbD,qBAAmB,EAAA,CAAA;IAAAK,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAJ,gBAGnBW,2BAAyB,EAAA,CAAA;IAAAP,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAJ,gBAGzBK,uBAAqB,EAAA,CAAA;IAAAD,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAJ,gBAGrBc,yBAAuB,EAAA,CAAA;IAAAV,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAJ,gBAGvBf,MAAI;KAAA,IAAC2C,OAAI;AAAA,aAAEC,QAAQvB,SAAS;;KAAGA;KAAQ,CAAA;IAAA;;EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"utils-builtin.mjs","names":["code","Show","splitProps","FunctionDeclaration","InterfaceDeclaration","InterfaceMember","VarDeclaration","usePowerlines","BuiltinFile","TSDoc","TSDocLink","TSDocParam","TSDocReturns","getAppTitle","defu","EnvSupportUtilities","_$createComponent","name","doc","initializer","_$createIntrinsic","ColorSupportUtilities","children","type","heading","parameters","default","HyperlinkSupportUtilities","returnType","ArgsUtilities","ExitFunctionDeclaration","context","optional","async","UtilsBuiltin","props","rest","_$mergeProps","id","description","imports","builtinImports","console","env","when","Boolean"],"sources":["../../src/components/utils-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, Show, splitProps } from \"@alloy-js/core\";\nimport {\n FunctionDeclaration,\n InterfaceDeclaration,\n InterfaceMember,\n VarDeclaration\n} from \"@alloy-js/typescript\";\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 {\n TSDoc,\n TSDocLink,\n TSDocParam,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\nexport interface UtilsBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\n\nexport function EnvSupportUtilities() {\n return (\n <>\n <VarDeclaration\n export\n const\n name=\"isTTY\"\n doc=\"Detect if stdout.TTY is available\"\n initializer={code`Boolean(process.stdout && process.stdout.isTTY);`}\n />\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"isMinimal\"\n doc=\"Detect if the current environment is minimal (CI, non-TTY, etc.)\"\n initializer={code` env.MINIMAL || isCI || isTest || !isTTY; `}\n />\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"isInteractive\"\n doc=\"Detect if the current environment is interactive\"\n initializer={code` !isMinimal && process.stdin?.isTTY && env.TERM !== \"dumb\"; `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ColorSupportUtilities() {\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"GetColorSupportLevelOptions\"\n doc=\"Options for the getColorSupportLevel function\">\n <InterfaceMember\n name=\"ignoreFlags\"\n type=\"boolean\"\n doc=\"Indicates if the function should skip checking command-line flags for color support\"\n />\n </InterfaceDeclaration>\n <hbr />\n <hbr />\n <TSDoc heading=\"Checks if a specific flag is present in the command line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {'The flag to check for, e.g., \"color\", \"no-color\".'}\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getColorSupportLevel\"\n parameters={[\n { name: \"stream\", type: \"NodeJS.WriteStream & { fd: 1 | 2; }\" },\n {\n name: \"options\",\n type: \"GetColorSupportLevelOptions\",\n default: \"{ ignoreFlags: false }\"\n }\n ]}>\n {code`const { ignoreFlags } = options;\n\n let forceColor: number | undefined;\n if (env.FORCE_COLOR !== undefined) {\n forceColor = !env.FORCE_COLOR\n ? 0\n : typeof env.FORCE_COLOR === \"boolean\"\n ? 1\n : typeof env.FORCE_COLOR === \"number\" &&\n [0, 1, 2, 3].includes(Math.min(env.FORCE_COLOR as number, 3))\n ? Math.min(env.FORCE_COLOR as number, 3)\n : undefined;\n }\n\n if (ignoreFlags !== true && forceColor === undefined) {\n if (\n hasFlag(\"no-color\") ||\n hasFlag(\"no-colors\") ||\n hasFlag(\"color=false\") ||\n hasFlag(\"color=never\")\n ) {\n return 0;\n }\n\n if (\n hasFlag(\"color=16m\") ||\n hasFlag(\"color=full\") ||\n hasFlag(\"color=truecolor\")\n ) {\n return 3;\n }\n\n if (hasFlag(\"color=256\")) {\n return 2;\n }\n\n if (\n hasFlag(\"color\") ||\n hasFlag(\"colors\") ||\n hasFlag(\"color=true\") ||\n hasFlag(\"color=always\")\n ) {\n forceColor = 1;\n }\n }\n\n const level = Boolean(env.TF_BUILD) || Boolean(env.AGENT_NAME)\n ? 1\n : stream &&\n !(isTTY || (stream && stream.isTTY)) &&\n forceColor === undefined\n ? 0\n : env.TERM === \"dumb\"\n ? forceColor || 0\n : isWindows\n ? Number(os.release().split(\".\")[0]) >= 10 &&\n Number(os.release().split(\".\")[2]) >= 10_586\n ? Number(os.release().split(\".\")[2]) >= 14_931\n ? 3\n : 2\n : 1\n : isCI\n ? Boolean(env.GITHUB_ACTIONS) ||\n Boolean(env.GITEA_ACTIONS) ||\n Boolean(env.CIRCLECI)\n ? 3\n : Boolean(env.TRAVIS) ||\n Boolean(env.APPVEYOR) ||\n Boolean(env.GITLAB_CI) ||\n Boolean(env.BUILDKITE) ||\n Boolean(env.DRONE) ||\n env.CI_NAME === \"codeship\"\n ? 1\n : forceColor || 0\n : Boolean(env.TEAMCITY_VERSION)\n ? /^(?:9\\.0*[1-9]\\d*\\.|\\d{2,}\\.)/.test(String(env.TEAMCITY_VERSION) || \"\")\n ? 1\n : 0\n : String(env.COLORTERM) === \"truecolor\" ||\n env.TERM === \"xterm-kitty\"\n ? 3\n : Boolean(env.TERM_PROGRAM)\n ? env.TERM_PROGRAM === \"iTerm.app\"\n ? Number.parseInt(\n (env.TERM_PROGRAM_VERSION || \"\").split(\".\")[0] as string,\n 10\n ) >= 3\n ? 3\n : 2\n : env.TERM_PROGRAM === \"Apple_Terminal\"\n ? 2\n : 0\n : /-256(?:color)?$/i.test(env.TERM || \"\")\n ? 2\n : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(\n env.TERM || \"\"\n )\n ? 1\n : Boolean(env.COLORTERM);\n\n return typeof level === \"boolean\" || level === 0\n ? false\n : {\n level,\n hasBasic: true,\n has256: level >= 2,\n has16m: level >= 3,\n };\n\n `}\n </FunctionDeclaration>\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"colorSupportLevels\"\n doc=\"Detect the terminal color support level in the current environment\"\n initializer={code` {\n stdout: getColorSupportLevel(process.stdout),\n stderr: getColorSupportLevel(process.stderr),\n }; `}\n />\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"isColorSupported\"\n doc=\"Detect if terminal color is supported in the current environment\"\n initializer={code` Boolean(colorSupportLevels.stdout); `}\n />\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"isUnicodeSupported\"\n doc=\"Detect if Unicode characters are supported in the current environment\"\n initializer={code` !isWindows\n ? env.TERM !== \"linux\"\n : Boolean(env.WT_SESSION) ||\n Boolean(env.TERMINUS_SUBLIME) ||\n env.ConEmuTask === \"{cmd::Cmder}\" ||\n env.TERM_PROGRAM === \"Terminus-Sublime\" ||\n env.TERM_PROGRAM === \"vscode\" ||\n env.TERM === \"xterm-256color\" ||\n env.TERM === \"alacritty\" ||\n env.TERM === \"rxvt-unicode\" ||\n env.TERM === \"rxvt-unicode-256color\" ||\n env.TERMINAL_EMULATOR === \"JetBrains-JediTerm\"; `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\n\nexport function HyperlinkSupportUtilities() {\n return (\n <>\n <FunctionDeclaration\n name=\"parseVersion\"\n parameters={[{ name: \"version\", type: \"string\", default: '\"\"' }]}>\n {code`if (/^\\d{3,4}$/.test(version)) {\n const match = /(\\d{1,2})(\\d{2})/.exec(version) ?? [];\n\n return {\n major: 0,\n minor: Number.parseInt(match[1]!, 10),\n patch: Number.parseInt(match[2]!, 10)\n };\n }\n\n const versionParts = (version ?? \"\")\n .split(\".\")\n .map(n => Number.parseInt(n, 10));\n\n return {\n major: versionParts[0],\n minor: versionParts[1],\n patch: versionParts[2]\n }; `}\n </FunctionDeclaration>\n <hbr />\n <hbr />\n <TSDoc heading=\"Check if the current environment/terminal supports hyperlinks in the terminal.\">\n <TSDocReturns>\n {\"True if the current environment/terminal supports hyperlinks.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"isHyperlinkSupported\"\n returnType=\"boolean\">\n {code`if (Boolean(env.FORCE_HYPERLINK)) {\n return true;\n }\n\n if (Boolean(env.NETLIFY)) {\n return true;\n } else if (isColorSupported || isTTY) {\n return false;\n } else if (Boolean(env.WT_SESSION)) {\n return true;\n } else if (isWindows || isMinimal || Boolean(env.TEAMCITY_VERSION)) {\n return false;\n } else if (Boolean(env.TERM_PROGRAM)) {\n const version = parseVersion(env.TERM_PROGRAM_VERSION);\n\n switch (String(env.TERM_PROGRAM)) {\n case \"iTerm.app\": {\n if (version.major === 3) {\n return version.minor !== undefined && version.minor >= 1;\n }\n\n return version.major !== undefined && version.major > 3;\n }\n case \"WezTerm\": {\n return version.major !== undefined && version.major >= 20_200_620;\n }\n\n case \"vscode\": {\n if (Boolean(env.CURSOR_TRACE_ID)) {\n return true;\n }\n\n return (\n version.minor !== undefined &&\n version.major !== undefined &&\n (version.major > 1 || (version.major === 1 && version.minor >= 72))\n );\n }\n\n case \"ghostty\": {\n return true;\n }\n }\n }\n\n if (Boolean(env.VTE_VERSION)) {\n if (env.VTE_VERSION === \"0.50.0\") {\n return false;\n }\n\n const version = parseVersion(env.VTE_VERSION);\n return (\n (version.major !== undefined && version.major > 0) ||\n (version.minor !== undefined && version.minor >= 50)\n );\n }\n\n if (String(env.TERM) === \"alacritty\") {\n return true;\n }\n\n return false; `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ArgsUtilities() {\n return (\n <>\n <TSDoc heading=\"Retrieves the command line arguments from Deno or Node.js environments.\">\n <TSDocReturns>\n {\n \"An array of command line arguments from Deno or Node.js environments.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"getArgs\">\n {code`return ((globalThis as { Deno?: { args: string[] } })?.Deno?.args ?? process.argv ?? []) as string[];`}\n </FunctionDeclaration>\n <hbr />\n <hbr />\n <TSDoc heading=\"Checks if a specific flag is present in the command line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {\n 'The flag (or an array of flags/aliases) to check for, e.g., \"color\", \"no-color\".'\n }\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"hasFlag\"\n parameters={[\n { name: \"flag\", type: \"string | string[]\" },\n {\n name: \"argv\",\n type: \"string[]\",\n default: \"getArgs()\"\n }\n ]}>\n <VarDeclaration\n const\n name=\"position\"\n type=\"number\"\n initializer={code`(Array.isArray(flag) ? flag : [flag]).reduce((ret, f) => {\n const pos = argv.findIndex(arg => (f.startsWith(\"-\") ? \"\" : (f.length === 1 ? \"-\" : \"--\") + f)?.toLowerCase() === arg?.toLowerCase() || arg?.toLowerCase().startsWith((f.length === 1 ? \"-\" : \"--\") + f + \"=\"));\n return pos !== -1 ? pos : ret;\n }, -1);`}\n />\n <hbr />\n {code`return position !== -1 && argv.indexOf(\"--\") === -1 || position < argv.indexOf(\"--\");`}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * The `exit` handler function declaration code for the Shell Shock project.\n */\nexport function ExitFunctionDeclaration() {\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"ExitOptions\"\n doc=\"Options for the exit handler function.\">\n <InterfaceMember\n name=\"exception\"\n optional\n type=\"string | Error\"\n doc=\"An optional exception that caused the exit. This can be a string message or an Error object.\"\n />\n <hbr />\n <InterfaceMember\n name=\"skipProcessExit\"\n optional\n type=\"boolean\"\n doc=\"Indicates whether the exit function should manually exit the process or not. If set to true, the exit function will not call process.exit() and will allow the application to continue running. If set to false or not specified, the exit function will call process.exit() to terminate the application.\"\n />\n <hbr />\n <InterfaceMember\n name=\"isSynchronous\"\n optional\n type=\"boolean\"\n doc=\"Indicates whether the exit function should perform synchronous operations only. If set to true, the exit function will avoid any asynchronous operations during exit. If set to false or not specified, the exit function may perform asynchronous operations as needed.\"\n />\n <hbr />\n <InterfaceMember\n name=\"signal\"\n optional\n type=\"number\"\n doc=\"The signal number that triggered the exit. This is typically used when the shutdown is initiated by a system signal (e.g., SIGINT, SIGTERM).\"\n />\n </InterfaceDeclaration>\n <hbr />\n <hbr />\n <VarDeclaration\n let\n name=\"isExiting\"\n type=\"boolean\"\n initializer={code`false;`}\n />\n <VarDeclaration\n const\n name=\"callbackAsyncQueue\"\n type=\"Array<[(code: number | string) => Promise<void> | void, number]>\"\n initializer={code`[];`}\n />\n <VarDeclaration\n const\n name=\"callbackSyncQueue\"\n type=\"Array<(code: number | string) => void>\"\n initializer={code`[];`}\n />\n <hbr />\n <hbr />\n <FunctionDeclaration\n export\n async\n name=\"exit\"\n parameters={[\n {\n name: \"options\",\n type: \"ExitOptions\",\n default: \"{}\"\n }\n ]}>\n {code`\n try {\n if (isExiting) {\n return;\n }\n\n isExiting = true;\n\n let exitCode: number | string = 0;\n if ((options.signal !== undefined && options.signal > 0) || options.exception) {\n exitCode = 128 + (options.signal ?? 1);\n } else if (typeof process.exitCode === \"number\" || typeof process.exitCode === \"string\") {\n exitCode = process.exitCode;\n }\n\n if (options.exception) {\n error(\\`A fatal error occured while running the application - please contact the ${getAppTitle(\n context\n )} support team: \\\\n\\${typeof options.exception === \"string\" ? options.exception : options.exception.message}\\`);\n }\n\n const terminate = (force = false) => {\n verbose(\\`The ${getAppTitle(\n context\n )} application exited \\${options.exception ? \\`early due to an exception\\` : \"successfully\"}...\\`);\n if (!options.skipProcessExit) {\n process.exit(exitCode);\n }\n };\n\n for (const callbackSync of callbackSyncQueue) {\n callbackSync(exitCode);\n }\n\n if (!options.isSynchronous) {\n const promises = [];\n let forceAfter = 0;\n for (const [callbackAsync, wait] of callbackAsyncQueue) {\n forceAfter = Math.max(forceAfter, wait);\n promises.push(Promise.resolve(callbackAsync(exitCode)));\n }\n\n const asyncTimer = setTimeout(() => {\n terminate(true);\n }, forceAfter);\n await Promise.all(promises);\n clearTimeout(asyncTimer);\n }\n\n terminate();\n } catch (err) {\n error(\\`The exit process failed to complete\\${(err as Error).message ? \\` - (err as Error).message\\` : \"\"}. Please contact the ${getAppTitle(\n context\n )} support team.\\`);\n\n if (!options.skipProcessExit) {\n process.exit(1);\n }\n }\n `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * A built-in utilities module for Shell Shock.\n */\nexport function UtilsBuiltin(props: UtilsBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <BuiltinFile\n id=\"utils\"\n description=\"A collection of helper utilities that ease command-line application development.\"\n {...rest}\n imports={defu(rest.imports ?? {}, {\n \"node:os\": \"os\",\n \"node:process\": \"process\"\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n console: [\"error\", \"verbose\"],\n env: [\"env\", \"isCI\", \"isTest\", \"isWindows\"]\n })}>\n <hbr />\n <hbr />\n <ArgsUtilities />\n <hbr />\n <hbr />\n <EnvSupportUtilities />\n <hbr />\n <hbr />\n <HyperlinkSupportUtilities />\n <hbr />\n <hbr />\n <ColorSupportUtilities />\n <hbr />\n <hbr />\n <ExitFunctionDeclaration />\n <hbr />\n <hbr />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA+CA,SAAgBe,sBAAsB;AACpC,QAAA;EAAAC,gBAEKV,gBAAc;GAAA,UAAA;GAAA,SAAA;GAGbW,MAAI;GACJC,KAAG;GACHC,aAAanB,IAAI;GAAkD,CAAA;EAAAoB,gBAAA,OAAA,EAAA,CAAA;EAAAA,gBAAA,OAAA,EAAA,CAAA;EAAAJ,gBAIpEV,gBAAc;GAAA,UAAA;GAAA,SAAA;GAGbW,MAAI;GACJC,KAAG;GACHC,aAAanB,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E;IAC9CC,SAAS,CAAC,SAAS,UAAU;IAC7BC,KAAK;KAAC;KAAO;KAAQ;KAAU;KAAW;IAC3C,CAAC;;EAAA,IAAArB,WAAA;AAAA,UAAA;IAAAF,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAJ,gBAGDa,eAAa,EAAA,CAAA;IAAAT,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAJ,gBAGbD,qBAAmB,EAAA,CAAA;IAAAK,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAJ,gBAGnBW,2BAAyB,EAAA,CAAA;IAAAP,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAJ,gBAGzBK,uBAAqB,EAAA,CAAA;IAAAD,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAJ,gBAGrBc,yBAAuB,EAAA,CAAA;IAAAV,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAJ,gBAGvBf,MAAI;KAAA,IAAC2C,OAAI;AAAA,aAAEC,QAAQvB,SAAS;;KAAGA;KAAQ,CAAA;IAAA;;EAAA,CAAA,CAAA"}
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core0 from "@alloy-js/core";
1
+ import * as _alloy_js_core15 from "@alloy-js/core";
2
2
  import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
3
3
  import { CommandTree } from "@shell-shock/core/types/command";
4
4
 
@@ -8,14 +8,14 @@ import { CommandTree } from "@shell-shock/core/types/command";
8
8
  */
9
9
  declare function VirtualCommandHandlerDeclaration(props: {
10
10
  command: CommandTree;
11
- }): _alloy_js_core0.Children;
11
+ }): _alloy_js_core15.Children;
12
12
  interface VirtualCommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
13
13
  command: CommandTree;
14
14
  }
15
15
  /**
16
16
  * The virtual command entry point for the Shell Shock project.
17
17
  */
18
- declare function VirtualCommandEntry(props: VirtualCommandEntryProps): _alloy_js_core0.Children;
18
+ declare function VirtualCommandEntry(props: VirtualCommandEntryProps): _alloy_js_core15.Children;
19
19
  //#endregion
20
20
  export { VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration };
21
21
  //# sourceMappingURL=virtual-command-entry.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-command-entry.d.mts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAiDgB,iBAAA,gCAAA,CACL,KAAA,EAAW;EA+CL,OAAA,EA/CN,WA+CM;CACf,CAAA,EAhDoB,eAAA,CACrB,QA+CC;AAGS,UAJM,wBAAA,SAAiC,IAIvC,CAHT,cAGS,EAAA,MAAA,GAAA,gBAAA,CAAA,CAAA;EAJuC,OAAA,EAIvC,WAJuC;;AAUlD;;;iBAAgB,mBAAA,QAA2B,2BAAwB,eAAA,CAAA"}
1
+ {"version":3,"file":"virtual-command-entry.d.mts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAiDgB,iBAAA,gCAAA,CACL,KAAA,EAAW;EA+CL,OAAA,EA/CN,WA+CM;CACf,CAAA,EAhDoB,gBAAA,CACrB,QA+CC;AAGS,UAJM,wBAAA,SAAiC,IAIvC,CAHT,cAGS,EAAA,MAAA,GAAA,gBAAA,CAAA,CAAA;EAJuC,OAAA,EAIvC,WAJuC;;AAUlD;;;iBAAgB,mBAAA,QAA2B,2BAAwB,gBAAA,CAAA"}
@@ -116,24 +116,88 @@ function buildThemeAnsiStyles(theme, wrapFn, convertFn) {
116
116
  text: {
117
117
  banner: {
118
118
  title: {
119
- open: wrapFn()(convertFn(theme.text.banner.title)),
120
- close: wrapAnsi16()(39)
119
+ primary: {
120
+ open: wrapFn()(convertFn(theme.text.banner.title.primary)),
121
+ close: wrapAnsi16()(39)
122
+ },
123
+ secondary: {
124
+ open: wrapFn()(convertFn(theme.text.banner.title.secondary)),
125
+ close: wrapAnsi16()(39)
126
+ },
127
+ tertiary: {
128
+ open: wrapFn()(convertFn(theme.text.banner.title.tertiary)),
129
+ close: wrapAnsi16()(39)
130
+ }
121
131
  },
122
132
  command: {
123
- open: wrapFn()(convertFn(theme.text.banner.command)),
124
- close: wrapAnsi16()(39)
133
+ primary: {
134
+ open: wrapFn()(convertFn(theme.text.banner.command.primary)),
135
+ close: wrapAnsi16()(39)
136
+ },
137
+ secondary: {
138
+ open: wrapFn()(convertFn(theme.text.banner.command.secondary)),
139
+ close: wrapAnsi16()(39)
140
+ },
141
+ tertiary: {
142
+ open: wrapFn()(convertFn(theme.text.banner.command.tertiary)),
143
+ close: wrapAnsi16()(39)
144
+ }
125
145
  },
126
146
  description: {
127
- open: wrapFn()(convertFn(theme.text.banner.description)),
128
- close: wrapAnsi16()(39)
147
+ primary: {
148
+ open: wrapFn()(convertFn(theme.text.banner.description.primary)),
149
+ close: wrapAnsi16()(39)
150
+ },
151
+ secondary: {
152
+ open: wrapFn()(convertFn(theme.text.banner.description.secondary)),
153
+ close: wrapAnsi16()(39)
154
+ },
155
+ tertiary: {
156
+ open: wrapFn()(convertFn(theme.text.banner.description.tertiary)),
157
+ close: wrapAnsi16()(39)
158
+ }
129
159
  },
130
160
  header: {
131
- open: wrapFn()(convertFn(theme.text.banner.header)),
132
- close: wrapAnsi16()(39)
161
+ primary: {
162
+ open: wrapFn()(convertFn(theme.text.banner.header.primary)),
163
+ close: wrapAnsi16()(39)
164
+ },
165
+ secondary: {
166
+ open: wrapFn()(convertFn(theme.text.banner.header.secondary)),
167
+ close: wrapAnsi16()(39)
168
+ },
169
+ tertiary: {
170
+ open: wrapFn()(convertFn(theme.text.banner.header.tertiary)),
171
+ close: wrapAnsi16()(39)
172
+ }
133
173
  },
134
174
  footer: {
135
- open: wrapFn()(convertFn(theme.text.banner.footer)),
136
- close: wrapAnsi16()(39)
175
+ primary: {
176
+ open: wrapFn()(convertFn(theme.text.banner.footer.primary)),
177
+ close: wrapAnsi16()(39)
178
+ },
179
+ secondary: {
180
+ open: wrapFn()(convertFn(theme.text.banner.footer.secondary)),
181
+ close: wrapAnsi16()(39)
182
+ },
183
+ tertiary: {
184
+ open: wrapFn()(convertFn(theme.text.banner.footer.tertiary)),
185
+ close: wrapAnsi16()(39)
186
+ }
187
+ },
188
+ link: {
189
+ primary: {
190
+ open: wrapFn()(convertFn(theme.text.banner.link.primary)),
191
+ close: wrapAnsi16()(39)
192
+ },
193
+ secondary: {
194
+ open: wrapFn()(convertFn(theme.text.banner.link.secondary)),
195
+ close: wrapAnsi16()(39)
196
+ },
197
+ tertiary: {
198
+ open: wrapFn()(convertFn(theme.text.banner.link.tertiary)),
199
+ close: wrapAnsi16()(39)
200
+ }
137
201
  }
138
202
  },
139
203
  heading: {
@@ -1 +1 @@
1
- {"version":3,"file":"ansi-utils.cjs","names":["ANSI_BACKGROUND_OFFSET","modifiers","reset","bold","dim","italic","underline","overline","inverse","hidden","strikethrough","colors","black","red","green","yellow","blue","magenta","cyan","white","blackBright","gray","grey","redBright","greenBright","yellowBright","blueBright","magentaBright","cyanBright","whiteBright","bgColors","bgBlack","bgRed","bgGreen","bgYellow","bgBlue","bgMagenta","bgCyan","bgWhite","bgBlackBright","bgGray","bgGrey","bgRedBright","bgGreenBright","bgYellowBright","bgBlueBright","bgMagentaBright","bgCyanBright","bgWhiteBright","wrapAnsi16","offset","code","wrapAnsi256","wrapAnsi16m","hexToRgb","rgbToAnsi256","Math","round","hex","matches","exec","toString","colorString","length","map","character","join","integer","Number","parseInt","hexToAnsi256","ansi256ToAnsi","remainder","floor","value","max","result","hexToAnsi","buildThemeAnsiStyles","theme","wrapFn","convertFn","text","banner","title","open","close","command","description","header","footer","heading","primary","secondary","tertiary","body","link","message","help","success","info","debug","warning","danger","error","usage","bin","subcommand","options","params","border","divider","outline","app","table","getAnsiStyles","output","ansi16","ansi256","ansi16m","key","Object","entries"],"sources":["../../src/helpers/ansi-utils.ts"],"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 { ThemeColorsResolvedConfig } from \"@shell-shock/plugin-theme/types/theme\";\n\nconst ANSI_BACKGROUND_OFFSET = 10;\n\nexport const modifiers = {\n reset: [0, 0],\n bold: [1, 22],\n dim: [2, 22],\n italic: [3, 23],\n underline: [4, 24],\n overline: [53, 55],\n inverse: [7, 27],\n hidden: [8, 28],\n strikethrough: [9, 29]\n};\n\nexport const colors = {\n black: [30, 39],\n red: [31, 39],\n green: [32, 39],\n yellow: [33, 39],\n blue: [34, 39],\n magenta: [35, 39],\n cyan: [36, 39],\n white: [37, 39],\n\n // Bright color\n blackBright: [90, 39],\n gray: [90, 39],\n grey: [90, 39],\n redBright: [91, 39],\n greenBright: [92, 39],\n yellowBright: [93, 39],\n blueBright: [94, 39],\n magentaBright: [95, 39],\n cyanBright: [96, 39],\n whiteBright: [97, 39]\n};\n\nexport const bgColors = {\n bgBlack: [40, 49],\n bgRed: [41, 49],\n bgGreen: [42, 49],\n bgYellow: [43, 49],\n bgBlue: [44, 49],\n bgMagenta: [45, 49],\n bgCyan: [46, 49],\n bgWhite: [47, 49],\n\n // Bright color\n bgBlackBright: [100, 49],\n bgGray: [100, 49],\n bgGrey: [100, 49],\n bgRedBright: [101, 49],\n bgGreenBright: [102, 49],\n bgYellowBright: [103, 49],\n bgBlueBright: [104, 49],\n bgMagentaBright: [105, 49],\n bgCyanBright: [106, 49],\n bgWhiteBright: [107, 49]\n};\n\nexport interface AnsiWrappers {\n open: string;\n close: string;\n}\n\ntype WrapAnsiFn = (offset?: number) => (code: number) => string;\ntype WrapAnsi16mFn = (offset?: number) => (code: string) => string;\n\nconst wrapAnsi16: WrapAnsiFn =\n (offset = 0) =>\n (code: number) =>\n `\\\\u001b[${code + offset}m`;\n\nconst wrapAnsi256: WrapAnsiFn =\n (offset = 0) =>\n (code: number) =>\n `\\\\u001b[${38 + offset};5;${code}m`;\n\nconst wrapAnsi16m: WrapAnsi16mFn =\n (offset = 0) =>\n (code: string) => {\n const [red, green, blue] = hexToRgb(code);\n\n return `\\\\u001b[${38 + offset};2;${red};${green};${blue}m`;\n };\n\nexport type BaseAnsiStylesKeys =\n | keyof typeof modifiers\n | keyof typeof colors\n | keyof typeof bgColors;\n\nexport type BaseAnsiStyles = Record<\n \"ansi16\" | \"ansi256\" | \"ansi16m\",\n Record<BaseAnsiStylesKeys, AnsiWrappers>\n>;\n\ntype ThemeAnsiStylesFormat<T> = T extends object\n ? {\n [K in keyof T]: ThemeAnsiStylesFormat<T[K]>;\n }\n : AnsiWrappers;\n\nexport type ThemeAnsiStyles = Record<\n \"ansi16\" | \"ansi256\" | \"ansi16m\",\n { theme: ThemeAnsiStylesFormat<ThemeColorsResolvedConfig> }\n>;\n\nexport type AnsiStyles = BaseAnsiStyles & ThemeAnsiStyles;\n\nfunction rgbToAnsi256(red: number, green: number, blue: number): number {\n if (red === green && green === blue) {\n if (red < 8) {\n return 16;\n }\n\n if (red > 248) {\n return 231;\n }\n\n return Math.round(((red - 8) / 247) * 24) + 232;\n }\n\n return (\n 16 +\n 36 * Math.round((red / 255) * 5) +\n 6 * Math.round((green / 255) * 5) +\n Math.round((blue / 255) * 5)\n );\n}\n\nfunction hexToRgb(hex: string | number): [number, number, number] {\n const matches = /[a-f\\d]{6}|[a-f\\d]{3}/i.exec(hex.toString(16));\n if (!matches) {\n return [0, 0, 0];\n }\n\n let [colorString] = matches;\n\n if (colorString.length === 3) {\n colorString = [...colorString]\n .map(character => character + character)\n .join(\"\");\n }\n\n const integer = Number.parseInt(colorString, 16);\n\n return [(integer >> 16) & 0xff, (integer >> 8) & 0xff, integer & 0xff];\n}\n\nfunction hexToAnsi256(hex: string | number): number {\n return rgbToAnsi256(...hexToRgb(hex));\n}\n\nfunction ansi256ToAnsi(code: number): number {\n if (code < 8) {\n return 30 + code;\n }\n\n if (code < 16) {\n return 90 + (code - 8);\n }\n\n let red;\n let green;\n let blue;\n\n if (code >= 232) {\n red = ((code - 232) * 10 + 8) / 255;\n green = red;\n blue = red;\n } else {\n code -= 16;\n\n const remainder = code % 36;\n\n red = Math.floor(code / 36) / 5;\n green = Math.floor(remainder / 6) / 5;\n blue = (remainder % 6) / 5;\n }\n\n const value = Math.max(red, green, blue) * 2;\n\n if (value === 0) {\n return 30;\n }\n\n let result =\n 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));\n\n if (value === 2) {\n result += 60;\n }\n\n return result;\n}\n\n// function rgbToAnsi(red: number, green: number, blue: number): number {\n// return ansi256ToAnsi(rgbToAnsi256(red, green, blue));\n// }\n\nfunction hexToAnsi(hex: string | number): number {\n return ansi256ToAnsi(hexToAnsi256(hex));\n}\n\nfunction buildThemeAnsiStyles(\n theme: ThemeColorsResolvedConfig,\n wrapFn: (offset?: number) => (code: any) => string,\n convertFn: (code: string) => any\n): ThemeAnsiStylesFormat<ThemeColorsResolvedConfig> {\n return {\n text: {\n banner: {\n title: {\n open: wrapFn()(convertFn(theme.text.banner.title)),\n close: wrapAnsi16()(39)\n },\n command: {\n open: wrapFn()(convertFn(theme.text.banner.command)),\n close: wrapAnsi16()(39)\n },\n description: {\n open: wrapFn()(convertFn(theme.text.banner.description)),\n close: wrapAnsi16()(39)\n },\n header: {\n open: wrapFn()(convertFn(theme.text.banner.header)),\n close: wrapAnsi16()(39)\n },\n footer: {\n open: wrapFn()(convertFn(theme.text.banner.footer)),\n close: wrapAnsi16()(39)\n }\n },\n heading: {\n primary: {\n open: wrapFn()(convertFn(theme.text.heading.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.text.heading.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.text.heading.tertiary)),\n close: wrapAnsi16()(39)\n }\n },\n body: {\n primary: {\n open: wrapFn()(convertFn(theme.text.body.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.text.body.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.text.body.tertiary)),\n close: wrapAnsi16()(39)\n },\n link: {\n open: wrapFn()(convertFn(theme.text.body.link)),\n close: wrapAnsi16()(39)\n }\n },\n message: {\n description: {\n help: {\n open: wrapFn()(convertFn(theme.text.message.description.help)),\n close: wrapAnsi16()(39)\n },\n success: {\n open: wrapFn()(convertFn(theme.text.message.description.success)),\n close: wrapAnsi16()(39)\n },\n info: {\n open: wrapFn()(convertFn(theme.text.message.description.info)),\n close: wrapAnsi16()(39)\n },\n debug: {\n open: wrapFn()(convertFn(theme.text.message.description.debug)),\n close: wrapAnsi16()(39)\n },\n warning: {\n open: wrapFn()(convertFn(theme.text.message.description.warning)),\n close: wrapAnsi16()(39)\n },\n danger: {\n open: wrapFn()(convertFn(theme.text.message.description.danger)),\n close: wrapAnsi16()(39)\n },\n error: {\n open: wrapFn()(convertFn(theme.text.message.description.error)),\n close: wrapAnsi16()(39)\n }\n },\n link: {\n help: {\n open: wrapFn()(convertFn(theme.text.message.link.help)),\n close: wrapAnsi16()(39)\n },\n success: {\n open: wrapFn()(convertFn(theme.text.message.link.success)),\n close: wrapAnsi16()(39)\n },\n info: {\n open: wrapFn()(convertFn(theme.text.message.link.info)),\n close: wrapAnsi16()(39)\n },\n debug: {\n open: wrapFn()(convertFn(theme.text.message.link.debug)),\n close: wrapAnsi16()(39)\n },\n warning: {\n open: wrapFn()(convertFn(theme.text.message.link.warning)),\n close: wrapAnsi16()(39)\n },\n danger: {\n open: wrapFn()(convertFn(theme.text.message.link.danger)),\n close: wrapAnsi16()(39)\n },\n error: {\n open: wrapFn()(convertFn(theme.text.message.link.error)),\n close: wrapAnsi16()(39)\n }\n },\n header: {\n help: {\n open: wrapFn()(convertFn(theme.text.message.header.help)),\n close: wrapAnsi16()(39)\n },\n success: {\n open: wrapFn()(convertFn(theme.text.message.header.success)),\n close: wrapAnsi16()(39)\n },\n info: {\n open: wrapFn()(convertFn(theme.text.message.header.info)),\n close: wrapAnsi16()(39)\n },\n debug: {\n open: wrapFn()(convertFn(theme.text.message.header.debug)),\n close: wrapAnsi16()(39)\n },\n warning: {\n open: wrapFn()(convertFn(theme.text.message.header.warning)),\n close: wrapAnsi16()(39)\n },\n danger: {\n open: wrapFn()(convertFn(theme.text.message.header.danger)),\n close: wrapAnsi16()(39)\n },\n error: {\n open: wrapFn()(convertFn(theme.text.message.header.error)),\n close: wrapAnsi16()(39)\n }\n },\n footer: {\n help: {\n open: wrapFn()(convertFn(theme.text.message.footer.help)),\n close: wrapAnsi16()(39)\n },\n success: {\n open: wrapFn()(convertFn(theme.text.message.footer.success)),\n close: wrapAnsi16()(39)\n },\n info: {\n open: wrapFn()(convertFn(theme.text.message.footer.info)),\n close: wrapAnsi16()(39)\n },\n debug: {\n open: wrapFn()(convertFn(theme.text.message.footer.debug)),\n close: wrapAnsi16()(39)\n },\n warning: {\n open: wrapFn()(convertFn(theme.text.message.footer.warning)),\n close: wrapAnsi16()(39)\n },\n danger: {\n open: wrapFn()(convertFn(theme.text.message.footer.danger)),\n close: wrapAnsi16()(39)\n },\n error: {\n open: wrapFn()(convertFn(theme.text.message.footer.error)),\n close: wrapAnsi16()(39)\n }\n }\n },\n usage: {\n bin: {\n open: wrapFn()(convertFn(theme.text.usage.bin)),\n close: wrapAnsi16()(39)\n },\n command: {\n open: wrapFn()(convertFn(theme.text.usage.command)),\n close: wrapAnsi16()(39)\n },\n subcommand: {\n open: wrapFn()(convertFn(theme.text.usage.subcommand)),\n close: wrapAnsi16()(39)\n },\n options: {\n open: wrapFn()(convertFn(theme.text.usage.options)),\n close: wrapAnsi16()(39)\n },\n params: {\n open: wrapFn()(convertFn(theme.text.usage.params)),\n close: wrapAnsi16()(39)\n },\n description: {\n open: wrapFn()(convertFn(theme.text.usage.description)),\n close: wrapAnsi16()(39)\n }\n }\n },\n border: {\n banner: {\n divider: {\n primary: {\n open: wrapFn()(convertFn(theme.border.banner.divider.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.border.banner.divider.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.border.banner.divider.tertiary)),\n close: wrapAnsi16()(39)\n }\n },\n outline: {\n primary: {\n open: wrapFn()(convertFn(theme.border.banner.outline.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.border.banner.outline.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.border.banner.outline.tertiary)),\n close: wrapAnsi16()(39)\n }\n }\n },\n app: {\n divider: {\n primary: {\n open: wrapFn()(convertFn(theme.border.app.divider.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.border.app.divider.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.border.app.divider.tertiary)),\n close: wrapAnsi16()(39)\n }\n },\n table: {\n primary: {\n open: wrapFn()(convertFn(theme.border.app.table.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.border.app.table.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.border.app.table.tertiary)),\n close: wrapAnsi16()(39)\n }\n }\n },\n message: {\n divider: {\n help: {\n open: wrapFn()(convertFn(theme.border.message.divider.help)),\n close: wrapAnsi16()(39)\n },\n success: {\n open: wrapFn()(convertFn(theme.border.message.divider.success)),\n close: wrapAnsi16()(39)\n },\n info: {\n open: wrapFn()(convertFn(theme.border.message.divider.info)),\n close: wrapAnsi16()(39)\n },\n debug: {\n open: wrapFn()(convertFn(theme.border.message.divider.debug)),\n close: wrapAnsi16()(39)\n },\n warning: {\n open: wrapFn()(convertFn(theme.border.message.divider.warning)),\n close: wrapAnsi16()(39)\n },\n danger: {\n open: wrapFn()(convertFn(theme.border.message.divider.danger)),\n close: wrapAnsi16()(39)\n },\n error: {\n open: wrapFn()(convertFn(theme.border.message.divider.error)),\n close: wrapAnsi16()(39)\n }\n },\n outline: {\n help: {\n open: wrapFn()(convertFn(theme.border.message.outline.help)),\n close: wrapAnsi16()(39)\n },\n success: {\n open: wrapFn()(convertFn(theme.border.message.outline.success)),\n close: wrapAnsi16()(39)\n },\n info: {\n open: wrapFn()(convertFn(theme.border.message.outline.info)),\n close: wrapAnsi16()(39)\n },\n debug: {\n open: wrapFn()(convertFn(theme.border.message.outline.debug)),\n close: wrapAnsi16()(39)\n },\n warning: {\n open: wrapFn()(convertFn(theme.border.message.outline.warning)),\n close: wrapAnsi16()(39)\n },\n danger: {\n open: wrapFn()(convertFn(theme.border.message.outline.danger)),\n close: wrapAnsi16()(39)\n },\n error: {\n open: wrapFn()(convertFn(theme.border.message.outline.error)),\n close: wrapAnsi16()(39)\n }\n }\n }\n }\n };\n}\n\n/**\n * Generates ANSI styles based on the provided context.\n *\n * @param theme - The theme colors configuration.\n * @returns The generated ANSI styles.\n */\nexport function getAnsiStyles(theme: ThemeColorsResolvedConfig): AnsiStyles {\n const output = { ansi16: {}, ansi256: {}, ansi16m: {} } as AnsiStyles;\n\n for (const [key, value] of Object.entries(modifiers) as [\n BaseAnsiStylesKeys,\n [number, number]\n ][]) {\n output.ansi16[key] = {\n open: wrapAnsi16()(value[0]),\n close: wrapAnsi16()(value[1])\n };\n\n output.ansi256[key] = {\n open: wrapAnsi16()(value[0]),\n close: wrapAnsi16()(value[1])\n };\n\n output.ansi16m[key] = {\n open: wrapAnsi16()(value[0]),\n close: wrapAnsi16()(value[1])\n };\n }\n\n for (const [key, value] of Object.entries(colors) as [\n BaseAnsiStylesKeys,\n [number, number]\n ][]) {\n output.ansi16[key] = {\n open: wrapAnsi16()(value[0]),\n close: wrapAnsi16()(value[1])\n };\n\n output.ansi256[key] = {\n open: wrapAnsi16()(value[0]),\n close: wrapAnsi16()(value[1])\n };\n\n output.ansi16m[key] = {\n open: wrapAnsi16()(value[0]),\n close: wrapAnsi16()(value[1])\n };\n }\n\n for (const [key, value] of Object.entries(bgColors) as [\n BaseAnsiStylesKeys,\n [number, number]\n ][]) {\n output.ansi16[key] = {\n open: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[0]),\n close: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[1])\n };\n\n output.ansi256[key] = {\n open: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[0]),\n close: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[1])\n };\n\n output.ansi16m[key] = {\n open: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[0]),\n close: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[1])\n };\n }\n\n output.ansi16.theme = buildThemeAnsiStyles(theme, wrapAnsi16, hexToAnsi);\n output.ansi256.theme = buildThemeAnsiStyles(theme, wrapAnsi256, hexToAnsi256);\n output.ansi16m.theme = buildThemeAnsiStyles(\n theme,\n wrapAnsi16m,\n (code: string) => code\n );\n\n return output;\n}\n"],"mappings":";;AAoBA,MAAMA,yBAAyB;AAE/B,MAAaC,YAAY;CACvBC,OAAO,CAAC,GAAG,EAAE;CACbC,MAAM,CAAC,GAAG,GAAG;CACbC,KAAK,CAAC,GAAG,GAAG;CACZC,QAAQ,CAAC,GAAG,GAAG;CACfC,WAAW,CAAC,GAAG,GAAG;CAClBC,UAAU,CAAC,IAAI,GAAG;CAClBC,SAAS,CAAC,GAAG,GAAG;CAChBC,QAAQ,CAAC,GAAG,GA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rC,YAAY,CAACyB,MAAM,GAAE;GAC7B;AAED0C,SAAOG,QAAQC,OAAO;GACpBnC,MAAMpC,YAAY,CAACyB,MAAM,GAAG;GAC5BY,OAAOrC,YAAY,CAACyB,MAAM,GAAE;GAC7B;;AAGH,MAAK,MAAM,CAAC8C,KAAK9C,UAAU+C,OAAOC,QAAQ5F,SAAS,EAG9C;AACHsF,SAAOC,OAAOG,OAAO;GACnBnC,MAAMpC,WAAWjD,uBAAuB,CAAC0E,MAAM,GAAG;GAClDY,OAAOrC,WAAWjD,uBAAuB,CAAC0E,MAAM,GAAE;GACnD;AAED0C,SAAOE,QAAQE,OAAO;GACpBnC,MAAMpC,WAAWjD,uBAAuB,CAAC0E,MAAM,GAAG;GAClDY,OAAOrC,WAAWjD,uBAAuB,CAAC0E,MAAM,GAAE;GACnD;AAED0C,SAAOG,QAAQC,OAAO;GACpBnC,MAAMpC,WAAWjD,uBAAuB,CAAC0E,MAAM,GAAG;GAClDY,OAAOrC,WAAWjD,uBAAuB,CAAC0E,MAAM,GAAE;GACnD;;AAGH0C,QAAOC,OAAOtC,QAAQD,qBAAqBC,OAAO9B,YAAY4B,UAAU;AACxEuC,QAAOE,QAAQvC,QAAQD,qBAAqBC,OAAO3B,aAAakB,aAAa;AAC7E8C,QAAOG,QAAQxC,QAAQD,qBACrBC,OACA1B,cACCF,SAAiBA,KACnB;AAED,QAAOiE"}
1
+ {"version":3,"file":"ansi-utils.cjs","names":["ANSI_BACKGROUND_OFFSET","modifiers","reset","bold","dim","italic","underline","overline","inverse","hidden","strikethrough","colors","black","red","green","yellow","blue","magenta","cyan","white","blackBright","gray","grey","redBright","greenBright","yellowBright","blueBright","magentaBright","cyanBright","whiteBright","bgColors","bgBlack","bgRed","bgGreen","bgYellow","bgBlue","bgMagenta","bgCyan","bgWhite","bgBlackBright","bgGray","bgGrey","bgRedBright","bgGreenBright","bgYellowBright","bgBlueBright","bgMagentaBright","bgCyanBright","bgWhiteBright","wrapAnsi16","offset","code","wrapAnsi256","wrapAnsi16m","hexToRgb","rgbToAnsi256","Math","round","hex","matches","exec","toString","colorString","length","map","character","join","integer","Number","parseInt","hexToAnsi256","ansi256ToAnsi","remainder","floor","value","max","result","hexToAnsi","buildThemeAnsiStyles","theme","wrapFn","convertFn","text","banner","title","primary","open","close","secondary","tertiary","command","description","header","footer","link","heading","body","message","help","success","info","debug","warning","danger","error","usage","bin","subcommand","options","params","border","divider","outline","app","table","getAnsiStyles","output","ansi16","ansi256","ansi16m","key","Object","entries"],"sources":["../../src/helpers/ansi-utils.ts"],"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 { ThemeColorsResolvedConfig } from \"@shell-shock/plugin-theme/types/theme\";\n\nconst ANSI_BACKGROUND_OFFSET = 10;\n\nexport const modifiers = {\n reset: [0, 0],\n bold: [1, 22],\n dim: [2, 22],\n italic: [3, 23],\n underline: [4, 24],\n overline: [53, 55],\n inverse: [7, 27],\n hidden: [8, 28],\n strikethrough: [9, 29]\n};\n\nexport const colors = {\n black: [30, 39],\n red: [31, 39],\n green: [32, 39],\n yellow: [33, 39],\n blue: [34, 39],\n magenta: [35, 39],\n cyan: [36, 39],\n white: [37, 39],\n\n // Bright color\n blackBright: [90, 39],\n gray: [90, 39],\n grey: [90, 39],\n redBright: [91, 39],\n greenBright: [92, 39],\n yellowBright: [93, 39],\n blueBright: [94, 39],\n magentaBright: [95, 39],\n cyanBright: [96, 39],\n whiteBright: [97, 39]\n};\n\nexport const bgColors = {\n bgBlack: [40, 49],\n bgRed: [41, 49],\n bgGreen: [42, 49],\n bgYellow: [43, 49],\n bgBlue: [44, 49],\n bgMagenta: [45, 49],\n bgCyan: [46, 49],\n bgWhite: [47, 49],\n\n // Bright color\n bgBlackBright: [100, 49],\n bgGray: [100, 49],\n bgGrey: [100, 49],\n bgRedBright: [101, 49],\n bgGreenBright: [102, 49],\n bgYellowBright: [103, 49],\n bgBlueBright: [104, 49],\n bgMagentaBright: [105, 49],\n bgCyanBright: [106, 49],\n bgWhiteBright: [107, 49]\n};\n\nexport interface AnsiWrappers {\n open: string;\n close: string;\n}\n\ntype WrapAnsiFn = (offset?: number) => (code: number) => string;\ntype WrapAnsi16mFn = (offset?: number) => (code: string) => string;\n\nconst wrapAnsi16: WrapAnsiFn =\n (offset = 0) =>\n (code: number) =>\n `\\\\u001b[${code + offset}m`;\n\nconst wrapAnsi256: WrapAnsiFn =\n (offset = 0) =>\n (code: number) =>\n `\\\\u001b[${38 + offset};5;${code}m`;\n\nconst wrapAnsi16m: WrapAnsi16mFn =\n (offset = 0) =>\n (code: string) => {\n const [red, green, blue] = hexToRgb(code);\n\n return `\\\\u001b[${38 + offset};2;${red};${green};${blue}m`;\n };\n\nexport type BaseAnsiStylesKeys =\n | keyof typeof modifiers\n | keyof typeof colors\n | keyof typeof bgColors;\n\nexport type BaseAnsiStyles = Record<\n \"ansi16\" | \"ansi256\" | \"ansi16m\",\n Record<BaseAnsiStylesKeys, AnsiWrappers>\n>;\n\ntype ThemeAnsiStylesFormat<T> = T extends object\n ? {\n [K in keyof T]: ThemeAnsiStylesFormat<T[K]>;\n }\n : AnsiWrappers;\n\nexport type ThemeAnsiStyles = Record<\n \"ansi16\" | \"ansi256\" | \"ansi16m\",\n { theme: ThemeAnsiStylesFormat<ThemeColorsResolvedConfig> }\n>;\n\nexport type AnsiStyles = BaseAnsiStyles & ThemeAnsiStyles;\n\nfunction rgbToAnsi256(red: number, green: number, blue: number): number {\n if (red === green && green === blue) {\n if (red < 8) {\n return 16;\n }\n\n if (red > 248) {\n return 231;\n }\n\n return Math.round(((red - 8) / 247) * 24) + 232;\n }\n\n return (\n 16 +\n 36 * Math.round((red / 255) * 5) +\n 6 * Math.round((green / 255) * 5) +\n Math.round((blue / 255) * 5)\n );\n}\n\nfunction hexToRgb(hex: string | number): [number, number, number] {\n const matches = /[a-f\\d]{6}|[a-f\\d]{3}/i.exec(hex.toString(16));\n if (!matches) {\n return [0, 0, 0];\n }\n\n let [colorString] = matches;\n\n if (colorString.length === 3) {\n colorString = [...colorString]\n .map(character => character + character)\n .join(\"\");\n }\n\n const integer = Number.parseInt(colorString, 16);\n\n return [(integer >> 16) & 0xff, (integer >> 8) & 0xff, integer & 0xff];\n}\n\nfunction hexToAnsi256(hex: string | number): number {\n return rgbToAnsi256(...hexToRgb(hex));\n}\n\nfunction ansi256ToAnsi(code: number): number {\n if (code < 8) {\n return 30 + code;\n }\n\n if (code < 16) {\n return 90 + (code - 8);\n }\n\n let red;\n let green;\n let blue;\n\n if (code >= 232) {\n red = ((code - 232) * 10 + 8) / 255;\n green = red;\n blue = red;\n } else {\n code -= 16;\n\n const remainder = code % 36;\n\n red = Math.floor(code / 36) / 5;\n green = Math.floor(remainder / 6) / 5;\n blue = (remainder % 6) / 5;\n }\n\n const value = Math.max(red, green, blue) * 2;\n\n if (value === 0) {\n return 30;\n }\n\n let result =\n 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));\n\n if (value === 2) {\n result += 60;\n }\n\n return result;\n}\n\n// function rgbToAnsi(red: number, green: number, blue: number): number {\n// return ansi256ToAnsi(rgbToAnsi256(red, green, blue));\n// }\n\nfunction hexToAnsi(hex: string | number): number {\n return ansi256ToAnsi(hexToAnsi256(hex));\n}\n\nfunction buildThemeAnsiStyles(\n theme: ThemeColorsResolvedConfig,\n wrapFn: (offset?: number) => (code: any) => string,\n convertFn: (code: string) => any\n): ThemeAnsiStylesFormat<ThemeColorsResolvedConfig> {\n return {\n text: {\n banner: {\n title: {\n primary: {\n open: wrapFn()(convertFn(theme.text.banner.title.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.text.banner.title.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.text.banner.title.tertiary)),\n close: wrapAnsi16()(39)\n }\n },\n command: {\n primary: {\n open: wrapFn()(convertFn(theme.text.banner.command.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.text.banner.command.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.text.banner.command.tertiary)),\n close: wrapAnsi16()(39)\n }\n },\n description: {\n primary: {\n open: wrapFn()(convertFn(theme.text.banner.description.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.text.banner.description.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.text.banner.description.tertiary)),\n close: wrapAnsi16()(39)\n }\n },\n header: {\n primary: {\n open: wrapFn()(convertFn(theme.text.banner.header.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.text.banner.header.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.text.banner.header.tertiary)),\n close: wrapAnsi16()(39)\n }\n },\n footer: {\n primary: {\n open: wrapFn()(convertFn(theme.text.banner.footer.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.text.banner.footer.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.text.banner.footer.tertiary)),\n close: wrapAnsi16()(39)\n }\n },\n link: {\n primary: {\n open: wrapFn()(convertFn(theme.text.banner.link.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.text.banner.link.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.text.banner.link.tertiary)),\n close: wrapAnsi16()(39)\n }\n }\n },\n heading: {\n primary: {\n open: wrapFn()(convertFn(theme.text.heading.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.text.heading.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.text.heading.tertiary)),\n close: wrapAnsi16()(39)\n }\n },\n body: {\n primary: {\n open: wrapFn()(convertFn(theme.text.body.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.text.body.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.text.body.tertiary)),\n close: wrapAnsi16()(39)\n },\n link: {\n open: wrapFn()(convertFn(theme.text.body.link)),\n close: wrapAnsi16()(39)\n }\n },\n message: {\n description: {\n help: {\n open: wrapFn()(convertFn(theme.text.message.description.help)),\n close: wrapAnsi16()(39)\n },\n success: {\n open: wrapFn()(convertFn(theme.text.message.description.success)),\n close: wrapAnsi16()(39)\n },\n info: {\n open: wrapFn()(convertFn(theme.text.message.description.info)),\n close: wrapAnsi16()(39)\n },\n debug: {\n open: wrapFn()(convertFn(theme.text.message.description.debug)),\n close: wrapAnsi16()(39)\n },\n warning: {\n open: wrapFn()(convertFn(theme.text.message.description.warning)),\n close: wrapAnsi16()(39)\n },\n danger: {\n open: wrapFn()(convertFn(theme.text.message.description.danger)),\n close: wrapAnsi16()(39)\n },\n error: {\n open: wrapFn()(convertFn(theme.text.message.description.error)),\n close: wrapAnsi16()(39)\n }\n },\n link: {\n help: {\n open: wrapFn()(convertFn(theme.text.message.link.help)),\n close: wrapAnsi16()(39)\n },\n success: {\n open: wrapFn()(convertFn(theme.text.message.link.success)),\n close: wrapAnsi16()(39)\n },\n info: {\n open: wrapFn()(convertFn(theme.text.message.link.info)),\n close: wrapAnsi16()(39)\n },\n debug: {\n open: wrapFn()(convertFn(theme.text.message.link.debug)),\n close: wrapAnsi16()(39)\n },\n warning: {\n open: wrapFn()(convertFn(theme.text.message.link.warning)),\n close: wrapAnsi16()(39)\n },\n danger: {\n open: wrapFn()(convertFn(theme.text.message.link.danger)),\n close: wrapAnsi16()(39)\n },\n error: {\n open: wrapFn()(convertFn(theme.text.message.link.error)),\n close: wrapAnsi16()(39)\n }\n },\n header: {\n help: {\n open: wrapFn()(convertFn(theme.text.message.header.help)),\n close: wrapAnsi16()(39)\n },\n success: {\n open: wrapFn()(convertFn(theme.text.message.header.success)),\n close: wrapAnsi16()(39)\n },\n info: {\n open: wrapFn()(convertFn(theme.text.message.header.info)),\n close: wrapAnsi16()(39)\n },\n debug: {\n open: wrapFn()(convertFn(theme.text.message.header.debug)),\n close: wrapAnsi16()(39)\n },\n warning: {\n open: wrapFn()(convertFn(theme.text.message.header.warning)),\n close: wrapAnsi16()(39)\n },\n danger: {\n open: wrapFn()(convertFn(theme.text.message.header.danger)),\n close: wrapAnsi16()(39)\n },\n error: {\n open: wrapFn()(convertFn(theme.text.message.header.error)),\n close: wrapAnsi16()(39)\n }\n },\n footer: {\n help: {\n open: wrapFn()(convertFn(theme.text.message.footer.help)),\n close: wrapAnsi16()(39)\n },\n success: {\n open: wrapFn()(convertFn(theme.text.message.footer.success)),\n close: wrapAnsi16()(39)\n },\n info: {\n open: wrapFn()(convertFn(theme.text.message.footer.info)),\n close: wrapAnsi16()(39)\n },\n debug: {\n open: wrapFn()(convertFn(theme.text.message.footer.debug)),\n close: wrapAnsi16()(39)\n },\n warning: {\n open: wrapFn()(convertFn(theme.text.message.footer.warning)),\n close: wrapAnsi16()(39)\n },\n danger: {\n open: wrapFn()(convertFn(theme.text.message.footer.danger)),\n close: wrapAnsi16()(39)\n },\n error: {\n open: wrapFn()(convertFn(theme.text.message.footer.error)),\n close: wrapAnsi16()(39)\n }\n }\n },\n usage: {\n bin: {\n open: wrapFn()(convertFn(theme.text.usage.bin)),\n close: wrapAnsi16()(39)\n },\n command: {\n open: wrapFn()(convertFn(theme.text.usage.command)),\n close: wrapAnsi16()(39)\n },\n subcommand: {\n open: wrapFn()(convertFn(theme.text.usage.subcommand)),\n close: wrapAnsi16()(39)\n },\n options: {\n open: wrapFn()(convertFn(theme.text.usage.options)),\n close: wrapAnsi16()(39)\n },\n params: {\n open: wrapFn()(convertFn(theme.text.usage.params)),\n close: wrapAnsi16()(39)\n },\n description: {\n open: wrapFn()(convertFn(theme.text.usage.description)),\n close: wrapAnsi16()(39)\n }\n }\n },\n border: {\n banner: {\n divider: {\n primary: {\n open: wrapFn()(convertFn(theme.border.banner.divider.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.border.banner.divider.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.border.banner.divider.tertiary)),\n close: wrapAnsi16()(39)\n }\n },\n outline: {\n primary: {\n open: wrapFn()(convertFn(theme.border.banner.outline.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.border.banner.outline.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.border.banner.outline.tertiary)),\n close: wrapAnsi16()(39)\n }\n }\n },\n app: {\n divider: {\n primary: {\n open: wrapFn()(convertFn(theme.border.app.divider.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.border.app.divider.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.border.app.divider.tertiary)),\n close: wrapAnsi16()(39)\n }\n },\n table: {\n primary: {\n open: wrapFn()(convertFn(theme.border.app.table.primary)),\n close: wrapAnsi16()(39)\n },\n secondary: {\n open: wrapFn()(convertFn(theme.border.app.table.secondary)),\n close: wrapAnsi16()(39)\n },\n tertiary: {\n open: wrapFn()(convertFn(theme.border.app.table.tertiary)),\n close: wrapAnsi16()(39)\n }\n }\n },\n message: {\n divider: {\n help: {\n open: wrapFn()(convertFn(theme.border.message.divider.help)),\n close: wrapAnsi16()(39)\n },\n success: {\n open: wrapFn()(convertFn(theme.border.message.divider.success)),\n close: wrapAnsi16()(39)\n },\n info: {\n open: wrapFn()(convertFn(theme.border.message.divider.info)),\n close: wrapAnsi16()(39)\n },\n debug: {\n open: wrapFn()(convertFn(theme.border.message.divider.debug)),\n close: wrapAnsi16()(39)\n },\n warning: {\n open: wrapFn()(convertFn(theme.border.message.divider.warning)),\n close: wrapAnsi16()(39)\n },\n danger: {\n open: wrapFn()(convertFn(theme.border.message.divider.danger)),\n close: wrapAnsi16()(39)\n },\n error: {\n open: wrapFn()(convertFn(theme.border.message.divider.error)),\n close: wrapAnsi16()(39)\n }\n },\n outline: {\n help: {\n open: wrapFn()(convertFn(theme.border.message.outline.help)),\n close: wrapAnsi16()(39)\n },\n success: {\n open: wrapFn()(convertFn(theme.border.message.outline.success)),\n close: wrapAnsi16()(39)\n },\n info: {\n open: wrapFn()(convertFn(theme.border.message.outline.info)),\n close: wrapAnsi16()(39)\n },\n debug: {\n open: wrapFn()(convertFn(theme.border.message.outline.debug)),\n close: wrapAnsi16()(39)\n },\n warning: {\n open: wrapFn()(convertFn(theme.border.message.outline.warning)),\n close: wrapAnsi16()(39)\n },\n danger: {\n open: wrapFn()(convertFn(theme.border.message.outline.danger)),\n close: wrapAnsi16()(39)\n },\n error: {\n open: wrapFn()(convertFn(theme.border.message.outline.error)),\n close: wrapAnsi16()(39)\n }\n }\n }\n }\n };\n}\n\n/**\n * Generates ANSI styles based on the provided context.\n *\n * @param theme - The theme colors configuration.\n * @returns The generated ANSI styles.\n */\nexport function getAnsiStyles(theme: ThemeColorsResolvedConfig): AnsiStyles {\n const output = { ansi16: {}, ansi256: {}, ansi16m: {} } as AnsiStyles;\n\n for (const [key, value] of Object.entries(modifiers) as [\n BaseAnsiStylesKeys,\n [number, number]\n ][]) {\n output.ansi16[key] = {\n open: wrapAnsi16()(value[0]),\n close: wrapAnsi16()(value[1])\n };\n\n output.ansi256[key] = {\n open: wrapAnsi16()(value[0]),\n close: wrapAnsi16()(value[1])\n };\n\n output.ansi16m[key] = {\n open: wrapAnsi16()(value[0]),\n close: wrapAnsi16()(value[1])\n };\n }\n\n for (const [key, value] of Object.entries(colors) as [\n BaseAnsiStylesKeys,\n [number, number]\n ][]) {\n output.ansi16[key] = {\n open: wrapAnsi16()(value[0]),\n close: wrapAnsi16()(value[1])\n };\n\n output.ansi256[key] = {\n open: wrapAnsi16()(value[0]),\n close: wrapAnsi16()(value[1])\n };\n\n output.ansi16m[key] = {\n open: wrapAnsi16()(value[0]),\n close: wrapAnsi16()(value[1])\n };\n }\n\n for (const [key, value] of Object.entries(bgColors) as [\n BaseAnsiStylesKeys,\n [number, number]\n ][]) {\n output.ansi16[key] = {\n open: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[0]),\n close: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[1])\n };\n\n output.ansi256[key] = {\n open: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[0]),\n close: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[1])\n };\n\n output.ansi16m[key] = {\n open: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[0]),\n close: wrapAnsi16(ANSI_BACKGROUND_OFFSET)(value[1])\n };\n }\n\n output.ansi16.theme = buildThemeAnsiStyles(theme, wrapAnsi16, hexToAnsi);\n output.ansi256.theme = buildThemeAnsiStyles(theme, wrapAnsi256, hexToAnsi256);\n output.ansi16m.theme = buildThemeAnsiStyles(\n theme,\n wrapAnsi16m,\n (code: string) => code\n );\n\n return output;\n}\n"],"mappings":";;AAoBA,MAAMA,yBAAyB;AAE/B,MAAaC,YAAY;CACvBC,OAAO,CAAC,GAAG,EAAE;CACbC,MAAM,CAAC,GAAG,GAAG;CACbC,KAAK,CAAC,GAAG,GAAG;CACZC,QAAQ,CAAC,GAAG,GAAG;CACfC,WAAW,CAAC,GAAG,GAAG;CAClBC,UAAU,CAAC,IAAI,GAAG;CAClBC,SAAS,CAAC,GAA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nD;AAED0C,SAAOG,QAAQC,OAAO;GACpBlC,MAAMrC,WAAWjD,uBAAuB,CAAC0E,MAAM,GAAG;GAClDa,OAAOtC,WAAWjD,uBAAuB,CAAC0E,MAAM,GAAE;GACnD;;AAGH0C,QAAOC,OAAOtC,QAAQD,qBAAqBC,OAAO9B,YAAY4B,UAAU;AACxEuC,QAAOE,QAAQvC,QAAQD,qBAAqBC,OAAO3B,aAAakB,aAAa;AAC7E8C,QAAOG,QAAQxC,QAAQD,qBACrBC,OACA1B,cACCF,SAAiBA,KACnB;AAED,QAAOiE"}
@@ -115,24 +115,88 @@ function buildThemeAnsiStyles(theme, wrapFn, convertFn) {
115
115
  text: {
116
116
  banner: {
117
117
  title: {
118
- open: wrapFn()(convertFn(theme.text.banner.title)),
119
- close: wrapAnsi16()(39)
118
+ primary: {
119
+ open: wrapFn()(convertFn(theme.text.banner.title.primary)),
120
+ close: wrapAnsi16()(39)
121
+ },
122
+ secondary: {
123
+ open: wrapFn()(convertFn(theme.text.banner.title.secondary)),
124
+ close: wrapAnsi16()(39)
125
+ },
126
+ tertiary: {
127
+ open: wrapFn()(convertFn(theme.text.banner.title.tertiary)),
128
+ close: wrapAnsi16()(39)
129
+ }
120
130
  },
121
131
  command: {
122
- open: wrapFn()(convertFn(theme.text.banner.command)),
123
- close: wrapAnsi16()(39)
132
+ primary: {
133
+ open: wrapFn()(convertFn(theme.text.banner.command.primary)),
134
+ close: wrapAnsi16()(39)
135
+ },
136
+ secondary: {
137
+ open: wrapFn()(convertFn(theme.text.banner.command.secondary)),
138
+ close: wrapAnsi16()(39)
139
+ },
140
+ tertiary: {
141
+ open: wrapFn()(convertFn(theme.text.banner.command.tertiary)),
142
+ close: wrapAnsi16()(39)
143
+ }
124
144
  },
125
145
  description: {
126
- open: wrapFn()(convertFn(theme.text.banner.description)),
127
- close: wrapAnsi16()(39)
146
+ primary: {
147
+ open: wrapFn()(convertFn(theme.text.banner.description.primary)),
148
+ close: wrapAnsi16()(39)
149
+ },
150
+ secondary: {
151
+ open: wrapFn()(convertFn(theme.text.banner.description.secondary)),
152
+ close: wrapAnsi16()(39)
153
+ },
154
+ tertiary: {
155
+ open: wrapFn()(convertFn(theme.text.banner.description.tertiary)),
156
+ close: wrapAnsi16()(39)
157
+ }
128
158
  },
129
159
  header: {
130
- open: wrapFn()(convertFn(theme.text.banner.header)),
131
- close: wrapAnsi16()(39)
160
+ primary: {
161
+ open: wrapFn()(convertFn(theme.text.banner.header.primary)),
162
+ close: wrapAnsi16()(39)
163
+ },
164
+ secondary: {
165
+ open: wrapFn()(convertFn(theme.text.banner.header.secondary)),
166
+ close: wrapAnsi16()(39)
167
+ },
168
+ tertiary: {
169
+ open: wrapFn()(convertFn(theme.text.banner.header.tertiary)),
170
+ close: wrapAnsi16()(39)
171
+ }
132
172
  },
133
173
  footer: {
134
- open: wrapFn()(convertFn(theme.text.banner.footer)),
135
- close: wrapAnsi16()(39)
174
+ primary: {
175
+ open: wrapFn()(convertFn(theme.text.banner.footer.primary)),
176
+ close: wrapAnsi16()(39)
177
+ },
178
+ secondary: {
179
+ open: wrapFn()(convertFn(theme.text.banner.footer.secondary)),
180
+ close: wrapAnsi16()(39)
181
+ },
182
+ tertiary: {
183
+ open: wrapFn()(convertFn(theme.text.banner.footer.tertiary)),
184
+ close: wrapAnsi16()(39)
185
+ }
186
+ },
187
+ link: {
188
+ primary: {
189
+ open: wrapFn()(convertFn(theme.text.banner.link.primary)),
190
+ close: wrapAnsi16()(39)
191
+ },
192
+ secondary: {
193
+ open: wrapFn()(convertFn(theme.text.banner.link.secondary)),
194
+ close: wrapAnsi16()(39)
195
+ },
196
+ tertiary: {
197
+ open: wrapFn()(convertFn(theme.text.banner.link.tertiary)),
198
+ close: wrapAnsi16()(39)
199
+ }
136
200
  }
137
201
  },
138
202
  heading: {