@rebasepro/app 0.24.0 → 0.24.1-canary.g19596ef
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/README.md +2 -2
- package/dist/components/common/useColumnsIds.d.ts +2 -2
- package/dist/components/common/useDataTableController.d.ts +15 -1
- package/dist/components/common/useScrollRestoration.d.ts +16 -7
- package/dist/contexts/CollectionResolverContext.d.ts +8 -1
- package/dist/contexts/StorageSourcesContext.d.ts +6 -0
- package/dist/core/RebaseProps.d.ts +21 -0
- package/dist/core/deprecated_plugin_keys.d.ts +10 -0
- package/dist/de-BcBo287O.js +1434 -0
- package/dist/de-BcBo287O.js.map +1 -0
- package/dist/debug/ui-reference/ComponentSections.d.ts +16 -0
- package/dist/debug.js +867 -484
- package/dist/es-D-JXBvsW.js +1442 -0
- package/dist/es-D-JXBvsW.js.map +1 -0
- package/dist/fr-BKGBSaZM.js +1434 -0
- package/dist/fr-BKGBSaZM.js.map +1 -0
- package/dist/hi-D1jEYlQ1.js +1434 -0
- package/dist/hi-D1jEYlQ1.js.map +1 -0
- package/dist/hooks/data/collectionWindow.d.ts +146 -13
- package/dist/hooks/data/save.d.ts +11 -2
- package/dist/hooks/data/useBatchedFetch.d.ts +21 -0
- package/dist/hooks/data/useDataOrder.d.ts +6 -0
- package/dist/hooks/data/useFetch.d.ts +12 -4
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useBuildModeController.d.ts +22 -2
- package/dist/hooks/useComponentOverride.d.ts +10 -7
- package/dist/hooks/useNavigationBlocker.d.ts +17 -9
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +1558 -8659
- package/dist/index.es.js.map +1 -1
- package/dist/it-DLXLsP1j.js +1434 -0
- package/dist/it-DLXLsP1j.js.map +1 -0
- package/dist/pt-Dd3JWvUZ.js +1439 -0
- package/dist/pt-Dd3JWvUZ.js.map +1 -0
- package/dist/util/previews.d.ts +22 -5
- package/dist/util/useStorageUploadController.d.ts +6 -2
- package/dist/vitePlugin.js +2 -0
- package/package.json +11 -7
- package/dist/hooks/useBackendStorageSource.d.ts +0 -35
package/README.md
CHANGED
|
@@ -67,8 +67,8 @@ This package is **framework-agnostic** in the sense that it doesn't depend on an
|
|
|
67
67
|
| `useRebaseContext` | Access the top-level Rebase context |
|
|
68
68
|
| `useDialogsController` | Programmatic dialog management |
|
|
69
69
|
| `useSnackbarController` | Show snackbar notifications |
|
|
70
|
-
| `useModeController` / `useBuildModeController` | Light/dark mode |
|
|
71
|
-
| `useStorageSource`
|
|
70
|
+
| `useModeController` / `useBuildModeController` | Light/dark mode: `mode` and `setMode("light" \| "dark" \| "system")`. To let your app own the theme, pass its own controller as `<Rebase modeController>`; `useBuildModeController({ enabled: false })` builds one that touches nothing outside React |
|
|
71
|
+
| `useStorageSource` | Storage source from context |
|
|
72
72
|
| `useRebaseClient` | Access the `RebaseClient` instance |
|
|
73
73
|
| `useLargeLayout` | Responsive layout breakpoint hook |
|
|
74
74
|
| `useClipboard` | Copy-to-clipboard |
|
|
@@ -12,8 +12,8 @@ export declare function getSubcollectionColumnId(collection: AdminCollection<any
|
|
|
12
12
|
* Every child view gets a 200px button column that opens its tab. For a relation
|
|
13
13
|
* declared in `relations` that button is the relation's only presence in the
|
|
14
14
|
* table. For one declared as a property it is the second: the property's own
|
|
15
|
-
* column is already there, hydrated by the list fetch's `include
|
|
16
|
-
* the child rows themselves — and carrying the *same heading*, because the tab
|
|
15
|
+
* column is already there, hydrated by the list fetch's `include`
|
|
16
|
+
* (`getRelationIncludeParams`), showing the child rows themselves — and carrying the *same heading*, because the tab
|
|
17
17
|
* takes its name from the declaring property. Two columns called "Applications",
|
|
18
18
|
* one of them a button, and nothing in the header to tell them apart.
|
|
19
19
|
*
|
|
@@ -2,6 +2,12 @@ import { Entity, FilterValues, User } from "@rebasepro/types";
|
|
|
2
2
|
import { EntityTableController, AdminCollection } from "@rebasepro/cms-types";
|
|
3
3
|
import { ScrollRestorationController } from "./useScrollRestoration.js";
|
|
4
4
|
export declare const DEFAULT_PAGE_SIZE = 50;
|
|
5
|
+
/**
|
|
6
|
+
* Rows held with `pagination: false` past which development builds warn. The
|
|
7
|
+
* docs promise every row, so they are all loaded; but tens of thousands of
|
|
8
|
+
* them sit in memory and re-render on every change, and nothing said so.
|
|
9
|
+
*/
|
|
10
|
+
export declare const UNPAGINATED_WARNING_ROWS = 10000;
|
|
5
11
|
export type DataTableControllerProps<M extends Record<string, any> = any> = {
|
|
6
12
|
/**
|
|
7
13
|
* Full path where the data of this table is located
|
|
@@ -26,6 +32,14 @@ export type DataTableControllerProps<M extends Record<string, any> = any> = {
|
|
|
26
32
|
* When set to true the filters and sort will be updated in the URL
|
|
27
33
|
*/
|
|
28
34
|
updateUrl?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Read rows at all. Defaults to `true`. `false` closes the subscription and
|
|
37
|
+
* reads nothing — for a view that keeps the controller for its search and
|
|
38
|
+
* filters but draws its rows some other way, like the board, whose columns
|
|
39
|
+
* each read their own. The rows already held stay until it is enabled
|
|
40
|
+
* again, which reads afresh.
|
|
41
|
+
*/
|
|
42
|
+
enabled?: boolean;
|
|
29
43
|
};
|
|
30
44
|
/**
|
|
31
45
|
* Use this hook to build a controller for the {@link DataCollectionTable}.
|
|
@@ -42,4 +56,4 @@ export type DataTableControllerProps<M extends Record<string, any> = any> = {
|
|
|
42
56
|
* @param fixedFilterFromProps
|
|
43
57
|
* @param updateUrl
|
|
44
58
|
*/
|
|
45
|
-
export declare function useDataTableController<M extends Record<string, any> = any, USER extends User = User>({ path, collection, scrollRestoration, entitiesDisplayedFirst, lastDeleteTimestamp, fixedFilter: fixedFilterFromProps, updateUrl }: DataTableControllerProps<M>): EntityTableController<M>;
|
|
59
|
+
export declare function useDataTableController<M extends Record<string, any> = any, USER extends User = User>({ path, collection, scrollRestoration, entitiesDisplayedFirst, lastDeleteTimestamp, fixedFilter: fixedFilterFromProps, updateUrl, enabled }: DataTableControllerProps<M>): EntityTableController<M>;
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import { Entity, FilterValues } from "@rebasepro/types";
|
|
2
|
+
/**
|
|
3
|
+
* Where a collection view was, and the rows to show when it comes back.
|
|
4
|
+
*
|
|
5
|
+
* `data` is the rows around what was on screen — a page either side, when the
|
|
6
|
+
* view reports what it draws — starting at row `dataOffset` (0 when absent:
|
|
7
|
+
* `data` then starts at the first row). It used to be every row the view held,
|
|
8
|
+
* which a table scrolled to 100,000 rows kept for the rest of the session and
|
|
9
|
+
* read again in full on the way back.
|
|
10
|
+
*/
|
|
11
|
+
export type CollectionScrollEntry = {
|
|
12
|
+
scrollOffset: number;
|
|
13
|
+
data: Entity<any>[];
|
|
14
|
+
dataOffset?: number;
|
|
15
|
+
};
|
|
2
16
|
/**
|
|
3
17
|
* Forget every collection's scroll position and the rows kept with it.
|
|
4
18
|
*
|
|
@@ -7,15 +21,10 @@ import { Entity, FilterValues } from "@rebasepro/types";
|
|
|
7
21
|
*/
|
|
8
22
|
export declare function clearCollectionScrollCache(): void;
|
|
9
23
|
export type ScrollRestorationController = {
|
|
10
|
-
getCollectionScroll: (path: string, filters?: FilterValues<any>) =>
|
|
11
|
-
|
|
12
|
-
data: Entity<any>[];
|
|
13
|
-
} | undefined;
|
|
14
|
-
updateCollectionScroll: (props: {
|
|
24
|
+
getCollectionScroll: (path: string, filters?: FilterValues<any>) => CollectionScrollEntry | undefined;
|
|
25
|
+
updateCollectionScroll: (props: CollectionScrollEntry & {
|
|
15
26
|
path: string;
|
|
16
|
-
scrollOffset: number;
|
|
17
27
|
filters?: FilterValues<any>;
|
|
18
|
-
data: Entity<any>[];
|
|
19
28
|
}) => void;
|
|
20
29
|
};
|
|
21
30
|
export declare function useScrollRestoration(): ScrollRestorationController;
|
|
@@ -29,5 +29,12 @@ export type DataPathResolver = (path: string) => string | undefined;
|
|
|
29
29
|
* to be. The views that fetch rows are *below* the registrar, and child effects
|
|
30
30
|
* run before parent effects, so registering in an effect would bind after the
|
|
31
31
|
* first page of rows had already been converted.
|
|
32
|
+
*
|
|
33
|
+
* Several layers may own collections at once — the CMS navigation, and each
|
|
34
|
+
* standalone `CollectionsProvider` on a page — so each registers under its own
|
|
35
|
+
* `owner` (`"default"` when omitted). A lookup asks every owner and takes the
|
|
36
|
+
* first that knows the collection. Registering nothing (`undefined` for both)
|
|
37
|
+
* removes that owner's registration.
|
|
32
38
|
*/
|
|
33
|
-
export
|
|
39
|
+
export type CollectionResolverRegistration = (resolver: CollectionResolver | undefined, resolveDataPath?: DataPathResolver, owner?: string) => void;
|
|
40
|
+
export declare const CollectionResolverRegistrationContext: React.Context<CollectionResolverRegistration>;
|
|
@@ -14,6 +14,12 @@ export interface StorageSourcesContextValue {
|
|
|
14
14
|
registry: Record<string, StorageSourceDefinition>;
|
|
15
15
|
/** Built {@link StorageSource} for direct sources, keyed by key. */
|
|
16
16
|
sources: Record<string, StorageSource>;
|
|
17
|
+
/**
|
|
18
|
+
* A server-routed source for a key not (yet) in `sources` — requests carry
|
|
19
|
+
* `?storageId=<key>`, so the server serves it or refuses naming it, rather
|
|
20
|
+
* than the panel guessing the default. Absent without a client.
|
|
21
|
+
*/
|
|
22
|
+
createSource?: (key: string) => StorageSource;
|
|
17
23
|
}
|
|
18
24
|
/** @internal */
|
|
19
25
|
export declare const StorageSourcesContext: React.Context<StorageSourcesContextValue>;
|
|
@@ -45,6 +45,7 @@ type DeepPartial<T> = T extends object ? {
|
|
|
45
45
|
*/
|
|
46
46
|
export type { EffectiveRoleController } from "@rebasepro/types";
|
|
47
47
|
import type { EffectiveRoleController } from "@rebasepro/types";
|
|
48
|
+
import type { ModeController } from "../hooks/useModeController.js";
|
|
48
49
|
/**
|
|
49
50
|
* Props for the main {@link Rebase} component.
|
|
50
51
|
*
|
|
@@ -265,6 +266,26 @@ export type RebaseProps<USER extends User, DB = unknown> = {
|
|
|
265
266
|
* Controller to simulate different roles when dev mode is active.
|
|
266
267
|
*/
|
|
267
268
|
effectiveRoleController?: EffectiveRoleController;
|
|
269
|
+
/**
|
|
270
|
+
* The light/dark mode, owned by the host app.
|
|
271
|
+
*
|
|
272
|
+
* Without it, `<Rebase>` owns the page's theme: it puts the `dark` class on
|
|
273
|
+
* `<html>`, follows `prefers-color-scheme`, remembers the user's pick in
|
|
274
|
+
* localStorage, and takes its class away when it unmounts. Pass one when
|
|
275
|
+
* your app already has a theme — Rebase then reads `mode` from it, calls
|
|
276
|
+
* its `setMode` from its own theme toggle, and touches none of the above.
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* ```tsx
|
|
280
|
+
* const [mode, setMode] = useState<"light" | "dark">("light");
|
|
281
|
+
* const modeController = useMemo(() => ({
|
|
282
|
+
* mode,
|
|
283
|
+
* setMode: (next: "light" | "dark" | "system") => setMode(next === "dark" ? "dark" : "light")
|
|
284
|
+
* }), [mode]);
|
|
285
|
+
* <Rebase client={client} modeController={modeController}>…</Rebase>
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
modeController?: ModeController;
|
|
268
289
|
/**
|
|
269
290
|
* Override or extend any Rebase UI string, keyed by locale.
|
|
270
291
|
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RebasePlugin } from "@rebasepro/cms-types";
|
|
2
|
+
/**
|
|
3
|
+
* Warn, once per plugin and key, about plugin keys that are declared on
|
|
4
|
+
* `RebasePlugin` but that nothing has ever called.
|
|
5
|
+
*
|
|
6
|
+
* A plugin that set one of these did nothing and said nothing about it. The
|
|
7
|
+
* types mark them deprecated; this names them at runtime too, which also
|
|
8
|
+
* reaches a plugin written in JavaScript.
|
|
9
|
+
*/
|
|
10
|
+
export declare function warnDeprecatedPluginKeys(plugins: readonly RebasePlugin[]): void;
|