@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,10 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
3
+ import { describePatch } from "./patch.js";
4
+ import { patchView } from "./line-diff.js";
5
+ // src/line-diff/index.ts
6
+ var line_diff_exports = /* @__PURE__ */ __exportAll({
7
+ describePatch: () => __foldkitBrandViewResult((describePatch), "@gjermundgaraba/pixel-paper/line-diff/index.js#describePatch"),
8
+ patchView: () => __foldkitBrandViewResult((patchView), "@gjermundgaraba/pixel-paper/line-diff/index.js#patchView")
9
+ });
10
+ export { describePatch, line_diff_exports, patchView };
@@ -0,0 +1,21 @@
1
+ import { Html, HtmlBuilder } from "foldkit/html";
2
+ /** Configuration for rendering a unified diff with `patchView`. */
3
+ export type PatchViewConfig = Readonly<{
4
+ /** One file's unified diff, as `diff -u` or `git diff -- <path>` writes it, its git header
5
+ * included. */
6
+ patch: string;
7
+ /** Names the two sides for screen readers: `"Version 3 against version 4"`. */
8
+ label: string;
9
+ }>;
10
+ /** A unified diff the caller already has (from a server, or `git diff -- <path>`) as a ruled
11
+ * table: the old and new numbers, a sign, the line. Added lines sit on the head tint behind an
12
+ * ink +; removed lines go muted behind a red −, and each sign is named for screen readers. Its
13
+ * hunks' lines are numbered from their headers, and the unchanged lines between hunks
14
+ * folded into a counted row. Lines past the last hunk are not in the patch, so nothing counts
15
+ * them. What git's header says beyond the lines prints as a note line above the table, or in
16
+ * its place: a rename, a mode change, an empty or binary file (`describePatch` has the
17
+ * sentences). A file whose type changed (a file that became a symlink) is two sections, each
18
+ * its own table under one note, named for its side (`"<label>, as it was"`). An empty patch
19
+ * says there is no difference; text that is not a diff, or holds several
20
+ * files, says it cannot be shown as lines. */
21
+ export declare const patchView: <Message>(config: PatchViewConfig, h: HtmlBuilder<Message>) => Html;
@@ -0,0 +1,75 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { LOCALE } from "../locale/locale.js";
3
+ import { DiffRow } from "./diff.js";
4
+ import { SAME_NOTE, readPatch } from "./patch.js";
5
+ import { Array, Option } from "effect";
6
+ // src/line-diff/line-diff.ts
7
+ const COLUMN_COUNT = 4;
8
+ const KIND = {
9
+ Same: {
10
+ className: "same",
11
+ sign: "",
12
+ said: "unchanged"
13
+ },
14
+ Added: {
15
+ className: "add",
16
+ sign: "+",
17
+ said: "added"
18
+ },
19
+ Removed: {
20
+ className: "del",
21
+ sign: "−",
22
+ said: "removed"
23
+ }
24
+ };
25
+ const lineView = (kind, numbers, text, h) => {
26
+ const { className, sign, said } = KIND[kind];
27
+ return __foldkitBrandViewResult((h.keyed("tr")(`${numbers.old}:${numbers.new}`, [h.Class(className)], [
28
+ h.td([h.Class("ln")], [numbers.old]),
29
+ h.td([h.Class("ln")], [numbers.new]),
30
+ h.td([h.Class("sign"), h.AriaLabel(said)], [sign]),
31
+ h.td([h.Class("line")], [text === "" ? " " : text])
32
+ ])), "@gjermundgaraba/pixel-paper/line-diff/line-diff.js#lineView");
33
+ };
34
+ const foldView = (count, firstOldNumber, h) => __foldkitBrandViewResult((h.keyed("tr")(`fold-${firstOldNumber}`, [h.Class("fold")], [h.td([h.Colspan(COLUMN_COUNT)], [`${count.toLocaleString(LOCALE)} unchanged ${count === 1 ? "line" : "lines"}`])])), "@gjermundgaraba/pixel-paper/line-diff/line-diff.js#foldView");
35
+ const rowView = (row, h) => __foldkitBrandViewResult((DiffRow.match(row, {
36
+ Same: ({ text, oldNumber, newNumber }) => __foldkitBrandViewResult((lineView("Same", {
37
+ old: `${oldNumber}`,
38
+ new: `${newNumber}`
39
+ }, text, h)), "@gjermundgaraba/pixel-paper/line-diff/line-diff.js#Same"),
40
+ Added: ({ text, newNumber }) => __foldkitBrandViewResult((lineView("Added", {
41
+ old: "",
42
+ new: `${newNumber}`
43
+ }, text, h)), "@gjermundgaraba/pixel-paper/line-diff/line-diff.js#Added"),
44
+ Removed: ({ text, oldNumber }) => __foldkitBrandViewResult((lineView("Removed", {
45
+ old: `${oldNumber}`,
46
+ new: ""
47
+ }, text, h)), "@gjermundgaraba/pixel-paper/line-diff/line-diff.js#Removed"),
48
+ Fold: ({ count, firstOldNumber }) => __foldkitBrandViewResult((foldView(count, firstOldNumber, h)), "@gjermundgaraba/pixel-paper/line-diff/line-diff.js#Fold")
49
+ })), "@gjermundgaraba/pixel-paper/line-diff/line-diff.js#rowView");
50
+ const noteView = (note, h) => __foldkitBrandViewResult((h.p([h.Class("note-line")], [note])), "@gjermundgaraba/pixel-paper/line-diff/line-diff.js#noteView");
51
+ const tableView = (rows, label, h) => __foldkitBrandViewResult((h.div([h.Class("diff-wrap")], [h.table([h.AriaLabel(label), h.Class("diff")], [h.tbody([], Array.map(rows, (row) => __foldkitBrandViewResult((rowView(row, h)), "@gjermundgaraba/pixel-paper/line-diff/line-diff.js#anonymous")))])])), "@gjermundgaraba/pixel-paper/line-diff/line-diff.js#tableView");
52
+ /** A unified diff the caller already has (from a server, or `git diff -- <path>`) as a ruled
53
+ * table: the old and new numbers, a sign, the line. Added lines sit on the head tint behind an
54
+ * ink +; removed lines go muted behind a red −, and each sign is named for screen readers. Its
55
+ * hunks' lines are numbered from their headers, and the unchanged lines between hunks
56
+ * folded into a counted row. Lines past the last hunk are not in the patch, so nothing counts
57
+ * them. What git's header says beyond the lines prints as a note line above the table, or in
58
+ * its place: a rename, a mode change, an empty or binary file (`describePatch` has the
59
+ * sentences). A file whose type changed (a file that became a symlink) is two sections, each
60
+ * its own table under one note, named for its side (`"<label>, as it was"`). An empty patch
61
+ * says there is no difference; text that is not a diff, or holds several
62
+ * files, says it cannot be shown as lines. */
63
+ const patchView = (config, h) => {
64
+ const { patch, label } = config;
65
+ const { notes, tables } = readPatch(patch);
66
+ const parts = [...Array.isReadonlyArrayNonEmpty(notes) ? [noteView(Array.join(notes, " "), h)] : [], ...Array.map(tables, ({ rows, maybeSide }) => __foldkitBrandViewResult((tableView(rows, Option.match(maybeSide, {
67
+ onNone: () => __foldkitBrandViewResult((label), "@gjermundgaraba/pixel-paper/line-diff/line-diff.js#onNone"),
68
+ onSome: (side) => __foldkitBrandViewResult((`${label}, ${side}`), "@gjermundgaraba/pixel-paper/line-diff/line-diff.js#onSome")
69
+ }), h)), "@gjermundgaraba/pixel-paper/line-diff/line-diff.js#anonymous~2"))];
70
+ return __foldkitBrandViewResult((Array.match(parts, {
71
+ onEmpty: () => __foldkitBrandViewResult((noteView(SAME_NOTE, h)), "@gjermundgaraba/pixel-paper/line-diff/line-diff.js#onEmpty"),
72
+ onNonEmpty: ([part, ...others]) => __foldkitBrandViewResult((Array.isArrayEmpty(others) ? part : h.div([h.Class("stack gap-s")], parts)), "@gjermundgaraba/pixel-paper/line-diff/line-diff.js#onNonEmpty")
73
+ })), "@gjermundgaraba/pixel-paper/line-diff/line-diff.js#patchView");
74
+ };
75
+ export { patchView };
@@ -0,0 +1,15 @@
1
+ import "./diff.js";
2
+ import { Option } from "effect";
3
+ /** What a patch says beyond its lines, as `patchView` prints it. */
4
+ export type PatchDescription = Readonly<{
5
+ /** The path a rename left, unquoted: for a heading such as `old.txt → new.txt`. */
6
+ maybeRenamedFrom: Option.Option<string>;
7
+ /** The sentences `patchView` prints above the patch's lines, or in their place: a rename,
8
+ * a mode change, a type change, an empty or binary file, no difference, or a patch it
9
+ * cannot show as lines. */
10
+ notes: readonly string[];
11
+ }>;
12
+ /** What `patchView` says about a patch from `git diff`, read from its header: the notes it
13
+ * prints (`["Renamed from old.txt."]`), for a caller that prints them itself, and the path a
14
+ * rename left. */
15
+ export declare const describePatch: (patch: string) => PatchDescription;
@@ -0,0 +1,120 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { diffRowsOfPatch, hunksOfPatch } from "./diff.js";
3
+ import { Array, Option, Record, String, pipe } from "effect";
4
+ // src/line-diff/patch.ts
5
+ const ESCAPED_BYTES = {
6
+ a: 7,
7
+ b: 8,
8
+ t: 9,
9
+ n: 10,
10
+ v: 11,
11
+ f: 12,
12
+ r: 13
13
+ };
14
+ const QUOTED_PART = /\\(?<octal>[0-7]{3})|\\(?<escaped>.)|[^\\]+/gu;
15
+ const bytesOf = (text) => __foldkitBrandViewResult(([...new TextEncoder().encode(text)]), "@gjermundgaraba/pixel-paper/line-diff/patch.js#bytesOf");
16
+ const bytesOfPart = (match) => {
17
+ const [part] = match;
18
+ const octal = match.groups?.["octal"];
19
+ const escaped = match.groups?.["escaped"];
20
+ if (octal !== void 0) return __foldkitBrandViewResult(([Number.parseInt(octal, 8)]), "@gjermundgaraba/pixel-paper/line-diff/patch.js#bytesOfPart");
21
+ else if (escaped === void 0) return __foldkitBrandViewResult((bytesOf(part)), "@gjermundgaraba/pixel-paper/line-diff/patch.js#bytesOfPart");
22
+ return __foldkitBrandViewResult((Option.match(Record.get(ESCAPED_BYTES, escaped), {
23
+ onNone: () => __foldkitBrandViewResult((bytesOf(escaped)), "@gjermundgaraba/pixel-paper/line-diff/patch.js#onNone"),
24
+ onSome: (byte) => __foldkitBrandViewResult(([byte]), "@gjermundgaraba/pixel-paper/line-diff/patch.js#onSome")
25
+ })), "@gjermundgaraba/pixel-paper/line-diff/patch.js#bytesOfPart");
26
+ };
27
+ /** The name a path in git's header stands for: git C-quotes a name with unusual bytes
28
+ * (`"caf\303\251.txt"`), and leaves any other as it is. */
29
+ const unquoted = (path) => __foldkitBrandViewResult((path.length >= 2 && path.startsWith("\"") && path.endsWith("\"") ? new TextDecoder().decode(Uint8Array.from(Array.flatMap(Array.fromIterable(path.slice(1, -1).matchAll(QUOTED_PART)), bytesOfPart))) : path), "@gjermundgaraba/pixel-paper/line-diff/patch.js#unquoted");
30
+ const GIT_SECTION = "diff --git ";
31
+ const headOf = (section) => __foldkitBrandViewResult((Array.takeWhile(section.split("\n"), (line) => __foldkitBrandViewResult((!line.startsWith("@@") && !line.startsWith("--- ")), "@gjermundgaraba/pixel-paper/line-diff/patch.js#anonymous"))), "@gjermundgaraba/pixel-paper/line-diff/patch.js#headOf");
32
+ const valueAfter = (head, prefix) => __foldkitBrandViewResult((pipe(Array.findFirst(head, String.startsWith(prefix)), Option.map((line) => __foldkitBrandViewResult((line.slice(prefix.length)), "@gjermundgaraba/pixel-paper/line-diff/patch.js#anonymous~2")))), "@gjermundgaraba/pixel-paper/line-diff/patch.js#valueAfter");
33
+ const hasLine = (head, prefix) => __foldkitBrandViewResult((Option.isSome(valueAfter(head, prefix))), "@gjermundgaraba/pixel-paper/line-diff/patch.js#hasLine");
34
+ const hasHunk = (section) => __foldkitBrandViewResult((Array.some(section.split("\n"), String.startsWith("@@ "))), "@gjermundgaraba/pixel-paper/line-diff/patch.js#hasHunk");
35
+ const sectionsOf = (patch) => {
36
+ const [first = "", ...others] = patch.split(/(?=^diff --git )/mu);
37
+ return __foldkitBrandViewResult((Array.isArrayNonEmpty(others) && !first.startsWith(GIT_SECTION) ? others : [first, ...others]), "@gjermundgaraba/pixel-paper/line-diff/patch.js#sectionsOf");
38
+ };
39
+ const SAME_NOTE = "No difference: both sides hold the same text.";
40
+ const UNREADABLE_NOTE = "This diff cannot be shown as lines.";
41
+ const BINARY_NOTE = "A binary file: its change has no lines.";
42
+ const unreadable = {
43
+ maybeRenamedFrom: Option.none(),
44
+ notes: [UNREADABLE_NOTE],
45
+ tables: []
46
+ };
47
+ const lineNote = (head, hasRows) => {
48
+ if (hasLine(head, "Binary files ") || hasLine(head, "GIT binary patch")) return __foldkitBrandViewResult((Option.some(BINARY_NOTE)), "@gjermundgaraba/pixel-paper/line-diff/patch.js#lineNote");
49
+ else if (hasRows) return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba/pixel-paper/line-diff/patch.js#lineNote");
50
+ else if (hasLine(head, "new file mode ")) return __foldkitBrandViewResult((Option.some("New empty file.")), "@gjermundgaraba/pixel-paper/line-diff/patch.js#lineNote");
51
+ else if (hasLine(head, "deleted file mode ")) return __foldkitBrandViewResult((Option.some("Deleted empty file.")), "@gjermundgaraba/pixel-paper/line-diff/patch.js#lineNote");
52
+ return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba/pixel-paper/line-diff/patch.js#lineNote");
53
+ };
54
+ const readSection = (section, rowsOf) => {
55
+ const head = headOf(section);
56
+ const maybeRows = rowsOf(section);
57
+ const maybeRenamedFrom = Option.map(valueAfter(head, "rename from "), unquoted);
58
+ const notes = [
59
+ ...Option.toArray(Option.map(maybeRenamedFrom, (from) => __foldkitBrandViewResult((`Renamed from ${from}.`), "@gjermundgaraba/pixel-paper/line-diff/patch.js#anonymous~3"))),
60
+ ...Option.toArray(Option.map(Option.all({
61
+ before: valueAfter(head, "old mode "),
62
+ after: valueAfter(head, "new mode ")
63
+ }), ({ before, after }) => __foldkitBrandViewResult((`Mode ${before} → ${after}.`), "@gjermundgaraba/pixel-paper/line-diff/patch.js#anonymous~4"))),
64
+ ...Option.toArray(lineNote(head, Option.isSome(maybeRows)))
65
+ ];
66
+ return __foldkitBrandViewResult((Option.isNone(maybeRows) && (hasHunk(section) || Array.isArrayEmpty(notes)) ? unreadable : {
67
+ maybeRenamedFrom,
68
+ notes,
69
+ tables: Option.toArray(Option.map(maybeRows, (rows) => (__foldkitBrandViewResult(({
70
+ rows,
71
+ maybeSide: Option.none()
72
+ }), "@gjermundgaraba/pixel-paper/line-diff/patch.js#anonymous~5"))))
73
+ }), "@gjermundgaraba/pixel-paper/line-diff/patch.js#readSection");
74
+ };
75
+ const KINDS = {
76
+ "100644": "a file",
77
+ "100755": "an executable file",
78
+ "120000": "a symlink",
79
+ "160000": "a submodule"
80
+ };
81
+ const kindOf = (mode) => __foldkitBrandViewResult((Option.getOrElse(Record.get(KINDS, mode), () => __foldkitBrandViewResult((`mode ${mode}`), "@gjermundgaraba/pixel-paper/line-diff/patch.js#anonymous~6"))), "@gjermundgaraba/pixel-paper/line-diff/patch.js#kindOf");
82
+ const sideTable = (section, side, rowsOf) => __foldkitBrandViewResult((Option.toArray(Option.map(rowsOf(section), (rows) => (__foldkitBrandViewResult(({
83
+ rows,
84
+ maybeSide: Option.some(side)
85
+ }), "@gjermundgaraba/pixel-paper/line-diff/patch.js#anonymous~7"))))), "@gjermundgaraba/pixel-paper/line-diff/patch.js#sideTable");
86
+ const readTypeChange = (gone, added, rowsOf) => {
87
+ const [goneHead, addedHead] = [headOf(gone), headOf(added)];
88
+ return __foldkitBrandViewResult((Option.flatMap(Option.all({
89
+ before: valueAfter(goneHead, "deleted file mode "),
90
+ after: valueAfter(addedHead, "new file mode ")
91
+ }), ({ before, after }) => __foldkitBrandViewResult((goneHead[0] === addedHead[0] ? Option.some({
92
+ maybeRenamedFrom: Option.none(),
93
+ notes: [`It was ${kindOf(before)} and is now ${kindOf(after)}.`],
94
+ tables: [...sideTable(gone, "as it was", rowsOf), ...sideTable(added, "as it is", rowsOf)]
95
+ }) : Option.none()), "@gjermundgaraba/pixel-paper/line-diff/patch.js#anonymous~8"))), "@gjermundgaraba/pixel-paper/line-diff/patch.js#readTypeChange");
96
+ };
97
+ const readPatchWith = (patch, rowsOf) => {
98
+ const text = patch.replaceAll("\r\n", "\n");
99
+ if (String.isEmpty(String.trim(text))) return __foldkitBrandViewResult(({
100
+ maybeRenamedFrom: Option.none(),
101
+ notes: [SAME_NOTE],
102
+ tables: []
103
+ }), "@gjermundgaraba/pixel-paper/line-diff/patch.js#readPatchWith");
104
+ const [first, second, ...rest] = sectionsOf(text);
105
+ if (first !== void 0 && second === void 0) return __foldkitBrandViewResult((readSection(first, rowsOf)), "@gjermundgaraba/pixel-paper/line-diff/patch.js#readPatchWith");
106
+ else if (first !== void 0 && second !== void 0 && Array.isArrayEmpty(rest)) return __foldkitBrandViewResult((Option.getOrElse(readTypeChange(first, second, rowsOf), () => __foldkitBrandViewResult((unreadable), "@gjermundgaraba/pixel-paper/line-diff/patch.js#anonymous~9"))), "@gjermundgaraba/pixel-paper/line-diff/patch.js#readPatchWith");
107
+ return __foldkitBrandViewResult((unreadable), "@gjermundgaraba/pixel-paper/line-diff/patch.js#readPatchWith");
108
+ };
109
+ const readPatch = (patch) => __foldkitBrandViewResult((readPatchWith(patch, diffRowsOfPatch)), "@gjermundgaraba/pixel-paper/line-diff/patch.js#readPatch");
110
+ /** What `patchView` says about a patch from `git diff`, read from its header: the notes it
111
+ * prints (`["Renamed from old.txt."]`), for a caller that prints them itself, and the path a
112
+ * rename left. */
113
+ const describePatch = (patch) => {
114
+ const { maybeRenamedFrom, notes } = readPatchWith(patch, (section) => __foldkitBrandViewResult((Option.as(hunksOfPatch(section), [])), "@gjermundgaraba/pixel-paper/line-diff/patch.js#anonymous~10"));
115
+ return __foldkitBrandViewResult(({
116
+ maybeRenamedFrom,
117
+ notes
118
+ }), "@gjermundgaraba/pixel-paper/line-diff/patch.js#describePatch");
119
+ };
120
+ export { SAME_NOTE, describePatch, readPatch, unquoted };
@@ -0,0 +1,5 @@
1
+ import { ViewConfig, view } from "./link-button.js";
2
+ declare namespace index_d_exports {
3
+ export { ViewConfig, view };
4
+ }
5
+ export { type ViewConfig, index_d_exports, view };
@@ -0,0 +1,6 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
3
+ import { view } from "./link-button.js";
4
+ // src/link-button/index.ts
5
+ var link_button_exports = /* @__PURE__ */ __exportAll({ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/link-button/index.js#view") });
6
+ export { link_button_exports, view };
@@ -0,0 +1,11 @@
1
+ import { GlyphName } from "../glyph/glyphs.js";
2
+ import { Look } from "../button/button.js";
3
+ import { Html, HtmlBuilder } from "foldkit/html";
4
+ /** Configuration for rendering a link button with `view`. */
5
+ export type ViewConfig = Look & Readonly<{
6
+ label: string;
7
+ href: string;
8
+ glyph?: GlyphName;
9
+ }>;
10
+ /** A `Button` that goes somewhere instead of doing something: a link printed the same. */
11
+ export declare const view: <Message>(config: ViewConfig, h: HtmlBuilder<Message>) => Html;
@@ -0,0 +1,10 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { view as view$1 } from "../glyph/glyph.js";
3
+ import { lookClassName } from "../button/button.js";
4
+ // src/link-button/link-button.ts
5
+ /** A `Button` that goes somewhere instead of doing something: a link printed the same. */
6
+ const view = (config, h) => {
7
+ const { label, href, glyph } = config;
8
+ return __foldkitBrandViewResult((h.a([h.Href(href), h.Class(lookClassName(config))], [...glyph === void 0 ? [] : [view$1({ name: glyph }, h)], label])), "@gjermundgaraba/pixel-paper/link-button/link-button.js#view");
9
+ };
10
+ export { view };
@@ -0,0 +1,5 @@
1
+ import { State, ViewConfig, view } from "./link-state.js";
2
+ declare namespace index_d_exports {
3
+ export { State, ViewConfig, view };
4
+ }
5
+ export { type State, type ViewConfig, index_d_exports, view };
@@ -0,0 +1,6 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
3
+ import { view } from "./link-state.js";
4
+ // src/link-state/index.ts
5
+ var link_state_exports = /* @__PURE__ */ __exportAll({ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/link-state/index.js#view") });
6
+ export { link_state_exports, view };
@@ -0,0 +1,15 @@
1
+ import { Schema } from "effect";
2
+ import { Html, HtmlBuilder } from "foldkit/html";
3
+ /** `Connecting`: the first reach, muted and working. `Reconnecting`: the link dropped and is
4
+ * coming back, on amber. `Offline`: given up, on red. Both stay visible on a phone. */
5
+ export declare const State: Schema.Literals<readonly ["Online", "Connecting", "Reconnecting", "Offline"]>;
6
+ export type State = typeof State.Type;
7
+ /** Configuration for rendering a connection word with `view`. */
8
+ export type ViewConfig = Readonly<{
9
+ state: State;
10
+ /** The words; the state's name by default. */
11
+ label?: string;
12
+ }>;
13
+ /** The connection word, in a top bar or a status bar. It is a status (`role="status"`), so a
14
+ * change of state is read out; while it connects it prints the working cursor. */
15
+ export declare const view: <Message>(config: ViewConfig, h: HtmlBuilder<Message>) => Html;
@@ -0,0 +1,17 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { Match, Schema } from "effect";
3
+ Schema.Literals([
4
+ "Online",
5
+ "Connecting",
6
+ "Reconnecting",
7
+ "Offline"
8
+ ]);
9
+ const stateWord = (state) => __foldkitBrandViewResult((Match.value(state).pipe(Match.withReturnType(), Match.when("Online", () => __foldkitBrandViewResult(("online"), "@gjermundgaraba/pixel-paper/link-state/link-state.js#anonymous")), Match.when("Connecting", () => __foldkitBrandViewResult(("connecting"), "@gjermundgaraba/pixel-paper/link-state/link-state.js#anonymous~2")), Match.when("Reconnecting", () => __foldkitBrandViewResult(("reconnecting"), "@gjermundgaraba/pixel-paper/link-state/link-state.js#anonymous~3")), Match.when("Offline", () => __foldkitBrandViewResult(("offline"), "@gjermundgaraba/pixel-paper/link-state/link-state.js#anonymous~4")), Match.exhaustive)), "@gjermundgaraba/pixel-paper/link-state/link-state.js#stateWord");
10
+ /** The connection word, in a top bar or a status bar. It is a status (`role="status"`), so a
11
+ * change of state is read out; while it connects it prints the working cursor. */
12
+ const view = (config, h) => {
13
+ const { state, label = stateWord(state) } = config;
14
+ const isWorking = state === "Connecting" || state === "Reconnecting";
15
+ return __foldkitBrandViewResult((h.span([h.Role("status"), h.Class(`link-state${state === "Online" ? "" : ` ${stateWord(state)}`}`)], [label, ...isWorking ? [h.span([h.Class("cursor"), h.AriaHidden(true)])] : []])), "@gjermundgaraba/pixel-paper/link-state/link-state.js#view");
16
+ };
17
+ export { view };
@@ -0,0 +1,5 @@
1
+ import { DialogEntry, Placement, ViewConfig, place, view } from "./live-region.js";
2
+ declare namespace index_d_exports {
3
+ export { DialogEntry, Placement, ViewConfig, place, view };
4
+ }
5
+ export { type DialogEntry, type Placement, type ViewConfig, index_d_exports, place, view };
@@ -0,0 +1,9 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
3
+ import { place, view } from "./live-region.js";
4
+ // src/live-region/index.ts
5
+ var live_region_exports = /* @__PURE__ */ __exportAll({
6
+ place: () => __foldkitBrandViewResult((place), "@gjermundgaraba/pixel-paper/live-region/index.js#place"),
7
+ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/live-region/index.js#view")
8
+ });
9
+ export { live_region_exports, place, view };
@@ -0,0 +1,39 @@
1
+ import { Html, HtmlBuilder } from "foldkit/html";
2
+ /** A dialog that can host the page's live parts: its name in the application, and whether it
3
+ * is open now. */
4
+ export type DialogEntry<Host extends string> = readonly [host: Host, isOpen: boolean];
5
+ /** Where the page's live parts go on this render. */
6
+ export type Placement<Host extends string> = Readonly<{
7
+ /** The `toLiveRegionView` to give the dialog `host`: the parts while it is the topmost open
8
+ * dialog, `undefined` while it is not. */
9
+ toDialogView: (host: Host) => (() => Html) | undefined;
10
+ /** The parts for the end of the body while no dialog is open, nothing while one is. */
11
+ toPageView: () => readonly Html[];
12
+ }>;
13
+ /**
14
+ * Places the page's live parts by the hosting rule: an open Dialog makes the page outside it
15
+ * inert and hidden from screen readers, so they render inside the topmost open dialog, and at
16
+ * the end of the body while none is open, exactly once either way. Neither renders them
17
+ * until called, so a Submodel among the parts (the toast stack) is built once. `dialogs` lists every dialog
18
+ * that can host them from the bottom of the stack to the top: one that opens from another
19
+ * (a confirm from a form) comes after it, so of the open ones the last is the topmost. Call it
20
+ * on every render, from the application's Model, so the parts move as dialogs open and close.
21
+ *
22
+ * ```ts
23
+ * const placement = LiveRegion.place([
24
+ * ["Rename", Dialog.isOpen(model.rename)],
25
+ * ["Delete", ConfirmDialog.isOpen(model.deleteConfirm)],
26
+ * ], () => LiveRegion.view({ toasts: toastsView(model, h) }, h));
27
+ * // the rename dialog's view inputs: toLiveRegionView: placement.toDialogView("Rename")
28
+ * // the body: [...content, ...placement.toPageView()]
29
+ * ```
30
+ */
31
+ export declare const place: <Host extends string>(dialogs: ReadonlyArray<DialogEntry<Host>>, toView: () => Html) => Placement<Host>;
32
+ /** Configuration for rendering the page's live parts with `view`. */
33
+ export type ViewConfig = Readonly<{
34
+ /** The page's Toast stack (its `h.submodel`), when it has one. */
35
+ toasts?: Html;
36
+ }>;
37
+ /** The page's live parts together, for `place`: the Announcer's region, then the toast stack
38
+ * the application gives. */
39
+ export declare const view: <Message>(config: ViewConfig, h: HtmlBuilder<Message>) => Html;
@@ -0,0 +1,33 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { view as view$1 } from "../announcer/announcer.js";
3
+ import { Array, Option, pipe } from "effect";
4
+ // src/live-region/live-region.ts
5
+ /**
6
+ * Places the page's live parts by the hosting rule: an open Dialog makes the page outside it
7
+ * inert and hidden from screen readers, so they render inside the topmost open dialog, and at
8
+ * the end of the body while none is open, exactly once either way. Neither renders them
9
+ * until called, so a Submodel among the parts (the toast stack) is built once. `dialogs` lists every dialog
10
+ * that can host them from the bottom of the stack to the top: one that opens from another
11
+ * (a confirm from a form) comes after it, so of the open ones the last is the topmost. Call it
12
+ * on every render, from the application's Model, so the parts move as dialogs open and close.
13
+ *
14
+ * ```ts
15
+ * const placement = LiveRegion.place([
16
+ * ["Rename", Dialog.isOpen(model.rename)],
17
+ * ["Delete", ConfirmDialog.isOpen(model.deleteConfirm)],
18
+ * ], () => LiveRegion.view({ toasts: toastsView(model, h) }, h));
19
+ * // the rename dialog's view inputs: toLiveRegionView: placement.toDialogView("Rename")
20
+ * // the body: [...content, ...placement.toPageView()]
21
+ * ```
22
+ */
23
+ const place = (dialogs, toView) => {
24
+ const maybeTopmost = pipe(Array.findLast(dialogs, ([, isOpen]) => __foldkitBrandViewResult((isOpen), "@gjermundgaraba/pixel-paper/live-region/live-region.js#anonymous")), Option.map(([host]) => __foldkitBrandViewResult((host), "@gjermundgaraba/pixel-paper/live-region/live-region.js#anonymous~2")));
25
+ return __foldkitBrandViewResult(({
26
+ toDialogView: (host) => __foldkitBrandViewResult((Option.exists(maybeTopmost, (topmost) => __foldkitBrandViewResult((topmost === host), "@gjermundgaraba/pixel-paper/live-region/live-region.js#anonymous~3")) ? toView : void 0), "@gjermundgaraba/pixel-paper/live-region/live-region.js#toDialogView"),
27
+ toPageView: () => __foldkitBrandViewResult((Option.isNone(maybeTopmost) ? [toView()] : []), "@gjermundgaraba/pixel-paper/live-region/live-region.js#toPageView")
28
+ }), "@gjermundgaraba/pixel-paper/live-region/live-region.js#place");
29
+ };
30
+ /** The page's live parts together, for `place`: the Announcer's region, then the toast stack
31
+ * the application gives. */
32
+ const view = (config, h) => __foldkitBrandViewResult((h.div([], [view$1(h), ...config.toasts === void 0 ? [] : [config.toasts]])), "@gjermundgaraba/pixel-paper/live-region/live-region.js#view");
33
+ export { place, view };
@@ -0,0 +1,5 @@
1
+ import { ViewConfig, view } from "./loading.js";
2
+ declare namespace index_d_exports {
3
+ export { ViewConfig, view };
4
+ }
5
+ export { type ViewConfig, index_d_exports, view };
@@ -0,0 +1,6 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
3
+ import { view } from "./loading.js";
4
+ // src/loading/index.ts
5
+ var loading_exports = /* @__PURE__ */ __exportAll({ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/loading/index.js#view") });
6
+ export { loading_exports, view };
@@ -0,0 +1,19 @@
1
+ import { Attributes } from "../attributes/attributes.js";
2
+ import { Html, HtmlBuilder } from "foldkit/html";
3
+ /** Configuration for rendering a loading line with `view`. */
4
+ export type ViewConfig<Message> = Readonly<{
5
+ /** Whether the content is on its way. Done, the line empties and leaves the flow, so it
6
+ * takes no room and no gap, but stays in place, so the next wait is heard. */
7
+ isLoading: boolean;
8
+ /** What is on its way, in pixel caps (`"loading the items"`). `"loading"` by default. */
9
+ label?: string;
10
+ /** Attributes for the line, such as the id and `tabindex="-1"` that make it a place to
11
+ * send focus. */
12
+ attributes?: Attributes<Message>;
13
+ }>;
14
+ /** What a panel says while its content is on the way, centred where the content will be, with
15
+ * the working cursor. A polite status that stays in place with its words swapped, as a live
16
+ * region must be for a screen reader to hear it: render it before the content, from before
17
+ * the wait starts, and set `isLoading`. It is not the page's live region (the Announcer's,
18
+ * marked `data-pixel-paper-announcer`), so a test that counts live regions counts that. */
19
+ export declare const view: <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Message>) => Html;
@@ -0,0 +1,16 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ // src/loading/loading.ts
3
+ /** What a panel says while its content is on the way, centred where the content will be, with
4
+ * the working cursor. A polite status that stays in place with its words swapped, as a live
5
+ * region must be for a screen reader to hear it: render it before the content, from before
6
+ * the wait starts, and set `isLoading`. It is not the page's live region (the Announcer's,
7
+ * marked `data-pixel-paper-announcer`), so a test that counts live regions counts that. */
8
+ const view = (config, h) => {
9
+ const { isLoading, label = "loading", attributes = [] } = config;
10
+ return __foldkitBrandViewResult((h.div([
11
+ ...attributes,
12
+ h.Role("status"),
13
+ h.Class(isLoading ? "loading" : "loading-idle")
14
+ ], isLoading ? [label, h.span([h.Class("cursor"), h.AriaHidden(true)])] : [])), "@gjermundgaraba/pixel-paper/loading/loading.js#view");
15
+ };
16
+ export { view };
@@ -0,0 +1,3 @@
1
+ /** The locale every number and date in the system is written in, so the server and every
2
+ * browser print the same. */
3
+ export declare const LOCALE = "en-GB";
@@ -0,0 +1,5 @@
1
+ // src/locale/locale.ts
2
+ /** The locale every number and date in the system is written in, so the server and every
3
+ * browser print the same. */
4
+ const LOCALE = "en-GB";
5
+ export { LOCALE };
@@ -0,0 +1,5 @@
1
+ import { ViewConfig, view } from "./mark.js";
2
+ declare namespace index_d_exports {
3
+ export { ViewConfig, view };
4
+ }
5
+ export { type ViewConfig, index_d_exports, view };
@@ -0,0 +1,6 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
3
+ import { view } from "./mark.js";
4
+ // src/mark/index.ts
5
+ var mark_exports = /* @__PURE__ */ __exportAll({ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/mark/index.js#view") });
6
+ export { mark_exports, view };
@@ -0,0 +1,15 @@
1
+ import { Html, HtmlBuilder } from "foldkit/html";
2
+ /** Configuration for rendering a mark with `view`. */
3
+ export type ViewConfig<Message> = Readonly<{
4
+ /** Says what the mark means: its accessible name and its tip. */
5
+ label: string;
6
+ /** Where every row is marked, the mark prints plain: amber is for the one among many. */
7
+ isPlain?: boolean;
8
+ /** Makes the mark a toggle button, `aria-pressed` by `isPressed`. */
9
+ onToggle?: Message;
10
+ isPressed?: boolean;
11
+ }>;
12
+ /** The viewfinder glyph on amber: this one needs attention. Still, it is an image
13
+ * (`role="img"`) named by its label; with `onToggle`, a toggle button built on
14
+ * `@foldkit/ui`'s Button. */
15
+ export declare const view: <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Message>) => Html;
@@ -0,0 +1,30 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { view as view$1 } from "../glyph/glyph.js";
3
+ import { pressedAttribute } from "../button/button.js";
4
+ import { Button } from "@foldkit/ui";
5
+ // src/mark/mark.ts
6
+ /** The viewfinder glyph on amber: this one needs attention. Still, it is an image
7
+ * (`role="img"`) named by its label; with `onToggle`, a toggle button built on
8
+ * `@foldkit/ui`'s Button. */
9
+ const view = (config, h) => {
10
+ const { label, isPlain = false, onToggle, isPressed = false } = config;
11
+ const markClass = isPlain ? "mark plain" : "mark";
12
+ const glyph = view$1({ name: "mark" }, h);
13
+ return __foldkitBrandViewResult((onToggle === void 0 ? h.span([
14
+ h.Role("img"),
15
+ h.AriaLabel(label),
16
+ h.DataAttribute("tip", label),
17
+ h.Class(markClass)
18
+ ], [glyph]) : Button.view({
19
+ onClick: onToggle,
20
+ toView: (groups) => __foldkitBrandViewResult((h.button([
21
+ ...groups.button,
22
+ h.AriaLabel(label),
23
+ pressedAttribute(isPressed, h),
24
+ h.DataAttribute("tip", label),
25
+ h.Class(markClass)
26
+ ], [glyph])), "@gjermundgaraba/pixel-paper/mark/mark.js#toView")
27
+ }, h)), "@gjermundgaraba/pixel-paper/mark/mark.js#view");
28
+ };
29
+ const readingView = (config, h) => __foldkitBrandViewResult((h.span([h.Class("mark reading")], [config.label])), "@gjermundgaraba/pixel-paper/mark/mark.js#readingView");
30
+ export { readingView, view };
@@ -0,0 +1,7 @@
1
+ import { Focus } from "../focus/focus.js";
2
+ import { Item, action, check, group, link, radio } from "./item.js";
3
+ import { BindSlip, BindToggleKeys, InitConfig, Message, Model, OutMessage, ViewInputs, id, init, isOpen, update, view } from "./menu.js";
4
+ declare namespace index_d_exports {
5
+ export { BindSlip, BindToggleKeys, Focus, InitConfig, Item, Message, Model, OutMessage, ViewInputs, action, check, group, id, init, isOpen, link, radio, update, view };
6
+ }
7
+ export { BindSlip, BindToggleKeys, Focus, type InitConfig, type Item, Message, Model, OutMessage, type ViewInputs, action, check, group, id, index_d_exports, init, isOpen, link, radio, update, view };
@@ -0,0 +1,25 @@
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 { action, check, group, link, radio } from "./item.js";
5
+ import { BindSlip, BindToggleKeys, Message, Model, OutMessage, id, init, isOpen, update, view } from "./menu.js";
6
+ // src/menu/index.ts
7
+ var menu_exports = /* @__PURE__ */ __exportAll({
8
+ BindSlip: () => __foldkitBrandViewResult((BindSlip), "@gjermundgaraba/pixel-paper/menu/index.js#BindSlip"),
9
+ BindToggleKeys: () => __foldkitBrandViewResult((BindToggleKeys), "@gjermundgaraba/pixel-paper/menu/index.js#BindToggleKeys"),
10
+ Focus: () => __foldkitBrandViewResult((Focus), "@gjermundgaraba/pixel-paper/menu/index.js#Focus"),
11
+ Message: () => __foldkitBrandViewResult((Message), "@gjermundgaraba/pixel-paper/menu/index.js#Message"),
12
+ Model: () => __foldkitBrandViewResult((Model), "@gjermundgaraba/pixel-paper/menu/index.js#Model"),
13
+ OutMessage: () => __foldkitBrandViewResult((OutMessage), "@gjermundgaraba/pixel-paper/menu/index.js#OutMessage"),
14
+ action: () => __foldkitBrandViewResult((action), "@gjermundgaraba/pixel-paper/menu/index.js#action"),
15
+ check: () => __foldkitBrandViewResult((check), "@gjermundgaraba/pixel-paper/menu/index.js#check"),
16
+ group: () => __foldkitBrandViewResult((group), "@gjermundgaraba/pixel-paper/menu/index.js#group"),
17
+ id: () => __foldkitBrandViewResult((id), "@gjermundgaraba/pixel-paper/menu/index.js#id"),
18
+ init: () => __foldkitBrandViewResult((init), "@gjermundgaraba/pixel-paper/menu/index.js#init"),
19
+ isOpen: () => __foldkitBrandViewResult((isOpen), "@gjermundgaraba/pixel-paper/menu/index.js#isOpen"),
20
+ link: () => __foldkitBrandViewResult((link), "@gjermundgaraba/pixel-paper/menu/index.js#link"),
21
+ radio: () => __foldkitBrandViewResult((radio), "@gjermundgaraba/pixel-paper/menu/index.js#radio"),
22
+ update: () => __foldkitBrandViewResult((update), "@gjermundgaraba/pixel-paper/menu/index.js#update"),
23
+ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/menu/index.js#view")
24
+ });
25
+ export { BindSlip, BindToggleKeys, Focus, Message, Model, OutMessage, action, check, group, id, init, isOpen, link, menu_exports, radio, update, view };