@rebasepro/cms 0.23.0 → 0.24.1-canary.g19596ef

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (840) hide show
  1. package/README.md +3 -1
  2. package/dist/collection_editor/CollectionEditorDialogsContext.js +10 -0
  3. package/dist/collection_editor/CollectionEditorDialogsContext.js.map +1 -0
  4. package/dist/collection_editor/ConfigControllerProvider.js +274 -0
  5. package/dist/collection_editor/ConfigControllerProvider.js.map +1 -0
  6. package/dist/collection_editor/_cms_internals.d.ts +2 -1
  7. package/dist/collection_editor/api/generateCollectionApi.js +64 -0
  8. package/dist/collection_editor/api/generateCollectionApi.js.map +1 -0
  9. package/dist/collection_editor/collection_wire.d.ts +13 -0
  10. package/dist/collection_editor/collection_wire.js +49 -0
  11. package/dist/collection_editor/collection_wire.js.map +1 -0
  12. package/dist/collection_editor/liveSchemaClient.d.ts +38 -18
  13. package/dist/collection_editor/liveSchemaClient.js +130 -0
  14. package/dist/collection_editor/liveSchemaClient.js.map +1 -0
  15. package/dist/collection_editor/relation_kinds.js +74 -0
  16. package/dist/collection_editor/relation_kinds.js.map +1 -0
  17. package/dist/collection_editor/serializable_types.d.ts +6 -1
  18. package/dist/collection_editor/serializable_utils.js +504 -0
  19. package/dist/collection_editor/serializable_utils.js.map +1 -0
  20. package/dist/collection_editor/types/config_controller.d.ts +11 -0
  21. package/dist/collection_editor/ui/EditorCollectionAction.js +37 -0
  22. package/dist/collection_editor/ui/EditorCollectionAction.js.map +1 -0
  23. package/dist/collection_editor/ui/MissingReferenceWidget.js +39 -0
  24. package/dist/collection_editor/ui/MissingReferenceWidget.js.map +1 -0
  25. package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js +160 -0
  26. package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js.map +1 -0
  27. package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js +61 -0
  28. package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js.map +1 -0
  29. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js +731 -0
  30. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js.map +1 -0
  31. package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js +220 -0
  32. package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js.map +1 -0
  33. package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js +160 -0
  34. package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js.map +1 -0
  35. package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js +394 -0
  36. package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js.map +1 -0
  37. package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js +616 -0
  38. package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js.map +1 -0
  39. package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js +68 -0
  40. package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js.map +1 -0
  41. package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js +11 -0
  42. package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js.map +1 -0
  43. package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js +148 -0
  44. package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js.map +1 -0
  45. package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js +244 -0
  46. package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js.map +1 -0
  47. package/dist/collection_editor/ui/collection_editor/EnumForm.js +222 -0
  48. package/dist/collection_editor/ui/collection_editor/EnumForm.js.map +1 -0
  49. package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js +204 -0
  50. package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js.map +1 -0
  51. package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js +108 -0
  52. package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js.map +1 -0
  53. package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js +163 -0
  54. package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js.map +1 -0
  55. package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js +59 -0
  56. package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js.map +1 -0
  57. package/dist/collection_editor/ui/collection_editor/PropertyEditView.js +640 -0
  58. package/dist/collection_editor/ui/collection_editor/PropertyEditView.js.map +1 -0
  59. package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js +141 -0
  60. package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js.map +1 -0
  61. package/dist/collection_editor/ui/collection_editor/PropertyTree.js +210 -0
  62. package/dist/collection_editor/ui/collection_editor/PropertyTree.js.map +1 -0
  63. package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js +31 -0
  64. package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js.map +1 -0
  65. package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js +25 -0
  66. package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js.map +1 -0
  67. package/dist/{SchemaChangeDialog-BeP0A4MJ.js → collection_editor/ui/collection_editor/SchemaChangeDialog.js} +73 -69
  68. package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js.map +1 -0
  69. package/dist/collection_editor/ui/collection_editor/SwitchControl.js +24 -0
  70. package/dist/collection_editor/ui/collection_editor/SwitchControl.js.map +1 -0
  71. package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js +66 -0
  72. package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js.map +1 -0
  73. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js +61 -0
  74. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -0
  75. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js +188 -0
  76. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js.map +1 -0
  77. package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +12 -0
  78. package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js +74 -0
  79. package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js.map +1 -0
  80. package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js +100 -0
  81. package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js.map +1 -0
  82. package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js +34 -0
  83. package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js.map +1 -0
  84. package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js +75 -0
  85. package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js.map +1 -0
  86. package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js +338 -0
  87. package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js.map +1 -0
  88. package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js +83 -0
  89. package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js.map +1 -0
  90. package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js +15 -0
  91. package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js.map +1 -0
  92. package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js +121 -0
  93. package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js.map +1 -0
  94. package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js +127 -0
  95. package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js.map +1 -0
  96. package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js +151 -0
  97. package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js.map +1 -0
  98. package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js +77 -0
  99. package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js.map +1 -0
  100. package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js +254 -0
  101. package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js.map +1 -0
  102. package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js +71 -0
  103. package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js.map +1 -0
  104. package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js +356 -0
  105. package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js.map +1 -0
  106. package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js +173 -0
  107. package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js.map +1 -0
  108. package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js +79 -0
  109. package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js.map +1 -0
  110. package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js +34 -0
  111. package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js.map +1 -0
  112. package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js +47 -0
  113. package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js.map +1 -0
  114. package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js +47 -0
  115. package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js.map +1 -0
  116. package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js +62 -0
  117. package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js.map +1 -0
  118. package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js +119 -0
  119. package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js.map +1 -0
  120. package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.d.ts +10 -0
  121. package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js +178 -0
  122. package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js.map +1 -0
  123. package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js +23 -0
  124. package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js.map +1 -0
  125. package/dist/collection_editor/ui/collection_editor/templates/blog_template.js +116 -0
  126. package/dist/collection_editor/ui/collection_editor/templates/blog_template.js.map +1 -0
  127. package/dist/collection_editor/ui/collection_editor/templates/pages_template.js +182 -0
  128. package/dist/collection_editor/ui/collection_editor/templates/pages_template.js.map +1 -0
  129. package/dist/collection_editor/ui/collection_editor/templates/products_template.js +87 -0
  130. package/dist/collection_editor/ui/collection_editor/templates/products_template.js.map +1 -0
  131. package/dist/collection_editor/ui/collection_editor/templates/users_template.js +46 -0
  132. package/dist/collection_editor/ui/collection_editor/templates/users_template.js.map +1 -0
  133. package/dist/collection_editor/ui/collection_editor/util.js +20 -0
  134. package/dist/collection_editor/ui/collection_editor/util.js.map +1 -0
  135. package/dist/collection_editor/ui/collection_editor/utils/strings.js +2 -0
  136. package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js +37 -0
  137. package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js.map +1 -0
  138. package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js +192 -0
  139. package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js.map +1 -0
  140. package/dist/collection_editor/useCollectionEditorController.js +12 -0
  141. package/dist/collection_editor/useCollectionEditorController.js.map +1 -0
  142. package/dist/collection_editor/useCollectionsConfigController.js +12 -0
  143. package/dist/collection_editor/useCollectionsConfigController.js.map +1 -0
  144. package/dist/collection_editor/useJsonCollectionsConfigController.js +191 -0
  145. package/dist/collection_editor/useJsonCollectionsConfigController.js.map +1 -0
  146. package/dist/collection_editor/useLiveSchemaEditing.d.ts +5 -5
  147. package/dist/collection_editor/useLiveSchemaEditing.js +214 -0
  148. package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -0
  149. package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +7 -0
  150. package/dist/collection_editor/useLocalCollectionsConfigController.js +228 -0
  151. package/dist/collection_editor/useLocalCollectionsConfigController.js.map +1 -0
  152. package/dist/collection_editor/useSafeSnackbarController.js +13 -0
  153. package/dist/collection_editor/useSafeSnackbarController.js.map +1 -0
  154. package/dist/collection_editor/validateCollectionJson.js +289 -0
  155. package/dist/collection_editor/validateCollectionJson.js.map +1 -0
  156. package/dist/collection_editor_ui.js +7 -33
  157. package/dist/components/AdditionalFieldValue.js +60 -0
  158. package/dist/components/AdditionalFieldValue.js.map +1 -0
  159. package/dist/components/AdminModeSyncer.js +41 -0
  160. package/dist/components/AdminModeSyncer.js.map +1 -0
  161. package/dist/components/ArrayContainer.d.ts +8 -2
  162. package/dist/components/ArrayContainer.js +363 -0
  163. package/dist/components/ArrayContainer.js.map +1 -0
  164. package/dist/components/ClearFilterSortButton.d.ts +7 -1
  165. package/dist/components/ClearFilterSortButton.js +33 -0
  166. package/dist/components/ClearFilterSortButton.js.map +1 -0
  167. package/dist/components/CollectionEditorDialogs.js +49 -0
  168. package/dist/components/CollectionEditorDialogs.js.map +1 -0
  169. package/dist/components/CollectionPanel.d.ts +26 -5
  170. package/dist/components/CollectionPanel.js +142 -0
  171. package/dist/components/CollectionPanel.js.map +1 -0
  172. package/dist/components/CollectionTableBinding/CollectionRowActions.js +165 -0
  173. package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -0
  174. package/dist/components/CollectionTableBinding/CollectionTableBinding.js +329 -0
  175. package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -0
  176. package/dist/components/CollectionTableBinding/PropertyTableCell.js +311 -0
  177. package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -0
  178. package/dist/components/CollectionTableBinding/column_utils.js +85 -0
  179. package/dist/components/CollectionTableBinding/column_utils.js.map +1 -0
  180. package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js +45 -0
  181. package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js.map +1 -0
  182. package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +66 -0
  183. package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -0
  184. package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +86 -0
  185. package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -0
  186. package/dist/components/CollectionTableBinding/fields/TableRelationField.js +93 -0
  187. package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -0
  188. package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js +33 -0
  189. package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js.map +1 -0
  190. package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js +171 -0
  191. package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js.map +1 -0
  192. package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js +91 -0
  193. package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js.map +1 -0
  194. package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js +36 -0
  195. package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js.map +1 -0
  196. package/dist/components/CollectionTableBinding/index.js +6 -0
  197. package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js +50 -0
  198. package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js.map +1 -0
  199. package/dist/components/CollectionTableBinding/internal/EntityTableCell.d.ts +2 -0
  200. package/dist/components/CollectionTableBinding/internal/EntityTableCell.js +223 -0
  201. package/dist/components/CollectionTableBinding/internal/EntityTableCell.js.map +1 -0
  202. package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js +58 -0
  203. package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js.map +1 -0
  204. package/dist/components/CollectionTableBinding/internal/TableCellOpener.js +53 -0
  205. package/dist/components/CollectionTableBinding/internal/TableCellOpener.js.map +1 -0
  206. package/dist/components/CollectionTableBinding/internal/common.js +40 -0
  207. package/dist/components/CollectionTableBinding/internal/common.js.map +1 -0
  208. package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +270 -0
  209. package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -0
  210. package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js +68 -0
  211. package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js.map +1 -0
  212. package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js +24 -0
  213. package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js.map +1 -0
  214. package/dist/components/CollectionTableBinding/table_bindings.js +306 -0
  215. package/dist/components/CollectionTableBinding/table_bindings.js.map +1 -0
  216. package/dist/components/CollectionViewBinding/BoardCardBinding.js +160 -0
  217. package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -0
  218. package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +471 -0
  219. package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -0
  220. package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js +108 -0
  221. package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -0
  222. package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +988 -0
  223. package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -0
  224. package/dist/components/CollectionViewBinding/CollectionViewActions.d.ts +6 -1
  225. package/dist/components/CollectionViewBinding/CollectionViewActions.js +146 -0
  226. package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -0
  227. package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +5 -2
  228. package/dist/components/CollectionViewBinding/CollectionViewBinding.js +1209 -0
  229. package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -0
  230. package/dist/components/CollectionViewBinding/CollectionViewStartActions.js +133 -0
  231. package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -0
  232. package/dist/components/CollectionViewBinding/EntityCardBinding.js +133 -0
  233. package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -0
  234. package/dist/components/CollectionViewBinding/FilterPresetsButton.js +203 -0
  235. package/dist/components/CollectionViewBinding/FilterPresetsButton.js.map +1 -0
  236. package/dist/components/CollectionViewBinding/FiltersDialog.d.ts +5 -0
  237. package/dist/components/CollectionViewBinding/FiltersDialog.js +148 -0
  238. package/dist/components/CollectionViewBinding/FiltersDialog.js.map +1 -0
  239. package/dist/components/CollectionViewBinding/SearchExplanation.js +86 -0
  240. package/dist/components/CollectionViewBinding/SearchExplanation.js.map +1 -0
  241. package/dist/components/CollectionViewBinding/SearchHighlight.js +262 -0
  242. package/dist/components/CollectionViewBinding/SearchHighlight.js.map +1 -0
  243. package/dist/components/CollectionViewBinding/SlotValue.js +117 -0
  244. package/dist/components/CollectionViewBinding/SlotValue.js.map +1 -0
  245. package/dist/components/CollectionViewBinding/SortButton.js +214 -0
  246. package/dist/components/CollectionViewBinding/SortButton.js.map +1 -0
  247. package/dist/components/CollectionViewBinding/SplitListCloseButton.js +41 -0
  248. package/dist/components/CollectionViewBinding/SplitListCloseButton.js.map +1 -0
  249. package/dist/components/CollectionViewBinding/SplitListShowButton.js +29 -0
  250. package/dist/components/CollectionViewBinding/SplitListShowButton.js.map +1 -0
  251. package/dist/components/CollectionViewBinding/SplitListView.js +311 -0
  252. package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -0
  253. package/dist/components/CollectionViewBinding/SplitViewContext.js +21 -0
  254. package/dist/components/CollectionViewBinding/SplitViewContext.js.map +1 -0
  255. package/dist/components/CollectionViewBinding/ViewModeToggle.js +150 -0
  256. package/dist/components/CollectionViewBinding/ViewModeToggle.js.map +1 -0
  257. package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js +49 -0
  258. package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js.map +1 -0
  259. package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js +122 -0
  260. package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js.map +1 -0
  261. package/dist/components/CollectionViewBinding/useBoardDataController.js +530 -0
  262. package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -0
  263. package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +4 -1
  264. package/dist/components/CollectionViewBinding/usePreviewSlots.js +384 -0
  265. package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -0
  266. package/dist/components/CollectionViewBinding/useSelectionController.js +104 -0
  267. package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -0
  268. package/dist/components/CollectionViewBinding/utils.js +21 -0
  269. package/dist/components/CollectionViewBinding/utils.js.map +1 -0
  270. package/dist/components/CollectionsProvider.d.ts +44 -0
  271. package/dist/components/CollectionsProvider.js +137 -0
  272. package/dist/components/CollectionsProvider.js.map +1 -0
  273. package/dist/components/CollectionsScopeContext.d.ts +18 -0
  274. package/dist/components/CollectionsScopeContext.js +25 -0
  275. package/dist/components/CollectionsScopeContext.js.map +1 -0
  276. package/dist/components/DefaultAppBar.js +179 -0
  277. package/dist/components/DefaultAppBar.js.map +1 -0
  278. package/dist/components/DefaultDrawer.js +364 -0
  279. package/dist/components/DefaultDrawer.js.map +1 -0
  280. package/dist/components/DeleteEntityDialog.js +256 -0
  281. package/dist/components/DeleteEntityDialog.js.map +1 -0
  282. package/dist/components/DetailViewBinding.js +504 -0
  283. package/dist/components/DetailViewBinding.js.map +1 -0
  284. package/dist/components/DrawerNavigationGroup.js +74 -0
  285. package/dist/components/DrawerNavigationGroup.js.map +1 -0
  286. package/dist/components/DrawerNavigationItem.d.ts +8 -0
  287. package/dist/components/DrawerNavigationItem.js +45 -0
  288. package/dist/components/DrawerNavigationItem.js.map +1 -0
  289. package/dist/components/EditFormActions.js +210 -0
  290. package/dist/components/EditFormActions.js.map +1 -0
  291. package/dist/components/EditViewBinding.d.ts +7 -1
  292. package/dist/components/EditViewBinding.js +802 -0
  293. package/dist/components/EditViewBinding.js.map +1 -0
  294. package/dist/components/EntityDisplayHeader.js +139 -0
  295. package/dist/components/EntityDisplayHeader.js.map +1 -0
  296. package/dist/components/EntityFormPanel.d.ts +58 -0
  297. package/dist/components/EntityFormPanel.js +126 -0
  298. package/dist/components/EntityFormPanel.js.map +1 -0
  299. package/dist/components/EntityIdentityBar.d.ts +29 -4
  300. package/dist/components/EntityIdentityBar.js +364 -0
  301. package/dist/components/EntityIdentityBar.js.map +1 -0
  302. package/dist/components/EntityInspector.js +96 -0
  303. package/dist/components/EntityInspector.js.map +1 -0
  304. package/dist/components/EntityPreviewBinding.js +282 -0
  305. package/dist/components/EntityPreviewBinding.js.map +1 -0
  306. package/dist/components/EntityPreviewNesting.js +53 -0
  307. package/dist/components/EntityPreviewNesting.js.map +1 -0
  308. package/dist/components/EntityViewBinding.js +246 -0
  309. package/dist/components/EntityViewBinding.js.map +1 -0
  310. package/dist/components/FieldCaption.js +17 -0
  311. package/dist/components/FieldCaption.js.map +1 -0
  312. package/dist/components/HomePage/ContentHomePage.js +326 -0
  313. package/dist/components/HomePage/ContentHomePage.js.map +1 -0
  314. package/dist/components/HomePage/FavouritesView.js +44 -0
  315. package/dist/components/HomePage/FavouritesView.js.map +1 -0
  316. package/dist/components/HomePage/HomePageDnD.js +436 -0
  317. package/dist/components/HomePage/HomePageDnD.js.map +1 -0
  318. package/dist/components/HomePage/NavigationCard.js +59 -0
  319. package/dist/components/HomePage/NavigationCard.js.map +1 -0
  320. package/dist/components/HomePage/NavigationCardBinding.js +70 -0
  321. package/dist/components/HomePage/NavigationCardBinding.js.map +1 -0
  322. package/dist/components/HomePage/NavigationGroup.js +98 -0
  323. package/dist/components/HomePage/NavigationGroup.js.map +1 -0
  324. package/dist/components/HomePage/RenameGroupDialog.js +89 -0
  325. package/dist/components/HomePage/RenameGroupDialog.js.map +1 -0
  326. package/dist/components/InlineEntityPreview.js +116 -0
  327. package/dist/components/InlineEntityPreview.js.map +1 -0
  328. package/dist/{JsonPreviewBinding-v0w3H0fp.js → components/JsonPreviewBinding.js} +2 -2
  329. package/dist/components/JsonPreviewBinding.js.map +1 -0
  330. package/dist/components/NavigationLoadingErrorView.d.ts +16 -0
  331. package/dist/components/NavigationLoadingErrorView.js +27 -0
  332. package/dist/components/NavigationLoadingErrorView.js.map +1 -0
  333. package/dist/components/PickerTrigger.js +27 -0
  334. package/dist/components/PickerTrigger.js.map +1 -0
  335. package/dist/components/PropertyCollectionView.js +215 -0
  336. package/dist/components/PropertyCollectionView.js.map +1 -0
  337. package/dist/components/PropertyConfigBadge.js +19 -0
  338. package/dist/components/PropertyConfigBadge.js.map +1 -0
  339. package/dist/components/PropertyKeyHint.js +58 -0
  340. package/dist/components/PropertyKeyHint.js.map +1 -0
  341. package/dist/components/RebaseAuthGate.js +35 -0
  342. package/dist/components/RebaseAuthGate.js.map +1 -0
  343. package/dist/components/RebaseCMS.js +44 -0
  344. package/dist/components/RebaseCMS.js.map +1 -0
  345. package/dist/components/RebaseLayout.js +59 -0
  346. package/dist/components/RebaseLayout.js.map +1 -0
  347. package/dist/components/RebaseNavigation.js +215 -0
  348. package/dist/components/RebaseNavigation.js.map +1 -0
  349. package/dist/components/RebaseRouteDefs.js +96 -0
  350. package/dist/components/RebaseRouteDefs.js.map +1 -0
  351. package/dist/components/RebaseShell.js +50 -0
  352. package/dist/components/RebaseShell.js.map +1 -0
  353. package/dist/components/ReferenceTable/SelectionTableBinding.js +224 -0
  354. package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -0
  355. package/dist/components/ReferenceWidget.js +100 -0
  356. package/dist/components/ReferenceWidget.js.map +1 -0
  357. package/dist/components/RelationSelector.js +625 -0
  358. package/dist/components/RelationSelector.js.map +1 -0
  359. package/dist/components/SearchIconsView.js +52 -0
  360. package/dist/components/SearchIconsView.js.map +1 -0
  361. package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
  362. package/dist/components/SelectableTable/SelectableTable.js +158 -0
  363. package/dist/components/SelectableTable/SelectableTable.js.map +1 -0
  364. package/dist/components/SelectableTable/SelectableTableContext.js +8 -0
  365. package/dist/components/SelectableTable/SelectableTableContext.js.map +1 -0
  366. package/dist/components/SelectableTable/SelectionStore.js +29 -0
  367. package/dist/components/SelectableTable/SelectionStore.js.map +1 -0
  368. package/dist/components/SelectableTable/filters/BooleanFilterField.js +28 -0
  369. package/dist/components/SelectableTable/filters/BooleanFilterField.js.map +1 -0
  370. package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +2 -1
  371. package/dist/components/SelectableTable/filters/DateTimeFilterField.js +93 -0
  372. package/dist/components/SelectableTable/filters/DateTimeFilterField.js.map +1 -0
  373. package/dist/components/SelectableTable/filters/FilterFieldBinding.js +132 -0
  374. package/dist/components/SelectableTable/filters/FilterFieldBinding.js.map +1 -0
  375. package/dist/components/SelectableTable/filters/ReferenceFilterField.js +157 -0
  376. package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -0
  377. package/dist/components/SelectableTable/filters/RelationFilterField.js +169 -0
  378. package/dist/components/SelectableTable/filters/RelationFilterField.js.map +1 -0
  379. package/dist/components/SelectableTable/filters/StringNumberFilterField.js +181 -0
  380. package/dist/components/SelectableTable/filters/StringNumberFilterField.js.map +1 -0
  381. package/dist/components/SelectableTable/filters/null_filter.js +36 -0
  382. package/dist/components/SelectableTable/filters/null_filter.js.map +1 -0
  383. package/dist/components/SideDialogs.js +149 -0
  384. package/dist/components/SideDialogs.js.map +1 -0
  385. package/dist/components/SidePanelBinding.js +287 -0
  386. package/dist/components/SidePanelBinding.js.map +1 -0
  387. package/dist/components/SidePanelProvider.js +69 -0
  388. package/dist/components/SidePanelProvider.js.map +1 -0
  389. package/dist/components/UserSelector.d.ts +2 -0
  390. package/dist/components/UserSelector.js +418 -0
  391. package/dist/components/UserSelector.js.map +1 -0
  392. package/dist/components/admin/CreationResultDialog.js +118 -0
  393. package/dist/components/admin/CreationResultDialog.js.map +1 -0
  394. package/dist/components/app/AppBar.js +14 -0
  395. package/dist/components/app/AppBar.js.map +1 -0
  396. package/dist/components/app/Drawer.js +26 -0
  397. package/dist/components/app/Drawer.js.map +1 -0
  398. package/dist/components/app/Scaffold.js +229 -0
  399. package/dist/components/app/Scaffold.js.map +1 -0
  400. package/dist/components/app/useApp.js +24 -0
  401. package/dist/components/app/useApp.js.map +1 -0
  402. package/dist/components/common/ActionMenuLabel.d.ts +15 -0
  403. package/dist/components/common/ActionMenuLabel.js +30 -0
  404. package/dist/components/common/ActionMenuLabel.js.map +1 -0
  405. package/dist/components/common/default_entity_actions.d.ts +37 -0
  406. package/dist/components/common/default_entity_actions.js +590 -0
  407. package/dist/components/common/default_entity_actions.js.map +1 -0
  408. package/dist/components/drawer_expansion.d.ts +25 -0
  409. package/dist/components/drawer_expansion.js +44 -0
  410. package/dist/components/drawer_expansion.js.map +1 -0
  411. package/dist/components/field_configs.d.ts +2 -2
  412. package/dist/components/field_configs.js +431 -0
  413. package/dist/components/field_configs.js.map +1 -0
  414. package/dist/components/field_ids.d.ts +11 -0
  415. package/dist/components/field_ids.js +58 -0
  416. package/dist/components/field_ids.js.map +1 -0
  417. package/dist/components/history/EntityHistoryEntry.js +151 -0
  418. package/dist/components/history/EntityHistoryEntry.js.map +1 -0
  419. package/dist/components/history/EntityHistoryView.js +157 -0
  420. package/dist/components/history/EntityHistoryView.js.map +1 -0
  421. package/dist/components/history/UserChip.js +21 -0
  422. package/dist/components/history/UserChip.js.map +1 -0
  423. package/dist/components/history/index.js +4 -0
  424. package/dist/components/index.d.ts +2 -0
  425. package/dist/components/lazy_record_views.d.ts +10 -0
  426. package/dist/components/lazy_record_views.js +57 -0
  427. package/dist/components/lazy_record_views.js.map +1 -0
  428. package/dist/contexts/BreacrumbsContext.js +28 -0
  429. package/dist/contexts/BreacrumbsContext.js.map +1 -0
  430. package/dist/contexts/EditorAIControllerContext.d.ts +18 -0
  431. package/dist/contexts/EditorAIControllerContext.js +29 -0
  432. package/dist/contexts/EditorAIControllerContext.js.map +1 -0
  433. package/dist/contexts/SideDialogsControllerContext.js +7 -0
  434. package/dist/contexts/SideDialogsControllerContext.js.map +1 -0
  435. package/dist/data_export/export/BasicExportAction.js +151 -0
  436. package/dist/data_export/export/BasicExportAction.js.map +1 -0
  437. package/dist/data_export/export/ExportCollectionAction.js +297 -0
  438. package/dist/data_export/export/ExportCollectionAction.js.map +1 -0
  439. package/dist/data_export/export/additional_fields.js +40 -0
  440. package/dist/data_export/export/additional_fields.js.map +1 -0
  441. package/dist/data_export/export/export.d.ts +35 -0
  442. package/dist/data_export/export/export.js +400 -0
  443. package/dist/data_export/export/export.js.map +1 -0
  444. package/dist/data_export/export/fetch_export_data.d.ts +17 -7
  445. package/dist/data_export/export/fetch_export_data.js +67 -0
  446. package/dist/data_export/export/fetch_export_data.js.map +1 -0
  447. package/dist/data_export/export/index.d.ts +4 -2
  448. package/dist/data_export/export/index.js +5 -0
  449. package/dist/data_import/components/DataNewPropertiesMapping.js +207 -0
  450. package/dist/data_import/components/DataNewPropertiesMapping.js.map +1 -0
  451. package/dist/data_import/components/ImportConversionProblems.d.ts +11 -0
  452. package/dist/data_import/components/ImportConversionProblems.js +89 -0
  453. package/dist/data_import/components/ImportConversionProblems.js.map +1 -0
  454. package/dist/data_import/components/ImportFileUpload.js +43 -0
  455. package/dist/data_import/components/ImportFileUpload.js.map +1 -0
  456. package/dist/data_import/components/ImportNewPropertyFieldPreview.js +42 -0
  457. package/dist/data_import/components/ImportNewPropertyFieldPreview.js.map +1 -0
  458. package/dist/data_import/components/ImportSaveInProgress.js +105 -0
  459. package/dist/data_import/components/ImportSaveInProgress.js.map +1 -0
  460. package/dist/data_import/components/index.d.ts +1 -0
  461. package/dist/data_import/hooks/useImportConfig.js +34 -0
  462. package/dist/data_import/hooks/useImportConfig.js.map +1 -0
  463. package/dist/{import-TCgkTVlS.js → data_import/import/ImportCollectionAction.js} +84 -92
  464. package/dist/data_import/import/ImportCollectionAction.js.map +1 -0
  465. package/dist/data_import/import/index.js +2 -0
  466. package/dist/data_import/utils/csv.js +146 -0
  467. package/dist/data_import/utils/csv.js.map +1 -0
  468. package/dist/data_import/utils/data.d.ts +81 -4
  469. package/dist/data_import/utils/data.js +366 -0
  470. package/dist/data_import/utils/data.js.map +1 -0
  471. package/dist/data_import/utils/file_headers.js +32 -0
  472. package/dist/data_import/utils/file_headers.js.map +1 -0
  473. package/dist/data_import/utils/file_to_json.js +149 -0
  474. package/dist/data_import/utils/file_to_json.js.map +1 -0
  475. package/dist/data_import/utils/get_import_inference_type.js +14 -0
  476. package/dist/data_import/utils/get_import_inference_type.js.map +1 -0
  477. package/dist/data_import/utils/id_column.js +27 -0
  478. package/dist/data_import/utils/id_column.js.map +1 -0
  479. package/dist/data_import/utils/import_columns.d.ts +48 -0
  480. package/dist/data_import/utils/import_columns.js +92 -0
  481. package/dist/data_import/utils/import_columns.js.map +1 -0
  482. package/dist/data_import/utils/save_entities.d.ts +33 -4
  483. package/dist/data_import/utils/save_entities.js +244 -0
  484. package/dist/data_import/utils/save_entities.js.map +1 -0
  485. package/dist/data_import/utils/transforms.js +83 -0
  486. package/dist/data_import/utils/transforms.js.map +1 -0
  487. package/dist/editor/components/SlashCommandMenu.js +497 -0
  488. package/dist/editor/components/SlashCommandMenu.js.map +1 -0
  489. package/dist/editor/components/editor-bubble-item.js +24 -0
  490. package/dist/editor/components/editor-bubble-item.js.map +1 -0
  491. package/dist/editor/components/editor-bubble.js +97 -0
  492. package/dist/editor/components/editor-bubble.js.map +1 -0
  493. package/dist/editor/components/image-bubble.js +148 -0
  494. package/dist/editor/components/image-bubble.js.map +1 -0
  495. package/dist/editor/components/table-bubble.js +406 -0
  496. package/dist/editor/components/table-bubble.js.map +1 -0
  497. package/dist/editor/editor.d.ts +7 -1
  498. package/dist/editor/editor.js +423 -0
  499. package/dist/editor/editor.js.map +1 -0
  500. package/dist/editor/extensions/HighlightDecorationExtension.js +74 -0
  501. package/dist/editor/extensions/HighlightDecorationExtension.js.map +1 -0
  502. package/dist/editor/extensions/Image.d.ts +28 -1
  503. package/dist/editor/extensions/Image.js +160 -0
  504. package/dist/editor/extensions/Image.js.map +1 -0
  505. package/dist/editor/extensions/TextLoadingDecorationExtension.js +82 -0
  506. package/dist/editor/extensions/TextLoadingDecorationExtension.js.map +1 -0
  507. package/dist/editor/extensions/clipboard.js +63 -0
  508. package/dist/editor/extensions/clipboard.js.map +1 -0
  509. package/dist/editor/extensions/drag-and-drop.js +354 -0
  510. package/dist/editor/extensions/drag-and-drop.js.map +1 -0
  511. package/dist/editor/hooks/useProseMirror.d.ts +4 -1
  512. package/dist/editor/hooks/useProseMirror.js +101 -0
  513. package/dist/editor/hooks/useProseMirror.js.map +1 -0
  514. package/dist/editor/hooks/useProseMirrorContext.js +11 -0
  515. package/dist/editor/hooks/useProseMirrorContext.js.map +1 -0
  516. package/dist/editor/markdown.js +154 -0
  517. package/dist/editor/markdown.js.map +1 -0
  518. package/dist/editor/nodeViews/ImageComponent.js +35 -0
  519. package/dist/editor/nodeViews/ImageComponent.js.map +1 -0
  520. package/dist/editor/nodeViews/ReactNodeView.js +57 -0
  521. package/dist/editor/nodeViews/ReactNodeView.js.map +1 -0
  522. package/dist/editor/nodeViews/TaskItemComponent.js +29 -0
  523. package/dist/editor/nodeViews/TaskItemComponent.js.map +1 -0
  524. package/dist/editor/nodeViews/index.js +21 -0
  525. package/dist/editor/nodeViews/index.js.map +1 -0
  526. package/dist/editor/plugins/index.js +54 -0
  527. package/dist/editor/plugins/index.js.map +1 -0
  528. package/dist/editor/plugins/inputrules.js +54 -0
  529. package/dist/editor/plugins/inputrules.js.map +1 -0
  530. package/dist/editor/plugins/placeholderPlugin.js +38 -0
  531. package/dist/editor/plugins/placeholderPlugin.js.map +1 -0
  532. package/dist/editor/plugins/slashCommandPlugin.js +40 -0
  533. package/dist/editor/plugins/slashCommandPlugin.js.map +1 -0
  534. package/dist/editor/sanitize-html.js +190 -0
  535. package/dist/editor/sanitize-html.js.map +1 -0
  536. package/dist/{markdown-CCqp8ibf.js → editor/schema.js} +2 -159
  537. package/dist/editor/schema.js.map +1 -0
  538. package/dist/editor/selectors/link-selector.js +118 -0
  539. package/dist/editor/selectors/link-selector.js.map +1 -0
  540. package/dist/editor/selectors/node-selector.js +118 -0
  541. package/dist/editor/selectors/node-selector.js.map +1 -0
  542. package/dist/editor/selectors/text-buttons.js +71 -0
  543. package/dist/editor/selectors/text-buttons.js.map +1 -0
  544. package/dist/editor/utils/prosemirror-utils.js +92 -0
  545. package/dist/editor/utils/prosemirror-utils.js.map +1 -0
  546. package/dist/editor/utils/remove_classes.js +16 -0
  547. package/dist/editor/utils/remove_classes.js.map +1 -0
  548. package/dist/editor.js +1 -3085
  549. package/dist/form/EntityForm.js +734 -0
  550. package/dist/form/EntityForm.js.map +1 -0
  551. package/dist/form/EntityFormActions.js +101 -0
  552. package/dist/form/EntityFormActions.js.map +1 -0
  553. package/dist/form/EntityFormBinding.js +256 -0
  554. package/dist/form/EntityFormBinding.js.map +1 -0
  555. package/dist/form/PropertyFieldBinding.js +298 -0
  556. package/dist/form/PropertyFieldBinding.js.map +1 -0
  557. package/dist/form/components/ErrorFocus.js +33 -0
  558. package/dist/form/components/ErrorFocus.js.map +1 -0
  559. package/dist/form/components/FieldBlock.js +118 -0
  560. package/dist/form/components/FieldBlock.js.map +1 -0
  561. package/dist/form/components/FieldHelperText.js +56 -0
  562. package/dist/form/components/FieldHelperText.js.map +1 -0
  563. package/dist/form/components/FormRail.js +118 -0
  564. package/dist/form/components/FormRail.js.map +1 -0
  565. package/dist/form/components/FormSections.js +63 -0
  566. package/dist/form/components/FormSections.js.map +1 -0
  567. package/dist/form/components/LabelWithIcon.js +29 -0
  568. package/dist/form/components/LabelWithIcon.js.map +1 -0
  569. package/dist/form/components/LocalChangesMenu.js +127 -0
  570. package/dist/form/components/LocalChangesMenu.js.map +1 -0
  571. package/dist/form/components/StorageItemPreview.js +46 -0
  572. package/dist/form/components/StorageItemPreview.js.map +1 -0
  573. package/dist/form/components/StorageUploadProgress.js +84 -0
  574. package/dist/form/components/StorageUploadProgress.js.map +1 -0
  575. package/dist/form/components/useRailVisible.js +43 -0
  576. package/dist/form/components/useRailVisible.js.map +1 -0
  577. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js +84 -0
  578. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js.map +1 -0
  579. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +125 -0
  580. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -0
  581. package/dist/form/field_bindings/BinaryFieldBinding.js +135 -0
  582. package/dist/form/field_bindings/BinaryFieldBinding.js.map +1 -0
  583. package/dist/form/field_bindings/BlockFieldBinding.js +164 -0
  584. package/dist/form/field_bindings/BlockFieldBinding.js.map +1 -0
  585. package/dist/form/field_bindings/DateTimeFieldBinding.js +47 -0
  586. package/dist/form/field_bindings/DateTimeFieldBinding.js.map +1 -0
  587. package/dist/form/field_bindings/GeopointFieldBinding.js +148 -0
  588. package/dist/form/field_bindings/GeopointFieldBinding.js.map +1 -0
  589. package/dist/form/field_bindings/KeyValueFieldBinding.js +450 -0
  590. package/dist/form/field_bindings/KeyValueFieldBinding.js.map +1 -0
  591. package/dist/form/field_bindings/MapFieldBinding.js +77 -0
  592. package/dist/form/field_bindings/MapFieldBinding.js.map +1 -0
  593. package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +215 -0
  594. package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -0
  595. package/dist/form/field_bindings/MultiSelectFieldBinding.js +88 -0
  596. package/dist/form/field_bindings/MultiSelectFieldBinding.js.map +1 -0
  597. package/dist/form/field_bindings/MultipleRelationFieldBinding.js +118 -0
  598. package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -0
  599. package/dist/form/field_bindings/ReadOnlyFieldBinding.js +52 -0
  600. package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -0
  601. package/dist/form/field_bindings/ReferenceFieldBinding.js +99 -0
  602. package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -0
  603. package/dist/form/field_bindings/RelationFieldBinding.js +135 -0
  604. package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -0
  605. package/dist/form/field_bindings/RepeatFieldBinding.js +103 -0
  606. package/dist/form/field_bindings/RepeatFieldBinding.js.map +1 -0
  607. package/dist/form/field_bindings/SelectFieldBinding.js +80 -0
  608. package/dist/form/field_bindings/SelectFieldBinding.js.map +1 -0
  609. package/dist/form/field_bindings/StorageUploadFieldBinding.js +266 -0
  610. package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -0
  611. package/dist/form/field_bindings/SwitchFieldBinding.js +41 -0
  612. package/dist/form/field_bindings/SwitchFieldBinding.js.map +1 -0
  613. package/dist/form/field_bindings/TextFieldBinding.js +114 -0
  614. package/dist/form/field_bindings/TextFieldBinding.js.map +1 -0
  615. package/dist/form/field_bindings/UserSelectFieldBinding.js +48 -0
  616. package/dist/form/field_bindings/UserSelectFieldBinding.js.map +1 -0
  617. package/dist/form/field_bindings/VectorFieldBinding.js +147 -0
  618. package/dist/form/field_bindings/VectorFieldBinding.js.map +1 -0
  619. package/dist/form/form_keyboard_scope.d.ts +26 -0
  620. package/dist/form/form_keyboard_scope.js +39 -0
  621. package/dist/form/form_keyboard_scope.js.map +1 -0
  622. package/dist/form/form_uploads.d.ts +24 -0
  623. package/dist/form/form_uploads.js +31 -0
  624. package/dist/form/form_uploads.js.map +1 -0
  625. package/dist/form/form_utils.d.ts +48 -0
  626. package/dist/form/form_utils.js +280 -0
  627. package/dist/form/form_utils.js.map +1 -0
  628. package/dist/form/resolve_cell_property.d.ts +32 -0
  629. package/dist/form/resolve_cell_property.js +80 -0
  630. package/dist/form/resolve_cell_property.js.map +1 -0
  631. package/dist/form/resolve_form_properties.d.ts +27 -0
  632. package/dist/form/resolve_form_properties.js +78 -0
  633. package/dist/form/resolve_form_properties.js.map +1 -0
  634. package/dist/form/useClearRestoreValue.js +27 -0
  635. package/dist/form/useClearRestoreValue.js.map +1 -0
  636. package/dist/form/useUndoableDiscard.js +36 -0
  637. package/dist/form/useUndoableDiscard.js.map +1 -0
  638. package/dist/form/validation.d.ts +20 -0
  639. package/dist/form/validation.js +416 -0
  640. package/dist/form/validation.js.map +1 -0
  641. package/dist/hooks/navigation/contexts/CollectionRegistryContext.js +22 -0
  642. package/dist/hooks/navigation/contexts/CollectionRegistryContext.js.map +1 -0
  643. package/dist/hooks/navigation/contexts/NavigationStateContext.js +15 -0
  644. package/dist/hooks/navigation/contexts/NavigationStateContext.js.map +1 -0
  645. package/dist/hooks/navigation/contexts/UrlContext.js +22 -0
  646. package/dist/hooks/navigation/contexts/UrlContext.js.map +1 -0
  647. package/dist/hooks/navigation/useAsyncResolver.js +68 -0
  648. package/dist/hooks/navigation/useAsyncResolver.js.map +1 -0
  649. package/dist/hooks/navigation/useBuildCollectionRegistryController.js +141 -0
  650. package/dist/hooks/navigation/useBuildCollectionRegistryController.js.map +1 -0
  651. package/dist/hooks/navigation/useBuildNavigationStateController.js +77 -0
  652. package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -0
  653. package/dist/hooks/navigation/useBuildUrlController.js +57 -0
  654. package/dist/hooks/navigation/useBuildUrlController.js.map +1 -0
  655. package/dist/hooks/navigation/useNavigationResolution.js +177 -0
  656. package/dist/hooks/navigation/useNavigationResolution.js.map +1 -0
  657. package/dist/hooks/navigation/useResolvedCollections.js +56 -0
  658. package/dist/hooks/navigation/useResolvedCollections.js.map +1 -0
  659. package/dist/hooks/navigation/useResolvedViews.js +94 -0
  660. package/dist/hooks/navigation/useResolvedViews.js.map +1 -0
  661. package/dist/hooks/navigation/useTopLevelNavigation.js +162 -0
  662. package/dist/hooks/navigation/useTopLevelNavigation.js.map +1 -0
  663. package/dist/hooks/navigation/utils.js +125 -0
  664. package/dist/hooks/navigation/utils.js.map +1 -0
  665. package/dist/hooks/useAdminContext.js +45 -0
  666. package/dist/hooks/useAdminContext.js.map +1 -0
  667. package/dist/hooks/useBreadcrumbsController.js +17 -0
  668. package/dist/hooks/useBreadcrumbsController.js.map +1 -0
  669. package/dist/hooks/useBuildSideDialogsController.js +96 -0
  670. package/dist/hooks/useBuildSideDialogsController.js.map +1 -0
  671. package/dist/hooks/useBuildSidePanel.js +221 -0
  672. package/dist/hooks/useBuildSidePanel.js.map +1 -0
  673. package/dist/hooks/useChildViewSource.js +41 -0
  674. package/dist/hooks/useChildViewSource.js.map +1 -0
  675. package/dist/hooks/useEntityDisplay.js +136 -0
  676. package/dist/hooks/useEntityDisplay.js.map +1 -0
  677. package/dist/hooks/useEntityDisplayTitle.js +34 -0
  678. package/dist/hooks/useEntityDisplayTitle.js.map +1 -0
  679. package/dist/hooks/useHistory.js +137 -0
  680. package/dist/hooks/useHistory.js.map +1 -0
  681. package/dist/hooks/useRecordActions.d.ts +28 -6
  682. package/dist/hooks/useRecordActions.js +108 -0
  683. package/dist/hooks/useRecordActions.js.map +1 -0
  684. package/dist/hooks/useReferencePaths.d.ts +21 -0
  685. package/dist/hooks/useReferencePaths.js +32 -0
  686. package/dist/hooks/useReferencePaths.js.map +1 -0
  687. package/dist/hooks/useResolvedNavigationFrom.js +83 -0
  688. package/dist/hooks/useResolvedNavigationFrom.js.map +1 -0
  689. package/dist/hooks/useResolvedUsers.js +109 -0
  690. package/dist/hooks/useResolvedUsers.js.map +1 -0
  691. package/dist/hooks/useSelectionDialog.js +53 -0
  692. package/dist/hooks/useSelectionDialog.js.map +1 -0
  693. package/dist/hooks/useSideDialogsController.js +8 -0
  694. package/dist/hooks/useSideDialogsController.js.map +1 -0
  695. package/dist/hooks/useSidePanel.js +15 -0
  696. package/dist/hooks/useSidePanel.js.map +1 -0
  697. package/dist/hooks/useStorageReferenceResolver.d.ts +25 -0
  698. package/dist/hooks/useStorageReferenceResolver.js +49 -0
  699. package/dist/hooks/useStorageReferenceResolver.js.map +1 -0
  700. package/dist/index.d.ts +3 -2
  701. package/dist/index.js +151 -3793
  702. package/dist/preview/PropertyPreview.js +260 -0
  703. package/dist/preview/PropertyPreview.js.map +1 -0
  704. package/dist/preview/compact_text.js +52 -0
  705. package/dist/preview/compact_text.js.map +1 -0
  706. package/dist/preview/components/ArrayEnumPreview.js +24 -0
  707. package/dist/preview/components/ArrayEnumPreview.js.map +1 -0
  708. package/dist/preview/components/BooleanPreview.js +25 -0
  709. package/dist/preview/components/BooleanPreview.js.map +1 -0
  710. package/dist/preview/components/DatePreview.d.ts +3 -2
  711. package/dist/preview/components/DatePreview.js +87 -0
  712. package/dist/preview/components/DatePreview.js.map +1 -0
  713. package/dist/preview/components/EmptyValue.js +13 -0
  714. package/dist/preview/components/EmptyValue.js.map +1 -0
  715. package/dist/preview/components/EnumValuesChip.js +26 -0
  716. package/dist/preview/components/EnumValuesChip.js.map +1 -0
  717. package/dist/preview/components/ImagePreview.d.ts +7 -1
  718. package/dist/preview/components/ImagePreview.js +112 -0
  719. package/dist/preview/components/ImagePreview.js.map +1 -0
  720. package/dist/preview/components/InlineEntityListPreview.js +31 -0
  721. package/dist/preview/components/InlineEntityListPreview.js.map +1 -0
  722. package/dist/preview/components/ReferencePreview.js +162 -0
  723. package/dist/preview/components/ReferencePreview.js.map +1 -0
  724. package/dist/preview/components/RelationPreview.js +196 -0
  725. package/dist/preview/components/RelationPreview.js.map +1 -0
  726. package/dist/preview/components/StorageMarkdown.d.ts +11 -0
  727. package/dist/preview/components/StorageMarkdown.js +49 -0
  728. package/dist/preview/components/StorageMarkdown.js.map +1 -0
  729. package/dist/preview/components/StorageThumbnail.js +183 -0
  730. package/dist/preview/components/StorageThumbnail.js.map +1 -0
  731. package/dist/preview/components/UrlComponentPreview.d.ts +3 -1
  732. package/dist/preview/components/UrlComponentPreview.js +88 -0
  733. package/dist/preview/components/UrlComponentPreview.js.map +1 -0
  734. package/dist/preview/components/UserPreview.js +30 -0
  735. package/dist/preview/components/UserPreview.js.map +1 -0
  736. package/dist/preview/components/date_fns_locales.js +124 -0
  737. package/dist/preview/components/date_fns_locales.js.map +1 -0
  738. package/dist/preview/components/storageRenditions.d.ts +10 -0
  739. package/dist/preview/components/storageRenditions.js +95 -0
  740. package/dist/preview/components/storageRenditions.js.map +1 -0
  741. package/dist/preview/property_previews/ArrayOfMapsPreview.js +44 -0
  742. package/dist/preview/property_previews/ArrayOfMapsPreview.js.map +1 -0
  743. package/dist/preview/property_previews/ArrayOfReferencesPreview.js +48 -0
  744. package/dist/preview/property_previews/ArrayOfReferencesPreview.js.map +1 -0
  745. package/dist/preview/property_previews/ArrayOfRelationsPreview.js +50 -0
  746. package/dist/preview/property_previews/ArrayOfRelationsPreview.js.map +1 -0
  747. package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js +30 -0
  748. package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js.map +1 -0
  749. package/dist/preview/property_previews/ArrayOfStringsPreview.js +42 -0
  750. package/dist/preview/property_previews/ArrayOfStringsPreview.js.map +1 -0
  751. package/dist/preview/property_previews/ArrayOneOfPreview.js +47 -0
  752. package/dist/preview/property_previews/ArrayOneOfPreview.js.map +1 -0
  753. package/dist/preview/property_previews/ArrayPropertyEnumPreview.js +25 -0
  754. package/dist/preview/property_previews/ArrayPropertyEnumPreview.js.map +1 -0
  755. package/dist/preview/property_previews/ArrayPropertyPreview.js +48 -0
  756. package/dist/preview/property_previews/ArrayPropertyPreview.js.map +1 -0
  757. package/dist/preview/property_previews/MapPropertyPreview.js +137 -0
  758. package/dist/preview/property_previews/MapPropertyPreview.js.map +1 -0
  759. package/dist/preview/property_previews/NumberPropertyPreview.js +34 -0
  760. package/dist/preview/property_previews/NumberPropertyPreview.js.map +1 -0
  761. package/dist/preview/property_previews/SkeletonPropertyComponent.js +151 -0
  762. package/dist/preview/property_previews/SkeletonPropertyComponent.js.map +1 -0
  763. package/dist/preview/property_previews/StringPropertyPreview.js +49 -0
  764. package/dist/preview/property_previews/StringPropertyPreview.js.map +1 -0
  765. package/dist/preview/util.d.ts +8 -3
  766. package/dist/{util-CC0ozHoD.js → preview/util.js} +13 -6
  767. package/dist/preview/util.js.map +1 -0
  768. package/dist/routes/CustomViewRoute.js +26 -0
  769. package/dist/routes/CustomViewRoute.js.map +1 -0
  770. package/dist/routes/RebaseRoute.js +311 -0
  771. package/dist/routes/RebaseRoute.js.map +1 -0
  772. package/dist/selection/SelectionMenu.js +90 -0
  773. package/dist/selection/SelectionMenu.js.map +1 -0
  774. package/dist/selection/resolve_selection.js +79 -0
  775. package/dist/selection/resolve_selection.js.map +1 -0
  776. package/dist/util/caller_scopes.d.ts +15 -0
  777. package/dist/util/caller_scopes.js +25 -0
  778. package/dist/util/caller_scopes.js.map +1 -0
  779. package/dist/util/collection_open_mode.d.ts +20 -0
  780. package/dist/util/collection_open_mode.js +32 -0
  781. package/dist/util/collection_open_mode.js.map +1 -0
  782. package/dist/util/dataControllerAdapter.js +65 -0
  783. package/dist/util/dataControllerAdapter.js.map +1 -0
  784. package/dist/util/entity_actions.d.ts +42 -1
  785. package/dist/util/entity_actions.js +77 -0
  786. package/dist/util/entity_actions.js.map +1 -0
  787. package/dist/util/entity_pages.d.ts +37 -3
  788. package/dist/util/entity_pages.js +71 -0
  789. package/dist/util/entity_pages.js.map +1 -0
  790. package/dist/util/find_entities_by_ids.d.ts +23 -0
  791. package/dist/util/find_entities_by_ids.js +55 -0
  792. package/dist/util/find_entities_by_ids.js.map +1 -0
  793. package/dist/util/fit_inline_actions.d.ts +20 -0
  794. package/dist/util/fit_inline_actions.js +40 -0
  795. package/dist/util/fit_inline_actions.js.map +1 -0
  796. package/dist/util/format_collection_date.d.ts +29 -0
  797. package/dist/util/format_collection_date.js +60 -0
  798. package/dist/util/format_collection_date.js.map +1 -0
  799. package/dist/util/map_with_concurrency.js +46 -0
  800. package/dist/util/map_with_concurrency.js.map +1 -0
  801. package/dist/util/navigation_utils.js +45 -0
  802. package/dist/util/navigation_utils.js.map +1 -0
  803. package/dist/util/number_format.js +33 -0
  804. package/dist/util/number_format.js.map +1 -0
  805. package/dist/util/previews.js +71 -0
  806. package/dist/util/previews.js.map +1 -0
  807. package/dist/util/propertyConfigMapper.js +83 -0
  808. package/dist/util/propertyConfigMapper.js.map +1 -0
  809. package/dist/util/property_utils.js +141 -0
  810. package/dist/util/property_utils.js.map +1 -0
  811. package/dist/util/resolutions.js +55 -0
  812. package/dist/util/resolutions.js.map +1 -0
  813. package/dist/util/view_constants.js +35 -0
  814. package/dist/util/view_constants.js.map +1 -0
  815. package/dist/util/view_mode.js +112 -0
  816. package/dist/util/view_mode.js.map +1 -0
  817. package/package.json +13 -9
  818. package/dist/CollectionEditorDialog-DLHCka00.js +0 -3630
  819. package/dist/CollectionEditorDialog-DLHCka00.js.map +0 -1
  820. package/dist/JsonPreviewBinding-v0w3H0fp.js.map +0 -1
  821. package/dist/PropertyEditView-_pu5hzZn.js +0 -3837
  822. package/dist/PropertyEditView-_pu5hzZn.js.map +0 -1
  823. package/dist/RouterCollectionsStudioView-ChPNl_uU.js +0 -212
  824. package/dist/RouterCollectionsStudioView-ChPNl_uU.js.map +0 -1
  825. package/dist/SchemaChangeDialog-BeP0A4MJ.js.map +0 -1
  826. package/dist/collection_editor/ui/CollectionViewHeaderAction.d.ts +0 -13
  827. package/dist/collection_editor/ui/PropertyAddColumnComponent.d.ts +0 -8
  828. package/dist/collection_editor_ui.js.map +0 -1
  829. package/dist/editor.js.map +0 -1
  830. package/dist/export-4bJWdlDK.js +0 -520
  831. package/dist/export-4bJWdlDK.js.map +0 -1
  832. package/dist/history-BElrZ5Rw.js +0 -313
  833. package/dist/history-BElrZ5Rw.js.map +0 -1
  834. package/dist/import-TCgkTVlS.js.map +0 -1
  835. package/dist/index.js.map +0 -1
  836. package/dist/markdown-CCqp8ibf.js.map +0 -1
  837. package/dist/rolldown-runtime-D7D4PA-g.js +0 -13
  838. package/dist/util-CC0ozHoD.js.map +0 -1
  839. package/dist/util-DybQBkug.js +0 -26390
  840. package/dist/util-DybQBkug.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,3793 +1,151 @@
1
- import { $n as ArrayPropertyEnumPreview, $t as PropertyConfigBadge, A as getFieldId, An as useAdminContext, Ar as FormRail, B as MapFieldBinding, Bn as ReadOnlyFieldBinding, Br as getIconForWidget, Bt as convertFileToJson, C as EntityFormBinding, Cn as serializeSelectionQuery, Cr as renderSkeletonIcon, Ct as EntityCardBinding, D as getDefaultFieldConfig, Dn as CollectionTableBinding, Dr as ImagePreview, Dt as useCollectionEditorDialogsState, E as DEFAULT_FIELD_CONFIGS, En as VirtualTableInput, Er as UrlComponentPreview, Et as ConfigControllerProvider, F as SelectFieldBinding, Fn as useSideDialogsController, Fr as spanClass, Ft as useImportConfig, G as useSelectionDialog, Gn as UserPreview, Gr as isRelationProperty, Gt as downloadDataAsCsv, H as DateTimeFieldBinding, Hn as FieldHelperText, Hr as getPropertyInPath, Ht as parseCsvRows, I as RepeatFieldBinding, In as SideDialogsControllerContext, Ir as PropertyKeyHint, It as ImportSaveInProgress, J as useBuildUrlController, Jn as DatePreview, Jt as escapeCsvFormula, K as SelectionTableBinding, Kn as NumberPropertyPreview, Kt as downloadEntitiesExport, L as ReferenceFieldBinding, Ln as SelectableTableContext, Lr as getBracketNotation, Lt as IMPORT_BATCH_SIZE, M as TextFieldBinding, Mn as useUrlController, Mr as FieldBlock, Mt as flattenEntry, N as SwitchFieldBinding, Nn as NavigationStateContext, Nr as LABEL_ICON_SIZE, Nt as processValueMapping, O as getDefaultFieldId, On as SelectableTable, Or as EmptyValue, Ot as ImportNewPropertyFieldPreview, P as StorageUploadFieldBinding, Pn as useNavigationStateController, Pr as isSelfLabellingProperty, Pt as getInferenceType, Q as useResolvedCollections, Qn as ArrayOfStringsPreview, Qt as ArrayContainer, R as MultiSelectFieldBinding, Rn as ArrayCustomShapedFieldBinding, Rr as getDefaultPropertiesOrder, Rt as saveImportedEntities, S as isSchemaChangeCancelled, Sn as selectionQueryToFindParams, Sr as renderSkeletonCaptionText, St as CollectionCardViewBinding, T as PropertyFieldBinding, Tn as useSelectionController, Tr as renderSkeletonText, Tt as useCollectionEditorController, U as BlockFieldBinding, Un as ArrayOfMapsPreview, Ur as getResolvedPropertyInPath, Ut as parseCsvToObjects, V as KeyValueFieldBinding, Vn as LabelWithIcon, Vr as getPropertiesWithPropertiesOrder, Vt as detectCsvDelimiter, W as ArrayOfReferencesFieldBinding, Wn as PropertyPreview, Wr as isReferenceProperty, Wt as downloadBlob, X as useTopLevelNavigation, Xn as MapPropertyPreview, Xt as getEntityJsonExportableData, Y as useBuildNavigationStateController, Yn as KeyValuePreview, Yt as getEntityCSVExportableData, Z as useResolvedViews, Zn as ArrayOneOfPreview, Zt as unescapeCsvFormula, _ as useCollectionsConfigController, _n as resolveViewMode, _r as StringPropertyPreview, _t as editEntityAction, a as namespaceToPropertiesPath, an as resolveEntityView, ar as ReferencePreview, at as getEntityViewWidth, b as asUnavailable, bn as SELECTION_PAGE_SIZE, br as StorageThumbnailInternal, bt as DetailViewBinding, c as buildCollectionGenerationCallback, cn as getCollectionBySlugWithin, cr as useSidePanel, d as fromSerializableCollectionConfigs, dn as isPathWithinRecord, dr as getUserLabel, dt as getInitialEntityValues, en as SearchIconsView, er as ArrayEnumPreview, et as useBuildCollectionRegistryController, f as fromSerializableProperties, fn as removeInitialAndTrailingSlashes, fr as useResolvedUser, ft as removeEmptyContainers, g as toSerializableProperty, gn as resolveOpenEntityMode, gr as ArrayPropertyPreview, gt as deleteEntityAction, h as toSerializableProperties, hn as resolveCollectionPathIds, hr as getEntityTitlePropertyKeyForEntity, ht as copyEntityAction, i as namespaceToPropertiesOrderPath, in as resolveEntityAction, ir as InlineEntityListPreview, it as buildSidePanelsFromUrl, j as VectorFieldBinding, jn as UrlContext, jr as RecordMeta, jt as convertDataToEntity, k as getFieldConfig, kn as CollectionRowActions, kr as FormSections, kt as DataNewPropertiesMapping, l as validateCollectionJson, ln as getCollectionPathsCombinations, lr as CollectionRegistryContext, lt as extractTouchedValues, m as toSerializableCollectionConfig, mn as removeTrailingSlash, mr as getEntityTitlePropertyKey, mt as CollectionViewBinding, n as getFullIdPath, nn as useBreadcrumbsController, nr as RelationPreview, nt as resolveNavigationFrom, o as CollectionGenerationApiError, on as mergeEntityActions, or as EntityPreviewBinding, ot as useBuildSidePanel, p as fromSerializableProperty, pn as removeInitialSlash, pr as getEntityPreviewKeys, pt as zodToFormErrors, q as SideDialogs, qn as BooleanPreview, qt as entryToCSVRow, r as idToPropertiesPath, rn as BreadcrumbsProvider, rr as ArrayOfReferencesPreview, rt as useResolvedNavigationFrom, s as DEFAULT_COLLECTION_GENERATION_ENDPOINT, sn as addInitialSlash, sr as SidePanelControllerContext, st as EditViewBinding, t as getFullId, tn as FieldCaption, tr as ArrayOfStorageComponentsPreview, tt as useHistory, u as fromSerializableCollectionConfig, un as getLastSegment, ur as useCollectionRegistryController, ut as getChanges, v as LiveSchemaError, vn as SelectionMenu, vr as EnumValuesChip, vt as resetPasswordAction, w as EntityForm, wr as renderSkeletonImageThumbnail, wt as CollectionViewActions, x as createLiveSchemaClient, xn as resolveSelection, xr as SkeletonPropertyComponent, xt as EntityViewBinding, y as SchemaChangeCancelled, yn as MAX_SELECTION_ROWS, yr as StorageThumbnail, yt as CreationResultDialog, z as MarkdownEditorFieldBinding, zn as useClearRestoreValue, zr as getIconForProperty, zt as ImportFileUpload } from "./util-DybQBkug.js";
2
- import { o as sanitizeUrl } from "./util-CC0ozHoD.js";
3
- import { i as PropertySelectEntry, n as ImportCollectionAction, r as ImportDataPreview } from "./import-TCgkTVlS.js";
4
- import { a as MAX_EXPORT_ROWS, i as EXPORT_PAGE_SIZE, n as ExportCollectionAction, o as fetchAllEntitiesForExport, r as BasicExportAction } from "./export-4bJWdlDK.js";
5
- import React, { Suspense, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
6
- import { deepEqual } from "fast-equals";
7
- import { Avatar, Button, Card, CenteredView, ChevronDownIcon, ChevronsLeftIcon, ChevronsRightIcon, Chip, CircularProgressCenter, Collapse, Container, Dialog, DialogActions, DialogContent, DialogTitle, ErrorBoundary, ExpandablePanel, IconButton, LogOutIcon, Markdown, Menu, MenuIcon, MenuItem, MoonIcon, PencilIcon, SearchBar, SettingsIcon, Sheet, Skeleton, StarIcon, SunIcon, SunMoonIcon, TextField, Tooltip, Typography, cls, defaultBorderMixin, iconSize, lazyChunk } from "@rebasepro/ui";
8
- import { buildRoutedRebaseData, getReferenceFrom, resolveDataSource } from "@rebasepro/common";
9
- import { CollectionResolverRegistrationContext, CollectionScopeProvider, CustomizationControllerContext, DEFAULT_API_PATH, ErrorView, IconForView, LanguageToggle, LoginView, NavigationBlockerProvider, NotFoundPage, RebaseDataContext, RebaseLogo, RebaseRoutes, SchemaDriftBanner, StudioBridgeRegistryProvider, UnsavedChangesDialog, UserSettingsView, buildCollapsedDefaults, getIcon, getLastSegment as getLastSegment$1, getNavigationEntriesFromPath, useAdminModeController, useAnalyticsController, useAuthController, useBridgeRegistration, useCollapsedGroups, useComponentOverride, useCustomizationController, useData, useDataSources, useLargeLayout, useModeController, useNavigationBlocker, useNavigationGroupLabel, useRebaseClient, useRebaseContext, useRebaseRegistry, useRebaseRegistryDispatch, useRestoreScroll, useSlot, useTranslation, useUserConfigurationPersistence } from "@rebasepro/app";
10
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
- import { prettifyIdentifier, toArray } from "@rebasepro/utils";
12
- import { Link, NavLink, Outlet, Route, useLocation, useNavigate } from "react-router";
13
- import { DndContext, DragOverlay, KeyboardSensor, MeasuringStrategy, MouseSensor, TouchSensor, closestCenter, closestCorners, getFirstCollision, pointerWithin, rectIntersection, useDndMonitor, useDroppable, useSensor, useSensors } from "@dnd-kit/core";
14
- import { restrictToVerticalAxis, restrictToWindowEdges } from "@dnd-kit/modifiers";
15
- import { SortableContext, arrayMove, defaultAnimateLayoutChanges, rectSortingStrategy, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
16
- import { CSS } from "@dnd-kit/utilities";
17
- import Fuse from "fuse.js";
18
- //#region src/routes/CustomViewRoute.tsx
19
- function CustomViewRoute({ view }) {
20
- const breadcrumbs = useBreadcrumbsController();
21
- const urlController = useUrlController();
22
- const breadcrumbsRef = useRef(breadcrumbs);
23
- breadcrumbsRef.current = breadcrumbs;
24
- useEffect(() => {
25
- breadcrumbsRef.current.set({ breadcrumbs: [{
26
- title: view.name,
27
- url: urlController.buildAppUrlPath(view.slug)
28
- }] });
29
- }, [view.slug, urlController]);
30
- if (typeof view.view === "function") {
31
- const ViewComponent = view.view;
32
- return /* @__PURE__ */ jsx(ViewComponent, {});
33
- }
34
- return /* @__PURE__ */ jsx(Fragment, { children: view.view });
35
- }
36
- //#endregion
37
- //#region src/routes/RebaseRoute.tsx
38
- function RebaseRoute() {
39
- const location = useLocation();
40
- const collectionRegistry = useCollectionRegistryController();
41
- const urlController = useUrlController();
42
- const breadcrumbs = useBreadcrumbsController();
43
- const userConfigPersistence = useUserConfigurationPersistence();
44
- const ResolvedCollectionView = useComponentOverride("Collection.View", CollectionViewBinding);
45
- const hash = location.hash;
46
- const isSidePanel = hash.includes("#side");
47
- const isNew = hash.includes("#new") || hash.includes("#new_side");
48
- const isCopy = hash.includes("#copy");
49
- const isFullScreen = hash.includes("#full");
50
- const pathname = location.pathname;
51
- const navigationEntries = getNavigationEntriesFromPath({
52
- path: urlController.urlPathToDataPath(pathname),
53
- collections: collectionRegistry.collections ?? []
54
- });
55
- useEffect(() => {
56
- breadcrumbs.set({ breadcrumbs: navigationEntries.map((entry) => {
57
- if (entry.type === "entity") return {
58
- title: String(entry.entityId),
59
- url: urlController.buildUrlCollectionPath(entry.path)
60
- };
61
- else if (entry.type === "custom_view") return {
62
- title: String(entry.view.name ?? entry.view.key),
63
- url: urlController.buildUrlCollectionPath(entry.path)
64
- };
65
- else if (entry.type === "collection") return {
66
- title: entry.collection.name,
67
- url: urlController.buildUrlCollectionPath(entry.path),
68
- id: entry.path
69
- };
70
- else throw new Error("Unexpected navigation entry type");
71
- }) });
72
- }, [navigationEntries.map((entry) => entry.path).join(",")]);
73
- if (isNew) return /* @__PURE__ */ jsx(EntityFullScreenRoute, {
74
- pathname,
75
- navigationEntries,
76
- isNew: true,
77
- isCopy: false
78
- });
79
- if (navigationEntries.length === 1 && navigationEntries[0].type === "collection") {
80
- let collection;
81
- collection = collectionRegistry.getCollection(navigationEntries[0].id);
82
- if (!collection) collection = collectionRegistry.getCollection(navigationEntries[0].slug);
83
- if (!collection) {
84
- if (!collectionRegistry.initialised) return /* @__PURE__ */ jsx(CircularProgressCenter, {});
85
- return /* @__PURE__ */ jsx(UnresolvedCollectionView, { path: navigationEntries[0].slug });
86
- }
87
- return /* @__PURE__ */ jsx(ResolvedCollectionView, {
88
- ...collection,
89
- parentCollectionSlugs: [],
90
- parentEntityIds: [],
91
- path: collection.slug,
92
- updateUrl: true,
93
- Actions: toArray(collection.Actions)
94
- }, `collection_view_${collection.slug}`);
95
- }
96
- if (isSidePanel) {
97
- if ([...navigationEntries].reverse().find((entry) => entry.type === "collection")) {
98
- let collection;
99
- const firstEntry = navigationEntries[0];
100
- collection = collectionRegistry.getCollection(firstEntry.id);
101
- if (!collection) collection = collectionRegistry.getCollection(firstEntry.slug);
102
- if (!collection) {
103
- if (!collectionRegistry.initialised) return /* @__PURE__ */ jsx(CircularProgressCenter, {});
104
- return /* @__PURE__ */ jsx(UnresolvedCollectionView, { path: firstEntry.slug });
105
- }
106
- return /* @__PURE__ */ jsx(ResolvedCollectionView, {
107
- ...collection,
108
- parentCollectionSlugs: [],
109
- parentEntityIds: [],
110
- path: collection.slug,
111
- updateUrl: true,
112
- Actions: toArray(collection.Actions)
113
- }, `collection_view_${collection.slug}`);
114
- }
115
- }
116
- const lastEntityEntry = navigationEntries.find((entry) => entry.type === "entity");
117
- const firstCollectionEntry = navigationEntries[0];
118
- if (!isFullScreen && !isCopy && firstCollectionEntry?.type === "collection" && lastEntityEntry?.type === "entity" && (navigationEntries.length === 2 || navigationEntries.length === 3)) {
119
- let collection;
120
- collection = collectionRegistry.getCollection(firstCollectionEntry.id);
121
- if (!collection) collection = collectionRegistry.getCollection(firstCollectionEntry.slug);
122
- const effectiveOpenMode = collection ? resolveOpenEntityMode({
123
- collection,
124
- viewMode: resolveViewMode({
125
- collection,
126
- search: location.search,
127
- savedViewMode: userConfigPersistence?.getCollectionConfig(collection.slug)?.defaultViewMode
128
- })
129
- }) : void 0;
130
- if (collection && effectiveOpenMode === "split") {
131
- let selectedTab;
132
- if (navigationEntries.length === 3) {
133
- const thirdEntry = navigationEntries[2];
134
- if (thirdEntry.type === "collection") selectedTab = thirdEntry.collection.slug;
135
- else if (thirdEntry.type === "custom_view") selectedTab = thirdEntry.view.key;
136
- }
137
- if (!selectedTab && navigationEntries.length === 2 && lastEntityEntry) {
138
- const entityIdStr = String(lastEntityEntry.entityId);
139
- const entityIdIdx = pathname.lastIndexOf(`/${entityIdStr}`);
140
- if (entityIdIdx >= 0) {
141
- const afterEntity = pathname.substring(entityIdIdx + 1 + entityIdStr.length);
142
- const trailingSegment = afterEntity.startsWith("/") ? afterEntity.substring(1) : afterEntity;
143
- if (trailingSegment.length > 0) selectedTab = trailingSegment;
144
- }
145
- }
146
- return /* @__PURE__ */ jsx(ResolvedCollectionView, {
147
- ...collection,
148
- parentCollectionSlugs: [],
149
- parentEntityIds: [],
150
- path: collection.slug,
151
- updateUrl: true,
152
- selectedEntityId: lastEntityEntry.entityId,
153
- selectedTab,
154
- Actions: toArray(collection.Actions)
155
- }, `collection_view_${collection.slug}`);
156
- }
157
- }
158
- return /* @__PURE__ */ jsx(EntityFullScreenRoute, {
159
- pathname,
160
- navigationEntries,
161
- isNew,
162
- isCopy
163
- });
164
- }
165
- function getSelectedTabFromUrl(isNew, lastCustomView) {
166
- if (isNew) return;
167
- else if (lastCustomView) {
168
- if (lastCustomView.type === "custom_view") return lastCustomView.view.key;
169
- else if (lastCustomView.type === "collection") return lastCustomView.id ?? lastCustomView.slug;
170
- }
171
- }
172
- function EntityFullScreenRoute({ pathname, navigationEntries, isNew, isCopy }) {
173
- const collectionRegistry = useCollectionRegistryController();
174
- const urlController = useUrlController();
175
- const navigate = useNavigate();
176
- const location = useLocation();
177
- const userConfigPersistence = useUserConfigurationPersistence();
178
- const defaultValues = location.state?.defaultValues;
179
- const hash = location.hash;
180
- const navigationPath = urlController.urlPathToDataPath(pathname);
181
- const blocked = useRef(false);
182
- const lastEntityEntry = [...navigationEntries].reverse().find((entry) => entry.type === "entity");
183
- const lastCustomView = [...lastEntityEntry ? navigationEntries.slice(navigationEntries.indexOf(lastEntityEntry) + 1) : []].reverse().find((entry) => entry.type === "custom_view" || entry.type === "collection");
184
- const entityId = lastEntityEntry && "entityId" in lastEntityEntry ? lastEntityEntry.entityId : void 0;
185
- let urlTab = getSelectedTabFromUrl(isNew, lastCustomView);
186
- if (!urlTab && entityId && !isNew) {
187
- const entityIdStr = String(entityId);
188
- const entityIdIdx = pathname.lastIndexOf(`/${entityIdStr}`);
189
- if (entityIdIdx >= 0) {
190
- const afterEntity = pathname.substring(entityIdIdx + 1 + entityIdStr.length);
191
- const trailingSegment = afterEntity.startsWith("/") ? afterEntity.substring(1) : afterEntity;
192
- if (trailingSegment.length > 0 && trailingSegment !== "edit") urlTab = trailingSegment;
193
- }
194
- }
195
- const [selectedTab, setSelectedTab] = useState(urlTab);
196
- const parentCollectionSlugs = collectionRegistry.getParentCollectionSlugs(navigationPath);
197
- const parentEntityIds = collectionRegistry.getParentEntityIds(navigationPath);
198
- useEffect(() => {
199
- if (urlTab !== selectedTab) setSelectedTab(urlTab);
200
- }, [urlTab]);
201
- const basePath = !entityId || isNew ? pathname : pathname.substring(0, pathname.lastIndexOf(`/${entityId}`));
202
- const entityPath = basePath + `/${entityId}`;
203
- const blocker = useNavigationBlocker(useCallback(({ currentLocation, nextLocation }) => {
204
- if (isPathWithinRecord(nextLocation.pathname, entityPath)) return false;
205
- const nextHash = nextLocation.hash;
206
- if (nextHash === "#side" || nextHash === "#new_side") return false;
207
- const currentHash = currentLocation.hash;
208
- if ((currentHash === "#side" || currentHash === "#new_side") && (nextLocation.pathname === basePath || isPathWithinRecord(nextLocation.pathname, entityPath))) return false;
209
- return blocked.current;
210
- }, [entityPath, basePath]));
211
- const lastCollectionEntry = [...navigationEntries].reverse().find((entry) => entry.type === "collection");
212
- if (isNew && !lastCollectionEntry) {
213
- if (!collectionRegistry.initialised) return /* @__PURE__ */ jsx(CircularProgressCenter, {});
214
- throw new Error("INTERNAL: No collection found in the navigation");
215
- }
216
- if (!isNew && !lastEntityEntry) {
217
- if (!collectionRegistry.initialised) return /* @__PURE__ */ jsx(CircularProgressCenter, {});
218
- return /* @__PURE__ */ jsx(NotFoundPage, {});
219
- }
220
- const rawCollection = isNew ? lastCollectionEntry && "collection" in lastCollectionEntry ? lastCollectionEntry.collection : void 0 : lastEntityEntry && "parentCollection" in lastEntityEntry ? lastEntityEntry.parentCollection : void 0;
221
- const collection = collectionRegistry.getCollection(rawCollection.slug) || rawCollection;
222
- const fullIdPath = isNew ? lastCollectionEntry.slug : lastEntityEntry.slug;
223
- const collectionPath = urlController.resolveDatabasePathsFrom(fullIdPath);
224
- const isEditRoute = pathname.endsWith("/edit") || pathname.split("/").pop() === "edit";
225
- const isDetailMode = collection.defaultEntityAction === "view" && !isNew && !isCopy && entityId && !isEditRoute;
226
- const showList = !isNew && !isCopy && entityId !== void 0 && navigationEntries[0]?.type === "collection" && (navigationEntries.length === 2 || navigationEntries.length === 3) && resolveOpenEntityMode({
227
- collection,
228
- viewMode: resolveViewMode({
229
- collection,
230
- search: location.search,
231
- savedViewMode: userConfigPersistence?.getCollectionConfig(collection.slug)?.defaultViewMode
232
- })
233
- }) === "split" ? () => navigate({
234
- pathname,
235
- search: location.search,
236
- hash: ""
237
- }) : void 0;
238
- if (isDetailMode) return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(DetailViewBinding, {
239
- entityId,
240
- collection,
241
- layout: "full_screen",
242
- path: collectionPath,
243
- selectedTab: selectedTab ?? void 0,
244
- onShowList: showList,
245
- onEditClick: () => {
246
- const editUrl = urlController.buildUrlCollectionPath(`${collectionPath}/${entityId}`) + "/edit";
247
- navigate(editUrl + hash);
248
- },
249
- onTabChange: (params) => {
250
- setSelectedTab(params.selectedTab);
251
- const newSelectedTab = params.selectedTab;
252
- if (newSelectedTab) navigate(`${basePath}/${entityId}/${newSelectedTab}${hash}`, { replace: true });
253
- else navigate(`${basePath}/${entityId}${hash}`, { replace: true });
254
- },
255
- parentCollectionSlugs,
256
- parentEntityIds
257
- }, collection.slug + "_view_" + entityId) });
258
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(EditViewBinding, {
259
- entityId: isNew ? void 0 : entityId,
260
- collection,
261
- layout: "full_screen",
262
- path: collectionPath,
263
- copy: isCopy,
264
- selectedTab: selectedTab ?? void 0,
265
- onShowList: showList,
266
- defaultValues: isNew ? defaultValues : void 0,
267
- onValuesModified: (modified) => blocked.current = modified,
268
- navigateBack: () => {
269
- const detailUrl = urlController.buildUrlCollectionPath(`${collectionPath}/${entityId}`);
270
- navigate(detailUrl + hash);
271
- },
272
- onSaved: (params) => {
273
- const newSelectedTab = params.selectedTab;
274
- const newEntityId = params.entityId;
275
- const savedHash = isNew ? "" : hash;
276
- if (newSelectedTab) navigate(`${basePath}/${newEntityId}/${newSelectedTab}${savedHash}`, { replace: true });
277
- else navigate(`${basePath}/${newEntityId}${savedHash}`, { replace: true });
278
- },
279
- onTabChange: (params) => {
280
- setSelectedTab(params.selectedTab);
281
- if (isNew) return;
282
- const newSelectedTab = params.selectedTab;
283
- if (newSelectedTab) navigate(`${basePath}/${entityId}/${newSelectedTab}${hash}`, { replace: true });
284
- else navigate(`${basePath}/${entityId}${hash}`, { replace: true });
285
- },
286
- parentCollectionSlugs,
287
- parentEntityIds
288
- }, collection.slug + "_" + (isNew ? "new" : isCopy ? entityId + "_copy" : entityId)), /* @__PURE__ */ jsx(UnsavedChangesDialog, {
289
- open: blocker?.state === "blocked",
290
- handleOk: () => blocker?.proceed?.(),
291
- handleCancel: () => blocker?.reset?.(),
292
- body: "You have unsaved changes in this entity."
293
- })] });
294
- }
295
- /**
296
- * Shown when a URL names a collection the registry cannot resolve.
297
- *
298
- * This used to be `return null`, which renders an empty pane inside the app
299
- * chrome: the sidebar, the nav highlight and the breadcrumb all still work,
300
- * because those read the collections array directly, while the view itself is
301
- * blank. Nothing is thrown, and the only trace is a `console.debug` — so the
302
- * panel looks like it lost its data rather than like it failed to find the
303
- * collection, and there is no string to search for.
304
- *
305
- * A slug containing slashes went unresolvable this way and cost an afternoon to
306
- * find. The lookup is fixed; this is the part that made it expensive.
307
- */
308
- function UnresolvedCollectionView({ path }) {
309
- useEffect(() => {
310
- console.warn(`[rebase] No collection is registered for "${path}", so this route has nothing to render. Check that the collection is in the collections array and that its slug matches the URL.`);
311
- }, [path]);
312
- return /* @__PURE__ */ jsx(CenteredView, { children: /* @__PURE__ */ jsx(ErrorView, {
313
- title: "Collection not found",
314
- error: `Nothing is registered for "${path}".`,
315
- tooltip: "The URL names a collection the panel does not know about. It may have been renamed or removed from the collections array, or the slug may not match the path."
316
- }) });
317
- }
318
- //#endregion
319
- //#region src/components/ReferenceWidget.tsx
320
- /**
321
- * This field allows selecting reference/s.
322
- */
323
- function ReferenceWidget({ name, multiselect = false, path, disabled, value, onReferenceSelected, onMultipleReferenceSelected, previewProperties, fixedFilter, size, className, includeId, includeEntityLink }) {
324
- const collectionRegistryController = useCollectionRegistryController();
325
- const collection = useMemo(() => {
326
- return collectionRegistryController.getCollection(path);
327
- }, [path, collectionRegistryController.getCollection]);
328
- const onSingleEntitySelected = useCallback((entity) => {
329
- if (disabled) return;
330
- if (onReferenceSelected) {
331
- const reference = entity ? getReferenceFrom(entity) : null;
332
- onReferenceSelected?.({
333
- reference,
334
- entity
335
- });
336
- }
337
- }, [disabled, onReferenceSelected]);
338
- const onMultipleEntitiesSelected = useCallback((entities) => {
339
- if (disabled) return;
340
- if (onMultipleReferenceSelected) onMultipleReferenceSelected({
341
- references: entities ? entities.map((e) => getReferenceFrom(e)) : null,
342
- entities
343
- });
344
- }, [disabled, onReferenceSelected]);
345
- const referenceDialogController = useSelectionDialog({
346
- multiselect,
347
- path,
348
- collection,
349
- onSingleEntitySelected,
350
- onMultipleEntitiesSelected,
351
- fixedFilter
352
- });
353
- useCallback((e) => {
354
- e.stopPropagation();
355
- if (multiselect) onMultipleEntitiesSelected([]);
356
- else onSingleEntitySelected(null);
357
- }, [onReferenceSelected]);
358
- let child;
359
- const onEntryClick = () => {
360
- if (disabled) return;
361
- referenceDialogController.open();
362
- };
363
- if (Array.isArray(value)) child = /* @__PURE__ */ jsx("div", {
364
- className: "flex flex-col gap-4",
365
- children: value.map((ref, index) => {
366
- return /* @__PURE__ */ jsx(ReferencePreview, {
367
- onClick: onEntryClick,
368
- reference: ref,
369
- disabled,
370
- previewProperties,
371
- size,
372
- includeId,
373
- includeEntityLink
374
- }, `reference_preview_${index}`);
375
- })
376
- });
377
- else if (value?.isEntityReference && value?.isEntityReference()) child = /* @__PURE__ */ jsx(ReferencePreview, {
378
- reference: value,
379
- onClick: onEntryClick,
380
- disabled,
381
- previewProperties,
382
- size,
383
- includeId,
384
- includeEntityLink
385
- });
386
- return /* @__PURE__ */ jsxs("div", {
387
- className: cls("text-sm font-medium", "min-w-80 flex flex-col gap-4", "relative transition-colors duration-200 ease-in rounded-xs font-medium", disabled ? "bg-opacity-50" : "hover:bg-opacity-75", "dark:text-white/50 text-text-primary/50 dark:text-text-primary-dark/50 dark:text-white/50", className),
388
- children: [child, !value && /* @__PURE__ */ jsx("div", {
389
- className: "justify-center text-left",
390
- children: /* @__PURE__ */ jsxs(Button, {
391
- disabled,
392
- onClick: onEntryClick,
393
- children: ["Edit ", name]
394
- })
395
- })]
396
- });
397
- }
398
- //#endregion
399
- //#region src/hooks/useBuildSideDialogsController.tsx
400
- function useBuildSideDialogsController() {
401
- const location = useLocation();
402
- const navigate = useNavigate();
403
- const locationRef = useRef(location);
404
- locationRef.current = location;
405
- const [sidePanels, setSidePanels] = useState([]);
406
- const sidePanelsRef = useRef(sidePanels);
407
- const routesStore = useRef({});
408
- const routesCount = useRef(0);
409
- const updateSidePanels = useCallback((newPanels) => {
410
- sidePanelsRef.current = newPanels;
411
- setSidePanels(newPanels);
412
- }, []);
413
- useEffect(() => {
414
- const newPanels = (location.state?.panels ?? []).map((key) => routesStore.current[key]).filter((p) => Boolean(p));
415
- if (!deepEqual(sidePanelsRef.current.map((p) => p.key), newPanels.map((p) => p.key))) {
416
- updateSidePanels(newPanels);
417
- if (newPanels.length === 0) routesCount.current = 0;
418
- }
419
- }, [location]);
420
- const close = useCallback(() => {
421
- const currentPanels = sidePanelsRef.current;
422
- if (currentPanels.length === 0) return;
423
- const lastSidePanel = currentPanels[currentPanels.length - 1];
424
- const updatedPanels = [...currentPanels.slice(0, -1)];
425
- updateSidePanels(updatedPanels);
426
- if (routesCount.current > 0) {
427
- if (lastSidePanel.urlPath) navigate(-1);
428
- routesCount.current--;
429
- } else if (lastSidePanel.parentUrlPath) {
430
- const baseLocation = locationRef.current.state?.base_location ?? locationRef.current;
431
- navigate(lastSidePanel.parentUrlPath, {
432
- replace: true,
433
- state: {
434
- base_location: baseLocation,
435
- panels: updatedPanels.map((p) => p.key)
436
- }
437
- });
438
- }
439
- }, [navigate]);
440
- const open = useCallback((panelProps) => {
441
- const newPanels = Array.isArray(panelProps) ? panelProps : [panelProps];
442
- newPanels.forEach((panel) => {
443
- routesStore.current[panel.key] = panel;
444
- });
445
- routesCount.current = routesCount.current + newPanels.length;
446
- const baseLocation = locationRef.current.state?.base_location ?? locationRef.current;
447
- const updatedPanels = [...sidePanelsRef.current, ...newPanels];
448
- updateSidePanels(updatedPanels);
449
- newPanels.forEach((panel) => {
450
- if (panel.urlPath) navigate(panel.urlPath, { state: {
451
- base_location: baseLocation,
452
- panels: updatedPanels.map((p) => p.key)
453
- } });
454
- });
455
- }, [navigate]);
456
- const replace = useCallback((panelProps) => {
457
- const newPanels = Array.isArray(panelProps) ? panelProps : [panelProps];
458
- newPanels.forEach((panel) => {
459
- routesStore.current[panel.key] = panel;
460
- });
461
- const baseLocation = locationRef.current.state?.base_location ?? locationRef.current;
462
- const updatedPanels = [...sidePanelsRef.current.slice(0, -newPanels.length), ...newPanels];
463
- updateSidePanels(updatedPanels);
464
- newPanels.forEach((panel) => {
465
- if (panel.urlPath) navigate(panel.urlPath, {
466
- replace: true,
467
- state: {
468
- base_location: baseLocation,
469
- panels: updatedPanels.map((p) => p.key)
470
- }
471
- });
472
- });
473
- }, [navigate]);
474
- return useMemo(() => ({
475
- sidePanels,
476
- setSidePanels: updateSidePanels,
477
- close,
478
- open,
479
- replace
480
- }), [
481
- sidePanels,
482
- updateSidePanels,
483
- close,
484
- open,
485
- replace
486
- ]);
487
- }
488
- //#endregion
489
- //#region src/components/SidePanelProvider.tsx
490
- /**
491
- * Provider that builds the SidePanelController and makes it available
492
- * via the SidePanelControllerContext from @rebasepro/app.
493
- *
494
- * After the admin extraction refactor, `useBuildSidePanel` lives
495
- * in the admin package while the context it feeds into lives in core.
496
- * This provider bridges the two: place it inside the `<Rebase>` tree and
497
- * above any component that calls `useSidePanel()`.
498
- *
499
- * Also auto-registers the side entity controller and breadcrumbs into the
500
- * self-assembling Studio bridge (when a StudioBridgeRegistryProvider is
501
- * mounted above in the tree).
502
- *
503
- * @example
504
- * ```tsx
505
- * <Rebase ...>
506
- * {({ loading }) => (
507
- * <SidePanelProvider>
508
- * <RebaseRoutes>
509
- * ...
510
- * </RebaseRoutes>
511
- * </SidePanelProvider>
512
- * )}
513
- * </Rebase>
514
- * ```
515
- *
516
- * @group Components
517
- */
518
- function SidePanelProvider({ children }) {
519
- const collectionRegistryController = useCollectionRegistryController();
520
- const urlController = useUrlController();
521
- const navigationStateController = useNavigationStateController();
522
- const sideDialogsController = useBuildSideDialogsController();
523
- const sidePanelController = useBuildSidePanel(collectionRegistryController, urlController, navigationStateController, sideDialogsController, useAuthController());
524
- return /* @__PURE__ */ jsx(NavigationBlockerProvider, { children: /* @__PURE__ */ jsx(BreadcrumbsProvider, { children: /* @__PURE__ */ jsx(SideDialogsControllerContext.Provider, {
525
- value: sideDialogsController,
526
- children: /* @__PURE__ */ jsxs(SidePanelControllerContext.Provider, {
527
- value: sidePanelController,
528
- children: [/* @__PURE__ */ jsx(BridgeAutoRegistrar$1, { sidePanelController }), children]
529
- })
530
- }) }) });
531
- }
532
- /**
533
- * Internal component that auto-registers side entity and breadcrumbs
534
- * into the Studio bridge. Must be a child of BreadcrumbsProvider.
535
- */
536
- function BridgeAutoRegistrar$1({ sidePanelController }) {
537
- const breadcrumbs = useBreadcrumbsController();
538
- useBridgeRegistration("sidePanelController", sidePanelController);
539
- useBridgeRegistration("breadcrumbs", breadcrumbs);
540
- return null;
541
- }
542
- //#endregion
543
- //#region src/components/AdminModeSyncer.tsx
544
- /**
545
- * A highly customizable utility component that observes react-router routes and
546
- * actively shifts the internal Rebase `adminModeController` context to match
547
- * the user's active window segment (e.g., Content vs Studio mode).
548
- *
549
- * Placing this anywhere safely inside the Rebase layout automatically triggers
550
- * UI mode synchronization.
551
- */
552
- function AdminModeSyncer({ devViews }) {
553
- const location = useLocation();
554
- const urlController = useUrlController();
555
- const adminModeController = useAdminModeController();
556
- const currentModeRef = React.useRef(adminModeController.mode);
557
- currentModeRef.current = adminModeController.mode;
558
- const setModeRef = React.useRef(adminModeController.setMode);
559
- setModeRef.current = adminModeController.setMode;
560
- useEffect(() => {
561
- const path = location.pathname;
562
- const isContentRoute = urlController.isUrlCollectionPath(path) || path === urlController.basePath;
563
- const studioHomePath = urlController.basePath === "/" ? "/s" : `${urlController.basePath}/s`;
564
- if ((path === studioHomePath || path.startsWith(studioHomePath + "/") || devViews?.some((view) => {
565
- const viewPath = urlController.buildAppUrlPath(view.slug);
566
- return path.startsWith(`${viewPath}/`) || path === viewPath;
567
- })) && currentModeRef.current !== "studio") setModeRef.current("studio");
568
- else if (isContentRoute && currentModeRef.current !== "cms") setModeRef.current("cms");
569
- }, [
570
- location.pathname,
571
- urlController,
572
- devViews
573
- ]);
574
- return null;
575
- }
576
- //#endregion
577
- //#region src/components/app/useApp.tsx
578
- var AppContext = React.createContext({
579
- hasDrawer: false,
580
- drawerHovered: false,
581
- drawerOpen: false,
582
- openDrawer: () => {
583
- throw new Error("openDrawer not implemented");
584
- },
585
- closeDrawer: () => {
586
- throw new Error("closeDrawer not implemented");
587
- },
588
- closeHover: () => {
589
- throw new Error("closeHover not implemented");
590
- },
591
- autoOpenDrawer: false
592
- });
593
- function useApp() {
594
- return React.useContext(AppContext);
595
- }
596
- //#endregion
597
- //#region src/components/DefaultAppBar.tsx
598
- /**
599
- * This component renders the main app bar of Rebase.
600
- * You will likely not need to use this component directly.
601
- *
602
-
603
- */
604
- var DefaultAppBar = function DefaultAppBar({ title, endAdornment, startAdornment, dropDownActions, includeModeToggle = true, includeLanguageToggle = true, includeUserMenu = true, className, style, user: userProp, logo: logoProp }) {
605
- const { hasDrawer, drawerOpen, logo: appLogo } = useApp();
606
- const logo = logoProp ?? appLogo;
607
- const navigation = useUrlController();
608
- const breadcrumbs = useBreadcrumbsController();
609
- const authController = useAuthController();
610
- useAdminModeController();
611
- const { mode, setMode } = useModeController();
612
- const navigate = useNavigate();
613
- const largeLayout = useLargeLayout();
614
- const user = userProp ?? authController.user;
615
- const { t } = useTranslation();
616
- const rebaseContext = useRebaseContext();
617
- const slotProps = React.useMemo(() => ({ context: rebaseContext }), [rebaseContext]);
618
- const globalSearch = useSlot("global.search", slotProps);
619
- const shellToolbar = useSlot("shell.toolbar", slotProps);
620
- let avatarComponent;
621
- if (user) {
622
- const initial = user?.displayName ? user.displayName[0].toUpperCase() : user?.email ? user.email[0].toUpperCase() : "A";
623
- avatarComponent = /* @__PURE__ */ jsx(Avatar, {
624
- src: user.photoURL ?? void 0,
625
- children: initial
626
- });
627
- } else if (user === void 0 || authController.initialLoading) avatarComponent = /* @__PURE__ */ jsx("div", {
628
- className: "p-1 flex justify-center",
629
- children: /* @__PURE__ */ jsx(Skeleton, { className: "w-10 h-10 rounded-full" })
630
- });
631
- else avatarComponent = null;
632
- return /* @__PURE__ */ jsxs("div", {
633
- style,
634
- role: "banner",
635
- className: cls("w-full h-14 transition-all ease-in duration-75 absolute top-0 max-w-full overflow-x-auto no-scrollbar", "flex flex-row gap-2 px-4 items-center", "backdrop-blur-sm bg-surface-frame/90", {
636
- "pl-[19rem]": drawerOpen && largeLayout,
637
- "pl-24": hasDrawer && !(drawerOpen && largeLayout),
638
- "z-10": largeLayout,
639
- "duration-100": drawerOpen && largeLayout
640
- }, className),
641
- children: [
642
- navigation && (!hasDrawer || title) && /* @__PURE__ */ jsx("div", {
643
- className: "mr-2 hidden lg:block",
644
- children: /* @__PURE__ */ jsx(Link, {
645
- className: "visited:text-inherit dark:visited:text-inherit block",
646
- to: navigation?.basePath ?? "/",
647
- children: /* @__PURE__ */ jsxs("div", {
648
- className: "flex flex-row gap-4",
649
- children: [!hasDrawer && (logo ? /* @__PURE__ */ jsx("img", {
650
- src: logo,
651
- alt: "Logo",
652
- className: cls("w-[32px] h-[32px] object-contain")
653
- }) : /* @__PURE__ */ jsx(RebaseLogo, {
654
- width: "32px",
655
- height: "32px"
656
- })), typeof title === "string" ? /* @__PURE__ */ jsx(Typography, {
657
- variant: "subtitle1",
658
- noWrap: true,
659
- children: title
660
- }) : title]
661
- })
662
- })
663
- }),
664
- /* @__PURE__ */ jsx("div", {
665
- className: "mr-8 hidden lg:block",
666
- children: /* @__PURE__ */ jsx("nav", {
667
- "aria-label": "Breadcrumb",
668
- children: /* @__PURE__ */ jsx("div", {
669
- className: "flex flex-row gap-2 items-center",
670
- children: breadcrumbs.breadcrumbs.map((breadcrumb, index) => {
671
- return /* @__PURE__ */ jsxs(React.Fragment, { children: [index > 0 && /* @__PURE__ */ jsx(Typography, {
672
- variant: "caption",
673
- color: "secondary",
674
- children: "/"
675
- }), /* @__PURE__ */ jsx(Link, {
676
- className: "visited:text-inherit dark:visited:text-inherit block",
677
- to: breadcrumb.url,
678
- children: /* @__PURE__ */ jsx("div", {
679
- className: "flex flex-row items-center gap-2 whitespace-nowrap",
680
- children: /* @__PURE__ */ jsx(Typography, {
681
- variant: "body2",
682
- children: breadcrumb.title
683
- })
684
- })
685
- }, index)] }, breadcrumb.url + "_" + index);
686
- })
687
- })
688
- })
689
- }),
690
- startAdornment,
691
- globalSearch,
692
- /* @__PURE__ */ jsx("div", { className: "grow" }),
693
- endAdornment && /* @__PURE__ */ jsx(ErrorBoundary, { children: endAdornment }),
694
- shellToolbar,
695
- includeLanguageToggle && /* @__PURE__ */ jsx(LanguageToggle, {}),
696
- includeModeToggle && /* @__PURE__ */ jsxs(Menu, {
697
- trigger: /* @__PURE__ */ jsx(IconButton, {
698
- color: "inherit",
699
- "aria-label": "Toggle theme",
700
- children: mode === "dark" ? /* @__PURE__ */ jsx(MoonIcon, { size: iconSize.small }) : /* @__PURE__ */ jsx(SunIcon, { size: iconSize.small })
701
- }),
702
- children: [
703
- /* @__PURE__ */ jsxs(MenuItem, {
704
- onClick: () => setMode("dark"),
705
- children: [
706
- /* @__PURE__ */ jsx(MoonIcon, { size: iconSize.smallest }),
707
- " ",
708
- t("dark_mode")
709
- ]
710
- }),
711
- /* @__PURE__ */ jsxs(MenuItem, {
712
- onClick: () => setMode("light"),
713
- children: [
714
- /* @__PURE__ */ jsx(SunIcon, { size: iconSize.smallest }),
715
- " ",
716
- t("light_mode"),
717
- " "
718
- ]
719
- }),
720
- /* @__PURE__ */ jsxs(MenuItem, {
721
- onClick: () => setMode("system"),
722
- children: [
723
- " ",
724
- /* @__PURE__ */ jsx(SunMoonIcon, { size: iconSize.smallest }),
725
- t("system_mode")
726
- ]
727
- })
728
- ]
729
- }),
730
- includeUserMenu && /* @__PURE__ */ jsxs(Menu, {
731
- trigger: /* @__PURE__ */ jsx("div", {
732
- "aria-label": "User menu",
733
- role: "button",
734
- children: avatarComponent
735
- }),
736
- children: [
737
- user && /* @__PURE__ */ jsxs("div", {
738
- className: "px-4 py-2 mb-2",
739
- children: [user.displayName && /* @__PURE__ */ jsx(Typography, {
740
- variant: "body1",
741
- color: "secondary",
742
- children: user.displayName
743
- }), user.email && /* @__PURE__ */ jsx(Typography, {
744
- variant: "body2",
745
- color: "secondary",
746
- children: user.email
747
- })]
748
- }),
749
- dropDownActions,
750
- !dropDownActions && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(MenuItem, {
751
- onClick: () => navigate("/settings"),
752
- children: [/* @__PURE__ */ jsx(SettingsIcon, {}), t("account_settings")]
753
- }), /* @__PURE__ */ jsxs(MenuItem, {
754
- onClick: async () => {
755
- await authController.signOut();
756
- navigate("/");
757
- },
758
- children: [/* @__PURE__ */ jsx(LogOutIcon, {}), t("log_out")]
759
- })] })
760
- ]
761
- })
762
- ]
763
- });
764
- };
765
- //#endregion
766
- //#region src/components/app/AppBar.tsx
767
- /**
768
- * This component renders the main app bar of Rebase.
769
- */
770
- function AppBar({ children, ...props }) {
771
- return /* @__PURE__ */ jsx(Fragment, { children: children ?? /* @__PURE__ */ jsx(DefaultAppBar, { ...props }) });
772
- }
773
- AppBar.componentType = "AppBar";
774
- //#endregion
775
- //#region src/components/DrawerNavigationItem.tsx
776
- function DrawerNavigationItem({ name, icon, drawerOpen, url, onClick, indented = false }) {
777
- const iconSlot = "w-[44px]";
778
- const iconWrap = indented ? /* @__PURE__ */ jsx("div", {
779
- className: cls("shrink-0 h-[30px]", iconSlot),
780
- "aria-hidden": true
781
- }) : /* @__PURE__ */ jsx("div", {
782
- className: cls("shrink-0 flex items-center justify-center h-[30px] text-surface-500 dark:text-text-secondary-dark [&>svg]:size-4 group-hover/nav:text-primary transition-colors duration-150", iconSlot),
783
- children: icon
784
- });
785
- const [wantsTooltip, setWantsTooltip] = React.useState(false);
786
- if (drawerOpen && wantsTooltip) setWantsTooltip(false);
787
- const listItem = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(NavLink, {
788
- onClick,
789
- "aria-label": name,
790
- style: {
791
- width: "100%",
792
- transition: drawerOpen ? "width 150ms ease-in" : void 0
793
- },
794
- className: ({ isActive }) => cls("rounded-lg truncate group/nav", "hover:bg-surface-hover text-surface-700 dark:text-surface-300 hover:text-surface-900 dark:hover:text-white", "flex flex-row items-center", drawerOpen ? "pr-4 h-[30px]" : "h-[30px]", "font-medium text-[13px]", isActive ? "bg-primary/8 dark:bg-primary/10 text-primary dark:text-primary [&_div]:text-primary" : ""),
795
- to: url,
796
- children: [iconWrap, /* @__PURE__ */ jsx("div", {
797
- className: cls("text-text-primary dark:text-surface-200", drawerOpen ? "opacity-100" : "opacity-0 hidden", "font-inherit truncate space-x-2"),
798
- children: name
799
- })]
800
- }) });
801
- return /* @__PURE__ */ jsx(Tooltip, {
802
- open: !drawerOpen && wantsTooltip,
803
- onOpenChange: setWantsTooltip,
804
- side: "right",
805
- title: name,
806
- children: listItem
807
- });
808
- }
809
- //#endregion
810
- //#region src/components/DrawerNavigationGroup.tsx
811
- /**
812
- * Shared drawer navigation group component used by both DefaultDrawer and RebaseCloudDrawer.
813
- * Renders a collapsible group with header and navigation items.
814
- */
815
- function DrawerNavigationGroup({ group, entries, collapsed, onToggleCollapsed, drawerOpen, headerActions, onItemClick, hideHeader, icon }) {
816
- const groupLabel = useNavigationGroupLabel();
817
- const ResolvedDrawerNavigationItem = useComponentOverride("Shell.DrawerNavigationItem", DrawerNavigationItem);
818
- const groupIcon = !hideHeader && drawerOpen ? getIcon(icon, void 0, void 0, "small") : void 0;
819
- return /* @__PURE__ */ jsxs("div", {
820
- className: "my-2 mx-2 flex flex-col",
821
- children: [!hideHeader && /* @__PURE__ */ jsxs("div", {
822
- className: cls("pl-3 pr-2 py-0.5 flex flex-row items-center transition-colors", drawerOpen ? "cursor-pointer hover:bg-surface-hover rounded-lg" : "opacity-0 invisible pointer-events-none"),
823
- onClick: drawerOpen ? onToggleCollapsed : void 0,
824
- children: [
825
- /* @__PURE__ */ jsx(ChevronDownIcon, {
826
- size: iconSize.small,
827
- className: cls("text-surface-400 dark:text-surface-400 transition-transform duration-200 mr-1", collapsed ? "-rotate-90" : "rotate-0")
828
- }),
829
- groupIcon && /* @__PURE__ */ jsx("span", {
830
- className: "shrink-0 mr-2 flex items-center text-surface-600 dark:text-surface-300 [&>svg]:size-4",
831
- children: groupIcon
832
- }),
833
- /* @__PURE__ */ jsx(Typography, {
834
- variant: "caption",
835
- color: "secondary",
836
- className: "font-semibold text-[11px] uppercase tracking-wider flex-grow line-clamp-1 text-surface-400 dark:text-surface-400",
837
- children: groupLabel(group || "Views")
838
- }),
839
- headerActions && /* @__PURE__ */ jsx("div", {
840
- onClick: (e) => e.stopPropagation(),
841
- children: headerActions
842
- })
843
- ]
844
- }), /* @__PURE__ */ jsx("div", {
845
- className: cls("transition-all duration-200 ease-in-out", "overflow-hidden", !hideHeader && "dark:bg-transparent", "rounded-lg", !hideHeader && collapsed ? "max-h-0 opacity-0" : "max-h-[2000px] opacity-100"),
846
- children: entries.map((entry) => /* @__PURE__ */ jsx(ResolvedDrawerNavigationItem, {
847
- icon: /* @__PURE__ */ jsx(IconForView, {
848
- collectionOrView: entry.collection ?? entry.view,
849
- size: "small"
850
- }),
851
- drawerOpen,
852
- onClick: () => onItemClick?.(entry),
853
- url: entry.url,
854
- name: entry.name
855
- }, entry.id))
856
- })]
857
- }, `drawer_group_${group}`);
858
- }
859
- //#endregion
860
- //#region src/components/DefaultDrawer.tsx
861
- /**
862
- * Default drawer used in the admin.
863
- *
864
- * When no `children` are provided, renders the full admin navigation
865
- * (collection groups, mode switch, plugin slots).
866
- *
867
- * When `children` **are** provided, renders the shared drawer shell
868
- * (logo, scrollable area, footer actions, collapse toggle) with the
869
- * custom content injected in the scrollable area. This lets consumers
870
- * like the SaaS dashboard reuse the identical structural layout while
871
- * supplying their own navigation items.
872
- *
873
- * @group Core
874
- */
875
- function DefaultDrawer({ title, logo, logoDestination, children, footerActions, className, style }) {
876
- const { drawerHovered, drawerOpen, openDrawer, closeDrawer, logo: appLogo } = useApp();
877
- const resolvedLogo = logo ?? appLogo;
878
- const scrollRef = React.useRef(null);
879
- const [scrolled, setScrolled] = React.useState(false);
880
- const handleScroll = () => {
881
- if (scrollRef.current) setScrolled(scrollRef.current.scrollTop > 0);
882
- };
883
- return /* @__PURE__ */ jsxs("div", {
884
- role: "navigation",
885
- "aria-label": "Main navigation",
886
- className: cls("flex flex-col h-full relative grow w-full", className),
887
- style,
888
- children: [
889
- /* @__PURE__ */ jsx(DrawerLogo, {
890
- logo: resolvedLogo,
891
- title,
892
- logoDestination,
893
- drawerOpen,
894
- drawerHovered
895
- }),
896
- /* @__PURE__ */ jsx("div", {
897
- ref: scrollRef,
898
- onScroll: handleScroll,
899
- className: "flex-grow min-h-0 overflow-y-auto overflow-x-hidden no-scrollbar px-2",
900
- style: { maskImage: scrolled ? "linear-gradient(to bottom, transparent 0, black 20px, black calc(100% - 20px), transparent 100%)" : "linear-gradient(to bottom, black 0, black calc(100% - 20px), transparent 100%)" },
901
- children: children ?? /* @__PURE__ */ jsx(AdminNavigationContent, {})
902
- }),
903
- footerActions !== null && (footerActions !== void 0 ? footerActions : /* @__PURE__ */ jsx(DrawerFooterActions, {
904
- drawerOpen,
905
- drawerHovered
906
- })),
907
- /* @__PURE__ */ jsx(DrawerToggle, {
908
- drawerOpen,
909
- drawerHovered,
910
- openDrawer,
911
- closeDrawer
912
- })
913
- ]
914
- });
915
- }
916
- /**
917
- * Default admin navigation content — rendered inside DefaultDrawer when no
918
- * custom `children` are provided. Contains the mode switch, navigation
919
- * groups, and header / footer plugin slots.
920
- */
921
- function AdminNavigationContent() {
922
- const { drawerHovered, drawerOpen, closeDrawer, closeHover } = useApp();
923
- const analyticsController = useAnalyticsController();
924
- const navigationState = useNavigationStateController();
925
- const context = useRebaseContext();
926
- const largeLayout = useLargeLayout();
927
- const adminModeController = useAdminModeController();
928
- const registry = useRebaseRegistry();
929
- const ResolvedDrawerNavigationGroup = useComponentOverride("Shell.DrawerNavigationGroup", DrawerNavigationGroup);
930
- const allNavigationEntries = navigationState.topLevelNavigation?.navigationEntries ?? [];
931
- const studioViewSlugs = useMemo(() => {
932
- const slugs = /* @__PURE__ */ new Set();
933
- (registry.studioConfig?.devViews ?? []).forEach((v) => slugs.add(v.slug));
934
- if (registry.studioConfig && registry.cmsConfig?.collectionEditor) slugs.add("schema");
935
- return slugs;
936
- }, [registry.studioConfig, registry.cmsConfig?.collectionEditor]);
937
- const filteredEntries = adminModeController.mode === "studio" ? allNavigationEntries.filter((e) => e.type === "view" && studioViewSlugs.has(e.slug) || e.type === "admin") : allNavigationEntries.filter((e) => e.type !== "view" || !studioViewSlugs.has(e.slug));
938
- const entryGroups = new Set(filteredEntries.map((e) => e.group).filter(Boolean));
939
- const orderedGroups = navigationState.topLevelNavigation?.groups ?? [];
940
- const groupsToRender = [...orderedGroups.filter((g) => entryGroups.has(g)), ...[...entryGroups].filter((g) => !orderedGroups.includes(g))];
941
- const groupIcons = useMemo(() => {
942
- const icons = /* @__PURE__ */ new Map();
943
- (registry.cmsConfig?.navigationGroupMappings ?? []).forEach((mapping) => {
944
- if (mapping.icon) icons.set(mapping.name, mapping.icon);
945
- });
946
- return icons;
947
- }, [registry.cmsConfig?.navigationGroupMappings]);
948
- const { isGroupCollapsed, toggleGroupCollapsed } = useCollapsedGroups(groupsToRender, "drawer", useMemo(() => buildCollapsedDefaults(registry.cmsConfig?.navigationGroupMappings, "drawer"), [registry.cmsConfig?.navigationGroupMappings]));
949
- const headerSlot = useSlot("navigation.header", {
950
- drawerOpen,
951
- drawerHovered,
952
- context
953
- });
954
- const footerSlot = useSlot("navigation.footer", {
955
- drawerOpen,
956
- drawerHovered,
957
- context
958
- });
959
- if (!navigationState.topLevelNavigation) return null;
960
- const onItemClick = (view) => {
961
- const eventName = view.type === "collection" ? "drawer_navigate_to_collection" : view.type === "view" ? "drawer_navigate_to_view" : "unmapped_event";
962
- analyticsController.onAnalyticsEvent?.(eventName, { url: view.url });
963
- if (!largeLayout) closeDrawer();
964
- else if (!drawerOpen) closeHover();
965
- };
966
- const drawerVisuallyOpen = drawerOpen || drawerHovered;
967
- return /* @__PURE__ */ jsxs(Fragment, { children: [
968
- registry.studioConfig && /* @__PURE__ */ jsx(DrawerModeSwitch, {
969
- drawerOpen,
970
- drawerHovered
971
- }),
972
- headerSlot,
973
- groupsToRender.map((group) => {
974
- const entriesInGroup = filteredEntries.filter((e) => e.group === group);
975
- return /* @__PURE__ */ jsx(ResolvedDrawerNavigationGroup, {
976
- group,
977
- entries: entriesInGroup,
978
- collapsed: isGroupCollapsed(group),
979
- onToggleCollapsed: () => toggleGroupCollapsed(group),
980
- drawerOpen: drawerVisuallyOpen,
981
- onItemClick,
982
- icon: groupIcons.get(group)
983
- }, `drawer_group_${group}`);
984
- }),
985
- footerSlot
986
- ] });
987
- }
988
- function DrawerLogo({ logo, title, logoDestination = "/", drawerOpen, drawerHovered }) {
989
- const showFullContent = drawerOpen || drawerHovered;
990
- const { t } = useTranslation();
991
- return /* @__PURE__ */ jsxs("div", {
992
- className: "flex flex-row items-center shrink-0 pt-4 pb-0 px-2",
993
- children: [/* @__PURE__ */ jsx(Link, {
994
- className: "shrink-0 flex items-center justify-center w-[56px] h-[40px]",
995
- to: logoDestination,
996
- "aria-label": t("home", { defaultValue: "Home" }),
997
- children: logo ? /* @__PURE__ */ jsx("img", {
998
- src: logo,
999
- alt: "Logo",
1000
- className: "w-[28px] h-[28px] object-contain"
1001
- }) : /* @__PURE__ */ jsx(RebaseLogo, {
1002
- width: "28px",
1003
- height: "28px"
1004
- })
1005
- }), /* @__PURE__ */ jsx("div", {
1006
- className: cls("flex flex-row items-center overflow-hidden transition-all duration-200 ease-in-out", showFullContent ? "opacity-100 w-full ml-1" : "opacity-0 w-0 ml-0"),
1007
- children: title && /* @__PURE__ */ jsx(Link, {
1008
- className: "visited:text-inherit dark:visited:text-inherit block truncate",
1009
- to: logoDestination,
1010
- children: typeof title === "string" ? /* @__PURE__ */ jsx(Typography, {
1011
- variant: "subtitle1",
1012
- noWrap: true,
1013
- className: "truncate",
1014
- children: title
1015
- }) : title
1016
- })
1017
- })]
1018
- });
1019
- }
1020
- /**
1021
- * Toggle button at the bottom of the drawer.
1022
- * Uses double-chevron icons to indicate collapse/expand direction.
1023
- */
1024
- function DrawerToggle({ drawerOpen, drawerHovered, openDrawer, closeDrawer }) {
1025
- const isExpanded = drawerOpen;
1026
- const showFullContent = isExpanded || drawerHovered && !drawerOpen;
1027
- const [wantsTooltip, setWantsTooltip] = React.useState(false);
1028
- if (showFullContent && wantsTooltip) setWantsTooltip(false);
1029
- const { t } = useTranslation();
1030
- return /* @__PURE__ */ jsx("div", {
1031
- className: "shrink-0 mt-auto px-4 pt-0.5 pb-2",
1032
- children: /* @__PURE__ */ jsx(Tooltip, {
1033
- title: isExpanded ? t("collapse") : t("expand"),
1034
- open: !showFullContent && wantsTooltip,
1035
- onOpenChange: setWantsTooltip,
1036
- side: "right",
1037
- sideOffset: 12,
1038
- asChild: true,
1039
- children: /* @__PURE__ */ jsxs("button", {
1040
- type: "button",
1041
- className: cls("flex flex-row items-center rounded-lg cursor-pointer w-full", "hover:bg-surface-hover", "transition-colors duration-150", "py-2"),
1042
- "aria-expanded": isExpanded,
1043
- "aria-label": isExpanded ? t("collapse") : t("expand"),
1044
- onClick: () => isExpanded ? closeDrawer() : openDrawer(),
1045
- children: [/* @__PURE__ */ jsx("div", {
1046
- className: "shrink-0 flex items-center justify-center w-[44px] h-[24px] text-surface-500 dark:text-surface-400",
1047
- children: isExpanded ? /* @__PURE__ */ jsx(ChevronsLeftIcon, { size: iconSize.small }) : /* @__PURE__ */ jsx(ChevronsRightIcon, { size: iconSize.small })
1048
- }), /* @__PURE__ */ jsx("div", {
1049
- className: cls("overflow-hidden transition-all duration-200 ease-in-out", showFullContent ? "opacity-100 w-auto" : "opacity-0 w-0"),
1050
- children: /* @__PURE__ */ jsx(Typography, {
1051
- variant: "body2",
1052
- className: "text-surface-500 dark:text-surface-400 select-none whitespace-nowrap",
1053
- children: isExpanded ? t("collapse") : t("expand")
1054
- })
1055
- })]
1056
- })
1057
- })
1058
- });
1059
- }
1060
- /**
1061
- * Segmented Content / Studio switch rendered inside the drawer.
1062
- * Animates in/out with the drawer open state via opacity + max-height.
1063
- */
1064
- function DrawerModeSwitch({ drawerOpen, drawerHovered }) {
1065
- const adminModeController = useAdminModeController();
1066
- const urlController = useUrlController();
1067
- const navigate = useNavigate();
1068
- return /* @__PURE__ */ jsx("div", {
1069
- className: cls("shrink-0 overflow-hidden transition-all duration-200 ease-in-out px-3", drawerOpen || drawerHovered ? "opacity-100 h-7 mt-2 mb-0" : "opacity-0 pointer-events-none h-7 mt-2 mb-0"),
1070
- children: /* @__PURE__ */ jsxs("div", {
1071
- role: "group",
1072
- "aria-label": "Panel mode",
1073
- className: "flex bg-surface-field rounded-lg p-0.5",
1074
- children: [/* @__PURE__ */ jsx("button", {
1075
- onClick: () => {
1076
- adminModeController.setMode("cms");
1077
- navigate(urlController.basePath ?? "/");
1078
- },
1079
- "aria-pressed": adminModeController.mode === "cms",
1080
- className: cls("flex-1 px-3 py-0.5 text-xs font-medium rounded-md transition-all text-center", adminModeController.mode === "cms" ? "bg-surface-lifted shadow-sm text-text-primary dark:text-text-primary-dark" : "text-surface-500 hover:text-surface-900 dark:hover:text-white"),
1081
- children: "CMS"
1082
- }), /* @__PURE__ */ jsx("button", {
1083
- onClick: () => {
1084
- adminModeController.setMode("studio");
1085
- navigate(urlController.basePath === "/" ? "/s" : `${urlController.basePath ?? ""}/s`);
1086
- },
1087
- "aria-pressed": adminModeController.mode === "studio",
1088
- className: cls("flex-1 px-3 py-0.5 text-xs font-medium rounded-md transition-all text-center", adminModeController.mode === "studio" ? "bg-surface-lifted shadow-sm text-text-primary dark:text-text-primary-dark" : "text-surface-500 hover:text-surface-900 dark:hover:text-white"),
1089
- children: "Studio"
1090
- })]
1091
- })
1092
- });
1093
- }
1094
- /**
1095
- * Footer actions rendered at the bottom of the drawer, above the collapse/expand toggle.
1096
- * Replaces the app bar icons (language, theme, user avatar) with a drawer-native layout
1097
- * that adapts between collapsed (icons only) and expanded (full labels + user bar) states.
1098
- *
1099
- * @group Core
1100
- */
1101
- function DrawerFooterActions({ drawerOpen, drawerHovered, dropDownActions, user: userProp }) {
1102
- const authController = useAuthController();
1103
- const { mode, setMode } = useModeController();
1104
- const navigate = useNavigate();
1105
- const { t } = useTranslation();
1106
- const user = userProp ?? authController.user;
1107
- const showFullContent = drawerOpen || drawerHovered;
1108
- const portalRef = React.useRef(null);
1109
- let avatarComponent;
1110
- if (user) {
1111
- const initial = user?.displayName ? user.displayName[0].toUpperCase() : user?.email ? user.email[0].toUpperCase() : "A";
1112
- avatarComponent = /* @__PURE__ */ jsx(Avatar, {
1113
- src: user.photoURL ?? void 0,
1114
- className: "w-8 h-8 text-xs",
1115
- children: initial
1116
- });
1117
- } else if (user === void 0 || authController.initialLoading) avatarComponent = /* @__PURE__ */ jsx(Skeleton, { className: "w-8 h-8 rounded-full" });
1118
- else avatarComponent = null;
1119
- return /* @__PURE__ */ jsx("div", {
1120
- className: "shrink-0 pt-2 pb-0",
1121
- ref: portalRef,
1122
- children: avatarComponent && /* @__PURE__ */ jsxs("div", {
1123
- className: "flex items-center px-[16px] py-1",
1124
- children: [/* @__PURE__ */ jsxs(Menu, {
1125
- trigger: /* @__PURE__ */ jsx("div", {
1126
- className: cls("shrink-0 flex items-center justify-center w-[44px] cursor-pointer", "rounded-md py-1", "hover:bg-surface-hover", "transition-colors duration-150"),
1127
- role: "button",
1128
- tabIndex: 0,
1129
- "aria-label": t("user_menu", { defaultValue: "User menu" }),
1130
- children: avatarComponent
1131
- }),
1132
- side: "top",
1133
- align: "start",
1134
- children: [
1135
- user && /* @__PURE__ */ jsxs("div", {
1136
- className: "px-4 py-2 mb-1",
1137
- children: [user.displayName && /* @__PURE__ */ jsx(Typography, {
1138
- variant: "body1",
1139
- color: "secondary",
1140
- children: user.displayName
1141
- }), user.email && /* @__PURE__ */ jsx(Typography, {
1142
- variant: "body2",
1143
- color: "secondary",
1144
- children: user.email
1145
- })]
1146
- }),
1147
- dropDownActions,
1148
- !dropDownActions && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(MenuItem, {
1149
- onClick: () => navigate("/settings"),
1150
- children: [/* @__PURE__ */ jsx(SettingsIcon, {}), t("account_settings")]
1151
- }), /* @__PURE__ */ jsxs(MenuItem, {
1152
- onClick: async () => {
1153
- await authController.signOut();
1154
- navigate("/");
1155
- },
1156
- children: [/* @__PURE__ */ jsx(LogOutIcon, {}), t("log_out")]
1157
- })] })
1158
- ]
1159
- }), showFullContent && /* @__PURE__ */ jsxs("div", {
1160
- className: "flex items-center gap-0",
1161
- children: [/* @__PURE__ */ jsx(LanguageToggle, {}), /* @__PURE__ */ jsxs(Menu, {
1162
- trigger: /* @__PURE__ */ jsx(IconButton, {
1163
- color: "inherit",
1164
- "aria-label": t("toggle_theme", { defaultValue: "Toggle theme" }),
1165
- className: "text-surface-500 dark:text-surface-400",
1166
- children: mode === "dark" ? /* @__PURE__ */ jsx(MoonIcon, { size: iconSize.small }) : mode === "light" ? /* @__PURE__ */ jsx(SunIcon, { size: iconSize.small }) : /* @__PURE__ */ jsx(SunMoonIcon, { size: iconSize.small })
1167
- }),
1168
- portalContainer: portalRef.current,
1169
- side: "top",
1170
- children: [
1171
- /* @__PURE__ */ jsxs(MenuItem, {
1172
- onClick: () => setMode("dark"),
1173
- children: [
1174
- /* @__PURE__ */ jsx(MoonIcon, { size: iconSize.smallest }),
1175
- " ",
1176
- t("dark_mode")
1177
- ]
1178
- }),
1179
- /* @__PURE__ */ jsxs(MenuItem, {
1180
- onClick: () => setMode("light"),
1181
- children: [
1182
- /* @__PURE__ */ jsx(SunIcon, { size: iconSize.smallest }),
1183
- " ",
1184
- t("light_mode")
1185
- ]
1186
- }),
1187
- /* @__PURE__ */ jsxs(MenuItem, {
1188
- onClick: () => setMode("system"),
1189
- children: [
1190
- /* @__PURE__ */ jsx(SunMoonIcon, { size: iconSize.smallest }),
1191
- " ",
1192
- t("system_mode")
1193
- ]
1194
- })
1195
- ]
1196
- })]
1197
- })]
1198
- })
1199
- });
1200
- }
1201
- //#endregion
1202
- //#region src/components/app/Drawer.tsx
1203
- /**
1204
- * This component is in charge of rendering the drawer.
1205
- * If you add this component under your {@link Scaffold}, it will be rendered
1206
- * as a drawer, and the open and close functionality will be handled automatically.
1207
- * If you want to customise the drawer, you can create your own component and pass it as a child.
1208
- * For custom drawers, you can use the {@link useApp} to open and close the drawer.
1209
- *
1210
- */
1211
- function Drawer({ children, title, logo, logoDestination, footerActions, className, style }) {
1212
- return /* @__PURE__ */ jsx(Fragment, { children: children ?? /* @__PURE__ */ jsx(DefaultDrawer, {
1213
- title,
1214
- logo,
1215
- logoDestination,
1216
- footerActions,
1217
- className,
1218
- style
1219
- }) });
1220
- }
1221
- Drawer.componentType = "Drawer";
1222
- /**
1223
- * Namespaced by base path: two admins served from one origin are two different
1224
- * navigations, and a single key would have them overwrite each other's drawer.
1225
- */
1226
- function drawerOpenStorageKey(basePath) {
1227
- return `rebase-drawer-open:${basePath || "/"}`;
1228
- }
1229
- /** `null` when the user has never toggled the drawer, or storage is unavailable. */
1230
- function readStoredDrawerOpen(key) {
1231
- if (typeof window === "undefined") return null;
1232
- try {
1233
- const stored = window.localStorage.getItem(key);
1234
- return stored === null ? null : stored === "true";
1235
- } catch (e) {
1236
- return null;
1237
- }
1238
- }
1239
- function writeStoredDrawerOpen(key, open) {
1240
- if (typeof window === "undefined") return;
1241
- try {
1242
- window.localStorage.setItem(key, String(open));
1243
- } catch (e) {}
1244
- }
1245
- /**
1246
- * This view acts as a scaffold for Rebase.
1247
- *
1248
- * It is in charge of displaying the navigation drawer, top bar and main
1249
- * collection views.
1250
- * This component needs a parent {@link Rebase}
1251
- *
1252
- * @param props
1253
-
1254
- * @group Core
1255
- */
1256
- var Scaffold = React.memo(function Scaffold(props) {
1257
- const { children, autoOpenDrawer = true, defaultDrawerOpen = false, logo, className, style, padding = true } = props;
1258
- const slotOf = (child) => React.isValidElement(child) ? child.type?.componentType : void 0;
1259
- const childArray = React.Children.toArray(children);
1260
- const drawerChildren = childArray.filter((child) => slotOf(child) === "Drawer");
1261
- if (drawerChildren.length > 1) throw Error("Only one Drawer component is allowed in Scaffold");
1262
- const appBarChildren = childArray.filter((child) => slotOf(child) === "AppBar");
1263
- if (appBarChildren.length > 1) throw Error("Only one AppBar component is allowed in Scaffold");
1264
- const otherChildren = childArray.filter((child) => slotOf(child) !== "Drawer" && slotOf(child) !== "AppBar");
1265
- const includeDrawer = drawerChildren.length > 0;
1266
- const largeLayout = useLargeLayout();
1267
- const storageKey = drawerOpenStorageKey(useUrlController().basePath);
1268
- const [drawerOpen, setDrawerOpenState] = React.useState(defaultDrawerOpen && largeLayout);
1269
- const [onHover, setOnHover] = React.useState(false);
1270
- React.useLayoutEffect(() => {
1271
- const stored = readStoredDrawerOpen(storageKey);
1272
- if (stored === null) return;
1273
- setDrawerOpenState(stored && largeLayout);
1274
- }, [storageKey]);
1275
- const wasLargeLayout = React.useRef(largeLayout);
1276
- React.useEffect(() => {
1277
- if (wasLargeLayout.current === largeLayout) return;
1278
- wasLargeLayout.current = largeLayout;
1279
- setDrawerOpenState(largeLayout ? readStoredDrawerOpen(storageKey) ?? defaultDrawerOpen : false);
1280
- }, [
1281
- largeLayout,
1282
- defaultDrawerOpen,
1283
- storageKey
1284
- ]);
1285
- const setDrawerOpen = useCallback((open) => {
1286
- setDrawerOpenState(open);
1287
- if (!largeLayout) return;
1288
- writeStoredDrawerOpen(storageKey, open);
1289
- }, [largeLayout, storageKey]);
1290
- const collapseWhenPopoverCloses = React.useRef(false);
1291
- const setOnHoverTrue = useCallback(() => {
1292
- if (!autoOpenDrawer) return;
1293
- collapseWhenPopoverCloses.current = false;
1294
- setOnHover(true);
1295
- }, [autoOpenDrawer]);
1296
- const setOnHoverFalse = useCallback(() => {
1297
- if (document.querySelector("[data-radix-popper-content-wrapper]")) {
1298
- collapseWhenPopoverCloses.current = true;
1299
- return;
1300
- }
1301
- collapseWhenPopoverCloses.current = false;
1302
- setOnHover(false);
1303
- }, []);
1304
- React.useEffect(() => {
1305
- if (!onHover) return;
1306
- const collapseIfOwed = () => {
1307
- if (!collapseWhenPopoverCloses.current) return;
1308
- if (document.querySelector("[data-radix-popper-content-wrapper]")) return;
1309
- collapseWhenPopoverCloses.current = false;
1310
- setOnHover(false);
1311
- };
1312
- const observer = new MutationObserver(collapseIfOwed);
1313
- observer.observe(document.body, {
1314
- childList: true,
1315
- subtree: true
1316
- });
1317
- return () => observer.disconnect();
1318
- }, [onHover]);
1319
- const handleDrawerOpen = useCallback(() => {
1320
- setDrawerOpen(true);
1321
- }, [setDrawerOpen]);
1322
- const handleDrawerClose = useCallback(() => {
1323
- setDrawerOpen(false);
1324
- }, [setDrawerOpen]);
1325
- const computedDrawerOpen = drawerOpen;
1326
- const computedDrawerHovered = Boolean(largeLayout && onHover);
1327
- const hasAppBar = Boolean(appBarChildren.length > 0);
1328
- const appContextValue = useMemo(() => ({
1329
- hasDrawer: Boolean(includeDrawer),
1330
- drawerOpen: computedDrawerOpen,
1331
- drawerHovered: computedDrawerHovered,
1332
- openDrawer: handleDrawerOpen,
1333
- closeDrawer: handleDrawerClose,
1334
- closeHover: setOnHoverFalse,
1335
- logo
1336
- }), [
1337
- includeDrawer,
1338
- computedDrawerOpen,
1339
- computedDrawerHovered,
1340
- handleDrawerOpen,
1341
- handleDrawerClose,
1342
- setOnHoverFalse,
1343
- logo
1344
- ]);
1345
- return /* @__PURE__ */ jsx(AppContext.Provider, {
1346
- value: appContextValue,
1347
- children: /* @__PURE__ */ jsxs("div", {
1348
- className: cls("flex h-screen w-screen overflow-hidden", "bg-surface-frame", "text-surface-900 dark:text-white", className),
1349
- style: {
1350
- paddingTop: "env(safe-area-inset-top)",
1351
- paddingLeft: "env(safe-area-inset-left)",
1352
- paddingRight: "env(safe-area-inset-right)",
1353
- paddingBottom: "env(safe-area-inset-bottom)",
1354
- height: "100dvh",
1355
- ...style
1356
- },
1357
- children: [
1358
- appBarChildren,
1359
- /* @__PURE__ */ jsx(DrawerWrapper, {
1360
- displayed: includeDrawer,
1361
- onMouseEnter: setOnHoverTrue,
1362
- onMouseMove: setOnHoverTrue,
1363
- onMouseLeave: setOnHoverFalse,
1364
- open: drawerOpen,
1365
- hovered: onHover,
1366
- setDrawerOpen,
1367
- children: includeDrawer && drawerChildren
1368
- }),
1369
- /* @__PURE__ */ jsxs("main", {
1370
- className: "flex flex-col grow overflow-auto",
1371
- children: [hasAppBar && /* @__PURE__ */ jsx(DrawerHeader, {}), /* @__PURE__ */ jsx("div", {
1372
- className: cls("bg-surface-sheet", "grow overflow-auto m-0", "lg:border lg:border-hairline", {
1373
- "mt-1 lg:m-0 lg:mx-2 lg:mb-2 lg:rounded-xl": padding,
1374
- "lg:mt-2": !hasAppBar && padding,
1375
- "lg:mt-4": !hasAppBar && !padding
1376
- }),
1377
- children: /* @__PURE__ */ jsx(ErrorBoundary, { children: otherChildren })
1378
- })]
1379
- })
1380
- ]
1381
- })
1382
- });
1383
- }, deepEqual);
1384
- var DrawerHeader = () => {
1385
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col min-h-14" });
1386
- };
1387
- function DrawerWrapper(props) {
1388
- const layoutWidth = !props.displayed ? 0 : props.open ? 280 : 72;
1389
- const visualWidth = !props.displayed ? 0 : props.open || props.hovered ? 280 : 72;
1390
- const isFloating = props.hovered && !props.open;
1391
- const { t } = useTranslation();
1392
- const innerDrawer = /* @__PURE__ */ jsx("div", {
1393
- className: cls("h-full overflow-hidden bg-surface-frame", defaultBorderMixin, isFloating ? "absolute top-0 left-0 bottom-0 z-50 shadow-lg border-r" : "relative"),
1394
- style: {
1395
- width: visualWidth,
1396
- transition: "left 75ms cubic-bezier(0.4, 0, 0.6, 1) 0ms, opacity 75ms cubic-bezier(0.4, 0, 0.6, 1) 0ms, width 75ms cubic-bezier(0.4, 0, 0.6, 1) 0ms"
1397
- },
1398
- children: /* @__PURE__ */ jsx("div", {
1399
- className: "flex flex-col h-full",
1400
- children: props.children
1401
- })
1402
- });
1403
- if (!useLargeLayout()) {
1404
- if (!props.displayed) return null;
1405
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(IconButton, {
1406
- color: "inherit",
1407
- "aria-label": t("open_menu"),
1408
- onClick: () => props.setDrawerOpen(true),
1409
- className: "absolute sm:top-2 sm:left-4 top-1 left-2",
1410
- children: /* @__PURE__ */ jsx(MenuIcon, {})
1411
- }), /* @__PURE__ */ jsx(Sheet, {
1412
- side: "left",
1413
- transparent: true,
1414
- open: props.open,
1415
- onOpenChange: props.setDrawerOpen,
1416
- title: t("navigation_drawer"),
1417
- overlayClassName: "bg-surface-scrim",
1418
- children: innerDrawer
1419
- })] });
1420
- }
1421
- return /* @__PURE__ */ jsx("div", {
1422
- className: "z-20 relative flex-shrink-0 overflow-visible",
1423
- onMouseEnter: props.onMouseEnter,
1424
- onMouseMove: props.onMouseMove,
1425
- onMouseLeave: props.onMouseLeave,
1426
- style: {
1427
- width: layoutWidth,
1428
- minWidth: layoutWidth,
1429
- transition: "left 75ms cubic-bezier(0.4, 0, 0.6, 1) 0ms, opacity 75ms cubic-bezier(0.4, 0, 0.6, 1) 0ms, width 75ms cubic-bezier(0.4, 0, 0.6, 1) 0ms"
1430
- },
1431
- children: innerDrawer
1432
- });
1433
- }
1434
- //#endregion
1435
- //#region src/components/RebaseCMS.tsx
1436
- /**
1437
- * Declarative component to configure the admin in Rebase.
1438
- * Renders nothing — purely registers config into the RebaseRegistry.
1439
- *
1440
- * When `collectionEditor` is provided, the built-in visual schema editor
1441
- * is auto-wired as a native feature (slots, provider, Studio view) without
1442
- * needing any external plugin.
1443
- */
1444
- function RebaseCMS({ collections, views, homePage, entityViews, collectionViews, entityActions, collectionEditor, navigationGroupMappings, basePath }) {
1445
- const dispatch = useRebaseRegistryDispatch();
1446
- useLayoutEffect(() => {
1447
- dispatch.registerAdmin({
1448
- collections,
1449
- views,
1450
- homePage,
1451
- entityViews,
1452
- collectionViews,
1453
- entityActions,
1454
- collectionEditor,
1455
- navigationGroupMappings,
1456
- basePath
1457
- });
1458
- return () => dispatch.unregisterAdmin();
1459
- }, [
1460
- dispatch,
1461
- collections,
1462
- views,
1463
- homePage,
1464
- entityViews,
1465
- collectionViews,
1466
- entityActions,
1467
- collectionEditor,
1468
- navigationGroupMappings,
1469
- basePath
1470
- ]);
1471
- return null;
1472
- }
1473
- //#endregion
1474
- //#region src/components/RebaseAuthGate.tsx
1475
- /**
1476
- * Auth gate component that handles the authentication flow.
1477
- *
1478
- * - Shows a loading spinner while `authController.initialLoading` is true.
1479
- * - Shows the login view when no user is authenticated.
1480
- * - Renders `children` when a user is authenticated.
1481
- *
1482
- * **Independently usable**: Use this alone when you want auth gating
1483
- * without the full admin layout or navigation.
1484
- *
1485
- * @example
1486
- * ```tsx
1487
- * <RebaseAuthGate>
1488
- * <MyCustomApp />
1489
- * </RebaseAuthGate>
1490
- * ```
1491
- */
1492
- function RebaseAuthGate({ children }) {
1493
- const registry = useRebaseRegistry();
1494
- const authController = useAuthController();
1495
- if (authController?.initialLoading) return /* @__PURE__ */ jsx(CircularProgressCenter, { size: "large" });
1496
- if (!authController?.user) return /* @__PURE__ */ jsx(Fragment, { children: registry.authConfig?.loginView ?? /* @__PURE__ */ jsx(LoginView, { authController }) });
1497
- return /* @__PURE__ */ jsx(Fragment, { children });
1498
- }
1499
- //#endregion
1500
- //#region src/collection_editor/useLiveSchemaEditing.tsx
1501
- /**
1502
- * The plan-then-confirm flow, as a hook.
1503
- *
1504
- * Owns three things that belong together and nothing else: whether the backend
1505
- * can edit its schema, the plan for the change somebody is making, and the
1506
- * dialog they confirm it in. The config controller calls `reviewChange` and
1507
- * awaits it; everything about *how* the confirmation happens stays here.
1508
- *
1509
- * ## Why `reviewChange` returns a promise that can reject
1510
- *
1511
- * Because the editor needs to know. A save that was cancelled must not leave
1512
- * the form thinking it succeeded — the collection on screen would then differ
1513
- * from the one on disk, and the next save would be computed from the wrong
1514
- * `before`. Rejecting with {@link SchemaChangeCancelled} is how "the person
1515
- * said no" reaches the caller as an outcome rather than as silence.
1516
- */
1517
- /**
1518
- * Loaded when a change is actually being reviewed, not before.
1519
- *
1520
- * This hook is reached from the collections config controller, which is
1521
- * constructed on every admin boot — so a static import would put the dialog and
1522
- * the `@rebasepro/ui` surface it draws on into the **eager** bundle: everything
1523
- * a browser downloads before the login screen paints. It cost 14 kB there, for
1524
- * a dialog most sessions never open. The bundle budget caught it.
1525
- */
1526
- var SchemaChangeDialog = lazyChunk(() => import("./SchemaChangeDialog-BeP0A4MJ.js").then((n) => n.n).then((m) => ({ default: m.SchemaChangeDialog })));
1527
- function useLiveSchemaEditing(options) {
1528
- const { baseUrl, authKey, writeSourceOnly } = options;
1529
- const optionsRef = useRef(options);
1530
- optionsRef.current = options;
1531
- const client = useMemo(() => options.client ?? createLiveSchemaClient({
1532
- baseUrl,
1533
- getAuthToken: () => optionsRef.current.getAuthToken?.() ?? null
1534
- }), [baseUrl, options.client]);
1535
- const [status, setStatus] = useState();
1536
- const [pending, setPending] = useState();
1537
- const [plan, setPlan] = useState();
1538
- const [planError, setPlanError] = useState();
1539
- const [result, setResult] = useState();
1540
- const [applying, setApplying] = useState(false);
1541
- const [applyError, setApplyError] = useState();
1542
- const probe = useRef(void 0);
1543
- /** Which review a plan response belongs to. See `reviewChange`. */
1544
- const reviewToken = useRef(0);
1545
- const ready = useCallback(() => {
1546
- const key = [client, authKey];
1547
- const current = probe.current;
1548
- if (!current || current.key[0] !== key[0] || current.key[1] !== key[1]) probe.current = {
1549
- key,
1550
- promise: client.status()
1551
- };
1552
- return probe.current.promise;
1553
- }, [client, authKey]);
1554
- useEffect(() => {
1555
- let cancelled = false;
1556
- ready().then((answer) => {
1557
- if (!cancelled) setStatus(answer);
1558
- });
1559
- return () => {
1560
- cancelled = true;
1561
- };
1562
- }, [ready]);
1563
- /**
1564
- * Ask what the change would do, and ignore an answer that arrives late.
1565
- *
1566
- * Separate from `reviewChange` so it can be issued *again* without starting
1567
- * a new review: a plan that failed on a dropped connection should cost a
1568
- * click, not the whole wizard — the person has already filled in the form,
1569
- * and making them do it twice for a transient failure is the kind of thing
1570
- * that teaches people to distrust the preview.
1571
- */
1572
- const requestPlan = useCallback(async (change) => {
1573
- const token = ++reviewToken.current;
1574
- try {
1575
- const answer = await client.plan(change);
1576
- if (token === reviewToken.current) setPlan(answer);
1577
- } catch (err) {
1578
- if (token !== reviewToken.current) return;
1579
- setPlanError(err instanceof LiveSchemaError || err instanceof Error ? err.message : String(err));
1580
- }
1581
- }, [client]);
1582
- const onRetry = useCallback(() => {
1583
- if (!pending) return;
1584
- setPlanError(void 0);
1585
- setPlan(void 0);
1586
- requestPlan(pending.change);
1587
- }, [pending, requestPlan]);
1588
- const clear = useCallback(() => {
1589
- setPending(void 0);
1590
- setPlan(void 0);
1591
- setPlanError(void 0);
1592
- setResult(void 0);
1593
- setApplyError(void 0);
1594
- setApplying(false);
1595
- }, []);
1596
- const reviewChange = useCallback((change) => {
1597
- return new Promise((resolve, reject) => {
1598
- setPending((previous) => {
1599
- previous?.reject(new SchemaChangeCancelled());
1600
- return {
1601
- change,
1602
- resolve,
1603
- reject
1604
- };
1605
- });
1606
- setPlan(void 0);
1607
- setPlanError(void 0);
1608
- setResult(void 0);
1609
- setApplyError(void 0);
1610
- setApplying(false);
1611
- requestPlan(change);
1612
- });
1613
- }, [requestPlan]);
1614
- const onConfirm = useCallback(() => {
1615
- if (!pending) return;
1616
- setApplying(true);
1617
- setApplyError(void 0);
1618
- client.apply(pending.change).then((answer) => {
1619
- setResult(answer);
1620
- setApplying(false);
1621
- pending.resolve();
1622
- setPending(void 0);
1623
- }, (err) => {
1624
- setApplying(false);
1625
- setApplyError(err instanceof Error ? err.message : String(err));
1626
- });
1627
- }, [client, pending]);
1628
- const onSourceOnly = useCallback(() => {
1629
- if (!pending || !writeSourceOnly) return;
1630
- setApplying(true);
1631
- setApplyError(void 0);
1632
- const settle = pending;
1633
- writeSourceOnly(settle.change).then(() => {
1634
- clear();
1635
- settle.resolve();
1636
- }, (err) => {
1637
- setApplying(false);
1638
- setApplyError(err instanceof Error ? err.message : String(err));
1639
- });
1640
- }, [
1641
- pending,
1642
- writeSourceOnly,
1643
- clear
1644
- ]);
1645
- const onClose = useCallback(() => {
1646
- if (applying) return;
1647
- const settle = pending;
1648
- clear();
1649
- if (settle && !result) settle.reject(new SchemaChangeCancelled());
1650
- }, [
1651
- applying,
1652
- pending,
1653
- result,
1654
- clear
1655
- ]);
1656
- const open = Boolean(pending) || Boolean(result);
1657
- return {
1658
- status,
1659
- ready,
1660
- reviewChange,
1661
- dialog: open ? /* @__PURE__ */ jsx(Suspense, {
1662
- fallback: null,
1663
- children: /* @__PURE__ */ jsx(SchemaChangeDialog, {
1664
- open,
1665
- collectionId: pending?.change.collectionId ?? "",
1666
- plan,
1667
- planError,
1668
- result,
1669
- applying,
1670
- applyError,
1671
- onConfirm,
1672
- onRetry: planError ? onRetry : void 0,
1673
- onSourceOnly: writeSourceOnly ? onSourceOnly : void 0,
1674
- onClose,
1675
- applyRefusedBecause: status && !status.canApply ? status.applyRefusedBecause : void 0,
1676
- target: status && {
1677
- repository: status.repository,
1678
- branch: status.branch
1679
- }
1680
- })
1681
- }) : null
1682
- };
1683
- }
1684
- //#endregion
1685
- //#region src/collection_editor/useLocalCollectionsConfigController.tsx
1686
- /**
1687
- * The guess this hook used to make on its own.
1688
- *
1689
- * `process.env.NODE_ENV` here is the *frontend bundle's* build mode. Whether
1690
- * the schema editor exists is decided by a different process entirely — the
1691
- * server's own `NODE_ENV`, its `collectionsDir`, whether its collections were
1692
- * introspected, whether `ts-morph` is installed. The two disagree in every
1693
- * ordinary setup: a dev frontend against a deployed API, a `baas` project, a
1694
- * hosted console. When they did, the editor offered itself and every save came
1695
- * back `404 Not Found`. It is kept only as the answer for a backend too old to
1696
- * be asked.
1697
- */
1698
- var buildModeGuess = () => process.env.NODE_ENV === "production";
1699
- function useLocalCollectionsConfigController(clientOrUrl, baseCollections = [], options) {
1700
- const parsedCollections = baseCollections;
1701
- const optionsRef = useRef(options);
1702
- optionsRef.current = options;
1703
- const clientBaseUrl = typeof clientOrUrl === "string" ? clientOrUrl : clientOrUrl?.baseUrl ?? "";
1704
- const clientApiPath = typeof clientOrUrl === "object" && clientOrUrl !== null && clientOrUrl.apiPath || DEFAULT_API_PATH;
1705
- const editorUrl = `${String(clientBaseUrl).replace(/\/$/, "")}${clientApiPath}/schema-editor`;
1706
- const resolveToken = async () => {
1707
- let token = optionsRef.current?.getAuthToken ? await optionsRef.current.getAuthToken() : null;
1708
- if (!token && typeof clientOrUrl === "object" && clientOrUrl !== null && clientOrUrl.resolveToken) token = await clientOrUrl.resolveToken();
1709
- return token ?? null;
1710
- };
1711
- const request = async (endpoint, payload) => {
1712
- try {
1713
- const token = await resolveToken();
1714
- const headers = { "Content-Type": "application/json" };
1715
- if (token) headers["Authorization"] = `Bearer ${token}`;
1716
- const response = await fetch(`${editorUrl}${endpoint}`, {
1717
- method: "POST",
1718
- headers,
1719
- body: JSON.stringify(payload)
1720
- });
1721
- if (!response.ok) {
1722
- const text = await response.text();
1723
- let err = {};
1724
- try {
1725
- err = JSON.parse(text);
1726
- } catch (e) {}
1727
- if (Object.keys(err).length === 0) err = { message: text };
1728
- console.error("dev server error payload:", err);
1729
- const errObj = err.error;
1730
- const errMessage = typeof errObj === "object" && errObj !== null ? errObj.message : typeof errObj === "string" ? errObj : err.message;
1731
- throw new Error(errMessage || "Error communicating with local dev server");
1732
- }
1733
- } catch (e) {
1734
- console.error("fetch request failed", e);
1735
- throw e;
1736
- }
1737
- };
1738
- const forcedReadOnly = options?.readOnly;
1739
- const authKey = options?.authKey ?? null;
1740
- const [availability, setAvailability] = useState({ state: "unknown" });
1741
- useEffect(() => {
1742
- if (forcedReadOnly === true) return;
1743
- let cancelled = false;
1744
- (async () => {
1745
- try {
1746
- const token = await resolveToken();
1747
- const response = await fetch(`${editorUrl}/status`, { headers: token ? { Authorization: `Bearer ${token}` } : {} });
1748
- if (cancelled) return;
1749
- if (response.status === 404) {
1750
- setAvailability({ state: "unknown" });
1751
- return;
1752
- }
1753
- const body = await response.json().catch(() => ({}));
1754
- if (cancelled) return;
1755
- if (response.ok) setAvailability({
1756
- state: "known",
1757
- enabled: body.enabled === true,
1758
- reason: body.reason
1759
- });
1760
- else setAvailability({
1761
- state: "known",
1762
- enabled: false,
1763
- reason: body.error?.message ?? `The backend refused to say whether collections are editable (HTTP ${response.status}).`
1764
- });
1765
- } catch {
1766
- if (!cancelled) setAvailability({ state: "unknown" });
1767
- }
1768
- })();
1769
- return () => {
1770
- cancelled = true;
1771
- };
1772
- }, [
1773
- editorUrl,
1774
- forcedReadOnly,
1775
- authKey
1776
- ]);
1777
- const liveSchema = useLiveSchemaEditing({
1778
- baseUrl: `${String(clientBaseUrl).replace(/\/$/, "")}${clientApiPath}/admin/schema`,
1779
- getAuthToken: resolveToken,
1780
- authKey,
1781
- writeSourceOnly: async ({ collectionId, collection }) => {
1782
- await request("/collection/save", {
1783
- collectionId,
1784
- collectionData: collection
1785
- });
1786
- }
1787
- });
1788
- /**
1789
- * Perform a write, through the live editor when there is one.
1790
- *
1791
- * `sourceOnly` is the write this controller has always done. It stays the
1792
- * whole behaviour on a backend that cannot edit its schema — a bundle
1793
- * deployment, a non-Postgres driver, a version too old to be asked — so
1794
- * nothing about the editor depends on the feature being there.
1795
- */
1796
- const write = async (collectionId, collection, sourceOnly) => {
1797
- if (!(await liveSchema.ready()).enabled) return sourceOnly();
1798
- await liveSchema.reviewChange({
1799
- collectionId,
1800
- collection
1801
- });
1802
- };
1803
- const readOnly = forcedReadOnly ?? (availability.state === "known" ? !availability.enabled : buildModeGuess());
1804
- const readOnlyReason = availability.state === "known" && availability.reason ? availability.reason : "Collections can only be edited against a backend running the schema editor, which is off in production.";
1805
- const findCollection = (id) => parsedCollections.find((c) => c.id === id || c.slug === id);
1806
- /**
1807
- * The whole collection as it should end up.
1808
- *
1809
- * Live editing computes the proposed state by replacing one collection in
1810
- * the set, so it needs all of it: handed a patch, it would read every
1811
- * property the patch does not mention as a removal and refuse the change.
1812
- * A collection this does not recognise is a new one, and the patch is the
1813
- * whole of it.
1814
- */
1815
- const wholeCollection = (id, patch) => {
1816
- const current = findCollection(id);
1817
- return current ? {
1818
- ...current,
1819
- ...patch
1820
- } : patch;
1821
- };
1822
- return useMemo(() => ({
1823
- loading: false,
1824
- readOnly,
1825
- readOnlyReason,
1826
- collections: parsedCollections,
1827
- dialog: liveSchema.dialog,
1828
- getCollection: (id) => {
1829
- const found = findCollection(id);
1830
- if (found) return found;
1831
- throw Error(`Collection ${id} not found in local mode`);
1832
- },
1833
- saveCollection: async ({ id, collectionData }) => {
1834
- await write(id, collectionData, () => request("/collection/save", {
1835
- collectionId: id,
1836
- collectionData
1837
- }));
1838
- },
1839
- updateCollection: async ({ id, collectionData }) => {
1840
- await write(id, wholeCollection(id, collectionData), () => request("/collection/save", {
1841
- collectionId: id,
1842
- collectionData
1843
- }));
1844
- },
1845
- deleteCollection: async ({ id }) => {
1846
- await request("/collection/delete", { collectionId: id });
1847
- },
1848
- saveProperty: async ({ path, propertyKey, property, newPropertiesOrder }) => {
1849
- const properties = {
1850
- ...findCollection(path)?.properties ?? {},
1851
- [propertyKey]: property
1852
- };
1853
- const proposed = wholeCollection(path, {
1854
- properties,
1855
- ...newPropertiesOrder ? { propertiesOrder: newPropertiesOrder } : {}
1856
- });
1857
- await write(path, proposed, async () => {
1858
- await request("/property/save", {
1859
- collectionId: path,
1860
- propertyKey,
1861
- propertyConfig: property
1862
- });
1863
- if (newPropertiesOrder) await request("/collection/save", {
1864
- collectionId: path,
1865
- collectionData: { propertiesOrder: newPropertiesOrder },
1866
- partial: true
1867
- });
1868
- });
1869
- },
1870
- deleteProperty: async ({ path, propertyKey, newPropertiesOrder }) => {
1871
- await request("/property/delete", {
1872
- collectionId: path,
1873
- propertyKey
1874
- });
1875
- if (newPropertiesOrder) await request("/collection/save", {
1876
- collectionId: path,
1877
- collectionData: { propertiesOrder: newPropertiesOrder },
1878
- partial: true
1879
- });
1880
- },
1881
- updatePropertiesOrder: async ({ collection, fullPath, newPropertiesOrder }) => {
1882
- const collectionId = collection.id || fullPath.split("/").pop();
1883
- await request("/collection/save", {
1884
- collectionId,
1885
- collectionData: { propertiesOrder: newPropertiesOrder },
1886
- partial: true
1887
- });
1888
- },
1889
- updateKanbanColumnsOrder: async () => {},
1890
- navigationEntries: [],
1891
- saveNavigationEntries: async () => {}
1892
- }), [
1893
- clientOrUrl,
1894
- parsedCollections,
1895
- readOnly,
1896
- readOnlyReason,
1897
- options?.getAuthToken,
1898
- liveSchema.dialog,
1899
- liveSchema.status
1900
- ]);
1901
- }
1902
- //#endregion
1903
- //#region src/components/RebaseNavigation.tsx
1904
- var EMPTY_PLUGINS = [];
1905
- var EMPTY_COLLECTIONS = [];
1906
- var CollectionsStudioView = lazyChunk(() => import("./RouterCollectionsStudioView-ChPNl_uU.js").then((n) => n.n).then((m) => ({ default: m.RouterCollectionsStudioView })));
1907
- /**
1908
- * Navigation layer — builds and provides all admin navigation controllers:
1909
- * collection registry, URL controller, navigation state, side entity,
1910
- * and the self-assembling Studio bridge.
1911
- *
1912
- * Also handles the collection editor config controller when enabled.
1913
- *
1914
- * **Independently usable**: Use this when you need admin navigation
1915
- * (entity tables, side panels) in a custom layout.
1916
- *
1917
- * @example
1918
- * ```tsx
1919
- * <RebaseNavigation>
1920
- * <MyCustomLayout>
1921
- * <CollectionViewBinding ... />
1922
- * </MyCustomLayout>
1923
- * </RebaseNavigation>
1924
- * ```
1925
- */
1926
- function RebaseNavigation({ children }) {
1927
- const registry = useRebaseRegistry();
1928
- const context = useRebaseContext();
1929
- const adminModeController = useAdminModeController();
1930
- const userConfigPersistence = useUserConfigurationPersistence();
1931
- const collectionEditorConfig = registry.cmsConfig?.collectionEditor;
1932
- const collectionEditorEnabled = Boolean(collectionEditorConfig) || Boolean(registry.studioConfig);
1933
- const collectionEditorOptions = useMemo(() => {
1934
- if (collectionEditorConfig === true || !collectionEditorConfig) return {};
1935
- return collectionEditorConfig;
1936
- }, [collectionEditorConfig]);
1937
- const cmsCollections = registry.cmsConfig?.collections ?? EMPTY_COLLECTIONS;
1938
- const collectionsBuilder = useMemo(() => Array.isArray(cmsCollections) ? () => [...cmsCollections] : cmsCollections, [cmsCollections]);
1939
- const dataSources = useDataSources();
1940
- const collectionRegistryController = useBuildCollectionRegistryController({
1941
- userConfigPersistence,
1942
- dataSources: dataSources.registry
1943
- });
1944
- const defaultData = useData();
1945
- const getCollectionRef = useRef(collectionRegistryController.getCollection);
1946
- getCollectionRef.current = collectionRegistryController.getCollection;
1947
- useContext(CollectionResolverRegistrationContext)(useCallback((slug) => getCollectionRef.current(slug), []));
1948
- const routedData = useMemo(() => buildRoutedRebaseData({
1949
- defaultData,
1950
- sources: dataSources.sources,
1951
- resolveKey: (slugOrPath) => resolveDataSource(getCollectionRef.current(slugOrPath), dataSources.registry).key
1952
- }), [defaultData, dataSources]);
1953
- const urlController = useBuildUrlController({
1954
- basePath: useMemo(() => {
1955
- const raw = registry.cmsConfig?.basePath;
1956
- if (!raw || raw === "/") return "/";
1957
- const trimmed = raw.replace(/^\/+/, "").replace(/\/+$/, "");
1958
- return trimmed ? `/${trimmed}` : "/";
1959
- }, [registry.cmsConfig?.basePath]),
1960
- baseCollectionPath: "/c",
1961
- collectionRegistryController
1962
- });
1963
- const rebaseClient = useRebaseClient();
1964
- const authController = useAuthController();
1965
- const resolvedCollections = useMemo(() => Array.isArray(cmsCollections) ? cmsCollections : [], [cmsCollections]);
1966
- useEffect(() => {
1967
- if (process.env.NODE_ENV === "production") return;
1968
- const { registry, sources } = dataSources;
1969
- const missing = Object.values(registry).filter((d) => (d.transport === "direct" || d.transport === "custom") && !sources[d.key]).map((d) => d.key);
1970
- if (missing.length > 0) console.warn(`[Rebase] These data source(s) declare a direct/custom transport but have no client-side driver and will fall back to the default data source: ${missing.map((k) => `"${k}"`).join(", ")}. Provide a \`driver\` for them in \`dataSources\` on <Rebase>.`);
1971
- }, [dataSources]);
1972
- const internalConfigController = useLocalCollectionsConfigController(rebaseClient, resolvedCollections, collectionEditorEnabled ? {
1973
- readOnly: collectionEditorOptions?.readOnly,
1974
- getAuthToken: collectionEditorOptions?.getAuthToken ?? authController?.getAuthToken,
1975
- authKey: authController?.user?.uid ?? null
1976
- } : { readOnly: true });
1977
- const schemaView = useMemo(() => {
1978
- if (!collectionEditorEnabled) return void 0;
1979
- const studioTools = registry.studioConfig?.tools ?? [
1980
- "sql",
1981
- "js",
1982
- "rls",
1983
- "schema",
1984
- "storage"
1985
- ];
1986
- if (!registry.studioConfig || !studioTools.includes("schema")) return void 0;
1987
- return {
1988
- slug: "schema",
1989
- name: "Edit collections",
1990
- group: "Database",
1991
- icon: "LayoutList",
1992
- nestedRoutes: true,
1993
- view: /* @__PURE__ */ jsx(Suspense, {
1994
- fallback: /* @__PURE__ */ jsx(CircularProgressCenter, {}),
1995
- children: /* @__PURE__ */ jsx(CollectionsStudioViewFromContext, {})
1996
- })
1997
- };
1998
- }, [collectionEditorEnabled, registry.studioConfig]);
1999
- const devViews = useMemo(() => {
2000
- const base = registry.studioConfig?.devViews ?? [];
2001
- if (schemaView) return [...base, schemaView];
2002
- return base;
2003
- }, [registry.studioConfig?.devViews, schemaView]);
2004
- const cmsViews = registry.cmsConfig?.views;
2005
- const mergedViews = useMemo(() => {
2006
- if (!cmsViews) return devViews;
2007
- if (Array.isArray(cmsViews) && cmsViews.length === 0) return devViews;
2008
- if (typeof cmsViews === "function") return async (params) => {
2009
- return [...await cmsViews(params) ?? [], ...devViews];
2010
- };
2011
- return [...cmsViews, ...devViews];
2012
- }, [cmsViews, devViews]);
2013
- const parentCustomizationController = useCustomizationController();
2014
- const navigationStateController = useBuildNavigationStateController({
2015
- plugins: parentCustomizationController.plugins ?? EMPTY_PLUGINS,
2016
- collections: collectionsBuilder,
2017
- views: mergedViews,
2018
- navigationGroupMappings: registry.cmsConfig?.navigationGroupMappings,
2019
- authController: context.authController,
2020
- data: routedData,
2021
- collectionRegistryController,
2022
- urlController,
2023
- adminMode: adminModeController?.mode
2024
- });
2025
- const enrichedCustomizationController = useMemo(() => {
2026
- const cmsEntityViews = registry.cmsConfig?.entityViews ?? [];
2027
- const cmsEntityActions = registry.cmsConfig?.entityActions ?? [];
2028
- const cmsCollectionViews = registry.cmsConfig?.collectionViews ?? [];
2029
- if (cmsEntityViews.length === 0 && cmsEntityActions.length === 0 && cmsCollectionViews.length === 0) return parentCustomizationController;
2030
- return {
2031
- ...parentCustomizationController,
2032
- entityViews: [...parentCustomizationController.entityViews ?? [], ...cmsEntityViews.filter((v) => !(parentCustomizationController.entityViews ?? []).some((ev) => ev.key === v.key))],
2033
- entityActions: [...parentCustomizationController.entityActions ?? [], ...cmsEntityActions.filter((a) => !(parentCustomizationController.entityActions ?? []).some((ea) => ea.key === a.key))],
2034
- collectionViews: [...parentCustomizationController.collectionViews ?? [], ...cmsCollectionViews.filter((v) => !(parentCustomizationController.collectionViews ?? []).some((cv) => cv.key === v.key))]
2035
- };
2036
- }, [
2037
- parentCustomizationController,
2038
- registry.cmsConfig?.entityViews,
2039
- registry.cmsConfig?.entityActions,
2040
- registry.cmsConfig?.collectionViews
2041
- ]);
2042
- const navigationContent = /* @__PURE__ */ jsx(RebaseDataContext.Provider, {
2043
- value: routedData,
2044
- children: /* @__PURE__ */ jsx(CustomizationControllerContext.Provider, {
2045
- value: enrichedCustomizationController,
2046
- children: /* @__PURE__ */ jsx(StudioBridgeRegistryProvider, { children: /* @__PURE__ */ jsx(CollectionRegistryContext.Provider, {
2047
- value: collectionRegistryController,
2048
- children: /* @__PURE__ */ jsx(UrlContext.Provider, {
2049
- value: urlController,
2050
- children: /* @__PURE__ */ jsx(NavigationStateContext.Provider, {
2051
- value: navigationStateController,
2052
- children: /* @__PURE__ */ jsxs(SidePanelProvider, { children: [/* @__PURE__ */ jsx(BridgeAutoRegistrar, {
2053
- collectionRegistryController,
2054
- urlController,
2055
- navigationStateController,
2056
- canWriteToCodebase: !internalConfigController.readOnly
2057
- }), children] })
2058
- })
2059
- })
2060
- }) })
2061
- })
2062
- });
2063
- if (collectionEditorEnabled) return /* @__PURE__ */ jsx(ConfigControllerProvider, {
2064
- collectionConfigController: internalConfigController,
2065
- pathSuggestions: collectionEditorOptions?.pathSuggestions,
2066
- children: navigationContent
2067
- });
2068
- return navigationContent;
2069
- }
2070
- /**
2071
- * The injected "Edit collections" view, bound to the live config controller.
2072
- *
2073
- * Exists so the element stored in the navigation state does not close over a
2074
- * controller instance — see the comment at its construction site.
2075
- */
2076
- function CollectionsStudioViewFromContext() {
2077
- return /* @__PURE__ */ jsx(CollectionsStudioView, { configController: useCollectionsConfigController() });
2078
- }
2079
- /**
2080
- * Internal component that auto-registers admin controllers into the
2081
- * self-assembling Studio bridge. Must be rendered inside both the
2082
- * navigation contexts and the StudioBridgeRegistryProvider.
2083
- */
2084
- function BridgeAutoRegistrar({ collectionRegistryController, urlController, navigationStateController, canWriteToCodebase }) {
2085
- useBridgeRegistration("collectionRegistry", collectionRegistryController);
2086
- useBridgeRegistration("urlController", urlController);
2087
- useBridgeRegistration("navigationState", navigationStateController);
2088
- useBridgeRegistration("capabilities", useMemo(() => ({ codebase: canWriteToCodebase }), [canWriteToCodebase]));
2089
- return null;
2090
- }
2091
- //#endregion
2092
- //#region src/components/RebaseLayout.tsx
2093
- /**
2094
- * Layout layer — provides the Scaffold, Drawer, and SideDialogs.
2095
- *
2096
- * Wraps the route outlet with the standard Rebase admin layout.
2097
- * Override the drawer via props; pass `appBar` to add a top bar (there is
2098
- * none by default — the drawer owns navigation and user actions).
2099
- *
2100
- * **Independently usable**: Use this when you want the Rebase layout
2101
- * without its default route definitions.
2102
- *
2103
- * It takes no children: the routed view arrives through react-router's
2104
- * `<Outlet/>`. This example used to pass `<Route>` elements, which is neither
2105
- * what the component renders nor something `RebaseLayoutProps` accepts — a
2106
- * reader following it wrote a type error whose message was about `children`,
2107
- * not about routes.
2108
- *
2109
- * Hand it to `<RebaseRouteDefs layout>`, which renders the routes inside it:
2110
- *
2111
- * @example
2112
- * ```tsx
2113
- * <RebaseRouteDefs layout={<RebaseLayout title="My Admin" appBar={<AppBar/>}/>}>
2114
- * <Route path="/custom" element={<CustomView/>}/>
2115
- * </RebaseRouteDefs>
2116
- * ```
2117
- */
2118
- function RebaseLayout(props) {
2119
- const { title = "Rebase", appBar, drawer, autoOpenDrawer = true, defaultDrawerOpen = false, logo, devViews = [] } = props;
2120
- const adminModeController = useAdminModeController();
2121
- const ResolvedDrawer = useComponentOverride("Shell.Drawer", Drawer);
2122
- const ActiveDrawer = drawer ?? /* @__PURE__ */ jsx(ResolvedDrawer, {
2123
- title,
2124
- logoDestination: adminModeController.mode === "studio" ? "/s" : "/"
2125
- });
2126
- return /* @__PURE__ */ jsxs(Scaffold, {
2127
- autoOpenDrawer,
2128
- defaultDrawerOpen,
2129
- logo,
2130
- children: [
2131
- /* @__PURE__ */ jsx(AdminModeSyncer, { devViews }),
2132
- appBar,
2133
- ActiveDrawer,
2134
- /* @__PURE__ */ jsx(Outlet, {}),
2135
- /* @__PURE__ */ jsx(SideDialogs, {})
2136
- ]
2137
- });
2138
- }
2139
- //#endregion
2140
- //#region src/components/HomePage/FavouritesView.tsx
2141
- function NavigationChip({ entry }) {
2142
- const navigate = useNavigate();
2143
- const userConfigurationPersistence = useUserConfigurationPersistence();
2144
- if (!userConfigurationPersistence) return null;
2145
- const favourite = userConfigurationPersistence.favouritePaths.includes(entry.slug);
2146
- const onIconClick = (e) => {
2147
- e.preventDefault();
2148
- e.stopPropagation();
2149
- if (favourite) userConfigurationPersistence.setFavouritePaths(userConfigurationPersistence.favouritePaths.filter((p) => p !== entry.slug));
2150
- else userConfigurationPersistence.setFavouritePaths([...userConfigurationPersistence.favouritePaths, entry.slug]);
2151
- };
2152
- return /* @__PURE__ */ jsx(Chip, {
2153
- onClick: () => navigate(entry.url),
2154
- icon: /* @__PURE__ */ jsx(StarIcon, {
2155
- onClick: onIconClick,
2156
- size: iconSize.small,
2157
- className: favourite ? "text-secondary" : "text-surface-400 dark:text-surface-500"
2158
- }),
2159
- children: entry.name
2160
- }, entry.slug);
2161
- }
2162
- function FavouritesView({ hidden }) {
2163
- const navigationStateController = useNavigationStateController();
2164
- const userConfigurationPersistence = useUserConfigurationPersistence();
2165
- if (!userConfigurationPersistence) return null;
2166
- const favouriteCollections = (userConfigurationPersistence?.favouritePaths ?? []).map((path) => navigationStateController.topLevelNavigation?.navigationEntries.find((entry) => entry.slug === path)).filter(Boolean);
2167
- return /* @__PURE__ */ jsx(Collapse, {
2168
- in: favouriteCollections.length > 0,
2169
- children: /* @__PURE__ */ jsx("div", {
2170
- className: "flex flex-row flex-wrap gap-2 pb-2 min-h-[32px]",
2171
- children: favouriteCollections.map((entry) => /* @__PURE__ */ jsx(NavigationChip, { entry }, entry.slug))
2172
- })
2173
- });
2174
- }
2175
- //#endregion
2176
- //#region src/components/HomePage/NavigationGroup.tsx
2177
- function NavigationGroup({ children, group, minimised, isPreview, isPotentialCardDropTarget, onEditGroup, dndDisabled, collapsed, onToggleCollapsed }) {
2178
- const groupLabel = useNavigationGroupLabel();
2179
- const [isHovered, setIsHovered] = useState(false);
2180
- /**
2181
- * The group's *name*, which is an identifier — it is what `onEditGroup`
2182
- * renames, what the card ordering compares, and what the drawer keys its
2183
- * icons off. Never the translated heading.
2184
- */
2185
- const currentGroupName = group ?? "Views";
2186
- /**
2187
- * What the heading reads.
2188
- *
2189
- * This used to translate only the default group (`t("views_group")`) and
2190
- * render every other name raw, while the drawer used
2191
- * `useNavigationGroupLabel` — so the same three groups had two sets of
2192
- * labels on one screen: `VISTAS / DATABASE / SETTINGS` on the home page
2193
- * against `VIEWS / BASE DE DATOS / SETTINGS` in the drawer beside it. One
2194
- * lookup, in both places.
2195
- */
2196
- const currentGroupLabel = groupLabel(currentGroupName);
2197
- const showCaret = !isPreview && !!onToggleCollapsed;
2198
- const TitleContent = /* @__PURE__ */ jsxs("div", {
2199
- className: cls("flex items-center", isPreview ? "px-1 py-0.5" : ""),
2200
- children: [/* @__PURE__ */ jsx(Typography, {
2201
- variant: isPreview ? "body2" : "caption",
2202
- component: "h2",
2203
- color: "secondary",
2204
- className: cls("px-4 py-1 rounded", "font-medium text-[10px] uppercase tracking-[0.08em] text-surface-400 dark:text-surface-400"),
2205
- children: currentGroupLabel
2206
- }), !isPreview && onEditGroup && !dndDisabled && /* @__PURE__ */ jsx(IconButton, {
2207
- size: "smallest",
2208
- onClick: (e) => {
2209
- e.stopPropagation();
2210
- onEditGroup(currentGroupName);
2211
- },
2212
- className: cls("ml-2 ", isHovered ? "opacity-100" : "opacity-0", "transition-opacity duration-100"),
2213
- children: /* @__PURE__ */ jsx(PencilIcon, { size: iconSize.smallest })
2214
- })]
2215
- });
2216
- return /* @__PURE__ */ jsxs("div", {
2217
- className: cls(!isPotentialCardDropTarget ? "my-10" : "my-6", "transition-all duration-200 ease-in-out"),
2218
- children: [
2219
- isPreview && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
2220
- className: cls("flex items-center justify-between w-full", "p-4 py-2"),
2221
- onMouseEnter: () => setIsHovered(true),
2222
- onMouseLeave: () => setIsHovered(false),
2223
- children: TitleContent
2224
- }), children] }),
2225
- !isPreview && showCaret && /* @__PURE__ */ jsx(ExpandablePanel, {
2226
- invisible: true,
2227
- expanded: !collapsed,
2228
- onExpandedChange: (open) => {
2229
- if (open !== !collapsed) onToggleCollapsed?.();
2230
- },
2231
- className: cls("mt-6"),
2232
- 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-field"),
2233
- innerClassName: cls("mt-4", !minimised ? "pt-0" : ""),
2234
- title: /* @__PURE__ */ jsx("div", {
2235
- onMouseEnter: () => setIsHovered(true),
2236
- onMouseLeave: () => setIsHovered(false),
2237
- className: "flex items-center",
2238
- children: TitleContent
2239
- }),
2240
- children: minimised ? /* @__PURE__ */ jsx("div", {
2241
- className: cls("mt-4 p-8 bg-surface-raised rounded-lg"),
2242
- style: { minHeight: "50px" }
2243
- }) : /* @__PURE__ */ jsx("div", {
2244
- className: cls("mt-4", !minimised ? "pt-0" : ""),
2245
- children
2246
- })
2247
- }),
2248
- !isPreview && !showCaret && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
2249
- className: cls("flex items-center justify-between w-full", "mt-6"),
2250
- onMouseEnter: () => setIsHovered(true),
2251
- onMouseLeave: () => setIsHovered(false),
2252
- children: TitleContent
2253
- }), !collapsed && (minimised ? /* @__PURE__ */ jsx("div", {
2254
- className: cls("mt-4 p-8 bg-surface-raised rounded-lg"),
2255
- style: { minHeight: "50px" }
2256
- }) : /* @__PURE__ */ jsx("div", {
2257
- className: cls("mt-4", !minimised ? "pt-0" : ""),
2258
- children
2259
- }))] })
2260
- ]
2261
- });
2262
- }
2263
- //#endregion
2264
- //#region src/components/HomePage/NavigationCard.tsx
2265
- var NavigationCard = React.memo(function NavigationCard({ name, description, icon, actions, additionalContent, onClick, shrink }) {
2266
- return /* @__PURE__ */ jsx(Card, {
2267
- className: cls("group h-full p-4 cursor-pointer transition-colors duration-150 ease-in-out", shrink && "w-full max-w-full min-h-0 scale-75"),
2268
- onClick: () => {
2269
- onClick?.();
2270
- },
2271
- children: /* @__PURE__ */ jsxs("div", {
2272
- className: "flex flex-col h-full",
2273
- children: [
2274
- /* @__PURE__ */ jsxs("div", {
2275
- className: "flex items-center w-full justify-between mb-1",
2276
- children: [/* @__PURE__ */ jsxs("div", {
2277
- className: "flex items-center gap-3",
2278
- children: [/* @__PURE__ */ jsx("div", {
2279
- className: "flex items-center justify-center w-5 h-5 text-surface-400 dark:text-surface-500 transition-colors duration-150 group-hover:text-primary dark:group-hover:text-primary",
2280
- children: icon
2281
- }), /* @__PURE__ */ jsx(Typography, {
2282
- variant: "subtitle1",
2283
- component: "h2",
2284
- children: name
2285
- })]
2286
- }), /* @__PURE__ */ jsx("div", {
2287
- className: "flex items-center gap-0.5",
2288
- onClick: (event) => {
2289
- event.preventDefault();
2290
- event.stopPropagation();
2291
- },
2292
- children: actions
2293
- })]
2294
- }),
2295
- /* @__PURE__ */ jsx("div", {
2296
- className: "pl-8",
2297
- children: description && /* @__PURE__ */ jsx(Typography, {
2298
- variant: "caption",
2299
- color: "secondary",
2300
- component: "div",
2301
- children: /* @__PURE__ */ jsx(Markdown, {
2302
- source: description,
2303
- size: "small"
2304
- })
2305
- })
2306
- }),
2307
- additionalContent && /* @__PURE__ */ jsx("div", {
2308
- className: "pl-8 pointer-events-none",
2309
- children: additionalContent
2310
- }),
2311
- /* @__PURE__ */ jsx("div", { className: "grow" })
2312
- ]
2313
- })
2314
- });
2315
- });
2316
- //#endregion
2317
- //#region src/components/HomePage/NavigationCardBinding.tsx
2318
- /**
2319
- * This is the component used in the home page to render a card for each
2320
- * collection or view.
2321
- * @group Components
2322
- * @param view
2323
- * @param path
2324
- * @param collection
2325
- * @param url
2326
- * @param name
2327
- * @param description
2328
- * @param onClick
2329
-
2330
- */
2331
- function NavigationCardBinding({ slug, collection, view, url, name, description, onClick, type, shrink }) {
2332
- const userConfigurationPersistence = useUserConfigurationPersistence();
2333
- const collectionIcon = /* @__PURE__ */ jsx(IconForView, {
2334
- collectionOrView: collection ?? view,
2335
- size: "small"
2336
- });
2337
- const navigate = useNavigate();
2338
- const context = useRebaseContext();
2339
- const favourite = (userConfigurationPersistence?.favouritePaths ?? []).includes(slug);
2340
- const actionsArray = userConfigurationPersistence ? [/* @__PURE__ */ jsx(IconButton, {
2341
- size: "small",
2342
- onClick: (e) => {
2343
- e.preventDefault();
2344
- e.stopPropagation();
2345
- if (favourite) userConfigurationPersistence.setFavouritePaths(userConfigurationPersistence.favouritePaths.filter((p) => p !== slug));
2346
- else userConfigurationPersistence.setFavouritePaths([...userConfigurationPersistence.favouritePaths, slug]);
2347
- },
2348
- children: /* @__PURE__ */ jsx(StarIcon, { className: favourite ? "text-secondary" : "text-surface-400 dark:text-surface-500" })
2349
- }, "favourite")] : [];
2350
- const pluginCardActions = useSlot("home.collection.actions", {
2351
- slug,
2352
- collection,
2353
- context
2354
- });
2355
- const pluginCardWidgets = useSlot("home.card.widget", {
2356
- slug,
2357
- collection,
2358
- context
2359
- });
2360
- return /* @__PURE__ */ jsx(NavigationCard, {
2361
- icon: collectionIcon,
2362
- name,
2363
- description,
2364
- actions: /* @__PURE__ */ jsxs(Fragment, { children: [actionsArray, pluginCardActions] }),
2365
- additionalContent: pluginCardWidgets.length > 0 ? /* @__PURE__ */ jsx(Fragment, { children: pluginCardWidgets }) : void 0,
2366
- onClick: () => {
2367
- onClick?.();
2368
- navigate(url);
2369
- if (userConfigurationPersistence) userConfigurationPersistence.setRecentlyVisitedPaths([slug, ...(userConfigurationPersistence.recentlyVisitedPaths ?? []).filter((p) => p !== slug)]);
2370
- },
2371
- shrink
2372
- });
2373
- }
2374
- //#endregion
2375
- //#region src/components/HomePage/HomePageDnD.tsx
2376
- var animateLayoutChanges = (args) => defaultAnimateLayoutChanges({
2377
- ...args,
2378
- wasDragging: true
2379
- });
2380
- var dropAnimationConfig = {};
2381
- var cloneSerializableNavigationEntry = (entry) => {
2382
- return {
2383
- id: entry.id,
2384
- slug: entry.slug,
2385
- url: entry.url,
2386
- name: entry.name,
2387
- type: entry.type,
2388
- collection: entry.collection ? { ...entry.collection } : void 0,
2389
- view: entry.view ? { ...entry.view } : void 0,
2390
- ...entry.group && { group: entry.group },
2391
- ...entry.description && { description: entry.description }
2392
- };
2393
- };
2394
- var cloneItemsForDnd = (items) => items.map((g) => ({
2395
- name: g.name,
2396
- entries: g.entries.map(cloneSerializableNavigationEntry)
2397
- }));
2398
- /**
2399
- * dnd-kit's `attributes`, minus the `role` it assumes.
2400
- *
2401
- * The wrapper these land on contains a `<Link>` and the card's own action
2402
- * buttons, and dnd-kit's `role: "button"` therefore declared a button
2403
- * containing a link containing more buttons. Measured on a scaffold's home
2404
- * page: 17 focusables for 5 destinations, 13 of the 17 `[role=button]` nested
2405
- * inside another — which is what a screen reader has to read through before it
2406
- * reaches the collection you wanted.
2407
- *
2408
- * The rest is kept, and it is the part that carries meaning:
2409
- * `aria-roledescription="sortable"`, the instructions dnd-kit points
2410
- * `aria-describedby` at, and the `tabIndex` its keyboard sensor needs — drag
2411
- * still works from the keyboard.
2412
- *
2413
- * A dedicated drag handle is the better answer and the one dnd-kit documents;
2414
- * it needs a control designed into the card, which is a visual change and not
2415
- * this one.
2416
- */
2417
- function draggableAttributes(attributes) {
2418
- const { role: _role, ...rest } = attributes;
2419
- return rest;
2420
- }
2421
- function SortableNavigationCard({ entry, onClick }) {
2422
- const { setNodeRef, listeners, attributes, transform, transition, isDragging } = useSortable({
2423
- id: entry.url,
2424
- animateLayoutChanges
2425
- });
2426
- return /* @__PURE__ */ jsx("div", {
2427
- ref: setNodeRef,
2428
- style: {
2429
- transform: transform ? CSS.Transform.toString(transform) : void 0,
2430
- transition,
2431
- opacity: isDragging ? 0 : 1
2432
- },
2433
- ...draggableAttributes(attributes),
2434
- ...listeners,
2435
- children: /* @__PURE__ */ jsx(NavigationCardBinding, {
2436
- ...entry,
2437
- onClick
2438
- })
2439
- });
2440
- }
2441
- function NavigationGroupDroppable({ id, itemIds, children, isPotentialCardDropTarget = false }) {
2442
- const { setNodeRef } = useDroppable({ id });
2443
- return /* @__PURE__ */ jsx("div", {
2444
- ref: setNodeRef,
2445
- className: cls(isPotentialCardDropTarget ? "p-2 bg-surface-raised rounded-lg" : void 0, "transition-all duration-200 ease-in-out"),
2446
- children: /* @__PURE__ */ jsx(SortableContext, {
2447
- items: itemIds,
2448
- strategy: rectSortingStrategy,
2449
- children
2450
- })
2451
- });
2452
- }
2453
- function SortableNavigationGroup({ groupName, children, disabled }) {
2454
- const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
2455
- id: groupName,
2456
- animateLayoutChanges,
2457
- disabled
2458
- });
2459
- return /* @__PURE__ */ jsx("div", {
2460
- ref: setNodeRef,
2461
- style: {
2462
- transform: transform ? CSS.Transform.toString(transform) : void 0,
2463
- transition,
2464
- opacity: isDragging ? 0 : 1
2465
- },
2466
- ...draggableAttributes(attributes),
2467
- ...listeners,
2468
- children
2469
- });
2470
- }
2471
- function useHomePageDnd({ items, setItems, disabled, onCardMovedBetweenGroups, onGroupMoved, onNewGroupDrop, onPersist }) {
2472
- const dndItems = items;
2473
- const setDndItems = setItems;
2474
- const [activeId, setActiveId] = useState(null);
2475
- const [activeIsGroup, setActiveIsGroup] = useState(false);
2476
- const [currentDraggingGroupId, setCurrentDraggingGroupId] = useState(null);
2477
- const [dndKitActiveNode, setDndKitActiveNode] = useState(null);
2478
- const [isDraggingCardOnly, setIsDraggingCardOnly] = useState(false);
2479
- const [dialogOpenForGroup, setDialogOpenForGroup] = useState(null);
2480
- const [isHoveringNewGroupDropZone, setIsHoveringNewGroupDropZone] = useState(false);
2481
- const [pendingNewGroupName, setPendingNewGroupName] = useState(null);
2482
- const [stateBeforeNewGroup, setStateBeforeNewGroup] = useState(null);
2483
- const preDragItemsRef = useRef(null);
2484
- const interimItemsRef = useRef(null);
2485
- useEffect(() => {
2486
- interimItemsRef.current = dndItems;
2487
- }, [dndItems]);
2488
- const sensors = useSensors(useSensor(MouseSensor, { activationConstraint: { distance: 10 } }), useSensor(TouchSensor, { activationConstraint: {
2489
- delay: 150,
2490
- tolerance: 5
2491
- } }), useSensor(KeyboardSensor));
2492
- const dndContainers = dndItems.map((g) => g.name);
2493
- const findDndContainer = useCallback((id) => {
2494
- if (!id) return void 0;
2495
- const group = dndItems.find((g) => g.name === id);
2496
- if (group) return group.name;
2497
- for (const g of dndItems) if (g.entries.some((e) => e.url === id)) return g.name;
2498
- }, [dndItems]);
2499
- const lastOverId = useRef(null);
2500
- const recentlyMovedToNewContainer = useRef(false);
2501
- const collisionDetection = useCallback((args) => {
2502
- if (disabled || !activeId) return [];
2503
- if (activeIsGroup) {
2504
- const groups = args.droppableContainers.filter((c) => dndItems.some((g) => g.name === c.id));
2505
- if (!groups.length) return [];
2506
- return closestCenter({
2507
- ...args,
2508
- droppableContainers: groups
2509
- });
2510
- }
2511
- const pointer = pointerWithin(args);
2512
- if (pointer.length) {
2513
- const zone = pointer.find((c) => c.id === "new-group-drop-zone");
2514
- if (zone) return [zone];
2515
- const container = pointer.find((c) => dndItems.some((g) => g.name === c.id));
2516
- if (container) {
2517
- const itemsIn = dndItems.find((g) => g.name === container.id)?.entries;
2518
- if (itemsIn?.length) {
2519
- const closest = closestCorners({
2520
- ...args,
2521
- droppableContainers: args.droppableContainers.filter((c) => itemsIn.some((e) => e.url === c.id))
2522
- });
2523
- if (closest.length) return closest;
2524
- }
2525
- return [container];
2526
- }
2527
- const first = getFirstCollision(pointer, "id");
2528
- if (first) return [{ id: first }];
2529
- }
2530
- const rects = rectIntersection(args);
2531
- const zoneRect = rects.find((c) => c.id === "new-group-drop-zone");
2532
- if (zoneRect) return [zoneRect];
2533
- let overId = getFirstCollision(rects, "id");
2534
- if (overId != null) {
2535
- if (dndItems.some((g) => g.name === overId)) {
2536
- const itemsIn = dndItems.find((g) => g.name === overId)?.entries;
2537
- if (itemsIn?.length) {
2538
- const closestItem = closestCorners({
2539
- ...args,
2540
- droppableContainers: args.droppableContainers.filter((c) => itemsIn.some((e) => e.url === c.id))
2541
- })[0]?.id;
2542
- if (closestItem) overId = closestItem;
2543
- }
2544
- }
2545
- lastOverId.current = overId;
2546
- return [{ id: overId }];
2547
- }
2548
- if (recentlyMovedToNewContainer.current && lastOverId.current && !activeIsGroup) return [{ id: lastOverId.current }];
2549
- return [];
2550
- }, [
2551
- activeId,
2552
- dndItems,
2553
- disabled,
2554
- activeIsGroup
2555
- ]);
2556
- const handleDragStart = ({ active }) => {
2557
- setDndKitActiveNode(active);
2558
- if (disabled) return;
2559
- preDragItemsRef.current = cloneItemsForDnd(dndItems);
2560
- const isGroup = dndItems.some((g) => g.name === active.id);
2561
- if (!active.data.current) active.data.current = {};
2562
- active.data.current.type = isGroup ? "group" : "item";
2563
- setActiveId(active.id);
2564
- setActiveIsGroup(isGroup);
2565
- setIsDraggingCardOnly(!isGroup);
2566
- if (isGroup) setCurrentDraggingGroupId(active.id);
2567
- recentlyMovedToNewContainer.current = false;
2568
- };
2569
- const handleDragOver = ({ active, over }) => {
2570
- if (disabled || !over) return;
2571
- const activeIdNow = active.id;
2572
- const overIdNow = over.id;
2573
- if (activeIdNow === overIdNow) return;
2574
- if (activeIsGroup) return;
2575
- const activeCont = findDndContainer(activeIdNow);
2576
- const overCont = findDndContainer(overIdNow);
2577
- if (!activeCont) return;
2578
- if (overCont && activeCont !== overCont) {
2579
- recentlyMovedToNewContainer.current = true;
2580
- lastOverId.current = overIdNow;
2581
- setDndItems((current) => {
2582
- const newState = cloneItemsForDnd(current);
2583
- const srcIdx = newState.findIndex((g) => g.name === activeCont);
2584
- const tgtIdx = newState.findIndex((g) => g.name === overCont);
2585
- if (srcIdx === -1 || tgtIdx === -1) return current;
2586
- const src = newState[srcIdx];
2587
- const tgt = newState[tgtIdx];
2588
- const idxInSrc = src.entries.findIndex((e) => e.url === activeIdNow);
2589
- if (idxInSrc === -1) return current;
2590
- const [moved] = src.entries.splice(idxInSrc, 1);
2591
- if (overIdNow === overCont) tgt.entries.push(moved);
2592
- else {
2593
- const overIdx = tgt.entries.findIndex((e) => e.url === overIdNow);
2594
- if (overIdx !== -1) tgt.entries.splice(overIdx, 0, moved);
2595
- else tgt.entries.push(moved);
2596
- }
2597
- return newState;
2598
- });
2599
- } else if (activeCont === overCont) recentlyMovedToNewContainer.current = false;
2600
- };
2601
- const handleDragEnd = ({ active, over }) => {
2602
- if (disabled || !over) {
2603
- resetDragState();
2604
- return;
2605
- }
2606
- const activeIdNow = active.id;
2607
- const overIdNow = over.id;
2608
- if (activeIsGroup) {
2609
- if (activeIdNow !== overIdNow && dndItems.some((g) => g.name === overIdNow)) {
2610
- const from = dndItems.findIndex((g) => g.name === activeIdNow);
2611
- const to = dndItems.findIndex((g) => g.name === overIdNow);
2612
- if (from !== -1 && to !== -1) {
2613
- const newState = arrayMove(dndItems, from, to);
2614
- setDndItems(newState);
2615
- onPersist?.(newState);
2616
- onGroupMoved?.(activeIdNow, from, to);
2617
- }
2618
- }
2619
- } else {
2620
- const findContainerInState = (id, state) => {
2621
- const group = state.find((g) => g.name === id);
2622
- if (group) return group.name;
2623
- for (const g of state) if (g.entries.some((e) => e.url === id)) return g.name;
2624
- };
2625
- const sourceState = preDragItemsRef.current || dndItems;
2626
- const activeCont = findContainerInState(activeIdNow, sourceState);
2627
- findDndContainer(overIdNow);
2628
- if (overIdNow === "new-group-drop-zone") {
2629
- if (activeCont) {
2630
- setStateBeforeNewGroup(cloneItemsForDnd(dndItems));
2631
- const newState = cloneItemsForDnd(dndItems);
2632
- const srcIdx = newState.findIndex((g) => g.name === activeCont);
2633
- if (srcIdx !== -1) {
2634
- const src = newState[srcIdx];
2635
- const idxInSrc = src.entries.findIndex((e) => e.url === activeIdNow);
2636
- if (idxInSrc !== -1) {
2637
- const [dragged] = src.entries.splice(idxInSrc, 1);
2638
- if (src.entries.length === 0) newState.splice(srcIdx, 1);
2639
- let tentative = "New Group";
2640
- let counter = 1;
2641
- while (newState.some((g) => g.name === tentative)) tentative = `New Group ${counter++}`;
2642
- newState.push({
2643
- name: tentative,
2644
- entries: [dragged]
2645
- });
2646
- setDndItems(newState);
2647
- setPendingNewGroupName(tentative);
2648
- setDialogOpenForGroup(tentative);
2649
- onNewGroupDrop?.();
2650
- }
2651
- }
2652
- }
2653
- } else {
2654
- const overCont = findDndContainer(overIdNow);
2655
- if (activeCont === overCont) {
2656
- const grpIdx = dndItems.findIndex((g) => g.name === activeCont);
2657
- if (grpIdx !== -1) {
2658
- const group = dndItems[grpIdx];
2659
- const oldIdx = group.entries.findIndex((e) => e.url === activeIdNow);
2660
- let newIdx = group.entries.findIndex((e) => e.url === overIdNow);
2661
- if (newIdx === -1 && overIdNow === activeCont) newIdx = group.entries.length - 1;
2662
- if (oldIdx !== -1 && newIdx !== -1 && oldIdx !== newIdx) {
2663
- const reordered = arrayMove(group.entries, oldIdx, newIdx);
2664
- const newState = [...dndItems];
2665
- newState[grpIdx] = {
2666
- ...group,
2667
- entries: reordered
2668
- };
2669
- setDndItems(newState);
2670
- onPersist?.(newState);
2671
- }
2672
- }
2673
- } else if (overCont && activeCont !== overCont) {
2674
- const finalState = cloneItemsForDnd(sourceState);
2675
- const finalOverId = lastOverId.current || overIdNow;
2676
- const cleanOverCont = findContainerInState(finalOverId, sourceState) || overCont;
2677
- const srcIdx = finalState.findIndex((g) => g.name === activeCont);
2678
- const tgtIdx = finalState.findIndex((g) => g.name === cleanOverCont);
2679
- if (srcIdx !== -1 && tgtIdx !== -1) {
2680
- const src = finalState[srcIdx];
2681
- const tgt = finalState[tgtIdx];
2682
- const idxInSrc = src.entries.findIndex((e) => e.url === activeIdNow);
2683
- if (idxInSrc !== -1) {
2684
- const [moved] = src.entries.splice(idxInSrc, 1);
2685
- if (finalOverId === cleanOverCont) tgt.entries.push(moved);
2686
- else {
2687
- const overIdx = tgt.entries.findIndex((e) => e.url === finalOverId);
2688
- if (overIdx !== -1) tgt.entries.splice(overIdx, 0, moved);
2689
- else tgt.entries.push(moved);
2690
- }
2691
- if (src.entries.length === 0) finalState.splice(srcIdx, 1);
2692
- setDndItems(finalState);
2693
- onPersist?.(finalState);
2694
- onCardMovedBetweenGroups?.(moved);
2695
- }
2696
- }
2697
- } else if (recentlyMovedToNewContainer.current) console.error("Move between containers detected but conditions not met", {
2698
- activeCont,
2699
- overCont,
2700
- activeIdNow,
2701
- overIdNow
2702
- });
2703
- }
2704
- }
2705
- resetDragState();
2706
- };
2707
- const resetDragState = () => {
2708
- setDndKitActiveNode(null);
2709
- setActiveId(null);
2710
- setActiveIsGroup(false);
2711
- setCurrentDraggingGroupId(null);
2712
- setIsDraggingCardOnly(false);
2713
- recentlyMovedToNewContainer.current = false;
2714
- };
2715
- const handleDragCancel = () => resetDragState();
2716
- const handleRenameGroup = (oldName, newName) => {
2717
- setDndItems((current) => {
2718
- const idx = current.findIndex((g) => g.name === oldName);
2719
- if (idx === -1) return current;
2720
- if (current.some((g) => g.name === newName && g.name !== oldName)) return current;
2721
- const updated = [...current];
2722
- updated[idx] = {
2723
- ...updated[idx],
2724
- name: newName
2725
- };
2726
- onPersist?.(updated);
2727
- return updated;
2728
- });
2729
- setPendingNewGroupName(null);
2730
- setStateBeforeNewGroup(null);
2731
- setDialogOpenForGroup(null);
2732
- };
2733
- const handleDialogClose = () => {
2734
- if (pendingNewGroupName && dialogOpenForGroup === pendingNewGroupName && stateBeforeNewGroup) setDndItems(stateBeforeNewGroup);
2735
- setPendingNewGroupName(null);
2736
- setStateBeforeNewGroup(null);
2737
- setDialogOpenForGroup(null);
2738
- };
2739
- return {
2740
- sensors,
2741
- collisionDetection,
2742
- onDragStart: handleDragStart,
2743
- onDragOver: handleDragOver,
2744
- onDragEnd: handleDragEnd,
2745
- onDragCancel: handleDragCancel,
2746
- dropAnimation: dropAnimationConfig,
2747
- activeItemForOverlay: disabled || !activeId || activeIsGroup ? null : dndItems.flatMap((g) => g.entries).find((e) => e.url === activeId) || null,
2748
- activeGroupData: disabled || !activeId || !activeIsGroup ? null : dndItems.find((g) => g.name === activeId) || null,
2749
- draggingGroupId: currentDraggingGroupId,
2750
- containers: dndContainers,
2751
- dndKitActiveNode,
2752
- isDraggingCardOnly,
2753
- dialogOpenForGroup,
2754
- setDialogOpenForGroup,
2755
- handleRenameGroup,
2756
- handleDialogClose,
2757
- isHoveringNewGroupDropZone,
2758
- setIsHoveringNewGroupDropZone
2759
- };
2760
- }
2761
- function NewGroupDropZone({ disabled, setIsHovering }) {
2762
- const { setNodeRef, isOver } = useDroppable({
2763
- id: "new-group-drop-zone",
2764
- disabled
2765
- });
2766
- const [isVisible, setIsVisible] = useState(false);
2767
- useDndMonitor({
2768
- onDragStart({ active }) {
2769
- if (disabled) return;
2770
- const tp = active.data.current?.type;
2771
- setIsVisible(tp === "item");
2772
- },
2773
- onDragEnd() {
2774
- setIsVisible(false);
2775
- },
2776
- onDragCancel() {
2777
- setIsVisible(false);
2778
- }
2779
- });
2780
- useEffect(() => {
2781
- setIsHovering(isOver && isVisible);
2782
- }, [
2783
- isOver,
2784
- isVisible,
2785
- setIsHovering
2786
- ]);
2787
- if (!isVisible || disabled) return null;
2788
- return /* @__PURE__ */ jsx("div", {
2789
- ref: setNodeRef,
2790
- className: 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", isOver ? "bg-surface-raised border-hairline-strong" : "bg-surface-card border-hairline-strong"),
2791
- children: /* @__PURE__ */ jsx("div", {
2792
- className: "text-center p-4",
2793
- children: /* @__PURE__ */ jsx("span", {
2794
- className: "block font-medium text-sm",
2795
- children: "Drop here to create a new group"
2796
- })
2797
- })
2798
- });
2799
- }
2800
- //#endregion
2801
- //#region src/components/HomePage/RenameGroupDialog.tsx
2802
- function RenameGroupDialog({ open, initialName, existingGroupNames, onClose, onRename }) {
2803
- const { t } = useTranslation();
2804
- const [name, setName] = useState(initialName);
2805
- const [error, setError] = useState(null);
2806
- const inputRef = useRef(null);
2807
- useEffect(() => {
2808
- if (open) {
2809
- setName(initialName);
2810
- setError(null);
2811
- setTimeout(() => {
2812
- if (inputRef.current) {
2813
- inputRef.current.focus();
2814
- inputRef.current.select();
2815
- }
2816
- }, 100);
2817
- }
2818
- }, [initialName, open]);
2819
- const handleNameChange = (event) => {
2820
- const newName = event.target.value;
2821
- setName(newName);
2822
- if (!newName.trim()) setError(t("group_name_empty_error"));
2823
- else if (existingGroupNames.includes(newName.trim())) setError(t("group_name_exists_error"));
2824
- else setError(null);
2825
- };
2826
- const handleSave = () => {
2827
- const trimmedName = name.trim();
2828
- if (!trimmedName) {
2829
- setError(t("group_name_empty_error"));
2830
- return;
2831
- }
2832
- if (existingGroupNames.includes(trimmedName)) {
2833
- setError(t("group_name_exists_error"));
2834
- return;
2835
- }
2836
- if (!error) {
2837
- onRename(trimmedName);
2838
- onClose();
2839
- }
2840
- };
2841
- const handleKeyDown = (event) => {
2842
- if (event.key === "Enter") {
2843
- event.preventDefault();
2844
- const trimmedName = name.trim();
2845
- let currentError = null;
2846
- if (!trimmedName) currentError = t("group_name_empty_error");
2847
- else if (existingGroupNames.includes(trimmedName)) currentError = t("group_name_exists_error");
2848
- if (!currentError && trimmedName) handleSave();
2849
- else if (currentError) setError(currentError);
2850
- }
2851
- };
2852
- if (!open) return null;
2853
- return /* @__PURE__ */ jsxs(Dialog, {
2854
- open,
2855
- children: [
2856
- /* @__PURE__ */ jsx(DialogTitle, { children: t("rename_group") }),
2857
- /* @__PURE__ */ jsxs(DialogContent, { children: [/* @__PURE__ */ jsx(TextField, {
2858
- inputRef,
2859
- label: t("group_name_label"),
2860
- value: name,
2861
- onChange: handleNameChange,
2862
- onKeyDown: handleKeyDown,
2863
- error: !!error,
2864
- "aria-describedby": error ? "group-name-error" : void 0
2865
- }), error && /* @__PURE__ */ jsx("p", {
2866
- id: "group-name-error",
2867
- style: { display: "none" },
2868
- children: error
2869
- })] }),
2870
- /* @__PURE__ */ jsxs(DialogActions, { children: [/* @__PURE__ */ jsx(Button, {
2871
- onClick: onClose,
2872
- variant: "text",
2873
- children: t("cancel")
2874
- }), /* @__PURE__ */ jsx(Button, {
2875
- onClick: handleSave,
2876
- disabled: !!error || !name.trim(),
2877
- children: t("save")
2878
- })] })
2879
- ]
2880
- });
2881
- }
2882
- //#endregion
2883
- //#region src/components/HomePage/ContentHomePage.tsx
2884
- var DEFAULT_GROUP_NAME = "Views";
2885
- var ADMIN_GROUP_NAME = "Admin";
2886
- function ContentHomePage({ additionalActions, additionalChildrenStart, additionalChildrenEnd, sections, hiddenGroups }) {
2887
- const context = useAdminContext();
2888
- const { navigationStateController } = context;
2889
- const customizationController = useCustomizationController();
2890
- const adminModeController = useAdminModeController();
2891
- const registry = useRebaseRegistry();
2892
- const { resolvedSlots } = customizationController;
2893
- const breadcrumbs = useBreadcrumbsController();
2894
- const { t } = useTranslation();
2895
- useEffect(() => {
2896
- breadcrumbs.set({ breadcrumbs: [] });
2897
- }, [breadcrumbs.set]);
2898
- const { allowDragAndDrop = false, navigationEntries: unFilteredNavigationEntries = [], groups: unFilteredGroupOrder = [], onNavigationEntriesUpdate = () => {} } = navigationStateController.topLevelNavigation || {};
2899
- const studioViewSlugs = useMemo(() => {
2900
- const slugs = /* @__PURE__ */ new Set();
2901
- (registry.studioConfig?.devViews ?? []).forEach((v) => slugs.add(v.slug));
2902
- if (registry.studioConfig && registry.cmsConfig?.collectionEditor) slugs.add("schema");
2903
- return slugs;
2904
- }, [registry.studioConfig, registry.cmsConfig?.collectionEditor]);
2905
- const rawNavigationEntries = useMemo(() => {
2906
- if (adminModeController.mode === "studio") return unFilteredNavigationEntries.filter((e) => e.type === "view" && studioViewSlugs.has(e.slug) || e.type === "admin");
2907
- return unFilteredNavigationEntries.filter((e) => e.type !== "view" || !studioViewSlugs.has(e.slug));
2908
- }, [
2909
- unFilteredNavigationEntries,
2910
- adminModeController.mode,
2911
- studioViewSlugs
2912
- ]);
2913
- const groupOrderFromNavController = useMemo(() => {
2914
- const entryGroups = new Set(rawNavigationEntries.map((e) => e.group).filter(Boolean));
2915
- return unFilteredGroupOrder.filter((g) => entryGroups.has(g));
2916
- }, [unFilteredGroupOrder, rawNavigationEntries]);
2917
- const fuse = useRef(null);
2918
- const [filteredUrls, setFilteredUrls] = useState(null);
2919
- const performingSearch = Boolean(filteredUrls);
2920
- const filteredNavigationEntries = useMemo(() => {
2921
- return filteredUrls ? rawNavigationEntries.filter((e) => filteredUrls.includes(e.url)) : rawNavigationEntries;
2922
- }, [filteredUrls, rawNavigationEntries]);
2923
- useEffect(() => {
2924
- fuse.current = new Fuse(rawNavigationEntries, { keys: [
2925
- "name",
2926
- "description",
2927
- "group",
2928
- "path"
2929
- ] });
2930
- }, [rawNavigationEntries]);
2931
- const updateSearch = useCallback((v) => {
2932
- if (!v?.trim()) {
2933
- setFilteredUrls(null);
2934
- return;
2935
- }
2936
- const results = fuse.current?.search(v.trim());
2937
- setFilteredUrls(results ? results.map((x) => x.item.url) : []);
2938
- }, []);
2939
- const [items, setItems] = useState([]);
2940
- const [adminGroupData, setAdminGroupData] = useState(null);
2941
- const isDndDirtyRef = useRef(false);
2942
- const dndDirtyTimeoutRef = useRef(null);
2943
- const processedGroups = useMemo(() => {
2944
- const src = filteredNavigationEntries;
2945
- const entriesByGroup = {};
2946
- src.forEach((e) => {
2947
- const g = e.type === "admin" ? ADMIN_GROUP_NAME : e.group ?? "Views";
2948
- (entriesByGroup[g] ??= []).push(e);
2949
- });
2950
- const hasPluginAdditionalCards = customizationController.resolvedSlots.some((s) => s.slot === "home.cards");
2951
- let allProcessed;
2952
- if (performingSearch) allProcessed = [...new Set(src.map((e) => e.group ?? "Views"))].map((name) => ({
2953
- name,
2954
- entries: entriesByGroup[name] || []
2955
- })).filter((g) => g.entries.length);
2956
- else {
2957
- allProcessed = groupOrderFromNavController.map((g) => ({
2958
- name: g,
2959
- entries: entriesByGroup[g] || []
2960
- }));
2961
- Object.keys(entriesByGroup).forEach((g) => {
2962
- if (!groupOrderFromNavController.includes(g)) allProcessed.push({
2963
- name: g,
2964
- entries: entriesByGroup[g]
2965
- });
2966
- });
2967
- if (hasPluginAdditionalCards && !allProcessed.some((g) => g.name === "Views")) allProcessed.push({
2968
- name: DEFAULT_GROUP_NAME,
2969
- entries: []
2970
- });
2971
- allProcessed = allProcessed.filter((g) => g.entries.length || g.name === "Views" && hasPluginAdditionalCards);
2972
- }
2973
- return {
2974
- adminGroupData: allProcessed.find((g) => g.name === "Admin") || null,
2975
- items: allProcessed.filter((g) => g.name !== "Admin" && !hiddenGroups?.includes(g.name))
2976
- };
2977
- }, [
2978
- filteredNavigationEntries,
2979
- performingSearch,
2980
- groupOrderFromNavController,
2981
- customizationController.resolvedSlots,
2982
- hiddenGroups
2983
- ]);
2984
- useEffect(() => {
2985
- if (isDndDirtyRef.current) return;
2986
- setAdminGroupData(processedGroups.adminGroupData);
2987
- setItems(processedGroups.items);
2988
- }, [processedGroups]);
2989
- const updateItems = (updater) => {
2990
- setItems(updater);
2991
- };
2992
- const persistNavigationGroups = (latest) => {
2993
- isDndDirtyRef.current = true;
2994
- if (dndDirtyTimeoutRef.current) clearTimeout(dndDirtyTimeoutRef.current);
2995
- dndDirtyTimeoutRef.current = setTimeout(() => {
2996
- isDndDirtyRef.current = false;
2997
- }, 1e3);
2998
- const draggable = latest.map((g) => ({
2999
- name: g.name,
3000
- entries: g.entries.map((e) => e.slug)
3001
- }));
3002
- const all = adminGroupData ? [...draggable, {
3003
- name: adminGroupData.name,
3004
- entries: adminGroupData.entries.map((e) => e.slug)
3005
- }] : draggable;
3006
- onNavigationEntriesUpdate(all);
3007
- };
3008
- const { isGroupCollapsed, toggleGroupCollapsed } = useCollapsedGroups(useMemo(() => [...items.map((item) => item.name), ...adminGroupData ? [adminGroupData.name] : []], [items, adminGroupData]), "home", useMemo(() => buildCollapsedDefaults(registry.cmsConfig?.navigationGroupMappings, "home"), [registry.cmsConfig?.navigationGroupMappings]));
3009
- const { sensors, collisionDetection, onDragStart, onDragOver, onDragEnd, dropAnimation, activeItemForOverlay, activeGroupData, draggingGroupId, containers, dndKitActiveNode, onDragCancel, isDraggingCardOnly, dialogOpenForGroup, setDialogOpenForGroup, handleRenameGroup, handleDialogClose, isHoveringNewGroupDropZone, setIsHoveringNewGroupDropZone } = useHomePageDnd({
3010
- items,
3011
- setItems: updateItems,
3012
- disabled: !allowDragAndDrop || performingSearch,
3013
- onPersist: persistNavigationGroups,
3014
- onGroupMoved: (g) => context.analyticsController?.onAnalyticsEvent?.("home_move_group", { name: g }),
3015
- onCardMovedBetweenGroups: (card) => context.analyticsController?.onAnalyticsEvent?.("home_move_card", { id: card.id }),
3016
- onNewGroupDrop: () => context.analyticsController?.onAnalyticsEvent?.("home_drop_new_group")
3017
- });
3018
- const { containerRef, direction } = useRestoreScroll();
3019
- const dndDisabled = !allowDragAndDrop || performingSearch;
3020
- const dndModifiers = dndKitActiveNode?.data.current?.type === "group" ? [restrictToVerticalAxis, restrictToWindowEdges] : [restrictToWindowEdges];
3021
- const sectionProps = { context };
3022
- const additionalPluginChildrenStart = useSlot("home.children.start", sectionProps);
3023
- const additionalPluginChildrenEnd = useSlot("home.children.end", sectionProps);
3024
- const additionalPluginActions = useSlot("home.actions", sectionProps);
3025
- const homeCardContributions = useMemo(() => {
3026
- return resolvedSlots.filter((s) => s.slot === "home.cards").sort((a, b) => (a.order ?? 50) - (b.order ?? 50));
3027
- }, [resolvedSlots]);
3028
- return /* @__PURE__ */ jsxs("div", {
3029
- ref: containerRef,
3030
- className: "py-2 overflow-auto h-full w-full bg-surface-sheet",
3031
- children: [/* @__PURE__ */ jsxs(Container, {
3032
- maxWidth: "6xl",
3033
- children: [
3034
- /* @__PURE__ */ jsx("div", {
3035
- className: "mb-4 flex flex-col gap-2",
3036
- children: /* @__PURE__ */ jsx(SchemaDriftBanner, {})
3037
- }),
3038
- /* @__PURE__ */ jsxs("div", {
3039
- className: "w-full sticky py-4 transition-all duration-400 ease-in-out top-0 z-10 flex flex-row gap-4",
3040
- style: { top: direction === "down" ? -84 : 0 },
3041
- children: [
3042
- /* @__PURE__ */ jsx(SearchBar, {
3043
- onTextSearch: updateSearch,
3044
- placeholder: t("search_collections"),
3045
- autoFocus: true,
3046
- size: "small",
3047
- innerClassName: "w-full",
3048
- className: "w-full grow"
3049
- }),
3050
- additionalActions,
3051
- additionalPluginActions
3052
- ]
3053
- }),
3054
- /* @__PURE__ */ jsx(FavouritesView, { hidden: performingSearch }),
3055
- additionalChildrenStart,
3056
- additionalPluginChildrenStart,
3057
- /* @__PURE__ */ jsxs(DndContext, {
3058
- sensors,
3059
- collisionDetection,
3060
- measuring: { droppable: {
3061
- strategy: MeasuringStrategy.Always,
3062
- frequency: 500
3063
- } },
3064
- onDragStart,
3065
- onDragOver,
3066
- onDragEnd,
3067
- onDragCancel,
3068
- modifiers: dndModifiers,
3069
- children: [
3070
- /* @__PURE__ */ jsx(SortableContext, {
3071
- items: containers,
3072
- strategy: verticalListSortingStrategy,
3073
- children: items.map((groupData, groupIndex) => {
3074
- const groupKey = groupData.name;
3075
- const entriesInGroup = groupData.entries;
3076
- const homeCardsProps = {
3077
- group: groupKey === "Views" ? void 0 : groupKey,
3078
- context
3079
- };
3080
- const additionalCards = homeCardContributions.map((s, i) => /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(s.Component, {
3081
- ...homeCardsProps,
3082
- ...s.props ?? {}
3083
- }) }, `home_cards_${groupKey}_${i}`));
3084
- if (entriesInGroup.length === 0 && (additionalCards.length === 0 || performingSearch)) return null;
3085
- return /* @__PURE__ */ jsx(SortableNavigationGroup, {
3086
- groupName: groupKey,
3087
- disabled: dndDisabled,
3088
- children: /* @__PURE__ */ jsx(NavigationGroup, {
3089
- group: groupKey === "Views" ? void 0 : groupKey,
3090
- minimised: draggingGroupId === groupKey && !isDraggingCardOnly,
3091
- isPotentialCardDropTarget: isDraggingCardOnly,
3092
- dndDisabled,
3093
- onEditGroup: () => {
3094
- if (dndDisabled) return;
3095
- setDialogOpenForGroup(groupKey);
3096
- },
3097
- collapsed: isGroupCollapsed(groupKey),
3098
- onToggleCollapsed: () => toggleGroupCollapsed(groupKey),
3099
- children: /* @__PURE__ */ jsx(NavigationGroupDroppable, {
3100
- id: groupKey,
3101
- itemIds: entriesInGroup.map((e) => e.url),
3102
- isPotentialCardDropTarget: isDraggingCardOnly,
3103
- children: /* @__PURE__ */ jsxs("div", {
3104
- className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 ",
3105
- children: [entriesInGroup.map((entry) => /* @__PURE__ */ jsx(SortableNavigationCard, {
3106
- entry,
3107
- onClick: () => {
3108
- let event = "unmapped_event";
3109
- if (entry.type === "collection") event = "home_navigate_to_collection";
3110
- else if (entry.type === "view") event = "home_navigate_to_view";
3111
- else if (entry.type === "admin") event = "home_navigate_to_admin_view";
3112
- context.analyticsController?.onAnalyticsEvent?.(event, { path: entry.slug });
3113
- }
3114
- }, entry.url)), !performingSearch && groupKey.toLowerCase() !== "Admin".toLowerCase() && additionalCards]
3115
- })
3116
- })
3117
- })
3118
- }, `group-${groupIndex}`);
3119
- })
3120
- }, containers.join(",")),
3121
- /* @__PURE__ */ jsx(NewGroupDropZone, {
3122
- disabled: dndDisabled,
3123
- setIsHovering: setIsHoveringNewGroupDropZone
3124
- }),
3125
- /* @__PURE__ */ jsx(DragOverlay, {
3126
- adjustScale: false,
3127
- dropAnimation,
3128
- children: activeGroupData && draggingGroupId === activeGroupData.name ? /* @__PURE__ */ jsx("div", {
3129
- className: "rounded-lg bg-transparent",
3130
- style: {
3131
- padding: 0,
3132
- margin: 0
3133
- },
3134
- children: /* @__PURE__ */ jsx(NavigationGroup, {
3135
- group: activeGroupData.name === "Views" ? void 0 : activeGroupData.name,
3136
- isPreview: false,
3137
- minimised: true
3138
- })
3139
- }) : activeItemForOverlay ? /* @__PURE__ */ jsx(NavigationCardBinding, {
3140
- ...activeItemForOverlay,
3141
- shrink: isHoveringNewGroupDropZone
3142
- }) : null
3143
- })
3144
- ]
3145
- }),
3146
- !performingSearch && adminGroupData && /* @__PURE__ */ jsx(NavigationGroup, {
3147
- group: adminGroupData.name,
3148
- collapsed: isGroupCollapsed(adminGroupData.name),
3149
- onToggleCollapsed: () => toggleGroupCollapsed(adminGroupData.name),
3150
- children: /* @__PURE__ */ jsx("div", {
3151
- className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 ",
3152
- children: adminGroupData.entries.map((entry) => /* @__PURE__ */ jsx(NavigationCardBinding, {
3153
- ...entry,
3154
- onClick: () => {
3155
- let event = "unmapped_event";
3156
- if (entry.type === "collection") event = "home_navigate_to_collection";
3157
- else if (entry.type === "view") event = "home_navigate_to_view";
3158
- else if (entry.type === "admin") event = "home_navigate_to_admin_view";
3159
- context.analyticsController?.onAnalyticsEvent?.(event, { path: entry.slug });
3160
- }
3161
- }, entry.url))
3162
- })
3163
- }),
3164
- sections && sections.map((section) => /* @__PURE__ */ jsx(NavigationGroup, {
3165
- group: section.title,
3166
- children: section.children
3167
- }, section.key)),
3168
- additionalPluginChildrenEnd,
3169
- additionalChildrenEnd
3170
- ]
3171
- }), dialogOpenForGroup && /* @__PURE__ */ jsx(RenameGroupDialog, {
3172
- open: true,
3173
- initialName: dialogOpenForGroup,
3174
- existingGroupNames: items.map((g) => g.name).filter((n) => n !== dialogOpenForGroup),
3175
- onClose: handleDialogClose,
3176
- onRename: (newName) => {
3177
- handleRenameGroup(dialogOpenForGroup, newName);
3178
- }
3179
- })]
3180
- });
3181
- }
3182
- //#endregion
3183
- //#region src/components/CollectionEditorDialogs.tsx
3184
- var CollectionEditorDialog = lazyChunk(() => import("./CollectionEditorDialog-DLHCka00.js").then((n) => n.r).then((m) => ({ default: m.CollectionEditorDialog })));
3185
- var PropertyFormDialog = lazyChunk(() => import("./PropertyEditView-_pu5hzZn.js").then((n) => n.t).then((m) => ({ default: m.PropertyFormDialog })));
3186
- /**
3187
- * Renders the CollectionEditorDialog and PropertyFormDialog inside
3188
- * the RebaseShell tree where admin-internal contexts
3189
- * (CollectionRegistryContext, NavigationStateContext, UrlContext)
3190
- * are available.
3191
- *
3192
- * Both dialog components are loaded dynamically via React.lazy so that
3193
- * production admin bundles that never open the collection editor don't pay
3194
- * the download/parse cost up-front.
3195
- *
3196
- * The dialog state (open/close, props) is managed by ConfigControllerProvider
3197
- * (a root-scope plugin provider that wraps the shell) and exposed via
3198
- * CollectionEditorDialogsContext.
3199
- */
3200
- function CollectionEditorDialogs() {
3201
- const state = useCollectionEditorDialogsState();
3202
- if (!state) return null;
3203
- const { collectionDialogProps, propertyDialogProps } = state;
3204
- if (!(collectionDialogProps?.open || propertyDialogProps?.open)) return null;
3205
- return /* @__PURE__ */ jsxs(Suspense, {
3206
- fallback: null,
3207
- children: [collectionDialogProps?.open && /* @__PURE__ */ jsx(CollectionEditorDialog, {
3208
- open: false,
3209
- isNewCollection: false,
3210
- configController: void 0,
3211
- handleClose: () => {},
3212
- ...collectionDialogProps
3213
- }), propertyDialogProps?.open && /* @__PURE__ */ jsx(PropertyFormDialog, {
3214
- open: false,
3215
- existingProperty: false,
3216
- autoOpenTypeSelect: false,
3217
- inArray: false,
3218
- allowDataInference: false,
3219
- propertyConfigs: {},
3220
- ...propertyDialogProps
3221
- })]
3222
- });
3223
- }
3224
- //#endregion
3225
- //#region src/components/RebaseRouteDefs.tsx
3226
- function SettingsView() {
3227
- const { t } = useTranslation();
3228
- const breadcrumbs = useBreadcrumbsController();
3229
- useEffect(() => {
3230
- breadcrumbs.set({ breadcrumbs: [{
3231
- title: t("account_settings"),
3232
- url: "/settings"
3233
- }] });
3234
- }, []);
3235
- return /* @__PURE__ */ jsx(UserSettingsView, {});
3236
- }
3237
- /**
3238
- * Route definitions for the admin.
3239
- *
3240
- * Defines all standard routes: home, studio home, collection view,
3241
- * settings, debug, custom views, and a catch-all 404.
3242
- *
3243
- * **Independently usable**: Use this when you want Rebase routes
3244
- * inside your own layout/navigation setup.
3245
- *
3246
- * @example
3247
- * ```tsx
3248
- * <RebaseNavigation>
3249
- * <RebaseRouteDefs layout={<MyCustomLayout />}>
3250
- * <Route path="/my-custom" element={<MyView />} />
3251
- * </RebaseRouteDefs>
3252
- * </RebaseNavigation>
3253
- * ```
3254
- */
3255
- function RebaseRouteDefs({ children, layout }) {
3256
- const registry = useRebaseRegistry();
3257
- const navigationStateController = useNavigationStateController();
3258
- const ResolvedHomePage = useComponentOverride("HomePage", ContentHomePage);
3259
- const cmsHomePage = registry.cmsConfig?.homePage ?? /* @__PURE__ */ jsx(Suspense, {
3260
- fallback: /* @__PURE__ */ jsx(CircularProgressCenter, {}),
3261
- children: /* @__PURE__ */ jsx(ResolvedHomePage, {})
3262
- });
3263
- const studioHomePage = registry.studioConfig?.homePage;
3264
- const combinedViews = useMemo(() => [...navigationStateController.views ?? [], ...navigationStateController.adminViews ?? []], [navigationStateController.views, navigationStateController.adminViews]);
3265
- const routeContents = /* @__PURE__ */ jsxs(Fragment, { children: [
3266
- /* @__PURE__ */ jsx(Route, {
3267
- path: "/",
3268
- element: cmsHomePage
3269
- }),
3270
- registry.studioConfig && /* @__PURE__ */ jsx(Route, {
3271
- path: "/s",
3272
- element: studioHomePage
3273
- }),
3274
- /* @__PURE__ */ jsx(Route, {
3275
- path: "/c/*",
3276
- element: /* @__PURE__ */ jsx(RebaseRoute, {})
3277
- }),
3278
- /* @__PURE__ */ jsx(Route, {
3279
- path: "/settings",
3280
- element: /* @__PURE__ */ jsx(SettingsView, {})
3281
- }),
3282
- combinedViews.map((view) => {
3283
- return (Array.isArray(view.slug) ? view.slug : [view.slug]).flatMap((slug) => {
3284
- const routes = [/* @__PURE__ */ jsx(Route, {
3285
- path: slug,
3286
- element: /* @__PURE__ */ jsx(CustomViewRoute, { view })
3287
- }, slug)];
3288
- if (view.nestedRoutes) routes.push(/* @__PURE__ */ jsx(Route, {
3289
- path: slug + "/*",
3290
- element: /* @__PURE__ */ jsx(CustomViewRoute, { view })
3291
- }, slug + "/*"));
3292
- return routes;
3293
- });
3294
- }),
3295
- children,
3296
- /* @__PURE__ */ jsx(Route, {
3297
- path: "*",
3298
- element: navigationStateController.loading ? /* @__PURE__ */ jsx(CircularProgressCenter, {}) : /* @__PURE__ */ jsx(NotFoundPage, {})
3299
- })
3300
- ] });
3301
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(RebaseRoutes, { children: layout ? /* @__PURE__ */ jsx(Route, {
3302
- element: layout,
3303
- children: routeContents
3304
- }) : /* @__PURE__ */ jsx(Route, {
3305
- element: /* @__PURE__ */ jsx(Fragment, { children: routeContents }),
3306
- children: routeContents
3307
- }) }), /* @__PURE__ */ jsx(CollectionEditorDialogs, {})] });
3308
- }
3309
- //#endregion
3310
- //#region src/components/RebaseShell.tsx
3311
- /**
3312
- * Convenience component that composes all four admin layers:
3313
- *
3314
- * ```
3315
- * <RebaseAuthGate>
3316
- * <RebaseNavigation>
3317
- * <RebaseRouteDefs layout={<RebaseLayout>}>
3318
- * {children}
3319
- * </RebaseRouteDefs>
3320
- * </RebaseNavigation>
3321
- * </RebaseAuthGate>
3322
- * ```
3323
- *
3324
- * Each layer is independently usable — see their individual docs.
3325
- * RebaseShell is sugar that composes them all with sensible defaults.
3326
- */
3327
- function RebaseShell(props) {
3328
- const { title = "Rebase", appBar, drawer, autoOpenDrawer = true, defaultDrawerOpen = false, logo, children } = props;
3329
- const registry = useRebaseRegistry();
3330
- return /* @__PURE__ */ jsx(RebaseAuthGate, { children: /* @__PURE__ */ jsx(RebaseNavigation, { children: /* @__PURE__ */ jsx(ErrorBoundary, {
3331
- fullPage: true,
3332
- children: /* @__PURE__ */ jsx(RebaseRouteDefs, {
3333
- layout: /* @__PURE__ */ jsx(RebaseLayout, {
3334
- title,
3335
- appBar,
3336
- drawer,
3337
- autoOpenDrawer,
3338
- defaultDrawerOpen,
3339
- logo,
3340
- devViews: useMemo(() => {
3341
- return registry.studioConfig?.devViews ?? [];
3342
- }, [registry.studioConfig?.devViews])
3343
- }),
3344
- children
3345
- })
3346
- }) }) });
3347
- }
3348
- //#endregion
3349
- //#region src/components/CollectionPanel.tsx
3350
- /**
3351
- * A high-level, reusable wrapper for embedding a Rebase collection view
3352
- * inside custom pages (dashboards, home pages, entity detail views, etc.).
3353
- *
3354
- * Usage:
3355
- * ```tsx
3356
- * import { CollectionPanel } from "@rebasepro/cms";
3357
- *
3358
- * function MyDashboard() {
3359
- * return (
3360
- * <div>
3361
- * <CollectionPanel path="tasks" title="Pending Tasks" />
3362
- * <CollectionPanel
3363
- * path="clients"
3364
- * viewMode="table"
3365
- * collectionOverrides={{
3366
- * defaultFilter: { status: ["!=", "completed"] }
3367
- * }}
3368
- * />
3369
- * </div>
3370
- * );
3371
- * }
3372
- * ```
3373
- *
3374
- * @group Components
3375
- */
3376
- function CollectionPanelInner({ mergedCollection, path, title, updateUrl, className }) {
3377
- const ResolvedCollectionView = useComponentOverride("Collection.View", CollectionViewBinding);
3378
- return /* @__PURE__ */ jsxs("div", {
3379
- className,
3380
- children: [title !== false && /* @__PURE__ */ jsx(Typography, {
3381
- variant: "subtitle2",
3382
- className: "font-semibold mb-2 text-surface-700 dark:text-surface-300",
3383
- children: title ?? mergedCollection.name
3384
- }), /* @__PURE__ */ jsx(ResolvedCollectionView, {
3385
- ...mergedCollection,
3386
- path,
3387
- updateUrl
3388
- })]
3389
- });
3390
- }
3391
- function CollectionPanel(props) {
3392
- const { path, viewMode, sort, limit, openEntityMode, className, collectionOverrides } = props;
3393
- const registeredCollection = useCollectionRegistryController().getCollection(path);
3394
- const mergedCollection = useMemo(() => {
3395
- if (!registeredCollection) return void 0;
3396
- const propOverrides = {};
3397
- if (viewMode) propOverrides.defaultViewMode = viewMode;
3398
- if (sort) propOverrides.sort = sort;
3399
- if (limit) propOverrides.pagination = limit;
3400
- if (openEntityMode) propOverrides.openEntityMode = openEntityMode;
3401
- return {
3402
- ...registeredCollection,
3403
- ...collectionOverrides ?? {},
3404
- ...propOverrides
3405
- };
3406
- }, [
3407
- registeredCollection,
3408
- collectionOverrides,
3409
- viewMode,
3410
- sort,
3411
- limit,
3412
- openEntityMode
3413
- ]);
3414
- if (!mergedCollection) return /* @__PURE__ */ jsx("div", {
3415
- className,
3416
- children: /* @__PURE__ */ jsxs(Typography, {
3417
- variant: "body2",
3418
- color: "secondary",
3419
- children: [
3420
- "Collection \"",
3421
- path,
3422
- "\" not found."
3423
- ]
3424
- })
3425
- });
3426
- return /* @__PURE__ */ jsx(CollectionScopeProvider, {
3427
- collection: mergedCollection,
3428
- children: /* @__PURE__ */ jsx(CollectionPanelInner, {
3429
- ...props,
3430
- mergedCollection
3431
- })
3432
- });
3433
- }
3434
- //#endregion
3435
- //#region src/util/propertyConfigMapper.ts
3436
- /**
3437
- * Map Rebase property types to headless-supported types.
3438
- * `vector` and `binary` are not directly renderable, so we fall back to `string`.
3439
- */
3440
- var TYPE_MAP = {
3441
- string: "string",
3442
- number: "number",
3443
- boolean: "boolean",
3444
- date: "date",
3445
- geopoint: "geopoint",
3446
- reference: "reference",
3447
- relation: "relation",
3448
- array: "array",
3449
- map: "map",
3450
- vector: "string",
3451
- binary: "string"
3452
- };
3453
- /**
3454
- * Convert a single Property to a CollectionPropertyConfig.
3455
- */
3456
- function mapPropertyToConfig(property, key) {
3457
- const base = {
3458
- type: TYPE_MAP[property.type] ?? "string",
3459
- name: property.name ?? (key ? prettifyIdentifier(key) : ""),
3460
- description: property.description,
3461
- columnWidth: property.admin?.columnWidth,
3462
- hideFromCollection: property.admin?.hideFromCollection
3463
- };
3464
- if (property.type === "string") {
3465
- if (property.enum) base.enum = mapEnumValues(property.enum);
3466
- if (property.admin?.multiline) base.multiline = true;
3467
- if (property.admin?.previewAsTag) base.previewAsTag = true;
3468
- if (property.admin?.urlPreview) base.url = property.admin.urlPreview;
3469
- if (property.admin?.markdown) base.markdown = true;
3470
- if (property.storage) base.storage = true;
3471
- if (property.email) base.email = true;
3472
- }
3473
- if (property.type === "number" && property.enum) base.enum = mapEnumValues(property.enum);
3474
- if (property.type === "array" && property.of && !Array.isArray(property.of)) base.of = mapPropertyToConfig(property.of, key);
3475
- if (property.type === "map" && property.properties) {
3476
- base.properties = mapPropertiesToConfigs(property.properties);
3477
- if (property.propertiesOrder) base.propertiesOrder = property.propertiesOrder;
3478
- }
3479
- if (property.type === "date" && property.mode) base.mode = property.mode;
3480
- if (property.admin?.Preview) {}
3481
- return base;
3482
- }
3483
- /**
3484
- * Convert a Properties record to a CollectionPropertyConfig record.
3485
- */
3486
- function mapPropertiesToConfigs(properties) {
3487
- const result = {};
3488
- for (const [key, property] of Object.entries(properties)) result[key] = mapPropertyToConfig(property, key);
3489
- return result;
3490
- }
3491
- /**
3492
- * Convert Rebase EnumValues to CollectionEnumValueConfig format.
3493
- * Handles both array form (EnumValueConfig[]) and record form.
3494
- */
3495
- function mapEnumValues(enumValues) {
3496
- if (!enumValues) return void 0;
3497
- if (Array.isArray(enumValues)) {
3498
- const result = {};
3499
- for (const item of enumValues) result[String(item.id)] = normalizeEnumValueConfig(item);
3500
- return result;
3501
- }
3502
- const result = {};
3503
- for (const [key, value] of Object.entries(enumValues)) result[key] = typeof value === "string" ? value : normalizeEnumValueConfig(value);
3504
- return result;
3505
- }
3506
- function normalizeEnumValueConfig(config) {
3507
- return {
3508
- label: config.label,
3509
- color: typeof config.color === "string" ? config.color : void 0,
3510
- disabled: config.disabled
3511
- };
3512
- }
3513
- //#endregion
3514
- //#region src/util/dataControllerAdapter.ts
3515
- /**
3516
- * Adapts an `EntityTableController<M>` (from @rebasepro/types) to a
3517
- * `CollectionDataController<T>` (from @rebasepro/ui), bridging the
3518
- * entity-aware data layer to the headless collection view.
3519
- */
3520
- /**
3521
- * Unwrap `Entity<M>` objects to flat rows for the headless view.
3522
- * The entity system uses `{ id, path, values: M }`; `values` is already the
3523
- * flat row `M` carrying its real primary key, so unwrapping is just `.values` —
3524
- * no `id`/`path` merge (those are view-model metadata, not row columns).
3525
- */
3526
- function flattenEntities(entities) {
3527
- return entities.map((entity) => entity.values);
3528
- }
3529
- /**
3530
- * React hook that adapts a EntityTableController to a CollectionDataController.
3531
- *
3532
- * Usage:
3533
- * ```tsx
3534
- * const tableController = useDataTableController({ path, collection });
3535
- * const dataController = useCollectionDataController(tableController);
3536
- *
3537
- * <CollectionView dataController={dataController} ... />
3538
- * ```
3539
- */
3540
- function useCollectionDataController(tableController) {
3541
- const flatData = useMemo(() => flattenEntities(tableController.data), [tableController.data]);
3542
- return useMemo(() => ({
3543
- data: flatData,
3544
- loading: tableController.dataLoading,
3545
- noMoreToLoad: tableController.noMoreToLoad,
3546
- error: tableController.dataLoadingError,
3547
- filterValues: tableController.filterValues,
3548
- setFilterValues: tableController.setFilterValues,
3549
- sortBy: tableController.sortBy,
3550
- setSortBy: tableController.setSortBy,
3551
- searchString: tableController.searchString,
3552
- setSearchString: tableController.setSearchString,
3553
- clearFilter: tableController.clearFilter,
3554
- initialScroll: tableController.initialScroll,
3555
- onScroll: tableController.onScroll,
3556
- paginationEnabled: tableController.paginationEnabled,
3557
- pageSize: tableController.pageSize,
3558
- itemCount: tableController.itemCount,
3559
- setItemCount: tableController.setItemCount
3560
- }), [flatData, tableController]);
3561
- }
3562
- /**
3563
- * Non-hook version for cases where you already have the data
3564
- * and just need to build a static controller.
3565
- */
3566
- function createStaticDataController(data, options) {
3567
- return {
3568
- data,
3569
- loading: options?.loading ?? false,
3570
- noMoreToLoad: true,
3571
- error: options?.error
3572
- };
3573
- }
3574
- //#endregion
3575
- //#region src/collection_editor/useJsonCollectionsConfigController.tsx
3576
- /**
3577
- * A `CollectionsConfigController` implementation that persists collection
3578
- * configurations as JSON via a pluggable `JsonCollectionStore` adapter.
3579
- *
3580
- * Use this when you want to store collection schemas in a database, API,
3581
- * localStorage, or any other JSON-compatible backend — as opposed to the
3582
- * default code-based persistence.
3583
- *
3584
- * @example
3585
- * ```tsx
3586
- * const store: JsonCollectionStore = {
3587
- * load: async () => { const res = await fetch('/api/schemas'); return res.json(); },
3588
- * save: async (slug, data) => { await fetch(`/api/schemas/${slug}`, { method: 'PUT', body: JSON.stringify(data) }); },
3589
- * delete: async (slug) => { await fetch(`/api/schemas/${slug}`, { method: 'DELETE' }); },
3590
- * };
3591
- *
3592
- * const configController = useJsonCollectionsConfigController({ store });
3593
- * ```
3594
- */
3595
- function useJsonCollectionsConfigController({ store, readOnly = false, autoLoad = true }) {
3596
- const [collections, setCollections] = useState([]);
3597
- const [loading, setLoading] = useState(autoLoad);
3598
- const [navigationEntries, setNavigationEntries] = useState([]);
3599
- const storeRef = useRef(store);
3600
- storeRef.current = store;
3601
- /**
3602
- * The current collections, readable outside a state updater.
3603
- *
3604
- * Three mutators used to compute their new value inside
3605
- * `setCollections(prev => …)` and persist from in there, which cost them
3606
- * both halves of a save: the promise they returned resolved before the
3607
- * store had answered, so a failed write reached the caller as a success,
3608
- * and a `setState` updater must be pure — under `StrictMode` React invokes
3609
- * it twice, so every one of those saves wrote to the store twice in
3610
- * development. Reading `prev` from a ref lets them do what
3611
- * `updatePropertiesOrder` already did: compute, set, then await.
3612
- */
3613
- const collectionsRef = useRef([]);
3614
- const applyCollections = useCallback((next) => {
3615
- collectionsRef.current = next;
3616
- setCollections(next);
3617
- }, []);
3618
- useEffect(() => {
3619
- if (!autoLoad) return;
3620
- let cancelled = false;
3621
- (async () => {
3622
- try {
3623
- const [serialized, navEntries] = await Promise.all([storeRef.current.load(), storeRef.current.loadNavigationEntries?.() ?? Promise.resolve([])]);
3624
- if (cancelled) return;
3625
- applyCollections(fromSerializableCollectionConfigs(serialized));
3626
- setNavigationEntries(navEntries);
3627
- } catch (e) {
3628
- console.error("useJsonCollectionsConfigController: failed to load collections", e);
3629
- } finally {
3630
- if (!cancelled) setLoading(false);
3631
- }
3632
- })();
3633
- return () => {
3634
- cancelled = true;
3635
- };
3636
- }, [autoLoad, applyCollections]);
3637
- /**
3638
- * Update local state and persist a collection to the store.
3639
- */
3640
- const persistCollection = useCallback(async (collection) => {
3641
- const serializable = toSerializableCollectionConfig(collection);
3642
- await storeRef.current.save(collection.slug, serializable);
3643
- }, []);
3644
- /**
3645
- * Find collection by id (slug).
3646
- */
3647
- const getCollection = useCallback((id) => {
3648
- const found = collections.find((c) => c.slug === id);
3649
- if (found) return found;
3650
- throw new Error(`Collection "${id}" not found`);
3651
- }, [collections]);
3652
- const saveCollection = useCallback(async ({ id, collectionData }) => {
3653
- const collection = collectionData;
3654
- await persistCollection(collection);
3655
- const prev = collectionsRef.current;
3656
- const idx = prev.findIndex((c) => c.slug === id);
3657
- if (idx >= 0) {
3658
- const next = [...prev];
3659
- next[idx] = collection;
3660
- applyCollections(next);
3661
- } else applyCollections([...prev, collection]);
3662
- }, [persistCollection, applyCollections]);
3663
- const updateCollection = useCallback(async ({ id, collectionData, previousId }) => {
3664
- const prev = collectionsRef.current;
3665
- const lookupId = previousId ?? id;
3666
- const idx = prev.findIndex((c) => c.slug === lookupId);
3667
- if (idx < 0) return;
3668
- const merged = {
3669
- ...prev[idx],
3670
- ...collectionData
3671
- };
3672
- const next = [...prev];
3673
- next[idx] = merged;
3674
- applyCollections(next);
3675
- await persistCollection(merged);
3676
- if (previousId && previousId !== id) await storeRef.current.delete(previousId);
3677
- }, [persistCollection, applyCollections]);
3678
- const deleteCollection = useCallback(async ({ id }) => {
3679
- await storeRef.current.delete(id);
3680
- applyCollections(collectionsRef.current.filter((c) => c.slug !== id));
3681
- }, [applyCollections]);
3682
- const saveProperty = useCallback(async ({ path, propertyKey, property, newPropertiesOrder }) => {
3683
- const prev = collectionsRef.current;
3684
- const idx = prev.findIndex((c) => c.slug === path);
3685
- if (idx < 0) return;
3686
- const collection = { ...prev[idx] };
3687
- collection.properties = {
3688
- ...collection.properties,
3689
- [propertyKey]: property
3690
- };
3691
- if (newPropertiesOrder) collection.propertiesOrder = newPropertiesOrder;
3692
- const next = [...prev];
3693
- next[idx] = collection;
3694
- applyCollections(next);
3695
- await persistCollection(next[idx]);
3696
- }, [persistCollection, applyCollections]);
3697
- const deleteProperty = useCallback(async ({ path, propertyKey, newPropertiesOrder }) => {
3698
- const prev = collectionsRef.current;
3699
- const idx = prev.findIndex((c) => c.slug === path);
3700
- if (idx < 0) return;
3701
- const collection = { ...prev[idx] };
3702
- const { [propertyKey]: _removed, ...remaining } = collection.properties;
3703
- collection.properties = remaining;
3704
- if (newPropertiesOrder) collection.propertiesOrder = newPropertiesOrder;
3705
- const next = [...prev];
3706
- next[idx] = collection;
3707
- applyCollections(next);
3708
- await persistCollection(next[idx]);
3709
- }, [persistCollection, applyCollections]);
3710
- const updatePropertiesOrder = useCallback(async ({ collection, newPropertiesOrder }) => {
3711
- const updated = {
3712
- ...collection,
3713
- propertiesOrder: newPropertiesOrder
3714
- };
3715
- const prev = collectionsRef.current;
3716
- const idx = prev.findIndex((c) => c.slug === collection.slug);
3717
- if (idx >= 0) {
3718
- const next = [...prev];
3719
- next[idx] = updated;
3720
- applyCollections(next);
3721
- }
3722
- await persistCollection(updated);
3723
- }, [persistCollection, applyCollections]);
3724
- const updateKanbanColumnsOrder = useCallback(async ({ collection, kanbanColumnProperty, newColumnsOrder }) => {}, []);
3725
- const saveNavigationEntriesHandler = useCallback(async (entries) => {
3726
- setNavigationEntries(entries);
3727
- if (storeRef.current.saveNavigationEntries) await storeRef.current.saveNavigationEntries(entries);
3728
- }, []);
3729
- return useMemo(() => ({
3730
- loading,
3731
- readOnly,
3732
- readOnlyReason: readOnly ? "Configuration is read-only." : void 0,
3733
- collections,
3734
- getCollection,
3735
- saveCollection,
3736
- updateCollection,
3737
- deleteCollection,
3738
- saveProperty,
3739
- deleteProperty,
3740
- updatePropertiesOrder,
3741
- updateKanbanColumnsOrder,
3742
- navigationEntries,
3743
- saveNavigationEntries: saveNavigationEntriesHandler
3744
- }), [
3745
- loading,
3746
- readOnly,
3747
- collections,
3748
- getCollection,
3749
- saveCollection,
3750
- updateCollection,
3751
- deleteCollection,
3752
- saveProperty,
3753
- deleteProperty,
3754
- updatePropertiesOrder,
3755
- updateKanbanColumnsOrder,
3756
- navigationEntries,
3757
- saveNavigationEntriesHandler
3758
- ]);
3759
- }
3760
- //#endregion
3761
- //#region src/collection_editor/ui/MissingReferenceWidget.tsx
3762
- function MissingReferenceWidget({ path: pathProp }) {
3763
- const registry = useCollectionRegistryController();
3764
- const path = getLastSegment$1(pathProp);
3765
- const parentCollectionSlugs = registry.getParentCollectionSlugs(pathProp);
3766
- const parentEntityIds = registry.getParentEntityIds(pathProp);
3767
- const collectionEditor = useCollectionEditorController();
3768
- const { t } = useTranslation();
3769
- return /* @__PURE__ */ jsxs("div", {
3770
- className: "p-1 flex flex-col items-center",
3771
- children: [/* @__PURE__ */ jsx(ErrorView, { error: t("studio_missing_reference_error", { path }) }), /* @__PURE__ */ jsx(Button, {
3772
- className: "mx-2",
3773
- size: "small",
3774
- onClick: () => {
3775
- collectionEditor.createCollection({
3776
- initialValues: {
3777
- path,
3778
- name: prettifyIdentifier(path)
3779
- },
3780
- parentCollectionSlugs,
3781
- parentEntityIds,
3782
- redirect: false,
3783
- sourceClick: "missing_reference"
3784
- });
3785
- },
3786
- children: t("studio_missing_reference_create")
3787
- })]
3788
- });
3789
- }
3790
- //#endregion
3791
- export { AdminModeSyncer, AppBar, ArrayContainer, ArrayCustomShapedFieldBinding, ArrayEnumPreview, ArrayOfMapsPreview, ArrayOfReferencesFieldBinding, ArrayOfReferencesPreview, ArrayOfStorageComponentsPreview, ArrayOfStringsPreview, ArrayOneOfPreview, ArrayPropertyEnumPreview, ArrayPropertyPreview, BasicExportAction, BlockFieldBinding, BooleanPreview, CollectionCardViewBinding, CollectionGenerationApiError, CollectionPanel, CollectionRegistryContext, CollectionRowActions, CollectionTableBinding, CollectionViewActions, CollectionViewBinding, CreationResultDialog, CustomViewRoute, DEFAULT_COLLECTION_GENERATION_ENDPOINT, DEFAULT_FIELD_CONFIGS, DataNewPropertiesMapping, DatePreview, DateTimeFieldBinding, DefaultDrawer, Drawer, DrawerFooterActions, DrawerNavigationGroup, DrawerNavigationItem, EXPORT_PAGE_SIZE, EmptyValue, EntityCardBinding, EntityForm, EntityFormBinding, EntityPreviewBinding, EntityViewBinding, EnumValuesChip, ExportCollectionAction, FieldBlock, FieldCaption, FieldHelperText, FormRail, FormSections, IMPORT_BATCH_SIZE, ImagePreview, ImportCollectionAction, ImportDataPreview, ImportFileUpload, ImportNewPropertyFieldPreview, ImportSaveInProgress, InlineEntityListPreview, KeyValueFieldBinding, KeyValuePreview, LABEL_ICON_SIZE, LabelWithIcon, LiveSchemaError, MAX_EXPORT_ROWS, MAX_SELECTION_ROWS, MapFieldBinding, MapPropertyPreview, MarkdownEditorFieldBinding, MissingReferenceWidget, MultiSelectFieldBinding, NavigationStateContext, NumberPropertyPreview, PropertyConfigBadge, PropertyFieldBinding, PropertyKeyHint, PropertyPreview, PropertySelectEntry, ReadOnlyFieldBinding, RebaseAuthGate, RebaseCMS, RebaseLayout, RebaseNavigation, RebaseRoute, RebaseRouteDefs, RebaseShell, RecordMeta, ReferenceFieldBinding, ReferencePreview, ReferenceWidget, RelationPreview, RepeatFieldBinding, SELECTION_PAGE_SIZE, Scaffold, SchemaChangeCancelled, SearchIconsView, SelectFieldBinding, SelectableTable, SelectableTableContext, SelectionMenu, SelectionTableBinding, SideDialogs, SidePanelControllerContext, SidePanelProvider, SkeletonPropertyComponent, StorageThumbnail, StorageThumbnailInternal, StorageUploadFieldBinding, StringPropertyPreview, SwitchFieldBinding, TextFieldBinding, UrlComponentPreview, UrlContext, UserPreview, VectorFieldBinding, VirtualTableInput, addInitialSlash, asUnavailable, buildCollectionGenerationCallback, buildSidePanelsFromUrl, convertDataToEntity, convertFileToJson, copyEntityAction, createLiveSchemaClient, createStaticDataController, deleteEntityAction, detectCsvDelimiter, downloadBlob, downloadDataAsCsv, downloadEntitiesExport, editEntityAction, entryToCSVRow, escapeCsvFormula, extractTouchedValues, fetchAllEntitiesForExport, flattenEntry, fromSerializableCollectionConfig, fromSerializableCollectionConfigs, fromSerializableProperties, fromSerializableProperty, getBracketNotation, getChanges, getCollectionBySlugWithin, getCollectionPathsCombinations, getDefaultFieldConfig, getDefaultFieldId, getDefaultPropertiesOrder, getEntityCSVExportableData, getEntityJsonExportableData, getEntityPreviewKeys, getEntityTitlePropertyKey, getEntityTitlePropertyKeyForEntity, getEntityViewWidth, getFieldConfig, getFieldId, getFullId, getFullIdPath, getIconForProperty, getIconForWidget, getInferenceType, getInitialEntityValues, getLastSegment, getPropertiesWithPropertiesOrder, getPropertyInPath, getResolvedPropertyInPath, getUserLabel, idToPropertiesPath, isReferenceProperty, isRelationProperty, isSchemaChangeCancelled, isSelfLabellingProperty, mapPropertiesToConfigs, mapPropertyToConfig, mergeEntityActions, namespaceToPropertiesOrderPath, namespaceToPropertiesPath, parseCsvRows, parseCsvToObjects, processValueMapping, removeEmptyContainers, removeInitialAndTrailingSlashes, removeInitialSlash, removeTrailingSlash, renderSkeletonCaptionText, renderSkeletonIcon, renderSkeletonImageThumbnail, renderSkeletonText, resetPasswordAction, resolveCollectionPathIds, resolveEntityAction, resolveEntityView, resolveNavigationFrom, resolveSelection, sanitizeUrl, saveImportedEntities, selectionQueryToFindParams, serializeSelectionQuery, spanClass, toSerializableCollectionConfig, toSerializableProperties, toSerializableProperty, unescapeCsvFormula, useAdminContext, useApp, useBreadcrumbsController, useBuildCollectionRegistryController, useBuildNavigationStateController, useBuildSidePanel, useBuildUrlController, useClearRestoreValue, useCollectionDataController, useCollectionEditorController, useCollectionRegistryController, useCollectionsConfigController, useHistory, useImportConfig, useJsonCollectionsConfigController, useLiveSchemaEditing, useLocalCollectionsConfigController, useNavigationStateController, useResolvedCollections, useResolvedNavigationFrom, useResolvedUser, useResolvedViews, useSelectionController, useSelectionDialog, useSideDialogsController, useSidePanel, useTopLevelNavigation, useUrlController, validateCollectionJson, zodToFormErrors };
3792
-
3793
- //# sourceMappingURL=index.js.map
1
+ import { EditorAIControllerProvider, useProvidedEditorAIController } from "./contexts/EditorAIControllerContext.js";
2
+ import { getBracketNotation, getDefaultPropertiesOrder, getIconForProperty, getIconForWidget, getPropertiesWithPropertiesOrder, getPropertyInPath, getResolvedPropertyInPath, isReferenceProperty, isRelationProperty } from "./util/property_utils.js";
3
+ import { PropertyKeyHint } from "./components/PropertyKeyHint.js";
4
+ import { FieldBlock, LABEL_ICON_SIZE, isSelfLabellingProperty, spanClass } from "./form/components/FieldBlock.js";
5
+ import { FormRail, RecordMeta } from "./form/components/FormRail.js";
6
+ import { FormSections } from "./form/components/FormSections.js";
7
+ import { EmptyValue } from "./preview/components/EmptyValue.js";
8
+ import { sanitizeUrl } from "./preview/util.js";
9
+ import { ImagePreview } from "./preview/components/ImagePreview.js";
10
+ import { UrlComponentPreview } from "./preview/components/UrlComponentPreview.js";
11
+ import { SkeletonPropertyComponent, renderSkeletonCaptionText, renderSkeletonIcon, renderSkeletonImageThumbnail, renderSkeletonText } from "./preview/property_previews/SkeletonPropertyComponent.js";
12
+ import { StorageThumbnail, StorageThumbnailInternal } from "./preview/components/StorageThumbnail.js";
13
+ import { EnumValuesChip } from "./preview/components/EnumValuesChip.js";
14
+ import { StringPropertyPreview } from "./preview/property_previews/StringPropertyPreview.js";
15
+ import { ArrayPropertyPreview } from "./preview/property_previews/ArrayPropertyPreview.js";
16
+ import { getEntityPreviewKeys, getEntityTitlePropertyKey, getEntityTitlePropertyKeyForEntity } from "./util/previews.js";
17
+ import { getUserLabel, useResolvedUser } from "./hooks/useResolvedUsers.js";
18
+ import { CollectionRegistryContext, useCollectionRegistryController } from "./hooks/navigation/contexts/CollectionRegistryContext.js";
19
+ import { SidePanelControllerContext, useSidePanel } from "./hooks/useSidePanel.js";
20
+ import { EntityPreviewBinding } from "./components/EntityPreviewBinding.js";
21
+ import { ReferencePreview } from "./preview/components/ReferencePreview.js";
22
+ import { InlineEntityListPreview } from "./preview/components/InlineEntityListPreview.js";
23
+ import { ArrayOfReferencesPreview } from "./preview/property_previews/ArrayOfReferencesPreview.js";
24
+ import { RelationPreview } from "./preview/components/RelationPreview.js";
25
+ import { ArrayOfStorageComponentsPreview } from "./preview/property_previews/ArrayOfStorageComponentsPreview.js";
26
+ import { ArrayEnumPreview } from "./preview/components/ArrayEnumPreview.js";
27
+ import { ArrayPropertyEnumPreview } from "./preview/property_previews/ArrayPropertyEnumPreview.js";
28
+ import { ArrayOfStringsPreview } from "./preview/property_previews/ArrayOfStringsPreview.js";
29
+ import { ArrayOneOfPreview } from "./preview/property_previews/ArrayOneOfPreview.js";
30
+ import { KeyValuePreview, MapPropertyPreview } from "./preview/property_previews/MapPropertyPreview.js";
31
+ import { DatePreview } from "./preview/components/DatePreview.js";
32
+ import { BooleanPreview } from "./preview/components/BooleanPreview.js";
33
+ import { NumberPropertyPreview } from "./preview/property_previews/NumberPropertyPreview.js";
34
+ import { UserPreview } from "./preview/components/UserPreview.js";
35
+ import { PropertyPreview } from "./preview/PropertyPreview.js";
36
+ import { ArrayOfMapsPreview } from "./preview/property_previews/ArrayOfMapsPreview.js";
37
+ import { FieldHelperText } from "./form/components/FieldHelperText.js";
38
+ import { LabelWithIcon } from "./form/components/LabelWithIcon.js";
39
+ import { ReadOnlyFieldBinding } from "./form/field_bindings/ReadOnlyFieldBinding.js";
40
+ import { useClearRestoreValue } from "./form/useClearRestoreValue.js";
41
+ import { ArrayCustomShapedFieldBinding } from "./form/field_bindings/ArrayCustomShapedFieldBinding.js";
42
+ import { SelectableTableContext } from "./components/SelectableTable/SelectableTableContext.js";
43
+ import { useSideDialogsController } from "./hooks/useSideDialogsController.js";
44
+ import { NavigationStateContext, useNavigationStateController } from "./hooks/navigation/contexts/NavigationStateContext.js";
45
+ import { UrlContext, useUrlController } from "./hooks/navigation/contexts/UrlContext.js";
46
+ import { useAdminContext } from "./hooks/useAdminContext.js";
47
+ import { mergeEntityActions } from "./util/entity_actions.js";
48
+ import { CollectionRowActions } from "./components/CollectionTableBinding/CollectionRowActions.js";
49
+ import { SelectableTable } from "./components/SelectableTable/SelectableTable.js";
50
+ import { CollectionTableBinding } from "./components/CollectionTableBinding/CollectionTableBinding.js";
51
+ import { VirtualTableInput } from "./components/CollectionTableBinding/index.js";
52
+ import { useSelectionController } from "./components/CollectionViewBinding/useSelectionController.js";
53
+ import { buildSidePanelsFromUrl, getEntityViewWidth, useBuildSidePanel } from "./hooks/useBuildSidePanel.js";
54
+ import { resolveNavigationFrom, useResolvedNavigationFrom } from "./hooks/useResolvedNavigationFrom.js";
55
+ import { useHistory } from "./hooks/useHistory.js";
56
+ import { useBuildCollectionRegistryController } from "./hooks/navigation/useBuildCollectionRegistryController.js";
57
+ import { addInitialSlash, getCollectionBySlugWithin, getCollectionPathsCombinations, getLastSegment, removeInitialAndTrailingSlashes, removeInitialSlash, removeTrailingSlash, resolveCollectionPathIds } from "./util/navigation_utils.js";
58
+ import { CreationResultDialog } from "./components/admin/CreationResultDialog.js";
59
+ import { copyEntityAction, deleteEntityAction, editEntityAction, resetPasswordAction } from "./components/common/default_entity_actions.js";
60
+ import { useResolvedCollections } from "./hooks/navigation/useResolvedCollections.js";
61
+ import { useResolvedViews } from "./hooks/navigation/useResolvedViews.js";
62
+ import { useTopLevelNavigation } from "./hooks/navigation/useTopLevelNavigation.js";
63
+ import { useBuildNavigationStateController } from "./hooks/navigation/useBuildNavigationStateController.js";
64
+ import { useBuildUrlController } from "./hooks/navigation/useBuildUrlController.js";
65
+ import { useBreadcrumbsController } from "./hooks/useBreadcrumbsController.js";
66
+ import { SideDialogs } from "./components/SideDialogs.js";
67
+ import { SelectionTableBinding } from "./components/ReferenceTable/SelectionTableBinding.js";
68
+ import { useSelectionDialog } from "./hooks/useSelectionDialog.js";
69
+ import { ArrayContainer } from "./components/ArrayContainer.js";
70
+ import { ArrayOfReferencesFieldBinding } from "./form/field_bindings/ArrayOfReferencesFieldBinding.js";
71
+ import { BlockFieldBinding } from "./form/field_bindings/BlockFieldBinding.js";
72
+ import { DateTimeFieldBinding } from "./form/field_bindings/DateTimeFieldBinding.js";
73
+ import { KeyValueFieldBinding } from "./form/field_bindings/KeyValueFieldBinding.js";
74
+ import { MapFieldBinding } from "./form/field_bindings/MapFieldBinding.js";
75
+ import { MarkdownEditorFieldBinding } from "./form/field_bindings/MarkdownEditorFieldBinding.js";
76
+ import { MultiSelectFieldBinding } from "./form/field_bindings/MultiSelectFieldBinding.js";
77
+ import { ReferenceFieldBinding } from "./form/field_bindings/ReferenceFieldBinding.js";
78
+ import { RepeatFieldBinding } from "./form/field_bindings/RepeatFieldBinding.js";
79
+ import { SelectFieldBinding } from "./form/field_bindings/SelectFieldBinding.js";
80
+ import { StorageUploadFieldBinding } from "./form/field_bindings/StorageUploadFieldBinding.js";
81
+ import { SwitchFieldBinding } from "./form/field_bindings/SwitchFieldBinding.js";
82
+ import { TextFieldBinding } from "./form/field_bindings/TextFieldBinding.js";
83
+ import { VectorFieldBinding } from "./form/field_bindings/VectorFieldBinding.js";
84
+ import { getDefaultFieldId, getFieldId } from "./components/field_ids.js";
85
+ import { DEFAULT_FIELD_CONFIGS, getDefaultFieldConfig, getFieldConfig } from "./components/field_configs.js";
86
+ import { PropertyFieldBinding } from "./form/PropertyFieldBinding.js";
87
+ import { extractTouchedValues, getChanges, getInitialEntityValues, removeEmptyContainers, zodToFormErrors } from "./form/form_utils.js";
88
+ import { EntityForm } from "./form/EntityForm.js";
89
+ import { EntityFormBinding } from "./form/EntityFormBinding.js";
90
+ import { CustomViewRoute } from "./routes/CustomViewRoute.js";
91
+ import { resolveEntityAction, resolveEntityView } from "./util/resolutions.js";
92
+ import { RebaseRoute } from "./routes/RebaseRoute.js";
93
+ import { EntityViewBinding } from "./components/EntityViewBinding.js";
94
+ import { MAX_SELECTION_ROWS, SELECTION_PAGE_SIZE, resolveSelection, selectionQueryToFindParams, serializeSelectionQuery } from "./selection/resolve_selection.js";
95
+ import { SelectionMenu } from "./selection/SelectionMenu.js";
96
+ import { FieldCaption } from "./components/FieldCaption.js";
97
+ import { SearchIconsView } from "./components/SearchIconsView.js";
98
+ import { PropertyConfigBadge } from "./components/PropertyConfigBadge.js";
99
+ import { downloadBlob, downloadDataAsCsv, downloadEntitiesExport, entryToCSVRow, escapeCsvFormula, getEntityCSVExportableData, getEntityJsonExportableData, unescapeCsvFormula } from "./data_export/export/export.js";
100
+ import { detectCsvDelimiter, parseCsvRows, parseCsvToObjects } from "./data_import/utils/csv.js";
101
+ import { convertFileToJson } from "./data_import/utils/file_to_json.js";
102
+ import { ImportFileUpload } from "./data_import/components/ImportFileUpload.js";
103
+ import { IMPORT_BATCH_MAX_BYTES, IMPORT_BATCH_SIZE, saveImportedEntities } from "./data_import/utils/save_entities.js";
104
+ import { ImportSaveInProgress } from "./data_import/components/ImportSaveInProgress.js";
105
+ import { useImportConfig } from "./data_import/hooks/useImportConfig.js";
106
+ import { getInferenceType } from "./data_import/utils/get_import_inference_type.js";
107
+ import { convertDataToEntity, convertImportData, flattenEntry, mappedColumnTarget, processValueMapping, slashDateOrdersByColumn } from "./data_import/utils/data.js";
108
+ import { ImportConversionProblems } from "./data_import/components/ImportConversionProblems.js";
109
+ import { DataNewPropertiesMapping } from "./data_import/components/DataNewPropertiesMapping.js";
110
+ import { ImportNewPropertyFieldPreview } from "./data_import/components/ImportNewPropertyFieldPreview.js";
111
+ import { useCollectionEditorController } from "./collection_editor/useCollectionEditorController.js";
112
+ import { CollectionViewActions } from "./components/CollectionViewBinding/CollectionViewActions.js";
113
+ import { EntityCardBinding } from "./components/CollectionViewBinding/EntityCardBinding.js";
114
+ import { CollectionCardViewBinding } from "./components/CollectionViewBinding/CollectionCardViewBinding.js";
115
+ import { CollectionViewBinding } from "./components/CollectionViewBinding/CollectionViewBinding.js";
116
+ import { ReferenceWidget } from "./components/ReferenceWidget.js";
117
+ import { SidePanelProvider } from "./components/SidePanelProvider.js";
118
+ import { AdminModeSyncer } from "./components/AdminModeSyncer.js";
119
+ import { useApp } from "./components/app/useApp.js";
120
+ import { AppBar } from "./components/app/AppBar.js";
121
+ import { DrawerNavigationItem } from "./components/DrawerNavigationItem.js";
122
+ import { DrawerNavigationGroup } from "./components/DrawerNavigationGroup.js";
123
+ import { DefaultDrawer, DrawerFooterActions } from "./components/DefaultDrawer.js";
124
+ import { Drawer } from "./components/app/Drawer.js";
125
+ import { Scaffold } from "./components/app/Scaffold.js";
126
+ import { RebaseCMS } from "./components/RebaseCMS.js";
127
+ import { RebaseAuthGate } from "./components/RebaseAuthGate.js";
128
+ import { LiveSchemaError, SchemaChangeCancelled, asUnavailable, createLiveSchemaClient, isSchemaChangeCancelled } from "./collection_editor/liveSchemaClient.js";
129
+ import { useLiveSchemaEditing } from "./collection_editor/useLiveSchemaEditing.js";
130
+ import { useLocalCollectionsConfigController } from "./collection_editor/useLocalCollectionsConfigController.js";
131
+ import { useCollectionsConfigController } from "./collection_editor/useCollectionsConfigController.js";
132
+ import { RebaseNavigation } from "./components/RebaseNavigation.js";
133
+ import { RebaseLayout } from "./components/RebaseLayout.js";
134
+ import { RebaseRouteDefs } from "./components/RebaseRouteDefs.js";
135
+ import { RebaseShell } from "./components/RebaseShell.js";
136
+ import { CollectionsProvider } from "./components/CollectionsProvider.js";
137
+ import { CollectionPanel } from "./components/CollectionPanel.js";
138
+ import { EntityFormPanel } from "./components/EntityFormPanel.js";
139
+ import { mapPropertiesToConfigs, mapPropertyToConfig } from "./util/propertyConfigMapper.js";
140
+ import { createStaticDataController, useCollectionDataController } from "./util/dataControllerAdapter.js";
141
+ import { ImportCollectionAction, ImportDataPreview, PropertySelectEntry } from "./data_import/import/ImportCollectionAction.js";
142
+ import { EXPORT_PAGE_SIZE, MAX_EXPORT_ROWS, fetchAllEntitiesForExport } from "./data_export/export/fetch_export_data.js";
143
+ import { BasicExportAction } from "./data_export/export/BasicExportAction.js";
144
+ import { ExportCollectionAction } from "./data_export/export/ExportCollectionAction.js";
145
+ import { fromSerializableCollectionConfig, fromSerializableCollectionConfigs, fromSerializableProperties, fromSerializableProperty, toSerializableCollectionConfig, toSerializableProperties, toSerializableProperty } from "./collection_editor/serializable_utils.js";
146
+ import { useJsonCollectionsConfigController } from "./collection_editor/useJsonCollectionsConfigController.js";
147
+ import { validateCollectionJson } from "./collection_editor/validateCollectionJson.js";
148
+ import { CollectionGenerationApiError, DEFAULT_COLLECTION_GENERATION_ENDPOINT, buildCollectionGenerationCallback } from "./collection_editor/api/generateCollectionApi.js";
149
+ import { MissingReferenceWidget } from "./collection_editor/ui/MissingReferenceWidget.js";
150
+ import { getFullId, getFullIdPath, idToPropertiesPath, namespaceToPropertiesOrderPath, namespaceToPropertiesPath } from "./collection_editor/ui/collection_editor/util.js";
151
+ export { AdminModeSyncer, AppBar, ArrayContainer, ArrayCustomShapedFieldBinding, ArrayEnumPreview, ArrayOfMapsPreview, ArrayOfReferencesFieldBinding, ArrayOfReferencesPreview, ArrayOfStorageComponentsPreview, ArrayOfStringsPreview, ArrayOneOfPreview, ArrayPropertyEnumPreview, ArrayPropertyPreview, BasicExportAction, BlockFieldBinding, BooleanPreview, CollectionCardViewBinding, CollectionGenerationApiError, CollectionPanel, CollectionRegistryContext, CollectionRowActions, CollectionTableBinding, CollectionViewActions, CollectionViewBinding, CollectionsProvider, CreationResultDialog, CustomViewRoute, DEFAULT_COLLECTION_GENERATION_ENDPOINT, DEFAULT_FIELD_CONFIGS, DataNewPropertiesMapping, DatePreview, DateTimeFieldBinding, DefaultDrawer, Drawer, DrawerFooterActions, DrawerNavigationGroup, DrawerNavigationItem, EXPORT_PAGE_SIZE, EditorAIControllerProvider, EmptyValue, EntityCardBinding, EntityForm, EntityFormBinding, EntityFormPanel, EntityPreviewBinding, EntityViewBinding, EnumValuesChip, ExportCollectionAction, FieldBlock, FieldCaption, FieldHelperText, FormRail, FormSections, IMPORT_BATCH_MAX_BYTES, IMPORT_BATCH_SIZE, ImagePreview, ImportCollectionAction, ImportConversionProblems, ImportDataPreview, ImportFileUpload, ImportNewPropertyFieldPreview, ImportSaveInProgress, InlineEntityListPreview, KeyValueFieldBinding, KeyValuePreview, LABEL_ICON_SIZE, LabelWithIcon, LiveSchemaError, MAX_EXPORT_ROWS, MAX_SELECTION_ROWS, MapFieldBinding, MapPropertyPreview, MarkdownEditorFieldBinding, MissingReferenceWidget, MultiSelectFieldBinding, NavigationStateContext, NumberPropertyPreview, PropertyConfigBadge, PropertyFieldBinding, PropertyKeyHint, PropertyPreview, PropertySelectEntry, ReadOnlyFieldBinding, RebaseAuthGate, RebaseCMS, RebaseLayout, RebaseNavigation, RebaseRoute, RebaseRouteDefs, RebaseShell, RecordMeta, ReferenceFieldBinding, ReferencePreview, ReferenceWidget, RelationPreview, RepeatFieldBinding, SELECTION_PAGE_SIZE, Scaffold, SchemaChangeCancelled, SearchIconsView, SelectFieldBinding, SelectableTable, SelectableTableContext, SelectionMenu, SelectionTableBinding, SideDialogs, SidePanelControllerContext, SidePanelProvider, SkeletonPropertyComponent, StorageThumbnail, StorageThumbnailInternal, StorageUploadFieldBinding, StringPropertyPreview, SwitchFieldBinding, TextFieldBinding, UrlComponentPreview, UrlContext, UserPreview, VectorFieldBinding, VirtualTableInput, addInitialSlash, asUnavailable, buildCollectionGenerationCallback, buildSidePanelsFromUrl, convertDataToEntity, convertFileToJson, convertImportData, copyEntityAction, createLiveSchemaClient, createStaticDataController, deleteEntityAction, detectCsvDelimiter, downloadBlob, downloadDataAsCsv, downloadEntitiesExport, editEntityAction, entryToCSVRow, escapeCsvFormula, extractTouchedValues, fetchAllEntitiesForExport, flattenEntry, fromSerializableCollectionConfig, fromSerializableCollectionConfigs, fromSerializableProperties, fromSerializableProperty, getBracketNotation, getChanges, getCollectionBySlugWithin, getCollectionPathsCombinations, getDefaultFieldConfig, getDefaultFieldId, getDefaultPropertiesOrder, getEntityCSVExportableData, getEntityJsonExportableData, getEntityPreviewKeys, getEntityTitlePropertyKey, getEntityTitlePropertyKeyForEntity, getEntityViewWidth, getFieldConfig, getFieldId, getFullId, getFullIdPath, getIconForProperty, getIconForWidget, getInferenceType, getInitialEntityValues, getLastSegment, getPropertiesWithPropertiesOrder, getPropertyInPath, getResolvedPropertyInPath, getUserLabel, idToPropertiesPath, isReferenceProperty, isRelationProperty, isSchemaChangeCancelled, isSelfLabellingProperty, mapPropertiesToConfigs, mapPropertyToConfig, mappedColumnTarget, mergeEntityActions, namespaceToPropertiesOrderPath, namespaceToPropertiesPath, parseCsvRows, parseCsvToObjects, processValueMapping, removeEmptyContainers, removeInitialAndTrailingSlashes, removeInitialSlash, removeTrailingSlash, renderSkeletonCaptionText, renderSkeletonIcon, renderSkeletonImageThumbnail, renderSkeletonText, resetPasswordAction, resolveCollectionPathIds, resolveEntityAction, resolveEntityView, resolveNavigationFrom, resolveSelection, sanitizeUrl, saveImportedEntities, selectionQueryToFindParams, serializeSelectionQuery, slashDateOrdersByColumn, spanClass, toSerializableCollectionConfig, toSerializableProperties, toSerializableProperty, unescapeCsvFormula, useAdminContext, useApp, useBreadcrumbsController, useBuildCollectionRegistryController, useBuildNavigationStateController, useBuildSidePanel, useBuildUrlController, useClearRestoreValue, useCollectionDataController, useCollectionEditorController, useCollectionRegistryController, useCollectionsConfigController, useHistory, useImportConfig, useJsonCollectionsConfigController, useLiveSchemaEditing, useLocalCollectionsConfigController, useNavigationStateController, useProvidedEditorAIController, useResolvedCollections, useResolvedNavigationFrom, useResolvedUser, useResolvedViews, useSelectionController, useSelectionDialog, useSideDialogsController, useSidePanel, useTopLevelNavigation, useUrlController, validateCollectionJson, zodToFormErrors };