@gjermundgaraba/pixel-paper 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (387) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +50 -2
  3. package/dist/_virtual/_rolldown/runtime.js +13 -0
  4. package/dist/announcer/announcer.d.ts +35 -0
  5. package/dist/announcer/announcer.js +121 -0
  6. package/dist/announcer/index.d.ts +5 -0
  7. package/dist/announcer/index.js +11 -0
  8. package/dist/attributes/attributes.d.ts +4 -0
  9. package/dist/banner/banner.d.ts +20 -0
  10. package/dist/banner/banner.js +18 -0
  11. package/dist/banner/index.d.ts +5 -0
  12. package/dist/banner/index.js +6 -0
  13. package/dist/bench/bench.d.ts +16 -0
  14. package/dist/bench/bench.js +12 -0
  15. package/dist/bench/index.d.ts +5 -0
  16. package/dist/bench/index.js +6 -0
  17. package/dist/board/board.d.ts +1151 -0
  18. package/dist/board/board.js +449 -0
  19. package/dist/board/index.d.ts +6 -0
  20. package/dist/board/index.js +21 -0
  21. package/dist/button/button.d.ts +54 -0
  22. package/dist/button/button.js +50 -0
  23. package/dist/button/index.d.ts +5 -0
  24. package/dist/button/index.js +9 -0
  25. package/dist/card/card.d.ts +66 -0
  26. package/dist/card/card.js +70 -0
  27. package/dist/card/index.d.ts +5 -0
  28. package/dist/card/index.js +10 -0
  29. package/dist/chip/chip.d.ts +27 -0
  30. package/dist/chip/chip.js +34 -0
  31. package/dist/chip/index.d.ts +5 -0
  32. package/dist/chip/index.js +9 -0
  33. package/dist/choice/choice.d.ts +16 -0
  34. package/dist/choice/choice.js +17 -0
  35. package/dist/choice/index.d.ts +5 -0
  36. package/dist/choice/index.js +6 -0
  37. package/dist/code-editor/code-editor.d.ts +15 -0
  38. package/dist/code-editor/code-editor.js +22 -0
  39. package/dist/code-editor/index.d.ts +5 -0
  40. package/dist/code-editor/index.js +6 -0
  41. package/dist/code-surface/code-surface.d.ts +12 -0
  42. package/dist/code-surface/code-surface.js +12 -0
  43. package/dist/code-surface/index.d.ts +5 -0
  44. package/dist/code-surface/index.js +6 -0
  45. package/dist/command-palette/command-palette.d.ts +579 -0
  46. package/dist/command-palette/command-palette.js +600 -0
  47. package/dist/command-palette/index.d.ts +9 -0
  48. package/dist/command-palette/index.js +32 -0
  49. package/dist/command-palette/keys.d.ts +13 -0
  50. package/dist/command-palette/keys.js +71 -0
  51. package/dist/command-palette/match.d.ts +43 -0
  52. package/dist/command-palette/match.js +45 -0
  53. package/dist/command-palette/message.d.ts +94 -0
  54. package/dist/command-palette/message.js +46 -0
  55. package/dist/confirm-dialog/confirm-dialog.d.ts +287 -0
  56. package/dist/confirm-dialog/confirm-dialog.js +115 -0
  57. package/dist/confirm-dialog/index.d.ts +5 -0
  58. package/dist/confirm-dialog/index.js +17 -0
  59. package/dist/copy-button/copy-button.d.ts +99 -0
  60. package/dist/copy-button/copy-button.js +96 -0
  61. package/dist/copy-button/index.d.ts +5 -0
  62. package/dist/copy-button/index.js +13 -0
  63. package/dist/crumbs/crumbs.d.ts +15 -0
  64. package/dist/crumbs/crumbs.js +11 -0
  65. package/dist/crumbs/index.d.ts +5 -0
  66. package/dist/crumbs/index.js +6 -0
  67. package/dist/deck/deck.d.ts +9 -0
  68. package/dist/deck/deck.js +9 -0
  69. package/dist/deck/index.d.ts +5 -0
  70. package/dist/deck/index.js +6 -0
  71. package/dist/dialog/dialog.d.ts +278 -0
  72. package/dist/dialog/dialog.js +145 -0
  73. package/dist/dialog/fold.d.ts +58 -0
  74. package/dist/dialog/fold.js +63 -0
  75. package/dist/dialog/index.d.ts +6 -0
  76. package/dist/dialog/index.js +21 -0
  77. package/dist/disclosure/disclosure.d.ts +24 -0
  78. package/dist/disclosure/disclosure.js +25 -0
  79. package/dist/disclosure/index.d.ts +5 -0
  80. package/dist/disclosure/index.js +6 -0
  81. package/dist/dom/html-element.js +8 -0
  82. package/dist/drag/drag.d.ts +15 -0
  83. package/dist/drag/drag.js +123 -0
  84. package/dist/drop-zone/drop-zone.d.ts +119 -0
  85. package/dist/drop-zone/drop-zone.js +64 -0
  86. package/dist/drop-zone/index.d.ts +5 -0
  87. package/dist/drop-zone/index.js +14 -0
  88. package/dist/empty-state/empty-state.d.ts +18 -0
  89. package/dist/empty-state/empty-state.js +16 -0
  90. package/dist/empty-state/index.d.ts +5 -0
  91. package/dist/empty-state/index.js +6 -0
  92. package/dist/error-summary/error-summary.d.ts +34 -0
  93. package/dist/error-summary/error-summary.js +33 -0
  94. package/dist/error-summary/index.d.ts +5 -0
  95. package/dist/error-summary/index.js +6 -0
  96. package/dist/field/field.d.ts +35 -0
  97. package/dist/field/field.js +34 -0
  98. package/dist/field/index.d.ts +5 -0
  99. package/dist/field/index.js +6 -0
  100. package/dist/field-grid/field-grid.d.ts +8 -0
  101. package/dist/field-grid/field-grid.js +8 -0
  102. package/dist/field-grid/index.d.ts +5 -0
  103. package/dist/field-grid/index.js +6 -0
  104. package/dist/fields/fields.js +9 -0
  105. package/dist/fieldset/fieldset.d.ts +13 -0
  106. package/dist/fieldset/fieldset.js +13 -0
  107. package/dist/fieldset/index.d.ts +5 -0
  108. package/dist/fieldset/index.js +6 -0
  109. package/dist/filter-chip/filter-chip.d.ts +21 -0
  110. package/dist/filter-chip/filter-chip.js +28 -0
  111. package/dist/filter-chip/index.d.ts +5 -0
  112. package/dist/filter-chip/index.js +6 -0
  113. package/dist/filter-strip/filter-strip.d.ts +12 -0
  114. package/dist/filter-strip/filter-strip.js +13 -0
  115. package/dist/filter-strip/index.d.ts +5 -0
  116. package/dist/filter-strip/index.js +6 -0
  117. package/dist/flash-word/flash-word.d.ts +31 -0
  118. package/dist/flash-word/flash-word.js +31 -0
  119. package/dist/flash-word/index.d.ts +5 -0
  120. package/dist/flash-word/index.js +9 -0
  121. package/dist/focus/focus.d.ts +15 -0
  122. package/dist/focus/focus.js +17 -0
  123. package/dist/focus/index.d.ts +5 -0
  124. package/dist/focus/index.js +9 -0
  125. package/dist/format/format.js +52 -0
  126. package/dist/format/index.d.ts +5 -0
  127. package/dist/format/index.js +6 -0
  128. package/dist/glyph/glyph.d.ts +9 -0
  129. package/dist/glyph/glyph.js +25 -0
  130. package/dist/glyph/glyphs.d.ts +381 -0
  131. package/dist/glyph/glyphs.js +2603 -0
  132. package/dist/glyph/index.d.ts +5 -0
  133. package/dist/glyph/index.js +6 -0
  134. package/dist/group/group.d.ts +8 -0
  135. package/dist/group/group.js +9 -0
  136. package/dist/group/index.d.ts +5 -0
  137. package/dist/group/index.js +6 -0
  138. package/dist/history/history.d.ts +34 -0
  139. package/dist/history/history.js +15 -0
  140. package/dist/history/index.d.ts +5 -0
  141. package/dist/history/index.js +6 -0
  142. package/dist/icon-button/icon-button.d.ts +23 -0
  143. package/dist/icon-button/icon-button.js +23 -0
  144. package/dist/icon-button/index.d.ts +5 -0
  145. package/dist/icon-button/index.js +6 -0
  146. package/dist/identity/identity.d.ts +15 -0
  147. package/dist/identity/identity.js +15 -0
  148. package/dist/identity/index.d.ts +5 -0
  149. package/dist/identity/index.js +6 -0
  150. package/dist/index.d.ts +85 -0
  151. package/dist/index.js +85 -0
  152. package/dist/inline-input/index.d.ts +5 -0
  153. package/dist/inline-input/index.js +20 -0
  154. package/dist/inline-input/inline-input.d.ts +196 -0
  155. package/dist/inline-input/inline-input.js +212 -0
  156. package/dist/key-help/index.d.ts +5 -0
  157. package/dist/key-help/index.js +18 -0
  158. package/dist/key-help/key-help.d.ts +255 -0
  159. package/dist/key-help/key-help.js +137 -0
  160. package/dist/key-hint/index.d.ts +6 -0
  161. package/dist/key-hint/index.js +12 -0
  162. package/dist/key-hint/key-hint.d.ts +13 -0
  163. package/dist/key-hint/key-hint.js +7 -0
  164. package/dist/key-hint/key-label.d.ts +18 -0
  165. package/dist/key-hint/key-label.js +77 -0
  166. package/dist/keymap/keymap.d.ts +11 -0
  167. package/dist/keymap/keymap.js +9 -0
  168. package/dist/keys/keys.js +4 -0
  169. package/dist/line-diff/diff.d.ts +2 -0
  170. package/dist/line-diff/diff.js +73 -0
  171. package/dist/line-diff/index.d.ts +6 -0
  172. package/dist/line-diff/index.js +10 -0
  173. package/dist/line-diff/line-diff.d.ts +21 -0
  174. package/dist/line-diff/line-diff.js +75 -0
  175. package/dist/line-diff/patch.d.ts +15 -0
  176. package/dist/line-diff/patch.js +120 -0
  177. package/dist/link-button/index.d.ts +5 -0
  178. package/dist/link-button/index.js +6 -0
  179. package/dist/link-button/link-button.d.ts +11 -0
  180. package/dist/link-button/link-button.js +10 -0
  181. package/dist/link-state/index.d.ts +5 -0
  182. package/dist/link-state/index.js +6 -0
  183. package/dist/link-state/link-state.d.ts +15 -0
  184. package/dist/link-state/link-state.js +17 -0
  185. package/dist/live-region/index.d.ts +5 -0
  186. package/dist/live-region/index.js +9 -0
  187. package/dist/live-region/live-region.d.ts +39 -0
  188. package/dist/live-region/live-region.js +33 -0
  189. package/dist/loading/index.d.ts +5 -0
  190. package/dist/loading/index.js +6 -0
  191. package/dist/loading/loading.d.ts +19 -0
  192. package/dist/loading/loading.js +16 -0
  193. package/dist/locale/locale.d.ts +3 -0
  194. package/dist/locale/locale.js +5 -0
  195. package/dist/mark/index.d.ts +5 -0
  196. package/dist/mark/index.js +6 -0
  197. package/dist/mark/mark.d.ts +15 -0
  198. package/dist/mark/mark.js +30 -0
  199. package/dist/menu/index.d.ts +7 -0
  200. package/dist/menu/index.js +25 -0
  201. package/dist/menu/item.d.ts +236 -0
  202. package/dist/menu/item.js +19 -0
  203. package/dist/menu/menu.d.ts +206 -0
  204. package/dist/menu/menu.js +208 -0
  205. package/dist/menu/slip.js +163 -0
  206. package/dist/meter/index.d.ts +5 -0
  207. package/dist/meter/index.js +6 -0
  208. package/dist/meter/meter.d.ts +38 -0
  209. package/dist/meter/meter.js +69 -0
  210. package/dist/monogram/monogram.js +33 -0
  211. package/dist/nav-strip/index.d.ts +5 -0
  212. package/dist/nav-strip/index.js +6 -0
  213. package/dist/nav-strip/nav-strip.d.ts +19 -0
  214. package/dist/nav-strip/nav-strip.js +21 -0
  215. package/dist/notice/index.d.ts +5 -0
  216. package/dist/notice/index.js +6 -0
  217. package/dist/notice/notice.d.ts +23 -0
  218. package/dist/notice/notice.js +35 -0
  219. package/dist/outcome/index.d.ts +5 -0
  220. package/dist/outcome/index.js +6 -0
  221. package/dist/outcome/outcome.d.ts +19 -0
  222. package/dist/outcome/outcome.js +14 -0
  223. package/dist/page-head/index.d.ts +5 -0
  224. package/dist/page-head/index.js +6 -0
  225. package/dist/page-head/page-head.d.ts +13 -0
  226. package/dist/page-head/page-head.js +10 -0
  227. package/dist/panel/index.d.ts +5 -0
  228. package/dist/panel/index.js +6 -0
  229. package/dist/panel/panel.d.ts +35 -0
  230. package/dist/panel/panel.js +25 -0
  231. package/dist/password-field/index.d.ts +5 -0
  232. package/dist/password-field/index.js +6 -0
  233. package/dist/password-field/password-field.d.ts +33 -0
  234. package/dist/password-field/password-field.js +39 -0
  235. package/dist/places/index.d.ts +5 -0
  236. package/dist/places/index.js +6 -0
  237. package/dist/places/places.d.ts +32 -0
  238. package/dist/places/places.js +22 -0
  239. package/dist/props-list/index.d.ts +5 -0
  240. package/dist/props-list/index.js +6 -0
  241. package/dist/props-list/props-list.d.ts +18 -0
  242. package/dist/props-list/props-list.js +12 -0
  243. package/dist/prose/index.d.ts +5 -0
  244. package/dist/prose/index.js +6 -0
  245. package/dist/prose/prose.d.ts +14 -0
  246. package/dist/prose/prose.js +6 -0
  247. package/dist/query-chip/index.d.ts +5 -0
  248. package/dist/query-chip/index.js +6 -0
  249. package/dist/query-chip/query-chip.d.ts +18 -0
  250. package/dist/query-chip/query-chip.js +17 -0
  251. package/dist/radio-choices/index.d.ts +5 -0
  252. package/dist/radio-choices/index.js +12 -0
  253. package/dist/radio-choices/radio-choices.d.ts +105 -0
  254. package/dist/radio-choices/radio-choices.js +56 -0
  255. package/dist/rail/index.d.ts +5 -0
  256. package/dist/rail/index.js +22 -0
  257. package/dist/rail/rail.d.ts +403 -0
  258. package/dist/rail/rail.js +355 -0
  259. package/dist/reel/index.d.ts +6 -0
  260. package/dist/reel/index.js +26 -0
  261. package/dist/reel/layout.d.ts +58 -0
  262. package/dist/reel/layout.js +378 -0
  263. package/dist/reel/reel.d.ts +1070 -0
  264. package/dist/reel/reel.js +1019 -0
  265. package/dist/remote/index.d.ts +5 -0
  266. package/dist/remote/index.js +6 -0
  267. package/dist/remote/remote.d.ts +28 -0
  268. package/dist/remote/remote.js +41 -0
  269. package/dist/rows/index.d.ts +5 -0
  270. package/dist/rows/index.js +12 -0
  271. package/dist/rows/rows.d.ts +116 -0
  272. package/dist/rows/rows.js +67 -0
  273. package/dist/scheme/index.d.ts +6 -0
  274. package/dist/scheme/index.js +10 -0
  275. package/dist/scheme/scheme-switch.d.ts +98 -0
  276. package/dist/scheme/scheme-switch.js +118 -0
  277. package/dist/scheme/scheme.d.ts +5 -0
  278. package/dist/scheme/scheme.js +16 -0
  279. package/dist/scheme/script.d.ts +8 -0
  280. package/dist/scheme/script.js +10 -0
  281. package/dist/secret/index.d.ts +5 -0
  282. package/dist/secret/index.js +6 -0
  283. package/dist/secret/secret.d.ts +13 -0
  284. package/dist/secret/secret.js +9 -0
  285. package/dist/segmented/index.d.ts +5 -0
  286. package/dist/segmented/index.js +6 -0
  287. package/dist/segmented/segmented.d.ts +17 -0
  288. package/dist/segmented/segmented.js +17 -0
  289. package/dist/select-field/index.d.ts +5 -0
  290. package/dist/select-field/index.js +6 -0
  291. package/dist/select-field/select-field.d.ts +38 -0
  292. package/dist/select-field/select-field.js +29 -0
  293. package/dist/sheet/index.d.ts +5 -0
  294. package/dist/sheet/index.js +6 -0
  295. package/dist/sheet/sheet.d.ts +16 -0
  296. package/dist/sheet/sheet.js +15 -0
  297. package/dist/skip-link/index.d.ts +5 -0
  298. package/dist/skip-link/index.js +9 -0
  299. package/dist/skip-link/skip-link.d.ts +23 -0
  300. package/dist/skip-link/skip-link.js +36 -0
  301. package/dist/slot/slot.js +8 -0
  302. package/dist/sortable/index.d.ts +5 -0
  303. package/dist/sortable/index.js +16 -0
  304. package/dist/sortable/sortable.d.ts +1125 -0
  305. package/dist/sortable/sortable.js +431 -0
  306. package/dist/stack/index.d.ts +5 -0
  307. package/dist/stack/index.js +6 -0
  308. package/dist/stack/stack.d.ts +15 -0
  309. package/dist/stack/stack.js +12 -0
  310. package/dist/stage/index.d.ts +5 -0
  311. package/dist/stage/index.js +6 -0
  312. package/dist/stage/stage.d.ts +14 -0
  313. package/dist/stage/stage.js +11 -0
  314. package/dist/stat/index.d.ts +5 -0
  315. package/dist/stat/index.js +6 -0
  316. package/dist/stat/stat.d.ts +18 -0
  317. package/dist/stat/stat.js +13 -0
  318. package/dist/status-bar/index.d.ts +6 -0
  319. package/dist/status-bar/index.js +11 -0
  320. package/dist/status-bar/status-bar.d.ts +28 -0
  321. package/dist/status-bar/status-bar.js +19 -0
  322. package/dist/subscription/prefix-keys.js +12 -0
  323. package/dist/table/index.d.ts +5 -0
  324. package/dist/table/index.js +6 -0
  325. package/dist/table/table.d.ts +26 -0
  326. package/dist/table/table.js +18 -0
  327. package/dist/tabs/index.d.ts +5 -0
  328. package/dist/tabs/index.js +14 -0
  329. package/dist/tabs/tabs.d.ts +125 -0
  330. package/dist/tabs/tabs.js +57 -0
  331. package/dist/tag/index.d.ts +5 -0
  332. package/dist/tag/index.js +6 -0
  333. package/dist/tag/tag.d.ts +16 -0
  334. package/dist/tag/tag.js +25 -0
  335. package/dist/text-button/index.d.ts +5 -0
  336. package/dist/text-button/index.js +6 -0
  337. package/dist/text-button/text-button.d.ts +8 -0
  338. package/dist/text-button/text-button.js +12 -0
  339. package/dist/textarea-field/index.d.ts +5 -0
  340. package/dist/textarea-field/index.js +6 -0
  341. package/dist/textarea-field/textarea-field.d.ts +28 -0
  342. package/dist/textarea-field/textarea-field.js +30 -0
  343. package/dist/time/index.d.ts +5 -0
  344. package/dist/time/index.js +9 -0
  345. package/dist/time/time.d.ts +38 -0
  346. package/dist/time/time.js +63 -0
  347. package/dist/tips/index.d.ts +5 -0
  348. package/dist/tips/index.js +14 -0
  349. package/dist/tips/tips.d.ts +339 -0
  350. package/dist/tips/tips.js +308 -0
  351. package/dist/toast/index.d.ts +5 -0
  352. package/dist/toast/index.js +17 -0
  353. package/dist/toast/stack.d.ts +7 -0
  354. package/dist/toast/stack.js +23 -0
  355. package/dist/toast/toast.d.ts +559 -0
  356. package/dist/toast/toast.js +269 -0
  357. package/dist/toc/index.d.ts +5 -0
  358. package/dist/toc/index.js +9 -0
  359. package/dist/toc/toc.d.ts +42 -0
  360. package/dist/toc/toc.js +35 -0
  361. package/dist/top-bar/bar-height.d.ts +26 -0
  362. package/dist/top-bar/bar-height.js +43 -0
  363. package/dist/top-bar/index.d.ts +6 -0
  364. package/dist/top-bar/index.js +12 -0
  365. package/dist/top-bar/top-bar.d.ts +19 -0
  366. package/dist/top-bar/top-bar.js +18 -0
  367. package/dist/wall/index.d.ts +5 -0
  368. package/dist/wall/index.js +9 -0
  369. package/dist/wall/wall.d.ts +16 -0
  370. package/dist/wall/wall.js +15 -0
  371. package/dist/window/index.d.ts +5 -0
  372. package/dist/window/index.js +6 -0
  373. package/dist/window/window.d.ts +28 -0
  374. package/dist/window/window.js +29 -0
  375. package/dist/wordmark/index.d.ts +5 -0
  376. package/dist/wordmark/index.js +6 -0
  377. package/dist/wordmark/wordmark.d.ts +10 -0
  378. package/dist/wordmark/wordmark.js +10 -0
  379. package/dist/wrap/index.d.ts +5 -0
  380. package/dist/wrap/index.js +6 -0
  381. package/dist/wrap/wrap.d.ts +12 -0
  382. package/dist/wrap/wrap.js +9 -0
  383. package/fonts/DepartureMono-Regular.woff2 +0 -0
  384. package/fonts/LICENSE.txt +2 -0
  385. package/package.json +57 -3
  386. package/src/pixel-paper.css +4611 -0
  387. package/src/tokens.css +151 -0
@@ -0,0 +1,269 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { announce } from "../announcer/announcer.js";
3
+ import { TONE_CLASS, toneGlyphView } from "../notice/notice.js";
4
+ import { isPlain } from "../keys/keys.js";
5
+ import { view as view$1 } from "../icon-button/icon-button.js";
6
+ import { Focus } from "../focus/focus.js";
7
+ import { htmlElement } from "../dom/html-element.js";
8
+ import { Message as Message$1, Model as Model$1, OutMessage, dismiss as dismiss$1, hold, init as init$1, newestId, release, show as show$1, showing, update as update$1, view as view$2 } from "./stack.js";
9
+ import { Array, Duration, Effect, Match, Option, Schema, Stream } from "effect";
10
+ import * as Command from "foldkit/command";
11
+ import { defineMessageUnion } from "foldkit/message";
12
+ import * as Render from "foldkit/render";
13
+ import * as Mount from "foldkit/mount";
14
+ import { modifyFields } from "foldkit/struct";
15
+ import { defineView } from "foldkit/submodel";
16
+ import * as Update from "foldkit/update";
17
+ import * as Dom from "foldkit/dom";
18
+ // src/toast/toast.ts
19
+ /** Schema for the page's toast stack: the `@foldkit/ui` Toast stack it is built on, which
20
+ * holds the slips, what holds them on screen (the pointer on a slip, the keyboard in the
21
+ * stack), and where focus came into the stack from. */
22
+ const Model = Schema.Struct({
23
+ stack: Model$1,
24
+ isPointerIn: Schema.Boolean,
25
+ isFocusIn: Schema.Boolean,
26
+ maybeReturnFocusId: Schema.Option(Schema.String)
27
+ });
28
+ /** Union of all Messages the toast stack can produce. */
29
+ const Message = defineMessageUnion({
30
+ GotStackMessage: { message: Message$1 },
31
+ FocusedStack: { maybeFromId: Schema.Option(Schema.String) },
32
+ BlurredStack: {},
33
+ PressedEscape: {},
34
+ MovedHost: {},
35
+ ClickedDismiss: { entryId: Schema.String },
36
+ CompletedFocusSlip: {},
37
+ CompletedFocus: {},
38
+ CompletedAnnounceSlip: {}
39
+ });
40
+ const TOAST_HOLD = Duration.seconds(5);
41
+ const MOST_SHOWING = 3;
42
+ /** Creates an empty toast stack. */
43
+ const init = (config) => (__foldkitBrandViewResult(({
44
+ stack: init$1({
45
+ id: config.id,
46
+ defaultDuration: TOAST_HOLD
47
+ }),
48
+ isPointerIn: false,
49
+ isFocusIn: false,
50
+ maybeReturnFocusId: Option.none()
51
+ }), "@gjermundgaraba/pixel-paper/toast/toast.js#init"));
52
+ /** The stack's id, unique in the document. */
53
+ const id = (model) => __foldkitBrandViewResult((model.stack.id), "@gjermundgaraba/pixel-paper/toast/toast.js#id");
54
+ const isHeld = (model) => __foldkitBrandViewResult((model.isPointerIn || model.isFocusIn), "@gjermundgaraba/pixel-paper/toast/toast.js#isHeld");
55
+ const slips = (model) => __foldkitBrandViewResult((showing(model.stack)), "@gjermundgaraba/pixel-paper/toast/toast.js#slips");
56
+ const foldConfig = {
57
+ foldOutMessage: OutMessage.match({ DismissedToast: () => __foldkitBrandViewResult(((model) => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous"))), "@gjermundgaraba/pixel-paper/toast/toast.js#DismissedToast") }),
58
+ read: (model) => __foldkitBrandViewResult((Option.some(model.stack)), "@gjermundgaraba/pixel-paper/toast/toast.js#read"),
59
+ write: (model, nextStack) => __foldkitBrandViewResult((modifyFields(model, { stack: () => __foldkitBrandViewResult((nextStack), "@gjermundgaraba/pixel-paper/toast/toast.js#stack") })), "@gjermundgaraba/pixel-paper/toast/toast.js#write"),
60
+ toParentMessage: (message) => __foldkitBrandViewResult((Message.GotStackMessage({ message })), "@gjermundgaraba/pixel-paper/toast/toast.js#toParentMessage")
61
+ };
62
+ const foldStack = Update.foldChild({
63
+ update: update$1,
64
+ ...foldConfig
65
+ });
66
+ const stackStep = (apply, entryId) => __foldkitBrandViewResult((Update.foldChildStep({
67
+ update: (stack) => __foldkitBrandViewResult((apply(stack, entryId)), "@gjermundgaraba/pixel-paper/toast/toast.js#update"),
68
+ ...foldConfig
69
+ })), "@gjermundgaraba/pixel-paper/toast/toast.js#stackStep");
70
+ const dismissStep = (entryId) => __foldkitBrandViewResult((stackStep(dismiss$1, entryId)), "@gjermundgaraba/pixel-paper/toast/toast.js#dismissStep");
71
+ const eachSlip = (model, apply, maybeExceptId) => __foldkitBrandViewResult((Update.combine(model, Array.map(Array.filter(slips(model), (slip) => __foldkitBrandViewResult((!Option.contains(maybeExceptId, slip.id)), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~2")), (slip) => __foldkitBrandViewResult((stackStep(apply, slip.id)), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~3")))), "@gjermundgaraba/pixel-paper/toast/toast.js#eachSlip");
72
+ const holdAll = (model) => __foldkitBrandViewResult((eachSlip(model, hold, Option.none())), "@gjermundgaraba/pixel-paper/toast/toast.js#holdAll");
73
+ const releaseUnlessHeld = (model, maybeExceptId) => __foldkitBrandViewResult((isHeld(model) ? holdAll(model) : eachSlip(model, release, maybeExceptId)), "@gjermundgaraba/pixel-paper/toast/toast.js#releaseUnlessHeld");
74
+ const pointerMoved = (stackMessage) => __foldkitBrandViewResult((Match.value(stackMessage).pipe(Match.withReturnType(), Match.tag("HoveredEntry", ({ entryId }) => __foldkitBrandViewResult((Option.some({
75
+ isPointerIn: true,
76
+ entryId
77
+ })), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~4")), Match.tag("LeftEntry", ({ entryId }) => __foldkitBrandViewResult((Option.some({
78
+ isPointerIn: false,
79
+ entryId
80
+ })), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~5")), Match.orElse(() => __foldkitBrandViewResult((Option.none()), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~6")))), "@gjermundgaraba/pixel-paper/toast/toast.js#pointerMoved");
81
+ const holdIfHeld = (entryId) => __foldkitBrandViewResult(((model) => __foldkitBrandViewResult((isHeld(model) ? stackStep(hold, entryId)(model) : { model }), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~7")), "@gjermundgaraba/pixel-paper/toast/toast.js#holdIfHeld");
82
+ const updateStack = (model, stackMessage) => __foldkitBrandViewResult((Option.match(pointerMoved(stackMessage), {
83
+ onNone: () => __foldkitBrandViewResult((foldStack(model, stackMessage)), "@gjermundgaraba/pixel-paper/toast/toast.js#onNone"),
84
+ onSome: ({ isPointerIn, entryId }) => __foldkitBrandViewResult((Update.combine(modifyFields(model, { isPointerIn: () => __foldkitBrandViewResult((isPointerIn), "@gjermundgaraba/pixel-paper/toast/toast.js#isPointerIn") }), [foldStack(stackMessage), (moved) => __foldkitBrandViewResult((releaseUnlessHeld(moved, Option.some(entryId))), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~8")])), "@gjermundgaraba/pixel-paper/toast/toast.js#onSome")
85
+ })), "@gjermundgaraba/pixel-paper/toast/toast.js#updateStack");
86
+ /** Moves focus, after the keyboard dismissed a slip, to the dismiss button of the slip now in
87
+ * its place, or the one before it. */
88
+ const FocusSlip = Command.define("FocusSlip", {
89
+ args: { entryId: Schema.String },
90
+ messages: [Message.CompletedFocusSlip],
91
+ execute: ({ entryId }) => __foldkitBrandViewResult((Dom.focus(`#${CSS.escape(entryId)} .toast > .iconbtn`).pipe(Effect.ignore, Effect.as(Message.CompletedFocusSlip()))), "@gjermundgaraba/pixel-paper/toast/toast.js#execute")
92
+ });
93
+ const stackElement = (stackId) => __foldkitBrandViewResult((htmlElement(`#${CSS.escape(stackId)}`)), "@gjermundgaraba/pixel-paper/toast/toast.js#stackElement");
94
+ /**
95
+ * Says a raised slip exactly once. `@foldkit/ui`'s stack is always a polite live region, so a
96
+ * slip added to a stack already on the page is read from there, and this says nothing more. A
97
+ * stack mounted in the same render (it moved to another host, a Dialog opening or closing in
98
+ * the same update) is a live region that arrives already holding the slip, which goes
99
+ * unheard: then the slip is said through the page's live region (as `Announcer.Announce` does),
100
+ * which follows the same host. It compares the stack element before and after the render.
101
+ */
102
+ const AnnounceSlip = Command.define("AnnounceSlip", {
103
+ args: {
104
+ stackId: Schema.String,
105
+ text: Schema.String
106
+ },
107
+ messages: [Message.CompletedAnnounceSlip],
108
+ execute: ({ stackId, text }) => __foldkitBrandViewResult((Effect.gen(function* () {
109
+ const maybeBefore = yield* Effect.sync(() => __foldkitBrandViewResult((stackElement(stackId)), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~10"));
110
+ yield* Render.afterCommit;
111
+ const maybeAfter = yield* Effect.sync(() => __foldkitBrandViewResult((stackElement(stackId)), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~11"));
112
+ if (!(Option.isSome(maybeBefore) && Option.isSome(maybeAfter) && maybeBefore.value === maybeAfter.value)) yield* announce(text);
113
+ return __foldkitBrandViewResult((Message.CompletedAnnounceSlip()), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~9");
114
+ })), "@gjermundgaraba/pixel-paper/toast/toast.js#execute~2")
115
+ });
116
+ const focusAfter = (model, entryId) => {
117
+ const index = Option.getOrElse(Array.findFirstIndex(slips(model), (slip) => __foldkitBrandViewResult((slip.id === entryId), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~12")), () => __foldkitBrandViewResult((0), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~13"));
118
+ const remaining = Array.filter(slips(model), (slip) => __foldkitBrandViewResult((slip.id !== entryId), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~14"));
119
+ return __foldkitBrandViewResult((Option.match(Array.get(remaining, Math.min(index, remaining.length - 1)), {
120
+ onSome: (slip) => __foldkitBrandViewResult((Option.some(FocusSlip({ entryId: slip.id }))), "@gjermundgaraba/pixel-paper/toast/toast.js#onSome~2"),
121
+ onNone: () => __foldkitBrandViewResult((Option.map(model.maybeReturnFocusId, (elementId) => __foldkitBrandViewResult((Focus({ id: elementId })), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~15"))), "@gjermundgaraba/pixel-paper/toast/toast.js#onNone~2")
122
+ })), "@gjermundgaraba/pixel-paper/toast/toast.js#focusAfter");
123
+ };
124
+ const dismissKeepingFocus = (model, entryId) => __foldkitBrandViewResult((Update.combine(model, [dismissStep(entryId), (stepModel) => __foldkitBrandViewResult((model.isFocusIn ? {
125
+ model: modifyFields(stepModel, { isFocusIn: () => __foldkitBrandViewResult((!Array.isReadonlyArrayEmpty(slips(stepModel))), "@gjermundgaraba/pixel-paper/toast/toast.js#isFocusIn") }),
126
+ commands: Option.toArray(focusAfter(model, entryId))
127
+ } : { model: stepModel }), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~16")])), "@gjermundgaraba/pixel-paper/toast/toast.js#dismissKeepingFocus");
128
+ /** Processes a toast stack Message and returns the next Model and Commands. */
129
+ const update = (model, message) => __foldkitBrandViewResult((Message.match(message, {
130
+ GotStackMessage: ({ message: stackMessage }) => __foldkitBrandViewResult((updateStack(model, stackMessage)), "@gjermundgaraba/pixel-paper/toast/toast.js#GotStackMessage"),
131
+ FocusedStack: ({ maybeFromId }) => __foldkitBrandViewResult((holdAll(modifyFields(model, {
132
+ isFocusIn: () => __foldkitBrandViewResult((true), "@gjermundgaraba/pixel-paper/toast/toast.js#isFocusIn~2"),
133
+ maybeReturnFocusId: (returnId) => __foldkitBrandViewResult((model.isFocusIn ? returnId : maybeFromId), "@gjermundgaraba/pixel-paper/toast/toast.js#maybeReturnFocusId")
134
+ }))), "@gjermundgaraba/pixel-paper/toast/toast.js#FocusedStack"),
135
+ BlurredStack: () => __foldkitBrandViewResult((model.isFocusIn ? releaseUnlessHeld(modifyFields(model, { isFocusIn: () => __foldkitBrandViewResult((false), "@gjermundgaraba/pixel-paper/toast/toast.js#isFocusIn~3") }), Option.none()) : { model }), "@gjermundgaraba/pixel-paper/toast/toast.js#BlurredStack"),
136
+ PressedEscape: () => __foldkitBrandViewResult((Option.match(Array.last(slips(model)), {
137
+ onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/toast/toast.js#onNone~3")),
138
+ onSome: (newest) => __foldkitBrandViewResult((dismissKeepingFocus(model, newest.id)), "@gjermundgaraba/pixel-paper/toast/toast.js#onSome~3")
139
+ })), "@gjermundgaraba/pixel-paper/toast/toast.js#PressedEscape"),
140
+ MovedHost: () => __foldkitBrandViewResult((releaseUnlessHeld(modifyFields(model, {
141
+ isFocusIn: () => __foldkitBrandViewResult((false), "@gjermundgaraba/pixel-paper/toast/toast.js#isFocusIn~4"),
142
+ isPointerIn: () => __foldkitBrandViewResult((false), "@gjermundgaraba/pixel-paper/toast/toast.js#isPointerIn~2")
143
+ }), Option.none())), "@gjermundgaraba/pixel-paper/toast/toast.js#MovedHost"),
144
+ ClickedDismiss: ({ entryId }) => __foldkitBrandViewResult((dismissKeepingFocus(model, entryId)), "@gjermundgaraba/pixel-paper/toast/toast.js#ClickedDismiss"),
145
+ CompletedFocusSlip: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/toast/toast.js#CompletedFocusSlip")),
146
+ CompletedFocus: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/toast/toast.js#CompletedFocus")),
147
+ CompletedAnnounceSlip: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/toast/toast.js#CompletedAnnounceSlip"))
148
+ })), "@gjermundgaraba/pixel-paper/toast/toast.js#update~2");
149
+ const oldestCalm = (model) => {
150
+ const calm = Array.filter(slips(model), (slip) => __foldkitBrandViewResult((slip.payload.tone !== "Error"), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~17"));
151
+ return __foldkitBrandViewResult((Option.filter(Array.head(calm), () => __foldkitBrandViewResult((calm.length >= MOST_SHOWING), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~18"))), "@gjermundgaraba/pixel-paper/toast/toast.js#oldestCalm");
152
+ };
153
+ const spoken = (config) => __foldkitBrandViewResult((config.body === void 0 ? `${config.title}.` : `${config.title}. ${config.body}`), "@gjermundgaraba/pixel-paper/toast/toast.js#spoken");
154
+ /**
155
+ * Raises a slip and says it once (see `AnnounceSlip`). At most `MOST_SHOWING` slips that are
156
+ * not errors show: one more takes the place of the oldest of them. Errors stack without limit,
157
+ * take nothing's place, and stay until the reader dismisses them or the application takes
158
+ * them back with `dismiss` and the returned `entryId`. Every tone, an error included, is said
159
+ * politely, never as an alert. A slip raised while the stack is held waits with the others.
160
+ */
161
+ const show = (model, config) => {
162
+ const payload = {
163
+ tone: config.tone,
164
+ title: config.title,
165
+ maybeBody: Option.fromNullishOr(config.body)
166
+ };
167
+ const maybeReplaced = Option.filter(oldestCalm(model), () => __foldkitBrandViewResult((config.tone !== "Error"), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~19"));
168
+ const raised = Update.combine(model, [...Array.fromOption(Option.map(maybeReplaced, (slip) => __foldkitBrandViewResult((dismissStep(slip.id)), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~20"))), Update.foldChildStep({
169
+ update: (stack) => __foldkitBrandViewResult((show$1(stack, {
170
+ payload,
171
+ variant: "Info",
172
+ sticky: config.tone === "Error"
173
+ })), "@gjermundgaraba/pixel-paper/toast/toast.js#update~3"),
174
+ ...foldConfig
175
+ })]);
176
+ const entryId = Option.getOrThrowWith(newestId(raised.model.stack), () => /* @__PURE__ */ __foldkitBrandViewResult((new Error("The toast stack raised no entry.")), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~21"));
177
+ const shown = Update.combine(raised.model, [holdIfHeld(entryId), (stepModel) => (__foldkitBrandViewResult(({
178
+ model: stepModel,
179
+ commands: [AnnounceSlip({
180
+ stackId: id(stepModel),
181
+ text: spoken(config)
182
+ })]
183
+ }), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~22"))]);
184
+ return __foldkitBrandViewResult(({
185
+ model: shown.model,
186
+ commands: [...raised.commands ?? [], ...shown.commands ?? []],
187
+ entryId
188
+ }), "@gjermundgaraba/pixel-paper/toast/toast.js#show");
189
+ };
190
+ /** Takes a slip back by its id: what it reported has recovered. */
191
+ const dismiss = (model, entryId) => __foldkitBrandViewResult((dismissKeepingFocus(model, entryId)), "@gjermundgaraba/pixel-paper/toast/toast.js#dismiss");
192
+ const slipView = (entry, h) => {
193
+ const { tone, title, maybeBody } = entry.payload;
194
+ return __foldkitBrandViewResult((h.div([h.Class(`notice toast${TONE_CLASS[tone]}`)], [
195
+ toneGlyphView({ tone }, h),
196
+ h.div([], [h.strong([], [title]), ...Option.toArray(maybeBody)]),
197
+ view$1({
198
+ glyph: "cross",
199
+ label: `Dismiss: ${title}`,
200
+ onClick: Message.ClickedDismiss({ entryId: entry.id })
201
+ }, h)
202
+ ])), "@gjermundgaraba/pixel-paper/toast/toast.js#slipView");
203
+ };
204
+ const isOutside = (stack, target) => __foldkitBrandViewResult((!(target instanceof Node && stack.contains(target))), "@gjermundgaraba/pixel-paper/toast/toast.js#isOutside");
205
+ const elementId = (target) => __foldkitBrandViewResult((target instanceof Element && target.id !== "" ? Option.some(target.id) : Option.none()), "@gjermundgaraba/pixel-paper/toast/toast.js#elementId");
206
+ const isEscape = (event) => __foldkitBrandViewResult((event.key === "Escape" && !event.isComposing && !event.defaultPrevented && isPlain(event)), "@gjermundgaraba/pixel-paper/toast/toast.js#isEscape");
207
+ const stackFocusIn = (stack, event) => __foldkitBrandViewResult((Option.liftPredicate(Message.FocusedStack({ maybeFromId: elementId(event.relatedTarget) }), () => __foldkitBrandViewResult((isOutside(stack, event.relatedTarget)), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~23"))), "@gjermundgaraba/pixel-paper/toast/toast.js#stackFocusIn");
208
+ const stackFocusOut = (stack, event) => __foldkitBrandViewResult((Option.liftPredicate(Message.BlurredStack(), () => __foldkitBrandViewResult((isOutside(stack, event.relatedTarget)), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~24"))), "@gjermundgaraba/pixel-paper/toast/toast.js#stackFocusOut");
209
+ const stackKey = (event) => __foldkitBrandViewResult((Option.liftPredicate(Message.PressedEscape(), () => __foldkitBrandViewResult((isEscape(event)), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~25"))), "@gjermundgaraba/pixel-paper/toast/toast.js#stackKey");
210
+ /** The stack's focus and keys: focus coming in (and from where) and going out, and Escape
211
+ * on a slip, which takes the newest and keeps a Dialog the stack sits in open (its default is
212
+ * prevented). In a Scene, resolve it with `sceneMounts`. */
213
+ const BindStack = Mount.defineStream("BindStack", {
214
+ messages: [
215
+ Message.FocusedStack,
216
+ Message.BlurredStack,
217
+ Message.PressedEscape
218
+ ],
219
+ execute: ({ element }) => __foldkitBrandViewResult((Stream.mergeAll([
220
+ Dom.streamFromEventFilterMap({
221
+ target: element,
222
+ type: "focusin",
223
+ filterMapEvent: (event) => __foldkitBrandViewResult((stackFocusIn(element, event)), "@gjermundgaraba/pixel-paper/toast/toast.js#filterMapEvent")
224
+ }),
225
+ Dom.streamFromEventFilterMap({
226
+ target: element,
227
+ type: "focusout",
228
+ filterMapEvent: (event) => __foldkitBrandViewResult((stackFocusOut(element, event)), "@gjermundgaraba/pixel-paper/toast/toast.js#filterMapEvent~2")
229
+ }),
230
+ Dom.streamFromEventFilterMapPreventDefault({
231
+ target: element,
232
+ type: "keydown",
233
+ filterMapEvent: stackKey
234
+ })
235
+ ], { concurrency: "unbounded" })), "@gjermundgaraba/pixel-paper/toast/toast.js#execute~3")
236
+ });
237
+ /**
238
+ * The page's toasts: printed slips at the bottom right (across the bottom on a phone), the
239
+ * newest lowest, built on `@foldkit/ui`'s Toast, in a polite live region named
240
+ * "Notifications". Each slip is said once as it is raised: by the stack, or through the
241
+ * page's live region when the stack moved host in the same render (see `AnnounceSlip`). Ok
242
+ * and quiet slips leave after the hold, which waits while the pointer is on any slip or the
243
+ * keyboard is in the stack; Escape in the stack dismisses the newest, and focus moves to the
244
+ * slip now in its place, or back where it came from once none is left.
245
+ *
246
+ * Render it once, placed by the rule the Announcer follows: while a Dialog is open, inside the
247
+ * topmost one (in its `toLiveRegionView`, beside the Announcer), so a toast raised from a card
248
+ * shows above it and can be reached; otherwise in the body. Moving it lets go of its holds.
249
+ */
250
+ const view = defineView((model, h) => __foldkitBrandViewResult((h.div([
251
+ h.OnMount(BindStack()),
252
+ h.OnUnmount(Message.MovedHost()),
253
+ h.Class("toasts")
254
+ ], [h.submodel({
255
+ slotId: `${id(model)}-entries`,
256
+ model: model.stack,
257
+ view: view$2,
258
+ viewInputs: {
259
+ position: "BottomRight",
260
+ ariaLabel: "Notifications",
261
+ containerClassName: "toast-stack",
262
+ entryToView: (entry) => __foldkitBrandViewResult((slipView(entry, h)), "@gjermundgaraba/pixel-paper/toast/toast.js#entryToView")
263
+ },
264
+ toParentMessage: (message) => __foldkitBrandViewResult((Message.GotStackMessage({ message })), "@gjermundgaraba/pixel-paper/toast/toast.js#toParentMessage~2")
265
+ })])), "@gjermundgaraba/pixel-paper/toast/toast.js#anonymous~26"));
266
+ /** What a parent's Scene resolves the stack's Mounts with, each with a Message that changes
267
+ * nothing: `Scene.Mount.resolveAll(...Toast.sceneMounts)`. */
268
+ const sceneMounts = [[BindStack, Message.BlurredStack()]];
269
+ export { AnnounceSlip, BindStack, FocusSlip, Message, Model, dismiss, id, init, sceneMounts, show, stackFocusIn, stackFocusOut, stackKey, update, view };
@@ -0,0 +1,5 @@
1
+ import { Level, ReadingPositionConfig, ViewConfig, readingPositionEntry, view } from "./toc.js";
2
+ declare namespace index_d_exports {
3
+ export { Level, ReadingPositionConfig, ViewConfig, readingPositionEntry, view };
4
+ }
5
+ export { type Level, type ReadingPositionConfig, type ViewConfig, index_d_exports, readingPositionEntry, view };
@@ -0,0 +1,9 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
3
+ import { readingPositionEntry, view } from "./toc.js";
4
+ // src/toc/index.ts
5
+ var toc_exports = /* @__PURE__ */ __exportAll({
6
+ readingPositionEntry: () => __foldkitBrandViewResult((readingPositionEntry), "@gjermundgaraba/pixel-paper/toc/index.js#readingPositionEntry"),
7
+ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/toc/index.js#view")
8
+ });
9
+ export { readingPositionEntry, toc_exports, view };
@@ -0,0 +1,42 @@
1
+ import { Option, Schema } from "effect";
2
+ import { Html, HtmlBuilder } from "foldkit/html";
3
+ import { EntryWithoutKeepAlive } from "foldkit/subscription";
4
+ /** A heading's level: `2` at the margin, `3` indented under it. */
5
+ export declare const Level: Schema.Literals<readonly [2, 3]>;
6
+ export type Level = typeof Level.Type;
7
+ /** One heading in the contents. */
8
+ export type Entry = Readonly<{
9
+ /** The heading's id in the page. */
10
+ id: string;
11
+ /** The heading's words, the link's name. */
12
+ label: string;
13
+ level: Level;
14
+ }>;
15
+ /** Configuration for rendering a table of contents with `view`. */
16
+ export type ViewConfig = Readonly<{
17
+ entries: readonly Entry[];
18
+ /** The heading being read, from the caller's Model, kept by `readingPositionEntry`. `None`
19
+ * until it first reports, as during a server render: the first heading is marked. */
20
+ maybeCurrentId: Option.Option<string>;
21
+ }>;
22
+ /** The page's headings as plain links in a `<nav>` named "On this page". One ink cell marks the
23
+ * heading being read, which is also `aria-current`. */
24
+ export declare const view: <Message>(config: ViewConfig, h: HtmlBuilder<Message>) => Html;
25
+ /** Configuration for the `readingPositionEntry` Subscription helper. */
26
+ export type ReadingPositionConfig<Model, Message> = Readonly<{
27
+ /** The ids of the headings the contents list, in page order; nothing is read while empty. */
28
+ headingIds: (model: Model) => readonly string[];
29
+ toMessage: (id: string) => Message;
30
+ }>;
31
+ /**
32
+ * A Subscription entry that reports the heading being read: the last of `headingIds` that has
33
+ * passed the upper fifth of the view, else the first. It reports once at the start and then
34
+ * on each scroll that moves it to another heading. Keep the id in the Model and hand it to
35
+ * `view` as `maybeCurrentId`. Pass it into `Subscription.make` as an entry value.
36
+ *
37
+ * A Subscription, not a Mount: what it reads is the window's scroll and headings elsewhere on
38
+ * the page, not the contents element, and its answer is Model state the view renders.
39
+ */
40
+ export declare const readingPositionEntry: <Model, Message>(config: ReadingPositionConfig<Model, Message>) => EntryWithoutKeepAlive<Model, Message, Readonly<{
41
+ headingIds: readonly string[];
42
+ }>, never>;
@@ -0,0 +1,35 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { Array, Option, Schema, Stream, pipe } from "effect";
3
+ Schema.Literals([2, 3]);
4
+ const currentId = (entries, maybeCurrentId) => __foldkitBrandViewResult((Option.orElse(maybeCurrentId, () => __foldkitBrandViewResult((Option.map(Array.head(entries), ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba/pixel-paper/toc/toc.js#anonymous~2"))), "@gjermundgaraba/pixel-paper/toc/toc.js#anonymous"))), "@gjermundgaraba/pixel-paper/toc/toc.js#currentId");
5
+ /** The page's headings as plain links in a `<nav>` named "On this page". One ink cell marks the
6
+ * heading being read, which is also `aria-current`. */
7
+ const view = (config, h) => {
8
+ const { entries } = config;
9
+ const maybeCurrent = currentId(entries, config.maybeCurrentId);
10
+ return __foldkitBrandViewResult((h.nav([h.AriaLabel("On this page")], [h.ul([h.Class("toc")], Array.map(entries, ({ id, label, level }) => __foldkitBrandViewResult((h.keyed("li")(id, level === 3 ? [h.Class("l3")] : [], [h.a([h.Href(`#${id}`), ...Option.contains(maybeCurrent, id) ? [h.AriaCurrent("true")] : []], [label])])), "@gjermundgaraba/pixel-paper/toc/toc.js#anonymous~3")))])), "@gjermundgaraba/pixel-paper/toc/toc.js#view");
11
+ };
12
+ const READING_LINE = .2;
13
+ const readingPosition = (headingIds) => {
14
+ const headings = Array.getSomes(Array.map(headingIds, (id) => __foldkitBrandViewResult((Option.fromNullishOr(document.querySelector(`#${CSS.escape(id)}`))), "@gjermundgaraba/pixel-paper/toc/toc.js#anonymous~4")));
15
+ const line = window.innerHeight * READING_LINE;
16
+ return __foldkitBrandViewResult((pipe(Array.findLast(headings, (heading) => __foldkitBrandViewResult((heading.getBoundingClientRect().top <= line), "@gjermundgaraba/pixel-paper/toc/toc.js#anonymous~5")), Option.orElse(() => __foldkitBrandViewResult((Array.head(headings)), "@gjermundgaraba/pixel-paper/toc/toc.js#anonymous~6")), Option.map(({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba/pixel-paper/toc/toc.js#anonymous~7")))), "@gjermundgaraba/pixel-paper/toc/toc.js#readingPosition");
17
+ };
18
+ /**
19
+ * A Subscription entry that reports the heading being read: the last of `headingIds` that has
20
+ * passed the upper fifth of the view, else the first. It reports once at the start and then
21
+ * on each scroll that moves it to another heading. Keep the id in the Model and hand it to
22
+ * `view` as `maybeCurrentId`. Pass it into `Subscription.make` as an entry value.
23
+ *
24
+ * A Subscription, not a Mount: what it reads is the window's scroll and headings elsewhere on
25
+ * the page, not the contents element, and its answer is Model state the view renders.
26
+ */
27
+ const readingPositionEntry = (config) => (__foldkitBrandViewResult(({
28
+ dependenciesSchema: Schema.Struct({ headingIds: Schema.Array(Schema.String) }),
29
+ modelToDependencies: (model) => (__foldkitBrandViewResult(({ headingIds: config.headingIds(model) }), "@gjermundgaraba/pixel-paper/toc/toc.js#modelToDependencies")),
30
+ dependenciesToStream: ({ headingIds }) => __foldkitBrandViewResult((Array.match(headingIds, {
31
+ onEmpty: () => __foldkitBrandViewResult((Stream.empty), "@gjermundgaraba/pixel-paper/toc/toc.js#onEmpty"),
32
+ onNonEmpty: (ids) => __foldkitBrandViewResult((Stream.suspend(() => __foldkitBrandViewResult((Stream.concat(Stream.make(void 0), Stream.fromEventListener(window, "scroll", { passive: true }))), "@gjermundgaraba/pixel-paper/toc/toc.js#anonymous~8")).pipe(Stream.map(() => __foldkitBrandViewResult((readingPosition(ids)), "@gjermundgaraba/pixel-paper/toc/toc.js#anonymous~9")), Stream.filter(Option.isSome), Stream.map(({ value }) => __foldkitBrandViewResult((value), "@gjermundgaraba/pixel-paper/toc/toc.js#anonymous~10")), Stream.changes, Stream.map(config.toMessage))), "@gjermundgaraba/pixel-paper/toc/toc.js#onNonEmpty")
33
+ })), "@gjermundgaraba/pixel-paper/toc/toc.js#dependenciesToStream")
34
+ }), "@gjermundgaraba/pixel-paper/toc/toc.js#readingPositionEntry"));
35
+ export { readingPositionEntry, view };
@@ -0,0 +1,26 @@
1
+ import "../attributes/attributes.js";
2
+ import { Schema } from "effect";
3
+ import { HtmlBuilder } from "foldkit/html";
4
+ import * as Mount from "foldkit/mount";
5
+ /** What a bar's height Mount reports: it started keeping the page's custom property at the
6
+ * bar's height. Nothing in a Model follows it. */
7
+ export declare const Message: import("foldkit/message").MessageUnion<{
8
+ readonly CompletedMeasureHeight: {};
9
+ }>;
10
+ export type Message = typeof Message.Type;
11
+ /** Keeps `property` on the page's root at the bar's height, however it wraps, from the moment
12
+ * the bar mounts until it leaves, so what is placed around it clears it. Only the page's
13
+ * first bar of its kind (`selector`) does: one shown inside the page, a specimen of one,
14
+ * leaves it alone. */
15
+ export declare const MeasureHeight: Mount.MountDefinitionWithArgs<"MeasureHeight", {
16
+ selector: Schema.String;
17
+ property: Schema.String;
18
+ }, {
19
+ readonly _tag: "CompletedMeasureHeight";
20
+ }>;
21
+ /** What a parent's Scene resolves the bar's Mount with, the Message lifted as the bar's
22
+ * `toParentMessage` lifts it: `Scene.Mount.resolveAll(...TopBar.sceneMounts(toParentMessage))`.
23
+ * It matches by name, since the Mount the parent holds reports the parent's Message. */
24
+ export declare const sceneMounts: <ParentMessage>(toParentMessage: (message: Message) => ParentMessage) => readonly [readonly [{
25
+ readonly name: "MeasureHeight";
26
+ }, ParentMessage]];
@@ -0,0 +1,43 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { Effect, Schema } from "effect";
3
+ import { defineMessageUnion } from "foldkit/message";
4
+ import * as Mount from "foldkit/mount";
5
+ // src/top-bar/bar-height.ts
6
+ /** What a bar's height Mount reports: it started keeping the page's custom property at the
7
+ * bar's height. Nothing in a Model follows it. */
8
+ const Message = defineMessageUnion({ CompletedMeasureHeight: {} });
9
+ const isFirstOfKind = (element, selector) => __foldkitBrandViewResult((document.querySelector(selector) === element), "@gjermundgaraba/pixel-paper/top-bar/bar-height.js#isFirstOfKind");
10
+ /** Keeps `property` on the page's root at the bar's height, however it wraps, from the moment
11
+ * the bar mounts until it leaves, so what is placed around it clears it. Only the page's
12
+ * first bar of its kind (`selector`) does: one shown inside the page, a specimen of one,
13
+ * leaves it alone. */
14
+ const MeasureHeight = Mount.define("MeasureHeight", {
15
+ args: {
16
+ selector: Schema.String,
17
+ property: Schema.String
18
+ },
19
+ messages: [Message.CompletedMeasureHeight],
20
+ execute: ({ element, selector, property }) => __foldkitBrandViewResult((Effect.gen(function* () {
21
+ if (!(element instanceof HTMLElement) || !isFirstOfKind(element, selector)) return __foldkitBrandViewResult((Message.CompletedMeasureHeight()), "@gjermundgaraba/pixel-paper/top-bar/bar-height.js#anonymous");
22
+ const root = document.documentElement.style;
23
+ yield* Effect.acquireRelease(Effect.sync(() => {
24
+ const measure = () => {
25
+ root.setProperty(property, `${element.offsetHeight}px`);
26
+ };
27
+ const observer = new ResizeObserver(measure);
28
+ observer.observe(element);
29
+ measure();
30
+ return __foldkitBrandViewResult((observer), "@gjermundgaraba/pixel-paper/top-bar/bar-height.js#anonymous~2");
31
+ }), (observer) => __foldkitBrandViewResult((Effect.sync(() => {
32
+ observer.disconnect();
33
+ root.removeProperty(property);
34
+ })), "@gjermundgaraba/pixel-paper/top-bar/bar-height.js#anonymous~3"));
35
+ return __foldkitBrandViewResult((Message.CompletedMeasureHeight()), "@gjermundgaraba/pixel-paper/top-bar/bar-height.js#anonymous");
36
+ })), "@gjermundgaraba/pixel-paper/top-bar/bar-height.js#execute")
37
+ });
38
+ /** What a parent's Scene resolves the bar's Mount with, the Message lifted as the bar's
39
+ * `toParentMessage` lifts it: `Scene.Mount.resolveAll(...TopBar.sceneMounts(toParentMessage))`.
40
+ * It matches by name, since the Mount the parent holds reports the parent's Message. */
41
+ const sceneMounts = (toParentMessage) => __foldkitBrandViewResult(([[{ name: MeasureHeight.name }, toParentMessage(Message.CompletedMeasureHeight())]]), "@gjermundgaraba/pixel-paper/top-bar/bar-height.js#sceneMounts");
42
+ const measureAttributes = (toParentMessage, args, h) => __foldkitBrandViewResult(([h.OnMount(Mount.mapMessage(MeasureHeight(args), toParentMessage))]), "@gjermundgaraba/pixel-paper/top-bar/bar-height.js#measureAttributes");
43
+ export { MeasureHeight, Message, measureAttributes, sceneMounts };
@@ -0,0 +1,6 @@
1
+ import { MeasureHeight, Message, sceneMounts } from "./bar-height.js";
2
+ import { ViewConfig, view } from "./top-bar.js";
3
+ declare namespace index_d_exports {
4
+ export { MeasureHeight, Message, ViewConfig, sceneMounts, view };
5
+ }
6
+ export { MeasureHeight, Message, type ViewConfig, index_d_exports, sceneMounts, view };
@@ -0,0 +1,12 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
3
+ import { MeasureHeight, Message, sceneMounts } from "./bar-height.js";
4
+ import { view } from "./top-bar.js";
5
+ // src/top-bar/index.ts
6
+ var top_bar_exports = /* @__PURE__ */ __exportAll({
7
+ MeasureHeight: () => __foldkitBrandViewResult((MeasureHeight), "@gjermundgaraba/pixel-paper/top-bar/index.js#MeasureHeight"),
8
+ Message: () => __foldkitBrandViewResult((Message), "@gjermundgaraba/pixel-paper/top-bar/index.js#Message"),
9
+ sceneMounts: () => __foldkitBrandViewResult((sceneMounts), "@gjermundgaraba/pixel-paper/top-bar/index.js#sceneMounts"),
10
+ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/top-bar/index.js#view")
11
+ });
12
+ export { MeasureHeight, Message, sceneMounts, top_bar_exports, view };
@@ -0,0 +1,19 @@
1
+ import { Message } from "./bar-height.js";
2
+ import { Html, HtmlBuilder } from "foldkit/html";
3
+ /** Configuration for rendering a top bar with `view`. */
4
+ export type ViewConfig<Message$1> = Readonly<{
5
+ /** The wordmark, at the left. */
6
+ brand: ReadonlyArray<Html | string>;
7
+ /** A NavStrip; on a phone it drops to a full-width strip under the brand. */
8
+ nav?: readonly Html[];
9
+ /** The right-hand tools; they wrap as one group. */
10
+ tools?: ReadonlyArray<Html | string>;
11
+ /** Lifts the bar's lifecycle Message (`MeasureHeight` started: the page's first top bar
12
+ * keeps `--topbar-h` at its height however it wraps, so anchors land clear of it) into the
13
+ * parent's Message, which the parent's update takes and changes nothing for. In a Scene,
14
+ * resolve it with `TopBar.sceneMounts(toParentMessage)`. */
15
+ toParentMessage: (message: Message) => Message$1;
16
+ }>;
17
+ /** The sticky paper bar across the top of an interface, closed by a 2px ink rule: the page's
18
+ * banner landmark (`<header>`), with the brand, the navigation and the tools. */
19
+ export declare const view: <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Message>) => Html;
@@ -0,0 +1,18 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { slotView } from "../slot/slot.js";
3
+ import { measureAttributes } from "./bar-height.js";
4
+ // src/top-bar/top-bar.ts
5
+ /** The sticky paper bar across the top of an interface, closed by a 2px ink rule: the page's
6
+ * banner landmark (`<header>`), with the brand, the navigation and the tools. */
7
+ const view = (config, h) => {
8
+ const { brand, nav = [], tools = [], toParentMessage } = config;
9
+ return __foldkitBrandViewResult((h.header([...measureAttributes(toParentMessage, {
10
+ selector: ".topbar",
11
+ property: "--topbar-h"
12
+ }, h), h.Class("topbar")], [
13
+ ...brand,
14
+ ...nav,
15
+ ...slotView("div", "topbar-tools", tools, h)
16
+ ])), "@gjermundgaraba/pixel-paper/top-bar/top-bar.js#view");
17
+ };
18
+ export { view };
@@ -0,0 +1,5 @@
1
+ import { MarkConfig, ViewConfig, markView, view } from "./wall.js";
2
+ declare namespace index_d_exports {
3
+ export { MarkConfig, ViewConfig, markView, view };
4
+ }
5
+ export { type MarkConfig, type ViewConfig, index_d_exports, markView, view };
@@ -0,0 +1,9 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
3
+ import { markView, view } from "./wall.js";
4
+ // src/wall/index.ts
5
+ var wall_exports = /* @__PURE__ */ __exportAll({
6
+ markView: () => __foldkitBrandViewResult((markView), "@gjermundgaraba/pixel-paper/wall/index.js#markView"),
7
+ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/wall/index.js#view")
8
+ });
9
+ export { markView, view, wall_exports };
@@ -0,0 +1,16 @@
1
+ import { Html, HtmlBuilder } from "foldkit/html";
2
+ /** Configuration for rendering a wall with `view`. */
3
+ export type ViewConfig = Readonly<{
4
+ /** One Card, alone on the ground: sign-in, first-run setup. */
5
+ body: ReadonlyArray<Html | string>;
6
+ }>;
7
+ /** The whole viewport as dithered ground with one card centred on it: the main landmark
8
+ * (`<main id="main">`). */
9
+ export declare const view: <Message>(config: ViewConfig, h: HtmlBuilder<Message>) => Html;
10
+ /** Configuration for rendering a wall's mark with `markView`. */
11
+ export type MarkConfig = Readonly<{
12
+ /** The wordmark, which the mark prints at wall size. */
13
+ brand: ReadonlyArray<Html | string>;
14
+ }>;
15
+ /** The wordmark at wall size beside the lock in a box: the top of a wall's card. */
16
+ export declare const markView: <Message>(config: MarkConfig, h: HtmlBuilder<Message>) => Html;
@@ -0,0 +1,15 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { view as view$1 } from "../glyph/glyph.js";
3
+ // src/wall/wall.ts
4
+ /** The whole viewport as dithered ground with one card centred on it: the main landmark
5
+ * (`<main id="main">`). */
6
+ const view = (config, h) => {
7
+ const { body } = config;
8
+ return __foldkitBrandViewResult((h.main([h.Id("main"), h.Class("wall")], body)), "@gjermundgaraba/pixel-paper/wall/wall.js#view");
9
+ };
10
+ /** The wordmark at wall size beside the lock in a box: the top of a wall's card. */
11
+ const markView = (config, h) => {
12
+ const { brand } = config;
13
+ return __foldkitBrandViewResult((h.div([h.Class("wall-mark")], [h.span([h.Class("glyph")], [view$1({ name: "lock" }, h)]), ...brand])), "@gjermundgaraba/pixel-paper/wall/wall.js#markView");
14
+ };
15
+ export { markView, view };
@@ -0,0 +1,5 @@
1
+ import { ViewConfig, view } from "./window.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 "./window.js";
4
+ // src/window/index.ts
5
+ var window_exports = /* @__PURE__ */ __exportAll({ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/window/index.js#view") });
6
+ export { view, window_exports };
@@ -0,0 +1,28 @@
1
+ import { GlyphName } from "../glyph/glyphs.js";
2
+ import { Html, HtmlBuilder } from "foldkit/html";
3
+ /** Configuration for rendering a window with `view`. */
4
+ export type ViewConfig<Message> = Readonly<{
5
+ /** Unique in the document: the title's id is made from it, and names the window. */
6
+ id: string;
7
+ /** Pixel caps in the inverted title bar. */
8
+ title: string;
9
+ /** A quiet IconButton before the kind glyph: a Reel's grip. */
10
+ lead?: readonly Html[];
11
+ /** What kind of thing it is: a terminal, a note, a machine. */
12
+ glyph?: GlyphName;
13
+ /** A chip in the title bar: its state. */
14
+ status?: ReadonlyArray<Html | string>;
15
+ /** IconButtons in the title bar, before the close. A child Submodel, whose view is one
16
+ * `Html`, hands back several in a `span.window-tools`: it is no box of its own
17
+ * (`display: contents`), so its buttons sit in the bar as the others do. */
18
+ tools?: readonly Html[];
19
+ /** The close glyph's Message; the glyph prints when it is given. */
20
+ onClose?: Message;
21
+ body: ReadonlyArray<Html | string>;
22
+ /** The body meets the border: a terminal, an editor, rows. */
23
+ isFlush?: boolean;
24
+ }>;
25
+ /** A panel that lives on a stage, sized by whatever places it (and moved by it, if it moves):
26
+ * its body scrolls inside, and its title bar carries its kind, its state and its tools. A
27
+ * region landmark (`<section>`) named by its `h2` title. */
28
+ export declare const view: <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Message>) => Html;