@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,54 @@
1
+ import type { Disposable } from './disposable.js';
2
+ import type { ComponentNode } from './graph.js';
3
+ import type { Rect } from './geometry.js';
4
+ /** Painting and input order. A layer is a plane, not a component. */
5
+ export type LayerName = 'base' | 'floating' | 'modal' | 'notification' | 'debug';
6
+ export type AnchorSide = 'top' | 'right' | 'bottom' | 'left';
7
+ export type AnchorAlign = 'start' | 'center' | 'end';
8
+ /** Position a layer entry relative to a focusable, a rect, or the screen. */
9
+ export type LayerPosition = {
10
+ kind: 'center';
11
+ } | {
12
+ kind: 'screen';
13
+ rect: Partial<Rect>;
14
+ } | {
15
+ kind: 'anchor';
16
+ targetId: string;
17
+ side: AnchorSide;
18
+ align?: AnchorAlign;
19
+ offset?: number;
20
+ } | {
21
+ kind: 'point';
22
+ x: number;
23
+ y: number;
24
+ } | {
25
+ kind: 'cursor';
26
+ };
27
+ export interface LayerEntry {
28
+ id: string;
29
+ layer: LayerName;
30
+ node: ComponentNode;
31
+ position?: LayerPosition;
32
+ /** Dim everything beneath. Modals want this. */
33
+ scrim?: boolean;
34
+ /** Trap focus inside and restore it on close. */
35
+ trapFocus?: boolean;
36
+ /** Escape closes it. */
37
+ dismissOnEscape?: boolean;
38
+ /** A click outside closes it. */
39
+ dismissOnOutsideClick?: boolean;
40
+ /** Auto-remove after this many ms. Toasts want this. */
41
+ timeoutMs?: number;
42
+ onClose?(reason: 'escape' | 'outside' | 'timeout' | 'api'): void;
43
+ order?: number;
44
+ }
45
+ export interface LayerManager {
46
+ open(entry: LayerEntry): Disposable;
47
+ close(id: string, reason?: 'escape' | 'outside' | 'timeout' | 'api'): void;
48
+ closeLayer(layer: LayerName): void;
49
+ entries(layer?: LayerName): LayerEntry[];
50
+ /** The innermost entry that traps focus, if any. */
51
+ topmostTrap(): LayerEntry | null;
52
+ update(id: string, patch: Partial<LayerEntry>): void;
53
+ }
54
+ //# sourceMappingURL=layer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../../src/types/layer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,qEAAqE;AACrE,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,cAAc,GAAG,OAAO,CAAC;AAEjF,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAC7D,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAErD,6EAA6E;AAC7E,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5F;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEvB,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,gDAAgD;IAChD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,iDAAiD;IACjD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wBAAwB;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iCAAiC;IACjC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,KAAK,GAAG,IAAI,CAAC;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAAC;IACpC,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,KAAK,GAAG,IAAI,CAAC;IAC3E,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACnC,OAAO,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,UAAU,EAAE,CAAC;IACzC,oDAAoD;IACpD,WAAW,IAAI,UAAU,GAAG,IAAI,CAAC;IACjC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;CACtD"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,114 @@
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 { ThemeDefinition } from './theme.js';
6
+ import type { ShellDefinition } from './shell.js';
7
+ import type { LayoutDefinition, Mount } from './surface.js';
8
+ import type { ScreenDefinition } from './navigation.js';
9
+ import type { ResourceActionDefinition, ResourceEditorDefinition, ResourceKind, ResourceProvider, ResourceViewerDefinition } from './resource.js';
10
+ import type { ComputedDefinition, DataProviderDefinition } from './store.js';
11
+ import type { BindingPath } from './graph.js';
12
+ import type { CapabilityName } from './capabilities.js';
13
+ /**
14
+ * One source contributing to the typed registries. Deliberately not a generic
15
+ * plugin bag: every category is its own list with its own type, so a bad
16
+ * contribution fails where it is written.
17
+ */
18
+ export interface ManifestSource {
19
+ id: string;
20
+ version?: string;
21
+ displayName?: string;
22
+ /** One line, for a list of sources that has room to say what each one is. */
23
+ description?: string;
24
+ }
25
+ export interface Contributes {
26
+ components?: ComponentDefinition[];
27
+ commands?: CommandDefinition[];
28
+ keybindings?: KeybindingDefinition[];
29
+ themes?: ThemeDefinition[];
30
+ shells?: ShellDefinition[];
31
+ layouts?: LayoutDefinition[];
32
+ screens?: ScreenDefinition[];
33
+ views?: Mount[];
34
+ resourceKinds?: ResourceKind[];
35
+ resourceProviders?: ResourceProvider[];
36
+ resourceViewers?: ResourceViewerDefinition[];
37
+ resourceEditors?: ResourceEditorDefinition[];
38
+ resourceActions?: ResourceActionDefinition[];
39
+ dataProviders?: DataProviderDefinition[];
40
+ computed?: {
41
+ path: BindingPath;
42
+ def: ComputedDefinition;
43
+ }[];
44
+ }
45
+ export interface Manifest {
46
+ source: ManifestSource;
47
+ /** Other manifest ids that must load first. */
48
+ requires?: string[];
49
+ engine?: {
50
+ textui: string;
51
+ };
52
+ /** Refuse to load without these terminal capabilities. */
53
+ requiresCapabilities?: CapabilityName[];
54
+ contributes?: Contributes;
55
+ }
56
+ export interface ManifestAPI {
57
+ load(manifest: Manifest): Promise<Disposable>;
58
+ unload(sourceId: string): void;
59
+ sources(): ManifestSource[];
60
+ loaded(sourceId: string): boolean;
61
+ }
62
+ /**
63
+ * Registry manifest metadata - what the CLI reads to copy a component's source
64
+ * into a user's project and to tell later what changed upstream.
65
+ */
66
+ export interface RegistryComponentManifest {
67
+ name: string;
68
+ description?: string;
69
+ category?: string;
70
+ version: string;
71
+ /** Files copied into the project, relative to the registry root. */
72
+ files: {
73
+ path: string;
74
+ target?: string;
75
+ type?: 'component' | 'style' | 'test' | 'example';
76
+ }[];
77
+ /** Other registry components this one needs. */
78
+ dependencies?: string[];
79
+ /** npm packages this one needs. */
80
+ npmDependencies?: Record<string, string>;
81
+ requiredCapabilities?: CapabilityName[];
82
+ optionalCapabilities?: CapabilityName[];
83
+ variants?: string[];
84
+ /** Store paths this component binds to by convention. */
85
+ storeBindings?: string[];
86
+ related?: string[];
87
+ examples?: {
88
+ name: string;
89
+ file: string;
90
+ }[];
91
+ /** Templates that include this component. */
92
+ templates?: string[];
93
+ /** Content hash of the copied files, so the CLI can detect local edits. */
94
+ hash?: string;
95
+ }
96
+ export interface RegistryManifest {
97
+ name: string;
98
+ version: string;
99
+ description?: string;
100
+ homepage?: string;
101
+ components: RegistryComponentManifest[];
102
+ themes?: {
103
+ name: string;
104
+ file: string;
105
+ appearance: 'light' | 'dark';
106
+ }[];
107
+ templates?: {
108
+ name: string;
109
+ description?: string;
110
+ files: string[];
111
+ components: string[];
112
+ }[];
113
+ }
114
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/types/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OA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,CAAC;IACzC,oBAAoB,CAAC,EAAE,cAAc,EAAE,CAAC;IACxC,oBAAoB,CAAC,EAAE,cAAc,EAAE,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,yBAAyB,EAAE,CAAC;IACxC,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,OAAO,GAAG,MAAM,CAAA;KAAE,EAAE,CAAC;IACxE,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;CAC7F"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,58 @@
1
+ import type { StyleColor } from './style.js';
2
+ /**
3
+ * Markdown, as rows a terminal can scroll.
4
+ *
5
+ * Two shapes and one invariant: **every row is exactly one row tall.** That is
6
+ * what makes "how far can this scroll" a length rather than an estimate - one
7
+ * source line becomes three rows when it wraps and none when it is a fence
8
+ * marker, so counting source lines is counting the wrong unit and the tail of
9
+ * a long document becomes unreachable.
10
+ *
11
+ * A fence is the exception that proves it: it is several rows, so it becomes
12
+ * several rows here, each tagged with the fence it belongs to so a painter can
13
+ * put the visible ones back into one box.
14
+ */
15
+ /** A run of text with one style. Inline emphasis is why rows are not strings. */
16
+ export interface MarkdownRun {
17
+ text: string;
18
+ bold?: boolean;
19
+ italic?: boolean;
20
+ code?: boolean;
21
+ /** An OSC 8 target, where the terminal has hyperlinks. */
22
+ link?: string;
23
+ }
24
+ export type MarkdownRow = {
25
+ kind: 'rule';
26
+ } | {
27
+ kind: 'heading';
28
+ runs: MarkdownRun[];
29
+ level: number;
30
+ } | {
31
+ kind: 'text';
32
+ runs: MarkdownRun[];
33
+ prefix?: string;
34
+ prefixFg?: StyleColor;
35
+ fg?: StyleColor;
36
+ } | {
37
+ kind: 'fence';
38
+ fence: number;
39
+ part: 'open' | 'code' | 'close';
40
+ text?: string;
41
+ language?: string;
42
+ };
43
+ export interface MarkdownLayoutOptions {
44
+ /** Cells to wrap to. Zero means "not measured yet" - nothing is wrapped. */
45
+ width: number;
46
+ /** The bullet glyph. Passed in, because glyphs come from the theme. */
47
+ bullet?: string;
48
+ /** The rule down the left of a block quote. Also a theme glyph. */
49
+ quoteBar?: string;
50
+ /**
51
+ * Whether a fence gets an opening and closing rule row.
52
+ *
53
+ * A borderless theme draws neither, and a layout that reserved two rows for
54
+ * rules nobody draws stops two rows short of the end of the document.
55
+ */
56
+ ruled?: boolean;
57
+ }
58
+ //# sourceMappingURL=markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/types/markdown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;;;;;;;GAYG;AAEH,iFAAiF;AACjF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,WAAW,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;IAAC,EAAE,CAAC,EAAE,UAAU,CAAA;CAAE,GAC9F;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAExG,MAAM,WAAW,qBAAqB;IACpC,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,40 @@
1
+ import type { Disposable } from './disposable.js';
2
+ import type { ComponentNode } from './graph.js';
3
+ import type { MountDisplay, SurfaceName } from './surface.js';
4
+ /**
5
+ * Screens and a stack, not a router. An application that wants URLs maps them
6
+ * onto screens itself.
7
+ */
8
+ export interface ScreenDefinition {
9
+ id: string;
10
+ /** Component name, or the node itself. */
11
+ component: string | ComponentNode;
12
+ display?: MountDisplay;
13
+ /**
14
+ * Where it mounts. `main` unless a screen wants to live somewhere else - a
15
+ * surface is the application's word, so this is open like the rest of them.
16
+ */
17
+ surface?: SurfaceName;
18
+ /** Screens keep their store scope when navigated away from. */
19
+ keepAlive?: boolean;
20
+ }
21
+ export interface ScreenEntry {
22
+ id: string;
23
+ params?: Record<string, unknown>;
24
+ /** Focus id to restore when this entry becomes current again. */
25
+ restoreFocus?: string | null;
26
+ }
27
+ export interface Navigator {
28
+ register(screen: ScreenDefinition): Disposable;
29
+ screens(): ScreenDefinition[];
30
+ get(id: string): ScreenDefinition | undefined;
31
+ push(id: string, params?: Record<string, unknown>): void;
32
+ replace(id: string, params?: Record<string, unknown>): void;
33
+ pop(): boolean;
34
+ popTo(id: string): boolean;
35
+ reset(id: string, params?: Record<string, unknown>): void;
36
+ current(): ScreenEntry | null;
37
+ stack(): ScreenEntry[];
38
+ canGoBack(): boolean;
39
+ }
40
+ //# sourceMappingURL=navigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/types/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,0CAA0C;IAC1C,SAAS,EAAE,MAAM,GAAG,aAAa,CAAC;IAClC,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU,CAAC;IAC/C,OAAO,IAAI,gBAAgB,EAAE,CAAC;IAC9B,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAAC;IAC9C,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACzD,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5D,GAAG,IAAI,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC1D,OAAO,IAAI,WAAW,GAAG,IAAI,CAAC;IAC9B,KAAK,IAAI,WAAW,EAAE,CAAC;IACvB,SAAS,IAAI,OAAO,CAAC;CACtB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,72 @@
1
+ import type { Rect, Size } from './geometry.js';
2
+ import type { Cell, Color } from './cells.js';
3
+ import type { Attrs } from './cells.js';
4
+ import type { Style } from './style.js';
5
+ import type { ResolvedTheme } from './theme.js';
6
+ import type { TerminalCapabilities } from './capabilities.js';
7
+ import type { ComponentNode } from './graph.js';
8
+ /** What a host component paints onto. Clipped to the node's own rect. */
9
+ export interface PaintSurface {
10
+ readonly rect: Rect;
11
+ /** Write a grapheme at a content-relative cell. Out of bounds is a no-op. */
12
+ put(x: number, y: number, char: string, style?: CellStyle): void;
13
+ /** Write a string, advancing by grapheme width. Returns cells consumed. */
14
+ text(x: number, y: number, text: string, style?: CellStyle): number;
15
+ fill(rect: Rect | undefined, char: string, style?: CellStyle): void;
16
+ /** Direct cell write, for painters that already resolved everything. */
17
+ cell(x: number, y: number, cell: Cell): void;
18
+ /** A sub-surface, clipped and offset. */
19
+ clip(rect: Rect): PaintSurface;
20
+ }
21
+ export interface CellStyle {
22
+ fg?: Color;
23
+ bg?: Color;
24
+ attrs?: Attrs;
25
+ link?: string;
26
+ }
27
+ /** Everything a host needs that is not its props. */
28
+ export interface RenderContext {
29
+ theme: ResolvedTheme;
30
+ capabilities: TerminalCapabilities;
31
+ /** Interaction state, already resolved for this instance. */
32
+ focused: boolean;
33
+ hovered: boolean;
34
+ active: boolean;
35
+ selected: boolean;
36
+ disabled: boolean;
37
+ /** Resolve a style token or literal to a concrete colour. */
38
+ color(c: unknown, fallback?: Color): Color;
39
+ /** Glyph for a role, downgraded to ascii when the terminal demands it. */
40
+ glyph(name: string): string;
41
+ /** Measure a string in terminal cells, honouring wide and zero-width. */
42
+ measureText(text: string): number;
43
+ }
44
+ export interface MeasureConstraints {
45
+ /** Infinity means "as much as you want". */
46
+ maxWidth: number;
47
+ maxHeight: number;
48
+ minWidth: number;
49
+ minHeight: number;
50
+ }
51
+ /**
52
+ * A host component is a primitive that participates in layout and paint
53
+ * directly. There are deliberately few of them - Box, Text and Canvas - and
54
+ * the entire catalog is function components composing those, so the layout
55
+ * engine only ever reasons about three shapes.
56
+ */
57
+ export interface HostComponent<P = Record<string, unknown>> {
58
+ name: string;
59
+ /** Style contributed by props, merged under the node's own `style` prop. */
60
+ style?(props: P, ctx: RenderContext): Style | undefined;
61
+ /** Intrinsic size when the style does not fix one. */
62
+ measure?(props: P, ctx: RenderContext, constraints: MeasureConstraints): Size;
63
+ /** Paint the content box. Border and background are painted by the runtime. */
64
+ paint?(surface: PaintSurface, props: P, ctx: RenderContext): void;
65
+ /** True when this host lays out children (Box). */
66
+ container?: boolean;
67
+ /** Never receives children; a children prop is a programmer error. */
68
+ leaf?: boolean;
69
+ }
70
+ export type FunctionComponent<P = any> = (props: P) => RenderOutput;
71
+ export type RenderOutput = ComponentNode | ComponentNode[] | string | number | null | undefined | false | RenderOutput[];
72
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/types/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,yEAAyE;AACzE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,6EAA6E;IAC7E,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IACjE,2EAA2E;IAC3E,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACpE,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IACpE,wEAAwE;IACxE,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EA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AAK,EAAE,CAAC,EAAE,GAAG,EAAE,aAAa,EAAE,WAAW,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC9E,+EAA+E;IAC/E,KAAK,CAAC,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CAAC;IAClE,mDAAmD;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sEAAsE;IACtE,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,MAAM,iBAAiB,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,YAAY,CAAC;AAEpE,MAAM,MAAM,YAAY,GACpB,aAAa,GACb,aAAa,EAAE,GACf,MAAM,GACN,MAAM,GACN,IAAI,GACJ,SAAS,GACT,KAAK,GACL,YAAY,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,170 @@
1
+ import type { Disposable } from './disposable.js';
2
+ import type { ComponentNode } from './graph.js';
3
+ import type { WhenClause } from './when.js';
4
+ import type { CommandHandler } from './command.js';
5
+ import type { SemanticVariant } from './style.js';
6
+ /**
7
+ * A resource is anything addressable that a viewer, an editor or an action can
8
+ * be registered for - a file, a record, a log stream, a service, a chart
9
+ * source. The filesystem is one provider among several, not the model.
10
+ */
11
+ export type ResourceURI = string;
12
+ export interface ResourceKind {
13
+ /** Stable id: 'file.markdown', 'service', 'log.stream'. */
14
+ id: string;
15
+ title: string;
16
+ icon?: string;
17
+ /**
18
+ * What colour the icon is, as a role rather than a colour.
19
+ *
20
+ * Named the way every other tone in the library is, so a kind picks
21
+ * "informational" and the theme decides what that looks like - a kind
22
+ * carrying `#d19a66` would be a kind that looks wrong in half the themes.
23
+ */
24
+ tone?: SemanticVariant;
25
+ /** MIME types this kind claims. */
26
+ mimeTypes?: string[];
27
+ /** Filename globs this kind claims. */
28
+ extensions?: string[];
29
+ /** Kinds this one specialises. `file.markdown` extends `file.text`. */
30
+ extends?: string;
31
+ /** Higher wins when several kinds match. */
32
+ priority?: number;
33
+ /** Last word on ambiguous matches. */
34
+ detect?(uri: ResourceURI, meta: ResourceMetadata): boolean;
35
+ }
36
+ export interface ResourceMetadata {
37
+ name: string;
38
+ size?: number;
39
+ modified?: number;
40
+ created?: number;
41
+ mimeType?: string;
42
+ readonly?: boolean;
43
+ /** Provider-specific extras. */
44
+ [key: string]: unknown;
45
+ }
46
+ /**
47
+ * What a *resource* can have done to it - not what its provider implements.
48
+ *
49
+ * Per resource on purpose: a read-only mount, a file the user has no
50
+ * permission on, and something inherently immutable all come back the same
51
+ * shape, and a caller deciding whether to offer Delete should never have to
52
+ * know which of the three it is looking at.
53
+ *
54
+ * This is what to ask before calling; the registry method still throws if the
55
+ * answer changed in between. `stream` is the odd one - declarative only, no
56
+ * registry method reads it. It stays for a log provider to claim, and comes
57
+ * out if none does.
58
+ */
59
+ export type ResourceCapability = 'read' | 'write' | 'delete' | 'rename' | 'list' | 'watch' | 'stream';
60
+ export interface Resource {
61
+ uri: ResourceURI;
62
+ kind: string;
63
+ metadata: ResourceMetadata;
64
+ capabilities: ResourceCapability[];
65
+ }
66
+ /** Where resources come from. One per URI scheme. */
67
+ export interface ResourceProvider {
68
+ scheme: string;
69
+ stat(uri: ResourceURI): Promise<Resource | null>;
70
+ list?(uri: ResourceURI): Promise<Resource[]>;
71
+ read?(uri: ResourceURI): Promise<string | Uint8Array>;
72
+ write?(uri: ResourceURI, content: string | Uint8Array): Promise<void>;
73
+ delete?(uri: ResourceURI): Promise<void>;
74
+ rename?(from: ResourceURI, to: ResourceURI): Promise<void>;
75
+ watch?(uri: ResourceURI, fn: (event: 'change' | 'create' | 'delete') => void): Disposable;
76
+ }
77
+ /** A component that can display one kind of resource. */
78
+ export interface ResourceViewerDefinition {
79
+ id: string;
80
+ title: string;
81
+ kinds: string[];
82
+ /** Component name; receives `{ resource, content }`. */
83
+ component: string;
84
+ icon?: string;
85
+ /** As on a kind. A renderer that declares one speaks for what it opens. */
86
+ tone?: SemanticVariant;
87
+ priority?: number;
88
+ when?: WhenClause;
89
+ /** Accept anything no specific viewer claims. */
90
+ fallback?: boolean;
91
+ }
92
+ export interface ResourceEditorDefinition extends ResourceViewerDefinition {
93
+ /** Editors must be able to hand back new content. */
94
+ saves: true;
95
+ }
96
+ export interface ResourceActionDefinition {
97
+ id: string;
98
+ title: string;
99
+ kinds: string[];
100
+ icon?: string;
101
+ when?: WhenClause;
102
+ /** Where the action offers itself: 'context', 'toolbar', 'palette'. */
103
+ slots?: string[];
104
+ priority?: number;
105
+ run: CommandHandler;
106
+ }
107
+ export interface ResourceRegistry {
108
+ registerKind(kind: ResourceKind): Disposable;
109
+ registerProvider(provider: ResourceProvider): Disposable;
110
+ registerViewer(def: ResourceViewerDefinition): Disposable;
111
+ registerEditor(def: ResourceEditorDefinition): Disposable;
112
+ registerAction(def: ResourceActionDefinition): Disposable;
113
+ kinds(): ResourceKind[];
114
+ /** Classify a resource: extension, then mime, then `detect`, then parent. */
115
+ detectKind(uri: ResourceURI, meta?: ResourceMetadata): string;
116
+ /** True when `kind` is `ancestor` or specialises it. */
117
+ kindMatches(kind: string, ancestor: string): boolean;
118
+ stat(uri: ResourceURI): Promise<Resource | null>;
119
+ list(uri: ResourceURI): Promise<Resource[]>;
120
+ read(uri: ResourceURI): Promise<string | Uint8Array>;
121
+ write(uri: ResourceURI, content: string | Uint8Array): Promise<void>;
122
+ /** Throws when the provider cannot. Ask `Resource.capabilities` first. */
123
+ delete(uri: ResourceURI): Promise<void>;
124
+ /** Within one scheme. Across two it throws - that is a copy and a delete. */
125
+ rename(from: ResourceURI, to: ResourceURI): Promise<void>;
126
+ /** A provider that cannot watch gives back a disposable that does nothing. */
127
+ watch(uri: ResourceURI, fn: (event: 'change' | 'create' | 'delete') => void): Disposable;
128
+ viewersFor(kind: string): ResourceViewerDefinition[];
129
+ editorsFor(kind: string): ResourceEditorDefinition[];
130
+ /** Every renderer for this kind - editors, viewers and openers - best first. */
131
+ renderersFor(kind: string): ResourceRendererDefinition[];
132
+ /**
133
+ * The icon and tone for a resource: the renderer that opens it, then the
134
+ * kind and whatever it extends. Empty when nobody has said.
135
+ */
136
+ appearanceOf(resource: {
137
+ kind: string;
138
+ }): {
139
+ icon?: string;
140
+ tone?: SemanticVariant;
141
+ };
142
+ actionsFor(kind: string, slot?: string): ResourceActionDefinition[];
143
+ /** The node that displays this resource, viewer chosen by the registry. */
144
+ nodeFor(resource: Resource, options?: {
145
+ viewerId?: string;
146
+ mode?: 'view' | 'edit';
147
+ }): ComponentNode | null;
148
+ }
149
+ /**
150
+ * One way of showing a resource.
151
+ *
152
+ * A viewer, an editor and a component that declared `opens` are three ways of
153
+ * registering the same thing: a component that can put this kind on screen.
154
+ * A panel wants the list, not the three lists - which one saves is a property
155
+ * of the renderer, not a different registry.
156
+ */
157
+ export interface ResourceRendererDefinition {
158
+ id: string;
159
+ title: string;
160
+ kinds: string[];
161
+ component: string;
162
+ icon?: string;
163
+ /** As on a kind. A renderer that declares one speaks for what it opens. */
164
+ tone?: SemanticVariant;
165
+ priority?: number;
166
+ when?: WhenClause;
167
+ /** True when this renderer can write the resource back. */
168
+ saves?: boolean;
169
+ }
170
+ //# sourceMappingURL=resource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/types/resource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AAEjC,MAAM,WAAW,YAAY;IAC3B,2D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UAAU,CAAC;IAClB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ import type { Disposable } from './disposable.js';
2
+ /**
3
+ * A service key is a typed token. This is a lookup table with types, not a
4
+ * dependency-injection container - there is no lifecycle, no scoping and no
5
+ * auto-wiring, on purpose.
6
+ */
7
+ export interface ServiceKey<T> {
8
+ readonly id: string;
9
+ /** Never present at runtime; carries the type. */
10
+ readonly __type?: T;
11
+ }
12
+ export declare function serviceKey<T>(id: string): ServiceKey<T>;
13
+ export interface ServiceContainer {
14
+ provide<T>(key: ServiceKey<T>, value: T): Disposable;
15
+ /** Created on first use. */
16
+ provideLazy<T>(key: ServiceKey<T>, factory: () => T): Disposable;
17
+ get<T>(key: ServiceKey<T>): T | undefined;
18
+ /** Throws with the key id when missing - a clear programmer error. */
19
+ require<T>(key: ServiceKey<T>): T;
20
+ has<T>(key: ServiceKey<T>): boolean;
21
+ /** A child container that falls back to this one. */
22
+ child(): ServiceContainer;
23
+ }
24
+ //# sourceMappingURL=services.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/types/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD;;;;GAIG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;CACrB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,CAEvD;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,UAAU,CAAC;IACrD,4BAA4B;IAC5B,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,UAAU,CAAC;IACjE,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC1C,sEAAsE;IACtE,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAClC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;IACpC,qDAAqD;IACrD,KAAK,IAAI,gBAAgB,CAAC;CAC3B"}
@@ -0,0 +1,3 @@
1
+ export function serviceKey(id) {
2
+ return { id };
3
+ }
@@ -0,0 +1,32 @@
1
+ import type { Disposable } from './disposable.js';
2
+ import type { SurfaceName } from './surface.js';
3
+ /**
4
+ * The shell is the frame around the surfaces. Where it puts them is the whole
5
+ * of what a shell decides - which is why the same application renders as a
6
+ * dense bordered console, an airy borderless report or a full workbench by
7
+ * changing one registration.
8
+ */
9
+ export interface ShellDefinition {
10
+ id: string;
11
+ title: string;
12
+ description?: string;
13
+ /** Component name; receives `{ surfaces, renderSurface }`. */
14
+ component: string;
15
+ /** Surfaces this shell renders. Others stay unmounted. */
16
+ surfaces?: SurfaceName[];
17
+ /** Default theme id this shell was designed against. */
18
+ theme?: string;
19
+ /** Below this width or height the shell is not offered. */
20
+ minSize?: {
21
+ width?: number;
22
+ height?: number;
23
+ };
24
+ }
25
+ export interface ShellRegistry {
26
+ register(def: ShellDefinition): Disposable;
27
+ get(id: string): ShellDefinition | undefined;
28
+ list(): ShellDefinition[];
29
+ /** Shells that fit the current terminal, best first. */
30
+ suitable(width: number, height: number): ShellDefinition[];
31
+ }
32
+ //# sourceMappingURL=shell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/types/shell.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/C;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,eAAe,GAAG,UAAU,CAAC;IAC3C,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAC;IAC7C,IAAI,IAAI,eAAe,EAAE,CAAC;IAC1B,wDAAwD;IACxD,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe,EAAE,CAAC;CAC5D"}
@@ -0,0 +1 @@
1
+ export {};