termcast 1.3.19 → 1.3.24

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 (412) hide show
  1. package/dist/ai.d.ts +104 -0
  2. package/dist/ai.d.ts.map +1 -0
  3. package/dist/ai.js +135 -0
  4. package/dist/ai.js.map +1 -0
  5. package/dist/apis/browser-extension.d.ts +18 -0
  6. package/dist/apis/browser-extension.d.ts.map +1 -0
  7. package/dist/apis/browser-extension.js +14 -0
  8. package/dist/apis/browser-extension.js.map +1 -0
  9. package/dist/apis/localstorage.d.ts.map +1 -1
  10. package/dist/apis/localstorage.js +4 -7
  11. package/dist/apis/localstorage.js.map +1 -1
  12. package/dist/apis/oauth.d.ts.map +1 -1
  13. package/dist/apis/oauth.js +5 -1
  14. package/dist/apis/oauth.js.map +1 -1
  15. package/dist/apis/preferences.d.ts.map +1 -1
  16. package/dist/apis/preferences.js +38 -19
  17. package/dist/apis/preferences.js.map +1 -1
  18. package/dist/build.d.ts.map +1 -1
  19. package/dist/build.js +2 -1
  20. package/dist/build.js.map +1 -1
  21. package/dist/cache.d.ts +32 -0
  22. package/dist/cache.d.ts.map +1 -0
  23. package/dist/cache.js +205 -0
  24. package/dist/cache.js.map +1 -0
  25. package/dist/cli.d.ts.map +1 -1
  26. package/dist/cli.js +69 -33
  27. package/dist/cli.js.map +1 -1
  28. package/dist/clipboard.d.ts +36 -0
  29. package/dist/clipboard.d.ts.map +1 -0
  30. package/dist/clipboard.js +154 -0
  31. package/dist/clipboard.js.map +1 -0
  32. package/dist/compile.d.ts.map +1 -1
  33. package/dist/compile.js +24 -6
  34. package/dist/compile.js.map +1 -1
  35. package/dist/components/actions.d.ts.map +1 -1
  36. package/dist/components/actions.js +56 -30
  37. package/dist/components/actions.js.map +1 -1
  38. package/dist/components/detail.d.ts.map +1 -1
  39. package/dist/components/detail.js +4 -0
  40. package/dist/components/detail.js.map +1 -1
  41. package/dist/components/dropdown.d.ts.map +1 -1
  42. package/dist/components/dropdown.js +38 -15
  43. package/dist/components/dropdown.js.map +1 -1
  44. package/dist/components/extension-preferences.d.ts.map +1 -1
  45. package/dist/components/extension-preferences.js +40 -13
  46. package/dist/components/extension-preferences.js.map +1 -1
  47. package/dist/components/form/checkbox.d.ts.map +1 -1
  48. package/dist/components/form/checkbox.js +5 -3
  49. package/dist/components/form/checkbox.js.map +1 -1
  50. package/dist/components/form/date-picker.d.ts.map +1 -1
  51. package/dist/components/form/date-picker.js +5 -3
  52. package/dist/components/form/date-picker.js.map +1 -1
  53. package/dist/components/form/description.d.ts.map +1 -1
  54. package/dist/components/form/description.js +2 -2
  55. package/dist/components/form/description.js.map +1 -1
  56. package/dist/components/form/dropdown.d.ts.map +1 -1
  57. package/dist/components/form/dropdown.js +84 -80
  58. package/dist/components/form/dropdown.js.map +1 -1
  59. package/dist/components/form/file-autocomplete.d.ts +3 -6
  60. package/dist/components/form/file-autocomplete.d.ts.map +1 -1
  61. package/dist/components/form/file-autocomplete.js +61 -66
  62. package/dist/components/form/file-autocomplete.js.map +1 -1
  63. package/dist/components/form/file-picker.d.ts.map +1 -1
  64. package/dist/components/form/file-picker.js +33 -30
  65. package/dist/components/form/file-picker.js.map +1 -1
  66. package/dist/components/form/form-end.d.ts.map +1 -1
  67. package/dist/components/form/form-end.js +21 -1
  68. package/dist/components/form/form-end.js.map +1 -1
  69. package/dist/components/form/form-type-only.d.ts +174 -0
  70. package/dist/components/form/form-type-only.d.ts.map +1 -0
  71. package/dist/components/form/form-type-only.js +2 -0
  72. package/dist/components/form/form-type-only.js.map +1 -0
  73. package/dist/components/form/index.d.ts +3 -1
  74. package/dist/components/form/index.d.ts.map +1 -1
  75. package/dist/components/form/index.js +100 -28
  76. package/dist/components/form/index.js.map +1 -1
  77. package/dist/components/form/password-field.d.ts.map +1 -1
  78. package/dist/components/form/password-field.js +5 -3
  79. package/dist/components/form/password-field.js.map +1 -1
  80. package/dist/components/form/text-area.d.ts.map +1 -1
  81. package/dist/components/form/text-area.js +5 -3
  82. package/dist/components/form/text-area.js.map +1 -1
  83. package/dist/components/form/text-field.d.ts.map +1 -1
  84. package/dist/components/form/text-field.js +6 -4
  85. package/dist/components/form/text-field.js.map +1 -1
  86. package/dist/components/form/types.d.ts +5 -0
  87. package/dist/components/form/types.d.ts.map +1 -1
  88. package/dist/components/form/use-form-handling.d.ts +4 -0
  89. package/dist/components/form/use-form-handling.d.ts.map +1 -0
  90. package/dist/components/form/use-form-handling.js +37 -0
  91. package/dist/components/form/use-form-handling.js.map +1 -0
  92. package/dist/components/form/with-left-border.d.ts +2 -1
  93. package/dist/components/form/with-left-border.d.ts.map +1 -1
  94. package/dist/components/form/with-left-border.js +27 -3
  95. package/dist/components/form/with-left-border.js.map +1 -1
  96. package/dist/components/icon.d.ts +1 -0
  97. package/dist/components/icon.d.ts.map +1 -1
  98. package/dist/components/icon.js +24 -8
  99. package/dist/components/icon.js.map +1 -1
  100. package/dist/components/list.d.ts +2 -2
  101. package/dist/components/list.d.ts.map +1 -1
  102. package/dist/components/list.js +140 -62
  103. package/dist/components/list.js.map +1 -1
  104. package/dist/components/loading-bar.d.ts.map +1 -1
  105. package/dist/components/loading-bar.js +2 -2
  106. package/dist/components/loading-bar.js.map +1 -1
  107. package/dist/components/loading-text.d.ts +8 -0
  108. package/dist/components/loading-text.d.ts.map +1 -0
  109. package/dist/components/loading-text.js +58 -0
  110. package/dist/components/loading-text.js.map +1 -0
  111. package/dist/descendants.js +1 -1
  112. package/dist/descendants.js.map +1 -1
  113. package/dist/dev-ui.d.ts +7 -0
  114. package/dist/dev-ui.d.ts.map +1 -0
  115. package/dist/dev-ui.js +118 -0
  116. package/dist/dev-ui.js.map +1 -0
  117. package/dist/environment.d.ts +63 -0
  118. package/dist/environment.d.ts.map +1 -0
  119. package/dist/environment.js +189 -0
  120. package/dist/environment.js.map +1 -0
  121. package/dist/examples/datepicker.d.ts +2 -0
  122. package/dist/examples/datepicker.d.ts.map +1 -0
  123. package/dist/examples/datepicker.js +344 -0
  124. package/dist/examples/datepicker.js.map +1 -0
  125. package/dist/examples/file-autocomplete.vitest.d.ts +2 -0
  126. package/dist/examples/file-autocomplete.vitest.d.ts.map +1 -0
  127. package/dist/examples/file-autocomplete.vitest.js +223 -0
  128. package/dist/examples/file-autocomplete.vitest.js.map +1 -0
  129. package/dist/examples/form-basic-arrow-keys.vitest.d.ts +2 -0
  130. package/dist/examples/form-basic-arrow-keys.vitest.d.ts.map +1 -0
  131. package/dist/examples/form-basic-arrow-keys.vitest.js +46 -0
  132. package/dist/examples/form-basic-arrow-keys.vitest.js.map +1 -0
  133. package/dist/examples/form-basic.vitest.d.ts +2 -0
  134. package/dist/examples/form-basic.vitest.d.ts.map +1 -0
  135. package/dist/examples/form-basic.vitest.js +630 -0
  136. package/dist/examples/form-basic.vitest.js.map +1 -0
  137. package/dist/examples/form-dropdown-with-sections.d.ts +2 -0
  138. package/dist/examples/form-dropdown-with-sections.d.ts.map +1 -0
  139. package/dist/examples/form-dropdown-with-sections.js +13 -0
  140. package/dist/examples/form-dropdown-with-sections.js.map +1 -0
  141. package/dist/examples/form-dropdown-with-sections.vitest.d.ts +2 -0
  142. package/dist/examples/form-dropdown-with-sections.vitest.d.ts.map +1 -0
  143. package/dist/examples/form-dropdown-with-sections.vitest.js +75 -0
  144. package/dist/examples/form-dropdown-with-sections.vitest.js.map +1 -0
  145. package/dist/examples/form-dropdown.vitest.d.ts +2 -0
  146. package/dist/examples/form-dropdown.vitest.d.ts.map +1 -0
  147. package/dist/examples/form-dropdown.vitest.js +854 -0
  148. package/dist/examples/form-dropdown.vitest.js.map +1 -0
  149. package/dist/examples/form-multiselect-dropdown.d.ts +2 -0
  150. package/dist/examples/form-multiselect-dropdown.d.ts.map +1 -0
  151. package/dist/examples/form-multiselect-dropdown.js +13 -0
  152. package/dist/examples/form-multiselect-dropdown.js.map +1 -0
  153. package/dist/examples/form-scroll.d.ts.map +1 -1
  154. package/dist/examples/form-scroll.js +7 -1
  155. package/dist/examples/form-scroll.js.map +1 -1
  156. package/dist/examples/form-scroll.vitest.d.ts +2 -0
  157. package/dist/examples/form-scroll.vitest.d.ts.map +1 -0
  158. package/dist/examples/form-scroll.vitest.js +211 -0
  159. package/dist/examples/form-scroll.vitest.js.map +1 -0
  160. package/dist/examples/form-tagpicker.vitest.d.ts +2 -0
  161. package/dist/examples/form-tagpicker.vitest.d.ts.map +1 -0
  162. package/dist/examples/form-tagpicker.vitest.js +736 -0
  163. package/dist/examples/form-tagpicker.vitest.js.map +1 -0
  164. package/dist/examples/internal/descendants-filtering.js +1 -1
  165. package/dist/examples/internal/descendants-filtering.js.map +1 -1
  166. package/dist/examples/internal/descendants.js +1 -1
  167. package/dist/examples/internal/descendants.js.map +1 -1
  168. package/dist/examples/internal/nested-boxes.d.ts +2 -0
  169. package/dist/examples/internal/nested-boxes.d.ts.map +1 -0
  170. package/dist/examples/internal/nested-boxes.js +7 -0
  171. package/dist/examples/internal/nested-boxes.js.map +1 -0
  172. package/dist/examples/internal/rhf-custom-ref.js +2 -2
  173. package/dist/examples/internal/rhf-custom-ref.js.map +1 -1
  174. package/dist/examples/internal/scrollbox-demo.js +3 -22
  175. package/dist/examples/internal/scrollbox-demo.js.map +1 -1
  176. package/dist/examples/internal/scrollbox-descendants.d.ts +2 -0
  177. package/dist/examples/internal/scrollbox-descendants.d.ts.map +1 -0
  178. package/dist/examples/internal/scrollbox-descendants.js +83 -0
  179. package/dist/examples/internal/scrollbox-descendants.js.map +1 -0
  180. package/dist/examples/internal/scrollbox-with-descendants.js +4 -8
  181. package/dist/examples/internal/scrollbox-with-descendants.js.map +1 -1
  182. package/dist/examples/internal/simple-scrollbox.vitest.d.ts +2 -0
  183. package/dist/examples/internal/simple-scrollbox.vitest.d.ts.map +1 -0
  184. package/dist/examples/internal/simple-scrollbox.vitest.js +96 -0
  185. package/dist/examples/internal/simple-scrollbox.vitest.js.map +1 -0
  186. package/dist/examples/internal/unicode-square-repro.d.ts +2 -0
  187. package/dist/examples/internal/unicode-square-repro.d.ts.map +1 -0
  188. package/dist/examples/internal/unicode-square-repro.js +7 -0
  189. package/dist/examples/internal/unicode-square-repro.js.map +1 -0
  190. package/dist/examples/list-detail-metadata.d.ts +2 -0
  191. package/dist/examples/list-detail-metadata.d.ts.map +1 -0
  192. package/dist/examples/list-detail-metadata.js +8 -0
  193. package/dist/examples/list-detail-metadata.js.map +1 -0
  194. package/dist/examples/list-dropdown-default.vitest.d.ts +2 -0
  195. package/dist/examples/list-dropdown-default.vitest.d.ts.map +1 -0
  196. package/dist/examples/list-dropdown-default.vitest.js +234 -0
  197. package/dist/examples/list-dropdown-default.vitest.js.map +1 -0
  198. package/dist/examples/list-fetch-data.vitest.d.ts +2 -0
  199. package/dist/examples/list-fetch-data.vitest.d.ts.map +1 -0
  200. package/dist/examples/list-fetch-data.vitest.js +111 -0
  201. package/dist/examples/list-fetch-data.vitest.js.map +1 -0
  202. package/dist/examples/list-filter-navigation.d.ts +2 -0
  203. package/dist/examples/list-filter-navigation.d.ts.map +1 -0
  204. package/dist/examples/list-filter-navigation.js +8 -0
  205. package/dist/examples/list-filter-navigation.js.map +1 -0
  206. package/dist/examples/list-scrollbox.vitest.d.ts +2 -0
  207. package/dist/examples/list-scrollbox.vitest.d.ts.map +1 -0
  208. package/dist/examples/list-scrollbox.vitest.js +93 -0
  209. package/dist/examples/list-scrollbox.vitest.js.map +1 -0
  210. package/dist/examples/list-with-detail-long.d.ts +2 -0
  211. package/dist/examples/list-with-detail-long.d.ts.map +1 -0
  212. package/dist/examples/list-with-detail-long.js +53 -0
  213. package/dist/examples/list-with-detail-long.js.map +1 -0
  214. package/dist/examples/list-with-detail.vitest.d.ts +2 -0
  215. package/dist/examples/list-with-detail.vitest.d.ts.map +1 -0
  216. package/dist/examples/list-with-detail.vitest.js +434 -0
  217. package/dist/examples/list-with-detail.vitest.js.map +1 -0
  218. package/dist/examples/list-with-dropdown.vitest.d.ts +2 -0
  219. package/dist/examples/list-with-dropdown.vitest.d.ts.map +1 -0
  220. package/dist/examples/list-with-dropdown.vitest.js +337 -0
  221. package/dist/examples/list-with-dropdown.vitest.js.map +1 -0
  222. package/dist/examples/list-with-sections.js +5 -1
  223. package/dist/examples/list-with-sections.js.map +1 -1
  224. package/dist/examples/list-with-sections.vitest.d.ts +2 -0
  225. package/dist/examples/list-with-sections.vitest.d.ts.map +1 -0
  226. package/dist/examples/list-with-sections.vitest.js +601 -0
  227. package/dist/examples/list-with-sections.vitest.js.map +1 -0
  228. package/dist/examples/scrollbox-vertical-centering.d.ts +6 -0
  229. package/dist/examples/scrollbox-vertical-centering.d.ts.map +1 -0
  230. package/dist/examples/scrollbox-vertical-centering.js +17 -0
  231. package/dist/examples/scrollbox-vertical-centering.js.map +1 -0
  232. package/dist/examples/simple-file-picker.vitest.d.ts +2 -0
  233. package/dist/examples/simple-file-picker.vitest.d.ts.map +1 -0
  234. package/dist/examples/simple-file-picker.vitest.js +678 -0
  235. package/dist/examples/simple-file-picker.vitest.js.map +1 -0
  236. package/dist/examples/simple-grid.vitest.d.ts +2 -0
  237. package/dist/examples/simple-grid.vitest.d.ts.map +1 -0
  238. package/dist/examples/simple-grid.vitest.js +521 -0
  239. package/dist/examples/simple-grid.vitest.js.map +1 -0
  240. package/dist/examples/simple-navigation.js +10 -4
  241. package/dist/examples/simple-navigation.js.map +1 -1
  242. package/dist/examples/simple-navigation.vitest.d.ts +2 -0
  243. package/dist/examples/simple-navigation.vitest.d.ts.map +1 -0
  244. package/dist/examples/simple-navigation.vitest.js +718 -0
  245. package/dist/examples/simple-navigation.vitest.js.map +1 -0
  246. package/dist/examples/store.vitest.d.ts +2 -0
  247. package/dist/examples/store.vitest.d.ts.map +1 -0
  248. package/dist/examples/store.vitest.js +69 -0
  249. package/dist/examples/store.vitest.js.map +1 -0
  250. package/dist/extensions/dev.d.ts +4 -2
  251. package/dist/extensions/dev.d.ts.map +1 -1
  252. package/dist/extensions/dev.js +61 -10
  253. package/dist/extensions/dev.js.map +1 -1
  254. package/dist/extensions/dev.vitest.d.ts +2 -0
  255. package/dist/extensions/dev.vitest.d.ts.map +1 -0
  256. package/dist/extensions/dev.vitest.js +197 -0
  257. package/dist/extensions/dev.vitest.js.map +1 -0
  258. package/dist/extensions/home.d.ts.map +1 -1
  259. package/dist/extensions/home.js +3 -0
  260. package/dist/extensions/home.js.map +1 -1
  261. package/dist/home-command.d.ts +8 -0
  262. package/dist/home-command.d.ts.map +1 -0
  263. package/dist/home-command.js +181 -0
  264. package/dist/home-command.js.map +1 -0
  265. package/dist/hover-repro.d.ts +2 -0
  266. package/dist/hover-repro.d.ts.map +1 -0
  267. package/dist/hover-repro.js +20 -0
  268. package/dist/hover-repro.js.map +1 -0
  269. package/dist/index.d.ts +1 -0
  270. package/dist/index.d.ts.map +1 -1
  271. package/dist/index.js +2 -0
  272. package/dist/index.js.map +1 -1
  273. package/dist/internal/dialog.d.ts +1 -0
  274. package/dist/internal/dialog.d.ts.map +1 -1
  275. package/dist/internal/dialog.js +27 -18
  276. package/dist/internal/dialog.js.map +1 -1
  277. package/dist/internal/navigation.d.ts +9 -1
  278. package/dist/internal/navigation.d.ts.map +1 -1
  279. package/dist/internal/navigation.js +5 -5
  280. package/dist/internal/navigation.js.map +1 -1
  281. package/dist/internal/offscreen.d.ts +6 -0
  282. package/dist/internal/offscreen.d.ts.map +1 -0
  283. package/dist/internal/offscreen.js +10 -0
  284. package/dist/internal/offscreen.js.map +1 -0
  285. package/dist/internal/providers.d.ts.map +1 -1
  286. package/dist/internal/providers.js +2 -2
  287. package/dist/internal/providers.js.map +1 -1
  288. package/dist/internal/scrollbox.d.ts +1 -10
  289. package/dist/internal/scrollbox.d.ts.map +1 -1
  290. package/dist/internal/scrollbox.js +2 -1
  291. package/dist/internal/scrollbox.js.map +1 -1
  292. package/dist/localstorage.d.ts +13 -0
  293. package/dist/localstorage.d.ts.map +1 -0
  294. package/dist/localstorage.js +190 -0
  295. package/dist/localstorage.js.map +1 -0
  296. package/dist/oauth.d.ts +142 -0
  297. package/dist/oauth.d.ts.map +1 -0
  298. package/dist/oauth.js +551 -0
  299. package/dist/oauth.js.map +1 -0
  300. package/dist/preferences.d.ts +23 -0
  301. package/dist/preferences.d.ts.map +1 -0
  302. package/dist/preferences.js +105 -0
  303. package/dist/preferences.js.map +1 -0
  304. package/dist/state.d.ts +2 -0
  305. package/dist/state.d.ts.map +1 -1
  306. package/dist/state.js +3 -0
  307. package/dist/state.js.map +1 -1
  308. package/dist/store.d.ts +21 -0
  309. package/dist/store.d.ts.map +1 -0
  310. package/dist/store.js +84 -0
  311. package/dist/store.js.map +1 -0
  312. package/dist/swift-loader.d.ts +3 -0
  313. package/dist/swift-loader.d.ts.map +1 -0
  314. package/dist/swift-loader.js +193 -0
  315. package/dist/swift-loader.js.map +1 -0
  316. package/dist/swift-runtime.d.ts +2 -0
  317. package/dist/swift-runtime.d.ts.map +1 -0
  318. package/dist/swift-runtime.js +27 -0
  319. package/dist/swift-runtime.js.map +1 -0
  320. package/dist/toast.d.ts +44 -0
  321. package/dist/toast.d.ts.map +1 -0
  322. package/dist/toast.js +221 -0
  323. package/dist/toast.js.map +1 -0
  324. package/dist/utils/file-system.d.ts +9 -0
  325. package/dist/utils/file-system.d.ts.map +1 -1
  326. package/dist/utils/file-system.js +49 -0
  327. package/dist/utils/file-system.js.map +1 -1
  328. package/dist/utils/run-command.d.ts +25 -1
  329. package/dist/utils/run-command.d.ts.map +1 -1
  330. package/dist/utils/run-command.js +47 -4
  331. package/dist/utils/run-command.js.map +1 -1
  332. package/dist/window.d.ts +12 -0
  333. package/dist/window.d.ts.map +1 -0
  334. package/dist/window.js +48 -0
  335. package/dist/window.js.map +1 -0
  336. package/package.json +13 -11
  337. package/src/apis/browser-extension.tsx +29 -0
  338. package/src/apis/localstorage.test.ts +14 -6
  339. package/src/apis/localstorage.tsx +8 -5
  340. package/src/apis/oauth.tsx +5 -1
  341. package/src/apis/preferences.tsx +48 -22
  342. package/src/build.test.tsx +52 -0
  343. package/src/build.tsx +2 -1
  344. package/src/cli.tsx +80 -39
  345. package/src/compile.tsx +24 -6
  346. package/src/components/actions.tsx +94 -32
  347. package/src/components/detail.tsx +4 -0
  348. package/src/components/dropdown.tsx +47 -14
  349. package/src/components/extension-preferences.tsx +44 -16
  350. package/src/components/form/checkbox.tsx +12 -6
  351. package/src/components/form/date-picker.tsx +12 -6
  352. package/src/components/form/description.tsx +7 -2
  353. package/src/components/form/dropdown.tsx +131 -119
  354. package/src/components/form/file-autocomplete.tsx +90 -108
  355. package/src/components/form/file-picker.tsx +54 -43
  356. package/src/components/form/form-end.tsx +23 -2
  357. package/src/components/form/index.tsx +152 -34
  358. package/src/components/form/password-field.tsx +12 -6
  359. package/src/components/form/text-area.tsx +13 -6
  360. package/src/components/form/text-field.tsx +13 -6
  361. package/src/components/form/types.tsx +6 -0
  362. package/src/components/form/with-left-border.tsx +41 -8
  363. package/src/components/icon.tsx +27 -8
  364. package/src/components/list.tsx +193 -74
  365. package/src/components/loading-bar.tsx +3 -2
  366. package/src/components/loading-text.tsx +79 -0
  367. package/src/descendants.tsx +1 -0
  368. package/src/examples/file-autocomplete.vitest.tsx +130 -125
  369. package/src/examples/form-basic.vitest.tsx +376 -176
  370. package/src/examples/form-dropdown.vitest.tsx +126 -126
  371. package/src/examples/form-scroll.tsx +2 -0
  372. package/src/examples/form-scroll.vitest.tsx +58 -58
  373. package/src/examples/form-tagpicker.vitest.tsx +99 -99
  374. package/src/examples/internal/descendants-filtering.tsx +1 -0
  375. package/src/examples/internal/descendants.tsx +1 -0
  376. package/src/examples/internal/rhf-custom-ref.tsx +2 -0
  377. package/src/examples/internal/scrollbox-demo.tsx +3 -27
  378. package/src/examples/internal/scrollbox-with-descendants.tsx +4 -7
  379. package/src/examples/internal/simple-scrollbox.vitest.tsx +7 -5
  380. package/src/examples/list-detail-metadata.tsx +49 -0
  381. package/src/examples/list-detail-metadata.vitest.tsx +88 -0
  382. package/src/examples/list-dropdown-default.vitest.tsx +51 -51
  383. package/src/examples/list-fetch-data.vitest.tsx +4 -4
  384. package/src/examples/list-scrollbox.vitest.tsx +73 -14
  385. package/src/examples/list-with-detail-long.tsx +70 -0
  386. package/src/examples/list-with-detail.vitest.tsx +198 -92
  387. package/src/examples/list-with-dropdown.vitest.tsx +53 -53
  388. package/src/examples/list-with-sections.tsx +1 -0
  389. package/src/examples/list-with-sections.vitest.tsx +213 -89
  390. package/src/examples/list-with-toast.vitest.tsx +4 -4
  391. package/src/examples/simple-file-picker.vitest.tsx +61 -471
  392. package/src/examples/simple-grid.vitest.tsx +238 -233
  393. package/src/examples/simple-navigation.tsx +15 -7
  394. package/src/examples/simple-navigation.vitest.tsx +121 -210
  395. package/src/examples/store.vitest.tsx +1 -1
  396. package/src/examples/swift-extension.vitest.tsx +148 -0
  397. package/src/examples/synonyms.vitest.tsx +159 -0
  398. package/src/extensions/dev.tsx +74 -7
  399. package/src/extensions/dev.vitest.tsx +97 -31
  400. package/src/extensions/home.tsx +6 -0
  401. package/src/index.tsx +3 -0
  402. package/src/internal/dialog.tsx +43 -30
  403. package/src/internal/navigation.tsx +3 -1
  404. package/src/internal/offscreen.tsx +15 -0
  405. package/src/internal/providers.tsx +4 -2
  406. package/src/internal/scrollbox.tsx +4 -8
  407. package/src/keyboard.test.tsx +69 -0
  408. package/src/state.tsx +7 -0
  409. package/src/swift-loader.tsx +239 -0
  410. package/src/swift-runtime.tsx +36 -0
  411. package/src/utils/file-system.ts +61 -0
  412. package/src/utils/run-command.tsx +75 -6
@@ -6,14 +6,31 @@ import { useFormContext, Controller } from 'react-hook-form';
6
6
  import { useFocusContext, useFormFieldDescendant } from './index';
7
7
  import { useKeyboard } from '@opentui/react';
8
8
  import { useIsInFocus } from 'termcast/src/internal/focus-context';
9
- import { FileAutocomplete } from './file-autocomplete';
9
+ import { FileAutocompleteDialog } from './file-autocomplete';
10
10
  import { useFormNavigationHelpers } from './use-form-navigation';
11
- const FilePickerField = ({ field, fieldState, formState, props, isFocused, setFocusedField, }) => {
11
+ import { useDialog } from 'termcast/src/internal/dialog';
12
+ import { LoadingText } from 'termcast/src/components/loading-text';
13
+ const FilePickerField = ({ field, fieldState, formState, props, isFocused, setFocusedField, isFormLoading, }) => {
12
14
  const isInFocus = useIsInFocus();
13
- const [showAutocomplete, setShowAutocomplete] = React.useState(false);
14
- const [searchTrigger, setSearchTrigger] = React.useState(0);
15
15
  const inputRef = React.useRef(null);
16
- const anchorRef = React.useRef(null);
16
+ const dialog = useDialog();
17
+ const showAutocomplete = () => {
18
+ if (dialog.stack.length > 0)
19
+ return;
20
+ const handleSelect = (path) => {
21
+ const currentFiles = field.value || [];
22
+ const newFiles = props.allowMultipleSelection !== false ? [...currentFiles, path] : [path];
23
+ field.onChange(newFiles);
24
+ if (props.onChange) {
25
+ props.onChange(newFiles);
26
+ }
27
+ inputRef.current?.setText('');
28
+ dialog.clear();
29
+ };
30
+ dialog.push(_jsx(FileAutocompleteDialog, { onSelect: handleSelect, onClose: () => {
31
+ dialog.clear();
32
+ }, inputRef: inputRef, canChooseFiles: props.canChooseFiles, canChooseDirectories: props.canChooseDirectories, initialDirectory: props.initialDirectory }));
33
+ };
17
34
  // Handle Enter key and left arrow for removing last file
18
35
  useKeyboard((evt) => {
19
36
  if (!isFocused || !isInFocus)
@@ -33,12 +50,11 @@ const FilePickerField = ({ field, fieldState, formState, props, isFocused, setFo
33
50
  if (evt.name === 'return') {
34
51
  const inputValue = inputRef.current?.plainText || '';
35
52
  // If input is empty, show files in current directory
36
- if (!inputValue && !showAutocomplete) {
37
- setShowAutocomplete(true);
38
- setSearchTrigger((n) => n + 1);
53
+ if (!inputValue) {
54
+ showAutocomplete();
39
55
  }
40
- // If autocomplete is not visible and input has value, add the path
41
- else if (inputValue.trim() && !showAutocomplete) {
56
+ // If input has value, add the path directly
57
+ else if (inputValue.trim()) {
42
58
  const currentFiles = field.value || [];
43
59
  const newFiles = props.allowMultipleSelection !== false
44
60
  ? [...currentFiles, inputValue.trim()]
@@ -51,36 +67,23 @@ const FilePickerField = ({ field, fieldState, formState, props, isFocused, setFo
51
67
  }
52
68
  }
53
69
  });
54
- const handleSelectFile = (path) => {
55
- const currentFiles = field.value || [];
56
- const newFiles = props.allowMultipleSelection !== false ? [...currentFiles, path] : [path];
57
- field.onChange(newFiles);
58
- if (props.onChange) {
59
- props.onChange(newFiles);
60
- }
61
- inputRef.current?.setText('');
62
- setShowAutocomplete(false);
63
- };
64
70
  const selectedFiles = field.value || [];
65
- return (_jsxs("box", { flexDirection: 'column', children: [_jsx(WithLeftBorder, { withDiamond: true, isFocused: isFocused, children: _jsx("text", { fg: isFocused ? Theme.primary : Theme.text, onMouseDown: () => {
71
+ return (_jsxs("box", { flexDirection: 'column', children: [_jsx(WithLeftBorder, { withDiamond: true, isFocused: isFocused, isLoading: isFormLoading, children: _jsx("box", { onMouseDown: () => {
66
72
  setFocusedField(props.id);
67
- }, children: props.title || 'File Path' }) }), _jsx(WithLeftBorder, { isFocused: isFocused, children: _jsxs("box", { flexDirection: 'column', ref: anchorRef, children: [_jsx("textarea", { ref: inputRef, height: 1, keyBindings: [
73
+ }, children: _jsx(LoadingText, { isLoading: isFocused && isFormLoading, color: isFocused ? Theme.primary : Theme.text, children: props.title || 'File Path' }) }) }), _jsx(WithLeftBorder, { isFocused: isFocused, children: _jsxs("box", { flexDirection: 'column', children: [_jsx("textarea", { ref: inputRef, height: 1, wrapMode: 'none', keyBindings: [
68
74
  { name: 'return', action: 'submit' },
69
75
  { name: 'linefeed', action: 'submit' },
70
76
  ], initialValue: "", placeholder: props.placeholder || 'Enter file path...', focused: isFocused, onMouseDown: () => setFocusedField(props.id), onContentChange: () => {
71
77
  const value = inputRef.current?.plainText || '';
72
78
  if (value && isFocused) {
73
- setShowAutocomplete(true);
74
- setSearchTrigger((n) => n + 1);
75
- }
76
- else if (!value) {
77
- setShowAutocomplete(false);
79
+ showAutocomplete();
78
80
  }
79
- } }), selectedFiles.length > 0 && (_jsxs("box", { flexDirection: 'column', marginTop: 1, children: [_jsx("text", { fg: Theme.textMuted, children: "Selected files:" }), selectedFiles.map((file, index) => (_jsxs("text", { fg: Theme.text, children: ["\u2022 ", file] }, index)))] }))] }) }), (fieldState.error || props.error) && (_jsx(WithLeftBorder, { isFocused: isFocused, children: _jsx("text", { fg: Theme.error, children: fieldState.error?.message || props.error }) })), props.info && (_jsx(WithLeftBorder, { isFocused: isFocused, children: _jsx("text", { fg: Theme.textMuted, children: props.info }) })), _jsx(FileAutocomplete, { onSelect: handleSelectFile, visible: showAutocomplete, onVisibilityChange: setShowAutocomplete, inputRef: inputRef, anchorRef: anchorRef, searchTrigger: searchTrigger, canChooseFiles: props.canChooseFiles, canChooseDirectories: props.canChooseDirectories, initialDirectory: props.initialDirectory })] }));
81
+ } }), selectedFiles.length > 0 && (_jsxs("box", { flexDirection: 'column', marginTop: 1, children: [_jsx("text", { fg: Theme.textMuted, children: "Selected files:" }), selectedFiles.map((file, index) => (_jsxs("text", { fg: Theme.text, children: ["\u2022 ", file] }, index)))] }))] }) }), (fieldState.error || props.error) && (_jsx(WithLeftBorder, { isFocused: isFocused, children: _jsx("text", { fg: Theme.error, children: fieldState.error?.message || props.error }) })), props.info && (_jsx(WithLeftBorder, { isFocused: isFocused, children: _jsx("text", { fg: Theme.textMuted, children: props.info }) }))] }));
80
82
  };
81
83
  export const FilePicker = (props) => {
82
84
  const { control } = useFormContext();
83
- const { focusedField, setFocusedField } = useFocusContext();
85
+ const focusContext = useFocusContext();
86
+ const { focusedField, setFocusedField } = focusContext;
84
87
  const isFocused = focusedField === props.id;
85
88
  const isInFocus = useIsInFocus();
86
89
  const elementRef = useRef(null);
@@ -104,7 +107,7 @@ export const FilePicker = (props) => {
104
107
  }
105
108
  });
106
109
  return (_jsx(Controller, { name: props.id, control: control, defaultValue: props.defaultValue || props.value || [], render: (renderProps) => {
107
- return (_jsx("box", { ref: elementRef, flexDirection: 'column', children: _jsx(FilePickerField, { ...renderProps, props: props, isFocused: isFocused, setFocusedField: setFocusedField }) }));
110
+ return (_jsx("box", { ref: elementRef, flexDirection: 'column', children: _jsx(FilePickerField, { ...renderProps, props: props, isFocused: isFocused, setFocusedField: setFocusedField, isFormLoading: focusContext.isLoading }) }));
108
111
  } }));
109
112
  };
110
113
  //# sourceMappingURL=file-picker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-picker.js","sourceRoot":"","sources":["../../../src/components/form/file-picker.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAqChE,MAAM,eAAe,GAAG,CAAC,EACvB,KAAK,EACL,UAAU,EACV,SAAS,EACT,KAAK,EACL,SAAS,EACT,eAAe,GAQhB,EAAO,EAAE;IACR,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IACrE,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC3D,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAqB,IAAI,CAAC,CAAA;IACvD,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAM,IAAI,CAAC,CAAA;IAEzC,yDAAyD;IACzD,WAAW,C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AAC,GACD,CACH,CAAA;AACH,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"form-end.d.ts","sourceRoot":"","sources":["../../../src/components/form/form-end.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,QAAO,GAE1B,CAAA"}
1
+ {"version":3,"file":"form-end.d.ts","sourceRoot":"","sources":["../../../src/components/form/form-end.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO,QAAO,GAsB1B,CAAA"}
@@ -1,6 +1,26 @@
1
1
  import { jsx as _jsx } from "@opentui/react/jsx-runtime";
2
+ import { useState, useLayoutEffect } from 'react';
2
3
  import { Theme } from 'termcast/src/theme';
4
+ import { useFocusContext, useFormScrollContext } from './index';
3
5
  export const FormEnd = () => {
4
- return _jsx("text", { fg: Theme.text, children: "\u2514" });
6
+ const { focusedField } = useFocusContext();
7
+ const scrollContext = useFormScrollContext();
8
+ const [isLastFieldFocused, setIsLastFieldFocused] = useState(false);
9
+ useLayoutEffect(() => {
10
+ if (!scrollContext || !focusedField) {
11
+ setIsLastFieldFocused(false);
12
+ return;
13
+ }
14
+ const descendants = Object.values(scrollContext.descendantsContext.map.current)
15
+ .filter((item) => item.index !== -1 && item.props?.id)
16
+ .sort((a, b) => a.index - b.index);
17
+ if (descendants.length === 0) {
18
+ setIsLastFieldFocused(false);
19
+ return;
20
+ }
21
+ const lastField = descendants[descendants.length - 1];
22
+ setIsLastFieldFocused(lastField.props?.id === focusedField);
23
+ }, [focusedField]);
24
+ return _jsx("text", { fg: isLastFieldFocused ? Theme.accent : Theme.text, children: "\u2514" });
5
25
  };
6
26
  //# sourceMappingURL=form-end.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-end.js","sourceRoot":"","sources":["../../../src/components/form/form-end.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE1C,MAAM,CAAC,MAAM,OAAO,GAAG,GAAQ,EAAE;IAC/B,OAAO,eAAM,EA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ACrD,qBAAqB,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,KAAK,YAAY,CAAC,CAAA;IAC7D,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAA;IAElB,OAAO,eAAM,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,uBAAU,CAAA;AAC3E,CAAC,CAAA"}
@@ -0,0 +1,174 @@
1
+ import React from 'react';
2
+ import { FormEvent, FormEventType, FormItemRef, FormValue_2, FormValues_2, FormProps_2, FormItemProps_2 } from './types';
3
+ import type { TextFieldProps, TextFieldRef } from './text-field';
4
+ import type { PasswordFieldProps, PasswordFieldRef } from './password-field';
5
+ import type { TextAreaProps, TextAreaRef } from './text-area';
6
+ import type { CheckboxProps, CheckboxRef } from './checkbox';
7
+ import type { DropdownProps, DropdownRef, DropdownItemProps, DropdownSectionProps } from './dropdown';
8
+ import type { DatePickerProps, DatePickerRef, DatePickerType as DatePickerEnum } from './date-picker';
9
+ import type { TagPickerType } from './tagpicker';
10
+ import type { DescriptionProps } from './description';
11
+ import type { FilePickerProps, FilePickerRef } from './file-picker';
12
+ interface LinkAccessoryProps {
13
+ text: string;
14
+ url: string;
15
+ }
16
+ export declare namespace Form {
17
+ type ItemProps<T extends FormValue_2> = FormItemProps_2<T>;
18
+ type Value = FormValue_2;
19
+ type Values = FormValues_2;
20
+ type Props = FormProps_2 & {
21
+ searchBarAccessory?: React.ReactElement<LinkAccessoryProps> | undefined | null;
22
+ };
23
+ type ItemReference = FormItemRef;
24
+ /**
25
+ * An interface describing event in callbacks {@link Form.Item.Props.onFocus} and {@link Form.Item.Props.onBlur}
26
+ */
27
+ type Event<T extends FormValue_2> = FormEvent<T>;
28
+ namespace Event {
29
+ /**
30
+ * Types of Form event {@link Form.Event}
31
+ * * `focus` - the type will be returned for the event of {@link Form.Item.Props.onFocus} callback
32
+ * * `blur` - the type will be returned for the event of {@link Form.Item.Props.onBlur} callback
33
+ */
34
+ type Type = FormEventType;
35
+ }
36
+ /**
37
+ * A Ref Type for the {@link Form.TextField}.
38
+ * Use refs to control your Form by calling `Form.TextField.focus()` or `Form.TextField.reset()` functions.
39
+ */
40
+ type TextField = TextFieldRef;
41
+ namespace TextField {
42
+ /**
43
+ * Props of the {@link Form.TextField} React component.
44
+ */
45
+ type Props = TextFieldProps;
46
+ }
47
+ /**
48
+ * A Ref Type for the {@link Form.PasswordField}.
49
+ * Use refs to control your Form by calling `Form.PasswordField.focus()` or `Form.PasswordField.reset()` functions.
50
+ */
51
+ type PasswordField = PasswordFieldRef;
52
+ namespace PasswordField {
53
+ /**
54
+ * Props of the {@link Form.PasswordField} React component.
55
+ */
56
+ type Props = PasswordFieldProps;
57
+ }
58
+ /**
59
+ * A Ref Type for the {@link Form.TextArea}.
60
+ * Use refs to control your Form by calling `Form.TextArea.focus()` or `Form.TextArea.reset()` functions.
61
+ */
62
+ type TextArea = TextAreaRef;
63
+ namespace TextArea {
64
+ /**
65
+ * Props of the {@link Form.TextArea} React component.
66
+ */
67
+ type Props = TextAreaProps;
68
+ }
69
+ /**
70
+ * A Ref Type for the {@link Form.Checkbox}.
71
+ * Use refs to control your Form by calling `Form.Checkbox.focus()` or `Form.Checkbox.reset()` functions.
72
+ */
73
+ type Checkbox = CheckboxRef;
74
+ namespace Checkbox {
75
+ /**
76
+ * Props of the {@link Form.Checkbox} React component.
77
+ */
78
+ type Props = CheckboxProps;
79
+ }
80
+ /**
81
+ * A Ref Type for the {@link Form.Dropdown}.
82
+ * Use refs to control your Form by calling `Form.Dropdown.focus()` or `Form.Dropdown.reset()` functions.
83
+ */
84
+ type Dropdown = DropdownRef;
85
+ namespace Dropdown {
86
+ /**
87
+ * Props of the {@link Form.Dropdown} React component.
88
+ */
89
+ type Props = DropdownProps;
90
+ namespace Item {
91
+ /**
92
+ * Props of the {@link Form.Dropdown.Item} React component.
93
+ */
94
+ type Props = DropdownItemProps;
95
+ }
96
+ namespace Section {
97
+ /**
98
+ * Props of the {@link Form.Dropdown.Section} React component.
99
+ */
100
+ type Props = DropdownSectionProps;
101
+ }
102
+ }
103
+ /**
104
+ * A Ref Type for the {@link Form.DatePicker}.
105
+ * Use refs to control your Form by calling `Form.DatePicker.focus()` or `Form.DatePicker.reset()` functions.
106
+ */
107
+ type DatePicker = DatePickerRef;
108
+ namespace DatePicker {
109
+ /**
110
+ * Props of the {@link Form.DatePicker} React component.
111
+ */
112
+ type Props = DatePickerProps;
113
+ /**
114
+ * The types of date components the user can pick with {@link Form.DatePicker}.
115
+ */
116
+ type Type = DatePickerEnum;
117
+ }
118
+ namespace TagPicker {
119
+ }
120
+ /**
121
+ * A Ref Type for the {@link Form.FilePicker}.
122
+ * Use refs to control your Form by calling `Form.FilePicker.focus()` or `Form.FilePicker.reset()` functions.
123
+ */
124
+ type FilePicker = FilePickerRef;
125
+ namespace FilePicker {
126
+ /**
127
+ * Props of the {@link Form.FilePicker} React component.
128
+ */
129
+ type Props = FilePickerProps;
130
+ }
131
+ namespace Separator {
132
+ /**
133
+ * Props of the {@link Form.Separator} React component.
134
+ */
135
+ interface Props {
136
+ }
137
+ }
138
+ namespace Description {
139
+ /**
140
+ * Props of the {@link Form.Description} React component.
141
+ */
142
+ type Props = DescriptionProps;
143
+ }
144
+ namespace LinkAccessory {
145
+ /**
146
+ * Props of the {@link Form.LinkAccessory} React component.
147
+ */
148
+ type Props = LinkAccessoryProps;
149
+ }
150
+ }
151
+ interface FormType {
152
+ (props: Form.Props): any;
153
+ TextField: React.ForwardRefExoticComponent<Form.TextField.Props & React.RefAttributes<Form.TextField>>;
154
+ PasswordField: React.ForwardRefExoticComponent<Form.PasswordField.Props & React.RefAttributes<Form.PasswordField>>;
155
+ TextArea: React.ForwardRefExoticComponent<Form.TextArea.Props & React.RefAttributes<Form.TextArea>>;
156
+ Checkbox: React.ForwardRefExoticComponent<Form.Checkbox.Props & React.RefAttributes<Form.Checkbox>>;
157
+ Dropdown: {
158
+ (props: Form.Dropdown.Props): any;
159
+ Item: (props: Form.Dropdown.Item.Props) => any;
160
+ Section: (props: Form.Dropdown.Section.Props) => any;
161
+ };
162
+ DatePicker: {
163
+ (props: Form.DatePicker.Props): any;
164
+ Type: typeof DatePickerEnum;
165
+ };
166
+ TagPicker: TagPickerType;
167
+ FilePicker: React.ForwardRefExoticComponent<Form.FilePicker.Props & React.RefAttributes<Form.FilePicker>>;
168
+ Separator: (props: Form.Separator.Props) => any;
169
+ Description: (props: Form.Description.Props) => any;
170
+ LinkAccessory: (props: Form.LinkAccessory.Props) => any;
171
+ }
172
+ export declare const Form: FormType;
173
+ export {};
174
+ //# sourceMappingURL=form-type-only.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-type-only.d.ts","sourceRoot":"","sources":["../../../src/components/form/form-type-only.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAGH,SAAS,EACT,aAAa,EACb,WAAW,EACX,WAAW,EACX,YAAY,EACZ,WAAW,EACX,eAAe,EAClB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,KAAK,EACR,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACvB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EACR,eAAe,EACf,aAAa,EACb,cAAc,IAAI,cAAc,EACnC,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;A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 export {};
2
+ //# sourceMappingURL=form-type-only.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-type-only.js","sourceRoot":"","sources":["../../../src/components/form/form-type-only.tsx"],"names":[],"mappings":""}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ScrollBoxRenderable, BoxRenderable } from '@opentui/core';
3
3
  import { DescendantContextType } from 'termcast/src/descendants';
4
- import { FormValues, FormProps } from './types';
4
+ import { FormValues, FormProps, LinkAccessoryProps } from './types';
5
5
  export * from './types';
6
6
  export { useFormContext } from 'react-hook-form';
7
7
  interface FormFieldDescendant {
@@ -21,6 +21,7 @@ export declare const useFormScrollContext: () => FormScrollContextValue | null;
21
21
  interface FocusContextValue {
22
22
  focusedField: string | null;
23
23
  setFocusedField: (id: string | null) => void;
24
+ isLoading: boolean;
24
25
  }
25
26
  export declare const useFocusContext: () => FocusContextValue;
26
27
  interface FormSubmitContextValue {
@@ -57,6 +58,7 @@ interface FormType {
57
58
  FilePicker: (props: FilePickerProps) => any;
58
59
  Separator: () => any;
59
60
  Description: (props: DescriptionProps) => any;
61
+ LinkAccessory: (props: LinkAccessoryProps) => any;
60
62
  }
61
63
  export declare const Form: FormType;
62
64
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/form/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAA;AAQd,OAAO,EAEL,mBAAmB,EACnB,aAAa,EACd,MAAM,eAAe,CAAA;AAEtB,OAAO,EAEL,qBAAqB,EACtB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,UAAU,EACV,SAAS,EASV,MAAM,SAAS,CAAA;AAIhB,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAGhD,UAAU,mBAAmB;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,CAAC,EAAE,aAAa,GAAG,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S,EAAE,MAAM,GAAG,CAAA;IACpB,WAAW,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,GAAG,CAAA;IAC7C,aAAa,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,GAAG,CAAA;CAClD;AAED,eAAO,MAAM,IAAI,EAAE,QA8OL,CAAA"}
@@ -1,13 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
2
- import { useState, createContext, useContext, useLayoutEffect, useRef, } from 'react';
2
+ import { useState, createContext, useContext, useRef, useEffect, } from 'react';
3
3
  import { useKeyboard } from '@opentui/react';
4
4
  import { useForm, FormProvider } from 'react-hook-form';
5
5
  import { logger } from 'termcast/src/logger';
6
6
  import { useIsInFocus } from 'termcast/src/internal/focus-context';
7
7
  import { useDialog } from 'termcast/src/internal/dialog';
8
8
  import { Theme } from 'termcast/src/theme';
9
+ import { useStore } from 'termcast/src/state';
9
10
  import { TextAttributes, } from '@opentui/core';
10
11
  import { createDescendants, } from 'termcast/src/descendants';
12
+ import { useNavigationPending } from 'termcast/src/internal/navigation';
11
13
  import { FORM_MAX_WIDTH } from './description';
12
14
  import { ScrollBox } from 'termcast/src/internal/scrollbox';
13
15
  export * from './types';
@@ -39,16 +41,25 @@ function FormFooter() {
39
41
  paddingTop: 1,
40
42
  marginTop: 1,
41
43
  flexDirection: 'row',
42
- }, children: [_jsx("text", { fg: Theme.text, attributes: TextAttributes.BOLD, children: "ctrl \u21B5" }), _jsx("text", { fg: Theme.textMuted, children: " submit" }), _jsxs("text", { fg: Theme.text, attributes: TextAttributes.BOLD, children: [' ', "\u2191\u2193"] }), _jsx("text", { fg: Theme.textMuted, children: " navigate" }), _jsxs("text", { fg: Theme.text, attributes: TextAttributes.BOLD, children: [' ', "^k"] }), _jsx("text", { fg: Theme.textMuted, children: " actions" })] }));
44
+ }, children: [_jsx("text", { fg: Theme.text, attributes: TextAttributes.BOLD, children: "ctrl \u21B5" }), _jsx("text", { fg: Theme.textMuted, children: " submit" }), _jsxs("text", { fg: Theme.text, attributes: TextAttributes.BOLD, children: [' ', "tab"] }), _jsx("text", { fg: Theme.textMuted, children: " navigate" }), _jsxs("text", { fg: Theme.text, attributes: TextAttributes.BOLD, children: [' ', "^k"] }), _jsx("text", { fg: Theme.textMuted, children: " actions" })] }));
43
45
  }
44
46
  export const Form = ((props) => {
47
+ const { navigationTitle, isLoading, searchBarAccessory } = props;
45
48
  const methods = useForm({
46
49
  // defaultValues: {},
47
50
  // mode: 'onChange',
48
51
  });
49
52
  const [focusedField, setFocusedFieldRaw] = useState(null);
53
+ const navigationPending = useNavigationPending();
50
54
  const scrollBoxRef = useRef(null);
51
55
  const descendantsContext = useFormFieldDescendants();
56
+ // Helper to get sorted field IDs
57
+ const getFieldIds = () => {
58
+ return Object.values(descendantsContext.map.current)
59
+ .filter((item) => item.index !== -1 && item.props?.id)
60
+ .sort((a, b) => a.index - b.index)
61
+ .map((item) => item.props.id);
62
+ };
52
63
  const scrollToField = (fieldId) => {
53
64
  const scrollBox = scrollBoxRef.current;
54
65
  if (!scrollBox)
@@ -60,16 +71,11 @@ export const Form = ((props) => {
60
71
  return;
61
72
  const contentY = scrollBox.content?.y || 0;
62
73
  const viewportHeight = scrollBox.viewport?.height || 10;
63
- const currentScrollTop = scrollBox.scrollTop || 0;
64
74
  // Access current position from the BoxRenderable ref
65
75
  const itemTop = elementRef.y - contentY;
66
- const itemBottom = itemTop + elementRef.height;
67
- if (itemTop < currentScrollTop) {
68
- scrollBox.scrollTo(itemTop);
69
- }
70
- else if (itemBottom > currentScrollTop + viewportHeight) {
71
- scrollBox.scrollTo(itemBottom - viewportHeight);
72
- }
76
+ // Scroll so the top of the item is centered in the viewport
77
+ const targetScrollTop = itemTop - viewportHeight / 2;
78
+ scrollBox.scrollTo(Math.max(0, targetScrollTop));
73
79
  };
74
80
  const setFocusedField = (id) => {
75
81
  setFocusedFieldRaw(id);
@@ -77,28 +83,82 @@ export const Form = ((props) => {
77
83
  scrollToField(id);
78
84
  }
79
85
  };
80
- // Auto-focus first field after children have registered as descendants
81
- useLayoutEffect(() => {
82
- const descendants = Object.values(descendantsContext.map.current)
83
- .filter((item) => item.index !== -1 && item.props?.id)
84
- .sort((a, b) => a.index - b.index);
85
- if (descendants.length > 0) {
86
- const firstId = descendants[0].props.id;
87
- logger.log(`focusing `, firstId);
88
- setFocusedFieldRaw(firstId);
86
+ // Focus first field helper
87
+ const focusFirstField = () => {
88
+ const fieldIds = getFieldIds();
89
+ if (fieldIds.length > 0) {
90
+ logger.log(`focusing first field:`, fieldIds[0]);
91
+ setFocusedField(fieldIds[0]);
92
+ return true;
89
93
  }
90
- else {
91
- logger.log(`no fields to focus in form`);
94
+ return false;
95
+ };
96
+ // Focus last field helper
97
+ const focusLastField = () => {
98
+ const fieldIds = getFieldIds();
99
+ if (fieldIds.length > 0) {
100
+ logger.log(`focusing last field:`, fieldIds[fieldIds.length - 1]);
101
+ setFocusedField(fieldIds[fieldIds.length - 1]);
102
+ return true;
103
+ }
104
+ return false;
105
+ };
106
+ // Auto-focus first field when descendants become available
107
+ // Runs on every render until a field is focused (handles async loading)
108
+ useEffect(() => {
109
+ if (focusedField)
110
+ return;
111
+ const fieldIds = getFieldIds();
112
+ if (fieldIds.length > 0) {
113
+ logger.log(`auto-focusing first field:`, fieldIds[0]);
114
+ setFocusedFieldRaw(fieldIds[0]);
92
115
  }
93
- }, []);
116
+ });
94
117
  // Get focus state and dialog
95
118
  const inFocus = useIsInFocus();
96
119
  const dialog = useDialog();
97
- // Handle action keys and page scrolling
120
+ // Handle action keys, tab navigation, and page scrolling
98
121
  useKeyboard((evt) => {
99
122
  // Only handle keyboard events when form is in focus
100
123
  if (!inFocus)
101
124
  return;
125
+ // Tab navigation at Form level - handles case when no field is focused
126
+ // or navigates between fields
127
+ if (evt.name === 'tab') {
128
+ if (!focusedField) {
129
+ // No field focused yet - focus first or last based on shift
130
+ if (evt.shift) {
131
+ focusLastField();
132
+ }
133
+ else {
134
+ focusFirstField();
135
+ }
136
+ }
137
+ else {
138
+ // A field is focused - navigate to next/previous
139
+ const fieldIds = getFieldIds();
140
+ const currentIndex = fieldIds.indexOf(focusedField);
141
+ if (evt.shift) {
142
+ // Shift+Tab - go to previous
143
+ if (currentIndex > 0) {
144
+ setFocusedField(fieldIds[currentIndex - 1]);
145
+ }
146
+ else {
147
+ setFocusedField(fieldIds[fieldIds.length - 1]);
148
+ }
149
+ }
150
+ else {
151
+ // Tab - go to next
152
+ if (currentIndex < fieldIds.length - 1) {
153
+ setFocusedField(fieldIds[currentIndex + 1]);
154
+ }
155
+ else {
156
+ setFocusedField(fieldIds[0]);
157
+ }
158
+ }
159
+ }
160
+ return;
161
+ }
102
162
  // Page up/down scrolling
103
163
  if (evt.name === 'pageup' || evt.name === 'pagedown') {
104
164
  const scrollBox = scrollBoxRef.current;
@@ -116,15 +176,17 @@ export const Form = ((props) => {
116
176
  return;
117
177
  }
118
178
  if (evt.name === 'k' && evt.ctrl && props.actions) {
119
- // Ctrl+K shows actions
179
+ // Ctrl+K shows actions (always show sheet)
120
180
  dialog.push(_jsx(FormSubmitContext.Provider, { value: submitContextValue, children: props.actions }), 'bottom-right');
121
181
  }
122
182
  else if (evt.name === 'return' && evt.ctrl && props.actions) {
123
- // Ctrl+Return shows actions (form submit shortcut)
183
+ // Ctrl+Return executes first action directly
184
+ useStore.setState({ shouldAutoExecuteFirstAction: true });
124
185
  dialog.push(_jsx(FormSubmitContext.Provider, { value: submitContextValue, children: props.actions }), 'bottom-right');
125
186
  }
126
187
  else if (evt.name === 'return' && evt.meta && props.actions) {
127
- // Cmd+Return also shows actions (consistent with List)
188
+ // Cmd+Return also executes first action directly
189
+ useStore.setState({ shouldAutoExecuteFirstAction: true });
128
190
  dialog.push(_jsx(FormSubmitContext.Provider, { value: submitContextValue, children: props.actions }), 'bottom-right');
129
191
  }
130
192
  });
@@ -135,14 +197,14 @@ export const Form = ((props) => {
135
197
  scrollBoxRef,
136
198
  descendantsContext,
137
199
  };
138
- return (_jsx(FormProvider, { ...methods, children: _jsx(FormSubmitContext.Provider, { value: submitContextValue, children: _jsx(FormScrollContext.Provider, { value: scrollContextValue, children: _jsx(FocusContext.Provider, { value: { focusedField, setFocusedField }, children: _jsx("box", { flexDirection: 'row', flexGrow: 1, justifyContent: 'center', children: _jsxs("box", { flexDirection: 'column', children: [_jsx(ScrollBox, { ref: scrollBoxRef, flexGrow: 1, style: {
200
+ return (_jsx(FormProvider, { ...methods, children: _jsx(FormSubmitContext.Provider, { value: submitContextValue, children: _jsx(FormScrollContext.Provider, { value: scrollContextValue, children: _jsx(FocusContext.Provider, { value: { focusedField, setFocusedField, isLoading: isLoading || false }, children: _jsx("box", { flexDirection: 'row', flexGrow: 1, justifyContent: 'center', children: _jsxs("box", { flexGrow: 0, flexDirection: 'column', children: [_jsx(ScrollBox, { ref: scrollBoxRef, flexGrow: 1, style: {
139
201
  rootOptions: {
140
202
  maxWidth: FORM_MAX_WIDTH,
141
203
  },
142
204
  contentOptions: {
143
205
  justifyContent: 'center',
144
206
  },
145
- }, children: _jsxs(FormFieldDescendantsProvider, { value: descendantsContext, children: [props.children, _jsx(FormEnd, {})] }) }), _jsx(FormFooter, {})] }) }) }) }) }) }));
207
+ }, children: _jsx("box", { children: _jsxs(FormFieldDescendantsProvider, { value: descendantsContext, children: [props.children, _jsx(FormEnd, {})] }) }) }), _jsx(FormFooter, {})] }) }) }) }) }) }));
146
208
  });
147
209
  // Import and assign components after Form is defined
148
210
  import { TextField } from './text-field';
@@ -166,4 +228,14 @@ Form.TagPicker = TagPicker;
166
228
  Form.FilePicker = FilePicker;
167
229
  Form.Separator = Separator;
168
230
  Form.Description = Description;
231
+ // LinkAccessory component - shows a link in the navigation bar
232
+ function LinkAccessory(props) {
233
+ return (_jsx("box", { style: {
234
+ flexShrink: 0,
235
+ maxWidth: '50%',
236
+ overflow: 'hidden',
237
+ paddingRight: 1,
238
+ }, children: _jsx("text", { fg: Theme.textMuted, attributes: TextAttributes.UNDERLINE, wrapMode: 'none', children: props.text }) }));
239
+ }
240
+ Form.LinkAccessory = LinkAccessory;
169
241
  //# sourceMappingURL=index.js.map