rimecms 0.28.10 → 0.30.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 (356) hide show
  1. package/README.md +3 -3
  2. package/dist/adapter-sqlite/area.server.js +8 -8
  3. package/dist/adapter-sqlite/generate-schema/column.server.d.ts +13 -0
  4. package/dist/adapter-sqlite/generate-schema/column.server.js +77 -0
  5. package/dist/adapter-sqlite/generate-schema/index.server.js +7 -12
  6. package/dist/adapter-sqlite/generate-schema/root.server.js +35 -39
  7. package/dist/adapter-sqlite/generate-schema/templates.server.d.ts +12 -0
  8. package/dist/adapter-sqlite/generate-schema/templates.server.js +19 -0
  9. package/dist/adapter-sqlite/generate-schema/{util.d.ts → util.server.d.ts} +2 -2
  10. package/dist/adapter-sqlite/generate-schema/{util.js → util.server.js} +2 -2
  11. package/dist/adapter-sqlite/generate-schema/write.server.js +1 -1
  12. package/dist/adapter-sqlite/relations.server.js +6 -1
  13. package/dist/adapter-sqlite/transform.server.js +1 -1
  14. package/dist/adapter-sqlite/util.server.d.ts +1 -6
  15. package/dist/adapter-sqlite/util.server.js +6 -0
  16. package/dist/adapter-sqlite/where.server.js +17 -16
  17. package/dist/adapter-sqlite/with.server.js +10 -10
  18. package/dist/core/areas/{api → rest}/get.server.d.ts +4 -2
  19. package/dist/core/areas/rest/get.server.js +45 -0
  20. package/dist/core/areas/rest/index.server.d.ts +6 -0
  21. package/dist/core/areas/rest/index.server.js +3 -0
  22. package/dist/core/areas/{api → rest}/update.server.d.ts +4 -2
  23. package/dist/core/areas/rest/update.server.js +43 -0
  24. package/dist/core/collections/auth/fields.d.ts +2 -182
  25. package/dist/core/collections/auth/hooks/before-upsert/augment-fields-password.server.d.ts +1 -1
  26. package/dist/core/collections/config/augment-auth.server.js +1 -1
  27. package/dist/core/collections/config/augment-nested.server.js +1 -1
  28. package/dist/core/collections/config/augment-panel.d.ts +1 -1
  29. package/dist/core/collections/config/augment-upload.js +2 -2
  30. package/dist/core/collections/config/augment-upload.server.js +4 -1
  31. package/dist/core/collections/operations/duplicate.js +31 -12
  32. package/dist/core/collections/operations/updateById.js +6 -5
  33. package/dist/core/collections/{api → rest}/create.server.d.ts +4 -2
  34. package/dist/core/collections/rest/create.server.js +37 -0
  35. package/dist/core/collections/{api → rest}/delete.server.d.ts +4 -2
  36. package/dist/core/collections/rest/delete.server.js +37 -0
  37. package/dist/core/collections/{api → rest}/deleteById.server.d.ts +4 -2
  38. package/dist/core/collections/rest/deleteById.server.js +21 -0
  39. package/dist/core/collections/{api → rest}/duplicate.server.d.ts +1 -1
  40. package/dist/core/collections/rest/duplicate.server.js +20 -0
  41. package/dist/core/collections/{api → rest}/get.server.d.ts +4 -2
  42. package/dist/core/collections/rest/get.server.js +50 -0
  43. package/dist/core/collections/{api → rest}/getById.server.d.ts +4 -2
  44. package/dist/core/collections/rest/getById.server.js +35 -0
  45. package/dist/core/collections/rest/index.server.d.ts +16 -0
  46. package/dist/core/collections/rest/index.server.js +16 -0
  47. package/dist/core/collections/{api → rest}/updateById.server.d.ts +4 -2
  48. package/dist/core/collections/rest/updateById.server.js +44 -0
  49. package/dist/core/collections/upload/disk/delete.server.d.ts +1 -1
  50. package/dist/core/collections/upload/disk/delete.server.js +48 -1
  51. package/dist/core/collections/upload/hooks/clean-up-files.server.js +2 -2
  52. package/dist/core/collections/upload/hooks/convert-base64.server.d.ts +1 -1
  53. package/dist/core/collections/upload/hooks/extract-path.server.d.ts +2 -2
  54. package/dist/core/collections/upload/hooks/extract-path.server.js +1 -1
  55. package/dist/core/collections/upload/hooks/handle-path-creation.server.d.ts +1 -1
  56. package/dist/core/collections/upload/hooks/process-file-upload.server.d.ts +1 -1
  57. package/dist/core/collections/upload/hooks/process-file-upload.server.js +3 -3
  58. package/dist/core/config/auth/better-auth.server.d.ts +2 -2
  59. package/dist/core/config/client/augment-directories.js +1 -1
  60. package/dist/core/config/config-context.server.d.ts +3 -3
  61. package/dist/core/config/server/augment-directories.server.js +1 -1
  62. package/dist/core/config/server/augment-panel-access.server.d.ts +1 -1
  63. package/dist/core/config/server/build-config.server.d.ts +11 -11
  64. package/dist/core/config/server/validate.server.js +51 -31
  65. package/dist/core/config/shared/find-thumbnail.js +13 -13
  66. package/dist/core/config/shared/find-title.js +13 -13
  67. package/dist/core/config/shared/upload-directories.js +1 -1
  68. package/dist/core/constant.d.ts +1 -1
  69. package/dist/core/constant.js +1 -1
  70. package/dist/core/constant.server.d.ts +1 -0
  71. package/dist/core/constant.server.js +2 -0
  72. package/dist/core/dev/cache/index.server.js +9 -9
  73. package/dist/core/dev/cli/build/index.d.ts +1 -0
  74. package/dist/core/dev/cli/build/index.js +37 -8
  75. package/dist/core/dev/cli/build/templates.d.ts +1 -0
  76. package/dist/core/dev/cli/build/templates.js +24 -0
  77. package/dist/core/dev/cli/clear/index.server.js +3 -2
  78. package/dist/core/dev/cli/generate/index.server.js +3 -2
  79. package/dist/core/dev/cli/index.js +20 -0
  80. package/dist/core/dev/cli/init/index.server.js +4 -4
  81. package/dist/core/dev/cli/init/templates.d.ts +1 -1
  82. package/dist/core/dev/cli/init/templates.js +2 -2
  83. package/dist/core/dev/cli/util/log.server.d.ts +1 -0
  84. package/dist/core/dev/cli/util/log.server.js +4 -0
  85. package/dist/core/dev/cli/util/package-manager.server.d.ts +9 -0
  86. package/dist/core/dev/cli/{init/package-manager-util.server.js → util/package-manager.server.js} +15 -0
  87. package/dist/core/dev/cli/util/package.server.d.ts +9 -0
  88. package/dist/core/dev/cli/{init/get-package-info.server.js → util/package.server.js} +10 -0
  89. package/dist/core/dev/generate/routes/common.server.d.ts +10 -1
  90. package/dist/core/dev/generate/routes/common.server.js +248 -29
  91. package/dist/core/dev/generate/routes/index.server.d.ts +7 -1
  92. package/dist/core/dev/generate/routes/index.server.js +16 -55
  93. package/dist/core/dev/generate/routes/util.server.d.ts +6 -16
  94. package/dist/core/dev/generate/routes/util.server.js +8 -21
  95. package/dist/core/dev/generate/types/index.server.js +22 -20
  96. package/dist/core/dev/vite/index.server.js +22 -6
  97. package/dist/core/errors/handler.server.d.ts +22 -1
  98. package/dist/core/errors/handler.server.js +25 -2
  99. package/dist/core/errors/index.d.ts +0 -1
  100. package/dist/core/errors/index.js +0 -1
  101. package/dist/core/fields/builders/boolean-builder.d.ts +3 -1
  102. package/dist/core/fields/builders/boolean-builder.js +3 -0
  103. package/dist/core/fields/builders/field-builder.d.ts +35 -2
  104. package/dist/core/fields/builders/field-builder.js +33 -2
  105. package/dist/core/fields/builders/form-field-builder.d.ts +71 -12
  106. package/dist/core/fields/builders/form-field-builder.js +96 -6
  107. package/dist/core/fields/builders/select-builder.d.ts +4 -1
  108. package/dist/core/fields/builders/select-builder.js +3 -0
  109. package/dist/core/fields/util.d.ts +9 -17
  110. package/dist/core/fields/util.js +49 -83
  111. package/dist/core/handlers/routes.server.d.ts +70 -1
  112. package/dist/core/handlers/routes.server.js +71 -4
  113. package/dist/core/naming.d.ts +34 -0
  114. package/dist/core/naming.js +39 -0
  115. package/dist/core/operations/blocks/diff.server.js +1 -1
  116. package/dist/core/operations/blocks/extract.server.js +1 -1
  117. package/dist/core/operations/configMap/buildTreeMap.d.ts +3 -2
  118. package/dist/core/operations/configMap/buildTreeMap.js +1 -1
  119. package/dist/core/operations/configMap/index.d.ts +2 -1
  120. package/dist/core/operations/configMap/index.js +13 -13
  121. package/dist/core/operations/configMap/types.d.ts +2 -2
  122. package/dist/core/operations/hooks/before-read/process-document-fields.server.js +14 -17
  123. package/dist/core/operations/hooks/before-upsert/data-config-map.server.d.ts +1 -1
  124. package/dist/core/operations/hooks/before-upsert/data-config-map.server.js +1 -1
  125. package/dist/core/operations/hooks/before-upsert/handle-new-version.server.d.ts +1 -1
  126. package/dist/core/operations/hooks/before-upsert/original-config-map.server.d.ts +1 -1
  127. package/dist/core/operations/hooks/before-upsert/original-config-map.server.js +1 -1
  128. package/dist/core/operations/hooks/before-upsert/set-default-values.server.d.ts +3 -5
  129. package/dist/core/operations/hooks/before-upsert/set-default-values.server.js +10 -15
  130. package/dist/core/operations/hooks/before-upsert/validate-fields.server.d.ts +1 -1
  131. package/dist/core/operations/hooks/before-upsert/validate-fields.server.js +49 -31
  132. package/dist/core/operations/relations/extract.server.js +5 -5
  133. package/dist/core/operations/shared/fallback-data-from-original.js +2 -2
  134. package/dist/core/operations/tree/diff.server.js +1 -1
  135. package/dist/core/operations/tree/extract.server.js +1 -1
  136. package/dist/core/plugins/api-init/index.server.js +10 -5
  137. package/dist/core/plugins/cache/cache.server.js +4 -4
  138. package/dist/core/rime.server.d.ts +10 -10
  139. package/dist/core/rime.server.js +5 -1
  140. package/dist/fields/blocks/component/AddBlockButton.svelte +7 -7
  141. package/dist/fields/blocks/component/AddBlockButton.svelte.d.ts +2 -2
  142. package/dist/fields/blocks/component/Blocks.svelte +6 -7
  143. package/dist/fields/blocks/component/props.d.ts +2 -2
  144. package/dist/fields/blocks/index.d.ts +1 -1
  145. package/dist/fields/blocks/index.js +3 -3
  146. package/dist/fields/blocks/index.server.js +1 -1
  147. package/dist/fields/checkbox/component/Checkbox.svelte +2 -2
  148. package/dist/fields/checkbox/component/props.d.ts +2 -2
  149. package/dist/fields/checkbox/index.server.d.ts +1 -2
  150. package/dist/fields/checkbox/index.server.js +1 -10
  151. package/dist/fields/combobox/component/ComboBox.svelte +3 -3
  152. package/dist/fields/combobox/component/props.d.ts +2 -2
  153. package/dist/fields/combobox/index.server.d.ts +1 -2
  154. package/dist/fields/combobox/index.server.js +2 -11
  155. package/dist/fields/component/index.d.ts +1 -1
  156. package/dist/fields/date/component/Date.svelte +4 -4
  157. package/dist/fields/date/component/Date.svelte.d.ts +2 -2
  158. package/dist/fields/date/index.d.ts +3 -1
  159. package/dist/fields/date/index.js +3 -0
  160. package/dist/fields/date/index.server.d.ts +1 -2
  161. package/dist/fields/date/index.server.js +1 -10
  162. package/dist/fields/email/component/Email.svelte +5 -6
  163. package/dist/fields/email/component/props.d.ts +2 -3
  164. package/dist/fields/email/index.d.ts +3 -2
  165. package/dist/fields/email/index.js +5 -2
  166. package/dist/fields/email/index.server.d.ts +0 -3
  167. package/dist/fields/email/index.server.js +0 -9
  168. package/dist/fields/group/component/Group.svelte +9 -15
  169. package/dist/fields/group/component/Group.svelte.d.ts +2 -2
  170. package/dist/fields/group/index.d.ts +4 -2
  171. package/dist/fields/group/index.server.js +2 -2
  172. package/dist/fields/index.server.d.ts +1 -4
  173. package/dist/fields/index.server.js +17 -13
  174. package/dist/fields/link/component/Link.svelte +5 -5
  175. package/dist/fields/link/component/RessourceInput.svelte +1 -1
  176. package/dist/fields/link/component/props.d.ts +2 -2
  177. package/dist/fields/link/index.d.ts +5 -2
  178. package/dist/fields/link/index.js +10 -11
  179. package/dist/fields/link/runtime.d.ts +2 -0
  180. package/dist/fields/link/runtime.js +1 -0
  181. package/dist/fields/link/{index.server.d.ts → runtime.server.d.ts} +1 -2
  182. package/dist/fields/link/{index.server.js → runtime.server.js} +2 -11
  183. package/dist/fields/number/component/Number.svelte +6 -6
  184. package/dist/fields/number/component/props.d.ts +2 -2
  185. package/dist/fields/number/index.d.ts +4 -10
  186. package/dist/fields/number/index.js +3 -4
  187. package/dist/fields/number/index.server.d.ts +1 -2
  188. package/dist/fields/number/index.server.js +1 -10
  189. package/dist/fields/radio/component/Radio.svelte +6 -7
  190. package/dist/fields/radio/component/props.d.ts +2 -2
  191. package/dist/fields/radio/index.server.d.ts +1 -2
  192. package/dist/fields/radio/index.server.js +2 -11
  193. package/dist/fields/relation/client.d.ts +1 -1
  194. package/dist/fields/relation/client.js +1 -1
  195. package/dist/fields/relation/component/Cell.svelte +1 -1
  196. package/dist/fields/relation/component/Relation.svelte +19 -15
  197. package/dist/fields/relation/component/Relation.svelte.d.ts +2 -2
  198. package/dist/fields/relation/component/upload/Browse.svelte +1 -1
  199. package/dist/fields/relation/index.d.ts +8 -5
  200. package/dist/fields/relation/index.js +8 -47
  201. package/dist/fields/relation/runtime.d.ts +5 -0
  202. package/dist/fields/relation/runtime.js +4 -0
  203. package/dist/fields/relation/runtime.server.d.ts +8 -0
  204. package/dist/fields/relation/runtime.server.js +49 -0
  205. package/dist/fields/rich-text/component/RichText.svelte +5 -5
  206. package/dist/fields/rich-text/component/props.d.ts +2 -2
  207. package/dist/fields/rich-text/core/features/fields/extension.d.ts +2 -2
  208. package/dist/fields/rich-text/core/features/fields/fields.svelte +2 -2
  209. package/dist/fields/rich-text/core/features/link/component/link-selector.svelte +1 -1
  210. package/dist/fields/rich-text/core/features/resource/resource-extension.d.ts +1 -1
  211. package/dist/fields/rich-text/core/features/resource/resource.svelte +1 -1
  212. package/dist/fields/rich-text/core/features/upload/upload-extension.d.ts +1 -1
  213. package/dist/fields/rich-text/core/features/upload/upload.svelte +1 -1
  214. package/dist/fields/rich-text/index.d.ts +2 -0
  215. package/dist/fields/rich-text/index.js +7 -2
  216. package/dist/fields/rich-text/index.server.d.ts +1 -2
  217. package/dist/fields/rich-text/index.server.js +1 -10
  218. package/dist/fields/select/component/Select.svelte +16 -16
  219. package/dist/fields/select/component/props.d.ts +2 -2
  220. package/dist/fields/select/index.d.ts +2 -0
  221. package/dist/fields/select/index.js +3 -0
  222. package/dist/fields/select/index.server.d.ts +1 -2
  223. package/dist/fields/select/index.server.js +2 -17
  224. package/dist/fields/slug/component/Slug.svelte +14 -10
  225. package/dist/fields/slug/component/Slug.svelte.d.ts +2 -2
  226. package/dist/fields/slug/index.d.ts +5 -2
  227. package/dist/fields/slug/index.js +3 -0
  228. package/dist/fields/slug/index.server.d.ts +1 -2
  229. package/dist/fields/slug/index.server.js +1 -10
  230. package/dist/fields/tabs/component/Tabs.svelte +15 -15
  231. package/dist/fields/tabs/component/Tabs.svelte.d.ts +2 -2
  232. package/dist/fields/tabs/index.d.ts +4 -16
  233. package/dist/fields/tabs/index.js +1 -8
  234. package/dist/fields/tabs/index.server.js +3 -3
  235. package/dist/fields/text/component/Text.svelte +5 -5
  236. package/dist/fields/text/component/props.d.ts +2 -3
  237. package/dist/fields/text/index.d.ts +4 -10
  238. package/dist/fields/text/index.js +3 -4
  239. package/dist/fields/text/index.server.d.ts +1 -2
  240. package/dist/fields/text/index.server.js +1 -10
  241. package/dist/fields/textarea/component/TextArea.svelte +3 -3
  242. package/dist/fields/textarea/component/props.d.ts +2 -2
  243. package/dist/fields/textarea/index.d.ts +4 -1
  244. package/dist/fields/textarea/index.js +3 -0
  245. package/dist/fields/textarea/index.server.d.ts +1 -2
  246. package/dist/fields/textarea/index.server.js +1 -10
  247. package/dist/fields/time/component/Time.svelte +5 -5
  248. package/dist/fields/time/component/Time.svelte.d.ts +1 -1
  249. package/dist/fields/time/component/props.d.ts +2 -2
  250. package/dist/fields/time/index.d.ts +2 -0
  251. package/dist/fields/time/index.js +3 -0
  252. package/dist/fields/time/index.server.d.ts +1 -2
  253. package/dist/fields/time/index.server.js +1 -10
  254. package/dist/fields/toggle/component/Toggle.svelte +3 -3
  255. package/dist/fields/toggle/component/Toggle.svelte.d.ts +1 -1
  256. package/dist/fields/toggle/component/props.d.ts +2 -2
  257. package/dist/fields/toggle/index.d.ts +2 -1
  258. package/dist/fields/toggle/index.server.d.ts +1 -2
  259. package/dist/fields/toggle/index.server.js +1 -10
  260. package/dist/fields/tree/component/AddItemButton.svelte +1 -2
  261. package/dist/fields/tree/component/Tree.svelte +6 -6
  262. package/dist/fields/tree/component/TreeBlock.svelte +5 -12
  263. package/dist/fields/tree/component/props.d.ts +3 -3
  264. package/dist/fields/tree/index.d.ts +3 -1
  265. package/dist/fields/tree/index.js +2 -2
  266. package/dist/fields/types.d.ts +11 -5
  267. package/dist/index.d.ts +8 -3
  268. package/dist/index.js +7 -3
  269. package/dist/panel/components/fields/FieldsPreview.svelte +4 -5
  270. package/dist/panel/components/fields/Hint.svelte +5 -4
  271. package/dist/panel/components/fields/Hint.svelte.d.ts +3 -2
  272. package/dist/panel/components/fields/Label.svelte +6 -11
  273. package/dist/panel/components/fields/Label.svelte.d.ts +3 -2
  274. package/dist/panel/components/fields/LabelFor.svelte +4 -4
  275. package/dist/panel/components/fields/LabelFor.svelte.d.ts +2 -1
  276. package/dist/panel/components/fields/RenderFields.svelte +11 -16
  277. package/dist/panel/components/fields/{root.svelte.d.ts → fieldset.svelte.d.ts} +1 -1
  278. package/dist/panel/components/fields/{root.svelte.js → fieldset.svelte.js} +1 -1
  279. package/dist/panel/components/fields/index.d.ts +5 -5
  280. package/dist/panel/components/fields/index.js +2 -2
  281. package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte +1 -1
  282. package/dist/panel/components/sections/document/AuthFooter.svelte +2 -7
  283. package/dist/panel/components/sections/document/ButtonStatus.svelte +1 -1
  284. package/dist/panel/components/sections/document/CurrentlyEdited.svelte +1 -1
  285. package/dist/panel/components/sections/document/Settings.svelte +1 -1
  286. package/dist/panel/components/sections/live/LiveEditPanel.svelte +2 -2
  287. package/dist/panel/context/collection.svelte.js +10 -10
  288. package/dist/panel/context/documentForm.svelte.d.ts +8 -21
  289. package/dist/panel/context/documentForm.svelte.js +46 -54
  290. package/dist/panel/context/form.svelte.d.ts +6 -3
  291. package/dist/panel/context/form.svelte.js +22 -18
  292. package/dist/panel/context/live.svelte.js +1 -1
  293. package/dist/panel/index.d.ts +9 -1
  294. package/dist/panel/index.js +7 -1
  295. package/dist/panel/pages/area/actions.server.d.ts +2 -21
  296. package/dist/panel/pages/area/actions.server.js +28 -27
  297. package/dist/panel/pages/area/load.server.d.ts +2 -17
  298. package/dist/panel/pages/area/load.server.js +37 -46
  299. package/dist/panel/pages/auth/fields.d.ts +4 -4
  300. package/dist/panel/pages/auth/fields.js +6 -22
  301. package/dist/panel/pages/auth/reset-password/ResetPassword.svelte +3 -10
  302. package/dist/panel/pages/auth/sign-in/SignIn.svelte +7 -1
  303. package/dist/panel/pages/collection/load.server.d.ts +6 -6
  304. package/dist/panel/pages/collection/load.server.js +70 -72
  305. package/dist/panel/pages/collection-document/actions.server.d.ts +1 -1
  306. package/dist/panel/pages/collection-document/actions.server.js +78 -70
  307. package/dist/panel/pages/collection-document/load.server.d.ts +5 -20
  308. package/dist/panel/pages/collection-document/load.server.js +80 -82
  309. package/dist/server.d.ts +7 -0
  310. package/dist/server.js +7 -0
  311. package/dist/types.d.ts +1 -0
  312. package/dist/util/doc.js +15 -17
  313. package/dist/util/index.d.ts +9 -1
  314. package/dist/util/index.js +12 -1
  315. package/package.json +8 -50
  316. package/dist/core/api/index.d.ts +0 -7
  317. package/dist/core/api/index.js +0 -10
  318. package/dist/core/api/index.server.d.ts +0 -3
  319. package/dist/core/api/index.server.js +0 -3
  320. package/dist/core/areas/api/get.server.js +0 -36
  321. package/dist/core/areas/api/index.server.d.ts +0 -7
  322. package/dist/core/areas/api/index.server.js +0 -4
  323. package/dist/core/areas/api/update.server.js +0 -33
  324. package/dist/core/collections/api/create.server.js +0 -29
  325. package/dist/core/collections/api/delete.server.js +0 -32
  326. package/dist/core/collections/api/deleteById.server.js +0 -16
  327. package/dist/core/collections/api/duplicate.server.js +0 -18
  328. package/dist/core/collections/api/get.server.js +0 -45
  329. package/dist/core/collections/api/getById.server.js +0 -30
  330. package/dist/core/collections/api/index.server.d.ts +0 -17
  331. package/dist/core/collections/api/index.server.js +0 -9
  332. package/dist/core/collections/api/updateById.server.js +0 -38
  333. package/dist/core/dev/cli/init/get-package-info.server.d.ts +0 -1
  334. package/dist/core/dev/cli/init/package-manager-util.server.d.ts +0 -3
  335. package/dist/core/dev/generate/routes/area.server.d.ts +0 -7
  336. package/dist/core/dev/generate/routes/area.server.js +0 -69
  337. package/dist/core/dev/generate/routes/collection.server.d.ts +0 -14
  338. package/dist/core/dev/generate/routes/collection.server.js +0 -129
  339. package/dist/fields/relation/index.server.d.ts +0 -4
  340. package/dist/fields/relation/index.server.js +0 -13
  341. package/dist/live.d.ts +0 -4
  342. package/dist/live.js +0 -4
  343. package/dist/panel/index.server.d.ts +0 -4
  344. package/dist/panel/index.server.js +0 -4
  345. package/dist/panel/pages/auth/index.d.ts +0 -4
  346. package/dist/panel/pages/auth/index.js +0 -4
  347. package/dist/panel/pages/auth/index.server.d.ts +0 -18
  348. package/dist/panel/pages/auth/index.server.js +0 -12
  349. package/dist/panel/pages/index.actions.server.d.ts +0 -13
  350. package/dist/panel/pages/index.actions.server.js +0 -10
  351. package/dist/panel/pages/index.load.server.d.ts +0 -23
  352. package/dist/panel/pages/index.load.server.js +0 -16
  353. package/dist/panel/ui.d.ts +0 -4
  354. package/dist/panel/ui.js +0 -5
  355. /package/dist/core/dev/cli/{util.server.d.ts → util/prompt.server.d.ts} +0 -0
  356. /package/dist/core/dev/cli/{util.server.js → util/prompt.server.js} +0 -0
@@ -1,9 +1,11 @@
1
+ import type { DataType } from './form-field-builder.js';
1
2
  import { FormFieldBuilder } from './form-field-builder.js';
2
- import type { DefaultValueFn, FormField, Option } from '../../../fields/types.js';
3
+ import type { DefaultValueFn, FieldValidationFunc, FormField, Option } from '../../../fields/types.js';
3
4
  type FieldWithOptions = FormField & {
4
5
  options: Option[];
5
6
  defaultValue?: (string | DefaultValueFn<string>) | (string[] | DefaultValueFn<string[]>);
6
7
  many?: boolean;
8
+ validate?: FieldValidationFunc<FieldWithOptions>;
7
9
  };
8
10
  declare class PickFieldBuilder<T extends FieldWithOptions = FieldWithOptions> extends FormFieldBuilder<T> {
9
11
  constructor(name: string, type: string);
@@ -17,6 +19,7 @@ declare class PickFieldBuilder<T extends FieldWithOptions = FieldWithOptions> ex
17
19
  }
18
20
  export declare class PickOneFieldBuilder<T extends FieldWithOptions = FieldWithOptions> extends PickFieldBuilder<T> {
19
21
  defaultValue(value: string | DefaultValueFn<string>): this;
22
+ get dataType(): DataType;
20
23
  }
21
24
  export declare class PickManyFieldBuilder<T extends FieldWithOptions = FieldWithOptions> extends PickFieldBuilder<T> {
22
25
  defaultValue(value: string[] | DefaultValueFn<string[]>): this;
@@ -61,6 +61,9 @@ export class PickOneFieldBuilder extends PickFieldBuilder {
61
61
  this.field.defaultValue = value;
62
62
  return this;
63
63
  }
64
+ get dataType() {
65
+ return 'text';
66
+ }
64
67
  }
65
68
  export class PickManyFieldBuilder extends PickFieldBuilder {
66
69
  defaultValue(value) {
@@ -1,6 +1,7 @@
1
1
  import type { Field, FormField, SeparatorField } from '../../fields/types.js';
2
2
  import type { Dic } from '../../util/types.js';
3
- import type { FieldBuilder } from './builders';
3
+ import type { FormFieldBuilder } from './builders/form-field-builder.js';
4
+ import type { FieldBuilder } from './builders/index.js';
4
5
  /**
5
6
  * Checks if a field is a presentative field (currently only separator fields).
6
7
  * Presentative fields are used for UI organization and don't store data.
@@ -10,24 +11,15 @@ export declare const isPresentative: (field: Field) => field is SeparatorField;
10
11
  * Checks if a field is a form field (has a name property).
11
12
  * Form fields are fields that can store data in documents.
12
13
  */
13
- export declare const isFormField: (field: Field) => field is FormField;
14
+ export declare const isFormField: <T extends Field>(field: FieldBuilder<T>) => field is FormFieldBuilder<T & FormField>;
14
15
  /**
15
16
  * Checks if a form field is not hidden.
16
17
  */
17
- export declare const isNotHidden: (field: FormField) => boolean;
18
+ export declare const isNotHidden: <T extends FormField>(field: FormFieldBuilder<T>) => boolean;
18
19
  /**
19
20
  * Checks if a field has live updates enabled.
20
21
  */
21
22
  export declare const isLiveField: (field: Field) => boolean | undefined;
22
- /**
23
- * Flattens a nested field structure into an array of form fields.
24
- * Handles special field types like tabs, tree, and blocks.
25
- *
26
- * @example
27
- * // Flattens a tabs field into its constituent form fields
28
- * const fields = [tabsField].reduce(toFormFields, []);
29
- */
30
- export declare function toFormFields(prev: any[], curr: any): any;
31
23
  /**
32
24
  * Creates an object with empty values based on field configurations.
33
25
  * Uses defaultValue if specified, otherwise undefined.
@@ -43,7 +35,7 @@ export declare function toFormFields(prev: any[], curr: any): any;
43
35
  * ]}
44
36
  * ]);
45
37
  */
46
- export declare const emptyValuesFromFieldConfig: <T extends FormField>(arr: T[]) => Dic;
38
+ export declare const emptyValuesFromFieldConfig: <T extends FormFieldBuilder>(arr: T[]) => Dic;
47
39
  /**
48
40
  * Converts a path with numeric indices to a regex pattern
49
41
  * Numbers between dots or between dot and colon are converted to \d+
@@ -59,13 +51,13 @@ export declare function pathToRegex(path: string): RegExp;
59
51
  * Retrieves a field configuration by its dot-notation path
60
52
  * @example
61
53
  * // Get the title field in the attributes group
62
- * const titleField = getFieldConfigByPath('attributes.title', collection.fields);
54
+ * const titleField = getFieldAtPath('attributes.title', collection.fields);
63
55
  *
64
56
  * // Get the title field in a specific block
65
- * const titleField = getFieldConfigByPath('attributes.layout.2:blockType.title', collection.fields);
57
+ * const titleField = getFieldAtPath('attributes.layout.2:blockType.title', collection.fields);
66
58
  *
67
59
  */
68
- export declare const getFieldConfigByPath: (path: string, fields: Field[]) => FormField | undefined;
60
+ export declare const getFieldAtPath: (path: string, fields: FieldBuilder[]) => FormFieldBuilder<FormField> | undefined;
69
61
  /**
70
62
  * Traverses a FieldBuilder[] tree and returns the subset of builders to pass to
71
63
  * RenderFields, along with the path prefix those builders should be rendered at.
@@ -74,7 +66,7 @@ export declare const getFieldConfigByPath: (path: string, fields: Field[]) => Fo
74
66
  * Blocks are treated as endpoints — the blocks builder itself is returned
75
67
  * regardless of any index:blockType suffix in the path.
76
68
  */
77
- export declare function getFieldBuildersAtPath(fieldPath: string, builders: FieldBuilder[], parentPath?: string): {
69
+ export declare function getFieldListAtPath(fieldPath: string, fields: FieldBuilder[], parentPath?: string): {
78
70
  fields: FieldBuilder[];
79
71
  path: string;
80
72
  };
@@ -1,7 +1,7 @@
1
- import { BlocksBuilder, isBlocksFieldRaw } from '../../fields/blocks/index.js';
2
- import { GroupFieldBuilder, isGroupFieldRaw } from '../../fields/group/index.js';
3
- import { isTabsFieldRaw, TabsBuilder } from '../../fields/tabs/index.js';
4
- import { isTreeFieldRaw, TreeBuilder } from '../../fields/tree/index.js';
1
+ import { BlocksBuilder } from '../../fields/blocks/index.js';
2
+ import { GroupFieldBuilder } from '../../fields/group/index.js';
3
+ import { TabsBuilder } from '../../fields/tabs/index.js';
4
+ import { TreeBuilder } from '../../fields/tree/index.js';
5
5
  import { normalizeFieldPath } from '../../util/doc.js';
6
6
  /**
7
7
  * Checks if a field is a presentative field (currently only separator fields).
@@ -12,48 +12,15 @@ export const isPresentative = (field) => ['separator'].includes(field.type);
12
12
  * Checks if a field is a form field (has a name property).
13
13
  * Form fields are fields that can store data in documents.
14
14
  */
15
- export const isFormField = (field) => 'name' in field;
15
+ export const isFormField = (field) => field.name !== '';
16
16
  /**
17
17
  * Checks if a form field is not hidden.
18
18
  */
19
- export const isNotHidden = (field) => !field.hidden;
19
+ export const isNotHidden = (field) => !field.get.hidden;
20
20
  /**
21
21
  * Checks if a field has live updates enabled.
22
22
  */
23
23
  export const isLiveField = (field) => field.live;
24
- /**
25
- * Flattens a nested field structure into an array of form fields.
26
- * Handles special field types like tabs, tree, and blocks.
27
- *
28
- * @example
29
- * // Flattens a tabs field into its constituent form fields
30
- * const fields = [tabsField].reduce(toFormFields, []);
31
- */
32
- export function toFormFields(prev, curr) {
33
- if (curr.type === 'tabs') {
34
- return curr.tabs.reduce(toFormFields, prev);
35
- }
36
- else if (curr.type === 'tree') {
37
- curr = {
38
- ...curr,
39
- fields: curr.fields.reduce(toFormFields, [])
40
- };
41
- }
42
- else if (curr.type === 'blocks') {
43
- curr = {
44
- ...curr,
45
- blocks: curr.blocks.map((b) => ({
46
- ...b,
47
- fields: b.fields.reduce(toFormFields, [])
48
- }))
49
- };
50
- }
51
- else if ('fields' in curr) {
52
- return curr.fields.reduce(toFormFields, prev);
53
- }
54
- prev.push(curr);
55
- return prev;
56
- }
57
24
  /**
58
25
  * Creates an object with empty values based on field configurations.
59
26
  * Uses defaultValue if specified, otherwise undefined.
@@ -73,24 +40,23 @@ export const emptyValuesFromFieldConfig = (arr) => {
73
40
  return Object.fromEntries(arr.map((config) => {
74
41
  let emptyValue;
75
42
  // Handle group fields - create nested object structure
76
- if (isGroupFieldRaw(config)) {
77
- emptyValue = emptyValuesFromFieldConfig(config.fields.filter(isFormField));
43
+ if (config instanceof GroupFieldBuilder) {
44
+ emptyValue = emptyValuesFromFieldConfig(config.get.fields.filter(isFormField));
78
45
  }
79
46
  // Handle tabs fields - create nested object structure for each tab
80
- else if (isTabsFieldRaw(config)) {
47
+ else if (config instanceof TabsBuilder) {
81
48
  const tabsValue = {};
82
- const tabs = config.tabs;
49
+ const tabs = config.get.tabs;
83
50
  for (const tab of tabs) {
84
51
  if ('fields' in tab) {
85
- tabsValue[tab.name] = emptyValuesFromFieldConfig(tab.fields.filter(isFormField));
52
+ tabsValue[tab.name] = emptyValuesFromFieldConfig(tab.get.fields.filter(isFormField));
86
53
  }
87
54
  }
88
55
  emptyValue = tabsValue;
89
56
  }
90
57
  // Handle default values
91
- else if ('defaultValue' in config) {
92
- emptyValue =
93
- typeof config.defaultValue === 'function' ? config.defaultValue() : config.defaultValue;
58
+ else {
59
+ emptyValue = config.run.defaultValue();
94
60
  }
95
61
  return [config.name, emptyValue];
96
62
  }));
@@ -118,13 +84,13 @@ export function pathToRegex(path) {
118
84
  * Retrieves a field configuration by its dot-notation path
119
85
  * @example
120
86
  * // Get the title field in the attributes group
121
- * const titleField = getFieldConfigByPath('attributes.title', collection.fields);
87
+ * const titleField = getFieldAtPath('attributes.title', collection.fields);
122
88
  *
123
89
  * // Get the title field in a specific block
124
- * const titleField = getFieldConfigByPath('attributes.layout.2:blockType.title', collection.fields);
90
+ * const titleField = getFieldAtPath('attributes.layout.2:blockType.title', collection.fields);
125
91
  *
126
92
  */
127
- export const getFieldConfigByPath = (path, fields) => {
93
+ export const getFieldAtPath = (path, fields) => {
128
94
  const parts = path.split('.');
129
95
  const findInFields = (currentFields, remainingParts) => {
130
96
  if (remainingParts.length === 0)
@@ -132,10 +98,10 @@ export const getFieldConfigByPath = (path, fields) => {
132
98
  const currentPart = remainingParts[0];
133
99
  for (const field of currentFields) {
134
100
  // Handle tabs
135
- if (isTabsFieldRaw(field)) {
136
- const tab = field.tabs.find((t) => t.name === currentPart);
101
+ if (field instanceof TabsBuilder) {
102
+ const tab = field.get.tabs.find((t) => t.name === currentPart);
137
103
  if (tab) {
138
- return findInFields(tab.fields, remainingParts.slice(1));
104
+ return findInFields(tab.get.fields, remainingParts.slice(1));
139
105
  }
140
106
  continue;
141
107
  }
@@ -145,22 +111,22 @@ export const getFieldConfigByPath = (path, fields) => {
145
111
  if (remainingParts.length === 1) {
146
112
  return field;
147
113
  }
148
- if (isGroupFieldRaw(field)) {
149
- return findInFields(field.fields, remainingParts.slice(1));
114
+ if (field instanceof GroupFieldBuilder) {
115
+ return findInFields(field.get.fields, remainingParts.slice(1));
150
116
  }
151
117
  // Handle blocks
152
- if (isBlocksFieldRaw(field) && remainingParts.length > 1) {
118
+ if (field instanceof BlocksBuilder && remainingParts.length > 1) {
153
119
  // const blockPartPattern = /:[a-zA-Z0-9]+/
154
120
  const blockType = remainingParts[1].split(':')[1];
155
121
  if (blockType) {
156
- const block = field.blocks.find((b) => b.name === blockType);
122
+ const block = field.get.blocks.find((b) => b.name === blockType);
157
123
  if (block) {
158
- return findInFields(block.fields, remainingParts.slice(2));
124
+ return findInFields(block.get.fields, remainingParts.slice(2));
159
125
  }
160
126
  }
161
127
  }
162
- if (isTreeFieldRaw(field)) {
163
- return findInFields(field.fields, remainingParts.slice(2));
128
+ if (field instanceof TreeBuilder) {
129
+ return findInFields(field.get.fields, remainingParts.slice(2));
164
130
  }
165
131
  }
166
132
  }
@@ -177,67 +143,67 @@ export const getFieldConfigByPath = (path, fields) => {
177
143
  * Blocks are treated as endpoints — the blocks builder itself is returned
178
144
  * regardless of any index:blockType suffix in the path.
179
145
  */
180
- export function getFieldBuildersAtPath(fieldPath, builders, parentPath = '') {
146
+ export function getFieldListAtPath(fieldPath, fields, parentPath = '') {
181
147
  if (!fieldPath)
182
- return { fields: builders, path: parentPath };
148
+ return { fields, path: parentPath };
183
149
  const dotIndex = fieldPath.indexOf('.');
184
150
  const head = dotIndex === -1 ? fieldPath : fieldPath.slice(0, dotIndex);
185
151
  const tail = dotIndex === -1 ? '' : fieldPath.slice(dotIndex + 1);
186
152
  const isEndpoint = fieldPath.split('.').length === 1;
187
153
  const nextParentPath = normalizeFieldPath(`${parentPath}${parentPath ? '.' : ''}${head}`);
188
- for (const builder of builders) {
154
+ for (const field of fields) {
189
155
  // ── Tabs container: navigate into the matching tab
190
- if (builder instanceof TabsBuilder) {
191
- const tab = builder.field.tabs.find((t) => t.name === head);
156
+ if (field instanceof TabsBuilder) {
157
+ const tab = field.field.tabs.find((t) => t.name === head);
192
158
  if (!tab)
193
159
  continue;
194
160
  if (isEndpoint) {
195
161
  // Path targets the tab → return all its inner fields
196
- return { fields: tab.raw.fields, path: nextParentPath };
162
+ return { fields: tab.get.fields, path: nextParentPath };
197
163
  }
198
- return getFieldBuildersAtPath(tail, tab.raw.fields, nextParentPath);
164
+ return getFieldListAtPath(tail, tab.get.fields, nextParentPath);
199
165
  }
200
- if (!isFormField(builder.raw))
166
+ if (!isFormField(field))
201
167
  continue;
202
168
  // ── Group field: navigate into children
203
- if (builder instanceof GroupFieldBuilder && builder.raw.name === head) {
204
- const children = builder.field.fields;
169
+ if (field instanceof GroupFieldBuilder && field.name === head) {
170
+ const children = field.get.fields;
205
171
  if (isEndpoint)
206
172
  return { fields: children, path: nextParentPath };
207
- return getFieldBuildersAtPath(tail, children, nextParentPath);
173
+ return getFieldListAtPath(tail, children, nextParentPath);
208
174
  }
209
175
  // —— Blocks
210
- if (builder instanceof BlocksBuilder && builder.raw.name === head) {
176
+ if (field instanceof BlocksBuilder && field.name === head) {
211
177
  const blockType = tail.split('.')[0]?.split(':')[1];
212
178
  const isInnerBlockLookup = tail.split('.').length > 1;
213
179
  const nextParentPathWithBlockIndex = `${nextParentPath}.${tail.split('.')[0]}`;
214
180
  if (blockType) {
215
- const block = builder.raw.blocks.find((b) => b.name === blockType);
216
- if (!isInnerBlockLookup && block?.raw.fields) {
181
+ const block = field.get.blocks.find((b) => b.name === blockType);
182
+ if (!isInnerBlockLookup && block?.get.fields) {
217
183
  return {
218
- fields: block?.raw.fields,
184
+ fields: block.get.fields,
219
185
  path: normalizeFieldPath(nextParentPathWithBlockIndex)
220
186
  };
221
187
  }
222
188
  if (block) {
223
- return getFieldBuildersAtPath(tail.split('.').slice(1).join('.'), block?.raw.fields, normalizeFieldPath(nextParentPathWithBlockIndex));
189
+ return getFieldListAtPath(tail.split('.').slice(1).join('.'), block.get.fields, normalizeFieldPath(nextParentPathWithBlockIndex));
224
190
  }
225
191
  }
226
- return { fields: [builder], path: parentPath };
192
+ return { fields: [field], path: parentPath };
227
193
  }
228
194
  // Tree
229
- if (builder instanceof TreeBuilder && builder.raw.name === head) {
230
- const children = builder.raw.fields;
195
+ if (field instanceof TreeBuilder && field.name === head) {
196
+ const children = field.get.fields;
231
197
  const nextParentPathWithIndex = `${nextParentPath}.${tail.split('.')[0]}`;
232
198
  if (isEndpoint)
233
199
  return { fields: children, path: nextParentPath };
234
- return getFieldBuildersAtPath(tail.split('.').slice(1).join('.'), children, nextParentPathWithIndex);
200
+ return getFieldListAtPath(tail.split('.').slice(1).join('.'), children, nextParentPathWithIndex);
235
201
  }
236
202
  // Direct unique field match
237
- if (isEndpoint && isFormField(builder.raw) && builder.raw.name === fieldPath) {
238
- return { fields: [builder], path: parentPath };
203
+ if (isEndpoint && isFormField(field) && field.name === fieldPath) {
204
+ return { fields: [field], path: parentPath };
239
205
  }
240
206
  }
241
207
  console.warn(`[LiveEditPanel] fieldPath "${fieldPath}" not found in config fields`);
242
- return { fields: builders, path: parentPath };
208
+ return { fields, path: parentPath };
243
209
  }
@@ -1,2 +1,71 @@
1
- import { type Handle } from '@sveltejs/kit';
1
+ import { areaLoad } from '../../panel/pages/area/load.server.js';
2
+ import { documentLoad } from '../../panel/pages/collection-document/load.server.js';
3
+ import { collectionLoad } from '../../panel/pages/collection/load.server.js';
4
+ import { liveLoad } from '../../panel/pages/live/load.server.js';
5
+ import { checkLiveRedirect } from '../../panel/util/live.server.js';
6
+ import { type Handle, type RequestEvent, type ServerLoadEvent } from '@sveltejs/kit';
7
+ /**
8
+ * Backs the fixed set of generated /panel/[slug=collection|area]/... and
9
+ * /api/[slug=collection|area]/... routes — each of these reads slug/id off
10
+ * event.params itself (a real dynamic route param), so the generated file
11
+ * just passes event straight through, no import needed. The param matchers
12
+ * (src/params/collection.ts, area.ts) already disambiguate collection vs
13
+ * area at the router level, so rest.collection/rest.area need no runtime
14
+ * isArea/id branching — each generated route calls the one method that
15
+ * matches its own folder. Deliberately lives outside rime.server.ts: app
16
+ * authors never touch this, and importing these panel/api wrappers there
17
+ * would make RimeContext's inferred type depend on functions that read
18
+ * event.locals.rime — i.e. on itself.
19
+ */
20
+ export declare const routeHandlers: {
21
+ checkLiveRedirect: typeof checkLiveRedirect;
22
+ panel: {
23
+ load: {
24
+ collection: typeof collectionLoad;
25
+ document: typeof documentLoad;
26
+ documentVersions: (event: ServerLoadEvent) => Promise<import("../../panel/index.js").CollectionDocData<true>>;
27
+ area: typeof areaLoad;
28
+ areaVersions: (event: ServerLoadEvent) => Promise<import("../../panel/index.js").AreaDocData<true>>;
29
+ dashboard: (event: ServerLoadEvent) => Promise<{
30
+ entries: import("../../panel/pages/dashboard/types.js").DashboardEntry[];
31
+ aria: import("../../types.js").Route[];
32
+ }>;
33
+ live: typeof liveLoad;
34
+ signIn: ({ locals }: ServerLoadEvent) => Promise<{
35
+ forgotPasswordEnabled: boolean;
36
+ image: string | null;
37
+ form: {};
38
+ }>;
39
+ forgotPassword: ({ locals }: ServerLoadEvent) => Promise<{
40
+ form: {};
41
+ image: string | null;
42
+ }>;
43
+ resetPassword: ({ locals, url }: ServerLoadEvent) => Promise<{
44
+ image: string | null;
45
+ token: string;
46
+ }>;
47
+ };
48
+ actions: {
49
+ document: import("@sveltejs/kit").Actions;
50
+ area: import("@sveltejs/kit").Actions;
51
+ signIn: (event: RequestEvent) => any;
52
+ };
53
+ };
54
+ rest: {
55
+ collection: {
56
+ get: typeof import("../collections/rest/get.server.js").restGet;
57
+ getById: typeof import("../collections/rest/getById.server.js").restGetById;
58
+ deleteById: typeof import("../collections/rest/deleteById.server.js").restDeleteById;
59
+ delete: typeof import("../collections/rest/delete.server.js").restDelete;
60
+ create: typeof import("../collections/rest/create.server.js").restCreate;
61
+ updateById: typeof import("../collections/rest/updateById.server.js").restUpdateById;
62
+ duplicate: typeof import("../collections/rest/duplicate.server.js").restDuplicate;
63
+ };
64
+ area: {
65
+ get: typeof import("../areas/rest/get.server.js").restGet;
66
+ update: typeof import("../areas/rest/update.server.js").restUpdate;
67
+ };
68
+ };
69
+ };
2
70
  export declare const handleRoutes: Handle;
71
+ export type RouteHandlers = typeof routeHandlers;
@@ -1,13 +1,80 @@
1
+ import { prototypeKebabToSlug } from '../naming.js';
1
2
  import buildNavigation from '../../panel/navigation.js';
3
+ import { areaFormActions } from '../../panel/pages/area/actions.server.js';
4
+ import { areaLoad } from '../../panel/pages/area/load.server.js';
5
+ import { forgotPasswordLoad } from '../../panel/pages/auth/forgot-password/load.server.js';
6
+ import { resetPasswordLoad } from '../../panel/pages/auth/reset-password/load.server.js';
7
+ import { signInActions } from '../../panel/pages/auth/sign-in/actions.server.js';
8
+ import { signInLoad } from '../../panel/pages/auth/sign-in/load.server.js';
9
+ import { collectionFormActions } from '../../panel/pages/collection-document/actions.server.js';
10
+ import { documentLoad } from '../../panel/pages/collection-document/load.server.js';
11
+ import { collectionLoad } from '../../panel/pages/collection/load.server.js';
12
+ import { dashboardLoad } from '../../panel/pages/dashboard/load.server.js';
13
+ import { liveLoad } from '../../panel/pages/live/load.server.js';
14
+ import { checkLiveRedirect } from '../../panel/util/live.server.js';
2
15
  import {} from '@sveltejs/kit';
16
+ import { rest as areaRest } from '../areas/rest/index.server.js';
17
+ import { rest as collectionRest } from '../collections/rest/index.server.js';
18
+ /**
19
+ * Backs the fixed set of generated /panel/[slug=collection|area]/... and
20
+ * /api/[slug=collection|area]/... routes — each of these reads slug/id off
21
+ * event.params itself (a real dynamic route param), so the generated file
22
+ * just passes event straight through, no import needed. The param matchers
23
+ * (src/params/collection.ts, area.ts) already disambiguate collection vs
24
+ * area at the router level, so rest.collection/rest.area need no runtime
25
+ * isArea/id branching — each generated route calls the one method that
26
+ * matches its own folder. Deliberately lives outside rime.server.ts: app
27
+ * authors never touch this, and importing these panel/api wrappers there
28
+ * would make RimeContext's inferred type depend on functions that read
29
+ * event.locals.rime — i.e. on itself.
30
+ */
31
+ export const routeHandlers = {
32
+ checkLiveRedirect,
33
+ panel: {
34
+ load: {
35
+ collection: collectionLoad,
36
+ document: documentLoad,
37
+ documentVersions: (event) => documentLoad(event, true),
38
+ area: areaLoad,
39
+ areaVersions: (event) => areaLoad(event, true),
40
+ dashboard: dashboardLoad,
41
+ live: liveLoad,
42
+ signIn: signInLoad,
43
+ forgotPassword: forgotPasswordLoad,
44
+ resetPassword: resetPasswordLoad
45
+ },
46
+ actions: {
47
+ document: collectionFormActions,
48
+ area: areaFormActions,
49
+ signIn: signInActions.default
50
+ }
51
+ },
52
+ rest: {
53
+ collection: collectionRest,
54
+ area: areaRest
55
+ }
56
+ };
3
57
  export const handleRoutes = async ({ event, resolve }) => {
4
58
  const { rime, user } = event.locals;
5
- const isSignInRoute = event.url.pathname === '/panel/sign-in';
6
- const isPanelRoute = event.url.pathname.startsWith('/panel') && !isSignInRoute;
59
+ const IS_SIGN_IN_ROUTE = event.url.pathname === '/panel/sign-in';
60
+ const IS_API_ROUTE = event.url.pathname.startsWith('/api');
61
+ const IS_PANEL_ROUTE = event.url.pathname.startsWith('/panel') && !IS_SIGN_IN_ROUTE;
62
+ // event.params.slug comes straight from the URL, always kebab-case (see
63
+ // src/params/collection.ts, area.ts). Collection/area slugs themselves are
64
+ // camelCase, so rewrite once here — every downstream handler (panel
65
+ // load/actions, REST) can then keep comparing event.params.slug directly
66
+ // against the config's `slug`. Scoped to routes actually matched via our
67
+ // own [slug=collection]/[slug=area] param matchers (route.id carries the
68
+ // matcher name) — a consumer's own app route can also use a `slug` param
69
+ // (e.g. (front)/pages/[slug]) and must be left untouched.
70
+ if ((IS_API_ROUTE || IS_PANEL_ROUTE) && event.params.slug) {
71
+ event.params.slug = prototypeKebabToSlug(event.params.slug);
72
+ }
7
73
  // build panel navigation
8
- if (isPanelRoute && event.request.method === 'GET') {
9
- event.locals.routes = buildNavigation(rime.config.raw, user);
74
+ if (IS_PANEL_ROUTE && event.request.method === 'GET') {
75
+ event.locals.navigation = buildNavigation(rime.config.raw, user);
10
76
  }
77
+ event.locals.routes = routeHandlers;
11
78
  // Handle custom routes from config and plugins
12
79
  const routes = '$routes' in rime.config.raw ? rime.config.raw.$routes : null;
13
80
  if (routes && event.url.pathname in routes) {
@@ -10,6 +10,17 @@ import type { CollectionSlug } from '../types.js';
10
10
  * withDirectoriesSuffix('pages_versions');
11
11
  */
12
12
  export declare const withDirectoriesSuffix: (slug: string) => CollectionSlug;
13
+ /**
14
+ * Remove a _directories suffix to a given name.
15
+ * Used for uploads path slug and tables.
16
+ * Prevent a version table name from being used, force the use of the main one.
17
+ *
18
+ * @example
19
+ * // Returns 'pages'
20
+ * withoutDirectoriesSuffix('pages_directories');
21
+ * withoutDirectoriesSuffix('pages_versions_directories');
22
+ */
23
+ export declare const withoutDirectoriesSuffix: (slug: string) => CollectionSlug;
13
24
  /**
14
25
  * Add a _versions suffix to a given name.
15
26
  * Used for document versioning slug and tables.
@@ -19,6 +30,15 @@ export declare const withDirectoriesSuffix: (slug: string) => CollectionSlug;
19
30
  * withVersionsSuffix('pages');
20
31
  */
21
32
  export declare const withVersionsSuffix: (name: string) => CollectionSlug;
33
+ /**
34
+ * Remove a _versions suffix from a given name.
35
+ * Used for document versioning slug and tables.
36
+ *
37
+ * @example
38
+ * // Returns 'pages'
39
+ * withoutVersionsSuffix('pages_versions');
40
+ */
41
+ export declare const withoutVersionsSuffix: (name: string) => CollectionSlug;
22
42
  /**
23
43
  * Check if a slug is a verioned collection slug
24
44
  * * @example
@@ -46,3 +66,17 @@ export declare const hasDirectoriesSuffix: (slug: string) => boolean;
46
66
  * withLocalesSuffix('pages_versions');
47
67
  */
48
68
  export declare const withLocalesSuffix: (name: string) => string;
69
+ /**
70
+ * Convert a kebab-case prototype slug.
71
+ * Basically used to convert param matchers slug into a collection/area slug.
72
+ * Only a literal trailing `_directories`/`_versions` suffix is preserved as a
73
+ * suffix — everything else, including a plain `-versions`/`-directories`
74
+ * word, is camelCased like any other segment.
75
+ *
76
+ * @example
77
+ * prototypeKebabToSlug('my-collection') // returns 'myCollection'
78
+ * prototypeKebabToSlug('my-collection_directories') // returns 'myCollection_directories'
79
+ * prototypeKebabToSlug('my-collection_versions') // returns 'myCollection_versions'
80
+ * prototypeKebabToSlug('my-collection-versions') // returns 'myCollectionVersions'
81
+ */
82
+ export declare const prototypeKebabToSlug: (kebab: string) => string;
@@ -9,6 +9,17 @@
9
9
  * withDirectoriesSuffix('pages_versions');
10
10
  */
11
11
  export const withDirectoriesSuffix = (slug) => `${slug.replace('_versions', '')}_directories`;
12
+ /**
13
+ * Remove a _directories suffix to a given name.
14
+ * Used for uploads path slug and tables.
15
+ * Prevent a version table name from being used, force the use of the main one.
16
+ *
17
+ * @example
18
+ * // Returns 'pages'
19
+ * withoutDirectoriesSuffix('pages_directories');
20
+ * withoutDirectoriesSuffix('pages_versions_directories');
21
+ */
22
+ export const withoutDirectoriesSuffix = (slug) => slug.replace('_directories', '');
12
23
  /**
13
24
  * Add a _versions suffix to a given name.
14
25
  * Used for document versioning slug and tables.
@@ -18,6 +29,15 @@ export const withDirectoriesSuffix = (slug) => `${slug.replace('_versions', '')}
18
29
  * withVersionsSuffix('pages');
19
30
  */
20
31
  export const withVersionsSuffix = (name) => `${name}_versions`;
32
+ /**
33
+ * Remove a _versions suffix from a given name.
34
+ * Used for document versioning slug and tables.
35
+ *
36
+ * @example
37
+ * // Returns 'pages'
38
+ * withoutVersionsSuffix('pages_versions');
39
+ */
40
+ export const withoutVersionsSuffix = (name) => name.replace('_versions', '');
21
41
  /**
22
42
  * Check if a slug is a verioned collection slug
23
43
  * * @example
@@ -45,3 +65,22 @@ export const hasDirectoriesSuffix = (slug) => slug.endsWith('_directories');
45
65
  * withLocalesSuffix('pages_versions');
46
66
  */
47
67
  export const withLocalesSuffix = (name) => `${name}Locales`;
68
+ /**
69
+ * Convert a kebab-case prototype slug.
70
+ * Basically used to convert param matchers slug into a collection/area slug.
71
+ * Only a literal trailing `_directories`/`_versions` suffix is preserved as a
72
+ * suffix — everything else, including a plain `-versions`/`-directories`
73
+ * word, is camelCased like any other segment.
74
+ *
75
+ * @example
76
+ * prototypeKebabToSlug('my-collection') // returns 'myCollection'
77
+ * prototypeKebabToSlug('my-collection_directories') // returns 'myCollection_directories'
78
+ * prototypeKebabToSlug('my-collection_versions') // returns 'myCollection_versions'
79
+ * prototypeKebabToSlug('my-collection-versions') // returns 'myCollectionVersions'
80
+ */
81
+ export const prototypeKebabToSlug = (kebab) => {
82
+ const suffixMatch = kebab.match(/(_(?:directories|versions))$/);
83
+ const suffix = suffixMatch ? suffixMatch[1] : '';
84
+ const base = suffix ? kebab.slice(0, -suffix.length) : kebab;
85
+ return base.replace(/-([a-z])/g, (_, char) => char.toUpperCase()) + suffix;
86
+ };
@@ -10,7 +10,7 @@ export function defineBlocksDiff({ existingBlocks, incomingBlocks, context }) {
10
10
  // - If a block is not localized than it should keep its id so block is updated
11
11
  if (context.isFallbackLocale) {
12
12
  incomingBlocks = incomingBlocks.map((block) => {
13
- const isLocalized = configMap[block.path]?.localized || false;
13
+ const isLocalized = configMap[block.path]?.get.localized || false;
14
14
  if (isLocalized) {
15
15
  delete block.id;
16
16
  block.locale = context.isFallbackLocale;
@@ -5,7 +5,7 @@ export function extractBlocks({ data, configMap }) {
5
5
  Object.entries(configMap).forEach(([path, config]) => {
6
6
  if (config.type === 'blocks') {
7
7
  const value = getValueAtPath(path, data);
8
- const isEmptyValue = config.isEmpty(value);
8
+ const isEmptyValue = config.run.isEmpty(value);
9
9
  if (value && !isEmptyValue) {
10
10
  value.forEach((block, index) => {
11
11
  if (block.type) {
@@ -1,3 +1,4 @@
1
- import type { TreeFieldRaw } from '../../../fields/tree/index.js';
1
+ import type { TreeBlock } from '../../types/doc.js';
2
+ import type { TreeBuilder } from '../../../fields/tree/index.js';
2
3
  import type { ConfigMap } from './types.js';
3
- export declare function buildTreeFieldsMap(treeConfig: TreeFieldRaw, treeItems: any[], basePath: string): ConfigMap;
4
+ export declare function buildTreeFieldsMap(treeConfig: TreeBuilder, treeItems: TreeBlock[], basePath: string): ConfigMap;
@@ -3,7 +3,7 @@ export function buildTreeFieldsMap(treeConfig, treeItems, basePath) {
3
3
  const treeMap = {};
4
4
  // Helper to add field configs for a specific path
5
5
  const addFieldConfigs = (path) => {
6
- for (const field of treeConfig.fields) {
6
+ for (const field of treeConfig.get.fields) {
7
7
  if (isFormField(field)) {
8
8
  treeMap[`${path}.${field.name}`] = field;
9
9
  }