MCPcopy Create free account
hub / github.com/Noumena-Network/code / transition

Method transition

src/ink/screen.ts:181–190  ·  view source on GitHub ↗

* Returns the pre-serialized ANSI string to transition from one style to * another. Cached by (fromId, toId) — zero allocations after first call * for a given pair.

(fromId: number, toId: number)

Source from the content-addressed store, hash-verified

179 * for a given pair.
180 */
181 transition(fromId: number, toId: number): string {
182 if (fromId === toId) return ''
183 const key = fromId * 0x100000 + toId
184 let str = this.transitionCache.get(key)
185 if (str === undefined) {
186 str = ansiCodesToString(diffAnsiCodes(this.get(fromId), this.get(toId)))
187 this.transitionCache.set(key, str)
188 }
189 return str
190 }
191
192 /**
193 * Intern a style that is `base + inverse`. Cached by base ID so

Callers 3

renderMethod · 0.80
transitionStyleFunction · 0.80
renderFrameSliceFunction · 0.80

Calls 3

getMethod · 0.95
setMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected