@rebasepro/app 0.0.1-canary.4829d6e

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 (268) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +174 -0
  3. package/dist/auth/api.d.ts +66 -0
  4. package/dist/auth/index.d.ts +13 -0
  5. package/dist/auth/types.d.ts +127 -0
  6. package/dist/auth/useRebaseAuthController.d.ts +13 -0
  7. package/dist/components/AIIcon.d.ts +17 -0
  8. package/dist/components/AuthSimulationMenu.d.ts +0 -0
  9. package/dist/components/ConfirmationDialog.d.ts +9 -0
  10. package/dist/components/Debug/UIReferenceView.d.ts +13 -0
  11. package/dist/components/Debug/UIStyleGuide.d.ts +2 -0
  12. package/dist/components/Debug/collection-views/CardViewDemo.d.ts +2 -0
  13. package/dist/components/Debug/collection-views/CollectionTableDemo.d.ts +2 -0
  14. package/dist/components/Debug/collection-views/KanbanBoardDemo.d.ts +2 -0
  15. package/dist/components/Debug/collection-views/index.d.ts +3 -0
  16. package/dist/components/Debug/collection-views/sample_data.d.ts +23 -0
  17. package/dist/components/Debug/crm-dashboard/CalendarWidget.d.ts +22 -0
  18. package/dist/components/Debug/crm-dashboard/CrmDashboardDemo.d.ts +2 -0
  19. package/dist/components/Debug/crm-dashboard/DashboardMetrics.d.ts +15 -0
  20. package/dist/components/Debug/crm-dashboard/PipelineOverview.d.ts +34 -0
  21. package/dist/components/Debug/crm-dashboard/RecentActivity.d.ts +19 -0
  22. package/dist/components/Debug/crm-dashboard/TaskFilters.d.ts +30 -0
  23. package/dist/components/Debug/crm-dashboard/TaskTable.d.ts +50 -0
  24. package/dist/components/Debug/crm-dashboard/TasksView.d.ts +41 -0
  25. package/dist/components/ErrorTooltip.d.ts +3 -0
  26. package/dist/components/ErrorView.d.ts +21 -0
  27. package/dist/components/LanguageToggle.d.ts +2 -0
  28. package/dist/components/LoginView/LoginView.d.ts +113 -0
  29. package/dist/components/LoginView/index.d.ts +2 -0
  30. package/dist/components/NotFoundPage.d.ts +2 -0
  31. package/dist/components/RebaseAuth.d.ts +10 -0
  32. package/dist/components/RebaseLogo.d.ts +7 -0
  33. package/dist/components/SchemaDriftBanner.d.ts +27 -0
  34. package/dist/components/UnsavedChangesDialog.d.ts +9 -0
  35. package/dist/components/UserDisplay.d.ts +7 -0
  36. package/dist/components/UserSelectPopover.d.ts +63 -0
  37. package/dist/components/UserSettingsView.d.ts +2 -0
  38. package/dist/components/common/index.d.ts +6 -0
  39. package/dist/components/common/table_height.d.ts +5 -0
  40. package/dist/components/common/types.d.ts +66 -0
  41. package/dist/components/common/useColumnsIds.d.ts +9 -0
  42. package/dist/components/common/useDataTableController.d.ts +45 -0
  43. package/dist/components/common/useDebouncedData.d.ts +9 -0
  44. package/dist/components/common/useScrollRestoration.d.ts +14 -0
  45. package/dist/components/index.d.ts +18 -0
  46. package/dist/contexts/AdminModeController.d.ts +4 -0
  47. package/dist/contexts/AnalyticsContext.d.ts +3 -0
  48. package/dist/contexts/AuthControllerContext.d.ts +3 -0
  49. package/dist/contexts/CollectionScopeContext.d.ts +50 -0
  50. package/dist/contexts/ComponentOverrideContext.d.ts +42 -0
  51. package/dist/contexts/CustomizationControllerContext.d.ts +3 -0
  52. package/dist/contexts/DataDriverContext.d.ts +3 -0
  53. package/dist/contexts/DataSourcesContext.d.ts +31 -0
  54. package/dist/contexts/DatabaseAdminContext.d.ts +3 -0
  55. package/dist/contexts/DialogsProvider.d.ts +4 -0
  56. package/dist/contexts/EffectiveRoleController.d.ts +4 -0
  57. package/dist/contexts/ModeController.d.ts +4 -0
  58. package/dist/contexts/RebaseClientInstanceContext.d.ts +6 -0
  59. package/dist/contexts/RebaseDataContext.d.ts +3 -0
  60. package/dist/contexts/SnackbarProvider.d.ts +2 -0
  61. package/dist/contexts/StorageSourceContext.d.ts +3 -0
  62. package/dist/contexts/StorageSourcesContext.d.ts +25 -0
  63. package/dist/contexts/UserConfigurationPersistenceContext.d.ts +3 -0
  64. package/dist/contexts/index.d.ts +17 -0
  65. package/dist/core/PluginLifecycleManager.d.ts +17 -0
  66. package/dist/core/PluginProviderStack.d.ts +21 -0
  67. package/dist/core/Rebase.d.ts +15 -0
  68. package/dist/core/RebaseProps.d.ts +291 -0
  69. package/dist/core/RebaseRouter.d.ts +4 -0
  70. package/dist/core/RebaseRoutes.d.ts +17 -0
  71. package/dist/core/index.d.ts +4 -0
  72. package/dist/hooks/ApiConfigContext.d.ts +24 -0
  73. package/dist/hooks/data/delete.d.ts +33 -0
  74. package/dist/hooks/data/save.d.ts +40 -0
  75. package/dist/hooks/data/useCollection.d.ts +62 -0
  76. package/dist/hooks/data/useData.d.ts +13 -0
  77. package/dist/hooks/data/useDataOrder.d.ts +12 -0
  78. package/dist/hooks/data/useFetch.d.ts +43 -0
  79. package/dist/hooks/data/useRelationSelector.d.ts +52 -0
  80. package/dist/hooks/index.d.ts +36 -0
  81. package/dist/hooks/useAdminModeController.d.ts +19 -0
  82. package/dist/hooks/useAnalyticsController.d.ts +5 -0
  83. package/dist/hooks/useAuthController.d.ts +11 -0
  84. package/dist/hooks/useAuthSubscription.d.ts +2 -0
  85. package/dist/hooks/useBackendStorageSource.d.ts +30 -0
  86. package/dist/hooks/useBridgeRegistration.d.ts +18 -0
  87. package/dist/hooks/useBrowserTitleAndIcon.d.ts +6 -0
  88. package/dist/hooks/useBuildAdminModeController.d.ts +6 -0
  89. package/dist/hooks/useBuildEffectiveRoleController.d.ts +8 -0
  90. package/dist/hooks/useBuildLocalConfigurationPersistence.d.ts +2 -0
  91. package/dist/hooks/useBuildModeController.d.ts +6 -0
  92. package/dist/hooks/useClipboard.d.ts +57 -0
  93. package/dist/hooks/useCollapsedGroups.d.ts +27 -0
  94. package/dist/hooks/useComponentOverride.d.ts +32 -0
  95. package/dist/hooks/useCustomizationController.d.ts +11 -0
  96. package/dist/hooks/useDialogsController.d.ts +11 -0
  97. package/dist/hooks/useEffectiveRoleController.d.ts +7 -0
  98. package/dist/hooks/useLargeLayout.d.ts +1 -0
  99. package/dist/hooks/useModeController.d.ts +19 -0
  100. package/dist/hooks/usePermissions.d.ts +12 -0
  101. package/dist/hooks/useRebaseClient.d.ts +5 -0
  102. package/dist/hooks/useRebaseContext.d.ts +11 -0
  103. package/dist/hooks/useRebaseRegistry.d.ts +34 -0
  104. package/dist/hooks/useResolvedComponent.d.ts +47 -0
  105. package/dist/hooks/useSlot.d.ts +18 -0
  106. package/dist/hooks/useSnackbarController.d.ts +20 -0
  107. package/dist/hooks/useStorageSource.d.ts +6 -0
  108. package/dist/hooks/useStudioBridge.d.ts +79 -0
  109. package/dist/hooks/useTranslation.d.ts +17 -0
  110. package/dist/hooks/useUnsavedChangesDialog.d.ts +12 -0
  111. package/dist/hooks/useUserConfigurationPersistence.d.ts +8 -0
  112. package/dist/i18n/RebaseI18nProvider.d.ts +33 -0
  113. package/dist/index.d.ts +16 -0
  114. package/dist/index.es.js +16843 -0
  115. package/dist/index.es.js.map +1 -0
  116. package/dist/index.umd.js +17021 -0
  117. package/dist/index.umd.js.map +1 -0
  118. package/dist/internal/common.d.ts +14 -0
  119. package/dist/internal/useRestoreScroll.d.ts +15 -0
  120. package/dist/locales/de.d.ts +2 -0
  121. package/dist/locales/en.d.ts +10 -0
  122. package/dist/locales/es.d.ts +10 -0
  123. package/dist/locales/fr.d.ts +2 -0
  124. package/dist/locales/hi.d.ts +2 -0
  125. package/dist/locales/it.d.ts +2 -0
  126. package/dist/locales/pt.d.ts +7 -0
  127. package/dist/util/constants.d.ts +1 -0
  128. package/dist/util/createFormexStub.d.ts +2 -0
  129. package/dist/util/entity_cache.d.ts +22 -0
  130. package/dist/util/enums.d.ts +5 -0
  131. package/dist/util/icon_list.d.ts +5 -0
  132. package/dist/util/icons.d.ts +20 -0
  133. package/dist/util/index.d.ts +8 -0
  134. package/dist/util/previews.d.ts +4 -0
  135. package/dist/util/useStorageUploadController.d.ts +44 -0
  136. package/dist/vitePlugin.d.ts +60 -0
  137. package/dist/vitePlugin.js +113 -0
  138. package/package.json +145 -0
  139. package/src/auth/api.ts +148 -0
  140. package/src/auth/index.ts +25 -0
  141. package/src/auth/types.ts +115 -0
  142. package/src/auth/useRebaseAuthController.ts +328 -0
  143. package/src/components/AIIcon.tsx +47 -0
  144. package/src/components/AuthSimulationMenu.tsx +0 -0
  145. package/src/components/ConfirmationDialog.tsx +48 -0
  146. package/src/components/Debug/UIReferenceView.tsx +958 -0
  147. package/src/components/Debug/UIStyleGuide.tsx +156 -0
  148. package/src/components/Debug/collection-views/CardViewDemo.tsx +85 -0
  149. package/src/components/Debug/collection-views/CollectionTableDemo.tsx +107 -0
  150. package/src/components/Debug/collection-views/KanbanBoardDemo.tsx +90 -0
  151. package/src/components/Debug/collection-views/index.ts +3 -0
  152. package/src/components/Debug/collection-views/sample_data.ts +42 -0
  153. package/src/components/Debug/crm-dashboard/CalendarWidget.tsx +389 -0
  154. package/src/components/Debug/crm-dashboard/CrmDashboardDemo.tsx +1102 -0
  155. package/src/components/Debug/crm-dashboard/DashboardMetrics.tsx +133 -0
  156. package/src/components/Debug/crm-dashboard/PipelineOverview.tsx +290 -0
  157. package/src/components/Debug/crm-dashboard/RecentActivity.tsx +215 -0
  158. package/src/components/Debug/crm-dashboard/TaskFilters.tsx +184 -0
  159. package/src/components/Debug/crm-dashboard/TaskTable.tsx +427 -0
  160. package/src/components/Debug/crm-dashboard/TasksView.tsx +234 -0
  161. package/src/components/ErrorTooltip.tsx +12 -0
  162. package/src/components/ErrorView.tsx +94 -0
  163. package/src/components/LanguageToggle.tsx +59 -0
  164. package/src/components/LoginView/LoginView.tsx +932 -0
  165. package/src/components/LoginView/index.ts +2 -0
  166. package/src/components/NotFoundPage.tsx +27 -0
  167. package/src/components/RebaseAuth.tsx +27 -0
  168. package/src/components/RebaseLogo.tsx +29 -0
  169. package/src/components/SchemaDriftBanner.tsx +102 -0
  170. package/src/components/UnsavedChangesDialog.tsx +46 -0
  171. package/src/components/UserDisplay.tsx +54 -0
  172. package/src/components/UserSelectPopover.tsx +399 -0
  173. package/src/components/UserSettingsView.tsx +318 -0
  174. package/src/components/common/index.ts +6 -0
  175. package/src/components/common/table_height.tsx +21 -0
  176. package/src/components/common/types.tsx +66 -0
  177. package/src/components/common/useColumnsIds.tsx +222 -0
  178. package/src/components/common/useDataTableController.tsx +514 -0
  179. package/src/components/common/useDebouncedData.ts +49 -0
  180. package/src/components/common/useScrollRestoration.tsx +68 -0
  181. package/src/components/index.tsx +26 -0
  182. package/src/contexts/AdminModeController.tsx +11 -0
  183. package/src/contexts/AnalyticsContext.tsx +4 -0
  184. package/src/contexts/AuthControllerContext.tsx +4 -0
  185. package/src/contexts/CollectionScopeContext.tsx +67 -0
  186. package/src/contexts/ComponentOverrideContext.tsx +81 -0
  187. package/src/contexts/CustomizationControllerContext.tsx +4 -0
  188. package/src/contexts/DataDriverContext.tsx +4 -0
  189. package/src/contexts/DataSourcesContext.tsx +36 -0
  190. package/src/contexts/DatabaseAdminContext.tsx +4 -0
  191. package/src/contexts/DialogsProvider.tsx +56 -0
  192. package/src/contexts/EffectiveRoleController.tsx +12 -0
  193. package/src/contexts/ModeController.tsx +11 -0
  194. package/src/contexts/RebaseClientInstanceContext.tsx +7 -0
  195. package/src/contexts/RebaseDataContext.tsx +4 -0
  196. package/src/contexts/SnackbarProvider.tsx +15 -0
  197. package/src/contexts/StorageSourceContext.tsx +4 -0
  198. package/src/contexts/StorageSourcesContext.tsx +30 -0
  199. package/src/contexts/UserConfigurationPersistenceContext.tsx +4 -0
  200. package/src/contexts/index.ts +17 -0
  201. package/src/core/PluginLifecycleManager.tsx +95 -0
  202. package/src/core/PluginProviderStack.tsx +40 -0
  203. package/src/core/Rebase.tsx +439 -0
  204. package/src/core/RebaseProps.tsx +320 -0
  205. package/src/core/RebaseRouter.tsx +17 -0
  206. package/src/core/RebaseRoutes.tsx +24 -0
  207. package/src/core/index.tsx +5 -0
  208. package/src/hooks/ApiConfigContext.tsx +41 -0
  209. package/src/hooks/data/delete.ts +55 -0
  210. package/src/hooks/data/save.ts +77 -0
  211. package/src/hooks/data/useCollection.tsx +176 -0
  212. package/src/hooks/data/useData.tsx +18 -0
  213. package/src/hooks/data/useDataOrder.ts +26 -0
  214. package/src/hooks/data/useFetch.tsx +140 -0
  215. package/src/hooks/data/useRelationSelector.tsx +234 -0
  216. package/src/hooks/index.tsx +45 -0
  217. package/src/hooks/useAdminModeController.tsx +23 -0
  218. package/src/hooks/useAnalyticsController.tsx +8 -0
  219. package/src/hooks/useAuthController.tsx +14 -0
  220. package/src/hooks/useAuthSubscription.ts +87 -0
  221. package/src/hooks/useBackendStorageSource.ts +288 -0
  222. package/src/hooks/useBridgeRegistration.tsx +32 -0
  223. package/src/hooks/useBrowserTitleAndIcon.tsx +23 -0
  224. package/src/hooks/useBuildAdminModeController.tsx +24 -0
  225. package/src/hooks/useBuildEffectiveRoleController.tsx +31 -0
  226. package/src/hooks/useBuildLocalConfigurationPersistence.tsx +75 -0
  227. package/src/hooks/useBuildModeController.tsx +71 -0
  228. package/src/hooks/useClipboard.tsx +158 -0
  229. package/src/hooks/useCollapsedGroups.ts +116 -0
  230. package/src/hooks/useComponentOverride.tsx +59 -0
  231. package/src/hooks/useCustomizationController.tsx +14 -0
  232. package/src/hooks/useDialogsController.tsx +15 -0
  233. package/src/hooks/useEffectiveRoleController.tsx +10 -0
  234. package/src/hooks/useLargeLayout.tsx +65 -0
  235. package/src/hooks/useModeController.tsx +23 -0
  236. package/src/hooks/usePermissions.ts +44 -0
  237. package/src/hooks/useRebaseClient.tsx +10 -0
  238. package/src/hooks/useRebaseContext.tsx +83 -0
  239. package/src/hooks/useRebaseRegistry.tsx +91 -0
  240. package/src/hooks/useResolvedComponent.tsx +159 -0
  241. package/src/hooks/useSlot.tsx +64 -0
  242. package/src/hooks/useSnackbarController.tsx +52 -0
  243. package/src/hooks/useStorageSource.tsx +11 -0
  244. package/src/hooks/useStudioBridge.tsx +209 -0
  245. package/src/hooks/useTranslation.ts +33 -0
  246. package/src/hooks/useUnsavedChangesDialog.tsx +64 -0
  247. package/src/hooks/useUserConfigurationPersistence.tsx +11 -0
  248. package/src/i18n/RebaseI18nProvider.tsx +160 -0
  249. package/src/index.ts +25 -0
  250. package/src/internal/common.tsx +16 -0
  251. package/src/internal/useRestoreScroll.tsx +69 -0
  252. package/src/locales/de.ts +902 -0
  253. package/src/locales/en.ts +980 -0
  254. package/src/locales/es.ts +922 -0
  255. package/src/locales/fr.ts +901 -0
  256. package/src/locales/hi.ts +901 -0
  257. package/src/locales/it.ts +901 -0
  258. package/src/locales/pt.ts +909 -0
  259. package/src/util/constants.ts +7 -0
  260. package/src/util/createFormexStub.tsx +66 -0
  261. package/src/util/entity_cache.ts +239 -0
  262. package/src/util/enums.ts +32 -0
  263. package/src/util/icon_list.ts +22 -0
  264. package/src/util/icons.tsx +149 -0
  265. package/src/util/index.ts +12 -0
  266. package/src/util/previews.ts +105 -0
  267. package/src/util/useStorageUploadController.tsx +350 -0
  268. package/src/vitePlugin.ts +196 -0
@@ -0,0 +1,62 @@
1
+ import type { CollectionConfig } from "@rebasepro/types";
2
+ import { Entity, FilterValues, User } from "@rebasepro/types";
3
+ /**
4
+ * @group Hooks and utilities
5
+ */
6
+ export interface CollectionProps<M extends Record<string, any>> {
7
+ /**
8
+ * Absolute collection path
9
+ */
10
+ path: string;
11
+ /**
12
+ * collection of the entity displayed by this collection
13
+ */
14
+ collection: CollectionConfig<M>;
15
+ /**
16
+ * Number of entities to fetch
17
+ */
18
+ itemCount?: number;
19
+ /**
20
+ * Number of items to skip
21
+ */
22
+ offset?: number;
23
+ /**
24
+ * Page number (1-indexed), alternative to offset
25
+ */
26
+ page?: number;
27
+ /**
28
+ * Filter the fetched data by the property
29
+ */
30
+ filterValues?: FilterValues<Extract<keyof M, string>>;
31
+ /**
32
+ * Sort the results by
33
+ */
34
+ sortBy?: [Extract<keyof M, string>, "asc" | "desc"];
35
+ /**
36
+ * Search string
37
+ */
38
+ searchString?: string;
39
+ }
40
+ /**
41
+ * @group Hooks and utilities
42
+ */
43
+ export interface CollectionResult<M extends Record<string, any>> {
44
+ data: Entity<M>[];
45
+ dataLoading: boolean;
46
+ noMoreToLoad: boolean;
47
+ dataLoadingError?: Error;
48
+ totalCount?: number;
49
+ }
50
+ /**
51
+ * This hook is used to fetch collections using a given collection
52
+ * @param path
53
+ * @param collection
54
+ * @param filterValues
55
+ * @param sortBy
56
+ * @param itemCount
57
+ * @param offset
58
+ * @param page
59
+ * @param searchString
60
+ * @group Hooks and utilities
61
+ */
62
+ export declare function useCollection<M extends Record<string, any>, USER extends User>({ path, collection, filterValues, sortBy, itemCount, offset, page, searchString }: CollectionProps<M>): CollectionResult<M>;
@@ -0,0 +1,13 @@
1
+ import { RebaseData } from "@rebasepro/types";
2
+ /**
3
+ * Use this hook to access the unified data API.
4
+ *
5
+ * ```ts
6
+ * const data = useData();
7
+ * const { data: products } = await data.products.find({ where: { status: ["==", "published"] } });
8
+ * await data.products.create({ name: "Camera", price: 299 });
9
+ * ```
10
+ *
11
+ * @group Hooks and utilities
12
+ */
13
+ export declare const useData: () => RebaseData;
@@ -0,0 +1,12 @@
1
+ import { Entity } from "@rebasepro/types";
2
+ export interface DataOrderProps<M extends Record<string, any>> {
3
+ data: Entity<M>[];
4
+ entitiesDisplayedFirst?: Entity<M>[];
5
+ }
6
+ /**
7
+ * This hook is used to have some entities at the beginning of data.
8
+ * @param path
9
+ * @param entitiesDisplayedFirst
10
+ * @group Hooks and utilities
11
+ */
12
+ export declare function useDataOrder<M extends Record<string, any>>({ data, entitiesDisplayedFirst }: DataOrderProps<M>): Entity<M>[];
@@ -0,0 +1,43 @@
1
+ import type { CollectionConfig } from "@rebasepro/types";
2
+ import { Entity, User } from "@rebasepro/types";
3
+ /**
4
+ * @group Hooks and utilities
5
+ */
6
+ export interface FetchProps<M extends Record<string, any>, USER extends User = User> {
7
+ path: string;
8
+ entityId?: string | number;
9
+ databaseId?: string;
10
+ collection: CollectionConfig<M, USER>;
11
+ useCache?: boolean;
12
+ }
13
+ /**
14
+ * @group Hooks and utilities
15
+ */
16
+ export interface FetchResult<M extends Record<string, any>> {
17
+ entity?: Entity<M>;
18
+ dataLoading: boolean;
19
+ dataLoadingError?: Error;
20
+ }
21
+ /**
22
+ * Pre-populate the entity fetch cache with entities loaded from a collection.
23
+ * This allows entity detail views to render instantly using cached data,
24
+ * while the background fetch/listener brings in fresh data.
25
+ * @param path - The collection path (e.g. "products")
26
+ * @param entities - Array of entities to cache
27
+ */
28
+ export declare function populateFetchCache<M extends Record<string, any>>(path: string, entities: Entity<M>[]): void;
29
+ /**
30
+ * Clear the entity fetch cache. Call this on auth state changes (e.g. logout)
31
+ * to prevent stale data from a previous session leaking into the next.
32
+ */
33
+ export declare function clearFetchCache(): void;
34
+ /**
35
+ * This hook is used to fetch a entity.
36
+ * It gives real time updates if the driver supports it.
37
+ * @param path
38
+ * @param collection
39
+ * @param entityId
40
+ * @param useCache
41
+ * @group Hooks and utilities
42
+ */
43
+ export declare function useFetch<M extends Record<string, any>, USER extends User = User>({ path, entityId, collection, databaseId, useCache }: FetchProps<M, USER>): FetchResult<M>;
@@ -0,0 +1,52 @@
1
+ import type { CollectionConfig } from "@rebasepro/types";
2
+ import { Entity, EntityRelation, FilterValues } from "@rebasepro/types";
3
+ export interface RelationItem {
4
+ id: string | number;
5
+ label: string;
6
+ description?: string;
7
+ data: Entity<any>;
8
+ relation: EntityRelation;
9
+ }
10
+ export interface UseRelationSelectorProps<M extends Record<string, any> = any> {
11
+ /**
12
+ * Full path where the relation data is located
13
+ */
14
+ path: string;
15
+ /**
16
+ * The collection that represents the relation entities
17
+ */
18
+ collection: CollectionConfig<M>;
19
+ /**
20
+ * Force filter to be applied to the relation search
21
+ */
22
+ fixedFilter?: FilterValues<string>;
23
+ /**
24
+ * Page size for pagination
25
+ */
26
+ pageSize?: number;
27
+ /**
28
+ * Function to extract the label from a entity
29
+ */
30
+ getLabelFromEntity?: (entity: Entity<M>) => string;
31
+ /**
32
+ * Function to extract the description from a entity
33
+ */
34
+ getDescriptionFromEntity?: (entity: Entity<M>) => string | undefined;
35
+ /**
36
+ * Property name to use as the secondary display field
37
+ */
38
+ descriptionProperty?: keyof M;
39
+ }
40
+ export interface RelationSelectorController {
41
+ items: RelationItem[];
42
+ isLoading: boolean;
43
+ error: Error | undefined;
44
+ search: (searchString: string) => void;
45
+ loadMore: () => void;
46
+ hasMore: boolean;
47
+ entityToRelationItem: (entity: Entity<any>, relation: EntityRelation) => RelationItem;
48
+ }
49
+ /**
50
+ * Hook to manage relation selection with data fetching from Rebase data source
51
+ */
52
+ export declare function useRelationSelector<M extends Record<string, any> = any>({ path, collection, fixedFilter, pageSize, getLabelFromEntity, getDescriptionFromEntity, descriptionProperty }: UseRelationSelectorProps<M>): RelationSelectorController;
@@ -0,0 +1,36 @@
1
+ export * from "./data/useData";
2
+ export * from "./data/useCollection";
3
+ export * from "./data/useFetch";
4
+ export * from "./data/useRelationSelector";
5
+ export * from "./data/save";
6
+ export * from "./data/delete";
7
+ export * from "./useUnsavedChangesDialog";
8
+ export * from "./useStorageSource";
9
+ export * from "./useAuthController";
10
+ export * from "./useAuthSubscription";
11
+ export * from "./useDialogsController";
12
+ export * from "./useAdminModeController";
13
+ export * from "./useBuildAdminModeController";
14
+ export * from "./useEffectiveRoleController";
15
+ export * from "./useBuildEffectiveRoleController";
16
+ export * from "./useRebaseContext";
17
+ export * from "./useSnackbarController";
18
+ export * from "./useModeController";
19
+ export * from "./useClipboard";
20
+ export * from "./useLargeLayout";
21
+ export * from "./useCollapsedGroups";
22
+ export * from "./useBrowserTitleAndIcon";
23
+ export * from "./useSlot";
24
+ export * from "./useCustomizationController";
25
+ export * from "./useBuildLocalConfigurationPersistence";
26
+ export * from "./useBuildModeController";
27
+ export * from "./useRebaseRegistry";
28
+ export * from "./useBackendStorageSource";
29
+ export * from "./usePermissions";
30
+ export * from "./ApiConfigContext";
31
+ export * from "./useTranslation";
32
+ export * from "./useRebaseClient";
33
+ export * from "./useAnalyticsController";
34
+ export * from "./useUserConfigurationPersistence";
35
+ export * from "./useResolvedComponent";
36
+ export * from "./useComponentOverride";
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Use this controller to change the admin mode (developer vs editor)
3
+ * @group Hooks and utilities
4
+ */
5
+ export interface AdminModeController {
6
+ mode: "content" | "studio" | "settings";
7
+ setMode: (mode: "content" | "studio" | "settings") => void;
8
+ }
9
+ /**
10
+ * Hook to retrieve the current admin mode ("developer" | "editor"), and `setMode`
11
+ * to change it.
12
+ *
13
+ * Consider that in order to use this hook you need to have a parent
14
+ * `Rebase`
15
+ *
16
+ * @see AdminModeController
17
+ * @group Hooks and utilities
18
+ */
19
+ export declare const useAdminModeController: () => AdminModeController;
@@ -0,0 +1,5 @@
1
+ import { AnalyticsController } from "@rebasepro/types";
2
+ /**
3
+ * @group Hooks and utilities
4
+ */
5
+ export declare const useAnalyticsController: () => AnalyticsController;
@@ -0,0 +1,11 @@
1
+ import { AuthController, User } from "@rebasepro/types";
2
+ /**
3
+ * Hook to retrieve the AuthContext.
4
+ *
5
+ * Consider that in order to use this hook you need to have a parent
6
+ * `Rebase`
7
+ *
8
+ * @see AuthController
9
+ * @group Hooks and utilities
10
+ */
11
+ export declare const useAuthController: <USER extends User = User, AuthControllerType extends AuthController<USER> = AuthController<USER>>() => AuthControllerType;
@@ -0,0 +1,2 @@
1
+ import { AuthClient, AuthController } from "@rebasepro/types";
2
+ export declare function useAuthSubscription(authClient?: AuthClient): AuthController;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * React hook for using backend storage API as a StorageSource
3
+ */
4
+ import { StorageSource } from "@rebasepro/types";
5
+ export interface BackendStorageSourceProps {
6
+ /**
7
+ * Backend API URL (e.g., 'http://localhost:3001')
8
+ */
9
+ apiUrl: string;
10
+ /**
11
+ * Function to get the current auth token
12
+ */
13
+ getAuthToken: () => Promise<string>;
14
+ }
15
+ /**
16
+ * Hook to create a StorageSource that uses the backend storage REST API.
17
+ * Use this for self-hosted Rebase with local or S3 storage.
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * const storageSource = useBackendStorageSource({
22
+ * apiUrl: 'http://localhost:3001',
23
+ * getAuthToken: authController.getAuthToken
24
+ * });
25
+ *
26
+ * // Then pass to Rebase:
27
+ * <Rebase storageSource={storageSource} ... />
28
+ * ```
29
+ */
30
+ export declare function useBackendStorageSource({ apiUrl, getAuthToken }: BackendStorageSourceProps): StorageSource;
@@ -0,0 +1,18 @@
1
+ import type { StudioBridge } from "./useStudioBridge";
2
+ /**
3
+ * Registers a value into the self-assembling Studio bridge.
4
+ *
5
+ * Each controller (collectionRegistry, sidePanel, url, navigation, breadcrumbs)
6
+ * calls this hook on mount to inject its real implementation into the bridge.
7
+ * On unmount the slice is automatically removed, reverting to the noop default.
8
+ *
9
+ * Usage:
10
+ * ```tsx
11
+ * function SomeProvider({ children }) {
12
+ * const controller = useBuildSomeController();
13
+ * useBridgeRegistration("sidePanelController", controller);
14
+ * return <SomeContext.Provider value={controller}>{children}</SomeContext.Provider>;
15
+ * }
16
+ * ```
17
+ */
18
+ export declare function useBridgeRegistration<K extends keyof StudioBridge>(key: K, value: StudioBridge[K]): void;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Internal hook to handle the browser title and icon
3
+ * @param name
4
+ * @param logo
5
+ */
6
+ export declare function useBrowserTitleAndIcon(name: string, logo?: string): void;
@@ -0,0 +1,6 @@
1
+ import { AdminModeController } from "./index";
2
+ /**
3
+ * Use this hook to build an admin mode controller that determines
4
+ * whether the UI shows Developer or Editor tools.
5
+ */
6
+ export declare function useBuildAdminModeController(): AdminModeController;
@@ -0,0 +1,8 @@
1
+ import type { EffectiveRoleController } from "@rebasepro/types";
2
+ /**
3
+ * Use this hook to build an effective role controller that determines
4
+ * what role is simulated in Editor mode when Dev mode is active.
5
+ *
6
+ * It uses localStorage to persist the simulated role across reloads.
7
+ */
8
+ export declare function useBuildEffectiveRoleController(): EffectiveRoleController;
@@ -0,0 +1,2 @@
1
+ import { UserConfigurationPersistence } from "@rebasepro/types";
2
+ export declare function useBuildLocalConfigurationPersistence(): UserConfigurationPersistence;
@@ -0,0 +1,6 @@
1
+ import { ModeController } from "./index";
2
+ /**
3
+ * Use this hook to build a color mode controller that determines
4
+ * the theme of the CMS
5
+ */
6
+ export declare function useBuildModeController(): ModeController;
@@ -0,0 +1,57 @@
1
+ import { MutableRefObject } from "react";
2
+ export interface UseClipboardProps {
3
+ /**
4
+ * It's callback function that is called after the `copy` command
5
+ * is executed.
6
+ *
7
+ * @param text: The selected clipboard text.
8
+ */
9
+ onSuccess?: (text: string) => void;
10
+ /**
11
+ * Triggers when the hook encounters an error.
12
+ * If passed hook won't throw an error.
13
+ *
14
+ * @param error: cause of the error
15
+ */
16
+ onError?: (error: string) => void;
17
+ /**
18
+ * Disables the new clipboard API `navigator.clipboard` even if
19
+ * it is supported.
20
+ */
21
+ disableClipboardAPI?: boolean;
22
+ /**
23
+ * revert back the isCopied flag to false again if a value is set.
24
+ */
25
+ copiedDuration?: number;
26
+ }
27
+ export interface useClipboardReturnType {
28
+ /**
29
+ * Use ref to pull the text content from.
30
+ */
31
+ ref: MutableRefObject<any>;
32
+ /**
33
+ * Use it to perform the copy operation
34
+ */
35
+ copy: (text?: string) => void;
36
+ /**
37
+ * Use it to perform the cut operation
38
+ */
39
+ cut: () => void;
40
+ /**
41
+ * Indicates wheater the content was successfully copied or not.
42
+ */
43
+ isCoppied: boolean;
44
+ /**
45
+ * Current selected clipboard content.
46
+ */
47
+ clipboard: string;
48
+ /**
49
+ * Clears the user clipboard.
50
+ */
51
+ clearClipboard: () => void;
52
+ /**
53
+ * Check to see if the browser supports the new `navigator.clipboard` API.
54
+ */
55
+ isSupported: () => boolean;
56
+ }
57
+ export declare const useClipboard: (options?: UseClipboardProps) => useClipboardReturnType;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Custom hook for managing collapsed/expanded state of navigation groups
3
+ * with localStorage persistence. Automatically cleans up stale group entries
4
+ * when groups are removed from the navigation.
5
+ *
6
+ * Groups that have never been toggled by the user fall back to
7
+ * `defaults[groupName]` (driven by `collapsedByDefault` in config).
8
+ *
9
+ * @param groupNames - Array of group names to track
10
+ * @param namespace - Namespace for localStorage key (e.g., "home", "drawer") to allow independent state
11
+ * @param defaults - Optional map of group name → collapsed boolean from config
12
+ */
13
+ export declare function useCollapsedGroups(groupNames: string[], namespace?: string, defaults?: Record<string, boolean>): {
14
+ isGroupCollapsed: (name: string) => boolean;
15
+ toggleGroupCollapsed: (name: string) => void;
16
+ };
17
+ /**
18
+ * Build a defaults map from navigationGroupMappings for a given namespace.
19
+ * Returns a Record<groupName, collapsed> that can be passed to useCollapsedGroups.
20
+ */
21
+ export declare function buildCollapsedDefaults(mappings: Array<{
22
+ name: string;
23
+ collapsedByDefault?: boolean | {
24
+ drawer?: boolean;
25
+ home?: boolean;
26
+ };
27
+ }> | undefined, namespace: "drawer" | "home"): Record<string, boolean>;
@@ -0,0 +1,32 @@
1
+ import React from "react";
2
+ import type { OverridableComponentName } from "@rebasepro/types";
3
+ /**
4
+ * Resolves a potentially overridden component.
5
+ *
6
+ * Resolution order:
7
+ * 1. Collection-scoped override (highest priority)
8
+ * 2. Global override
9
+ * 3. Default component (fallback)
10
+ *
11
+ * Supports two override modes:
12
+ * - **Eject** (default): The override component fully replaces the default.
13
+ * - **Wrap** (`wrap: true`): The override component wraps the default.
14
+ * The default is passed as `OriginalComponent` in props.
15
+ *
16
+ * @param name - The overridable component name (e.g. `"Entity.Form"`)
17
+ * @param DefaultComponent - The built-in default component
18
+ * @returns The resolved component — either the default, a full replacement, or a wrapper
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * import { useComponentOverride } from "@rebasepro/app";
23
+ *
24
+ * function EntityFormWrapper(props: EntityFormProps) {
25
+ * const ResolvedForm = useComponentOverride("Entity.Form", DefaultEntityForm);
26
+ * return <ResolvedForm {...props} />;
27
+ * }
28
+ * ```
29
+ *
30
+ * @group Hooks
31
+ */
32
+ export declare function useComponentOverride<P>(name: OverridableComponentName, DefaultComponent: React.ComponentType<P>): React.ComponentType<P>;
@@ -0,0 +1,11 @@
1
+ import type { CustomizationController } from "@rebasepro/types";
2
+ /**
3
+ * Use this hook to retrieve the customization controller.
4
+ * This hook includes all the customization options that can be used
5
+ * to customize the CMS.
6
+ *
7
+ * You will likely not need to use this hook directly.
8
+ *
9
+ * @group Hooks and utilities
10
+ */
11
+ export declare const useCustomizationController: () => CustomizationController;
@@ -0,0 +1,11 @@
1
+ import type { DialogsController } from "@rebasepro/types";
2
+ /**
3
+ * Use this hook to open a dialog imperatively.
4
+ * Alternatively, you can use dialogs declaratively using the `Dialog` component.
5
+ *
6
+ * Consider that in order to use this hook you need to have a parent
7
+ * `Rebase`
8
+ *
9
+ * @group Hooks and utilities
10
+ */
11
+ export declare const useDialogsController: () => DialogsController;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Hook to retrieve the {@link EffectiveRoleController}
3
+ *
4
+ * @see EffectiveRoleController
5
+ * @category Hooks and utilities
6
+ */
7
+ export declare const useEffectiveRoleController: () => import("@rebasepro/types").EffectiveRoleController;
@@ -0,0 +1 @@
1
+ export declare const useLargeLayout: () => boolean;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Use this controller to change color mode
3
+ * @group Hooks and utilities
4
+ */
5
+ export interface ModeController {
6
+ mode: "light" | "dark";
7
+ setMode: (mode: "light" | "dark" | "system") => void;
8
+ }
9
+ /**
10
+ * Hook to retrieve the current mode ("light" | "dark"), and `setMode`
11
+ * or `toggle` functions to change it.
12
+ *
13
+ * Consider that in order to use this hook you need to have a parent
14
+ * `Rebase`
15
+ *
16
+ * @see ModeController
17
+ * @group Hooks and utilities
18
+ */
19
+ export declare const useModeController: () => ModeController;
@@ -0,0 +1,12 @@
1
+ import type { CollectionConfig } from "@rebasepro/types";
2
+ import { Entity } from "@rebasepro/types";
3
+ /**
4
+ * Hook to evaluate roles and permissions for the current user.
5
+ * It abstracts away the need to pass `authController` to permission evaluation functions.
6
+ */
7
+ export declare function usePermissions(): {
8
+ canCreate: (collection: CollectionConfig<any>, path: string) => boolean;
9
+ canEdit: (collection: CollectionConfig<any>, path: string, entity: Entity<any> | null) => boolean;
10
+ canDelete: (collection: CollectionConfig<any>, path: string, entity: Entity<any> | null) => boolean;
11
+ canRead: (collection: CollectionConfig<any>) => boolean;
12
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Hook to retrieve the full RebaseClient instance from context.
3
+ * Returns `undefined` if no client was provided to `<Rebase>`.
4
+ */
5
+ export declare function useRebaseClient<T = any>(): T | undefined;
@@ -0,0 +1,11 @@
1
+ import { AuthController, RebaseContext, User } from "@rebasepro/types";
2
+ /**
3
+ * Hook to retrieve the {@link RebaseContext}.
4
+ *
5
+ * Consider that in order to use this hook you need to have a parent
6
+ * `Rebase` component.
7
+ *
8
+ * @see RebaseContext
9
+ * @group Hooks and utilities
10
+ */
11
+ export declare const useRebaseContext: <USER extends User = User, AuthControllerType extends AuthController<USER> = AuthController<USER>>() => RebaseContext<USER, AuthControllerType>;
@@ -0,0 +1,34 @@
1
+ import React from "react";
2
+ import type { RebaseRegistryController, RebaseAdminConfig, RebaseStudioConfig, RebaseAuthConfig } from "@rebasepro/types";
3
+ /**
4
+ * Split into two contexts to prevent infinite re-render loops:
5
+ * - DispatchContext: stable register/unregister functions (never changes identity)
6
+ * - StateContext: the current config values (changes when modules register)
7
+ *
8
+ * Feature components (RebaseAuth, RebaseAdmin, RebaseStudio) only consume
9
+ * the dispatch context, so registering does NOT cause them to re-render.
10
+ * RebaseShell consumes state context to read the collected configs.
11
+ */
12
+ interface RegistryDispatch {
13
+ registerCMS: (config: RebaseAdminConfig) => void;
14
+ unregisterCMS: () => void;
15
+ registerStudio: (config: RebaseStudioConfig) => void;
16
+ unregisterStudio: () => void;
17
+ registerAuth: (config: RebaseAuthConfig) => void;
18
+ unregisterAuth: () => void;
19
+ }
20
+ export declare function RebaseRegistryProvider({ children }: {
21
+ children: React.ReactNode;
22
+ }): React.JSX.Element;
23
+ /**
24
+ * Returns the full registry (state + dispatch).
25
+ * Use this in RebaseShell where you need to read configs.
26
+ */
27
+ export declare function useRebaseRegistry(): RebaseRegistryController;
28
+ /**
29
+ * Returns only the stable dispatch functions.
30
+ * Use this in feature components (RebaseAuth, RebaseAdmin, RebaseStudio)
31
+ * to avoid re-render loops.
32
+ */
33
+ export declare function useRebaseRegistryDispatch(): RegistryDispatch;
34
+ export {};
@@ -0,0 +1,47 @@
1
+ import React from "react";
2
+ import type { ComponentRef } from "@rebasepro/types";
3
+ /**
4
+ * Resolves a `ComponentRef` into a renderable `React.ComponentType`.
5
+ *
6
+ * This hook handles all three forms of `ComponentRef`:
7
+ *
8
+ * 1. **`LazyComponentRef`** (produced by the Vite plugin from string paths):
9
+ * Wraps the lazy loader with `React.lazy()` for automatic code-splitting.
10
+ *
11
+ * 2. **`() => Promise<{ default: ComponentType }>`** (manual lazy import):
12
+ * Also wraps with `React.lazy()`. Distinguished from regular components
13
+ * by checking that the function has no parameters and is not a known
14
+ * React internal (no `$$typeof`).
15
+ *
16
+ * 3. **Direct `React.ComponentType`**:
17
+ * Returned as-is.
18
+ *
19
+ * If the ref is `undefined` or a raw string (which should never happen at
20
+ * runtime in the browser since the Vite plugin transforms strings), returns `undefined`.
21
+ *
22
+ * The returned component is stable across re-renders as long as the `ref`
23
+ * is referentially stable.
24
+ *
25
+ * **Usage:** Wrap the rendered component in `<Suspense>` to handle the
26
+ * loading state of lazy components.
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * const ResolvedField = useResolvedComponent(property.ui?.Field);
31
+ * if (!ResolvedField) return null;
32
+ * return (
33
+ * <Suspense fallback={<CircularProgress />}>
34
+ * <ResolvedField {...fieldProps} />
35
+ * </Suspense>
36
+ * );
37
+ * ```
38
+ * */
39
+ export declare function useResolvedComponent<P = unknown>(ref: ComponentRef<P> | undefined): React.ComponentType<P> | undefined;
40
+ /**
41
+ * Pure function version of the resolver, for use outside React components.
42
+ * Same resolution logic as `useResolvedComponent`.
43
+ *
44
+ * Results are cached per reference identity — calling this multiple times
45
+ * with the same `ref` object returns the same `React.ComponentType`.
46
+ */
47
+ export declare function resolveComponentRef<P = unknown>(ref: ComponentRef<P> | undefined): React.ComponentType<P> | undefined;