@kujoforall/paper-ui 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (366) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE +21 -0
  3. package/README.md +252 -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 +213 -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 +187 -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 +40 -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 +105 -0
  19. package/dist/components/editor/document-view.js.map +1 -0
  20. package/dist/components/editor/editor-state.d.ts +100 -0
  21. package/dist/components/editor/editor-state.d.ts.map +1 -0
  22. package/dist/components/editor/editor-state.js +192 -0
  23. package/dist/components/editor/editor-state.js.map +1 -0
  24. package/dist/components/editor/extensions/spoiler.d.ts +8 -0
  25. package/dist/components/editor/extensions/spoiler.d.ts.map +1 -0
  26. package/dist/components/editor/extensions/spoiler.js +36 -0
  27. package/dist/components/editor/extensions/spoiler.js.map +1 -0
  28. package/dist/components/editor/index.d.ts +9 -0
  29. package/dist/components/editor/index.d.ts.map +1 -0
  30. package/dist/components/editor/index.js +9 -0
  31. package/dist/components/editor/index.js.map +1 -0
  32. package/dist/components/editor/kinds.d.ts +99 -0
  33. package/dist/components/editor/kinds.d.ts.map +1 -0
  34. package/dist/components/editor/kinds.js +74 -0
  35. package/dist/components/editor/kinds.js.map +1 -0
  36. package/dist/components/sketch/rough.d.ts +38 -0
  37. package/dist/components/sketch/rough.d.ts.map +1 -0
  38. package/dist/components/sketch/rough.js +57 -0
  39. package/dist/components/sketch/rough.js.map +1 -0
  40. package/dist/components/ui/accent-picker.d.ts +2 -0
  41. package/dist/components/ui/accent-picker.d.ts.map +1 -0
  42. package/dist/components/ui/accent-picker.js +44 -0
  43. package/dist/components/ui/accent-picker.js.map +1 -0
  44. package/dist/components/ui/address-field.d.ts +10 -0
  45. package/dist/components/ui/address-field.d.ts.map +1 -0
  46. package/dist/components/ui/address-field.js +24 -0
  47. package/dist/components/ui/address-field.js.map +1 -0
  48. package/dist/components/ui/app-shell.d.ts +25 -0
  49. package/dist/components/ui/app-shell.d.ts.map +1 -0
  50. package/dist/components/ui/app-shell.js +69 -0
  51. package/dist/components/ui/app-shell.js.map +1 -0
  52. package/dist/components/ui/badge.d.ts +19 -0
  53. package/dist/components/ui/badge.d.ts.map +1 -0
  54. package/dist/components/ui/badge.js +62 -0
  55. package/dist/components/ui/badge.js.map +1 -0
  56. package/dist/components/ui/breadcrumbs.d.ts +10 -0
  57. package/dist/components/ui/breadcrumbs.d.ts.map +1 -0
  58. package/dist/components/ui/breadcrumbs.js +9 -0
  59. package/dist/components/ui/breadcrumbs.js.map +1 -0
  60. package/dist/components/ui/button.d.ts +13 -0
  61. package/dist/components/ui/button.d.ts.map +1 -0
  62. package/dist/components/ui/button.js +45 -0
  63. package/dist/components/ui/button.js.map +1 -0
  64. package/dist/components/ui/calendar.d.ts +5 -0
  65. package/dist/components/ui/calendar.d.ts.map +1 -0
  66. package/dist/components/ui/calendar.js +64 -0
  67. package/dist/components/ui/calendar.js.map +1 -0
  68. package/dist/components/ui/callout.d.ts +13 -0
  69. package/dist/components/ui/callout.d.ts.map +1 -0
  70. package/dist/components/ui/callout.js +27 -0
  71. package/dist/components/ui/callout.js.map +1 -0
  72. package/dist/components/ui/card.d.ts +13 -0
  73. package/dist/components/ui/card.d.ts.map +1 -0
  74. package/dist/components/ui/card.js +27 -0
  75. package/dist/components/ui/card.js.map +1 -0
  76. package/dist/components/ui/checkbox.d.ts +6 -0
  77. package/dist/components/ui/checkbox.d.ts.map +1 -0
  78. package/dist/components/ui/checkbox.js +10 -0
  79. package/dist/components/ui/checkbox.js.map +1 -0
  80. package/dist/components/ui/command-menu.d.ts +15 -0
  81. package/dist/components/ui/command-menu.d.ts.map +1 -0
  82. package/dist/components/ui/command-menu.js +24 -0
  83. package/dist/components/ui/command-menu.js.map +1 -0
  84. package/dist/components/ui/date-picker.d.ts +35 -0
  85. package/dist/components/ui/date-picker.d.ts.map +1 -0
  86. package/dist/components/ui/date-picker.js +56 -0
  87. package/dist/components/ui/date-picker.js.map +1 -0
  88. package/dist/components/ui/date-time-picker.d.ts +19 -0
  89. package/dist/components/ui/date-time-picker.d.ts.map +1 -0
  90. package/dist/components/ui/date-time-picker.js +32 -0
  91. package/dist/components/ui/date-time-picker.js.map +1 -0
  92. package/dist/components/ui/dialog.d.ts +17 -0
  93. package/dist/components/ui/dialog.d.ts.map +1 -0
  94. package/dist/components/ui/dialog.js +33 -0
  95. package/dist/components/ui/dialog.js.map +1 -0
  96. package/dist/components/ui/dropdown-menu.d.ts +20 -0
  97. package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
  98. package/dist/components/ui/dropdown-menu.js +56 -0
  99. package/dist/components/ui/dropdown-menu.js.map +1 -0
  100. package/dist/components/ui/editable-text.d.ts +17 -0
  101. package/dist/components/ui/editable-text.d.ts.map +1 -0
  102. package/dist/components/ui/editable-text.js +68 -0
  103. package/dist/components/ui/editable-text.js.map +1 -0
  104. package/dist/components/ui/field-button.d.ts +14 -0
  105. package/dist/components/ui/field-button.d.ts.map +1 -0
  106. package/dist/components/ui/field-button.js +16 -0
  107. package/dist/components/ui/field-button.js.map +1 -0
  108. package/dist/components/ui/file-preview.d.ts +5 -0
  109. package/dist/components/ui/file-preview.d.ts.map +1 -0
  110. package/dist/components/ui/file-preview.js +66 -0
  111. package/dist/components/ui/file-preview.js.map +1 -0
  112. package/dist/components/ui/file-uploader.d.ts +39 -0
  113. package/dist/components/ui/file-uploader.d.ts.map +1 -0
  114. package/dist/components/ui/file-uploader.js +110 -0
  115. package/dist/components/ui/file-uploader.js.map +1 -0
  116. package/dist/components/ui/handle-row.d.ts +15 -0
  117. package/dist/components/ui/handle-row.d.ts.map +1 -0
  118. package/dist/components/ui/handle-row.js +41 -0
  119. package/dist/components/ui/handle-row.js.map +1 -0
  120. package/dist/components/ui/image-block.d.ts +31 -0
  121. package/dist/components/ui/image-block.d.ts.map +1 -0
  122. package/dist/components/ui/image-block.js +103 -0
  123. package/dist/components/ui/image-block.js.map +1 -0
  124. package/dist/components/ui/image-card.d.ts +17 -0
  125. package/dist/components/ui/image-card.d.ts.map +1 -0
  126. package/dist/components/ui/image-card.js +38 -0
  127. package/dist/components/ui/image-card.js.map +1 -0
  128. package/dist/components/ui/image-viewer.d.ts +31 -0
  129. package/dist/components/ui/image-viewer.d.ts.map +1 -0
  130. package/dist/components/ui/image-viewer.js +81 -0
  131. package/dist/components/ui/image-viewer.js.map +1 -0
  132. package/dist/components/ui/image.d.ts +11 -0
  133. package/dist/components/ui/image.d.ts.map +1 -0
  134. package/dist/components/ui/image.js +32 -0
  135. package/dist/components/ui/image.js.map +1 -0
  136. package/dist/components/ui/index.d.ts +49 -0
  137. package/dist/components/ui/index.d.ts.map +1 -0
  138. package/dist/components/ui/index.js +49 -0
  139. package/dist/components/ui/index.js.map +1 -0
  140. package/dist/components/ui/input.d.ts +16 -0
  141. package/dist/components/ui/input.d.ts.map +1 -0
  142. package/dist/components/ui/input.js +32 -0
  143. package/dist/components/ui/input.js.map +1 -0
  144. package/dist/components/ui/link-block.d.ts +13 -0
  145. package/dist/components/ui/link-block.d.ts.map +1 -0
  146. package/dist/components/ui/link-block.js +21 -0
  147. package/dist/components/ui/link-block.js.map +1 -0
  148. package/dist/components/ui/mac-card.d.ts +15 -0
  149. package/dist/components/ui/mac-card.d.ts.map +1 -0
  150. package/dist/components/ui/mac-card.js +9 -0
  151. package/dist/components/ui/mac-card.js.map +1 -0
  152. package/dist/components/ui/nav-tree.d.ts +16 -0
  153. package/dist/components/ui/nav-tree.d.ts.map +1 -0
  154. package/dist/components/ui/nav-tree.js +34 -0
  155. package/dist/components/ui/nav-tree.js.map +1 -0
  156. package/dist/components/ui/page.d.ts +12 -0
  157. package/dist/components/ui/page.d.ts.map +1 -0
  158. package/dist/components/ui/page.js +15 -0
  159. package/dist/components/ui/page.js.map +1 -0
  160. package/dist/components/ui/popover.d.ts +8 -0
  161. package/dist/components/ui/popover.d.ts.map +1 -0
  162. package/dist/components/ui/popover.js +18 -0
  163. package/dist/components/ui/popover.js.map +1 -0
  164. package/dist/components/ui/progress.d.ts +9 -0
  165. package/dist/components/ui/progress.d.ts.map +1 -0
  166. package/dist/components/ui/progress.js +9 -0
  167. package/dist/components/ui/progress.js.map +1 -0
  168. package/dist/components/ui/property.d.ts +15 -0
  169. package/dist/components/ui/property.d.ts.map +1 -0
  170. package/dist/components/ui/property.js +34 -0
  171. package/dist/components/ui/property.js.map +1 -0
  172. package/dist/components/ui/segmented.d.ts +13 -0
  173. package/dist/components/ui/segmented.d.ts.map +1 -0
  174. package/dist/components/ui/segmented.js +10 -0
  175. package/dist/components/ui/segmented.js.map +1 -0
  176. package/dist/components/ui/select-menu.d.ts +10 -0
  177. package/dist/components/ui/select-menu.d.ts.map +1 -0
  178. package/dist/components/ui/select-menu.js +10 -0
  179. package/dist/components/ui/select-menu.js.map +1 -0
  180. package/dist/components/ui/select.d.ts +11 -0
  181. package/dist/components/ui/select.d.ts.map +1 -0
  182. package/dist/components/ui/select.js +31 -0
  183. package/dist/components/ui/select.js.map +1 -0
  184. package/dist/components/ui/selection-bar.d.ts +12 -0
  185. package/dist/components/ui/selection-bar.d.ts.map +1 -0
  186. package/dist/components/ui/selection-bar.js +15 -0
  187. package/dist/components/ui/selection-bar.js.map +1 -0
  188. package/dist/components/ui/separator.d.ts +4 -0
  189. package/dist/components/ui/separator.d.ts.map +1 -0
  190. package/dist/components/ui/separator.js +12 -0
  191. package/dist/components/ui/separator.js.map +1 -0
  192. package/dist/components/ui/spotlight.d.ts +23 -0
  193. package/dist/components/ui/spotlight.d.ts.map +1 -0
  194. package/dist/components/ui/spotlight.js +107 -0
  195. package/dist/components/ui/spotlight.js.map +1 -0
  196. package/dist/components/ui/stat-tile.d.ts +8 -0
  197. package/dist/components/ui/stat-tile.d.ts.map +1 -0
  198. package/dist/components/ui/stat-tile.js +9 -0
  199. package/dist/components/ui/stat-tile.js.map +1 -0
  200. package/dist/components/ui/step-dialog.d.ts +20 -0
  201. package/dist/components/ui/step-dialog.d.ts.map +1 -0
  202. package/dist/components/ui/step-dialog.js +36 -0
  203. package/dist/components/ui/step-dialog.js.map +1 -0
  204. package/dist/components/ui/table.d.ts +8 -0
  205. package/dist/components/ui/table.d.ts.map +1 -0
  206. package/dist/components/ui/table.js +23 -0
  207. package/dist/components/ui/table.js.map +1 -0
  208. package/dist/components/ui/theme-toggle.d.ts +2 -0
  209. package/dist/components/ui/theme-toggle.d.ts.map +1 -0
  210. package/dist/components/ui/theme-toggle.js +49 -0
  211. package/dist/components/ui/theme-toggle.js.map +1 -0
  212. package/dist/components/ui/time-picker.d.ts +21 -0
  213. package/dist/components/ui/time-picker.d.ts.map +1 -0
  214. package/dist/components/ui/time-picker.js +63 -0
  215. package/dist/components/ui/time-picker.js.map +1 -0
  216. package/dist/components/ui/tooltip.d.ts +15 -0
  217. package/dist/components/ui/tooltip.d.ts.map +1 -0
  218. package/dist/components/ui/tooltip.js +21 -0
  219. package/dist/components/ui/tooltip.js.map +1 -0
  220. package/dist/components/ui/typography.d.ts +34 -0
  221. package/dist/components/ui/typography.d.ts.map +1 -0
  222. package/dist/components/ui/typography.js +72 -0
  223. package/dist/components/ui/typography.js.map +1 -0
  224. package/dist/components/ui/video-block.d.ts +14 -0
  225. package/dist/components/ui/video-block.d.ts.map +1 -0
  226. package/dist/components/ui/video-block.js +18 -0
  227. package/dist/components/ui/video-block.js.map +1 -0
  228. package/dist/hooks/use-save-queue.d.ts +13 -0
  229. package/dist/hooks/use-save-queue.d.ts.map +1 -0
  230. package/dist/hooks/use-save-queue.js +45 -0
  231. package/dist/hooks/use-save-queue.js.map +1 -0
  232. package/dist/hooks/use-selection.d.ts +10 -0
  233. package/dist/hooks/use-selection.d.ts.map +1 -0
  234. package/dist/hooks/use-selection.js +43 -0
  235. package/dist/hooks/use-selection.js.map +1 -0
  236. package/dist/hooks/use-shared-transition.d.ts +3 -0
  237. package/dist/hooks/use-shared-transition.d.ts.map +1 -0
  238. package/dist/hooks/use-shared-transition.js +38 -0
  239. package/dist/hooks/use-shared-transition.js.map +1 -0
  240. package/dist/hooks/use-upload-queue.d.ts +22 -0
  241. package/dist/hooks/use-upload-queue.d.ts.map +1 -0
  242. package/dist/hooks/use-upload-queue.js +78 -0
  243. package/dist/hooks/use-upload-queue.js.map +1 -0
  244. package/dist/lib/accent.d.ts +5 -0
  245. package/dist/lib/accent.d.ts.map +1 -0
  246. package/dist/lib/accent.js +10 -0
  247. package/dist/lib/accent.js.map +1 -0
  248. package/dist/lib/bento.d.ts +17 -0
  249. package/dist/lib/bento.d.ts.map +1 -0
  250. package/dist/lib/bento.js +92 -0
  251. package/dist/lib/bento.js.map +1 -0
  252. package/dist/lib/dates.d.ts +14 -0
  253. package/dist/lib/dates.d.ts.map +1 -0
  254. package/dist/lib/dates.js +34 -0
  255. package/dist/lib/dates.js.map +1 -0
  256. package/dist/lib/document.d.ts +79 -0
  257. package/dist/lib/document.d.ts.map +1 -0
  258. package/dist/lib/document.js +11 -0
  259. package/dist/lib/document.js.map +1 -0
  260. package/dist/lib/embed.d.ts +14 -0
  261. package/dist/lib/embed.d.ts.map +1 -0
  262. package/dist/lib/embed.js +63 -0
  263. package/dist/lib/embed.js.map +1 -0
  264. package/dist/lib/files.d.ts +23 -0
  265. package/dist/lib/files.d.ts.map +1 -0
  266. package/dist/lib/files.js +69 -0
  267. package/dist/lib/files.js.map +1 -0
  268. package/dist/lib/justified.d.ts +50 -0
  269. package/dist/lib/justified.d.ts.map +1 -0
  270. package/dist/lib/justified.js +78 -0
  271. package/dist/lib/justified.js.map +1 -0
  272. package/dist/lib/rich-text-dom.d.ts +14 -0
  273. package/dist/lib/rich-text-dom.d.ts.map +1 -0
  274. package/dist/lib/rich-text-dom.js +143 -0
  275. package/dist/lib/rich-text-dom.js.map +1 -0
  276. package/dist/lib/rich-text.d.ts +15 -0
  277. package/dist/lib/rich-text.d.ts.map +1 -0
  278. package/dist/lib/rich-text.js +35 -0
  279. package/dist/lib/rich-text.js.map +1 -0
  280. package/dist/lib/spotlight.d.ts +22 -0
  281. package/dist/lib/spotlight.d.ts.map +1 -0
  282. package/dist/lib/spotlight.js +66 -0
  283. package/dist/lib/spotlight.js.map +1 -0
  284. package/dist/lib/tree.d.ts +17 -0
  285. package/dist/lib/tree.d.ts.map +1 -0
  286. package/dist/lib/tree.js +35 -0
  287. package/dist/lib/tree.js.map +1 -0
  288. package/dist/lib/utils.d.ts +3 -0
  289. package/dist/lib/utils.d.ts.map +1 -0
  290. package/dist/lib/utils.js +6 -0
  291. package/dist/lib/utils.js.map +1 -0
  292. package/dist/styles/notion.css +526 -0
  293. package/package.json +106 -5
  294. package/src/components/editor/block-text.tsx +230 -0
  295. package/src/components/editor/blocks.tsx +368 -0
  296. package/src/components/editor/document-editor.tsx +101 -0
  297. package/src/components/editor/document-view.tsx +192 -0
  298. package/src/components/editor/editor-state.tsx +270 -0
  299. package/src/components/editor/extensions/spoiler.tsx +76 -0
  300. package/src/components/editor/index.ts +9 -0
  301. package/src/components/editor/kinds.ts +158 -0
  302. package/src/components/sketch/rough.tsx +90 -0
  303. package/src/components/ui/accent-picker.tsx +72 -0
  304. package/src/components/ui/address-field.tsx +57 -0
  305. package/src/components/ui/app-shell.tsx +138 -0
  306. package/src/components/ui/badge.tsx +81 -0
  307. package/src/components/ui/breadcrumbs.tsx +25 -0
  308. package/src/components/ui/button.tsx +73 -0
  309. package/src/components/ui/calendar.tsx +100 -0
  310. package/src/components/ui/callout.tsx +62 -0
  311. package/src/components/ui/card.tsx +90 -0
  312. package/src/components/ui/checkbox.tsx +32 -0
  313. package/src/components/ui/command-menu.tsx +72 -0
  314. package/src/components/ui/date-picker.tsx +170 -0
  315. package/src/components/ui/date-time-picker.tsx +117 -0
  316. package/src/components/ui/dialog.tsx +124 -0
  317. package/src/components/ui/dropdown-menu.tsx +183 -0
  318. package/src/components/ui/editable-text.tsx +109 -0
  319. package/src/components/ui/field-button.tsx +68 -0
  320. package/src/components/ui/file-preview.tsx +80 -0
  321. package/src/components/ui/file-uploader.tsx +376 -0
  322. package/src/components/ui/handle-row.tsx +116 -0
  323. package/src/components/ui/image-block.tsx +238 -0
  324. package/src/components/ui/image-card.tsx +102 -0
  325. package/src/components/ui/image-viewer.tsx +187 -0
  326. package/src/components/ui/image.tsx +96 -0
  327. package/src/components/ui/index.ts +83 -0
  328. package/src/components/ui/input.tsx +99 -0
  329. package/src/components/ui/link-block.tsx +82 -0
  330. package/src/components/ui/mac-card.tsx +46 -0
  331. package/src/components/ui/nav-tree.tsx +86 -0
  332. package/src/components/ui/page.tsx +25 -0
  333. package/src/components/ui/popover.tsx +42 -0
  334. package/src/components/ui/progress.tsx +36 -0
  335. package/src/components/ui/property.tsx +64 -0
  336. package/src/components/ui/segmented.tsx +42 -0
  337. package/src/components/ui/select-menu.tsx +46 -0
  338. package/src/components/ui/select.tsx +124 -0
  339. package/src/components/ui/selection-bar.tsx +50 -0
  340. package/src/components/ui/separator.tsx +30 -0
  341. package/src/components/ui/spotlight.tsx +222 -0
  342. package/src/components/ui/stat-tile.tsx +25 -0
  343. package/src/components/ui/step-dialog.tsx +104 -0
  344. package/src/components/ui/table.tsx +42 -0
  345. package/src/components/ui/theme-toggle.tsx +101 -0
  346. package/src/components/ui/time-picker.tsx +173 -0
  347. package/src/components/ui/tooltip.tsx +64 -0
  348. package/src/components/ui/typography.tsx +168 -0
  349. package/src/components/ui/video-block.tsx +60 -0
  350. package/src/hooks/use-save-queue.ts +66 -0
  351. package/src/hooks/use-selection.ts +44 -0
  352. package/src/hooks/use-shared-transition.ts +40 -0
  353. package/src/hooks/use-upload-queue.ts +111 -0
  354. package/src/lib/accent.ts +11 -0
  355. package/src/lib/bento.ts +87 -0
  356. package/src/lib/dates.ts +39 -0
  357. package/src/lib/document.ts +55 -0
  358. package/src/lib/embed.ts +62 -0
  359. package/src/lib/files.ts +73 -0
  360. package/src/lib/justified.ts +106 -0
  361. package/src/lib/rich-text-dom.ts +136 -0
  362. package/src/lib/rich-text.ts +50 -0
  363. package/src/lib/spotlight.ts +78 -0
  364. package/src/lib/tree.ts +41 -0
  365. package/src/lib/utils.ts +6 -0
  366. package/src/styles/notion.css +526 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # @kujoforall/paper-ui
2
+
3
+ ## 0.1.0
4
+
5
+ First release as a package: the kit as it stood on 2026-12-05, built with `tsc` to one module per file, with `"use client"` kept, type declarations, source maps and the original source.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nandan Patel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,253 @@
1
- # Temporary Holding Version
1
+ # Paper UI
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `@kujoforall/paper-ui`: a Notion-flavoured component set. Radix primitives for
4
+ behaviour, Tailwind v4 for tokens, published to npm so every app uses one copy.
5
+
6
+ ```bash
7
+ npm install && npm run dev # the showcase → http://localhost:5173
8
+ ```
9
+
10
+ ## The three ideas
11
+
12
+ **One ink, many alphas.** There is no grey ramp. Secondary text, borders,
13
+ dividers and hover tints are all `#37352f` — a warm brown-black, never pure
14
+ `#000` — at different opacities. That single rule is why nothing in the system
15
+ clashes, and it halves the token count.
16
+
17
+ | Token | Light | Role |
18
+ | --- | --- | --- |
19
+ | `--ink` | `#37352f` | body text |
20
+ | `--ink-secondary` | 65% | supporting copy |
21
+ | `--ink-tertiary` | 50% | placeholders, captions |
22
+ | `--hairline` | 9% | dividers |
23
+ | `--hairline-strong` | 16% | field borders |
24
+ | `--tint-hover` | 5.5% | hover ground |
25
+ | `--accent` | `#2383e2` | the one colour an accent theme sets |
26
+ | `--accent-text` | mixed | the accent pulled toward the ink, for titles and markers |
27
+
28
+ **Shadows start with a 1px ring.** Every elevation token leads with
29
+ `0 0 0 1px rgb(15 15 15 / .05)` before any blur. The ring is what keeps a white
30
+ popover crisp against a white page; diffuse blur alone reads as mush. Dark mode
31
+ inverts the logic — a *lighter* ring separates, a *heavier* drop lifts.
32
+
33
+ ```
34
+ --shadow-popover:
35
+ 0 0 0 1px rgb(15 15 15 / .05), /* ring: the separator */
36
+ 0 3px 6px rgb(15 15 15 / .10), /* contact shadow */
37
+ 0 9px 24px rgb(15 15 15 / .20); /* ambient lift */
38
+ ```
39
+
40
+ **Nine pastels, no picker.** Each is a tinted ground plus same-hue ink, all at
41
+ low chroma, so forty tags on one board still read calm. A user cannot pick an
42
+ ugly combination because they cannot pick an arbitrary one. Resist a tenth.
43
+
44
+ ```tsx
45
+ <Badge color="blue">Design</Badge>
46
+ <Badge color={tagColorFor(user.id)}>{user.name}</Badge> // stable, unchosen
47
+ ```
48
+
49
+ **One accent, seven themes.** Light and dark decide the surfaces; the accent
50
+ decides which colour titles, markers and controls take. A theme is one line,
51
+ `[data-accent="green"] { --accent: #448361; }`, and hover, tint, focus ring and
52
+ `--accent-text` are mixed from it. The hues are the tag inks, so an accent never
53
+ clashes with a badge beside it. `AccentPicker` sets `data-accent` on `<html>` and
54
+ remembers it.
55
+
56
+ ## Testing
57
+
58
+ ```bash
59
+ npm test # vitest, in jsdom
60
+ ```
61
+
62
+ The tests check behaviour and accessibility, not pixels: what each component
63
+ renders, what it reports, and how it answers the keyboard. The layouts in `lib`
64
+ are checked as pure functions. Looking at the showcase is still how a change to
65
+ the look is checked.
66
+
67
+ ## Using it in an app
68
+
69
+ ```bash
70
+ npm install @kujoforall/paper-ui
71
+ ```
72
+
73
+ The app needs React 19 and Tailwind 4. Its stylesheet imports Tailwind, then the
74
+ kit's, which carries the tokens and tells Tailwind where the kit's classes are:
75
+
76
+ ```css
77
+ @import "tailwindcss";
78
+ @import "@kujoforall/paper-ui/styles.css";
79
+ ```
80
+
81
+ | Import | Holds |
82
+ | --- | --- |
83
+ | `@kujoforall/paper-ui` | every component in `src/components/ui` |
84
+ | `@kujoforall/paper-ui/editor` | `DocumentEditor`, `DocumentView` and what an extension is built from |
85
+ | `@kujoforall/paper-ui/sketch` | the hand-drawn shapes (roughjs) |
86
+ | `@kujoforall/paper-ui/hooks/<name>` | a hook from `src/hooks`, e.g. `hooks/use-selection` |
87
+ | `@kujoforall/paper-ui/lib/<name>` | a helper from `src/lib`, e.g. `lib/utils` (`cn`), `lib/rich-text` |
88
+ | `@kujoforall/paper-ui/styles.css` | the stylesheet |
89
+
90
+ The package is one module per source file, so an app's bundle holds only what it
91
+ imports. Components carry `"use client"`, so a Next server component can render
92
+ them. The source ships beside the build, so go-to-definition and stack traces
93
+ land in the kit's own code.
94
+
95
+ Dark mode is class-based (`<html class="dark">`). `index.html` has the
96
+ before-paint script that prevents a flash, for the theme and for the accent; port
97
+ it if you leave Vite. In Next, `next-themes` handles the theme and
98
+ `ACCENT_INIT_SCRIPT` from `lib/accent` goes in a `<script>` in the root layout's
99
+ `<head>`. The hand-drawn font is Caveat, loaded by the app (it sets
100
+ `--font-caveat`, or a `<link>` works).
101
+
102
+ Things that take a link (`NavTree`, `Breadcrumbs`) accept your router's link
103
+ component as `link` and default to a plain `<a>`. `EditableText` reports clicks on
104
+ links and page mentions through `onLink`. Nothing here imports a router.
105
+
106
+ ## Releasing
107
+
108
+ ```bash
109
+ npx changeset # say what changed and whether it is a patch, minor or major
110
+ ```
111
+
112
+ Commit the changeset with the change. When it reaches `main`, the Release
113
+ workflow opens a "Version packages" pull request that bumps the version and
114
+ writes `CHANGELOG.md`; merging that publishes to npm. Every pull request runs CI:
115
+ typecheck, tests, the package build, and `npm run smoke`.
116
+
117
+ `npm run smoke` packs the package as npm would publish it, installs it into a
118
+ fresh Vite 8 app and a fresh Next 16 app, typechecks and builds both, and checks
119
+ the kit's tokens and classes reach their CSS. `--keep` leaves the apps to look
120
+ at; `--version 0.2.0` tests a version already on the registry instead.
121
+
122
+ Inside the kit, imports are relative and written with their `.ts`/`.tsx`
123
+ extension (`tsc` rewrites them to `.js`); the showcase may use `@/`, the
124
+ published folders may not. `npm run build:lib` builds `dist/`,
125
+ `npm run dev:lib` rebuilds it on every change, and `npm run build:site` builds
126
+ the showcase into `site/`.
127
+
128
+ ## Extending
129
+
130
+ Three escape hatches, in order of preference.
131
+
132
+ 1. **Retheme** — change the ~40 custom properties in `:root` / `.dark`. Nothing
133
+ downstream hardcodes a colour, so the set re-skins wholesale.
134
+ 2. **Override per-instance** — every component takes `className` and merges it
135
+ through `tailwind-merge`, so `<Button className="h-12 rounded-full">` wins
136
+ over the variant.
137
+ 3. **Add a variant** — extend the `cva` config in the component file. You own
138
+ these files; there is no package to fight.
139
+
140
+ `asChild` is available on `Button` and the Radix triggers for composition
141
+ without wrapper elements.
142
+
143
+ ## Conventions worth keeping
144
+
145
+ - **Exactly one `primary` button per view.** The accent fill is the loudest
146
+ thing the system does. Two of them and neither reads as the next step.
147
+ - **Hover is a tint, never a border.** A border appearing on hover shifts
148
+ layout and draws a box the design didn't ask for.
149
+ - **Hierarchy from type and space only.** No coloured section bars, no rules
150
+ above headings, no boxes to group things that whitespace already groups.
151
+ - **Use the `affordance` utility for row actions.** Put `group` on the row and
152
+ `affordance` on the control: it is invisible until hover, but still reachable
153
+ by keyboard (it reveals on `focus-visible` and `focus-within`).
154
+ - **Keep motion under 200ms.** Overlays fade at 120–140ms with a 2% scale.
155
+ Nothing springs. Past 200ms it stops feeling like feedback and starts
156
+ feeling like latency.
157
+ - **Respect the measure.** The `measure` utility caps text at 44rem. Long
158
+ lines are the fastest way to make a clean design feel cheap.
159
+
160
+ ## Patterns
161
+
162
+ Beyond single components, the kit carries the patterns a Notion-like app is made
163
+ of. They were extracted from a real one (`~/projects/web-apps/endgame`), which is
164
+ the place to look for each of them used in anger.
165
+
166
+ | Pattern | Where | What it gives you |
167
+ | --- | --- | --- |
168
+ | App frame | `AppShell`, `SidebarFrame`, `SidebarSection` | Collapsing sidebar (`⌘\`), a drawer on small screens, and a `main` that is a container, so pages size to the room they have |
169
+ | Navigation | `NavTree`, `Breadcrumbs` | A nested tree with coloured icons and the active entry in the accent |
170
+ | Records | `PropertyList`, `Property`, `QuietInput`, `NumberInput`, `SelectMenu` | A record's fields with no boxes until hovered; a number that commits on blur |
171
+ | Data | `Table`, `Th`, `Td`, `ClickableRow`, `StatTile`, `Progress` | A table that scrolls in its own box; headline figures; "n of m" with an action |
172
+ | Editing | `EditableText`, `lib/rich-text`, `lib/rich-text-dom` | Rich text edited in place over a JSON span model, with caret helpers |
173
+ | Commands | `CommandMenu` | The "/" menu: anchored to the caret, never takes focus |
174
+ | Jumping | `Spotlight`, `useSpotlightShortcut`, `lib/spotlight` | ⌘K search over every place to go: each typed word must match, label matches rank first, typed letters are picked out |
175
+ | Block rows | `HandleRow` | Hover controls in the margin: add below, drag to move, click for a menu |
176
+ | Trees | `lib/tree` | Pure locate / insert / update / remove on `{ id, children }` |
177
+ | Saving | `hooks/use-save-queue` | Optimistic saves: debounced per key, sent in order, flushed on page hide |
178
+ | Sketches | `components/sketch/rough` | rough.js strokes in the kit's colours: `RoughBox`, `RoughPaths` |
179
+
180
+ A third, a trip planner (`~/projects/web-apps/triptrack`), added these:
181
+
182
+ | Pattern | Where | What it gives you |
183
+ | --- | --- | --- |
184
+ | Pictures in documents | `ImageBlock` | A picture as a block: chosen, dropped, pasted or linked when empty; centred, sized by dragging its sides (or the arrow keys), with a caption under it. It holds no upload logic |
185
+ | Videos and links in documents | `VideoBlock`, `LinkBlock`, `AddressField`, `lib/embed` | A YouTube or Vimeo video played in place, sandboxed and from YouTube's no-cookie domain; a web page as a card with a typed name. Empty, each asks for its link and says why one will not do. `lib/embed` checks addresses the same way on a server |
186
+
187
+ A second app, a photo library (`~/projects/web-apps/vault`), added these:
188
+
189
+ | Pattern | Where | What it gives you |
190
+ | --- | --- | --- |
191
+ | Images | `Image` | A picture that holds its shape, shows a blurred stand-in, then fades in; one already cached is shown at once |
192
+ | Image cards | `ImageCard`, `ImageCardButton`, `ImageCardBadge` | A picture as a card, with controls and markers on its corners that read on any photo, and a picked state |
193
+ | Carousel | `ImageViewer` | One picture at a time at full size: arrow keys, a slide from the side each came from, neighbours fetched ahead, a toolbar and a sliding side panel |
194
+ | Shared transition | `hooks/use-shared-transition` | Growing a thumbnail into the full view and back with View Transitions, by saying which one element carries the name |
195
+ | Multi-step dialog | `StepDialog`, `Stepper` | A dialog several steps long that keeps one size and slides each step in |
196
+ | Selection | `hooks/use-selection`, `SelectionBar` | Picking several things, a run of them with Shift, and a bar of what to do with them |
197
+ | Views of a panel | `Segmented` | Two or three views chosen like tabs |
198
+ | Page frame | `Page`, `PageHeader` | One width and one title size for every page of an app |
199
+ | File previews | `FilePreview` · `FileUploader` / `FileDropArea` | A cheap picture of an image file before it is uploaded |
200
+ | Uploading | `FileUploader`, `FileDropArea`, `hooks/use-upload-queue`, `lib/files` | A four-step upload dialog around a function you supply that sends one file: drop area, folders, previews, validation, a few at a time, retry, summary. `single` makes it take one file, for a thing that has one picture |
201
+ | Picture layouts | `lib/justified` | `justify()` for rows that fill the width, `masonry()` for columns, with heights known before drawing |
202
+ | Bento | `lib/bento` | `bento()` packs pictures into a grid of cells with no holes: each asks for a span, and a gap goes to the neighbour it crops least |
203
+ | Colour themes | `AccentPicker`, `lib/accent`, `[data-accent]` in `notion.css` | Paper, or one of seven colours that sets the accent and washes every surface with it, so the background matches |
204
+ | Pickers | `Select`, `DatePicker`, `DateRangePicker`, `TimePicker`, `DateTimePicker`, `Calendar`, `Popover`, `FieldButton`, `lib/dates` | Fields you press rather than type in: one of a list, a day, a first and last day, a time, a day with a time. Each rests as the same well as `Input` and holds a plain string |
205
+ | Sidebar from anywhere | `toggleSidebar()`, `--sidebar-w` | Opening the shell's sidebar from outside it, and laying things out around it |
206
+
207
+ Three things learned the hard way, kept as comments where they apply:
208
+
209
+ - **Centre with `translate`, animate with `transform`.** Tailwind v4's
210
+ `-translate-x-1/2` sets the `translate` property. A keyframe that also translates
211
+ moves the element twice, and a dialog visibly jumps on open.
212
+ - **Do not mix a custom size class and a colour in one `cn()`.** tailwind-merge
213
+ cannot tell `text-h2` from a text colour and keeps only one. Put the colour on
214
+ another element, or outside `cn`.
215
+ - **Draw rough.js in the browser only.** Its arithmetic rounds differently in Node,
216
+ and hydration rejects the difference.
217
+ - **In dark mode `surface-raised` and `surface-sunken` are the same colour.** One drawn
218
+ on the other vanishes. Where something must show against whatever is under it, use
219
+ a tint (`bg-tint-active`) or `surface-overlay`.
220
+ - **Controls on top of a picture are white on a dark disc in both themes.** They have
221
+ to read against the picture, not the page. Everything else, tooltips included,
222
+ follows the theme.
223
+ - **Hide work in progress from a list; do not show a placeholder that will move.** An
224
+ item that appears in one place and jumps to another reads as a glitch. Let it
225
+ arrive once, where it belongs.
226
+ - **A calendar in a popover in a dialog has to be given focus by the popover.** The
227
+ calendar's own `autoFocus` fires before the popover has taken over the dialog's
228
+ focus trap, and the dialog pulls focus back. `focusCalendarDay` on
229
+ `onOpenAutoFocus` does it at the right moment.
230
+ - **Several states on one element are resolved in `cn()`, not as sibling classes.**
231
+ A day can be today, outside the month and chosen at once. Which class wins as CSS
232
+ depends on the order the stylesheet was built in; in `cn()` the last one named wins.
233
+ - **A date in a form is a string, never a `Date` built from one.**
234
+ `new Date("2027-01-12")` is midnight in Greenwich and the day before for anyone west
235
+ of it. `lib/dates` builds local days from the parts.
236
+ - **A callback passed to `mutate()` is dropped if its component unmounts.** Anything
237
+ that must happen after a delete that removes the page itself, such as navigating
238
+ away, belongs in the hook's own `onSuccess`.
239
+
240
+ ## What's here
241
+
242
+ `Button` · `Input` / `Textarea` / `Label` / `Field` · `Card` · `Badge` ·
243
+ `Callout` · `Dialog` · `DropdownMenu` · `Tooltip` · `Separator` ·
244
+ `Heading` / `Text` / `Code` / `Kbd` / `Prose` · `ThemeToggle` · `MacCard` ·
245
+ `Checkbox` · `SelectMenu` · `AccentPicker` · `Table` · `StatTile` · `Progress` ·
246
+ `Property` · `Breadcrumbs` · `NavTree` · `AppShell` · `EditableText` ·
247
+ `CommandMenu` · `Spotlight` · `HandleRow` · `RoughBox` · `Image` · `ImageCard` · `ImageViewer` ·
248
+ `StepDialog` / `Stepper` · `SelectionBar` · `Segmented` · `Page` / `PageHeader` ·
249
+ `FilePreview` · `FileUploader` / `FileDropArea` · `VideoBlock` · `LinkBlock` · `AddressField` · `Popover` · `FieldButton` ·
250
+ `Select` · `Calendar` · `DatePicker` / `DateRangePicker` · `TimePicker` ·
251
+ `DateTimePicker`
252
+
253
+ Not yet built: Radio, Switch, Tabs, Toast, Avatar, a multi-select.
@@ -0,0 +1,8 @@
1
+ import { type TextNode } from "./kinds.js";
2
+ export declare function BlockText({ block, placeholder, alwaysShowPlaceholder, className, }: {
3
+ block: TextNode;
4
+ placeholder?: string;
5
+ alwaysShowPlaceholder?: boolean;
6
+ className?: string;
7
+ }): import("react").JSX.Element;
8
+ //# sourceMappingURL=block-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block-text.d.ts","sourceRoot":"","sources":["../../../src/components/editor/block-text.tsx"],"names":[],"mappings":"AAQA,OAAO,EAA8D,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAWvG,wBAAgB,SAAS,CAAC,EACtB,KAAK,EACL,WAAW,EACX,qBAAqB,EACrB,SAAS,GACZ,EAAE;IACC,KAAK,EAAE,QAAQ,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,+BAwMA"}
@@ -0,0 +1,213 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { CommandMenu } from "../ui/command-menu.js";
5
+ import { caretOffset, caretOnEdgeLine, caretRect } from "../../lib/rich-text-dom.js";
6
+ import { EditableText } from "../ui/editable-text.js";
7
+ import { useEditor } from "./editor-state.js";
8
+ import { hasText, isListType } from "./kinds.js";
9
+ import { cut, normalize, plain, split } from "../../lib/rich-text.js";
10
+ import { flat, locate } from "../../lib/tree.js";
11
+ /* The text of one block, with the keyboard behaviour that makes a column of
12
+ separate elements feel like one document: Enter splits, Backspace at the start
13
+ joins, Tab nests, arrows cross block edges, "/" opens the list of blocks.
14
+ Pictures, videos, cards and dividers above or below are selected by Backspace,
15
+ Delete and the arrows, as in Notion (see editor-state). */
16
+ export function BlockText({ block, placeholder, alwaysShowPlaceholder, className, }) {
17
+ const ed = useEditor();
18
+ const { schema } = ed;
19
+ const kind = (key) => schema.kind(key);
20
+ const [slash, setSlash] = useState(null);
21
+ const matches = slash ? schema.kinds.filter((k) => k.label.toLowerCase().includes(slash.query.toLowerCase())) : [];
22
+ const place = locate(ed.blocks, block.id);
23
+ const parentId = place.parent?.id ?? null;
24
+ const setText = (text) => ed.edit(block.id, (b) => ({ ...b, text }), { rewrite: true });
25
+ // Makes this block a `to` block holding `text`, or, where that is impossible,
26
+ // keeps it and adds the new block below.
27
+ const turnInto = (to, text) => {
28
+ const made = to.make(text);
29
+ const empty = plain(text) === "" && block.children.length === 0;
30
+ if (!("text" in made)) {
31
+ setText(text);
32
+ // An extension that can take the caret (a table's first cell) gets it; the kit's own
33
+ // pictures, videos and cards keep it in their address field instead.
34
+ const id = ed.create(parentId, block.id, made, { focus: schema.extension(made.type)?.focus !== undefined });
35
+ if (empty)
36
+ ed.remove(block.id);
37
+ // A divider leaves the writing to go on below it.
38
+ if (made.type === "divider")
39
+ ed.create(parentId, id, { type: "paragraph", text: [] }, { focus: true });
40
+ }
41
+ else if (block.children.some((child) => !schema.holds(made.type, child.type))) {
42
+ setText(text);
43
+ ed.create(parentId, block.id, to.make([]), { focus: true });
44
+ }
45
+ else {
46
+ ed.edit(block.id, (b) => ({ ...made, id: b.id, children: b.children }), { rewrite: true });
47
+ ed.focus(block.id, "end");
48
+ }
49
+ };
50
+ const onChange = (text, el) => {
51
+ const typed = plain(text);
52
+ const shortcut = schema.shortcuts[typed];
53
+ if (shortcut && schema.kind(shortcut) && schema.kindOf(block)?.key !== shortcut)
54
+ return turnInto(kind(shortcut), []);
55
+ ed.edit(block.id, (b) => ({ ...b, text }), { typing: true });
56
+ const caret = caretOffset(el);
57
+ if (caret === null)
58
+ return setSlash(null);
59
+ if (slash) {
60
+ const query = typed.slice(slash.from + 1, caret);
61
+ setSlash(caret <= slash.from || typed[slash.from] !== "/" || /\s/.test(query) ? null : { ...slash, query, index: 0 });
62
+ }
63
+ else if (typed[caret - 1] === "/" && (caret === 1 || /\s/.test(typed[caret - 2] ?? ""))) {
64
+ const rect = caretRect();
65
+ if (rect)
66
+ setSlash({ from: caret - 1, query: "", index: 0, rect });
67
+ }
68
+ };
69
+ const pick = (to) => {
70
+ if (!slash)
71
+ return;
72
+ const rest = cut(block.text, slash.from, slash.from + 1 + slash.query.length);
73
+ setSlash(null);
74
+ if (plain(rest) === "")
75
+ turnInto(to, []);
76
+ else {
77
+ setText(rest);
78
+ ed.create(parentId, block.id, to.make([]), { focus: true });
79
+ }
80
+ };
81
+ function outdent(caret) {
82
+ if (!place.parent)
83
+ return;
84
+ const grand = locate(ed.blocks, place.parent.id).parent;
85
+ ed.move(block.id, grand?.id ?? null, place.parent.id);
86
+ ed.focus(block.id, caret);
87
+ }
88
+ const onKeyDown = (e) => {
89
+ if (slash && matches.length > 0) {
90
+ const step = e.key === "ArrowDown" ? 1 : e.key === "ArrowUp" ? -1 : 0;
91
+ if (step) {
92
+ e.preventDefault();
93
+ setSlash({ ...slash, index: (slash.index + step + matches.length) % matches.length });
94
+ return;
95
+ }
96
+ if (e.key === "Enter") {
97
+ e.preventDefault();
98
+ pick(matches[slash.index]);
99
+ return;
100
+ }
101
+ }
102
+ if (e.key === "Escape")
103
+ return setSlash(null);
104
+ const caret = caretOffset(e.currentTarget);
105
+ const length = plain(block.text).length;
106
+ if (e.key === "Enter" && !e.shiftKey) {
107
+ e.preventDefault();
108
+ if (caret === null)
109
+ return;
110
+ // Enter on an empty list item, heading or quote backs out of it, one level at a time.
111
+ if (length === 0 && block.type !== "paragraph" && block.children.length === 0) {
112
+ if (place.parent)
113
+ outdent(0);
114
+ else
115
+ turnInto(kind("text"), []);
116
+ return;
117
+ }
118
+ // An empty last line inside a toggle steps back out of it, as Notion's do.
119
+ if (length === 0 && block.type === "paragraph" && place.parent !== null && schema.toggle(place.parent.type) && place.index === place.siblings.length - 1) {
120
+ outdent(0);
121
+ return;
122
+ }
123
+ const [before, after] = split(block.text, caret);
124
+ const next = block.type === "check"
125
+ ? { type: "check", checked: false, text: after }
126
+ : isListType(block.type)
127
+ ? { type: block.type, text: after }
128
+ : { type: "paragraph", text: after };
129
+ setText(before);
130
+ // A toggle's own line names it; what Enter starts goes inside it.
131
+ if (schema.toggle(block.type))
132
+ ed.create(block.id, null, next, { focus: true });
133
+ // With children, the new item goes first among them, where the caret appears to be.
134
+ else if (block.children.length > 0)
135
+ ed.create(block.id, null, next, { focus: true });
136
+ else
137
+ ed.create(parentId, block.id, next, { focus: true });
138
+ return;
139
+ }
140
+ if (e.key === "Backspace" && caret === 0 && window.getSelection()?.isCollapsed) {
141
+ if (block.type !== "paragraph") {
142
+ e.preventDefault();
143
+ if (block.children.length === 0)
144
+ turnInto(kind("text"), block.text);
145
+ return;
146
+ }
147
+ const order = flat(ed.blocks);
148
+ const prev = order[order.findIndex((b) => b.id === block.id) - 1];
149
+ if (!prev)
150
+ return;
151
+ e.preventDefault();
152
+ if (!hasText(prev)) {
153
+ // As in Notion: an empty line goes, and the picture or card above is
154
+ // selected; a second Backspace removes that. A line with words keeps them.
155
+ if (length === 0)
156
+ ed.remove(block.id);
157
+ ed.select(prev.id);
158
+ return;
159
+ }
160
+ const joinAt = plain(prev.text).length;
161
+ ed.edit(prev.id, (b) => ({ ...b, text: normalize([...prev.text, ...block.text]) }), { rewrite: true });
162
+ ed.remove(block.id);
163
+ ed.focus(prev.id, joinAt);
164
+ return;
165
+ }
166
+ if (e.key === "Tab") {
167
+ e.preventDefault();
168
+ if (e.shiftKey)
169
+ outdent(caret ?? "end");
170
+ else {
171
+ const above = place.siblings[place.index - 1];
172
+ if (!above || !schema.holds(above.type, block.type))
173
+ return;
174
+ ed.move(block.id, above.id, above.children.at(-1)?.id ?? null);
175
+ ed.focus(block.id, caret ?? "end");
176
+ }
177
+ return;
178
+ }
179
+ // Delete at the end of a line takes in what follows: the next line's words,
180
+ // or, when a picture or card is next, selects it to be deleted.
181
+ if (e.key === "Delete" && caret === length && window.getSelection()?.isCollapsed) {
182
+ const order = flat(ed.blocks);
183
+ const next = order[order.findIndex((b) => b.id === block.id) + 1];
184
+ if (next === undefined || block.children.length > 0)
185
+ return;
186
+ e.preventDefault();
187
+ if (!hasText(next))
188
+ return ed.select(next.id);
189
+ if (next.children.length > 0)
190
+ return;
191
+ ed.edit(block.id, (b) => ({ ...b, text: normalize([...block.text, ...next.text]) }), { rewrite: true });
192
+ ed.remove(next.id);
193
+ ed.focus(block.id, length);
194
+ return;
195
+ }
196
+ // The arrows move through every block, landing on pictures and cards too. They
197
+ // leave from anywhere on a block's first or last line, not only its very ends.
198
+ if ((e.key === "ArrowUp" && (caret === 0 || caretOnEdgeLine(e.currentTarget, "first"))) ||
199
+ (e.key === "ArrowDown" && (caret === length || caretOnEdgeLine(e.currentTarget, "last")))) {
200
+ const order = flat(ed.blocks);
201
+ const to = order[order.findIndex((b) => b.id === block.id) + (e.key === "ArrowUp" ? -1 : 1)];
202
+ if (!to)
203
+ return;
204
+ e.preventDefault();
205
+ if (hasText(to))
206
+ ed.focus(to.id, e.key === "ArrowUp" ? "end" : 0);
207
+ else
208
+ ed.select(to.id);
209
+ }
210
+ };
211
+ return (_jsxs(_Fragment, { children: [_jsx(EditableText, { id: String(block.id), text: block.text, rev: ed.rev(block.id), onChange: onChange, onKeyDown: onKeyDown, onLink: ed.onLink, placeholder: placeholder, alwaysShowPlaceholder: alwaysShowPlaceholder, className: className }), slash && matches.length > 0 && _jsx(CommandMenu, { title: "Blocks", rect: slash.rect, commands: matches, index: slash.index, onPick: (c) => pick(c) })] }));
212
+ }
213
+ //# sourceMappingURL=block-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block-text.js","sourceRoot":"","sources":["../../../src/components/editor/block-text.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAsB,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAwB,CAAC;AACrD,OA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C7F,IAAI,CAAC,EAAE;gBAAE,OAAO;YAChB,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,IAAI,OAAO,CAAC,EAAE,CAAC;gBAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;;gBAC7D,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,CACH,8BACI,KAAC,YAAY,IACT,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EACpB,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EACrB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,EAAE,CAAC,MAAM,EACjB,WAAW,EAAE,WAAW,EACxB,qBAAqB,EAAE,qBAAqB,EAC5C,SAAS,EAAE,SAAS,GACtB,EACD,KAAK,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,KAAC,WAAW,IAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAc,CAAC,GAAI,IAC7J,CACN,CAAC;AACN,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { type ReactNode } from "react";
2
+ import type { Text } from "../../lib/rich-text.js";
3
+ import { type BuiltinNode, type Node } from "./kinds.js";
4
+ type Of<T extends BuiltinNode["type"]> = Extract<BuiltinNode, {
5
+ type: T;
6
+ }>;
7
+ export declare function BlockRow({ block, className, children, open, menu }: {
8
+ block: Node;
9
+ className?: string;
10
+ children: ReactNode;
11
+ open?: () => void;
12
+ menu?: ReactNode;
13
+ }): import("react").JSX.Element;
14
+ export declare function BlockList({ blocks, depth }: {
15
+ blocks: Node[];
16
+ depth?: number;
17
+ }): (import("react").JSX.Element | null)[];
18
+ /** A caption under a picture or a video: rich text of its own, saved with the block. Enter goes on below. */
19
+ export declare function Caption({ block, text }: {
20
+ block: Node;
21
+ text: Text;
22
+ }): import("react").JSX.Element;
23
+ /**
24
+ * ImageBlock in a document. A file is handed to the owner's `uploadImage`, which
25
+ * says where it can be loaded from; without one, only links are taken. Once it
26
+ * has a picture the block is selected, so Enter goes on writing below it. A click
27
+ * selects it; opening it larger is in its menu.
28
+ */
29
+ export declare function PictureBlock({ block }: {
30
+ block: Of<"image">;
31
+ }): import("react").JSX.Element;
32
+ export {};
33
+ //# sourceMappingURL=blocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../src/components/editor/blocks.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAYnD,OAAO,EAAuB,KAAK,WAAW,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAE9E,KAAK,EAAE,CAAC,CAAC,SAAS,WAAW,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAa3E,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,CAAA;CAAE,+BAgFjK;AAgBD,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,KAAS,EAAE,EAAE;IAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,0CAUlF;AA4GD,6GAA6G;AAC7G,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,+BAmBnE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,CAAA;CAAE,+BAuD7D"}