payload-canvas 0.5.2 → 0.7.0-next.0

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 (325) hide show
  1. package/README.md +350 -45
  2. package/dist/admin/AiKeyField.d.ts +4 -3
  3. package/dist/admin/AiKeyField.js +3 -3
  4. package/dist/admin/ArrayRowLabel.d.ts +12 -0
  5. package/dist/admin/ArrayRowLabel.js +21 -0
  6. package/dist/admin/BuilderTab.js +1 -1
  7. package/dist/admin/DocumentEditView.d.ts +1 -1
  8. package/dist/admin/DocumentEditView.js +2 -3
  9. package/dist/admin/LayoutField.d.ts +1 -1
  10. package/dist/admin/LayoutField.js +2 -2
  11. package/dist/admin/TemplateConditionsField.d.ts +2 -2
  12. package/dist/admin/TemplateConditionsField.js +2 -2
  13. package/dist/admin/aiKeyField.css +58 -0
  14. package/dist/admin/client.d.ts +1 -0
  15. package/dist/admin/client.js +2 -0
  16. package/dist/admin/diff/LayoutDiff.js +3 -3
  17. package/dist/admin/diff/LayoutJsonDiff.d.ts +1 -1
  18. package/dist/admin/diff/LayoutJsonDiff.js +1 -1
  19. package/dist/admin/diff/layoutDiff.css +180 -0
  20. package/dist/admin/editor/Editor.d.ts +2 -2
  21. package/dist/admin/editor/Editor.js +10 -3
  22. package/dist/admin/editor/Inspector.js +23 -17
  23. package/dist/admin/editor/Library.d.ts +2 -2
  24. package/dist/admin/editor/Library.js +8 -7
  25. package/dist/admin/editor/Outline.js +20 -12
  26. package/dist/admin/editor/Overlay.js +6 -4
  27. package/dist/admin/editor/actions.d.ts +7 -2
  28. package/dist/admin/editor/actions.js +44 -12
  29. package/dist/admin/editor/assistant/AssistantPanel.d.ts +1 -1
  30. package/dist/admin/editor/assistant/AssistantPanel.js +33 -21
  31. package/dist/admin/editor/assistant/{assistant.scss → assistant.css} +322 -315
  32. package/dist/admin/editor/classes/ClassManager.d.ts +1 -1
  33. package/dist/admin/editor/classes/ClassManager.js +1 -1
  34. package/dist/admin/editor/classes/manager.css +258 -0
  35. package/dist/admin/editor/comments/CommentLayer.d.ts +1 -1
  36. package/dist/admin/editor/comments/CommentLayer.js +1 -1
  37. package/dist/admin/editor/comments/CommentsPanel.d.ts +1 -1
  38. package/dist/admin/editor/comments/CommentsPanel.js +1 -1
  39. package/dist/admin/editor/comments/{comments.scss → comments.css} +121 -140
  40. package/dist/admin/editor/comments/controller.d.ts +7 -0
  41. package/dist/admin/editor/comments/controller.js +12 -0
  42. package/dist/admin/editor/comments/useCommentFromURL.d.ts +2 -0
  43. package/dist/admin/editor/comments/useCommentFromURL.js +36 -0
  44. package/dist/admin/editor/dnd/{dnd.scss → dnd.css} +78 -80
  45. package/dist/admin/editor/dnd/smooth.js +1 -1
  46. package/dist/admin/editor/{editor.scss → editor.css} +798 -751
  47. package/dist/admin/editor/empty/EmptyStart.d.ts +1 -1
  48. package/dist/admin/editor/empty/EmptyStart.js +3 -3
  49. package/dist/admin/editor/empty/{empty.scss → empty.css} +12 -13
  50. package/dist/admin/editor/fields/ArrayField.js +3 -3
  51. package/dist/admin/editor/fields/FormBlock.d.ts +20 -0
  52. package/dist/admin/editor/fields/FormBlock.js +167 -0
  53. package/dist/admin/editor/fields/FormFieldName.d.ts +25 -0
  54. package/dist/admin/editor/fields/FormFieldName.js +58 -0
  55. package/dist/admin/editor/fields/GroupField.d.ts +22 -2
  56. package/dist/admin/editor/fields/GroupField.js +30 -1
  57. package/dist/admin/editor/fields/MergeTags.d.ts +8 -0
  58. package/dist/admin/editor/fields/MergeTags.js +62 -0
  59. package/dist/admin/editor/fields/arrayRows.d.ts +0 -2
  60. package/dist/admin/editor/fields/arrayRows.js +0 -4
  61. package/dist/admin/editor/fields/fields.css +786 -0
  62. package/dist/admin/editor/fields/values.d.ts +0 -2
  63. package/dist/admin/editor/fields/values.js +0 -14
  64. package/dist/admin/editor/generate/GenerateImage.d.ts +1 -1
  65. package/dist/admin/editor/generate/GenerateImage.js +1 -1
  66. package/dist/admin/editor/generate/{generate.scss → generate.css} +83 -82
  67. package/dist/admin/editor/icons.d.ts +3 -0
  68. package/dist/admin/editor/icons.js +3 -0
  69. package/dist/admin/editor/insert/InsertHandle.js +1 -1
  70. package/dist/admin/editor/insert/picker.d.ts +3 -2
  71. package/dist/admin/editor/insert/picker.js +9 -3
  72. package/dist/admin/editor/layout/LeftPanel.js +5 -3
  73. package/dist/admin/editor/layout/layout.css +243 -0
  74. package/dist/admin/editor/layout/leftTabs.d.ts +15 -0
  75. package/dist/admin/editor/layout/leftTabs.js +18 -0
  76. package/dist/admin/editor/layout/panels.js +1 -1
  77. package/dist/admin/editor/live/PresenceUI.d.ts +1 -1
  78. package/dist/admin/editor/live/PresenceUI.js +2 -2
  79. package/dist/admin/editor/live/{presence.scss → presence.css} +5 -4
  80. package/dist/admin/editor/locale/LocaleField.d.ts +1 -1
  81. package/dist/admin/editor/locale/LocaleField.js +1 -1
  82. package/dist/admin/editor/locale/LocaleSwitcher.d.ts +1 -1
  83. package/dist/admin/editor/locale/LocaleSwitcher.js +1 -1
  84. package/dist/admin/editor/locale/locale.css +153 -0
  85. package/dist/admin/editor/media/ImageEditor.d.ts +9 -3
  86. package/dist/admin/editor/media/ImageEditor.js +17 -11
  87. package/dist/admin/editor/media/{media.scss → media.css} +70 -60
  88. package/dist/admin/editor/media/model.d.ts +10 -1
  89. package/dist/admin/editor/media/model.js +19 -0
  90. package/dist/admin/editor/menu/Menu.d.ts +1 -1
  91. package/dist/admin/editor/menu/Menu.js +1 -1
  92. package/dist/admin/editor/menu/blockMenu.js +3 -3
  93. package/dist/admin/editor/menu/menu.css +132 -0
  94. package/dist/admin/editor/motion/MotionPanel.d.ts +2 -2
  95. package/dist/admin/editor/motion/MotionPanel.js +2 -2
  96. package/dist/admin/editor/motion/{motion.scss → motion.css} +24 -21
  97. package/dist/admin/editor/names.d.ts +9 -0
  98. package/dist/admin/editor/names.js +18 -0
  99. package/dist/admin/editor/regions/RegionFields.d.ts +6 -0
  100. package/dist/admin/editor/regions/RegionFields.js +122 -0
  101. package/dist/admin/editor/regions/RegionPane.js +5 -3
  102. package/dist/admin/editor/regions/RegionRows.js +2 -2
  103. package/dist/admin/editor/regions/required.d.ts +16 -0
  104. package/dist/admin/editor/regions/required.js +43 -0
  105. package/dist/admin/editor/renderField.d.ts +10 -3
  106. package/dist/admin/editor/renderField.js +87 -33
  107. package/dist/admin/editor/runtime.d.ts +3 -2
  108. package/dist/admin/editor/runtime.js +12 -18
  109. package/dist/admin/editor/sections/ComponentFields.d.ts +1 -1
  110. package/dist/admin/editor/sections/ComponentFields.js +2 -3
  111. package/dist/admin/editor/sections/PropertyControls.d.ts +1 -1
  112. package/dist/admin/editor/sections/PropertyControls.js +1 -1
  113. package/dist/admin/editor/sections/components.css +244 -0
  114. package/dist/admin/editor/sections/variants.css +93 -0
  115. package/dist/admin/editor/sections/variants.d.ts +1 -1
  116. package/dist/admin/editor/sections/variants.js +1 -1
  117. package/dist/admin/editor/styles/ClassBar.d.ts +1 -1
  118. package/dist/admin/editor/styles/ClassBar.js +1 -1
  119. package/dist/admin/editor/styles/StylesPanel.d.ts +1 -1
  120. package/dist/admin/editor/styles/StylesPanel.js +5 -3
  121. package/dist/admin/editor/styles/{classes.scss → classes.css} +128 -125
  122. package/dist/admin/editor/styles/context.js +9 -4
  123. package/dist/admin/editor/styles/{styles.scss → styles.css} +368 -370
  124. package/dist/admin/editor/templates/Bindable.d.ts +1 -1
  125. package/dist/admin/editor/templates/Bindable.js +1 -1
  126. package/dist/admin/editor/templates/binding.js +4 -1
  127. package/dist/admin/editor/templates/{templates.scss → templates.css} +207 -206
  128. package/dist/admin/editor/tooltip/Tooltips.d.ts +1 -1
  129. package/dist/admin/editor/tooltip/Tooltips.js +1 -1
  130. package/dist/admin/editor/tooltip/{tooltip.scss → tooltip.css} +11 -10
  131. package/dist/admin/editor/topbar/ContentModeToggle.d.ts +1 -1
  132. package/dist/admin/editor/topbar/ContentModeToggle.js +2 -2
  133. package/dist/admin/editor/topbar/DocumentActions.js +5 -5
  134. package/dist/admin/editor/topbar/TopBar.d.ts +1 -1
  135. package/dist/admin/editor/topbar/TopBar.js +2 -3
  136. package/dist/admin/editor/topbar/contentMode.css +25 -0
  137. package/dist/admin/editor/topbar/screens/DrawerRouter.d.ts +1 -1
  138. package/dist/admin/editor/topbar/screens/DrawerRouter.js +52 -40
  139. package/dist/admin/editor/topbar/screens/ScreenDrawer.d.ts +1 -1
  140. package/dist/admin/editor/topbar/screens/ScreenDrawer.js +4 -5
  141. package/dist/admin/editor/topbar/screens/drawerRouterSupport.d.ts +5 -5
  142. package/dist/admin/editor/topbar/screens/drawerRouterSupport.js +7 -7
  143. package/dist/admin/editor/topbar/screens/screens.css +139 -0
  144. package/dist/admin/editor/topbar/settingsDrawer.css +33 -0
  145. package/dist/admin/editor/topbar/settingsDrawer.d.ts +1 -1
  146. package/dist/admin/editor/topbar/settingsDrawer.js +3 -3
  147. package/dist/admin/editor/topbar/{topbar.scss → topbar.css} +189 -231
  148. package/dist/admin/editor/ui/Select.d.ts +1 -1
  149. package/dist/admin/editor/ui/Select.js +1 -1
  150. package/dist/admin/editor/ui/Slider.d.ts +1 -1
  151. package/dist/admin/editor/ui/Slider.js +1 -1
  152. package/dist/admin/editor/ui/Tabs.d.ts +17 -0
  153. package/dist/admin/editor/ui/Tabs.js +17 -0
  154. package/dist/admin/editor/ui/controls.css +301 -0
  155. package/dist/admin/forms/SubmissionCells.d.ts +6 -0
  156. package/dist/admin/forms/SubmissionCells.js +31 -0
  157. package/dist/admin/forms/SubmissionView.d.ts +5 -0
  158. package/dist/admin/forms/SubmissionView.js +106 -0
  159. package/dist/admin/forms/submissionData.d.ts +32 -0
  160. package/dist/admin/forms/submissionData.js +63 -0
  161. package/dist/admin/forms/submissions.css +200 -0
  162. package/dist/admin/layoutField.css +70 -0
  163. package/dist/admin/rsc.d.ts +2 -0
  164. package/dist/admin/rsc.js +5 -0
  165. package/dist/admin/screen/BuilderScreen.d.ts +1 -1
  166. package/dist/admin/screen/BuilderScreen.js +1 -1
  167. package/dist/admin/templateConditions.css +25 -0
  168. package/dist/ai/endpoint.d.ts +5 -0
  169. package/dist/ai/endpoint.js +18 -8
  170. package/dist/ai/images/service.js +2 -2
  171. package/dist/ai/prompt.d.ts +8 -0
  172. package/dist/ai/prompt.js +30 -0
  173. package/dist/ai/settings/index.js +3 -0
  174. package/dist/ai/tools.d.ts +6 -1
  175. package/dist/ai/tools.js +90 -6
  176. package/dist/blocks/builtins/carousel.js +10 -1
  177. package/dist/blocks/index.d.ts +1 -1
  178. package/dist/blocks/index.js +1 -1
  179. package/dist/blocks/payload.d.ts +7 -0
  180. package/dist/blocks/payload.js +16 -2
  181. package/dist/classes/collection.js +1 -0
  182. package/dist/classes/sheet.js +2 -0
  183. package/dist/comments/collection.js +3 -0
  184. package/dist/comments/shared.d.ts +5 -0
  185. package/dist/comments/shared.js +5 -0
  186. package/dist/core/blocks.d.ts +17 -3
  187. package/dist/core/blocks.js +92 -10
  188. package/dist/core/classes.d.ts +5 -0
  189. package/dist/core/classes.js +26 -1
  190. package/dist/core/conditions.d.ts +7 -0
  191. package/dist/core/conditions.js +22 -0
  192. package/dist/core/dropTarget.d.ts +3 -2
  193. package/dist/core/dropTarget.js +7 -1
  194. package/dist/core/fieldHooks.d.ts +1 -1
  195. package/dist/core/index.d.ts +6 -3
  196. package/dist/core/index.js +6 -3
  197. package/dist/core/payloadBlocks.js +25 -3
  198. package/dist/core/references.d.ts +7 -0
  199. package/dist/core/references.js +29 -11
  200. package/dist/core/regions.d.ts +14 -0
  201. package/dist/core/regions.js +17 -1
  202. package/dist/core/rowLabel.d.ts +8 -0
  203. package/dist/core/rowLabel.js +98 -0
  204. package/dist/core/starter.d.ts +10 -0
  205. package/dist/core/starter.js +40 -0
  206. package/dist/core/tree.js +4 -0
  207. package/dist/core/types.d.ts +96 -0
  208. package/dist/core/uniqueProps.d.ts +40 -0
  209. package/dist/core/uniqueProps.js +156 -0
  210. package/dist/core/validate.js +43 -3
  211. package/dist/forms/answers.d.ts +21 -0
  212. package/dist/forms/answers.js +82 -0
  213. package/dist/forms/blocks.d.ts +33 -0
  214. package/dist/forms/blocks.js +178 -0
  215. package/dist/forms/conditions.d.ts +78 -0
  216. package/dist/forms/conditions.js +184 -0
  217. package/dist/forms/emails.d.ts +23 -0
  218. package/dist/forms/emails.js +64 -0
  219. package/dist/forms/fieldConfigs.d.ts +35 -0
  220. package/dist/forms/fieldConfigs.js +167 -0
  221. package/dist/forms/fieldOps.d.ts +78 -0
  222. package/dist/forms/fieldOps.js +378 -0
  223. package/dist/forms/fieldSettings.d.ts +81 -0
  224. package/dist/forms/fieldSettings.js +239 -0
  225. package/dist/forms/files.d.ts +54 -0
  226. package/dist/forms/files.js +128 -0
  227. package/dist/forms/index.d.ts +16 -0
  228. package/dist/forms/index.js +18 -0
  229. package/dist/forms/mergeTags.d.ts +103 -0
  230. package/dist/forms/mergeTags.js +150 -0
  231. package/dist/forms/noScript.d.ts +60 -0
  232. package/dist/forms/noScript.js +109 -0
  233. package/dist/forms/pageForms.d.ts +99 -0
  234. package/dist/forms/pageForms.js +294 -0
  235. package/dist/forms/pageSync.d.ts +91 -0
  236. package/dist/forms/pageSync.js +325 -0
  237. package/dist/forms/rateLimit.d.ts +21 -0
  238. package/dist/forms/rateLimit.js +50 -0
  239. package/dist/forms/settings.d.ts +13 -0
  240. package/dist/forms/settings.js +92 -0
  241. package/dist/forms/spam.d.ts +100 -0
  242. package/dist/forms/spam.js +218 -0
  243. package/dist/forms/spamSettings.d.ts +43 -0
  244. package/dist/forms/spamSettings.js +25 -0
  245. package/dist/forms/submission.d.ts +34 -0
  246. package/dist/forms/submission.js +89 -0
  247. package/dist/forms/submissionsAdmin.d.ts +26 -0
  248. package/dist/forms/submissionsAdmin.js +108 -0
  249. package/dist/forms/summary.d.ts +60 -0
  250. package/dist/forms/summary.js +113 -0
  251. package/dist/forms/uploads.d.ts +41 -0
  252. package/dist/forms/uploads.js +132 -0
  253. package/dist/index.d.ts +8 -2
  254. package/dist/index.js +8 -2
  255. package/dist/live/document.d.ts +12 -0
  256. package/dist/live/document.js +8 -1
  257. package/dist/live/draftAccess.js +1 -1
  258. package/dist/live/endpoints.d.ts +1 -0
  259. package/dist/live/session.js +3 -1
  260. package/dist/live/storage.d.ts +13 -2
  261. package/dist/live/storage.js +18 -7
  262. package/dist/mcp/forms.d.ts +26 -0
  263. package/dist/mcp/forms.js +280 -0
  264. package/dist/mcp/index.d.ts +7 -0
  265. package/dist/mcp/index.js +29 -10
  266. package/dist/mcp/shared.d.ts +1 -0
  267. package/dist/mcp/shared.js +1 -0
  268. package/dist/plugin/forms.d.ts +30 -0
  269. package/dist/plugin/forms.js +63 -0
  270. package/dist/plugin/formsSync.d.ts +138 -0
  271. package/dist/plugin/formsSync.js +345 -0
  272. package/dist/plugin/hook.d.ts +22 -0
  273. package/dist/plugin/hook.js +19 -7
  274. package/dist/plugin/index.d.ts +14 -0
  275. package/dist/plugin/index.js +101 -30
  276. package/dist/plugin/links.d.ts +7 -2
  277. package/dist/plugin/links.js +9 -3
  278. package/dist/plugin/references.d.ts +6 -0
  279. package/dist/plugin/references.js +12 -0
  280. package/dist/plugin/sections.js +3 -0
  281. package/dist/plugin/templates.js +5 -1
  282. package/dist/react/canvas/BuilderCanvas.d.ts +2 -0
  283. package/dist/react/canvas/BuilderCanvas.js +29 -6
  284. package/dist/react/canvas/inline/candidates.js +2 -2
  285. package/dist/react/canvas/inline/mapper.d.ts +6 -1
  286. package/dist/react/canvas/inline/mapper.js +35 -4
  287. package/dist/react/canvas/inline/rich/editor.js +9 -1
  288. package/dist/react/components/Image.d.ts +1 -1
  289. package/dist/react/components/Image.js +2 -2
  290. package/dist/react/render/LayoutOutlet.d.ts +7 -3
  291. package/dist/react/render/LayoutOutlet.js +9 -4
  292. package/dist/react/render/RenderLayout.js +13 -7
  293. package/dist/react/render/resolve.d.ts +1 -0
  294. package/dist/react/render/resolve.js +7 -1
  295. package/dist/react/render/templates.js +3 -1
  296. package/dist/react/server.js +19 -0
  297. package/dist/react/theme/ThemeStyle.js +1 -1
  298. package/dist/theme/admin/ColorField.d.ts +4 -3
  299. package/dist/theme/admin/ColorField.js +1 -1
  300. package/dist/theme/admin/FontField.d.ts +4 -3
  301. package/dist/theme/admin/FontField.js +1 -1
  302. package/dist/theme/admin/SaveSignal.js +1 -1
  303. package/dist/theme/admin/SliderField.d.ts +1 -1
  304. package/dist/theme/admin/SliderField.js +1 -1
  305. package/dist/theme/admin/Variables.d.ts +4 -3
  306. package/dist/theme/admin/Variables.js +2 -2
  307. package/dist/theme/admin/fields.css +327 -0
  308. package/dist/theme/global.js +2 -0
  309. package/package.json +29 -24
  310. package/dist/admin/aiKeyField.scss +0 -58
  311. package/dist/admin/diff/layoutDiff.scss +0 -181
  312. package/dist/admin/editor/classes/manager.scss +0 -262
  313. package/dist/admin/editor/fields/fields.scss +0 -628
  314. package/dist/admin/editor/layout/layout.scss +0 -240
  315. package/dist/admin/editor/locale/locale.scss +0 -154
  316. package/dist/admin/editor/menu/menu.scss +0 -132
  317. package/dist/admin/editor/sections/components.scss +0 -238
  318. package/dist/admin/editor/sections/variants.scss +0 -90
  319. package/dist/admin/editor/topbar/contentMode.scss +0 -35
  320. package/dist/admin/editor/topbar/screens/screens.scss +0 -134
  321. package/dist/admin/editor/topbar/settingsDrawer.scss +0 -32
  322. package/dist/admin/editor/ui/controls.scss +0 -320
  323. package/dist/admin/layoutField.scss +0 -69
  324. package/dist/admin/templateConditions.scss +0 -24
  325. package/dist/theme/admin/fields.scss +0 -363
@@ -1,2 +1,2 @@
1
- import './tooltip.scss';
1
+ import './tooltip.css';
2
2
  export declare function Tooltips(): null;
@@ -19,7 +19,7 @@
19
19
  // mounting it again elsewhere is harmless.
20
20
  import { useEffect } from 'react';
21
21
  import { installTooltips } from './controller.js';
22
- import './tooltip.scss';
22
+ import './tooltip.css';
23
23
  export function Tooltips() {
24
24
  useEffect(() => installTooltips(document), []);
25
25
  return null;
@@ -1,6 +1,7 @@
1
- // The editor tooltip (`Tooltips.tsx`). It lives in `<body>`, outside the editor root, so it uses
2
- // Payload's theme variables only.
3
-
1
+ /*
2
+ * The editor tooltip (`Tooltips.tsx`). It lives in `<body>`, outside the editor root, so it uses
3
+ * Payload's theme variables only.
4
+ */
4
5
  @layer payload-default {
5
6
  @keyframes builder-tooltip-in {
6
7
  from {
@@ -18,9 +19,9 @@
18
19
  padding: 4px 8px;
19
20
  overflow: visible;
20
21
  border: 0;
21
- border-radius: var(--style-radius-s, 4px);
22
- background: var(--theme-elevation-900);
23
- color: var(--theme-elevation-0);
22
+ border-radius: var(--radius-medium, 4px);
23
+ background: var(--color-bg-inverse);
24
+ color: var(--color-text-oninverse);
24
25
  font-family: var(--font-body);
25
26
  font-size: var(--be-text-s);
26
27
  font-weight: var(--be-weight-medium);
@@ -29,11 +30,11 @@
29
30
  overflow-wrap: anywhere;
30
31
  box-shadow: var(--be-shadow);
31
32
  pointer-events: none;
33
+ }
32
34
 
33
- @media (prefers-reduced-motion: no-preference) {
34
- &:popover-open {
35
- animation: builder-tooltip-in 100ms ease both;
36
- }
35
+ @media (prefers-reduced-motion: no-preference) {
36
+ .builder-tooltip:popover-open {
37
+ animation: builder-tooltip-in 100ms ease both;
37
38
  }
38
39
  }
39
40
  }
@@ -1,4 +1,4 @@
1
- import './contentMode.scss';
1
+ import './contentMode.css';
2
2
  /** The "Content mode" label. Shown only in content mode. */
3
3
  export declare function ContentModeLabel(): import("react").JSX.Element | null;
4
4
  /** "Preview as client": designers see and edit the page as a client does. Hidden for clients. */
@@ -5,7 +5,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  import { setPreviewAsClient, useContentMode } from '../contentMode.js';
6
6
  import { Icon } from '../icons.js';
7
7
  import { useRuntime } from '../runtime.js';
8
- import './contentMode.scss';
8
+ import './contentMode.css';
9
9
  const LABEL_TIP = 'You can change text, images and links';
10
10
  /** The "Content mode" label. Shown only in content mode. */
11
11
  export function ContentModeLabel() {
@@ -22,5 +22,5 @@ export function PreviewAsClientToggle() {
22
22
  if (!runtime.canEditDesign)
23
23
  return null;
24
24
  const tip = on ? 'Back to full editing' : 'Edit as a client: text, images and links only';
25
- return (_jsxs("button", { type: "button", className: "builder-bar__button builder-bar__client-toggle", "aria-pressed": on, "aria-label": "Preview as client", "data-tooltip": tip, onClick: () => setPreviewAsClient(runtime, !on), children: [_jsx(Icon, { name: on ? 'eyeOff' : 'eye', size: 14 }), _jsx("span", { className: "builder-bar__label", children: "Preview as client" })] }));
25
+ return (_jsx("button", { type: "button", className: "builder-editor__icon-button", "aria-pressed": on, "aria-label": "Preview as client", "data-tooltip": `Preview as client · ${tip}`, onClick: () => setPreviewAsClient(runtime, !on), children: _jsx(Icon, { name: on ? 'eyeOff' : 'eye' }) }));
26
26
  }
@@ -1,8 +1,7 @@
1
1
  'use client';
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- // The right side of the top bar: the save state, Preview, the settings drawer and Publish.
4
- import { ConfirmationModal, useConfig, useDocumentDrawer, useModal, useRouteTransition } from '@payloadcms/ui';
5
- import { useRouter } from 'next/navigation';
3
+ // The right side of the top bar: the save state, the Preview and settings icon buttons, and Publish.
4
+ import { ConfirmationModal, useConfig, useDocumentDrawer, useModal, useRouter, useRouteTransition } from '@payloadcms/ui';
6
5
  import { useCallback, useEffect, useEffectEvent, useRef, useState } from 'react';
7
6
  import { findBlock } from '../../../core/index.js';
8
7
  import { editViewPath } from '../../../plugin/links.js';
@@ -80,7 +79,8 @@ export function PreviewButton() {
80
79
  const href = previewUrl ?? url;
81
80
  if (!href)
82
81
  return null;
83
- return (_jsxs("a", { className: "builder-bar__button", href: href, target: "_blank", rel: "noopener noreferrer", "aria-label": previewUrl ? 'Preview the draft in a new tab' : 'Open the page in a new tab', "data-tooltip": previewUrl ? 'Preview the draft in a new tab' : 'Open the page in a new tab', children: [_jsx(Icon, { name: "external", size: 14 }), _jsx("span", { className: "builder-bar__label", children: "Preview" })] }));
82
+ const label = previewUrl ? 'Preview the draft in a new tab' : 'Open the page in a new tab';
83
+ return (_jsx("a", { className: "builder-editor__icon-button", href: href, target: "_blank", rel: "noopener noreferrer", "aria-label": label, "data-tooltip": label, children: _jsx(Icon, { name: "external" }) }));
84
84
  }
85
85
  /**
86
86
  * Opens the document's own edit form (title, slug, SEO, …) in Payload's document drawer. After
@@ -167,7 +167,7 @@ export function PageSettings() {
167
167
  closeDrawer();
168
168
  return true;
169
169
  }, [admin, collection, closeDrawer]);
170
- return (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", className: "builder-bar__button", "aria-label": `${singular} settings`, "data-tooltip": `Title and other ${singular.toLowerCase()} settings`, onClick: () => runtime.doc.openSettings(), children: [_jsx(Icon, { name: "settings", size: 14 }), _jsxs("span", { className: "builder-bar__label", children: [singular, " settings"] })] }), _jsx(DrawerWidth, { slug: drawerSlug, width: "min(720px, calc(100% - var(--gutter-h)))" }), _jsx(SettingsDrawerSlug, { value: drawerSlug, children: _jsx(SettingsDrawerReload, { value: reload, children: _jsx(RouterIntercept, { intercept: intercept, children: _jsx(DocumentDrawer, { disableActions: true, onSave: () => {
170
+ return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "builder-editor__icon-button", "aria-label": `${singular} settings`, "data-tooltip": `Title and other ${singular.toLowerCase()} settings`, onClick: () => runtime.doc.openSettings(), children: _jsx(Icon, { name: "settings" }) }), _jsx(DrawerWidth, { slug: drawerSlug, width: "min(720px, calc(100% - var(--gutter-h)))" }), _jsx(SettingsDrawerSlug, { value: drawerSlug, children: _jsx(SettingsDrawerReload, { value: reload, children: _jsx(RouterIntercept, { intercept: intercept, children: _jsx(DocumentDrawer, { disableActions: true, onSave: () => {
171
171
  void runtime.doc.refresh();
172
172
  runtime.regions?.reload();
173
173
  } }, formKey) }) }) })] }));
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from 'react';
2
- import './topbar.scss';
2
+ import './topbar.css';
3
3
  /**
4
4
  * The `from` query parameter (where the editor came from, e.g. the page builder that opened a
5
5
  * saved section) when it is a path inside the admin. Anything else is ignored.
@@ -3,8 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  // The full-screen builder's one top bar. Left: back, the admin home, the document title and its
4
4
  // status. Center: undo, redo and the canvas width. Right: who is here, the save state, preview,
5
5
  // page settings, help and Publish. The AI assistant opens from the inspector tab (or Ctrl+I).
6
- import { Link, useConfig } from '@payloadcms/ui';
7
- import { useSearchParams } from 'next/navigation';
6
+ import { Link, useConfig, useSearchParams } from '@payloadcms/ui';
8
7
  import { useEffect, useMemo, useRef, useState } from 'react';
9
8
  import { Icon } from '../icons.js';
10
9
  import { Presence } from '../live/PresenceUI.js';
@@ -25,7 +24,7 @@ import { ScreenDrawer } from './screens/ScreenDrawer.js';
25
24
  import { useDismiss } from './useDismiss.js';
26
25
  import { editViewPath, listViewPath } from '../../../plugin/links.js';
27
26
  import { forgetForm } from '../../formChoice.js';
28
- import './topbar.scss';
27
+ import './topbar.css';
29
28
  /**
30
29
  * The `from` query parameter (where the editor came from, e.g. the page builder that opened a
31
30
  * saved section) when it is a path inside the admin. Anything else is ignored.
@@ -0,0 +1,25 @@
1
+ /* Content mode in the top bar (ContentModeToggle.tsx). Payload CSS variables only, no Tailwind. */
2
+ @layer payload-default {
3
+ /* A quiet pill next to the status: it says what this editor can change, not a warning. */
4
+ .builder-bar__content-mode {
5
+ display: inline-flex;
6
+ flex: none;
7
+ align-items: center;
8
+ gap: 5px;
9
+ height: 24px;
10
+ margin-left: 4px;
11
+ padding: 0 9px 0 8px;
12
+ border: 1px solid var(--be-border);
13
+ border-radius: 12px;
14
+ color: var(--color-text);
15
+ font-size: var(--be-text-s);
16
+ font-weight: var(--be-weight-strong);
17
+ white-space: nowrap;
18
+ cursor: default;
19
+ }
20
+
21
+ .builder-bar__content-mode svg {
22
+ flex: none;
23
+ color: var(--color-text-secondary);
24
+ }
25
+ }
@@ -28,7 +28,7 @@ export declare function DrawerRouter({ pathname, search, segments, onNavigate, o
28
28
  * Lets `intercept` take some `router.push` / `router.replace` calls of the screens inside (it
29
29
  * returns true when it took one). The other calls go to the page's own router. The settings
30
30
  * drawer uses it: the "Go back" of Payload's "Document locked" dialog pushes the collection list,
31
- * which would leave the builder. Without the context (a Next upgrade) the calls are not taken.
31
+ * which would leave the builder. Without the adapter context the calls are not taken.
32
32
  */
33
33
  export declare function RouterIntercept({ intercept, children }: {
34
34
  intercept: (href: string) => boolean;
@@ -1,21 +1,31 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import * as appRouterModule from 'next/dist/shared/lib/app-router-context.shared-runtime';
4
- import * as hooksModule from 'next/dist/shared/lib/hooks-client-context.shared-runtime';
5
- import { usePathname, useRouter, useSearchParams } from 'next/navigation';
6
- import { Component, useEffect, useMemo, useRef } from 'react';
3
+ // A router for Payload screens shown inside a builder drawer.
4
+ //
5
+ // Payload's Versions, Version and API screens navigate with the admin router: a version row is a
6
+ // link, pagination and the comparison select push new search params, Restore pushes the edit
7
+ // view. In the drawer, each of these would leave the builder. This provider gives the screens a
8
+ // router of their own, so a navigation changes what the drawer shows instead of the page.
9
+ //
10
+ // Payload 4's admin UI reads its router from `RouterAdapterContext` (`@payloadcms/ui`): its
11
+ // `useRouter`, `usePathname`, `useSearchParams` and `useParams` hooks and `PayloadLink` all read
12
+ // that one context. This file provides that context again inside the drawer, with the drawer's
13
+ // path and a router that calls `onNavigate`.
14
+ //
15
+ // It fails safe: a missing context, hooks that do not read the drawer's values (a probe checks on
16
+ // every screen), or an error while a screen renders makes `onUnavailable` fire, and the screen
17
+ // opens as a normal admin page. A capture-phase click listener also keeps plain link clicks in
18
+ // the drawer (the Link of the page's adapter navigates on its own).
19
+ import { RouterAdapterContext, usePathname, useRouter, useSearchParams } from '@payloadcms/ui';
20
+ import { Component, use, useEffect, useMemo, useRef } from 'react';
7
21
  import { disabledByDevFlag, drawerLinkHref, hooksFollow, isReactContext, routerSupport } from './drawerRouterSupport.js';
8
- // Read through a plain record: an export that Next removes is `undefined` here, not a crash.
9
- const internals = { ...appRouterModule, ...hooksModule };
10
- const contexts = internals;
11
- const withPromises = isReactContext(internals.NavigationPromisesContext);
12
- /** Set when the probe found that Next's hooks ignore the override: later screens open as pages at once. */
22
+ /** Set when the probe found that the hooks ignore the override: later screens open as pages at once. */
13
23
  let broken = null;
14
24
  /** Whether screens can open in the drawer now. */
15
25
  export function drawerRouterSupport() {
16
26
  if (broken)
17
27
  return { ok: false, reason: broken };
18
- return routerSupport(internals, disabledByDevFlag());
28
+ return routerSupport({ RouterAdapterContext }, disabledByDevFlag());
19
29
  }
20
30
  let warned = false;
21
31
  /** One console warning in development when the screens fall back to admin pages. */
@@ -26,19 +36,16 @@ export function warnDrawerFallback(reason) {
26
36
  console.warn(`[builder] Versions and API screens open as admin pages, not in a drawer: ${reason}. See DrawerRouter.tsx.`);
27
37
  }
28
38
  export function DrawerRouter({ pathname, search, segments, onNavigate, onUnavailable, children, }) {
39
+ // The page's adapter: the drawer keeps its Link component.
40
+ const page = use(RouterAdapterContext);
29
41
  const router = useMemo(() => ({
30
42
  back: () => onNavigate({ kind: 'back' }),
31
- forward: () => { },
32
43
  refresh: () => onNavigate({ kind: 'refresh' }),
33
44
  push: (href) => onNavigate({ kind: 'push', href }),
34
45
  replace: (href) => onNavigate({ kind: 'replace', href }),
35
- prefetch: () => { },
36
- // `useRouter` replaces it with the id of the page around the drawer.
37
- bfcacheId: '',
38
46
  }), [onNavigate]);
39
- const searchParams = useMemo(() => new URLSearchParams(search), [search]);
40
- const params = useMemo(() => ({ segments }), [segments]);
41
- // Plain link clicks stay in the drawer even if Next's `<Link>` stops using the router above.
47
+ const value = useMemo(() => (page ? { Link: page.Link, params: { segments }, pathname, router, searchParams: new URLSearchParams(search) } : null), [page, segments, pathname, router, search]);
48
+ // Plain link clicks stay in the drawer: the Link component of the page's adapter navigates itself.
42
49
  const screen = useRef(null);
43
50
  useEffect(() => {
44
51
  const el = screen.current;
@@ -58,42 +65,47 @@ export function DrawerRouter({ pathname, search, segments, onNavigate, onUnavail
58
65
  return () => el.removeEventListener('click', onClick, true);
59
66
  }, [onNavigate]);
60
67
  const support = drawerRouterSupport();
61
- const unavailable = support.ok ? null : support.reason;
68
+ const unavailable = !support.ok ? support.reason : value ? null : 'the admin router adapter is missing';
62
69
  useEffect(() => {
63
70
  if (unavailable)
64
71
  onUnavailable(unavailable);
65
72
  }, [unavailable, onUnavailable]);
66
- if (unavailable)
73
+ if (unavailable || !value)
67
74
  return null;
68
- const { AppRouterContext, PathnameContext, SearchParamsContext, PathParamsContext, NavigationPromisesContext } = contexts;
69
- const probed = (_jsx(Probe, { pathname: pathname, search: search, push: router.push, onUnavailable: onUnavailable, children: children }));
70
- return (_jsx("div", { ref: screen, className: "builder-screen-drawer__screen", children: _jsx(Boundary, { onError: onUnavailable, children: _jsx(AppRouterContext, { value: router, children: _jsx(PathnameContext, { value: pathname, children: _jsx(SearchParamsContext, { value: searchParams, children: _jsx(PathParamsContext, { value: params, children: withPromises && NavigationPromisesContext ? _jsx(NavigationPromisesContext, { value: null, children: probed }) : probed }) }) }) }) }) }));
75
+ return (_jsx("div", { ref: screen, className: "builder-screen-drawer__screen", children: _jsx(Boundary, { onError: onUnavailable, children: _jsx(RouterAdapterContext, { value: value, children: _jsx(Probe, { pathname: pathname, search: search, push: router.push, onUnavailable: onUnavailable, children: children }) }) }) }));
71
76
  }
72
77
  /**
73
78
  * Lets `intercept` take some `router.push` / `router.replace` calls of the screens inside (it
74
79
  * returns true when it took one). The other calls go to the page's own router. The settings
75
80
  * drawer uses it: the "Go back" of Payload's "Document locked" dialog pushes the collection list,
76
- * which would leave the builder. Without the context (a Next upgrade) the calls are not taken.
81
+ * which would leave the builder. Without the adapter context the calls are not taken.
77
82
  */
78
83
  export function RouterIntercept({ intercept, children }) {
79
- const router = useRouter();
80
- const wrapped = useMemo(() => ({
81
- ...router,
82
- push: (href, options) => {
83
- if (!intercept(href))
84
- router.push(href, options);
85
- },
86
- replace: (href, options) => {
87
- if (!intercept(href))
88
- router.replace(href, options);
89
- },
90
- }), [router, intercept]);
91
- if (!isReactContext(internals.AppRouterContext))
84
+ const page = use(RouterAdapterContext);
85
+ const value = useMemo(() => {
86
+ if (!page)
87
+ return null;
88
+ const { router } = page;
89
+ return {
90
+ ...page,
91
+ router: {
92
+ ...router,
93
+ push: (href, options) => {
94
+ if (!intercept(href))
95
+ router.push(href, options);
96
+ },
97
+ replace: (href, options) => {
98
+ if (!intercept(href))
99
+ router.replace(href, options);
100
+ },
101
+ },
102
+ };
103
+ }, [page, intercept]);
104
+ if (!value || !isReactContext(RouterAdapterContext))
92
105
  return children;
93
- const { AppRouterContext } = contexts;
94
- return _jsx(AppRouterContext, { value: wrapped, children: children });
106
+ return _jsx(RouterAdapterContext, { value: value, children: children });
95
107
  }
96
- /** Renders the screen only when Next's hooks return the drawer's values. */
108
+ /** Renders the screen only when the admin router hooks return the drawer's values. */
97
109
  function Probe({ pathname, search, push, onUnavailable, children, }) {
98
110
  const router = useRouter();
99
111
  const actualPath = usePathname();
@@ -102,7 +114,7 @@ function Probe({ pathname, search, push, onUnavailable, children, }) {
102
114
  useEffect(() => {
103
115
  if (ok)
104
116
  return;
105
- broken = 'Next’s navigation hooks no longer read the overridden contexts';
117
+ broken = 'the admin router hooks no longer read the overridden context';
106
118
  onUnavailable(broken);
107
119
  }, [ok, onUnavailable]);
108
120
  return ok ? children : null;
@@ -1,3 +1,3 @@
1
- import './screens.scss';
1
+ import './screens.css';
2
2
  /** Opens on `runtime.doc.openScreen(…)`. Mounted once, in the top bar. */
3
3
  export declare function ScreenDrawer(): import("react").JSX.Element;
@@ -5,13 +5,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  // Payload renders them on the server through its public `renderDocument` server function: the
6
6
  // same one its document drawer uses, with `paramsOverride` set to the screen's admin path. The
7
7
  // screens navigate inside the drawer (DrawerRouter.tsx). Back returns to the last screen. If the
8
- // drawer router cannot work (a Next upgrade), the screen opens as a normal admin page instead.
8
+ // drawer router cannot work (a Payload upgrade), the screen opens as a normal admin page instead.
9
9
  //
10
10
  // Restore goes through the builder, not through Payload's Restore button: the live session owns
11
11
  // the layout, so it must reset the session for every editor (live/document.ts). The drawer hides
12
12
  // Payload's button and shows its own in the header.
13
- import { ConfirmationModal, Drawer, Gutter, ShimmerEffect, useConfig, useDrawerSlug, useModal, useServerFunctions } from '@payloadcms/ui';
14
- import { useRouter } from 'next/navigation';
13
+ import { ConfirmationModal, Drawer, Gutter, ShimmerEffect, useConfig, useDrawerSlug, useModal, useRouter, useServerFunctions } from '@payloadcms/ui';
15
14
  import { useCallback, useEffect, useEffectEvent, useMemo, useRef, useState } from 'react';
16
15
  import { Icon } from '../../icons.js';
17
16
  import { useRuntime } from '../../runtime.js';
@@ -20,7 +19,7 @@ import { useModalA11y } from '../../ui/modalA11y.js';
20
19
  import { useValue } from '../../valueStore.js';
21
20
  import { DrawerRouter, drawerRouterSupport, warnDrawerFallback } from './DrawerRouter.js';
22
21
  import { withoutUndefinedLocale } from './drawerRouterSupport.js';
23
- import './screens.scss';
22
+ import './screens.css';
24
23
  const RESTORE_SLUG = 'builder-restore-version';
25
24
  /**
26
25
  * Payload's API screen builds its URL with `locale=${code}`, and an app without localization has
@@ -209,7 +208,7 @@ export function ScreenDrawer() {
209
208
  const segments = useMemo(() => ['collections', collection, id, ...(shownRoute?.path ?? [])], [collection, id, shownRoute]);
210
209
  const body = useRef(null);
211
210
  useCleanApiUrl(body, !localization && shownRoute?.path[0] === 'api');
212
- return (_jsxs(Drawer, { slug: slug, className: "builder-screen-drawer", gutter: false, Header: null, children: [_jsx(Gutter, { className: "builder-screen-drawer__header", children: _jsxs("div", { className: "builder-screen-drawer__bar", children: [history.length > 1 && (_jsx("button", { type: "button", className: "builder-screen-drawer__icon-button", "aria-label": "Back", onClick: () => navigate({ kind: 'back' }), children: _jsx(Icon, { name: "back" }) })), _jsx("h2", { className: "builder-screen-drawer__title", children: titleOf(current) }), canRestore && (_jsxs("button", { type: "button", className: "builder-screen-drawer__restore", disabled: busy !== null, onClick: () => openModal(RESTORE_SLUG), children: [_jsx(Icon, { name: "undo", size: 14 }), busy === 'restore' ? 'Restoring…' : meta.drafts ? 'Restore as draft' : 'Restore this version'] })), _jsx("button", { type: "button", className: "builder-screen-drawer__icon-button", "aria-label": "Close", onClick: () => closeModal(slug), children: _jsx(Icon, { name: "close" }) })] }) }), _jsx("div", { ref: body, className: "builder-screen-drawer__body", "aria-busy": loading, children: failed ? (_jsx(Gutter, { children: _jsxs("p", { className: "builder-screen-drawer__error", children: ["This screen did not load.", ' ', _jsx("button", { type: "button", className: "builder-screen-drawer__link", onClick: reload, children: "Try again" })] }) })) : shown ? (_jsx(DrawerRouter, { pathname: `${docPath}/${shown.route.path.join('/')}`, search: shown.route.search, segments: segments, onNavigate: navigate, onUnavailable: onUnavailable, children: shown.node })) : (_jsxs(Gutter, { className: "builder-screen-drawer__loading", children: [_jsx(ShimmerEffect, { height: "40px" }), _jsx(ShimmerEffect, { height: "240px" })] })) }), versionId && (_jsx(ConfirmationModal, { modalSlug: RESTORE_SLUG, heading: "Restore this version?", body: meta.drafts
211
+ return (_jsxs(Drawer, { slug: slug, className: "builder-screen-drawer", Header: null, children: [_jsx(Gutter, { className: "builder-screen-drawer__header", children: _jsxs("div", { className: "builder-screen-drawer__bar", children: [history.length > 1 && (_jsx("button", { type: "button", className: "builder-screen-drawer__icon-button", "aria-label": "Back", onClick: () => navigate({ kind: 'back' }), children: _jsx(Icon, { name: "back" }) })), _jsx("h2", { className: "builder-screen-drawer__title", children: titleOf(current) }), canRestore && (_jsxs("button", { type: "button", className: "builder-screen-drawer__restore", disabled: busy !== null, onClick: () => openModal(RESTORE_SLUG), children: [_jsx(Icon, { name: "undo", size: 14 }), busy === 'restore' ? 'Restoring…' : meta.drafts ? 'Restore as draft' : 'Restore this version'] })), _jsx("button", { type: "button", className: "builder-screen-drawer__icon-button", "aria-label": "Close", onClick: () => closeModal(slug), children: _jsx(Icon, { name: "close" }) })] }) }), _jsx("div", { ref: body, className: "builder-screen-drawer__body", "aria-busy": loading, children: failed ? (_jsx(Gutter, { children: _jsxs("p", { className: "builder-screen-drawer__error", children: ["This screen did not load.", ' ', _jsx("button", { type: "button", className: "builder-screen-drawer__link", onClick: reload, children: "Try again" })] }) })) : shown ? (_jsx(DrawerRouter, { pathname: `${docPath}/${shown.route.path.join('/')}`, search: shown.route.search, segments: segments, onNavigate: navigate, onUnavailable: onUnavailable, children: shown.node })) : (_jsxs(Gutter, { className: "builder-screen-drawer__loading", children: [_jsx(ShimmerEffect, { height: "40px" }), _jsx(ShimmerEffect, { height: "240px" })] })) }), versionId && (_jsx(ConfirmationModal, { modalSlug: RESTORE_SLUG, heading: "Restore this version?", body: meta.drafts
213
212
  ? 'The page goes back to this version for everyone editing it. It becomes the draft: the site keeps the published version until you publish.'
214
213
  : 'The page goes back to this version for everyone editing it.', confirmLabel: "Restore", confirmingLabel: "Restoring\u2026", onConfirm: async () => {
215
214
  if (await runtime.doc.restore(versionId))
@@ -1,5 +1,5 @@
1
- /** The Next contexts the drawer router must provide. `NavigationPromisesContext` is optional: only development builds read it. */
2
- export declare const REQUIRED_CONTEXTS: readonly ['AppRouterContext', 'PathnameContext', 'SearchParamsContext', 'PathParamsContext'];
1
+ /** The context the drawer router provides again: Payload 4's admin router (`@payloadcms/ui`). */
2
+ export declare const REQUIRED_CONTEXTS: readonly ['RouterAdapterContext'];
3
3
  export type RouterSupport = {
4
4
  ok: true;
5
5
  } | {
@@ -9,13 +9,13 @@ export type RouterSupport = {
9
9
  /** True for an object made by React's `createContext`. */
10
10
  export declare function isReactContext(value: unknown): boolean;
11
11
  /**
12
- * Whether the drawer router can run with these exports of Next's internal modules. Not ok when a
12
+ * Whether the drawer router can run with these exports of `@payloadcms/ui`. Not ok when a
13
13
  * context is missing or is no longer a React context, or when `disabled` (the development flag).
14
14
  */
15
15
  export declare function routerSupport(exports: Record<string, unknown>, disabled?: boolean): RouterSupport;
16
16
  /**
17
- * True when Next's hooks, called inside the drawer router, return the drawer's values. False
18
- * means Next reads its route from somewhere else now, and screen navigation would leave the page.
17
+ * True when the admin router hooks, called inside the drawer router, return the drawer's values.
18
+ * False means they read the route from somewhere else now, and screen navigation would leave the page.
19
19
  */
20
20
  export declare function hooksFollow(expected: {
21
21
  pathname: string;
@@ -1,14 +1,14 @@
1
1
  // Decides whether the drawer router (DrawerRouter.tsx) can work, and which link clicks it takes.
2
- // Pure: no Next and no React imports, so the tests run in Node.
3
- /** The Next contexts the drawer router must provide. `NavigationPromisesContext` is optional: only development builds read it. */
4
- export const REQUIRED_CONTEXTS = ['AppRouterContext', 'PathnameContext', 'SearchParamsContext', 'PathParamsContext'];
2
+ // Pure: no Payload and no React imports, so the tests run in Node.
3
+ /** The context the drawer router provides again: Payload 4's admin router (`@payloadcms/ui`). */
4
+ export const REQUIRED_CONTEXTS = ['RouterAdapterContext'];
5
5
  const REACT_CONTEXT = Symbol.for('react.context');
6
6
  /** True for an object made by React's `createContext`. */
7
7
  export function isReactContext(value) {
8
8
  return typeof value === 'object' && value !== null && value.$$typeof === REACT_CONTEXT;
9
9
  }
10
10
  /**
11
- * Whether the drawer router can run with these exports of Next's internal modules. Not ok when a
11
+ * Whether the drawer router can run with these exports of `@payloadcms/ui`. Not ok when a
12
12
  * context is missing or is no longer a React context, or when `disabled` (the development flag).
13
13
  */
14
14
  export function routerSupport(exports, disabled = false) {
@@ -16,12 +16,12 @@ export function routerSupport(exports, disabled = false) {
16
16
  return { ok: false, reason: 'the development flag turned it off' };
17
17
  const missing = REQUIRED_CONTEXTS.filter((name) => !isReactContext(exports[name]));
18
18
  if (missing.length > 0)
19
- return { ok: false, reason: `Next no longer exports ${missing.join(', ')}` };
19
+ return { ok: false, reason: `@payloadcms/ui no longer exports ${missing.join(', ')}` };
20
20
  return { ok: true };
21
21
  }
22
22
  /**
23
- * True when Next's hooks, called inside the drawer router, return the drawer's values. False
24
- * means Next reads its route from somewhere else now, and screen navigation would leave the page.
23
+ * True when the admin router hooks, called inside the drawer router, return the drawer's values.
24
+ * False means they read the route from somewhere else now, and screen navigation would leave the page.
25
25
  */
26
26
  export function hooksFollow(expected, actual) {
27
27
  return actual.pathname === expected.pathname && actual.search === new URLSearchParams(expected.search).toString() && actual.push === expected.push;
@@ -0,0 +1,139 @@
1
+ /*
2
+ * Drawers over the builder: Payload's Versions and API screens, and the page settings drawer.
3
+ * They render in Payload's modal container, outside `.builder-editor`, so they use Payload's CSS
4
+ * variables only. No Tailwind.
5
+ */
6
+ @layer payload-default {
7
+ /*
8
+ * The width applies from the first frame. Payload animates every drawer property, so a width
9
+ * that changes after the drawer opened would animate too.
10
+ */
11
+ .builder-screen-drawer > .drawer__content {
12
+ width: min(1280px, 100% - var(--gutter-h)) !important;
13
+ }
14
+
15
+ .builder-screen-drawer__header {
16
+ position: sticky;
17
+ z-index: 3;
18
+ top: 0;
19
+ border-bottom: 1px solid var(--color-border);
20
+ background: var(--color-bg);
21
+ }
22
+
23
+ .builder-screen-drawer__bar {
24
+ display: flex;
25
+ align-items: center;
26
+ gap: calc(1.0156rem * 0.5);
27
+ min-height: calc(1.0156rem * 2.5);
28
+ padding: calc(1.0156rem * 1.5) 0 1.0156rem;
29
+ }
30
+
31
+ .builder-screen-drawer__title {
32
+ flex: 1;
33
+ min-width: 0;
34
+ margin: 0;
35
+ overflow: hidden;
36
+ text-overflow: ellipsis;
37
+ white-space: nowrap;
38
+ }
39
+
40
+ .builder-screen-drawer__icon-button {
41
+ display: inline-grid;
42
+ flex: none;
43
+ place-items: center;
44
+ width: 32px;
45
+ height: 32px;
46
+ padding: 0;
47
+ border: 0;
48
+ border-radius: var(--radius-medium, 4px);
49
+ background: transparent;
50
+ color: var(--color-text);
51
+ cursor: pointer;
52
+ }
53
+
54
+ .builder-screen-drawer__icon-button:hover {
55
+ background: var(--color-bg-hover);
56
+ color: var(--color-text);
57
+ }
58
+
59
+ .builder-screen-drawer__icon-button:focus-visible {
60
+ outline: 2px solid var(--color-border-selected);
61
+ outline-offset: 0;
62
+ }
63
+
64
+ .builder-screen-drawer__restore {
65
+ display: inline-flex;
66
+ flex: none;
67
+ align-items: center;
68
+ gap: 6px;
69
+ height: 32px;
70
+ padding: 0 12px;
71
+ border: 0;
72
+ border-radius: var(--radius-medium, 4px);
73
+ background: var(--color-bg-inverse);
74
+ color: var(--color-text-oninverse);
75
+ font: inherit;
76
+ font-size: var(--be-text-m);
77
+ font-weight: var(--be-weight-medium);
78
+ cursor: pointer;
79
+ }
80
+
81
+ .builder-screen-drawer__restore:hover:not(:disabled) {
82
+ background: var(--color-bg-inverse);
83
+ }
84
+
85
+ .builder-screen-drawer__restore:disabled {
86
+ opacity: 0.5;
87
+ cursor: default;
88
+ }
89
+
90
+ .builder-screen-drawer__restore:focus-visible {
91
+ outline: 2px solid var(--color-border-selected);
92
+ outline-offset: 2px;
93
+ }
94
+
95
+ .builder-screen-drawer__body {
96
+ transition: opacity 150ms ease;
97
+ /* Loading the next screen: the current one stays, dimmed. */
98
+ }
99
+
100
+ .builder-screen-drawer__body[aria-busy=true] {
101
+ opacity: 0.55;
102
+ pointer-events: none;
103
+ }
104
+
105
+ /* Wraps the screen only to catch its link clicks: no box of its own. */
106
+ .builder-screen-drawer__screen {
107
+ display: contents;
108
+ }
109
+
110
+ .builder-screen-drawer__loading {
111
+ display: flex;
112
+ flex-direction: column;
113
+ gap: 1.0156rem;
114
+ padding-top: 1.0156rem;
115
+ }
116
+
117
+ .builder-screen-drawer__error {
118
+ margin: 1.0156rem 0;
119
+ color: var(--color-text);
120
+ }
121
+
122
+ .builder-screen-drawer__link {
123
+ padding: 0;
124
+ border: 0;
125
+ background: none;
126
+ color: var(--color-text);
127
+ font: inherit;
128
+ text-decoration: underline;
129
+ cursor: pointer;
130
+ }
131
+
132
+ /*
133
+ * Restore runs through the builder (the header button): Payload's own would leave the live
134
+ * session out.
135
+ */
136
+ .builder-screen-drawer .restore-version {
137
+ display: none;
138
+ }
139
+ }
@@ -0,0 +1,33 @@
1
+ /*
2
+ * The "Not saved" banner in the settings drawer (settingsDrawer.tsx). It renders inside Payload's
3
+ * document controls, outside `.builder-editor`, so it uses Payload's CSS variables only.
4
+ */
5
+ @layer payload-default {
6
+ /* Above the form's fields (the banner moves there from the controls row). */
7
+ .builder-stale-save__slot {
8
+ padding: 1.0156rem var(--gutter-h) 0;
9
+ }
10
+
11
+ .builder-stale-save {
12
+ display: flex;
13
+ flex-wrap: wrap;
14
+ align-items: center;
15
+ gap: calc(1.0156rem * 0.5) 1.0156rem;
16
+ width: 100%;
17
+ padding: calc(1.0156rem * 0.5) calc(1.0156rem * 0.75);
18
+ border: 1px solid var(--color-border-danger);
19
+ border-radius: var(--radius-medium);
20
+ background: var(--color-bg-danger-tertiary);
21
+ color: var(--color-text-danger);
22
+ line-height: 1.4;
23
+ }
24
+
25
+ .builder-stale-save__text {
26
+ flex: 1 1 280px;
27
+ margin: 0;
28
+ }
29
+
30
+ .builder-stale-save__reload {
31
+ flex: none;
32
+ }
33
+ }
@@ -1,5 +1,5 @@
1
1
  import type { PublishButtonClientProps } from 'payload';
2
- import './settingsDrawer.scss';
2
+ import './settingsDrawer.css';
3
3
  /** Slug of the builder's settings drawer. Null outside the builder view. */
4
4
  export declare const SettingsDrawerSlug: import("react").Context<string | null>;
5
5
  /** Loads the settings drawer's form again from the server (their changes; the user's input goes). */