Runtime Abstraction (P2)
Shared UI code in apps/** should not directly import or assume:
window/documentnavigator.clipboardrequestAnimationFrame
Instead, use the runtime helpers exported from vue-terminal:
- environment flags (
isBrowser/isTerminal) - safe wrappers (
timer,raf,clipboard,getWindow/getDocument) - explicit clipboard providers such as
createOsc52ClipboardProvider()
Why
- The same Vue app should run in browser (DOM renderer) and in Node/terminal (stdout renderer + stdin).
- Removing hard browser deps keeps terminal builds deterministic and prevents runtime crashes.
Guidelines
- DOM-only code (e.g.
createDomRenderer) may usedocumentdirectly. - Shared UI code should call runtime wrappers or feature-detect via
isBrowser. - Terminal clipboard stays opt-in.
createRuntime("terminal")returns an unsupported clipboard by default; passcreateRuntime("terminal", { clipboard }),createTerminalApp({ clipboard }), or<TerminalProvider :clipboard="clipboard" />when a host wants copy/paste integration. createOsc52ClipboardProvider()writes OSC52 sequences only when explicitly configured or used. It does not runpbcopy,wl-copy,xclip, or other system commands.