rimecms 1.2.0 → 1.4.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 (748) 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/constant.d.ts +16 -0
  5. package/dist/adapter-sqlite/constant.js +16 -0
  6. package/dist/adapter-sqlite/db-move.server.d.ts +31 -0
  7. package/dist/adapter-sqlite/db-move.server.js +102 -0
  8. package/dist/adapter-sqlite/drizzle-config.server.d.ts +9 -0
  9. package/dist/adapter-sqlite/drizzle-config.server.js +39 -0
  10. package/dist/adapter-sqlite/generate-schema/column.server.d.ts +8 -6
  11. package/dist/adapter-sqlite/generate-schema/column.server.js +13 -49
  12. package/dist/adapter-sqlite/generate-schema/index.server.d.ts +1 -0
  13. package/dist/adapter-sqlite/generate-schema/index.server.js +6 -0
  14. package/dist/adapter-sqlite/generate-schema/relations/junction.server.d.ts +3 -3
  15. package/dist/adapter-sqlite/generate-schema/relations/junction.server.js +3 -3
  16. package/dist/adapter-sqlite/generate-schema/root.server.d.ts +4 -0
  17. package/dist/adapter-sqlite/generate-schema/root.server.js +26 -33
  18. package/dist/adapter-sqlite/generate-schema/templates.server.d.ts +0 -22
  19. package/dist/adapter-sqlite/generate-schema/templates.server.js +0 -33
  20. package/dist/adapter-sqlite/generate-schema/write.server.d.ts +6 -0
  21. package/dist/adapter-sqlite/generate-schema/write.server.js +13 -3
  22. package/dist/adapter-sqlite/hooks.server.d.ts +3 -0
  23. package/dist/adapter-sqlite/hooks.server.js +64 -0
  24. package/dist/adapter-sqlite/index.server.d.ts +9 -1
  25. package/dist/adapter-sqlite/index.server.js +23 -2
  26. package/dist/adapter-sqlite/locales.server.js +1 -4
  27. package/dist/adapter-sqlite/order-by.server.d.ts +6 -0
  28. package/dist/adapter-sqlite/order-by.server.js +6 -0
  29. package/dist/adapter-sqlite/read.server.d.ts +12 -1
  30. package/dist/adapter-sqlite/read.server.js +94 -38
  31. package/dist/adapter-sqlite/registry.server.d.ts +2 -2
  32. package/dist/adapter-sqlite/registry.server.js +2 -2
  33. package/dist/adapter-sqlite/relations.server.d.ts +5 -0
  34. package/dist/adapter-sqlite/relations.server.js +27 -7
  35. package/dist/adapter-sqlite/repeatable.server.d.ts +4 -1
  36. package/dist/adapter-sqlite/repeatable.server.js +4 -1
  37. package/dist/adapter-sqlite/select.server.d.ts +6 -0
  38. package/dist/adapter-sqlite/select.server.js +56 -113
  39. package/dist/adapter-sqlite/table.server.js +7 -0
  40. package/dist/adapter-sqlite/transform.server.js +8 -2
  41. package/dist/adapter-sqlite/where.server.d.ts +11 -0
  42. package/dist/adapter-sqlite/where.server.js +237 -236
  43. package/dist/adapter-sqlite/write.server.d.ts +5 -0
  44. package/dist/adapter-sqlite/write.server.js +9 -7
  45. package/dist/core/adapter.d.ts +63 -12
  46. package/dist/core/auth/access.d.ts +3 -5
  47. package/dist/core/auth/access.js +3 -5
  48. package/dist/core/auth/augment.js +3 -4
  49. package/dist/core/auth/augment.server.d.ts +4 -0
  50. package/dist/core/auth/augment.server.js +4 -0
  51. package/dist/core/auth/better-auth/config.server.d.ts +24 -16
  52. package/dist/core/auth/better-auth/config.server.js +6 -0
  53. package/dist/core/auth/better-auth/hooks.server.js +17 -5
  54. package/dist/core/auth/better-auth/instance.server.d.ts +38 -32
  55. package/dist/core/auth/better-auth/permissions.d.ts +8 -7
  56. package/dist/core/auth/better-auth/permissions.js +1 -0
  57. package/dist/core/auth/better-auth-tables.server.d.ts +9 -7
  58. package/dist/core/auth/better-auth-tables.server.js +9 -7
  59. package/dist/core/auth/constant.d.ts +3 -3
  60. package/dist/core/auth/constant.js +3 -3
  61. package/dist/core/auth/constant.server.d.ts +3 -3
  62. package/dist/core/auth/constant.server.js +3 -3
  63. package/dist/core/auth/handler/index.server.js +37 -15
  64. package/dist/core/auth/hooks/create-better-auth-user.server.d.ts +4 -2
  65. package/dist/core/auth/hooks/create-better-auth-user.server.js +132 -185
  66. package/dist/core/auth/hooks/forward-roles.server.d.ts +2 -1
  67. package/dist/core/auth/hooks/forward-roles.server.js +3 -3
  68. package/dist/core/auth/hooks/populate-api-key.server.d.ts +2 -2
  69. package/dist/core/auth/hooks/populate-api-key.server.js +11 -3
  70. package/dist/core/auth/hooks/prevent-user-mutations.server.d.ts +2 -2
  71. package/dist/core/auth/hooks/prevent-user-mutations.server.js +5 -4
  72. package/dist/core/auth/hooks/sign-in-new-user.server.d.ts +5 -6
  73. package/dist/core/auth/hooks/sign-in-new-user.server.js +5 -6
  74. package/dist/core/auth/staff/derive.d.ts +10 -0
  75. package/dist/core/auth/staff/derive.js +10 -0
  76. package/dist/core/auth/tables.d.ts +4 -0
  77. package/dist/core/auth/tables.js +4 -0
  78. package/dist/core/auth/types.d.ts +10 -5
  79. package/dist/core/auth/user.server.d.ts +8 -3
  80. package/dist/core/auth/user.server.js +8 -3
  81. package/dist/core/auth/validate-config.d.ts +1 -3
  82. package/dist/core/auth/validate-config.js +2 -4
  83. package/dist/core/boot.server.d.ts +38 -32
  84. package/dist/core/boot.server.js +7 -2
  85. package/dist/core/codegen.server.d.ts +2 -3
  86. package/dist/core/codegen.server.js +18 -16
  87. package/dist/core/config/build.d.ts +1 -1
  88. package/dist/core/config/build.server.d.ts +2 -1
  89. package/dist/core/config/build.server.js +1 -0
  90. package/dist/core/config/context.server.d.ts +3 -9
  91. package/dist/core/config/context.server.js +3 -9
  92. package/dist/core/config/index.server.d.ts +4 -2
  93. package/dist/core/config/index.server.js +4 -2
  94. package/dist/core/config/types.d.ts +17 -6
  95. package/dist/core/config/validate.server.d.ts +4 -0
  96. package/dist/core/config/validate.server.js +100 -90
  97. package/dist/core/constants.d.ts +13 -5
  98. package/dist/core/constants.js +13 -5
  99. package/dist/core/constants.server.d.ts +7 -0
  100. package/dist/core/constants.server.js +7 -0
  101. package/dist/core/dev/cache.server.d.ts +10 -7
  102. package/dist/core/dev/cache.server.js +10 -11
  103. package/dist/core/dev/cli/commands/build.d.ts +7 -2
  104. package/dist/core/dev/cli/commands/build.js +38 -12
  105. package/dist/core/dev/cli/commands/clear.server.d.ts +6 -0
  106. package/dist/core/dev/cli/commands/clear.server.js +20 -6
  107. package/dist/core/dev/cli/commands/generate-exports.server.js +25 -4
  108. package/dist/core/dev/cli/commands/generate.server.d.ts +5 -0
  109. package/dist/core/dev/cli/commands/generate.server.js +7 -8
  110. package/dist/core/dev/cli/commands/init.server.d.ts +10 -1
  111. package/dist/core/dev/cli/commands/init.server.js +45 -53
  112. package/dist/core/dev/cli/commands/uploads-move.server.js +3 -0
  113. package/dist/core/dev/cli/index.js +34 -16
  114. package/dist/core/dev/cli/templates/build.d.ts +4 -0
  115. package/dist/core/dev/cli/templates/build.js +4 -0
  116. package/dist/core/dev/cli/templates/init.d.ts +7 -10
  117. package/dist/core/dev/cli/templates/init.js +22 -47
  118. package/dist/core/dev/cli/util/adapter-hooks.server.d.ts +15 -0
  119. package/dist/core/dev/cli/util/adapter-hooks.server.js +17 -0
  120. package/dist/core/dev/cli/util/package-manager.server.d.ts +10 -1
  121. package/dist/core/dev/cli/util/package-manager.server.js +21 -19
  122. package/dist/core/dev/cli/util/package.server.d.ts +1 -0
  123. package/dist/core/dev/cli/util/package.server.js +2 -2
  124. package/dist/core/dev/cli/util/project-name.d.ts +2 -1
  125. package/dist/core/dev/cli/util/project-name.js +6 -4
  126. package/dist/core/dev/cli/util/prompt.server.d.ts +2 -1
  127. package/dist/core/dev/cli/util/prompt.server.js +2 -1
  128. package/dist/core/dev/codegen/routes/common.server.d.ts +12 -0
  129. package/dist/core/dev/codegen/routes/common.server.js +9 -17
  130. package/dist/core/dev/codegen/routes/custom-css.server.d.ts +3 -9
  131. package/dist/core/dev/codegen/routes/custom-css.server.js +8 -34
  132. package/dist/core/dev/codegen/routes/index.server.d.ts +4 -5
  133. package/dist/core/dev/codegen/routes/index.server.js +33 -17
  134. package/dist/core/dev/codegen/routes/util.server.d.ts +13 -23
  135. package/dist/core/dev/codegen/routes/util.server.js +15 -25
  136. package/dist/core/dev/codegen/runtime/index.server.d.ts +2 -3
  137. package/dist/core/dev/codegen/runtime/index.server.js +2 -3
  138. package/dist/core/dev/codegen/runtime/parse-exports.server.js +10 -3
  139. package/dist/core/dev/codegen/sanitize/index.server.d.ts +11 -1
  140. package/dist/core/dev/codegen/sanitize/index.server.js +81 -50
  141. package/dist/core/dev/codegen/types/index.server.d.ts +2 -4
  142. package/dist/core/dev/codegen/types/index.server.js +6 -10
  143. package/dist/core/dev/codegen/types/templates.server.d.ts +4 -2
  144. package/dist/core/dev/codegen/types/templates.server.js +13 -26
  145. package/dist/core/dev/config-memo.server.js +6 -7
  146. package/dist/core/dev/constants.server.d.ts +4 -2
  147. package/dist/core/dev/constants.server.js +7 -4
  148. package/dist/core/dev/deny-storage.server.d.ts +2 -2
  149. package/dist/core/dev/deny-storage.server.js +2 -2
  150. package/dist/core/dev/ensure.server.d.ts +5 -0
  151. package/dist/core/dev/ensure.server.js +9 -22
  152. package/dist/core/dev/env.server.d.ts +3 -1
  153. package/dist/core/dev/env.server.js +3 -1
  154. package/dist/core/dev/vite.server.d.ts +10 -0
  155. package/dist/core/dev/vite.server.js +21 -5
  156. package/dist/core/errors/handler.server.d.ts +9 -3
  157. package/dist/core/errors/handler.server.js +11 -6
  158. package/dist/core/errors/index.d.ts +21 -1
  159. package/dist/core/errors/index.js +23 -3
  160. package/dist/core/fields/builders/boolean-builder.d.ts +4 -0
  161. package/dist/core/fields/builders/boolean-builder.js +6 -1
  162. package/dist/core/fields/builders/field-builder.d.ts +16 -4
  163. package/dist/core/fields/builders/field-builder.js +11 -0
  164. package/dist/core/fields/builders/form-field-builder.d.ts +46 -2
  165. package/dist/core/fields/builders/form-field-builder.js +47 -2
  166. package/dist/core/fields/builders/index.d.ts +0 -2
  167. package/dist/core/fields/builders/index.js +0 -2
  168. package/dist/core/fields/builders/select-builder.d.ts +13 -2
  169. package/dist/core/fields/builders/select-builder.js +13 -1
  170. package/dist/core/fields/initial.d.ts +4 -1
  171. package/dist/core/fields/types.d.ts +5 -6
  172. package/dist/core/fields/util.d.ts +9 -14
  173. package/dist/core/fields/util.js +10 -15
  174. package/dist/core/fields/validate.d.ts +3 -0
  175. package/dist/core/fields/validate.js +3 -0
  176. package/dist/core/fields/walk.d.ts +4 -1
  177. package/dist/core/fields/walk.js +1 -2
  178. package/dist/core/handler.server.d.ts +5 -0
  179. package/dist/core/handler.server.js +15 -1
  180. package/dist/core/i18n/en/common.d.ts +28 -0
  181. package/dist/core/i18n/en/common.js +28 -0
  182. package/dist/core/i18n/en/errors.d.ts +6 -0
  183. package/dist/core/i18n/en/errors.js +6 -0
  184. package/dist/core/i18n/en/fields.d.ts +11 -0
  185. package/dist/core/i18n/en/fields.js +12 -1
  186. package/dist/core/i18n/fr/common.d.ts +28 -0
  187. package/dist/core/i18n/fr/common.js +29 -0
  188. package/dist/core/i18n/fr/errors.d.ts +6 -0
  189. package/dist/core/i18n/fr/errors.js +6 -0
  190. package/dist/core/i18n/fr/fields.d.ts +11 -0
  191. package/dist/core/i18n/fr/fields.js +12 -1
  192. package/dist/core/i18n/index.d.ts +1 -0
  193. package/dist/core/i18n/index.js +7 -0
  194. package/dist/core/i18n/register.server.js +1 -1
  195. package/dist/core/locale/types.d.ts +2 -6
  196. package/dist/core/logger.server.js +8 -2
  197. package/dist/core/panel/configure.js +2 -2
  198. package/dist/core/panel/types.d.ts +4 -2
  199. package/dist/core/pipeline/build-document.server.d.ts +2 -2
  200. package/dist/core/pipeline/build-document.server.js +2 -2
  201. package/dist/core/pipeline/build.server.js +2 -12
  202. package/dist/core/{prototype/shared/versions/hooks → pipeline}/fallback-data-from-original.d.ts +6 -6
  203. package/dist/core/{prototype/shared/versions/hooks → pipeline}/fallback-data-from-original.js +5 -5
  204. package/dist/core/pipeline/hooks/original-config-map.server.d.ts +3 -2
  205. package/dist/core/pipeline/hooks/original-config-map.server.js +3 -2
  206. package/dist/core/pipeline/hooks/process-document-fields.server.d.ts +2 -1
  207. package/dist/core/pipeline/hooks/process-document-fields.server.js +4 -9
  208. package/dist/core/pipeline/hooks/sort-document-props.server.js +4 -3
  209. package/dist/core/pipeline/hooks/validate-fields.server.d.ts +15 -1
  210. package/dist/core/pipeline/hooks/validate-fields.server.js +142 -47
  211. package/dist/core/pipeline/persist/blocks/extract.server.d.ts +5 -0
  212. package/dist/core/pipeline/persist/blocks/extract.server.js +5 -0
  213. package/dist/core/pipeline/persist/blocks/index.server.d.ts +3 -7
  214. package/dist/core/pipeline/persist/blocks/index.server.js +3 -8
  215. package/dist/core/pipeline/persist/relations/diff.server.js +1 -0
  216. package/dist/core/pipeline/persist/relations/extract.server.d.ts +1 -0
  217. package/dist/core/pipeline/persist/relations/extract.server.js +2 -0
  218. package/dist/core/pipeline/persist/relations/index.server.d.ts +6 -0
  219. package/dist/core/pipeline/persist/relations/index.server.js +31 -8
  220. package/dist/core/pipeline/persist/repeatable.server.d.ts +21 -12
  221. package/dist/core/pipeline/persist/repeatable.server.js +28 -4
  222. package/dist/core/pipeline/persist/tree/extract.server.d.ts +5 -0
  223. package/dist/core/pipeline/persist/tree/extract.server.js +6 -8
  224. package/dist/core/pipeline/persist/tree/index.server.d.ts +5 -0
  225. package/dist/core/pipeline/persist/tree/index.server.js +5 -0
  226. package/dist/core/pipeline/populate-relations.server.d.ts +1 -0
  227. package/dist/core/pipeline/populate-relations.server.js +1 -0
  228. package/dist/core/pipeline/run.server.d.ts +26 -17
  229. package/dist/core/pipeline/run.server.js +51 -9
  230. package/dist/core/pipeline/types.d.ts +30 -7
  231. package/dist/core/pipeline/without-denied-fields.d.ts +15 -0
  232. package/dist/core/pipeline/without-denied-fields.js +53 -2
  233. package/dist/core/plugins/api-init/index.server.d.ts +8 -0
  234. package/dist/core/plugins/api-init/index.server.js +8 -0
  235. package/dist/core/plugins/cache/HeaderButton.svelte +15 -6
  236. package/dist/core/plugins/cache/cache.server.d.ts +9 -0
  237. package/dist/core/plugins/cache/cache.server.js +9 -0
  238. package/dist/core/plugins/cache/handler.server.d.ts +5 -0
  239. package/dist/core/plugins/cache/handler.server.js +5 -0
  240. package/dist/core/plugins/cache/module.server.d.ts +4 -19
  241. package/dist/core/plugins/cache/module.server.js +5 -1
  242. package/dist/core/plugins/cache/types.d.ts +6 -0
  243. package/dist/core/plugins/index.d.ts +1 -0
  244. package/dist/core/plugins/index.js +1 -0
  245. package/dist/core/plugins/mailer/index.server.d.ts +5 -2
  246. package/dist/core/plugins/mailer/index.server.js +4 -0
  247. package/dist/core/plugins/plugins.server.d.ts +1 -0
  248. package/dist/core/plugins/plugins.server.js +1 -0
  249. package/dist/core/plugins/sse/client.js +4 -0
  250. package/dist/core/prototype/area/definition.server.d.ts +2 -3
  251. package/dist/core/prototype/area/definition.server.js +2 -3
  252. package/dist/core/prototype/area/operations/find.d.ts +5 -0
  253. package/dist/core/prototype/area/operations/find.js +5 -0
  254. package/dist/core/prototype/area/rest/endpoint.server.d.ts +3 -3
  255. package/dist/core/prototype/area/rest/endpoint.server.js +3 -3
  256. package/dist/core/prototype/area/rest/get.server.d.ts +2 -1
  257. package/dist/core/prototype/area/rest/get.server.js +2 -1
  258. package/dist/core/prototype/area/rest/update.server.d.ts +2 -1
  259. package/dist/core/prototype/area/rest/update.server.js +2 -1
  260. package/dist/core/prototype/collection/api.server.d.ts +15 -1
  261. package/dist/core/prototype/collection/api.server.js +16 -0
  262. package/dist/core/prototype/collection/augment-label.d.ts +9 -0
  263. package/dist/core/prototype/collection/augment-label.js +9 -0
  264. package/dist/core/prototype/collection/definition.d.ts +1 -1
  265. package/dist/core/prototype/collection/definition.js +1 -1
  266. package/dist/core/prototype/collection/hooks/merge-with-initial.server.d.ts +3 -3
  267. package/dist/core/prototype/collection/hooks/merge-with-initial.server.js +3 -3
  268. package/dist/core/prototype/collection/hooks.server.d.ts +2 -6
  269. package/dist/core/prototype/collection/hooks.server.js +8 -9
  270. package/dist/core/prototype/collection/nested/hooks/add-children.server.d.ts +3 -1
  271. package/dist/core/prototype/collection/nested/hooks/add-children.server.js +19 -11
  272. package/dist/core/prototype/collection/nested/hooks/index.server.d.ts +1 -0
  273. package/dist/core/prototype/collection/nested/hooks/index.server.js +1 -0
  274. package/dist/core/prototype/collection/nested/hooks/place-at-end.server.d.ts +10 -0
  275. package/dist/core/prototype/collection/nested/hooks/place-at-end.server.js +24 -0
  276. package/dist/core/prototype/collection/nested/move.server.d.ts +35 -0
  277. package/dist/core/prototype/collection/nested/move.server.js +74 -0
  278. package/dist/core/prototype/collection/operations/count.d.ts +19 -0
  279. package/dist/core/prototype/collection/operations/count.js +23 -0
  280. package/dist/core/prototype/collection/operations/create.d.ts +16 -0
  281. package/dist/core/prototype/collection/operations/create.js +46 -26
  282. package/dist/core/prototype/collection/operations/delete-by-id.d.ts +5 -0
  283. package/dist/core/prototype/collection/operations/delete-by-id.js +5 -0
  284. package/dist/core/prototype/collection/operations/delete.d.ts +8 -0
  285. package/dist/core/prototype/collection/operations/delete.js +8 -0
  286. package/dist/core/prototype/collection/operations/duplicate.d.ts +8 -0
  287. package/dist/core/prototype/collection/operations/duplicate.js +12 -0
  288. package/dist/core/prototype/collection/operations/find-by-id.d.ts +5 -0
  289. package/dist/core/prototype/collection/operations/find-by-id.js +5 -0
  290. package/dist/core/prototype/collection/operations/find.d.ts +6 -1
  291. package/dist/core/prototype/collection/operations/find.js +7 -2
  292. package/dist/core/prototype/collection/rest/count.server.d.ts +5 -0
  293. package/dist/core/prototype/collection/rest/count.server.js +12 -0
  294. package/dist/core/prototype/collection/rest/create.server.d.ts +2 -1
  295. package/dist/core/prototype/collection/rest/create.server.js +2 -1
  296. package/dist/core/prototype/collection/rest/delete-by-id.server.d.ts +1 -3
  297. package/dist/core/prototype/collection/rest/delete-by-id.server.js +1 -3
  298. package/dist/core/prototype/collection/rest/get-by-id.server.d.ts +2 -1
  299. package/dist/core/prototype/collection/rest/get-by-id.server.js +2 -1
  300. package/dist/core/prototype/collection/rest/get.server.d.ts +2 -1
  301. package/dist/core/prototype/collection/rest/get.server.js +2 -1
  302. package/dist/core/prototype/collection/rest/index.server.js +5 -0
  303. package/dist/core/prototype/collection/rest/lock.server.js +0 -5
  304. package/dist/core/prototype/collection/rest/move.server.d.ts +11 -0
  305. package/dist/core/prototype/collection/rest/move.server.js +34 -0
  306. package/dist/core/prototype/collection/rest/update-by-id.server.d.ts +3 -1
  307. package/dist/core/prototype/collection/rest/update-by-id.server.js +3 -1
  308. package/dist/core/prototype/collection/thumbnail/hooks/set-document-thumbnail.server.js +17 -9
  309. package/dist/core/prototype/collection/upload/boot/index.server.d.ts +3 -5
  310. package/dist/core/prototype/collection/upload/boot/index.server.js +3 -5
  311. package/dist/core/prototype/collection/upload/directories/configure.server.js +1 -2
  312. package/dist/core/prototype/collection/upload/directories/create.server.d.ts +15 -0
  313. package/dist/core/prototype/collection/upload/directories/create.server.js +19 -0
  314. package/dist/core/prototype/collection/upload/directories/derive.js +2 -2
  315. package/dist/core/prototype/collection/upload/directories/pipeline.server.js +5 -4
  316. package/dist/core/prototype/collection/upload/disk/save.server.d.ts +9 -5
  317. package/dist/core/prototype/collection/upload/disk/save.server.js +19 -6
  318. package/dist/core/prototype/collection/upload/ensure.server.d.ts +2 -7
  319. package/dist/core/prototype/collection/upload/ensure.server.js +2 -7
  320. package/dist/core/prototype/collection/upload/handler.server.d.ts +4 -0
  321. package/dist/core/prototype/collection/upload/handler.server.js +13 -4
  322. package/dist/core/prototype/collection/upload/hooks/convert-base64.server.d.ts +3 -10
  323. package/dist/core/prototype/collection/upload/hooks/convert-base64.server.js +5 -18
  324. package/dist/core/prototype/collection/upload/hooks/delete-folder-contents.server.d.ts +10 -0
  325. package/dist/core/prototype/collection/upload/hooks/delete-folder-contents.server.js +30 -0
  326. package/dist/core/prototype/collection/upload/hooks/extract-path.server.d.ts +1 -1
  327. package/dist/core/prototype/collection/upload/hooks/extract-path.server.js +1 -1
  328. package/dist/core/prototype/collection/upload/hooks/handle-path-creation.server.js +8 -20
  329. package/dist/core/prototype/collection/upload/hooks/index.server.d.ts +2 -5
  330. package/dist/core/prototype/collection/upload/hooks/index.server.js +2 -5
  331. package/dist/core/prototype/collection/upload/hooks/populate-sizes.server.d.ts +4 -2
  332. package/dist/core/prototype/collection/upload/hooks/populate-sizes.server.js +18 -19
  333. package/dist/core/prototype/collection/upload/hooks/process-file-upload.server.d.ts +3 -1
  334. package/dist/core/prototype/collection/upload/hooks/process-file-upload.server.js +16 -3
  335. package/dist/core/prototype/collection/upload/hooks/update-directory-children.server.js +3 -2
  336. package/dist/core/prototype/collection/upload/module.d.ts +4 -2
  337. package/dist/core/prototype/collection/upload/module.js +12 -17
  338. package/dist/core/prototype/collection/upload/module.server.d.ts +3 -4
  339. package/dist/core/prototype/collection/upload/module.server.js +3 -4
  340. package/dist/core/prototype/collection/upload/types.d.ts +21 -6
  341. package/dist/core/prototype/collection/upload/util/client.d.ts +2 -2
  342. package/dist/core/prototype/collection/upload/util/client.js +2 -2
  343. package/dist/core/prototype/collection/upload/util/config.d.ts +1 -0
  344. package/dist/core/prototype/collection/upload/util/converter.server.d.ts +5 -0
  345. package/dist/core/prototype/collection/upload/util/converter.server.js +16 -24
  346. package/dist/core/prototype/collection/upload/util/mime.d.ts +60 -0
  347. package/dist/core/prototype/collection/upload/util/mime.js +94 -4
  348. package/dist/core/prototype/collection/upload/util/path.d.ts +5 -1
  349. package/dist/core/prototype/collection/upload/util/path.js +9 -12
  350. package/dist/core/prototype/define.d.ts +14 -0
  351. package/dist/core/prototype/define.js +14 -0
  352. package/dist/core/prototype/shared/title/find-title.js +1 -0
  353. package/dist/core/prototype/shared/title/select.d.ts +2 -2
  354. package/dist/core/prototype/shared/title/select.js +2 -2
  355. package/dist/core/prototype/shared/url/hooks/set-live-url.server.js +2 -3
  356. package/dist/core/prototype/shared/versions/augment.js +8 -4
  357. package/dist/core/prototype/shared/versions/hooks/handle-new-version.server.js +6 -2
  358. package/dist/core/prototype/shared/versions/validate-config.server.js +1 -2
  359. package/dist/core/prototype/types.d.ts +0 -5
  360. package/dist/core/rime.server.d.ts +3 -2
  361. package/dist/core/rime.server.js +3 -2
  362. package/dist/core/routes/context.server.d.ts +11 -0
  363. package/dist/core/routes/context.server.js +11 -0
  364. package/dist/core/routes/handler.server.d.ts +4 -3
  365. package/dist/core/routes/handler.server.js +4 -3
  366. package/dist/core/routes/panel-navigation.d.ts +4 -5
  367. package/dist/core/routes/panel-navigation.js +4 -8
  368. package/dist/core/routes/util.d.ts +8 -2
  369. package/dist/core/routes/util.js +10 -4
  370. package/dist/fields/blocks/component/AddBlockButton.svelte +1 -0
  371. package/dist/fields/blocks/component/Blocks.svelte +15 -11
  372. package/dist/fields/blocks/component/focus/BlocksFocus.svelte +22 -10
  373. package/dist/fields/blocks/component/focus/LayersList.svelte +5 -0
  374. package/dist/fields/blocks/component/focus/Palette.svelte +0 -1
  375. package/dist/fields/blocks/component/focus/Renders.svelte +5 -4
  376. package/dist/fields/blocks/component/focus/Renders.svelte.d.ts +2 -1
  377. package/dist/fields/blocks/component/focus/focus.svelte.js +42 -13
  378. package/dist/fields/blocks/component/picker/BlockPicker.svelte +2 -2
  379. package/dist/fields/blocks/index.d.ts +16 -0
  380. package/dist/fields/blocks/index.js +15 -2
  381. package/dist/fields/checkbox/component/Checkbox.svelte +1 -0
  382. package/dist/fields/combobox/component/ComboBox.svelte +3 -2
  383. package/dist/fields/combobox/index.d.ts +1 -0
  384. package/dist/fields/combobox/index.js +1 -0
  385. package/dist/fields/component/index.d.ts +3 -0
  386. package/dist/fields/component/index.js +3 -0
  387. package/dist/fields/date/component/Date.svelte +8 -5
  388. package/dist/fields/date/index.d.ts +1 -0
  389. package/dist/fields/date/index.js +1 -0
  390. package/dist/fields/email/component/Email.svelte +8 -5
  391. package/dist/fields/email/index.d.ts +1 -0
  392. package/dist/fields/email/index.js +1 -0
  393. package/dist/fields/group/component/Group.svelte +8 -15
  394. package/dist/fields/group/index.d.ts +7 -1
  395. package/dist/fields/group/index.js +5 -4
  396. package/dist/fields/link/component/Link.svelte +19 -8
  397. package/dist/fields/link/component/RessourceInput.svelte +68 -47
  398. package/dist/fields/link/index.d.ts +12 -0
  399. package/dist/fields/link/index.js +14 -1
  400. package/dist/fields/number/component/Number.svelte +1 -0
  401. package/dist/fields/number/index.js +5 -3
  402. package/dist/fields/radio/component/Radio.svelte +12 -3
  403. package/dist/fields/radio/index.d.ts +1 -0
  404. package/dist/fields/radio/index.js +1 -0
  405. package/dist/fields/relation/component/Cell.svelte +4 -4
  406. package/dist/fields/relation/component/Relation.svelte +92 -131
  407. package/dist/fields/relation/component/Relation.svelte.d.ts +0 -1
  408. package/dist/fields/relation/component/RelationInline.svelte +22 -27
  409. package/dist/fields/relation/component/default/Default.svelte +50 -19
  410. package/dist/fields/relation/component/default/Default.svelte.d.ts +12 -1
  411. package/dist/fields/relation/component/types.d.ts +5 -3
  412. package/dist/fields/relation/component/upload/Browse.svelte +50 -41
  413. package/dist/fields/relation/component/upload/Browse.svelte.d.ts +6 -1
  414. package/dist/fields/relation/component/upload/Upload.svelte +8 -3
  415. package/dist/fields/relation/component/upload/Upload.svelte.d.ts +0 -1
  416. package/dist/fields/relation/index.d.ts +27 -10
  417. package/dist/fields/relation/index.js +16 -0
  418. package/dist/fields/relation/populate.js +1 -0
  419. package/dist/fields/relation/query.d.ts +22 -0
  420. package/dist/fields/relation/query.js +29 -0
  421. package/dist/fields/relation/relation.test-d.js +11 -0
  422. package/dist/fields/repeatable/RepeatableActions.svelte +4 -0
  423. package/dist/fields/repeatable/RepeatableActions.svelte.d.ts +4 -0
  424. package/dist/fields/repeatable.js +3 -21
  425. package/dist/fields/rich-text/client.d.ts +26 -0
  426. package/dist/fields/rich-text/client.js +26 -0
  427. package/dist/fields/rich-text/component/RichTextInline.svelte +2 -9
  428. package/dist/fields/rich-text/component/RichTextInline.svelte.d.ts +2 -9
  429. package/dist/fields/rich-text/component/bubble-menu/bubble-menu.svelte +2 -0
  430. package/dist/fields/rich-text/component/bubble-menu/icon-button/icon-button.css +0 -1
  431. package/dist/fields/rich-text/component/bubble-menu/icon-button/icon-button.svelte +1 -2
  432. package/dist/fields/rich-text/component/bubble-menu/node-selector/node-selector.css +0 -1
  433. package/dist/fields/rich-text/component/bubble-menu/node-selector/node-selector.svelte +9 -6
  434. package/dist/fields/rich-text/component/context.svelte.d.ts +1 -0
  435. package/dist/fields/rich-text/component/context.svelte.js +1 -0
  436. package/dist/fields/rich-text/component/drag-handle/drag-handle.css +0 -1
  437. package/dist/fields/rich-text/component/drag-handle/drag-handle.svelte +1 -0
  438. package/dist/fields/rich-text/component/styles/editor.css +0 -1
  439. package/dist/fields/rich-text/component/styles/field.css +10 -11
  440. package/dist/fields/rich-text/core/build-editor-config.d.ts +15 -6
  441. package/dist/fields/rich-text/core/build-editor-config.js +47 -66
  442. package/dist/fields/rich-text/core/extensions/current-node/current-node.css +1 -0
  443. package/dist/fields/rich-text/core/extensions/current-node/current-node.d.ts +2 -2
  444. package/dist/fields/rich-text/core/extensions/current-node/current-node.js +3 -4
  445. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle-plugin.d.ts +5 -0
  446. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle-plugin.js +40 -77
  447. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.d.ts +1 -1
  448. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.js +1 -1
  449. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/cloneElement.d.ts +4 -0
  450. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/cloneElement.js +5 -0
  451. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/dragHandler.d.ts +5 -0
  452. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/dragHandler.js +11 -13
  453. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/findNextElementFromCursor.d.ts +6 -8
  454. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/findNextElementFromCursor.js +9 -14
  455. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getInnerCoords.d.ts +1 -0
  456. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getInnerCoords.js +6 -5
  457. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getOuterNode.d.ts +3 -1
  458. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getOuterNode.js +8 -21
  459. package/dist/fields/rich-text/core/features/blockquote.js +5 -1
  460. package/dist/fields/rich-text/core/features/bold.js +0 -3
  461. package/dist/fields/rich-text/core/features/bullet-list.js +5 -1
  462. package/dist/fields/rich-text/core/features/fields/extension.d.ts +1 -0
  463. package/dist/fields/rich-text/core/features/fields/extension.js +1 -0
  464. package/dist/fields/rich-text/core/features/fields/fields-form.svelte +54 -0
  465. package/dist/fields/rich-text/core/features/fields/fields-form.svelte.d.ts +14 -0
  466. package/dist/fields/rich-text/core/features/fields/fields.svelte +30 -35
  467. package/dist/fields/rich-text/core/features/fields/index.d.ts +2 -0
  468. package/dist/fields/rich-text/core/features/fields/index.js +1 -0
  469. package/dist/fields/rich-text/core/features/heading.js +19 -68
  470. package/dist/fields/rich-text/core/features/hr/hr.css +1 -2
  471. package/dist/fields/rich-text/core/features/hr/hr.js +5 -1
  472. package/dist/fields/rich-text/core/features/index.d.ts +1 -0
  473. package/dist/fields/rich-text/core/features/index.js +1 -0
  474. package/dist/fields/rich-text/core/features/json-attribute.d.ts +1 -1
  475. package/dist/fields/rich-text/core/features/json-attribute.js +1 -1
  476. package/dist/fields/rich-text/core/features/link/component/link-selector.svelte +61 -58
  477. package/dist/fields/rich-text/core/features/link/component/link-selector.svelte.d.ts +3 -1
  478. package/dist/fields/rich-text/core/features/link/index.d.ts +5 -0
  479. package/dist/fields/rich-text/core/features/link/index.js +2 -14
  480. package/dist/fields/rich-text/core/features/ordered-list.js +5 -1
  481. package/dist/fields/rich-text/core/features/paragraph.js +5 -1
  482. package/dist/fields/rich-text/core/features/pick-dialog.svelte +16 -4
  483. package/dist/fields/rich-text/core/features/pick-dialog.svelte.d.ts +7 -3
  484. package/dist/fields/rich-text/core/features/resource/index.d.ts +1 -0
  485. package/dist/fields/rich-text/core/features/resource/index.js +1 -0
  486. package/dist/fields/rich-text/core/features/resource/resource-extension.d.ts +1 -0
  487. package/dist/fields/rich-text/core/features/resource/resource-extension.js +8 -6
  488. package/dist/fields/rich-text/core/features/resource/resource.svelte +38 -49
  489. package/dist/fields/rich-text/core/features/resource/types.d.ts +1 -0
  490. package/dist/fields/rich-text/core/features/upload/index.d.ts +1 -0
  491. package/dist/fields/rich-text/core/features/upload/index.js +2 -1
  492. package/dist/fields/rich-text/core/features/upload/upload-extension.d.ts +6 -0
  493. package/dist/fields/rich-text/core/features/upload/upload-extension.js +2 -2
  494. package/dist/fields/{relation/component → rich-text/core/features}/upload/upload.css +1 -2
  495. package/dist/fields/rich-text/core/features/upload/upload.svelte +47 -73
  496. package/dist/fields/rich-text/core/features/upload/upload.svelte.d.ts +1 -0
  497. package/dist/fields/rich-text/core/render-rich-text.svelte +30 -16
  498. package/dist/fields/rich-text/core/rich-text-editor-core.svelte +8 -3
  499. package/dist/fields/rich-text/core/rich-text-editor-core.svelte.d.ts +1 -0
  500. package/dist/fields/rich-text/core/svelte/constant.d.ts +1 -0
  501. package/dist/fields/rich-text/core/svelte/constant.js +1 -0
  502. package/dist/fields/rich-text/core/svelte/node-view-renderer.svelte.d.ts +10 -0
  503. package/dist/fields/rich-text/core/svelte/node-view-renderer.svelte.js +23 -6
  504. package/dist/fields/rich-text/core/svelte/node-view-wrapper.svelte +6 -2
  505. package/dist/fields/rich-text/core/svelte/node-view-wrapper.svelte.d.ts +1 -0
  506. package/dist/fields/rich-text/core/svelte/renderer.d.ts +1 -0
  507. package/dist/fields/rich-text/core/svelte/renderer.js +1 -0
  508. package/dist/fields/rich-text/core/types.d.ts +11 -0
  509. package/dist/fields/rich-text/index.d.ts +2 -0
  510. package/dist/fields/rich-text/index.js +12 -7
  511. package/dist/fields/rich-text/json.d.ts +6 -4
  512. package/dist/fields/rich-text/json.js +6 -4
  513. package/dist/fields/select/component/Select.svelte +37 -12
  514. package/dist/fields/select/index.d.ts +2 -1
  515. package/dist/fields/select/index.js +1 -0
  516. package/dist/fields/separator/index.d.ts +1 -0
  517. package/dist/fields/separator/index.js +1 -0
  518. package/dist/fields/slug/component/Slug.svelte +14 -13
  519. package/dist/fields/slug/index.d.ts +11 -0
  520. package/dist/fields/slug/index.js +11 -0
  521. package/dist/fields/tabs/component/Tabs.svelte +4 -7
  522. package/dist/fields/tabs/index.d.ts +10 -0
  523. package/dist/fields/tabs/index.js +10 -0
  524. package/dist/fields/text/component/TextInline.svelte +12 -10
  525. package/dist/fields/text/index.d.ts +7 -0
  526. package/dist/fields/text/index.js +9 -2
  527. package/dist/fields/textarea/index.d.ts +3 -0
  528. package/dist/fields/textarea/index.js +5 -2
  529. package/dist/fields/time/index.d.ts +1 -0
  530. package/dist/fields/time/index.js +4 -6
  531. package/dist/fields/toggle/component/Toggle.svelte +1 -0
  532. package/dist/fields/toggle/index.d.ts +1 -0
  533. package/dist/fields/toggle/index.js +1 -0
  534. package/dist/fields/tree/component/AddItemButton.svelte +3 -2
  535. package/dist/fields/tree/component/AddItemButton.svelte.d.ts +1 -1
  536. package/dist/fields/tree/component/Tree.svelte +16 -57
  537. package/dist/fields/tree/component/TreeBlock.svelte +26 -40
  538. package/dist/fields/tree/component/props.d.ts +3 -2
  539. package/dist/fields/tree/index.js +14 -2
  540. package/dist/fields/tree/util.js +0 -3
  541. package/dist/fields/types.d.ts +23 -1
  542. package/dist/index.d.ts +1 -0
  543. package/dist/index.js +1 -0
  544. package/dist/live/Consumer.svelte +6 -0
  545. package/dist/live/LiveEdit.svelte +23 -5
  546. package/dist/live/LiveEdit.svelte.d.ts +2 -1
  547. package/dist/live/Provider.svelte +5 -1
  548. package/dist/live/context.svelte.d.ts +3 -4
  549. package/dist/live/context.svelte.js +9 -6
  550. package/dist/panel/components/Root.svelte +7 -1
  551. package/dist/panel/components/fields/FieldsPreview.svelte +15 -1
  552. package/dist/panel/components/fields/Label.svelte +2 -0
  553. package/dist/panel/components/fields/RenderFields.svelte +12 -1
  554. package/dist/panel/components/fields/fieldset.svelte.d.ts +7 -1
  555. package/dist/panel/components/fields/fieldset.svelte.js +7 -1
  556. package/dist/panel/components/fields/setting.css +7 -0
  557. package/dist/panel/components/sections/auth/AuthForm.svelte +4 -1
  558. package/dist/panel/components/sections/collection/Avatar.svelte +1 -1
  559. package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte +3 -0
  560. package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte +11 -1
  561. package/dist/panel/components/sections/collection/folder/FolderEdit.svelte +10 -1
  562. package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte +45 -34
  563. package/dist/panel/components/sections/collection/folder/Folders.svelte +1 -0
  564. package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte +8 -3
  565. package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte.d.ts +2 -1
  566. package/dist/panel/components/sections/collection/grid/create-directory-dialog/CreateDirectoryDialog.svelte +3 -1
  567. package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte +4 -0
  568. package/dist/panel/components/sections/collection/header/ButtonCreate.svelte +1 -5
  569. package/dist/panel/components/sections/collection/header/SearchInput.svelte +2 -0
  570. package/dist/panel/components/sections/collection/header/SelectUI.svelte +25 -5
  571. package/dist/panel/components/sections/collection/list/CollectionList.svelte +4 -1
  572. package/dist/panel/components/sections/collection/list/row/Row.svelte +16 -16
  573. package/dist/panel/components/sections/collection/list/row/Row.svelte.d.ts +4 -4
  574. package/dist/panel/components/sections/collection/tree/CollectionTree.svelte +4 -80
  575. package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte +18 -8
  576. package/dist/panel/components/sections/collection/tree/sortable.d.ts +11 -0
  577. package/dist/panel/components/sections/collection/tree/sortable.js +45 -0
  578. package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte +5 -3
  579. package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte.d.ts +0 -1
  580. package/dist/panel/components/sections/commands/CommandPalette.svelte +5 -0
  581. package/dist/panel/components/sections/document/AuthAPIKeyDialog.svelte +14 -4
  582. package/dist/panel/components/sections/document/AuthAPIKeyDialog.svelte.d.ts +2 -0
  583. package/dist/panel/components/sections/document/AuthFooter.svelte +37 -31
  584. package/dist/panel/components/sections/document/AuthFooter.svelte.d.ts +0 -2
  585. package/dist/panel/components/sections/document/ButtonSave.svelte +2 -6
  586. package/dist/panel/components/sections/document/ButtonSave.svelte.d.ts +1 -3
  587. package/dist/panel/components/sections/document/ButtonStatus.svelte +24 -11
  588. package/dist/panel/components/sections/document/ChangeSlugDialog.svelte +16 -0
  589. package/dist/panel/components/sections/document/CurrentlyEdited.svelte +5 -3
  590. package/dist/panel/components/sections/document/CurrentlyEdited.svelte.d.ts +1 -0
  591. package/dist/panel/components/sections/document/Document.svelte +29 -18
  592. package/dist/panel/components/sections/document/DocumentChildren.svelte +48 -41
  593. package/dist/panel/components/sections/document/Header.svelte +13 -11
  594. package/dist/panel/components/sections/document/Settings.svelte +127 -157
  595. package/dist/panel/components/sections/document/Versions.svelte +11 -2
  596. package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte +32 -13
  597. package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte.d.ts +2 -0
  598. package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte +24 -10
  599. package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte.d.ts +3 -0
  600. package/dist/panel/components/sections/live/LiveEditPanel.svelte +11 -5
  601. package/dist/panel/components/sections/live/LiveEditPanel.svelte.d.ts +10 -3
  602. package/dist/panel/components/sections/live/LiveFloatingUI.svelte +18 -2
  603. package/dist/panel/components/sections/live/LiveFloatingUI.svelte.d.ts +3 -0
  604. package/dist/panel/components/ui/button/button.svelte +0 -3
  605. package/dist/panel/components/ui/calendar/calendar.css +0 -1
  606. package/dist/panel/components/ui/calendar/calendar.svelte.d.ts +1 -1
  607. package/dist/panel/components/ui/card-resource/card-resource.svelte +17 -3
  608. package/dist/panel/components/ui/card-resource/card-resource.svelte.d.ts +2 -0
  609. package/dist/panel/components/ui/checkbox/checkbox.svelte.d.ts +1 -1
  610. package/dist/panel/components/ui/command/command-count.css +6 -0
  611. package/dist/panel/components/ui/command/command-count.svelte +15 -0
  612. package/dist/panel/components/ui/command/command-count.svelte.d.ts +9 -0
  613. package/dist/panel/components/ui/command/command-dialog.css +2 -0
  614. package/dist/panel/components/ui/command/command-input-select.svelte +5 -0
  615. package/dist/panel/components/ui/command/filter.d.ts +10 -0
  616. package/dist/panel/components/ui/command/filter.js +11 -0
  617. package/dist/panel/components/ui/command/index.d.ts +2 -1
  618. package/dist/panel/components/ui/command/index.js +2 -1
  619. package/dist/panel/components/ui/context-menu/context-menu.css +2 -2
  620. package/dist/panel/components/ui/dialog/dialog-content.css +4 -1
  621. package/dist/panel/components/ui/dialog/dialog-content.svelte +8 -1
  622. package/dist/panel/components/ui/dialog/dialog-overlay.css +2 -1
  623. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-content.css +2 -2
  624. package/dist/panel/components/ui/input/input.svelte +3 -0
  625. package/dist/panel/components/ui/language-switcher/LanguageSwitcher.svelte +1 -1
  626. package/dist/panel/components/ui/layer/layer.svelte.d.ts +22 -0
  627. package/dist/panel/components/ui/layer/layer.svelte.js +37 -0
  628. package/dist/panel/components/ui/nav/Nav.svelte +4 -9
  629. package/dist/panel/components/ui/nav/NavGroup.svelte +6 -6
  630. package/dist/panel/components/ui/nav/NavItem.svelte +1 -0
  631. package/dist/panel/components/ui/nav/NavItem.svelte.d.ts +1 -0
  632. package/dist/panel/components/ui/nav/UserButton.svelte +4 -4
  633. package/dist/panel/components/ui/page-header/PageHeader.svelte +1 -5
  634. package/dist/panel/components/ui/page-header/PageHeader.svelte.d.ts +1 -0
  635. package/dist/panel/components/ui/popover/popover-content.css +2 -1
  636. package/dist/panel/components/ui/radio-row-group/radio-row-group.css +0 -1
  637. package/dist/panel/components/ui/scroll-area/scroll-area-scrollbar.svelte +3 -4
  638. package/dist/panel/components/ui/scroll-area/scroll-area-scrollbar.svelte.d.ts +1 -1
  639. package/dist/panel/components/ui/scroll-area/scroll-area.css +0 -6
  640. package/dist/panel/components/ui/scroll-area/scroll-area.svelte +4 -1
  641. package/dist/panel/components/ui/sheet/index.d.ts +1 -1
  642. package/dist/panel/components/ui/sheet/sheet-content.svelte +13 -2
  643. package/dist/panel/components/ui/sheet/sheet-content.svelte.d.ts +3 -0
  644. package/dist/panel/components/ui/sheet/sheet.css +11 -43
  645. package/dist/panel/components/ui/sonner/sonner.css +5 -0
  646. package/dist/panel/components/ui/switch/switch.svelte.d.ts +1 -1
  647. package/dist/panel/components/ui/tag/tag.svelte +8 -1
  648. package/dist/panel/components/ui/tooltip/tooltip-content.svelte +1 -1
  649. package/dist/panel/components/ui/tree/tree-rows.css +1 -8
  650. package/dist/panel/context/api-proxy.svelte.d.ts +2 -0
  651. package/dist/panel/context/api-proxy.svelte.js +30 -4
  652. package/dist/panel/context/blocks-ops.d.ts +6 -0
  653. package/dist/panel/context/blocks-ops.js +6 -0
  654. package/dist/panel/context/bulk-delete.d.ts +4 -3
  655. package/dist/panel/context/bulk-delete.js +13 -7
  656. package/dist/panel/context/collection.svelte.d.ts +10 -22
  657. package/dist/panel/context/collection.svelte.js +73 -115
  658. package/dist/panel/context/commands.svelte.js +5 -0
  659. package/dist/panel/context/config.svelte.js +2 -0
  660. package/dist/panel/context/createContext.svelte.d.ts +1 -0
  661. package/dist/panel/context/createContext.svelte.js +1 -0
  662. package/dist/panel/context/documentForm.svelte.d.ts +4 -2
  663. package/dist/panel/context/documentForm.svelte.js +87 -159
  664. package/dist/panel/context/errors.svelte.d.ts +8 -0
  665. package/dist/panel/context/errors.svelte.js +8 -0
  666. package/dist/panel/context/form.svelte.d.ts +8 -1
  667. package/dist/panel/context/form.svelte.js +37 -40
  668. package/dist/panel/context/livePanel.svelte.d.ts +3 -0
  669. package/dist/panel/context/locale.svelte.js +3 -0
  670. package/dist/panel/context/nav.svelte.js +9 -21
  671. package/dist/panel/context/tree-ops.d.ts +14 -0
  672. package/dist/panel/context/tree-ops.js +70 -0
  673. package/dist/panel/context/versions.svelte.d.ts +6 -0
  674. package/dist/panel/context/versions.svelte.js +18 -0
  675. package/dist/panel/index.d.ts +1 -10
  676. package/dist/panel/pages/area/Area.svelte +1 -1
  677. package/dist/panel/pages/area/actions.server.js +1 -0
  678. package/dist/panel/pages/area/load.server.d.ts +1 -0
  679. package/dist/panel/pages/area/load.server.js +1 -1
  680. package/dist/panel/pages/auth/forgot-password/ForgotPassword.svelte +23 -16
  681. package/dist/panel/pages/auth/forgot-password/load.server.d.ts +1 -0
  682. package/dist/panel/pages/auth/forgot-password/load.server.js +3 -5
  683. package/dist/panel/pages/auth/image.server.d.ts +6 -0
  684. package/dist/panel/pages/auth/image.server.js +19 -0
  685. package/dist/panel/pages/auth/reset-password/ResetPassword.svelte +22 -15
  686. package/dist/panel/pages/auth/reset-password/load.server.d.ts +3 -0
  687. package/dist/panel/pages/auth/reset-password/load.server.js +5 -5
  688. package/dist/panel/pages/auth/sign-in/actions.server.js +33 -25
  689. package/dist/panel/pages/auth/sign-in/load.server.d.ts +4 -0
  690. package/dist/panel/pages/auth/sign-in/load.server.js +6 -5
  691. package/dist/panel/pages/collection/Collection.svelte.d.ts +1 -1
  692. package/dist/panel/pages/collection/CollectionPage.svelte +31 -27
  693. package/dist/panel/pages/collection/CollectionPage.svelte.d.ts +1 -1
  694. package/dist/panel/pages/collection/load.server.d.ts +5 -2
  695. package/dist/panel/pages/collection/load.server.js +53 -54
  696. package/dist/panel/pages/collection-document/CollectionDocument.svelte +1 -1
  697. package/dist/panel/pages/collection-document/actions.server.js +3 -11
  698. package/dist/panel/pages/collection-document/load.server.d.ts +5 -0
  699. package/dist/panel/pages/collection-document/load.server.js +10 -3
  700. package/dist/panel/pages/dashboard/DashboardRow.svelte +13 -0
  701. package/dist/panel/pages/dashboard/load.server.d.ts +3 -0
  702. package/dist/panel/pages/dashboard/load.server.js +19 -8
  703. package/dist/panel/pages/live/Live.svelte +45 -45
  704. package/dist/panel/pages/live/load.server.d.ts +5 -0
  705. package/dist/panel/pages/live/load.server.js +5 -0
  706. package/dist/panel/pages/shared/DocumentPage.svelte +9 -5
  707. package/dist/panel/pages/shared/DocumentPage.svelte.d.ts +0 -1
  708. package/dist/panel/style/font.css +3 -3
  709. package/dist/panel/style/index.css +23 -8
  710. package/dist/panel/style/palette.css +1 -1
  711. package/dist/panel/style/size.css +1 -0
  712. package/dist/panel/style/z-index.css +18 -0
  713. package/dist/panel/types.d.ts +0 -1
  714. package/dist/panel/util/Sortable.d.ts +6 -1
  715. package/dist/panel/util/Sortable.js +6 -1
  716. package/dist/panel/util/auth.d.ts +18 -0
  717. package/dist/panel/util/auth.js +25 -0
  718. package/dist/panel/util/candidates.svelte.d.ts +118 -0
  719. package/dist/panel/util/candidates.svelte.js +176 -0
  720. package/dist/panel/util/count.d.ts +19 -0
  721. package/dist/panel/util/count.js +20 -0
  722. package/dist/panel/util/dataError.d.ts +1 -0
  723. package/dist/panel/util/dataError.js +1 -0
  724. package/dist/panel/util/storage.d.ts +13 -0
  725. package/dist/panel/util/storage.js +37 -0
  726. package/dist/panel/util/time.d.ts +7 -1
  727. package/dist/panel/util/time.js +19 -5
  728. package/dist/panel/util/upload-file.d.ts +0 -8
  729. package/dist/panel/util/upload-file.js +6 -12
  730. package/dist/server.js +3 -0
  731. package/dist/util/form-data.d.ts +3 -3
  732. package/dist/util/form-data.js +4 -2
  733. package/dist/util/function.d.ts +7 -6
  734. package/dist/util/function.js +7 -6
  735. package/dist/util/object.d.ts +10 -11
  736. package/dist/util/object.js +21 -55
  737. package/dist/util/random.d.ts +8 -12
  738. package/dist/util/random.js +34 -88
  739. package/dist/util/string.js +76 -114
  740. package/dist/util/types.d.ts +2 -0
  741. package/package.json +17 -15
  742. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getComputedStyle.d.ts +0 -1
  743. package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getComputedStyle.js +0 -4
  744. package/dist/fields/rich-text/core/features/link/component/link-selector.css +0 -0
  745. package/dist/fields/rich-text/core/features/resource/resource.css +0 -0
  746. package/dist/panel/style/util.css +0 -3
  747. package/dist/panel/util/once.svelte.d.ts +0 -3
  748. package/dist/panel/util/once.svelte.js +0 -12
@@ -19,11 +19,6 @@ export type BaseDoc = {
19
19
  _live?: string;
20
20
  };
21
21
  export type GenericDoc = BaseDoc & Dic;
22
- export type GenericNestedDoc = BaseDoc & {
23
- _children: string[];
24
- _parent: string | null;
25
- _position: number;
26
- } & Dic;
27
22
  export type TreeBlock = {
28
23
  id: string;
29
24
  ownerId?: string;
@@ -55,7 +55,8 @@ export type Rime<C extends Config = Config> = {
55
55
  createRimeContext(event: RequestEvent): RimeContext<C>;
56
56
  };
57
57
  /**
58
- * Creates the main Rime object
59
- * that provides access to cms API
58
+ * Boots rime for one config — codegen in dev, the adapter, better-auth, the panel translations —
59
+ * and answers the process-wide object. Its `createRimeContext` builds `event.locals.rime` for each
60
+ * request.
60
61
  */
61
62
  export declare function createRime<const C extends Config>(config: BuildConfig<C>): Promise<Rime<C>>;
@@ -5,8 +5,9 @@ import { areaApi } from './prototype/area/api.server.js';
5
5
  import { collectionApi } from './prototype/collection/api.server.js';
6
6
  import { createRoutesContext } from './routes/context.server.js';
7
7
  /**
8
- * Creates the main Rime object
9
- * that provides access to cms API
8
+ * Boots rime for one config — codegen in dev, the adapter, better-auth, the panel translations —
9
+ * and answers the process-wide object. Its `createRimeContext` builds `event.locals.rime` for each
10
+ * request.
10
11
  */
11
12
  export async function createRime(config) {
12
13
  // Phases 1 and 2 — codegen (dev only) then boot, in that order, written out in
@@ -20,10 +20,21 @@ export declare function slugOf(event: Pick<RequestEvent, 'params' | 'locals'>):
20
20
  export declare function createRoutesContext(event: RequestEvent): {
21
21
  /** The slug of the prototype the URL names. A load reads `slugOf(event)` instead. */
22
22
  readonly slug: undefined;
23
+ /** Whether the request is under `/api`. */
23
24
  readonly isAPI: boolean;
25
+ /** Whether the route is the panel's sign-in, forgot-password or reset-password page. */
24
26
  readonly isPublicAuthRoute: boolean;
27
+ /**
28
+ * Whether the request is a panel page that needs a session: a route with the `[panel]` param,
29
+ * sign-in, forgot-password and reset-password excepted. False on a URL no route matched.
30
+ */
25
31
  readonly isPanel: boolean;
32
+ /** The panel's path segment, `RIME_PANEL_ROUTE`. Private: never send it to the client. */
26
33
  readonly panel: string;
34
+ /**
35
+ * A root-relative panel path, `/panel/pages/12`. Unlike `panelUrl` in `routes/util.ts`, which
36
+ * the browser uses, this is not an absolute URL.
37
+ */
27
38
  panelUrl(...args: string[]): ResolvedPathname;
28
39
  apiUrl: typeof routes.apiUrl;
29
40
  absolute: typeof routes.absolute;
@@ -26,18 +26,29 @@ export function createRoutesContext(event) {
26
26
  get slug() {
27
27
  return slugOf(event);
28
28
  },
29
+ /** Whether the request is under `/api`. */
29
30
  get isAPI() {
30
31
  return routes.isApiPathname(event.url.pathname);
31
32
  },
33
+ /** Whether the route is the panel's sign-in, forgot-password or reset-password page. */
32
34
  get isPublicAuthRoute() {
33
35
  return routes.isPublicPanelAuthRoute(event.route.id);
34
36
  },
37
+ /**
38
+ * Whether the request is a panel page that needs a session: a route with the `[panel]` param,
39
+ * sign-in, forgot-password and reset-password excepted. False on a URL no route matched.
40
+ */
35
41
  get isPanel() {
36
42
  return event.params.panel !== undefined && !routes.isPublicPanelAuthRoute(event.route.id);
37
43
  },
44
+ /** The panel's path segment, `RIME_PANEL_ROUTE`. Private: never send it to the client. */
38
45
  get panel() {
39
46
  return RIME_PANEL_ROUTE;
40
47
  },
48
+ /**
49
+ * A root-relative panel path, `/panel/pages/12`. Unlike `panelUrl` in `routes/util.ts`, which
50
+ * the browser uses, this is not an absolute URL.
51
+ */
41
52
  panelUrl(...args) {
42
53
  return routes.joinPath(RIME_PANEL_ROUTE, ...args);
43
54
  },
@@ -11,9 +11,6 @@ import type { Handle } from '@sveltejs/kit/hooks';
11
11
  * Each generated file passes `event` straight through and imports nothing — slug and id are real
12
12
  * route params, and the matchers rime generates into `+rime.generated/params.ts`, which the app's
13
13
  * `src/params.ts` spreads, have already sorted out which prototype the URL names.
14
- *
15
- * Lives here rather than on `rime.server.ts`, because these handlers read `event.locals.rime`.
16
- * Naming them there would make `RimeContext` depend on its own type.
17
14
  */
18
15
  export declare const routeHandlers: {
19
16
  checkLiveRedirect: typeof checkLiveRedirect;
@@ -53,5 +50,9 @@ export declare const routeHandlers: {
53
50
  */
54
51
  rest: (name: string, path: string, event: RequestEvent) => Response | Promise<Response>;
55
52
  };
53
+ /**
54
+ * The last handle: builds the panel sidebar for a panel GET, puts `routeHandlers` on
55
+ * `event.locals.routes`, and answers a `$routes` pathname before SvelteKit's own routing.
56
+ */
56
57
  export declare const handleRoutes: Handle;
57
58
  export type RouteHandlers = typeof routeHandlers;
@@ -27,9 +27,6 @@ const restRoutes = {
27
27
  * Each generated file passes `event` straight through and imports nothing — slug and id are real
28
28
  * route params, and the matchers rime generates into `+rime.generated/params.ts`, which the app's
29
29
  * `src/params.ts` spreads, have already sorted out which prototype the URL names.
30
- *
31
- * Lives here rather than on `rime.server.ts`, because these handlers read `event.locals.rime`.
32
- * Naming them there would make `RimeContext` depend on its own type.
33
30
  */
34
31
  export const routeHandlers = {
35
32
  checkLiveRedirect,
@@ -66,6 +63,10 @@ export const routeHandlers = {
66
63
  return handler(event);
67
64
  }
68
65
  };
66
+ /**
67
+ * The last handle: builds the panel sidebar for a panel GET, puts `routeHandlers` on
68
+ * `event.locals.routes`, and answers a `$routes` pathname before SvelteKit's own routing.
69
+ */
69
70
  export const handleRoutes = async ({ event, resolve }) => {
70
71
  const { rime } = event.locals;
71
72
  const { isPanel } = rime.routes;
@@ -3,11 +3,10 @@ import type { Config } from '../../types.js';
3
3
  import type { Dic } from '../../util/types.js';
4
4
  import type { RequestEvent } from '@sveltejs/kit';
5
5
  /**
6
- * Builds the panel navigation groups: the collections and areas the request's user may read, then
7
- * the custom panel routes.
8
- * @param config - the built config.
9
- * @param event - the request; gives the user and `rime.routes.panelUrl`.
10
- * @returns the routes, by group.
6
+ * The panel sidebar, by group: the collections and areas the request's user may read, then the
7
+ * custom panel routes. A collection goes to its `panel.group`, else `collections`; an area to its
8
+ * `panel.group`, else `areas`; a custom route without a group to `none`. A config with
9
+ * `panel: false` is left out.
11
10
  */
12
11
  declare const buildNavigation: <C extends Config>(config: BuildConfig<C>, event: RequestEvent) => Dic;
13
12
  export default buildNavigation;
@@ -1,9 +1,8 @@
1
1
  /**
2
- * Builds the panel navigation groups: the collections and areas the request's user may read, then
3
- * the custom panel routes.
4
- * @param config - the built config.
5
- * @param event - the request; gives the user and `rime.routes.panelUrl`.
6
- * @returns the routes, by group.
2
+ * The panel sidebar, by group: the collections and areas the request's user may read, then the
3
+ * custom panel routes. A collection goes to its `panel.group`, else `collections`; an area to its
4
+ * `panel.group`, else `areas`; a custom route without a group to `none`. A config with
5
+ * `panel: false` is left out.
7
6
  */
8
7
  const buildNavigation = (config, event) => {
9
8
  const groups = {};
@@ -16,7 +15,6 @@ const buildNavigation = (config, event) => {
16
15
  groups[group] ??= [];
17
16
  groups[group].push(route);
18
17
  };
19
- // Process collections
20
18
  config.collections
21
19
  .filter((collection) => collection.panel !== false)
22
20
  .forEach((collection) => {
@@ -29,7 +27,6 @@ const buildNavigation = (config, event) => {
29
27
  addRouteToGroup(route, (collection.panel && collection.panel?.group) || 'collections');
30
28
  }
31
29
  });
32
- // Process areas
33
30
  config.areas
34
31
  .filter((area) => area.panel !== false)
35
32
  .forEach((area) => {
@@ -42,7 +39,6 @@ const buildNavigation = (config, event) => {
42
39
  addRouteToGroup(route, (area.panel && area.panel?.group) || 'areas');
43
40
  }
44
41
  });
45
- // Process custom panel routes
46
42
  Object.entries(config.panel.routes).forEach(([routePath, routeConfig]) => {
47
43
  const route = {
48
44
  title: routeConfig.label,
@@ -10,13 +10,19 @@ export declare function joinPath(...args: string[]): string;
10
10
  * apiUrl('pages', '123') // -> /api/pages/123
11
11
  */
12
12
  export declare function apiUrl(...args: string[]): string;
13
- /** Prefixes `SITE_URL` to a root-relative path. */
13
+ /**
14
+ * Prefixes `SITE_URL` to a root-relative path, with or without its trailing slash.
15
+ * @example
16
+ * absolute('/panel') // SITE_URL https://site.com/ -> https://site.com/panel
17
+ */
14
18
  export declare function absolute(path: string): string;
15
19
  /** `/api` and the paths under it: `/api/pages` is one, `/apiary` is not. */
16
20
  export declare function isApiPathname(pathname: string): boolean;
21
+ /** Whether a route id is the panel's sign-in, forgot-password or reset-password page. */
17
22
  export declare function isPublicPanelAuthRoute(routeId: string | null): boolean;
18
23
  /**
19
- * Panel-only. Reads `page.params.panel`, which is undefined server-side
24
+ * Panel-only, inside a component: the panel path from `page.params.panel`. Throws on a route with
25
+ * no `[panel]` param.
20
26
  */
21
27
  export declare function panelPath(...args: string[]): ResolvedPathname;
22
28
  /**
@@ -16,23 +16,29 @@ export function joinPath(...args) {
16
16
  export function apiUrl(...args) {
17
17
  return `${API_PREFIX}/${args.join('/')}`;
18
18
  }
19
- /** Prefixes `SITE_URL` to a root-relative path. */
19
+ /**
20
+ * Prefixes `SITE_URL` to a root-relative path, with or without its trailing slash.
21
+ * @example
22
+ * absolute('/panel') // SITE_URL https://site.com/ -> https://site.com/panel
23
+ */
20
24
  export function absolute(path) {
21
- return `${SITE_URL}${path}`;
25
+ return `${SITE_URL.replace(/\/+$/, '')}${path}`;
22
26
  }
23
27
  /** `/api` and the paths under it: `/api/pages` is one, `/apiary` is not. */
24
28
  export function isApiPathname(pathname) {
25
29
  return pathname === API_PREFIX || pathname.startsWith(`${API_PREFIX}/`);
26
30
  }
31
+ /** Whether a route id is the panel's sign-in, forgot-password or reset-password page. */
27
32
  export function isPublicPanelAuthRoute(routeId) {
28
33
  return !!routeId && PANEL_PUBLIC_AUTH_ROUTE_IDS.has(routeId);
29
34
  }
30
35
  /**
31
- * Panel-only. Reads `page.params.panel`, which is undefined server-side
36
+ * Panel-only, inside a component: the panel path from `page.params.panel`. Throws on a route with
37
+ * no `[panel]` param.
32
38
  */
33
39
  export function panelPath(...args) {
34
40
  if (!page.params.panel)
35
- throw new Error('panelPath called outside of component environment, page.params.panel is not defined');
41
+ throw new Error('panelPath called on a route without a [panel] param');
36
42
  return joinPath(page.params.panel, ...args);
37
43
  }
38
44
  /**
@@ -19,6 +19,7 @@
19
19
  /** The one type of a list that has one: the button adds it without a menu. */
20
20
  const single = $derived(config.get.blocks.length === 1 ? config.get.blocks[0].block : null);
21
21
 
22
+ /** Closes the picker and adds a block of this type, its fields at their initial values. */
22
23
  const add = (block: BlocksFieldBlock) => {
23
24
  open = false;
24
25
  const empty = {
@@ -8,7 +8,6 @@
8
8
  import { useSortable } from '../../../panel/util/Sortable.js';
9
9
  import { normalizeFieldPath } from '../../../util/string.js';
10
10
  import Maximize2 from '@lucide/svelte/icons/maximize-2';
11
- import { onMount } from 'svelte';
12
11
  import { SvelteSet } from 'svelte/reactivity';
13
12
  import DefaultLocaleButton from '../../repeatable/DefaultLocaleButton.svelte';
14
13
  import AddBlockButton from './AddBlockButton.svelte';
@@ -32,6 +31,7 @@
32
31
  if (last === -1 || !form.blocks.builder(parts.slice(0, last).join('.'))) return list;
33
32
  return parts.slice(0, last + 1).join('.');
34
33
  });
34
+ /** The summary layout asks for focus mode: a nested form, which has none, keeps the list. */
35
35
  const summary = $derived(config.get.layout === 'summary' && !!focus);
36
36
 
37
37
  const field = $derived(form.useField(path, config));
@@ -39,16 +39,16 @@
39
39
  const count = $derived(blockState.blocks.length);
40
40
  let sorting = $state(false);
41
41
 
42
- /** The blocks shown open, by id; the others are rows. The browser remembers the open ones. */
43
- const opened = new SvelteSet<string>();
42
+ /**
43
+ * The blocks shown open, by id; the others are rows. The browser remembers a saved block open,
44
+ * by its id.
45
+ */
46
+ // svelte-ignore state_referenced_locally
47
+ const opened = new SvelteSet<string>(
48
+ blockState.blocks.map((block) => block.id).filter(isRememberedOpen)
49
+ );
44
50
  const anyOpen = $derived(blockState.blocks.some((block) => opened.has(block.id)));
45
51
 
46
- onMount(() => {
47
- for (const block of blockState.blocks) {
48
- if (isRememberedOpen(block.id)) opened.add(block.id);
49
- }
50
- });
51
-
52
52
  function setOpen(id: string, open: boolean) {
53
53
  if (open) {
54
54
  opened.add(id);
@@ -58,6 +58,7 @@
58
58
  rememberOpen(id, open);
59
59
  }
60
60
 
61
+ /** Opens every block when none is open, else closes them all. */
61
62
  function toggleAll() {
62
63
  const open = !anyOpen;
63
64
  for (const block of blockState.blocks) setOpen(block.id, open);
@@ -78,10 +79,11 @@
78
79
  if (source && copy && opened.has(source.id)) setOpen(copy.id, true);
79
80
  };
80
81
 
81
- // svelte-ignore state_referenced_locally
82
+ // Unique per list: a row drags within its own list only
83
+ const key = $props.id();
82
84
  const { sortable } = useSortable({
83
85
  handle: '.rz-block__grip',
84
- group: path,
86
+ group: `rz-blocks-${key}`,
85
87
  animation: 150,
86
88
  onStart: () => (sorting = true),
87
89
  onUnchoose: () => (sorting = false),
@@ -94,11 +96,13 @@
94
96
  }
95
97
  });
96
98
 
99
+ /** Makes the list's rows draggable by their grip, for as long as the list is on the page. */
97
100
  function sortableList(node: HTMLElement) {
98
101
  const instance = sortable(node);
99
102
  return { destroy: () => instance.destroy() };
100
103
  }
101
104
 
105
+ /** The block type a row's `type` names; a type the config lacks throws. */
102
106
  function getConfigByBlockType(type: string): BlocksFieldBlock {
103
107
  const blockConfig = config.get.blocks.find((b) => type === b.name);
104
108
  if (!blockConfig) {
@@ -6,6 +6,7 @@
6
6
  import * as Dialog from '../../../../panel/components/ui/dialog/index.js';
7
7
  import * as Sheet from '../../../../panel/components/ui/sheet/index.js';
8
8
  import * as Tabs from '../../../../panel/components/ui/tabs/index.js';
9
+ import { parseBlockPath } from '../../../../panel/context/blocks-ops.js';
9
10
  import { useCommands } from '../../../../panel/context/commands.svelte.js';
10
11
  import type { DocumentFormContext } from '../../../../panel/context/documentForm.svelte.js';
11
12
  import { getLocaleContext } from '../../../../panel/context/locale.svelte.js';
@@ -76,16 +77,17 @@
76
77
  const narrow = $derived(width > 0 && width < 52 * remPx());
77
78
  let panelOpen = $state(false);
78
79
 
80
+ /** The root font size in pixels: the breakpoint is in rem. */
79
81
  function remPx() {
80
82
  return parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
81
83
  }
82
84
 
83
- // The selection moved. Nothing left to inspect: the types to add. Picked from the layers in the
84
- // sheet: put it away, to see the block.
85
+ // The selection changed. With nothing selected, an Inspector tab turns to Add, or to Layers in a
86
+ // locked form; a pick from the Layers tab closes the sheet, so the block shows.
85
87
  $effect(() => {
86
88
  const picked = !!focus.current;
87
89
  untrack(() => {
88
- if (focus.tab === 'inspector' && !picked) focus.tab = 'add';
90
+ if (focus.tab === 'inspector' && !picked) focus.tab = focus.locked ? 'layers' : 'add';
89
91
  if (focus.tab === 'layers') panelOpen = false;
90
92
  });
91
93
  });
@@ -106,7 +108,8 @@
106
108
  });
107
109
  });
108
110
 
109
- // A focus session starts with fresh relations in the renders.
111
+ // A focus session starts with fresh relations in the renders. It runs on the server too,
112
+ // where the cache is empty.
110
113
  populate.clear();
111
114
 
112
115
  // The overlay owns the viewport while it is up; the document under it stays where it was.
@@ -118,15 +121,22 @@
118
121
  };
119
122
  });
120
123
 
124
+ /** A dialog is open: the arrow, copy and delete keys are its own then. */
121
125
  const dialogOpen = () => !!document.querySelector('[role="dialog"][data-state="open"]');
122
126
 
123
- /** Removes the selection, after asking when the block holds blocks of its own. */
127
+ /** Removes the selection, after asking when one of the selected blocks holds blocks. */
124
128
  function requestRemove() {
125
- const row = focus.currentRow;
126
- if (!row || focus.locked) return;
127
- const holdsBlocks = row.children.some((child) => form.blocks.list(child.list).length > 0);
128
- if (holdsBlocks) confirmRemove = true;
129
- else focus.removeSelection();
129
+ if (!focus.selection.length || focus.locked) return;
130
+ const holdsBlocks = focus.selection.some((rowPath) => {
131
+ const at = parseBlockPath(rowPath);
132
+ const row = focus.rowsOf(at.list).find((candidate) => candidate.index === at.index);
133
+ return !!row?.children.some((child) => form.blocks.list(child.list).length > 0);
134
+ });
135
+ if (holdsBlocks) {
136
+ confirmRemove = true;
137
+ } else {
138
+ focus.removeSelection();
139
+ }
130
140
  }
131
141
 
132
142
  /** Escape goes back one step: the selection, then one level up. The sheet closes itself. */
@@ -135,6 +145,7 @@
135
145
  else focus.up();
136
146
  }
137
147
 
148
+ /** Pastes after the selection, and warns when nothing was copied or the list refuses its type. */
138
149
  async function paste() {
139
150
  const id = await focus.pasteAfterSelection();
140
151
  if (!id) toast.warning(t__('fields.paste_refused'));
@@ -153,6 +164,7 @@
153
164
  const types = addable;
154
165
  const row = focus.currentRow;
155
166
  const editing = !focus.locked;
167
+ /** No dialog open: the keys below act. */
156
168
  const free = () => !dialogOpen();
157
169
  return [
158
170
  ...(editing
@@ -19,6 +19,10 @@
19
19
  const focus = getBlocksFocusContext()!;
20
20
  const rows = $derived(focus.rowsOf(list, depth));
21
21
 
22
+ /**
23
+ * The row, or a field inside it, has an error: error keys are normalized paths,
24
+ * `sections.0.title`.
25
+ */
22
26
  const hasError = (rowPath: string) =>
23
27
  Object.keys(form.errors.value).some((key) => key === rowPath || key.startsWith(`${rowPath}.`));
24
28
 
@@ -58,6 +62,7 @@
58
62
  }
59
63
  });
60
64
 
65
+ /** Makes this list of layers sortable, for as long as it is on the page. */
61
66
  function sortableList(node: HTMLElement) {
62
67
  const instance = sortable(node);
63
68
  return { destroy: () => instance.destroy() };
@@ -40,7 +40,6 @@
40
40
  group: { name: 'rz-blocks-layers', pull: 'clone', put: false },
41
41
  sort: false,
42
42
  animation: 150,
43
- disabled: focus.locked,
44
43
  onEnd: (event) => event.clone?.remove()
45
44
  });
46
45
 
@@ -19,7 +19,8 @@
19
19
  /**
20
20
  * `only` narrows the list to the block at that index, focus on one block: it does not move
21
21
  * then, its own lists do. `onRemove` asks first when the block holds blocks of its own.
22
- * `holder` is the block a nested list belongs to, and `class` what its render names it.
22
+ * `holder` is the block a nested list belongs to; `class` is the class the parent's render gives
23
+ * this list through `children(name, { class })`.
23
24
  */
24
25
  type Props = {
25
26
  form: DocumentFormContext;
@@ -159,7 +160,7 @@
159
160
  tabindex="0"
160
161
  onclick={(event) => select(event, row.path)}
161
162
  onkeydown={(event) => {
162
- if (event.key === 'Enter' && event.target === event.currentTarget) {
163
+ if ((event.key === 'Enter' || event.key === ' ') && event.target === event.currentTarget) {
163
164
  event.preventDefault();
164
165
  focus.select(row.path);
165
166
  }
@@ -275,8 +276,8 @@
275
276
  min-height: var(--rz-size-8);
276
277
  }
277
278
 
278
- /* An empty nested list: somewhere to drop a type, its `+` inside. */
279
- .rz-renders[data-empty]:not([data-list='']) {
279
+ /* An empty list: somewhere to drop a type. A nested one has its `+` inside. */
280
+ .rz-renders[data-empty] {
280
281
  padding: var(--rz-size-2);
281
282
  border: 1px dashed var(--rz-border-strong);
282
283
  border-radius: var(--rz-radius-md);
@@ -3,7 +3,8 @@ import Renders from './Renders.svelte';
3
3
  /**
4
4
  * `only` narrows the list to the block at that index, focus on one block: it does not move
5
5
  * then, its own lists do. `onRemove` asks first when the block holds blocks of its own.
6
- * `holder` is the block a nested list belongs to, and `class` what its render names it.
6
+ * `holder` is the block a nested list belongs to; `class` is the class the parent's render gives
7
+ * this list through `children(name, { class })`.
7
8
  */
8
9
  type Props = {
9
10
  form: DocumentFormContext;
@@ -30,7 +30,12 @@ const endsOnBlock = (target) => /\.\d+$/.test(target);
30
30
  export function setBlocksFocusContext(form) {
31
31
  const initial = page.url.searchParams.get(FOCUS_PARAM);
32
32
  let fromUrl = $state(initial);
33
- const path = $derived((page.state.blocksFocus ?? fromUrl) || null);
33
+ /** A blocks list, or one block of a list: anything else in the address opens nothing. */
34
+ const isTarget = (target) => !!form.blocks.builder(endsOnBlock(target) ? parseBlockPath(target).list : target);
35
+ const path = $derived.by(() => {
36
+ const target = page.state.blocksFocus ?? fromUrl;
37
+ return target && isTarget(target) ? target : null;
38
+ });
34
39
  /** Narrowed by the address, the block is selected and its fields show. */
35
40
  const narrowedFromUrl = !!initial && endsOnBlock(initial);
36
41
  let selection = $state(narrowedFromUrl ? [initial] : []);
@@ -58,6 +63,7 @@ export function setBlocksFocusContext(form) {
58
63
  const locked = $derived(form.isDisabled || form.readOnly);
59
64
  /** The block the path ends on, the one the stage is narrowed to. */
60
65
  const narrowed = $derived(path && endsOnBlock(path) ? parseBlockPath(path) : null);
66
+ /** The address on screen, with `?focus=` set to `list`, or without it for `null`. */
61
67
  const urlWith = (list) => {
62
68
  // eslint-disable-next-line svelte/prefer-svelte-reactivity -- a copy handed to pushState, not state
63
69
  const url = new URL(page.url.href);
@@ -108,7 +114,9 @@ export function setBlocksFocusContext(form) {
108
114
  /* ---------------------------------------------------------------- rows */
109
115
  const builderOf = (list) => form.blocks.builder(list);
110
116
  const configOf = (list, block) => builderOf(list)?.get.blocks.find((candidate) => candidate.name === block.type)?.get;
117
+ /** A row's title: `renderTitle`, else the block's label, else its type capitalized. */
111
118
  const titleOf = (config, block, index) => repeatableTitle(config?.renderTitle, { values: block, position: index }, config?.label || capitalize(block.type));
119
+ /** One list's rows, each with the `blocks` lists its block holds. `depth` is the layers' indent. */
112
120
  function rowsOf(list, depth = 0) {
113
121
  return form.blocks.list(list).map((block, index) => {
114
122
  const config = configOf(list, block);
@@ -118,7 +126,7 @@ export function setBlocksFocusContext(form) {
118
126
  .map((field) => ({
119
127
  list: `${rowPath}.${field.name}`,
120
128
  builder: field,
121
- label: field.get.label || capitalize(field.name)
129
+ label: field.get.label
122
130
  }));
123
131
  return {
124
132
  path: rowPath,
@@ -173,7 +181,7 @@ export function setBlocksFocusContext(form) {
173
181
  if (narrowed)
174
182
  return rootRows()[0]?.title ?? '';
175
183
  const builder = builderOf(path);
176
- const fieldLabel = builder?.get.label || capitalize(builder?.name || '');
184
+ const fieldLabel = builder?.get.label ?? '';
177
185
  const crumbs = breadcrumb();
178
186
  const parent = crumbs.length > 1 ? crumbs[crumbs.length - 2] : undefined;
179
187
  if (!parent?.block)
@@ -197,19 +205,20 @@ export function setBlocksFocusContext(form) {
197
205
  if (/^\d+$/.test(part)) {
198
206
  const index = parseInt(part);
199
207
  const block = form.blocks.list(list)[index];
200
- if (!block)
201
- continue;
202
- crumbs.push({
203
- label: titleOf(configOf(list, block), block, index),
204
- list,
205
- block: `${list}.${index}`
206
- });
208
+ if (block) {
209
+ crumbs.push({
210
+ label: titleOf(configOf(list, block), block, index),
211
+ list,
212
+ block: `${list}.${index}`
213
+ });
214
+ }
215
+ list = `${list}.${part}`;
207
216
  continue;
208
217
  }
209
218
  list = list ? `${list}.${part}` : part;
210
219
  const builder = builderOf(list);
211
220
  if (builder)
212
- crumbs.push({ label: builder.get.label || capitalize(part), list });
221
+ crumbs.push({ label: builder.get.label, list });
213
222
  }
214
223
  return crumbs;
215
224
  }
@@ -227,7 +236,7 @@ export function setBlocksFocusContext(form) {
227
236
  if (!narrowed && form.blocks.accepts(path, type) && current.list !== path) {
228
237
  targets.push({
229
238
  list: path,
230
- label: rootBuilder?.get.label || capitalize(rootBuilder?.name || '')
239
+ label: rootBuilder?.get.label ?? ''
231
240
  });
232
241
  }
233
242
  for (const row of allRows()) {
@@ -244,7 +253,11 @@ export function setBlocksFocusContext(form) {
244
253
  return targets;
245
254
  }
246
255
  /* ----------------------------------------------------------- selection */
256
+ /** The first selected block, `{ list, index }`, or none. */
247
257
  const currentAt = () => (selection[0] ? parseBlockPath(selection[0]) : null);
258
+ /**
259
+ * Selects a row. With `extend`, the row joins the selection first, or leaves it when it was in.
260
+ */
248
261
  function select(rowPath, options = {}) {
249
262
  if (options.extend && selection.length) {
250
263
  selection = selection.includes(rowPath)
@@ -255,7 +268,10 @@ export function setBlocksFocusContext(form) {
255
268
  selection = [rowPath];
256
269
  }
257
270
  }
258
- /** Up from the first row lands on the root node; down from the root on the first row. */
271
+ /**
272
+ * Up from the first row lands on the root node, down from the root on the first row; down from
273
+ * the last stays. `extend` adds or drops the row as `select` does.
274
+ */
259
275
  function selectRelative(delta, extend = false) {
260
276
  const rows = visibleRows();
261
277
  if (!rows.length)
@@ -291,6 +307,10 @@ export function setBlocksFocusContext(form) {
291
307
  return null;
292
308
  return { list, index: form.blocks.list(list).length };
293
309
  }
310
+ /**
311
+ * Inserts a block of `type` at `at`, after the selection by default, and selects it. The new
312
+ * id, or `null` when the form is locked or the list does not take the type.
313
+ */
294
314
  function insertType(type, at = insertionPoint()) {
295
315
  if (locked || !at)
296
316
  return null;
@@ -328,6 +348,7 @@ export function setBlocksFocusContext(form) {
328
348
  }
329
349
  /** Adds the type picked where the picker was opened. */
330
350
  const insertPicked = (type) => insertType(type, pickPoint());
351
+ /** Duplicates the selected block right after it, and selects the copy. */
331
352
  function duplicateSelection() {
332
353
  const current = movableAt();
333
354
  if (locked || !current)
@@ -358,6 +379,7 @@ export function setBlocksFocusContext(form) {
358
379
  }
359
380
  select(blockPath({ list: first.list, index: Math.min(first.index, remaining.length - 1) }));
360
381
  }
382
+ /** Moves the selected block `delta` places within its list; past either end, nothing moves. */
361
383
  function moveSelection(delta) {
362
384
  const current = movableAt();
363
385
  if (locked || !current)
@@ -368,6 +390,7 @@ export function setBlocksFocusContext(form) {
368
390
  form.blocks.move(blockPath(current), { list: current.list, index });
369
391
  select(blockPath({ list: current.list, index }));
370
392
  }
393
+ /** Moves the selected block to the end of `list`, and selects it where it lands. */
371
394
  function moveSelectionInto(list) {
372
395
  const current = movableAt();
373
396
  if (locked || !current)
@@ -377,12 +400,17 @@ export function setBlocksFocusContext(form) {
377
400
  const landed = shiftListPath(list, current);
378
401
  select(blockPath({ list: landed, index }));
379
402
  }
403
+ /** Copies the first selected block to the clipboard. */
380
404
  function copySelection() {
381
405
  const current = currentAt();
382
406
  if (!current)
383
407
  return Promise.resolve();
384
408
  return form.blocks.copy(blockPath(current));
385
409
  }
410
+ /**
411
+ * Pastes the copied block after the selection. The new id, or `null` when nothing was copied or
412
+ * the list refuses its type.
413
+ */
386
414
  async function pasteAfterSelection() {
387
415
  const at = insertionPoint();
388
416
  if (locked || !at)
@@ -408,6 +436,7 @@ export function setBlocksFocusContext(form) {
408
436
  else
409
437
  collapsed.delete(id);
410
438
  };
439
+ /** Folds every row that holds a list. */
411
440
  const collapseAll = () => {
412
441
  for (const row of allRows())
413
442
  if (row.children.length)