@kujoforall/paper-ui 0.1.0 → 0.2.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 (553) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/README.md +50 -7
  3. package/dist/components/editor/block-text.d.ts.map +1 -1
  4. package/dist/components/editor/block-text.js +52 -17
  5. package/dist/components/editor/block-text.js.map +1 -1
  6. package/dist/components/editor/blocks.d.ts.map +1 -1
  7. package/dist/components/editor/blocks.js +17 -13
  8. package/dist/components/editor/blocks.js.map +1 -1
  9. package/dist/components/editor/document-editor.d.ts.map +1 -1
  10. package/dist/components/editor/document-editor.js +4 -2
  11. package/dist/components/editor/document-editor.js.map +1 -1
  12. package/dist/components/editor/document-view.d.ts.map +1 -1
  13. package/dist/components/editor/document-view.js +17 -12
  14. package/dist/components/editor/document-view.js.map +1 -1
  15. package/dist/components/editor/editor-state.d.ts +7 -0
  16. package/dist/components/editor/editor-state.d.ts.map +1 -1
  17. package/dist/components/editor/editor-state.js +28 -3
  18. package/dist/components/editor/editor-state.js.map +1 -1
  19. package/dist/components/editor/extensions/kit-blocks.d.ts +34 -0
  20. package/dist/components/editor/extensions/kit-blocks.d.ts.map +1 -0
  21. package/dist/components/editor/extensions/kit-blocks.js +201 -0
  22. package/dist/components/editor/extensions/kit-blocks.js.map +1 -0
  23. package/dist/components/editor/extensions/spoiler.d.ts.map +1 -1
  24. package/dist/components/editor/extensions/spoiler.js +2 -2
  25. package/dist/components/editor/extensions/spoiler.js.map +1 -1
  26. package/dist/components/editor/index.d.ts +1 -0
  27. package/dist/components/editor/index.d.ts.map +1 -1
  28. package/dist/components/editor/index.js +1 -0
  29. package/dist/components/editor/index.js.map +1 -1
  30. package/dist/components/editor/kinds.js +1 -1
  31. package/dist/components/editor/kinds.js.map +1 -1
  32. package/dist/components/editor/look.d.ts +18 -0
  33. package/dist/components/editor/look.d.ts.map +1 -0
  34. package/dist/components/editor/look.js +21 -0
  35. package/dist/components/editor/look.js.map +1 -0
  36. package/dist/components/three/model-viewer.d.ts +36 -0
  37. package/dist/components/three/model-viewer.d.ts.map +1 -0
  38. package/dist/components/three/model-viewer.js +338 -0
  39. package/dist/components/three/model-viewer.js.map +1 -0
  40. package/dist/components/ui/accent-picker.js +1 -1
  41. package/dist/components/ui/accent-picker.js.map +1 -1
  42. package/dist/components/ui/alert-dialog.d.ts +29 -0
  43. package/dist/components/ui/alert-dialog.d.ts.map +1 -0
  44. package/dist/components/ui/alert-dialog.js +72 -0
  45. package/dist/components/ui/alert-dialog.js.map +1 -0
  46. package/dist/components/ui/animated-height.d.ts +6 -0
  47. package/dist/components/ui/animated-height.d.ts.map +1 -0
  48. package/dist/components/ui/animated-height.js +26 -0
  49. package/dist/components/ui/animated-height.js.map +1 -0
  50. package/dist/components/ui/app-shell.d.ts +1 -0
  51. package/dist/components/ui/app-shell.d.ts.map +1 -1
  52. package/dist/components/ui/app-shell.js +5 -3
  53. package/dist/components/ui/app-shell.js.map +1 -1
  54. package/dist/components/ui/avatar.d.ts +30 -0
  55. package/dist/components/ui/avatar.d.ts.map +1 -0
  56. package/dist/components/ui/avatar.js +50 -0
  57. package/dist/components/ui/avatar.js.map +1 -0
  58. package/dist/components/ui/badge.d.ts +3 -3
  59. package/dist/components/ui/badge.d.ts.map +1 -1
  60. package/dist/components/ui/badge.js +2 -2
  61. package/dist/components/ui/badge.js.map +1 -1
  62. package/dist/components/ui/banner.d.ts +33 -0
  63. package/dist/components/ui/banner.d.ts.map +1 -0
  64. package/dist/components/ui/banner.js +21 -0
  65. package/dist/components/ui/banner.js.map +1 -0
  66. package/dist/components/ui/breadcrumbs.js +1 -1
  67. package/dist/components/ui/breadcrumbs.js.map +1 -1
  68. package/dist/components/ui/button.d.ts +8 -6
  69. package/dist/components/ui/button.d.ts.map +1 -1
  70. package/dist/components/ui/button.js +91 -26
  71. package/dist/components/ui/button.js.map +1 -1
  72. package/dist/components/ui/calendar.d.ts.map +1 -1
  73. package/dist/components/ui/calendar.js +6 -5
  74. package/dist/components/ui/calendar.js.map +1 -1
  75. package/dist/components/ui/callout.d.ts +23 -4
  76. package/dist/components/ui/callout.d.ts.map +1 -1
  77. package/dist/components/ui/callout.js +28 -15
  78. package/dist/components/ui/callout.js.map +1 -1
  79. package/dist/components/ui/card.d.ts +13 -8
  80. package/dist/components/ui/card.d.ts.map +1 -1
  81. package/dist/components/ui/card.js +10 -9
  82. package/dist/components/ui/card.js.map +1 -1
  83. package/dist/components/ui/checkbox.d.ts +9 -4
  84. package/dist/components/ui/checkbox.d.ts.map +1 -1
  85. package/dist/components/ui/checkbox.js +25 -5
  86. package/dist/components/ui/checkbox.js.map +1 -1
  87. package/dist/components/ui/choice-label.d.ts +13 -0
  88. package/dist/components/ui/choice-label.d.ts.map +1 -0
  89. package/dist/components/ui/choice-label.js +17 -0
  90. package/dist/components/ui/choice-label.js.map +1 -0
  91. package/dist/components/ui/collapsible.d.ts +10 -0
  92. package/dist/components/ui/collapsible.d.ts.map +1 -0
  93. package/dist/components/ui/collapsible.js +21 -0
  94. package/dist/components/ui/collapsible.js.map +1 -0
  95. package/dist/components/ui/collection-layout.d.ts +24 -0
  96. package/dist/components/ui/collection-layout.d.ts.map +1 -0
  97. package/dist/components/ui/collection-layout.js +16 -0
  98. package/dist/components/ui/collection-layout.js.map +1 -0
  99. package/dist/components/ui/combobox.d.ts +10 -0
  100. package/dist/components/ui/combobox.d.ts.map +1 -0
  101. package/dist/components/ui/combobox.js +93 -0
  102. package/dist/components/ui/combobox.js.map +1 -0
  103. package/dist/components/ui/command-menu.d.ts +5 -2
  104. package/dist/components/ui/command-menu.d.ts.map +1 -1
  105. package/dist/components/ui/command-menu.js +31 -6
  106. package/dist/components/ui/command-menu.js.map +1 -1
  107. package/dist/components/ui/context-menu.d.ts +19 -0
  108. package/dist/components/ui/context-menu.d.ts.map +1 -0
  109. package/dist/components/ui/context-menu.js +42 -0
  110. package/dist/components/ui/context-menu.js.map +1 -0
  111. package/dist/components/ui/copy-button.d.ts +11 -0
  112. package/dist/components/ui/copy-button.d.ts.map +1 -0
  113. package/dist/components/ui/copy-button.js +48 -0
  114. package/dist/components/ui/copy-button.js.map +1 -0
  115. package/dist/components/ui/database/calendar-view.d.ts +10 -0
  116. package/dist/components/ui/database/calendar-view.d.ts.map +1 -0
  117. package/dist/components/ui/database/calendar-view.js +65 -0
  118. package/dist/components/ui/database/calendar-view.js.map +1 -0
  119. package/dist/components/ui/database/card-views.d.ts +22 -0
  120. package/dist/components/ui/database/card-views.d.ts.map +1 -0
  121. package/dist/components/ui/database/card-views.js +74 -0
  122. package/dist/components/ui/database/card-views.js.map +1 -0
  123. package/dist/components/ui/database/cells.d.ts +20 -0
  124. package/dist/components/ui/database/cells.d.ts.map +1 -0
  125. package/dist/components/ui/database/cells.js +132 -0
  126. package/dist/components/ui/database/cells.js.map +1 -0
  127. package/dist/components/ui/database/database.d.ts +19 -0
  128. package/dist/components/ui/database/database.d.ts.map +1 -0
  129. package/dist/components/ui/database/database.js +102 -0
  130. package/dist/components/ui/database/database.js.map +1 -0
  131. package/dist/components/ui/database/icons.d.ts +5 -0
  132. package/dist/components/ui/database/icons.d.ts.map +1 -0
  133. package/dist/components/ui/database/icons.js +13 -0
  134. package/dist/components/ui/database/icons.js.map +1 -0
  135. package/dist/components/ui/database/table-view.d.ts +11 -0
  136. package/dist/components/ui/database/table-view.d.ts.map +1 -0
  137. package/dist/components/ui/database/table-view.js +157 -0
  138. package/dist/components/ui/database/table-view.js.map +1 -0
  139. package/dist/components/ui/date-picker.d.ts +6 -1
  140. package/dist/components/ui/date-picker.d.ts.map +1 -1
  141. package/dist/components/ui/date-picker.js +20 -12
  142. package/dist/components/ui/date-picker.js.map +1 -1
  143. package/dist/components/ui/date-time-picker.d.ts +3 -1
  144. package/dist/components/ui/date-time-picker.d.ts.map +1 -1
  145. package/dist/components/ui/date-time-picker.js +17 -15
  146. package/dist/components/ui/date-time-picker.js.map +1 -1
  147. package/dist/components/ui/dialog.d.ts +13 -9
  148. package/dist/components/ui/dialog.d.ts.map +1 -1
  149. package/dist/components/ui/dialog.js +33 -3
  150. package/dist/components/ui/dialog.js.map +1 -1
  151. package/dist/components/ui/document-layout.d.ts +15 -0
  152. package/dist/components/ui/document-layout.d.ts.map +1 -0
  153. package/dist/components/ui/document-layout.js +15 -0
  154. package/dist/components/ui/document-layout.js.map +1 -0
  155. package/dist/components/ui/dropdown-menu.d.ts +14 -10
  156. package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
  157. package/dist/components/ui/dropdown-menu.js +22 -13
  158. package/dist/components/ui/dropdown-menu.js.map +1 -1
  159. package/dist/components/ui/editable-text.d.ts +9 -2
  160. package/dist/components/ui/editable-text.d.ts.map +1 -1
  161. package/dist/components/ui/editable-text.js +27 -10
  162. package/dist/components/ui/editable-text.js.map +1 -1
  163. package/dist/components/ui/empty-state.d.ts +11 -0
  164. package/dist/components/ui/empty-state.d.ts.map +1 -0
  165. package/dist/components/ui/empty-state.js +9 -0
  166. package/dist/components/ui/empty-state.js.map +1 -0
  167. package/dist/components/ui/error-state.d.ts +20 -0
  168. package/dist/components/ui/error-state.d.ts.map +1 -0
  169. package/dist/components/ui/error-state.js +17 -0
  170. package/dist/components/ui/error-state.js.map +1 -0
  171. package/dist/components/ui/field-button.d.ts +2 -1
  172. package/dist/components/ui/field-button.d.ts.map +1 -1
  173. package/dist/components/ui/field-button.js +7 -5
  174. package/dist/components/ui/field-button.js.map +1 -1
  175. package/dist/components/ui/file-preview.js +1 -1
  176. package/dist/components/ui/file-preview.js.map +1 -1
  177. package/dist/components/ui/file-uploader.d.ts.map +1 -1
  178. package/dist/components/ui/file-uploader.js +5 -4
  179. package/dist/components/ui/file-uploader.js.map +1 -1
  180. package/dist/components/ui/filter-builder.d.ts +18 -0
  181. package/dist/components/ui/filter-builder.d.ts.map +1 -0
  182. package/dist/components/ui/filter-builder.js +98 -0
  183. package/dist/components/ui/filter-builder.js.map +1 -0
  184. package/dist/components/ui/focus-shell.d.ts +14 -0
  185. package/dist/components/ui/focus-shell.d.ts.map +1 -0
  186. package/dist/components/ui/focus-shell.js +13 -0
  187. package/dist/components/ui/focus-shell.js.map +1 -0
  188. package/dist/components/ui/handle-row.d.ts +11 -1
  189. package/dist/components/ui/handle-row.d.ts.map +1 -1
  190. package/dist/components/ui/handle-row.js +101 -32
  191. package/dist/components/ui/handle-row.js.map +1 -1
  192. package/dist/components/ui/header-bar.d.ts +5 -0
  193. package/dist/components/ui/header-bar.d.ts.map +1 -0
  194. package/dist/components/ui/header-bar.js +10 -0
  195. package/dist/components/ui/header-bar.js.map +1 -0
  196. package/dist/components/ui/hover-card.d.ts +6 -0
  197. package/dist/components/ui/hover-card.d.ts.map +1 -0
  198. package/dist/components/ui/hover-card.js +13 -0
  199. package/dist/components/ui/hover-card.js.map +1 -0
  200. package/dist/components/ui/image-block.js +4 -4
  201. package/dist/components/ui/image-block.js.map +1 -1
  202. package/dist/components/ui/image-card.d.ts.map +1 -1
  203. package/dist/components/ui/image-card.js +5 -4
  204. package/dist/components/ui/image-card.js.map +1 -1
  205. package/dist/components/ui/image-framer.d.ts +24 -0
  206. package/dist/components/ui/image-framer.d.ts.map +1 -0
  207. package/dist/components/ui/image-framer.js +89 -0
  208. package/dist/components/ui/image-framer.js.map +1 -0
  209. package/dist/components/ui/image-viewer.d.ts.map +1 -1
  210. package/dist/components/ui/image-viewer.js +38 -5
  211. package/dist/components/ui/image-viewer.js.map +1 -1
  212. package/dist/components/ui/image.d.ts +25 -3
  213. package/dist/components/ui/image.d.ts.map +1 -1
  214. package/dist/components/ui/image.js +50 -21
  215. package/dist/components/ui/image.js.map +1 -1
  216. package/dist/components/ui/index.d.ts +54 -11
  217. package/dist/components/ui/index.d.ts.map +1 -1
  218. package/dist/components/ui/index.js +53 -10
  219. package/dist/components/ui/index.js.map +1 -1
  220. package/dist/components/ui/input.d.ts +71 -12
  221. package/dist/components/ui/input.d.ts.map +1 -1
  222. package/dist/components/ui/input.js +236 -23
  223. package/dist/components/ui/input.js.map +1 -1
  224. package/dist/components/ui/link-block.d.ts.map +1 -1
  225. package/dist/components/ui/link-block.js +1 -1
  226. package/dist/components/ui/link-block.js.map +1 -1
  227. package/dist/components/ui/list-detail.d.ts +23 -0
  228. package/dist/components/ui/list-detail.d.ts.map +1 -0
  229. package/dist/components/ui/list-detail.js +33 -0
  230. package/dist/components/ui/list-detail.js.map +1 -0
  231. package/dist/components/ui/listbox.d.ts +7 -0
  232. package/dist/components/ui/listbox.d.ts.map +1 -0
  233. package/dist/components/ui/listbox.js +29 -0
  234. package/dist/components/ui/listbox.js.map +1 -0
  235. package/dist/components/ui/mac-card.js +1 -1
  236. package/dist/components/ui/mac-card.js.map +1 -1
  237. package/dist/components/ui/month-picker.d.ts +13 -0
  238. package/dist/components/ui/month-picker.d.ts.map +1 -0
  239. package/dist/components/ui/month-picker.js +53 -0
  240. package/dist/components/ui/month-picker.js.map +1 -0
  241. package/dist/components/ui/multi-select.d.ts +22 -0
  242. package/dist/components/ui/multi-select.d.ts.map +1 -0
  243. package/dist/components/ui/multi-select.js +88 -0
  244. package/dist/components/ui/multi-select.js.map +1 -0
  245. package/dist/components/ui/nav-tree.d.ts.map +1 -1
  246. package/dist/components/ui/nav-tree.js +10 -3
  247. package/dist/components/ui/nav-tree.js.map +1 -1
  248. package/dist/components/ui/page.d.ts +16 -5
  249. package/dist/components/ui/page.d.ts.map +1 -1
  250. package/dist/components/ui/page.js +23 -10
  251. package/dist/components/ui/page.js.map +1 -1
  252. package/dist/components/ui/pagination.d.ts +26 -0
  253. package/dist/components/ui/pagination.d.ts.map +1 -0
  254. package/dist/components/ui/pagination.js +54 -0
  255. package/dist/components/ui/pagination.js.map +1 -0
  256. package/dist/components/ui/picker-panel.d.ts +13 -0
  257. package/dist/components/ui/picker-panel.d.ts.map +1 -0
  258. package/dist/components/ui/picker-panel.js +19 -0
  259. package/dist/components/ui/picker-panel.js.map +1 -0
  260. package/dist/components/ui/popover.d.ts +2 -2
  261. package/dist/components/ui/popover.d.ts.map +1 -1
  262. package/dist/components/ui/popover.js +1 -1
  263. package/dist/components/ui/popover.js.map +1 -1
  264. package/dist/components/ui/progress.d.ts +11 -1
  265. package/dist/components/ui/progress.d.ts.map +1 -1
  266. package/dist/components/ui/progress.js +17 -4
  267. package/dist/components/ui/progress.js.map +1 -1
  268. package/dist/components/ui/property.d.ts +2 -6
  269. package/dist/components/ui/property.d.ts.map +1 -1
  270. package/dist/components/ui/property.js +6 -22
  271. package/dist/components/ui/property.js.map +1 -1
  272. package/dist/components/ui/radio-group.d.ts +8 -0
  273. package/dist/components/ui/radio-group.d.ts.map +1 -0
  274. package/dist/components/ui/radio-group.js +18 -0
  275. package/dist/components/ui/radio-group.js.map +1 -0
  276. package/dist/components/ui/rating.d.ts +14 -0
  277. package/dist/components/ui/rating.d.ts.map +1 -0
  278. package/dist/components/ui/rating.js +61 -0
  279. package/dist/components/ui/rating.js.map +1 -0
  280. package/dist/components/ui/save-status.d.ts +8 -0
  281. package/dist/components/ui/save-status.d.ts.map +1 -0
  282. package/dist/components/ui/save-status.js +31 -0
  283. package/dist/components/ui/save-status.js.map +1 -0
  284. package/dist/components/ui/segmented.d.ts +15 -7
  285. package/dist/components/ui/segmented.d.ts.map +1 -1
  286. package/dist/components/ui/segmented.js +8 -6
  287. package/dist/components/ui/segmented.js.map +1 -1
  288. package/dist/components/ui/select-menu.d.ts +3 -1
  289. package/dist/components/ui/select-menu.d.ts.map +1 -1
  290. package/dist/components/ui/select-menu.js +2 -2
  291. package/dist/components/ui/select-menu.js.map +1 -1
  292. package/dist/components/ui/select.d.ts +7 -2
  293. package/dist/components/ui/select.d.ts.map +1 -1
  294. package/dist/components/ui/select.js +19 -5
  295. package/dist/components/ui/select.js.map +1 -1
  296. package/dist/components/ui/selection-bar.js +1 -1
  297. package/dist/components/ui/selection-bar.js.map +1 -1
  298. package/dist/components/ui/settings-layout.d.ts +34 -0
  299. package/dist/components/ui/settings-layout.d.ts.map +1 -0
  300. package/dist/components/ui/settings-layout.js +16 -0
  301. package/dist/components/ui/settings-layout.js.map +1 -0
  302. package/dist/components/ui/share-link.d.ts +14 -0
  303. package/dist/components/ui/share-link.d.ts.map +1 -0
  304. package/dist/components/ui/share-link.js +16 -0
  305. package/dist/components/ui/share-link.js.map +1 -0
  306. package/dist/components/ui/sheet.d.ts +21 -0
  307. package/dist/components/ui/sheet.d.ts.map +1 -0
  308. package/dist/components/ui/sheet.js +53 -0
  309. package/dist/components/ui/sheet.js.map +1 -0
  310. package/dist/components/ui/sidebar.d.ts +82 -0
  311. package/dist/components/ui/sidebar.d.ts.map +1 -0
  312. package/dist/components/ui/sidebar.js +258 -0
  313. package/dist/components/ui/sidebar.js.map +1 -0
  314. package/dist/components/ui/skeleton.d.ts +8 -0
  315. package/dist/components/ui/skeleton.d.ts.map +1 -0
  316. package/dist/components/ui/skeleton.js +15 -0
  317. package/dist/components/ui/skeleton.js.map +1 -0
  318. package/dist/components/ui/spinner.d.ts +12 -0
  319. package/dist/components/ui/spinner.d.ts.map +1 -0
  320. package/dist/components/ui/spinner.js +14 -0
  321. package/dist/components/ui/spinner.js.map +1 -0
  322. package/dist/components/ui/spotlight.d.ts.map +1 -1
  323. package/dist/components/ui/spotlight.js +14 -11
  324. package/dist/components/ui/spotlight.js.map +1 -1
  325. package/dist/components/ui/step-dialog.js +3 -3
  326. package/dist/components/ui/step-dialog.js.map +1 -1
  327. package/dist/components/ui/steps-layout.d.ts +20 -0
  328. package/dist/components/ui/steps-layout.d.ts.map +1 -0
  329. package/dist/components/ui/steps-layout.js +26 -0
  330. package/dist/components/ui/steps-layout.js.map +1 -0
  331. package/dist/components/ui/switch.d.ts +8 -0
  332. package/dist/components/ui/switch.d.ts.map +1 -0
  333. package/dist/components/ui/switch.js +21 -0
  334. package/dist/components/ui/switch.js.map +1 -0
  335. package/dist/components/ui/table.d.ts +13 -5
  336. package/dist/components/ui/table.d.ts.map +1 -1
  337. package/dist/components/ui/table.js +65 -12
  338. package/dist/components/ui/table.js.map +1 -1
  339. package/dist/components/ui/tabs.d.ts +7 -0
  340. package/dist/components/ui/tabs.d.ts.map +1 -0
  341. package/dist/components/ui/tabs.js +19 -0
  342. package/dist/components/ui/tabs.js.map +1 -0
  343. package/dist/components/ui/theme-toggle.d.ts +14 -0
  344. package/dist/components/ui/theme-toggle.d.ts.map +1 -1
  345. package/dist/components/ui/theme-toggle.js +69 -41
  346. package/dist/components/ui/theme-toggle.js.map +1 -1
  347. package/dist/components/ui/time-list.d.ts +16 -0
  348. package/dist/components/ui/time-list.d.ts.map +1 -0
  349. package/dist/components/ui/time-list.js +49 -0
  350. package/dist/components/ui/time-list.js.map +1 -0
  351. package/dist/components/ui/time-picker.d.ts +37 -11
  352. package/dist/components/ui/time-picker.d.ts.map +1 -1
  353. package/dist/components/ui/time-picker.js +130 -52
  354. package/dist/components/ui/time-picker.js.map +1 -1
  355. package/dist/components/ui/toast.d.ts +18 -0
  356. package/dist/components/ui/toast.d.ts.map +1 -0
  357. package/dist/components/ui/toast.js +77 -0
  358. package/dist/components/ui/toast.js.map +1 -0
  359. package/dist/components/ui/toggle.d.ts +15 -0
  360. package/dist/components/ui/toggle.d.ts.map +1 -0
  361. package/dist/components/ui/toggle.js +55 -0
  362. package/dist/components/ui/toggle.js.map +1 -0
  363. package/dist/components/ui/tooltip.d.ts +1 -1
  364. package/dist/components/ui/tooltip.d.ts.map +1 -1
  365. package/dist/components/ui/tooltip.js +13 -2
  366. package/dist/components/ui/tooltip.js.map +1 -1
  367. package/dist/components/ui/top-bar.d.ts +25 -0
  368. package/dist/components/ui/top-bar.d.ts.map +1 -0
  369. package/dist/components/ui/top-bar.js +23 -0
  370. package/dist/components/ui/top-bar.js.map +1 -0
  371. package/dist/components/ui/typography.d.ts +11 -5
  372. package/dist/components/ui/typography.d.ts.map +1 -1
  373. package/dist/components/ui/typography.js +31 -5
  374. package/dist/components/ui/typography.js.map +1 -1
  375. package/dist/components/ui/video-block.d.ts.map +1 -1
  376. package/dist/components/ui/video-block.js +5 -1
  377. package/dist/components/ui/video-block.js.map +1 -1
  378. package/dist/hooks/use-dismiss.d.ts +5 -0
  379. package/dist/hooks/use-dismiss.d.ts.map +1 -0
  380. package/dist/hooks/use-dismiss.js +23 -0
  381. package/dist/hooks/use-dismiss.js.map +1 -0
  382. package/dist/hooks/use-escape-first.d.ts +3 -0
  383. package/dist/hooks/use-escape-first.d.ts.map +1 -0
  384. package/dist/hooks/use-escape-first.js +27 -0
  385. package/dist/hooks/use-escape-first.js.map +1 -0
  386. package/dist/hooks/use-media-query.d.ts +5 -0
  387. package/dist/hooks/use-media-query.d.ts.map +1 -0
  388. package/dist/hooks/use-media-query.js +16 -0
  389. package/dist/hooks/use-media-query.js.map +1 -0
  390. package/dist/hooks/use-save-queue.d.ts.map +1 -1
  391. package/dist/hooks/use-save-queue.js +19 -7
  392. package/dist/hooks/use-save-queue.js.map +1 -1
  393. package/dist/hooks/use-selection.d.ts.map +1 -1
  394. package/dist/hooks/use-selection.js +10 -1
  395. package/dist/hooks/use-selection.js.map +1 -1
  396. package/dist/lib/database.d.ts +92 -0
  397. package/dist/lib/database.d.ts.map +1 -0
  398. package/dist/lib/database.js +272 -0
  399. package/dist/lib/database.js.map +1 -0
  400. package/dist/lib/dates.d.ts +16 -0
  401. package/dist/lib/dates.d.ts.map +1 -1
  402. package/dist/lib/dates.js +27 -0
  403. package/dist/lib/dates.js.map +1 -1
  404. package/dist/lib/keys.d.ts +18 -0
  405. package/dist/lib/keys.d.ts.map +1 -0
  406. package/dist/lib/keys.js +66 -0
  407. package/dist/lib/keys.js.map +1 -0
  408. package/dist/lib/number.d.ts +4 -0
  409. package/dist/lib/number.d.ts.map +1 -0
  410. package/dist/lib/number.js +33 -0
  411. package/dist/lib/number.js.map +1 -0
  412. package/dist/lib/pointer.d.ts +2 -0
  413. package/dist/lib/pointer.d.ts.map +1 -0
  414. package/dist/lib/pointer.js +4 -0
  415. package/dist/lib/pointer.js.map +1 -0
  416. package/dist/lib/prepare-image.d.ts +43 -0
  417. package/dist/lib/prepare-image.d.ts.map +1 -0
  418. package/dist/lib/prepare-image.js +105 -0
  419. package/dist/lib/prepare-image.js.map +1 -0
  420. package/dist/lib/rich-text-dom.d.ts +2 -0
  421. package/dist/lib/rich-text-dom.d.ts.map +1 -1
  422. package/dist/lib/rich-text-dom.js +5 -3
  423. package/dist/lib/rich-text-dom.js.map +1 -1
  424. package/dist/lib/theme.d.ts +6 -0
  425. package/dist/lib/theme.d.ts.map +1 -0
  426. package/dist/lib/theme.js +15 -0
  427. package/dist/lib/theme.js.map +1 -0
  428. package/dist/lib/time.d.ts +19 -0
  429. package/dist/lib/time.d.ts.map +1 -0
  430. package/dist/lib/time.js +91 -0
  431. package/dist/lib/time.js.map +1 -0
  432. package/dist/lib/utils.d.ts.map +1 -1
  433. package/dist/lib/utils.js +20 -2
  434. package/dist/lib/utils.js.map +1 -1
  435. package/dist/styles/notion.css +342 -51
  436. package/package.json +27 -4
  437. package/src/components/editor/block-text.tsx +58 -17
  438. package/src/components/editor/blocks.tsx +19 -14
  439. package/src/components/editor/document-editor.tsx +7 -2
  440. package/src/components/editor/document-view.tsx +37 -24
  441. package/src/components/editor/editor-state.tsx +31 -3
  442. package/src/components/editor/extensions/kit-blocks.tsx +452 -0
  443. package/src/components/editor/extensions/spoiler.tsx +9 -4
  444. package/src/components/editor/index.ts +1 -0
  445. package/src/components/editor/kinds.ts +1 -1
  446. package/src/components/editor/look.tsx +36 -0
  447. package/src/components/three/model-viewer.tsx +514 -0
  448. package/src/components/ui/accent-picker.tsx +2 -2
  449. package/src/components/ui/alert-dialog.tsx +136 -0
  450. package/src/components/ui/animated-height.tsx +34 -0
  451. package/src/components/ui/app-shell.tsx +9 -7
  452. package/src/components/ui/avatar.tsx +106 -0
  453. package/src/components/ui/badge.tsx +4 -4
  454. package/src/components/ui/banner.tsx +53 -0
  455. package/src/components/ui/breadcrumbs.tsx +1 -1
  456. package/src/components/ui/button.tsx +115 -41
  457. package/src/components/ui/calendar.tsx +8 -7
  458. package/src/components/ui/callout.tsx +41 -42
  459. package/src/components/ui/card.tsx +27 -58
  460. package/src/components/ui/checkbox.tsx +53 -19
  461. package/src/components/ui/choice-label.tsx +43 -0
  462. package/src/components/ui/collapsible.tsx +58 -0
  463. package/src/components/ui/collection-layout.tsx +69 -0
  464. package/src/components/ui/combobox.tsx +155 -0
  465. package/src/components/ui/command-menu.tsx +61 -31
  466. package/src/components/ui/context-menu.tsx +89 -0
  467. package/src/components/ui/copy-button.tsx +80 -0
  468. package/src/components/ui/database/calendar-view.tsx +180 -0
  469. package/src/components/ui/database/card-views.tsx +221 -0
  470. package/src/components/ui/database/cells.tsx +237 -0
  471. package/src/components/ui/database/database.tsx +279 -0
  472. package/src/components/ui/database/icons.ts +15 -0
  473. package/src/components/ui/database/table-view.tsx +311 -0
  474. package/src/components/ui/date-picker.tsx +99 -61
  475. package/src/components/ui/date-time-picker.tsx +68 -62
  476. package/src/components/ui/dialog.tsx +48 -21
  477. package/src/components/ui/document-layout.tsx +52 -0
  478. package/src/components/ui/dropdown-menu.tsx +33 -31
  479. package/src/components/ui/editable-text.tsx +40 -7
  480. package/src/components/ui/empty-state.tsx +35 -0
  481. package/src/components/ui/error-state.tsx +67 -0
  482. package/src/components/ui/field-button.tsx +11 -9
  483. package/src/components/ui/file-preview.tsx +1 -1
  484. package/src/components/ui/file-uploader.tsx +23 -24
  485. package/src/components/ui/filter-builder.tsx +304 -0
  486. package/src/components/ui/focus-shell.tsx +48 -0
  487. package/src/components/ui/handle-row.tsx +176 -40
  488. package/src/components/ui/header-bar.tsx +15 -0
  489. package/src/components/ui/hover-card.tsx +30 -0
  490. package/src/components/ui/image-block.tsx +6 -6
  491. package/src/components/ui/image-card.tsx +18 -25
  492. package/src/components/ui/image-framer.tsx +160 -0
  493. package/src/components/ui/image-viewer.tsx +53 -10
  494. package/src/components/ui/image.tsx +133 -29
  495. package/src/components/ui/index.ts +106 -11
  496. package/src/components/ui/input.tsx +437 -65
  497. package/src/components/ui/link-block.tsx +5 -2
  498. package/src/components/ui/list-detail.tsx +115 -0
  499. package/src/components/ui/listbox.ts +26 -0
  500. package/src/components/ui/mac-card.tsx +5 -5
  501. package/src/components/ui/month-picker.tsx +119 -0
  502. package/src/components/ui/multi-select.tsx +221 -0
  503. package/src/components/ui/nav-tree.tsx +11 -5
  504. package/src/components/ui/page.tsx +63 -15
  505. package/src/components/ui/pagination.tsx +143 -0
  506. package/src/components/ui/picker-panel.tsx +69 -0
  507. package/src/components/ui/popover.tsx +3 -3
  508. package/src/components/ui/progress.tsx +56 -16
  509. package/src/components/ui/property.tsx +6 -37
  510. package/src/components/ui/radio-group.tsx +61 -0
  511. package/src/components/ui/rating.tsx +122 -0
  512. package/src/components/ui/save-status.tsx +53 -0
  513. package/src/components/ui/segmented.tsx +48 -16
  514. package/src/components/ui/select-menu.tsx +11 -3
  515. package/src/components/ui/select.tsx +33 -10
  516. package/src/components/ui/selection-bar.tsx +1 -1
  517. package/src/components/ui/settings-layout.tsx +117 -0
  518. package/src/components/ui/share-link.tsx +66 -0
  519. package/src/components/ui/sheet.tsx +90 -0
  520. package/src/components/ui/sidebar.tsx +627 -0
  521. package/src/components/ui/skeleton.tsx +22 -0
  522. package/src/components/ui/spinner.tsx +28 -0
  523. package/src/components/ui/spotlight.tsx +21 -21
  524. package/src/components/ui/step-dialog.tsx +6 -6
  525. package/src/components/ui/steps-layout.tsx +91 -0
  526. package/src/components/ui/switch.tsx +55 -0
  527. package/src/components/ui/table.tsx +75 -18
  528. package/src/components/ui/tabs.tsx +41 -0
  529. package/src/components/ui/theme-toggle.tsx +74 -83
  530. package/src/components/ui/time-list.tsx +106 -0
  531. package/src/components/ui/time-picker.tsx +305 -134
  532. package/src/components/ui/toast.tsx +132 -0
  533. package/src/components/ui/toggle.tsx +76 -0
  534. package/src/components/ui/tooltip.tsx +20 -6
  535. package/src/components/ui/top-bar.tsx +118 -0
  536. package/src/components/ui/typography.tsx +45 -9
  537. package/src/components/ui/video-block.tsx +9 -3
  538. package/src/hooks/use-dismiss.ts +24 -0
  539. package/src/hooks/use-escape-first.ts +25 -0
  540. package/src/hooks/use-media-query.ts +23 -0
  541. package/src/hooks/use-save-queue.ts +19 -7
  542. package/src/hooks/use-selection.ts +8 -1
  543. package/src/lib/database.ts +322 -0
  544. package/src/lib/dates.ts +36 -0
  545. package/src/lib/keys.ts +72 -0
  546. package/src/lib/number.ts +29 -0
  547. package/src/lib/pointer.ts +3 -0
  548. package/src/lib/prepare-image.ts +141 -0
  549. package/src/lib/rich-text-dom.ts +5 -3
  550. package/src/lib/theme.ts +18 -0
  551. package/src/lib/time.ts +83 -0
  552. package/src/lib/utils.ts +21 -2
  553. package/src/styles/notion.css +342 -51
@@ -0,0 +1,105 @@
1
+ /* Turning a picture off a phone or a camera into what is worth uploading: a display
2
+ JPEG and a thumbnail, each under a byte budget, the right way up, never the
3
+ original. Three apps each wrote this (endgame, medialogue, triptrack); this is
4
+ the one, with their differences as options.
5
+
6
+ - The picture is turned upright from its EXIF orientation (createImageBitmap's
7
+ default) and drawn on white, so a cut-out PNG does not come out on black.
8
+ - It is halved until the last step is small: a canvas shrinking a picture to a
9
+ quarter or less in one go skips pixels and the result shimmers.
10
+ - Each copy is saved at the best quality that fits its budget, stepping down;
11
+ a photograph fits at the first. One that will not fit fails, rather than
12
+ sending what the server will refuse.
13
+ - `square` crops to the middle square first (an avatar, a cover).
14
+ - `hash` adds a SHA-256 of the original file, to spot a picture sent twice.
15
+
16
+ Browser only: it needs a canvas. */
17
+ export const QUALITIES = [0.82, 0.72, 0.6, 0.5, 0.4];
18
+ const DEFAULTS = {
19
+ display: { edge: 1600, bytes: 1_000_000 },
20
+ thumb: { edge: 400, bytes: 140_000 },
21
+ };
22
+ /** The size a picture of `width` × `height` becomes for `copy`, never larger than it was. */
23
+ export function fitSize(width, height, copy) {
24
+ const scale = Math.min(1, copy.height !== undefined ? copy.height / height : (copy.edge ?? Infinity) / Math.max(width, height));
25
+ return { width: Math.max(1, Math.round(width * scale)), height: Math.max(1, Math.round(height * scale)) };
26
+ }
27
+ function canvasOf(width, height) {
28
+ const canvas = document.createElement("canvas");
29
+ canvas.width = width;
30
+ canvas.height = height;
31
+ const context = canvas.getContext("2d");
32
+ if (context === null)
33
+ throw new Error("This browser could not resize the picture.");
34
+ context.fillStyle = "#fff";
35
+ context.fillRect(0, 0, width, height);
36
+ context.imageSmoothingQuality = "high";
37
+ return [canvas, context];
38
+ }
39
+ /** `source` (its `crop`) drawn at `width` × `height`, halving on the way so nothing shimmers. */
40
+ export function resizeTo(source, crop, width, height) {
41
+ let current = source;
42
+ let from = crop;
43
+ let w = crop.width;
44
+ let h = crop.height;
45
+ while (w / 2 >= width && h / 2 >= height) {
46
+ w = Math.round(w / 2);
47
+ h = Math.round(h / 2);
48
+ const [canvas, context] = canvasOf(w, h);
49
+ context.drawImage(current, from.x, from.y, from.width, from.height, 0, 0, w, h);
50
+ // A step's own canvas (never the caller's) is let go of once drawn from: iOS Safari caps the memory canvases may hold.
51
+ if (current !== source && current instanceof HTMLCanvasElement)
52
+ current.width = 0;
53
+ current = canvas;
54
+ from = { x: 0, y: 0, width: w, height: h };
55
+ }
56
+ const [canvas, context] = canvasOf(width, height);
57
+ context.drawImage(current, from.x, from.y, from.width, from.height, 0, 0, width, height);
58
+ if (current !== source && current instanceof HTMLCanvasElement)
59
+ current.width = 0;
60
+ return canvas;
61
+ }
62
+ const encode = (canvas, quality) => new Promise((resolve, reject) => canvas.toBlob((blob) => (blob ? resolve(blob) : reject(new Error("This browser could not save the picture."))), "image/jpeg", quality));
63
+ /** The best quality JPEG that fits in `bytes`. */
64
+ export async function jpegUnder(canvas, bytes, qualities = QUALITIES) {
65
+ let blob = null;
66
+ for (const quality of qualities) {
67
+ blob = await encode(canvas, quality);
68
+ if (blob.size <= bytes)
69
+ return blob;
70
+ }
71
+ throw new Error("That picture would not shrink far enough to keep.");
72
+ }
73
+ const hex = (buffer) => [...new Uint8Array(buffer)].map((b) => b.toString(16).padStart(2, "0")).join("");
74
+ export async function prepareImage(file, { display = DEFAULTS.display, thumb = DEFAULTS.thumb, square = false, hash = false, qualities = QUALITIES, } = {}) {
75
+ let bitmap;
76
+ try {
77
+ bitmap = await createImageBitmap(file);
78
+ }
79
+ catch {
80
+ throw new Error("This browser cannot open that kind of picture.");
81
+ }
82
+ try {
83
+ const side = Math.min(bitmap.width, bitmap.height);
84
+ const crop = square
85
+ ? { x: Math.round((bitmap.width - side) / 2), y: Math.round((bitmap.height - side) / 2), width: side, height: side }
86
+ : { x: 0, y: 0, width: bitmap.width, height: bitmap.height };
87
+ const size = fitSize(crop.width, crop.height, display);
88
+ const big = resizeTo(bitmap, crop, size.width, size.height);
89
+ const small = fitSize(size.width, size.height, thumb);
90
+ const little = resizeTo(big, { x: 0, y: 0, width: size.width, height: size.height }, small.width, small.height);
91
+ return {
92
+ display: await jpegUnder(big, display.bytes, qualities),
93
+ thumb: await jpegUnder(little, thumb.bytes, qualities),
94
+ width: size.width,
95
+ height: size.height,
96
+ aspect: size.width / size.height,
97
+ ...(hash ? { hash: hex(await crypto.subtle.digest("SHA-256", await file.arrayBuffer())) } : null),
98
+ };
99
+ }
100
+ finally {
101
+ // A 24 MP bitmap is about 100 MB; the next file should not wait for the collector.
102
+ bitmap.close();
103
+ }
104
+ }
105
+ //# sourceMappingURL=prepare-image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepare-image.js","sourceRoot":"","sources":["../../src/lib/prepare-image.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;sCAesC;AAsBtC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;AAE9D,MAAM,QAAQ,GAAG;IACb,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE;IACzC,KAAK,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE;CACH,CAAC;AAEtC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,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAChH,OAAO;YACH,OAAO,EAAE,MAAM,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC;YACvD,KAAK,EAAE,MAAM,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC;YACtD,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM;YAChC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;SACpG,CAAC;IACN,CAAC;YAAS,CAAC;QACP,mFAAmF;QACnF,MAAM,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC;AACL,CAAC"}
@@ -1,4 +1,6 @@
1
1
  import { type Text } from "./rich-text.js";
2
+ /** Inline code, the same in Code, the editor and the read view. */
3
+ export declare const CODE_CLASSES = "rounded-small bg-tag-red-bg/70 px-1.5 py-0.5 font-mono text-[0.85em] text-tag-red-ink";
2
4
  export declare function spansToHtml(text: Text): string;
3
5
  export declare function readSpans(root: HTMLElement): Text;
4
6
  export declare function caretOffset(root: HTMLElement): number | null;
@@ -1 +1 @@
1
- {"version":3,"file":"rich-text-dom.d.ts","sourceRoot":"","sources":["../../src/lib/rich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+4,17 @@ import { normalize } from "./rich-text.js";
4
4
  written and read back only when it is a web or mail address, so a `javascript:`
5
5
  href pasted in as HTML never survives into the document. */
6
6
  const escape = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
7
- const UNDERLINE = "underline decoration-accent/50 underline-offset-[3px] hover:decoration-accent cursor-pointer";
8
- const CODE = "rounded-[3px] bg-tag-red-bg/70 px-1.5 py-0.5 font-mono text-[0.85em] text-tag-red-ink";
7
+ const UNDERLINE = "link";
8
+ /** Inline code, the same in Code, the editor and the read view. */
9
+ export const CODE_CLASSES = "rounded-small bg-tag-red-bg/70 px-1.5 py-0.5 font-mono text-[0.85em] text-tag-red-ink";
10
+ const CODE = CODE_CLASSES;
9
11
  const PAGE_ICON = '<svg class="mr-1 mb-0.5 inline size-[1em] text-ink-secondary" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/></svg>';
10
12
  export function spansToHtml(text) {
11
13
  return text
12
14
  .map((span) => {
13
15
  // A page link is one uneditable token, as a Notion mention is.
14
16
  if (span.page)
15
- return `<a data-page="${escape(span.page)}" href="/${escape(span.page)}" contenteditable="false" class="font-medium cursor-pointer rounded-[3px] hover:bg-tint-hover">${PAGE_ICON}<span class="${UNDERLINE}">${escape(span.text)}</span></a>`;
17
+ return `<a data-page="${escape(span.page)}" href="/${escape(span.page)}" contenteditable="false" class="font-medium cursor-pointer rounded-small hover:bg-tint-hover">${PAGE_ICON}<span class="${UNDERLINE}">${escape(span.text)}</span></a>`;
16
18
  let html = escape(span.text);
17
19
  if (span.code)
18
20
  html = `<code class="${CODE}">${html}</code>`;
@@ -1 +1 @@
1
- {"version":3,"file":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C,cAAc,CAAC,qBAAqB,EAAE,CAAC;IACxD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,IAAiB,EAAE,IAAsB;IACrE,MAAM,IAAI,GAAG,SAAS,EAAE,CAAC;IACzB,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACxE,MAAM,GAAG,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACzC,MAAM,IAAI,GAAG,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;IAChF,OAAO,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,GAAG,CAAC;AACtG,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type Theme = "light" | "dark" | "system";
2
+ export declare const THEMES: readonly Theme[];
3
+ export declare const THEME_KEY = "theme";
4
+ export declare const isTheme: (value: unknown) => value is Theme;
5
+ export declare function themeInitScript(storageKey?: string): string;
6
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/lib/theme.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAChD,eAAO,MAAM,MAAM,EAAE,SAAS,KAAK,EAAgC,CAAC;AACpE,eAAO,MAAM,SAAS,UAAU,CAAC;AAEjC,eAAO,MAAM,OAAO,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,KAAoE,CAAC;AAEvH,wBAAgB,eAAe,CAAC,UAAU,GAAE,MAAkB,GAAG,MAAM,CAEtE"}
@@ -0,0 +1,15 @@
1
+ /* Light, dark, or whatever the system says, kept in localStorage under a key the app
2
+ chooses (each app on one domain wants its own). Dark mode is the `dark` class on
3
+ <html>; the stylesheet does the rest.
4
+
5
+ themeInitScript() is the same choice made before first paint, so a reload never
6
+ flashes the wrong theme: put it in a <script> in <head> (index.html in Vite,
7
+ `dangerouslySetInnerHTML` in Next's root layout). It also applies the colour theme
8
+ kept by AccentPicker. */
9
+ export const THEMES = ["light", "dark", "system"];
10
+ export const THEME_KEY = "theme";
11
+ export const isTheme = (value) => value === "light" || value === "dark" || value === "system";
12
+ export function themeInitScript(storageKey = THEME_KEY) {
13
+ return `try{var t=localStorage.getItem(${JSON.stringify(storageKey)});if(t==="dark"||((t===null||t==="system")&&matchMedia("(prefers-color-scheme: dark)").matches))document.documentElement.classList.add("dark");var a=localStorage.getItem("accent");if(a&&a!=="paper")document.documentElement.dataset.accent=a}catch(e){}`;
14
+ }
15
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/lib/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;2BAO2B;AAG3B,MAAM,CAAC,MAAM,MAAM,GAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AACpE,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC;AAEjC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAc,EAAkB,EAAE,CAAC,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,QAAQ,CAAC;AAEvH,MAAM,UAAU,eAAe,CAAC,aAAqB,SAAS;IAC1D,OAAO,kCAAkC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,4PAA4P,CAAC;AACpU,CAAC"}
@@ -0,0 +1,19 @@
1
+ export type HourCycle = "h12" | "h23";
2
+ /** Whether this reader's locale writes times on a 12-hour clock (9:30 PM) or a 24-hour one (21:30). */
3
+ export declare function localHourCycle(locale?: string): HourCycle;
4
+ export declare function parseTime(text: string): string | null;
5
+ /** "21:30" → "9:30 PM" on a 12-hour clock, "21:30" on a 24-hour one. */
6
+ export declare function formatTime(time: string, cycle?: HourCycle): string;
7
+ /** Minutes since midnight. */
8
+ export declare const minutesOf: (time: string) => number;
9
+ export declare const timeOf: (minutes: number) => string;
10
+ /** Every `step` minutes through the day (from `after`, exclusive, when given), plus `include` if it falls between. */
11
+ export declare function timesEvery(step: number, { after, include }?: {
12
+ after?: string | null;
13
+ include?: string | null;
14
+ }): string[];
15
+ /** 30 → "30 min", 60 → "1 hr", 90 → "1.5 hrs", 135 → "2 hr 15 min". */
16
+ export declare function durationLabel(minutes: number): string;
17
+ /** The listed time closest to `time` (or to now), for where a list should open. */
18
+ export declare function nearest(times: readonly string[], time?: string | null, now?: Date): string | undefined;
19
+ //# sourceMappingURL=time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/lib/time.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK,CAAC;AAItC,uGAAuG;AACvG,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAOzD;AAQD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiBrD;AAED,wEAAwE;AACxE,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,SAA4B,GAAG,MAAM,CAKpF;AAED,8BAA8B;AAC9B,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,MAGxC,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,SAAS,MAAM,KAAG,MAAsE,CAAC;AAEhH,sHAAsH;AACtH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,GAAG,MAAM,EAAE,CAO9H;AAED,uEAAuE;AACvE,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMrD;AAED,mFAAmF;AACnF,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,GAAE,IAAiB,GAAG,MAAM,GAAG,SAAS,CAIlH"}
@@ -0,0 +1,91 @@
1
+ /* Times of day as the string a form holds, `HH:MM` on a 24-hour clock, and the ways
2
+ people type and read them. Pure, so a server can use the same rules. */
3
+ const pad = (n) => String(n).padStart(2, "0");
4
+ /** Whether this reader's locale writes times on a 12-hour clock (9:30 PM) or a 24-hour one (21:30). */
5
+ export function localHourCycle(locale) {
6
+ try {
7
+ const cycle = new Intl.DateTimeFormat(locale, { hour: "numeric" }).resolvedOptions().hourCycle;
8
+ return cycle === "h11" || cycle === "h12" ? "h12" : "h23";
9
+ }
10
+ catch {
11
+ return "h23";
12
+ }
13
+ }
14
+ /* Reads a time the way people type one:
15
+ "9" → 09:00 "930" → 09:30 "0930" → 09:30 "9:30" "9.30" "9h30" → 09:30
16
+ "9pm" "9 p.m." "9:30pm" → 21:.. "12am" → 00:00 "12pm" → 12:00
17
+ "21" "2130" "21:30" → 21:30 "noon" → 12:00 "midnight" → 00:00
18
+ A bare hour from 1 to 11 is taken as written (9 is 09:00): add "pm" for evening.
19
+ Returns null for anything that is not a time of day. */
20
+ export function parseTime(text) {
21
+ const s = text.trim().toLowerCase().replace(/\s+/g, "");
22
+ if (s === "")
23
+ return null;
24
+ if (s === "noon" || s === "midday")
25
+ return "12:00";
26
+ if (s === "midnight")
27
+ return "00:00";
28
+ const m = /^(\d{1,2})(?:[:.h]?(\d{2}))?(a|p|am|pm|a\.m\.|p\.m\.)?$/.exec(s);
29
+ if (!m)
30
+ return null;
31
+ let hour = Number(m[1]);
32
+ const minute = m[2] === undefined ? 0 : Number(m[2]);
33
+ const half = m[3]?.[0];
34
+ if (minute > 59)
35
+ return null;
36
+ if (half !== undefined) {
37
+ if (hour < 1 || hour > 12)
38
+ return null;
39
+ if (half === "a" && hour === 12)
40
+ hour = 0;
41
+ if (half === "p" && hour !== 12)
42
+ hour += 12;
43
+ }
44
+ else if (hour > 23)
45
+ return null;
46
+ return `${pad(hour)}:${pad(minute)}`;
47
+ }
48
+ /** "21:30" → "9:30 PM" on a 12-hour clock, "21:30" on a 24-hour one. */
49
+ export function formatTime(time, cycle = localHourCycle()) {
50
+ const [h, m] = time.split(":").map(Number);
51
+ if (cycle === "h23")
52
+ return `${pad(h)}:${pad(m)}`;
53
+ const hour = h % 12 === 0 ? 12 : h % 12;
54
+ return `${hour}:${pad(m)} ${h < 12 ? "AM" : "PM"}`;
55
+ }
56
+ /** Minutes since midnight. */
57
+ export const minutesOf = (time) => {
58
+ const [h, m] = time.split(":").map(Number);
59
+ return h * 60 + m;
60
+ };
61
+ export const timeOf = (minutes) => `${pad(Math.floor(minutes / 60) % 24)}:${pad(minutes % 60)}`;
62
+ /** Every `step` minutes through the day (from `after`, exclusive, when given), plus `include` if it falls between. */
63
+ export function timesEvery(step, { after, include } = {}) {
64
+ const safe = Number.isInteger(step) && step > 0 && step <= 60 ? step : 15;
65
+ const start = after ? minutesOf(after) + 1 : 0;
66
+ const set = new Set();
67
+ for (let m = Math.ceil(start / safe) * safe; m < 24 * 60; m += safe)
68
+ set.add(timeOf(m));
69
+ if (include && (!after || minutesOf(include) > minutesOf(after)))
70
+ set.add(include);
71
+ return [...set].sort();
72
+ }
73
+ /** 30 → "30 min", 60 → "1 hr", 90 → "1.5 hrs", 135 → "2 hr 15 min". */
74
+ export function durationLabel(minutes) {
75
+ if (minutes < 60)
76
+ return `${minutes} min`;
77
+ const h = minutes / 60;
78
+ if (minutes % 60 === 0)
79
+ return h === 1 ? "1 hr" : `${h} hrs`;
80
+ if (minutes % 30 === 0)
81
+ return `${h} hrs`;
82
+ return `${Math.floor(h)} hr ${minutes % 60} min`;
83
+ }
84
+ /** The listed time closest to `time` (or to now), for where a list should open. */
85
+ export function nearest(times, time, now = new Date()) {
86
+ if (times.length === 0)
87
+ return undefined;
88
+ const target = time ? minutesOf(time) : now.getHours() * 60 + now.getMinutes();
89
+ return times.reduce((best, t) => (Math.abs(minutesOf(t) - target) < Math.abs(minutesOf(best) - target) ? t : best));
90
+ }
91
+ //# sourceMappingURL=time.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.js","sourceRoot":"","sources":["../../src/lib/time.ts"],"names":[],"mappings":"AAAA;0EAC0E;AAI1E,MAAM,GAAG,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAE9D,uGAAuG;AACvG,MAAM,UAAU,cAAc,CAAC,MAAe;IAC1C,IAAI,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC,SAAS,CAAC;QAC/F,OAAO,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAC9D,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAED;;;;;0DAK0D;AAC1D,MAAM,UAAU,SAAS,CAAC,IAAY;IAClC,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACxD,IAAI,CAAC,KAAK,EAAE;QAAE,OAAO,IAAI,CAA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,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;IAC/E,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAsB7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
package/dist/lib/utils.js CHANGED
@@ -1,6 +1,24 @@
1
1
  import { clsx } from "clsx";
2
- import { twMerge } from "tailwind-merge";
2
+ import { extendTailwindMerge } from "tailwind-merge";
3
+ /* tailwind-merge knows Tailwind's own scales, not the kit's. Told nothing, it
4
+ cannot see that two of the kit's classes set the same thing, so it keeps both
5
+ and the stylesheet's order decides, not the caller: `text-caption
6
+ text-ink-tertiary` lost its size (it took `caption` for a colour), and
7
+ `h-control-md h-auto` kept the fixed height, so a growing Textarea never grew.
8
+ These are the kit's own names from notion.css. */
9
+ const merge = extendTailwindMerge({
10
+ extend: {
11
+ theme: {
12
+ text: ["display", "title", "h1", "h2", "h3", "lead", "body", "caption", "micro"],
13
+ leading: ["prose"],
14
+ spacing: ["control-sm", "control-md", "control-lg", "measure"],
15
+ container: ["measure", "reading", "wide"],
16
+ radius: ["small", "control", "surface", "overlay"],
17
+ shadow: ["popover", "dialog", "edge", "edge-t", "edge-b", "edge-l", "edge-r"],
18
+ },
19
+ },
20
+ });
3
21
  export function cn(...inputs) {
4
- return twMerge(clsx(inputs));
22
+ return merge(clsx(inputs));
5
23
  }
6
24
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,UAAU,EAAE,CAAC,GAAG,MAAoB;IACtC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AACjC,CAAC"}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;;oDAKoD;AACpD,MAAM,KAAK,GAAG,mBAAmB,CAAC;IAC9B,MAAM,EAAE;QACJ,KAAK,EAAE;YACH,IAAI,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC;YAChF,OAAO,EAAE,CAAC,OAAO,CAAC;YAClB,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,CAAC;YAC9D,SAAS,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC;YACzC,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;YAClD,MAAM,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC;SAChF;KACJ;CACJ,CAAC,CAAC;AAEH,MAAM,UAAU,EAAE,CAAC,GAAG,MAAoB;IACtC,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAC/B,CAAC"}