silvery 0.19.0 → 0.19.2

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/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { i as FocusManagerContext, l as TermContext, n as CapabilityRegistryContext, o as RuntimeContext, r as ChainAppContext, s as StderrContext, t as CacheBackendContext } from "./context-BU5LkkIy.mjs";
2
- import { $ as activeEditTargetRef, $i as enableMouse, $n as ToastItem, $r as createCursorStore, $t as OSC133, Aa as SearchProvider, Ai as useFocusWithin, An as SilveryErrorBoundary, Ar as toneFgToken, At as createWheelEvent, Bi as useAgNode, Bn as Skeleton, Br as CursorLine, Bt as queryMode, Ca as swapPanes, Ci as supportsScrollRegions, Cn as createFocusManager, Cr as Table, Ct as isTTY, Da as ActiveSchemeContext, Di as useInputLayer, Dn as findSpatialTarget, Dr as SearchBar, Dt as createDoubleClickState, Ea as Text, Ei as InputLayerProvider, En as findFocusableAncestor, Er as Spinner, Et as computeEnterLeave, Fa as calcEdgeBasedScrollOffset, Fi as useExit, Fn as GridCell, Fr as PickerDialog, Ft as isTerm, Gi as Link, Gn as Tabs, Gr as countVisualLines, Gt as queryTerminalVersion, Hi as Console, Hn as Tab, Hr as TextArea, Ht as queryDeviceAttributes, Ia as Box, Ii as useApp, In as useGridPosition, Ir as PickerList, It as queryCellSize, J as useTea, Ji as BEL, Jn as CommandPalette, Jr as cursorToRowCol, Jt as queryCursorPosition, Ki as useMouseCursor, Kn as Breadcrumb, Kr as cursorMoveDown, Kt as queryTertiaryDA, Li as useRuntime, Ln as PositionRegistryProvider, Lr as Backdrop, Lt as queryTextAreaPixels, Ma as useSearchOptional, Mi as useFocus, Mn as Spacer, Mr as toneIcon, Mt as hitTest, Na as useInput, Ni as useStderr, Nn as Newline, Nr as toneSubtleTokens, Nt as processMouseEvent, Oa as useTheme, Oi as useInputLayerContext, On as getExplicitFocusLink, Or as Button, Ot as createMouseEvent, Pa as useVirtualizer, Pi as useStdout, Pn as Transform, Pr as Toggle, Pt as createInputEvents, Q as activeEditContextRef, Qi as enableKittyKeyboard, Qn as ToastContainer, Qr as CursorProvider, Qt as detectKittySupport, Ri as useBoxMetrics, Rn as createPositionRegistry, Rr as ModalDialog, Rt as queryTextAreaSize, Sa as splitPane, Si as setScrollRegion, Sn as dispatchKeyEvent, Sr as Badge, St as isInspectorEnabled, Ta as HorizontalVirtualList, Ti as InputLayerContext, Tn as findEnclosingScope, Tr as ProgressBar, Tt as checkDoubleClick, Ui as useConsole, Un as TabList, Ur as clampScroll, Ut as queryPrimaryDA, Vi as Screen, Vn as Tooltip, Vr as EditContextDisplay, Vt as queryModes, Wi as ErrorBoundary, Wn as TabPanel, Wr as useTextArea, Wt as querySecondaryDA, X as collect, Xi as disableKittyKeyboard, Xn as Banner, Xr as rowColToCursor, Xt as runTermtest, Y as fx, Yi as KittyFlags, Yn as Alert, Yr as getWrappedLines, Yt as TERMTEST_SECTIONS, Z as InputBoundary, Zi as disableMouse, Zn as InlineAlert, Zr as TextInput, Zt as detectKittyFromStdio, _a as findAdjacentPane, _i as usePaste, _n as shallow, _r as P, _t as autoEnableInspector, a as ReactiveThemeProvider, aa as resetCursorStyle, ai as useColorScheme, an as injectDOMStyles, ar as Code, at as renderScreenReaderOutput, ba as removePane, bi as scrollDown, bn as createKeyEvent, br as UL, bt as inspectFrame, ca as setCursorStyle, ci as useDragState, cn as HitRegistryContext, cr as H1, ct as renderStatic, da as setWindowTitle, di as useSelection, dn as useHitRegistry, dr as HR, dt as VirtualTerminal, ea as notify, ei as getCursorState, en as copyToClipboard, er as useToast, et as useEditContext, fa as getModifierState, fi as usePasteEvents, fn as HitRegistry, fr as Kbd, ft as withDiagnostics, ga as createLeaf, gi as PasteProvider, gn as useWindowSize, gr as OL, gt as withMeasurer, ha as Fill, hi as getInternalClipboard, hn as ThemeProvider, hr as Muted, ht as createPipeline, i as useActiveScheme, ia as reportDirectory, ii as useReadline, in as createDOMAdapter, ir as Blockquote, it as createTermEditContext, ja as useSearch, ji as useFocusable, jn as Static, jr as toneFillTokens, jt as dispatchMouseEvent, ka as ListView, ki as useFocusManager, kn as getTabOrder$1, kr as TONE_ICONS, kt as createMouseEventProcessor, la as setMouseCursorShape, li as useCopyModeState, ln as useHitRegion, lr as H2, lt as renderSync, ma as useModifierKeys, mi as createPasteEvent, mn as resetHitRegionIdCounter, mr as Lead, mt as withCommands, n as useId, na as notifyKitty, ni as subscribeCursor, nn as requestClipboard, nr as FormField, nt as invertTextOp, oa as resetMouseCursorShape, oi as useListItem, on as CanvasRenderBuffer, or as CodeBlock, ot as measureElement, pa as lastModifierState, pi as createCopyProvider, pn as Z_INDEX, pr as LI, pt as withKeybindings, qi as ANSI, qn as TreeView, qr as cursorMoveUp, qt as queryCursorFromStdio, r as useTransition$1, ra as queryKittyKeyboard, ri as useCursor, rn as DOMRenderBuffer, rr as Heading, rt as mergeTextOps, sa as resetWindowTitle, si as useInteractiveState, sn as createCanvasAdapter, sr as Em, st as render$1, t as useDeferredValue, ta as notifyITerm2, ti as resetCursorState, tn as parseClipboardResponse, tr as Form, tt as applyTextOp, ua as setWindowAndIconTitle, ui as useFindState, un as useHitRegionCallback, ur as H3, ut as withRender, va as getPaneIds, vi as moveCursor, vn as useTerm, vr as Small, vt as disableInspector, wa as SplitView, wi as useTerminalFocused, wn as findByTestID, wr as SelectList, wt as resolveNonTTYMode, xa as resizeSplit, xi as scrollUp, xn as dispatchFocusEvent, xr as Divider, xt as inspectTree, ya as getTabOrder, yi as resetScrollRegion, yn as createFocusEvent, yr as Strong, yt as enableInspector, zi as useSignal, zn as usePositionRegistry, zr as formatTitleWithHotkey, zt as DecMode } from "./src-C2uvC-r0.mjs";
2
+ import { $ as activeEditTargetRef, $i as enableMouse, $n as ToastItem, $r as createCursorStore, $t as OSC133, Aa as SearchProvider, Ai as useFocusWithin, An as SilveryErrorBoundary, Ar as toneFgToken, At as createWheelEvent, Bi as useAgNode, Bn as Skeleton, Br as CursorLine, Bt as queryMode, Ca as swapPanes, Ci as supportsScrollRegions, Cn as createFocusManager, Cr as Table, Ct as isTTY, Da as ActiveSchemeContext, Di as useInputLayer, Dn as findSpatialTarget, Dr as SearchBar, Dt as createDoubleClickState, Ea as Text, Ei as InputLayerProvider, En as findFocusableAncestor, Er as Spinner, Et as computeEnterLeave, Fa as calcEdgeBasedScrollOffset, Fi as useExit, Fn as GridCell, Fr as PickerDialog, Ft as isTerm, Gi as Link, Gn as Tabs, Gr as countVisualLines, Gt as queryTerminalVersion, Hi as Console, Hn as Tab, Hr as TextArea, Ht as queryDeviceAttributes, Ia as Box, Ii as useApp, In as useGridPosition, Ir as PickerList, It as queryCellSize, J as useTea, Ji as BEL, Jn as CommandPalette, Jr as cursorToRowCol, Jt as queryCursorPosition, Ki as useMouseCursor, Kn as Breadcrumb, Kr as cursorMoveDown, Kt as queryTertiaryDA, Li as useRuntime, Ln as PositionRegistryProvider, Lr as Backdrop, Lt as queryTextAreaPixels, Ma as useSearchOptional, Mi as useFocus, Mn as Spacer, Mr as toneIcon, Mt as hitTest, Na as useInput, Ni as useStderr, Nn as Newline, Nr as toneSubtleTokens, Nt as processMouseEvent, Oa as useTheme, Oi as useInputLayerContext, On as getExplicitFocusLink, Or as Button, Ot as createMouseEvent, Pa as useVirtualizer, Pi as useStdout, Pn as Transform, Pr as Toggle, Pt as createInputEvents, Q as activeEditContextRef, Qi as enableKittyKeyboard, Qn as ToastContainer, Qr as CursorProvider, Qt as detectKittySupport, Ri as useBoxMetrics, Rn as createPositionRegistry, Rr as ModalDialog, Rt as queryTextAreaSize, Sa as splitPane, Si as setScrollRegion, Sn as dispatchKeyEvent, Sr as Badge, St as isInspectorEnabled, Ta as HorizontalVirtualList, Ti as InputLayerContext, Tn as findEnclosingScope, Tr as ProgressBar, Tt as checkDoubleClick, Ui as useConsole, Un as TabList, Ur as clampScroll, Ut as queryPrimaryDA, Vi as Screen, Vn as Tooltip, Vr as EditContextDisplay, Vt as queryModes, Wi as ErrorBoundary, Wn as TabPanel, Wr as useTextArea, Wt as querySecondaryDA, X as collect, Xi as disableKittyKeyboard, Xn as Banner, Xr as rowColToCursor, Xt as runTermtest, Y as fx, Yi as KittyFlags, Yn as Alert, Yr as getWrappedLines, Yt as TERMTEST_SECTIONS, Z as InputBoundary, Zi as disableMouse, Zn as InlineAlert, Zr as TextInput, Zt as detectKittyFromStdio, _a as findAdjacentPane, _i as usePaste, _n as shallow, _r as P, _t as autoEnableInspector, a as ReactiveThemeProvider, aa as resetCursorStyle, ai as useColorScheme, an as injectDOMStyles, ar as Code, at as renderScreenReaderOutput, ba as removePane, bi as scrollDown, bn as createKeyEvent, br as UL, bt as inspectFrame, ca as setCursorStyle, ci as useDragState, cn as HitRegistryContext, cr as H1, ct as renderStatic, da as setWindowTitle, di as useSelection, dn as useHitRegistry, dr as HR, dt as VirtualTerminal, ea as notify, ei as getCursorState, en as copyToClipboard, er as useToast, et as useEditContext, fa as getModifierState, fi as usePasteEvents, fn as HitRegistry, fr as Kbd, ft as withDiagnostics, ga as createLeaf, gi as PasteProvider, gn as useWindowSize, gr as OL, gt as withMeasurer, ha as Fill, hi as getInternalClipboard, hn as ThemeProvider, hr as Muted, ht as createPipeline, i as useActiveScheme, ia as reportDirectory, ii as useReadline, in as createDOMAdapter, ir as Blockquote, it as createTermEditContext, ja as useSearch, ji as useFocusable, jn as Static, jr as toneFillTokens, jt as dispatchMouseEvent, ka as ListView, ki as useFocusManager, kn as getTabOrder$1, kr as TONE_ICONS, kt as createMouseEventProcessor, la as setMouseCursorShape, li as useCopyModeState, ln as useHitRegion, lr as H2, lt as renderSync, ma as useModifierKeys, mi as createPasteEvent, mn as resetHitRegionIdCounter, mr as Lead, mt as withCommands, n as useId, na as notifyKitty, ni as subscribeCursor, nn as requestClipboard, nr as FormField, nt as invertTextOp, oa as resetMouseCursorShape, oi as useListItem, on as CanvasRenderBuffer, or as CodeBlock, ot as measureElement, pa as lastModifierState, pi as createCopyProvider, pn as Z_INDEX, pr as LI, pt as withKeybindings, qi as ANSI, qn as TreeView, qr as cursorMoveUp, qt as queryCursorFromStdio, r as useTransition$1, ra as queryKittyKeyboard, ri as useCursor, rn as DOMRenderBuffer, rr as Heading, rt as mergeTextOps, sa as resetWindowTitle, si as useInteractiveState, sn as createCanvasAdapter, sr as Em, st as render$1, t as useDeferredValue, ta as notifyITerm2, ti as resetCursorState, tn as parseClipboardResponse, tr as Form, tt as applyTextOp, ua as setWindowAndIconTitle, ui as useFindState, un as useHitRegionCallback, ur as H3, ut as withRender, va as getPaneIds, vi as moveCursor, vn as useTerm, vr as Small, vt as disableInspector, wa as SplitView, wi as useTerminalFocused, wn as findByTestID, wr as SelectList, wt as resolveNonTTYMode, xa as resizeSplit, xi as scrollUp, xn as dispatchFocusEvent, xr as Divider, xt as inspectTree, ya as getTabOrder, yi as resetScrollRegion, yn as createFocusEvent, yr as Strong, yt as enableInspector, zi as useSignal, zn as usePositionRegistry, zr as formatTitleWithHotkey, zt as DecMode } from "./src-CF-6UN01.mjs";
3
3
  import { $ as isWideGrapheme, A as isMouseSequence, B as displayWidth, C as enableFocusReporting, Ct as isPrivateUseArea, D as disableBracketedPaste, E as PASTE_START, F as IncrementalRenderMismatchError, G as graphemeCount, Gt as parseHotkey, H as ensureEmojiPresentation, Ht as keyToModifiers, J as hasWideCharacters, K as graphemeWidth, Kt as parseKey, L as constrainText, M as createOutputPhase, O as enableBracketedPaste, P as setOutputCaps, Q as isTextSizingEnabled, R as createMeasurer, Rt as emptyKey, S as disableFocusReporting, T as PASTE_END, Tt as textSized, Ut as keyToName, V as displayWidthAnsi, W as getFirstCodePoint, Wt as matchHotkey, X as isCJK, Y as hasZeroWidthCharacters, Z as isLikelyEmoji, _ as term, _t as wrapText, at as parseAnsiText, b as createTerm, bt as writeTextTruncated, ct as setTextSizingEnabled, dt as sliceByWidthRange, ft as splitGraphemes, gt as truncateText, ht as truncateAnsi, it as padText, j as parseMouseSequence, k as parseBracketedPaste, lt as sliceByWidth, mt as stripAnsi, nt as measureText, ot as runWithMeasurer, q as hasAnsi, qt as parseKeypress, rt as normalizeText, st as setTextEmojiWide, tt as isZeroWidthGrapheme, ut as sliceByWidthFromEnd, vt as writeLinesToBuffer, w as parseFocusEvent, wt as isTextSizingLikelySupported, xt as detectTextSizingSupport, y as patchConsole, yt as writeTextToBuffer, z as createWidthMeasurer } from "./reconciler-Cwgm8hRR.mjs";
4
4
  import { T as deriveTheme, U as pickColorLevel, W as quantizeHex, Z as detectTerminalCaps, _ as parsePaletteResponse, b as setPaletteColor, c as queryBackgroundColor, d as resetBackgroundColor, f as resetCursorColor, g as setForegroundColor, h as setCursorColor, k as resolveThemeColor, l as queryCursorColor, m as setBackgroundColor, n as generateTheme, p as resetForegroundColor, q as defaultCaps, s as detectColorScheme, u as queryForegroundColor, v as queryMultiplePaletteColors, y as queryPaletteColor } from "./src-NCKb8kE5.mjs";
5
5
  import { a as setLayoutEngine, i as isLayoutEngineInitialized } from "./layout-engine-ClUgv6jB.mjs";
6
- import { n as renderStringSync, t as renderString } from "./render-string-Cbuf63Ya.mjs";
6
+ import { n as renderStringSync, t as renderString } from "./render-string-Darrg7ku.mjs";
7
7
  import { E as defaultLightTheme, O as getThemeByName, S as ansi16LightTheme, T as defaultDarkTheme, i as detectTheme, w as builtinThemes, x as ansi16DarkTheme } from "./src-B5GjfG7g.mjs";
8
8
  import { a as encodeKittyImage, c as useScreenRect, i as deleteKittyImage, l as useScrollRect, n as encodeSixel, o as isKittyGraphicsSupported, r as isSixelSupported, s as useBoxRect, t as Image } from "./image-CTII5QWI.mjs";
9
9
  import { n as createYogaEngine, r as initYogaEngine, t as YogaLayoutEngine } from "./yoga-adapter-8oRGRw8V.mjs";
@@ -1,2 +1,2 @@
1
- import { n as renderStringSync, t as renderString } from "./render-string-Cbuf63Ya.mjs";
1
+ import { n as renderStringSync, t as renderString } from "./render-string-Darrg7ku.mjs";
2
2
  export { renderString, renderStringSync };
@@ -4588,16 +4588,29 @@ function forEachFadeRegionCell(bufferWidth, bufferHeight, includes, excludes, vi
4588
4588
  if (x0 >= x1 || y0 >= y1) continue;
4589
4589
  for (let y = y0; y < y1; y++) for (let x = x0; x < x1; x++) once(x, y);
4590
4590
  }
4591
- if (excludes.length > 0) for (const { rect } of excludes) {
4592
- const ix0 = Math.max(0, rect.x);
4593
- const iy0 = Math.max(0, rect.y);
4594
- const ix1 = Math.min(bufferWidth, rect.x + rect.width);
4595
- const iy1 = Math.min(bufferHeight, rect.y + rect.height);
4596
- const innerValid = ix0 < ix1 && iy0 < iy1;
4597
- for (let y = 0; y < bufferHeight; y++) for (let x = 0; x < bufferWidth; x++) {
4598
- if (innerValid && x >= ix0 && x < ix1 && y >= iy0 && y < iy1) continue;
4599
- once(x, y);
4591
+ if (excludes.length > 0) {
4592
+ const clipped = [];
4593
+ for (const { rect } of excludes) {
4594
+ const x0 = Math.max(0, rect.x);
4595
+ const y0 = Math.max(0, rect.y);
4596
+ const x1 = Math.min(bufferWidth, rect.x + rect.width);
4597
+ const y1 = Math.min(bufferHeight, rect.y + rect.height);
4598
+ if (x0 < x1 && y0 < y1) clipped.push({
4599
+ x0,
4600
+ y0,
4601
+ x1,
4602
+ y1
4603
+ });
4600
4604
  }
4605
+ if (clipped.length > 0) for (let y = 0; y < bufferHeight; y++) for (let x = 0; x < bufferWidth; x++) {
4606
+ let insideAnyExclude = false;
4607
+ for (const r of clipped) if (x >= r.x0 && x < r.x1 && y >= r.y0 && y < r.y1) {
4608
+ insideAnyExclude = true;
4609
+ break;
4610
+ }
4611
+ if (!insideAnyExclude) once(x, y);
4612
+ }
4613
+ else for (let y = 0; y < bufferHeight; y++) for (let x = 0; x < bufferWidth; x++) once(x, y);
4601
4614
  }
4602
4615
  return count;
4603
4616
  }
@@ -4738,6 +4751,19 @@ function fadeCell(buffer, x, y, plan) {
4738
4751
  if (fgHex && bgHex) {
4739
4752
  const mixedRgb = hexToRgb$1(mixSrgb(fgHex, bgHex, amount));
4740
4753
  if (!mixedRgb) return false;
4754
+ if (isEmojiGlyph) {
4755
+ const newAttrs = cell.attrs.dim ? cell.attrs : {
4756
+ ...cell.attrs,
4757
+ dim: true
4758
+ };
4759
+ buffer.setCell(x, y, {
4760
+ ...cell,
4761
+ fg: mixedRgb,
4762
+ attrs: newAttrs
4763
+ });
4764
+ propagateToContinuation(buffer, cell, x, y, { dim: true });
4765
+ return true;
4766
+ }
4741
4767
  buffer.setCell(x, y, {
4742
4768
  ...cell,
4743
4769
  fg: mixedRgb
@@ -4805,17 +4831,19 @@ init_src();
4805
4831
  * Stage 2b — emit the Kitty graphics overlay for the plan.
4806
4832
  *
4807
4833
  * The output always begins with `CURSOR_SAVE + kittyDeleteAllScrimPlacements()
4808
- * + CURSOR_RESTORE` when `plan.active` is true — even when zero emoji cells
4834
+ * + CURSOR_RESTORE` when the plan is realized — even when zero emoji cells
4809
4835
  * fall inside the faded region this frame. The unconditional clear is what
4810
4836
  * erases stale placements from a previous frame.
4811
4837
  *
4812
- * Returns `""` when `plan.active` is false. Callers that also need to
4813
- * suppress the overlay because Kitty graphics are not available should NOT
4814
- * call this function at all the orchestrator (`./index.ts`) guards the
4815
- * call site with `plan.kittyEnabled`.
4838
+ * Returns `""` when the plan can't be realized as a Kitty overlay. Public
4839
+ * API safety callers (tests, future consumers) should be able to invoke
4840
+ * this directly without re-deriving the `kittyEnabled` / `scrim` /
4841
+ * `amount > 0` gate. The orchestrator (`./index.ts`) also gates with
4842
+ * `plan.kittyEnabled` for clarity, but the early-out below is the
4843
+ * authoritative contract.
4816
4844
  */
4817
4845
  function realizeToKitty(plan, buffer) {
4818
- if (!plan.active) return "";
4846
+ if (!plan.active || !plan.kittyEnabled || plan.amount <= 0 || plan.scrim === null) return "";
4819
4847
  const cells = collectEmojiCellsInFadeRegion(buffer, plan);
4820
4848
  const tint = hexToRgb$1(plan.scrim ?? plan.defaultBg ?? "#000000") ?? {
4821
4849
  r: 0,
@@ -4873,20 +4901,11 @@ function collectEmojiCellsInFadeRegion(buffer, plan) {
4873
4901
  }
4874
4902
  //#endregion
4875
4903
  //#region packages/ag-term/src/pipeline/backdrop/index.ts
4876
- init_src();
4877
4904
  const EMPTY_RESULT = Object.freeze({
4878
4905
  modified: false,
4879
4906
  overlay: ""
4880
4907
  });
4881
4908
  /**
4882
- * Cached "Kitty inactive-frame cleanup" overlay. Emitted when Kitty
4883
- * graphics are enabled but the backdrop is inactive this frame so any
4884
- * stale scrim placements from the previous frame are cleared. Kept as a
4885
- * module-level constant so repeated inactive frames don't rebuild the
4886
- * same string.
4887
- */
4888
- const KITTY_CLEANUP_OVERLAY = "\x1B7" + kittyDeleteAllScrimPlacements() + "\x1B8";
4889
- /**
4890
4909
  * Apply backdrop-fade to the buffer based on tree markers.
4891
4910
  *
4892
4911
  * Thin orchestrator over the mask → realize stages:
@@ -4897,30 +4916,24 @@ const KITTY_CLEANUP_OVERLAY = "\x1B7" + kittyDeleteAllScrimPlacements() + "\x1B8
4897
4916
  *
4898
4917
  * Returns a `BackdropResult`:
4899
4918
  * - `modified` — any buffer cells changed.
4900
- * - `overlay` — out-of-band ANSI escapes. Non-empty when Kitty graphics
4901
- * are enabled (regardless of whether the plan is active):
4902
- * - Plan active: contains at minimum a scrim-clear command so last-frame
4903
- * placements get erased even if this frame has no wide cells.
4904
- * - Plan inactive: contains a cursor-save/delete-all/cursor-restore
4905
- * sequence so stale placements from a prior active frame are cleaned
4906
- * up. Without this, leftover scrim rectangles persist on screen when
4907
- * the backdrop deactivates.
4908
- *
4909
- * Because the overlay self-cleans on deactivation, the higher-level
4910
- * `_kittyActive` tracker in `ag.ts` is redundant for this module. It is
4911
- * intentionally left in place (out of scope for this pass); future cleanup
4912
- * can delete it once the renderer-level tracker is also removed.
4919
+ * - `overlay` — out-of-band ANSI escapes. Non-empty only when the plan is
4920
+ * active AND Kitty graphics are enabled. An active overlay always begins
4921
+ * with a delete-all command so last-frame placements get erased even if
4922
+ * this frame has no wide cells.
4923
+ *
4924
+ * **Inactive frames are silent.** When `plan.active` is false this returns
4925
+ * `EMPTY_RESULT` regardless of `options.kittyGraphics`. Stale scrim
4926
+ * placements from a prior active frame must be cleaned up at the
4927
+ * deactivation EDGE by the caller (e.g., `ag.ts` tracks `_kittyActive`
4928
+ * across frames and emits a one-shot delete-all when active→inactive).
4929
+ * Emitting the delete-all every inactive frame here would spam the
4930
+ * terminal Modal's default `fade={0}` would push a cleanup string every
4931
+ * frame indefinitely.
4913
4932
  */
4914
4933
  function applyBackdrop(root, buffer, options) {
4915
4934
  const plan = buildPlan(root, options);
4916
4935
  if (plan.mixedAmounts && process.env.NODE_ENV !== "production") console.warn(`[silvery:backdrop] multiple fade amounts in one frame (using ${plan.amount}); Kitty overlay will use the first observed amount. See plan.ts / assertSingleAmount.`);
4917
- if (!plan.active) {
4918
- if (options?.kittyGraphics === true) return {
4919
- modified: false,
4920
- overlay: KITTY_CLEANUP_OVERLAY
4921
- };
4922
- return EMPTY_RESULT;
4923
- }
4936
+ if (!plan.active) return EMPTY_RESULT;
4924
4937
  return {
4925
4938
  modified: realizeToBuffer(plan, buffer),
4926
4939
  overlay: plan.kittyEnabled ? realizeToKitty(plan, buffer) : ""
@@ -5214,9 +5227,10 @@ function createAg(root, options) {
5214
5227
  } else {
5215
5228
  carryForwardBuffer = buffer;
5216
5229
  if (!opts?.fresh) _prevBuffer = buffer;
5217
- if (_kittyActive) overlay = "\x1B7" + kittyDeleteAllScrimPlacements() + "\x1B8";
5218
5230
  }
5219
- _kittyActive = backdropActive && overlay.length > 0;
5231
+ const kittyActiveThisFrame = backdropActive && overlay.length > 0;
5232
+ if (_kittyActive && !kittyActiveThisFrame) overlay = "\x1B7" + kittyDeleteAllScrimPlacements() + "\x1B8";
5233
+ _kittyActive = kittyActiveThisFrame;
5220
5234
  clearDirtyTracking();
5221
5235
  const acc = globalThis.__silvery_bench_phases;
5222
5236
  if (acc) {
@@ -5512,4 +5526,4 @@ function withActEnvironment(fn) {
5512
5526
  //#endregion
5513
5527
  export { setActiveColorLevel as a, _usingCtx as i, renderStringSync as n, createAg as r, renderString as t };
5514
5528
 
5515
- //# sourceMappingURL=render-string-Cbuf63Ya.mjs.map
5529
+ //# sourceMappingURL=render-string-Darrg7ku.mjs.map