rimecms 1.3.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (731) hide show
  1. package/dist/adapter-sqlite/collection.server.js +2 -1
  2. package/dist/adapter-sqlite/columns.server.d.ts +42 -61
  3. package/dist/adapter-sqlite/columns.server.js +50 -111
  4. package/dist/adapter-sqlite/generate-schema/column.server.d.ts +8 -6
  5. package/dist/adapter-sqlite/generate-schema/column.server.js +13 -49
  6. package/dist/adapter-sqlite/generate-schema/index.server.d.ts +1 -0
  7. package/dist/adapter-sqlite/generate-schema/index.server.js +6 -0
  8. package/dist/adapter-sqlite/generate-schema/relations/junction.server.d.ts +3 -3
  9. package/dist/adapter-sqlite/generate-schema/relations/junction.server.js +3 -3
  10. package/dist/adapter-sqlite/generate-schema/root.server.d.ts +4 -0
  11. package/dist/adapter-sqlite/generate-schema/root.server.js +26 -33
  12. package/dist/adapter-sqlite/generate-schema/templates.server.d.ts +0 -22
  13. package/dist/adapter-sqlite/generate-schema/templates.server.js +0 -33
  14. package/dist/adapter-sqlite/generate-schema/write.server.d.ts +6 -0
  15. package/dist/adapter-sqlite/generate-schema/write.server.js +6 -0
  16. package/dist/adapter-sqlite/index.server.js +5 -0
  17. package/dist/adapter-sqlite/locales.server.js +1 -4
  18. package/dist/adapter-sqlite/order-by.server.d.ts +6 -0
  19. package/dist/adapter-sqlite/order-by.server.js +6 -0
  20. package/dist/adapter-sqlite/read.server.d.ts +12 -1
  21. package/dist/adapter-sqlite/read.server.js +94 -38
  22. package/dist/adapter-sqlite/registry.server.d.ts +2 -2
  23. package/dist/adapter-sqlite/registry.server.js +2 -2
  24. package/dist/adapter-sqlite/relations.server.d.ts +5 -0
  25. package/dist/adapter-sqlite/relations.server.js +27 -7
  26. package/dist/adapter-sqlite/repeatable.server.d.ts +4 -1
  27. package/dist/adapter-sqlite/repeatable.server.js +4 -1
  28. package/dist/adapter-sqlite/select.server.d.ts +6 -0
  29. package/dist/adapter-sqlite/select.server.js +56 -113
  30. package/dist/adapter-sqlite/table.server.js +7 -0
  31. package/dist/adapter-sqlite/transform.server.js +8 -2
  32. package/dist/adapter-sqlite/where.server.d.ts +11 -0
  33. package/dist/adapter-sqlite/where.server.js +237 -236
  34. package/dist/adapter-sqlite/write.server.d.ts +5 -0
  35. package/dist/adapter-sqlite/write.server.js +9 -7
  36. package/dist/core/adapter.d.ts +36 -12
  37. package/dist/core/auth/access.d.ts +3 -5
  38. package/dist/core/auth/access.js +3 -5
  39. package/dist/core/auth/augment.js +3 -4
  40. package/dist/core/auth/augment.server.d.ts +4 -0
  41. package/dist/core/auth/augment.server.js +4 -0
  42. package/dist/core/auth/better-auth/config.server.d.ts +24 -16
  43. package/dist/core/auth/better-auth/config.server.js +6 -0
  44. package/dist/core/auth/better-auth/hooks.server.js +17 -5
  45. package/dist/core/auth/better-auth/instance.server.d.ts +38 -32
  46. package/dist/core/auth/better-auth/permissions.d.ts +8 -7
  47. package/dist/core/auth/better-auth/permissions.js +1 -0
  48. package/dist/core/auth/better-auth-tables.server.d.ts +5 -6
  49. package/dist/core/auth/better-auth-tables.server.js +5 -6
  50. package/dist/core/auth/constant.d.ts +3 -3
  51. package/dist/core/auth/constant.js +3 -3
  52. package/dist/core/auth/constant.server.d.ts +3 -3
  53. package/dist/core/auth/constant.server.js +3 -3
  54. package/dist/core/auth/handler/index.server.js +2 -6
  55. package/dist/core/auth/hooks/create-better-auth-user.server.d.ts +4 -2
  56. package/dist/core/auth/hooks/create-better-auth-user.server.js +132 -185
  57. package/dist/core/auth/hooks/forward-roles.server.d.ts +2 -1
  58. package/dist/core/auth/hooks/forward-roles.server.js +3 -3
  59. package/dist/core/auth/hooks/populate-api-key.server.d.ts +2 -2
  60. package/dist/core/auth/hooks/populate-api-key.server.js +11 -3
  61. package/dist/core/auth/hooks/prevent-user-mutations.server.d.ts +2 -2
  62. package/dist/core/auth/hooks/prevent-user-mutations.server.js +5 -4
  63. package/dist/core/auth/hooks/sign-in-new-user.server.d.ts +5 -6
  64. package/dist/core/auth/hooks/sign-in-new-user.server.js +5 -6
  65. package/dist/core/auth/staff/derive.d.ts +10 -0
  66. package/dist/core/auth/staff/derive.js +10 -0
  67. package/dist/core/auth/tables.d.ts +4 -0
  68. package/dist/core/auth/tables.js +4 -0
  69. package/dist/core/auth/types.d.ts +10 -5
  70. package/dist/core/auth/validate-config.d.ts +1 -3
  71. package/dist/core/auth/validate-config.js +2 -4
  72. package/dist/core/boot.server.d.ts +38 -32
  73. package/dist/core/codegen.server.js +8 -2
  74. package/dist/core/config/build.d.ts +1 -1
  75. package/dist/core/config/build.server.d.ts +2 -1
  76. package/dist/core/config/build.server.js +1 -0
  77. package/dist/core/config/context.server.d.ts +3 -9
  78. package/dist/core/config/context.server.js +3 -9
  79. package/dist/core/config/index.server.d.ts +4 -2
  80. package/dist/core/config/index.server.js +4 -2
  81. package/dist/core/config/types.d.ts +13 -4
  82. package/dist/core/config/validate.server.d.ts +4 -0
  83. package/dist/core/config/validate.server.js +100 -90
  84. package/dist/core/constants.d.ts +13 -5
  85. package/dist/core/constants.js +13 -5
  86. package/dist/core/constants.server.d.ts +7 -0
  87. package/dist/core/constants.server.js +7 -0
  88. package/dist/core/dev/cache.server.d.ts +10 -7
  89. package/dist/core/dev/cache.server.js +10 -11
  90. package/dist/core/dev/cli/commands/build.d.ts +5 -0
  91. package/dist/core/dev/cli/commands/build.js +17 -2
  92. package/dist/core/dev/cli/commands/clear.server.d.ts +1 -0
  93. package/dist/core/dev/cli/commands/clear.server.js +3 -2
  94. package/dist/core/dev/cli/commands/generate-exports.server.js +25 -4
  95. package/dist/core/dev/cli/commands/generate.server.d.ts +5 -0
  96. package/dist/core/dev/cli/commands/generate.server.js +7 -8
  97. package/dist/core/dev/cli/commands/init.server.d.ts +7 -0
  98. package/dist/core/dev/cli/commands/init.server.js +34 -7
  99. package/dist/core/dev/cli/index.js +16 -14
  100. package/dist/core/dev/cli/templates/build.d.ts +4 -0
  101. package/dist/core/dev/cli/templates/build.js +4 -0
  102. package/dist/core/dev/cli/templates/init.d.ts +2 -1
  103. package/dist/core/dev/cli/templates/init.js +17 -9
  104. package/dist/core/dev/cli/util/package-manager.server.d.ts +6 -1
  105. package/dist/core/dev/cli/util/package-manager.server.js +14 -10
  106. package/dist/core/dev/cli/util/package.server.d.ts +1 -0
  107. package/dist/core/dev/cli/util/package.server.js +2 -2
  108. package/dist/core/dev/cli/util/project-name.d.ts +2 -1
  109. package/dist/core/dev/cli/util/project-name.js +6 -4
  110. package/dist/core/dev/cli/util/prompt.server.d.ts +2 -1
  111. package/dist/core/dev/cli/util/prompt.server.js +2 -1
  112. package/dist/core/dev/codegen/routes/common.server.d.ts +12 -0
  113. package/dist/core/dev/codegen/routes/common.server.js +9 -17
  114. package/dist/core/dev/codegen/routes/custom-css.server.d.ts +3 -9
  115. package/dist/core/dev/codegen/routes/custom-css.server.js +8 -34
  116. package/dist/core/dev/codegen/routes/index.server.d.ts +4 -5
  117. package/dist/core/dev/codegen/routes/index.server.js +33 -17
  118. package/dist/core/dev/codegen/routes/util.server.d.ts +13 -23
  119. package/dist/core/dev/codegen/routes/util.server.js +15 -25
  120. package/dist/core/dev/codegen/runtime/index.server.d.ts +2 -3
  121. package/dist/core/dev/codegen/runtime/index.server.js +2 -3
  122. package/dist/core/dev/codegen/runtime/parse-exports.server.js +10 -3
  123. package/dist/core/dev/codegen/sanitize/index.server.d.ts +11 -1
  124. package/dist/core/dev/codegen/sanitize/index.server.js +81 -50
  125. package/dist/core/dev/codegen/types/index.server.d.ts +2 -4
  126. package/dist/core/dev/codegen/types/index.server.js +6 -10
  127. package/dist/core/dev/codegen/types/templates.server.d.ts +4 -2
  128. package/dist/core/dev/codegen/types/templates.server.js +13 -26
  129. package/dist/core/dev/config-memo.server.js +6 -7
  130. package/dist/core/dev/constants.server.d.ts +4 -2
  131. package/dist/core/dev/constants.server.js +7 -4
  132. package/dist/core/dev/ensure.server.d.ts +5 -0
  133. package/dist/core/dev/ensure.server.js +11 -6
  134. package/dist/core/dev/env.server.d.ts +3 -1
  135. package/dist/core/dev/env.server.js +3 -1
  136. package/dist/core/dev/vite.server.d.ts +10 -0
  137. package/dist/core/dev/vite.server.js +13 -1
  138. package/dist/core/errors/handler.server.d.ts +9 -3
  139. package/dist/core/errors/handler.server.js +11 -6
  140. package/dist/core/errors/index.d.ts +21 -1
  141. package/dist/core/errors/index.js +23 -3
  142. package/dist/core/fields/builders/boolean-builder.d.ts +4 -0
  143. package/dist/core/fields/builders/boolean-builder.js +6 -1
  144. package/dist/core/fields/builders/field-builder.d.ts +16 -4
  145. package/dist/core/fields/builders/field-builder.js +11 -0
  146. package/dist/core/fields/builders/form-field-builder.d.ts +46 -2
  147. package/dist/core/fields/builders/form-field-builder.js +47 -2
  148. package/dist/core/fields/builders/index.d.ts +0 -2
  149. package/dist/core/fields/builders/index.js +0 -2
  150. package/dist/core/fields/builders/select-builder.d.ts +13 -2
  151. package/dist/core/fields/builders/select-builder.js +13 -1
  152. package/dist/core/fields/initial.d.ts +4 -1
  153. package/dist/core/fields/types.d.ts +5 -6
  154. package/dist/core/fields/util.d.ts +9 -14
  155. package/dist/core/fields/util.js +10 -15
  156. package/dist/core/fields/validate.d.ts +3 -0
  157. package/dist/core/fields/validate.js +3 -0
  158. package/dist/core/fields/walk.d.ts +4 -1
  159. package/dist/core/fields/walk.js +1 -2
  160. package/dist/core/handler.server.d.ts +5 -0
  161. package/dist/core/handler.server.js +15 -1
  162. package/dist/core/i18n/en/common.d.ts +28 -0
  163. package/dist/core/i18n/en/common.js +28 -0
  164. package/dist/core/i18n/en/errors.d.ts +6 -0
  165. package/dist/core/i18n/en/errors.js +6 -0
  166. package/dist/core/i18n/en/fields.d.ts +11 -0
  167. package/dist/core/i18n/en/fields.js +12 -1
  168. package/dist/core/i18n/fr/common.d.ts +28 -0
  169. package/dist/core/i18n/fr/common.js +29 -0
  170. package/dist/core/i18n/fr/errors.d.ts +6 -0
  171. package/dist/core/i18n/fr/errors.js +6 -0
  172. package/dist/core/i18n/fr/fields.d.ts +11 -0
  173. package/dist/core/i18n/fr/fields.js +12 -1
  174. package/dist/core/i18n/index.d.ts +1 -0
  175. package/dist/core/i18n/index.js +7 -0
  176. package/dist/core/i18n/register.server.js +1 -1
  177. package/dist/core/locale/types.d.ts +2 -6
  178. package/dist/core/logger.server.js +8 -2
  179. package/dist/core/panel/configure.js +2 -2
  180. package/dist/core/panel/types.d.ts +4 -2
  181. package/dist/core/pipeline/build-document.server.d.ts +2 -2
  182. package/dist/core/pipeline/build-document.server.js +2 -2
  183. package/dist/core/pipeline/build.server.js +2 -12
  184. package/dist/core/{prototype/shared/versions/hooks → pipeline}/fallback-data-from-original.d.ts +6 -6
  185. package/dist/core/{prototype/shared/versions/hooks → pipeline}/fallback-data-from-original.js +5 -5
  186. package/dist/core/pipeline/hooks/original-config-map.server.d.ts +3 -2
  187. package/dist/core/pipeline/hooks/original-config-map.server.js +3 -2
  188. package/dist/core/pipeline/hooks/process-document-fields.server.d.ts +2 -1
  189. package/dist/core/pipeline/hooks/process-document-fields.server.js +4 -9
  190. package/dist/core/pipeline/hooks/sort-document-props.server.js +4 -3
  191. package/dist/core/pipeline/hooks/validate-fields.server.d.ts +15 -1
  192. package/dist/core/pipeline/hooks/validate-fields.server.js +142 -47
  193. package/dist/core/pipeline/persist/blocks/extract.server.d.ts +5 -0
  194. package/dist/core/pipeline/persist/blocks/extract.server.js +5 -0
  195. package/dist/core/pipeline/persist/blocks/index.server.d.ts +3 -7
  196. package/dist/core/pipeline/persist/blocks/index.server.js +3 -8
  197. package/dist/core/pipeline/persist/relations/diff.server.js +1 -0
  198. package/dist/core/pipeline/persist/relations/extract.server.d.ts +1 -0
  199. package/dist/core/pipeline/persist/relations/extract.server.js +2 -0
  200. package/dist/core/pipeline/persist/relations/index.server.d.ts +6 -0
  201. package/dist/core/pipeline/persist/relations/index.server.js +31 -8
  202. package/dist/core/pipeline/persist/repeatable.server.d.ts +21 -12
  203. package/dist/core/pipeline/persist/repeatable.server.js +28 -4
  204. package/dist/core/pipeline/persist/tree/extract.server.d.ts +5 -0
  205. package/dist/core/pipeline/persist/tree/extract.server.js +6 -8
  206. package/dist/core/pipeline/persist/tree/index.server.d.ts +5 -0
  207. package/dist/core/pipeline/persist/tree/index.server.js +5 -0
  208. package/dist/core/pipeline/populate-relations.server.d.ts +1 -0
  209. package/dist/core/pipeline/populate-relations.server.js +1 -0
  210. package/dist/core/pipeline/run.server.d.ts +26 -17
  211. package/dist/core/pipeline/run.server.js +51 -9
  212. package/dist/core/pipeline/types.d.ts +30 -7
  213. package/dist/core/pipeline/without-denied-fields.d.ts +15 -0
  214. package/dist/core/pipeline/without-denied-fields.js +53 -2
  215. package/dist/core/plugins/api-init/index.server.d.ts +8 -0
  216. package/dist/core/plugins/api-init/index.server.js +8 -0
  217. package/dist/core/plugins/cache/HeaderButton.svelte +15 -6
  218. package/dist/core/plugins/cache/cache.server.d.ts +9 -0
  219. package/dist/core/plugins/cache/cache.server.js +9 -0
  220. package/dist/core/plugins/cache/handler.server.d.ts +5 -0
  221. package/dist/core/plugins/cache/handler.server.js +5 -0
  222. package/dist/core/plugins/cache/module.server.d.ts +4 -19
  223. package/dist/core/plugins/cache/module.server.js +5 -1
  224. package/dist/core/plugins/cache/types.d.ts +6 -0
  225. package/dist/core/plugins/index.d.ts +1 -0
  226. package/dist/core/plugins/index.js +1 -0
  227. package/dist/core/plugins/mailer/index.server.d.ts +5 -2
  228. package/dist/core/plugins/mailer/index.server.js +4 -0
  229. package/dist/core/plugins/plugins.server.d.ts +1 -0
  230. package/dist/core/plugins/plugins.server.js +1 -0
  231. package/dist/core/plugins/sse/client.js +4 -0
  232. package/dist/core/prototype/area/definition.server.d.ts +2 -3
  233. package/dist/core/prototype/area/definition.server.js +2 -3
  234. package/dist/core/prototype/area/operations/find.d.ts +5 -0
  235. package/dist/core/prototype/area/operations/find.js +5 -0
  236. package/dist/core/prototype/area/rest/endpoint.server.d.ts +3 -3
  237. package/dist/core/prototype/area/rest/endpoint.server.js +3 -3
  238. package/dist/core/prototype/area/rest/get.server.d.ts +2 -1
  239. package/dist/core/prototype/area/rest/get.server.js +2 -1
  240. package/dist/core/prototype/area/rest/update.server.d.ts +2 -1
  241. package/dist/core/prototype/area/rest/update.server.js +2 -1
  242. package/dist/core/prototype/collection/api.server.d.ts +15 -1
  243. package/dist/core/prototype/collection/api.server.js +16 -0
  244. package/dist/core/prototype/collection/augment-label.d.ts +9 -0
  245. package/dist/core/prototype/collection/augment-label.js +9 -0
  246. package/dist/core/prototype/collection/definition.d.ts +1 -1
  247. package/dist/core/prototype/collection/definition.js +1 -1
  248. package/dist/core/prototype/collection/hooks/merge-with-initial.server.d.ts +3 -3
  249. package/dist/core/prototype/collection/hooks/merge-with-initial.server.js +3 -3
  250. package/dist/core/prototype/collection/hooks.server.d.ts +2 -6
  251. package/dist/core/prototype/collection/hooks.server.js +8 -9
  252. package/dist/core/prototype/collection/nested/hooks/add-children.server.d.ts +3 -1
  253. package/dist/core/prototype/collection/nested/hooks/add-children.server.js +19 -11
  254. package/dist/core/prototype/collection/nested/hooks/index.server.d.ts +1 -0
  255. package/dist/core/prototype/collection/nested/hooks/index.server.js +1 -0
  256. package/dist/core/prototype/collection/nested/hooks/place-at-end.server.d.ts +10 -0
  257. package/dist/core/prototype/collection/nested/hooks/place-at-end.server.js +24 -0
  258. package/dist/core/prototype/collection/nested/move.server.d.ts +35 -0
  259. package/dist/core/prototype/collection/nested/move.server.js +74 -0
  260. package/dist/core/prototype/collection/operations/count.d.ts +19 -0
  261. package/dist/core/prototype/collection/operations/count.js +23 -0
  262. package/dist/core/prototype/collection/operations/create.d.ts +16 -0
  263. package/dist/core/prototype/collection/operations/create.js +46 -26
  264. package/dist/core/prototype/collection/operations/delete-by-id.d.ts +5 -0
  265. package/dist/core/prototype/collection/operations/delete-by-id.js +5 -0
  266. package/dist/core/prototype/collection/operations/delete.d.ts +8 -0
  267. package/dist/core/prototype/collection/operations/delete.js +8 -0
  268. package/dist/core/prototype/collection/operations/duplicate.d.ts +8 -0
  269. package/dist/core/prototype/collection/operations/duplicate.js +12 -0
  270. package/dist/core/prototype/collection/operations/find-by-id.d.ts +5 -0
  271. package/dist/core/prototype/collection/operations/find-by-id.js +5 -0
  272. package/dist/core/prototype/collection/operations/find.d.ts +6 -1
  273. package/dist/core/prototype/collection/operations/find.js +7 -2
  274. package/dist/core/prototype/collection/rest/count.server.d.ts +5 -0
  275. package/dist/core/prototype/collection/rest/count.server.js +12 -0
  276. package/dist/core/prototype/collection/rest/create.server.d.ts +2 -1
  277. package/dist/core/prototype/collection/rest/create.server.js +2 -1
  278. package/dist/core/prototype/collection/rest/delete-by-id.server.d.ts +1 -3
  279. package/dist/core/prototype/collection/rest/delete-by-id.server.js +1 -3
  280. package/dist/core/prototype/collection/rest/get-by-id.server.d.ts +2 -1
  281. package/dist/core/prototype/collection/rest/get-by-id.server.js +2 -1
  282. package/dist/core/prototype/collection/rest/get.server.d.ts +2 -1
  283. package/dist/core/prototype/collection/rest/get.server.js +2 -1
  284. package/dist/core/prototype/collection/rest/index.server.js +5 -0
  285. package/dist/core/prototype/collection/rest/lock.server.js +0 -5
  286. package/dist/core/prototype/collection/rest/move.server.d.ts +11 -0
  287. package/dist/core/prototype/collection/rest/move.server.js +34 -0
  288. package/dist/core/prototype/collection/rest/update-by-id.server.d.ts +3 -1
  289. package/dist/core/prototype/collection/rest/update-by-id.server.js +3 -1
  290. package/dist/core/prototype/collection/thumbnail/hooks/set-document-thumbnail.server.js +17 -9
  291. package/dist/core/prototype/collection/upload/boot/index.server.d.ts +3 -5
  292. package/dist/core/prototype/collection/upload/boot/index.server.js +3 -5
  293. package/dist/core/prototype/collection/upload/directories/configure.server.js +1 -2
  294. package/dist/core/prototype/collection/upload/directories/create.server.d.ts +15 -0
  295. package/dist/core/prototype/collection/upload/directories/create.server.js +19 -0
  296. package/dist/core/prototype/collection/upload/directories/derive.js +2 -2
  297. package/dist/core/prototype/collection/upload/directories/pipeline.server.js +5 -4
  298. package/dist/core/prototype/collection/upload/disk/save.server.d.ts +9 -5
  299. package/dist/core/prototype/collection/upload/disk/save.server.js +19 -6
  300. package/dist/core/prototype/collection/upload/ensure.server.d.ts +2 -7
  301. package/dist/core/prototype/collection/upload/ensure.server.js +2 -7
  302. package/dist/core/prototype/collection/upload/handler.server.d.ts +4 -0
  303. package/dist/core/prototype/collection/upload/handler.server.js +13 -4
  304. package/dist/core/prototype/collection/upload/hooks/convert-base64.server.d.ts +3 -10
  305. package/dist/core/prototype/collection/upload/hooks/convert-base64.server.js +5 -18
  306. package/dist/core/prototype/collection/upload/hooks/delete-folder-contents.server.d.ts +10 -0
  307. package/dist/core/prototype/collection/upload/hooks/delete-folder-contents.server.js +30 -0
  308. package/dist/core/prototype/collection/upload/hooks/extract-path.server.d.ts +1 -1
  309. package/dist/core/prototype/collection/upload/hooks/extract-path.server.js +1 -1
  310. package/dist/core/prototype/collection/upload/hooks/handle-path-creation.server.js +8 -20
  311. package/dist/core/prototype/collection/upload/hooks/index.server.d.ts +2 -5
  312. package/dist/core/prototype/collection/upload/hooks/index.server.js +2 -5
  313. package/dist/core/prototype/collection/upload/hooks/populate-sizes.server.d.ts +4 -2
  314. package/dist/core/prototype/collection/upload/hooks/populate-sizes.server.js +18 -19
  315. package/dist/core/prototype/collection/upload/hooks/process-file-upload.server.d.ts +3 -1
  316. package/dist/core/prototype/collection/upload/hooks/process-file-upload.server.js +16 -3
  317. package/dist/core/prototype/collection/upload/hooks/update-directory-children.server.js +3 -2
  318. package/dist/core/prototype/collection/upload/module.d.ts +4 -2
  319. package/dist/core/prototype/collection/upload/module.js +12 -17
  320. package/dist/core/prototype/collection/upload/module.server.d.ts +3 -4
  321. package/dist/core/prototype/collection/upload/module.server.js +3 -4
  322. package/dist/core/prototype/collection/upload/types.d.ts +21 -6
  323. package/dist/core/prototype/collection/upload/util/client.d.ts +2 -2
  324. package/dist/core/prototype/collection/upload/util/client.js +2 -2
  325. package/dist/core/prototype/collection/upload/util/config.d.ts +1 -0
  326. package/dist/core/prototype/collection/upload/util/converter.server.d.ts +5 -0
  327. package/dist/core/prototype/collection/upload/util/converter.server.js +16 -24
  328. package/dist/core/prototype/collection/upload/util/mime.d.ts +60 -0
  329. package/dist/core/prototype/collection/upload/util/mime.js +94 -4
  330. package/dist/core/prototype/collection/upload/util/path.d.ts +5 -1
  331. package/dist/core/prototype/collection/upload/util/path.js +9 -12
  332. package/dist/core/prototype/define.d.ts +14 -0
  333. package/dist/core/prototype/define.js +14 -0
  334. package/dist/core/prototype/shared/title/find-title.js +1 -0
  335. package/dist/core/prototype/shared/title/select.d.ts +2 -2
  336. package/dist/core/prototype/shared/title/select.js +2 -2
  337. package/dist/core/prototype/shared/url/hooks/set-live-url.server.js +2 -3
  338. package/dist/core/prototype/shared/versions/augment.js +8 -4
  339. package/dist/core/prototype/shared/versions/hooks/handle-new-version.server.js +6 -2
  340. package/dist/core/prototype/shared/versions/validate-config.server.js +1 -2
  341. package/dist/core/prototype/types.d.ts +0 -5
  342. package/dist/core/rime.server.d.ts +3 -2
  343. package/dist/core/rime.server.js +3 -2
  344. package/dist/core/routes/context.server.d.ts +11 -0
  345. package/dist/core/routes/context.server.js +11 -0
  346. package/dist/core/routes/handler.server.d.ts +4 -3
  347. package/dist/core/routes/handler.server.js +4 -3
  348. package/dist/core/routes/panel-navigation.d.ts +4 -5
  349. package/dist/core/routes/panel-navigation.js +4 -8
  350. package/dist/core/routes/util.d.ts +8 -2
  351. package/dist/core/routes/util.js +10 -4
  352. package/dist/fields/blocks/component/AddBlockButton.svelte +1 -0
  353. package/dist/fields/blocks/component/Blocks.svelte +15 -11
  354. package/dist/fields/blocks/component/focus/BlocksFocus.svelte +22 -10
  355. package/dist/fields/blocks/component/focus/LayersList.svelte +5 -0
  356. package/dist/fields/blocks/component/focus/Palette.svelte +0 -1
  357. package/dist/fields/blocks/component/focus/Renders.svelte +5 -4
  358. package/dist/fields/blocks/component/focus/Renders.svelte.d.ts +2 -1
  359. package/dist/fields/blocks/component/focus/focus.svelte.js +42 -13
  360. package/dist/fields/blocks/component/picker/BlockPicker.svelte +2 -2
  361. package/dist/fields/blocks/index.d.ts +16 -0
  362. package/dist/fields/blocks/index.js +15 -2
  363. package/dist/fields/checkbox/component/Checkbox.svelte +1 -0
  364. package/dist/fields/combobox/component/ComboBox.svelte +3 -2
  365. package/dist/fields/combobox/index.d.ts +1 -0
  366. package/dist/fields/combobox/index.js +1 -0
  367. package/dist/fields/component/index.d.ts +3 -0
  368. package/dist/fields/component/index.js +3 -0
  369. package/dist/fields/date/component/Date.svelte +8 -5
  370. package/dist/fields/date/index.d.ts +1 -0
  371. package/dist/fields/date/index.js +1 -0
  372. package/dist/fields/email/component/Email.svelte +8 -5
  373. package/dist/fields/email/index.d.ts +1 -0
  374. package/dist/fields/email/index.js +1 -0
  375. package/dist/fields/group/component/Group.svelte +8 -15
  376. package/dist/fields/group/index.d.ts +7 -1
  377. package/dist/fields/group/index.js +5 -4
  378. package/dist/fields/link/component/Link.svelte +19 -8
  379. package/dist/fields/link/component/RessourceInput.svelte +68 -47
  380. package/dist/fields/link/index.d.ts +12 -0
  381. package/dist/fields/link/index.js +14 -1
  382. package/dist/fields/number/component/Number.svelte +1 -0
  383. package/dist/fields/number/index.js +5 -3
  384. package/dist/fields/radio/component/Radio.svelte +12 -3
  385. package/dist/fields/radio/index.d.ts +1 -0
  386. package/dist/fields/radio/index.js +1 -0
  387. package/dist/fields/relation/component/Cell.svelte +4 -4
  388. package/dist/fields/relation/component/Relation.svelte +92 -131
  389. package/dist/fields/relation/component/Relation.svelte.d.ts +0 -1
  390. package/dist/fields/relation/component/RelationInline.svelte +22 -27
  391. package/dist/fields/relation/component/default/Default.svelte +50 -19
  392. package/dist/fields/relation/component/default/Default.svelte.d.ts +12 -1
  393. package/dist/fields/relation/component/types.d.ts +5 -3
  394. package/dist/fields/relation/component/upload/Browse.svelte +50 -41
  395. package/dist/fields/relation/component/upload/Browse.svelte.d.ts +6 -1
  396. package/dist/fields/relation/component/upload/Upload.svelte +8 -3
  397. package/dist/fields/relation/component/upload/Upload.svelte.d.ts +0 -1
  398. package/dist/fields/relation/index.d.ts +27 -10
  399. package/dist/fields/relation/index.js +16 -0
  400. package/dist/fields/relation/populate.js +1 -0
  401. package/dist/fields/relation/query.d.ts +22 -0
  402. package/dist/fields/relation/query.js +29 -0
  403. package/dist/fields/relation/relation.test-d.js +11 -0
  404. package/dist/fields/repeatable/RepeatableActions.svelte +4 -0
  405. package/dist/fields/repeatable/RepeatableActions.svelte.d.ts +4 -0
  406. package/dist/fields/repeatable.js +3 -21
  407. package/dist/fields/rich-text/client.d.ts +26 -0
  408. package/dist/fields/rich-text/client.js +26 -0
  409. package/dist/fields/rich-text/component/RichTextInline.svelte +2 -9
  410. package/dist/fields/rich-text/component/RichTextInline.svelte.d.ts +2 -9
  411. package/dist/fields/rich-text/component/bubble-menu/bubble-menu.svelte +2 -0
  412. package/dist/fields/rich-text/component/bubble-menu/icon-button/icon-button.css +0 -1
  413. package/dist/fields/rich-text/component/bubble-menu/icon-button/icon-button.svelte +1 -2
  414. package/dist/fields/rich-text/component/bubble-menu/node-selector/node-selector.css +0 -1
  415. package/dist/fields/rich-text/component/bubble-menu/node-selector/node-selector.svelte +9 -6
  416. package/dist/fields/rich-text/component/context.svelte.d.ts +1 -0
  417. package/dist/fields/rich-text/component/context.svelte.js +1 -0
  418. package/dist/fields/rich-text/component/drag-handle/drag-handle.css +0 -1
  419. package/dist/fields/rich-text/component/drag-handle/drag-handle.svelte +1 -0
  420. package/dist/fields/rich-text/component/styles/editor.css +0 -1
  421. package/dist/fields/rich-text/component/styles/field.css +10 -11
  422. package/dist/fields/rich-text/core/build-editor-config.d.ts +15 -6
  423. package/dist/fields/rich-text/core/build-editor-config.js +47 -66
  424. package/dist/fields/rich-text/core/extensions/current-node/current-node.css +1 -0
  425. package/dist/fields/rich-text/core/extensions/current-node/current-node.d.ts +2 -2
  426. package/dist/fields/rich-text/core/extensions/current-node/current-node.js +3 -4
  427. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle-plugin.d.ts +5 -0
  428. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle-plugin.js +40 -77
  429. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.d.ts +1 -1
  430. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.js +1 -1
  431. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/cloneElement.d.ts +4 -0
  432. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/cloneElement.js +5 -0
  433. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/dragHandler.d.ts +5 -0
  434. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/dragHandler.js +11 -13
  435. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/findNextElementFromCursor.d.ts +6 -8
  436. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/findNextElementFromCursor.js +9 -14
  437. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getInnerCoords.d.ts +1 -0
  438. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getInnerCoords.js +6 -5
  439. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getOuterNode.d.ts +3 -1
  440. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getOuterNode.js +8 -21
  441. package/dist/fields/rich-text/core/features/blockquote.js +5 -1
  442. package/dist/fields/rich-text/core/features/bold.js +0 -3
  443. package/dist/fields/rich-text/core/features/bullet-list.js +5 -1
  444. package/dist/fields/rich-text/core/features/fields/extension.d.ts +1 -0
  445. package/dist/fields/rich-text/core/features/fields/extension.js +1 -0
  446. package/dist/fields/rich-text/core/features/fields/fields-form.svelte +54 -0
  447. package/dist/fields/rich-text/core/features/fields/fields-form.svelte.d.ts +14 -0
  448. package/dist/fields/rich-text/core/features/fields/fields.svelte +30 -35
  449. package/dist/fields/rich-text/core/features/fields/index.d.ts +2 -0
  450. package/dist/fields/rich-text/core/features/fields/index.js +1 -0
  451. package/dist/fields/rich-text/core/features/heading.js +19 -68
  452. package/dist/fields/rich-text/core/features/hr/hr.css +1 -2
  453. package/dist/fields/rich-text/core/features/hr/hr.js +5 -1
  454. package/dist/fields/rich-text/core/features/index.d.ts +1 -0
  455. package/dist/fields/rich-text/core/features/index.js +1 -0
  456. package/dist/fields/rich-text/core/features/json-attribute.d.ts +1 -1
  457. package/dist/fields/rich-text/core/features/json-attribute.js +1 -1
  458. package/dist/fields/rich-text/core/features/link/component/link-selector.svelte +61 -58
  459. package/dist/fields/rich-text/core/features/link/component/link-selector.svelte.d.ts +3 -1
  460. package/dist/fields/rich-text/core/features/link/index.d.ts +5 -0
  461. package/dist/fields/rich-text/core/features/link/index.js +2 -14
  462. package/dist/fields/rich-text/core/features/ordered-list.js +5 -1
  463. package/dist/fields/rich-text/core/features/paragraph.js +5 -1
  464. package/dist/fields/rich-text/core/features/pick-dialog.svelte +16 -4
  465. package/dist/fields/rich-text/core/features/pick-dialog.svelte.d.ts +7 -3
  466. package/dist/fields/rich-text/core/features/resource/index.d.ts +1 -0
  467. package/dist/fields/rich-text/core/features/resource/index.js +1 -0
  468. package/dist/fields/rich-text/core/features/resource/resource-extension.d.ts +1 -0
  469. package/dist/fields/rich-text/core/features/resource/resource-extension.js +8 -6
  470. package/dist/fields/rich-text/core/features/resource/resource.svelte +38 -49
  471. package/dist/fields/rich-text/core/features/resource/types.d.ts +1 -0
  472. package/dist/fields/rich-text/core/features/upload/index.d.ts +1 -0
  473. package/dist/fields/rich-text/core/features/upload/index.js +2 -1
  474. package/dist/fields/rich-text/core/features/upload/upload-extension.d.ts +6 -0
  475. package/dist/fields/rich-text/core/features/upload/upload-extension.js +2 -2
  476. package/dist/fields/{relation/component → rich-text/core/features}/upload/upload.css +1 -2
  477. package/dist/fields/rich-text/core/features/upload/upload.svelte +47 -73
  478. package/dist/fields/rich-text/core/features/upload/upload.svelte.d.ts +1 -0
  479. package/dist/fields/rich-text/core/render-rich-text.svelte +30 -16
  480. package/dist/fields/rich-text/core/rich-text-editor-core.svelte +8 -3
  481. package/dist/fields/rich-text/core/rich-text-editor-core.svelte.d.ts +1 -0
  482. package/dist/fields/rich-text/core/svelte/constant.d.ts +1 -0
  483. package/dist/fields/rich-text/core/svelte/constant.js +1 -0
  484. package/dist/fields/rich-text/core/svelte/node-view-renderer.svelte.d.ts +10 -0
  485. package/dist/fields/rich-text/core/svelte/node-view-renderer.svelte.js +23 -6
  486. package/dist/fields/rich-text/core/svelte/node-view-wrapper.svelte +6 -2
  487. package/dist/fields/rich-text/core/svelte/node-view-wrapper.svelte.d.ts +1 -0
  488. package/dist/fields/rich-text/core/svelte/renderer.d.ts +1 -0
  489. package/dist/fields/rich-text/core/svelte/renderer.js +1 -0
  490. package/dist/fields/rich-text/core/types.d.ts +11 -0
  491. package/dist/fields/rich-text/index.d.ts +2 -0
  492. package/dist/fields/rich-text/index.js +12 -7
  493. package/dist/fields/rich-text/json.d.ts +6 -4
  494. package/dist/fields/rich-text/json.js +6 -4
  495. package/dist/fields/select/component/Select.svelte +37 -12
  496. package/dist/fields/select/index.d.ts +2 -1
  497. package/dist/fields/select/index.js +1 -0
  498. package/dist/fields/separator/index.d.ts +1 -0
  499. package/dist/fields/separator/index.js +1 -0
  500. package/dist/fields/slug/component/Slug.svelte +14 -13
  501. package/dist/fields/slug/index.d.ts +11 -0
  502. package/dist/fields/slug/index.js +11 -0
  503. package/dist/fields/tabs/component/Tabs.svelte +4 -7
  504. package/dist/fields/tabs/index.d.ts +10 -0
  505. package/dist/fields/tabs/index.js +10 -0
  506. package/dist/fields/text/component/TextInline.svelte +12 -10
  507. package/dist/fields/text/index.d.ts +7 -0
  508. package/dist/fields/text/index.js +9 -2
  509. package/dist/fields/textarea/index.d.ts +3 -0
  510. package/dist/fields/textarea/index.js +5 -2
  511. package/dist/fields/time/index.d.ts +1 -0
  512. package/dist/fields/time/index.js +4 -6
  513. package/dist/fields/toggle/component/Toggle.svelte +1 -0
  514. package/dist/fields/toggle/index.d.ts +1 -0
  515. package/dist/fields/toggle/index.js +1 -0
  516. package/dist/fields/tree/component/AddItemButton.svelte +3 -2
  517. package/dist/fields/tree/component/AddItemButton.svelte.d.ts +1 -1
  518. package/dist/fields/tree/component/Tree.svelte +16 -57
  519. package/dist/fields/tree/component/TreeBlock.svelte +26 -40
  520. package/dist/fields/tree/component/props.d.ts +3 -2
  521. package/dist/fields/tree/index.d.ts +131 -0
  522. package/dist/fields/tree/index.js +14 -2
  523. package/dist/fields/tree/util.js +0 -3
  524. package/dist/fields/types.d.ts +23 -1
  525. package/dist/index.d.ts +1 -0
  526. package/dist/index.js +1 -0
  527. package/dist/live/Consumer.svelte +6 -0
  528. package/dist/live/LiveEdit.svelte +23 -5
  529. package/dist/live/LiveEdit.svelte.d.ts +2 -1
  530. package/dist/live/Provider.svelte +5 -1
  531. package/dist/live/context.svelte.d.ts +3 -4
  532. package/dist/live/context.svelte.js +9 -6
  533. package/dist/panel/components/Root.svelte +7 -1
  534. package/dist/panel/components/fields/FieldsPreview.svelte +15 -1
  535. package/dist/panel/components/fields/Label.svelte +2 -0
  536. package/dist/panel/components/fields/RenderFields.svelte +12 -1
  537. package/dist/panel/components/fields/fieldset.svelte.d.ts +7 -1
  538. package/dist/panel/components/fields/fieldset.svelte.js +7 -1
  539. package/dist/panel/components/fields/setting.css +7 -0
  540. package/dist/panel/components/sections/auth/AuthForm.svelte +4 -1
  541. package/dist/panel/components/sections/collection/Avatar.svelte +1 -1
  542. package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte +3 -0
  543. package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte +11 -1
  544. package/dist/panel/components/sections/collection/folder/FolderEdit.svelte +10 -1
  545. package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte +45 -34
  546. package/dist/panel/components/sections/collection/folder/Folders.svelte +1 -0
  547. package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte +8 -3
  548. package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte.d.ts +2 -1
  549. package/dist/panel/components/sections/collection/grid/create-directory-dialog/CreateDirectoryDialog.svelte +3 -1
  550. package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte +4 -0
  551. package/dist/panel/components/sections/collection/header/ButtonCreate.svelte +1 -5
  552. package/dist/panel/components/sections/collection/header/SearchInput.svelte +2 -0
  553. package/dist/panel/components/sections/collection/header/SelectUI.svelte +25 -5
  554. package/dist/panel/components/sections/collection/list/CollectionList.svelte +4 -1
  555. package/dist/panel/components/sections/collection/list/row/Row.svelte +16 -16
  556. package/dist/panel/components/sections/collection/list/row/Row.svelte.d.ts +4 -4
  557. package/dist/panel/components/sections/collection/tree/CollectionTree.svelte +4 -80
  558. package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte +18 -8
  559. package/dist/panel/components/sections/collection/tree/sortable.d.ts +11 -0
  560. package/dist/panel/components/sections/collection/tree/sortable.js +45 -0
  561. package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte +5 -3
  562. package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte.d.ts +0 -1
  563. package/dist/panel/components/sections/commands/CommandPalette.svelte +5 -0
  564. package/dist/panel/components/sections/document/AuthAPIKeyDialog.svelte +14 -4
  565. package/dist/panel/components/sections/document/AuthAPIKeyDialog.svelte.d.ts +2 -0
  566. package/dist/panel/components/sections/document/AuthFooter.svelte +37 -31
  567. package/dist/panel/components/sections/document/AuthFooter.svelte.d.ts +0 -2
  568. package/dist/panel/components/sections/document/ButtonSave.svelte +2 -6
  569. package/dist/panel/components/sections/document/ButtonSave.svelte.d.ts +1 -3
  570. package/dist/panel/components/sections/document/ButtonStatus.svelte +24 -11
  571. package/dist/panel/components/sections/document/ChangeSlugDialog.svelte +16 -0
  572. package/dist/panel/components/sections/document/CurrentlyEdited.svelte +5 -3
  573. package/dist/panel/components/sections/document/CurrentlyEdited.svelte.d.ts +1 -0
  574. package/dist/panel/components/sections/document/Document.svelte +29 -18
  575. package/dist/panel/components/sections/document/DocumentChildren.svelte +48 -41
  576. package/dist/panel/components/sections/document/Header.svelte +13 -11
  577. package/dist/panel/components/sections/document/Settings.svelte +127 -157
  578. package/dist/panel/components/sections/document/Versions.svelte +11 -2
  579. package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte +32 -13
  580. package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte.d.ts +2 -0
  581. package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte +24 -10
  582. package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte.d.ts +3 -0
  583. package/dist/panel/components/sections/live/LiveEditPanel.svelte +11 -5
  584. package/dist/panel/components/sections/live/LiveEditPanel.svelte.d.ts +10 -3
  585. package/dist/panel/components/sections/live/LiveFloatingUI.svelte +18 -2
  586. package/dist/panel/components/sections/live/LiveFloatingUI.svelte.d.ts +3 -0
  587. package/dist/panel/components/ui/button/button.svelte +0 -3
  588. package/dist/panel/components/ui/calendar/calendar.css +0 -1
  589. package/dist/panel/components/ui/calendar/calendar.svelte.d.ts +1 -1
  590. package/dist/panel/components/ui/card-resource/card-resource.svelte +17 -3
  591. package/dist/panel/components/ui/card-resource/card-resource.svelte.d.ts +2 -0
  592. package/dist/panel/components/ui/checkbox/checkbox.svelte.d.ts +1 -1
  593. package/dist/panel/components/ui/command/command-count.css +6 -0
  594. package/dist/panel/components/ui/command/command-count.svelte +15 -0
  595. package/dist/panel/components/ui/command/command-count.svelte.d.ts +9 -0
  596. package/dist/panel/components/ui/command/command-dialog.css +2 -0
  597. package/dist/panel/components/ui/command/command-input-select.svelte +5 -0
  598. package/dist/panel/components/ui/command/filter.d.ts +10 -0
  599. package/dist/panel/components/ui/command/filter.js +11 -0
  600. package/dist/panel/components/ui/command/index.d.ts +2 -1
  601. package/dist/panel/components/ui/command/index.js +2 -1
  602. package/dist/panel/components/ui/context-menu/context-menu.css +2 -2
  603. package/dist/panel/components/ui/dialog/dialog-content.css +4 -1
  604. package/dist/panel/components/ui/dialog/dialog-content.svelte +8 -1
  605. package/dist/panel/components/ui/dialog/dialog-overlay.css +2 -1
  606. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-content.css +2 -2
  607. package/dist/panel/components/ui/input/input.svelte +3 -0
  608. package/dist/panel/components/ui/language-switcher/LanguageSwitcher.svelte +1 -1
  609. package/dist/panel/components/ui/layer/layer.svelte.d.ts +22 -0
  610. package/dist/panel/components/ui/layer/layer.svelte.js +37 -0
  611. package/dist/panel/components/ui/nav/Nav.svelte +4 -9
  612. package/dist/panel/components/ui/nav/NavGroup.svelte +6 -6
  613. package/dist/panel/components/ui/nav/NavItem.svelte +1 -0
  614. package/dist/panel/components/ui/nav/NavItem.svelte.d.ts +1 -0
  615. package/dist/panel/components/ui/nav/UserButton.svelte +4 -4
  616. package/dist/panel/components/ui/page-header/PageHeader.svelte +1 -5
  617. package/dist/panel/components/ui/page-header/PageHeader.svelte.d.ts +1 -0
  618. package/dist/panel/components/ui/popover/popover-content.css +2 -1
  619. package/dist/panel/components/ui/radio-row-group/radio-row-group.css +0 -1
  620. package/dist/panel/components/ui/scroll-area/scroll-area-scrollbar.svelte +3 -4
  621. package/dist/panel/components/ui/scroll-area/scroll-area-scrollbar.svelte.d.ts +1 -1
  622. package/dist/panel/components/ui/scroll-area/scroll-area.css +0 -6
  623. package/dist/panel/components/ui/scroll-area/scroll-area.svelte +4 -1
  624. package/dist/panel/components/ui/sheet/index.d.ts +1 -1
  625. package/dist/panel/components/ui/sheet/sheet-content.svelte +13 -2
  626. package/dist/panel/components/ui/sheet/sheet-content.svelte.d.ts +3 -0
  627. package/dist/panel/components/ui/sheet/sheet.css +11 -43
  628. package/dist/panel/components/ui/sonner/sonner.css +5 -0
  629. package/dist/panel/components/ui/switch/switch.svelte.d.ts +1 -1
  630. package/dist/panel/components/ui/tag/tag.svelte +8 -1
  631. package/dist/panel/components/ui/tooltip/index.d.ts +7 -0
  632. package/dist/panel/components/ui/tooltip/tooltip-content.svelte +1 -1
  633. package/dist/panel/components/ui/tree/tree-rows.css +1 -8
  634. package/dist/panel/context/api-proxy.svelte.d.ts +2 -0
  635. package/dist/panel/context/api-proxy.svelte.js +30 -4
  636. package/dist/panel/context/blocks-ops.d.ts +6 -0
  637. package/dist/panel/context/blocks-ops.js +6 -0
  638. package/dist/panel/context/bulk-delete.d.ts +4 -3
  639. package/dist/panel/context/bulk-delete.js +13 -7
  640. package/dist/panel/context/collection.svelte.d.ts +10 -22
  641. package/dist/panel/context/collection.svelte.js +73 -115
  642. package/dist/panel/context/commands.svelte.js +5 -0
  643. package/dist/panel/context/config.svelte.js +2 -0
  644. package/dist/panel/context/createContext.svelte.d.ts +1 -0
  645. package/dist/panel/context/createContext.svelte.js +1 -0
  646. package/dist/panel/context/documentForm.svelte.d.ts +4 -2
  647. package/dist/panel/context/documentForm.svelte.js +87 -159
  648. package/dist/panel/context/errors.svelte.d.ts +8 -0
  649. package/dist/panel/context/errors.svelte.js +8 -0
  650. package/dist/panel/context/form.svelte.d.ts +8 -1
  651. package/dist/panel/context/form.svelte.js +37 -40
  652. package/dist/panel/context/livePanel.svelte.d.ts +3 -0
  653. package/dist/panel/context/locale.svelte.js +3 -0
  654. package/dist/panel/context/nav.svelte.js +9 -21
  655. package/dist/panel/context/tree-ops.d.ts +14 -0
  656. package/dist/panel/context/tree-ops.js +70 -0
  657. package/dist/panel/context/versions.svelte.d.ts +6 -0
  658. package/dist/panel/context/versions.svelte.js +18 -0
  659. package/dist/panel/index.d.ts +1 -10
  660. package/dist/panel/pages/area/Area.svelte +1 -1
  661. package/dist/panel/pages/area/actions.server.js +1 -0
  662. package/dist/panel/pages/area/load.server.d.ts +1 -0
  663. package/dist/panel/pages/area/load.server.js +1 -1
  664. package/dist/panel/pages/auth/forgot-password/ForgotPassword.svelte +23 -16
  665. package/dist/panel/pages/auth/forgot-password/load.server.d.ts +1 -0
  666. package/dist/panel/pages/auth/forgot-password/load.server.js +3 -5
  667. package/dist/panel/pages/auth/image.server.d.ts +6 -0
  668. package/dist/panel/pages/auth/image.server.js +19 -0
  669. package/dist/panel/pages/auth/reset-password/ResetPassword.svelte +22 -15
  670. package/dist/panel/pages/auth/reset-password/load.server.d.ts +3 -0
  671. package/dist/panel/pages/auth/reset-password/load.server.js +5 -5
  672. package/dist/panel/pages/auth/sign-in/actions.server.js +33 -25
  673. package/dist/panel/pages/auth/sign-in/load.server.d.ts +4 -0
  674. package/dist/panel/pages/auth/sign-in/load.server.js +6 -5
  675. package/dist/panel/pages/collection/Collection.svelte.d.ts +1 -1
  676. package/dist/panel/pages/collection/CollectionPage.svelte +31 -27
  677. package/dist/panel/pages/collection/CollectionPage.svelte.d.ts +1 -1
  678. package/dist/panel/pages/collection/load.server.d.ts +5 -2
  679. package/dist/panel/pages/collection/load.server.js +53 -54
  680. package/dist/panel/pages/collection-document/CollectionDocument.svelte +1 -1
  681. package/dist/panel/pages/collection-document/actions.server.js +3 -11
  682. package/dist/panel/pages/collection-document/load.server.d.ts +5 -0
  683. package/dist/panel/pages/collection-document/load.server.js +10 -3
  684. package/dist/panel/pages/dashboard/load.server.d.ts +3 -0
  685. package/dist/panel/pages/dashboard/load.server.js +19 -8
  686. package/dist/panel/pages/live/Live.svelte +45 -45
  687. package/dist/panel/pages/live/load.server.d.ts +5 -0
  688. package/dist/panel/pages/live/load.server.js +5 -0
  689. package/dist/panel/pages/shared/DocumentPage.svelte +9 -5
  690. package/dist/panel/pages/shared/DocumentPage.svelte.d.ts +0 -1
  691. package/dist/panel/style/font.css +1 -1
  692. package/dist/panel/style/index.css +21 -6
  693. package/dist/panel/style/palette.css +1 -1
  694. package/dist/panel/style/size.css +1 -0
  695. package/dist/panel/style/z-index.css +18 -0
  696. package/dist/panel/types.d.ts +0 -1
  697. package/dist/panel/util/Sortable.d.ts +6 -1
  698. package/dist/panel/util/Sortable.js +6 -1
  699. package/dist/panel/util/auth.d.ts +18 -0
  700. package/dist/panel/util/auth.js +25 -0
  701. package/dist/panel/util/candidates.svelte.d.ts +118 -0
  702. package/dist/panel/util/candidates.svelte.js +176 -0
  703. package/dist/panel/util/count.d.ts +19 -0
  704. package/dist/panel/util/count.js +20 -0
  705. package/dist/panel/util/dataError.d.ts +1 -0
  706. package/dist/panel/util/dataError.js +1 -0
  707. package/dist/panel/util/storage.d.ts +13 -0
  708. package/dist/panel/util/storage.js +37 -0
  709. package/dist/panel/util/time.d.ts +7 -1
  710. package/dist/panel/util/time.js +19 -5
  711. package/dist/panel/util/upload-file.d.ts +0 -8
  712. package/dist/panel/util/upload-file.js +6 -12
  713. package/dist/server.js +3 -0
  714. package/dist/util/form-data.d.ts +3 -3
  715. package/dist/util/form-data.js +4 -2
  716. package/dist/util/function.d.ts +7 -6
  717. package/dist/util/function.js +7 -6
  718. package/dist/util/object.d.ts +10 -11
  719. package/dist/util/object.js +21 -55
  720. package/dist/util/random.d.ts +8 -12
  721. package/dist/util/random.js +34 -88
  722. package/dist/util/string.js +76 -114
  723. package/dist/util/types.d.ts +2 -0
  724. package/package.json +12 -15
  725. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getComputedStyle.d.ts +0 -1
  726. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getComputedStyle.js +0 -4
  727. package/dist/fields/rich-text/core/features/link/component/link-selector.css +0 -0
  728. package/dist/fields/rich-text/core/features/resource/resource.css +0 -0
  729. package/dist/panel/style/util.css +0 -3
  730. package/dist/panel/util/once.svelte.d.ts +0 -3
  731. package/dist/panel/util/once.svelte.js +0 -12
@@ -12,6 +12,7 @@ import { prototypeKebab } from '../prototype/naming.js';
12
12
  import { isCamelCase } from '../../util/string.js';
13
13
  /** A field name: letters, digits and `_`, a letter first after any `_`: `_hello_guys`, `fooBar` */
14
14
  const FIELD_NAME = /^_*[a-zA-Z][a-zA-Z0-9_]*$/;
15
+ /** The values that appear more than once, each once: `['a', 'b', 'a']` -> `['a']`. */
15
16
  function hasDuplicates(arr) {
16
17
  return [...new Set(arr.filter((e, i, a) => a.indexOf(e) !== i))];
17
18
  }
@@ -62,107 +63,112 @@ function validateSlugs(config) {
62
63
  }
63
64
  return errors;
64
65
  }
65
- /**
66
- * Validate documents fields for each collections
67
- * and areas
68
- */
69
- const validateFields = (config) => {
70
- let errors = [];
71
- for (const collection of config.collections) {
72
- const collectionErrors = validateDocumentFields(collection, config);
73
- errors = [...errors, ...collectionErrors];
66
+ /** Where a message points: `collection pages`. */
67
+ const where = ({ prototype }) => `${prototype.type} ${prototype.slug}`;
68
+ /** The names a level writes under: each form field's, and each tab's. */
69
+ const namesAtLevel = (fields) => fields.flatMap((field) => {
70
+ if (field instanceof TabsBuilder)
71
+ return field.get.tabs.map((tab) => tab.name);
72
+ return isFormField(field) ? [field.name] : [];
73
+ });
74
+ /** A relation names a collection that exists, and is not `$root()`. */
75
+ const relationRules = (field, scope) => {
76
+ const errors = [];
77
+ if (!scope.collectionSlugs.includes(field.get.relationTo)) {
78
+ errors.push(`Relation field ${field.name} references unknown collection ${field.get.relationTo}, in ${where(scope)}`);
74
79
  }
75
- for (const area of config.areas) {
76
- const collectionErrors = validateDocumentFields(area, config);
77
- errors = [...errors, ...collectionErrors];
80
+ // A relation is junction rows, and the base row has no junction. A reference that must sit
81
+ // there is a text column with `$references(slug, { resolve: true })`.
82
+ if (field.get.root) {
83
+ errors.push(`Relation field ${field.name} can't be $root(), in ${where(scope)}`);
78
84
  }
79
85
  return errors;
80
86
  };
81
- const validateDocumentFields = (documentConfig, config) => {
87
+ /**
88
+ * A block name holds no ".", two blocks of one name in a prototype are the same block, and an
89
+ * array default names only the block types the field declares.
90
+ *
91
+ * A blocks rule, not a walk: it compares whole block builders, which a node does not carry.
92
+ */
93
+ const blocksRules = (field, scope) => {
82
94
  const errors = [];
83
- const registeredBlocks = {};
84
- const validateRelationField = (field) => {
85
- const collectionsSlugs = config.collections.map((c) => c.slug);
86
- if (!collectionsSlugs.includes(field.get.relationTo)) {
87
- errors.push(`Relation field ${field.name} references unknown collection ${field.get.relationTo}, in ${documentConfig.type} ${documentConfig.slug}`);
95
+ for (const block of field.get.blocks) {
96
+ // A "." splits the path segment that carries the block name
97
+ if (block.name.includes('.')) {
98
+ errors.push(`Block ${block.name} of ${where(scope)} can't hold a "."`);
88
99
  }
89
- // A relation is junction rows, and the base row has no junction. A reference that must sit
90
- // there is a text column with `$references(slug, { resolve: true })`.
91
- if (field.get.root) {
92
- errors.push(`Relation field ${field.name} can't be $root(), in ${documentConfig.type} ${documentConfig.slug}`);
100
+ if (block.name in scope.blocks) {
101
+ if (JSON.stringify(scope.blocks[block.name]) !== JSON.stringify(block)) {
102
+ errors.push(`Each block with same name should be identical (block ${block.name})`);
103
+ }
93
104
  }
94
- };
95
- /** The names this level writes under: each form field's, and each tab's. */
96
- const namesAtLevel = (fields) => fields.flatMap((field) => {
97
- if (field instanceof TabsBuilder)
98
- return field.get.tabs.map((tab) => tab.name);
99
- return isFormField(field) ? [field.name] : [];
100
- });
101
- const validateFields = (fields) => {
102
- for (const duplicate of hasDuplicates(namesAtLevel(fields))) {
103
- errors.push(`Duplicate field or tab '${duplicate}' in ${documentConfig.type} '${documentConfig.slug}'`);
105
+ else {
106
+ scope.blocks[block.name] = block;
104
107
  }
105
- for (const field of fields) {
106
- if (isFormField(field)) {
107
- // A `$root()` field sits on the base row, which has no locales branch.
108
- if (field.get.root && field.get.localized) {
109
- errors.push(`Field ${field.name} of ${documentConfig.type} ${documentConfig.slug} with $root(), can't be localized`);
110
- }
111
- // A resolved reference is joined from a column of the row; a localized column is on the
112
- // locales branch, where no join reaches it.
113
- if (field._references?.resolve && field.get.localized) {
114
- errors.push(`Field ${field.name} of ${documentConfig.type} ${documentConfig.slug} with a resolved reference, can't be localized`);
115
- }
116
- // Check for malformed field.name
117
- if (!FIELD_NAME.test(field.name)) {
118
- errors.push(`Field ${field.name} of ${documentConfig.type} ${documentConfig.slug} should be camelCase`);
119
- }
120
- // A blocks rule, not a walk: it compares whole block builders, which a node does not carry.
121
- if (field instanceof BlocksBuilder) {
122
- for (const block of field.get.blocks) {
123
- // A "." splits the path segment that carries the block name
124
- if (block.name.includes('.')) {
125
- errors.push(`Block ${block.name} of ${documentConfig.type} ${documentConfig.slug} can't hold a "."`);
126
- }
127
- if (block.name in registeredBlocks) {
128
- const blockDefinedButDiffer = JSON.stringify(registeredBlocks[block.name]) !== JSON.stringify(block);
129
- if (blockDefinedButDiffer) {
130
- errors.push(`Each block with same name should be identique (block ${block.name})`);
131
- }
132
- }
133
- else {
134
- registeredBlocks[block.name] = block;
135
- }
136
- }
137
- // A default names block types this list declares. A function default is checked when
138
- // it runs.
139
- const initial = field.get.defaultValue;
140
- if (Array.isArray(initial)) {
141
- try {
142
- field.use.completeDefault(initial);
143
- }
144
- catch (error) {
145
- errors.push(`${error.message}, in ${documentConfig.type} ${documentConfig.slug}`);
146
- }
147
- }
148
- }
149
- else if (field instanceof RelationFieldBuilder) {
150
- validateRelationField(field);
151
- }
152
- else if ((field instanceof PickOneFieldBuilder || field instanceof PickManyFieldBuilder) &&
153
- !field.get.options?.length) {
154
- errors.push(`Field ${field.name} of ${documentConfig.type} ${documentConfig.slug} should have at least one option`);
155
- }
156
- }
157
- // Every block type, every tab, a group's and a tree row's fields: one level each.
158
- for (const node of field.use.nodes()) {
159
- validateFields(node.fields);
160
- }
108
+ }
109
+ // A function default is checked when it runs.
110
+ const initial = field.get.defaultValue;
111
+ if (Array.isArray(initial)) {
112
+ try {
113
+ field.use.completeDefault(initial);
114
+ }
115
+ catch (error) {
116
+ errors.push(`${error.message}, in ${where(scope)}`);
161
117
  }
162
- };
163
- validateFields(documentConfig.fields);
118
+ }
164
119
  return errors;
165
120
  };
121
+ /** The rules one form field follows, whatever its level. */
122
+ const fieldRules = (field, scope) => {
123
+ if (!isFormField(field))
124
+ return [];
125
+ const errors = [];
126
+ // A `$root()` field sits on the base row, which has no locales branch.
127
+ if (field.get.root && field.get.localized) {
128
+ errors.push(`Field ${field.name} of ${where(scope)} with $root(), can't be localized`);
129
+ }
130
+ // A resolved reference is joined from a column of the row; a localized column is on the
131
+ // locales branch, where no join reaches it.
132
+ if (field._references?.resolve && field.get.localized) {
133
+ errors.push(`Field ${field.name} of ${where(scope)} with a resolved reference, can't be localized`);
134
+ }
135
+ // `id` is the document's own column, and each block's and tree row's: no field takes it. A
136
+ // config rime derives (a `$` slug) may: the upload folders' id is their path.
137
+ if (field.name === 'id' && !scope.prototype.slug.startsWith('$')) {
138
+ errors.push(`Field id of ${where(scope)}: "id" is reserved for the document's and each row's id`);
139
+ }
140
+ if (!FIELD_NAME.test(field.name)) {
141
+ errors.push(`Field ${field.name} of ${where(scope)} should hold only letters, digits and underscores, with a letter first after any leading underscore`);
142
+ }
143
+ if (field instanceof BlocksBuilder) {
144
+ errors.push(...blocksRules(field, scope));
145
+ }
146
+ if (field instanceof RelationFieldBuilder) {
147
+ errors.push(...relationRules(field, scope));
148
+ }
149
+ if ((field instanceof PickOneFieldBuilder || field instanceof PickManyFieldBuilder) &&
150
+ !field.get.options?.length) {
151
+ errors.push(`Field ${field.name} of ${where(scope)} should have at least one option`);
152
+ }
153
+ return errors;
154
+ };
155
+ /**
156
+ * The rules of one level of fields, then of each level below it: every block type, every tab, a
157
+ * group's and a tree row's fields.
158
+ */
159
+ const fieldErrors = (fields, scope) => [
160
+ ...hasDuplicates(namesAtLevel(fields)).map((name) => `Duplicate field or tab '${name}' in ${scope.prototype.type} '${scope.prototype.slug}'`),
161
+ ...fields.flatMap((field) => [
162
+ ...fieldRules(field, scope),
163
+ ...field.use.nodes().flatMap((node) => fieldErrors(node.fields, scope))
164
+ ])
165
+ ];
166
+ /** The field rules of every collection, then of every area. */
167
+ const validateFields = (config) => {
168
+ const collectionSlugs = config.collections.map((c) => c.slug);
169
+ return [...config.collections, ...config.areas].flatMap((prototype) => fieldErrors(prototype.fields, { prototype, collectionSlugs, blocks: {} }));
170
+ };
171
+ /** `config.$adapter` is set. */
166
172
  const hasDatabase = (config) => {
167
173
  const hasDatabaseName = '$adapter' in config;
168
174
  if (!hasDatabaseName) {
@@ -207,6 +213,10 @@ function validateKebabs(config) {
207
213
  }
208
214
  return errors;
209
215
  }
216
+ /**
217
+ * Runs each rule group in turn and stops at the first that fails: clears the dev cache, logs the
218
+ * group's errors, and answers `false`.
219
+ */
210
220
  function validate(config) {
211
221
  const validateFunctions = [
212
222
  hasDuplicateSlug,
@@ -7,7 +7,10 @@ export declare const PARAMS: {
7
7
  * @example ?/update&autoSave=true&versionId=abc
8
8
  */
9
9
  readonly AUTO_SAVE: "autoSave";
10
- /** Fetch nested documents in relation / link at a specific depth */
10
+ /**
11
+ * How many levels of relations a read resolves into documents.
12
+ * @example ?depth=1
13
+ */
11
14
  readonly DEPTH: "depth";
12
15
  /**
13
16
  * Make a new version. The update starts from the row the other parameters select — the
@@ -32,11 +35,12 @@ export declare const PARAMS: {
32
35
  */
33
36
  readonly LATEST: "latest";
34
37
  /**
35
- * GET operations limit number of documents
38
+ * At most this many documents in a list.
36
39
  * @example ?limit=4
37
40
  */
38
41
  readonly LIMIT: "limit";
39
- /** GET / CREATE / UPDATE a specific document locale
42
+ /**
43
+ * The locale a read or a write is for.
40
44
  * @example ?locale=en
41
45
  */
42
46
  readonly LOCALE: "locale";
@@ -45,7 +49,8 @@ export declare const PARAMS: {
45
49
  */
46
50
  readonly OFFSET: "offset";
47
51
  /**
48
- * Redirect or not after creation operation
52
+ * `false` keeps the panel's create action from redirecting to the new document: a create made
53
+ * from a nested form stays where it is (panel/pages/collection-document/actions.server.ts).
49
54
  * @example ?redirect=false
50
55
  */
51
56
  readonly REDIRECT: "redirect";
@@ -58,7 +63,10 @@ export declare const PARAMS: {
58
63
  * @example ?sort=-title
59
64
  */
60
65
  readonly SORT: "sort";
61
- /** GET / UPDATE a specific version*/
66
+ /**
67
+ * The version a read or an update is for, by its id.
68
+ * @example ?versionId=abc
69
+ */
62
70
  readonly VERSION_ID: "versionId";
63
71
  /**
64
72
  * The upload folder the panel list opens at; the create form sends it on as `_path`.
@@ -7,7 +7,10 @@ export const PARAMS = {
7
7
  * @example ?/update&autoSave=true&versionId=abc
8
8
  */
9
9
  AUTO_SAVE: 'autoSave',
10
- /** Fetch nested documents in relation / link at a specific depth */
10
+ /**
11
+ * How many levels of relations a read resolves into documents.
12
+ * @example ?depth=1
13
+ */
11
14
  DEPTH: 'depth',
12
15
  /**
13
16
  * Make a new version. The update starts from the row the other parameters select — the
@@ -32,11 +35,12 @@ export const PARAMS = {
32
35
  */
33
36
  LATEST: 'latest',
34
37
  /**
35
- * GET operations limit number of documents
38
+ * At most this many documents in a list.
36
39
  * @example ?limit=4
37
40
  */
38
41
  LIMIT: 'limit',
39
- /** GET / CREATE / UPDATE a specific document locale
42
+ /**
43
+ * The locale a read or a write is for.
40
44
  * @example ?locale=en
41
45
  */
42
46
  LOCALE: 'locale',
@@ -45,7 +49,8 @@ export const PARAMS = {
45
49
  */
46
50
  OFFSET: 'offset',
47
51
  /**
48
- * Redirect or not after creation operation
52
+ * `false` keeps the panel's create action from redirecting to the new document: a create made
53
+ * from a nested form stays where it is (panel/pages/collection-document/actions.server.ts).
49
54
  * @example ?redirect=false
50
55
  */
51
56
  REDIRECT: 'redirect',
@@ -58,7 +63,10 @@ export const PARAMS = {
58
63
  * @example ?sort=-title
59
64
  */
60
65
  SORT: 'sort',
61
- /** GET / UPDATE a specific version*/
66
+ /**
67
+ * The version a read or an update is for, by its id.
68
+ * @example ?versionId=abc
69
+ */
62
70
  VERSION_ID: 'versionId',
63
71
  /**
64
72
  * The upload folder the panel list opens at; the create form sends it on as `_path`.
@@ -1,5 +1,12 @@
1
1
  export declare const PACKAGE_NAME = "rimecms";
2
+ /**
3
+ * Whether this code runs from the rime repository rather than from an installed `rimecms`: a
4
+ * path test on this module's URL. Then rime's version is read from the root `package.json`,
5
+ * generated types carry eslint-disable lines, and the Vite plugin reloads on edits to
6
+ * `src/lib/core/config`.
7
+ */
2
8
  export declare const IS_RIME_REPO: boolean;
9
+ /** The app's `node_modules/.rime`: the dev cache of codegen memos and the `rime generate` mark. */
3
10
  export declare const RIME_DEV_CACHE_DIR: string;
4
11
  /** Consumer branding image convention: drop a file at static/assets/panel/panel.jpg. */
5
12
  export declare const PANEL_AUTH_IMAGE = "/assets/panel/panel.jpg";
@@ -1,6 +1,13 @@
1
1
  import path from 'path';
2
2
  export const PACKAGE_NAME = 'rimecms';
3
+ /**
4
+ * Whether this code runs from the rime repository rather than from an installed `rimecms`: a
5
+ * path test on this module's URL. Then rime's version is read from the root `package.json`,
6
+ * generated types carry eslint-disable lines, and the Vite plugin reloads on edits to
7
+ * `src/lib/core/config`.
8
+ */
3
9
  export const IS_RIME_REPO = !import.meta.url.includes('/node_modules/rimecms/');
10
+ /** The app's `node_modules/.rime`: the dev cache of codegen memos and the `rime generate` mark. */
4
11
  export const RIME_DEV_CACHE_DIR = path.resolve(process.cwd(), 'node_modules', '.rime');
5
12
  /** Consumer branding image convention: drop a file at static/assets/panel/panel.jpg. */
6
13
  export const PANEL_AUTH_IMAGE = '/assets/panel/panel.jpg';
@@ -1,11 +1,14 @@
1
+ /** The string stored under `key`, false when nothing is. */
1
2
  declare function get(key: string): string | false;
3
+ /** Stores `value` under `key`, creating node_modules/.rime when needed. */
2
4
  declare function set(key: string, value: string): void;
3
5
  /**
4
- * The two verbs for a memo — content that is only ever compared, never read back.
6
+ * Whether `content` hashes to what is stored under `key`. Stores nothing.
5
7
  *
6
- * Every codegen step asks the same question: is this the string I was given last time? Storing
7
- * the answer as a digest keeps a 400KB serialized config out of `node_modules/.rime` and makes
8
- * the comparison a fixed 64 bytes:
8
+ * `matches` and `remember` are the two verbs for a memo — content that is only ever compared,
9
+ * never read back. Every codegen step asks the same question: is this the string I was given
10
+ * last time? Storing the answer as a digest keeps a 400KB serialized config out of
11
+ * `node_modules/.rime` and makes the comparison a fixed 64 bytes:
9
12
  *
10
13
  * ```ts
11
14
  * if (cache.matches('config', memo)) return;
@@ -13,13 +16,13 @@ declare function set(key: string, value: string): void;
13
16
  * cache.remember('config', memo);
14
17
  * ```
15
18
  *
16
- * Split in two rather than one `changed()` because a step stores its memo only once its work
17
- * succeeded: a memo written before would skip the work forever after a failure.
19
+ * A step stores its memo only once its work succeeded: a memo written before would skip the
20
+ * work forever after a failure.
18
21
  */
19
- /** Whether `content` hashes to what is stored under `key`. Stores nothing. */
20
22
  declare function matches(key: string, content: string): boolean;
21
23
  /** Records `content` under `key`, as its digest. */
22
24
  declare function remember(key: string, content: string): void;
25
+ /** Removes what is stored under `key`. */
23
26
  declare function del(key: string): void;
24
27
  /** Removes every stored entry: the whole node_modules/.rime folder, whether or not it exists. */
25
28
  declare function clear(): void;
@@ -2,10 +2,7 @@ import { createHash } from 'node:crypto';
2
2
  import fs from 'fs';
3
3
  import path from 'path';
4
4
  import { RIME_DEV_CACHE_DIR } from '../constants.server.js';
5
- const dev = process.env.NODE_ENV === 'development';
6
- if (!fs.existsSync(RIME_DEV_CACHE_DIR) && dev) {
7
- fs.mkdirSync(RIME_DEV_CACHE_DIR);
8
- }
5
+ /** The string stored under `key`, false when nothing is. */
9
6
  function get(key) {
10
7
  const keyPath = path.join(RIME_DEV_CACHE_DIR, key + '.txt');
11
8
  const exist = fs.existsSync(keyPath);
@@ -14,6 +11,7 @@ function get(key) {
14
11
  }
15
12
  return false;
16
13
  }
14
+ /** Stores `value` under `key`, creating node_modules/.rime when needed. */
17
15
  function set(key, value) {
18
16
  if (!fs.existsSync(RIME_DEV_CACHE_DIR)) {
19
17
  fs.mkdirSync(RIME_DEV_CACHE_DIR);
@@ -23,11 +21,12 @@ function set(key, value) {
23
21
  }
24
22
  const digest = (content) => createHash('sha256').update(content).digest('hex');
25
23
  /**
26
- * The two verbs for a memo — content that is only ever compared, never read back.
24
+ * Whether `content` hashes to what is stored under `key`. Stores nothing.
27
25
  *
28
- * Every codegen step asks the same question: is this the string I was given last time? Storing
29
- * the answer as a digest keeps a 400KB serialized config out of `node_modules/.rime` and makes
30
- * the comparison a fixed 64 bytes:
26
+ * `matches` and `remember` are the two verbs for a memo — content that is only ever compared,
27
+ * never read back. Every codegen step asks the same question: is this the string I was given
28
+ * last time? Storing the answer as a digest keeps a 400KB serialized config out of
29
+ * `node_modules/.rime` and makes the comparison a fixed 64 bytes:
31
30
  *
32
31
  * ```ts
33
32
  * if (cache.matches('config', memo)) return;
@@ -35,10 +34,9 @@ const digest = (content) => createHash('sha256').update(content).digest('hex');
35
34
  * cache.remember('config', memo);
36
35
  * ```
37
36
  *
38
- * Split in two rather than one `changed()` because a step stores its memo only once its work
39
- * succeeded: a memo written before would skip the work forever after a failure.
37
+ * A step stores its memo only once its work succeeded: a memo written before would skip the
38
+ * work forever after a failure.
40
39
  */
41
- /** Whether `content` hashes to what is stored under `key`. Stores nothing. */
42
40
  function matches(key, content) {
43
41
  return get(key) === digest(content);
44
42
  }
@@ -46,6 +44,7 @@ function matches(key, content) {
46
44
  function remember(key, content) {
47
45
  set(key, digest(content));
48
46
  }
47
+ /** Removes what is stored under `key`. */
49
48
  function del(key) {
50
49
  const keyPath = path.join(RIME_DEV_CACHE_DIR, key + '.txt');
51
50
  if (fs.existsSync(keyPath)) {
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Runs `vite build` and packs a deployable ./app: the build, package.json and an index.js server
3
+ * (templates/build.ts). `withStorage` adds ./storage, `withStatic` ./static, `withEnv` a
4
+ * production .env. Prints the commands to run next.
5
+ */
1
6
  export declare const build: (args: {
2
7
  withEnv?: boolean;
3
8
  withStatic?: boolean;
@@ -24,6 +24,11 @@ const installCommands = {
24
24
  runEnv: 'bunx rime env'
25
25
  }
26
26
  };
27
+ /**
28
+ * Runs `vite build` and packs a deployable ./app: the build, package.json and an index.js server
29
+ * (templates/build.ts). `withStorage` adds ./storage, `withStatic` ./static, `withEnv` a
30
+ * production .env. Prints the commands to run next.
31
+ */
27
32
  export const build = async (args) => {
28
33
  const bun = usesBunScripts();
29
34
  // -w ships the database: refused while the adapter asks for a step first, `rime db:move` for a
@@ -52,6 +57,11 @@ export const build = async (args) => {
52
57
  process.exitCode = 1;
53
58
  return;
54
59
  }
60
+ if (!existsSync('./build')) {
61
+ logger.error('[✗] ./build not found: the SvelteKit adapter writes elsewhere, nothing packaged');
62
+ process.exitCode = 1;
63
+ return;
64
+ }
55
65
  // Create app directory
56
66
  mkdirSync('./app', { recursive: true });
57
67
  // Move build folder
@@ -71,8 +81,13 @@ export const build = async (args) => {
71
81
  }
72
82
  }
73
83
  if (args.withStatic) {
74
- cpSync('./static', './app/static', { recursive: true });
75
- logger.debug('[✓] static directory copied');
84
+ if (existsSync('./static')) {
85
+ cpSync('./static', './app/static', { recursive: true });
86
+ logger.debug('[✓] static directory copied');
87
+ }
88
+ else {
89
+ logger.warn('No static directory to copy (skip)');
90
+ }
76
91
  }
77
92
  // Create main entry server file
78
93
  writeFileSync('./app/index.js', nodeServer);
@@ -2,6 +2,7 @@
2
2
  * `rime clear`: removes the database adapter's files, then everything rime generated or keeps for
3
3
  * itself. Loads no config: the adapter's hooks come from the module `rime init` or the last dev
4
4
  * boot recorded in `node_modules/.rime`, else from the default adapter's, as after a fresh install.
5
+ * Asks first, with the list above, unless `force`.
5
6
  */
6
7
  export declare const clear: (args: {
7
8
  force?: boolean;
@@ -7,7 +7,7 @@ import path from 'node:path';
7
7
  import { CONFIG_DIR, GENERATED_DIR } from '../../constants.server.js';
8
8
  import { importAdapterHooks, recordedHooksModule } from '../util/adapter-hooks.server.js';
9
9
  import { prompt } from '../util/prompt.server.js';
10
- const clearMessage = `Are you sure you want to delete all related rime files (Y/n):
10
+ const clearMessage = `Are you sure you want to delete all related rime files:
11
11
  - the files of the database adapter
12
12
  - ./storage/uploads
13
13
  - ./src/routes/(rime)
@@ -23,11 +23,12 @@ const clearMessage = `Are you sure you want to delete all related rime files (Y/
23
23
  * `rime clear`: removes the database adapter's files, then everything rime generated or keeps for
24
24
  * itself. Loads no config: the adapter's hooks come from the module `rime init` or the last dev
25
25
  * boot recorded in `node_modules/.rime`, else from the default adapter's, as after a fresh install.
26
+ * Asks first, with the list above, unless `force`.
26
27
  */
27
28
  export const clear = async (args) => {
28
29
  let shouldProceed = true;
29
30
  if (!args.force) {
30
- const response = await prompt(`${clearMessage} (Y/n)`, 'n');
31
+ const response = await prompt(`${clearMessage}(y/N)`, 'n');
31
32
  shouldProceed = response.trim().toLowerCase() === 'y';
32
33
  }
33
34
  if (!shouldProceed) {
@@ -113,6 +113,27 @@ function rewriteSpecifiers(distDir, pkgName, pairs) {
113
113
  fs.writeFileSync(file, rewritten);
114
114
  }
115
115
  }
116
+ /**
117
+ * Whether an `exports` entry has the shape this command writes: `./X/module` pointing, through
118
+ * `types`, `browser` and `default` alone, at module files of `./dist/X/`.
119
+ *
120
+ * ```jsonc
121
+ * "./ui/module": { "browser": "./dist/ui/module.js", "default": "./dist/ui/module.server.js" } // written
122
+ * "./widgets/module": { "default": "./dist/ui/widgets/module.js" } // the author's alias
123
+ * "./widgets/module": "./src/widgets/module.js" // the author's
124
+ * ```
125
+ */
126
+ function isWritten(key, value) {
127
+ const subpath = key.match(/^\.\/(.+)\/module$/)?.[1];
128
+ if (!subpath || typeof value !== 'object' || value === null || !('default' in value)) {
129
+ return false;
130
+ }
131
+ const dir = './' + path.posix.join('dist', subpath);
132
+ return Object.entries(value).every(([condition, target]) => ['types', 'browser', 'default'].includes(condition) &&
133
+ typeof target === 'string' &&
134
+ path.posix.dirname(target) === dir &&
135
+ /^module(\.server|\.browser)?\.(js|ts|d\.ts)$/.test(path.posix.basename(target)));
136
+ }
116
137
  /**
117
138
  * One `exports` entry per pair, plus a `default` for every other entry that lacks one: an entry
118
139
  * with no `default` fails to resolve through the map.
@@ -121,10 +142,10 @@ function writeExports(root, distDir, pairs, stubs) {
121
142
  const pkgPath = path.join(root, 'package.json');
122
143
  const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
123
144
  const exportsMap = pkg.exports ?? {};
124
- // Idempotent: this command runs on every `rime package`, and a pair that disappeared must not leave
125
- // its entry behind pointing at a file dist/ no longer has.
126
- for (const key of Object.keys(exportsMap)) {
127
- if (key.endsWith('/module'))
145
+ // Idempotent: the entries a previous run wrote go, so a pair that disappeared leaves none
146
+ // behind. The author's own `/module` entries stay.
147
+ for (const [key, value] of Object.entries(exportsMap)) {
148
+ if (isWritten(key, value))
128
149
  delete exportsMap[key];
129
150
  }
130
151
  for (const [subpath, entry] of pairs) {
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Sanitizes the config, writes the modules declaration, then loads the config once in a
3
+ * throwaway Vite server, which runs codegen: routes, schema, types. `force` first empties
4
+ * node_modules/.rime and src/routes/(rime).
5
+ */
1
6
  export declare const generate: (args: {
2
7
  force?: boolean;
3
8
  }) => Promise<void>;
@@ -7,6 +7,11 @@ import { logger } from '../../../logger.server.js';
7
7
  import { trycatch } from '../../../../util/function.js';
8
8
  import { mkdirSync, rmSync } from 'fs';
9
9
  import path from 'path';
10
+ /**
11
+ * Sanitizes the config, writes the modules declaration, then loads the config once in a
12
+ * throwaway Vite server, which runs codegen: routes, schema, types. `force` first empties
13
+ * node_modules/.rime and src/routes/(rime).
14
+ */
10
15
  export const generate = async (args) => {
11
16
  const { force } = args;
12
17
  /**
@@ -21,7 +26,7 @@ export const generate = async (args) => {
21
26
  logger.error(err.message);
22
27
  }
23
28
  }
24
- /*
29
+ /**
25
30
  * Delete routes/(rime) folder
26
31
  */
27
32
  function clearRoutes() {
@@ -32,12 +37,6 @@ export const generate = async (args) => {
32
37
  logger.error(err.message);
33
38
  }
34
39
  }
35
- /**
36
- * Sanitize the user config into GENERATED_DIR (`src/+rime.generated` by default)
37
- */
38
- async function sanitizeConfig() {
39
- await sanitize();
40
- }
41
40
  /**
42
41
  * Create the vite devServer
43
42
  */
@@ -74,7 +73,7 @@ export const generate = async (args) => {
74
73
  cache.set('.cli', `${process.pid} ${Date.now()}`);
75
74
  try {
76
75
  ensureUserConfigExist();
77
- await sanitizeConfig();
76
+ await sanitize();
78
77
  // Normal `vite dev` writes this from `configureServer`'s `listening` event, which never
79
78
  // fires here — this command's own Vite server runs in `middlewareMode` (no `httpServer`).
80
79
  regenerateModulesDeclaration();
@@ -6,5 +6,12 @@ type Args = {
6
6
  /** The database adapter: `sqlite`, or a package with a `hooks` entry. */
7
7
  adapter?: string;
8
8
  };
9
+ /**
10
+ * `rime init`: sets a SvelteKit app up for rime. Writes .env, src/env.ts and the .gitignore
11
+ * entries, records the database adapter and lets it write its own files, then writes the config,
12
+ * the Bun scripts (with `bun`), adapter-node and the Vite plugin. Installs the dependencies unless
13
+ * `skipInstall`, then runs `generate({ force: true })`. `name` names the database; without it the
14
+ * package name is used, asked for unless `force`.
15
+ */
9
16
  export declare const init: ({ force, name: incomingName, skipInstall, bun, adapter: adapterName }: Args) => Promise<void>;
10
17
  export {};