@rebasepro/cms 0.34.0 → 0.34.2
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/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js +1 -1
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js +1 -1
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js +1 -1
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewActions.js +1 -6
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -1
- package/dist/components/RebaseNavigation.js +7 -14
- package/dist/components/RebaseNavigation.js.map +1 -1
- package/dist/index.js +17 -17
- package/package.json +9 -9
|
@@ -2,11 +2,11 @@ import { useCollectionRegistryController } from "../../../hooks/navigation/conte
|
|
|
2
2
|
import { useNavigationStateController } from "../../../hooks/navigation/contexts/NavigationStateContext.js";
|
|
3
3
|
import { useUrlController } from "../../../hooks/navigation/contexts/UrlContext.js";
|
|
4
4
|
import { useSafeSnackbarController } from "../../useSafeSnackbarController.js";
|
|
5
|
+
import { isSchemaChangeCancelled } from "../../liveSchemaClient.js";
|
|
5
6
|
import { ImportSaveInProgress } from "../../../data_import/components/ImportSaveInProgress.js";
|
|
6
7
|
import { useImportConfig } from "../../../data_import/hooks/useImportConfig.js";
|
|
7
8
|
import { getInferenceType } from "../../../data_import/utils/get_import_inference_type.js";
|
|
8
9
|
import { ConfigControllerContext } from "../../ConfigControllerProvider.js";
|
|
9
|
-
import { isSchemaChangeCancelled } from "../../liveSchemaClient.js";
|
|
10
10
|
import { getFullIdPath } from "./util.js";
|
|
11
11
|
import { SchemaEditRefusalView } from "./SchemaEditRefusalView.js";
|
|
12
12
|
import { CollectionEditorSchema } from "./CollectionYupValidation.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getFieldConfig } from "../../../components/field_configs.js";
|
|
2
|
-
import { FieldCaption } from "../../../components/FieldCaption.js";
|
|
3
2
|
import { PropertyConfigBadge } from "../../../components/PropertyConfigBadge.js";
|
|
3
|
+
import { FieldCaption } from "../../../components/FieldCaption.js";
|
|
4
4
|
import { useCollectionsConfigController } from "../../useCollectionsConfigController.js";
|
|
5
5
|
import { LayoutModeSwitch } from "./LayoutModeSwitch.js";
|
|
6
6
|
import { ViewModeSwitch } from "./ViewModeSwitch.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FieldCaption } from "../../../components/FieldCaption.js";
|
|
2
1
|
import { SearchIconsView } from "../../../components/SearchIconsView.js";
|
|
2
|
+
import { FieldCaption } from "../../../components/FieldCaption.js";
|
|
3
3
|
import { useCollectionsConfigController } from "../../useCollectionsConfigController.js";
|
|
4
4
|
import { toSerializableCollectionConfig } from "../../serializable_utils.js";
|
|
5
5
|
import { useState } from "react";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getFieldConfig } from "../../../components/field_configs.js";
|
|
2
|
-
import { FieldCaption } from "../../../components/FieldCaption.js";
|
|
3
2
|
import { PropertyConfigBadge } from "../../../components/PropertyConfigBadge.js";
|
|
3
|
+
import { FieldCaption } from "../../../components/FieldCaption.js";
|
|
4
4
|
import { PropertyFormDialog } from "./PropertyEditView.js";
|
|
5
5
|
import React, { useMemo, useRef, useState } from "react";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { useAdminContext } from "../../hooks/useAdminContext.js";
|
|
2
2
|
import { useToolbarLabels } from "../CollectionTableBinding/internal/CollectionTableToolbar.js";
|
|
3
|
-
import { useCollectionEditorController } from "../../collection_editor/useCollectionEditorController.js";
|
|
4
|
-
import { EditorCollectionAction } from "../../collection_editor/ui/EditorCollectionAction.js";
|
|
5
3
|
import { CollectionAddButton } from "./CollectionAddButton.js";
|
|
6
4
|
import React, { Suspense } from "react";
|
|
7
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -17,8 +15,6 @@ function CollectionViewActions({ collection, relativePath, parentCollectionSlugs
|
|
|
17
15
|
const toolbarLabels = useToolbarLabels();
|
|
18
16
|
const labelled = !compact && toolbarLabels;
|
|
19
17
|
const { t } = useTranslation();
|
|
20
|
-
const collectionEditorController = useCollectionEditorController();
|
|
21
|
-
const hasCollectionEditor = Boolean(collectionEditorController?.editCollection);
|
|
22
18
|
const { selectedCount, hasSelection } = selectionController;
|
|
23
19
|
const addButton = onNewClick && /* @__PURE__ */ jsx(CollectionAddButton, {
|
|
24
20
|
collection,
|
|
@@ -111,8 +107,7 @@ function CollectionViewActions({ collection, relativePath, parentCollectionSlugs
|
|
|
111
107
|
collection.exportable !== false && /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Suspense, {
|
|
112
108
|
fallback: null,
|
|
113
109
|
children: /* @__PURE__ */ jsx(ExportCollectionAction, { ...builtInActionProps })
|
|
114
|
-
}) })
|
|
115
|
-
hasCollectionEditor && /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(EditorCollectionAction, { ...builtInActionProps }) })
|
|
110
|
+
}) })
|
|
116
111
|
] });
|
|
117
112
|
const [overflowOpen, setOverflowOpen] = React.useState(false);
|
|
118
113
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionViewActions.js","names":[],"sources":["../../../src/components/CollectionViewBinding/CollectionViewActions.tsx"],"sourcesContent":["\n\nimport React, { Suspense } from \"react\";\n\nimport { useTranslation, useSlot } from \"@rebasepro/app\";\nimport { CollectionActionsProps, EntityTableController, EntitySelectionController, AdminCollection } from \"@rebasepro/cms-types\";\nimport { Button, IconButton, Tooltip, Popover, iconSize, lazyChunk } from \"@rebasepro/ui\";\nimport { ErrorBoundary, Link2Icon, MoreVerticalIcon, Trash2Icon, Unlink2Icon } from \"@rebasepro/ui\";\nimport { usePermissions } from \"@rebasepro/app\";\nimport { toArray } from \"@rebasepro/utils\";\n// Lazy-load import/export — pulls in exceljs only on demand\nconst ImportCollectionAction = lazyChunk(() => import(\"../../data_import/import\").then(m => ({ default: m.ImportCollectionAction })));\nconst ExportCollectionAction = lazyChunk(() => import(\"../../data_export/export\").then(m => ({ default: m.ExportCollectionAction })));\nimport { EditorCollectionAction } from \"../../collection_editor/ui/EditorCollectionAction\";\nimport { useCollectionEditorController } from \"../../collection_editor/useCollectionEditorController\";\nimport { useAdminContext } from \"../../hooks/useAdminContext\";\nimport { useToolbarLabels } from \"../CollectionTableBinding/internal/CollectionTableToolbar\";\nimport { CollectionAddButton } from \"./CollectionAddButton\";\nimport { selectionControllerOf, tableControllerOf } from \"@rebasepro/app\";\n\nexport type CollectionViewActionsProps<M extends Record<string, unknown>> = {\n collection: AdminCollection<M>;\n path: string;\n relativePath: string;\n parentCollectionSlugs: string[], parentEntityIds: string[];\n selectionEnabled: boolean;\n onNewClick: () => void;\n /**\n * Attach a row that already exists to this parent. Only supplied for a\n * junction-backed tab, where the parent owns the link rather than the row.\n */\n onAddExistingClick?: () => void;\n onMultipleDeleteClick: () => void;\n /**\n * The rows are shared with other records through a junction, so removing\n * them unlinks them from this record and deletes nothing. The bin says so.\n */\n removeUnlinks?: boolean;\n selectionController: EntitySelectionController<M>;\n tableController: EntityTableController<M>;\n collectionEntitiesCount?: number;\n compact?: boolean;\n children?: React.ReactNode;\n openNewDocument: (defaultValues?: Record<string, unknown>) => void;\n}\n\nexport function CollectionViewActions<M extends Record<string, unknown>>({\n collection,\n relativePath,\n parentCollectionSlugs, parentEntityIds,\n onNewClick,\n onAddExistingClick,\n onMultipleDeleteClick,\n removeUnlinks,\n selectionEnabled,\n path,\n selectionController,\n tableController,\n collectionEntitiesCount,\n compact,\n children,\n openNewDocument\n}: CollectionViewActionsProps<M>) {\n const context = useAdminContext();\n\n const { canDelete } = usePermissions();\n\n const toolbarLabels = useToolbarLabels();\n // Labelled controls where the toolbar has room for them — a wide view\n // and labels that fit; their icon-only forms otherwise.\n const labelled = !compact && toolbarLabels;\n const { t } = useTranslation();\n\n // Check if the collection editor context is available (ConfigControllerProvider present)\n const collectionEditorController = useCollectionEditorController();\n const hasCollectionEditor = Boolean(collectionEditorController?.editCollection);\n\n const { selectedCount, hasSelection } = selectionController;\n\n const addButton = onNewClick &&\n <CollectionAddButton collection={collection} path={path} onClick={onNewClick} compact={Boolean(compact)}/>;\n\n // On a junction-backed tab, creating a row is only half of what \"add\" means:\n // the far more common act is attaching one that already exists. There was no\n // way to do that at all — the junction row was only ever written alongside an\n // insert — so a shared vocabulary could only ever grow.\n const linkButton = onAddExistingClick && (labelled\n ? <Button\n id={`link_entity_${path}`}\n onClick={onAddExistingClick}\n startIcon={<Link2Icon size={iconSize.small}/>}\n size=\"small\"\n variant=\"outlined\"\n color=\"neutral\">\n {t(\"add_existing\")}\n </Button>\n : <Tooltip title={t(\"add_existing\")}>\n <Button\n id={`link_entity_${path}`}\n onClick={onAddExistingClick}\n variant=\"outlined\"\n color=\"neutral\"\n size=\"small\">\n <Link2Icon size={iconSize.small}/>\n </Button>\n </Tooltip>);\n\n const multipleDeleteEnabled = canDelete(collection, path, null);\n\n // Only once something is selected. A permanently-disabled bin sat in every\n // collection toolbar — and in the split view, where the toolbar is a narrow\n // strip above the list, it was a third of the visible controls doing\n // nothing. It appears the moment you tick a row, which is when you want it.\n\n // `undefined` is \"every matching row, and nobody knows how many\" — a full\n // selection against an accessor with no `count`. Rendering it as 0 would\n // say the opposite of what is true.\n const countLabel = selectedCount === undefined ? \"…\" : selectedCount.toLocaleString();\n\n let multipleDeleteButton: React.ReactNode | undefined;\n if (hasSelection) {\n const RemoveIcon = removeUnlinks ? Unlink2Icon : Trash2Icon;\n // What the button does, in both forms. The labelled one's only text is\n // the count, so without it a screen reader announced \"(1)\".\n const actionLabel = removeUnlinks ? t(\"remove_from_record\") : t(\"delete_selected\");\n const button = labelled\n // `min-w`, not `w`. A fixed 80px was enough for the one- and\n // two-digit counts you could reach by ticking rows; \"select all\n // matching\" put six digits in here, and a flex child over its width\n // compresses — so the bin itself was what gave way, shrinking to a\n // sliver beside the number. The width is a floor now, so the\n // control still holds its place in the toolbar when the count is\n // short, and `shrink-0` means the icon can never be the thing that\n // gives.\n ? <Button\n variant={\"text\"}\n aria-label={`${actionLabel} (${countLabel})`}\n disabled={!multipleDeleteEnabled}\n startIcon={<RemoveIcon size={iconSize.small} className={\"shrink-0\"}/>}\n onClick={onMultipleDeleteClick}\n color={\"neutral\"}\n className=\"@5xl/collection:min-w-20\"\n >\n ({countLabel})\n </Button>\n : <IconButton aria-label={actionLabel}\n size={\"small\"}\n disabled={!multipleDeleteEnabled}\n onClick={onMultipleDeleteClick}>\n <RemoveIcon size={iconSize.small}/>\n </IconButton>;\n multipleDeleteButton =\n <Tooltip\n title={multipleDeleteEnabled\n ? (removeUnlinks ? t(\"remove_from_record\") : t(\"delete\"))\n : t(\"delete_not_allowed\")}>\n {button}\n </Tooltip>\n }\n\n // The admin's own actions read the records; an app's are handed rows.\n const builtInActionProps = {\n path,\n relativePath,\n parentCollectionSlugs,\n parentEntityIds,\n collection,\n selectionController,\n context,\n tableController,\n collectionEntitiesCount,\n openNewDocument\n };\n const actionProps: CollectionActionsProps<M> = {\n ...builtInActionProps,\n selectionController: selectionControllerOf(selectionController, collection, path),\n tableController: tableControllerOf(tableController, collection)\n };\n\n const actions = toArray(collection.Actions)\n .map((Action, i) => {\n return (\n <ErrorBoundary key={`actions_${i}`}>\n <Suspense fallback={null}>\n <Action {...actionProps}/>\n </Suspense>\n </ErrorBoundary>\n );\n });\n\n const pluginActions = useSlot(\"collection.actions\", actionProps as CollectionActionsProps);\n\n const secondaryActions = (\n <>\n {children}\n <ErrorBoundary>\n {actions}\n {pluginActions}\n </ErrorBoundary>\n <ErrorBoundary>\n <Suspense fallback={null}>\n <ImportCollectionAction {...(actionProps as CollectionActionsProps)}/>\n </Suspense>\n </ErrorBoundary>\n {collection.exportable !== false && (\n <ErrorBoundary>\n <Suspense fallback={null}>\n <ExportCollectionAction {...builtInActionProps}/>\n </Suspense>\n </ErrorBoundary>\n )}\n {hasCollectionEditor && (\n <ErrorBoundary>\n <EditorCollectionAction {...builtInActionProps}/>\n </ErrorBoundary>\n )}\n </>\n );\n\n const [overflowOpen, setOverflowOpen] = React.useState(false);\n\n return (\n <div className=\"flex items-center gap-1\">\n {!compact ? (\n secondaryActions\n ) : (\n <Popover\n open={overflowOpen}\n onOpenChange={setOverflowOpen}\n trigger={\n <IconButton aria-label={t(\"more_actions\")} size=\"small\">\n <MoreVerticalIcon size={iconSize.smallest}/>\n </IconButton>\n }>\n <div className=\"flex flex-row items-center gap-1 p-2\">\n {secondaryActions}\n </div>\n </Popover>\n )}\n {multipleDeleteButton}\n {linkButton}\n {addButton}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAWA,IAAM,yBAAyB,gBAAgB,OAAO,oCAA2B,CAAC,MAAK,OAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;AACpI,IAAM,yBAAyB,gBAAgB,OAAO,oCAA2B,CAAC,MAAK,OAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;AAkCpI,SAAgB,sBAAyD,EACrE,YACA,cACA,uBAAuB,iBACvB,YACA,oBACA,uBACA,eACA,kBACA,MACA,qBACA,iBACA,yBACA,SACA,UACA,mBAC8B;CAC9B,MAAM,UAAU,gBAAgB;CAEhC,MAAM,EAAE,cAAc,eAAe;CAErC,MAAM,gBAAgB,iBAAiB;CAGvC,MAAM,WAAW,CAAC,WAAW;CAC7B,MAAM,EAAE,MAAM,eAAe;CAG7B,MAAM,6BAA6B,8BAA8B;CACjE,MAAM,sBAAsB,QAAQ,4BAA4B,cAAc;CAE9E,MAAM,EAAE,eAAe,iBAAiB;CAExC,MAAM,YAAY,cACd,oBAAC,qBAAD;EAAiC;EAAkB;EAAM,SAAS;EAAY,SAAS,QAAQ,OAAO;CAAG,CAAA;CAM7G,MAAM,aAAa,uBAAuB,WACpC,oBAAC,QAA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kB,iBAAiB,UAAU;CAClE;CAeA,MAAM,mBACF,qBAAA,UAAA,EAAA,UAAA;EACK;EACD,qBAAC,eAAD,EAAA,UAAA,CAhBQ,QAAQ,WAAW,OAAO,CAAC,CACtC,KAAK,QAAQ,MAAM;GAChB,OACI,oBAAC,eAAD,EAAA,UACI,oBAAC,UAAD;IAAU,UAAU;cAChB,oBAAC,QAAD,EAAQ,GAAI,YAAa,CAAA;GACnB,CAAA,EACC,GAJK,WAAW,GAIhB;EAEvB,CAQS,GANS,QAAQ,sBAAsB,WAOvC,CACU,EAAA,CAAA;EACf,oBAAC,eAAD,EAAA,UACI,oBAAC,UAAD;GAAU,UAAU;aAChB,oBAAC,wBAAD,EAAwB,GAAK,YAAwC,CAAA;EAC/D,CAAA,EACC,CAAA;EACd,WAAW,eAAe,SACvB,oBAAC,eAAD,EAAA,UACI,oBAAC,UAAD;GAAU,UAAU;aAChB,oBAAC,wBAAD,EAAwB,GAAI,mBAAoB,CAAA;EAC1C,CAAA,EACC,CAAA;EAElB,uBACG,oBAAC,eAAD,EAAA,UACI,oBAAC,wBAAD,EAAwB,GAAI,mBAAoB,CAAA,EACrC,CAAA;CAErB,EAAA,CAAA;CAGN,MAAM,CAAC,cAAc,mBAAmB,MAAM,SAAS,KAAK;CAE5D,OACI,qBAAC,OAAD;EAAK,WAAU;YAAf;GACK,CAAC,UACE,mBAEA,oBAAC,SAAD;IACI,MAAM;IACN,cAAc;IACd,SACI,oBAAC,YAAD;KAAY,cAAY,EAAE,cAAc;KAAG,MAAK;eAC5C,oBAAC,kBAAD,EAAkB,MAAM,SAAS,SAAU,CAAA;IACnC,CAAA;cAEhB,oBAAC,OAAD;KAAK,WAAU;eACV;IACA,CAAA;GACA,CAAA;GAEZ;GACA;GACA;EACA;;AAEb"}
|
|
1
|
+
{"version":3,"file":"CollectionViewActions.js","names":[],"sources":["../../../src/components/CollectionViewBinding/CollectionViewActions.tsx"],"sourcesContent":["\n\nimport React, { Suspense } from \"react\";\n\nimport { useTranslation, useSlot } from \"@rebasepro/app\";\nimport { CollectionActionsProps, EntityTableController, EntitySelectionController, AdminCollection } from \"@rebasepro/cms-types\";\nimport { Button, IconButton, Tooltip, Popover, iconSize, lazyChunk } from \"@rebasepro/ui\";\nimport { ErrorBoundary, Link2Icon, MoreVerticalIcon, Trash2Icon, Unlink2Icon } from \"@rebasepro/ui\";\nimport { usePermissions } from \"@rebasepro/app\";\nimport { toArray } from \"@rebasepro/utils\";\n// Lazy-load import/export — pulls in exceljs only on demand\nconst ImportCollectionAction = lazyChunk(() => import(\"../../data_import/import\").then(m => ({ default: m.ImportCollectionAction })));\nconst ExportCollectionAction = lazyChunk(() => import(\"../../data_export/export\").then(m => ({ default: m.ExportCollectionAction })));\nimport { useAdminContext } from \"../../hooks/useAdminContext\";\nimport { useToolbarLabels } from \"../CollectionTableBinding/internal/CollectionTableToolbar\";\nimport { CollectionAddButton } from \"./CollectionAddButton\";\nimport { selectionControllerOf, tableControllerOf } from \"@rebasepro/app\";\n\nexport type CollectionViewActionsProps<M extends Record<string, unknown>> = {\n collection: AdminCollection<M>;\n path: string;\n relativePath: string;\n parentCollectionSlugs: string[], parentEntityIds: string[];\n selectionEnabled: boolean;\n onNewClick: () => void;\n /**\n * Attach a row that already exists to this parent. Only supplied for a\n * junction-backed tab, where the parent owns the link rather than the row.\n */\n onAddExistingClick?: () => void;\n onMultipleDeleteClick: () => void;\n /**\n * The rows are shared with other records through a junction, so removing\n * them unlinks them from this record and deletes nothing. The bin says so.\n */\n removeUnlinks?: boolean;\n selectionController: EntitySelectionController<M>;\n tableController: EntityTableController<M>;\n collectionEntitiesCount?: number;\n compact?: boolean;\n children?: React.ReactNode;\n openNewDocument: (defaultValues?: Record<string, unknown>) => void;\n}\n\nexport function CollectionViewActions<M extends Record<string, unknown>>({\n collection,\n relativePath,\n parentCollectionSlugs, parentEntityIds,\n onNewClick,\n onAddExistingClick,\n onMultipleDeleteClick,\n removeUnlinks,\n selectionEnabled,\n path,\n selectionController,\n tableController,\n collectionEntitiesCount,\n compact,\n children,\n openNewDocument\n}: CollectionViewActionsProps<M>) {\n const context = useAdminContext();\n\n const { canDelete } = usePermissions();\n\n const toolbarLabels = useToolbarLabels();\n // Labelled controls where the toolbar has room for them — a wide view\n // and labels that fit; their icon-only forms otherwise.\n const labelled = !compact && toolbarLabels;\n const { t } = useTranslation();\n\n const { selectedCount, hasSelection } = selectionController;\n\n const addButton = onNewClick &&\n <CollectionAddButton collection={collection} path={path} onClick={onNewClick} compact={Boolean(compact)}/>;\n\n // On a junction-backed tab, creating a row is only half of what \"add\" means:\n // the far more common act is attaching one that already exists. There was no\n // way to do that at all — the junction row was only ever written alongside an\n // insert — so a shared vocabulary could only ever grow.\n const linkButton = onAddExistingClick && (labelled\n ? <Button\n id={`link_entity_${path}`}\n onClick={onAddExistingClick}\n startIcon={<Link2Icon size={iconSize.small}/>}\n size=\"small\"\n variant=\"outlined\"\n color=\"neutral\">\n {t(\"add_existing\")}\n </Button>\n : <Tooltip title={t(\"add_existing\")}>\n <Button\n id={`link_entity_${path}`}\n onClick={onAddExistingClick}\n variant=\"outlined\"\n color=\"neutral\"\n size=\"small\">\n <Link2Icon size={iconSize.small}/>\n </Button>\n </Tooltip>);\n\n const multipleDeleteEnabled = canDelete(collection, path, null);\n\n // Only once something is selected. A permanently-disabled bin sat in every\n // collection toolbar — and in the split view, where the toolbar is a narrow\n // strip above the list, it was a third of the visible controls doing\n // nothing. It appears the moment you tick a row, which is when you want it.\n\n // `undefined` is \"every matching row, and nobody knows how many\" — a full\n // selection against an accessor with no `count`. Rendering it as 0 would\n // say the opposite of what is true.\n const countLabel = selectedCount === undefined ? \"…\" : selectedCount.toLocaleString();\n\n let multipleDeleteButton: React.ReactNode | undefined;\n if (hasSelection) {\n const RemoveIcon = removeUnlinks ? Unlink2Icon : Trash2Icon;\n // What the button does, in both forms. The labelled one's only text is\n // the count, so without it a screen reader announced \"(1)\".\n const actionLabel = removeUnlinks ? t(\"remove_from_record\") : t(\"delete_selected\");\n const button = labelled\n // `min-w`, not `w`. A fixed 80px was enough for the one- and\n // two-digit counts you could reach by ticking rows; \"select all\n // matching\" put six digits in here, and a flex child over its width\n // compresses — so the bin itself was what gave way, shrinking to a\n // sliver beside the number. The width is a floor now, so the\n // control still holds its place in the toolbar when the count is\n // short, and `shrink-0` means the icon can never be the thing that\n // gives.\n ? <Button\n variant={\"text\"}\n aria-label={`${actionLabel} (${countLabel})`}\n disabled={!multipleDeleteEnabled}\n startIcon={<RemoveIcon size={iconSize.small} className={\"shrink-0\"}/>}\n onClick={onMultipleDeleteClick}\n color={\"neutral\"}\n className=\"@5xl/collection:min-w-20\"\n >\n ({countLabel})\n </Button>\n : <IconButton aria-label={actionLabel}\n size={\"small\"}\n disabled={!multipleDeleteEnabled}\n onClick={onMultipleDeleteClick}>\n <RemoveIcon size={iconSize.small}/>\n </IconButton>;\n multipleDeleteButton =\n <Tooltip\n title={multipleDeleteEnabled\n ? (removeUnlinks ? t(\"remove_from_record\") : t(\"delete\"))\n : t(\"delete_not_allowed\")}>\n {button}\n </Tooltip>\n }\n\n // The admin's own actions read the records; an app's are handed rows.\n const builtInActionProps = {\n path,\n relativePath,\n parentCollectionSlugs,\n parentEntityIds,\n collection,\n selectionController,\n context,\n tableController,\n collectionEntitiesCount,\n openNewDocument\n };\n const actionProps: CollectionActionsProps<M> = {\n ...builtInActionProps,\n selectionController: selectionControllerOf(selectionController, collection, path),\n tableController: tableControllerOf(tableController, collection)\n };\n\n const actions = toArray(collection.Actions)\n .map((Action, i) => {\n return (\n <ErrorBoundary key={`actions_${i}`}>\n <Suspense fallback={null}>\n <Action {...actionProps}/>\n </Suspense>\n </ErrorBoundary>\n );\n });\n\n const pluginActions = useSlot(\"collection.actions\", actionProps as CollectionActionsProps);\n\n const secondaryActions = (\n <>\n {children}\n <ErrorBoundary>\n {actions}\n {pluginActions}\n </ErrorBoundary>\n <ErrorBoundary>\n <Suspense fallback={null}>\n <ImportCollectionAction {...(actionProps as CollectionActionsProps)}/>\n </Suspense>\n </ErrorBoundary>\n {collection.exportable !== false && (\n <ErrorBoundary>\n <Suspense fallback={null}>\n <ExportCollectionAction {...builtInActionProps}/>\n </Suspense>\n </ErrorBoundary>\n )}\n {/* No collection editor here: a collection view is CMS, and the\n editor is a Studio view (`/schema`). Its gear sat in this\n toolbar for everyone who edits content. */}\n </>\n );\n\n const [overflowOpen, setOverflowOpen] = React.useState(false);\n\n return (\n <div className=\"flex items-center gap-1\">\n {!compact ? (\n secondaryActions\n ) : (\n <Popover\n open={overflowOpen}\n onOpenChange={setOverflowOpen}\n trigger={\n <IconButton aria-label={t(\"more_actions\")} size=\"small\">\n <MoreVerticalIcon size={iconSize.smallest}/>\n </IconButton>\n }>\n <div className=\"flex flex-row items-center gap-1 p-2\">\n {secondaryActions}\n </div>\n </Popover>\n )}\n {multipleDeleteButton}\n {linkButton}\n {addButton}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAWA,IAAM,yBAAyB,gBAAgB,OAAO,oCAA2B,CAAC,MAAK,OAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;AACpI,IAAM,yBAAyB,gBAAgB,OAAO,oCAA2B,CAAC,MAAK,OAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;AAgCpI,SAAgB,sBAAyD,EACrE,YACA,cACA,uBAAuB,iBACvB,YACA,oBACA,uBACA,eACA,kBACA,MACA,qBACA,iBACA,yBACA,SACA,UACA,mBAC8B;CAC9B,MAAM,UAAU,gBAAgB;CAEhC,MAAM,EAAE,cAAc,eAAe;CAErC,MAAM,gBAAgB,iBAAiB;CAGvC,MAAM,WAAW,CAAC,WAAW;CAC7B,MAAM,EAAE,MAAM,eAAe;CAE7B,MAAM,EAAE,eAAe,iBAAiB;CAExC,MAAM,YAAY,cACd,oBAAC,qBAAD;EAAiC;EAAkB;EAAM,SAAS;EAAY,SAAS,QAAQ,OAAO;CAAG,CAAA;CAM7G,MAAM,aAAa,uBAAuB,WACpC,oBAAC,QA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AkB,iBAAiB,UAAU;CAClE;CAeA,MAAM,mBACF,qBAAA,UAAA,EAAA,UAAA;EACK;EACD,qBAAC,eAAD,EAAA,UAAA,CAhBQ,QAAQ,WAAW,OAAO,CAAC,CACtC,KAAK,QAAQ,MAAM;GAChB,OACI,oBAAC,eAAD,EAAA,UACI,oBAAC,UAAD;IAAU,UAAU;cAChB,oBAAC,QAAD,EAAQ,GAAI,YAAa,CAAA;GACnB,CAAA,EACC,GAJK,WAAW,GAIhB;EAEvB,CAQS,GANS,QAAQ,sBAAsB,WAOvC,CACU,EAAA,CAAA;EACf,oBAAC,eAAD,EAAA,UACI,oBAAC,UAAD;GAAU,UAAU;aAChB,oBAAC,wBAAD,EAAwB,GAAK,YAAwC,CAAA;EAC/D,CAAA,EACC,CAAA;EACd,WAAW,eAAe,SACvB,oBAAC,eAAD,EAAA,UACI,oBAAC,UAAD;GAAU,UAAU;aAChB,oBAAC,wBAAD,EAAwB,GAAI,mBAAoB,CAAA;EAC1C,CAAA,EACC,CAAA;CAKrB,EAAA,CAAA;CAGN,MAAM,CAAC,cAAc,mBAAmB,MAAM,SAAS,KAAK;CAE5D,OACI,qBAAC,OAAD;EAAK,WAAU;YAAf;GACK,CAAC,UACE,mBAEA,oBAAC,SAAD;IACI,MAAM;IACN,cAAc;IACd,SACI,oBAAC,YAAD;KAAY,cAAY,EAAE,cAAc;KAAG,MAAK;eAC5C,oBAAC,kBAAD,EAAkB,MAAM,SAAS,SAAU,CAAA;IACnC,CAAA;cAEhB,oBAAC,OAAD;KAAK,WAAU;eACV;IACA,CAAA;GACA,CAAA;GAEZ;GACA;GACA;EACA;;AAEb"}
|
|
@@ -7,17 +7,17 @@ import { callerHoldsScope, reportsScopes } from "../util/caller_scopes.js";
|
|
|
7
7
|
import { useBuildNavigationStateController } from "../hooks/navigation/useBuildNavigationStateController.js";
|
|
8
8
|
import { useBuildUrlController } from "../hooks/navigation/useBuildUrlController.js";
|
|
9
9
|
import { withUserLayer } from "../hooks/navigation/ui_preferences.js";
|
|
10
|
-
import { ConfigControllerProvider } from "../collection_editor/ConfigControllerProvider.js";
|
|
11
10
|
import { SidePanelProvider } from "./SidePanelProvider.js";
|
|
12
11
|
import { composeCollectionsInput } from "../hooks/navigation/compose_collections_input.js";
|
|
13
12
|
import { usePanelTables } from "../hooks/navigation/usePanelTables.js";
|
|
14
13
|
import { CollectionsScopeContext } from "./CollectionsScopeContext.js";
|
|
15
14
|
import { useLocalCollectionsConfigController } from "../collection_editor/useLocalCollectionsConfigController.js";
|
|
15
|
+
import { ConfigControllerProvider } from "../collection_editor/ConfigControllerProvider.js";
|
|
16
16
|
import { useCollectionsConfigController } from "../collection_editor/useCollectionsConfigController.js";
|
|
17
17
|
import { Suspense, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
18
18
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
19
|
import { CircularProgressCenter, lazyChunk } from "@rebasepro/ui";
|
|
20
|
-
import { buildRoutedRebaseData } from "@rebasepro/cms-types";
|
|
20
|
+
import { buildRoutedRebaseData, studioSchemaToolEnabled } from "@rebasepro/cms-types";
|
|
21
21
|
import { CollectionResolverRegistrationContext, CustomizationControllerContext, RebaseDataContext, StudioBridgeRegistryProvider, UserConfigurationPersistenceContext, useAdminModeController, useAuthController, useBridgeRegistration, useCustomizationController, useData, useDataSources, useRebaseClient, useRebaseContext, useRebaseEmbedHost, useRebaseRegistry, useTranslation, useUiPreferences, useUserConfigurationPersistence } from "@rebasepro/app";
|
|
22
22
|
import { RebaseApiError } from "@rebasepro/types";
|
|
23
23
|
import { resolveDataSource } from "@rebasepro/common";
|
|
@@ -146,19 +146,13 @@ function RebaseNavigation({ children }) {
|
|
|
146
146
|
tables: servedTables,
|
|
147
147
|
presentation: { save: uiPreferences.controller.saveWorkspace }
|
|
148
148
|
} : { readOnly: true });
|
|
149
|
+
const { t } = useTranslation();
|
|
149
150
|
const schemaView = useMemo(() => {
|
|
150
|
-
if (!
|
|
151
|
-
const studioTools = registry.studioConfig?.tools ?? [
|
|
152
|
-
"sql",
|
|
153
|
-
"js",
|
|
154
|
-
"rls",
|
|
155
|
-
"schema",
|
|
156
|
-
"storage"
|
|
157
|
-
];
|
|
158
|
-
if (!registry.studioConfig || !studioTools.includes("schema")) return void 0;
|
|
151
|
+
if (!studioSchemaToolEnabled(registry)) return void 0;
|
|
159
152
|
return {
|
|
160
153
|
slug: "schema",
|
|
161
|
-
name: "
|
|
154
|
+
name: t("studio_tool_schema"),
|
|
155
|
+
description: t("studio_tool_schema_description"),
|
|
162
156
|
group: "Database",
|
|
163
157
|
icon: "LayoutList",
|
|
164
158
|
nestedRoutes: true,
|
|
@@ -167,7 +161,7 @@ function RebaseNavigation({ children }) {
|
|
|
167
161
|
children: /* @__PURE__ */ jsx(CollectionsStudioViewFromContext, {})
|
|
168
162
|
})
|
|
169
163
|
};
|
|
170
|
-
}, [
|
|
164
|
+
}, [registry, t]);
|
|
171
165
|
const devViews = useMemo(() => {
|
|
172
166
|
const base = registry.studioConfig?.devViews ?? [];
|
|
173
167
|
if (schemaView) return [...base, schemaView];
|
|
@@ -195,7 +189,6 @@ function RebaseNavigation({ children }) {
|
|
|
195
189
|
urlController,
|
|
196
190
|
adminMode: adminModeController?.mode
|
|
197
191
|
});
|
|
198
|
-
const { t } = useTranslation();
|
|
199
192
|
const tablesError = descriptors.status === "error" ? descriptors.error : void 0;
|
|
200
193
|
const reloadTables = descriptors.reload;
|
|
201
194
|
const tablesInUse = registry.cmsConfig !== null && !descriptors.unavailable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RebaseNavigation.js","names":[],"sources":["../../src/components/RebaseNavigation.tsx"],"sourcesContent":["import React, { useMemo, useRef, useEffect, useCallback, useContext, useState, Suspense } from \"react\";\nimport {\n useRebaseRegistry,\n useRebaseContext,\n useAuthController,\n useCustomizationController,\n useAdminModeController,\n useUserConfigurationPersistence,\n useRebaseClient,\n useData,\n useDataSources,\n CollectionResolverRegistrationContext,\n StudioBridgeRegistryProvider,\n useBridgeRegistration,\n CustomizationControllerContext,\n RebaseDataContext,\n UserConfigurationPersistenceContext,\n useRebaseEmbedHost,\n useTranslation,\n useUiPreferences\n} from \"@rebasepro/app\";\nimport { resolveDataSource } from \"@rebasepro/common\";\nimport { buildRoutedRebaseData } from \"@rebasepro/cms-types\";\nimport { CircularProgressCenter, lazyChunk } from \"@rebasepro/ui\";\n\nimport type { AppView, CollectionCustomView, CollectionEditorOptions, EntityCustomView, EntityAction, RebasePlugin, AdminCollection, TableCustomization } from \"@rebasepro/cms-types\";\nimport { RebaseApiError } from \"@rebasepro/types\";\nimport type { UrlController, NavigationStateController, CollectionRegistryController } from \"@rebasepro/cms-types\";\n\nconst EMPTY_PLUGINS: RebasePlugin[] = [];\nconst NO_COLLECTIONS: AdminCollection[] = [];\nconst NO_CUSTOMIZATIONS: readonly TableCustomization[] = [];\nconst NO_EXTERNAL_COLLECTIONS: readonly AdminCollection[] = [];\n\nimport { useBuildNavigationStateController } from \"../hooks/navigation/useBuildNavigationStateController\";\nimport { useBuildUrlController } from \"../hooks/navigation/useBuildUrlController\";\nimport { useBuildCollectionRegistryController } from \"../hooks/navigation/useBuildCollectionRegistryController\";\nimport { composeCollectionsInput } from \"../hooks/navigation/compose_collections_input\";\nimport { withUserLayer } from \"../hooks/navigation/ui_preferences\";\nimport { usePanelTables } from \"../hooks/navigation/usePanelTables\";\n\nimport { CollectionRegistryContext } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { UrlContext } from \"../hooks/navigation/contexts/UrlContext\";\nimport { NavigationStateContext } from \"../hooks/navigation/contexts/NavigationStateContext\";\n\nimport { SidePanelProvider } from \"./SidePanelProvider\";\nimport { CollectionsScopeContext } from \"./CollectionsScopeContext\";\nimport { prefetchRecordViews } from \"./lazy_record_views\";\n\n// Collection editor internals — used when collectionEditor is enabled\nimport { useLocalCollectionsConfigController } from \"../collection_editor/useLocalCollectionsConfigController\";\nimport { ConfigControllerProvider } from \"../collection_editor/ConfigControllerProvider\";\nimport { useCollectionsConfigController } from \"../collection_editor/useCollectionsConfigController\";\nimport { callerHoldsScope, reportsScopes } from \"../util/caller_scopes\";\n\n// Lazy-load the schema view — only fetched when studio schema tool is active\nconst CollectionsStudioView = lazyChunk(() =>\n import(\"../collection_editor/ui/collection_editor/RouterCollectionsStudioView\")\n .then(m => ({ default: m.RouterCollectionsStudioView }))\n);\n\nexport interface RebaseNavigationProps {\n children: React.ReactNode;\n}\n\n/**\n * Navigation layer — builds and provides all admin navigation controllers:\n * collection registry, URL controller, navigation state, side entity,\n * and the self-assembling Studio bridge.\n *\n * Also handles the collection editor config controller when enabled.\n *\n * **Independently usable**: Use this when you need admin navigation\n * (entity tables, side panels) in a custom layout.\n *\n * @example\n * ```tsx\n * <RebaseNavigation>\n * <MyCustomLayout>\n * <CollectionViewBinding ... />\n * </MyCustomLayout>\n * </RebaseNavigation>\n * ```\n */\nexport function RebaseNavigation({ children }: RebaseNavigationProps) {\n const registry = useRebaseRegistry();\n // Mounted behind the auth gate: someone is signed in, so the collection\n // table and record views are about to be wanted. Fetch them while idle.\n useEffect(() => prefetchRecordViews(), []);\n const context = useRebaseContext();\n const adminModeController = useAdminModeController();\n // The store the rest of the panel reads. Built one level up, by\n // `<Rebase>`, so the registry here and the collection views below merge\n // from the same cache — a second instance built here would keep its own.\n const browserUserConfigPersistence = useUserConfigurationPersistence();\n\n // ── Collection Editor resolution ──────────────────────────────────\n // The collection editor is ALWAYS enabled when Studio is registered.\n // The `collectionEditor` admin config is for fine-tuning (readOnly, auth, etc.),\n // not for opting-in. When omitted, the editor defaults to enabled\n // (read-only in production).\n const collectionEditorConfig = registry.cmsConfig?.collectionEditor;\n const collectionEditorEnabled = Boolean(collectionEditorConfig) || Boolean(registry.studioConfig);\n const collectionEditorOptions: CollectionEditorOptions | undefined = useMemo(() => {\n if (collectionEditorConfig === true || !collectionEditorConfig) return {};\n return collectionEditorConfig;\n }, [collectionEditorConfig]);\n\n // ── The collections: served tables and external ones ──────────────\n // Every table the server serves the signed-in user (or the ones handed\n // to <RebaseCMS tables>), projected and customized, beside the\n // collections whose rows live elsewhere (Firestore). Only with a\n // <RebaseCMS> registered: a Studio alone shows no collections.\n const tableCustomizations = registry.cmsConfig?.tableCustomizations ?? NO_CUSTOMIZATIONS;\n const externalCollections = registry.cmsConfig?.externalCollections ?? NO_EXTERNAL_COLLECTIONS;\n const descriptors = usePanelTables(registry.cmsConfig?.tables, registry.cmsConfig !== null);\n const servedTables = descriptors.tables;\n // In an embedding (an MCP App view) the panel asks the server for no\n // preferences: the embedding received them with the screen, and they are\n // folded here exactly as the panel's own — the server's `ui-config.json`\n // where the app passes no `uiConfig` of its own.\n const embeddedPreferences = useRebaseEmbedHost()?.uiPreferences;\n const uiConfig = registry.cmsConfig?.uiConfig ?? embeddedPreferences?.file;\n\n // ── UI preferences: the workspace's, and the signed-in user's own ──\n // How each table is presented, as the collection editor saved it for\n // everybody and as the views remember it for this user. The user's live\n // on the server when it keeps them, in the browser otherwise; everything\n // below reads them through the persistence provided here.\n const preferencesClient = useRebaseClient();\n const preferencesAuth = useAuthController();\n const inEmbedding = useRebaseEmbedHost() !== undefined;\n const uiPreferences = useUiPreferences({\n transport: preferencesClient,\n getAuthToken: preferencesAuth?.getAuthToken,\n authKey: preferencesAuth?.user?.uid ?? null,\n enabled: registry.cmsConfig !== null && Boolean(preferencesAuth?.user) && !inEmbedding,\n local: browserUserConfigPersistence\n });\n const embeddedUser = embeddedPreferences?.user;\n const userConfigPersistence = useMemo(\n () => embeddedUser && uiPreferences.userPersistence\n ? withUserLayer(uiPreferences.userPersistence, embeddedUser)\n : uiPreferences.userPersistence,\n [embeddedUser, uiPreferences.userPersistence]);\n const workspacePreferences = embeddedPreferences?.workspace ?? uiPreferences.controller.workspace;\n\n // What the composition last produced, for the collection editor, which\n // lists and edits the collections the panel shows.\n const [composedCollections, setComposedCollections] = useState<AdminCollection[]>(NO_COLLECTIONS);\n\n // In an embedding (an MCP App view, `embed_host.ts`), the collections are\n // the app's own — custom fields, previews, views and actions included —\n // narrowed to what the person may see and do there.\n const narrow = useRebaseEmbedHost()?.narrowCollections;\n\n // ── Build the navigation controllers ──────────────────────────────\n const collectionsBuilder = useMemo(() => {\n const composed = composeCollectionsInput({\n tables: servedTables,\n tableCustomizations,\n externalCollections,\n uiConfig,\n workspacePreferences\n });\n return async (params: Parameters<typeof composed>[0]) => {\n const collections = await composed(params);\n setComposedCollections(collections);\n return narrow ? narrow(collections) : collections;\n };\n }, [servedTables, tableCustomizations, externalCollections, uiConfig, workspacePreferences, narrow]);\n\n const dataSources = useDataSources();\n const collectionRegistryController = useBuildCollectionRegistryController({ userConfigPersistence, dataSources: dataSources.registry });\n\n // ── Multi-data-source routing ─────────────────────────────────────\n // Combine the default data source (server transport) with the registered\n // direct/custom sources from <Rebase> and route each collection by its\n // resolved data-source key, looked up by path against the collection\n // registry. A stable resolver ref keeps the routed data instance\n // referentially stable across registry rebuilds, so data-effect\n // dependencies don't thrash.\n const defaultData = useData();\n const getCollectionRef = useRef(collectionRegistryController.getCollection);\n getCollectionRef.current = collectionRegistryController.getCollection;\n\n // Hand the data layer a way to read this registry. It was built by <Rebase>,\n // above us, and needs a collection's primary keys to give its rows an\n // address — rows themselves carry only columns.\n //\n // Registered during render, not in an effect: the views that fetch rows are\n // below us, and their effects run before ours, so an effect here would bind\n // after the first page had already been converted. The call only assigns a\n // ref, so repeating it per render is free.\n //\n // With it goes where each collection is stored: a direct driver has to be\n // handed the `path` a Firestore collection declares, not its slug.\n const registerCollectionResolver = useContext(CollectionResolverRegistrationContext);\n const resolveCollection = useCallback(\n (slug: string) => getCollectionRef.current(slug),\n []);\n registerCollectionResolver(resolveCollection, collectionRegistryController.resolveDataPath);\n const routedData = useMemo(() => buildRoutedRebaseData({\n defaultData,\n sources: dataSources.sources,\n resolveKey: (slugOrPath) => resolveDataSource(getCollectionRef.current(slugOrPath), dataSources.registry).key\n }), [defaultData, dataSources]);\n\n // Normalize the configured mount prefix to a leading-slash, no-trailing-slash\n // form (e.g. \"admin\" or \"/admin/\" -> \"/admin\"); empty/\"/\" stays \"/\".\n const basePath = useMemo(() => {\n const raw = registry.cmsConfig?.basePath;\n if (!raw || raw === \"/\") return \"/\";\n const trimmed = raw.replace(/^\\/+/, \"\").replace(/\\/+$/, \"\");\n return trimmed ? `/${trimmed}` : \"/\";\n }, [registry.cmsConfig?.basePath]);\n\n const builtUrlController = useBuildUrlController({\n basePath,\n baseCollectionPath: \"/c\",\n collectionRegistryController\n });\n // In an embedding (an MCP App view) no route draws a record's page: a\n // record opens over the screen, as it does under a CollectionsProvider.\n const embedded = useRebaseEmbedHost() !== undefined;\n const urlController = useMemo<UrlController>(() => embedded ? {\n ...builtUrlController,\n isUrlCollectionPath: () => false,\n routesMounted: false\n } : builtUrlController, [builtUrlController, embedded]);\n\n // ── Build config controller internally when collection editor is enabled ──\n const rebaseClient = useRebaseClient();\n const authController = useAuthController();\n\n // ── Dev-only data-source sanity check ─────────────────────────────\n // Warn about data sources declared with a direct/custom transport that\n // have no client-side driver — these silently fall back to the default\n // (server) source, a common source of misrouting. Unambiguous: it never\n // false-positives on server-mediated sources (which intentionally have\n // no client driver).\n useEffect(() => {\n if (process.env.NODE_ENV === \"production\") return;\n const { registry, sources } = dataSources;\n const missing = Object.values(registry)\n .filter((d) => (d.transport === \"direct\" || d.transport === \"custom\") && !sources[d.key])\n .map((d) => d.key);\n if (missing.length > 0) {\n console.warn(\n `[Rebase] These data source(s) declare a direct/custom transport but have no client-side driver and will fall back to the default data source: ${missing.map(k => `\"${k}\"`).join(\", \")}. ` +\n `Provide a \\`driver\\` for them in \\`dataSources\\` on <Rebase>.`\n );\n }\n }, [dataSources]);\n\n // `readOnly` is left undefined unless the developer set it: the controller\n // asks the backend whether its schema editor will accept a write, which is\n // the only process that knows. Deciding it here from `process.env.NODE_ENV`\n // — the *frontend bundle's* build mode — is what made the editor offer\n // itself against production backends, `baas` projects and servers without\n // `ts-morph`, and turned every save into a bare 404.\n //\n // Both of its status routes require `schema:read`. Asked by someone\n // without it, each answers 403 on every page load. So when the controller\n // reports scopes, it is not asked until they include that one. A\n // controller that does not report them leaves the backend to answer.\n const internalConfigController = useLocalCollectionsConfigController(\n rebaseClient,\n composedCollections,\n collectionEditorEnabled ? {\n readOnly: collectionEditorOptions?.readOnly,\n getAuthToken: collectionEditorOptions?.getAuthToken ?? authController?.getAuthToken,\n authKey: authController?.user?.uid ?? null,\n mayReadSchema: reportsScopes(authController)\n ? callerHoldsScope(authController, \"schema:read\")\n : undefined,\n tables: servedTables,\n presentation: { save: uiPreferences.controller.saveWorkspace }\n } : { readOnly: true }\n );\n\n // ── Auto-inject schema view into Studio devViews ──────────────────\n const schemaView: AppView | undefined = useMemo(() => {\n if (!collectionEditorEnabled) return undefined;\n // Only inject when Studio is registered and includes \"schema\" tool (or all tools)\n const studioTools = registry.studioConfig?.tools ?? [\"sql\", \"js\", \"rls\", \"schema\", \"storage\"];\n if (!registry.studioConfig || !studioTools.includes(\"schema\")) return undefined;\n return {\n slug: \"schema\",\n name: \"Edit collections\",\n group: \"Database\",\n icon: \"LayoutList\",\n nestedRoutes: true,\n // Reads the controller from context at render time rather than\n // capturing it here. A view is a React *element*, and the\n // navigation state controller resolves the view list once and holds\n // on to the elements it resolved — so a controller passed as a prop\n // is frozen at whatever it was on the first render, forever. That\n // hid every later change: the editor stayed writable after the\n // backend said it was read-only, and the collection list never\n // refreshed. Everything else in the editor already reads this from\n // `ConfigControllerProvider`, which wraps this subtree.\n view: (\n <Suspense fallback={<CircularProgressCenter/>}>\n <CollectionsStudioViewFromContext/>\n </Suspense>\n )\n };\n }, [collectionEditorEnabled, registry.studioConfig]);\n\n const devViews = useMemo(() => {\n const base = registry.studioConfig?.devViews ?? [];\n if (schemaView) return [...base, schemaView];\n return base;\n }, [registry.studioConfig?.devViews, schemaView]);\n\n // Merge admin-registered views with Studio dev views.\n // Order: admin views (developer's primary content) → Studio dev views (tooling).\n // Plugin views are merged later inside resolveAppViews.\n const cmsViews = registry.cmsConfig?.views;\n const mergedViews = useMemo(() => {\n if (!cmsViews) return devViews;\n if (Array.isArray(cmsViews) && cmsViews.length === 0) return devViews;\n // When cmsViews is a builder function, wrap it to append devViews after resolution\n if (typeof cmsViews === \"function\") {\n return async (params: Parameters<typeof cmsViews>[0]) => {\n const resolved = await cmsViews(params) ?? [];\n return [...resolved, ...devViews];\n };\n }\n return [...cmsViews, ...devViews];\n }, [cmsViews, devViews]);\n\n const parentCustomizationController = useCustomizationController();\n\n const builtNavigationStateController = useBuildNavigationStateController({\n plugins: parentCustomizationController.plugins ?? EMPTY_PLUGINS,\n collections: collectionsBuilder,\n // Until the tables arrive, no route that needs a collection renders:\n // they show the loading state, not \"collection not found\", and a deep\n // link resolves once the collections built from them are registered.\n collectionsPending: descriptors.status === \"loading\",\n views: mergedViews,\n navigationGroupMappings: registry.cmsConfig?.navigationGroupMappings,\n authController: context.authController!,\n // The collection and view builders get the rows the server sends.\n data: context.data,\n collectionRegistryController,\n urlController,\n adminMode: adminModeController?.mode\n });\n\n // A failure to load the tables is the navigation's loading error: the home\n // page and a route to a collection that could not be built say what failed\n // and offer to retry. A session the server no longer accepts is the\n // client's to renew, and it signs out when it cannot — so the error says to\n // sign in again.\n //\n // Refreshing the navigation asks for the tables again too: it is what the\n // collection editor calls after it changed the schema, and with an `ETag`\n // an unchanged schema costs a 304.\n const { t } = useTranslation();\n const tablesError = descriptors.status === \"error\" ? descriptors.error : undefined;\n const reloadTables = descriptors.reload;\n const tablesInUse = registry.cmsConfig !== null && !descriptors.unavailable;\n const navigationStateController = useMemo<NavigationStateController>(() => {\n if (!tablesInUse) return builtNavigationStateController;\n const signedOut = tablesError instanceof RebaseApiError && tablesError.status === 401;\n const error = tablesError\n ? new Error(signedOut\n ? t(\"tables_load_signed_out\")\n : t(\"tables_load_failed\", { message: tablesError.message }), { cause: tablesError })\n : undefined;\n return {\n ...builtNavigationStateController,\n navigationLoadingError: builtNavigationStateController.navigationLoadingError ?? error,\n refreshNavigation: () => {\n reloadTables();\n builtNavigationStateController.refreshNavigation();\n }\n };\n }, [builtNavigationStateController, tablesInUse, tablesError, reloadTables, t]);\n\n // ── Merge admin-registered entityViews/entityActions into the customization controller ──\n // The <Rebase> component builds the customizationController from its own props,\n // but entity views passed to <RebaseCMS> are stored in the registry and not\n // automatically merged. We re-provide an enriched controller here so that\n // downstream consumers (EditViewBinding, side panels, etc.) can resolve\n // string-keyed entity views like \"blog_preview\".\n const enrichedCustomizationController = useMemo(() => {\n const cmsEntityViews = (registry.cmsConfig?.entityViews ?? []) as EntityCustomView[];\n const cmsEntityActions = (registry.cmsConfig?.entityActions ?? []) as EntityAction[];\n // Collection view modes ride the same channel, for the same reason:\n // `admin.customViews: [\"map\"]` has to find the component somewhere.\n const cmsCollectionViews = (registry.cmsConfig?.collectionViews ?? []) as CollectionCustomView[];\n if (cmsEntityViews.length === 0 && cmsEntityActions.length === 0 && cmsCollectionViews.length === 0) {\n return parentCustomizationController;\n }\n return {\n ...parentCustomizationController,\n entityViews: [\n ...(parentCustomizationController.entityViews ?? []),\n ...cmsEntityViews.filter(v => !(parentCustomizationController.entityViews ?? []).some(ev => ev.key === v.key))\n ],\n entityActions: [\n ...(parentCustomizationController.entityActions ?? []),\n ...cmsEntityActions.filter(a => !(parentCustomizationController.entityActions ?? []).some(ea => ea.key === a.key))\n ],\n collectionViews: [\n ...(parentCustomizationController.collectionViews ?? []),\n ...cmsCollectionViews.filter(v => !(parentCustomizationController.collectionViews ?? []).some(cv => cv.key === v.key))\n ]\n };\n }, [parentCustomizationController, registry.cmsConfig?.entityViews, registry.cmsConfig?.entityActions, registry.cmsConfig?.collectionViews]);\n\n // ── Inner content with all context providers ──────────────────────\n // Re-provide RebaseDataContext with the routed data so that every admin\n // consumer (list/entity views, references, board, import/export, and\n // `context.data`) is routed to the correct driver by collection path.\n const navigationContent = (\n <UserConfigurationPersistenceContext.Provider value={userConfigPersistence}>\n <CollectionsScopeContext.Provider value={true}>\n <RebaseDataContext.Provider value={routedData}>\n <CustomizationControllerContext.Provider value={enrichedCustomizationController}>\n <StudioBridgeRegistryProvider>\n <CollectionRegistryContext.Provider value={collectionRegistryController}>\n <UrlContext.Provider value={urlController}>\n <NavigationStateContext.Provider value={navigationStateController}>\n <SidePanelProvider>\n <BridgeAutoRegistrar\n collectionRegistryController={collectionRegistryController}\n urlController={urlController}\n navigationStateController={navigationStateController}\n canWriteToCodebase={!internalConfigController.readOnly}\n />\n {children}\n </SidePanelProvider>\n </NavigationStateContext.Provider>\n </UrlContext.Provider>\n </CollectionRegistryContext.Provider>\n </StudioBridgeRegistryProvider>\n </CustomizationControllerContext.Provider>\n </RebaseDataContext.Provider>\n </CollectionsScopeContext.Provider>\n </UserConfigurationPersistenceContext.Provider>\n );\n\n // ── Wrap with ConfigControllerProvider when collection editor is enabled ──\n if (collectionEditorEnabled) {\n return (\n <ConfigControllerProvider\n collectionConfigController={internalConfigController}\n pathSuggestions={collectionEditorOptions?.pathSuggestions}\n >\n {navigationContent}\n </ConfigControllerProvider>\n );\n }\n\n return navigationContent;\n}\n\n/**\n * The injected \"Edit collections\" view, bound to the live config controller.\n *\n * Exists so the element stored in the navigation state does not close over a\n * controller instance — see the comment at its construction site.\n */\nfunction CollectionsStudioViewFromContext() {\n const configController = useCollectionsConfigController();\n return <CollectionsStudioView configController={configController}/>;\n}\n\n/**\n * Internal component that auto-registers admin controllers into the\n * self-assembling Studio bridge. Must be rendered inside both the\n * navigation contexts and the StudioBridgeRegistryProvider.\n */\nfunction BridgeAutoRegistrar({\n collectionRegistryController,\n urlController,\n navigationStateController,\n canWriteToCodebase\n}: {\n collectionRegistryController: CollectionRegistryController;\n urlController: UrlController;\n navigationStateController: NavigationStateController;\n canWriteToCodebase: boolean;\n}) {\n useBridgeRegistration(\"collectionRegistry\", collectionRegistryController);\n useBridgeRegistration(\"urlController\", urlController);\n useBridgeRegistration(\"navigationState\", navigationStateController);\n\n // Studio tools that would write into the project's collection source — the\n // RLS editor's policy save for a mapped table, its \"Import to codebase\" —\n // ask the bridge whether that write can land. The default is `true`, which\n // is what an admin panel sitting next to its own `collectionsDir` assumes;\n // it is wrong for exactly the same backends that make the collection editor\n // read-only, so the two now answer from one source.\n const capabilities = useMemo(() => ({ codebase: canWriteToCodebase }), [canWriteToCodebase]);\n useBridgeRegistration(\"capabilities\", capabilities);\n return null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6BA,IAAM,gBAAgC,CAAC;AACvC,IAAM,iBAAoC,CAAC;AAC3C,IAAM,oBAAmD,CAAC;AAC1D,IAAM,0BAAsD,CAAC;AAwB7D,IAAM,wBAAwB,gBAC1B,OAAO,2EAAwE,CAC1E,MAAK,OAAM,EAAE,SAAS,EAAE,4BAA4B,EAAE,CAC/D;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,iBAAiB,EAAE,YAAmC;CAClE,MAAM,WAAW,kBAAkB;CAGnC,gBAAgB,oBAAoB,GAAG,CAAC,CAAC;CACzC,MAAM,UAAU,iBAAiB;CACjC,MAAM,sBAAsB,uBAAuB;CAInD,MAAM,+BAA+B,gCAAgC;CAOrE,MAAM,yBAAyB,SAAS,WAAW;CACnD,MAAM,0BAA0B,QAAQ,sBAAsB,KAAK,QAAQ,SAAS,YAAY;CAChG,MAAM,0BAA+D,cAAc;EAC/E,IAAI,2BAA2B,QAAQ,CAAC,wBAAwB,OAAO,CAAC;EACxE,OAAO;CACX,GAAG,CAAC,sBAAsB,CAAC;CAO3B,MAAM,sBAAsB,SAAS,WAAW,uBAAuB;CACvE,MAAM,sBAAsB,SAAS,WAAW,uBAAuB;CACvE,MAAM,cAAc,eAAe,SAAS,WAAW,QAAQ,SAAS,cAAc,IAAI;CAC1F,MAAM,eAAe,YAAY;CAKjC,MAAM,sBAAsB,mBAAmB,CAAC,EAAE;CAClD,MAAM,WAAW,SAAS,WAAW,YAAY,qBAAqB;CAOtE,MAAM,oBAAoB,gBAAgB;CAC1C,MAAM,kBAAkB,kBAAkB;CAC1C,MAA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}
|
|
1
|
+
{"version":3,"file":"RebaseNavigation.js","names":[],"sources":["../../src/components/RebaseNavigation.tsx"],"sourcesContent":["import React, { useMemo, useRef, useEffect, useCallback, useContext, useState, Suspense } from \"react\";\nimport {\n useRebaseRegistry,\n useRebaseContext,\n useAuthController,\n useCustomizationController,\n useAdminModeController,\n useUserConfigurationPersistence,\n useRebaseClient,\n useData,\n useDataSources,\n CollectionResolverRegistrationContext,\n StudioBridgeRegistryProvider,\n useBridgeRegistration,\n CustomizationControllerContext,\n RebaseDataContext,\n UserConfigurationPersistenceContext,\n useRebaseEmbedHost,\n useTranslation,\n useUiPreferences\n} from \"@rebasepro/app\";\nimport { resolveDataSource } from \"@rebasepro/common\";\nimport { buildRoutedRebaseData, studioSchemaToolEnabled } from \"@rebasepro/cms-types\";\nimport { CircularProgressCenter, lazyChunk } from \"@rebasepro/ui\";\n\nimport type { AppView, CollectionCustomView, CollectionEditorOptions, EntityCustomView, EntityAction, RebasePlugin, AdminCollection, TableCustomization } from \"@rebasepro/cms-types\";\nimport { RebaseApiError } from \"@rebasepro/types\";\nimport type { UrlController, NavigationStateController, CollectionRegistryController } from \"@rebasepro/cms-types\";\n\nconst EMPTY_PLUGINS: RebasePlugin[] = [];\nconst NO_COLLECTIONS: AdminCollection[] = [];\nconst NO_CUSTOMIZATIONS: readonly TableCustomization[] = [];\nconst NO_EXTERNAL_COLLECTIONS: readonly AdminCollection[] = [];\n\nimport { useBuildNavigationStateController } from \"../hooks/navigation/useBuildNavigationStateController\";\nimport { useBuildUrlController } from \"../hooks/navigation/useBuildUrlController\";\nimport { useBuildCollectionRegistryController } from \"../hooks/navigation/useBuildCollectionRegistryController\";\nimport { composeCollectionsInput } from \"../hooks/navigation/compose_collections_input\";\nimport { withUserLayer } from \"../hooks/navigation/ui_preferences\";\nimport { usePanelTables } from \"../hooks/navigation/usePanelTables\";\n\nimport { CollectionRegistryContext } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { UrlContext } from \"../hooks/navigation/contexts/UrlContext\";\nimport { NavigationStateContext } from \"../hooks/navigation/contexts/NavigationStateContext\";\n\nimport { SidePanelProvider } from \"./SidePanelProvider\";\nimport { CollectionsScopeContext } from \"./CollectionsScopeContext\";\nimport { prefetchRecordViews } from \"./lazy_record_views\";\n\n// Collection editor internals — used when collectionEditor is enabled\nimport { useLocalCollectionsConfigController } from \"../collection_editor/useLocalCollectionsConfigController\";\nimport { ConfigControllerProvider } from \"../collection_editor/ConfigControllerProvider\";\nimport { useCollectionsConfigController } from \"../collection_editor/useCollectionsConfigController\";\nimport { callerHoldsScope, reportsScopes } from \"../util/caller_scopes\";\n\n// Lazy-load the schema view — only fetched when studio schema tool is active\nconst CollectionsStudioView = lazyChunk(() =>\n import(\"../collection_editor/ui/collection_editor/RouterCollectionsStudioView\")\n .then(m => ({ default: m.RouterCollectionsStudioView }))\n);\n\nexport interface RebaseNavigationProps {\n children: React.ReactNode;\n}\n\n/**\n * Navigation layer — builds and provides all admin navigation controllers:\n * collection registry, URL controller, navigation state, side entity,\n * and the self-assembling Studio bridge.\n *\n * Also handles the collection editor config controller when enabled.\n *\n * **Independently usable**: Use this when you need admin navigation\n * (entity tables, side panels) in a custom layout.\n *\n * @example\n * ```tsx\n * <RebaseNavigation>\n * <MyCustomLayout>\n * <CollectionViewBinding ... />\n * </MyCustomLayout>\n * </RebaseNavigation>\n * ```\n */\nexport function RebaseNavigation({ children }: RebaseNavigationProps) {\n const registry = useRebaseRegistry();\n // Mounted behind the auth gate: someone is signed in, so the collection\n // table and record views are about to be wanted. Fetch them while idle.\n useEffect(() => prefetchRecordViews(), []);\n const context = useRebaseContext();\n const adminModeController = useAdminModeController();\n // The store the rest of the panel reads. Built one level up, by\n // `<Rebase>`, so the registry here and the collection views below merge\n // from the same cache — a second instance built here would keep its own.\n const browserUserConfigPersistence = useUserConfigurationPersistence();\n\n // ── Collection Editor resolution ──────────────────────────────────\n // The collection editor is ALWAYS enabled when Studio is registered.\n // The `collectionEditor` admin config is for fine-tuning (readOnly, auth, etc.),\n // not for opting-in. When omitted, the editor defaults to enabled\n // (read-only in production).\n const collectionEditorConfig = registry.cmsConfig?.collectionEditor;\n const collectionEditorEnabled = Boolean(collectionEditorConfig) || Boolean(registry.studioConfig);\n const collectionEditorOptions: CollectionEditorOptions | undefined = useMemo(() => {\n if (collectionEditorConfig === true || !collectionEditorConfig) return {};\n return collectionEditorConfig;\n }, [collectionEditorConfig]);\n\n // ── The collections: served tables and external ones ──────────────\n // Every table the server serves the signed-in user (or the ones handed\n // to <RebaseCMS tables>), projected and customized, beside the\n // collections whose rows live elsewhere (Firestore). Only with a\n // <RebaseCMS> registered: a Studio alone shows no collections.\n const tableCustomizations = registry.cmsConfig?.tableCustomizations ?? NO_CUSTOMIZATIONS;\n const externalCollections = registry.cmsConfig?.externalCollections ?? NO_EXTERNAL_COLLECTIONS;\n const descriptors = usePanelTables(registry.cmsConfig?.tables, registry.cmsConfig !== null);\n const servedTables = descriptors.tables;\n // In an embedding (an MCP App view) the panel asks the server for no\n // preferences: the embedding received them with the screen, and they are\n // folded here exactly as the panel's own — the server's `ui-config.json`\n // where the app passes no `uiConfig` of its own.\n const embeddedPreferences = useRebaseEmbedHost()?.uiPreferences;\n const uiConfig = registry.cmsConfig?.uiConfig ?? embeddedPreferences?.file;\n\n // ── UI preferences: the workspace's, and the signed-in user's own ──\n // How each table is presented, as the collection editor saved it for\n // everybody and as the views remember it for this user. The user's live\n // on the server when it keeps them, in the browser otherwise; everything\n // below reads them through the persistence provided here.\n const preferencesClient = useRebaseClient();\n const preferencesAuth = useAuthController();\n const inEmbedding = useRebaseEmbedHost() !== undefined;\n const uiPreferences = useUiPreferences({\n transport: preferencesClient,\n getAuthToken: preferencesAuth?.getAuthToken,\n authKey: preferencesAuth?.user?.uid ?? null,\n enabled: registry.cmsConfig !== null && Boolean(preferencesAuth?.user) && !inEmbedding,\n local: browserUserConfigPersistence\n });\n const embeddedUser = embeddedPreferences?.user;\n const userConfigPersistence = useMemo(\n () => embeddedUser && uiPreferences.userPersistence\n ? withUserLayer(uiPreferences.userPersistence, embeddedUser)\n : uiPreferences.userPersistence,\n [embeddedUser, uiPreferences.userPersistence]);\n const workspacePreferences = embeddedPreferences?.workspace ?? uiPreferences.controller.workspace;\n\n // What the composition last produced, for the collection editor, which\n // lists and edits the collections the panel shows.\n const [composedCollections, setComposedCollections] = useState<AdminCollection[]>(NO_COLLECTIONS);\n\n // In an embedding (an MCP App view, `embed_host.ts`), the collections are\n // the app's own — custom fields, previews, views and actions included —\n // narrowed to what the person may see and do there.\n const narrow = useRebaseEmbedHost()?.narrowCollections;\n\n // ── Build the navigation controllers ──────────────────────────────\n const collectionsBuilder = useMemo(() => {\n const composed = composeCollectionsInput({\n tables: servedTables,\n tableCustomizations,\n externalCollections,\n uiConfig,\n workspacePreferences\n });\n return async (params: Parameters<typeof composed>[0]) => {\n const collections = await composed(params);\n setComposedCollections(collections);\n return narrow ? narrow(collections) : collections;\n };\n }, [servedTables, tableCustomizations, externalCollections, uiConfig, workspacePreferences, narrow]);\n\n const dataSources = useDataSources();\n const collectionRegistryController = useBuildCollectionRegistryController({ userConfigPersistence, dataSources: dataSources.registry });\n\n // ── Multi-data-source routing ─────────────────────────────────────\n // Combine the default data source (server transport) with the registered\n // direct/custom sources from <Rebase> and route each collection by its\n // resolved data-source key, looked up by path against the collection\n // registry. A stable resolver ref keeps the routed data instance\n // referentially stable across registry rebuilds, so data-effect\n // dependencies don't thrash.\n const defaultData = useData();\n const getCollectionRef = useRef(collectionRegistryController.getCollection);\n getCollectionRef.current = collectionRegistryController.getCollection;\n\n // Hand the data layer a way to read this registry. It was built by <Rebase>,\n // above us, and needs a collection's primary keys to give its rows an\n // address — rows themselves carry only columns.\n //\n // Registered during render, not in an effect: the views that fetch rows are\n // below us, and their effects run before ours, so an effect here would bind\n // after the first page had already been converted. The call only assigns a\n // ref, so repeating it per render is free.\n //\n // With it goes where each collection is stored: a direct driver has to be\n // handed the `path` a Firestore collection declares, not its slug.\n const registerCollectionResolver = useContext(CollectionResolverRegistrationContext);\n const resolveCollection = useCallback(\n (slug: string) => getCollectionRef.current(slug),\n []);\n registerCollectionResolver(resolveCollection, collectionRegistryController.resolveDataPath);\n const routedData = useMemo(() => buildRoutedRebaseData({\n defaultData,\n sources: dataSources.sources,\n resolveKey: (slugOrPath) => resolveDataSource(getCollectionRef.current(slugOrPath), dataSources.registry).key\n }), [defaultData, dataSources]);\n\n // Normalize the configured mount prefix to a leading-slash, no-trailing-slash\n // form (e.g. \"admin\" or \"/admin/\" -> \"/admin\"); empty/\"/\" stays \"/\".\n const basePath = useMemo(() => {\n const raw = registry.cmsConfig?.basePath;\n if (!raw || raw === \"/\") return \"/\";\n const trimmed = raw.replace(/^\\/+/, \"\").replace(/\\/+$/, \"\");\n return trimmed ? `/${trimmed}` : \"/\";\n }, [registry.cmsConfig?.basePath]);\n\n const builtUrlController = useBuildUrlController({\n basePath,\n baseCollectionPath: \"/c\",\n collectionRegistryController\n });\n // In an embedding (an MCP App view) no route draws a record's page: a\n // record opens over the screen, as it does under a CollectionsProvider.\n const embedded = useRebaseEmbedHost() !== undefined;\n const urlController = useMemo<UrlController>(() => embedded ? {\n ...builtUrlController,\n isUrlCollectionPath: () => false,\n routesMounted: false\n } : builtUrlController, [builtUrlController, embedded]);\n\n // ── Build config controller internally when collection editor is enabled ──\n const rebaseClient = useRebaseClient();\n const authController = useAuthController();\n\n // ── Dev-only data-source sanity check ─────────────────────────────\n // Warn about data sources declared with a direct/custom transport that\n // have no client-side driver — these silently fall back to the default\n // (server) source, a common source of misrouting. Unambiguous: it never\n // false-positives on server-mediated sources (which intentionally have\n // no client driver).\n useEffect(() => {\n if (process.env.NODE_ENV === \"production\") return;\n const { registry, sources } = dataSources;\n const missing = Object.values(registry)\n .filter((d) => (d.transport === \"direct\" || d.transport === \"custom\") && !sources[d.key])\n .map((d) => d.key);\n if (missing.length > 0) {\n console.warn(\n `[Rebase] These data source(s) declare a direct/custom transport but have no client-side driver and will fall back to the default data source: ${missing.map(k => `\"${k}\"`).join(\", \")}. ` +\n `Provide a \\`driver\\` for them in \\`dataSources\\` on <Rebase>.`\n );\n }\n }, [dataSources]);\n\n // `readOnly` is left undefined unless the developer set it: the controller\n // asks the backend whether its schema editor will accept a write, which is\n // the only process that knows. Deciding it here from `process.env.NODE_ENV`\n // — the *frontend bundle's* build mode — is what made the editor offer\n // itself against production backends, `baas` projects and servers without\n // `ts-morph`, and turned every save into a bare 404.\n //\n // Both of its status routes require `schema:read`. Asked by someone\n // without it, each answers 403 on every page load. So when the controller\n // reports scopes, it is not asked until they include that one. A\n // controller that does not report them leaves the backend to answer.\n const internalConfigController = useLocalCollectionsConfigController(\n rebaseClient,\n composedCollections,\n collectionEditorEnabled ? {\n readOnly: collectionEditorOptions?.readOnly,\n getAuthToken: collectionEditorOptions?.getAuthToken ?? authController?.getAuthToken,\n authKey: authController?.user?.uid ?? null,\n mayReadSchema: reportsScopes(authController)\n ? callerHoldsScope(authController, \"schema:read\")\n : undefined,\n tables: servedTables,\n presentation: { save: uiPreferences.controller.saveWorkspace }\n } : { readOnly: true }\n );\n\n const { t } = useTranslation();\n\n // ── Auto-inject schema view into Studio devViews ──────────────────\n const schemaView: AppView | undefined = useMemo(() => {\n // One rule, shared with the drawer and both home pages: they sort a\n // view into the Studio by asking the same question, so a route\n // injected here on any other terms shows up in CMS mode.\n if (!studioSchemaToolEnabled(registry)) return undefined;\n return {\n slug: \"schema\",\n // The name and description the Studio home page's card carries:\n // the drawer said \"Edit collections\" for what the card beside\n // it called \"Collections\".\n name: t(\"studio_tool_schema\"),\n description: t(\"studio_tool_schema_description\"),\n group: \"Database\",\n icon: \"LayoutList\",\n nestedRoutes: true,\n // Reads the controller from context at render time rather than\n // capturing it here. A view is a React *element*, and the\n // navigation state controller resolves the view list once and holds\n // on to the elements it resolved — so a controller passed as a prop\n // is frozen at whatever it was on the first render, forever. That\n // hid every later change: the editor stayed writable after the\n // backend said it was read-only, and the collection list never\n // refreshed. Everything else in the editor already reads this from\n // `ConfigControllerProvider`, which wraps this subtree.\n view: (\n <Suspense fallback={<CircularProgressCenter/>}>\n <CollectionsStudioViewFromContext/>\n </Suspense>\n )\n };\n }, [registry, t]);\n\n const devViews = useMemo(() => {\n const base = registry.studioConfig?.devViews ?? [];\n if (schemaView) return [...base, schemaView];\n return base;\n }, [registry.studioConfig?.devViews, schemaView]);\n\n // Merge admin-registered views with Studio dev views.\n // Order: admin views (developer's primary content) → Studio dev views (tooling).\n // Plugin views are merged later inside resolveAppViews.\n const cmsViews = registry.cmsConfig?.views;\n const mergedViews = useMemo(() => {\n if (!cmsViews) return devViews;\n if (Array.isArray(cmsViews) && cmsViews.length === 0) return devViews;\n // When cmsViews is a builder function, wrap it to append devViews after resolution\n if (typeof cmsViews === \"function\") {\n return async (params: Parameters<typeof cmsViews>[0]) => {\n const resolved = await cmsViews(params) ?? [];\n return [...resolved, ...devViews];\n };\n }\n return [...cmsViews, ...devViews];\n }, [cmsViews, devViews]);\n\n const parentCustomizationController = useCustomizationController();\n\n const builtNavigationStateController = useBuildNavigationStateController({\n plugins: parentCustomizationController.plugins ?? EMPTY_PLUGINS,\n collections: collectionsBuilder,\n // Until the tables arrive, no route that needs a collection renders:\n // they show the loading state, not \"collection not found\", and a deep\n // link resolves once the collections built from them are registered.\n collectionsPending: descriptors.status === \"loading\",\n views: mergedViews,\n navigationGroupMappings: registry.cmsConfig?.navigationGroupMappings,\n authController: context.authController!,\n // The collection and view builders get the rows the server sends.\n data: context.data,\n collectionRegistryController,\n urlController,\n adminMode: adminModeController?.mode\n });\n\n // A failure to load the tables is the navigation's loading error: the home\n // page and a route to a collection that could not be built say what failed\n // and offer to retry. A session the server no longer accepts is the\n // client's to renew, and it signs out when it cannot — so the error says to\n // sign in again.\n //\n // Refreshing the navigation asks for the tables again too: it is what the\n // collection editor calls after it changed the schema, and with an `ETag`\n // an unchanged schema costs a 304.\n const tablesError = descriptors.status === \"error\" ? descriptors.error : undefined;\n const reloadTables = descriptors.reload;\n const tablesInUse = registry.cmsConfig !== null && !descriptors.unavailable;\n const navigationStateController = useMemo<NavigationStateController>(() => {\n if (!tablesInUse) return builtNavigationStateController;\n const signedOut = tablesError instanceof RebaseApiError && tablesError.status === 401;\n const error = tablesError\n ? new Error(signedOut\n ? t(\"tables_load_signed_out\")\n : t(\"tables_load_failed\", { message: tablesError.message }), { cause: tablesError })\n : undefined;\n return {\n ...builtNavigationStateController,\n navigationLoadingError: builtNavigationStateController.navigationLoadingError ?? error,\n refreshNavigation: () => {\n reloadTables();\n builtNavigationStateController.refreshNavigation();\n }\n };\n }, [builtNavigationStateController, tablesInUse, tablesError, reloadTables, t]);\n\n // ── Merge admin-registered entityViews/entityActions into the customization controller ──\n // The <Rebase> component builds the customizationController from its own props,\n // but entity views passed to <RebaseCMS> are stored in the registry and not\n // automatically merged. We re-provide an enriched controller here so that\n // downstream consumers (EditViewBinding, side panels, etc.) can resolve\n // string-keyed entity views like \"blog_preview\".\n const enrichedCustomizationController = useMemo(() => {\n const cmsEntityViews = (registry.cmsConfig?.entityViews ?? []) as EntityCustomView[];\n const cmsEntityActions = (registry.cmsConfig?.entityActions ?? []) as EntityAction[];\n // Collection view modes ride the same channel, for the same reason:\n // `admin.customViews: [\"map\"]` has to find the component somewhere.\n const cmsCollectionViews = (registry.cmsConfig?.collectionViews ?? []) as CollectionCustomView[];\n if (cmsEntityViews.length === 0 && cmsEntityActions.length === 0 && cmsCollectionViews.length === 0) {\n return parentCustomizationController;\n }\n return {\n ...parentCustomizationController,\n entityViews: [\n ...(parentCustomizationController.entityViews ?? []),\n ...cmsEntityViews.filter(v => !(parentCustomizationController.entityViews ?? []).some(ev => ev.key === v.key))\n ],\n entityActions: [\n ...(parentCustomizationController.entityActions ?? []),\n ...cmsEntityActions.filter(a => !(parentCustomizationController.entityActions ?? []).some(ea => ea.key === a.key))\n ],\n collectionViews: [\n ...(parentCustomizationController.collectionViews ?? []),\n ...cmsCollectionViews.filter(v => !(parentCustomizationController.collectionViews ?? []).some(cv => cv.key === v.key))\n ]\n };\n }, [parentCustomizationController, registry.cmsConfig?.entityViews, registry.cmsConfig?.entityActions, registry.cmsConfig?.collectionViews]);\n\n // ── Inner content with all context providers ──────────────────────\n // Re-provide RebaseDataContext with the routed data so that every admin\n // consumer (list/entity views, references, board, import/export, and\n // `context.data`) is routed to the correct driver by collection path.\n const navigationContent = (\n <UserConfigurationPersistenceContext.Provider value={userConfigPersistence}>\n <CollectionsScopeContext.Provider value={true}>\n <RebaseDataContext.Provider value={routedData}>\n <CustomizationControllerContext.Provider value={enrichedCustomizationController}>\n <StudioBridgeRegistryProvider>\n <CollectionRegistryContext.Provider value={collectionRegistryController}>\n <UrlContext.Provider value={urlController}>\n <NavigationStateContext.Provider value={navigationStateController}>\n <SidePanelProvider>\n <BridgeAutoRegistrar\n collectionRegistryController={collectionRegistryController}\n urlController={urlController}\n navigationStateController={navigationStateController}\n canWriteToCodebase={!internalConfigController.readOnly}\n />\n {children}\n </SidePanelProvider>\n </NavigationStateContext.Provider>\n </UrlContext.Provider>\n </CollectionRegistryContext.Provider>\n </StudioBridgeRegistryProvider>\n </CustomizationControllerContext.Provider>\n </RebaseDataContext.Provider>\n </CollectionsScopeContext.Provider>\n </UserConfigurationPersistenceContext.Provider>\n );\n\n // ── Wrap with ConfigControllerProvider when collection editor is enabled ──\n if (collectionEditorEnabled) {\n return (\n <ConfigControllerProvider\n collectionConfigController={internalConfigController}\n pathSuggestions={collectionEditorOptions?.pathSuggestions}\n >\n {navigationContent}\n </ConfigControllerProvider>\n );\n }\n\n return navigationContent;\n}\n\n/**\n * The injected \"Edit collections\" view, bound to the live config controller.\n *\n * Exists so the element stored in the navigation state does not close over a\n * controller instance — see the comment at its construction site.\n */\nfunction CollectionsStudioViewFromContext() {\n const configController = useCollectionsConfigController();\n return <CollectionsStudioView configController={configController}/>;\n}\n\n/**\n * Internal component that auto-registers admin controllers into the\n * self-assembling Studio bridge. Must be rendered inside both the\n * navigation contexts and the StudioBridgeRegistryProvider.\n */\nfunction BridgeAutoRegistrar({\n collectionRegistryController,\n urlController,\n navigationStateController,\n canWriteToCodebase\n}: {\n collectionRegistryController: CollectionRegistryController;\n urlController: UrlController;\n navigationStateController: NavigationStateController;\n canWriteToCodebase: boolean;\n}) {\n useBridgeRegistration(\"collectionRegistry\", collectionRegistryController);\n useBridgeRegistration(\"urlController\", urlController);\n useBridgeRegistration(\"navigationState\", navigationStateController);\n\n // Studio tools that would write into the project's collection source — the\n // RLS editor's policy save for a mapped table, its \"Import to codebase\" —\n // ask the bridge whether that write can land. The default is `true`, which\n // is what an admin panel sitting next to its own `collectionsDir` assumes;\n // it is wrong for exactly the same backends that make the collection editor\n // read-only, so the two now answer from one source.\n const capabilities = useMemo(() => ({ codebase: canWriteToCodebase }), [canWriteToCodebase]);\n useBridgeRegistration(\"capabilities\", capabilities);\n return null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6BA,IAAM,gBAAgC,CAAC;AACvC,IAAM,iBAAoC,CAAC;AAC3C,IAAM,oBAAmD,CAAC;AAC1D,IAAM,0BAAsD,CAAC;AAwB7D,IAAM,wBAAwB,gBAC1B,OAAO,2EAAwE,CAC1E,MAAK,OAAM,EAAE,SAAS,EAAE,4BAA4B,EAAE,CAC/D;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,iBAAiB,EAAE,YAAmC;CAClE,MAAM,WAAW,kBAAkB;CAGnC,gBAAgB,oBAAoB,GAAG,CAAC,CAAC;CACzC,MAAM,UAAU,iBAAiB;CACjC,MAAM,sBAAsB,uBAAuB;CAInD,MAAM,+BAA+B,gCAAgC;CAOrE,MAAM,yBAAyB,SAAS,WAAW;CACnD,MAAM,0BAA0B,QAAQ,sBAAsB,KAAK,QAAQ,SAAS,YAAY;CAChG,MAAM,0BAA+D,cAAc;EAC/E,IAAI,2BAA2B,QAAQ,CAAC,wBAAwB,OAAO,CAAC;EACxE,OAAO;CACX,GAAG,CAAC,sBAAsB,CAAC;CAO3B,MAAM,sBAAs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,8BACA,eACA,2BACA,sBAMD;CACC,sBAAsB,sBAAsB,4BAA4B;CACxE,sBAAsB,iBAAiB,aAAa;CACpD,sBAAsB,mBAAmB,yBAAyB;CASlE,sBAAsB,gBADD,eAAe,EAAE,UAAU,mBAAmB,IAAI,CAAC,kBAAkB,CACpD,CAAY;CAClD,OAAO;AACX"}
|
package/dist/index.js
CHANGED
|
@@ -118,23 +118,6 @@ import { useChildViewSource } from "./hooks/useChildViewSource.js";
|
|
|
118
118
|
import { EditViewBinding } from "./components/EditViewBinding.js";
|
|
119
119
|
import { MAX_SELECTION_ROWS, SELECTION_PAGE_SIZE, resolveSelection, selectionQueryToFindParams, serializeSelectionQuery } from "./selection/resolve_selection.js";
|
|
120
120
|
import { SelectionMenu } from "./selection/SelectionMenu.js";
|
|
121
|
-
import { FieldCaption } from "./components/FieldCaption.js";
|
|
122
|
-
import { SearchIconsView } from "./components/SearchIconsView.js";
|
|
123
|
-
import { PropertyConfigBadge } from "./components/PropertyConfigBadge.js";
|
|
124
|
-
import { downloadBlob, downloadDataAsCsv, downloadEntitiesExport, entryToCSVRow, escapeCsvFormula, getEntityCSVExportableData, getEntityJsonExportableData, unescapeCsvFormula } from "./data_export/export/export.js";
|
|
125
|
-
import { detectCsvDelimiter, parseCsvRows, parseCsvToObjects } from "./data_import/utils/csv.js";
|
|
126
|
-
import { convertFileToJson } from "./data_import/utils/file_to_json.js";
|
|
127
|
-
import { ImportFileUpload } from "./data_import/components/ImportFileUpload.js";
|
|
128
|
-
import { IMPORT_BATCH_MAX_BYTES, IMPORT_BATCH_SIZE, saveImportedEntities } from "./data_import/utils/save_entities.js";
|
|
129
|
-
import { ImportSaveInProgress } from "./data_import/components/ImportSaveInProgress.js";
|
|
130
|
-
import { useImportConfig } from "./data_import/hooks/useImportConfig.js";
|
|
131
|
-
import { getInferenceType } from "./data_import/utils/get_import_inference_type.js";
|
|
132
|
-
import { convertDataToEntity, convertImportData, flattenEntry, mappedColumnTarget, processValueMapping, slashDateOrdersByColumn } from "./data_import/utils/data.js";
|
|
133
|
-
import { ImportConversionProblems } from "./data_import/components/ImportConversionProblems.js";
|
|
134
|
-
import { DataNewPropertiesMapping } from "./data_import/components/DataNewPropertiesMapping.js";
|
|
135
|
-
import { ImportNewPropertyFieldPreview } from "./data_import/components/ImportNewPropertyFieldPreview.js";
|
|
136
|
-
import { useCollectionEditorController } from "./collection_editor/useCollectionEditorController.js";
|
|
137
|
-
import { EditorCollectionAction } from "./collection_editor/ui/EditorCollectionAction.js";
|
|
138
121
|
import { CollectionAddButton } from "./components/CollectionViewBinding/CollectionAddButton.js";
|
|
139
122
|
import { CollectionViewActions } from "./components/CollectionViewBinding/CollectionViewActions.js";
|
|
140
123
|
import { CollectionFiltersButton, CollectionSearchBar, CollectionToolbar, CollectionViewModeToggle } from "./components/CollectionViewBinding/CollectionToolbar.js";
|
|
@@ -145,7 +128,10 @@ import { EntityCardBinding } from "./components/CollectionViewBinding/EntityCard
|
|
|
145
128
|
import { CollectionCardViewBinding } from "./components/CollectionViewBinding/CollectionCardViewBinding.js";
|
|
146
129
|
import { CollectionViewBinding } from "./components/CollectionViewBinding/CollectionViewBinding.js";
|
|
147
130
|
import { DetailViewBinding } from "./components/DetailViewBinding.js";
|
|
131
|
+
import { PropertyConfigBadge } from "./components/PropertyConfigBadge.js";
|
|
148
132
|
import { ReferenceWidget } from "./components/ReferenceWidget.js";
|
|
133
|
+
import { SearchIconsView } from "./components/SearchIconsView.js";
|
|
134
|
+
import { FieldCaption } from "./components/FieldCaption.js";
|
|
149
135
|
import { SidePanelProvider } from "./components/SidePanelProvider.js";
|
|
150
136
|
import { AdminModeSyncer } from "./components/AdminModeSyncer.js";
|
|
151
137
|
import { useApp } from "./components/app/useApp.js";
|
|
@@ -161,6 +147,18 @@ import { RebaseAuthGate } from "./components/RebaseAuthGate.js";
|
|
|
161
147
|
import { LiveSchemaError, SchemaChangeCancelled, asUnavailable, createLiveSchemaClient, isSchemaChangeCancelled } from "./collection_editor/liveSchemaClient.js";
|
|
162
148
|
import { useLiveSchemaEditing } from "./collection_editor/useLiveSchemaEditing.js";
|
|
163
149
|
import { useLocalCollectionsConfigController } from "./collection_editor/useLocalCollectionsConfigController.js";
|
|
150
|
+
import { downloadBlob, downloadDataAsCsv, downloadEntitiesExport, entryToCSVRow, escapeCsvFormula, getEntityCSVExportableData, getEntityJsonExportableData, unescapeCsvFormula } from "./data_export/export/export.js";
|
|
151
|
+
import { detectCsvDelimiter, parseCsvRows, parseCsvToObjects } from "./data_import/utils/csv.js";
|
|
152
|
+
import { convertFileToJson } from "./data_import/utils/file_to_json.js";
|
|
153
|
+
import { ImportFileUpload } from "./data_import/components/ImportFileUpload.js";
|
|
154
|
+
import { IMPORT_BATCH_MAX_BYTES, IMPORT_BATCH_SIZE, saveImportedEntities } from "./data_import/utils/save_entities.js";
|
|
155
|
+
import { ImportSaveInProgress } from "./data_import/components/ImportSaveInProgress.js";
|
|
156
|
+
import { useImportConfig } from "./data_import/hooks/useImportConfig.js";
|
|
157
|
+
import { getInferenceType } from "./data_import/utils/get_import_inference_type.js";
|
|
158
|
+
import { convertDataToEntity, convertImportData, flattenEntry, mappedColumnTarget, processValueMapping, slashDateOrdersByColumn } from "./data_import/utils/data.js";
|
|
159
|
+
import { ImportConversionProblems } from "./data_import/components/ImportConversionProblems.js";
|
|
160
|
+
import { DataNewPropertiesMapping } from "./data_import/components/DataNewPropertiesMapping.js";
|
|
161
|
+
import { ImportNewPropertyFieldPreview } from "./data_import/components/ImportNewPropertyFieldPreview.js";
|
|
164
162
|
import { useCollectionsConfigController } from "./collection_editor/useCollectionsConfigController.js";
|
|
165
163
|
import { RebaseNavigation } from "./components/RebaseNavigation.js";
|
|
166
164
|
import { RebaseLayout } from "./components/RebaseLayout.js";
|
|
@@ -181,12 +179,14 @@ import { ImportCollectionAction, ImportDataPreview, PropertySelectEntry } from "
|
|
|
181
179
|
import { EXPORT_PAGE_SIZE, MAX_EXPORT_ROWS, fetchAllEntitiesForExport } from "./data_export/export/fetch_export_data.js";
|
|
182
180
|
import { BasicExportAction } from "./data_export/export/BasicExportAction.js";
|
|
183
181
|
import { ExportCollectionAction } from "./data_export/export/ExportCollectionAction.js";
|
|
182
|
+
import { useCollectionEditorController } from "./collection_editor/useCollectionEditorController.js";
|
|
184
183
|
import { fromSerializableCollectionConfig, fromSerializableCollectionConfigs, fromSerializableProperties, fromSerializableProperty, toSerializableCollectionConfig, toSerializableProperties, toSerializableProperty } from "./collection_editor/serializable_utils.js";
|
|
185
184
|
import { validateCollectionJson } from "./collection_editor/validateCollectionJson.js";
|
|
186
185
|
import { CollectionGenerationApiError, DEFAULT_COLLECTION_GENERATION_ENDPOINT, buildCollectionGenerationCallback } from "./collection_editor/api/generateCollectionApi.js";
|
|
187
186
|
import { MissingReferenceWidget } from "./collection_editor/ui/MissingReferenceWidget.js";
|
|
188
187
|
import { getFullId, getFullIdPath, idToPropertiesPath, namespaceToPropertiesOrderPath, namespaceToPropertiesPath } from "./collection_editor/ui/collection_editor/util.js";
|
|
189
188
|
import { SmallNavigationCard } from "./components/HomePage/SmallNavigationCard.js";
|
|
189
|
+
import { EditorCollectionAction } from "./collection_editor/ui/EditorCollectionAction.js";
|
|
190
190
|
import { SavedAppFrame, sandboxedViewDocument } from "./saved_apps/saved_app_frame.js";
|
|
191
191
|
import { SavedAppsView, savedAppsView } from "./saved_apps/SavedAppsView.js";
|
|
192
192
|
export { AdditionalFieldValue, AdminModeSyncer, AppBar, ArrayContainer, ArrayCustomShapedFieldBinding, ArrayEnumPreview, ArrayOfMapsPreview, ArrayOfReferencesFieldBinding, ArrayOfReferencesPreview, ArrayOfStorageComponentsPreview, ArrayOfStringsPreview, ArrayOneOfPreview, ArrayPropertyEnumPreview, ArrayPropertyPreview, BasicExportAction, BlockFieldBinding, BooleanFilterField, BooleanPreview, CollectionAddButton, CollectionCardViewBinding, CollectionFiltersButton, CollectionGenerationApiError, CollectionPanel, CollectionRegistryContext, CollectionRowActions, CollectionSearchBar, CollectionTableBinding, CollectionTableToolbar, CollectionToolbar, CollectionViewActions, CollectionViewBinding, CollectionViewModeToggle, CollectionsProvider, CreationResultDialog, CustomViewRoute, DEFAULT_COLLECTION_GENERATION_ENDPOINT, DEFAULT_FIELD_CONFIGS, DataNewPropertiesMapping, DatePreview, DateTimeFieldBinding, DateTimeFilterField, DefaultDrawer, DetailViewBinding, Drawer, DrawerExpansionContext, DrawerFooterActions, DrawerNavigationGroup, DrawerNavigationItem, EXPORT_PAGE_SIZE, EditViewBinding, EditorAIControllerProvider, EditorCollectionAction, EmptyValue, EntityCardBinding, EntityForm, EntityFormBinding, EntityFormPanel, EntityPreviewBinding, EntityTableCell, EntityViewBinding, EnumValuesChip, ExportCollectionAction, FavouritesView, FieldBlock, FieldCaption, FieldHelperText, FieldValue, FormField, FormRail, FormSections, Highlighted, IMPORT_BATCH_MAX_BYTES, IMPORT_BATCH_SIZE, ImagePreview, ImportCollectionAction, ImportConversionProblems, ImportDataPreview, ImportFileUpload, ImportNewPropertyFieldPreview, ImportSaveInProgress, InlineEntityListPreview, KeyValueFieldBinding, KeyValuePreview, LABEL_ICON_SIZE, LabelWithIcon, LiveSchemaError, MAX_EXPORT_ROWS, MAX_SELECTION_ROWS, MapFieldBinding, MapPropertyPreview, MarkdownEditorFieldBinding, MatchExplanation, MissingReferenceWidget, MultiSelectFieldBinding, NAVIGATION_DEFAULT_GROUP_NAME, NavigationCard, NavigationCardBinding, NavigationGroup, NavigationStateContext, NestedEntityPreviewBoundary, NumberPropertyPreview, PropertyConfigBadge, PropertyFieldBinding, PropertyKeyHint, PropertyPreview, PropertySelectEntry, PropertyTableCell, ReadOnlyFieldBinding, RebaseAuthGate, RebaseCMS, RebaseLayout, RebaseNavigation, RebaseRoute, RebaseRouteDefs, RebaseShell, RecordDetail, RecordForm, RecordMeta, ReferenceFieldBinding, ReferenceFilterField, ReferencePreview, ReferenceWidget, RelationFilterField, RelationPreview, RepeatFieldBinding, SELECTION_PAGE_SIZE, SavedAppFrame, SavedAppsView, Scaffold, SchemaChangeCancelled, SearchIconsView, SelectFieldBinding, SelectableTable, SelectableTableContext, SelectionMenu, SelectionTableBinding, SideDialogs, SidePanelControllerContext, SidePanelProvider, SkeletonPropertyComponent, SlotValue, SmallNavigationCard, StorageThumbnail, StorageThumbnailInternal, StorageUploadFieldBinding, StringNumberFilterField, StringPropertyPreview, SwitchFieldBinding, TagChips, TextFieldBinding, UrlComponentPreview, UrlContext, UserPreview, VectorFieldBinding, VirtualTableInput, addInitialSlash, applyTableCustomization, applyTableCustomizations, asUnavailable, buildCollectionGenerationCallback, buildSidePanelsFromUrl, collectionFromTable, collectionsFromTables, composeCollections, convertDataToEntity, convertFileToJson, convertImportData, copyEntityAction, createLiveSchemaClient, createStaticDataController, customizeTable, deleteEntityAction, detectCsvDelimiter, downloadBlob, downloadDataAsCsv, downloadEntitiesExport, editEntityAction, entityActionName, entryToCSVRow, escapeCsvFormula, extractTouchedValues, fetchAllEntitiesForExport, fieldLabel, flattenEntry, formatDatePreview, fromSerializableCollectionConfig, fromSerializableCollectionConfigs, fromSerializableProperties, fromSerializableProperty, getBracketNotation, getChanges, getCollectionBySlugWithin, getCollectionPathsCombinations, getDatePropertyMode, getDatePropertyTimezone, getDefaultFieldConfig, getDefaultFieldId, getDefaultPropertiesOrder, getEntityCSVExportableData, getEntityJsonExportableData, getEntityPreviewKeys, getEntityTitlePropertyKey, getEntityTitlePropertyKeyForEntity, getEntityViewWidth, getFieldConfig, getFieldId, getFullId, getFullIdPath, getIconForProperty, getIconForWidget, getInferenceType, getInitialEntityValues, getLastSegment, getParentLinkValues, getPropertiesWithPropertiesOrder, getPropertyInPath, getRelationTargetPath, getResolvedPropertyInPath, getTouchedPropertyValues, getUnappliedLocalChanges, getUserLabel, hasEntityId, idToPropertiesPath, isEmptyPreviewValue, isReferenceProperty, isRelationProperty, isSchemaChangeCancelled, isSelfLabellingProperty, mapPropertiesToConfigs, mapPropertyToConfig, mappedColumnTarget, mergeEntityActions, namespaceToPropertiesOrderPath, namespaceToPropertiesPath, normalizeDeprecatedSidePanelProps, overlayEdit, parseCsvRows, parseCsvToObjects, processValueMapping, propertiesToColumns, removeEmptyContainers, removeInitialAndTrailingSlashes, removeInitialSlash, removeTrailingSlash, renderSkeletonCaptionText, renderSkeletonIcon, renderSkeletonImageThumbnail, renderSkeletonText, resetPasswordAction, resolveCollectionPathIds, resolveCollectionSlotKeys, resolveEntityAction, resolveEntityActionState, resolveEntityView, resolveNavigationFrom, resolveSelection, sandboxedViewDocument, sanitizeUrl, saveImportedEntities, savedAppsView, selectionQueryToFindParams, serializeSelectionQuery, slashDateOrdersByColumn, spanClass, toSerializableCollectionConfig, toSerializableProperties, toSerializableProperty, unescapeCsvFormula, unlinkEntityAction, updateRecord, useAdminContext, useApp, useBreadcrumbsController, useBuildCollectionRegistryController, useBuildNavigationStateController, useBuildSidePanel, useBuildUrlController, useChildViewSource, useClearRestoreValue, useCollectionDataController, useCollectionEditorController, useCollectionLargeLayout, useCollectionRegistryController, useCollectionSlotKeys, useCollectionsConfigController, useDateFnsLocale, useDrawerExpandedWhile, useDrawerExpansion, useEntitySlots, useEntityTitle, useHistory, useImagePlace, useImportConfig, useLiveSchemaEditing, useLocalCollectionsConfigController, useNavigationStateController, useProvidedEditorAIController, useResolvedCollections, useResolvedNavigationFrom, useResolvedUser, useResolvedViews, useSearchExplanation, useSelectionController, useSelectionDialog, useSideDialogContext, useSideDialogsController, useSidePanel, useToolbarLabels, useTopLevelNavigation, useUrlController, validateCollectionJson, zodToFormErrors };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/cms",
|
|
3
|
-
"version": "0.34.
|
|
3
|
+
"version": "0.34.2",
|
|
4
4
|
"description": "Rebase CMS — content management views, forms, and routing",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rebase",
|
|
@@ -99,14 +99,14 @@
|
|
|
99
99
|
"react-use-measure": "^2.1.7",
|
|
100
100
|
"read-excel-file": "^9.3.10",
|
|
101
101
|
"zod": "^4.4.3",
|
|
102
|
-
"@rebasepro/
|
|
103
|
-
"@rebasepro/
|
|
104
|
-
"@rebasepro/
|
|
105
|
-
"@rebasepro/
|
|
106
|
-
"@rebasepro/
|
|
107
|
-
"@rebasepro/
|
|
108
|
-
"@rebasepro/
|
|
109
|
-
"@rebasepro/utils": "0.34.
|
|
102
|
+
"@rebasepro/cms-types": "0.34.2",
|
|
103
|
+
"@rebasepro/forms": "0.34.2",
|
|
104
|
+
"@rebasepro/inference": "0.34.2",
|
|
105
|
+
"@rebasepro/types": "0.34.2",
|
|
106
|
+
"@rebasepro/ui": "0.34.2",
|
|
107
|
+
"@rebasepro/common": "0.34.2",
|
|
108
|
+
"@rebasepro/app": "0.34.2",
|
|
109
|
+
"@rebasepro/utils": "0.34.2"
|
|
110
110
|
},
|
|
111
111
|
"peerDependencies": {
|
|
112
112
|
"react": "^19.2.7",
|