claude-face 0.1.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.
- package/README.md +72 -0
- package/dist/bin/cli.d.ts +2 -0
- package/dist/bin/cli.js +128 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/src/config.d.ts +24 -0
- package/dist/src/config.js +32 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/face.d.ts +60 -0
- package/dist/src/face.js +472 -0
- package/dist/src/face.js.map +1 -0
- package/dist/src/frames.d.ts +1 -0
- package/dist/src/frames.js +3 -0
- package/dist/src/frames.js.map +1 -0
- package/dist/src/ipc.d.ts +27 -0
- package/dist/src/ipc.js +136 -0
- package/dist/src/ipc.js.map +1 -0
- package/dist/src/loader.d.ts +2 -0
- package/dist/src/loader.js +87 -0
- package/dist/src/loader.js.map +1 -0
- package/dist/src/main.d.ts +2 -0
- package/dist/src/main.js +201 -0
- package/dist/src/main.js.map +1 -0
- package/dist/src/patterns.d.ts +6 -0
- package/dist/src/patterns.js +14 -0
- package/dist/src/patterns.js.map +1 -0
- package/dist/src/pty.d.ts +17 -0
- package/dist/src/pty.js +84 -0
- package/dist/src/pty.js.map +1 -0
- package/dist/src/scroll.d.ts +36 -0
- package/dist/src/scroll.js +56 -0
- package/dist/src/scroll.js.map +1 -0
- package/dist/src/state.d.ts +35 -0
- package/dist/src/state.js +158 -0
- package/dist/src/state.js.map +1 -0
- package/dist/src/theme.d.ts +15 -0
- package/dist/src/theme.js +51 -0
- package/dist/src/theme.js.map +1 -0
- package/dist/src/types.d.ts +58 -0
- package/dist/src/types.js +3 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils.d.ts +14 -0
- package/dist/src/utils.js +26 -0
- package/dist/src/utils.js.map +1 -0
- package/package.json +33 -0
package/dist/src/face.js
ADDED
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
import { colorForRole } from './theme.js';
|
|
2
|
+
import { config } from './config.js';
|
|
3
|
+
// ── Helper ──────────────────────────────────────────────────────────
|
|
4
|
+
/**
|
|
5
|
+
* Render a single art row with ANSI color spans applied.
|
|
6
|
+
* Accepts pre-sorted spans for this specific row only.
|
|
7
|
+
*/
|
|
8
|
+
export function renderRow(art, rowSpans, theme) {
|
|
9
|
+
if (rowSpans.length === 0) {
|
|
10
|
+
return art;
|
|
11
|
+
}
|
|
12
|
+
let result = '';
|
|
13
|
+
let spanIdx = 0;
|
|
14
|
+
let inSpan = false;
|
|
15
|
+
for (let col = 0; col < art.length; col++) {
|
|
16
|
+
// Check if we are leaving the current span
|
|
17
|
+
if (inSpan && spanIdx < rowSpans.length) {
|
|
18
|
+
const cur = rowSpans[spanIdx];
|
|
19
|
+
if (col >= cur.col + cur.len) {
|
|
20
|
+
result += theme.reset;
|
|
21
|
+
inSpan = false;
|
|
22
|
+
spanIdx++;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
// Check if we are entering a new span
|
|
26
|
+
while (spanIdx < rowSpans.length && !inSpan) {
|
|
27
|
+
const next = rowSpans[spanIdx];
|
|
28
|
+
if (col >= next.col && col < next.col + next.len) {
|
|
29
|
+
result += colorForRole(theme, next.role);
|
|
30
|
+
inSpan = true;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
else if (col < next.col) {
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
spanIdx++;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
result += art[col];
|
|
41
|
+
}
|
|
42
|
+
// Close any still-open span
|
|
43
|
+
if (inSpan) {
|
|
44
|
+
result += theme.reset;
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
// ── Span cache ──────────────────────────────────────────────────────
|
|
49
|
+
const spanCacheKey = Symbol('spansByRow');
|
|
50
|
+
function getSpansByRow(frame) {
|
|
51
|
+
const cached = frame[spanCacheKey];
|
|
52
|
+
if (cached)
|
|
53
|
+
return cached;
|
|
54
|
+
const map = new Map();
|
|
55
|
+
for (const span of frame.colors ?? []) {
|
|
56
|
+
let arr = map.get(span.row);
|
|
57
|
+
if (!arr) {
|
|
58
|
+
arr = [];
|
|
59
|
+
map.set(span.row, arr);
|
|
60
|
+
}
|
|
61
|
+
arr.push(span);
|
|
62
|
+
}
|
|
63
|
+
for (const arr of map.values()) {
|
|
64
|
+
arr.sort((a, b) => a.col - b.col);
|
|
65
|
+
}
|
|
66
|
+
frame[spanCacheKey] = map;
|
|
67
|
+
return map;
|
|
68
|
+
}
|
|
69
|
+
const EMPTY_SPANS = [];
|
|
70
|
+
// ── ANSI constants ──────────────────────────────────────────────────
|
|
71
|
+
const HIDE_CURSOR = '\x1b[?25l';
|
|
72
|
+
const CURSOR_HOME = '\x1b[H';
|
|
73
|
+
const CLEAR_SCREEN = '\x1b[2J';
|
|
74
|
+
const DIM_ON = '\x1b[2m';
|
|
75
|
+
const DIM_OFF = '\x1b[0m';
|
|
76
|
+
// ── FaceRenderer ────────────────────────────────────────────────────
|
|
77
|
+
const { minRenderIntervalMs: MIN_RENDER_INTERVAL_MS, transitionDurationMs: TRANSITION_DURATION_MS, transitionTickMs: TRANSITION_TICK_MS, sigmoidSteepness: SIGMOID_STEEPNESS, } = config;
|
|
78
|
+
export class FaceRenderer {
|
|
79
|
+
face;
|
|
80
|
+
theme;
|
|
81
|
+
currentState = 'idle';
|
|
82
|
+
currentFrameIndex = 0;
|
|
83
|
+
// Animation — self-throttling setTimeout with time-based frame selection.
|
|
84
|
+
animationTimer = null;
|
|
85
|
+
cycleStartTime = 0;
|
|
86
|
+
animCycleDuration = 0;
|
|
87
|
+
animForwardDuration = 0;
|
|
88
|
+
animFrameDuration = 0;
|
|
89
|
+
animFrameCount = 0;
|
|
90
|
+
animHasReverse = false;
|
|
91
|
+
animGapMin = 0;
|
|
92
|
+
animGapMax = 0;
|
|
93
|
+
animTickMs = MIN_RENDER_INTERVAL_MS;
|
|
94
|
+
// Render state
|
|
95
|
+
stdoutDraining = true;
|
|
96
|
+
hasRenderedOnce = false;
|
|
97
|
+
lastRenderedState = null;
|
|
98
|
+
lastRenderedFrame = -1;
|
|
99
|
+
// Pre-rendered frame cache stored as Buffers — avoids per-write UTF-8 encoding.
|
|
100
|
+
// Uses cursor-home + sequential rows instead of per-row cursor positioning,
|
|
101
|
+
// cutting ANSI escape sequences from ~40 per frame to 3.
|
|
102
|
+
frameCache = new Map();
|
|
103
|
+
clearScreenBuf = Buffer.alloc(0);
|
|
104
|
+
cachedCols = 0;
|
|
105
|
+
cachedRows = 0;
|
|
106
|
+
// Transition state — per-character flip with sigmoid-distributed timing.
|
|
107
|
+
transitioning = false;
|
|
108
|
+
transitionTimer = null;
|
|
109
|
+
transitionStartTime = 0;
|
|
110
|
+
transitionFlipTimes = null;
|
|
111
|
+
transitionOldArt = [];
|
|
112
|
+
transitionNewArt = [];
|
|
113
|
+
transitionOldRoles = [];
|
|
114
|
+
transitionNewRoles = [];
|
|
115
|
+
transitionNewState = 'idle';
|
|
116
|
+
constructor(face, theme) {
|
|
117
|
+
this.face = face;
|
|
118
|
+
this.theme = theme;
|
|
119
|
+
process.stdout.on('drain', () => {
|
|
120
|
+
this.stdoutDraining = true;
|
|
121
|
+
});
|
|
122
|
+
this.rebuildFrameCache();
|
|
123
|
+
}
|
|
124
|
+
// ── Pre-render all frames ───────────────────────────────────────
|
|
125
|
+
//
|
|
126
|
+
// Strategy: instead of 40 individual \x1b[row;1H cursor-position escapes
|
|
127
|
+
// per frame (expensive for terminal to parse), we use:
|
|
128
|
+
// \x1b[?25l — hide cursor (1 escape)
|
|
129
|
+
// \x1b[H — cursor home (1 escape)
|
|
130
|
+
// row\r\n — sequential rows with carriage-return + newline
|
|
131
|
+
// \x1b[2m — dim for status (1 escape)
|
|
132
|
+
//
|
|
133
|
+
// This cuts terminal escape parsing from ~40 per frame to ~3.
|
|
134
|
+
// Empty lines pad for vertical centering. Rows are clipped to terminal size.
|
|
135
|
+
rebuildFrameCache() {
|
|
136
|
+
const cols = process.stdout.columns ?? 80;
|
|
137
|
+
const rows = process.stdout.rows ?? 24;
|
|
138
|
+
this.cachedCols = cols;
|
|
139
|
+
this.cachedRows = rows;
|
|
140
|
+
this.frameCache.clear();
|
|
141
|
+
const hOffset = Math.max(0, Math.floor((cols - this.face.width) / 2));
|
|
142
|
+
const vOffset = Math.max(0, Math.floor((rows - this.face.height - 1) / 2));
|
|
143
|
+
const pad = ' '.repeat(hOffset);
|
|
144
|
+
const visibleArtWidth = Math.min(this.face.width, cols - hOffset);
|
|
145
|
+
const trailingPad = ' '.repeat(Math.max(0, cols - hOffset - visibleArtWidth));
|
|
146
|
+
const emptyLine = ' '.repeat(cols);
|
|
147
|
+
this.clearScreenBuf = Buffer.from(HIDE_CURSOR + CLEAR_SCREEN);
|
|
148
|
+
// How many art rows fit on screen (reserve 1 for status)
|
|
149
|
+
const maxArtRows = Math.max(0, rows - vOffset - 1);
|
|
150
|
+
for (const [stateName, expression] of Object.entries(this.face.expressions)) {
|
|
151
|
+
const expr = expression;
|
|
152
|
+
const rendered = [];
|
|
153
|
+
// Status line content
|
|
154
|
+
const statusPad = Math.max(0, Math.floor((cols - stateName.length) / 2));
|
|
155
|
+
const statusTrail = ' '.repeat(Math.max(0, cols - statusPad - stateName.length));
|
|
156
|
+
const statusContent = ' '.repeat(statusPad) + DIM_ON + stateName + DIM_OFF + statusTrail;
|
|
157
|
+
for (const frame of expr.frames) {
|
|
158
|
+
const spansByRow = getSpansByRow(frame);
|
|
159
|
+
const lines = [];
|
|
160
|
+
// Start with hide cursor + cursor home
|
|
161
|
+
lines.push(HIDE_CURSOR + CURSOR_HOME);
|
|
162
|
+
// Top padding (empty lines for vertical centering)
|
|
163
|
+
for (let i = 0; i < vOffset; i++) {
|
|
164
|
+
lines.push(emptyLine);
|
|
165
|
+
}
|
|
166
|
+
// Art rows (clipped to visible area)
|
|
167
|
+
const artRowCount = Math.min(frame.art.length, maxArtRows);
|
|
168
|
+
for (let r = 0; r < artRowCount; r++) {
|
|
169
|
+
const artRow = visibleArtWidth < frame.art[r].length
|
|
170
|
+
? frame.art[r].slice(0, visibleArtWidth)
|
|
171
|
+
: frame.art[r];
|
|
172
|
+
const rowSpans = spansByRow.get(r) ?? EMPTY_SPANS;
|
|
173
|
+
const colored = renderRow(artRow, rowSpans, this.theme);
|
|
174
|
+
lines.push(pad + colored + trailingPad);
|
|
175
|
+
}
|
|
176
|
+
// Status line
|
|
177
|
+
lines.push(statusContent);
|
|
178
|
+
// Bottom padding (fill rest of screen to overwrite stale content)
|
|
179
|
+
const usedRows = vOffset + artRowCount + 1;
|
|
180
|
+
for (let i = usedRows; i < rows; i++) {
|
|
181
|
+
lines.push(emptyLine);
|
|
182
|
+
}
|
|
183
|
+
// Join with \r\n and encode to Buffer once
|
|
184
|
+
rendered.push(Buffer.from(lines.join('\r\n')));
|
|
185
|
+
}
|
|
186
|
+
this.frameCache.set(stateName, rendered);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// ── Public API ──────────────────────────────────────────────────
|
|
190
|
+
setState(state) {
|
|
191
|
+
if (state === this.currentState && !this.transitioning && this.animationTimer !== null)
|
|
192
|
+
return;
|
|
193
|
+
// Capture where we're transitioning *from* before clearing state.
|
|
194
|
+
const fromState = this.transitioning ? this.transitionNewState : this.currentState;
|
|
195
|
+
const fromFrameIdx = this.transitioning ? 0 : this.currentFrameIndex;
|
|
196
|
+
this.stopAnimation();
|
|
197
|
+
this.stopTransition();
|
|
198
|
+
this.currentState = state;
|
|
199
|
+
this.currentFrameIndex = 0;
|
|
200
|
+
const expression = this.face.expressions[state];
|
|
201
|
+
if (!expression)
|
|
202
|
+
return;
|
|
203
|
+
// If we've already rendered and the state actually changed, transition.
|
|
204
|
+
if (this.hasRenderedOnce && fromState !== state) {
|
|
205
|
+
const fromExpr = this.face.expressions[fromState];
|
|
206
|
+
if (fromExpr) {
|
|
207
|
+
const oldFrame = fromExpr.frames[fromFrameIdx] ?? fromExpr.frames[0];
|
|
208
|
+
const newFrame = expression.frames[0];
|
|
209
|
+
this.beginTransition(oldFrame, newFrame, state);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// First render or missing old expression — hard cut.
|
|
214
|
+
this.renderNow();
|
|
215
|
+
if (expression.frames.length > 1) {
|
|
216
|
+
this.startAnimation(expression);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
invalidateCache() {
|
|
220
|
+
this.stopTransition();
|
|
221
|
+
this.rebuildFrameCache();
|
|
222
|
+
this.lastRenderedState = null;
|
|
223
|
+
this.lastRenderedFrame = -1;
|
|
224
|
+
this.renderNow();
|
|
225
|
+
}
|
|
226
|
+
showMessage(msg) {
|
|
227
|
+
const cols = process.stdout.columns ?? 80;
|
|
228
|
+
const rows = process.stdout.rows ?? 24;
|
|
229
|
+
const hOffset = Math.max(0, Math.floor((cols - msg.length) / 2));
|
|
230
|
+
const vOffset = Math.max(0, Math.floor(rows / 2));
|
|
231
|
+
let out = HIDE_CURSOR + CLEAR_SCREEN;
|
|
232
|
+
out += `\x1b[${vOffset};1H`;
|
|
233
|
+
out += ' '.repeat(hOffset) + DIM_ON + msg + DIM_OFF;
|
|
234
|
+
process.stdout.write(out);
|
|
235
|
+
}
|
|
236
|
+
destroy() {
|
|
237
|
+
this.stopAnimation();
|
|
238
|
+
this.stopTransition();
|
|
239
|
+
}
|
|
240
|
+
// ── Transition ─────────────────────────────────────────────────
|
|
241
|
+
buildRoleGrid(frame, artRows, artCols) {
|
|
242
|
+
const spansByRow = getSpansByRow(frame);
|
|
243
|
+
const grid = [];
|
|
244
|
+
for (let r = 0; r < artRows; r++) {
|
|
245
|
+
const row = new Array(artCols).fill(null);
|
|
246
|
+
const spans = spansByRow.get(r) ?? EMPTY_SPANS;
|
|
247
|
+
for (const span of spans) {
|
|
248
|
+
const end = Math.min(span.col + span.len, artCols);
|
|
249
|
+
for (let c = span.col; c < end; c++) {
|
|
250
|
+
row[c] = span.role;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
grid.push(row);
|
|
254
|
+
}
|
|
255
|
+
return grid;
|
|
256
|
+
}
|
|
257
|
+
generateFlipTimes(totalPositions, duration) {
|
|
258
|
+
const times = new Float32Array(totalPositions);
|
|
259
|
+
const scale = duration / SIGMOID_STEEPNESS;
|
|
260
|
+
const half = duration / 2;
|
|
261
|
+
for (let i = 0; i < totalPositions; i++) {
|
|
262
|
+
// Uniform random in (0,1), clamped away from extremes to avoid ±Infinity
|
|
263
|
+
const u = 0.001 + Math.random() * 0.998;
|
|
264
|
+
// Logistic quantile — maps uniform distribution to sigmoid-shaped timing
|
|
265
|
+
times[i] = Math.max(0, Math.min(duration, half + scale * Math.log(u / (1 - u))));
|
|
266
|
+
}
|
|
267
|
+
return times;
|
|
268
|
+
}
|
|
269
|
+
beginTransition(oldFrame, newFrame, toState) {
|
|
270
|
+
const artRows = Math.max(oldFrame.art.length, newFrame.art.length);
|
|
271
|
+
const artCols = this.face.width;
|
|
272
|
+
this.transitionOldArt = oldFrame.art;
|
|
273
|
+
this.transitionNewArt = newFrame.art;
|
|
274
|
+
this.transitionOldRoles = this.buildRoleGrid(oldFrame, artRows, artCols);
|
|
275
|
+
this.transitionNewRoles = this.buildRoleGrid(newFrame, artRows, artCols);
|
|
276
|
+
this.transitionNewState = toState;
|
|
277
|
+
this.transitionFlipTimes = this.generateFlipTimes(artRows * artCols, TRANSITION_DURATION_MS);
|
|
278
|
+
this.transitionStartTime = Date.now();
|
|
279
|
+
this.transitioning = true;
|
|
280
|
+
// Invalidate so renderNow works after transition finishes
|
|
281
|
+
this.lastRenderedState = null;
|
|
282
|
+
this.lastRenderedFrame = -1;
|
|
283
|
+
this.renderTransitionFrame();
|
|
284
|
+
this.scheduleTransitionTick();
|
|
285
|
+
}
|
|
286
|
+
scheduleTransitionTick() {
|
|
287
|
+
this.transitionTimer = setTimeout(() => this.transitionTick(), TRANSITION_TICK_MS);
|
|
288
|
+
}
|
|
289
|
+
transitionTick() {
|
|
290
|
+
this.transitionTimer = null;
|
|
291
|
+
if (!this.transitioning)
|
|
292
|
+
return;
|
|
293
|
+
if (Date.now() - this.transitionStartTime >= TRANSITION_DURATION_MS) {
|
|
294
|
+
this.finishTransition();
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
this.renderTransitionFrame();
|
|
298
|
+
this.scheduleTransitionTick();
|
|
299
|
+
}
|
|
300
|
+
finishTransition() {
|
|
301
|
+
this.transitioning = false;
|
|
302
|
+
this.transitionFlipTimes = null;
|
|
303
|
+
this.lastRenderedState = null;
|
|
304
|
+
this.lastRenderedFrame = -1;
|
|
305
|
+
this.renderNow();
|
|
306
|
+
const expression = this.face.expressions[this.currentState];
|
|
307
|
+
if (expression && expression.frames.length > 1) {
|
|
308
|
+
this.startAnimation(expression);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
stopTransition() {
|
|
312
|
+
this.transitioning = false;
|
|
313
|
+
if (this.transitionTimer !== null) {
|
|
314
|
+
clearTimeout(this.transitionTimer);
|
|
315
|
+
this.transitionTimer = null;
|
|
316
|
+
}
|
|
317
|
+
this.transitionFlipTimes = null;
|
|
318
|
+
}
|
|
319
|
+
renderTransitionFrame() {
|
|
320
|
+
if (!this.stdoutDraining)
|
|
321
|
+
return;
|
|
322
|
+
const cols = process.stdout.columns ?? 80;
|
|
323
|
+
const rows = process.stdout.rows ?? 24;
|
|
324
|
+
if (cols !== this.cachedCols || rows !== this.cachedRows) {
|
|
325
|
+
// Terminal resized mid-transition — snap to new state.
|
|
326
|
+
this.finishTransition();
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
const elapsed = Date.now() - this.transitionStartTime;
|
|
330
|
+
const flipTimes = this.transitionFlipTimes;
|
|
331
|
+
const faceWidth = this.face.width;
|
|
332
|
+
const hOffset = Math.max(0, Math.floor((cols - faceWidth) / 2));
|
|
333
|
+
const vOffset = Math.max(0, Math.floor((rows - this.face.height - 1) / 2));
|
|
334
|
+
const pad = ' '.repeat(hOffset);
|
|
335
|
+
const visibleArtWidth = Math.min(faceWidth, cols - hOffset);
|
|
336
|
+
const trailingPad = ' '.repeat(Math.max(0, cols - hOffset - visibleArtWidth));
|
|
337
|
+
const emptyLine = ' '.repeat(cols);
|
|
338
|
+
const maxArtRows = Math.max(0, rows - vOffset - 1);
|
|
339
|
+
const artRowCount = Math.min(this.transitionOldArt.length, this.transitionNewArt.length, maxArtRows);
|
|
340
|
+
const lines = [];
|
|
341
|
+
lines.push(HIDE_CURSOR + CURSOR_HOME);
|
|
342
|
+
for (let i = 0; i < vOffset; i++) {
|
|
343
|
+
lines.push(emptyLine);
|
|
344
|
+
}
|
|
345
|
+
for (let r = 0; r < artRowCount; r++) {
|
|
346
|
+
// Build composite art string and color spans for this row.
|
|
347
|
+
let compositeArt = '';
|
|
348
|
+
const compositeSpans = [];
|
|
349
|
+
let currentRole = null;
|
|
350
|
+
let spanStart = 0;
|
|
351
|
+
for (let c = 0; c < visibleArtWidth; c++) {
|
|
352
|
+
const flipped = elapsed >= flipTimes[r * faceWidth + c];
|
|
353
|
+
const ch = flipped
|
|
354
|
+
? (this.transitionNewArt[r]?.[c] ?? ' ')
|
|
355
|
+
: (this.transitionOldArt[r]?.[c] ?? ' ');
|
|
356
|
+
const role = flipped
|
|
357
|
+
? (this.transitionNewRoles[r]?.[c] ?? null)
|
|
358
|
+
: (this.transitionOldRoles[r]?.[c] ?? null);
|
|
359
|
+
if (role !== currentRole) {
|
|
360
|
+
if (currentRole !== null) {
|
|
361
|
+
compositeSpans.push({ row: r, col: spanStart, len: c - spanStart, role: currentRole });
|
|
362
|
+
}
|
|
363
|
+
currentRole = role;
|
|
364
|
+
spanStart = c;
|
|
365
|
+
}
|
|
366
|
+
compositeArt += ch;
|
|
367
|
+
}
|
|
368
|
+
if (currentRole !== null) {
|
|
369
|
+
compositeSpans.push({ row: r, col: spanStart, len: visibleArtWidth - spanStart, role: currentRole });
|
|
370
|
+
}
|
|
371
|
+
const colored = renderRow(compositeArt, compositeSpans, this.theme);
|
|
372
|
+
lines.push(pad + colored + trailingPad);
|
|
373
|
+
}
|
|
374
|
+
// Status line — show the incoming state name
|
|
375
|
+
const stateName = this.transitionNewState;
|
|
376
|
+
const statusPad = Math.max(0, Math.floor((cols - stateName.length) / 2));
|
|
377
|
+
const statusTrail = ' '.repeat(Math.max(0, cols - statusPad - stateName.length));
|
|
378
|
+
lines.push(' '.repeat(statusPad) + DIM_ON + stateName + DIM_OFF + statusTrail);
|
|
379
|
+
const usedRows = vOffset + artRowCount + 1;
|
|
380
|
+
for (let i = usedRows; i < rows; i++) {
|
|
381
|
+
lines.push(emptyLine);
|
|
382
|
+
}
|
|
383
|
+
this.stdoutDraining = process.stdout.write(Buffer.from(lines.join('\r\n')));
|
|
384
|
+
}
|
|
385
|
+
// ── Animation ───────────────────────────────────────────────────
|
|
386
|
+
startAnimation(expression) {
|
|
387
|
+
const config = expression.config;
|
|
388
|
+
const frameCount = expression.frames.length;
|
|
389
|
+
const frameDuration = config.loopDuration / frameCount;
|
|
390
|
+
const forwardDuration = config.loopDuration;
|
|
391
|
+
const reverseDuration = config.reverse ? config.loopDuration : 0;
|
|
392
|
+
this.animFrameCount = frameCount;
|
|
393
|
+
this.animFrameDuration = frameDuration;
|
|
394
|
+
this.animForwardDuration = forwardDuration;
|
|
395
|
+
this.animHasReverse = config.reverse;
|
|
396
|
+
this.animGapMin = config.gapMin ?? config.gap;
|
|
397
|
+
this.animGapMax = config.gapMax ?? config.gap;
|
|
398
|
+
this.animTickMs = Math.max(Math.round(frameDuration), MIN_RENDER_INTERVAL_MS);
|
|
399
|
+
this.startNewCycle();
|
|
400
|
+
this.scheduleNextTick();
|
|
401
|
+
}
|
|
402
|
+
startNewCycle() {
|
|
403
|
+
this.cycleStartTime = Date.now();
|
|
404
|
+
const gap = this.animGapMin + Math.random() * (this.animGapMax - this.animGapMin);
|
|
405
|
+
const reverseDuration = this.animHasReverse ? this.animForwardDuration : 0;
|
|
406
|
+
this.animCycleDuration = this.animForwardDuration + reverseDuration + gap;
|
|
407
|
+
}
|
|
408
|
+
scheduleNextTick() {
|
|
409
|
+
this.animationTimer = setTimeout(() => this.animationTick(), this.animTickMs);
|
|
410
|
+
}
|
|
411
|
+
animationTick() {
|
|
412
|
+
this.animationTimer = null;
|
|
413
|
+
const elapsed = Date.now() - this.cycleStartTime;
|
|
414
|
+
// If we've passed the end of this cycle, start a new one with a fresh random gap
|
|
415
|
+
if (elapsed >= this.animCycleDuration) {
|
|
416
|
+
this.startNewCycle();
|
|
417
|
+
}
|
|
418
|
+
const cyclePos = Date.now() - this.cycleStartTime;
|
|
419
|
+
let newFrame;
|
|
420
|
+
if (cyclePos < this.animForwardDuration) {
|
|
421
|
+
newFrame = Math.min(Math.floor(cyclePos / this.animFrameDuration), this.animFrameCount - 1);
|
|
422
|
+
}
|
|
423
|
+
else if (this.animHasReverse && cyclePos < this.animForwardDuration * 2) {
|
|
424
|
+
const revPos = cyclePos - this.animForwardDuration;
|
|
425
|
+
newFrame = Math.max(this.animFrameCount - 1 - Math.floor(revPos / this.animFrameDuration), 0);
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
newFrame = 0;
|
|
429
|
+
}
|
|
430
|
+
if (newFrame !== this.currentFrameIndex) {
|
|
431
|
+
this.currentFrameIndex = newFrame;
|
|
432
|
+
this.renderNow();
|
|
433
|
+
}
|
|
434
|
+
this.scheduleNextTick();
|
|
435
|
+
}
|
|
436
|
+
stopAnimation() {
|
|
437
|
+
if (this.animationTimer !== null) {
|
|
438
|
+
clearTimeout(this.animationTimer);
|
|
439
|
+
this.animationTimer = null;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
// ── Rendering ───────────────────────────────────────────────────
|
|
443
|
+
renderNow() {
|
|
444
|
+
if (!this.stdoutDraining)
|
|
445
|
+
return;
|
|
446
|
+
const cols = process.stdout.columns ?? 80;
|
|
447
|
+
const rows = process.stdout.rows ?? 24;
|
|
448
|
+
if (cols !== this.cachedCols || rows !== this.cachedRows) {
|
|
449
|
+
this.rebuildFrameCache();
|
|
450
|
+
}
|
|
451
|
+
if (this.lastRenderedState === this.currentState &&
|
|
452
|
+
this.lastRenderedFrame === this.currentFrameIndex) {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
const frames = this.frameCache.get(this.currentState);
|
|
456
|
+
if (!frames)
|
|
457
|
+
return;
|
|
458
|
+
const output = frames[this.currentFrameIndex];
|
|
459
|
+
if (!output)
|
|
460
|
+
return;
|
|
461
|
+
if (!this.hasRenderedOnce) {
|
|
462
|
+
this.stdoutDraining = process.stdout.write(Buffer.concat([this.clearScreenBuf, output]));
|
|
463
|
+
this.hasRenderedOnce = true;
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
this.stdoutDraining = process.stdout.write(output);
|
|
467
|
+
}
|
|
468
|
+
this.lastRenderedState = this.currentState;
|
|
469
|
+
this.lastRenderedFrame = this.currentFrameIndex;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
//# sourceMappingURL=face.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"face.js","sourceRoot":"","sources":["../../src/face.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,uEAAuE;AAEvE;;;GAGG;AACH,MAAM,UAAU,SAAS,CACvB,GAAW,EACX,QAAqB,EACrB,KAAkB;IAElB,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,GAAG,CAAC;IACb,CAAC;IAED,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI,MAAM,GAAG,KAAK,CAAC;IAEnB,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC;QAC1C,2CAA2C;QAC3C,I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AE,CAAC;QACvC,IAAI,IAAI,KAAK,IAAI,CAAC,UAAU,IAAI,IAAI,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;YACzD,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC3B,CAAC;QAED,IACE,IAAI,CAAC,iBAAiB,KAAK,IAAI,CAAC,YAAY;YAC5C,IAAI,CAAC,iBAAiB,KAAK,IAAI,CAAC,iBAAiB,EACjD,CAAC;YACD,OAAO;QACT,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACtD,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC9C,IAAI,CAAC,MAAM;YAAE,OAAO;QAEpB,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YAC1B,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;YACzF,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC9B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACrD,CAAC;QAED,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,YAAY,CAAC;QAC3C,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC;IAClD,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const defaultFace: import("./types.js").FaceDefinition;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frames.js","sourceRoot":"","sources":["../../src/frames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FaceState } from './types.js';
|
|
2
|
+
export declare function getSocketPath(): string;
|
|
3
|
+
export declare class StateServer {
|
|
4
|
+
private server;
|
|
5
|
+
private clients;
|
|
6
|
+
private socketPath;
|
|
7
|
+
constructor(socketPath: string);
|
|
8
|
+
broadcast(state: FaceState): void;
|
|
9
|
+
close(): void;
|
|
10
|
+
}
|
|
11
|
+
export declare class StateClient {
|
|
12
|
+
private socket;
|
|
13
|
+
private socketPath;
|
|
14
|
+
private onState;
|
|
15
|
+
private onDisconnect?;
|
|
16
|
+
private onConnect?;
|
|
17
|
+
private buffer;
|
|
18
|
+
private retryTimer;
|
|
19
|
+
private closed;
|
|
20
|
+
constructor(socketPath: string, onState: (state: FaceState) => void, opts?: {
|
|
21
|
+
onDisconnect?: () => void;
|
|
22
|
+
onConnect?: () => void;
|
|
23
|
+
});
|
|
24
|
+
private connect;
|
|
25
|
+
private scheduleRetry;
|
|
26
|
+
close(): void;
|
|
27
|
+
}
|