@gjermundgaraba/pixel-paper 0.0.0-stage → 0.1.1

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 (387) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +50 -2
  3. package/dist/_virtual/_rolldown/runtime.js +13 -0
  4. package/dist/announcer/announcer.d.ts +35 -0
  5. package/dist/announcer/announcer.js +121 -0
  6. package/dist/announcer/index.d.ts +5 -0
  7. package/dist/announcer/index.js +11 -0
  8. package/dist/attributes/attributes.d.ts +4 -0
  9. package/dist/banner/banner.d.ts +20 -0
  10. package/dist/banner/banner.js +18 -0
  11. package/dist/banner/index.d.ts +5 -0
  12. package/dist/banner/index.js +6 -0
  13. package/dist/bench/bench.d.ts +16 -0
  14. package/dist/bench/bench.js +12 -0
  15. package/dist/bench/index.d.ts +5 -0
  16. package/dist/bench/index.js +6 -0
  17. package/dist/board/board.d.ts +1151 -0
  18. package/dist/board/board.js +449 -0
  19. package/dist/board/index.d.ts +6 -0
  20. package/dist/board/index.js +21 -0
  21. package/dist/button/button.d.ts +54 -0
  22. package/dist/button/button.js +50 -0
  23. package/dist/button/index.d.ts +5 -0
  24. package/dist/button/index.js +9 -0
  25. package/dist/card/card.d.ts +66 -0
  26. package/dist/card/card.js +70 -0
  27. package/dist/card/index.d.ts +5 -0
  28. package/dist/card/index.js +10 -0
  29. package/dist/chip/chip.d.ts +27 -0
  30. package/dist/chip/chip.js +34 -0
  31. package/dist/chip/index.d.ts +5 -0
  32. package/dist/chip/index.js +9 -0
  33. package/dist/choice/choice.d.ts +16 -0
  34. package/dist/choice/choice.js +17 -0
  35. package/dist/choice/index.d.ts +5 -0
  36. package/dist/choice/index.js +6 -0
  37. package/dist/code-editor/code-editor.d.ts +15 -0
  38. package/dist/code-editor/code-editor.js +22 -0
  39. package/dist/code-editor/index.d.ts +5 -0
  40. package/dist/code-editor/index.js +6 -0
  41. package/dist/code-surface/code-surface.d.ts +12 -0
  42. package/dist/code-surface/code-surface.js +12 -0
  43. package/dist/code-surface/index.d.ts +5 -0
  44. package/dist/code-surface/index.js +6 -0
  45. package/dist/command-palette/command-palette.d.ts +579 -0
  46. package/dist/command-palette/command-palette.js +600 -0
  47. package/dist/command-palette/index.d.ts +9 -0
  48. package/dist/command-palette/index.js +32 -0
  49. package/dist/command-palette/keys.d.ts +13 -0
  50. package/dist/command-palette/keys.js +71 -0
  51. package/dist/command-palette/match.d.ts +43 -0
  52. package/dist/command-palette/match.js +45 -0
  53. package/dist/command-palette/message.d.ts +94 -0
  54. package/dist/command-palette/message.js +46 -0
  55. package/dist/confirm-dialog/confirm-dialog.d.ts +287 -0
  56. package/dist/confirm-dialog/confirm-dialog.js +115 -0
  57. package/dist/confirm-dialog/index.d.ts +5 -0
  58. package/dist/confirm-dialog/index.js +17 -0
  59. package/dist/copy-button/copy-button.d.ts +99 -0
  60. package/dist/copy-button/copy-button.js +96 -0
  61. package/dist/copy-button/index.d.ts +5 -0
  62. package/dist/copy-button/index.js +13 -0
  63. package/dist/crumbs/crumbs.d.ts +15 -0
  64. package/dist/crumbs/crumbs.js +11 -0
  65. package/dist/crumbs/index.d.ts +5 -0
  66. package/dist/crumbs/index.js +6 -0
  67. package/dist/deck/deck.d.ts +9 -0
  68. package/dist/deck/deck.js +9 -0
  69. package/dist/deck/index.d.ts +5 -0
  70. package/dist/deck/index.js +6 -0
  71. package/dist/dialog/dialog.d.ts +278 -0
  72. package/dist/dialog/dialog.js +145 -0
  73. package/dist/dialog/fold.d.ts +58 -0
  74. package/dist/dialog/fold.js +63 -0
  75. package/dist/dialog/index.d.ts +6 -0
  76. package/dist/dialog/index.js +21 -0
  77. package/dist/disclosure/disclosure.d.ts +24 -0
  78. package/dist/disclosure/disclosure.js +25 -0
  79. package/dist/disclosure/index.d.ts +5 -0
  80. package/dist/disclosure/index.js +6 -0
  81. package/dist/dom/html-element.js +8 -0
  82. package/dist/drag/drag.d.ts +15 -0
  83. package/dist/drag/drag.js +123 -0
  84. package/dist/drop-zone/drop-zone.d.ts +119 -0
  85. package/dist/drop-zone/drop-zone.js +64 -0
  86. package/dist/drop-zone/index.d.ts +5 -0
  87. package/dist/drop-zone/index.js +14 -0
  88. package/dist/empty-state/empty-state.d.ts +18 -0
  89. package/dist/empty-state/empty-state.js +16 -0
  90. package/dist/empty-state/index.d.ts +5 -0
  91. package/dist/empty-state/index.js +6 -0
  92. package/dist/error-summary/error-summary.d.ts +34 -0
  93. package/dist/error-summary/error-summary.js +33 -0
  94. package/dist/error-summary/index.d.ts +5 -0
  95. package/dist/error-summary/index.js +6 -0
  96. package/dist/field/field.d.ts +35 -0
  97. package/dist/field/field.js +34 -0
  98. package/dist/field/index.d.ts +5 -0
  99. package/dist/field/index.js +6 -0
  100. package/dist/field-grid/field-grid.d.ts +8 -0
  101. package/dist/field-grid/field-grid.js +8 -0
  102. package/dist/field-grid/index.d.ts +5 -0
  103. package/dist/field-grid/index.js +6 -0
  104. package/dist/fields/fields.js +9 -0
  105. package/dist/fieldset/fieldset.d.ts +13 -0
  106. package/dist/fieldset/fieldset.js +13 -0
  107. package/dist/fieldset/index.d.ts +5 -0
  108. package/dist/fieldset/index.js +6 -0
  109. package/dist/filter-chip/filter-chip.d.ts +21 -0
  110. package/dist/filter-chip/filter-chip.js +28 -0
  111. package/dist/filter-chip/index.d.ts +5 -0
  112. package/dist/filter-chip/index.js +6 -0
  113. package/dist/filter-strip/filter-strip.d.ts +12 -0
  114. package/dist/filter-strip/filter-strip.js +13 -0
  115. package/dist/filter-strip/index.d.ts +5 -0
  116. package/dist/filter-strip/index.js +6 -0
  117. package/dist/flash-word/flash-word.d.ts +31 -0
  118. package/dist/flash-word/flash-word.js +31 -0
  119. package/dist/flash-word/index.d.ts +5 -0
  120. package/dist/flash-word/index.js +9 -0
  121. package/dist/focus/focus.d.ts +15 -0
  122. package/dist/focus/focus.js +17 -0
  123. package/dist/focus/index.d.ts +5 -0
  124. package/dist/focus/index.js +9 -0
  125. package/dist/format/format.js +52 -0
  126. package/dist/format/index.d.ts +5 -0
  127. package/dist/format/index.js +6 -0
  128. package/dist/glyph/glyph.d.ts +9 -0
  129. package/dist/glyph/glyph.js +25 -0
  130. package/dist/glyph/glyphs.d.ts +381 -0
  131. package/dist/glyph/glyphs.js +2603 -0
  132. package/dist/glyph/index.d.ts +5 -0
  133. package/dist/glyph/index.js +6 -0
  134. package/dist/group/group.d.ts +8 -0
  135. package/dist/group/group.js +9 -0
  136. package/dist/group/index.d.ts +5 -0
  137. package/dist/group/index.js +6 -0
  138. package/dist/history/history.d.ts +34 -0
  139. package/dist/history/history.js +15 -0
  140. package/dist/history/index.d.ts +5 -0
  141. package/dist/history/index.js +6 -0
  142. package/dist/icon-button/icon-button.d.ts +23 -0
  143. package/dist/icon-button/icon-button.js +23 -0
  144. package/dist/icon-button/index.d.ts +5 -0
  145. package/dist/icon-button/index.js +6 -0
  146. package/dist/identity/identity.d.ts +15 -0
  147. package/dist/identity/identity.js +15 -0
  148. package/dist/identity/index.d.ts +5 -0
  149. package/dist/identity/index.js +6 -0
  150. package/dist/index.d.ts +85 -0
  151. package/dist/index.js +85 -0
  152. package/dist/inline-input/index.d.ts +5 -0
  153. package/dist/inline-input/index.js +20 -0
  154. package/dist/inline-input/inline-input.d.ts +196 -0
  155. package/dist/inline-input/inline-input.js +212 -0
  156. package/dist/key-help/index.d.ts +5 -0
  157. package/dist/key-help/index.js +18 -0
  158. package/dist/key-help/key-help.d.ts +255 -0
  159. package/dist/key-help/key-help.js +137 -0
  160. package/dist/key-hint/index.d.ts +6 -0
  161. package/dist/key-hint/index.js +12 -0
  162. package/dist/key-hint/key-hint.d.ts +13 -0
  163. package/dist/key-hint/key-hint.js +7 -0
  164. package/dist/key-hint/key-label.d.ts +18 -0
  165. package/dist/key-hint/key-label.js +77 -0
  166. package/dist/keymap/keymap.d.ts +11 -0
  167. package/dist/keymap/keymap.js +9 -0
  168. package/dist/keys/keys.js +4 -0
  169. package/dist/line-diff/diff.d.ts +2 -0
  170. package/dist/line-diff/diff.js +73 -0
  171. package/dist/line-diff/index.d.ts +6 -0
  172. package/dist/line-diff/index.js +10 -0
  173. package/dist/line-diff/line-diff.d.ts +21 -0
  174. package/dist/line-diff/line-diff.js +75 -0
  175. package/dist/line-diff/patch.d.ts +15 -0
  176. package/dist/line-diff/patch.js +120 -0
  177. package/dist/link-button/index.d.ts +5 -0
  178. package/dist/link-button/index.js +6 -0
  179. package/dist/link-button/link-button.d.ts +11 -0
  180. package/dist/link-button/link-button.js +10 -0
  181. package/dist/link-state/index.d.ts +5 -0
  182. package/dist/link-state/index.js +6 -0
  183. package/dist/link-state/link-state.d.ts +15 -0
  184. package/dist/link-state/link-state.js +17 -0
  185. package/dist/live-region/index.d.ts +5 -0
  186. package/dist/live-region/index.js +9 -0
  187. package/dist/live-region/live-region.d.ts +39 -0
  188. package/dist/live-region/live-region.js +33 -0
  189. package/dist/loading/index.d.ts +5 -0
  190. package/dist/loading/index.js +6 -0
  191. package/dist/loading/loading.d.ts +19 -0
  192. package/dist/loading/loading.js +16 -0
  193. package/dist/locale/locale.d.ts +3 -0
  194. package/dist/locale/locale.js +5 -0
  195. package/dist/mark/index.d.ts +5 -0
  196. package/dist/mark/index.js +6 -0
  197. package/dist/mark/mark.d.ts +15 -0
  198. package/dist/mark/mark.js +30 -0
  199. package/dist/menu/index.d.ts +7 -0
  200. package/dist/menu/index.js +25 -0
  201. package/dist/menu/item.d.ts +236 -0
  202. package/dist/menu/item.js +19 -0
  203. package/dist/menu/menu.d.ts +206 -0
  204. package/dist/menu/menu.js +208 -0
  205. package/dist/menu/slip.js +163 -0
  206. package/dist/meter/index.d.ts +5 -0
  207. package/dist/meter/index.js +6 -0
  208. package/dist/meter/meter.d.ts +38 -0
  209. package/dist/meter/meter.js +69 -0
  210. package/dist/monogram/monogram.js +33 -0
  211. package/dist/nav-strip/index.d.ts +5 -0
  212. package/dist/nav-strip/index.js +6 -0
  213. package/dist/nav-strip/nav-strip.d.ts +19 -0
  214. package/dist/nav-strip/nav-strip.js +21 -0
  215. package/dist/notice/index.d.ts +5 -0
  216. package/dist/notice/index.js +6 -0
  217. package/dist/notice/notice.d.ts +23 -0
  218. package/dist/notice/notice.js +35 -0
  219. package/dist/outcome/index.d.ts +5 -0
  220. package/dist/outcome/index.js +6 -0
  221. package/dist/outcome/outcome.d.ts +19 -0
  222. package/dist/outcome/outcome.js +14 -0
  223. package/dist/page-head/index.d.ts +5 -0
  224. package/dist/page-head/index.js +6 -0
  225. package/dist/page-head/page-head.d.ts +13 -0
  226. package/dist/page-head/page-head.js +10 -0
  227. package/dist/panel/index.d.ts +5 -0
  228. package/dist/panel/index.js +6 -0
  229. package/dist/panel/panel.d.ts +35 -0
  230. package/dist/panel/panel.js +25 -0
  231. package/dist/password-field/index.d.ts +5 -0
  232. package/dist/password-field/index.js +6 -0
  233. package/dist/password-field/password-field.d.ts +33 -0
  234. package/dist/password-field/password-field.js +39 -0
  235. package/dist/places/index.d.ts +5 -0
  236. package/dist/places/index.js +6 -0
  237. package/dist/places/places.d.ts +32 -0
  238. package/dist/places/places.js +22 -0
  239. package/dist/props-list/index.d.ts +5 -0
  240. package/dist/props-list/index.js +6 -0
  241. package/dist/props-list/props-list.d.ts +18 -0
  242. package/dist/props-list/props-list.js +12 -0
  243. package/dist/prose/index.d.ts +5 -0
  244. package/dist/prose/index.js +6 -0
  245. package/dist/prose/prose.d.ts +14 -0
  246. package/dist/prose/prose.js +6 -0
  247. package/dist/query-chip/index.d.ts +5 -0
  248. package/dist/query-chip/index.js +6 -0
  249. package/dist/query-chip/query-chip.d.ts +18 -0
  250. package/dist/query-chip/query-chip.js +17 -0
  251. package/dist/radio-choices/index.d.ts +5 -0
  252. package/dist/radio-choices/index.js +12 -0
  253. package/dist/radio-choices/radio-choices.d.ts +105 -0
  254. package/dist/radio-choices/radio-choices.js +56 -0
  255. package/dist/rail/index.d.ts +5 -0
  256. package/dist/rail/index.js +22 -0
  257. package/dist/rail/rail.d.ts +403 -0
  258. package/dist/rail/rail.js +355 -0
  259. package/dist/reel/index.d.ts +6 -0
  260. package/dist/reel/index.js +26 -0
  261. package/dist/reel/layout.d.ts +58 -0
  262. package/dist/reel/layout.js +378 -0
  263. package/dist/reel/reel.d.ts +1070 -0
  264. package/dist/reel/reel.js +1019 -0
  265. package/dist/remote/index.d.ts +5 -0
  266. package/dist/remote/index.js +6 -0
  267. package/dist/remote/remote.d.ts +28 -0
  268. package/dist/remote/remote.js +41 -0
  269. package/dist/rows/index.d.ts +5 -0
  270. package/dist/rows/index.js +12 -0
  271. package/dist/rows/rows.d.ts +116 -0
  272. package/dist/rows/rows.js +67 -0
  273. package/dist/scheme/index.d.ts +6 -0
  274. package/dist/scheme/index.js +10 -0
  275. package/dist/scheme/scheme-switch.d.ts +98 -0
  276. package/dist/scheme/scheme-switch.js +118 -0
  277. package/dist/scheme/scheme.d.ts +5 -0
  278. package/dist/scheme/scheme.js +16 -0
  279. package/dist/scheme/script.d.ts +8 -0
  280. package/dist/scheme/script.js +10 -0
  281. package/dist/secret/index.d.ts +5 -0
  282. package/dist/secret/index.js +6 -0
  283. package/dist/secret/secret.d.ts +13 -0
  284. package/dist/secret/secret.js +9 -0
  285. package/dist/segmented/index.d.ts +5 -0
  286. package/dist/segmented/index.js +6 -0
  287. package/dist/segmented/segmented.d.ts +17 -0
  288. package/dist/segmented/segmented.js +17 -0
  289. package/dist/select-field/index.d.ts +5 -0
  290. package/dist/select-field/index.js +6 -0
  291. package/dist/select-field/select-field.d.ts +38 -0
  292. package/dist/select-field/select-field.js +29 -0
  293. package/dist/sheet/index.d.ts +5 -0
  294. package/dist/sheet/index.js +6 -0
  295. package/dist/sheet/sheet.d.ts +16 -0
  296. package/dist/sheet/sheet.js +15 -0
  297. package/dist/skip-link/index.d.ts +5 -0
  298. package/dist/skip-link/index.js +9 -0
  299. package/dist/skip-link/skip-link.d.ts +23 -0
  300. package/dist/skip-link/skip-link.js +36 -0
  301. package/dist/slot/slot.js +8 -0
  302. package/dist/sortable/index.d.ts +5 -0
  303. package/dist/sortable/index.js +16 -0
  304. package/dist/sortable/sortable.d.ts +1125 -0
  305. package/dist/sortable/sortable.js +431 -0
  306. package/dist/stack/index.d.ts +5 -0
  307. package/dist/stack/index.js +6 -0
  308. package/dist/stack/stack.d.ts +15 -0
  309. package/dist/stack/stack.js +12 -0
  310. package/dist/stage/index.d.ts +5 -0
  311. package/dist/stage/index.js +6 -0
  312. package/dist/stage/stage.d.ts +14 -0
  313. package/dist/stage/stage.js +11 -0
  314. package/dist/stat/index.d.ts +5 -0
  315. package/dist/stat/index.js +6 -0
  316. package/dist/stat/stat.d.ts +18 -0
  317. package/dist/stat/stat.js +13 -0
  318. package/dist/status-bar/index.d.ts +6 -0
  319. package/dist/status-bar/index.js +11 -0
  320. package/dist/status-bar/status-bar.d.ts +28 -0
  321. package/dist/status-bar/status-bar.js +19 -0
  322. package/dist/subscription/prefix-keys.js +12 -0
  323. package/dist/table/index.d.ts +5 -0
  324. package/dist/table/index.js +6 -0
  325. package/dist/table/table.d.ts +26 -0
  326. package/dist/table/table.js +18 -0
  327. package/dist/tabs/index.d.ts +5 -0
  328. package/dist/tabs/index.js +14 -0
  329. package/dist/tabs/tabs.d.ts +125 -0
  330. package/dist/tabs/tabs.js +57 -0
  331. package/dist/tag/index.d.ts +5 -0
  332. package/dist/tag/index.js +6 -0
  333. package/dist/tag/tag.d.ts +16 -0
  334. package/dist/tag/tag.js +25 -0
  335. package/dist/text-button/index.d.ts +5 -0
  336. package/dist/text-button/index.js +6 -0
  337. package/dist/text-button/text-button.d.ts +8 -0
  338. package/dist/text-button/text-button.js +12 -0
  339. package/dist/textarea-field/index.d.ts +5 -0
  340. package/dist/textarea-field/index.js +6 -0
  341. package/dist/textarea-field/textarea-field.d.ts +28 -0
  342. package/dist/textarea-field/textarea-field.js +30 -0
  343. package/dist/time/index.d.ts +5 -0
  344. package/dist/time/index.js +9 -0
  345. package/dist/time/time.d.ts +38 -0
  346. package/dist/time/time.js +63 -0
  347. package/dist/tips/index.d.ts +5 -0
  348. package/dist/tips/index.js +14 -0
  349. package/dist/tips/tips.d.ts +339 -0
  350. package/dist/tips/tips.js +308 -0
  351. package/dist/toast/index.d.ts +5 -0
  352. package/dist/toast/index.js +17 -0
  353. package/dist/toast/stack.d.ts +7 -0
  354. package/dist/toast/stack.js +23 -0
  355. package/dist/toast/toast.d.ts +559 -0
  356. package/dist/toast/toast.js +269 -0
  357. package/dist/toc/index.d.ts +5 -0
  358. package/dist/toc/index.js +9 -0
  359. package/dist/toc/toc.d.ts +42 -0
  360. package/dist/toc/toc.js +35 -0
  361. package/dist/top-bar/bar-height.d.ts +26 -0
  362. package/dist/top-bar/bar-height.js +43 -0
  363. package/dist/top-bar/index.d.ts +6 -0
  364. package/dist/top-bar/index.js +12 -0
  365. package/dist/top-bar/top-bar.d.ts +19 -0
  366. package/dist/top-bar/top-bar.js +18 -0
  367. package/dist/wall/index.d.ts +5 -0
  368. package/dist/wall/index.js +9 -0
  369. package/dist/wall/wall.d.ts +16 -0
  370. package/dist/wall/wall.js +15 -0
  371. package/dist/window/index.d.ts +5 -0
  372. package/dist/window/index.js +6 -0
  373. package/dist/window/window.d.ts +28 -0
  374. package/dist/window/window.js +29 -0
  375. package/dist/wordmark/index.d.ts +5 -0
  376. package/dist/wordmark/index.js +6 -0
  377. package/dist/wordmark/wordmark.d.ts +10 -0
  378. package/dist/wordmark/wordmark.js +10 -0
  379. package/dist/wrap/index.d.ts +5 -0
  380. package/dist/wrap/index.js +6 -0
  381. package/dist/wrap/wrap.d.ts +12 -0
  382. package/dist/wrap/wrap.js +9 -0
  383. package/fonts/DepartureMono-Regular.woff2 +0 -0
  384. package/fonts/LICENSE.txt +2 -0
  385. package/package.json +57 -3
  386. package/src/pixel-paper.css +4611 -0
  387. package/src/tokens.css +151 -0
@@ -0,0 +1,9 @@
1
+ import { Choice, Command, Page, findChoices } from "./match.js";
2
+ import { Message } from "./message.js";
3
+ import { InitConfig, Model, OpenAtConfig, OutMessage, ScrollToCursor, ViewInputs, id, init, isOpen, isPicking, maybeCursorId, maybePageId, open, openAt, pickFailed, pickSucceeded, query, subscriptions, update, view } from "./command-palette.js";
4
+ import { BindPaletteKeys } from "./keys.js";
5
+ import { Focus } from "../focus/focus.js";
6
+ declare namespace index_d_exports {
7
+ export { BindPaletteKeys, Choice, Command, Focus, InitConfig, Message, Model, OpenAtConfig, OutMessage, Page, ScrollToCursor, ViewInputs, findChoices, id, init, isOpen, isPicking, maybeCursorId, maybePageId, open, openAt, pickFailed, pickSucceeded, query, subscriptions, update, view };
8
+ }
9
+ export { BindPaletteKeys, type Choice, type Command, Focus, type InitConfig, Message, Model, type OpenAtConfig, OutMessage, type Page, ScrollToCursor, type ViewInputs, findChoices, id, index_d_exports, init, isOpen, isPicking, maybeCursorId, maybePageId, open, openAt, pickFailed, pickSucceeded, query, subscriptions, update, view };
@@ -0,0 +1,32 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
3
+ import { Focus } from "../focus/focus.js";
4
+ import { Message } from "./message.js";
5
+ import { BindPaletteKeys } from "./keys.js";
6
+ import { findChoices } from "./match.js";
7
+ import { Model, OutMessage, ScrollToCursor, id, init, isOpen, isPicking, maybeCursorId, maybePageId, open, openAt, pickFailed, pickSucceeded, query, subscriptions, update, view } from "./command-palette.js";
8
+ // src/command-palette/index.ts
9
+ var command_palette_exports = /* @__PURE__ */ __exportAll({
10
+ BindPaletteKeys: () => __foldkitBrandViewResult((BindPaletteKeys), "@gjermundgaraba/pixel-paper/command-palette/index.js#BindPaletteKeys"),
11
+ Focus: () => __foldkitBrandViewResult((Focus), "@gjermundgaraba/pixel-paper/command-palette/index.js#Focus"),
12
+ Message: () => __foldkitBrandViewResult((Message), "@gjermundgaraba/pixel-paper/command-palette/index.js#Message"),
13
+ Model: () => __foldkitBrandViewResult((Model), "@gjermundgaraba/pixel-paper/command-palette/index.js#Model"),
14
+ OutMessage: () => __foldkitBrandViewResult((OutMessage), "@gjermundgaraba/pixel-paper/command-palette/index.js#OutMessage"),
15
+ ScrollToCursor: () => __foldkitBrandViewResult((ScrollToCursor), "@gjermundgaraba/pixel-paper/command-palette/index.js#ScrollToCursor"),
16
+ findChoices: () => __foldkitBrandViewResult((findChoices), "@gjermundgaraba/pixel-paper/command-palette/index.js#findChoices"),
17
+ id: () => __foldkitBrandViewResult((id), "@gjermundgaraba/pixel-paper/command-palette/index.js#id"),
18
+ init: () => __foldkitBrandViewResult((init), "@gjermundgaraba/pixel-paper/command-palette/index.js#init"),
19
+ isOpen: () => __foldkitBrandViewResult((isOpen), "@gjermundgaraba/pixel-paper/command-palette/index.js#isOpen"),
20
+ isPicking: () => __foldkitBrandViewResult((isPicking), "@gjermundgaraba/pixel-paper/command-palette/index.js#isPicking"),
21
+ maybeCursorId: () => __foldkitBrandViewResult((maybeCursorId), "@gjermundgaraba/pixel-paper/command-palette/index.js#maybeCursorId"),
22
+ maybePageId: () => __foldkitBrandViewResult((maybePageId), "@gjermundgaraba/pixel-paper/command-palette/index.js#maybePageId"),
23
+ open: () => __foldkitBrandViewResult((open), "@gjermundgaraba/pixel-paper/command-palette/index.js#open"),
24
+ openAt: () => __foldkitBrandViewResult((openAt), "@gjermundgaraba/pixel-paper/command-palette/index.js#openAt"),
25
+ pickFailed: () => __foldkitBrandViewResult((pickFailed), "@gjermundgaraba/pixel-paper/command-palette/index.js#pickFailed"),
26
+ pickSucceeded: () => __foldkitBrandViewResult((pickSucceeded), "@gjermundgaraba/pixel-paper/command-palette/index.js#pickSucceeded"),
27
+ query: () => __foldkitBrandViewResult((query), "@gjermundgaraba/pixel-paper/command-palette/index.js#query"),
28
+ subscriptions: () => __foldkitBrandViewResult((subscriptions), "@gjermundgaraba/pixel-paper/command-palette/index.js#subscriptions"),
29
+ update: () => __foldkitBrandViewResult((update), "@gjermundgaraba/pixel-paper/command-palette/index.js#update"),
30
+ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/command-palette/index.js#view")
31
+ });
32
+ export { BindPaletteKeys, Focus, Message, Model, OutMessage, ScrollToCursor, command_palette_exports, findChoices, id, init, isOpen, isPicking, maybeCursorId, maybePageId, open, openAt, pickFailed, pickSucceeded, query, subscriptions, update, view };
@@ -0,0 +1,13 @@
1
+ import "./message.js";
2
+ import { Option, Stream } from "effect";
3
+ import * as Mount from "foldkit/mount";
4
+ /** What the palette's card needs of the document as it is at the event: Backspace in an empty
5
+ * field on a page goes back (its default prevented), a key an IME is composing never reaches
6
+ * the field's handler, and a press on a row keeps focus in the field, so a refused pick
7
+ * leaves it there. The arrows and Enter are the field's own handler's, in the view, which
8
+ * knows the rows. Escape is the Dialog's: it closes the whole palette. In a Scene, resolve it
9
+ * with `Message.PressedBackspace`. */
10
+ export declare const BindPaletteKeys: Mount.MountDefinitionNoArgs<"BindPaletteKeys", {
11
+ readonly _tag: "PressedBackspace";
12
+ readonly maybeShownPage: Option.Option<string>;
13
+ }>;
@@ -0,0 +1,71 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { isPlain } from "../keys/keys.js";
3
+ import { Message } from "./message.js";
4
+ import { Match, Option, Stream } from "effect";
5
+ import * as Mount from "foldkit/mount";
6
+ import * as Dom from "foldkit/dom";
7
+ // src/command-palette/keys.ts
8
+ const OPTION_SELECTOR = "[role=\"option\"]";
9
+ const FIELD_ATTRIBUTE = "pixel-paper-palette-field";
10
+ const PAGE_ATTRIBUTE = "pixel-paper-palette-page";
11
+ const shownPageOf = (element) => __foldkitBrandViewResult((Option.fromNullishOr(element.getAttribute(`data-${PAGE_ATTRIBUTE}`))), "@gjermundgaraba/pixel-paper/command-palette/keys.js#shownPageOf");
12
+ const isEmptyFieldOnPage = (root, field) => __foldkitBrandViewResult((field instanceof HTMLInputElement && field.value === "" && Option.isSome(shownPageOf(root))), "@gjermundgaraba/pixel-paper/command-palette/keys.js#isEmptyFieldOnPage");
13
+ const isComposingModifiedOrHandled = (event) => __foldkitBrandViewResult((event.isComposing || !isPlain(event) || event.defaultPrevented), "@gjermundgaraba/pixel-paper/command-palette/keys.js#isComposingModifiedOrHandled");
14
+ const fieldKey = (root, event) => {
15
+ const field = root.querySelector(`[data-${FIELD_ATTRIBUTE}]`);
16
+ if (field === null || event.target !== field || event.key !== "Backspace" || isComposingModifiedOrHandled(event) || !isEmptyFieldOnPage(root, field)) return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba/pixel-paper/command-palette/keys.js#fieldKey");
17
+ return __foldkitBrandViewResult((Option.some(Message.PressedBackspace({ maybeShownPage: shownPageOf(root) }))), "@gjermundgaraba/pixel-paper/command-palette/keys.js#fieldKey");
18
+ };
19
+ const composingKey = (event) => {
20
+ if (event.isComposing) event.stopPropagation();
21
+ return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba/pixel-paper/command-palette/keys.js#composingKey");
22
+ };
23
+ const rowPress = (event) => {
24
+ if (event.target instanceof Element && event.target.closest("[role=\"option\"]") !== null) event.preventDefault();
25
+ return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba/pixel-paper/command-palette/keys.js#rowPress");
26
+ };
27
+ /** What the palette's card needs of the document as it is at the event: Backspace in an empty
28
+ * field on a page goes back (its default prevented), a key an IME is composing never reaches
29
+ * the field's handler, and a press on a row keeps focus in the field, so a refused pick
30
+ * leaves it there. The arrows and Enter are the field's own handler's, in the view, which
31
+ * knows the rows. Escape is the Dialog's: it closes the whole palette. In a Scene, resolve it
32
+ * with `Message.PressedBackspace`. */
33
+ const BindPaletteKeys = Mount.defineStream("BindPaletteKeys", {
34
+ messages: [Message.PressedBackspace],
35
+ execute: ({ element }) => __foldkitBrandViewResult((Stream.mergeAll([
36
+ Dom.streamFromEventFilterMap({
37
+ target: element,
38
+ type: "keydown",
39
+ options: { capture: true },
40
+ filterMapEvent: composingKey
41
+ }),
42
+ Dom.streamFromEventFilterMapPreventDefault({
43
+ target: element,
44
+ type: "keydown",
45
+ filterMapEvent: (event) => __foldkitBrandViewResult((fieldKey(element, event)), "@gjermundgaraba/pixel-paper/command-palette/keys.js#filterMapEvent")
46
+ }),
47
+ Dom.streamFromEventFilterMap({
48
+ target: element,
49
+ type: "mousedown",
50
+ filterMapEvent: rowPress
51
+ })
52
+ ], { concurrency: "unbounded" })), "@gjermundgaraba/pixel-paper/command-palette/keys.js#execute")
53
+ });
54
+ const isInsidePalette = (paletteId, event) => __foldkitBrandViewResult((Option.exists(Option.fromNullishOr(document.querySelector(`#${CSS.escape(paletteId)}`)), (dialog) => __foldkitBrandViewResult((event.target instanceof Node && dialog.contains(event.target)), "@gjermundgaraba/pixel-paper/command-palette/keys.js#anonymous"))), "@gjermundgaraba/pixel-paper/command-palette/keys.js#isInsidePalette");
55
+ const earlyKeyMessageOf = (key) => __foldkitBrandViewResult((Match.value(key).pipe(Match.withReturnType(), Match.whenOr("ArrowDown", "ArrowUp", (arrow) => __foldkitBrandViewResult((Option.some(Message.PressedEarlyArrowKey({ key: arrow }))), "@gjermundgaraba/pixel-paper/command-palette/keys.js#anonymous~2")), Match.when("Enter", () => __foldkitBrandViewResult((Option.some(Message.PressedEarlyEnter())), "@gjermundgaraba/pixel-paper/command-palette/keys.js#anonymous~3")), Match.orElse(() => __foldkitBrandViewResult((Option.none()), "@gjermundgaraba/pixel-paper/command-palette/keys.js#anonymous~4")))), "@gjermundgaraba/pixel-paper/command-palette/keys.js#earlyKeyMessageOf");
56
+ const earlyKey = (paletteId, event) => {
57
+ if (isInsidePalette(paletteId, event) || isComposingModifiedOrHandled(event)) return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba/pixel-paper/command-palette/keys.js#earlyKey");
58
+ const maybeMessage = earlyKeyMessageOf(event.key);
59
+ if (Option.isSome(maybeMessage)) {
60
+ event.preventDefault();
61
+ event.stopPropagation();
62
+ }
63
+ return __foldkitBrandViewResult((maybeMessage), "@gjermundgaraba/pixel-paper/command-palette/keys.js#earlyKey");
64
+ };
65
+ const earlyKeys = (paletteId) => __foldkitBrandViewResult((Dom.streamFromEventFilterMap({
66
+ target: () => __foldkitBrandViewResult((window), "@gjermundgaraba/pixel-paper/command-palette/keys.js#target"),
67
+ type: "keydown",
68
+ options: { capture: true },
69
+ filterMapEvent: (event) => __foldkitBrandViewResult((earlyKey(paletteId, event)), "@gjermundgaraba/pixel-paper/command-palette/keys.js#filterMapEvent~2")
70
+ })), "@gjermundgaraba/pixel-paper/command-palette/keys.js#earlyKeys");
71
+ export { BindPaletteKeys, FIELD_ATTRIBUTE, OPTION_SELECTOR, PAGE_ATTRIBUTE, composingKey, earlyKey, earlyKeys, fieldKey, rowPress, shownPageOf };
@@ -0,0 +1,43 @@
1
+ import { GlyphName } from "../glyph/glyphs.js";
2
+ import { HashSet } from "effect";
3
+ /** One row of the palette: a command, or a choice on a page. */
4
+ export type Choice = Readonly<{
5
+ id: string;
6
+ label: string;
7
+ /** A key or a note at the right (`KeyHint.keyLabel` prints a binding). */
8
+ hint?: string;
9
+ /** An authored title (a page, an item): set in sans with a glyph. On the commands it waits
10
+ * for a query. */
11
+ isAuthored?: boolean;
12
+ glyph?: GlyphName;
13
+ /** It cannot run now: still found, and the cursor still lands on it, but Enter and a click
14
+ * do nothing. Say why in `reason`. */
15
+ isDisabled?: boolean;
16
+ /** Why it cannot run now (`"No item open"`), printed in place of the hint while held. */
17
+ reason?: string;
18
+ /** On a page, its depth in the page's tree, from 1 at the roots: it sits under the nearest
19
+ * choice before it one level up, and indents by its depth. A page without levels is flat. */
20
+ level?: number;
21
+ }>;
22
+ /** A page of choices a command opens in place (a status, a date, a destination). */
23
+ export type Page = Readonly<{
24
+ /** The page's name, in the head after Back (`"Status"`, `"Move to"`). */
25
+ title: string;
26
+ choices: readonly Choice[];
27
+ /** The field's placeholder; `"type to narrow"` when not given. */
28
+ find?: string;
29
+ /** The choice in force now: tagged current, and not picked again. */
30
+ current?: string;
31
+ /** Where the cursor starts while the reader has not moved it: this choice while the query
32
+ * finds it, else `current` while the query finds it, else the first choice the query finds
33
+ * (the next status after the current one; the first a typed query finds). */
34
+ start?: string;
35
+ }>;
36
+ /** One command, under its group's heading. With a `page` it opens that page in place instead
37
+ * of being selected. */
38
+ export type Command = Omit<Choice, "level"> & Readonly<{
39
+ group: string;
40
+ page?: Page;
41
+ }>;
42
+ /** The choices a page's query finds. */
43
+ export declare const findChoices: (page: Page, query: string) => readonly Choice[];
@@ -0,0 +1,45 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { Array, HashSet, Option, Order, String, pipe } from "effect";
3
+ // src/command-palette/match.ts
4
+ const isSubsequence = (needle, haystack) => __foldkitBrandViewResult((Array.reduce(Array.fromIterable(haystack), 0, (found, character) => __foldkitBrandViewResult((needle.charAt(found) === character ? found + 1 : found), "@gjermundgaraba/pixel-paper/command-palette/match.js#anonymous")) === needle.length), "@gjermundgaraba/pixel-paper/command-palette/match.js#isSubsequence");
5
+ const matches = (query, label) => {
6
+ const needle = pipe(query, String.trim, String.toLowerCase);
7
+ return __foldkitBrandViewResult((isSubsequence(needle, String.toLowerCase(label))), "@gjermundgaraba/pixel-paper/command-palette/match.js#matches");
8
+ };
9
+ const isBlank = (query) => __foldkitBrandViewResult((String.isEmpty(String.trim(query))), "@gjermundgaraba/pixel-paper/command-palette/match.js#isBlank");
10
+ const findCommands = (commands, query) => {
11
+ const hits = isBlank(query) ? Array.filter(commands, (command) => __foldkitBrandViewResult((command.isAuthored !== true), "@gjermundgaraba/pixel-paper/command-palette/match.js#anonymous~2")) : Array.filter(commands, (command) => __foldkitBrandViewResult((matches(query, command.label)), "@gjermundgaraba/pixel-paper/command-palette/match.js#anonymous~3"));
12
+ const ordered = [...Array.filter(hits, (command) => __foldkitBrandViewResult((command.isAuthored !== true), "@gjermundgaraba/pixel-paper/command-palette/match.js#anonymous~4")), ...Array.filter(hits, (command) => __foldkitBrandViewResult((command.isAuthored === true), "@gjermundgaraba/pixel-paper/command-palette/match.js#anonymous~5"))];
13
+ const groups = Array.dedupe(Array.map(ordered, ({ group }) => __foldkitBrandViewResult((group), "@gjermundgaraba/pixel-paper/command-palette/match.js#anonymous~6")));
14
+ const groupIndex = (command) => __foldkitBrandViewResult((Option.getOrElse(Array.findFirstIndex(groups, (group) => __foldkitBrandViewResult((group === command.group), "@gjermundgaraba/pixel-paper/command-palette/match.js#anonymous~7")), () => __foldkitBrandViewResult((groups.length), "@gjermundgaraba/pixel-paper/command-palette/match.js#anonymous~8"))), "@gjermundgaraba/pixel-paper/command-palette/match.js#groupIndex");
15
+ return __foldkitBrandViewResult((Array.sort(ordered, Order.mapInput(Order.Number, groupIndex))), "@gjermundgaraba/pixel-paper/command-palette/match.js#findCommands");
16
+ };
17
+ /** The choices a page's query finds. */
18
+ const findChoices = (page, query) => __foldkitBrandViewResult((isBlank(query) ? page.choices : Array.filter(page.choices, (choice) => __foldkitBrandViewResult((matches(query, choice.label)), "@gjermundgaraba/pixel-paper/command-palette/match.js#anonymous~9"))), "@gjermundgaraba/pixel-paper/command-palette/match.js#findChoices");
19
+ const WALK_START = {
20
+ chain: [],
21
+ keptIds: HashSet.empty()
22
+ };
23
+ const unfiltered = (page) => (__foldkitBrandViewResult(({
24
+ rows: page.choices,
25
+ found: page.choices,
26
+ contextIds: HashSet.empty()
27
+ }), "@gjermundgaraba/pixel-paper/command-palette/match.js#unfiltered"));
28
+ const treeChoices = (page, query) => {
29
+ const found = findChoices(page, query);
30
+ const foundIds = HashSet.fromIterable(Array.map(found, ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba/pixel-paper/command-palette/match.js#anonymous~10")));
31
+ const { keptIds } = Array.reduce(page.choices, WALK_START, ({ chain, keptIds: keptSoFar }, choice) => {
32
+ const nextChain = Array.append(Array.take(chain, (choice.level ?? 1) - 1), choice);
33
+ return __foldkitBrandViewResult(({
34
+ chain: nextChain,
35
+ keptIds: HashSet.has(foundIds, choice.id) ? HashSet.union(keptSoFar, HashSet.fromIterable(Array.map(nextChain, ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba/pixel-paper/command-palette/match.js#anonymous~12")))) : keptSoFar
36
+ }), "@gjermundgaraba/pixel-paper/command-palette/match.js#anonymous~11");
37
+ });
38
+ return __foldkitBrandViewResult(({
39
+ rows: Array.filter(page.choices, ({ id }) => __foldkitBrandViewResult((HashSet.has(keptIds, id)), "@gjermundgaraba/pixel-paper/command-palette/match.js#anonymous~13")),
40
+ found,
41
+ contextIds: HashSet.difference(keptIds, foundIds)
42
+ }), "@gjermundgaraba/pixel-paper/command-palette/match.js#treeChoices");
43
+ };
44
+ const pageChoices = (page, query) => __foldkitBrandViewResult((isBlank(query) ? unfiltered(page) : treeChoices(page, query)), "@gjermundgaraba/pixel-paper/command-palette/match.js#pageChoices");
45
+ export { findChoices, findCommands, matches, pageChoices };
@@ -0,0 +1,94 @@
1
+ import { Schema } from "effect";
2
+ /** Union of all Messages a command palette can produce. */
3
+ export declare const Message: import("foldkit/message").MessageUnion<{
4
+ readonly GotDialogMessage: {
5
+ message: import("foldkit/message").MessageUnion<{
6
+ readonly GotDialogMessage: {
7
+ message: import("foldkit/message").MessageUnion<{
8
+ readonly RequestedOpen: {};
9
+ readonly RequestedClose: {};
10
+ readonly SucceededShowDialog: {};
11
+ readonly FailedShowDialog: {};
12
+ readonly SucceededAcquireResources: {};
13
+ readonly FailedAcquireResources: {};
14
+ readonly CompletedCloseDialog: {};
15
+ readonly Unmounted: {};
16
+ readonly CompletedReleaseDialogResources: {};
17
+ readonly GotAnimationMessage: {
18
+ message: import("foldkit/message").MessageUnion<{
19
+ readonly Showed: {};
20
+ readonly Hid: {};
21
+ readonly CompletedWaitForPaint: {
22
+ generation: Schema.Number;
23
+ };
24
+ readonly EndedAnimation: {
25
+ generation: Schema.Number;
26
+ };
27
+ }>;
28
+ };
29
+ }>;
30
+ };
31
+ readonly PressedActionKey: {
32
+ direction: Schema.Literals<readonly ["Previous", "Next"]>;
33
+ };
34
+ }>;
35
+ };
36
+ readonly UpdatedQuery: {
37
+ value: Schema.String;
38
+ maybeShownPage: Schema.Option<Schema.String>;
39
+ };
40
+ readonly PressedArrowKey: {
41
+ key: Schema.Literals<readonly ["ArrowUp", "ArrowDown"]>;
42
+ snapshot: Schema.Struct<{
43
+ readonly maybeShownPage: Schema.Option<Schema.String>;
44
+ readonly shownQuery: Schema.String;
45
+ readonly shownShift: Schema.Finite;
46
+ readonly rows: Schema.$Array<Schema.Struct<{
47
+ readonly id: Schema.String;
48
+ readonly isHeld: Schema.Boolean;
49
+ readonly hasPage: Schema.Boolean;
50
+ }>>;
51
+ readonly maybeShownCursor: Schema.Option<Schema.String>;
52
+ }>;
53
+ };
54
+ readonly PressedEarlyArrowKey: {
55
+ key: Schema.Literals<readonly ["ArrowUp", "ArrowDown"]>;
56
+ };
57
+ readonly CompletedReportPendingKeys: {
58
+ renderGeneration: Schema.Int;
59
+ maybeRow: Schema.Option<Schema.Struct<{
60
+ readonly id: Schema.String;
61
+ readonly isHeld: Schema.Boolean;
62
+ readonly hasPage: Schema.Boolean;
63
+ }>>;
64
+ };
65
+ readonly PressedEnter: {
66
+ snapshot: Schema.Struct<{
67
+ readonly maybeShownPage: Schema.Option<Schema.String>;
68
+ readonly shownQuery: Schema.String;
69
+ readonly shownShift: Schema.Finite;
70
+ readonly rows: Schema.$Array<Schema.Struct<{
71
+ readonly id: Schema.String;
72
+ readonly isHeld: Schema.Boolean;
73
+ readonly hasPage: Schema.Boolean;
74
+ }>>;
75
+ readonly maybeShownCursor: Schema.Option<Schema.String>;
76
+ }>;
77
+ };
78
+ readonly PressedEarlyEnter: {};
79
+ readonly PressedBackspace: {
80
+ maybeShownPage: Schema.Option<Schema.String>;
81
+ };
82
+ readonly ClickedRow: {
83
+ row: Schema.Struct<{
84
+ readonly id: Schema.String;
85
+ readonly isHeld: Schema.Boolean;
86
+ readonly hasPage: Schema.Boolean;
87
+ }>;
88
+ maybeShownPage: Schema.Option<Schema.String>;
89
+ };
90
+ readonly ClickedBack: {};
91
+ readonly CompletedScrollToCursor: {};
92
+ readonly CompletedFocus: {};
93
+ }>;
94
+ export type Message = typeof Message.Type;
@@ -0,0 +1,46 @@
1
+ import { Message as Message$1 } from "../dialog/dialog.js";
2
+ import { Schema } from "effect";
3
+ import { defineMessageUnion } from "foldkit/message";
4
+ // src/command-palette/message.ts
5
+ const ShownPage = Schema.Option(Schema.String);
6
+ const ShownRow = Schema.Struct({
7
+ id: Schema.String,
8
+ isHeld: Schema.Boolean,
9
+ hasPage: Schema.Boolean
10
+ });
11
+ const RenderSnapshot = Schema.Struct({
12
+ maybeShownPage: ShownPage,
13
+ shownQuery: Schema.String,
14
+ shownShift: Schema.Finite,
15
+ rows: Schema.Array(ShownRow),
16
+ maybeShownCursor: Schema.Option(Schema.String)
17
+ });
18
+ const ArrowKey = Schema.Literals(["ArrowUp", "ArrowDown"]);
19
+ /** Union of all Messages a command palette can produce. */
20
+ const Message = defineMessageUnion({
21
+ GotDialogMessage: { message: Message$1 },
22
+ UpdatedQuery: {
23
+ value: Schema.String,
24
+ maybeShownPage: ShownPage
25
+ },
26
+ PressedArrowKey: {
27
+ key: ArrowKey,
28
+ snapshot: RenderSnapshot
29
+ },
30
+ PressedEarlyArrowKey: { key: ArrowKey },
31
+ CompletedReportPendingKeys: {
32
+ renderGeneration: Schema.Int,
33
+ maybeRow: Schema.Option(ShownRow)
34
+ },
35
+ PressedEnter: { snapshot: RenderSnapshot },
36
+ PressedEarlyEnter: {},
37
+ PressedBackspace: { maybeShownPage: ShownPage },
38
+ ClickedRow: {
39
+ row: ShownRow,
40
+ maybeShownPage: ShownPage
41
+ },
42
+ ClickedBack: {},
43
+ CompletedScrollToCursor: {},
44
+ CompletedFocus: {}
45
+ });
46
+ export { ArrowKey, Message, ShownRow };
@@ -0,0 +1,287 @@
1
+ import { UpdateContext } from "../dialog/dialog.js";
2
+ import { Schema } from "effect";
3
+ import { Html } from "foldkit/html";
4
+ import * as Update from "foldkit/update";
5
+ /** Schema for a confirm dialog: the pixel-paper Dialog it opens in. */
6
+ export declare const Model: Schema.Struct<{
7
+ readonly dialog: Schema.Struct<{
8
+ readonly dialog: Schema.Struct<{
9
+ readonly id: Schema.String;
10
+ readonly isOpen: Schema.Boolean;
11
+ readonly isAnimated: Schema.Boolean;
12
+ readonly animation: Schema.Struct<{
13
+ readonly id: Schema.String;
14
+ readonly isShowing: Schema.Boolean;
15
+ readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
16
+ readonly transitionGeneration: Schema.Number;
17
+ }>;
18
+ readonly maybeFocusSelector: Schema.Option<Schema.String>;
19
+ }>;
20
+ }>;
21
+ }>;
22
+ export type Model = typeof Model.Type;
23
+ /** Union of all Messages a confirm dialog can produce. */
24
+ export declare const Message: import("foldkit/message").MessageUnion<{
25
+ readonly GotDialogMessage: {
26
+ message: import("foldkit/message").MessageUnion<{
27
+ readonly GotDialogMessage: {
28
+ message: import("foldkit/message").MessageUnion<{
29
+ readonly RequestedOpen: {};
30
+ readonly RequestedClose: {};
31
+ readonly SucceededShowDialog: {};
32
+ readonly FailedShowDialog: {};
33
+ readonly SucceededAcquireResources: {};
34
+ readonly FailedAcquireResources: {};
35
+ readonly CompletedCloseDialog: {};
36
+ readonly Unmounted: {};
37
+ readonly CompletedReleaseDialogResources: {};
38
+ readonly GotAnimationMessage: {
39
+ message: import("foldkit/message").MessageUnion<{
40
+ readonly Showed: {};
41
+ readonly Hid: {};
42
+ readonly CompletedWaitForPaint: {
43
+ generation: Schema.Number;
44
+ };
45
+ readonly EndedAnimation: {
46
+ generation: Schema.Number;
47
+ };
48
+ }>;
49
+ };
50
+ }>;
51
+ };
52
+ readonly PressedActionKey: {
53
+ direction: Schema.Literals<readonly ["Previous", "Next"]>;
54
+ };
55
+ }>;
56
+ };
57
+ readonly ClickedConfirm: {};
58
+ readonly ClickedCancel: {};
59
+ }>;
60
+ export type Message = typeof Message.Type;
61
+ /** Union of OutMessages a confirm dialog reports. `Confirmed`: the reader pressed the action;
62
+ * the dialog stays open until the parent calls `close`. `Cancelled`: cancel, Escape or a click
63
+ * on the veil; the dialog has closed, and whether that also stops work already running is
64
+ * the parent's to decide. Never reported while its ways out are held (`Dialog.UpdateContext`). */
65
+ export declare const OutMessage: import("foldkit/message").MessageUnion<{
66
+ readonly Confirmed: {};
67
+ readonly Cancelled: {};
68
+ }>;
69
+ export type OutMessage = typeof OutMessage.Type;
70
+ /** Configuration for creating a confirm dialog with `init`. */
71
+ export type InitConfig = Readonly<{
72
+ id: string;
73
+ }>;
74
+ /** Creates a closed confirm dialog. */
75
+ export declare const init: (config: InitConfig) => Model;
76
+ /** Processes a confirm dialog Message and returns the next Model, Commands and OutMessage.
77
+ * While `context.isCloseHeld`, cancel, Escape and the veil change nothing. */
78
+ export declare const update: (model: Model, message: Message, context?: UpdateContext) => Readonly<{
79
+ model: {
80
+ readonly dialog: {
81
+ readonly dialog: {
82
+ readonly id: string;
83
+ readonly isOpen: boolean;
84
+ readonly isAnimated: boolean;
85
+ readonly animation: {
86
+ readonly id: string;
87
+ readonly isShowing: boolean;
88
+ readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
89
+ readonly transitionGeneration: number;
90
+ };
91
+ readonly maybeFocusSelector: import("effect/Option").Option<string>;
92
+ };
93
+ };
94
+ };
95
+ commands?: Update.Commands<{
96
+ readonly _tag: "ClickedCancel";
97
+ } | {
98
+ readonly _tag: "ClickedConfirm";
99
+ } | {
100
+ readonly _tag: "GotDialogMessage";
101
+ readonly message: {
102
+ readonly _tag: "GotDialogMessage";
103
+ readonly message: {
104
+ readonly _tag: "CompletedCloseDialog";
105
+ } | {
106
+ readonly _tag: "CompletedReleaseDialogResources";
107
+ } | {
108
+ readonly _tag: "FailedAcquireResources";
109
+ } | {
110
+ readonly _tag: "FailedShowDialog";
111
+ } | {
112
+ readonly _tag: "GotAnimationMessage";
113
+ readonly message: {
114
+ readonly _tag: "CompletedWaitForPaint";
115
+ readonly generation: number;
116
+ } | {
117
+ readonly _tag: "EndedAnimation";
118
+ readonly generation: number;
119
+ } | {
120
+ readonly _tag: "Hid";
121
+ } | {
122
+ readonly _tag: "Showed";
123
+ };
124
+ } | {
125
+ readonly _tag: "RequestedClose";
126
+ } | {
127
+ readonly _tag: "RequestedOpen";
128
+ } | {
129
+ readonly _tag: "SucceededAcquireResources";
130
+ } | {
131
+ readonly _tag: "SucceededShowDialog";
132
+ } | {
133
+ readonly _tag: "Unmounted";
134
+ };
135
+ } | {
136
+ readonly _tag: "PressedActionKey";
137
+ readonly direction: "Next" | "Previous";
138
+ };
139
+ }, never>;
140
+ outMessage?: {
141
+ readonly _tag: "Cancelled";
142
+ } | {
143
+ readonly _tag: "Confirmed";
144
+ };
145
+ }>;
146
+ /** Opens the confirm dialog: focus starts on the action, or on cancel when it is `isDanger`. */
147
+ export declare const open: (model: Model) => Update.Return<Model, Message>;
148
+ /** Closes the confirm dialog without reporting `Cancelled`: call it once confirmed work has
149
+ * landed. */
150
+ export declare const close: (model: Model) => Update.Return<Model, Message>;
151
+ /** The confirm dialog's id, unique in the document. */
152
+ export declare const id: (model: Model) => string;
153
+ /** Whether the confirm dialog is open. */
154
+ export declare const isOpen: (model: Model) => boolean;
155
+ /** Per-render inputs passed to `view` through `h.submodel`'s `viewInputs`. */
156
+ export type ViewInputs = Readonly<{
157
+ /** The title bar: the action's name (`"Delete"`). */
158
+ title: string;
159
+ /** Pixel caps under the glyph: the question (`"Delete this file?"`), the Outcome's title. */
160
+ question: string;
161
+ /** One sans sentence: what happens, and what cannot be undone. Markup that carries no
162
+ * handlers: it is built in the application's boundary and rendered in this Submodel's (put
163
+ * controls in `toDetailView`). */
164
+ body: ReadonlyArray<Html | string>;
165
+ /** Under the sentence: what the work said back (an error Notice, what to do about it, a
166
+ * notice with its own retry). A slot that may carry the application's handlers, so a
167
+ * function. */
168
+ toDetailView?: () => ReadonlyArray<Html | string>;
169
+ /** The confirming button's word (`"delete"`). */
170
+ label: string;
171
+ /** Destructive: the confirming button turns red and cancel becomes the default. */
172
+ isDanger?: boolean;
173
+ /** The confirmed work is running: the confirming button is held (its word stays, the
174
+ * working cursor prints, a second press does nothing) and keeps focus, and cancel is held
175
+ * with it. Pair it with `isCloseHeld` in `update`'s context, from the same state, so
176
+ * Escape and the veil change nothing either. */
177
+ isBusy?: boolean;
178
+ /** The action cannot run now (nothing is running; it is blocked): the confirming button is
179
+ * held, `aria-disabled` without the working cursor, and stays in the keyboard, so focus
180
+ * does not fall to the page. Cancel stays live. */
181
+ isDisabled?: boolean;
182
+ /** The page's live region and toasts while this is the topmost open dialog, `undefined`
183
+ * while it is not (see `Dialog`). */
184
+ toLiveRegionView?: (() => Html) | undefined;
185
+ }>;
186
+ /**
187
+ * The one question before an irreversible step: a glyph in a box, a headline, a sentence. With
188
+ * `isDanger` it is the system's only destructive confirm. The thing that destroys (delete,
189
+ * disable, reset) is a neutral Button at rest that opens this dialog; the red button is the
190
+ * commit inside it, focus starts on cancel, and the dialog is an alert (`alertdialog`); without
191
+ * it the dialog is a plain one with focus on the action. There is no inline
192
+ * arm-then-confirm button: red never rests on a button, and an armed button is easy to
193
+ * double-click through.
194
+ *
195
+ * Work that takes a while stays in the dialog: set `isBusy` while it runs (and `isCloseHeld`
196
+ * in `update`'s context), `close` once it has landed, and on failure keep it open with the
197
+ * error in `toDetailView`.
198
+ */
199
+ export declare const view: import("foldkit/submodel").View<{
200
+ readonly dialog: {
201
+ readonly dialog: {
202
+ readonly id: string;
203
+ readonly isOpen: boolean;
204
+ readonly isAnimated: boolean;
205
+ readonly animation: {
206
+ readonly id: string;
207
+ readonly isShowing: boolean;
208
+ readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
209
+ readonly transitionGeneration: number;
210
+ };
211
+ readonly maybeFocusSelector: import("effect/Option").Option<string>;
212
+ };
213
+ };
214
+ }, {
215
+ readonly _tag: "ClickedCancel";
216
+ } | {
217
+ readonly _tag: "ClickedConfirm";
218
+ } | {
219
+ readonly _tag: "GotDialogMessage";
220
+ readonly message: {
221
+ readonly _tag: "GotDialogMessage";
222
+ readonly message: {
223
+ readonly _tag: "CompletedCloseDialog";
224
+ } | {
225
+ readonly _tag: "CompletedReleaseDialogResources";
226
+ } | {
227
+ readonly _tag: "FailedAcquireResources";
228
+ } | {
229
+ readonly _tag: "FailedShowDialog";
230
+ } | {
231
+ readonly _tag: "GotAnimationMessage";
232
+ readonly message: {
233
+ readonly _tag: "CompletedWaitForPaint";
234
+ readonly generation: number;
235
+ } | {
236
+ readonly _tag: "EndedAnimation";
237
+ readonly generation: number;
238
+ } | {
239
+ readonly _tag: "Hid";
240
+ } | {
241
+ readonly _tag: "Showed";
242
+ };
243
+ } | {
244
+ readonly _tag: "RequestedClose";
245
+ } | {
246
+ readonly _tag: "RequestedOpen";
247
+ } | {
248
+ readonly _tag: "SucceededAcquireResources";
249
+ } | {
250
+ readonly _tag: "SucceededShowDialog";
251
+ } | {
252
+ readonly _tag: "Unmounted";
253
+ };
254
+ } | {
255
+ readonly _tag: "PressedActionKey";
256
+ readonly direction: "Next" | "Previous";
257
+ };
258
+ }, Readonly<{
259
+ /** The title bar: the action's name (`"Delete"`). */
260
+ title: string;
261
+ /** Pixel caps under the glyph: the question (`"Delete this file?"`), the Outcome's title. */
262
+ question: string;
263
+ /** One sans sentence: what happens, and what cannot be undone. Markup that carries no
264
+ * handlers: it is built in the application's boundary and rendered in this Submodel's (put
265
+ * controls in `toDetailView`). */
266
+ body: ReadonlyArray<Html | string>;
267
+ /** Under the sentence: what the work said back (an error Notice, what to do about it, a
268
+ * notice with its own retry). A slot that may carry the application's handlers, so a
269
+ * function. */
270
+ toDetailView?: () => ReadonlyArray<Html | string>;
271
+ /** The confirming button's word (`"delete"`). */
272
+ label: string;
273
+ /** Destructive: the confirming button turns red and cancel becomes the default. */
274
+ isDanger?: boolean;
275
+ /** The confirmed work is running: the confirming button is held (its word stays, the
276
+ * working cursor prints, a second press does nothing) and keeps focus, and cancel is held
277
+ * with it. Pair it with `isCloseHeld` in `update`'s context, from the same state, so
278
+ * Escape and the veil change nothing either. */
279
+ isBusy?: boolean;
280
+ /** The action cannot run now (nothing is running; it is blocked): the confirming button is
281
+ * held, `aria-disabled` without the working cursor, and stays in the keyboard, so focus
282
+ * does not fall to the page. Cancel stays live. */
283
+ isDisabled?: boolean;
284
+ /** The page's live region and toasts while this is the topmost open dialog, `undefined`
285
+ * while it is not (see `Dialog`). */
286
+ toLiveRegionView?: (() => Html) | undefined;
287
+ }>>;