rimecms 0.33.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (489) hide show
  1. package/dist/adapter-sqlite/auth.server.d.ts +2 -2
  2. package/dist/adapter-sqlite/columns.server.js +2 -2
  3. package/dist/adapter-sqlite/connect.server.d.ts +12 -0
  4. package/dist/adapter-sqlite/connect.server.js +31 -0
  5. package/dist/adapter-sqlite/generate-schema/index.server.js +11 -3
  6. package/dist/adapter-sqlite/generate-schema/root.server.d.ts +13 -4
  7. package/dist/adapter-sqlite/generate-schema/root.server.js +75 -131
  8. package/dist/adapter-sqlite/generate-schema/templates.server.d.ts +27 -6
  9. package/dist/adapter-sqlite/generate-schema/templates.server.js +52 -10
  10. package/dist/adapter-sqlite/index.server.d.ts +13 -5
  11. package/dist/adapter-sqlite/index.server.js +9 -6
  12. package/dist/adapter-sqlite/naming.server.d.ts +6 -8
  13. package/dist/adapter-sqlite/naming.server.js +22 -4
  14. package/dist/adapter-sqlite/paths.server.d.ts +10 -0
  15. package/dist/adapter-sqlite/paths.server.js +122 -0
  16. package/dist/adapter-sqlite/read.server.d.ts +10 -1
  17. package/dist/adapter-sqlite/read.server.js +22 -10
  18. package/dist/adapter-sqlite/select.server.d.ts +19 -0
  19. package/dist/adapter-sqlite/select.server.js +71 -63
  20. package/dist/adapter-sqlite/table.server.d.ts +2 -2
  21. package/dist/adapter-sqlite/transform.server.js +33 -3
  22. package/dist/adapter-sqlite/types.server.d.ts +10 -3
  23. package/dist/adapter-sqlite/where.server.d.ts +2 -3
  24. package/dist/adapter-sqlite/where.server.js +19 -1
  25. package/dist/core/adapter.d.ts +94 -0
  26. package/dist/core/auth/better-auth/config.server.d.ts +3 -3
  27. package/dist/core/auth/better-auth/instance.server.d.ts +6 -6
  28. package/dist/core/auth/handler/index.server.js +1 -1
  29. package/dist/core/auth/staff/derive.js +1 -1
  30. package/dist/core/auth/validate-config.js +3 -5
  31. package/dist/core/boot.server.d.ts +6 -6
  32. package/dist/core/config/types.d.ts +43 -5
  33. package/dist/core/config/validate.server.js +34 -51
  34. package/dist/core/dev/cli/commands/build.js +21 -6
  35. package/dist/core/dev/cli/commands/init.server.d.ts +2 -1
  36. package/dist/core/dev/cli/commands/init.server.js +32 -6
  37. package/dist/core/dev/cli/index.js +1 -0
  38. package/dist/core/dev/cli/templates/init.d.ts +6 -1
  39. package/dist/core/dev/cli/templates/init.js +30 -2
  40. package/dist/core/dev/cli/util/package-manager.server.d.ts +1 -0
  41. package/dist/core/dev/cli/util/package-manager.server.js +11 -8
  42. package/dist/core/dev/cli/util/package.server.d.ts +9 -0
  43. package/dist/core/dev/cli/util/package.server.js +43 -0
  44. package/dist/core/dev/codegen/types/contributions.server.d.ts +3 -2
  45. package/dist/core/dev/codegen/types/contributions.server.js +10 -3
  46. package/dist/core/dev/vite.server.js +4 -3
  47. package/dist/core/fields/blank.d.ts +21 -0
  48. package/dist/core/fields/blank.js +37 -0
  49. package/dist/core/fields/builders/field-builder.d.ts +53 -0
  50. package/dist/core/fields/builders/field-builder.js +14 -1
  51. package/dist/core/fields/builders/form-field-builder.d.ts +8 -0
  52. package/dist/core/fields/builders/form-field-builder.js +14 -1
  53. package/dist/core/fields/util.d.ts +9 -2
  54. package/dist/core/fields/util.js +123 -135
  55. package/dist/core/fields/walk.d.ts +44 -0
  56. package/dist/core/fields/walk.js +55 -0
  57. package/dist/core/handler.server.js +4 -0
  58. package/dist/core/i18n/context.d.ts +5 -0
  59. package/dist/core/i18n/context.js +6 -0
  60. package/dist/core/i18n/en/common.d.ts +71 -0
  61. package/dist/core/i18n/en/common.js +72 -1
  62. package/dist/core/i18n/en/fields.d.ts +68 -0
  63. package/dist/core/i18n/en/fields.js +69 -1
  64. package/dist/core/i18n/fr/common.d.ts +71 -0
  65. package/dist/core/i18n/fr/common.js +72 -1
  66. package/dist/core/i18n/fr/fields.d.ts +68 -0
  67. package/dist/core/i18n/fr/fields.js +69 -1
  68. package/dist/core/i18n/index.d.ts +29 -3
  69. package/dist/core/i18n/index.js +55 -29
  70. package/dist/core/locale/copy.server.js +3 -3
  71. package/dist/core/logger.server.js +15 -6
  72. package/dist/core/pipeline/build-document.server.d.ts +3 -0
  73. package/dist/core/pipeline/build-document.server.js +10 -7
  74. package/dist/core/pipeline/config-map/index.d.ts +9 -0
  75. package/dist/core/pipeline/config-map/index.js +16 -50
  76. package/dist/core/pipeline/hooks/process-document-fields.server.d.ts +3 -0
  77. package/dist/core/pipeline/hooks/process-document-fields.server.js +48 -12
  78. package/dist/core/pipeline/hooks/set-default-values.server.d.ts +1 -0
  79. package/dist/core/pipeline/hooks/set-default-values.server.js +1 -0
  80. package/dist/core/pipeline/persist/blocks/extract.server.js +1 -1
  81. package/dist/core/pipeline/persist/relations/extract.server.js +2 -0
  82. package/dist/core/pipeline/populate-relations.server.d.ts +27 -0
  83. package/dist/core/pipeline/populate-relations.server.js +42 -0
  84. package/dist/core/pipeline/run.server.d.ts +17 -6
  85. package/dist/core/pipeline/run.server.js +44 -30
  86. package/dist/core/plugins/cache/module.server.d.ts +1 -1
  87. package/dist/core/plugins/cache/module.server.js +5 -5
  88. package/dist/core/prototype/area/api.server.js +1 -2
  89. package/dist/core/prototype/area/definition.js +1 -10
  90. package/dist/core/prototype/area/definition.server.js +4 -5
  91. package/dist/core/prototype/area/hooks.server.js +3 -2
  92. package/dist/core/prototype/area/operations/find.js +2 -0
  93. package/dist/core/prototype/blank.d.ts +26 -0
  94. package/dist/core/prototype/blank.js +22 -0
  95. package/dist/core/prototype/collection/api.server.d.ts +29 -3
  96. package/dist/core/prototype/collection/api.server.js +47 -4
  97. package/dist/core/prototype/collection/definition.js +0 -3
  98. package/dist/core/prototype/collection/hooks/merge-with-blank.server.d.ts +5 -1
  99. package/dist/core/prototype/collection/hooks/merge-with-blank.server.js +8 -22
  100. package/dist/core/prototype/collection/hooks.server.js +11 -5
  101. package/dist/core/prototype/collection/nested/module.server.js +3 -1
  102. package/dist/core/prototype/collection/nested/tree.d.ts +12 -0
  103. package/dist/core/prototype/collection/nested/tree.js +42 -0
  104. package/dist/core/prototype/collection/operations/find-by-id.js +2 -0
  105. package/dist/core/prototype/collection/operations/find-by-ids.d.ts +19 -0
  106. package/dist/core/prototype/collection/operations/find-by-ids.js +54 -0
  107. package/dist/core/prototype/collection/operations/find.js +21 -27
  108. package/dist/core/prototype/collection/operations/update-slug-by-id.d.ts +20 -0
  109. package/dist/core/prototype/collection/operations/update-slug-by-id.js +53 -0
  110. package/dist/core/prototype/collection/rest/index.server.js +3 -1
  111. package/dist/core/prototype/collection/rest/update-slug-by-id.server.d.ts +2 -0
  112. package/dist/core/prototype/collection/rest/update-slug-by-id.server.js +20 -0
  113. package/dist/core/prototype/collection/thumbnail/find-thumbnail.d.ts +2 -1
  114. package/dist/core/prototype/collection/thumbnail/find-thumbnail.js +4 -27
  115. package/dist/core/prototype/collection/upload/directories/derive.js +3 -1
  116. package/dist/core/prototype/collection/upload/disk/delete.server.js +1 -2
  117. package/dist/core/prototype/define.js +2 -0
  118. package/dist/core/prototype/shared/metas/fields.js +2 -1
  119. package/dist/core/prototype/shared/title/find-title.d.ts +2 -1
  120. package/dist/core/prototype/shared/title/find-title.js +5 -28
  121. package/dist/core/prototype/shared/url/addresses.server.d.ts +26 -0
  122. package/dist/core/prototype/shared/url/addresses.server.js +119 -0
  123. package/dist/core/prototype/shared/url/doc-type.d.ts +6 -0
  124. package/dist/core/prototype/shared/url/doc-type.js +9 -0
  125. package/dist/core/prototype/shared/url/format.server.d.ts +27 -0
  126. package/dist/core/prototype/shared/url/format.server.js +38 -0
  127. package/dist/core/prototype/shared/url/hooks/create-paths.server.d.ts +2 -0
  128. package/dist/core/prototype/shared/url/hooks/create-paths.server.js +9 -0
  129. package/dist/core/prototype/shared/url/hooks/detach-paths.server.d.ts +5 -0
  130. package/dist/core/prototype/shared/url/hooks/detach-paths.server.js +18 -0
  131. package/dist/core/prototype/shared/url/hooks/index.server.d.ts +5 -1
  132. package/dist/core/prototype/shared/url/hooks/index.server.js +5 -1
  133. package/dist/core/prototype/shared/url/hooks/set-area-url.server.d.ts +2 -0
  134. package/dist/core/prototype/shared/url/hooks/set-area-url.server.js +8 -0
  135. package/dist/core/prototype/shared/url/hooks/set-live-url.server.d.ts +5 -0
  136. package/dist/core/prototype/shared/url/hooks/set-live-url.server.js +19 -0
  137. package/dist/core/prototype/shared/url/hooks/sync-paths.server.d.ts +7 -0
  138. package/dist/core/prototype/shared/url/hooks/sync-paths.server.js +37 -0
  139. package/dist/core/prototype/shared/url/refresh.server.d.ts +36 -0
  140. package/dist/core/prototype/shared/url/refresh.server.js +58 -0
  141. package/dist/core/prototype/shared/versions/configure.server.js +3 -0
  142. package/dist/core/routes/context.server.d.ts +2 -1
  143. package/dist/fields/blocks/component/AddBlockButton.svelte +48 -137
  144. package/dist/fields/blocks/component/Block.svelte +153 -117
  145. package/dist/fields/blocks/component/Block.svelte.d.ts +11 -5
  146. package/dist/fields/blocks/component/BlockActions.svelte +76 -26
  147. package/dist/fields/blocks/component/BlockActions.svelte.d.ts +3 -0
  148. package/dist/fields/blocks/component/Blocks.svelte +248 -91
  149. package/dist/fields/blocks/component/focus/BlocksFocus.svelte +680 -0
  150. package/dist/fields/blocks/component/focus/BlocksFocus.svelte.d.ts +7 -0
  151. package/dist/fields/blocks/component/focus/Layers.svelte +145 -0
  152. package/dist/fields/blocks/component/focus/Layers.svelte.d.ts +9 -0
  153. package/dist/fields/blocks/component/focus/LayersList.svelte +304 -0
  154. package/dist/fields/blocks/component/focus/LayersList.svelte.d.ts +10 -0
  155. package/dist/fields/blocks/component/focus/Palette.svelte +135 -0
  156. package/dist/fields/blocks/component/focus/Palette.svelte.d.ts +9 -0
  157. package/dist/fields/blocks/component/focus/RenderPlaceholder.svelte +77 -0
  158. package/dist/fields/blocks/component/focus/RenderPlaceholder.svelte.d.ts +10 -0
  159. package/dist/fields/blocks/component/focus/Renders.svelte +302 -0
  160. package/dist/fields/blocks/component/focus/Renders.svelte.d.ts +11 -0
  161. package/dist/fields/blocks/component/focus/Stage.svelte +190 -0
  162. package/dist/fields/blocks/component/focus/Stage.svelte.d.ts +8 -0
  163. package/dist/fields/blocks/component/focus/StagePlaceholder.svelte +69 -0
  164. package/dist/fields/blocks/component/focus/StagePlaceholder.svelte.d.ts +3 -0
  165. package/dist/fields/blocks/component/focus/focus.svelte.d.ts +140 -0
  166. package/dist/fields/blocks/component/focus/focus.svelte.js +424 -0
  167. package/dist/fields/blocks/component/picker/BlockPicker.svelte +88 -0
  168. package/dist/fields/blocks/component/picker/BlockPicker.svelte.d.ts +10 -0
  169. package/dist/fields/blocks/component/picker/BlockTile.svelte +121 -0
  170. package/dist/fields/blocks/component/picker/BlockTile.svelte.d.ts +12 -0
  171. package/dist/fields/blocks/index.d.ts +49 -7
  172. package/dist/fields/blocks/index.js +61 -12
  173. package/dist/fields/checkbox/component/Checkbox.svelte +11 -37
  174. package/dist/fields/checkbox/component/Checkbox.svelte.d.ts +1 -0
  175. package/dist/fields/combobox/component/ComboBox.svelte +37 -7
  176. package/dist/fields/combobox/component/combobox.css +26 -10
  177. package/dist/fields/date/component/Date.svelte +43 -12
  178. package/dist/fields/group/component/Group.svelte +110 -41
  179. package/dist/fields/group/index.d.ts +5 -1
  180. package/dist/fields/group/index.js +10 -2
  181. package/dist/fields/link/component/Link.svelte +184 -143
  182. package/dist/fields/link/component/RessourceInput.svelte +26 -24
  183. package/dist/fields/link/index.d.ts +1 -0
  184. package/dist/fields/link/module.server.js +2 -4
  185. package/dist/fields/number/component/Number.svelte +38 -20
  186. package/dist/fields/number/component/number.css +22 -20
  187. package/dist/fields/number/index.d.ts +1 -0
  188. package/dist/fields/radio/component/Radio.svelte +12 -0
  189. package/dist/fields/radio/index.js +1 -1
  190. package/dist/fields/relation/component/Relation.svelte +169 -40
  191. package/dist/fields/relation/component/RelationInline.svelte +258 -0
  192. package/dist/fields/relation/component/RelationInline.svelte.d.ts +26 -0
  193. package/dist/fields/relation/component/default/Default.svelte +210 -100
  194. package/dist/fields/relation/component/default/Default.svelte.d.ts +14 -1
  195. package/dist/fields/relation/component/types.d.ts +4 -0
  196. package/dist/fields/relation/component/upload/Browse.svelte +619 -88
  197. package/dist/fields/relation/component/upload/Browse.svelte.d.ts +10 -2
  198. package/dist/fields/relation/component/upload/Create.svelte +41 -0
  199. package/dist/fields/relation/component/upload/Create.svelte.d.ts +13 -0
  200. package/dist/fields/relation/component/upload/Upload.svelte +287 -101
  201. package/dist/fields/relation/component/upload/Upload.svelte.d.ts +6 -1
  202. package/dist/fields/relation/component/upload/upload.css +5 -81
  203. package/dist/fields/relation/module.server.js +7 -1
  204. package/dist/fields/relation/value.d.ts +25 -0
  205. package/dist/fields/relation/value.js +27 -0
  206. package/dist/fields/rich-text/component/RichText.svelte +12 -80
  207. package/dist/fields/rich-text/component/RichText.svelte.d.ts +1 -1
  208. package/dist/fields/rich-text/component/RichTextInline.svelte +28 -0
  209. package/dist/fields/rich-text/component/RichTextInline.svelte.d.ts +11 -0
  210. package/dist/fields/rich-text/component/bubble-menu/bubble-menu.css +4 -3
  211. package/dist/fields/rich-text/component/bubble-menu/bubble-menu.svelte +3 -1
  212. package/dist/fields/rich-text/component/bubble-menu/icon-button/icon-button.css +2 -2
  213. package/dist/fields/rich-text/component/bubble-menu/node-selector/node-selector.css +7 -10
  214. package/dist/fields/rich-text/component/drag-handle/drag-handle.css +0 -2
  215. package/dist/fields/rich-text/component/styles/editor.css +111 -0
  216. package/dist/fields/rich-text/component/styles/field.css +71 -0
  217. package/dist/fields/rich-text/component/suggestion/suggestion.svelte +41 -56
  218. package/dist/fields/rich-text/core/build-editor-config.js +1 -1
  219. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle-plugin.js +29 -3
  220. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.d.ts +1 -0
  221. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.js +2 -1
  222. package/dist/fields/rich-text/core/features/fields/fields.css +2 -3
  223. package/dist/fields/rich-text/core/features/hr/hr.css +4 -4
  224. package/dist/fields/rich-text/core/features/link/component/link-selector.css +0 -4
  225. package/dist/fields/rich-text/core/features/link/component/link-selector.svelte +24 -8
  226. package/dist/fields/rich-text/core/features/resource/resource.svelte +20 -6
  227. package/dist/fields/rich-text/core/features/upload/upload.svelte +20 -8
  228. package/dist/fields/rich-text/core/rich-text-editor-core.svelte +103 -0
  229. package/dist/fields/rich-text/core/rich-text-editor-core.svelte.d.ts +15 -0
  230. package/dist/fields/select/component/Select.svelte +67 -28
  231. package/dist/fields/slug/component/Slug.svelte +26 -53
  232. package/dist/fields/slug/index.d.ts +1 -0
  233. package/dist/fields/slug/index.js +1 -1
  234. package/dist/fields/tabs/component/Tabs.svelte +28 -22
  235. package/dist/fields/tabs/index.d.ts +4 -1
  236. package/dist/fields/tabs/index.js +17 -5
  237. package/dist/fields/text/index.d.ts +1 -0
  238. package/dist/fields/textarea/component/TextArea.svelte +28 -13
  239. package/dist/fields/textarea/index.d.ts +1 -0
  240. package/dist/fields/time/component/Time.svelte +9 -2
  241. package/dist/fields/toggle/component/Toggle.svelte +8 -25
  242. package/dist/fields/toggle/component/Toggle.svelte.d.ts +1 -0
  243. package/dist/fields/toggle/index.d.ts +1 -0
  244. package/dist/fields/tree/component/AddItemButton.svelte +18 -5
  245. package/dist/fields/tree/component/Tree.svelte +48 -19
  246. package/dist/fields/tree/component/TreeBlock.svelte +318 -104
  247. package/dist/fields/tree/component/TreeBlockActions.svelte +71 -7
  248. package/dist/fields/tree/component/TreeBlockActions.svelte.d.ts +4 -0
  249. package/dist/fields/tree/component/props.d.ts +2 -1
  250. package/dist/fields/tree/index.d.ts +13 -1
  251. package/dist/fields/tree/index.js +35 -9
  252. package/dist/fields/types.d.ts +3 -1
  253. package/dist/index.d.ts +4 -3
  254. package/dist/index.js +3 -2
  255. package/dist/panel/components/Root.svelte +16 -44
  256. package/dist/panel/components/Root.svelte.d.ts +1 -1
  257. package/dist/panel/components/fields/Error.svelte +18 -3
  258. package/dist/panel/components/fields/FieldsPreview.svelte +30 -17
  259. package/dist/panel/components/fields/FieldsPreviewTrigger.svelte +25 -3
  260. package/dist/panel/components/fields/Hint.svelte +51 -8
  261. package/dist/panel/components/fields/Hint.svelte.d.ts +11 -0
  262. package/dist/panel/components/fields/Label.svelte +2 -0
  263. package/dist/panel/components/fields/LabelFor.svelte +7 -2
  264. package/dist/panel/components/fields/RenderFields.svelte +10 -3
  265. package/dist/panel/components/fields/fieldset.svelte.d.ts +4 -1
  266. package/dist/panel/components/fields/fieldset.svelte.js +9 -2
  267. package/dist/panel/components/fields/index.d.ts +1 -0
  268. package/dist/panel/components/fields/setting.css +82 -0
  269. package/dist/panel/components/sections/auth/AuthForm.svelte +25 -26
  270. package/dist/panel/components/sections/collection/Avatar.svelte +61 -0
  271. package/dist/panel/components/sections/collection/Avatar.svelte.d.ts +9 -0
  272. package/dist/panel/components/sections/collection/DocStatus.svelte +28 -0
  273. package/dist/panel/components/sections/collection/DocStatus.svelte.d.ts +7 -0
  274. package/dist/panel/components/sections/collection/Empty.svelte +3 -3
  275. package/dist/panel/components/sections/collection/StatusDot.svelte +7 -5
  276. package/dist/panel/components/sections/collection/When.svelte +33 -0
  277. package/dist/panel/components/sections/collection/When.svelte.d.ts +8 -0
  278. package/dist/panel/components/sections/collection/bulk-upload/BulkUploadDialog.svelte +65 -21
  279. package/dist/panel/components/sections/collection/bulk-upload/BulkUploadDialog.svelte.d.ts +3 -2
  280. package/dist/panel/components/sections/collection/bulk-upload/DropZone.svelte +45 -162
  281. package/dist/panel/components/sections/collection/bulk-upload/DropZone.svelte.d.ts +3 -2
  282. package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte +151 -0
  283. package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte.d.ts +17 -0
  284. package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte +177 -0
  285. package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte.d.ts +12 -0
  286. package/dist/panel/components/sections/collection/bulk-upload/UploadProgress.svelte +75 -0
  287. package/dist/panel/components/sections/collection/bulk-upload/UploadProgress.svelte.d.ts +8 -0
  288. package/dist/panel/components/sections/collection/folder/Folder.svelte +18 -3
  289. package/dist/panel/components/sections/collection/folder/FolderEdit.svelte +26 -18
  290. package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte +98 -58
  291. package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte.d.ts +0 -1
  292. package/dist/panel/components/sections/collection/folder/Folders.svelte +60 -0
  293. package/dist/panel/components/sections/collection/folder/Folders.svelte.d.ts +7 -0
  294. package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte +31 -71
  295. package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte.d.ts +1 -0
  296. package/dist/panel/components/sections/collection/grid/create-directory-dialog/CreateDirectoryDialog.svelte +5 -3
  297. package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte +250 -37
  298. package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte.d.ts +2 -0
  299. package/dist/panel/components/sections/collection/header/ButtonCreate.svelte +43 -18
  300. package/dist/panel/components/sections/collection/header/ButtonCreate.svelte.d.ts +6 -4
  301. package/dist/panel/components/sections/collection/header/DisplayMode.svelte +69 -58
  302. package/dist/panel/components/sections/collection/header/DisplayMode.svelte.d.ts +0 -1
  303. package/dist/panel/components/sections/collection/header/FilterMenu.svelte +60 -0
  304. package/dist/panel/components/sections/collection/header/FilterMenu.svelte.d.ts +14 -0
  305. package/dist/panel/components/sections/collection/header/SearchInput.svelte +17 -26
  306. package/dist/panel/components/sections/collection/header/SelectUI.svelte +19 -34
  307. package/dist/panel/components/sections/collection/list/CollectionList.svelte +99 -68
  308. package/dist/panel/components/sections/collection/list/columns.d.ts +21 -0
  309. package/dist/panel/components/sections/collection/list/columns.js +23 -0
  310. package/dist/panel/components/sections/collection/list/header/Header.svelte +99 -51
  311. package/dist/panel/components/sections/collection/list/row/Row.svelte +165 -82
  312. package/dist/panel/components/sections/collection/list/row/Row.svelte.d.ts +4 -0
  313. package/dist/panel/components/sections/collection/tree/CollectionTree.svelte +92 -44
  314. package/dist/panel/components/sections/collection/tree/CollectionTree.svelte.d.ts +1 -0
  315. package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte +139 -43
  316. package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte.d.ts +2 -0
  317. package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte +1 -1
  318. package/dist/panel/components/sections/commands/CommandButton.svelte +99 -0
  319. package/dist/panel/components/sections/commands/CommandButton.svelte.d.ts +10 -0
  320. package/dist/panel/components/sections/commands/CommandPalette.svelte +275 -0
  321. package/dist/panel/components/sections/commands/CommandPalette.svelte.d.ts +8 -0
  322. package/dist/panel/components/sections/commands/Commands.svelte +18 -0
  323. package/dist/panel/components/sections/commands/Commands.svelte.d.ts +9 -0
  324. package/dist/panel/components/sections/document/AuthAPIKeyDialog.svelte +23 -7
  325. package/dist/panel/components/sections/document/AuthFooter.svelte +31 -12
  326. package/dist/panel/components/sections/document/AutoSaveBanner.svelte +24 -7
  327. package/dist/panel/components/sections/document/ButtonSave.svelte +32 -21
  328. package/dist/panel/components/sections/document/ButtonSave.svelte.d.ts +5 -5
  329. package/dist/panel/components/sections/document/ButtonStatus.svelte +68 -20
  330. package/dist/panel/components/sections/document/ChangeSlugDialog.svelte +199 -0
  331. package/dist/panel/components/sections/document/ChangeSlugDialog.svelte.d.ts +10 -0
  332. package/dist/panel/components/sections/document/CurrentlyEdited.svelte +2 -2
  333. package/dist/panel/components/sections/document/Document.svelte +96 -65
  334. package/dist/panel/components/sections/document/DocumentChildren.svelte +175 -0
  335. package/dist/panel/components/sections/document/DocumentChildren.svelte.d.ts +8 -0
  336. package/dist/panel/components/sections/document/DocumentUrl.svelte +119 -0
  337. package/dist/panel/components/sections/document/DocumentUrl.svelte.d.ts +9 -0
  338. package/dist/panel/components/sections/document/Header.svelte +171 -94
  339. package/dist/panel/components/sections/document/Settings.svelte +255 -110
  340. package/dist/panel/components/sections/document/Settings.svelte.d.ts +0 -1
  341. package/dist/panel/components/sections/document/Versions.svelte +5 -3
  342. package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte +112 -53
  343. package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte.d.ts +2 -2
  344. package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte +74 -41
  345. package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte.d.ts +1 -1
  346. package/dist/panel/components/sections/live/LiveEdit.svelte +2 -2
  347. package/dist/panel/components/sections/live/LiveFloatingUI.svelte +30 -11
  348. package/dist/panel/components/sections/live/live-edit-panel.css +2 -2
  349. package/dist/panel/components/sections/page-layout/Page.svelte +13 -1
  350. package/dist/panel/components/ui/breadcrumb/BreadCrumb.svelte +55 -27
  351. package/dist/panel/components/ui/button/button.svelte +81 -54
  352. package/dist/panel/components/ui/button/index.d.ts +7 -3
  353. package/dist/panel/components/ui/button/index.js +2 -2
  354. package/dist/panel/components/ui/calendar/calendar.css +27 -27
  355. package/dist/panel/components/ui/calendar/calendar.svelte.d.ts +1 -1
  356. package/dist/panel/components/ui/card/card-description.svelte +1 -1
  357. package/dist/panel/components/ui/card/card.svelte +21 -4
  358. package/dist/panel/components/ui/card-document/card-document.svelte +24 -12
  359. package/dist/panel/components/ui/card-resource/card-resource.svelte +26 -8
  360. package/dist/panel/components/ui/checkbox/checkbox.css +8 -10
  361. package/dist/panel/components/ui/command/command-dialog.css +28 -4
  362. package/dist/panel/components/ui/command/command-dialog.svelte +4 -1
  363. package/dist/panel/components/ui/command/command-dialog.svelte.d.ts +2 -0
  364. package/dist/panel/components/ui/command/command-empty.css +1 -1
  365. package/dist/panel/components/ui/command/command-group.css +3 -3
  366. package/dist/panel/components/ui/command/command-input-select.svelte +3 -3
  367. package/dist/panel/components/ui/command/command-input.svelte +38 -14
  368. package/dist/panel/components/ui/command/command-input.svelte.d.ts +6 -1
  369. package/dist/panel/components/ui/command/command-item.css +2 -2
  370. package/dist/panel/components/ui/command/command-list.css +1 -1
  371. package/dist/panel/components/ui/command/command-separator.css +1 -1
  372. package/dist/panel/components/ui/context-menu/context-menu-item.css +2 -2
  373. package/dist/panel/components/ui/context-menu/context-menu.css +6 -7
  374. package/dist/panel/components/ui/dialog/dialog-content.css +8 -10
  375. package/dist/panel/components/ui/dialog/dialog-content.svelte +19 -0
  376. package/dist/panel/components/ui/dialog/dialog-description.css +1 -1
  377. package/dist/panel/components/ui/dialog/dialog-footer.svelte +5 -1
  378. package/dist/panel/components/ui/dialog/dialog-overlay.css +1 -1
  379. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +19 -5
  380. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-content.css +6 -4
  381. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-item.css +1 -1
  382. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-radio-item.css +1 -1
  383. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-separator.css +1 -1
  384. package/dist/panel/components/ui/input/input.svelte +57 -31
  385. package/dist/panel/components/ui/kbd/Kbd.svelte +90 -0
  386. package/dist/panel/components/ui/kbd/Kbd.svelte.d.ts +11 -0
  387. package/dist/panel/components/ui/kbd/index.d.ts +1 -0
  388. package/dist/panel/components/ui/kbd/index.js +1 -0
  389. package/dist/panel/components/ui/label/label.css +5 -3
  390. package/dist/panel/components/ui/language-switcher/LanguageSwitcher.svelte +27 -15
  391. package/dist/panel/components/ui/nav/Nav.svelte +180 -110
  392. package/dist/panel/components/ui/nav/Nav.svelte.d.ts +0 -2
  393. package/dist/panel/components/ui/nav/NavGroup.svelte +87 -73
  394. package/dist/panel/components/ui/nav/NavItemButton.svelte +69 -29
  395. package/dist/panel/components/ui/nav/UserButton.svelte +132 -71
  396. package/dist/panel/components/ui/page-header/PageHeader.svelte +140 -42
  397. package/dist/panel/components/ui/page-header/PageHeader.svelte.d.ts +8 -1
  398. package/dist/panel/components/ui/popover/popover-content.css +4 -3
  399. package/dist/panel/components/ui/radio-group/radio-group.css +4 -6
  400. package/dist/panel/components/ui/radio-row-group/radio-row-group.css +19 -7
  401. package/dist/panel/components/ui/scroll-area/scroll-area.css +2 -2
  402. package/dist/panel/components/ui/separator/separator.svelte +1 -1
  403. package/dist/panel/components/ui/sheet/index.d.ts +4 -4
  404. package/dist/panel/components/ui/sheet/index.js +5 -5
  405. package/dist/panel/components/ui/sheet/sheet.css +50 -11
  406. package/dist/panel/components/ui/sonner/sonner.css +11 -8
  407. package/dist/panel/components/ui/switch/switch.css +13 -18
  408. package/dist/panel/components/ui/tabs/tabs.css +44 -35
  409. package/dist/panel/components/ui/tag/tag.svelte +20 -6
  410. package/dist/panel/components/ui/tooltip/tooltip-content.svelte +14 -4
  411. package/dist/panel/components/ui/tree/tree-rows.css +146 -0
  412. package/dist/panel/context/blocks-ops.d.ts +78 -0
  413. package/dist/panel/context/blocks-ops.js +170 -0
  414. package/dist/panel/context/collection.svelte.d.ts +28 -0
  415. package/dist/panel/context/collection.svelte.js +120 -65
  416. package/dist/panel/context/commands.svelte.d.ts +80 -0
  417. package/dist/panel/context/commands.svelte.js +108 -0
  418. package/dist/panel/context/documentForm.svelte.d.ts +34 -2
  419. package/dist/panel/context/documentForm.svelte.js +105 -102
  420. package/dist/panel/context/live.svelte.js +2 -73
  421. package/dist/panel/context/nav.svelte.d.ts +23 -0
  422. package/dist/panel/context/nav.svelte.js +56 -0
  423. package/dist/panel/fonts/Geist-VariableFont_wght.ttf +0 -0
  424. package/dist/panel/fonts/GeistMono-VariableFont_wght.ttf +0 -0
  425. package/dist/panel/index.d.ts +7 -1
  426. package/dist/panel/index.js +10 -1
  427. package/dist/panel/pages/auth/forgot-password/ForgotPassword.svelte +16 -1
  428. package/dist/panel/pages/collection/CollectionPage.svelte +236 -61
  429. package/dist/panel/pages/collection/load.server.js +1 -1
  430. package/dist/panel/pages/dashboard/Dashboard.svelte +135 -90
  431. package/dist/panel/pages/dashboard/DashboardCard.svelte +109 -0
  432. package/dist/panel/pages/dashboard/DashboardCard.svelte.d.ts +14 -0
  433. package/dist/panel/pages/dashboard/DashboardCollection.svelte +180 -57
  434. package/dist/panel/pages/dashboard/DashboardCollection.svelte.d.ts +1 -0
  435. package/dist/panel/pages/dashboard/DashboardRow.svelte +93 -0
  436. package/dist/panel/pages/dashboard/DashboardRow.svelte.d.ts +16 -0
  437. package/dist/panel/pages/dashboard/load.server.js +49 -25
  438. package/dist/panel/pages/dashboard/time.d.ts +19 -0
  439. package/dist/panel/pages/dashboard/time.js +29 -0
  440. package/dist/panel/pages/dashboard/types.d.ts +9 -2
  441. package/dist/panel/pages/live/Live.svelte +53 -50
  442. package/dist/panel/style/font.css +21 -32
  443. package/dist/panel/style/index.css +191 -122
  444. package/dist/panel/style/mixins/index.css +14 -0
  445. package/dist/panel/style/palette.css +35 -26
  446. package/dist/panel/style/postcss/size-function.d.ts +4 -0
  447. package/dist/panel/style/postcss/size-function.js +24 -0
  448. package/dist/panel/style/radius.css +4 -5
  449. package/dist/panel/style/scheme.css +111 -0
  450. package/dist/panel/style/size.css +3 -0
  451. package/dist/panel/util/Sortable.js +9 -4
  452. package/dist/panel/util/keys.d.ts +24 -0
  453. package/dist/panel/util/keys.js +63 -0
  454. package/dist/panel/util/populate.d.ts +8 -0
  455. package/dist/panel/util/populate.js +49 -0
  456. package/dist/panel/util/time.d.ts +12 -0
  457. package/dist/panel/util/time.js +35 -0
  458. package/dist/panel/util/upload-file.d.ts +106 -0
  459. package/dist/panel/util/upload-file.js +165 -0
  460. package/dist/util/index.d.ts +7 -10
  461. package/dist/util/index.js +7 -8
  462. package/dist/util/object.d.ts +10 -0
  463. package/dist/util/object.js +22 -1
  464. package/dist/util/string.d.ts +17 -0
  465. package/dist/util/string.js +23 -0
  466. package/package.json +1 -3
  467. package/dist/core/pipeline/config-map/build-tree-map.d.ts +0 -4
  468. package/dist/core/pipeline/config-map/build-tree-map.js +0 -30
  469. package/dist/core/prototype/doc.d.ts +0 -31
  470. package/dist/core/prototype/doc.js +0 -118
  471. package/dist/core/prototype/shared/url/augment.d.ts +0 -13
  472. package/dist/core/prototype/shared/url/augment.js +0 -11
  473. package/dist/core/prototype/shared/url/hooks/populate-url.server.d.ts +0 -4
  474. package/dist/core/prototype/shared/url/hooks/populate-url.server.js +0 -120
  475. package/dist/fields/rich-text/component/styles/rich-text.css +0 -183
  476. package/dist/panel/components/sections/collection/header/Header.svelte +0 -17
  477. package/dist/panel/components/sections/collection/header/Header.svelte.d.ts +0 -3
  478. package/dist/panel/components/sections/collection/header/Separator.svelte +0 -8
  479. package/dist/panel/components/sections/collection/header/Separator.svelte.d.ts +0 -26
  480. package/dist/panel/components/sections/collection/tree/util.d.ts +0 -12
  481. package/dist/panel/components/sections/collection/tree/util.js +0 -22
  482. package/dist/panel/fonts/ChivoMono-Italic-VariableFont_wght.ttf +0 -0
  483. package/dist/panel/fonts/ChivoMono-VariableFont_wght.ttf +0 -0
  484. package/dist/panel/fonts/Inter-VariableFont_slnt,wght.ttf +0 -0
  485. package/dist/panel/fonts/Lora-Italic-VariableFont_wght.ttf +0 -0
  486. package/dist/panel/fonts/Lora-VariableFont_wght.ttf +0 -0
  487. package/dist/panel/style/shadow.css +0 -10
  488. package/dist/util/path.d.ts +0 -16
  489. package/dist/util/path.js +0 -19
@@ -2,11 +2,14 @@ import { isVersioned } from '../../../prototype/shared/versions/enabled.js';
2
2
  import { versionsDocType } from '../../../prototype/shared/versions/doc-type.js';
3
3
  import { isUpload } from '../../../prototype/collection/upload/enabled.js';
4
4
  import { uploadDocType } from '../../../prototype/collection/upload/doc-type.js';
5
+ import { hasUrl } from '../../../prototype/shared/url/enabled.js';
6
+ import { urlDocType } from '../../../prototype/shared/url/doc-type.js';
5
7
  /**
6
8
  * What each config's generated doc type gains beyond its own fields.
7
9
  *
8
- * Two contributors and they are the whole list: `versions` adds `versionId`, `upload` extends
9
- * `UploadDoc`, adds its `sizes` member and filters out the fields its image sizes collide with.
10
+ * Three contributors and they are the whole list: `versions` adds `versionId`, `upload` extends
11
+ * `UploadDoc`, adds its `sizes` member and filters out the fields its image sizes collide with,
12
+ * `url` adds the address.
10
13
  * The `fields` predicates are **ANDed** — each says which fields it still wants generated, and
11
14
  * a field has to survive both.
12
15
  *
@@ -14,7 +17,11 @@ import { uploadDocType } from '../../../prototype/collection/upload/doc-type.js'
14
17
  export const contributionsFor = (config) =>
15
18
  // Upload before versions: the prototype's feature list has upload first, and the members land
16
19
  // in that order in the generated type.
17
- [isUpload(config) ? uploadDocType(config) : null, isVersioned(config) ? versionsDocType() : null]
20
+ [
21
+ isUpload(config) ? uploadDocType(config) : null,
22
+ isVersioned(config) ? versionsDocType() : null,
23
+ hasUrl(config) ? urlDocType(config.type) : null
24
+ ]
18
25
  .filter((c) => c !== null)
19
26
  .reduce((current, contribution) => ({
20
27
  extends: [...current.extends, ...(contribution.extends ?? [])],
@@ -149,16 +149,17 @@ export function rime() {
149
149
  },
150
150
  config() {
151
151
  return {
152
+ // `bun:sqlite` only exists at runtime under Bun (adapterSqlite driver 'bun').
152
153
  ssr: {
153
- external: ['sharp']
154
+ external: ['sharp', 'bun:sqlite']
154
155
  },
155
156
  optimizeDeps: {
156
- exclude: ['sharp'],
157
+ exclude: ['sharp', 'bun:sqlite'],
157
158
  include: ['@lucide/svelte']
158
159
  },
159
160
  build: {
160
161
  rollupOptions: {
161
- external: ['sharp']
162
+ external: ['sharp', 'bun:sqlite']
162
163
  },
163
164
  target: 'es2022'
164
165
  },
@@ -0,0 +1,21 @@
1
+ import type { FieldBuilder } from './builders/field-builder.js';
2
+ import type { Field } from '../../fields/types.js';
3
+ import type { Dic } from '../../util/types.js';
4
+ import type { RequestEvent } from '@sveltejs/kit';
5
+ /** What a field is handed to build its blank value. The event is a default's, and boot has none. */
6
+ export type BlankContext = {
7
+ event?: RequestEvent;
8
+ };
9
+ /**
10
+ * A list of fields as a blank object, each field contributing its own members.
11
+ *
12
+ * A branch opens an object, a leaf holds its default, and a repeater holds its own — `#` in a
13
+ * segment means only a document can name the children.
14
+ *
15
+ * ```
16
+ * group('attributes').fields(text('title')) -> { attributes: { title: null } }
17
+ * tabs(tab('meta').fields(text('title'))) -> { meta: { title: null } }
18
+ * blocks('layout', [...]) -> { layout: [] }
19
+ * ```
20
+ */
21
+ export declare const blankFields: (fields: FieldBuilder<Field>[], context?: BlankContext) => Dic;
@@ -0,0 +1,37 @@
1
+ import { isFormField } from './util.js';
2
+ /**
3
+ * A list of fields as a blank object, each field contributing its own members.
4
+ *
5
+ * A branch opens an object, a leaf holds its default, and a repeater holds its own — `#` in a
6
+ * segment means only a document can name the children.
7
+ *
8
+ * ```
9
+ * group('attributes').fields(text('title')) -> { attributes: { title: null } }
10
+ * tabs(tab('meta').fields(text('title'))) -> { meta: { title: null } }
11
+ * blocks('layout', [...]) -> { layout: [] }
12
+ * ```
13
+ */
14
+ export const blankFields = (fields, context = {}) => {
15
+ const doc = {};
16
+ for (const field of fields) {
17
+ try {
18
+ const nodes = field.use.nodes();
19
+ if (!nodes.length || nodes.some((node) => node.segment.includes('#'))) {
20
+ if (isFormField(field))
21
+ doc[field.name] = field.use.defaultValue(context) ?? null;
22
+ continue;
23
+ }
24
+ // Its name opens an object, or it has none and its branches land on this one.
25
+ const target = field.name ? (doc[field.name] = {}) : doc;
26
+ for (const node of nodes) {
27
+ const bucket = node.segment ? (target[node.segment] = {}) : target;
28
+ Object.assign(bucket, blankFields(node.fields, context));
29
+ }
30
+ }
31
+ catch (err) {
32
+ console.error(`Building the blank value of ${field.type} field "${field.name}" failed.`);
33
+ throw err;
34
+ }
35
+ }
36
+ return doc;
37
+ };
@@ -23,6 +23,53 @@ export type FieldUse = {
23
23
  accessCreate(...args: Parameters<FieldAccess>): boolean;
24
24
  accessUpdate(...args: Parameters<FieldAccess>): boolean;
25
25
  generateType(): string;
26
+ /** Every branch this field can produce, from the config alone. */
27
+ nodes(): FieldNode[];
28
+ /** The branches this particular value has. */
29
+ nodesFor(value: unknown): ValueNode[];
30
+ };
31
+ /**
32
+ * One branch below a field: what it adds to the path, and the fields under it.
33
+ *
34
+ * ```
35
+ * group('attributes') -> { segment: '', fields: [ text('title') ] }
36
+ * tabs(tab('meta')) -> { segment: 'meta', fields: [ text('title') ] }
37
+ * blocks('layout') -> { segment: '#:hero', fields: [ text('title') ] }
38
+ * tree('nav') -> { segment: '#', repeatVia: '_children', fields: [ text('label') ] }
39
+ * ```
40
+ */
41
+ export type FieldNode = {
42
+ /**
43
+ * The segment this branch contributes below the field's own name. `''` when it contributes
44
+ * nothing — Group, whose own name is already the segment. `#` stands for an index that only a
45
+ * document can supply.
46
+ */
47
+ segment: string;
48
+ /**
49
+ * When set, the branch nests into itself through this segment, so `nav.0`, `nav.0._children.1`
50
+ * and deeper are all this same branch. Read when resolving a path; a value walk flattens the
51
+ * recursion itself.
52
+ */
53
+ repeatVia?: string;
54
+ fields: FieldBuilder[];
55
+ /**
56
+ * The branch is stored as rows of its own, in a child table of the owner, not as its columns.
57
+ * `kind` is the table's marker on disk; `name` is what follows it.
58
+ *
59
+ * ```
60
+ * blocks('layout', [block('hero')]) { kind: 'blocks', name: 'hero' } pages__$blocks_hero
61
+ * tree('nav') { kind: 'tree', name: 'nav' } pages__$tree_nav
62
+ * ```
63
+ */
64
+ storage?: NodeStorage;
65
+ };
66
+ export type NodeStorage = {
67
+ kind: 'blocks' | 'tree';
68
+ name: string;
69
+ };
70
+ /** A branch a real value has: a concrete segment, no `#`, and the data under it. */
71
+ export type ValueNode = FieldNode & {
72
+ value: unknown;
26
73
  };
27
74
  export declare class FieldBuilder<T extends Field = Field> {
28
75
  field: T;
@@ -68,4 +115,10 @@ export declare class FieldBuilder<T extends Field = Field> {
68
115
  * compile error), while staying a real overridable method so every concrete field can
69
116
  * provide its own, unlike a private `#field` which can't be polymorphically overridden. */
70
117
  protected generateType(): string;
118
+ /** The branches below this field, from the config alone. A leaf has none.
119
+ * `protected` and reached through `.use.nodes()`, same as `generateType`. */
120
+ protected nodes(): FieldNode[];
121
+ /** The branches below this field for one value. A leaf has none.
122
+ * `protected` and reached through `.use.nodesFor()`, same as `generateType`. */
123
+ protected nodesFor(_value: unknown): ValueNode[];
71
124
  }
@@ -56,7 +56,9 @@ export class FieldBuilder {
56
56
  accessCreate: (..._args) => true,
57
57
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
58
58
  accessUpdate: (..._args) => true,
59
- generateType: () => this.generateType()
59
+ generateType: () => this.generateType(),
60
+ nodes: () => this.nodes(),
61
+ nodesFor: (value) => this.nodesFor(value)
60
62
  };
61
63
  }
62
64
  get component() {
@@ -72,4 +74,15 @@ export class FieldBuilder {
72
74
  generateType() {
73
75
  return '';
74
76
  }
77
+ /** The branches below this field, from the config alone. A leaf has none.
78
+ * `protected` and reached through `.use.nodes()`, same as `generateType`. */
79
+ nodes() {
80
+ return [];
81
+ }
82
+ /** The branches below this field for one value. A leaf has none.
83
+ * `protected` and reached through `.use.nodesFor()`, same as `generateType`. */
84
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
85
+ nodesFor(_value) {
86
+ return [];
87
+ }
75
88
  }
@@ -67,6 +67,14 @@ export declare class FormFieldBuilder<T extends FormField = FormField> extends F
67
67
  * `_parent` on a nested collection is the typical case: the site tree must not fork per version.
68
68
  */
69
69
  $root(): this;
70
+ /**
71
+ * Indexes the field's column, for a field a list is filtered or sorted by.
72
+ *
73
+ * ```ts
74
+ * text('sku').$index() // where[sku][equals]=… reads the index, not every row
75
+ * ```
76
+ */
77
+ $index(): this;
70
78
  /** `label`/`localized`/`root`/`required` are the only properties that need
71
79
  * anything beyond a plain `this.field` read (a fallback default, or a
72
80
  * boolean coercion) — everything else a concrete field type adds
@@ -69,6 +69,17 @@ export class FormFieldBuilder extends FieldBuilder {
69
69
  this.field.root = true;
70
70
  return this;
71
71
  }
72
+ /**
73
+ * Indexes the field's column, for a field a list is filtered or sorted by.
74
+ *
75
+ * ```ts
76
+ * text('sku').$index() // where[sku][equals]=… reads the index, not every row
77
+ * ```
78
+ */
79
+ $index() {
80
+ this.field.index = true;
81
+ return this;
82
+ }
72
83
  /** `label`/`localized`/`root`/`required` are the only properties that need
73
84
  * anything beyond a plain `this.field` read (a fallback default, or a
74
85
  * boolean coercion) — everything else a concrete field type adds
@@ -148,7 +159,9 @@ export class FormFieldBuilder extends FieldBuilder {
148
159
  const value = this.field.defaultValue;
149
160
  return typeof value === 'function' ? value(context) : value;
150
161
  },
151
- generateType: () => this._references?.resolve ? this.resolvedReferenceType() : this.generateType()
162
+ generateType: () => this._references?.resolve ? this.resolvedReferenceType() : this.generateType(),
163
+ nodes: () => this.nodes(),
164
+ nodesFor: (value) => this.nodesFor(value)
152
165
  };
153
166
  }
154
167
  /** The document a resolved reference reads as, whatever the field's own type says. */
@@ -1,4 +1,4 @@
1
- import type { Field, FormField, SeparatorField } from '../../fields/types.js';
1
+ import type { Field, FieldAccess, FormField, SeparatorField } from '../../fields/types.js';
2
2
  import type { Dic } from '../../util/types.js';
3
3
  import type { FormFieldBuilder } from './builders/form-field-builder.js';
4
4
  import type { FieldBuilder } from './builders/index.js';
@@ -35,7 +35,7 @@ export declare const isLiveField: (field: Field) => boolean | undefined;
35
35
  * ]}
36
36
  * ]);
37
37
  */
38
- export declare const emptyValuesFromFieldConfig: <T extends FormFieldBuilder>(arr: T[]) => Dic;
38
+ export declare const emptyValuesFromFieldConfig: (fields: FieldBuilder[]) => Dic;
39
39
  /**
40
40
  * Converts a path with numeric indices to a regex pattern
41
41
  * Numbers between dots or between dot and colon are converted to \d+
@@ -85,6 +85,8 @@ export declare const baseFieldNames: (config: {
85
85
  fields: FieldBuilder[];
86
86
  }) => string[];
87
87
  export type ResolvedReference = {
88
+ /** The field itself, for whoever must ask it something — who may read it, for one. */
89
+ field: FormFieldBuilder<FormField>;
88
90
  /** The document path: `meta.owner`. */
89
91
  path: string;
90
92
  /** The column it is stored in: `meta__owner`. */
@@ -109,6 +111,11 @@ export type ResolvedReference = {
109
111
  * Walks tabs and groups, whose columns sit on the owner's row. Blocks and tree rows are their
110
112
  * own tables and are not walked.
111
113
  */
114
+ /**
115
+ * The resolved references a reader may see, by path — what a read asks the adapter to join. A
116
+ * reference the pipeline would drop for this reader is not joined for nothing.
117
+ */
118
+ export declare const readableReferences: (fields: FieldBuilder[], user: Parameters<FieldAccess>[0]) => string[];
112
119
  export declare const resolvedReferencesOf: (fields: FieldBuilder[], parentPath?: string) => ResolvedReference[];
113
120
  /**
114
121
  * Splits a write into the half that belongs on the base row and the half that belongs on the
@@ -1,8 +1,5 @@
1
- import { BlocksBuilder } from '../../fields/blocks/index.js';
2
- import { GroupFieldBuilder } from '../../fields/group/index.js';
3
- import { TabsBuilder } from '../../fields/tabs/index.js';
4
- import { TreeBuilder } from '../../fields/tree/index.js';
5
- import { normalizeFieldPath } from '../../util/path.js';
1
+ import { normalizeFieldPath } from '../../util/string.js';
2
+ import { matchesSegment, walkFields } from './walk.js';
6
3
  /**
7
4
  * Checks if a field is a presentative field (currently only separator fields).
8
5
  * Presentative fields are used for UI organization and don't store data.
@@ -36,31 +33,20 @@ export const isLiveField = (field) => field.live;
36
33
  * ]}
37
34
  * ]);
38
35
  */
39
- export const emptyValuesFromFieldConfig = (arr) => {
40
- return Object.fromEntries(arr.map((config) => {
41
- let emptyValue;
42
- // Handle group fields - create nested object structure
43
- if (config instanceof GroupFieldBuilder) {
44
- emptyValue = emptyValuesFromFieldConfig(config.get.fields.filter(isFormField));
45
- }
46
- // Handle tabs fields - create nested object structure for each tab
47
- else if (config instanceof TabsBuilder) {
48
- const tabsValue = {};
49
- const tabs = config.get.tabs;
50
- for (const tab of tabs) {
51
- if ('fields' in tab) {
52
- tabsValue[tab.name] = emptyValuesFromFieldConfig(tab.get.fields.filter(isFormField));
53
- }
54
- }
55
- emptyValue = tabsValue;
56
- }
57
- // Handle default values
58
- else {
59
- emptyValue = config.use.defaultValue();
60
- }
61
- return [config.name, emptyValue];
62
- }));
63
- };
36
+ export const emptyValuesFromFieldConfig = (fields) => Object.fromEntries(fields.filter(isFormField).map((config) => {
37
+ const nodes = config.use.nodes();
38
+ // A leaf, and a repeater with it: `#` means only a document can name the children, so an
39
+ // empty one holds the field's own default.
40
+ if (!nodes.length || nodes.some((node) => node.segment.includes('#'))) {
41
+ return [config.name, config.use.defaultValue()];
42
+ }
43
+ const value = {};
44
+ for (const node of nodes) {
45
+ const bucket = node.segment ? (value[node.segment] = {}) : value;
46
+ Object.assign(bucket, emptyValuesFromFieldConfig(node.fields));
47
+ }
48
+ return [config.name, value];
49
+ }));
64
50
  /**
65
51
  * Converts a path with numeric indices to a regex pattern
66
52
  * Numbers between dots or between dot and colon are converted to \d+
@@ -91,49 +77,53 @@ export function pathToRegex(path) {
91
77
  *
92
78
  */
93
79
  export const getFieldAtPath = (path, fields) => {
94
- const parts = path.split('.');
95
- const findInFields = (currentFields, remainingParts) => {
96
- if (remainingParts.length === 0)
80
+ const findInFields = (currentFields, parts) => {
81
+ if (!parts.length)
97
82
  return undefined;
98
- const currentPart = remainingParts[0];
99
83
  for (const field of currentFields) {
100
- // Handle tabs
101
- if (field instanceof TabsBuilder) {
102
- const tab = field.get.tabs.find((t) => t.name === currentPart);
103
- if (tab) {
104
- return findInFields(tab.get.fields, remainingParts.slice(1));
84
+ const nodes = field.use.nodes();
85
+ // A container with no name of its own: its branches are the segment (tabs).
86
+ if (!field.name) {
87
+ for (const node of nodes) {
88
+ if (!matchesSegment(node.segment, parts[0]))
89
+ continue;
90
+ const found = findInFields(node.fields, parts.slice(1));
91
+ if (found)
92
+ return found;
105
93
  }
106
94
  continue;
107
95
  }
108
- // Handle regular fields
109
- if (isFormField(field)) {
110
- if (field.name === currentPart) {
111
- if (remainingParts.length === 1) {
112
- return field;
113
- }
114
- if (field instanceof GroupFieldBuilder) {
115
- return findInFields(field.get.fields, remainingParts.slice(1));
116
- }
117
- // Handle blocks
118
- if (field instanceof BlocksBuilder && remainingParts.length > 1) {
119
- // const blockPartPattern = /:[a-zA-Z0-9]+/
120
- const blockType = remainingParts[1].split(':')[1];
121
- if (blockType) {
122
- const block = field.get.blocks.find((b) => b.name === blockType);
123
- if (block) {
124
- return findInFields(block.get.fields, remainingParts.slice(2));
125
- }
126
- }
127
- }
128
- if (field instanceof TreeBuilder) {
129
- return findInFields(field.get.fields, remainingParts.slice(2));
130
- }
96
+ if (field.name !== parts[0])
97
+ continue;
98
+ if (parts.length === 1)
99
+ return field;
100
+ for (const node of nodes) {
101
+ // A branch that adds no segment: the rest of the path is already inside it.
102
+ if (!node.segment) {
103
+ const found = findInFields(node.fields, parts.slice(1));
104
+ if (found)
105
+ return found;
106
+ continue;
107
+ }
108
+ if (!matchesSegment(node.segment, parts[1]))
109
+ continue;
110
+ // A repeating branch stays itself through `_children.<index>`, however deep.
111
+ let rest = parts.slice(2);
112
+ while (node.repeatVia &&
113
+ rest[0] === node.repeatVia &&
114
+ rest[1] !== undefined &&
115
+ matchesSegment(node.segment, rest[1])) {
116
+ rest = rest.slice(2);
131
117
  }
118
+ const found = findInFields(node.fields, rest);
119
+ if (found)
120
+ return found;
132
121
  }
122
+ return undefined;
133
123
  }
134
124
  return undefined;
135
125
  };
136
- return findInFields(fields, parts);
126
+ return findInFields(fields, path.split('.'));
137
127
  };
138
128
  /**
139
129
  * Traverses a FieldBuilder[] tree and returns the subset of builders to pass to
@@ -149,60 +139,53 @@ export function getFieldListAtPath(fieldPath, fields, parentPath = '') {
149
139
  const dotIndex = fieldPath.indexOf('.');
150
140
  const head = dotIndex === -1 ? fieldPath : fieldPath.slice(0, dotIndex);
151
141
  const tail = dotIndex === -1 ? '' : fieldPath.slice(dotIndex + 1);
152
- const isEndpoint = fieldPath.split('.').length === 1;
153
- const nextParentPath = normalizeFieldPath(`${parentPath}${parentPath ? '.' : ''}${head}`);
142
+ const isEndpoint = !tail;
143
+ const below = (path, segment) => normalizeFieldPath(path ? `${path}.${segment}` : segment);
154
144
  for (const field of fields) {
155
- // ── Tabs container: navigate into the matching tab
156
- if (field instanceof TabsBuilder) {
157
- const tab = field.field.tabs.find((t) => t.name === head);
158
- if (!tab)
145
+ const nodes = field.use.nodes();
146
+ // A container with no name of its own: its branches are the segment (tabs).
147
+ if (!field.name) {
148
+ const node = nodes.find((candidate) => matchesSegment(candidate.segment, head));
149
+ if (!node)
159
150
  continue;
160
- if (isEndpoint) {
161
- // Path targets the tab → return all its inner fields
162
- return { fields: tab.get.fields, path: nextParentPath };
163
- }
164
- return getFieldListAtPath(tail, tab.get.fields, nextParentPath);
151
+ const path = below(parentPath, head);
152
+ return isEndpoint
153
+ ? { fields: node.fields, path }
154
+ : getFieldListAtPath(tail, node.fields, path);
165
155
  }
166
- if (!isFormField(field))
156
+ if (field.name !== head)
167
157
  continue;
168
- // ── Group field: navigate into children
169
- if (field instanceof GroupFieldBuilder && field.name === head) {
170
- const children = field.get.fields;
171
- if (isEndpoint)
172
- return { fields: children, path: nextParentPath };
173
- return getFieldListAtPath(tail, children, nextParentPath);
158
+ const own = below(parentPath, head);
159
+ // A branch that adds no segment: the rest of the path is already inside it (group).
160
+ const transparent = nodes.find((node) => !node.segment);
161
+ if (transparent) {
162
+ return isEndpoint
163
+ ? { fields: transparent.fields, path: own }
164
+ : getFieldListAtPath(tail, transparent.fields, own);
174
165
  }
175
- // —— Blocks
176
- if (field instanceof BlocksBuilder && field.name === head) {
177
- const blockType = tail.split('.')[0]?.split(':')[1];
178
- const isInnerBlockLookup = tail.split('.').length > 1;
179
- const nextParentPathWithBlockIndex = `${nextParentPath}.${tail.split('.')[0]}`;
180
- if (blockType) {
181
- const block = field.get.blocks.find((b) => b.name === blockType);
182
- if (!isInnerBlockLookup && block?.get.fields) {
183
- return {
184
- fields: block.get.fields,
185
- path: normalizeFieldPath(nextParentPathWithBlockIndex)
186
- };
187
- }
188
- if (block) {
189
- return getFieldListAtPath(tail.split('.').slice(1).join('.'), block.get.fields, normalizeFieldPath(nextParentPathWithBlockIndex));
190
- }
191
- }
192
- return { fields: [field], path: parentPath };
193
- }
194
- // Tree
195
- if (field instanceof TreeBuilder && field.name === head) {
196
- const children = field.get.fields;
197
- const nextParentPathWithIndex = `${nextParentPath}.${tail.split('.')[0]}`;
198
- if (isEndpoint)
199
- return { fields: children, path: nextParentPath };
200
- return getFieldListAtPath(tail.split('.').slice(1).join('.'), children, nextParentPathWithIndex);
166
+ if (isEndpoint) {
167
+ // Nothing left to pick a branch with. One unnamed branch is still the answer — a tree row;
168
+ // several named ones are not — a blocks field answers with itself.
169
+ const only = nodes.length === 1 && !nodes[0].segment.includes(':') ? nodes[0] : undefined;
170
+ return only ? { fields: only.fields, path: own } : { fields: [field], path: parentPath };
201
171
  }
202
- // Direct unique field match
203
- if (isEndpoint && isFormField(field) && field.name === fieldPath) {
172
+ const parts = tail.split('.');
173
+ const node = nodes.find((candidate) => matchesSegment(candidate.segment, parts[0]));
174
+ if (!node)
204
175
  return { fields: [field], path: parentPath };
176
+ // A repeating branch stays itself through `_children.<index>`, however deep.
177
+ let rest = parts.slice(1);
178
+ let path = below(own, parts[0]);
179
+ while (node.repeatVia &&
180
+ rest[0] === node.repeatVia &&
181
+ rest[1] !== undefined &&
182
+ matchesSegment(node.segment, rest[1])) {
183
+ path = `${path}.${rest[0]}.${rest[1]}`;
184
+ rest = rest.slice(2);
205
185
  }
186
+ return rest.length
187
+ ? getFieldListAtPath(rest.join('.'), node.fields, path)
188
+ : { fields: node.fields, path };
206
189
  }
207
190
  console.warn(`[LiveEditPanel] fieldPath "${fieldPath}" not found in config fields`);
208
191
  return { fields, path: parentPath };
@@ -218,10 +201,7 @@ export function getFieldListAtPath(fieldPath, fields, parentPath = '') {
218
201
  *
219
202
  * Top-level only, matching the generator: a nested field cannot be split off its parent.
220
203
  */
221
- export const baseFieldNames = (config) => config.fields
222
- .filter(isFormField)
223
- .filter((field) => field.get.root)
224
- .map((field) => field.name);
204
+ export const baseFieldNames = (config) => config.fields.filter((field) => field.get.root).map((field) => field.name);
225
205
  /**
226
206
  * The fields a read resolves into the document they reference, with the column each one is
227
207
  * stored in. A field opts in with `$references(slug, { resolve: true })`.
@@ -237,31 +217,39 @@ export const baseFieldNames = (config) => config.fields
237
217
  * Walks tabs and groups, whose columns sit on the owner's row. Blocks and tree rows are their
238
218
  * own tables and are not walked.
239
219
  */
220
+ /**
221
+ * The resolved references a reader may see, by path — what a read asks the adapter to join. A
222
+ * reference the pipeline would drop for this reader is not joined for nothing.
223
+ */
224
+ export const readableReferences = (fields, user) => resolvedReferencesOf(fields)
225
+ .filter((reference) => reference.field.use.accessRead(user))
226
+ .map((reference) => reference.path);
227
+ const resolvedReferencesMemo = new WeakMap();
240
228
  export const resolvedReferencesOf = (fields, parentPath = '') => {
241
- const prefix = parentPath ? `${parentPath}.` : '';
242
- const found = [];
243
- for (const field of fields) {
244
- if (field instanceof TabsBuilder) {
245
- for (const tab of field.get.tabs) {
246
- found.push(...resolvedReferencesOf(tab.get.fields, `${prefix}${tab.name}`));
247
- }
248
- continue;
229
+ // A config's fields do not change once built, and this is asked once per query and once per
230
+ // document read: answered once per list of fields.
231
+ if (!parentPath) {
232
+ let found = resolvedReferencesMemo.get(fields);
233
+ if (!found) {
234
+ found = collectResolvedReferences(fields, '');
235
+ resolvedReferencesMemo.set(fields, found);
249
236
  }
250
- if (!isFormField(field))
251
- continue;
252
- if (field instanceof GroupFieldBuilder) {
253
- found.push(...resolvedReferencesOf(field.get.fields, `${prefix}${field.name}`));
237
+ return found;
238
+ }
239
+ return collectResolvedReferences(fields, parentPath);
240
+ };
241
+ const collectResolvedReferences = (fields, parentPath) => {
242
+ const found = [];
243
+ for (const { field, path } of walkFields(fields, { path: parentPath, determinate: true })) {
244
+ if (!isFormField(field) || !field._references?.resolve)
254
245
  continue;
255
- }
256
- if (field._references?.resolve) {
257
- const path = `${prefix}${field.name}`;
258
- found.push({
259
- path,
260
- column: path.replace(/\./g, '__'),
261
- root: field.get.root,
262
- to: field._references.table
263
- });
264
- }
246
+ found.push({
247
+ field,
248
+ path,
249
+ column: path.replace(/\./g, '__'),
250
+ root: field.get.root,
251
+ to: field._references.table
252
+ });
265
253
  }
266
254
  return found;
267
255
  };
@@ -0,0 +1,44 @@
1
+ import type { FieldBuilder } from './builders/field-builder.js';
2
+ /** A field the walk reached, the path it sits at, and the data there when the walk has data. */
3
+ export type Visit = {
4
+ field: FieldBuilder;
5
+ path: string;
6
+ value: unknown;
7
+ };
8
+ /** The document grammar's join. A joiner is never handed an empty part — a branch that
9
+ * contributes no segment keeps its parent's path — so it only guards the empty parent. */
10
+ export declare const joinPath: (parent: string, part: string) => string;
11
+ export type WalkOptions = {
12
+ path?: string;
13
+ /** The schema generator joins with `__`. */
14
+ join?: (parent: string, part: string) => string;
15
+ /** Skip branches whose segment holds a `#` — a path no config alone can name. */
16
+ determinate?: boolean;
17
+ };
18
+ /**
19
+ * Every field the config declares, parents before children, siblings in declaration order.
20
+ *
21
+ * ```
22
+ * tabs(tab('meta').fields(group('seo').fields(text('title'))))
23
+ * -> meta.seo · meta.seo.title
24
+ * ```
25
+ */
26
+ export declare function walkFields(fields: FieldBuilder[], { path, join, determinate }?: WalkOptions): Generator<Visit>;
27
+ /**
28
+ * Every field a document actually carries, at the path its value sits at. A named field the data
29
+ * does not hold contributes nothing.
30
+ *
31
+ * ```
32
+ * blocks('layout', [block('hero').fields(text('title'))])
33
+ * { layout: [ { type: 'hero', title: 'x' } ] } -> layout · layout.0:hero.title
34
+ * ```
35
+ */
36
+ export declare function walkValues(fields: FieldBuilder[], data: unknown, { path, join }?: WalkOptions): Generator<Visit>;
37
+ /**
38
+ * Whether one concrete segment is the branch a declared segment stands for.
39
+ *
40
+ * ```
41
+ * '#:hero' matches '0:hero' · '#' matches '7' · 'meta' matches only 'meta'
42
+ * ```
43
+ */
44
+ export declare const matchesSegment: (pattern: string, segment: string) => boolean;