payload-canvas 0.6.0 → 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 (164) hide show
  1. package/README.md +17 -17
  2. package/dist/admin/AiKeyField.d.ts +4 -3
  3. package/dist/admin/AiKeyField.js +3 -3
  4. package/dist/admin/BuilderTab.js +1 -1
  5. package/dist/admin/DocumentEditView.d.ts +1 -1
  6. package/dist/admin/DocumentEditView.js +2 -3
  7. package/dist/admin/LayoutField.d.ts +1 -1
  8. package/dist/admin/LayoutField.js +2 -2
  9. package/dist/admin/TemplateConditionsField.d.ts +2 -2
  10. package/dist/admin/TemplateConditionsField.js +2 -2
  11. package/dist/admin/aiKeyField.css +58 -0
  12. package/dist/admin/diff/LayoutDiff.js +3 -3
  13. package/dist/admin/diff/LayoutJsonDiff.d.ts +1 -1
  14. package/dist/admin/diff/LayoutJsonDiff.js +1 -1
  15. package/dist/admin/diff/layoutDiff.css +180 -0
  16. package/dist/admin/editor/Editor.d.ts +2 -2
  17. package/dist/admin/editor/Editor.js +2 -2
  18. package/dist/admin/editor/Library.js +1 -2
  19. package/dist/admin/editor/assistant/AssistantPanel.d.ts +1 -1
  20. package/dist/admin/editor/assistant/AssistantPanel.js +1 -1
  21. package/dist/admin/editor/assistant/{assistant.scss → assistant.css} +322 -315
  22. package/dist/admin/editor/classes/ClassManager.d.ts +1 -1
  23. package/dist/admin/editor/classes/ClassManager.js +1 -1
  24. package/dist/admin/editor/classes/manager.css +258 -0
  25. package/dist/admin/editor/comments/CommentLayer.d.ts +1 -1
  26. package/dist/admin/editor/comments/CommentLayer.js +1 -1
  27. package/dist/admin/editor/comments/CommentsPanel.d.ts +1 -1
  28. package/dist/admin/editor/comments/CommentsPanel.js +1 -1
  29. package/dist/admin/editor/comments/{comments.scss → comments.css} +121 -140
  30. package/dist/admin/editor/comments/useCommentFromURL.js +1 -1
  31. package/dist/admin/editor/dnd/{dnd.scss → dnd.css} +78 -80
  32. package/dist/admin/editor/{editor.scss → editor.css} +782 -763
  33. package/dist/admin/editor/empty/EmptyStart.d.ts +1 -1
  34. package/dist/admin/editor/empty/EmptyStart.js +3 -3
  35. package/dist/admin/editor/empty/{empty.scss → empty.css} +12 -13
  36. package/dist/admin/editor/fields/FormBlock.js +3 -3
  37. package/dist/admin/editor/fields/fields.css +786 -0
  38. package/dist/admin/editor/generate/GenerateImage.d.ts +1 -1
  39. package/dist/admin/editor/generate/GenerateImage.js +1 -1
  40. package/dist/admin/editor/generate/{generate.scss → generate.css} +83 -82
  41. package/dist/admin/editor/layout/layout.css +243 -0
  42. package/dist/admin/editor/layout/panels.js +1 -1
  43. package/dist/admin/editor/live/PresenceUI.d.ts +1 -1
  44. package/dist/admin/editor/live/PresenceUI.js +2 -2
  45. package/dist/admin/editor/live/{presence.scss → presence.css} +5 -4
  46. package/dist/admin/editor/locale/LocaleField.d.ts +1 -1
  47. package/dist/admin/editor/locale/LocaleField.js +1 -1
  48. package/dist/admin/editor/locale/LocaleSwitcher.d.ts +1 -1
  49. package/dist/admin/editor/locale/LocaleSwitcher.js +1 -1
  50. package/dist/admin/editor/locale/locale.css +153 -0
  51. package/dist/admin/editor/media/ImageEditor.d.ts +1 -1
  52. package/dist/admin/editor/media/ImageEditor.js +1 -1
  53. package/dist/admin/editor/media/{media.scss → media.css} +67 -67
  54. package/dist/admin/editor/menu/Menu.d.ts +1 -1
  55. package/dist/admin/editor/menu/Menu.js +1 -1
  56. package/dist/admin/editor/menu/menu.css +132 -0
  57. package/dist/admin/editor/motion/MotionPanel.d.ts +2 -2
  58. package/dist/admin/editor/motion/MotionPanel.js +2 -2
  59. package/dist/admin/editor/motion/{motion.scss → motion.css} +24 -21
  60. package/dist/admin/editor/regions/RegionPane.js +1 -1
  61. package/dist/admin/editor/renderField.d.ts +1 -1
  62. package/dist/admin/editor/renderField.js +1 -1
  63. package/dist/admin/editor/sections/ComponentFields.d.ts +1 -1
  64. package/dist/admin/editor/sections/ComponentFields.js +2 -3
  65. package/dist/admin/editor/sections/PropertyControls.d.ts +1 -1
  66. package/dist/admin/editor/sections/PropertyControls.js +1 -1
  67. package/dist/admin/editor/sections/components.css +244 -0
  68. package/dist/admin/editor/sections/variants.css +93 -0
  69. package/dist/admin/editor/sections/variants.d.ts +1 -1
  70. package/dist/admin/editor/sections/variants.js +1 -1
  71. package/dist/admin/editor/styles/ClassBar.d.ts +1 -1
  72. package/dist/admin/editor/styles/ClassBar.js +1 -1
  73. package/dist/admin/editor/styles/StylesPanel.d.ts +1 -1
  74. package/dist/admin/editor/styles/StylesPanel.js +1 -1
  75. package/dist/admin/editor/styles/{classes.scss → classes.css} +128 -125
  76. package/dist/admin/editor/styles/{styles.scss → styles.css} +368 -370
  77. package/dist/admin/editor/templates/Bindable.d.ts +1 -1
  78. package/dist/admin/editor/templates/Bindable.js +1 -1
  79. package/dist/admin/editor/templates/binding.js +4 -1
  80. package/dist/admin/editor/templates/{templates.scss → templates.css} +207 -206
  81. package/dist/admin/editor/tooltip/Tooltips.d.ts +1 -1
  82. package/dist/admin/editor/tooltip/Tooltips.js +1 -1
  83. package/dist/admin/editor/tooltip/{tooltip.scss → tooltip.css} +11 -10
  84. package/dist/admin/editor/topbar/ContentModeToggle.d.ts +1 -1
  85. package/dist/admin/editor/topbar/ContentModeToggle.js +1 -1
  86. package/dist/admin/editor/topbar/DocumentActions.js +1 -2
  87. package/dist/admin/editor/topbar/TopBar.d.ts +1 -1
  88. package/dist/admin/editor/topbar/TopBar.js +2 -3
  89. package/dist/admin/editor/topbar/{contentMode.scss → contentMode.css} +7 -8
  90. package/dist/admin/editor/topbar/screens/DrawerRouter.d.ts +1 -1
  91. package/dist/admin/editor/topbar/screens/DrawerRouter.js +52 -40
  92. package/dist/admin/editor/topbar/screens/ScreenDrawer.d.ts +1 -1
  93. package/dist/admin/editor/topbar/screens/ScreenDrawer.js +4 -5
  94. package/dist/admin/editor/topbar/screens/drawerRouterSupport.d.ts +5 -5
  95. package/dist/admin/editor/topbar/screens/drawerRouterSupport.js +7 -7
  96. package/dist/admin/editor/topbar/screens/screens.css +139 -0
  97. package/dist/admin/editor/topbar/settingsDrawer.css +33 -0
  98. package/dist/admin/editor/topbar/settingsDrawer.d.ts +1 -1
  99. package/dist/admin/editor/topbar/settingsDrawer.js +3 -3
  100. package/dist/admin/editor/topbar/{topbar.scss → topbar.css} +189 -191
  101. package/dist/admin/editor/ui/Select.d.ts +1 -1
  102. package/dist/admin/editor/ui/Select.js +1 -1
  103. package/dist/admin/editor/ui/Slider.d.ts +1 -1
  104. package/dist/admin/editor/ui/Slider.js +1 -1
  105. package/dist/admin/editor/ui/controls.css +301 -0
  106. package/dist/admin/forms/SubmissionCells.d.ts +1 -1
  107. package/dist/admin/forms/SubmissionCells.js +1 -1
  108. package/dist/admin/forms/SubmissionView.d.ts +1 -1
  109. package/dist/admin/forms/SubmissionView.js +1 -1
  110. package/dist/admin/forms/submissionData.d.ts +1 -1
  111. package/dist/admin/forms/submissionData.js +1 -1
  112. package/dist/admin/forms/submissions.css +200 -0
  113. package/dist/admin/layoutField.css +70 -0
  114. package/dist/admin/screen/BuilderScreen.d.ts +1 -1
  115. package/dist/admin/screen/BuilderScreen.js +1 -1
  116. package/dist/admin/templateConditions.css +25 -0
  117. package/dist/ai/images/service.js +2 -2
  118. package/dist/ai/settings/index.js +3 -0
  119. package/dist/classes/collection.js +1 -0
  120. package/dist/classes/sheet.js +2 -0
  121. package/dist/comments/collection.js +3 -0
  122. package/dist/core/fieldHooks.d.ts +1 -1
  123. package/dist/forms/submissionsAdmin.js +1 -1
  124. package/dist/forms/uploads.js +2 -2
  125. package/dist/live/draftAccess.js +1 -1
  126. package/dist/plugin/index.js +2 -2
  127. package/dist/plugin/sections.js +3 -0
  128. package/dist/plugin/templates.js +5 -1
  129. package/dist/react/canvas/inline/candidates.js +2 -2
  130. package/dist/react/canvas/inline/rich/editor.js +9 -1
  131. package/dist/react/components/Image.d.ts +1 -1
  132. package/dist/react/components/Image.js +2 -2
  133. package/dist/react/render/resolve.js +2 -0
  134. package/dist/react/render/templates.js +3 -1
  135. package/dist/react/server.js +1 -1
  136. package/dist/react/theme/ThemeStyle.js +1 -1
  137. package/dist/theme/admin/ColorField.d.ts +4 -3
  138. package/dist/theme/admin/ColorField.js +1 -1
  139. package/dist/theme/admin/FontField.d.ts +4 -3
  140. package/dist/theme/admin/FontField.js +1 -1
  141. package/dist/theme/admin/SaveSignal.js +1 -1
  142. package/dist/theme/admin/SliderField.d.ts +1 -1
  143. package/dist/theme/admin/SliderField.js +1 -1
  144. package/dist/theme/admin/Variables.d.ts +4 -3
  145. package/dist/theme/admin/Variables.js +2 -2
  146. package/dist/theme/admin/fields.css +327 -0
  147. package/dist/theme/global.js +2 -0
  148. package/package.json +25 -24
  149. package/dist/admin/aiKeyField.scss +0 -58
  150. package/dist/admin/diff/layoutDiff.scss +0 -181
  151. package/dist/admin/editor/classes/manager.scss +0 -262
  152. package/dist/admin/editor/fields/fields.scss +0 -778
  153. package/dist/admin/editor/layout/layout.scss +0 -240
  154. package/dist/admin/editor/locale/locale.scss +0 -154
  155. package/dist/admin/editor/menu/menu.scss +0 -132
  156. package/dist/admin/editor/sections/components.scss +0 -238
  157. package/dist/admin/editor/sections/variants.scss +0 -90
  158. package/dist/admin/editor/topbar/screens/screens.scss +0 -134
  159. package/dist/admin/editor/topbar/settingsDrawer.scss +0 -32
  160. package/dist/admin/editor/ui/controls.scss +0 -320
  161. package/dist/admin/forms/submissions.scss +0 -197
  162. package/dist/admin/layoutField.scss +0 -69
  163. package/dist/admin/templateConditions.scss +0 -24
  164. package/dist/theme/admin/fields.scss +0 -363
package/README.md CHANGED
@@ -15,11 +15,11 @@
15
15
  </tr>
16
16
  </table>
17
17
 
18
- A visual page builder for Payload CMS 3. It adds a full-screen builder to the collections you choose. Editors drag blocks onto a live canvas, nest them without limit, and style them with Tailwind classes. AI agents can build and edit the same pages over MCP, and an open editor shows each AI change as it happens.
18
+ A visual page builder for Payload CMS 4. This is the Payload 4 line, published as `payload-canvas@next`; `payload-canvas@latest` (0.6.x) is for Payload 3. It adds a full-screen builder to the collections you choose. Editors drag blocks onto a live canvas, nest them without limit, and style them with Tailwind classes. AI agents can build and edit the same pages over MCP, and an open editor shows each AI change as it happens.
19
19
 
20
20
  The npm package is `payload-canvas`.
21
21
 
22
- - Works in any Payload 3.90+ app on Next.js 16 and React 19.
22
+ - Works in any Payload 4 app (`^4.0.0-beta.8`) on Next.js 16.4.1+ and React 19.3.1+.
23
23
  - The layout is one JSON field per document. Nothing changes in your other fields.
24
24
  - The site renders the layout with `payload-canvas/react` (React Server Components), or with your own renderer.
25
25
  - Save, drafts, autosave, versions and access control stay Payload's own.
@@ -30,7 +30,7 @@ One package holds everything: the Payload plugin and admin editor (`payload-canv
30
30
  **Quick start.** Add the builder to an existing Payload app with the [install guide](#install) (about ten minutes). Or create a new project from the starter app:
31
31
 
32
32
  ```bash
33
- npx create-payload-canvas my-website
33
+ npx create-payload-canvas@next my-website
34
34
  ```
35
35
 
36
36
  The starter also has a calmer Payload admin: a sidebar in groups with icons, a neutral look in light and dark mode, list cells that show values by field type (a check mark, option chips, short dates, "3 links", a rich text excerpt) instead of raw code, array rows named by their content, and a dashboard with quick actions, recent edits, open comments, form messages, site checks, broken links (a 404 log and links to missing pages), unused media, scheduled publishes and optional Plausible or Umami numbers. Each part is plain code in `src/admin/` of the starter. The CLI asks which parts to keep (see [Features](../create-payload-canvas/README.md#features)).
@@ -74,24 +74,24 @@ The starter also has a calmer Payload admin: a sidebar in groups with icons, a n
74
74
 
75
75
  ## Requirements
76
76
 
77
- - `payload`, `@payloadcms/ui`, `@payloadcms/richtext-lexical` 3.90 or later (Payload 3 only, not the Payload 4 canary)
78
- - `next` 16.3 or later, `react` and `react-dom` 19.2 or later
77
+ - `payload`, `@payloadcms/ui`, `@payloadcms/richtext-lexical` 4.0.0-beta.8 or a later 4.x (for Payload 3, use `payload-canvas@latest`)
78
+ - `next` 16.4.1 or later, `react` and `react-dom` 19.3.1 or later
79
79
  - `tailwindcss` 4.3 or later (the plugin compiles your Tailwind entry CSS)
80
- - Node.js 20.9 or later
80
+ - Node.js 24.22.1 or later
81
81
  - Any Payload database adapter. Postgres and SQLite store the layout as `jsonb`/JSON.
82
82
 
83
- You do not need `transpilePackages` or a `sass` install. The package ships compiled JavaScript. The admin styles are `.scss` files, and Next compiles them with the `sass` that `@payloadcms/next` already installs, the same way it compiles Payload's own admin styles.
83
+ You do not need `transpilePackages` or a `sass` install. The package ships compiled JavaScript and plain CSS. The admin styles use Payload 4's CSS variables (`--color-*`, `--radius-*`, `--text-*`), so they follow Payload's light and dark theme.
84
84
 
85
85
  Peer dependencies:
86
86
 
87
87
  | Package | Range | Needed for |
88
88
  |---|---|---|
89
- | `payload`, `@payloadcms/ui`, `@payloadcms/richtext-lexical` | `^3.90.0` | everything |
90
- | `next` | `^16.3.0` | everything |
91
- | `react`, `react-dom` | `^19.2.0` | everything |
89
+ | `payload`, `@payloadcms/ui`, `@payloadcms/richtext-lexical` | `^4.0.0-beta.8` | everything |
90
+ | `next` | `^16.4.1` | everything |
91
+ | `react`, `react-dom` | `^19.3.1` | everything |
92
92
  | `tailwindcss` | `^4.3.0` | the CSS compile on save and in the canvas |
93
93
  | `@anthropic-ai/sdk` | `>=0.131.0`, optional | only the `/ai/anthropic` adapter |
94
- | `payload-mcp-toolkit` | `>=0.9.0`, optional | only `builderMcpTools()` (`/mcp`) |
94
+ | `payload-mcp-toolkit` | `>=0.12.0-next.0`, optional | only `builderMcpTools()` (`/mcp`). Do not add `@payloadcms/plugin-mcp` next to it: both serve `/api/mcp`. |
95
95
  | `zod` | `^3.25 \|\| ^4`, optional | only `builderMcpTools()` (`/mcp`) |
96
96
 
97
97
  ## Install
@@ -99,18 +99,18 @@ Peer dependencies:
99
99
  These steps start from a blank Payload app with Postgres:
100
100
 
101
101
  ```bash
102
- npx create-payload-app@latest -n my-site -t blank --db postgres --use-pnpm
102
+ npx create-payload-app@beta -n my-site -t blank --db postgres --use-pnpm
103
103
  ```
104
104
 
105
- They were tested step by step on such an app with Payload 3.90.2, Next.js 16.3.3, React 19.2.6, Tailwind 4.3.3, TypeScript 5.7 and pnpm 10, in `next dev` and in `next build` + `next start`. An existing Payload app works the same way: skip what you already have.
105
+ They were written for Payload 3 and checked again on Payload 4.0.0-beta.8 with Next.js 16.4.6 and React 19.3.1 through the starter app. An existing Payload app works the same way: skip what you already have.
106
106
 
107
107
  ### 1. Add the package
108
108
 
109
109
  ```bash
110
- pnpm add payload-canvas tailwindcss @tailwindcss/postcss postcss
110
+ pnpm add payload-canvas@next tailwindcss @tailwindcss/postcss postcss
111
111
  ```
112
112
 
113
- With npm: `npm install payload-canvas tailwindcss @tailwindcss/postcss postcss`.
113
+ With npm: `npm install payload-canvas@next tailwindcss @tailwindcss/postcss postcss`.
114
114
 
115
115
  ### 2. Add a collection with pages
116
116
 
@@ -3207,13 +3207,13 @@ All entries must show one version. Pin `payload`, `@payloadcms/*` and `next` to
3207
3207
 
3208
3208
  **After adding `payload-mcp-toolkit`, `user.email` fails to typecheck.** The toolkit adds an API-key auth strategy, so `req.user` and `payload.auth()` can return an API key. Check `'email' in user` before you read user fields.
3209
3209
 
3210
- **Turbopack.** The package works with Turbopack (`next dev` and `next build`, the default in Next 16) and webpack. It ships `.scss` files for the admin, which Next compiles the same way it compiles Payload's own SCSS.
3210
+ **Turbopack.** The package works with Turbopack (`next dev` and `next build`, the default in Next 16) and webpack. It ships plain `.css` files for the admin, which Next loads the same way it loads Payload's own CSS.
3211
3211
 
3212
3212
  ## Limits
3213
3213
 
3214
3214
  This is version 0.2. Before 1.0, a minor version can change the API. Known limits:
3215
3215
 
3216
- - **Payload 3 only.** Payload 4 (canary today) changes the admin UI. The builder does not support it yet.
3216
+ - **Payload 4 beta.** This line follows Payload 4 betas (`^4.0.0-beta.8`). For Payload 3, use `payload-canvas@latest` (0.6.x).
3217
3217
  - **Next.js and React only.** The admin editor and the canvas need a Next.js app (Payload's own requirement). Other frontends can render the stored JSON with their own code.
3218
3218
  - **`RenderLayout` needs React Server Components.** `RenderLayout` and the `payload-canvas/react/server` helpers need the Next.js App Router (or another RSC framework).
3219
3219
  - **The canvas runtime runs only in the editor's iframe.** `payload-canvas/react/canvas` belongs on the canvas route and nowhere else.
@@ -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
  };
@@ -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
+ }
@@ -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. */
@@ -14,8 +14,8 @@ import { LeftPanel } from './layout/LeftPanel.js';
14
14
  import { selectLeftTab } from './layout/leftTabs.js';
15
15
  import { applySizes, readSizes } from './layout/panels.js';
16
16
  import { Splitter } from './layout/Splitter.js';
17
- import './layout/layout.scss';
18
- import './dnd/dnd.scss';
17
+ import './layout/layout.css';
18
+ import './dnd/dnd.css';
19
19
  import { SectionDialog } from './sections/SectionDialog.js';
20
20
  import { createRuntime, RuntimeContext, toCanvasPoint } from './runtime.js';
21
21
  import { bindShortcuts } from './shortcuts.js';
@@ -1,8 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useDraggable } from '@dnd-kit/core';
4
- import { useConfig, useRouteTransition } from '@payloadcms/ui';
5
- import { useRouter } from 'next/navigation';
4
+ import { useConfig, useRouter, useRouteTransition } from '@payloadcms/ui';
6
5
  import { memo, useDeferredValue, useEffect, useMemo, useRef, useState } from 'react';
7
6
  import { isComponent } from '../../core/components.js';
8
7
  import { sectionVersion, sectionVersions } from '../../core/sections.js';
@@ -1,4 +1,4 @@
1
- import './assistant.scss';
1
+ import './assistant.css';
2
2
  export declare function AssistantPanel({ hidden }: {
3
3
  hidden: boolean;
4
4
  }): import("react").JSX.Element | null;
@@ -13,7 +13,7 @@ import { useValue } from '../valueStore.js';
13
13
  import { ConnectAgents, useCopy } from './ConnectAgents.js';
14
14
  import { failedAction, failureParts, humanizeTool, retriedCalls, transcript } from './history.js';
15
15
  import { Markdown } from './MarkdownView.js';
16
- import './assistant.scss';
16
+ import './assistant.css';
17
17
  import { FORM_SETTINGS_REGION } from '../../../forms/blocks.js';
18
18
  const PROVIDER_DOCS = 'https://github.com/jon8800/payload-canvas/blob/main/docs/ai/providers.md';
19
19
  /** Distance from the bottom (px) within which new content keeps the list scrolled to the end. */