@rebasepro/cms 0.28.1 → 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
@@ -0,0 +1,223 @@
1
+ import { useCollectionRegistryController } from "../hooks/navigation/contexts/CollectionRegistryContext.js";
2
+ import { CollectionPanel } from "../components/CollectionPanel.js";
3
+ import { RecordForm } from "../components/RecordForm.js";
4
+ import { filterOf, orderOf } from "./payload.js";
5
+ import { AppCollections } from "./app_modules.js";
6
+ import { AppErrorBoundary, loadApp } from "./code_app.js";
7
+ import { useViewStore } from "./store.js";
8
+ import { useEffect, useMemo, useRef, useState } from "react";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ import { Alert, Button, Card, CircularProgress, Dialog, DialogActions, DialogContent, DialogTitle, IconButton, Maximize2Icon, Tooltip, Typography, cls, iconSize } from "@rebasepro/ui";
11
+ //#region src/mcp_view/screen.tsx
12
+ /**
13
+ * The tallest the screen is in the conversation; past it, a collection
14
+ * scrolls inside its own block, and anything else inside the screen. A
15
+ * record's form and the confirmation of a save open over the frame, centred
16
+ * in it: in a frame as tall as everything on the screen they would open where
17
+ * the person is not looking.
18
+ */
19
+ var INLINE_MAX_HEIGHT = 640;
20
+ /**
21
+ * What the embedded app's shell draws (`renderCms` of the embed host): the
22
+ * one block the tool opened — a collection, a record, or an app the model
23
+ * wrote — inside the providers the app's own `<RebaseShell>` set up, so its
24
+ * collections, custom views, entity views, fields and actions are the ones
25
+ * drawn.
26
+ */
27
+ function McpScreen({ bridge, screen, hostContext, pendingPlan, onAppError }) {
28
+ const rootRef = useRef(null);
29
+ const context = useViewStore(hostContext);
30
+ const pending = useViewStore(pendingPlan);
31
+ const registry = useCollectionRegistryController();
32
+ const fullscreen = context.displayMode === "fullscreen";
33
+ const canExpand = !fullscreen && context.availableDisplayModes?.includes("fullscreen") === true;
34
+ const block = screen.blocks[0];
35
+ useEffect(() => {
36
+ const root = rootRef.current;
37
+ if (!root) return;
38
+ const measure = () => {
39
+ const html = document.documentElement;
40
+ const previous = html.style.height;
41
+ html.style.height = "max-content";
42
+ bridge.sizeChanged(Math.ceil(html.getBoundingClientRect().height));
43
+ html.style.height = previous;
44
+ };
45
+ const observer = new ResizeObserver(measure);
46
+ observer.observe(root);
47
+ measure();
48
+ return () => observer.disconnect();
49
+ }, [bridge]);
50
+ const collectionOf = (name) => registry.getCollection(name);
51
+ const heading = screen.title ?? (block.type === "app" ? void 0 : blockTitle(block, collectionOf(block.collection)));
52
+ let body;
53
+ if (!registry.initialised && !registry.collections?.length) body = /* @__PURE__ */ jsx(CircularProgress, { size: "smallest" });
54
+ else if (block.type === "app") body = /* @__PURE__ */ jsx(AppView, {
55
+ block,
56
+ onError: onAppError
57
+ });
58
+ else {
59
+ const collection = collectionOf(block.collection);
60
+ body = !collection ? /* @__PURE__ */ jsxs(Alert, {
61
+ color: "error",
62
+ size: "small",
63
+ children: [
64
+ "The collection \"",
65
+ block.collection,
66
+ "\" is not in this view."
67
+ ]
68
+ }) : block.type === "collection" ? /* @__PURE__ */ jsx(CollectionView, {
69
+ block,
70
+ collection
71
+ }) : /* @__PURE__ */ jsx(RecordView, {
72
+ block,
73
+ collection
74
+ });
75
+ }
76
+ return /* @__PURE__ */ jsxs("div", {
77
+ ref: rootRef,
78
+ className: cls("flex flex-col gap-4 p-4 w-full min-w-0 bg-surface-sheet overflow-y-auto", fullscreen && "h-screen"),
79
+ style: fullscreen ? void 0 : { maxHeight: INLINE_MAX_HEIGHT },
80
+ children: [
81
+ (heading || canExpand) && /* @__PURE__ */ jsxs("div", {
82
+ className: "flex items-center justify-between gap-3 min-h-8",
83
+ children: [/* @__PURE__ */ jsx(Typography, {
84
+ variant: "subtitle2",
85
+ noWrap: true,
86
+ children: heading
87
+ }), canExpand && /* @__PURE__ */ jsx(Tooltip, {
88
+ title: "Expand",
89
+ children: /* @__PURE__ */ jsx(IconButton, {
90
+ size: "small",
91
+ "aria-label": "Expand",
92
+ onClick: () => void bridge.requestDisplayMode("fullscreen").catch(() => void 0),
93
+ children: /* @__PURE__ */ jsx(Maximize2Icon, { size: iconSize.smallest })
94
+ })
95
+ })]
96
+ }),
97
+ body,
98
+ /* @__PURE__ */ jsxs(Dialog, {
99
+ open: pending !== void 0,
100
+ onOpenChange: (open) => !open && pending?.answer(false),
101
+ maxWidth: "sm",
102
+ children: [
103
+ /* @__PURE__ */ jsx(DialogTitle, {
104
+ variant: "subtitle1",
105
+ children: "Confirm this change"
106
+ }),
107
+ /* @__PURE__ */ jsxs(DialogContent, {
108
+ className: "flex flex-col gap-2",
109
+ children: [
110
+ /* @__PURE__ */ jsx(Typography, {
111
+ variant: "body2",
112
+ children: pending?.plan.summary
113
+ }),
114
+ pending?.plan.effects?.map((effect) => /* @__PURE__ */ jsx(Typography, {
115
+ variant: "body2",
116
+ color: "secondary",
117
+ children: effect
118
+ }, effect)),
119
+ pending?.plan.reversible && /* @__PURE__ */ jsxs(Typography, {
120
+ variant: "caption",
121
+ color: "secondary",
122
+ children: ["Undo: ", pending.plan.reversible]
123
+ })
124
+ ]
125
+ }),
126
+ /* @__PURE__ */ jsxs(DialogActions, { children: [/* @__PURE__ */ jsx(Button, {
127
+ variant: "text",
128
+ color: "neutral",
129
+ onClick: () => pending?.answer(false),
130
+ children: "Cancel"
131
+ }), /* @__PURE__ */ jsx(Button, {
132
+ variant: "filled",
133
+ color: "primary",
134
+ onClick: () => pending?.answer(true),
135
+ children: "Save"
136
+ })] })
137
+ ]
138
+ })
139
+ ]
140
+ });
141
+ }
142
+ function blockTitle(block, collection) {
143
+ if (block.type === "record") {
144
+ const name = collection?.singularName ?? collection?.name ?? block.collection;
145
+ return block.id === void 0 ? `New ${name.toLowerCase()}` : name;
146
+ }
147
+ return collection?.name ?? block.collection;
148
+ }
149
+ /**
150
+ * show_collection: the admin panel's collection view, where a row opens its
151
+ * form over the screen. It sizes to its rows, up to what the screen leaves
152
+ * it — inline, the screen's height cap; full screen, the window — and then
153
+ * scrolls inside.
154
+ */
155
+ function CollectionView({ block, collection }) {
156
+ const overrides = useMemo(() => {
157
+ const where = filterOf(block.where);
158
+ return {
159
+ ...where && { defaultFilter: where },
160
+ ...block.limit !== void 0 && { pagination: block.limit }
161
+ };
162
+ }, [block.where, block.limit]);
163
+ const sort = orderOf(block.orderBy);
164
+ return /* @__PURE__ */ jsx(CollectionPanel, {
165
+ collection: collection.slug,
166
+ title: false,
167
+ className: "flex-1 rounded-xl overflow-hidden",
168
+ ...block.view && { viewMode: block.view },
169
+ ...sort && { orderBy: sort },
170
+ collectionOverrides: overrides
171
+ });
172
+ }
173
+ /** show_record: the admin panel's form, for a row or a new one. */
174
+ function RecordView({ block, collection }) {
175
+ const [created, setCreated] = useState();
176
+ const id = block.id ?? created;
177
+ return /* @__PURE__ */ jsx(Card, {
178
+ className: "min-w-0 overflow-hidden",
179
+ children: /* @__PURE__ */ jsx(RecordForm, {
180
+ collection,
181
+ id,
182
+ ...id === void 0 && block.values && { defaultValues: block.values },
183
+ onSaved: (params) => {
184
+ if (id === void 0) setCreated(params.id);
185
+ }
186
+ }, String(id ?? "new"))
187
+ });
188
+ }
189
+ /**
190
+ * show_app: the app the model wrote, held to the collections it was opened
191
+ * with, and its failure shown in its place.
192
+ */
193
+ function AppView({ block, onError }) {
194
+ const loaded = useMemo(() => loadApp(block.code), [block.code]);
195
+ useEffect(() => {
196
+ if (loaded.error) onError(loaded.error);
197
+ }, [loaded, onError]);
198
+ const failure = (error) => /* @__PURE__ */ jsxs(Alert, {
199
+ color: "error",
200
+ size: "small",
201
+ children: [
202
+ "The app failed",
203
+ error.line ? ` at line ${error.line}` : "",
204
+ ": ",
205
+ error.message
206
+ ]
207
+ });
208
+ if (!loaded.Component) return failure(loaded.error ?? { message: "The app did not load." });
209
+ const { Component } = loaded;
210
+ return /* @__PURE__ */ jsx(AppErrorBoundary, {
211
+ lineOffset: loaded.lineOffset,
212
+ onError,
213
+ fallback: failure,
214
+ children: /* @__PURE__ */ jsx(AppCollections, {
215
+ names: block.collections,
216
+ children: /* @__PURE__ */ jsx(Component, {})
217
+ })
218
+ });
219
+ }
220
+ //#endregion
221
+ export { McpScreen };
222
+
223
+ //# sourceMappingURL=screen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen.js","names":[],"sources":["../../src/mcp_view/screen.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport type { AdminCollection } from \"@rebasepro/cms-types\";\nimport {\n Alert,\n Button,\n Card,\n CircularProgress,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n IconButton,\n Maximize2Icon,\n Tooltip,\n Typography,\n cls,\n iconSize\n} from \"@rebasepro/ui\";\nimport { CollectionPanel } from \"../components/CollectionPanel\";\nimport { RecordForm } from \"../components/RecordForm\";\nimport { useCollectionRegistryController } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\nimport type { HostContext, McpAppBridge } from \"./bridge\";\nimport type { WritePlan } from \"./tool_driver\";\nimport { filterOf, orderOf, type AppBlock, type CollectionBlock, type RecordBlock, type Screen } from \"./payload\";\nimport { AppErrorBoundary, loadApp, type AppError } from \"./code_app\";\nimport { AppCollections } from \"./app_modules\";\nimport { useViewStore, type ViewStore } from \"./store\";\n\n/**\n * The tallest the screen is in the conversation; past it, a collection\n * scrolls inside its own block, and anything else inside the screen. A\n * record's form and the confirmation of a save open over the frame, centred\n * in it: in a frame as tall as everything on the screen they would open where\n * the person is not looking.\n */\nconst INLINE_MAX_HEIGHT = 640;\n\n/** A write's plan waiting for the person's answer. */\nexport interface PendingPlan {\n plan: WritePlan;\n answer: (confirmed: boolean) => void;\n}\n\nexport interface McpScreenProps {\n bridge: McpAppBridge;\n screen: Screen;\n /** The host's context, as it changes. */\n hostContext: ViewStore<HostContext>;\n /** The write plan to confirm, as it changes. */\n pendingPlan: ViewStore<PendingPlan | undefined>;\n onAppError: (error: AppError) => void;\n}\n\n/**\n * What the embedded app's shell draws (`renderCms` of the embed host): the\n * one block the tool opened — a collection, a record, or an app the model\n * wrote — inside the providers the app's own `<RebaseShell>` set up, so its\n * collections, custom views, entity views, fields and actions are the ones\n * drawn.\n */\nexport function McpScreen({ bridge, screen, hostContext, pendingPlan, onAppError }: McpScreenProps) {\n const rootRef = useRef<HTMLDivElement>(null);\n const context = useViewStore(hostContext);\n const pending = useViewStore(pendingPlan);\n const registry = useCollectionRegistryController();\n const fullscreen = context.displayMode === \"fullscreen\";\n const canExpand = !fullscreen && context.availableDisplayModes?.includes(\"fullscreen\") === true;\n const block = screen.blocks[0];\n\n // The host sizes the frame to the document, which it cannot measure\n // across the sandbox.\n useEffect(() => {\n const root = rootRef.current;\n if (!root) return;\n const measure = () => {\n const html = document.documentElement;\n const previous = html.style.height;\n html.style.height = \"max-content\";\n bridge.sizeChanged(Math.ceil(html.getBoundingClientRect().height));\n html.style.height = previous;\n };\n const observer = new ResizeObserver(measure);\n observer.observe(root);\n measure();\n return () => observer.disconnect();\n }, [bridge]);\n\n const collectionOf = (name: string): AdminCollection | undefined => registry.getCollection(name);\n const heading = screen.title ?? (block.type === \"app\" ? undefined : blockTitle(block, collectionOf(block.collection)));\n\n let body: React.ReactNode;\n if (!registry.initialised && !registry.collections?.length) {\n body = <CircularProgress size=\"smallest\"/>;\n } else if (block.type === \"app\") {\n body = <AppView block={block} onError={onAppError}/>;\n } else {\n const collection = collectionOf(block.collection);\n body = !collection\n ? <Alert color=\"error\" size=\"small\">The collection &quot;{block.collection}&quot; is not in this view.</Alert>\n : block.type === \"collection\"\n ? <CollectionView block={block} collection={collection}/>\n : <RecordView block={block} collection={collection}/>;\n }\n\n return (\n <div ref={rootRef}\n className={cls(\"flex flex-col gap-4 p-4 w-full min-w-0 bg-surface-sheet overflow-y-auto\", fullscreen && \"h-screen\")}\n style={fullscreen ? undefined : { maxHeight: INLINE_MAX_HEIGHT }}>\n {(heading || canExpand) && (\n <div className=\"flex items-center justify-between gap-3 min-h-8\">\n <Typography variant=\"subtitle2\" noWrap>{heading}</Typography>\n {canExpand && (\n <Tooltip title=\"Expand\">\n <IconButton\n size=\"small\"\n aria-label=\"Expand\"\n onClick={() => void bridge.requestDisplayMode(\"fullscreen\").catch(() => undefined)}\n >\n <Maximize2Icon size={iconSize.smallest}/>\n </IconButton>\n </Tooltip>\n )}\n </div>\n )}\n {body}\n <Dialog open={pending !== undefined} onOpenChange={open => !open && pending?.answer(false)} maxWidth=\"sm\">\n <DialogTitle variant=\"subtitle1\">Confirm this change</DialogTitle>\n <DialogContent className=\"flex flex-col gap-2\">\n <Typography variant=\"body2\">{pending?.plan.summary}</Typography>\n {pending?.plan.effects?.map(effect => (\n <Typography key={effect} variant=\"body2\" color=\"secondary\">{effect}</Typography>\n ))}\n {pending?.plan.reversible && (\n <Typography variant=\"caption\" color=\"secondary\">Undo: {pending.plan.reversible}</Typography>\n )}\n </DialogContent>\n <DialogActions>\n <Button variant=\"text\" color=\"neutral\" onClick={() => pending?.answer(false)}>Cancel</Button>\n <Button variant=\"filled\" color=\"primary\" onClick={() => pending?.answer(true)}>Save</Button>\n </DialogActions>\n </Dialog>\n </div>\n );\n}\n\nfunction blockTitle(block: CollectionBlock | RecordBlock, collection: AdminCollection | undefined): string {\n if (block.type === \"record\") {\n const name = collection?.singularName ?? collection?.name ?? block.collection;\n return block.id === undefined ? `New ${name.toLowerCase()}` : name;\n }\n return collection?.name ?? block.collection;\n}\n\n/**\n * show_collection: the admin panel's collection view, where a row opens its\n * form over the screen. It sizes to its rows, up to what the screen leaves\n * it — inline, the screen's height cap; full screen, the window — and then\n * scrolls inside.\n */\nfunction CollectionView({ block, collection }: {\n block: CollectionBlock;\n collection: AdminCollection;\n}) {\n const overrides = useMemo<Partial<AdminCollection>>(() => {\n // The model's filter, as one the person can clear.\n const where = filterOf(block.where);\n return {\n ...(where && { defaultFilter: where }),\n ...(block.limit !== undefined && { pagination: block.limit })\n };\n }, [block.where, block.limit]);\n const sort = orderOf(block.orderBy);\n\n return (\n <CollectionPanel\n collection={collection.slug}\n title={false}\n className=\"flex-1 rounded-xl overflow-hidden\"\n {...(block.view && { viewMode: block.view })}\n {...(sort && { orderBy: sort })}\n collectionOverrides={overrides}\n />\n );\n}\n\n/** show_record: the admin panel's form, for a row or a new one. */\nfunction RecordView({ block, collection }: { block: RecordBlock; collection: AdminCollection }) {\n // A new row's form becomes that row's once it is saved.\n const [created, setCreated] = useState<string | number>();\n const id = block.id ?? created;\n return (\n <Card className=\"min-w-0 overflow-hidden\">\n <RecordForm\n key={String(id ?? \"new\")}\n collection={collection}\n id={id}\n {...(id === undefined && block.values && { defaultValues: block.values })}\n onSaved={params => {\n if (id === undefined) setCreated(params.id);\n }}\n />\n </Card>\n );\n}\n\n/**\n * show_app: the app the model wrote, held to the collections it was opened\n * with, and its failure shown in its place.\n */\nfunction AppView({ block, onError }: {\n block: AppBlock;\n onError: (error: AppError) => void;\n}) {\n const loaded = useMemo(() => loadApp(block.code), [block.code]);\n\n // A module that failed as it loaded is told once.\n useEffect(() => {\n if (loaded.error) onError(loaded.error);\n }, [loaded, onError]);\n\n const failure = (error: AppError) => (\n <Alert color=\"error\" size=\"small\">\n The app failed{error.line ? ` at line ${error.line}` : \"\"}: {error.message}\n </Alert>\n );\n if (!loaded.Component) return failure(loaded.error ?? { message: \"The app did not load.\" });\n const { Component } = loaded;\n return (\n <AppErrorBoundary lineOffset={loaded.lineOffset} onError={onError} fallback={failure}>\n <AppCollections names={block.collections}>\n <Component/>\n </AppCollections>\n </AppErrorBoundary>\n );\n}\n"],"mappings":"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"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The storage the admin panel's file fields and previews ask, in a view that
3
+ * can fetch nothing of its own.
4
+ *
5
+ * A field that stores a file holds its path, and a preview asks the storage
6
+ * source for an address to draw it from — a customer's avatar beside their
7
+ * name, in every row that points at them. With no storage source that asked
8
+ * nothing and threw. Here an address the field already holds is its own
9
+ * address (the host may still refuse to load it, and the preview then shows
10
+ * its placeholder); a path names nothing the view can reach, and draws as a
11
+ * file that is not there. Nothing is uploaded or deleted from here.
12
+ */
13
+ import type { StorageSource } from "@rebasepro/types";
14
+ export declare const VIEW_STORAGE_SOURCE: StorageSource;
@@ -0,0 +1,29 @@
1
+ //#region src/mcp_view/storage_source.ts
2
+ var UNAVAILABLE = "Files cannot be uploaded or removed from this view. Open the project's admin panel to change them.";
3
+ var VIEW_STORAGE_SOURCE = {
4
+ async getSignedUrl(keyOrUrl) {
5
+ return /^https?:\/\//i.test(keyOrUrl) ? { url: keyOrUrl } : {
6
+ url: null,
7
+ fileNotFound: true
8
+ };
9
+ },
10
+ async getObject() {
11
+ return null;
12
+ },
13
+ async putObject() {
14
+ throw new Error(UNAVAILABLE);
15
+ },
16
+ async deleteObject() {
17
+ throw new Error(UNAVAILABLE);
18
+ },
19
+ async listObjects() {
20
+ return {
21
+ prefixes: [],
22
+ items: []
23
+ };
24
+ }
25
+ };
26
+ //#endregion
27
+ export { VIEW_STORAGE_SOURCE };
28
+
29
+ //# sourceMappingURL=storage_source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage_source.js","names":[],"sources":["../../src/mcp_view/storage_source.ts"],"sourcesContent":["/**\n * The storage the admin panel's file fields and previews ask, in a view that\n * can fetch nothing of its own.\n *\n * A field that stores a file holds its path, and a preview asks the storage\n * source for an address to draw it from — a customer's avatar beside their\n * name, in every row that points at them. With no storage source that asked\n * nothing and threw. Here an address the field already holds is its own\n * address (the host may still refuse to load it, and the preview then shows\n * its placeholder); a path names nothing the view can reach, and draws as a\n * file that is not there. Nothing is uploaded or deleted from here.\n */\nimport type { StorageSource } from \"@rebasepro/types\";\n\nconst UNAVAILABLE = \"Files cannot be uploaded or removed from this view. Open the project's admin panel to change them.\";\n\nexport const VIEW_STORAGE_SOURCE: StorageSource = {\n async getSignedUrl(keyOrUrl) {\n return /^https?:\\/\\//i.test(keyOrUrl) ? { url: keyOrUrl } : { url: null, fileNotFound: true };\n },\n async getObject() {\n return null;\n },\n async putObject() {\n throw new Error(UNAVAILABLE);\n },\n async deleteObject() {\n throw new Error(UNAVAILABLE);\n },\n async listObjects() {\n return { prefixes: [], items: [] };\n }\n};\n"],"mappings":";AAcA,IAAM,cAAc;AAEpB,IAAa,sBAAqC;CAC9C,MAAM,aAAa,UAAU;EACzB,OAAO,gBAAgB,KAAK,QAAQ,IAAI,EAAE,KAAK,SAAS,IAAI;GAAE,KAAK;GAAM,cAAc;EAAK;CAChG;CACA,MAAM,YAAY;EACd,OAAO;CACX;CACA,MAAM,YAAY;EACd,MAAM,IAAI,MAAM,WAAW;CAC/B;CACA,MAAM,eAAe;EACjB,MAAM,IAAI,MAAM,WAAW;CAC/B;CACA,MAAM,cAAc;EAChB,OAAO;GAAE,UAAU,CAAC;GAAG,OAAO,CAAC;EAAE;CACrC;AACJ"}
@@ -0,0 +1,9 @@
1
+ /** A value set from outside React — by the host's messages — and read by components. */
2
+ export interface ViewStore<T> {
3
+ get(): T;
4
+ set(value: T): void;
5
+ subscribe(listener: () => void): () => void;
6
+ }
7
+ export declare function createViewStore<T>(initial: T): ViewStore<T>;
8
+ /** The store's value, re-rendering when it changes. */
9
+ export declare function useViewStore<T>(store: ViewStore<T>): T;
@@ -0,0 +1,27 @@
1
+ import { useSyncExternalStore } from "react";
2
+ //#region src/mcp_view/store.ts
3
+ function createViewStore(initial) {
4
+ let value = initial;
5
+ const listeners = /* @__PURE__ */ new Set();
6
+ return {
7
+ get: () => value,
8
+ set(next) {
9
+ value = next;
10
+ for (const listener of listeners) listener();
11
+ },
12
+ subscribe(listener) {
13
+ listeners.add(listener);
14
+ return () => {
15
+ listeners.delete(listener);
16
+ };
17
+ }
18
+ };
19
+ }
20
+ /** The store's value, re-rendering when it changes. */
21
+ function useViewStore(store) {
22
+ return useSyncExternalStore(store.subscribe, store.get, store.get);
23
+ }
24
+ //#endregion
25
+ export { createViewStore, useViewStore };
26
+
27
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","names":[],"sources":["../../src/mcp_view/store.ts"],"sourcesContent":["import { useSyncExternalStore } from \"react\";\n\n/** A value set from outside React — by the host's messages — and read by components. */\nexport interface ViewStore<T> {\n get(): T;\n set(value: T): void;\n subscribe(listener: () => void): () => void;\n}\n\nexport function createViewStore<T>(initial: T): ViewStore<T> {\n let value = initial;\n const listeners = new Set<() => void>();\n return {\n get: () => value,\n set(next) {\n value = next;\n for (const listener of listeners) listener();\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n }\n };\n}\n\n/** The store's value, re-rendering when it changes. */\nexport function useViewStore<T>(store: ViewStore<T>): T {\n return useSyncExternalStore(store.subscribe, store.get, store.get);\n}\n"],"mappings":";;AASA,SAAgB,gBAAmB,SAA0B;CACzD,IAAI,QAAQ;CACZ,MAAM,4BAAY,IAAI,IAAgB;CACtC,OAAO;EACH,WAAW;EACX,IAAI,MAAM;GACN,QAAQ;GACR,KAAK,MAAM,YAAY,WAAW,SAAS;EAC/C;EACA,UAAU,UAAU;GAChB,UAAU,IAAI,QAAQ;GACtB,aAAa;IACT,UAAU,OAAO,QAAQ;GAC7B;EACJ;CACJ;AACJ;;AAGA,SAAgB,aAAgB,OAAwB;CACpD,OAAO,qBAAqB,MAAM,WAAW,MAAM,KAAK,MAAM,GAAG;AACrE"}
@@ -0,0 +1,135 @@
1
+ /**
2
+ * The admin panel's data layer, over the MCP tools of the server that served
3
+ * this view.
4
+ *
5
+ * `<Rebase>` reads and writes through a `DataDriver`; this one turns each read
6
+ * and write into a `tools/call` the host relays to the server — the same
7
+ * tools, the same person, the same RLS as the model's own calls. Rows go and
8
+ * come in the REST shape those tools speak (dates as ISO text, a belongsTo as
9
+ * its foreign key); `<Rebase>` turns them into the admin panel's view model
10
+ * and back, as it does for any driver.
11
+ *
12
+ * An app's row hooks (`useRows`, `useAggregate`, …) read the same driver
13
+ * through the flat data layer (`buildRebaseData`), which keeps the wire's
14
+ * rows and takes aggregates from `restFetchService`: here, the aggregate tool.
15
+ *
16
+ * A write the server answers with a plan (the hosted connector's two-step
17
+ * `write`) is held: the person is shown the plan and the write is sent again
18
+ * with its token only if they confirm. The row hooks write through
19
+ * `confirmingDriver`, which asks the person before any other write too: code
20
+ * can write without a click, while a save made with the admin's own controls
21
+ * was the person's click. Either way the admin panel sees one save that took
22
+ * a moment longer, or one that failed with "Not saved".
23
+ *
24
+ * The driver does not subscribe (no `listenCollection`/`listenOne`): every
25
+ * write it makes comes through `<Rebase>`'s data layers, which say so on the
26
+ * `<Rebase>`'s change signal, and each view of the collection reads again on
27
+ * it. It learns of no change it did not make — the host relays no other
28
+ * tool's calls — so it has nothing to announce either
29
+ * (`subscribeToExternalChanges`).
30
+ */
31
+ import { type CollectionConfig, type DataDriver } from "@rebasepro/types";
32
+ import { type ToolResult } from "./bridge.js";
33
+ /** A tool the view calls, and the arguments it always sends to it. */
34
+ export interface ToolAction {
35
+ tool: string;
36
+ arguments: Record<string, unknown>;
37
+ /**
38
+ * The tool answers a plan before it changes anything (the hosted
39
+ * connector's `write`), so the person confirms there. Not set, a change
40
+ * the row hooks make is confirmed in the view before it is sent.
41
+ */
42
+ plans?: boolean;
43
+ }
44
+ /**
45
+ * The tools the view reads and writes with. The server that served it may
46
+ * name its own (`actions` in a show_* result): the hosted Rebase connector
47
+ * reads with `query` and writes with `write`, each with the project. Absent,
48
+ * they are an app's own `/mcp` tools.
49
+ */
50
+ export interface ViewActions {
51
+ page: ToolAction;
52
+ get: ToolAction;
53
+ count: ToolAction;
54
+ create: ToolAction;
55
+ update: ToolAction;
56
+ delete: ToolAction;
57
+ /** `count`/`sum`/`avg`/`min`/`max` over the matching rows, grouped or not, as REST's `select` and `groupBy`. */
58
+ aggregate: ToolAction;
59
+ }
60
+ export declare const DEFAULT_ACTIONS: ViewActions;
61
+ /** What a write's first call answered instead of running: what it will do, for the person to confirm. */
62
+ export interface WritePlan {
63
+ summary: string;
64
+ effects?: string[];
65
+ reversible?: string;
66
+ }
67
+ /** One change the person made here, as the model is told about it. */
68
+ export interface ViewChange {
69
+ action: "created" | "updated" | "deleted";
70
+ collection: string;
71
+ id: string;
72
+ fields?: string[];
73
+ }
74
+ /** The calls the driver makes: the bridge's `callTool`, as a function so a test can stand in for the host. */
75
+ export type CallTool = (name: string, args: Record<string, unknown>) => Promise<ToolResult>;
76
+ /**
77
+ * A page a result already carries: the rows the server read — for the model
78
+ * (show_collection), or ahead of an app's first render (show_app) — and the
79
+ * arguments it read them with.
80
+ */
81
+ export interface SeedPage {
82
+ collection: string;
83
+ /** As the read tools take them: `where`, `orderBy`, `searchString`, `limit`, `offset`. */
84
+ args: Record<string, unknown>;
85
+ rows: Record<string, unknown>[];
86
+ /** How many rows the read's filter matches, where the server counted them: answers that count, once. */
87
+ total?: number;
88
+ }
89
+ export interface ToolDriverOptions {
90
+ callTool: CallTool;
91
+ actions: ViewActions;
92
+ /** Show the person a write's plan; true when they confirm it. */
93
+ confirm: (plan: WritePlan) => Promise<boolean>;
94
+ /**
95
+ * A page already read: served once in place of the read tool's call, to
96
+ * a read asking for exactly it, and dropped by any write or once it is
97
+ * older than the driver's read cache keeps a row.
98
+ */
99
+ seed?: SeedPage;
100
+ /**
101
+ * Pages read ahead of an app's first render, one per collection it
102
+ * names: each served once as {@link seed} is, its rows answering a read
103
+ * by key, and its `total` the count of the collection's rows.
104
+ */
105
+ seeds?: SeedPage[];
106
+ /** Every change made through this driver, in order, after each one. */
107
+ onChange?: (changes: readonly ViewChange[]) => void;
108
+ /**
109
+ * The collection a name the tools take names — its slug or its data
110
+ * path: an app names collections as the model wrote them, the admin
111
+ * panel by slug. A write's values are sent by its config (a date-only
112
+ * column as its day, a belongsTo under its foreign key), and drop what
113
+ * was read of it under either name.
114
+ */
115
+ collection?: (name: string) => CollectionConfig | undefined;
116
+ }
117
+ export interface ToolDriver {
118
+ /** For `<Rebase>`: the admin panel's reads and saves. */
119
+ driver: DataDriver;
120
+ /**
121
+ * The same driver, asking the person before each write the tool does not
122
+ * plan itself: for the row hooks (`useRowWrites`), since code can write
123
+ * without a click. A declined write rejects with {@link SaveCancelledError}
124
+ * and nothing is sent.
125
+ */
126
+ confirmingDriver: DataDriver;
127
+ }
128
+ /** A save the person declined at the plan. The form shows it as the save's error. */
129
+ export declare class SaveCancelledError extends Error {
130
+ constructor();
131
+ }
132
+ export declare function createToolDriver(options: ToolDriverOptions): ToolDriver;
133
+ export declare function textOf(result: ToolResult): string | undefined;
134
+ /** What the model is told the person changed here, sent with their next message. */
135
+ export declare function describeChanges(changes: readonly ViewChange[]): string;