You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Build the browser engine from per-instance factories
Go: import github.com/cplieger/web-terminal-engine/v6/... in place of .../v5/...; the Go API is otherwise unchanged in this commit.
Replace render.init(...), scroll.init(...), mouse.init(...) and connection.init(...) with one createTerminalEngine({ output, termWrap, callbacks, wsPath }), or compose createModeState, createScrollController, createRenderer, createMouseController and createConnection yourself, passing each state dependency explicitly (there is no default instance to fall back to).
Call methods on the returned instances (engine.connection.connect(), engine.renderer.bind(store), engine.renderer.updateFontMetrics()) in place of the removed render, scroll, modes, mouse and connection namespace exports.
Import encodeSGR, MAX_REPLAY_LINES, MAX_OUTBOX_BYTES and POWER_ON_MODES from the package root instead of the removed namespaces.
Stop calling generateSessionId, historyPagingAvailable and historyRequestInFlight; session identity and paging state are connection internals with no replacement.
Pass a mode state to keyboard.bracketTextForPaste(text, modes), keyboard.kittyDisambiguateActive(modes) and toolbar.bindMobileToolbar({ ..., modes }); the modes member is required.
Replace the connection.Callbacks type with the root ConnectionCallbacks type; remove getHaveThrough, onResumeTransition, onHistoryReply, noteSolicited, clearSolicited and onHistoryRetry from it (the engine answers them from its own renderer; onResumeBounds still fires, after the renderer has been updated), and move wsPath from it to the options object (ConnectionOptions.wsPath or TerminalEngineOptions.wsPath).
Route frames yourself only when composing the factories by hand: createTerminalEngine already passes screen, scroll and modes frames to its renderer before your onMessage sees them.
Replace modes.setModes(...) with modes.applySnapshot({ ...POWER_ON_MODES, ... }) and scroll.restoreScrollTop(top) with scroll.restoreView({ top, following: false }).
Read the --char-w custom property from the terminal element you passed as termWrap, not from document.documentElement.
Pass sessionIdKey when two engines on one page run without a session manager, or they attach to the same session.
Copy POWER_ON_MODES ({ ...POWER_ON_MODES }) before changing a field; the object is frozen and an assignment to it throws in strict mode.
Call engine.dispose() when the terminal leaves the page. A callback may call it; the connection stops after the callback returns, and every method stays callable afterwards, returning its documented empty value.
Expect createTerminalEngine and the five factories to throw on a failed construction with nothing left behind; there is no partially built engine to dispose.
Added
[breaking] Build the browser engine from per-instance factories