@kya-os/cli 0.1.0-beta.8 → 1.0.0-beta-0.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 (107) hide show
  1. package/README.md +24 -26
  2. package/dist/commands/check.d.ts.map +1 -1
  3. package/dist/commands/check.js +62 -61
  4. package/dist/commands/check.js.map +1 -1
  5. package/dist/commands/claim.d.ts.map +1 -1
  6. package/dist/commands/claim.js +31 -31
  7. package/dist/commands/claim.js.map +1 -1
  8. package/dist/commands/env.d.ts +1 -1
  9. package/dist/commands/env.js +90 -89
  10. package/dist/commands/env.js.map +1 -1
  11. package/dist/commands/init.d.ts.map +1 -1
  12. package/dist/commands/init.js +268 -218
  13. package/dist/commands/init.js.map +1 -1
  14. package/dist/commands/rotate.d.ts.map +1 -1
  15. package/dist/commands/rotate.js +67 -56
  16. package/dist/commands/rotate.js.map +1 -1
  17. package/dist/components/agent-avatar.d.ts +28 -0
  18. package/dist/components/agent-avatar.d.ts.map +1 -0
  19. package/dist/components/agent-avatar.js +98 -0
  20. package/dist/components/agent-avatar.js.map +1 -0
  21. package/dist/components/agent-card.d.ts +14 -0
  22. package/dist/components/agent-card.d.ts.map +1 -0
  23. package/dist/components/agent-card.js +170 -0
  24. package/dist/components/agent-card.js.map +1 -0
  25. package/dist/components/agent-table.d.ts +20 -0
  26. package/dist/components/agent-table.d.ts.map +1 -0
  27. package/dist/components/agent-table.js +195 -0
  28. package/dist/components/agent-table.js.map +1 -0
  29. package/dist/components/box.d.ts +14 -0
  30. package/dist/components/box.d.ts.map +1 -0
  31. package/dist/components/box.js +222 -0
  32. package/dist/components/box.js.map +1 -0
  33. package/dist/components/index.d.ts +16 -0
  34. package/dist/components/index.d.ts.map +1 -0
  35. package/dist/components/index.js +17 -0
  36. package/dist/components/index.js.map +1 -0
  37. package/dist/components/messages.d.ts +62 -0
  38. package/dist/components/messages.d.ts.map +1 -0
  39. package/dist/components/messages.js +146 -0
  40. package/dist/components/messages.js.map +1 -0
  41. package/dist/components/types.d.ts +51 -0
  42. package/dist/components/types.d.ts.map +1 -0
  43. package/dist/components/types.js +5 -0
  44. package/dist/components/types.js.map +1 -0
  45. package/dist/components/welcome.d.ts +38 -0
  46. package/dist/components/welcome.d.ts.map +1 -0
  47. package/dist/components/welcome.js +149 -0
  48. package/dist/components/welcome.js.map +1 -0
  49. package/dist/effects/cli-integration.js +3 -3
  50. package/dist/effects/cli-integration.js.map +1 -1
  51. package/dist/effects/index.d.ts +9 -12
  52. package/dist/effects/index.d.ts.map +1 -1
  53. package/dist/effects/index.js +69 -34
  54. package/dist/effects/index.js.map +1 -1
  55. package/dist/index.d.ts +1 -1
  56. package/dist/index.js +12 -19
  57. package/dist/utils/env-manager.d.ts +69 -5
  58. package/dist/utils/env-manager.d.ts.map +1 -1
  59. package/dist/utils/env-manager.js +381 -56
  60. package/dist/utils/env-manager.js.map +1 -1
  61. package/dist/utils/prompts.d.ts +1 -0
  62. package/dist/utils/prompts.d.ts.map +1 -1
  63. package/dist/utils/prompts.js +15 -0
  64. package/dist/utils/prompts.js.map +1 -1
  65. package/dist/utils/screen-manager.d.ts +10 -0
  66. package/dist/utils/screen-manager.d.ts.map +1 -0
  67. package/dist/utils/screen-manager.js +50 -0
  68. package/dist/utils/screen-manager.js.map +1 -0
  69. package/dist/utils/validation.d.ts +92 -0
  70. package/dist/utils/validation.d.ts.map +1 -0
  71. package/dist/utils/validation.js +106 -0
  72. package/dist/utils/validation.js.map +1 -0
  73. package/package.json +27 -9
  74. package/dist/commands/cli-experience-demo-simple.d.ts +0 -14
  75. package/dist/commands/cli-experience-demo-simple.d.ts.map +0 -1
  76. package/dist/commands/cli-experience-demo-simple.js +0 -119
  77. package/dist/commands/cli-experience-demo-simple.js.map +0 -1
  78. package/dist/commands/cli-experience-demo.d.ts +0 -14
  79. package/dist/commands/cli-experience-demo.d.ts.map +0 -1
  80. package/dist/commands/cli-experience-demo.js +0 -172
  81. package/dist/commands/cli-experience-demo.js.map +0 -1
  82. package/dist/commands/effects-demo.d.ts +0 -10
  83. package/dist/commands/effects-demo.d.ts.map +0 -1
  84. package/dist/commands/effects-demo.js +0 -292
  85. package/dist/commands/effects-demo.js.map +0 -1
  86. package/dist/dev.d.ts +0 -7
  87. package/dist/dev.d.ts.map +0 -1
  88. package/dist/dev.js +0 -9
  89. package/dist/dev.js.map +0 -1
  90. package/dist/effects/__tests__/effects.test.d.ts +0 -5
  91. package/dist/effects/__tests__/effects.test.d.ts.map +0 -1
  92. package/dist/effects/__tests__/effects.test.js +0 -206
  93. package/dist/effects/__tests__/effects.test.js.map +0 -1
  94. package/dist/effects/implementations/binary-path.d.ts +0 -88
  95. package/dist/effects/implementations/binary-path.d.ts.map +0 -1
  96. package/dist/effects/implementations/binary-path.js +0 -296
  97. package/dist/effects/implementations/binary-path.js.map +0 -1
  98. package/dist/effects/implementations/test.d.ts +0 -113
  99. package/dist/effects/implementations/test.d.ts.map +0 -1
  100. package/dist/effects/implementations/test.js +0 -552
  101. package/dist/effects/implementations/test.js.map +0 -1
  102. package/dist/effects/template/effect-template.d.ts +0 -97
  103. package/dist/effects/template/effect-template.d.ts.map +0 -1
  104. package/dist/effects/template/effect-template.js +0 -208
  105. package/dist/effects/template/effect-template.js.map +0 -1
  106. package/dist/index.d.ts.map +0 -1
  107. package/dist/index.js.map +0 -1
@@ -1,113 +0,0 @@
1
- /**
2
- * Blackhole Effect with ASCII Art Center
3
- * Characters are consumed by a black hole with custom ASCII art and explode outwards
4
- */
5
- import { BaseEffect } from "../types.js";
6
- /**
7
- * Configuration options for the Blackhole effect
8
- */
9
- export interface BlackholeEffectOptions {
10
- /** Duration in milliseconds */
11
- duration?: number;
12
- /** Color for the blackhole border stars */
13
- blackholeColor?: string;
14
- /** Colors for stars during explosion */
15
- starColors?: string[];
16
- /** Final color for characters */
17
- finalColor?: string;
18
- /** Use gradient for final color */
19
- useGradient?: boolean;
20
- /** Gradient direction */
21
- gradientDirection?: "vertical" | "horizontal" | "diagonal";
22
- /** Size of the blackhole relative to canvas (0.1 - 0.5) */
23
- blackholeSize?: number;
24
- /** ASCII art to display at the center */
25
- centerAsciiArt?: string[];
26
- /** Color for the center ASCII art */
27
- centerArtColor?: string;
28
- /** Whether to animate the center art */
29
- animateCenterArt?: boolean;
30
- }
31
- /**
32
- * Blackhole effect implementation
33
- */
34
- export declare class TestBlackholeEffect extends BaseEffect {
35
- readonly name = "Blackhole";
36
- readonly description = "Characters are consumed by a black hole with ASCII art center and explode outwards";
37
- private options;
38
- private characterStates;
39
- private animationFrameCount;
40
- private totalFrames;
41
- private _isEffectComplete;
42
- private currentPhase;
43
- private blackholeCenter;
44
- private blackholeRadius;
45
- private blackholeChars;
46
- private centerArtChars;
47
- private centerArtBounds;
48
- private readonly starSymbols;
49
- private readonly starfieldColors;
50
- private readonly defaultPiArt;
51
- constructor(options?: BlackholeEffectOptions);
52
- /**
53
- * Parse ASCII art into character positions
54
- */
55
- private parseAsciiArt;
56
- /**
57
- * Initialize the effect
58
- */
59
- protected onInitialize(): void;
60
- /**
61
- * Calculate gradient colors
62
- */
63
- private calculateGradientColors;
64
- /**
65
- * Get gradient key based on direction
66
- */
67
- private getGradientKey;
68
- /**
69
- * Render the next frame
70
- */
71
- render(): Promise<string[]>;
72
- /**
73
- * Render center ASCII art
74
- */
75
- private renderCenterArt;
76
- /**
77
- * Update animation state for all characters
78
- */
79
- private updateAnimationState;
80
- /**
81
- * Update individual character position
82
- */
83
- private updateCharacterPosition;
84
- /**
85
- * Create visual representation of a character
86
- */
87
- private createCharacterVisual;
88
- /**
89
- * Calculate distance between two coordinates
90
- */
91
- private calculateDistance;
92
- /**
93
- * Get ANSI color code for a color
94
- */
95
- private getColorCode;
96
- /**
97
- * Interpolate between two colors
98
- */
99
- private interpolateColor;
100
- /**
101
- * Render fallback for when effects are disabled
102
- */
103
- renderFallback(): string[];
104
- /**
105
- * Check if effect is complete
106
- */
107
- isComplete(): boolean;
108
- /**
109
- * Reset the effect
110
- */
111
- protected onReset(): void;
112
- }
113
- //# sourceMappingURL=test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../src/effects/implementations/test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,UAAU,EAMX,MAAM,aAAa,CAAC;AAGrB;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,iCAAiC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,yBAAyB;IACzB,iBAAiB,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,UAAU,CAAC;IAC3D,2DAA2D;IAC3D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yCAAyC;IACzC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,qCAAqC;IACrC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wCAAwC;IACxC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAkCD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,UAAU;IACjD,QAAQ,CAAC,IAAI,eAAe;IAC5B,QAAQ,CAAC,WAAW,wFACmE;IAEvF,OAAO,CAAC,OAAO,CAAmC;IAClD,OAAO,CAAC,eAAe,CAAmD;IAC1E,OAAO,CAAC,mBAAmB,CAAa;IACxC,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,iBAAiB,CAAkB;IAG3C,OAAO,CAAC,YAAY,CAKO;IAG3B,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,cAAc,CAAyB;IAG/C,OAAO,CAAC,cAAc,CAAsB;IAC5C,OAAO,CAAC,eAAe,CAA2B;IAGlD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAiD;IAC7E,OAAO,CAAC,QAAQ,CAAC,eAAe,CAO9B;IAGF,OAAO,CAAC,QAAQ,CAAC,YAAY,CA+B3B;gBAEU,OAAO,GAAE,sBAA2B;IAiBhD;;OAEG;IACH,OAAO,CAAC,aAAa;IAuBrB;;OAEG;IACH,SAAS,CAAC,YAAY,IAAI,IAAI;IA8F9B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAwC/B;;OAEG;IACH,OAAO,CAAC,cAAc;IAatB;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IA8CjC;;OAEG;IACH,OAAO,CAAC,eAAe;IA2FvB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAyB5B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAwI/B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAkE7B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAIzB;;OAEG;IACH,OAAO,CAAC,YAAY;IAiBpB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAsBxB;;OAEG;IACH,cAAc,IAAI,MAAM,EAAE;IAI1B;;OAEG;IACH,UAAU,IAAI,OAAO;IAIrB;;OAEG;IACH,SAAS,CAAC,OAAO,IAAI,IAAI;CAS1B"}
@@ -1,552 +0,0 @@
1
- /**
2
- * Blackhole Effect with ASCII Art Center
3
- * Characters are consumed by a black hole with custom ASCII art and explode outwards
4
- */
5
- import { BaseEffect, } from "../types.js";
6
- import { ANSI } from "../utils.js";
7
- /**
8
- * Blackhole effect implementation
9
- */
10
- export class TestBlackholeEffect extends BaseEffect {
11
- constructor(options = {}) {
12
- super();
13
- this.name = "Blackhole";
14
- this.description = "Characters are consumed by a black hole with ASCII art center and explode outwards";
15
- this.characterStates = new Map();
16
- this.animationFrameCount = 0;
17
- this.totalFrames = 0;
18
- this._isEffectComplete = false;
19
- // Animation phase tracking
20
- this.currentPhase = "forming";
21
- // Blackhole properties
22
- this.blackholeCenter = { x: 0, y: 0 };
23
- this.blackholeRadius = 0;
24
- this.blackholeChars = [];
25
- // ASCII art properties
26
- this.centerArtChars = [];
27
- this.centerArtBounds = { width: 0, height: 0 };
28
- // Star symbols
29
- this.starSymbols = ["*", "'", "`", "¤", "•", "°", "·", "✦", "✧"];
30
- this.starfieldColors = [
31
- "4a4a4d",
32
- "808080",
33
- "a0a0a0",
34
- "c0c0c0",
35
- "e0e0e0",
36
- "ffffff",
37
- ];
38
- // Default Pi ASCII art
39
- this.defaultPiArt = [
40
- " πππππππππππππππππππππ ",
41
- " ππππππππππππππππππππππππππ ",
42
- " πππππππππππππππππππππππππππππ ",
43
- " ππππππππππππππππππππππππππππππππ ",
44
- " πππππππππππππππππππππππππππ ",
45
- " ππππππππππππππππππππππππππ ",
46
- " ππππππππ πππππππππ ππππππ ",
47
- " ππππππππ ππππππππ πππππππππ ",
48
- " ππππππππ πππππππ πππππππππππ ",
49
- " πππππππππππ πππππππππ ππππππππππππ ",
50
- " πππππππππππππππππππ πππππππππππππ ",
51
- " πππππππππππππππππ πππππππππππππππ ",
52
- " πππππππππππππππ πππππππππππππππ ",
53
- " ππππππππππππ ππππππππππππππππ ",
54
- " ππ ππππππππππ πππππππππππππππππ ",
55
- " ππππππ πππππππππ πππππππππππππππππ ",
56
- " ππππππππππ πππππππ πππππππππππππππππππ",
57
- "ππππππππππππ πππππππ πππππππππππππππππ",
58
- "ππππππππππππππ πππππππ ππππππππππππππππ",
59
- "ππππππππππππππ ππππππππ ππππππππ ",
60
- " ππππππππππππ ππππππππππ ππππππππ ",
61
- " ππππππππππππ ππππππππππππ ππππππππ ",
62
- " πππππππππππππ πππππππππππππππππππππππ ",
63
- " ππππππππππππ πππππππππππππππππππππππ ",
64
- " ππππππππππππ πππππππππππππππππππππ ",
65
- " πππππππππππ πππππππππππππππππππππ ",
66
- " ππππππππππ ππππππππππππππππππππ ",
67
- " ππππππππππ πππππππππππππππππππ ",
68
- " ππππππππ ππππππππππππππππ ",
69
- " πππππππ πππππππππππ ",
70
- ];
71
- this.options = {
72
- duration: 6000,
73
- blackholeColor: "ffffff",
74
- starColors: ["ffcc0d", "ff7326", "ff194d", "bf2669", "702a8c", "049dbf"],
75
- finalColor: "ffffff",
76
- useGradient: true,
77
- gradientDirection: "diagonal",
78
- blackholeSize: 0.3,
79
- centerAsciiArt: this.defaultPiArt,
80
- centerArtColor: "9945ff",
81
- animateCenterArt: true,
82
- ...options,
83
- };
84
- }
85
- /**
86
- * Parse ASCII art into character positions
87
- */
88
- parseAsciiArt(art) {
89
- this.centerArtChars = [];
90
- let maxX = 0;
91
- let maxY = art.length;
92
- for (let y = 0; y < art.length; y++) {
93
- const line = art[y];
94
- maxX = Math.max(maxX, line.length);
95
- for (let x = 0; x < line.length; x++) {
96
- const char = line[x];
97
- if (char && char !== " ") {
98
- this.centerArtChars.push({
99
- symbol: char,
100
- relativePos: { x, y },
101
- });
102
- }
103
- }
104
- }
105
- this.centerArtBounds = { width: maxX, height: maxY };
106
- }
107
- /**
108
- * Initialize the effect
109
- */
110
- onInitialize() {
111
- this.totalFrames = Math.floor((this.options.duration / 1000) * this.config.frameRate);
112
- const dimensions = this.getCanvasDimensions();
113
- this.blackholeCenter = {
114
- x: Math.floor(dimensions.width / 2),
115
- y: Math.floor(dimensions.height / 2),
116
- };
117
- // Parse ASCII art
118
- this.parseAsciiArt(this.options.centerAsciiArt);
119
- // Calculate radius to accommodate ASCII art
120
- const artRadius = Math.max(Math.ceil(this.centerArtBounds.width / 2), Math.ceil(this.centerArtBounds.height / 2));
121
- this.blackholeRadius = Math.max(artRadius + 5, // Add padding around ASCII art
122
- Math.floor(Math.min(dimensions.width * this.options.blackholeSize, dimensions.height * this.options.blackholeSize)));
123
- // Initialize character states
124
- this.characterStates.clear();
125
- this.blackholeChars = [];
126
- // Calculate final colors for gradient
127
- const gradientColors = this.calculateGradientColors(dimensions);
128
- // Select characters for blackhole ring
129
- const blackholeCharCount = Math.min(Math.floor(this.blackholeRadius * 3), Math.floor(this.characters.length * 0.3));
130
- const shuffledChars = [...this.characters].sort(() => Math.random() - 0.5);
131
- this.blackholeChars = shuffledChars.slice(0, blackholeCharCount);
132
- // Initialize all character states
133
- for (const char of this.characters) {
134
- const key = `${char.originalPosition.x},${char.originalPosition.y}`;
135
- const isBlackholeChar = this.blackholeChars.includes(char);
136
- let finalColor = this.options.finalColor;
137
- if (this.options.useGradient) {
138
- const gradientKey = this.getGradientKey(char.originalPosition, dimensions);
139
- finalColor = gradientColors[gradientKey] || this.options.finalColor;
140
- }
141
- // Random starfield position
142
- const starfieldPos = {
143
- x: Math.floor(Math.random() * dimensions.width),
144
- y: Math.floor(Math.random() * dimensions.height),
145
- };
146
- this.characterStates.set(key, {
147
- phase: "starfield",
148
- isBlackholeRing: isBlackholeChar,
149
- isCenterArt: false,
150
- starSymbol: this.starSymbols[Math.floor(Math.random() * this.starSymbols.length)],
151
- starColor: this.starfieldColors[Math.floor(Math.random() * this.starfieldColors.length)],
152
- position: { ...starfieldPos },
153
- targetPosition: { ...char.originalPosition },
154
- spiralAngle: Math.random() * Math.PI * 2,
155
- spiralRadius: this.calculateDistance(starfieldPos, this.blackholeCenter),
156
- explosionVector: { x: 0, y: 0 },
157
- settlingProgress: 0,
158
- finalColor,
159
- });
160
- }
161
- this.currentPhase = "forming";
162
- this.animationFrameCount = 0;
163
- this._isEffectComplete = false;
164
- }
165
- /**
166
- * Calculate gradient colors
167
- */
168
- calculateGradientColors(dimensions) {
169
- const gradientMap = {};
170
- if (this.options.gradientDirection === "diagonal") {
171
- const maxDist = Math.sqrt(dimensions.width ** 2 + dimensions.height ** 2);
172
- for (let y = 0; y < dimensions.height; y++) {
173
- for (let x = 0; x < dimensions.width; x++) {
174
- const dist = Math.sqrt(x ** 2 + y ** 2);
175
- const factor = dist / maxDist;
176
- const key = `${x},${y}`;
177
- gradientMap[key] = this.interpolateColor(this.options.starColors[this.options.starColors.length - 1], this.options.finalColor, factor);
178
- }
179
- }
180
- }
181
- else {
182
- const size = this.options.gradientDirection === "vertical"
183
- ? dimensions.height
184
- : dimensions.width;
185
- const startColor = this.options.starColors[this.options.starColors.length - 1];
186
- for (let i = 0; i < size; i++) {
187
- const factor = i / (size - 1);
188
- gradientMap[i] = this.interpolateColor(startColor, this.options.finalColor, factor);
189
- }
190
- }
191
- return gradientMap;
192
- }
193
- /**
194
- * Get gradient key based on direction
195
- */
196
- getGradientKey(pos, _dimensions) {
197
- if (this.options.gradientDirection === "diagonal") {
198
- return `${pos.x},${pos.y}`;
199
- }
200
- else if (this.options.gradientDirection === "vertical") {
201
- return pos.y;
202
- }
203
- else {
204
- return pos.x;
205
- }
206
- }
207
- /**
208
- * Render the next frame
209
- */
210
- async render() {
211
- if (!this.isInitialized) {
212
- throw new Error("Effect not initialized");
213
- }
214
- // Update animation state
215
- this.updateAnimationState();
216
- // Create the frame
217
- const dimensions = this.getCanvasDimensions();
218
- const frame = Array(dimensions.height)
219
- .fill("")
220
- .map(() => Array(dimensions.width).fill(" "));
221
- // Render center ASCII art first (so it appears behind other elements)
222
- if (this.currentPhase !== "forming") {
223
- this.renderCenterArt(frame, dimensions);
224
- }
225
- // Render characters
226
- for (const char of this.characters) {
227
- const key = `${char.originalPosition.x},${char.originalPosition.y}`;
228
- const state = this.characterStates.get(key);
229
- if (state && !state.isCenterArt) {
230
- const visual = this.createCharacterVisual(char, state);
231
- char.visual = visual;
232
- const x = Math.round(state.position.x);
233
- const y = Math.round(state.position.y);
234
- if (y >= 0 && y < dimensions.height && x >= 0 && x < dimensions.width) {
235
- // Apply ANSI color codes
236
- const colorCode = this.getColorCode(visual.colors.fg);
237
- const resetCode = ANSI.reset;
238
- frame[y][x] = colorCode + visual.symbol + resetCode;
239
- }
240
- }
241
- }
242
- this.animationFrameCount++;
243
- // Convert frame to strings
244
- return frame.map((row) => row.join(""));
245
- }
246
- /**
247
- * Render center ASCII art
248
- */
249
- renderCenterArt(frame, dimensions) {
250
- const artOffsetX = Math.floor(this.blackholeCenter.x - this.centerArtBounds.width / 2);
251
- const artOffsetY = Math.floor(this.blackholeCenter.y - this.centerArtBounds.height / 2);
252
- // Calculate art properties based on phase
253
- let opacity = 1;
254
- let rotation = 0;
255
- let scale = 1;
256
- if (this.options.animateCenterArt) {
257
- const frameProgress = this.animationFrameCount / this.totalFrames;
258
- switch (this.currentPhase) {
259
- case "forming":
260
- opacity = Math.min(frameProgress / 0.15, 1);
261
- scale = 0.5 + opacity * 0.5;
262
- break;
263
- case "consuming":
264
- rotation = frameProgress * Math.PI * 2;
265
- opacity = 1;
266
- // Pulsate
267
- scale = 1 + Math.sin(frameProgress * Math.PI * 10) * 0.1;
268
- break;
269
- case "collapsing":
270
- const collapseProgress = (frameProgress - 0.5) / 0.1;
271
- scale = 1 - collapseProgress * 0.5;
272
- opacity = 1;
273
- break;
274
- case "exploding":
275
- opacity = 0; // Hide during explosion
276
- break;
277
- }
278
- }
279
- // Render each character
280
- for (const artChar of this.centerArtChars) {
281
- let x = artChar.relativePos.x;
282
- let y = artChar.relativePos.y;
283
- // Apply rotation if animating
284
- if (rotation !== 0 && this.options.animateCenterArt) {
285
- const centerX = this.centerArtBounds.width / 2;
286
- const centerY = this.centerArtBounds.height / 2;
287
- const relX = x - centerX;
288
- const relY = y - centerY;
289
- x = Math.round(centerX + relX * Math.cos(rotation) - relY * Math.sin(rotation));
290
- y = Math.round(centerY + relX * Math.sin(rotation) + relY * Math.cos(rotation));
291
- }
292
- // Apply scale
293
- if (scale !== 1) {
294
- const centerX = this.centerArtBounds.width / 2;
295
- const centerY = this.centerArtBounds.height / 2;
296
- x = Math.round(centerX + (x - centerX) * scale);
297
- y = Math.round(centerY + (y - centerY) * scale);
298
- }
299
- const finalX = artOffsetX + x;
300
- const finalY = artOffsetY + y;
301
- if (finalY >= 0 &&
302
- finalY < dimensions.height &&
303
- finalX >= 0 &&
304
- finalX < dimensions.width &&
305
- opacity > 0.1) {
306
- const colorCode = this.getColorCode(this.options.centerArtColor);
307
- const resetCode = ANSI.reset;
308
- frame[finalY][finalX] = colorCode + artChar.symbol + resetCode;
309
- }
310
- }
311
- }
312
- /**
313
- * Update animation state for all characters
314
- */
315
- updateAnimationState() {
316
- const progress = this.animationFrameCount / this.totalFrames;
317
- // Update phase transitions
318
- if (this.currentPhase === "forming" && progress > 0.15) {
319
- this.currentPhase = "consuming";
320
- }
321
- else if (this.currentPhase === "consuming" && progress > 0.5) {
322
- this.currentPhase = "collapsing";
323
- }
324
- else if (this.currentPhase === "collapsing" && progress > 0.6) {
325
- this.currentPhase = "exploding";
326
- }
327
- else if (this.currentPhase === "exploding" && progress > 0.7) {
328
- this.currentPhase = "settling";
329
- }
330
- // Update character positions based on phase
331
- for (const [_key, state] of this.characterStates) {
332
- if (!state.isCenterArt) {
333
- this.updateCharacterPosition(state);
334
- }
335
- }
336
- // Check completion
337
- this._isEffectComplete = progress >= 1;
338
- }
339
- /**
340
- * Update individual character position
341
- */
342
- updateCharacterPosition(state) {
343
- const frameProgress = this.animationFrameCount / this.totalFrames;
344
- switch (this.currentPhase) {
345
- case "forming":
346
- if (state.isBlackholeRing) {
347
- // Move to blackhole ring position
348
- const ringProgress = Math.min(frameProgress / 0.15, 1);
349
- const angle = (this.blackholeChars.indexOf(this.characters.find((c) => this.characterStates.get(`${c.originalPosition.x},${c.originalPosition.y}`) === state)) /
350
- this.blackholeChars.length) *
351
- Math.PI *
352
- 2;
353
- const targetX = this.blackholeCenter.x + Math.cos(angle) * this.blackholeRadius;
354
- const targetY = this.blackholeCenter.y + Math.sin(angle) * this.blackholeRadius;
355
- state.position.x =
356
- state.position.x +
357
- (targetX - state.position.x) * ringProgress * 0.1;
358
- state.position.y =
359
- state.position.y +
360
- (targetY - state.position.y) * ringProgress * 0.1;
361
- state.phase = "consuming";
362
- }
363
- break;
364
- case "consuming":
365
- if (state.isBlackholeRing) {
366
- // Rotate blackhole ring
367
- const angle = (this.blackholeChars.indexOf(this.characters.find((c) => this.characterStates.get(`${c.originalPosition.x},${c.originalPosition.y}`) === state)) /
368
- this.blackholeChars.length) *
369
- Math.PI *
370
- 2 +
371
- frameProgress * Math.PI * 2;
372
- state.position.x =
373
- this.blackholeCenter.x + Math.cos(angle) * this.blackholeRadius;
374
- state.position.y =
375
- this.blackholeCenter.y + Math.sin(angle) * this.blackholeRadius;
376
- }
377
- else {
378
- // Spiral into blackhole
379
- const consumeProgress = (frameProgress - 0.15) / 0.35;
380
- if (consumeProgress > 0) {
381
- state.spiralAngle += 0.2;
382
- state.spiralRadius *= 0.95;
383
- state.position.x =
384
- this.blackholeCenter.x +
385
- Math.cos(state.spiralAngle) * state.spiralRadius;
386
- state.position.y =
387
- this.blackholeCenter.y +
388
- Math.sin(state.spiralAngle) * state.spiralRadius;
389
- if (state.spiralRadius < 2) {
390
- state.phase = "collapsed";
391
- state.position = { ...this.blackholeCenter };
392
- }
393
- }
394
- }
395
- break;
396
- case "collapsing":
397
- // All characters move to center
398
- const collapseProgress = (frameProgress - 0.5) / 0.1;
399
- if (collapseProgress > 0) {
400
- state.position.x += (this.blackholeCenter.x - state.position.x) * 0.2;
401
- state.position.y += (this.blackholeCenter.y - state.position.y) * 0.2;
402
- state.phase = "collapsed";
403
- }
404
- break;
405
- case "exploding":
406
- // Calculate explosion vector
407
- if (state.explosionVector.x === 0 && state.explosionVector.y === 0) {
408
- const angle = Math.atan2(state.targetPosition.y - this.blackholeCenter.y, state.targetPosition.x - this.blackholeCenter.x);
409
- const distance = this.calculateDistance(state.targetPosition, this.blackholeCenter);
410
- const speed = Math.min(distance * 0.3, 5);
411
- state.explosionVector.x = Math.cos(angle) * speed;
412
- state.explosionVector.y = Math.sin(angle) * speed;
413
- state.phase = "exploding";
414
- }
415
- // Apply explosion movement
416
- state.position.x += state.explosionVector.x;
417
- state.position.y += state.explosionVector.y;
418
- // Dampen explosion
419
- state.explosionVector.x *= 0.9;
420
- state.explosionVector.y *= 0.9;
421
- break;
422
- case "settling":
423
- // Settle to final position
424
- const settleProgress = (frameProgress - 0.7) / 0.3;
425
- if (settleProgress > 0) {
426
- state.position.x += (state.targetPosition.x - state.position.x) * 0.1;
427
- state.position.y += (state.targetPosition.y - state.position.y) * 0.1;
428
- state.settlingProgress = Math.min(settleProgress, 1);
429
- if (Math.abs(state.position.x - state.targetPosition.x) < 0.5 &&
430
- Math.abs(state.position.y - state.targetPosition.y) < 0.5) {
431
- state.position = { ...state.targetPosition };
432
- state.phase = "final";
433
- }
434
- }
435
- break;
436
- }
437
- }
438
- /**
439
- * Create visual representation of a character
440
- */
441
- createCharacterVisual(char, state) {
442
- let symbol = state.starSymbol;
443
- let color = state.starColor;
444
- switch (state.phase) {
445
- case "starfield":
446
- // Initial starfield state
447
- break;
448
- case "consuming":
449
- if (state.isBlackholeRing) {
450
- symbol = "*";
451
- color = this.options.blackholeColor;
452
- }
453
- else {
454
- // Fading as consumed
455
- const fadeColors = ["808080", "606060", "404040", "202020", "000000"];
456
- const fadeIndex = Math.min(Math.floor((1 - state.spiralRadius / 50) * fadeColors.length), fadeColors.length - 1);
457
- color = fadeColors[Math.max(0, fadeIndex)];
458
- }
459
- break;
460
- case "collapsed":
461
- symbol = "●";
462
- color =
463
- this.options.starColors[Math.floor(Math.random() * this.options.starColors.length)];
464
- break;
465
- case "exploding":
466
- symbol = char.originalSymbol;
467
- color =
468
- this.options.starColors[Math.floor(this.animationFrameCount / 2) %
469
- this.options.starColors.length];
470
- break;
471
- case "settling":
472
- case "final":
473
- symbol = char.originalSymbol;
474
- // Fade from star color to final color
475
- const starColor = this.options.starColors[0];
476
- color = this.interpolateColor(starColor, state.finalColor, state.settlingProgress);
477
- break;
478
- }
479
- return {
480
- symbol,
481
- colors: {
482
- fg: color,
483
- bg: null,
484
- },
485
- };
486
- }
487
- /**
488
- * Calculate distance between two coordinates
489
- */
490
- calculateDistance(a, b) {
491
- return Math.sqrt((a.x - b.x) ** 2 + (a.y - b.y) ** 2);
492
- }
493
- /**
494
- * Get ANSI color code for a color
495
- */
496
- getColorCode(color) {
497
- if (!color || this.config.noColor) {
498
- return "";
499
- }
500
- // For RGB colors, convert to ANSI 24-bit color
501
- if (typeof color === "string") {
502
- const r = parseInt(color.substring(0, 2), 16);
503
- const g = parseInt(color.substring(2, 4), 16);
504
- const b = parseInt(color.substring(4, 6), 16);
505
- return `\x1b[38;2;${r};${g};${b}m`;
506
- }
507
- // For XTerm colors
508
- return `\x1b[38;5;${color}m`;
509
- }
510
- /**
511
- * Interpolate between two colors
512
- */
513
- interpolateColor(color1, color2, factor) {
514
- const r1 = parseInt(color1.substring(0, 2), 16);
515
- const g1 = parseInt(color1.substring(2, 4), 16);
516
- const b1 = parseInt(color1.substring(4, 6), 16);
517
- const r2 = parseInt(color2.substring(0, 2), 16);
518
- const g2 = parseInt(color2.substring(2, 4), 16);
519
- const b2 = parseInt(color2.substring(4, 6), 16);
520
- const r = Math.round(r1 + (r2 - r1) * factor);
521
- const g = Math.round(g1 + (g2 - g1) * factor);
522
- const b = Math.round(b1 + (b2 - b1) * factor);
523
- return [r, g, b]
524
- .map((c) => Math.max(0, Math.min(255, c)).toString(16).padStart(2, "0"))
525
- .join("");
526
- }
527
- /**
528
- * Render fallback for when effects are disabled
529
- */
530
- renderFallback() {
531
- return this.text.split("\n");
532
- }
533
- /**
534
- * Check if effect is complete
535
- */
536
- isComplete() {
537
- return this._isEffectComplete;
538
- }
539
- /**
540
- * Reset the effect
541
- */
542
- onReset() {
543
- this.characterStates.clear();
544
- this.blackholeChars = [];
545
- this.centerArtChars = [];
546
- this.currentPhase = "forming";
547
- this.animationFrameCount = 0;
548
- this._isEffectComplete = false;
549
- this.onInitialize();
550
- }
551
- }
552
- //# sourceMappingURL=test.js.map