@payloadcms/next 3.0.0-beta.90 → 3.0.0-beta.91

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 (461) hide show
  1. package/dist/cjs/withPayload.js +111 -0
  2. package/dist/cjs/withPayload.js.map +1 -0
  3. package/dist/config.js +0 -1
  4. package/dist/config.js.map +1 -1
  5. package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js +15 -9
  6. package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js.map +1 -1
  7. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js +100 -35
  8. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
  9. package/dist/elements/DocumentHeader/Tabs/Tab/index.js +74 -63
  10. package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
  11. package/dist/elements/DocumentHeader/Tabs/getCustomViews.js +31 -35
  12. package/dist/elements/DocumentHeader/Tabs/getCustomViews.js.map +1 -1
  13. package/dist/elements/DocumentHeader/Tabs/getViewConfig.js +15 -12
  14. package/dist/elements/DocumentHeader/Tabs/getViewConfig.js.map +1 -1
  15. package/dist/elements/DocumentHeader/Tabs/index.js +86 -79
  16. package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
  17. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js +32 -13
  18. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js.map +1 -1
  19. package/dist/elements/DocumentHeader/Tabs/tabs/index.js +60 -52
  20. package/dist/elements/DocumentHeader/Tabs/tabs/index.js.map +1 -1
  21. package/dist/elements/DocumentHeader/index.js +24 -23
  22. package/dist/elements/DocumentHeader/index.js.map +1 -1
  23. package/dist/elements/EmailAndUsername/index.js +107 -75
  24. package/dist/elements/EmailAndUsername/index.js.map +1 -1
  25. package/dist/elements/LeaveWithoutSaving/index.js +150 -83
  26. package/dist/elements/LeaveWithoutSaving/index.js.map +1 -1
  27. package/dist/elements/LeaveWithoutSaving/usePreventLeave.d.ts.map +1 -1
  28. package/dist/elements/LeaveWithoutSaving/usePreventLeave.js +119 -101
  29. package/dist/elements/LeaveWithoutSaving/usePreventLeave.js.map +1 -1
  30. package/dist/elements/Logo/index.js +36 -21
  31. package/dist/elements/Logo/index.js.map +1 -1
  32. package/dist/elements/Nav/NavHamburger/index.js +41 -13
  33. package/dist/elements/Nav/NavHamburger/index.js.map +1 -1
  34. package/dist/elements/Nav/NavWrapper/index.js +48 -16
  35. package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
  36. package/dist/elements/Nav/index.client.js +149 -76
  37. package/dist/elements/Nav/index.client.js.map +1 -1
  38. package/dist/elements/Nav/index.js +56 -50
  39. package/dist/elements/Nav/index.js.map +1 -1
  40. package/dist/exports/layouts.js +0 -1
  41. package/dist/exports/layouts.js.map +1 -1
  42. package/dist/exports/routes.js +0 -1
  43. package/dist/exports/routes.js.map +1 -1
  44. package/dist/exports/templates.js +0 -1
  45. package/dist/exports/templates.js.map +1 -1
  46. package/dist/exports/utilities.js +0 -1
  47. package/dist/exports/utilities.js.map +1 -1
  48. package/dist/exports/views.js +0 -1
  49. package/dist/exports/views.js.map +1 -1
  50. package/dist/fetchAPI-multipart/fileFactory.js +35 -34
  51. package/dist/fetchAPI-multipart/fileFactory.js.map +1 -1
  52. package/dist/fetchAPI-multipart/handlers.js +77 -78
  53. package/dist/fetchAPI-multipart/handlers.js.map +1 -1
  54. package/dist/fetchAPI-multipart/index.js +33 -31
  55. package/dist/fetchAPI-multipart/index.js.map +1 -1
  56. package/dist/fetchAPI-multipart/isEligibleRequest.js +13 -21
  57. package/dist/fetchAPI-multipart/isEligibleRequest.js.map +1 -1
  58. package/dist/fetchAPI-multipart/processMultipart.js +158 -141
  59. package/dist/fetchAPI-multipart/processMultipart.js.map +1 -1
  60. package/dist/fetchAPI-multipart/processNested.js +23 -21
  61. package/dist/fetchAPI-multipart/processNested.js.map +1 -1
  62. package/dist/fetchAPI-multipart/uploadTimer.js +16 -17
  63. package/dist/fetchAPI-multipart/uploadTimer.js.map +1 -1
  64. package/dist/fetchAPI-multipart/utilities.js +166 -166
  65. package/dist/fetchAPI-multipart/utilities.js.map +1 -1
  66. package/dist/fetchAPI-stream-file/index.js +19 -17
  67. package/dist/fetchAPI-stream-file/index.js.map +1 -1
  68. package/dist/index.js +0 -1
  69. package/dist/index.js.map +1 -1
  70. package/dist/layouts/Root/index.js +118 -115
  71. package/dist/layouts/Root/index.js.map +1 -1
  72. package/dist/prod/styles.css +1 -1
  73. package/dist/routes/graphql/handler.js +109 -103
  74. package/dist/routes/graphql/handler.js.map +1 -1
  75. package/dist/routes/graphql/index.js +0 -1
  76. package/dist/routes/graphql/index.js.map +1 -1
  77. package/dist/routes/graphql/playground.js +23 -24
  78. package/dist/routes/graphql/playground.js.map +1 -1
  79. package/dist/routes/index.js +0 -1
  80. package/dist/routes/index.js.map +1 -1
  81. package/dist/routes/rest/auth/access.js +22 -21
  82. package/dist/routes/rest/auth/access.js.map +1 -1
  83. package/dist/routes/rest/auth/forgotPassword.js +29 -25
  84. package/dist/routes/rest/auth/forgotPassword.js.map +1 -1
  85. package/dist/routes/rest/auth/init.js +16 -14
  86. package/dist/routes/rest/auth/init.js.map +1 -1
  87. package/dist/routes/rest/auth/login.js +43 -38
  88. package/dist/routes/rest/auth/login.js.map +1 -1
  89. package/dist/routes/rest/auth/logout.js +31 -27
  90. package/dist/routes/rest/auth/logout.js.map +1 -1
  91. package/dist/routes/rest/auth/me.js +23 -21
  92. package/dist/routes/rest/auth/me.js.map +1 -1
  93. package/dist/routes/rest/auth/refresh.js +31 -27
  94. package/dist/routes/rest/auth/refresh.js.map +1 -1
  95. package/dist/routes/rest/auth/registerFirstUser.js +43 -38
  96. package/dist/routes/rest/auth/registerFirstUser.js.map +1 -1
  97. package/dist/routes/rest/auth/resetPassword.js +38 -33
  98. package/dist/routes/rest/auth/resetPassword.js.map +1 -1
  99. package/dist/routes/rest/auth/unlock.js +27 -23
  100. package/dist/routes/rest/auth/unlock.js.map +1 -1
  101. package/dist/routes/rest/auth/verifyEmail.js +22 -17
  102. package/dist/routes/rest/auth/verifyEmail.js.map +1 -1
  103. package/dist/routes/rest/buildFormState.js +38 -37
  104. package/dist/routes/rest/buildFormState.js.map +1 -1
  105. package/dist/routes/rest/checkEndpoints.js +11 -9
  106. package/dist/routes/rest/checkEndpoints.js.map +1 -1
  107. package/dist/routes/rest/collections/count.js +15 -11
  108. package/dist/routes/rest/collections/count.js.map +1 -1
  109. package/dist/routes/rest/collections/create.js +30 -26
  110. package/dist/routes/rest/collections/create.js.map +1 -1
  111. package/dist/routes/rest/collections/delete.js +40 -35
  112. package/dist/routes/rest/collections/delete.js.map +1 -1
  113. package/dist/routes/rest/collections/deleteByID.js +36 -31
  114. package/dist/routes/rest/collections/deleteByID.js.map +1 -1
  115. package/dist/routes/rest/collections/docAccess.js +17 -14
  116. package/dist/routes/rest/collections/docAccess.js.map +1 -1
  117. package/dist/routes/rest/collections/duplicate.js +36 -31
  118. package/dist/routes/rest/collections/duplicate.js.map +1 -1
  119. package/dist/routes/rest/collections/find.js +29 -20
  120. package/dist/routes/rest/collections/find.js.map +1 -1
  121. package/dist/routes/rest/collections/findByID.js +28 -23
  122. package/dist/routes/rest/collections/findByID.js.map +1 -1
  123. package/dist/routes/rest/collections/findVersionByID.js +27 -22
  124. package/dist/routes/rest/collections/findVersionByID.js.map +1 -1
  125. package/dist/routes/rest/collections/findVersions.js +27 -19
  126. package/dist/routes/rest/collections/findVersions.js.map +1 -1
  127. package/dist/routes/rest/collections/preview.js +39 -34
  128. package/dist/routes/rest/collections/preview.js.map +1 -1
  129. package/dist/routes/rest/collections/restoreVersion.js +32 -27
  130. package/dist/routes/rest/collections/restoreVersion.js.map +1 -1
  131. package/dist/routes/rest/collections/update.js +43 -37
  132. package/dist/routes/rest/collections/update.js.map +1 -1
  133. package/dist/routes/rest/collections/updateByID.js +38 -33
  134. package/dist/routes/rest/collections/updateByID.js.map +1 -1
  135. package/dist/routes/rest/files/checkFileAccess.js +46 -44
  136. package/dist/routes/rest/files/checkFileAccess.js.map +1 -1
  137. package/dist/routes/rest/files/getFile.js +52 -49
  138. package/dist/routes/rest/files/getFile.js.map +1 -1
  139. package/dist/routes/rest/files/getFileTypeFallback.js +16 -17
  140. package/dist/routes/rest/files/getFileTypeFallback.js.map +1 -1
  141. package/dist/routes/rest/globals/docAccess.js +15 -13
  142. package/dist/routes/rest/globals/docAccess.js.map +1 -1
  143. package/dist/routes/rest/globals/findOne.js +22 -18
  144. package/dist/routes/rest/globals/findOne.js.map +1 -1
  145. package/dist/routes/rest/globals/findVersionByID.js +22 -17
  146. package/dist/routes/rest/globals/findVersionByID.js.map +1 -1
  147. package/dist/routes/rest/globals/findVersions.js +27 -19
  148. package/dist/routes/rest/globals/findVersions.js.map +1 -1
  149. package/dist/routes/rest/globals/preview.js +38 -34
  150. package/dist/routes/rest/globals/preview.js.map +1 -1
  151. package/dist/routes/rest/globals/restoreVersion.js +27 -22
  152. package/dist/routes/rest/globals/restoreVersion.js.map +1 -1
  153. package/dist/routes/rest/globals/update.js +32 -28
  154. package/dist/routes/rest/globals/update.js.map +1 -1
  155. package/dist/routes/rest/index.js +651 -626
  156. package/dist/routes/rest/index.js.map +1 -1
  157. package/dist/routes/rest/og/image.js +74 -76
  158. package/dist/routes/rest/og/image.js.map +1 -1
  159. package/dist/routes/rest/og/index.js +60 -59
  160. package/dist/routes/rest/og/index.js.map +1 -1
  161. package/dist/routes/rest/routeError.js +102 -95
  162. package/dist/routes/rest/routeError.js.map +1 -1
  163. package/dist/routes/rest/types.js +1 -2
  164. package/dist/routes/rest/types.js.map +1 -1
  165. package/dist/routes/rest/utilities/sanitizeCollectionID.js +14 -11
  166. package/dist/routes/rest/utilities/sanitizeCollectionID.js.map +1 -1
  167. package/dist/scss/app.scss +4 -4
  168. package/dist/scss/type.scss +4 -4
  169. package/dist/templates/Default/NavHamburger/index.js +18 -6
  170. package/dist/templates/Default/NavHamburger/index.js.map +1 -1
  171. package/dist/templates/Default/Wrapper/index.js +42 -13
  172. package/dist/templates/Default/Wrapper/index.js.map +1 -1
  173. package/dist/templates/Default/index.js +54 -47
  174. package/dist/templates/Default/index.js.map +1 -1
  175. package/dist/templates/Minimal/index.js +16 -16
  176. package/dist/templates/Minimal/index.js.map +1 -1
  177. package/dist/utilities/addDataAndFileToRequest.js +40 -35
  178. package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
  179. package/dist/utilities/addLocalesToRequest.js +44 -36
  180. package/dist/utilities/addLocalesToRequest.js.map +1 -1
  181. package/dist/utilities/createPayloadRequest.js +85 -74
  182. package/dist/utilities/createPayloadRequest.js.map +1 -1
  183. package/dist/utilities/getNextRequestI18n.js +13 -11
  184. package/dist/utilities/getNextRequestI18n.js.map +1 -1
  185. package/dist/utilities/getPayloadHMR.d.ts +1 -1
  186. package/dist/utilities/getPayloadHMR.d.ts.map +1 -1
  187. package/dist/utilities/getPayloadHMR.js +91 -94
  188. package/dist/utilities/getPayloadHMR.js.map +1 -1
  189. package/dist/utilities/getRequestLanguage.js +16 -13
  190. package/dist/utilities/getRequestLanguage.js.map +1 -1
  191. package/dist/utilities/getRequestLocales.js +27 -24
  192. package/dist/utilities/getRequestLocales.js.map +1 -1
  193. package/dist/utilities/getRequestTheme.js +16 -16
  194. package/dist/utilities/getRequestTheme.js.map +1 -1
  195. package/dist/utilities/headersWithCors.js +21 -30
  196. package/dist/utilities/headersWithCors.js.map +1 -1
  197. package/dist/utilities/initPage/handleAdminPage.js +46 -42
  198. package/dist/utilities/initPage/handleAdminPage.js.map +1 -1
  199. package/dist/utilities/initPage/handleAuthRedirect.js +45 -32
  200. package/dist/utilities/initPage/handleAuthRedirect.js.map +1 -1
  201. package/dist/utilities/initPage/index.js +146 -120
  202. package/dist/utilities/initPage/index.js.map +1 -1
  203. package/dist/utilities/initPage/shared.js +26 -25
  204. package/dist/utilities/initPage/shared.js.map +1 -1
  205. package/dist/utilities/initPage/types.js +1 -2
  206. package/dist/utilities/initPage/types.js.map +1 -1
  207. package/dist/utilities/mergeHeaders.js +8 -9
  208. package/dist/utilities/mergeHeaders.js.map +1 -1
  209. package/dist/utilities/meta.js +66 -68
  210. package/dist/utilities/meta.js.map +1 -1
  211. package/dist/utilities/timestamp.js +4 -5
  212. package/dist/utilities/timestamp.js.map +1 -1
  213. package/dist/views/API/LocaleSelector/index.d.ts.map +1 -1
  214. package/dist/views/API/LocaleSelector/index.js +38 -11
  215. package/dist/views/API/LocaleSelector/index.js.map +1 -1
  216. package/dist/views/API/RenderJSON/index.js +124 -112
  217. package/dist/views/API/RenderJSON/index.js.map +1 -1
  218. package/dist/views/API/index.client.js +190 -202
  219. package/dist/views/API/index.client.js.map +1 -1
  220. package/dist/views/API/index.js +2 -3
  221. package/dist/views/API/index.js.map +1 -1
  222. package/dist/views/API/meta.js +22 -18
  223. package/dist/views/API/meta.js.map +1 -1
  224. package/dist/views/Account/Settings/LanguageSelector.js +45 -12
  225. package/dist/views/Account/Settings/LanguageSelector.js.map +1 -1
  226. package/dist/views/Account/Settings/index.js +21 -28
  227. package/dist/views/Account/Settings/index.js.map +1 -1
  228. package/dist/views/Account/ToggleTheme/index.js +51 -30
  229. package/dist/views/Account/ToggleTheme/index.js.map +1 -1
  230. package/dist/views/Account/index.client.js +32 -16
  231. package/dist/views/Account/index.client.js.map +1 -1
  232. package/dist/views/Account/index.js +99 -68
  233. package/dist/views/Account/index.js.map +1 -1
  234. package/dist/views/Account/meta.js +12 -8
  235. package/dist/views/Account/meta.js.map +1 -1
  236. package/dist/views/CreateFirstUser/index.client.js +95 -57
  237. package/dist/views/CreateFirstUser/index.client.js.map +1 -1
  238. package/dist/views/CreateFirstUser/index.js +42 -28
  239. package/dist/views/CreateFirstUser/index.js.map +1 -1
  240. package/dist/views/CreateFirstUser/meta.js +12 -8
  241. package/dist/views/CreateFirstUser/meta.js.map +1 -1
  242. package/dist/views/Dashboard/Default/index.js +132 -115
  243. package/dist/views/Dashboard/Default/index.js.map +1 -1
  244. package/dist/views/Dashboard/index.js +61 -52
  245. package/dist/views/Dashboard/index.js.map +1 -1
  246. package/dist/views/Dashboard/meta.js +16 -12
  247. package/dist/views/Dashboard/meta.js.map +1 -1
  248. package/dist/views/Document/getCustomViewByKey.js +2 -3
  249. package/dist/views/Document/getCustomViewByKey.js.map +1 -1
  250. package/dist/views/Document/getCustomViewByRoute.js +30 -27
  251. package/dist/views/Document/getCustomViewByRoute.js.map +1 -1
  252. package/dist/views/Document/getDocumentData.js +34 -28
  253. package/dist/views/Document/getDocumentData.js.map +1 -1
  254. package/dist/views/Document/getDocumentPermissions.js +83 -74
  255. package/dist/views/Document/getDocumentPermissions.js.map +1 -1
  256. package/dist/views/Document/getMetaBySegment.js +113 -107
  257. package/dist/views/Document/getMetaBySegment.js.map +1 -1
  258. package/dist/views/Document/getViewsFromConfig.js +309 -331
  259. package/dist/views/Document/getViewsFromConfig.js.map +1 -1
  260. package/dist/views/Document/index.d.ts.map +1 -1
  261. package/dist/views/Document/index.js +193 -159
  262. package/dist/views/Document/index.js.map +1 -1
  263. package/dist/views/Document/meta.js +1 -2
  264. package/dist/views/Document/meta.js.map +1 -1
  265. package/dist/views/Edit/Default/Auth/APIKey.js +118 -132
  266. package/dist/views/Edit/Default/Auth/APIKey.js.map +1 -1
  267. package/dist/views/Edit/Default/Auth/index.js +293 -196
  268. package/dist/views/Edit/Default/Auth/index.js.map +1 -1
  269. package/dist/views/Edit/Default/Auth/types.js +1 -2
  270. package/dist/views/Edit/Default/Auth/types.js.map +1 -1
  271. package/dist/views/Edit/Default/SetDocumentStepNav/index.js +121 -70
  272. package/dist/views/Edit/Default/SetDocumentStepNav/index.js.map +1 -1
  273. package/dist/views/Edit/Default/SetDocumentTitle/index.js +74 -29
  274. package/dist/views/Edit/Default/SetDocumentTitle/index.js.map +1 -1
  275. package/dist/views/Edit/Default/index.js +190 -187
  276. package/dist/views/Edit/Default/index.js.map +1 -1
  277. package/dist/views/Edit/Default/types.js +1 -2
  278. package/dist/views/Edit/Default/types.js.map +1 -1
  279. package/dist/views/Edit/index.client.js +45 -21
  280. package/dist/views/Edit/index.client.js.map +1 -1
  281. package/dist/views/Edit/index.js +2 -3
  282. package/dist/views/Edit/index.js.map +1 -1
  283. package/dist/views/Edit/meta.js +43 -35
  284. package/dist/views/Edit/meta.js.map +1 -1
  285. package/dist/views/Edit/sanitizeEditViewProps.js +8 -9
  286. package/dist/views/Edit/sanitizeEditViewProps.js.map +1 -1
  287. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +151 -94
  288. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
  289. package/dist/views/ForgotPassword/index.js +59 -46
  290. package/dist/views/ForgotPassword/index.js.map +1 -1
  291. package/dist/views/ForgotPassword/meta.js +12 -8
  292. package/dist/views/ForgotPassword/meta.js.map +1 -1
  293. package/dist/views/List/Default/index.js +348 -208
  294. package/dist/views/List/Default/index.js.map +1 -1
  295. package/dist/views/List/Default/types.js +1 -2
  296. package/dist/views/List/Default/types.js.map +1 -1
  297. package/dist/views/List/index.js +153 -137
  298. package/dist/views/List/index.js.map +1 -1
  299. package/dist/views/List/meta.js +20 -17
  300. package/dist/views/List/meta.js.map +1 -1
  301. package/dist/views/LivePreview/Context/collisionDetection.js +24 -21
  302. package/dist/views/LivePreview/Context/collisionDetection.js.map +1 -1
  303. package/dist/views/LivePreview/Context/context.d.ts +2 -1
  304. package/dist/views/LivePreview/Context/context.d.ts.map +1 -1
  305. package/dist/views/LivePreview/Context/context.js +39 -36
  306. package/dist/views/LivePreview/Context/context.js.map +1 -1
  307. package/dist/views/LivePreview/Context/index.js +134 -142
  308. package/dist/views/LivePreview/Context/index.js.map +1 -1
  309. package/dist/views/LivePreview/Context/sizeReducer.js +18 -19
  310. package/dist/views/LivePreview/Context/sizeReducer.js.map +1 -1
  311. package/dist/views/LivePreview/Device/index.js +78 -71
  312. package/dist/views/LivePreview/Device/index.js.map +1 -1
  313. package/dist/views/LivePreview/DeviceContainer/index.js +47 -23
  314. package/dist/views/LivePreview/DeviceContainer/index.js.map +1 -1
  315. package/dist/views/LivePreview/IFrame/index.js +21 -16
  316. package/dist/views/LivePreview/IFrame/index.js.map +1 -1
  317. package/dist/views/LivePreview/Preview/index.js +145 -92
  318. package/dist/views/LivePreview/Preview/index.js.map +1 -1
  319. package/dist/views/LivePreview/Toolbar/Controls/index.js +136 -115
  320. package/dist/views/LivePreview/Toolbar/Controls/index.js.map +1 -1
  321. package/dist/views/LivePreview/Toolbar/SizeInput/index.js +89 -51
  322. package/dist/views/LivePreview/Toolbar/SizeInput/index.js.map +1 -1
  323. package/dist/views/LivePreview/Toolbar/index.js +82 -50
  324. package/dist/views/LivePreview/Toolbar/index.js.map +1 -1
  325. package/dist/views/LivePreview/ToolbarArea/index.js +32 -10
  326. package/dist/views/LivePreview/ToolbarArea/index.js.map +1 -1
  327. package/dist/views/LivePreview/index.client.js +316 -160
  328. package/dist/views/LivePreview/index.client.js.map +1 -1
  329. package/dist/views/LivePreview/index.js +67 -55
  330. package/dist/views/LivePreview/index.js.map +1 -1
  331. package/dist/views/LivePreview/meta.js +14 -9
  332. package/dist/views/LivePreview/meta.js.map +1 -1
  333. package/dist/views/LivePreview/usePopupWindow.js +91 -94
  334. package/dist/views/LivePreview/usePopupWindow.js.map +1 -1
  335. package/dist/views/Login/LoginField/index.js +83 -39
  336. package/dist/views/Login/LoginField/index.js.map +1 -1
  337. package/dist/views/Login/LoginForm/index.js +130 -66
  338. package/dist/views/Login/LoginForm/index.js.map +1 -1
  339. package/dist/views/Login/index.js +77 -54
  340. package/dist/views/Login/index.js.map +1 -1
  341. package/dist/views/Login/meta.js +12 -8
  342. package/dist/views/Login/meta.js.map +1 -1
  343. package/dist/views/Logout/LogoutClient.js +84 -39
  344. package/dist/views/Logout/LogoutClient.js.map +1 -1
  345. package/dist/views/Logout/index.js +29 -16
  346. package/dist/views/Logout/index.js.map +1 -1
  347. package/dist/views/Logout/meta.js +11 -7
  348. package/dist/views/Logout/meta.js.map +1 -1
  349. package/dist/views/NotFound/index.client.js +78 -40
  350. package/dist/views/NotFound/index.client.js.map +1 -1
  351. package/dist/views/NotFound/index.js +47 -37
  352. package/dist/views/NotFound/index.js.map +1 -1
  353. package/dist/views/NotFound/meta.js +9 -7
  354. package/dist/views/NotFound/meta.js.map +1 -1
  355. package/dist/views/ResetPassword/index.client.js +97 -59
  356. package/dist/views/ResetPassword/index.client.js.map +1 -1
  357. package/dist/views/ResetPassword/index.js +68 -53
  358. package/dist/views/ResetPassword/index.js.map +1 -1
  359. package/dist/views/ResetPassword/meta.js +12 -8
  360. package/dist/views/ResetPassword/meta.js.map +1 -1
  361. package/dist/views/Root/generateCustomViewMetadata.js +21 -19
  362. package/dist/views/Root/generateCustomViewMetadata.js.map +1 -1
  363. package/dist/views/Root/getCustomViewByRoute.js +42 -31
  364. package/dist/views/Root/getCustomViewByRoute.js.map +1 -1
  365. package/dist/views/Root/getViewFromConfig.js +162 -156
  366. package/dist/views/Root/getViewFromConfig.js.map +1 -1
  367. package/dist/views/Root/index.js +99 -82
  368. package/dist/views/Root/index.js.map +1 -1
  369. package/dist/views/Root/isPathMatchingRoute.js +18 -13
  370. package/dist/views/Root/isPathMatchingRoute.js.map +1 -1
  371. package/dist/views/Root/meta.js +141 -136
  372. package/dist/views/Root/meta.js.map +1 -1
  373. package/dist/views/Unauthorized/index.js +32 -22
  374. package/dist/views/Unauthorized/index.js.map +1 -1
  375. package/dist/views/Unauthorized/meta.js +12 -8
  376. package/dist/views/Unauthorized/meta.js.map +1 -1
  377. package/dist/views/Verify/index.js +58 -43
  378. package/dist/views/Verify/index.js.map +1 -1
  379. package/dist/views/Verify/meta.js +12 -8
  380. package/dist/views/Verify/meta.js.map +1 -1
  381. package/dist/views/Version/Default/SetStepNav.d.ts.map +1 -1
  382. package/dist/views/Version/Default/SetStepNav.js +147 -103
  383. package/dist/views/Version/Default/SetStepNav.js.map +1 -1
  384. package/dist/views/Version/Default/index.js +198 -114
  385. package/dist/views/Version/Default/index.js.map +1 -1
  386. package/dist/views/Version/Default/types.js +1 -2
  387. package/dist/views/Version/Default/types.js.map +1 -1
  388. package/dist/views/Version/RenderFieldsToDiff/Label/index.js +6 -5
  389. package/dist/views/Version/RenderFieldsToDiff/Label/index.js.map +1 -1
  390. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -1
  391. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +65 -69
  392. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
  393. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.d.ts.map +1 -1
  394. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js +34 -31
  395. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js.map +1 -1
  396. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +108 -78
  397. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
  398. package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js +17 -11
  399. package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js.map +1 -1
  400. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts.map +1 -1
  401. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +40 -38
  402. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
  403. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.d.ts.map +1 -1
  404. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +42 -32
  405. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
  406. package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.js +17 -11
  407. package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.js.map +1 -1
  408. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.d.ts.map +1 -1
  409. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +34 -31
  410. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
  411. package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.js +4 -5
  412. package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.js.map +1 -1
  413. package/dist/views/Version/RenderFieldsToDiff/fields/index.js +20 -21
  414. package/dist/views/Version/RenderFieldsToDiff/fields/index.js.map +1 -1
  415. package/dist/views/Version/RenderFieldsToDiff/fields/styles.js +23 -24
  416. package/dist/views/Version/RenderFieldsToDiff/fields/styles.js.map +1 -1
  417. package/dist/views/Version/RenderFieldsToDiff/fields/types.js +1 -2
  418. package/dist/views/Version/RenderFieldsToDiff/fields/types.js.map +1 -1
  419. package/dist/views/Version/RenderFieldsToDiff/index.js +102 -97
  420. package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
  421. package/dist/views/Version/RenderFieldsToDiff/types.js +1 -2
  422. package/dist/views/Version/RenderFieldsToDiff/types.js.map +1 -1
  423. package/dist/views/Version/Restore/index.js +107 -110
  424. package/dist/views/Version/Restore/index.js.map +1 -1
  425. package/dist/views/Version/Restore/types.js +1 -2
  426. package/dist/views/Version/Restore/types.js.map +1 -1
  427. package/dist/views/Version/SelectComparison/index.js +130 -138
  428. package/dist/views/Version/SelectComparison/index.js.map +1 -1
  429. package/dist/views/Version/SelectComparison/types.js +1 -2
  430. package/dist/views/Version/SelectComparison/types.js.map +1 -1
  431. package/dist/views/Version/SelectLocales/index.js +58 -30
  432. package/dist/views/Version/SelectLocales/index.js.map +1 -1
  433. package/dist/views/Version/SelectLocales/types.js +1 -2
  434. package/dist/views/Version/SelectLocales/types.js.map +1 -1
  435. package/dist/views/Version/index.js +126 -105
  436. package/dist/views/Version/index.js.map +1 -1
  437. package/dist/views/Version/meta.js +49 -43
  438. package/dist/views/Version/meta.js.map +1 -1
  439. package/dist/views/Versions/buildColumns.js +87 -82
  440. package/dist/views/Versions/buildColumns.js.map +1 -1
  441. package/dist/views/Versions/cells/AutosaveCell/index.js +69 -42
  442. package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
  443. package/dist/views/Versions/cells/CreatedAt/index.js +70 -17
  444. package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
  445. package/dist/views/Versions/cells/ID/index.js +17 -5
  446. package/dist/views/Versions/cells/ID/index.js.map +1 -1
  447. package/dist/views/Versions/getLatestVersion.js +33 -29
  448. package/dist/views/Versions/getLatestVersion.js.map +1 -1
  449. package/dist/views/Versions/index.client.js +80 -77
  450. package/dist/views/Versions/index.client.js.map +1 -1
  451. package/dist/views/Versions/index.js +148 -127
  452. package/dist/views/Versions/index.js.map +1 -1
  453. package/dist/views/Versions/meta.js +43 -37
  454. package/dist/views/Versions/meta.js.map +1 -1
  455. package/dist/views/Versions/types.js +1 -2
  456. package/dist/views/Versions/types.js.map +1 -1
  457. package/dist/withPayload.js +83 -117
  458. package/dist/withPayload.js.map +1 -1
  459. package/package.json +20 -10
  460. package/dist/cjs/withPayload.cjs +0 -145
  461. package/dist/cjs/withPayload.cjs.map +0 -1
@@ -1,4 +1,6 @@
1
1
  'use client';
2
+
3
+ import { c as _c } from "react/compiler-runtime";
2
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
5
  import { getTranslation } from '@payloadcms/translations';
4
6
  import { NavGroup, useAuth, useConfig, useEntityVisibility, useNav, useTranslation } from '@payloadcms/ui';
@@ -7,82 +9,153 @@ import LinkWithDefault from 'next/link.js';
7
9
  import { usePathname } from 'next/navigation.js';
8
10
  import React, { Fragment } from 'react';
9
11
  const baseClass = 'nav';
10
- export const DefaultNavClient = ()=>{
11
- const { permissions } = useAuth();
12
- const { isEntityVisible } = useEntityVisibility();
13
- const pathname = usePathname();
14
- const { config: { collections, globals, routes: { admin: adminRoute } } } = useConfig();
15
- const { i18n } = useTranslation();
16
- const { navOpen } = useNav();
17
- const groups = groupNavItems([
18
- ...collections.filter(({ slug })=>isEntityVisible({
19
- collectionSlug: slug
20
- })).map((collection)=>{
21
- const entityToGroup = {
22
- type: EntityType.collection,
23
- entity: collection
24
- };
25
- return entityToGroup;
26
- }),
27
- ...globals.filter(({ slug })=>isEntityVisible({
28
- globalSlug: slug
29
- })).map((global)=>{
30
- const entityToGroup = {
31
- type: EntityType.global,
32
- entity: global
33
- };
34
- return entityToGroup;
35
- })
36
- ], permissions, i18n);
37
- return /*#__PURE__*/ _jsx(Fragment, {
38
- children: groups.map(({ entities, label }, key)=>{
39
- return /*#__PURE__*/ _jsx(NavGroup, {
40
- label: label,
41
- children: entities.map(({ type, entity }, i)=>{
42
- let entityLabel;
43
- let href;
44
- let id;
45
- if (type === EntityType.collection) {
46
- href = formatAdminURL({
47
- adminRoute,
48
- path: `/collections/${entity.slug}`
49
- });
50
- entityLabel = getTranslation(entity.labels.plural, i18n);
51
- id = `nav-${entity.slug}`;
52
- }
53
- if (type === EntityType.global) {
54
- href = formatAdminURL({
55
- adminRoute,
56
- path: `/globals/${entity.slug}`
57
- });
58
- entityLabel = getTranslation(entity.label, i18n);
59
- id = `nav-global-${entity.slug}`;
60
- }
61
- const Link = LinkWithDefault.default || LinkWithDefault;
62
- const LinkElement = Link || 'a';
63
- const activeCollection = pathname.endsWith(href);
64
- return /*#__PURE__*/ _jsxs(LinkElement, {
65
- className: [
66
- `${baseClass}__link`,
67
- activeCollection && `active`
68
- ].filter(Boolean).join(' '),
69
- href: href,
70
- id: id,
71
- tabIndex: !navOpen ? -1 : undefined,
72
- children: [
73
- activeCollection && /*#__PURE__*/ _jsx("div", {
74
- className: `${baseClass}__link-indicator`
75
- }),
76
- /*#__PURE__*/ _jsx("span", {
77
- className: `${baseClass}__link-label`,
78
- children: entityLabel
79
- })
80
- ]
81
- }, i);
82
- })
83
- }, key);
84
- })
12
+ export const DefaultNavClient = () => {
13
+ const $ = _c(18);
14
+ const {
15
+ permissions
16
+ } = useAuth();
17
+ const {
18
+ isEntityVisible
19
+ } = useEntityVisibility();
20
+ const pathname = usePathname();
21
+ const {
22
+ config: t0
23
+ } = useConfig();
24
+ const {
25
+ collections,
26
+ globals,
27
+ routes: t1
28
+ } = t0;
29
+ const {
30
+ admin: adminRoute
31
+ } = t1;
32
+ const {
33
+ i18n
34
+ } = useTranslation();
35
+ const {
36
+ navOpen
37
+ } = useNav();
38
+ let t2;
39
+ if ($[0] !== isEntityVisible || $[1] !== collections || $[2] !== globals || $[3] !== permissions || $[4] !== i18n || $[5] !== adminRoute || $[6] !== pathname || $[7] !== navOpen) {
40
+ let t3;
41
+ if ($[9] !== isEntityVisible) {
42
+ t3 = t4 => {
43
+ const {
44
+ slug
45
+ } = t4;
46
+ return isEntityVisible({
47
+ collectionSlug: slug
48
+ });
49
+ };
50
+ $[9] = isEntityVisible;
51
+ $[10] = t3;
52
+ } else {
53
+ t3 = $[10];
54
+ }
55
+ let t4;
56
+ if ($[11] !== isEntityVisible) {
57
+ t4 = t5 => {
58
+ const {
59
+ slug: slug_0
60
+ } = t5;
61
+ return isEntityVisible({
62
+ globalSlug: slug_0
63
+ });
64
+ };
65
+ $[11] = isEntityVisible;
66
+ $[12] = t4;
67
+ } else {
68
+ t4 = $[12];
69
+ }
70
+ const groups = groupNavItems([...collections.filter(t3).map(_temp), ...globals.filter(t4).map(_temp2)], permissions, i18n);
71
+ let t5;
72
+ if ($[13] !== adminRoute || $[14] !== i18n || $[15] !== pathname || $[16] !== navOpen) {
73
+ t5 = (t6, key) => {
74
+ const {
75
+ entities,
76
+ label
77
+ } = t6;
78
+ return _jsx(NavGroup, {
79
+ label,
80
+ children: entities.map((t7, i) => {
81
+ const {
82
+ type,
83
+ entity
84
+ } = t7;
85
+ let entityLabel;
86
+ let href;
87
+ let id;
88
+ if (type === EntityType.collection) {
89
+ href = formatAdminURL({
90
+ adminRoute,
91
+ path: `/collections/${entity.slug}`
92
+ });
93
+ entityLabel = getTranslation(entity.labels.plural, i18n);
94
+ id = `nav-${entity.slug}`;
95
+ }
96
+ if (type === EntityType.global) {
97
+ href = formatAdminURL({
98
+ adminRoute,
99
+ path: `/globals/${entity.slug}`
100
+ });
101
+ entityLabel = getTranslation(entity.label, i18n);
102
+ id = `nav-global-${entity.slug}`;
103
+ }
104
+ const Link = LinkWithDefault.default || LinkWithDefault;
105
+ const LinkElement = Link || "a";
106
+ const activeCollection = pathname.endsWith(href);
107
+ return _jsxs(LinkElement, {
108
+ className: [`${baseClass}__link`, activeCollection && `active`].filter(Boolean).join(" "),
109
+ href,
110
+ id,
111
+ tabIndex: !navOpen ? -1 : undefined,
112
+ children: [activeCollection && _jsx("div", {
113
+ className: `${baseClass}__link-indicator`
114
+ }), _jsx("span", {
115
+ className: `${baseClass}__link-label`,
116
+ children: entityLabel
117
+ })]
118
+ }, i);
119
+ })
120
+ }, key);
121
+ };
122
+ $[13] = adminRoute;
123
+ $[14] = i18n;
124
+ $[15] = pathname;
125
+ $[16] = navOpen;
126
+ $[17] = t5;
127
+ } else {
128
+ t5 = $[17];
129
+ }
130
+ t2 = _jsx(Fragment, {
131
+ children: groups.map(t5)
85
132
  });
133
+ $[0] = isEntityVisible;
134
+ $[1] = collections;
135
+ $[2] = globals;
136
+ $[3] = permissions;
137
+ $[4] = i18n;
138
+ $[5] = adminRoute;
139
+ $[6] = pathname;
140
+ $[7] = navOpen;
141
+ $[8] = t2;
142
+ } else {
143
+ t2 = $[8];
144
+ }
145
+ return t2;
86
146
  };
87
-
147
+ function _temp(collection) {
148
+ const entityToGroup = {
149
+ type: EntityType.collection,
150
+ entity: collection
151
+ };
152
+ return entityToGroup;
153
+ }
154
+ function _temp2(global) {
155
+ const entityToGroup_0 = {
156
+ type: EntityType.global,
157
+ entity: global
158
+ };
159
+ return entityToGroup_0;
160
+ }
88
161
  //# sourceMappingURL=index.client.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/elements/Nav/index.client.tsx"],"sourcesContent":["'use client'\n\nimport type { EntityToGroup } from '@payloadcms/ui/shared'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n ChevronIcon,\n NavGroup,\n useAuth,\n useConfig,\n useEntityVisibility,\n useNav,\n useTranslation,\n} from '@payloadcms/ui'\nimport { EntityType, formatAdminURL, groupNavItems } from '@payloadcms/ui/shared'\nimport LinkWithDefault from 'next/link.js'\nimport { usePathname } from 'next/navigation.js'\nimport React, { Fragment } from 'react'\n\nconst baseClass = 'nav'\n\nexport const DefaultNavClient: React.FC = () => {\n const { permissions } = useAuth()\n const { isEntityVisible } = useEntityVisibility()\n const pathname = usePathname()\n\n const {\n config: {\n collections,\n globals,\n routes: { admin: adminRoute },\n },\n } = useConfig()\n\n const { i18n } = useTranslation()\n const { navOpen } = useNav()\n\n const groups = groupNavItems(\n [\n ...collections\n .filter(({ slug }) => isEntityVisible({ collectionSlug: slug }))\n .map((collection) => {\n const entityToGroup: EntityToGroup = {\n type: EntityType.collection,\n entity: collection,\n }\n\n return entityToGroup\n }),\n ...globals\n .filter(({ slug }) => isEntityVisible({ globalSlug: slug }))\n .map((global) => {\n const entityToGroup: EntityToGroup = {\n type: EntityType.global,\n entity: global,\n }\n\n return entityToGroup\n }),\n ],\n permissions,\n i18n,\n )\n\n return (\n <Fragment>\n {groups.map(({ entities, label }, key) => {\n return (\n <NavGroup key={key} label={label}>\n {entities.map(({ type, entity }, i) => {\n let entityLabel: string\n let href: string\n let id: string\n\n if (type === EntityType.collection) {\n href = formatAdminURL({ adminRoute, path: `/collections/${entity.slug}` })\n entityLabel = getTranslation(entity.labels.plural, i18n)\n id = `nav-${entity.slug}`\n }\n\n if (type === EntityType.global) {\n href = formatAdminURL({ adminRoute, path: `/globals/${entity.slug}` })\n entityLabel = getTranslation(entity.label, i18n)\n id = `nav-global-${entity.slug}`\n }\n\n const Link = (LinkWithDefault.default ||\n LinkWithDefault) as typeof LinkWithDefault.default\n\n const LinkElement = Link || 'a'\n const activeCollection = pathname.endsWith(href)\n\n return (\n <LinkElement\n className={[`${baseClass}__link`, activeCollection && `active`]\n .filter(Boolean)\n .join(' ')}\n href={href}\n id={id}\n key={i}\n tabIndex={!navOpen ? -1 : undefined}\n >\n {activeCollection && <div className={`${baseClass}__link-indicator`} />}\n <span className={`${baseClass}__link-label`}>{entityLabel}</span>\n </LinkElement>\n )\n })}\n </NavGroup>\n )\n })}\n </Fragment>\n )\n}\n"],"names":["getTranslation","NavGroup","useAuth","useConfig","useEntityVisibility","useNav","useTranslation","EntityType","formatAdminURL","groupNavItems","LinkWithDefault","usePathname","React","Fragment","baseClass","DefaultNavClient","permissions","isEntityVisible","pathname","config","collections","globals","routes","admin","adminRoute","i18n","navOpen","groups","filter","slug","collectionSlug","map","collection","entityToGroup","type","entity","globalSlug","global","entities","label","key","i","entityLabel","href","id","path","labels","plural","Link","default","LinkElement","activeCollection","endsWith","className","Boolean","join","tabIndex","undefined","div","span"],"mappings":"AAAA;;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SAEEC,QAAQ,EACRC,OAAO,EACPC,SAAS,EACTC,mBAAmB,EACnBC,MAAM,EACNC,cAAc,QACT,iBAAgB;AACvB,SAASC,UAAU,EAAEC,cAAc,EAAEC,aAAa,QAAQ,wBAAuB;AACjF,OAAOC,qBAAqB,eAAc;AAC1C,SAASC,WAAW,QAAQ,qBAAoB;AAChD,OAAOC,SAASC,QAAQ,QAAQ,QAAO;AAEvC,MAAMC,YAAY;AAElB,OAAO,MAAMC,mBAA6B;IACxC,MAAM,EAAEC,WAAW,EAAE,GAAGd;IACxB,MAAM,EAAEe,eAAe,EAAE,GAAGb;IAC5B,MAAMc,WAAWP;IAEjB,MAAM,EACJQ,QAAQ,EACNC,WAAW,EACXC,OAAO,EACPC,QAAQ,EAAEC,OAAOC,UAAU,EAAE,EAC9B,EACF,GAAGrB;IAEJ,MAAM,EAAEsB,IAAI,EAAE,GAAGnB;IACjB,MAAM,EAAEoB,OAAO,EAAE,GAAGrB;IAEpB,MAAMsB,SAASlB,cACb;WACKW,YACAQ,MAAM,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKZ,gBAAgB;gBAAEa,gBAAgBD;YAAK,IAC5DE,G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BAE3C,qBACE,MAACO;wBACCG,WAAW;4BAAC,CAAC,EAAEvC,UAAU,MAAM,CAAC;4BAAEqC,oBAAoB,CAAC,MAAM,CAAC;yBAAC,CAC5DvB,MAAM,CAAC0B,SACPC,IAAI,CAAC;wBACRZ,MAAMA;wBACNC,IAAIA;wBAEJY,UAAU,CAAC9B,UAAU,CAAC,IAAI+B;;4BAEzBN,kCAAoB,KAACO;gCAAIL,WAAW,CAAC,EAAEvC,UAAU,gBAAgB,CAAC;;0CACnE,KAAC6C;gCAAKN,WAAW,CAAC,EAAEvC,UAAU,YAAY,CAAC;0CAAG4B;;;uBAJzCD;gBAOX;eAtCaD;QAyCnB;;AAGN,EAAC"}
1
+ {"version":3,"file":"index.client.js","names":["c","_c","getTranslation","NavGroup","useAuth","useConfig","useEntityVisibility","useNav","useTranslation","EntityType","formatAdminURL","groupNavItems","LinkWithDefault","usePathname","React","Fragment","baseClass","DefaultNavClient","$","permissions","isEntityVisible","pathname","config","t0","collections","globals","routes","t1","admin","adminRoute","i18n","navOpen","t2","t3","t4","slug","collectionSlug","t5","slug_0","globalSlug","groups","filter","map","_temp","_temp2","t6","key","entities","label","_jsx","children","t7","i","type","entity","entityLabel","href","id","collection","labels","plural","global","Link","default","LinkElement","activeCollection","endsWith","_jsxs","className","Boolean","join","tabIndex","undefined","entityToGroup","entityToGroup_0"],"sources":["../../../src/elements/Nav/index.client.tsx"],"sourcesContent":["'use client'\n\nimport type { EntityToGroup } from '@payloadcms/ui/shared'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n ChevronIcon,\n NavGroup,\n useAuth,\n useConfig,\n useEntityVisibility,\n useNav,\n useTranslation,\n} from '@payloadcms/ui'\nimport { EntityType, formatAdminURL, groupNavItems } from '@payloadcms/ui/shared'\nimport LinkWithDefault from 'next/link.js'\nimport { usePathname } from 'next/navigation.js'\nimport React, { Fragment } from 'react'\n\nconst baseClass = 'nav'\n\nexport const DefaultNavClient: React.FC = () => {\n const { permissions } = useAuth()\n const { isEntityVisible } = useEntityVisibility()\n const pathname = usePathname()\n\n const {\n config: {\n collections,\n globals,\n routes: { admin: adminRoute },\n },\n } = useConfig()\n\n const { i18n } = useTranslation()\n const { navOpen } = useNav()\n\n const groups = groupNavItems(\n [\n ...collections\n .filter(({ slug }) => isEntityVisible({ collectionSlug: slug }))\n .map((collection) => {\n const entityToGroup: EntityToGroup = {\n type: EntityType.collection,\n entity: collection,\n }\n\n return entityToGroup\n }),\n ...globals\n .filter(({ slug }) => isEntityVisible({ globalSlug: slug }))\n .map((global) => {\n const entityToGroup: EntityToGroup = {\n type: EntityType.global,\n entity: global,\n }\n\n return entityToGroup\n }),\n ],\n permissions,\n i18n,\n )\n\n return (\n <Fragment>\n {groups.map(({ entities, label }, key) => {\n return (\n <NavGroup key={key} label={label}>\n {entities.map(({ type, entity }, i) => {\n let entityLabel: string\n let href: string\n let id: string\n\n if (type === EntityType.collection) {\n href = formatAdminURL({ adminRoute, path: `/collections/${entity.slug}` })\n entityLabel = getTranslation(entity.labels.plural, i18n)\n id = `nav-${entity.slug}`\n }\n\n if (type === EntityType.global) {\n href = formatAdminURL({ adminRoute, path: `/globals/${entity.slug}` })\n entityLabel = getTranslation(entity.label, i18n)\n id = `nav-global-${entity.slug}`\n }\n\n const Link = (LinkWithDefault.default ||\n LinkWithDefault) as typeof LinkWithDefault.default\n\n const LinkElement = Link || 'a'\n const activeCollection = pathname.endsWith(href)\n\n return (\n <LinkElement\n className={[`${baseClass}__link`, activeCollection && `active`]\n .filter(Boolean)\n .join(' ')}\n href={href}\n id={id}\n key={i}\n tabIndex={!navOpen ? -1 : undefined}\n >\n {activeCollection && <div className={`${baseClass}__link-indicator`} />}\n <span className={`${baseClass}__link-label`}>{entityLabel}</span>\n </LinkElement>\n )\n })}\n </NavGroup>\n )\n })}\n </Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,cAAc,QAAQ;AAC/B,SAEEC,QAAQ,E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FL,E;CA+CJ;AA3F0C,SAAAW,MAAAe,UAAA;EAqBhC,MAAAe,aAAA;IAAApB,IAAA,EAAA5C,UAAA,CAAAiD,UAAA;IAAAJ,MAAA,EAEUI;EAAA;EACV,OAEOe,aAAA;AAAA;AA1ByB,SAAA7B,OAAAiB,MAAA;EA+BhC,MAAAa,eAAA;IAAArB,IAAA,EAAA5C,UAAA,CAAAoD,MAAA;IAAAP,MAAA,EAEUO;EAAA;EACV,OAEOY,eAAA;AAAA","ignoreList":[]}
@@ -6,56 +6,62 @@ import { NavHamburger } from './NavHamburger/index.js';
6
6
  import { NavWrapper } from './NavWrapper/index.js';
7
7
  const baseClass = 'nav';
8
8
  import { DefaultNavClient } from './index.client.js';
9
- export const DefaultNav = (props)=>{
10
- const { i18n, locale, params, payload, permissions, searchParams, user } = props;
11
- if (!payload?.config) {
12
- return null;
9
+ export const DefaultNav = props => {
10
+ const {
11
+ i18n,
12
+ locale,
13
+ params,
14
+ payload,
15
+ permissions,
16
+ searchParams,
17
+ user
18
+ } = props;
19
+ if (!payload?.config) {
20
+ return null;
21
+ }
22
+ const {
23
+ admin: {
24
+ components: {
25
+ afterNavLinks,
26
+ beforeNavLinks
27
+ }
13
28
  }
14
- const { admin: { components: { afterNavLinks, beforeNavLinks } } } = payload.config;
15
- const createMappedComponent = getCreateMappedComponent({
16
- importMap: payload.importMap,
17
- serverProps: {
18
- i18n,
19
- locale,
20
- params,
21
- payload,
22
- permissions,
23
- searchParams,
24
- user
25
- }
26
- });
27
- const mappedBeforeNavLinks = createMappedComponent(beforeNavLinks, undefined, undefined, 'beforeNavLinks');
28
- const mappedAfterNavLinks = createMappedComponent(afterNavLinks, undefined, undefined, 'afterNavLinks');
29
- return /*#__PURE__*/ _jsxs(NavWrapper, {
30
- baseClass: baseClass,
31
- children: [
32
- /*#__PURE__*/ _jsxs("nav", {
33
- className: `${baseClass}__wrap`,
34
- children: [
35
- /*#__PURE__*/ _jsx(RenderComponent, {
36
- mappedComponent: mappedBeforeNavLinks
37
- }),
38
- /*#__PURE__*/ _jsx(DefaultNavClient, {}),
39
- /*#__PURE__*/ _jsx(RenderComponent, {
40
- mappedComponent: mappedAfterNavLinks
41
- }),
42
- /*#__PURE__*/ _jsx("div", {
43
- className: `${baseClass}__controls`,
44
- children: /*#__PURE__*/ _jsx(Logout, {})
45
- })
46
- ]
47
- }),
48
- /*#__PURE__*/ _jsx("div", {
49
- className: `${baseClass}__header`,
50
- children: /*#__PURE__*/ _jsx("div", {
51
- className: `${baseClass}__header-content`,
52
- children: /*#__PURE__*/ _jsx(NavHamburger, {
53
- baseClass: baseClass
54
- })
55
- })
56
- })
57
- ]
58
- });
29
+ } = payload.config;
30
+ const createMappedComponent = getCreateMappedComponent({
31
+ importMap: payload.importMap,
32
+ serverProps: {
33
+ i18n,
34
+ locale,
35
+ params,
36
+ payload,
37
+ permissions,
38
+ searchParams,
39
+ user
40
+ }
41
+ });
42
+ const mappedBeforeNavLinks = createMappedComponent(beforeNavLinks, undefined, undefined, 'beforeNavLinks');
43
+ const mappedAfterNavLinks = createMappedComponent(afterNavLinks, undefined, undefined, 'afterNavLinks');
44
+ return /*#__PURE__*/_jsxs(NavWrapper, {
45
+ baseClass: baseClass,
46
+ children: [/*#__PURE__*/_jsxs("nav", {
47
+ className: `${baseClass}__wrap`,
48
+ children: [/*#__PURE__*/_jsx(RenderComponent, {
49
+ mappedComponent: mappedBeforeNavLinks
50
+ }), /*#__PURE__*/_jsx(DefaultNavClient, {}), /*#__PURE__*/_jsx(RenderComponent, {
51
+ mappedComponent: mappedAfterNavLinks
52
+ }), /*#__PURE__*/_jsx("div", {
53
+ className: `${baseClass}__controls`,
54
+ children: /*#__PURE__*/_jsx(Logout, {})
55
+ })]
56
+ }), /*#__PURE__*/_jsx("div", {
57
+ className: `${baseClass}__header`,
58
+ children: /*#__PURE__*/_jsx("div", {
59
+ className: `${baseClass}__header-content`,
60
+ children: /*#__PURE__*/_jsx(NavHamburger, {
61
+ baseClass: baseClass
62
+ })
63
+ })
64
+ })]
65
+ });
59
66
  };
60
-
61
67
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/elements/Nav/index.tsx"],"sourcesContent":["import type { ServerProps } from 'payload'\n\nimport { Logout } from '@payloadcms/ui'\nimport { RenderComponent, getCreateMappedComponent } from '@payloadcms/ui/shared'\nimport React from 'react'\n\nimport { NavHamburger } from './NavHamburger/index.js'\nimport { NavWrapper } from './NavWrapper/index.js'\nimport './index.scss'\n\nconst baseClass = 'nav'\n\nimport { DefaultNavClient } from './index.client.js'\n\nexport type NavProps = ServerProps\n\nexport const DefaultNav: React.FC<NavProps> = (props) => {\n const { i18n, locale, params, payload, permissions, searchParams, user } = props\n\n if (!payload?.config) {\n return null\n }\n\n const {\n admin: {\n components: { afterNavLinks, beforeNavLinks },\n },\n } = payload.config\n\n const createMappedComponent = getCreateMappedComponent({\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n },\n })\n\n const mappedBeforeNavLinks = createMappedComponent(\n beforeNavLinks,\n undefined,\n undefined,\n 'beforeNavLinks',\n )\n const mappedAfterNavLinks = createMappedComponent(\n afterNavLinks,\n undefined,\n undefined,\n 'afterNavLinks',\n )\n\n return (\n <NavWrapper baseClass={baseClass}>\n <nav className={`${baseClass}__wrap`}>\n <RenderComponent mappedComponent={mappedBeforeNavLinks} />\n <DefaultNavClient />\n <RenderComponent mappedComponent={mappedAfterNavLinks} />\n <div className={`${baseClass}__controls`}>\n <Logout />\n </div>\n </nav>\n <div className={`${baseClass}__header`}>\n <div className={`${baseClass}__header-content`}>\n <NavHamburger baseClass={baseClass} />\n </div>\n </div>\n </NavWrapper>\n )\n}\n"],"names":["Logout","RenderComponent","getCreateMappedComponent","React","NavHamburger","NavWrapper","baseClass","DefaultNavClient","DefaultNav","props","i18n","locale","params","payload","permissions","searchParams","user","config","admin","components","afterNavLinks","beforeNavLinks","createMappedComponent","importMap","serverProps","mappedBeforeNavLinks","undefined","mappedAfterNavLinks","nav","className","mappedComponent","div"],"mappings":";AAEA,SAASA,MAAM,QAAQ,iBAAgB;AACvC,SAASC,eAAe,EAAEC,wBAAwB,QAAQ,wBAAuB;AACjF,OAAOC,WAAW,QAAO;AAEzB,SAASC,YAAY,QAAQ,0BAAyB;AACtD,SAASC,UAAU,QAAQ,wBAAuB;AAGlD,MAAMC,YAAY;AAElB,SAASC,gBAAgB,QAAQ,oBAAmB;AAIpD,OAAO,MAAMC,aAAiC,CAACC;IAC7C,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAEC,WAAW,EAAEC,YAAY,EAAEC,IAAI,EAAE,GAAGP;IAE3E,IAAI,CAACI,SAASI,QAAQ;QACpB,OAAO;IACT;IAEA,MAAM,EACJC,OAAO,EACLC,YAAY,EAAEC,aAAa,EAAEC,cAAc,EAAE,EAC9C,EACF,GAAGR,QAAQI,MAAM;IAElB,MAAMK,wBAAwBpB,yBAAyB;QACrDqB,WAAWV,QAAQU,SAAS;QAC5BC,aAAa;YACXd;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;QACF;IACF;IAEA,MAAMS,uBAAuBH,sBAC3BD,gBACAK,WACAA,WACA;IAEF,MAAMC,sBAAsBL,sBAC1BF,eACAM,WACAA,WACA;IAGF,qBACE,MAACrB;QAAWC,WAAWA;;0BACrB,MAACsB;gBAAIC,WAAW,CAAC,EAAEvB,UAAU,MAAM,CAAC;;kCAClC,KAACL;wBAAgB6B,iBAAiBL;;kCAClC,KAAClB;kCACD,KAACN;wBAAgB6B,iBAAiBH;;kCAClC,KAACI;wBAAIF,WAAW,CAAC,EAAEvB,UAAU,UAAU,CAAC;kCACtC,cAAA,KAACN;;;;0BAGL,KAAC+B;gBAAIF,WAAW,CAAC,EAAEvB,UAAU,QAAQ,CAAC;0BACpC,cAAA,KAACyB;oBAAIF,WAAW,CAAC,EAAEvB,UAAU,gBAAgB,CAAC;8BAC5C,cAAA,KAACF;wBAAaE,WAAWA;;;;;;AAKnC,EAAC"}
1
+ {"version":3,"file":"index.js","names":["Logout","RenderComponent","getCreateMappedComponent","React","NavHamburger","NavWrapper","baseClass","DefaultNavClient","DefaultNav","props","i18n","locale","params","payload","permissions","searchParams","user","config","admin","components","afterNavLinks","beforeNavLinks","createMappedComponent","importMap","serverProps","mappedBeforeNavLinks","undefined","mappedAfterNavLinks","_jsxs","className","_jsx","mappedComponent"],"sources":["../../../src/elements/Nav/index.tsx"],"sourcesContent":["import type { ServerProps } from 'payload'\n\nimport { Logout } from '@payloadcms/ui'\nimport { RenderComponent, getCreateMappedComponent } from '@payloadcms/ui/shared'\nimport React from 'react'\n\nimport { NavHamburger } from './NavHamburger/index.js'\nimport { NavWrapper } from './NavWrapper/index.js'\nimport './index.scss'\n\nconst baseClass = 'nav'\n\nimport { DefaultNavClient } from './index.client.js'\n\nexport type NavProps = ServerProps\n\nexport const DefaultNav: React.FC<NavProps> = (props) => {\n const { i18n, locale, params, payload, permissions, searchParams, user } = props\n\n if (!payload?.config) {\n return null\n }\n\n const {\n admin: {\n components: { afterNavLinks, beforeNavLinks },\n },\n } = payload.config\n\n const createMappedComponent = getCreateMappedComponent({\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n },\n })\n\n const mappedBeforeNavLinks = createMappedComponent(\n beforeNavLinks,\n undefined,\n undefined,\n 'beforeNavLinks',\n )\n const mappedAfterNavLinks = createMappedComponent(\n afterNavLinks,\n undefined,\n undefined,\n 'afterNavLinks',\n )\n\n return (\n <NavWrapper baseClass={baseClass}>\n <nav className={`${baseClass}__wrap`}>\n <RenderComponent mappedComponent={mappedBeforeNavLinks} />\n <DefaultNavClient />\n <RenderComponent mappedComponent={mappedAfterNavLinks} />\n <div className={`${baseClass}__controls`}>\n <Logout />\n </div>\n </nav>\n <div className={`${baseClass}__header`}>\n <div className={`${baseClass}__header-content`}>\n <NavHamburger baseClass={baseClass} />\n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AAW,GAAGvB,SAAA,YAAqB;kBACtC,aAAAwB,IAAA,CAAC9B,MAAA;;qBAGL8B,IAAA,CAAC;MAAID,SAAA,EAAW,GAAGvB,SAAA,UAAmB;gBACpC,aAAAwB,IAAA,CAAC;QAAID,SAAA,EAAW,GAAGvB,SAAA,kBAA2B;kBAC5C,aAAAwB,IAAA,CAAC1B,YAAA;UAAaE,SAAA,EAAWA;;;;;AAKnC","ignoreList":[]}
@@ -1,3 +1,2 @@
1
1
  export { RootLayout, metadata } from '../layouts/Root/index.js';
2
-
3
2
  //# sourceMappingURL=layouts.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/exports/layouts.ts"],"sourcesContent":["export { RootLayout, metadata } from '../layouts/Root/index.js'\n"],"names":["RootLayout","metadata"],"mappings":"AAAA,SAASA,UAAU,EAAEC,QAAQ,QAAQ,2BAA0B"}
1
+ {"version":3,"file":"layouts.js","names":["RootLayout","metadata"],"sources":["../../src/exports/layouts.ts"],"sourcesContent":["export { RootLayout, metadata } from '../layouts/Root/index.js'\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,QAAQ,QAAQ","ignoreList":[]}
@@ -1,4 +1,3 @@
1
1
  export { GRAPHQL_PLAYGROUND_GET, GRAPHQL_POST } from '../routes/graphql/index.js';
2
2
  export { DELETE as REST_DELETE, GET as REST_GET, OPTIONS as REST_OPTIONS, PATCH as REST_PATCH, POST as REST_POST } from '../routes/rest/index.js';
3
-
4
3
  //# sourceMappingURL=routes.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/exports/routes.ts"],"sourcesContent":["export { GRAPHQL_PLAYGROUND_GET, GRAPHQL_POST } from '../routes/graphql/index.js'\n\nexport {\n DELETE as REST_DELETE,\n GET as REST_GET,\n OPTIONS as REST_OPTIONS,\n PATCH as REST_PATCH,\n POST as REST_POST,\n} from '../routes/rest/index.js'\n"],"names":["GRAPHQL_PLAYGROUND_GET","GRAPHQL_POST","DELETE","REST_DELETE","GET","REST_GET","OPTIONS","REST_OPTIONS","PATCH","REST_PATCH","POST","REST_POST"],"mappings":"AAAA,SAASA,sBAAsB,EAAEC,YAAY,QAAQ,6BAA4B;AAEjF,SACEC,UAAUC,WAAW,EACrBC,OAAOC,QAAQ,EACfC,WAAWC,YAAY,EACvBC,SAASC,UAAU,EACnBC,QAAQC,SAAS,QACZ,0BAAyB"}
1
+ {"version":3,"file":"routes.js","names":["GRAPHQL_PLAYGROUND_GET","GRAPHQL_POST","DELETE","REST_DELETE","GET","REST_GET","OPTIONS","REST_OPTIONS","PATCH","REST_PATCH","POST","REST_POST"],"sources":["../../src/exports/routes.ts"],"sourcesContent":["export { GRAPHQL_PLAYGROUND_GET, GRAPHQL_POST } from '../routes/graphql/index.js'\n\nexport {\n DELETE as REST_DELETE,\n GET as REST_GET,\n OPTIONS as REST_OPTIONS,\n PATCH as REST_PATCH,\n POST as REST_POST,\n} from '../routes/rest/index.js'\n"],"mappings":"AAAA,SAASA,sBAAsB,EAAEC,YAAY,QAAQ;AAErD,SACEC,MAAA,IAAUC,WAAW,EACrBC,GAAA,IAAOC,QAAQ,EACfC,OAAA,IAAWC,YAAY,EACvBC,KAAA,IAASC,UAAU,EACnBC,IAAA,IAAQC,SAAS,QACZ","ignoreList":[]}
@@ -1,4 +1,3 @@
1
1
  export { DefaultTemplate } from '../templates/Default/index.js';
2
2
  export { MinimalTemplate } from '../templates/Minimal/index.js';
3
-
4
3
  //# sourceMappingURL=templates.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/exports/templates.ts"],"sourcesContent":["export { DefaultTemplate, type DefaultTemplateProps } from '../templates/Default/index.js'\nexport { MinimalTemplate, type MinimalTemplateProps } from '../templates/Minimal/index.js'\n"],"names":["DefaultTemplate","MinimalTemplate"],"mappings":"AAAA,SAASA,eAAe,QAAmC,gCAA+B;AAC1F,SAASC,eAAe,QAAmC,gCAA+B"}
1
+ {"version":3,"file":"templates.js","names":["DefaultTemplate","MinimalTemplate"],"sources":["../../src/exports/templates.ts"],"sourcesContent":["export { DefaultTemplate, type DefaultTemplateProps } from '../templates/Default/index.js'\nexport { MinimalTemplate, type MinimalTemplateProps } from '../templates/Minimal/index.js'\n"],"mappings":"AAAA,SAASA,eAAe,QAAmC;AAC3D,SAASC,eAAe,QAAmC","ignoreList":[]}
@@ -4,5 +4,4 @@ export { createPayloadRequest } from '../utilities/createPayloadRequest.js';
4
4
  export { getNextRequestI18n } from '../utilities/getNextRequestI18n.js';
5
5
  export { getPayloadHMR, reload } from '../utilities/getPayloadHMR.js';
6
6
  export { headersWithCors } from '../utilities/headersWithCors.js';
7
-
8
7
  //# sourceMappingURL=utilities.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/exports/utilities.ts"],"sourcesContent":["export { addDataAndFileToRequest } from '../utilities/addDataAndFileToRequest.js'\nexport { addLocalesToRequestFromData, sanitizeLocales } from '../utilities/addLocalesToRequest.js'\nexport { createPayloadRequest } from '../utilities/createPayloadRequest.js'\nexport { getNextRequestI18n } from '../utilities/getNextRequestI18n.js'\nexport { getPayloadHMR, reload } from '../utilities/getPayloadHMR.js'\nexport { headersWithCors } from '../utilities/headersWithCors.js'\n"],"names":["addDataAndFileToRequest","addLocalesToRequestFromData","sanitizeLocales","createPayloadRequest","getNextRequestI18n","getPayloadHMR","reload","headersWithCors"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,0CAAyC;AACjF,SAASC,2BAA2B,EAAEC,eAAe,QAAQ,sCAAqC;AAClG,SAASC,oBAAoB,QAAQ,uCAAsC;AAC3E,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,aAAa,EAAEC,MAAM,QAAQ,gCAA+B;AACrE,SAASC,eAAe,QAAQ,kCAAiC"}
1
+ {"version":3,"file":"utilities.js","names":["addDataAndFileToRequest","addLocalesToRequestFromData","sanitizeLocales","createPayloadRequest","getNextRequestI18n","getPayloadHMR","reload","headersWithCors"],"sources":["../../src/exports/utilities.ts"],"sourcesContent":["export { addDataAndFileToRequest } from '../utilities/addDataAndFileToRequest.js'\nexport { addLocalesToRequestFromData, sanitizeLocales } from '../utilities/addLocalesToRequest.js'\nexport { createPayloadRequest } from '../utilities/createPayloadRequest.js'\nexport { getNextRequestI18n } from '../utilities/getNextRequestI18n.js'\nexport { getPayloadHMR, reload } from '../utilities/getPayloadHMR.js'\nexport { headersWithCors } from '../utilities/headersWithCors.js'\n"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ;AACxC,SAASC,2BAA2B,EAAEC,eAAe,QAAQ;AAC7D,SAASC,oBAAoB,QAAQ;AACrC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,aAAa,EAAEC,MAAM,QAAQ;AACtC,SAASC,eAAe,QAAQ","ignoreList":[]}
@@ -2,5 +2,4 @@ export { DefaultEditView as EditView } from '../views/Edit/Default/index.js';
2
2
  export { DefaultListView as ListView } from '../views/List/Default/index.js';
3
3
  export { NotFoundPage } from '../views/NotFound/index.js';
4
4
  export { RootPage, generatePageMetadata } from '../views/Root/index.js';
5
-
6
5
  //# sourceMappingURL=views.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/exports/views.ts"],"sourcesContent":["export { DefaultEditView as EditView } from '../views/Edit/Default/index.js'\nexport { DefaultListView as ListView } from '../views/List/Default/index.js'\nexport { NotFoundPage } from '../views/NotFound/index.js'\nexport { type GenerateViewMetadata, RootPage, generatePageMetadata } from '../views/Root/index.js'\n"],"names":["DefaultEditView","EditView","DefaultListView","ListView","NotFoundPage","RootPage","generatePageMetadata"],"mappings":"AAAA,SAASA,mBAAmBC,QAAQ,QAAQ,iCAAgC;AAC5E,SAASC,mBAAmBC,QAAQ,QAAQ,iCAAgC;AAC5E,SAASC,YAAY,QAAQ,6BAA4B;AACzD,SAAoCC,QAAQ,EAAEC,oBAAoB,QAAQ,yBAAwB"}
1
+ {"version":3,"file":"views.js","names":["DefaultEditView","EditView","DefaultListView","ListView","NotFoundPage","RootPage","generatePageMetadata"],"sources":["../../src/exports/views.ts"],"sourcesContent":["export { DefaultEditView as EditView } from '../views/Edit/Default/index.js'\nexport { DefaultListView as ListView } from '../views/List/Default/index.js'\nexport { NotFoundPage } from '../views/NotFound/index.js'\nexport { type GenerateViewMetadata, RootPage, generatePageMetadata } from '../views/Root/index.js'\n"],"mappings":"AAAA,SAASA,eAAA,IAAmBC,QAAQ,QAAQ;AAC5C,SAASC,eAAA,IAAmBC,QAAQ,QAAQ;AAC5C,SAASC,YAAY,QAAQ;AAC7B,SAAoCC,QAAQ,EAAEC,oBAAoB,QAAQ","ignoreList":[]}
@@ -2,42 +2,43 @@ import { checkAndMakeDir, debugLog, isFunc, moveFile, promiseCallback, saveBuffe
2
2
  /**
3
3
  * Returns Local function that moves the file to a different location on the filesystem
4
4
  * which takes two function arguments to make it compatible w/ Promise or Callback APIs
5
- */ const moveFromTemp = (filePath, options, fileUploadOptions)=>(resolve, reject)=>{
6
- debugLog(fileUploadOptions, `Moving temporary file ${options.tempFilePath} to ${filePath}`);
7
- moveFile(options.tempFilePath, filePath, promiseCallback(resolve, reject));
8
- };
5
+ */
6
+ const moveFromTemp = (filePath, options, fileUploadOptions) => (resolve, reject) => {
7
+ debugLog(fileUploadOptions, `Moving temporary file ${options.tempFilePath} to ${filePath}`);
8
+ moveFile(options.tempFilePath, filePath, promiseCallback(resolve, reject));
9
+ };
9
10
  /**
10
11
  * Returns Local function that moves the file from buffer to a different location on the filesystem
11
12
  * which takes two function arguments to make it compatible w/ Promise or Callback APIs
12
- */ const moveFromBuffer = (filePath, options, fileUploadOptions)=>(resolve, reject)=>{
13
- debugLog(fileUploadOptions, `Moving uploaded buffer to ${filePath}`);
14
- saveBufferToFile(options.buffer, filePath, promiseCallback(resolve, reject));
15
- };
16
- export const fileFactory = (options, fileUploadOptions)=>{
17
- // see: https://github.com/richardgirges/express-fileupload/issues/14
18
- // firefox uploads empty file in case of cache miss when f5ing page.
19
- // resulting in unexpected behavior. if there is no file data, the file is invalid.
20
- // if (!fileUploadOptions.useTempFiles && !options.buffer.length) return;
21
- // Create and return file object.
22
- return {
23
- name: options.name,
24
- data: options.buffer,
25
- encoding: options.encoding,
26
- md5: options.hash,
27
- mimetype: options.mimetype,
28
- mv: (filePath, callback)=>{
29
- // Define a proper move function.
30
- const moveFunc = fileUploadOptions.useTempFiles ? moveFromTemp(filePath, options, fileUploadOptions) : moveFromBuffer(filePath, options, fileUploadOptions);
31
- // Create a folder for a file.
32
- checkAndMakeDir(fileUploadOptions, filePath);
33
- // If callback is passed in, use the callback API, otherwise return a promise.
34
- const defaultReject = ()=>undefined;
35
- return isFunc(callback) ? moveFunc(callback, defaultReject) : new Promise(moveFunc);
36
- },
37
- size: options.size,
38
- tempFilePath: options.tempFilePath,
39
- truncated: options.truncated
40
- };
13
+ */
14
+ const moveFromBuffer = (filePath, options, fileUploadOptions) => (resolve, reject) => {
15
+ debugLog(fileUploadOptions, `Moving uploaded buffer to ${filePath}`);
16
+ saveBufferToFile(options.buffer, filePath, promiseCallback(resolve, reject));
17
+ };
18
+ export const fileFactory = (options, fileUploadOptions) => {
19
+ // see: https://github.com/richardgirges/express-fileupload/issues/14
20
+ // firefox uploads empty file in case of cache miss when f5ing page.
21
+ // resulting in unexpected behavior. if there is no file data, the file is invalid.
22
+ // if (!fileUploadOptions.useTempFiles && !options.buffer.length) return;
23
+ // Create and return file object.
24
+ return {
25
+ name: options.name,
26
+ data: options.buffer,
27
+ encoding: options.encoding,
28
+ md5: options.hash,
29
+ mimetype: options.mimetype,
30
+ mv: (filePath, callback) => {
31
+ // Define a proper move function.
32
+ const moveFunc = fileUploadOptions.useTempFiles ? moveFromTemp(filePath, options, fileUploadOptions) : moveFromBuffer(filePath, options, fileUploadOptions);
33
+ // Create a folder for a file.
34
+ checkAndMakeDir(fileUploadOptions, filePath);
35
+ // If callback is passed in, use the callback API, otherwise return a promise.
36
+ const defaultReject = () => undefined;
37
+ return isFunc(callback) ? moveFunc(callback, defaultReject) : new Promise(moveFunc);
38
+ },
39
+ size: options.size,
40
+ tempFilePath: options.tempFilePath,
41
+ truncated: options.truncated
42
+ };
41
43
  };
42
-
43
44
  //# sourceMappingURL=fileFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/fetchAPI-multipart/fileFactory.ts"],"sourcesContent":["import type { FetchAPIFileUploadOptions, FileShape } from './index.js'\n\nimport {\n checkAndMakeDir,\n debugLog,\n isFunc,\n moveFile,\n promiseCallback,\n saveBufferToFile,\n} from './utilities.js'\n\ntype MoveFile = (\n filePath: string,\n options: FileFactoryOptions,\n fileUploadOptions: FetchAPIFileUploadOptions,\n) => (resolve: () => void, reject: () => void) => void\n\n/**\n * Returns Local function that moves the file to a different location on the filesystem\n * which takes two function arguments to make it compatible w/ Promise or Callback APIs\n */\nconst moveFromTemp: MoveFile = (filePath, options, fileUploadOptions) => (resolve, reject) => {\n debugLog(fileUploadOptions, `Moving temporary file ${options.tempFilePath} to ${filePath}`)\n moveFile(options.tempFilePath, filePath, promiseCallback(resolve, reject))\n}\n\n/**\n * Returns Local function that moves the file from buffer to a different location on the filesystem\n * which takes two function arguments to make it compatible w/ Promise or Callback APIs\n */\nconst moveFromBuffer: MoveFile = (filePath, options, fileUploadOptions) => (resolve, reject) => {\n debugLog(fileUploadOptions, `Moving uploaded buffer to ${filePath}`)\n saveBufferToFile(options.buffer, filePath, promiseCallback(resolve, reject))\n}\n\ntype FileFactoryOptions = {\n buffer: Buffer\n encoding: string\n hash: Buffer | string\n mimetype: string\n name: string\n size: number\n tempFilePath: string\n truncated: boolean\n}\ntype FileFactory = (\n options: FileFactoryOptions,\n fileUploadOptions: FetchAPIFileUploadOptions,\n) => FileShape\nexport const fileFactory: FileFactory = (options, fileUploadOptions) => {\n // see: https://github.com/richardgirges/express-fileupload/issues/14\n // firefox uploads empty file in case of cache miss when f5ing page.\n // resulting in unexpected behavior. if there is no file data, the file is invalid.\n // if (!fileUploadOptions.useTempFiles && !options.buffer.length) return;\n\n // Create and return file object.\n return {\n name: options.name,\n data: options.buffer,\n encoding: options.encoding,\n md5: options.hash,\n mimetype: options.mimetype,\n mv: (filePath: string, callback) => {\n // Define a proper move function.\n const moveFunc = fileUploadOptions.useTempFiles\n ? moveFromTemp(filePath, options, fileUploadOptions)\n : moveFromBuffer(filePath, options, fileUploadOptions)\n // Create a folder for a file.\n checkAndMakeDir(fileUploadOptions, filePath)\n // If callback is passed in, use the callback API, otherwise return a promise.\n const defaultReject = () => undefined\n return isFunc(callback) ? moveFunc(callback, defaultReject) : new Promise(moveFunc)\n },\n size: options.size,\n tempFilePath: options.tempFilePath,\n truncated: options.truncated,\n }\n}\n"],"names":["checkAndMakeDir","debugLog","isFunc","moveFile","promiseCallback","saveBufferToFile","moveFromTemp","filePath","options","fileUploadOptions","resolve","reject","tempFilePath","moveFromBuffer","buffer","fileFactory","name","data","encoding","md5","hash","mimetype","mv","callback","moveFunc","useTempFiles","defaultReject","undefined","Promise","size","truncated"],"mappings":"AAEA,SACEA,eAAe,EACfC,QAAQ,EACRC,MAAM,EACNC,QAAQ,EACRC,eAAe,EACfC,gBAAgB,QACX,iBAAgB;AAQvB;;;CAGC,GACD,MAAMC,eAAyB,CAACC,UAAUC,SAASC,oBAAsB,CAACC,SAASC;QACjFV,SAASQ,mBAAmB,CAAC,sBAAsB,EAAED,QAAQI,YAAY,CAAC,IAAI,EAAEL,SAAS,CAAC;QAC1FJ,SAASK,QAAQI,YAAY,EAAEL,UAAUH,gBAAgBM,SAASC;IACpE;AAEA;;;CAGC,GACD,MAAME,iBAA2B,CAACN,UAAUC,SAASC,oBAAsB,CAACC,SAASC;QACnFV,SAASQ,mBAAmB,CAAC,0BAA0B,EAAEF,SAAS,CAAC;QACnEF,iBAAiBG,QAAQM,MAAM,EAAEP,UAAUH,gBAAgBM,SAASC;IACtE;AAgBA,OAAO,MAAMI,cAA2B,CAACP,SAASC;IAChD,qEAAqE;IACrE,oEAAoE;IACpE,mFAAmF;IACnF,yEAAyE;IAEzE,iCAAiC;IACjC,OAAO;QACLO,MAAMR,QAAQQ,IAAI;QAClBC,MAAMT,QAAQM,MAAM;QACpBI,UAAUV,QAAQU,QAAQ;QAC1BC,KAAKX,QAAQY,IAAI;QACjBC,UAAUb,QAAQa,QAAQ;QAC1BC,IAAI,CAACf,UAAkBgB;YACrB,iCAAiC;YACjC,MAAMC,WAAWf,kBAAkBgB,YAAY,GAC3CnB,aAAaC,UAAUC,SAASC,qBAChCI,eAAeN,UAAUC,SAASC;YACtC,8BAA8B;YAC9BT,gBAAgBS,mBAAmBF;YACnC,8EAA8E;YAC9E,MAAMmB,gBAAgB,IAAMC;YAC5B,OAAOzB,OAAOqB,YAAYC,SAASD,UAAUG,iBAAiB,IAAIE,QAAQJ;QAC5E;QACAK,MAAMrB,QAAQqB,IAAI;QAClBjB,cAAcJ,QAAQI,YAAY;QAClCkB,WAAWtB,QAAQsB,SAAS;IAC9B;AACF,EAAC"}
1
+ {"version":3,"file":"fileFactory.js","names":["checkAndMakeDir","debugLog","isFunc","moveFile","promiseCallback","saveBufferToFile","moveFromTemp","filePath","options","fileUploadOptions","resolve","reject","tempFilePath","moveFromBuffer","buffer","fileFactory","name","data","encoding","md5","hash","mimetype","mv","callback","moveFunc","useTempFiles","defaultReject","undefined","Promise","size","truncated"],"sources":["../../src/fetchAPI-multipart/fileFactory.ts"],"sourcesContent":["import type { FetchAPIFileUploadOptions, FileShape } from './index.js'\n\nimport {\n checkAndMakeDir,\n debugLog,\n isFunc,\n moveFile,\n promiseCallback,\n saveBufferToFile,\n} from './utilities.js'\n\ntype MoveFile = (\n filePath: string,\n options: FileFactoryOptions,\n fileUploadOptions: FetchAPIFileUploadOptions,\n) => (resolve: () => void, reject: () => void) => void\n\n/**\n * Returns Local function that moves the file to a different location on the filesystem\n * which takes two function arguments to make it compatible w/ Promise or Callback APIs\n */\nconst moveFromTemp: MoveFile = (filePath, options, fileUploadOptions) => (resolve, reject) => {\n debugLog(fileUploadOptions, `Moving temporary file ${options.tempFilePath} to ${filePath}`)\n moveFile(options.tempFilePath, filePath, promiseCallback(resolve, reject))\n}\n\n/**\n * Returns Local function that moves the file from buffer to a different location on the filesystem\n * which takes two function arguments to make it compatible w/ Promise or Callback APIs\n */\nconst moveFromBuffer: MoveFile = (filePath, options, fileUploadOptions) => (resolve, reject) => {\n debugLog(fileUploadOptions, `Moving uploaded buffer to ${filePath}`)\n saveBufferToFile(options.buffer, filePath, promiseCallback(resolve, reject))\n}\n\ntype FileFactoryOptions = {\n buffer: Buffer\n encoding: string\n hash: Buffer | string\n mimetype: string\n name: string\n size: number\n tempFilePath: string\n truncated: boolean\n}\ntype FileFactory = (\n options: FileFactoryOptions,\n fileUploadOptions: FetchAPIFileUploadOptions,\n) => FileShape\nexport const fileFactory: FileFactory = (options, fileUploadOptions) => {\n // see: https://github.com/richardgirges/express-fileupload/issues/14\n // firefox uploads empty file in case of cache miss when f5ing page.\n // resulting in unexpected behavior. if there is no file data, the file is invalid.\n // if (!fileUploadOptions.useTempFiles && !options.buffer.length) return;\n\n // Create and return file object.\n return {\n name: options.name,\n data: options.buffer,\n encoding: options.encoding,\n md5: options.hash,\n mimetype: options.mimetype,\n mv: (filePath: string, callback) => {\n // Define a proper move function.\n const moveFunc = fileUploadOptions.useTempFiles\n ? moveFromTemp(filePath, options, fileUploadOptions)\n : moveFromBuffer(filePath, options, fileUploadOptions)\n // Create a folder for a file.\n checkAndMakeDir(fileUploadOptions, filePath)\n // If callback is passed in, use the callback API, otherwise return a promise.\n const defaultReject = () => undefined\n return isFunc(callback) ? moveFunc(callback, defaultReject) : new Promise(moveFunc)\n },\n size: options.size,\n tempFilePath: options.tempFilePath,\n truncated: options.truncated,\n }\n}\n"],"mappings":"AAEA,SACEA,eAAe,EACfC,QAAQ,EACRC,MAAM,EACNC,QAAQ,EACRC,eAAe,EACfC,gBAAgB,QACX;AAQP;;;;AAIA,MAAMC,YAAA,GAAyBA,CAACC,QAAA,EAAUC,OAAA,EAASC,iBAAA,KAAsB,CAACC,OAAA,EAASC,MAAA;EACjFV,QAAA,CAASQ,iBAAA,EAAmB,yBAAyBD,OAAA,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