@kujoforall/paper-ui 0.0.0-stage → 0.2.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 (661) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/LICENSE +21 -0
  3. package/README.md +295 -2
  4. package/dist/components/editor/block-text.d.ts +8 -0
  5. package/dist/components/editor/block-text.d.ts.map +1 -0
  6. package/dist/components/editor/block-text.js +248 -0
  7. package/dist/components/editor/block-text.js.map +1 -0
  8. package/dist/components/editor/blocks.d.ts +33 -0
  9. package/dist/components/editor/blocks.d.ts.map +1 -0
  10. package/dist/components/editor/blocks.js +191 -0
  11. package/dist/components/editor/blocks.js.map +1 -0
  12. package/dist/components/editor/document-editor.d.ts +27 -0
  13. package/dist/components/editor/document-editor.d.ts.map +1 -0
  14. package/dist/components/editor/document-editor.js +42 -0
  15. package/dist/components/editor/document-editor.js.map +1 -0
  16. package/dist/components/editor/document-view.d.ts +22 -0
  17. package/dist/components/editor/document-view.d.ts.map +1 -0
  18. package/dist/components/editor/document-view.js +110 -0
  19. package/dist/components/editor/document-view.js.map +1 -0
  20. package/dist/components/editor/editor-state.d.ts +107 -0
  21. package/dist/components/editor/editor-state.d.ts.map +1 -0
  22. package/dist/components/editor/editor-state.js +217 -0
  23. package/dist/components/editor/editor-state.js.map +1 -0
  24. package/dist/components/editor/extensions/kit-blocks.d.ts +34 -0
  25. package/dist/components/editor/extensions/kit-blocks.d.ts.map +1 -0
  26. package/dist/components/editor/extensions/kit-blocks.js +201 -0
  27. package/dist/components/editor/extensions/kit-blocks.js.map +1 -0
  28. package/dist/components/editor/extensions/spoiler.d.ts +8 -0
  29. package/dist/components/editor/extensions/spoiler.d.ts.map +1 -0
  30. package/dist/components/editor/extensions/spoiler.js +36 -0
  31. package/dist/components/editor/extensions/spoiler.js.map +1 -0
  32. package/dist/components/editor/index.d.ts +10 -0
  33. package/dist/components/editor/index.d.ts.map +1 -0
  34. package/dist/components/editor/index.js +10 -0
  35. package/dist/components/editor/index.js.map +1 -0
  36. package/dist/components/editor/kinds.d.ts +99 -0
  37. package/dist/components/editor/kinds.d.ts.map +1 -0
  38. package/dist/components/editor/kinds.js +74 -0
  39. package/dist/components/editor/kinds.js.map +1 -0
  40. package/dist/components/editor/look.d.ts +18 -0
  41. package/dist/components/editor/look.d.ts.map +1 -0
  42. package/dist/components/editor/look.js +21 -0
  43. package/dist/components/editor/look.js.map +1 -0
  44. package/dist/components/sketch/rough.d.ts +38 -0
  45. package/dist/components/sketch/rough.d.ts.map +1 -0
  46. package/dist/components/sketch/rough.js +57 -0
  47. package/dist/components/sketch/rough.js.map +1 -0
  48. package/dist/components/three/model-viewer.d.ts +36 -0
  49. package/dist/components/three/model-viewer.d.ts.map +1 -0
  50. package/dist/components/three/model-viewer.js +338 -0
  51. package/dist/components/three/model-viewer.js.map +1 -0
  52. package/dist/components/ui/accent-picker.d.ts +2 -0
  53. package/dist/components/ui/accent-picker.d.ts.map +1 -0
  54. package/dist/components/ui/accent-picker.js +44 -0
  55. package/dist/components/ui/accent-picker.js.map +1 -0
  56. package/dist/components/ui/address-field.d.ts +10 -0
  57. package/dist/components/ui/address-field.d.ts.map +1 -0
  58. package/dist/components/ui/address-field.js +24 -0
  59. package/dist/components/ui/address-field.js.map +1 -0
  60. package/dist/components/ui/alert-dialog.d.ts +29 -0
  61. package/dist/components/ui/alert-dialog.d.ts.map +1 -0
  62. package/dist/components/ui/alert-dialog.js +72 -0
  63. package/dist/components/ui/alert-dialog.js.map +1 -0
  64. package/dist/components/ui/animated-height.d.ts +6 -0
  65. package/dist/components/ui/animated-height.d.ts.map +1 -0
  66. package/dist/components/ui/animated-height.js +26 -0
  67. package/dist/components/ui/animated-height.js.map +1 -0
  68. package/dist/components/ui/app-shell.d.ts +26 -0
  69. package/dist/components/ui/app-shell.d.ts.map +1 -0
  70. package/dist/components/ui/app-shell.js +71 -0
  71. package/dist/components/ui/app-shell.js.map +1 -0
  72. package/dist/components/ui/avatar.d.ts +30 -0
  73. package/dist/components/ui/avatar.d.ts.map +1 -0
  74. package/dist/components/ui/avatar.js +50 -0
  75. package/dist/components/ui/avatar.js.map +1 -0
  76. package/dist/components/ui/badge.d.ts +19 -0
  77. package/dist/components/ui/badge.d.ts.map +1 -0
  78. package/dist/components/ui/badge.js +62 -0
  79. package/dist/components/ui/badge.js.map +1 -0
  80. package/dist/components/ui/banner.d.ts +33 -0
  81. package/dist/components/ui/banner.d.ts.map +1 -0
  82. package/dist/components/ui/banner.js +21 -0
  83. package/dist/components/ui/banner.js.map +1 -0
  84. package/dist/components/ui/breadcrumbs.d.ts +10 -0
  85. package/dist/components/ui/breadcrumbs.d.ts.map +1 -0
  86. package/dist/components/ui/breadcrumbs.js +9 -0
  87. package/dist/components/ui/breadcrumbs.js.map +1 -0
  88. package/dist/components/ui/button.d.ts +15 -0
  89. package/dist/components/ui/button.d.ts.map +1 -0
  90. package/dist/components/ui/button.js +110 -0
  91. package/dist/components/ui/button.js.map +1 -0
  92. package/dist/components/ui/calendar.d.ts +5 -0
  93. package/dist/components/ui/calendar.d.ts.map +1 -0
  94. package/dist/components/ui/calendar.js +65 -0
  95. package/dist/components/ui/calendar.js.map +1 -0
  96. package/dist/components/ui/callout.d.ts +32 -0
  97. package/dist/components/ui/callout.d.ts.map +1 -0
  98. package/dist/components/ui/callout.js +40 -0
  99. package/dist/components/ui/callout.js.map +1 -0
  100. package/dist/components/ui/card.d.ts +18 -0
  101. package/dist/components/ui/card.d.ts.map +1 -0
  102. package/dist/components/ui/card.js +28 -0
  103. package/dist/components/ui/card.js.map +1 -0
  104. package/dist/components/ui/checkbox.d.ts +11 -0
  105. package/dist/components/ui/checkbox.d.ts.map +1 -0
  106. package/dist/components/ui/checkbox.js +30 -0
  107. package/dist/components/ui/checkbox.js.map +1 -0
  108. package/dist/components/ui/choice-label.d.ts +13 -0
  109. package/dist/components/ui/choice-label.d.ts.map +1 -0
  110. package/dist/components/ui/choice-label.js +17 -0
  111. package/dist/components/ui/choice-label.js.map +1 -0
  112. package/dist/components/ui/collapsible.d.ts +10 -0
  113. package/dist/components/ui/collapsible.d.ts.map +1 -0
  114. package/dist/components/ui/collapsible.js +21 -0
  115. package/dist/components/ui/collapsible.js.map +1 -0
  116. package/dist/components/ui/collection-layout.d.ts +24 -0
  117. package/dist/components/ui/collection-layout.d.ts.map +1 -0
  118. package/dist/components/ui/collection-layout.js +16 -0
  119. package/dist/components/ui/collection-layout.js.map +1 -0
  120. package/dist/components/ui/combobox.d.ts +10 -0
  121. package/dist/components/ui/combobox.d.ts.map +1 -0
  122. package/dist/components/ui/combobox.js +93 -0
  123. package/dist/components/ui/combobox.js.map +1 -0
  124. package/dist/components/ui/command-menu.d.ts +18 -0
  125. package/dist/components/ui/command-menu.d.ts.map +1 -0
  126. package/dist/components/ui/command-menu.js +49 -0
  127. package/dist/components/ui/command-menu.js.map +1 -0
  128. package/dist/components/ui/context-menu.d.ts +19 -0
  129. package/dist/components/ui/context-menu.d.ts.map +1 -0
  130. package/dist/components/ui/context-menu.js +42 -0
  131. package/dist/components/ui/context-menu.js.map +1 -0
  132. package/dist/components/ui/copy-button.d.ts +11 -0
  133. package/dist/components/ui/copy-button.d.ts.map +1 -0
  134. package/dist/components/ui/copy-button.js +48 -0
  135. package/dist/components/ui/copy-button.js.map +1 -0
  136. package/dist/components/ui/database/calendar-view.d.ts +10 -0
  137. package/dist/components/ui/database/calendar-view.d.ts.map +1 -0
  138. package/dist/components/ui/database/calendar-view.js +65 -0
  139. package/dist/components/ui/database/calendar-view.js.map +1 -0
  140. package/dist/components/ui/database/card-views.d.ts +22 -0
  141. package/dist/components/ui/database/card-views.d.ts.map +1 -0
  142. package/dist/components/ui/database/card-views.js +74 -0
  143. package/dist/components/ui/database/card-views.js.map +1 -0
  144. package/dist/components/ui/database/cells.d.ts +20 -0
  145. package/dist/components/ui/database/cells.d.ts.map +1 -0
  146. package/dist/components/ui/database/cells.js +132 -0
  147. package/dist/components/ui/database/cells.js.map +1 -0
  148. package/dist/components/ui/database/database.d.ts +19 -0
  149. package/dist/components/ui/database/database.d.ts.map +1 -0
  150. package/dist/components/ui/database/database.js +102 -0
  151. package/dist/components/ui/database/database.js.map +1 -0
  152. package/dist/components/ui/database/icons.d.ts +5 -0
  153. package/dist/components/ui/database/icons.d.ts.map +1 -0
  154. package/dist/components/ui/database/icons.js +13 -0
  155. package/dist/components/ui/database/icons.js.map +1 -0
  156. package/dist/components/ui/database/table-view.d.ts +11 -0
  157. package/dist/components/ui/database/table-view.d.ts.map +1 -0
  158. package/dist/components/ui/database/table-view.js +157 -0
  159. package/dist/components/ui/database/table-view.js.map +1 -0
  160. package/dist/components/ui/date-picker.d.ts +40 -0
  161. package/dist/components/ui/date-picker.d.ts.map +1 -0
  162. package/dist/components/ui/date-picker.js +64 -0
  163. package/dist/components/ui/date-picker.js.map +1 -0
  164. package/dist/components/ui/date-time-picker.d.ts +21 -0
  165. package/dist/components/ui/date-time-picker.d.ts.map +1 -0
  166. package/dist/components/ui/date-time-picker.js +34 -0
  167. package/dist/components/ui/date-time-picker.js.map +1 -0
  168. package/dist/components/ui/dialog.d.ts +21 -0
  169. package/dist/components/ui/dialog.d.ts.map +1 -0
  170. package/dist/components/ui/dialog.js +63 -0
  171. package/dist/components/ui/dialog.js.map +1 -0
  172. package/dist/components/ui/document-layout.d.ts +15 -0
  173. package/dist/components/ui/document-layout.d.ts.map +1 -0
  174. package/dist/components/ui/document-layout.js +15 -0
  175. package/dist/components/ui/document-layout.js.map +1 -0
  176. package/dist/components/ui/dropdown-menu.d.ts +24 -0
  177. package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
  178. package/dist/components/ui/dropdown-menu.js +65 -0
  179. package/dist/components/ui/dropdown-menu.js.map +1 -0
  180. package/dist/components/ui/editable-text.d.ts +24 -0
  181. package/dist/components/ui/editable-text.d.ts.map +1 -0
  182. package/dist/components/ui/editable-text.js +85 -0
  183. package/dist/components/ui/editable-text.js.map +1 -0
  184. package/dist/components/ui/empty-state.d.ts +11 -0
  185. package/dist/components/ui/empty-state.d.ts.map +1 -0
  186. package/dist/components/ui/empty-state.js +9 -0
  187. package/dist/components/ui/empty-state.js.map +1 -0
  188. package/dist/components/ui/error-state.d.ts +20 -0
  189. package/dist/components/ui/error-state.d.ts.map +1 -0
  190. package/dist/components/ui/error-state.js +17 -0
  191. package/dist/components/ui/error-state.js.map +1 -0
  192. package/dist/components/ui/field-button.d.ts +15 -0
  193. package/dist/components/ui/field-button.d.ts.map +1 -0
  194. package/dist/components/ui/field-button.js +18 -0
  195. package/dist/components/ui/field-button.js.map +1 -0
  196. package/dist/components/ui/file-preview.d.ts +5 -0
  197. package/dist/components/ui/file-preview.d.ts.map +1 -0
  198. package/dist/components/ui/file-preview.js +66 -0
  199. package/dist/components/ui/file-preview.js.map +1 -0
  200. package/dist/components/ui/file-uploader.d.ts +39 -0
  201. package/dist/components/ui/file-uploader.d.ts.map +1 -0
  202. package/dist/components/ui/file-uploader.js +111 -0
  203. package/dist/components/ui/file-uploader.js.map +1 -0
  204. package/dist/components/ui/filter-builder.d.ts +18 -0
  205. package/dist/components/ui/filter-builder.d.ts.map +1 -0
  206. package/dist/components/ui/filter-builder.js +98 -0
  207. package/dist/components/ui/filter-builder.js.map +1 -0
  208. package/dist/components/ui/focus-shell.d.ts +14 -0
  209. package/dist/components/ui/focus-shell.d.ts.map +1 -0
  210. package/dist/components/ui/focus-shell.js +13 -0
  211. package/dist/components/ui/focus-shell.js.map +1 -0
  212. package/dist/components/ui/handle-row.d.ts +25 -0
  213. package/dist/components/ui/handle-row.d.ts.map +1 -0
  214. package/dist/components/ui/handle-row.js +110 -0
  215. package/dist/components/ui/handle-row.js.map +1 -0
  216. package/dist/components/ui/header-bar.d.ts +5 -0
  217. package/dist/components/ui/header-bar.d.ts.map +1 -0
  218. package/dist/components/ui/header-bar.js +10 -0
  219. package/dist/components/ui/header-bar.js.map +1 -0
  220. package/dist/components/ui/hover-card.d.ts +6 -0
  221. package/dist/components/ui/hover-card.d.ts.map +1 -0
  222. package/dist/components/ui/hover-card.js +13 -0
  223. package/dist/components/ui/hover-card.js.map +1 -0
  224. package/dist/components/ui/image-block.d.ts +31 -0
  225. package/dist/components/ui/image-block.d.ts.map +1 -0
  226. package/dist/components/ui/image-block.js +103 -0
  227. package/dist/components/ui/image-block.js.map +1 -0
  228. package/dist/components/ui/image-card.d.ts +17 -0
  229. package/dist/components/ui/image-card.d.ts.map +1 -0
  230. package/dist/components/ui/image-card.js +39 -0
  231. package/dist/components/ui/image-card.js.map +1 -0
  232. package/dist/components/ui/image-framer.d.ts +24 -0
  233. package/dist/components/ui/image-framer.d.ts.map +1 -0
  234. package/dist/components/ui/image-framer.js +89 -0
  235. package/dist/components/ui/image-framer.js.map +1 -0
  236. package/dist/components/ui/image-viewer.d.ts +31 -0
  237. package/dist/components/ui/image-viewer.d.ts.map +1 -0
  238. package/dist/components/ui/image-viewer.js +114 -0
  239. package/dist/components/ui/image-viewer.js.map +1 -0
  240. package/dist/components/ui/image.d.ts +33 -0
  241. package/dist/components/ui/image.d.ts.map +1 -0
  242. package/dist/components/ui/image.js +61 -0
  243. package/dist/components/ui/image.js.map +1 -0
  244. package/dist/components/ui/index.d.ts +92 -0
  245. package/dist/components/ui/index.d.ts.map +1 -0
  246. package/dist/components/ui/index.js +92 -0
  247. package/dist/components/ui/index.js.map +1 -0
  248. package/dist/components/ui/input.d.ts +75 -0
  249. package/dist/components/ui/input.d.ts.map +1 -0
  250. package/dist/components/ui/input.js +245 -0
  251. package/dist/components/ui/input.js.map +1 -0
  252. package/dist/components/ui/link-block.d.ts +13 -0
  253. package/dist/components/ui/link-block.d.ts.map +1 -0
  254. package/dist/components/ui/link-block.js +21 -0
  255. package/dist/components/ui/link-block.js.map +1 -0
  256. package/dist/components/ui/list-detail.d.ts +23 -0
  257. package/dist/components/ui/list-detail.d.ts.map +1 -0
  258. package/dist/components/ui/list-detail.js +33 -0
  259. package/dist/components/ui/list-detail.js.map +1 -0
  260. package/dist/components/ui/listbox.d.ts +7 -0
  261. package/dist/components/ui/listbox.d.ts.map +1 -0
  262. package/dist/components/ui/listbox.js +29 -0
  263. package/dist/components/ui/listbox.js.map +1 -0
  264. package/dist/components/ui/mac-card.d.ts +15 -0
  265. package/dist/components/ui/mac-card.d.ts.map +1 -0
  266. package/dist/components/ui/mac-card.js +9 -0
  267. package/dist/components/ui/mac-card.js.map +1 -0
  268. package/dist/components/ui/month-picker.d.ts +13 -0
  269. package/dist/components/ui/month-picker.d.ts.map +1 -0
  270. package/dist/components/ui/month-picker.js +53 -0
  271. package/dist/components/ui/month-picker.js.map +1 -0
  272. package/dist/components/ui/multi-select.d.ts +22 -0
  273. package/dist/components/ui/multi-select.d.ts.map +1 -0
  274. package/dist/components/ui/multi-select.js +88 -0
  275. package/dist/components/ui/multi-select.js.map +1 -0
  276. package/dist/components/ui/nav-tree.d.ts +16 -0
  277. package/dist/components/ui/nav-tree.d.ts.map +1 -0
  278. package/dist/components/ui/nav-tree.js +41 -0
  279. package/dist/components/ui/nav-tree.js.map +1 -0
  280. package/dist/components/ui/page.d.ts +23 -0
  281. package/dist/components/ui/page.d.ts.map +1 -0
  282. package/dist/components/ui/page.js +28 -0
  283. package/dist/components/ui/page.js.map +1 -0
  284. package/dist/components/ui/pagination.d.ts +26 -0
  285. package/dist/components/ui/pagination.d.ts.map +1 -0
  286. package/dist/components/ui/pagination.js +54 -0
  287. package/dist/components/ui/pagination.js.map +1 -0
  288. package/dist/components/ui/picker-panel.d.ts +13 -0
  289. package/dist/components/ui/picker-panel.d.ts.map +1 -0
  290. package/dist/components/ui/picker-panel.js +19 -0
  291. package/dist/components/ui/picker-panel.js.map +1 -0
  292. package/dist/components/ui/popover.d.ts +8 -0
  293. package/dist/components/ui/popover.d.ts.map +1 -0
  294. package/dist/components/ui/popover.js +18 -0
  295. package/dist/components/ui/popover.js.map +1 -0
  296. package/dist/components/ui/progress.d.ts +19 -0
  297. package/dist/components/ui/progress.d.ts.map +1 -0
  298. package/dist/components/ui/progress.js +22 -0
  299. package/dist/components/ui/progress.js.map +1 -0
  300. package/dist/components/ui/property.d.ts +11 -0
  301. package/dist/components/ui/property.d.ts.map +1 -0
  302. package/dist/components/ui/property.js +18 -0
  303. package/dist/components/ui/property.js.map +1 -0
  304. package/dist/components/ui/radio-group.d.ts +8 -0
  305. package/dist/components/ui/radio-group.d.ts.map +1 -0
  306. package/dist/components/ui/radio-group.js +18 -0
  307. package/dist/components/ui/radio-group.js.map +1 -0
  308. package/dist/components/ui/rating.d.ts +14 -0
  309. package/dist/components/ui/rating.d.ts.map +1 -0
  310. package/dist/components/ui/rating.js +61 -0
  311. package/dist/components/ui/rating.js.map +1 -0
  312. package/dist/components/ui/save-status.d.ts +8 -0
  313. package/dist/components/ui/save-status.d.ts.map +1 -0
  314. package/dist/components/ui/save-status.js +31 -0
  315. package/dist/components/ui/save-status.js.map +1 -0
  316. package/dist/components/ui/segmented.d.ts +21 -0
  317. package/dist/components/ui/segmented.d.ts.map +1 -0
  318. package/dist/components/ui/segmented.js +12 -0
  319. package/dist/components/ui/segmented.js.map +1 -0
  320. package/dist/components/ui/select-menu.d.ts +12 -0
  321. package/dist/components/ui/select-menu.d.ts.map +1 -0
  322. package/dist/components/ui/select-menu.js +10 -0
  323. package/dist/components/ui/select-menu.js.map +1 -0
  324. package/dist/components/ui/select.d.ts +16 -0
  325. package/dist/components/ui/select.d.ts.map +1 -0
  326. package/dist/components/ui/select.js +45 -0
  327. package/dist/components/ui/select.js.map +1 -0
  328. package/dist/components/ui/selection-bar.d.ts +12 -0
  329. package/dist/components/ui/selection-bar.d.ts.map +1 -0
  330. package/dist/components/ui/selection-bar.js +15 -0
  331. package/dist/components/ui/selection-bar.js.map +1 -0
  332. package/dist/components/ui/separator.d.ts +4 -0
  333. package/dist/components/ui/separator.d.ts.map +1 -0
  334. package/dist/components/ui/separator.js +12 -0
  335. package/dist/components/ui/separator.js.map +1 -0
  336. package/dist/components/ui/settings-layout.d.ts +34 -0
  337. package/dist/components/ui/settings-layout.d.ts.map +1 -0
  338. package/dist/components/ui/settings-layout.js +16 -0
  339. package/dist/components/ui/settings-layout.js.map +1 -0
  340. package/dist/components/ui/share-link.d.ts +14 -0
  341. package/dist/components/ui/share-link.d.ts.map +1 -0
  342. package/dist/components/ui/share-link.js +16 -0
  343. package/dist/components/ui/share-link.js.map +1 -0
  344. package/dist/components/ui/sheet.d.ts +21 -0
  345. package/dist/components/ui/sheet.d.ts.map +1 -0
  346. package/dist/components/ui/sheet.js +53 -0
  347. package/dist/components/ui/sheet.js.map +1 -0
  348. package/dist/components/ui/sidebar.d.ts +82 -0
  349. package/dist/components/ui/sidebar.d.ts.map +1 -0
  350. package/dist/components/ui/sidebar.js +258 -0
  351. package/dist/components/ui/sidebar.js.map +1 -0
  352. package/dist/components/ui/skeleton.d.ts +8 -0
  353. package/dist/components/ui/skeleton.d.ts.map +1 -0
  354. package/dist/components/ui/skeleton.js +15 -0
  355. package/dist/components/ui/skeleton.js.map +1 -0
  356. package/dist/components/ui/spinner.d.ts +12 -0
  357. package/dist/components/ui/spinner.d.ts.map +1 -0
  358. package/dist/components/ui/spinner.js +14 -0
  359. package/dist/components/ui/spinner.js.map +1 -0
  360. package/dist/components/ui/spotlight.d.ts +23 -0
  361. package/dist/components/ui/spotlight.d.ts.map +1 -0
  362. package/dist/components/ui/spotlight.js +110 -0
  363. package/dist/components/ui/spotlight.js.map +1 -0
  364. package/dist/components/ui/stat-tile.d.ts +8 -0
  365. package/dist/components/ui/stat-tile.d.ts.map +1 -0
  366. package/dist/components/ui/stat-tile.js +9 -0
  367. package/dist/components/ui/stat-tile.js.map +1 -0
  368. package/dist/components/ui/step-dialog.d.ts +20 -0
  369. package/dist/components/ui/step-dialog.d.ts.map +1 -0
  370. package/dist/components/ui/step-dialog.js +36 -0
  371. package/dist/components/ui/step-dialog.js.map +1 -0
  372. package/dist/components/ui/steps-layout.d.ts +20 -0
  373. package/dist/components/ui/steps-layout.d.ts.map +1 -0
  374. package/dist/components/ui/steps-layout.js +26 -0
  375. package/dist/components/ui/steps-layout.js.map +1 -0
  376. package/dist/components/ui/switch.d.ts +8 -0
  377. package/dist/components/ui/switch.d.ts.map +1 -0
  378. package/dist/components/ui/switch.js +21 -0
  379. package/dist/components/ui/switch.js.map +1 -0
  380. package/dist/components/ui/table.d.ts +16 -0
  381. package/dist/components/ui/table.d.ts.map +1 -0
  382. package/dist/components/ui/table.js +76 -0
  383. package/dist/components/ui/table.js.map +1 -0
  384. package/dist/components/ui/tabs.d.ts +7 -0
  385. package/dist/components/ui/tabs.d.ts.map +1 -0
  386. package/dist/components/ui/tabs.js +19 -0
  387. package/dist/components/ui/tabs.js.map +1 -0
  388. package/dist/components/ui/theme-toggle.d.ts +16 -0
  389. package/dist/components/ui/theme-toggle.d.ts.map +1 -0
  390. package/dist/components/ui/theme-toggle.js +65 -0
  391. package/dist/components/ui/theme-toggle.js.map +1 -0
  392. package/dist/components/ui/time-list.d.ts +16 -0
  393. package/dist/components/ui/time-list.d.ts.map +1 -0
  394. package/dist/components/ui/time-list.js +49 -0
  395. package/dist/components/ui/time-list.js.map +1 -0
  396. package/dist/components/ui/time-picker.d.ts +47 -0
  397. package/dist/components/ui/time-picker.d.ts.map +1 -0
  398. package/dist/components/ui/time-picker.js +141 -0
  399. package/dist/components/ui/time-picker.js.map +1 -0
  400. package/dist/components/ui/toast.d.ts +18 -0
  401. package/dist/components/ui/toast.d.ts.map +1 -0
  402. package/dist/components/ui/toast.js +77 -0
  403. package/dist/components/ui/toast.js.map +1 -0
  404. package/dist/components/ui/toggle.d.ts +15 -0
  405. package/dist/components/ui/toggle.d.ts.map +1 -0
  406. package/dist/components/ui/toggle.js +55 -0
  407. package/dist/components/ui/toggle.js.map +1 -0
  408. package/dist/components/ui/tooltip.d.ts +15 -0
  409. package/dist/components/ui/tooltip.d.ts.map +1 -0
  410. package/dist/components/ui/tooltip.js +32 -0
  411. package/dist/components/ui/tooltip.js.map +1 -0
  412. package/dist/components/ui/top-bar.d.ts +25 -0
  413. package/dist/components/ui/top-bar.d.ts.map +1 -0
  414. package/dist/components/ui/top-bar.js +23 -0
  415. package/dist/components/ui/top-bar.js.map +1 -0
  416. package/dist/components/ui/typography.d.ts +40 -0
  417. package/dist/components/ui/typography.d.ts.map +1 -0
  418. package/dist/components/ui/typography.js +98 -0
  419. package/dist/components/ui/typography.js.map +1 -0
  420. package/dist/components/ui/video-block.d.ts +14 -0
  421. package/dist/components/ui/video-block.d.ts.map +1 -0
  422. package/dist/components/ui/video-block.js +22 -0
  423. package/dist/components/ui/video-block.js.map +1 -0
  424. package/dist/hooks/use-dismiss.d.ts +5 -0
  425. package/dist/hooks/use-dismiss.d.ts.map +1 -0
  426. package/dist/hooks/use-dismiss.js +23 -0
  427. package/dist/hooks/use-dismiss.js.map +1 -0
  428. package/dist/hooks/use-escape-first.d.ts +3 -0
  429. package/dist/hooks/use-escape-first.d.ts.map +1 -0
  430. package/dist/hooks/use-escape-first.js +27 -0
  431. package/dist/hooks/use-escape-first.js.map +1 -0
  432. package/dist/hooks/use-media-query.d.ts +5 -0
  433. package/dist/hooks/use-media-query.d.ts.map +1 -0
  434. package/dist/hooks/use-media-query.js +16 -0
  435. package/dist/hooks/use-media-query.js.map +1 -0
  436. package/dist/hooks/use-save-queue.d.ts +13 -0
  437. package/dist/hooks/use-save-queue.d.ts.map +1 -0
  438. package/dist/hooks/use-save-queue.js +57 -0
  439. package/dist/hooks/use-save-queue.js.map +1 -0
  440. package/dist/hooks/use-selection.d.ts +10 -0
  441. package/dist/hooks/use-selection.d.ts.map +1 -0
  442. package/dist/hooks/use-selection.js +52 -0
  443. package/dist/hooks/use-selection.js.map +1 -0
  444. package/dist/hooks/use-shared-transition.d.ts +3 -0
  445. package/dist/hooks/use-shared-transition.d.ts.map +1 -0
  446. package/dist/hooks/use-shared-transition.js +38 -0
  447. package/dist/hooks/use-shared-transition.js.map +1 -0
  448. package/dist/hooks/use-upload-queue.d.ts +22 -0
  449. package/dist/hooks/use-upload-queue.d.ts.map +1 -0
  450. package/dist/hooks/use-upload-queue.js +78 -0
  451. package/dist/hooks/use-upload-queue.js.map +1 -0
  452. package/dist/lib/accent.d.ts +5 -0
  453. package/dist/lib/accent.d.ts.map +1 -0
  454. package/dist/lib/accent.js +10 -0
  455. package/dist/lib/accent.js.map +1 -0
  456. package/dist/lib/bento.d.ts +17 -0
  457. package/dist/lib/bento.d.ts.map +1 -0
  458. package/dist/lib/bento.js +92 -0
  459. package/dist/lib/bento.js.map +1 -0
  460. package/dist/lib/database.d.ts +92 -0
  461. package/dist/lib/database.d.ts.map +1 -0
  462. package/dist/lib/database.js +272 -0
  463. package/dist/lib/database.js.map +1 -0
  464. package/dist/lib/dates.d.ts +30 -0
  465. package/dist/lib/dates.d.ts.map +1 -0
  466. package/dist/lib/dates.js +61 -0
  467. package/dist/lib/dates.js.map +1 -0
  468. package/dist/lib/document.d.ts +79 -0
  469. package/dist/lib/document.d.ts.map +1 -0
  470. package/dist/lib/document.js +11 -0
  471. package/dist/lib/document.js.map +1 -0
  472. package/dist/lib/embed.d.ts +14 -0
  473. package/dist/lib/embed.d.ts.map +1 -0
  474. package/dist/lib/embed.js +63 -0
  475. package/dist/lib/embed.js.map +1 -0
  476. package/dist/lib/files.d.ts +23 -0
  477. package/dist/lib/files.d.ts.map +1 -0
  478. package/dist/lib/files.js +69 -0
  479. package/dist/lib/files.js.map +1 -0
  480. package/dist/lib/justified.d.ts +50 -0
  481. package/dist/lib/justified.d.ts.map +1 -0
  482. package/dist/lib/justified.js +78 -0
  483. package/dist/lib/justified.js.map +1 -0
  484. package/dist/lib/keys.d.ts +18 -0
  485. package/dist/lib/keys.d.ts.map +1 -0
  486. package/dist/lib/keys.js +66 -0
  487. package/dist/lib/keys.js.map +1 -0
  488. package/dist/lib/number.d.ts +4 -0
  489. package/dist/lib/number.d.ts.map +1 -0
  490. package/dist/lib/number.js +33 -0
  491. package/dist/lib/number.js.map +1 -0
  492. package/dist/lib/pointer.d.ts +2 -0
  493. package/dist/lib/pointer.d.ts.map +1 -0
  494. package/dist/lib/pointer.js +4 -0
  495. package/dist/lib/pointer.js.map +1 -0
  496. package/dist/lib/prepare-image.d.ts +43 -0
  497. package/dist/lib/prepare-image.d.ts.map +1 -0
  498. package/dist/lib/prepare-image.js +105 -0
  499. package/dist/lib/prepare-image.js.map +1 -0
  500. package/dist/lib/rich-text-dom.d.ts +16 -0
  501. package/dist/lib/rich-text-dom.d.ts.map +1 -0
  502. package/dist/lib/rich-text-dom.js +145 -0
  503. package/dist/lib/rich-text-dom.js.map +1 -0
  504. package/dist/lib/rich-text.d.ts +15 -0
  505. package/dist/lib/rich-text.d.ts.map +1 -0
  506. package/dist/lib/rich-text.js +35 -0
  507. package/dist/lib/rich-text.js.map +1 -0
  508. package/dist/lib/spotlight.d.ts +22 -0
  509. package/dist/lib/spotlight.d.ts.map +1 -0
  510. package/dist/lib/spotlight.js +66 -0
  511. package/dist/lib/spotlight.js.map +1 -0
  512. package/dist/lib/theme.d.ts +6 -0
  513. package/dist/lib/theme.d.ts.map +1 -0
  514. package/dist/lib/theme.js +15 -0
  515. package/dist/lib/theme.js.map +1 -0
  516. package/dist/lib/time.d.ts +19 -0
  517. package/dist/lib/time.d.ts.map +1 -0
  518. package/dist/lib/time.js +91 -0
  519. package/dist/lib/time.js.map +1 -0
  520. package/dist/lib/tree.d.ts +17 -0
  521. package/dist/lib/tree.d.ts.map +1 -0
  522. package/dist/lib/tree.js +35 -0
  523. package/dist/lib/tree.js.map +1 -0
  524. package/dist/lib/utils.d.ts +3 -0
  525. package/dist/lib/utils.d.ts.map +1 -0
  526. package/dist/lib/utils.js +24 -0
  527. package/dist/lib/utils.js.map +1 -0
  528. package/dist/styles/notion.css +817 -0
  529. package/package.json +129 -5
  530. package/src/components/editor/block-text.tsx +271 -0
  531. package/src/components/editor/blocks.tsx +373 -0
  532. package/src/components/editor/document-editor.tsx +106 -0
  533. package/src/components/editor/document-view.tsx +205 -0
  534. package/src/components/editor/editor-state.tsx +298 -0
  535. package/src/components/editor/extensions/kit-blocks.tsx +452 -0
  536. package/src/components/editor/extensions/spoiler.tsx +81 -0
  537. package/src/components/editor/index.ts +10 -0
  538. package/src/components/editor/kinds.ts +158 -0
  539. package/src/components/editor/look.tsx +36 -0
  540. package/src/components/sketch/rough.tsx +90 -0
  541. package/src/components/three/model-viewer.tsx +514 -0
  542. package/src/components/ui/accent-picker.tsx +72 -0
  543. package/src/components/ui/address-field.tsx +57 -0
  544. package/src/components/ui/alert-dialog.tsx +136 -0
  545. package/src/components/ui/animated-height.tsx +34 -0
  546. package/src/components/ui/app-shell.tsx +140 -0
  547. package/src/components/ui/avatar.tsx +106 -0
  548. package/src/components/ui/badge.tsx +81 -0
  549. package/src/components/ui/banner.tsx +53 -0
  550. package/src/components/ui/breadcrumbs.tsx +25 -0
  551. package/src/components/ui/button.tsx +147 -0
  552. package/src/components/ui/calendar.tsx +101 -0
  553. package/src/components/ui/callout.tsx +61 -0
  554. package/src/components/ui/card.tsx +59 -0
  555. package/src/components/ui/checkbox.tsx +66 -0
  556. package/src/components/ui/choice-label.tsx +43 -0
  557. package/src/components/ui/collapsible.tsx +58 -0
  558. package/src/components/ui/collection-layout.tsx +69 -0
  559. package/src/components/ui/combobox.tsx +155 -0
  560. package/src/components/ui/command-menu.tsx +102 -0
  561. package/src/components/ui/context-menu.tsx +89 -0
  562. package/src/components/ui/copy-button.tsx +80 -0
  563. package/src/components/ui/database/calendar-view.tsx +180 -0
  564. package/src/components/ui/database/card-views.tsx +221 -0
  565. package/src/components/ui/database/cells.tsx +237 -0
  566. package/src/components/ui/database/database.tsx +279 -0
  567. package/src/components/ui/database/icons.ts +15 -0
  568. package/src/components/ui/database/table-view.tsx +311 -0
  569. package/src/components/ui/date-picker.tsx +208 -0
  570. package/src/components/ui/date-time-picker.tsx +123 -0
  571. package/src/components/ui/dialog.tsx +151 -0
  572. package/src/components/ui/document-layout.tsx +52 -0
  573. package/src/components/ui/dropdown-menu.tsx +185 -0
  574. package/src/components/ui/editable-text.tsx +142 -0
  575. package/src/components/ui/empty-state.tsx +35 -0
  576. package/src/components/ui/error-state.tsx +67 -0
  577. package/src/components/ui/field-button.tsx +70 -0
  578. package/src/components/ui/file-preview.tsx +80 -0
  579. package/src/components/ui/file-uploader.tsx +375 -0
  580. package/src/components/ui/filter-builder.tsx +304 -0
  581. package/src/components/ui/focus-shell.tsx +48 -0
  582. package/src/components/ui/handle-row.tsx +252 -0
  583. package/src/components/ui/header-bar.tsx +15 -0
  584. package/src/components/ui/hover-card.tsx +30 -0
  585. package/src/components/ui/image-block.tsx +238 -0
  586. package/src/components/ui/image-card.tsx +95 -0
  587. package/src/components/ui/image-framer.tsx +160 -0
  588. package/src/components/ui/image-viewer.tsx +230 -0
  589. package/src/components/ui/image.tsx +200 -0
  590. package/src/components/ui/index.ts +178 -0
  591. package/src/components/ui/input.tsx +471 -0
  592. package/src/components/ui/link-block.tsx +85 -0
  593. package/src/components/ui/list-detail.tsx +115 -0
  594. package/src/components/ui/listbox.ts +26 -0
  595. package/src/components/ui/mac-card.tsx +46 -0
  596. package/src/components/ui/month-picker.tsx +119 -0
  597. package/src/components/ui/multi-select.tsx +221 -0
  598. package/src/components/ui/nav-tree.tsx +92 -0
  599. package/src/components/ui/page.tsx +73 -0
  600. package/src/components/ui/pagination.tsx +143 -0
  601. package/src/components/ui/picker-panel.tsx +69 -0
  602. package/src/components/ui/popover.tsx +42 -0
  603. package/src/components/ui/progress.tsx +76 -0
  604. package/src/components/ui/property.tsx +33 -0
  605. package/src/components/ui/radio-group.tsx +61 -0
  606. package/src/components/ui/rating.tsx +122 -0
  607. package/src/components/ui/save-status.tsx +53 -0
  608. package/src/components/ui/segmented.tsx +74 -0
  609. package/src/components/ui/select-menu.tsx +54 -0
  610. package/src/components/ui/select.tsx +147 -0
  611. package/src/components/ui/selection-bar.tsx +50 -0
  612. package/src/components/ui/separator.tsx +30 -0
  613. package/src/components/ui/settings-layout.tsx +117 -0
  614. package/src/components/ui/share-link.tsx +66 -0
  615. package/src/components/ui/sheet.tsx +90 -0
  616. package/src/components/ui/sidebar.tsx +627 -0
  617. package/src/components/ui/skeleton.tsx +22 -0
  618. package/src/components/ui/spinner.tsx +28 -0
  619. package/src/components/ui/spotlight.tsx +222 -0
  620. package/src/components/ui/stat-tile.tsx +25 -0
  621. package/src/components/ui/step-dialog.tsx +104 -0
  622. package/src/components/ui/steps-layout.tsx +91 -0
  623. package/src/components/ui/switch.tsx +55 -0
  624. package/src/components/ui/table.tsx +99 -0
  625. package/src/components/ui/tabs.tsx +41 -0
  626. package/src/components/ui/theme-toggle.tsx +80 -0
  627. package/src/components/ui/time-list.tsx +106 -0
  628. package/src/components/ui/time-picker.tsx +344 -0
  629. package/src/components/ui/toast.tsx +132 -0
  630. package/src/components/ui/toggle.tsx +76 -0
  631. package/src/components/ui/tooltip.tsx +78 -0
  632. package/src/components/ui/top-bar.tsx +118 -0
  633. package/src/components/ui/typography.tsx +204 -0
  634. package/src/components/ui/video-block.tsx +66 -0
  635. package/src/hooks/use-dismiss.ts +24 -0
  636. package/src/hooks/use-escape-first.ts +25 -0
  637. package/src/hooks/use-media-query.ts +23 -0
  638. package/src/hooks/use-save-queue.ts +78 -0
  639. package/src/hooks/use-selection.ts +51 -0
  640. package/src/hooks/use-shared-transition.ts +40 -0
  641. package/src/hooks/use-upload-queue.ts +111 -0
  642. package/src/lib/accent.ts +11 -0
  643. package/src/lib/bento.ts +87 -0
  644. package/src/lib/database.ts +322 -0
  645. package/src/lib/dates.ts +75 -0
  646. package/src/lib/document.ts +55 -0
  647. package/src/lib/embed.ts +62 -0
  648. package/src/lib/files.ts +73 -0
  649. package/src/lib/justified.ts +106 -0
  650. package/src/lib/keys.ts +72 -0
  651. package/src/lib/number.ts +29 -0
  652. package/src/lib/pointer.ts +3 -0
  653. package/src/lib/prepare-image.ts +141 -0
  654. package/src/lib/rich-text-dom.ts +138 -0
  655. package/src/lib/rich-text.ts +50 -0
  656. package/src/lib/spotlight.ts +78 -0
  657. package/src/lib/theme.ts +18 -0
  658. package/src/lib/time.ts +83 -0
  659. package/src/lib/tree.ts +41 -0
  660. package/src/lib/utils.ts +25 -0
  661. package/src/styles/notion.css +817 -0
@@ -0,0 +1,17 @@
1
+ export type Tile<T> = {
2
+ item: T;
3
+ col: number;
4
+ row: number;
5
+ width: number;
6
+ height: number;
7
+ };
8
+ export declare function bento<T>(items: T[], columns: number, ask: (item: T, index: number) => [number, number],
9
+ /** Width over height of each picture, and of one cell, so a gap goes to the neighbour it crops least. */
10
+ shape?: {
11
+ aspect: (item: T) => number;
12
+ cell: number;
13
+ }): {
14
+ tiles: Tile<T>[];
15
+ rows: number;
16
+ };
17
+ //# sourceMappingURL=bento.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bento.d.ts","sourceRoot":"","sources":["../../src/lib/bento.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI;IAAE,IAAI,EAAE,CAAC,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3F,wBAAgB,KAAK,CAAC,CAAC,EACnB,KAAK,EAAE,CAAC,EAAE,EACV,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC;AACjD,yGAAyG;AACzG,KAAK,CAAC,EAAE;IAAE,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACtD;IAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAqEpC"}
@@ -0,0 +1,92 @@
1
+ /* A bento: pictures packed into a grid of square-ish cells with no holes, so a
2
+ day's photos read as one composed block rather than a list that ran out.
3
+
4
+ Each picture asks for a span (wide ones two columns, tall ones two rows, a
5
+ chosen one both). They are placed in order at the first free cell, shrinking
6
+ to fit where the ask cannot be met. A grid packed that way can still leave
7
+ gaps, so afterwards each gap is filled by growing a neighbour into it, which
8
+ keeps every picture in the order it was placed. */
9
+ export function bento(items, columns, ask,
10
+ /** Width over height of each picture, and of one cell, so a gap goes to the neighbour it crops least. */
11
+ shape) {
12
+ const grid = [];
13
+ const free = (r, c) => c >= 0 && c < columns && (grid[r]?.[c] ?? null) === null;
14
+ const claim = (r, c, who) => {
15
+ while (grid.length <= r)
16
+ grid.push(Array.from({ length: columns }, () => null));
17
+ grid[r][c] = who;
18
+ };
19
+ const fits = (r, c, w, h) => {
20
+ for (let y = r; y < r + h; y++)
21
+ for (let x = c; x < c + w; x++)
22
+ if (!free(y, x))
23
+ return false;
24
+ return true;
25
+ };
26
+ const tiles = [];
27
+ items.forEach((item, index) => {
28
+ let [w, h] = ask(item, index);
29
+ w = Math.min(Math.max(w, 1), columns);
30
+ h = Math.max(h, 1);
31
+ let at = 0;
32
+ while (!free(Math.floor(at / columns), at % columns))
33
+ at++;
34
+ const row = Math.floor(at / columns);
35
+ const col = at % columns;
36
+ // The first free cell is free, so one of these always fits.
37
+ const size = [[w, h], [1, h], [w, 1], [1, 1]].find(([sw, sh]) => fits(row, col, sw, sh));
38
+ [w, h] = size;
39
+ for (let y = row; y < row + h; y++)
40
+ for (let x = col; x < col + w; x++)
41
+ claim(y, x, index);
42
+ tiles.push({ item, col, row, width: w, height: h });
43
+ });
44
+ const rows = grid.length;
45
+ const owner = (r, c) => (r >= 0 && r < rows && c >= 0 && c < columns ? (grid[r][c] ?? null) : null);
46
+ const column = (t, c) => Array.from({ length: t.height }, (_, k) => t.row + k).every((r) => owner(r, c) === null);
47
+ const line = (t, r) => Array.from({ length: t.width }, (_, k) => t.col + k).every((c) => owner(r, c) === null);
48
+ const take = (t, index) => {
49
+ for (let y = t.row; y < t.row + t.height; y++)
50
+ for (let x = t.col; x < t.col + t.width; x++)
51
+ grid[y][x] = index;
52
+ };
53
+ // Each gap is filled by growing a neighbour whose whole edge borders it.
54
+ // Of those that can, the one whose new shape is nearest its picture's grows,
55
+ // so a portrait grows down and a landscape across.
56
+ const misfit = (t, w, h) => (shape === undefined ? 0 : Math.abs(Math.log(((w / h) * shape.cell) / shape.aspect(t.item))));
57
+ for (let changed = true; changed;) {
58
+ changed = false;
59
+ for (let r = 0; r < rows; r++) {
60
+ for (let c = 0; c < columns; c++) {
61
+ if (owner(r, c) !== null)
62
+ continue;
63
+ const growths = [];
64
+ const left = owner(r, c - 1);
65
+ if (left !== null && tiles[left].col + tiles[left].width === c && column(tiles[left], c))
66
+ growths.push({ who: left, w: 1, h: 0, apply: (t) => t.width++ });
67
+ const right = owner(r, c + 1);
68
+ if (right !== null && tiles[right].col === c + 1 && column(tiles[right], c))
69
+ growths.push({ who: right, w: 1, h: 0, apply: (t) => (t.col--, t.width++) });
70
+ const above = owner(r - 1, c);
71
+ if (above !== null && tiles[above].row + tiles[above].height === r && line(tiles[above], r))
72
+ growths.push({ who: above, w: 0, h: 1, apply: (t) => t.height++ });
73
+ const below = owner(r + 1, c);
74
+ if (below !== null && tiles[below].row === r + 1 && line(tiles[below], r))
75
+ growths.push({ who: below, w: 0, h: 1, apply: (t) => (t.row--, t.height++) });
76
+ if (growths.length === 0)
77
+ continue;
78
+ const best = growths.reduce((a, b) => {
79
+ const ta = tiles[a.who];
80
+ const tb = tiles[b.who];
81
+ return misfit(tb, tb.width + b.w, tb.height + b.h) < misfit(ta, ta.width + a.w, ta.height + a.h) ? b : a;
82
+ });
83
+ const tile = tiles[best.who];
84
+ best.apply(tile);
85
+ take(tile, best.who);
86
+ changed = true;
87
+ }
88
+ }
89
+ }
90
+ return { tiles, rows };
91
+ }
92
+ //# sourceMappingURL=bento.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bento.js","sourceRoot":"","sources":["../../src/lib/bento.ts"],"names":[],"mappings":"AAAA;;;;;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AC;IACL,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,92 @@
1
+ export type PropertyType = "title" | "text" | "number" | "select" | "multiSelect" | "date" | "checkbox" | "url";
2
+ export type TagColor = "gray" | "brown" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "red";
3
+ export type PropertyOption = {
4
+ id: string;
5
+ name: string;
6
+ color: TagColor;
7
+ };
8
+ export type Property = {
9
+ id: string;
10
+ name: string;
11
+ type: PropertyType;
12
+ options?: PropertyOption[];
13
+ };
14
+ export type Value = string | number | boolean | string[] | null;
15
+ export type Row = {
16
+ id: string;
17
+ values: Record<string, Value>;
18
+ cover?: string | null;
19
+ };
20
+ export type FilterOp = "contains" | "notContains" | "is" | "isNot" | "isEmpty" | "isNotEmpty" | "gt" | "lt" | "gte" | "lte" | "before" | "after" | "onOrBefore" | "onOrAfter";
21
+ export type Filter = {
22
+ id: string;
23
+ property: string;
24
+ op: FilterOp;
25
+ value?: Value;
26
+ };
27
+ export type Match = "all" | "any";
28
+ export type Sort = {
29
+ property: string;
30
+ direction: "asc" | "desc";
31
+ };
32
+ /** What can be asked of each kind of property, in the order a menu shows them, with their words. */
33
+ export declare const OPS: Record<PropertyType, readonly {
34
+ op: FilterOp;
35
+ label: string;
36
+ }[]>;
37
+ /** Whether an op needs a value to compare with (is empty does not). */
38
+ export declare const needsValue: (op: FilterOp) => op is "before" | "after" | "is" | "contains" | "notContains" | "isNot" | "gt" | "lt" | "gte" | "lte" | "onOrBefore" | "onOrAfter";
39
+ export declare const isEmpty: (v: Value | undefined) => boolean;
40
+ /** A filter just added for `property`: its first op, and for a checkbox, checked. */
41
+ export declare function newFilter(property: Property, id: string): Filter;
42
+ /** Whether `row` passes `filter`. A filter still missing its value lets everything through, so a half-written one never empties the view. */
43
+ export declare function passes(row: Row, filter: Filter, property: Property | undefined): boolean;
44
+ /** Whether a filter says anything yet: its property exists, and it has a value if it needs one. */
45
+ export declare function isActive(filter: Filter, property: Property | undefined): boolean;
46
+ /** Rows passing all (or any) of the filters. Filters that say nothing yet (a deleted property, a value not given) are left out,
47
+ so with "any" a half-written one does not let every row through. */
48
+ export declare function filterRows(rows: readonly Row[], properties: readonly Property[], filters: readonly Filter[], match?: Match): Row[];
49
+ /** How two values of `property` order, ascending. Empty sorts last, whichever way. */
50
+ export declare function compareValues(a: Value | undefined, b: Value | undefined, property: Property): number;
51
+ /** Sorted by each sort in turn; rows equal on all of them keep their order. */
52
+ export declare function sortRows(rows: readonly Row[], properties: readonly Property[], sorts: readonly Sort[]): Row[];
53
+ export type Group = {
54
+ key: string | null;
55
+ option: PropertyOption | null;
56
+ rows: Row[];
57
+ };
58
+ /** Rows by a select (or a checkbox): a group per option in its order, then "No value". Empty groups are kept, for a board's columns. */
59
+ export declare function groupRows(rows: readonly Row[], property: Property): Group[];
60
+ /** The first title property, which names a row. */
61
+ export declare const titleOf: (properties: readonly Property[]) => Property | undefined;
62
+ /** A value as words, for a screen reader or a plain cell. */
63
+ export declare function valueText(v: Value | undefined, property: Property): string;
64
+ export type ViewKind = "table" | "board" | "gallery" | "list" | "calendar";
65
+ /** One way of seeing the rows. A view keeps its own filter, sort, hidden properties and, per kind, what it groups or dates by. */
66
+ export type View = {
67
+ id: string;
68
+ name: string;
69
+ kind: ViewKind;
70
+ sort: Sort[];
71
+ filter: Filter[];
72
+ match?: Match;
73
+ /** A board's columns: a select property. */
74
+ groupBy?: string;
75
+ /** A calendar's days: a date property. */
76
+ dateProperty?: string;
77
+ /** Properties not shown (a table's columns, a card's lines). */
78
+ hidden: string[];
79
+ /** A table's column widths, in px, by property. */
80
+ widths?: Record<string, number>;
81
+ /** A table's column order, by property id; any not listed follow in the properties' order. */
82
+ order?: string[];
83
+ };
84
+ /** Rows whose words (title, text, url, select and multi-select names) contain `query`, ignoring case. */
85
+ export declare function searchRows(rows: readonly Row[], properties: readonly Property[], query: string): Row[];
86
+ /** What a view shows: searched, filtered, then sorted. */
87
+ export declare function applyView(rows: readonly Row[], properties: readonly Property[], view: Pick<View, "filter" | "sort" | "match">, query?: string): Row[];
88
+ /** A view's properties to show, in its order, without the hidden ones. The title always shows. */
89
+ export declare function shownProperties(properties: readonly Property[], view: Pick<View, "hidden" | "order">): Property[];
90
+ /** A fresh view of `kind`, choosing what a board groups by and a calendar dates by. */
91
+ export declare function newView(kind: ViewKind, properties: readonly Property[], id: string, name?: string): View;
92
+ //# sourceMappingURL=database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/lib/database.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,aAAa,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;AAEhH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7G,MAAM,MAAM,cAAc,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE3E,MAAM,MAAM,QAAQ,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,YAAY,CAAC;IAAC,OAAO,CAAC,EAAE,cAAc,EAAE,CAAA;CAAE,CAAC;AAEpG,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;AAEhE,MAAM,MAAM,GAAG,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAA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IAAI,EAAE,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gEAAgE;IAChE,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,8FAA8F;IAC9F,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,yGAAyG;AACzG,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,EAAE,EAAE,UAAU,EAAE,SAAS,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,CAKtG;AAED,0DAA0D;AAC1D,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,EAAE,EAAE,UAAU,EAAE,SAAS,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,KAAK,SAAK,GAAG,GAAG,EAAE,CAEjJ;AAED,kGAAkG;AAClG,wBAAgB,eAAe,CAAC,UAAU,EAAE,SAAS,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,QAAQ,EAAE,CAQjH;AAED,uFAAuF;AACvF,wBAAgB,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,QAAQ,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAYxG"}
@@ -0,0 +1,272 @@
1
+ /* A database, as Notion's: rows with typed properties, seen through views that
2
+ filter, sort and group them. The app owns the data; this is the meaning of it,
3
+ pure functions with no React, so a server can filter and sort by the same
4
+ rules the page does.
5
+
6
+ Values are plain JSON: text as a string, a number, a date as "YYYY-MM-DD", a
7
+ checkbox as a boolean, a select as its option's id, a multi-select as an array
8
+ of option ids. Empty is null (or "" or []). */
9
+ /** What can be asked of each kind of property, in the order a menu shows them, with their words. */
10
+ export const OPS = {
11
+ title: textOps(),
12
+ text: textOps(),
13
+ url: textOps(),
14
+ number: [
15
+ { op: "is", label: "=" },
16
+ { op: "isNot", label: "≠" },
17
+ { op: "gt", label: ">" },
18
+ { op: "lt", label: "<" },
19
+ { op: "gte", label: "≥" },
20
+ { op: "lte", label: "≤" },
21
+ { op: "isEmpty", label: "is empty" },
22
+ { op: "isNotEmpty", label: "is not empty" },
23
+ ],
24
+ select: [
25
+ { op: "is", label: "is" },
26
+ { op: "isNot", label: "is not" },
27
+ { op: "isEmpty", label: "is empty" },
28
+ { op: "isNotEmpty", label: "is not empty" },
29
+ ],
30
+ multiSelect: [
31
+ { op: "contains", label: "contains" },
32
+ { op: "notContains", label: "does not contain" },
33
+ { op: "isEmpty", label: "is empty" },
34
+ { op: "isNotEmpty", label: "is not empty" },
35
+ ],
36
+ date: [
37
+ { op: "is", label: "is" },
38
+ { op: "before", label: "is before" },
39
+ { op: "after", label: "is after" },
40
+ { op: "onOrBefore", label: "is on or before" },
41
+ { op: "onOrAfter", label: "is on or after" },
42
+ { op: "isEmpty", label: "is empty" },
43
+ { op: "isNotEmpty", label: "is not empty" },
44
+ ],
45
+ checkbox: [{ op: "is", label: "is" }],
46
+ };
47
+ function textOps() {
48
+ return [
49
+ { op: "contains", label: "contains" },
50
+ { op: "notContains", label: "does not contain" },
51
+ { op: "is", label: "is" },
52
+ { op: "isNot", label: "is not" },
53
+ { op: "isEmpty", label: "is empty" },
54
+ { op: "isNotEmpty", label: "is not empty" },
55
+ ];
56
+ }
57
+ /** Whether an op needs a value to compare with (is empty does not). */
58
+ export const needsValue = (op) => op !== "isEmpty" && op !== "isNotEmpty";
59
+ export const isEmpty = (v) => v === null || v === undefined || v === "" || (Array.isArray(v) && v.length === 0);
60
+ /** A filter just added for `property`: its first op, and for a checkbox, checked. */
61
+ export function newFilter(property, id) {
62
+ const op = OPS[property.type][0].op;
63
+ return { id, property: property.id, op, value: property.type === "checkbox" ? true : null };
64
+ }
65
+ /** Whether `row` passes `filter`. A filter still missing its value lets everything through, so a half-written one never empties the view. */
66
+ export function passes(row, filter, property) {
67
+ if (!property)
68
+ return true;
69
+ const v = row.values[property.id] ?? null;
70
+ if (filter.op === "isEmpty")
71
+ return isEmpty(v);
72
+ if (filter.op === "isNotEmpty")
73
+ return !isEmpty(v);
74
+ const want = filter.value;
75
+ if (property.type === "checkbox")
76
+ return (v === true) === (want !== false);
77
+ if (isEmpty(want))
78
+ return true;
79
+ switch (property.type) {
80
+ case "title":
81
+ case "text":
82
+ case "url": {
83
+ const have = String(v ?? "").toLocaleLowerCase();
84
+ const w = String(want).toLocaleLowerCase();
85
+ if (filter.op === "contains")
86
+ return have.includes(w);
87
+ if (filter.op === "notContains")
88
+ return !have.includes(w);
89
+ if (filter.op === "is")
90
+ return have === w;
91
+ if (filter.op === "isNot")
92
+ return have !== w;
93
+ return true;
94
+ }
95
+ case "number": {
96
+ // A number stored as text counts as that number.
97
+ const n = typeof v === "number" ? v : typeof v === "string" && v.trim() !== "" ? Number(v) : NaN;
98
+ if (Number.isNaN(n))
99
+ return filter.op === "isNot";
100
+ const w = Number(want);
101
+ const v2 = n;
102
+ return { is: v2 === w, isNot: v2 !== w, gt: v2 > w, lt: v2 < w, gte: v2 >= w, lte: v2 <= w }[filter.op] ?? true;
103
+ }
104
+ case "select":
105
+ if (filter.op === "is")
106
+ return v === want;
107
+ if (filter.op === "isNot")
108
+ return v !== want;
109
+ return true;
110
+ case "multiSelect": {
111
+ const have = Array.isArray(v) ? v : [];
112
+ const wants = Array.isArray(want) ? want : [String(want)];
113
+ const any = wants.some((w) => have.includes(w));
114
+ return filter.op === "notContains" ? !any : any;
115
+ }
116
+ case "date": {
117
+ if (typeof v !== "string" || v === "")
118
+ return false;
119
+ const w = String(want);
120
+ // "YYYY-MM-DD" compares as text in date order.
121
+ const day = v.slice(0, 10);
122
+ return { is: day === w, before: day < w, after: day > w, onOrBefore: day <= w, onOrAfter: day >= w }[filter.op] ?? true;
123
+ }
124
+ }
125
+ }
126
+ /** Whether a filter says anything yet: its property exists, and it has a value if it needs one. */
127
+ export function isActive(filter, property) {
128
+ if (!property)
129
+ return false;
130
+ if (!needsValue(filter.op) || property.type === "checkbox")
131
+ return true;
132
+ return !isEmpty(filter.value ?? null);
133
+ }
134
+ /** Rows passing all (or any) of the filters. Filters that say nothing yet (a deleted property, a value not given) are left out,
135
+ so with "any" a half-written one does not let every row through. */
136
+ export function filterRows(rows, properties, filters, match = "all") {
137
+ const byId = new Map(properties.map((p) => [p.id, p]));
138
+ const active = filters.filter((f) => isActive(f, byId.get(f.property)));
139
+ if (active.length === 0)
140
+ return [...rows];
141
+ return rows.filter((row) => (match === "all" ? active.every((f) => passes(row, f, byId.get(f.property))) : active.some((f) => passes(row, f, byId.get(f.property)))));
142
+ }
143
+ const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: "base" });
144
+ /** How two values of `property` order, ascending. Empty sorts last, whichever way. */
145
+ export function compareValues(a, b, property) {
146
+ switch (property.type) {
147
+ case "number": {
148
+ // Something not a number sorts after every number.
149
+ const na = Number(a);
150
+ const nb = Number(b);
151
+ if (Number.isNaN(na) || Number.isNaN(nb))
152
+ return Number(Number.isNaN(na)) - Number(Number.isNaN(nb));
153
+ return na - nb;
154
+ }
155
+ case "checkbox":
156
+ return Number(a === true) - Number(b === true);
157
+ case "select": {
158
+ // In the options' own order, as a board's columns are.
159
+ // An id no longer among the options sorts after them.
160
+ const order = (v) => {
161
+ const i = property.options?.findIndex((o) => o.id === v) ?? -1;
162
+ return i === -1 ? Number.MAX_SAFE_INTEGER : i;
163
+ };
164
+ return order(a) - order(b);
165
+ }
166
+ case "multiSelect": {
167
+ const name = (v) => (Array.isArray(v) ? v.map((id) => property.options?.find((o) => o.id === id)?.name ?? id).join(", ") : "");
168
+ return collator.compare(name(a), name(b));
169
+ }
170
+ default:
171
+ return collator.compare(String(a ?? ""), String(b ?? ""));
172
+ }
173
+ }
174
+ /** Sorted by each sort in turn; rows equal on all of them keep their order. */
175
+ export function sortRows(rows, properties, sorts) {
176
+ const byId = new Map(properties.map((p) => [p.id, p]));
177
+ const keyed = rows.map((row, index) => ({ row, index }));
178
+ keyed.sort((x, y) => {
179
+ for (const sort of sorts) {
180
+ const property = byId.get(sort.property);
181
+ if (!property)
182
+ continue;
183
+ const a = x.row.values[property.id];
184
+ const b = y.row.values[property.id];
185
+ // A checkbox is never empty: unset is unchecked, sorted with the unchecked.
186
+ const ea = property.type !== "checkbox" && isEmpty(a ?? null);
187
+ const eb = property.type !== "checkbox" && isEmpty(b ?? null);
188
+ if (ea !== eb)
189
+ return ea ? 1 : -1;
190
+ if (ea && eb)
191
+ continue;
192
+ const c = compareValues(a, b, property);
193
+ if (c !== 0)
194
+ return sort.direction === "asc" ? c : -c;
195
+ }
196
+ return x.index - y.index;
197
+ });
198
+ return keyed.map((k) => k.row);
199
+ }
200
+ /** Rows by a select (or a checkbox): a group per option in its order, then "No value". Empty groups are kept, for a board's columns. */
201
+ export function groupRows(rows, property) {
202
+ if (property.type === "checkbox") {
203
+ return [true, false].map((on) => ({ key: String(on), option: null, rows: rows.filter((r) => (r.values[property.id] === true) === on) }));
204
+ }
205
+ const options = property.options ?? [];
206
+ const groups = options.map((option) => ({ key: option.id, option, rows: [] }));
207
+ const none = { key: null, option: null, rows: [] };
208
+ for (const row of rows) {
209
+ const v = row.values[property.id];
210
+ const ids = Array.isArray(v) ? v : v === null || v === undefined || v === "" ? [] : [String(v)];
211
+ const homes = groups.filter((g) => ids.includes(g.key));
212
+ if (homes.length === 0)
213
+ none.rows.push(row);
214
+ for (const g of homes)
215
+ g.rows.push(row);
216
+ }
217
+ return [...groups, none];
218
+ }
219
+ /** The first title property, which names a row. */
220
+ export const titleOf = (properties) => properties.find((p) => p.type === "title");
221
+ /** A value as words, for a screen reader or a plain cell. */
222
+ export function valueText(v, property) {
223
+ if (isEmpty(v ?? null))
224
+ return "";
225
+ switch (property.type) {
226
+ case "checkbox":
227
+ return v ? "Yes" : "No";
228
+ case "select":
229
+ return property.options?.find((o) => o.id === v)?.name ?? String(v);
230
+ case "multiSelect":
231
+ return v.map((id) => property.options?.find((o) => o.id === id)?.name ?? id).join(", ");
232
+ default:
233
+ return String(v);
234
+ }
235
+ }
236
+ /** Rows whose words (title, text, url, select and multi-select names) contain `query`, ignoring case. */
237
+ export function searchRows(rows, properties, query) {
238
+ const q = query.trim().toLocaleLowerCase();
239
+ if (q === "")
240
+ return [...rows];
241
+ const words = properties.filter((p) => p.type !== "checkbox" && p.type !== "number" && p.type !== "date");
242
+ return rows.filter((row) => words.some((p) => valueText(row.values[p.id], p).toLocaleLowerCase().includes(q)));
243
+ }
244
+ /** What a view shows: searched, filtered, then sorted. */
245
+ export function applyView(rows, properties, view, query = "") {
246
+ return sortRows(filterRows(searchRows(rows, properties, query), properties, view.filter, view.match), properties, view.sort);
247
+ }
248
+ /** A view's properties to show, in its order, without the hidden ones. The title always shows. */
249
+ export function shownProperties(properties, view) {
250
+ const order = view.order ?? [];
251
+ const ranked = [...properties].sort((a, b) => {
252
+ const ia = order.indexOf(a.id);
253
+ const ib = order.indexOf(b.id);
254
+ return (ia === -1 ? order.length + properties.indexOf(a) : ia) - (ib === -1 ? order.length + properties.indexOf(b) : ib);
255
+ });
256
+ return ranked.filter((p) => p.type === "title" || !view.hidden.includes(p.id));
257
+ }
258
+ /** A fresh view of `kind`, choosing what a board groups by and a calendar dates by. */
259
+ export function newView(kind, properties, id, name) {
260
+ const names = { table: "Table", board: "Board", gallery: "Gallery", list: "List", calendar: "Calendar" };
261
+ return {
262
+ id,
263
+ name: name ?? names[kind],
264
+ kind,
265
+ sort: [],
266
+ filter: [],
267
+ hidden: [],
268
+ groupBy: kind === "board" ? properties.find((p) => p.type === "select")?.id : undefined,
269
+ dateProperty: kind === "calendar" ? properties.find((p) => p.type === "date")?.id : undefined,
270
+ };
271
+ }
272
+ //# sourceMappingURL=database.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/lib/database.ts"],"names":[],"mappings":"AAAA;;;;;;;iDAOiD;AAkCjD,oGAAoG;AACpG,MAAM,CAAC,MAAM,GAAG,GAAqE;IACjF,KAAK,EAAE,OAAO,EAAE;IAChB,IAAI,EAAE,OAAO,EAAE;IACf,GAAG,EAAE,OAAO,EAAE;IACd,MAAM,EAAE;QACJ,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE;QACxB,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE;QAC3B,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE;QACxB,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE;QACxB,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE;QACzB,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE;QACzB,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE;QACpC,EAAE,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE;KAC9C;IACD,MAAM,EAAE;QACJ,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;QACzB,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE;QAChC,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE;QACpC,EAAE,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE;KAC9C;IACD,WAAW,EAAE;QACT,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;QACrC,EAAE,EAAE,EAAE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M,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IACnI,OAAO;QACH,EAAE;QACF,IAAI,EAAE,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC;QACzB,IAAI;QACJ,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS;QACvF,YAAY,EAAE,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS;KAChG,CAAC;AACN,CAAC"}
@@ -0,0 +1,30 @@
1
+ export declare function toISODate(date: Date): string;
2
+ /** The local day a `YYYY-MM-DD` names, or undefined if it names none (30 February). */
3
+ export declare function fromISODate(value: string | null | undefined): Date | undefined;
4
+ export declare function isTime(value: string | null | undefined): value is string;
5
+ /** Splits `YYYY-MM-DDTHH:MM`; either half is null when it is missing or wrong. */
6
+ export declare function splitDateTime(value: string | null | undefined): {
7
+ date: string | null;
8
+ time: string | null;
9
+ };
10
+ /** "Sun 27 Dec 2026" */
11
+ export declare const formatDay: (date: Date) => string;
12
+ /** "27 Dec 2026" */
13
+ export declare const formatShortDay: (date: Date) => string;
14
+ /** The reader's local day, `YYYY-MM-DD`. */
15
+ export declare const today: (now?: Date) => string;
16
+ export declare const isMonth: (value: unknown) => value is string;
17
+ /** The month a `YYYY-MM-DD` falls in. */
18
+ export declare const monthOf: (day: string) => string;
19
+ /** How many days the month has (28 to 31). */
20
+ export declare function daysIn(month: string): number;
21
+ /** The month `by` months before or after, across a year's end. */
22
+ export declare function shiftMonth(month: string, by: number): string;
23
+ /** The first and last day of a month, both included. */
24
+ export declare const monthSpan: (month: string) => {
25
+ from: string;
26
+ to: string;
27
+ };
28
+ /** "December 2026" */
29
+ export declare const formatMonth: (month: string) => string;
30
+ //# sourceMappingURL=dates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dates.d.ts","sourceRoot":"","sources":["../../src/lib/dates.ts"],"names":[],"mappings":"AAOA,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE5C;AAED,uFAAuF;AACvF,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,CAK9E;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,IAAI,MAAM,CAExE;AAED,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAM5G;AAKD,wBAAwB;AACxB,eAAO,MAAM,SAAS,GAAI,MAAM,IAAI,KAAG,MAA2C,CAAC;AACnF,oBAAoB;AACpB,eAAO,MAAM,cAAc,GAAI,MAAM,IAAI,KAAG,MAAgC,CAAC;AAM7E,4CAA4C;AAC5C,eAAO,MAAM,KAAK,GAAI,MAAK,IAAiB,KAAG,MAAwB,CAAC;AAExE,eAAO,MAAM,OAAO,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAA4E,CAAC;AAE/H,yCAAyC;AACzC,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,KAAG,MAAyB,CAAC;AAEhE,8CAA8C;AAC9C,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAG5C;AAED,kEAAkE;AAClE,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAI5D;AAED,wDAAwD;AACxD,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,KAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAqE,CAAC;AAI1I,sBAAsB;AACtB,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,KAAG,MAG3C,CAAC"}
@@ -0,0 +1,61 @@
1
+ /* Dates and times as the strings a form holds: `YYYY-MM-DD`, `HH:MM`, and the two
2
+ joined by a `T`. They are calendar values, not instants, so nothing here goes
3
+ through UTC: `new Date("2027-01-12")` is midnight in Greenwich, which is the day
4
+ before for anyone west of it. */
5
+ const pad = (n) => String(n).padStart(2, "0");
6
+ export function toISODate(date) {
7
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
8
+ }
9
+ /** The local day a `YYYY-MM-DD` names, or undefined if it names none (30 February). */
10
+ export function fromISODate(value) {
11
+ const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value ?? "");
12
+ if (match === null)
13
+ return undefined;
14
+ const date = new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));
15
+ return toISODate(date) === value ? date : undefined;
16
+ }
17
+ export function isTime(value) {
18
+ return /^([01]\d|2[0-3]):[0-5]\d$/.test(value ?? "");
19
+ }
20
+ /** Splits `YYYY-MM-DDTHH:MM`; either half is null when it is missing or wrong. */
21
+ export function splitDateTime(value) {
22
+ const [date = "", time = ""] = (value ?? "").split("T");
23
+ return {
24
+ date: fromISODate(date) === undefined ? null : date,
25
+ time: isTime(time.slice(0, 5)) ? time.slice(0, 5) : null,
26
+ };
27
+ }
28
+ const DAY = new Intl.DateTimeFormat("en-GB", { weekday: "short", day: "numeric", month: "short", year: "numeric" });
29
+ const SHORT_DAY = new Intl.DateTimeFormat("en-GB", { day: "numeric", month: "short", year: "numeric" });
30
+ /** "Sun 27 Dec 2026" */
31
+ export const formatDay = (date) => DAY.format(date).replace(",", "");
32
+ /** "27 Dec 2026" */
33
+ export const formatShortDay = (date) => SHORT_DAY.format(date);
34
+ /* Months as `YYYY-MM`, for a month at a time: a calendar, a budget, a report.
35
+ From endgame, 2026-12-05, without its fixed time zone: "today" here is the
36
+ browser's local day, which is the reader's. */
37
+ /** The reader's local day, `YYYY-MM-DD`. */
38
+ export const today = (now = new Date()) => toISODate(now);
39
+ export const isMonth = (value) => typeof value === "string" && /^\d{4}-(0[1-9]|1[0-2])$/.test(value);
40
+ /** The month a `YYYY-MM-DD` falls in. */
41
+ export const monthOf = (day) => day.slice(0, 7);
42
+ /** How many days the month has (28 to 31). */
43
+ export function daysIn(month) {
44
+ const [y, m] = month.split("-").map(Number);
45
+ return new Date(y, m, 0).getDate();
46
+ }
47
+ /** The month `by` months before or after, across a year's end. */
48
+ export function shiftMonth(month, by) {
49
+ const [y, m] = month.split("-").map(Number);
50
+ const date = new Date(y, m - 1 + by, 1);
51
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}`;
52
+ }
53
+ /** The first and last day of a month, both included. */
54
+ export const monthSpan = (month) => ({ from: `${month}-01`, to: `${month}-${pad(daysIn(month))}` });
55
+ const MONTH = new Intl.DateTimeFormat("en-GB", { month: "long", year: "numeric" });
56
+ /** "December 2026" */
57
+ export const formatMonth = (month) => {
58
+ const [y, m] = month.split("-").map(Number);
59
+ return MONTH.format(new Date(y, m - 1, 1));
60
+ };
61
+ //# sourceMappingURL=dates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dates.js","sourceRoot":"","sources":["../../src/lib/dates.ts"],"names":[],"mappings":"AAAA;;;mCAGmC;AAEnC,MAAM,GAAG,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAE9D,MAAM,UAAU,SAAS,CAAC,IAAU;IAChC,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,CAAC,IAAI,C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