@rebasepro/cms 0.28.2 → 0.29.0-canary.g0e3a0e7

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 (339) hide show
  1. package/README.md +3 -3
  2. package/dist/collection_editor/_cms_internals.d.ts +0 -1
  3. package/dist/collection_editor/ui/EditorCollectionAction.d.ts +2 -2
  4. package/dist/collection_editor/ui/EditorCollectionAction.js.map +1 -1
  5. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js +2 -2
  6. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -1
  7. package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js +1 -1
  8. package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js.map +1 -1
  9. package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js +1 -1
  10. package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js.map +1 -1
  11. package/dist/components/AdditionalFieldValue.d.ts +9 -3
  12. package/dist/components/AdditionalFieldValue.js +7 -4
  13. package/dist/components/AdditionalFieldValue.js.map +1 -1
  14. package/dist/components/CollectionPanel.d.ts +117 -18
  15. package/dist/components/CollectionPanel.js +115 -37
  16. package/dist/components/CollectionPanel.js.map +1 -1
  17. package/dist/components/CollectionTableBinding/CollectionRowActions.d.ts +5 -5
  18. package/dist/components/CollectionTableBinding/CollectionRowActions.js +16 -12
  19. package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -1
  20. package/dist/components/CollectionTableBinding/CollectionTableBinding.js +33 -8
  21. package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -1
  22. package/dist/components/CollectionTableBinding/CollectionTableBindingProps.d.ts +8 -3
  23. package/dist/components/CollectionTableBinding/PropertyTableCell.js +2 -2
  24. package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -1
  25. package/dist/components/CollectionTableBinding/column_utils.d.ts +9 -1
  26. package/dist/components/CollectionTableBinding/column_utils.js +6 -3
  27. package/dist/components/CollectionTableBinding/column_utils.js.map +1 -1
  28. package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +2 -2
  29. package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -1
  30. package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +2 -2
  31. package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -1
  32. package/dist/components/CollectionTableBinding/fields/TableRelationField.js +2 -2
  33. package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -1
  34. package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.d.ts +3 -2
  35. package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js +9 -7
  36. package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js.map +1 -1
  37. package/dist/components/CollectionTableBinding/internal/common.d.ts +26 -2
  38. package/dist/components/CollectionTableBinding/internal/common.js +88 -4
  39. package/dist/components/CollectionTableBinding/internal/common.js.map +1 -1
  40. package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +4 -3
  41. package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -1
  42. package/dist/components/CollectionViewBinding/BoardCardBinding.d.ts +7 -1
  43. package/dist/components/CollectionViewBinding/BoardCardBinding.js +19 -14
  44. package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -1
  45. package/dist/components/CollectionViewBinding/CollectionAddButton.d.ts +28 -0
  46. package/dist/components/CollectionViewBinding/CollectionAddButton.js +50 -0
  47. package/dist/components/CollectionViewBinding/CollectionAddButton.js.map +1 -0
  48. package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.d.ts +11 -3
  49. package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +9 -4
  50. package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -1
  51. package/dist/components/CollectionViewBinding/CollectionCardViewBinding.d.ts +5 -3
  52. package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js +5 -3
  53. package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -1
  54. package/dist/components/CollectionViewBinding/CollectionEntityActions.d.ts +29 -0
  55. package/dist/components/CollectionViewBinding/CollectionEntityActions.js +112 -0
  56. package/dist/components/CollectionViewBinding/CollectionEntityActions.js.map +1 -0
  57. package/dist/components/CollectionViewBinding/CollectionListViewBinding.d.ts +2 -2
  58. package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +58 -16
  59. package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -1
  60. package/dist/components/CollectionViewBinding/CollectionToolbar.d.ts +57 -0
  61. package/dist/components/CollectionViewBinding/CollectionToolbar.js +146 -0
  62. package/dist/components/CollectionViewBinding/CollectionToolbar.js.map +1 -0
  63. package/dist/components/CollectionViewBinding/CollectionViewActions.d.ts +2 -2
  64. package/dist/components/CollectionViewBinding/CollectionViewActions.js +22 -26
  65. package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -1
  66. package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +58 -22
  67. package/dist/components/CollectionViewBinding/CollectionViewBinding.js +81 -1089
  68. package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -1
  69. package/dist/components/CollectionViewBinding/CollectionViewContent.d.ts +9 -0
  70. package/dist/components/CollectionViewBinding/CollectionViewContent.js +152 -0
  71. package/dist/components/CollectionViewBinding/CollectionViewContent.js.map +1 -0
  72. package/dist/components/CollectionViewBinding/CollectionViewDialogs.d.ts +9 -0
  73. package/dist/components/CollectionViewBinding/CollectionViewDialogs.js +38 -0
  74. package/dist/components/CollectionViewBinding/CollectionViewDialogs.js.map +1 -0
  75. package/dist/components/CollectionViewBinding/CollectionViewFrame.d.ts +13 -0
  76. package/dist/components/CollectionViewBinding/CollectionViewFrame.js +32 -0
  77. package/dist/components/CollectionViewBinding/CollectionViewFrame.js.map +1 -0
  78. package/dist/components/CollectionViewBinding/CollectionViewScope.d.ts +14 -0
  79. package/dist/components/CollectionViewBinding/CollectionViewScope.js +22 -0
  80. package/dist/components/CollectionViewBinding/CollectionViewScope.js.map +1 -0
  81. package/dist/components/CollectionViewBinding/CollectionViewStartActions.d.ts +2 -2
  82. package/dist/components/CollectionViewBinding/CollectionViewStartActions.js +39 -67
  83. package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -1
  84. package/dist/components/CollectionViewBinding/CustomViewHost.d.ts +28 -0
  85. package/dist/components/CollectionViewBinding/CustomViewHost.js +54 -0
  86. package/dist/components/CollectionViewBinding/CustomViewHost.js.map +1 -0
  87. package/dist/components/CollectionViewBinding/EntitiesCount.d.ts +24 -0
  88. package/dist/components/CollectionViewBinding/EntitiesCount.js +69 -0
  89. package/dist/components/CollectionViewBinding/EntitiesCount.js.map +1 -0
  90. package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +7 -1
  91. package/dist/components/CollectionViewBinding/EntityCardBinding.js +34 -23
  92. package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -1
  93. package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.d.ts +17 -0
  94. package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js +107 -0
  95. package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js.map +1 -0
  96. package/dist/components/CollectionViewBinding/FiltersButton.d.ts +15 -0
  97. package/dist/components/CollectionViewBinding/FiltersButton.js +49 -0
  98. package/dist/components/CollectionViewBinding/FiltersButton.js.map +1 -0
  99. package/dist/components/CollectionViewBinding/PluginColumnSlots.d.ts +35 -0
  100. package/dist/components/CollectionViewBinding/PluginColumnSlots.js +45 -0
  101. package/dist/components/CollectionViewBinding/PluginColumnSlots.js.map +1 -0
  102. package/dist/components/CollectionViewBinding/RowActions.d.ts +40 -0
  103. package/dist/components/CollectionViewBinding/RowActions.js +60 -0
  104. package/dist/components/CollectionViewBinding/RowActions.js.map +1 -0
  105. package/dist/components/CollectionViewBinding/SplitListView.d.ts +7 -4
  106. package/dist/components/CollectionViewBinding/SplitListView.js +20 -21
  107. package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -1
  108. package/dist/components/CollectionViewBinding/builtin_action_props.d.ts +13 -0
  109. package/dist/components/CollectionViewBinding/fields.d.ts +22 -0
  110. package/dist/components/CollectionViewBinding/fields.js +47 -0
  111. package/dist/components/CollectionViewBinding/fields.js.map +1 -0
  112. package/dist/components/CollectionViewBinding/useBoardDataController.js +6 -7
  113. package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -1
  114. package/dist/components/CollectionViewBinding/useCollectionLargeLayout.d.ts +19 -0
  115. package/dist/components/CollectionViewBinding/useCollectionLargeLayout.js +28 -0
  116. package/dist/components/CollectionViewBinding/useCollectionLargeLayout.js.map +1 -0
  117. package/dist/components/CollectionViewBinding/useCollectionViewState.d.ts +125 -0
  118. package/dist/components/CollectionViewBinding/useCollectionViewState.js +844 -0
  119. package/dist/components/CollectionViewBinding/useCollectionViewState.js.map +1 -0
  120. package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +20 -0
  121. package/dist/components/CollectionViewBinding/usePreviewSlots.js +23 -2
  122. package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -1
  123. package/dist/components/CollectionViewBinding/useSelectionController.d.ts +21 -3
  124. package/dist/components/CollectionViewBinding/useSelectionController.js +37 -6
  125. package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -1
  126. package/dist/components/CollectionsProvider.d.ts +3 -3
  127. package/dist/components/CollectionsProvider.js +4 -4
  128. package/dist/components/CollectionsProvider.js.map +1 -1
  129. package/dist/components/CollectionsScopeContext.d.ts +1 -1
  130. package/dist/components/CollectionsScopeContext.js +1 -1
  131. package/dist/components/CollectionsScopeContext.js.map +1 -1
  132. package/dist/components/DeleteEntityDialog.d.ts +1 -1
  133. package/dist/components/DeleteEntityDialog.js +2 -2
  134. package/dist/components/DeleteEntityDialog.js.map +1 -1
  135. package/dist/components/DetailViewBinding.js +32 -68
  136. package/dist/components/DetailViewBinding.js.map +1 -1
  137. package/dist/components/EditFormActions.js +5 -4
  138. package/dist/components/EditFormActions.js.map +1 -1
  139. package/dist/components/EditViewBinding.d.ts +2 -2
  140. package/dist/components/EditViewBinding.js +25 -15
  141. package/dist/components/EditViewBinding.js.map +1 -1
  142. package/dist/components/EntityDisplayHeader.js +8 -5
  143. package/dist/components/EntityDisplayHeader.js.map +1 -1
  144. package/dist/components/EntityPreviewBinding.js +1 -1
  145. package/dist/components/EntityPreviewBinding.js.map +1 -1
  146. package/dist/components/EntityViewBinding.d.ts +8 -1
  147. package/dist/components/EntityViewBinding.js +43 -14
  148. package/dist/components/EntityViewBinding.js.map +1 -1
  149. package/dist/components/EntityViewBody.d.ts +40 -0
  150. package/dist/components/EntityViewBody.js +90 -0
  151. package/dist/components/EntityViewBody.js.map +1 -0
  152. package/dist/components/FieldValue.d.ts +50 -0
  153. package/dist/components/FieldValue.js +81 -0
  154. package/dist/components/FieldValue.js.map +1 -0
  155. package/dist/components/InlineEntityPreview.js +1 -1
  156. package/dist/components/InlineEntityPreview.js.map +1 -1
  157. package/dist/components/PanelNotFound.d.ts +5 -0
  158. package/dist/components/PanelNotFound.js +21 -0
  159. package/dist/components/PanelNotFound.js.map +1 -0
  160. package/dist/components/RebaseCMS.d.ts +1 -1
  161. package/dist/components/RebaseCMS.js +11 -3
  162. package/dist/components/RebaseCMS.js.map +1 -1
  163. package/dist/components/RebaseNavigation.js +9 -3
  164. package/dist/components/RebaseNavigation.js.map +1 -1
  165. package/dist/components/RebaseShell.js +10 -5
  166. package/dist/components/RebaseShell.js.map +1 -1
  167. package/dist/components/RecordDetail.d.ts +61 -0
  168. package/dist/components/RecordDetail.js +123 -0
  169. package/dist/components/RecordDetail.js.map +1 -0
  170. package/dist/components/RecordForm.d.ts +126 -0
  171. package/dist/components/{EntityFormPanel.js → RecordForm.js} +64 -36
  172. package/dist/components/RecordForm.js.map +1 -0
  173. package/dist/components/ReferenceTable/SelectionTableBinding.d.ts +47 -17
  174. package/dist/components/ReferenceTable/SelectionTableBinding.js +89 -53
  175. package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -1
  176. package/dist/components/ReferenceWidget.d.ts +5 -3
  177. package/dist/components/ReferenceWidget.js +10 -7
  178. package/dist/components/ReferenceWidget.js.map +1 -1
  179. package/dist/components/RelationSelector.js +4 -4
  180. package/dist/components/RelationSelector.js.map +1 -1
  181. package/dist/components/SelectableTable/SelectableTable.js +2 -3
  182. package/dist/components/SelectableTable/SelectableTable.js.map +1 -1
  183. package/dist/components/SelectableTable/SelectionStore.d.ts +1 -1
  184. package/dist/components/SelectableTable/SelectionStore.js +1 -1
  185. package/dist/components/SelectableTable/SelectionStore.js.map +1 -1
  186. package/dist/components/SelectableTable/filters/ReferenceFilterField.js +2 -2
  187. package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -1
  188. package/dist/components/SidePanelBinding.js +13 -12
  189. package/dist/components/SidePanelBinding.js.map +1 -1
  190. package/dist/components/collection_prop.d.ts +18 -0
  191. package/dist/components/collection_prop.js +23 -0
  192. package/dist/components/collection_prop.js.map +1 -0
  193. package/dist/components/common/default_entity_actions.js +54 -54
  194. package/dist/components/common/default_entity_actions.js.map +1 -1
  195. package/dist/components/history/EntityHistoryView.d.ts +4 -1
  196. package/dist/components/history/EntityHistoryView.js +1 -1
  197. package/dist/components/history/EntityHistoryView.js.map +1 -1
  198. package/dist/components/history/LastEditedByFormAction.d.ts +1 -1
  199. package/dist/components/index.d.ts +4 -2
  200. package/dist/data_export/export/ExportCollectionAction.d.ts +3 -2
  201. package/dist/data_export/export/ExportCollectionAction.js +4 -3
  202. package/dist/data_export/export/ExportCollectionAction.js.map +1 -1
  203. package/dist/data_export/export/additional_fields.d.ts +6 -3
  204. package/dist/data_export/export/additional_fields.js +8 -4
  205. package/dist/data_export/export/additional_fields.js.map +1 -1
  206. package/dist/data_import/import/ImportCollectionAction.js +2 -2
  207. package/dist/data_import/import/ImportCollectionAction.js.map +1 -1
  208. package/dist/form/EntityForm.d.ts +1 -1
  209. package/dist/form/EntityForm.js +252 -150
  210. package/dist/form/EntityForm.js.map +1 -1
  211. package/dist/form/EntityFormActions.js +3 -2
  212. package/dist/form/EntityFormActions.js.map +1 -1
  213. package/dist/form/EntityFormBinding.d.ts +1 -1
  214. package/dist/form/EntityFormBinding.js +22 -11
  215. package/dist/form/EntityFormBinding.js.map +1 -1
  216. package/dist/form/FormField.d.ts +36 -0
  217. package/dist/form/FormField.js +41 -0
  218. package/dist/form/FormField.js.map +1 -0
  219. package/dist/form/FormFieldsContext.d.ts +69 -0
  220. package/dist/form/FormFieldsContext.js +143 -0
  221. package/dist/form/FormFieldsContext.js.map +1 -0
  222. package/dist/form/PropertyFieldBinding.js +4 -4
  223. package/dist/form/PropertyFieldBinding.js.map +1 -1
  224. package/dist/form/collection_showing.d.ts +8 -0
  225. package/dist/form/collection_showing.js +29 -0
  226. package/dist/form/collection_showing.js.map +1 -0
  227. package/dist/form/components/ErrorFocus.js +2 -1
  228. package/dist/form/components/ErrorFocus.js.map +1 -1
  229. package/dist/form/components/FieldBlock.js +3 -1
  230. package/dist/form/components/FieldBlock.js.map +1 -1
  231. package/dist/form/components/FormRail.d.ts +5 -1
  232. package/dist/form/components/FormRail.js +5 -1
  233. package/dist/form/components/FormRail.js.map +1 -1
  234. package/dist/form/components/FormSections.d.ts +5 -1
  235. package/dist/form/components/FormSections.js +11 -4
  236. package/dist/form/components/FormSections.js.map +1 -1
  237. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +2 -2
  238. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -1
  239. package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +1 -1
  240. package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -1
  241. package/dist/form/field_bindings/MultipleRelationFieldBinding.js +2 -2
  242. package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -1
  243. package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -1
  244. package/dist/form/field_bindings/ReferenceFieldBinding.js +2 -2
  245. package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -1
  246. package/dist/form/field_bindings/RelationFieldBinding.js +2 -2
  247. package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -1
  248. package/dist/form/field_bindings/StorageUploadFieldBinding.js +1 -1
  249. package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -1
  250. package/dist/form/form_dom_ids.d.ts +25 -0
  251. package/dist/form/form_dom_ids.js +42 -0
  252. package/dist/form/form_dom_ids.js.map +1 -0
  253. package/dist/form/index.d.ts +3 -1
  254. package/dist/form/resolve_cell_property.d.ts +5 -0
  255. package/dist/form/resolve_cell_property.js +22 -1
  256. package/dist/form/resolve_cell_property.js.map +1 -1
  257. package/dist/hooks/index.d.ts +1 -1
  258. package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +2 -2
  259. package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -1
  260. package/dist/hooks/navigation/useNavigationResolution.d.ts +3 -3
  261. package/dist/hooks/navigation/useNavigationResolution.js.map +1 -1
  262. package/dist/hooks/navigation/useResolvedCollections.d.ts +2 -2
  263. package/dist/hooks/navigation/useResolvedCollections.js.map +1 -1
  264. package/dist/hooks/navigation/useResolvedViews.d.ts +2 -2
  265. package/dist/hooks/navigation/useResolvedViews.js.map +1 -1
  266. package/dist/hooks/useBuildSidePanel.js +9 -9
  267. package/dist/hooks/useBuildSidePanel.js.map +1 -1
  268. package/dist/hooks/useEntityDisplay.js +6 -4
  269. package/dist/hooks/useEntityDisplay.js.map +1 -1
  270. package/dist/hooks/useRecordActions.js +2 -2
  271. package/dist/hooks/useRecordActions.js.map +1 -1
  272. package/dist/hooks/useSelectionDialog.d.ts +20 -7
  273. package/dist/hooks/useSelectionDialog.js +29 -8
  274. package/dist/hooks/useSelectionDialog.js.map +1 -1
  275. package/dist/index.d.ts +8 -3
  276. package/dist/index.js +15 -9
  277. package/dist/mcp-view.d.ts +9 -0
  278. package/dist/mcp-view.js +2 -0
  279. package/dist/mcp_view/app_modules.d.ts +29 -0
  280. package/dist/mcp_view/app_modules.js +163 -0
  281. package/dist/mcp_view/app_modules.js.map +1 -0
  282. package/dist/mcp_view/bridge.d.ts +90 -0
  283. package/dist/mcp_view/bridge.js +205 -0
  284. package/dist/mcp_view/bridge.js.map +1 -0
  285. package/dist/mcp_view/code_app.d.ts +65 -0
  286. package/dist/mcp_view/code_app.js +139 -0
  287. package/dist/mcp_view/code_app.js.map +1 -0
  288. package/dist/mcp_view/index.d.ts +48 -0
  289. package/dist/mcp_view/index.js +235 -0
  290. package/dist/mcp_view/index.js.map +1 -0
  291. package/dist/mcp_view/payload.d.ts +78 -0
  292. package/dist/mcp_view/payload.js +155 -0
  293. package/dist/mcp_view/payload.js.map +1 -0
  294. package/dist/mcp_view/screen.d.ts +28 -0
  295. package/dist/mcp_view/screen.js +223 -0
  296. package/dist/mcp_view/screen.js.map +1 -0
  297. package/dist/mcp_view/storage_source.d.ts +14 -0
  298. package/dist/mcp_view/storage_source.js +29 -0
  299. package/dist/mcp_view/storage_source.js.map +1 -0
  300. package/dist/mcp_view/store.d.ts +9 -0
  301. package/dist/mcp_view/store.js +27 -0
  302. package/dist/mcp_view/store.js.map +1 -0
  303. package/dist/mcp_view/tool_driver.d.ts +135 -0
  304. package/dist/mcp_view/tool_driver.js +527 -0
  305. package/dist/mcp_view/tool_driver.js.map +1 -0
  306. package/dist/preview/components/DatePreview.d.ts +34 -1
  307. package/dist/preview/components/DatePreview.js +72 -37
  308. package/dist/preview/components/DatePreview.js.map +1 -1
  309. package/dist/routes/RebaseRoute.js +1 -1
  310. package/dist/routes/RebaseRoute.js.map +1 -1
  311. package/dist/selection/SelectionMenu.d.ts +5 -3
  312. package/dist/selection/SelectionMenu.js +16 -9
  313. package/dist/selection/SelectionMenu.js.map +1 -1
  314. package/dist/selection/index.d.ts +2 -1
  315. package/dist/selection/resolve_selection.d.ts +61 -7
  316. package/dist/selection/resolve_selection.js +93 -11
  317. package/dist/selection/resolve_selection.js.map +1 -1
  318. package/dist/types/components/EntityFormProps.d.ts +60 -10
  319. package/dist/types/fields.d.ts +2 -65
  320. package/dist/util/dataControllerAdapter.d.ts +8 -0
  321. package/dist/util/dataControllerAdapter.js +11 -0
  322. package/dist/util/dataControllerAdapter.js.map +1 -1
  323. package/dist/util/navigation_utils.d.ts +5 -4
  324. package/dist/util/navigation_utils.js +6 -6
  325. package/dist/util/navigation_utils.js.map +1 -1
  326. package/dist/util/propertyConfigMapper.d.ts +8 -0
  327. package/dist/util/propertyConfigMapper.js +16 -2
  328. package/dist/util/propertyConfigMapper.js.map +1 -1
  329. package/package.json +15 -9
  330. package/recipes/README.md +79 -26
  331. package/recipes/approval-queue.tsx +79 -0
  332. package/recipes/bulk-set-status.tsx +23 -17
  333. package/recipes/calendar-view.tsx +28 -23
  334. package/recipes/master-detail.tsx +75 -0
  335. package/recipes/my-preferences.tsx +3 -3
  336. package/recipes/orders-dashboard.tsx +58 -84
  337. package/recipes/site-settings.tsx +4 -4
  338. package/dist/components/EntityFormPanel.d.ts +0 -63
  339. package/dist/components/EntityFormPanel.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import { useLayoutEffect } from "react";
2
- import { useRebaseRegistryDispatch } from "@rebasepro/app";
1
+ import { useLayoutEffect, useMemo } from "react";
2
+ import { useRebaseEmbedHost, useRebaseRegistryDispatch } from "@rebasepro/app";
3
3
  //#region src/components/RebaseCMS.tsx
4
4
  /**
5
5
  * Declarative component to configure the admin in Rebase.
@@ -9,8 +9,12 @@ import { useRebaseRegistryDispatch } from "@rebasepro/app";
9
9
  * is auto-wired as a native feature (slots, provider, Studio view) without
10
10
  * needing any external plugin.
11
11
  */
12
- function RebaseCMS({ collections, views, homePage, entityViews, collectionViews, entityActions, collectionEditor, navigationGroupMappings, basePath }) {
12
+ function RebaseCMS({ collections: collectionsProp, views, homePage, entityViews, collectionViews, entityActions, collectionEditor: collectionEditorProp, navigationGroupMappings, basePath }) {
13
13
  const dispatch = useRebaseRegistryDispatch();
14
+ const embed = useRebaseEmbedHost();
15
+ const narrow = embed?.narrowCollections;
16
+ const collections = useMemo(() => narrow && collectionsProp ? narrowed(collectionsProp, narrow) : collectionsProp, [collectionsProp, narrow]);
17
+ const collectionEditor = embed ? void 0 : collectionEditorProp;
14
18
  useLayoutEffect(() => {
15
19
  dispatch.registerAdmin({
16
20
  collections,
@@ -38,6 +42,10 @@ function RebaseCMS({ collections, views, homePage, entityViews, collectionViews,
38
42
  ]);
39
43
  return null;
40
44
  }
45
+ function narrowed(collections, narrow) {
46
+ if (Array.isArray(collections)) return narrow(collections);
47
+ return async (params) => narrow(await collections(params));
48
+ }
41
49
  //#endregion
42
50
  export { RebaseCMS };
43
51
 
@@ -1 +1 @@
1
- {"version":3,"file":"RebaseCMS.js","names":[],"sources":["../../src/components/RebaseCMS.tsx"],"sourcesContent":["import React, { useLayoutEffect } from \"react\";\nimport { useRebaseRegistryDispatch } from \"@rebasepro/app\";\nimport type { RebaseCMSConfig } from \"@rebasepro/cms-types\";\n\n/**\n * Declarative component to configure the admin in Rebase.\n * Renders nothing — purely registers config into the RebaseRegistry.\n *\n * When `collectionEditor` is provided, the built-in visual schema editor\n * is auto-wired as a native feature (slots, provider, Studio view) without\n * needing any external plugin.\n */\nexport function RebaseCMS({ collections, views, homePage, entityViews, collectionViews, entityActions, collectionEditor, navigationGroupMappings, basePath }: RebaseCMSConfig) {\n const dispatch = useRebaseRegistryDispatch();\n\n useLayoutEffect(() => {\n dispatch.registerAdmin({ collections,\nviews,\nhomePage,\nentityViews,\ncollectionViews,\nentityActions,\ncollectionEditor,\nnavigationGroupMappings,\nbasePath });\n return () => dispatch.unregisterAdmin();\n }, [dispatch, collections, views, homePage, entityViews, collectionViews, entityActions, collectionEditor, navigationGroupMappings, basePath]);\n\n return null;\n}\n"],"mappings":";;;;;;;;;;;AAYA,SAAgB,UAAU,EAAE,aAAa,OAAO,UAAU,aAAa,iBAAiB,eAAe,kBAAkB,yBAAyB,YAA6B;CAC3K,MAAM,WAAW,0BAA0B;CAE3C,sBAAsB;EAClB,SAAS,cAAc;GAAE;GACjC;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EAAS,CAAC;EACF,aAAa,SAAS,gBAAgB;CAC1C,GAAG;EAAC;EAAU;EAAa;EAAO;EAAU;EAAa;EAAiB;EAAe;EAAkB;EAAyB;CAAQ,CAAC;CAE7I,OAAO;AACX"}
1
+ {"version":3,"file":"RebaseCMS.js","names":[],"sources":["../../src/components/RebaseCMS.tsx"],"sourcesContent":["import React, { useLayoutEffect, useMemo } from \"react\";\nimport { useRebaseEmbedHost, useRebaseRegistryDispatch } from \"@rebasepro/app\";\nimport type { AdminCollection, CollectionConfigsBuilder, RebaseCMSConfig } from \"@rebasepro/cms-types\";\n\n/**\n * Declarative component to configure the admin in Rebase.\n * Renders nothing — purely registers config into the RebaseRegistry.\n *\n * When `collectionEditor` is provided, the built-in visual schema editor\n * is auto-wired as a native feature (slots, provider, Studio view) without\n * needing any external plugin.\n */\nexport function RebaseCMS({ collections: collectionsProp, views, homePage, entityViews, collectionViews, entityActions, collectionEditor: collectionEditorProp, navigationGroupMappings, basePath }: RebaseCMSConfig) {\n const dispatch = useRebaseRegistryDispatch();\n\n // In an embedding (an MCP App view, `embed_host.ts`), the collections are\n // the app's own — custom fields, previews, views and actions included —\n // narrowed to what the person may see and do there; and the schema\n // editor, which writes the project's files, is not offered.\n const embed = useRebaseEmbedHost();\n const narrow = embed?.narrowCollections;\n const collections = useMemo(() => narrow && collectionsProp ? narrowed(collectionsProp, narrow) : collectionsProp,\n [collectionsProp, narrow]);\n const collectionEditor = embed ? undefined : collectionEditorProp;\n\n useLayoutEffect(() => {\n dispatch.registerAdmin({ collections,\nviews,\nhomePage,\nentityViews,\ncollectionViews,\nentityActions,\ncollectionEditor,\nnavigationGroupMappings,\nbasePath });\n return () => dispatch.unregisterAdmin();\n }, [dispatch, collections, views, homePage, entityViews, collectionViews, entityActions, collectionEditor, navigationGroupMappings, basePath]);\n\n return null;\n}\n\nfunction narrowed(\n collections: AdminCollection[] | CollectionConfigsBuilder,\n narrow: (collections: AdminCollection[]) => AdminCollection[]\n): AdminCollection[] | CollectionConfigsBuilder {\n if (Array.isArray(collections)) return narrow(collections);\n return async params => narrow(await collections(params));\n}\n"],"mappings":";;;;;;;;;;;AAYA,SAAgB,UAAU,EAAE,aAAa,iBAAiB,OAAO,UAAU,aAAa,iBAAiB,eAAe,kBAAkB,sBAAsB,yBAAyB,YAA6B;CAClN,MAAM,WAAW,0BAA0B;CAM3C,MAAM,QAAQ,mBAAmB;CACjC,MAAM,SAAS,OAAO;CACtB,MAAM,cAAc,cAAc,UAAU,kBAAkB,SAAS,iBAAiB,MAAM,IAAI,iBAC9F,CAAC,iBAAiB,MAAM,CAAC;CAC7B,MAAM,mBAAmB,QAAQ,KAAA,IAAY;CAE7C,sBAAsB;EAClB,SAAS,cAAc;GAAE;GACjC;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EAAS,CAAC;EACF,aAAa,SAAS,gBAAgB;CAC1C,GAAG;EAAC;EAAU;EAAa;EAAO;EAAU;EAAa;EAAiB;EAAe;EAAkB;EAAyB;CAAQ,CAAC;CAE7I,OAAO;AACX;AAEA,SAAS,SACL,aACA,QAC4C;CAC5C,IAAI,MAAM,QAAQ,WAAW,GAAG,OAAO,OAAO,WAAW;CACzD,OAAO,OAAM,WAAU,OAAO,MAAM,YAAY,MAAM,CAAC;AAC3D"}
@@ -15,7 +15,7 @@ import { Suspense, useCallback, useContext, useEffect, useMemo, useRef } from "r
15
15
  import { jsx, jsxs } from "react/jsx-runtime";
16
16
  import { CircularProgressCenter, lazyChunk } from "@rebasepro/ui";
17
17
  import { buildRoutedRebaseData, resolveDataSource } from "@rebasepro/common";
18
- import { CollectionResolverRegistrationContext, CustomizationControllerContext, RebaseDataContext, StudioBridgeRegistryProvider, useAdminModeController, useAuthController, useBridgeRegistration, useCustomizationController, useData, useDataSources, useRebaseClient, useRebaseContext, useRebaseRegistry, useUserConfigurationPersistence } from "@rebasepro/app";
18
+ import { CollectionResolverRegistrationContext, CustomizationControllerContext, RebaseDataContext, StudioBridgeRegistryProvider, useAdminModeController, useAuthController, useBridgeRegistration, useCustomizationController, useData, useDataSources, useRebaseClient, useRebaseContext, useRebaseEmbedHost, useRebaseRegistry, useUserConfigurationPersistence } from "@rebasepro/app";
19
19
  //#region src/components/RebaseNavigation.tsx
20
20
  var EMPTY_PLUGINS = [];
21
21
  var EMPTY_COLLECTIONS = [];
@@ -67,7 +67,7 @@ function RebaseNavigation({ children }) {
67
67
  sources: dataSources.sources,
68
68
  resolveKey: (slugOrPath) => resolveDataSource(getCollectionRef.current(slugOrPath), dataSources.registry).key
69
69
  }), [defaultData, dataSources]);
70
- const urlController = useBuildUrlController({
70
+ const builtUrlController = useBuildUrlController({
71
71
  basePath: useMemo(() => {
72
72
  const raw = registry.cmsConfig?.basePath;
73
73
  if (!raw || raw === "/") return "/";
@@ -77,6 +77,12 @@ function RebaseNavigation({ children }) {
77
77
  baseCollectionPath: "/c",
78
78
  collectionRegistryController
79
79
  });
80
+ const embedded = useRebaseEmbedHost() !== void 0;
81
+ const urlController = useMemo(() => embedded ? {
82
+ ...builtUrlController,
83
+ isUrlCollectionPath: () => false,
84
+ routesMounted: false
85
+ } : builtUrlController, [builtUrlController, embedded]);
80
86
  const rebaseClient = useRebaseClient();
81
87
  const authController = useAuthController();
82
88
  const resolvedCollections = useMemo(() => Array.isArray(cmsCollections) ? cmsCollections : [], [cmsCollections]);
@@ -135,7 +141,7 @@ function RebaseNavigation({ children }) {
135
141
  views: mergedViews,
136
142
  navigationGroupMappings: registry.cmsConfig?.navigationGroupMappings,
137
143
  authController: context.authController,
138
- data: routedData,
144
+ data: context.data,
139
145
  collectionRegistryController,
140
146
  urlController,
141
147
  adminMode: adminModeController?.mode
@@ -1 +1 @@
1
- {"version":3,"file":"RebaseNavigation.js","names":[],"sources":["../../src/components/RebaseNavigation.tsx"],"sourcesContent":["import React, { useMemo, useRef, useEffect, useCallback, useContext, Suspense } from \"react\";\nimport {\n useRebaseRegistry,\n useRebaseContext,\n useAuthController,\n useCustomizationController,\n useAdminModeController,\n useUserConfigurationPersistence,\n useRebaseClient,\n useData,\n useDataSources,\n CollectionResolverRegistrationContext,\n StudioBridgeRegistryProvider,\n useBridgeRegistration,\n CustomizationControllerContext,\n RebaseDataContext\n} from \"@rebasepro/app\";\nimport { buildRoutedRebaseData, resolveDataSource } from \"@rebasepro/common\";\nimport { CircularProgressCenter, lazyChunk } from \"@rebasepro/ui\";\n\nimport type { AppView, CollectionCustomView, CollectionEditorOptions, EntityCustomView, EntityAction, RebasePlugin, AdminCollection } from \"@rebasepro/cms-types\";\nimport type { CollectionRegistryController } from \"@rebasepro/types\";\nimport type { UrlController, NavigationStateController } from \"@rebasepro/cms-types\";\n\nconst EMPTY_PLUGINS: RebasePlugin[] = [];\nconst EMPTY_COLLECTIONS: AdminCollection[] = [];\n\nimport { useBuildNavigationStateController } from \"../hooks/navigation/useBuildNavigationStateController\";\nimport { useBuildUrlController } from \"../hooks/navigation/useBuildUrlController\";\nimport { useBuildCollectionRegistryController } from \"../hooks/navigation/useBuildCollectionRegistryController\";\n\nimport { CollectionRegistryContext } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { UrlContext } from \"../hooks/navigation/contexts/UrlContext\";\nimport { NavigationStateContext } from \"../hooks/navigation/contexts/NavigationStateContext\";\n\nimport { SidePanelProvider } from \"./SidePanelProvider\";\nimport { CollectionsScopeContext } from \"./CollectionsScopeContext\";\nimport { prefetchRecordViews } from \"./lazy_record_views\";\n\n// Collection editor internals — used when collectionEditor is enabled\nimport { useLocalCollectionsConfigController } from \"../collection_editor/useLocalCollectionsConfigController\";\nimport { ConfigControllerProvider } from \"../collection_editor/ConfigControllerProvider\";\nimport { useCollectionsConfigController } from \"../collection_editor/useCollectionsConfigController\";\nimport { callerHoldsScope, reportsScopes } from \"../util/caller_scopes\";\n\n// Lazy-load the schema view — only fetched when studio schema tool is active\nconst CollectionsStudioView = lazyChunk(() =>\n import(\"../collection_editor/ui/collection_editor/RouterCollectionsStudioView\")\n .then(m => ({ default: m.RouterCollectionsStudioView }))\n);\n\nexport interface RebaseNavigationProps {\n children: React.ReactNode;\n}\n\n/**\n * Navigation layer — builds and provides all admin navigation controllers:\n * collection registry, URL controller, navigation state, side entity,\n * and the self-assembling Studio bridge.\n *\n * Also handles the collection editor config controller when enabled.\n *\n * **Independently usable**: Use this when you need admin navigation\n * (entity tables, side panels) in a custom layout.\n *\n * @example\n * ```tsx\n * <RebaseNavigation>\n * <MyCustomLayout>\n * <CollectionViewBinding ... />\n * </MyCustomLayout>\n * </RebaseNavigation>\n * ```\n */\nexport function RebaseNavigation({ children }: RebaseNavigationProps) {\n const registry = useRebaseRegistry();\n // Mounted behind the auth gate: someone is signed in, so the collection\n // table and record views are about to be wanted. Fetch them while idle.\n useEffect(() => prefetchRecordViews(), []);\n const context = useRebaseContext();\n const adminModeController = useAdminModeController();\n // The store the rest of the panel reads. Built one level up, by\n // `<Rebase>`, so the registry here and the collection views below merge\n // from the same cache — a second instance built here would keep its own.\n const userConfigPersistence = useUserConfigurationPersistence();\n\n // ── Collection Editor resolution ──────────────────────────────────\n // The collection editor is ALWAYS enabled when Studio is registered.\n // The `collectionEditor` admin config is for fine-tuning (readOnly, auth, etc.),\n // not for opting-in. When omitted, the editor defaults to enabled\n // (read-only in production).\n const collectionEditorConfig = registry.cmsConfig?.collectionEditor;\n const collectionEditorEnabled = Boolean(collectionEditorConfig) || Boolean(registry.studioConfig);\n const collectionEditorOptions: CollectionEditorOptions | undefined = useMemo(() => {\n if (collectionEditorConfig === true || !collectionEditorConfig) return {};\n return collectionEditorConfig;\n }, [collectionEditorConfig]);\n\n // ── Combine admin and Studio Configs ────────────────────────────────\n const cmsCollections = registry.cmsConfig?.collections ?? EMPTY_COLLECTIONS;\n\n // ── Build the navigation controllers ──────────────────────────────\n const collectionsBuilder = useMemo(() => Array.isArray(cmsCollections) ? () => [...cmsCollections] : cmsCollections, [cmsCollections]);\n\n const dataSources = useDataSources();\n const collectionRegistryController = useBuildCollectionRegistryController({ userConfigPersistence, dataSources: dataSources.registry });\n\n // ── Multi-data-source routing ─────────────────────────────────────\n // Combine the default data source (server transport) with the registered\n // direct/custom sources from <Rebase> and route each collection by its\n // resolved data-source key, looked up by path against the collection\n // registry. A stable resolver ref keeps the routed data instance\n // referentially stable across registry rebuilds, so data-effect\n // dependencies don't thrash.\n const defaultData = useData();\n const getCollectionRef = useRef(collectionRegistryController.getCollection);\n getCollectionRef.current = collectionRegistryController.getCollection;\n\n // Hand the data layer a way to read this registry. It was built by <Rebase>,\n // above us, and needs a collection's primary keys to give its rows an\n // address — rows themselves carry only columns.\n //\n // Registered during render, not in an effect: the views that fetch rows are\n // below us, and their effects run before ours, so an effect here would bind\n // after the first page had already been converted. The call only assigns a\n // ref, so repeating it per render is free.\n //\n // With it goes where each collection is stored: a direct driver has to be\n // handed the `path` a Firestore collection declares, not its slug.\n const registerCollectionResolver = useContext(CollectionResolverRegistrationContext);\n const resolveCollection = useCallback(\n (slug: string) => getCollectionRef.current(slug),\n []);\n registerCollectionResolver(resolveCollection, collectionRegistryController.resolveDataPath);\n const routedData = useMemo(() => buildRoutedRebaseData({\n defaultData,\n sources: dataSources.sources,\n resolveKey: (slugOrPath) => resolveDataSource(getCollectionRef.current(slugOrPath), dataSources.registry).key\n }), [defaultData, dataSources]);\n\n // Normalize the configured mount prefix to a leading-slash, no-trailing-slash\n // form (e.g. \"admin\" or \"/admin/\" -> \"/admin\"); empty/\"/\" stays \"/\".\n const basePath = useMemo(() => {\n const raw = registry.cmsConfig?.basePath;\n if (!raw || raw === \"/\") return \"/\";\n const trimmed = raw.replace(/^\\/+/, \"\").replace(/\\/+$/, \"\");\n return trimmed ? `/${trimmed}` : \"/\";\n }, [registry.cmsConfig?.basePath]);\n\n const urlController = useBuildUrlController({\n basePath,\n baseCollectionPath: \"/c\",\n collectionRegistryController\n });\n\n // ── Build config controller internally when collection editor is enabled ──\n const rebaseClient = useRebaseClient();\n const authController = useAuthController();\n const resolvedCollections = useMemo(\n () => Array.isArray(cmsCollections) ? cmsCollections : [],\n [cmsCollections]\n );\n\n // ── Dev-only data-source sanity check ─────────────────────────────\n // Warn about data sources declared with a direct/custom transport that\n // have no client-side driver — these silently fall back to the default\n // (server) source, a common source of misrouting. Unambiguous: it never\n // false-positives on server-mediated sources (which intentionally have\n // no client driver).\n useEffect(() => {\n if (process.env.NODE_ENV === \"production\") return;\n const { registry, sources } = dataSources;\n const missing = Object.values(registry)\n .filter((d) => (d.transport === \"direct\" || d.transport === \"custom\") && !sources[d.key])\n .map((d) => d.key);\n if (missing.length > 0) {\n console.warn(\n `[Rebase] These data source(s) declare a direct/custom transport but have no client-side driver and will fall back to the default data source: ${missing.map(k => `\"${k}\"`).join(\", \")}. ` +\n `Provide a \\`driver\\` for them in \\`dataSources\\` on <Rebase>.`\n );\n }\n }, [dataSources]);\n\n // `readOnly` is left undefined unless the developer set it: the controller\n // asks the backend whether its schema editor will accept a write, which is\n // the only process that knows. Deciding it here from `process.env.NODE_ENV`\n // — the *frontend bundle's* build mode — is what made the editor offer\n // itself against production backends, `baas` projects and servers without\n // `ts-morph`, and turned every save into a bare 404.\n //\n // Both of its status routes require `schema:read`. Asked by someone\n // without it, each answers 403 on every page load. So when the controller\n // reports scopes, it is not asked until they include that one. A\n // controller that does not report them leaves the backend to answer.\n const internalConfigController = useLocalCollectionsConfigController(\n rebaseClient,\n resolvedCollections,\n collectionEditorEnabled ? {\n readOnly: collectionEditorOptions?.readOnly,\n getAuthToken: collectionEditorOptions?.getAuthToken ?? authController?.getAuthToken,\n authKey: authController?.user?.uid ?? null,\n mayReadSchema: reportsScopes(authController)\n ? callerHoldsScope(authController, \"schema:read\")\n : undefined\n } : { readOnly: true }\n );\n\n // ── Auto-inject schema view into Studio devViews ──────────────────\n const schemaView: AppView | undefined = useMemo(() => {\n if (!collectionEditorEnabled) return undefined;\n // Only inject when Studio is registered and includes \"schema\" tool (or all tools)\n const studioTools = registry.studioConfig?.tools ?? [\"sql\", \"js\", \"rls\", \"schema\", \"storage\"];\n if (!registry.studioConfig || !studioTools.includes(\"schema\")) return undefined;\n return {\n slug: \"schema\",\n name: \"Edit collections\",\n group: \"Database\",\n icon: \"LayoutList\",\n nestedRoutes: true,\n // Reads the controller from context at render time rather than\n // capturing it here. A view is a React *element*, and the\n // navigation state controller resolves the view list once and holds\n // on to the elements it resolved — so a controller passed as a prop\n // is frozen at whatever it was on the first render, forever. That\n // hid every later change: the editor stayed writable after the\n // backend said it was read-only, and the collection list never\n // refreshed. Everything else in the editor already reads this from\n // `ConfigControllerProvider`, which wraps this subtree.\n view: (\n <Suspense fallback={<CircularProgressCenter/>}>\n <CollectionsStudioViewFromContext/>\n </Suspense>\n )\n };\n }, [collectionEditorEnabled, registry.studioConfig]);\n\n const devViews = useMemo(() => {\n const base = registry.studioConfig?.devViews ?? [];\n if (schemaView) return [...base, schemaView];\n return base;\n }, [registry.studioConfig?.devViews, schemaView]);\n\n // Merge admin-registered views with Studio dev views.\n // Order: admin views (developer's primary content) → Studio dev views (tooling).\n // Plugin views are merged later inside resolveAppViews.\n const cmsViews = registry.cmsConfig?.views;\n const mergedViews = useMemo(() => {\n if (!cmsViews) return devViews;\n if (Array.isArray(cmsViews) && cmsViews.length === 0) return devViews;\n // When cmsViews is a builder function, wrap it to append devViews after resolution\n if (typeof cmsViews === \"function\") {\n return async (params: Parameters<typeof cmsViews>[0]) => {\n const resolved = await cmsViews(params) ?? [];\n return [...resolved, ...devViews];\n };\n }\n return [...cmsViews, ...devViews];\n }, [cmsViews, devViews]);\n\n const parentCustomizationController = useCustomizationController();\n\n const navigationStateController = useBuildNavigationStateController({\n plugins: parentCustomizationController.plugins ?? EMPTY_PLUGINS,\n collections: collectionsBuilder,\n views: mergedViews,\n navigationGroupMappings: registry.cmsConfig?.navigationGroupMappings,\n authController: context.authController!,\n data: routedData,\n collectionRegistryController,\n urlController,\n adminMode: adminModeController?.mode\n });\n\n // ── Merge admin-registered entityViews/entityActions into the customization controller ──\n // The <Rebase> component builds the customizationController from its own props,\n // but entity views passed to <RebaseCMS> are stored in the registry and not\n // automatically merged. We re-provide an enriched controller here so that\n // downstream consumers (EditViewBinding, side panels, etc.) can resolve\n // string-keyed entity views like \"blog_preview\".\n const enrichedCustomizationController = useMemo(() => {\n const cmsEntityViews = (registry.cmsConfig?.entityViews ?? []) as EntityCustomView[];\n const cmsEntityActions = (registry.cmsConfig?.entityActions ?? []) as EntityAction[];\n // Collection view modes ride the same channel, for the same reason:\n // `admin.customViews: [\"map\"]` has to find the component somewhere.\n const cmsCollectionViews = (registry.cmsConfig?.collectionViews ?? []) as CollectionCustomView[];\n if (cmsEntityViews.length === 0 && cmsEntityActions.length === 0 && cmsCollectionViews.length === 0) {\n return parentCustomizationController;\n }\n return {\n ...parentCustomizationController,\n entityViews: [\n ...(parentCustomizationController.entityViews ?? []),\n ...cmsEntityViews.filter(v => !(parentCustomizationController.entityViews ?? []).some(ev => ev.key === v.key))\n ],\n entityActions: [\n ...(parentCustomizationController.entityActions ?? []),\n ...cmsEntityActions.filter(a => !(parentCustomizationController.entityActions ?? []).some(ea => ea.key === a.key))\n ],\n collectionViews: [\n ...(parentCustomizationController.collectionViews ?? []),\n ...cmsCollectionViews.filter(v => !(parentCustomizationController.collectionViews ?? []).some(cv => cv.key === v.key))\n ]\n };\n }, [parentCustomizationController, registry.cmsConfig?.entityViews, registry.cmsConfig?.entityActions, registry.cmsConfig?.collectionViews]);\n\n // ── Inner content with all context providers ──────────────────────\n // Re-provide RebaseDataContext with the routed data so that every admin\n // consumer (list/entity views, references, board, import/export, and\n // `context.data`) is routed to the correct driver by collection path.\n const navigationContent = (\n <CollectionsScopeContext.Provider value={true}>\n <RebaseDataContext.Provider value={routedData}>\n <CustomizationControllerContext.Provider value={enrichedCustomizationController}>\n <StudioBridgeRegistryProvider>\n <CollectionRegistryContext.Provider value={collectionRegistryController}>\n <UrlContext.Provider value={urlController}>\n <NavigationStateContext.Provider value={navigationStateController}>\n <SidePanelProvider>\n <BridgeAutoRegistrar\n collectionRegistryController={collectionRegistryController}\n urlController={urlController}\n navigationStateController={navigationStateController}\n canWriteToCodebase={!internalConfigController.readOnly}\n />\n {children}\n </SidePanelProvider>\n </NavigationStateContext.Provider>\n </UrlContext.Provider>\n </CollectionRegistryContext.Provider>\n </StudioBridgeRegistryProvider>\n </CustomizationControllerContext.Provider>\n </RebaseDataContext.Provider>\n </CollectionsScopeContext.Provider>\n );\n\n // ── Wrap with ConfigControllerProvider when collection editor is enabled ──\n if (collectionEditorEnabled) {\n return (\n <ConfigControllerProvider\n collectionConfigController={internalConfigController}\n pathSuggestions={collectionEditorOptions?.pathSuggestions}\n >\n {navigationContent}\n </ConfigControllerProvider>\n );\n }\n\n return navigationContent;\n}\n\n/**\n * The injected \"Edit collections\" view, bound to the live config controller.\n *\n * Exists so the element stored in the navigation state does not close over a\n * controller instance — see the comment at its construction site.\n */\nfunction CollectionsStudioViewFromContext() {\n const configController = useCollectionsConfigController();\n return <CollectionsStudioView configController={configController}/>;\n}\n\n/**\n * Internal component that auto-registers admin controllers into the\n * self-assembling Studio bridge. Must be rendered inside both the\n * navigation contexts and the StudioBridgeRegistryProvider.\n */\nfunction BridgeAutoRegistrar({\n collectionRegistryController,\n urlController,\n navigationStateController,\n canWriteToCodebase\n}: {\n collectionRegistryController: CollectionRegistryController;\n urlController: UrlController;\n navigationStateController: NavigationStateController;\n canWriteToCodebase: boolean;\n}) {\n useBridgeRegistration(\"collectionRegistry\", collectionRegistryController);\n useBridgeRegistration(\"urlController\", urlController);\n useBridgeRegistration(\"navigationState\", navigationStateController);\n\n // Studio tools that would write into the project's collection source — the\n // RLS editor's policy save for a mapped table, its \"Import to codebase\" —\n // ask the bridge whether that write can land. The default is `true`, which\n // is what an admin panel sitting next to its own `collectionsDir` assumes;\n // it is wrong for exactly the same backends that make the collection editor\n // read-only, so the two now answer from one source.\n const capabilities = useMemo(() => ({ cod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,CAAA;EACb,CAAA;CACM,CAAA;CAItC,IAAI,yBACA,OACI,oBAAC,0BAAD;EACI,4BAA4B;EAC5B,iBAAiB,yBAAyB;YAEzC;CACqB,CAAA;CAIlC,OAAO;AACX;;;;;;;AAQA,SAAS,mCAAmC;CAExC,OAAO,oBAAC,uBAAD,EAAyC,kBADvB,+BACuB,EAAkB,CAAA;AACtE;;;;;;AAOA,SAAS,oBAAoB,EACzB,8BACA,eACA,2BACA,sBAMD;CACC,sBAAsB,sBAAsB,4BAA4B;CACxE,sBAAsB,iBAAiB,aAAa;CACpD,sBAAsB,mBAAmB,yBAAyB;CASlE,sBAAsB,gBADD,eAAe,EAAE,UAAU,mBAAmB,IAAI,CAAC,kBAAkB,CACpD,CAAY;CAClD,OAAO;AACX"}
1
+ {"version":3,"file":"RebaseNavigation.js","names":[],"sources":["../../src/components/RebaseNavigation.tsx"],"sourcesContent":["import React, { useMemo, useRef, useEffect, useCallback, useContext, Suspense } from \"react\";\nimport {\n useRebaseRegistry,\n useRebaseContext,\n useAuthController,\n useCustomizationController,\n useAdminModeController,\n useUserConfigurationPersistence,\n useRebaseClient,\n useData,\n useDataSources,\n CollectionResolverRegistrationContext,\n StudioBridgeRegistryProvider,\n useBridgeRegistration,\n CustomizationControllerContext,\n RebaseDataContext,\n useRebaseEmbedHost\n} from \"@rebasepro/app\";\nimport { buildRoutedRebaseData, resolveDataSource } from \"@rebasepro/common\";\nimport { CircularProgressCenter, lazyChunk } from \"@rebasepro/ui\";\n\nimport type { AppView, CollectionCustomView, CollectionEditorOptions, EntityCustomView, EntityAction, RebasePlugin, AdminCollection } from \"@rebasepro/cms-types\";\nimport type { CollectionRegistryController } from \"@rebasepro/types\";\nimport type { UrlController, NavigationStateController } from \"@rebasepro/cms-types\";\n\nconst EMPTY_PLUGINS: RebasePlugin[] = [];\nconst EMPTY_COLLECTIONS: AdminCollection[] = [];\n\nimport { useBuildNavigationStateController } from \"../hooks/navigation/useBuildNavigationStateController\";\nimport { useBuildUrlController } from \"../hooks/navigation/useBuildUrlController\";\nimport { useBuildCollectionRegistryController } from \"../hooks/navigation/useBuildCollectionRegistryController\";\n\nimport { CollectionRegistryContext } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { UrlContext } from \"../hooks/navigation/contexts/UrlContext\";\nimport { NavigationStateContext } from \"../hooks/navigation/contexts/NavigationStateContext\";\n\nimport { SidePanelProvider } from \"./SidePanelProvider\";\nimport { CollectionsScopeContext } from \"./CollectionsScopeContext\";\nimport { prefetchRecordViews } from \"./lazy_record_views\";\n\n// Collection editor internals — used when collectionEditor is enabled\nimport { useLocalCollectionsConfigController } from \"../collection_editor/useLocalCollectionsConfigController\";\nimport { ConfigControllerProvider } from \"../collection_editor/ConfigControllerProvider\";\nimport { useCollectionsConfigController } from \"../collection_editor/useCollectionsConfigController\";\nimport { callerHoldsScope, reportsScopes } from \"../util/caller_scopes\";\n\n// Lazy-load the schema view — only fetched when studio schema tool is active\nconst CollectionsStudioView = lazyChunk(() =>\n import(\"../collection_editor/ui/collection_editor/RouterCollectionsStudioView\")\n .then(m => ({ default: m.RouterCollectionsStudioView }))\n);\n\nexport interface RebaseNavigationProps {\n children: React.ReactNode;\n}\n\n/**\n * Navigation layer — builds and provides all admin navigation controllers:\n * collection registry, URL controller, navigation state, side entity,\n * and the self-assembling Studio bridge.\n *\n * Also handles the collection editor config controller when enabled.\n *\n * **Independently usable**: Use this when you need admin navigation\n * (entity tables, side panels) in a custom layout.\n *\n * @example\n * ```tsx\n * <RebaseNavigation>\n * <MyCustomLayout>\n * <CollectionViewBinding ... />\n * </MyCustomLayout>\n * </RebaseNavigation>\n * ```\n */\nexport function RebaseNavigation({ children }: RebaseNavigationProps) {\n const registry = useRebaseRegistry();\n // Mounted behind the auth gate: someone is signed in, so the collection\n // table and record views are about to be wanted. Fetch them while idle.\n useEffect(() => prefetchRecordViews(), []);\n const context = useRebaseContext();\n const adminModeController = useAdminModeController();\n // The store the rest of the panel reads. Built one level up, by\n // `<Rebase>`, so the registry here and the collection views below merge\n // from the same cache — a second instance built here would keep its own.\n const userConfigPersistence = useUserConfigurationPersistence();\n\n // ── Collection Editor resolution ──────────────────────────────────\n // The collection editor is ALWAYS enabled when Studio is registered.\n // The `collectionEditor` admin config is for fine-tuning (readOnly, auth, etc.),\n // not for opting-in. When omitted, the editor defaults to enabled\n // (read-only in production).\n const collectionEditorConfig = registry.cmsConfig?.collectionEditor;\n const collectionEditorEnabled = Boolean(collectionEditorConfig) || Boolean(registry.studioConfig);\n const collectionEditorOptions: CollectionEditorOptions | undefined = useMemo(() => {\n if (collectionEditorConfig === true || !collectionEditorConfig) return {};\n return collectionEditorConfig;\n }, [collectionEditorConfig]);\n\n // ── Combine admin and Studio Configs ────────────────────────────────\n const cmsCollections = registry.cmsConfig?.collections ?? EMPTY_COLLECTIONS;\n\n // ── Build the navigation controllers ──────────────────────────────\n const collectionsBuilder = useMemo(() => Array.isArray(cmsCollections) ? () => [...cmsCollections] : cmsCollections, [cmsCollections]);\n\n const dataSources = useDataSources();\n const collectionRegistryController = useBuildCollectionRegistryController({ userConfigPersistence, dataSources: dataSources.registry });\n\n // ── Multi-data-source routing ─────────────────────────────────────\n // Combine the default data source (server transport) with the registered\n // direct/custom sources from <Rebase> and route each collection by its\n // resolved data-source key, looked up by path against the collection\n // registry. A stable resolver ref keeps the routed data instance\n // referentially stable across registry rebuilds, so data-effect\n // dependencies don't thrash.\n const defaultData = useData();\n const getCollectionRef = useRef(collectionRegistryController.getCollection);\n getCollectionRef.current = collectionRegistryController.getCollection;\n\n // Hand the data layer a way to read this registry. It was built by <Rebase>,\n // above us, and needs a collection's primary keys to give its rows an\n // address — rows themselves carry only columns.\n //\n // Registered during render, not in an effect: the views that fetch rows are\n // below us, and their effects run before ours, so an effect here would bind\n // after the first page had already been converted. The call only assigns a\n // ref, so repeating it per render is free.\n //\n // With it goes where each collection is stored: a direct driver has to be\n // handed the `path` a Firestore collection declares, not its slug.\n const registerCollectionResolver = useContext(CollectionResolverRegistrationContext);\n const resolveCollection = useCallback(\n (slug: string) => getCollectionRef.current(slug),\n []);\n registerCollectionResolver(resolveCollection, collectionRegistryController.resolveDataPath);\n const routedData = useMemo(() => buildRoutedRebaseData({\n defaultData,\n sources: dataSources.sources,\n resolveKey: (slugOrPath) => resolveDataSource(getCollectionRef.current(slugOrPath), dataSources.registry).key\n }), [defaultData, dataSources]);\n\n // Normalize the configured mount prefix to a leading-slash, no-trailing-slash\n // form (e.g. \"admin\" or \"/admin/\" -> \"/admin\"); empty/\"/\" stays \"/\".\n const basePath = useMemo(() => {\n const raw = registry.cmsConfig?.basePath;\n if (!raw || raw === \"/\") return \"/\";\n const trimmed = raw.replace(/^\\/+/, \"\").replace(/\\/+$/, \"\");\n return trimmed ? `/${trimmed}` : \"/\";\n }, [registry.cmsConfig?.basePath]);\n\n const builtUrlController = useBuildUrlController({\n basePath,\n baseCollectionPath: \"/c\",\n collectionRegistryController\n });\n // In an embedding (an MCP App view) no route draws a record's page: a\n // record opens over the screen, as it does under a CollectionsProvider.\n const embedded = useRebaseEmbedHost() !== undefined;\n const urlController = useMemo<UrlController>(() => embedded ? {\n ...builtUrlController,\n isUrlCollectionPath: () => false,\n routesMounted: false\n } : builtUrlController, [builtUrlController, embedded]);\n\n // ── Build config controller internally when collection editor is enabled ──\n const rebaseClient = useRebaseClient();\n const authController = useAuthController();\n const resolvedCollections = useMemo(\n () => Array.isArray(cmsCollections) ? cmsCollections : [],\n [cmsCollections]\n );\n\n // ── Dev-only data-source sanity check ─────────────────────────────\n // Warn about data sources declared with a direct/custom transport that\n // have no client-side driver — these silently fall back to the default\n // (server) source, a common source of misrouting. Unambiguous: it never\n // false-positives on server-mediated sources (which intentionally have\n // no client driver).\n useEffect(() => {\n if (process.env.NODE_ENV === \"production\") return;\n const { registry, sources } = dataSources;\n const missing = Object.values(registry)\n .filter((d) => (d.transport === \"direct\" || d.transport === \"custom\") && !sources[d.key])\n .map((d) => d.key);\n if (missing.length > 0) {\n console.warn(\n `[Rebase] These data source(s) declare a direct/custom transport but have no client-side driver and will fall back to the default data source: ${missing.map(k => `\"${k}\"`).join(\", \")}. ` +\n `Provide a \\`driver\\` for them in \\`dataSources\\` on <Rebase>.`\n );\n }\n }, [dataSources]);\n\n // `readOnly` is left undefined unless the developer set it: the controller\n // asks the backend whether its schema editor will accept a write, which is\n // the only process that knows. Deciding it here from `process.env.NODE_ENV`\n // — the *frontend bundle's* build mode — is what made the editor offer\n // itself against production backends, `baas` projects and servers without\n // `ts-morph`, and turned every save into a bare 404.\n //\n // Both of its status routes require `schema:read`. Asked by someone\n // without it, each answers 403 on every page load. So when the controller\n // reports scopes, it is not asked until they include that one. A\n // controller that does not report them leaves the backend to answer.\n const internalConfigController = useLocalCollectionsConfigController(\n rebaseClient,\n resolvedCollections,\n collectionEditorEnabled ? {\n readOnly: collectionEditorOptions?.readOnly,\n getAuthToken: collectionEditorOptions?.getAuthToken ?? authController?.getAuthToken,\n authKey: authController?.user?.uid ?? null,\n mayReadSchema: reportsScopes(authController)\n ? callerHoldsScope(authController, \"schema:read\")\n : undefined\n } : { readOnly: true }\n );\n\n // ── Auto-inject schema view into Studio devViews ──────────────────\n const schemaView: AppView | undefined = useMemo(() => {\n if (!collectionEditorEnabled) return undefined;\n // Only inject when Studio is registered and includes \"schema\" tool (or all tools)\n const studioTools = registry.studioConfig?.tools ?? [\"sql\", \"js\", \"rls\", \"schema\", \"storage\"];\n if (!registry.studioConfig || !studioTools.includes(\"schema\")) return undefined;\n return {\n slug: \"schema\",\n name: \"Edit collections\",\n group: \"Database\",\n icon: \"LayoutList\",\n nestedRoutes: true,\n // Reads the controller from context at render time rather than\n // capturing it here. A view is a React *element*, and the\n // navigation state controller resolves the view list once and holds\n // on to the elements it resolved — so a controller passed as a prop\n // is frozen at whatever it was on the first render, forever. That\n // hid every later change: the editor stayed writable after the\n // backend said it was read-only, and the collection list never\n // refreshed. Everything else in the editor already reads this from\n // `ConfigControllerProvider`, which wraps this subtree.\n view: (\n <Suspense fallback={<CircularProgressCenter/>}>\n <CollectionsStudioViewFromContext/>\n </Suspense>\n )\n };\n }, [collectionEditorEnabled, registry.studioConfig]);\n\n const devViews = useMemo(() => {\n const base = registry.studioConfig?.devViews ?? [];\n if (schemaView) return [...base, schemaView];\n return base;\n }, [registry.studioConfig?.devViews, schemaView]);\n\n // Merge admin-registered views with Studio dev views.\n // Order: admin views (developer's primary content) → Studio dev views (tooling).\n // Plugin views are merged later inside resolveAppViews.\n const cmsViews = registry.cmsConfig?.views;\n const mergedViews = useMemo(() => {\n if (!cmsViews) return devViews;\n if (Array.isArray(cmsViews) && cmsViews.length === 0) return devViews;\n // When cmsViews is a builder function, wrap it to append devViews after resolution\n if (typeof cmsViews === \"function\") {\n return async (params: Parameters<typeof cmsViews>[0]) => {\n const resolved = await cmsViews(params) ?? [];\n return [...resolved, ...devViews];\n };\n }\n return [...cmsViews, ...devViews];\n }, [cmsViews, devViews]);\n\n const parentCustomizationController = useCustomizationController();\n\n const navigationStateController = useBuildNavigationStateController({\n plugins: parentCustomizationController.plugins ?? EMPTY_PLUGINS,\n collections: collectionsBuilder,\n views: mergedViews,\n navigationGroupMappings: registry.cmsConfig?.navigationGroupMappings,\n authController: context.authController!,\n // The collection and view builders get the rows the server sends.\n data: context.data,\n collectionRegistryController,\n urlController,\n adminMode: adminModeController?.mode\n });\n\n // ── Merge admin-registered entityViews/entityActions into the customization controller ──\n // The <Rebase> component builds the customizationController from its own props,\n // but entity views passed to <RebaseCMS> are stored in the registry and not\n // automatically merged. We re-provide an enriched controller here so that\n // downstream consumers (EditViewBinding, side panels, etc.) can resolve\n // string-keyed entity views like \"blog_preview\".\n const enrichedCustomizationController = useMemo(() => {\n const cmsEntityViews = (registry.cmsConfig?.entityViews ?? []) as EntityCustomView[];\n const cmsEntityActions = (registry.cmsConfig?.entityActions ?? []) as EntityAction[];\n // Collection view modes ride the same channel, for the same reason:\n // `admin.customViews: [\"map\"]` has to find the component somewhere.\n const cmsCollectionViews = (registry.cmsConfig?.collectionViews ?? []) as CollectionCustomView[];\n if (cmsEntityViews.length === 0 && cmsEntityActions.length === 0 && cmsCollectionViews.length === 0) {\n return parentCustomizationController;\n }\n return {\n ...parentCustomizationController,\n entityViews: [\n ...(parentCustomizationController.entityViews ?? []),\n ...cmsEntityViews.filter(v => !(parentCustomizationController.entityViews ?? []).some(ev => ev.key === v.key))\n ],\n entityActions: [\n ...(parentCustomizationController.entityActions ?? []),\n ...cmsEntityActions.filter(a => !(parentCustomizationController.entityActions ?? []).some(ea => ea.key === a.key))\n ],\n collectionViews: [\n ...(parentCustomizationController.collectionViews ?? []),\n ...cmsCollectionViews.filter(v => !(parentCustomizationController.collectionViews ?? []).some(cv => cv.key === v.key))\n ]\n };\n }, [parentCustomizationController, registry.cmsConfig?.entityViews, registry.cmsConfig?.entityActions, registry.cmsConfig?.collectionViews]);\n\n // ── Inner content with all context providers ──────────────────────\n // Re-provide RebaseDataContext with the routed data so that every admin\n // consumer (list/entity views, references, board, import/export, and\n // `context.data`) is routed to the correct driver by collection path.\n const navigationContent = (\n <CollectionsScopeContext.Provider value={true}>\n <RebaseDataContext.Provider value={routedData}>\n <CustomizationControllerContext.Provider value={enrichedCustomizationController}>\n <StudioBridgeRegistryProvider>\n <CollectionRegistryContext.Provider value={collectionRegistryController}>\n <UrlContext.Provider value={urlController}>\n <NavigationStateContext.Provider value={navigationStateController}>\n <SidePanelProvider>\n <BridgeAutoRegistrar\n collectionRegistryController={collectionRegistryController}\n urlController={urlController}\n navigationStateController={navigationStateController}\n canWriteToCodebase={!internalConfigController.readOnly}\n />\n {children}\n </SidePanelProvider>\n </NavigationStateContext.Provider>\n </UrlContext.Provider>\n </CollectionRegistryContext.Provider>\n </StudioBridgeRegistryProvider>\n </CustomizationControllerContext.Provider>\n </RebaseDataContext.Provider>\n </CollectionsScopeContext.Provider>\n );\n\n // ── Wrap with ConfigControllerProvider when collection editor is enabled ──\n if (collectionEditorEnabled) {\n return (\n <ConfigControllerProvider\n collectionConfigController={internalConfigController}\n pathSuggestions={collectionEditorOptions?.pathSuggestions}\n >\n {navigationContent}\n </ConfigControllerProvider>\n );\n }\n\n return navigationContent;\n}\n\n/**\n * The injected \"Edit collections\" view, bound to the live config controller.\n *\n * Exists so the element stored in the navigation state does not close over a\n * controller instance — see the comment at its construction site.\n */\nfunction CollectionsStudioViewFromContext() {\n const configController = useCollectionsConfigController();\n return <CollectionsStudioView configController={configController}/>;\n}\n\n/**\n * Internal component that auto-registers admin controllers into the\n * self-assembling Studio bridge. Must be rendered inside both the\n * navigation contexts and the StudioBridgeRegistryProvider.\n */\nfunction BridgeAutoRegistrar({\n collectionRegistryController,\n urlController,\n navigationStateController,\n canWriteToCodebase\n}: {\n collectionRegistryController: CollectionRegistryController;\n urlController: UrlController;\n navigationStateController: NavigationStateController;\n canWriteToCodebase: boolean;\n}) {\n useBridgeRegistration(\"collectionRegistry\", collectionRegistryController);\n useBridgeRegistration(\"urlController\", urlController);\n useBridgeRegistration(\"navigationState\", navigationStateController);\n\n // Studio tools that would write into the project's collection source — the\n // RLS editor's policy save for a mapped table, its \"Import to codebase\" —\n // ask the bridge whether that write can land. The default is `true`, which\n // is what an admin panel sitting next to its own `collectionsDir` assumes;\n // it is wrong for exactly the same backends that make the collection editor\n // read-only, so the two now answer from one source.\n const capabilities = useMemo(() => ({ codebase: canWriteToCodebase }), [canWriteToCodebase]);\n useBridgeRegistration(\"capabilities\", capabilities);\n return null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyBA,IAAM,gBAAgC,CAAC;AACvC,IAAM,oBAAuC,CAAC;AAqB9C,IAAM,wBAAwB,gBAC1B,OAAO,2EAAwE,CAC1E,MAAK,OAAM,EAAE,SAAS,EAAE,4BAA4B,EAAE,CAC/D;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,iBAAiB,EAAE,YAAmC;CAClE,MAAM,WAAW,kBAAkB;CAGnC,gBAAgB,oBAAoB,GAAG,CAAC,CAAC;CACzC,MAAM,UAAU,iBAAiB;CACj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AS,oBAAoB,EACzB,8BACA,eACA,2BACA,sBAMD;CACC,sBAAsB,sBAAsB,4BAA4B;CACxE,sBAAsB,iBAAiB,aAAa;CACpD,sBAAsB,mBAAmB,yBAAyB;CASlE,sBAAsB,gBADD,eAAe,EAAE,UAAU,mBAAmB,IAAI,CAAC,kBAAkB,CACpD,CAAY;CAClD,OAAO;AACX"}
@@ -1,11 +1,13 @@
1
+ import { SideDialogs } from "./SideDialogs.js";
1
2
  import { RebaseAuthGate } from "./RebaseAuthGate.js";
2
3
  import { RebaseNavigation } from "./RebaseNavigation.js";
3
4
  import { RebaseLayout } from "./RebaseLayout.js";
4
5
  import { RebaseRouteDefs } from "./RebaseRouteDefs.js";
5
6
  import { useMemo } from "react";
6
- import { jsx } from "react/jsx-runtime";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
7
8
  import { ErrorBoundary } from "@rebasepro/ui";
8
- import { useRebaseRegistry } from "@rebasepro/app";
9
+ import { useRebaseEmbedHost, useRebaseRegistry } from "@rebasepro/app";
10
+ import { MemoryRouter } from "react-router";
9
11
  //#region src/components/RebaseShell.tsx
10
12
  /**
11
13
  * Convenience component that composes all four admin layers:
@@ -26,6 +28,11 @@ import { useRebaseRegistry } from "@rebasepro/app";
26
28
  function RebaseShell(props) {
27
29
  const { title = "Rebase", appBar, drawer, autoOpenDrawer = true, defaultDrawerOpen = false, logo, children } = props;
28
30
  const registry = useRebaseRegistry();
31
+ const embed = useRebaseEmbedHost();
32
+ const devViews = useMemo(() => {
33
+ return registry.studioConfig?.devViews ?? [];
34
+ }, [registry.studioConfig?.devViews]);
35
+ if (embed) return /* @__PURE__ */ jsx(MemoryRouter, { children: /* @__PURE__ */ jsxs(RebaseNavigation, { children: [/* @__PURE__ */ jsx(ErrorBoundary, { children: embed.renderCms() }), /* @__PURE__ */ jsx(SideDialogs, {})] }) });
29
36
  return /* @__PURE__ */ jsx(RebaseAuthGate, { children: /* @__PURE__ */ jsx(RebaseNavigation, { children: /* @__PURE__ */ jsx(ErrorBoundary, {
30
37
  fullPage: true,
31
38
  children: /* @__PURE__ */ jsx(RebaseRouteDefs, {
@@ -36,9 +43,7 @@ function RebaseShell(props) {
36
43
  autoOpenDrawer,
37
44
  defaultDrawerOpen,
38
45
  logo,
39
- devViews: useMemo(() => {
40
- return registry.studioConfig?.devViews ?? [];
41
- }, [registry.studioConfig?.devViews])
46
+ devViews
42
47
  }),
43
48
  children
44
49
  })
@@ -1 +1 @@
1
- {"version":3,"file":"RebaseShell.js","names":[],"sources":["../../src/components/RebaseShell.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport {\n useRebaseRegistry\n} from \"@rebasepro/app\";\nimport { ErrorBoundary } from \"@rebasepro/ui\";\n\nimport { RebaseAuthGate } from \"./RebaseAuthGate\";\nimport { RebaseNavigation } from \"./RebaseNavigation\";\nimport { RebaseLayout } from \"./RebaseLayout\";\nimport { RebaseRouteDefs } from \"./RebaseRouteDefs\";\n\nexport interface RebaseShellProps {\n title?: string;\n /**\n * Top bar. Only rendered if provided — pass `<AppBar/>` for the default\n * one — or when `<Rebase components>` overrides `\"Shell.AppBar\"`.\n */\n appBar?: React.ReactNode;\n drawer?: React.ReactNode;\n /** Expand the drawer while the pointer is over it. On by default; pass `false` to opt out. Not a load-time default — that is `defaultDrawerOpen`. */\n autoOpenDrawer?: boolean;\n /** Start with the drawer expanded instead of collapsed to icons. Ignored on small layouts. */\n defaultDrawerOpen?: boolean;\n /** Path to the logo shown in the drawer and top bar. Falls back to the Rebase mark. */\n logo?: string;\n children?: React.ReactNode;\n}\n\n/**\n * Convenience component that composes all four admin layers:\n *\n * ```\n * <RebaseAuthGate>\n * <RebaseNavigation>\n * <RebaseRouteDefs layout={<RebaseLayout>}>\n * {children}\n * </RebaseRouteDefs>\n * </RebaseNavigation>\n * </RebaseAuthGate>\n * ```\n *\n * Each layer is independently usable — see their individual docs.\n * RebaseShell is sugar that composes them all with sensible defaults.\n */\nexport function RebaseShell(props: RebaseShellProps) {\n const {\n title = \"Rebase\",\n appBar,\n drawer,\n autoOpenDrawer = true,\n defaultDrawerOpen = false,\n logo,\n children\n } = props;\n\n const registry = useRebaseRegistry();\n\n // Compute devViews for the layout's AdminModeSyncer\n const devViews = useMemo(() => {\n return registry.studioConfig?.devViews ?? [];\n }, [registry.studioConfig?.devViews]);\n\n return (\n <RebaseAuthGate>\n <RebaseNavigation>\n <ErrorBoundary fullPage>\n <RebaseRouteDefs\n layout={\n <RebaseLayout\n title={title}\n appBar={appBar}\n drawer={drawer}\n autoOpenDrawer={autoOpenDrawer}\n defaultDrawerOpen={defaultDrawerOpen}\n logo={logo}\n devViews={devViews}\n />\n }\n >\n {children}\n </RebaseRouteDefs>\n </ErrorBoundary>\n </RebaseNavigation>\n </RebaseAuthGate>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,SAAgB,YAAY,OAAyB;CACjD,MAAM,EACF,QAAQ,UACR,QACA,QACA,iBAAiB,MACjB,oBAAoB,OACpB,MACA,aACA;CAEJ,MAAM,WAAW,kBAAkB;CAOnC,OACI,oBAAC,gBAAD,EAAA,UACI,oBAAC,kBAAD,EAAA,UACI,oBAAC,eAAD;EAAe,UAAA;YACX,oBAAC,iBAAD;GACI,QACI,oBAAC,cAAD;IACW;IACC;IACA;IACQ;IACG;IACb;IACI,UAjBrB,cAAc;KAC3B,OAAO,SAAS,cAAc,YAAY,CAAC;IAC/C,GAAG,CAAC,SAAS,cAAc,QAAQ,CAeG;GACb,CAAA;GAGJ;EACY,CAAA;CACN,CAAA,EACD,CAAA,EACN,CAAA;AAExB"}
1
+ {"version":3,"file":"RebaseShell.js","names":[],"sources":["../../src/components/RebaseShell.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { MemoryRouter } from \"react-router\";\nimport {\n useRebaseEmbedHost,\n useRebaseRegistry\n} from \"@rebasepro/app\";\nimport { ErrorBoundary } from \"@rebasepro/ui\";\n\nimport { RebaseAuthGate } from \"./RebaseAuthGate\";\nimport { RebaseNavigation } from \"./RebaseNavigation\";\nimport { SideDialogs } from \"./SideDialogs\";\nimport { RebaseLayout } from \"./RebaseLayout\";\nimport { RebaseRouteDefs } from \"./RebaseRouteDefs\";\n\nexport interface RebaseShellProps {\n title?: string;\n /**\n * Top bar. Only rendered if provided — pass `<AppBar/>` for the default\n * one — or when `<Rebase components>` overrides `\"Shell.AppBar\"`.\n */\n appBar?: React.ReactNode;\n drawer?: React.ReactNode;\n /** Expand the drawer while the pointer is over it. On by default; pass `false` to opt out. Not a load-time default — that is `defaultDrawerOpen`. */\n autoOpenDrawer?: boolean;\n /** Start with the drawer expanded instead of collapsed to icons. Ignored on small layouts. */\n defaultDrawerOpen?: boolean;\n /** Path to the logo shown in the drawer and top bar. Falls back to the Rebase mark. */\n logo?: string;\n children?: React.ReactNode;\n}\n\n/**\n * Convenience component that composes all four admin layers:\n *\n * ```\n * <RebaseAuthGate>\n * <RebaseNavigation>\n * <RebaseRouteDefs layout={<RebaseLayout>}>\n * {children}\n * </RebaseRouteDefs>\n * </RebaseNavigation>\n * </RebaseAuthGate>\n * ```\n *\n * Each layer is independently usable — see their individual docs.\n * RebaseShell is sugar that composes them all with sensible defaults.\n */\nexport function RebaseShell(props: RebaseShellProps) {\n const {\n title = \"Rebase\",\n appBar,\n drawer,\n autoOpenDrawer = true,\n defaultDrawerOpen = false,\n logo,\n children\n } = props;\n\n const registry = useRebaseRegistry();\n const embed = useRebaseEmbedHost();\n\n // Compute devViews for the layout's AdminModeSyncer\n const devViews = useMemo(() => {\n return registry.studioConfig?.devViews ?? [];\n }, [registry.studioConfig?.devViews]);\n\n // In an embedding (an MCP App view, `embed_host.ts`) the person is signed\n // in by the host and there is no address bar: the providers stay, and the\n // host's screen takes the place of the gate, the routes and the layout.\n if (embed) {\n return (\n <MemoryRouter>\n <RebaseNavigation>\n <ErrorBoundary>{embed.renderCms()}</ErrorBoundary>\n {/* Where records open over the screen; the layout draws it otherwise. */}\n <SideDialogs/>\n </RebaseNavigation>\n </MemoryRouter>\n );\n }\n\n return (\n <RebaseAuthGate>\n <RebaseNavigation>\n <ErrorBoundary fullPage>\n <RebaseRouteDefs\n layout={\n <RebaseLayout\n title={title}\n appBar={appBar}\n drawer={drawer}\n autoOpenDrawer={autoOpenDrawer}\n defaultDrawerOpen={defaultDrawerOpen}\n logo={logo}\n devViews={devViews}\n />\n }\n >\n {children}\n </RebaseRouteDefs>\n </ErrorBoundary>\n </RebaseNavigation>\n </RebaseAuthGate>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAgB,YAAY,OAAyB;CACjD,MAAM,EACF,QAAQ,UACR,QACA,QACA,iBAAiB,MACjB,oBAAoB,OACpB,MACA,aACA;CAEJ,MAAM,WAAW,kBAAkB;CACnC,MAAM,QAAQ,mBAAmB;CAGjC,MAAM,WAAW,cAAc;EAC3B,OAAO,SAAS,cAAc,YAAY,CAAC;CAC/C,GAAG,CAAC,SAAS,cAAc,QAAQ,CAAC;CAKpC,IAAI,OACA,OACI,oBAAC,cAAD,EAAA,UACI,qBAAC,kBAAD,EAAA,UAAA,CACI,oBAAC,eAAD,EAAA,UAAgB,MAAM,UAAU,EAAiB,CAAA,GAEjD,oBAAC,aAAD,CAAa,CAAA,CACC,EAAA,CAAA,EACR,CAAA;CAItB,OACI,oBAAC,gBAAD,EAAA,UACI,oBAAC,kBAAD,EAAA,UACI,oBAAC,eAAD;EAAe,UAAA;YACX,oBAAC,iBAAD;GACI,QACI,oBAAC,cAAD;IACW;IACC;IACA;IACQ;IACG;IACb;IACI;GACb,CAAA;GAGJ;EACY,CAAA;CACN,CAAA,EACD,CAAA,EACN,CAAA;AAExB"}
@@ -0,0 +1,61 @@
1
+ import React from "react";
2
+ import type { AdminCollection } from "@rebasepro/cms-types";
3
+ import type { RecordPanelCollection } from "./RecordForm.js";
4
+ /**
5
+ * Props for {@link RecordDetail}.
6
+ *
7
+ * @group Components
8
+ */
9
+ export type RecordDetailProps<M extends Record<string, unknown> = Record<string, unknown>> = RecordDetailOptions<M> & RecordPanelCollection<M>;
10
+ /**
11
+ * The options of an {@link RecordDetail}, beside its collection.
12
+ *
13
+ * @group Components
14
+ */
15
+ export type RecordDetailOptions<M extends Record<string, unknown> = Record<string, unknown>> = {
16
+ /** The record to show. */
17
+ id: string | number;
18
+ className?: string;
19
+ /**
20
+ * The fields the view shows, in this order; any other property is left
21
+ * out. Sections and the rail keep their grouping, each holding only these
22
+ * fields. Wins over the collection's `formView.Builder`.
23
+ */
24
+ fields?: string[];
25
+ /**
26
+ * Collection settings for this view only, applied over the registered
27
+ * collection the way `CollectionPanel` and `RecordForm` apply their
28
+ * own: a shallow merge, so `properties` given here replaces the
29
+ * collection's whole map.
30
+ */
31
+ collectionOverrides?: Partial<AdminCollection>;
32
+ };
33
+ /**
34
+ * One record, read-only — loaded by id, drawn the way the CMS's own detail
35
+ * view draws it — to drop into a page of your own app. The read-only twin of
36
+ * `RecordForm`.
37
+ *
38
+ * Each field renders its `PropertyPreview`: an enum as its chip, a date in its
39
+ * timezone, a relation as its target's title, a property's own
40
+ * `admin.Preview`. A field a dynamic `conditions` rule hides for this record,
41
+ * or that the signed-in user may not read, is left out, exactly as the form
42
+ * leaves it out.
43
+ *
44
+ * Needs `<Rebase>` and a React Router router above it (any router, any path).
45
+ * Where no CMS navigation is mounted above, it brings its own
46
+ * {@link CollectionsProvider}, so `<RebaseCMS>`, `<RebaseNavigation>` and
47
+ * `<RebaseShell>` are not needed.
48
+ *
49
+ * @example
50
+ * ```tsx
51
+ * <Rebase client={client} authController={authController}>
52
+ * <BrowserRouter>
53
+ * <RecordDetail collection={ordersCollection} id="123"
54
+ * fields={["customer", "status", "total"]}/>
55
+ * </BrowserRouter>
56
+ * </Rebase>
57
+ * ```
58
+ *
59
+ * @group Components
60
+ */
61
+ export declare function RecordDetail<M extends Record<string, unknown> = Record<string, unknown>>(rawProps: RecordDetailProps<M>): React.JSX.Element;
@@ -0,0 +1,123 @@
1
+ import { useCollectionRegistryController } from "../hooks/navigation/contexts/CollectionRegistryContext.js";
2
+ import { useNavigationStateController } from "../hooks/navigation/contexts/NavigationStateContext.js";
3
+ import { EntityViewBody, useReadOnlyFormContext } from "./EntityViewBody.js";
4
+ import { CollectionsScopeContext, isRegistered } from "./CollectionsScopeContext.js";
5
+ import { CollectionsProvider } from "./CollectionsProvider.js";
6
+ import { collectionPropOf } from "./collection_prop.js";
7
+ import { PanelNotFound } from "./PanelNotFound.js";
8
+ import { useContext, useMemo, useRef } from "react";
9
+ import { jsx } from "react/jsx-runtime";
10
+ import { deepEqual } from "fast-equals";
11
+ import { CenteredView, CircularProgressCenter } from "@rebasepro/ui";
12
+ import { CollectionScopeProvider, ErrorView, useFetch } from "@rebasepro/app";
13
+ //#region src/components/RecordDetail.tsx
14
+ /**
15
+ * One record, read-only — loaded by id, drawn the way the CMS's own detail
16
+ * view draws it — to drop into a page of your own app. The read-only twin of
17
+ * `RecordForm`.
18
+ *
19
+ * Each field renders its `PropertyPreview`: an enum as its chip, a date in its
20
+ * timezone, a relation as its target's title, a property's own
21
+ * `admin.Preview`. A field a dynamic `conditions` rule hides for this record,
22
+ * or that the signed-in user may not read, is left out, exactly as the form
23
+ * leaves it out.
24
+ *
25
+ * Needs `<Rebase>` and a React Router router above it (any router, any path).
26
+ * Where no CMS navigation is mounted above, it brings its own
27
+ * {@link CollectionsProvider}, so `<RebaseCMS>`, `<RebaseNavigation>` and
28
+ * `<RebaseShell>` are not needed.
29
+ *
30
+ * @example
31
+ * ```tsx
32
+ * <Rebase client={client} authController={authController}>
33
+ * <BrowserRouter>
34
+ * <RecordDetail collection={ordersCollection} id="123"
35
+ * fields={["customer", "status", "total"]}/>
36
+ * </BrowserRouter>
37
+ * </Rebase>
38
+ * ```
39
+ *
40
+ * @group Components
41
+ */
42
+ function RecordDetail(rawProps) {
43
+ const inScope = useContext(CollectionsScopeContext);
44
+ const collectionRegistry = useCollectionRegistryController();
45
+ const navigationState = useNavigationStateController();
46
+ const { collection, path } = collectionPropOf(rawProps.collection, rawProps.path);
47
+ const props = {
48
+ ...rawProps,
49
+ collection,
50
+ path
51
+ };
52
+ const ownCollections = useMemo(() => collection ? [collection] : [], [collection]);
53
+ const needsOwnScope = collection !== void 0 && (!inScope || !navigationState.loading && !isRegistered(collectionRegistry.collections, path));
54
+ const recordKey = `${path}/${props.id}`;
55
+ if (!inScope && collection === void 0) return /* @__PURE__ */ jsx(PanelNotFound, { className: props.className });
56
+ if (needsOwnScope) return /* @__PURE__ */ jsx(CollectionsProvider, {
57
+ collections: ownCollections,
58
+ children: /* @__PURE__ */ jsx(RecordDetailInScope, { ...props }, recordKey)
59
+ });
60
+ return /* @__PURE__ */ jsx(RecordDetailInScope, { ...props }, recordKey);
61
+ }
62
+ function RecordDetailInScope({ collection: collectionProp, id: entityId, path: pathProp, className, fields, collectionOverrides }) {
63
+ const path = pathProp;
64
+ const collectionRegistry = useCollectionRegistryController();
65
+ const navigationState = useNavigationStateController();
66
+ const overridesRef = useRef(collectionOverrides);
67
+ if (!deepEqual(overridesRef.current, collectionOverrides)) overridesRef.current = collectionOverrides;
68
+ const stableOverrides = overridesRef.current;
69
+ const lookUp = collectionRegistry.initialised || !navigationState.loading;
70
+ const collection = useMemo(() => {
71
+ const registered = lookUp ? collectionRegistry.getCollection(path) : void 0;
72
+ return registered && stableOverrides ? {
73
+ ...registered,
74
+ ...stableOverrides
75
+ } : registered;
76
+ }, [
77
+ lookUp,
78
+ collectionRegistry,
79
+ path,
80
+ stableOverrides
81
+ ]);
82
+ const { entity, dataLoading, dataLoadingError } = useFetch({
83
+ path,
84
+ entityId,
85
+ collection: collection ?? collectionProp,
86
+ relations: true,
87
+ useCache: false
88
+ });
89
+ const formContext = useReadOnlyFormContext({
90
+ entityId,
91
+ entity,
92
+ collection: collection ?? collectionProp,
93
+ path,
94
+ openEntityMode: "full_screen"
95
+ });
96
+ if (!collection) {
97
+ if (navigationState.loading) return /* @__PURE__ */ jsx(CircularProgressCenter, {});
98
+ return /* @__PURE__ */ jsx(PanelNotFound, { className });
99
+ }
100
+ if (dataLoadingError) return /* @__PURE__ */ jsx(CenteredView, {
101
+ className,
102
+ children: /* @__PURE__ */ jsx(ErrorView, { error: dataLoadingError })
103
+ });
104
+ if (!entity) {
105
+ if (dataLoading) return /* @__PURE__ */ jsx(CircularProgressCenter, {});
106
+ return /* @__PURE__ */ jsx(PanelNotFound, { className });
107
+ }
108
+ return /* @__PURE__ */ jsx(CollectionScopeProvider, {
109
+ collection,
110
+ children: /* @__PURE__ */ jsx(EntityViewBody, {
111
+ entity,
112
+ collection,
113
+ path,
114
+ formContext,
115
+ fields,
116
+ className
117
+ })
118
+ });
119
+ }
120
+ //#endregion
121
+ export { RecordDetail };
122
+
123
+ //# sourceMappingURL=RecordDetail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecordDetail.js","names":[],"sources":["../../src/components/RecordDetail.tsx"],"sourcesContent":["import React, { useContext, useMemo, useRef } from \"react\";\nimport { deepEqual as equal } from \"fast-equals\";\nimport type { AdminCollection } from \"@rebasepro/cms-types\";\nimport { CenteredView, CircularProgressCenter } from \"@rebasepro/ui\";\nimport { CollectionScopeProvider, ErrorView, useFetch } from \"@rebasepro/app\";\n\nimport { useCollectionRegistryController } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { useNavigationStateController } from \"../hooks/navigation/contexts/NavigationStateContext\";\nimport { CollectionsScopeContext, isRegistered } from \"./CollectionsScopeContext\";\nimport { CollectionsProvider } from \"./CollectionsProvider\";\nimport { EntityViewBody, useReadOnlyFormContext } from \"./EntityViewBody\";\nimport { PanelNotFound } from \"./PanelNotFound\";\nimport { collectionPropOf, type ScopedRecordPanelProps } from \"./collection_prop\";\nimport type { RecordPanelCollection } from \"./RecordForm\";\n\n/**\n * Props for {@link RecordDetail}.\n *\n * @group Components\n */\nexport type RecordDetailProps<M extends Record<string, unknown> = Record<string, unknown>> =\n RecordDetailOptions<M> & RecordPanelCollection<M>;\n\n/**\n * The options of an {@link RecordDetail}, beside its collection.\n *\n * @group Components\n */\nexport type RecordDetailOptions<M extends Record<string, unknown> = Record<string, unknown>> = {\n /** The record to show. */\n id: string | number;\n\n className?: string;\n\n /**\n * The fields the view shows, in this order; any other property is left\n * out. Sections and the rail keep their grouping, each holding only these\n * fields. Wins over the collection's `formView.Builder`.\n */\n fields?: string[];\n\n /**\n * Collection settings for this view only, applied over the registered\n * collection the way `CollectionPanel` and `RecordForm` apply their\n * own: a shallow merge, so `properties` given here replaces the\n * collection's whole map.\n */\n collectionOverrides?: Partial<AdminCollection>;\n};\n\n/**\n * One record, read-only — loaded by id, drawn the way the CMS's own detail\n * view draws it — to drop into a page of your own app. The read-only twin of\n * `RecordForm`.\n *\n * Each field renders its `PropertyPreview`: an enum as its chip, a date in its\n * timezone, a relation as its target's title, a property's own\n * `admin.Preview`. A field a dynamic `conditions` rule hides for this record,\n * or that the signed-in user may not read, is left out, exactly as the form\n * leaves it out.\n *\n * Needs `<Rebase>` and a React Router router above it (any router, any path).\n * Where no CMS navigation is mounted above, it brings its own\n * {@link CollectionsProvider}, so `<RebaseCMS>`, `<RebaseNavigation>` and\n * `<RebaseShell>` are not needed.\n *\n * @example\n * ```tsx\n * <Rebase client={client} authController={authController}>\n * <BrowserRouter>\n * <RecordDetail collection={ordersCollection} id=\"123\"\n * fields={[\"customer\", \"status\", \"total\"]}/>\n * </BrowserRouter>\n * </Rebase>\n * ```\n *\n * @group Components\n */\nexport function RecordDetail<M extends Record<string, unknown> = Record<string, unknown>>(rawProps: RecordDetailProps<M>) {\n const inScope = useContext(CollectionsScopeContext);\n const collectionRegistry = useCollectionRegistryController();\n const navigationState = useNavigationStateController();\n const { collection, path } = collectionPropOf<AdminCollection<M>>(rawProps.collection, rawProps.path);\n const props: ScopedRecordPanelProps<RecordDetailOptions<M>, M> = { ...rawProps, collection, path };\n const ownCollections = useMemo(() => collection ? [collection] : [], [collection]);\n\n // As `RecordForm`: a collection handed over as a value brings its own\n // scope where none is above, or where the one above has settled without\n // it. One named by path is looked up in the scope above.\n const needsOwnScope = collection !== undefined && (!inScope\n || (!navigationState.loading && !isRegistered(collectionRegistry.collections, path)));\n const recordKey = `${path}/${props.id}`;\n // As `RecordForm`: named by path with no scope above, it is not found.\n if (!inScope && collection === undefined) return <PanelNotFound className={props.className}/>;\n if (needsOwnScope) {\n return (\n <CollectionsProvider collections={ownCollections}>\n <RecordDetailInScope key={recordKey} {...props}/>\n </CollectionsProvider>\n );\n }\n return <RecordDetailInScope key={recordKey} {...props}/>;\n}\n\nfunction RecordDetailInScope<M extends Record<string, unknown>>({\n collection: collectionProp,\n id: entityId,\n path: pathProp,\n className,\n fields,\n collectionOverrides\n}: ScopedRecordPanelProps<RecordDetailOptions<M>, M>) {\n const path = pathProp;\n const collectionRegistry = useCollectionRegistryController<Record<string, unknown>, AdminCollection<M>>();\n const navigationState = useNavigationStateController();\n\n // The registry's copy, as in `RecordForm`: it carries the plugins'\n // changes and the user's saved overrides. Looked up once per registry, and\n // the overrides compared by value, because the record's subscription is\n // keyed on the collection it was opened with.\n const overridesRef = useRef(collectionOverrides);\n if (!equal(overridesRef.current, collectionOverrides)) overridesRef.current = collectionOverrides;\n const stableOverrides = overridesRef.current;\n const lookUp = collectionRegistry.initialised || !navigationState.loading;\n const collection = useMemo(() => {\n const registered = lookUp ? collectionRegistry.getCollection(path) : undefined;\n return registered && stableOverrides\n ? { ...registered, ...stableOverrides } as AdminCollection<M>\n : registered;\n }, [lookUp, collectionRegistry, path, stableOverrides]);\n\n const { entity, dataLoading, dataLoadingError } = useFetch<M>({\n path,\n entityId,\n collection: collection ?? collectionProp,\n relations: true,\n useCache: false\n });\n\n const formContext = useReadOnlyFormContext<M>({\n entityId,\n entity,\n collection: collection ?? collectionProp,\n path,\n openEntityMode: \"full_screen\"\n });\n\n if (!collection) {\n if (navigationState.loading) return <CircularProgressCenter/>;\n return <PanelNotFound className={className}/>;\n }\n if (dataLoadingError) {\n return <CenteredView className={className}><ErrorView error={dataLoadingError}/></CenteredView>;\n }\n if (!entity) {\n if (dataLoading) return <CircularProgressCenter/>;\n return <PanelNotFound className={className}/>;\n }\n\n return (\n <CollectionScopeProvider collection={collection}>\n <EntityViewBody<M>\n entity={entity}\n collection={collection}\n path={path}\n formContext={formContext}\n fields={fields}\n className={className}\n />\n </CollectionScopeProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,SAAgB,aAA0E,UAAgC;CACtH,MAAM,UAAU,WAAW,uBAAuB;CAClD,MAAM,qBAAqB,gCAAgC;CAC3D,MAAM,kBAAkB,6BAA6B;CACrD,MAAM,EAAE,YAAY,SAAS,iBAAqC,SAAS,YAAY,SAAS,IAAI;CACpG,MAAM,QAA2D;EAAE,GAAG;EAAU;EAAY;CAAK;CACjG,MAAM,iBAAiB,cAAc,aAAa,CAAC,UAAU,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC;CAKjF,MAAM,gBAAgB,eAAe,KAAA,MAAc,CAAC,WAC5C,CAAC,gBAAgB,WAAW,CAAC,aAAa,mBAAmB,aAAa,IAAI;CACtF,MAAM,YAAY,GAAG,KAAK,GAAG,MAAM;CAEnC,IAAI,CAAC,WAAW,eAAe,KAAA,GAAW,OAAO,oBAAC,eAAD,EAAe,WAAW,MAAM,UAAW,CAAA;CAC5F,IAAI,eACA,OACI,oBAAC,qBAAD;EAAqB,aAAa;YAC9B,oBAAC,qBAAD,EAAqC,GAAI,MAAO,GAAtB,SAAsB;CAC/B,CAAA;CAG7B,OAAO,oBAAC,qBAAD,EAAqC,GAAI,MAAO,GAAtB,SAAsB;AAC3D;AAEA,SAAS,oBAAuD,EAC5D,YAAY,gBACZ,IAAI,UACJ,MAAM,UACN,WACA,QACA,uBACkD;CAClD,MAAM,OAAO;CACb,MAAM,qBAAqB,gCAA6E;CACxG,MAAM,kBAAkB,6BAA6B;CAMrD,MAAM,eAAe,OAAO,mBAAmB;CAC/C,IAAI,CAAC,UAAM,aAAa,SAAS,mBAAmB,GAAG,aAAa,UAAU;CAC9E,MAAM,kBAAkB,aAAa;CACrC,MAAM,SAAS,mBAAmB,eAAe,CAAC,gBAAgB;CAClE,MAAM,aAAa,cAAc;EAC7B,MAAM,aAAa,SAAS,mBAAmB,cAAc,IAAI,IAAI,KAAA;EACrE,OAAO,cAAc,kBACf;GAAE,GAAG;GAAY,GAAG;EAAgB,IACpC;CACV,GAAG;EAAC;EAAQ;EAAoB;EAAM;CAAe,CAAC;CAEtD,MAAM,EAAE,QAAQ,aAAa,qBAAqB,SAAY;EAC1D;EACA;EACA,YAAY,cAAc;EAC1B,WAAW;EACX,UAAU;CACd,CAAC;CAED,MAAM,cAAc,uBAA0B;EAC1C;EACA;EACA,YAAY,cAAc;EAC1B;EACA,gBAAgB;CACpB,CAAC;CAED,IAAI,CAAC,YAAY;EACb,IAAI,gBAAgB,SAAS,OAAO,oBAAC,wBAAD,CAAwB,CAAA;EAC5D,OAAO,oBAAC,eAAD,EAA0B,UAAW,CAAA;CAChD;CACA,IAAI,kBACA,OAAO,oBAAC,cAAD;EAAyB;YAAW,oBAAC,WAAD,EAAW,OAAO,iBAAkB,CAAA;CAAe,CAAA;CAElG,IAAI,CAAC,QAAQ;EACT,IAAI,aAAa,OAAO,oBAAC,wBAAD,CAAwB,CAAA;EAChD,OAAO,oBAAC,eAAD,EAA0B,UAAW,CAAA;CAChD;CAEA,OACI,oBAAC,yBAAD;EAAqC;YACjC,oBAAC,gBAAD;GACY;GACI;GACN;GACO;GACL;GACG;EACd,CAAA;CACoB,CAAA;AAEjC"}
@@ -0,0 +1,126 @@
1
+ import React from "react";
2
+ import type { AdminCollection } from "@rebasepro/cms-types";
3
+ import type { EntityFormBindingProps } from "../form/EntityFormBinding.js";
4
+ import type { OnSavedParams } from "../types/components/EntityFormProps.js";
5
+ /**
6
+ * Props for {@link RecordForm}.
7
+ *
8
+ * @group Components
9
+ */
10
+ export type RecordFormProps<M extends Record<string, unknown> = Record<string, unknown>> = RecordFormOptions<M> & RecordPanelCollection<M>;
11
+ /**
12
+ * Which collection a record panel's record belongs to: named, the way
13
+ * {@link CollectionPanel} names it, or handed over as a value.
14
+ *
15
+ * @group Components
16
+ */
17
+ export type RecordPanelCollection<M extends Record<string, unknown> = Record<string, unknown>> = {
18
+ /**
19
+ * The collection the record belongs to: its name (`"orders"`), registered
20
+ * with `<RebaseCMS>` or a {@link CollectionsProvider} above, or the
21
+ * collection as a value — a `defineCollection` config or a resolved
22
+ * collection. Handed over as a value where no CMS navigation is mounted
23
+ * above, the panel brings its own {@link CollectionsProvider} for it.
24
+ */
25
+ collection: AdminCollection<M> | string;
26
+ /**
27
+ * Where the record lives, where that is not the collection's name: a
28
+ * subcollection's full path, `posts/p1/comments`.
29
+ */
30
+ path?: string;
31
+ };
32
+ /**
33
+ * The options of an {@link RecordForm}, beside its collection.
34
+ *
35
+ * @group Components
36
+ */
37
+ export type RecordFormOptions<M extends Record<string, unknown> = Record<string, unknown>> = {
38
+ /**
39
+ * The record to edit. When no record has this id yet, the form creates
40
+ * it under this id — so a record kept at a known key (a settings record,
41
+ * a profile keyed by its user's id) needs no seeding. Omit it to create a
42
+ * new record under an id the data source assigns.
43
+ */
44
+ id?: string | number;
45
+ /** Called after every successful save, with the saved record. */
46
+ onSaved?: (params: OnSavedParams) => void;
47
+ /**
48
+ * Called when the form asks to be left — after its record is deleted, or
49
+ * by an action that closes it. The form is your page's, so where that
50
+ * leads is yours to say; without it, nothing happens.
51
+ */
52
+ onClose?: () => void;
53
+ /** Values a new record starts with — one created without an id, or under an id no record has yet. */
54
+ defaultValues?: Partial<M>;
55
+ className?: string;
56
+ /**
57
+ * The fields the form shows, in this order; any other property is left
58
+ * out. Sections and the rail keep their grouping, each holding only these
59
+ * fields. The form validates only what it shows, and, creating a record,
60
+ * refuses with an error naming them when a required field it leaves out
61
+ * has no default value and is not filled by the server or the database.
62
+ */
63
+ fields?: string[];
64
+ /**
65
+ * A denser form, for a side card or a narrow panel: no rail beside the
66
+ * fields, no record metadata, medium-height controls and tighter padding.
67
+ */
68
+ compact?: boolean;
69
+ /**
70
+ * Your own arrangement of the fields, in place of the generated ones:
71
+ * `<FormField name="…"/>`s inside any JSX. Validation covers the fields
72
+ * its `<FormField>`s render, with the same create-time check as
73
+ * {@link fields}. Wins over the collection's `formView.Builder`.
74
+ *
75
+ * ```tsx
76
+ * <RecordForm collection="orders" id={id}>
77
+ * <div className="grid grid-cols-2 gap-3">
78
+ * <FormField name="status"/>
79
+ * <FormField name="tracking_number"/>
80
+ * </div>
81
+ * <FormField name="notes"/>
82
+ * </RecordForm>
83
+ * ```
84
+ */
85
+ children?: React.ReactNode;
86
+ /**
87
+ * Collection settings for this form only, applied over the registered
88
+ * collection the way `CollectionPanel` applies its own: a shallow merge,
89
+ * so `properties` given here replaces the collection's whole map.
90
+ */
91
+ collectionOverrides?: Partial<AdminCollection>;
92
+ /** Anything else {@link EntityFormBinding} takes. */
93
+ formProps?: Partial<Omit<EntityFormBindingProps<M>, "path" | "collection" | "id" | "row" | "initialStatus" | "fields" | "layout" | "compact">>;
94
+ };
95
+ /**
96
+ * One record's form — loaded by id, saved through `<Rebase>`'s data layer —
97
+ * to drop into a page of your own app.
98
+ *
99
+ * Needs `<Rebase>` and a React Router router above it (any router, any path).
100
+ * Where no CMS navigation is mounted above, it brings its own
101
+ * {@link CollectionsProvider}, so `<RebaseCMS>`, `<RebaseNavigation>` and
102
+ * `<RebaseShell>` are not needed.
103
+ *
104
+ * @example
105
+ * ```tsx
106
+ * <Rebase client={client} authController={authController}>
107
+ * <BrowserRouter>
108
+ * <RecordForm collection={postsCollection} id="123"
109
+ * onSaved={({ id }) => toast(`Saved ${id}`)}/>
110
+ * </BrowserRouter>
111
+ * </Rebase>
112
+ * ```
113
+ *
114
+ * @group Components
115
+ */
116
+ export declare function RecordForm<M extends Record<string, unknown> = Record<string, unknown>>(rawProps: RecordFormProps<M>): React.JSX.Element;
117
+ /**
118
+ * @deprecated Renamed {@link RecordForm}, with the same props. It warns once.
119
+ * @group Components
120
+ */
121
+ export type EntityFormPanelProps<M extends Record<string, unknown> = Record<string, unknown>> = RecordFormProps<M>;
122
+ /**
123
+ * @deprecated Renamed {@link RecordForm}, with the same props. It warns once.
124
+ * @group Components
125
+ */
126
+ export declare function EntityFormPanel<M extends Record<string, unknown> = Record<string, unknown>>(props: RecordFormProps<M>): React.JSX.Element;