@rebasepro/studio 0.0.1-canary.000dc36

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 (363) hide show
  1. package/LICENSE +114 -0
  2. package/README.md +159 -0
  3. package/dist/ApiExplorer-DHVmWYfK.js +1053 -0
  4. package/dist/ApiExplorer-DHVmWYfK.js.map +1 -0
  5. package/dist/AuthSimulationSelector-CM488Eei.js +106 -0
  6. package/dist/AuthSimulationSelector-CM488Eei.js.map +1 -0
  7. package/dist/BranchesView-DcHZtvXo.js +292 -0
  8. package/dist/BranchesView-DcHZtvXo.js.map +1 -0
  9. package/dist/CronJobsView-CijCToeK.js +456 -0
  10. package/dist/CronJobsView-CijCToeK.js.map +1 -0
  11. package/dist/JSEditor-CSHA0t_O.js +1308 -0
  12. package/dist/JSEditor-CSHA0t_O.js.map +1 -0
  13. package/dist/MonacoEditor-CMYEjiRf.js +161 -0
  14. package/dist/MonacoEditor-CMYEjiRf.js.map +1 -0
  15. package/dist/RLSEditor-BzDjqo6w.js +1872 -0
  16. package/dist/RLSEditor-BzDjqo6w.js.map +1 -0
  17. package/dist/SQLEditor-Cr9Kg_Qg.js +1780 -0
  18. package/dist/SQLEditor-Cr9Kg_Qg.js.map +1 -0
  19. package/dist/SchemaVisualizer-BGpmzyXT.js +1069 -0
  20. package/dist/SchemaVisualizer-BGpmzyXT.js.map +1 -0
  21. package/dist/StorageView-DG9tJZG1.js +811 -0
  22. package/dist/StorageView-DG9tJZG1.js.map +1 -0
  23. package/dist/common/src/collections/CollectionRegistry.d.ts +56 -0
  24. package/dist/common/src/collections/index.d.ts +1 -0
  25. package/dist/common/src/data/buildRebaseData.d.ts +14 -0
  26. package/dist/common/src/index.d.ts +3 -0
  27. package/dist/common/src/util/builders.d.ts +57 -0
  28. package/dist/common/src/util/callbacks.d.ts +6 -0
  29. package/dist/common/src/util/collections.d.ts +11 -0
  30. package/dist/common/src/util/common.d.ts +2 -0
  31. package/dist/common/src/util/conditions.d.ts +26 -0
  32. package/dist/common/src/util/entities.d.ts +58 -0
  33. package/dist/common/src/util/enums.d.ts +3 -0
  34. package/dist/common/src/util/index.d.ts +16 -0
  35. package/dist/common/src/util/navigation_from_path.d.ts +34 -0
  36. package/dist/common/src/util/navigation_utils.d.ts +20 -0
  37. package/dist/common/src/util/parent_references_from_path.d.ts +6 -0
  38. package/dist/common/src/util/paths.d.ts +14 -0
  39. package/dist/common/src/util/permissions.d.ts +5 -0
  40. package/dist/common/src/util/references.d.ts +2 -0
  41. package/dist/common/src/util/relations.d.ts +22 -0
  42. package/dist/common/src/util/resolutions.d.ts +72 -0
  43. package/dist/common/src/util/storage.d.ts +24 -0
  44. package/dist/core/src/components/AIIcon.d.ts +16 -0
  45. package/dist/core/src/components/ConfirmationDialog.d.ts +9 -0
  46. package/dist/core/src/components/Debug/UIReferenceView.d.ts +1 -0
  47. package/dist/core/src/components/Debug/UIStyleGuide.d.ts +1 -0
  48. package/dist/core/src/components/ErrorTooltip.d.ts +2 -0
  49. package/dist/core/src/components/ErrorView.d.ts +21 -0
  50. package/dist/core/src/components/LanguageToggle.d.ts +1 -0
  51. package/dist/core/src/components/LoginView/LoginView.d.ts +68 -0
  52. package/dist/core/src/components/LoginView/index.d.ts +2 -0
  53. package/dist/core/src/components/NotFoundPage.d.ts +1 -0
  54. package/dist/core/src/components/RebaseAuth.d.ts +10 -0
  55. package/dist/core/src/components/RebaseLogo.d.ts +7 -0
  56. package/dist/core/src/components/UnsavedChangesDialog.d.ts +9 -0
  57. package/dist/core/src/components/UserDisplay.d.ts +7 -0
  58. package/dist/core/src/components/UserSelectPopover.d.ts +62 -0
  59. package/dist/core/src/components/UserSettingsView.d.ts +1 -0
  60. package/dist/core/src/components/common/index.d.ts +6 -0
  61. package/dist/core/src/components/common/table_height.d.ts +5 -0
  62. package/dist/core/src/components/common/types.d.ts +63 -0
  63. package/dist/core/src/components/common/useColumnsIds.d.ts +9 -0
  64. package/dist/core/src/components/common/useDataTableController.d.ts +45 -0
  65. package/dist/core/src/components/common/useDebouncedData.d.ts +9 -0
  66. package/dist/core/src/components/common/useScrollRestoration.d.ts +14 -0
  67. package/dist/core/src/components/index.d.ts +16 -0
  68. package/dist/core/src/contexts/AdminModeController.d.ts +4 -0
  69. package/dist/core/src/contexts/AnalyticsContext.d.ts +3 -0
  70. package/dist/core/src/contexts/AuthControllerContext.d.ts +3 -0
  71. package/dist/core/src/contexts/CustomizationControllerContext.d.ts +3 -0
  72. package/dist/core/src/contexts/DataDriverContext.d.ts +3 -0
  73. package/dist/core/src/contexts/DatabaseAdminContext.d.ts +3 -0
  74. package/dist/core/src/contexts/DialogsProvider.d.ts +4 -0
  75. package/dist/core/src/contexts/EffectiveRoleController.d.ts +4 -0
  76. package/dist/core/src/contexts/InternalUserManagementContext.d.ts +3 -0
  77. package/dist/core/src/contexts/ModeController.d.ts +4 -0
  78. package/dist/core/src/contexts/RebaseClientInstanceContext.d.ts +6 -0
  79. package/dist/core/src/contexts/RebaseDataContext.d.ts +3 -0
  80. package/dist/core/src/contexts/SnackbarProvider.d.ts +2 -0
  81. package/dist/core/src/contexts/StorageSourceContext.d.ts +3 -0
  82. package/dist/core/src/contexts/UserConfigurationPersistenceContext.d.ts +3 -0
  83. package/dist/core/src/contexts/index.d.ts +13 -0
  84. package/dist/core/src/core/PluginLifecycleManager.d.ts +17 -0
  85. package/dist/core/src/core/PluginProviderStack.d.ts +21 -0
  86. package/dist/core/src/core/Rebase.d.ts +14 -0
  87. package/dist/core/src/core/RebaseProps.d.ts +136 -0
  88. package/dist/core/src/core/RebaseRouter.d.ts +4 -0
  89. package/dist/core/src/core/RebaseRoutes.d.ts +17 -0
  90. package/dist/core/src/core/index.d.ts +4 -0
  91. package/dist/core/src/hooks/ApiConfigContext.d.ts +24 -0
  92. package/dist/core/src/hooks/data/delete.d.ts +31 -0
  93. package/dist/core/src/hooks/data/save.d.ts +34 -0
  94. package/dist/core/src/hooks/data/useCollectionFetch.d.ts +51 -0
  95. package/dist/core/src/hooks/data/useData.d.ts +13 -0
  96. package/dist/core/src/hooks/data/useDataOrder.d.ts +12 -0
  97. package/dist/core/src/hooks/data/useEntityFetch.d.ts +38 -0
  98. package/dist/core/src/hooks/data/useRelationSelector.d.ts +52 -0
  99. package/dist/core/src/hooks/data/useUserSelector.d.ts +31 -0
  100. package/dist/core/src/hooks/index.d.ts +37 -0
  101. package/dist/core/src/hooks/useAdminModeController.d.ts +19 -0
  102. package/dist/core/src/hooks/useAnalyticsController.d.ts +5 -0
  103. package/dist/core/src/hooks/useAuthController.d.ts +11 -0
  104. package/dist/core/src/hooks/useAuthSubscription.d.ts +2 -0
  105. package/dist/core/src/hooks/useBackendStorageSource.d.ts +30 -0
  106. package/dist/core/src/hooks/useBridgeRegistration.d.ts +18 -0
  107. package/dist/core/src/hooks/useBrowserTitleAndIcon.d.ts +6 -0
  108. package/dist/core/src/hooks/useBuildAdminModeController.d.ts +6 -0
  109. package/dist/core/src/hooks/useBuildEffectiveRoleController.d.ts +8 -0
  110. package/dist/core/src/hooks/useBuildLocalConfigurationPersistence.d.ts +2 -0
  111. package/dist/core/src/hooks/useBuildModeController.d.ts +6 -0
  112. package/dist/core/src/hooks/useClipboard.d.ts +57 -0
  113. package/dist/core/src/hooks/useCollapsedGroups.d.ts +12 -0
  114. package/dist/core/src/hooks/useCustomizationController.d.ts +11 -0
  115. package/dist/core/src/hooks/useDialogsController.d.ts +11 -0
  116. package/dist/core/src/hooks/useEffectiveRoleController.d.ts +7 -0
  117. package/dist/core/src/hooks/useInternalUserManagementController.d.ts +12 -0
  118. package/dist/core/src/hooks/useLargeLayout.d.ts +1 -0
  119. package/dist/core/src/hooks/useModeController.d.ts +19 -0
  120. package/dist/core/src/hooks/usePermissions.d.ts +12 -0
  121. package/dist/core/src/hooks/useRebaseClient.d.ts +5 -0
  122. package/dist/core/src/hooks/useRebaseContext.d.ts +11 -0
  123. package/dist/core/src/hooks/useRebaseRegistry.d.ts +34 -0
  124. package/dist/core/src/hooks/useSlot.d.ts +18 -0
  125. package/dist/core/src/hooks/useSnackbarController.d.ts +20 -0
  126. package/dist/core/src/hooks/useStorageSource.d.ts +7 -0
  127. package/dist/core/src/hooks/useStudioBridge.d.ts +91 -0
  128. package/dist/core/src/hooks/useTranslation.d.ts +17 -0
  129. package/dist/core/src/hooks/useUnsavedChangesDialog.d.ts +12 -0
  130. package/dist/core/src/hooks/useUserConfigurationPersistence.d.ts +8 -0
  131. package/dist/core/src/hooks/useValidateAuthenticator.d.ts +21 -0
  132. package/dist/core/src/i18n/RebaseI18nProvider.d.ts +33 -0
  133. package/dist/core/src/index.d.ts +15 -0
  134. package/dist/core/src/internal/common.d.ts +3 -0
  135. package/dist/core/src/internal/useRestoreScroll.d.ts +6 -0
  136. package/dist/core/src/locales/de.d.ts +2 -0
  137. package/dist/core/src/locales/en.d.ts +10 -0
  138. package/dist/core/src/locales/es.d.ts +10 -0
  139. package/dist/core/src/locales/fr.d.ts +2 -0
  140. package/dist/core/src/locales/hi.d.ts +2 -0
  141. package/dist/core/src/locales/it.d.ts +2 -0
  142. package/dist/core/src/locales/pt.d.ts +7 -0
  143. package/dist/core/src/util/constants.d.ts +1 -0
  144. package/dist/core/src/util/createFormexStub.d.ts +2 -0
  145. package/dist/core/src/util/entity_cache.d.ts +27 -0
  146. package/dist/core/src/util/enums.d.ts +5 -0
  147. package/dist/core/src/util/icon_list.d.ts +5 -0
  148. package/dist/core/src/util/icon_synonyms.d.ts +1 -0
  149. package/dist/core/src/util/icons.d.ts +20 -0
  150. package/dist/core/src/util/index.d.ts +10 -0
  151. package/dist/core/src/util/previews.d.ts +4 -0
  152. package/dist/core/src/util/useStorageUploadController.d.ts +38 -0
  153. package/dist/core/src/util/useTraceUpdate.d.ts +2 -0
  154. package/dist/formex/src/Field.d.ts +52 -0
  155. package/dist/formex/src/Formex.d.ts +7 -0
  156. package/dist/formex/src/index.d.ts +5 -0
  157. package/dist/formex/src/types.d.ts +40 -0
  158. package/dist/formex/src/useCreateFormex.d.ts +14 -0
  159. package/dist/formex/src/utils.d.ts +16 -0
  160. package/dist/index.es.js +726 -0
  161. package/dist/index.es.js.map +1 -0
  162. package/dist/index.umd.js +9567 -0
  163. package/dist/index.umd.js.map +1 -0
  164. package/dist/studio/src/components/ApiExplorer/ApiExplorer.d.ts +9 -0
  165. package/dist/studio/src/components/ApiExplorer/EndpointDetail.d.ts +9 -0
  166. package/dist/studio/src/components/ApiExplorer/TryItPanel.d.ts +15 -0
  167. package/dist/studio/src/components/ApiExplorer/parseSpec.d.ts +16 -0
  168. package/dist/studio/src/components/ApiExplorer/types.d.ts +90 -0
  169. package/dist/studio/src/components/AuthSimulationSelector.d.ts +11 -0
  170. package/dist/studio/src/components/Branches/BranchesView.d.ts +1 -0
  171. package/dist/studio/src/components/CronJobs/CronJobsView.d.ts +1 -0
  172. package/dist/studio/src/components/JSEditor/JSEditor.d.ts +1 -0
  173. package/dist/studio/src/components/JSEditor/JSEditorSidebar.d.ts +21 -0
  174. package/dist/studio/src/components/JSEditor/JSMonacoEditor.d.ts +18 -0
  175. package/dist/studio/src/components/RLSEditor/PolicyEditor.d.ts +9 -0
  176. package/dist/studio/src/components/RLSEditor/RLSEditor.d.ts +19 -0
  177. package/dist/studio/src/components/RLSEditor/index.d.ts +1 -0
  178. package/dist/studio/src/components/RebaseStudio.d.ts +2 -0
  179. package/dist/studio/src/components/SQLEditor/ExplainVisualizer.d.ts +24 -0
  180. package/dist/studio/src/components/SQLEditor/MonacoEditor.d.ts +17 -0
  181. package/dist/studio/src/components/SQLEditor/SQLEditor.d.ts +11 -0
  182. package/dist/studio/src/components/SQLEditor/SQLEditorSidebar.d.ts +21 -0
  183. package/dist/studio/src/components/SQLEditor/SchemaBrowser.d.ts +8 -0
  184. package/dist/studio/src/components/SchemaVisualizer/RelationEdge.d.ts +3 -0
  185. package/dist/studio/src/components/SchemaVisualizer/SchemaVisualizer.d.ts +2 -0
  186. package/dist/studio/src/components/SchemaVisualizer/TableNode.d.ts +3 -0
  187. package/dist/studio/src/components/SchemaVisualizer/index.d.ts +5 -0
  188. package/dist/studio/src/components/SchemaVisualizer/schema-visualizer.utils.d.ts +42 -0
  189. package/dist/studio/src/components/SchemaVisualizer/useSchemaGraph.d.ts +37 -0
  190. package/dist/studio/src/components/StorageView/StorageView.d.ts +1 -0
  191. package/dist/studio/src/components/StudioHomePage.d.ts +9 -0
  192. package/dist/studio/src/index.d.ts +4 -0
  193. package/dist/studio/src/utils/entities.d.ts +0 -0
  194. package/dist/studio/src/utils/pgColumnToProperty.d.ts +6 -0
  195. package/dist/studio/src/utils/sql_utils.d.ts +52 -0
  196. package/dist/types/src/controllers/analytics_controller.d.ts +7 -0
  197. package/dist/types/src/controllers/auth.d.ts +119 -0
  198. package/dist/types/src/controllers/client.d.ts +170 -0
  199. package/dist/types/src/controllers/collection_registry.d.ts +46 -0
  200. package/dist/types/src/controllers/customization_controller.d.ts +60 -0
  201. package/dist/types/src/controllers/data.d.ts +168 -0
  202. package/dist/types/src/controllers/data_driver.d.ts +195 -0
  203. package/dist/types/src/controllers/database_admin.d.ts +11 -0
  204. package/dist/types/src/controllers/dialogs_controller.d.ts +36 -0
  205. package/dist/types/src/controllers/effective_role.d.ts +4 -0
  206. package/dist/types/src/controllers/email.d.ts +34 -0
  207. package/dist/types/src/controllers/index.d.ts +18 -0
  208. package/dist/types/src/controllers/local_config_persistence.d.ts +20 -0
  209. package/dist/types/src/controllers/navigation.d.ts +213 -0
  210. package/dist/types/src/controllers/registry.d.ts +54 -0
  211. package/dist/types/src/controllers/side_dialogs_controller.d.ts +67 -0
  212. package/dist/types/src/controllers/side_entity_controller.d.ts +90 -0
  213. package/dist/types/src/controllers/snackbar.d.ts +24 -0
  214. package/dist/types/src/controllers/storage.d.ts +171 -0
  215. package/dist/types/src/index.d.ts +4 -0
  216. package/dist/types/src/rebase_context.d.ts +105 -0
  217. package/dist/types/src/types/backend.d.ts +536 -0
  218. package/dist/types/src/types/backend_hooks.d.ts +187 -0
  219. package/dist/types/src/types/builders.d.ts +15 -0
  220. package/dist/types/src/types/chips.d.ts +5 -0
  221. package/dist/types/src/types/collections.d.ts +857 -0
  222. package/dist/types/src/types/cron.d.ts +102 -0
  223. package/dist/types/src/types/data_source.d.ts +64 -0
  224. package/dist/types/src/types/entities.d.ts +145 -0
  225. package/dist/types/src/types/entity_actions.d.ts +98 -0
  226. package/dist/types/src/types/entity_callbacks.d.ts +173 -0
  227. package/dist/types/src/types/entity_link_builder.d.ts +7 -0
  228. package/dist/types/src/types/entity_overrides.d.ts +10 -0
  229. package/dist/types/src/types/entity_views.d.ts +59 -0
  230. package/dist/types/src/types/export_import.d.ts +21 -0
  231. package/dist/types/src/types/formex.d.ts +40 -0
  232. package/dist/types/src/types/index.d.ts +25 -0
  233. package/dist/types/src/types/locales.d.ts +4 -0
  234. package/dist/types/src/types/modify_collections.d.ts +5 -0
  235. package/dist/types/src/types/plugins.d.ts +282 -0
  236. package/dist/types/src/types/properties.d.ts +1148 -0
  237. package/dist/types/src/types/property_config.d.ts +70 -0
  238. package/dist/types/src/types/relations.d.ts +336 -0
  239. package/dist/types/src/types/slots.d.ts +262 -0
  240. package/dist/types/src/types/translations.d.ts +874 -0
  241. package/dist/types/src/types/user_management_delegate.d.ts +121 -0
  242. package/dist/types/src/types/websockets.d.ts +78 -0
  243. package/dist/types/src/users/index.d.ts +2 -0
  244. package/dist/types/src/users/roles.d.ts +22 -0
  245. package/dist/types/src/users/user.d.ts +46 -0
  246. package/dist/ui/src/components/Alert.d.ts +12 -0
  247. package/dist/ui/src/components/Autocomplete.d.ts +21 -0
  248. package/dist/ui/src/components/Avatar.d.ts +11 -0
  249. package/dist/ui/src/components/Badge.d.ts +8 -0
  250. package/dist/ui/src/components/BooleanSwitch.d.ts +14 -0
  251. package/dist/ui/src/components/BooleanSwitchWithLabel.d.ts +17 -0
  252. package/dist/ui/src/components/Button.d.ts +14 -0
  253. package/dist/ui/src/components/Card.d.ts +9 -0
  254. package/dist/ui/src/components/CenteredView.d.ts +9 -0
  255. package/dist/ui/src/components/Checkbox.d.ts +13 -0
  256. package/dist/ui/src/components/Chip.d.ts +26 -0
  257. package/dist/ui/src/components/CircularProgress.d.ts +5 -0
  258. package/dist/ui/src/components/CircularProgressCenter.d.ts +11 -0
  259. package/dist/ui/src/components/Collapse.d.ts +9 -0
  260. package/dist/ui/src/components/ColorPicker.d.ts +30 -0
  261. package/dist/ui/src/components/Container.d.ts +8 -0
  262. package/dist/ui/src/components/DateTimeField.d.ts +24 -0
  263. package/dist/ui/src/components/DebouncedTextField.d.ts +2 -0
  264. package/dist/ui/src/components/Dialog.d.ts +39 -0
  265. package/dist/ui/src/components/DialogActions.d.ts +7 -0
  266. package/dist/ui/src/components/DialogContent.d.ts +7 -0
  267. package/dist/ui/src/components/DialogTitle.d.ts +10 -0
  268. package/dist/ui/src/components/ErrorBoundary.d.ts +11 -0
  269. package/dist/ui/src/components/ExpandablePanel.d.ts +12 -0
  270. package/dist/ui/src/components/FileUpload.d.ts +23 -0
  271. package/dist/ui/src/components/IconButton.d.ts +12 -0
  272. package/dist/ui/src/components/InfoLabel.d.ts +5 -0
  273. package/dist/ui/src/components/InputLabel.d.ts +11 -0
  274. package/dist/ui/src/components/Label.d.ts +7 -0
  275. package/dist/ui/src/components/LoadingButton.d.ts +7 -0
  276. package/dist/ui/src/components/Markdown.d.ts +10 -0
  277. package/dist/ui/src/components/Menu.d.ts +23 -0
  278. package/dist/ui/src/components/Menubar.d.ts +80 -0
  279. package/dist/ui/src/components/MultiSelect.d.ts +48 -0
  280. package/dist/ui/src/components/Paper.d.ts +6 -0
  281. package/dist/ui/src/components/Popover.d.ts +24 -0
  282. package/dist/ui/src/components/RadioGroup.d.ts +28 -0
  283. package/dist/ui/src/components/ResizablePanels.d.ts +18 -0
  284. package/dist/ui/src/components/SearchBar.d.ts +22 -0
  285. package/dist/ui/src/components/Select.d.ts +43 -0
  286. package/dist/ui/src/components/Separator.d.ts +5 -0
  287. package/dist/ui/src/components/Sheet.d.ts +22 -0
  288. package/dist/ui/src/components/Skeleton.d.ts +6 -0
  289. package/dist/ui/src/components/Slider.d.ts +21 -0
  290. package/dist/ui/src/components/Table.d.ts +34 -0
  291. package/dist/ui/src/components/Tabs.d.ts +19 -0
  292. package/dist/ui/src/components/TextField.d.ts +58 -0
  293. package/dist/ui/src/components/TextareaAutosize.d.ts +43 -0
  294. package/dist/ui/src/components/ToggleButtonGroup.d.ts +30 -0
  295. package/dist/ui/src/components/Tooltip.d.ts +19 -0
  296. package/dist/ui/src/components/Typography.d.ts +36 -0
  297. package/dist/ui/src/components/VirtualTable/VirtualTable.d.ts +11 -0
  298. package/dist/ui/src/components/VirtualTable/VirtualTableCell.d.ts +21 -0
  299. package/dist/ui/src/components/VirtualTable/VirtualTableHeader.d.ts +29 -0
  300. package/dist/ui/src/components/VirtualTable/VirtualTableHeaderRow.d.ts +2 -0
  301. package/dist/ui/src/components/VirtualTable/VirtualTableProps.d.ts +243 -0
  302. package/dist/ui/src/components/VirtualTable/VirtualTableRow.d.ts +3 -0
  303. package/dist/ui/src/components/VirtualTable/index.d.ts +3 -0
  304. package/dist/ui/src/components/VirtualTable/types.d.ts +38 -0
  305. package/dist/ui/src/components/common/SelectInputLabel.d.ts +5 -0
  306. package/dist/ui/src/components/index.d.ts +53 -0
  307. package/dist/ui/src/hooks/PortalContainerContext.d.ts +31 -0
  308. package/dist/ui/src/hooks/index.d.ts +6 -0
  309. package/dist/ui/src/hooks/useDebounceCallback.d.ts +1 -0
  310. package/dist/ui/src/hooks/useDebounceValue.d.ts +1 -0
  311. package/dist/ui/src/hooks/useDebouncedCallback.d.ts +1 -0
  312. package/dist/ui/src/hooks/useInjectStyles.d.ts +7 -0
  313. package/dist/ui/src/hooks/useOutsideAlerter.d.ts +5 -0
  314. package/dist/ui/src/icons/GitHubIcon.d.ts +2 -0
  315. package/dist/ui/src/icons/HandleIcon.d.ts +1 -0
  316. package/dist/ui/src/icons/Icon.d.ts +20 -0
  317. package/dist/ui/src/icons/cool_icon_keys.d.ts +1 -0
  318. package/dist/ui/src/icons/icon_keys.d.ts +1 -0
  319. package/dist/ui/src/icons/index.d.ts +6 -0
  320. package/dist/ui/src/index.d.ts +5 -0
  321. package/dist/ui/src/styles.d.ts +12 -0
  322. package/dist/ui/src/util/chip_colors.d.ts +4 -0
  323. package/dist/ui/src/util/cls.d.ts +2 -0
  324. package/dist/ui/src/util/debounce.d.ts +10 -0
  325. package/dist/ui/src/util/hash.d.ts +1 -0
  326. package/dist/ui/src/util/index.d.ts +4 -0
  327. package/dist/ui/src/util/key_to_icon_component.d.ts +1 -0
  328. package/package.json +84 -0
  329. package/src/components/ApiExplorer/ApiExplorer.tsx +292 -0
  330. package/src/components/ApiExplorer/EndpointDetail.tsx +271 -0
  331. package/src/components/ApiExplorer/TryItPanel.tsx +486 -0
  332. package/src/components/ApiExplorer/parseSpec.ts +104 -0
  333. package/src/components/ApiExplorer/types.ts +84 -0
  334. package/src/components/AuthSimulationSelector.tsx +73 -0
  335. package/src/components/Branches/BranchesView.tsx +370 -0
  336. package/src/components/CronJobs/CronJobsView.tsx +346 -0
  337. package/src/components/JSEditor/JSEditor.tsx +1033 -0
  338. package/src/components/JSEditor/JSEditorSidebar.tsx +340 -0
  339. package/src/components/JSEditor/JSMonacoEditor.tsx +390 -0
  340. package/src/components/RLSEditor/PolicyEditor.tsx +444 -0
  341. package/src/components/RLSEditor/RLSEditor.tsx +771 -0
  342. package/src/components/RLSEditor/index.ts +1 -0
  343. package/src/components/RebaseStudio.tsx +121 -0
  344. package/src/components/SQLEditor/ExplainVisualizer.tsx +128 -0
  345. package/src/components/SQLEditor/MonacoEditor.tsx +203 -0
  346. package/src/components/SQLEditor/SQLEditor.tsx +1417 -0
  347. package/src/components/SQLEditor/SQLEditorSidebar.tsx +174 -0
  348. package/src/components/SQLEditor/SchemaBrowser.tsx +156 -0
  349. package/src/components/SchemaVisualizer/RelationEdge.tsx +102 -0
  350. package/src/components/SchemaVisualizer/SchemaVisualizer.tsx +663 -0
  351. package/src/components/SchemaVisualizer/TableNode.tsx +257 -0
  352. package/src/components/SchemaVisualizer/index.ts +5 -0
  353. package/src/components/SchemaVisualizer/schema-visualizer.utils.ts +140 -0
  354. package/src/components/SchemaVisualizer/useSchemaGraph.ts +397 -0
  355. package/src/components/StorageView/StorageView.tsx +938 -0
  356. package/src/components/StudioHomePage.tsx +357 -0
  357. package/src/index.ts +31 -0
  358. package/src/utils/entities.ts +2 -0
  359. package/src/utils/pgColumnToProperty.test.ts +401 -0
  360. package/src/utils/pgColumnToProperty.ts +275 -0
  361. package/src/utils/sql_utils.test.ts +265 -0
  362. package/src/utils/sql_utils.ts +291 -0
  363. package/src/vite-env.d.ts +1 -0
@@ -0,0 +1,663 @@
1
+ import React, { useState, useCallback, useMemo, useEffect, useRef } from "react";
2
+ import {
3
+ ReactFlow,
4
+ Controls,
5
+ MiniMap,
6
+ Background,
7
+ BackgroundVariant,
8
+ useReactFlow,
9
+ ReactFlowProvider,
10
+ applyNodeChanges,
11
+ applyEdgeChanges
12
+ } from "@xyflow/react";
13
+ import type { Node, Edge, NodeChange, EdgeChange } from "@xyflow/react";
14
+ import "@xyflow/react/dist/style.css";
15
+ import {
16
+ Button,
17
+ SearchBar,
18
+ TextField,
19
+ Tooltip,
20
+ Alert,
21
+ Typography,
22
+ cls,
23
+ defaultBorderMixin,
24
+ CircularProgress,
25
+ ResizablePanels,
26
+ IconButton
27
+ } from "@rebasepro/ui";
28
+ import {
29
+ useStudioCollectionRegistry,
30
+ IconForView
31
+ } from "@rebasepro/core";
32
+ import type { EntityCollection } from "@rebasepro/types";
33
+ import { isPostgresCollection } from "@rebasepro/types";
34
+ import { useSchemaGraph } from "./useSchemaGraph";
35
+ import type { TableNodeData } from "./useSchemaGraph";
36
+ import { TableNode } from "./TableNode";
37
+ import { RelationEdge } from "./RelationEdge";
38
+
39
+
40
+ // ─── Custom node / edge type registrations ────────────────────────────
41
+
42
+ const nodeTypes = {
43
+ tableNode: TableNode
44
+ };
45
+
46
+ const edgeTypes = {
47
+ relationEdge: RelationEdge
48
+ };
49
+
50
+ // ─── Inner component (needs ReactFlowProvider) ─────────────────────────
51
+
52
+ function SchemaVisualizerCanvas({
53
+ collections
54
+ }: {
55
+ collections: EntityCollection[];
56
+ }) {
57
+ const reactFlowInstance = useReactFlow();
58
+ const {
59
+ nodes: layoutedNodes,
60
+ edges: layoutedEdges,
61
+ direction,
62
+ setDirection,
63
+ relayout,
64
+ tableCount,
65
+ relationCount
66
+ } = useSchemaGraph(collections);
67
+
68
+ const [nodes, setNodes] = useState<Node[]>([]);
69
+ const [edges, setEdges] = useState<Edge[]>([]);
70
+ const [selectedTable, setSelectedTable] = useState<string | null>(null);
71
+ const [searchQuery, setSearchQuery] = useState("");
72
+ const initialFitDone = useRef(false);
73
+
74
+ // Sync layouted data into state
75
+ useEffect(() => {
76
+ setNodes(layoutedNodes);
77
+ setEdges(layoutedEdges);
78
+ }, [layoutedNodes, layoutedEdges]);
79
+
80
+ const onNodesChange = useCallback(
81
+ (changes: NodeChange[]) => setNodes((nds) => applyNodeChanges(changes, nds)),
82
+ []
83
+ );
84
+ const onEdgesChange = useCallback(
85
+ (changes: EdgeChange[]) => setEdges((eds) => applyEdgeChanges(changes, eds)),
86
+ []
87
+ );
88
+
89
+ // Fit view on first load
90
+ useEffect(() => {
91
+ if (nodes.length > 0 && !initialFitDone.current) {
92
+ const timer = setTimeout(() => {
93
+ reactFlowInstance.fitView({ padding: 0.15,
94
+ duration: 400 });
95
+ initialFitDone.current = true;
96
+ }, 200);
97
+ return () => clearTimeout(timer);
98
+ }
99
+ return undefined;
100
+ }, [nodes.length, reactFlowInstance]);
101
+
102
+ const handleFitView = useCallback(() => {
103
+ reactFlowInstance.fitView({ padding: 0.15,
104
+ duration: 400 });
105
+ }, [reactFlowInstance]);
106
+
107
+ const handleNodeClick = useCallback((_: React.MouseEvent, node: Node) => {
108
+ setSelectedTable(node.id);
109
+ }, []);
110
+
111
+ const handlePaneClick = useCallback(() => {
112
+ setSelectedTable(null);
113
+ }, []);
114
+
115
+ // Focus on a table from the sidebar
116
+ const handleTableSelect = useCallback(
117
+ (nodeId: string) => {
118
+ setSelectedTable(nodeId);
119
+ const node = nodes.find((n) => n.id === nodeId);
120
+ if (node) {
121
+ reactFlowInstance.setCenter(
122
+ node.position.x + 140,
123
+ node.position.y + 60,
124
+ { zoom: 1.2,
125
+ duration: 400 }
126
+ );
127
+ }
128
+ },
129
+ [nodes, reactFlowInstance]
130
+ );
131
+
132
+ // Sidebar panel size
133
+ const [sidebarSize, setSidebarSize] = useState(() => {
134
+ try {
135
+ const saved = localStorage.getItem("rebase_schema_viz_sidebar_size");
136
+ return saved !== null ? parseFloat(saved) : 20;
137
+ } catch {
138
+ return 20;
139
+ }
140
+ });
141
+
142
+ useEffect(() => {
143
+ try {
144
+ localStorage.setItem(
145
+ "rebase_schema_viz_sidebar_size",
146
+ sidebarSize.toString()
147
+ );
148
+ } catch {
149
+ // Ignore
150
+ }
151
+ }, [sidebarSize]);
152
+
153
+ // Group collections for sidebar
154
+ const postgresCollections = useMemo(
155
+ () => collections.filter(isPostgresCollection),
156
+ [collections]
157
+ );
158
+
159
+ const filteredCollections = useMemo(() => {
160
+ if (!searchQuery.trim()) return postgresCollections;
161
+ const q = searchQuery.toLowerCase();
162
+ return postgresCollections.filter(
163
+ (c) =>
164
+ c.name.toLowerCase().includes(q) ||
165
+ c.table?.toLowerCase().includes(q) ||
166
+ c.slug?.toLowerCase().includes(q)
167
+ );
168
+ }, [postgresCollections, searchQuery]);
169
+
170
+ // Junction table nodes
171
+ const junctionNodes = useMemo(
172
+ () =>
173
+ nodes.filter(
174
+ (n) => (n.data as TableNodeData).isJunction
175
+ ),
176
+ [nodes]
177
+ );
178
+
179
+ // Stats
180
+ const stats = useMemo(
181
+ () => ({
182
+ tables: tableCount,
183
+ relations: relationCount,
184
+ junctions: junctionNodes.length,
185
+ withRls: postgresCollections.filter(
186
+ (c) =>
187
+ isPostgresCollection(c) &&
188
+ c.securityRules &&
189
+ c.securityRules.length > 0
190
+ ).length
191
+ }),
192
+ [
193
+ tableCount,
194
+ relationCount,
195
+ junctionNodes.length,
196
+ postgresCollections
197
+ ]
198
+ );
199
+
200
+ return (
201
+ <ResizablePanels
202
+ orientation="horizontal"
203
+ panelSizePercent={sidebarSize}
204
+ onPanelSizeChange={setSidebarSize}
205
+ minPanelSizePx={220}
206
+ firstPanel={
207
+ <div
208
+ className={cls(
209
+ "flex flex-col h-full w-full bg-white dark:bg-surface-950 border-r",
210
+ defaultBorderMixin
211
+ )}
212
+ >
213
+ {/* Sidebar header */}
214
+ <div
215
+ className={cls(
216
+ "flex items-center justify-between px-3 py-2 border-b bg-surface-50 dark:bg-surface-900 min-h-[48px]",
217
+ defaultBorderMixin
218
+ )}
219
+ >
220
+ <Typography
221
+ variant="caption"
222
+ className="font-bold uppercase tracking-wider text-text-disabled dark:text-text-disabled-dark"
223
+ >
224
+ Tables
225
+ </Typography>
226
+ <Typography
227
+ variant="caption"
228
+ className="text-[10px] text-text-disabled dark:text-text-disabled-dark font-mono"
229
+ >
230
+ {stats.tables}
231
+ </Typography>
232
+ </div>
233
+
234
+ {/* Search */}
235
+ <div className="px-2 py-1.5 border-b border-surface-200/40 dark:border-surface-700/40">
236
+ <SearchBar
237
+ size="smallest"
238
+ placeholder="Filter tables…"
239
+ onTextSearch={(val) => setSearchQuery(val ?? "")}
240
+ innerClassName="text-xs"
241
+ />
242
+ </div>
243
+
244
+ {/* Table list */}
245
+ <div className="flex-grow overflow-y-auto no-scrollbar p-1">
246
+ {/* Regular collections */}
247
+ <div className="space-y-0.5">
248
+ {filteredCollections.map((collection) => {
249
+ const table = collection.table ?? collection.slug;
250
+ const nodeId = `table-${table}`;
251
+ const isSelected = selectedTable === nodeId;
252
+ return (
253
+ <div
254
+ key={nodeId}
255
+ onClick={() =>
256
+ handleTableSelect(nodeId)
257
+ }
258
+ className={cls(
259
+ "flex items-center p-1.5 cursor-pointer rounded transition-colors group",
260
+ isSelected
261
+ ? "bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-light"
262
+ : "hover:bg-surface-100 dark:hover:bg-surface-950 text-text-secondary dark:text-text-secondary-dark"
263
+ )}
264
+ >
265
+ <div className="shrink-0 mr-1.5 text-text-disabled dark:text-text-disabled-dark">
266
+ <IconForView
267
+ collectionOrView={{
268
+ slug: collection.slug,
269
+ name: collection.name,
270
+ icon:
271
+ typeof collection.icon ===
272
+ "string"
273
+ ? collection.icon
274
+ : undefined
275
+ }}
276
+ size="smallest"
277
+ />
278
+ </div>
279
+ <div className="flex flex-col min-w-0 flex-1">
280
+ <Typography
281
+ variant="caption"
282
+ className="text-xs truncate font-medium"
283
+ >
284
+ {collection.name}
285
+ </Typography>
286
+ {table !== collection.name && (
287
+ <Typography
288
+ variant="caption"
289
+ className="text-[10px] text-text-disabled dark:text-text-disabled-dark font-mono truncate"
290
+ >
291
+ {table}
292
+ </Typography>
293
+ )}
294
+ </div>
295
+ <div className="flex items-center gap-1 shrink-0 ml-1">
296
+ {isPostgresCollection(collection) &&
297
+ collection.securityRules &&
298
+ collection.securityRules
299
+ .length > 0 && (
300
+ <Tooltip title="RLS enabled">
301
+ <div className="w-1.5 h-1.5 rounded-full bg-green-500"/>
302
+ </Tooltip>
303
+ )}
304
+ {collection.history && (
305
+ <Tooltip title="History enabled">
306
+ <div className="w-1.5 h-1.5 rounded-full bg-blue-400"/>
307
+ </Tooltip>
308
+ )}
309
+ </div>
310
+ </div>
311
+ );
312
+ })}
313
+ </div>
314
+
315
+ {/* Junction tables */}
316
+ {junctionNodes.length > 0 && (
317
+ <div className="mt-3">
318
+ <Typography
319
+ variant="caption"
320
+ className="px-1.5 text-[10px] uppercase tracking-wider text-text-disabled dark:text-text-disabled-dark font-medium"
321
+ >
322
+ Junction Tables
323
+ </Typography>
324
+ <div className="mt-1 space-y-0.5">
325
+ {junctionNodes.map((node) => {
326
+ const d =
327
+ node.data as TableNodeData;
328
+ const isSelected =
329
+ selectedTable === node.id;
330
+ return (
331
+ <div
332
+ key={node.id}
333
+ onClick={() =>
334
+ handleTableSelect(
335
+ node.id
336
+ )
337
+ }
338
+ className={cls(
339
+ "flex items-center p-1.5 cursor-pointer rounded transition-colors",
340
+ isSelected
341
+ ? "bg-primary/10 text-primary dark:bg-primary/20"
342
+ : "hover:bg-surface-100 dark:hover:bg-surface-950 text-text-disabled dark:text-text-disabled-dark"
343
+ )}
344
+ >
345
+ <svg
346
+ className="w-3.5 h-3.5 mr-1.5 shrink-0"
347
+ fill="none"
348
+ stroke="currentColor"
349
+ viewBox="0 0 24 24"
350
+ >
351
+ <path
352
+ strokeLinecap="round"
353
+ strokeLinejoin="round"
354
+ strokeWidth={2}
355
+ d="M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"
356
+ />
357
+ </svg>
358
+ <Typography
359
+ variant="caption"
360
+ className="text-xs font-mono truncate"
361
+ >
362
+ {d.tableName}
363
+ </Typography>
364
+ </div>
365
+ );
366
+ })}
367
+ </div>
368
+ </div>
369
+ )}
370
+ </div>
371
+
372
+ {/* Stats footer */}
373
+ <div
374
+ className={cls(
375
+ "px-3 py-2 border-t bg-surface-50 dark:bg-surface-900 space-y-1",
376
+ defaultBorderMixin
377
+ )}
378
+ >
379
+ <div className="flex items-center justify-between">
380
+ <Typography
381
+ variant="caption"
382
+ className="text-[10px] text-text-disabled dark:text-text-disabled-dark"
383
+ >
384
+ Tables
385
+ </Typography>
386
+ <Typography
387
+ variant="caption"
388
+ className="text-[10px] font-mono font-medium"
389
+ >
390
+ {stats.tables}
391
+ </Typography>
392
+ </div>
393
+ <div className="flex items-center justify-between">
394
+ <Typography
395
+ variant="caption"
396
+ className="text-[10px] text-text-disabled dark:text-text-disabled-dark"
397
+ >
398
+ Relations
399
+ </Typography>
400
+ <Typography
401
+ variant="caption"
402
+ className="text-[10px] font-mono font-medium"
403
+ >
404
+ {stats.relations}
405
+ </Typography>
406
+ </div>
407
+ <div className="flex items-center justify-between">
408
+ <Typography
409
+ variant="caption"
410
+ className="text-[10px] text-text-disabled dark:text-text-disabled-dark"
411
+ >
412
+ RLS protected
413
+ </Typography>
414
+ <div className="flex items-center gap-1">
415
+ <div className="w-1.5 h-1.5 rounded-full bg-green-500"/>
416
+ <Typography
417
+ variant="caption"
418
+ className="text-[10px] font-mono font-medium"
419
+ >
420
+ {stats.withRls}
421
+ </Typography>
422
+ </div>
423
+ </div>
424
+ </div>
425
+ </div>
426
+ }
427
+ secondPanel={
428
+ <div className="flex-grow flex flex-col min-w-0 h-full w-full bg-white dark:bg-surface-950">
429
+ {/* Toolbar */}
430
+ <div
431
+ className={cls(
432
+ "flex items-center justify-between pr-2 border-b bg-white dark:bg-surface-950 min-h-[46px]",
433
+ defaultBorderMixin
434
+ )}
435
+ >
436
+ <div className="flex items-center gap-2 px-4">
437
+ <Typography
438
+ variant="subtitle2"
439
+ className="font-mono text-text-secondary dark:text-text-secondary-dark"
440
+ >
441
+ Schema Visualizer
442
+ </Typography>
443
+ </div>
444
+ <div className="flex shrink-0 items-center gap-1.5">
445
+ {/* Direction toggle */}
446
+ <div className="flex items-center bg-surface-100 dark:bg-surface-950 rounded-md border border-surface-200/40 dark:border-surface-700/40">
447
+ <Tooltip title="Left to right layout">
448
+ <Button
449
+ size="small"
450
+ variant={direction === "LR" ? "filled" : "text"}
451
+ color={direction === "LR" ? "primary" : "neutral"}
452
+ onClick={() => setDirection("LR")}
453
+ className="!rounded-r-none !px-2 !py-1 !text-[10px] !font-mono"
454
+ >
455
+ LR
456
+ </Button>
457
+ </Tooltip>
458
+ <Tooltip title="Top to bottom layout">
459
+ <Button
460
+ size="small"
461
+ variant={direction === "TB" ? "filled" : "text"}
462
+ color={direction === "TB" ? "primary" : "neutral"}
463
+ onClick={() => setDirection("TB")}
464
+ className="!rounded-l-none !px-2 !py-1 !text-[10px] !font-mono"
465
+ >
466
+ TB
467
+ </Button>
468
+ </Tooltip>
469
+ </div>
470
+
471
+ <div className="h-4 w-px bg-surface-200 dark:bg-surface-950 mx-0.5"/>
472
+
473
+ {/* Fit view */}
474
+ <Tooltip title="Fit to view">
475
+ <IconButton
476
+ size="small"
477
+ onClick={handleFitView}
478
+ >
479
+ <svg
480
+ className="w-4 h-4"
481
+ fill="none"
482
+ stroke="currentColor"
483
+ viewBox="0 0 24 24"
484
+ >
485
+ <path
486
+ strokeLinecap="round"
487
+ strokeLinejoin="round"
488
+ strokeWidth={2}
489
+ d="M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"
490
+ />
491
+ </svg>
492
+ </IconButton>
493
+ </Tooltip>
494
+
495
+ {/* Re-layout */}
496
+ <Tooltip title="Re-layout">
497
+ <IconButton
498
+ size="small"
499
+ onClick={relayout}
500
+ >
501
+ <svg
502
+ className="w-4 h-4"
503
+ fill="none"
504
+ stroke="currentColor"
505
+ viewBox="0 0 24 24"
506
+ >
507
+ <path
508
+ strokeLinecap="round"
509
+ strokeLinejoin="round"
510
+ strokeWidth={2}
511
+ d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
512
+ />
513
+ </svg>
514
+ </IconButton>
515
+ </Tooltip>
516
+ </div>
517
+ </div>
518
+
519
+ {/* Canvas */}
520
+ <div className="flex-grow relative">
521
+ <ReactFlow
522
+ nodes={nodes}
523
+ edges={edges}
524
+ onNodesChange={onNodesChange}
525
+ onEdgesChange={onEdgesChange}
526
+ onNodeClick={handleNodeClick}
527
+ onPaneClick={handlePaneClick}
528
+ nodeTypes={nodeTypes}
529
+ edgeTypes={edgeTypes}
530
+ fitView
531
+ fitViewOptions={{ padding: 0.15 }}
532
+ minZoom={0.1}
533
+ maxZoom={2}
534
+ proOptions={{ hideAttribution: true }}
535
+ className="bg-surface-50 dark:bg-surface-950"
536
+ >
537
+ <Background
538
+ variant={BackgroundVariant.Dots}
539
+ gap={20}
540
+ size={1}
541
+ className="!bg-surface-50 dark:!bg-surface-950"
542
+ color="var(--rf-bg-dot, #d4d4d8)"
543
+ />
544
+ <Controls
545
+ showInteractive={false}
546
+ className="!bg-white dark:!bg-surface-900 !border !border-surface-200/40 dark:!border-surface-700/40 !shadow-sm !rounded-lg"
547
+ />
548
+ <MiniMap
549
+ nodeStrokeColor={(n) => {
550
+ const d = n.data as TableNodeData;
551
+ if (d.isJunction) return "#a78bfa";
552
+ if (d.rlsEnabled) return "#22c55e";
553
+ return "#6366f1";
554
+ }}
555
+ nodeColor={(n) => {
556
+ const d = n.data as TableNodeData;
557
+ if (d.isJunction) return "#ede9fe";
558
+ return "#eef2ff";
559
+ }}
560
+ maskColor="rgba(0,0,0,0.08)"
561
+ className="!bg-white dark:!bg-surface-900 !border !border-surface-200/40 dark:!border-surface-700/40 !shadow-sm !rounded-lg"
562
+ />
563
+ </ReactFlow>
564
+
565
+ {/* Legend overlay */}
566
+ <div className="absolute bottom-4 left-4 flex items-center gap-3 px-3 py-2 bg-white/90 dark:bg-surface-900/90 backdrop-blur-sm rounded-lg border border-surface-200/40 dark:border-surface-700/40 shadow-sm">
567
+ <div className="flex items-center gap-1.5">
568
+ <div className="w-6 h-0.5 bg-indigo-500 rounded"/>
569
+ <Typography
570
+ variant="caption"
571
+ className="text-[10px] text-text-disabled dark:text-text-disabled-dark"
572
+ >
573
+ Owning
574
+ </Typography>
575
+ </div>
576
+ <div className="flex items-center gap-1.5">
577
+ <div className="w-6 h-0.5 bg-violet-500 rounded"/>
578
+ <Typography
579
+ variant="caption"
580
+ className="text-[10px] text-text-disabled dark:text-text-disabled-dark"
581
+ >
582
+ M:N
583
+ </Typography>
584
+ </div>
585
+ <div className="flex items-center gap-1.5">
586
+ <div
587
+ className="w-6 h-0.5 rounded"
588
+ style={{
589
+ backgroundImage:
590
+ "repeating-linear-gradient(90deg, #94a3b8, #94a3b8 4px, transparent 4px, transparent 7px)"
591
+ }}
592
+ />
593
+ <Typography
594
+ variant="caption"
595
+ className="text-[10px] text-text-disabled dark:text-text-disabled-dark"
596
+ >
597
+ Inverse
598
+ </Typography>
599
+ </div>
600
+ <div className="h-3 w-px bg-surface-200 dark:bg-surface-700"/>
601
+ <div className="flex items-center gap-1">
602
+ <span className="text-[9px]">πŸ”‘</span>
603
+ <Typography
604
+ variant="caption"
605
+ className="text-[10px] text-text-disabled dark:text-text-disabled-dark"
606
+ >
607
+ PK
608
+ </Typography>
609
+ </div>
610
+ <div className="flex items-center gap-1">
611
+ <span className="text-[9px]">πŸ”—</span>
612
+ <Typography
613
+ variant="caption"
614
+ className="text-[10px] text-text-disabled dark:text-text-disabled-dark"
615
+ >
616
+ FK
617
+ </Typography>
618
+ </div>
619
+ </div>
620
+ </div>
621
+ </div>
622
+ }
623
+ />
624
+ );
625
+ }
626
+
627
+ // ─── Outer wrapper (provides ReactFlowProvider) ────────────────────────
628
+
629
+ export const SchemaVisualizer = () => {
630
+ const { collections: registryCollections } =
631
+ useStudioCollectionRegistry() as {
632
+ collections?: EntityCollection[];
633
+ };
634
+
635
+ // Merge registry collections with any passed collections
636
+ const collections = useMemo(() => {
637
+ return registryCollections ?? [];
638
+ }, [registryCollections]);
639
+
640
+ if (!collections || collections.length === 0) {
641
+ return (
642
+ <div className="flex items-center justify-center h-full w-full">
643
+ <div className="text-center space-y-3">
644
+ <CircularProgress size="small"/>
645
+ <Typography
646
+ variant="body2"
647
+ color="secondary"
648
+ >
649
+ Loading schema…
650
+ </Typography>
651
+ </div>
652
+ </div>
653
+ );
654
+ }
655
+
656
+ return (
657
+ <div className="flex h-full w-full bg-white dark:bg-surface-950 overflow-hidden text-text-primary dark:text-text-primary-dark">
658
+ <ReactFlowProvider>
659
+ <SchemaVisualizerCanvas collections={collections}/>
660
+ </ReactFlowProvider>
661
+ </div>
662
+ );
663
+ };