@rebasepro/cms 0.24.0 → 0.24.1-canary.gcb918fc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/collection_editor/CollectionEditorDialogsContext.js +10 -0
- package/dist/collection_editor/CollectionEditorDialogsContext.js.map +1 -0
- package/dist/collection_editor/ConfigControllerProvider.js +274 -0
- package/dist/collection_editor/ConfigControllerProvider.js.map +1 -0
- package/dist/collection_editor/api/generateCollectionApi.js +64 -0
- package/dist/collection_editor/api/generateCollectionApi.js.map +1 -0
- package/dist/collection_editor/collection_wire.d.ts +13 -0
- package/dist/collection_editor/collection_wire.js +49 -0
- package/dist/collection_editor/collection_wire.js.map +1 -0
- package/dist/collection_editor/liveSchemaClient.js +130 -0
- package/dist/collection_editor/liveSchemaClient.js.map +1 -0
- package/dist/collection_editor/relation_kinds.js +74 -0
- package/dist/collection_editor/relation_kinds.js.map +1 -0
- package/dist/collection_editor/serializable_types.d.ts +4 -1
- package/dist/collection_editor/serializable_utils.js +504 -0
- package/dist/collection_editor/serializable_utils.js.map +1 -0
- package/dist/collection_editor/ui/EditorCollectionAction.js +37 -0
- package/dist/collection_editor/ui/EditorCollectionAction.js.map +1 -0
- package/dist/collection_editor/ui/MissingReferenceWidget.js +39 -0
- package/dist/collection_editor/ui/MissingReferenceWidget.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js +160 -0
- package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js +61 -0
- package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js +731 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js +220 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js +160 -0
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js +394 -0
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js +616 -0
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js +68 -0
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js +11 -0
- package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js +148 -0
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js +244 -0
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/EnumForm.js +222 -0
- package/dist/collection_editor/ui/collection_editor/EnumForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js +204 -0
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js +108 -0
- package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js +163 -0
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js +59 -0
- package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js +640 -0
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js +141 -0
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js +210 -0
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js +31 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js +25 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js.map +1 -0
- package/dist/{SchemaChangeDialog-CcFSXvkK.js → collection_editor/ui/collection_editor/SchemaChangeDialog.js} +42 -59
- package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/SwitchControl.js +24 -0
- package/dist/collection_editor/ui/collection_editor/SwitchControl.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js +66 -0
- package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js +61 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js +188 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +12 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js +74 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js +100 -0
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js +34 -0
- package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js +75 -0
- package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js +338 -0
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js +83 -0
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js +15 -0
- package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js +121 -0
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js +127 -0
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js +151 -0
- package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js +77 -0
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js +254 -0
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js +71 -0
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js +356 -0
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js +173 -0
- package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js +79 -0
- package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js +34 -0
- package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js +47 -0
- package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js +47 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js +62 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js +119 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.d.ts +10 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js +178 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js +23 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.js +116 -0
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.js +182 -0
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/products_template.js +87 -0
- package/dist/collection_editor/ui/collection_editor/templates/products_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/users_template.js +46 -0
- package/dist/collection_editor/ui/collection_editor/templates/users_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/util.js +20 -0
- package/dist/collection_editor/ui/collection_editor/util.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/strings.js +2 -0
- package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js +37 -0
- package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js +192 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js.map +1 -0
- package/dist/collection_editor/useCollectionEditorController.js +12 -0
- package/dist/collection_editor/useCollectionEditorController.js.map +1 -0
- package/dist/collection_editor/useCollectionsConfigController.js +12 -0
- package/dist/collection_editor/useCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useJsonCollectionsConfigController.js +191 -0
- package/dist/collection_editor/useJsonCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useLiveSchemaEditing.js +214 -0
- package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.js +228 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useSafeSnackbarController.js +13 -0
- package/dist/collection_editor/useSafeSnackbarController.js.map +1 -0
- package/dist/collection_editor/validateCollectionJson.js +289 -0
- package/dist/collection_editor/validateCollectionJson.js.map +1 -0
- package/dist/collection_editor_ui.js +7 -33
- package/dist/components/AdditionalFieldValue.js +60 -0
- package/dist/components/AdditionalFieldValue.js.map +1 -0
- package/dist/components/AdminModeSyncer.js +41 -0
- package/dist/components/AdminModeSyncer.js.map +1 -0
- package/dist/components/ArrayContainer.d.ts +8 -2
- package/dist/components/ArrayContainer.js +363 -0
- package/dist/components/ArrayContainer.js.map +1 -0
- package/dist/components/ClearFilterSortButton.js +33 -0
- package/dist/components/ClearFilterSortButton.js.map +1 -0
- package/dist/components/CollectionEditorDialogs.js +49 -0
- package/dist/components/CollectionEditorDialogs.js.map +1 -0
- package/dist/components/CollectionPanel.d.ts +26 -5
- package/dist/components/CollectionPanel.js +142 -0
- package/dist/components/CollectionPanel.js.map +1 -0
- package/dist/components/CollectionTableBinding/CollectionRowActions.js +165 -0
- package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -0
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js +329 -0
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -0
- package/dist/components/CollectionTableBinding/PropertyTableCell.js +311 -0
- package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -0
- package/dist/components/CollectionTableBinding/column_utils.js +85 -0
- package/dist/components/CollectionTableBinding/column_utils.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js +45 -0
- package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +66 -0
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +86 -0
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js +93 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js +33 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js +171 -0
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js +91 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js +36 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js.map +1 -0
- package/dist/components/CollectionTableBinding/index.js +6 -0
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js +50 -0
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.d.ts +2 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.js +223 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js +58 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/TableCellOpener.js +53 -0
- package/dist/components/CollectionTableBinding/internal/TableCellOpener.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/common.js +40 -0
- package/dist/components/CollectionTableBinding/internal/common.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +270 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js +68 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js +24 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js.map +1 -0
- package/dist/components/CollectionTableBinding/table_bindings.js +306 -0
- package/dist/components/CollectionTableBinding/table_bindings.js.map +1 -0
- package/dist/components/CollectionViewBinding/BoardCardBinding.js +160 -0
- package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +471 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js +108 -0
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +988 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.js +146 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js +1209 -0
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js +133 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.js +133 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js +203 -0
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.js +148 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.js.map +1 -0
- package/dist/components/CollectionViewBinding/SearchExplanation.js +86 -0
- package/dist/components/CollectionViewBinding/SearchExplanation.js.map +1 -0
- package/dist/components/CollectionViewBinding/SearchHighlight.js +262 -0
- package/dist/components/CollectionViewBinding/SearchHighlight.js.map +1 -0
- package/dist/components/CollectionViewBinding/SlotValue.js +117 -0
- package/dist/components/CollectionViewBinding/SlotValue.js.map +1 -0
- package/dist/components/CollectionViewBinding/SortButton.js +214 -0
- package/dist/components/CollectionViewBinding/SortButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListCloseButton.js +41 -0
- package/dist/components/CollectionViewBinding/SplitListCloseButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListShowButton.js +29 -0
- package/dist/components/CollectionViewBinding/SplitListShowButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListView.js +311 -0
- package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitViewContext.js +21 -0
- package/dist/components/CollectionViewBinding/SplitViewContext.js.map +1 -0
- package/dist/components/CollectionViewBinding/ViewModeToggle.js +150 -0
- package/dist/components/CollectionViewBinding/ViewModeToggle.js.map +1 -0
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js +49 -0
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js.map +1 -0
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js +122 -0
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js.map +1 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js +530 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +4 -1
- package/dist/components/CollectionViewBinding/usePreviewSlots.js +384 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -0
- package/dist/components/CollectionViewBinding/useSelectionController.js +104 -0
- package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -0
- package/dist/components/CollectionViewBinding/utils.js +21 -0
- package/dist/components/CollectionViewBinding/utils.js.map +1 -0
- package/dist/components/CollectionsProvider.d.ts +44 -0
- package/dist/components/CollectionsProvider.js +137 -0
- package/dist/components/CollectionsProvider.js.map +1 -0
- package/dist/components/CollectionsScopeContext.d.ts +18 -0
- package/dist/components/CollectionsScopeContext.js +25 -0
- package/dist/components/CollectionsScopeContext.js.map +1 -0
- package/dist/components/DefaultAppBar.js +179 -0
- package/dist/components/DefaultAppBar.js.map +1 -0
- package/dist/components/DefaultDrawer.js +364 -0
- package/dist/components/DefaultDrawer.js.map +1 -0
- package/dist/components/DeleteEntityDialog.js +256 -0
- package/dist/components/DeleteEntityDialog.js.map +1 -0
- package/dist/components/DetailViewBinding.js +504 -0
- package/dist/components/DetailViewBinding.js.map +1 -0
- package/dist/components/DrawerNavigationGroup.js +74 -0
- package/dist/components/DrawerNavigationGroup.js.map +1 -0
- package/dist/components/DrawerNavigationItem.d.ts +8 -0
- package/dist/components/DrawerNavigationItem.js +45 -0
- package/dist/components/DrawerNavigationItem.js.map +1 -0
- package/dist/components/EditFormActions.js +210 -0
- package/dist/components/EditFormActions.js.map +1 -0
- package/dist/components/EditViewBinding.js +802 -0
- package/dist/components/EditViewBinding.js.map +1 -0
- package/dist/components/EntityDisplayHeader.js +139 -0
- package/dist/components/EntityDisplayHeader.js.map +1 -0
- package/dist/components/EntityFormPanel.d.ts +58 -0
- package/dist/components/EntityFormPanel.js +126 -0
- package/dist/components/EntityFormPanel.js.map +1 -0
- package/dist/components/EntityIdentityBar.js +364 -0
- package/dist/components/EntityIdentityBar.js.map +1 -0
- package/dist/components/EntityInspector.js +96 -0
- package/dist/components/EntityInspector.js.map +1 -0
- package/dist/components/EntityPreviewBinding.js +282 -0
- package/dist/components/EntityPreviewBinding.js.map +1 -0
- package/dist/components/EntityPreviewNesting.js +53 -0
- package/dist/components/EntityPreviewNesting.js.map +1 -0
- package/dist/components/EntityViewBinding.js +246 -0
- package/dist/components/EntityViewBinding.js.map +1 -0
- package/dist/components/FieldCaption.js +17 -0
- package/dist/components/FieldCaption.js.map +1 -0
- package/dist/components/HomePage/ContentHomePage.js +326 -0
- package/dist/components/HomePage/ContentHomePage.js.map +1 -0
- package/dist/components/HomePage/FavouritesView.js +44 -0
- package/dist/components/HomePage/FavouritesView.js.map +1 -0
- package/dist/components/HomePage/HomePageDnD.js +436 -0
- package/dist/components/HomePage/HomePageDnD.js.map +1 -0
- package/dist/components/HomePage/NavigationCard.js +59 -0
- package/dist/components/HomePage/NavigationCard.js.map +1 -0
- package/dist/components/HomePage/NavigationCardBinding.js +70 -0
- package/dist/components/HomePage/NavigationCardBinding.js.map +1 -0
- package/dist/components/HomePage/NavigationGroup.js +98 -0
- package/dist/components/HomePage/NavigationGroup.js.map +1 -0
- package/dist/components/HomePage/RenameGroupDialog.js +89 -0
- package/dist/components/HomePage/RenameGroupDialog.js.map +1 -0
- package/dist/components/InlineEntityPreview.js +116 -0
- package/dist/components/InlineEntityPreview.js.map +1 -0
- package/dist/{JsonPreviewBinding-v0w3H0fp.js → components/JsonPreviewBinding.js} +2 -2
- package/dist/components/JsonPreviewBinding.js.map +1 -0
- package/dist/components/NavigationLoadingErrorView.js +27 -0
- package/dist/components/NavigationLoadingErrorView.js.map +1 -0
- package/dist/components/PickerTrigger.js +27 -0
- package/dist/components/PickerTrigger.js.map +1 -0
- package/dist/components/PropertyCollectionView.js +215 -0
- package/dist/components/PropertyCollectionView.js.map +1 -0
- package/dist/components/PropertyConfigBadge.js +19 -0
- package/dist/components/PropertyConfigBadge.js.map +1 -0
- package/dist/components/PropertyKeyHint.js +58 -0
- package/dist/components/PropertyKeyHint.js.map +1 -0
- package/dist/components/RebaseAuthGate.js +35 -0
- package/dist/components/RebaseAuthGate.js.map +1 -0
- package/dist/components/RebaseCMS.js +44 -0
- package/dist/components/RebaseCMS.js.map +1 -0
- package/dist/components/RebaseLayout.js +59 -0
- package/dist/components/RebaseLayout.js.map +1 -0
- package/dist/components/RebaseNavigation.js +215 -0
- package/dist/components/RebaseNavigation.js.map +1 -0
- package/dist/components/RebaseRouteDefs.js +96 -0
- package/dist/components/RebaseRouteDefs.js.map +1 -0
- package/dist/components/RebaseShell.js +50 -0
- package/dist/components/RebaseShell.js.map +1 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.js +224 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -0
- package/dist/components/ReferenceWidget.js +100 -0
- package/dist/components/ReferenceWidget.js.map +1 -0
- package/dist/components/RelationSelector.js +625 -0
- package/dist/components/RelationSelector.js.map +1 -0
- package/dist/components/SearchIconsView.js +52 -0
- package/dist/components/SearchIconsView.js.map +1 -0
- package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
- package/dist/components/SelectableTable/SelectableTable.js +158 -0
- package/dist/components/SelectableTable/SelectableTable.js.map +1 -0
- package/dist/components/SelectableTable/SelectableTableContext.js +8 -0
- package/dist/components/SelectableTable/SelectableTableContext.js.map +1 -0
- package/dist/components/SelectableTable/SelectionStore.js +29 -0
- package/dist/components/SelectableTable/SelectionStore.js.map +1 -0
- package/dist/components/SelectableTable/filters/BooleanFilterField.js +28 -0
- package/dist/components/SelectableTable/filters/BooleanFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +2 -1
- package/dist/components/SelectableTable/filters/DateTimeFilterField.js +93 -0
- package/dist/components/SelectableTable/filters/DateTimeFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js +132 -0
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js.map +1 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js +157 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/RelationFilterField.js +169 -0
- package/dist/components/SelectableTable/filters/RelationFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js +181 -0
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/null_filter.js +36 -0
- package/dist/components/SelectableTable/filters/null_filter.js.map +1 -0
- package/dist/components/SideDialogs.js +149 -0
- package/dist/components/SideDialogs.js.map +1 -0
- package/dist/components/SidePanelBinding.js +287 -0
- package/dist/components/SidePanelBinding.js.map +1 -0
- package/dist/components/SidePanelProvider.js +69 -0
- package/dist/components/SidePanelProvider.js.map +1 -0
- package/dist/components/UserSelector.d.ts +2 -0
- package/dist/components/UserSelector.js +418 -0
- package/dist/components/UserSelector.js.map +1 -0
- package/dist/components/admin/CreationResultDialog.js +118 -0
- package/dist/components/admin/CreationResultDialog.js.map +1 -0
- package/dist/components/app/AppBar.js +14 -0
- package/dist/components/app/AppBar.js.map +1 -0
- package/dist/components/app/Drawer.js +26 -0
- package/dist/components/app/Drawer.js.map +1 -0
- package/dist/components/app/Scaffold.js +229 -0
- package/dist/components/app/Scaffold.js.map +1 -0
- package/dist/components/app/useApp.js +24 -0
- package/dist/components/app/useApp.js.map +1 -0
- package/dist/components/common/ActionMenuLabel.js +30 -0
- package/dist/components/common/ActionMenuLabel.js.map +1 -0
- package/dist/components/common/default_entity_actions.js +590 -0
- package/dist/components/common/default_entity_actions.js.map +1 -0
- package/dist/components/drawer_expansion.d.ts +25 -0
- package/dist/components/drawer_expansion.js +44 -0
- package/dist/components/drawer_expansion.js.map +1 -0
- package/dist/components/field_configs.d.ts +2 -2
- package/dist/components/field_configs.js +431 -0
- package/dist/components/field_configs.js.map +1 -0
- package/dist/components/field_ids.d.ts +11 -0
- package/dist/components/field_ids.js +58 -0
- package/dist/components/field_ids.js.map +1 -0
- package/dist/components/history/EntityHistoryEntry.js +151 -0
- package/dist/components/history/EntityHistoryEntry.js.map +1 -0
- package/dist/components/history/EntityHistoryView.js +157 -0
- package/dist/components/history/EntityHistoryView.js.map +1 -0
- package/dist/components/history/UserChip.js +21 -0
- package/dist/components/history/UserChip.js.map +1 -0
- package/dist/components/history/index.js +4 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/lazy_record_views.d.ts +10 -0
- package/dist/components/lazy_record_views.js +57 -0
- package/dist/components/lazy_record_views.js.map +1 -0
- package/dist/contexts/BreacrumbsContext.js +28 -0
- package/dist/contexts/BreacrumbsContext.js.map +1 -0
- package/dist/contexts/EditorAIControllerContext.d.ts +18 -0
- package/dist/contexts/EditorAIControllerContext.js +29 -0
- package/dist/contexts/EditorAIControllerContext.js.map +1 -0
- package/dist/contexts/SideDialogsControllerContext.js +7 -0
- package/dist/contexts/SideDialogsControllerContext.js.map +1 -0
- package/dist/data_export/export/BasicExportAction.js +151 -0
- package/dist/data_export/export/BasicExportAction.js.map +1 -0
- package/dist/data_export/export/ExportCollectionAction.js +297 -0
- package/dist/data_export/export/ExportCollectionAction.js.map +1 -0
- package/dist/data_export/export/additional_fields.js +40 -0
- package/dist/data_export/export/additional_fields.js.map +1 -0
- package/dist/data_export/export/export.d.ts +35 -0
- package/dist/data_export/export/export.js +400 -0
- package/dist/data_export/export/export.js.map +1 -0
- package/dist/data_export/export/fetch_export_data.d.ts +17 -7
- package/dist/data_export/export/fetch_export_data.js +67 -0
- package/dist/data_export/export/fetch_export_data.js.map +1 -0
- package/dist/data_export/export/index.d.ts +4 -2
- package/dist/data_export/export/index.js +5 -0
- package/dist/data_import/components/DataNewPropertiesMapping.js +207 -0
- package/dist/data_import/components/DataNewPropertiesMapping.js.map +1 -0
- package/dist/data_import/components/ImportConversionProblems.js +89 -0
- package/dist/data_import/components/ImportConversionProblems.js.map +1 -0
- package/dist/data_import/components/ImportFileUpload.js +43 -0
- package/dist/data_import/components/ImportFileUpload.js.map +1 -0
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js +42 -0
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js.map +1 -0
- package/dist/data_import/components/ImportSaveInProgress.js +105 -0
- package/dist/data_import/components/ImportSaveInProgress.js.map +1 -0
- package/dist/data_import/hooks/useImportConfig.js +34 -0
- package/dist/data_import/hooks/useImportConfig.js.map +1 -0
- package/dist/{import-DjQoRrIU.js → data_import/import/ImportCollectionAction.js} +53 -43
- package/dist/data_import/import/ImportCollectionAction.js.map +1 -0
- package/dist/data_import/import/index.js +2 -0
- package/dist/data_import/utils/csv.js +146 -0
- package/dist/data_import/utils/csv.js.map +1 -0
- package/dist/data_import/utils/data.js +366 -0
- package/dist/data_import/utils/data.js.map +1 -0
- package/dist/data_import/utils/file_headers.js +32 -0
- package/dist/data_import/utils/file_headers.js.map +1 -0
- package/dist/data_import/utils/file_to_json.js +149 -0
- package/dist/data_import/utils/file_to_json.js.map +1 -0
- package/dist/data_import/utils/get_import_inference_type.js +14 -0
- package/dist/data_import/utils/get_import_inference_type.js.map +1 -0
- package/dist/data_import/utils/id_column.js +27 -0
- package/dist/data_import/utils/id_column.js.map +1 -0
- package/dist/data_import/utils/import_columns.js +92 -0
- package/dist/data_import/utils/import_columns.js.map +1 -0
- package/dist/data_import/utils/save_entities.d.ts +33 -4
- package/dist/data_import/utils/save_entities.js +244 -0
- package/dist/data_import/utils/save_entities.js.map +1 -0
- package/dist/data_import/utils/transforms.js +83 -0
- package/dist/data_import/utils/transforms.js.map +1 -0
- package/dist/editor/components/SlashCommandMenu.js +497 -0
- package/dist/editor/components/SlashCommandMenu.js.map +1 -0
- package/dist/editor/components/editor-bubble-item.js +24 -0
- package/dist/editor/components/editor-bubble-item.js.map +1 -0
- package/dist/editor/components/editor-bubble.js +97 -0
- package/dist/editor/components/editor-bubble.js.map +1 -0
- package/dist/editor/components/image-bubble.js +148 -0
- package/dist/editor/components/image-bubble.js.map +1 -0
- package/dist/editor/components/table-bubble.js +406 -0
- package/dist/editor/components/table-bubble.js.map +1 -0
- package/dist/editor/editor.js +423 -0
- package/dist/editor/editor.js.map +1 -0
- package/dist/editor/extensions/HighlightDecorationExtension.js +74 -0
- package/dist/editor/extensions/HighlightDecorationExtension.js.map +1 -0
- package/dist/editor/extensions/Image.d.ts +7 -1
- package/dist/editor/extensions/Image.js +160 -0
- package/dist/editor/extensions/Image.js.map +1 -0
- package/dist/editor/extensions/TextLoadingDecorationExtension.js +82 -0
- package/dist/editor/extensions/TextLoadingDecorationExtension.js.map +1 -0
- package/dist/editor/extensions/clipboard.js +63 -0
- package/dist/editor/extensions/clipboard.js.map +1 -0
- package/dist/editor/extensions/drag-and-drop.js +354 -0
- package/dist/editor/extensions/drag-and-drop.js.map +1 -0
- package/dist/editor/hooks/useProseMirror.js +101 -0
- package/dist/editor/hooks/useProseMirror.js.map +1 -0
- package/dist/editor/hooks/useProseMirrorContext.js +11 -0
- package/dist/editor/hooks/useProseMirrorContext.js.map +1 -0
- package/dist/editor/markdown.js +154 -0
- package/dist/editor/markdown.js.map +1 -0
- package/dist/editor/nodeViews/ImageComponent.js +35 -0
- package/dist/editor/nodeViews/ImageComponent.js.map +1 -0
- package/dist/editor/nodeViews/ReactNodeView.js +57 -0
- package/dist/editor/nodeViews/ReactNodeView.js.map +1 -0
- package/dist/editor/nodeViews/TaskItemComponent.js +29 -0
- package/dist/editor/nodeViews/TaskItemComponent.js.map +1 -0
- package/dist/editor/nodeViews/index.js +21 -0
- package/dist/editor/nodeViews/index.js.map +1 -0
- package/dist/editor/plugins/index.js +54 -0
- package/dist/editor/plugins/index.js.map +1 -0
- package/dist/editor/plugins/inputrules.js +54 -0
- package/dist/editor/plugins/inputrules.js.map +1 -0
- package/dist/editor/plugins/placeholderPlugin.js +38 -0
- package/dist/editor/plugins/placeholderPlugin.js.map +1 -0
- package/dist/editor/plugins/slashCommandPlugin.js +40 -0
- package/dist/editor/plugins/slashCommandPlugin.js.map +1 -0
- package/dist/editor/sanitize-html.js +190 -0
- package/dist/editor/sanitize-html.js.map +1 -0
- package/dist/{markdown-CCqp8ibf.js → editor/schema.js} +2 -159
- package/dist/editor/schema.js.map +1 -0
- package/dist/editor/selectors/link-selector.js +118 -0
- package/dist/editor/selectors/link-selector.js.map +1 -0
- package/dist/editor/selectors/node-selector.js +118 -0
- package/dist/editor/selectors/node-selector.js.map +1 -0
- package/dist/editor/selectors/text-buttons.js +71 -0
- package/dist/editor/selectors/text-buttons.js.map +1 -0
- package/dist/editor/utils/prosemirror-utils.js +92 -0
- package/dist/editor/utils/prosemirror-utils.js.map +1 -0
- package/dist/editor/utils/remove_classes.js +16 -0
- package/dist/editor/utils/remove_classes.js.map +1 -0
- package/dist/editor.js +1 -3147
- package/dist/form/EntityForm.js +734 -0
- package/dist/form/EntityForm.js.map +1 -0
- package/dist/form/EntityFormActions.js +101 -0
- package/dist/form/EntityFormActions.js.map +1 -0
- package/dist/form/EntityFormBinding.js +256 -0
- package/dist/form/EntityFormBinding.js.map +1 -0
- package/dist/form/PropertyFieldBinding.js +298 -0
- package/dist/form/PropertyFieldBinding.js.map +1 -0
- package/dist/form/components/ErrorFocus.js +33 -0
- package/dist/form/components/ErrorFocus.js.map +1 -0
- package/dist/form/components/FieldBlock.js +118 -0
- package/dist/form/components/FieldBlock.js.map +1 -0
- package/dist/form/components/FieldHelperText.js +56 -0
- package/dist/form/components/FieldHelperText.js.map +1 -0
- package/dist/form/components/FormRail.js +118 -0
- package/dist/form/components/FormRail.js.map +1 -0
- package/dist/form/components/FormSections.js +63 -0
- package/dist/form/components/FormSections.js.map +1 -0
- package/dist/form/components/LabelWithIcon.js +29 -0
- package/dist/form/components/LabelWithIcon.js.map +1 -0
- package/dist/form/components/LocalChangesMenu.js +127 -0
- package/dist/form/components/LocalChangesMenu.js.map +1 -0
- package/dist/form/components/StorageItemPreview.js +46 -0
- package/dist/form/components/StorageItemPreview.js.map +1 -0
- package/dist/form/components/StorageUploadProgress.js +84 -0
- package/dist/form/components/StorageUploadProgress.js.map +1 -0
- package/dist/form/components/useRailVisible.js +43 -0
- package/dist/form/components/useRailVisible.js.map +1 -0
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js +84 -0
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +125 -0
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/BinaryFieldBinding.js +135 -0
- package/dist/form/field_bindings/BinaryFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/BlockFieldBinding.js +164 -0
- package/dist/form/field_bindings/BlockFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/DateTimeFieldBinding.js +47 -0
- package/dist/form/field_bindings/DateTimeFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/GeopointFieldBinding.js +148 -0
- package/dist/form/field_bindings/GeopointFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.js +450 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MapFieldBinding.js +77 -0
- package/dist/form/field_bindings/MapFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +215 -0
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MultiSelectFieldBinding.js +88 -0
- package/dist/form/field_bindings/MultiSelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js +118 -0
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js +52 -0
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ReferenceFieldBinding.js +99 -0
- package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/RelationFieldBinding.js +135 -0
- package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/RepeatFieldBinding.js +103 -0
- package/dist/form/field_bindings/RepeatFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/SelectFieldBinding.js +80 -0
- package/dist/form/field_bindings/SelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/StorageUploadFieldBinding.js +266 -0
- package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/SwitchFieldBinding.js +41 -0
- package/dist/form/field_bindings/SwitchFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/TextFieldBinding.js +114 -0
- package/dist/form/field_bindings/TextFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/UserSelectFieldBinding.js +48 -0
- package/dist/form/field_bindings/UserSelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/VectorFieldBinding.js +147 -0
- package/dist/form/field_bindings/VectorFieldBinding.js.map +1 -0
- package/dist/form/form_keyboard_scope.d.ts +26 -0
- package/dist/form/form_keyboard_scope.js +39 -0
- package/dist/form/form_keyboard_scope.js.map +1 -0
- package/dist/form/form_uploads.d.ts +24 -0
- package/dist/form/form_uploads.js +31 -0
- package/dist/form/form_uploads.js.map +1 -0
- package/dist/form/form_utils.d.ts +24 -0
- package/dist/form/form_utils.js +280 -0
- package/dist/form/form_utils.js.map +1 -0
- package/dist/form/resolve_cell_property.d.ts +32 -0
- package/dist/form/resolve_cell_property.js +80 -0
- package/dist/form/resolve_cell_property.js.map +1 -0
- package/dist/form/resolve_form_properties.d.ts +2 -1
- package/dist/form/resolve_form_properties.js +78 -0
- package/dist/form/resolve_form_properties.js.map +1 -0
- package/dist/form/useClearRestoreValue.js +27 -0
- package/dist/form/useClearRestoreValue.js.map +1 -0
- package/dist/form/useUndoableDiscard.js +36 -0
- package/dist/form/useUndoableDiscard.js.map +1 -0
- package/dist/form/validation.d.ts +20 -0
- package/dist/form/validation.js +416 -0
- package/dist/form/validation.js.map +1 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js +22 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js.map +1 -0
- package/dist/hooks/navigation/contexts/NavigationStateContext.js +15 -0
- package/dist/hooks/navigation/contexts/NavigationStateContext.js.map +1 -0
- package/dist/hooks/navigation/contexts/UrlContext.js +22 -0
- package/dist/hooks/navigation/contexts/UrlContext.js.map +1 -0
- package/dist/hooks/navigation/useAsyncResolver.js +68 -0
- package/dist/hooks/navigation/useAsyncResolver.js.map +1 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js +141 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js.map +1 -0
- package/dist/hooks/navigation/useBuildNavigationStateController.js +77 -0
- package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -0
- package/dist/hooks/navigation/useBuildUrlController.js +57 -0
- package/dist/hooks/navigation/useBuildUrlController.js.map +1 -0
- package/dist/hooks/navigation/useNavigationResolution.js +177 -0
- package/dist/hooks/navigation/useNavigationResolution.js.map +1 -0
- package/dist/hooks/navigation/useResolvedCollections.js +56 -0
- package/dist/hooks/navigation/useResolvedCollections.js.map +1 -0
- package/dist/hooks/navigation/useResolvedViews.js +94 -0
- package/dist/hooks/navigation/useResolvedViews.js.map +1 -0
- package/dist/hooks/navigation/useTopLevelNavigation.js +162 -0
- package/dist/hooks/navigation/useTopLevelNavigation.js.map +1 -0
- package/dist/hooks/navigation/utils.js +125 -0
- package/dist/hooks/navigation/utils.js.map +1 -0
- package/dist/hooks/useAdminContext.js +45 -0
- package/dist/hooks/useAdminContext.js.map +1 -0
- package/dist/hooks/useBreadcrumbsController.js +17 -0
- package/dist/hooks/useBreadcrumbsController.js.map +1 -0
- package/dist/hooks/useBuildSideDialogsController.js +96 -0
- package/dist/hooks/useBuildSideDialogsController.js.map +1 -0
- package/dist/hooks/useBuildSidePanel.js +221 -0
- package/dist/hooks/useBuildSidePanel.js.map +1 -0
- package/dist/hooks/useChildViewSource.js +41 -0
- package/dist/hooks/useChildViewSource.js.map +1 -0
- package/dist/hooks/useEntityDisplay.js +136 -0
- package/dist/hooks/useEntityDisplay.js.map +1 -0
- package/dist/hooks/useEntityDisplayTitle.js +34 -0
- package/dist/hooks/useEntityDisplayTitle.js.map +1 -0
- package/dist/hooks/useHistory.js +137 -0
- package/dist/hooks/useHistory.js.map +1 -0
- package/dist/hooks/useRecordActions.js +108 -0
- package/dist/hooks/useRecordActions.js.map +1 -0
- package/dist/hooks/useReferencePaths.js +32 -0
- package/dist/hooks/useReferencePaths.js.map +1 -0
- package/dist/hooks/useResolvedNavigationFrom.js +83 -0
- package/dist/hooks/useResolvedNavigationFrom.js.map +1 -0
- package/dist/hooks/useResolvedUsers.js +109 -0
- package/dist/hooks/useResolvedUsers.js.map +1 -0
- package/dist/hooks/useSelectionDialog.js +53 -0
- package/dist/hooks/useSelectionDialog.js.map +1 -0
- package/dist/hooks/useSideDialogsController.js +8 -0
- package/dist/hooks/useSideDialogsController.js.map +1 -0
- package/dist/hooks/useSidePanel.js +15 -0
- package/dist/hooks/useSidePanel.js.map +1 -0
- package/dist/hooks/useStorageReferenceResolver.d.ts +4 -2
- package/dist/hooks/useStorageReferenceResolver.js +49 -0
- package/dist/hooks/useStorageReferenceResolver.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +151 -3867
- package/dist/preview/PropertyPreview.js +260 -0
- package/dist/preview/PropertyPreview.js.map +1 -0
- package/dist/preview/compact_text.js +52 -0
- package/dist/preview/compact_text.js.map +1 -0
- package/dist/preview/components/ArrayEnumPreview.js +24 -0
- package/dist/preview/components/ArrayEnumPreview.js.map +1 -0
- package/dist/preview/components/BooleanPreview.js +25 -0
- package/dist/preview/components/BooleanPreview.js.map +1 -0
- package/dist/preview/components/DatePreview.d.ts +3 -2
- package/dist/preview/components/DatePreview.js +87 -0
- package/dist/preview/components/DatePreview.js.map +1 -0
- package/dist/preview/components/EmptyValue.js +13 -0
- package/dist/preview/components/EmptyValue.js.map +1 -0
- package/dist/preview/components/EnumValuesChip.js +26 -0
- package/dist/preview/components/EnumValuesChip.js.map +1 -0
- package/dist/preview/components/ImagePreview.d.ts +7 -1
- package/dist/preview/components/ImagePreview.js +112 -0
- package/dist/preview/components/ImagePreview.js.map +1 -0
- package/dist/preview/components/InlineEntityListPreview.js +31 -0
- package/dist/preview/components/InlineEntityListPreview.js.map +1 -0
- package/dist/preview/components/ReferencePreview.js +162 -0
- package/dist/preview/components/ReferencePreview.js.map +1 -0
- package/dist/preview/components/RelationPreview.js +196 -0
- package/dist/preview/components/RelationPreview.js.map +1 -0
- package/dist/preview/components/StorageMarkdown.d.ts +2 -1
- package/dist/preview/components/StorageMarkdown.js +49 -0
- package/dist/preview/components/StorageMarkdown.js.map +1 -0
- package/dist/preview/components/StorageThumbnail.js +183 -0
- package/dist/preview/components/StorageThumbnail.js.map +1 -0
- package/dist/preview/components/UrlComponentPreview.d.ts +3 -1
- package/dist/preview/components/UrlComponentPreview.js +88 -0
- package/dist/preview/components/UrlComponentPreview.js.map +1 -0
- package/dist/preview/components/UserPreview.js +30 -0
- package/dist/preview/components/UserPreview.js.map +1 -0
- package/dist/preview/components/date_fns_locales.js +124 -0
- package/dist/preview/components/date_fns_locales.js.map +1 -0
- package/dist/preview/components/storageRenditions.d.ts +10 -0
- package/dist/preview/components/storageRenditions.js +93 -0
- package/dist/preview/components/storageRenditions.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfMapsPreview.js +44 -0
- package/dist/preview/property_previews/ArrayOfMapsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js +48 -0
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js +50 -0
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js +30 -0
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfStringsPreview.js +42 -0
- package/dist/preview/property_previews/ArrayOfStringsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOneOfPreview.js +47 -0
- package/dist/preview/property_previews/ArrayOneOfPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js +25 -0
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayPropertyPreview.js +48 -0
- package/dist/preview/property_previews/ArrayPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/MapPropertyPreview.js +137 -0
- package/dist/preview/property_previews/MapPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/NumberPropertyPreview.js +34 -0
- package/dist/preview/property_previews/NumberPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/SkeletonPropertyComponent.js +151 -0
- package/dist/preview/property_previews/SkeletonPropertyComponent.js.map +1 -0
- package/dist/preview/property_previews/StringPropertyPreview.js +49 -0
- package/dist/preview/property_previews/StringPropertyPreview.js.map +1 -0
- package/dist/preview/util.d.ts +4 -3
- package/dist/{util-D7ebttKT.js → preview/util.js} +8 -5
- package/dist/preview/util.js.map +1 -0
- package/dist/routes/CustomViewRoute.js +26 -0
- package/dist/routes/CustomViewRoute.js.map +1 -0
- package/dist/routes/RebaseRoute.js +311 -0
- package/dist/routes/RebaseRoute.js.map +1 -0
- package/dist/selection/SelectionMenu.js +90 -0
- package/dist/selection/SelectionMenu.js.map +1 -0
- package/dist/selection/resolve_selection.js +79 -0
- package/dist/selection/resolve_selection.js.map +1 -0
- package/dist/util/caller_scopes.js +25 -0
- package/dist/util/caller_scopes.js.map +1 -0
- package/dist/util/collection_open_mode.d.ts +20 -0
- package/dist/util/collection_open_mode.js +32 -0
- package/dist/util/collection_open_mode.js.map +1 -0
- package/dist/util/dataControllerAdapter.js +65 -0
- package/dist/util/dataControllerAdapter.js.map +1 -0
- package/dist/util/entity_actions.d.ts +5 -0
- package/dist/util/entity_actions.js +77 -0
- package/dist/util/entity_actions.js.map +1 -0
- package/dist/util/entity_pages.d.ts +37 -3
- package/dist/util/entity_pages.js +71 -0
- package/dist/util/entity_pages.js.map +1 -0
- package/dist/util/find_entities_by_ids.d.ts +23 -0
- package/dist/util/find_entities_by_ids.js +55 -0
- package/dist/util/find_entities_by_ids.js.map +1 -0
- package/dist/util/fit_inline_actions.js +40 -0
- package/dist/util/fit_inline_actions.js.map +1 -0
- package/dist/util/format_collection_date.d.ts +29 -0
- package/dist/util/format_collection_date.js +60 -0
- package/dist/util/format_collection_date.js.map +1 -0
- package/dist/util/map_with_concurrency.js +46 -0
- package/dist/util/map_with_concurrency.js.map +1 -0
- package/dist/util/navigation_utils.js +45 -0
- package/dist/util/navigation_utils.js.map +1 -0
- package/dist/util/number_format.js +33 -0
- package/dist/util/number_format.js.map +1 -0
- package/dist/util/previews.js +71 -0
- package/dist/util/previews.js.map +1 -0
- package/dist/util/propertyConfigMapper.js +83 -0
- package/dist/util/propertyConfigMapper.js.map +1 -0
- package/dist/util/property_utils.js +141 -0
- package/dist/util/property_utils.js.map +1 -0
- package/dist/util/resolutions.js +55 -0
- package/dist/util/resolutions.js.map +1 -0
- package/dist/util/view_constants.js +35 -0
- package/dist/util/view_constants.js.map +1 -0
- package/dist/util/view_mode.js +112 -0
- package/dist/util/view_mode.js.map +1 -0
- package/package.json +13 -9
- package/dist/CollectionEditorDialog-p5-I-Apu.js +0 -3669
- package/dist/CollectionEditorDialog-p5-I-Apu.js.map +0 -1
- package/dist/JsonPreviewBinding-v0w3H0fp.js.map +0 -1
- package/dist/PropertyEditView-DDB_X-00.js +0 -3837
- package/dist/PropertyEditView-DDB_X-00.js.map +0 -1
- package/dist/RouterCollectionsStudioView-SGBV4CMg.js +0 -212
- package/dist/RouterCollectionsStudioView-SGBV4CMg.js.map +0 -1
- package/dist/SchemaChangeDialog-CcFSXvkK.js.map +0 -1
- package/dist/collection_editor/ui/CollectionViewHeaderAction.d.ts +0 -13
- package/dist/collection_editor/ui/PropertyAddColumnComponent.d.ts +0 -8
- package/dist/collection_editor_ui.js.map +0 -1
- package/dist/editor.js.map +0 -1
- package/dist/export-DCHuPD1a.js +0 -520
- package/dist/export-DCHuPD1a.js.map +0 -1
- package/dist/history-CBd6SBRs.js +0 -314
- package/dist/history-CBd6SBRs.js.map +0 -1
- package/dist/import-DjQoRrIU.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/markdown-CCqp8ibf.js.map +0 -1
- package/dist/rolldown-runtime-D7D4PA-g.js +0 -13
- package/dist/util-BRvKFMLa.js +0 -27773
- package/dist/util-BRvKFMLa.js.map +0 -1
- package/dist/util-D7ebttKT.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UrlContext.js","names":[],"sources":["../../../../src/hooks/navigation/contexts/UrlContext.tsx"],"sourcesContent":["import type { UrlController } from \"@rebasepro/cms-types\";\nimport React, { createContext } from \"react\";\n\n\n\nexport const UrlContext = createContext<UrlController>({\n basePath: \"/\",\n baseCollectionPath: \"/c\",\n urlPathToDataPath: () => \"\",\n homeUrl: \"/\",\n isUrlCollectionPath: () => false,\n buildUrlCollectionPath: () => \"\",\n buildAppUrlPath: () => \"\",\n resolveDatabasePathsFrom: () => \"\",\n navigate: () => { }\n});\n\nexport function useUrlController(): UrlController {\n const context = React.useContext(UrlContext);\n if (context === undefined) {\n throw new Error(\"useUrlController must be used within a UrlContext.Provider\");\n }\n return context;\n}\n"],"mappings":";;AAKA,IAAa,aAAa,cAA6B;CACnD,UAAU;CACV,oBAAoB;CACpB,yBAAyB;CACzB,SAAS;CACT,2BAA2B;CAC3B,8BAA8B;CAC9B,uBAAuB;CACvB,gCAAgC;CAChC,gBAAgB,CAAE;AACtB,CAAC;AAED,SAAgB,mBAAkC;CAC9C,MAAM,UAAU,MAAM,WAAW,UAAU;CAC3C,IAAI,YAAY,KAAA,GACZ,MAAM,IAAI,MAAM,4DAA4D;CAEhF,OAAO;AACX"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
//#region src/hooks/navigation/useAsyncResolver.ts
|
|
3
|
+
/**
|
|
4
|
+
* Generic hook that resolves an async value with loading/error/refresh
|
|
5
|
+
* state management, cancellation on unmount or deps change, and
|
|
6
|
+
* ref-based change detection to prevent unnecessary state updates.
|
|
7
|
+
*
|
|
8
|
+
* Extracted from the common pattern in useResolvedCollections and
|
|
9
|
+
* useResolvedViews.
|
|
10
|
+
*/
|
|
11
|
+
function useAsyncResolver({ resolver, initialValue, isEqual, deps, disabled }) {
|
|
12
|
+
const [data, setData] = useState(initialValue);
|
|
13
|
+
const [loading, setLoading] = useState(true);
|
|
14
|
+
const [error, setError] = useState(void 0);
|
|
15
|
+
const [refreshTrigger, setRefreshTrigger] = useState(0);
|
|
16
|
+
const refresh = useCallback(() => {
|
|
17
|
+
setRefreshTrigger((prev) => prev + 1);
|
|
18
|
+
}, []);
|
|
19
|
+
const dataRef = useRef(initialValue);
|
|
20
|
+
const resolverRef = useRef(resolver);
|
|
21
|
+
resolverRef.current = resolver;
|
|
22
|
+
const isEqualRef = useRef(isEqual);
|
|
23
|
+
isEqualRef.current = isEqual;
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (disabled) return;
|
|
26
|
+
let cancelled = false;
|
|
27
|
+
(async () => {
|
|
28
|
+
try {
|
|
29
|
+
const result = await resolverRef.current();
|
|
30
|
+
if (cancelled) return;
|
|
31
|
+
if (!isEqualRef.current(dataRef.current, result)) {
|
|
32
|
+
dataRef.current = result;
|
|
33
|
+
setData(result);
|
|
34
|
+
}
|
|
35
|
+
setError(void 0);
|
|
36
|
+
} catch (e) {
|
|
37
|
+
if (!cancelled) {
|
|
38
|
+
console.error(e);
|
|
39
|
+
setError(e);
|
|
40
|
+
}
|
|
41
|
+
} finally {
|
|
42
|
+
if (!cancelled) setLoading(false);
|
|
43
|
+
}
|
|
44
|
+
})();
|
|
45
|
+
return () => {
|
|
46
|
+
cancelled = true;
|
|
47
|
+
};
|
|
48
|
+
}, [
|
|
49
|
+
...deps,
|
|
50
|
+
refreshTrigger,
|
|
51
|
+
disabled
|
|
52
|
+
]);
|
|
53
|
+
return useMemo(() => ({
|
|
54
|
+
data,
|
|
55
|
+
loading,
|
|
56
|
+
error,
|
|
57
|
+
refresh
|
|
58
|
+
}), [
|
|
59
|
+
data,
|
|
60
|
+
loading,
|
|
61
|
+
error,
|
|
62
|
+
refresh
|
|
63
|
+
]);
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
export { useAsyncResolver };
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=useAsyncResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAsyncResolver.js","names":[],"sources":["../../../src/hooks/navigation/useAsyncResolver.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState, useMemo } from \"react\";\n\nexport type UseAsyncResolverResult<T> = {\n data: T;\n loading: boolean;\n error: Error | undefined;\n refresh: () => void;\n};\n\n/**\n * Generic hook that resolves an async value with loading/error/refresh\n * state management, cancellation on unmount or deps change, and\n * ref-based change detection to prevent unnecessary state updates.\n *\n * Extracted from the common pattern in useResolvedCollections and\n * useResolvedViews.\n */\nexport function useAsyncResolver<T>({\n resolver,\n initialValue,\n isEqual,\n deps,\n disabled,\n}: {\n /** Async function that resolves the data */\n resolver: () => Promise<T>;\n /** Initial value before first resolution */\n initialValue: T;\n /** Equality check to prevent unnecessary state updates */\n isEqual: (a: T, b: T) => boolean;\n /** Effect dependencies — when these change, resolver re-runs */\n deps: React.DependencyList;\n /** When true, skip resolution */\n disabled?: boolean;\n}): UseAsyncResolverResult<T> {\n\n const [data, setData] = useState<T>(initialValue);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | undefined>(undefined);\n const [refreshTrigger, setRefreshTrigger] = useState(0);\n\n const refresh = useCallback(() => {\n setRefreshTrigger(prev => prev + 1);\n }, []);\n\n // Ref for change detection — avoids state updates when data hasn't changed\n const dataRef = useRef<T>(initialValue);\n\n // Store resolver in a ref so we always call the latest version\n // without adding it to effect deps (it's typically a new closure each render)\n const resolverRef = useRef(resolver);\n resolverRef.current = resolver;\n\n // Same for isEqual\n const isEqualRef = useRef(isEqual);\n isEqualRef.current = isEqual;\n\n useEffect(() => {\n if (disabled) return;\n\n let cancelled = false;\n\n (async () => {\n try {\n const result = await resolverRef.current();\n\n if (cancelled) return;\n\n // Only update state if data actually changed\n if (!isEqualRef.current(dataRef.current, result)) {\n dataRef.current = result;\n setData(result);\n }\n\n setError(undefined);\n } catch (e) {\n if (!cancelled) {\n console.error(e);\n setError(e as Error);\n }\n } finally {\n if (!cancelled) {\n setLoading(false);\n }\n }\n })();\n\n return () => {\n cancelled = true;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [...deps, refreshTrigger, disabled]);\n\n return useMemo(() => ({\n data,\n loading,\n error,\n refresh\n }), [data, loading, error, refresh]);\n}\n"],"mappings":";;;;;;;;;;AAiBA,SAAgB,iBAAoB,EAChC,UACA,cACA,SACA,MACA,YAY0B;CAE1B,MAAM,CAAC,MAAM,WAAW,SAAY,YAAY;CAChD,MAAM,CAAC,SAAS,cAAc,SAAS,IAAI;CAC3C,MAAM,CAAC,OAAO,YAAY,SAA4B,KAAA,CAAS;CAC/D,MAAM,CAAC,gBAAgB,qBAAqB,SAAS,CAAC;CAEtD,MAAM,UAAU,kBAAkB;EAC9B,mBAAkB,SAAQ,OAAO,CAAC;CACtC,GAAG,CAAC,CAAC;CAGL,MAAM,UAAU,OAAU,YAAY;CAItC,MAAM,cAAc,OAAO,QAAQ;CACnC,YAAY,UAAU;CAGtB,MAAM,aAAa,OAAO,OAAO;CACjC,WAAW,UAAU;CAErB,gBAAgB;EACZ,IAAI,UAAU;EAEd,IAAI,YAAY;EAEhB,CAAC,YAAY;GACT,IAAI;IACA,MAAM,SAAS,MAAM,YAAY,QAAQ;IAEzC,IAAI,WAAW;IAGf,IAAI,CAAC,WAAW,QAAQ,QAAQ,SAAS,MAAM,GAAG;KAC9C,QAAQ,UAAU;KAClB,QAAQ,MAAM;IAClB;IAEA,SAAS,KAAA,CAAS;GACtB,SAAS,GAAG;IACR,IAAI,CAAC,WAAW;KACZ,QAAQ,MAAM,CAAC;KACf,SAAS,CAAU;IACvB;GACJ,UAAU;IACN,IAAI,CAAC,WACD,WAAW,KAAK;GAExB;EACJ,EAAA,CAAG;EAEH,aAAa;GACT,YAAY;EAChB;CAEJ,GAAG;EAAC,GAAG;EAAM;EAAgB;CAAQ,CAAC;CAEtC,OAAO,eAAe;EAClB;EACA;EACA;EACA;CACJ,IAAI;EAAC;EAAM;EAAS;EAAO;CAAO,CAAC;AACvC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { CollectionRegistry, getSubcollections } from "@rebasepro/common";
|
|
3
|
+
import { getParentReferencesFromPath, removeInitialAndTrailingSlashes } from "@rebasepro/app";
|
|
4
|
+
import { mergeDeep } from "@rebasepro/utils";
|
|
5
|
+
import { resolveAdminCollection } from "@rebasepro/cms-types";
|
|
6
|
+
//#region src/hooks/navigation/useBuildCollectionRegistryController.tsx
|
|
7
|
+
function useBuildCollectionRegistryController(props) {
|
|
8
|
+
const { userConfigPersistence, dataSources } = props;
|
|
9
|
+
const collectionRegistryRef = useRef(new CollectionRegistry(void 0, dataSources));
|
|
10
|
+
if (dataSources) collectionRegistryRef.current.setDataSources(dataSources);
|
|
11
|
+
const [initialised, setInitialised] = useState(false);
|
|
12
|
+
const getCollection = useCallback((slugOrPath, includeUserOverride = false) => {
|
|
13
|
+
const registry = collectionRegistryRef.current;
|
|
14
|
+
const cleanedPath = removeInitialAndTrailingSlashes(slugOrPath);
|
|
15
|
+
if (!cleanedPath) return void 0;
|
|
16
|
+
let collection;
|
|
17
|
+
try {
|
|
18
|
+
collection = registry.resolvePathToCollections(cleanedPath, { allowRecordPath: true }).finalCollection;
|
|
19
|
+
} catch (e) {
|
|
20
|
+
console.warn(`[rebase] Could not resolve a collection for "${cleanedPath}"`, e);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const userOverride = includeUserOverride ? userConfigPersistence?.getCollectionConfig(slugOrPath) : void 0;
|
|
24
|
+
const overriddenCollection = collection ? mergeDeep(collection, userOverride ?? {}) : void 0;
|
|
25
|
+
if (!overriddenCollection) return void 0;
|
|
26
|
+
let result = overriddenCollection;
|
|
27
|
+
const subcollections = "subcollections" in overriddenCollection ? overriddenCollection.subcollections : void 0;
|
|
28
|
+
const callbacks = overriddenCollection.callbacks;
|
|
29
|
+
result = {
|
|
30
|
+
...result,
|
|
31
|
+
callbacks: result?.callbacks ?? callbacks
|
|
32
|
+
};
|
|
33
|
+
if (subcollections && "subcollections" in result) result.subcollections = result.subcollections ?? subcollections;
|
|
34
|
+
return resolveAdminCollection({
|
|
35
|
+
...overriddenCollection,
|
|
36
|
+
...result
|
|
37
|
+
});
|
|
38
|
+
}, [userConfigPersistence]);
|
|
39
|
+
const getRawCollection = useCallback((slugOrPath) => {
|
|
40
|
+
const registry = collectionRegistryRef.current;
|
|
41
|
+
if (registry === void 0) return void 0;
|
|
42
|
+
const cleanedPath = removeInitialAndTrailingSlashes(slugOrPath);
|
|
43
|
+
if (!cleanedPath) return void 0;
|
|
44
|
+
const pathSegments = cleanedPath.split("/");
|
|
45
|
+
return registry.getRaw(pathSegments.join("/"));
|
|
46
|
+
}, []);
|
|
47
|
+
const resolveDataPath = useCallback((path) => {
|
|
48
|
+
const cleanedPath = removeInitialAndTrailingSlashes(path);
|
|
49
|
+
const dataPath = cleanedPath ? collectionRegistryRef.current.resolveDataPath(cleanedPath) : cleanedPath;
|
|
50
|
+
return dataPath === cleanedPath ? path : dataPath;
|
|
51
|
+
}, []);
|
|
52
|
+
const resolveCollectionPath = useCallback((path, preferredDriver) => {
|
|
53
|
+
const cleanedPath = removeInitialAndTrailingSlashes(path);
|
|
54
|
+
const collectionPath = cleanedPath ? collectionRegistryRef.current.resolveCollectionPath(cleanedPath, preferredDriver) : cleanedPath;
|
|
55
|
+
return collectionPath === cleanedPath ? path : collectionPath;
|
|
56
|
+
}, []);
|
|
57
|
+
const getParentReferencesFromPath$1 = useCallback((path) => {
|
|
58
|
+
const registry = collectionRegistryRef.current;
|
|
59
|
+
if (!registry) return [];
|
|
60
|
+
return getParentReferencesFromPath({
|
|
61
|
+
path: removeInitialAndTrailingSlashes(path).split("/").join("/"),
|
|
62
|
+
collections: registry.getCollections()
|
|
63
|
+
});
|
|
64
|
+
}, []);
|
|
65
|
+
const getParentCollectionSlugs = useCallback((path) => {
|
|
66
|
+
const resolved = walkPath(collectionRegistryRef.current, path);
|
|
67
|
+
if (!resolved) return [];
|
|
68
|
+
return resolved.collections.slice(0, -1).map((collection) => collection.slug);
|
|
69
|
+
}, []);
|
|
70
|
+
const getParentEntityIds = useCallback((path) => {
|
|
71
|
+
const resolved = walkPath(collectionRegistryRef.current, path);
|
|
72
|
+
if (!resolved) return [];
|
|
73
|
+
const { collections, entityIds } = resolved;
|
|
74
|
+
return (entityIds.length === collections.length ? entityIds.slice(0, -1) : entityIds).map(String);
|
|
75
|
+
}, []);
|
|
76
|
+
const convertIdsToPaths = useCallback((ids) => {
|
|
77
|
+
const registry = collectionRegistryRef.current;
|
|
78
|
+
if (!registry) return [];
|
|
79
|
+
let currentCollections = registry.getCollections();
|
|
80
|
+
const paths = [];
|
|
81
|
+
for (let i = 0; i < ids.length; i++) {
|
|
82
|
+
const id = ids[i];
|
|
83
|
+
const collection = currentCollections.find((c) => c.slug === id);
|
|
84
|
+
if (!collection) throw Error(`Collection with id ${id} not found`);
|
|
85
|
+
paths.push(collection.slug);
|
|
86
|
+
currentCollections = getSubcollections(collection) ?? [];
|
|
87
|
+
}
|
|
88
|
+
return paths;
|
|
89
|
+
}, []);
|
|
90
|
+
const collections = collectionRegistryRef.current.getCollections().map(resolveAdminCollection);
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (!initialised && collections.length > 0) setInitialised(true);
|
|
93
|
+
}, [initialised, collections.length]);
|
|
94
|
+
return useMemo(() => ({
|
|
95
|
+
collections,
|
|
96
|
+
initialised,
|
|
97
|
+
getCollection,
|
|
98
|
+
getRawCollection,
|
|
99
|
+
resolveDataPath,
|
|
100
|
+
resolveCollectionPath,
|
|
101
|
+
getParentReferencesFromPath: getParentReferencesFromPath$1,
|
|
102
|
+
getParentCollectionSlugs,
|
|
103
|
+
getParentEntityIds,
|
|
104
|
+
convertIdsToPaths,
|
|
105
|
+
collectionRegistryRef
|
|
106
|
+
}), [
|
|
107
|
+
collections,
|
|
108
|
+
initialised,
|
|
109
|
+
getCollection,
|
|
110
|
+
getRawCollection,
|
|
111
|
+
resolveDataPath,
|
|
112
|
+
resolveCollectionPath,
|
|
113
|
+
getParentReferencesFromPath$1,
|
|
114
|
+
getParentCollectionSlugs,
|
|
115
|
+
getParentEntityIds,
|
|
116
|
+
convertIdsToPaths
|
|
117
|
+
]);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The collections and record ids a path runs through, whether it ends at a
|
|
121
|
+
* collection or at one of its records; `undefined` when the registry cannot
|
|
122
|
+
* walk it.
|
|
123
|
+
*
|
|
124
|
+
* A route to a record can also end in the tab it opens — `…/{id}/history`,
|
|
125
|
+
* `…/{id}/edit` — which is not a subcollection, and whose parents are the
|
|
126
|
+
* record's. So a path that does not walk is tried once more without its last
|
|
127
|
+
* segment.
|
|
128
|
+
*/
|
|
129
|
+
function walkPath(registry, path) {
|
|
130
|
+
const segments = removeInitialAndTrailingSlashes(path).split("/").filter(Boolean);
|
|
131
|
+
for (const candidate of [segments, segments.slice(0, -1)]) {
|
|
132
|
+
if (candidate.length === 0) continue;
|
|
133
|
+
try {
|
|
134
|
+
return registry.resolvePathToCollections(candidate.join("/"), { allowRecordPath: true });
|
|
135
|
+
} catch {}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
export { useBuildCollectionRegistryController };
|
|
140
|
+
|
|
141
|
+
//# sourceMappingURL=useBuildCollectionRegistryController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBuildCollectionRegistryController.js","names":[],"sources":["../../../src/hooks/navigation/useBuildCollectionRegistryController.tsx"],"sourcesContent":["import type { DataSourceDefinition } from \"@rebasepro/types\";\nimport { useCallback, useEffect, useRef, useState, useMemo } from \"react\";\nimport { CollectionRegistry, getSubcollections } from \"@rebasepro/common\";\nimport { getParentReferencesFromPath as commonGetParentReferencesFromPath, removeInitialAndTrailingSlashes } from \"@rebasepro/app\";\nimport { EntityReference, CollectionRegistryController } from \"@rebasepro/types\";\nimport { UserConfigurationPersistence, resolveAdminCollection, AdminCollection } from \"@rebasepro/cms-types\";\nimport { mergeDeep } from \"@rebasepro/utils\";\n\nexport function useBuildCollectionRegistryController(props: {\n userConfigPersistence?: UserConfigurationPersistence,\n dataSources?: Record<string, DataSourceDefinition>\n}): CollectionRegistryController & {\n collectionRegistryRef: React.MutableRefObject<CollectionRegistry>;\n} {\n const { userConfigPersistence, dataSources } = props;\n const collectionRegistryRef = useRef<CollectionRegistry>(new CollectionRegistry(undefined, dataSources));\n // Keep the registry's data sources in sync (used to resolve engine during\n // normalization). Applied synchronously before the async registration\n // effect in useResolvedCollections runs.\n if (dataSources) collectionRegistryRef.current.setDataSources(dataSources);\n const [initialised, setInitialised] = useState(false);\n\n const getCollection = useCallback((\n slugOrPath: string,\n includeUserOverride = false\n ): AdminCollection | undefined => {\n\n const registry = collectionRegistryRef.current;\n\n const cleanedPath = removeInitialAndTrailingSlashes(slugOrPath);\n if (!cleanedPath) return undefined;\n\n let collection: AdminCollection | undefined;\n\n // A slug is allowed to contain slashes, and several drivers need it\n // to: a Firestore collection partitioned by locale is declared as\n // `content/de-DE/podcasts`, and that string is its *name*, not a path\n // to walk. Reading any `a/b/c` as collection/entity/subcollection looked\n // for a root collection called `content`, found none and threw, and the\n // view came out blank. Thirty-five collections in one app were\n // unreachable that way.\n //\n // Matching the whole path as a slug first fixed the collection itself\n // and nothing under it: `medico/v2.0.0/joints/j1/movements` is not a\n // slug either, so it went back to a walker starting from `medico`, and\n // the joint's tabs rendered empty. The registry now takes the longest\n // leading run of segments that names a collection as the root, and\n // pairs up what follows — which also decides whether the path ends at a\n // record. The segment count cannot: `content/podcasts` is two segments\n // and a collection, `content/de-DE/podcasts/abc123` four and a record.\n try {\n collection = registry.resolvePathToCollections(cleanedPath, { allowRecordPath: true }).finalCollection as AdminCollection;\n } catch (e) {\n // Warn, not debug. An unresolved collection ends as a route with\n // nothing in it, and at `debug` there was no way to tell that\n // from a collection that legitimately has no rows.\n console.warn(`[rebase] Could not resolve a collection for \"${cleanedPath}\"`, e);\n return undefined;\n }\n\n const userOverride = includeUserOverride ? userConfigPersistence?.getCollectionConfig(slugOrPath) : undefined;\n const overriddenCollection = collection ? mergeDeep(collection, userOverride ?? {}) : undefined;\n\n if (!overriddenCollection) return undefined;\n\n let result: Partial<AdminCollection> | undefined = overriddenCollection;\n const subcollections = \"subcollections\" in overriddenCollection ? overriddenCollection.subcollections : undefined;\n const callbacks = overriddenCollection.callbacks;\n result = {\n ...result,\n callbacks: result?.callbacks ?? callbacks\n };\n // Preserve subcollections if they exist\n if (subcollections && \"subcollections\" in result) {\n (result as Record<string, unknown>).subcollections = (result as Record<string, unknown>).subcollections ?? subcollections;\n }\n\n // Flatten the admin block: everything downstream of here is the panel's\n // view model, not the authoring shape. Applied after the user-override\n // merge so an override of a presentation field still wins.\n return resolveAdminCollection({ ...overriddenCollection,\n...result } as AdminCollection);\n\n }, [userConfigPersistence]);\n\n const getRawCollection = useCallback((slugOrPath: string): AdminCollection | undefined => {\n const registry = collectionRegistryRef.current;\n if (registry === undefined) return undefined;\n\n const cleanedPath = removeInitialAndTrailingSlashes(slugOrPath);\n if (!cleanedPath) return undefined;\n\n const pathSegments = cleanedPath.split(\"/\");\n\n return registry.getRaw(pathSegments.join(\"/\")) as AdminCollection | undefined;\n }, []);\n\n // Both hand a path back exactly as given when there is nothing to\n // translate, slashes and all: most collections are stored under their slug.\n const resolveDataPath = useCallback((path: string): string => {\n const cleanedPath = removeInitialAndTrailingSlashes(path);\n const dataPath = cleanedPath ? collectionRegistryRef.current.resolveDataPath(cleanedPath) : cleanedPath;\n return dataPath === cleanedPath ? path : dataPath;\n }, []);\n\n const resolveCollectionPath = useCallback((path: string, preferredDriver?: string): string => {\n const cleanedPath = removeInitialAndTrailingSlashes(path);\n const collectionPath = cleanedPath ? collectionRegistryRef.current.resolveCollectionPath(cleanedPath, preferredDriver) : cleanedPath;\n return collectionPath === cleanedPath ? path : collectionPath;\n }, []);\n\n const getParentReferencesFromPath = useCallback((path: string): EntityReference[] => {\n const registry = collectionRegistryRef.current;\n if (!registry) {\n return [];\n }\n const cleanedPath = removeInitialAndTrailingSlashes(path);\n const pathSegments = cleanedPath.split(\"/\");\n\n return commonGetParentReferencesFromPath({\n path: pathSegments.join(\"/\"),\n collections: registry.getCollections()\n });\n }, []);\n\n // Both read the registry's walk rather than taking alternate segments of\n // the path as collections and ids. Alternate segments only line up while no\n // slug contains a slash: they read `medico/v2.0.0/joints/j1/movements` as\n // having `v2.0.0` for a parent id and no parent collection at all.\n const getParentCollectionSlugs = useCallback((path: string): string[] => {\n const resolved = walkPath(collectionRegistryRef.current, path);\n if (!resolved) return [];\n // Every collection on the way down except the one the path addresses.\n return resolved.collections.slice(0, -1).map(collection => collection.slug);\n }, []);\n\n const getParentEntityIds = useCallback((path: string): string[] => {\n const resolved = walkPath(collectionRegistryRef.current, path);\n if (!resolved) return [];\n const { collections, entityIds } = resolved;\n // A path ending at a record has one id per collection, and the last is\n // the record itself rather than a parent of it.\n const parentIds = entityIds.length === collections.length ? entityIds.slice(0, -1) : entityIds;\n return parentIds.map(String);\n }, []);\n\n const convertIdsToPaths = useCallback((ids: string[]): string[] => {\n const registry = collectionRegistryRef.current;\n if (!registry) return [];\n let currentCollections: AdminCollection[] = registry.getCollections();\n const paths: string[] = [];\n for (let i = 0; i < ids.length; i++) {\n const id = ids[i];\n const collection: AdminCollection | undefined = currentCollections.find(c => c.slug === id);\n if (!collection)\n throw Error(`Collection with id ${id} not found`);\n paths.push(collection.slug);\n currentCollections = getSubcollections(collection) ?? [];\n }\n return paths;\n }, []);\n\n const collections = collectionRegistryRef.current.getCollections().map(resolveAdminCollection);\n\n // Determine initialised automatically based on whether collections exist,\n // though the NavigationStateController also plays a role in overall init\n useEffect(() => {\n if (!initialised && collections.length > 0) {\n setInitialised(true);\n }\n }, [initialised, collections.length]);\n\n return useMemo(() => ({\n collections,\n initialised,\n getCollection,\n getRawCollection,\n resolveDataPath,\n resolveCollectionPath,\n getParentReferencesFromPath,\n getParentCollectionSlugs,\n getParentEntityIds,\n convertIdsToPaths,\n collectionRegistryRef\n }), [\n collections,\n initialised,\n getCollection,\n getRawCollection,\n resolveDataPath,\n resolveCollectionPath,\n getParentReferencesFromPath,\n getParentCollectionSlugs,\n getParentEntityIds,\n convertIdsToPaths\n ]);\n}\n\n/**\n * The collections and record ids a path runs through, whether it ends at a\n * collection or at one of its records; `undefined` when the registry cannot\n * walk it.\n *\n * A route to a record can also end in the tab it opens — `…/{id}/history`,\n * `…/{id}/edit` — which is not a subcollection, and whose parents are the\n * record's. So a path that does not walk is tried once more without its last\n * segment.\n */\nfunction walkPath(registry: CollectionRegistry, path: string): ReturnType<CollectionRegistry[\"resolvePathToCollections\"]> | undefined {\n const segments = removeInitialAndTrailingSlashes(path).split(\"/\").filter(Boolean);\n for (const candidate of [segments, segments.slice(0, -1)]) {\n if (candidate.length === 0) continue;\n try {\n return registry.resolvePathToCollections(candidate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|
|
1
|
+
import { useResolvedCollections } from "./useResolvedCollections.js";
|
|
2
|
+
import { useResolvedViews } from "./useResolvedViews.js";
|
|
3
|
+
import { useTopLevelNavigation } from "./useTopLevelNavigation.js";
|
|
4
|
+
import { useCallback, useMemo, useRef } from "react";
|
|
5
|
+
//#region src/hooks/navigation/useBuildNavigationStateController.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Main hook that resolves collections, views, and admin views into a
|
|
8
|
+
* NavigationStateController. This is a thin composition of three focused hooks:
|
|
9
|
+
*
|
|
10
|
+
* - useResolvedCollections: resolves collection props and registers with CollectionRegistry
|
|
11
|
+
* - useResolvedViews: resolves view/admin view props
|
|
12
|
+
* - useTopLevelNavigation: computes the NavigationResult from resolved data
|
|
13
|
+
*
|
|
14
|
+
* The NavigationStateController type is preserved as a public API.
|
|
15
|
+
*/
|
|
16
|
+
function useBuildNavigationStateController(props) {
|
|
17
|
+
const { authController, collections: collectionsProp, views: viewsProp, adminViews: adminViewsProp, viewsOrder, plugins, data, disabled, navigationGroupMappings, collectionRegistryController, urlController, adminMode = "cms", effectiveRoleController } = props;
|
|
18
|
+
const { collections, loading: collectionsLoading, error: collectionsError, refresh: refreshCollections } = useResolvedCollections({
|
|
19
|
+
authController,
|
|
20
|
+
collections: collectionsProp,
|
|
21
|
+
data,
|
|
22
|
+
plugins,
|
|
23
|
+
disabled,
|
|
24
|
+
collectionRegistryController
|
|
25
|
+
});
|
|
26
|
+
const { views, adminViews, loading: viewsLoading, error: viewsError, refresh: refreshViews } = useResolvedViews({
|
|
27
|
+
authController,
|
|
28
|
+
views: viewsProp,
|
|
29
|
+
adminViews: adminViewsProp,
|
|
30
|
+
data,
|
|
31
|
+
plugins,
|
|
32
|
+
adminMode,
|
|
33
|
+
effectiveRoleController
|
|
34
|
+
});
|
|
35
|
+
const { topLevelNavigation } = useTopLevelNavigation({
|
|
36
|
+
collections,
|
|
37
|
+
views,
|
|
38
|
+
adminViews,
|
|
39
|
+
plugins,
|
|
40
|
+
navigationGroupMappings,
|
|
41
|
+
viewsOrder,
|
|
42
|
+
urlController,
|
|
43
|
+
adminMode,
|
|
44
|
+
collectionRegistryController
|
|
45
|
+
});
|
|
46
|
+
const pendingRefreshRef = useRef(false);
|
|
47
|
+
const refreshNavigation = useCallback(() => {
|
|
48
|
+
if (pendingRefreshRef.current) return;
|
|
49
|
+
pendingRefreshRef.current = true;
|
|
50
|
+
queueMicrotask(() => {
|
|
51
|
+
pendingRefreshRef.current = false;
|
|
52
|
+
refreshCollections();
|
|
53
|
+
refreshViews();
|
|
54
|
+
});
|
|
55
|
+
}, [refreshCollections, refreshViews]);
|
|
56
|
+
return useMemo(() => ({
|
|
57
|
+
views,
|
|
58
|
+
adminViews,
|
|
59
|
+
topLevelNavigation,
|
|
60
|
+
loading: collectionsLoading || viewsLoading,
|
|
61
|
+
navigationLoadingError: collectionsError ?? viewsError,
|
|
62
|
+
refreshNavigation
|
|
63
|
+
}), [
|
|
64
|
+
views,
|
|
65
|
+
adminViews,
|
|
66
|
+
topLevelNavigation,
|
|
67
|
+
collectionsLoading,
|
|
68
|
+
viewsLoading,
|
|
69
|
+
collectionsError,
|
|
70
|
+
viewsError,
|
|
71
|
+
refreshNavigation
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { useBuildNavigationStateController };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=useBuildNavigationStateController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBuildNavigationStateController.js","names":[],"sources":["../../../src/hooks/navigation/useBuildNavigationStateController.tsx"],"sourcesContent":["\nimport type { AppView, NavigationResult, RebasePlugin, NavigationStateController, UrlController, NavigationGroupMapping, AdminCollection } from \"@rebasepro/cms-types\";\nimport { useCallback, useMemo, useRef } from \"react\";\n\nimport { RebaseData, CollectionRegistryController, User } from \"@rebasepro/types\";\nimport { AuthController } from \"@rebasepro/cms-types\";\nimport type { EffectiveRoleController } from \"@rebasepro/types\";\nimport type { CollectionConfigsBuilder, AppViewsBuilder } from \"@rebasepro/cms-types\";\nimport { CollectionRegistry } from \"@rebasepro/common\";\n\nimport { useResolvedCollections } from \"./useResolvedCollections\";\nimport { useResolvedViews } from \"./useResolvedViews\";\nimport { useTopLevelNavigation } from \"./useTopLevelNavigation\";\n\nexport type BuildNavigationStateProps<EC extends AdminCollection, USER extends User> = {\n authController: AuthController<USER>;\n collections?: EC[] | CollectionConfigsBuilder<EC>;\n views?: AppView[] | AppViewsBuilder;\n adminViews?: AppView[] | AppViewsBuilder;\n data: RebaseData;\n plugins?: RebasePlugin[];\n navigationGroupMappings?: NavigationGroupMapping[];\n disabled?: boolean;\n viewsOrder?: string[];\n collectionRegistryController: CollectionRegistryController<EC> & { collectionRegistryRef: React.MutableRefObject<CollectionRegistry> };\n urlController: UrlController;\n adminMode?: \"cms\" | \"studio\";\n effectiveRoleController?: EffectiveRoleController;\n\n};\n\n/**\n * Main hook that resolves collections, views, and admin views into a\n * NavigationStateController. This is a thin composition of three focused hooks:\n *\n * - useResolvedCollections: resolves collection props and registers with CollectionRegistry\n * - useResolvedViews: resolves view/admin view props\n * - useTopLevelNavigation: computes the NavigationResult from resolved data\n *\n * The NavigationStateController type is preserved as a public API.\n */\nexport function useBuildNavigationStateController<EC extends AdminCollection, USER extends User>(\n props: BuildNavigationStateProps<EC, USER>\n): NavigationStateController {\n\n const {\n authController,\n collections: collectionsProp,\n views: viewsProp,\n adminViews: adminViewsProp,\n viewsOrder,\n plugins,\n data,\n disabled,\n navigationGroupMappings,\n collectionRegistryController,\n urlController,\n adminMode = \"cms\",\n effectiveRoleController\n } = props;\n\n const {\n collections,\n loading: collectionsLoading,\n error: collectionsError,\n refresh: refreshCollections\n } = useResolvedCollections({\n authController,\n collections: collectionsProp,\n data,\n plugins,\n disabled,\n collectionRegistryController\n });\n\n const {\n views,\n adminViews,\n loading: viewsLoading,\n error: viewsError,\n refresh: refreshViews\n } = useResolvedViews({\n authController,\n views: viewsProp,\n adminViews: adminViewsProp,\n data,\n plugins,\n adminMode,\n effectiveRoleController\n });\n\n // Step 3: Compute top-level navigation (pure derived state)\n const { topLevelNavigation } = useTopLevelNavigation({\n collections,\n views,\n adminViews,\n plugins,\n navigationGroupMappings,\n viewsOrder,\n urlController,\n adminMode,\n collectionRegistryController\n });\n\n // Expose a combined refresh function with microtask batching\n const pendingRefreshRef = useRef(false);\n const refreshNavigation = useCallback(() => {\n if (pendingRefreshRef.current) return;\n pendingRefreshRef.current = true;\n queueMicrotask(() => {\n pendingRefreshRef.current = false;\n refreshCollections();\n refreshViews();\n });\n }, [refreshCollections, refreshViews]);\n\n return useMemo(() => ({\n views,\n adminViews,\n topLevelNavigation,\n loading: collectionsLoading || viewsLoading,\n navigationLoadingError: collectionsError ?? viewsError,\n refreshNavigation\n }), [\n views,\n adminViews,\n topLevelNavigation,\n collectionsLoading,\n viewsLoading,\n collectionsError,\n viewsError,\n refreshNavigation\n ]);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAyCA,SAAgB,kCACZ,OACyB;CAEzB,MAAM,EACF,gBACA,aAAa,iBACb,OAAO,WACP,YAAY,gBACZ,YACA,SACA,MACA,UACA,yBACA,8BACA,eACA,YAAY,OACZ,4BACA;CAEJ,MAAM,EACF,aACA,SAAS,oBACT,OAAO,kBACP,SAAS,uBACT,uBAAuB;EACvB;EACA,aAAa;EACb;EACA;EACA;EACA;CACJ,CAAC;CAED,MAAM,EACF,OACA,YACA,SAAS,cACT,OAAO,YACP,SAAS,iBACT,iBAAiB;EACjB;EACA,OAAO;EACP,YAAY;EACZ;EACA;EACA;EACA;CACJ,CAAC;CAGD,MAAM,EAAE,uBAAuB,sBAAsB;EACjD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACJ,CAAC;CAGD,MAAM,oBAAoB,OAAO,KAAK;CACtC,MAAM,oBAAoB,kBAAkB;EACxC,IAAI,kBAAkB,SAAS;EAC/B,kBAAkB,UAAU;EAC5B,qBAAqB;GACjB,kBAAkB,UAAU;GAC5B,mBAAmB;GACnB,aAAa;EACjB,CAAC;CACL,GAAG,CAAC,oBAAoB,YAAY,CAAC;CAErC,OAAO,eAAe;EAClB;EACA;EACA;EACA,SAAS,sBAAsB;EAC/B,wBAAwB,oBAAoB;EAC5C;CACJ,IAAI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACJ,CAAC;AACL"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useCallback, useMemo } from "react";
|
|
2
|
+
import { removeInitialAndTrailingSlashes, resolveCollectionPathIds } from "@rebasepro/app";
|
|
3
|
+
import { useNavigate } from "react-router";
|
|
4
|
+
//#region src/hooks/navigation/useBuildUrlController.tsx
|
|
5
|
+
function useBuildUrlController(props) {
|
|
6
|
+
const { basePath, baseCollectionPath, collectionRegistryController } = props;
|
|
7
|
+
const navigate = useNavigate();
|
|
8
|
+
const homeUrl = basePath === "/" ? "/" : `/${removeInitialAndTrailingSlashes(basePath)}`;
|
|
9
|
+
const buildUrlCollectionPath = useCallback((path) => {
|
|
10
|
+
return (basePath === "/" ? `${baseCollectionPath}/${path}` : `${basePath}${baseCollectionPath}/${path}`).replace(/\/\//g, "/");
|
|
11
|
+
}, [basePath, baseCollectionPath]);
|
|
12
|
+
const buildAppUrlPath = useCallback((path) => {
|
|
13
|
+
return (basePath === "/" ? `/${path}` : `${basePath}/${path}`).replace(/\/\//g, "/");
|
|
14
|
+
}, [basePath]);
|
|
15
|
+
const urlPathToDataPath = useCallback((cmsPath) => {
|
|
16
|
+
let path = cmsPath;
|
|
17
|
+
if (basePath !== "/" && path.startsWith(basePath)) path = path.replace(basePath, "");
|
|
18
|
+
if (path.startsWith(baseCollectionPath)) path = path.replace(baseCollectionPath, "");
|
|
19
|
+
return removeInitialAndTrailingSlashes(path);
|
|
20
|
+
}, [basePath, baseCollectionPath]);
|
|
21
|
+
const isUrlCollectionPath = useCallback((urlPath) => {
|
|
22
|
+
let path = urlPath;
|
|
23
|
+
if (basePath !== "/" && path.startsWith(basePath)) path = path.replace(basePath, "");
|
|
24
|
+
return path === baseCollectionPath || path.startsWith(baseCollectionPath + "/");
|
|
25
|
+
}, [basePath, baseCollectionPath]);
|
|
26
|
+
const resolveDatabasePathsFrom = useCallback((path) => {
|
|
27
|
+
return resolveCollectionPathIds(path, collectionRegistryController.collections ?? []);
|
|
28
|
+
}, [collectionRegistryController]);
|
|
29
|
+
const navigateTo = useCallback((to, options) => {
|
|
30
|
+
navigate(to, options);
|
|
31
|
+
}, [navigate]);
|
|
32
|
+
return useMemo(() => ({
|
|
33
|
+
basePath,
|
|
34
|
+
baseCollectionPath,
|
|
35
|
+
urlPathToDataPath,
|
|
36
|
+
homeUrl,
|
|
37
|
+
isUrlCollectionPath,
|
|
38
|
+
buildUrlCollectionPath,
|
|
39
|
+
buildAppUrlPath,
|
|
40
|
+
resolveDatabasePathsFrom,
|
|
41
|
+
navigate: navigateTo
|
|
42
|
+
}), [
|
|
43
|
+
basePath,
|
|
44
|
+
baseCollectionPath,
|
|
45
|
+
urlPathToDataPath,
|
|
46
|
+
homeUrl,
|
|
47
|
+
isUrlCollectionPath,
|
|
48
|
+
buildUrlCollectionPath,
|
|
49
|
+
buildAppUrlPath,
|
|
50
|
+
resolveDatabasePathsFrom,
|
|
51
|
+
navigateTo
|
|
52
|
+
]);
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { useBuildUrlController };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=useBuildUrlController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBuildUrlController.js","names":[],"sources":["../../../src/hooks/navigation/useBuildUrlController.tsx"],"sourcesContent":["import type { UrlController, NavigateOptions } from \"@rebasepro/cms-types\";\nimport { useCallback, useMemo } from \"react\";\nimport { removeInitialAndTrailingSlashes, resolveCollectionPathIds } from \"@rebasepro/app\";\nimport { CollectionRegistryController } from \"@rebasepro/types\";\nimport { useNavigate } from \"react-router\";\n\nexport function useBuildUrlController(props: {\n basePath: string,\n baseCollectionPath: string,\n collectionRegistryController: CollectionRegistryController\n}): UrlController {\n\n const { basePath, baseCollectionPath, collectionRegistryController } = props;\n const navigate = useNavigate();\n\n const homeUrl = basePath === \"/\" ? \"/\" : `/${removeInitialAndTrailingSlashes(basePath)}`;\n\n const buildUrlCollectionPath = useCallback((path: string): string => {\n const fullPath = basePath === \"/\" ? `${baseCollectionPath}/${path}` : `${basePath}${baseCollectionPath}/${path}`;\n return fullPath.replace(/\\/\\//g, \"/\");\n }, [basePath, baseCollectionPath]);\n\n const buildAppUrlPath = useCallback((path: string): string => {\n const fullPath = basePath === \"/\" ? `/${path}` : `${basePath}/${path}`;\n return fullPath.replace(/\\/\\//g, \"/\");\n }, [basePath]);\n\n const urlPathToDataPath = useCallback((cmsPath: string): string => {\n let path = cmsPath;\n if (basePath !== \"/\" && path.startsWith(basePath)) {\n path = path.replace(basePath, \"\");\n }\n if (path.startsWith(baseCollectionPath)) {\n path = path.replace(baseCollectionPath, \"\");\n }\n return removeInitialAndTrailingSlashes(path);\n }, [basePath, baseCollectionPath]);\n\n const isUrlCollectionPath = useCallback((urlPath: string): boolean => {\n let path = urlPath;\n if (basePath !== \"/\" && path.startsWith(basePath)) {\n path = path.replace(basePath, \"\");\n }\n return path === baseCollectionPath || path.startsWith(baseCollectionPath + \"/\");\n }, [basePath, baseCollectionPath]);\n\n const resolveDatabasePathsFrom = useCallback((path: string): string => {\n return resolveCollectionPathIds(path, collectionRegistryController.collections ?? []);\n }, [collectionRegistryController]);\n\n const navigateTo = useCallback((to: string, options?: NavigateOptions) => {\n navigate(to, options);\n }, [navigate]);\n\n return useMemo(() => ({\n basePath,\n baseCollectionPath,\n urlPathToDataPath,\n homeUrl,\n isUrlCollectionPath,\n buildUrlCollectionPath,\n buildAppUrlPath,\n resolveDatabasePathsFrom,\n navigate: navigateTo\n }), [basePath, baseCollectionPath, urlPathToDataPath, homeUrl, isUrlCollectionPath, buildUrlCollectionPath, buildAppUrlP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AAC,QAAQ,CAAC;CAEb,OAAO,eAAe;EAClB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;CACd,IAAI;EAAC;EAAU;EAAoB;EAAmB;EAAS;EAAqB;EAAwB;EAAiB;EAA0B;CAAU,CAAC;AACtK"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { CreationResultDialog } from "../../components/admin/CreationResultDialog.js";
|
|
2
|
+
import { accountAccessAction, resetMfaAction, resetPasswordAction } from "../../components/common/default_entity_actions.js";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { canReadCollection } from "@rebasepro/common";
|
|
5
|
+
import { resolveAdminCollection } from "@rebasepro/cms-types";
|
|
6
|
+
//#region src/hooks/navigation/useNavigationResolution.ts
|
|
7
|
+
/**
|
|
8
|
+
* Check whether a `RebaseCallContext` is actually the full frontend
|
|
9
|
+
* `RebaseContext` (which carries `dialogsController`).
|
|
10
|
+
*/
|
|
11
|
+
function isRebaseContext(ctx) {
|
|
12
|
+
return typeof ctx === "object" && ctx !== null && "dialogsController" in ctx;
|
|
13
|
+
}
|
|
14
|
+
function filterOutNotAllowedCollections(resolvedCollections, authController) {
|
|
15
|
+
return resolvedCollections.filter((c) => canReadCollection(c, authController)).map((c) => {
|
|
16
|
+
if (!c.childCollections) return c;
|
|
17
|
+
return {
|
|
18
|
+
...c,
|
|
19
|
+
childCollections: () => filterOutNotAllowedCollections(c.childCollections() ?? [], authController)
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function applyPluginModifyCollection(resolvedCollections, modifyCollection) {
|
|
24
|
+
return resolvedCollections.map((collection) => {
|
|
25
|
+
const modifiedCollection = modifyCollection(collection);
|
|
26
|
+
if (modifiedCollection.childCollections) return {
|
|
27
|
+
...modifiedCollection,
|
|
28
|
+
childCollections: () => applyPluginModifyCollection(modifiedCollection.childCollections() ?? [], modifyCollection)
|
|
29
|
+
};
|
|
30
|
+
return modifiedCollection;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Auto-inject auth-specific entity actions and callbacks for collections
|
|
35
|
+
* with `auth: true` or `auth: { enabled: true }`.
|
|
36
|
+
*
|
|
37
|
+
* Injections:
|
|
38
|
+
* 1. **resetPasswordAction** — adds the entity action unless explicitly disabled,
|
|
39
|
+
* or unless the auth adapter reports no `adminPasswordReset` support. Custom
|
|
40
|
+
* adapters mount their own admin routes and may not implement
|
|
41
|
+
* `POST /admin/users/:userId/reset-password`; injecting the action anyway
|
|
42
|
+
* would show a button that can only ever 404.
|
|
43
|
+
* 2. **browserCallbacks.afterSave** — shows the `CreationResultDialog` when a
|
|
44
|
+
* new user is created with `invitationSent` or `temporaryPassword` in the
|
|
45
|
+
* response
|
|
46
|
+
*
|
|
47
|
+
* Skips injection if the collection already has the action/callback present.
|
|
48
|
+
*/
|
|
49
|
+
function injectAuthCollectionConfig(collections, adminPasswordResetSupported) {
|
|
50
|
+
return collections.map((collection) => {
|
|
51
|
+
const authProp = collection.auth;
|
|
52
|
+
if (!authProp) return collection;
|
|
53
|
+
if (!(authProp === true || typeof authProp === "object" && authProp.enabled === true)) return collection;
|
|
54
|
+
const authConfig = typeof authProp === "object" ? authProp : void 0;
|
|
55
|
+
let result = collection;
|
|
56
|
+
const resetPref = authConfig?.actions?.resetPassword;
|
|
57
|
+
let actionToInject;
|
|
58
|
+
if (resetPref === false) actionToInject = void 0;
|
|
59
|
+
else if (typeof resetPref === "object") actionToInject = resetPref;
|
|
60
|
+
else if (!adminPasswordResetSupported) actionToInject = void 0;
|
|
61
|
+
else actionToInject = resetPasswordAction;
|
|
62
|
+
if (actionToInject) {
|
|
63
|
+
const injectedAction = actionToInject;
|
|
64
|
+
const existing = result.entityActions ?? [];
|
|
65
|
+
if (!existing.some((a) => typeof a === "string" ? a === injectedAction.key : a.key != null && a.key === injectedAction.key)) result = {
|
|
66
|
+
...result,
|
|
67
|
+
entityActions: [...existing, injectedAction]
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (adminPasswordResetSupported) {
|
|
71
|
+
const present = result.entityActions ?? [];
|
|
72
|
+
const missing = [resetMfaAction, accountAccessAction].filter((action) => !present.some((a) => typeof a === "string" ? a === action.key : a.key != null && a.key === action.key));
|
|
73
|
+
if (missing.length > 0) result = {
|
|
74
|
+
...result,
|
|
75
|
+
entityActions: [...present, ...missing]
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const existingAfterSave = result.browserCallbacks?.afterSave;
|
|
79
|
+
const injectedAfterSave = {
|
|
80
|
+
...result.browserCallbacks,
|
|
81
|
+
afterSave: (async (props) => {
|
|
82
|
+
await existingAfterSave?.(props);
|
|
83
|
+
const { values, status, context } = props;
|
|
84
|
+
if (status !== "new" && status !== "copy") return;
|
|
85
|
+
if (!(values.invitationSent !== void 0 || values.temporaryPassword !== void 0) || !isRebaseContext(context) || !context.dialogsController) return;
|
|
86
|
+
const { dialogsController } = context;
|
|
87
|
+
const creationResult = {
|
|
88
|
+
user: {
|
|
89
|
+
uid: String(props.id),
|
|
90
|
+
email: typeof values.email === "string" ? values.email : "",
|
|
91
|
+
displayName: typeof values.displayName === "string" ? values.displayName : "",
|
|
92
|
+
roles: Array.isArray(values.roles) ? values.roles : [],
|
|
93
|
+
photoURL: typeof values.photoURL === "string" ? values.photoURL : typeof values.photoUrl === "string" ? values.photoUrl : null,
|
|
94
|
+
providerId: "password",
|
|
95
|
+
isAnonymous: false
|
|
96
|
+
},
|
|
97
|
+
invitationSent: !!values.invitationSent,
|
|
98
|
+
temporaryPassword: typeof values.temporaryPassword === "string" ? values.temporaryPassword : void 0,
|
|
99
|
+
emailDeliveryFailed: !!values.emailDeliveryFailed
|
|
100
|
+
};
|
|
101
|
+
const { closeDialog } = dialogsController.open({
|
|
102
|
+
key: "user_creation_result",
|
|
103
|
+
Component: () => React.createElement(CreationResultDialog, {
|
|
104
|
+
result: creationResult,
|
|
105
|
+
onClose: () => closeDialog()
|
|
106
|
+
})
|
|
107
|
+
});
|
|
108
|
+
})
|
|
109
|
+
};
|
|
110
|
+
result = {
|
|
111
|
+
...result,
|
|
112
|
+
browserCallbacks: injectedAfterSave,
|
|
113
|
+
admin: {
|
|
114
|
+
...result.admin,
|
|
115
|
+
browserCallbacks: injectedAfterSave
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
return result;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
async function resolveCollections(collections, authController, data, plugins) {
|
|
122
|
+
let resolvedCollections = [];
|
|
123
|
+
if (typeof collections === "function") resolvedCollections = await collections({
|
|
124
|
+
user: authController.user,
|
|
125
|
+
authController,
|
|
126
|
+
data
|
|
127
|
+
});
|
|
128
|
+
else if (Array.isArray(collections)) resolvedCollections = collections;
|
|
129
|
+
resolvedCollections = resolvedCollections.map(resolveAdminCollection);
|
|
130
|
+
if (plugins) for (const plugin of plugins) {
|
|
131
|
+
if (plugin.hooks?.modifyCollection) resolvedCollections = applyPluginModifyCollection(resolvedCollections, plugin.hooks.modifyCollection);
|
|
132
|
+
if (plugin.hooks?.injectCollections) resolvedCollections = plugin.hooks.injectCollections(resolvedCollections).map(resolveAdminCollection);
|
|
133
|
+
}
|
|
134
|
+
resolvedCollections = injectAuthCollectionConfig(resolvedCollections, authController.capabilities?.adminPasswordReset ?? true);
|
|
135
|
+
resolvedCollections = filterOutNotAllowedCollections(resolvedCollections, authController);
|
|
136
|
+
return resolvedCollections;
|
|
137
|
+
}
|
|
138
|
+
async function resolveAppViews(baseViews, authController, data, plugins) {
|
|
139
|
+
let resolvedViews = [];
|
|
140
|
+
if (typeof baseViews === "function") resolvedViews = await baseViews({
|
|
141
|
+
user: authController.user,
|
|
142
|
+
authController,
|
|
143
|
+
data
|
|
144
|
+
}) ?? [];
|
|
145
|
+
else if (Array.isArray(baseViews)) resolvedViews = baseViews;
|
|
146
|
+
if (plugins) {
|
|
147
|
+
for (const plugin of plugins) if (plugin.views && plugin.views.length > 0) resolvedViews = [...resolvedViews, ...plugin.views];
|
|
148
|
+
}
|
|
149
|
+
if (process.env.NODE_ENV !== "production") {
|
|
150
|
+
const slugCounts = /* @__PURE__ */ new Map();
|
|
151
|
+
resolvedViews.forEach((v) => {
|
|
152
|
+
slugCounts.set(v.slug, (slugCounts.get(v.slug) ?? 0) + 1);
|
|
153
|
+
});
|
|
154
|
+
slugCounts.forEach((count, slug) => {
|
|
155
|
+
if (count > 1) console.warn(`[Rebase] Duplicate view slug "${slug}" detected (${count} views). Last-write-wins. Ensure unique slugs across admin views and plugins.`);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
resolvedViews = filterViewsByRole(resolvedViews, authController);
|
|
159
|
+
return resolvedViews;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Filter views by the `roles` field on AppView.
|
|
163
|
+
* When `roles` is set, the view is only included if the current user
|
|
164
|
+
* has at least one of the listed roles. Views without `roles` (or with
|
|
165
|
+
* an empty array) are always included.
|
|
166
|
+
*/
|
|
167
|
+
function filterViewsByRole(views, authController) {
|
|
168
|
+
const userRoles = authController.user?.roles ?? [];
|
|
169
|
+
return views.filter((view) => {
|
|
170
|
+
if (!view.roles || view.roles.length === 0) return true;
|
|
171
|
+
return view.roles.some((role) => userRoles.includes(role));
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
export { applyPluginModifyCollection, filterOutNotAllowedCollections, resolveAppViews, resolveCollections };
|
|
176
|
+
|
|
177
|
+
//# sourceMappingURL=useNavigationResolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNavigationResolution.js","names":[],"sources":["../../../src/hooks/navigation/useNavigationResolution.ts"],"sourcesContent":["import type { AuthCollectionConfig, CollectionCallbacks } from \"@rebasepro/types\";\nimport type { AppView, AppViewsBuilder, EntityAction, CollectionConfigsBuilder, RebaseContext, RebasePlugin, UserCreationResult, AdminCollection } from \"@rebasepro/cms-types\";\nimport { type User, type RebaseData } from \"@rebasepro/types\";\nimport { type AuthController, resolveAdminCollection } from \"@rebasepro/cms-types\";\nimport { canReadCollection } from \"@rebasepro/common\";\nimport { accountAccessAction, resetMfaAction, resetPasswordAction } from \"../../components/common/default_entity_actions\";\nimport { CreationResultDialog } from \"../../components/admin/CreationResultDialog\";\nimport React from \"react\";\n\n/**\n * Check whether a `RebaseCallContext` is actually the full frontend\n * `RebaseContext` (which carries `dialogsController`).\n */\nfunction isRebaseContext(ctx: unknown): ctx is RebaseContext {\n return typeof ctx === \"object\" && ctx !== null && \"dialogsController\" in ctx;\n}\n\nexport function filterOutNotAllowedCollections(resolvedCollections: AdminCollection[], authController: AuthController): AdminCollection[] {\n return resolvedCollections\n .filter((c) => canReadCollection(c, authController))\n .map((c) => {\n if (!c.childCollections) return c;\n return {\n ...c,\n childCollections: () => filterOutNotAllowedCollections(c.childCollections!() ?? [], authController)\n };\n });\n}\n\nexport function applyPluginModifyCollection(resolvedCollections: AdminCollection[], modifyCollection: (collection: AdminCollection) => AdminCollection): AdminCollection[] {\n return resolvedCollections.map((collection): AdminCollection => {\n const modifiedCollection = modifyCollection(collection);\n if (modifiedCollection.childCollections) {\n return {\n ...modifiedCollection,\n childCollections: () => applyPluginModifyCollection(modifiedCollection.childCollections!() ?? [], modifyCollection)\n };\n }\n return modifiedCollection;\n });\n}\n\n/**\n * Auto-inject auth-specific entity actions and callbacks for collections\n * with `auth: true` or `auth: { enabled: true }`.\n *\n * Injections:\n * 1. **resetPasswordAction** — adds the entity action unless explicitly disabled,\n * or unless the auth adapter reports no `adminPasswordReset` support. Custom\n * adapters mount their own admin routes and may not implement\n * `POST /admin/users/:userId/reset-password`; injecting the action anyway\n * would show a button that can only ever 404.\n * 2. **browserCallbacks.afterSave** — shows the `CreationResultDialog` when a\n * new user is created with `invitationSent` or `temporaryPassword` in the\n * response\n *\n * Skips injection if the collection already has the action/callback present.\n */\nfunction injectAuthCollectionConfig(\n collections: AdminCollection[],\n adminPasswordResetSupported: boolean\n): AdminCollection[] {\n return collections.map((collection) => {\n const authProp = collection.auth;\n if (!authProp) return collection;\n\n const isAuth = authProp === true || (typeof authProp === \"object\" && authProp.enabled === true);\n if (!isAuth) return collection;\n\n const authConfig: AuthCollectionConfig | undefined = typeof authProp === \"object\" ? authProp : undefined;\n\n let result = collection;\n\n // ─── Entity Action injection (resetPassword) ─────────────────────\n const resetPref = authConfig?.actions?.resetPassword;\n let actionToInject: EntityAction | undefined;\n\n if (resetPref === false) {\n actionToInject = undefined;\n } else if (typeof resetPref === \"object\") {\n // An explicitly supplied action is the collection author's own; they\n // own its backend, so the adapter capability doesn't apply.\n // `auth.actions.resetPassword`'s object form is an EntityAction; core\n // types it as `object` because a server never renders one.\n actionToInject = resetPref as EntityAction;\n } else if (!adminPasswordResetSupported) {\n actionToInject = undefined;\n } else {\n actionToInject = resetPasswordAction;\n }\n\n if (actionToInject) {\n const injectedAction = actionToInject;\n const existing = result.entityActions ?? [];\n // An entry is either the action or the key of an app-level one, and a\n // collection that names `\"reset_password\"` already has this action — so\n // the string form has to count here too, or the reset action is injected\n // a second time and the user gets two identical buttons.\n const alreadyHas = existing.some((a) =>\n typeof a === \"string\"\n ? a === injectedAction.key\n : a.key != null && a.key === injectedAction.key\n );\n if (!alreadyHas) {\n result = {\n ...result,\n entityActions: [...existing, injectedAction]\n };\n }\n }\n\n // ─── The other admin user actions ───────────────────────────────\n //\n // Resetting a user's second factors and switching an account off are\n // mounted by the same admin user routes as the password reset, so the\n // same capability says whether they exist. Each action is offered only\n // to a caller holding `users:write`, which is what the routes demand.\n if (adminPasswordResetSupported) {\n const present = result.entityActions ?? [];\n const missing = [resetMfaAction, accountAccessAction].filter((action) => !present.some((a) =>\n typeof a === \"string\" ? a === action.key : a.key != null && a.key === action.key));\n if (missing.length > 0) {\n result = { ...result, entityActions: [...present, ...missing] };\n }\n }\n\n // ─── afterSave callback (creation result dialog) ─────────────────\n //\n // `browserCallbacks`, not `callbacks`. This injection has always been a\n // panel behaviour — it opens a dialog — but it was installed on the\n // server's block, which nothing in the browser runs and which the Vite\n // plugin strips on the way into the bundle. So it never fired, and\n // creating a user through the panel never showed the temporary password\n // the server had just minted and will not repeat.\n const existingAfterSave = result.browserCallbacks?.afterSave;\n const injectedAfterSave = {\n ...result.browserCallbacks,\n afterSave: (async (props) => {\n await existingAfterSave?.(props);\n\n const { values, status, context } = props;\n if (status !== \"new\" && status !== \"copy\") return;\n\n const hasCreationInfo = values.invitationSent !== undefined || values.temporaryPassword !== undefined;\n if (!hasCreationInfo || !isRebaseContext(context) || !context.dialogsController) return;\n\n const { dialogsController } = context;\n\n const creationResult: UserCreationResult = {\n user: {\n uid: String(props.id),\n email: typeof values.email === \"string\" ? values.email : \"\",\n displayName: typeof values.displayName === \"string\" ? values.displayName : \"\",\n roles: Array.isArray(values.roles) ? values.roles as string[] : [],\n photoURL: typeof values.photoURL === \"string\"\n ? values.photoURL\n : typeof values.photoUrl === \"string\"\n ? values.photoUrl\n : null,\n providerId: \"password\",\n isAnonymous: false\n },\n invitationSent: !!values.invitationSent,\n temporaryPassword: typeof values.temporaryPassword === \"string\" ? values.temporaryPassword : undefined,\n emailDeliveryFailed: !!values.emailDeliveryFailed\n };\n\n const { closeDialog } = dialogsController.open({\n key: \"user_creation_result\",\n Component: () => (\n React.createElement(CreationResultDialog, {\n result: creationResult,\n onClose: () => closeDialog()\n })\n )\n });\n }) as NonNullable<CollectionCallbacks[\"afterSave\"]>\n };\n\n // Written to both the flat key and the block. This injection runs after\n // `resolveAdminCollection` has flattened `admin` onto the top level, and\n // that flattening spreads the block *over* the top level — so anything\n // put only up here is undone the next time a collection is re-resolved,\n // which the registry controller does on every lookup. Writing both keeps\n // re-flattening the no-op its callers already believe it is.\n result = {\n ...result,\n browserCallbacks: injectedAfterSave,\n admin: {\n ...result.admin,\n browserCallbacks: injectedAfterSave\n }\n };\n\n return result;\n });\n}\n\nexport async function resolveCollections(\n collections: undefined | AdminCollection[] | CollectionConfigsBuilder,\n authController: AuthController,\n data: RebaseData,\n plugins: RebasePlugin[] | undefined\n): Promise<AdminCollection[]> {\n let resolvedCollections: AdminCollection[] = [];\n if (typeof collections === \"function\") {\n resolvedCollections = await collections({\n user: authController.user,\n authController,\n data\n });\n } else if (Array.isArray(collections)) {\n resolvedCollections = collections;\n }\n\n // Collections arrive in the authoring shape, with presentation nested under\n // `admin`. Everything downstream — plugins, navigation, the drawer — reads the\n // panel's flat view model, so `admin.group` or `admin.hideFromNavigation`\n // would otherwise be silently ignored.\n resolvedCollections = resolvedCollections.map(resolveAdminCollection);\n\n if (plugins) {\n for (const plugin of plugins) {\n if (plugin.hooks?.modifyCollection) {\n resolvedCollections = applyPluginModifyCollection(resolvedCollections, plugin.hooks.modifyCollection);\n }\n\n if (plugin.hooks?.injectCollections) {\n // A plugin may return collections in the authoring shape too; the\n // flattening is idempotent, so re-running it is safe.\n resolvedCollections = plugin.hooks.injectCollections(resolvedCollections).map(resolveAdminCollection);\n }\n }\n }\n\n // Auto-inject auth entity actions and callbacks (resetPassword, creation dialog, etc.)\n resolvedCollections = injectAuthCollectionConfig(\n resolvedCollections,\n authController.capabilities?.adminPasswordReset ?? true\n );\n\n resolvedCollections = filterOutNotAllowedCollections(resolvedCollections, authController);\n return resolvedCollections;\n}\n\nexport async function resolveAppViews(\n baseViews: AppView[] | AppViewsBuilder | undefined,\n authController: AuthController,\n data: RebaseData,\n plugins?: RebasePlugin[]\n): Promise<AppView[]> {\n let resolvedViews: AppView[] = [];\n if (typeof baseViews === \"function\") {\n resolvedViews = await baseViews({\n user: authController.user,\n authController,\n data\n }) ?? [];\n } else if (Array.isArray(baseViews)) {\n resolvedViews = baseViews;\n }\n\n // Inject views from plugins\n if (plugins) {\n for (const plugin of plugins) {\n if (plugin.views && plugin.views.length > 0) {\n resolvedViews = [...resolvedViews, ...plugin.views];\n }\n }\n }\n\n // Detect duplicate view slugs (dev warning)\n if (process.env.NODE_ENV !== 'production') {\n const slugCounts = new Map<string, number>();\n resolvedViews.forEach(v => {\n slugCounts.set(v.slug, (slugCounts.get(v.slug) ?? 0) + 1);\n });\n slugCounts.forEach((count, slug) => {\n if (count > 1) {\n console.warn(\n `[Rebase] Duplicate view slug \"${slug}\" detected (${count} views). ` +\n `Last-write-wins. Ensure unique slugs across admin views and plugins.`\n );\n }\n });\n }\n\n // Filter by roles — applies to admin, plugin, and builder-returned views\n resolvedViews = filterViewsByRole(resolvedViews, authController);\n\n return resolvedViews;\n}\n\n/**\n * Filter views by the `roles` field on AppView.\n * When `roles` is set, the view is only included if the current user\n * has at least one of the listed roles. Views without `roles` (or with\n * an empty array) are always included.\n */\nfunction filterViewsByRole(views: AppView[], authController: AuthController): AppView[] {\n const userRoles = authController.user?.roles ?? [];\n return views.filter(view => {\n if (!view.roles || view.roles.length === 0) return true;\n return view.roles.some(role => userRoles.includes(role));\n });\n}\n"],"mappings":";;;;;;;;;;AAaA,SAAS,gBAAgB,KAAoC;CACzD,OAAO,OAAO,QAAQ,YAAY,QAAQ,QAAQ,uBAAuB;AAC7E;AAEA,SAAgB,+BAA+B,qBAAwC,gBAAmD;CACtI,OAAO,oBACF,QAAQ,MAAM,kBAAkB,GAAG,cAAc,CAAC,CAAC,CACnD,KAAK,MAAM;EACR,IAAI,CAAC,EAAE,kBAAkB,OAAO;EAChC,OAAO;GACH,GAAG;GACH,wBAAwB,+BAA+B,EAAE,iBAAkB,KAAK,CAAC,GAAG,cAAc;EACtG;CACJ,CAAC;AACT;AAEA,SAAgB,4BAA4B,qBAAwC,kBAAuF;CACvK,OAAO,oBAAoB,KAAK,eAAgC;EAC5D,MAAM,qBAAqB,iBAAiB,UAAU;EACtD,IAAI,mBAAmB,kBACnB,OAAO;GACH,GAAG;GACH,wBAAwB,4BAA4B,mBAAmB,iBAAkB,KAAK,CAAC,GAAG,gBAAgB;EACtH;EAEJ,OAAO;CACX,CAAC;AACL;;;;;;;;;;;;;;;;;AAkBA,SAAS,2BACL,aACA,6BACiB;CACjB,OAAO,YAAY,KAAK,eAAe;EACnC,MAAM,WAAW,WAAW;EAC5B,IA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