emoji-banner-generator 1.0.0

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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +160 -0
  3. package/dist/animation.d.ts +14 -0
  4. package/dist/animation.d.ts.map +1 -0
  5. package/dist/animation.js +194 -0
  6. package/dist/animation.js.map +1 -0
  7. package/dist/bitmap.d.ts +25 -0
  8. package/dist/bitmap.d.ts.map +1 -0
  9. package/dist/bitmap.js +141 -0
  10. package/dist/bitmap.js.map +1 -0
  11. package/dist/cli.d.ts +19 -0
  12. package/dist/cli.d.ts.map +1 -0
  13. package/dist/cli.js +174 -0
  14. package/dist/cli.js.map +1 -0
  15. package/dist/clipboard.d.ts +17 -0
  16. package/dist/clipboard.d.ts.map +1 -0
  17. package/dist/clipboard.js +47 -0
  18. package/dist/clipboard.js.map +1 -0
  19. package/dist/emoji.d.ts +25 -0
  20. package/dist/emoji.d.ts.map +1 -0
  21. package/dist/emoji.js +180 -0
  22. package/dist/emoji.js.map +1 -0
  23. package/dist/fonts.d.ts +26 -0
  24. package/dist/fonts.d.ts.map +1 -0
  25. package/dist/fonts.js +551 -0
  26. package/dist/fonts.js.map +1 -0
  27. package/dist/index.d.ts +7 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +108 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/output.d.ts +26 -0
  32. package/dist/output.d.ts.map +1 -0
  33. package/dist/output.js +113 -0
  34. package/dist/output.js.map +1 -0
  35. package/dist/renderer.d.ts +18 -0
  36. package/dist/renderer.d.ts.map +1 -0
  37. package/dist/renderer.js +247 -0
  38. package/dist/renderer.js.map +1 -0
  39. package/dist/slack.d.ts +35 -0
  40. package/dist/slack.d.ts.map +1 -0
  41. package/dist/slack.js +129 -0
  42. package/dist/slack.js.map +1 -0
  43. package/dist/themes.d.ts +31 -0
  44. package/dist/themes.d.ts.map +1 -0
  45. package/dist/themes.js +84 -0
  46. package/dist/themes.js.map +1 -0
  47. package/dist/types.d.ts +113 -0
  48. package/dist/types.d.ts.map +1 -0
  49. package/dist/types.js +5 -0
  50. package/dist/types.js.map +1 -0
  51. package/package.json +57 -0
package/dist/themes.js ADDED
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Theme module
3
+ * Provides themed emoji sets for different visual styles
4
+ */
5
+ /**
6
+ * GitHub contribution graph colors using square emojis
7
+ * Level 0 = no contribution (background)
8
+ * Level 1-4 = increasing intensity
9
+ */
10
+ const GITHUB_THEME_EMOJIS = {
11
+ 0: '⬜', // Background / no contribution
12
+ 1: '🟩', // Light green (low contribution)
13
+ 2: '🟩', // Medium-light green
14
+ 3: '🟩', // Medium-dark green
15
+ 4: '🟩', // Dark green (high contribution)
16
+ };
17
+ // Alternative GitHub theme with different shades using Unicode blocks
18
+ const GITHUB_THEME_BLOCKS = [
19
+ '⬜', // Level 0 - empty
20
+ '🟩', // Level 1 - lightest green
21
+ '🟩', // Level 2
22
+ '🟩', // Level 3
23
+ '🟩', // Level 4 - darkest green
24
+ ];
25
+ /**
26
+ * Available themes
27
+ */
28
+ const THEMES = {
29
+ default: ['🔥'], // Single default emoji
30
+ github: GITHUB_THEME_BLOCKS,
31
+ };
32
+ /**
33
+ * Get emojis for a specific theme
34
+ */
35
+ export function getThemeEmojis(theme) {
36
+ return THEMES[theme] || THEMES.default;
37
+ }
38
+ /**
39
+ * Get background emoji for a theme
40
+ */
41
+ export function getThemeBackground(theme) {
42
+ if (theme === 'github') {
43
+ return '⬜'; // White square for GitHub theme background
44
+ }
45
+ return ' '; // Default: double space
46
+ }
47
+ /**
48
+ * Check if a theme is valid
49
+ */
50
+ export function isValidTheme(theme) {
51
+ return theme in THEMES;
52
+ }
53
+ /**
54
+ * Get all available theme names
55
+ */
56
+ export function getAvailableThemes() {
57
+ return Object.keys(THEMES);
58
+ }
59
+ /**
60
+ * GitHub theme intensity calculator
61
+ * Returns 1-4 for foreground pixels with varying intensity
62
+ */
63
+ export function getGitHubIntensity(row, col, seed = 0) {
64
+ // Simple deterministic pseudo-random based on position
65
+ const hash = (row * 31 + col * 17 + seed) % 100;
66
+ if (hash < 20)
67
+ return 1;
68
+ if (hash < 45)
69
+ return 2;
70
+ if (hash < 75)
71
+ return 3;
72
+ return 4;
73
+ }
74
+ /**
75
+ * Get description for a theme
76
+ */
77
+ export function getThemeDescription(theme) {
78
+ const descriptions = {
79
+ default: 'Default theme - uses specified emoji',
80
+ github: 'GitHub contribution graph style with green squares',
81
+ };
82
+ return descriptions[theme] || 'Unknown theme';
83
+ }
84
+ //# sourceMappingURL=themes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themes.js","sourceRoot":"","sources":["../src/themes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;GAIG;AACH,MAAM,mBAAmB,GAAgC;IACvD,CAAC,EAAE,GAAG,EAAE,+BAA+B;IACvC,CAAC,EAAE,IAAI,EAAE,iCAAiC;IAC1C,CAAC,EAAE,IAAI,EAAE,qBAAqB;IAC9B,CAAC,EAAE,IAAI,EAAE,sBAAsB;IAC/B,CAAC,EAAE,IAAI,EAAE,iCAAiC;CAC3C,CAAC;AAEF,sEAAsE;AACtE,MAAM,mBAAmB,GAAa;IACpC,GAAG,EAAE,kBAAkB;IACvB,IAAI,EAAE,2BAA2B;IACjC,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,0BAA0B;CACjC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,GAA4B;IACtC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,uBAAuB;IACxC,MAAM,EAAE,mBAAmB;CAC5B,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAAY;IACzC,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAY;IAC7C,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvB,OAAO,GAAG,CAAC,CAAC,2CAA2C;IACzD,CAAC;IACD,OAAO,IAAI,CAAC,CAAC,wBAAwB;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,KAAK,IAAI,MAAM,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAY,CAAC;AACxC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,GAAW,EACX,GAAW,EACX,OAAe,CAAC;IAEhB,uDAAuD;IACvD,MAAM,IAAI,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC;IAEhD,IAAI,IAAI,GAAG,EAAE;QAAE,OAAO,CAAC,CAAC;IACxB,IAAI,IAAI,GAAG,EAAE;QAAE,OAAO,CAAC,CAAC;IACxB,IAAI,IAAI,GAAG,EAAE;QAAE,OAAO,CAAC,CAAC;IACxB,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAY;IAC9C,MAAM,YAAY,GAA0B;QAC1C,OAAO,EAAE,sCAAsC;QAC/C,MAAM,EAAE,oDAAoD;KAC7D,CAAC;IACF,OAAO,YAAY,CAAC,KAAK,CAAC,IAAI,eAAe,CAAC;AAChD,CAAC"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Type definitions for emoji-banner-generator
3
+ */
4
+ /**
5
+ * Bitmap representation - 2D array of boolean values
6
+ * true = foreground (character pixel), false = background
7
+ */
8
+ export type Bitmap = boolean[][];
9
+ /**
10
+ * Emoji selection mode when multiple emojis are provided
11
+ */
12
+ export type EmojiMode = 'random' | 'row' | 'column' | 'row-gradient' | 'column-gradient';
13
+ /**
14
+ * Output format options
15
+ */
16
+ export type OutputFormat = 'text' | 'slack';
17
+ /**
18
+ * Theme options
19
+ */
20
+ export type Theme = 'default' | 'github';
21
+ /**
22
+ * CLI options parsed from command line arguments
23
+ */
24
+ export interface CLIOptions {
25
+ /** Text to convert (positional argument or from file) */
26
+ text?: string;
27
+ /** Input file path to read text from */
28
+ file?: string;
29
+ /** Emoji(s) to use for foreground - can be comma-separated */
30
+ emoji: string;
31
+ /** Emoji to use for background (default: space) */
32
+ background?: string;
33
+ /** Copy result to clipboard */
34
+ copy?: boolean;
35
+ /** Output format */
36
+ format?: OutputFormat;
37
+ /** Theme to use */
38
+ theme?: Theme;
39
+ /** Emoji selection mode */
40
+ mode?: EmojiMode;
41
+ /** Font to use for text rendering */
42
+ font?: string;
43
+ /** Border option (boolean to use background, or emoji string) */
44
+ border?: boolean | string;
45
+ }
46
+ /**
47
+ * Rendered banner result
48
+ */
49
+ export interface BannerResult {
50
+ /** The rendered text with emojis */
51
+ text: string;
52
+ /** Background emoji used */
53
+ backgroundEmoji: string;
54
+ /** Border emoji used (if any) */
55
+ borderEmoji?: string;
56
+ /** The bitmap data */
57
+ bitmap: Bitmap;
58
+ /** Width of the banner in characters */
59
+ width: number;
60
+ /** Height of the banner in characters */
61
+ height: number;
62
+ }
63
+ /**
64
+ * Slack Block Kit message structure
65
+ */
66
+ export interface SlackBlock {
67
+ type: string;
68
+ text?: {
69
+ type: string;
70
+ text: string;
71
+ emoji?: boolean;
72
+ };
73
+ elements?: Array<{
74
+ type: string;
75
+ text: string;
76
+ emoji?: boolean;
77
+ }>;
78
+ }
79
+ /**
80
+ * Slack Block Kit message format
81
+ */
82
+ export interface SlackMessage {
83
+ blocks: SlackBlock[];
84
+ }
85
+ /**
86
+ * GitHub theme color levels (0-4, like contribution graph)
87
+ */
88
+ export type GitHubLevel = 0 | 1 | 2 | 3 | 4;
89
+ /**
90
+ * Configuration for rendering
91
+ */
92
+ export interface RenderConfig {
93
+ /** Emojis for foreground */
94
+ foregroundEmojis: string[];
95
+ /** Emoji for background */
96
+ backgroundEmoji: string;
97
+ /** Emoji for border (if provided) */
98
+ borderEmoji?: string;
99
+ /** Emoji selection mode */
100
+ mode: EmojiMode;
101
+ /** Theme to apply */
102
+ theme: Theme;
103
+ }
104
+ /**
105
+ * Animation configuration
106
+ */
107
+ export interface AnimationConfig {
108
+ /** Speed in milliseconds per frame */
109
+ speed: number;
110
+ /** Terminal width */
111
+ terminalWidth: number;
112
+ }
113
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,EAAE,EAAE,CAAC;AAEjC;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,cAAc,GACd,iBAAiB,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,oBAAoB;IACpB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,mBAAmB;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,2BAA2B;IAC3B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAA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aAAa,EAAE,MAAM,CAAC;CACvB"}
package/dist/types.js ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Type definitions for emoji-banner-generator
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "emoji-banner-generator",
3
+ "version": "1.0.0",
4
+ "description": "Convert text to emoji banner art for CLI display",
5
+ "main": "dist/index.js",
6
+ "bin": {
7
+ "emjtxt": "dist/index.js"
8
+ },
9
+ "type": "module",
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "start": "node dist/index.js",
13
+ "dev": "tsx src/index.ts",
14
+ "prepublishOnly": "npm run build",
15
+ "lint": "eslint src/**/*.ts",
16
+ "format": "prettier --write src/**/*.ts"
17
+ },
18
+ "keywords": [
19
+ "emoji",
20
+ "banner",
21
+ "ascii-art",
22
+ "cli",
23
+ "text-to-emoji",
24
+ "slack"
25
+ ],
26
+ "author": "levyxx <rb.06p.8046@s.thers.ac.jp>",
27
+ "license": "MIT",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/levyxx/emoji-banner-generator.git"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/levyxx/emoji-banner-generator/issues"
34
+ },
35
+ "homepage": "https://github.com/levyxx/emoji-banner-generator#readme",
36
+ "files": [
37
+ "dist",
38
+ "README.md"
39
+ ],
40
+ "engines": {
41
+ "node": ">=18.0.0"
42
+ },
43
+ "dependencies": {
44
+ "clipboardy": "^4.0.0",
45
+ "commander": "^12.1.0",
46
+ "figlet": "^1.7.0",
47
+ "node-emoji": "^2.1.3"
48
+ },
49
+ "devDependencies": {
50
+ "@types/figlet": "^1.5.8",
51
+ "@types/node": "^20.11.0",
52
+ "eslint": "^8.56.0",
53
+ "prettier": "^3.2.0",
54
+ "tsx": "^4.7.0",
55
+ "typescript": "^5.3.3"
56
+ }
57
+ }