@payloadcms/ui 4.0.0-internal.af6aad0 → 4.0.0-internal.b8a92d2

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 (855) hide show
  1. package/dist/css/app.css +1 -0
  2. package/dist/css/colors.css +9 -8
  3. package/dist/css/forms.css +1 -0
  4. package/dist/css/preflight.css +1 -0
  5. package/dist/css/spacing.css +12 -0
  6. package/dist/css/typography.css +158 -14
  7. package/dist/elements/APIKeyInput/index.d.ts +2 -0
  8. package/dist/elements/APIKeyInput/index.d.ts.map +1 -1
  9. package/dist/elements/APIKeyInput/index.js +27 -29
  10. package/dist/elements/APIKeyInput/index.js.map +1 -1
  11. package/dist/elements/AddNewRelation/index.css +4 -0
  12. package/dist/elements/AddNewRelation/index.js +2 -2
  13. package/dist/elements/AddNewRelation/index.js.map +1 -1
  14. package/dist/elements/AppHeader/EditViewWidthSettings/index.css +5 -0
  15. package/dist/elements/AppHeader/EditViewWidthSettings/index.d.ts +4 -0
  16. package/dist/elements/AppHeader/EditViewWidthSettings/index.d.ts.map +1 -0
  17. package/dist/elements/AppHeader/EditViewWidthSettings/index.js +77 -0
  18. package/dist/elements/AppHeader/EditViewWidthSettings/index.js.map +1 -0
  19. package/dist/{icons/CollapseLayers → elements/AppHeader/SettingsMenu}/index.css +1 -1
  20. package/dist/elements/AppHeader/SettingsMenu/index.d.ts +4 -0
  21. package/dist/elements/AppHeader/SettingsMenu/index.d.ts.map +1 -0
  22. package/dist/elements/AppHeader/SettingsMenu/index.js +59 -0
  23. package/dist/elements/AppHeader/SettingsMenu/index.js.map +1 -0
  24. package/dist/elements/AppHeader/TypeSizeSettings/index.d.ts +3 -0
  25. package/dist/elements/AppHeader/TypeSizeSettings/index.d.ts.map +1 -0
  26. package/dist/elements/AppHeader/TypeSizeSettings/index.js +58 -0
  27. package/dist/elements/AppHeader/TypeSizeSettings/index.js.map +1 -0
  28. package/dist/elements/AppHeader/index.css +3 -4
  29. package/dist/elements/AppHeader/index.d.ts +8 -1
  30. package/dist/elements/AppHeader/index.d.ts.map +1 -1
  31. package/dist/elements/AppHeader/index.js +16 -6
  32. package/dist/elements/AppHeader/index.js.map +1 -1
  33. package/dist/elements/Autosave/index.d.ts.map +1 -1
  34. package/dist/elements/Autosave/index.js +2 -3
  35. package/dist/elements/Autosave/index.js.map +1 -1
  36. package/dist/elements/Banner/index.css +4 -0
  37. package/dist/elements/Banner/index.d.ts.map +1 -1
  38. package/dist/elements/Banner/index.js +1 -0
  39. package/dist/elements/Banner/index.js.map +1 -1
  40. package/dist/elements/BulkUpload/ActionsBar/index.css +1 -0
  41. package/dist/elements/BulkUpload/AddingFilesView/index.css +2 -4
  42. package/dist/elements/BulkUpload/FileSidebar/index.css +1 -0
  43. package/dist/elements/BulkUpload/FormsManager/createFormData.d.ts +1 -1
  44. package/dist/elements/BulkUpload/FormsManager/createFormData.d.ts.map +1 -1
  45. package/dist/elements/BulkUpload/FormsManager/createFormData.js +7 -3
  46. package/dist/elements/BulkUpload/FormsManager/createFormData.js.map +1 -1
  47. package/dist/elements/BulkUpload/FormsManager/index.d.ts.map +1 -1
  48. package/dist/elements/BulkUpload/FormsManager/index.js +18 -12
  49. package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
  50. package/dist/elements/BulkUpload/index.css +2 -0
  51. package/dist/elements/Button/index.css +0 -23
  52. package/dist/elements/Button/types.d.ts +1 -1
  53. package/dist/elements/Button/types.d.ts.map +1 -1
  54. package/dist/elements/Button/types.js.map +1 -1
  55. package/dist/elements/Collapsible/index.css +1 -0
  56. package/dist/elements/CopyLocaleData/index.d.ts.map +1 -1
  57. package/dist/elements/CopyLocaleData/index.js +8 -9
  58. package/dist/elements/CopyLocaleData/index.js.map +1 -1
  59. package/dist/elements/DatePicker/index.css +2 -0
  60. package/dist/elements/DefaultListViewTabs/index.css +0 -1
  61. package/dist/elements/DefaultListViewTabs/index.d.ts.map +1 -1
  62. package/dist/elements/DefaultListViewTabs/index.js +62 -84
  63. package/dist/elements/DefaultListViewTabs/index.js.map +1 -1
  64. package/dist/elements/DeleteMany/index.d.ts.map +1 -1
  65. package/dist/elements/DeleteMany/index.js +2 -3
  66. package/dist/elements/DeleteMany/index.js.map +1 -1
  67. package/dist/elements/Dialog/index.css +1 -0
  68. package/dist/elements/DocumentControls/index.css +1 -0
  69. package/dist/elements/DocumentDrawer/types.d.ts +1 -1
  70. package/dist/elements/DocumentDrawer/types.d.ts.map +1 -1
  71. package/dist/elements/DocumentDrawer/types.js.map +1 -1
  72. package/dist/elements/DocumentFields/index.css +2 -0
  73. package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts +1 -0
  74. package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts.map +1 -1
  75. package/dist/elements/DocumentHeader/Tabs/Tab/index.js +3 -2
  76. package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
  77. package/dist/elements/DocumentHeader/Tabs/index.css +1 -0
  78. package/dist/elements/DocumentHeader/Tabs/index.d.ts +1 -0
  79. package/dist/elements/DocumentHeader/Tabs/index.d.ts.map +1 -1
  80. package/dist/elements/DocumentHeader/Tabs/index.js +5 -3
  81. package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
  82. package/dist/elements/DocumentHeader/index.css +1 -0
  83. package/dist/elements/DocumentHeader/index.d.ts +1 -0
  84. package/dist/elements/DocumentHeader/index.d.ts.map +1 -1
  85. package/dist/elements/DocumentHeader/index.js +4 -2
  86. package/dist/elements/DocumentHeader/index.js.map +1 -1
  87. package/dist/elements/Drawer/types.d.ts +2 -2
  88. package/dist/elements/Drawer/types.d.ts.map +1 -1
  89. package/dist/elements/Drawer/types.js.map +1 -1
  90. package/dist/elements/DuplicateDocument/index.d.ts.map +1 -1
  91. package/dist/elements/DuplicateDocument/index.js +2 -3
  92. package/dist/elements/DuplicateDocument/index.js.map +1 -1
  93. package/dist/elements/EditMany/DrawerContent.d.ts.map +1 -1
  94. package/dist/elements/EditMany/DrawerContent.js +2 -3
  95. package/dist/elements/EditMany/DrawerContent.js.map +1 -1
  96. package/dist/elements/EditUpload/index.css +1 -1
  97. package/dist/elements/FieldDiffContainer/index.css +1 -0
  98. package/dist/elements/FieldDiffLabel/index.css +1 -0
  99. package/dist/elements/FileDetails/StaticFileDetails/index.css +2 -0
  100. package/dist/elements/HTMLDiff/index.css +1 -0
  101. package/dist/elements/Hierarchy/ColumnBrowser/Column/index.css +4 -22
  102. package/dist/elements/Hierarchy/ColumnBrowser/Column/index.d.ts.map +1 -1
  103. package/dist/elements/Hierarchy/ColumnBrowser/Column/index.js +49 -68
  104. package/dist/elements/Hierarchy/ColumnBrowser/Column/index.js.map +1 -1
  105. package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.css +15 -100
  106. package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.d.ts.map +1 -1
  107. package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.js +137 -97
  108. package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.js.map +1 -1
  109. package/dist/elements/Hierarchy/ColumnBrowser/index.d.ts +1 -1
  110. package/dist/elements/Hierarchy/ColumnBrowser/index.d.ts.map +1 -1
  111. package/dist/elements/Hierarchy/ColumnBrowser/index.js +23 -51
  112. package/dist/elements/Hierarchy/ColumnBrowser/index.js.map +1 -1
  113. package/dist/elements/Hierarchy/ColumnBrowser/types.d.ts +3 -26
  114. package/dist/elements/Hierarchy/ColumnBrowser/types.d.ts.map +1 -1
  115. package/dist/elements/Hierarchy/ColumnBrowser/types.js.map +1 -1
  116. package/dist/elements/Hierarchy/DocHeaderButton/index.d.ts.map +1 -1
  117. package/dist/elements/Hierarchy/DocHeaderButton/index.js +1 -6
  118. package/dist/elements/Hierarchy/DocHeaderButton/index.js.map +1 -1
  119. package/dist/elements/Hierarchy/DocHeaderButton/index.server.js +3 -1
  120. package/dist/elements/Hierarchy/DocHeaderButton/index.server.js.map +1 -1
  121. package/dist/elements/Hierarchy/Field/SelectedHierarchies.css +36 -0
  122. package/dist/elements/Hierarchy/Field/SelectedHierarchies.d.ts +13 -0
  123. package/dist/elements/Hierarchy/Field/SelectedHierarchies.d.ts.map +1 -0
  124. package/dist/elements/Hierarchy/Field/SelectedHierarchies.js +141 -0
  125. package/dist/elements/Hierarchy/Field/SelectedHierarchies.js.map +1 -0
  126. package/dist/elements/Hierarchy/Field/index.client.d.ts +0 -5
  127. package/dist/elements/Hierarchy/Field/index.client.d.ts.map +1 -1
  128. package/dist/elements/Hierarchy/Field/index.client.js +95 -120
  129. package/dist/elements/Hierarchy/Field/index.client.js.map +1 -1
  130. package/dist/elements/Hierarchy/Field/index.css +34 -3
  131. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.d.ts +4 -18
  132. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.d.ts.map +1 -1
  133. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.js +24 -88
  134. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.js.map +1 -1
  135. package/dist/elements/Hierarchy/Modal/index.css +53 -4
  136. package/dist/elements/Hierarchy/Modal/index.d.ts +2 -5
  137. package/dist/elements/Hierarchy/Modal/index.d.ts.map +1 -1
  138. package/dist/elements/Hierarchy/Modal/index.js +99 -136
  139. package/dist/elements/Hierarchy/Modal/index.js.map +1 -1
  140. package/dist/elements/Hierarchy/Modal/types.d.ts +0 -15
  141. package/dist/elements/Hierarchy/Modal/types.d.ts.map +1 -1
  142. package/dist/elements/Hierarchy/Modal/types.js.map +1 -1
  143. package/dist/elements/Hierarchy/MoveMany/index.d.ts +3 -7
  144. package/dist/elements/Hierarchy/MoveMany/index.d.ts.map +1 -1
  145. package/dist/elements/Hierarchy/MoveMany/index.js +171 -45
  146. package/dist/elements/Hierarchy/MoveMany/index.js.map +1 -1
  147. package/dist/elements/Hierarchy/Search/index.css +9 -2
  148. package/dist/elements/Hierarchy/Search/index.d.ts.map +1 -1
  149. package/dist/elements/Hierarchy/Search/index.js +73 -6
  150. package/dist/elements/Hierarchy/Search/index.js.map +1 -1
  151. package/dist/elements/Hierarchy/Search/types.d.ts +6 -2
  152. package/dist/elements/Hierarchy/Search/types.d.ts.map +1 -1
  153. package/dist/elements/Hierarchy/Search/types.js.map +1 -1
  154. package/dist/elements/Hierarchy/Search/useHierarchySearch.d.ts.map +1 -1
  155. package/dist/elements/Hierarchy/Search/useHierarchySearch.js +2 -3
  156. package/dist/elements/Hierarchy/Search/useHierarchySearch.js.map +1 -1
  157. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.d.ts +4 -0
  158. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.d.ts.map +1 -1
  159. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.js +186 -101
  160. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.js.map +1 -1
  161. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.d.ts.map +1 -1
  162. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.js +21 -1
  163. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.js.map +1 -1
  164. package/dist/elements/Hierarchy/Tree/LoadMore/index.css +3 -3
  165. package/dist/elements/Hierarchy/Tree/TreeNode/index.css +29 -59
  166. package/dist/elements/Hierarchy/Tree/TreeNode/index.d.ts +1 -1
  167. package/dist/elements/Hierarchy/Tree/TreeNode/index.d.ts.map +1 -1
  168. package/dist/elements/Hierarchy/Tree/TreeNode/index.js +10 -54
  169. package/dist/elements/Hierarchy/Tree/TreeNode/index.js.map +1 -1
  170. package/dist/elements/Hierarchy/Tree/index.css +9 -8
  171. package/dist/elements/Hierarchy/Tree/index.d.ts.map +1 -1
  172. package/dist/elements/Hierarchy/Tree/index.js +47 -29
  173. package/dist/elements/Hierarchy/Tree/index.js.map +1 -1
  174. package/dist/elements/Hierarchy/Tree/types.d.ts +1 -9
  175. package/dist/elements/Hierarchy/Tree/types.d.ts.map +1 -1
  176. package/dist/elements/Hierarchy/Tree/types.js.map +1 -1
  177. package/dist/elements/Hierarchy/Tree/useChildren.d.ts.map +1 -1
  178. package/dist/elements/Hierarchy/Tree/useChildren.js +1 -11
  179. package/dist/elements/Hierarchy/Tree/useChildren.js.map +1 -1
  180. package/dist/elements/ItemsDrawer/index.css +3 -0
  181. package/dist/elements/ListControls/index.css +1 -0
  182. package/dist/elements/ListControls/index.d.ts.map +1 -1
  183. package/dist/elements/ListControls/index.js +7 -2
  184. package/dist/elements/ListControls/index.js.map +1 -1
  185. package/dist/elements/ListControls/types.d.ts +3 -5
  186. package/dist/elements/ListControls/types.d.ts.map +1 -1
  187. package/dist/elements/ListControls/types.js.map +1 -1
  188. package/dist/elements/ListControlsBar/index.css +1 -0
  189. package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.d.ts.map +1 -1
  190. package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.js +3 -4
  191. package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.js.map +1 -1
  192. package/dist/elements/LivePreview/Window/index.css +1 -0
  193. package/dist/elements/LivePreview/Window/index.js +1 -1
  194. package/dist/elements/LivePreview/Window/index.js.map +1 -1
  195. package/dist/elements/Localizer/index.js +1 -1
  196. package/dist/elements/Localizer/index.js.map +1 -1
  197. package/dist/elements/Nav/NavSidebarToggle/index.js +1 -1
  198. package/dist/elements/Nav/NavSidebarToggle/index.js.map +1 -1
  199. package/dist/elements/Nav/NavWrapper/index.d.ts +0 -1
  200. package/dist/elements/Nav/NavWrapper/index.d.ts.map +1 -1
  201. package/dist/elements/Nav/NavWrapper/index.js +18 -12
  202. package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
  203. package/dist/elements/Nav/SidebarTabs/index.css +2 -1
  204. package/dist/elements/Nav/SidebarTabs/renderTabServerFn.js +3 -2
  205. package/dist/elements/Nav/SidebarTabs/renderTabServerFn.js.map +1 -1
  206. package/dist/elements/Nav/context.d.ts +1 -0
  207. package/dist/elements/Nav/context.d.ts.map +1 -1
  208. package/dist/elements/Nav/context.js +67 -92
  209. package/dist/elements/Nav/context.js.map +1 -1
  210. package/dist/elements/Nav/index.css +44 -47
  211. package/dist/elements/Nav/index.d.ts +0 -4
  212. package/dist/elements/Nav/index.d.ts.map +1 -1
  213. package/dist/elements/Nav/index.js +1 -16
  214. package/dist/elements/Nav/index.js.map +1 -1
  215. package/dist/elements/NavGroup/index.css +15 -29
  216. package/dist/elements/PageControls/index.css +1 -0
  217. package/dist/elements/PillSelector/index.css +1 -0
  218. package/dist/elements/Popup/PopupButtonList/index.css +16 -32
  219. package/dist/elements/Popup/index.css +0 -6
  220. package/dist/elements/Popup/index.d.ts +0 -10
  221. package/dist/elements/Popup/index.d.ts.map +1 -1
  222. package/dist/elements/Popup/index.js +5 -12
  223. package/dist/elements/Popup/index.js.map +1 -1
  224. package/dist/elements/PreviewSizes/index.css +2 -0
  225. package/dist/elements/PublishButton/ScheduleDrawer/index.d.ts.map +1 -1
  226. package/dist/elements/PublishButton/ScheduleDrawer/index.js +8 -30
  227. package/dist/elements/PublishButton/ScheduleDrawer/index.js.map +1 -1
  228. package/dist/elements/PublishButton/ScheduleDrawer/types.d.ts +1 -1
  229. package/dist/elements/PublishButton/ScheduleDrawer/types.d.ts.map +1 -1
  230. package/dist/elements/PublishButton/ScheduleDrawer/types.js.map +1 -1
  231. package/dist/elements/PublishButton/index.css +1 -0
  232. package/dist/elements/PublishButton/index.d.ts.map +1 -1
  233. package/dist/elements/PublishButton/index.js +16 -31
  234. package/dist/elements/PublishButton/index.js.map +1 -1
  235. package/dist/elements/PublishMany/DrawerContent.d.ts.map +1 -1
  236. package/dist/elements/PublishMany/DrawerContent.js +2 -3
  237. package/dist/elements/PublishMany/DrawerContent.js.map +1 -1
  238. package/dist/elements/QueryPresets/QueryPresetBar/index.d.ts.map +1 -1
  239. package/dist/elements/QueryPresets/QueryPresetBar/index.js +14 -1
  240. package/dist/elements/QueryPresets/QueryPresetBar/index.js.map +1 -1
  241. package/dist/elements/QueryPresets/fields/Heading/index.css +1 -0
  242. package/dist/elements/ReactSelect/types.d.ts +0 -5
  243. package/dist/elements/ReactSelect/types.d.ts.map +1 -1
  244. package/dist/elements/ReactSelect/types.js.map +1 -1
  245. package/dist/elements/RenderTitle/index.css +1 -0
  246. package/dist/elements/RestoreMany/index.d.ts.map +1 -1
  247. package/dist/elements/RestoreMany/index.js +2 -3
  248. package/dist/elements/RestoreMany/index.js.map +1 -1
  249. package/dist/elements/SaveDraftButton/index.d.ts.map +1 -1
  250. package/dist/elements/SaveDraftButton/index.js +2 -3
  251. package/dist/elements/SaveDraftButton/index.js.map +1 -1
  252. package/dist/elements/SelectAll/index.d.ts.map +1 -1
  253. package/dist/elements/SelectAll/index.js +2 -1
  254. package/dist/elements/SelectAll/index.js.map +1 -1
  255. package/dist/elements/SelectRow/index.d.ts.map +1 -1
  256. package/dist/elements/SelectRow/index.js +2 -1
  257. package/dist/elements/SelectRow/index.js.map +1 -1
  258. package/dist/elements/SidebarRow/index.css +5 -1
  259. package/dist/elements/SidebarToggle/index.css +1 -3
  260. package/dist/elements/Status/index.d.ts.map +1 -1
  261. package/dist/elements/Status/index.js +2 -3
  262. package/dist/elements/Status/index.js.map +1 -1
  263. package/dist/elements/StepNav/index.d.ts.map +1 -1
  264. package/dist/elements/StepNav/index.js +10 -14
  265. package/dist/elements/StepNav/index.js.map +1 -1
  266. package/dist/elements/StepNav/types.d.ts +0 -6
  267. package/dist/elements/StepNav/types.d.ts.map +1 -1
  268. package/dist/elements/StepNav/types.js.map +1 -1
  269. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.css +7 -5
  270. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.d.ts.map +1 -1
  271. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js +3 -14
  272. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js.map +1 -1
  273. package/dist/elements/Table/OrderableTable.d.ts.map +1 -1
  274. package/dist/elements/Table/OrderableTable.js +2 -3
  275. package/dist/elements/Table/OrderableTable.js.map +1 -1
  276. package/dist/elements/Table/RelationshipProvider/index.d.ts.map +1 -1
  277. package/dist/elements/Table/RelationshipProvider/index.js +2 -3
  278. package/dist/elements/Table/RelationshipProvider/index.js.map +1 -1
  279. package/dist/elements/Table/index.css +1 -0
  280. package/dist/elements/TableSection/index.css +1 -0
  281. package/dist/elements/Tabs/index.css +1 -0
  282. package/dist/elements/Thumbnail/index.css +1 -0
  283. package/dist/elements/TimezonePicker/index.css +1 -0
  284. package/dist/elements/Tooltip/index.css +7 -0
  285. package/dist/elements/UnpublishButton/index.d.ts.map +1 -1
  286. package/dist/elements/UnpublishButton/index.js +3 -4
  287. package/dist/elements/UnpublishButton/index.js.map +1 -1
  288. package/dist/elements/UnpublishMany/DrawerContent.d.ts.map +1 -1
  289. package/dist/elements/UnpublishMany/DrawerContent.js +2 -3
  290. package/dist/elements/UnpublishMany/DrawerContent.js.map +1 -1
  291. package/dist/elements/UserMenu/LanguageMenu/index.d.ts.map +1 -1
  292. package/dist/elements/UserMenu/LanguageMenu/index.js +39 -83
  293. package/dist/elements/UserMenu/LanguageMenu/index.js.map +1 -1
  294. package/dist/elements/UserMenu/SettingsMenu/index.d.ts.map +1 -1
  295. package/dist/elements/UserMenu/SettingsMenu/index.js +21 -57
  296. package/dist/elements/UserMenu/SettingsMenu/index.js.map +1 -1
  297. package/dist/elements/UserMenu/ThemeMenu/index.d.ts.map +1 -1
  298. package/dist/elements/UserMenu/ThemeMenu/index.js +39 -83
  299. package/dist/elements/UserMenu/ThemeMenu/index.js.map +1 -1
  300. package/dist/elements/UserMenu/index.css +2 -32
  301. package/dist/elements/UserMenu/index.d.ts +0 -1
  302. package/dist/elements/UserMenu/index.d.ts.map +1 -1
  303. package/dist/elements/UserMenu/index.js +51 -77
  304. package/dist/elements/UserMenu/index.js.map +1 -1
  305. package/dist/elements/WhereBuilder/Condition/Relationship/index.js +1 -1
  306. package/dist/elements/WhereBuilder/Condition/Relationship/index.js.map +1 -1
  307. package/dist/elements/WhereBuilder/Condition/index.css +1 -0
  308. package/dist/elements/WhereBuilder/index.css +2 -0
  309. package/dist/exports/client/index.d.ts +2 -4
  310. package/dist/exports/client/index.d.ts.map +1 -1
  311. package/dist/exports/client/index.js +1 -1
  312. package/dist/exports/client/index.js.map +3 -3
  313. package/dist/exports/rsc/index.d.ts +2 -0
  314. package/dist/exports/rsc/index.d.ts.map +1 -1
  315. package/dist/exports/rsc/index.js +2 -0
  316. package/dist/exports/rsc/index.js.map +1 -1
  317. package/dist/fields/Array/index.css +1 -0
  318. package/dist/fields/Array/index.d.ts.map +1 -1
  319. package/dist/fields/Array/index.js +2 -3
  320. package/dist/fields/Array/index.js.map +1 -1
  321. package/dist/fields/Blocks/index.css +1 -0
  322. package/dist/fields/Blocks/index.d.ts.map +1 -1
  323. package/dist/fields/Blocks/index.js +2 -3
  324. package/dist/fields/Blocks/index.js.map +1 -1
  325. package/dist/fields/Checkbox/Input.d.ts +2 -2
  326. package/dist/fields/Checkbox/Input.d.ts.map +1 -1
  327. package/dist/fields/Checkbox/Input.js +152 -134
  328. package/dist/fields/Checkbox/Input.js.map +1 -1
  329. package/dist/fields/Checkbox/index.css +163 -168
  330. package/dist/fields/FieldDescription/index.css +5 -0
  331. package/dist/fields/FieldLabel/index.css +8 -27
  332. package/dist/fields/FieldLabel/index.d.ts.map +1 -1
  333. package/dist/fields/FieldLabel/index.js +4 -5
  334. package/dist/fields/FieldLabel/index.js.map +1 -1
  335. package/dist/fields/Group/index.css +1 -0
  336. package/dist/fields/RadioGroup/Radio/index.css +1 -0
  337. package/dist/fields/RadioGroup/index.css +1 -1
  338. package/dist/fields/Relationship/Input.d.ts.map +1 -1
  339. package/dist/fields/Relationship/Input.js +8 -27
  340. package/dist/fields/Relationship/Input.js.map +1 -1
  341. package/dist/fields/Relationship/optionsReducer.d.ts.map +1 -1
  342. package/dist/fields/Relationship/optionsReducer.js +0 -2
  343. package/dist/fields/Relationship/optionsReducer.js.map +1 -1
  344. package/dist/fields/Relationship/types.d.ts +0 -24
  345. package/dist/fields/Relationship/types.d.ts.map +1 -1
  346. package/dist/fields/Relationship/types.js.map +1 -1
  347. package/dist/fields/Row/index.css +2 -0
  348. package/dist/fields/Slug/index.d.ts.map +1 -1
  349. package/dist/fields/Slug/index.js +2 -3
  350. package/dist/fields/Slug/index.js.map +1 -1
  351. package/dist/fields/Tabs/index.css +1 -0
  352. package/dist/fields/Textarea/index.css +1 -1
  353. package/dist/fields/Upload/Input.d.ts.map +1 -1
  354. package/dist/fields/Upload/Input.js +2 -3
  355. package/dist/fields/Upload/Input.js.map +1 -1
  356. package/dist/fields/shared/index.d.ts +1 -1
  357. package/dist/fields/shared/index.d.ts.map +1 -1
  358. package/dist/fields/shared/index.js.map +1 -1
  359. package/dist/forms/Form/context.d.ts +3 -1
  360. package/dist/forms/Form/context.d.ts.map +1 -1
  361. package/dist/forms/Form/context.js +3 -1
  362. package/dist/forms/Form/context.js.map +1 -1
  363. package/dist/forms/Form/index.d.ts.map +1 -1
  364. package/dist/forms/Form/index.js +15 -7
  365. package/dist/forms/Form/index.js.map +1 -1
  366. package/dist/forms/NullifyField/index.d.ts.map +1 -1
  367. package/dist/forms/NullifyField/index.js +2 -3
  368. package/dist/forms/NullifyField/index.js.map +1 -1
  369. package/dist/forms/RenderFields/index.css +1 -7
  370. package/dist/forms/fieldSchemasToFormState/renderField.d.ts.map +1 -1
  371. package/dist/forms/fieldSchemasToFormState/renderField.js +3 -2
  372. package/dist/forms/fieldSchemasToFormState/renderField.js.map +1 -1
  373. package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.d.ts +12 -0
  374. package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.d.ts.map +1 -0
  375. package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.js +42 -0
  376. package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.js.map +1 -0
  377. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.d.ts +8 -6
  378. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.d.ts.map +1 -1
  379. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js +22 -9
  380. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js.map +1 -1
  381. package/dist/forms/fieldSchemasToFormState/types.d.ts +1 -0
  382. package/dist/forms/fieldSchemasToFormState/types.d.ts.map +1 -1
  383. package/dist/forms/fieldSchemasToFormState/types.js.map +1 -1
  384. package/dist/hooks/useControllableState.js +3 -3
  385. package/dist/hooks/useControllableState.js.map +1 -1
  386. package/dist/hooks/usePayloadAPI.d.ts.map +1 -1
  387. package/dist/hooks/usePayloadAPI.js +2 -3
  388. package/dist/hooks/usePayloadAPI.js.map +1 -1
  389. package/dist/layouts/Root/index.d.ts.map +1 -1
  390. package/dist/layouts/Root/index.js +19 -5
  391. package/dist/layouts/Root/index.js.map +1 -1
  392. package/dist/providers/DocumentInfo/index.d.ts.map +1 -1
  393. package/dist/providers/DocumentInfo/index.js +32 -22
  394. package/dist/providers/DocumentInfo/index.js.map +1 -1
  395. package/dist/providers/Hierarchy/index.d.ts.map +1 -1
  396. package/dist/providers/Hierarchy/index.js +24 -53
  397. package/dist/providers/Hierarchy/index.js.map +1 -1
  398. package/dist/providers/Hierarchy/types.d.ts +0 -2
  399. package/dist/providers/Hierarchy/types.d.ts.map +1 -1
  400. package/dist/providers/Hierarchy/types.js.map +1 -1
  401. package/dist/providers/LivePreview/index.d.ts.map +1 -1
  402. package/dist/providers/LivePreview/index.js +13 -6
  403. package/dist/providers/LivePreview/index.js.map +1 -1
  404. package/dist/providers/Locale/index.d.ts +1 -5
  405. package/dist/providers/Locale/index.d.ts.map +1 -1
  406. package/dist/providers/Locale/index.js +61 -140
  407. package/dist/providers/Locale/index.js.map +1 -1
  408. package/dist/providers/Root/index.d.ts +4 -1
  409. package/dist/providers/Root/index.d.ts.map +1 -1
  410. package/dist/providers/Root/index.js +25 -16
  411. package/dist/providers/Root/index.js.map +1 -1
  412. package/dist/providers/Selection/index.d.ts.map +1 -1
  413. package/dist/providers/Selection/index.js +2 -3
  414. package/dist/providers/Selection/index.js.map +1 -1
  415. package/dist/providers/ServerFunctions/index.d.ts +5 -1
  416. package/dist/providers/ServerFunctions/index.d.ts.map +1 -1
  417. package/dist/providers/ServerFunctions/index.js +15 -0
  418. package/dist/providers/ServerFunctions/index.js.map +1 -1
  419. package/dist/providers/TableColumns/buildColumnState/index.d.ts.map +1 -1
  420. package/dist/providers/TableColumns/buildColumnState/index.js +0 -1
  421. package/dist/providers/TableColumns/buildColumnState/index.js.map +1 -1
  422. package/dist/providers/Theme/index.d.ts +17 -1
  423. package/dist/providers/Theme/index.d.ts.map +1 -1
  424. package/dist/providers/Theme/index.js +253 -81
  425. package/dist/providers/Theme/index.js.map +1 -1
  426. package/dist/providers/Theme/shared.d.ts +8 -0
  427. package/dist/providers/Theme/shared.d.ts.map +1 -1
  428. package/dist/providers/Theme/shared.js +6 -0
  429. package/dist/providers/Theme/shared.js.map +1 -1
  430. package/dist/styles.css +182 -23
  431. package/dist/templates/Default/Wrapper/index.css +3 -2
  432. package/dist/templates/Default/Wrapper/index.d.ts +0 -2
  433. package/dist/templates/Default/Wrapper/index.d.ts.map +1 -1
  434. package/dist/templates/Default/Wrapper/index.js +6 -12
  435. package/dist/templates/Default/Wrapper/index.js.map +1 -1
  436. package/dist/templates/Default/index.css +2 -3
  437. package/dist/templates/Default/index.d.ts.map +1 -1
  438. package/dist/templates/Default/index.js +15 -17
  439. package/dist/templates/Default/index.js.map +1 -1
  440. package/dist/utilities/buildFormState.d.ts.map +1 -1
  441. package/dist/utilities/buildFormState.js +6 -2
  442. package/dist/utilities/buildFormState.js.map +1 -1
  443. package/dist/utilities/formatAbsoluteURL.d.ts +1 -1
  444. package/dist/utilities/formatAbsoluteURL.d.ts.map +1 -1
  445. package/dist/utilities/formatAbsoluteURL.js +18 -8
  446. package/dist/utilities/formatAbsoluteURL.js.map +1 -1
  447. package/dist/utilities/getHasScheduledPublish.d.ts +2 -3
  448. package/dist/utilities/getHasScheduledPublish.d.ts.map +1 -1
  449. package/dist/utilities/getHasScheduledPublish.js +2 -5
  450. package/dist/utilities/getHasScheduledPublish.js.map +1 -1
  451. package/dist/utilities/handleAuthRedirect.d.ts.map +1 -1
  452. package/dist/utilities/handleAuthRedirect.js +4 -1
  453. package/dist/utilities/handleAuthRedirect.js.map +1 -1
  454. package/dist/utilities/handleServerFunctions.d.ts.map +1 -1
  455. package/dist/utilities/handleServerFunctions.js +4 -2
  456. package/dist/utilities/handleServerFunctions.js.map +1 -1
  457. package/dist/utilities/initReq.d.ts.map +1 -1
  458. package/dist/utilities/initReq.js +40 -5
  459. package/dist/utilities/initReq.js.map +1 -1
  460. package/dist/utilities/isAbsoluteURL.d.ts +3 -0
  461. package/dist/utilities/isAbsoluteURL.d.ts.map +1 -0
  462. package/dist/utilities/isAbsoluteURL.js +15 -0
  463. package/dist/utilities/isAbsoluteURL.js.map +1 -0
  464. package/dist/utilities/isHttpURL.d.ts +3 -0
  465. package/dist/utilities/isHttpURL.d.ts.map +1 -0
  466. package/dist/utilities/isHttpURL.js +12 -0
  467. package/dist/utilities/isHttpURL.js.map +1 -0
  468. package/dist/utilities/isPathMatchingRoute.d.ts.map +1 -1
  469. package/dist/utilities/isPathMatchingRoute.js +7 -5
  470. package/dist/utilities/isPathMatchingRoute.js.map +1 -1
  471. package/dist/utilities/isPublicAdminRoute.d.ts.map +1 -1
  472. package/dist/utilities/isPublicAdminRoute.js +9 -6
  473. package/dist/utilities/isPublicAdminRoute.js.map +1 -1
  474. package/dist/utilities/schedulePublishHandler.d.ts +8 -1
  475. package/dist/utilities/schedulePublishHandler.d.ts.map +1 -1
  476. package/dist/utilities/schedulePublishHandler.js +72 -5
  477. package/dist/utilities/schedulePublishHandler.js.map +1 -1
  478. package/dist/utilities/serverFunctionRegistry.d.ts.map +1 -1
  479. package/dist/utilities/serverFunctionRegistry.js +2 -1
  480. package/dist/utilities/serverFunctionRegistry.js.map +1 -1
  481. package/dist/utilities/slugify.d.ts.map +1 -1
  482. package/dist/utilities/slugify.js +2 -0
  483. package/dist/utilities/slugify.js.map +1 -1
  484. package/dist/views/API/index.client.d.ts.map +1 -1
  485. package/dist/views/API/index.client.js +2 -3
  486. package/dist/views/API/index.client.js.map +1 -1
  487. package/dist/views/API/index.css +1 -0
  488. package/dist/views/Account/index.d.ts +1 -1
  489. package/dist/views/Account/index.d.ts.map +1 -1
  490. package/dist/views/Account/index.js +8 -5
  491. package/dist/views/Account/index.js.map +1 -1
  492. package/dist/views/Dashboard/Default/ModularDashboard/index.css +2 -0
  493. package/dist/views/Dashboard/Default/ModularDashboard/index.d.ts.map +1 -1
  494. package/dist/views/Dashboard/Default/ModularDashboard/index.js +1 -0
  495. package/dist/views/Dashboard/Default/ModularDashboard/index.js.map +1 -1
  496. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn.d.ts.map +1 -1
  497. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn.js +3 -1
  498. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn.js.map +1 -1
  499. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.d.ts.map +1 -1
  500. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js +2 -0
  501. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js.map +1 -1
  502. package/dist/views/Dashboard/index.d.ts.map +1 -1
  503. package/dist/views/Dashboard/index.js +2 -3
  504. package/dist/views/Dashboard/index.js.map +1 -1
  505. package/dist/views/Document/handleServerFunction.d.ts.map +1 -1
  506. package/dist/views/Document/handleServerFunction.js +2 -0
  507. package/dist/views/Document/handleServerFunction.js.map +1 -1
  508. package/dist/views/Document/index.d.ts +1 -1
  509. package/dist/views/Document/index.d.ts.map +1 -1
  510. package/dist/views/Document/index.js +10 -6
  511. package/dist/views/Document/index.js.map +1 -1
  512. package/dist/views/Document/renderDocumentSlots.d.ts +1 -0
  513. package/dist/views/Document/renderDocumentSlots.d.ts.map +1 -1
  514. package/dist/views/Document/renderDocumentSlots.js +7 -4
  515. package/dist/views/Document/renderDocumentSlots.js.map +1 -1
  516. package/dist/views/Edit/Auth/APIKey.d.ts +1 -1
  517. package/dist/views/Edit/Auth/APIKey.d.ts.map +1 -1
  518. package/dist/views/Edit/Auth/APIKey.js +233 -59
  519. package/dist/views/Edit/Auth/APIKey.js.map +1 -1
  520. package/dist/views/Edit/Auth/APIKeyGenerationModal.d.ts +12 -0
  521. package/dist/views/Edit/Auth/APIKeyGenerationModal.d.ts.map +1 -0
  522. package/dist/views/Edit/Auth/APIKeyGenerationModal.js +117 -0
  523. package/dist/views/Edit/Auth/APIKeyGenerationModal.js.map +1 -0
  524. package/dist/views/Edit/Auth/index.css +91 -0
  525. package/dist/views/Edit/Auth/index.d.ts.map +1 -1
  526. package/dist/views/Edit/Auth/index.js +10 -28
  527. package/dist/views/Edit/Auth/index.js.map +1 -1
  528. package/dist/views/Edit/Auth/types.d.ts +3 -1
  529. package/dist/views/Edit/Auth/types.d.ts.map +1 -1
  530. package/dist/views/Edit/Auth/types.js.map +1 -1
  531. package/dist/views/Edit/index.css +44 -0
  532. package/dist/views/Edit/index.d.ts.map +1 -1
  533. package/dist/views/Edit/index.js +13 -0
  534. package/dist/views/Edit/index.js.map +1 -1
  535. package/dist/views/Edit/useEditViewWidth.d.ts +8 -0
  536. package/dist/views/Edit/useEditViewWidth.d.ts.map +1 -0
  537. package/dist/views/Edit/useEditViewWidth.js +56 -0
  538. package/dist/views/Edit/useEditViewWidth.js.map +1 -0
  539. package/dist/views/ForgotPassword/ForgotPasswordForm/index.css +14 -0
  540. package/dist/views/ForgotPassword/ForgotPasswordForm/index.d.ts.map +1 -1
  541. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +209 -161
  542. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
  543. package/dist/views/ForgotPassword/index.d.ts.map +1 -1
  544. package/dist/views/ForgotPassword/index.js +2 -11
  545. package/dist/views/ForgotPassword/index.js.map +1 -1
  546. package/dist/views/HierarchyList/DocumentListSelection/index.d.ts.map +1 -1
  547. package/dist/views/HierarchyList/DocumentListSelection/index.js +105 -100
  548. package/dist/views/HierarchyList/DocumentListSelection/index.js.map +1 -1
  549. package/dist/views/HierarchyList/HierarchyListHeader/index.d.ts +1 -6
  550. package/dist/views/HierarchyList/HierarchyListHeader/index.d.ts.map +1 -1
  551. package/dist/views/HierarchyList/HierarchyListHeader/index.js +8 -10
  552. package/dist/views/HierarchyList/HierarchyListHeader/index.js.map +1 -1
  553. package/dist/views/HierarchyList/HierarchyTable/ChildNameCell.d.ts.map +1 -1
  554. package/dist/views/HierarchyList/HierarchyTable/ChildNameCell.js +10 -11
  555. package/dist/views/HierarchyList/HierarchyTable/ChildNameCell.js.map +1 -1
  556. package/dist/views/HierarchyList/HierarchyTable/SlotTable.css +1 -0
  557. package/dist/views/HierarchyList/HierarchyTable/SlotTable.d.ts.map +1 -1
  558. package/dist/views/HierarchyList/HierarchyTable/SlotTable.js +6 -3
  559. package/dist/views/HierarchyList/HierarchyTable/SlotTable.js.map +1 -1
  560. package/dist/views/HierarchyList/HierarchyTable/index.css +0 -51
  561. package/dist/views/HierarchyList/HierarchyTable/index.d.ts +1 -13
  562. package/dist/views/HierarchyList/HierarchyTable/index.d.ts.map +1 -1
  563. package/dist/views/HierarchyList/HierarchyTable/index.js +38 -156
  564. package/dist/views/HierarchyList/HierarchyTable/index.js.map +1 -1
  565. package/dist/views/HierarchyList/HierarchyTable/types.d.ts +0 -6
  566. package/dist/views/HierarchyList/HierarchyTable/types.d.ts.map +1 -1
  567. package/dist/views/HierarchyList/HierarchyTable/types.js.map +1 -1
  568. package/dist/views/HierarchyList/index.css +1 -0
  569. package/dist/views/HierarchyList/index.d.ts.map +1 -1
  570. package/dist/views/HierarchyList/index.js +20 -103
  571. package/dist/views/HierarchyList/index.js.map +1 -1
  572. package/dist/views/List/ListHeader/index.css +1 -0
  573. package/dist/views/List/ListHeader/index.d.ts +0 -1
  574. package/dist/views/List/ListHeader/index.d.ts.map +1 -1
  575. package/dist/views/List/ListHeader/index.js +2 -6
  576. package/dist/views/List/ListHeader/index.js.map +1 -1
  577. package/dist/views/List/ListSelection/index.d.ts.map +1 -1
  578. package/dist/views/List/ListSelection/index.js +122 -138
  579. package/dist/views/List/ListSelection/index.js.map +1 -1
  580. package/dist/views/List/handleHierarchy.d.ts +1 -6
  581. package/dist/views/List/handleHierarchy.d.ts.map +1 -1
  582. package/dist/views/List/handleHierarchy.js +3 -34
  583. package/dist/views/List/handleHierarchy.js.map +1 -1
  584. package/dist/views/List/handleServerFunction.d.ts.map +1 -1
  585. package/dist/views/List/handleServerFunction.js +3 -1
  586. package/dist/views/List/handleServerFunction.js.map +1 -1
  587. package/dist/views/List/index.client.d.ts.map +1 -1
  588. package/dist/views/List/index.client.js +6 -129
  589. package/dist/views/List/index.client.js.map +1 -1
  590. package/dist/views/List/index.css +2 -0
  591. package/dist/views/List/index.d.ts.map +1 -1
  592. package/dist/views/List/index.js +18 -28
  593. package/dist/views/List/index.js.map +1 -1
  594. package/dist/views/NotFound/client.d.ts +2 -0
  595. package/dist/views/NotFound/client.d.ts.map +1 -0
  596. package/dist/views/NotFound/client.js +4 -0
  597. package/dist/views/NotFound/client.js.map +1 -0
  598. package/dist/views/NotFound/page.d.ts.map +1 -1
  599. package/dist/views/NotFound/page.js +4 -3
  600. package/dist/views/NotFound/page.js.map +1 -1
  601. package/dist/views/Root/getRouteData.d.ts.map +1 -1
  602. package/dist/views/Root/getRouteData.js +2 -8
  603. package/dist/views/Root/getRouteData.js.map +1 -1
  604. package/dist/views/Root/index.d.ts.map +1 -1
  605. package/dist/views/Root/index.js +31 -22
  606. package/dist/views/Root/index.js.map +1 -1
  607. package/dist/views/Verify/index.d.ts +1 -1
  608. package/dist/views/Verify/index.d.ts.map +1 -1
  609. package/dist/views/Verify/index.js +4 -4
  610. package/dist/views/Verify/index.js.map +1 -1
  611. package/dist/views/Version/Default/SetStepNav.d.ts.map +1 -1
  612. package/dist/views/Version/Default/SetStepNav.js +10 -13
  613. package/dist/views/Version/Default/SetStepNav.js.map +1 -1
  614. package/dist/views/Version/Default/index.css +2 -0
  615. package/dist/views/Version/Default/index.d.ts.map +1 -1
  616. package/dist/views/Version/Default/index.js +12 -13
  617. package/dist/views/Version/Default/index.js.map +1 -1
  618. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.d.ts +1 -0
  619. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.d.ts.map +1 -1
  620. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js +56 -50
  621. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js.map +1 -1
  622. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.d.ts.map +1 -1
  623. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +41 -27
  624. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js.map +1 -1
  625. package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.css +8 -0
  626. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -1
  627. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +10 -0
  628. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
  629. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.css +1 -0
  630. package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.css +1 -0
  631. package/dist/views/Version/RenderFieldsToDiff/index.css +2 -0
  632. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.d.ts.map +1 -1
  633. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js +33 -1
  634. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js.map +1 -1
  635. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.d.ts +8 -2
  636. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.d.ts.map +1 -1
  637. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js +17 -19
  638. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js.map +1 -1
  639. package/dist/views/Version/Restore/index.d.ts.map +1 -1
  640. package/dist/views/Version/Restore/index.js +9 -6
  641. package/dist/views/Version/Restore/index.js.map +1 -1
  642. package/dist/views/Versions/VersionPillLabel/VersionPillLabel.d.ts.map +1 -1
  643. package/dist/views/Versions/VersionPillLabel/VersionPillLabel.js +2 -3
  644. package/dist/views/Versions/VersionPillLabel/VersionPillLabel.js.map +1 -1
  645. package/dist/views/Versions/VersionPillLabel/index.css +1 -0
  646. package/dist/views/Versions/index.css +1 -0
  647. package/dist/widgets/CollectionCards/index.client.js +1 -1
  648. package/dist/widgets/CollectionCards/index.client.js.map +1 -1
  649. package/dist/widgets/CollectionCards/index.css +43 -33
  650. package/dist/widgets/CollectionCards/index.js +1 -1
  651. package/dist/widgets/CollectionCards/index.js.map +1 -1
  652. package/dist/widgets/RecentlyViewed/DocumentActivity/index.css +193 -0
  653. package/dist/widgets/RecentlyViewed/DocumentActivity/index.d.ts +5 -0
  654. package/dist/widgets/RecentlyViewed/DocumentActivity/index.d.ts.map +1 -0
  655. package/dist/widgets/RecentlyViewed/DocumentActivity/index.js +225 -0
  656. package/dist/widgets/RecentlyViewed/DocumentActivity/index.js.map +1 -0
  657. package/dist/widgets/RecentlyViewed/DocumentItem/index.css +181 -0
  658. package/dist/widgets/RecentlyViewed/DocumentItem/index.d.ts +11 -0
  659. package/dist/widgets/RecentlyViewed/DocumentItem/index.d.ts.map +1 -0
  660. package/dist/widgets/RecentlyViewed/DocumentItem/index.js +104 -0
  661. package/dist/widgets/RecentlyViewed/DocumentItem/index.js.map +1 -0
  662. package/dist/widgets/RecentlyViewed/getDocumentThumbnail.d.ts +10 -0
  663. package/dist/widgets/RecentlyViewed/getDocumentThumbnail.d.ts.map +1 -0
  664. package/dist/widgets/RecentlyViewed/getDocumentThumbnail.js +85 -0
  665. package/dist/widgets/RecentlyViewed/getDocumentThumbnail.js.map +1 -0
  666. package/dist/widgets/RecentlyViewed/getDocumentWidgetData.d.ts +7 -0
  667. package/dist/widgets/RecentlyViewed/getDocumentWidgetData.d.ts.map +1 -0
  668. package/dist/widgets/RecentlyViewed/getDocumentWidgetData.js +206 -0
  669. package/dist/widgets/RecentlyViewed/getDocumentWidgetData.js.map +1 -0
  670. package/dist/widgets/RecentlyViewed/index.d.ts +3 -5
  671. package/dist/widgets/RecentlyViewed/index.d.ts.map +1 -1
  672. package/dist/widgets/RecentlyViewed/index.js +10 -140
  673. package/dist/widgets/RecentlyViewed/index.js.map +1 -1
  674. package/dist/widgets/RecentlyViewed/shared.d.ts +38 -0
  675. package/dist/widgets/RecentlyViewed/shared.d.ts.map +1 -0
  676. package/dist/widgets/RecentlyViewed/shared.js +70 -0
  677. package/dist/widgets/RecentlyViewed/shared.js.map +1 -0
  678. package/dist/widgets/UploadDropzone/index.client.d.ts +7 -0
  679. package/dist/widgets/UploadDropzone/index.client.d.ts.map +1 -0
  680. package/dist/widgets/UploadDropzone/index.client.js +134 -0
  681. package/dist/widgets/UploadDropzone/index.client.js.map +1 -0
  682. package/dist/widgets/UploadDropzone/index.css +50 -0
  683. package/dist/widgets/UploadDropzone/index.d.ts +8 -0
  684. package/dist/widgets/UploadDropzone/index.d.ts.map +1 -0
  685. package/dist/widgets/UploadDropzone/index.js +29 -0
  686. package/dist/widgets/UploadDropzone/index.js.map +1 -0
  687. package/dist/widgets/Welcome/index.css +13 -0
  688. package/dist/widgets/Welcome/index.d.ts +5 -0
  689. package/dist/widgets/Welcome/index.d.ts.map +1 -0
  690. package/dist/widgets/Welcome/index.js +26 -0
  691. package/dist/widgets/Welcome/index.js.map +1 -0
  692. package/dist/widgets/WidgetIcon/assets/images.svg +3 -0
  693. package/dist/widgets/WidgetIcon/assets/pin-solid.svg +3 -0
  694. package/dist/widgets/WidgetIcon/assets/pin.svg +3 -0
  695. package/dist/widgets/WidgetIcon/assets/table.svg +3 -0
  696. package/dist/widgets/WidgetIcon/index.css +23 -0
  697. package/dist/widgets/WidgetIcon/index.d.ts +6 -0
  698. package/dist/widgets/WidgetIcon/index.d.ts.map +1 -0
  699. package/dist/widgets/WidgetIcon/index.js +10 -0
  700. package/dist/widgets/WidgetIcon/index.js.map +1 -0
  701. package/package.json +11 -5
  702. package/dist/elements/ClipboardAction/clipboardUtilities.spec.js +0 -120
  703. package/dist/elements/ClipboardAction/clipboardUtilities.spec.js.map +0 -1
  704. package/dist/elements/ClipboardAction/isClipboardDataValid.spec.js +0 -144
  705. package/dist/elements/ClipboardAction/isClipboardDataValid.spec.js.map +0 -1
  706. package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js +0 -885
  707. package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js.map +0 -1
  708. package/dist/elements/ColumnSelection/matchesColumnSearch.spec.js +0 -87
  709. package/dist/elements/ColumnSelection/matchesColumnSearch.spec.js.map +0 -1
  710. package/dist/elements/CommandPalette/buildActions.spec.js +0 -158
  711. package/dist/elements/CommandPalette/buildActions.spec.js.map +0 -1
  712. package/dist/elements/CommandPalette/highlightLabel.spec.js +0 -78
  713. package/dist/elements/CommandPalette/highlightLabel.spec.js.map +0 -1
  714. package/dist/elements/FieldSelect/reduceFieldOptions.spec.js +0 -143
  715. package/dist/elements/FieldSelect/reduceFieldOptions.spec.js.map +0 -1
  716. package/dist/elements/Hierarchy/CreateNewButton/index.css +0 -9
  717. package/dist/elements/Hierarchy/CreateNewButton/index.d.ts +0 -9
  718. package/dist/elements/Hierarchy/CreateNewButton/index.d.ts.map +0 -1
  719. package/dist/elements/Hierarchy/CreateNewButton/index.js +0 -111
  720. package/dist/elements/Hierarchy/CreateNewButton/index.js.map +0 -1
  721. package/dist/elements/Hierarchy/Modal/Footer/index.css +0 -45
  722. package/dist/elements/Hierarchy/Modal/Footer/index.d.ts +0 -28
  723. package/dist/elements/Hierarchy/Modal/Footer/index.d.ts.map +0 -1
  724. package/dist/elements/Hierarchy/Modal/Footer/index.js +0 -166
  725. package/dist/elements/Hierarchy/Modal/Footer/index.js.map +0 -1
  726. package/dist/elements/Hierarchy/getFolderHierarchySlug.d.ts +0 -22
  727. package/dist/elements/Hierarchy/getFolderHierarchySlug.d.ts.map +0 -1
  728. package/dist/elements/Hierarchy/getFolderHierarchySlug.js +0 -17
  729. package/dist/elements/Hierarchy/getFolderHierarchySlug.js.map +0 -1
  730. package/dist/elements/Hierarchy/move/moveDocuments.d.ts +0 -34
  731. package/dist/elements/Hierarchy/move/moveDocuments.d.ts.map +0 -1
  732. package/dist/elements/Hierarchy/move/moveDocuments.js +0 -94
  733. package/dist/elements/Hierarchy/move/moveDocuments.js.map +0 -1
  734. package/dist/elements/SegmentedControl/index.css +0 -58
  735. package/dist/elements/SegmentedControl/index.d.ts +0 -19
  736. package/dist/elements/SegmentedControl/index.d.ts.map +0 -1
  737. package/dist/elements/SegmentedControl/index.js +0 -104
  738. package/dist/elements/SegmentedControl/index.js.map +0 -1
  739. package/dist/elements/StepNav/DropTarget/index.css +0 -20
  740. package/dist/elements/StepNav/DropTarget/index.d.ts +0 -16
  741. package/dist/elements/StepNav/DropTarget/index.d.ts.map +0 -1
  742. package/dist/elements/StepNav/DropTarget/index.js +0 -71
  743. package/dist/elements/StepNav/DropTarget/index.js.map +0 -1
  744. package/dist/elements/Toasts/fieldErrors.spec.js +0 -46
  745. package/dist/elements/Toasts/fieldErrors.spec.js.map +0 -1
  746. package/dist/elements/UserMenu/HoverSubmenuGroup.d.ts +0 -18
  747. package/dist/elements/UserMenu/HoverSubmenuGroup.d.ts.map +0 -1
  748. package/dist/elements/UserMenu/HoverSubmenuGroup.js +0 -38
  749. package/dist/elements/UserMenu/HoverSubmenuGroup.js.map +0 -1
  750. package/dist/elements/UserMenu/useHoverSubmenu.d.ts +0 -21
  751. package/dist/elements/UserMenu/useHoverSubmenu.d.ts.map +0 -1
  752. package/dist/elements/UserMenu/useHoverSubmenu.js +0 -260
  753. package/dist/elements/UserMenu/useHoverSubmenu.js.map +0 -1
  754. package/dist/elements/ViewModeToggle/index.d.ts +0 -8
  755. package/dist/elements/ViewModeToggle/index.d.ts.map +0 -1
  756. package/dist/elements/ViewModeToggle/index.js +0 -29
  757. package/dist/elements/ViewModeToggle/index.js.map +0 -1
  758. package/dist/elements/WhereBuilder/Condition/Relationship/optionsReducer.spec.js +0 -152
  759. package/dist/elements/WhereBuilder/Condition/Relationship/optionsReducer.spec.js.map +0 -1
  760. package/dist/elements/WhereBuilder/conditionValue.spec.js +0 -65
  761. package/dist/elements/WhereBuilder/conditionValue.spec.js.map +0 -1
  762. package/dist/fields/Upload/Input.spec.js +0 -241
  763. package/dist/fields/Upload/Input.spec.js.map +0 -1
  764. package/dist/forms/fieldSchemasToFormState/fieldSchemasToFormState.spec.d.ts +0 -2
  765. package/dist/forms/fieldSchemasToFormState/fieldSchemasToFormState.spec.d.ts.map +0 -1
  766. package/dist/forms/fieldSchemasToFormState/fieldSchemasToFormState.spec.js +0 -67
  767. package/dist/forms/fieldSchemasToFormState/fieldSchemasToFormState.spec.js.map +0 -1
  768. package/dist/icons/CollapseLayers/index.d.ts +0 -7
  769. package/dist/icons/CollapseLayers/index.d.ts.map +0 -1
  770. package/dist/icons/CollapseLayers/index.js +0 -23
  771. package/dist/icons/CollapseLayers/index.js.map +0 -1
  772. package/dist/icons/Table/index.css +0 -5
  773. package/dist/icons/Table/index.d.ts +0 -7
  774. package/dist/icons/Table/index.d.ts.map +0 -1
  775. package/dist/icons/Table/index.js +0 -25
  776. package/dist/icons/Table/index.js.map +0 -1
  777. package/dist/layouts/Root/index.spec.js +0 -20
  778. package/dist/layouts/Root/index.spec.js.map +0 -1
  779. package/dist/providers/Auth/authSessionRequests.spec.js +0 -121
  780. package/dist/providers/Auth/authSessionRequests.spec.js.map +0 -1
  781. package/dist/providers/Auth/sessionActivity.spec.js +0 -44
  782. package/dist/providers/Auth/sessionActivity.spec.js.map +0 -1
  783. package/dist/providers/Auth/tabSessionSync/index.spec.js +0 -463
  784. package/dist/providers/Auth/tabSessionSync/index.spec.js.map +0 -1
  785. package/dist/providers/Auth/useAuthSessionTimers.spec.js +0 -311
  786. package/dist/providers/Auth/useAuthSessionTimers.spec.js.map +0 -1
  787. package/dist/providers/HierarchyDnd/index.css +0 -51
  788. package/dist/providers/HierarchyDnd/index.d.ts +0 -21
  789. package/dist/providers/HierarchyDnd/index.d.ts.map +0 -1
  790. package/dist/providers/HierarchyDnd/index.js +0 -163
  791. package/dist/providers/HierarchyDnd/index.js.map +0 -1
  792. package/dist/providers/HierarchyDnd/types.d.ts +0 -56
  793. package/dist/providers/HierarchyDnd/types.d.ts.map +0 -1
  794. package/dist/providers/HierarchyDnd/types.js +0 -21
  795. package/dist/providers/HierarchyDnd/types.js.map +0 -1
  796. package/dist/providers/RouteTransition/ProgressBar/index.spec.js +0 -44
  797. package/dist/providers/RouteTransition/ProgressBar/index.spec.js.map +0 -1
  798. package/dist/providers/TableColumns/buildColumnState/index.spec.js +0 -40
  799. package/dist/providers/TableColumns/buildColumnState/index.spec.js.map +0 -1
  800. package/dist/utilities/appendCacheTag.spec.js +0 -34
  801. package/dist/utilities/appendCacheTag.spec.js.map +0 -1
  802. package/dist/utilities/formatMetadata.spec.js +0 -83
  803. package/dist/utilities/formatMetadata.spec.js.map +0 -1
  804. package/dist/utilities/fuzzyMatch.spec.js +0 -38
  805. package/dist/utilities/fuzzyMatch.spec.js.map +0 -1
  806. package/dist/utilities/isCustomAdminView.spec.js +0 -90
  807. package/dist/utilities/isCustomAdminView.spec.js.map +0 -1
  808. package/dist/utilities/isPathMatchingRoute.spec.js +0 -178
  809. package/dist/utilities/isPathMatchingRoute.spec.js.map +0 -1
  810. package/dist/utilities/normalizeRelationshipValue.spec.js +0 -373
  811. package/dist/utilities/normalizeRelationshipValue.spec.js.map +0 -1
  812. package/dist/utilities/recentlyViewed.spec.js +0 -92
  813. package/dist/utilities/recentlyViewed.spec.js.map +0 -1
  814. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.css +0 -216
  815. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.d.ts +0 -20
  816. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.d.ts.map +0 -1
  817. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.js +0 -182
  818. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.js.map +0 -1
  819. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.css +0 -38
  820. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.d.ts +0 -15
  821. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.d.ts.map +0 -1
  822. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.js +0 -85
  823. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.js.map +0 -1
  824. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.css +0 -98
  825. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.d.ts +0 -27
  826. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.d.ts.map +0 -1
  827. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.js +0 -84
  828. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.js.map +0 -1
  829. package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.d.ts +0 -19
  830. package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.d.ts.map +0 -1
  831. package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.js +0 -100
  832. package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.js.map +0 -1
  833. package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.d.ts +0 -53
  834. package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.d.ts.map +0 -1
  835. package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.js +0 -145
  836. package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.js.map +0 -1
  837. package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.d.ts +0 -8
  838. package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.d.ts.map +0 -1
  839. package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.js +0 -21
  840. package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.js.map +0 -1
  841. package/dist/views/HierarchyList/HierarchyCards/index.css +0 -115
  842. package/dist/views/HierarchyList/HierarchyCards/index.d.ts +0 -80
  843. package/dist/views/HierarchyList/HierarchyCards/index.d.ts.map +0 -1
  844. package/dist/views/HierarchyList/HierarchyCards/index.js +0 -457
  845. package/dist/views/HierarchyList/HierarchyCards/index.js.map +0 -1
  846. package/dist/views/Root/getCustomCollectionViewByRoute.spec.js +0 -168
  847. package/dist/views/Root/getCustomCollectionViewByRoute.spec.js.map +0 -1
  848. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js +0 -861
  849. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js.map +0 -1
  850. package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js +0 -47
  851. package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js.map +0 -1
  852. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js +0 -135
  853. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js.map +0 -1
  854. package/dist/widgets/CollectionQuery/getCollectionFieldPaths.spec.js +0 -100
  855. package/dist/widgets/CollectionQuery/getCollectionFieldPaths.spec.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["formatAdminURL","qs","React","createContext","use","useCallback","useEffect","useMemo","useRef","useState","useControllableState","useAuth","requests","useConfig","DocumentTitleProvider","useLocale","useLocaleLoading","usePreferences","useTranslation","UploadEditsProvider","useUploadEdits","useGetDocPermissions","Context","useDocumentInfo","DocumentInfo","children","props","id","collectionSlug","currentEditor","currentEditorFromProps","docPermissions","docPermissionsFromProps","globalSlug","hasPublishedDoc","hasPublishedDocFromProps","hasPublishPermission","hasPublishPermissionFromProps","hasSavePermission","hasSavePermissionFromProps","hasScheduledPublish","hasScheduledPublishFromProps","initialData","initialState","isLocked","isLockedFromProps","lastUpdateTime","lastUpdateTimeFromProps","mostRecentVersionIsAutosaved","mostRecentVersionIsAutosavedFromProps","unpublishedVersionCount","unpublishedVersionCountFromProps","versionCount","versionCountFromProps","setDocPermissions","setHasSavePermission","setHasPublishPermission","permissions","config","admin","dateFormat","collections","routes","api","getEntityConfig","collectionConfig","globalConfig","hasLockedDocumentsCollection","some","collection","slug","abortControllerRef","AbortController","docConfig","i18n","uploadEdits","setMostRecentVersionIsAutosaved","setVersionCount","setHasPublishedDoc","setUnpublishedVersionCount","setHasScheduledPublish","Boolean","documentIsLocked","setDocumentIsLocked","setCurrentEditor","setLastUpdateTime","data","setData","uploadStatus","setUploadStatus","documentLockState","hasShownLockedModal","user","updateUploadStatus","status","getPreference","setPreference","code","locale","localeIsLoading","isInitializing","undefined","baseAPIPath","apiRoute","path","pluralType","preferencesKey","unlockDocument","docID","isGlobal","request","get","credentials","params","docs","json","length","lockID","delete","headers","error","console","updateDocumentEditor","userData","relationTo","value","patch","body","JSON","stringify","getDocPermissions","getDocPreferences","setDocFieldPreferences","fieldPreferences","allPreferences","fields","e","incrementVersionCount","newCount","versions","maxPerDoc","Math","min","max","re1","current","abort","_err","action","docPath","depth","addQueryPrefix","savedDocumentData","updateSavedDocumentData","_jsx","DocumentInfoProvider"],"sources":["../../../src/providers/DocumentInfo/index.tsx"],"sourcesContent":["'use client'\nimport type { DocumentPreferences, User } from 'payload'\n\nimport { formatAdminURL } from 'payload/shared'\nimport * as qs from 'qs-esm'\nimport React, { createContext, use, useCallback, useEffect, useMemo, useRef, useState } from 'react'\n\nimport type { DocumentInfoContext, DocumentInfoProps } from './types.js'\n\nimport { useControllableState } from '../../hooks/useControllableState.js'\nimport { useAuth } from '../../providers/Auth/index.js'\nimport { requests } from '../../utilities/api.js'\nimport { useConfig } from '../Config/index.js'\nimport { DocumentTitleProvider } from '../DocumentTitle/index.js'\nimport { useLocale, useLocaleLoading } from '../Locale/index.js'\nimport { usePreferences } from '../Preferences/index.js'\nimport { useTranslation } from '../Translation/index.js'\nimport { UploadEditsProvider, useUploadEdits } from '../UploadEdits/index.js'\nimport { useGetDocPermissions } from './useGetDocPermissions.js'\n\nconst Context = createContext({} as DocumentInfoContext)\n\nexport type * from './types.js'\n\nexport const useDocumentInfo = (): DocumentInfoContext => use(Context)\n\nconst DocumentInfo: React.FC<\n {\n readonly children: React.ReactNode\n } & DocumentInfoProps\n> = ({ children, ...props }) => {\n const {\n id,\n collectionSlug,\n currentEditor: currentEditorFromProps,\n docPermissions: docPermissionsFromProps,\n globalSlug,\n hasPublishedDoc: hasPublishedDocFromProps,\n hasPublishPermission: hasPublishPermissionFromProps,\n hasSavePermission: hasSavePermissionFromProps,\n hasScheduledPublish: hasScheduledPublishFromProps,\n initialData,\n initialState,\n isLocked: isLockedFromProps,\n lastUpdateTime: lastUpdateTimeFromProps,\n mostRecentVersionIsAutosaved: mostRecentVersionIsAutosavedFromProps,\n unpublishedVersionCount: unpublishedVersionCountFromProps,\n versionCount: versionCountFromProps,\n } = props\n\n const [docPermissions, setDocPermissions] = useControllableState(docPermissionsFromProps)\n\n const [hasSavePermission, setHasSavePermission] = useControllableState(hasSavePermissionFromProps)\n\n const [hasPublishPermission, setHasPublishPermission] = useControllableState(\n hasPublishPermissionFromProps,\n )\n\n const { permissions } = useAuth()\n\n const {\n config: {\n admin: { dateFormat },\n collections,\n routes: { api },\n },\n getEntityConfig,\n } = useConfig()\n\n const collectionConfig = getEntityConfig({ collectionSlug })\n const globalConfig = getEntityConfig({ globalSlug })\n\n // Check if the locked-documents collection exists in the config\n const hasLockedDocumentsCollection = collections.some(\n (collection) => collection.slug === 'payload-locked-documents',\n )\n\n const abortControllerRef = useRef(new AbortController())\n const docConfig = collectionConfig || globalConfig\n\n const { i18n } = useTranslation()\n\n const { uploadEdits } = useUploadEdits()\n\n const [mostRecentVersionIsAutosaved, setMostRecentVersionIsAutosaved] = useState(\n mostRecentVersionIsAutosavedFromProps,\n )\n\n const [versionCount, setVersionCount] = useState(versionCountFromProps)\n\n const [hasPublishedDoc, setHasPublishedDoc] = useState(hasPublishedDocFromProps)\n\n const [unpublishedVersionCount, setUnpublishedVersionCount] = useState(\n unpublishedVersionCountFromProps,\n )\n\n const [hasScheduledPublish, setHasScheduledPublish] = useState(\n Boolean(hasScheduledPublishFromProps),\n )\n\n const [documentIsLocked, setDocumentIsLocked] = useControllableState<boolean | undefined>(\n isLockedFromProps,\n )\n\n const [currentEditor, setCurrentEditor] = useControllableState<null | User>(\n currentEditorFromProps,\n )\n const [lastUpdateTime, setLastUpdateTime] = useControllableState<number>(lastUpdateTimeFromProps)\n\n const [data, setData] = useControllableState(initialData)\n\n const [uploadStatus, setUploadStatus] = useControllableState<'failed' | 'idle' | 'uploading'>(\n 'idle',\n )\n\n const documentLockState = useRef<{\n hasShownLockedModal: boolean\n isLocked: boolean\n user: number | string | User\n } | null>({\n hasShownLockedModal: false,\n isLocked: false,\n user: null,\n })\n\n const updateUploadStatus = useCallback(\n (status: 'failed' | 'idle' | 'uploading') => {\n setUploadStatus(status)\n },\n [setUploadStatus],\n )\n\n const { getPreference, setPreference } = usePreferences()\n const { code: locale } = useLocale()\n const { localeIsLoading } = useLocaleLoading()\n\n const isInitializing = useMemo(\n () => initialState === undefined || initialData === undefined || localeIsLoading,\n [initialData, initialState, localeIsLoading],\n )\n\n const baseAPIPath = formatAdminURL({\n apiRoute: api,\n path: '',\n })\n\n let slug: string\n let pluralType: 'collections' | 'globals'\n let preferencesKey: string\n\n if (globalSlug) {\n slug = globalSlug\n pluralType = 'globals'\n preferencesKey = `global-${slug}`\n }\n\n if (collectionSlug) {\n slug = collectionSlug\n pluralType = 'collections'\n\n if (id) {\n preferencesKey = `collection-${slug}-${id}`\n }\n }\n\n const unlockDocument = useCallback(\n async (docID: number | string, slug: string) => {\n // Check if the locked-documents collection exists before making API calls\n if (!hasLockedDocumentsCollection) {\n return\n }\n\n try {\n const isGlobal = slug === globalSlug\n\n const request = await requests.get(`${baseAPIPath}/payload-locked-documents`, {\n credentials: 'include',\n params: isGlobal\n ? {\n 'where[globalSlug][equals]': slug,\n }\n : {\n 'where[document.relationTo][equals]': slug,\n 'where[document.value][equals]': docID,\n },\n })\n\n const { docs } = await request.json()\n\n if (docs?.length > 0) {\n const lockID = docs[0].id\n await requests.delete(`${baseAPIPath}/payload-locked-documents/${lockID}`, {\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n })\n setDocumentIsLocked(false)\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Failed to unlock the document', error)\n }\n },\n [baseAPIPath, globalSlug, setDocumentIsLocked, hasLockedDocumentsCollection],\n )\n\n const updateDocumentEditor = useCallback(\n async (docID: number | string, slug: string, user: number | string | User) => {\n // Check if the locked-documents collection exists before making API calls\n if (!hasLockedDocumentsCollection) {\n return\n }\n\n try {\n const isGlobal = slug === globalSlug\n\n // Check if the document is already locked\n const request = await requests.get(`${baseAPIPath}/payload-locked-documents`, {\n credentials: 'include',\n params: isGlobal\n ? {\n 'where[globalSlug][equals]': slug,\n }\n : {\n 'where[document.relationTo][equals]': slug,\n 'where[document.value][equals]': docID,\n },\n })\n\n const { docs } = await request.json()\n\n if (docs?.length > 0) {\n const lockID = docs[0].id\n\n const userData =\n typeof user === 'object'\n ? { relationTo: user.collection, value: user.id }\n : { relationTo: 'users', value: user }\n\n // Send a patch request to update the _lastEdited info\n await requests.patch(`${baseAPIPath}/payload-locked-documents/${lockID}`, {\n body: JSON.stringify({\n user: userData,\n }),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n })\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Failed to update the document editor', error)\n }\n },\n [baseAPIPath, globalSlug, hasLockedDocumentsCollection],\n )\n\n const getDocPermissions = useGetDocPermissions({\n id: id as string,\n api,\n collectionSlug,\n globalSlug,\n i18n,\n locale,\n permissions,\n setDocPermissions,\n setHasPublishPermission,\n setHasSavePermission,\n })\n\n const getDocPreferences = useCallback(() => {\n return getPreference<DocumentPreferences>(preferencesKey)\n }, [getPreference, preferencesKey])\n\n const setDocFieldPreferences = useCallback<DocumentInfoContext['setDocFieldPreferences']>(\n async (path, fieldPreferences) => {\n const allPreferences = await getDocPreferences()\n\n if (preferencesKey) {\n try {\n await setPreference(preferencesKey, {\n ...allPreferences,\n fields: {\n ...(allPreferences?.fields || {}),\n [path]: {\n ...allPreferences?.fields?.[path],\n ...fieldPreferences,\n },\n },\n })\n } catch (e) {\n console.error(e) // eslint-disable-line no-console\n }\n }\n },\n [setPreference, preferencesKey, getDocPreferences],\n )\n\n const incrementVersionCount = useCallback(() => {\n const newCount = versionCount + 1\n if (collectionConfig && collectionConfig.versions) {\n if (collectionConfig.versions.maxPerDoc > 0) {\n setVersionCount(Math.min(newCount, collectionConfig.versions.maxPerDoc))\n } else {\n setVersionCount(newCount)\n }\n } else if (globalConfig && globalConfig.versions) {\n if (globalConfig.versions.max > 0) {\n setVersionCount(Math.min(newCount, globalConfig.versions.max))\n } else {\n setVersionCount(newCount)\n }\n }\n }, [collectionConfig, globalConfig, versionCount])\n\n // clean on unmount\n useEffect(() => {\n const re1 = abortControllerRef.current\n\n return () => {\n if (re1) {\n try {\n re1.abort()\n } catch (_err) {\n // swallow error\n }\n }\n }\n }, [])\n\n const action: string = React.useMemo(() => {\n const docPath = `${pluralType === 'globals' ? `/globals` : ''}/${slug}${id ? `/${id}` : ''}`\n\n return `${baseAPIPath}${docPath}${qs.stringify(\n {\n depth: 0,\n 'fallback-locale': 'null',\n locale,\n uploadEdits: uploadEdits || undefined,\n },\n {\n addQueryPrefix: true,\n },\n )}`\n }, [baseAPIPath, locale, pluralType, id, slug, uploadEdits])\n\n const value: DocumentInfoContext = {\n ...props,\n action,\n currentEditor,\n data,\n docConfig,\n docPermissions,\n documentIsLocked,\n documentLockState,\n getDocPermissions,\n getDocPreferences,\n hasPublishedDoc,\n hasPublishPermission,\n hasSavePermission,\n hasScheduledPublish,\n incrementVersionCount,\n initialData,\n initialState,\n isInitializing,\n lastUpdateTime,\n mostRecentVersionIsAutosaved,\n preferencesKey,\n savedDocumentData: data,\n setCurrentEditor,\n setData,\n setDocFieldPreferences,\n setDocumentIsLocked,\n setHasPublishedDoc,\n setHasScheduledPublish,\n setLastUpdateTime,\n setMostRecentVersionIsAutosaved,\n setUnpublishedVersionCount,\n setUploadStatus: updateUploadStatus,\n unlockDocument,\n unpublishedVersionCount,\n updateDocumentEditor,\n updateSavedDocumentData: setData,\n uploadStatus,\n versionCount,\n }\n\n return (\n <Context value={value}>\n <DocumentTitleProvider>{children}</DocumentTitleProvider>\n </Context>\n )\n}\n\nexport const DocumentInfoProvider: React.FC<\n {\n readonly children: React.ReactNode\n } & DocumentInfoProps\n> = (props) => {\n return (\n <UploadEditsProvider>\n <DocumentInfo {...props} />\n </UploadEditsProvider>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SAASA,cAAc,QAAQ;AAC/B,YAAYC,EAAA,MAAQ;AACpB,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAI7F,SAASC,oBAAoB,QAAQ;AACrC,SAASC,OAAO,QAAQ;AACxB,SAASC,QAAQ,QAAQ;AACzB,SAASC,SAAS,QAAQ;AAC1B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,SAAS,EAAEC,gBAAgB,QAAQ;AAC5C,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,mBAAmB,EAAEC,cAAc,QAAQ;AACpD,SAASC,oBAAoB,QAAQ;AAErC,MAAMC,OAAA,gBAAUnB,aAAA,CAAc,CAAC;AAI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A,WAAA,IAAe0B;IAC9B,GACA;MACEkD,cAAA,EAAgB;IAClB,IACC;EACL,GAAG,CAACjD,WAAA,EAAaJ,MAAA,EAAQO,UAAA,EAAY9E,EAAA,EAAI2C,IAAA,EAAMK,WAAA,CAAY;EAE3D,MAAMkD,KAAA,GAA6B;IACjC,GAAGnG,KAAK;IACR0H,MAAA;IACAvH,aAAA;IACAyD,IAAA;IACAb,SAAA;IACA1C,cAAA;IACAmD,gBAAA;IACAQ,iBAAA;IACAwC,iBAAA;IACAC,iBAAA;IACAjG,eAAA;IACAE,oBAAA;IACAE,iBAAA;IACAE,mBAAA;IACAiG,qBAAA;IACA/F,WAAA;IACAC,YAAA;IACAyD,cAAA;IACAtD,cAAA;IACAE,4BAAA;IACA0D,cAAA;IACA8C,iBAAA,EAAmBlE,IAAA;IACnBF,gBAAA;IACAG,OAAA;IACA6C,sBAAA;IACAjD,mBAAA;IACAL,kBAAA;IACAE,sBAAA;IACAK,iBAAA;IACAT,+BAAA;IACAG,0BAAA;IACAU,eAAA,EAAiBI,kBAAA;IACjBc,cAAA;IACAzD,uBAAA;IACAwE,oBAAA;IACA+B,uBAAA,EAAyBlE,OAAA;IACzBC,YAAA;IACApC;EACF;EAEA,oBACEsG,IAAA,CAACpI,OAAA;IAAQuG,KAAA,EAAOA,KAAA;cACd,aAAA6B,IAAA,CAAC5I,qBAAA;gBAAuBW;;;AAG9B;AAEA,OAAO,MAAMkI,oBAAA,GAIRjI,KAAA;EACH,oBACEgI,IAAA,CAACvI,mBAAA;cACC,aAAAuI,IAAA,CAAClI,YAAA;MAAc,GAAGE;;;AAGxB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["formatAdminURL","qs","React","createContext","use","useCallback","useEffect","useMemo","useRef","useState","useControllableState","useAuth","requests","useConfig","DocumentTitleProvider","useLocale","useLocaleLoading","usePreferences","useTranslation","UploadEditsProvider","useUploadEdits","useGetDocPermissions","Context","useDocumentInfo","DocumentInfo","children","props","id","collectionSlug","currentEditor","currentEditorFromProps","docPermissions","docPermissionsFromProps","globalSlug","hasPublishedDoc","hasPublishedDocFromProps","hasPublishPermission","hasPublishPermissionFromProps","hasSavePermission","hasSavePermissionFromProps","hasScheduledPublish","hasScheduledPublishFromProps","initialData","initialState","isLocked","isLockedFromProps","lastUpdateTime","lastUpdateTimeFromProps","mostRecentVersionIsAutosaved","mostRecentVersionIsAutosavedFromProps","unpublishedVersionCount","unpublishedVersionCountFromProps","versionCount","versionCountFromProps","setDocPermissions","setHasSavePermission","setHasPublishPermission","permissions","config","admin","dateFormat","collections","routes","api","getEntityConfig","collectionConfig","globalConfig","hasLockedDocumentsCollection","some","collection","slug","abortControllerRef","AbortController","docConfig","i18n","uploadEdits","setMostRecentVersionIsAutosaved","setVersionCount","setHasPublishedDoc","setUnpublishedVersionCount","setHasScheduledPublish","Boolean","documentIsLocked","setDocumentIsLocked","setCurrentEditor","setLastUpdateTime","data","setData","uploadStatus","setUploadStatus","documentLockState","hasShownLockedModal","user","updateUploadStatus","status","getPreference","setPreference","currentLocale","locale","code","localeIsLoading","isInitializing","undefined","pluralType","preferencesKey","unlockDocument","docID","isGlobal","request","get","apiRoute","path","credentials","params","docs","json","length","lockID","delete","headers","error","console","updateDocumentEditor","userData","relationTo","value","patch","body","JSON","stringify","getDocPermissions","getDocPreferences","setDocFieldPreferences","fieldPreferences","allPreferences","fields","e","incrementVersionCount","newCount","versions","maxPerDoc","Math","min","max","re1","current","abort","_err","action","docPath","depth","addQueryPrefix","savedDocumentData","updateSavedDocumentData","_jsx","DocumentInfoProvider"],"sources":["../../../src/providers/DocumentInfo/index.tsx"],"sourcesContent":["'use client'\nimport type { DocumentPreferences, User } from 'payload'\n\nimport { formatAdminURL } from 'payload/shared'\nimport * as qs from 'qs-esm'\nimport React, { createContext, use, useCallback, useEffect, useMemo, useRef, useState } from 'react'\n\nimport type { DocumentInfoContext, DocumentInfoProps } from './types.js'\n\nimport { useControllableState } from '../../hooks/useControllableState.js'\nimport { useAuth } from '../../providers/Auth/index.js'\nimport { requests } from '../../utilities/api.js'\nimport { useConfig } from '../Config/index.js'\nimport { DocumentTitleProvider } from '../DocumentTitle/index.js'\nimport { useLocale, useLocaleLoading } from '../Locale/index.js'\nimport { usePreferences } from '../Preferences/index.js'\nimport { useTranslation } from '../Translation/index.js'\nimport { UploadEditsProvider, useUploadEdits } from '../UploadEdits/index.js'\nimport { useGetDocPermissions } from './useGetDocPermissions.js'\n\nconst Context = createContext({} as DocumentInfoContext)\n\nexport type * from './types.js'\n\nexport const useDocumentInfo = (): DocumentInfoContext => use(Context)\n\nconst DocumentInfo: React.FC<\n {\n readonly children: React.ReactNode\n } & DocumentInfoProps\n> = ({ children, ...props }) => {\n const {\n id,\n collectionSlug,\n currentEditor: currentEditorFromProps,\n docPermissions: docPermissionsFromProps,\n globalSlug,\n hasPublishedDoc: hasPublishedDocFromProps,\n hasPublishPermission: hasPublishPermissionFromProps,\n hasSavePermission: hasSavePermissionFromProps,\n hasScheduledPublish: hasScheduledPublishFromProps,\n initialData,\n initialState,\n isLocked: isLockedFromProps,\n lastUpdateTime: lastUpdateTimeFromProps,\n mostRecentVersionIsAutosaved: mostRecentVersionIsAutosavedFromProps,\n unpublishedVersionCount: unpublishedVersionCountFromProps,\n versionCount: versionCountFromProps,\n } = props\n\n const [docPermissions, setDocPermissions] = useControllableState(docPermissionsFromProps)\n\n const [hasSavePermission, setHasSavePermission] = useControllableState(hasSavePermissionFromProps)\n\n const [hasPublishPermission, setHasPublishPermission] = useControllableState(\n hasPublishPermissionFromProps,\n )\n\n const { permissions } = useAuth()\n\n const {\n config: {\n admin: { dateFormat },\n collections,\n routes: { api },\n },\n getEntityConfig,\n } = useConfig()\n\n const collectionConfig = getEntityConfig({ collectionSlug })\n const globalConfig = getEntityConfig({ globalSlug })\n\n // Check if the locked-documents collection exists in the config\n const hasLockedDocumentsCollection = collections.some(\n (collection) => collection.slug === 'payload-locked-documents',\n )\n\n const abortControllerRef = useRef(new AbortController())\n const docConfig = collectionConfig || globalConfig\n\n const { i18n } = useTranslation()\n\n const { uploadEdits } = useUploadEdits()\n\n const [mostRecentVersionIsAutosaved, setMostRecentVersionIsAutosaved] = useState(\n mostRecentVersionIsAutosavedFromProps,\n )\n\n const [versionCount, setVersionCount] = useState(versionCountFromProps)\n\n const [hasPublishedDoc, setHasPublishedDoc] = useState(hasPublishedDocFromProps)\n\n const [unpublishedVersionCount, setUnpublishedVersionCount] = useState(\n unpublishedVersionCountFromProps,\n )\n\n const [hasScheduledPublish, setHasScheduledPublish] = useState(\n Boolean(hasScheduledPublishFromProps),\n )\n\n const [documentIsLocked, setDocumentIsLocked] = useControllableState<boolean | undefined>(\n isLockedFromProps,\n )\n\n const [currentEditor, setCurrentEditor] = useControllableState<null | User>(\n currentEditorFromProps,\n )\n const [lastUpdateTime, setLastUpdateTime] = useControllableState<number>(lastUpdateTimeFromProps)\n\n const [data, setData] = useControllableState(initialData)\n\n const [uploadStatus, setUploadStatus] = useControllableState<'failed' | 'idle' | 'uploading'>(\n 'idle',\n )\n\n const documentLockState = useRef<{\n hasShownLockedModal: boolean\n isLocked: boolean\n user: number | string | User\n } | null>({\n hasShownLockedModal: false,\n isLocked: false,\n user: null,\n })\n\n const updateUploadStatus = useCallback(\n (status: 'failed' | 'idle' | 'uploading') => {\n setUploadStatus(status)\n },\n [setUploadStatus],\n )\n\n const { getPreference, setPreference } = usePreferences()\n const currentLocale = useLocale()\n const locale = currentLocale?.code\n const { localeIsLoading } = useLocaleLoading()\n\n const isInitializing = useMemo(\n () => initialState === undefined || initialData === undefined || localeIsLoading,\n [initialData, initialState, localeIsLoading],\n )\n\n let slug: string\n let pluralType: 'collections' | 'globals'\n let preferencesKey: string\n\n if (globalSlug) {\n slug = globalSlug\n pluralType = 'globals'\n preferencesKey = `global-${slug}`\n }\n\n if (collectionSlug) {\n slug = collectionSlug\n pluralType = 'collections'\n\n if (id) {\n preferencesKey = `collection-${slug}-${id}`\n }\n }\n\n const unlockDocument = useCallback(\n async (docID: number | string, slug: string) => {\n // Check if the locked-documents collection exists before making API calls\n if (!hasLockedDocumentsCollection) {\n return\n }\n\n try {\n const isGlobal = slug === globalSlug\n\n const request = await requests.get(\n formatAdminURL({ apiRoute: api, path: '/payload-locked-documents' }),\n {\n credentials: 'include',\n params: isGlobal\n ? {\n 'where[globalSlug][equals]': slug,\n }\n : {\n 'where[document.relationTo][equals]': slug,\n 'where[document.value][equals]': docID,\n },\n },\n )\n\n const { docs } = await request.json()\n\n if (docs?.length > 0) {\n const lockID = docs[0].id\n await requests.delete(\n formatAdminURL({\n apiRoute: api,\n path: `/payload-locked-documents/${lockID}`,\n }),\n {\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n )\n setDocumentIsLocked(false)\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Failed to unlock the document', error)\n }\n },\n [api, globalSlug, setDocumentIsLocked, hasLockedDocumentsCollection],\n )\n\n const updateDocumentEditor = useCallback(\n async (docID: number | string, slug: string, user: number | string | User) => {\n // Check if the locked-documents collection exists before making API calls\n if (!hasLockedDocumentsCollection) {\n return\n }\n\n try {\n const isGlobal = slug === globalSlug\n\n // Check if the document is already locked\n const request = await requests.get(\n formatAdminURL({ apiRoute: api, path: '/payload-locked-documents' }),\n {\n credentials: 'include',\n params: isGlobal\n ? {\n 'where[globalSlug][equals]': slug,\n }\n : {\n 'where[document.relationTo][equals]': slug,\n 'where[document.value][equals]': docID,\n },\n },\n )\n\n const { docs } = await request.json()\n\n if (docs?.length > 0) {\n const lockID = docs[0].id\n\n const userData =\n typeof user === 'object'\n ? { relationTo: user.collection, value: user.id }\n : { relationTo: 'users', value: user }\n\n // Send a patch request to update the _lastEdited info\n await requests.patch(\n formatAdminURL({\n apiRoute: api,\n path: `/payload-locked-documents/${lockID}`,\n }),\n {\n body: JSON.stringify({\n user: userData,\n }),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n )\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Failed to update the document editor', error)\n }\n },\n [api, globalSlug, hasLockedDocumentsCollection],\n )\n\n const getDocPermissions = useGetDocPermissions({\n id: id as string,\n api,\n collectionSlug,\n globalSlug,\n i18n,\n locale,\n permissions,\n setDocPermissions,\n setHasPublishPermission,\n setHasSavePermission,\n })\n\n const getDocPreferences = useCallback(() => {\n return getPreference<DocumentPreferences>(preferencesKey)\n }, [getPreference, preferencesKey])\n\n const setDocFieldPreferences = useCallback<DocumentInfoContext['setDocFieldPreferences']>(\n async (path, fieldPreferences) => {\n const allPreferences = await getDocPreferences()\n\n if (preferencesKey) {\n try {\n await setPreference(preferencesKey, {\n ...allPreferences,\n fields: {\n ...(allPreferences?.fields || {}),\n [path]: {\n ...allPreferences?.fields?.[path],\n ...fieldPreferences,\n },\n },\n })\n } catch (e) {\n console.error(e) // eslint-disable-line no-console\n }\n }\n },\n [setPreference, preferencesKey, getDocPreferences],\n )\n\n const incrementVersionCount = useCallback(() => {\n const newCount = versionCount + 1\n if (collectionConfig && collectionConfig.versions) {\n if (collectionConfig.versions.maxPerDoc > 0) {\n setVersionCount(Math.min(newCount, collectionConfig.versions.maxPerDoc))\n } else {\n setVersionCount(newCount)\n }\n } else if (globalConfig && globalConfig.versions) {\n if (globalConfig.versions.max > 0) {\n setVersionCount(Math.min(newCount, globalConfig.versions.max))\n } else {\n setVersionCount(newCount)\n }\n }\n }, [collectionConfig, globalConfig, versionCount])\n\n // clean on unmount\n useEffect(() => {\n const re1 = abortControllerRef.current\n\n return () => {\n if (re1) {\n try {\n re1.abort()\n } catch (_err) {\n // swallow error\n }\n }\n }\n }, [])\n\n const action: string = React.useMemo(() => {\n const docPath = `${pluralType === 'globals' ? `/globals` : ''}/${slug}${id ? `/${id}` : ''}`\n\n return formatAdminURL({\n apiRoute: api,\n path: `${docPath}${qs.stringify(\n {\n depth: 0,\n 'fallback-locale': 'null',\n locale,\n uploadEdits: uploadEdits || undefined,\n },\n {\n addQueryPrefix: true,\n },\n )}` as `/${string}`,\n })\n }, [api, locale, pluralType, id, slug, uploadEdits])\n\n const value: DocumentInfoContext = {\n ...props,\n action,\n currentEditor,\n data,\n docConfig,\n docPermissions,\n documentIsLocked,\n documentLockState,\n getDocPermissions,\n getDocPreferences,\n hasPublishedDoc,\n hasPublishPermission,\n hasSavePermission,\n hasScheduledPublish,\n incrementVersionCount,\n initialData,\n initialState,\n isInitializing,\n lastUpdateTime,\n mostRecentVersionIsAutosaved,\n preferencesKey,\n savedDocumentData: data,\n setCurrentEditor,\n setData,\n setDocFieldPreferences,\n setDocumentIsLocked,\n setHasPublishedDoc,\n setHasScheduledPublish,\n setLastUpdateTime,\n setMostRecentVersionIsAutosaved,\n setUnpublishedVersionCount,\n setUploadStatus: updateUploadStatus,\n unlockDocument,\n unpublishedVersionCount,\n updateDocumentEditor,\n updateSavedDocumentData: setData,\n uploadStatus,\n versionCount,\n }\n\n return (\n <Context value={value}>\n <DocumentTitleProvider>{children}</DocumentTitleProvider>\n </Context>\n )\n}\n\nexport const DocumentInfoProvider: React.FC<\n {\n readonly children: React.ReactNode\n } & DocumentInfoProps\n> = (props) => {\n return (\n <UploadEditsProvider>\n <DocumentInfo {...props} />\n </UploadEditsProvider>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SAASA,cAAc,QAAQ;AAC/B,YAAYC,EAAA,MAAQ;AACpB,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAI7F,SAASC,oBAAoB,QAAQ;AACrC,SAASC,OAAO,QAAQ;AACxB,SAASC,QAAQ,QAAQ;AACzB,SAASC,SAAS,QAAQ;AAC1B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,SAAS,EAAEC,gBAAgB,QAAQ;AAC5C,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,mBAAmB,EAAEC,cAAc,QAAQ;AACpD,SAASC,oBAAoB,QAAQ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@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/Hierarchy/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAExE,OAAO,KAAK,EAEV,qBAAqB,EAGrB,sBAAsB,EAEvB,MAAM,YAAY,CAAA;AASnB,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAkb9D,CAAA;AAED,eAAO,MAAM,YAAY,QAAO,qBAM/B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/Hierarchy/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAExE,OAAO,KAAK,EAEV,qBAAqB,EAGrB,sBAAsB,EAEvB,MAAM,YAAY,CAAA;AASnB,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAmZ9D,CAAA;AAED,eAAO,MAAM,YAAY,QAAO,qBAM/B,CAAA"}
@@ -105,27 +105,13 @@ export const HierarchyProvider = ({
105
105
  } else {
106
106
  const existingDocIds = new Set(existingEntry.docs.map(doc_0 => doc_0.id));
107
107
  const newDocs = treeData.docs.filter(doc_1 => !existingDocIds.has(doc_1.id));
108
- // Reconcile loadedCount/totalDocs against the deduped merge rather than
109
- // blindly overwriting: a shallower fetch (e.g. fewer pages walked) must not
110
- // regress loadedCount below what's already accumulated in docs, or downstream
111
- // page-number math in Tree will refetch and duplicate an already-shown page.
112
- const mergedLoadedParents = {
113
- ...existingEntry.loadedParents
114
- };
115
- for (const [parentKey, meta] of Object.entries(treeData.loadedParents)) {
116
- const existingMeta = existingEntry.loadedParents[parentKey];
117
- const loadedCount = Math.max(existingMeta?.loadedCount ?? 0, meta.loadedCount ?? 0);
118
- const totalDocs = Math.max(existingMeta?.totalDocs ?? 0, meta.totalDocs ?? 0);
119
- mergedLoadedParents[parentKey] = {
120
- hasMore: loadedCount < totalDocs,
121
- loadedCount,
122
- totalDocs
123
- };
124
- }
125
108
  newCache.set(slug, {
126
109
  baseFilter: existingEntry.baseFilter,
127
110
  docs: [...existingEntry.docs, ...newDocs],
128
- loadedParents: mergedLoadedParents
111
+ loadedParents: {
112
+ ...existingEntry.loadedParents,
113
+ ...treeData.loadedParents
114
+ }
129
115
  });
130
116
  }
131
117
  return newCache;
@@ -174,42 +160,29 @@ export const HierarchyProvider = ({
174
160
  return newMap_1;
175
161
  });
176
162
  }, [savePreferencesDebounced]);
177
- const collapseAllForCollection = useCallback(slug_2 => {
178
- setExpandedNodesByCollection(prev_3 => {
179
- // Always produce a new Map, even when the collection's set is already empty. The tree
180
- // may still be rendering server-provided nodes that only this state change can clear.
181
- const newMap_2 = new Map(prev_3);
182
- const newExpanded_0 = new Set();
183
- newMap_2.set(slug_2, newExpanded_0);
184
- savePreferencesDebounced(slug_2, {
185
- expanded: newExpanded_0
186
- });
187
- return newMap_2;
188
- });
189
- }, [savePreferencesDebounced]);
190
163
  const toggleNode = useCallback(id_0 => {
191
164
  if (!collectionSlug) {
192
165
  return;
193
166
  }
194
167
  toggleNodeForCollection(collectionSlug, id_0);
195
168
  }, [collectionSlug, toggleNodeForCollection]);
196
- const getExpandedNodesForCollection = useCallback(slug_3 => {
197
- return expandedNodesByCollection.get(slug_3) || new Set();
169
+ const getExpandedNodesForCollection = useCallback(slug_2 => {
170
+ return expandedNodesByCollection.get(slug_2) || new Set();
198
171
  }, [expandedNodesByCollection]);
199
- const getTreeDataForCollection = useCallback(slug_4 => {
200
- return treeCache.get(slug_4) || null;
172
+ const getTreeDataForCollection = useCallback(slug_3 => {
173
+ return treeCache.get(slug_3) || null;
201
174
  }, [treeCache]);
202
175
  const setSelectedFilters = useCallback(filters => {
203
176
  if (!collectionSlug) {
204
177
  return;
205
178
  }
206
- setSelectedFiltersByCollection(prev_4 => {
207
- const newMap_3 = new Map(prev_4);
208
- newMap_3.set(collectionSlug, filters);
179
+ setSelectedFiltersByCollection(prev_3 => {
180
+ const newMap_2 = new Map(prev_3);
181
+ newMap_2.set(collectionSlug, filters);
209
182
  savePreferencesDebounced(collectionSlug, {
210
183
  filters
211
184
  });
212
- return newMap_3;
185
+ return newMap_2;
213
186
  });
214
187
  }, [collectionSlug, savePreferencesDebounced]);
215
188
  const selectParent = useCallback(id_1 => {
@@ -232,8 +205,8 @@ export const HierarchyProvider = ({
232
205
  if (!cache_0) {
233
206
  return;
234
207
  }
235
- const parentKey_0 = parentId_0 === null ? 'root' : String(parentId_0);
236
- const parentMeta = cache_0.loadedParents[parentKey_0];
208
+ const parentKey = parentId_0 === null ? 'root' : String(parentId_0);
209
+ const parentMeta = cache_0.loadedParents[parentKey];
237
210
  if (!parentMeta || !parentMeta.hasMore) {
238
211
  return;
239
212
  }
@@ -284,8 +257,8 @@ export const HierarchyProvider = ({
284
257
  }
285
258
  const data_1 = await response.json();
286
259
  const newDocs_0 = data_1.docs || [];
287
- setTreeCache(prev_5 => {
288
- const newCache_0 = new Map(prev_5);
260
+ setTreeCache(prev_4 => {
261
+ const newCache_0 = new Map(prev_4);
289
262
  const existingEntry_0 = newCache_0.get(collectionSlug);
290
263
  if (existingEntry_0) {
291
264
  const existingDocIds_0 = new Set(existingEntry_0.docs.map(doc_3 => doc_3.id));
@@ -294,9 +267,8 @@ export const HierarchyProvider = ({
294
267
  docs: [...existingEntry_0.docs, ...uniqueNewDocs],
295
268
  loadedParents: {
296
269
  ...existingEntry_0.loadedParents,
297
- [parentKey_0]: {
270
+ [parentKey]: {
298
271
  hasMore: data_1.hasNextPage || false,
299
- loadedCount: currentChildren.length + uniqueNewDocs.length,
300
272
  totalDocs: data_1.totalDocs || 0
301
273
  }
302
274
  }
@@ -325,15 +297,15 @@ export const HierarchyProvider = ({
325
297
  setIsLoadingMore(false);
326
298
  setLoadingNodeId(null);
327
299
  }, []);
328
- const refreshTree = useCallback(slug_5 => {
329
- setTreeCache(prev_6 => {
330
- const next = new Map(prev_6);
331
- next.delete(slug_5);
300
+ const refreshTree = useCallback(slug_4 => {
301
+ setTreeCache(prev_5 => {
302
+ const next = new Map(prev_5);
303
+ next.delete(slug_4);
332
304
  return next;
333
305
  });
334
- setTreeRefreshKeys(prev_7 => {
335
- const next_0 = new Map(prev_7);
336
- next_0.set(slug_5, (next_0.get(slug_5) ?? 0) + 1);
306
+ setTreeRefreshKeys(prev_6 => {
307
+ const next_0 = new Map(prev_6);
308
+ next_0.set(slug_4, (next_0.get(slug_4) ?? 0) + 1);
337
309
  return next_0;
338
310
  });
339
311
  }, []);
@@ -342,7 +314,6 @@ export const HierarchyProvider = ({
342
314
  const value = {
343
315
  allowedCollections,
344
316
  baseFilter,
345
- collapseAllForCollection,
346
317
  collectionSlug,
347
318
  expandedNodes,
348
319
  getExpandedNodesForCollection,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["DEFAULT_HIERARCHY_TREE_LIMIT","formatAdminURL","PREFERENCE_KEYS","qs","React","createContext","use","useCallback","useState","useDebouncedCallback","useConfig","usePreferences","useRouter","HierarchyContext","undefined","HierarchyProvider","children","setPreference","router","config","routes","admin","adminRoute","api","serverURL","baseFilter","setBaseFilter","collectionSlug","setCollectionSlug","parent","setParent","parentFieldName","setParentFieldName","treeLimit","setTreeLimit","typeFieldName","setTypeFieldName","useAsTitle","setUseAsTitle","allowedCollections","setAllowedCollections","treeCache","setTreeCache","Map","expandedNodesByCollection","setExpandedNodesByCollection","selectedFiltersByCollection","setSelectedFiltersByCollection","isLoadingMore","setIsLoadingMore","loadingNodeId","setLoadingNodeId","treeRefreshKeys","setTreeRefreshKeys","getNodeChildren","parentId","cache","get","docs","filter","doc","docParentId","String","hydrate","data","newAllowedCollections","newBaseFilter","slug","expandedNodes","newExpandedNodes","newParent","newParentFieldName","selectedFilters","newSelectedFilters","treeData","newTreeLimit","newTypeFieldName","newUseAsTitle","prev","newCache","existingEntry","set","existingDocIds","Set","map","id","newDocs","has","mergedLoadedParents","loadedParents","parentKey","meta","Object","entries","existingMeta","loadedCount","Math","max","totalDocs","hasMore","length","newMap","existingExpanded","mergedExpanded","savePreferencesDebounced","preferenceKey","HIERARCHY_TREE","currentExpanded","currentFilters","Array","from","expanded","filters","toggleNodeForCollection","newExpanded","delete","add","collapseAllForCollection","toggleNode","getExpandedNodesForCollection","getTreeDataForCollection","setSelectedFilters","selectParent","queryParam","url","path","push","refresh","loadMoreChildren","parentMeta","currentChildren","nextPage","floor","where","or","exists","equals","queryString","stringify","limit","page","sort","addQueryPrefix","apiRoute","response","fetch","credentials","ok","Error","json","uniqueNewDocs","hasNextPage","reset","refreshTree","next","value","_jsx","useHierarchy","context"],"sources":["../../../src/providers/Hierarchy/index.tsx"],"sourcesContent":["'use client'\n\nimport type { TypeWithID, Where } from 'payload'\n\nimport { DEFAULT_HIERARCHY_TREE_LIMIT, formatAdminURL, PREFERENCE_KEYS } from 'payload/shared'\nimport * as qs from 'qs-esm'\nimport React, { createContext, use, useCallback, useState } from 'react'\n\nimport type {\n AllowedCollection,\n HierarchyContextValue,\n HierarchyDocument,\n HierarchyHydrateData,\n HierarchyProviderProps,\n HierarchyTreeCacheEntry,\n} from './types.js'\n\nimport { useDebouncedCallback } from '../../hooks/useDebouncedCallback.js'\nimport { useConfig } from '../Config/index.js'\nimport { usePreferences } from '../Preferences/index.js'\nimport { useRouter } from '../RouterAdapter/index.js'\n\nconst HierarchyContext = createContext<HierarchyContextValue | undefined>(undefined)\n\nexport const HierarchyProvider: React.FC<HierarchyProviderProps> = ({ children }) => {\n const { setPreference } = usePreferences()\n const router = useRouter()\n const {\n config: {\n routes: { admin: adminRoute, api },\n serverURL,\n },\n } = useConfig()\n\n const [baseFilter, setBaseFilter] = useState<null | Where>(null)\n const [collectionSlug, setCollectionSlug] = useState<null | string>(null)\n const [parent, setParent] = useState<null | (Record<string, unknown> & TypeWithID)>(null)\n const [parentFieldName, setParentFieldName] = useState<string>('')\n const [treeLimit, setTreeLimit] = useState<number>(DEFAULT_HIERARCHY_TREE_LIMIT)\n const [typeFieldName, setTypeFieldName] = useState<null | string>(null)\n const [useAsTitle, setUseAsTitle] = useState<null | string>(null)\n const [allowedCollections, setAllowedCollections] = useState<AllowedCollection[] | null>(null)\n\n const [treeCache, setTreeCache] = useState<Map<string, HierarchyTreeCacheEntry>>(() => new Map())\n const [expandedNodesByCollection, setExpandedNodesByCollection] = useState<\n Map<string, Set<number | string>>\n >(() => new Map())\n const [selectedFiltersByCollection, setSelectedFiltersByCollection] = useState<\n Map<string, string[]>\n >(() => new Map())\n const [isLoadingMore, setIsLoadingMore] = useState<boolean>(false)\n const [loadingNodeId, setLoadingNodeId] = useState<null | number | string>(null)\n const [treeRefreshKeys, setTreeRefreshKeys] = useState<Map<string, number>>(() => new Map())\n\n const getNodeChildren = useCallback(\n (parentId: null | number | string): HierarchyDocument[] => {\n if (!collectionSlug) {\n return []\n }\n\n const cache = treeCache.get(collectionSlug)\n if (!cache) {\n return []\n }\n\n return cache.docs.filter((doc) => {\n const docParentId = doc[parentFieldName]\n if (parentId === null) {\n return docParentId === null || docParentId === undefined\n }\n return docParentId !== null && String(docParentId) === String(parentId)\n })\n },\n [collectionSlug, parentFieldName, treeCache],\n )\n\n const hydrate = useCallback((data: HierarchyHydrateData) => {\n const {\n allowedCollections: newAllowedCollections,\n baseFilter: newBaseFilter,\n collectionSlug: slug,\n expandedNodes: newExpandedNodes,\n parent: newParent,\n parentFieldName: newParentFieldName,\n selectedFilters: newSelectedFilters,\n treeData,\n treeLimit: newTreeLimit,\n typeFieldName: newTypeFieldName,\n useAsTitle: newUseAsTitle,\n } = data\n\n setCollectionSlug(slug)\n\n if (newBaseFilter !== undefined) {\n setBaseFilter(newBaseFilter ?? null)\n }\n\n if (newAllowedCollections) {\n setAllowedCollections(newAllowedCollections)\n }\n\n if (newParentFieldName) {\n setParentFieldName(newParentFieldName)\n }\n\n if (newTreeLimit !== undefined) {\n setTreeLimit(newTreeLimit)\n }\n\n if (newTypeFieldName !== undefined) {\n setTypeFieldName(newTypeFieldName)\n }\n\n if (newParent !== undefined) {\n setParent(newParent)\n }\n\n if (newUseAsTitle !== undefined) {\n setUseAsTitle(newUseAsTitle)\n }\n\n if (treeData) {\n setTreeCache((prev) => {\n const newCache = new Map(prev)\n const existingEntry = newCache.get(slug)\n\n // If baseFilter is provided, replace cache entirely (tenant changed)\n // Otherwise merge to support incremental loading\n if (newBaseFilter !== undefined || !existingEntry) {\n newCache.set(slug, { ...treeData, baseFilter: newBaseFilter ?? null })\n } else {\n const existingDocIds = new Set(existingEntry.docs.map((doc) => doc.id))\n const newDocs = treeData.docs.filter((doc) => !existingDocIds.has(doc.id))\n\n // Reconcile loadedCount/totalDocs against the deduped merge rather than\n // blindly overwriting: a shallower fetch (e.g. fewer pages walked) must not\n // regress loadedCount below what's already accumulated in docs, or downstream\n // page-number math in Tree will refetch and duplicate an already-shown page.\n const mergedLoadedParents = { ...existingEntry.loadedParents }\n for (const [parentKey, meta] of Object.entries(treeData.loadedParents)) {\n const existingMeta = existingEntry.loadedParents[parentKey]\n const loadedCount = Math.max(existingMeta?.loadedCount ?? 0, meta.loadedCount ?? 0)\n const totalDocs = Math.max(existingMeta?.totalDocs ?? 0, meta.totalDocs ?? 0)\n mergedLoadedParents[parentKey] = {\n hasMore: loadedCount < totalDocs,\n loadedCount,\n totalDocs,\n }\n }\n\n newCache.set(slug, {\n baseFilter: existingEntry.baseFilter,\n docs: [...existingEntry.docs, ...newDocs],\n loadedParents: mergedLoadedParents,\n })\n }\n\n return newCache\n })\n }\n\n if (newExpandedNodes && newExpandedNodes.length > 0) {\n setExpandedNodesByCollection((prev) => {\n const newMap = new Map(prev)\n const existingExpanded = newMap.get(slug) || new Set()\n const mergedExpanded = new Set([...existingExpanded, ...newExpandedNodes])\n newMap.set(slug, mergedExpanded)\n return newMap\n })\n }\n\n if (newSelectedFilters) {\n setSelectedFiltersByCollection((prev) => {\n const newMap = new Map(prev)\n newMap.set(slug, newSelectedFilters)\n return newMap\n })\n }\n }, [])\n\n const savePreferencesDebounced = useDebouncedCallback(\n async (slug: string, data: { expanded?: Set<number | string>; filters?: string[] }) => {\n const preferenceKey = `${PREFERENCE_KEYS.HIERARCHY_TREE}-${slug}`\n const currentExpanded = expandedNodesByCollection.get(slug) || new Set()\n const currentFilters = selectedFiltersByCollection.get(slug) || []\n\n await setPreference(preferenceKey, {\n expandedNodes: Array.from(data.expanded ?? currentExpanded),\n selectedFilters: data.filters ?? currentFilters,\n })\n },\n 500,\n )\n\n const toggleNodeForCollection = useCallback(\n (slug: string, id: number | string) => {\n setExpandedNodesByCollection((prev) => {\n const newMap = new Map(prev)\n const currentExpanded = newMap.get(slug) || new Set()\n const newExpanded = new Set(currentExpanded)\n\n if (newExpanded.has(id)) {\n newExpanded.delete(id)\n } else {\n newExpanded.add(id)\n }\n\n newMap.set(slug, newExpanded)\n savePreferencesDebounced(slug, { expanded: newExpanded })\n return newMap\n })\n },\n [savePreferencesDebounced],\n )\n\n const collapseAllForCollection = useCallback(\n (slug: string) => {\n setExpandedNodesByCollection((prev) => {\n // Always produce a new Map, even when the collection's set is already empty. The tree\n // may still be rendering server-provided nodes that only this state change can clear.\n const newMap = new Map(prev)\n const newExpanded = new Set<number | string>()\n\n newMap.set(slug, newExpanded)\n savePreferencesDebounced(slug, { expanded: newExpanded })\n return newMap\n })\n },\n [savePreferencesDebounced],\n )\n\n const toggleNode = useCallback(\n (id: number | string) => {\n if (!collectionSlug) {\n return\n }\n toggleNodeForCollection(collectionSlug, id)\n },\n [collectionSlug, toggleNodeForCollection],\n )\n\n const getExpandedNodesForCollection = useCallback(\n (slug: string): Set<number | string> => {\n return expandedNodesByCollection.get(slug) || new Set()\n },\n [expandedNodesByCollection],\n )\n\n const getTreeDataForCollection = useCallback(\n (slug: string) => {\n return treeCache.get(slug) || null\n },\n [treeCache],\n )\n\n const setSelectedFilters = useCallback(\n (filters: string[]) => {\n if (!collectionSlug) {\n return\n }\n\n setSelectedFiltersByCollection((prev) => {\n const newMap = new Map(prev)\n newMap.set(collectionSlug, filters)\n savePreferencesDebounced(collectionSlug, { filters })\n return newMap\n })\n },\n [collectionSlug, savePreferencesDebounced],\n )\n\n const selectParent = useCallback(\n (id: null | number | string) => {\n if (!collectionSlug) {\n return\n }\n\n const queryParam = parentFieldName || 'parent'\n const url = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}${id !== null ? `?${queryParam}=${id}` : ''}`,\n })\n router.push(url)\n router.refresh()\n },\n [adminRoute, collectionSlug, parentFieldName, router],\n )\n\n const loadMoreChildren = useCallback(\n async (parentId: null | number | string): Promise<void> => {\n if (!collectionSlug || isLoadingMore) {\n return\n }\n\n const cache = treeCache.get(collectionSlug)\n if (!cache) {\n return\n }\n\n const parentKey = parentId === null ? 'root' : String(parentId)\n const parentMeta = cache.loadedParents[parentKey]\n if (!parentMeta || !parentMeta.hasMore) {\n return\n }\n\n setIsLoadingMore(true)\n setLoadingNodeId(parentId)\n\n try {\n const currentChildren = cache.docs.filter((doc) => {\n const docParentId = doc[parentFieldName]\n if (parentId === null) {\n return docParentId === null || docParentId === undefined\n }\n return docParentId !== null && String(docParentId) === String(parentId)\n })\n\n const nextPage = Math.floor(currentChildren.length / treeLimit) + 1\n\n const where =\n parentId === null\n ? {\n or: [\n { [parentFieldName]: { exists: false } },\n { [parentFieldName]: { equals: null } },\n ],\n }\n : { [parentFieldName]: { equals: parentId } }\n\n const queryString = qs.stringify(\n { limit: treeLimit, page: nextPage, sort: useAsTitle ?? 'id', where },\n { addQueryPrefix: true },\n )\n const url = formatAdminURL({\n apiRoute: api,\n path: `/${collectionSlug}${queryString}`,\n serverURL,\n })\n const response = await fetch(url, {\n credentials: 'include',\n })\n\n if (!response.ok) {\n throw new Error('Failed to fetch more children')\n }\n\n const data = await response.json()\n const newDocs = data.docs || []\n\n setTreeCache((prev) => {\n const newCache = new Map(prev)\n const existingEntry = newCache.get(collectionSlug)\n\n if (existingEntry) {\n const existingDocIds = new Set(existingEntry.docs.map((doc) => doc.id))\n const uniqueNewDocs = newDocs.filter((doc) => !existingDocIds.has(doc.id))\n\n newCache.set(collectionSlug, {\n docs: [...existingEntry.docs, ...uniqueNewDocs],\n loadedParents: {\n ...existingEntry.loadedParents,\n [parentKey]: {\n hasMore: data.hasNextPage || false,\n loadedCount: currentChildren.length + uniqueNewDocs.length,\n totalDocs: data.totalDocs || 0,\n },\n },\n })\n }\n\n return newCache\n })\n } catch {\n // Failed to load more children - silently fail\n } finally {\n setIsLoadingMore(false)\n setLoadingNodeId(null)\n }\n },\n [\n api,\n collectionSlug,\n isLoadingMore,\n parentFieldName,\n serverURL,\n treeCache,\n treeLimit,\n useAsTitle,\n ],\n )\n\n const reset = useCallback(() => {\n setBaseFilter(null)\n setCollectionSlug(null)\n setParent(null)\n setParentFieldName('')\n setTreeLimit(DEFAULT_HIERARCHY_TREE_LIMIT)\n setTypeFieldName(null)\n setUseAsTitle(null)\n setTreeCache(new Map())\n setExpandedNodesByCollection(new Map())\n setSelectedFiltersByCollection(new Map())\n setIsLoadingMore(false)\n setLoadingNodeId(null)\n }, [])\n\n const refreshTree = useCallback((slug: string) => {\n setTreeCache((prev) => {\n const next = new Map(prev)\n next.delete(slug)\n return next\n })\n setTreeRefreshKeys((prev) => {\n const next = new Map(prev)\n next.set(slug, (next.get(slug) ?? 0) + 1)\n return next\n })\n }, [])\n\n const expandedNodes =\n collectionSlug && expandedNodesByCollection.has(collectionSlug)\n ? expandedNodesByCollection.get(collectionSlug)\n : new Set<number | string>()\n\n const selectedFilters =\n collectionSlug && selectedFiltersByCollection.has(collectionSlug)\n ? selectedFiltersByCollection.get(collectionSlug)\n : []\n\n const value: HierarchyContextValue = {\n allowedCollections,\n baseFilter,\n collapseAllForCollection,\n collectionSlug,\n expandedNodes,\n getExpandedNodesForCollection,\n getNodeChildren,\n getTreeDataForCollection,\n hydrate,\n isLoadingMore,\n loadingNodeId,\n loadMoreChildren,\n parent,\n parentFieldName,\n refreshTree,\n reset,\n selectedFilters,\n selectParent,\n setSelectedFilters,\n toggleNode,\n toggleNodeForCollection,\n treeLimit,\n treeRefreshKeys,\n typeFieldName,\n useAsTitle,\n }\n\n return <HierarchyContext value={value}>{children}</HierarchyContext>\n}\n\nexport const useHierarchy = (): HierarchyContextValue => {\n const context = use(HierarchyContext)\n if (!context) {\n throw new Error('useHierarchy must be used within HierarchyProvider')\n }\n return context\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,4BAA4B,EAAEC,cAAc,EAAEC,eAAe,QAAQ;AAC9E,YAAYC,EAAA,MAAQ;AACpB,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,WAAW,EAAEC,QAAQ,QAAQ;AAWjE,SAASC,oBAAoB,QAAQ;AACrC,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAC/B,SAASC,SAAS,QAAQ;AAE1B,MAAMC,gBAAA,gBAAmBR,aAAA,CAAiDS,SAAA;AAE1E,OAAO,MAAMC,iBAAA,GAAsDA,CAAC;EAAEC;AAAQ,CAAE;EAC9E,MAAM;IAAEC;EAAa,CAAE,GAAGN,cAAA;EAC1B,MAAMO,MAAA,GAASN,SAAA;EACf,MAAM;IACJO,MAAA,EAAQ;MACNC,MAAA,EAAQ;QAAEC,KAAA,EAAOC,UAAU;QAAEC;MAAG,CAAE;MAClCC;IAAS;EACV,CACF,GAAGd,SAAA;EAEJ,MAAM,CAACe,UAAA,EAAYC,aAAA,CAAc,GAAGlB,QAAA,CAAuB;EAC3D,MAAM,CAACmB,cAAA,EAAgBC,iBAAA,CAAkB,GAAGpB,QAAA,CAAwB;EACpE,MAAM,CAACqB,MAAA,EAAQC,SAAA,CAAU,GAAGtB,QAAA,CAAwD;EACpF,MAAM,CAACuB,eAAA,EAAiBC,kBAAA,CAAmB,GAAGxB,QAAA,CAAiB;EAC/D,MAAM,CAACyB,SAAA,EAAWC,YAAA,CAAa,GAAG1B,QAAA,CAAiBR,4BAAA;EACnD,MAAM,CAACmC,aAAA,EAAeC,gBAAA,CAAiB,GAAG5B,QAAA,CAAwB;EAClE,MAAM,CAAC6B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ACAkD,YAAA;IACAD,kBAAA;IACAH,UAAA;IACAL,uBAAA;IACAhF,SAAA;IACAmB,eAAA;IACAjB,aAAA;IACAE;EACF;EAEA,oBAAOuH,IAAA,CAAC/I,gBAAA;IAAiB8I,KAAA,EAAOA,KAAA;cAAQ3I;;AAC1C;AAEA,OAAO,MAAM6I,YAAA,GAAeA,CAAA;EAC1B,MAAMC,OAAA,GAAUxJ,GAAA,CAAIO,gBAAA;EACpB,IAAI,CAACiJ,OAAA,EAAS;IACZ,MAAM,IAAIV,KAAA,CAAM;EAClB;EACA,OAAOU,OAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["DEFAULT_HIERARCHY_TREE_LIMIT","formatAdminURL","PREFERENCE_KEYS","qs","React","createContext","use","useCallback","useState","useDebouncedCallback","useConfig","usePreferences","useRouter","HierarchyContext","undefined","HierarchyProvider","children","setPreference","router","config","routes","admin","adminRoute","api","serverURL","baseFilter","setBaseFilter","collectionSlug","setCollectionSlug","parent","setParent","parentFieldName","setParentFieldName","treeLimit","setTreeLimit","typeFieldName","setTypeFieldName","useAsTitle","setUseAsTitle","allowedCollections","setAllowedCollections","treeCache","setTreeCache","Map","expandedNodesByCollection","setExpandedNodesByCollection","selectedFiltersByCollection","setSelectedFiltersByCollection","isLoadingMore","setIsLoadingMore","loadingNodeId","setLoadingNodeId","treeRefreshKeys","setTreeRefreshKeys","getNodeChildren","parentId","cache","get","docs","filter","doc","docParentId","String","hydrate","data","newAllowedCollections","newBaseFilter","slug","expandedNodes","newExpandedNodes","newParent","newParentFieldName","selectedFilters","newSelectedFilters","treeData","newTreeLimit","newTypeFieldName","newUseAsTitle","prev","newCache","existingEntry","set","existingDocIds","Set","map","id","newDocs","has","loadedParents","length","newMap","existingExpanded","mergedExpanded","savePreferencesDebounced","preferenceKey","HIERARCHY_TREE","currentExpanded","currentFilters","Array","from","expanded","filters","toggleNodeForCollection","newExpanded","delete","add","toggleNode","getExpandedNodesForCollection","getTreeDataForCollection","setSelectedFilters","selectParent","queryParam","url","path","push","refresh","loadMoreChildren","parentKey","parentMeta","hasMore","currentChildren","nextPage","Math","floor","where","or","exists","equals","queryString","stringify","limit","page","sort","addQueryPrefix","apiRoute","response","fetch","credentials","ok","Error","json","uniqueNewDocs","hasNextPage","totalDocs","reset","refreshTree","next","value","_jsx","useHierarchy","context"],"sources":["../../../src/providers/Hierarchy/index.tsx"],"sourcesContent":["'use client'\n\nimport type { TypeWithID, Where } from 'payload'\n\nimport { DEFAULT_HIERARCHY_TREE_LIMIT, formatAdminURL, PREFERENCE_KEYS } from 'payload/shared'\nimport * as qs from 'qs-esm'\nimport React, { createContext, use, useCallback, useState } from 'react'\n\nimport type {\n AllowedCollection,\n HierarchyContextValue,\n HierarchyDocument,\n HierarchyHydrateData,\n HierarchyProviderProps,\n HierarchyTreeCacheEntry,\n} from './types.js'\n\nimport { useDebouncedCallback } from '../../hooks/useDebouncedCallback.js'\nimport { useConfig } from '../Config/index.js'\nimport { usePreferences } from '../Preferences/index.js'\nimport { useRouter } from '../RouterAdapter/index.js'\n\nconst HierarchyContext = createContext<HierarchyContextValue | undefined>(undefined)\n\nexport const HierarchyProvider: React.FC<HierarchyProviderProps> = ({ children }) => {\n const { setPreference } = usePreferences()\n const router = useRouter()\n const {\n config: {\n routes: { admin: adminRoute, api },\n serverURL,\n },\n } = useConfig()\n\n const [baseFilter, setBaseFilter] = useState<null | Where>(null)\n const [collectionSlug, setCollectionSlug] = useState<null | string>(null)\n const [parent, setParent] = useState<null | (Record<string, unknown> & TypeWithID)>(null)\n const [parentFieldName, setParentFieldName] = useState<string>('')\n const [treeLimit, setTreeLimit] = useState<number>(DEFAULT_HIERARCHY_TREE_LIMIT)\n const [typeFieldName, setTypeFieldName] = useState<null | string>(null)\n const [useAsTitle, setUseAsTitle] = useState<null | string>(null)\n const [allowedCollections, setAllowedCollections] = useState<AllowedCollection[] | null>(null)\n\n const [treeCache, setTreeCache] = useState<Map<string, HierarchyTreeCacheEntry>>(() => new Map())\n const [expandedNodesByCollection, setExpandedNodesByCollection] = useState<\n Map<string, Set<number | string>>\n >(() => new Map())\n const [selectedFiltersByCollection, setSelectedFiltersByCollection] = useState<\n Map<string, string[]>\n >(() => new Map())\n const [isLoadingMore, setIsLoadingMore] = useState<boolean>(false)\n const [loadingNodeId, setLoadingNodeId] = useState<null | number | string>(null)\n const [treeRefreshKeys, setTreeRefreshKeys] = useState<Map<string, number>>(() => new Map())\n\n const getNodeChildren = useCallback(\n (parentId: null | number | string): HierarchyDocument[] => {\n if (!collectionSlug) {\n return []\n }\n\n const cache = treeCache.get(collectionSlug)\n if (!cache) {\n return []\n }\n\n return cache.docs.filter((doc) => {\n const docParentId = doc[parentFieldName]\n if (parentId === null) {\n return docParentId === null || docParentId === undefined\n }\n return docParentId !== null && String(docParentId) === String(parentId)\n })\n },\n [collectionSlug, parentFieldName, treeCache],\n )\n\n const hydrate = useCallback((data: HierarchyHydrateData) => {\n const {\n allowedCollections: newAllowedCollections,\n baseFilter: newBaseFilter,\n collectionSlug: slug,\n expandedNodes: newExpandedNodes,\n parent: newParent,\n parentFieldName: newParentFieldName,\n selectedFilters: newSelectedFilters,\n treeData,\n treeLimit: newTreeLimit,\n typeFieldName: newTypeFieldName,\n useAsTitle: newUseAsTitle,\n } = data\n\n setCollectionSlug(slug)\n\n if (newBaseFilter !== undefined) {\n setBaseFilter(newBaseFilter ?? null)\n }\n\n if (newAllowedCollections) {\n setAllowedCollections(newAllowedCollections)\n }\n\n if (newParentFieldName) {\n setParentFieldName(newParentFieldName)\n }\n\n if (newTreeLimit !== undefined) {\n setTreeLimit(newTreeLimit)\n }\n\n if (newTypeFieldName !== undefined) {\n setTypeFieldName(newTypeFieldName)\n }\n\n if (newParent !== undefined) {\n setParent(newParent)\n }\n\n if (newUseAsTitle !== undefined) {\n setUseAsTitle(newUseAsTitle)\n }\n\n if (treeData) {\n setTreeCache((prev) => {\n const newCache = new Map(prev)\n const existingEntry = newCache.get(slug)\n\n // If baseFilter is provided, replace cache entirely (tenant changed)\n // Otherwise merge to support incremental loading\n if (newBaseFilter !== undefined || !existingEntry) {\n newCache.set(slug, { ...treeData, baseFilter: newBaseFilter ?? null })\n } else {\n const existingDocIds = new Set(existingEntry.docs.map((doc) => doc.id))\n const newDocs = treeData.docs.filter((doc) => !existingDocIds.has(doc.id))\n\n newCache.set(slug, {\n baseFilter: existingEntry.baseFilter,\n docs: [...existingEntry.docs, ...newDocs],\n loadedParents: {\n ...existingEntry.loadedParents,\n ...treeData.loadedParents,\n },\n })\n }\n\n return newCache\n })\n }\n\n if (newExpandedNodes && newExpandedNodes.length > 0) {\n setExpandedNodesByCollection((prev) => {\n const newMap = new Map(prev)\n const existingExpanded = newMap.get(slug) || new Set()\n const mergedExpanded = new Set([...existingExpanded, ...newExpandedNodes])\n newMap.set(slug, mergedExpanded)\n return newMap\n })\n }\n\n if (newSelectedFilters) {\n setSelectedFiltersByCollection((prev) => {\n const newMap = new Map(prev)\n newMap.set(slug, newSelectedFilters)\n return newMap\n })\n }\n }, [])\n\n const savePreferencesDebounced = useDebouncedCallback(\n async (slug: string, data: { expanded?: Set<number | string>; filters?: string[] }) => {\n const preferenceKey = `${PREFERENCE_KEYS.HIERARCHY_TREE}-${slug}`\n const currentExpanded = expandedNodesByCollection.get(slug) || new Set()\n const currentFilters = selectedFiltersByCollection.get(slug) || []\n\n await setPreference(preferenceKey, {\n expandedNodes: Array.from(data.expanded ?? currentExpanded),\n selectedFilters: data.filters ?? currentFilters,\n })\n },\n 500,\n )\n\n const toggleNodeForCollection = useCallback(\n (slug: string, id: number | string) => {\n setExpandedNodesByCollection((prev) => {\n const newMap = new Map(prev)\n const currentExpanded = newMap.get(slug) || new Set()\n const newExpanded = new Set(currentExpanded)\n\n if (newExpanded.has(id)) {\n newExpanded.delete(id)\n } else {\n newExpanded.add(id)\n }\n\n newMap.set(slug, newExpanded)\n savePreferencesDebounced(slug, { expanded: newExpanded })\n return newMap\n })\n },\n [savePreferencesDebounced],\n )\n\n const toggleNode = useCallback(\n (id: number | string) => {\n if (!collectionSlug) {\n return\n }\n toggleNodeForCollection(collectionSlug, id)\n },\n [collectionSlug, toggleNodeForCollection],\n )\n\n const getExpandedNodesForCollection = useCallback(\n (slug: string): Set<number | string> => {\n return expandedNodesByCollection.get(slug) || new Set()\n },\n [expandedNodesByCollection],\n )\n\n const getTreeDataForCollection = useCallback(\n (slug: string) => {\n return treeCache.get(slug) || null\n },\n [treeCache],\n )\n\n const setSelectedFilters = useCallback(\n (filters: string[]) => {\n if (!collectionSlug) {\n return\n }\n\n setSelectedFiltersByCollection((prev) => {\n const newMap = new Map(prev)\n newMap.set(collectionSlug, filters)\n savePreferencesDebounced(collectionSlug, { filters })\n return newMap\n })\n },\n [collectionSlug, savePreferencesDebounced],\n )\n\n const selectParent = useCallback(\n (id: null | number | string) => {\n if (!collectionSlug) {\n return\n }\n\n const queryParam = parentFieldName || 'parent'\n const url = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}${id !== null ? `?${queryParam}=${id}` : ''}`,\n })\n router.push(url)\n router.refresh()\n },\n [adminRoute, collectionSlug, parentFieldName, router],\n )\n\n const loadMoreChildren = useCallback(\n async (parentId: null | number | string): Promise<void> => {\n if (!collectionSlug || isLoadingMore) {\n return\n }\n\n const cache = treeCache.get(collectionSlug)\n if (!cache) {\n return\n }\n\n const parentKey = parentId === null ? 'root' : String(parentId)\n const parentMeta = cache.loadedParents[parentKey]\n if (!parentMeta || !parentMeta.hasMore) {\n return\n }\n\n setIsLoadingMore(true)\n setLoadingNodeId(parentId)\n\n try {\n const currentChildren = cache.docs.filter((doc) => {\n const docParentId = doc[parentFieldName]\n if (parentId === null) {\n return docParentId === null || docParentId === undefined\n }\n return docParentId !== null && String(docParentId) === String(parentId)\n })\n\n const nextPage = Math.floor(currentChildren.length / treeLimit) + 1\n\n const where =\n parentId === null\n ? {\n or: [\n { [parentFieldName]: { exists: false } },\n { [parentFieldName]: { equals: null } },\n ],\n }\n : { [parentFieldName]: { equals: parentId } }\n\n const queryString = qs.stringify(\n { limit: treeLimit, page: nextPage, sort: useAsTitle ?? 'id', where },\n { addQueryPrefix: true },\n )\n const url = formatAdminURL({\n apiRoute: api,\n path: `/${collectionSlug}${queryString}`,\n serverURL,\n })\n const response = await fetch(url, {\n credentials: 'include',\n })\n\n if (!response.ok) {\n throw new Error('Failed to fetch more children')\n }\n\n const data = await response.json()\n const newDocs = data.docs || []\n\n setTreeCache((prev) => {\n const newCache = new Map(prev)\n const existingEntry = newCache.get(collectionSlug)\n\n if (existingEntry) {\n const existingDocIds = new Set(existingEntry.docs.map((doc) => doc.id))\n const uniqueNewDocs = newDocs.filter((doc) => !existingDocIds.has(doc.id))\n\n newCache.set(collectionSlug, {\n docs: [...existingEntry.docs, ...uniqueNewDocs],\n loadedParents: {\n ...existingEntry.loadedParents,\n [parentKey]: {\n hasMore: data.hasNextPage || false,\n totalDocs: data.totalDocs || 0,\n },\n },\n })\n }\n\n return newCache\n })\n } catch {\n // Failed to load more children - silently fail\n } finally {\n setIsLoadingMore(false)\n setLoadingNodeId(null)\n }\n },\n [\n api,\n collectionSlug,\n isLoadingMore,\n parentFieldName,\n serverURL,\n treeCache,\n treeLimit,\n useAsTitle,\n ],\n )\n\n const reset = useCallback(() => {\n setBaseFilter(null)\n setCollectionSlug(null)\n setParent(null)\n setParentFieldName('')\n setTreeLimit(DEFAULT_HIERARCHY_TREE_LIMIT)\n setTypeFieldName(null)\n setUseAsTitle(null)\n setTreeCache(new Map())\n setExpandedNodesByCollection(new Map())\n setSelectedFiltersByCollection(new Map())\n setIsLoadingMore(false)\n setLoadingNodeId(null)\n }, [])\n\n const refreshTree = useCallback((slug: string) => {\n setTreeCache((prev) => {\n const next = new Map(prev)\n next.delete(slug)\n return next\n })\n setTreeRefreshKeys((prev) => {\n const next = new Map(prev)\n next.set(slug, (next.get(slug) ?? 0) + 1)\n return next\n })\n }, [])\n\n const expandedNodes =\n collectionSlug && expandedNodesByCollection.has(collectionSlug)\n ? expandedNodesByCollection.get(collectionSlug)\n : new Set<number | string>()\n\n const selectedFilters =\n collectionSlug && selectedFiltersByCollection.has(collectionSlug)\n ? selectedFiltersByCollection.get(collectionSlug)\n : []\n\n const value: HierarchyContextValue = {\n allowedCollections,\n baseFilter,\n collectionSlug,\n expandedNodes,\n getExpandedNodesForCollection,\n getNodeChildren,\n getTreeDataForCollection,\n hydrate,\n isLoadingMore,\n loadingNodeId,\n loadMoreChildren,\n parent,\n parentFieldName,\n refreshTree,\n reset,\n selectedFilters,\n selectParent,\n setSelectedFilters,\n toggleNode,\n toggleNodeForCollection,\n treeLimit,\n treeRefreshKeys,\n typeFieldName,\n useAsTitle,\n }\n\n return <HierarchyContext value={value}>{children}</HierarchyContext>\n}\n\nexport const useHierarchy = (): HierarchyContextValue => {\n const context = use(HierarchyContext)\n if (!context) {\n throw new Error('useHierarchy must be used within HierarchyProvider')\n }\n return context\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,4BAA4B,EAAEC,cAAc,EAAEC,eAAe,QAAQ;AAC9E,YAAYC,EAAA,MAAQ;AACpB,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,WAAW,EAAEC,QAAQ,QAAQ;AAWjE,SAASC,oBAAoB,QAAQ;AACrC,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAC/B,SAASC,SAAS,QAAQ;AAE1B,MAAMC,gBAAA,gBAAmBR,aAAA,CAAiDS,SAAA;AAE1E,OAAO,MAAMC,iBAAA,GAAsDA,CAAC;EAAEC;AAAQ,CAAE;EAC9E,MAAM;IAAEC;EAAa,CAAE,GAAGN,cAAA;EAC1B,MAAMO,MAAA,GAASN,SAAA;EACf,MAAM;IACJO,MAAA,EAAQ;MACNC,MAAA,EAAQ;QAAEC,KAAA,EAAOC,UAAU;QAAEC;MAAG,CAAE;MAClCC;IAAS;EACV,CACF,GAAGd,SAAA;EAEJ,MAAM,CAACe,UAAA,EAAYC,aAAA,CAAc,GAAGlB,QAAA,CAAuB;E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C+E,MAAA,CAAKzF,GAAG,CAACU,MAAA,KAAS,KAAK;MACvC,OAAO+E,MAAA;IACT;EACF,GAAG,EAAE;EAEL,MAAM9E,aAAA,GACJzC,cAAA,IAAkBiB,yBAAA,CAA0B2C,GAAG,CAAC5D,cAAA,IAC5CiB,yBAAA,CAA0Ba,GAAG,CAAC9B,cAAA,IAC9B,IAAIwD,GAAA;EAEV,MAAMX,eAAA,GACJ7C,cAAA,IAAkBmB,2BAAA,CAA4ByC,GAAG,CAAC5D,cAAA,IAC9CmB,2BAAA,CAA4BW,GAAG,CAAC9B,cAAA,IAChC,EAAE;EAER,MAAMwH,KAAA,GAA+B;IACnC5G,kBAAA;IACAd,UAAA;IACAE,cAAA;IACAyC,aAAA;IACAuC,6BAAA;IACArD,eAAA;IACAsD,wBAAA;IACA7C,OAAA;IACAf,aAAA;IACAE,aAAA;IACAkE,gBAAA;IACAvF,MAAA;IACAE,eAAA;IACAkH,WAAA;IACAD,KAAA;IACAxE,eAAA;IACAsC,YAAA;IACAD,kBAAA;IACAH,UAAA;IACAJ,uBAAA;IACArE,SAAA;IACAmB,eAAA;IACAjB,aAAA;IACAE;EACF;EAEA,oBAAO+G,IAAA,CAACvI,gBAAA;IAAiBsI,KAAA,EAAOA,KAAA;cAAQnI;;AAC1C;AAEA,OAAO,MAAMqI,YAAA,GAAeA,CAAA;EAC1B,MAAMC,OAAA,GAAUhJ,GAAA,CAAIO,gBAAA;EACpB,IAAI,CAACyI,OAAA,EAAS;IACZ,MAAM,IAAIX,KAAA,CAAM;EAClB;EACA,OAAOW,OAAA;AACT","ignoreList":[]}
@@ -45,8 +45,6 @@ export type HierarchyHydrateData = {
45
45
  export type HierarchyContextValue = {
46
46
  allowedCollections: AllowedCollection[] | null;
47
47
  baseFilter: null | Where;
48
- /** Collapse every expanded node for a specific collection (persists to preferences) */
49
- collapseAllForCollection: (collectionSlug: string) => void;
50
48
  collectionSlug: null | string;
51
49
  expandedNodes: Set<number | string>;
52
50
  /** Get expanded nodes for a specific collection (use this in tabs to avoid cross-tab state conflicts) */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/providers/Hierarchy/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;IACtB,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,GAAG,UAAU,CAAA;AAEd,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,CAAC,EAAE,IAAI,GAAG,KAAK,CAAA;IACzB,IAAI,EAAE,iBAAiB,EAAE,CAAA;IACzB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC7F,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,CAAC,EAAE,IAAI,GAAG,KAAK,CAAA;IACzB,IAAI,EAAE,iBAAiB,EAAE,CAAA;IACzB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC7F,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAE/D,MAAM,MAAM,oBAAoB,GAAG;IACjC,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAA;IAC/C,UAAU,CAAC,EAAE,IAAI,GAAG,KAAK,CAAA;IACzB,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,CA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AC9E,aAAa,EAAE,IAAI,GAAG,MAAM,CAAA;IAC5B,UAAU,EAAE,IAAI,GAAG,MAAM,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAA;IAC/C,UAAU,CAAC,EAAE,IAAI,GAAG,KAAK,CAAA;IACzB,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IACnC,8FAA8F;IAC9F,MAAM,CAAC,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAAC,CAAA;IACtD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,gDAAgD;IAChD,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;IAC1B,SAAS,CAAC,EAAE,aAAa,CAAA;IACzB,QAAQ,CAAC,EAAE,oBAAoB,CAAA;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8EAA8E;IAC9E,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/providers/Hierarchy/types.ts"],"sourcesContent":["import type { PaginatedDocs, TypeWithID, Where } from 'payload'\n\nexport type HierarchyDocument = {\n [key: string]: unknown\n _hasChildren?: boolean\n} & TypeWithID\n\nexport type HierarchyInitialData = {\n baseFilter?: null | Where\n docs: HierarchyDocument[]\n loadedParents: Record<string, { hasMore: boolean; loadedCount?: number; totalDocs: number }>\n}\n\nexport type HierarchyTreeCacheEntry = {\n baseFilter?: null | Where\n docs: HierarchyDocument[]\n loadedParents: Record<string, { hasMore: boolean; loadedCount?: number; totalDocs: number }>\n}\n\nexport type AllowedCollection = { label: string; slug: string }\n\nexport type HierarchyHydrateData = {\n allowedCollections?: AllowedCollection[] | null\n baseFilter?: null | Where\n collectionSlug: string\n expandedNodes?: (number | string)[]\n /** The full data of the current parent (for accessing id, collectionSpecific values, etc.) */\n parent?: null | (Record<string, unknown> & TypeWithID)\n parentFieldName?: string\n /** Initial selected filters from preferences */\n selectedFilters?: string[]\n tableData?: PaginatedDocs\n treeData?: HierarchyInitialData\n treeLimit?: number\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName?: string\n useAsTitle?: string\n}\n\nexport type HierarchyContextValue = {\n allowedCollections: AllowedCollection[] | null\n baseFilter: null | Where\n /** Collapse every expanded node for a specific collection (persists to preferences) */\n collapseAllForCollection: (collectionSlug: string) => void\n collectionSlug: null | string\n expandedNodes: Set<number | string>\n /** Get expanded nodes for a specific collection (use this in tabs to avoid cross-tab state conflicts) */\n getExpandedNodesForCollection: (collectionSlug: string) => Set<number | string>\n getNodeChildren: (parentId: null | number | string) => HierarchyDocument[]\n /** Get tree data for a specific collection (returns null if not hydrated or cleared by refresh) */\n getTreeDataForCollection: (collectionSlug: string) => HierarchyInitialData | null\n hydrate: (data: HierarchyHydrateData) => void\n isLoadingMore: boolean\n loadingNodeId: null | number | string\n loadMoreChildren: (parentId: null | number | string) => Promise<void>\n /** The full data of the current parent (for accessing id, collectionSpecific values, etc.) */\n parent: null | (Record<string, unknown> & TypeWithID)\n parentFieldName: string\n /** Refresh the tree for a specific collection by clearing its cache and incrementing its key */\n refreshTree: (collectionSlug: string) => void\n reset: () => void\n /** Selected collection type filters for the sidebar tree */\n selectedFilters: string[]\n selectParent: (id: null | number | string) => void\n /** Update selected filters (persists to preferences) */\n setSelectedFilters: (filters: string[]) => void\n toggleNode: (id: number | string) => void\n /** Toggle node expansion for a specific collection (use this in tabs to avoid cross-tab state conflicts) */\n toggleNodeForCollection: (collectionSlug: string, id: number | string) => void\n treeLimit: number\n /** Per-collection keys that change when refreshTree(slug) is called */\n treeRefreshKeys: Map<string, number>\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName: null | string\n useAsTitle: null | string\n}\n\nexport type HierarchyProviderProps = {\n children: React.ReactNode\n}\n\nexport type HydrateHierarchyProviderProps = {\n allowedCollections?: AllowedCollection[] | null\n baseFilter?: null | Where\n collectionSlug: string\n expandedNodes?: (number | string)[]\n /** The full data of the current parent (for accessing id, collectionSpecific values, etc.) */\n parent?: null | (Record<string, unknown> & TypeWithID)\n parentFieldName?: string\n /** Initial selected filters from preferences */\n selectedFilters?: string[]\n tableData?: PaginatedDocs\n treeData?: HierarchyInitialData\n treeLimit?: number\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName?: string\n useAsTitle?: string\n}\n"],"mappings":"AAiFA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/providers/Hierarchy/types.ts"],"sourcesContent":["import type { PaginatedDocs, TypeWithID, Where } from 'payload'\n\nexport type HierarchyDocument = {\n [key: string]: unknown\n _hasChildren?: boolean\n} & TypeWithID\n\nexport type HierarchyInitialData = {\n baseFilter?: null | Where\n docs: HierarchyDocument[]\n loadedParents: Record<string, { hasMore: boolean; loadedCount?: number; totalDocs: number }>\n}\n\nexport type HierarchyTreeCacheEntry = {\n baseFilter?: null | Where\n docs: HierarchyDocument[]\n loadedParents: Record<string, { hasMore: boolean; loadedCount?: number; totalDocs: number }>\n}\n\nexport type AllowedCollection = { label: string; slug: string }\n\nexport type HierarchyHydrateData = {\n allowedCollections?: AllowedCollection[] | null\n baseFilter?: null | Where\n collectionSlug: string\n expandedNodes?: (number | string)[]\n /** The full data of the current parent (for accessing id, collectionSpecific values, etc.) */\n parent?: null | (Record<string, unknown> & TypeWithID)\n parentFieldName?: string\n /** Initial selected filters from preferences */\n selectedFilters?: string[]\n tableData?: PaginatedDocs\n treeData?: HierarchyInitialData\n treeLimit?: number\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName?: string\n useAsTitle?: string\n}\n\nexport type HierarchyContextValue = {\n allowedCollections: AllowedCollection[] | null\n baseFilter: null | Where\n collectionSlug: null | string\n expandedNodes: Set<number | string>\n /** Get expanded nodes for a specific collection (use this in tabs to avoid cross-tab state conflicts) */\n getExpandedNodesForCollection: (collectionSlug: string) => Set<number | string>\n getNodeChildren: (parentId: null | number | string) => HierarchyDocument[]\n /** Get tree data for a specific collection (returns null if not hydrated or cleared by refresh) */\n getTreeDataForCollection: (collectionSlug: string) => HierarchyInitialData | null\n hydrate: (data: HierarchyHydrateData) => void\n isLoadingMore: boolean\n loadingNodeId: null | number | string\n loadMoreChildren: (parentId: null | number | string) => Promise<void>\n /** The full data of the current parent (for accessing id, collectionSpecific values, etc.) */\n parent: null | (Record<string, unknown> & TypeWithID)\n parentFieldName: string\n /** Refresh the tree for a specific collection by clearing its cache and incrementing its key */\n refreshTree: (collectionSlug: string) => void\n reset: () => void\n /** Selected collection type filters for the sidebar tree */\n selectedFilters: string[]\n selectParent: (id: null | number | string) => void\n /** Update selected filters (persists to preferences) */\n setSelectedFilters: (filters: string[]) => void\n toggleNode: (id: number | string) => void\n /** Toggle node expansion for a specific collection (use this in tabs to avoid cross-tab state conflicts) */\n toggleNodeForCollection: (collectionSlug: string, id: number | string) => void\n treeLimit: number\n /** Per-collection keys that change when refreshTree(slug) is called */\n treeRefreshKeys: Map<string, number>\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName: null | string\n useAsTitle: null | string\n}\n\nexport type HierarchyProviderProps = {\n children: React.ReactNode\n}\n\nexport type HydrateHierarchyProviderProps = {\n allowedCollections?: AllowedCollection[] | null\n baseFilter?: null | Where\n collectionSlug: string\n expandedNodes?: (number | string)[]\n /** The full data of the current parent (for accessing id, collectionSpecific values, etc.) */\n parent?: null | (Record<string, unknown> & TypeWithID)\n parentFieldName?: string\n /** Initial selected filters from preferences */\n selectedFilters?: string[]\n tableData?: PaginatedDocs\n treeData?: HierarchyInitialData\n treeLimit?: number\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName?: string\n useAsTitle?: string\n}\n"],"mappings":"AA+EA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/LivePreview/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAyB,iBAAiB,EAAsB,MAAM,SAAS,CAAA;AAG3F,OAAO,KAAmE,MAAM,OAAO,CAAA;AAEvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAU1D,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,WAAW,CAAC,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAA;IAC9C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,UAAU,CAAC,EAAE;QACX,MAAM,EAAE,MAAM,CAAA;QACd,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,gBAAgB,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,GAAG,IAAI,CAAC,sBAAsB,EAAE,sBAAsB,GAAG,KAAK,CAAC,CAAA;AAEhE,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAwQlE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/LivePreview/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAyB,iBAAiB,EAAsB,MAAM,SAAS,CAAA;AAG3F,OAAO,KAAmE,MAAM,OAAO,CAAA;AAEvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAW1D,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,WAAW,CAAC,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAA;IAC9C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,UAAU,CAAC,EAAE;QACX,MAAM,EAAE,MAAM,CAAA;QACd,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,gBAAgB,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,GAAG,IAAI,CAAC,sBAAsB,EAAE,sBAAsB,GAAG,KAAK,CAAC,CAAA;AAEhE,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAgRlE,CAAA"}
@@ -7,6 +7,7 @@ import { usePopupWindow } from '../../hooks/usePopupWindow.js';
7
7
  import { useDocumentInfo } from '../../providers/DocumentInfo/index.js';
8
8
  import { usePreferences } from '../../providers/Preferences/index.js';
9
9
  import { formatAbsoluteURL } from '../../utilities/formatAbsoluteURL.js';
10
+ import { isHttpURL } from '../../utilities/isHttpURL.js';
10
11
  import { customCollisionDetection } from './collisionDetection.js';
11
12
  import { LivePreviewContext } from './context.js';
12
13
  import { sizeReducer } from './sizeReducer.js';
@@ -39,7 +40,13 @@ export const LivePreviewProvider = ({
39
40
  width: '100%'
40
41
  }], [incomingBreakpoints]);
41
42
  const [url, setURL] = useState('');
42
- const [previewURL, setPreviewURL] = useState(previewURLFromProps);
43
+ const [previewURL, _setPreviewURL] = useState();
44
+ const setPreviewURL = useCallback(incomingURL => {
45
+ _setPreviewURL(isHttpURL(incomingURL) ? incomingURL : undefined);
46
+ }, []);
47
+ useEffect(() => {
48
+ setPreviewURL(previewURLFromProps);
49
+ }, [previewURLFromProps, setPreviewURL]);
43
50
  const {
44
51
  isPopupOpen,
45
52
  openPopupWindow,
@@ -84,16 +91,16 @@ export const LivePreviewProvider = ({
84
91
  * - resets `appIsReady` to `false` while the new URL is loading
85
92
  */
86
93
  const setLivePreviewURL = useCallback(_incomingURL => {
87
- let incomingURL;
94
+ let incomingURL_0;
88
95
  if (typeof _incomingURL === 'string') {
89
- incomingURL = formatAbsoluteURL(_incomingURL);
96
+ incomingURL_0 = formatAbsoluteURL(_incomingURL);
90
97
  }
91
- if (!incomingURL) {
98
+ if (!incomingURL_0) {
92
99
  setIsLivePreviewing(false);
93
100
  }
94
- if (incomingURL !== url) {
101
+ if (incomingURL_0 !== url) {
95
102
  setAppIsReady(false);
96
- setURL(incomingURL);
103
+ setURL(incomingURL_0);
97
104
  }
98
105
  }, [setIsLivePreviewing, url]);
99
106
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["DndContext","React","useCallback","useEffect","useId","useMemo","useRef","useState","usePopupWindow","useDocumentInfo","usePreferences","formatAbsoluteURL","customCollisionDetection","LivePreviewContext","sizeReducer","LivePreviewProvider","breakpoints","incomingBreakpoints","children","isLivePreviewEnabled","isLivePreviewing","incomingIsLivePreviewing","isPreviewEnabled","previewURL","previewURLFromProps","typeofLivePreviewURL","url","urlFromProps","_setIsLivePreviewing","shouldRenderIframe","setShouldRenderIframe","setIsLivePreviewing","livePreviewing","name","height","label","width","setURL","setPreviewURL","isPopupOpen","openPopupWindow","popupRef","eventType","appIsReady","setAppIsReady","lastReadyAt","setLastReadyAt","collectionSlug","globalSlug","isFirstRender","setPreference","iframeRef","isExpanded","setIsExpanded","loadedURL","setLoadedURL","zoom","setZoom","position","setPosition","x","y","size","setSize","useReducer","measuredDeviceSize","setMeasuredDeviceSize","breakpoint","setBreakpoint","setLivePreviewURL","_incomingURL","incomingURL","handleDragEnd","ev","over","id","newPos","delta","setWidth","type","value","setHeight","foundBreakpoint","find","bp","handleMessage","event","startsWith","origin","data","ready","Date","now","window","addEventListener","removeEventListener","current","editViewType","dndContextID","_jsx","setToolbarPosition","toolbarPosition","collisionDetection","onDragEnd"],"sources":["../../../src/providers/LivePreview/index.tsx"],"sourcesContent":["'use client'\nimport type { CollectionPreferences, LivePreviewConfig, LivePreviewURLType } from 'payload'\n\nimport { DndContext } from '@dnd-kit/core'\nimport React, { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'\n\nimport type { LivePreviewContextType } from './context.js'\n\nimport { usePopupWindow } from '../../hooks/usePopupWindow.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { usePreferences } from '../../providers/Preferences/index.js'\nimport { formatAbsoluteURL } from '../../utilities/formatAbsoluteURL.js'\nimport { customCollisionDetection } from './collisionDetection.js'\nimport { LivePreviewContext } from './context.js'\nimport { sizeReducer } from './sizeReducer.js'\n\nexport type LivePreviewProviderProps = {\n appIsReady?: boolean\n breakpoints?: LivePreviewConfig['breakpoints']\n children: React.ReactNode\n deviceSize?: {\n height: number\n width: number\n }\n isLivePreviewEnabled?: boolean\n isLivePreviewing: boolean\n /**\n * This specifically relates to `admin.preview` function in the config instead of live preview.\n */\n isPreviewEnabled?: boolean\n /**\n * This specifically relates to `admin.preview` function in the config instead of live preview.\n */\n previewURL?: string\n} & Pick<LivePreviewContextType, 'typeofLivePreviewURL' | 'url'>\n\nexport const LivePreviewProvider: React.FC<LivePreviewProviderProps> = ({\n breakpoints: incomingBreakpoints,\n children,\n isLivePreviewEnabled,\n isLivePreviewing: incomingIsLivePreviewing,\n isPreviewEnabled,\n previewURL: previewURLFromProps,\n typeofLivePreviewURL,\n url: urlFromProps,\n}) => {\n const [isLivePreviewing, _setIsLivePreviewing] =\n useState<LivePreviewContextType['isLivePreviewing']>(incomingIsLivePreviewing)\n\n const [shouldRenderIframe, setShouldRenderIframe] =\n useState<LivePreviewContextType['shouldRenderIframe']>(isLivePreviewing)\n\n /**\n * Rendering the iframe is a one-way event, e.g. defer load and never unmount.\n * This way, subsequent toggles will appear to load instantly.\n */\n const setIsLivePreviewing = useCallback<LivePreviewContextType['setIsLivePreviewing']>(\n (livePreviewing) => {\n if (livePreviewing) {\n setShouldRenderIframe(true)\n }\n\n _setIsLivePreviewing(livePreviewing)\n },\n [],\n )\n\n const breakpoints: LivePreviewConfig['breakpoints'] = useMemo(\n () => [\n ...(incomingBreakpoints || []),\n {\n name: 'responsive',\n height: '100%',\n label: 'Responsive',\n width: '100%',\n },\n ],\n [incomingBreakpoints],\n )\n\n const [url, setURL] = useState<string>('')\n const [previewURL, setPreviewURL] = useState<string>(previewURLFromProps)\n\n const { isPopupOpen, openPopupWindow, popupRef } = usePopupWindow({\n eventType: 'payload-live-preview',\n url,\n })\n\n const [appIsReady, setAppIsReady] = useState(false)\n // Tracks when any preview (iframe or popup) signals it's ready\n // Used to trigger an initial sync to newly opened previews\n const [lastReadyAt, setLastReadyAt] = useState<number>(0)\n\n const { collectionSlug, globalSlug } = useDocumentInfo()\n\n const isFirstRender = useRef(true)\n\n const { setPreference } = usePreferences()\n\n const iframeRef = React.useRef<HTMLIFrameElement>(null)\n\n const [isExpanded, setIsExpanded] = useState(false)\n\n const [loadedURL, setLoadedURL] = useState<string>()\n\n const [zoom, setZoom] = useState(1)\n\n const [position, setPosition] = useState({ x: 0, y: 0 })\n\n const [size, setSize] = React.useReducer(sizeReducer, { height: 0, width: 0 })\n\n const [measuredDeviceSize, setMeasuredDeviceSize] = useState({\n height: 0,\n width: 0,\n })\n\n const [breakpoint, setBreakpoint] =\n React.useState<LivePreviewConfig['breakpoints'][0]['name']>('responsive')\n\n /**\n * A \"middleware\" callback fn that does some additional work before `setURL`.\n * This is what we provide through context, bc it:\n * - ensures the URL is absolute\n * - resets `appIsReady` to `false` while the new URL is loading\n */\n const setLivePreviewURL = useCallback<LivePreviewContextType['setURL']>(\n (_incomingURL) => {\n let incomingURL: LivePreviewURLType\n\n if (typeof _incomingURL === 'string') {\n incomingURL = formatAbsoluteURL(_incomingURL)\n }\n\n if (!incomingURL) {\n setIsLivePreviewing(false)\n }\n\n if (incomingURL !== url) {\n setAppIsReady(false)\n setURL(incomingURL)\n }\n },\n [setIsLivePreviewing, url],\n )\n\n /**\n * `url` needs to be relative to the window, which cannot be done on initial render.\n */\n useEffect(() => {\n if (typeof urlFromProps === 'string') {\n setURL(formatAbsoluteURL(urlFromProps))\n }\n }, [urlFromProps])\n\n // The toolbar needs to freely drag and drop around the page\n const handleDragEnd = (ev) => {\n // only update position if the toolbar is completely within the preview area\n // otherwise reset it back to the previous position\n // TODO: reset to the nearest edge of the preview area\n if (ev.over && ev.over.id === 'live-preview-area') {\n const newPos = {\n x: position.x + ev.delta.x,\n y: position.y + ev.delta.y,\n }\n\n setPosition(newPos)\n } else {\n // reset\n }\n }\n\n const setWidth = useCallback(\n (width) => {\n setSize({ type: 'width', value: width })\n },\n [setSize],\n )\n\n const setHeight = useCallback(\n (height) => {\n setSize({ type: 'height', value: height })\n },\n [setSize],\n )\n\n // explicitly set new width and height when as new breakpoints are selected\n // exclude `custom` breakpoint as it is handled by the `setWidth` and `setHeight` directly\n useEffect(() => {\n const foundBreakpoint = breakpoints?.find((bp) => bp.name === breakpoint)\n\n if (\n foundBreakpoint &&\n breakpoint !== 'responsive' &&\n breakpoint !== 'custom' &&\n typeof foundBreakpoint?.width === 'number' &&\n typeof foundBreakpoint?.height === 'number'\n ) {\n setSize({\n type: 'reset',\n value: {\n height: foundBreakpoint.height,\n width: foundBreakpoint.width,\n },\n })\n }\n }, [breakpoint, breakpoints])\n\n /**\n * Receive the `ready` message from the popup window\n * This indicates that the app is ready to receive `window.postMessage` events\n * This is also the only cross-origin way of detecting when a popup window has loaded\n * Unlike iframe elements which have an `onLoad` handler, there is no way to access `window.open` on popups\n */\n useEffect(() => {\n const handleMessage = (event: MessageEvent) => {\n if (\n url?.startsWith(event.origin) &&\n event.data &&\n typeof event.data === 'object' &&\n event.data.type === 'payload-live-preview'\n ) {\n if (event.data.ready) {\n setAppIsReady(true)\n setLastReadyAt(Date.now())\n }\n }\n }\n\n window.addEventListener('message', handleMessage)\n\n return () => {\n window.removeEventListener('message', handleMessage)\n }\n }, [url])\n\n useEffect(() => {\n if (isFirstRender.current) {\n isFirstRender.current = false\n return\n }\n\n void setPreference<CollectionPreferences>(\n collectionSlug ? `collection-${collectionSlug}` : `global-${globalSlug}`,\n {\n editViewType: isLivePreviewing ? 'live-preview' : 'default',\n },\n true,\n )\n }, [isLivePreviewing, setPreference, collectionSlug, globalSlug])\n\n const dndContextID = useId()\n\n return (\n <LivePreviewContext\n value={{\n appIsReady,\n breakpoint,\n breakpoints,\n iframeRef,\n isExpanded,\n isLivePreviewEnabled,\n isLivePreviewing,\n isPopupOpen,\n isPreviewEnabled,\n lastReadyAt,\n loadedURL,\n measuredDeviceSize,\n openPopupWindow,\n popupRef,\n previewURL,\n setBreakpoint,\n setHeight,\n setIsExpanded,\n setIsLivePreviewing,\n setLoadedURL,\n setMeasuredDeviceSize,\n setPreviewURL,\n setSize,\n setToolbarPosition: setPosition,\n setURL: setLivePreviewURL,\n setWidth,\n setZoom,\n shouldRenderIframe,\n size,\n toolbarPosition: position,\n typeofLivePreviewURL,\n url,\n zoom,\n }}\n >\n <DndContext\n collisionDetection={customCollisionDetection}\n // Provide stable ID to fix hydration issues: https://github.com/clauderic/dnd-kit/issues/926\n id={dndContextID}\n onDragEnd={handleDragEnd}\n >\n {children}\n </DndContext>\n </LivePreviewContext>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SAASA,UAAU,QAAQ;AAC3B,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,KAAK,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAIhF,SAASC,cAAc,QAAQ;AAC/B,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,wBAAwB,QAAQ;AACzC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,WAAW,QAAQ;AAsB5B,OAAO,MAAMC,mBAAA,GAA0DA,CAAC;EACtEC,WAAA,EAAaC,mBAAm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BAAA;MACAiC,IAAA;MACAuC,eAAA,EAAiB3C,QAAA;MACjBjC,oBAAA;MACAC,GAAA;MACA8B;IACF;cAEA,aAAA2C,IAAA,CAACnG,UAAA;MACCsG,kBAAA,EAAoB1F,wBAAA;MACpB;MACA+D,EAAA,EAAIuB,YAAA;MACJK,SAAA,EAAW/B,aAAA;gBAEVtD;;;AAIT","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["DndContext","React","useCallback","useEffect","useId","useMemo","useRef","useState","usePopupWindow","useDocumentInfo","usePreferences","formatAbsoluteURL","isHttpURL","customCollisionDetection","LivePreviewContext","sizeReducer","LivePreviewProvider","breakpoints","incomingBreakpoints","children","isLivePreviewEnabled","isLivePreviewing","incomingIsLivePreviewing","isPreviewEnabled","previewURL","previewURLFromProps","typeofLivePreviewURL","url","urlFromProps","_setIsLivePreviewing","shouldRenderIframe","setShouldRenderIframe","setIsLivePreviewing","livePreviewing","name","height","label","width","setURL","_setPreviewURL","setPreviewURL","incomingURL","undefined","isPopupOpen","openPopupWindow","popupRef","eventType","appIsReady","setAppIsReady","lastReadyAt","setLastReadyAt","collectionSlug","globalSlug","isFirstRender","setPreference","iframeRef","isExpanded","setIsExpanded","loadedURL","setLoadedURL","zoom","setZoom","position","setPosition","x","y","size","setSize","useReducer","measuredDeviceSize","setMeasuredDeviceSize","breakpoint","setBreakpoint","setLivePreviewURL","_incomingURL","handleDragEnd","ev","over","id","newPos","delta","setWidth","type","value","setHeight","foundBreakpoint","find","bp","handleMessage","event","startsWith","origin","data","ready","Date","now","window","addEventListener","removeEventListener","current","editViewType","dndContextID","_jsx","setToolbarPosition","toolbarPosition","collisionDetection","onDragEnd"],"sources":["../../../src/providers/LivePreview/index.tsx"],"sourcesContent":["'use client'\nimport type { CollectionPreferences, LivePreviewConfig, LivePreviewURLType } from 'payload'\n\nimport { DndContext } from '@dnd-kit/core'\nimport React, { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'\n\nimport type { LivePreviewContextType } from './context.js'\n\nimport { usePopupWindow } from '../../hooks/usePopupWindow.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { usePreferences } from '../../providers/Preferences/index.js'\nimport { formatAbsoluteURL } from '../../utilities/formatAbsoluteURL.js'\nimport { isHttpURL } from '../../utilities/isHttpURL.js'\nimport { customCollisionDetection } from './collisionDetection.js'\nimport { LivePreviewContext } from './context.js'\nimport { sizeReducer } from './sizeReducer.js'\n\nexport type LivePreviewProviderProps = {\n appIsReady?: boolean\n breakpoints?: LivePreviewConfig['breakpoints']\n children: React.ReactNode\n deviceSize?: {\n height: number\n width: number\n }\n isLivePreviewEnabled?: boolean\n isLivePreviewing: boolean\n /**\n * This specifically relates to `admin.preview` function in the config instead of live preview.\n */\n isPreviewEnabled?: boolean\n /**\n * This specifically relates to `admin.preview` function in the config instead of live preview.\n */\n previewURL?: string\n} & Pick<LivePreviewContextType, 'typeofLivePreviewURL' | 'url'>\n\nexport const LivePreviewProvider: React.FC<LivePreviewProviderProps> = ({\n breakpoints: incomingBreakpoints,\n children,\n isLivePreviewEnabled,\n isLivePreviewing: incomingIsLivePreviewing,\n isPreviewEnabled,\n previewURL: previewURLFromProps,\n typeofLivePreviewURL,\n url: urlFromProps,\n}) => {\n const [isLivePreviewing, _setIsLivePreviewing] =\n useState<LivePreviewContextType['isLivePreviewing']>(incomingIsLivePreviewing)\n\n const [shouldRenderIframe, setShouldRenderIframe] =\n useState<LivePreviewContextType['shouldRenderIframe']>(isLivePreviewing)\n\n /**\n * Rendering the iframe is a one-way event, e.g. defer load and never unmount.\n * This way, subsequent toggles will appear to load instantly.\n */\n const setIsLivePreviewing = useCallback<LivePreviewContextType['setIsLivePreviewing']>(\n (livePreviewing) => {\n if (livePreviewing) {\n setShouldRenderIframe(true)\n }\n\n _setIsLivePreviewing(livePreviewing)\n },\n [],\n )\n\n const breakpoints: LivePreviewConfig['breakpoints'] = useMemo(\n () => [\n ...(incomingBreakpoints || []),\n {\n name: 'responsive',\n height: '100%',\n label: 'Responsive',\n width: '100%',\n },\n ],\n [incomingBreakpoints],\n )\n\n const [url, setURL] = useState<string>('')\n const [previewURL, _setPreviewURL] = useState<string>()\n\n const setPreviewURL = useCallback<LivePreviewContextType['setPreviewURL']>((incomingURL) => {\n _setPreviewURL(isHttpURL(incomingURL) ? incomingURL : undefined)\n }, [])\n\n useEffect(() => {\n setPreviewURL(previewURLFromProps)\n }, [previewURLFromProps, setPreviewURL])\n\n const { isPopupOpen, openPopupWindow, popupRef } = usePopupWindow({\n eventType: 'payload-live-preview',\n url,\n })\n\n const [appIsReady, setAppIsReady] = useState(false)\n // Tracks when any preview (iframe or popup) signals it's ready\n // Used to trigger an initial sync to newly opened previews\n const [lastReadyAt, setLastReadyAt] = useState<number>(0)\n\n const { collectionSlug, globalSlug } = useDocumentInfo()\n\n const isFirstRender = useRef(true)\n\n const { setPreference } = usePreferences()\n\n const iframeRef = React.useRef<HTMLIFrameElement>(null)\n\n const [isExpanded, setIsExpanded] = useState(false)\n\n const [loadedURL, setLoadedURL] = useState<string>()\n\n const [zoom, setZoom] = useState(1)\n\n const [position, setPosition] = useState({ x: 0, y: 0 })\n\n const [size, setSize] = React.useReducer(sizeReducer, { height: 0, width: 0 })\n\n const [measuredDeviceSize, setMeasuredDeviceSize] = useState({\n height: 0,\n width: 0,\n })\n\n const [breakpoint, setBreakpoint] =\n React.useState<LivePreviewConfig['breakpoints'][0]['name']>('responsive')\n\n /**\n * A \"middleware\" callback fn that does some additional work before `setURL`.\n * This is what we provide through context, bc it:\n * - ensures the URL is absolute\n * - resets `appIsReady` to `false` while the new URL is loading\n */\n const setLivePreviewURL = useCallback<LivePreviewContextType['setURL']>(\n (_incomingURL) => {\n let incomingURL: LivePreviewURLType\n\n if (typeof _incomingURL === 'string') {\n incomingURL = formatAbsoluteURL(_incomingURL)\n }\n\n if (!incomingURL) {\n setIsLivePreviewing(false)\n }\n\n if (incomingURL !== url) {\n setAppIsReady(false)\n setURL(incomingURL)\n }\n },\n [setIsLivePreviewing, url],\n )\n\n /**\n * `url` needs to be relative to the window, which cannot be done on initial render.\n */\n useEffect(() => {\n if (typeof urlFromProps === 'string') {\n setURL(formatAbsoluteURL(urlFromProps))\n }\n }, [urlFromProps])\n\n // The toolbar needs to freely drag and drop around the page\n const handleDragEnd = (ev) => {\n // only update position if the toolbar is completely within the preview area\n // otherwise reset it back to the previous position\n // TODO: reset to the nearest edge of the preview area\n if (ev.over && ev.over.id === 'live-preview-area') {\n const newPos = {\n x: position.x + ev.delta.x,\n y: position.y + ev.delta.y,\n }\n\n setPosition(newPos)\n } else {\n // reset\n }\n }\n\n const setWidth = useCallback(\n (width) => {\n setSize({ type: 'width', value: width })\n },\n [setSize],\n )\n\n const setHeight = useCallback(\n (height) => {\n setSize({ type: 'height', value: height })\n },\n [setSize],\n )\n\n // explicitly set new width and height when as new breakpoints are selected\n // exclude `custom` breakpoint as it is handled by the `setWidth` and `setHeight` directly\n useEffect(() => {\n const foundBreakpoint = breakpoints?.find((bp) => bp.name === breakpoint)\n\n if (\n foundBreakpoint &&\n breakpoint !== 'responsive' &&\n breakpoint !== 'custom' &&\n typeof foundBreakpoint?.width === 'number' &&\n typeof foundBreakpoint?.height === 'number'\n ) {\n setSize({\n type: 'reset',\n value: {\n height: foundBreakpoint.height,\n width: foundBreakpoint.width,\n },\n })\n }\n }, [breakpoint, breakpoints])\n\n /**\n * Receive the `ready` message from the popup window\n * This indicates that the app is ready to receive `window.postMessage` events\n * This is also the only cross-origin way of detecting when a popup window has loaded\n * Unlike iframe elements which have an `onLoad` handler, there is no way to access `window.open` on popups\n */\n useEffect(() => {\n const handleMessage = (event: MessageEvent) => {\n if (\n url?.startsWith(event.origin) &&\n event.data &&\n typeof event.data === 'object' &&\n event.data.type === 'payload-live-preview'\n ) {\n if (event.data.ready) {\n setAppIsReady(true)\n setLastReadyAt(Date.now())\n }\n }\n }\n\n window.addEventListener('message', handleMessage)\n\n return () => {\n window.removeEventListener('message', handleMessage)\n }\n }, [url])\n\n useEffect(() => {\n if (isFirstRender.current) {\n isFirstRender.current = false\n return\n }\n\n void setPreference<CollectionPreferences>(\n collectionSlug ? `collection-${collectionSlug}` : `global-${globalSlug}`,\n {\n editViewType: isLivePreviewing ? 'live-preview' : 'default',\n },\n true,\n )\n }, [isLivePreviewing, setPreference, collectionSlug, globalSlug])\n\n const dndContextID = useId()\n\n return (\n <LivePreviewContext\n value={{\n appIsReady,\n breakpoint,\n breakpoints,\n iframeRef,\n isExpanded,\n isLivePreviewEnabled,\n isLivePreviewing,\n isPopupOpen,\n isPreviewEnabled,\n lastReadyAt,\n loadedURL,\n measuredDeviceSize,\n openPopupWindow,\n popupRef,\n previewURL,\n setBreakpoint,\n setHeight,\n setIsExpanded,\n setIsLivePreviewing,\n setLoadedURL,\n setMeasuredDeviceSize,\n setPreviewURL,\n setSize,\n setToolbarPosition: setPosition,\n setURL: setLivePreviewURL,\n setWidth,\n setZoom,\n shouldRenderIframe,\n size,\n toolbarPosition: position,\n typeofLivePreviewURL,\n url,\n zoom,\n }}\n >\n <DndContext\n collisionDetection={customCollisionDetection}\n // Provide stable ID to fix hydration issues: https://github.com/clauderic/dnd-kit/issues/926\n id={dndContextID}\n onDragEnd={handleDragEnd}\n >\n {children}\n </DndContext>\n </LivePreviewContext>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SAASA,UAAU,QAAQ;AAC3B,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,KAAK,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAIhF,SAASC,cAAc,QAAQ;AAC/B,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,SAAS,QAAQ;AAC1B,SAASC,wBAAwB,QAAQ;AACzC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,WAAW,QAAQ;AAsB5B,OAAO,MAAMC,mBAAA,GAA0DA,CAAC;EACtEC,WAAA,EAAaC,mBAAmB;E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ACAgD,aAAA;MACAY,SAAA;MACA3B,aAAA;MACAzB,mBAAA;MACA2B,YAAA;MACAW,qBAAA;MACA9B,aAAA;MACA2B,OAAA;MACAoC,kBAAA,EAAoBxC,WAAA;MACpBzB,MAAA,EAAQmC,iBAAA;MACRQ,QAAA;MACApB,OAAA;MACA/B,kBAAA;MACAoC,IAAA;MACAsC,eAAA,EAAiB1C,QAAA;MACjBpC,oBAAA;MACAC,GAAA;MACAiC;IACF;cAEA,aAAA0C,IAAA,CAACtG,UAAA;MACCyG,kBAAA,EAAoB5F,wBAAA;MACpB;MACAiE,EAAA,EAAIuB,YAAA;MACJK,SAAA,EAAW/B,aAAA;gBAEVxD;;;AAIT","ignoreList":[]}
@@ -12,9 +12,5 @@ export declare const useLocaleLoading: () => {
12
12
  localeIsLoading: boolean;
13
13
  setLocaleIsLoading: (_: boolean) => any;
14
14
  };
15
- /**
16
- * TODO: V4
17
- * The return type of the `useLocale` hook will change in v4. It will return `null | Locale` instead of `false | {} | Locale`.
18
- */
19
- export declare const useLocale: () => Locale;
15
+ export declare const useLocale: () => Locale | null;
20
16
  //# sourceMappingURL=index.d.ts.map