@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,5 @@
1
1
  'use client';
2
+
2
3
  import { jsx as _jsx } from "react/jsx-runtime";
3
4
  import { DndContext } from '@dnd-kit/core';
4
5
  import { fieldSchemaToJSON } from 'payload/shared';
@@ -6,151 +7,142 @@ import React, { useCallback, useEffect, useState } from 'react';
6
7
  import { customCollisionDetection } from './collisionDetection.js';
7
8
  import { LivePreviewContext } from './context.js';
8
9
  import { sizeReducer } from './sizeReducer.js';
9
- export const LivePreviewProvider = ({ breakpoints, children, fieldSchema, isPopupOpen, openPopupWindow, popupRef, url })=>{
10
- const [previewWindowType, setPreviewWindowType] = useState('iframe');
11
- const [appIsReady, setAppIsReady] = useState(false);
12
- const [listeningForMessages, setListeningForMessages] = useState(false);
13
- const iframeRef = React.useRef(null);
14
- const [iframeHasLoaded, setIframeHasLoaded] = useState(false);
15
- const [zoom, setZoom] = useState(1);
16
- const [position, setPosition] = useState({
17
- x: 0,
18
- y: 0
19
- });
20
- const [size, setSize] = React.useReducer(sizeReducer, {
21
- height: 0,
22
- width: 0
23
- });
24
- const [measuredDeviceSize, setMeasuredDeviceSize] = useState({
25
- height: 0,
26
- width: 0
10
+ export const LivePreviewProvider = ({
11
+ breakpoints,
12
+ children,
13
+ fieldSchema,
14
+ isPopupOpen,
15
+ openPopupWindow,
16
+ popupRef,
17
+ url
18
+ }) => {
19
+ const [previewWindowType, setPreviewWindowType] = useState('iframe');
20
+ const [appIsReady, setAppIsReady] = useState(false);
21
+ const [listeningForMessages, setListeningForMessages] = useState(false);
22
+ const iframeRef = React.useRef(null);
23
+ const [iframeHasLoaded, setIframeHasLoaded] = useState(false);
24
+ const [zoom, setZoom] = useState(1);
25
+ const [position, setPosition] = useState({
26
+ x: 0,
27
+ y: 0
28
+ });
29
+ const [size, setSize] = React.useReducer(sizeReducer, {
30
+ height: 0,
31
+ width: 0
32
+ });
33
+ const [measuredDeviceSize, setMeasuredDeviceSize] = useState({
34
+ height: 0,
35
+ width: 0
36
+ });
37
+ const [breakpoint, setBreakpoint] = React.useState('responsive');
38
+ const [fieldSchemaJSON] = useState(() => {
39
+ return fieldSchemaToJSON(fieldSchema);
40
+ });
41
+ // The toolbar needs to freely drag and drop around the page
42
+ const handleDragEnd = ev => {
43
+ // only update position if the toolbar is completely within the preview area
44
+ // otherwise reset it back to the previous position
45
+ // TODO: reset to the nearest edge of the preview area
46
+ if (ev.over && ev.over.id === 'live-preview-area') {
47
+ const newPos = {
48
+ x: position.x + ev.delta.x,
49
+ y: position.y + ev.delta.y
50
+ };
51
+ setPosition(newPos);
52
+ } else {
53
+ // reset
54
+ }
55
+ };
56
+ const setWidth = useCallback(width => {
57
+ setSize({
58
+ type: 'width',
59
+ value: width
27
60
  });
28
- const [breakpoint, setBreakpoint] = React.useState('responsive');
29
- const [fieldSchemaJSON] = useState(()=>{
30
- return fieldSchemaToJSON(fieldSchema);
61
+ }, [setSize]);
62
+ const setHeight = useCallback(height => {
63
+ setSize({
64
+ type: 'height',
65
+ value: height
31
66
  });
32
- // The toolbar needs to freely drag and drop around the page
33
- const handleDragEnd = (ev)=>{
34
- // only update position if the toolbar is completely within the preview area
35
- // otherwise reset it back to the previous position
36
- // TODO: reset to the nearest edge of the preview area
37
- if (ev.over && ev.over.id === 'live-preview-area') {
38
- const newPos = {
39
- x: position.x + ev.delta.x,
40
- y: position.y + ev.delta.y
41
- };
42
- setPosition(newPos);
43
- } else {
44
- // reset
45
- }
46
- };
47
- const setWidth = useCallback((width)=>{
48
- setSize({
49
- type: 'width',
50
- value: width
51
- });
52
- }, [
53
- setSize
54
- ]);
55
- const setHeight = useCallback((height)=>{
56
- setSize({
57
- type: 'height',
58
- value: height
59
- });
60
- }, [
61
- setSize
62
- ]);
63
- // explicitly set new width and height when as new breakpoints are selected
64
- // exclude `custom` breakpoint as it is handled by the `setWidth` and `setHeight` directly
65
- useEffect(()=>{
66
- const foundBreakpoint = breakpoints?.find((bp)=>bp.name === breakpoint);
67
- if (foundBreakpoint && breakpoint !== 'responsive' && breakpoint !== 'custom' && typeof foundBreakpoint?.width === 'number' && typeof foundBreakpoint?.height === 'number') {
68
- setSize({
69
- type: 'reset',
70
- value: {
71
- height: foundBreakpoint.height,
72
- width: foundBreakpoint.width
73
- }
74
- });
67
+ }, [setSize]);
68
+ // explicitly set new width and height when as new breakpoints are selected
69
+ // exclude `custom` breakpoint as it is handled by the `setWidth` and `setHeight` directly
70
+ useEffect(() => {
71
+ const foundBreakpoint = breakpoints?.find(bp => bp.name === breakpoint);
72
+ if (foundBreakpoint && breakpoint !== 'responsive' && breakpoint !== 'custom' && typeof foundBreakpoint?.width === 'number' && typeof foundBreakpoint?.height === 'number') {
73
+ setSize({
74
+ type: 'reset',
75
+ value: {
76
+ height: foundBreakpoint.height,
77
+ width: foundBreakpoint.width
75
78
  }
76
- }, [
77
- breakpoint,
78
- breakpoints
79
- ]);
80
- // Receive the `ready` message from the popup window
81
- // This indicates that the app is ready to receive `window.postMessage` events
82
- // This is also the only cross-origin way of detecting when a popup window has loaded
83
- // Unlike iframe elements which have an `onLoad` handler, there is no way to access `window.open` on popups
84
- useEffect(()=>{
85
- const handleMessage = (event)=>{
86
- if (url?.startsWith(event.origin) && event.data && typeof event.data === 'object' && event.data.type === 'payload-live-preview') {
87
- if (event.data.ready) {
88
- setAppIsReady(true);
89
- }
90
- }
91
- };
92
- window.addEventListener('message', handleMessage);
93
- setListeningForMessages(true);
94
- return ()=>{
95
- window.removeEventListener('message', handleMessage);
96
- };
97
- }, [
98
- url,
99
- listeningForMessages
100
- ]);
101
- const handleWindowChange = useCallback((type)=>{
102
- setAppIsReady(false);
103
- setPreviewWindowType(type);
104
- if (type === 'popup') openPopupWindow();
105
- }, [
106
- openPopupWindow
107
- ]);
108
- // when the user closes the popup window, switch back to the iframe
109
- // the `usePopupWindow` reports the `isPopupOpen` state for us to use here
110
- useEffect(()=>{
111
- const newPreviewWindowType = isPopupOpen ? 'popup' : 'iframe';
112
- if (newPreviewWindowType !== previewWindowType) {
113
- handleWindowChange('iframe');
79
+ });
80
+ }
81
+ }, [breakpoint, breakpoints]);
82
+ // Receive the `ready` message from the popup window
83
+ // This indicates that the app is ready to receive `window.postMessage` events
84
+ // This is also the only cross-origin way of detecting when a popup window has loaded
85
+ // Unlike iframe elements which have an `onLoad` handler, there is no way to access `window.open` on popups
86
+ useEffect(() => {
87
+ const handleMessage = event => {
88
+ if (url?.startsWith(event.origin) && event.data && typeof event.data === 'object' && event.data.type === 'payload-live-preview') {
89
+ if (event.data.ready) {
90
+ setAppIsReady(true);
114
91
  }
115
- }, [
116
- previewWindowType,
117
- isPopupOpen,
118
- handleWindowChange
119
- ]);
120
- return /*#__PURE__*/ _jsx(LivePreviewContext.Provider, {
121
- value: {
122
- appIsReady,
123
- breakpoint,
124
- breakpoints,
125
- fieldSchemaJSON,
126
- iframeHasLoaded,
127
- iframeRef,
128
- isPopupOpen,
129
- measuredDeviceSize,
130
- openPopupWindow,
131
- popupRef,
132
- previewWindowType,
133
- setAppIsReady,
134
- setBreakpoint,
135
- setHeight,
136
- setIframeHasLoaded,
137
- setMeasuredDeviceSize,
138
- setPreviewWindowType: handleWindowChange,
139
- setSize,
140
- setToolbarPosition: setPosition,
141
- setWidth,
142
- setZoom,
143
- size,
144
- toolbarPosition: position,
145
- url,
146
- zoom
147
- },
148
- children: /*#__PURE__*/ _jsx(DndContext, {
149
- collisionDetection: customCollisionDetection,
150
- onDragEnd: handleDragEnd,
151
- children: listeningForMessages && children
152
- })
153
- });
92
+ }
93
+ };
94
+ window.addEventListener('message', handleMessage);
95
+ setListeningForMessages(true);
96
+ return () => {
97
+ window.removeEventListener('message', handleMessage);
98
+ };
99
+ }, [url, listeningForMessages]);
100
+ const handleWindowChange = useCallback(type => {
101
+ setAppIsReady(false);
102
+ setPreviewWindowType(type);
103
+ if (type === 'popup') openPopupWindow();
104
+ }, [openPopupWindow]);
105
+ // when the user closes the popup window, switch back to the iframe
106
+ // the `usePopupWindow` reports the `isPopupOpen` state for us to use here
107
+ useEffect(() => {
108
+ const newPreviewWindowType = isPopupOpen ? 'popup' : 'iframe';
109
+ if (newPreviewWindowType !== previewWindowType) {
110
+ handleWindowChange('iframe');
111
+ }
112
+ }, [previewWindowType, isPopupOpen, handleWindowChange]);
113
+ return /*#__PURE__*/_jsx(LivePreviewContext.Provider, {
114
+ value: {
115
+ appIsReady,
116
+ breakpoint,
117
+ breakpoints,
118
+ fieldSchemaJSON,
119
+ iframeHasLoaded,
120
+ iframeRef,
121
+ isPopupOpen,
122
+ measuredDeviceSize,
123
+ openPopupWindow,
124
+ popupRef,
125
+ previewWindowType,
126
+ setAppIsReady,
127
+ setBreakpoint,
128
+ setHeight,
129
+ setIframeHasLoaded,
130
+ setMeasuredDeviceSize,
131
+ setPreviewWindowType: handleWindowChange,
132
+ setSize,
133
+ setToolbarPosition: setPosition,
134
+ setWidth,
135
+ setZoom,
136
+ size,
137
+ toolbarPosition: position,
138
+ url,
139
+ zoom
140
+ },
141
+ children: /*#__PURE__*/_jsx(DndContext, {
142
+ collisionDetection: customCollisionDetection,
143
+ onDragEnd: handleDragEnd,
144
+ children: listeningForMessages && children
145
+ })
146
+ });
154
147
  };
155
-
156
148
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/views/LivePreview/Context/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientField, LivePreviewConfig } from 'payload'\n\nimport { DndContext } from '@dnd-kit/core'\nimport { fieldSchemaToJSON } from 'payload/shared'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { usePopupWindow } from '../usePopupWindow.js'\n\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 fieldSchema: ClientField[]\n isPopupOpen?: boolean\n openPopupWindow?: ReturnType<typeof usePopupWindow>['openPopupWindow']\n popupRef?: React.RefObject<Window>\n url?: string\n}\n\nexport const LivePreviewProvider: React.FC<LivePreviewProviderProps> = ({\n breakpoints,\n children,\n fieldSchema,\n isPopupOpen,\n openPopupWindow,\n popupRef,\n url,\n}) => {\n const [previewWindowType, setPreviewWindowType] = useState<'iframe' | 'popup'>('iframe')\n\n const [appIsReady, setAppIsReady] = useState(false)\n const [listeningForMessages, setListeningForMessages] = useState(false)\n\n const iframeRef = React.useRef<HTMLIFrameElement>(null)\n\n const [iframeHasLoaded, setIframeHasLoaded] = useState(false)\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 const [fieldSchemaJSON] = useState(() => {\n return fieldSchemaToJSON(fieldSchema)\n })\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 // 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 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 }\n }\n }\n\n window.addEventListener('message', handleMessage)\n\n setListeningForMessages(true)\n\n return () => {\n window.removeEventListener('message', handleMessage)\n }\n }, [url, listeningForMessages])\n\n const handleWindowChange = useCallback(\n (type: 'iframe' | 'popup') => {\n setAppIsReady(false)\n setPreviewWindowType(type)\n if (type === 'popup') openPopupWindow()\n },\n [openPopupWindow],\n )\n\n // when the user closes the popup window, switch back to the iframe\n // the `usePopupWindow` reports the `isPopupOpen` state for us to use here\n useEffect(() => {\n const newPreviewWindowType = isPopupOpen ? 'popup' : 'iframe'\n\n if (newPreviewWindowType !== previewWindowType) {\n handleWindowChange('iframe')\n }\n }, [previewWindowType, isPopupOpen, handleWindowChange])\n\n return (\n <LivePreviewContext.Provider\n value={{\n appIsReady,\n breakpoint,\n breakpoints,\n fieldSchemaJSON,\n iframeHasLoaded,\n iframeRef,\n isPopupOpen,\n measuredDeviceSize,\n openPopupWindow,\n popupRef,\n previewWindowType,\n setAppIsReady,\n setBreakpoint,\n setHeight,\n setIframeHasLoaded,\n setMeasuredDeviceSize,\n setPreviewWindowType: handleWindowChange,\n setSize,\n setToolbarPosition: setPosition,\n setWidth,\n setZoom,\n size,\n toolbarPosition: position,\n url,\n zoom,\n }}\n >\n <DndContext collisionDetection={customCollisionDetection} onDragEnd={handleDragEnd}>\n {listeningForMessages && children}\n </DndContext>\n </LivePreviewContext.Provider>\n )\n}\n"],"names":["DndContext","fieldSchemaToJSON","React","useCallback","useEffect","useState","customCollisionDetection","LivePreviewContext","sizeReducer","LivePreviewProvider","breakpoints","children","fieldSchema","isPopupOpen","openPopupWindow","popupRef","url","previewWindowType","setPreviewWindowType","appIsReady","setAppIsReady","listeningForMessages","setListeningForMessages","iframeRef","useRef","iframeHasLoaded","setIframeHasLoaded","zoom","setZoom","position","setPosition","x","y","size","setSize","useReducer","height","width","measuredDeviceSize","setMeasuredDeviceSize","breakpoint","setBreakpoint","fieldSchemaJSON","handleDragEnd","ev","over","id","newPos","delta","setWidth","type","value","setHeight","foundBreakpoint","find","bp","name","handleMessage","event","startsWith","origin","data","ready","window","addEventListener","removeEventListener","handleWindowChange","newPreviewWindowType","Provider","setToolbarPosition","toolbarPosition","collisionDetection","onDragEnd"],"mappings":"AAAA;;AAGA,SAASA,UAAU,QAAQ,gBAAe;AAC1C,SAASC,iBAAiB,QAAQ,iBA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+C;QACC9B,cAAc;QACdF,qBAAqBgC;QACrB,IAAIA,SAAS,SAASpC;IACxB,GACA;QAACA;KAAgB;IAGnB,mEAAmE;IACnE,0EAA0E;IAC1EV,UAAU;QACR,MAAM+D,uBAAuBtD,cAAc,UAAU;QAErD,IAAIsD,yBAAyBlD,mBAAmB;YAC9CiD,mBAAmB;QACrB;IACF,GAAG;QAACjD;QAAmBJ;QAAaqD;KAAmB;IAEvD,qBACE,KAAC3D,mBAAmB6D,QAAQ;QAC1BjB,OAAO;YACLhC;YACAqB;YACA9B;YACAgC;YACAjB;YACAF;YACAV;YACAyB;YACAxB;YACAC;YACAE;YACAG;YACAqB;YACAW;YACA1B;YACAa;YACArB,sBAAsBgD;YACtBhC;YACAmC,oBAAoBvC;YACpBmB;YACArB;YACAK;YACAqC,iBAAiBzC;YACjBb;YACAW;QACF;kBAEA,cAAA,KAAC3B;YAAWuE,oBAAoBjE;YAA0BkE,WAAW7B;sBAClEtB,wBAAwBV;;;AAIjC,EAAC"}
1
+ {"version":3,"file":"index.js","names":["DndContext","fieldSchemaToJSON","React","useCallback","useEffect","useState","customCollisionDetection","LivePreviewContext","sizeReducer","LivePreviewProvider","breakpoints","children","fieldSchema","isPopupOpen","openPopupWindow","popupRef","url","previewWindowType","setPreviewWindowType","appIsReady","setAppIsReady","listeningForMessages","setListeningForMessages","iframeRef","useRef","iframeHasLoaded","setIframeHasLoaded","zoom","setZoom","position","setPosition","x","y","size","setSize","useReducer","height","width","measuredDeviceSize","setMeasuredDeviceSize","breakpoint","setBreakpoint","fieldSchemaJSON","handleDragEnd","ev","over","id","newPos","delta","setWidth","type","value","setHeight","foundBreakpoint","find","bp","name","handleMessage","event","startsWith","origin","data","ready","window","addEventListener","removeEventListener","handleWindowChange","newPreviewWindowType","_jsx","Provider","setToolbarPosition","toolbarPosition","collisionDetection","onDragEnd"],"sources":["../../../../src/views/LivePreview/Context/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientField, LivePreviewConfig } from 'payload'\n\nimport { DndContext } from '@dnd-kit/core'\nimport { fieldSchemaToJSON } from 'payload/shared'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { usePopupWindow } from '../usePopupWindow.js'\n\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 fieldSchema: ClientField[]\n isPopupOpen?: boolean\n openPopupWindow?: ReturnType<typeof usePopupWindow>['openPopupWindow']\n popupRef?: React.RefObject<Window>\n url?: string\n}\n\nexport const LivePreviewProvider: React.FC<LivePreviewProviderProps> = ({\n breakpoints,\n children,\n fieldSchema,\n isPopupOpen,\n openPopupWindow,\n popupRef,\n url,\n}) => {\n const [previewWindowType, setPreviewWindowType] = useState<'iframe' | 'popup'>('iframe')\n\n const [appIsReady, setAppIsReady] = useState(false)\n const [listeningForMessages, setListeningForMessages] = useState(false)\n\n const iframeRef = React.useRef<HTMLIFrameElement>(null)\n\n const [iframeHasLoaded, setIframeHasLoaded] = useState(false)\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 const [fieldSchemaJSON] = useState(() => {\n return fieldSchemaToJSON(fieldSchema)\n })\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 // 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 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 }\n }\n }\n\n window.addEventListener('message', handleMessage)\n\n setListeningForMessages(true)\n\n return () => {\n window.removeEventListener('message', handleMessage)\n }\n }, [url, listeningForMessages])\n\n const handleWindowChange = useCallback(\n (type: 'iframe' | 'popup') => {\n setAppIsReady(false)\n setPreviewWindowType(type)\n if (type === 'popup') openPopupWindow()\n },\n [openPopupWindow],\n )\n\n // when the user closes the popup window, switch back to the iframe\n // the `usePopupWindow` reports the `isPopupOpen` state for us to use here\n useEffect(() => {\n const newPreviewWindowType = isPopupOpen ? 'popup' : 'iframe'\n\n if (newPreviewWindowType !== previewWindowType) {\n handleWindowChange('iframe')\n }\n }, [previewWindowType, isPopupOpen, handleWindowChange])\n\n return (\n <LivePreviewContext.Provider\n value={{\n appIsReady,\n breakpoint,\n breakpoints,\n fieldSchemaJSON,\n iframeHasLoaded,\n iframeRef,\n isPopupOpen,\n measuredDeviceSize,\n openPopupWindow,\n popupRef,\n previewWindowType,\n setAppIsReady,\n setBreakpoint,\n setHeight,\n setIframeHasLoaded,\n setMeasuredDeviceSize,\n setPreviewWindowType: handleWindowChange,\n setSize,\n setToolbarPosition: setPosition,\n setWidth,\n setZoom,\n size,\n toolbarPosition: position,\n url,\n zoom,\n }}\n >\n <DndContext collisionDetection={customCollisionDetection} onDragEnd={handleDragEnd}>\n {listeningForMessages && children}\n </DndContext>\n </LivePreviewContext.Provider>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SAASA,UAAU,QAAQ;AAC3B,SAASC,iBAAiB,QAAQ;AAClC,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ;AAIxD,SAASC,wBAAwB,QAAQ;AACzC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,WAAW,QAAQ;AAiB5B,OAAO,MAAMC,mBAAA,GAA0DA,CAAC;EACtEC,WAAW;EACXC,QAAQ;EACRC,WAAW;EACXC,WAAW;EACXC,eAAe;EACfC,QAAQ;EACRC;AAAG,CACJ;EACC,MAAM,CAACC,iBAAA,EAAmBC,oBAAA,CAAqB,GAAGb,QAAA,CAA6B;EAE/E,MAAM,CAACc,UAAA,EAAYC,aAAA,CAAc,GAAGf,QAAA,CAAS;EAC7C,MAAM,CAACgB,oBAAA,EAAsBC,uBAAA,CAAwB,GAAGjB,QAAA,CAAS;EAEjE,MAAMkB,SAAA,GAAYrB,KAAA,CAAMsB,MAAM,CAAoB;EAElD,MAAM,CAACC,eAAA,EAAiBC,kBAAA,CAAmB,GAAGrB,QAAA,CAAS;EAEvD,MAAM,CAACsB,IAAA,EAAMC,OAAA,CAAQ,GAAGvB,QAAA,CAAS;EAEjC,MAAM,CAACwB,QAAA,EAAUC,WAAA,CAAY,GAAGzB,QAAA,CAAS;IAAE0B,CA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,CAACjD,iBAAA,EAAmBJ,WAAA,EAAaqD,kBAAA,CAAmB;EAEvD,oBACEE,IAAA,CAAC7D,kBAAA,CAAmB8D,QAAQ;IAC1BlB,KAAA,EAAO;MACLhC,UAAA;MACAqB,UAAA;MACA9B,WAAA;MACAgC,eAAA;MACAjB,eAAA;MACAF,SAAA;MACAV,WAAA;MACAyB,kBAAA;MACAxB,eAAA;MACAC,QAAA;MACAE,iBAAA;MACAG,aAAA;MACAqB,aAAA;MACAW,SAAA;MACA1B,kBAAA;MACAa,qBAAA;MACArB,oBAAA,EAAsBgD,kBAAA;MACtBhC,OAAA;MACAoC,kBAAA,EAAoBxC,WAAA;MACpBmB,QAAA;MACArB,OAAA;MACAK,IAAA;MACAsC,eAAA,EAAiB1C,QAAA;MACjBb,GAAA;MACAW;IACF;cAEA,aAAAyC,IAAA,CAACpE,UAAA;MAAWwE,kBAAA,EAAoBlE,wBAAA;MAA0BmE,SAAA,EAAW9B,aAAA;gBAClEtB,oBAAA,IAAwBV;;;AAIjC","ignoreList":[]}
@@ -8,24 +8,23 @@
8
8
  // return { ...state, ...(action?.value || {}) }
9
9
  // }
10
10
  // },
11
- export const sizeReducer = (state, action)=>{
12
- switch(action.type){
13
- case 'width':
14
- return {
15
- ...state,
16
- width: action.value
17
- };
18
- case 'height':
19
- return {
20
- ...state,
21
- height: action.value
22
- };
23
- default:
24
- return {
25
- ...state,
26
- ...action?.value || {}
27
- };
28
- }
11
+ export const sizeReducer = (state, action) => {
12
+ switch (action.type) {
13
+ case 'width':
14
+ return {
15
+ ...state,
16
+ width: action.value
17
+ };
18
+ case 'height':
19
+ return {
20
+ ...state,
21
+ height: action.value
22
+ };
23
+ default:
24
+ return {
25
+ ...state,
26
+ ...(action?.value || {})
27
+ };
28
+ }
29
29
  };
30
-
31
30
  //# sourceMappingURL=sizeReducer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/views/LivePreview/Context/sizeReducer.ts"],"sourcesContent":["// export const sizeReducer: (state, action) => {\n// switch (action.type) {\n// case 'width':\n// return { ...state, width: action.value }\n// case 'height':\n// return { ...state, height: action.value }\n// default:\n// return { ...state, ...(action?.value || {}) }\n// }\n// },\n\ntype SizeReducerState = {\n height: number\n width: number\n}\n\nexport type SizeReducerAction =\n | {\n type: 'height' | 'width'\n value: number\n }\n | {\n type: 'reset'\n value: {\n height: number\n width: number\n }\n }\n\nexport const sizeReducer = (state: SizeReducerState, action: SizeReducerAction) => {\n switch (action.type) {\n case 'width':\n return { ...state, width: action.value }\n case 'height':\n return { ...state, height: action.value }\n default:\n return { ...state, ...(action?.value || {}) }\n }\n}\n"],"names":["sizeReducer","state","action","type","width","value","height"],"mappings":"AAAA,iDAAiD;AACjD,2BAA2B;AAC3B,oBAAoB;AACpB,iDAAiD;AACjD,qBAAqB;AACrB,kDAAkD;AAClD,eAAe;AACf,sDAAsD;AACtD,MAAM;AACN,KAAK;AAoBL,OAAO,MAAMA,cAAc,CAACC,OAAyBC;IACnD,OAAQA,OAAOC,IAAI;QACjB,KAAK;YACH,OAAO;gBAAE,GAAGF,KAAK;gBAAEG,OAAOF,OAAOG,KAAK;YAAC;QACzC,KAAK;YACH,OAAO;gBAAE,GAAGJ,KAAK;gBAAEK,QAAQJ,OAAOG,KAAK;YAAC;QAC1C;YACE,OAAO;gBAAE,GAAGJ,KAAK;gBAAE,GAAIC,QAAQG,SAAS,CAAC,CAAC;YAAE;IAChD;AACF,EAAC"}
1
+ {"version":3,"file":"sizeReducer.js","names":["sizeReducer","state","action","type","width","value","height"],"sources":["../../../../src/views/LivePreview/Context/sizeReducer.ts"],"sourcesContent":["// export const sizeReducer: (state, action) => {\n// switch (action.type) {\n// case 'width':\n// return { ...state, width: action.value }\n// case 'height':\n// return { ...state, height: action.value }\n// default:\n// return { ...state, ...(action?.value || {}) }\n// }\n// },\n\ntype SizeReducerState = {\n height: number\n width: number\n}\n\nexport type SizeReducerAction =\n | {\n type: 'height' | 'width'\n value: number\n }\n | {\n type: 'reset'\n value: {\n height: number\n width: number\n }\n }\n\nexport const sizeReducer = (state: SizeReducerState, action: SizeReducerAction) => {\n switch (action.type) {\n case 'width':\n return { ...state, width: action.value }\n case 'height':\n return { ...state, height: action.value }\n default:\n return { ...state, ...(action?.value || {}) }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAoBA,OAAO,MAAMA,WAAA,GAAcA,CAACC,KAAA,EAAyBC,MAAA;EACnD,QAAQA,MAAA,CAAOC,IAAI;IACjB,KAAK;MACH,OAAO;QAAE,GAAGF,KAAK;QAAEG,KAAA,EAAOF,MAAA,CAAOG;MAAM;IACzC,KAAK;MACH,OAAO;QAAE,GAAGJ,KAAK;QAAEK,MAAA,EAAQJ,MAAA,CAAOG;MAAM;IAC1C;MACE,OAAO;QAAE,GAAGJ,KAAK;QAAE,IAAIC,MAAA,EAAQG,KAAA,IAAS,CAAC,CAAC;MAAE;EAChD;AACF","ignoreList":[]}
@@ -1,81 +1,88 @@
1
1
  'use client';
2
+
2
3
  import { jsx as _jsx } from "react/jsx-runtime";
3
4
  import { useResize } from '@payloadcms/ui';
4
5
  import React, { useEffect } from 'react';
5
6
  import { useLivePreviewContext } from '../Context/context.js';
6
- export const DeviceContainer = (props)=>{
7
- const { children } = props;
8
- const deviceFrameRef = React.useRef(null);
9
- const outerFrameRef = React.useRef(null);
10
- const { breakpoint, setMeasuredDeviceSize, size: desiredSize, zoom } = useLivePreviewContext();
11
- // Keep an accurate measurement of the actual device size as it is truly rendered
12
- // This is helpful when `sizes` are non-number units like percentages, etc.
13
- const { size: measuredDeviceSize } = useResize(deviceFrameRef.current);
14
- const { size: outerFrameSize } = useResize(outerFrameRef.current);
15
- let deviceIsLargerThanFrame = false;
16
- // Sync the measured device size with the context so that other components can use it
17
- // This happens from the bottom up so that as this component mounts and unmounts,
18
- // its size is freshly populated again upon re-mounting, i.e. going from iframe->popup->iframe
19
- useEffect(()=>{
20
- if (measuredDeviceSize) {
21
- setMeasuredDeviceSize(measuredDeviceSize);
7
+ export const DeviceContainer = props => {
8
+ const {
9
+ children
10
+ } = props;
11
+ const deviceFrameRef = React.useRef(null);
12
+ const outerFrameRef = React.useRef(null);
13
+ const {
14
+ breakpoint,
15
+ setMeasuredDeviceSize,
16
+ size: desiredSize,
17
+ zoom
18
+ } = useLivePreviewContext();
19
+ // Keep an accurate measurement of the actual device size as it is truly rendered
20
+ // This is helpful when `sizes` are non-number units like percentages, etc.
21
+ const {
22
+ size: measuredDeviceSize
23
+ } = useResize(deviceFrameRef.current);
24
+ const {
25
+ size: outerFrameSize
26
+ } = useResize(outerFrameRef.current);
27
+ let deviceIsLargerThanFrame = false;
28
+ // Sync the measured device size with the context so that other components can use it
29
+ // This happens from the bottom up so that as this component mounts and unmounts,
30
+ // its size is freshly populated again upon re-mounting, i.e. going from iframe->popup->iframe
31
+ useEffect(() => {
32
+ if (measuredDeviceSize) {
33
+ setMeasuredDeviceSize(measuredDeviceSize);
34
+ }
35
+ }, [measuredDeviceSize, setMeasuredDeviceSize]);
36
+ let x = '0';
37
+ let margin = '0';
38
+ if (breakpoint && breakpoint !== 'responsive') {
39
+ x = '-50%';
40
+ if (typeof zoom === 'number' && typeof desiredSize.width === 'number' && typeof desiredSize.height === 'number' && typeof measuredDeviceSize.width === 'number' && typeof measuredDeviceSize.height === 'number') {
41
+ margin = '0 auto';
42
+ const scaledDesiredWidth = desiredSize.width / zoom;
43
+ const scaledDeviceWidth = measuredDeviceSize.width * zoom;
44
+ const scaledDeviceDifferencePixels = scaledDesiredWidth - desiredSize.width;
45
+ deviceIsLargerThanFrame = scaledDeviceWidth > outerFrameSize.width;
46
+ if (deviceIsLargerThanFrame) {
47
+ if (zoom > 1) {
48
+ const differenceFromDeviceToFrame = measuredDeviceSize.width - outerFrameSize.width;
49
+ if (differenceFromDeviceToFrame < 0) x = `${differenceFromDeviceToFrame / 2}px`;else x = '0';
50
+ } else {
51
+ x = '0';
22
52
  }
23
- }, [
24
- measuredDeviceSize,
25
- setMeasuredDeviceSize
26
- ]);
27
- let x = '0';
28
- let margin = '0';
29
- if (breakpoint && breakpoint !== 'responsive') {
30
- x = '-50%';
31
- if (typeof zoom === 'number' && typeof desiredSize.width === 'number' && typeof desiredSize.height === 'number' && typeof measuredDeviceSize.width === 'number' && typeof measuredDeviceSize.height === 'number') {
32
- margin = '0 auto';
33
- const scaledDesiredWidth = desiredSize.width / zoom;
34
- const scaledDeviceWidth = measuredDeviceSize.width * zoom;
35
- const scaledDeviceDifferencePixels = scaledDesiredWidth - desiredSize.width;
36
- deviceIsLargerThanFrame = scaledDeviceWidth > outerFrameSize.width;
37
- if (deviceIsLargerThanFrame) {
38
- if (zoom > 1) {
39
- const differenceFromDeviceToFrame = measuredDeviceSize.width - outerFrameSize.width;
40
- if (differenceFromDeviceToFrame < 0) x = `${differenceFromDeviceToFrame / 2}px`;
41
- else x = '0';
42
- } else {
43
- x = '0';
44
- }
45
- } else {
46
- if (zoom >= 1) {
47
- x = `${scaledDeviceDifferencePixels / 2}px`;
48
- } else {
49
- const differenceFromDeviceToFrame = outerFrameSize.width - scaledDeviceWidth;
50
- x = `${differenceFromDeviceToFrame / 2}px`;
51
- margin = '0';
52
- }
53
- }
53
+ } else {
54
+ if (zoom >= 1) {
55
+ x = `${scaledDeviceDifferencePixels / 2}px`;
56
+ } else {
57
+ const differenceFromDeviceToFrame_0 = outerFrameSize.width - scaledDeviceWidth;
58
+ x = `${differenceFromDeviceToFrame_0 / 2}px`;
59
+ margin = '0';
54
60
  }
61
+ }
55
62
  }
56
- let width = zoom ? `${100 / zoom}%` : '100%';
57
- let height = zoom ? `${100 / zoom}%` : '100%';
58
- if (breakpoint !== 'responsive') {
59
- width = `${desiredSize?.width / (typeof zoom === 'number' ? zoom : 1)}px`;
60
- height = `${desiredSize?.height / (typeof zoom === 'number' ? zoom : 1)}px`;
61
- }
62
- return /*#__PURE__*/ _jsx("div", {
63
- ref: outerFrameRef,
64
- style: {
65
- height: '100%',
66
- width: '100%'
67
- },
68
- children: /*#__PURE__*/ _jsx("div", {
69
- ref: deviceFrameRef,
70
- style: {
71
- height,
72
- margin,
73
- transform: `translate3d(${x}, 0, 0)`,
74
- width
75
- },
76
- children: children
77
- })
78
- });
63
+ }
64
+ let width = zoom ? `${100 / zoom}%` : '100%';
65
+ let height = zoom ? `${100 / zoom}%` : '100%';
66
+ if (breakpoint !== 'responsive') {
67
+ width = `${desiredSize?.width / (typeof zoom === 'number' ? zoom : 1)}px`;
68
+ height = `${desiredSize?.height / (typeof zoom === 'number' ? zoom : 1)}px`;
69
+ }
70
+ return /*#__PURE__*/_jsx("div", {
71
+ ref: outerFrameRef,
72
+ style: {
73
+ height: '100%',
74
+ width: '100%'
75
+ },
76
+ children: /*#__PURE__*/_jsx("div", {
77
+ ref: deviceFrameRef,
78
+ style: {
79
+ height,
80
+ margin,
81
+ transform: `translate3d(${x}, 0, 0)`,
82
+ width
83
+ },
84
+ children: children
85
+ })
86
+ });
79
87
  };
80
-
81
88
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/views/LivePreview/Device/index.tsx"],"sourcesContent":["'use client'\nimport { useResize } from '@payloadcms/ui'\nimport React, { useEffect } from 'react'\n\nimport { useLivePreviewContext } from '../Context/context.js'\n\nexport const DeviceContainer: React.FC<{\n children: React.ReactNode\n}> = (props) => {\n const { children } = props\n\n const deviceFrameRef = React.useRef<HTMLDivElement>(null)\n const outerFrameRef = React.useRef<HTMLDivElement>(null)\n\n const { breakpoint, setMeasuredDeviceSize, size: desiredSize, zoom } = useLivePreviewContext()\n\n // Keep an accurate measurement of the actual device size as it is truly rendered\n // This is helpful when `sizes` are non-number units like percentages, etc.\n const { size: measuredDeviceSize } = useResize(deviceFrameRef.current)\n const { size: outerFrameSize } = useResize(outerFrameRef.current)\n\n let deviceIsLargerThanFrame: boolean = false\n\n // Sync the measured device size with the context so that other components can use it\n // This happens from the bottom up so that as this component mounts and unmounts,\n // its size is freshly populated again upon re-mounting, i.e. going from iframe->popup->iframe\n useEffect(() => {\n if (measuredDeviceSize) {\n setMeasuredDeviceSize(measuredDeviceSize)\n }\n }, [measuredDeviceSize, setMeasuredDeviceSize])\n\n let x = '0'\n let margin = '0'\n\n if (breakpoint && breakpoint !== 'responsive') {\n x = '-50%'\n\n if (\n typeof zoom === 'number' &&\n typeof desiredSize.width === 'number' &&\n typeof desiredSize.height === 'number' &&\n typeof measuredDeviceSize.width === 'number' &&\n typeof measuredDeviceSize.height === 'number'\n ) {\n margin = '0 auto'\n const scaledDesiredWidth = desiredSize.width / zoom\n const scaledDeviceWidth = measuredDeviceSize.width * zoom\n const scaledDeviceDifferencePixels = scaledDesiredWidth - desiredSize.width\n deviceIsLargerThanFrame = scaledDeviceWidth > outerFrameSize.width\n\n if (deviceIsLargerThanFrame) {\n if (zoom > 1) {\n const differenceFromDeviceToFrame = measuredDeviceSize.width - outerFrameSize.width\n if (differenceFromDeviceToFrame < 0) x = `${differenceFromDeviceToFrame / 2}px`\n else x = '0'\n } else {\n x = '0'\n }\n } else {\n if (zoom >= 1) {\n x = `${scaledDeviceDifferencePixels / 2}px`\n } else {\n const differenceFromDeviceToFrame = outerFrameSize.width - scaledDeviceWidth\n x = `${differenceFromDeviceToFrame / 2}px`\n margin = '0'\n }\n }\n }\n }\n\n let width = zoom ? `${100 / zoom}%` : '100%'\n let height = zoom ? `${100 / zoom}%` : '100%'\n\n if (breakpoint !== 'responsive') {\n width = `${desiredSize?.width / (typeof zoom === 'number' ? zoom : 1)}px`\n height = `${desiredSize?.height / (typeof zoom === 'number' ? zoom : 1)}px`\n }\n\n return (\n <div\n ref={outerFrameRef}\n style={{\n height: '100%',\n width: '100%',\n }}\n >\n <div\n ref={deviceFrameRef}\n style={{\n height,\n margin,\n transform: `translate3d(${x}, 0, 0)`,\n width,\n }}\n >\n {children}\n </div>\n </div>\n )\n}\n"],"names":["useResize","React","useEffect","useLivePreviewContext","DeviceContainer","props","children","deviceFrameRef","useRef","outerFrameRef","breakpoint","setMeasuredDeviceSize","size","desiredSize","zoom","measuredDeviceSize","current","outerFrameSize","deviceIsLargerThanFrame","x","margin","width","height","scaledDesiredWidth","scaledDeviceWidth","scaledDeviceDifferencePixels","differenceFromDeviceToFrame","div","ref","style","transform"],"mappings":"AAAA;;AACA,SAASA,SAAS,QAAQ,iBAAgB;AAC1C,OAAOC,SAASC,SAAS,QAAQ,QAAO;AAExC,SAASC,qBAAqB,QAAQ,wBAAuB;AAE7D,OAAO,MAAMC,kBAER,CAACC;IACJ,MAAM,EAAEC,QAAQ,EAAE,GAAGD;IAErB,MAAME,iBAAiBN,MAAMO,MAAM,CAAiB;IACpD,MAAMC,gBAAgBR,MAAMO,MAAM,CAAiB;IAEnD,MAAM,EAAEE,UAAU,EAAEC,qBAAqB,EAAEC,MAAMC,WAAW,EAAEC,IAAI,EAAE,GAAGX;IAEvE,iFAAiF;IACjF,2EAA2E;IAC3E,MAAM,EAAES,MAAMG,kBAAkB,EAAE,GAAGf,UAAUO,eAAeS,OAAO;IACrE,MAAM,EAAEJ,MAAMK,cAAc,EAAE,GAAGjB,UAAUS,cAAcO,OAAO;IAEhE,IAAIE,0BAAmC;IAEvC,qFAAqF;IACrF,iFAAiF;IACjF,8FAA8F;IAC9FhB,UAAU;QACR,IAAIa,oBAAoB;YACtBJ,sBAAsBI;QACxB;IACF,GAAG;QAACA;QAAoBJ;KAAsB;IAE9C,IAAIQ,IAAI;IACR,IAAIC,SAAS;IAEb,IAAIV,cAAcA,eAAe,cAAc;QAC7CS,IAAI;QAEJ,IACE,OAAOL,SAAS,YAChB,OAAOD,YAAYQ,KAAK,KAAK,YAC7B,OAAOR,YAAYS,MAAM,KAAK,YAC9B,OAAOP,mBAAmBM,KAAK,KAAK,YACpC,OAAON,mBAAmBO,MAAM,KAAK,UACrC;YACAF,SAAS;YACT,MAAMG,qBAAqBV,YAAYQ,KAAK,GAAGP;YAC/C,MAAMU,oBAAoBT,mBAAmBM,KAAK,GAAGP;YACrD,MAAMW,+BAA+BF,qBAAqBV,YAAYQ,KAAK;YAC3EH,0BAA0BM,oBAAoBP,eAAeI,KAAK;YAElE,IAAIH,yBAAyB;gBAC3B,IAAIJ,OAAO,GAAG;oBACZ,MAAMY,8BAA8BX,mBAAmBM,KAAK,GAAGJ,eAAeI,KAAK;oBACnF,IAAIK,8BAA8B,GAAGP,IAAI,CAAC,EAAEO,8BAA8B,EAAE,EAAE,CAAC;yBAC1EP,IAAI;gBACX,OAAO;oBACLA,IAAI;gBACN;YACF,OAAO;gBACL,IAAIL,QAAQ,GAAG;oBACbK,IAAI,CAAC,EAAEM,+BAA+B,EAAE,EAAE,CAAC;gBAC7C,OAAO;oBACL,MAAMC,8BAA8BT,eAAeI,KAAK,GAAGG;oBAC3DL,IAAI,CAAC,EAAEO,8BAA8B,EAAE,EAAE,CAAC;oBAC1CN,SAAS;gBACX;YACF;QACF;IACF;IAEA,IAAIC,QAAQP,OAAO,CAAC,EAAE,MAAMA,KAAK,CAAC,CAAC,GAAG;IACtC,IAAIQ,SAASR,OAAO,CAAC,EAAE,MAAMA,KAAK,CAAC,CAAC,GAAG;IAEvC,IAAIJ,eAAe,cAAc;QAC/BW,QAAQ,CAAC,EAAER,aAAaQ,QAAS,CAAA,OAAOP,SAAS,WAAWA,OAAO,CAAA,EAAG,EAAE,CAAC;QACzEQ,SAAS,CAAC,EAAET,aAAaS,SAAU,CAAA,OAAOR,SAAS,WAAWA,OAAO,CAAA,EAAG,EAAE,CAAC;IAC7E;IAEA,qBACE,KAACa;QACCC,KAAKnB;QACLoB,OAAO;YACLP,QAAQ;YACRD,OAAO;QACT;kBAEA,cAAA,KAACM;YACCC,KAAKrB;YACLsB,OAAO;gBACLP;gBACAF;gBACAU,WAAW,CAAC,YAAY,EAAEX,EAAE,OAAO,CAAC;gBACpCE;YACF;sBAECf;;;AAIT,EAAC"}
1
+ {"version":3,"file":"index.js","names":["useResize","React","useEffect","useLivePreviewContext","DeviceContainer","props","children","deviceFrameRef","useRef","outerFrameRef","breakpoint","setMeasuredDeviceSize","size","desiredSize","zoom","measuredDeviceSize","current","outerFrameSize","deviceIsLargerThanFrame","x","margin","width","height","scaledDesiredWidth","scaledDeviceWidth","scaledDeviceDifferencePixels","differenceFromDeviceToFrame","_jsx","ref","style","transform"],"sources":["../../../../src/views/LivePreview/Device/index.tsx"],"sourcesContent":["'use client'\nimport { useResize } from '@payloadcms/ui'\nimport React, { useEffect } from 'react'\n\nimport { useLivePreviewContext } from '../Context/context.js'\n\nexport const DeviceContainer: React.FC<{\n children: React.ReactNode\n}> = (props) => {\n const { children } = props\n\n const deviceFrameRef = React.useRef<HTMLDivElement>(null)\n const outerFrameRef = React.useRef<HTMLDivElement>(null)\n\n const { breakpoint, setMeasuredDeviceSize, size: desiredSize, zoom } = useLivePreviewContext()\n\n // Keep an accurate measurement of the actual device size as it is truly rendered\n // This is helpful when `sizes` are non-number units like percentages, etc.\n const { size: measuredDeviceSize } = useResize(deviceFrameRef.current)\n const { size: outerFrameSize } = useResize(outerFrameRef.current)\n\n let deviceIsLargerThanFrame: boolean = false\n\n // Sync the measured device size with the context so that other components can use it\n // This happens from the bottom up so that as this component mounts and unmounts,\n // its size is freshly populated again upon re-mounting, i.e. going from iframe->popup->iframe\n useEffect(() => {\n if (measuredDeviceSize) {\n setMeasuredDeviceSize(measuredDeviceSize)\n }\n }, [measuredDeviceSize, setMeasuredDeviceSize])\n\n let x = '0'\n let margin = '0'\n\n if (breakpoint && breakpoint !== 'responsive') {\n x = '-50%'\n\n if (\n typeof zoom === 'number' &&\n typeof desiredSize.width === 'number' &&\n typeof desiredSize.height === 'number' &&\n typeof measuredDeviceSize.width === 'number' &&\n typeof measuredDeviceSize.height === 'number'\n ) {\n margin = '0 auto'\n const scaledDesiredWidth = desiredSize.width / zoom\n const scaledDeviceWidth = measuredDeviceSize.width * zoom\n const scaledDeviceDifferencePixels = scaledDesiredWidth - desiredSize.width\n deviceIsLargerThanFrame = scaledDeviceWidth > outerFrameSize.width\n\n if (deviceIsLargerThanFrame) {\n if (zoom > 1) {\n const differenceFromDeviceToFrame = measuredDeviceSize.width - outerFrameSize.width\n if (differenceFromDeviceToFrame < 0) x = `${differenceFromDeviceToFrame / 2}px`\n else x = '0'\n } else {\n x = '0'\n }\n } else {\n if (zoom >= 1) {\n x = `${scaledDeviceDifferencePixels / 2}px`\n } else {\n const differenceFromDeviceToFrame = outerFrameSize.width - scaledDeviceWidth\n x = `${differenceFromDeviceToFrame / 2}px`\n margin = '0'\n }\n }\n }\n }\n\n let width = zoom ? `${100 / zoom}%` : '100%'\n let height = zoom ? `${100 / zoom}%` : '100%'\n\n if (breakpoint !== 'responsive') {\n width = `${desiredSize?.width / (typeof zoom === 'number' ? zoom : 1)}px`\n height = `${desiredSize?.height / (typeof zoom === 'number' ? zoom : 1)}px`\n }\n\n return (\n <div\n ref={outerFrameRef}\n style={{\n height: '100%',\n width: '100%',\n }}\n >\n <div\n ref={deviceFrameRef}\n style={{\n height,\n margin,\n transform: `translate3d(${x}, 0, 0)`,\n width,\n }}\n >\n {children}\n </div>\n </div>\n )\n}\n"],"mappings":"AAAA;;;AACA,SAASA,SAAS,QAAQ;AAC1B,OAAOC,KAAA,IAASC,SAAS,QAAQ;AAEjC,SAASC,qBAAqB,QAAQ;AAEtC,OAAO,MAAMC,eAAA,GAEPC,KAAA;EACJ,MAAM;IAAEC;EAAQ,CAAE,GAAGD,KAAA;EAErB,MAAME,cAAA,GAAiBN,KAAA,CAAMO,MAAM,CAAiB;EACpD,MAAMC,aAAA,GAAgBR,KAAA,CAAMO,MAAM,CAAiB;EAEnD,MAAM;IAAEE,UAAU;IAAEC,qBAAqB;IAAEC,IAAA,EAAMC,WAAW;IAAEC;EAAI,CAAE,GAAGX,qBAAA;EAEvE;EACA;EACA,MAAM;IAAES,IAAA,EAAMG;EAAkB,CAAE,GAAGf,SAAA,CAAUO,cAAA,CAAeS,OAAO;EACrE,MAAM;IAAEJ,IAAA,EAAMK;EAAc,CAAE,GAAGjB,SAAA,CAAUS,aAAA,C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