rimecms 0.33.0 → 1.0.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 (489) hide show
  1. package/dist/adapter-sqlite/auth.server.d.ts +2 -2
  2. package/dist/adapter-sqlite/columns.server.js +2 -2
  3. package/dist/adapter-sqlite/connect.server.d.ts +12 -0
  4. package/dist/adapter-sqlite/connect.server.js +31 -0
  5. package/dist/adapter-sqlite/generate-schema/index.server.js +11 -3
  6. package/dist/adapter-sqlite/generate-schema/root.server.d.ts +13 -4
  7. package/dist/adapter-sqlite/generate-schema/root.server.js +75 -131
  8. package/dist/adapter-sqlite/generate-schema/templates.server.d.ts +27 -6
  9. package/dist/adapter-sqlite/generate-schema/templates.server.js +52 -10
  10. package/dist/adapter-sqlite/index.server.d.ts +13 -5
  11. package/dist/adapter-sqlite/index.server.js +9 -6
  12. package/dist/adapter-sqlite/naming.server.d.ts +6 -8
  13. package/dist/adapter-sqlite/naming.server.js +22 -4
  14. package/dist/adapter-sqlite/paths.server.d.ts +10 -0
  15. package/dist/adapter-sqlite/paths.server.js +122 -0
  16. package/dist/adapter-sqlite/read.server.d.ts +10 -1
  17. package/dist/adapter-sqlite/read.server.js +22 -10
  18. package/dist/adapter-sqlite/select.server.d.ts +19 -0
  19. package/dist/adapter-sqlite/select.server.js +71 -63
  20. package/dist/adapter-sqlite/table.server.d.ts +2 -2
  21. package/dist/adapter-sqlite/transform.server.js +33 -3
  22. package/dist/adapter-sqlite/types.server.d.ts +10 -3
  23. package/dist/adapter-sqlite/where.server.d.ts +2 -3
  24. package/dist/adapter-sqlite/where.server.js +19 -1
  25. package/dist/core/adapter.d.ts +94 -0
  26. package/dist/core/auth/better-auth/config.server.d.ts +3 -3
  27. package/dist/core/auth/better-auth/instance.server.d.ts +6 -6
  28. package/dist/core/auth/handler/index.server.js +1 -1
  29. package/dist/core/auth/staff/derive.js +1 -1
  30. package/dist/core/auth/validate-config.js +3 -5
  31. package/dist/core/boot.server.d.ts +6 -6
  32. package/dist/core/config/types.d.ts +43 -5
  33. package/dist/core/config/validate.server.js +34 -51
  34. package/dist/core/dev/cli/commands/build.js +21 -6
  35. package/dist/core/dev/cli/commands/init.server.d.ts +2 -1
  36. package/dist/core/dev/cli/commands/init.server.js +32 -6
  37. package/dist/core/dev/cli/index.js +1 -0
  38. package/dist/core/dev/cli/templates/init.d.ts +6 -1
  39. package/dist/core/dev/cli/templates/init.js +30 -2
  40. package/dist/core/dev/cli/util/package-manager.server.d.ts +1 -0
  41. package/dist/core/dev/cli/util/package-manager.server.js +11 -8
  42. package/dist/core/dev/cli/util/package.server.d.ts +9 -0
  43. package/dist/core/dev/cli/util/package.server.js +43 -0
  44. package/dist/core/dev/codegen/types/contributions.server.d.ts +3 -2
  45. package/dist/core/dev/codegen/types/contributions.server.js +10 -3
  46. package/dist/core/dev/vite.server.js +4 -3
  47. package/dist/core/fields/blank.d.ts +21 -0
  48. package/dist/core/fields/blank.js +37 -0
  49. package/dist/core/fields/builders/field-builder.d.ts +53 -0
  50. package/dist/core/fields/builders/field-builder.js +14 -1
  51. package/dist/core/fields/builders/form-field-builder.d.ts +8 -0
  52. package/dist/core/fields/builders/form-field-builder.js +14 -1
  53. package/dist/core/fields/util.d.ts +9 -2
  54. package/dist/core/fields/util.js +123 -135
  55. package/dist/core/fields/walk.d.ts +44 -0
  56. package/dist/core/fields/walk.js +55 -0
  57. package/dist/core/handler.server.js +4 -0
  58. package/dist/core/i18n/context.d.ts +5 -0
  59. package/dist/core/i18n/context.js +6 -0
  60. package/dist/core/i18n/en/common.d.ts +71 -0
  61. package/dist/core/i18n/en/common.js +72 -1
  62. package/dist/core/i18n/en/fields.d.ts +68 -0
  63. package/dist/core/i18n/en/fields.js +69 -1
  64. package/dist/core/i18n/fr/common.d.ts +71 -0
  65. package/dist/core/i18n/fr/common.js +72 -1
  66. package/dist/core/i18n/fr/fields.d.ts +68 -0
  67. package/dist/core/i18n/fr/fields.js +69 -1
  68. package/dist/core/i18n/index.d.ts +29 -3
  69. package/dist/core/i18n/index.js +55 -29
  70. package/dist/core/locale/copy.server.js +3 -3
  71. package/dist/core/logger.server.js +15 -6
  72. package/dist/core/pipeline/build-document.server.d.ts +3 -0
  73. package/dist/core/pipeline/build-document.server.js +10 -7
  74. package/dist/core/pipeline/config-map/index.d.ts +9 -0
  75. package/dist/core/pipeline/config-map/index.js +16 -50
  76. package/dist/core/pipeline/hooks/process-document-fields.server.d.ts +3 -0
  77. package/dist/core/pipeline/hooks/process-document-fields.server.js +48 -12
  78. package/dist/core/pipeline/hooks/set-default-values.server.d.ts +1 -0
  79. package/dist/core/pipeline/hooks/set-default-values.server.js +1 -0
  80. package/dist/core/pipeline/persist/blocks/extract.server.js +1 -1
  81. package/dist/core/pipeline/persist/relations/extract.server.js +2 -0
  82. package/dist/core/pipeline/populate-relations.server.d.ts +27 -0
  83. package/dist/core/pipeline/populate-relations.server.js +42 -0
  84. package/dist/core/pipeline/run.server.d.ts +17 -6
  85. package/dist/core/pipeline/run.server.js +44 -30
  86. package/dist/core/plugins/cache/module.server.d.ts +1 -1
  87. package/dist/core/plugins/cache/module.server.js +5 -5
  88. package/dist/core/prototype/area/api.server.js +1 -2
  89. package/dist/core/prototype/area/definition.js +1 -10
  90. package/dist/core/prototype/area/definition.server.js +4 -5
  91. package/dist/core/prototype/area/hooks.server.js +3 -2
  92. package/dist/core/prototype/area/operations/find.js +2 -0
  93. package/dist/core/prototype/blank.d.ts +26 -0
  94. package/dist/core/prototype/blank.js +22 -0
  95. package/dist/core/prototype/collection/api.server.d.ts +29 -3
  96. package/dist/core/prototype/collection/api.server.js +47 -4
  97. package/dist/core/prototype/collection/definition.js +0 -3
  98. package/dist/core/prototype/collection/hooks/merge-with-blank.server.d.ts +5 -1
  99. package/dist/core/prototype/collection/hooks/merge-with-blank.server.js +8 -22
  100. package/dist/core/prototype/collection/hooks.server.js +11 -5
  101. package/dist/core/prototype/collection/nested/module.server.js +3 -1
  102. package/dist/core/prototype/collection/nested/tree.d.ts +12 -0
  103. package/dist/core/prototype/collection/nested/tree.js +42 -0
  104. package/dist/core/prototype/collection/operations/find-by-id.js +2 -0
  105. package/dist/core/prototype/collection/operations/find-by-ids.d.ts +19 -0
  106. package/dist/core/prototype/collection/operations/find-by-ids.js +54 -0
  107. package/dist/core/prototype/collection/operations/find.js +21 -27
  108. package/dist/core/prototype/collection/operations/update-slug-by-id.d.ts +20 -0
  109. package/dist/core/prototype/collection/operations/update-slug-by-id.js +53 -0
  110. package/dist/core/prototype/collection/rest/index.server.js +3 -1
  111. package/dist/core/prototype/collection/rest/update-slug-by-id.server.d.ts +2 -0
  112. package/dist/core/prototype/collection/rest/update-slug-by-id.server.js +20 -0
  113. package/dist/core/prototype/collection/thumbnail/find-thumbnail.d.ts +2 -1
  114. package/dist/core/prototype/collection/thumbnail/find-thumbnail.js +4 -27
  115. package/dist/core/prototype/collection/upload/directories/derive.js +3 -1
  116. package/dist/core/prototype/collection/upload/disk/delete.server.js +1 -2
  117. package/dist/core/prototype/define.js +2 -0
  118. package/dist/core/prototype/shared/metas/fields.js +2 -1
  119. package/dist/core/prototype/shared/title/find-title.d.ts +2 -1
  120. package/dist/core/prototype/shared/title/find-title.js +5 -28
  121. package/dist/core/prototype/shared/url/addresses.server.d.ts +26 -0
  122. package/dist/core/prototype/shared/url/addresses.server.js +119 -0
  123. package/dist/core/prototype/shared/url/doc-type.d.ts +6 -0
  124. package/dist/core/prototype/shared/url/doc-type.js +9 -0
  125. package/dist/core/prototype/shared/url/format.server.d.ts +27 -0
  126. package/dist/core/prototype/shared/url/format.server.js +38 -0
  127. package/dist/core/prototype/shared/url/hooks/create-paths.server.d.ts +2 -0
  128. package/dist/core/prototype/shared/url/hooks/create-paths.server.js +9 -0
  129. package/dist/core/prototype/shared/url/hooks/detach-paths.server.d.ts +5 -0
  130. package/dist/core/prototype/shared/url/hooks/detach-paths.server.js +18 -0
  131. package/dist/core/prototype/shared/url/hooks/index.server.d.ts +5 -1
  132. package/dist/core/prototype/shared/url/hooks/index.server.js +5 -1
  133. package/dist/core/prototype/shared/url/hooks/set-area-url.server.d.ts +2 -0
  134. package/dist/core/prototype/shared/url/hooks/set-area-url.server.js +8 -0
  135. package/dist/core/prototype/shared/url/hooks/set-live-url.server.d.ts +5 -0
  136. package/dist/core/prototype/shared/url/hooks/set-live-url.server.js +19 -0
  137. package/dist/core/prototype/shared/url/hooks/sync-paths.server.d.ts +7 -0
  138. package/dist/core/prototype/shared/url/hooks/sync-paths.server.js +37 -0
  139. package/dist/core/prototype/shared/url/refresh.server.d.ts +36 -0
  140. package/dist/core/prototype/shared/url/refresh.server.js +58 -0
  141. package/dist/core/prototype/shared/versions/configure.server.js +3 -0
  142. package/dist/core/routes/context.server.d.ts +2 -1
  143. package/dist/fields/blocks/component/AddBlockButton.svelte +48 -137
  144. package/dist/fields/blocks/component/Block.svelte +153 -117
  145. package/dist/fields/blocks/component/Block.svelte.d.ts +11 -5
  146. package/dist/fields/blocks/component/BlockActions.svelte +76 -26
  147. package/dist/fields/blocks/component/BlockActions.svelte.d.ts +3 -0
  148. package/dist/fields/blocks/component/Blocks.svelte +248 -91
  149. package/dist/fields/blocks/component/focus/BlocksFocus.svelte +680 -0
  150. package/dist/fields/blocks/component/focus/BlocksFocus.svelte.d.ts +7 -0
  151. package/dist/fields/blocks/component/focus/Layers.svelte +145 -0
  152. package/dist/fields/blocks/component/focus/Layers.svelte.d.ts +9 -0
  153. package/dist/fields/blocks/component/focus/LayersList.svelte +304 -0
  154. package/dist/fields/blocks/component/focus/LayersList.svelte.d.ts +10 -0
  155. package/dist/fields/blocks/component/focus/Palette.svelte +135 -0
  156. package/dist/fields/blocks/component/focus/Palette.svelte.d.ts +9 -0
  157. package/dist/fields/blocks/component/focus/RenderPlaceholder.svelte +77 -0
  158. package/dist/fields/blocks/component/focus/RenderPlaceholder.svelte.d.ts +10 -0
  159. package/dist/fields/blocks/component/focus/Renders.svelte +302 -0
  160. package/dist/fields/blocks/component/focus/Renders.svelte.d.ts +11 -0
  161. package/dist/fields/blocks/component/focus/Stage.svelte +190 -0
  162. package/dist/fields/blocks/component/focus/Stage.svelte.d.ts +8 -0
  163. package/dist/fields/blocks/component/focus/StagePlaceholder.svelte +69 -0
  164. package/dist/fields/blocks/component/focus/StagePlaceholder.svelte.d.ts +3 -0
  165. package/dist/fields/blocks/component/focus/focus.svelte.d.ts +140 -0
  166. package/dist/fields/blocks/component/focus/focus.svelte.js +424 -0
  167. package/dist/fields/blocks/component/picker/BlockPicker.svelte +88 -0
  168. package/dist/fields/blocks/component/picker/BlockPicker.svelte.d.ts +10 -0
  169. package/dist/fields/blocks/component/picker/BlockTile.svelte +121 -0
  170. package/dist/fields/blocks/component/picker/BlockTile.svelte.d.ts +12 -0
  171. package/dist/fields/blocks/index.d.ts +49 -7
  172. package/dist/fields/blocks/index.js +61 -12
  173. package/dist/fields/checkbox/component/Checkbox.svelte +11 -37
  174. package/dist/fields/checkbox/component/Checkbox.svelte.d.ts +1 -0
  175. package/dist/fields/combobox/component/ComboBox.svelte +37 -7
  176. package/dist/fields/combobox/component/combobox.css +26 -10
  177. package/dist/fields/date/component/Date.svelte +43 -12
  178. package/dist/fields/group/component/Group.svelte +110 -41
  179. package/dist/fields/group/index.d.ts +5 -1
  180. package/dist/fields/group/index.js +10 -2
  181. package/dist/fields/link/component/Link.svelte +184 -143
  182. package/dist/fields/link/component/RessourceInput.svelte +26 -24
  183. package/dist/fields/link/index.d.ts +1 -0
  184. package/dist/fields/link/module.server.js +2 -4
  185. package/dist/fields/number/component/Number.svelte +38 -20
  186. package/dist/fields/number/component/number.css +22 -20
  187. package/dist/fields/number/index.d.ts +1 -0
  188. package/dist/fields/radio/component/Radio.svelte +12 -0
  189. package/dist/fields/radio/index.js +1 -1
  190. package/dist/fields/relation/component/Relation.svelte +169 -40
  191. package/dist/fields/relation/component/RelationInline.svelte +258 -0
  192. package/dist/fields/relation/component/RelationInline.svelte.d.ts +26 -0
  193. package/dist/fields/relation/component/default/Default.svelte +210 -100
  194. package/dist/fields/relation/component/default/Default.svelte.d.ts +14 -1
  195. package/dist/fields/relation/component/types.d.ts +4 -0
  196. package/dist/fields/relation/component/upload/Browse.svelte +619 -88
  197. package/dist/fields/relation/component/upload/Browse.svelte.d.ts +10 -2
  198. package/dist/fields/relation/component/upload/Create.svelte +41 -0
  199. package/dist/fields/relation/component/upload/Create.svelte.d.ts +13 -0
  200. package/dist/fields/relation/component/upload/Upload.svelte +287 -101
  201. package/dist/fields/relation/component/upload/Upload.svelte.d.ts +6 -1
  202. package/dist/fields/relation/component/upload/upload.css +5 -81
  203. package/dist/fields/relation/module.server.js +7 -1
  204. package/dist/fields/relation/value.d.ts +25 -0
  205. package/dist/fields/relation/value.js +27 -0
  206. package/dist/fields/rich-text/component/RichText.svelte +12 -80
  207. package/dist/fields/rich-text/component/RichText.svelte.d.ts +1 -1
  208. package/dist/fields/rich-text/component/RichTextInline.svelte +28 -0
  209. package/dist/fields/rich-text/component/RichTextInline.svelte.d.ts +11 -0
  210. package/dist/fields/rich-text/component/bubble-menu/bubble-menu.css +4 -3
  211. package/dist/fields/rich-text/component/bubble-menu/bubble-menu.svelte +3 -1
  212. package/dist/fields/rich-text/component/bubble-menu/icon-button/icon-button.css +2 -2
  213. package/dist/fields/rich-text/component/bubble-menu/node-selector/node-selector.css +7 -10
  214. package/dist/fields/rich-text/component/drag-handle/drag-handle.css +0 -2
  215. package/dist/fields/rich-text/component/styles/editor.css +111 -0
  216. package/dist/fields/rich-text/component/styles/field.css +71 -0
  217. package/dist/fields/rich-text/component/suggestion/suggestion.svelte +41 -56
  218. package/dist/fields/rich-text/core/build-editor-config.js +1 -1
  219. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle-plugin.js +29 -3
  220. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.d.ts +1 -0
  221. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.js +2 -1
  222. package/dist/fields/rich-text/core/features/fields/fields.css +2 -3
  223. package/dist/fields/rich-text/core/features/hr/hr.css +4 -4
  224. package/dist/fields/rich-text/core/features/link/component/link-selector.css +0 -4
  225. package/dist/fields/rich-text/core/features/link/component/link-selector.svelte +24 -8
  226. package/dist/fields/rich-text/core/features/resource/resource.svelte +20 -6
  227. package/dist/fields/rich-text/core/features/upload/upload.svelte +20 -8
  228. package/dist/fields/rich-text/core/rich-text-editor-core.svelte +103 -0
  229. package/dist/fields/rich-text/core/rich-text-editor-core.svelte.d.ts +15 -0
  230. package/dist/fields/select/component/Select.svelte +67 -28
  231. package/dist/fields/slug/component/Slug.svelte +26 -53
  232. package/dist/fields/slug/index.d.ts +1 -0
  233. package/dist/fields/slug/index.js +1 -1
  234. package/dist/fields/tabs/component/Tabs.svelte +28 -22
  235. package/dist/fields/tabs/index.d.ts +4 -1
  236. package/dist/fields/tabs/index.js +17 -5
  237. package/dist/fields/text/index.d.ts +1 -0
  238. package/dist/fields/textarea/component/TextArea.svelte +28 -13
  239. package/dist/fields/textarea/index.d.ts +1 -0
  240. package/dist/fields/time/component/Time.svelte +9 -2
  241. package/dist/fields/toggle/component/Toggle.svelte +8 -25
  242. package/dist/fields/toggle/component/Toggle.svelte.d.ts +1 -0
  243. package/dist/fields/toggle/index.d.ts +1 -0
  244. package/dist/fields/tree/component/AddItemButton.svelte +18 -5
  245. package/dist/fields/tree/component/Tree.svelte +48 -19
  246. package/dist/fields/tree/component/TreeBlock.svelte +318 -104
  247. package/dist/fields/tree/component/TreeBlockActions.svelte +71 -7
  248. package/dist/fields/tree/component/TreeBlockActions.svelte.d.ts +4 -0
  249. package/dist/fields/tree/component/props.d.ts +2 -1
  250. package/dist/fields/tree/index.d.ts +13 -1
  251. package/dist/fields/tree/index.js +35 -9
  252. package/dist/fields/types.d.ts +3 -1
  253. package/dist/index.d.ts +4 -3
  254. package/dist/index.js +3 -2
  255. package/dist/panel/components/Root.svelte +16 -44
  256. package/dist/panel/components/Root.svelte.d.ts +1 -1
  257. package/dist/panel/components/fields/Error.svelte +18 -3
  258. package/dist/panel/components/fields/FieldsPreview.svelte +30 -17
  259. package/dist/panel/components/fields/FieldsPreviewTrigger.svelte +25 -3
  260. package/dist/panel/components/fields/Hint.svelte +51 -8
  261. package/dist/panel/components/fields/Hint.svelte.d.ts +11 -0
  262. package/dist/panel/components/fields/Label.svelte +2 -0
  263. package/dist/panel/components/fields/LabelFor.svelte +7 -2
  264. package/dist/panel/components/fields/RenderFields.svelte +10 -3
  265. package/dist/panel/components/fields/fieldset.svelte.d.ts +4 -1
  266. package/dist/panel/components/fields/fieldset.svelte.js +9 -2
  267. package/dist/panel/components/fields/index.d.ts +1 -0
  268. package/dist/panel/components/fields/setting.css +82 -0
  269. package/dist/panel/components/sections/auth/AuthForm.svelte +25 -26
  270. package/dist/panel/components/sections/collection/Avatar.svelte +61 -0
  271. package/dist/panel/components/sections/collection/Avatar.svelte.d.ts +9 -0
  272. package/dist/panel/components/sections/collection/DocStatus.svelte +28 -0
  273. package/dist/panel/components/sections/collection/DocStatus.svelte.d.ts +7 -0
  274. package/dist/panel/components/sections/collection/Empty.svelte +3 -3
  275. package/dist/panel/components/sections/collection/StatusDot.svelte +7 -5
  276. package/dist/panel/components/sections/collection/When.svelte +33 -0
  277. package/dist/panel/components/sections/collection/When.svelte.d.ts +8 -0
  278. package/dist/panel/components/sections/collection/bulk-upload/BulkUploadDialog.svelte +65 -21
  279. package/dist/panel/components/sections/collection/bulk-upload/BulkUploadDialog.svelte.d.ts +3 -2
  280. package/dist/panel/components/sections/collection/bulk-upload/DropZone.svelte +45 -162
  281. package/dist/panel/components/sections/collection/bulk-upload/DropZone.svelte.d.ts +3 -2
  282. package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte +151 -0
  283. package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte.d.ts +17 -0
  284. package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte +177 -0
  285. package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte.d.ts +12 -0
  286. package/dist/panel/components/sections/collection/bulk-upload/UploadProgress.svelte +75 -0
  287. package/dist/panel/components/sections/collection/bulk-upload/UploadProgress.svelte.d.ts +8 -0
  288. package/dist/panel/components/sections/collection/folder/Folder.svelte +18 -3
  289. package/dist/panel/components/sections/collection/folder/FolderEdit.svelte +26 -18
  290. package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte +98 -58
  291. package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte.d.ts +0 -1
  292. package/dist/panel/components/sections/collection/folder/Folders.svelte +60 -0
  293. package/dist/panel/components/sections/collection/folder/Folders.svelte.d.ts +7 -0
  294. package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte +31 -71
  295. package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte.d.ts +1 -0
  296. package/dist/panel/components/sections/collection/grid/create-directory-dialog/CreateDirectoryDialog.svelte +5 -3
  297. package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte +250 -37
  298. package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte.d.ts +2 -0
  299. package/dist/panel/components/sections/collection/header/ButtonCreate.svelte +43 -18
  300. package/dist/panel/components/sections/collection/header/ButtonCreate.svelte.d.ts +6 -4
  301. package/dist/panel/components/sections/collection/header/DisplayMode.svelte +69 -58
  302. package/dist/panel/components/sections/collection/header/DisplayMode.svelte.d.ts +0 -1
  303. package/dist/panel/components/sections/collection/header/FilterMenu.svelte +60 -0
  304. package/dist/panel/components/sections/collection/header/FilterMenu.svelte.d.ts +14 -0
  305. package/dist/panel/components/sections/collection/header/SearchInput.svelte +17 -26
  306. package/dist/panel/components/sections/collection/header/SelectUI.svelte +19 -34
  307. package/dist/panel/components/sections/collection/list/CollectionList.svelte +99 -68
  308. package/dist/panel/components/sections/collection/list/columns.d.ts +21 -0
  309. package/dist/panel/components/sections/collection/list/columns.js +23 -0
  310. package/dist/panel/components/sections/collection/list/header/Header.svelte +99 -51
  311. package/dist/panel/components/sections/collection/list/row/Row.svelte +165 -82
  312. package/dist/panel/components/sections/collection/list/row/Row.svelte.d.ts +4 -0
  313. package/dist/panel/components/sections/collection/tree/CollectionTree.svelte +92 -44
  314. package/dist/panel/components/sections/collection/tree/CollectionTree.svelte.d.ts +1 -0
  315. package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte +139 -43
  316. package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte.d.ts +2 -0
  317. package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte +1 -1
  318. package/dist/panel/components/sections/commands/CommandButton.svelte +99 -0
  319. package/dist/panel/components/sections/commands/CommandButton.svelte.d.ts +10 -0
  320. package/dist/panel/components/sections/commands/CommandPalette.svelte +275 -0
  321. package/dist/panel/components/sections/commands/CommandPalette.svelte.d.ts +8 -0
  322. package/dist/panel/components/sections/commands/Commands.svelte +18 -0
  323. package/dist/panel/components/sections/commands/Commands.svelte.d.ts +9 -0
  324. package/dist/panel/components/sections/document/AuthAPIKeyDialog.svelte +23 -7
  325. package/dist/panel/components/sections/document/AuthFooter.svelte +31 -12
  326. package/dist/panel/components/sections/document/AutoSaveBanner.svelte +24 -7
  327. package/dist/panel/components/sections/document/ButtonSave.svelte +32 -21
  328. package/dist/panel/components/sections/document/ButtonSave.svelte.d.ts +5 -5
  329. package/dist/panel/components/sections/document/ButtonStatus.svelte +68 -20
  330. package/dist/panel/components/sections/document/ChangeSlugDialog.svelte +199 -0
  331. package/dist/panel/components/sections/document/ChangeSlugDialog.svelte.d.ts +10 -0
  332. package/dist/panel/components/sections/document/CurrentlyEdited.svelte +2 -2
  333. package/dist/panel/components/sections/document/Document.svelte +96 -65
  334. package/dist/panel/components/sections/document/DocumentChildren.svelte +175 -0
  335. package/dist/panel/components/sections/document/DocumentChildren.svelte.d.ts +8 -0
  336. package/dist/panel/components/sections/document/DocumentUrl.svelte +119 -0
  337. package/dist/panel/components/sections/document/DocumentUrl.svelte.d.ts +9 -0
  338. package/dist/panel/components/sections/document/Header.svelte +171 -94
  339. package/dist/panel/components/sections/document/Settings.svelte +255 -110
  340. package/dist/panel/components/sections/document/Settings.svelte.d.ts +0 -1
  341. package/dist/panel/components/sections/document/Versions.svelte +5 -3
  342. package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte +112 -53
  343. package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte.d.ts +2 -2
  344. package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte +74 -41
  345. package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte.d.ts +1 -1
  346. package/dist/panel/components/sections/live/LiveEdit.svelte +2 -2
  347. package/dist/panel/components/sections/live/LiveFloatingUI.svelte +30 -11
  348. package/dist/panel/components/sections/live/live-edit-panel.css +2 -2
  349. package/dist/panel/components/sections/page-layout/Page.svelte +13 -1
  350. package/dist/panel/components/ui/breadcrumb/BreadCrumb.svelte +55 -27
  351. package/dist/panel/components/ui/button/button.svelte +81 -54
  352. package/dist/panel/components/ui/button/index.d.ts +7 -3
  353. package/dist/panel/components/ui/button/index.js +2 -2
  354. package/dist/panel/components/ui/calendar/calendar.css +27 -27
  355. package/dist/panel/components/ui/calendar/calendar.svelte.d.ts +1 -1
  356. package/dist/panel/components/ui/card/card-description.svelte +1 -1
  357. package/dist/panel/components/ui/card/card.svelte +21 -4
  358. package/dist/panel/components/ui/card-document/card-document.svelte +24 -12
  359. package/dist/panel/components/ui/card-resource/card-resource.svelte +26 -8
  360. package/dist/panel/components/ui/checkbox/checkbox.css +8 -10
  361. package/dist/panel/components/ui/command/command-dialog.css +28 -4
  362. package/dist/panel/components/ui/command/command-dialog.svelte +4 -1
  363. package/dist/panel/components/ui/command/command-dialog.svelte.d.ts +2 -0
  364. package/dist/panel/components/ui/command/command-empty.css +1 -1
  365. package/dist/panel/components/ui/command/command-group.css +3 -3
  366. package/dist/panel/components/ui/command/command-input-select.svelte +3 -3
  367. package/dist/panel/components/ui/command/command-input.svelte +38 -14
  368. package/dist/panel/components/ui/command/command-input.svelte.d.ts +6 -1
  369. package/dist/panel/components/ui/command/command-item.css +2 -2
  370. package/dist/panel/components/ui/command/command-list.css +1 -1
  371. package/dist/panel/components/ui/command/command-separator.css +1 -1
  372. package/dist/panel/components/ui/context-menu/context-menu-item.css +2 -2
  373. package/dist/panel/components/ui/context-menu/context-menu.css +6 -7
  374. package/dist/panel/components/ui/dialog/dialog-content.css +8 -10
  375. package/dist/panel/components/ui/dialog/dialog-content.svelte +19 -0
  376. package/dist/panel/components/ui/dialog/dialog-description.css +1 -1
  377. package/dist/panel/components/ui/dialog/dialog-footer.svelte +5 -1
  378. package/dist/panel/components/ui/dialog/dialog-overlay.css +1 -1
  379. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +19 -5
  380. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-content.css +6 -4
  381. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-item.css +1 -1
  382. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-radio-item.css +1 -1
  383. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-separator.css +1 -1
  384. package/dist/panel/components/ui/input/input.svelte +57 -31
  385. package/dist/panel/components/ui/kbd/Kbd.svelte +90 -0
  386. package/dist/panel/components/ui/kbd/Kbd.svelte.d.ts +11 -0
  387. package/dist/panel/components/ui/kbd/index.d.ts +1 -0
  388. package/dist/panel/components/ui/kbd/index.js +1 -0
  389. package/dist/panel/components/ui/label/label.css +5 -3
  390. package/dist/panel/components/ui/language-switcher/LanguageSwitcher.svelte +27 -15
  391. package/dist/panel/components/ui/nav/Nav.svelte +180 -110
  392. package/dist/panel/components/ui/nav/Nav.svelte.d.ts +0 -2
  393. package/dist/panel/components/ui/nav/NavGroup.svelte +87 -73
  394. package/dist/panel/components/ui/nav/NavItemButton.svelte +69 -29
  395. package/dist/panel/components/ui/nav/UserButton.svelte +132 -71
  396. package/dist/panel/components/ui/page-header/PageHeader.svelte +140 -42
  397. package/dist/panel/components/ui/page-header/PageHeader.svelte.d.ts +8 -1
  398. package/dist/panel/components/ui/popover/popover-content.css +4 -3
  399. package/dist/panel/components/ui/radio-group/radio-group.css +4 -6
  400. package/dist/panel/components/ui/radio-row-group/radio-row-group.css +19 -7
  401. package/dist/panel/components/ui/scroll-area/scroll-area.css +2 -2
  402. package/dist/panel/components/ui/separator/separator.svelte +1 -1
  403. package/dist/panel/components/ui/sheet/index.d.ts +4 -4
  404. package/dist/panel/components/ui/sheet/index.js +5 -5
  405. package/dist/panel/components/ui/sheet/sheet.css +50 -11
  406. package/dist/panel/components/ui/sonner/sonner.css +11 -8
  407. package/dist/panel/components/ui/switch/switch.css +13 -18
  408. package/dist/panel/components/ui/tabs/tabs.css +44 -35
  409. package/dist/panel/components/ui/tag/tag.svelte +20 -6
  410. package/dist/panel/components/ui/tooltip/tooltip-content.svelte +14 -4
  411. package/dist/panel/components/ui/tree/tree-rows.css +146 -0
  412. package/dist/panel/context/blocks-ops.d.ts +78 -0
  413. package/dist/panel/context/blocks-ops.js +170 -0
  414. package/dist/panel/context/collection.svelte.d.ts +28 -0
  415. package/dist/panel/context/collection.svelte.js +120 -65
  416. package/dist/panel/context/commands.svelte.d.ts +80 -0
  417. package/dist/panel/context/commands.svelte.js +108 -0
  418. package/dist/panel/context/documentForm.svelte.d.ts +34 -2
  419. package/dist/panel/context/documentForm.svelte.js +105 -102
  420. package/dist/panel/context/live.svelte.js +2 -73
  421. package/dist/panel/context/nav.svelte.d.ts +23 -0
  422. package/dist/panel/context/nav.svelte.js +56 -0
  423. package/dist/panel/fonts/Geist-VariableFont_wght.ttf +0 -0
  424. package/dist/panel/fonts/GeistMono-VariableFont_wght.ttf +0 -0
  425. package/dist/panel/index.d.ts +7 -1
  426. package/dist/panel/index.js +10 -1
  427. package/dist/panel/pages/auth/forgot-password/ForgotPassword.svelte +16 -1
  428. package/dist/panel/pages/collection/CollectionPage.svelte +236 -61
  429. package/dist/panel/pages/collection/load.server.js +1 -1
  430. package/dist/panel/pages/dashboard/Dashboard.svelte +135 -90
  431. package/dist/panel/pages/dashboard/DashboardCard.svelte +109 -0
  432. package/dist/panel/pages/dashboard/DashboardCard.svelte.d.ts +14 -0
  433. package/dist/panel/pages/dashboard/DashboardCollection.svelte +180 -57
  434. package/dist/panel/pages/dashboard/DashboardCollection.svelte.d.ts +1 -0
  435. package/dist/panel/pages/dashboard/DashboardRow.svelte +93 -0
  436. package/dist/panel/pages/dashboard/DashboardRow.svelte.d.ts +16 -0
  437. package/dist/panel/pages/dashboard/load.server.js +49 -25
  438. package/dist/panel/pages/dashboard/time.d.ts +19 -0
  439. package/dist/panel/pages/dashboard/time.js +29 -0
  440. package/dist/panel/pages/dashboard/types.d.ts +9 -2
  441. package/dist/panel/pages/live/Live.svelte +53 -50
  442. package/dist/panel/style/font.css +21 -32
  443. package/dist/panel/style/index.css +191 -122
  444. package/dist/panel/style/mixins/index.css +14 -0
  445. package/dist/panel/style/palette.css +35 -26
  446. package/dist/panel/style/postcss/size-function.d.ts +4 -0
  447. package/dist/panel/style/postcss/size-function.js +24 -0
  448. package/dist/panel/style/radius.css +4 -5
  449. package/dist/panel/style/scheme.css +111 -0
  450. package/dist/panel/style/size.css +3 -0
  451. package/dist/panel/util/Sortable.js +9 -4
  452. package/dist/panel/util/keys.d.ts +24 -0
  453. package/dist/panel/util/keys.js +63 -0
  454. package/dist/panel/util/populate.d.ts +8 -0
  455. package/dist/panel/util/populate.js +49 -0
  456. package/dist/panel/util/time.d.ts +12 -0
  457. package/dist/panel/util/time.js +35 -0
  458. package/dist/panel/util/upload-file.d.ts +106 -0
  459. package/dist/panel/util/upload-file.js +165 -0
  460. package/dist/util/index.d.ts +7 -10
  461. package/dist/util/index.js +7 -8
  462. package/dist/util/object.d.ts +10 -0
  463. package/dist/util/object.js +22 -1
  464. package/dist/util/string.d.ts +17 -0
  465. package/dist/util/string.js +23 -0
  466. package/package.json +1 -3
  467. package/dist/core/pipeline/config-map/build-tree-map.d.ts +0 -4
  468. package/dist/core/pipeline/config-map/build-tree-map.js +0 -30
  469. package/dist/core/prototype/doc.d.ts +0 -31
  470. package/dist/core/prototype/doc.js +0 -118
  471. package/dist/core/prototype/shared/url/augment.d.ts +0 -13
  472. package/dist/core/prototype/shared/url/augment.js +0 -11
  473. package/dist/core/prototype/shared/url/hooks/populate-url.server.d.ts +0 -4
  474. package/dist/core/prototype/shared/url/hooks/populate-url.server.js +0 -120
  475. package/dist/fields/rich-text/component/styles/rich-text.css +0 -183
  476. package/dist/panel/components/sections/collection/header/Header.svelte +0 -17
  477. package/dist/panel/components/sections/collection/header/Header.svelte.d.ts +0 -3
  478. package/dist/panel/components/sections/collection/header/Separator.svelte +0 -8
  479. package/dist/panel/components/sections/collection/header/Separator.svelte.d.ts +0 -26
  480. package/dist/panel/components/sections/collection/tree/util.d.ts +0 -12
  481. package/dist/panel/components/sections/collection/tree/util.js +0 -22
  482. package/dist/panel/fonts/ChivoMono-Italic-VariableFont_wght.ttf +0 -0
  483. package/dist/panel/fonts/ChivoMono-VariableFont_wght.ttf +0 -0
  484. package/dist/panel/fonts/Inter-VariableFont_slnt,wght.ttf +0 -0
  485. package/dist/panel/fonts/Lora-Italic-VariableFont_wght.ttf +0 -0
  486. package/dist/panel/fonts/Lora-VariableFont_wght.ttf +0 -0
  487. package/dist/panel/style/shadow.css +0 -10
  488. package/dist/util/path.d.ts +0 -16
  489. package/dist/util/path.js +0 -19
@@ -1,8 +1,6 @@
1
1
  import { getFieldAtPath, resolvedReferencesOf } from '../core/fields/util.js';
2
- import { BlocksBuilder } from '../fields/blocks/index.js';
3
2
  import { getColumns } from 'drizzle-orm';
4
3
  import { RelationFieldBuilder } from '../fields/relation/index.js';
5
- import { TreeBuilder } from '../fields/tree/index.js';
6
4
  import { baseTableName, childTableNames, joinName, tableName } from './naming.server.js';
7
5
  /** What a joined target is projected to, beside its `id`: whatever of these its table has. */
8
6
  const JOINED_COLUMNS = ['name', 'email', 'title', 'filename'];
@@ -14,7 +12,7 @@ const JOINED_COLUMNS = ['name', 'email', 'title', 'filename'];
14
12
  * `select`, only the selected ones.
15
13
  */
16
14
  export const resolvedReferenceJoins = (args) => {
17
- const { table, tables, config, select } = args;
15
+ const { table, tables, config, select, resolve } = args;
18
16
  const isBase = table === baseTableName(config.slug);
19
17
  const withParam = {};
20
18
  for (const reference of resolvedReferencesOf(config.fields)) {
@@ -22,6 +20,8 @@ export const resolvedReferenceJoins = (args) => {
22
20
  continue;
23
21
  if (select?.length && !select.includes(reference.path))
24
22
  continue;
23
+ if (resolve && !resolve.includes(reference.path))
24
+ continue;
25
25
  const target = tables[baseTableName(reference.to)];
26
26
  if (!target)
27
27
  continue;
@@ -33,88 +33,96 @@ export const resolvedReferenceJoins = (args) => {
33
33
  }
34
34
  return withParam;
35
35
  };
36
+ /** What a read of a page's address asks for: `url`, `_urlPath` and `_slug`, or all of the page. */
37
+ const ADDRESS_PATHS = ['url', '_urlPath', '_slug'];
38
+ /**
39
+ * The page's row in its paths table, in the locale read, when its collection has `$url`. A page
40
+ * has a row in every locale, so there is no fallback to resolve.
41
+ *
42
+ * ```ts
43
+ * pathsJoin({ base: 'pages', tables, locale: 'en' })
44
+ * // { 'pages__$paths': { where: { locale: 'en' }, columns: { slug: true, path: true, url: true } } }
45
+ * ```
46
+ */
47
+ export const pathsJoin = (args) => {
48
+ const { base, tables, locale, select } = args;
49
+ const paths = tableName({ owner: base, child: { kind: 'paths' } });
50
+ if (!(paths in tables))
51
+ return {};
52
+ if (select?.length && !select.some((path) => ADDRESS_PATHS.includes(path)))
53
+ return {};
54
+ return {
55
+ [paths]: { where: { locale: locale ?? '' }, columns: { slug: true, path: true, url: true } }
56
+ };
57
+ };
36
58
  export const buildWithParam = (args) => {
37
- const { table, select = [], locale, fallback, tables, config: documentConfig } = args;
59
+ const { table, select = [], resolve, locale, fallback, tables, config: documentConfig } = args;
38
60
  // A child row — a block, a tree node — belongs to one locale. Its locales branch, and the
39
61
  // document's, are read for every locale in the order and merged in `transform`.
40
62
  const branchWhere = branchFilter(locale, fallback);
63
+ // On the base table only: a versioned read joins it above the content row.
64
+ const paths = table === baseTableName(documentConfig.slug)
65
+ ? pathsJoin({ base: table, tables, locale, select })
66
+ : {};
41
67
  if (!select.length) {
42
68
  return {
43
69
  ...buildFullWithParam({ table, locale, fallback, tables }),
44
- ...resolvedReferenceJoins({ table, tables, config: documentConfig })
70
+ ...resolvedReferenceJoins({ table, tables, config: documentConfig, resolve }),
71
+ ...paths
45
72
  };
46
73
  }
47
- const withParam = resolvedReferenceJoins({ table, tables, config: documentConfig, select });
48
- // Track paths for different field types
74
+ const withParam = {
75
+ ...resolvedReferenceJoins({
76
+ table,
77
+ tables,
78
+ config: documentConfig,
79
+ select,
80
+ resolve
81
+ }),
82
+ ...paths
83
+ };
49
84
  const directRelationPaths = [];
50
- const blockPaths = [];
51
- const treePaths = [];
85
+ /** The selected paths stored as child tables, by the tables' kind. */
86
+ const childPaths = { blocks: [], tree: [] };
87
+ const allChildPaths = () => [...childPaths.blocks, ...childPaths.tree];
88
+ /** The kinds of child table a field's branches are stored in — none for a column. */
89
+ const storageKinds = (field) => [
90
+ ...new Set(field.use.nodes().flatMap((node) => (node.storage ? [node.storage.kind] : [])))
91
+ ];
52
92
  for (const path of select) {
53
93
  // Convert dot notation to double underscore notation for SQLite queries
54
94
  const sqlPath = path.replace(/\./g, '__');
55
95
  const fieldConfig = getFieldAtPath(path, documentConfig.fields);
96
+ // Each branch is where the field's rows are stored: the junction table, a child table, or a
97
+ // column of the row itself.
56
98
  if (fieldConfig instanceof RelationFieldBuilder) {
57
- // Handle relation fields
58
99
  directRelationPaths.push(path);
59
100
  }
60
- else if (fieldConfig instanceof BlocksBuilder) {
61
- // Handle blocks fields
62
- blockPaths.push(path);
63
- const blocksTables = childTableNames(table, 'blocks', tables);
64
- for (const blocksTable of blocksTables) {
65
- if (!withParam[blocksTable]) {
101
+ else if (fieldConfig && storageKinds(fieldConfig).length) {
102
+ for (const kind of storageKinds(fieldConfig)) {
103
+ childPaths[kind].push(path);
104
+ for (const childTable of childTableNames(table, kind, tables)) {
105
+ if (withParam[childTable])
106
+ continue;
66
107
  let params = { orderBy: { position: 'asc' } };
67
- const columns = getColumns(tables[blocksTable]);
108
+ const columns = getColumns(tables[childTable]);
68
109
  const hasLocale = Object.keys(columns).includes('locale');
69
110
  if (locale && hasLocale) {
70
111
  params = { ...params, where: { locale } };
71
112
  }
72
- withParam[blocksTable] = params;
73
- // Handle localized blocks
74
- const localesBlockTable = tableName({ owner: blocksTable, branch: 'locales' });
75
- if (locale && localesBlockTable in tables) {
76
- withParam[blocksTable] = {
77
- ...withParam[blocksTable],
78
- with: {
79
- [localesBlockTable]: {
80
- where: branchWhere
81
- }
82
- }
83
- };
84
- }
85
- }
86
- }
87
- }
88
- else if (fieldConfig instanceof TreeBuilder) {
89
- // Handle tree fields
90
- treePaths.push(path);
91
- const treeTables = childTableNames(table, 'tree', tables);
92
- for (const treeTable of treeTables) {
93
- if (!withParam[treeTable]) {
94
- let params = { orderBy: { position: 'asc' } };
95
- const columns = getColumns(tables[treeTable]);
96
- const hasLocale = Object.keys(columns).includes('locale');
97
- if (locale && hasLocale) {
98
- params = { ...params, where: { locale } };
99
- }
100
- withParam[treeTable] = params;
101
- // Handle localized trees
102
- const localesTreeTables = tableName({ owner: treeTable, branch: 'locales' });
103
- if (locale && localesTreeTables in tables) {
104
- withParam[treeTable] = {
105
- ...withParam[treeTable],
106
- with: {
107
- [localesTreeTables]: {
108
- where: branchWhere
109
- }
110
- }
113
+ withParam[childTable] = params;
114
+ // Its locales branch with it.
115
+ const localesTable = tableName({ owner: childTable, branch: 'locales' });
116
+ if (locale && localesTable in tables) {
117
+ withParam[childTable] = {
118
+ ...withParam[childTable],
119
+ with: { [localesTable]: { where: branchWhere } }
111
120
  };
112
121
  }
113
122
  }
114
123
  }
115
124
  }
116
125
  else if (fieldConfig) {
117
- // Handle regular fields
118
126
  if (fieldConfig.get.localized && locale) {
119
127
  const localesTableName = tableName({ owner: table, branch: 'locales' });
120
128
  if (localesTableName in tables) {
@@ -147,7 +155,7 @@ export const buildWithParam = (args) => {
147
155
  // 1. Include relations table if container paths exist (blocks or trees).
148
156
  // If container paths are present we include relations for those containers
149
157
  // and also include any direct relation paths.
150
- if ((blockPaths.length > 0 || treePaths.length > 0) &&
158
+ if (allChildPaths().length > 0 &&
151
159
  tableName({ owner: table, child: { kind: 'rels' } }) in tables) {
152
160
  // Create a where condition that matches relations within any of the container paths,
153
161
  // and include direct relation paths as exact matches.
@@ -155,7 +163,7 @@ export const buildWithParam = (args) => {
155
163
  where: {
156
164
  OR: [
157
165
  // A container's rows sit under its path; a direct relation is the path itself.
158
- ...[...blockPaths, ...treePaths].map((path) => ({ path: { like: `${path}__%` } })),
166
+ ...allChildPaths().map((path) => ({ path: { like: `${path}__%` } })),
159
167
  ...directRelationPaths.map((path) => ({ path }))
160
168
  ]
161
169
  },
@@ -163,12 +171,12 @@ export const buildWithParam = (args) => {
163
171
  };
164
172
  }
165
173
  // 2. Include tree tables for blocks that might contain trees
166
- if (blockPaths.length > 0) {
174
+ if (childPaths.blocks.length > 0) {
167
175
  const treeTables = childTableNames(table, 'tree', tables);
168
176
  for (const treeTable of treeTables) {
169
177
  if (!withParam[treeTable]) {
170
178
  withParam[treeTable] = {
171
- where: { OR: blockPaths.map((path) => ({ path: { like: `${path}__%` } })) },
179
+ where: { OR: childPaths.blocks.map((path) => ({ path: { like: `${path}__%` } })) },
172
180
  orderBy: { position: 'asc' }
173
181
  };
174
182
  // Handle localized trees
@@ -187,12 +195,12 @@ export const buildWithParam = (args) => {
187
195
  }
188
196
  }
189
197
  // 3. Include block tables for trees that might contain blocks
190
- if (treePaths.length > 0) {
198
+ if (childPaths.tree.length > 0) {
191
199
  const blocksTables = childTableNames(table, 'blocks', tables);
192
200
  for (const blocksTable of blocksTables) {
193
201
  if (!withParam[blocksTable]) {
194
202
  withParam[blocksTable] = {
195
- where: { OR: treePaths.map((path) => ({ path: { like: `${path}__%` } })) },
203
+ where: { OR: childPaths.tree.map((path) => ({ path: { like: `${path}__%` } })) },
196
204
  orderBy: { position: 'asc' }
197
205
  };
198
206
  // Handle localized blocks
@@ -1,6 +1,6 @@
1
1
  import type { TableHandle } from '../core/adapter.js';
2
2
  import type { GetRegisterType } from '../index.js';
3
- import type { LibSQLDatabase } from 'drizzle-orm/libsql';
3
+ import type { SqliteDatabase } from './types.server.js';
4
4
  /**
5
5
  * Handles for the tables features declared — see `FeatureDefinition.tables`.
6
6
  *
@@ -13,6 +13,6 @@ import type { LibSQLDatabase } from 'drizzle-orm/libsql';
13
13
  * had no way to name until a feature could declare one.
14
14
  */
15
15
  export declare const createTableHandles: (args: {
16
- db: LibSQLDatabase<GetRegisterType<"Relations">>;
16
+ db: SqliteDatabase;
17
17
  tables: GetRegisterType<"Tables">;
18
18
  }) => (slug: string) => TableHandle;
@@ -2,9 +2,9 @@ import { getTableColumns } from 'drizzle-orm';
2
2
  import { flatten } from 'flat';
3
3
  import { logger } from '../core/logger.server.js';
4
4
  import { extractFieldName } from '../fields/tree/util.js';
5
- import { omit } from '../util/object.js';
5
+ import { isObjectLiteral, omit } from '../util/object.js';
6
6
  import { baseTableName, tableName as buildTableName, childTableNames, joinName } from './naming.server.js';
7
- import { transformDatabaseColumnsToPaths } from './columns.server.js';
7
+ import { databaseColumnToPath, transformDatabaseColumnsToPaths } from './columns.server.js';
8
8
  import { localeOrder, mergeLocaleRows } from './locales.server.js';
9
9
  import { resolvedReferencesOf } from '../core/fields/util.js';
10
10
  /**
@@ -42,6 +42,8 @@ export const createTransformHandle = (args) => {
42
42
  // the config rather than asked of a feature, which is what keeps this file naming none.
43
43
  const tableName = baseTableName(configCtx.getBySlug(slug)._versions?.slug ?? slug);
44
44
  const tableNameRelationFields = buildTableName({ owner: tableName, child: { kind: 'rels' } });
45
+ // The addresses hang off the base row, whether or not the content is on a versions table.
46
+ const tableNamePaths = buildTableName({ owner: baseTableName(slug), child: { kind: 'paths' } });
45
47
  const tableNameLocales = buildTableName({ owner: tableName, branch: 'locales' });
46
48
  /** Add localized fields, each from the first locale in the fallback order that holds it. */
47
49
  if (locale && tableNameLocales in tables && doc[tableNameLocales]) {
@@ -109,7 +111,35 @@ export const createTransformHandle = (args) => {
109
111
  // The child tables came back on the same row; they are their own piles now. Left on, they
110
112
  // flatten into `pages__$blocks_hero.0.id` keys that survive every step to be stripped by name
111
113
  // at the very end.
112
- const base = transformDatabaseColumnsToPaths(flatten(omit([...blocksTables, ...treeTables, tableNameRelationFields], doc)));
114
+ // One pass over the row: a child table's key is dropped, a column becomes its path, and a
115
+ // JSON value — an object or an array — is flattened under it, nothing else is walked.
116
+ const childTables = new Set([
117
+ ...blocksTables,
118
+ ...treeTables,
119
+ tableNameRelationFields,
120
+ tableNamePaths
121
+ ]);
122
+ const base = {};
123
+ for (const [key, value] of Object.entries(doc)) {
124
+ if (childTables.has(key))
125
+ continue;
126
+ if (isObjectLiteral(value) || Array.isArray(value)) {
127
+ for (const [flatKey, flatValue] of Object.entries(flatten({ [key]: value }))) {
128
+ base[databaseColumnToPath(flatKey)] = flatValue;
129
+ }
130
+ }
131
+ else {
132
+ base[databaseColumnToPath(key)] = value;
133
+ }
134
+ }
135
+ // The page's address in the locale read: `url`, `_urlPath` and `_slug` on the document. Not
136
+ // `_path`, which an upload collection already names.
137
+ if (tableNamePaths in doc) {
138
+ const [address] = doc[tableNamePaths] ?? [];
139
+ base.url = address?.url ?? null;
140
+ base._urlPath = address?.path ?? null;
141
+ base._slug = address?.slug ?? null;
142
+ }
113
143
  return { base, blocks, tree, relations };
114
144
  };
115
145
  return { rows };
@@ -1,12 +1,19 @@
1
1
  import type { GetRegisterType } from '../index.js';
2
2
  import type { ColumnBaseConfig, ColumnDataType } from 'drizzle-orm';
3
- import type { LibSQLDatabase } from 'drizzle-orm/libsql';
4
- import type { SQLiteColumn, SQLiteTableWithColumns } from 'drizzle-orm/sqlite-core';
3
+ import type { SQLiteAsyncDatabase, SQLiteColumn, SQLiteTableWithColumns } from 'drizzle-orm/sqlite-core';
4
+ /**
5
+ * The drizzle connection, whichever driver opened it.
6
+ *
7
+ * libsql is async and bun:sqlite is sync, but drizzle wraps both in `SQLiteAsyncDatabase`, so
8
+ * every query is awaited the same way. The one difference that leaks: a sync driver's
9
+ * `db.transaction()` rejects an async callback.
10
+ */
11
+ export type SqliteDatabase = SQLiteAsyncDatabase<'sync' | 'async', unknown, GetRegisterType<'Relations'>>;
5
12
  /**
6
13
  * What every facade in this folder is built from: the connection and the generated tables.
7
14
  */
8
15
  export type AdapterDeps = {
9
- db: LibSQLDatabase<GetRegisterType<'Relations'>>;
16
+ db: SqliteDatabase;
10
17
  tables: GenericTables;
11
18
  };
12
19
  type GenericColumn = SQLiteColumn<ColumnBaseConfig<ColumnDataType>, Record<string, unknown>>;
@@ -1,14 +1,13 @@
1
1
  import type { ConfigContext } from '../core/rime.server.js';
2
2
  import { type GetRegisterType } from '../index.js';
3
- import type { LibSQLDatabase } from 'drizzle-orm/libsql';
4
3
  import type { ParsedQs } from 'qs';
5
4
  import type { PrototypeSlug } from '../types.js';
6
- import type { GenericTable } from './types.server.js';
5
+ import type { GenericTable, SqliteDatabase } from './types.server.js';
7
6
  type BuildWhereArgs = {
8
7
  query: ParsedQs;
9
8
  slug: PrototypeSlug;
10
9
  locale?: string;
11
- db: LibSQLDatabase<GetRegisterType<'Relations'>>;
10
+ db: SqliteDatabase;
12
11
  tables: GetRegisterType<'Tables'>;
13
12
  configCtx: ConfigContext;
14
13
  /**
@@ -52,6 +52,16 @@ export const buildWhereParam = ({ query, slug, db, locale, tables, configCtx, ba
52
52
  const {
53
53
  // Get condition members
54
54
  column, sqlColumn, fn, operator, rawValue, value } = getConditionMembers(conditionObject);
55
+ // A collection with `$url` finds its pages by url or by path through its paths table, in the
56
+ // locale read. A versions table is matched through its `ownerId`, like any base-row filter.
57
+ const pathsTable = getTable(tableName({ owner: baseTableName(base ?? slug), child: { kind: 'paths' } }));
58
+ if (pathsTable && (column === 'url' || column === '_urlPath')) {
59
+ const owners = db
60
+ .select({ id: pathsTable.ownerId })
61
+ .from(pathsTable)
62
+ .where(and(eq(pathsTable.locale, locale ?? ''), fn(column === 'url' ? pathsTable.url : pathsTable.path, value)));
63
+ return inArray(isShadow ? table.ownerId : table.id, owners);
64
+ }
55
65
  // Handle regular fields
56
66
  if (unlocalizedColumns.includes(sqlColumn)) {
57
67
  return fn(table[sqlColumn], value);
@@ -66,7 +76,15 @@ export const buildWhereParam = ({ query, slug, db, locale, tables, configCtx, ba
66
76
  const resolved = order.length > 1
67
77
  ? sql `COALESCE(${sql.join(order.map(valueIn), sql `, `)})`
68
78
  : valueIn(order[0]);
69
- return fn(resolved, value);
79
+ if (operator !== 'equals' && operator !== 'in_array')
80
+ return fn(resolved, value);
81
+ // A document whose read value matches has a locales row holding it, so the documents with
82
+ // one are asked first: that is what an index on the column answers, and the comparison
83
+ // above then runs on those alone.
84
+ return and(inArray(table.id, db
85
+ .select({ ownerId: tableLocales.ownerId })
86
+ .from(tableLocales)
87
+ .where(fn(tableLocales[sqlColumn], value))), fn(resolved, value));
70
88
  }
71
89
  // A column the base row keeps — the hierarchy columns, and any `$root()` field — reached
72
90
  // through `ownerId` when the table queried is the versions table.
@@ -55,6 +55,7 @@ export interface Adapter {
55
55
  blocks: BlocksHandle;
56
56
  tree: TreeHandle;
57
57
  relations: RelationsHandle;
58
+ paths: PathsHandle;
58
59
  transform: TransformHandle;
59
60
  auth: AuthHandle;
60
61
  }
@@ -78,6 +79,12 @@ export interface BaseHandle {
78
79
  locale?: string;
79
80
  /** See `find`. */
80
81
  localeFallback?: boolean;
82
+ /**
83
+ * The resolved references to join, by document path. Absent, every one; `select` narrows
84
+ * further. A read hands down the ones its reader may see, so a join is never made for a
85
+ * field the pipeline goes on to drop.
86
+ */
87
+ resolve?: string[];
81
88
  /** Per document, which content row — see `find`. Filters the list as well as picking rows. */
82
89
  content?: OperationQuery;
83
90
  }): Promise<RawDoc[]>;
@@ -119,6 +126,8 @@ export interface CollectionHandle extends BaseHandle {
119
126
  * else, which is what a copy from one row to another reads.
120
127
  */
121
128
  localeFallback?: boolean;
129
+ /** See `findMany`. */
130
+ resolve?: string[];
122
131
  /**
123
132
  * Narrows which content row this read means, for a config that has one. The newest when
124
133
  * omitted, which is what "the content of this document" means with nothing else said.
@@ -191,6 +200,8 @@ export interface AreaHandle extends BaseHandle {
191
200
  locale?: string;
192
201
  /** See `CollectionHandle.find`. */
193
202
  localeFallback?: boolean;
203
+ /** See `CollectionHandle.findMany`. */
204
+ resolve?: string[];
194
205
  content?: OperationQuery;
195
206
  }): Promise<RawDoc | undefined>;
196
207
  /** Writes the rows a write plan names. See `CollectionHandle.update`. */
@@ -275,6 +286,89 @@ export interface RelationsHandle {
275
286
  locale?: string;
276
287
  }): Promise<Relation[]>;
277
288
  }
289
+ /**
290
+ * A page's address in one locale, as a collection with `$url` stores it.
291
+ *
292
+ * ```
293
+ * { ownerId: 'web', locale: 'en', slug: 'web', path: 'services/web', url: 'https://site.test/en/services/web' }
294
+ * ```
295
+ *
296
+ * `locale` is `''` when the config has no localization. `path` is the slugs from the top page down
297
+ * to this one; the adapter keeps it in step when a slug changes or a page moves.
298
+ */
299
+ export type PathRow = {
300
+ ownerId: string;
301
+ locale: string;
302
+ slug: string;
303
+ path: string;
304
+ url: string | null;
305
+ };
306
+ /**
307
+ * The addresses of a collection's pages. Every verb names one page; the pages under it follow.
308
+ */
309
+ export interface PathsHandle {
310
+ /** One row per locale for a new page, under its parent's row in each locale. */
311
+ insert(args: {
312
+ slug: PrototypeSlug;
313
+ ownerId: string;
314
+ parentId: string | null;
315
+ rows: {
316
+ locale: string;
317
+ slug: string;
318
+ }[];
319
+ }): Promise<PathRow[]>;
320
+ /** The page's rows, in every locale unless one is given. */
321
+ get(args: {
322
+ slug: PrototypeSlug;
323
+ ownerId: string;
324
+ locale?: string;
325
+ }): Promise<PathRow[]>;
326
+ /** A new slug in one locale. Answers the row with its new path. */
327
+ setSlug(args: {
328
+ slug: PrototypeSlug;
329
+ ownerId: string;
330
+ locale: string;
331
+ value: string;
332
+ }): Promise<PathRow | undefined>;
333
+ /** Under another parent, or at the top, in every locale at once. Answers the page's rows. */
334
+ moveUnder(args: {
335
+ slug: PrototypeSlug;
336
+ ownerId: string;
337
+ parentId: string | null;
338
+ }): Promise<PathRow[]>;
339
+ /** Its children go to the top, before it is deleted. Answers their rows. */
340
+ detachChildren(args: {
341
+ slug: PrototypeSlug;
342
+ ownerId: string;
343
+ }): Promise<PathRow[]>;
344
+ /** The row at `path` and, with `withDescendants`, every row below it, in one locale. */
345
+ under(args: {
346
+ slug: PrototypeSlug;
347
+ locale: string;
348
+ path: string;
349
+ withDescendants?: boolean;
350
+ }): Promise<PathRow[]>;
351
+ /** The slugs the children of `parentId` hold in `locale`, or of the top pages when it is null. */
352
+ siblingSlugs(args: {
353
+ slug: PrototypeSlug;
354
+ locale: string;
355
+ parentId: string | null;
356
+ }): Promise<string[]>;
357
+ /** The documents of the collection with no row in `locale` yet. */
358
+ missingOwners(args: {
359
+ slug: PrototypeSlug;
360
+ locale: string;
361
+ }): Promise<string[]>;
362
+ /** New urls, in one transaction. */
363
+ setUrls(args: {
364
+ slug: PrototypeSlug;
365
+ rows: {
366
+ ownerId: string;
367
+ locale: string;
368
+ url: string;
369
+ }[];
370
+ }): Promise<void>;
371
+ }
278
372
  export interface TransformHandle {
279
373
  /**
280
374
  * The rows one document is stored across, unflattened and grouped by what they are.
@@ -1257,7 +1257,7 @@ export declare function getBaseAuthConfig<const C extends Config>(ctx: {
1257
1257
  $Infer: {
1258
1258
  body: {
1259
1259
  userId: string;
1260
- role: "user" | "admin" | "staff" | ("user" | "admin" | "staff")[];
1260
+ role: "user" | "staff" | "admin" | ("user" | "staff" | "admin")[];
1261
1261
  };
1262
1262
  };
1263
1263
  };
@@ -1346,7 +1346,7 @@ export declare function getBaseAuthConfig<const C extends Config>(ctx: {
1346
1346
  email: string;
1347
1347
  password?: string | undefined;
1348
1348
  name: string;
1349
- role?: "user" | "admin" | "staff" | ("user" | "admin" | "staff")[] | undefined;
1349
+ role?: "user" | "staff" | "admin" | ("user" | "staff" | "admin")[] | undefined;
1350
1350
  data?: Record<string, any> | undefined;
1351
1351
  };
1352
1352
  };
@@ -1970,7 +1970,7 @@ export declare function getBaseAuthConfig<const C extends Config>(ctx: {
1970
1970
  };
1971
1971
  } & {
1972
1972
  userId?: string | undefined;
1973
- role?: "user" | "admin" | "staff" | undefined;
1973
+ role?: "user" | "staff" | "admin" | undefined;
1974
1974
  };
1975
1975
  };
1976
1976
  };
@@ -1273,7 +1273,7 @@ export declare const createAuthInstance: <const C extends Config>(args: {
1273
1273
  $Infer: {
1274
1274
  body: {
1275
1275
  userId: string;
1276
- role: "user" | "admin" | "staff" | ("user" | "admin" | "staff")[];
1276
+ role: "user" | "staff" | "admin" | ("user" | "staff" | "admin")[];
1277
1277
  };
1278
1278
  };
1279
1279
  };
@@ -1362,7 +1362,7 @@ export declare const createAuthInstance: <const C extends Config>(args: {
1362
1362
  email: string;
1363
1363
  password?: string | undefined;
1364
1364
  name: string;
1365
- role?: "user" | "admin" | "staff" | ("user" | "admin" | "staff")[] | undefined;
1365
+ role?: "user" | "staff" | "admin" | ("user" | "staff" | "admin")[] | undefined;
1366
1366
  data?: Record<string, any> | undefined;
1367
1367
  };
1368
1368
  };
@@ -1986,7 +1986,7 @@ export declare const createAuthInstance: <const C extends Config>(args: {
1986
1986
  };
1987
1987
  } & {
1988
1988
  userId?: string | undefined;
1989
- role?: "user" | "admin" | "staff" | undefined;
1989
+ role?: "user" | "staff" | "admin" | undefined;
1990
1990
  };
1991
1991
  };
1992
1992
  };
@@ -3344,7 +3344,7 @@ export declare const createAuthInstance: <const C extends Config>(args: {
3344
3344
  $Infer: {
3345
3345
  body: {
3346
3346
  userId: string;
3347
- role: "user" | "admin" | "staff" | ("user" | "admin" | "staff")[];
3347
+ role: "user" | "staff" | "admin" | ("user" | "staff" | "admin")[];
3348
3348
  };
3349
3349
  };
3350
3350
  };
@@ -3433,7 +3433,7 @@ export declare const createAuthInstance: <const C extends Config>(args: {
3433
3433
  email: string;
3434
3434
  password?: string | undefined;
3435
3435
  name: string;
3436
- role?: "user" | "admin" | "staff" | ("user" | "admin" | "staff")[] | undefined;
3436
+ role?: "user" | "staff" | "admin" | ("user" | "staff" | "admin")[] | undefined;
3437
3437
  data?: Record<string, any> | undefined;
3438
3438
  };
3439
3439
  };
@@ -4057,7 +4057,7 @@ export declare const createAuthInstance: <const C extends Config>(args: {
4057
4057
  };
4058
4058
  } & {
4059
4059
  userId?: string | undefined;
4060
- role?: "user" | "admin" | "staff" | undefined;
4060
+ role?: "user" | "staff" | "admin" | undefined;
4061
4061
  };
4062
4062
  };
4063
4063
  };
@@ -1,6 +1,6 @@
1
1
  import { RimeError } from '../../errors/index.js';
2
2
  import { error, redirect } from '@sveltejs/kit';
3
- import { access } from '../../../util/index.js';
3
+ import { access } from '../access.js';
4
4
  import { BETTER_AUTH_ROLES } from '../constant.server.js';
5
5
  import { userAttributes } from '../user.server.js';
6
6
  import { hasAuthUser } from '../better-auth-tables.server.js';
@@ -1,4 +1,4 @@
1
- import { access } from '../../../util/index.js';
1
+ import { access } from '../access.js';
2
2
  import { UsersRound } from '@lucide/svelte';
3
3
  import cloneDeep from 'clone-deep';
4
4
  export const staffCollection = {
@@ -1,4 +1,3 @@
1
- import { isFormField } from '../fields/util.js';
2
1
  import { SelectFieldBuilder } from '../../fields/select/index.js';
3
2
  /**
4
3
  * What a collection declaring `auth` has to look like.
@@ -22,12 +21,11 @@ export const validateAuth = (config) => {
22
21
  if (config.versions) {
23
22
  errors.push(`Auth collections can't be versionned (${config.slug})`);
24
23
  }
25
- const formFields = config.fields.filter(isFormField);
26
- const rolesField = formFields
24
+ const rolesField = config.fields
27
25
  .filter((f) => f.name === 'roles')
28
26
  .filter((f) => f instanceof SelectFieldBuilder)[0];
29
- const nameField = formFields.filter((f) => f.name === 'name')[0];
30
- const emailField = formFields.find((f) => f.name === 'email' && f.type === 'email');
27
+ const nameField = config.fields.filter((f) => f.name === 'name')[0];
28
+ const emailField = config.fields.find((f) => f.name === 'email' && f.type === 'email');
31
29
  if (!rolesField)
32
30
  errors.push(`Field roles is missing in collection ${config.slug}`);
33
31
  if (!emailField && config.auth?.type !== 'apiKey')