@rebasepro/admin 0.0.1-canary.eae7889 → 0.0.1-canary.eb08332

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (716) hide show
  1. package/LICENSE +21 -6
  2. package/README.md +139 -0
  3. package/dist/CollectionEditorDialog-DKGlYDPc.js +3630 -0
  4. package/dist/CollectionEditorDialog-DKGlYDPc.js.map +1 -0
  5. package/dist/PropertyEditView-h0N-AMCY.js +3808 -0
  6. package/dist/PropertyEditView-h0N-AMCY.js.map +1 -0
  7. package/dist/RouterCollectionsStudioView-DdEStpFk.js +192 -0
  8. package/dist/RouterCollectionsStudioView-DdEStpFk.js.map +1 -0
  9. package/dist/collection_editor/ConfigControllerProvider.d.ts +2 -11
  10. package/dist/collection_editor/_cms_internals.d.ts +4 -4
  11. package/dist/collection_editor/api/generateCollectionApi.d.ts +10 -9
  12. package/dist/collection_editor/extensibility_types.d.ts +135 -0
  13. package/dist/collection_editor/index.d.ts +6 -1
  14. package/dist/collection_editor/pgColumnToProperty.d.ts +3 -3
  15. package/dist/collection_editor/serializable_types.d.ts +370 -0
  16. package/dist/collection_editor/serializable_utils.d.ts +50 -0
  17. package/dist/collection_editor/types/collection_editor_controller.d.ts +11 -10
  18. package/dist/collection_editor/types/collection_inference.d.ts +2 -2
  19. package/dist/collection_editor/types/config_controller.d.ts +21 -14
  20. package/dist/collection_editor/ui/AddKanbanColumnAction.d.ts +7 -5
  21. package/dist/collection_editor/ui/CollectionViewHeaderAction.d.ts +7 -5
  22. package/dist/collection_editor/ui/EditorCollectionAction.d.ts +1 -1
  23. package/dist/collection_editor/ui/EditorCollectionActionStart.d.ts +1 -1
  24. package/dist/collection_editor/ui/EditorEntityAction.d.ts +1 -1
  25. package/dist/collection_editor/ui/HomePageEditorCollectionAction.d.ts +1 -1
  26. package/dist/collection_editor/ui/KanbanSetupAction.d.ts +7 -5
  27. package/dist/collection_editor/ui/MissingReferenceWidget.d.ts +1 -1
  28. package/dist/collection_editor/ui/NewCollectionButton.d.ts +1 -1
  29. package/dist/collection_editor/ui/NewCollectionCard.d.ts +1 -1
  30. package/dist/collection_editor/ui/PropertyAddColumnComponent.d.ts +6 -5
  31. package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.d.ts +4 -4
  32. package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.d.ts +1 -1
  33. package/dist/collection_editor/ui/collection_editor/CollectionDetailsForm.d.ts +7 -7
  34. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +10 -11
  35. package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.d.ts +4 -4
  36. package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.d.ts +4 -3
  37. package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +17 -7
  38. package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.d.ts +2 -1
  39. package/dist/collection_editor/ui/collection_editor/CollectionRelationsTab.d.ts +2 -1
  40. package/dist/collection_editor/ui/collection_editor/CollectionStudioView.d.ts +14 -1
  41. package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.d.ts +1 -9
  42. package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.d.ts +25 -2
  43. package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.d.ts +4 -2
  44. package/dist/collection_editor/ui/collection_editor/EntityActionsEditTab.d.ts +4 -3
  45. package/dist/collection_editor/ui/collection_editor/EntityActionsSelectDialog.d.ts +2 -1
  46. package/dist/collection_editor/ui/collection_editor/EntityCustomViewsSelectDialog.d.ts +2 -1
  47. package/dist/collection_editor/ui/collection_editor/EnumForm.d.ts +2 -1
  48. package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.d.ts +8 -4
  49. package/dist/collection_editor/ui/collection_editor/GetCodeDialog.d.ts +4 -3
  50. package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.d.ts +2 -1
  51. package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.d.ts +3 -3
  52. package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +17 -5
  53. package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.d.ts +2 -2
  54. package/dist/collection_editor/ui/collection_editor/PropertyTree.d.ts +2 -2
  55. package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.d.ts +15 -0
  56. package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.d.ts +14 -0
  57. package/dist/collection_editor/ui/collection_editor/SubcollectionsEditTab.d.ts +8 -6
  58. package/dist/collection_editor/ui/collection_editor/SwitchControl.d.ts +3 -2
  59. package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.d.ts +1 -1
  60. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.d.ts +1 -1
  61. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.d.ts +3 -2
  62. package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.d.ts +2 -1
  63. package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.d.ts +2 -1
  64. package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.d.ts +2 -1
  65. package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.d.ts +2 -1
  66. package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.d.ts +2 -1
  67. package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.d.ts +2 -1
  68. package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.d.ts +2 -1
  69. package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.d.ts +2 -1
  70. package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.d.ts +3 -2
  71. package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.d.ts +3 -8
  72. package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.d.ts +2 -1
  73. package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.d.ts +2 -1
  74. package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.d.ts +2 -1
  75. package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.d.ts +2 -1
  76. package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.d.ts +4 -0
  77. package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.d.ts +2 -1
  78. package/dist/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.d.ts +2 -1
  79. package/dist/collection_editor/ui/collection_editor/properties/conditions/ConditionsPanel.d.ts +1 -1
  80. package/dist/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.d.ts +2 -1
  81. package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.d.ts +2 -1
  82. package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.d.ts +2 -1
  83. package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.d.ts +2 -1
  84. package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.d.ts +2 -1
  85. package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.d.ts +1 -1
  86. package/dist/collection_editor/ui/collection_editor/templates/blog_template.d.ts +2 -2
  87. package/dist/collection_editor/ui/collection_editor/templates/pages_template.d.ts +2 -2
  88. package/dist/collection_editor/ui/collection_editor/templates/products_template.d.ts +2 -2
  89. package/dist/collection_editor/ui/collection_editor/templates/users_template.d.ts +2 -2
  90. package/dist/collection_editor/useJsonCollectionsConfigController.d.ts +37 -0
  91. package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +2 -2
  92. package/dist/collection_editor/useSafeSnackbarController.d.ts +2 -0
  93. package/dist/collection_editor/validateCollectionJson.d.ts +2 -2
  94. package/dist/collection_editor_ui.d.ts +4 -0
  95. package/dist/collection_editor_ui.js +33 -11
  96. package/dist/collection_editor_ui.js.map +1 -1
  97. package/dist/components/ArrayContainer.d.ts +5 -5
  98. package/dist/components/ClearFilterSortButton.d.ts +1 -1
  99. package/dist/components/CollectionEditorDialogs.d.ts +2 -1
  100. package/dist/components/CollectionPanel.d.ts +58 -0
  101. package/dist/components/{EntityCollectionTable/EntityCollectionRowActions.d.ts → CollectionTableBinding/CollectionRowActions.d.ts} +5 -5
  102. package/dist/components/CollectionTableBinding/CollectionTableBinding.d.ts +28 -0
  103. package/dist/components/{EntityCollectionTable/EntityCollectionTableProps.d.ts → CollectionTableBinding/CollectionTableBindingProps.d.ts} +4 -4
  104. package/dist/components/{EntityCollectionTable → CollectionTableBinding}/column_utils.d.ts +2 -2
  105. package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableMultipleRelationField.d.ts +6 -6
  106. package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableReferenceField.d.ts +6 -6
  107. package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableRelationField.d.ts +6 -6
  108. package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableRelationSelectorField.d.ts +3 -2
  109. package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableStorageUpload.d.ts +4 -4
  110. package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/VirtualTableSelect.d.ts +1 -1
  111. package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/VirtualTableUserSelect.d.ts +1 -1
  112. package/dist/components/CollectionTableBinding/index.d.ts +6 -0
  113. package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/CollectionTableToolbar.d.ts +5 -1
  114. package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/EntityTableCell.d.ts +3 -3
  115. package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/EntityTableCellActions.d.ts +1 -1
  116. package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/common.d.ts +2 -2
  117. package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/PopupFormField.d.ts +7 -6
  118. package/dist/components/{EntityCollectionTable → CollectionTableBinding}/table_bindings.d.ts +4 -3
  119. package/dist/components/CollectionViewBinding/BoardCardBinding.d.ts +31 -0
  120. package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.d.ts +22 -0
  121. package/dist/components/{EntityCollectionView/EntityCollectionCardView.d.ts → CollectionViewBinding/CollectionCardViewBinding.d.ts} +5 -5
  122. package/dist/components/CollectionViewBinding/CollectionListViewBinding.d.ts +50 -0
  123. package/dist/components/CollectionViewBinding/CollectionViewActions.d.ts +20 -0
  124. package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +41 -0
  125. package/dist/components/CollectionViewBinding/CollectionViewStartActions.d.ts +21 -0
  126. package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +21 -0
  127. package/dist/components/CollectionViewBinding/FilterPresetsButton.d.ts +22 -0
  128. package/dist/components/{EntityCollectionView → CollectionViewBinding}/FiltersDialog.d.ts +3 -2
  129. package/dist/components/{EntityCollectionView → CollectionViewBinding}/SplitListView.d.ts +6 -5
  130. package/dist/components/{EntityCollectionView → CollectionViewBinding}/ViewModeToggle.d.ts +2 -1
  131. package/dist/components/{EntityCollectionView → CollectionViewBinding}/hooks/useCollectionInlineEditor.d.ts +3 -3
  132. package/dist/components/{EntityCollectionView → CollectionViewBinding}/hooks/useKanbanDragAndDrop.d.ts +7 -6
  133. package/dist/components/{EntityCollectionView → CollectionViewBinding}/useBoardDataController.d.ts +2 -2
  134. package/dist/components/{EntityCollectionView/useEntityPreviewSlots.d.ts → CollectionViewBinding/usePreviewSlots.d.ts} +5 -5
  135. package/dist/components/DefaultAppBar.d.ts +18 -1
  136. package/dist/components/DefaultDrawer.d.ts +53 -5
  137. package/dist/components/DeleteEntityDialog.d.ts +6 -5
  138. package/dist/components/DetailViewBinding.d.ts +28 -0
  139. package/dist/components/DrawerNavigationGroup.d.ts +1 -1
  140. package/dist/components/DrawerNavigationItem.d.ts +1 -1
  141. package/dist/components/EditFormActions.d.ts +3 -0
  142. package/dist/components/EditViewBinding.d.ts +58 -0
  143. package/dist/components/{EntityPreview.d.ts → EntityPreviewBinding.d.ts} +14 -14
  144. package/dist/components/EntityViewBinding.d.ts +13 -0
  145. package/dist/components/FieldCaption.d.ts +1 -1
  146. package/dist/components/HomePage/ContentHomePage.d.ts +1 -1
  147. package/dist/components/HomePage/FavouritesView.d.ts +1 -1
  148. package/dist/components/HomePage/HomePageDnD.d.ts +7 -7
  149. package/dist/components/HomePage/NavigationCard.d.ts +1 -1
  150. package/dist/components/HomePage/NavigationCardBinding.d.ts +2 -1
  151. package/dist/components/HomePage/NavigationGroup.d.ts +2 -2
  152. package/dist/components/HomePage/RenameGroupDialog.d.ts +2 -1
  153. package/dist/components/HomePage/SmallNavigationCard.d.ts +1 -1
  154. package/dist/components/JsonPreviewBinding.d.ts +4 -0
  155. package/dist/components/PropertyCollectionView.d.ts +3 -2
  156. package/dist/components/PropertyIdCopyTooltip.d.ts +3 -3
  157. package/dist/components/{RebaseCMS.d.ts → RebaseAdmin.d.ts} +2 -2
  158. package/dist/components/RebaseAuthGate.d.ts +1 -1
  159. package/dist/components/RebaseLayout.d.ts +6 -5
  160. package/dist/components/RebaseNavigation.d.ts +2 -2
  161. package/dist/components/RebaseRouteDefs.d.ts +2 -2
  162. package/dist/components/RebaseShell.d.ts +2 -1
  163. package/dist/components/ReferenceTable/{EntitySelectionTable.d.ts → SelectionTableBinding.d.ts} +6 -6
  164. package/dist/components/ReferenceWidget.d.ts +3 -2
  165. package/dist/components/RelationSelector.d.ts +1 -1
  166. package/dist/components/SearchIconsView.d.ts +2 -1
  167. package/dist/components/SelectableTable/SelectableTable.d.ts +11 -11
  168. package/dist/components/SelectableTable/SelectableTableContext.d.ts +3 -3
  169. package/dist/components/SelectableTable/SelectionStore.d.ts +16 -22
  170. package/dist/components/SelectableTable/filters/BooleanFilterField.d.ts +9 -3
  171. package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +10 -3
  172. package/dist/components/SelectableTable/filters/FilterFieldBinding.d.ts +40 -0
  173. package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +10 -3
  174. package/dist/components/SelectableTable/filters/RelationFilterField.d.ts +8 -1
  175. package/dist/components/SelectableTable/filters/StringNumberFilterField.d.ts +10 -3
  176. package/dist/components/SideDialogs.d.ts +2 -2
  177. package/dist/components/SidePanelBinding.d.ts +11 -0
  178. package/dist/components/{SideEntityProvider.d.ts → SidePanelProvider.d.ts} +8 -8
  179. package/dist/components/admin/CreationResultDialog.d.ts +6 -0
  180. package/dist/components/admin/index.d.ts +1 -3
  181. package/dist/components/app/AppBar.d.ts +1 -1
  182. package/dist/components/app/Drawer.d.ts +9 -2
  183. package/dist/components/common/default_entity_actions.d.ts +8 -1
  184. package/dist/components/field_configs.d.ts +1 -1
  185. package/dist/components/history/EntityHistoryEntry.d.ts +3 -3
  186. package/dist/components/history/EntityHistoryView.d.ts +1 -1
  187. package/dist/components/history/LastEditedByFormAction.d.ts +2 -1
  188. package/dist/components/history/LastEditedByIndicator.d.ts +4 -3
  189. package/dist/components/history/UserChip.d.ts +1 -1
  190. package/dist/components/index.d.ts +16 -13
  191. package/dist/contexts/SidePanelControllerContext.d.ts +3 -0
  192. package/dist/data_export/export/BasicExportAction.d.ts +2 -1
  193. package/dist/data_export/export/ExportCollectionAction.d.ts +4 -4
  194. package/dist/data_export/export/export.d.ts +3 -3
  195. package/dist/data_import/components/DataNewPropertiesMapping.d.ts +1 -1
  196. package/dist/data_import/components/ImportFileUpload.d.ts +1 -1
  197. package/dist/data_import/components/ImportNewPropertyFieldPreview.d.ts +2 -1
  198. package/dist/data_import/components/ImportSaveInProgress.d.ts +3 -3
  199. package/dist/data_import/import/ImportCollectionAction.d.ts +4 -3
  200. package/dist/data_import/utils/data.d.ts +1 -1
  201. package/dist/data_import/utils/file_headers.d.ts +6 -1
  202. package/dist/data_import/utils/file_to_json.d.ts +1 -11
  203. package/dist/data_import/utils/transforms.d.ts +11 -0
  204. package/dist/editor/components/SlashCommandMenu.d.ts +2 -1
  205. package/dist/editor/components/editor-bubble.d.ts +5 -1
  206. package/dist/editor/components/image-bubble.d.ts +5 -1
  207. package/dist/editor/components/index.d.ts +3 -3
  208. package/dist/editor/components/table-bubble.d.ts +5 -1
  209. package/dist/editor/editor.d.ts +4 -4
  210. package/dist/editor/nodeViews/ReactNodeView.d.ts +4 -1
  211. package/dist/editor/selectors/color-selector.d.ts +1 -1
  212. package/dist/editor/selectors/link-selector.d.ts +1 -1
  213. package/dist/editor/selectors/node-selector.d.ts +1 -1
  214. package/dist/editor/selectors/text-buttons.d.ts +1 -1
  215. package/dist/editor/useProseMirror.d.ts +2 -2
  216. package/dist/editor/utils/remove_classes.d.ts +1 -1
  217. package/dist/editor.js +2625 -3569
  218. package/dist/editor.js.map +1 -1
  219. package/dist/form/EntityForm.d.ts +11 -9
  220. package/dist/form/EntityFormActions.d.ts +2 -1
  221. package/dist/form/EntityFormBinding.d.ts +27 -0
  222. package/dist/form/PropertyFieldBinding.d.ts +1 -1
  223. package/dist/form/components/FieldHelperText.d.ts +1 -1
  224. package/dist/form/components/FormEntry.d.ts +1 -1
  225. package/dist/form/components/FormLayout.d.ts +1 -1
  226. package/dist/form/components/LabelWithIconAndTooltip.d.ts +1 -1
  227. package/dist/form/components/LocalChangesMenu.d.ts +3 -2
  228. package/dist/form/components/StorageItemPreview.d.ts +2 -1
  229. package/dist/form/components/StorageUploadProgress.d.ts +10 -4
  230. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +2 -1
  231. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +2 -1
  232. package/dist/form/field_bindings/BlockFieldBinding.d.ts +2 -1
  233. package/dist/form/field_bindings/DateTimeFieldBinding.d.ts +2 -1
  234. package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +2 -1
  235. package/dist/form/field_bindings/MapFieldBinding.d.ts +2 -1
  236. package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +4 -3
  237. package/dist/form/field_bindings/MultiSelectFieldBinding.d.ts +2 -1
  238. package/dist/form/field_bindings/MultipleRelationFieldBinding.d.ts +2 -1
  239. package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +2 -1
  240. package/dist/form/field_bindings/ReferenceFieldBinding.d.ts +2 -1
  241. package/dist/form/field_bindings/RelationFieldBinding.d.ts +2 -1
  242. package/dist/form/field_bindings/RepeatFieldBinding.d.ts +2 -1
  243. package/dist/form/field_bindings/SelectFieldBinding.d.ts +2 -1
  244. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +5 -4
  245. package/dist/form/field_bindings/SwitchFieldBinding.d.ts +2 -1
  246. package/dist/form/field_bindings/TextFieldBinding.d.ts +2 -1
  247. package/dist/form/field_bindings/UserSelectFieldBinding.d.ts +2 -1
  248. package/dist/form/field_bindings/VectorFieldBinding.d.ts +12 -0
  249. package/dist/form/form_utils.d.ts +8 -0
  250. package/dist/form/index.d.ts +6 -2
  251. package/dist/form/validation.d.ts +3 -3
  252. package/dist/history-C0FdqGNz.js +311 -0
  253. package/dist/history-C0FdqGNz.js.map +1 -0
  254. package/dist/hooks/index.d.ts +4 -4
  255. package/dist/hooks/navigation/contexts/CollectionRegistryContext.d.ts +2 -2
  256. package/dist/hooks/navigation/useAsyncResolver.d.ts +26 -0
  257. package/dist/hooks/navigation/useBuildCollectionRegistryController.d.ts +2 -0
  258. package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +6 -8
  259. package/dist/hooks/navigation/useNavigationResolution.d.ts +6 -7
  260. package/dist/hooks/navigation/useResolvedCollections.d.ts +11 -7
  261. package/dist/hooks/navigation/useResolvedViews.d.ts +2 -5
  262. package/dist/hooks/navigation/useTopLevelNavigation.d.ts +3 -3
  263. package/dist/hooks/navigation/utils.d.ts +5 -5
  264. package/dist/hooks/useBreadcrumbsController.d.ts +2 -32
  265. package/dist/hooks/useBuildSidePanel.d.ts +6 -0
  266. package/dist/hooks/useCMSContext.d.ts +2 -2
  267. package/dist/hooks/{useEntityHistory.d.ts → useHistory.d.ts} +2 -2
  268. package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
  269. package/dist/hooks/{useEntitySelectionDialog.d.ts → useSelectionDialog.d.ts} +2 -2
  270. package/dist/hooks/useSideDialogsController.d.ts +1 -1
  271. package/dist/hooks/useSidePanel.d.ts +11 -0
  272. package/dist/index.d.ts +6 -3
  273. package/dist/index.js +2 -799
  274. package/dist/markdown-CklalUUk.js +526 -0
  275. package/dist/markdown-CklalUUk.js.map +1 -0
  276. package/dist/preview/components/ArrayEnumPreview.d.ts +2 -1
  277. package/dist/preview/components/EmptyValue.d.ts +2 -1
  278. package/dist/preview/components/EnumValuesChip.d.ts +1 -1
  279. package/dist/preview/components/ImagePreview.d.ts +2 -1
  280. package/dist/preview/components/ReferencePreview.d.ts +2 -1
  281. package/dist/preview/components/RelationPreview.d.ts +2 -1
  282. package/dist/preview/components/StorageThumbnail.d.ts +3 -1
  283. package/dist/preview/components/UrlComponentPreview.d.ts +1 -0
  284. package/dist/preview/components/UserPreview.d.ts +6 -3
  285. package/dist/preview/property_previews/ArrayOfMapsPreview.d.ts +2 -1
  286. package/dist/preview/property_previews/ArrayOfReferencesPreview.d.ts +1 -1
  287. package/dist/preview/property_previews/ArrayOfRelationsPreview.d.ts +1 -1
  288. package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.d.ts +2 -1
  289. package/dist/preview/property_previews/ArrayOfStringsPreview.d.ts +2 -1
  290. package/dist/preview/property_previews/ArrayOneOfPreview.d.ts +2 -1
  291. package/dist/preview/property_previews/ArrayPropertyEnumPreview.d.ts +1 -1
  292. package/dist/preview/property_previews/ArrayPropertyPreview.d.ts +2 -1
  293. package/dist/preview/property_previews/MapPropertyPreview.d.ts +3 -2
  294. package/dist/preview/property_previews/SkeletonPropertyComponent.d.ts +5 -4
  295. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  296. package/dist/routes/CustomViewRoute.d.ts +2 -1
  297. package/dist/routes/RebaseRoute.d.ts +1 -1
  298. package/dist/src-DLAFyeZI.js +24222 -0
  299. package/dist/src-DLAFyeZI.js.map +1 -0
  300. package/dist/types/components/EntityFormActionsProps.d.ts +4 -4
  301. package/dist/types/components/EntityFormProps.d.ts +65 -5
  302. package/dist/types/components/PropertyPreviewProps.d.ts +6 -1
  303. package/dist/types/components/formex.d.ts +1 -40
  304. package/dist/types/fields.d.ts +23 -12
  305. package/dist/util/dataControllerAdapter.d.ts +27 -0
  306. package/dist/util/navigation_utils.d.ts +16 -6
  307. package/dist/util/previews.d.ts +8 -3
  308. package/dist/util/propertyConfigMapper.d.ts +17 -0
  309. package/dist/util/property_utils.d.ts +3 -3
  310. package/dist/util/resolutions.d.ts +1 -2
  311. package/dist/util/view_constants.d.ts +6 -0
  312. package/package.json +56 -55
  313. package/src/collection_editor/ConfigControllerProvider.tsx +37 -53
  314. package/src/collection_editor/_cms_internals.ts +4 -4
  315. package/src/collection_editor/api/generateCollectionApi.ts +10 -9
  316. package/src/collection_editor/extensibility_types.ts +168 -0
  317. package/src/collection_editor/index.ts +47 -3
  318. package/src/collection_editor/pgColumnToProperty.ts +23 -6
  319. package/src/collection_editor/serializable_types.ts +474 -0
  320. package/src/collection_editor/serializable_utils.ts +576 -0
  321. package/src/collection_editor/types/collection_editor_controller.tsx +8 -11
  322. package/src/collection_editor/types/collection_inference.ts +2 -2
  323. package/src/collection_editor/types/config_controller.tsx +14 -14
  324. package/src/collection_editor/ui/AddKanbanColumnAction.tsx +21 -9
  325. package/src/collection_editor/ui/CollectionViewHeaderAction.tsx +8 -8
  326. package/src/collection_editor/ui/EditorCollectionAction.tsx +9 -14
  327. package/src/collection_editor/ui/EditorCollectionActionStart.tsx +13 -18
  328. package/src/collection_editor/ui/EditorEntityAction.tsx +9 -14
  329. package/src/collection_editor/ui/HomePageEditorCollectionAction.tsx +13 -19
  330. package/src/collection_editor/ui/KanbanSetupAction.tsx +8 -6
  331. package/src/collection_editor/ui/MissingReferenceWidget.tsx +5 -3
  332. package/src/collection_editor/ui/NewCollectionButton.tsx +4 -4
  333. package/src/collection_editor/ui/NewCollectionCard.tsx +8 -13
  334. package/src/collection_editor/ui/PropertyAddColumnComponent.tsx +11 -16
  335. package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +20 -12
  336. package/src/collection_editor/ui/collection_editor/CollectionDetailsForm.tsx +29 -59
  337. package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +213 -135
  338. package/src/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.tsx +21 -7
  339. package/src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx +29 -23
  340. package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +142 -112
  341. package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +49 -12
  342. package/src/collection_editor/ui/collection_editor/CollectionRelationsTab.tsx +29 -10
  343. package/src/collection_editor/ui/collection_editor/CollectionStudioView.tsx +26 -23
  344. package/src/collection_editor/ui/collection_editor/CollectionsStudioView.tsx +104 -37
  345. package/src/collection_editor/ui/collection_editor/DisplaySettingsForm.tsx +26 -14
  346. package/src/collection_editor/ui/collection_editor/EntityActionsEditTab.tsx +21 -8
  347. package/src/collection_editor/ui/collection_editor/EntityActionsSelectDialog.tsx +1 -1
  348. package/src/collection_editor/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +1 -1
  349. package/src/collection_editor/ui/collection_editor/EnumForm.tsx +20 -5
  350. package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +45 -12
  351. package/src/collection_editor/ui/collection_editor/GetCodeDialog.tsx +10 -12
  352. package/src/collection_editor/ui/collection_editor/KanbanConfigSection.tsx +5 -6
  353. package/src/collection_editor/ui/collection_editor/LayoutModeSwitch.tsx +17 -5
  354. package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +190 -27
  355. package/src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx +58 -49
  356. package/src/collection_editor/ui/collection_editor/PropertyTree.tsx +17 -4
  357. package/src/collection_editor/ui/collection_editor/RouterCollectionStudioView.tsx +44 -0
  358. package/src/collection_editor/ui/collection_editor/RouterCollectionsStudioView.tsx +41 -0
  359. package/src/collection_editor/ui/collection_editor/SubcollectionsEditTab.tsx +27 -13
  360. package/src/collection_editor/ui/collection_editor/SwitchControl.tsx +1 -1
  361. package/src/collection_editor/ui/collection_editor/ViewModeSwitch.tsx +9 -2
  362. package/src/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +4 -4
  363. package/src/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.tsx +4 -4
  364. package/src/collection_editor/ui/collection_editor/properties/BlockPropertyField.tsx +5 -6
  365. package/src/collection_editor/ui/collection_editor/properties/BooleanPropertyField.tsx +1 -1
  366. package/src/collection_editor/ui/collection_editor/properties/CommonPropertyFields.tsx +5 -5
  367. package/src/collection_editor/ui/collection_editor/properties/DateTimePropertyField.tsx +10 -10
  368. package/src/collection_editor/ui/collection_editor/properties/EnumPropertyField.tsx +10 -9
  369. package/src/collection_editor/ui/collection_editor/properties/MapPropertyField.tsx +7 -8
  370. package/src/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.tsx +17 -10
  371. package/src/collection_editor/ui/collection_editor/properties/NumberPropertyField.tsx +7 -7
  372. package/src/collection_editor/ui/collection_editor/properties/ReferencePropertyField.tsx +19 -53
  373. package/src/collection_editor/ui/collection_editor/properties/RelationPropertyField.tsx +43 -60
  374. package/src/collection_editor/ui/collection_editor/properties/RepeatPropertyField.tsx +3 -3
  375. package/src/collection_editor/ui/collection_editor/properties/StoragePropertyField.tsx +56 -13
  376. package/src/collection_editor/ui/collection_editor/properties/StringPropertyField.tsx +7 -7
  377. package/src/collection_editor/ui/collection_editor/properties/UrlPropertyField.tsx +4 -3
  378. package/src/collection_editor/ui/collection_editor/properties/VectorPropertyField.tsx +34 -0
  379. package/src/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +5 -6
  380. package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +18 -9
  381. package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsPanel.tsx +1 -2
  382. package/src/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.tsx +17 -5
  383. package/src/collection_editor/ui/collection_editor/properties/conditions/property_paths.ts +1 -1
  384. package/src/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx +4 -4
  385. package/src/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx +3 -3
  386. package/src/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx +6 -9
  387. package/src/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +6 -6
  388. package/src/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.tsx +1 -2
  389. package/src/collection_editor/ui/collection_editor/templates/blog_template.ts +3 -3
  390. package/src/collection_editor/ui/collection_editor/templates/pages_template.ts +3 -3
  391. package/src/collection_editor/ui/collection_editor/templates/products_template.ts +4 -4
  392. package/src/collection_editor/ui/collection_editor/templates/users_template.ts +2 -2
  393. package/src/collection_editor/ui/collection_editor/utils/supported_fields.tsx +0 -1
  394. package/src/collection_editor/ui/collection_editor/utils/update_property_for_widget.ts +7 -29
  395. package/src/collection_editor/useJsonCollectionsConfigController.tsx +286 -0
  396. package/src/collection_editor/useLocalCollectionsConfigController.tsx +11 -8
  397. package/src/collection_editor/useSafeSnackbarController.ts +9 -0
  398. package/src/collection_editor/validateCollectionJson.ts +111 -24
  399. package/src/collection_editor_ui.ts +6 -0
  400. package/src/components/AdminModeSyncer.tsx +2 -2
  401. package/src/components/ArrayContainer.tsx +28 -24
  402. package/src/components/ClearFilterSortButton.tsx +2 -3
  403. package/src/components/CollectionEditorDialogs.tsx +1 -1
  404. package/src/components/CollectionPanel.tsx +178 -0
  405. package/src/components/{EntityCollectionTable/EntityCollectionRowActions.tsx → CollectionTableBinding/CollectionRowActions.tsx} +26 -16
  406. package/src/components/{EntityCollectionTable/EntityCollectionTable.tsx → CollectionTableBinding/CollectionTableBinding.tsx} +34 -31
  407. package/src/components/{EntityCollectionTable/EntityCollectionTableProps.tsx → CollectionTableBinding/CollectionTableBindingProps.tsx} +4 -4
  408. package/src/components/{EntityCollectionTable → CollectionTableBinding}/PropertyTableCell.tsx +14 -12
  409. package/src/components/{EntityCollectionTable → CollectionTableBinding}/column_utils.tsx +4 -4
  410. package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableMultipleRelationField.tsx +13 -13
  411. package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableReferenceField.tsx +39 -19
  412. package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableRelationField.tsx +14 -14
  413. package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableRelationSelectorField.tsx +3 -3
  414. package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableStorageUpload.tsx +29 -27
  415. package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/VirtualTableSelect.tsx +0 -1
  416. package/src/components/CollectionTableBinding/index.tsx +14 -0
  417. package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/CollectionTableToolbar.tsx +22 -28
  418. package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/EntityTableCell.tsx +8 -9
  419. package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/EntityTableCellActions.tsx +2 -3
  420. package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/common.tsx +7 -7
  421. package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/PopupFormField.tsx +12 -13
  422. package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/useDraggable.tsx +5 -2
  423. package/src/components/{EntityCollectionTable → CollectionTableBinding}/table_bindings.tsx +101 -104
  424. package/src/components/{EntityCollectionView/EntityBoardCard.tsx → CollectionViewBinding/BoardCardBinding.tsx} +39 -40
  425. package/src/components/{EntityCollectionView/EntityCollectionBoardView.tsx → CollectionViewBinding/CollectionBoardViewBinding.tsx} +88 -52
  426. package/src/components/CollectionViewBinding/CollectionCardViewBinding.tsx +157 -0
  427. package/src/components/{EntityCollectionView/EntityCollectionListView.tsx → CollectionViewBinding/CollectionListViewBinding.tsx} +234 -151
  428. package/src/components/{EntityCollectionView/EntityCollectionViewActions.tsx → CollectionViewBinding/CollectionViewActions.tsx} +36 -26
  429. package/src/components/{EntityCollectionView/EntityCollectionView.tsx → CollectionViewBinding/CollectionViewBinding.tsx} +392 -213
  430. package/src/components/{EntityCollectionView/EntityCollectionViewStartActions.tsx → CollectionViewBinding/CollectionViewStartActions.tsx} +42 -23
  431. package/src/components/{EntityCollectionView/EntityCard.tsx → CollectionViewBinding/EntityCardBinding.tsx} +14 -14
  432. package/src/components/CollectionViewBinding/FilterPresetsButton.tsx +294 -0
  433. package/src/components/{EntityCollectionView → CollectionViewBinding}/FiltersDialog.tsx +37 -79
  434. package/src/components/{EntityCollectionView → CollectionViewBinding}/SplitListView.tsx +97 -30
  435. package/src/components/{EntityCollectionView → CollectionViewBinding}/ViewModeToggle.tsx +20 -8
  436. package/src/components/{EntityCollectionView → CollectionViewBinding}/hooks/useCollectionInlineEditor.ts +9 -8
  437. package/src/components/{EntityCollectionView → CollectionViewBinding}/hooks/useKanbanDragAndDrop.ts +17 -16
  438. package/src/components/{EntityCollectionView → CollectionViewBinding}/useBoardDataController.tsx +118 -70
  439. package/src/components/{EntityCollectionView/useEntityPreviewSlots.ts → CollectionViewBinding/usePreviewSlots.ts} +136 -48
  440. package/src/components/DefaultAppBar.tsx +73 -41
  441. package/src/components/DefaultDrawer.tsx +317 -85
  442. package/src/components/DeleteEntityDialog.tsx +7 -7
  443. package/src/components/DetailViewBinding.tsx +670 -0
  444. package/src/components/DrawerNavigationGroup.tsx +11 -11
  445. package/src/components/DrawerNavigationItem.tsx +6 -6
  446. package/src/components/{EntityEditViewFormActions.tsx → EditFormActions.tsx} +78 -59
  447. package/src/components/EditViewBinding.tsx +761 -0
  448. package/src/components/{EntityPreview.tsx → EntityPreviewBinding.tsx} +53 -39
  449. package/src/components/{EntityView.tsx → EntityViewBinding.tsx} +8 -9
  450. package/src/components/HomePage/ContentHomePage.tsx +35 -17
  451. package/src/components/HomePage/FavouritesView.tsx +2 -3
  452. package/src/components/HomePage/HomePageDnD.tsx +3 -2
  453. package/src/components/HomePage/NavigationCard.tsx +9 -16
  454. package/src/components/HomePage/NavigationCardBinding.tsx +6 -7
  455. package/src/components/HomePage/NavigationGroup.tsx +4 -5
  456. package/src/components/HomePage/RenameGroupDialog.tsx +1 -1
  457. package/src/components/HomePage/SmallNavigationCard.tsx +0 -5
  458. package/src/components/{EntityJsonPreview.tsx → JsonPreviewBinding.tsx} +2 -2
  459. package/src/components/PropertyCollectionView.tsx +2 -1
  460. package/src/components/PropertyIdCopyTooltip.tsx +2 -3
  461. package/src/components/{RebaseCMS.tsx → RebaseAdmin.tsx} +8 -6
  462. package/src/components/RebaseAuthGate.tsx +5 -3
  463. package/src/components/RebaseLayout.tsx +10 -9
  464. package/src/components/RebaseNavigation.tsx +107 -31
  465. package/src/components/RebaseRouteDefs.tsx +10 -13
  466. package/src/components/RebaseShell.tsx +18 -14
  467. package/src/components/ReferenceTable/{EntitySelectionTable.tsx → SelectionTableBinding.tsx} +40 -33
  468. package/src/components/ReferenceWidget.tsx +7 -7
  469. package/src/components/RelationSelector.tsx +82 -24
  470. package/src/components/SearchIconsView.tsx +13 -12
  471. package/src/components/SelectableTable/SelectableTable.tsx +68 -115
  472. package/src/components/SelectableTable/SelectableTableContext.tsx +4 -3
  473. package/src/components/SelectableTable/SelectionStore.ts +20 -44
  474. package/src/components/SelectableTable/filters/BooleanFilterField.tsx +13 -5
  475. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +37 -16
  476. package/src/components/SelectableTable/filters/FilterFieldBinding.tsx +187 -0
  477. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +27 -13
  478. package/src/components/SelectableTable/filters/RelationFilterField.tsx +17 -3
  479. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +95 -35
  480. package/src/components/SideDialogs.tsx +58 -40
  481. package/src/components/SidePanelBinding.tsx +261 -0
  482. package/src/components/{SideEntityProvider.tsx → SidePanelProvider.tsx} +17 -16
  483. package/src/components/UserSelector.tsx +123 -9
  484. package/src/components/admin/CreationResultDialog.tsx +138 -0
  485. package/src/components/admin/index.ts +1 -3
  486. package/src/components/app/Drawer.tsx +9 -1
  487. package/src/components/app/Scaffold.tsx +16 -9
  488. package/src/components/common/default_entity_actions.tsx +270 -29
  489. package/src/components/field_configs.tsx +68 -46
  490. package/src/components/history/EntityHistoryEntry.tsx +4 -5
  491. package/src/components/history/EntityHistoryView.tsx +18 -8
  492. package/src/components/history/LastEditedByIndicator.tsx +4 -4
  493. package/src/components/index.ts +20 -17
  494. package/src/contexts/BreacrumbsContext.tsx +15 -6
  495. package/src/contexts/SidePanelControllerContext.tsx +5 -0
  496. package/src/data_export/export/BasicExportAction.tsx +42 -43
  497. package/src/data_export/export/ExportCollectionAction.tsx +55 -54
  498. package/src/data_export/export/export.ts +17 -17
  499. package/src/data_import/components/DataNewPropertiesMapping.tsx +17 -4
  500. package/src/data_import/components/ImportFileUpload.tsx +2 -3
  501. package/src/data_import/components/ImportNewPropertyFieldPreview.tsx +2 -3
  502. package/src/data_import/components/ImportSaveInProgress.tsx +4 -4
  503. package/src/data_import/import/ImportCollectionAction.tsx +26 -13
  504. package/src/data_import/utils/data.ts +26 -8
  505. package/src/data_import/utils/file_headers.ts +13 -89
  506. package/src/data_import/utils/file_to_json.ts +43 -68
  507. package/src/data_import/utils/get_properties_mapping.ts +1 -1
  508. package/src/data_import/utils/transforms.ts +47 -0
  509. package/src/editor/components/SlashCommandMenu.tsx +17 -2
  510. package/src/editor/components/editor-bubble-item.tsx +1 -1
  511. package/src/editor/components/editor-bubble.tsx +32 -9
  512. package/src/editor/components/image-bubble.tsx +28 -12
  513. package/src/editor/components/index.ts +3 -3
  514. package/src/editor/components/table-bubble.tsx +80 -18
  515. package/src/editor/editor.tsx +34 -15
  516. package/src/editor/extensions/HighlightDecorationExtension.ts +3 -2
  517. package/src/editor/extensions/Image/index.ts +3 -3
  518. package/src/editor/extensions/Image.ts +3 -3
  519. package/src/editor/extensions/clipboard.ts +2 -2
  520. package/src/editor/markdown-it-plugins.d.ts +24 -0
  521. package/src/editor/markdown.ts +2 -3
  522. package/src/editor/nodeViews/ReactNodeView.tsx +1 -1
  523. package/src/editor/nodeViews/TaskItemComponent.tsx +9 -8
  524. package/src/editor/schema.ts +135 -59
  525. package/src/editor/selectors/ai-selector.tsx +0 -1
  526. package/src/editor/selectors/color-selector.tsx +1 -2
  527. package/src/editor/selectors/link-selector.tsx +9 -7
  528. package/src/editor/selectors/node-selector.tsx +17 -3
  529. package/src/editor/selectors/text-buttons.tsx +1 -2
  530. package/src/editor/useProseMirror.ts +2 -2
  531. package/src/editor/utils/prosemirror-utils.ts +1 -1
  532. package/src/editor/utils/remove_classes.ts +6 -5
  533. package/src/form/EntityForm.tsx +222 -442
  534. package/src/form/EntityFormActions.tsx +49 -55
  535. package/src/form/EntityFormBinding.tsx +323 -0
  536. package/src/form/PropertyFieldBinding.tsx +81 -84
  537. package/src/form/components/ErrorFocus.tsx +1 -1
  538. package/src/form/components/FieldHelperText.tsx +6 -7
  539. package/src/form/components/FormLayout.tsx +1 -1
  540. package/src/form/components/LocalChangesMenu.tsx +20 -5
  541. package/src/form/components/StorageItemPreview.tsx +2 -3
  542. package/src/form/components/StorageUploadProgress.tsx +14 -7
  543. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +5 -5
  544. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +12 -13
  545. package/src/form/field_bindings/BlockFieldBinding.tsx +59 -58
  546. package/src/form/field_bindings/DateTimeFieldBinding.tsx +2 -2
  547. package/src/form/field_bindings/KeyValueFieldBinding.tsx +319 -303
  548. package/src/form/field_bindings/MapFieldBinding.tsx +14 -56
  549. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +28 -10
  550. package/src/form/field_bindings/MultiSelectFieldBinding.tsx +3 -4
  551. package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +11 -12
  552. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +9 -2
  553. package/src/form/field_bindings/ReferenceFieldBinding.tsx +17 -15
  554. package/src/form/field_bindings/RelationFieldBinding.tsx +157 -156
  555. package/src/form/field_bindings/RepeatFieldBinding.tsx +8 -8
  556. package/src/form/field_bindings/SelectFieldBinding.tsx +3 -4
  557. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +107 -103
  558. package/src/form/field_bindings/SwitchFieldBinding.tsx +17 -17
  559. package/src/form/field_bindings/TextFieldBinding.tsx +90 -78
  560. package/src/form/field_bindings/UserSelectFieldBinding.tsx +18 -18
  561. package/src/form/field_bindings/VectorFieldBinding.tsx +202 -0
  562. package/src/form/form_utils.ts +163 -0
  563. package/src/form/index.tsx +15 -6
  564. package/src/form/useClearRestoreValue.tsx +1 -1
  565. package/src/form/validation.ts +104 -50
  566. package/src/hooks/index.ts +4 -4
  567. package/src/hooks/navigation/contexts/CollectionRegistryContext.tsx +5 -4
  568. package/src/hooks/navigation/contexts/NavigationStateContext.tsx +2 -2
  569. package/src/hooks/navigation/contexts/UrlContext.tsx +1 -2
  570. package/src/hooks/navigation/useAsyncResolver.ts +100 -0
  571. package/src/hooks/navigation/useBuildCollectionRegistryController.tsx +40 -21
  572. package/src/hooks/navigation/useBuildNavigationStateController.tsx +21 -22
  573. package/src/hooks/navigation/useNavigationResolution.ts +193 -21
  574. package/src/hooks/navigation/useResolvedCollections.ts +45 -77
  575. package/src/hooks/navigation/useResolvedViews.tsx +44 -123
  576. package/src/hooks/navigation/useTopLevelNavigation.ts +22 -18
  577. package/src/hooks/navigation/utils.ts +12 -9
  578. package/src/hooks/useBreadcrumbsController.tsx +2 -34
  579. package/src/hooks/{useBuildSideEntityController.tsx → useBuildSidePanel.tsx} +63 -24
  580. package/src/hooks/useCMSContext.tsx +7 -7
  581. package/src/hooks/{useEntityHistory.ts → useHistory.ts} +9 -4
  582. package/src/hooks/useResolvedNavigationFrom.tsx +8 -5
  583. package/src/hooks/{useEntitySelectionDialog.tsx → useSelectionDialog.tsx} +7 -7
  584. package/src/hooks/useSideDialogsController.tsx +1 -1
  585. package/src/hooks/useSidePanel.tsx +13 -0
  586. package/src/index.ts +34 -20
  587. package/src/preview/PropertyPreview.tsx +34 -41
  588. package/src/preview/components/DatePreview.tsx +1 -1
  589. package/src/preview/components/EnumValuesChip.tsx +1 -1
  590. package/src/preview/components/ImagePreview.tsx +4 -3
  591. package/src/preview/components/ReferencePreview.tsx +69 -18
  592. package/src/preview/components/RelationPreview.tsx +107 -18
  593. package/src/preview/components/StorageThumbnail.tsx +28 -8
  594. package/src/preview/components/UrlComponentPreview.tsx +12 -4
  595. package/src/preview/components/UserPreview.tsx +6 -15
  596. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +5 -5
  597. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +5 -5
  598. package/src/preview/property_previews/ArrayOfRelationsPreview.tsx +4 -4
  599. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +4 -4
  600. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +3 -2
  601. package/src/preview/property_previews/ArrayOneOfPreview.tsx +7 -9
  602. package/src/preview/property_previews/ArrayPropertyEnumPreview.tsx +1 -1
  603. package/src/preview/property_previews/ArrayPropertyPreview.tsx +4 -4
  604. package/src/preview/property_previews/MapPropertyPreview.tsx +4 -3
  605. package/src/preview/property_previews/NumberPropertyPreview.tsx +5 -3
  606. package/src/preview/property_previews/SkeletonPropertyComponent.tsx +24 -25
  607. package/src/preview/property_previews/StringPropertyPreview.tsx +13 -11
  608. package/src/routes/CustomViewRoute.tsx +14 -6
  609. package/src/routes/RebaseRoute.tsx +112 -36
  610. package/src/types/components/EntityFormActionsProps.tsx +4 -4
  611. package/src/types/components/EntityFormProps.tsx +75 -5
  612. package/src/types/components/PropertyPreviewProps.tsx +6 -1
  613. package/src/types/components/formex.tsx +1 -45
  614. package/src/types/fields.tsx +26 -15
  615. package/src/util/dataControllerAdapter.ts +87 -0
  616. package/src/util/navigation_utils.ts +43 -13
  617. package/src/util/previews.ts +149 -13
  618. package/src/util/propertyConfigMapper.ts +134 -0
  619. package/src/util/property_utils.tsx +24 -9
  620. package/src/util/resolutions.ts +4 -8
  621. package/src/util/view_constants.ts +6 -0
  622. package/dist/CollectionEditorDialog-B2M9lCyL.js +0 -4720
  623. package/dist/CollectionEditorDialog-B2M9lCyL.js.map +0 -1
  624. package/dist/CollectionsStudioView-WG6soyfs.js +0 -218
  625. package/dist/CollectionsStudioView-WG6soyfs.js.map +0 -1
  626. package/dist/ContentHomePage-CDF_a6Lp.js +0 -1786
  627. package/dist/ContentHomePage-CDF_a6Lp.js.map +0 -1
  628. package/dist/ExportCollectionAction-Dc0VOWMN.js +0 -439
  629. package/dist/ExportCollectionAction-Dc0VOWMN.js.map +0 -1
  630. package/dist/ImportCollectionAction-DpCagAOy.js +0 -686
  631. package/dist/ImportCollectionAction-DpCagAOy.js.map +0 -1
  632. package/dist/PropertyEditView-DS67DxoT.js +0 -8138
  633. package/dist/PropertyEditView-DS67DxoT.js.map +0 -1
  634. package/dist/RoleChip-QtUFXeTp.js +0 -67
  635. package/dist/RoleChip-QtUFXeTp.js.map +0 -1
  636. package/dist/RolesView-CIuYBimF.js +0 -424
  637. package/dist/RolesView-CIuYBimF.js.map +0 -1
  638. package/dist/UsersView-B5zelXnH.js +0 -493
  639. package/dist/UsersView-B5zelXnH.js.map +0 -1
  640. package/dist/collection_editor/types/config_permissions.d.ts +0 -19
  641. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +0 -27
  642. package/dist/components/EntityCollectionTable/fields/VirtualTableDateField.d.ts +0 -12
  643. package/dist/components/EntityCollectionTable/fields/VirtualTableInput.d.ts +0 -9
  644. package/dist/components/EntityCollectionTable/fields/VirtualTableNumberInput.d.ts +0 -8
  645. package/dist/components/EntityCollectionTable/fields/VirtualTableSwitch.d.ts +0 -7
  646. package/dist/components/EntityCollectionTable/index.d.ts +0 -6
  647. package/dist/components/EntityCollectionView/Board.d.ts +0 -2
  648. package/dist/components/EntityCollectionView/BoardColumn.d.ts +0 -42
  649. package/dist/components/EntityCollectionView/BoardColumnTitle.d.ts +0 -9
  650. package/dist/components/EntityCollectionView/BoardSortableList.d.ts +0 -14
  651. package/dist/components/EntityCollectionView/EntityBoardCard.d.ts +0 -31
  652. package/dist/components/EntityCollectionView/EntityCard.d.ts +0 -20
  653. package/dist/components/EntityCollectionView/EntityCollectionBoardView.d.ts +0 -21
  654. package/dist/components/EntityCollectionView/EntityCollectionListView.d.ts +0 -34
  655. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +0 -64
  656. package/dist/components/EntityCollectionView/EntityCollectionViewActions.d.ts +0 -18
  657. package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +0 -18
  658. package/dist/components/EntityCollectionView/board_types.d.ts +0 -105
  659. package/dist/components/EntityEditView.d.ts +0 -49
  660. package/dist/components/EntityEditViewFormActions.d.ts +0 -2
  661. package/dist/components/EntityJsonPreview.d.ts +0 -3
  662. package/dist/components/EntitySidePanel.d.ts +0 -10
  663. package/dist/components/EntityView.d.ts +0 -12
  664. package/dist/components/admin/RoleChip.d.ts +0 -4
  665. package/dist/components/admin/RolesView.d.ts +0 -4
  666. package/dist/components/admin/UsersView.d.ts +0 -4
  667. package/dist/contexts/SideEntityControllerContext.d.ts +0 -3
  668. package/dist/form/field_bindings/ReferenceAsStringFieldBinding.d.ts +0 -10
  669. package/dist/hooks/navigation/useNavigationRegistry.d.ts +0 -11
  670. package/dist/hooks/navigation/useNavigationURLs.d.ts +0 -11
  671. package/dist/hooks/useBuildSideEntityController.d.ts +0 -6
  672. package/dist/hooks/useSideEntityController.d.ts +0 -11
  673. package/dist/index-CBhrgpR7.js +0 -12
  674. package/dist/index-CBhrgpR7.js.map +0 -1
  675. package/dist/index-CHxgwt6E.js +0 -456
  676. package/dist/index-CHxgwt6E.js.map +0 -1
  677. package/dist/index-Dey5WJpO.js +0 -8
  678. package/dist/index-Dey5WJpO.js.map +0 -1
  679. package/dist/index.js.map +0 -1
  680. package/dist/markdown-z2Ir7Cgo.js +0 -618
  681. package/dist/markdown-z2Ir7Cgo.js.map +0 -1
  682. package/dist/useEntityHistory-Dcj4zhGj.js +0 -121
  683. package/dist/useEntityHistory-Dcj4zhGj.js.map +0 -1
  684. package/dist/util-BQ82ySL3.js +0 -27720
  685. package/dist/util-BQ82ySL3.js.map +0 -1
  686. package/src/collection_editor/types/config_permissions.ts +0 -20
  687. package/src/components/EntityCollectionTable/fields/VirtualTableDateField.tsx +0 -39
  688. package/src/components/EntityCollectionTable/fields/VirtualTableInput.tsx +0 -90
  689. package/src/components/EntityCollectionTable/fields/VirtualTableNumberInput.tsx +0 -80
  690. package/src/components/EntityCollectionTable/fields/VirtualTableSwitch.tsx +0 -32
  691. package/src/components/EntityCollectionTable/index.tsx +0 -14
  692. package/src/components/EntityCollectionView/Board.tsx +0 -474
  693. package/src/components/EntityCollectionView/BoardColumn.tsx +0 -158
  694. package/src/components/EntityCollectionView/BoardColumnTitle.tsx +0 -45
  695. package/src/components/EntityCollectionView/BoardSortableList.tsx +0 -177
  696. package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +0 -267
  697. package/src/components/EntityCollectionView/board_types.ts +0 -113
  698. package/src/components/EntityEditView.tsx +0 -632
  699. package/src/components/EntitySidePanel.tsx +0 -160
  700. package/src/components/admin/RoleChip.tsx +0 -23
  701. package/src/components/admin/RolesView.tsx +0 -419
  702. package/src/components/admin/UsersView.tsx +0 -782
  703. package/src/contexts/SideEntityControllerContext.tsx +0 -5
  704. package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +0 -141
  705. package/src/hooks/navigation/useNavigationRegistry.ts +0 -153
  706. package/src/hooks/navigation/useNavigationURLs.ts +0 -56
  707. package/src/hooks/useSideEntityController.tsx +0 -13
  708. /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/PropertyTableCell.d.ts +0 -0
  709. /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/useDraggable.d.ts +0 -0
  710. /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/useWindowSize.d.ts +0 -0
  711. /package/dist/components/{EntityCollectionView → CollectionViewBinding}/useSelectionController.d.ts +0 -0
  712. /package/dist/components/{EntityCollectionView → CollectionViewBinding}/utils.d.ts +0 -0
  713. /package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/VirtualTableUserSelect.tsx +0 -0
  714. /package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/useWindowSize.tsx +0 -0
  715. /package/src/components/{EntityCollectionView → CollectionViewBinding}/useSelectionController.tsx +0 -0
  716. /package/src/components/{EntityCollectionView → CollectionViewBinding}/utils.ts +0 -0
@@ -1,1786 +0,0 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import React__default, { useState, useRef, useEffect, useCallback, useMemo } from "react";
3
- import Fuse from "fuse.js";
4
- import { Chip, Collapse, cls, IconButton, iconSize, ExpandablePanel, Typography, Markdown, Card, DialogTitle, TextField, DialogContent, Button, DialogActions, Dialog, Container, SearchBar, ErrorBoundary } from "@rebasepro/ui";
5
- import { c } from "react-compiler-runtime";
6
- import { useNavigate } from "react-router-dom";
7
- import { StarIcon, PencilIcon, ArrowRightIcon } from "lucide-react";
8
- import { useUserConfigurationPersistence, useTranslation, useRebaseContext, useSlot, IconForView, useCustomizationController, useAdminModeController, STUDIO_NAVIGATION_GROUPS, useCollapsedGroups, useRestoreScroll } from "@rebasepro/core";
9
- import "fast-equals";
10
- import "@rebasepro/common";
11
- import "@rebasepro/formex";
12
- import "zod";
13
- import "@rebasepro/utils";
14
- import { m as useNavigationStateController, k as useCMSContext, i as useBreadcrumbsController } from "./util-BQ82ySL3.js";
15
- import "date-fns";
16
- import "date-fns/locale";
17
- import "@rebasepro/types";
18
- import { useSensor, MouseSensor, TouchSensor, KeyboardSensor, useSensors, closestCenter, pointerWithin, closestCorners, getFirstCollision, rectIntersection, useDroppable, useDndMonitor, DndContext, MeasuringStrategy, DragOverlay } from "@dnd-kit/core";
19
- import { restrictToVerticalAxis, restrictToWindowEdges } from "@dnd-kit/modifiers";
20
- import { useSortable, arrayMove, defaultAnimateLayoutChanges, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from "@dnd-kit/sortable";
21
- import { CSS } from "@dnd-kit/utilities";
22
- import "react-dropzone";
23
- import "react-router";
24
- import "xlsx";
25
- import "@rebasepro/schema-inference";
26
- function NavigationChip(t0) {
27
- const $ = c(18);
28
- const {
29
- entry
30
- } = t0;
31
- const navigate = useNavigate();
32
- const userConfigurationPersistence = useUserConfigurationPersistence();
33
- if (!userConfigurationPersistence) {
34
- return null;
35
- }
36
- let t1;
37
- if ($[0] !== entry.slug || $[1] !== userConfigurationPersistence.favouritePaths) {
38
- t1 = userConfigurationPersistence.favouritePaths.includes(entry.slug);
39
- $[0] = entry.slug;
40
- $[1] = userConfigurationPersistence.favouritePaths;
41
- $[2] = t1;
42
- } else {
43
- t1 = $[2];
44
- }
45
- const favourite = t1;
46
- let t2;
47
- if ($[3] !== entry.slug || $[4] !== favourite || $[5] !== userConfigurationPersistence) {
48
- t2 = (e) => {
49
- e.preventDefault();
50
- e.stopPropagation();
51
- if (favourite) {
52
- userConfigurationPersistence.setFavouritePaths(userConfigurationPersistence.favouritePaths.filter((p) => p !== entry.slug));
53
- } else {
54
- userConfigurationPersistence.setFavouritePaths([...userConfigurationPersistence.favouritePaths, entry.slug]);
55
- }
56
- };
57
- $[3] = entry.slug;
58
- $[4] = favourite;
59
- $[5] = userConfigurationPersistence;
60
- $[6] = t2;
61
- } else {
62
- t2 = $[6];
63
- }
64
- const onIconClick = t2;
65
- let t3;
66
- if ($[7] !== entry.url || $[8] !== navigate) {
67
- t3 = () => navigate(entry.url);
68
- $[7] = entry.url;
69
- $[8] = navigate;
70
- $[9] = t3;
71
- } else {
72
- t3 = $[9];
73
- }
74
- const t4 = favourite ? "text-secondary" : "text-surface-400 dark:text-surface-500";
75
- let t5;
76
- if ($[10] !== onIconClick || $[11] !== t4) {
77
- t5 = /* @__PURE__ */ jsx(StarIcon, { onClick: onIconClick, size: "small", className: t4 });
78
- $[10] = onIconClick;
79
- $[11] = t4;
80
- $[12] = t5;
81
- } else {
82
- t5 = $[12];
83
- }
84
- let t6;
85
- if ($[13] !== entry.name || $[14] !== entry.slug || $[15] !== t3 || $[16] !== t5) {
86
- t6 = /* @__PURE__ */ jsx(Chip, { onClick: t3, icon: t5, children: entry.name }, entry.slug);
87
- $[13] = entry.name;
88
- $[14] = entry.slug;
89
- $[15] = t3;
90
- $[16] = t5;
91
- $[17] = t6;
92
- } else {
93
- t6 = $[17];
94
- }
95
- return t6;
96
- }
97
- function FavouritesView(t0) {
98
- const $ = c(17);
99
- const navigationStateController = useNavigationStateController();
100
- const userConfigurationPersistence = useUserConfigurationPersistence();
101
- if (!userConfigurationPersistence) {
102
- return null;
103
- }
104
- let t1;
105
- if ($[0] !== userConfigurationPersistence?.favouritePaths) {
106
- t1 = userConfigurationPersistence?.favouritePaths ?? [];
107
- $[0] = userConfigurationPersistence?.favouritePaths;
108
- $[1] = t1;
109
- } else {
110
- t1 = $[1];
111
- }
112
- let T0;
113
- let t2;
114
- let t3;
115
- let t4;
116
- if ($[2] !== navigationStateController || $[3] !== t1) {
117
- let t52;
118
- if ($[8] !== navigationStateController) {
119
- t52 = (path) => navigationStateController.topLevelNavigation?.navigationEntries.find((entry) => entry.slug === path);
120
- $[8] = navigationStateController;
121
- $[9] = t52;
122
- } else {
123
- t52 = $[9];
124
- }
125
- const favouriteCollections = t1.map(t52).filter(Boolean);
126
- T0 = Collapse;
127
- t4 = favouriteCollections.length > 0;
128
- t2 = "flex flex-row flex-wrap gap-2 pb-2 min-h-[32px]";
129
- t3 = favouriteCollections.map(_temp$1);
130
- $[2] = navigationStateController;
131
- $[3] = t1;
132
- $[4] = T0;
133
- $[5] = t2;
134
- $[6] = t3;
135
- $[7] = t4;
136
- } else {
137
- T0 = $[4];
138
- t2 = $[5];
139
- t3 = $[6];
140
- t4 = $[7];
141
- }
142
- let t5;
143
- if ($[10] !== t2 || $[11] !== t3) {
144
- t5 = /* @__PURE__ */ jsx("div", { className: t2, children: t3 });
145
- $[10] = t2;
146
- $[11] = t3;
147
- $[12] = t5;
148
- } else {
149
- t5 = $[12];
150
- }
151
- let t6;
152
- if ($[13] !== T0 || $[14] !== t4 || $[15] !== t5) {
153
- t6 = /* @__PURE__ */ jsx(T0, { in: t4, children: t5 });
154
- $[13] = T0;
155
- $[14] = t4;
156
- $[15] = t5;
157
- $[16] = t6;
158
- } else {
159
- t6 = $[16];
160
- }
161
- return t6;
162
- }
163
- function _temp$1(entry_0) {
164
- return /* @__PURE__ */ jsx(NavigationChip, { entry: entry_0 }, entry_0.slug);
165
- }
166
- function NavigationGroup(t0) {
167
- const $ = c(45);
168
- const {
169
- children,
170
- group,
171
- minimised,
172
- isPreview,
173
- isPotentialCardDropTarget,
174
- onEditGroup,
175
- dndDisabled,
176
- collapsed,
177
- onToggleCollapsed
178
- } = t0;
179
- const {
180
- t
181
- } = useTranslation();
182
- const [isHovered, setIsHovered] = useState(false);
183
- let t1;
184
- if ($[0] !== group || $[1] !== t) {
185
- t1 = group ?? t("views_group");
186
- $[0] = group;
187
- $[1] = t;
188
- $[2] = t1;
189
- } else {
190
- t1 = $[2];
191
- }
192
- const currentGroupName = t1;
193
- const showCaret = !isPreview && !!onToggleCollapsed;
194
- const t2 = isPreview ? "px-1 py-0.5" : "";
195
- let t3;
196
- if ($[3] !== t2) {
197
- t3 = cls("flex items-center", t2);
198
- $[3] = t2;
199
- $[4] = t3;
200
- } else {
201
- t3 = $[4];
202
- }
203
- const t4 = isPreview ? "body2" : "caption";
204
- let t5;
205
- if ($[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
206
- t5 = cls("p-4 py-2 rounded", "font-medium text-sm text-surface-600 dark:text-surface-400");
207
- $[5] = t5;
208
- } else {
209
- t5 = $[5];
210
- }
211
- let t6;
212
- if ($[6] !== currentGroupName || $[7] !== t4) {
213
- t6 = /* @__PURE__ */ jsx(Typography, { variant: t4, component: "h2", color: "secondary", className: t5, children: currentGroupName });
214
- $[6] = currentGroupName;
215
- $[7] = t4;
216
- $[8] = t6;
217
- } else {
218
- t6 = $[8];
219
- }
220
- let t7;
221
- if ($[9] !== currentGroupName || $[10] !== dndDisabled || $[11] !== isHovered || $[12] !== isPreview || $[13] !== onEditGroup) {
222
- t7 = !isPreview && onEditGroup && !dndDisabled && /* @__PURE__ */ jsx(IconButton, { size: "smallest", onClick: (e) => {
223
- e.stopPropagation();
224
- onEditGroup(currentGroupName);
225
- }, className: cls("ml-2 ", isHovered ? "opacity-100" : "opacity-0", "transition-opacity duration-100"), children: /* @__PURE__ */ jsx(PencilIcon, { size: iconSize.smallest }) });
226
- $[9] = currentGroupName;
227
- $[10] = dndDisabled;
228
- $[11] = isHovered;
229
- $[12] = isPreview;
230
- $[13] = onEditGroup;
231
- $[14] = t7;
232
- } else {
233
- t7 = $[14];
234
- }
235
- let t8;
236
- if ($[15] !== t3 || $[16] !== t6 || $[17] !== t7) {
237
- t8 = /* @__PURE__ */ jsxs("div", { className: t3, children: [
238
- t6,
239
- t7
240
- ] });
241
- $[15] = t3;
242
- $[16] = t6;
243
- $[17] = t7;
244
- $[18] = t8;
245
- } else {
246
- t8 = $[18];
247
- }
248
- const TitleContent = t8;
249
- const t9 = !isPotentialCardDropTarget ? "my-10" : "my-6";
250
- let t10;
251
- if ($[19] !== t9) {
252
- t10 = cls(t9, "transition-all duration-200 ease-in-out");
253
- $[19] = t9;
254
- $[20] = t10;
255
- } else {
256
- t10 = $[20];
257
- }
258
- let t11;
259
- if ($[21] !== TitleContent || $[22] !== children || $[23] !== isPreview) {
260
- t11 = isPreview && /* @__PURE__ */ jsxs(Fragment, { children: [
261
- /* @__PURE__ */ jsx("div", { className: cls("flex items-center justify-between w-full", "p-4 py-2"), onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: TitleContent }),
262
- children
263
- ] });
264
- $[21] = TitleContent;
265
- $[22] = children;
266
- $[23] = isPreview;
267
- $[24] = t11;
268
- } else {
269
- t11 = $[24];
270
- }
271
- let t12;
272
- if ($[25] !== TitleContent || $[26] !== children || $[27] !== collapsed || $[28] !== isPreview || $[29] !== minimised || $[30] !== onToggleCollapsed || $[31] !== showCaret) {
273
- t12 = !isPreview && showCaret && /* @__PURE__ */ jsx(ExpandablePanel, { invisible: true, expanded: !collapsed, onExpandedChange: (open) => {
274
- if (open !== !collapsed) {
275
- onToggleCollapsed?.();
276
- }
277
- }, className: cls("mt-6"), titleClassName: cls("min-h-0 p-0 border-none", "rounded flex items-center justify-between w-full", "hover:bg-transparent", "cursor-pointer select-none", collapsed && "bg-surface-100 dark:bg-surface-900/50"), innerClassName: cls("mt-4", !minimised ? "pt-0" : ""), title: /* @__PURE__ */ jsx("div", { onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), className: "flex items-center", children: TitleContent }), children: minimised ? /* @__PURE__ */ jsx("div", { className: cls("mt-4 p-8 bg-surface-accent-200 dark:bg-surface-accent-800 rounded-lg"), style: {
278
- minHeight: "50px"
279
- } }) : /* @__PURE__ */ jsx("div", { className: cls("mt-4", !minimised ? "pt-0" : ""), children }) });
280
- $[25] = TitleContent;
281
- $[26] = children;
282
- $[27] = collapsed;
283
- $[28] = isPreview;
284
- $[29] = minimised;
285
- $[30] = onToggleCollapsed;
286
- $[31] = showCaret;
287
- $[32] = t12;
288
- } else {
289
- t12 = $[32];
290
- }
291
- let t13;
292
- if ($[33] !== TitleContent || $[34] !== children || $[35] !== collapsed || $[36] !== isPreview || $[37] !== minimised || $[38] !== showCaret) {
293
- t13 = !isPreview && !showCaret && /* @__PURE__ */ jsxs(Fragment, { children: [
294
- /* @__PURE__ */ jsx("div", { className: cls("flex items-center justify-between w-full", "mt-6"), onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: TitleContent }),
295
- !collapsed && (minimised ? /* @__PURE__ */ jsx("div", { className: cls("mt-4 p-8 bg-surface-accent-200 dark:bg-surface-accent-800 rounded-lg"), style: {
296
- minHeight: "50px"
297
- } }) : /* @__PURE__ */ jsx("div", { className: cls("mt-4", !minimised ? "pt-0" : ""), children }))
298
- ] });
299
- $[33] = TitleContent;
300
- $[34] = children;
301
- $[35] = collapsed;
302
- $[36] = isPreview;
303
- $[37] = minimised;
304
- $[38] = showCaret;
305
- $[39] = t13;
306
- } else {
307
- t13 = $[39];
308
- }
309
- let t14;
310
- if ($[40] !== t10 || $[41] !== t11 || $[42] !== t12 || $[43] !== t13) {
311
- t14 = /* @__PURE__ */ jsxs("div", { className: t10, children: [
312
- t11,
313
- t12,
314
- t13
315
- ] });
316
- $[40] = t10;
317
- $[41] = t11;
318
- $[42] = t12;
319
- $[43] = t13;
320
- $[44] = t14;
321
- } else {
322
- t14 = $[44];
323
- }
324
- return t14;
325
- }
326
- const NavigationCard = React__default.memo(function NavigationCard2(t0) {
327
- const $ = c(31);
328
- const {
329
- name,
330
- description,
331
- icon,
332
- actions,
333
- additionalContent,
334
- onClick,
335
- shrink
336
- } = t0;
337
- const t1 = shrink && "w-full max-w-full min-h-0 scale-75";
338
- let t2;
339
- if ($[0] !== t1) {
340
- t2 = cls("group h-full p-5 cursor-pointer transition-all duration-200 ease-in-out", "border-surface-200/40 dark:border-surface-700/40", "hover:-translate-y-0.5 hover:shadow-md hover:shadow-primary/5", "hover:border-primary/30 dark:hover:border-primary/20", t1);
341
- $[0] = t1;
342
- $[1] = t2;
343
- } else {
344
- t2 = $[1];
345
- }
346
- let t3;
347
- if ($[2] !== onClick) {
348
- t3 = () => {
349
- onClick?.();
350
- };
351
- $[2] = onClick;
352
- $[3] = t3;
353
- } else {
354
- t3 = $[3];
355
- }
356
- let t4;
357
- if ($[4] !== icon) {
358
- t4 = /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-7 h-7 rounded-lg bg-primary/8 dark:bg-primary/10 text-primary/70 dark:text-primary/60 transition-colors duration-200 group-hover:bg-primary/12 dark:group-hover:bg-primary/15 group-hover:text-primary dark:group-hover:text-primary/80", children: icon });
359
- $[4] = icon;
360
- $[5] = t4;
361
- } else {
362
- t4 = $[5];
363
- }
364
- let t5;
365
- if ($[6] !== name) {
366
- t5 = /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", component: "h2", children: name });
367
- $[6] = name;
368
- $[7] = t5;
369
- } else {
370
- t5 = $[7];
371
- }
372
- let t6;
373
- if ($[8] !== t4 || $[9] !== t5) {
374
- t6 = /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
375
- t4,
376
- t5
377
- ] });
378
- $[8] = t4;
379
- $[9] = t5;
380
- $[10] = t6;
381
- } else {
382
- t6 = $[10];
383
- }
384
- let t7;
385
- if ($[11] !== actions) {
386
- t7 = /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5", onClick: _temp, children: actions });
387
- $[11] = actions;
388
- $[12] = t7;
389
- } else {
390
- t7 = $[12];
391
- }
392
- let t8;
393
- if ($[13] !== t6 || $[14] !== t7) {
394
- t8 = /* @__PURE__ */ jsxs("div", { className: "flex items-center w-full justify-between mb-1", children: [
395
- t6,
396
- t7
397
- ] });
398
- $[13] = t6;
399
- $[14] = t7;
400
- $[15] = t8;
401
- } else {
402
- t8 = $[15];
403
- }
404
- let t9;
405
- if ($[16] !== description) {
406
- t9 = description && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", component: "div", children: /* @__PURE__ */ jsx(Markdown, { source: description, size: "small" }) });
407
- $[16] = description;
408
- $[17] = t9;
409
- } else {
410
- t9 = $[17];
411
- }
412
- let t10;
413
- if ($[18] !== t9) {
414
- t10 = /* @__PURE__ */ jsx("div", { className: "grow pl-[44px]", children: t9 });
415
- $[18] = t9;
416
- $[19] = t10;
417
- } else {
418
- t10 = $[19];
419
- }
420
- let t11;
421
- if ($[20] !== additionalContent) {
422
- t11 = additionalContent && /* @__PURE__ */ jsx("div", { className: "pl-[44px] pointer-events-none", children: additionalContent });
423
- $[20] = additionalContent;
424
- $[21] = t11;
425
- } else {
426
- t11 = $[21];
427
- }
428
- let t12;
429
- if ($[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
430
- t12 = /* @__PURE__ */ jsx("div", { className: "self-end mt-1", children: /* @__PURE__ */ jsx("div", { className: "transition-transform duration-200 group-hover:translate-x-0.5", children: /* @__PURE__ */ jsx(ArrowRightIcon, { className: "text-primary" }) }) });
431
- $[22] = t12;
432
- } else {
433
- t12 = $[22];
434
- }
435
- let t13;
436
- if ($[23] !== t10 || $[24] !== t11 || $[25] !== t8) {
437
- t13 = /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full", children: [
438
- t8,
439
- t10,
440
- t11,
441
- t12
442
- ] });
443
- $[23] = t10;
444
- $[24] = t11;
445
- $[25] = t8;
446
- $[26] = t13;
447
- } else {
448
- t13 = $[26];
449
- }
450
- let t14;
451
- if ($[27] !== t13 || $[28] !== t2 || $[29] !== t3) {
452
- t14 = /* @__PURE__ */ jsx(Card, { className: t2, onClick: t3, children: t13 });
453
- $[27] = t13;
454
- $[28] = t2;
455
- $[29] = t3;
456
- $[30] = t14;
457
- } else {
458
- t14 = $[30];
459
- }
460
- return t14;
461
- });
462
- function _temp(event) {
463
- event.preventDefault();
464
- event.stopPropagation();
465
- }
466
- function NavigationCardBinding(t0) {
467
- const $ = c(38);
468
- const {
469
- slug,
470
- collection,
471
- view,
472
- url,
473
- name,
474
- description,
475
- onClick,
476
- shrink
477
- } = t0;
478
- const userConfigurationPersistence = useUserConfigurationPersistence();
479
- const t1 = collection ?? view;
480
- let t2;
481
- if ($[0] !== t1) {
482
- t2 = /* @__PURE__ */ jsx(IconForView, { collectionOrView: t1 });
483
- $[0] = t1;
484
- $[1] = t2;
485
- } else {
486
- t2 = $[1];
487
- }
488
- const collectionIcon = t2;
489
- const navigate = useNavigate();
490
- const context = useRebaseContext();
491
- let t3;
492
- if ($[2] !== userConfigurationPersistence?.favouritePaths) {
493
- t3 = userConfigurationPersistence?.favouritePaths ?? [];
494
- $[2] = userConfigurationPersistence?.favouritePaths;
495
- $[3] = t3;
496
- } else {
497
- t3 = $[3];
498
- }
499
- let t4;
500
- if ($[4] !== slug || $[5] !== t3) {
501
- t4 = t3.includes(slug);
502
- $[4] = slug;
503
- $[5] = t3;
504
- $[6] = t4;
505
- } else {
506
- t4 = $[6];
507
- }
508
- const favourite = t4;
509
- let t5;
510
- if ($[7] !== favourite || $[8] !== slug || $[9] !== userConfigurationPersistence) {
511
- t5 = userConfigurationPersistence ? [/* @__PURE__ */ jsx(IconButton, { size: "small", onClick: (e) => {
512
- e.preventDefault();
513
- e.stopPropagation();
514
- if (favourite) {
515
- userConfigurationPersistence.setFavouritePaths(userConfigurationPersistence.favouritePaths.filter((p) => p !== slug));
516
- } else {
517
- userConfigurationPersistence.setFavouritePaths([...userConfigurationPersistence.favouritePaths, slug]);
518
- }
519
- }, children: /* @__PURE__ */ jsx(StarIcon, { className: favourite ? "text-secondary" : "text-surface-400 dark:text-surface-500" }) }, "favourite")] : [];
520
- $[7] = favourite;
521
- $[8] = slug;
522
- $[9] = userConfigurationPersistence;
523
- $[10] = t5;
524
- } else {
525
- t5 = $[10];
526
- }
527
- const actionsArray = t5;
528
- let t6;
529
- if ($[11] !== collection || $[12] !== context || $[13] !== slug) {
530
- t6 = {
531
- slug,
532
- collection,
533
- context
534
- };
535
- $[11] = collection;
536
- $[12] = context;
537
- $[13] = slug;
538
- $[14] = t6;
539
- } else {
540
- t6 = $[14];
541
- }
542
- const pluginCardActions = useSlot("home.collection.actions", t6);
543
- let t7;
544
- if ($[15] !== collection || $[16] !== context || $[17] !== slug) {
545
- t7 = {
546
- slug,
547
- collection,
548
- context
549
- };
550
- $[15] = collection;
551
- $[16] = context;
552
- $[17] = slug;
553
- $[18] = t7;
554
- } else {
555
- t7 = $[18];
556
- }
557
- const pluginCardInsights = useSlot("home.card.insight", t7);
558
- let t8;
559
- if ($[19] !== actionsArray || $[20] !== pluginCardActions) {
560
- t8 = /* @__PURE__ */ jsxs(Fragment, { children: [
561
- actionsArray,
562
- pluginCardActions
563
- ] });
564
- $[19] = actionsArray;
565
- $[20] = pluginCardActions;
566
- $[21] = t8;
567
- } else {
568
- t8 = $[21];
569
- }
570
- const actions = t8;
571
- let t9;
572
- if ($[22] !== pluginCardInsights) {
573
- t9 = pluginCardInsights.length > 0 ? /* @__PURE__ */ jsx(Fragment, { children: pluginCardInsights }) : void 0;
574
- $[22] = pluginCardInsights;
575
- $[23] = t9;
576
- } else {
577
- t9 = $[23];
578
- }
579
- let t10;
580
- if ($[24] !== navigate || $[25] !== onClick || $[26] !== slug || $[27] !== url || $[28] !== userConfigurationPersistence) {
581
- t10 = () => {
582
- onClick?.();
583
- navigate(url);
584
- if (userConfigurationPersistence) {
585
- userConfigurationPersistence.setRecentlyVisitedPaths([slug, ...(userConfigurationPersistence.recentlyVisitedPaths ?? []).filter((p_0) => p_0 !== slug)]);
586
- }
587
- };
588
- $[24] = navigate;
589
- $[25] = onClick;
590
- $[26] = slug;
591
- $[27] = url;
592
- $[28] = userConfigurationPersistence;
593
- $[29] = t10;
594
- } else {
595
- t10 = $[29];
596
- }
597
- let t11;
598
- if ($[30] !== actions || $[31] !== collectionIcon || $[32] !== description || $[33] !== name || $[34] !== shrink || $[35] !== t10 || $[36] !== t9) {
599
- t11 = /* @__PURE__ */ jsx(NavigationCard, { icon: collectionIcon, name, description, actions, additionalContent: t9, onClick: t10, shrink });
600
- $[30] = actions;
601
- $[31] = collectionIcon;
602
- $[32] = description;
603
- $[33] = name;
604
- $[34] = shrink;
605
- $[35] = t10;
606
- $[36] = t9;
607
- $[37] = t11;
608
- } else {
609
- t11 = $[37];
610
- }
611
- return t11;
612
- }
613
- const animateLayoutChanges = (args) => defaultAnimateLayoutChanges({
614
- ...args,
615
- wasDragging: true
616
- });
617
- const dropAnimationConfig = {};
618
- const cloneSerializableNavigationEntry = (entry) => {
619
- const clonedEntry = {
620
- id: entry.id,
621
- slug: entry.slug,
622
- url: entry.url,
623
- name: entry.name,
624
- type: entry.type,
625
- collection: entry.collection ? {
626
- ...entry.collection
627
- } : void 0,
628
- view: entry.view ? {
629
- ...entry.view
630
- } : void 0,
631
- ...entry.group && {
632
- group: entry.group
633
- },
634
- ...entry.description && {
635
- description: entry.description
636
- }
637
- };
638
- return clonedEntry;
639
- };
640
- const cloneItemsForDnd = (items) => items.map((g) => ({
641
- name: g.name,
642
- entries: g.entries.map(cloneSerializableNavigationEntry)
643
- }));
644
- function SortableNavigationCard(t0) {
645
- const $ = c(17);
646
- const {
647
- entry,
648
- onClick
649
- } = t0;
650
- let t1;
651
- if ($[0] !== entry.url) {
652
- t1 = {
653
- id: entry.url,
654
- animateLayoutChanges
655
- };
656
- $[0] = entry.url;
657
- $[1] = t1;
658
- } else {
659
- t1 = $[1];
660
- }
661
- const {
662
- setNodeRef,
663
- listeners,
664
- attributes,
665
- transform,
666
- transition,
667
- isDragging
668
- } = useSortable(t1);
669
- let t2;
670
- if ($[2] !== transform) {
671
- t2 = transform ? CSS.Transform.toString(transform) : void 0;
672
- $[2] = transform;
673
- $[3] = t2;
674
- } else {
675
- t2 = $[3];
676
- }
677
- const t3 = isDragging ? 0 : 1;
678
- let t4;
679
- if ($[4] !== t2 || $[5] !== t3 || $[6] !== transition) {
680
- t4 = {
681
- transform: t2,
682
- transition,
683
- opacity: t3
684
- };
685
- $[4] = t2;
686
- $[5] = t3;
687
- $[6] = transition;
688
- $[7] = t4;
689
- } else {
690
- t4 = $[7];
691
- }
692
- const style = t4;
693
- let t5;
694
- if ($[8] !== entry || $[9] !== onClick) {
695
- t5 = /* @__PURE__ */ jsx(NavigationCardBinding, { ...entry, onClick });
696
- $[8] = entry;
697
- $[9] = onClick;
698
- $[10] = t5;
699
- } else {
700
- t5 = $[10];
701
- }
702
- let t6;
703
- if ($[11] !== attributes || $[12] !== listeners || $[13] !== setNodeRef || $[14] !== style || $[15] !== t5) {
704
- t6 = /* @__PURE__ */ jsx("div", { ref: setNodeRef, style, ...attributes, ...listeners, children: t5 });
705
- $[11] = attributes;
706
- $[12] = listeners;
707
- $[13] = setNodeRef;
708
- $[14] = style;
709
- $[15] = t5;
710
- $[16] = t6;
711
- } else {
712
- t6 = $[16];
713
- }
714
- return t6;
715
- }
716
- function NavigationGroupDroppable(t0) {
717
- const $ = c(11);
718
- const {
719
- id,
720
- itemIds,
721
- children,
722
- isPotentialCardDropTarget: t1
723
- } = t0;
724
- const isPotentialCardDropTarget = t1 === void 0 ? false : t1;
725
- let t2;
726
- if ($[0] !== id) {
727
- t2 = {
728
- id
729
- };
730
- $[0] = id;
731
- $[1] = t2;
732
- } else {
733
- t2 = $[1];
734
- }
735
- const {
736
- setNodeRef
737
- } = useDroppable(t2);
738
- const t3 = isPotentialCardDropTarget ? "p-2 bg-surface-accent-200 dark:bg-surface-accent-800 rounded-lg" : void 0;
739
- let t4;
740
- if ($[2] !== t3) {
741
- t4 = cls(t3, "transition-all duration-200 ease-in-out");
742
- $[2] = t3;
743
- $[3] = t4;
744
- } else {
745
- t4 = $[3];
746
- }
747
- let t5;
748
- if ($[4] !== children || $[5] !== itemIds) {
749
- t5 = /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy: rectSortingStrategy, children });
750
- $[4] = children;
751
- $[5] = itemIds;
752
- $[6] = t5;
753
- } else {
754
- t5 = $[6];
755
- }
756
- let t6;
757
- if ($[7] !== setNodeRef || $[8] !== t4 || $[9] !== t5) {
758
- t6 = /* @__PURE__ */ jsx("div", { ref: setNodeRef, className: t4, children: t5 });
759
- $[7] = setNodeRef;
760
- $[8] = t4;
761
- $[9] = t5;
762
- $[10] = t6;
763
- } else {
764
- t6 = $[10];
765
- }
766
- return t6;
767
- }
768
- function SortableNavigationGroup(t0) {
769
- const $ = c(15);
770
- const {
771
- groupName,
772
- children,
773
- disabled
774
- } = t0;
775
- let t1;
776
- if ($[0] !== disabled || $[1] !== groupName) {
777
- t1 = {
778
- id: groupName,
779
- animateLayoutChanges,
780
- disabled
781
- };
782
- $[0] = disabled;
783
- $[1] = groupName;
784
- $[2] = t1;
785
- } else {
786
- t1 = $[2];
787
- }
788
- const {
789
- attributes,
790
- listeners,
791
- setNodeRef,
792
- transform,
793
- transition,
794
- isDragging
795
- } = useSortable(t1);
796
- let t2;
797
- if ($[3] !== transform) {
798
- t2 = transform ? CSS.Transform.toString(transform) : void 0;
799
- $[3] = transform;
800
- $[4] = t2;
801
- } else {
802
- t2 = $[4];
803
- }
804
- const t3 = isDragging ? 0 : 1;
805
- let t4;
806
- if ($[5] !== t2 || $[6] !== t3 || $[7] !== transition) {
807
- t4 = {
808
- transform: t2,
809
- transition,
810
- opacity: t3
811
- };
812
- $[5] = t2;
813
- $[6] = t3;
814
- $[7] = transition;
815
- $[8] = t4;
816
- } else {
817
- t4 = $[8];
818
- }
819
- const style = t4;
820
- let t5;
821
- if ($[9] !== attributes || $[10] !== children || $[11] !== listeners || $[12] !== setNodeRef || $[13] !== style) {
822
- t5 = /* @__PURE__ */ jsx("div", { ref: setNodeRef, style, ...attributes, ...listeners, children });
823
- $[9] = attributes;
824
- $[10] = children;
825
- $[11] = listeners;
826
- $[12] = setNodeRef;
827
- $[13] = style;
828
- $[14] = t5;
829
- } else {
830
- t5 = $[14];
831
- }
832
- return t5;
833
- }
834
- function useHomePageDnd({
835
- items,
836
- setItems,
837
- disabled,
838
- onCardMovedBetweenGroups,
839
- onGroupMoved,
840
- onNewGroupDrop,
841
- onPersist
842
- }) {
843
- const dndItems = items;
844
- const setDndItems = setItems;
845
- const [activeId, setActiveId] = useState(null);
846
- const [activeIsGroup, setActiveIsGroup] = useState(false);
847
- const [currentDraggingGroupId, setCurrentDraggingGroupId] = useState(null);
848
- const [dndKitActiveNode, setDndKitActiveNode] = useState(null);
849
- const [isDraggingCardOnly, setIsDraggingCardOnly] = useState(false);
850
- const [dialogOpenForGroup, setDialogOpenForGroup] = useState(null);
851
- const [isHoveringNewGroupDropZone, setIsHoveringNewGroupDropZone] = useState(false);
852
- const [pendingNewGroupName, setPendingNewGroupName] = useState(null);
853
- const [stateBeforeNewGroup, setStateBeforeNewGroup] = useState(null);
854
- const preDragItemsRef = useRef(null);
855
- const interimItemsRef = useRef(null);
856
- useEffect(() => {
857
- interimItemsRef.current = dndItems;
858
- }, [dndItems]);
859
- const mouseSensor = useSensor(MouseSensor, {
860
- activationConstraint: {
861
- distance: 10
862
- }
863
- });
864
- const touchSensor = useSensor(TouchSensor, {
865
- activationConstraint: {
866
- delay: 150,
867
- tolerance: 5
868
- }
869
- });
870
- const keyboardSensor = useSensor(KeyboardSensor);
871
- const sensors = useSensors(mouseSensor, touchSensor, keyboardSensor);
872
- const dndContainers = dndItems.map((g) => g.name);
873
- const findDndContainer = useCallback((id) => {
874
- if (!id) return void 0;
875
- const group = dndItems.find((g_0) => g_0.name === id);
876
- if (group) return group.name;
877
- for (const g_1 of dndItems) {
878
- if (g_1.entries.some((e) => e.url === id)) return g_1.name;
879
- }
880
- return void 0;
881
- }, [dndItems]);
882
- const lastOverId = useRef(null);
883
- const recentlyMovedToNewContainer = useRef(false);
884
- const collisionDetection = useCallback((args) => {
885
- if (disabled || !activeId) return [];
886
- if (activeIsGroup) {
887
- const groups = args.droppableContainers.filter((c2) => dndItems.some((g_2) => g_2.name === c2.id));
888
- if (!groups.length) return [];
889
- return closestCenter({
890
- ...args,
891
- droppableContainers: groups
892
- });
893
- }
894
- const pointer = pointerWithin(args);
895
- if (pointer.length) {
896
- const zone = pointer.find((c_0) => c_0.id === "new-group-drop-zone");
897
- if (zone) return [zone];
898
- const container = pointer.find((c_1) => dndItems.some((g_3) => g_3.name === c_1.id));
899
- if (container) {
900
- const itemsIn = dndItems.find((g_4) => g_4.name === container.id)?.entries;
901
- if (itemsIn?.length) {
902
- const closest = closestCorners({
903
- ...args,
904
- droppableContainers: args.droppableContainers.filter((c_2) => itemsIn.some((e_0) => e_0.url === c_2.id))
905
- });
906
- if (closest.length) return closest;
907
- }
908
- return [container];
909
- }
910
- const first = getFirstCollision(pointer, "id");
911
- if (first) return [{
912
- id: first
913
- }];
914
- }
915
- const rects = rectIntersection(args);
916
- const zoneRect = rects.find((c_3) => c_3.id === "new-group-drop-zone");
917
- if (zoneRect) return [zoneRect];
918
- let overId = getFirstCollision(rects, "id");
919
- if (overId != null) {
920
- const overIsContainer = dndItems.some((g_5) => g_5.name === overId);
921
- if (overIsContainer) {
922
- const itemsIn_0 = dndItems.find((g_6) => g_6.name === overId)?.entries;
923
- if (itemsIn_0?.length) {
924
- const closestItem = closestCorners({
925
- ...args,
926
- droppableContainers: args.droppableContainers.filter((c_4) => itemsIn_0.some((e_1) => e_1.url === c_4.id))
927
- })[0]?.id;
928
- if (closestItem) overId = closestItem;
929
- }
930
- }
931
- lastOverId.current = overId;
932
- return [{
933
- id: overId
934
- }];
935
- }
936
- if (recentlyMovedToNewContainer.current && lastOverId.current && !activeIsGroup) return [{
937
- id: lastOverId.current
938
- }];
939
- return [];
940
- }, [activeId, dndItems, disabled, activeIsGroup]);
941
- const handleDragStart = ({
942
- active
943
- }) => {
944
- setDndKitActiveNode(active);
945
- if (disabled) return;
946
- preDragItemsRef.current = cloneItemsForDnd(dndItems);
947
- const isGroup = dndItems.some((g_7) => g_7.name === active.id);
948
- if (!active.data.current) active.data.current = {};
949
- active.data.current.type = isGroup ? "group" : "item";
950
- setActiveId(active.id);
951
- setActiveIsGroup(isGroup);
952
- setIsDraggingCardOnly(!isGroup);
953
- if (isGroup) setCurrentDraggingGroupId(active.id);
954
- recentlyMovedToNewContainer.current = false;
955
- };
956
- const handleDragOver = ({
957
- active: active_0,
958
- over
959
- }) => {
960
- if (disabled || !over) return;
961
- const activeIdNow = active_0.id;
962
- const overIdNow = over.id;
963
- if (activeIdNow === overIdNow) return;
964
- if (activeIsGroup) return;
965
- const activeCont = findDndContainer(activeIdNow);
966
- const overCont = findDndContainer(overIdNow);
967
- if (!activeCont) return;
968
- if (overCont && activeCont !== overCont) {
969
- recentlyMovedToNewContainer.current = true;
970
- lastOverId.current = overIdNow;
971
- setDndItems((current) => {
972
- const newState = cloneItemsForDnd(current);
973
- const srcIdx = newState.findIndex((g_8) => g_8.name === activeCont);
974
- const tgtIdx = newState.findIndex((g_9) => g_9.name === overCont);
975
- if (srcIdx === -1 || tgtIdx === -1) return current;
976
- const src = newState[srcIdx];
977
- const tgt = newState[tgtIdx];
978
- const idxInSrc = src.entries.findIndex((e_2) => e_2.url === activeIdNow);
979
- if (idxInSrc === -1) return current;
980
- const [moved] = src.entries.splice(idxInSrc, 1);
981
- const overIsContainer_0 = overIdNow === overCont;
982
- if (overIsContainer_0) {
983
- tgt.entries.push(moved);
984
- } else {
985
- const overIdx = tgt.entries.findIndex((e_3) => e_3.url === overIdNow);
986
- if (overIdx !== -1) {
987
- tgt.entries.splice(overIdx, 0, moved);
988
- } else {
989
- tgt.entries.push(moved);
990
- }
991
- }
992
- return newState;
993
- });
994
- } else if (activeCont === overCont) {
995
- recentlyMovedToNewContainer.current = false;
996
- }
997
- };
998
- const handleDragEnd = ({
999
- active: active_1,
1000
- over: over_0
1001
- }) => {
1002
- if (disabled || !over_0) {
1003
- resetDragState();
1004
- return;
1005
- }
1006
- const activeIdNow_0 = active_1.id;
1007
- const overIdNow_0 = over_0.id;
1008
- if (activeIsGroup) {
1009
- if (activeIdNow_0 !== overIdNow_0 && dndItems.some((g_12) => g_12.name === overIdNow_0)) {
1010
- const from = dndItems.findIndex((g_10) => g_10.name === activeIdNow_0);
1011
- const to = dndItems.findIndex((g_11) => g_11.name === overIdNow_0);
1012
- if (from !== -1 && to !== -1) {
1013
- const newState_0 = arrayMove(dndItems, from, to);
1014
- setDndItems(newState_0);
1015
- onPersist?.(newState_0);
1016
- onGroupMoved?.(activeIdNow_0, from, to);
1017
- }
1018
- }
1019
- } else {
1020
- const findContainerInState = (id_0, state) => {
1021
- const group_0 = state.find((g_13) => g_13.name === id_0);
1022
- if (group_0) return group_0.name;
1023
- for (const g_14 of state) {
1024
- if (g_14.entries.some((e_4) => e_4.url === id_0)) return g_14.name;
1025
- }
1026
- return void 0;
1027
- };
1028
- const sourceState = preDragItemsRef.current || dndItems;
1029
- const activeCont_0 = findContainerInState(activeIdNow_0, sourceState);
1030
- findDndContainer(overIdNow_0);
1031
- if (overIdNow_0 === "new-group-drop-zone") {
1032
- if (activeCont_0) {
1033
- setStateBeforeNewGroup(cloneItemsForDnd(dndItems));
1034
- const newState_1 = cloneItemsForDnd(dndItems);
1035
- const srcIdx_0 = newState_1.findIndex((g_15) => g_15.name === activeCont_0);
1036
- if (srcIdx_0 !== -1) {
1037
- const src_0 = newState_1[srcIdx_0];
1038
- const idxInSrc_0 = src_0.entries.findIndex((e_5) => e_5.url === activeIdNow_0);
1039
- if (idxInSrc_0 !== -1) {
1040
- const [dragged] = src_0.entries.splice(idxInSrc_0, 1);
1041
- if (src_0.entries.length === 0) newState_1.splice(srcIdx_0, 1);
1042
- let tentative = "New Group";
1043
- let counter = 1;
1044
- while (newState_1.some((g_16) => g_16.name === tentative)) tentative = `New Group ${counter++}`;
1045
- newState_1.push({
1046
- name: tentative,
1047
- entries: [dragged]
1048
- });
1049
- setDndItems(newState_1);
1050
- setPendingNewGroupName(tentative);
1051
- setDialogOpenForGroup(tentative);
1052
- onNewGroupDrop?.();
1053
- }
1054
- }
1055
- }
1056
- } else {
1057
- const overCont_1 = findDndContainer(overIdNow_0);
1058
- if (activeCont_0 === overCont_1) {
1059
- const grpIdx = dndItems.findIndex((g_17) => g_17.name === activeCont_0);
1060
- if (grpIdx !== -1) {
1061
- const group_1 = dndItems[grpIdx];
1062
- const oldIdx = group_1.entries.findIndex((e_6) => e_6.url === activeIdNow_0);
1063
- let newIdx = group_1.entries.findIndex((e_7) => e_7.url === overIdNow_0);
1064
- if (newIdx === -1 && overIdNow_0 === activeCont_0) newIdx = group_1.entries.length - 1;
1065
- if (oldIdx !== -1 && newIdx !== -1 && oldIdx !== newIdx) {
1066
- const reordered = arrayMove(group_1.entries, oldIdx, newIdx);
1067
- const newState_2 = [...dndItems];
1068
- newState_2[grpIdx] = {
1069
- ...group_1,
1070
- entries: reordered
1071
- };
1072
- setDndItems(newState_2);
1073
- onPersist?.(newState_2);
1074
- }
1075
- }
1076
- } else if (overCont_1 && activeCont_0 !== overCont_1) {
1077
- const finalState = cloneItemsForDnd(sourceState);
1078
- const finalOverId = lastOverId.current || overIdNow_0;
1079
- const cleanOverCont = findContainerInState(finalOverId, sourceState) || overCont_1;
1080
- const srcIdx_1 = finalState.findIndex((g_18) => g_18.name === activeCont_0);
1081
- const tgtIdx_0 = finalState.findIndex((g_19) => g_19.name === cleanOverCont);
1082
- if (srcIdx_1 !== -1 && tgtIdx_0 !== -1) {
1083
- const src_1 = finalState[srcIdx_1];
1084
- const tgt_0 = finalState[tgtIdx_0];
1085
- const idxInSrc_1 = src_1.entries.findIndex((e_8) => e_8.url === activeIdNow_0);
1086
- if (idxInSrc_1 !== -1) {
1087
- const [moved_0] = src_1.entries.splice(idxInSrc_1, 1);
1088
- const overIsContainer_1 = finalOverId === cleanOverCont;
1089
- if (overIsContainer_1) {
1090
- tgt_0.entries.push(moved_0);
1091
- } else {
1092
- const overIdx_0 = tgt_0.entries.findIndex((e_9) => e_9.url === finalOverId);
1093
- if (overIdx_0 !== -1) {
1094
- tgt_0.entries.splice(overIdx_0, 0, moved_0);
1095
- } else {
1096
- tgt_0.entries.push(moved_0);
1097
- }
1098
- }
1099
- if (src_1.entries.length === 0) {
1100
- finalState.splice(srcIdx_1, 1);
1101
- }
1102
- setDndItems(finalState);
1103
- onPersist?.(finalState);
1104
- onCardMovedBetweenGroups?.(moved_0);
1105
- }
1106
- }
1107
- } else if (recentlyMovedToNewContainer.current) {
1108
- console.error("Move between containers detected but conditions not met", {
1109
- activeCont: activeCont_0,
1110
- overCont: overCont_1,
1111
- activeIdNow: activeIdNow_0,
1112
- overIdNow: overIdNow_0
1113
- });
1114
- }
1115
- }
1116
- }
1117
- resetDragState();
1118
- };
1119
- const resetDragState = () => {
1120
- setDndKitActiveNode(null);
1121
- setActiveId(null);
1122
- setActiveIsGroup(false);
1123
- setCurrentDraggingGroupId(null);
1124
- setIsDraggingCardOnly(false);
1125
- recentlyMovedToNewContainer.current = false;
1126
- };
1127
- const handleDragCancel = () => resetDragState();
1128
- const handleRenameGroup = (oldName, newName) => {
1129
- setDndItems((current_0) => {
1130
- const idx = current_0.findIndex((g_20) => g_20.name === oldName);
1131
- if (idx === -1) return current_0;
1132
- if (current_0.some((g_21) => g_21.name === newName && g_21.name !== oldName)) return current_0;
1133
- const updated = [...current_0];
1134
- updated[idx] = {
1135
- ...updated[idx],
1136
- name: newName
1137
- };
1138
- onPersist?.(updated);
1139
- return updated;
1140
- });
1141
- setPendingNewGroupName(null);
1142
- setStateBeforeNewGroup(null);
1143
- setDialogOpenForGroup(null);
1144
- };
1145
- const handleDialogClose = () => {
1146
- if (pendingNewGroupName && dialogOpenForGroup === pendingNewGroupName && stateBeforeNewGroup) {
1147
- setDndItems(stateBeforeNewGroup);
1148
- }
1149
- setPendingNewGroupName(null);
1150
- setStateBeforeNewGroup(null);
1151
- setDialogOpenForGroup(null);
1152
- };
1153
- const activeItemForOverlay = disabled || !activeId || activeIsGroup ? null : dndItems.flatMap((g_22) => g_22.entries).find((e_10) => e_10.url === activeId) || null;
1154
- const activeGroupData = disabled || !activeId || !activeIsGroup ? null : dndItems.find((g_23) => g_23.name === activeId) || null;
1155
- return {
1156
- sensors,
1157
- collisionDetection,
1158
- onDragStart: handleDragStart,
1159
- onDragOver: handleDragOver,
1160
- onDragEnd: handleDragEnd,
1161
- onDragCancel: handleDragCancel,
1162
- dropAnimation: dropAnimationConfig,
1163
- activeItemForOverlay,
1164
- activeGroupData,
1165
- draggingGroupId: currentDraggingGroupId,
1166
- containers: dndContainers,
1167
- dndKitActiveNode,
1168
- isDraggingCardOnly,
1169
- dialogOpenForGroup,
1170
- setDialogOpenForGroup,
1171
- handleRenameGroup,
1172
- handleDialogClose,
1173
- isHoveringNewGroupDropZone,
1174
- setIsHoveringNewGroupDropZone
1175
- };
1176
- }
1177
- function NewGroupDropZone(t0) {
1178
- const $ = c(15);
1179
- const {
1180
- disabled,
1181
- setIsHovering
1182
- } = t0;
1183
- let t1;
1184
- if ($[0] !== disabled) {
1185
- t1 = {
1186
- id: "new-group-drop-zone",
1187
- disabled
1188
- };
1189
- $[0] = disabled;
1190
- $[1] = t1;
1191
- } else {
1192
- t1 = $[1];
1193
- }
1194
- const {
1195
- setNodeRef,
1196
- isOver
1197
- } = useDroppable(t1);
1198
- const [isVisible, setIsVisible] = useState(false);
1199
- let t2;
1200
- if ($[2] !== disabled) {
1201
- t2 = {
1202
- onDragStart(t32) {
1203
- const {
1204
- active
1205
- } = t32;
1206
- if (disabled) {
1207
- return;
1208
- }
1209
- const tp = active.data.current?.type;
1210
- setIsVisible(tp === "item");
1211
- },
1212
- onDragEnd() {
1213
- setIsVisible(false);
1214
- },
1215
- onDragCancel() {
1216
- setIsVisible(false);
1217
- }
1218
- };
1219
- $[2] = disabled;
1220
- $[3] = t2;
1221
- } else {
1222
- t2 = $[3];
1223
- }
1224
- useDndMonitor(t2);
1225
- let t3;
1226
- let t4;
1227
- if ($[4] !== isOver || $[5] !== isVisible || $[6] !== setIsHovering) {
1228
- t3 = () => {
1229
- setIsHovering(isOver && isVisible);
1230
- };
1231
- t4 = [isOver, isVisible, setIsHovering];
1232
- $[4] = isOver;
1233
- $[5] = isVisible;
1234
- $[6] = setIsHovering;
1235
- $[7] = t3;
1236
- $[8] = t4;
1237
- } else {
1238
- t3 = $[7];
1239
- t4 = $[8];
1240
- }
1241
- useEffect(t3, t4);
1242
- if (!isVisible || disabled) {
1243
- return null;
1244
- }
1245
- const t5 = isOver ? "bg-surface-accent-100 dark:bg-surface-accent-800 border-surface-300 dark:border-surface-600" : "bg-surface-50 dark:bg-surface-900 border-surface-200 dark:border-surface-700";
1246
- let t6;
1247
- if ($[9] !== t5) {
1248
- t6 = cls("fixed right-8 top-1/2 -translate-y-1/2 w-[200px] h-[120px] border border-dashed rounded-lg flex items-center justify-center transition-all", t5);
1249
- $[9] = t5;
1250
- $[10] = t6;
1251
- } else {
1252
- t6 = $[10];
1253
- }
1254
- let t7;
1255
- if ($[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1256
- t7 = /* @__PURE__ */ jsx("div", { className: "text-center p-4", children: /* @__PURE__ */ jsx("span", { className: "block font-medium text-sm", children: "Drop here to create a new group" }) });
1257
- $[11] = t7;
1258
- } else {
1259
- t7 = $[11];
1260
- }
1261
- let t8;
1262
- if ($[12] !== setNodeRef || $[13] !== t6) {
1263
- t8 = /* @__PURE__ */ jsx("div", { ref: setNodeRef, className: t6, children: t7 });
1264
- $[12] = setNodeRef;
1265
- $[13] = t6;
1266
- $[14] = t8;
1267
- } else {
1268
- t8 = $[14];
1269
- }
1270
- return t8;
1271
- }
1272
- function RenameGroupDialog(t0) {
1273
- const $ = c(56);
1274
- const {
1275
- open,
1276
- initialName,
1277
- existingGroupNames,
1278
- onClose,
1279
- onRename
1280
- } = t0;
1281
- const {
1282
- t
1283
- } = useTranslation();
1284
- const [name, setName] = useState(initialName);
1285
- const [error, setError] = useState(null);
1286
- const inputRef = useRef(null);
1287
- let t1;
1288
- let t2;
1289
- if ($[0] !== initialName || $[1] !== open) {
1290
- t1 = () => {
1291
- if (open) {
1292
- setName(initialName);
1293
- setError(null);
1294
- setTimeout(() => {
1295
- if (inputRef.current) {
1296
- inputRef.current.focus();
1297
- inputRef.current.select();
1298
- }
1299
- }, 100);
1300
- }
1301
- };
1302
- t2 = [initialName, open];
1303
- $[0] = initialName;
1304
- $[1] = open;
1305
- $[2] = t1;
1306
- $[3] = t2;
1307
- } else {
1308
- t1 = $[2];
1309
- t2 = $[3];
1310
- }
1311
- useEffect(t1, t2);
1312
- let t3;
1313
- if ($[4] !== existingGroupNames || $[5] !== t) {
1314
- t3 = (event) => {
1315
- const newName = event.target.value;
1316
- setName(newName);
1317
- if (!newName.trim()) {
1318
- setError(t("group_name_empty_error"));
1319
- } else {
1320
- if (existingGroupNames.includes(newName.trim())) {
1321
- setError(t("group_name_exists_error"));
1322
- } else {
1323
- setError(null);
1324
- }
1325
- }
1326
- };
1327
- $[4] = existingGroupNames;
1328
- $[5] = t;
1329
- $[6] = t3;
1330
- } else {
1331
- t3 = $[6];
1332
- }
1333
- const handleNameChange = t3;
1334
- let t4;
1335
- if ($[7] !== error || $[8] !== existingGroupNames || $[9] !== name || $[10] !== onClose || $[11] !== onRename || $[12] !== t) {
1336
- t4 = () => {
1337
- const trimmedName = name.trim();
1338
- if (!trimmedName) {
1339
- setError(t("group_name_empty_error"));
1340
- return;
1341
- }
1342
- if (existingGroupNames.includes(trimmedName)) {
1343
- setError(t("group_name_exists_error"));
1344
- return;
1345
- }
1346
- if (!error) {
1347
- onRename(trimmedName);
1348
- onClose();
1349
- }
1350
- };
1351
- $[7] = error;
1352
- $[8] = existingGroupNames;
1353
- $[9] = name;
1354
- $[10] = onClose;
1355
- $[11] = onRename;
1356
- $[12] = t;
1357
- $[13] = t4;
1358
- } else {
1359
- t4 = $[13];
1360
- }
1361
- const handleSave = t4;
1362
- let t5;
1363
- if ($[14] !== existingGroupNames || $[15] !== handleSave || $[16] !== name || $[17] !== t) {
1364
- t5 = (event_0) => {
1365
- if (event_0.key === "Enter") {
1366
- event_0.preventDefault();
1367
- const trimmedName_0 = name.trim();
1368
- let currentError = null;
1369
- if (!trimmedName_0) {
1370
- currentError = t("group_name_empty_error");
1371
- } else {
1372
- if (existingGroupNames.includes(trimmedName_0)) {
1373
- currentError = t("group_name_exists_error");
1374
- }
1375
- }
1376
- if (!currentError && trimmedName_0) {
1377
- handleSave();
1378
- } else {
1379
- if (currentError) {
1380
- setError(currentError);
1381
- }
1382
- }
1383
- }
1384
- };
1385
- $[14] = existingGroupNames;
1386
- $[15] = handleSave;
1387
- $[16] = name;
1388
- $[17] = t;
1389
- $[18] = t5;
1390
- } else {
1391
- t5 = $[18];
1392
- }
1393
- const handleKeyDown = t5;
1394
- if (!open) {
1395
- return null;
1396
- }
1397
- let t6;
1398
- if ($[19] !== t) {
1399
- t6 = t("rename_group");
1400
- $[19] = t;
1401
- $[20] = t6;
1402
- } else {
1403
- t6 = $[20];
1404
- }
1405
- let t7;
1406
- if ($[21] !== t6) {
1407
- t7 = /* @__PURE__ */ jsx(DialogTitle, { children: t6 });
1408
- $[21] = t6;
1409
- $[22] = t7;
1410
- } else {
1411
- t7 = $[22];
1412
- }
1413
- let t8;
1414
- if ($[23] !== t) {
1415
- t8 = t("group_name_label");
1416
- $[23] = t;
1417
- $[24] = t8;
1418
- } else {
1419
- t8 = $[24];
1420
- }
1421
- const t9 = !!error;
1422
- const t10 = error ? "group-name-error" : void 0;
1423
- let t11;
1424
- if ($[25] !== handleKeyDown || $[26] !== handleNameChange || $[27] !== name || $[28] !== t10 || $[29] !== t8 || $[30] !== t9) {
1425
- t11 = /* @__PURE__ */ jsx(TextField, { inputRef, label: t8, value: name, onChange: handleNameChange, onKeyDown: handleKeyDown, error: t9, "aria-describedby": t10 });
1426
- $[25] = handleKeyDown;
1427
- $[26] = handleNameChange;
1428
- $[27] = name;
1429
- $[28] = t10;
1430
- $[29] = t8;
1431
- $[30] = t9;
1432
- $[31] = t11;
1433
- } else {
1434
- t11 = $[31];
1435
- }
1436
- let t12;
1437
- if ($[32] !== error) {
1438
- t12 = error && /* @__PURE__ */ jsx("p", { id: "group-name-error", style: {
1439
- display: "none"
1440
- }, children: error });
1441
- $[32] = error;
1442
- $[33] = t12;
1443
- } else {
1444
- t12 = $[33];
1445
- }
1446
- let t13;
1447
- if ($[34] !== t11 || $[35] !== t12) {
1448
- t13 = /* @__PURE__ */ jsxs(DialogContent, { children: [
1449
- t11,
1450
- t12
1451
- ] });
1452
- $[34] = t11;
1453
- $[35] = t12;
1454
- $[36] = t13;
1455
- } else {
1456
- t13 = $[36];
1457
- }
1458
- let t14;
1459
- if ($[37] !== t) {
1460
- t14 = t("cancel");
1461
- $[37] = t;
1462
- $[38] = t14;
1463
- } else {
1464
- t14 = $[38];
1465
- }
1466
- let t15;
1467
- if ($[39] !== onClose || $[40] !== t14) {
1468
- t15 = /* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "text", children: t14 });
1469
- $[39] = onClose;
1470
- $[40] = t14;
1471
- $[41] = t15;
1472
- } else {
1473
- t15 = $[41];
1474
- }
1475
- const t16 = !!error || !name.trim();
1476
- let t17;
1477
- if ($[42] !== t) {
1478
- t17 = t("save");
1479
- $[42] = t;
1480
- $[43] = t17;
1481
- } else {
1482
- t17 = $[43];
1483
- }
1484
- let t18;
1485
- if ($[44] !== handleSave || $[45] !== t16 || $[46] !== t17) {
1486
- t18 = /* @__PURE__ */ jsx(Button, { onClick: handleSave, disabled: t16, children: t17 });
1487
- $[44] = handleSave;
1488
- $[45] = t16;
1489
- $[46] = t17;
1490
- $[47] = t18;
1491
- } else {
1492
- t18 = $[47];
1493
- }
1494
- let t19;
1495
- if ($[48] !== t15 || $[49] !== t18) {
1496
- t19 = /* @__PURE__ */ jsxs(DialogActions, { children: [
1497
- t15,
1498
- t18
1499
- ] });
1500
- $[48] = t15;
1501
- $[49] = t18;
1502
- $[50] = t19;
1503
- } else {
1504
- t19 = $[50];
1505
- }
1506
- let t20;
1507
- if ($[51] !== open || $[52] !== t13 || $[53] !== t19 || $[54] !== t7) {
1508
- t20 = /* @__PURE__ */ jsxs(Dialog, { open, children: [
1509
- t7,
1510
- t13,
1511
- t19
1512
- ] });
1513
- $[51] = open;
1514
- $[52] = t13;
1515
- $[53] = t19;
1516
- $[54] = t7;
1517
- $[55] = t20;
1518
- } else {
1519
- t20 = $[55];
1520
- }
1521
- return t20;
1522
- }
1523
- const DEFAULT_GROUP_NAME = "Views";
1524
- const ADMIN_GROUP_NAME = "Admin";
1525
- function ContentHomePage({
1526
- additionalActions,
1527
- additionalChildrenStart,
1528
- additionalChildrenEnd,
1529
- sections,
1530
- hiddenGroups
1531
- }) {
1532
- const context = useCMSContext();
1533
- const {
1534
- navigationStateController
1535
- } = context;
1536
- const customizationController = useCustomizationController();
1537
- const adminModeController = useAdminModeController();
1538
- const isStudioMode = adminModeController.mode === "studio";
1539
- const {
1540
- resolvedSlots
1541
- } = customizationController;
1542
- const breadcrumbs = useBreadcrumbsController();
1543
- const {
1544
- t
1545
- } = useTranslation();
1546
- useEffect(() => {
1547
- breadcrumbs.set({
1548
- breadcrumbs: []
1549
- });
1550
- }, [breadcrumbs.set]);
1551
- const {
1552
- allowDragAndDrop = false,
1553
- navigationEntries: unFilteredNavigationEntries = [],
1554
- groups: unFilteredGroupOrder = [],
1555
- onNavigationEntriesUpdate = () => {
1556
- }
1557
- } = navigationStateController.topLevelNavigation || {};
1558
- const rawNavigationEntries = useMemo(() => {
1559
- return unFilteredNavigationEntries.filter((e) => {
1560
- const isStudioGroup = e.group ? STUDIO_NAVIGATION_GROUPS.includes(e.group) : false;
1561
- return isStudioMode ? isStudioGroup : !isStudioGroup;
1562
- });
1563
- }, [unFilteredNavigationEntries, isStudioMode]);
1564
- const groupOrderFromNavController = useMemo(() => {
1565
- return unFilteredGroupOrder.filter((g) => {
1566
- const isStudioGroup_0 = STUDIO_NAVIGATION_GROUPS.includes(g);
1567
- return isStudioMode ? isStudioGroup_0 : !isStudioGroup_0;
1568
- });
1569
- }, [unFilteredGroupOrder, isStudioMode]);
1570
- const fuse = useRef(null);
1571
- const [filteredUrls, setFilteredUrls] = useState(null);
1572
- const performingSearch = Boolean(filteredUrls);
1573
- const filteredNavigationEntries = useMemo(() => {
1574
- return filteredUrls ? rawNavigationEntries.filter((e_0) => filteredUrls.includes(e_0.url)) : rawNavigationEntries;
1575
- }, [filteredUrls, rawNavigationEntries]);
1576
- useEffect(() => {
1577
- fuse.current = new Fuse(rawNavigationEntries, {
1578
- keys: ["name", "description", "group", "path"]
1579
- });
1580
- }, [rawNavigationEntries]);
1581
- const updateSearch = useCallback((v) => {
1582
- if (!v?.trim()) {
1583
- setFilteredUrls(null);
1584
- return;
1585
- }
1586
- const results = fuse.current?.search(v.trim());
1587
- setFilteredUrls(results ? results.map((x) => x.item.url) : []);
1588
- }, []);
1589
- const [items, setItems] = useState([]);
1590
- const [adminGroupData, setAdminGroupData] = useState(null);
1591
- const isDndDirtyRef = useRef(false);
1592
- const dndDirtyTimeoutRef = useRef(null);
1593
- const processedGroups = useMemo(() => {
1594
- const src = filteredNavigationEntries;
1595
- const entriesByGroup = {};
1596
- src.forEach((e_1) => {
1597
- const g_0 = e_1.type === "admin" ? ADMIN_GROUP_NAME : e_1.group ?? DEFAULT_GROUP_NAME;
1598
- (entriesByGroup[g_0] ??= []).push(e_1);
1599
- });
1600
- const hasPluginAdditionalCards = customizationController.resolvedSlots.some((s) => s.slot === "home.cards");
1601
- let allProcessed;
1602
- if (performingSearch) {
1603
- const ordered = [...new Set(src.map((e_2) => e_2.group ?? DEFAULT_GROUP_NAME))];
1604
- allProcessed = ordered.map((name) => ({
1605
- name,
1606
- entries: entriesByGroup[name] || []
1607
- })).filter((g_1) => g_1.entries.length);
1608
- } else {
1609
- allProcessed = groupOrderFromNavController.map((g_2) => ({
1610
- name: g_2,
1611
- entries: entriesByGroup[g_2] || []
1612
- }));
1613
- Object.keys(entriesByGroup).forEach((g_3) => {
1614
- if (!groupOrderFromNavController.includes(g_3)) allProcessed.push({
1615
- name: g_3,
1616
- entries: entriesByGroup[g_3]
1617
- });
1618
- });
1619
- if (hasPluginAdditionalCards && !allProcessed.some((g_4) => g_4.name === DEFAULT_GROUP_NAME)) {
1620
- allProcessed.push({
1621
- name: DEFAULT_GROUP_NAME,
1622
- entries: []
1623
- });
1624
- }
1625
- allProcessed = allProcessed.filter((g_5) => g_5.entries.length || g_5.name === DEFAULT_GROUP_NAME && hasPluginAdditionalCards);
1626
- }
1627
- const admin = allProcessed.find((g_6) => g_6.name === ADMIN_GROUP_NAME);
1628
- return {
1629
- adminGroupData: admin || null,
1630
- items: allProcessed.filter((g_7) => g_7.name !== ADMIN_GROUP_NAME && !hiddenGroups?.includes(g_7.name))
1631
- };
1632
- }, [filteredNavigationEntries, performingSearch, groupOrderFromNavController, customizationController.resolvedSlots, hiddenGroups]);
1633
- useEffect(() => {
1634
- if (isDndDirtyRef.current) {
1635
- return;
1636
- }
1637
- setAdminGroupData(processedGroups.adminGroupData);
1638
- setItems(processedGroups.items);
1639
- }, [processedGroups]);
1640
- const updateItems = (updater) => {
1641
- setItems(updater);
1642
- };
1643
- const persistNavigationGroups = (latest) => {
1644
- isDndDirtyRef.current = true;
1645
- if (dndDirtyTimeoutRef.current) {
1646
- clearTimeout(dndDirtyTimeoutRef.current);
1647
- }
1648
- dndDirtyTimeoutRef.current = setTimeout(() => {
1649
- isDndDirtyRef.current = false;
1650
- }, 1e3);
1651
- const draggable = latest.map((g_8) => ({
1652
- name: g_8.name,
1653
- entries: g_8.entries.map((e_3) => e_3.slug)
1654
- }));
1655
- const all = adminGroupData ? [...draggable, {
1656
- name: adminGroupData.name,
1657
- entries: adminGroupData.entries.map((e_4) => e_4.slug)
1658
- }] : draggable;
1659
- onNavigationEntriesUpdate(all);
1660
- };
1661
- const groupNames = useMemo(() => [...items.map((item) => item.name), ...adminGroupData ? [adminGroupData.name] : []], [items, adminGroupData]);
1662
- const {
1663
- isGroupCollapsed,
1664
- toggleGroupCollapsed
1665
- } = useCollapsedGroups(groupNames, "home");
1666
- const {
1667
- sensors,
1668
- collisionDetection,
1669
- onDragStart,
1670
- onDragOver,
1671
- onDragEnd,
1672
- dropAnimation,
1673
- activeItemForOverlay,
1674
- activeGroupData,
1675
- draggingGroupId,
1676
- containers,
1677
- dndKitActiveNode,
1678
- onDragCancel,
1679
- isDraggingCardOnly,
1680
- dialogOpenForGroup,
1681
- setDialogOpenForGroup,
1682
- handleRenameGroup,
1683
- handleDialogClose,
1684
- isHoveringNewGroupDropZone,
1685
- setIsHoveringNewGroupDropZone
1686
- } = useHomePageDnd({
1687
- items,
1688
- setItems: updateItems,
1689
- disabled: !allowDragAndDrop || performingSearch,
1690
- onPersist: persistNavigationGroups,
1691
- onGroupMoved: (g_9) => context.analyticsController?.onAnalyticsEvent?.("home_move_group", {
1692
- name: g_9
1693
- }),
1694
- onCardMovedBetweenGroups: (card) => context.analyticsController?.onAnalyticsEvent?.("home_move_card", {
1695
- id: card.id
1696
- }),
1697
- onNewGroupDrop: () => context.analyticsController?.onAnalyticsEvent?.("home_drop_new_group")
1698
- });
1699
- const {
1700
- containerRef,
1701
- direction
1702
- } = useRestoreScroll();
1703
- const dndDisabled = !allowDragAndDrop || performingSearch;
1704
- const dndModifiers = dndKitActiveNode?.data.current?.type === "group" ? [restrictToVerticalAxis, restrictToWindowEdges] : [restrictToWindowEdges];
1705
- const sectionProps = {
1706
- context
1707
- };
1708
- const additionalPluginChildrenStart = useSlot("home.children.start", sectionProps);
1709
- const additionalPluginChildrenEnd = useSlot("home.children.end", sectionProps);
1710
- const additionalPluginActions = useSlot("home.actions", sectionProps);
1711
- const homeCardContributions = useMemo(() => {
1712
- return resolvedSlots.filter((s_0) => s_0.slot === "home.cards").sort((a, b) => (a.order ?? 50) - (b.order ?? 50));
1713
- }, [resolvedSlots]);
1714
- return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: "py-2 overflow-auto h-full w-full dark:bg-surface-800", children: [
1715
- /* @__PURE__ */ jsxs(Container, { maxWidth: "6xl", children: [
1716
- /* @__PURE__ */ jsxs("div", { className: "w-full sticky py-4 transition-all duration-400 ease-in-out top-0 z-10 flex flex-row gap-4", style: {
1717
- top: direction === "down" ? -84 : 0
1718
- }, children: [
1719
- /* @__PURE__ */ jsx(SearchBar, { onTextSearch: updateSearch, placeholder: t("search_collections"), autoFocus: true, size: "small", innerClassName: "w-full", className: "w-full grow" }),
1720
- additionalActions,
1721
- additionalPluginActions
1722
- ] }),
1723
- /* @__PURE__ */ jsx(FavouritesView, { hidden: performingSearch }),
1724
- additionalChildrenStart,
1725
- additionalPluginChildrenStart,
1726
- /* @__PURE__ */ jsxs(DndContext, { sensors, collisionDetection, measuring: {
1727
- droppable: {
1728
- strategy: MeasuringStrategy.Always,
1729
- frequency: 500
1730
- }
1731
- }, onDragStart, onDragOver, onDragEnd, onDragCancel, modifiers: dndModifiers, children: [
1732
- /* @__PURE__ */ jsx(SortableContext, { items: containers, strategy: verticalListSortingStrategy, children: items.map((groupData, groupIndex) => {
1733
- const groupKey = groupData.name;
1734
- const entriesInGroup = groupData.entries;
1735
- const homeCardsProps = {
1736
- group: groupKey === DEFAULT_GROUP_NAME ? void 0 : groupKey,
1737
- context
1738
- };
1739
- const additionalCards = homeCardContributions.map((s_1, i) => /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(s_1.Component, { ...homeCardsProps, ...s_1.props ?? {} }) }, `home_cards_${groupKey}_${i}`));
1740
- if (entriesInGroup.length === 0 && (additionalCards.length === 0 || performingSearch)) return null;
1741
- return /* @__PURE__ */ jsx(SortableNavigationGroup, { groupName: groupKey, disabled: dndDisabled, children: /* @__PURE__ */ jsx(NavigationGroup, { group: groupKey === DEFAULT_GROUP_NAME ? void 0 : groupKey, minimised: draggingGroupId === groupKey && !isDraggingCardOnly, isPotentialCardDropTarget: isDraggingCardOnly, dndDisabled, onEditGroup: () => {
1742
- if (dndDisabled) return;
1743
- setDialogOpenForGroup(groupKey);
1744
- }, collapsed: isGroupCollapsed(groupKey), onToggleCollapsed: () => toggleGroupCollapsed(groupKey), children: /* @__PURE__ */ jsx(NavigationGroupDroppable, { id: groupKey, itemIds: entriesInGroup.map((e_5) => e_5.url), isPotentialCardDropTarget: isDraggingCardOnly, children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 ", children: [
1745
- entriesInGroup.map((entry) => /* @__PURE__ */ jsx(SortableNavigationCard, { entry, onClick: () => {
1746
- let event = "unmapped_event";
1747
- if (entry.type === "collection") event = "home_navigate_to_collection";
1748
- else if (entry.type === "view") event = "home_navigate_to_view";
1749
- else if (entry.type === "admin") event = "home_navigate_to_admin_view";
1750
- context.analyticsController?.onAnalyticsEvent?.(event, {
1751
- path: entry.slug
1752
- });
1753
- } }, entry.url)),
1754
- !performingSearch && groupKey.toLowerCase() !== ADMIN_GROUP_NAME.toLowerCase() && additionalCards
1755
- ] }) }) }) }, `group-${groupIndex}`);
1756
- }) }, JSON.stringify(containers)),
1757
- /* @__PURE__ */ jsx(NewGroupDropZone, { disabled: dndDisabled, setIsHovering: setIsHoveringNewGroupDropZone }),
1758
- /* @__PURE__ */ jsx(DragOverlay, { adjustScale: false, dropAnimation, children: activeGroupData && draggingGroupId === activeGroupData.name ? /* @__PURE__ */ jsx("div", { className: "rounded-lg bg-transparent", style: {
1759
- padding: 0,
1760
- margin: 0
1761
- }, children: /* @__PURE__ */ jsx(NavigationGroup, { group: activeGroupData.name === DEFAULT_GROUP_NAME ? void 0 : activeGroupData.name, isPreview: false, minimised: true }) }) : activeItemForOverlay ? /* @__PURE__ */ jsx(NavigationCardBinding, { ...activeItemForOverlay, shrink: isHoveringNewGroupDropZone }) : null })
1762
- ] }),
1763
- !performingSearch && adminGroupData && /* @__PURE__ */ jsx(NavigationGroup, { group: adminGroupData.name, collapsed: isGroupCollapsed(adminGroupData.name), onToggleCollapsed: () => toggleGroupCollapsed(adminGroupData.name), children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 ", children: adminGroupData.entries.map((entry_0) => /* @__PURE__ */ jsx(NavigationCardBinding, { ...entry_0, onClick: () => {
1764
- let event_0 = "unmapped_event";
1765
- if (entry_0.type === "collection") event_0 = "home_navigate_to_collection";
1766
- else if (entry_0.type === "view") event_0 = "home_navigate_to_view";
1767
- else if (entry_0.type === "admin") event_0 = "home_navigate_to_admin_view";
1768
- context.analyticsController?.onAnalyticsEvent?.(event_0, {
1769
- path: entry_0.slug
1770
- });
1771
- } }, entry_0.url)) }) }),
1772
- sections && sections.map((section) => /* @__PURE__ */ jsx(NavigationGroup, { group: section.title, children: section.children }, section.key)),
1773
- additionalPluginChildrenEnd,
1774
- additionalChildrenEnd
1775
- ] }),
1776
- dialogOpenForGroup && /* @__PURE__ */ jsx(RenameGroupDialog, { open: true, initialName: dialogOpenForGroup, existingGroupNames: items.map((g_10) => g_10.name).filter((n) => n !== dialogOpenForGroup), onClose: handleDialogClose, onRename: (newName) => {
1777
- handleRenameGroup(dialogOpenForGroup, newName);
1778
- } })
1779
- ] });
1780
- }
1781
- export {
1782
- ADMIN_GROUP_NAME,
1783
- ContentHomePage,
1784
- DEFAULT_GROUP_NAME
1785
- };
1786
- //# sourceMappingURL=ContentHomePage-CDF_a6Lp.js.map