payload-canvas 0.3.0-next.1 → 0.4.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 (236) hide show
  1. package/README.md +522 -39
  2. package/dist/admin/BuilderTab.js +1 -1
  3. package/dist/admin/diff/LayoutDiff.js +3 -3
  4. package/dist/admin/diff/changes.js +8 -0
  5. package/dist/admin/diff/layoutDiff.scss +48 -48
  6. package/dist/admin/editor/DragLayer.js +1 -1
  7. package/dist/admin/editor/InlineToolbar.js +1 -1
  8. package/dist/admin/editor/Inspector.js +50 -5
  9. package/dist/admin/editor/Outline.js +13 -11
  10. package/dist/admin/editor/Overlay.js +1 -1
  11. package/dist/admin/editor/actions.d.ts +9 -1
  12. package/dist/admin/editor/actions.js +38 -3
  13. package/dist/admin/editor/assistant/AssistantPanel.js +1 -1
  14. package/dist/admin/editor/assistant/ConnectAgents.js +1 -1
  15. package/dist/admin/editor/assistant/assistant.scss +65 -65
  16. package/dist/admin/editor/dnd/dnd.scss +2 -2
  17. package/dist/admin/editor/editor.scss +134 -134
  18. package/dist/admin/editor/empty/EmptyStart.js +32 -6
  19. package/dist/admin/editor/empty/empty.scss +3 -3
  20. package/dist/admin/editor/fields/ArrayField.js +2 -2
  21. package/dist/admin/editor/fields/GroupField.d.ts +5 -2
  22. package/dist/admin/editor/fields/GroupField.js +6 -2
  23. package/dist/admin/editor/fields/WhereField.d.ts +17 -0
  24. package/dist/admin/editor/fields/WhereField.js +67 -0
  25. package/dist/admin/editor/fields/access.d.ts +1 -1
  26. package/dist/admin/editor/fields/fields.scss +122 -33
  27. package/dist/admin/editor/fields/whereRows.d.ts +28 -0
  28. package/dist/admin/editor/fields/whereRows.js +118 -0
  29. package/dist/admin/editor/generate/GenerateImage.js +1 -1
  30. package/dist/admin/editor/generate/generate.scss +48 -48
  31. package/dist/admin/editor/icons.d.ts +1 -0
  32. package/dist/admin/editor/icons.js +3 -1
  33. package/dist/admin/editor/insert/InsertHandle.js +1 -1
  34. package/dist/admin/editor/layout/FrameResize.js +1 -1
  35. package/dist/admin/editor/layout/LeftPanel.js +1 -1
  36. package/dist/admin/editor/layout/layout.scss +4 -4
  37. package/dist/admin/editor/live/PresenceUI.js +1 -1
  38. package/dist/admin/editor/live/presence.scss +1 -1
  39. package/dist/admin/editor/locale/LocaleField.d.ts +2 -2
  40. package/dist/admin/editor/locale/LocaleField.js +4 -2
  41. package/dist/admin/editor/locale/locale.scss +12 -12
  42. package/dist/admin/editor/media/ImageEditor.js +1 -1
  43. package/dist/admin/editor/media/media.scss +23 -23
  44. package/dist/admin/editor/menu/Menu.js +1 -1
  45. package/dist/admin/editor/menu/blockMenu.js +5 -1
  46. package/dist/admin/editor/menu/menu.scss +16 -16
  47. package/dist/admin/editor/motion/MotionPanel.js +2 -2
  48. package/dist/admin/editor/motion/model.d.ts +2 -2
  49. package/dist/admin/editor/motion/model.js +2 -2
  50. package/dist/admin/editor/motion/motion.scss +2 -2
  51. package/dist/admin/editor/regions/RegionOverlay.js +1 -1
  52. package/dist/admin/editor/regions/RegionPane.js +1 -1
  53. package/dist/admin/editor/renderField.d.ts +3 -1
  54. package/dist/admin/editor/renderField.js +14 -5
  55. package/dist/admin/editor/runtime.js +1 -0
  56. package/dist/admin/editor/styles/ColorPicker.js +1 -1
  57. package/dist/admin/editor/styles/SiteClasses.d.ts +9 -0
  58. package/dist/admin/editor/styles/SiteClasses.js +31 -0
  59. package/dist/admin/editor/styles/StylesPanel.d.ts +3 -1
  60. package/dist/admin/editor/styles/StylesPanel.js +9 -6
  61. package/dist/admin/editor/styles/VariantBar.js +1 -1
  62. package/dist/admin/editor/styles/context.d.ts +9 -2
  63. package/dist/admin/editor/styles/context.js +14 -9
  64. package/dist/admin/editor/styles/controls.js +3 -3
  65. package/dist/admin/editor/styles/sections.js +2 -2
  66. package/dist/admin/editor/styles/styles.scss +147 -93
  67. package/dist/admin/editor/templates/Bindable.d.ts +14 -6
  68. package/dist/admin/editor/templates/Bindable.js +74 -18
  69. package/dist/admin/editor/templates/SamplePicker.js +1 -1
  70. package/dist/admin/editor/templates/binding.d.ts +11 -4
  71. package/dist/admin/editor/templates/binding.js +23 -3
  72. package/dist/admin/editor/templates/templates.scss +90 -90
  73. package/dist/admin/editor/tooltip/tooltip.scss +4 -4
  74. package/dist/admin/editor/topbar/DocumentActions.js +1 -1
  75. package/dist/admin/editor/topbar/DocumentTitle.js +1 -1
  76. package/dist/admin/editor/topbar/screens/DrawerRouter.d.ts +1 -1
  77. package/dist/admin/editor/topbar/screens/ScreenDrawer.js +1 -1
  78. package/dist/admin/editor/topbar/screens/drawerRouterSupport.d.ts +1 -1
  79. package/dist/admin/editor/topbar/screens/screens.scss +20 -20
  80. package/dist/admin/editor/topbar/settingsDrawer.js +3 -3
  81. package/dist/admin/editor/topbar/settingsDrawer.scss +7 -7
  82. package/dist/admin/editor/topbar/topbar.scss +47 -47
  83. package/dist/admin/editor/ui/Select.js +1 -1
  84. package/dist/admin/editor/ui/controls.scss +26 -26
  85. package/dist/admin/screen/BuilderScreen.js +1 -1
  86. package/dist/ai/adapters/anthropic.d.ts +2 -2
  87. package/dist/ai/images/service.js +1 -1
  88. package/dist/ai/loop.d.ts +5 -5
  89. package/dist/ai/prompt.js +8 -2
  90. package/dist/ai/tools.js +11 -2
  91. package/dist/blocks/builtins/carousel.d.ts +32 -0
  92. package/dist/blocks/builtins/carousel.js +122 -0
  93. package/dist/blocks/builtins/disclosure.d.ts +13 -0
  94. package/dist/blocks/builtins/disclosure.js +107 -0
  95. package/dist/blocks/builtins/faq.d.ts +17 -0
  96. package/dist/blocks/builtins/faq.js +88 -0
  97. package/dist/blocks/builtins/filterLink.d.ts +22 -0
  98. package/dist/blocks/builtins/filterLink.js +76 -0
  99. package/dist/blocks/builtins/headingId.d.ts +15 -0
  100. package/dist/blocks/builtins/headingId.js +36 -0
  101. package/dist/blocks/builtins/icon.d.ts +8 -0
  102. package/dist/blocks/builtins/icon.js +45 -0
  103. package/dist/blocks/builtins/index.d.ts +35 -0
  104. package/dist/blocks/builtins/index.js +50 -0
  105. package/dist/blocks/builtins/lightbox.d.ts +43 -0
  106. package/dist/blocks/builtins/lightbox.js +93 -0
  107. package/dist/blocks/builtins/mediaBackdrop.d.ts +11 -0
  108. package/dist/blocks/builtins/mediaBackdrop.js +79 -0
  109. package/dist/blocks/builtins/sectionRef.d.ts +26 -0
  110. package/dist/blocks/builtins/sectionRef.js +78 -0
  111. package/dist/blocks/builtins/shared.d.ts +33 -0
  112. package/dist/blocks/builtins/shared.js +70 -0
  113. package/dist/blocks/builtins/tableOfContents.d.ts +3 -0
  114. package/dist/blocks/builtins/tableOfContents.js +44 -0
  115. package/dist/blocks/defaults.d.ts +28 -10
  116. package/dist/blocks/defaults.js +413 -20
  117. package/dist/blocks/index.d.ts +4 -2
  118. package/dist/blocks/index.js +3 -1
  119. package/dist/core/attrs.d.ts +27 -0
  120. package/dist/core/attrs.js +132 -0
  121. package/dist/core/bindings.d.ts +123 -12
  122. package/dist/core/bindings.js +504 -19
  123. package/dist/core/blocks.d.ts +46 -1
  124. package/dist/core/blocks.js +136 -0
  125. package/dist/core/classes.d.ts +10 -2
  126. package/dist/core/classes.js +34 -5
  127. package/dist/core/fieldAccess.js +1 -1
  128. package/dist/core/fieldHooks.d.ts +1 -1
  129. package/dist/core/headings.d.ts +21 -0
  130. package/dist/core/headings.js +47 -0
  131. package/dist/core/index.d.ts +4 -2
  132. package/dist/core/index.js +4 -2
  133. package/dist/core/motion.d.ts +24 -15
  134. package/dist/core/motion.js +20 -12
  135. package/dist/core/operations.js +59 -2
  136. package/dist/core/payloadBlocks.js +3 -1
  137. package/dist/core/schema.js +20 -0
  138. package/dist/core/tree.js +24 -1
  139. package/dist/core/types.d.ts +87 -0
  140. package/dist/core/validate.js +29 -4
  141. package/dist/css/tokens.d.ts +6 -3
  142. package/dist/css/tokens.js +48 -2
  143. package/dist/index.d.ts +3 -3
  144. package/dist/index.js +2 -2
  145. package/dist/live/draftAccess.js +1 -1
  146. package/dist/live/session.d.ts +1 -1
  147. package/dist/live/storage.js +4 -2
  148. package/dist/mcp/index.d.ts +2 -0
  149. package/dist/mcp/index.js +50 -13
  150. package/dist/mcp/shared.d.ts +34 -31
  151. package/dist/mcp/shared.js +23 -8
  152. package/dist/plugin/index.d.ts +8 -0
  153. package/dist/plugin/index.js +30 -12
  154. package/dist/plugin/listCollections.d.ts +17 -2
  155. package/dist/plugin/listCollections.js +44 -7
  156. package/dist/plugin/references.d.ts +5 -0
  157. package/dist/plugin/references.js +1 -1
  158. package/dist/plugin/templates.d.ts +4 -0
  159. package/dist/plugin/templates.js +24 -9
  160. package/dist/protocol/index.d.ts +3 -1
  161. package/dist/react/canvas/BuilderCanvas.js +6 -4
  162. package/dist/react/canvas/fetchDocs.d.ts +16 -2
  163. package/dist/react/canvas/fetchDocs.js +42 -9
  164. package/dist/react/canvas/inline/rich/editor.js +1 -6
  165. package/dist/react/canvas/measure.d.ts +3 -1
  166. package/dist/react/canvas/measure.js +26 -2
  167. package/dist/react/canvas/resolveLayout.d.ts +1 -1
  168. package/dist/react/canvas/resolveLayout.js +17 -6
  169. package/dist/react/canvas/serverBlocks.d.ts +11 -0
  170. package/dist/react/canvas/serverBlocks.js +28 -1
  171. package/dist/react/canvas/thumbnail/ThumbnailCanvas.js +1 -1
  172. package/dist/react/components/Button.d.ts +11 -2
  173. package/dist/react/components/Button.js +43 -6
  174. package/dist/react/components/CollectionList.d.ts +6 -3
  175. package/dist/react/components/CollectionList.js +21 -7
  176. package/dist/react/components/Container.js +4 -1
  177. package/dist/react/components/Field.js +13 -2
  178. package/dist/react/components/Heading.js +9 -2
  179. package/dist/react/components/Image.d.ts +9 -0
  180. package/dist/react/components/Image.js +16 -1
  181. package/dist/react/components/List.d.ts +1 -0
  182. package/dist/react/components/List.js +6 -0
  183. package/dist/react/components/Menu.d.ts +16 -0
  184. package/dist/react/components/Menu.js +83 -19
  185. package/dist/react/components/RichText.d.ts +8 -3
  186. package/dist/react/components/RichText.js +25 -4
  187. package/dist/react/components/builtins/Accordion.d.ts +9 -0
  188. package/dist/react/components/builtins/Accordion.js +37 -0
  189. package/dist/react/components/builtins/BackdropVideo.d.ts +13 -0
  190. package/dist/react/components/builtins/BackdropVideo.js +16 -0
  191. package/dist/react/components/builtins/Carousel.d.ts +13 -0
  192. package/dist/react/components/builtins/Carousel.js +134 -0
  193. package/dist/react/components/builtins/Disclosure.d.ts +7 -0
  194. package/dist/react/components/builtins/Disclosure.js +13 -0
  195. package/dist/react/components/builtins/FilterLink.d.ts +8 -0
  196. package/dist/react/components/builtins/FilterLink.js +30 -0
  197. package/dist/react/components/builtins/Icon.d.ts +14 -0
  198. package/dist/react/components/builtins/Icon.js +28 -0
  199. package/dist/react/components/builtins/Lightbox.d.ts +45 -0
  200. package/dist/react/components/builtins/Lightbox.js +252 -0
  201. package/dist/react/components/builtins/MediaBackdrop.d.ts +14 -0
  202. package/dist/react/components/builtins/MediaBackdrop.js +61 -0
  203. package/dist/react/components/builtins/SectionRef.d.ts +7 -0
  204. package/dist/react/components/builtins/SectionRef.js +17 -0
  205. package/dist/react/components/builtins/TableOfContents.d.ts +7 -0
  206. package/dist/react/components/builtins/TableOfContents.js +21 -0
  207. package/dist/react/components/builtins/glyphs.d.ts +8 -0
  208. package/dist/react/components/builtins/glyphs.js +7 -0
  209. package/dist/react/components/builtins/index.d.ts +32 -0
  210. package/dist/react/components/builtins/index.js +36 -0
  211. package/dist/react/components/index.js +2 -0
  212. package/dist/react/index.d.ts +3 -1
  213. package/dist/react/index.js +3 -1
  214. package/dist/react/motion/runtime.js +10 -6
  215. package/dist/react/motion/style.js +1 -1
  216. package/dist/react/render/PayloadRoot.js +1 -1
  217. package/dist/react/render/RenderLayout.d.ts +1 -1
  218. package/dist/react/render/RenderLayout.js +77 -24
  219. package/dist/react/render/lists.d.ts +107 -5
  220. package/dist/react/render/lists.js +284 -9
  221. package/dist/react/render/resolve.d.ts +22 -2
  222. package/dist/react/render/resolve.js +45 -24
  223. package/dist/react/render/sections.d.ts +9 -0
  224. package/dist/react/render/sections.js +51 -0
  225. package/dist/react/render/types.d.ts +6 -1
  226. package/dist/react/server.d.ts +4 -4
  227. package/dist/react/server.js +55 -7
  228. package/dist/react/theme/ThemeStyle.d.ts +13 -2
  229. package/dist/react/theme/ThemeStyle.js +13 -3
  230. package/dist/theme/admin/ColorField.d.ts +2 -2
  231. package/dist/theme/admin/ColorField.js +2 -2
  232. package/dist/theme/admin/FontField.d.ts +2 -2
  233. package/dist/theme/admin/FontField.js +2 -2
  234. package/dist/theme/admin/SaveSignal.js +2 -2
  235. package/dist/theme/admin/fields.scss +48 -48
  236. package/package.json +23 -28
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  // The empty page's start screen: a card over the canvas with three suggested sections, the
4
4
  // Sections and Blocks tabs, and the assistant (when the plugin has one). A document that the site
5
5
  // shows through a template says so first, with a link to the template.
@@ -9,8 +9,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
9
9
  // while something is dragged.
10
10
  import { Button, useConfig } from '@payloadcms/ui';
11
11
  import { useEffect, useId, useMemo, useState } from 'react';
12
- import { DOCUMENT_TEMPLATE_FIELD, TEMPLATE_DEFAULT_FIELD, TEMPLATE_LAYOUT_FIELD, TEMPLATE_TARGET_FIELD } from '../../../core/bindings.js';
12
+ import { DOCUMENT_TEMPLATE_FIELD, TEMPLATE_CONDITIONS_FIELD, TEMPLATE_DEFAULT_FIELD, TEMPLATE_LAYOUT_FIELD, TEMPLATE_TARGET_FIELD, templateConditions, } from '../../../core/bindings.js';
13
13
  import { builderViewPath } from '../../../plugin/links.js';
14
+ import { whereParams } from '../../../react/canvas/fetchDocs.js';
14
15
  import { insertBlocks, sectionPosition } from '../actions.js';
15
16
  import { Icon } from '../icons.js';
16
17
  import { selectLeftTab } from '../layout/leftTabs.js';
@@ -23,7 +24,9 @@ import './empty.scss';
23
24
  /** Categories of the suggested sections, in order: a page usually starts with these. */
24
25
  const SUGGESTED = ['Heroes', 'Features', 'Calls to action'];
25
26
  const SUGGESTION_COUNT = 3;
26
- function suggestions(sections) {
27
+ function suggestions(all) {
28
+ // One version of each section: its variants stay in the library.
29
+ const sections = all.filter((s) => !s.variantOf);
27
30
  const picked = SUGGESTED.flatMap((category) => sections.find((s) => s.category === category) ?? []);
28
31
  const rest = sections.filter((s) => !picked.includes(s));
29
32
  return [...picked, ...rest].slice(0, SUGGESTION_COUNT);
@@ -38,7 +41,8 @@ async function getJson(url) {
38
41
  }
39
42
  /**
40
43
  * The published template the site renders this document through: its own template, else the
41
- * collection's newest default template with blocks. The same rule as `loadTemplate`.
44
+ * first template (by name) whose conditions match the latest draft, else the collection's newest
45
+ * default template with blocks. The same rule as `loadTemplate`.
42
46
  */
43
47
  async function appliedTemplate(runtime, id) {
44
48
  const templates = runtime.config.templates;
@@ -58,6 +62,28 @@ async function appliedTemplate(runtime, id) {
58
62
  if (template && hasBlocks(template))
59
63
  return { id: ownId, name: String(template.name ?? 'Untitled') };
60
64
  }
65
+ const conditioned = await getJson(`${base}?${new URLSearchParams({
66
+ [`where[and][0][${TEMPLATE_TARGET_FIELD}][equals]`]: runtime.config.collection,
67
+ 'where[and][1][_status][equals]': 'published',
68
+ [`select[${TEMPLATE_CONDITIONS_FIELD}]`]: 'true',
69
+ sort: 'name',
70
+ depth: '0',
71
+ limit: '100',
72
+ }).toString()}`);
73
+ for (const candidate of conditioned?.docs ?? []) {
74
+ const where = templateConditions(candidate);
75
+ if (!where)
76
+ continue;
77
+ const match = new URLSearchParams({ 'where[and][0][id][equals]': String(id), depth: '0', limit: '1', draft: 'true', 'select[id]': 'true' });
78
+ for (const [name, value] of whereParams(where, 'where[and][1]'))
79
+ match.append(name, value);
80
+ const found = await getJson(`${runtime.api}/${encodeURIComponent(runtime.config.collection)}?${match.toString()}`);
81
+ if (!found?.docs?.length)
82
+ continue;
83
+ const template = await getJson(`${base}/${encodeURIComponent(String(candidate.id))}?depth=0`);
84
+ if (template && hasBlocks(template))
85
+ return { id: candidate.id, name: String(template.name ?? 'Untitled') };
86
+ }
61
87
  const query = new URLSearchParams({
62
88
  [`where[and][0][${TEMPLATE_TARGET_FIELD}][equals]`]: runtime.config.collection,
63
89
  [`where[and][1][${TEMPLATE_DEFAULT_FIELD}][equals]`]: 'true',
@@ -114,7 +140,7 @@ function TemplateNotice({ template, titleId, onIgnore }) {
114
140
  const singular = collections.find((c) => c.slug === runtime.config.collection)?.labels?.singular;
115
141
  const noun = typeof singular === 'string' ? singular.toLowerCase() : 'document';
116
142
  const templates = runtime.config.templates;
117
- return (_jsxs(_Fragment, { children: [_jsx("span", { className: "builder-empty-start__icon", children: _jsx(Icon, { name: "template", size: 20 }) }), _jsxs("h2", { id: titleId, className: "builder-empty-start__title", children: ["This ", noun, " uses the template \u201C", template.name, "\u201D"] }), _jsxs("p", { className: "builder-empty-start__text", children: ["The site shows this ", noun, " through the template. Blocks you add here do not show while a template applies."] }), _jsxs("div", { className: "builder-empty-start__actions", children: [templates && (_jsx(Button, { el: "link", url: builderViewPath(routes.admin, templates.collection, template.id), buttonStyle: "primary", size: "medium", margin: false, children: "Open the template" })), _jsx(Button, { buttonStyle: "secondary", size: "medium", margin: false, onClick: onIgnore, children: "Add blocks here anyway" })] })] }));
143
+ return (_jsxs(_Fragment, { children: [_jsx("span", { className: "builder-empty-start__icon", children: _jsx(Icon, { name: "template", size: 20 }) }), _jsxs("h2", { id: titleId, className: "builder-empty-start__title", children: ["This ", noun, " uses the template \u201C", template.name, "\u201D"] }), _jsxs("p", { className: "builder-empty-start__text", children: ["The site shows this ", noun, " through the template. Blocks you add here do not show while a template applies."] }), _jsxs("div", { className: "builder-empty-start__actions", children: [templates && (_jsx(Button, { el: "link", url: builderViewPath(routes.admin, templates.collection, template.id), buttonStyle: "primary", size: "small", margin: false, children: "Open the template" })), _jsx(Button, { buttonStyle: "secondary", size: "small", margin: false, onClick: onIgnore, children: "Add blocks here anyway" })] })] }));
118
144
  }
119
145
  function StartOptions({ titleId }) {
120
146
  const runtime = useRuntime();
@@ -123,5 +149,5 @@ function StartOptions({ titleId }) {
123
149
  if (insertBlocks(runtime, section.blocks, sectionPosition(runtime)))
124
150
  runtime.notify(`Added ${section.label}`);
125
151
  };
126
- return (_jsxs(_Fragment, { children: [_jsx("h2", { id: titleId, className: "builder-empty-start__title", children: "Start this page" }), _jsx("p", { className: "builder-empty-start__text", children: picks.length > 0 ? 'Add a section to begin, or build the page block by block.' : 'Add blocks from the Blocks tab, or drag them onto the canvas.' }), picks.length > 0 && (_jsx("ul", { className: "builder-empty-start__sections", "aria-label": "Suggested sections", children: picks.map((section) => (_jsx("li", { children: _jsxs("button", { type: "button", className: "builder-editor__card builder-empty-start__section", onClick: () => insert(section), children: [_jsx(SectionThumb, { section: section }), _jsxs("span", { className: "builder-editor__card-text", children: [_jsx("span", { className: "builder-editor__card-label", children: section.label }), section.category && _jsx("span", { className: "builder-editor__card-desc", children: section.category })] })] }) }, section.id))) })), _jsxs("div", { className: "builder-empty-start__actions", children: [picks.length > 0 && (_jsx(Button, { buttonStyle: "secondary", size: "medium", margin: false, onClick: () => selectLeftTab(runtime, 'sections', { focus: true }), children: "Browse sections" })), _jsx(Button, { buttonStyle: "secondary", size: "medium", margin: false, onClick: () => selectLeftTab(runtime, 'blocks', { focus: true }), children: "Add a block" }), runtime.assistant && (_jsx(Button, { buttonStyle: "secondary", size: "medium", margin: false, icon: _jsx(Icon, { name: "sparkle", size: 14 }), iconPosition: "left", onClick: () => runtime.toggleAssistant(true), children: "Ask the assistant" }))] })] }));
152
+ return (_jsxs(_Fragment, { children: [_jsx("h2", { id: titleId, className: "builder-empty-start__title", children: "Start this page" }), _jsx("p", { className: "builder-empty-start__text", children: picks.length > 0 ? 'Add a section to begin, or build the page block by block.' : 'Add blocks from the Blocks tab, or drag them onto the canvas.' }), picks.length > 0 && (_jsx("ul", { className: "builder-empty-start__sections", "aria-label": "Suggested sections", children: picks.map((section) => (_jsx("li", { children: _jsxs("button", { type: "button", className: "builder-editor__card builder-empty-start__section", onClick: () => insert(section), children: [_jsx(SectionThumb, { section: section }), _jsxs("span", { className: "builder-editor__card-text", children: [_jsx("span", { className: "builder-editor__card-label", children: section.label }), section.category && _jsx("span", { className: "builder-editor__card-desc", children: section.category })] })] }) }, section.id))) })), _jsxs("div", { className: "builder-empty-start__actions", children: [picks.length > 0 && (_jsx(Button, { buttonStyle: "secondary", size: "small", margin: false, onClick: () => selectLeftTab(runtime, 'sections', { focus: true }), children: "Browse sections" })), _jsx(Button, { buttonStyle: "secondary", size: "small", margin: false, onClick: () => selectLeftTab(runtime, 'blocks', { focus: true }), children: "Add a block" }), runtime.assistant && (_jsx(Button, { buttonStyle: "secondary", size: "small", margin: false, icon: _jsx(Icon, { name: "sparkle", size: 14 }), iconPosition: "left", onClick: () => runtime.toggleAssistant(true), children: "Ask the assistant" }))] })] }));
127
153
  }
@@ -24,7 +24,7 @@
24
24
  border: 1px solid var(--be-border);
25
25
  border-radius: var(--be-radius-m);
26
26
  background: var(--be-panel);
27
- color: var(--color-text);
27
+ color: var(--theme-text);
28
28
  box-shadow: var(--be-shadow);
29
29
  text-align: center;
30
30
  pointer-events: auto;
@@ -44,7 +44,7 @@
44
44
  .builder-empty-start__title {
45
45
  margin: 0;
46
46
  // Payload's h4 size (16px): the start card's title is a page-level heading, not panel text.
47
- font-size: calc(var(--spacer-3) * 0.8);
47
+ font-size: calc(var(--base) * 0.8);
48
48
  font-weight: var(--be-weight-strong);
49
49
  line-height: 1.35;
50
50
  text-wrap: balance;
@@ -53,7 +53,7 @@
53
53
  .builder-empty-start__text {
54
54
  max-width: 48ch;
55
55
  margin: 0;
56
- color: var(--color-text-secondary);
56
+ color: var(--theme-elevation-650);
57
57
  font-size: var(--be-text-m);
58
58
  line-height: 1.5;
59
59
  text-wrap: balance;
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Button, Collapsible, DraggableSortable, FieldLabel, useDraggableSortable } from '@payloadcms/ui';
4
4
  import { memo, use, useLayoutEffect, useMemo, useRef } from 'react';
5
5
  import { createId } from '../../../core/ids.js';
@@ -57,7 +57,7 @@ export function ArrayField({ fields, label, singular, description, maxRows, path
57
57
  };
58
58
  }, []);
59
59
  const ids = rows.map((row) => row.id);
60
- return (_jsxs("div", { className: "builder-field-array", children: [_jsxs("div", { className: "builder-field-array__head", children: [_jsx(FieldLabel, { label: label, path: path }), rows.length > 0 && (_jsxs("div", { className: "builder-field-array__head-actions", children: [_jsx("button", { type: "button", onClick: () => setCollapsedRows(stateKey, new Set(ids)), children: "Collapse all" }), _jsx("button", { type: "button", onClick: () => setCollapsedRows(stateKey, new Set()), children: "Show all" })] }))] }), description && _jsx("p", { className: "builder-field-group__description", children: description }), rows.length > 0 && (_jsx(DraggableSortable, { className: "builder-field-array__rows", ids: ids, onDragEnd: ({ moveFromIndex, moveToIndex }) => actions.move(moveFromIndex, moveToIndex), children: rows.map((row, index) => (_jsx(ArrayFieldRow, { actions: actions, collapsed: collapsed.has(row.id), fields: fields, full: full, index: index, itemLabel: itemLabel, path: path, row: row, rowCount: rows.length, stateKey: stateKey }, row.id))) })), _jsx(Button, { buttonStyle: "secondary", disabled: full, icon: "plus", iconPosition: "left", margin: false, onClick: () => actions.addBelow(rows.length - 1), size: "medium", children: singular ? `Add ${singular}` : 'Add item' })] }));
60
+ return (_jsxs("div", { className: "builder-field-array", children: [_jsxs("div", { className: "builder-field-array__head", children: [_jsx(FieldLabel, { label: label, path: path }), rows.length > 0 && (_jsxs("div", { className: "builder-field-array__head-actions", children: [_jsx("button", { type: "button", onClick: () => setCollapsedRows(stateKey, new Set(ids)), children: "Collapse all" }), _jsx("button", { type: "button", onClick: () => setCollapsedRows(stateKey, new Set()), children: "Show all" })] }))] }), description && _jsx("p", { className: "builder-field-group__description", children: description }), rows.length > 0 && (_jsx(DraggableSortable, { className: "builder-field-array__rows", ids: ids, onDragEnd: ({ moveFromIndex, moveToIndex }) => actions.move(moveFromIndex, moveToIndex), children: rows.map((row, index) => (_jsx(ArrayFieldRow, { actions: actions, collapsed: collapsed.has(row.id), fields: fields, full: full, index: index, itemLabel: itemLabel, path: path, row: row, rowCount: rows.length, stateKey: stateKey }, row.id))) })), _jsx(Button, { buttonStyle: "secondary", disabled: full, icon: "plus", iconPosition: "left", iconStyle: "with-border", margin: false, onClick: () => actions.addBelow(rows.length - 1), size: "small", children: singular ? `Add ${singular}` : 'Add item' })] }));
61
61
  }
62
62
  /** One row. Memoized: typing in one row does not re-render the others. */
63
63
  const ArrayFieldRow = memo(function ArrayFieldRow({ actions, collapsed, fields, full, index, itemLabel, path, row, rowCount, stateKey, }) {
@@ -11,10 +11,13 @@ type Props = {
11
11
  };
12
12
  /**
13
13
  * Fields that share the parent's data, under a small heading: a collapsible, or one of several
14
- * unnamed tabs. Looks like a group, but stores nothing of its own.
14
+ * unnamed tabs. Looks like a group, but stores nothing of its own. `collapsed`: a collapsible with
15
+ * `admin.initCollapsed` starts folded, and its heading opens it.
15
16
  */
16
- export declare function FieldSection({ label, children }: {
17
+ export declare function FieldSection({ label, description, collapsed, children, }: {
17
18
  readonly label: string;
19
+ readonly description?: string;
20
+ readonly collapsed?: boolean;
18
21
  readonly children: ReactNode;
19
22
  }): import("react").JSX.Element;
20
23
  /** A named group: a small heading over its sub-fields, which edit one nested object. */
@@ -3,9 +3,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { RenderBlockFields } from '../renderField.js';
4
4
  /**
5
5
  * Fields that share the parent's data, under a small heading: a collapsible, or one of several
6
- * unnamed tabs. Looks like a group, but stores nothing of its own.
6
+ * unnamed tabs. Looks like a group, but stores nothing of its own. `collapsed`: a collapsible with
7
+ * `admin.initCollapsed` starts folded, and its heading opens it.
7
8
  */
8
- export function FieldSection({ label, children }) {
9
+ export function FieldSection({ label, description, collapsed, children, }) {
10
+ if (collapsed !== undefined) {
11
+ return (_jsxs("details", { className: "builder-field-group builder-field-group--fold", open: !collapsed, children: [_jsx("summary", { className: "builder-field-group__label", children: label }), description && _jsx("p", { className: "builder-field-group__description", children: description }), _jsx("div", { className: "builder-field-group__fields", children: children })] }));
12
+ }
9
13
  return (_jsxs("fieldset", { className: "builder-field-group", children: [_jsx("legend", { className: "builder-field-group__label", children: label }), _jsx("div", { className: "builder-field-group__fields", children: children })] }));
10
14
  }
11
15
  /** A named group: a small heading over its sub-fields, which edit one nested object. */
@@ -0,0 +1,17 @@
1
+ type Props = {
2
+ readonly label: string;
3
+ readonly description?: string;
4
+ readonly path: string;
5
+ readonly required: boolean;
6
+ readonly value: unknown;
7
+ readonly onChange: (value: unknown) => void;
8
+ /** The slug of the collection the query runs on, when known: its fields fill the field select. */
9
+ readonly collection?: string;
10
+ };
11
+ /**
12
+ * A Payload `where` query as rows: field, operator and value, AND-ed. Stores the same where
13
+ * object as the JSON editor. A where the rows cannot show (`or`, nested groups) opens as JSON.
14
+ * "Edit as JSON" switches to the JSON editor.
15
+ */
16
+ export declare function WhereField({ label, description, path, required, value, onChange, collection }: Props): import("react").JSX.Element;
17
+ export {};
@@ -0,0 +1,67 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Button, FieldLabel, useConfig } from '@payloadcms/ui';
4
+ import { useMemo, useState } from 'react';
5
+ import { dataFields } from '../../../core/fields.js';
6
+ import { Select } from '../ui/Select.js';
7
+ import { JsonField } from './JsonField.js';
8
+ import { convertWhereValue, parseWhereValue, rowsWhere, WHERE_OPERATORS, whereRows, whereValueText, } from './whereRows.js';
9
+ const OPERATOR_LABELS = {
10
+ equals: 'is',
11
+ not_equals: 'is not',
12
+ in: 'is one of',
13
+ not_in: 'is none of',
14
+ greater_than: 'greater than',
15
+ greater_than_equal: 'at least',
16
+ less_than: 'less than',
17
+ less_than_equal: 'at most',
18
+ like: 'has the words',
19
+ contains: 'contains',
20
+ exists: 'exists',
21
+ };
22
+ const OPERATOR_OPTIONS = WHERE_OPERATORS.map((value) => ({ value, label: OPERATOR_LABELS[value] }));
23
+ const YES_NO = [
24
+ { value: 'true', label: 'yes' },
25
+ { value: 'false', label: 'no' },
26
+ ];
27
+ const editRows = (value) => (whereRows(value) ?? []).map((row) => ({ ...row, text: whereValueText(row.value) }));
28
+ /**
29
+ * A Payload `where` query as rows: field, operator and value, AND-ed. Stores the same where
30
+ * object as the JSON editor. A where the rows cannot show (`or`, nested groups) opens as JSON.
31
+ * "Edit as JSON" switches to the JSON editor.
32
+ */
33
+ export function WhereField({ label, description, path, required, value, onChange, collection }) {
34
+ const { config } = useConfig();
35
+ const fields = useMemo(() => {
36
+ const found = config.collections.find((c) => c.slug === collection);
37
+ return found ? dataFields(found.fields).filter((f) => f.type !== 'group' && f.type !== 'array' && f.type !== 'blocks') : [];
38
+ }, [config.collections, collection]);
39
+ const [json, setJson] = useState(false);
40
+ const [draft, setDraft] = useState(() => ({ rows: editRows(value), source: value }));
41
+ // The value changed from outside (undo, AI edit): show it. Our own edits come back as `source`.
42
+ if (value !== draft.source)
43
+ setDraft({ rows: editRows(value), source: value });
44
+ const fits = whereRows(value) !== null;
45
+ if (json || !fits) {
46
+ return (_jsxs("div", { className: "builder-where", children: [_jsx(JsonField, { description: description, label: label, onChange: onChange, path: path, required: required, value: value }), fits ? (_jsx("button", { type: "button", className: "builder-where__switch", onClick: () => setJson(false), children: "Edit as conditions" })) : (_jsx("p", { className: "builder-field-group__description", children: "This query uses parts the condition rows cannot show (for example \"or\"), so it opens as JSON." }))] }));
47
+ }
48
+ const typeOf = (name) => fields.find((f) => f.name === name)?.type;
49
+ const update = (rows) => {
50
+ const where = rowsWhere(rows);
51
+ setDraft({ rows, source: where });
52
+ onChange(where);
53
+ };
54
+ const change = (index, patch) => update(draft.rows.map((row, i) => (i === index ? { ...row, ...patch } : row)));
55
+ const fieldOptions = (current) => {
56
+ const options = fields.map((f) => ({ value: f.name, label: f.name }));
57
+ return current && !options.some((o) => o.value === current) ? [{ value: current, label: current }, ...options] : options;
58
+ };
59
+ return (_jsxs("div", { className: "builder-where", children: [_jsxs("div", { className: "builder-where__head", children: [_jsx(FieldLabel, { label: label, path: path, required: required }), _jsx("button", { type: "button", className: "builder-where__switch", onClick: () => setJson(true), children: "Edit as JSON" })] }), description && _jsx("p", { className: "builder-field-group__description", children: description }), draft.rows.map((row, index) => {
60
+ const name = `Condition ${index + 1}`;
61
+ return (_jsxs("fieldset", { className: "builder-where__row", "aria-label": name, children: [fields.length > 0 ? (_jsx(Select, { "aria-label": `${name}: field`, placeholder: "Field", value: row.field || null, options: fieldOptions(row.field), onValueChange: (field) => change(index, { field: field ?? '', value: parseWhereValue(row.text, row.operator, typeOf(field ?? '')) }) })) : (_jsx("input", { type: "text", className: "builder-where__input", "aria-label": `${name}: field`, placeholder: "Field", value: row.field, onChange: (e) => change(index, { field: e.target.value }) })), _jsx(Select, { "aria-label": `${name}: operator`, value: row.operator, options: OPERATOR_OPTIONS, onValueChange: (next) => {
62
+ const operator = (next ?? 'equals');
63
+ const converted = convertWhereValue(row, operator, typeOf(row.field));
64
+ change(index, { operator, value: converted, text: whereValueText(converted) });
65
+ } }), row.operator === 'exists' ? (_jsx(Select, { "aria-label": `${name}: value`, value: row.value === false ? 'false' : 'true', options: YES_NO, onValueChange: (next) => change(index, { value: next !== 'false', text: next ?? 'true' }) })) : (_jsx("input", { type: "text", className: "builder-where__input", "aria-label": `${name}: value`, placeholder: row.operator === 'in' || row.operator === 'not_in' ? 'a, b, c' : 'Value', value: row.text, onChange: (e) => change(index, { text: e.target.value, value: parseWhereValue(e.target.value, row.operator, typeOf(row.field)) }) })), _jsx("button", { type: "button", className: "builder-where__remove", "aria-label": `Remove ${name.toLowerCase()}`, onClick: () => update(draft.rows.filter((_, i) => i !== index)), children: "\u00D7" })] }, index));
66
+ }), _jsx(Button, { buttonStyle: "secondary", icon: "plus", iconPosition: "left", iconStyle: "with-border", margin: false, onClick: () => update([...draft.rows, { field: '', operator: 'equals', value: '', text: '' }]), size: "small", children: "Add condition" })] }));
67
+ }
@@ -21,7 +21,7 @@ export declare function useFieldAccessCheck(): (path: string) => {
21
21
  export declare function FieldAccessFrame({ locked, children }: {
22
22
  locked: boolean;
23
23
  children: ReactNode;
24
- }): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
24
+ }): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
25
25
  /** How many top-level props of the block the user may not read. */
26
26
  export declare function useHiddenCount(block: Block): number;
27
27
  /** A line under the fields when some are hidden from this user. */
@@ -7,54 +7,143 @@
7
7
  .builder-editor__fields {
8
8
  .field-description,
9
9
  .upload-relationship-details__meta {
10
- color: var(--color-text-secondary);
10
+ color: var(--theme-elevation-600);
11
11
  }
12
12
  }
13
13
 
14
14
  .builder-field-group {
15
15
  display: flex;
16
16
  flex-direction: column;
17
- gap: calc(var(--spacer-3) * 0.5);
17
+ gap: calc(var(--base) * 0.5);
18
18
  min-width: 0;
19
19
  margin: 0;
20
- padding: calc(var(--spacer-3) * 0.5) 0 0 calc(var(--spacer-3) * 0.6);
20
+ padding: calc(var(--base) * 0.5) 0 0 calc(var(--base) * 0.6);
21
21
  border: 0;
22
- border-left: 2px solid var(--color-bg-hover);
22
+ border-left: 2px solid var(--theme-elevation-100);
23
23
  }
24
24
 
25
25
  .builder-field-group__label {
26
- margin: 0 0 calc(var(--spacer-3) * 0.25);
26
+ margin: 0 0 calc(var(--base) * 0.25);
27
27
  padding: 0;
28
- color: var(--color-text-secondary);
28
+ color: var(--theme-elevation-600);
29
29
  font-size: var(--be-text-s);
30
30
  font-weight: var(--be-weight-strong);
31
31
  letter-spacing: 0.04em;
32
32
  text-transform: uppercase;
33
33
  }
34
34
 
35
+ // A collapsible with `initCollapsed`: the heading opens and closes it.
36
+ .builder-field-group--fold > .builder-field-group__label {
37
+ cursor: pointer;
38
+ }
39
+
40
+ .builder-field-group--fold:not([open]) {
41
+ padding-bottom: 0;
42
+ }
43
+
35
44
  .builder-field-group__description {
36
45
  margin: 0;
37
- color: var(--color-text-secondary);
46
+ color: var(--theme-elevation-600);
47
+ font-size: var(--be-text-m);
48
+ }
49
+
50
+ // The where builder (WhereField): rows of field, operator, value and a remove button.
51
+ .builder-where {
52
+ display: flex;
53
+ flex-direction: column;
54
+ gap: calc(var(--base) * 0.4);
55
+ align-items: flex-start;
56
+ }
57
+
58
+ .builder-where__head {
59
+ display: flex;
60
+ align-items: baseline;
61
+ justify-content: space-between;
62
+ align-self: stretch;
63
+ gap: 8px;
64
+
65
+ .field-label {
66
+ margin: 0;
67
+ }
68
+ }
69
+
70
+ .builder-where__switch {
71
+ padding: 0;
72
+ border: 0;
73
+ background: none;
74
+ color: var(--theme-elevation-800);
75
+ font: inherit;
76
+ font-size: var(--be-text-m);
77
+ text-decoration: underline;
78
+ cursor: pointer;
79
+ }
80
+
81
+ .builder-where__row {
82
+ display: grid;
83
+ grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.2fr) auto;
84
+ align-items: center;
85
+ align-self: stretch;
86
+ gap: 4px;
87
+ min-width: 0;
88
+ margin: 0;
89
+ padding: 0;
90
+ border: 0;
91
+ }
92
+
93
+ .builder-where__input {
94
+ box-sizing: border-box;
95
+ width: 100%;
96
+ min-width: 0;
97
+ height: calc(var(--base) * 2);
98
+ padding: 0 calc(var(--base) * 0.5);
99
+ border: 1px solid var(--theme-elevation-150);
100
+ border-radius: var(--style-radius-s);
101
+ background: var(--theme-input-bg, var(--theme-elevation-0));
102
+ color: var(--theme-elevation-800);
103
+ font: inherit;
38
104
  font-size: var(--be-text-m);
105
+
106
+ &:focus-visible {
107
+ outline: 2px solid var(--theme-success-500);
108
+ outline-offset: 1px;
109
+ }
110
+ }
111
+
112
+ .builder-where__remove {
113
+ width: calc(var(--base) * 1.5);
114
+ height: calc(var(--base) * 1.5);
115
+ padding: 0;
116
+ border: 0;
117
+ border-radius: var(--style-radius-s);
118
+ background: none;
119
+ color: var(--theme-elevation-600);
120
+ font-size: 18px;
121
+ line-height: 1;
122
+ cursor: pointer;
123
+
124
+ &:hover {
125
+ background: var(--theme-elevation-100);
126
+ color: var(--theme-elevation-900);
127
+ }
39
128
  }
40
129
 
41
130
  .builder-field-group__fields {
42
131
  display: flex;
43
132
  flex-direction: column;
44
- gap: calc(var(--spacer-3) * 0.75);
133
+ gap: calc(var(--base) * 0.75);
45
134
  }
46
135
 
47
136
  // Point field: longitude and latitude side by side.
48
137
  .builder-field-point {
49
138
  display: flex;
50
139
  flex-direction: column;
51
- gap: calc(var(--spacer-3) * 0.25);
140
+ gap: calc(var(--base) * 0.25);
52
141
  }
53
142
 
54
143
  .builder-field-point__inputs {
55
144
  display: grid;
56
145
  grid-template-columns: repeat(2, minmax(0, 1fr));
57
- gap: calc(var(--spacer-3) * 0.5);
146
+ gap: calc(var(--base) * 0.5);
58
147
  }
59
148
 
60
149
  // Array field: Payload's look (Collapsible rows, drag handle, "..." row menu), sized for the
@@ -63,7 +152,7 @@
63
152
  display: flex;
64
153
  flex-direction: column;
65
154
  align-items: flex-start;
66
- gap: calc(var(--spacer-3) * 0.4);
155
+ gap: calc(var(--base) * 0.4);
67
156
 
68
157
  > * {
69
158
  align-self: stretch;
@@ -94,14 +183,14 @@
94
183
  padding: 0;
95
184
  border: 0;
96
185
  background: none;
97
- color: var(--color-text);
186
+ color: var(--theme-elevation-800);
98
187
  font: inherit;
99
188
  font-size: var(--be-text-m);
100
189
  cursor: pointer;
101
190
 
102
191
  &:hover,
103
192
  &:focus-visible {
104
- color: var(--color-text-secondary);
193
+ color: var(--theme-elevation-600);
105
194
  text-decoration: underline;
106
195
  }
107
196
  }
@@ -122,24 +211,24 @@
122
211
  }
123
212
 
124
213
  .builder-field-array .builder-field-array__collapsible {
125
- border-radius: var(--radius-medium, 4px);
126
- background: var(--color-bg);
214
+ border-radius: var(--style-radius-s, 4px);
215
+ background: var(--theme-elevation-0);
127
216
 
128
217
  > .collapsible__toggle-wrap {
129
218
  gap: 2px;
130
219
  padding: 2px 4px;
131
- border-top-left-radius: var(--radius-medium, 4px);
132
- border-top-right-radius: var(--radius-medium, 4px);
220
+ border-top-left-radius: var(--style-radius-s, 4px);
221
+ border-top-right-radius: var(--style-radius-s, 4px);
133
222
  line-height: 24px;
134
223
 
135
224
  > .collapsible__toggle {
136
- border-radius: var(--radius-medium, 4px);
225
+ border-radius: var(--style-radius-s, 4px);
137
226
  }
138
227
  }
139
228
 
140
229
  &.collapsible--collapsed > .collapsible__toggle-wrap {
141
- border-bottom-left-radius: var(--radius-medium, 4px);
142
- border-bottom-right-radius: var(--radius-medium, 4px);
230
+ border-bottom-left-radius: var(--style-radius-s, 4px);
231
+ border-bottom-right-radius: var(--style-radius-s, 4px);
143
232
  }
144
233
 
145
234
  // The toggle button covers the whole header. The handle sits above it, so a drag starts there.
@@ -152,8 +241,8 @@
152
241
  width: 20px;
153
242
  height: 20px;
154
243
  padding: 2px;
155
- border-radius: var(--radius-medium, 4px);
156
- color: var(--color-text);
244
+ border-radius: var(--style-radius-s, 4px);
245
+ color: var(--theme-elevation-800);
157
246
 
158
247
  &:hover {
159
248
  opacity: 1;
@@ -161,7 +250,7 @@
161
250
 
162
251
  &:focus-visible {
163
252
  opacity: 1;
164
- outline: 2px solid var(--color-text-tertiary);
253
+ outline: 2px solid var(--theme-elevation-400);
165
254
  }
166
255
  }
167
256
 
@@ -181,15 +270,15 @@
181
270
 
182
271
  .collapsible__content {
183
272
  padding: 0;
184
- border-bottom-left-radius: var(--radius-medium, 4px);
185
- border-bottom-right-radius: var(--radius-medium, 4px);
273
+ border-bottom-left-radius: var(--style-radius-s, 4px);
274
+ border-bottom-right-radius: var(--style-radius-s, 4px);
186
275
  }
187
276
  }
188
277
 
189
278
  .builder-field-array__title {
190
279
  display: block;
191
280
  overflow: hidden;
192
- color: var(--color-text);
281
+ color: var(--theme-text);
193
282
  font-size: var(--be-text-m);
194
283
  text-overflow: ellipsis;
195
284
  white-space: nowrap;
@@ -206,12 +295,12 @@
206
295
  border: 0;
207
296
  border-radius: 50%;
208
297
  background: none;
209
- color: var(--color-text);
298
+ color: var(--theme-elevation-800);
210
299
  cursor: pointer;
211
300
 
212
301
  &:hover,
213
302
  &[aria-expanded='true'] {
214
- background: var(--color-bg);
303
+ background: var(--theme-elevation-0);
215
304
  }
216
305
 
217
306
  // Near the inspector's right edge: the tooltip opens to the left.
@@ -225,14 +314,14 @@
225
314
  .builder-field-array__fields {
226
315
  display: flex;
227
316
  flex-direction: column;
228
- gap: calc(var(--spacer-3) * 0.75);
317
+ gap: calc(var(--base) * 0.75);
229
318
  padding: 10px;
230
319
  }
231
320
 
232
321
  // The message under an input (`InputError`).
233
322
  .builder-field-error {
234
323
  margin: 4px 0 0;
235
- color: var(--color-bg-danger);
324
+ color: var(--theme-error-500);
236
325
  font-size: var(--be-text-m);
237
326
  }
238
327
 
@@ -286,9 +375,9 @@
286
375
  justify-content: center;
287
376
  width: 20px;
288
377
  height: 20px;
289
- border-radius: var(--radius-medium);
290
- color: var(--color-text-secondary);
291
- background: var(--color-bg-secondary);
378
+ border-radius: var(--style-radius-s);
379
+ color: var(--theme-elevation-600);
380
+ background: var(--theme-elevation-50);
292
381
  cursor: help;
293
382
  }
294
383
 
@@ -0,0 +1,28 @@
1
+ export declare const WHERE_OPERATORS: readonly ['equals', 'not_equals', 'in', 'not_in', 'greater_than', 'greater_than_equal', 'less_than', 'less_than_equal', 'like', 'contains', 'exists'];
2
+ export type WhereOperator = (typeof WHERE_OPERATORS)[number];
3
+ /** One condition. `value` is the stored value (a string, number, boolean, or a list for in/not_in). */
4
+ export type WhereRow = {
5
+ field: string;
6
+ operator: WhereOperator;
7
+ value: unknown;
8
+ };
9
+ /**
10
+ * The rows of a stored where: empty for no where, null when the builder cannot show it. Takes
11
+ * `{ a: { equals: 1 }, b: { … } }` and `{ and: [ { a: { equals: 1 } }, … ] }`.
12
+ */
13
+ export declare function whereRows(where: unknown): WhereRow[] | null;
14
+ /**
15
+ * The where of the rows: one object `{ field: { op: value } }`, or `{ and: [...] }` when a field
16
+ * has the same operator twice. Rows without a field are left out. `undefined` for no rows.
17
+ */
18
+ export declare function rowsWhere(rows: readonly WhereRow[]): Record<string, unknown> | undefined;
19
+ /** The text a value shows in the value input: lists as "a, b". */
20
+ export declare const whereValueText: (value: unknown) => string;
21
+ /**
22
+ * The value to store for typed text. `fieldType` is the Payload field type when known: numbers
23
+ * become numbers and checkboxes booleans; any other text stays text (so "0412" stays a string).
24
+ * `in` and `not_in` split on commas. `exists` takes "true" or "false".
25
+ */
26
+ export declare function parseWhereValue(text: string, operator: WhereOperator, fieldType?: string): unknown;
27
+ /** The value a row keeps when its operator changes: re-read from its text for the new operator. */
28
+ export declare const convertWhereValue: (row: WhereRow, operator: WhereOperator, fieldType?: string) => unknown;