@corenel/web-ui 0.7.0 → 0.9.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 (108) hide show
  1. package/dist/Composer.d.ts.map +1 -1
  2. package/dist/Composer.js +184 -172
  3. package/dist/Composer.js.map +1 -1
  4. package/dist/ContextBar.d.ts +1 -4
  5. package/dist/ContextBar.d.ts.map +1 -1
  6. package/dist/ContextBar.js +2 -2
  7. package/dist/ContextBar.js.map +1 -1
  8. package/dist/ContextManager.d.ts +3 -6
  9. package/dist/ContextManager.d.ts.map +1 -1
  10. package/dist/ContextManager.js +58 -10
  11. package/dist/ContextManager.js.map +1 -1
  12. package/dist/SummaryTranscript.d.ts +11 -1
  13. package/dist/SummaryTranscript.d.ts.map +1 -1
  14. package/dist/SummaryTranscript.js +47 -10
  15. package/dist/SummaryTranscript.js.map +1 -1
  16. package/dist/ToolFold.d.ts +9 -0
  17. package/dist/ToolFold.d.ts.map +1 -0
  18. package/dist/ToolFold.js +32 -0
  19. package/dist/ToolFold.js.map +1 -0
  20. package/dist/Transcript.d.ts +30 -1
  21. package/dist/Transcript.d.ts.map +1 -1
  22. package/dist/Transcript.js +132 -23
  23. package/dist/Transcript.js.map +1 -1
  24. package/dist/agentChat/AgentChat.d.ts +19 -5
  25. package/dist/agentChat/AgentChat.d.ts.map +1 -1
  26. package/dist/agentChat/AgentChat.js +174 -91
  27. package/dist/agentChat/AgentChat.js.map +1 -1
  28. package/dist/agentChat/OptionsDrawer.d.ts +0 -23
  29. package/dist/agentChat/OptionsDrawer.d.ts.map +1 -1
  30. package/dist/agentChat/OptionsDrawer.js +10 -45
  31. package/dist/agentChat/OptionsDrawer.js.map +1 -1
  32. package/dist/agentChat/PlanReview.d.ts +56 -0
  33. package/dist/agentChat/PlanReview.d.ts.map +1 -0
  34. package/dist/agentChat/PlanReview.js +269 -0
  35. package/dist/agentChat/PlanReview.js.map +1 -0
  36. package/dist/agentChat/SkillsSection.js +4 -2
  37. package/dist/agentChat/SkillsSection.js.map +1 -1
  38. package/dist/agentChat/controller.d.ts +12 -3
  39. package/dist/agentChat/controller.d.ts.map +1 -1
  40. package/dist/agentChat/controller.js.map +1 -1
  41. package/dist/arrivalEffect.d.ts +28 -0
  42. package/dist/arrivalEffect.d.ts.map +1 -0
  43. package/dist/arrivalEffect.js +114 -0
  44. package/dist/arrivalEffect.js.map +1 -0
  45. package/dist/commandTurn.d.ts.map +1 -1
  46. package/dist/commandTurn.js +3 -2
  47. package/dist/commandTurn.js.map +1 -1
  48. package/dist/fx/AsteroidsOverlay.d.ts +6 -0
  49. package/dist/fx/AsteroidsOverlay.d.ts.map +1 -0
  50. package/dist/fx/AsteroidsOverlay.js +166 -0
  51. package/dist/fx/AsteroidsOverlay.js.map +1 -0
  52. package/dist/fx/FlapRow.d.ts +8 -0
  53. package/dist/fx/FlapRow.d.ts.map +1 -0
  54. package/dist/fx/FlapRow.js +12 -0
  55. package/dist/fx/FlapRow.js.map +1 -0
  56. package/dist/fx/FxText.d.ts +11 -0
  57. package/dist/fx/FxText.d.ts.map +1 -0
  58. package/dist/fx/FxText.js +50 -0
  59. package/dist/fx/FxText.js.map +1 -0
  60. package/dist/fx/LiveAnswer.d.ts +17 -0
  61. package/dist/fx/LiveAnswer.d.ts.map +1 -0
  62. package/dist/fx/LiveAnswer.js +298 -0
  63. package/dist/fx/LiveAnswer.js.map +1 -0
  64. package/dist/fx/MatrixRain.d.ts +5 -0
  65. package/dist/fx/MatrixRain.d.ts.map +1 -0
  66. package/dist/fx/MatrixRain.js +73 -0
  67. package/dist/fx/MatrixRain.js.map +1 -0
  68. package/dist/fx/NetsplitJoin.d.ts +3 -0
  69. package/dist/fx/NetsplitJoin.d.ts.map +1 -0
  70. package/dist/fx/NetsplitJoin.js +13 -0
  71. package/dist/fx/NetsplitJoin.js.map +1 -0
  72. package/dist/fx/arrivalModes.d.ts +27 -0
  73. package/dist/fx/arrivalModes.d.ts.map +1 -0
  74. package/dist/fx/arrivalModes.js +107 -0
  75. package/dist/fx/arrivalModes.js.map +1 -0
  76. package/dist/fx/tail.d.ts +16 -0
  77. package/dist/fx/tail.d.ts.map +1 -0
  78. package/dist/fx/tail.js +54 -0
  79. package/dist/fx/tail.js.map +1 -0
  80. package/dist/fx/useReveal.d.ts +2 -0
  81. package/dist/fx/useReveal.d.ts.map +1 -0
  82. package/dist/fx/useReveal.js +59 -0
  83. package/dist/fx/useReveal.js.map +1 -0
  84. package/dist/observed.d.ts +16 -0
  85. package/dist/observed.d.ts.map +1 -0
  86. package/dist/observed.js +33 -0
  87. package/dist/observed.js.map +1 -0
  88. package/dist/toolRender.d.ts +6 -2
  89. package/dist/toolRender.d.ts.map +1 -1
  90. package/dist/toolRender.js +27 -17
  91. package/dist/toolRender.js.map +1 -1
  92. package/dist/transcriptSkin.d.ts +23 -0
  93. package/dist/transcriptSkin.d.ts.map +1 -0
  94. package/dist/transcriptSkin.js +255 -0
  95. package/dist/transcriptSkin.js.map +1 -0
  96. package/dist/transcriptSkinCss.d.ts +4 -0
  97. package/dist/transcriptSkinCss.d.ts.map +1 -0
  98. package/dist/transcriptSkinCss.js +136 -0
  99. package/dist/transcriptSkinCss.js.map +1 -0
  100. package/dist/usageSummary.d.ts +31 -0
  101. package/dist/usageSummary.d.ts.map +1 -0
  102. package/dist/usageSummary.js +39 -0
  103. package/dist/usageSummary.js.map +1 -0
  104. package/dist/verificationView.d.ts +3 -0
  105. package/dist/verificationView.d.ts.map +1 -0
  106. package/dist/verificationView.js +37 -0
  107. package/dist/verificationView.js.map +1 -0
  108. package/package.json +5 -5
@@ -0,0 +1,298 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /* The in-progress answer under an arrival effect.
3
+ *
4
+ * The streamed text itself is never rewritten: a paced reveal decides how much
5
+ * of it Markdown renders (see arrivalModes.ts for how each effect commits),
6
+ * and the effect's decoration is drawn after it (the tail). The tail is DOM
7
+ * decoration appended to the newest block after each render -- aria-hidden,
8
+ * never selectable, never part of the text, and gone once the reveal catches
9
+ * up. With no effect, or under reduced motion, this is plain Markdown. */
10
+ import { useEffect, useLayoutEffect, useRef, useState } from 'react';
11
+ import { Markdown } from '../RichContent';
12
+ import { prefersReducedMotion } from '../arrivalEffect';
13
+ import { useReveal } from './useReveal';
14
+ import { TAIL_MAX, tailGlyphs, tailHost } from './tail';
15
+ import { bandEnd, bandText, committedAt, isBandEffect, lineCount, paceFor, signalGlyphs, SIGNAL_TAIL } from './arrivalModes';
16
+ const TILE = 'display:inline-flex;align-items:center;justify-content:center;width:.95em;height:1.3em;margin:0 1px;border-radius:2px;' +
17
+ 'vertical-align:middle;background:linear-gradient(#262626 0 49%,#0a0a0a 49% 51%,#1d1d1d 51%);color:#f3f1e8;' +
18
+ 'font:700 .85em var(--font-mono, ui-monospace, monospace)';
19
+ /* Colours come from the text (currentColor) so every effect reads on every
20
+ * skin and theme; the skin's --accent only tints glows, which degrade to
21
+ * nothing where it is missing. */
22
+ const GLOW = 'var(--accent, #4fd1ff)';
23
+ // Signal lock's small vertical roll as a new line starts: six steps, ~350 ms.
24
+ const ROLL_PX = [-5, -3, 2, 4, 1, 0];
25
+ const ROLL_MS = 350;
26
+ // Teleprinter paper feed: one small step up, then back.
27
+ const FEED_MS = 140;
28
+ // Effects whose tail re-rolls between reveal ticks.
29
+ const REROLL = new Set(['matrix', 'splitflap', 'decode', 'typewriter', 'signal']);
30
+ function tailSpan(effect) {
31
+ const span = document.createElement('span');
32
+ span.className = 'fx-tail';
33
+ span.setAttribute('aria-hidden', 'true');
34
+ span.dataset.fxTail = effect;
35
+ // Decoration: never selectable, so it is never part of copied text, and
36
+ // never takes the pointer (a band tail must not act as a link).
37
+ span.style.userSelect = 'none';
38
+ span.style.pointerEvents = 'none';
39
+ return span;
40
+ }
41
+ /** A band of words (radar contacts, pencil sketch). `age` 0 is the newest word. */
42
+ function buildBand(effect, band) {
43
+ const span = tailSpan(effect);
44
+ const words = bandText(band).split(' ');
45
+ words.forEach((w, i) => {
46
+ if (i > 0)
47
+ span.appendChild(document.createTextNode(' '));
48
+ if (!w)
49
+ return;
50
+ const el = document.createElement('span');
51
+ el.textContent = w;
52
+ const age = (words.length - 1 - i) / Math.max(1, words.length - 1);
53
+ if (effect === 'radar') {
54
+ el.dataset.fxContact = '';
55
+ // Newest contacts glow brightest and fade as the sweep moves on.
56
+ el.style.textShadow = `0 0 ${Math.round(8 - age * 6)}px ${GLOW}`;
57
+ }
58
+ else {
59
+ el.dataset.fxSketch = '';
60
+ // Outline only: the fill is transparent, the stroke is the text colour.
61
+ el.style.setProperty('-webkit-text-fill-color', 'transparent');
62
+ el.style.setProperty('-webkit-text-stroke', '0.6px currentColor');
63
+ el.style.opacity = String(0.9 - age * 0.25);
64
+ }
65
+ span.appendChild(el);
66
+ });
67
+ return span;
68
+ }
69
+ function buildSignal(pending, lineStartAt) {
70
+ const span = tailSpan('signal');
71
+ const glyphs = signalGlyphs(pending);
72
+ // Blur falls away toward the reveal point, where the signal has locked.
73
+ const third = Math.ceil(glyphs.length / 3);
74
+ [0.3, 0.8, 1.4].forEach((blur, k) => {
75
+ const part = glyphs.slice(k * third, (k + 1) * third).join('');
76
+ if (!part)
77
+ return;
78
+ const seg = document.createElement('span');
79
+ seg.textContent = part;
80
+ seg.style.filter = `blur(${blur}px)`;
81
+ seg.style.opacity = String(0.85 - k * 0.15);
82
+ span.appendChild(seg);
83
+ });
84
+ const t = Date.now() - lineStartAt;
85
+ const step = Math.floor(t / (ROLL_MS / ROLL_PX.length));
86
+ span.style.position = 'relative';
87
+ span.style.top = `${step < ROLL_PX.length ? ROLL_PX[step] : 0}px`;
88
+ return span;
89
+ }
90
+ function buildTail(effect, pending, cursor) {
91
+ const span = tailSpan(effect);
92
+ if (effect === 'typewriter') {
93
+ const caret = document.createElement('span');
94
+ caret.dataset.fxCaret = '';
95
+ caret.style.cssText = 'display:inline-block;width:.55em;height:1.05em;margin-left:1px;vertical-align:-2px;background:currentColor;opacity:.7';
96
+ span.appendChild(caret);
97
+ return span;
98
+ }
99
+ if (effect === 'teleprinter') {
100
+ // One persistent cursor node, moved into each rebuilt tail, so its single
101
+ // blink animation carries on (see LiveAnswer).
102
+ if (cursor)
103
+ span.appendChild(cursor);
104
+ return span;
105
+ }
106
+ const glyphs = tailGlyphs(effect, pending);
107
+ if (effect === 'splitflap') {
108
+ for (const g of glyphs) {
109
+ const tile = document.createElement('span');
110
+ tile.className = 'fx-tile';
111
+ tile.style.cssText = TILE;
112
+ tile.textContent = g === ' ' ? '' : g;
113
+ span.appendChild(tile);
114
+ }
115
+ return span;
116
+ }
117
+ span.textContent = glyphs.join('');
118
+ if (effect === 'matrix')
119
+ span.style.cssText = 'color:#b6ffb6;text-shadow:0 0 6px #33ff33;user-select:none;pointer-events:none';
120
+ else
121
+ span.style.cssText = 'opacity:.55;user-select:none;pointer-events:none';
122
+ return span;
123
+ }
124
+ function makeCursor() {
125
+ const cursor = document.createElement('span');
126
+ cursor.dataset.fxCursor = '';
127
+ cursor.style.cssText = 'display:inline-block;width:.6em;height:1em;vertical-align:-2px;background:currentColor';
128
+ return cursor;
129
+ }
130
+ /* The blocks Markdown rendered, in document order. Markdown wraps each prose
131
+ * run in a plain <div>, so the wrapper is never a block here; a nested list's
132
+ * items come after their parent item, so the deepest newest item is last. */
133
+ const BLOCKS = 'p, li, h1, h2, h3, h4, h5, h6, blockquote, pre, table';
134
+ function renderedBlocks(root) {
135
+ const md = root.querySelector('.agent-md');
136
+ return md ? Array.from(md.querySelectorAll(BLOCKS)) : [];
137
+ }
138
+ export function LiveAnswer({ text, effect, complete = true, startAt = 0, onProgress, onDone }) {
139
+ const active = effect !== 'none' && !prefersReducedMotion();
140
+ const shown = useReveal(text, active, paceFor(effect), Math.min(startAt, text.length));
141
+ /* Committed text never goes back within one answer: once Markdown has
142
+ * rendered something, a later delta must not turn it back into decoration
143
+ * (or hide it). A shorter text is a new answer and starts over. */
144
+ const maxCommit = useRef({ len: text.length, at: 0 });
145
+ if (text.length < maxCommit.current.len)
146
+ maxCommit.current = { len: text.length, at: 0 };
147
+ maxCommit.current.len = text.length;
148
+ const committed = active
149
+ ? Math.min(text.length, Math.max(committedAt(effect, text, shown, complete), maxCommit.current.at))
150
+ : text.length;
151
+ maxCommit.current.at = committed;
152
+ const ref = useRef(null);
153
+ const beamRef = useRef(null);
154
+ const band = active && isBandEffect(effect) ? text.slice(committed, Math.max(committed, bandEnd(text, shown))) : '';
155
+ const pending = !active || effect === 'netsplit' ? ''
156
+ : isBandEffect(effect) ? band
157
+ : text.slice(shown, shown + (effect === 'signal' ? SIGNAL_TAIL : TAIL_MAX));
158
+ const cb = useRef({ onProgress, onDone });
159
+ cb.current = { onProgress, onDone };
160
+ const doneRef = useRef(false);
161
+ useEffect(() => {
162
+ cb.current.onProgress?.(shown);
163
+ if (!doneRef.current && text.length > 0 && shown >= text.length) {
164
+ doneRef.current = true;
165
+ cb.current.onDone?.();
166
+ }
167
+ }, [shown, text.length]);
168
+ /* Line breaks crossed so far: the teleprinter feeds the paper at each one,
169
+ * and a signal line starts rolling in. Tracked during render (not in an
170
+ * effect) so the feed lands on the same frame as the line. */
171
+ const lines = active ? lineCount(text, shown) : 0;
172
+ // `at`: when the current line started arriving (the answer's first line
173
+ // starts at mount). `feeds`: how many line ends the paper has fed for.
174
+ const [lineWatch, setLineWatch] = useState(() => ({ lines, at: Date.now(), feeds: 0 }));
175
+ if (lineWatch.lines !== lines) {
176
+ const next = lines > lineWatch.lines;
177
+ setLineWatch({ lines, at: next ? Date.now() : lineWatch.at, feeds: next ? lineWatch.feeds + 1 : lineWatch.feeds });
178
+ }
179
+ const [feeding, setFeeding] = useState(false);
180
+ useEffect(() => {
181
+ if (effect !== 'teleprinter' || !active || lineWatch.feeds === 0)
182
+ return;
183
+ setFeeding(true);
184
+ const id = setTimeout(() => setFeeding(false), FEED_MS);
185
+ return () => clearTimeout(id);
186
+ }, [effect, active, lineWatch.feeds]);
187
+ /* Netsplit: each newly posted line slides in. Only NEW blocks (the block
188
+ * count grew) -- never one that already had text, and never the wrapper
189
+ * around the whole answer. -1: not counted yet (a hand-off resumes with
190
+ * blocks already on screen; those do not slide in). Web Animations leave
191
+ * the DOM and its text untouched, and do nothing where unsupported. */
192
+ const blockCount = useRef(-1);
193
+ useLayoutEffect(() => {
194
+ const root = ref.current;
195
+ if (effect !== 'netsplit' || !active || !root) {
196
+ blockCount.current = -1;
197
+ return;
198
+ }
199
+ const blocks = renderedBlocks(root);
200
+ const before = blockCount.current;
201
+ blockCount.current = blocks.length;
202
+ if (before < 0)
203
+ return;
204
+ for (const block of blocks.slice(before)) {
205
+ if (typeof block.animate === 'function') {
206
+ block.animate([{ opacity: 0, transform: 'translateY(4px)' }, { opacity: 1, transform: 'none' }], { duration: 200, easing: 'ease-out' });
207
+ }
208
+ }
209
+ }, [effect, active, committed]);
210
+ /* The teleprinter cursor: ONE node and ONE blink animation for as long as
211
+ * the cursor shows, moved into each rebuilt tail; cancelled when the
212
+ * cursor goes (caught up, effect change, unmount). */
213
+ const cursorRef = useRef(null);
214
+ const cursorOn = active && effect === 'teleprinter' && shown < text.length;
215
+ useEffect(() => {
216
+ if (!cursorOn)
217
+ return;
218
+ return () => {
219
+ cursorRef.current?.anim?.cancel();
220
+ cursorRef.current = null;
221
+ };
222
+ }, [cursorOn]);
223
+ const lineStartAt = lineWatch.at;
224
+ useLayoutEffect(() => {
225
+ const root = ref.current;
226
+ if (!root)
227
+ return;
228
+ const beam = beamRef.current;
229
+ const clear = () => root.querySelectorAll('.fx-tail').forEach((n) => n.remove());
230
+ const draw = () => {
231
+ clear();
232
+ const host = pending ? tailHost(root, { outsideInline: isBandEffect(effect) }) : null;
233
+ if (!host) {
234
+ if (beam)
235
+ beam.style.display = 'none';
236
+ return;
237
+ }
238
+ let cursor;
239
+ if (effect === 'teleprinter') {
240
+ if (!cursorRef.current)
241
+ cursorRef.current = { el: makeCursor(), anim: null };
242
+ cursor = cursorRef.current.el;
243
+ }
244
+ const tail = effect === 'signal' ? buildSignal(pending, lineStartAt)
245
+ : isBandEffect(effect) ? buildBand(effect, pending)
246
+ : buildTail(effect, pending, cursor);
247
+ host.appendChild(tail);
248
+ if (beam)
249
+ placeBeam(beam, root, tail);
250
+ if (cursor && cursorRef.current && !cursorRef.current.anim)
251
+ cursorRef.current.anim = blink(cursor);
252
+ };
253
+ draw();
254
+ if (!pending || !REROLL.has(effect))
255
+ return clear;
256
+ // Re-roll the glyphs between reveal ticks so the tail keeps moving.
257
+ const id = setInterval(draw, 60);
258
+ return () => { clearInterval(id); clear(); };
259
+ }, [effect, pending, shown, lineStartAt]);
260
+ const radar = active && effect === 'radar' && pending !== '';
261
+ const style = radar
262
+ ? { position: 'relative' }
263
+ : effect === 'teleprinter' && active
264
+ ? { transform: feeding ? 'translateY(-3px)' : '', transition: `transform ${FEED_MS - 20}ms steps(2, end)` }
265
+ : undefined;
266
+ return (_jsxs("div", { ref: ref, "data-fx": effect, style: style, children: [_jsx(Markdown, { text: active ? text.slice(0, committed) : text }), radar && _jsx("div", { ref: beamRef, "data-fx-beam": "", "aria-hidden": "true", style: S.beam })] }));
267
+ }
268
+ /** The teleprinter cursor blinks: on half a second, off half a second, no
269
+ * fade. Started once per cursor (LiveAnswer keeps the node and the
270
+ * Animation), pinned to the document timeline (startTime 0). Web Animations: nothing to inject, and a no-op
271
+ * where unsupported. Effects are already off under reduced motion. */
272
+ function blink(cursor) {
273
+ if (typeof cursor.animate !== 'function')
274
+ return null;
275
+ const a = cursor.animate([{ opacity: 1 }, { opacity: 1, offset: 0.5 }, { opacity: 0, offset: 0.5 }, { opacity: 0 }], { duration: 1000, iterations: Infinity });
276
+ a.startTime = 0;
277
+ return a;
278
+ }
279
+ /** The radar beam rides the newest contact: its leading edge at the end of
280
+ * the tail, on the tail's line. */
281
+ function placeBeam(beam, root, tail) {
282
+ const rects = tail.getClientRects();
283
+ const r = rects.length ? rects[rects.length - 1] : tail.getBoundingClientRect();
284
+ const base = root.getBoundingClientRect();
285
+ beam.style.display = 'block';
286
+ beam.style.left = `${r.right - base.left - BEAM_W}px`;
287
+ beam.style.top = `${r.top - base.top}px`;
288
+ beam.style.height = `${Math.max(r.height, 16)}px`;
289
+ }
290
+ const BEAM_W = 70;
291
+ const S = {
292
+ beam: {
293
+ position: 'absolute', left: 0, top: 0, width: BEAM_W, height: 16, pointerEvents: 'none', userSelect: 'none',
294
+ background: `linear-gradient(90deg, transparent, color-mix(in srgb, ${GLOW} 10%, transparent) 70%, color-mix(in srgb, ${GLOW} 45%, transparent) 97%, ${GLOW})`,
295
+ transition: 'left 90ms linear, top 90ms linear',
296
+ },
297
+ };
298
+ //# sourceMappingURL=LiveAnswer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiveAnswer.js","sourceRoot":"","sources":["../../fx/LiveAnswer.tsx"],"names":[],"mappings":";AAAA;;;;;;;0EAO0E;AAC1E,OAAc,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAsB,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7H,MAAM,IAAI,GACR,wHAAwH;IACxH,4GAA4G;IAC5G,0DAA0D,CAAC;AAE7D;;kCAEkC;AAClC,MAAM,IAAI,GAAG,wBAAwB,CAAC;AACtC,8EAA8E;AAC9E,MAAM,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CA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AG,IAAI,CAAC,cAAc,EAAE,CAAC;IACpC,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;IAChF,MAAM,IAAI,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;IAC1C,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IAC7B,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,GAAG,MAAM,IAAI,CAAC;IACtD,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IACzC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC;AACpD,CAAC;AAED,MAAM,MAAM,GAAG,EAAE,CAAC;AAClB,MAAM,CAAC,GAAwC;IAC7C,IAAI,EAAE;QACJ,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;QAC3G,UAAU,EAAE,0DAA0D,IAAI,8CAA8C,IAAI,2BAA2B,IAAI,GAAG;QAC9J,UAAU,EAAE,mCAAmC;KAChD;CACF,CAAC"}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export declare function MatrixRain({ active }: {
3
+ active: boolean;
4
+ }): React.JSX.Element | null;
5
+ //# sourceMappingURL=MatrixRain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MatrixRain.d.ts","sourceRoot":"","sources":["../../fx/MatrixRain.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAMjD,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,4BAsDzD"}
@@ -0,0 +1,73 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /* The faint falling-glyph rain behind the in-progress turn under the Matrix
3
+ * rain effect. Decorative: aria-hidden, never takes clicks, and stops the
4
+ * moment it is inactive or unmounted. Needs a positioned parent. */
5
+ import { useEffect, useRef } from 'react';
6
+ const GLYPHS = 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワ0123456789';
7
+ const COL = 14;
8
+ const FRAME_MS = 55;
9
+ export function MatrixRain({ active }) {
10
+ const ref = useRef(null);
11
+ useEffect(() => {
12
+ const cv = ref.current;
13
+ if (!active || !cv)
14
+ return;
15
+ const ctx = cv.getContext('2d');
16
+ if (!ctx)
17
+ return;
18
+ // Drawn in CSS pixels on a device-pixel canvas (sharp on HiDPI). Resized
19
+ // only when the size really changes: assigning width wipes the canvas, and
20
+ // the live box grows a little with every streamed line.
21
+ let W = 0;
22
+ let H = 0;
23
+ const size = () => {
24
+ const p = cv.parentElement;
25
+ const w = p?.clientWidth ?? 0, h = p?.clientHeight ?? 0, dpr = window.devicePixelRatio || 1;
26
+ if (w === W && h === H && cv.width === Math.round(w * dpr))
27
+ return;
28
+ W = w;
29
+ H = h;
30
+ cv.width = Math.round(w * dpr);
31
+ cv.height = Math.round(h * dpr);
32
+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
33
+ };
34
+ size();
35
+ const ro = typeof ResizeObserver !== 'undefined' ? new ResizeObserver(size) : null;
36
+ if (ro && cv.parentElement)
37
+ ro.observe(cv.parentElement);
38
+ let drops = Array.from({ length: Math.max(1, Math.ceil(W / COL)) }, () => Math.random() * -30);
39
+ let last = 0;
40
+ let raf = 0;
41
+ const frame = (now) => {
42
+ if (now - last >= FRAME_MS) {
43
+ last = now;
44
+ const cols = Math.max(1, Math.ceil(W / COL));
45
+ if (drops.length !== cols)
46
+ drops = Array.from({ length: cols }, (_, i) => drops[i] ?? Math.random() * -30);
47
+ // Fade old glyphs to transparent, not to black: painting black would
48
+ // build a dark veil behind the text on light skins.
49
+ ctx.globalCompositeOperation = 'destination-out';
50
+ ctx.fillStyle = 'rgba(0,0,0,0.12)';
51
+ ctx.fillRect(0, 0, W, H);
52
+ ctx.globalCompositeOperation = 'source-over';
53
+ ctx.fillStyle = '#33ff33';
54
+ ctx.font = '13px monospace';
55
+ drops = drops.map((y, i) => {
56
+ ctx.fillText(GLYPHS[Math.floor(Math.random() * GLYPHS.length)], i * COL, y * 16);
57
+ return y * 16 > H && Math.random() > 0.96 ? 0 : y + 1;
58
+ });
59
+ }
60
+ raf = window.requestAnimationFrame(frame);
61
+ };
62
+ raf = window.requestAnimationFrame(frame);
63
+ return () => { window.cancelAnimationFrame(raf); ro?.disconnect(); };
64
+ }, [active]);
65
+ if (!active)
66
+ return null;
67
+ return _jsx("canvas", { ref: ref, "aria-hidden": "true", style: S.canvas });
68
+ }
69
+ const S = {
70
+ // Behind the answer: the live box sets isolation so -1 stays inside it.
71
+ canvas: { position: 'absolute', inset: 0, width: '100%', height: '100%', pointerEvents: 'none', opacity: 0.25, zIndex: -1 },
72
+ };
73
+ //# sourceMappingURL=MatrixRain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MatrixRain.js","sourceRoot":"","sources":["../../fx/MatrixRain.tsx"],"names":[],"mappings":";AAAA;;oEAEoE;AACpE,OAAc,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEjD,MAAM,MAAM,GAAG,wDAAwD,CAAC;AACxE,MAAM,GAAG,GAAG,EAAE,CAAC;AACf,MAAM,QAAQ,GAAG,EAAE,CAAC;AAEpB,MAAM,UAAU,UAAU,CAAC,EAAE,MAAM,EAAuB;IACxD,MAAM,GAAG,GAAG,MAAM,CAAo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CAAC,CAAC,EAAE;CAC5H,CAAC"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare function NetsplitJoin(): React.JSX.Element;
3
+ //# sourceMappingURL=NetsplitJoin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NetsplitJoin.d.ts","sourceRoot":"","sources":["../../fx/NetsplitJoin.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,wBAAgB,YAAY,sBAM3B"}
@@ -0,0 +1,13 @@
1
+ import { jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { IRC_AGENT_NICK } from '../transcriptSkinCss';
3
+ export function NetsplitJoin() {
4
+ return (_jsxs("div", { "data-fx-join": "", "aria-hidden": "true", style: S.join, children: ["* ", IRC_AGENT_NICK, " has joined"] }));
5
+ }
6
+ const S = {
7
+ // The skin's success tint where it has one, else the text colour, dimmed.
8
+ join: {
9
+ userSelect: 'none', pointerEvents: 'none', color: 'var(--success, currentColor)', opacity: 0.8,
10
+ fontFamily: 'var(--font-mono, ui-monospace, monospace)', fontSize: '0.92em', marginBottom: 2,
11
+ },
12
+ };
13
+ //# sourceMappingURL=NetsplitJoin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NetsplitJoin.js","sourceRoot":"","sources":["../../fx/NetsplitJoin.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,UAAU,YAAY;IAC1B,OAAO,CACL,+BAAkB,EAAE,iBAAa,MAAM,EAAC,KAAK,EAAE,CAAC,CAAC,IAAI,mBAChD,cAAc,mBACb,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,GAAwC;IAC7C,0EAA0E;IAC1E,IAAI,EAAE;QACJ,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B,EAAE,OAAO,EAAE,GAAG;QAC9F,UAAU,EAAE,2CAA2C,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;KAC7F;CACF,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { ArrivalEffect } from '../arrivalEffect';
2
+ /** Reveal step per tick: typewriter keys at ~30 characters a second, the rest ~60. */
3
+ export declare function paceFor(effect: ArrivalEffect): number;
4
+ /** The end of the word containing (or starting at) `i`: the next whitespace. */
5
+ export declare function bandEnd(text: string, i: number): number;
6
+ /** How much of `text` Markdown renders once `shown` characters are revealed.
7
+ * `complete`: the text is final (the stream ended). Only then does catching
8
+ * up commit everything; while it streams, being caught up is just a pause,
9
+ * and the effect's own rule still applies (netsplit holds back a partial
10
+ * line, a band keeps its last words as decoration). */
11
+ export declare function committedAt(effect: ArrivalEffect, text: string, shown: number, complete?: boolean): number;
12
+ /** True for the effects whose decoration is the trailing band of words. */
13
+ export declare function isBandEffect(effect: ArrivalEffect): boolean;
14
+ /** A band's words as decoration: Markdown markers dropped (the decoration must
15
+ * never show raw syntax), whitespace collapsed. */
16
+ export declare function bandText(raw: string): string;
17
+ /** Line breaks in the first `n` characters (teleprinter feeds, signal rolls). */
18
+ export declare function lineCount(text: string, n: number): number;
19
+ export declare const NOISE = "#%&@$*+=?/\\|<>~^!";
20
+ /** At ~60 characters a second a character spends ~0.7 s crossing a tail this
21
+ * long, which is how long the signal takes to lock. */
22
+ export declare const SIGNAL_TAIL = 42;
23
+ /** The signal tail: the rest of the current line (capped), each character
24
+ * static or already locked. Characters nearest the reveal point are the most
25
+ * likely to have locked. Spaces stay spaces. */
26
+ export declare function signalGlyphs(pending: string, rand?: () => number): string[];
27
+ //# sourceMappingURL=arrivalModes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrivalModes.d.ts","sourceRoot":"","sources":["../../fx/arrivalModes.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AActD,sFAAsF;AACtF,wBAAgB,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAErD;AAID,gFAAgF;AAChF,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAIvD;AA6BD;;;;uDAIuD;AACvD,wBAAgB,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,UAAO,GAAG,MAAM,CAWvG;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAE3D;AAED;mDACmD;AACnD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK5C;AAED,iFAAiF;AACjF,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAKzD;AAED,eAAO,MAAM,KAAK,uBAAuB,CAAC;AAC1C;uDACuD;AACvD,eAAO,MAAM,WAAW,KAAK,CAAC;AAE9B;;gDAEgD;AAChD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,MAAoB,GAAG,MAAM,EAAE,CAQxF"}
@@ -0,0 +1,107 @@
1
+ const MODE = {
2
+ none: 'char', matrix: 'char', splitflap: 'char', typewriter: 'char', decode: 'char', teleprinter: 'char', signal: 'char',
3
+ radar: 'band', pencil: 'band', netsplit: 'line',
4
+ };
5
+ /** How far a band trails the reveal, in characters: at ~60 characters a second
6
+ * a radar contact glows about half a second, and a pencil sketch inks a beat
7
+ * (~0.55 s) after it is drawn. */
8
+ const BAND_LAG = { radar: 30, pencil: 33 };
9
+ /** Reveal step per tick: typewriter keys at ~30 characters a second, the rest ~60. */
10
+ export function paceFor(effect) {
11
+ return effect === 'typewriter' ? 1 : 2;
12
+ }
13
+ const isSpace = (ch) => ch !== undefined && /\s/.test(ch);
14
+ /** The end of the word containing (or starting at) `i`: the next whitespace. */
15
+ export function bandEnd(text, i) {
16
+ let j = Math.min(i, text.length);
17
+ while (j < text.length && !isSpace(text[j]))
18
+ j++;
19
+ return j;
20
+ }
21
+ // A block marker opening a line ("- ", "12. ", "## ", "> ", "| "), possibly
22
+ // nested ("> - "). Committed with the line's first word so Markdown already
23
+ // renders the block, and the marker never shows as raw text.
24
+ const BLOCK_MARKER = /^(?:(?:[-*+]|\d+[.)]|#{1,6}|>|\|)[ \t]+)+/;
25
+ function bandCommit(text, shown, lag) {
26
+ let c = Math.max(0, shown - lag);
27
+ // Back to a word start: a band holds whole words.
28
+ while (c > 0 && !isSpace(text[c - 1]))
29
+ c--;
30
+ // Never leave a line start inside the band. The decoration sits in the
31
+ // newest rendered block, so the newest line must already be one: commit
32
+ // through its block marker, if any, and its first word. The answer's own
33
+ // first line needs this only when it opens with a marker.
34
+ // The line's prefix is its indent, any (stacked) markers and their
35
+ // whitespace; `word` is where its first real word starts. A band starting
36
+ // anywhere in that prefix -- not only at the line start -- would show a raw
37
+ // marker (" - nested", "> - item").
38
+ const lineStart = text.lastIndexOf('\n', shown - 1) + 1;
39
+ let word = lineStart;
40
+ while (word < text.length && isSpace(text[word]))
41
+ word++;
42
+ const marker = BLOCK_MARKER.exec(text.slice(word));
43
+ if (marker)
44
+ word += marker[0].length;
45
+ while (word < text.length && isSpace(text[word]))
46
+ word++;
47
+ if (c <= word && (lineStart > 0 || marker))
48
+ c = Math.max(c, bandEnd(text, word));
49
+ return c;
50
+ }
51
+ /** How much of `text` Markdown renders once `shown` characters are revealed.
52
+ * `complete`: the text is final (the stream ended). Only then does catching
53
+ * up commit everything; while it streams, being caught up is just a pause,
54
+ * and the effect's own rule still applies (netsplit holds back a partial
55
+ * line, a band keeps its last words as decoration). */
56
+ export function committedAt(effect, text, shown, complete = true) {
57
+ if (complete && shown >= text.length)
58
+ return text.length;
59
+ const at = Math.min(shown, text.length);
60
+ switch (MODE[effect]) {
61
+ case 'band': return bandCommit(text, at, BAND_LAG[effect] ?? 30);
62
+ case 'line': {
63
+ const nl = text.lastIndexOf('\n', at - 1);
64
+ return nl < 0 ? 0 : nl + 1;
65
+ }
66
+ default: return at;
67
+ }
68
+ }
69
+ /** True for the effects whose decoration is the trailing band of words. */
70
+ export function isBandEffect(effect) {
71
+ return MODE[effect] === 'band';
72
+ }
73
+ /** A band's words as decoration: Markdown markers dropped (the decoration must
74
+ * never show raw syntax), whitespace collapsed. */
75
+ export function bandText(raw) {
76
+ return raw
77
+ .replace(/\]\([^)]*\)/g, '')
78
+ .replace(/[*_`~#>|\\[\]]/g, '')
79
+ .replace(/\s+/g, ' ');
80
+ }
81
+ /** Line breaks in the first `n` characters (teleprinter feeds, signal rolls). */
82
+ export function lineCount(text, n) {
83
+ let count = 0;
84
+ const end = Math.min(n, text.length);
85
+ for (let i = 0; i < end; i++)
86
+ if (text.charCodeAt(i) === 10)
87
+ count++;
88
+ return count;
89
+ }
90
+ export const NOISE = '#%&@$*+=?/\\|<>~^!';
91
+ /** At ~60 characters a second a character spends ~0.7 s crossing a tail this
92
+ * long, which is how long the signal takes to lock. */
93
+ export const SIGNAL_TAIL = 42;
94
+ /** The signal tail: the rest of the current line (capped), each character
95
+ * static or already locked. Characters nearest the reveal point are the most
96
+ * likely to have locked. Spaces stay spaces. */
97
+ export function signalGlyphs(pending, rand = Math.random) {
98
+ const nl = pending.indexOf('\n');
99
+ const line = [...pending.slice(0, nl < 0 ? SIGNAL_TAIL : Math.min(nl, SIGNAL_TAIL))];
100
+ return line.map((ch, i) => {
101
+ if (isSpace(ch))
102
+ return ' ';
103
+ const lock = 1 - i / SIGNAL_TAIL;
104
+ return rand() < lock * lock ? ch : NOISE[Math.floor(rand() * NOISE.length)];
105
+ });
106
+ }
107
+ //# sourceMappingURL=arrivalModes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrivalModes.js","sourceRoot":"","sources":["../../fx/arrivalModes.ts"],"names":[],"mappings":"AAmBA,MAAM,IAAI,GAAgC;IACxC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,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,WAAW,GAAG,EAAE,CAAC;AAE9B;;gDAEgD;AAChD,MAAM,UAAU,YAAY,CAAC,OAAe,EAAE,OAAqB,IAAI,CAAC,MAAM;IAC5E,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,IAAI,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACrF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE;QACxB,IAAI,OAAO,CAAC,EAAE,CAAC;YAAE,OAAO,GAAG,CAAC;QAC5B,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC;QACjC,OAAO,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { ArrivalEffect } from '../arrivalEffect';
2
+ export declare const TAIL_MAX = 14;
3
+ /** A random glyph standing in for `ch` under `effect`; whitespace stays a space,
4
+ * and an effect without glyphs returns `ch` itself. */
5
+ export declare function glyphFor(effect: ArrivalEffect, ch: string, rand?: () => number): string;
6
+ /** One glyph per pending character (spaces kept), capped at TAIL_MAX. Effects
7
+ * without a glyph tail return none. */
8
+ export declare function tailGlyphs(effect: ArrivalEffect, pending: string, rand?: () => number): string[];
9
+ /** The element to append the tail to: the deepest last element of the newest
10
+ * block. Null when the newest block is one the tail must not enter (a code
11
+ * block still streaming), so no tail is drawn at all rather than one in the
12
+ * wrong place. */
13
+ export declare function tailHost(root: Element, opts?: {
14
+ outsideInline?: boolean;
15
+ }): Element | null;
16
+ //# sourceMappingURL=tail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tail.d.ts","sourceRoot":"","sources":["../../fx/tail.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,eAAO,MAAM,QAAQ,KAAK,CAAC;AAQ3B;uDACuD;AACvD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,MAAoB,GAAG,MAAM,CAIpG;AAED;uCACuC;AACvC,wBAAgB,UAAU,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,MAAoB,GAAG,MAAM,EAAE,CAG7G;AAQD;;;kBAGkB;AAClB,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,GAAE;IAAE,aAAa,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,GAAG,IAAI,CAkB9F"}