domotion-svg 0.13.2 → 0.13.3
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/dist/animation/animator.js +12 -2
- package/package.json +1 -1
|
@@ -444,6 +444,14 @@ function renderTypingOverlay(overlay, frameIdx, frameStart, frameEnd, totalDurat
|
|
|
444
444
|
const speed = overlay.speed ?? 60;
|
|
445
445
|
const fontSize = overlay.fontSize ?? 14;
|
|
446
446
|
const charWidth = fontSize * 0.6; // monospace cell (overlay font is monospace)
|
|
447
|
+
// DM-1205: the typewriter reveal hides not-yet-typed text with a width-0 clip
|
|
448
|
+
// rect. Chrome renders a zero-area clip path as "clip everything" (text
|
|
449
|
+
// hidden, correct), but WebKit/Safari treats an EMPTY clip as "no clip" and
|
|
450
|
+
// paints the element in full — so on multi-line overlays every line past the
|
|
451
|
+
// first showed its whole text immediately (the shared text opacity is already
|
|
452
|
+
// 1 while the line waits its turn). Hiding with a tiny non-zero width keeps
|
|
453
|
+
// the clip non-empty so WebKit clips it too; 0.01px reveals no visible pixel.
|
|
454
|
+
const hiddenW = "0.01px";
|
|
447
455
|
const lineHeight = Math.round(fontSize * 1.35);
|
|
448
456
|
const color = overlay.color ?? "#e6edf3";
|
|
449
457
|
const typeStartMs = frameStart + delay;
|
|
@@ -512,7 +520,7 @@ function renderTypingOverlay(overlay, frameIdx, frameStart, frameEnd, totalDurat
|
|
|
512
520
|
const lineEndPct = pct(lineEndMs, totalDuration);
|
|
513
521
|
lineTimings.push({ li, startMs: lineStartMs, endMs: lineEndMs, len: line.length });
|
|
514
522
|
cumChars += line.length;
|
|
515
|
-
parts.push(` <defs><clipPath id="${clipId}"><rect class="${id}-rev${li}" x="${overlay.x}" y="${lineY - fontSize}" width="
|
|
523
|
+
parts.push(` <defs><clipPath id="${clipId}"><rect class="${id}-rev${li}" x="${overlay.x}" y="${lineY - fontSize}" width="${hiddenW}" height="${textHeight}" /></clipPath></defs>`);
|
|
516
524
|
parts.push(` <text class="${id}-text" x="${overlay.x}" y="${lineY}" fill="${color}" font-size="${fontSize}" font-family="'SF Mono', Menlo, Monaco, monospace" clip-path="url(#${clipId})">${escapeHtml(line)}</text>`);
|
|
517
525
|
// DM-1204: the reveal clip MUST sweep linearly so its right edge tracks the
|
|
518
526
|
// caret (whose position track is `linear`). Without an explicit timing
|
|
@@ -520,8 +528,10 @@ function renderTypingOverlay(overlay, frameIdx, frameStart, frameEnd, totalDurat
|
|
|
520
528
|
// through the sweep at the time-midpoint while the linear caret is only at
|
|
521
529
|
// 50% — that desync read as the caret lagging ~10–20 chars behind the
|
|
522
530
|
// revealed text mid-type, even though the endpoints (parked state) matched.
|
|
531
|
+
// DM-1205: the hidden state uses `hiddenW` (a tiny non-zero width), not 0,
|
|
532
|
+
// so WebKit's empty-clip-path fallback doesn't paint the whole line.
|
|
523
533
|
cssRules.push(`
|
|
524
|
-
@keyframes ${id}-rev${li} { 0%, ${lineStartPct} { width:
|
|
534
|
+
@keyframes ${id}-rev${li} { 0%, ${lineStartPct} { width: ${hiddenW}; } ${lineEndPct} { width: ${lineWidth}px; } ${holdEndPct} { width: ${lineWidth}px; } ${disappearPct}, 100% { width: ${hiddenW}; } }
|
|
525
535
|
.${id}-rev${li} { animation: ${id}-rev${li} ${totalSec.toFixed(2)}s linear infinite; }`);
|
|
526
536
|
});
|
|
527
537
|
// Whole-overlay visibility — shared by every line's <text>.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "domotion-svg",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.3",
|
|
4
4
|
"description": "DOM-to-animated-SVG renderer. Captures HTML/CSS via Playwright Chromium and converts it to self-contained SVG with CSS animations — pixel-faithful demos that scale crisply and load lazily.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Brian Westphal",
|