@kya-os/cli 0.1.0-beta.6 → 0.1.0-beta.7

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 (110) hide show
  1. package/README.md +210 -34
  2. package/dist/commands/check.d.ts.map +1 -1
  3. package/dist/commands/check.js +28 -6
  4. package/dist/commands/check.js.map +1 -1
  5. package/dist/commands/cli-experience-demo-simple.d.ts +14 -0
  6. package/dist/commands/cli-experience-demo-simple.d.ts.map +1 -0
  7. package/dist/commands/cli-experience-demo-simple.js +119 -0
  8. package/dist/commands/cli-experience-demo-simple.js.map +1 -0
  9. package/dist/commands/cli-experience-demo.d.ts +14 -0
  10. package/dist/commands/cli-experience-demo.d.ts.map +1 -0
  11. package/dist/commands/cli-experience-demo.js +172 -0
  12. package/dist/commands/cli-experience-demo.js.map +1 -0
  13. package/dist/commands/effects-demo.d.ts +10 -0
  14. package/dist/commands/effects-demo.d.ts.map +1 -0
  15. package/dist/commands/effects-demo.js +292 -0
  16. package/dist/commands/effects-demo.js.map +1 -0
  17. package/dist/commands/env.d.ts.map +1 -1
  18. package/dist/commands/env.js +12 -2
  19. package/dist/commands/env.js.map +1 -1
  20. package/dist/commands/init.d.ts.map +1 -1
  21. package/dist/commands/init.js +262 -136
  22. package/dist/commands/init.js.map +1 -1
  23. package/dist/commands/rotate.d.ts.map +1 -1
  24. package/dist/commands/rotate.js +19 -3
  25. package/dist/commands/rotate.js.map +1 -1
  26. package/dist/dev.d.ts +7 -0
  27. package/dist/dev.d.ts.map +1 -0
  28. package/dist/dev.js +9 -0
  29. package/dist/dev.js.map +1 -0
  30. package/dist/effects/__tests__/effects.test.d.ts +5 -0
  31. package/dist/effects/__tests__/effects.test.d.ts.map +1 -0
  32. package/dist/effects/__tests__/effects.test.js +206 -0
  33. package/dist/effects/__tests__/effects.test.js.map +1 -0
  34. package/dist/effects/animation-engine.d.ts +173 -0
  35. package/dist/effects/animation-engine.d.ts.map +1 -0
  36. package/dist/effects/animation-engine.js +254 -0
  37. package/dist/effects/animation-engine.js.map +1 -0
  38. package/dist/effects/cli-integration.d.ts +86 -0
  39. package/dist/effects/cli-integration.d.ts.map +1 -0
  40. package/dist/effects/cli-integration.js +309 -0
  41. package/dist/effects/cli-integration.js.map +1 -0
  42. package/dist/effects/config.d.ts +95 -0
  43. package/dist/effects/config.d.ts.map +1 -0
  44. package/dist/effects/config.js +216 -0
  45. package/dist/effects/config.js.map +1 -0
  46. package/dist/effects/effect-runner.d.ts +69 -0
  47. package/dist/effects/effect-runner.d.ts.map +1 -0
  48. package/dist/effects/effect-runner.js +255 -0
  49. package/dist/effects/effect-runner.js.map +1 -0
  50. package/dist/effects/gradient.d.ts +131 -0
  51. package/dist/effects/gradient.d.ts.map +1 -0
  52. package/dist/effects/gradient.js +236 -0
  53. package/dist/effects/gradient.js.map +1 -0
  54. package/dist/effects/implementations/beams.d.ts +80 -0
  55. package/dist/effects/implementations/beams.d.ts.map +1 -0
  56. package/dist/effects/implementations/beams.js +221 -0
  57. package/dist/effects/implementations/beams.js.map +1 -0
  58. package/dist/effects/implementations/binary-path.d.ts +88 -0
  59. package/dist/effects/implementations/binary-path.d.ts.map +1 -0
  60. package/dist/effects/implementations/binary-path.js +296 -0
  61. package/dist/effects/implementations/binary-path.js.map +1 -0
  62. package/dist/effects/implementations/blackhole.d.ts +98 -0
  63. package/dist/effects/implementations/blackhole.d.ts.map +1 -0
  64. package/dist/effects/implementations/blackhole.js +394 -0
  65. package/dist/effects/implementations/blackhole.js.map +1 -0
  66. package/dist/effects/implementations/burn.d.ts +74 -0
  67. package/dist/effects/implementations/burn.d.ts.map +1 -0
  68. package/dist/effects/implementations/burn.js +234 -0
  69. package/dist/effects/implementations/burn.js.map +1 -0
  70. package/dist/effects/implementations/decrypt.d.ts +115 -0
  71. package/dist/effects/implementations/decrypt.d.ts.map +1 -0
  72. package/dist/effects/implementations/decrypt.js +394 -0
  73. package/dist/effects/implementations/decrypt.js.map +1 -0
  74. package/dist/effects/implementations/test.d.ts +113 -0
  75. package/dist/effects/implementations/test.d.ts.map +1 -0
  76. package/dist/effects/implementations/test.js +552 -0
  77. package/dist/effects/implementations/test.js.map +1 -0
  78. package/dist/effects/implementations/waves.d.ts +78 -0
  79. package/dist/effects/implementations/waves.d.ts.map +1 -0
  80. package/dist/effects/implementations/waves.js +278 -0
  81. package/dist/effects/implementations/waves.js.map +1 -0
  82. package/dist/effects/index.d.ts +37 -0
  83. package/dist/effects/index.d.ts.map +1 -0
  84. package/dist/effects/index.js +79 -0
  85. package/dist/effects/index.js.map +1 -0
  86. package/dist/effects/motion-engine.d.ts +168 -0
  87. package/dist/effects/motion-engine.d.ts.map +1 -0
  88. package/dist/effects/motion-engine.js +353 -0
  89. package/dist/effects/motion-engine.js.map +1 -0
  90. package/dist/effects/safe-executor.d.ts +55 -0
  91. package/dist/effects/safe-executor.d.ts.map +1 -0
  92. package/dist/effects/safe-executor.js +210 -0
  93. package/dist/effects/safe-executor.js.map +1 -0
  94. package/dist/effects/template/effect-template.d.ts +97 -0
  95. package/dist/effects/template/effect-template.d.ts.map +1 -0
  96. package/dist/effects/template/effect-template.js +208 -0
  97. package/dist/effects/template/effect-template.js.map +1 -0
  98. package/dist/effects/types.d.ts +199 -0
  99. package/dist/effects/types.d.ts.map +1 -0
  100. package/dist/effects/types.js +80 -0
  101. package/dist/effects/types.js.map +1 -0
  102. package/dist/effects/utils.d.ts +104 -0
  103. package/dist/effects/utils.d.ts.map +1 -0
  104. package/dist/effects/utils.js +280 -0
  105. package/dist/effects/utils.js.map +1 -0
  106. package/dist/index.d.ts +2 -1
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +48 -42
  109. package/dist/index.js.map +1 -1
  110. package/package.json +4 -1
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Effect Template
3
+ * Base template for creating new terminal effects
4
+ *
5
+ * To create a new effect:
6
+ * 1. Copy this file and rename it to your effect name
7
+ * 2. Update the class name and description
8
+ * 3. Define your effect-specific options interface
9
+ * 4. Implement the effect logic in onInitialize and render
10
+ * 5. Register your effect in src/effects/index.ts
11
+ */
12
+ import { BaseEffect } from "../types.js";
13
+ /**
14
+ * Configuration options for the Template effect
15
+ * Define all customizable parameters here
16
+ */
17
+ export interface TemplateEffectOptions {
18
+ /** Duration in milliseconds */
19
+ duration?: number;
20
+ /** Primary color for the effect */
21
+ primaryColor?: string;
22
+ /** Secondary color for the effect */
23
+ secondaryColor?: string;
24
+ /** Speed multiplier for animations */
25
+ speed?: number;
26
+ }
27
+ /**
28
+ * Template Effect implementation
29
+ * Replace "Template" with your effect name throughout
30
+ */
31
+ export declare class TemplateEffect extends BaseEffect {
32
+ readonly name = "Template";
33
+ readonly description = "Description of what this effect does";
34
+ private options;
35
+ private animationFrameCount;
36
+ private totalFrames;
37
+ private _isEffectComplete;
38
+ private effectState;
39
+ constructor(options?: TemplateEffectOptions);
40
+ /**
41
+ * Initialize the effect
42
+ * Called when the effect starts
43
+ */
44
+ protected onInitialize(): void;
45
+ /**
46
+ * Render the next frame
47
+ * This is called for each frame of the animation
48
+ */
49
+ render(): Promise<string[]>;
50
+ /**
51
+ * Update the effect state for the current frame
52
+ * Implement your animation logic here
53
+ */
54
+ private updateEffectState;
55
+ /**
56
+ * Determine how to render a specific character
57
+ * This is where the visual effect is applied
58
+ */
59
+ private getCharacterRender;
60
+ /**
61
+ * Interpolate between two colors
62
+ * Utility method for color transitions
63
+ */
64
+ private interpolateColor;
65
+ /**
66
+ * Get ANSI color code for a color
67
+ * Converts color to terminal escape sequence
68
+ */
69
+ private getColorCode;
70
+ /**
71
+ * Render fallback for when effects are disabled
72
+ * Simply returns the original text
73
+ */
74
+ renderFallback(): string[];
75
+ /**
76
+ * Check if effect is complete
77
+ * Return true when the animation should end
78
+ */
79
+ isComplete(): boolean;
80
+ /**
81
+ * Reset the effect
82
+ * Called when the effect needs to restart
83
+ */
84
+ protected onReset(): void;
85
+ }
86
+ /**
87
+ * Example usage in src/effects/index.ts:
88
+ *
89
+ * import { TemplateEffect } from "./implementations/template.js";
90
+ *
91
+ * registerEffect({
92
+ * name: "template",
93
+ * description: "Description of what this effect does",
94
+ * factory: () => new TemplateEffect(),
95
+ * });
96
+ */
97
+ //# sourceMappingURL=effect-template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effect-template.d.ts","sourceRoot":"","sources":["../../../src/effects/template/effect-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAS,MAAM,aAAa,CAAC;AAGhD;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mCAAmC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAGhB;AAYD;;;GAGG;AACH,qBAAa,cAAe,SAAQ,UAAU;IAE5C,QAAQ,CAAC,IAAI,cAAc;IAC3B,QAAQ,CAAC,WAAW,0CAA0C;IAG9D,OAAO,CAAC,OAAO,CAAkC;IAGjD,OAAO,CAAC,mBAAmB,CAAa;IACxC,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,iBAAiB,CAAkB;IAC3C,OAAO,CAAC,WAAW,CAAc;gBAErB,OAAO,GAAE,qBAA0B;IAmB/C;;;OAGG;IACH,SAAS,CAAC,YAAY,IAAI,IAAI;IAuB9B;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAwCjC;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAkBzB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAyB1B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAsBxB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAkBpB;;;OAGG;IACH,cAAc,IAAI,MAAM,EAAE;IAI1B;;;OAGG;IACH,UAAU,IAAI,OAAO;IAIrB;;;OAGG;IACH,SAAS,CAAC,OAAO,IAAI,IAAI;CAQ1B;AAED;;;;;;;;;;GAUG"}
@@ -0,0 +1,208 @@
1
+ /**
2
+ * Effect Template
3
+ * Base template for creating new terminal effects
4
+ *
5
+ * To create a new effect:
6
+ * 1. Copy this file and rename it to your effect name
7
+ * 2. Update the class name and description
8
+ * 3. Define your effect-specific options interface
9
+ * 4. Implement the effect logic in onInitialize and render
10
+ * 5. Register your effect in src/effects/index.ts
11
+ */
12
+ import { BaseEffect } from "../types.js";
13
+ import { ANSI, easeInOutSine } from "../utils.js";
14
+ /**
15
+ * Template Effect implementation
16
+ * Replace "Template" with your effect name throughout
17
+ */
18
+ export class TemplateEffect extends BaseEffect {
19
+ constructor(options = {}) {
20
+ super();
21
+ // Effect metadata
22
+ this.name = "Template"; // Change this to your effect name
23
+ this.description = "Description of what this effect does"; // Update description
24
+ // Internal state
25
+ this.animationFrameCount = 0;
26
+ this.totalFrames = 0;
27
+ this._isEffectComplete = false;
28
+ // Merge provided options with defaults
29
+ this.options = {
30
+ duration: 3000,
31
+ primaryColor: "00ff00",
32
+ secondaryColor: "ffffff",
33
+ speed: 1.0,
34
+ // Set default values for all options
35
+ ...options,
36
+ };
37
+ // Initialize state
38
+ this.effectState = {
39
+ exampleProperty: 0,
40
+ };
41
+ }
42
+ /**
43
+ * Initialize the effect
44
+ * Called when the effect starts
45
+ */
46
+ onInitialize() {
47
+ // Calculate total frames based on duration and frame rate
48
+ this.totalFrames = Math.floor((this.options.duration / 1000) * this.config.frameRate);
49
+ // Reset counters
50
+ this.animationFrameCount = 0;
51
+ this._isEffectComplete = false;
52
+ // Initialize character states
53
+ // Example: Hide all characters initially
54
+ for (const char of this.characters) {
55
+ char.visual.symbol = " ";
56
+ char.visual.colors.fg = this.options.primaryColor;
57
+ }
58
+ // Set up any initial state needed for the effect
59
+ this.effectState = {
60
+ exampleProperty: 0,
61
+ };
62
+ }
63
+ /**
64
+ * Render the next frame
65
+ * This is called for each frame of the animation
66
+ */
67
+ async render() {
68
+ if (!this.isInitialized) {
69
+ throw new Error("Effect not initialized");
70
+ }
71
+ // Update effect state for this frame
72
+ this.updateEffectState();
73
+ // Render text line by line
74
+ const lines = this.text.split("\n");
75
+ const renderedLines = [];
76
+ for (let y = 0; y < lines.length; y++) {
77
+ let line = "";
78
+ const chars = [...lines[y]];
79
+ for (let x = 0; x < chars.length; x++) {
80
+ const char = chars[x];
81
+ // Apply effect logic to determine how to render this character
82
+ const { symbol, color } = this.getCharacterRender(char, x, y);
83
+ if (color) {
84
+ const colorCode = this.getColorCode(color);
85
+ const resetCode = ANSI.reset;
86
+ line += colorCode + symbol + resetCode;
87
+ }
88
+ else {
89
+ line += symbol;
90
+ }
91
+ }
92
+ renderedLines.push(line);
93
+ }
94
+ // Increment frame counter
95
+ this.animationFrameCount++;
96
+ return renderedLines;
97
+ }
98
+ /**
99
+ * Update the effect state for the current frame
100
+ * Implement your animation logic here
101
+ */
102
+ updateEffectState() {
103
+ // Calculate animation progress (0 to 1)
104
+ const progress = this.animationFrameCount / this.totalFrames;
105
+ // Apply easing for smooth animation
106
+ const easedProgress = easeInOutSine(progress);
107
+ // Update state based on progress
108
+ this.effectState.exampleProperty = easedProgress;
109
+ // Example: Check if effect should complete
110
+ if (progress >= 1.0) {
111
+ this._isEffectComplete = true;
112
+ }
113
+ // Add your effect-specific state updates here
114
+ }
115
+ /**
116
+ * Determine how to render a specific character
117
+ * This is where the visual effect is applied
118
+ */
119
+ getCharacterRender(char, _x, _y) {
120
+ // Example: Simple fade-in effect
121
+ const progress = this.effectState.exampleProperty;
122
+ if (progress < 0.5) {
123
+ // First half: show nothing
124
+ return { symbol: " ", color: null };
125
+ }
126
+ else {
127
+ // Second half: fade in the character
128
+ const fadeProgress = (progress - 0.5) * 2;
129
+ const color = this.interpolateColor("000000", this.options.primaryColor, fadeProgress);
130
+ return { symbol: char, color };
131
+ }
132
+ // Implement your effect-specific rendering logic here
133
+ }
134
+ /**
135
+ * Interpolate between two colors
136
+ * Utility method for color transitions
137
+ */
138
+ interpolateColor(color1, color2, factor) {
139
+ const r1 = parseInt(color1.substring(0, 2), 16);
140
+ const g1 = parseInt(color1.substring(2, 4), 16);
141
+ const b1 = parseInt(color1.substring(4, 6), 16);
142
+ const r2 = parseInt(color2.substring(0, 2), 16);
143
+ const g2 = parseInt(color2.substring(2, 4), 16);
144
+ const b2 = parseInt(color2.substring(4, 6), 16);
145
+ const r = Math.round(r1 + (r2 - r1) * factor);
146
+ const g = Math.round(g1 + (g2 - g1) * factor);
147
+ const b = Math.round(b1 + (b2 - b1) * factor);
148
+ return [r, g, b]
149
+ .map((c) => Math.max(0, Math.min(255, c)).toString(16).padStart(2, "0"))
150
+ .join("");
151
+ }
152
+ /**
153
+ * Get ANSI color code for a color
154
+ * Converts color to terminal escape sequence
155
+ */
156
+ getColorCode(color) {
157
+ if (!color || this.config.noColor) {
158
+ return "";
159
+ }
160
+ // For RGB colors, convert to ANSI 24-bit color
161
+ if (typeof color === "string") {
162
+ const r = parseInt(color.substring(0, 2), 16);
163
+ const g = parseInt(color.substring(2, 4), 16);
164
+ const b = parseInt(color.substring(4, 6), 16);
165
+ return `\x1b[38;2;${r};${g};${b}m`;
166
+ }
167
+ // For XTerm colors
168
+ return `\x1b[38;5;${color}m`;
169
+ }
170
+ /**
171
+ * Render fallback for when effects are disabled
172
+ * Simply returns the original text
173
+ */
174
+ renderFallback() {
175
+ return this.text.split("\n");
176
+ }
177
+ /**
178
+ * Check if effect is complete
179
+ * Return true when the animation should end
180
+ */
181
+ isComplete() {
182
+ return this._isEffectComplete;
183
+ }
184
+ /**
185
+ * Reset the effect
186
+ * Called when the effect needs to restart
187
+ */
188
+ onReset() {
189
+ this.animationFrameCount = 0;
190
+ this._isEffectComplete = false;
191
+ this.effectState = {
192
+ exampleProperty: 0,
193
+ };
194
+ this.onInitialize();
195
+ }
196
+ }
197
+ /**
198
+ * Example usage in src/effects/index.ts:
199
+ *
200
+ * import { TemplateEffect } from "./implementations/template.js";
201
+ *
202
+ * registerEffect({
203
+ * name: "template",
204
+ * description: "Description of what this effect does",
205
+ * factory: () => new TemplateEffect(),
206
+ * });
207
+ */
208
+ //# sourceMappingURL=effect-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effect-template.js","sourceRoot":"","sources":["../../../src/effects/template/effect-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAS,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA6BlD;;;GAGG;AACH,MAAM,OAAO,cAAe,SAAQ,UAAU;IAc5C,YAAY,UAAiC,EAAE;QAC7C,KAAK,EAAE,CAAC;QAdV,kBAAkB;QACT,SAAI,GAAG,UAAU,CAAC,CAAC,kCAAkC;QACrD,gBAAW,GAAG,sCAAsC,CAAC,CAAC,qBAAqB;QAKpF,iBAAiB;QACT,wBAAmB,GAAW,CAAC,CAAC;QAChC,gBAAW,GAAW,CAAC,CAAC;QACxB,sBAAiB,GAAY,KAAK,CAAC;QAMzC,uCAAuC;QACvC,IAAI,CAAC,OAAO,GAAG;YACb,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,QAAQ;YACtB,cAAc,EAAE,QAAQ;YACxB,KAAK,EAAE,GAAG;YACV,qCAAqC;YACrC,GAAG,OAAO;SACX,CAAC;QAEF,mBAAmB;QACnB,IAAI,CAAC,WAAW,GAAG;YACjB,eAAe,EAAE,CAAC;SACnB,CAAC;IACJ,CAAC;IAED;;;OAGG;IACO,YAAY;QACpB,0DAA0D;QAC1D,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAC3B,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CACvD,CAAC;QAEF,iBAAiB;QACjB,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC;QA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BAAmB,GAAG,CAAC,CAAC;QAC7B,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG;YACjB,eAAe,EAAE,CAAC;SACnB,CAAC;QACF,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;CACF;AAED;;;;;;;;;;GAUG"}
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Core types and interfaces for the Terminal Effects Engine
3
+ * Based on TerminalTextEffects Python library architecture
4
+ */
5
+ /**
6
+ * RGB color string in hex format (without #)
7
+ */
8
+ export type RGBColor = string;
9
+ /**
10
+ * XTerm 256 color code
11
+ */
12
+ export type XTermColor = number;
13
+ /**
14
+ * Color can be RGB hex or XTerm-256
15
+ */
16
+ export type Color = RGBColor | XTermColor | null;
17
+ /**
18
+ * Color pair for foreground and background
19
+ */
20
+ export interface ColorPair {
21
+ fg: Color;
22
+ bg: Color;
23
+ }
24
+ /**
25
+ * Character visual state at a point in time
26
+ */
27
+ export interface CharacterVisual {
28
+ symbol: string;
29
+ colors: ColorPair;
30
+ }
31
+ /**
32
+ * Single frame of animation
33
+ */
34
+ export interface Frame {
35
+ characters: CharacterVisual[];
36
+ duration?: number;
37
+ }
38
+ /**
39
+ * Terminal dimensions
40
+ */
41
+ export interface TerminalDimensions {
42
+ width: number;
43
+ height: number;
44
+ }
45
+ /**
46
+ * Coordinate in 2D space
47
+ */
48
+ export interface Coordinate {
49
+ x: number;
50
+ y: number;
51
+ }
52
+ /**
53
+ * Animation easing function
54
+ */
55
+ export type EasingFunction = (t: number) => number;
56
+ /**
57
+ * Effect configuration options
58
+ */
59
+ export interface EffectConfig {
60
+ /** Target frame rate (fps) */
61
+ frameRate: number;
62
+ /** Use XTerm colors instead of RGB */
63
+ useXTermColors: boolean;
64
+ /** Disable all colors */
65
+ noColor: boolean;
66
+ /** Canvas dimensions */
67
+ canvas?: TerminalDimensions;
68
+ /** Custom parameters for specific effects */
69
+ [key: string]: any;
70
+ }
71
+ /**
72
+ * Base interface for all effects
73
+ */
74
+ export interface Effect {
75
+ /** Effect name for identification */
76
+ readonly name: string;
77
+ /** Effect description */
78
+ readonly description: string;
79
+ /** Initialize the effect with text and config */
80
+ initialize(text: string, config: Partial<EffectConfig>): void;
81
+ /** Render the next frame of the effect */
82
+ render(): Promise<string[]>;
83
+ /** Render fallback plain text version */
84
+ renderFallback(): string[];
85
+ /** Check if the effect is complete */
86
+ isComplete(): boolean;
87
+ /** Reset the effect to initial state */
88
+ reset(): void;
89
+ /** Cleanup any resources */
90
+ cleanup(): void;
91
+ }
92
+ /**
93
+ * Scene represents a sequence of visual changes
94
+ */
95
+ export interface Scene {
96
+ id: string;
97
+ frames: Frame[];
98
+ isLooping: boolean;
99
+ currentFrame: number;
100
+ }
101
+ /**
102
+ * Motion path for character movement
103
+ */
104
+ export interface Path {
105
+ waypoints: Coordinate[];
106
+ currentPosition: number;
107
+ easing?: EasingFunction;
108
+ }
109
+ /**
110
+ * Character state including position and animation
111
+ */
112
+ export interface EffectCharacter {
113
+ id: string;
114
+ originalSymbol: string;
115
+ originalPosition: Coordinate;
116
+ currentPosition: Coordinate;
117
+ visual: CharacterVisual;
118
+ motion?: Path;
119
+ scene?: Scene;
120
+ }
121
+ /**
122
+ * Effect execution result
123
+ */
124
+ export interface EffectResult {
125
+ success: boolean;
126
+ frames?: string[];
127
+ error?: Error;
128
+ duration?: number;
129
+ }
130
+ /**
131
+ * Terminal capability detection result
132
+ */
133
+ export interface TerminalCapabilities {
134
+ supportsColor: boolean;
135
+ supports256Color: boolean;
136
+ supportsTrueColor: boolean;
137
+ dimensions: TerminalDimensions;
138
+ isInteractive: boolean;
139
+ }
140
+ /**
141
+ * Effect registry entry
142
+ */
143
+ export interface EffectRegistryEntry {
144
+ name: string;
145
+ description: string;
146
+ factory: () => Effect;
147
+ }
148
+ /**
149
+ * Safety configuration for effects
150
+ */
151
+ export interface SafetyConfig {
152
+ /** Maximum execution time in milliseconds */
153
+ maxExecutionTime: number;
154
+ /** Maximum memory usage in MB */
155
+ maxMemoryUsage: number;
156
+ /** Enable performance monitoring */
157
+ enableMonitoring: boolean;
158
+ /** Force fallback mode */
159
+ forceFallback: boolean;
160
+ }
161
+ /**
162
+ * Performance metrics for monitoring
163
+ */
164
+ export interface PerformanceMetrics {
165
+ frameCount: number;
166
+ totalDuration: number;
167
+ averageFrameTime: number;
168
+ maxFrameTime: number;
169
+ memoryUsage: number;
170
+ }
171
+ /**
172
+ * Abstract base class for effects
173
+ */
174
+ export declare abstract class BaseEffect implements Effect {
175
+ abstract readonly name: string;
176
+ abstract readonly description: string;
177
+ protected text: string;
178
+ protected config: EffectConfig;
179
+ protected characters: EffectCharacter[];
180
+ protected frameCount: number;
181
+ protected isInitialized: boolean;
182
+ initialize(text: string, config: Partial<EffectConfig>): void;
183
+ abstract render(): Promise<string[]>;
184
+ abstract renderFallback(): string[];
185
+ abstract isComplete(): boolean;
186
+ reset(): void;
187
+ cleanup(): void;
188
+ protected abstract onInitialize(): void;
189
+ protected abstract onReset(): void;
190
+ protected onCleanup(): void;
191
+ protected createCharacters(text: string): EffectCharacter[];
192
+ protected getCanvasDimensions(): TerminalDimensions;
193
+ }
194
+ /**
195
+ * Type guard for Color types
196
+ */
197
+ export declare function isRGBColor(color: Color): color is RGBColor;
198
+ export declare function isXTermColor(color: Color): color is XTermColor;
199
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/effects/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,QAAQ,GAAG,UAAU,GAAG,IAAI,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,KAAK,CAAC;IACV,EAAE,EAAE,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BAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,EAAE;IAwB3D,SAAS,CAAC,mBAAmB,IAAI,kBAAkB;CAYpD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,QAAQ,CAE1D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,UAAU,CAE9D"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Core types and interfaces for the Terminal Effects Engine
3
+ * Based on TerminalTextEffects Python library architecture
4
+ */
5
+ /**
6
+ * Abstract base class for effects
7
+ */
8
+ export class BaseEffect {
9
+ constructor() {
10
+ this.text = "";
11
+ this.config = {
12
+ frameRate: 30,
13
+ useXTermColors: false,
14
+ noColor: false,
15
+ };
16
+ this.characters = [];
17
+ this.frameCount = 0;
18
+ this.isInitialized = false;
19
+ }
20
+ initialize(text, config) {
21
+ this.text = text;
22
+ this.config = { ...this.config, ...config };
23
+ this.characters = this.createCharacters(text);
24
+ this.isInitialized = true;
25
+ this.onInitialize();
26
+ }
27
+ reset() {
28
+ this.frameCount = 0;
29
+ this.characters = this.createCharacters(this.text);
30
+ this.onReset();
31
+ }
32
+ cleanup() {
33
+ this.characters = [];
34
+ this.onCleanup();
35
+ }
36
+ onCleanup() {
37
+ // Optional cleanup hook
38
+ }
39
+ createCharacters(text) {
40
+ const lines = text.split("\n");
41
+ const characters = [];
42
+ lines.forEach((line, y) => {
43
+ [...line].forEach((char, x) => {
44
+ if (char !== " ") {
45
+ characters.push({
46
+ id: `${x}-${y}`,
47
+ originalSymbol: char,
48
+ originalPosition: { x, y },
49
+ currentPosition: { x, y },
50
+ visual: {
51
+ symbol: char,
52
+ colors: { fg: null, bg: null },
53
+ },
54
+ });
55
+ }
56
+ });
57
+ });
58
+ return characters;
59
+ }
60
+ getCanvasDimensions() {
61
+ if (this.config.canvas) {
62
+ return this.config.canvas;
63
+ }
64
+ // Calculate from text if no canvas specified
65
+ const lines = this.text.split("\n");
66
+ const height = lines.length;
67
+ const width = Math.max(...lines.map((line) => line.length));
68
+ return { width, height };
69
+ }
70
+ }
71
+ /**
72
+ * Type guard for Color types
73
+ */
74
+ export function isRGBColor(color) {
75
+ return typeof color === "string" && /^[0-9a-fA-F]{6}$/.test(color);
76
+ }
77
+ export function isXTermColor(color) {
78
+ return typeof color === "number" && color >= 0 && color <= 255;
79
+ }
80
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/effects/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkMH;;GAEG;AACH,MAAM,OAAgB,UAAU;IAAhC;QAIY,SAAI,GAAW,EAAE,CAAC;QAClB,WAAM,GAAiB;YAC/B,SAAS,EAAE,EAAE;YACb,cAAc,EAAE,KAAK;YACrB,OAAO,EAAE,KAAK;SACf,CAAC;QAEQ,eAAU,GAAsB,EAAE,CAAC;QACnC,eAAU,GAAW,CAAC,CAAC;QACvB,kBAAa,GAAY,KAAK,CAAC;IAuE3C,CAAC;IArEC,UAAU,CAAC,IAAY,EAAE,MAA6B;QACpD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;QAC5C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;IAQD,KAAK;QACH,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;IAED,OAAO;QACL,IAAI,CAAC,UAAU,GAA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