@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,56 @@
|
|
|
1
|
+
import { resolveCollections } from "./useNavigationResolution.js";
|
|
2
|
+
import { areCollectionListsEqual } from "./utils.js";
|
|
3
|
+
import { useAsyncResolver } from "./useAsyncResolver.js";
|
|
4
|
+
import { useMemo, useRef } from "react";
|
|
5
|
+
//#region src/hooks/navigation/useResolvedCollections.ts
|
|
6
|
+
/**
|
|
7
|
+
* Hook that resolves collection props (which may be async builders or arrays)
|
|
8
|
+
* into concrete AdminCollection[], and registers them with the CollectionRegistry.
|
|
9
|
+
*
|
|
10
|
+
* When userManagement is provided, the default users collection is always
|
|
11
|
+
* prepended. Developer collections override via generic slug-based dedup
|
|
12
|
+
* (Map keyed by slug, last-write-wins). No hardcoded string checks.
|
|
13
|
+
*
|
|
14
|
+
* Uses refs for potentially-unstable dependencies (driver, authController,
|
|
15
|
+
* plugins) to avoid re-triggering effects when their object identity changes.
|
|
16
|
+
*/
|
|
17
|
+
function useResolvedCollections(props) {
|
|
18
|
+
const { authController, collections: collectionsProp, data, plugins, disabled, collectionRegistryController } = props;
|
|
19
|
+
const userIdentity = authController.user ? `${authController.user.uid}:${(authController.user.roles ?? []).sort().join(",")}` : null;
|
|
20
|
+
const dataRef = useRef(data);
|
|
21
|
+
dataRef.current = data;
|
|
22
|
+
const authControllerRef = useRef(authController);
|
|
23
|
+
authControllerRef.current = authController;
|
|
24
|
+
const pluginsRef = useRef(plugins);
|
|
25
|
+
pluginsRef.current = plugins;
|
|
26
|
+
const { data: collections, loading, error, refresh } = useAsyncResolver({
|
|
27
|
+
resolver: async () => {
|
|
28
|
+
const deduped = [...await resolveCollections(collectionsProp, authControllerRef.current, dataRef.current, pluginsRef.current)];
|
|
29
|
+
if (collectionRegistryController.collectionRegistryRef.current.registerMultiple(deduped)) console.debug("Collections have changed", deduped);
|
|
30
|
+
return deduped;
|
|
31
|
+
},
|
|
32
|
+
initialValue: [],
|
|
33
|
+
isEqual: areCollectionListsEqual,
|
|
34
|
+
deps: [
|
|
35
|
+
collectionsProp,
|
|
36
|
+
userIdentity,
|
|
37
|
+
disabled
|
|
38
|
+
],
|
|
39
|
+
disabled: disabled || authController.initialLoading
|
|
40
|
+
});
|
|
41
|
+
return useMemo(() => ({
|
|
42
|
+
collections,
|
|
43
|
+
loading,
|
|
44
|
+
error,
|
|
45
|
+
refresh
|
|
46
|
+
}), [
|
|
47
|
+
collections,
|
|
48
|
+
loading,
|
|
49
|
+
error,
|
|
50
|
+
refresh
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { useResolvedCollections };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=useResolvedCollections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResolvedCollections.js","names":[],"sources":["../../../src/hooks/navigation/useResolvedCollections.ts"],"sourcesContent":["\nimport type { RebasePlugin, AdminCollection } from \"@rebasepro/cms-types\";\nimport { useRef, useMemo } from \"react\";\n\nimport { CollectionRegistryController, RebaseData, User } from \"@rebasepro/types\";\nimport { AuthController } from \"@rebasepro/cms-types\";\nimport type { CollectionConfigsBuilder } from \"@rebasepro/cms-types\";\nimport { CollectionRegistry } from \"@rebasepro/common\";\n\nimport { resolveCollections } from \"./useNavigationResolution\";\nimport { areCollectionListsEqual } from \"./utils\";\nimport { useAsyncResolver } from \"./useAsyncResolver\";\n\nexport type UseResolvedCollectionsProps<EC extends AdminCollection, USER extends User> = {\n authController: AuthController<USER>;\n collections?: EC[] | CollectionConfigsBuilder<EC>;\n data: RebaseData;\n plugins?: RebasePlugin[];\n disabled?: boolean;\n collectionRegistryController: CollectionRegistryController<EC> & { collectionRegistryRef: React.MutableRefObject<CollectionRegistry> };\n\n};\n\nexport type UseResolvedCollectionsResult = {\n collections: AdminCollection[];\n loading: boolean;\n error: Error | undefined;\n refresh: () => void;\n};\n\n/**\n * Hook that resolves collection props (which may be async builders or arrays)\n * into concrete AdminCollection[], and registers them with the CollectionRegistry.\n *\n * When userManagement is provided, the default users collection is always\n * prepended. Developer collections override via generic slug-based dedup\n * (Map keyed by slug, last-write-wins). No hardcoded string checks.\n *\n * Uses refs for potentially-unstable dependencies (driver, authController,\n * plugins) to avoid re-triggering effects when their object identity changes.\n */\nexport function useResolvedCollections<EC extends AdminCollection, USER extends User>(\n props: UseResolvedCollectionsProps<EC, USER>\n): UseResolvedCollectionsResult {\n\n const {\n authController,\n collections: collectionsProp,\n data,\n plugins,\n disabled,\n collectionRegistryController\n } = props;\n\n // Stable identity string for the user — avoids re-triggering when the\n // authController object reference changes but uid/roles are the same.\n const userIdentity = authController.user\n ? `${authController.user.uid}:${(authController.user.roles ?? []).sort().join(',')}`\n : null;\n\n // Use refs for values that may be new objects each render but shouldn't\n // re-trigger the effect. The effect reads them at execution time.\n const dataRef = useRef(data);\n dataRef.current = data;\n const authControllerRef = useRef(authController);\n authControllerRef.current = authController;\n const pluginsRef = useRef(plugins);\n pluginsRef.current = plugins;\n\n const { data: collections, loading, error, refresh } = useAsyncResolver<AdminCollection[]>({\n resolver: async () => {\n const resolved = await resolveCollections(\n collectionsProp,\n authControllerRef.current,\n dataRef.current,\n pluginsRef.current\n );\n\n const deduped = [...resolved];\n\n // Register with the CollectionRegistry; returns true if changed\n const changed = collectionRegistryController.collectionRegistryRef.current.registerMultiple(deduped);\n\n if (changed) {\n console.debug(\"Collections have changed\", deduped);\n }\n\n return deduped;\n },\n initialValue: [],\n isEqual: areCollectionListsEqual,\n deps: [collectionsProp, userIdentity, disabled],\n disabled: disabled || authController.initialLoading,\n });\n\n return useMemo(() => ({\n collections,\n loading,\n error,\n refresh\n }), [collections, loading, error, refresh]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyCA,SAAgB,uBACZ,OAC4B;CAE5B,MAAM,EACF,gBACA,aAAa,iBACb,MACA,SACA,UACA,iCACA;CAIJ,MAAM,eAAe,eAAe,OAC9B,GAAG,eAAe,KAAK,IAAI,IAAI,eAAe,KAAK,SAAS,CAAC,EAAA,CAAG,KAAK,CAAC,CAAC,KAAK,GAAG,MAC/E;CAIN,MAAM,UAAU,OAAO,IAAI;CAC3B,QAAQ,UAAU;CAClB,MAAM,oBAAoB,OAAO,cAAc;CAC/C,kBAAkB,UAAU;CAC5B,MAAM,aAAa,OAAO,OAAO;CACjC,WAAW,UAAU;CAErB,MAAM,EAAE,MAAM,aAAa,SAAS,OAAO,YAAY,iBAAoC;EACvF,UAAU,YAAY;GAQlB,MAAM,UAAU,CAAC,GAAG,MAPG,mBACnB,iBACA,kBAAkB,SAClB,QAAQ,SACR,WAAW,OACf,CAE4B;GAK5B,IAFgB,6BAA6B,sBAAsB,QAAQ,iBAAiB,OAExF,GACA,QAAQ,MAAM,4BAA4B,OAAO;GAGrD,OAAO;EACX;EACA,cAAc,CAAC;EACf,SAAS;EACT,MAAM;GAAC;GAAiB;GAAc;EAAQ;EAC9C,UAAU,YAAY,eAAe;CACzC,CAAC;CAED,OAAO,eAAe;EAClB;EACA;EACA;EACA;CACJ,IAAI;EAAC;EAAa;EAAS;EAAO;CAAO,CAAC;AAC9C"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { resolveAppViews } from "./useNavigationResolution.js";
|
|
2
|
+
import { useAsyncResolver } from "./useAsyncResolver.js";
|
|
3
|
+
import { useMemo, useRef } from "react";
|
|
4
|
+
//#region src/hooks/navigation/useResolvedViews.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Compare two view arrays by their slug identity.
|
|
7
|
+
* Returns true when the sets of slugs are identical (same order, same values).
|
|
8
|
+
* This avoids deepEqual on React elements, which have unstable internal refs.
|
|
9
|
+
*/
|
|
10
|
+
function viewSlugsEqual(a, b) {
|
|
11
|
+
if (a === b) return true;
|
|
12
|
+
if (!a || !b) return false;
|
|
13
|
+
if (a.length !== b.length) return false;
|
|
14
|
+
for (let i = 0; i < a.length; i++) if (a[i].slug !== b[i].slug) return false;
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Equality check for the combined views data.
|
|
19
|
+
* Compares both views and adminViews by slug identity.
|
|
20
|
+
*/
|
|
21
|
+
function areResolvedViewsEqual(a, b) {
|
|
22
|
+
return viewSlugsEqual(a.views, b.views) && viewSlugsEqual(a.adminViews, b.adminViews);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Hook that resolves view and admin view props (which may be async builders or arrays)
|
|
26
|
+
* into concrete AppView[].
|
|
27
|
+
*
|
|
28
|
+
* Uses refs for potentially-unstable dependencies (driver, authController,
|
|
29
|
+
* plugins) to avoid re-triggering effects when their object identity changes.
|
|
30
|
+
*/
|
|
31
|
+
function useResolvedViews(props) {
|
|
32
|
+
const { authController, views: viewsProp, adminViews: adminViewsProp, data, plugins, adminMode = "cms", effectiveRoleController } = props;
|
|
33
|
+
const userIdentity = authController.user ? `${authController.user.uid}:${(authController.user.roles ?? []).sort().join(",")}` : null;
|
|
34
|
+
const dataRef = useRef(data);
|
|
35
|
+
dataRef.current = data;
|
|
36
|
+
const authControllerRef = useRef(authController);
|
|
37
|
+
authControllerRef.current = authController;
|
|
38
|
+
const pluginsRef = useRef(plugins);
|
|
39
|
+
pluginsRef.current = plugins;
|
|
40
|
+
const resolvedAuthController = useMemo(() => {
|
|
41
|
+
if (adminMode === "studio" && effectiveRoleController?.effectiveRole && authController.user) return {
|
|
42
|
+
...authController,
|
|
43
|
+
user: {
|
|
44
|
+
...authController.user,
|
|
45
|
+
roles: [effectiveRoleController.effectiveRole]
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return authController;
|
|
49
|
+
}, [
|
|
50
|
+
adminMode,
|
|
51
|
+
effectiveRoleController?.effectiveRole,
|
|
52
|
+
authController
|
|
53
|
+
]);
|
|
54
|
+
const resolvedAuthControllerRef = useRef(resolvedAuthController);
|
|
55
|
+
resolvedAuthControllerRef.current = resolvedAuthController;
|
|
56
|
+
const initialLoading = resolvedAuthController.initialLoading;
|
|
57
|
+
const { data: resolvedData, loading, error, refresh } = useAsyncResolver({
|
|
58
|
+
resolver: async () => {
|
|
59
|
+
const [newViews, newAdminViews] = await Promise.all([resolveAppViews(viewsProp, resolvedAuthControllerRef.current, dataRef.current, pluginsRef.current), resolveAppViews(adminViewsProp, resolvedAuthControllerRef.current, dataRef.current)]);
|
|
60
|
+
return {
|
|
61
|
+
views: newViews,
|
|
62
|
+
adminViews: newAdminViews
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
initialValue: {
|
|
66
|
+
views: void 0,
|
|
67
|
+
adminViews: void 0
|
|
68
|
+
},
|
|
69
|
+
isEqual: areResolvedViewsEqual,
|
|
70
|
+
deps: [
|
|
71
|
+
viewsProp,
|
|
72
|
+
adminViewsProp,
|
|
73
|
+
adminMode,
|
|
74
|
+
userIdentity
|
|
75
|
+
],
|
|
76
|
+
disabled: initialLoading
|
|
77
|
+
});
|
|
78
|
+
return useMemo(() => ({
|
|
79
|
+
views: resolvedData.views,
|
|
80
|
+
adminViews: resolvedData.adminViews,
|
|
81
|
+
loading,
|
|
82
|
+
error,
|
|
83
|
+
refresh
|
|
84
|
+
}), [
|
|
85
|
+
resolvedData,
|
|
86
|
+
loading,
|
|
87
|
+
error,
|
|
88
|
+
refresh
|
|
89
|
+
]);
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
export { useResolvedViews };
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=useResolvedViews.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResolvedViews.js","names":[],"sources":["../../../src/hooks/navigation/useResolvedViews.tsx"],"sourcesContent":["\nimport type { EffectiveRoleController } from \"@rebasepro/types\";\nimport type { AppView, AppViewsBuilder, RebasePlugin } from \"@rebasepro/cms-types\";\nimport { useMemo, useRef } from \"react\";\n\n/**\n * Compare two view arrays by their slug identity.\n * Returns true when the sets of slugs are identical (same order, same values).\n * This avoids deepEqual on React elements, which have unstable internal refs.\n */\nfunction viewSlugsEqual(a: AppView[] | undefined, b: AppView[] | undefined): boolean {\n if (a === b) return true;\n if (!a || !b) return false;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i].slug !== b[i].slug) return false;\n }\n return true;\n}\n\nimport type { RebaseData, User } from \"@rebasepro/types\";\nimport type { AuthController } from \"@rebasepro/cms-types\";\n\nimport { resolveAppViews } from \"./useNavigationResolution\";\nimport { useAsyncResolver } from \"./useAsyncResolver\";\n\nexport type UseResolvedViewsProps<USER extends User> = {\n authController: AuthController<USER>;\n views?: AppView[] | AppViewsBuilder;\n adminViews?: AppView[] | AppViewsBuilder;\n data: RebaseData;\n plugins?: RebasePlugin[];\n adminMode?: \"cms\" | \"studio\";\n effectiveRoleController?: EffectiveRoleController;\n};\n\nexport type UseResolvedViewsResult = {\n views: AppView[] | undefined;\n adminViews: AppView[] | undefined;\n loading: boolean;\n error: Error | undefined;\n refresh: () => void;\n};\n\n/**\n * Combined result type for the async resolver — holds both views and\n * adminViews so they can be resolved together in a single async call.\n */\ntype ResolvedViewsData = {\n views: AppView[] | undefined;\n adminViews: AppView[] | undefined;\n};\n\n/**\n * Equality check for the combined views data.\n * Compares both views and adminViews by slug identity.\n */\nfunction areResolvedViewsEqual(a: ResolvedViewsData, b: ResolvedViewsData): boolean {\n return viewSlugsEqual(a.views, b.views) && viewSlugsEqual(a.adminViews, b.adminViews);\n}\n\n/**\n * Hook that resolves view and admin view props (which may be async builders or arrays)\n * into concrete AppView[].\n *\n * Uses refs for potentially-unstable dependencies (driver, authController,\n * plugins) to avoid re-triggering effects when their object identity changes.\n */\nexport function useResolvedViews<USER extends User>(\n props: UseResolvedViewsProps<USER>\n): UseResolvedViewsResult {\n\n const {\n authController,\n views: viewsProp,\n adminViews: adminViewsProp,\n data,\n plugins,\n adminMode = \"cms\",\n effectiveRoleController\n } = props;\n\n // Stable identity string for the user — avoids re-triggering when the\n // authController object reference changes but uid/roles are the same.\n const userIdentity = authController.user\n ? `${authController.user.uid}:${(authController.user.roles ?? []).sort().join(',')}`\n : null;\n\n // Use refs for values that may be new objects each render but shouldn't\n // re-trigger the effect. The effect reads them at execution time.\n const dataRef = useRef(data);\n dataRef.current = data;\n const authControllerRef = useRef(authController);\n authControllerRef.current = authController;\n const pluginsRef = useRef(plugins);\n pluginsRef.current = plugins;\n\n // Build the resolved auth controller (with effective role override for studio mode)\n const resolvedAuthController = useMemo(() => {\n if (adminMode === \"studio\" && effectiveRoleController?.effectiveRole && authController.user) {\n return {\n ...authController,\n user: {\n ...authController.user,\n roles: [effectiveRoleController.effectiveRole]\n }\n };\n }\n return authController;\n }, [adminMode, effectiveRoleController?.effectiveRole, authController]);\n\n // Store resolvedAuthController in a ref for effect access without re-triggering\n const resolvedAuthControllerRef = useRef(resolvedAuthController);\n resolvedAuthControllerRef.current = resolvedAuthController;\n\n const initialLoading = resolvedAuthController.initialLoading;\n\n const { data: resolvedData, loading, error, refresh } = useAsyncResolver<ResolvedViewsData>({\n resolver: async () => {\n const [newViews, newAdminViews] = await Promise.all([\n resolveAppViews(viewsProp, resolvedAuthControllerRef.current, dataRef.current, pluginsRef.current),\n resolveAppViews(adminViewsProp, resolvedAuthControllerRef.current, dataRef.current)\n ]);\n return { views: newViews, adminViews: newAdminViews };\n },\n initialValue: { views: undefined, adminViews: undefined },\n isEqual: areResolvedViewsEqual,\n deps: [viewsProp, adminViewsProp, adminMode, userIdentity],\n disabled: initialLoading,\n });\n\n return useMemo(() => ({\n views: resolvedData.views,\n adminViews: resolvedData.adminViews,\n loading,\n error,\n refresh\n }), [resolvedData, loading, error, refresh]);\n}\n"],"mappings":";;;;;;;;;AAUA,SAAS,eAAe,GAA0B,GAAmC;CACjF,IAAI,MAAM,GAAG,OAAO;CACpB,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO;CACrB,IAAI,EAAE,WAAW,EAAE,QAAQ,OAAO;CAClC,KAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,KAC1B,IAAI,EAAE,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,OAAO;CAExC,OAAO;AACX;;;;;AAuCA,SAAS,sBAAsB,GAAsB,GAA+B;CAChF,OAAO,eAAe,EAAE,OAAO,EAAE,KAAK,KAAK,eAAe,EAAE,YAAY,EAAE,UAAU;AACxF;;;;;;;;AASA,SAAgB,iBACZ,OACsB;CAEtB,MAAM,EACF,gBACA,OAAO,WACP,YAAY,gBACZ,MACA,SACA,YAAY,OACZ,4BACA;CAIJ,MAAM,eAAe,eAAe,OAC9B,GAAG,eAAe,KAAK,IAAI,IAAI,eAAe,KAAK,SAAS,CAAC,EAAA,CAAG,KAAK,CAAC,CAAC,KAAK,GAAG,MAC/E;CAIN,MAAM,UAAU,OAAO,IAAI;CAC3B,QAAQ,UAAU;CAClB,MAAM,oBAAoB,OAAO,cAAc;CAC/C,kBAAkB,UAAU;CAC5B,MAAM,aAAa,OAAO,OAAO;CACjC,WAAW,UAAU;CAGrB,MAAM,yBAAyB,cAAc;EACzC,IAAI,cAAc,YAAY,yBAAyB,iBAAiB,eAAe,MACnF,OAAO;GACH,GAAG;GACH,MAAM;IACF,GAAG,eAAe;IAClB,OAAO,CAAC,wBAAwB,aAAa;GACjD;EACJ;EAEJ,OAAO;CACX,GAAG;EAAC;EAAW,yBAAyB;EAAe;CAAc,CAAC;CAGtE,MAAM,4BAA4B,OAAO,sBAAsB;CAC/D,0BAA0B,UAAU;CAEpC,MAAM,iBAAiB,uBAAuB;CAE9C,MAAM,EAAE,MAAM,cAAc,SAAS,OAAO,YAAY,iBAAoC;EACxF,UAAU,YAAY;GAClB,MAAM,CAAC,UAAU,iBAAiB,MAAM,QAAQ,IAAI,CAChD,gBAAgB,WAAW,0BAA0B,SAAS,QAAQ,SAAS,WAAW,OAAO,GACjG,gBAAgB,gBAAgB,0BAA0B,SAAS,QAAQ,OAAO,CACtF,CAAC;GACD,OAAO;IAAE,OAAO;IAAU,YAAY;GAAc;EACxD;EACA,cAAc;GAAE,OAAO,KAAA;GAAW,YAAY,KAAA;EAAU;EACxD,SAAS;EACT,MAAM;GAAC;GAAW;GAAgB;GAAW;EAAY;EACzD,UAAU;CACd,CAAC;CAED,OAAO,eAAe;EAClB,OAAO,aAAa;EACpB,YAAY,aAAa;EACzB;EACA;EACA;CACJ,IAAI;EAAC;EAAc;EAAS;EAAO;CAAO,CAAC;AAC/C"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { computeNavigationGroups, getGroup, isBottomPinnedGroupName } from "./utils.js";
|
|
2
|
+
import { useCallback, useMemo, useRef } from "react";
|
|
3
|
+
import { deepEqual } from "fast-equals";
|
|
4
|
+
//#region src/hooks/navigation/useTopLevelNavigation.ts
|
|
5
|
+
/**
|
|
6
|
+
* Hook that computes the top-level NavigationResult from resolved collections,
|
|
7
|
+
* views, and admin views. Pure computation — no async, no effects.
|
|
8
|
+
*
|
|
9
|
+
* The `onNavigationEntriesUpdate` callback is embedded in the result for API
|
|
10
|
+
* compatibility, but its reference is stable via useCallback.
|
|
11
|
+
*/
|
|
12
|
+
function useTopLevelNavigation(props) {
|
|
13
|
+
const { collections, views, adminViews, plugins, navigationGroupMappings, viewsOrder, urlController, adminMode, collectionRegistryController } = props;
|
|
14
|
+
const pluginGroups = useMemo(() => {
|
|
15
|
+
const allPluginGroups = plugins?.flatMap((plugin) => plugin.hooks?.navigationEntries ? plugin.hooks.navigationEntries.map((e) => e.name) : []) ?? [];
|
|
16
|
+
return [...new Set(allPluginGroups)];
|
|
17
|
+
}, [plugins]);
|
|
18
|
+
const onNavigationEntriesOrderUpdate = useCallback((entries) => {
|
|
19
|
+
if (!plugins) return;
|
|
20
|
+
const filteredEntries = entries.filter((entry) => entry.entries.length > 0);
|
|
21
|
+
if (plugins.some((plugin) => plugin.hooks?.onNavigationEntriesUpdate)) plugins.forEach((plugin) => {
|
|
22
|
+
if (plugin.hooks?.onNavigationEntriesUpdate) plugin.hooks.onNavigationEntriesUpdate(filteredEntries);
|
|
23
|
+
});
|
|
24
|
+
}, [plugins]);
|
|
25
|
+
const topLevelNavigationRef = useRef(void 0);
|
|
26
|
+
const topLevelNavigation = useMemo(() => {
|
|
27
|
+
if (!views && !adminViews && collections.length === 0) return;
|
|
28
|
+
const finalNavigationGroupMappings = computeNavigationGroups({
|
|
29
|
+
navigationGroupMappings,
|
|
30
|
+
collections,
|
|
31
|
+
views,
|
|
32
|
+
plugins
|
|
33
|
+
});
|
|
34
|
+
const allPluginNavigationEntries = finalNavigationGroupMappings.map((g) => g.entries).flat() ?? [];
|
|
35
|
+
const navigationEntriesOrder = [...new Set(allPluginNavigationEntries)];
|
|
36
|
+
let navigationEntries = [
|
|
37
|
+
...(collections ?? []).reduce((acc, collection) => {
|
|
38
|
+
if (collection.hideFromNavigation) return acc;
|
|
39
|
+
const pathKey = collection.slug;
|
|
40
|
+
let groupName = getGroup(collection);
|
|
41
|
+
if (finalNavigationGroupMappings) {
|
|
42
|
+
for (const pluginGroupDef of finalNavigationGroupMappings) if (pluginGroupDef.entries.includes(pathKey)) {
|
|
43
|
+
groupName = pluginGroupDef.name;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
acc.push({
|
|
48
|
+
id: `collection:${pathKey}`,
|
|
49
|
+
url: urlController.buildUrlCollectionPath(pathKey),
|
|
50
|
+
type: "collection",
|
|
51
|
+
name: collection.name.trim(),
|
|
52
|
+
slug: pathKey,
|
|
53
|
+
collection,
|
|
54
|
+
description: collection.description?.trim(),
|
|
55
|
+
group: groupName ?? "Views"
|
|
56
|
+
});
|
|
57
|
+
return acc;
|
|
58
|
+
}, []),
|
|
59
|
+
...(views ?? []).reduce((acc, view) => {
|
|
60
|
+
if (view.hideFromNavigation) return acc;
|
|
61
|
+
const pathKey = view.slug;
|
|
62
|
+
let groupName = getGroup(view);
|
|
63
|
+
if (finalNavigationGroupMappings) {
|
|
64
|
+
for (const pluginGroupDef of finalNavigationGroupMappings) if (pluginGroupDef.entries.includes(pathKey)) {
|
|
65
|
+
groupName = pluginGroupDef.name;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const basePathKey = Array.isArray(pathKey) ? pathKey[0] : pathKey;
|
|
70
|
+
acc.push({
|
|
71
|
+
id: `view:${pathKey}`,
|
|
72
|
+
url: urlController.buildAppUrlPath(basePathKey),
|
|
73
|
+
name: view.name.trim(),
|
|
74
|
+
type: "view",
|
|
75
|
+
slug: view.slug,
|
|
76
|
+
view,
|
|
77
|
+
description: view.description?.trim(),
|
|
78
|
+
group: groupName ?? "Views"
|
|
79
|
+
});
|
|
80
|
+
return acc;
|
|
81
|
+
}, []),
|
|
82
|
+
...(adminViews ?? []).reduce((acc, adminView) => {
|
|
83
|
+
if (adminView.hideFromNavigation) return acc;
|
|
84
|
+
const pathKey = adminView.slug;
|
|
85
|
+
let groupName = adminView.group?.trim() || "Admin";
|
|
86
|
+
if (finalNavigationGroupMappings) {
|
|
87
|
+
for (const pluginGroupDef of finalNavigationGroupMappings) if (pluginGroupDef.entries.includes(pathKey)) {
|
|
88
|
+
groupName = pluginGroupDef.name;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
acc.push({
|
|
93
|
+
id: `admin:${pathKey}`,
|
|
94
|
+
url: urlController.buildAppUrlPath(pathKey),
|
|
95
|
+
name: adminView.name.trim(),
|
|
96
|
+
type: "admin",
|
|
97
|
+
slug: adminView.slug,
|
|
98
|
+
view: adminView,
|
|
99
|
+
description: adminView.description?.trim(),
|
|
100
|
+
group: groupName
|
|
101
|
+
});
|
|
102
|
+
return acc;
|
|
103
|
+
}, [])
|
|
104
|
+
];
|
|
105
|
+
const pinnedGroups = /* @__PURE__ */ new Set();
|
|
106
|
+
for (const view of [...views ?? [], ...adminViews ?? []]) if (view.pinToBottom) pinnedGroups.add(getGroup(view));
|
|
107
|
+
const groupOrderValue = (groupName) => isBottomPinnedGroupName(groupName) || groupName !== void 0 && pinnedGroups.has(groupName) ? 1 : 0;
|
|
108
|
+
const usedViewsOrder = viewsOrder ?? navigationEntriesOrder;
|
|
109
|
+
navigationEntries = navigationEntries.sort((a, b) => {
|
|
110
|
+
const groupDiff = groupOrderValue(a.group) - groupOrderValue(b.group);
|
|
111
|
+
if (groupDiff !== 0) return groupDiff;
|
|
112
|
+
if (usedViewsOrder) {
|
|
113
|
+
const getSortPath = (navEntry) => typeof navEntry.slug === "string" ? navEntry.slug : navEntry.slug[0];
|
|
114
|
+
const aIndex = usedViewsOrder.indexOf(getSortPath(a));
|
|
115
|
+
const bIndex = usedViewsOrder.indexOf(getSortPath(b));
|
|
116
|
+
if (aIndex !== -1 || bIndex !== -1) {
|
|
117
|
+
if (aIndex === -1) return 1;
|
|
118
|
+
if (bIndex === -1) return -1;
|
|
119
|
+
return aIndex - bIndex;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return 0;
|
|
123
|
+
});
|
|
124
|
+
const collectedGroupsFromEntries = navigationEntries.map((e) => e.group).filter(Boolean);
|
|
125
|
+
const groupsFromMappings = finalNavigationGroupMappings.map((g) => g.name);
|
|
126
|
+
const additionalGroups = collectedGroupsFromEntries.filter((g) => !groupsFromMappings.includes(g));
|
|
127
|
+
const allDefinedGroups = [
|
|
128
|
+
...pluginGroups ?? [],
|
|
129
|
+
...groupsFromMappings,
|
|
130
|
+
...additionalGroups
|
|
131
|
+
];
|
|
132
|
+
const uniqueGroupsArray = [...new Set(allDefinedGroups)];
|
|
133
|
+
const lastGroups = uniqueGroupsArray.filter((g) => groupOrderValue(g) === 1);
|
|
134
|
+
const uniqueGroups = [...uniqueGroupsArray.filter((g) => groupOrderValue(g) === 0), ...lastGroups];
|
|
135
|
+
const computedTopLevelNav = {
|
|
136
|
+
allowDragAndDrop: plugins?.some((plugin) => plugin.hooks?.allowDragAndDrop) ?? false,
|
|
137
|
+
navigationEntries,
|
|
138
|
+
groups: uniqueGroups,
|
|
139
|
+
onNavigationEntriesUpdate: onNavigationEntriesOrderUpdate
|
|
140
|
+
};
|
|
141
|
+
if (topLevelNavigationRef.current && deepEqual(topLevelNavigationRef.current.navigationEntries, computedTopLevelNav.navigationEntries) && deepEqual(topLevelNavigationRef.current.groups, computedTopLevelNav.groups) && topLevelNavigationRef.current.allowDragAndDrop === computedTopLevelNav.allowDragAndDrop) return topLevelNavigationRef.current;
|
|
142
|
+
topLevelNavigationRef.current = computedTopLevelNav;
|
|
143
|
+
return computedTopLevelNav;
|
|
144
|
+
}, [
|
|
145
|
+
collections,
|
|
146
|
+
views,
|
|
147
|
+
adminViews,
|
|
148
|
+
navigationGroupMappings,
|
|
149
|
+
urlController.buildAppUrlPath,
|
|
150
|
+
urlController.buildUrlCollectionPath,
|
|
151
|
+
pluginGroups,
|
|
152
|
+
plugins,
|
|
153
|
+
adminMode,
|
|
154
|
+
viewsOrder,
|
|
155
|
+
onNavigationEntriesOrderUpdate
|
|
156
|
+
]);
|
|
157
|
+
return useMemo(() => ({ topLevelNavigation }), [topLevelNavigation]);
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
export { useTopLevelNavigation };
|
|
161
|
+
|
|
162
|
+
//# sourceMappingURL=useTopLevelNavigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTopLevelNavigation.js","names":[],"sources":["../../../src/hooks/navigation/useTopLevelNavigation.ts"],"sourcesContent":["\nimport type { AppView, UrlController, RebasePlugin, NavigationEntry, NavigationGroupMapping, NavigationResult, AdminCollection } from \"@rebasepro/cms-types\";\nimport { useCallback, useMemo, useRef } from \"react\";\nimport { deepEqual as equal } from \"fast-equals\";\n\nimport { CollectionRegistryController } from \"@rebasepro/types\";\nimport { CollectionRegistry } from \"@rebasepro/common\";\n\nimport { computeNavigationGroups, getGroup, isBottomPinnedGroupName, NAVIGATION_ADMIN_GROUP_NAME, NAVIGATION_DEFAULT_GROUP_NAME } from \"./utils\";\n\nexport type UseTopLevelNavigationProps = {\n collections: AdminCollection[];\n views: AppView[] | undefined;\n adminViews: AppView[] | undefined;\n plugins?: RebasePlugin[];\n navigationGroupMappings?: NavigationGroupMapping[];\n viewsOrder?: string[];\n urlController: UrlController;\n adminMode?: \"cms\" | \"studio\";\n collectionRegistryController: CollectionRegistryController & { collectionRegistryRef: React.MutableRefObject<CollectionRegistry> };\n};\n\nexport type UseTopLevelNavigationResult = {\n topLevelNavigation: NavigationResult | undefined;\n};\n\n/**\n * Hook that computes the top-level NavigationResult from resolved collections,\n * views, and admin views. Pure computation — no async, no effects.\n *\n * The `onNavigationEntriesUpdate` callback is embedded in the result for API\n * compatibility, but its reference is stable via useCallback.\n */\nexport function useTopLevelNavigation(\n props: UseTopLevelNavigationProps\n): UseTopLevelNavigationResult {\n\n const {\n collections,\n views,\n adminViews,\n plugins,\n navigationGroupMappings,\n viewsOrder,\n urlController,\n adminMode,\n collectionRegistryController\n } = props;\n\n const pluginGroups = useMemo(() => {\n const allPluginGroups = plugins?.flatMap(plugin => plugin.hooks?.navigationEntries ? plugin.hooks.navigationEntries.map(e => e.name) : []) ?? [];\n return [...new Set(allPluginGroups)];\n }, [plugins]);\n\n // Stable reference to the drag-and-drop update callback.\n // We use a ref-based approach internally so the callback identity doesn't\n // change when collections/views change (which would cause NavigationResult\n // equality to always fail).\n const onNavigationEntriesOrderUpdate = useCallback((entries: NavigationGroupMapping[]) => {\n if (!plugins) {\n return;\n }\n // remove all groups that have no entries\n const filteredEntries = entries.filter(entry => entry.entries.length > 0);\n\n // Persist to backend via plugins\n if (plugins.some((plugin: RebasePlugin) => plugin.hooks?.onNavigationEntriesUpdate)) {\n plugins.forEach((plugin: RebasePlugin) => {\n if (plugin.hooks?.onNavigationEntriesUpdate) {\n plugin.hooks.onNavigationEntriesUpdate(filteredEntries);\n }\n });\n }\n }, [plugins]);\n\n const topLevelNavigationRef = useRef<NavigationResult | undefined>(undefined);\n\n const topLevelNavigation = useMemo(() => {\n // Don't compute until we have collections and views resolved\n if (!views && !adminViews && collections.length === 0) {\n return undefined;\n }\n\n const finalNavigationGroupMappings: NavigationGroupMapping[] = computeNavigationGroups({\n navigationGroupMappings,\n collections,\n views: views,\n plugins\n });\n\n const allPluginNavigationEntries = finalNavigationGroupMappings.map((g) => g.entries).flat() ?? [];\n const navigationEntriesOrder = ([...new Set(allPluginNavigationEntries)]);\n\n let navigationEntries: NavigationEntry[] = [\n ...(collections ?? []).reduce((acc, collection) => {\n if (collection.hideFromNavigation) return acc;\n\n const pathKey = collection.slug;\n let groupName = getGroup(collection);\n\n if (finalNavigationGroupMappings) {\n for (const pluginGroupDef of finalNavigationGroupMappings) {\n if (pluginGroupDef.entries.includes(pathKey)) {\n groupName = pluginGroupDef.name;\n break;\n }\n }\n }\n\n acc.push({\n id: `collection:${pathKey}`,\n url: urlController.buildUrlCollectionPath(pathKey),\n type: \"collection\",\n name: collection.name.trim(),\n slug: pathKey,\n collection,\n description: collection.description?.trim(),\n group: groupName ?? NAVIGATION_DEFAULT_GROUP_NAME\n });\n return acc;\n }, [] as NavigationEntry[]),\n\n ...(views ?? []).reduce((acc, view) => {\n if (view.hideFromNavigation) return acc;\n\n const pathKey = view.slug;\n let groupName = getGroup(view);\n\n if (finalNavigationGroupMappings) {\n for (const pluginGroupDef of finalNavigationGroupMappings) {\n if (pluginGroupDef.entries.includes(pathKey)) {\n groupName = pluginGroupDef.name;\n break;\n }\n }\n }\n\n const basePathKey = Array.isArray(pathKey) ? pathKey[0] : pathKey;\n acc.push({\n id: `view:${pathKey}`,\n url: urlController.buildAppUrlPath(basePathKey),\n name: view.name.trim(),\n type: \"view\",\n slug: view.slug,\n view,\n description: view.description?.trim(),\n group: groupName ?? NAVIGATION_DEFAULT_GROUP_NAME\n });\n return acc;\n }, [] as NavigationEntry[]),\n\n ...(adminViews ?? []).reduce((acc, adminView) => {\n if (adminView.hideFromNavigation) return acc;\n\n const pathKey = adminView.slug;\n let groupName = adminView.group?.trim() || NAVIGATION_ADMIN_GROUP_NAME;\n\n if (finalNavigationGroupMappings) {\n for (const pluginGroupDef of finalNavigationGroupMappings) {\n if (pluginGroupDef.entries.includes(pathKey)) {\n groupName = pluginGroupDef.name;\n break;\n }\n }\n }\n\n acc.push({\n id: `admin:${pathKey}`,\n url: urlController.buildAppUrlPath(pathKey),\n name: adminView.name.trim(),\n type: \"admin\",\n slug: adminView.slug,\n view: adminView,\n description: adminView.description?.trim(),\n group: groupName\n });\n return acc;\n }, [] as NavigationEntry[])\n ];\n\n // Groups that sink to the bottom. Two sources, because the string\n // comparison predates the flag and apps depend on it: the names in\n // `NAVIGATION_BOTTOM_GROUP_NAMES`, and any group holding a view that\n // asked for it — which is the only one of the two that survives the\n // group being renamed or translated.\n const pinnedGroups = new Set<string>();\n for (const view of [...(views ?? []), ...(adminViews ?? [])]) {\n if (view.pinToBottom) pinnedGroups.add(getGroup(view));\n }\n\n const groupOrderValue = (groupName?: string): number =>\n (isBottomPinnedGroupName(groupName) || (groupName !== undefined && pinnedGroups.has(groupName))) ? 1 : 0;\n\n const usedViewsOrder = viewsOrder ?? navigationEntriesOrder;\n navigationEntries = navigationEntries.sort((a, b) => {\n // Primary: group priority (admin/settings last)\n const groupDiff = groupOrderValue(a.group) - groupOrderValue(b.group);\n if (groupDiff !== 0) return groupDiff;\n\n // Secondary: explicit view order (if provided)\n if (usedViewsOrder) {\n const getSortPath = (navEntry: NavigationEntry) => typeof navEntry.slug === \"string\" ? navEntry.slug : navEntry.slug[0];\n const aIndex = usedViewsOrder.indexOf(getSortPath(a));\n const bIndex = usedViewsOrder.indexOf(getSortPath(b));\n if (aIndex !== -1 || bIndex !== -1) {\n if (aIndex === -1) return 1;\n if (bIndex === -1) return -1;\n return aIndex - bIndex;\n }\n }\n\n return 0;\n });\n\n const collectedGroupsFromEntries = navigationEntries\n .map(e => e.group)\n .filter(Boolean) as string[];\n\n const groupsFromMappings = finalNavigationGroupMappings.map(g => g.name);\n const additionalGroups = collectedGroupsFromEntries.filter(g => !groupsFromMappings.includes(g));\n\n const allDefinedGroups = [\n ...(pluginGroups ?? []),\n ...groupsFromMappings,\n ...additionalGroups\n ];\n\n const uniqueGroupsArray = [...new Set(allDefinedGroups)];\n // Same rule the entry sort uses — read through `groupOrderValue` rather\n // than repeated inline, so the drawer's group order and the entries\n // inside it cannot disagree about which groups are last.\n const lastGroups = uniqueGroupsArray.filter(g => groupOrderValue(g) === 1);\n const otherGroups = uniqueGroupsArray.filter(g => groupOrderValue(g) === 0);\n const uniqueGroups = [...otherGroups, ...lastGroups] as string[];\n\n const computedTopLevelNav = {\n allowDragAndDrop: plugins?.some((plugin: RebasePlugin) => plugin.hooks?.allowDragAndDrop) ?? false,\n navigationEntries,\n groups: uniqueGroups,\n onNavigationEntriesUpdate: onNavigationEntriesOrderUpdate\n };\n\n // Cache the newly computed navigation result and return the cached reference\n // if it is deeply equal to the previous one, to prevent reference churn.\n const isNavEqual = topLevelNavigationRef.current &&\n equal(topLevelNavigationRef.current.navigationEntries, computedTopLevelNav.navigationEntries) &&\n equal(topLevelNavigationRef.current.groups, computedTopLevelNav.groups) &&\n topLevelNavigationRef.current.allowDragAndDrop === computedTopLevelNav.allowDragAndDrop;\n\n if (isNavEqual) {\n return topLevelNavigationRef.current;\n }\n\n topLevelNavigationRef.current = computedTopLevelNav;\n return computedTopLevelNav;\n }, [\n collections,\n views,\n adminViews,\n navigationGroupMappings,\n urlController.buildAppUrlPath,\n urlController.buildUrlCollectionPath,\n pluginGroups,\n plugins,\n adminMode,\n viewsOrder,\n onNavigationEntriesOrderUpdate\n ]);\n\n return useMemo(() => ({\n topLevelNavigation\n }), [topLevelNavigation]);\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { deepEqual } from "fast-equals";
|
|
2
|
+
import { getSubcollections } from "@rebasepro/common";
|
|
3
|
+
//#region src/hooks/navigation/utils.ts
|
|
4
|
+
var NAVIGATION_DEFAULT_GROUP_NAME = "Views";
|
|
5
|
+
var NAVIGATION_ADMIN_GROUP_NAME = "Admin";
|
|
6
|
+
/**
|
|
7
|
+
* Group names that sink to the bottom of the drawer on their name alone.
|
|
8
|
+
*
|
|
9
|
+
* A magic string, and it stays one for compatibility: apps have been relying on
|
|
10
|
+
* `group: "Settings"` landing last since before there was a flag, and taking it
|
|
11
|
+
* away would silently reshuffle their navigation.
|
|
12
|
+
*
|
|
13
|
+
* It is a bad way to ask for the behaviour, though — it is invisible from the
|
|
14
|
+
* `group?: string` type, and it is defeated by the most ordinary edit there is:
|
|
15
|
+
* translating the label. `group: "Ajustes"` is the same group to a reader and a
|
|
16
|
+
* different one to this comparison, so the ordering just quietly stops
|
|
17
|
+
* happening. Set {@link AppView.pinToBottom} instead, which says so.
|
|
18
|
+
*/
|
|
19
|
+
var NAVIGATION_BOTTOM_GROUP_NAMES = ["Admin", "Settings"];
|
|
20
|
+
/** Whether a group sinks to the bottom by virtue of its name. @see NAVIGATION_BOTTOM_GROUP_NAMES */
|
|
21
|
+
function isBottomPinnedGroupName(groupName) {
|
|
22
|
+
return groupName !== void 0 && NAVIGATION_BOTTOM_GROUP_NAMES.includes(groupName);
|
|
23
|
+
}
|
|
24
|
+
function getGroup(collectionOrView) {
|
|
25
|
+
const trimmed = collectionOrView.group?.trim();
|
|
26
|
+
if (!trimmed || trimmed === "") return NAVIGATION_DEFAULT_GROUP_NAME;
|
|
27
|
+
return trimmed;
|
|
28
|
+
}
|
|
29
|
+
function computeNavigationGroups({ navigationGroupMappings, collections, views, plugins }) {
|
|
30
|
+
let result = navigationGroupMappings ? navigationGroupMappings.map((g) => ({
|
|
31
|
+
name: g.name,
|
|
32
|
+
entries: [...g.entries],
|
|
33
|
+
...g.collapsedByDefault !== void 0 && { collapsedByDefault: g.collapsedByDefault }
|
|
34
|
+
})) : navigationGroupMappings;
|
|
35
|
+
if (plugins) result = plugins.reduce((acc, plugin) => {
|
|
36
|
+
if (plugin.hooks?.navigationEntries) plugin.hooks.navigationEntries.forEach((entry) => {
|
|
37
|
+
const { name, entries } = entry;
|
|
38
|
+
const existingGroup = acc.find((g) => g.name === name);
|
|
39
|
+
if (existingGroup) existingGroup.entries.push(...entries);
|
|
40
|
+
else acc.push({
|
|
41
|
+
name,
|
|
42
|
+
entries: [...entries]
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
return acc;
|
|
46
|
+
}, result ?? []);
|
|
47
|
+
const assignedEntries = /* @__PURE__ */ new Set();
|
|
48
|
+
if (result) result.forEach((group) => {
|
|
49
|
+
group.entries.forEach((entry) => assignedEntries.add(entry));
|
|
50
|
+
});
|
|
51
|
+
const unassignedGroupMap = {};
|
|
52
|
+
(collections ?? []).forEach((collection) => {
|
|
53
|
+
if (collection.hideFromNavigation) return;
|
|
54
|
+
const entry = collection.slug;
|
|
55
|
+
if (!assignedEntries.has(entry)) {
|
|
56
|
+
const groupName = getGroup(collection);
|
|
57
|
+
if (!unassignedGroupMap[groupName]) unassignedGroupMap[groupName] = [];
|
|
58
|
+
unassignedGroupMap[groupName].push(entry);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
(views ?? []).forEach((view) => {
|
|
62
|
+
if (view.hideFromNavigation) return;
|
|
63
|
+
const entry = Array.isArray(view.slug) ? view.slug[0] : view.slug;
|
|
64
|
+
if (!assignedEntries.has(entry)) {
|
|
65
|
+
const groupName = getGroup(view);
|
|
66
|
+
if (!unassignedGroupMap[groupName]) unassignedGroupMap[groupName] = [];
|
|
67
|
+
unassignedGroupMap[groupName].push(entry);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
Object.entries(unassignedGroupMap).forEach(([groupName, entries]) => {
|
|
71
|
+
if (result) {
|
|
72
|
+
const existingGroup = result.find((g) => g.name === groupName);
|
|
73
|
+
if (existingGroup) existingGroup.entries.push(...entries);
|
|
74
|
+
else result.push({
|
|
75
|
+
name: groupName,
|
|
76
|
+
entries
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
if (!result) {
|
|
81
|
+
result = [];
|
|
82
|
+
const groupMap = {};
|
|
83
|
+
(collections ?? []).forEach((collection) => {
|
|
84
|
+
if (collection.hideFromNavigation) return;
|
|
85
|
+
const name = getGroup(collection);
|
|
86
|
+
const entry = collection.slug;
|
|
87
|
+
if (!groupMap[name]) groupMap[name] = [];
|
|
88
|
+
groupMap[name].push(entry);
|
|
89
|
+
});
|
|
90
|
+
(views ?? []).forEach((view) => {
|
|
91
|
+
if (view.hideFromNavigation) return;
|
|
92
|
+
const name = getGroup(view);
|
|
93
|
+
const entry = Array.isArray(view.slug) ? view.slug[0] : view.slug;
|
|
94
|
+
if (!groupMap[name]) groupMap[name] = [];
|
|
95
|
+
groupMap[name].push(entry);
|
|
96
|
+
});
|
|
97
|
+
result = Object.entries(groupMap).map(([name, entries]) => ({
|
|
98
|
+
name,
|
|
99
|
+
entries
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
result.forEach((group) => {
|
|
103
|
+
group.entries = [...new Set(group.entries)];
|
|
104
|
+
});
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
function areCollectionListsEqual(a, b, visitedSlugs = []) {
|
|
108
|
+
if (a.length !== b.length) return false;
|
|
109
|
+
const aCopy = [...a];
|
|
110
|
+
const bCopy = [...b];
|
|
111
|
+
const aSorted = aCopy.sort((x, y) => x.slug.localeCompare(y.slug));
|
|
112
|
+
const bSorted = bCopy.sort((x, y) => x.slug.localeCompare(y.slug));
|
|
113
|
+
return aSorted.every((value, index) => areCollectionsEqual(value, bSorted[index], visitedSlugs));
|
|
114
|
+
}
|
|
115
|
+
function areCollectionsEqual(a, b, visitedSlugs = []) {
|
|
116
|
+
if (a.slug !== b.slug) return false;
|
|
117
|
+
if (visitedSlugs.includes(a.slug)) return true;
|
|
118
|
+
const newVisited = [...visitedSlugs, a.slug];
|
|
119
|
+
if (!areCollectionListsEqual(getSubcollections(a), getSubcollections(b), newVisited)) return false;
|
|
120
|
+
return deepEqual(Object.fromEntries(Object.entries(a).filter(([k, v]) => typeof v !== "function" && k !== "subcollections")), Object.fromEntries(Object.entries(b).filter(([k, v]) => typeof v !== "function" && k !== "subcollections")));
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
export { NAVIGATION_ADMIN_GROUP_NAME, NAVIGATION_BOTTOM_GROUP_NAMES, NAVIGATION_DEFAULT_GROUP_NAME, areCollectionListsEqual, areCollectionsEqual, computeNavigationGroups, getGroup, isBottomPinnedGroupName };
|
|
124
|
+
|
|
125
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../../src/hooks/navigation/utils.ts"],"sourcesContent":["\nimport type { AppView, RebasePlugin, NavigationGroupMapping, AdminCollection } from \"@rebasepro/cms-types\";\n\nimport { getSubcollections } from \"@rebasepro/common\";\nimport { deepEqual as equal } from \"fast-equals\";\n\nexport const NAVIGATION_DEFAULT_GROUP_NAME = \"Views\";\nexport const NAVIGATION_ADMIN_GROUP_NAME = \"Admin\";\n\n/**\n * Group names that sink to the bottom of the drawer on their name alone.\n *\n * A magic string, and it stays one for compatibility: apps have been relying on\n * `group: \"Settings\"` landing last since before there was a flag, and taking it\n * away would silently reshuffle their navigation.\n *\n * It is a bad way to ask for the behaviour, though — it is invisible from the\n * `group?: string` type, and it is defeated by the most ordinary edit there is:\n * translating the label. `group: \"Ajustes\"` is the same group to a reader and a\n * different one to this comparison, so the ordering just quietly stops\n * happening. Set {@link AppView.pinToBottom} instead, which says so.\n */\nexport const NAVIGATION_BOTTOM_GROUP_NAMES = [\"Admin\", \"Settings\"] as const;\n\n/** Whether a group sinks to the bottom by virtue of its name. @see NAVIGATION_BOTTOM_GROUP_NAMES */\nexport function isBottomPinnedGroupName(groupName?: string): boolean {\n return groupName !== undefined && (NAVIGATION_BOTTOM_GROUP_NAMES as readonly string[]).includes(groupName);\n}\n\nexport function getGroup(collectionOrView: AdminCollection | AppView) {\n const trimmed = collectionOrView.group?.trim();\n if (!trimmed || trimmed === \"\") {\n return NAVIGATION_DEFAULT_GROUP_NAME;\n }\n return trimmed;\n}\n\nexport function computeNavigationGroups({\n navigationGroupMappings,\n collections,\n views,\n plugins\n}: {\n navigationGroupMappings?: NavigationGroupMapping[],\n collections?: AdminCollection[],\n views?: AppView[],\n plugins?: RebasePlugin[]\n}): NavigationGroupMapping[] {\n\n // Deep clone the input groups upfront to avoid mutating the caller's data\n let result = navigationGroupMappings\n ? navigationGroupMappings.map(g => ({\n name: g.name,\n entries: [...g.entries],\n ...(g.collapsedByDefault !== undefined && { collapsedByDefault: g.collapsedByDefault })\n }))\n : navigationGroupMappings;\n\n // Merge plugin navigation entries\n if (plugins) {\n result = plugins.reduce((acc, plugin) => {\n if (plugin.hooks?.navigationEntries) {\n plugin.hooks.navigationEntries.forEach((entry) => {\n const {\n name,\n entries\n } = entry;\n const existingGroup = acc.find(g => g.name === name);\n if (existingGroup) {\n existingGroup.entries.push(...entries);\n } else {\n acc.push({\n name,\n entries: [...entries]\n });\n }\n });\n\n }\n return acc;\n }, result ?? []);\n }\n\n // Track all entries that are already assigned to groups\n const assignedEntries = new Set<string>();\n if (result) {\n result.forEach(group => {\n group.entries.forEach(entry => assignedEntries.add(entry));\n });\n }\n\n // Find collections and views that are NOT in any persisted group\n const unassignedGroupMap: Record<string, string[]> = {};\n\n // Check collections\n (collections ?? []).forEach(collection => {\n if (collection.hideFromNavigation) return;\n const entry = collection.slug;\n if (!assignedEntries.has(entry)) {\n const groupName = getGroup(collection);\n if (!unassignedGroupMap[groupName]) unassignedGroupMap[groupName] = [];\n unassignedGroupMap[groupName].push(entry);\n }\n });\n\n // Check views\n (views ?? []).forEach(view => {\n if (view.hideFromNavigation) return;\n const entry = Array.isArray(view.slug) ? view.slug[0] : view.slug;\n if (!assignedEntries.has(entry)) {\n const groupName = getGroup(view);\n if (!unassignedGroupMap[groupName]) unassignedGroupMap[groupName] = [];\n unassignedGroupMap[groupName].push(entry);\n }\n });\n\n // Merge unassigned entries into existing groups or create new groups\n Object.entries(unassignedGroupMap).forEach(([groupName, entries]) => {\n if (result) {\n const existingGroup = result.find(g => g.name === groupName);\n if (existingGroup) {\n existingGroup.entries.push(...entries);\n } else {\n result.push({\n name: groupName,\n entries\n });\n }\n }\n });\n\n if (!result) {\n // No persisted data at all - create from scratch\n result = [];\n const groupMap: Record<string, string[]> = {};\n\n // Add collections\n (collections ?? []).forEach(collection => {\n if (collection.hideFromNavigation) return;\n const name = getGroup(collection);\n const entry = collection.slug;\n if (!groupMap[name]) groupMap[name] = [];\n groupMap[name].push(entry);\n });\n\n // Add views\n (views ?? []).forEach(view => {\n if (view.hideFromNavigation) return;\n const name = getGroup(view);\n const entry = Array.isArray(view.slug) ? view.slug[0] : view.slug;\n if (!groupMap[name]) groupMap[name] = [];\n groupMap[name].push(entry);\n });\n\n // Convert groupMap to result array\n result = Object.entries(groupMap).map(([name, entries]) => ({\n name,\n entries\n }));\n }\n\n // Remove duplicates in entries\n result.forEach(group => {\n group.entries = [...new Set(group.entries)];\n });\n\n return result;\n}\n\nexport function areCollectionListsEqual(a: AdminCollection[], b: AdminCollection[], visitedSlugs: string[] = []) {\n if (a.length !== b.length) {\n return false;\n }\n const aCopy = [...a];\n const bCopy = [...b];\n const aSorted = aCopy.sort((x, y) => x.slug.localeCompare(y.slug));\n const bSorted = bCopy.sort((x, y) => x.slug.localeCompare(y.slug));\n return aSorted.every((value, index) => areCollectionsEqual(value, bSorted[index], visitedSlugs));\n}\n\nexport function areCollectionsEqual(a: AdminCollection, b: AdminCollection, visitedSlugs: string[] = []) {\n if (a.slug !== b.slug) {\n return false;\n }\n if (visitedSlugs.includes(a.slug)) {\n return true;\n }\n const newVisited = [...visitedSlugs, a.slug];\n\n if (!areCollectionListsEqual(getSubcollections(a), getSubcollections(b), newVisited)) {\n return false;\n }\n const restAWithoutFunctions = Object.fromEntries(\n Object.entries(a).filter(([k, v]) => typeof v !== \"function\" && k !== \"subcollections\")\n );\n const restBWithoutFunctions = Object.fromEntries(\n Object.entries(b).filter(([k, v]) => typeof v !== \"function\" && k !== \"subcollections\")\n );\n return equal(restAWithoutFunctions, restBWithoutFunctions);\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useCollectionRegistryController } from "./navigation/contexts/CollectionRegistryContext.js";
|
|
2
|
+
import { useSidePanel } from "./useSidePanel.js";
|
|
3
|
+
import { useSideDialogsController } from "./useSideDialogsController.js";
|
|
4
|
+
import { useNavigationStateController } from "./navigation/contexts/NavigationStateContext.js";
|
|
5
|
+
import { useUrlController } from "./navigation/contexts/UrlContext.js";
|
|
6
|
+
import { useMemo } from "react";
|
|
7
|
+
import { useRebaseContext } from "@rebasepro/app";
|
|
8
|
+
//#region src/hooks/useAdminContext.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Hook that builds a fully-populated admin context by combining the
|
|
11
|
+
* core {@link RebaseContext} with admin-specific controllers.
|
|
12
|
+
*
|
|
13
|
+
* Use this instead of `useRebaseContext()` in admin components that
|
|
14
|
+
* need to pass context to entity action callbacks, plugin slots,
|
|
15
|
+
* or any consumer that expects admin controllers on the context object.
|
|
16
|
+
*
|
|
17
|
+
* @group Hooks and utilities
|
|
18
|
+
*/
|
|
19
|
+
function useAdminContext() {
|
|
20
|
+
const baseContext = useRebaseContext();
|
|
21
|
+
const sidePanelController = useSidePanel();
|
|
22
|
+
const sideDialogsController = useSideDialogsController();
|
|
23
|
+
const urlController = useUrlController();
|
|
24
|
+
const navigationStateController = useNavigationStateController();
|
|
25
|
+
const collectionRegistryController = useCollectionRegistryController();
|
|
26
|
+
return useMemo(() => ({
|
|
27
|
+
...baseContext,
|
|
28
|
+
sidePanelController,
|
|
29
|
+
sideDialogsController,
|
|
30
|
+
urlController,
|
|
31
|
+
navigationStateController,
|
|
32
|
+
collectionRegistryController
|
|
33
|
+
}), [
|
|
34
|
+
baseContext,
|
|
35
|
+
sidePanelController,
|
|
36
|
+
sideDialogsController,
|
|
37
|
+
urlController,
|
|
38
|
+
navigationStateController,
|
|
39
|
+
collectionRegistryController
|
|
40
|
+
]);
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { useAdminContext };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=useAdminContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAdminContext.js","names":[],"sources":["../../src/hooks/useAdminContext.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useRebaseContext } from \"@rebasepro/app\";\nimport type {\n User\n} from \"@rebasepro/types\";\nimport type {\n AuthController,\n RebaseContext,\n SideDialogsController,\n SidePanelController\n} from \"@rebasepro/cms-types\";\nimport type {\n CollectionRegistryController\n} from \"@rebasepro/types\";\nimport type {\n NavigationStateController,\n UrlController\n} from \"@rebasepro/cms-types\";\nimport { useSidePanel } from \"./useSidePanel\";\nimport { useSideDialogsController } from \"./useSideDialogsController\";\nimport {\n useUrlController,\n useNavigationStateController,\n useCollectionRegistryController\n} from \"./navigation/contexts\";\n\n/**\n * The admin context extends the core RebaseContext with admin-specific\n * controllers that are only available inside the admin routing tree.\n *\n * Use {@link useAdminContext} to obtain an instance.\n * @group Hooks and utilities\n */\nexport type AdminContext<\n DB = Record<string, unknown>,\n USER extends User = User,\n AuthControllerType extends AuthController<USER> = AuthController<USER>\n> = RebaseContext<USER, AuthControllerType> & {\n sidePanelController: SidePanelController;\n sideDialogsController: SideDialogsController;\n urlController: UrlController;\n navigationStateController: NavigationStateController;\n collectionRegistryController: CollectionRegistryController<DB>;\n};\n\n/**\n * Hook that builds a fully-populated admin context by combining the\n * core {@link RebaseContext} with admin-specific controllers.\n *\n * Use this instead of `useRebaseContext()` in admin components that\n * need to pass context to entity action callbacks, plugin slots,\n * or any consumer that expects admin controllers on the context object.\n *\n * @group Hooks and utilities\n */\nexport function useAdminContext<\n DB = Record<string, unknown>,\n USER extends User = User,\n AuthControllerType extends AuthController<USER> = AuthController<USER>\n>(): AdminContext<DB, USER, AuthControllerType> {\n const baseContext = useRebaseContext<USER, AuthControllerType>();\n const sidePanelController = useSidePanel();\n const sideDialogsController = useSideDialogsController();\n const urlController = useUrlController();\n const navigationStateController = useNavigationStateController();\n const collectionRegistryController = useCollectionRegistryController<DB>();\n\n return useMemo(() => ({\n ...baseContext,\n sidePanelController,\n sideDialogsController,\n urlController,\n navigationStateController,\n collectionRegistryController\n }), [\n baseContext,\n sidePanelController,\n sideDialogsController,\n urlController,\n navigationStateController,\n collectionRegistryController\n ]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuDA,SAAgB,kBAIgC;CAC5C,MAAM,cAAc,iBAA2C;CAC/D,MAAM,sBAAsB,aAAa;CACzC,MAAM,wBAAwB,yBAAyB;CACvD,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,4BAA4B,6BAA6B;CAC/D,MAAM,+BAA+B,gCAAoC;CAEzE,OAAO,eAAe;EAClB,GAAG;EACH;EACA;EACA;EACA;EACA;CACJ,IAAI;EACA;EACA;EACA;EACA;EACA;EACA;CACJ,CAAC;AACL"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BreadcrumbContext } from "../contexts/BreacrumbsContext.js";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
//#region src/hooks/useBreadcrumbsController.tsx
|
|
4
|
+
/**
|
|
5
|
+
* Hook to retrieve the BreadcrumbsController.
|
|
6
|
+
*
|
|
7
|
+
* Consider that in order to use this hook you need to have a parent
|
|
8
|
+
* `Rebase`
|
|
9
|
+
*
|
|
10
|
+
* @see BreadcrumbsController
|
|
11
|
+
* @group Hooks and utilities
|
|
12
|
+
*/
|
|
13
|
+
var useBreadcrumbsController = () => useContext(BreadcrumbContext);
|
|
14
|
+
//#endregion
|
|
15
|
+
export { useBreadcrumbsController };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=useBreadcrumbsController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBreadcrumbsController.js","names":[],"sources":["../../src/hooks/useBreadcrumbsController.tsx"],"sourcesContent":["import { useContext } from \"react\";\nimport { BreadcrumbContext } from \"../contexts/BreacrumbsContext\";\nimport { BreadcrumbEntry, BreadcrumbsController } from \"@rebasepro/cms-types\";\n\nexport type { BreadcrumbEntry, BreadcrumbsController };\n\n\n/**\n * Hook to retrieve the BreadcrumbsController.\n *\n * Consider that in order to use this hook you need to have a parent\n * `Rebase`\n *\n * @see BreadcrumbsController\n * @group Hooks and utilities\n */\nexport const useBreadcrumbsController = (): BreadcrumbsController => useContext(BreadcrumbContext);\n"],"mappings":";;;;;;;;;;;;AAgBA,IAAa,iCAAwD,WAAW,iBAAiB"}
|