@rebasepro/studio 0.0.1-canary.09e5ec5
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.
- package/LICENSE +114 -0
- package/README.md +159 -0
- package/dist/ApiExplorer-gMJt5JrS.js +1053 -0
- package/dist/ApiExplorer-gMJt5JrS.js.map +1 -0
- package/dist/AuthSimulationSelector-BF4rkRGp.js +118 -0
- package/dist/AuthSimulationSelector-BF4rkRGp.js.map +1 -0
- package/dist/BranchesView-DcHZtvXo.js +292 -0
- package/dist/BranchesView-DcHZtvXo.js.map +1 -0
- package/dist/CronJobsView-CijCToeK.js +456 -0
- package/dist/CronJobsView-CijCToeK.js.map +1 -0
- package/dist/JSEditor-D8nVp3Lp.js +1308 -0
- package/dist/JSEditor-D8nVp3Lp.js.map +1 -0
- package/dist/MonacoEditor-CMYEjiRf.js +161 -0
- package/dist/MonacoEditor-CMYEjiRf.js.map +1 -0
- package/dist/RLSEditor-DBH09u9v.js +1831 -0
- package/dist/RLSEditor-DBH09u9v.js.map +1 -0
- package/dist/SQLEditor-CkVx9vgr.js +1792 -0
- package/dist/SQLEditor-CkVx9vgr.js.map +1 -0
- package/dist/SchemaVisualizer-BgD5Zb77.js +1069 -0
- package/dist/SchemaVisualizer-BgD5Zb77.js.map +1 -0
- package/dist/StorageView-CTqGFhY9.js +907 -0
- package/dist/StorageView-CTqGFhY9.js.map +1 -0
- package/dist/common/src/collections/CollectionRegistry.d.ts +56 -0
- package/dist/common/src/collections/index.d.ts +1 -0
- package/dist/common/src/data/buildRebaseData.d.ts +14 -0
- package/dist/common/src/index.d.ts +3 -0
- package/dist/common/src/util/builders.d.ts +57 -0
- package/dist/common/src/util/callbacks.d.ts +6 -0
- package/dist/common/src/util/collections.d.ts +11 -0
- package/dist/common/src/util/common.d.ts +2 -0
- package/dist/common/src/util/conditions.d.ts +26 -0
- package/dist/common/src/util/entities.d.ts +58 -0
- package/dist/common/src/util/enums.d.ts +3 -0
- package/dist/common/src/util/index.d.ts +16 -0
- package/dist/common/src/util/navigation_from_path.d.ts +34 -0
- package/dist/common/src/util/navigation_utils.d.ts +20 -0
- package/dist/common/src/util/parent_references_from_path.d.ts +6 -0
- package/dist/common/src/util/paths.d.ts +14 -0
- package/dist/common/src/util/permissions.d.ts +5 -0
- package/dist/common/src/util/references.d.ts +2 -0
- package/dist/common/src/util/relations.d.ts +22 -0
- package/dist/common/src/util/resolutions.d.ts +72 -0
- package/dist/common/src/util/storage.d.ts +24 -0
- package/dist/core/src/components/AIIcon.d.ts +16 -0
- package/dist/core/src/components/ConfirmationDialog.d.ts +9 -0
- package/dist/core/src/components/Debug/UIReferenceView.d.ts +1 -0
- package/dist/core/src/components/Debug/UIStyleGuide.d.ts +1 -0
- package/dist/core/src/components/ErrorTooltip.d.ts +2 -0
- package/dist/core/src/components/ErrorView.d.ts +21 -0
- package/dist/core/src/components/LanguageToggle.d.ts +1 -0
- package/dist/core/src/components/LoginView/LoginView.d.ts +68 -0
- package/dist/core/src/components/LoginView/index.d.ts +2 -0
- package/dist/core/src/components/NotFoundPage.d.ts +1 -0
- package/dist/core/src/components/RebaseAuth.d.ts +10 -0
- package/dist/core/src/components/RebaseLogo.d.ts +7 -0
- package/dist/core/src/components/UnsavedChangesDialog.d.ts +9 -0
- package/dist/core/src/components/UserDisplay.d.ts +7 -0
- package/dist/core/src/components/UserSelectPopover.d.ts +62 -0
- package/dist/core/src/components/UserSettingsView.d.ts +1 -0
- package/dist/core/src/components/common/index.d.ts +6 -0
- package/dist/core/src/components/common/table_height.d.ts +5 -0
- package/dist/core/src/components/common/types.d.ts +63 -0
- package/dist/core/src/components/common/useColumnsIds.d.ts +9 -0
- package/dist/core/src/components/common/useDataTableController.d.ts +45 -0
- package/dist/core/src/components/common/useDebouncedData.d.ts +9 -0
- package/dist/core/src/components/common/useScrollRestoration.d.ts +14 -0
- package/dist/core/src/components/index.d.ts +16 -0
- package/dist/core/src/contexts/AdminModeController.d.ts +4 -0
- package/dist/core/src/contexts/AnalyticsContext.d.ts +3 -0
- package/dist/core/src/contexts/AuthControllerContext.d.ts +3 -0
- package/dist/core/src/contexts/CustomizationControllerContext.d.ts +3 -0
- package/dist/core/src/contexts/DataDriverContext.d.ts +3 -0
- package/dist/core/src/contexts/DatabaseAdminContext.d.ts +3 -0
- package/dist/core/src/contexts/DialogsProvider.d.ts +4 -0
- package/dist/core/src/contexts/EffectiveRoleController.d.ts +4 -0
- package/dist/core/src/contexts/InternalUserManagementContext.d.ts +3 -0
- package/dist/core/src/contexts/ModeController.d.ts +4 -0
- package/dist/core/src/contexts/RebaseClientInstanceContext.d.ts +6 -0
- package/dist/core/src/contexts/RebaseDataContext.d.ts +3 -0
- package/dist/core/src/contexts/SnackbarProvider.d.ts +2 -0
- package/dist/core/src/contexts/StorageSourceContext.d.ts +3 -0
- package/dist/core/src/contexts/UserConfigurationPersistenceContext.d.ts +3 -0
- package/dist/core/src/contexts/index.d.ts +13 -0
- package/dist/core/src/core/PluginLifecycleManager.d.ts +17 -0
- package/dist/core/src/core/PluginProviderStack.d.ts +21 -0
- package/dist/core/src/core/Rebase.d.ts +14 -0
- package/dist/core/src/core/RebaseProps.d.ts +136 -0
- package/dist/core/src/core/RebaseRouter.d.ts +4 -0
- package/dist/core/src/core/RebaseRoutes.d.ts +17 -0
- package/dist/core/src/core/index.d.ts +4 -0
- package/dist/core/src/hooks/ApiConfigContext.d.ts +24 -0
- package/dist/core/src/hooks/data/delete.d.ts +31 -0
- package/dist/core/src/hooks/data/save.d.ts +34 -0
- package/dist/core/src/hooks/data/useCollectionFetch.d.ts +51 -0
- package/dist/core/src/hooks/data/useData.d.ts +13 -0
- package/dist/core/src/hooks/data/useDataOrder.d.ts +12 -0
- package/dist/core/src/hooks/data/useEntityFetch.d.ts +38 -0
- package/dist/core/src/hooks/data/useRelationSelector.d.ts +52 -0
- package/dist/core/src/hooks/data/useUserSelector.d.ts +31 -0
- package/dist/core/src/hooks/index.d.ts +37 -0
- package/dist/core/src/hooks/useAdminModeController.d.ts +19 -0
- package/dist/core/src/hooks/useAnalyticsController.d.ts +5 -0
- package/dist/core/src/hooks/useAuthController.d.ts +11 -0
- package/dist/core/src/hooks/useAuthSubscription.d.ts +2 -0
- package/dist/core/src/hooks/useBackendStorageSource.d.ts +30 -0
- package/dist/core/src/hooks/useBridgeRegistration.d.ts +18 -0
- package/dist/core/src/hooks/useBrowserTitleAndIcon.d.ts +6 -0
- package/dist/core/src/hooks/useBuildAdminModeController.d.ts +6 -0
- package/dist/core/src/hooks/useBuildEffectiveRoleController.d.ts +8 -0
- package/dist/core/src/hooks/useBuildLocalConfigurationPersistence.d.ts +2 -0
- package/dist/core/src/hooks/useBuildModeController.d.ts +6 -0
- package/dist/core/src/hooks/useClipboard.d.ts +57 -0
- package/dist/core/src/hooks/useCollapsedGroups.d.ts +12 -0
- package/dist/core/src/hooks/useCustomizationController.d.ts +11 -0
- package/dist/core/src/hooks/useDialogsController.d.ts +11 -0
- package/dist/core/src/hooks/useEffectiveRoleController.d.ts +7 -0
- package/dist/core/src/hooks/useInternalUserManagementController.d.ts +12 -0
- package/dist/core/src/hooks/useLargeLayout.d.ts +1 -0
- package/dist/core/src/hooks/useModeController.d.ts +19 -0
- package/dist/core/src/hooks/usePermissions.d.ts +12 -0
- package/dist/core/src/hooks/useRebaseClient.d.ts +5 -0
- package/dist/core/src/hooks/useRebaseContext.d.ts +11 -0
- package/dist/core/src/hooks/useRebaseRegistry.d.ts +34 -0
- package/dist/core/src/hooks/useSlot.d.ts +18 -0
- package/dist/core/src/hooks/useSnackbarController.d.ts +20 -0
- package/dist/core/src/hooks/useStorageSource.d.ts +7 -0
- package/dist/core/src/hooks/useStudioBridge.d.ts +91 -0
- package/dist/core/src/hooks/useTranslation.d.ts +17 -0
- package/dist/core/src/hooks/useUnsavedChangesDialog.d.ts +12 -0
- package/dist/core/src/hooks/useUserConfigurationPersistence.d.ts +8 -0
- package/dist/core/src/hooks/useValidateAuthenticator.d.ts +21 -0
- package/dist/core/src/i18n/RebaseI18nProvider.d.ts +33 -0
- package/dist/core/src/index.d.ts +15 -0
- package/dist/core/src/internal/common.d.ts +3 -0
- package/dist/core/src/internal/useRestoreScroll.d.ts +6 -0
- package/dist/core/src/locales/de.d.ts +2 -0
- package/dist/core/src/locales/en.d.ts +10 -0
- package/dist/core/src/locales/es.d.ts +10 -0
- package/dist/core/src/locales/fr.d.ts +2 -0
- package/dist/core/src/locales/hi.d.ts +2 -0
- package/dist/core/src/locales/it.d.ts +2 -0
- package/dist/core/src/locales/pt.d.ts +7 -0
- package/dist/core/src/util/constants.d.ts +1 -0
- package/dist/core/src/util/createFormexStub.d.ts +2 -0
- package/dist/core/src/util/entity_cache.d.ts +27 -0
- package/dist/core/src/util/enums.d.ts +5 -0
- package/dist/core/src/util/icon_list.d.ts +5 -0
- package/dist/core/src/util/icon_synonyms.d.ts +1 -0
- package/dist/core/src/util/icons.d.ts +20 -0
- package/dist/core/src/util/index.d.ts +10 -0
- package/dist/core/src/util/previews.d.ts +4 -0
- package/dist/core/src/util/useStorageUploadController.d.ts +38 -0
- package/dist/core/src/util/useTraceUpdate.d.ts +2 -0
- package/dist/formex/src/Field.d.ts +52 -0
- package/dist/formex/src/Formex.d.ts +7 -0
- package/dist/formex/src/index.d.ts +5 -0
- package/dist/formex/src/types.d.ts +40 -0
- package/dist/formex/src/useCreateFormex.d.ts +14 -0
- package/dist/formex/src/utils.d.ts +16 -0
- package/dist/index.es.js +726 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +9647 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/studio/src/components/ApiExplorer/ApiExplorer.d.ts +9 -0
- package/dist/studio/src/components/ApiExplorer/EndpointDetail.d.ts +9 -0
- package/dist/studio/src/components/ApiExplorer/TryItPanel.d.ts +15 -0
- package/dist/studio/src/components/ApiExplorer/parseSpec.d.ts +16 -0
- package/dist/studio/src/components/ApiExplorer/types.d.ts +90 -0
- package/dist/studio/src/components/AuthSimulationSelector.d.ts +11 -0
- package/dist/studio/src/components/Branches/BranchesView.d.ts +1 -0
- package/dist/studio/src/components/CronJobs/CronJobsView.d.ts +1 -0
- package/dist/studio/src/components/JSEditor/JSEditor.d.ts +1 -0
- package/dist/studio/src/components/JSEditor/JSEditorSidebar.d.ts +21 -0
- package/dist/studio/src/components/JSEditor/JSMonacoEditor.d.ts +18 -0
- package/dist/studio/src/components/RLSEditor/PolicyEditor.d.ts +9 -0
- package/dist/studio/src/components/RLSEditor/RLSEditor.d.ts +19 -0
- package/dist/studio/src/components/RLSEditor/index.d.ts +1 -0
- package/dist/studio/src/components/RebaseStudio.d.ts +2 -0
- package/dist/studio/src/components/SQLEditor/ExplainVisualizer.d.ts +24 -0
- package/dist/studio/src/components/SQLEditor/MonacoEditor.d.ts +17 -0
- package/dist/studio/src/components/SQLEditor/SQLEditor.d.ts +11 -0
- package/dist/studio/src/components/SQLEditor/SQLEditorSidebar.d.ts +21 -0
- package/dist/studio/src/components/SQLEditor/SchemaBrowser.d.ts +8 -0
- package/dist/studio/src/components/SchemaVisualizer/RelationEdge.d.ts +3 -0
- package/dist/studio/src/components/SchemaVisualizer/SchemaVisualizer.d.ts +2 -0
- package/dist/studio/src/components/SchemaVisualizer/TableNode.d.ts +3 -0
- package/dist/studio/src/components/SchemaVisualizer/index.d.ts +5 -0
- package/dist/studio/src/components/SchemaVisualizer/schema-visualizer.utils.d.ts +42 -0
- package/dist/studio/src/components/SchemaVisualizer/useSchemaGraph.d.ts +37 -0
- package/dist/studio/src/components/StorageView/StorageView.d.ts +1 -0
- package/dist/studio/src/components/StudioHomePage.d.ts +9 -0
- package/dist/studio/src/index.d.ts +4 -0
- package/dist/studio/src/utils/entities.d.ts +0 -0
- package/dist/studio/src/utils/pgColumnToProperty.d.ts +6 -0
- package/dist/studio/src/utils/sql_utils.d.ts +52 -0
- package/dist/types/src/controllers/analytics_controller.d.ts +7 -0
- package/dist/types/src/controllers/auth.d.ts +119 -0
- package/dist/types/src/controllers/client.d.ts +170 -0
- package/dist/types/src/controllers/collection_registry.d.ts +45 -0
- package/dist/types/src/controllers/customization_controller.d.ts +60 -0
- package/dist/types/src/controllers/data.d.ts +168 -0
- package/dist/types/src/controllers/data_driver.d.ts +160 -0
- package/dist/types/src/controllers/database_admin.d.ts +11 -0
- package/dist/types/src/controllers/dialogs_controller.d.ts +36 -0
- package/dist/types/src/controllers/effective_role.d.ts +4 -0
- package/dist/types/src/controllers/email.d.ts +34 -0
- package/dist/types/src/controllers/index.d.ts +18 -0
- package/dist/types/src/controllers/local_config_persistence.d.ts +20 -0
- package/dist/types/src/controllers/navigation.d.ts +213 -0
- package/dist/types/src/controllers/registry.d.ts +54 -0
- package/dist/types/src/controllers/side_dialogs_controller.d.ts +67 -0
- package/dist/types/src/controllers/side_entity_controller.d.ts +90 -0
- package/dist/types/src/controllers/snackbar.d.ts +24 -0
- package/dist/types/src/controllers/storage.d.ts +171 -0
- package/dist/types/src/index.d.ts +4 -0
- package/dist/types/src/rebase_context.d.ts +105 -0
- package/dist/types/src/types/backend.d.ts +536 -0
- package/dist/types/src/types/builders.d.ts +15 -0
- package/dist/types/src/types/chips.d.ts +5 -0
- package/dist/types/src/types/collections.d.ts +856 -0
- package/dist/types/src/types/cron.d.ts +102 -0
- package/dist/types/src/types/data_source.d.ts +64 -0
- package/dist/types/src/types/entities.d.ts +145 -0
- package/dist/types/src/types/entity_actions.d.ts +98 -0
- package/dist/types/src/types/entity_callbacks.d.ts +173 -0
- package/dist/types/src/types/entity_link_builder.d.ts +7 -0
- package/dist/types/src/types/entity_overrides.d.ts +10 -0
- package/dist/types/src/types/entity_views.d.ts +61 -0
- package/dist/types/src/types/export_import.d.ts +21 -0
- package/dist/types/src/types/index.d.ts +23 -0
- package/dist/types/src/types/locales.d.ts +4 -0
- package/dist/types/src/types/modify_collections.d.ts +5 -0
- package/dist/types/src/types/plugins.d.ts +279 -0
- package/dist/types/src/types/properties.d.ts +1176 -0
- package/dist/types/src/types/property_config.d.ts +70 -0
- package/dist/types/src/types/relations.d.ts +336 -0
- package/dist/types/src/types/slots.d.ts +252 -0
- package/dist/types/src/types/translations.d.ts +870 -0
- package/dist/types/src/types/user_management_delegate.d.ts +121 -0
- package/dist/types/src/types/websockets.d.ts +78 -0
- package/dist/types/src/users/index.d.ts +2 -0
- package/dist/types/src/users/roles.d.ts +22 -0
- package/dist/types/src/users/user.d.ts +46 -0
- package/dist/ui/src/components/Alert.d.ts +12 -0
- package/dist/ui/src/components/Autocomplete.d.ts +21 -0
- package/dist/ui/src/components/Avatar.d.ts +11 -0
- package/dist/ui/src/components/Badge.d.ts +8 -0
- package/dist/ui/src/components/BooleanSwitch.d.ts +14 -0
- package/dist/ui/src/components/BooleanSwitchWithLabel.d.ts +17 -0
- package/dist/ui/src/components/Button.d.ts +14 -0
- package/dist/ui/src/components/Card.d.ts +9 -0
- package/dist/ui/src/components/CenteredView.d.ts +9 -0
- package/dist/ui/src/components/Checkbox.d.ts +13 -0
- package/dist/ui/src/components/Chip.d.ts +26 -0
- package/dist/ui/src/components/CircularProgress.d.ts +5 -0
- package/dist/ui/src/components/CircularProgressCenter.d.ts +11 -0
- package/dist/ui/src/components/Collapse.d.ts +9 -0
- package/dist/ui/src/components/ColorPicker.d.ts +30 -0
- package/dist/ui/src/components/Container.d.ts +8 -0
- package/dist/ui/src/components/DateTimeField.d.ts +24 -0
- package/dist/ui/src/components/DebouncedTextField.d.ts +2 -0
- package/dist/ui/src/components/Dialog.d.ts +39 -0
- package/dist/ui/src/components/DialogActions.d.ts +7 -0
- package/dist/ui/src/components/DialogContent.d.ts +7 -0
- package/dist/ui/src/components/DialogTitle.d.ts +10 -0
- package/dist/ui/src/components/ErrorBoundary.d.ts +11 -0
- package/dist/ui/src/components/ExpandablePanel.d.ts +12 -0
- package/dist/ui/src/components/FileUpload.d.ts +23 -0
- package/dist/ui/src/components/IconButton.d.ts +12 -0
- package/dist/ui/src/components/InfoLabel.d.ts +5 -0
- package/dist/ui/src/components/InputLabel.d.ts +11 -0
- package/dist/ui/src/components/Label.d.ts +7 -0
- package/dist/ui/src/components/LoadingButton.d.ts +7 -0
- package/dist/ui/src/components/Markdown.d.ts +10 -0
- package/dist/ui/src/components/Menu.d.ts +23 -0
- package/dist/ui/src/components/Menubar.d.ts +80 -0
- package/dist/ui/src/components/MultiSelect.d.ts +48 -0
- package/dist/ui/src/components/Paper.d.ts +6 -0
- package/dist/ui/src/components/Popover.d.ts +24 -0
- package/dist/ui/src/components/RadioGroup.d.ts +28 -0
- package/dist/ui/src/components/ResizablePanels.d.ts +18 -0
- package/dist/ui/src/components/SearchBar.d.ts +22 -0
- package/dist/ui/src/components/Select.d.ts +43 -0
- package/dist/ui/src/components/Separator.d.ts +5 -0
- package/dist/ui/src/components/Sheet.d.ts +22 -0
- package/dist/ui/src/components/Skeleton.d.ts +6 -0
- package/dist/ui/src/components/Slider.d.ts +21 -0
- package/dist/ui/src/components/Table.d.ts +34 -0
- package/dist/ui/src/components/Tabs.d.ts +19 -0
- package/dist/ui/src/components/TextField.d.ts +58 -0
- package/dist/ui/src/components/TextareaAutosize.d.ts +43 -0
- package/dist/ui/src/components/ToggleButtonGroup.d.ts +30 -0
- package/dist/ui/src/components/Tooltip.d.ts +19 -0
- package/dist/ui/src/components/Typography.d.ts +36 -0
- package/dist/ui/src/components/VirtualTable/VirtualTable.d.ts +11 -0
- package/dist/ui/src/components/VirtualTable/VirtualTableCell.d.ts +21 -0
- package/dist/ui/src/components/VirtualTable/VirtualTableHeader.d.ts +29 -0
- package/dist/ui/src/components/VirtualTable/VirtualTableHeaderRow.d.ts +2 -0
- package/dist/ui/src/components/VirtualTable/VirtualTableProps.d.ts +243 -0
- package/dist/ui/src/components/VirtualTable/VirtualTableRow.d.ts +3 -0
- package/dist/ui/src/components/VirtualTable/index.d.ts +3 -0
- package/dist/ui/src/components/VirtualTable/types.d.ts +38 -0
- package/dist/ui/src/components/common/SelectInputLabel.d.ts +5 -0
- package/dist/ui/src/components/index.d.ts +53 -0
- package/dist/ui/src/hooks/PortalContainerContext.d.ts +31 -0
- package/dist/ui/src/hooks/index.d.ts +6 -0
- package/dist/ui/src/hooks/useDebounceCallback.d.ts +1 -0
- package/dist/ui/src/hooks/useDebounceValue.d.ts +1 -0
- package/dist/ui/src/hooks/useDebouncedCallback.d.ts +1 -0
- package/dist/ui/src/hooks/useInjectStyles.d.ts +7 -0
- package/dist/ui/src/hooks/useOutsideAlerter.d.ts +5 -0
- package/dist/ui/src/icons/GitHubIcon.d.ts +2 -0
- package/dist/ui/src/icons/HandleIcon.d.ts +1 -0
- package/dist/ui/src/icons/Icon.d.ts +20 -0
- package/dist/ui/src/icons/cool_icon_keys.d.ts +1 -0
- package/dist/ui/src/icons/icon_keys.d.ts +1 -0
- package/dist/ui/src/icons/index.d.ts +6 -0
- package/dist/ui/src/index.d.ts +5 -0
- package/dist/ui/src/styles.d.ts +12 -0
- package/dist/ui/src/util/chip_colors.d.ts +4 -0
- package/dist/ui/src/util/cls.d.ts +2 -0
- package/dist/ui/src/util/debounce.d.ts +10 -0
- package/dist/ui/src/util/hash.d.ts +1 -0
- package/dist/ui/src/util/index.d.ts +4 -0
- package/dist/ui/src/util/key_to_icon_component.d.ts +1 -0
- package/package.json +84 -0
- package/src/components/ApiExplorer/ApiExplorer.tsx +290 -0
- package/src/components/ApiExplorer/EndpointDetail.tsx +271 -0
- package/src/components/ApiExplorer/TryItPanel.tsx +510 -0
- package/src/components/ApiExplorer/parseSpec.ts +104 -0
- package/src/components/ApiExplorer/types.ts +84 -0
- package/src/components/AuthSimulationSelector.tsx +77 -0
- package/src/components/Branches/BranchesView.tsx +370 -0
- package/src/components/CronJobs/CronJobsView.tsx +346 -0
- package/src/components/JSEditor/JSEditor.tsx +1033 -0
- package/src/components/JSEditor/JSEditorSidebar.tsx +340 -0
- package/src/components/JSEditor/JSMonacoEditor.tsx +390 -0
- package/src/components/RLSEditor/PolicyEditor.tsx +444 -0
- package/src/components/RLSEditor/RLSEditor.tsx +692 -0
- package/src/components/RLSEditor/index.ts +1 -0
- package/src/components/RebaseStudio.tsx +121 -0
- package/src/components/SQLEditor/ExplainVisualizer.tsx +128 -0
- package/src/components/SQLEditor/MonacoEditor.tsx +203 -0
- package/src/components/SQLEditor/SQLEditor.tsx +1419 -0
- package/src/components/SQLEditor/SQLEditorSidebar.tsx +174 -0
- package/src/components/SQLEditor/SchemaBrowser.tsx +158 -0
- package/src/components/SchemaVisualizer/RelationEdge.tsx +102 -0
- package/src/components/SchemaVisualizer/SchemaVisualizer.tsx +665 -0
- package/src/components/SchemaVisualizer/TableNode.tsx +257 -0
- package/src/components/SchemaVisualizer/index.ts +5 -0
- package/src/components/SchemaVisualizer/schema-visualizer.utils.ts +140 -0
- package/src/components/SchemaVisualizer/useSchemaGraph.ts +397 -0
- package/src/components/StorageView/StorageView.tsx +1035 -0
- package/src/components/StudioHomePage.tsx +357 -0
- package/src/index.ts +31 -0
- package/src/utils/entities.ts +2 -0
- package/src/utils/pgColumnToProperty.test.ts +401 -0
- package/src/utils/pgColumnToProperty.ts +275 -0
- package/src/utils/sql_utils.test.ts +265 -0
- package/src/utils/sql_utils.ts +291 -0
- package/src/vite-env.d.ts +1 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import { Typography, cls, defaultBorderMixin, Tabs, Tab, IconButton , iconSize } from "@rebasepro/ui";
|
|
4
|
+
import { Trash2Icon } from "lucide-react";
|
|
5
|
+
import { useTranslation } from "@rebasepro/core";
|
|
6
|
+
import { SchemaBrowser } from "./SchemaBrowser";
|
|
7
|
+
import { TableInfo } from "./SQLEditor";
|
|
8
|
+
|
|
9
|
+
export interface Snippet {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
sql: string;
|
|
13
|
+
createdAt: number;
|
|
14
|
+
isFavorite?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface SQLEditorSidebarProps {
|
|
18
|
+
onSelectSnippet: (sql: string) => void;
|
|
19
|
+
onTableClick: (tableName: string) => void;
|
|
20
|
+
snippets: Snippet[];
|
|
21
|
+
history: string[];
|
|
22
|
+
onDeleteSnippet: (id: string) => void;
|
|
23
|
+
schemas: Record<string, TableInfo[]>;
|
|
24
|
+
isSchemaLoading: boolean;
|
|
25
|
+
schemaError: string | null;
|
|
26
|
+
onRetrySchema: () => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const SQLEditorSidebar = ({
|
|
30
|
+
onSelectSnippet,
|
|
31
|
+
onTableClick,
|
|
32
|
+
snippets,
|
|
33
|
+
history,
|
|
34
|
+
onDeleteSnippet,
|
|
35
|
+
schemas,
|
|
36
|
+
isSchemaLoading,
|
|
37
|
+
schemaError,
|
|
38
|
+
onRetrySchema
|
|
39
|
+
}: SQLEditorSidebarProps) => {
|
|
40
|
+
const [activeTab, setActiveTab] = useState<"schema" | "snippets" | "history">("schema");
|
|
41
|
+
const { t } = useTranslation();
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div className={cls("flex flex-col h-full w-full bg-white dark:bg-surface-950 border-r", defaultBorderMixin)}>
|
|
45
|
+
<Tabs value={activeTab} onValueChange={(v) => setActiveTab(v as "schema" | "snippets" | "history")} variant="boxy" className="border-b border-surface-200 dark:border-surface-950">
|
|
46
|
+
<Tab value="schema">{t("studio_sql_sidebar_schema")}</Tab>
|
|
47
|
+
<Tab value="snippets">{t("studio_sql_sidebar_snippets")}</Tab>
|
|
48
|
+
<Tab value="history">{t("studio_sql_sidebar_history")}</Tab>
|
|
49
|
+
</Tabs>
|
|
50
|
+
|
|
51
|
+
<div className="flex-grow overflow-hidden relative">
|
|
52
|
+
{activeTab === "schema" && (
|
|
53
|
+
<SchemaBrowser
|
|
54
|
+
onTableClick={onTableClick}
|
|
55
|
+
schemas={schemas}
|
|
56
|
+
isSchemaLoading={isSchemaLoading}
|
|
57
|
+
schemaError={schemaError}
|
|
58
|
+
onRetrySchema={onRetrySchema}
|
|
59
|
+
/>
|
|
60
|
+
)}
|
|
61
|
+
|
|
62
|
+
{activeTab === "snippets" && (() => {
|
|
63
|
+
const favorites = snippets.filter(s => s.isFavorite);
|
|
64
|
+
const others = snippets.filter(s => !s.isFavorite);
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<div className="flex flex-col h-full">
|
|
68
|
+
<div className={cls("flex items-center justify-between px-3 py-2 border-b bg-surface-50 dark:bg-surface-900 min-h-[48px]", defaultBorderMixin)}>
|
|
69
|
+
<Typography variant="caption" className="font-bold uppercase tracking-wider text-text-disabled dark:text-text-disabled-dark">{t("studio_sql_sidebar_snippets")}</Typography>
|
|
70
|
+
</div>
|
|
71
|
+
<div className="flex-grow overflow-y-auto p-2 space-y-2 no-scrollbar">
|
|
72
|
+
{snippets.length === 0 ? (
|
|
73
|
+
<div className="p-4 text-center">
|
|
74
|
+
<Typography variant="caption" className="text-text-disabled dark:text-text-disabled-dark">{t("studio_sql_sidebar_no_snippets")}</Typography>
|
|
75
|
+
</div>
|
|
76
|
+
) : (
|
|
77
|
+
<>
|
|
78
|
+
{favorites.length > 0 && (
|
|
79
|
+
<div className="mb-4">
|
|
80
|
+
<Typography variant="caption" className="text-[10px] font-bold uppercase tracking-wider text-text-disabled dark:text-text-disabled-dark mb-2 px-1 flex items-center">
|
|
81
|
+
<svg className="w-3 h-3 mr-1 text-red-500" fill="currentColor" viewBox="0 0 20 20"><path fillRule="evenodd" d="M3.172 5.172a4 4 0 015.656 0L10 6.343l1.172-1.171a4 4 0 115.656 5.656L10 17.657l-6.828-6.829a4 4 0 010-5.656z" clipRule="evenodd"/></svg>
|
|
82
|
+
Favorites
|
|
83
|
+
</Typography>
|
|
84
|
+
<div className="space-y-2">
|
|
85
|
+
{favorites.map(snippet => (
|
|
86
|
+
<div
|
|
87
|
+
key={snippet.id}
|
|
88
|
+
className={cls("group p-2 rounded border hover:border-surface-400 dark:hover:border-surface-600 bg-white dark:bg-surface-900 transition-all cursor-pointer relative", defaultBorderMixin)}
|
|
89
|
+
onClick={() => onSelectSnippet(snippet.sql)}
|
|
90
|
+
>
|
|
91
|
+
<Typography variant="body2" className="text-text-primary dark:text-text-primary-dark font-medium text-[13px] truncate pr-6">{snippet.name}</Typography>
|
|
92
|
+
<Typography variant="caption" className="text-text-secondary dark:text-text-secondary-dark text-[10px] block mt-1 truncate">{snippet.sql}</Typography>
|
|
93
|
+
<IconButton
|
|
94
|
+
size="smallest"
|
|
95
|
+
className="absolute right-1 top-1 opacity-0 group-hover:opacity-100 text-text-disabled hover:text-red-500 transition-opacity"
|
|
96
|
+
onClick={(e) => {
|
|
97
|
+
e.stopPropagation();
|
|
98
|
+
onDeleteSnippet(snippet.id);
|
|
99
|
+
}}
|
|
100
|
+
>
|
|
101
|
+
<Trash2Icon size={iconSize.smallest}/>
|
|
102
|
+
</IconButton>
|
|
103
|
+
</div>
|
|
104
|
+
))}
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
)}
|
|
108
|
+
{others.length > 0 && (
|
|
109
|
+
<div>
|
|
110
|
+
{favorites.length > 0 && (
|
|
111
|
+
<Typography variant="caption" className="text-[10px] font-bold uppercase tracking-wider text-text-disabled dark:text-text-disabled-dark mb-2 px-1 mt-4">
|
|
112
|
+
Others
|
|
113
|
+
</Typography>
|
|
114
|
+
)}
|
|
115
|
+
<div className="space-y-2">
|
|
116
|
+
{others.map(snippet => (
|
|
117
|
+
<div
|
|
118
|
+
key={snippet.id}
|
|
119
|
+
className={cls("group p-2 rounded border hover:border-surface-400 dark:hover:border-surface-600 bg-white dark:bg-surface-900 transition-all cursor-pointer relative", defaultBorderMixin)}
|
|
120
|
+
onClick={() => onSelectSnippet(snippet.sql)}
|
|
121
|
+
>
|
|
122
|
+
<Typography variant="body2" className="text-text-primary dark:text-text-primary-dark font-medium text-[13px] truncate pr-6">{snippet.name}</Typography>
|
|
123
|
+
<Typography variant="caption" className="text-text-secondary dark:text-text-secondary-dark text-[10px] block mt-1 truncate">{snippet.sql}</Typography>
|
|
124
|
+
<IconButton
|
|
125
|
+
size="smallest"
|
|
126
|
+
className="absolute right-1 top-1 opacity-0 group-hover:opacity-100 text-text-disabled hover:text-red-500 transition-opacity"
|
|
127
|
+
onClick={(e) => {
|
|
128
|
+
e.stopPropagation();
|
|
129
|
+
onDeleteSnippet(snippet.id);
|
|
130
|
+
}}
|
|
131
|
+
>
|
|
132
|
+
<Trash2Icon size={iconSize.smallest}/>
|
|
133
|
+
</IconButton>
|
|
134
|
+
</div>
|
|
135
|
+
))}
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
)}
|
|
139
|
+
</>
|
|
140
|
+
)}
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
144
|
+
})()}
|
|
145
|
+
|
|
146
|
+
{activeTab === "history" && (
|
|
147
|
+
<div className="flex flex-col h-full">
|
|
148
|
+
<div className={cls("flex items-center justify-between px-3 py-2 border-b bg-surface-50 dark:bg-surface-900 min-h-[48px]", defaultBorderMixin)}>
|
|
149
|
+
<Typography variant="caption" className="font-bold uppercase tracking-wider text-text-disabled dark:text-text-disabled-dark">{t("studio_sql_sidebar_history")}</Typography>
|
|
150
|
+
</div>
|
|
151
|
+
<div className="flex-grow overflow-y-auto p-1 space-y-1 no-scrollbar">
|
|
152
|
+
{history.length === 0 ? (
|
|
153
|
+
<div className="p-4 text-center">
|
|
154
|
+
<Typography variant="caption" className="text-text-disabled dark:text-text-disabled-dark">{t("studio_sql_sidebar_no_history")}</Typography>
|
|
155
|
+
</div>
|
|
156
|
+
) : (
|
|
157
|
+
[...history].reverse().map((sql, i) => (
|
|
158
|
+
<div
|
|
159
|
+
key={i}
|
|
160
|
+
className="p-2 py-1.5 rounded hover:bg-surface-100 dark:hover:bg-surface-950 cursor-pointer group transition-colors flex items-start"
|
|
161
|
+
onClick={() => onSelectSnippet(sql)}
|
|
162
|
+
>
|
|
163
|
+
<svg className="w-3 h-3 mt-1 mr-2 text-text-disabled dark:text-text-disabled-dark group-hover:text-primary transition-colors flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
|
|
164
|
+
<Typography variant="caption" className="text-text-secondary dark:text-text-secondary-dark group-hover:text-text-primary dark:group-hover:text-text-primary-dark text-[11px] line-clamp-2 leading-tight flex-grow">{sql}</Typography>
|
|
165
|
+
</div>
|
|
166
|
+
))
|
|
167
|
+
)}
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
)}
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
);
|
|
174
|
+
};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import { Typography, CircularProgress, cls, IconButton, defaultBorderMixin, Menu, MenuItem, Button , iconSize } from "@rebasepro/ui";
|
|
4
|
+
import { CopyIcon, MoreVerticalIcon, RefreshCwIcon } from "lucide-react";
|
|
5
|
+
import { TableInfo } from "./SQLEditor";
|
|
6
|
+
import { ErrorView, useTranslation } from "@rebasepro/core";
|
|
7
|
+
|
|
8
|
+
export const SchemaBrowser = ({
|
|
9
|
+
onTableClick,
|
|
10
|
+
schemas,
|
|
11
|
+
isSchemaLoading,
|
|
12
|
+
schemaError,
|
|
13
|
+
onRetrySchema
|
|
14
|
+
}: {
|
|
15
|
+
onTableClick?: (tableName: string) => void,
|
|
16
|
+
schemas: Record<string, TableInfo[]>,
|
|
17
|
+
isSchemaLoading: boolean,
|
|
18
|
+
schemaError: string | null,
|
|
19
|
+
onRetrySchema: () => void
|
|
20
|
+
}) => {
|
|
21
|
+
const [expandedSchemas, setExpandedSchemas] = useState<Record<string, boolean>>({ public: true });
|
|
22
|
+
const [expandedTables, setExpandedTables] = useState<Record<string, boolean>>({});
|
|
23
|
+
const { t } = useTranslation();
|
|
24
|
+
|
|
25
|
+
if (isSchemaLoading) return <div className="p-4 flex justify-center"><CircularProgress size="small"/></div>;
|
|
26
|
+
if (schemaError) return (
|
|
27
|
+
<div className="p-2">
|
|
28
|
+
<ErrorView error={schemaError} onRetry={onRetrySchema}/>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div className="flex flex-col h-full overflow-hidden">
|
|
34
|
+
<div className={cls("flex items-center justify-between px-3 py-2 border-b bg-surface-50 dark:bg-surface-900 min-h-[48px]", defaultBorderMixin)}>
|
|
35
|
+
<Typography variant="caption" className="font-bold uppercase tracking-wider text-text-disabled dark:text-text-disabled-dark">{t("studio_schema_tables")}</Typography>
|
|
36
|
+
<IconButton size="small" onClick={onRetrySchema} title="Refresh schema">
|
|
37
|
+
<RefreshCwIcon size={iconSize.smallest}/>
|
|
38
|
+
</IconButton>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div className="flex-grow overflow-y-auto no-scrollbar p-1">
|
|
42
|
+
{Object.keys(schemas).length === 0 ? (
|
|
43
|
+
<div className="p-4 text-center">
|
|
44
|
+
<Typography variant="caption" className="text-text-disabled dark:text-text-disabled-dark italic">{t("studio_schema_no_tables")}</Typography>
|
|
45
|
+
</div>
|
|
46
|
+
) : Object.entries(schemas).map(([schemaName, tables]) => (
|
|
47
|
+
<div key={schemaName} className="mb-2">
|
|
48
|
+
<div
|
|
49
|
+
className="flex items-center p-1 cursor-pointer hover:bg-surface-100 dark:hover:bg-surface-950 rounded transition-colors"
|
|
50
|
+
onClick={() => setExpandedSchemas(prev => ({ ...prev,
|
|
51
|
+
[schemaName]: !prev[schemaName] }))}
|
|
52
|
+
>
|
|
53
|
+
<svg className={cls("w-3 h-3 mr-1 transition-transform", expandedSchemas[schemaName] ? "rotate-90" : "")} fill="currentColor" viewBox="0 0 20 20"><path d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"/></svg>
|
|
54
|
+
<Typography variant="body2" className="text-text-primary dark:text-text-primary-dark font-medium text-xs truncate flex-grow">{schemaName}</Typography>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
{expandedSchemas[schemaName] && (
|
|
58
|
+
<div className="ml-3 mt-1 space-y-1">
|
|
59
|
+
{tables.map(table => (
|
|
60
|
+
<div key={table.tableName}>
|
|
61
|
+
<div
|
|
62
|
+
className="flex items-center p-1 cursor-pointer hover:bg-surface-100 dark:hover:bg-surface-950 rounded transition-colors group relative"
|
|
63
|
+
onClick={() => setExpandedTables(prev => ({ ...prev,
|
|
64
|
+
[`${schemaName}.${table.tableName}`]: !prev[`${schemaName}.${table.tableName}`] }))}
|
|
65
|
+
>
|
|
66
|
+
<svg className={cls("w-3 h-3 mr-1 transition-transform shrink-0", expandedTables[`${schemaName}.${table.tableName}`] ? "rotate-90" : "")} fill="currentColor" viewBox="0 0 20 20"><path d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"/></svg>
|
|
67
|
+
<svg className="w-3.5 h-3.5 mr-1 shrink-0 text-text-disabled dark:text-text-disabled-dark" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 10h18M3 14h18m-9-4v8m-7 0h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/></svg>
|
|
68
|
+
<Typography variant="body2" className="text-text-secondary dark:text-text-secondary-dark text-xs truncate flex-1 min-w-0">{table.tableName}</Typography>
|
|
69
|
+
|
|
70
|
+
<div className="flex opacity-0 group-hover:opacity-100 focus-within:opacity-100 absolute right-1 items-center bg-surface-100 dark:bg-surface-950 px-1 gap-1 rounded transition-opacity">
|
|
71
|
+
<IconButton
|
|
72
|
+
size="smallest"
|
|
73
|
+
className="transition-colors text-text-secondary hover:text-text-primary pointer-events-auto"
|
|
74
|
+
onClick={(e) => {
|
|
75
|
+
e.stopPropagation();
|
|
76
|
+
navigator.clipboard.writeText(table.tableName);
|
|
77
|
+
}}
|
|
78
|
+
title="CopyIcon table name"
|
|
79
|
+
>
|
|
80
|
+
<CopyIcon size={iconSize.smallest}/>
|
|
81
|
+
</IconButton>
|
|
82
|
+
|
|
83
|
+
<Menu
|
|
84
|
+
trigger={
|
|
85
|
+
<IconButton
|
|
86
|
+
size={"smallest"}
|
|
87
|
+
className="transition-colors text-text-secondary hover:text-text-primary pointer-events-auto"
|
|
88
|
+
onClick={(e) => e.stopPropagation()}
|
|
89
|
+
title="Generate SQL templates"
|
|
90
|
+
>
|
|
91
|
+
<MoreVerticalIcon size={iconSize.smallest}/>
|
|
92
|
+
</IconButton>
|
|
93
|
+
}
|
|
94
|
+
>
|
|
95
|
+
<MenuItem dense className="text-xs" onClick={(e: React.MouseEvent) => {
|
|
96
|
+
e.stopPropagation();
|
|
97
|
+
onTableClick?.(`SELECT * FROM ${schemaName !== "public" ? `${schemaName}.` : ""}${table.tableName} LIMIT 100;`);
|
|
98
|
+
}}>SELECT (Top 100)</MenuItem>
|
|
99
|
+
<MenuItem dense className="text-xs" onClick={(e: React.MouseEvent) => {
|
|
100
|
+
e.stopPropagation();
|
|
101
|
+
onTableClick?.(`SELECT \n ${table.columns.map(c => c.name).join(",\n ")}\nFROM ${schemaName !== "public" ? `${schemaName}.` : ""}${table.tableName};`);
|
|
102
|
+
}}>SELECT (All columns)</MenuItem>
|
|
103
|
+
<MenuItem dense className="text-xs" onClick={(e: React.MouseEvent) => {
|
|
104
|
+
e.stopPropagation();
|
|
105
|
+
onTableClick?.(`INSERT INTO ${schemaName !== "public" ? `${schemaName}.` : ""}${table.tableName} (\n ${table.columns.map(c => c.name).join(",\n ")}\n) VALUES (\n ${table.columns.map(() => "?").join(",\n ")}\n);`);
|
|
106
|
+
}}>INSERT statement</MenuItem>
|
|
107
|
+
<MenuItem dense className="text-xs" onClick={(e: React.MouseEvent) => {
|
|
108
|
+
e.stopPropagation();
|
|
109
|
+
onTableClick?.(`UPDATE ${schemaName !== "public" ? `${schemaName}.` : ""}${table.tableName} \nSET \n ${table.columns.map(c => `${c.name} = ?`).join(",\n ")}\nWHERE id = ?;`);
|
|
110
|
+
}}>UPDATE statement</MenuItem>
|
|
111
|
+
</Menu>
|
|
112
|
+
|
|
113
|
+
<Button
|
|
114
|
+
variant="text"
|
|
115
|
+
size="small"
|
|
116
|
+
className="text-[10px] text-primary uppercase min-h-0 py-0.5 px-1 font-medium ml-1 flex-shrink-0 leading-none h-[22px]"
|
|
117
|
+
onClick={(e) => {
|
|
118
|
+
e.stopPropagation();
|
|
119
|
+
onTableClick?.(`SELECT * FROM ${schemaName !== "public" ? `${schemaName}.` : ""}${table.tableName} LIMIT 100;`);
|
|
120
|
+
}}
|
|
121
|
+
>
|
|
122
|
+
SELECT
|
|
123
|
+
</Button>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
{expandedTables[`${schemaName}.${table.tableName}`] && (
|
|
128
|
+
<div className={cls("ml-5 mt-1 space-y-0.5 border-l", defaultBorderMixin)}>
|
|
129
|
+
{table.columns.map(col => (
|
|
130
|
+
<div key={col.name} className="flex items-center p-1 group pl-2 hover:bg-surface-50 dark:hover:bg-surface-950 rounded-r relative min-h-[28px]">
|
|
131
|
+
<svg className="w-3 h-3 mr-1.5 text-text-disabled dark:text-text-disabled-dark shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M9 4.5v15m6-15v15m-10.5-1.5h15c.621 0 1.125-.504 1.125-1.125V5.625c0-.621-.504-1.125-1.125-1.125h-15c-.621 0-1.125.504-1.125 1.125v12.75c0 .621.504 1.125 1.125 1.125Z"/></svg>
|
|
132
|
+
<Typography variant="caption" className="text-text-primary dark:text-text-primary-dark text-[11px] truncate flex-grow mr-2">{col.name}</Typography>
|
|
133
|
+
<Typography variant="caption" className="text-text-disabled dark:text-text-disabled-dark text-[9px] truncate mr-1 uppercase shrink-0" title={col.dataType}>{col.dataType}</Typography>
|
|
134
|
+
<IconButton
|
|
135
|
+
size="smallest"
|
|
136
|
+
className="opacity-0 group-hover:opacity-100 absolute right-1 bg-surface-50 dark:bg-surface-950 transition-colors pointer-events-auto"
|
|
137
|
+
onClick={(e) => {
|
|
138
|
+
e.stopPropagation();
|
|
139
|
+
navigator.clipboard.writeText(col.name);
|
|
140
|
+
}}
|
|
141
|
+
title="CopyIcon column name"
|
|
142
|
+
>
|
|
143
|
+
<CopyIcon size={iconSize.smallest}/>
|
|
144
|
+
</IconButton>
|
|
145
|
+
</div>
|
|
146
|
+
))}
|
|
147
|
+
</div>
|
|
148
|
+
)}
|
|
149
|
+
</div>
|
|
150
|
+
))}
|
|
151
|
+
</div>
|
|
152
|
+
)}
|
|
153
|
+
</div>
|
|
154
|
+
))}
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
);
|
|
158
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React, { memo } from "react";
|
|
2
|
+
import { BaseEdge, getSmoothStepPath, EdgeLabelRenderer } from "@xyflow/react";
|
|
3
|
+
import type { EdgeProps } from "@xyflow/react";
|
|
4
|
+
import { cls } from "@rebasepro/ui";
|
|
5
|
+
import type { RelationEdgeData } from "./schema-visualizer.utils";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Custom React Flow edge that renders relations with style variations
|
|
9
|
+
* based on cardinality and direction.
|
|
10
|
+
*
|
|
11
|
+
* - Owning one-to-one: solid, primary color
|
|
12
|
+
* - Many-to-many (junction): solid, violet
|
|
13
|
+
* - Inverse: dashed, muted
|
|
14
|
+
* - Join path: dotted, muted
|
|
15
|
+
*/
|
|
16
|
+
const RelationEdgeInner = ({
|
|
17
|
+
id,
|
|
18
|
+
sourceX,
|
|
19
|
+
sourceY,
|
|
20
|
+
targetX,
|
|
21
|
+
targetY,
|
|
22
|
+
sourcePosition,
|
|
23
|
+
targetPosition,
|
|
24
|
+
data,
|
|
25
|
+
selected
|
|
26
|
+
}: EdgeProps) => {
|
|
27
|
+
const edgeData = data as RelationEdgeData | undefined;
|
|
28
|
+
|
|
29
|
+
const [edgePath, labelX, labelY] = getSmoothStepPath({
|
|
30
|
+
sourceX,
|
|
31
|
+
sourceY,
|
|
32
|
+
sourcePosition,
|
|
33
|
+
targetX,
|
|
34
|
+
targetY,
|
|
35
|
+
targetPosition,
|
|
36
|
+
borderRadius: 8
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const isInverse = edgeData?.direction === "inverse";
|
|
40
|
+
const isJoinPath = edgeData?.hasJoinPath;
|
|
41
|
+
const isJunction = edgeData?.hasJunction;
|
|
42
|
+
|
|
43
|
+
// Determine stroke style
|
|
44
|
+
let strokeColor = "var(--rf-edge-stroke, #94a3b8)";
|
|
45
|
+
let strokeDasharray: string | undefined;
|
|
46
|
+
let strokeWidth = 1.5;
|
|
47
|
+
|
|
48
|
+
if (selected) {
|
|
49
|
+
strokeColor = "var(--rf-edge-stroke-selected, #6366f1)";
|
|
50
|
+
strokeWidth = 2.5;
|
|
51
|
+
} else if (isJunction) {
|
|
52
|
+
strokeColor = "#8b5cf6"; // violet
|
|
53
|
+
} else if (isInverse) {
|
|
54
|
+
strokeDasharray = "6 3";
|
|
55
|
+
strokeColor = "#94a3b8";
|
|
56
|
+
} else if (isJoinPath) {
|
|
57
|
+
strokeDasharray = "3 3";
|
|
58
|
+
strokeColor = "#94a3b8";
|
|
59
|
+
} else {
|
|
60
|
+
strokeColor = "#6366f1"; // primary/indigo
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<>
|
|
65
|
+
<BaseEdge
|
|
66
|
+
id={id}
|
|
67
|
+
path={edgePath}
|
|
68
|
+
style={{
|
|
69
|
+
stroke: strokeColor,
|
|
70
|
+
strokeWidth,
|
|
71
|
+
strokeDasharray
|
|
72
|
+
}}
|
|
73
|
+
/>
|
|
74
|
+
{edgeData?.label && (
|
|
75
|
+
<EdgeLabelRenderer>
|
|
76
|
+
<div
|
|
77
|
+
style={{
|
|
78
|
+
position: "absolute",
|
|
79
|
+
transform: `translate(-50%, -50%) translate(${labelX}px,${labelY}px)`,
|
|
80
|
+
pointerEvents: "all"
|
|
81
|
+
}}
|
|
82
|
+
className={cls(
|
|
83
|
+
"px-1.5 py-0.5 rounded text-[9px] font-mono font-semibold leading-none",
|
|
84
|
+
"bg-white dark:bg-surface-900 border",
|
|
85
|
+
selected
|
|
86
|
+
? "border-primary text-primary"
|
|
87
|
+
: isJunction
|
|
88
|
+
? "border-violet-200 dark:border-violet-800 text-violet-600 dark:text-violet-400"
|
|
89
|
+
: isInverse || isJoinPath
|
|
90
|
+
? "border-surface-200 dark:border-surface-700 text-text-disabled dark:text-text-disabled-dark"
|
|
91
|
+
: "border-primary/30 dark:border-primary/30 text-primary"
|
|
92
|
+
)}
|
|
93
|
+
>
|
|
94
|
+
{edgeData.label}
|
|
95
|
+
</div>
|
|
96
|
+
</EdgeLabelRenderer>
|
|
97
|
+
)}
|
|
98
|
+
</>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const RelationEdge = memo(RelationEdgeInner);
|