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,8 +1,9 @@
1
- import type { TextFieldClientComponent } from 'payload';
2
- import './aiKeyField.scss';
1
+ import type { TextFieldClientProps } from 'payload';
2
+ import { type FC } from 'react';
3
+ import './aiKeyField.css';
3
4
  /**
4
5
  * An API key in the AI settings global. The stored key never reaches the browser: the field shows
5
6
  * only "Set, ends in …4f2a" (from the read-only `keyStatus`), and offers Replace and Clear.
6
7
  * The value it sends: a new key (string), `null` to clear, or nothing to keep the stored key.
7
8
  */
8
- export declare const AiKeyField: TextFieldClientComponent;
9
+ export declare const AiKeyField: FC<TextFieldClientProps>;
@@ -3,7 +3,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
3
3
  import { Button, FieldDescription, FieldLabel, useDocumentInfo, useField, useFormFields, useFormModified } from '@payloadcms/ui';
4
4
  import { useState } from 'react';
5
5
  import { KEY_STATUS_FIELD } from '../ai/settings/shared.js';
6
- import './aiKeyField.scss';
6
+ import './aiKeyField.css';
7
7
  function statusText(status) {
8
8
  if (status?.state === 'set')
9
9
  return status.last4 ? `Set, ends in …${status.last4}` : 'Set';
@@ -47,8 +47,8 @@ export const AiKeyField = function AiKeyField({ path, field, readOnly }) {
47
47
  const fallback = !stored || clearing ? fallbackText(custom) : null;
48
48
  return (_jsxs("div", { className: "field-type ai-key-field", children: [_jsx(FieldLabel, { label: field.label, path: path }), _jsx("p", { className: `ai-key-field__status${status?.state === 'unreadable' ? ' ai-key-field__status--error' : ''}`, children: clearing ? 'The key is removed when you save.' : statusText(status) }), fallback && _jsx("p", { className: "ai-key-field__note", children: fallback }), editing ? (_jsxs("div", { className: "ai-key-field__row", children: [_jsx("input", { className: "ai-key-field__input", type: "password", autoComplete: "off", spellCheck: false, placeholder: "Paste the API key", "aria-label": typeof field.label === 'string' ? field.label : path, value: typeof value === 'string' ? value : '', onChange: (event) => setValue(event.target.value), disabled: locked,
49
49
  // oxlint-disable-next-line jsx-a11y/no-autofocus -- the user just asked for this input
50
- autoFocus: true }), _jsx(Button, { buttonStyle: "secondary", size: "small", margin: false, onClick: () => {
50
+ autoFocus: true }), _jsx(Button, { buttonStyle: "secondary", size: "medium", margin: false, onClick: () => {
51
51
  setValue(undefined);
52
52
  setEditing(false);
53
- }, children: "Cancel" })] })) : (!locked && (_jsxs("div", { className: "ai-key-field__row", children: [clearing ? (_jsx(Button, { buttonStyle: "secondary", size: "small", margin: false, onClick: () => setValue(undefined), children: "Undo" })) : (_jsxs(_Fragment, { children: [_jsx(Button, { buttonStyle: "secondary", size: "small", margin: false, onClick: () => setEditing(true), children: stored ? 'Replace key' : 'Add key' }), stored && (_jsx(Button, { buttonStyle: "secondary", size: "small", margin: false, onClick: () => setValue(null), children: "Clear key" }))] })), custom?.keyUrl && (_jsx("a", { className: "ai-key-field__link", href: custom.keyUrl, target: "_blank", rel: "noopener noreferrer", children: "Get an API key" }))] }))), typeof value === 'string' && value.trim() && _jsx("p", { className: "ai-key-field__note", children: "Save the settings to store the new key." }), description ? _jsx(FieldDescription, { description: description, path: path }) : null] }));
53
+ }, children: "Cancel" })] })) : (!locked && (_jsxs("div", { className: "ai-key-field__row", children: [clearing ? (_jsx(Button, { buttonStyle: "secondary", size: "medium", margin: false, onClick: () => setValue(undefined), children: "Undo" })) : (_jsxs(_Fragment, { children: [_jsx(Button, { buttonStyle: "secondary", size: "medium", margin: false, onClick: () => setEditing(true), children: stored ? 'Replace key' : 'Add key' }), stored && (_jsx(Button, { buttonStyle: "secondary", size: "medium", margin: false, onClick: () => setValue(null), children: "Clear key" }))] })), custom?.keyUrl && (_jsx("a", { className: "ai-key-field__link", href: custom.keyUrl, target: "_blank", rel: "noopener noreferrer", children: "Get an API key" }))] }))), typeof value === 'string' && value.trim() && _jsx("p", { className: "ai-key-field__note", children: "Save the settings to store the new key." }), description ? _jsx(FieldDescription, { description: description, path: path }) : null] }));
54
54
  };
@@ -0,0 +1,12 @@
1
+ import type { ClientField } from 'payload';
2
+ type Props = {
3
+ /** The array field, sent by Payload to every RowLabel component. */
4
+ readonly field?: ClientField;
5
+ };
6
+ /**
7
+ * A row label for any Payload array field: the row's most telling value ("Sales team (sales)"),
8
+ * else "Item 1" with the field's singular label. The same rule names rows in the builder's
9
+ * inspector (`rowLabel` in `payload-canvas/core`). Set it as `admin.components.RowLabel`.
10
+ */
11
+ export declare function ArrayRowLabel({ field }: Props): import("react").JSX.Element;
12
+ export {};
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useRowLabel, useTranslation } from '@payloadcms/ui';
4
+ import { textOf } from '../core/fields.js';
5
+ import { rowLabel } from '../core/rowLabel.js';
6
+ /**
7
+ * A row label for any Payload array field: the row's most telling value ("Sales team (sales)"),
8
+ * else "Item 1" with the field's singular label. The same rule names rows in the builder's
9
+ * inspector (`rowLabel` in `payload-canvas/core`). Set it as `admin.components.RowLabel`.
10
+ */
11
+ export function ArrayRowLabel({ field }) {
12
+ const { data, rowNumber } = useRowLabel();
13
+ const { i18n } = useTranslation();
14
+ const fields = field && 'fields' in field ? field.fields : [];
15
+ const labels = field && 'labels' in field ? field.labels : undefined;
16
+ const singular = labels?.singular;
17
+ // A label is a string or one string per language.
18
+ const name = typeof singular === 'object' && singular ? (singular[i18n.language] ?? singular) : singular;
19
+ // Payload's row number here is the 0-based row index.
20
+ return (_jsx("span", { className: "row-label", style: { pointerEvents: 'none' }, children: rowLabel(data, fields, rowNumber ?? 0, textOf(name)) }));
21
+ }
@@ -12,7 +12,7 @@ export function BuilderTab() {
12
12
  const { config: { routes }, } = useConfig();
13
13
  if (id === undefined || id === null || !collectionSlug)
14
14
  return null;
15
- return (_jsx(Button, { buttonStyle: "tab", className: "doc-tab", el: "link", margin: false, size: "medium", to: builderViewPath(routes.admin, collectionSlug, id),
15
+ return (_jsx(Button, { buttonStyle: "ghost", className: "doc-tab", el: "link", margin: false, size: "medium", to: builderViewPath(routes.admin, collectionSlug, id),
16
16
  // With `editor.openInBuilder`, opening the document later goes to the builder again.
17
17
  onClick: () => forgetForm(collectionSlug, id), children: _jsx("span", { className: "doc-tab__label", children: "Builder" }) }));
18
18
  }
@@ -1,5 +1,5 @@
1
1
  import type { DocumentViewClientProps } from 'payload';
2
- import './layoutField.scss';
2
+ import './layoutField.css';
3
3
  /**
4
4
  * The default edit view of a builder collection with `editor.openInBuilder` on
5
5
  * (`views.edit.default`). A saved document opens the full-screen builder instead of Payload's
@@ -1,11 +1,10 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { DefaultEditView, useConfig, useDocumentDrawerContext, useDocumentInfo } from '@payloadcms/ui';
4
- import { useRouter, useSearchParams } from 'next/navigation';
3
+ import { DefaultEditView, useConfig, useDocumentDrawerContext, useDocumentInfo, useRouter, useSearchParams } from '@payloadcms/ui';
5
4
  import { useEffect } from 'react';
6
5
  import { builderOpening, builderViewPath, FORM_PARAM, opensInBuilder } from '../plugin/links.js';
7
6
  import { formChosen, rememberForm } from './formChoice.js';
8
- import './layoutField.scss';
7
+ import './layoutField.css';
9
8
  /**
10
9
  * The default edit view of a builder collection with `editor.openInBuilder` on
11
10
  * (`views.edit.default`). A saved document opens the full-screen builder instead of Payload's
@@ -1,5 +1,5 @@
1
1
  import type { JSONFieldClientProps } from 'payload';
2
- import './layoutField.scss';
2
+ import './layoutField.css';
3
3
  /**
4
4
  * Field component of the layout JSON field: the page's sections in a box, with an "Open builder"
5
5
  * button. The builder itself opens full screen (`{admin}/builder/:collection/:id`). Inside the
@@ -7,7 +7,7 @@ import { builderViewPath } from '../plugin/links.js';
7
7
  import { blockSummary } from './editor/names.js';
8
8
  import { SettingsDrawerSlug } from './editor/topbar/settingsDrawer.js';
9
9
  import { forgetForm } from './formChoice.js';
10
- import './layoutField.scss';
10
+ import './layoutField.css';
11
11
  /** Top-level blocks named in the summary. */
12
12
  const SUMMARY_SECTIONS = 5;
13
13
  function readConfig(props) {
@@ -49,5 +49,5 @@ function LayoutSummary(props) {
49
49
  const collection = collectionSlug ?? config.collection;
50
50
  return (_jsxs("div", { className: "field-type builder-summary", children: [_jsx(FieldLabel, { label: label, path: path }), _jsxs("div", { className: "builder-summary__box", children: [_jsxs("div", { className: "builder-summary__head", children: [_jsx("p", { className: "builder-summary__count", children: total === 0
51
51
  ? 'No blocks yet'
52
- : `${count(layout.blocks.length, 'section', 'sections')} · ${count(total, 'block', 'blocks')}` }), saved && (_jsx(Button, { buttonStyle: "primary", el: "link", size: "small", margin: false, url: builderViewPath(routes.admin, collection, id), onClick: () => forgetForm(collection, id), children: "Open builder" }))] }), names.length > 0 && (_jsx("ol", { className: "builder-summary__list", children: names.map((name, i) => (_jsx("li", { children: name }, i))) })), more > 0 && _jsxs("p", { className: "builder-summary__more", children: ["and ", count(more, 'more section', 'more sections')] })] }), !saved && _jsx("p", { className: "field-description", children: "Save the document first. Then you can open the builder." })] }));
52
+ : `${count(layout.blocks.length, 'section', 'sections')} · ${count(total, 'block', 'blocks')}` }), saved && (_jsx(Button, { buttonStyle: "primary", el: "link", size: "medium", margin: false, url: builderViewPath(routes.admin, collection, id), onClick: () => forgetForm(collection, id), children: "Open builder" }))] }), names.length > 0 && (_jsx("ol", { className: "builder-summary__list", children: names.map((name, i) => (_jsx("li", { children: name }, i))) })), more > 0 && _jsxs("p", { className: "builder-summary__more", children: ["and ", count(more, 'more section', 'more sections')] })] }), !saved && _jsx("p", { className: "field-description", children: "Save the document first. Then you can open the builder." })] }));
53
53
  }
@@ -1,6 +1,6 @@
1
1
  import type { JSONFieldClientProps } from 'payload';
2
- import './editor/fields/fields.scss';
3
- import './templateConditions.scss';
2
+ import './editor/fields/fields.css';
3
+ import './templateConditions.css';
4
4
  /**
5
5
  * The templates collection's `conditions` field: the builder's condition rows (field, operator,
6
6
  * value, in "or" groups) over the fields of the template's target collection, with "Edit as JSON" for queries
@@ -3,8 +3,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useField, useFormFields } from '@payloadcms/ui';
4
4
  import { TEMPLATE_TARGET_FIELD } from '../core/bindings.js';
5
5
  import { WhereField } from './editor/fields/WhereField.js';
6
- import './editor/fields/fields.scss';
7
- import './templateConditions.scss';
6
+ import './editor/fields/fields.css';
7
+ import './templateConditions.css';
8
8
  /** The conditions test the document itself: a date value may be relative to now, nothing else. */
9
9
  const DATE_ONLY = { date: true };
10
10
  /**
@@ -0,0 +1,58 @@
1
+ /* The API key field of the AI settings global. Payload CSS variables only, no Tailwind. */
2
+ @layer payload-default {
3
+ .ai-key-field {
4
+ margin-bottom: var(--spacing-field, calc(1.0156rem * 1.5));
5
+ }
6
+
7
+ .ai-key-field__status {
8
+ margin: 0 0 calc(1.0156rem * 0.25);
9
+ color: var(--color-text);
10
+ font-size: var(--text-body-medium-font-size, 13px);
11
+ }
12
+
13
+ .ai-key-field__status--error {
14
+ color: var(--color-text-danger);
15
+ }
16
+
17
+ .ai-key-field__note {
18
+ margin: 0 0 calc(1.0156rem * 0.5);
19
+ color: var(--color-text-tertiary);
20
+ font-size: var(--text-body-small-font-size, 12px);
21
+ }
22
+
23
+ .ai-key-field__row {
24
+ display: flex;
25
+ flex-wrap: wrap;
26
+ align-items: center;
27
+ gap: calc(1.0156rem * 0.5);
28
+ margin-bottom: calc(1.0156rem * 0.5);
29
+ }
30
+
31
+ .ai-key-field__input {
32
+ flex: 1 1 calc(1.0156rem * 16);
33
+ min-width: 0;
34
+ height: calc(1.0156rem * 2);
35
+ padding: 0 calc(1.0156rem * 0.5);
36
+ border: 1px solid var(--color-border);
37
+ border-radius: var(--radius-medium, var(--radius-medium));
38
+ background: var(--field-color-bg);
39
+ color: var(--color-text);
40
+ font: inherit;
41
+ font-size: var(--text-body-medium-font-size, 13px);
42
+ box-sizing: border-box;
43
+ outline: none;
44
+ }
45
+
46
+ .ai-key-field__input:hover {
47
+ border-color: var(--color-border-control-strong);
48
+ }
49
+
50
+ .ai-key-field__input:focus {
51
+ border-color: var(--color-border-control-strong);
52
+ }
53
+
54
+ .ai-key-field__link {
55
+ color: var(--color-text);
56
+ font-size: var(--text-body-small-font-size, 12px);
57
+ }
58
+ }
@@ -1,4 +1,5 @@
1
1
  export { AiKeyField } from './AiKeyField.js';
2
+ export { ArrayRowLabel } from './ArrayRowLabel.js';
2
3
  export { BuilderTab } from './BuilderTab.js';
3
4
  export { DocumentEditView } from './DocumentEditView.js';
4
5
  export { PublishButton } from './editor/topbar/settingsDrawer.js';
@@ -6,7 +6,9 @@
6
6
  // 'payload-canvas/client#PublishButton' — Payload's Publish button, hidden in the builder's settings drawer
7
7
  // 'payload-canvas/client#TemplateConditionsField' — a template's conditions as condition rows
8
8
  // 'payload-canvas/client#AiKeyField' — an API key in the AI settings global ("Set, ends in …4f2a", Replace, Clear)
9
+ // 'payload-canvas/client#ArrayRowLabel' — a row label for any array field, from the row's own values (core `rowLabel`)
9
10
  export { AiKeyField } from './AiKeyField.js';
11
+ export { ArrayRowLabel } from './ArrayRowLabel.js';
10
12
  export { BuilderTab } from './BuilderTab.js';
11
13
  export { DocumentEditView } from './DocumentEditView.js';
12
14
  export { PublishButton } from './editor/topbar/settingsDrawer.js';
@@ -51,12 +51,12 @@ function ChangeRow({ change, settings }) {
51
51
  return (_jsxs("li", { className: `${base}__change ${base}__change--${change.kind}`, children: [_jsxs("div", { className: `${base}__head`, children: [_jsx("span", { className: `${base}__pill ${base}__pill--${change.kind}`, children: KIND_LABELS[change.kind] }), _jsx("strong", { className: `${base}__name`, children: change.name }), (change.kind === 'added' || change.kind === 'removed') && change.where ? (_jsxs("span", { className: `${base}__where`, children: ["in ", change.where] })) : null, (change.kind === 'added' || change.kind === 'removed') && change.inside > 0 ? (_jsxs("span", { className: `${base}__where`, children: ["with ", change.inside, " ", change.inside === 1 ? 'block' : 'blocks', " inside"] })) : null, change.kind === 'moved' ? (_jsxs("span", { className: `${base}__where`, children: ["from ", change.from, " to ", change.to] })) : null] }), change.kind === 'changed' ? (_jsx("ul", { className: `${base}__details`, children: change.details.map((detail, index) => (_jsx(Detail, { detail: detail, settings: settings }, index))) })) : null] }));
52
52
  }
53
53
  export function LayoutDiff(props) {
54
- const { comparisonValue, versionValue, field, clientField, i18n, locale, nestingLevel, selectedLocales } = props;
54
+ const { valueFrom, valueTo, field, clientField, i18n, locale, nestingLevel, selectedLocales } = props;
55
55
  const builder = field.admin?.custom?.builder;
56
56
  const settings = builder?.localization ?? null;
57
57
  // Translations follow the locales picked in the compare view; all of them when none are picked.
58
58
  const locales = settings && selectedLocales?.length ? selectedLocales : undefined;
59
- const changes = diffLayouts(comparisonValue, versionValue, { blocks: builder?.blocks ?? [], ...(locales ? { locales } : {}) });
59
+ const changes = diffLayouts(valueFrom, valueTo, { blocks: builder?.blocks ?? [], ...(locales ? { locales } : {}) });
60
60
  const label = fieldLabel(clientField?.label ?? field.label, i18n?.language ?? 'en', field.name);
61
- return (_jsxs("div", { className: `${base} nested-level-${nestingLevel ?? 0}`, children: [_jsxs(FieldDiffLabel, { children: [locale ? _jsx("span", { className: "field-diff__locale-label", children: locale }) : null, label] }), _jsxs("div", { className: `${base}__content`, children: [_jsx("p", { className: `${base}__summary`, children: summarizeLayoutChanges(changes) }), changes.length > 0 ? (_jsx("ul", { className: `${base}__list`, children: changes.map((change) => (_jsx(ChangeRow, { change: change, settings: settings }, `${change.kind}:${change.id}`))) })) : null, _jsx(LayoutJsonDiff, { from: comparisonValue, to: versionValue })] })] }));
61
+ return (_jsxs("div", { className: `${base} nested-level-${nestingLevel ?? 0}`, children: [_jsxs(FieldDiffLabel, { children: [locale ? _jsx("span", { className: "field-diff__locale-label", children: locale }) : null, label] }), _jsxs("div", { className: `${base}__content`, children: [_jsx("p", { className: `${base}__summary`, children: summarizeLayoutChanges(changes) }), changes.length > 0 ? (_jsx("ul", { className: `${base}__list`, children: changes.map((change) => (_jsx(ChangeRow, { change: change, settings: settings }, `${change.kind}:${change.id}`))) })) : null, _jsx(LayoutJsonDiff, { from: valueFrom, to: valueTo })] })] }));
62
62
  }
@@ -1,4 +1,4 @@
1
- import './layoutDiff.scss';
1
+ import './layoutDiff.css';
2
2
  export declare function LayoutJsonDiff({ from, to }: {
3
3
  from: unknown;
4
4
  to: unknown;
@@ -4,7 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  // JSON, old on the left and new on the right. Built only when someone opens it.
5
5
  import { escapeDiffHTML, getHTMLDiffComponents, unescapeDiffHTML } from '@payloadcms/ui';
6
6
  import { useMemo, useState } from 'react';
7
- import './layoutDiff.scss';
7
+ import './layoutDiff.css';
8
8
  function jsonHTML(value) {
9
9
  return `<p><pre>${escapeDiffHTML(JSON.stringify(value ?? null, null, 2))}</pre></p>`;
10
10
  }
@@ -0,0 +1,180 @@
1
+ /*
2
+ * The builder layout diff in Payload's Versions > compare view. Payload CSS variables only, no
3
+ * Tailwind. Colors come from Payload's own diff variables (`--diff-create-*`, `--diff-delete-*`),
4
+ * with theme fallbacks, so it matches the other fields' diffs in light and dark theme.
5
+ */
6
+ @layer payload-default {
7
+ .layout-diff {
8
+ position: relative;
9
+ }
10
+
11
+ .layout-diff__content {
12
+ display: flex;
13
+ flex-direction: column;
14
+ gap: calc(1.0156rem * 0.5);
15
+ background: var(--color-bg-secondary);
16
+ padding: calc(1.0156rem * 0.5);
17
+ }
18
+
19
+ .layout-diff__summary {
20
+ margin: 0;
21
+ color: var(--color-text);
22
+ font-weight: 500;
23
+ }
24
+
25
+ .layout-diff__list, .layout-diff__details {
26
+ list-style: none;
27
+ margin: 0;
28
+ padding: 0;
29
+ }
30
+
31
+ .layout-diff__list {
32
+ display: flex;
33
+ flex-direction: column;
34
+ gap: calc(1.0156rem * 0.25);
35
+ }
36
+
37
+ .layout-diff__change {
38
+ padding: calc(1.0156rem * 0.4) calc(1.0156rem * 0.5);
39
+ border: 1px solid var(--color-border);
40
+ border-radius: var(--radius-medium);
41
+ background: var(--color-bg);
42
+ }
43
+
44
+ .layout-diff__head {
45
+ display: flex;
46
+ flex-wrap: wrap;
47
+ align-items: baseline;
48
+ gap: calc(1.0156rem * 0.3);
49
+ min-width: 0;
50
+ }
51
+
52
+ .layout-diff__pill {
53
+ flex: none;
54
+ padding: 0 calc(1.0156rem * 0.25);
55
+ border: 1px solid var(--color-border);
56
+ border-radius: var(--radius-medium);
57
+ background: var(--color-bg-hover);
58
+ color: var(--color-text);
59
+ font-size: calc(1.0156rem * 0.55);
60
+ font-weight: 600;
61
+ line-height: 1.6;
62
+ text-transform: uppercase;
63
+ letter-spacing: 0.04em;
64
+ }
65
+
66
+ .layout-diff__pill--added {
67
+ border-color: var(--diff-create-pill-border, var(--color-border-brand));
68
+ background: var(--diff-create-pill-bg, var(--color-bg-selected-hover));
69
+ color: var(--diff-create-pill-color, var(--color-text-brand));
70
+ }
71
+
72
+ .layout-diff__pill--removed {
73
+ border-color: var(--diff-delete-pill-border, var(--color-border-danger));
74
+ background: var(--diff-delete-pill-bg, var(--color-bg-danger-tertiary-hover));
75
+ color: var(--diff-delete-pill-color, var(--color-text-danger));
76
+ }
77
+
78
+ .layout-diff__name {
79
+ min-width: 0;
80
+ overflow-wrap: anywhere;
81
+ }
82
+
83
+ .layout-diff__where {
84
+ color: var(--color-text-secondary);
85
+ }
86
+
87
+ .layout-diff__details {
88
+ display: flex;
89
+ flex-direction: column;
90
+ gap: calc(1.0156rem * 0.2);
91
+ margin-top: calc(1.0156rem * 0.3);
92
+ padding-inline-start: calc(1.0156rem * 0.5);
93
+ border-inline-start: 2px solid var(--color-border);
94
+ }
95
+
96
+ .layout-diff__detail {
97
+ display: flex;
98
+ flex-wrap: wrap;
99
+ align-items: baseline;
100
+ gap: calc(1.0156rem * 0.25);
101
+ min-width: 0;
102
+ }
103
+
104
+ .layout-diff__detail-label {
105
+ display: inline-flex;
106
+ align-items: baseline;
107
+ gap: calc(1.0156rem * 0.2);
108
+ color: var(--color-text-secondary);
109
+ }
110
+
111
+ .layout-diff__detail-label::after {
112
+ content: ":";
113
+ }
114
+
115
+ .layout-diff__detail-label .field-diff__locale-label {
116
+ margin: 0;
117
+ }
118
+
119
+ .layout-diff__value, .layout-diff__class {
120
+ padding: 0 calc(1.0156rem * 0.15);
121
+ border-radius: var(--radius-medium);
122
+ text-decoration: none;
123
+ overflow-wrap: anywhere;
124
+ }
125
+
126
+ .layout-diff__value--del {
127
+ background: var(--diff-delete-parent-bg, var(--color-bg-danger-tertiary));
128
+ color: var(--diff-delete-parent-color, var(--color-text-danger));
129
+ text-decoration: line-through;
130
+ text-decoration-color: var(--diff-delete-pill-border, var(--color-border-danger));
131
+ }
132
+
133
+ .layout-diff__value--ins {
134
+ background: var(--diff-create-parent-bg, var(--color-bg-selected));
135
+ color: var(--diff-create-parent-color, var(--color-text-brand));
136
+ }
137
+
138
+ .layout-diff__class {
139
+ font-family: var(--font-mono, ui-monospace, monospace);
140
+ font-size: calc(1.0156rem * 0.55);
141
+ }
142
+
143
+ .layout-diff__empty {
144
+ color: var(--color-text-tertiary);
145
+ font-style: italic;
146
+ }
147
+
148
+ .layout-diff__arrow {
149
+ color: var(--color-text-tertiary);
150
+ }
151
+
152
+ .layout-diff__json {
153
+ border-top: 1px solid var(--color-border);
154
+ padding-top: calc(1.0156rem * 0.4);
155
+ }
156
+
157
+ .layout-diff__json-summary {
158
+ cursor: pointer;
159
+ color: var(--color-text-secondary);
160
+ width: fit-content;
161
+ }
162
+
163
+ .layout-diff__json-summary:hover {
164
+ color: var(--color-text);
165
+ }
166
+
167
+ .layout-diff__json-content {
168
+ display: grid;
169
+ /* Same columns as Payload's field diffs: old on the left, new on the right. */
170
+ grid-template-columns: calc(50% - 1.0156rem * 0.5) calc(50% - 1.0156rem * 0.5);
171
+ gap: 1.0156rem;
172
+ margin-top: calc(1.0156rem * 0.5);
173
+ overflow-x: auto;
174
+ }
175
+
176
+ .layout-diff__json-content pre {
177
+ white-space: pre-wrap;
178
+ overflow-wrap: anywhere;
179
+ }
180
+ }
@@ -1,8 +1,8 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import type { BuilderClientConfig } from '../../core/types.js';
3
3
  import type { BuilderDocMeta } from '../../live/types.js';
4
- import './layout/layout.scss';
5
- import './dnd/dnd.scss';
4
+ import './layout/layout.css';
5
+ import './dnd/dnd.css';
6
6
  type EditorProps = {
7
7
  config: BuilderClientConfig;
8
8
  /** The document as the server loaded it. */
@@ -9,11 +9,13 @@ import { DragLayer } from './DragLayer.js';
9
9
  import { dropAt, endSmoothDrag, isSmoothDrag, MAKE_ROOM_EASING, SETTLE_EASING, startSmoothDrag } from './dnd/smooth.js';
10
10
  import { Inspector } from './Inspector.js';
11
11
  import { CommentsOrInspector } from './comments/CommentsPanel.js';
12
+ import { useCommentFromURL } from './comments/useCommentFromURL.js';
12
13
  import { LeftPanel } from './layout/LeftPanel.js';
14
+ import { selectLeftTab } from './layout/leftTabs.js';
13
15
  import { applySizes, readSizes } from './layout/panels.js';
14
16
  import { Splitter } from './layout/Splitter.js';
15
- import './layout/layout.scss';
16
- import './dnd/dnd.scss';
17
+ import './layout/layout.css';
18
+ import './dnd/dnd.css';
17
19
  import { SectionDialog } from './sections/SectionDialog.js';
18
20
  import { createRuntime, RuntimeContext, toCanvasPoint } from './runtime.js';
19
21
  import { bindShortcuts } from './shortcuts.js';
@@ -62,6 +64,7 @@ export function Editor({ config, meta, icon, locale, canEditDesign }) {
62
64
  useFollow(runtime);
63
65
  useTemplateController(runtime);
64
66
  useComponentRefresh(runtime);
67
+ useCommentFromURL(runtime);
65
68
  useEffect(() => runtime.assistant?.setDocument(config.collection, docId), [runtime, config.collection, docId]);
66
69
  useEffect(() => () => runtime.assistant?.stop(), [runtime]);
67
70
  // The hidden thumbnail iframe goes with the editor.
@@ -117,6 +120,10 @@ export function Editor({ config, meta, icon, locale, canEditDesign }) {
117
120
  rect: initial ? { x: initial.left, y: initial.top, width: initial.width, height: initial.height } : null,
118
121
  fromOutline: String(active.id).startsWith('outline:'),
119
122
  });
123
+ // A block or section from the library: Layers opens at once (as in Webflow), so the drop can go
124
+ // in the tree or on the canvas. The library item stays mounted in its hidden panel, so the drag lives on.
125
+ if (data.source.kind === 'new')
126
+ selectLeftTab(runtime, 'layers');
120
127
  stopAutoScroll.current = startAutoScroll(runtime);
121
128
  };
122
129
  const onDragMove = ({ collisions }) => {
@@ -150,7 +157,7 @@ export function Editor({ config, meta, icon, locale, canEditDesign }) {
150
157
  return insertBlocks(runtime, section, target.to);
151
158
  if (source.kind === 'block')
152
159
  return runtime.store.apply({ type: 'move', id: source.id, to: target.to }, { select: source.id });
153
- const block = runtime.createBlock(source.blockType);
160
+ const block = runtime.createBlock(source.blockType, target.to);
154
161
  if (!block || !runtime.store.apply({ type: 'insert', block, to: target.to }, { select: block.id, newContent: true }))
155
162
  return false;
156
163
  runtime.focusRequest.set(block.id);
@@ -4,6 +4,7 @@ import { CheckboxInput, TextInput } from '@payloadcms/ui';
4
4
  import { useDeferredValue, useEffect, useState } from 'react';
5
5
  import { blockParts, findBlock, getBlockDefinition, htmlIdProblem, htmlIdsOf } from '../../core/index.js';
6
6
  import { BlockIcon, Icon } from './icons.js';
7
+ import { Tabs } from './ui/Tabs.js';
7
8
  import { useContentMode } from './contentMode.js';
8
9
  import { blockMenuEntries } from './menu/blockMenu.js';
9
10
  import { MenuButton } from './menu/Menu.js';
@@ -18,7 +19,7 @@ import { useAccessRefresh } from './fields/access.js';
18
19
  import { InputError } from './fields/CheckedInputs.js';
19
20
  import { BlockContentFields } from './renderField.js';
20
21
  import { useRuntime } from './runtime.js';
21
- import { storesBuilderData } from './actions.js';
22
+ import { storesBuilderData, storesClasses } from './actions.js';
22
23
  import { shortcutList } from './shortcuts.js';
23
24
  import { useEditor } from './store.js';
24
25
  import { StylesPanel } from './styles/StylesPanel.js';
@@ -28,9 +29,6 @@ import { useOptionalValue, useValue, useValueSelector } from './valueStore.js';
28
29
  import { RegionPane } from './regions/RegionPane.js';
29
30
  import { SECTION_REF_BLOCK } from '../../blocks/builtins/sectionRef.js';
30
31
  import { ComponentBanner, ComponentValuesPanel } from './sections/ComponentFields.js';
31
- function Tabs({ value, options, onChange, variant = 'underline' }) {
32
- return (_jsx("div", { className: variant === 'segmented' ? 'builder-editor__segmented builder-editor__segmented--full' : 'builder-editor__tabs', role: "tablist", children: options.map((option) => (_jsxs("button", { type: "button", role: "tab", "aria-selected": value === option.id, className: variant === 'segmented' ? 'builder-editor__segment' : 'builder-editor__tab', onClick: () => onChange(option.id), children: [option.icon && _jsx(Icon, { name: option.icon, size: 13 }), option.label] }, option.id))) }));
33
- }
34
32
  export function Inspector() {
35
33
  const runtime = useRuntime();
36
34
  const { inspectorRef } = runtime;
@@ -86,8 +84,10 @@ function saveTabChoice(tab) {
86
84
  }
87
85
  }
88
86
  /** The tab a block opens on: the chosen tab, unless the block has nothing to show there. */
89
- function tabFor(chosen, def, justAdded) {
87
+ function tabFor(chosen, def, justAdded, allTabs) {
90
88
  const hasFields = (def?.fields.length ?? 0) > 0;
89
+ if (!allTabs && chosen !== 'content' && chosen !== 'styles')
90
+ return 'content';
91
91
  // A block that was just added opens on its content, so typing starts at once.
92
92
  if (justAdded && hasFields)
93
93
  return 'content';
@@ -119,7 +119,9 @@ function BlockPane() {
119
119
  const def = block ? getBlockDefinition(runtime.config.blocks, block.type) : undefined;
120
120
  // Content mode edits content only: no Styles, Motion or Advanced tab.
121
121
  const contentMode = useContentMode(runtime);
122
- const tab = storesBuilderData(runtime) && !contentMode ? tabFor(chosen, def, block !== null && block.id === addedId) : 'content';
122
+ // A Payload blocks field keeps only the classes of blocks with class keys: Content and Styles.
123
+ const styled = block !== null && storesClasses(runtime, block.type);
124
+ const tab = styled && !contentMode ? tabFor(chosen, def, block !== null && block.id === addedId, storesBuilderData(runtime)) : 'content';
123
125
  const setTab = (next) => {
124
126
  setAddedId(null);
125
127
  setChosen(next);
@@ -138,17 +140,21 @@ function BlockPane() {
138
140
  });
139
141
  return () => cancelAnimationFrame(frame);
140
142
  }, [block, focusRequest, runtime]);
141
- if (!block)
142
- return region && runtime.regions ? _jsx(RegionPane, { regions: runtime.regions, name: region }, region) : _jsx(EmptyState, {});
143
- return (_jsxs("div", { className: "builder-editor__block-pane", children: [_jsx(BlockHeader, { block: block }), _jsx(BlockProblems, { blockId: block.id }), _jsx(EditingBanner, { blockId: block.id }), _jsx(LocaleNote, { blockId: block.id, tab: tab }), !contentMode && (_jsx(Tabs, { value: tab, onChange: setTab, options: storesBuilderData(runtime)
144
- ? [
145
- { id: 'content', label: 'Content' },
146
- { id: 'styles', label: 'Styles' },
147
- { id: 'motion', label: 'Motion' },
148
- { id: 'advanced', label: 'Advanced' },
149
- ]
150
- : // A Payload blocks field holds the blocks' own fields only.
151
- [{ id: 'content', label: 'Content' }] })), tab === 'content' && _jsx(BlockContentFields, { block: block }), tab === 'content' && block.type === SECTION_REF_BLOCK && _jsx(ComponentValuesPanel, { block: block }), tab === 'styles' && storesBuilderData(runtime) && _jsx(StyleFields, { block: block }), tab === 'motion' && storesBuilderData(runtime) && _jsx(MotionPanel, { blockId: block.id, blockType: block.type, motion: block.motion }), tab === 'advanced' && storesBuilderData(runtime) && _jsx(AdvancedFields, { block: block })] }, block.id));
143
+ if (!block) {
144
+ // A selected region shows its pane. Without a selection, a panel region (a form's settings) shows its fields.
145
+ const shownRegion = region ?? runtime.regions?.config.find((r) => r.panel)?.name ?? null;
146
+ return shownRegion && runtime.regions ? _jsx(RegionPane, { regions: runtime.regions, name: shownRegion }, shownRegion) : _jsx(EmptyState, {});
147
+ }
148
+ return (_jsxs("div", { className: "builder-editor__block-pane", children: [_jsx(BlockHeader, { block: block }), _jsx(BlockProblems, { blockId: block.id }), _jsx(EditingBanner, { blockId: block.id }), _jsx(LocaleNote, { blockId: block.id, tab: tab }), !contentMode && styled && (_jsx(Tabs, { value: tab, onChange: setTab, options: [
149
+ { id: 'content', label: 'Content' },
150
+ { id: 'styles', label: 'Styles' },
151
+ ...(storesBuilderData(runtime)
152
+ ? [
153
+ { id: 'motion', label: 'Motion' },
154
+ { id: 'advanced', label: 'Advanced' },
155
+ ]
156
+ : []),
157
+ ] })), tab === 'content' && _jsx(BlockContentFields, { block: block }), tab === 'content' && block.type === SECTION_REF_BLOCK && _jsx(ComponentValuesPanel, { block: block }), tab === 'styles' && styled && _jsx(StyleFields, { block: block }), tab === 'motion' && storesBuilderData(runtime) && _jsx(MotionPanel, { blockId: block.id, blockType: block.type, motion: block.motion }), tab === 'advanced' && storesBuilderData(runtime) && _jsx(AdvancedFields, { block: block })] }, block.id));
152
158
  }
153
159
  /** What stopped the last publish, for this block. */
154
160
  function BlockProblems({ blockId }) {
@@ -1,8 +1,8 @@
1
1
  import type { SectionDefinition } from '../../core/types.js';
2
2
  /**
3
3
  * A library tab of the left panel: blocks or ready-made sections, with a search field. Drag an
4
- * item onto the canvas (or the Layers tab, which opens the tree), or click it to insert it at the
5
- * selection.
4
+ * item onto the canvas or into the Layers tree (Layers opens when the drag starts), or click it to
5
+ * insert it at the selection (Layers then opens with the new block selected).
6
6
  */
7
7
  export declare function Library({ kind }: {
8
8
  kind: 'blocks' | 'sections';