@gjermundgaraba/pixel-paper 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,255 @@
1
+ import { KeyPlatform } from "../key-hint/key-label.js";
2
+ import { KeymapGroup } from "../keymap/keymap.js";
3
+ import { Schema } from "effect";
4
+ import { Html } from "foldkit/html";
5
+ import * as Update from "foldkit/update";
6
+ import { KeySequence } from "foldkit/dom";
7
+ /** Schema for the key help: its Dialog and the words in its find field. */
8
+ export declare const Model: Schema.Struct<{
9
+ readonly dialog: Schema.Struct<{
10
+ readonly dialog: Schema.Struct<{
11
+ readonly id: Schema.String;
12
+ readonly isOpen: Schema.Boolean;
13
+ readonly isAnimated: Schema.Boolean;
14
+ readonly animation: Schema.Struct<{
15
+ readonly id: Schema.String;
16
+ readonly isShowing: Schema.Boolean;
17
+ readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
18
+ readonly transitionGeneration: Schema.Number;
19
+ }>;
20
+ readonly maybeFocusSelector: Schema.Option<Schema.String>;
21
+ }>;
22
+ }>;
23
+ readonly query: Schema.String;
24
+ }>;
25
+ export type Model = typeof Model.Type;
26
+ /** One command the keyboard gives, as the help lists it: the keys that give it (any of
27
+ * them), the heading it sits under (`"Move"`, `"Edit"`) and what it does (`"Next item"`).
28
+ * Describe the same bindings the application hands `Dom.streamFromKeyBindings`, so a key
29
+ * never says one thing and does another. */
30
+ export type Binding = Readonly<{
31
+ keys: readonly KeySequence[];
32
+ group: string;
33
+ does: string;
34
+ }>;
35
+ /** The key that opens the help, `?`, which the application binds. */
36
+ export declare const HELP_KEYS: KeySequence;
37
+ /** Union of all Messages the key help can produce. */
38
+ export declare const Message: import("foldkit/message").MessageUnion<{
39
+ readonly GotDialogMessage: {
40
+ message: import("foldkit/message").MessageUnion<{
41
+ readonly GotDialogMessage: {
42
+ message: import("foldkit/message").MessageUnion<{
43
+ readonly RequestedOpen: {};
44
+ readonly RequestedClose: {};
45
+ readonly SucceededShowDialog: {};
46
+ readonly FailedShowDialog: {};
47
+ readonly SucceededAcquireResources: {};
48
+ readonly FailedAcquireResources: {};
49
+ readonly CompletedCloseDialog: {};
50
+ readonly Unmounted: {};
51
+ readonly CompletedReleaseDialogResources: {};
52
+ readonly GotAnimationMessage: {
53
+ message: import("foldkit/message").MessageUnion<{
54
+ readonly Showed: {};
55
+ readonly Hid: {};
56
+ readonly CompletedWaitForPaint: {
57
+ generation: Schema.Number;
58
+ };
59
+ readonly EndedAnimation: {
60
+ generation: Schema.Number;
61
+ };
62
+ }>;
63
+ };
64
+ }>;
65
+ };
66
+ readonly PressedActionKey: {
67
+ direction: Schema.Literals<readonly ["Previous", "Next"]>;
68
+ };
69
+ }>;
70
+ };
71
+ readonly UpdatedQuery: {
72
+ value: Schema.String;
73
+ };
74
+ readonly PressedHelpKey: {};
75
+ }>;
76
+ export type Message = typeof Message.Type;
77
+ /** Union of OutMessages the key help reports: the reader closed it (Escape, a click on the
78
+ * veil, a close button). Opening it, by `?` or `open`, reports nothing. */
79
+ export declare const OutMessage: import("foldkit/message").MessageUnion<{
80
+ readonly Closed: {};
81
+ }>;
82
+ export type OutMessage = typeof OutMessage.Type;
83
+ /** Configuration for creating the key help with `init`. */
84
+ export type InitConfig = Readonly<{
85
+ id: string;
86
+ }>;
87
+ /** Creates the key help, closed. */
88
+ export declare const init: (config: InitConfig) => Model;
89
+ /** Processes a key help Message and returns the next Model, Commands and OutMessage. */
90
+ export declare const update: (model: Model, message: Message) => Readonly<{
91
+ model: {
92
+ readonly dialog: {
93
+ readonly dialog: {
94
+ readonly id: string;
95
+ readonly isOpen: boolean;
96
+ readonly isAnimated: boolean;
97
+ readonly animation: {
98
+ readonly id: string;
99
+ readonly isShowing: boolean;
100
+ readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
101
+ readonly transitionGeneration: number;
102
+ };
103
+ readonly maybeFocusSelector: import("effect/Option").Option<string>;
104
+ };
105
+ };
106
+ readonly query: string;
107
+ };
108
+ commands?: Update.Commands<{
109
+ readonly _tag: "GotDialogMessage";
110
+ readonly message: {
111
+ readonly _tag: "GotDialogMessage";
112
+ readonly message: {
113
+ readonly _tag: "CompletedCloseDialog";
114
+ } | {
115
+ readonly _tag: "CompletedReleaseDialogResources";
116
+ } | {
117
+ readonly _tag: "FailedAcquireResources";
118
+ } | {
119
+ readonly _tag: "FailedShowDialog";
120
+ } | {
121
+ readonly _tag: "GotAnimationMessage";
122
+ readonly message: {
123
+ readonly _tag: "CompletedWaitForPaint";
124
+ readonly generation: number;
125
+ } | {
126
+ readonly _tag: "EndedAnimation";
127
+ readonly generation: number;
128
+ } | {
129
+ readonly _tag: "Hid";
130
+ } | {
131
+ readonly _tag: "Showed";
132
+ };
133
+ } | {
134
+ readonly _tag: "RequestedClose";
135
+ } | {
136
+ readonly _tag: "RequestedOpen";
137
+ } | {
138
+ readonly _tag: "SucceededAcquireResources";
139
+ } | {
140
+ readonly _tag: "SucceededShowDialog";
141
+ } | {
142
+ readonly _tag: "Unmounted";
143
+ };
144
+ } | {
145
+ readonly _tag: "PressedActionKey";
146
+ readonly direction: "Next" | "Previous";
147
+ };
148
+ } | {
149
+ readonly _tag: "PressedHelpKey";
150
+ } | {
151
+ readonly _tag: "UpdatedQuery";
152
+ readonly value: string;
153
+ }, never>;
154
+ outMessage?: {
155
+ readonly _tag: "Closed";
156
+ };
157
+ }>;
158
+ /** Opens the key help, as `?` does: for a button or a command palette entry. */
159
+ export declare const open: (model: Model) => Update.Return<Model, Message>;
160
+ /** The key help's id, unique in the document. */
161
+ export declare const id: (model: Model) => string;
162
+ /** Whether the key help is open. */
163
+ export declare const isOpen: (model: Model) => boolean;
164
+ /** The bindings as a keymap: under their groups in the order the groups first appear, each
165
+ * binding's keys printed for the platform, filtered by the query (its keys or its words). */
166
+ export declare const toKeymapGroups: (bindings: readonly Binding[], platform: KeyPlatform, query: string) => readonly KeymapGroup[];
167
+ /** Per-render inputs passed to `view` through `h.submodel`'s `viewInputs`. */
168
+ export type ViewInputs = Readonly<{
169
+ /** Every key in force now. The help adds its own `?` line. */
170
+ bindings: readonly Binding[];
171
+ platform: KeyPlatform;
172
+ /** The application's own words above the find field: what the page would say that the
173
+ * reader still needs while the help covers it (a sync notice and its retry). A slot that
174
+ * may carry the application's handlers, so a function. */
175
+ toIntroView?: () => ReadonlyArray<Html | string>;
176
+ /** The page's live region and toasts while this is the topmost open dialog, `undefined`
177
+ * while it is not (see `Dialog`). */
178
+ toLiveRegionView?: (() => Html) | undefined;
179
+ }>;
180
+ /** The keyboard's help: every key in force, under its group, with a field that finds one by
181
+ * its keys or its words. `open` opens it, from `HELP_KEYS` or a button. Render it
182
+ * once per page. */
183
+ export declare const view: import("foldkit/submodel").View<{
184
+ readonly dialog: {
185
+ readonly dialog: {
186
+ readonly id: string;
187
+ readonly isOpen: boolean;
188
+ readonly isAnimated: boolean;
189
+ readonly animation: {
190
+ readonly id: string;
191
+ readonly isShowing: boolean;
192
+ readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
193
+ readonly transitionGeneration: number;
194
+ };
195
+ readonly maybeFocusSelector: import("effect/Option").Option<string>;
196
+ };
197
+ };
198
+ readonly query: string;
199
+ }, {
200
+ readonly _tag: "GotDialogMessage";
201
+ readonly message: {
202
+ readonly _tag: "GotDialogMessage";
203
+ readonly message: {
204
+ readonly _tag: "CompletedCloseDialog";
205
+ } | {
206
+ readonly _tag: "CompletedReleaseDialogResources";
207
+ } | {
208
+ readonly _tag: "FailedAcquireResources";
209
+ } | {
210
+ readonly _tag: "FailedShowDialog";
211
+ } | {
212
+ readonly _tag: "GotAnimationMessage";
213
+ readonly message: {
214
+ readonly _tag: "CompletedWaitForPaint";
215
+ readonly generation: number;
216
+ } | {
217
+ readonly _tag: "EndedAnimation";
218
+ readonly generation: number;
219
+ } | {
220
+ readonly _tag: "Hid";
221
+ } | {
222
+ readonly _tag: "Showed";
223
+ };
224
+ } | {
225
+ readonly _tag: "RequestedClose";
226
+ } | {
227
+ readonly _tag: "RequestedOpen";
228
+ } | {
229
+ readonly _tag: "SucceededAcquireResources";
230
+ } | {
231
+ readonly _tag: "SucceededShowDialog";
232
+ } | {
233
+ readonly _tag: "Unmounted";
234
+ };
235
+ } | {
236
+ readonly _tag: "PressedActionKey";
237
+ readonly direction: "Next" | "Previous";
238
+ };
239
+ } | {
240
+ readonly _tag: "PressedHelpKey";
241
+ } | {
242
+ readonly _tag: "UpdatedQuery";
243
+ readonly value: string;
244
+ }, Readonly<{
245
+ /** Every key in force now. The help adds its own `?` line. */
246
+ bindings: readonly Binding[];
247
+ platform: KeyPlatform;
248
+ /** The application's own words above the find field: what the page would say that the
249
+ * reader still needs while the help covers it (a sync notice and its retry). A slot that
250
+ * may carry the application's handlers, so a function. */
251
+ toIntroView?: () => ReadonlyArray<Html | string>;
252
+ /** The page's live region and toasts while this is the topmost open dialog, `undefined`
253
+ * while it is not (see `Dialog`). */
254
+ toLiveRegionView?: (() => Html) | undefined;
255
+ }>>;
@@ -0,0 +1,137 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { keyLabel, pressesOf } from "../key-hint/key-label.js";
3
+ import { view as view$1 } from "../button/button.js";
4
+ import { view as view$2 } from "../card/card.js";
5
+ import { foldDialog } from "../dialog/fold.js";
6
+ import { Message as Message$1, Model as Model$1, OutMessage as OutMessage$1, dialog_exports, id as id$1, init as init$1, isOpen as isOpen$1, view as view$3 } from "../dialog/dialog.js";
7
+ import { view as view$4 } from "../field/field.js";
8
+ import { view as view$5 } from "../keymap/keymap.js";
9
+ import { Array, Predicate, Schema, String, pipe } from "effect";
10
+ import { defineMessageUnion } from "foldkit/message";
11
+ import { modifyFields } from "foldkit/struct";
12
+ import { defineView } from "foldkit/submodel";
13
+ // src/key-help/key-help.ts
14
+ /** Schema for the key help: its Dialog and the words in its find field. */
15
+ const Model = Schema.Struct({
16
+ dialog: Model$1,
17
+ query: Schema.String
18
+ });
19
+ /** The key that opens the help, `?`, which the application binds. */
20
+ const HELP_KEYS = "Shift+?";
21
+ /** The help's own line in its listing. */
22
+ const helpBinding = {
23
+ keys: [HELP_KEYS],
24
+ group: "Help",
25
+ does: "These keys"
26
+ };
27
+ /** Union of all Messages the key help can produce. */
28
+ const Message = defineMessageUnion({
29
+ GotDialogMessage: { message: Message$1 },
30
+ UpdatedQuery: { value: Schema.String },
31
+ PressedHelpKey: {}
32
+ });
33
+ /** Union of OutMessages the key help reports: the reader closed it (Escape, a click on the
34
+ * veil, a close button). Opening it, by `?` or `open`, reports nothing. */
35
+ const OutMessage = defineMessageUnion({ Closed: {} });
36
+ /** Creates the key help, closed. */
37
+ const init = (config) => (__foldkitBrandViewResult(({
38
+ dialog: init$1({ id: config.id }),
39
+ query: ""
40
+ }), "@gjermundgaraba/pixel-paper/key-help/key-help.js#init"));
41
+ const toOutMessage = OutMessage$1.match({ Closed: () => __foldkitBrandViewResult((OutMessage.Closed()), "@gjermundgaraba/pixel-paper/key-help/key-help.js#Closed") });
42
+ const dialogFold = foldDialog(dialog_exports, {
43
+ read: (model) => __foldkitBrandViewResult((model.dialog), "@gjermundgaraba/pixel-paper/key-help/key-help.js#read"),
44
+ write: (model, nextDialog) => __foldkitBrandViewResult((modifyFields(model, { dialog: () => __foldkitBrandViewResult((nextDialog), "@gjermundgaraba/pixel-paper/key-help/key-help.js#dialog") })), "@gjermundgaraba/pixel-paper/key-help/key-help.js#write"),
45
+ toParentMessage: (message) => __foldkitBrandViewResult((Message.GotDialogMessage({ message })), "@gjermundgaraba/pixel-paper/key-help/key-help.js#toParentMessage"),
46
+ toParentOutMessage: toOutMessage
47
+ });
48
+ const clearQuery = (model) => __foldkitBrandViewResult((modifyFields(model, { query: () => __foldkitBrandViewResult((""), "@gjermundgaraba/pixel-paper/key-help/key-help.js#query") })), "@gjermundgaraba/pixel-paper/key-help/key-help.js#clearQuery");
49
+ /** Processes a key help Message and returns the next Model, Commands and OutMessage. */
50
+ const update = (model, message) => __foldkitBrandViewResult((Message.match(message, {
51
+ GotDialogMessage: ({ message: dialogMessage }) => __foldkitBrandViewResult((dialogFold.update(model, dialogMessage)), "@gjermundgaraba/pixel-paper/key-help/key-help.js#GotDialogMessage"),
52
+ UpdatedQuery: ({ value }) => (__foldkitBrandViewResult(({ model: modifyFields(model, { query: () => __foldkitBrandViewResult((value), "@gjermundgaraba/pixel-paper/key-help/key-help.js#query~2") }) }), "@gjermundgaraba/pixel-paper/key-help/key-help.js#UpdatedQuery")),
53
+ PressedHelpKey: () => __foldkitBrandViewResult((dialogFold.open(clearQuery(model))), "@gjermundgaraba/pixel-paper/key-help/key-help.js#PressedHelpKey")
54
+ })), "@gjermundgaraba/pixel-paper/key-help/key-help.js#update");
55
+ /** Opens the key help, as `?` does: for a button or a command palette entry. */
56
+ const open = (model) => __foldkitBrandViewResult((dialogFold.open(clearQuery(model))), "@gjermundgaraba/pixel-paper/key-help/key-help.js#open");
57
+ /** The key help's id, unique in the document. */
58
+ const id = (model) => __foldkitBrandViewResult((id$1(model.dialog)), "@gjermundgaraba/pixel-paper/key-help/key-help.js#id");
59
+ /** Whether the key help is open. */
60
+ const isOpen = (model) => __foldkitBrandViewResult((isOpen$1(model.dialog)), "@gjermundgaraba/pixel-paper/key-help/key-help.js#isOpen");
61
+ const isFound = (binding, labels, query) => __foldkitBrandViewResult((pipe([
62
+ labels,
63
+ ...Array.flatMap(binding.keys, pressesOf),
64
+ binding.does,
65
+ binding.group
66
+ ], Array.join(" "), String.toLowerCase, String.includes(query))), "@gjermundgaraba/pixel-paper/key-help/key-help.js#isFound");
67
+ /** The bindings as a keymap: under their groups in the order the groups first appear, each
68
+ * binding's keys printed for the platform, filtered by the query (its keys or its words). */
69
+ const toKeymapGroups = (bindings, platform, query) => {
70
+ const normalizedQuery = pipe(query, String.trim, String.toLowerCase);
71
+ const rows = pipe(bindings, Array.map((binding) => (__foldkitBrandViewResult(({
72
+ binding,
73
+ labels: Array.join(Array.map(binding.keys, (keys) => __foldkitBrandViewResult((keyLabel(keys, platform)), "@gjermundgaraba/pixel-paper/key-help/key-help.js#anonymous~2")), " / ")
74
+ }), "@gjermundgaraba/pixel-paper/key-help/key-help.js#anonymous"))), Array.filter(({ binding, labels }) => __foldkitBrandViewResult((isFound(binding, labels, normalizedQuery)), "@gjermundgaraba/pixel-paper/key-help/key-help.js#anonymous~3")), Array.map(({ binding, labels }) => (__foldkitBrandViewResult(({
75
+ group: binding.group,
76
+ row: {
77
+ keys: labels,
78
+ does: binding.does
79
+ }
80
+ }), "@gjermundgaraba/pixel-paper/key-help/key-help.js#anonymous~4"))));
81
+ const groups = Array.dedupe(Array.map(rows, ({ group }) => __foldkitBrandViewResult((group), "@gjermundgaraba/pixel-paper/key-help/key-help.js#anonymous~5")));
82
+ return __foldkitBrandViewResult((Array.map(groups, (group) => (__foldkitBrandViewResult(({
83
+ title: group,
84
+ rows: pipe(rows, Array.filter((row) => __foldkitBrandViewResult((row.group === group), "@gjermundgaraba/pixel-paper/key-help/key-help.js#anonymous~7")), Array.map(({ row }) => __foldkitBrandViewResult((row), "@gjermundgaraba/pixel-paper/key-help/key-help.js#anonymous~8")))
85
+ }), "@gjermundgaraba/pixel-paper/key-help/key-help.js#anonymous~6")))), "@gjermundgaraba/pixel-paper/key-help/key-help.js#toKeymapGroups");
86
+ };
87
+ const NOTE = "Keys wait while you type in a field.";
88
+ const SEQUENCE_NOTE = " Type the keys of a sequence one straight after the other; any other key lets go of the first.";
89
+ const NOTHING_FOUND = "No key does that.";
90
+ const hasSequence = (bindings) => __foldkitBrandViewResult((Array.some(bindings, (binding) => __foldkitBrandViewResult((Array.some(binding.keys, (keys) => __foldkitBrandViewResult((!Predicate.isString(keys)), "@gjermundgaraba/pixel-paper/key-help/key-help.js#anonymous~10"))), "@gjermundgaraba/pixel-paper/key-help/key-help.js#anonymous~9"))), "@gjermundgaraba/pixel-paper/key-help/key-help.js#hasSequence");
91
+ const cardView = (model, viewInputs, render, h) => {
92
+ const bindings = [...viewInputs.bindings, helpBinding];
93
+ const groups = toKeymapGroups(bindings, viewInputs.platform, model.query);
94
+ const note = Array.match(groups, {
95
+ onEmpty: () => __foldkitBrandViewResult((NOTHING_FOUND), "@gjermundgaraba/pixel-paper/key-help/key-help.js#onEmpty"),
96
+ onNonEmpty: () => __foldkitBrandViewResult((hasSequence(bindings) ? `${NOTE}${SEQUENCE_NOTE}` : NOTE), "@gjermundgaraba/pixel-paper/key-help/key-help.js#onNonEmpty")
97
+ });
98
+ return __foldkitBrandViewResult((view$2({
99
+ title: "Keys",
100
+ titleAttributes: render.title,
101
+ isNarrow: true,
102
+ closeAttributes: render.closeButton,
103
+ actionBarAttributes: render.actionBar,
104
+ actions: [view$1({
105
+ label: "close",
106
+ attributes: render.closeButton
107
+ }, h)],
108
+ body: [
109
+ ...viewInputs.toIntroView?.() ?? [],
110
+ view$4({
111
+ id: `${id(model)}-find`,
112
+ label: "Find a key",
113
+ value: model.query,
114
+ onInput: (value) => __foldkitBrandViewResult((Message.UpdatedQuery({ value })), "@gjermundgaraba/pixel-paper/key-help/key-help.js#onInput"),
115
+ inputAttributes: render.initialFocus
116
+ }, h),
117
+ view$5({
118
+ groups,
119
+ note
120
+ }, h)
121
+ ]
122
+ }, h)), "@gjermundgaraba/pixel-paper/key-help/key-help.js#cardView");
123
+ };
124
+ /** The keyboard's help: every key in force, under its group, with a field that finds one by
125
+ * its keys or its words. `open` opens it, from `HELP_KEYS` or a button. Render it
126
+ * once per page. */
127
+ const view = defineView((model, viewInputs, h) => __foldkitBrandViewResult((h.submodel({
128
+ slotId: id(model),
129
+ model: model.dialog,
130
+ view: view$3,
131
+ viewInputs: {
132
+ toLiveRegionView: viewInputs.toLiveRegionView,
133
+ toView: (render) => __foldkitBrandViewResult((cardView(model, viewInputs, render, h)), "@gjermundgaraba/pixel-paper/key-help/key-help.js#toView")
134
+ },
135
+ toParentMessage: (message) => __foldkitBrandViewResult((Message.GotDialogMessage({ message })), "@gjermundgaraba/pixel-paper/key-help/key-help.js#toParentMessage~2")
136
+ })), "@gjermundgaraba/pixel-paper/key-help/key-help.js#anonymous~11"));
137
+ export { HELP_KEYS, Message, Model, OutMessage, helpBinding, id, init, isOpen, open, toKeymapGroups, update, view };
@@ -0,0 +1,6 @@
1
+ import { KeyPlatform, detectKeyPlatform, keyLabel } from "./key-label.js";
2
+ import { ViewConfig, view } from "./key-hint.js";
3
+ declare namespace index_d_exports {
4
+ export { KeyPlatform, ViewConfig, detectKeyPlatform, keyLabel, view };
5
+ }
6
+ export { KeyPlatform, type ViewConfig, detectKeyPlatform, index_d_exports, keyLabel, view };
@@ -0,0 +1,12 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
3
+ import { KeyPlatform, detectKeyPlatform, keyLabel } from "./key-label.js";
4
+ import { view } from "./key-hint.js";
5
+ // src/key-hint/index.ts
6
+ var key_hint_exports = /* @__PURE__ */ __exportAll({
7
+ KeyPlatform: () => __foldkitBrandViewResult((KeyPlatform), "@gjermundgaraba/pixel-paper/key-hint/index.js#KeyPlatform"),
8
+ detectKeyPlatform: () => __foldkitBrandViewResult((detectKeyPlatform), "@gjermundgaraba/pixel-paper/key-hint/index.js#detectKeyPlatform"),
9
+ keyLabel: () => __foldkitBrandViewResult((keyLabel), "@gjermundgaraba/pixel-paper/key-hint/index.js#keyLabel"),
10
+ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/key-hint/index.js#view")
11
+ });
12
+ export { KeyPlatform, detectKeyPlatform, keyLabel, key_hint_exports, view };
@@ -0,0 +1,13 @@
1
+ import { KeyPlatform } from "./key-label.js";
2
+ import { Html, HtmlBuilder } from "foldkit/html";
3
+ import { KeySequence } from "foldkit/dom";
4
+ /** Configuration for rendering a key hint with `view`. */
5
+ export type ViewConfig = Readonly<{
6
+ /** The binding's keys, as `Dom.streamFromKeyBindings` names them: `"Q"`, `"Mod+K"`,
7
+ * `["G", "G"]`. */
8
+ keys: KeySequence;
9
+ platform: KeyPlatform;
10
+ }>;
11
+ /** A key printed small beside the words of a control, for the eye only: the control's
12
+ * accessible name stays its words. */
13
+ export declare const view: <Message>(config: ViewConfig, h: HtmlBuilder<Message>) => Html;
@@ -0,0 +1,7 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { keyLabel } from "./key-label.js";
3
+ // src/key-hint/key-hint.ts
4
+ /** A key printed small beside the words of a control, for the eye only: the control's
5
+ * accessible name stays its words. */
6
+ const view = (config, h) => __foldkitBrandViewResult((h.kbd([h.Class("key-hint"), h.AriaHidden(true)], [keyLabel(config.keys, config.platform)])), "@gjermundgaraba/pixel-paper/key-hint/key-hint.js#view");
7
+ export { view };
@@ -0,0 +1,18 @@
1
+ import { Effect, Schema } from "effect";
2
+ import { KeySequence } from "foldkit/dom";
3
+ /** Which keyboard a key prints for: Apple's symbols (`⌘K`) or the spelled-out modifiers
4
+ * everyone else reads (`Ctrl+K`). `Mod` in a binding is Meta on Apple, Control elsewhere. */
5
+ export declare const KeyPlatform: Schema.Literals<readonly ["Apple", "Other"]>;
6
+ export type KeyPlatform = typeof KeyPlatform.Type;
7
+ /** The reader's key platform, from the browser's user agent (`keyPlatformOf`). `Other` where
8
+ * there is no navigator, as during a server render. */
9
+ export declare const detectKeyPlatform: Effect.Effect<KeyPlatform>;
10
+ /**
11
+ * A key binding as the help and the key hints print it. Takes the same strings
12
+ * `Dom.streamFromKeyBindings` matches: `"Mod+K"` prints `⌘K` on Apple and `Ctrl+K` elsewhere,
13
+ * arrows print as arrows, a plain letter prints in lower case (`"G"` is `g`), and Shift with a
14
+ * lone character prints the character it types (`"Shift+G"` is `G`, `"Shift+?"` is `?`). A
15
+ * sequence of characters reads as Vim writes it (`["G", "G"]` is `gg`); a sequence with a
16
+ * named key keeps its spaces.
17
+ */
18
+ export declare const keyLabel: (keys: KeySequence, platform: KeyPlatform) => string;
@@ -0,0 +1,77 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { Array, Effect, Match, Option, Predicate, Record, Schema, String, pipe } from "effect";
3
+ // src/key-hint/key-label.ts
4
+ /** Which keyboard a key prints for: Apple's symbols (`⌘K`) or the spelled-out modifiers
5
+ * everyone else reads (`Ctrl+K`). `Mod` in a binding is Meta on Apple, Control elsewhere. */
6
+ const KeyPlatform = Schema.Literals(["Apple", "Other"]);
7
+ const APPLE_PLATFORM_PATTERN = /Mac|iPhone|iPad|iPod/u;
8
+ /** The key platform a user agent string names, the way `Dom.streamFromKeyBindings` resolves
9
+ * `Mod`, so a hint names the key the binding answers to. */
10
+ const keyPlatformOf = (userAgent) => __foldkitBrandViewResult((APPLE_PLATFORM_PATTERN.test(userAgent) ? "Apple" : "Other"), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#keyPlatformOf");
11
+ /** The reader's key platform, from the browser's user agent (`keyPlatformOf`). `Other` where
12
+ * there is no navigator, as during a server render. */
13
+ const detectKeyPlatform = Effect.sync(() => __foldkitBrandViewResult((typeof navigator === "undefined" ? "Other" : keyPlatformOf(navigator.userAgent)), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#anonymous"));
14
+ const MODIFIER_ORDER = [
15
+ "Control",
16
+ "Alt",
17
+ "Shift",
18
+ "Meta"
19
+ ];
20
+ const APPLE_SYMBOL = {
21
+ Control: "⌃",
22
+ Alt: "⌥",
23
+ Shift: "⇧",
24
+ Meta: "⌘"
25
+ };
26
+ const OTHER_PREFIX = {
27
+ Control: "Ctrl+",
28
+ Alt: "Alt+",
29
+ Shift: "Shift+",
30
+ Meta: "Meta+"
31
+ };
32
+ const KEY_NAMES = {
33
+ arrowdown: "↓",
34
+ arrowup: "↑",
35
+ arrowleft: "←",
36
+ arrowright: "→",
37
+ plus: "+",
38
+ space: "Space"
39
+ };
40
+ const toModifier = (platform) => __foldkitBrandViewResult(((token) => __foldkitBrandViewResult((Match.value(String.toLowerCase(token)).pipe(Match.withReturnType(), Match.when("mod", () => __foldkitBrandViewResult((Option.some(platform === "Apple" ? "Meta" : "Control")), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#anonymous~3")), Match.when("control", () => __foldkitBrandViewResult((Option.some("Control")), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#anonymous~4")), Match.when("alt", () => __foldkitBrandViewResult((Option.some("Alt")), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#anonymous~5")), Match.when("shift", () => __foldkitBrandViewResult((Option.some("Shift")), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#anonymous~6")), Match.when("meta", () => __foldkitBrandViewResult((Option.some("Meta")), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#anonymous~7")), Match.orElse(() => __foldkitBrandViewResult((Option.none()), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#anonymous~8")))), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#anonymous~2")), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#toModifier");
41
+ const parsePress = (press, platform) => {
42
+ const tokens = pipe(press, String.split("+"), Array.map(String.trim));
43
+ const [modifierTokens, key] = Array.unappend(tokens);
44
+ return __foldkitBrandViewResult(({
45
+ modifiers: Array.getSomes(Array.map(modifierTokens, toModifier(platform))),
46
+ key
47
+ }), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#parsePress");
48
+ };
49
+ const isCharacter = (key) => __foldkitBrandViewResult((key.length === 1), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#isCharacter");
50
+ const keyName = (key, hasModifier) => __foldkitBrandViewResult((Option.match(Record.get(KEY_NAMES, String.toLowerCase(key)), {
51
+ onSome: (name) => __foldkitBrandViewResult((name), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#onSome"),
52
+ onNone: () => {
53
+ if (!isCharacter(key)) return __foldkitBrandViewResult((key), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#onNone");
54
+ else if (hasModifier) return __foldkitBrandViewResult((String.toUpperCase(key)), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#onNone");
55
+ return __foldkitBrandViewResult((String.toLowerCase(key)), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#onNone");
56
+ }
57
+ })), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#keyName");
58
+ const pressLabel = (press, platform) => {
59
+ const { modifiers, key } = parsePress(press, platform);
60
+ if (isCharacter(key) && Array.contains(modifiers, "Shift") && Array.length(modifiers) === 1) return __foldkitBrandViewResult((String.toUpperCase(key)), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#pressLabel");
61
+ const orderedModifiers = Array.filter(MODIFIER_ORDER, (modifier) => __foldkitBrandViewResult((Array.contains(modifiers, modifier)), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#anonymous~9"));
62
+ return __foldkitBrandViewResult((`${Array.join(Array.map(orderedModifiers, (modifier) => __foldkitBrandViewResult((platform === "Apple" ? APPLE_SYMBOL[modifier] : OTHER_PREFIX[modifier]), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#anonymous~10")), "")}${keyName(key, Array.isReadonlyArrayNonEmpty(orderedModifiers))}`), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#pressLabel");
63
+ };
64
+ const pressesOf = (keys) => __foldkitBrandViewResult((Predicate.isString(keys) ? [keys] : keys), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#pressesOf");
65
+ /**
66
+ * A key binding as the help and the key hints print it. Takes the same strings
67
+ * `Dom.streamFromKeyBindings` matches: `"Mod+K"` prints `⌘K` on Apple and `Ctrl+K` elsewhere,
68
+ * arrows print as arrows, a plain letter prints in lower case (`"G"` is `g`), and Shift with a
69
+ * lone character prints the character it types (`"Shift+G"` is `G`, `"Shift+?"` is `?`). A
70
+ * sequence of characters reads as Vim writes it (`["G", "G"]` is `gg`); a sequence with a
71
+ * named key keeps its spaces.
72
+ */
73
+ const keyLabel = (keys, platform) => {
74
+ const labels = Array.map(pressesOf(keys), (press) => __foldkitBrandViewResult((pressLabel(press, platform)), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#anonymous~11"));
75
+ return __foldkitBrandViewResult((Array.every(labels, isCharacter) ? Array.join(labels, "") : Array.join(labels, " ")), "@gjermundgaraba/pixel-paper/key-hint/key-label.js#keyLabel");
76
+ };
77
+ export { KeyPlatform, detectKeyPlatform, keyLabel, keyPlatformOf, pressesOf };
@@ -0,0 +1,11 @@
1
+ import { Html, HtmlBuilder } from "foldkit/html";
2
+ /** One key and what it does, both as printed. */
3
+ export type KeymapRow = Readonly<{
4
+ keys: string;
5
+ does: string;
6
+ }>;
7
+ /** A heading and the keys under it. */
8
+ export type KeymapGroup = Readonly<{
9
+ title: string;
10
+ rows: readonly KeymapRow[];
11
+ }>;
@@ -0,0 +1,9 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { Array } from "effect";
3
+ // src/keymap/keymap.ts
4
+ const rowView = (h) => __foldkitBrandViewResult((({ keys, does }) => __foldkitBrandViewResult((h.keyed("div")(keys, [h.Class("keymap-row")], [h.kbd([], [keys]), h.span([], [does])])), "@gjermundgaraba/pixel-paper/keymap/keymap.js#anonymous")), "@gjermundgaraba/pixel-paper/keymap/keymap.js#rowView");
5
+ const groupView = (h) => __foldkitBrandViewResult((({ title, rows }) => __foldkitBrandViewResult((h.keyed("div")(title, [], [h.h3([], [title]), ...Array.map(rows, rowView(h))])), "@gjermundgaraba/pixel-paper/keymap/keymap.js#anonymous~2")), "@gjermundgaraba/pixel-paper/keymap/keymap.js#groupView");
6
+ /** Keys and what they do, grouped under `h3` headings, each key in a `kbd`, in the pixel
7
+ * face. Sits in a narrow Card. */
8
+ const view = (config, h) => __foldkitBrandViewResult((h.div([h.Class("keymap")], [...Array.map(config.groups, groupView(h)), ...config.note === void 0 ? [] : [h.p([h.Class("note-line")], [config.note])]])), "@gjermundgaraba/pixel-paper/keymap/keymap.js#view");
9
+ export { view };
@@ -0,0 +1,4 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ // src/keys/keys.ts
3
+ const isPlain = (event) => __foldkitBrandViewResult((!event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey), "@gjermundgaraba/pixel-paper/keys/keys.js#isPlain");
4
+ export { isPlain };
@@ -0,0 +1,2 @@
1
+ import { Array, Option, Schema } from "effect";
2
+ import "diff";
@@ -0,0 +1,73 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { Array, Match, Option, Record, Schema } from "effect";
3
+ import { defineTaggedUnion } from "foldkit/schema";
4
+ import { parsePatch } from "diff";
5
+ // src/line-diff/diff.ts
6
+ const DiffRow = defineTaggedUnion({
7
+ Same: {
8
+ text: Schema.String,
9
+ oldNumber: Schema.Finite,
10
+ newNumber: Schema.Finite
11
+ },
12
+ Added: {
13
+ text: Schema.String,
14
+ newNumber: Schema.Finite
15
+ },
16
+ Removed: {
17
+ text: Schema.String,
18
+ oldNumber: Schema.Finite
19
+ },
20
+ Fold: {
21
+ count: Schema.Finite,
22
+ firstOldNumber: Schema.Finite
23
+ }
24
+ });
25
+ const numberLine = (numbers, kind, text) => __foldkitBrandViewResult((Match.value(kind).pipe(Match.withReturnType(), Match.when("Same", () => __foldkitBrandViewResult(([{
26
+ old: numbers.old + 1,
27
+ new: numbers.new + 1
28
+ }, DiffRow.Same({
29
+ text,
30
+ oldNumber: numbers.old,
31
+ newNumber: numbers.new
32
+ })]), "@gjermundgaraba/pixel-paper/line-diff/diff.js#anonymous")), Match.when("Added", () => __foldkitBrandViewResult(([{
33
+ old: numbers.old,
34
+ new: numbers.new + 1
35
+ }, DiffRow.Added({
36
+ text,
37
+ newNumber: numbers.new
38
+ })]), "@gjermundgaraba/pixel-paper/line-diff/diff.js#anonymous~2")), Match.when("Removed", () => __foldkitBrandViewResult(([{
39
+ old: numbers.old + 1,
40
+ new: numbers.new
41
+ }, DiffRow.Removed({
42
+ text,
43
+ oldNumber: numbers.old
44
+ })]), "@gjermundgaraba/pixel-paper/line-diff/diff.js#anonymous~3")), Match.exhaustive)), "@gjermundgaraba/pixel-paper/line-diff/diff.js#numberLine");
45
+ const numbered = (lines, from) => __foldkitBrandViewResult((Array.mapAccum(lines, from, (numbers, { kind, text }) => __foldkitBrandViewResult((numberLine(numbers, kind, text)), "@gjermundgaraba/pixel-paper/line-diff/diff.js#anonymous~4"))), "@gjermundgaraba/pixel-paper/line-diff/diff.js#numbered");
46
+ const LINE_KIND_BY_PREFIX = {
47
+ " ": "Same",
48
+ "+": "Added",
49
+ "-": "Removed"
50
+ };
51
+ const kindOf = (line) => __foldkitBrandViewResult((line === "" ? Option.some("Same") : Record.get(LINE_KIND_BY_PREFIX, line.charAt(0))), "@gjermundgaraba/pixel-paper/line-diff/diff.js#kindOf");
52
+ const linesOf = (hunk) => __foldkitBrandViewResult((Array.getSomes(Array.map(hunk.lines, (line) => __foldkitBrandViewResult((Option.map(kindOf(line), (kind) => (__foldkitBrandViewResult(({
53
+ kind,
54
+ text: line.slice(1)
55
+ }), "@gjermundgaraba/pixel-paper/line-diff/diff.js#anonymous~6")))), "@gjermundgaraba/pixel-paper/line-diff/diff.js#anonymous~5")))), "@gjermundgaraba/pixel-paper/line-diff/diff.js#linesOf");
56
+ const readHunk = (nextOld, hunk) => {
57
+ const gap = hunk.oldStart - nextOld;
58
+ const [end, rows] = numbered(linesOf(hunk), {
59
+ old: hunk.oldStart,
60
+ new: hunk.newStart
61
+ });
62
+ return __foldkitBrandViewResult(([end.old, gap > 0 ? [DiffRow.Fold({
63
+ count: gap,
64
+ firstOldNumber: nextOld
65
+ }), ...rows] : rows]), "@gjermundgaraba/pixel-paper/line-diff/diff.js#readHunk");
66
+ };
67
+ const onlyHunksOf = (files) => __foldkitBrandViewResult((Array.match(files, {
68
+ onEmpty: () => __foldkitBrandViewResult((Option.none()), "@gjermundgaraba/pixel-paper/line-diff/diff.js#onEmpty"),
69
+ onNonEmpty: ([file, ...others]) => __foldkitBrandViewResult((Array.isArrayEmpty(others) && Array.isArrayNonEmpty(file.hunks) ? Option.some(file.hunks) : Option.none()), "@gjermundgaraba/pixel-paper/line-diff/diff.js#onNonEmpty")
70
+ })), "@gjermundgaraba/pixel-paper/line-diff/diff.js#onlyHunksOf");
71
+ const hunksOfPatch = (patch) => __foldkitBrandViewResult((Option.flatMap(Option.liftThrowable(parsePatch)(patch), onlyHunksOf)), "@gjermundgaraba/pixel-paper/line-diff/diff.js#hunksOfPatch");
72
+ const diffRowsOfPatch = (patch) => __foldkitBrandViewResult((Option.map(hunksOfPatch(patch), (hunks) => __foldkitBrandViewResult((Array.flatten(Array.mapAccum(hunks, 1, readHunk)[1])), "@gjermundgaraba/pixel-paper/line-diff/diff.js#anonymous~7"))), "@gjermundgaraba/pixel-paper/line-diff/diff.js#diffRowsOfPatch");
73
+ export { DiffRow, diffRowsOfPatch, hunksOfPatch };
@@ -0,0 +1,6 @@
1
+ import { PatchViewConfig, patchView } from "./line-diff.js";
2
+ import { describePatch } from "./patch.js";
3
+ declare namespace index_d_exports {
4
+ export { PatchViewConfig, describePatch, patchView };
5
+ }
6
+ export { type PatchViewConfig, describePatch, index_d_exports, patchView };