@rebasepro/app 0.17.3 → 0.18.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 (185) hide show
  1. package/README.md +4 -1
  2. package/dist/components/index.d.ts +0 -3
  3. package/dist/contexts/AuthControllerContext.d.ts +2 -1
  4. package/dist/contexts/CustomizationControllerContext.d.ts +2 -1
  5. package/dist/contexts/DialogsProvider.d.ts +2 -1
  6. package/dist/contexts/RebaseDataContext.d.ts +10 -1
  7. package/dist/contexts/StorageSourceContext.d.ts +11 -1
  8. package/dist/core/RebaseProps.d.ts +2 -12
  9. package/dist/debug/index.d.ts +19 -0
  10. package/dist/debug.js +3631 -0
  11. package/dist/hooks/data/delete.d.ts +16 -7
  12. package/dist/hooks/data/save.d.ts +18 -4
  13. package/dist/hooks/index.d.ts +1 -0
  14. package/dist/hooks/useAdminModeController.d.ts +5 -4
  15. package/dist/hooks/useNavigationGroupLabel.d.ts +17 -0
  16. package/dist/hooks/useStudioBridge.d.ts +33 -0
  17. package/dist/index.es.js +2599 -6980
  18. package/dist/index.es.js.map +1 -1
  19. package/dist/vitePlugin.d.ts +22 -0
  20. package/dist/vitePlugin.js +40 -1
  21. package/package.json +42 -31
  22. package/src/auth/api.ts +0 -134
  23. package/src/auth/index.ts +0 -26
  24. package/src/auth/types.ts +0 -115
  25. package/src/auth/useRebaseAuthController.ts +0 -345
  26. package/src/collections/collection_view_config.ts +0 -76
  27. package/src/collections/entity-display-cache.ts +0 -195
  28. package/src/collections/entity-display.ts +0 -77
  29. package/src/collections/entity_image_preview.ts +0 -61
  30. package/src/collections/filter-operator-resolution.ts +0 -119
  31. package/src/collections/form-layout.ts +0 -394
  32. package/src/collections/index.ts +0 -13
  33. package/src/collections/navigation_from_path.ts +0 -123
  34. package/src/collections/navigation_utils.ts +0 -171
  35. package/src/collections/parent_references_from_path.ts +0 -59
  36. package/src/collections/property-path.ts +0 -30
  37. package/src/collections/property_presentation.ts +0 -264
  38. package/src/collections/summary-property.ts +0 -114
  39. package/src/collections/title-property.ts +0 -312
  40. package/src/components/AIIcon.tsx +0 -47
  41. package/src/components/AuthSimulationMenu.tsx +0 -0
  42. package/src/components/ConfirmationDialog.tsx +0 -48
  43. package/src/components/Debug/UIReferenceView.tsx +0 -1053
  44. package/src/components/Debug/UIStyleGuide.tsx +0 -159
  45. package/src/components/Debug/collection-views/CardViewDemo.tsx +0 -87
  46. package/src/components/Debug/collection-views/CollectionTableDemo.tsx +0 -107
  47. package/src/components/Debug/collection-views/KanbanBoardDemo.tsx +0 -89
  48. package/src/components/Debug/collection-views/index.ts +0 -3
  49. package/src/components/Debug/collection-views/sample_data.ts +0 -44
  50. package/src/components/Debug/crm-dashboard/CalendarWidget.tsx +0 -387
  51. package/src/components/Debug/crm-dashboard/CrmDashboardDemo.tsx +0 -1100
  52. package/src/components/Debug/crm-dashboard/DashboardMetrics.tsx +0 -131
  53. package/src/components/Debug/crm-dashboard/PipelineOverview.tsx +0 -288
  54. package/src/components/Debug/crm-dashboard/RecentActivity.tsx +0 -213
  55. package/src/components/Debug/crm-dashboard/TaskFilters.tsx +0 -182
  56. package/src/components/Debug/crm-dashboard/TaskTable.tsx +0 -425
  57. package/src/components/Debug/crm-dashboard/TasksView.tsx +0 -234
  58. package/src/components/ErrorTooltip.tsx +0 -12
  59. package/src/components/ErrorView.tsx +0 -94
  60. package/src/components/LanguageToggle.tsx +0 -59
  61. package/src/components/LoginView/LoginView.tsx +0 -1235
  62. package/src/components/LoginView/index.ts +0 -2
  63. package/src/components/LoginView/oauth-redirect-flow.ts +0 -184
  64. package/src/components/NotFoundPage.tsx +0 -27
  65. package/src/components/RebaseAuth.tsx +0 -27
  66. package/src/components/RebaseLogo.tsx +0 -88
  67. package/src/components/SchemaDriftBanner.tsx +0 -102
  68. package/src/components/UnsavedChangesDialog.tsx +0 -46
  69. package/src/components/UserDisplay.tsx +0 -54
  70. package/src/components/UserSelectPopover.tsx +0 -399
  71. package/src/components/UserSettingsView.tsx +0 -318
  72. package/src/components/common/index.ts +0 -6
  73. package/src/components/common/table_height.tsx +0 -21
  74. package/src/components/common/types.tsx +0 -66
  75. package/src/components/common/useColumnsIds.tsx +0 -261
  76. package/src/components/common/useDataTableController.tsx +0 -571
  77. package/src/components/common/useDebouncedData.ts +0 -49
  78. package/src/components/common/useScrollRestoration.tsx +0 -68
  79. package/src/components/index.tsx +0 -26
  80. package/src/contexts/AdminModeController.tsx +0 -11
  81. package/src/contexts/AnalyticsContext.tsx +0 -4
  82. package/src/contexts/AuthControllerContext.tsx +0 -4
  83. package/src/contexts/CollectionResolverContext.tsx +0 -24
  84. package/src/contexts/CollectionScopeContext.tsx +0 -68
  85. package/src/contexts/ComponentOverrideContext.tsx +0 -81
  86. package/src/contexts/CustomizationControllerContext.tsx +0 -4
  87. package/src/contexts/DataDriverContext.tsx +0 -4
  88. package/src/contexts/DataSourcesContext.tsx +0 -36
  89. package/src/contexts/DatabaseAdminContext.tsx +0 -4
  90. package/src/contexts/DialogsProvider.tsx +0 -56
  91. package/src/contexts/EffectiveRoleController.tsx +0 -12
  92. package/src/contexts/ModeController.tsx +0 -11
  93. package/src/contexts/RebaseClientInstanceContext.tsx +0 -7
  94. package/src/contexts/RebaseDataContext.tsx +0 -4
  95. package/src/contexts/SnackbarProvider.tsx +0 -15
  96. package/src/contexts/StorageSourceContext.tsx +0 -4
  97. package/src/contexts/StorageSourcesContext.tsx +0 -30
  98. package/src/contexts/UserConfigurationPersistenceContext.tsx +0 -4
  99. package/src/contexts/index.ts +0 -18
  100. package/src/core/PluginLifecycleManager.tsx +0 -96
  101. package/src/core/PluginProviderStack.tsx +0 -40
  102. package/src/core/Rebase.tsx +0 -488
  103. package/src/core/RebaseProps.tsx +0 -333
  104. package/src/core/RebaseRouter.tsx +0 -18
  105. package/src/core/RebaseRoutes.tsx +0 -24
  106. package/src/core/index.tsx +0 -5
  107. package/src/hooks/ApiConfigContext.tsx +0 -83
  108. package/src/hooks/data/collectionQuery.ts +0 -55
  109. package/src/hooks/data/delete.ts +0 -56
  110. package/src/hooks/data/save.ts +0 -78
  111. package/src/hooks/data/useCollection.tsx +0 -183
  112. package/src/hooks/data/useData.tsx +0 -18
  113. package/src/hooks/data/useDataOrder.ts +0 -26
  114. package/src/hooks/data/useFetch.tsx +0 -156
  115. package/src/hooks/data/useRelationSelector.tsx +0 -280
  116. package/src/hooks/index.tsx +0 -45
  117. package/src/hooks/useAdminModeController.tsx +0 -23
  118. package/src/hooks/useAnalyticsController.tsx +0 -8
  119. package/src/hooks/useAuthController.tsx +0 -15
  120. package/src/hooks/useAuthSubscription.ts +0 -130
  121. package/src/hooks/useBackendStorageSource.ts +0 -295
  122. package/src/hooks/useBridgeRegistration.tsx +0 -32
  123. package/src/hooks/useBrowserTitleAndIcon.tsx +0 -23
  124. package/src/hooks/useBuildAdminModeController.tsx +0 -29
  125. package/src/hooks/useBuildEffectiveRoleController.tsx +0 -30
  126. package/src/hooks/useBuildLocalConfigurationPersistence.tsx +0 -83
  127. package/src/hooks/useBuildModeController.tsx +0 -73
  128. package/src/hooks/useClipboard.tsx +0 -158
  129. package/src/hooks/useCollapsedGroups.ts +0 -116
  130. package/src/hooks/useComponentOverride.tsx +0 -59
  131. package/src/hooks/useCustomizationController.tsx +0 -14
  132. package/src/hooks/useDialogsController.tsx +0 -15
  133. package/src/hooks/useEffectiveRoleController.tsx +0 -10
  134. package/src/hooks/useLargeLayout.tsx +0 -65
  135. package/src/hooks/useModeController.tsx +0 -23
  136. package/src/hooks/useNavigationBlocker.tsx +0 -108
  137. package/src/hooks/usePermissions.ts +0 -45
  138. package/src/hooks/useRebaseClient.tsx +0 -10
  139. package/src/hooks/useRebaseContext.tsx +0 -84
  140. package/src/hooks/useRebaseRegistry.tsx +0 -91
  141. package/src/hooks/useResolvedComponent.tsx +0 -195
  142. package/src/hooks/useSlot.tsx +0 -64
  143. package/src/hooks/useSnackbarController.tsx +0 -80
  144. package/src/hooks/useStorageSource.tsx +0 -11
  145. package/src/hooks/useStudioBridge.tsx +0 -258
  146. package/src/hooks/useTranslation.ts +0 -38
  147. package/src/hooks/useUnsavedChangesDialog.tsx +0 -67
  148. package/src/hooks/useUserConfigurationPersistence.tsx +0 -11
  149. package/src/i18n/RebaseI18nProvider.tsx +0 -159
  150. package/src/index.ts +0 -32
  151. package/src/internal/common.tsx +0 -28
  152. package/src/internal/useRestoreScroll.tsx +0 -69
  153. package/src/locales/de.ts +0 -941
  154. package/src/locales/en.ts +0 -1021
  155. package/src/locales/es.ts +0 -962
  156. package/src/locales/fr.ts +0 -941
  157. package/src/locales/hi.ts +0 -941
  158. package/src/locales/it.ts +0 -941
  159. package/src/locales/pt.ts +0 -949
  160. package/src/util/constants.ts +0 -7
  161. package/src/util/createFormexStub.tsx +0 -66
  162. package/src/util/entity_cache.ts +0 -242
  163. package/src/util/enums.ts +0 -34
  164. package/src/util/icon_list.ts +0 -22
  165. package/src/util/icons.tsx +0 -129
  166. package/src/util/index.ts +0 -13
  167. package/src/util/local_storage.ts +0 -66
  168. package/src/util/previews.ts +0 -127
  169. package/src/util/useStorageUploadController.tsx +0 -354
  170. package/src/vitePlugin.ts +0 -215
  171. /package/dist/{components/Debug → debug}/UIReferenceView.d.ts +0 -0
  172. /package/dist/{components/Debug → debug}/UIStyleGuide.d.ts +0 -0
  173. /package/dist/{components/Debug → debug}/collection-views/CardViewDemo.d.ts +0 -0
  174. /package/dist/{components/Debug → debug}/collection-views/CollectionTableDemo.d.ts +0 -0
  175. /package/dist/{components/Debug → debug}/collection-views/KanbanBoardDemo.d.ts +0 -0
  176. /package/dist/{components/Debug → debug}/collection-views/index.d.ts +0 -0
  177. /package/dist/{components/Debug → debug}/collection-views/sample_data.d.ts +0 -0
  178. /package/dist/{components/Debug → debug}/crm-dashboard/CalendarWidget.d.ts +0 -0
  179. /package/dist/{components/Debug → debug}/crm-dashboard/CrmDashboardDemo.d.ts +0 -0
  180. /package/dist/{components/Debug → debug}/crm-dashboard/DashboardMetrics.d.ts +0 -0
  181. /package/dist/{components/Debug → debug}/crm-dashboard/PipelineOverview.d.ts +0 -0
  182. /package/dist/{components/Debug → debug}/crm-dashboard/RecentActivity.d.ts +0 -0
  183. /package/dist/{components/Debug → debug}/crm-dashboard/TaskFilters.d.ts +0 -0
  184. /package/dist/{components/Debug → debug}/crm-dashboard/TaskTable.d.ts +0 -0
  185. /package/dist/{components/Debug → debug}/crm-dashboard/TasksView.d.ts +0 -0
@@ -1,26 +0,0 @@
1
- export type { ErrorViewProps } from "./ErrorView";
2
- export { ErrorView } from "./ErrorView";
3
-
4
-
5
- export * from "./common";
6
-
7
- export * from "./NotFoundPage";
8
-
9
- export * from "./ConfirmationDialog";
10
- export * from "./ErrorTooltip";
11
- export * from "./RebaseLogo";
12
-
13
- export * from "./AIIcon";
14
- export * from "./Debug/UIStyleGuide";
15
- export * from "./Debug/UIReferenceView";
16
- export { CrmDashboardDemo } from "./Debug/crm-dashboard/CrmDashboardDemo";
17
- export * from "./UserSettingsView";
18
- export * from "./LanguageToggle";
19
- export * from "./UserSelectPopover";
20
- export * from "./UserDisplay";
21
-
22
- export * from "./LoginView";
23
-
24
- export * from "./RebaseAuth";
25
-
26
- export * from "./SchemaDriftBanner";
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- import type { AdminModeController } from "../hooks/useAdminModeController";
3
-
4
- const DEFAULT_ADMIN_MODE_STATE: AdminModeController = {
5
- mode: "cms",
6
- setMode: (mode: "cms" | "studio" | "settings") => {
7
- }
8
- };
9
- export const AdminModeControllerContext = React.createContext<AdminModeController>(DEFAULT_ADMIN_MODE_STATE);
10
-
11
- export const AdminModeControllerProvider = AdminModeControllerContext.Provider;
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- import { AnalyticsController } from "@rebasepro/cms-types";
3
-
4
- export const AnalyticsContext = React.createContext<AnalyticsController>({} as AnalyticsController);
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- import { AuthController } from "@rebasepro/cms-types";
3
-
4
- export const AuthControllerContext = React.createContext<AuthController<any, any>>({} as AuthController<any, any>);
@@ -1,24 +0,0 @@
1
- import React from "react";
2
-
3
- /**
4
- * Look up a collection's config by slug.
5
- */
6
- export type CollectionResolver = (slug: string) => { properties?: Record<string, unknown> } | undefined;
7
-
8
- /**
9
- * Lets the layer that owns the collections hand a resolver *up* to the data
10
- * layer, which needs a collection's primary keys to give its rows an address.
11
- *
12
- * The inversion is forced by the composition: `<Rebase client>` builds the data
13
- * layer, and `<RebaseCMS collections>` sits inside it — so the collections are
14
- * not in scope where the data is created, and `Rebase` cannot take them as a
15
- * prop without giving every headless BaaS app a collections argument it has no
16
- * use for.
17
- *
18
- * Registration is a ref write, so it is safe to call during render — and it has
19
- * to be. The views that fetch rows are *below* the registrar, and child effects
20
- * run before parent effects, so registering in an effect would bind after the
21
- * first page of rows had already been converted.
22
- */
23
- export const CollectionResolverRegistrationContext =
24
- React.createContext<(resolver: CollectionResolver | undefined) => void>(() => undefined);
@@ -1,68 +0,0 @@
1
- import React, { createContext, useContext } from "react";
2
-
3
- import { CollectionComponentOverrideProvider } from "./ComponentOverrideContext";
4
- import type { AdminCollection } from "@rebasepro/cms-types";
5
-
6
- /**
7
- * Carries the collection a UI subtree is currently bound to.
8
- *
9
- * Mounted by every collection binding (main collection views, entity
10
- * edit/detail views, side panels, reference-selection dialogs, import
11
- * previews) via {@link CollectionScopeProvider}. Leaf components read it with
12
- * {@link useCollectionScope} to derive collection-dependent behavior — e.g.
13
- * filter fields resolve the engine's supported operators from
14
- * `collection.engine` — without every intermediate component threading
15
- * collection props.
16
- *
17
- * @internal
18
- */
19
- export const CollectionScopeContext = createContext<AdminCollection | undefined>(undefined);
20
-
21
- /**
22
- * Read the collection the current subtree is bound to, or `undefined` when
23
- * rendered outside any collection scope (e.g. a fully standalone table).
24
- *
25
- * @group Hooks
26
- */
27
- export function useCollectionScope(): AdminCollection | undefined {
28
- return useContext(CollectionScopeContext);
29
- }
30
-
31
- /**
32
- * Scopes a UI subtree to a collection.
33
- *
34
- * Provides two things at once:
35
- * 1. The collection itself — readable via {@link useCollectionScope} —
36
- * so leaf components (filter fields, previews, …) can derive
37
- * collection-dependent behavior such as engine capabilities.
38
- * 2. The collection's component overrides (`collection.components`),
39
- * by mounting {@link CollectionComponentOverrideProvider}.
40
- *
41
- * Mount this wherever a subtree is bound to a specific collection. If you
42
- * build a custom view around `SelectableTable` / `CollectionTableBinding`,
43
- * wrap it in this provider to get engine-aware filters and collection-scoped
44
- * component overrides for free:
45
- *
46
- * ```tsx
47
- * <CollectionScopeProvider collection={myCollection}>
48
- * <CollectionTableBinding ... />
49
- * </CollectionScopeProvider>
50
- * ```
51
- *
52
- * @group Components
53
- */
54
- export function CollectionScopeProvider({
55
- collection,
56
- children
57
- }: {
58
- collection: AdminCollection<any> | undefined;
59
- children: React.ReactNode;
60
- }) {
61
- return (
62
- <CollectionScopeContext.Provider value={collection as AdminCollection | undefined}>
63
- <CollectionComponentOverrideProvider overrides={collection?.components}>
64
- {children}
65
- </CollectionComponentOverrideProvider>
66
- </CollectionScopeContext.Provider>
67
- );
68
- }
@@ -1,81 +0,0 @@
1
- import React, { createContext, useContext, useMemo } from "react";
2
- import type { ComponentOverrideMap } from "@rebasepro/cms-types";
3
-
4
- /** Stable empty reference to avoid re-creating context values on every render. */
5
- const EMPTY_OVERRIDES: ComponentOverrideMap = {};
6
-
7
- /**
8
- * Internal state for the component override resolution chain.
9
- * Holds both global overrides (set on `<Rebase>`) and collection-scoped
10
- * overrides (set on individual collections).
11
- *
12
- * Resolution priority: collection > global > default.
13
- *
14
- * @internal
15
- */
16
- interface ComponentOverrideState {
17
- globalOverrides: ComponentOverrideMap;
18
- collectionOverrides: ComponentOverrideMap;
19
- }
20
-
21
- export const ComponentOverrideContext = createContext<ComponentOverrideState>({
22
- globalOverrides: EMPTY_OVERRIDES,
23
- collectionOverrides: EMPTY_OVERRIDES
24
- });
25
-
26
- /**
27
- * Provider set at the `<Rebase>` root level to supply global component overrides.
28
- *
29
- * @internal — Used by the Rebase component. End users set overrides via
30
- * the `components` prop on `<Rebase>`.
31
- */
32
- export function GlobalComponentOverrideProvider({
33
- overrides,
34
- children
35
- }: {
36
- overrides?: ComponentOverrideMap;
37
- children: React.ReactNode;
38
- }) {
39
- const value = useMemo<ComponentOverrideState>(() => ({
40
- globalOverrides: overrides ?? EMPTY_OVERRIDES,
41
- collectionOverrides: EMPTY_OVERRIDES
42
- }), [overrides]);
43
-
44
- return (
45
- <ComponentOverrideContext.Provider value={value}>
46
- {children}
47
- </ComponentOverrideContext.Provider>
48
- );
49
- }
50
-
51
- /**
52
- * Provider set at the collection level to layer collection-scoped overrides
53
- * on top of global overrides.
54
- *
55
- * When a collection defines `components`, this provider is mounted
56
- * around the collection's view subtree. Components within the subtree
57
- * will resolve overrides in order: collection → global → default.
58
- *
59
- * @internal — Used by DataCollectionView when a collection has
60
- * `components` defined.
61
- */
62
- export function CollectionComponentOverrideProvider({
63
- overrides,
64
- children
65
- }: {
66
- overrides?: ComponentOverrideMap;
67
- children: React.ReactNode;
68
- }) {
69
- const parent = useContext(ComponentOverrideContext);
70
-
71
- const value = useMemo<ComponentOverrideState>(() => ({
72
- globalOverrides: parent.globalOverrides,
73
- collectionOverrides: overrides ?? EMPTY_OVERRIDES
74
- }), [parent.globalOverrides, overrides]);
75
-
76
- return (
77
- <ComponentOverrideContext.Provider value={value}>
78
- {children}
79
- </ComponentOverrideContext.Provider>
80
- );
81
- }
@@ -1,4 +0,0 @@
1
- import type { CustomizationController } from "@rebasepro/cms-types";
2
- import React from "react";
3
-
4
- export const CustomizationControllerContext = React.createContext<CustomizationController>({} as CustomizationController);
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- import { DataDriver } from "@rebasepro/types";
3
-
4
- export const DataDriverContext = React.createContext<DataDriver>({} as DataDriver);
@@ -1,36 +0,0 @@
1
- import React from "react";
2
- import { DataSourceDefinition, RebaseData } from "@rebasepro/types";
3
-
4
- /**
5
- * The data-source configuration provided to `<Rebase>`: the declared
6
- * definitions plus the built {@link RebaseData} instances for direct/custom
7
- * transports.
8
- *
9
- * The actual path-based routing is assembled by the navigation layer (which
10
- * has the collection registry) via `resolveDataSource` + `buildRoutedRebaseData`
11
- * and re-provided through `RebaseDataContext`.
12
- *
13
- * @internal
14
- */
15
- export interface DataSourcesContextValue {
16
- /** All declared data sources, keyed by data-source key. */
17
- registry: Record<string, DataSourceDefinition>;
18
- /**
19
- * Built {@link RebaseData} for direct/custom data sources, keyed by
20
- * data-source key. Server-mediated sources are absent (they ride the
21
- * default client).
22
- */
23
- sources: Record<string, RebaseData>;
24
- }
25
-
26
- const EMPTY: DataSourcesContextValue = { registry: {}, sources: {} };
27
-
28
- /** @internal */
29
- export const DataSourcesContext = React.createContext<DataSourcesContextValue>(EMPTY);
30
-
31
- /**
32
- * Access the data-source configuration provided to `<Rebase>` via the
33
- * `dataSources` prop.
34
- * @internal
35
- */
36
- export const useDataSources = (): DataSourcesContextValue => React.useContext(DataSourcesContext);
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- import { DatabaseAdmin } from "@rebasepro/types";
3
-
4
- export const DatabaseAdminContext = React.createContext<DatabaseAdmin | undefined>(undefined);
@@ -1,56 +0,0 @@
1
- import type { DialogControllerEntryProps, DialogsController } from "@rebasepro/cms-types";
2
- import React, { PropsWithChildren, useCallback, useRef, useState, useMemo } from "react";
3
- ;
4
-
5
- export const DialogsControllerContext = React.createContext<DialogsController>({} as DialogsController);
6
-
7
- export const DialogsProvider: React.FC<PropsWithChildren> = ({ children }) => {
8
-
9
- const [dialogEntries, setDialogEntries] = useState<DialogControllerEntryProps[]>([]);
10
- const dialogEntriesRef = useRef<DialogControllerEntryProps[]>(dialogEntries);
11
-
12
- const updateDialogEntries = (newPanels: DialogControllerEntryProps<any>[]) => {
13
- dialogEntriesRef.current = newPanels;
14
- setDialogEntries(newPanels);
15
- };
16
-
17
- const close = useCallback(() => {
18
-
19
- if (dialogEntries.length === 0)
20
- return;
21
-
22
- const updatedPanels = [...dialogEntriesRef.current.slice(0, -1)];
23
- updateDialogEntries(updatedPanels);
24
-
25
- }, [dialogEntries]);
26
-
27
- const open = useCallback(<T extends object = object>(dialogEntry: DialogControllerEntryProps<T>) => {
28
-
29
- const updatedPanels = [...dialogEntriesRef.current, dialogEntry];
30
- updateDialogEntries(updatedPanels);
31
-
32
- return {
33
- closeDialog: () => {
34
- const updatedPanels = dialogEntriesRef.current.filter(e => e.key !== dialogEntry.key);
35
- updateDialogEntries(updatedPanels);
36
- }
37
- }
38
- }, [dialogEntries]);
39
-
40
- const dialogsController = useMemo(() => ({
41
- open,
42
- close
43
- }), [open, close]);
44
-
45
- return (
46
- <DialogsControllerContext.Provider value={dialogsController}>
47
- {children}
48
- {dialogEntries.map((entry, i) => <entry.Component
49
- key={`dialog_${i}`}
50
- open={true}
51
- closeDialog={close}
52
- {...entry.props}
53
- />)}
54
- </DialogsControllerContext.Provider>
55
- );
56
- };
@@ -1,12 +0,0 @@
1
- import type { EffectiveRoleController } from "@rebasepro/types";
2
- import React from "react";
3
- ;
4
-
5
- const DEFAULT_EFFECTIVE_ROLE_STATE: EffectiveRoleController = {
6
- effectiveRole: null,
7
- setEffectiveRole: (_role: string | null) => {
8
- }
9
- };
10
- export const EffectiveRoleControllerContext = React.createContext<EffectiveRoleController>(DEFAULT_EFFECTIVE_ROLE_STATE);
11
-
12
- export const EffectiveRoleControllerProvider = EffectiveRoleControllerContext.Provider;
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- import type { ModeController } from "../hooks/useModeController";
3
-
4
- const DEFAULT_MODE_STATE: ModeController = {
5
- mode: "light",
6
- setMode: (mode: "light" | "dark" | "system") => {
7
- }
8
- };
9
- export const ModeControllerContext = React.createContext<ModeController>(DEFAULT_MODE_STATE);
10
-
11
- export const ModeControllerProvider = ModeControllerContext.Provider;
@@ -1,7 +0,0 @@
1
- import React from "react";
2
-
3
- /**
4
- * Context that exposes the full RebaseClient instance.
5
- * Used by the JS Editor to give developer scripts access to `client.data`, `client.auth`, etc.
6
- */
7
- export const RebaseClientInstanceContext = React.createContext<any>(undefined);
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- import { RebaseData } from "@rebasepro/types";
3
-
4
- export const RebaseDataContext = React.createContext<RebaseData>({} as RebaseData);
@@ -1,15 +0,0 @@
1
- "use client";
2
-
3
- import React, { PropsWithChildren } from "react";
4
- import { SnackbarProvider as NotistackSnackbarProvider } from "notistack";
5
-
6
- export const SnackbarProvider: React.FC<PropsWithChildren> = ({ children }) => {
7
-
8
- return (
9
- <NotistackSnackbarProvider maxSnack={3}
10
- preventDuplicate={true}
11
- autoHideDuration={3500}>
12
- {children}
13
- </NotistackSnackbarProvider>
14
- );
15
- };
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- import { StorageSource } from "@rebasepro/types";
3
-
4
- export const StorageSourceContext = React.createContext<StorageSource>({} as StorageSource);
@@ -1,30 +0,0 @@
1
- import React from "react";
2
- import type { StorageSource, StorageSourceDefinition, StorageSourceRegistry } from "@rebasepro/types";
3
-
4
- /**
5
- * The storage-source configuration provided to `<Rebase>`: the declared
6
- * definitions and the built {@link StorageSource} instances, wrapped in a
7
- * {@link StorageSourceRegistry} for fast key-based lookup.
8
- *
9
- * Mirrors the {@link DataSourcesContext} pattern used for databases.
10
- *
11
- * @internal
12
- */
13
- export interface StorageSourcesContextValue {
14
- /** All declared storage sources, keyed by storage-source key. */
15
- registry: Record<string, StorageSourceDefinition>;
16
- /** Built {@link StorageSource} for direct sources, keyed by key. */
17
- sources: Record<string, StorageSource>;
18
- }
19
-
20
- const EMPTY: StorageSourcesContextValue = { registry: {}, sources: {} };
21
-
22
- /** @internal */
23
- export const StorageSourcesContext = React.createContext<StorageSourcesContextValue>(EMPTY);
24
-
25
- /**
26
- * Access the storage-source configuration provided to `<Rebase>` via the
27
- * `storageSources` prop.
28
- * @internal
29
- */
30
- export const useStorageSources = (): StorageSourcesContextValue => React.useContext(StorageSourcesContext);
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- import { UserConfigurationPersistence } from "@rebasepro/cms-types";
3
-
4
- export const UserConfigurationPersistenceContext = React.createContext<UserConfigurationPersistence | undefined>(undefined);
@@ -1,18 +0,0 @@
1
- export * from "./SnackbarProvider";
2
- export * from "./ModeController";
3
- export * from "./AdminModeController";
4
- export * from "./EffectiveRoleController";
5
- export * from "./AuthControllerContext";
6
- export * from "./DataDriverContext";
7
- export * from "./DataSourcesContext";
8
- export * from "./RebaseDataContext";
9
- export * from "./AnalyticsContext";
10
- export * from "./StorageSourceContext";
11
- export * from "./StorageSourcesContext";
12
- export * from "./UserConfigurationPersistenceContext";
13
- export * from "./DialogsProvider";
14
- export * from "./RebaseClientInstanceContext";
15
- export * from "./CustomizationControllerContext";
16
- export * from "./ComponentOverrideContext";
17
- export * from "./CollectionScopeContext";
18
- export * from "./CollectionResolverContext";
@@ -1,96 +0,0 @@
1
-
2
- import { useEffect, useRef } from "react";
3
- import type { User } from "@rebasepro/types";
4
- import type { RebasePlugin, RebaseContext } from "@rebasepro/cms-types";
5
-
6
- /**
7
- * Render-less component that manages plugin lifecycle hooks.
8
- *
9
- * - Calls `lifecycle.onMount(context)` when plugins mount.
10
- * - Calls `lifecycle.onUnmount()` when plugins unmount.
11
- * - Subscribes to auth state changes and calls `lifecycle.onAuthStateChange`.
12
- *
13
- * Mount this component inside the Rebase tree, below PluginProviderStack,
14
- * so that the RebaseContext is fully available.
15
- *
16
- * @internal
17
- */
18
- export function PluginLifecycleManager({
19
- plugins,
20
- context
21
- }: {
22
- plugins: RebasePlugin[];
23
- context: RebaseContext;
24
- }) {
25
- const mountedRef = useRef(false);
26
- const prevUserRef = useRef<User | null | undefined>(undefined);
27
-
28
- // ── Mount / Unmount lifecycle ────────────────────────────────────
29
- useEffect(() => {
30
- // Prevent double-fire in StrictMode
31
- if (mountedRef.current) return;
32
- mountedRef.current = true;
33
-
34
- for (const plugin of plugins) {
35
- if (plugin.lifecycle?.onMount) {
36
- try {
37
- const result = plugin.lifecycle.onMount(context);
38
- if (result instanceof Promise) {
39
- result.catch((err) =>
40
- console.error(`[Rebase] Plugin "${plugin.key}" onMount error:`, err)
41
- );
42
- }
43
- } catch (err) {
44
- console.error(`[Rebase] Plugin "${plugin.key}" onMount error:`, err);
45
- }
46
- }
47
- }
48
-
49
- return () => {
50
- mountedRef.current = false;
51
- for (const plugin of plugins) {
52
- if (plugin.lifecycle?.onUnmount) {
53
- try {
54
- plugin.lifecycle.onUnmount();
55
- } catch (err) {
56
- console.error(`[Rebase] Plugin "${plugin.key}" onUnmount error:`, err);
57
- }
58
- }
59
- }
60
- };
61
- // Only run on mount/unmount — plugins array identity should be stable
62
- }, []);
63
-
64
- // ── Auth state change lifecycle ──────────────────────────────────
65
- const currentUser = context.authController?.user ?? null;
66
-
67
- useEffect(() => {
68
- // Skip the initial call — onMount handles that
69
- if (prevUserRef.current === undefined) {
70
- prevUserRef.current = currentUser;
71
- return;
72
- }
73
-
74
- // Only fire when the user identity actually changes
75
- const prevUid = prevUserRef.current?.uid;
76
- const currUid = currentUser?.uid;
77
- if (prevUid === currUid) return;
78
-
79
- prevUserRef.current = currentUser;
80
-
81
- for (const plugin of plugins) {
82
- if (plugin.lifecycle?.onAuthStateChange) {
83
- try {
84
- plugin.lifecycle.onAuthStateChange(currentUser);
85
- } catch (err) {
86
- console.error(
87
- `[Rebase] Plugin "${plugin.key}" onAuthStateChange error:`,
88
- err
89
- );
90
- }
91
- }
92
- }
93
- }, [currentUser, plugins]);
94
-
95
- return null;
96
- }
@@ -1,40 +0,0 @@
1
- import type { RebasePlugin } from "@rebasepro/cms-types";
2
- import React from "react";
3
- ;
4
-
5
- /**
6
- * Wraps children with all provider components from plugins that match the given scope.
7
- *
8
- * Replaces the 3 copy-pasted `plugins.forEach(plugin => { if (plugin.form?.provider) ... })` patterns
9
- * in Rebase.tsx, EditViewBinding.tsx, and PopupFormField.tsx.
10
- *
11
- * @param plugins - Array of plugins to extract providers from.
12
- * @param scope - `"root"` or `"form"` — which providers to apply.
13
- * @param scopeProps - Additional props passed to each provider component.
14
- * @param children - The content to wrap.
15
- *
16
- * @group Core
17
- */
18
- export function PluginProviderStack({
19
- plugins,
20
- scope,
21
- scopeProps,
22
- children
23
- }: {
24
- plugins: RebasePlugin[];
25
- scope: "root" | "form";
26
- scopeProps?: Record<string, unknown>;
27
- children: React.ReactNode;
28
- }) {
29
- const providers = plugins.flatMap(p => p.providers ?? [])
30
- .filter(p => p.scope === scope);
31
-
32
- return providers.reduceRight<React.ReactNode>(
33
- (acc, provider) => (
34
- <provider.Component {...provider.props} {...scopeProps}>
35
- {acc}
36
- </provider.Component>
37
- ),
38
- children
39
- );
40
- }