@rebasepro/cms 0.28.2 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +255 -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 +54 -0
  289. package/dist/mcp_view/index.js +262 -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 +30 -0
  295. package/dist/mcp_view/screen.js +245 -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 +160 -0
  304. package/dist/mcp_view/tool_driver.js +575 -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,245 @@
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 { describeFailedWrite } from "./tool_driver.js";
5
+ import { filterOf, orderOf } from "./payload.js";
6
+ import { AppCollections } from "./app_modules.js";
7
+ import { AppErrorBoundary, loadApp } from "./code_app.js";
8
+ import { createViewStore, useViewStore } from "./store.js";
9
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ import { Alert, Button, Card, CircularProgress, Dialog, DialogActions, DialogContent, DialogTitle, IconButton, Maximize2Icon, Tooltip, Typography, cls, iconSize } from "@rebasepro/ui";
12
+ //#region src/mcp_view/screen.tsx
13
+ /**
14
+ * The tallest the screen is in the conversation; past it, a collection
15
+ * scrolls inside its own block, and anything else inside the screen. A
16
+ * record's form and the confirmation of a save open over the frame, centred
17
+ * in it: in a frame as tall as everything on the screen they would open where
18
+ * the person is not looking.
19
+ */
20
+ var INLINE_MAX_HEIGHT = 640;
21
+ /**
22
+ * What the embedded app's shell draws (`renderCms` of the embed host): the
23
+ * one block the tool opened — a collection, a record, or an app the model
24
+ * wrote — inside the providers the app's own `<RebaseShell>` set up, so its
25
+ * collections, custom views, entity views, fields and actions are the ones
26
+ * drawn.
27
+ */
28
+ function McpScreen({ bridge, screen, hostContext, pendingPlan, writeFailure, onAppError }) {
29
+ const rootRef = useRef(null);
30
+ const context = useViewStore(hostContext);
31
+ const pending = useViewStore(pendingPlan);
32
+ const [refused, dismissRefused] = useRefusedWrite(writeFailure);
33
+ const registry = useCollectionRegistryController();
34
+ const fullscreen = context.displayMode === "fullscreen";
35
+ const canExpand = !fullscreen && context.availableDisplayModes?.includes("fullscreen") === true;
36
+ const block = screen.blocks[0];
37
+ useEffect(() => {
38
+ const root = rootRef.current;
39
+ if (!root) return;
40
+ const measure = () => {
41
+ const html = document.documentElement;
42
+ const previous = html.style.height;
43
+ html.style.height = "max-content";
44
+ bridge.sizeChanged(Math.ceil(html.getBoundingClientRect().height));
45
+ html.style.height = previous;
46
+ };
47
+ const observer = new ResizeObserver(measure);
48
+ observer.observe(root);
49
+ measure();
50
+ return () => observer.disconnect();
51
+ }, [bridge]);
52
+ const collectionOf = (name) => registry.getCollection(name);
53
+ const heading = screen.title ?? (block.type === "app" ? void 0 : blockTitle(block, collectionOf(block.collection)));
54
+ let body;
55
+ if (!registry.initialised && !registry.collections?.length) body = /* @__PURE__ */ jsx(CircularProgress, { size: "smallest" });
56
+ else if (block.type === "app") body = /* @__PURE__ */ jsx(AppView, {
57
+ block,
58
+ onError: onAppError
59
+ });
60
+ else {
61
+ const collection = collectionOf(block.collection);
62
+ body = !collection ? /* @__PURE__ */ jsxs(Alert, {
63
+ color: "error",
64
+ size: "small",
65
+ children: [
66
+ "The collection \"",
67
+ block.collection,
68
+ "\" is not in this view."
69
+ ]
70
+ }) : block.type === "collection" ? /* @__PURE__ */ jsx(CollectionView, {
71
+ block,
72
+ collection
73
+ }) : /* @__PURE__ */ jsx(RecordView, {
74
+ block,
75
+ collection
76
+ });
77
+ }
78
+ return /* @__PURE__ */ jsxs("div", {
79
+ ref: rootRef,
80
+ className: cls("flex flex-col gap-4 p-4 w-full min-w-0 bg-surface-sheet overflow-y-auto", fullscreen && "h-screen"),
81
+ style: fullscreen ? void 0 : { maxHeight: INLINE_MAX_HEIGHT },
82
+ children: [
83
+ (heading || canExpand) && /* @__PURE__ */ jsxs("div", {
84
+ className: "flex items-center justify-between gap-3 min-h-8",
85
+ children: [/* @__PURE__ */ jsx(Typography, {
86
+ variant: "subtitle2",
87
+ noWrap: true,
88
+ children: heading
89
+ }), canExpand && /* @__PURE__ */ jsx(Tooltip, {
90
+ title: "Expand",
91
+ children: /* @__PURE__ */ jsx(IconButton, {
92
+ size: "small",
93
+ "aria-label": "Expand",
94
+ onClick: () => void bridge.requestDisplayMode("fullscreen").catch(() => void 0),
95
+ children: /* @__PURE__ */ jsx(Maximize2Icon, { size: iconSize.smallest })
96
+ })
97
+ })]
98
+ }),
99
+ refused && /* @__PURE__ */ jsx(Alert, {
100
+ color: "error",
101
+ size: "small",
102
+ outerClassName: "sticky top-0 z-10",
103
+ onDismiss: dismissRefused,
104
+ children: `Could not ${describeFailedWrite(refused)}: ${refused.message}`
105
+ }),
106
+ body,
107
+ /* @__PURE__ */ jsxs(Dialog, {
108
+ open: pending !== void 0,
109
+ onOpenChange: (open) => !open && pending?.answer(false),
110
+ maxWidth: "sm",
111
+ children: [
112
+ /* @__PURE__ */ jsx(DialogTitle, {
113
+ variant: "subtitle1",
114
+ children: "Confirm this change"
115
+ }),
116
+ /* @__PURE__ */ jsxs(DialogContent, {
117
+ className: "flex flex-col gap-2",
118
+ children: [
119
+ /* @__PURE__ */ jsx(Typography, {
120
+ variant: "body2",
121
+ children: pending?.plan.summary
122
+ }),
123
+ pending?.plan.effects?.map((effect) => /* @__PURE__ */ jsx(Typography, {
124
+ variant: "body2",
125
+ color: "secondary",
126
+ children: effect
127
+ }, effect)),
128
+ pending?.plan.reversible && /* @__PURE__ */ jsxs(Typography, {
129
+ variant: "caption",
130
+ color: "secondary",
131
+ children: ["Undo: ", pending.plan.reversible]
132
+ })
133
+ ]
134
+ }),
135
+ /* @__PURE__ */ jsxs(DialogActions, { children: [/* @__PURE__ */ jsx(Button, {
136
+ variant: "text",
137
+ color: "neutral",
138
+ onClick: () => pending?.answer(false),
139
+ children: "Cancel"
140
+ }), /* @__PURE__ */ jsx(Button, {
141
+ variant: "filled",
142
+ color: "primary",
143
+ onClick: () => pending?.answer(true),
144
+ children: "Save"
145
+ })] })
146
+ ]
147
+ })
148
+ ]
149
+ });
150
+ }
151
+ function blockTitle(block, collection) {
152
+ if (block.type === "record") {
153
+ const name = collection?.singularName ?? collection?.name ?? block.collection;
154
+ return block.id === void 0 ? `New ${name.toLowerCase()}` : name;
155
+ }
156
+ return collection?.name ?? block.collection;
157
+ }
158
+ /**
159
+ * show_collection: the admin panel's collection view, where a row opens its
160
+ * form over the screen. It sizes to its rows, up to what the screen leaves
161
+ * it — inline, the screen's height cap; full screen, the window — and then
162
+ * scrolls inside.
163
+ */
164
+ function CollectionView({ block, collection }) {
165
+ const overrides = useMemo(() => {
166
+ const where = filterOf(block.where);
167
+ return {
168
+ ...where && { defaultFilter: where },
169
+ ...block.limit !== void 0 && { pagination: block.limit }
170
+ };
171
+ }, [block.where, block.limit]);
172
+ const sort = orderOf(block.orderBy);
173
+ return /* @__PURE__ */ jsx(CollectionPanel, {
174
+ collection: collection.slug,
175
+ title: false,
176
+ className: "flex-1 rounded-xl overflow-hidden",
177
+ ...block.view && { viewMode: block.view },
178
+ ...sort && { orderBy: sort },
179
+ collectionOverrides: overrides
180
+ });
181
+ }
182
+ /** show_record: the admin panel's form, for a row or a new one. */
183
+ function RecordView({ block, collection }) {
184
+ const [created, setCreated] = useState();
185
+ const id = block.id ?? created;
186
+ return /* @__PURE__ */ jsx(Card, {
187
+ className: "min-w-0 overflow-hidden",
188
+ children: /* @__PURE__ */ jsx(RecordForm, {
189
+ collection,
190
+ id,
191
+ ...id === void 0 && block.values && { defaultValues: block.values },
192
+ onSaved: (params) => {
193
+ if (id === void 0) setCreated(params.id);
194
+ }
195
+ }, String(id ?? "new"))
196
+ });
197
+ }
198
+ /**
199
+ * show_app: the app the model wrote, held to the collections it was opened
200
+ * with, and its failure shown in its place.
201
+ */
202
+ function AppView({ block, onError }) {
203
+ const loaded = useMemo(() => loadApp(block.code), [block.code]);
204
+ useEffect(() => {
205
+ if (loaded.error) onError(loaded.error);
206
+ }, [loaded, onError]);
207
+ const failure = (error) => /* @__PURE__ */ jsxs(Alert, {
208
+ color: "error",
209
+ size: "small",
210
+ children: [
211
+ "The app failed",
212
+ error.line ? ` at line ${error.line}` : "",
213
+ ": ",
214
+ error.message
215
+ ]
216
+ });
217
+ if (!loaded.Component) return failure(loaded.error ?? { message: "The app did not load." });
218
+ const { Component } = loaded;
219
+ return /* @__PURE__ */ jsx(AppErrorBoundary, {
220
+ lineOffset: loaded.lineOffset,
221
+ onError,
222
+ fallback: failure,
223
+ children: /* @__PURE__ */ jsx(AppCollections, {
224
+ names: block.collections,
225
+ children: /* @__PURE__ */ jsx(Component, {})
226
+ })
227
+ });
228
+ }
229
+ /**
230
+ * The last write the server refused, until the person dismisses it: an app's
231
+ * code can drop the rejection, and a button the app drew shows nothing of its
232
+ * own (the admin's own controls show theirs). Shown in the screen, not as a
233
+ * snackbar, which the sandboxed frame left off its edge.
234
+ */
235
+ function useRefusedWrite(store) {
236
+ const failure = useViewStore(store ?? NO_FAILURES);
237
+ const [dismissed, setDismissed] = useState(void 0);
238
+ const dismiss = useCallback(() => setDismissed(failure), [failure]);
239
+ return [failure !== dismissed ? failure : void 0, dismiss];
240
+ }
241
+ var NO_FAILURES = createViewStore(void 0);
242
+ //#endregion
243
+ export { McpScreen };
244
+
245
+ //# sourceMappingURL=screen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen.js","names":[],"sources":["../../src/mcp_view/screen.tsx"],"sourcesContent":["import React, { useCallback, 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 { describeFailedWrite, type WriteFailure, 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 { createViewStore, 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 /** The last write the server refused, as it changes: shown to the person, once each. */\n writeFailure?: ViewStore<WriteFailure | 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, writeFailure, onAppError }: McpScreenProps) {\n const rootRef = useRef<HTMLDivElement>(null);\n const context = useViewStore(hostContext);\n const pending = useViewStore(pendingPlan);\n const [refused, dismissRefused] = useRefusedWrite(writeFailure);\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 {refused && (\n // Sticky: the inline frame scrolls inside, and the button that\n // wrote may be far below its top.\n <Alert color=\"error\" size=\"small\" outerClassName=\"sticky top-0 z-10\" onDismiss={dismissRefused}>\n {`Could not ${describeFailedWrite(refused)}: ${refused.message}`}\n </Alert>\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\n/**\n * The last write the server refused, until the person dismisses it: an app's\n * code can drop the rejection, and a button the app drew shows nothing of its\n * own (the admin's own controls show theirs). Shown in the screen, not as a\n * snackbar, which the sandboxed frame left off its edge.\n */\nfunction useRefusedWrite(store: ViewStore<WriteFailure | undefined> | undefined): [WriteFailure | undefined, () => void] {\n const failure = useViewStore(store ?? NO_FAILURES);\n const [dismissed, setDismissed] = useState<WriteFailure | undefined>(undefined);\n const dismiss = useCallback(() => setDismissed(failure), [failure]);\n return [failure !== dismissed ? failure : undefined, dismiss];\n}\n\nconst NO_FAILURES = createViewStore<WriteFailure | undefined>(undefined);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmCA,IAAM,oBAAoB;;;;;;;;AA2B1B,SAAgB,UAAU,EAAE,QAAQ,QAAQ,aAAa,aAAa,cAAc,cAA8B;CAC9G,MAAM,UAAU,OAAuB,IAAI;CAC3C,MAAM,UAAU,aAAa,WAAW;CACxC,MAAM,UAAU,aAAa,WAAW;CACxC,MAAM,CAAC,SAAS,kBAAkB,gBAAgB,YAAY;CAC9D,MAAM,WAAW,gCAAgC;CACjD,MAAM,aAAa,QAAQ,gBAAgB;CAC3C,MAAM,YAAY,CAAC,cAAc,QAAQ,uBAAuB,SAAS,YAAY,MAAM;CAC3F,MAAM,QAAQ,OAAO,OAAO;CAI5B,gBAAgB;EACZ,MAAM,OAAO,QAAQ;EACrB,IAAI,CAAC,MAAM;EACX,MAAM,gBAAgB;GAClB,MAAM,OAAO,SAAS;GACtB,MAAM,WAAW,KAAK,MAAM;GAC5B,KAAK,MAAM,SAAS;GACpB,OAAO,YAAY,KAAK,KAAK,KAAK,sBAAsB,CAAC,CAAC,MAAM,CAAC;GACjE,KAAK,MAAM,SAAS;EACxB;EACA,MAAM,WAAW,IAAI,eAAe,OAAO;EAC3C,SAAS,QAAQ,IAAI;EACrB,QAAQ;EACR,aAAa,SAAS,WAAW;CACrC,GAAG,CAAC,MAAM,CAAC;CAEX,MAAM,gBAAgB,SAA8C,SAAS,cAAc,IAAI;CAC/F,MAAM,UAAU,OAAO,UAAU,MAAM,SAAS,QAAQ,KAAA,IAAY,WAAW,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OAAO,GAAG,CAAC,OAAO,CAAC;CAClE,OAAO,CAAC,YAAY,YAAY,UAAU,KAAA,GAAW,OAAO;AAChE;AAEA,IAAM,cAAc,gBAA0C,KAAA,CAAS"}
@@ -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,160 @@
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
+ /** The row as the person knows it — its title — where the driver can tell; see {@link ToolDriverOptions.rowLabel}. */
73
+ label?: string;
74
+ fields?: string[];
75
+ }
76
+ /** A write the server refused: what was tried, on which row, and the server's words. */
77
+ export interface WriteFailure {
78
+ action: "create" | "update" | "delete";
79
+ collection: string;
80
+ /** The row, as {@link ToolDriverOptions.rowLabel} names it; absent for a create. */
81
+ row?: string;
82
+ message: string;
83
+ }
84
+ /** The calls the driver makes: the bridge's `callTool`, as a function so a test can stand in for the host. */
85
+ export type CallTool = (name: string, args: Record<string, unknown>) => Promise<ToolResult>;
86
+ /**
87
+ * A page a result already carries: the rows the server read — for the model
88
+ * (show_collection), or ahead of an app's first render (show_app) — and the
89
+ * arguments it read them with.
90
+ */
91
+ export interface SeedPage {
92
+ collection: string;
93
+ /** As the read tools take them: `where`, `orderBy`, `searchString`, `limit`, `offset`. */
94
+ args: Record<string, unknown>;
95
+ rows: Record<string, unknown>[];
96
+ /** How many rows the read's filter matches, where the server counted them: answers that count, once. */
97
+ total?: number;
98
+ }
99
+ export interface ToolDriverOptions {
100
+ callTool: CallTool;
101
+ actions: ViewActions;
102
+ /** Show the person a write's plan; true when they confirm it. */
103
+ confirm: (plan: WritePlan) => Promise<boolean>;
104
+ /**
105
+ * A page already read: served once in place of the read tool's call, to
106
+ * a read asking for exactly it, and dropped by any write or once it is
107
+ * older than the driver's read cache keeps a row.
108
+ */
109
+ seed?: SeedPage;
110
+ /**
111
+ * Pages read ahead of an app's first render, one per collection it
112
+ * names: each served once as {@link seed} is, its rows answering a read
113
+ * by key, and its `total` the count of the collection's rows.
114
+ */
115
+ seeds?: SeedPage[];
116
+ /** Every change made through this driver, in order, after each one. */
117
+ onChange?: (changes: readonly ViewChange[]) => void;
118
+ /**
119
+ * How a row is named to the person — in a write's confirmation, in a
120
+ * refusal — given the row where the driver has read it: its title, say.
121
+ * Without it, or where it says nothing, `row <id>`.
122
+ */
123
+ rowLabel?: (collection: string, id: string, row: Record<string, unknown> | undefined) => string | undefined;
124
+ /**
125
+ * A write through {@link ToolDriver.confirmingDriver} that the server
126
+ * refused. App code can drop the rejection it gets; this is how the
127
+ * person and the model still learn of it. A write the person declined is
128
+ * not one.
129
+ */
130
+ onWriteFailed?: (failure: WriteFailure) => void;
131
+ /**
132
+ * The collection a name the tools take names — its slug or its data
133
+ * path: an app names collections as the model wrote them, the admin
134
+ * panel by slug. A write's values are sent by its config (a date-only
135
+ * column as its day, a belongsTo under its foreign key), and drop what
136
+ * was read of it under either name.
137
+ */
138
+ collection?: (name: string) => CollectionConfig | undefined;
139
+ }
140
+ export interface ToolDriver {
141
+ /** For `<Rebase>`: the admin panel's reads and saves. */
142
+ driver: DataDriver;
143
+ /**
144
+ * The same driver, asking the person before each write the tool does not
145
+ * plan itself: for the row hooks (`useRowWrites`), since code can write
146
+ * without a click. A declined write rejects with {@link SaveCancelledError}
147
+ * and nothing is sent.
148
+ */
149
+ confirmingDriver: DataDriver;
150
+ }
151
+ /** A save the person declined at the plan. The form shows it as the save's error. */
152
+ export declare class SaveCancelledError extends Error {
153
+ constructor();
154
+ }
155
+ export declare function createToolDriver(options: ToolDriverOptions): ToolDriver;
156
+ export declare function textOf(result: ToolResult): string | undefined;
157
+ /** What the model is told the person changed here, sent with their next message. */
158
+ /** "update ORD-2026-0081 in orders", "create a row in orders". */
159
+ export declare function describeFailedWrite(failure: WriteFailure): string;
160
+ export declare function describeChanges(changes: readonly ViewChange[]): string;