Changed Desktop

This commit is contained in:
2025-09-10 11:48:22 +02:00
parent 6804d95a08
commit d099faf68a
4591 changed files with 1612898 additions and 51 deletions

View File

@@ -0,0 +1,6 @@
import type { CFontProps } from 'ink-big-text';
export declare function renderInkLogo(text: string, palette: string[], options?: {
font?: CFontProps['font'];
letterSpacing?: number;
}): Promise<void>;
//# sourceMappingURL=InkRenderer.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"InkRenderer.d.ts","sourceRoot":"","sources":["../src/InkRenderer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAiC/C,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9D,OAAO,CAAC,IAAI,CAAC,CA0Bf"}

View File

@@ -0,0 +1,30 @@
import { jsx as _jsx } from "react/jsx-runtime";
import { render } from 'ink';
import BigText from 'ink-big-text';
import Gradient from 'ink-gradient';
const Logo = ({ text, colors, font = 'block', letterSpacing, }) => {
// ink-gradient with custom colors
if (colors.length > 0) {
return (_jsx(Gradient, { colors: colors, children: _jsx(BigText, { text: text, font: font, letterSpacing: letterSpacing }) }));
}
// Default gradient
return (_jsx(Gradient, { name: "rainbow", children: _jsx(BigText, { text: text, font: font, letterSpacing: letterSpacing }) }));
};
export function renderInkLogo(text, palette, options) {
return new Promise((resolve) => {
const { unmount } = render(_jsx(Logo, { text: text, colors: palette, font: options?.font, letterSpacing: options?.letterSpacing }));
// Automatically unmount after rendering to allow process to exit
setTimeout(() => {
unmount();
// Reset terminal state to prevent corruption
// SGR reset (colors, styles)
process.stdout.write('\x1b[0m');
// Ensure cursor is visible
process.stdout.write('\x1b[?25h');
// Clear to end of line to remove any artifacts
process.stdout.write('\x1b[K');
resolve();
}, 100);
});
}
//# sourceMappingURL=InkRenderer.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"InkRenderer.js","sourceRoot":"","sources":["../src/InkRenderer.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,OAAO,QAAQ,MAAM,cAAc,CAAC;AASpC,MAAM,IAAI,GAAwB,CAAC,EACjC,IAAI,EACJ,MAAM,EACN,IAAI,GAAG,OAAO,EACd,aAAa,GACd,EAAE,EAAE;IACH,kCAAkC;IAClC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,CACL,KAAC,QAAQ,IAAC,MAAM,EAAE,MAAM,YACtB,KAAC,OAAO,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,GAAI,GACxD,CACZ,CAAC;IACJ,CAAC;IAED,mBAAmB;IACnB,OAAO,CACL,KAAC,QAAQ,IAAC,IAAI,EAAC,SAAS,YACtB,KAAC,OAAO,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,GAAI,GACxD,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,OAAiB,EACjB,OAA+D;IAE/D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CACxB,KAAC,IAAI,IACH,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,OAAO,EAAE,IAAI,EACnB,aAAa,EAAE,OAAO,EAAE,aAAa,GACrC,CACH,CAAC;QAEF,iEAAiE;QACjE,UAAU,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,CAAC;YAEV,6CAA6C;YAC7C,6BAA6B;YAC7B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAChC,2BAA2B;YAC3B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAClC,+CAA+C;YAC/C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAE/B,OAAO,EAAE,CAAC;QACZ,CAAC,EAAE,GAAG,CAAC,CAAC;IACV,CAAC,CAAC,CAAC;AACL,CAAC"}

View File

@@ -0,0 +1,3 @@
#!/usr/bin/env node
export {};
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}

151
cache/npm/global/lib/node_modules/oh-my-logo/dist/index.js generated vendored Executable file
View File

@@ -0,0 +1,151 @@
#!/usr/bin/env node
import { Command } from 'commander';
import { render, renderFilled, getPaletteNames, getPalettePreview, DEFAULT_FONT, DEFAULT_PALETTE, resolveColors, } from './lib.js';
import { shouldUseColor, stripAnsiCodes } from './utils/stdout.js';
import { PaletteError, InputError } from './utils/errors.js';
import { readFileSync } from 'fs';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const packageJson = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8'));
const program = new Command();
program
.name('oh-my-logo')
.description('Display giant ASCII art logos with colorful gradients in your terminal')
.version(packageJson.version)
.argument('[text]', 'Text to display (use "\\n" for newlines or "-" for stdin)')
.argument('[palette]', 'Color palette to use', DEFAULT_PALETTE)
.option('-f, --font <name>', 'Figlet font name', process.env.OHMYLOGO_FONT || DEFAULT_FONT)
.option('-l, --list-palettes', 'List available palettes')
.option('--gallery', 'Render text in all available palettes')
.option('--color', 'Force color output even in pipes')
.option('--no-color', 'Disable color output')
.option('-d, --direction <dir>', 'Gradient direction: horizontal, vertical, or diagonal', 'vertical')
.option('--filled', 'Use filled characters instead of outlined ASCII art')
.option('--block-font <font>', 'Font for filled mode (3d, block, chrome, grid, huge, pallet, shade, simple, simple3d, simpleBlock, slick, tiny)', 'block')
.option('--letter-spacing <number>', 'Letter spacing for filled mode', parseInt)
.option('--reverse-gradient', 'Reverse gradient colors')
.action(async (text, paletteArg, options) => {
try {
if (options.listPalettes) {
console.log('Available palettes:');
getPaletteNames().forEach((name) => {
const preview = getPalettePreview(name);
console.log(` - ${name.padEnd(12)} ${preview}`);
});
process.exit(0);
}
if (!text) {
throw new InputError('Text is required when not using --list-palettes or --gallery');
}
if (options.gallery) {
// Render in all palettes
let inputText = text;
if (text === '-') {
inputText = readFileSync(0, 'utf-8').trim();
}
if (!inputText || inputText.trim() === '') {
throw new InputError('Text must not be empty');
}
inputText = inputText.replace(/\\n/g, '\n');
const paletteNames = getPaletteNames();
for (const paletteName of paletteNames) {
console.log(`\n=== ${paletteName.toUpperCase()}${options.reverseGradient ? ' (reversed)' : ''} ===\n`);
let paletteColors = resolveColors(paletteName);
if (options.reverseGradient) {
paletteColors = [...paletteColors].reverse();
}
if (options.filled) {
// Validate letter spacing
if (options.letterSpacing !== undefined &&
options.letterSpacing < 0) {
throw new InputError('Letter spacing must be 0 or greater');
}
await renderFilled(inputText, {
palette: paletteColors,
font: options.blockFont,
letterSpacing: options.letterSpacing,
});
}
else {
const logo = await render(inputText, {
palette: paletteColors,
font: options.font,
direction: options.direction,
});
const useColor = shouldUseColor({
forceColor: options.color,
noColor: !options.color && options.noColor,
});
const output = useColor ? logo : stripAnsiCodes(logo);
console.log(output);
}
}
process.exit(0);
}
if (!text) {
throw new InputError('Text is required when not using --list-palettes');
}
let inputText = text;
if (text === '-') {
inputText = readFileSync(0, 'utf-8').trim();
}
if (!inputText || inputText.trim() === '') {
throw new InputError('Text must not be empty');
}
inputText = inputText.replace(/\\n/g, '\n');
// Validate and resolve palette
let paletteColors;
try {
paletteColors = resolveColors(paletteArg);
}
catch {
if (paletteArg !== DEFAULT_PALETTE) {
throw new PaletteError(paletteArg);
}
paletteColors = resolveColors(DEFAULT_PALETTE);
}
// Reverse colors if requested
if (options.reverseGradient) {
paletteColors = [...paletteColors].reverse();
}
if (options.filled) {
// Validate letter spacing
if (options.letterSpacing !== undefined && options.letterSpacing < 0) {
throw new InputError('Letter spacing must be 0 or greater');
}
// Use Ink for filled characters
await renderFilled(inputText, {
palette: paletteColors,
font: options.blockFont,
letterSpacing: options.letterSpacing,
});
}
else {
// Use figlet for outlined ASCII art
const logo = await render(inputText, {
palette: paletteColors,
font: options.font,
direction: options.direction,
});
const useColor = shouldUseColor({
forceColor: options.color,
noColor: !options.color && options.noColor,
});
const output = useColor ? logo : stripAnsiCodes(logo);
console.log(output);
}
}
catch (error) {
if (error instanceof Error) {
console.error(`Error: ${error.message}`);
}
else {
console.error('An unexpected error occurred');
}
process.exit(1);
}
});
program.parse();
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,22 @@
import { PALETTES, type PaletteName, resolvePalette, getPaletteNames, getDefaultPalette, getPalettePreview } from './palettes.js';
import type { Fonts } from 'figlet';
export declare const DEFAULT_PALETTE: PaletteName;
export declare const DEFAULT_FONT = "Standard";
export declare const DEFAULT_DIRECTION = "vertical";
export interface RenderOptions {
palette?: PaletteName | string[] | string;
font?: Fonts | string;
direction?: 'vertical' | 'horizontal' | 'diagonal';
}
export type BlockFont = '3d' | 'block' | 'chrome' | 'grid' | 'huge' | 'pallet' | 'shade' | 'simple' | 'simple3d' | 'simpleBlock' | 'slick' | 'tiny';
export interface RenderInkOptions {
palette?: PaletteName | string[] | string;
font?: BlockFont;
letterSpacing?: number;
}
export declare function resolveColors(palette: PaletteName | string[] | string): string[];
export declare function render(text: string, options?: RenderOptions): Promise<string>;
export declare function renderFilled(text: string, options?: RenderInkOptions): Promise<void>;
export { PALETTES, type PaletteName, resolvePalette, getPaletteNames, getDefaultPalette, getPalettePreview, };
export type { Fonts };
//# sourceMappingURL=lib.d.ts.map

View File

@@ -0,0 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L,QAAQ,EACR,KAAK,WAAW,EAChB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,iBAAiB,GAClB,CAAC;AAEF,YAAY,EAAE,KAAK,EAAE,CAAC"}

View File

@@ -0,0 +1,32 @@
import { renderLogo } from './renderer.js';
import { renderInkLogo } from './InkRenderer.js';
import { PALETTES, resolvePalette, getPaletteNames, getDefaultPalette, getPalettePreview, } from './palettes.js';
export const DEFAULT_PALETTE = 'grad-blue';
export const DEFAULT_FONT = 'Standard';
export const DEFAULT_DIRECTION = 'vertical';
export function resolveColors(palette) {
if (Array.isArray(palette)) {
return palette;
}
const colors = resolvePalette(palette);
if (!colors) {
throw new Error(`Unknown palette: ${palette}`);
}
return colors;
}
export async function render(text, options = {}) {
const { palette = DEFAULT_PALETTE, font = DEFAULT_FONT, direction = DEFAULT_DIRECTION, } = options;
const paletteColors = resolveColors(palette);
return renderLogo(text, paletteColors, font, direction);
}
export async function renderFilled(text, options = {}) {
const { palette = DEFAULT_PALETTE, font, letterSpacing } = options;
// Validate letter spacing
if (letterSpacing !== undefined && letterSpacing < 0) {
throw new Error('Letter spacing must be 0 or greater');
}
const paletteColors = resolveColors(palette);
return renderInkLogo(text, paletteColors, { font, letterSpacing });
}
export { PALETTES, resolvePalette, getPaletteNames, getDefaultPalette, getPalettePreview, };
//# sourceMappingURL=lib.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACL,QAAQ,EAER,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAGvB,MAAM,CAAC,MAAM,eAAe,GAAgB,WAAW,CAAC;AACxD,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AACvC,MAAM,CAAC,MAAM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

View File

@@ -0,0 +1,21 @@
export declare const PALETTES: {
readonly 'grad-blue': readonly ["#4ea8ff", "#7f88ff"];
readonly sunset: readonly ["#ff9966", "#ff5e62", "#ffa34e"];
readonly dawn: readonly ["#00c6ff", "#0072ff"];
readonly nebula: readonly ["#654ea3", "#eaafc8"];
readonly mono: readonly ["#f07178", "#f07178"];
readonly ocean: readonly ["#667eea", "#764ba2"];
readonly fire: readonly ["#ff0844", "#ffb199"];
readonly forest: readonly ["#134e5e", "#71b280"];
readonly gold: readonly ["#f7971e", "#ffd200"];
readonly purple: readonly ["#667db6", "#0082c8", "#0078ff"];
readonly mint: readonly ["#00d2ff", "#3a7bd5"];
readonly coral: readonly ["#ff9a9e", "#fecfef"];
readonly matrix: readonly ["#00ff41", "#008f11"];
};
export type PaletteName = keyof typeof PALETTES;
export declare function resolvePalette(name: string): string[] | null;
export declare function getPaletteNames(): string[];
export declare function getDefaultPalette(): string[];
export declare function getPalettePreview(name: PaletteName): string;
//# sourceMappingURL=palettes.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"palettes.d.ts","sourceRoot":"","sources":["../src/palettes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;CAcX,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,QAAQ,CAAC;AAEhD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAI5D;AAED,wBAAgB,eAAe,IAAI,MAAM,EAAE,CAE1C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,EAAE,CAE5C;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAG3D"}

View File

@@ -0,0 +1,31 @@
export const PALETTES = {
'grad-blue': ['#4ea8ff', '#7f88ff'],
sunset: ['#ff9966', '#ff5e62', '#ffa34e'],
dawn: ['#00c6ff', '#0072ff'],
nebula: ['#654ea3', '#eaafc8'],
mono: ['#f07178', '#f07178'],
ocean: ['#667eea', '#764ba2'],
fire: ['#ff0844', '#ffb199'],
forest: ['#134e5e', '#71b280'],
gold: ['#f7971e', '#ffd200'],
purple: ['#667db6', '#0082c8', '#0078ff'],
mint: ['#00d2ff', '#3a7bd5'],
coral: ['#ff9a9e', '#fecfef'],
matrix: ['#00ff41', '#008f11'],
};
export function resolvePalette(name) {
const paletteName = name;
const palette = PALETTES[paletteName];
return palette ? [...palette] : null;
}
export function getPaletteNames() {
return Object.keys(PALETTES);
}
export function getDefaultPalette() {
return [...PALETTES['grad-blue']];
}
export function getPalettePreview(name) {
const colors = PALETTES[name];
return colors.join(' → ');
}
//# sourceMappingURL=palettes.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"palettes.js","sourceRoot":"","sources":["../src/palettes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,WAAW,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;IACnC,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;IACzC,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;IAC5B,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;IAC5B,KAAK,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;IAC7B,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;IAC5B,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;IAC5B,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;IACzC,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;IAC5B,KAAK,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;IAC7B,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAIX,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,WAAW,GAAG,IAAmB,CAAC;IACxC,MAAM,OAAO,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;IACtC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAiB;IACjD,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC9B,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC"}

View File

@@ -0,0 +1,2 @@
export declare function renderLogo(text: string, palette: string[], font?: string, direction?: string): string;
//# sourceMappingURL=renderer.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAIA,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,GAAE,MAAmB,EACzB,SAAS,GAAE,MAAmB,GAC7B,MAAM,CA6DR"}

View File

@@ -0,0 +1,61 @@
import figlet from 'figlet';
import gradient from 'gradient-string';
import { FontError } from './utils/errors.js';
export function renderLogo(text, palette, font = 'Standard', direction = 'vertical') {
try {
const asciiArt = figlet.textSync(text, {
font: font,
horizontalLayout: 'default',
verticalLayout: 'default',
width: 80,
whitespaceBreak: true,
});
// Create gradient function
const gradientFn = gradient(palette);
let coloredArt;
switch (direction) {
case 'horizontal':
// Apply gradient horizontally (left to right on each line)
const lines = asciiArt.split('\n');
const coloredLines = lines.map((line) => {
if (line.trim() === '') {
return line;
}
return gradientFn(line);
});
coloredArt = coloredLines.join('\n');
break;
case 'diagonal':
// Create a custom diagonal gradient by applying different gradients per line
const diagonalLines = asciiArt.split('\n');
const lineCount = diagonalLines.length;
coloredArt = diagonalLines
.map((line, index) => {
if (line.trim() === '') {
return line;
}
// Create a gradient that shifts based on line position
const shiftedPalette = palette.map((color, colorIndex) => {
const shift = (index / lineCount) * palette.length;
return palette[Math.floor(colorIndex + shift) % palette.length];
});
return gradient(shiftedPalette)(line);
})
.join('\n');
break;
case 'vertical':
default:
// Apply gradient vertically (top to bottom across all lines)
coloredArt = gradientFn.multiline(asciiArt);
break;
}
return coloredArt;
}
catch (error) {
if (error instanceof Error && error.message.includes('font')) {
throw new FontError(font);
}
throw error;
}
}
//# sourceMappingURL=renderer.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,UAAU,UAAU,CACxB,IAAY,EACZ,OAAiB,EACjB,OAAe,UAAU,EACzB,YAAoB,UAAU;IAE9B,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;YACrC,IAAI,EAAE,IAAoB;YAC1B,gBAAgB,EAAE,SAAS;YAC3B,cAAc,EAAE,SAAS;YACzB,KAAK,EAAE,EAAE;YACT,eAAe,EAAE,IAAI;SACtB,CAAC,CAAC;QAEH,2BAA2B;QAC3B,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;QAErC,IAAI,UAAkB,CAAC;QAEvB,QAAQ,SAAS,EAAE,CAAC;YAClB,KAAK,YAAY;gBACf,2DAA2D;gBAC3D,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,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CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7D,MAAM,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}

View File

@@ -0,0 +1,16 @@
export declare class OhMyLogoError extends Error {
constructor(message: string);
}
export declare class PaletteError extends OhMyLogoError {
readonly palette: string;
constructor(paletteName: string);
}
export declare class InputError extends OhMyLogoError {
readonly input: string;
constructor(input: string);
}
export declare class FontError extends OhMyLogoError {
readonly font: string;
constructor(fontName: string);
}
//# sourceMappingURL=errors.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,YAAa,SAAQ,aAAa;IAC7C,SAAgB,OAAO,EAAE,MAAM,CAAC;gBAEpB,WAAW,EAAE,MAAM;CAIhC;AAED,qBAAa,UAAW,SAAQ,aAAa;IAC3C,SAAgB,KAAK,EAAE,MAAM,CAAC;gBAElB,KAAK,EAAE,MAAM;CAI1B;AAED,qBAAa,SAAU,SAAQ,aAAa;IAC1C,SAAgB,IAAI,EAAE,MAAM,CAAC;gBAEjB,QAAQ,EAAE,MAAM;CAI7B"}

View File

@@ -0,0 +1,28 @@
export class OhMyLogoError extends Error {
constructor(message) {
super(message);
this.name = this.constructor.name;
}
}
export class PaletteError extends OhMyLogoError {
palette;
constructor(paletteName) {
super(`Unknown palette: ${paletteName}`);
this.palette = paletteName;
}
}
export class InputError extends OhMyLogoError {
input;
constructor(input) {
super(`Invalid input: ${input}`);
this.input = input;
}
}
export class FontError extends OhMyLogoError {
font;
constructor(fontName) {
super(`Font not found: ${fontName}`);
this.font = fontName;
}
}
//# sourceMappingURL=errors.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACpC,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,aAAa;IAC7B,OAAO,CAAS;IAEhC,YAAY,WAAmB;QAC7B,KAAK,CAAC,oBAAoB,WAAW,EAAE,CAAC,CAAC;QACzC,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,OAAO,UAAW,SAAQ,aAAa;IAC3B,KAAK,CAAS;IAE9B,YAAY,KAAa;QACvB,KAAK,CAAC,kBAAkB,KAAK,EAAE,CAAC,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAED,MAAM,OAAO,SAAU,SAAQ,aAAa;IAC1B,IAAI,CAAS;IAE7B,YAAY,QAAgB;QAC1B,KAAK,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;IACvB,CAAC;CACF"}

View File

@@ -0,0 +1,7 @@
export interface ColorOptions {
forceColor?: boolean;
noColor?: boolean;
}
export declare function shouldUseColor(options?: ColorOptions): boolean;
export declare function stripAnsiCodes(text: string): string;
//# sourceMappingURL=stdout.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"stdout.d.ts","sourceRoot":"","sources":["../../src/utils/stdout.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,cAAc,CAAC,OAAO,GAAE,YAAiB,GAAG,OAAO,CA4BlE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAInD"}

View File

@@ -0,0 +1,30 @@
export function shouldUseColor(options = {}) {
// Force color takes highest precedence
if (options.forceColor) {
return true;
}
// No color option
if (options.noColor) {
return false;
}
// Check NO_COLOR environment variable
if (process.env.NO_COLOR) {
return false;
}
// Check FORCE_COLOR environment variable
if (process.env.FORCE_COLOR) {
return true;
}
// Check if running in CI with color support
if (process.env.CI && (process.env.COLORTERM || process.env.TERM_PROGRAM)) {
return true;
}
// Default to TTY detection
return process.stdout.isTTY ?? false;
}
export function stripAnsiCodes(text) {
// More comprehensive regex for ANSI escape sequences
const ansiRegex = /\u001b\[[0-9;]*[a-zA-Z]/g;
return text.replace(ansiRegex, '');
}
//# sourceMappingURL=stdout.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"stdout.js","sourceRoot":"","sources":["../../src/utils/stdout.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,cAAc,CAAC,UAAwB,EAAE;IACvD,uCAAuC;IACvC,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,kBAAkB;IAClB,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,sCAAsC;IACtC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,yCAAyC;IACzC,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,4CAA4C;IAC5C,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;QAC1E,OAAO,IAAI,CAAC;IACd,CAAC;IAED,2BAA2B;IAC3B,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,KAAK,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,qDAAqD;IACrD,MAAM,SAAS,GAAG,0BAA0B,CAAC;IAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AACrC,CAAC"}