@textui/core 0.1.0

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 (323) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -0
  3. package/dist/adapters/index.d.ts +12 -0
  4. package/dist/adapters/index.d.ts.map +1 -0
  5. package/dist/adapters/index.js +11 -0
  6. package/dist/app/app.d.ts +200 -0
  7. package/dist/app/app.d.ts.map +1 -0
  8. package/dist/app/app.js +980 -0
  9. package/dist/core/animation.d.ts +34 -0
  10. package/dist/core/animation.d.ts.map +1 -0
  11. package/dist/core/animation.js +125 -0
  12. package/dist/core/clipboard.d.ts +29 -0
  13. package/dist/core/clipboard.d.ts.map +1 -0
  14. package/dist/core/clipboard.js +30 -0
  15. package/dist/core/commands.d.ts +42 -0
  16. package/dist/core/commands.d.ts.map +1 -0
  17. package/dist/core/commands.js +146 -0
  18. package/dist/core/components.d.ts +27 -0
  19. package/dist/core/components.d.ts.map +1 -0
  20. package/dist/core/components.js +78 -0
  21. package/dist/core/events.d.ts +23 -0
  22. package/dist/core/events.d.ts.map +1 -0
  23. package/dist/core/events.js +77 -0
  24. package/dist/core/focus.d.ts +69 -0
  25. package/dist/core/focus.d.ts.map +1 -0
  26. package/dist/core/focus.js +336 -0
  27. package/dist/core/i18n.d.ts +27 -0
  28. package/dist/core/i18n.d.ts.map +1 -0
  29. package/dist/core/i18n.js +88 -0
  30. package/dist/core/keybindings.d.ts +53 -0
  31. package/dist/core/keybindings.d.ts.map +1 -0
  32. package/dist/core/keybindings.js +163 -0
  33. package/dist/core/layers.d.ts +28 -0
  34. package/dist/core/layers.d.ts.map +1 -0
  35. package/dist/core/layers.js +84 -0
  36. package/dist/core/manifest.d.ts +22 -0
  37. package/dist/core/manifest.d.ts.map +1 -0
  38. package/dist/core/manifest.js +85 -0
  39. package/dist/core/navigation.d.ts +47 -0
  40. package/dist/core/navigation.d.ts.map +1 -0
  41. package/dist/core/navigation.js +110 -0
  42. package/dist/core/resources.d.ts +115 -0
  43. package/dist/core/resources.d.ts.map +1 -0
  44. package/dist/core/resources.js +321 -0
  45. package/dist/core/services.d.ts +21 -0
  46. package/dist/core/services.d.ts.map +1 -0
  47. package/dist/core/services.js +63 -0
  48. package/dist/core/store.d.ts +60 -0
  49. package/dist/core/store.d.ts.map +1 -0
  50. package/dist/core/store.js +593 -0
  51. package/dist/core/surfaces.d.ts +81 -0
  52. package/dist/core/surfaces.d.ts.map +1 -0
  53. package/dist/core/surfaces.js +237 -0
  54. package/dist/core/syntax.d.ts +49 -0
  55. package/dist/core/syntax.d.ts.map +1 -0
  56. package/dist/core/syntax.js +172 -0
  57. package/dist/core/when.d.ts +15 -0
  58. package/dist/core/when.d.ts.map +1 -0
  59. package/dist/core/when.js +224 -0
  60. package/dist/index.d.ts +49 -0
  61. package/dist/index.d.ts.map +1 -0
  62. package/dist/index.js +54 -0
  63. package/dist/jsx/factory.d.ts +27 -0
  64. package/dist/jsx/factory.d.ts.map +1 -0
  65. package/dist/jsx/factory.js +102 -0
  66. package/dist/jsx/intrinsics.d.ts +96 -0
  67. package/dist/jsx/intrinsics.d.ts.map +1 -0
  68. package/dist/jsx/intrinsics.js +1 -0
  69. package/dist/jsx/jsx-dev-runtime.d.ts +13 -0
  70. package/dist/jsx/jsx-dev-runtime.d.ts.map +1 -0
  71. package/dist/jsx/jsx-dev-runtime.js +12 -0
  72. package/dist/jsx/jsx-runtime.d.ts +42 -0
  73. package/dist/jsx/jsx-runtime.d.ts.map +1 -0
  74. package/dist/jsx/jsx-runtime.js +16 -0
  75. package/dist/render/buffer.d.ts +77 -0
  76. package/dist/render/buffer.d.ts.map +1 -0
  77. package/dist/render/buffer.js +275 -0
  78. package/dist/render/color.d.ts +35 -0
  79. package/dist/render/color.d.ts.map +1 -0
  80. package/dist/render/color.js +160 -0
  81. package/dist/render/diff.d.ts +37 -0
  82. package/dist/render/diff.d.ts.map +1 -0
  83. package/dist/render/diff.js +66 -0
  84. package/dist/render/layout.d.ts +72 -0
  85. package/dist/render/layout.d.ts.map +1 -0
  86. package/dist/render/layout.js +633 -0
  87. package/dist/render/static.d.ts +63 -0
  88. package/dist/render/static.d.ts.map +1 -0
  89. package/dist/render/static.js +209 -0
  90. package/dist/runtime/bindings.d.ts +46 -0
  91. package/dist/runtime/bindings.d.ts.map +1 -0
  92. package/dist/runtime/bindings.js +116 -0
  93. package/dist/runtime/hooks.d.ts +284 -0
  94. package/dist/runtime/hooks.d.ts.map +1 -0
  95. package/dist/runtime/hooks.js +846 -0
  96. package/dist/runtime/instance.d.ts +106 -0
  97. package/dist/runtime/instance.d.ts.map +1 -0
  98. package/dist/runtime/instance.js +181 -0
  99. package/dist/runtime/paint.d.ts +27 -0
  100. package/dist/runtime/paint.d.ts.map +1 -0
  101. package/dist/runtime/paint.js +567 -0
  102. package/dist/runtime/reconcile.d.ts +23 -0
  103. package/dist/runtime/reconcile.d.ts.map +1 -0
  104. package/dist/runtime/reconcile.js +260 -0
  105. package/dist/runtime/runtime.d.ts +42 -0
  106. package/dist/runtime/runtime.d.ts.map +1 -0
  107. package/dist/runtime/runtime.js +1 -0
  108. package/dist/runtime/style.d.ts +55 -0
  109. package/dist/runtime/style.d.ts.map +1 -0
  110. package/dist/runtime/style.js +143 -0
  111. package/dist/themes/borders.d.ts +10 -0
  112. package/dist/themes/borders.d.ts.map +1 -0
  113. package/dist/themes/borders.js +88 -0
  114. package/dist/themes/builtin.d.ts +31 -0
  115. package/dist/themes/builtin.d.ts.map +1 -0
  116. package/dist/themes/builtin.js +291 -0
  117. package/dist/themes/glyphs.d.ts +15 -0
  118. package/dist/themes/glyphs.d.ts.map +1 -0
  119. package/dist/themes/glyphs.js +97 -0
  120. package/dist/themes/index.d.ts +5 -0
  121. package/dist/themes/index.d.ts.map +1 -0
  122. package/dist/themes/index.js +4 -0
  123. package/dist/themes/registry.d.ts +20 -0
  124. package/dist/themes/registry.d.ts.map +1 -0
  125. package/dist/themes/registry.js +204 -0
  126. package/dist/types/adapter.d.ts +38 -0
  127. package/dist/types/adapter.d.ts.map +1 -0
  128. package/dist/types/adapter.js +1 -0
  129. package/dist/types/animation.d.ts +31 -0
  130. package/dist/types/animation.d.ts.map +1 -0
  131. package/dist/types/animation.js +1 -0
  132. package/dist/types/app.d.ts +148 -0
  133. package/dist/types/app.d.ts.map +1 -0
  134. package/dist/types/app.js +1 -0
  135. package/dist/types/async.d.ts +30 -0
  136. package/dist/types/async.d.ts.map +1 -0
  137. package/dist/types/async.js +1 -0
  138. package/dist/types/capabilities.d.ts +44 -0
  139. package/dist/types/capabilities.d.ts.map +1 -0
  140. package/dist/types/capabilities.js +33 -0
  141. package/dist/types/cells.d.ts +72 -0
  142. package/dist/types/cells.d.ts.map +1 -0
  143. package/dist/types/cells.js +10 -0
  144. package/dist/types/command.d.ts +127 -0
  145. package/dist/types/command.d.ts.map +1 -0
  146. package/dist/types/command.js +1 -0
  147. package/dist/types/component-registry.d.ts +77 -0
  148. package/dist/types/component-registry.d.ts.map +1 -0
  149. package/dist/types/component-registry.js +1 -0
  150. package/dist/types/disposable.d.ts +8 -0
  151. package/dist/types/disposable.d.ts.map +1 -0
  152. package/dist/types/disposable.js +1 -0
  153. package/dist/types/focus.d.ts +72 -0
  154. package/dist/types/focus.d.ts.map +1 -0
  155. package/dist/types/focus.js +1 -0
  156. package/dist/types/geometry.d.ts +28 -0
  157. package/dist/types/geometry.d.ts.map +1 -0
  158. package/dist/types/geometry.js +14 -0
  159. package/dist/types/graph.d.ts +129 -0
  160. package/dist/types/graph.d.ts.map +1 -0
  161. package/dist/types/graph.js +31 -0
  162. package/dist/types/i18n.d.ts +23 -0
  163. package/dist/types/i18n.d.ts.map +1 -0
  164. package/dist/types/i18n.js +1 -0
  165. package/dist/types/index.d.ts +32 -0
  166. package/dist/types/index.d.ts.map +1 -0
  167. package/dist/types/index.js +31 -0
  168. package/dist/types/input.d.ts +65 -0
  169. package/dist/types/input.d.ts.map +1 -0
  170. package/dist/types/input.js +1 -0
  171. package/dist/types/keybinding.d.ts +49 -0
  172. package/dist/types/keybinding.d.ts.map +1 -0
  173. package/dist/types/keybinding.js +1 -0
  174. package/dist/types/layer.d.ts +54 -0
  175. package/dist/types/layer.d.ts.map +1 -0
  176. package/dist/types/layer.js +1 -0
  177. package/dist/types/manifest.d.ts +114 -0
  178. package/dist/types/manifest.d.ts.map +1 -0
  179. package/dist/types/manifest.js +1 -0
  180. package/dist/types/markdown.d.ts +58 -0
  181. package/dist/types/markdown.d.ts.map +1 -0
  182. package/dist/types/markdown.js +1 -0
  183. package/dist/types/navigation.d.ts +40 -0
  184. package/dist/types/navigation.d.ts.map +1 -0
  185. package/dist/types/navigation.js +1 -0
  186. package/dist/types/render.d.ts +72 -0
  187. package/dist/types/render.d.ts.map +1 -0
  188. package/dist/types/render.js +1 -0
  189. package/dist/types/resource.d.ts +170 -0
  190. package/dist/types/resource.d.ts.map +1 -0
  191. package/dist/types/resource.js +1 -0
  192. package/dist/types/services.d.ts +24 -0
  193. package/dist/types/services.d.ts.map +1 -0
  194. package/dist/types/services.js +3 -0
  195. package/dist/types/shell.d.ts +32 -0
  196. package/dist/types/shell.d.ts.map +1 -0
  197. package/dist/types/shell.js +1 -0
  198. package/dist/types/store.d.ts +124 -0
  199. package/dist/types/store.d.ts.map +1 -0
  200. package/dist/types/store.js +1 -0
  201. package/dist/types/stream.d.ts +18 -0
  202. package/dist/types/stream.d.ts.map +1 -0
  203. package/dist/types/stream.js +1 -0
  204. package/dist/types/style.d.ts +166 -0
  205. package/dist/types/style.d.ts.map +1 -0
  206. package/dist/types/style.js +1 -0
  207. package/dist/types/surface.d.ts +97 -0
  208. package/dist/types/surface.d.ts.map +1 -0
  209. package/dist/types/surface.js +1 -0
  210. package/dist/types/syntax.d.ts +68 -0
  211. package/dist/types/syntax.d.ts.map +1 -0
  212. package/dist/types/syntax.js +5 -0
  213. package/dist/types/terminal.d.ts +52 -0
  214. package/dist/types/terminal.d.ts.map +1 -0
  215. package/dist/types/terminal.js +1 -0
  216. package/dist/types/theme.d.ts +117 -0
  217. package/dist/types/theme.d.ts.map +1 -0
  218. package/dist/types/theme.js +1 -0
  219. package/dist/types/when.d.ts +19 -0
  220. package/dist/types/when.d.ts.map +1 -0
  221. package/dist/types/when.js +1 -0
  222. package/dist/ui/primitives.d.ts +56 -0
  223. package/dist/ui/primitives.d.ts.map +1 -0
  224. package/dist/ui/primitives.js +108 -0
  225. package/dist/ui/screen.d.ts +23 -0
  226. package/dist/ui/screen.d.ts.map +1 -0
  227. package/dist/ui/screen.js +18 -0
  228. package/dist/util/disposable.d.ts +6 -0
  229. package/dist/util/disposable.d.ts.map +1 -0
  230. package/dist/util/disposable.js +49 -0
  231. package/dist/util/markdown.d.ts +24 -0
  232. package/dist/util/markdown.d.ts.map +1 -0
  233. package/dist/util/markdown.js +220 -0
  234. package/dist/util/paths.d.ts +47 -0
  235. package/dist/util/paths.d.ts.map +1 -0
  236. package/dist/util/paths.js +134 -0
  237. package/dist/util/stream.d.ts +32 -0
  238. package/dist/util/stream.d.ts.map +1 -0
  239. package/dist/util/stream.js +206 -0
  240. package/dist/util/text.d.ts +65 -0
  241. package/dist/util/text.d.ts.map +1 -0
  242. package/dist/util/text.js +419 -0
  243. package/package.json +70 -0
  244. package/src/adapters/index.ts +11 -0
  245. package/src/app/app.ts +1096 -0
  246. package/src/core/animation.ts +144 -0
  247. package/src/core/clipboard.ts +40 -0
  248. package/src/core/commands.ts +169 -0
  249. package/src/core/components.ts +91 -0
  250. package/src/core/events.ts +95 -0
  251. package/src/core/focus.ts +358 -0
  252. package/src/core/i18n.ts +107 -0
  253. package/src/core/keybindings.ts +184 -0
  254. package/src/core/layers.ts +94 -0
  255. package/src/core/manifest.ts +84 -0
  256. package/src/core/navigation.ts +135 -0
  257. package/src/core/resources.ts +362 -0
  258. package/src/core/services.ts +69 -0
  259. package/src/core/store.ts +640 -0
  260. package/src/core/surfaces.ts +292 -0
  261. package/src/core/syntax.ts +200 -0
  262. package/src/core/when.ts +238 -0
  263. package/src/index.ts +76 -0
  264. package/src/jsx/factory.ts +124 -0
  265. package/src/jsx/intrinsics.ts +99 -0
  266. package/src/jsx/jsx-dev-runtime.ts +23 -0
  267. package/src/jsx/jsx-runtime.ts +76 -0
  268. package/src/render/buffer.ts +318 -0
  269. package/src/render/color.ts +180 -0
  270. package/src/render/diff.ts +99 -0
  271. package/src/render/layout.ts +764 -0
  272. package/src/render/static.ts +290 -0
  273. package/src/runtime/bindings.ts +150 -0
  274. package/src/runtime/hooks.ts +1057 -0
  275. package/src/runtime/instance.ts +284 -0
  276. package/src/runtime/paint.ts +737 -0
  277. package/src/runtime/reconcile.ts +335 -0
  278. package/src/runtime/runtime.ts +47 -0
  279. package/src/runtime/style.ts +205 -0
  280. package/src/themes/borders.ts +95 -0
  281. package/src/themes/builtin.ts +301 -0
  282. package/src/themes/glyphs.ts +101 -0
  283. package/src/themes/index.ts +4 -0
  284. package/src/themes/registry.ts +224 -0
  285. package/src/types/adapter.ts +41 -0
  286. package/src/types/animation.ts +34 -0
  287. package/src/types/app.ts +149 -0
  288. package/src/types/async.ts +35 -0
  289. package/src/types/capabilities.ts +79 -0
  290. package/src/types/cells.ts +79 -0
  291. package/src/types/command.ts +139 -0
  292. package/src/types/component-registry.ts +82 -0
  293. package/src/types/disposable.ts +8 -0
  294. package/src/types/focus.ts +77 -0
  295. package/src/types/geometry.ts +50 -0
  296. package/src/types/graph.ts +174 -0
  297. package/src/types/i18n.ts +25 -0
  298. package/src/types/index.ts +31 -0
  299. package/src/types/input.ts +81 -0
  300. package/src/types/keybinding.ts +51 -0
  301. package/src/types/layer.ts +46 -0
  302. package/src/types/manifest.ts +101 -0
  303. package/src/types/markdown.ts +47 -0
  304. package/src/types/navigation.ts +42 -0
  305. package/src/types/render.ts +86 -0
  306. package/src/types/resource.ts +185 -0
  307. package/src/types/services.ts +28 -0
  308. package/src/types/shell.ts +30 -0
  309. package/src/types/store.ts +148 -0
  310. package/src/types/stream.ts +24 -0
  311. package/src/types/style.ts +205 -0
  312. package/src/types/surface.ts +119 -0
  313. package/src/types/syntax.ts +93 -0
  314. package/src/types/terminal.ts +58 -0
  315. package/src/types/theme.ts +121 -0
  316. package/src/types/when.ts +21 -0
  317. package/src/ui/primitives.ts +118 -0
  318. package/src/ui/screen.ts +41 -0
  319. package/src/util/disposable.ts +49 -0
  320. package/src/util/markdown.ts +225 -0
  321. package/src/util/paths.ts +138 -0
  322. package/src/util/stream.ts +213 -0
  323. package/src/util/text.ts +428 -0
@@ -0,0 +1,38 @@
1
+ import type { Disposable } from './disposable.js';
2
+ import type { ComponentDefinition } from './component-registry.js';
3
+ import type { CommandDefinition } from './command.js';
4
+ import type { KeybindingDefinition } from './keybinding.js';
5
+ import type { HighlighterDefinition } from './syntax.js';
6
+ import type { ResourceActionDefinition, ResourceEditorDefinition, ResourceKind, ResourceProvider, ResourceViewerDefinition } from './resource.js';
7
+ import type { TextUIApp } from './app.js';
8
+ /**
9
+ * A resource adapter.
10
+ *
11
+ * Everything one resource type needs, in one value: what it is, where it comes
12
+ * from, what opens it, how it is coloured, and what can be done to it. The
13
+ * registries underneath stay separate - an adapter is a convenience for the
14
+ * author and a unit of undo for the application, not a new mechanism.
15
+ *
16
+ * Registering returns a `Disposable` that removes exactly what was added, so a
17
+ * plugin can be unloaded without the screen keeping a viewer nobody can
18
+ * explain.
19
+ */
20
+ export interface ResourceAdapter {
21
+ id: string;
22
+ title?: string;
23
+ description?: string;
24
+ kinds?: ResourceKind[];
25
+ providers?: ResourceProvider[];
26
+ viewers?: ResourceViewerDefinition[];
27
+ editors?: ResourceEditorDefinition[];
28
+ actions?: ResourceActionDefinition[];
29
+ highlighters?: HighlighterDefinition[];
30
+ /** Commands the adapter contributes. Usually one per action. */
31
+ commands?: CommandDefinition[];
32
+ keybindings?: KeybindingDefinition[];
33
+ /** Components the viewers and editors name. */
34
+ components?: ComponentDefinition[];
35
+ /** Anything the fields above cannot express. */
36
+ register?(app: TextUIApp): Disposable | void;
37
+ }
38
+ //# sourceMappingURL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9C"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ import type { Disposable } from './disposable.js';
2
+ export type Easing = 'linear' | 'easeIn' | 'easeOut' | 'easeInOut' | ((t: number) => number);
3
+ export interface TweenOptions {
4
+ from: number;
5
+ to: number;
6
+ durationMs: number;
7
+ easing?: Easing;
8
+ onUpdate(value: number): void;
9
+ onComplete?(): void;
10
+ }
11
+ export interface TickerOptions {
12
+ /** Frames per second. Clamped by the driver's global cap. */
13
+ fps?: number;
14
+ onTick(frame: number, elapsedMs: number): void;
15
+ }
16
+ /**
17
+ * One driver for every moving thing, so a global disable is one flag and a
18
+ * slow ssh link can drop the frame rate for all of it at once.
19
+ */
20
+ export interface AnimationDriver extends Disposable {
21
+ enabled: boolean;
22
+ /** Global ceiling; individual tickers may ask for less. */
23
+ maxFps: number;
24
+ ticker(options: TickerOptions): Disposable;
25
+ tween(options: TweenOptions): Disposable;
26
+ /** Advance manually. The testing harness drives time with this. */
27
+ advance(ms: number): void;
28
+ /** True when animations are off - components render their final state. */
29
+ readonly disabled: boolean;
30
+ }
31
+ //# sourceMappingURL=animation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../src/types/animation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;AAE7F,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,CAAC,IAAI,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,6DAA6D;IAC7D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAChD;AAED;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,OAAO,EAAE,OAAO,CAAC;IACjB,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,UAAU,CAAC;IAC3C,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,UAAU,CAAC;IACzC,mEAAmE;IACnE,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,148 @@
1
+ import type { Disposable } from './disposable.js';
2
+ import type { Size } from './geometry.js';
3
+ import type { ReactiveStore, EventBus, ScopeName } from './store.js';
4
+ import type { ComponentRegistry } from './component-registry.js';
5
+ import type { CommandRegistry } from './command.js';
6
+ import type { KeybindingRegistry } from './keybinding.js';
7
+ import type { ThemeRegistry, ResolvedTheme, ThemeDefinition } from './theme.js';
8
+ import type { ShellRegistry } from './shell.js';
9
+ import type { LayoutRegistry, SurfaceRegistry, SurfaceName } from './surface.js';
10
+ import type { ResourceRegistry } from './resource.js';
11
+ import type { SyntaxRegistry } from './syntax.js';
12
+ import type { ResourceAdapter } from './adapter.js';
13
+ import type { Navigator } from './navigation.js';
14
+ import type { LayerManager } from './layer.js';
15
+ import type { FocusManager } from './focus.js';
16
+ import type { WhenEngine } from './when.js';
17
+ import type { I18n } from './i18n.js';
18
+ import type { ServiceContainer } from './services.js';
19
+ import type { AnimationDriver } from './animation.js';
20
+ import type { ManifestAPI } from './manifest.js';
21
+ import type { TerminalAdapter, TerminalSessionOptions } from './terminal.js';
22
+ import type { TerminalCapabilities, CapabilityOverrides } from './capabilities.js';
23
+ import type { ComponentNode } from './graph.js';
24
+ import type { CellBuffer } from './cells.js';
25
+ /**
26
+ * The application. Every registry hangs off it, and every registry is late
27
+ * binding, which is what lets a screen be data and a shell be swappable at
28
+ * runtime.
29
+ */
30
+ export interface TextUIApp extends Disposable {
31
+ readonly components: ComponentRegistry;
32
+ readonly commands: CommandRegistry;
33
+ readonly keybindings: KeybindingRegistry;
34
+ readonly themes: ThemeRegistry;
35
+ readonly shells: ShellRegistry;
36
+ readonly layouts: LayoutRegistry;
37
+ readonly surfaces: SurfaceRegistry;
38
+ readonly resources: ResourceRegistry;
39
+ readonly syntax: SyntaxRegistry;
40
+ readonly screens: Navigator;
41
+ readonly layers: LayerManager;
42
+ readonly focus: FocusManager;
43
+ readonly store: ReactiveStore;
44
+ readonly events: EventBus;
45
+ readonly when: WhenEngine;
46
+ readonly i18n: I18n;
47
+ readonly services: ServiceContainer;
48
+ readonly animation: AnimationDriver;
49
+ readonly manifest: ManifestAPI;
50
+ readonly terminal: TerminalAdapter;
51
+ readonly capabilities: TerminalCapabilities;
52
+ readonly theme: ResolvedTheme;
53
+ readonly size: Size;
54
+ readonly running: boolean;
55
+ setTheme(id: string): void;
56
+ setShell(id: string): void;
57
+ activeShell(): string;
58
+ setCapabilityOverrides(overrides: CapabilityOverrides): void;
59
+ /** Acquire the terminal and start the render loop. */
60
+ /** Swap the root node for another one, and redraw. */
61
+ setRoot(node: ComponentNode): void;
62
+ start(): Promise<void>;
63
+ /** Release exactly what was acquired, then stop. */
64
+ stop(): Promise<void>;
65
+ /** Force a frame now, outside the scheduler. Tests and screenshots use it. */
66
+ flush(): void;
67
+ /** The last painted frame. */
68
+ buffer(): CellBuffer;
69
+ /**
70
+ * Register a resource type whole: kinds, provider, viewers, highlighter,
71
+ * actions, commands. Disposing removes exactly what was added.
72
+ */
73
+ registerAdapter(adapter: ResourceAdapter): Disposable;
74
+ open: SurfaceRegistry['open'];
75
+ openResource: SurfaceRegistry['openResource'];
76
+ execute: CommandRegistry['execute'];
77
+ /** Every mounted node's tree, for the inspector and the test harness. */
78
+ inspect(): InspectorNode | null;
79
+ /**
80
+ * Frame statistics. `runs` is how many terminal writes the last frame cost,
81
+ * which is the number that tells you whether the diff is doing its job.
82
+ */
83
+ stats(): {
84
+ renders: number;
85
+ runs: number;
86
+ instances: number;
87
+ };
88
+ }
89
+ export interface InspectorNode {
90
+ id: string;
91
+ component: string;
92
+ key?: string | number;
93
+ rect?: {
94
+ x: number;
95
+ y: number;
96
+ width: number;
97
+ height: number;
98
+ };
99
+ props: Record<string, unknown>;
100
+ role?: string;
101
+ label?: string;
102
+ text?: string;
103
+ focusable?: boolean;
104
+ focused?: boolean;
105
+ /** Why the last render happened, when diagnostics are on. */
106
+ renderReason?: string;
107
+ bindings?: string[];
108
+ children: InspectorNode[];
109
+ }
110
+ export interface CreateAppOptions {
111
+ terminal?: TerminalAdapter;
112
+ session?: TerminalSessionOptions;
113
+ theme?: string;
114
+ themes?: ThemeDefinition[];
115
+ shell?: string;
116
+ /**
117
+ * The root node, when the app is not using screens.
118
+ *
119
+ * It is mounted into the `main` surface at boot, so the shell still frames
120
+ * it: the canvas is painted, the status surface and toast host exist, and
121
+ * `setShell` means something. It is an alternative to screens, not to the
122
+ * shell.
123
+ */
124
+ root?: ComponentNode;
125
+ capabilityOverrides?: CapabilityOverrides;
126
+ locale?: string;
127
+ /**
128
+ * Register everything the app needs. Runs once at boot, before the first
129
+ * render.
130
+ *
131
+ * A `Disposable` may be returned and the app disposes it on `stop()`, which
132
+ * is what makes `onBoot: registerBuiltins` the whole call rather than
133
+ * `onBoot: (app) => void registerBuiltins(app)`. Everything that registers
134
+ * hands back a disposable already; requiring `void` meant the shortest
135
+ * correct form was a cast of one away.
136
+ */
137
+ onBoot?(app: TextUIApp): void | Disposable | Promise<void | Disposable>;
138
+ /** Off disables every animation globally. */
139
+ animations?: boolean;
140
+ maxFps?: number;
141
+ /** Scopes cleared when `stop()` runs. */
142
+ clearOnStop?: ScopeName[];
143
+ /** Surfaces this app uses; others never mount. */
144
+ surfaces?: SurfaceName[];
145
+ /** Render diagnostics into `$/modus/diagnostics/*`. */
146
+ diagnostics?: boolean;
147
+ }
148
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/types/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OA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;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC;IAC1B,kDAAkD;IAClD,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB,uDAAuD;IACvD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,30 @@
1
+ import type { Disposable } from './disposable.js';
2
+ export type TaskStatus = 'idle' | 'running' | 'success' | 'error' | 'cancelled';
3
+ export interface TaskState<T = unknown> {
4
+ status: TaskStatus;
5
+ data?: T;
6
+ error?: unknown;
7
+ /** 0..1 when the task reports it, undefined when indeterminate. */
8
+ progress?: number;
9
+ /** Free-text step description, for a progress line. */
10
+ step?: string;
11
+ startedAt?: number;
12
+ finishedAt?: number;
13
+ }
14
+ export interface TaskController<T = unknown> {
15
+ readonly state: TaskState<T>;
16
+ run(...args: unknown[]): Promise<T | undefined>;
17
+ cancel(): void;
18
+ reset(): void;
19
+ subscribe(fn: (state: TaskState<T>) => void): Disposable;
20
+ }
21
+ export interface TaskRunContext {
22
+ signal: AbortSignal;
23
+ progress(value: number, step?: string): void;
24
+ }
25
+ export type TaskFn<T> = (ctx: TaskRunContext, ...args: any[]) => Promise<T> | T;
26
+ export interface ResourceState<T = unknown> extends TaskState<T> {
27
+ /** Refetching while previous data is still shown. */
28
+ refreshing: boolean;
29
+ }
30
+ //# sourceMappingURL=async.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/types/async.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;AAEhF,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,OAAO;IACpC,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,OAAO;IACzC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAC7B,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAChD,MAAM,IAAI,IAAI,CAAC;IACf,KAAK,IAAI,IAAI,CAAC;IACd,SAAS,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,UAAU,CAAC;CAC1D;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9C;AAED,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAEhF,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IAC9D,qDAAqD;IACrD,UAAU,EAAE,OAAO,CAAC;CACrB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,44 @@
1
+ /**
2
+ * What this terminal can actually do. Detected where possible, overridable by
3
+ * the adapter, and readable from the store at `$/modus/capabilities/*` so a
4
+ * `when` clause and a layout can both branch on it.
5
+ *
6
+ * Components degrade against this; they never feature-detect on their own.
7
+ */
8
+ export type ColorDepth = 0 | 4 | 8 | 24;
9
+ /** How much of the box-drawing / symbol repertoire is safe to emit. */
10
+ export type UnicodeLevel = 'ascii' | 'bmp' | 'full';
11
+ export interface TerminalCapabilities {
12
+ /** 0 = monochrome, 4 = 16 colors, 8 = 256, 24 = truecolor. */
13
+ colorDepth: ColorDepth;
14
+ unicode: UnicodeLevel;
15
+ /** True when the terminal reports (or is assumed to have) emoji/wide support. */
16
+ wideChars: boolean;
17
+ mouse: boolean;
18
+ wheel: boolean;
19
+ /** Terminal reports focus in/out (CSI ?1004h). */
20
+ focusEvents: boolean;
21
+ /** Bracketed paste (CSI ?2004h). */
22
+ paste: boolean;
23
+ /** OSC 8 hyperlinks. */
24
+ hyperlinks: boolean;
25
+ /** OSC 52 clipboard write. */
26
+ clipboard: boolean;
27
+ /** Alternate screen buffer (CSI ?1049h). */
28
+ altScreen: boolean;
29
+ /** Cursor show/hide/position. */
30
+ cursor: boolean;
31
+ /** Synchronized output (DEC 2026) - tear-free frames. */
32
+ synchronizedOutput: boolean;
33
+ /** Terminal supports setting the window/tab title (OSC 0/2). */
34
+ title: boolean;
35
+ /** Keyboard disambiguation (Kitty keyboard protocol). */
36
+ kittyKeyboard: boolean;
37
+ }
38
+ export type CapabilityName = keyof TerminalCapabilities;
39
+ /** Partial override applied on top of detection. */
40
+ export type CapabilityOverrides = Partial<TerminalCapabilities>;
41
+ /** The most conservative terminal we still render correctly on. */
42
+ export declare const MINIMAL_CAPABILITIES: TerminalCapabilities;
43
+ export declare const FULL_CAPABILITIES: TerminalCapabilities;
44
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../src/types/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AAExC,uEAAuE;AACvE,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAEpD,MAAM,WAAW,oBAAoB;IACnC,8DAA8D;IAC9D,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,YAAY,CAAC;IACtB,iFAAiF;IACjF,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,kDAAkD;IAClD,WAAW,EAAE,OAAO,CAAC;IACrB,oCAAoC;IACpC,KAAK,EAAE,OAAO,CAAC;IACf,wBAAwB;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,8BAA8B;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,4CAA4C;IAC5C,SAAS,EAAE,OAAO,CAAC;IACnB,iCAAiC;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,yDAAyD;IACzD,kBAAkB,EAAE,OAAO,CAAC;IAC5B,gEAAgE;IAChE,KAAK,EAAE,OAAO,CAAC;IACf,yDAAyD;IACzD,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,oBAAoB,CAAC;AAExD,oDAAoD;AACpD,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAEhE,mEAAmE;AACnE,eAAO,MAAM,oBAAoB,EAAE,oBAelC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,oBAe/B,CAAC"}
@@ -0,0 +1,33 @@
1
+ /** The most conservative terminal we still render correctly on. */
2
+ export const MINIMAL_CAPABILITIES = {
3
+ colorDepth: 0,
4
+ unicode: 'ascii',
5
+ wideChars: false,
6
+ mouse: false,
7
+ wheel: false,
8
+ focusEvents: false,
9
+ paste: false,
10
+ hyperlinks: false,
11
+ clipboard: false,
12
+ altScreen: false,
13
+ cursor: true,
14
+ synchronizedOutput: false,
15
+ title: false,
16
+ kittyKeyboard: false,
17
+ };
18
+ export const FULL_CAPABILITIES = {
19
+ colorDepth: 24,
20
+ unicode: 'full',
21
+ wideChars: true,
22
+ mouse: true,
23
+ wheel: true,
24
+ focusEvents: true,
25
+ paste: true,
26
+ hyperlinks: true,
27
+ clipboard: true,
28
+ altScreen: true,
29
+ cursor: true,
30
+ synchronizedOutput: true,
31
+ title: true,
32
+ kittyKeyboard: true,
33
+ };
@@ -0,0 +1,72 @@
1
+ import type { Rect } from './geometry.js';
2
+ /**
3
+ * A color is either a token name resolved through the theme, a 24-bit RGB
4
+ * value, a 256-palette index, or one of the 16 ANSI names. The renderer
5
+ * downsamples to whatever `colorDepth` allows - a component never picks a
6
+ * fallback itself.
7
+ */
8
+ export type AnsiColorName = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'brightBlack' | 'brightRed' | 'brightGreen' | 'brightYellow' | 'brightBlue' | 'brightMagenta' | 'brightCyan' | 'brightWhite';
9
+ export type Color = AnsiColorName | `#${string}` | {
10
+ rgb: [number, number, number];
11
+ } | {
12
+ palette: number;
13
+ } | 'default';
14
+ /** Text attributes as a bitfield - one number per cell, cheap to diff. */
15
+ export declare const ATTR_NONE = 0;
16
+ export declare const ATTR_BOLD: number;
17
+ export declare const ATTR_DIM: number;
18
+ export declare const ATTR_ITALIC: number;
19
+ export declare const ATTR_UNDERLINE: number;
20
+ export declare const ATTR_BLINK: number;
21
+ export declare const ATTR_INVERSE: number;
22
+ export declare const ATTR_HIDDEN: number;
23
+ export declare const ATTR_STRIKE: number;
24
+ export type Attrs = number;
25
+ /**
26
+ * One terminal cell. `char` is a full grapheme cluster (may be several code
27
+ * points). A wide grapheme occupies this cell and marks the next one
28
+ * `continuation`, which the writer skips.
29
+ */
30
+ export interface Cell {
31
+ char: string;
32
+ fg: Color;
33
+ bg: Color;
34
+ attrs: Attrs;
35
+ /** OSC 8 target, when the terminal supports hyperlinks. */
36
+ link?: string;
37
+ /** True for the right half of a double-width grapheme. */
38
+ continuation?: boolean;
39
+ }
40
+ export interface CellBuffer {
41
+ readonly width: number;
42
+ readonly height: number;
43
+ get(x: number, y: number): Cell | undefined;
44
+ set(x: number, y: number, cell: Cell): void;
45
+ /** Rows that changed since `commit()`. Empty when nothing moved. */
46
+ dirtyRows(): number[];
47
+ commit(): void;
48
+ clear(rect?: Rect): void;
49
+ resize(width: number, height: number): void;
50
+ /** Plain text, no attributes. The testing harness reads this. */
51
+ toText(rect?: Rect): string;
52
+ }
53
+ /** One contiguous run of identical-style cells - what the ANSI writer emits. */
54
+ export interface CellRun {
55
+ x: number;
56
+ y: number;
57
+ text: string;
58
+ fg: Color;
59
+ bg: Color;
60
+ attrs: Attrs;
61
+ link?: string;
62
+ }
63
+ export interface FrameDiff {
64
+ runs: CellRun[];
65
+ /** Where the hardware cursor should end up, or null to keep it hidden. */
66
+ cursor: {
67
+ x: number;
68
+ y: number;
69
+ visible: boolean;
70
+ } | null;
71
+ }
72
+ //# sourceMappingURL=cells.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cells.d.ts","sourceRoot":"","sources":["../../src/types/cells.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GACrB,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAC5E,aAAa,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,GAC5D,YAAY,GAAG,eAAe,GAAG,YAAY,GAAG,aAAa,CAAC;AAElE,MAAM,MAAM,KAAK,GACb,aAAa,GACb,IAAI,MAAM,EAAE,GACZ;IAAE,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GACjC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GACnB,SAAS,CAAC;AAEd,0EAA0E;AAC1E,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,eAAO,M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CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,KAAK,CAAC;IACV,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,0EAA0E;IAC1E,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CAC3D"}
@@ -0,0 +1,10 @@
1
+ /** Text attributes as a bitfield - one number per cell, cheap to diff. */
2
+ export const ATTR_NONE = 0;
3
+ export const ATTR_BOLD = 1 << 0;
4
+ export const ATTR_DIM = 1 << 1;
5
+ export const ATTR_ITALIC = 1 << 2;
6
+ export const ATTR_UNDERLINE = 1 << 3;
7
+ export const ATTR_BLINK = 1 << 4;
8
+ export const ATTR_INVERSE = 1 << 5;
9
+ export const ATTR_HIDDEN = 1 << 6;
10
+ export const ATTR_STRIKE = 1 << 7;
@@ -0,0 +1,127 @@
1
+ import type { Disposable } from './disposable.js';
2
+ import type { WhenClause } from './when.js';
3
+ import type { ReactiveStore } from './store.js';
4
+ import type { TextUIApp } from './app.js';
5
+ /**
6
+ * Command scope. A command resolves from the most specific scope outward:
7
+ * component -> region -> screen -> app
8
+ * The same id may be registered at several scopes; the innermost active one
9
+ * wins, which is how `table.search` means the focused table.
10
+ */
11
+ export type CommandScope = 'app' | 'screen' | 'region' | 'component';
12
+ /**
13
+ * One thing an argument may be answered with.
14
+ *
15
+ * A bare string is the short form and stays the common one - the value is the
16
+ * label and there is nothing else to say. The long form is for a choice that
17
+ * has to be *explained*: an agent's approval modes are five words that all
18
+ * sound alike ("Auto Mode", "Plan Mode") and the sentence under each one is
19
+ * what tells them apart, which is the difference between picking and guessing.
20
+ *
21
+ * The command is handed `value`, never the label. A host's ids are opaque and
22
+ * its labels are prose, and resolving one back to the other at the far end is
23
+ * a lookup that can be wrong.
24
+ */
25
+ export interface ArgChoice {
26
+ value: string;
27
+ /** What a person reads. The value, when there is nothing better. */
28
+ label?: string;
29
+ icon?: string;
30
+ /** A line under it: what choosing this would mean. */
31
+ description?: string;
32
+ }
33
+ export type ArgChoices = (string | ArgChoice)[];
34
+ export interface ArgSpec {
35
+ name: string;
36
+ type: 'string' | 'number' | 'boolean' | 'unknown';
37
+ required?: boolean;
38
+ description?: string;
39
+ /** Fixed choices, or a resolver for a picker. */
40
+ choices?: ArgChoices | (() => Promise<ArgChoices> | ArgChoices);
41
+ default?: unknown;
42
+ /**
43
+ * Show what a choice would do, before it is chosen.
44
+ *
45
+ * Called as the highlight moves, and with `null` when the asking is
46
+ * abandoned - so a theme can be applied while you look at it and put back if
47
+ * you press escape. The command owns whatever it needs to remember to undo
48
+ * itself; the palette only reports what is happening.
49
+ */
50
+ preview?(value: string | null): void;
51
+ }
52
+ export type ArgsSchema = ArgSpec[];
53
+ export interface CommandContext {
54
+ app: TextUIApp;
55
+ store: ReactiveStore;
56
+ /** The scope instance the command resolved from (a region id, a node id). */
57
+ scopeId: string | null;
58
+ /** How it was invoked, for commands that care. */
59
+ source: 'keybinding' | 'palette' | 'menu' | 'api' | 'mouse' | 'cli';
60
+ }
61
+ export type CommandHandler = (args: Record<string, unknown>, ctx: CommandContext) => unknown | Promise<unknown>;
62
+ export interface CommandDefinition {
63
+ id: string;
64
+ title: string;
65
+ description?: string;
66
+ category?: string;
67
+ icon?: string;
68
+ /**
69
+ * Leave the surface that ran this open.
70
+ *
71
+ * For a command whose whole effect is to flip something: closing the palette
72
+ * after each one means reopening it to reach the next, and a list of
73
+ * switches is meant to be walked.
74
+ */
75
+ keepOpen?: boolean;
76
+ /**
77
+ * A short state word shown beside the row, in place of the category.
78
+ *
79
+ * The icon is the row's identity and should not move under the reader as
80
+ * state changes; this is where the state goes instead.
81
+ */
82
+ badge?: string;
83
+ /**
84
+ * A key hint, when it is not this command's own keybinding.
85
+ *
86
+ * A row built for one list may stand for a command registered under another
87
+ * id; the binding a person would actually press belongs to that one.
88
+ */
89
+ shortcut?: string;
90
+ keywords?: string[];
91
+ scope?: CommandScope;
92
+ /** The instance this registration belongs to, for non-app scopes. */
93
+ scopeId?: string;
94
+ when?: WhenClause;
95
+ /**
96
+ * The state of a command that is a switch, as a clause over the store.
97
+ *
98
+ * A toggle's row has to say what it is toggling *to*, and the definition is
99
+ * registered once while the state changes under it - so this is a clause
100
+ * evaluated per read, the same way `when` is, rather than a boolean nobody
101
+ * would remember to update. Absent means the command is not a switch, which
102
+ * a menu needs to tell apart from a switch that is off.
103
+ */
104
+ checked?: WhenClause;
105
+ args?: ArgsSchema;
106
+ /** Slots this command publishes itself into: 'palette', 'menu:tab', ... */
107
+ slots?: string[];
108
+ run: CommandHandler;
109
+ }
110
+ export interface CommandRegistry {
111
+ register(def: CommandDefinition): Disposable;
112
+ unregister(id: string, scopeId?: string): void;
113
+ get(id: string): CommandDefinition | undefined;
114
+ list(options?: {
115
+ scope?: CommandScope;
116
+ slot?: string;
117
+ enabledOnly?: boolean;
118
+ }): CommandDefinition[];
119
+ /** Resolve through the active scope chain, innermost first. */
120
+ resolve(id: string): CommandDefinition | undefined;
121
+ execute(id: string, args?: Record<string, unknown>, source?: CommandContext['source']): Promise<unknown>;
122
+ /** True when the command exists and its `when` clause passes. */
123
+ enabled(id: string): boolean;
124
+ /** A switch's state, or undefined when the command is not a switch. */
125
+ isChecked(id: string): boolean | undefined;
126
+ }
127
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/types/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,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