@zaly/tui 0.0.10 → 0.0.12

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.
Files changed (180) hide show
  1. package/assets/schemas/theme.schema.json +351 -36
  2. package/assets/themes/ayu-dark.json +2 -21
  3. package/assets/themes/catppuccin-frappe.json +2 -21
  4. package/assets/themes/catppuccin-latte.json +2 -21
  5. package/assets/themes/catppuccin-macchiato.json +2 -21
  6. package/assets/themes/catppuccin-mocha.json +2 -21
  7. package/assets/themes/dracula-soft.json +2 -21
  8. package/assets/themes/dracula.json +2 -21
  9. package/assets/themes/everforest-dark.json +2 -21
  10. package/assets/themes/everforest-light.json +2 -21
  11. package/assets/themes/github-dark.json +2 -21
  12. package/assets/themes/github-light.json +2 -21
  13. package/assets/themes/gruvbox-dark-medium.json +2 -21
  14. package/assets/themes/kanagawa-dragon.json +2 -21
  15. package/assets/themes/kanagawa-wave.json +2 -21
  16. package/assets/themes/material-theme-palenight.json +2 -21
  17. package/assets/themes/min-dark.json +2 -18
  18. package/assets/themes/min-light.json +2 -18
  19. package/assets/themes/monokai.json +2 -21
  20. package/assets/themes/night-owl.json +2 -21
  21. package/assets/themes/nord.json +2 -18
  22. package/assets/themes/one-dark-pro.json +2 -21
  23. package/assets/themes/one-light.json +2 -20
  24. package/assets/themes/poimandres.json +2 -21
  25. package/assets/themes/rose-pine.json +2 -18
  26. package/assets/themes/solarized-dark.json +2 -21
  27. package/assets/themes/solarized-light.json +2 -21
  28. package/assets/themes/synthwave-84.json +2 -21
  29. package/assets/themes/tokyonight-day.json +4 -5
  30. package/assets/themes/tokyonight-moon.json +3 -4
  31. package/assets/themes/tokyonight-night.json +3 -4
  32. package/assets/themes/tokyonight-storm.json +3 -4
  33. package/assets/themes/vesper.json +2 -17
  34. package/assets/themes/vitesse-dark.json +2 -21
  35. package/assets/themes/vitesse-light.json +2 -21
  36. package/dist/{actions-DFboj3g5.d.mts → actions-Dc4D4uSf.d.mts} +4 -4
  37. package/dist/{actions-DFboj3g5.d.mts.map → actions-Dc4D4uSf.d.mts.map} +1 -1
  38. package/dist/{ansi-Clq0ozyA.mjs → ansi-DZlXaItJ.mjs} +37 -2
  39. package/dist/ansi-DZlXaItJ.mjs.map +1 -0
  40. package/dist/ansi.d.mts +3 -1
  41. package/dist/ansi.d.mts.map +1 -1
  42. package/dist/ansi.mjs +1 -1
  43. package/dist/{autocomplete-CxzetPOo.d.mts → autocomplete-StW1QJZJ.d.mts} +4 -4
  44. package/dist/{autocomplete-CxzetPOo.d.mts.map → autocomplete-StW1QJZJ.d.mts.map} +1 -1
  45. package/dist/{box-DLEcEvDH.mjs → box-BkP4MF82.mjs} +2 -2
  46. package/dist/box-BkP4MF82.mjs.map +1 -0
  47. package/dist/{builder-DC9byAmK.mjs → builder-1z5ewEWK.mjs} +4 -4
  48. package/dist/builder-1z5ewEWK.mjs.map +1 -0
  49. package/dist/{callbacks-D132G8dy.mjs → callbacks-BwWTCqPJ.mjs} +3 -3
  50. package/dist/{callbacks-D132G8dy.mjs.map → callbacks-BwWTCqPJ.mjs.map} +1 -1
  51. package/dist/{ctx-8Nuf5BrN.mjs → ctx-B7BmPUCD.mjs} +3 -3
  52. package/dist/{ctx-8Nuf5BrN.mjs.map → ctx-B7BmPUCD.mjs.map} +1 -1
  53. package/dist/ctx-D_JgJ8Eo.mjs +1 -0
  54. package/dist/{divider-l0-JPEIm.mjs → divider-TSx9NhI_.mjs} +2 -2
  55. package/dist/divider-TSx9NhI_.mjs.map +1 -0
  56. package/dist/{files-BUsa-RVl.d.mts → files-7DUYSeNc.d.mts} +3 -3
  57. package/dist/{files-BUsa-RVl.d.mts.map → files-7DUYSeNc.d.mts.map} +1 -1
  58. package/dist/{github-D89A3F9U.d.mts → github-C1KfXk98.d.mts} +3 -3
  59. package/dist/{github-D89A3F9U.d.mts.map → github-C1KfXk98.d.mts.map} +1 -1
  60. package/dist/github-Cy2hfWJ7.mjs.map +1 -1
  61. package/dist/{image-34bU73bW.d.mts → image-VaT7AN-S.d.mts} +2 -2
  62. package/dist/{image-34bU73bW.d.mts.map → image-VaT7AN-S.d.mts.map} +1 -1
  63. package/dist/image.d.mts +1 -1
  64. package/dist/index.d.mts +3 -3
  65. package/dist/index.mjs +4 -4
  66. package/dist/{input-Dylds_sI.d.mts → input-BAYux7qo.d.mts} +3 -3
  67. package/dist/{input-Dylds_sI.d.mts.map → input-BAYux7qo.d.mts.map} +1 -1
  68. package/dist/{input-D7fQEUdt.mjs → input-BGTTujDN.mjs} +16 -11
  69. package/dist/input-BGTTujDN.mjs.map +1 -0
  70. package/dist/{inspect-DPLRum7L.d.mts → inspect-CfNydMgO.d.mts} +11 -15
  71. package/dist/inspect-CfNydMgO.d.mts.map +1 -0
  72. package/dist/{inspect-CcgiZ_F9.mjs → inspect-jG_W4njH.mjs} +2 -2
  73. package/dist/{inspect-CcgiZ_F9.mjs.map → inspect-jG_W4njH.mjs.map} +1 -1
  74. package/dist/{log-Dy_QnPZF.mjs → log-ByKlM4iI.mjs} +5 -5
  75. package/dist/log-ByKlM4iI.mjs.map +1 -0
  76. package/dist/{logger-DvuX9DPS.mjs → logger-DSQb0sLP.mjs} +3 -3
  77. package/dist/{logger-DvuX9DPS.mjs.map → logger-DSQb0sLP.mjs.map} +1 -1
  78. package/dist/{markdown-BGPa7UzD.mjs → markdown-CwRmWuU6.mjs} +5 -5
  79. package/dist/{markdown-BGPa7UzD.mjs.map → markdown-CwRmWuU6.mjs.map} +1 -1
  80. package/dist/markdown.d.mts +1 -1
  81. package/dist/markdown.mjs +1 -1
  82. package/dist/{overlay-9WXYiGgW.mjs → overlay-BnvOKtGT.mjs} +2 -2
  83. package/dist/{overlay-9WXYiGgW.mjs.map → overlay-BnvOKtGT.mjs.map} +1 -1
  84. package/dist/{picker-JL8lZfRH.d.mts → picker-DQs_IW77.d.mts} +5 -5
  85. package/dist/{picker-JL8lZfRH.d.mts.map → picker-DQs_IW77.d.mts.map} +1 -1
  86. package/dist/{picker-BqHINl_a.mjs → picker-Dh5IUrTk.mjs} +2 -2
  87. package/dist/{picker-BqHINl_a.mjs.map → picker-Dh5IUrTk.mjs.map} +1 -1
  88. package/dist/{queries-Cvalgu6P.d.mts → queries-BDX8mcl5.d.mts} +26 -10
  89. package/dist/queries-BDX8mcl5.d.mts.map +1 -0
  90. package/dist/{registry-3hLzS4ks.mjs → registry-D-suU3g0.mjs} +15 -20
  91. package/dist/registry-D-suU3g0.mjs.map +1 -0
  92. package/dist/{render-f7M2856V.mjs → render-DEIUNLkh.mjs} +2 -2
  93. package/dist/{render-f7M2856V.mjs.map → render-DEIUNLkh.mjs.map} +1 -1
  94. package/dist/renderer-DhqbEVVR.mjs +1 -0
  95. package/dist/{renderer-DesbRwjQ.mjs → renderer-MQue4Da5.mjs} +2 -2
  96. package/dist/{renderer-DesbRwjQ.mjs.map → renderer-MQue4Da5.mjs.map} +1 -1
  97. package/dist/{renderer-V6AGjbyf.mjs → renderer-zDNlAovy.mjs} +66 -15
  98. package/dist/renderer-zDNlAovy.mjs.map +1 -0
  99. package/dist/{select-zGd5pbiB.d.mts → select-J2KtwxyK.d.mts} +3 -3
  100. package/dist/{select-zGd5pbiB.d.mts.map → select-J2KtwxyK.d.mts.map} +1 -1
  101. package/dist/services/logger.d.mts +1 -1
  102. package/dist/services/logger.mjs +1 -1
  103. package/dist/services/notifier.d.mts +1 -1
  104. package/dist/services/notifier.mjs +2 -2
  105. package/dist/services/picker.d.mts +5 -5
  106. package/dist/services/picker.mjs +6 -6
  107. package/dist/services/prompt.d.mts +4 -4
  108. package/dist/services/prompt.mjs +5 -5
  109. package/dist/shiki/server.mjs +1 -1
  110. package/dist/style.d.mts +2 -2
  111. package/dist/style.mjs +3 -3
  112. package/dist/{text-BefiXAFW.d.mts → text-CCYs9RB2.d.mts} +3 -3
  113. package/dist/{text-BefiXAFW.d.mts.map → text-CCYs9RB2.d.mts.map} +1 -1
  114. package/dist/{text-CRZD9KTN.mjs → text-CkQ7Irmt.mjs} +2 -2
  115. package/dist/{text-CRZD9KTN.mjs.map → text-CkQ7Irmt.mjs.map} +1 -1
  116. package/dist/{text-BLz1tRoC.mjs → text-XvPfweeg.mjs} +2 -2
  117. package/dist/text-XvPfweeg.mjs.map +1 -0
  118. package/dist/text.d.mts +1 -1
  119. package/dist/text.mjs +1 -1
  120. package/dist/{theme.config-BKXX_noZ.mjs → theme.config-B3Yx--C2.mjs} +12 -20
  121. package/dist/theme.config-B3Yx--C2.mjs.map +1 -0
  122. package/dist/themes.d.mts +1 -1
  123. package/dist/themes.mjs +1 -1
  124. package/dist/{tree-CArtDRec.d.mts → tree-DJl5W_B7.d.mts} +3 -3
  125. package/dist/{tree-CArtDRec.d.mts.map → tree-DJl5W_B7.d.mts.map} +1 -1
  126. package/dist/{types-C0EOLZDc.d.mts → types-D2EYlzmK.d.mts} +10 -18
  127. package/dist/types-D2EYlzmK.d.mts.map +1 -0
  128. package/dist/{widget-DtJU2-BJ.d.mts → widget-DPqBbB57.d.mts} +2 -2
  129. package/dist/{widget-DtJU2-BJ.d.mts.map → widget-DPqBbB57.d.mts.map} +1 -1
  130. package/dist/widgets/autocomplete.d.mts +1 -1
  131. package/dist/widgets/autocomplete.mjs +2 -2
  132. package/dist/widgets/box.d.mts +1 -1
  133. package/dist/widgets/box.mjs +1 -1
  134. package/dist/widgets/code.d.mts +2 -2
  135. package/dist/widgets/code.mjs +4 -4
  136. package/dist/widgets/completions/actions.d.mts +1 -1
  137. package/dist/widgets/completions/files.d.mts +1 -1
  138. package/dist/widgets/completions/github.d.mts +1 -1
  139. package/dist/widgets/completions/index.d.mts +3 -3
  140. package/dist/widgets/diff.d.mts +2 -2
  141. package/dist/widgets/diff.mjs +2 -2
  142. package/dist/widgets/divider.d.mts +3 -3
  143. package/dist/widgets/divider.mjs +1 -1
  144. package/dist/widgets/image.d.mts +1 -1
  145. package/dist/widgets/image.mjs +1 -1
  146. package/dist/widgets/input.d.mts +1 -1
  147. package/dist/widgets/input.mjs +1 -1
  148. package/dist/widgets/log.d.mts +1 -1
  149. package/dist/widgets/log.mjs +1 -1
  150. package/dist/widgets/markdown.d.mts +4 -4
  151. package/dist/widgets/markdown.mjs +1 -1
  152. package/dist/widgets/overlay.d.mts +1 -1
  153. package/dist/widgets/overlay.mjs +1 -1
  154. package/dist/widgets/picker.d.mts +1 -1
  155. package/dist/widgets/picker.mjs +1 -1
  156. package/dist/widgets/progress.d.mts +4 -4
  157. package/dist/widgets/progress.mjs.map +1 -1
  158. package/dist/widgets/select.d.mts +1 -1
  159. package/dist/widgets/show.d.mts +1 -1
  160. package/dist/widgets/spinner.d.mts +2 -2
  161. package/dist/widgets/text.d.mts +1 -1
  162. package/dist/widgets/text.mjs +1 -1
  163. package/dist/widgets/tree.d.mts +1 -1
  164. package/dist/widgets/widget.d.mts +1 -1
  165. package/package.json +2 -2
  166. package/dist/ansi-Clq0ozyA.mjs.map +0 -1
  167. package/dist/box-DLEcEvDH.mjs.map +0 -1
  168. package/dist/builder-DC9byAmK.mjs.map +0 -1
  169. package/dist/ctx-k0wTqeql.mjs +0 -1
  170. package/dist/divider-l0-JPEIm.mjs.map +0 -1
  171. package/dist/input-D7fQEUdt.mjs.map +0 -1
  172. package/dist/inspect-DPLRum7L.d.mts.map +0 -1
  173. package/dist/log-Dy_QnPZF.mjs.map +0 -1
  174. package/dist/queries-Cvalgu6P.d.mts.map +0 -1
  175. package/dist/registry-3hLzS4ks.mjs.map +0 -1
  176. package/dist/renderer-BSMOuiLM.mjs +0 -1
  177. package/dist/renderer-V6AGjbyf.mjs.map +0 -1
  178. package/dist/text-BLz1tRoC.mjs.map +0 -1
  179. package/dist/theme.config-BKXX_noZ.mjs.map +0 -1
  180. package/dist/types-C0EOLZDc.d.mts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderer-V6AGjbyf.mjs","names":["bumpKittyPlacements","buildStyle"],"sources":["../src/input/actions.ts","../src/input/decoder.ts","../src/input/defaults.ts","../src/input/router.ts","../src/renderer/frame.ts","../src/renderer/surface.ts","../src/renderer/overlay.ts","../src/renderer/selection.ts","../src/renderer/stream.ts","../src/renderer/terminal.ts","../src/renderer/ui.ts","../src/renderer/renderer.ts"],"sourcesContent":["import type { MaybePromise } from \"@zaly/shared\"\nimport type { ArgsOpts, ArgsResult } from \"@zaly/shared/args\"\nimport type { Node } from \"../core/node.ts\"\nimport type { KeyPattern } from \"./keys.ts\"\nimport type { RoutedKey } from \"./router.ts\"\n\nimport { Emitter } from \"@zaly/shared\"\nimport { Logger } from \"@zaly/shared/logger\"\nimport { canonical } from \"./keys.ts\"\n\n/**\n * Context handed to every action handler. Whether the action was\n * fired by a key, programmatic dispatch, command palette, or a plugin,\n * handlers see a uniform payload.\n */\nexport type ActionCtx<T extends ArgsOpts = ArgsOpts, N = void> = {\n /** The action id being dispatched. */\n readonly id: string\n readonly node?: Node\n /** The node dispatch started from — typically the focused node for\n * key- or palette-triggered actions. `undefined` for purely\n * programmatic dispatch with no anchor. */\n readonly target?: Node\n /** What triggered the dispatch. Open string for extensibility. */\n readonly source: \"key\" | \"programmatic\" | (string & {})\n /** When `source === \"key\"`, the originating routed key event. */\n readonly key?: RoutedKey\n args?: ArgsResult<T>\n} & (N extends Node\n ? {\n /** The node whose `actions[id]` handler matched, or `undefined` when\n * the action was handled by a catalog-level `fn` (not tied to a\n * specific node). */\n readonly node: N\n }\n : {})\n\nexport type ActionFn<T extends ArgsOpts = ArgsOpts, N = void> = (\n ctx: ActionCtx<T, N>\n) => MaybePromise<unknown>\n\nexport type KeyBinding = Omit<ActionDef, \"fn\" | \"keys\"> & {\n id: string\n fn: ActionFn\n keys: string | readonly string[]\n}\n\n/**\n * Metadata + default bindings for a single action. Used as catalog\n * entries inside the `Actions` registry.\n *\n * - `desc` / `name`: human-facing copy for help screens, command palette.\n * - `keys`: default key pattern(s). The registry builds the router's\n * keymap from these so apps don't have to wire bindings themselves.\n * - `hidden`: omit from command palette enumeration.\n * - `fn`: optional handler. When present, `dispatch(id)` calls it\n * directly (used for global/app actions that aren't anchored to a\n * widget instance). When absent, dispatch walks the focus chain\n * looking for a node with `actions[id]`.\n */\nexport interface ActionDef<T extends ArgsOpts = ArgsOpts, N = void> {\n cmd?: string\n desc?: string\n keys?: readonly string[]\n hidden?: boolean\n args?: T\n source?: string\n fn?: ActionFn<T, N>\n /** Optional numeric priority for ordering in the command palette.\n * Higher number is higher priority. Defaults to 0 */\n priority?: number\n}\n\nexport type Action<T extends ArgsOpts = ArgsOpts, N = void> = ActionDef<T, N> & { id: string }\n\nexport type ActionMap = Record<string, ActionDef>\n\nexport type ActionFilter = {\n cmd?: string\n id?: string | RegExp\n hidden?: boolean\n source?: string\n filter?: (info: Action) => boolean\n}\n\nfunction filterAction(action?: Action, filter?: ActionFilter): action is Action {\n if (!action) return false\n if (!filter) return true\n if (filter.cmd && filter.cmd !== action.cmd) return false\n if (filter.id) {\n if (typeof filter.id === \"string\" && filter.id !== action.id) return false\n if (filter.id instanceof RegExp && !filter.id.test(action.id)) return false\n }\n if (filter.hidden !== undefined && filter.hidden !== (action.hidden ?? false)) return false\n if (filter.filter && !filter.filter(action)) return false\n if (filter.source && filter.source !== action.source) return false\n return true\n}\n\n/** A single entry in a Node's `actions` dict.\n *\n * Either a bare handler — the historical form, ideal for built-in\n * widgets whose metadata lives in `defaultActions` — or the full\n * `ActionInfo` shape (with a *required* `fn`). The object form lets\n * widget / plugin authors colocate desc + keys + impl in one place;\n * on mount, the metadata (everything except `fn`) is auto-registered\n * into `ctx.actions` with `extend: false`, so it contributes defaults\n * without clobbering anything the user already configured. */\nexport type NodeAction<T extends Node = Node> =\n | ActionFn<ArgsOpts, T>\n | (ActionDef<ArgsOpts, T> & { fn: ActionFn<ArgsOpts, T> })\n\n/** Shape of a Node's `actions` dict — full action ids as keys. */\nexport type NodeActionMap<T extends Node = Node> = Record<string, NodeAction<T>>\n\ntype ActionEvents = {\n change: {}\n}\n\n/**\n * Runtime registry of action metadata + impls.\n *\n * `register(entries)` merges new `ActionInfo` objects into the catalog\n * by id — passing `{ \"x\": { keys: [...] } }` updates only the `keys`\n * field of `x`, preserving existing `fn`/`desc`. That lets docs,\n * bindings, and impls be registered in separate calls / from different\n * layers (bundled defaults, app-level overrides, plugin contributions).\n *\n * `dispatch(id, ctx)` runs the action:\n * - If the catalog entry has `fn`, it's called directly (global\n * actions).\n * - Otherwise, the focus chain is walked from `ctx.target` (default:\n * the router's focused node) up to the root, and the first node\n * with `actions[id]` handles it.\n *\n * `list()` returns the catalog for command palette / help enumeration.\n */\nexport class Actions extends Emitter<ActionEvents> {\n readonly #catalog = new Map<string, Action>()\n /** Optional focus-chain walker. Supplied by the Renderer so Actions\n * doesn't have to know about the router directly. Returns the\n * starting node (focused by default) so dispatch can walk up. */\n #getTarget: () => Node | undefined = () => undefined\n #logger: Logger\n #keymap = new Map<KeyPattern, string[]>()\n\n constructor(logger?: Logger) {\n super()\n this.#logger = logger ?? new Logger()\n this.on(\"change\", () => this.#updateKeymap())\n }\n\n /** Internal — the Renderer wires this after construction. */\n setTargetResolver(fn: () => Node | undefined): void {\n this.#getTarget = fn\n }\n\n bind(binding: KeyBinding): () => void {\n const { id, keys, ...info } = binding\n return this.register({\n [id]: {\n ...info,\n keys: (Array.isArray(keys) ? keys : [keys]).map((k) => canonical(k)),\n },\n })\n }\n\n /**\n * Register or merge catalog entries. Values are shallow-merged into\n * existing entries by id.\n *\n * When `opts.default` is `true`, the new entry is merged *before* the\n * existing one, so it provides defaults.\n *\n * When `opts.default` is `false` (the default), the new entry is merged\n * *after* the existing one, so it overrides prior values.\n *\n * Returns an unregister function that rolls this call back.\n */\n register(actions: ActionMap | Action[], opts: { default?: boolean } = {}): () => void {\n const entries = Array.isArray(actions)\n ? Object.fromEntries(actions.map((a) => [a.id, a]))\n : actions\n const isDefault = opts.default ?? false\n const ids = Object.keys(entries)\n const prior = new Map<string, Action | undefined>()\n for (const id of ids) prior.set(id, this.#catalog.get(id))\n for (const [id, info] of Object.entries(entries)) {\n info.keys = info.keys?.map((k) => canonical(k))\n const existing = this.#catalog.get(id)\n this.#catalog.set(id, isDefault ? { ...info, ...existing, id } : { ...existing, ...info, id })\n }\n void this.emit(\"change\")\n return () => {\n for (const id of ids) {\n const before = prior.get(id)\n if (before === undefined) this.#catalog.delete(id)\n else this.#catalog.set(id, before)\n }\n void this.emit(\"change\")\n }\n }\n\n /** Remove entries by id. */\n delete(filter: string[] | ActionFilter): void {\n const ids = Array.isArray(filter) ? filter : this.list(filter).map((a) => a.id)\n let changed = false\n for (const id of ids) {\n if (this.#catalog.delete(id)) changed = true\n }\n if (changed) void this.emit(\"change\")\n }\n\n get(id: string): Action | undefined {\n return this.#catalog.get(id)\n }\n\n list(opts?: ActionFilter): Action[] {\n return [...this.#catalog.values()].filter((action) =>\n opts ? filterAction(action, opts) : true\n )\n }\n\n find(opts?: ActionFilter): Action | undefined {\n return this.list(opts)[0]\n }\n\n /**\n * Fire the action `id`. Returns `true` if anything handled it.\n *\n * Order:\n * 1. If the catalog entry has `fn`, call it with the full ctx.\n * 2. Otherwise walk `target` → root and fire the first node's\n * `actions[id]`.\n * 3. Return `false` if nothing consumed.\n */\n dispatch(id: string, ctx?: Partial<ActionCtx>): boolean\n // oxlint-disable-next-line typescript/unified-signatures\n dispatch(action: Action, ctx?: Partial<ActionCtx>): boolean\n dispatch(idOrAction: string | Action, partial: Partial<ActionCtx> = {}): boolean {\n const id = typeof idOrAction === \"string\" ? idOrAction : idOrAction.id\n const action = typeof idOrAction === \"string\" ? this.#catalog.get(id) : idOrAction\n const target = partial.target ?? this.#getTarget()\n const source = partial.source ?? \"programmatic\"\n if (action?.fn) {\n const ctx: ActionCtx = { id, source, target, ...partial }\n const fn = action.fn\n this.#logger.try(() => fn(ctx), { id, name: \"dispatch\", source })\n return true\n }\n for (let node: Node | undefined = target; node !== undefined; node = node.parent) {\n if (!node.isVisible() || !node.mounted) continue\n const entry = node.actions?.[id]\n const fn = typeof entry === \"function\" ? entry : entry?.fn\n if (typeof fn === \"function\") {\n const ctx = { id, node, source, target, ...partial }\n this.#logger.try(() => fn(ctx), { id, name: \"dispatch\", source })\n return true\n }\n }\n return false\n }\n\n dispatchKey(routed: RoutedKey, opts: { node?: boolean; global?: boolean } = {}): boolean {\n const actions = (this.#keymap.get(canonical(routed.pattern)) ?? [])\n .map((id) => this.get(id))\n .filter((a) => filterAction(a))\n .toSorted((a, b) => (b.priority ?? 0) - (a.priority ?? 0))\n if (!actions.length) return false\n const nodeActions = (opts.node ?? true) ? actions.filter((a) => !a.fn) : []\n const globalActions = (opts.global ?? true) ? actions.filter((a) => a.fn) : []\n const target = this.#getTarget()\n\n // Phase 1 - Node actions\n // A node's action targets have higher precedence than the node itself\n if (nodeActions.length) {\n for (const t of target ? [...target.actionTargets, target] : []) {\n for (const a of nodeActions)\n if (this.dispatch(a, { key: routed, source: \"key\", target: t })) return true\n }\n }\n\n // Phase 2 - global actions\n for (const a of globalActions) if (this.dispatch(a, { key: routed, source: \"key\" })) return true\n\n return false\n }\n\n /**\n * Build a `canonical-key → action-id[]` keymap from every catalog\n * entry's `keys` field. Multiple actions can share the same default\n * binding (e.g. both `input.submit` and `menu.select` default to\n * `enter`) — the router's dispatch tries each candidate in order\n * and the first whose handler is reachable on the focus chain\n * wins. Registration order defines priority; later wins.\n */\n #updateKeymap(): void {\n const out = new Map<KeyPattern, string[]>()\n for (const [id, info] of this.#catalog) {\n if (!info.keys) continue\n for (const pattern of info.keys) {\n const c = canonical(pattern)\n const list = out.get(c) ?? []\n list.push(id)\n out.set(c, list)\n }\n }\n this.#keymap = out\n }\n\n whichKey(node: Node, opts: { filter?: ActionFilter } = {}): (Action & { keys: string[] })[] {\n const ret: (Action & { keys: string[] })[] = []\n const actions = Object.keys(node.actions ?? {})\n .map((id) => this.get(id))\n .filter((a) => filterAction(a, opts.filter))\n .toSorted((a, b) => (b.priority ?? 0) - (a.priority ?? 0))\n const used = new Set<string>()\n for (const action of actions) {\n const keys = (action.keys ?? []).map((k) => canonical(k)).filter((k) => !used.has(k))\n if (keys.length === 0) continue\n keys.forEach((k) => used.add(k))\n ret.push({ ...action, keys })\n }\n return ret\n }\n}\n","import type { KeyEvent } from \"./keys.ts\"\n\n/**\n * Decoder — bytes (as a string, after the caller UTF-8 decodes them) in,\n * structured `InputEvent`s out. Holds partial state across `feed()` calls\n * so split-chunk CSI / SS3 / paste sequences work transparently.\n *\n * ESC handling: a lone ESC byte is held as pending (because `ESC + <byte>`\n * might be Alt+<key> or the start of a CSI sequence). Call `flush()` from\n * an idle-timer tick to emit a bare `esc` event when no follow-up arrives.\n */\n\nexport type MouseButton = \"left\" | \"middle\" | \"right\"\n\nexport type MouseEvent = {\n type: \"mouse\"\n x: number\n y: number\n alt: boolean\n ctrl: boolean\n meta: boolean\n shift: boolean\n} & (\n | { kind: \"scroll\"; deltaY: number }\n | { kind: \"down\" | \"drag\" | \"up\"; button: MouseButton; click?: 1 | 2 | 3 }\n)\n\nexport type TerminalResponseEvent =\n | { type: \"term-response\"; kind: \"csi\"; sequence: string; params: string; final: string }\n | { type: \"term-response\"; kind: \"osc\" | \"dcs\" | \"apc\"; sequence: string; payload: string }\n\nexport type InputEvent =\n | { type: \"key\"; event: KeyEvent }\n | { type: \"paste\"; text: string }\n | { type: \"focus\"; gained: boolean }\n | TerminalResponseEvent\n | MouseEvent\n\nexport class Decoder {\n #pending = \"\"\n // Non-undefined while we're accumulating the body of a bracketed-paste\n // block. Any bytes that arrive — including newlines and control chars —\n // go into this buffer verbatim until we see `\\x1b[201~`.\n #paste: string | undefined\n\n feed(chunk: string): InputEvent[] {\n const out: InputEvent[] = []\n let buf = this.#pending + chunk\n this.#pending = \"\"\n\n while (buf.length > 0) {\n if (this.#paste !== undefined) {\n const end = buf.indexOf(PASTE_END)\n if (end === -1) {\n this.#paste += buf\n buf = \"\"\n continue\n }\n this.#paste += buf.slice(0, end)\n out.push({ text: this.#paste, type: \"paste\" })\n this.#paste = undefined\n buf = buf.slice(end + PASTE_END.length)\n continue\n }\n\n const c = buf[0]\n if (c === \"\\x1b\") {\n const consumed = parseEsc(buf, out, () => {\n this.#paste = \"\"\n })\n if (consumed === 0) {\n // Incomplete — hold and await more bytes.\n this.#pending = buf\n return out\n }\n buf = buf.slice(consumed)\n continue\n }\n\n const step = decodeChar(buf, out, { alt: false })\n buf = buf.slice(step)\n }\n\n return out\n }\n\n /**\n * Force-emit any state we've been holding. Currently only the bare-ESC\n * case: if `feed` ended on a lone `\\x1b` we hold it in case `a` follows\n * (alt+a); call `flush` after a short idle timeout to commit it as an\n * `esc` key press.\n */\n flush(): InputEvent[] {\n if (this.#pending === \"\\x1b\") {\n this.#pending = \"\"\n return [key({ name: \"esc\" })]\n }\n return []\n }\n}\n\nconst PASTE_END = \"\\x1b[201~\"\n\n// -----------------------------------------------------------------------------\n// ESC-prefixed parsing.\n// -----------------------------------------------------------------------------\n\nfunction parseEsc(buf: string, out: InputEvent[], onPasteStart: () => void): number {\n if (buf.length === 1) return 0 // just ESC, need more\n\n const second = buf[1]\n if (second === \"[\") return parseCsi(buf, out, onPasteStart)\n if (second === \"O\") return parseSs3(buf, out)\n if (second === \"]\") return parseStringControl(buf, out, \"osc\")\n if (second === \"P\") return parseStringControl(buf, out, \"dcs\")\n if (second === \"_\") return parseStringControl(buf, out, \"apc\")\n\n // Anything else after ESC is alt + <that key>.\n return 1 + decodeChar(buf.slice(1), out, { alt: true })\n}\n\nfunction parseCsi(buf: string, out: InputEvent[], onPasteStart: () => void): number {\n // buf[0..1] = \"\\x1b[\". Final byte is 0x40..0x7e. Params are the bytes in\n // between — digits plus `;` (and sometimes `?` / `>`). We're permissive:\n // scan for the final byte, slice params, dispatch.\n let i = 2\n while (i < buf.length) {\n const code = buf.charCodeAt(i)\n if (code >= 0x40 && code <= 0x7e) {\n const params = buf.slice(2, i)\n const final = buf[i]\n const consumed = i + 1\n if (params === \"200\" && final === \"~\") {\n onPasteStart()\n return consumed\n }\n if (params === \"\" && final === \"I\") {\n out.push({ gained: true, type: \"focus\" })\n return consumed\n }\n if (params === \"\" && final === \"O\") {\n out.push({ gained: false, type: \"focus\" })\n return consumed\n }\n if (isTerminalCsiResponse(params, final)) {\n out.push({\n final,\n kind: \"csi\",\n params,\n sequence: buf.slice(0, consumed),\n type: \"term-response\",\n })\n return consumed\n }\n handleCsi(params, final, out)\n return consumed\n }\n i++\n }\n return 0 // incomplete\n}\n\nfunction parseStringControl(buf: string, out: InputEvent[], kind: \"osc\" | \"dcs\" | \"apc\"): number {\n const payloadStart = 2\n const st = buf.indexOf(\"\\x1b\\\\\", payloadStart)\n const bel = kind === \"osc\" ? buf.indexOf(\"\\x07\", payloadStart) : -1\n const useBel = bel !== -1 && (st === -1 || bel < st)\n const end = useBel ? bel : st\n if (end === -1) return 0\n const consumed = end + (useBel ? 1 : 2)\n out.push({\n kind,\n payload: buf.slice(payloadStart, end),\n sequence: buf.slice(0, consumed),\n type: \"term-response\",\n })\n return consumed\n}\n\nfunction parseSs3(buf: string, out: InputEvent[]): number {\n if (buf.length < 3) return 0\n const final = buf[2]\n const name = SS3_NAMES[final]\n if (name !== undefined) out.push(key({ name }))\n return 3\n}\n\nconst ARROW_NAMES: Partial<Record<string, string>> = {\n A: \"up\",\n B: \"down\",\n C: \"right\",\n D: \"left\",\n F: \"end\",\n H: \"home\",\n}\n\nconst TILDE_NAMES: Partial<Record<string, string>> = {\n \"1\": \"home\",\n \"11\": \"f1\",\n \"12\": \"f2\",\n \"13\": \"f3\",\n \"14\": \"f4\",\n \"15\": \"f5\",\n \"17\": \"f6\",\n \"18\": \"f7\",\n \"19\": \"f8\",\n \"2\": \"insert\",\n \"20\": \"f9\",\n \"21\": \"f10\",\n \"23\": \"f11\",\n \"24\": \"f12\",\n \"3\": \"delete\",\n \"4\": \"end\",\n \"5\": \"pageup\",\n \"6\": \"pagedown\",\n \"7\": \"home\",\n \"8\": \"end\",\n}\n\nconst SS3_NAMES: Partial<Record<string, string>> = { P: \"f1\", Q: \"f2\", R: \"f3\", S: \"f4\" }\n\nfunction isTerminalCsiResponse(params: string, final: string): boolean {\n return final === \"c\" && (params.startsWith(\"?\") || params.startsWith(\">\"))\n}\n\nfunction handleCsi(params: string, final: string, out: InputEvent[]): void {\n if ((final === \"M\" || final === \"m\") && params.startsWith(\"<\")) {\n handleMouse(params, final, out)\n return\n }\n\n const parts = params.length === 0 ? [] : params.split(\";\")\n\n const arrow = ARROW_NAMES[final]\n if (arrow !== undefined) {\n // Form is either `A` (no params) or `1;<mod>A` (modified).\n const mod = parts.length === 2 ? Number.parseInt(parts[1], 10) : 1\n out.push(key({ name: arrow, ...modBits(mod) }))\n return\n }\n\n if (final === \"~\") {\n const code = parts[0] ?? \"\"\n const name = TILDE_NAMES[code]\n if (name === undefined) return\n const mod = parts.length === 2 ? Number.parseInt(parts[1], 10) : 1\n out.push(key({ name, ...modBits(mod) }))\n return\n }\n\n // Unrecognized CSI — drop. (Cursor-position responses, etc.)\n}\n\nfunction handleMouse(params: string, final: string, out: InputEvent[]): void {\n const parts = params\n .slice(1)\n .split(\";\")\n .map((p) => Number.parseInt(p, 10))\n const [button, x, y] = parts\n if (!Number.isFinite(button) || !Number.isFinite(x) || !Number.isFinite(y)) return\n\n const code = button & 0b11\n const scroll = (button & 0b0100_0000) !== 0\n const mods = mouseModBits(button)\n if (scroll) {\n out.push({\n ...mods,\n deltaY: code === 0 ? -1 : 1,\n kind: \"scroll\",\n type: \"mouse\",\n x,\n y,\n })\n return\n }\n\n const mouseButton = buttonName(code)\n if (!mouseButton) return\n const kind = mouseKind(button, final)\n out.push({\n ...mods,\n button: mouseButton,\n kind,\n type: \"mouse\",\n x,\n y,\n })\n}\n\nfunction mouseKind(button: number, final: string): \"down\" | \"drag\" | \"up\" {\n if (final === \"m\") return \"up\"\n if ((button & 0b0010_0000) !== 0) return \"drag\"\n return \"down\"\n}\n\nfunction buttonName(code: number): MouseButton | undefined {\n if (code === 0) return \"left\"\n if (code === 1) return \"middle\"\n if (code === 2) return \"right\"\n return undefined\n}\n\nfunction mouseModBits(button: number): Pick<KeyEvent, \"alt\" | \"ctrl\" | \"meta\" | \"shift\"> {\n return {\n alt: (button & 0b1000) !== 0,\n ctrl: (button & 0b1_0000) !== 0,\n meta: false,\n shift: (button & 0b0100) !== 0,\n }\n}\n\nfunction modBits(m: number): Pick<KeyEvent, \"alt\" | \"ctrl\" | \"meta\" | \"shift\"> {\n // CSI modifier param: 1 = none, then 1 + bit-set over (shift|alt|ctrl|meta).\n const v = Number.isFinite(m) ? m - 1 : 0\n return {\n alt: (v & 0b0010) !== 0,\n ctrl: (v & 0b0100) !== 0,\n meta: (v & 0b1000) !== 0,\n shift: (v & 0b0001) !== 0,\n }\n}\n\n// -----------------------------------------------------------------------------\n// Character-level decoding (used both for plain bytes and for the byte after ESC).\n// -----------------------------------------------------------------------------\n\nfunction decodeChar(buf: string, out: InputEvent[], opts: { alt: boolean }): number {\n const alt = opts.alt\n const code = buf.charCodeAt(0)\n\n if (code === 0x09) {\n out.push(key({ alt, name: \"tab\" }))\n return 1\n }\n if (code === 0x0a || code === 0x0d) {\n out.push(key({ alt, name: \"enter\" }))\n return 1\n }\n if (code === 0x08 || code === 0x7f) {\n out.push(key({ alt, name: \"backspace\" }))\n return 1\n }\n if (code === 0x20) {\n out.push(key({ alt, name: \"space\", text: \" \" }))\n return 1\n }\n if (code >= 0x01 && code <= 0x1a) {\n // Ctrl + letter. Except 0x09 / 0x0a / 0x0d which we already mapped above\n // to their dedicated names (tab / enter), so the user's handler can\n // keyMatches(\"tab\") without also writing keyMatches(\"ctrl-i\").\n const letter = String.fromCharCode(code + 0x60)\n out.push(key({ alt, ctrl: true, name: letter }))\n return 1\n }\n\n // Printable: take a full code point (handles surrogate pairs). On stdin\n // in raw mode with utf8 encoding, Node gives us already-decoded strings\n // so surrogate pairs only appear for astral planes — still handle them.\n const cp = buf.codePointAt(0) ?? 0\n const ch = String.fromCodePoint(cp)\n const isUpper = ch.length === 1 && ch >= \"A\" && ch <= \"Z\"\n out.push(key({ alt, name: ch, shift: isUpper, text: ch }))\n return ch.length\n}\n\nfunction key(partial: Partial<KeyEvent> & { name: string }): InputEvent {\n return {\n event: {\n alt: partial.alt ?? false,\n ctrl: partial.ctrl ?? false,\n meta: partial.meta ?? false,\n name: partial.name,\n shift: partial.shift ?? false,\n ...(partial.text !== undefined ? { text: partial.text } : {}),\n },\n type: \"key\",\n }\n}\n","import type { Renderer } from \"../renderer/renderer.ts\"\nimport type { Input } from \"../widgets/input.ts\"\nimport type { PickerActions } from \"../widgets/picker.ts\"\nimport type { Select } from \"../widgets/select.ts\"\nimport type { ActionDef } from \"./actions.ts\"\n\n/**\n * Union of every built-in action id. Derived from widget `actions`\n * dicts plus the Renderer's `globalActions`. Used to constrain the\n * `defaultActions` catalog so TypeScript catches missing docs or\n * renamed actions at compile time.\n */\nexport type BuiltinAction =\n | keyof (Input[\"actions\"] & Select[\"actions\"] & Renderer[\"globalActions\"])\n | PickerActions\n\n/**\n * Catalog of built-in actions with descriptions and default bindings.\n * Typed as `Record<BuiltinAction, ActionInfo>` so missing entries are a\n * compile error — add an action to a widget and you'll be nudged to\n * document it here.\n *\n * The Renderer registers this into its `actions` registry at\n * construction; apps compose further catalogs via\n * `renderer.actions.register(...)`.\n */\nexport const defaultActions: Record<BuiltinAction, ActionDef> = {\n \"global.quit\": {\n cmd: \"quit\",\n desc: \"quit\",\n keys: [\"ctrl-c\"],\n },\n \"input.cursorDown\": {\n desc: \"move cursor down one line\",\n hidden: true,\n keys: [\"down\"],\n },\n \"input.cursorLeft\": {\n desc: \"move cursor left\",\n hidden: true,\n keys: [\"left\"],\n },\n \"input.cursorLineEnd\": {\n desc: \"jump to end of current line\",\n hidden: true,\n keys: [\"end\", \"ctrl-e\"],\n },\n \"input.cursorLineStart\": {\n desc: \"jump to start of current line\",\n hidden: true,\n keys: [\"home\", \"ctrl-a\"],\n },\n \"input.cursorRight\": {\n desc: \"move cursor right\",\n hidden: true,\n keys: [\"right\"],\n },\n \"input.cursorUp\": {\n desc: \"move cursor up one line\",\n hidden: true,\n keys: [\"up\"],\n },\n \"input.deleteCharBack\": {\n desc: \"delete the character before the cursor\",\n hidden: true,\n keys: [\"backspace\"],\n },\n \"input.deleteCharForward\": {\n desc: \"delete the character at the cursor\",\n hidden: true,\n keys: [\"delete\"],\n },\n \"input.deleteWordBack\": {\n desc: \"delete the word before the cursor\",\n hidden: true,\n keys: [\"ctrl-w\"],\n },\n \"input.insertNewline\": {\n desc: \"insert a newline at the cursor (copies leading indent)\",\n hidden: true,\n keys: [\"shift-enter\", \"alt-enter\"],\n },\n \"input.insertTab\": {\n desc: \"insert an indent (two spaces) at the cursor\",\n hidden: true,\n keys: [\"tab\"],\n },\n \"input.paste\": {\n desc: \"paste text from the system clipboard, or attach a pasted image\",\n hidden: true,\n keys: [\"ctrl-v\"],\n },\n \"input.submit\": {\n desc: \"submit the current value\",\n hidden: true,\n keys: [\"enter\"],\n },\n \"picker.next\": {\n desc: \"move to the next item that matches the query\",\n hidden: true,\n keys: [\"ctrl-n\"],\n },\n \"picker.prev\": {\n desc: \"move to the previous item that matches the query\",\n hidden: true,\n keys: [\"ctrl-p\"],\n },\n \"select.accept\": {\n desc: \"select the active item\",\n hidden: true,\n keys: [\"enter\"],\n },\n \"select.close\": {\n desc: \"close\",\n keys: [\"esc\"],\n },\n \"select.complete\": {\n desc: \"complete the active item\",\n hidden: true,\n keys: [\"tab\"],\n },\n \"select.first\": {\n desc: \"jump to the first item\",\n hidden: true,\n keys: [\"home\"],\n },\n \"select.last\": {\n desc: \"jump to the last item\",\n hidden: true,\n keys: [\"end\"],\n },\n \"select.next\": {\n desc: \"move to the next item\",\n hidden: true,\n keys: [\"down\"],\n },\n \"select.page-down\": {\n desc: \"move down one page\",\n hidden: true,\n keys: [\"pagedown\", \"ctrl-d\"],\n },\n \"select.page-up\": {\n desc: \"move up one page\",\n hidden: true,\n keys: [\"pageup\", \"ctrl-u\"],\n },\n \"select.prev\": {\n desc: \"move to the previous item\",\n hidden: true,\n keys: [\"up\"],\n },\n}\n","import type { Node } from \"../core/node.ts\"\nimport type { Actions } from \"./actions.ts\"\nimport type { InputEvent, MouseEvent, TerminalResponseEvent } from \"./decoder.ts\"\nimport type { KeyEvent, KeyPattern } from \"./keys.ts\"\n\nimport { Emitter } from \"@zaly/shared\"\nimport { Logger } from \"@zaly/shared/logger\"\nimport { canonical } from \"./keys.ts\"\n\nexport type KeyPatterns = KeyPattern | readonly KeyPattern[]\nexport type KeyHandler = (ev: KeyEvent) => boolean | void\n\n/** A keymap entry is either an action id (string) or a direct key\n * handler — the Router treats them as alternate branches on match.\n * Multiple entries can share the same key; dispatch tries each in\n * order until one consumes. */\nexport type KeymapEntry = string | KeyHandler\n\n/**\n * A routed keyboard event — the raw `KeyEvent` data plus a propagation\n * control and a precomputed canonical `pattern`. Listeners call\n * `.stop()` to consume the event; the router checks `.stopped` between\n * parent-chain hops and halts bubbling.\n */\nexport interface RoutedKey {\n name: string\n text?: string\n ctrl: boolean\n alt: boolean\n shift: boolean\n meta: boolean\n /** Canonical pattern form (e.g. `\"ctrl-a\"`, `\"shift-enter\"`). Handy\n * for `switch(ev.pattern)` matching without calling `keyMatches`. */\n pattern: string\n stopped: boolean\n stop: () => void\n}\n\n/** A routed paste event — the pasted text + the same propagation control. */\nexport interface RoutedPaste {\n text: string\n stopped: boolean\n stop: () => void\n}\n\nexport type InputRouterEvents = {\n \"terminal-focus\": { gained: boolean }\n key: { event: KeyEvent }\n mouse: { event: MouseEvent }\n \"term-response\": { event: TerminalResponseEvent }\n focus: { node: Node }\n blur: { node: Node }\n}\n\n/**\n * Routes decoder events to the right node and/or action.\n *\n * Dispatch priority for a key event (most-specific-first):\n *\n * 1. **Per-node `\"key\"` bubble** — focused node up to root. Each\n * node's `on(\"key\")` / `bind()` handlers fire. Calling `.stop()`\n * ends dispatch. This is where local overrides live.\n * 2. **Keymap lookup** — a single table built by the `Actions`\n * registry (`canonical pattern → action id | direct handler`).\n * Action ids are dispatched through `Actions.dispatch(id)`,\n * which walks the focus chain for `node.actions[id]` — or\n * calls a catalog-level `fn` if the action has one.\n * 3. **Global `bind()` handlers** — a last-resort fallback for\n * ad-hoc app-level bindings registered via `router.bind(...)`.\n *\n * Paste events follow a simple emit-and-bubble path — no keymap.\n */\nexport class InputRouter extends Emitter<InputRouterEvents> {\n #focused: Node[] = []\n /** Set by the Renderer so keymap-matched action ids can be\n * dispatched through the catalog. */\n #actions: Actions | undefined\n #logger: Logger\n #mouseClick: { button: string; count: 1 | 2 | 3; time: number; x: number; y: number } | undefined\n #terminalFocus = true\n\n constructor(logger?: Logger) {\n super()\n this.#logger = logger ?? new Logger()\n }\n\n /** Internal — wired by the Renderer at construction. */\n setActions(actions: Actions): void {\n this.#actions = actions\n }\n\n /** Currently-focused node, or `undefined` when none. */\n get focused(): Node | undefined {\n this.#focused = this.#focused.filter((n) => n.mounted)\n return this.#focused.at(-1)\n }\n\n /**\n * Move focus to `node`. Emits `blur`\n * on the previously-focused node and `focus` on the new one.\n * Focusing the already-focused node is a no-op.\n */\n focus(node: Node): void {\n // If the node is already focused, or not mounted, do nothing\n if (!node.mounted || this.focused === node) return\n\n const prev = this.focused\n\n // Remove the node from the focus stack if it exists, then push it to the top\n this.#focused = this.#focused.filter((n) => n !== node)\n this.#focused.push(node)\n\n if (prev !== undefined) {\n void prev.emit(\"blur\")\n void this.emit(\"blur\", { node: prev })\n }\n\n void node.emit(\"focus\")\n void this.emit(\"focus\", { node })\n }\n\n /** Clear focus from `node`. Emits `blur` on the node and `focus`\n * on the next-most-recently-focused node, if any. */\n blur(node: Node): void {\n const top = this.focused\n\n // Remove the node from the focus stack if it exists\n this.#focused = this.#focused.filter((n) => n !== node)\n\n // If the node is not the currently focused node, do nothing\n if (top !== node) return\n\n const next = this.focused\n\n void node.emit(\"blur\")\n void this.emit(\"blur\", { node })\n\n if (next !== undefined) {\n void next.emit(\"focus\")\n void this.emit(\"focus\", { node: next })\n }\n }\n\n get terminalFocus(): boolean {\n return this.#terminalFocus\n }\n\n /**\n * Dispatch a decoder event. Returns `true` if consumed.\n */\n dispatch(ev: InputEvent): boolean {\n return this.#logger.try(() => this.#dispatch(ev), \"dispatch\") ?? false\n }\n\n #dispatch(ev: InputEvent): boolean {\n if (ev.type === \"key\") return this.#dispatchKey(ev.event)\n if (ev.type === \"paste\") return this.#dispatchPaste(ev.text)\n if (ev.type === \"term-response\") {\n void this.emit(\"term-response\", { event: ev })\n return false\n }\n if (ev.type === \"mouse\") {\n void this.emit(\"mouse\", { event: this.#routeMouse(ev) })\n return false\n } else {\n this.#terminalFocus = ev.gained\n void this.emit(\"terminal-focus\", { gained: ev.gained })\n }\n return false\n }\n\n #routeMouse(event: MouseEvent): MouseEvent {\n if (event.kind !== \"down\") return event\n const now = Date.now()\n const prev = this.#mouseClick\n const same =\n prev !== undefined &&\n prev.button === event.button &&\n prev.x === event.x &&\n prev.y === event.y &&\n now - prev.time <= 500\n const count = same ? (((prev.count % 3) + 1) as 1 | 2 | 3) : 1\n this.#mouseClick = { button: event.button, count, time: now, x: event.x, y: event.y }\n return { ...event, click: count }\n }\n\n #dispatchKey(event: KeyEvent): boolean {\n void this.emit(\"key\", { event })\n const routed = makeRoutedKey(event)\n\n // Phase 1 - node actions\n if (this.#actions?.dispatchKey(routed, { global: false, node: true })) return true\n\n // Phase 2 — per-node key bubble. Most-local wins.\n for (let node: Node | undefined = this.focused; node !== undefined; node = node.parent) {\n void node.emit(\"key\", { key: routed })\n if (routed.stopped) return true\n }\n\n // Phase 3 - global actions\n return this.#actions?.dispatchKey(routed, { global: true, node: false }) ?? false\n }\n\n #dispatchPaste(text: string): boolean {\n const routed = makeRoutedPaste(text)\n let node = this.focused\n while (node !== undefined) {\n void node.emit(\"paste\", { paste: routed })\n if (routed.stopped) return true\n node = node.parent\n }\n return false\n }\n}\n\nfunction makeRoutedKey(ev: KeyEvent): RoutedKey {\n const r: RoutedKey = {\n alt: ev.alt,\n ctrl: ev.ctrl,\n meta: ev.meta,\n name: ev.name,\n pattern: canonical(ev),\n shift: ev.shift,\n stop: () => {\n r.stopped = true\n },\n stopped: false,\n }\n if (ev.text !== undefined) r.text = ev.text\n return r\n}\n\nfunction makeRoutedPaste(text: string): RoutedPaste {\n const r: RoutedPaste = {\n stop: () => {\n r.stopped = true\n },\n stopped: false,\n text,\n }\n return r\n}\n","import type { RenderCtx } from \"../core/ctx.ts\"\nimport type { Terminal } from \"./terminal.ts\"\n\nimport { sliceAnsi, stringWidth } from \"@zaly/shared/ansi\"\nimport { stripAnsiBg } from \"../style/ansi.ts\"\n\nexport type FrameOp = (terminal: Terminal) => void\n\nexport type LineSlice = {\n from: number\n line: string\n to?: number\n}\n\nfunction sliceLine(\n line: string,\n from: number | undefined,\n to: number | undefined,\n width: number\n): LineSlice | undefined {\n const start = from ? Math.max(0, from - 1) : 0\n const end = to ? Math.max(start, to - 1) : width\n if (end <= start) return\n const lineWidth = stringWidth(line)\n if (start >= lineWidth) return\n const clampedEnd = Math.min(end, lineWidth)\n return { from: start + 1, line, to: clampedEnd + 1 }\n}\n\nexport class Frame {\n #base: (string | undefined)[] = []\n #current: (string | undefined)[] = []\n\n constructor(readonly terminal: Terminal) {}\n\n reset(rows = this.terminal.rows): void {\n this.#base = Array(rows).fill(undefined)\n this.#current = Array(rows).fill(undefined)\n }\n\n begin(): RenderFrame {\n const rows = this.terminal.rows\n if (this.#current.length !== rows || this.#base.length !== rows) this.reset(rows)\n return new RenderFrame(this.terminal, this.#current, this.#base)\n }\n\n slice(\n row: number,\n from: number | undefined,\n to: number | undefined,\n width = this.terminal.cols\n ): LineSlice | undefined {\n return sliceLine(this.#current[row - 1] ?? \"\", from, to, width)\n }\n}\n\nexport class RenderFrame {\n readonly #ops: FrameOp[] = []\n readonly #next: string[]\n\n constructor(\n readonly terminal: Terminal,\n readonly current: (string | undefined)[],\n readonly base: (string | undefined)[]\n ) {\n this.#next = base.map((row) => row ?? \"\")\n }\n\n get(row: number): string {\n return this.#next[row - 1] ?? \"\"\n }\n\n set(row: number, content: string): void {\n if (row < 1 || row > this.#next.length) return\n this.#next[row - 1] = content\n }\n\n clear(row: number): void {\n this.set(row, \"\")\n }\n\n overlay(row: number, col: number, content: string): void {\n if (row < 1 || row > this.#next.length) return\n const base = this.get(row)\n const start = Math.max(0, col - 1)\n const width = stringWidth(content)\n const prefix = sliceAnsi(base, 0, start)\n const pad = \" \".repeat(Math.max(0, start - stringWidth(prefix)))\n this.set(row, `${prefix}${pad}${content}${sliceAnsi(base, start + width)}`)\n }\n\n slice(\n row: number,\n from: number | undefined,\n to: number | undefined,\n width = this.terminal.cols\n ): LineSlice | undefined {\n if (row < 1 || row > this.#next.length) return\n return sliceLine(this.get(row), from, to, width)\n }\n\n highlight(\n row: number,\n from: number | undefined,\n to: number | undefined,\n ctx: RenderCtx\n ): LineSlice | undefined {\n const ret = this.slice(row, from, to, ctx.width)\n if (!ret) return\n const start = ret.from - 1\n const end = (ret.to ?? ctx.width + 1) - 1\n const text = sliceAnsi(ret.line, start, end)\n const highlighted = ctx.style.selection(stripAnsiBg(text))\n this.set(row, `${sliceAnsi(ret.line, 0, start)}${highlighted}${sliceAnsi(ret.line, end)}`)\n return ret\n }\n\n queue(op: FrameOp): void {\n this.#ops.push(op)\n }\n\n commitBase(): void {\n for (let i = 0; i < this.#next.length; i++) this.base[i] = this.#next[i]\n }\n\n flush(): void {\n for (let i = 0; i < this.#next.length; i++) {\n const next = this.#next[i]\n if (this.current[i] === next) continue\n const row = i + 1\n this.queue((terminal) => {\n terminal.write(terminal.moveTo(row, 1) + terminal.clearLine() + next.trimEnd())\n })\n this.current[i] = next\n }\n }\n\n scrollUp(top: number, bottom: number, lines: number, op: FrameOp): void {\n if (lines <= 0 || top > bottom) return\n this.flush()\n this.queue(op)\n const from = Math.max(1, top)\n const to = Math.min(this.#next.length, bottom)\n const amount = Math.min(lines, to - from + 1)\n for (let i = from - 1; i < to; i++) {\n const source = i + amount\n const value = source < to ? (this.current[source] ?? \"\") : \"\"\n this.current[i] = value\n this.#next[i] = value\n }\n }\n\n scrollDown(top: number, bottom: number, lines: number, op: FrameOp): void {\n if (lines <= 0 || top > bottom) return\n this.flush()\n this.queue(op)\n const from = Math.max(1, top)\n const to = Math.min(this.#next.length, bottom)\n const amount = Math.min(lines, to - from + 1)\n for (let i = to - 1; i >= from - 1; i--) {\n const source = i - amount\n const value = source >= from - 1 ? (this.current[source] ?? \"\") : \"\"\n this.current[i] = value\n this.#next[i] = value\n }\n }\n\n paint(): { rows: number; ops: number } {\n const ops = this.#ops.length\n this.flush()\n const rows = this.#ops.length - ops\n for (const op of this.#ops) op(this.terminal)\n this.#ops.length = 0\n return { ops, rows }\n }\n}\n","import type { MountCtx } from \"../core/ctx.ts\"\nimport type { Node } from \"../core/node.ts\"\nimport type { RenderFrame } from \"./frame.ts\"\nimport type { Renderer, SurfaceType } from \"./renderer.ts\"\n\nimport { Emitter } from \"@zaly/shared\"\nimport { untrack } from \"../core/reactive.ts\"\n\n/**\n * Base event map for renderer surfaces. Surfaces usually schedule work\n * through their owning `Renderer`; subclasses may extend this with their\n * own surface-specific events.\n *\n * @internal\n */\nexport type SurfaceEvents = {}\n\nexport type Point = {\n row: number\n col: number\n}\n\n/**\n * Shared base for the three renderer surfaces (`Stream`, `UI`,\n * `OverlaySurface`). Owns the common lifecycle and paint bookkeeping:\n *\n * - `#running` flag and `#mountCtx` reference, driven by the Renderer\n * `start` / `stop` events. Subclasses read `mountCtx` to mount nodes\n * appended while the renderer is running.\n * - `#dirty`, set by `invalidate()`, means this surface has content or\n * state changes and schedules a frame.\n * Concrete surfaces override `mountAll` / `unmountAll` to walk whichever\n * node set they track, and `_render()` to compute rows and enqueue a paint\n * closure into the renderer's atomic terminal sync.\n *\n * @internal\n */\nexport abstract class Surface<E extends {} = never> extends Emitter<SurfaceEvents, E> {\n abstract readonly type: SurfaceType\n #running = false\n #mountCtx?: MountCtx\n #rendering?: Promise<void>\n $r: Renderer\n #dirty = false\n /** 1-based inclusive row bounds of this surface's content */\n abstract bounds: { top: number; bottom: number }\n\n constructor(renderer: Renderer) {\n super()\n this.$r = renderer\n .on(\"start\", () => {\n if (this.#running) return\n this.#running = true\n this.#mountCtx = this.$r.mountCtx(this.type)\n this.mountAll(this.#mountCtx)\n })\n .on(\"stop\", () => {\n if (!this.#running) return\n this.#running = false\n this.unmountAll()\n this.#mountCtx = undefined\n })\n }\n\n /** Check if this surface contains the given screen position */\n contains(point: Point): boolean {\n const { top, bottom } = this.bounds\n return point.row >= top && point.row <= bottom\n }\n\n get dirty(): boolean {\n return this.#dirty\n }\n\n track(ev: string, inc = 1): void {\n this.$r.stats.inc(ev, inc)\n }\n\n /** Mark this surface as changed and schedule a renderer frame. */\n invalidate = (): void => {\n this.#dirty = true\n this.track(`${this.type}.dirty`)\n untrack(() => void this.$r.emit(\"dirty\"))\n }\n\n /** `true` between `onStart()` and `onStop()`. Subclasses read this\n * to decide whether an append should mount immediately or wait. */\n protected get running(): boolean {\n return this.#running\n }\n\n /** The MountCtx handed in by the Renderer on `start()`. Undefined\n * when the surface isn't running. Subclasses read this to mount\n * nodes appended while the renderer is up. */\n protected get mountCtx(): MountCtx | undefined {\n return this.#mountCtx\n }\n\n /** Mount every node this surface currently tracks under `ctx`.\n * Called by `onStart` after `#running` flips on. */\n protected abstract mountAll(ctx: MountCtx): void\n\n /** Unmount every node this surface currently tracks. Called by\n * `onStop` before `#mountCtx` is cleared. */\n protected abstract unmountAll(): void\n\n /** Every node this surface currently tracks, for renderer traversals. */\n abstract get nodes(): readonly Node[]\n\n /** Paint the surface into the renderer frame. Direct callers (tests) may\n * omit a frame; in that case a one-off frame is created and flushed. */\n abstract _render(frame: RenderFrame): Promise<void>\n\n async render(frame?: RenderFrame): Promise<void> {\n const ownFrame = frame ?? this.$r.frame.begin()\n return (this.#rendering ??= (async () => {\n this.#dirty = false\n await this._render(ownFrame)\n if (frame === undefined) this.$r.terminal.sync(() => ownFrame.paint())\n })().finally(() => {\n this.#rendering = undefined\n }))\n }\n}\n","import type { MountCtx } from \"../core/ctx.ts\"\nimport type { Node } from \"../core/node.ts\"\nimport type { Overlay } from \"../widgets/overlay.ts\"\nimport type { RenderFrame } from \"./frame.ts\"\nimport type { Point } from \"./surface.ts\"\n\nimport { stringWidth } from \"@zaly/shared/ansi\"\nimport { createNode, withOwner } from \"../core/reactive.ts\"\nimport { Surface } from \"./surface.ts\"\n\nexport type OverlayRenderState = {\n x: number\n y: number\n width: number\n height: number\n zIndex: number\n node: Overlay\n}\n\nexport type OverlaySurfaceEvents = {\n \"render-node\": OverlayRenderState\n}\n\n/**\n * Overlay surface — paints absolute-positioned `Overlay` nodes on top\n * of the stream and UI surfaces after each tick.\n *\n * Open/close is explicit. While an overlay is open, mutations on its\n * state (or its subtree) bubble through `invalidate` → this surface's\n * `dirty` → Renderer's scheduler, same as the other surfaces. On\n * close, the covered area is overdrawn by asking the stream and UI\n * to invalidate so the next flush repaints them in full.\n *\n * v1 is intentionally minimal:\n * - Overlays are painted top-to-bottom in z-order on every flush; we\n * don't track per-overlay dirty flags, just paint all active ones.\n * - No clipping against the viewport — callers are responsible for\n * sizing / positioning sensibly. The stream lives inside DECSTBM,\n * so overlays that touch row 0 can disrupt scrollback.\n */\nexport class OverlaySurface extends Surface<OverlaySurfaceEvents> {\n readonly type = \"overlay\"\n readonly #overlays: Overlay[] = []\n /** Cached render state for each active overlay, in z-order (low -> high). */\n #state: OverlayRenderState[] = []\n\n get state(): readonly OverlayRenderState[] {\n return [...this.#state]\n }\n\n get bounds(): { top: number; bottom: number } {\n return { bottom: this.$r.terminal.rows, top: 1 }\n }\n\n override get dirty(): boolean {\n return this.active.length > 0 || super.dirty\n }\n\n /** Active overlays in paint order (low → high z-index). */\n get active(): readonly Overlay[] {\n return this.#overlays.filter((o) => o.visible && o.ctx !== undefined)\n }\n\n /** Return the topmost overlay at the given `(row, col)`, if any. */\n at({ row, col }: Point): OverlayRenderState | undefined {\n return this.#state.findLast((s) => {\n if (row < s.y || row >= s.y + s.height) return false\n if (col < s.x || col >= s.x + s.width) return false\n return true\n })\n }\n\n override contains(point: Point): boolean {\n return this.at(point) !== undefined\n }\n\n /** Register an overlay with the surface. Function form runs `fn`\n * inside a fresh Owner scope and adopts the returned Overlay. */\n add<O extends Overlay>(overlay: () => O): O {\n const resolved = withOwner(this.$r.rootOwner, () => createNode(overlay))\n if (this.#overlays.includes(resolved)) return resolved\n this.#overlays.push(resolved)\n this.#overlays.sort((a, b) => (a.state.zIndex ?? 0) - (b.state.zIndex ?? 0))\n resolved.on(\"invalidate\", this.invalidate)\n resolved.on(\"unmount\", () => this.remove(resolved))\n const ctx = this.mountCtx\n if (this.running && ctx) resolved.mount(ctx)\n if (resolved.visible) this.invalidate()\n return resolved\n }\n\n remove(overlay: Overlay): this {\n const i = this.#overlays.indexOf(overlay)\n if (i === -1) return this\n this.#overlays.splice(i, 1)\n void overlay.emit(\"close\")\n if (overlay.mounted) overlay.unmount()\n overlay.off(\"invalidate\", this.invalidate)\n this.invalidate()\n return this\n }\n\n open<T extends Overlay = Overlay>(overlay: () => T): T {\n return this.add(overlay).show()\n }\n\n close(overlay: Overlay): this {\n overlay.hide()\n this.remove(overlay)\n return this\n }\n\n /** Every currently-open overlay node, for renderer traversals. */\n get nodes(): readonly Node[] {\n return this.#overlays\n }\n\n protected mountAll(ctx: MountCtx): void {\n for (const o of this.#overlays) if (!o.mounted) o.mount(ctx)\n }\n\n protected unmountAll(): void {\n // Active set is preserved so a subsequent `onStart()` remounts the\n // same stack in z-order.\n for (const o of this.#overlays) if (o.mounted) o.unmount()\n }\n\n /**\n * Render pass: compute rows for each active overlay, then paint them\n * at their absolute `(y, x)` inside the outer sync block. Matches the\n * `render(sync?)` shape used by Stream and UI so the Renderer can\n * capture all three paints and emit them in one atomic frame.\n */\n async _render(frame: RenderFrame): Promise<void> {\n const painted: { x: number; y: number; rows: string[] }[] = []\n const ctx = this.$r.ctx\n this.#state = await Promise.all(\n this.active.map(async (node) => {\n // Width and height are honoured by the box layout itself\n // (`width: \"fit\" | number` and the `height` + `verticalAlign`\n // pair on `BoxStyle`). We pass ctx unchanged and trust the\n // overlay's own state to size correctly.\n const rows = await node.render(ctx)\n const height = rows.length\n const width = Math.max(...rows.map((r) => stringWidth(r)))\n\n let x = node.state.x\n let y = node.state.y\n if (x < 1 && x > 0) x = Math.floor(this.$r.terminal.cols * x)\n if (x < 0) x = this.$r.terminal.cols + x // Allow negative x to position relative to right edge\n\n let refY = 1\n let refHeight = this.$r.terminal.rows\n\n if (node.state.relative === \"ui\") {\n refHeight = this.$r.ui.height\n refY = this.$r.terminal.footerTop\n } else if (node.state.relative === \"stream\") {\n refHeight = this.$r.stream.liveHeight\n }\n\n if (y < 1 && y > 0) y = Math.floor(refHeight * y)\n\n const anchorY = y < 0 ? refY + refHeight + y : refY + y - 1\n\n const va = node.state.verticalAnchor ?? \"top\"\n if (va === \"bottom\") y = anchorY - height + 1\n else if (va === \"center\") y = anchorY - Math.floor(height / 2)\n else y = anchorY\n\n const ha = node.state.horizontalAnchor ?? \"left\"\n if (ha === \"right\") x = x - width + 1\n else if (ha === \"center\") x -= Math.floor(width / 2)\n\n painted.push({ rows, x, y })\n const s: OverlayRenderState = { height, node, width, x, y, zIndex: node.state.zIndex ?? 0 }\n void this.emit(\"render-node\", s)\n return s\n })\n )\n for (const { rows, x, y } of painted) {\n for (let r = 0; r < rows.length; r++) frame.overlay(y + r, x, rows[r])\n }\n }\n}\n","import type { RenderCtx } from \"../core/ctx.ts\"\nimport type { MouseEvent } from \"../input/decoder.ts\"\nimport type { LineSlice, RenderFrame } from \"./frame.ts\"\nimport type { Renderer } from \"./renderer.ts\"\nimport type { Point } from \"./surface.ts\"\n\nimport { Emitter } from \"@zaly/shared\"\nimport { sliceAnsi, stripAnsi } from \"@zaly/shared/ansi\"\nimport { isDeepStrictEqual } from \"node:util\"\nimport { untrack } from \"../core/reactive.ts\"\n\nexport type SelectionSurface = \"stream\" | \"screen\"\n\nexport type Selection = {\n dragging: boolean\n from: Point\n surface: SelectionSurface\n to: Point\n}\n\ntype HitPoint = {\n screen: Point\n stream?: Point\n}\n\nexport type SelectionEvents = {\n change: { selection?: Selection; prev?: Selection }\n selection: { text: string; selection: Selection }\n}\n\nexport class SelectionLayer extends Emitter<SelectionEvents> {\n #selection: Selection | undefined\n #text = \"\"\n #dirty = false\n #emitted?: Selection\n $r: Renderer\n\n constructor(renderer: Renderer) {\n super()\n this.$r = renderer\n }\n\n get selection(): Selection | undefined {\n return this.#selection\n }\n\n set selection(value: Selection | undefined) {\n const prev = this.#selection\n if (isDeepStrictEqual(prev, value)) return\n this.#selection = value\n this.#dirty = true\n this.#emitted = undefined\n if (!value) {\n this.#text = \"\"\n this.#dirty = false\n }\n this.invalidate()\n void this.emit(\"change\", { prev, selection: value })\n }\n\n get text(): string | undefined {\n return this.#selection ? this.#text : undefined\n }\n\n set text(value: string) {\n if (this.#text === value && !this.#dirty) return\n this.#text = value\n const selection = this.#selection\n if (!selection || selection.dragging || this.#emitted === selection) return\n this.#dirty = false\n setImmediate(() => {\n if (selection !== this.#selection || value !== this.#text) return\n this.#emitted = selection\n void this.emit(\"selection\", { selection, text: value })\n })\n }\n\n invalidate(): void {\n this.$r.overlay.invalidate()\n untrack(() => void this.$r.emit(\"dirty\"))\n }\n\n mouse(event: MouseEvent): boolean {\n if (event.kind === \"scroll\") return false\n if (event.button !== \"left\") return false\n\n const point = this.#hit(event)\n if (event.kind === \"down\") {\n if (event.click === 2) {\n this.select(point.screen, \"word\")\n return true\n }\n if (event.click === 3) {\n this.select(point.screen, \"line\")\n return true\n }\n this.selection = point.stream\n ? { dragging: true, from: point.stream, surface: \"stream\", to: point.stream }\n : { dragging: true, from: point.screen, surface: \"screen\", to: point.screen }\n return true\n }\n\n const selection = this.#selection\n if (!selection?.dragging) return false\n\n if (event.kind === \"drag\") {\n this.selection = this.#update(selection, point, true)\n return true\n }\n\n const next = this.#update(selection, point, false)\n this.selection = samePoint(next.from, next.to) ? undefined : next\n return true\n }\n\n clear(): void {\n if (!this.#selection) return\n this.selection = undefined\n }\n\n select(screen: Point, what: \"line\" | \"word\"): void {\n const point = this.#hitPoint(screen)\n const line = this.$r.frame.slice(screen.row, 1, undefined)\n if (!line) return\n const slice = what === \"line\" ? lineRange(line.line) : wordRange(line.line, screen.col)\n if (!slice) return\n const row = point.stream?.row ?? screen.row\n this.selection = {\n dragging: false,\n from: { col: slice.from, row },\n surface: point.stream ? \"stream\" : \"screen\",\n to: { col: slice.to, row },\n }\n }\n\n renderStream(frame: RenderFrame, ctx: RenderCtx): void {\n if (this.#selection?.surface === \"stream\") this.render(frame, ctx)\n }\n\n renderScreen(frame: RenderFrame, ctx: RenderCtx): void {\n if (this.#selection?.surface === \"screen\") this.render(frame, ctx)\n }\n\n render(frame: RenderFrame, ctx: RenderCtx): void {\n const selection = this.#selection\n if (!selection) return\n\n const from = this.#toScreen(selection.surface, selection.from)\n const to = this.#toScreen(selection.surface, selection.to)\n const start = before(from, to) ? from : to\n const end = start === from ? to : from\n const bounds = selection.surface === \"stream\" ? this.$r.stream.bounds : undefined\n const highlighted = renderRange({ bounds, ctx, end, frame, start })\n this.text = normalizeText(\n selection.surface === \"stream\" ? this.#streamSlices(start, end, bounds!) : highlighted\n )\n }\n\n #hit(event: MouseEvent): HitPoint {\n return this.#hitPoint({ col: event.x, row: event.y })\n }\n\n #hitPoint(screen: Point): HitPoint {\n if (this.$r.overlay.contains(screen)) return { screen }\n if (this.$r.ui.contains(screen)) return { screen }\n const stream = this.$r.stream.contains(screen) ? this.$r.stream.fromScreen(screen) : undefined\n return { screen, stream }\n }\n\n #update(selection: Selection, point: HitPoint, dragging: boolean): Selection {\n if (selection.surface === \"stream\" && point.stream)\n return { ...selection, dragging, to: point.stream }\n\n const from =\n selection.surface === \"stream\" ? this.$r.stream.toScreen(selection.from)! : selection.from\n return { dragging, from, surface: \"screen\", to: point.screen }\n }\n\n #toScreen(surface: SelectionSurface, point: Point): Point {\n return surface === \"stream\" ? this.$r.stream.toScreen(point)! : point\n }\n\n #streamSlices(start: Point, end: Point, bounds: { top: number; bottom: number }): LineSlice[] {\n const ret: LineSlice[] = []\n const firstRow = Math.max(start.row, bounds.top)\n const lastRow = Math.min(end.row, bounds.bottom)\n if (lastRow < firstRow) return ret\n\n for (let row = firstRow; row <= lastRow; row++) {\n const streamPoint = this.$r.stream.fromScreen({ col: 1, row })\n if (!streamPoint) continue\n const line = this.$r.stream.getRow(streamPoint.row)\n if (line === undefined) continue\n ret.push({\n from: row === start.row ? start.col : 1,\n line,\n to: row === end.row ? end.col : undefined,\n })\n }\n return ret\n }\n}\n\ntype Range = { from: number; to: number }\n\nconst WORD = /^[\\w\\-/\\\\@]$/\n\nfunction lineRange(line: string): Range | undefined {\n const text = stripAnsi(line)\n const start = text.search(/\\S/)\n if (start === -1) return\n let end = text.length\n while (end > start && /\\s/.test(text[end - 1]!)) end--\n return { from: start + 1, to: end + 1 }\n}\n\nfunction wordRange(line: string, col: number): Range | undefined {\n const text = stripAnsi(line)\n const index = col - 1\n if (index < 0 || index >= text.length) return\n const match = charClass(text[index]!)\n let start = index\n while (start > 0 && charClass(text[start - 1]!) === match) start--\n let end = index + 1\n while (end < text.length && charClass(text[end]!) === match) end++\n return { from: start + 1, to: end + 1 }\n}\n\nfunction charClass(char: string): \"space\" | \"word\" | \"punct\" {\n if (/\\s/.test(char)) return \"space\"\n if (WORD.test(char)) return \"word\"\n return \"punct\"\n}\n\nfunction samePoint(a: Point, b: Point): boolean {\n return a.row === b.row && a.col === b.col\n}\n\nfunction before(a: Point, b: Point): boolean {\n return a.row < b.row || (a.row === b.row && a.col <= b.col)\n}\n\nfunction normalizeText(slices: LineSlice[]): string {\n const lines = slices.map((slice) => {\n const full = stripAnsi(slice.line).trimEnd()\n const text = stripAnsi(\n sliceAnsi(slice.line, slice.from - 1, slice.to ? slice.to - 1 : undefined)\n ).trimEnd()\n return { from: slice.from, full, text }\n })\n const indent = commonIndent(lines.map((line) => line.full))\n return lines.map((line) => stripIndent(line.text, line.from, indent)).join(\"\\n\")\n}\n\nfunction commonIndent(lines: string[]): number {\n const nonEmpty = lines.filter((line) => line.trim() !== \"\")\n if (nonEmpty.length === 0) return 0\n return Math.min(...nonEmpty.map((line) => line.match(/^[ \\t]*/)?.[0].length ?? 0))\n}\n\nfunction stripIndent(line: string, from: number, indent: number): string {\n if (indent === 0 || line.trim() === \"\") return line\n const visibleBeforeSelection = from - 1\n const remove = Math.max(0, indent - visibleBeforeSelection)\n return remove === 0 ? line : line.slice(remove)\n}\n\nfunction renderRange({\n bounds,\n ctx,\n end,\n frame,\n start,\n}: {\n bounds?: { top: number; bottom: number }\n ctx: RenderCtx\n end: Point\n frame: RenderFrame\n start: Point\n}): LineSlice[] {\n const lines: LineSlice[] = []\n const firstRow = bounds ? Math.max(start.row, bounds.top) : start.row\n const lastRow = bounds ? Math.min(end.row, bounds.bottom) : end.row\n if (lastRow < firstRow) return lines\n\n if (firstRow === lastRow) {\n const from = firstRow === start.row ? start.col : 1\n const to = firstRow === end.row ? end.col : undefined\n const text = frame.highlight(firstRow, from, to, ctx)\n if (text !== undefined) lines.push(text)\n return lines\n }\n\n const first = frame.highlight(firstRow, firstRow === start.row ? start.col : 1, undefined, ctx)\n if (first !== undefined) lines.push(first)\n for (let row = firstRow + 1; row < lastRow; row++) {\n const text = frame.highlight(row, 1, undefined, ctx)\n if (text !== undefined) lines.push(text)\n }\n const last = frame.highlight(lastRow, 1, lastRow === end.row ? end.col : undefined, ctx)\n if (last !== undefined) lines.push(last)\n return lines\n}\n","import type { MountCtx } from \"../core/ctx.ts\"\nimport type { Node } from \"../core/node.ts\"\nimport type { SuspenseBoundary } from \"../core/reactive.ts\"\nimport type { RenderFrame } from \"./frame.ts\"\nimport type { Renderer } from \"./renderer.ts\"\nimport type { Point } from \"./surface.ts\"\nimport type { Terminal } from \"./terminal.ts\"\n\nimport { throttle } from \"@zaly/shared/throttle\"\nimport {\n createNode,\n createSuspenseBoundary,\n provideContext,\n SuspenseContext,\n withOwner,\n} from \"../core/reactive.ts\"\nimport { bumpPlacements as bumpKittyPlacements } from \"../image/kitty.ts\"\nimport { Surface } from \"./surface.ts\"\n\nexport type StreamEvents = {\n idle: void\n scroll: { offset: number; total: number; below: number }\n}\n\ntype StreamSnapshot = {\n bottom: number\n deleteVirtualPlacements?: () => string\n historyLength: number\n rows: string[]\n scrollTop: number\n top: number\n virtual: boolean\n visible: string[]\n}\n\ntype StreamRenderPlan = {\n commit: string[]\n frame: RenderFrame\n next: StreamSnapshot\n old: StreamSnapshot\n}\n\ntype RenderState = {\n /** Rows from this state that have already entered terminal scrollback.\n * Scrollback is immutable, so later renders may only replace rows after\n * this committed prefix. */\n commit: number\n dirty: boolean\n live: boolean\n node: Node\n /** Per-state Suspense boundary. Installed at `append` time inside\n * the appended subtree's Owner scope, so descendant `createAsync`\n * calls find it via `useContext(SuspenseContext)`. Passed to\n * `createRender` on each render pass — its drain loop awaits\n * `whenIdle()` so rows promoted to scrollback reflect resolved\n * async values. */\n boundary: SuspenseBoundary\n /** Undefined until the first render pass populates it. */\n rows?: string[]\n freeze: () => void\n}\n\nexport type StreamOptions = {\n maxLive: number\n /** Baseline (\"steady state\") footer height in rows. The commit-to-\n * scrollback threshold uses `terminal.rows - fixedFooterHeight`\n * instead of `terminal.rows`. With this set to the natural footer\n * size (e.g. 2 for an input bar), scrollback is exactly contiguous\n * with the visible region in steady state — no rows hidden behind\n * the footer. Footer growth past this size (autocomplete) still\n * hides rows temporarily; they reappear when the footer returns\n * to baseline.\n *\n * Default `0`: commit at full `terminal.rows` (old behavior).\n */\n fixedFooterHeight: number\n}\n\n/**\n * Stream surface — append-only list of nodes that render into the bottom\n * of the terminal's scroll region and commit to scrollback as newer\n * content arrives.\n *\n * We keep previously-appended nodes in `#state` as long as any of their\n * rows are still on-screen, so `rows` (the getter) can report the full\n * visible slice, and so the overlay surface can reconstruct what was\n * underneath it. Only the current tail is `live` — committed nodes are\n * frozen.\n *\n * Scrollback commits happen via `\\n` at `scrollBottom`: the only\n * guaranteed-portable way to move a row into scrollback (xterm.js and\n * ghostty-web's WASM parser both ignore `CSI S` for scrollback\n * promotion). So growth of the stream always flows through the bottom\n * row with a `\\n`-prefix write per new row.\n */\nfunction findFrozenPrefixEnd(rendered: string[], frozen: string[]): number {\n if (frozen.length === 0) return 0\n for (let start = 0; start <= rendered.length - frozen.length; start++) {\n let match = true\n for (let i = 0; i < frozen.length; i++) {\n if (rendered[start + i] !== frozen[i]) {\n match = false\n break\n }\n }\n if (match) return start + frozen.length\n }\n return frozen.length\n}\n\nconst SCROLL_DURATION = 120\n\nexport class Stream extends Surface<StreamEvents> {\n readonly type = \"stream\"\n #state: RenderState[] = []\n #snapshot: StreamSnapshot = {\n bottom: 0,\n historyLength: 0,\n rows: [],\n scrollTop: 0,\n top: 1,\n virtual: false,\n visible: [],\n }\n #opts: StreamOptions\n #scrollback: string[] = []\n /** 0 = follow live bottom; otherwise 1-based top row inside history. */\n #scrollTop = 0\n #scrollAnim?: { cancel: () => void }\n\n constructor(renderer: Renderer, opts: Partial<StreamOptions> = {}) {\n super(renderer)\n this.#opts = {\n fixedFooterHeight: opts.fixedFooterHeight ?? 0,\n maxLive: opts.maxLive ?? 3,\n }\n this.emitScroll = throttle(this.emitScroll.bind(this), 1000 / 60)\n }\n\n get bounds(): { top: number; bottom: number } {\n return { bottom: this.terminal.scrollBottom, top: 1 }\n }\n\n get terminal(): Terminal {\n return this.$r.terminal\n }\n\n /**\n * Append `node` as the new live tail. The previous tail is frozen —\n * it stops receiving re-renders even if its state mutates.\n *\n * Function form: `append(() => node)` runs the function inside a\n * fresh Owner scope (so `signal` / `effect` / `onCleanup` /\n * `provideContext` inside `fn` attach to that scope) and appends the\n * returned Node. The Owner disposes when the Node unmounts.\n */\n append<N extends Node>(node: () => N): N {\n // Each appended subtree gets its own Suspense boundary so\n // `createRender` (called per state during render) can drain\n // pending `createAsync` work before its rows commit to scrollback.\n // The boundary is provided inside the new Owner scope so\n // descendants find it via `useContext(SuspenseContext)`.\n const boundary = createSuspenseBoundary()\n const resolved = withOwner(this.$r.rootOwner, () =>\n createNode(() => {\n provideContext(SuspenseContext, boundary)\n return node()\n })\n )\n\n const invalidate = () => {\n state.dirty = true\n this.invalidate()\n }\n\n const state = {\n boundary,\n commit: 0,\n dirty: true,\n freeze: () => {\n if (state.node.mounted) state.node.unmount()\n state.node.off(\"invalidate\", invalidate)\n },\n get live() {\n return this.boundary.active() || this.dirty || !!this.node.state.sticky\n },\n node: resolved,\n }\n\n this.#state.push(state)\n const ctx = this.mountCtx\n if (this.running && ctx) resolved.mount(ctx)\n\n resolved.on(\"invalidate\", invalidate)\n\n this.invalidate()\n return resolved\n }\n\n /** How many rows the live region may occupy. */\n get liveHeight(): number {\n return this.terminal.scrollBottom\n }\n\n /** Tracked nodes (oldest first). Used by renderer traversals. */\n get nodes(): readonly Node[] {\n return this.#state.map((s) => s.node)\n }\n\n async waitIdle(): Promise<void> {\n if (!this.pending) return\n await new Promise((resolve) => this.once(\"idle\", resolve))\n }\n\n /**\n * Rows currently painted in the live region, top-to-bottom. Bottom\n * of the returned array aligns with `terminal.scrollBottom`. Exposed\n * so the overlay surface can restore what it drew over.\n */\n get rows(): readonly string[] {\n return this.#snapshot.visible\n }\n\n getRow(row: number): string | undefined {\n return this.#snapshot.rows[row - 1]\n }\n\n fromScreen(point: Point): Point | undefined {\n const { top, visible, scrollTop } = this.#snapshot\n if (point.row < top || point.row >= top + visible.length) return\n return { col: point.col, row: scrollTop + point.row - top }\n }\n\n toScreen(point: Point): Point | undefined {\n const { top, scrollTop } = this.#snapshot\n const offset = point.row - scrollTop\n return { col: point.col, row: top + offset }\n }\n\n get #historyLength(): number {\n return this.#snapshot.historyLength\n }\n\n emitScroll(): void {\n setImmediate(() => {\n void this.emit(\"scroll\", {\n below:\n this.#scrollTop === 0 ? 0 : this.#historyLength - this.#scrollTop - this.liveHeight + 1,\n offset: this.#scrollTop === 0 ? this.#historyLength : this.#scrollTop,\n total: this.#historyLength,\n })\n })\n }\n\n scroll(lines = 0.5): Promise<void> {\n const amount = Math.trunc(Math.abs(lines) < 1 ? lines * this.liveHeight : lines)\n if (amount === 0) return Promise.resolve()\n\n const total = this.#historyLength\n const maxTop = Math.max(1, total - this.liveHeight + 1)\n const current = this.#scrollTop === 0 ? maxTop : this.#scrollTop\n const target = Math.max(1, Math.min(maxTop, current + amount))\n if (target === current) return Promise.resolve()\n\n this.#scrollAnim?.cancel()\n\n const ret = Promise.withResolvers<void>()\n\n const delta = Math.abs(target - current)\n const dir = Math.sign(target - current)\n const stepTime = Math.max(8, Math.min(16, SCROLL_DURATION / delta))\n const stepAmount = Math.max(1, Math.ceil(delta / Math.ceil(SCROLL_DURATION / stepTime)))\n\n const tick = () => {\n const lastTop = Math.max(1, this.#historyLength - this.liveHeight + 1)\n const top = this.#scrollTop === 0 ? lastTop : this.#scrollTop\n const remaining = Math.abs(target - top)\n if (remaining === 0) {\n this.#scrollTop = target >= lastTop ? 0 : target\n this.emitScroll()\n ret.resolve()\n this.#scrollAnim = undefined\n return\n }\n\n const step = Math.min(stepAmount, remaining)\n const next = top + dir * step\n this.#scrollTop = next >= lastTop ? 0 : next\n this.emitScroll()\n this.invalidate()\n\n const t = setTimeout(tick, stepTime)\n t.unref()\n this.#scrollAnim = {\n cancel: () => {\n clearTimeout(t)\n ret.resolve()\n this.#scrollAnim = undefined\n },\n }\n }\n\n tick()\n return ret.promise\n }\n\n async scrollBottom(): Promise<void> {\n if (this.#scrollTop === 0) return\n await this.scroll(Math.max(1, this.#historyLength - this.liveHeight + 1))\n if (this.#scrollTop === 0) return // Already at target\n if (this.#scrollAnim) return // Another scroll started during the scroll-bottom animation; don't override it with a hard jump\n this.#scrollTop = 0\n this.emitScroll()\n this.invalidate()\n }\n\n scrollTop(): Promise<void> {\n return this.scroll(-this.#historyLength + 1)\n }\n\n scrollUp(lines = 0.5): Promise<void> {\n return this.scroll(-lines)\n }\n\n scrollDown(lines = 0.5): Promise<void> {\n return this.scroll(lines)\n }\n\n async #render(): Promise<{ commitLimit: number; rows: string[] }> {\n const ctx = this.$r.ctx\n\n // Render tracked nodes. Node.render() owns cache invalidation, so clean\n // nodes return cached rows immediately; Stream only preserves the\n // previous row count when a node shrinks so stale terminal rows clear.\n await Promise.all(\n this.#state.map(async (s) => {\n const prev = s.rows ?? []\n const len = prev.length\n const frozen = prev.slice(0, s.commit)\n s.dirty = false\n const rendered = await s.node.render(ctx)\n const mutableStart = s.commit === 0 ? 0 : findFrozenPrefixEnd(rendered, frozen)\n s.rows = [...frozen, ...rendered.slice(mutableStart)]\n if (s.rows.length < len) s.rows.push(...Array(len - s.rows.length).fill(\"\"))\n })\n )\n\n // Let promise callbacks scheduled by createAsync during render run before\n // deciding what can enter scrollback. If a resource resolved immediately,\n // its setValue() invalidates the node here, keeping this state live for\n // one more frame instead of committing initial/fallback rows.\n await Promise.resolve()\n\n // Push sticky nodes to the end so they paint last and end up at the bottom\n const states: RenderState[] = []\n const sticky: RenderState[] = []\n for (const s of this.#state) {\n if (s.node.state.sticky) sticky.push(s)\n else states.push(s)\n }\n states.push(...sticky)\n this.#state = [...states]\n\n const rows: string[] = []\n let commitLimit: number | undefined\n for (const s of this.#state) {\n if (commitLimit === undefined && s.live) commitLimit = rows.length\n if (s.rows) rows.push(...s.rows)\n }\n return { commitLimit: commitLimit ?? rows.length, rows }\n }\n\n async _render(frame: RenderFrame): Promise<void> {\n const { commitLimit, rows: allRows } = await this.#render()\n const old = this.#snapshot\n const liveHeight = this.liveHeight\n const committed = this.#committedRows()\n\n // Commit threshold = the *full terminal minus the baseline footer\n // height*. Steady state (footer == fixedFooterHeight) keeps\n // scrollback exactly contiguous with the visible region — no\n // hidden rows. Footer growth above baseline (autocomplete) still\n // hides rows temporarily but they're recoverable when the footer\n // shrinks back. `fixedFooterHeight = 0` reduces to \"commit at the\n // full terminal\" (old behavior).\n const commitThreshold = Math.max(1, this.terminal.rows - this.#opts.fixedFooterHeight)\n const liveStart = Math.min(commitLimit, Math.max(committed, allRows.length - commitThreshold))\n const commit = allRows.slice(committed, liveStart)\n this.#scrollback.push(...commit)\n const liveRows = allRows.slice(liveStart)\n const historyLength = this.#scrollback.length + liveRows.length\n const maxTop = Math.max(1, historyLength - liveHeight + 1)\n if (this.#scrollTop > maxTop) this.#scrollTop = 0\n\n // Bottom-anchored slice of (post-commit) addressable: the rows\n // that actually paint in the scroll region.\n let newVisible = liveRows.slice(-liveHeight)\n const historyChanged = this.#historyLength !== historyLength\n\n let deleteImages: (() => string) | undefined\n\n if (this.#scrollTop > 0) {\n if (historyChanged) this.emitScroll()\n const start = this.#scrollTop - 1\n const sbl = this.#scrollback.length\n // Slice starts in the live region\n if (start >= sbl) newVisible = liveRows.slice(start - sbl, start - sbl + liveHeight)\n else {\n // Slice overlaps with scrollback\n newVisible = this.#scrollback.slice(start, start + liveHeight)\n if (newVisible.length < liveHeight)\n newVisible.push(...liveRows.slice(0, liveHeight - newVisible.length))\n }\n }\n\n // Relocate kitty placements for virtual scrolling or alt-screen.\n if (this.#scrollTop > 0 || this.terminal.altScreen) {\n const kittyPlacements = bumpKittyPlacements(newVisible)\n if (kittyPlacements) {\n newVisible = kittyPlacements.rows\n deleteImages = kittyPlacements.delete\n }\n }\n\n const next: StreamSnapshot = {\n bottom: liveHeight,\n deleteVirtualPlacements: deleteImages,\n historyLength,\n rows: [...this.#scrollback, ...liveRows],\n scrollTop: this.#scrollTop === 0 ? maxTop : this.#scrollTop,\n top: liveHeight - newVisible.length + 1,\n virtual: this.#scrollTop > 0,\n visible: newVisible,\n }\n\n const plan: StreamRenderPlan = {\n commit,\n frame,\n next,\n old,\n }\n\n this.#paint(plan)\n\n this.#snapshot = next\n this.#advanceCommits(commit.length)\n this.#dropCommittedStates()\n\n if (!this.pending) void this.emit(\"idle\")\n }\n\n #paint(plan: StreamRenderPlan): void {\n if (plan.old.deleteVirtualPlacements)\n plan.frame.queue((terminal) => terminal.write(plan.old.deleteVirtualPlacements!()))\n\n // In normal screen mode, committed rows are promoted to the terminal's\n // native scrollback. In alt-screen mode, zaly's internal #scrollback is\n // the only history, so there is nothing useful to promote.\n if (!this.terminal.altScreen) this.#commitToScrollback(plan)\n\n this.#clearAboveVisible(plan)\n this.#paintVirtualScroll(plan)\n this.#paintVisible(plan)\n }\n\n #commitToScrollback(plan: StreamRenderPlan): void {\n // Paint each batch of to-be-committed rows at the top of the scroll\n // region, then \\n them off. Batched because the scroll region only has\n // `liveHeight` rows.\n let i = 0\n while (i < plan.commit.length) {\n const batch = Math.min(plan.commit.length - i, plan.next.bottom)\n for (let j = 0; j < batch; j++) {\n const row = 1 + j\n const content = plan.commit[i + j]\n plan.frame.set(row, content)\n }\n plan.frame.scrollUp(1, plan.next.bottom, batch, (terminal) => {\n terminal.write(terminal.moveTo(plan.next.bottom, 1))\n for (let j = 0; j < batch; j++) terminal.write(\"\\n\")\n })\n i += batch\n }\n }\n\n #clearAboveVisible(plan: StreamRenderPlan): void {\n // Layout shifts and \\n commits can leave ghost content above the new\n // bottom-anchored stream paint area. Clear it explicitly.\n const clearTop =\n plan.old.bottom !== plan.next.bottom ? Math.max(1, Math.min(plan.old.top, plan.next.top)) : 1\n for (let r = clearTop; r < plan.next.top; r++) {\n if (r < 1 || r > plan.next.bottom) continue\n plan.frame.clear(r)\n }\n }\n\n #paintVirtualScroll(plan: StreamRenderPlan): void {\n if (plan.commit.length > 0) return\n if (!plan.old.virtual || !plan.next.virtual) return\n if (plan.old.bottom !== plan.next.bottom) return\n if (plan.old.visible.length !== plan.next.visible.length) return\n if (plan.next.visible.length === 0) return\n\n const delta = plan.next.scrollTop - plan.old.scrollTop\n const lines = Math.abs(delta)\n if (lines === 0 || lines >= plan.next.visible.length) return\n\n if (delta > 0) {\n plan.frame.scrollUp(1, plan.next.bottom, lines, (terminal) => {\n terminal.write(terminal.scrollUp(lines))\n })\n } else {\n plan.frame.scrollDown(1, plan.next.bottom, lines, (terminal) => {\n terminal.write(terminal.scrollDown(lines))\n })\n }\n }\n\n #paintVisible(plan: StreamRenderPlan): void {\n // Paint the visible region. In the steady streaming case this skips\n // every write except the last row.\n for (let k = 0; k < plan.next.visible.length; k++) {\n const row = plan.next.top + k\n plan.frame.set(row, plan.next.visible[k])\n }\n }\n\n #advanceCommits(commitCount: number): void {\n // Mark newly-promoted rows on their owning states. This keeps the\n // immutable scrollback boundary local to each retained node, so later\n // mutations above the boundary can't shift already-promoted rows and\n // make us write the same semantic row to scrollback again.\n let remaining = commitCount\n for (const s of this.#state) {\n if (remaining <= 0) break\n const len = s.rows?.length ?? 0\n const n = Math.min(remaining, Math.max(0, len - s.commit))\n s.commit += n\n remaining -= n\n }\n }\n\n #dropCommittedStates(): void {\n // Drop states whose rows have entirely entered scrollback. Their\n // committed rows leave `allRows` on the next tick; the global committed\n // count is derived from retained states, so no separate adjustment is\n // needed.\n while (this.#state.length > 0) {\n const first = this.#state[0]\n const len = first.rows?.length ?? 0\n if (first.live || first.commit < len) break\n this.#state.shift()\n first.freeze()\n }\n }\n\n #committedRows(): number {\n return this.#state.reduce((sum, s) => sum + s.commit, 0)\n }\n\n get pending() {\n return this.active\n }\n\n get active() {\n return this.#state.some((s) => s.boundary.active())\n }\n\n /**\n * Terminal was resized. Forget only the paint mirror that mapped stream\n * rows onto the old screen geometry. App scrollback and per-state commit\n * boundaries are preserved; retained nodes re-render at the new width\n * through Node.render()'s cache key.\n *\n * Paired with a screen-clear in the Renderer's resize handler — this\n * method only resets our mirror of what's on screen; the actual wipe\n * and re-establishment of DECSTBM lives in the terminal-level handler.\n */\n onResize(): void {\n this.resetPaint()\n }\n\n resetPaint(): void {\n this.#snapshot = {\n ...this.#snapshot,\n bottom: this.terminal.scrollBottom,\n rows: [],\n scrollTop: 0,\n top: 1,\n virtual: false,\n visible: [],\n }\n this.#scrollAnim?.cancel()\n this.invalidate()\n }\n\n reset(opts: { keepNodes?: boolean } = {}): void {\n this.resetPaint()\n this.#scrollback = []\n this.#snapshot.historyLength = 0\n this.#scrollTop = 0\n for (const s of this.#state) s.commit = 0\n if (!opts.keepNodes) {\n for (const s of this.#state) s.freeze()\n this.#state = []\n }\n }\n\n protected mountAll(ctx: MountCtx): void {\n for (const s of this.#state) if (!s.node.mounted) s.node.mount(ctx)\n }\n\n protected unmountAll(): void {\n // Tracked state (`#state`) is preserved so a subsequent `onStart()`\n // finds the same tree and remounts it.\n for (const s of this.#state) if (s.node.mounted) s.node.unmount()\n }\n}\n","/**\n * Terminal primitive — owns stdin raw mode, stdout writes, and the\n * standard set of control modes we flip for a direct-mode renderer:\n * hide cursor, DECAWM off, DECSTBM scroll region, synchronized output.\n *\n * No rendering logic lives here; upstream surfaces (stream, ui) push\n * escape sequences through the helpers exposed below.\n */\n\nimport { inspect } from \"node:util\"\n\nexport interface TerminalWriter {\n readonly columns: number\n readonly rows: number\n readonly isTTY?: boolean\n write: (s: string) => boolean | void\n}\n\nexport interface TerminalReader {\n readonly isTTY?: boolean\n setRawMode?: (mode: boolean) => void\n ref?: () => void\n unref?: () => void\n on: (event: string, listener: (...args: unknown[]) => void) => void\n off: (event: string, listener: (...args: unknown[]) => void) => void\n resume?: () => void\n pause?: () => void\n}\n\nexport type TerminalProgress = \"inactive\" | \"progress\" | \"loading\" | \"error\" | \"paused\"\ntype ProgressState = {\n type: TerminalProgress\n value?: number\n}\n// oxlint-disable-next-line sort-keys\nconst progressStates: Record<TerminalProgress, number> = {\n inactive: 0,\n progress: 1,\n error: 2,\n loading: 3,\n paused: 4,\n}\n\nexport interface TerminalOpts {\n stdin?: TerminalReader\n stdout?: TerminalWriter\n /** Rows reserved at the bottom for a sticky footer (UI surface). */\n reserveBottom?: number\n /** Register SIGINT/SIGTERM/process.exit handlers. Disable for tests. */\n hookSignals?: boolean\n /** Enable alternate screen buffer. */\n altScreen?: boolean\n /** Enable SGR mouse reporting. */\n mouse?: boolean\n}\n\ntype ResizeListener = (cols: number, rows: number) => void\n\n// ESC helpers — keeping as plain string constants so greps / docs line up.\nconst CSI = \"\\x1b[\"\nconst ST = \"\\x1b\\\\\"\n\n/** @internal */\nexport class Terminal {\n readonly #stdout: TerminalWriter\n readonly #stdin: TerminalReader | undefined\n readonly #altScreen: boolean\n readonly #hookSignals: boolean\n\n #started = false\n #reserveBottom: number\n #mouse = false\n #progress: ProgressState = { type: \"inactive\" }\n #progressInterval: ReturnType<typeof setInterval> | undefined\n #prevRawMode: boolean | undefined\n #resizeListeners = new Set<ResizeListener>()\n #signalCleanup: (() => void) | undefined\n #onResize = (): void => {\n // stdout.columns/rows update in place on SIGWINCH; re-emit.\n for (const l of this.#resizeListeners) l(this.cols, this.rows)\n }\n\n constructor(opts: TerminalOpts = {}) {\n this.#stdout = opts.stdout ?? (process.stdout as unknown as TerminalWriter)\n this.#stdin = opts.stdin ?? (process.stdin as unknown as TerminalReader)\n this.#reserveBottom = opts.reserveBottom ?? 0\n this.#altScreen = opts.altScreen ?? false\n this.#hookSignals = opts.hookSignals ?? true\n this.#mouse = opts.mouse ?? false\n }\n\n /** Current terminal columns (number of cells wide). */\n get cols(): number {\n return this.#stdout.columns || 80\n }\n\n /** Current terminal rows (number of cells tall). */\n get rows(): number {\n return this.#stdout.rows || 24\n }\n\n /** Rows reserved at the bottom for the footer. */\n get reserveBottom(): number {\n return this.#reserveBottom\n }\n\n /** Bottom row of the scroll region (1-based, inclusive). */\n get scrollBottom(): number {\n return Math.max(1, this.rows - this.#reserveBottom)\n }\n\n /** Top row of the footer (1-based, inclusive). 0 when no footer. */\n get footerTop(): number {\n return this.#reserveBottom > 0 ? this.rows - this.#reserveBottom + 1 : 0\n }\n\n get altScreen(): boolean {\n return this.#altScreen\n }\n\n get mouse(): boolean {\n return this.#mouse\n }\n\n set mouse(mouse: boolean) {\n if (this.#mouse === mouse) return\n this.#mouse = mouse\n if (!this.#started) return\n this.write(\n mouse ? `${CSI}?1002h${CSI}?1006h${CSI}?1007h` : `${CSI}?1007l${CSI}?1006l${CSI}?1002l`\n )\n }\n\n // ---------- lifecycle ----------\n\n /**\n * Install control-mode state: hide cursor, DECAWM off, DECSTBM scroll\n * region, stdin raw mode, SIGWINCH + SIGINT/SIGTERM hooks.\n */\n start(): void {\n if (this.#started) return\n this.#started = true\n this.#writeProgress(\"progress\", 0)\n this.#writeProgress(\"inactive\")\n\n if (this.#altScreen) this.write(`${CSI}?1049h`)\n\n // Cursor hidden, auto-wrap off, bracketed paste on, focus reporting on.\n // Bracketed paste (?2004) lets the decoder tell chunked pastes apart\n // from keystrokes so widgets don't run individual key handlers for\n // every character of a paste. Focus reporting (?1004) lets the\n // terminal tell us when our window gains/loses focus so we can\n // update cursor visibility, pause animations, etc.\n this.write(`${CSI}?25l${CSI}?7l${CSI}?2004h${CSI}?1004h`)\n if (this.#mouse) this.write(`${CSI}?1002h${CSI}?1006h${CSI}?1007h`)\n this.#writeProgress()\n // Scroll region set to [1, scrollBottom]. Terminals default to the\n // full viewport, so omitting `reserveBottom = 0` is a no-op.\n if (this.#reserveBottom > 0) this.setScrollRegion(1, this.scrollBottom)\n\n // stdin → raw mode for the input-routing layer that'll land next.\n // We deliberately do NOT call stdin.resume() here: nothing in the\n // renderer reads keystrokes yet, and keeping stdin in the flowing\n // state pins the Node/Bun event loop open so the process can't\n // exit naturally. The input module will resume() when it wires a\n // reader, and pause() when it unwires.\n if (this.#stdin?.isTTY && typeof this.#stdin.setRawMode === \"function\") {\n this.#prevRawMode = Boolean((this.#stdin as { isRaw?: boolean }).isRaw)\n this.#stdin.setRawMode(true)\n }\n\n // Resize listener.\n process.on(\"SIGWINCH\", this.#onResize)\n\n // Graceful shutdown.\n if (this.#hookSignals) {\n const bye = (): void => {\n this.stop()\n process.exit(0)\n }\n const onCrash = (err: unknown): void => {\n this.stop()\n const insp = process.versions.bun ? Bun.inspect : inspect\n process.stdout.write(\"\", () => {\n process.stdout.write(insp(err, { colors: true }))\n })\n }\n process.once(\"uncaughtException\", onCrash)\n process.once(\"SIGINT\", bye)\n process.once(\"SIGTERM\", bye)\n const onExit = (): void => this.stop()\n process.once(\"exit\", onExit)\n this.#signalCleanup = () => {\n process.off(\"SIGINT\", bye)\n process.off(\"SIGTERM\", bye)\n process.off(\"exit\", onExit)\n process.off(\"uncaughtException\", onCrash)\n }\n }\n }\n\n deleteImages(opts: { data?: boolean } = {}): void {\n if (!this.#started) return\n // Remove all Kitty images. KGP doesn't support selective deletion, so\n // this is the only way to avoid orphaned images when the renderer\n // crashes mid-paint.\n this.write(`\\x1b_Ga=d,d=${(opts.data ?? true) ? \"A\" : \"a\"},q=2\\x1b\\\\`)\n }\n\n /** Restore terminal modes, detach listeners. Idempotent. */\n stop(): void {\n if (!this.#started) return\n\n try {\n // Remove all Kitty images and taskbar/window progress state.\n this.deleteImages()\n this.setProgress()\n\n // Clear scroll region (if set), disable paste/focus reporting,\n // auto-wrap back on, cursor back on.\n if (this.#reserveBottom > 0) this.clearScrollRegion()\n // Wipe the visible viewport — covers both leftover footer rows\n // and any half-painted stream rows from an in-flight render that\n // was killed mid-paint (crash path). Scrollback is unaffected.\n this.write(\n `${CSI}?1007l${CSI}?1006l${CSI}?1002l${CSI}?1000l${CSI}?1004l${CSI}?2004l${CSI}?7h${CSI}?25h`\n )\n if (this.#altScreen) this.write(`${CSI}?1049l`)\n } finally {\n this.#started = false\n }\n\n if (this.#stdin?.isTTY && typeof this.#stdin.setRawMode === \"function\") {\n this.#stdin.setRawMode(this.#prevRawMode ?? false)\n // Belt-and-braces: pause stdin in case the input layer left it\n // flowing. Keeps the event loop free to exit.\n this.#stdin.pause?.()\n }\n\n process.off(\"SIGWINCH\", this.#onResize)\n this.#signalCleanup?.()\n this.#signalCleanup = undefined\n }\n\n /** Set terminal/window progress when supported (OSC 9;4).\n *\n * - omitted / `\"inactive\"`: clear progress\n * - `\"loading\"`: indeterminate progress\n * - `\"progress\"`: determinate progress percentage, clamped to `0..100`\n * - `\"error\"` / `\"paused\"`: terminal-specific error/paused states with optional percentage\n */\n setProgress(state: \"progress\", value: number): void\n setProgress(state: \"error\" | \"paused\", value?: number): void\n setProgress(state?: \"inactive\" | \"loading\"): void\n setProgress(state?: TerminalProgress, value?: number): void {\n state ??= \"inactive\"\n\n const resetError = () => {\n this.#writeProgress(\"progress\", 50)\n this.#writeProgress(\"loading\")\n }\n if (this.#progress.type === \"error\" && state !== \"error\") resetError()\n if (state === \"progress\") this.#progress = { type: \"progress\", value: value ?? 0 }\n else if (state === \"error\" || state === \"paused\")\n this.#progress = { type: state, value: value ?? this.#progress.value }\n else this.#progress = { type: state }\n this.#writeProgress()\n if (state === \"inactive\") {\n if (this.#progressInterval) clearInterval(this.#progressInterval)\n this.#progressInterval = undefined\n } else if (!this.#progressInterval) {\n this.#progressInterval = setInterval(() => this.#writeProgress(), 100)\n this.#progressInterval.unref()\n }\n }\n\n #writeProgress(state?: TerminalProgress, value?: number | false): void {\n if (!this.#started) return\n value ??=\n this.#progress.value === undefined\n ? undefined\n : Math.max(0, Math.min(100, Math.round(this.#progress.value)))\n const st = progressStates[state ?? this.#progress.type]\n const seq = `\\x1b]9;4;${st}${typeof value === \"number\" ? `;${value}` : \"\"}${ST}`\n this.write(seq)\n }\n\n /** Change the bottom reservation and re-apply the scroll region. */\n setReserveBottom(rows: number): void {\n const next = Math.max(0, Math.min(rows, this.rows - 1))\n if (next === this.#reserveBottom) return\n this.#reserveBottom = next\n if (!this.#started) return\n if (next > 0) this.setScrollRegion(1, this.scrollBottom)\n else this.clearScrollRegion()\n }\n\n // ---------- output helpers ----------\n\n /** Low-level write. Use escape helpers + this to emit sequences. */\n write(s: string): void {\n if (!this.#started) return\n this.#stdout.write(s)\n }\n\n #write(s: string): void {\n this.#stdout.write(s)\n }\n\n // ---------- side-channel transmit queue ----------\n //\n // Some terminal protocols separate \"register data\" from \"place at\n // cursor\" — Kitty Graphics Protocol (KGP) being the canonical\n // example: an image is transmitted once (`a=t`) and then placed\n // many times (`a=p,i=N`). The transmit bytes don't have to live\n // anywhere particular in the output stream — they just need to\n // arrive before any placement that references them.\n //\n // Routing transmit bytes through this queue (instead of inlining\n // them into rendered rows) lets the Node-level cache hold *pure\n // placement* rows: safe to cache, safe to re-splice, no stray\n // transmit ANSI surviving across paints. The renderer drains the\n // queue once per frame, before composing the frame body.\n\n readonly #pendingTransmits: string[] = []\n\n /** Queue a side-channel ANSI payload (KGP transmit, etc.) for the\n * next `flushTransmits()`. No-op for empty strings. */\n enqueueTransmit(seq: string): void {\n if (seq) this.#pendingTransmits.push(seq)\n }\n\n /** Drain the transmit queue. Called by the renderer at the start of\n * each paint, before frame composition. Idempotent when empty. */\n flushTransmits(): void {\n if (this.#pendingTransmits.length === 0) return\n this.#stdout.write(this.#pendingTransmits.join(\"\"))\n this.#pendingTransmits.length = 0\n }\n\n /** Absolute cursor move (1-based). */\n moveTo(row: number, col = 1): string {\n return `${CSI}${row};${col}H`\n }\n\n /** Erase the entire line the cursor is on. */\n clearLine(): string {\n return `${CSI}2K`\n }\n\n /** Clear from cursor to end of screen. */\n clearBelow(): string {\n return `${CSI}0J`\n }\n\n /** Scroll the scroll region up by `n` rows (SU). Top rows enter scrollback. */\n scrollUp(n: number): string {\n return n > 0 ? `${CSI}${n}S` : \"\"\n }\n\n /**\n * Scroll the scroll region down by `n` rows (SD). Top `n` rows become\n * blank, existing content shifts down, bottom `n` rows fall off the\n * region (they don't move to scrollback — scrollback is a top-side\n * concept; SD's displaced rows are simply lost).\n */\n scrollDown(n: number): string {\n return n > 0 ? `${CSI}${n}T` : \"\"\n }\n\n /** Delete `n` lines at the cursor, pulling content below upward (DL). */\n deleteLines(n: number): string {\n return n > 0 ? `${CSI}${n}M` : \"\"\n }\n\n /** Set the scroll region (DECSTBM), 1-based inclusive. */\n setScrollRegion(top: number, bottom: number): void {\n this.write(`${CSI}${top};${bottom}r`)\n }\n\n /** Reset to the full-viewport scroll region. */\n clearScrollRegion(): void {\n this.write(`${CSI}r`)\n }\n\n /**\n * Wrap a block of writes in begin/end-synchronized-update. Supporting\n * terminals buffer the enclosed bytes and paint atomically — eliminates\n * flicker on multi-row diff rewrites. Unsupported terminals ignore\n * both escapes, so there's no downside.\n */\n sync(fn: () => void): void {\n if (!this.#started) return\n this.write(`${CSI}?2026h`)\n try {\n fn()\n } finally {\n this.#write(`${CSI}?2026l`)\n }\n }\n\n // ---------- resize events ----------\n\n onResize(fn: ResizeListener): () => void {\n this.#resizeListeners.add(fn)\n return () => this.#resizeListeners.delete(fn)\n }\n}\n","import type { MountCtx } from \"../core/ctx.ts\"\nimport type { Node } from \"../core/node.ts\"\nimport type { Box } from \"../widgets/box.ts\"\nimport type { RenderFrame } from \"./frame.ts\"\nimport type { Renderer } from \"./renderer.ts\"\n\nimport { createNode, withOwner } from \"../core/reactive.ts\"\nimport { box } from \"../widgets/box.ts\"\nimport { Surface } from \"./surface.ts\"\n\n/**\n * UI surface — the sticky footer. Renders a single Box tree at the\n * bottom of the terminal, inside the rows reserved by `Terminal`'s\n * scroll region. Row-diff redraws: only changed rows are rewritten on\n * each flush, so an input widget re-rendering every keystroke doesn't\n * repaint the entire footer.\n *\n * Height is determined by the root's rendered row count, capped to a\n * sensible upper bound so a runaway render can't take over the screen.\n * When the height changes the terminal's reserved bottom gets updated,\n * which rewrites `DECSTBM`; the stream surface then has less/more room\n * and its next flush naturally fills the new geometry.\n */\nexport class UI extends Surface {\n readonly type = \"ui\"\n readonly #root: Box = box({ flexDirection: \"column\" })\n #rows: string[] = []\n\n constructor(renderer: Renderer) {\n super(renderer)\n // Root invalidates propagate to us via the parent chain (no parent\n // set above — the UI owns the root). Subscribe directly.\n this.#root.on(\"invalidate\", this.invalidate)\n }\n\n /** The footer's root Box. Add children via `ui.root.add(child)`. */\n get root(): Box {\n return this.#root\n }\n\n get terminal() {\n return this.$r.terminal\n }\n\n /** Shortcut: add a child to the footer root. Same semantics as\n * `ui.root.add(child)`; returns `this` for chaining.\n *\n * Function form: `add(() => box(…))` runs the function inside a\n * fresh Owner scope (so `signal` / `effect` / `onCleanup` /\n * `provideContext` inside `fn` attach to that scope) and adds the\n * returned Node. The Owner disposes when the Node unmounts. */\n add<N extends Node>(child: () => N): N {\n const ret = withOwner(this.$r.rootOwner, () => createNode(child))\n this.#root.add(ret)\n return ret\n }\n\n /** Current rendered height (rows). */\n get height(): number {\n return this.#rows.length\n }\n\n /**\n * The rows currently painted into the footer region, in order from the\n * top of the reserved area downward. Exposed so the overlay surface\n * can re-emit this content after it tears down, without re-rendering\n * the tree.\n */\n get rows(): readonly string[] {\n return this.#rows\n }\n\n /**\n * Render the footer tree and paint the diff against the last paint.\n * Updates the terminal's reservation whenever the height changes so\n * the scroll region stays correctly sized.\n *\n * When called from `Renderer.render()`, a capture-style `sync` is\n * provided so all surfaces paint inside one atomic sync frame. Direct\n * callers (tests) omit it and get an immediate `terminal.sync`.\n */\n async _render(frame: RenderFrame): Promise<void> {\n const ctx = this.$r.ctx\n const rendered = await this.#root.render({ ...ctx, width: this.terminal.cols })\n const visible = Math.max(0, this.terminal.rows - 1)\n const rows = rendered.length > visible ? rendered.slice(-visible) : rendered\n const prevHeight = this.#rows.length\n const nextHeight = rows.length\n\n // Resize the reserved bottom to match the new footer height.\n // Reissues DECSTBM — stream's next flush sees a different\n // `scrollBottom` and re-slices its virtual buffer to fit. Footer-grow no\n // longer commits stream rows to scrollback — they stay addressable, ready\n // to reappear when the footer shrinks back.\n if (nextHeight !== this.terminal.reserveBottom) {\n frame.flush()\n frame.queue((terminal) => terminal.setReserveBottom(nextHeight))\n this.$r.stream.invalidate()\n }\n\n const top = this.terminal.rows - nextHeight + 1\n const prevTop = this.terminal.rows - prevHeight + 1\n for (let row = prevTop; row < top; row++) frame.clear(row)\n for (let i = 0; i < nextHeight; i++) frame.set(top + i, rows[i])\n\n this.#rows = rows\n }\n\n /**\n * Terminal was resized. Drop the painted-rows mirror so the next\n * render's grow/shrink math treats the footer as if it's just\n * appearing — correct after a screen clear, when the terminal no\n * longer holds any footer bytes. The scroll region gets re-established\n * through the normal `setReserveBottom` path inside `render()`.\n */\n onResize(): void {\n this.#rows = []\n this.invalidate()\n }\n\n /** UI's tracked node set is just the footer root. */\n get nodes(): readonly Node[] {\n return [this.#root]\n }\n\n protected mountAll(ctx: MountCtx): void {\n if (!this.#root.mounted) this.#root.mount(ctx)\n }\n\n protected unmountAll(): void {\n if (this.#root.mounted) this.#root.unmount()\n }\n\n get bounds(): { top: number; bottom: number } {\n const top = this.terminal.footerTop || this.terminal.rows + 1\n return { bottom: this.terminal.rows, top }\n }\n}\n","import type { MountCtx, RenderCtx } from \"../core/ctx.ts\"\nimport type { Node } from \"../core/node.ts\"\nimport type { Owner, Reactive } from \"../core/reactive.ts\"\nimport type { ActionDef } from \"../input/actions.ts\"\nimport type { TuiReporterOpts } from \"../services/logger.ts\"\nimport type { Theme } from \"../themes/types.ts\"\nimport type { RenderFrame } from \"./frame.ts\"\nimport type { Surface } from \"./surface.ts\"\nimport type { TerminalReader, TerminalWriter } from \"./terminal.ts\"\n\nimport { Emitter } from \"@zaly/shared\"\nimport { stringWidth } from \"@zaly/shared/ansi\"\nimport { Logger } from \"@zaly/shared/logger\"\nimport { createCtx } from \"../core/ctx.ts\"\nimport {\n createRoot,\n memo,\n peek,\n provideContext,\n signal,\n untrack,\n unwrap,\n useActiveOwner,\n} from \"../core/reactive.ts\"\nimport { RenderContext } from \"../core/render.ts\"\nimport { Actions } from \"../input/actions.ts\"\nimport { Decoder } from \"../input/decoder.ts\"\nimport { defaultActions } from \"../input/defaults.ts\"\nimport { TerminalQueries } from \"../input/queries.ts\"\nimport { InputRouter } from \"../input/router.ts\"\nimport { TuiReporter } from \"../services/logger.ts\"\nimport { styleBuilder as buildStyle } from \"../style/builder.ts\"\nimport { defaultTheme } from \"../themes/registry.ts\"\nimport { Frame } from \"./frame.ts\"\nimport { OverlaySurface } from \"./overlay.ts\"\nimport { SelectionLayer } from \"./selection.ts\"\nimport { Stream } from \"./stream.ts\"\nimport { Terminal } from \"./terminal.ts\"\nimport { UI } from \"./ui.ts\"\n\nexport interface RendererOptions {\n stdin?: TerminalReader\n stdout?: TerminalWriter\n images?: Reactive<boolean>\n theme?: Theme\n /** Baseline footer height in rows — the size the footer occupies in\n * \"steady state\" (no autocomplete, no transient widget growth).\n * Stream uses `terminal.rows - fixedFooterHeight` as its commit\n * threshold, so scrollback ends exactly at the visible region's top\n * edge whenever the footer is at this size. Default `0` (commit at\n * the full terminal — preserves pre-existing behavior). Set to\n * match your app's persistent footer (e.g. 2 for a single-line\n * input with a one-line border). */\n fixedFooterHeight?: number\n /** Enable alternate screen buffer. Useful to test whether native\n * scrollback is competing with app-level scrolling. */\n altScreen?: boolean\n /** Register SIGINT/SIGTERM cleanup (default: true). Disable in tests. */\n hookSignals?: boolean\n logger?: Logger\n /** Enable terminal mouse reporting. Scroll events scroll the stream. */\n mouse?: boolean\n reporter?: TuiReporterOpts\n}\n\nexport type RenderEvents = {\n start: {}\n stop: {}\n dirty: {}\n}\n\nexport type SurfaceType = \"stream\" | \"ui\" | \"overlay\"\n\n/** Visitor signature for `Renderer.walk`. Return `\"stop\"` to halt. */\nexport type NodeVisitor = (node: Node) => void | \"stop\"\n\nexport class RenderStats {\n #stats: Record<string, number> = {}\n\n /** Increment a stat by `delta` (default: `1`). */\n inc(stat: string, delta = 1): void {\n this.#stats[stat] = (this.#stats[stat] ?? 0) + delta\n }\n\n set(stat: string, value: number): void {\n this.#stats[stat] = value\n }\n\n get(): Record<string, number> {\n return { ...this.#stats }\n }\n}\n\n/**\n * Wires a `Terminal` primitive with the `Stream` and `UI` surfaces.\n * Doesn't render anything until you either append to `renderer.stream`\n * or add children to `renderer.ui.root`.\n *\n * ```ts\n * const renderer = new Renderer()\n * renderer.start()\n * renderer.stream.append(text(\"hello\"))\n * renderer.ui.root.add(input({ placeholder: \"> \" }))\n * // ... later\n * renderer.stop()\n * ```\n */\nexport class Renderer extends Emitter<RenderEvents> {\n readonly stream: Stream\n readonly ui: UI\n readonly overlay: OverlaySurface\n readonly selection: SelectionLayer\n readonly terminal: Terminal\n readonly input: InputRouter\n readonly frame: Frame\n /** Always-on logger, auto-attached to `this.stream`. Calling\n * `renderer.log(\"msg\")` logs at `\"log\"` level; level methods\n * (`renderer.log.error(...)` etc.) are also available. */\n readonly logger: Logger\n\n readonly #decoder = new Decoder()\n readonly #stdin: TerminalReader & { setEncoding?: (enc: string) => void }\n\n #theme = signal<Theme | undefined>(undefined)\n\n /** Root Owner — every surface's function-shape `add` / `append` runs\n * its child under this Owner via `withOwner(#rootOwner, …)`, so\n * context values provided here (`RenderContext`, future global\n * scopes) are visible to every widget body in the tree. */\n readonly #rootOwner: Owner\n #running = false\n #escTimer: ReturnType<typeof setTimeout> | undefined\n #rendering?: Promise<void>\n #dirty = false\n #debug = false\n /** Monotonic cache-key for `RenderCtx`. Bumped on any event that\n * invalidates every node cache in the tree (resize, theme swap). */\n #ctxVersion = 0\n #ctx: RenderCtx | undefined\n queries: TerminalQueries\n\n /** Runtime action registry (catalog + dispatcher). Populated with\n * `defaultActions` + `globalActions` at construction; apps extend\n * via `renderer.actions.register({ \"app.foo\": { ... } })`. */\n readonly actions: Actions\n stats = new RenderStats()\n\n /** Global action impls. Merged into the `actions` catalog on\n * construction so the ids declared here gain their keys and desc\n * from `defaultActions`. Using `satisfies` (rather than an explicit\n * type annotation) keeps the literal keys so `BuiltinAction` can\n * pull them out. */\n globalActions = {\n \"global.quit\": {\n fn: (): void => {\n this.stop()\n process.exit(0)\n },\n },\n } satisfies Record<string, ActionDef>\n\n constructor(opts: RendererOptions = {}) {\n super()\n this.terminal = new Terminal({\n altScreen: opts.altScreen,\n hookSignals: opts.hookSignals,\n mouse: opts.mouse,\n stdin: opts.stdin,\n stdout: opts.stdout,\n })\n this.frame = new Frame(this.terminal)\n\n if (opts.theme) this.#theme.set(opts.theme)\n\n this.ui = new UI(this)\n this.stream = new Stream(this, {\n fixedFooterHeight: opts.fixedFooterHeight,\n })\n // Surfaces render into the shared frame; the renderer owns scheduling,\n // lifecycle events, and paint order.\n this.overlay = new OverlaySurface(this)\n this.selection = new SelectionLayer(this)\n this.logger = opts.logger ?? new Logger({ name: \"renderer\" })\n\n this.input = new InputRouter(this.logger.child({ name: \"input\" }))\n this.queries = new TerminalQueries(this.input, this.terminal)\n this.actions = new Actions(this.logger.child({ name: \"actions\" }))\n\n // Root Owner: an entry point for `useContext` walks. Every widget\n // body added via `ui.add(fn)` / `stream.append(fn)` / `overlay.add(fn)`\n // runs under this Owner, so `useContext(RenderContext)` resolves\n // to the values provided here.\n this.#rootOwner = createRoot(() => {\n provideContext(RenderContext, {\n images: memo(() => unwrap(opts.images) ?? true),\n queries: this.queries,\n style: memo(() => buildStyle(this.#theme.get())),\n theme: this.#theme.get,\n })\n return useActiveOwner() as Owner\n })\n\n const reporter = new TuiReporter(opts.reporter)\n reporter.attach({ append: (node) => this.stream.append(node) })\n\n this.logger.attach(\"tui\", reporter)\n\n // Wire the action registry: Actions looks up the focused node\n // (so programmatic dispatch starts there) and the Router hands\n // matched keymap action ids back to the registry for dispatch.\n this.actions.setTargetResolver(() => this.input.focused)\n this.input.setActions(this.actions)\n this.input.on(\"mouse\", ({ event }) => {\n if (event.kind === \"scroll\") void this.stream.scroll(event.deltaY)\n else this.selection.mouse(event)\n })\n this.input.on(\"key\", ({ event }) => {\n if (event.name === \"esc\") this.selection.clear()\n })\n // Rebuild the Router's keymap whenever the catalog changes. Action\n // `.keys` fields are the single source of truth for default\n // bindings; `setKeymap` can still be called by apps to override.\n // Bundled metadata + impls. `register` merges by id, so the\n // `globalActions` `fn` entries augment the docs/keys already\n // supplied by `defaultActions`.\n this.actions.register(defaultActions, { default: true })\n this.actions.register(this.globalActions, { default: true })\n\n // Untrack to prevent dep leaking\n this.on(\"dirty\", () => untrack(() => this.#schedule()))\n\n // SIGWINCH: dimensions changed. The terminal has re-wrapped its\n // existing content against the new column count; our on-screen\n // positioning bookkeeping (stream's `#rows`/`#scrollbackCount`,\n // ui's `#rows`) is from before the resize and no longer maps to\n // what's really painted. Cleanest recovery:\n //\n // 1. Bump `ctxVersion` + drop cached `#ctx` so every node's\n // cache self-invalidates and re-renders at the new width on\n // the next pass.\n // 2. Clear the scroll region (DECSTBM defaults to full viewport)\n // then wipe the screen with ED. The UI surface's next render\n // will reissue DECSTBM against the new row count.\n // 3. Tell both surfaces to forget their paint mirrors\n // (`onResize`). Node state is preserved — we still have every\n // stream node — so the re-render just replays them from\n // scratch at the new geometry.\n this.terminal.onResize(() => {\n this.#ctxVersion++\n this.#ctx = undefined\n this.terminal.sync(() => {\n // Drop DECSTBM so ED clears the entire display (some terminals\n // honour the region for ED; full reset avoids ambiguity), wipe\n // the screen, then reissue DECSTBM against the NEW row count\n // if a footer is reserved. `setReserveBottom` would early-return\n // (the stored `#reserveBottom` hasn't changed), so we bypass it\n // and talk to `setScrollRegion` directly.\n this.terminal.clearScrollRegion()\n this.terminal.write(`${this.terminal.moveTo(1, 1)}\\x1b[2J`)\n if (this.terminal.reserveBottom > 0) {\n this.terminal.setScrollRegion(1, this.terminal.scrollBottom)\n }\n })\n this.frame.reset()\n this.stream.onResize()\n this.ui.onResize()\n })\n\n this.#stdin = (opts.stdin ?? (process.stdin as unknown as TerminalReader)) as TerminalReader & {\n setEncoding?: (enc: string) => void\n }\n }\n\n /**\n * Shared `RenderCtx` for the current tick. Built on demand and\n * reused across every `Node.render(ctx)` call until the version\n * bumps (resize, theme swap). Nodes compare `ctx.version` against\n * their cached row's version — simple integer check, no hashing.\n */\n get ctx(): RenderCtx {\n if (\n this.#ctx === undefined ||\n this.#ctx.version !== this.#ctxVersion ||\n this.#ctx.width !== this.terminal.cols\n ) {\n this.#ctx = createCtx({\n theme: peek(this.#theme.get), // Untrack to prevent dep leaks from `ctx.theme` reads in render.\n transmit: (seq) => this.terminal.enqueueTransmit(seq),\n version: this.#ctxVersion,\n width: this.terminal.cols,\n })\n }\n return this.#ctx\n }\n\n get rootOwner(): Owner {\n return this.#rootOwner\n }\n\n get mouse(): boolean {\n return this.terminal.mouse\n }\n\n set mouse(mouse: boolean) {\n this.terminal.mouse = mouse\n }\n\n get debug(): boolean {\n return this.#debug\n }\n\n set debug(debug: boolean) {\n if (this.#debug === debug) return\n this.#debug = debug\n this.#schedule()\n }\n\n /** Whether the renderer is currently running. Surfaces use this to\n * decide whether a fresh append/open should immediately mount the\n * node or just queue it for the next `start()`. */\n get running(): boolean {\n return this.#running\n }\n\n /** Shortcut for `renderer.input.bind(pattern, handler)`. Returns an\n * unsubscribe function. Use for one-off app-level bindings where a\n * named action would be overkill. */\n bind: Actions[\"bind\"] = (binding) => this.actions.bind(binding)\n\n /** Swap the ambient theme. Widgets that read `theme()` / `style()`\n * from `useContext(RenderContext)` re-fire automatically; primitive\n * Nodes that compare cache against `ctx.version` need the version\n * bump that already happens elsewhere on theme-driven invalidation. */\n set theme(theme: Theme) {\n this.#theme.set(theme)\n this.#ctxVersion++\n this.stream.invalidate()\n this.ui.invalidate()\n this.overlay.invalidate()\n this.#schedule()\n }\n\n /** Get the current theme. (tracked) */\n get theme(): Theme {\n return this.#theme.get() ?? defaultTheme\n }\n\n start(): void {\n if (this.#running) return\n this.#running = true\n this.terminal.start()\n this.#stdin.setEncoding?.(\"utf8\")\n this.#stdin.on(\"data\", this.#onData)\n this.#stdin.resume?.()\n // Mount every surface's tracked tree. Build one MountCtx per\n // surface; each shares the same underlying services (router,\n // overlay, tree walk), only the `surface` tag differs.\n void this.emit(\"start\")\n // Anything that called `emit(\"dirty\")` before `start()` set\n // `#dirty = true` but couldn't schedule (no renderer yet). Now\n // that we're running, drain it.\n if (this.#dirty) this.#schedule()\n // setInterval(() => {\n // console.log(this.stats.get())\n // }, 5000)\n process.on(\"unhandledRejection\", (reason) =>\n this.logger.child(\"unhandledRejection\").error(\"Unhandled Rejection:\", reason)\n )\n }\n\n stop(): void {\n if (!this.#running) return\n // Unmount before tearing the terminal down so widgets that\n // scheduled teardown work (timers, subscriptions) have a clean\n // chance to run before their last render.\n void this.emit(\"stop\")\n this.#running = false\n this.#stdin.off(\"data\", this.#onData)\n this.#stdin.pause?.()\n if (this.#escTimer !== undefined) {\n clearTimeout(this.#escTimer)\n this.#escTimer = undefined\n }\n this.terminal.stop()\n }\n\n /** Look up a node by its `id`. Returns `undefined` if nothing matches. */\n getNode(id: string): Node | undefined {\n let found: Node | undefined\n this.walk((n) => {\n if (n.id() !== id) return undefined\n found = n\n return \"stop\"\n })\n return found\n }\n\n /**\n * Find every node matching a predicate. When passed a string, it's\n * interpreted as `node.type === string` — the common \"find all\n * Inputs\" case. For anything richer, pass a function.\n */\n findNode(match: string | ((node: Node) => boolean)): Node[] {\n const pred = typeof match === \"string\" ? (n: Node): boolean => n.type === match : match\n const out: Node[] = []\n this.walk((n) => {\n if (pred(n)) out.push(n)\n })\n return out\n }\n\n /**\n * Walk every node in the combined stream + UI tree, depth-first,\n * parents before children. Return `\"stop\"` from the visitor to halt.\n */\n walk(visit: NodeVisitor): void {\n // Roots: the UI tree (single root Box) + every live stream node.\n // Each root gets a depth-first visit, parent first. A `\"stop\"`\n // return from the visitor shortcuts the whole traversal — not\n // just the current subtree — so callers can bail early.\n const stopped = { v: false }\n const visitNode = (n: Node): void => {\n if (stopped.v) return\n if (visit(n) === \"stop\") {\n stopped.v = true\n return\n }\n for (const c of n.children) visitNode(c)\n }\n visitNode(this.ui.root)\n for (const n of this.stream.nodes) visitNode(n)\n for (const n of this.overlay.nodes) visitNode(n)\n }\n\n /** Build a MountCtx for a given surface. Each call creates a fresh\n * object but closes over the same underlying services, so nodes\n * across surfaces share a single overlay surface, router, etc. */\n mountCtx(surface: SurfaceType): MountCtx {\n const logger = this.logger.child({ name: surface, surface })\n const input = this.input\n return {\n actions: this.actions,\n findNode: (m) => this.findNode(m),\n getNode: (id) => this.getNode(id),\n input: {\n bind: (binding) => this.actions.bind(binding),\n blur: (node) => this.input.blur(node),\n events: this.input,\n focus: (node) => this.input.focus(node),\n queries: this.queries,\n get terminalFocus(): boolean {\n return input.terminalFocus\n },\n },\n logger,\n overlay: {\n add: (o) => this.overlay.add(o),\n remove: (o) => this.overlay.remove(o),\n },\n surface,\n }\n }\n\n /** Mark dirty and ensure the render loop is active. Cheap and\n * idempotent — synchronous invalidations within the same tick all\n * collapse into one paint via the microtask boundary at the top of\n * the loop. */\n #schedule(): void {\n this.#dirty = true\n // Nothing to paint until the renderer is actually running.\n // Tracked `#dirty` is preserved so `start()` picks it up via the\n // initial mount-triggered flush (or the first invalidate after).\n if (!this.#running) return\n if (this.#rendering !== undefined) return\n\n this.#rendering = (async () => {\n try {\n // Microtask boundary: batch every same-tick invalidation into\n // one paint. Without this, the first `await` inside `#render`\n // may or may not happen early enough for synchronous follow-up\n // invalidates to land in the same pass.\n await Promise.resolve()\n while (this.#dirty && this.#running) {\n this.#dirty = false\n try {\n this.stats.inc(\"render\")\n // oxlint-disable-next-line no-await-in-loop\n await this.#render()\n } catch (error) {\n // Kill the loop before the trace lands, so no further\n // paints race against the crash handler's output. Re-throw\n // next tick so `uncaughtException` picks it up with the\n // terminal already torn down cleanly.\n this.#running = false\n this.logger.child(\"render\").error(error)\n process.nextTick(() => {\n throw error\n })\n return\n }\n }\n } finally {\n this.#rendering = undefined\n }\n })()\n }\n\n /** Force a paint if dirty, and wait until the loop is idle. Useful\n * for tests and external \"redraw and tell me when done\" flows.\n * Concurrent callers share the same in-flight promise — no extra\n * paints are queued. */\n async render(): Promise<void> {\n if (!this.#running) return\n this.#schedule()\n if (this.#rendering !== undefined) await this.#rendering\n }\n\n /** Render dirty surfaces into a shared full-viewport frame, then flush\n * queued terminal ops and final row diffs in one atomic terminal sync. */\n async #render(): Promise<void> {\n const frame = this.frame.begin()\n const render = async (surface: Surface): Promise<void> => {\n if (!surface.dirty) return\n await surface.render(frame)\n }\n await render(this.stream)\n await render(this.ui)\n frame.commitBase()\n this.selection.renderStream(frame, this.ctx)\n await render(this.overlay)\n if (this.#debug) this.#renderDebug(frame)\n this.selection.renderScreen(frame, this.ctx)\n // Flush any side-channel transmits (e.g. KGP image data queued by\n // Image widgets during render) BEFORE entering the synced frame.\n // The terminal stores transmitted bytes globally — placements in\n // the frame body reference them by id and just need them to have\n // arrived first.\n this.terminal.flushTransmits()\n this.terminal.sync(() => {\n const s = frame.paint()\n this.stats.inc(\"paint-ops\", s.ops)\n this.stats.inc(\"paint-rows\", s.rows)\n })\n }\n\n #renderDebug(frame: RenderFrame): void {\n const stats = this.stats.get()\n const rows = Object.entries(stats)\n .toSorted(([a], [b]) => a.localeCompare(b))\n .map(([key, value]) => `${key}: ${value}`)\n rows.unshift(`debug: ${new Date().toLocaleTimeString()}`)\n\n const width = Math.min(this.terminal.cols, Math.max(...rows.map((row) => stringWidth(row)), 0))\n const x = Math.max(1, this.terminal.cols - width + 1)\n for (let i = 0; i < rows.length && i < this.terminal.rows; i++) {\n frame.overlay(i + 1, x, rows[i])\n }\n }\n\n // stdin wiring. In raw mode the terminal delivers bytes directly —\n // including ctrl-c as 0x03 rather than SIGINT — so we decode here and\n // hand events off to the router. Arrow so `stdin.off(\"data\", …)`\n // removes the same reference we attached.\n readonly #onData = (chunk: unknown): void => {\n // stdin may deliver strings (when setEncoding was called) or Buffers.\n const text = typeof chunk === \"string\" ? chunk : String(chunk)\n for (const ev of this.#decoder.feed(text)) this.input.dispatch(ev)\n // Any pending `\\x1b` will hang in the decoder until more bytes\n // arrive. Schedule a short timer so a lone ESC keypress commits as\n // an `esc` event rather than waiting indefinitely.\n if (this.#escTimer !== undefined) clearTimeout(this.#escTimer)\n this.#escTimer = setTimeout(() => {\n this.#escTimer = undefined\n for (const ev of this.#decoder.flush()) this.input.dispatch(ev)\n }, 25)\n this.#escTimer.unref()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAqFA,SAAS,aAAa,QAAiB,QAAyC;CAC9E,IAAI,CAAC,QAAQ,OAAO;CACpB,IAAI,CAAC,QAAQ,OAAO;CACpB,IAAI,OAAO,OAAO,OAAO,QAAQ,OAAO,KAAK,OAAO;CACpD,IAAI,OAAO,IAAI;EACb,IAAI,OAAO,OAAO,OAAO,YAAY,OAAO,OAAO,OAAO,IAAI,OAAO;EACrE,IAAI,OAAO,cAAc,UAAU,CAAC,OAAO,GAAG,KAAK,OAAO,EAAE,GAAG,OAAO;CACxE;CACA,IAAI,OAAO,WAAW,KAAA,KAAa,OAAO,YAAY,OAAO,UAAU,QAAQ,OAAO;CACtF,IAAI,OAAO,UAAU,CAAC,OAAO,OAAO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AAO;EAC3C,KAAK,QAAQ,2BAAU,IAAI,KAAK,EAAA,CAAE,mBAAmB,GAAG;EAExD,MAAM,QAAQ,KAAK,IAAI,KAAK,SAAS,MAAM,KAAK,IAAI,GAAG,KAAK,KAAK,QAAQ,YAAY,GAAG,CAAC,GAAG,CAAC,CAAC;EAC9F,MAAM,IAAI,KAAK,IAAI,GAAG,KAAK,SAAS,OAAO,QAAQ,CAAC;EACpD,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,UAAU,IAAI,KAAK,SAAS,MAAM,KACzD,MAAM,QAAQ,IAAI,GAAG,GAAG,KAAK,EAAE;CAEnC;CAMA,WAAoB,UAAyB;EAE3C,MAAM,OAAO,OAAO,UAAU,WAAW,QAAQ,OAAO,KAAK;EAC7D,KAAK,MAAM,MAAM,KAAK,SAAS,KAAK,IAAI,GAAG,KAAK,MAAM,SAAS,EAAE;EAIjE,IAAI,KAAK,cAAc,KAAA,GAAW,aAAa,KAAK,SAAS;EAC7D,KAAK,YAAY,iBAAiB;GAChC,KAAK,YAAY,KAAA;GACjB,KAAK,MAAM,MAAM,KAAK,SAAS,MAAM,GAAG,KAAK,MAAM,SAAS,EAAE;EAChE,GAAG,EAAE;EACL,KAAK,UAAU,MAAM;CACvB;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"text-BLz1tRoC.mjs","names":[],"sources":["../src/widgets/text.ts"],"sourcesContent":["import type { MaybePromise } from \"@zaly/shared\"\nimport type { RenderCtx } from \"../core/ctx.ts\"\nimport type { Reactive } from \"../core/reactive.ts\"\nimport type { State } from \"../core/state.ts\"\nimport type { Style } from \"../style/types.ts\"\n\nimport { Node } from \"../core/node.ts\"\nimport { unwrap } from \"../core/reactive.ts\"\nimport { calcLayout, formatText } from \"../layout/text.ts\"\n\n/**\n * Text content — three forms, resolved at render time:\n *\n * 1. Plain string — static content.\n * 2. Reactive accessor (`signal()` / `memo()`) — re-reads on each\n * render and subscribes the node so signal writes invalidate.\n * 3. `(ctx) => string` — computed from the render context. Use this\n * for inline-styled spans via `ctx.style`.\n *\n * Branded accessors are picked up via `isAccessor`; any other function\n * is treated as the ctx-aware form. Plain strings pass through.\n *\n * ```ts\n * text(\"hello\")\n * text(name) // signal accessor\n * text(({ style }) => style.ok(`✓ ${count}`)) // ctx-aware\n * ```\n */\nexport type TextContent = Reactive<string> | ((ctx: RenderCtx) => MaybePromise<Reactive<string>>)\n\nexport interface TextStyle extends Style {\n content: TextContent\n wrap?: \"word\" | \"char\" | \"none\"\n}\n\nexport class Text extends Node<TextStyle> {\n protected async _render(ctx: RenderCtx): Promise<string[]> {\n const content = await textContent(this.state.content, ctx)\n return formatText(content, {\n style: ctx.style.add(this.state),\n width: ctx.width,\n wrap: this.state.wrap,\n })\n }\n\n override async layout(ctx: RenderCtx) {\n return calcLayout(await textContent(this.state.content, ctx), { wrap: this.state.wrap })\n }\n}\n\nexport function textContent(content: TextContent, ctx: RenderCtx): Promise<string>\nexport function textContent(content: TextContent | undefined, ctx: RenderCtx): Promise<undefined>\nexport async function textContent(\n content: TextContent | undefined,\n ctx: RenderCtx\n): Promise<string | undefined> {\n if (content === undefined) return\n const raw = unwrap(content)\n return unwrap(typeof raw === \"string\" ? raw : await raw(ctx))\n}\n\n/**\n * Factory for `Text`. Content can be a plain string or a `(ctx) => string`\n * function that's called at render time — use the function form when you\n * want inline-styled spans via `ctx.style`.\n *\n * ```ts\n * text(\"hello\")\n * text(\"hello\", { fg: \"primary\", bold: true })\n * text({ content: \"hello\", fg: \"primary\" })\n * text(({ style }) => `ok: ${style.ok(\"yes\")}`)\n * ```\n */\nexport function text(content: TextContent, style?: Omit<State<TextStyle>, \"content\">): Text\nexport function text(style: State<TextStyle>): Text\nexport function text(\n first: TextContent | State<TextStyle>,\n style?: Omit<State<TextStyle>, \"content\">\n): Text {\n // TextContent: string | function (incl. reactive accessor) | …\n // TextStyle: plain object with a `content` field.\n // The TextStyle branch is picked only when `first` is a non-function\n // object — accessors are functions, so they go through the content path.\n if (typeof first === \"string\" || typeof first === \"function\") {\n return new Text({ content: first, ...style })\n }\n return new Text(first)\n}\n"],"mappings":";;;;AAmCA,IAAa,OAAb,cAA0B,KAAgB;CACxC,MAAgB,QAAQ,KAAmC;EACzD,MAAM,UAAU,MAAM,YAAY,KAAK,MAAM,SAAS,GAAG;EACzD,OAAO,WAAW,SAAS;GACzB,OAAO,IAAI,MAAM,IAAI,KAAK,KAAK;GAC/B,OAAO,IAAI;GACX,MAAM,KAAK,MAAM;EACnB,CAAC;CACH;CAEA,MAAe,OAAO,KAAgB;EACpC,OAAO,WAAW,MAAM,YAAY,KAAK,MAAM,SAAS,GAAG,GAAG,EAAE,MAAM,KAAK,MAAM,KAAK,CAAC;CACzF;AACF;AAIA,eAAsB,YACpB,SACA,KAC6B;CAC7B,IAAI,YAAY,KAAA,GAAW;CAC3B,MAAM,MAAM,OAAO,OAAO;CAC1B,OAAO,OAAO,OAAO,QAAQ,WAAW,MAAM,MAAM,IAAI,GAAG,CAAC;AAC9D;AAgBA,SAAgB,KACd,OACA,OACM;CAKN,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,YAChD,OAAO,IAAI,KAAK;EAAE,SAAS;EAAO,GAAG;CAAM,CAAC;CAE9C,OAAO,IAAI,KAAK,KAAK;AACvB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme.config-BKXX_noZ.mjs","names":["_accessExpressionAsString_1._accessExpressionAsString","_assertGuard_1._assertGuard"],"sources":["../../../node_modules/.bun/typia@15.1.0+367f7514c87f1df1/node_modules/typia/lib/TypeGuardError.mjs","../../../node_modules/.bun/typia@15.1.0+367f7514c87f1df1/node_modules/typia/lib/internal/_assertGuard.mjs","../../../node_modules/.bun/typia@15.1.0+367f7514c87f1df1/node_modules/typia/lib/internal/_accessExpressionAsString.mjs","../src/schemas/gen/theme.config.ts"],"sourcesContent":["//#region src/TypeGuardError.ts\n/**\n* Error thrown when type assertion fails.\n*\n* Thrown by {@link assert}, {@link assertGuard}, and other assert-family\n* functions when input doesn't match expected type `T`. Contains detailed\n* information about the first assertion failure:\n*\n* - `method`: Which typia function threw (e.g., `\"typia.assert\"`)\n* - `path`: Property path where error occurred (e.g., `\"input.user.age\"`)\n* - `expected`: Expected type string (e.g., `\"number & ExclusiveMinimum<19>\"`)\n* - `value`: Actual value that failed validation\n*\n* @template T Expected type (for type safety)\n*/\nvar TypeGuardError = class extends Error {\n\t/**\n\t* Creates a new TypeGuardError instance.\n\t*\n\t* @param props Error properties\n\t*/\n\tconstructor(props) {\n\t\tsuper(props.message || `Error on ${props.method}(): invalid type${props.path ? ` on ${props.path}` : \"\"}, expect to be ${props.expected}`);\n\t\tconst proto = new.target.prototype;\n\t\tif (Object.setPrototypeOf) Object.setPrototypeOf(this, proto);\n\t\telse this.__proto__ = proto;\n\t\tthis.name = \"TypeGuardError\";\n\t\tthis.method = props.method;\n\t\tthis.path = props.path;\n\t\tthis.expected = props.expected;\n\t\tthis.value = props.value;\n\t\tif (props.description || props.value === void 0) this.description = props.description ?? [\n\t\t\t\"The value at this path is `undefined`.\",\n\t\t\t\"\",\n\t\t\t`Please fill the \\`${props.expected}\\` typed value next time.`\n\t\t].join(\"\\n\");\n\t}\n};\n//#endregion\nexport { TypeGuardError };\n\n//# sourceMappingURL=TypeGuardError.mjs.map","import { TypeGuardError } from \"../TypeGuardError.mjs\";\n//#region src/internal/_assertGuard.ts\n/**\n* Report an assertion failure.\n*\n* When `exceptionable` is true it throws the error that `factory` makes, or a\n* TypeGuardError when `factory` is not a function; otherwise it returns false\n* so a union probe can try the next branch.\n*\n* @evidence contracts/common.md#principled-implementation When the call is exceptionable it throws an error built by the caller's factory if one is a function, and a TypeGuardError otherwise, and when it is not exceptionable it returns false so a union probe can try another branch without throwing. The factory is tested for callability because a pointwise call such as `rows.map(assertUser)` passes the element index in that position, which a bare truthiness test would call.\n* @evidence contracts/common.md#clear-and-simple-design One function with a boolean guard and one factory branch.\n* @evidence contracts/common.md#prohibited-implementation-shortcuts A non-callable argument falls back to the default error and is not retried or wrapped; the comment explains that a create-time factory overridden by the argument cannot be recovered here.\n* @evidence contracts/common.md#meaningful-documentation The doc states the two outcomes and the factory rule; the inline comment records the pointwise hand-off failure.\n*/\nconst _assertGuard = (exceptionable, props, factory) => {\n\tif (exceptionable === true) {\n\t\tif (typeof factory === \"function\") throw factory(props);\n\t\tthrow new TypeGuardError(props);\n\t}\n\treturn false;\n};\n//#endregion\nexport { _assertGuard };\n\n//# sourceMappingURL=_assertGuard.mjs.map","//#region src/internal/_accessExpressionAsString.ts\n/**\n* Write a property access on a key as source text.\n*\n* A key that is a legal ASCII identifier and not a reserved word becomes\n* `.key`, and any other key becomes `[\"key\"]` with a JSON string literal.\n*\n* @evidence contracts/common.md#principled-implementation A key that is a legal ASCII identifier and not a reserved word is written as a dot access, and every other key as a bracket access with a JSON string literal, which is a valid JavaScript string literal for any key, so the emitted access expression is correct for every property name. The reserved list is conservative for dot access, which is legal after a dot, so it can only cause an extra bracket form; the strict-mode future reserved words are not in the list.\n* @evidence contracts/common.md#clear-and-simple-design One function with two private helpers, the identifier test and the reserved set.\n* @evidence contracts/common.md#prohibited-implementation-shortcuts The decision is purely lexical and no property name is special-cased.\n* @evidence contracts/common.md#meaningful-documentation The doc states the dot and bracket forms and why bracket access is always safe.\n*/\nconst _accessExpressionAsString = (str) => variable(str) ? `.${str}` : `[${JSON.stringify(str)}]`;\nconst variable = (str) => reserved(str) === false && /^[a-zA-Z_$][a-zA-Z_$0-9]*$/g.test(str);\nconst reserved = (str) => RESERVED.has(str);\nconst RESERVED = /* @__PURE__ */ new Set([\n\t\"break\",\n\t\"case\",\n\t\"catch\",\n\t\"class\",\n\t\"const\",\n\t\"continue\",\n\t\"debugger\",\n\t\"default\",\n\t\"delete\",\n\t\"do\",\n\t\"else\",\n\t\"enum\",\n\t\"export\",\n\t\"extends\",\n\t\"false\",\n\t\"finally\",\n\t\"for\",\n\t\"function\",\n\t\"if\",\n\t\"import\",\n\t\"in\",\n\t\"instanceof\",\n\t\"new\",\n\t\"null\",\n\t\"return\",\n\t\"super\",\n\t\"switch\",\n\t\"this\",\n\t\"throw\",\n\t\"true\",\n\t\"try\",\n\t\"typeof\",\n\t\"var\",\n\t\"void\",\n\t\"while\",\n\t\"with\"\n]);\n//#endregion\nexport { _accessExpressionAsString };\n\n//# sourceMappingURL=_accessExpressionAsString.mjs.map","import * as _assertGuard_1 from \"typia/lib/internal/_assertGuard\";\nimport * as _accessExpressionAsString_1 from \"typia/lib/internal/_accessExpressionAsString\";\nconst __typia_transform__accessExpressionAsString = _accessExpressionAsString_1._accessExpressionAsString;\n// oxlint-disable import/no-named-as-default-member\nimport type { ShikiTheme } from \"../../shiki/types.ts\";\nimport type { AnsiColorName, BrightAnsiColorName, Color, HexColor, Style, ThemeKey, } from \"../../style/types.ts\";\nimport type { Theme } from \"../../themes/types.ts\";\ntype UserStyle = Omit<Style, \"fg\" | \"bg\" | \"style\"> & {\n fg?: string;\n bg?: string;\n};\ntype UserTheme = {\n $schema?: string;\n shiki?: ShikiTheme;\n id: string;\n name?: string;\n} & Record<string, string | UserStyle>;\ntype ColorKeys<T> = {\n [K in keyof T]-?: [\n T[K]\n ] extends [\n Color\n ] ? K : never;\n}[keyof T];\nconst toBaseColor = (() => {\n const _iv0 = new Set([\"accent\", \"black\", \"blue\", \"border\", \"borderTitle\", \"brightBlack\", \"brightBlue\", \"brightCyan\", \"brightGray\", \"brightGreen\", \"brightGrey\", \"brightMagenta\", \"brightRed\", \"brightWhite\", \"brightYellow\", \"code\", \"codeTitle\", \"comment\", \"cyan\", \"delim\", \"diffAdd\", \"diffContext\", \"diffDel\", \"diffLine\", \"diffTitle\", \"divider\", \"error\", \"gray\", \"green\", \"grey\", \"gutter\", \"highlight\", \"id\", \"info\", \"inherit\", \"magenta\", \"mdBold\", \"mdCode\", \"mdCodeBlock\", \"mdCodeBlockTitle\", \"mdHeading\", \"mdHeading1\", \"mdHeading2\", \"mdHeading3\", \"mdHeading4\", \"mdHeading5\", \"mdHeading6\", \"mdHr\", \"mdItalic\", \"mdLink\", \"mdListBullet\", \"mdListChecked\", \"mdListUnchecked\", \"mdQuote\", \"mdStrikethrough\", \"mdTable\", \"mdTableHeader\", \"muted\", \"name\", \"optionActive\", \"optionDesc\", \"optionName\", \"overlay\", \"primary\", \"prompt\", \"quiet\", \"red\", \"selection\", \"shiki\", \"subtle\", \"success\", \"syntaxBoolean\", \"syntaxBracket\", \"syntaxConstant\", \"syntaxDelimiter\", \"syntaxField\", \"syntaxFunction\", \"syntaxNumber\", \"syntaxSpecial\", \"syntaxString\", \"text\", \"title\", \"ui\", \"warn\", \"white\", \"yellow\"]);\n const _av0 = new Set([\"accent\", \"black\", \"blue\", \"border\", \"borderTitle\", \"brightBlack\", \"brightBlue\", \"brightCyan\", \"brightGray\", \"brightGreen\", \"brightGrey\", \"brightMagenta\", \"brightRed\", \"brightWhite\", \"brightYellow\", \"code\", \"codeTitle\", \"comment\", \"cyan\", \"delim\", \"diffAdd\", \"diffContext\", \"diffDel\", \"diffLine\", \"diffTitle\", \"divider\", \"error\", \"gray\", \"green\", \"grey\", \"gutter\", \"highlight\", \"id\", \"info\", \"inherit\", \"magenta\", \"mdBold\", \"mdCode\", \"mdCodeBlock\", \"mdCodeBlockTitle\", \"mdHeading\", \"mdHeading1\", \"mdHeading2\", \"mdHeading3\", \"mdHeading4\", \"mdHeading5\", \"mdHeading6\", \"mdHr\", \"mdItalic\", \"mdLink\", \"mdListBullet\", \"mdListChecked\", \"mdListUnchecked\", \"mdQuote\", \"mdStrikethrough\", \"mdTable\", \"mdTableHeader\", \"muted\", \"name\", \"optionActive\", \"optionDesc\", \"optionName\", \"overlay\", \"primary\", \"prompt\", \"quiet\", \"red\", \"selection\", \"shiki\", \"subtle\", \"success\", \"syntaxBoolean\", \"syntaxBracket\", \"syntaxConstant\", \"syntaxDelimiter\", \"syntaxField\", \"syntaxFunction\", \"syntaxNumber\", \"syntaxSpecial\", \"syntaxString\", \"text\", \"title\", \"ui\", \"warn\", \"white\", \"yellow\"]);\n const _ae0 = \"(\\\"accent\\\" | \\\"black\\\" | \\\"blue\\\" | \\\"border\\\" | \\\"borderTitle\\\" | \\\"brightBlack\\\" | \\\"brightBlue\\\" | \\\"brightCyan\\\" | \\\"brightGray\\\" | \\\"brightGreen\\\" | \\\"brightGrey\\\" | \\\"brightMagenta\\\" | \\\"brightRed\\\" | \\\"brightWhite\\\" | \\\"brightYellow\\\" | \\\"code\\\" | \\\"codeTitle\\\" | \\\"comment\\\" | \\\"cyan\\\" | \\\"delim\\\" | \\\"diffAdd\\\" | \\\"diffContext\\\" | \\\"diffDel\\\" | \\\"diffLine\\\" | \\\"diffTitle\\\" | \\\"divider\\\" | \\\"error\\\" | \\\"gray\\\" | \\\"green\\\" | \\\"grey\\\" | \\\"gutter\\\" | \\\"highlight\\\" | \\\"id\\\" | \\\"info\\\" | \\\"inherit\\\" | \\\"magenta\\\" | \\\"mdBold\\\" | \\\"mdCode\\\" | \\\"mdCodeBlock\\\" | \\\"mdCodeBlockTitle\\\" | \\\"mdHeading\\\" | \\\"mdHeading1\\\" | \\\"mdHeading2\\\" | \\\"mdHeading3\\\" | \\\"mdHeading4\\\" | \\\"mdHeading5\\\" | \\\"mdHeading6\\\" | \\\"mdHr\\\" | \\\"mdItalic\\\" | \\\"mdLink\\\" | \\\"mdListBullet\\\" | \\\"mdListChecked\\\" | \\\"mdListUnchecked\\\" | \\\"mdQuote\\\" | \\\"mdStrikethrough\\\" | \\\"mdTable\\\" | \\\"mdTableHeader\\\" | \\\"muted\\\" | \\\"name\\\" | \\\"optionActive\\\" | \\\"optionDesc\\\" | \\\"optionName\\\" | \\\"overlay\\\" | \\\"primary\\\" | \\\"prompt\\\" | \\\"quiet\\\" | \\\"red\\\" | \\\"selection\\\" | \\\"shiki\\\" | \\\"subtle\\\" | \\\"success\\\" | \\\"syntaxBoolean\\\" | \\\"syntaxBracket\\\" | \\\"syntaxConstant\\\" | \\\"syntaxDelimiter\\\" | \\\"syntaxField\\\" | \\\"syntaxFunction\\\" | \\\"syntaxNumber\\\" | \\\"syntaxSpecial\\\" | \\\"syntaxString\\\" | \\\"text\\\" | \\\"title\\\" | \\\"ui\\\" | \\\"warn\\\" | \\\"white\\\" | \\\"yellow\\\" | `#${string}`)\";\n const __is = (input: any): input is HexColor | AnsiColorName | BrightAnsiColorName | ThemeKey | \"inherit\" => null !== input && undefined !== input && (true === _iv0.has(input) || \"string\" === typeof input && RegExp(/^#(.*)/).test(input));\n let _errorFactory: any;\n return (input: any, errorFactory?: (p: import(\"typia\").TypeGuardError.IProps) => Error): HexColor | AnsiColorName | BrightAnsiColorName | ThemeKey | \"inherit\" => {\n if (false === __is(input)) {\n _errorFactory = errorFactory;\n ((input: any, _path: string, _exceptionable: boolean = true) => (null !== input || _assertGuard_1._assertGuard(true, {\n method: \"typia.createAssert\",\n path: _path + \"\",\n expected: _ae0,\n value: input\n }, _errorFactory)) && (undefined !== input || _assertGuard_1._assertGuard(true, {\n method: \"typia.createAssert\",\n path: _path + \"\",\n expected: _ae0,\n value: input\n }, _errorFactory)) && (true === _av0.has(input) || \"string\" === typeof input && RegExp(/^#(.*)/).test(input) || _assertGuard_1._assertGuard(true, {\n method: \"typia.createAssert\",\n path: _path + \"\",\n expected: _ae0,\n value: input\n }, _errorFactory)))(input, \"$input\", true);\n }\n return input;\n };\n})();\nconst toLightnessColor = (() => {\n const _iv0 = new Set([\"accent\", \"border\", \"borderTitle\", \"code\", \"codeTitle\", \"comment\", \"delim\", \"diffAdd\", \"diffContext\", \"diffDel\", \"diffLine\", \"diffTitle\", \"divider\", \"error\", \"gutter\", \"highlight\", \"id\", \"info\", \"mdBold\", \"mdCode\", \"mdCodeBlock\", \"mdCodeBlockTitle\", \"mdHeading\", \"mdHeading1\", \"mdHeading2\", \"mdHeading3\", \"mdHeading4\", \"mdHeading5\", \"mdHeading6\", \"mdHr\", \"mdItalic\", \"mdLink\", \"mdListBullet\", \"mdListChecked\", \"mdListUnchecked\", \"mdQuote\", \"mdStrikethrough\", \"mdTable\", \"mdTableHeader\", \"muted\", \"name\", \"optionActive\", \"optionDesc\", \"optionName\", \"overlay\", \"primary\", \"prompt\", \"quiet\", \"selection\", \"shiki\", \"subtle\", \"success\", \"syntaxBoolean\", \"syntaxBracket\", \"syntaxConstant\", \"syntaxDelimiter\", \"syntaxField\", \"syntaxFunction\", \"syntaxNumber\", \"syntaxSpecial\", \"syntaxString\", \"text\", \"title\", \"ui\", \"warn\"]);\n const _av0 = new Set([\"accent\", \"border\", \"borderTitle\", \"code\", \"codeTitle\", \"comment\", \"delim\", \"diffAdd\", \"diffContext\", \"diffDel\", \"diffLine\", \"diffTitle\", \"divider\", \"error\", \"gutter\", \"highlight\", \"id\", \"info\", \"mdBold\", \"mdCode\", \"mdCodeBlock\", \"mdCodeBlockTitle\", \"mdHeading\", \"mdHeading1\", \"mdHeading2\", \"mdHeading3\", \"mdHeading4\", \"mdHeading5\", \"mdHeading6\", \"mdHr\", \"mdItalic\", \"mdLink\", \"mdListBullet\", \"mdListChecked\", \"mdListUnchecked\", \"mdQuote\", \"mdStrikethrough\", \"mdTable\", \"mdTableHeader\", \"muted\", \"name\", \"optionActive\", \"optionDesc\", \"optionName\", \"overlay\", \"primary\", \"prompt\", \"quiet\", \"selection\", \"shiki\", \"subtle\", \"success\", \"syntaxBoolean\", \"syntaxBracket\", \"syntaxConstant\", \"syntaxDelimiter\", \"syntaxField\", \"syntaxFunction\", \"syntaxNumber\", \"syntaxSpecial\", \"syntaxString\", \"text\", \"title\", \"ui\", \"warn\"]);\n const _ae0 = \"(\\\"accent\\\" | \\\"border\\\" | \\\"borderTitle\\\" | \\\"code\\\" | \\\"codeTitle\\\" | \\\"comment\\\" | \\\"delim\\\" | \\\"diffAdd\\\" | \\\"diffContext\\\" | \\\"diffDel\\\" | \\\"diffLine\\\" | \\\"diffTitle\\\" | \\\"divider\\\" | \\\"error\\\" | \\\"gutter\\\" | \\\"highlight\\\" | \\\"id\\\" | \\\"info\\\" | \\\"mdBold\\\" | \\\"mdCode\\\" | \\\"mdCodeBlock\\\" | \\\"mdCodeBlockTitle\\\" | \\\"mdHeading\\\" | \\\"mdHeading1\\\" | \\\"mdHeading2\\\" | \\\"mdHeading3\\\" | \\\"mdHeading4\\\" | \\\"mdHeading5\\\" | \\\"mdHeading6\\\" | \\\"mdHr\\\" | \\\"mdItalic\\\" | \\\"mdLink\\\" | \\\"mdListBullet\\\" | \\\"mdListChecked\\\" | \\\"mdListUnchecked\\\" | \\\"mdQuote\\\" | \\\"mdStrikethrough\\\" | \\\"mdTable\\\" | \\\"mdTableHeader\\\" | \\\"muted\\\" | \\\"name\\\" | \\\"optionActive\\\" | \\\"optionDesc\\\" | \\\"optionName\\\" | \\\"overlay\\\" | \\\"primary\\\" | \\\"prompt\\\" | \\\"quiet\\\" | \\\"selection\\\" | \\\"shiki\\\" | \\\"subtle\\\" | \\\"success\\\" | \\\"syntaxBoolean\\\" | \\\"syntaxBracket\\\" | \\\"syntaxConstant\\\" | \\\"syntaxDelimiter\\\" | \\\"syntaxField\\\" | \\\"syntaxFunction\\\" | \\\"syntaxNumber\\\" | \\\"syntaxSpecial\\\" | \\\"syntaxString\\\" | \\\"text\\\" | \\\"title\\\" | \\\"ui\\\" | \\\"warn\\\" | `#${string}`)\";\n const __is = (input: any): input is HexColor | ThemeKey => null !== input && undefined !== input && (true === _iv0.has(input) || \"string\" === typeof input && RegExp(/^#(.*)/).test(input));\n let _errorFactory: any;\n return (input: any, errorFactory?: (p: import(\"typia\").TypeGuardError.IProps) => Error): HexColor | ThemeKey => {\n if (false === __is(input)) {\n _errorFactory = errorFactory;\n ((input: any, _path: string, _exceptionable: boolean = true) => (null !== input || _assertGuard_1._assertGuard(true, {\n method: \"typia.createAssert\",\n path: _path + \"\",\n expected: _ae0,\n value: input\n }, _errorFactory)) && (undefined !== input || _assertGuard_1._assertGuard(true, {\n method: \"typia.createAssert\",\n path: _path + \"\",\n expected: _ae0,\n value: input\n }, _errorFactory)) && (true === _av0.has(input) || \"string\" === typeof input && RegExp(/^#(.*)/).test(input) || _assertGuard_1._assertGuard(true, {\n method: \"typia.createAssert\",\n path: _path + \"\",\n expected: _ae0,\n value: input\n }, _errorFactory)))(input, \"$input\", true);\n }\n return input;\n };\n})();\nconst toStyle = (() => {\n const _ao0 = (input: any, _path: string, _exceptionable: boolean = true): boolean => _ao1(input, _path, true && _exceptionable) && ((undefined === input.fg || \"string\" === typeof input.fg || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssert\",\n path: _path + \".fg\",\n expected: \"(string | undefined)\",\n value: input.fg\n }, _errorFactory)) && (undefined === input.bg || \"string\" === typeof input.bg || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssert\",\n path: _path + \".bg\",\n expected: \"(string | undefined)\",\n value: input.bg\n }, _errorFactory)));\n const _ao1 = (input: any, _path: string, _exceptionable: boolean = true): boolean => (undefined === input.bold || \"boolean\" === typeof input.bold || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssert\",\n path: _path + \".bold\",\n expected: \"(boolean | undefined)\",\n value: input.bold\n }, _errorFactory)) && (undefined === input.dim || \"boolean\" === typeof input.dim || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssert\",\n path: _path + \".dim\",\n expected: \"(boolean | undefined)\",\n value: input.dim\n }, _errorFactory)) && (undefined === input.italic || \"boolean\" === typeof input.italic || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssert\",\n path: _path + \".italic\",\n expected: \"(boolean | undefined)\",\n value: input.italic\n }, _errorFactory)) && (undefined === input.underline || \"boolean\" === typeof input.underline || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssert\",\n path: _path + \".underline\",\n expected: \"(boolean | undefined)\",\n value: input.underline\n }, _errorFactory)) && (undefined === input.inverse || \"boolean\" === typeof input.inverse || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssert\",\n path: _path + \".inverse\",\n expected: \"(boolean | undefined)\",\n value: input.inverse\n }, _errorFactory)) && (undefined === input.strikethrough || \"boolean\" === typeof input.strikethrough || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssert\",\n path: _path + \".strikethrough\",\n expected: \"(boolean | undefined)\",\n value: input.strikethrough\n }, _errorFactory));\n const _io0 = (input: any): boolean => _io1(input) && ((undefined === input.fg || \"string\" === typeof input.fg) && (undefined === input.bg || \"string\" === typeof input.bg));\n const _io1 = (input: any): boolean => (undefined === input.bold || \"boolean\" === typeof input.bold) && (undefined === input.dim || \"boolean\" === typeof input.dim) && (undefined === input.italic || \"boolean\" === typeof input.italic) && (undefined === input.underline || \"boolean\" === typeof input.underline) && (undefined === input.inverse || \"boolean\" === typeof input.inverse) && (undefined === input.strikethrough || \"boolean\" === typeof input.strikethrough);\n const __is = (input: any): input is UserStyle => \"object\" === typeof input && null !== input && false === Array.isArray(input) && _io0(input);\n let _errorFactory: any;\n return (input: any, errorFactory?: (p: import(\"typia\").TypeGuardError.IProps) => Error): UserStyle => {\n if (false === __is(input)) {\n _errorFactory = errorFactory;\n ((input: any, _path: string, _exceptionable: boolean = true) => (\"object\" === typeof input && null !== input && false === Array.isArray(input) || _assertGuard_1._assertGuard(true, {\n method: \"typia.createAssert\",\n path: _path + \"\",\n expected: \"UserStyle\",\n value: input\n }, _errorFactory)) && _ao0(input, _path + \"\", true) || _assertGuard_1._assertGuard(true, {\n method: \"typia.createAssert\",\n path: _path + \"\",\n expected: \"UserStyle\",\n value: input\n }, _errorFactory))(input, \"$input\", true);\n }\n return input;\n };\n})();\nconst isColorKey = (() => {\n return (input: any): input is ColorKeys<Theme> => \"accent\" === input || \"error\" === input || \"info\" === input || \"primary\" === input || \"success\" === input || \"text\" === input || \"warn\" === input;\n})();\nfunction toColor(value: unknown) {\n if (typeof value !== \"string\")\n return toBaseColor(value); // will throw\n const color = value.replace(/[+-]\\d+/, \"\");\n if (value.match(/[+-]\\d+/))\n toLightnessColor(color);\n return toBaseColor(color);\n}\nconst validator = (() => {\n const _iv0 = new Set([\"andromeeda\", \"aurora-x\", \"ayu-dark\", \"ayu-light\", \"ayu-mirage\", \"catppuccin-frappe\", \"catppuccin-latte\", \"catppuccin-macchiato\", \"catppuccin-mocha\", \"dark-plus\", \"dracula\", \"dracula-soft\", \"everforest-dark\", \"everforest-light\", \"github-dark\", \"github-dark-default\", \"github-dark-dimmed\", \"github-dark-high-contrast\", \"github-light\", \"github-light-default\", \"github-light-high-contrast\", \"gruvbox-dark-hard\", \"gruvbox-dark-medium\", \"gruvbox-dark-soft\", \"gruvbox-light-hard\", \"gruvbox-light-medium\", \"gruvbox-light-soft\", \"horizon\", \"horizon-bright\", \"houston\", \"kanagawa-dragon\", \"kanagawa-lotus\", \"kanagawa-wave\", \"laserwave\", \"light-plus\", \"material-theme\", \"material-theme-darker\", \"material-theme-lighter\", \"material-theme-ocean\", \"material-theme-palenight\", \"min-dark\", \"min-light\", \"monokai\", \"night-owl\", \"night-owl-light\", \"nord\", \"one-dark-pro\", \"one-light\", \"plastic\", \"poimandres\", \"red\", \"rose-pine\", \"rose-pine-dawn\", \"rose-pine-moon\", \"slack-dark\", \"slack-ochin\", \"snazzy-light\", \"solarized-dark\", \"solarized-light\", \"synthwave-84\", \"tokyo-night\", \"vesper\", \"vitesse-black\", \"vitesse-dark\", \"vitesse-light\"]);\n const _av0 = new Set([\"andromeeda\", \"aurora-x\", \"ayu-dark\", \"ayu-light\", \"ayu-mirage\", \"catppuccin-frappe\", \"catppuccin-latte\", \"catppuccin-macchiato\", \"catppuccin-mocha\", \"dark-plus\", \"dracula\", \"dracula-soft\", \"everforest-dark\", \"everforest-light\", \"github-dark\", \"github-dark-default\", \"github-dark-dimmed\", \"github-dark-high-contrast\", \"github-light\", \"github-light-default\", \"github-light-high-contrast\", \"gruvbox-dark-hard\", \"gruvbox-dark-medium\", \"gruvbox-dark-soft\", \"gruvbox-light-hard\", \"gruvbox-light-medium\", \"gruvbox-light-soft\", \"horizon\", \"horizon-bright\", \"houston\", \"kanagawa-dragon\", \"kanagawa-lotus\", \"kanagawa-wave\", \"laserwave\", \"light-plus\", \"material-theme\", \"material-theme-darker\", \"material-theme-lighter\", \"material-theme-ocean\", \"material-theme-palenight\", \"min-dark\", \"min-light\", \"monokai\", \"night-owl\", \"night-owl-light\", \"nord\", \"one-dark-pro\", \"one-light\", \"plastic\", \"poimandres\", \"red\", \"rose-pine\", \"rose-pine-dawn\", \"rose-pine-moon\", \"slack-dark\", \"slack-ochin\", \"snazzy-light\", \"solarized-dark\", \"solarized-light\", \"synthwave-84\", \"tokyo-night\", \"vesper\", \"vitesse-black\", \"vitesse-dark\", \"vitesse-light\"]);\n const _ae0 = \"(\\\"andromeeda\\\" | \\\"aurora-x\\\" | \\\"ayu-dark\\\" | \\\"ayu-light\\\" | \\\"ayu-mirage\\\" | \\\"catppuccin-frappe\\\" | \\\"catppuccin-latte\\\" | \\\"catppuccin-macchiato\\\" | \\\"catppuccin-mocha\\\" | \\\"dark-plus\\\" | \\\"dracula\\\" | \\\"dracula-soft\\\" | \\\"everforest-dark\\\" | \\\"everforest-light\\\" | \\\"github-dark\\\" | \\\"github-dark-default\\\" | \\\"github-dark-dimmed\\\" | \\\"github-dark-high-contrast\\\" | \\\"github-light\\\" | \\\"github-light-default\\\" | \\\"github-light-high-contrast\\\" | \\\"gruvbox-dark-hard\\\" | \\\"gruvbox-dark-medium\\\" | \\\"gruvbox-dark-soft\\\" | \\\"gruvbox-light-hard\\\" | \\\"gruvbox-light-medium\\\" | \\\"gruvbox-light-soft\\\" | \\\"horizon\\\" | \\\"horizon-bright\\\" | \\\"houston\\\" | \\\"kanagawa-dragon\\\" | \\\"kanagawa-lotus\\\" | \\\"kanagawa-wave\\\" | \\\"laserwave\\\" | \\\"light-plus\\\" | \\\"material-theme\\\" | \\\"material-theme-darker\\\" | \\\"material-theme-lighter\\\" | \\\"material-theme-ocean\\\" | \\\"material-theme-palenight\\\" | \\\"min-dark\\\" | \\\"min-light\\\" | \\\"monokai\\\" | \\\"night-owl\\\" | \\\"night-owl-light\\\" | \\\"nord\\\" | \\\"one-dark-pro\\\" | \\\"one-light\\\" | \\\"plastic\\\" | \\\"poimandres\\\" | \\\"red\\\" | \\\"rose-pine\\\" | \\\"rose-pine-dawn\\\" | \\\"rose-pine-moon\\\" | \\\"slack-dark\\\" | \\\"slack-ochin\\\" | \\\"snazzy-light\\\" | \\\"solarized-dark\\\" | \\\"solarized-light\\\" | \\\"synthwave-84\\\" | \\\"tokyo-night\\\" | \\\"vesper\\\" | \\\"vitesse-black\\\" | \\\"vitesse-dark\\\" | \\\"vitesse-light\\\" | undefined)\";\n const _ao0 = (input: any, _path: string, _exceptionable: boolean = true): boolean => (undefined === input.$schema || \"string\" === typeof input.$schema || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssertEquals\",\n path: _path + \".$schema\",\n expected: \"(string | undefined)\",\n value: input.$schema\n }, _errorFactory)) && (undefined === input.shiki || true === _av0.has(input.shiki) || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssertEquals\",\n path: _path + \".shiki\",\n expected: _ae0,\n value: input.shiki\n }, _errorFactory)) && (undefined === input.id || \"string\" === typeof input.id || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssertEquals\",\n path: _path + \".id\",\n expected: \"(string | undefined)\",\n value: input.id\n }, _errorFactory)) && (undefined === input.name || \"string\" === typeof input.name || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssertEquals\",\n path: _path + \".name\",\n expected: \"(string | undefined)\",\n value: input.name\n }, _errorFactory)) && (false === _exceptionable || Object.keys(input).every((key: any) => {\n if ([\"$schema\", \"shiki\", \"id\", \"name\"].some((prop: any) => key === prop))\n return true;\n const value = input[key];\n if (undefined === value)\n return true;\n return (null !== value || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssertEquals\",\n path: _path + __typia_transform__accessExpressionAsString(key),\n expected: \"(UserStyle | string | undefined)\",\n value: value\n }, _errorFactory)) && (undefined === value || \"string\" === typeof value || (\"object\" === typeof value && null !== value && false === Array.isArray(value) || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssertEquals\",\n path: _path + __typia_transform__accessExpressionAsString(key),\n expected: \"(UserStyle | string | undefined)\",\n value: value\n }, _errorFactory)) && _ao1(value, _path + __typia_transform__accessExpressionAsString(key), true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssertEquals\",\n path: _path + __typia_transform__accessExpressionAsString(key),\n expected: \"(UserStyle | string | undefined)\",\n value: value\n }, _errorFactory));\n }));\n const _ao1 = (input: any, _path: string, _exceptionable: boolean = true): boolean => (undefined === input.bold || \"boolean\" === typeof input.bold || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssertEquals\",\n path: _path + \".bold\",\n expected: \"(boolean | undefined)\",\n value: input.bold\n }, _errorFactory)) && (undefined === input.dim || \"boolean\" === typeof input.dim || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssertEquals\",\n path: _path + \".dim\",\n expected: \"(boolean | undefined)\",\n value: input.dim\n }, _errorFactory)) && (undefined === input.italic || \"boolean\" === typeof input.italic || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssertEquals\",\n path: _path + \".italic\",\n expected: \"(boolean | undefined)\",\n value: input.italic\n }, _errorFactory)) && (undefined === input.underline || \"boolean\" === typeof input.underline || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssertEquals\",\n path: _path + \".underline\",\n expected: \"(boolean | undefined)\",\n value: input.underline\n }, _errorFactory)) && (undefined === input.inverse || \"boolean\" === typeof input.inverse || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssertEquals\",\n path: _path + \".inverse\",\n expected: \"(boolean | undefined)\",\n value: input.inverse\n }, _errorFactory)) && (undefined === input.strikethrough || \"boolean\" === typeof input.strikethrough || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssertEquals\",\n path: _path + \".strikethrough\",\n expected: \"(boolean | undefined)\",\n value: input.strikethrough\n }, _errorFactory)) && (undefined === input.fg || \"string\" === typeof input.fg || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssertEquals\",\n path: _path + \".fg\",\n expected: \"(string | undefined)\",\n value: input.fg\n }, _errorFactory)) && (undefined === input.bg || \"string\" === typeof input.bg || _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssertEquals\",\n path: _path + \".bg\",\n expected: \"(string | undefined)\",\n value: input.bg\n }, _errorFactory)) && (0 === Object.keys(input).length || (false === _exceptionable || Object.keys(input).every((key: any) => {\n if ([\"bold\", \"dim\", \"italic\", \"underline\", \"inverse\", \"strikethrough\", \"fg\", \"bg\"].some((prop: any) => key === prop))\n return true;\n const value = input[key];\n if (undefined === value)\n return true;\n return _assertGuard_1._assertGuard(_exceptionable, {\n method: \"typia.createAssertEquals\",\n path: _path + _accessExpressionAsString_1._accessExpressionAsString(key),\n expected: \"undefined\",\n value: value\n }, _errorFactory);\n })));\n const _io0 = (input: any, _exceptionable: boolean = true): boolean => (undefined === input.$schema || \"string\" === typeof input.$schema) && (undefined === input.shiki || true === _iv0.has(input.shiki)) && (undefined === input.id || \"string\" === typeof input.id) && (undefined === input.name || \"string\" === typeof input.name) && Object.keys(input).every((key: any) => {\n if ([\"$schema\", \"shiki\", \"id\", \"name\"].some((prop: any) => key === prop))\n return true;\n const value = input[key];\n if (undefined === value)\n return true;\n return null !== value && (undefined === value || \"string\" === typeof value || \"object\" === typeof value && null !== value && false === Array.isArray(value) && _io1(value, true && _exceptionable));\n });\n const _io1 = (input: any, _exceptionable: boolean = true): boolean => (undefined === input.bold || \"boolean\" === typeof input.bold) && (undefined === input.dim || \"boolean\" === typeof input.dim) && (undefined === input.italic || \"boolean\" === typeof input.italic) && (undefined === input.underline || \"boolean\" === typeof input.underline) && (undefined === input.inverse || \"boolean\" === typeof input.inverse) && (undefined === input.strikethrough || \"boolean\" === typeof input.strikethrough) && (undefined === input.fg || \"string\" === typeof input.fg) && (undefined === input.bg || \"string\" === typeof input.bg) && (0 === Object.keys(input).length || Object.keys(input).every((key: any) => {\n if ([\"bold\", \"dim\", \"italic\", \"underline\", \"inverse\", \"strikethrough\", \"fg\", \"bg\"].some((prop: any) => key === prop))\n return true;\n const value = input[key];\n if (undefined === value)\n return true;\n return false;\n }));\n const __is = (input: any, _exceptionable: boolean = true): input is Partial<UserTheme> => \"object\" === typeof input && null !== input && false === Array.isArray(input) && _io0(input, true);\n let _errorFactory: any;\n return (input: any, errorFactory?: (p: import(\"typia\").TypeGuardError.IProps) => Error): Partial<UserTheme> => {\n if (false === __is(input)) {\n _errorFactory = errorFactory;\n ((input: any, _path: string, _exceptionable: boolean = true) => (\"object\" === typeof input && null !== input && false === Array.isArray(input) || _assertGuard_1._assertGuard(true, {\n method: \"typia.createAssertEquals\",\n path: _path + \"\",\n expected: \"Partial<UserTheme>\",\n value: input\n }, _errorFactory)) && _ao0(input, _path + \"\", true) || _assertGuard_1._assertGuard(true, {\n method: \"typia.createAssertEquals\",\n path: _path + \"\",\n expected: \"Partial<UserTheme>\",\n value: input\n }, _errorFactory))(input, \"$input\", true);\n }\n return input;\n };\n})();\nconst skipSlots = new Set([\"$schema\", \"shiki\", \"id\", \"name\"]);\nexport function validateTheme(input: unknown): Partial<UserTheme> {\n const out = validator(input);\n for (const [slot, value] of Object.entries(out)) {\n if (skipSlots.has(slot) || value === undefined)\n continue;\n if (typeof value === \"string\" && toColor(value))\n continue;\n if (isColorKey(slot))\n toColor(value);\n const style = toStyle(value);\n if (style.fg !== undefined)\n toColor(style.fg);\n if (style.bg !== undefined)\n toColor(style.bg);\n }\n return out as unknown as Partial<Theme> & {\n $schema?: string;\n };\n}\n"],"ignoreList":[0,1,2],"mappings":";;;;;;;;;;;;;;;AAeA,IAAI,iBAAiB,cAAc,MAAM;;;;;;CAMxC,YAAY,OAAO;EAClB,MAAM,MAAM,WAAW,YAAY,MAAM,OAAO,kBAAkB,MAAM,OAAO,OAAO,MAAM,SAAS,GAAG,iBAAiB,MAAM,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AAQ,KAAK;EACjB,MAAM,QAAQ,QAAQ,KAAK;EAC3B,IAAI,MAAM,OAAO,KAAA,GACb,QAAQ,MAAM,EAAE;EACpB,IAAI,MAAM,OAAO,KAAA,GACb,QAAQ,MAAM,EAAE;CACxB;CACA,OAAO;AAGX"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-C0EOLZDc.d.mts","names":[],"sources":["../src/shiki/types.ts","../src/style/types.ts","../src/themes/types.ts"],"mappings":";;KAEY,aAAa;KACb,gBAAgB;KAEhB;EACV;EACA;EACA;EACA,QAAQ;EACR,SAAS;;KAGC,qBAAqB,KAAK;EACpC;EACA,MAAM;EACN;;KAGU,WAAW,qBACrB,kBAAkB,QAAQ,cAAc;EACtC;;KAGQ;EACV;EACA;EACA;EACA;;KAGU;EAAuB;KAAmB;EAAgB;;KAE1D;EACV,QAAQ;EACR,SAAS;;;;KCjCC,OAAO,WAAW,WAAW;;;;KAK7B;;KAGA;;KAaA,+BAA+B,WAAW;KAE1C,YAAY,gBAAgB,sBAAsB;;;;KAKlD;KACA,iBAAiB;;;;;;;;;;;;;KAcjB,QACR,WACA,gBACA,sBACA,0BAEG,WAAW,YAAY,sBACvB,WAAW,YAAY;UAEb;EACf,KAAK;EACL,KAAK;EACL;EACA;EACA;EACA;EACA;EACA;;;;;;KAOU,QAAQ,KAAK;EACvB,KAAK;EACL,KAAK;EACL,QAAQ;;KAGE,WAAW,QAAQ;;;;;;;;;KClEnB,aAAa,QAAQ;;;;;;;;;;;;;;;;;KAkBrB;EACV;EACA;;;;;EAKA,QAAQ;;EAKR,SAAS;;EAET,QAAQ;;;;;EAQR,MAAM;;;;EAIN,OAAO;;;EAGP,OAAO;;;EAGP,SAAS;;EAET,OAAO;;EAEP,OAAO;;;;;EAQP,QAAQ;;EAER,IAAI;;EAEJ,SAAS;;;;EAIT,WAAW;;EAKX,SAAS;;EAET,WAAW;;EAEX,QAAQ;;EAER,QAAQ;;EAER,QAAQ;;;EAGR,aAAa;;EAKb,MAA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