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.
- package/README.md +350 -45
- package/dist/admin/AiKeyField.d.ts +4 -3
- package/dist/admin/AiKeyField.js +3 -3
- package/dist/admin/ArrayRowLabel.d.ts +12 -0
- package/dist/admin/ArrayRowLabel.js +21 -0
- package/dist/admin/BuilderTab.js +1 -1
- package/dist/admin/DocumentEditView.d.ts +1 -1
- package/dist/admin/DocumentEditView.js +2 -3
- package/dist/admin/LayoutField.d.ts +1 -1
- package/dist/admin/LayoutField.js +2 -2
- package/dist/admin/TemplateConditionsField.d.ts +2 -2
- package/dist/admin/TemplateConditionsField.js +2 -2
- package/dist/admin/aiKeyField.css +58 -0
- package/dist/admin/client.d.ts +1 -0
- package/dist/admin/client.js +2 -0
- package/dist/admin/diff/LayoutDiff.js +3 -3
- package/dist/admin/diff/LayoutJsonDiff.d.ts +1 -1
- package/dist/admin/diff/LayoutJsonDiff.js +1 -1
- package/dist/admin/diff/layoutDiff.css +180 -0
- package/dist/admin/editor/Editor.d.ts +2 -2
- package/dist/admin/editor/Editor.js +10 -3
- package/dist/admin/editor/Inspector.js +23 -17
- package/dist/admin/editor/Library.d.ts +2 -2
- package/dist/admin/editor/Library.js +8 -7
- package/dist/admin/editor/Outline.js +20 -12
- package/dist/admin/editor/Overlay.js +6 -4
- package/dist/admin/editor/actions.d.ts +7 -2
- package/dist/admin/editor/actions.js +44 -12
- package/dist/admin/editor/assistant/AssistantPanel.d.ts +1 -1
- package/dist/admin/editor/assistant/AssistantPanel.js +33 -21
- package/dist/admin/editor/assistant/{assistant.scss → assistant.css} +322 -315
- package/dist/admin/editor/classes/ClassManager.d.ts +1 -1
- package/dist/admin/editor/classes/ClassManager.js +1 -1
- package/dist/admin/editor/classes/manager.css +258 -0
- package/dist/admin/editor/comments/CommentLayer.d.ts +1 -1
- package/dist/admin/editor/comments/CommentLayer.js +1 -1
- package/dist/admin/editor/comments/CommentsPanel.d.ts +1 -1
- package/dist/admin/editor/comments/CommentsPanel.js +1 -1
- package/dist/admin/editor/comments/{comments.scss → comments.css} +121 -140
- package/dist/admin/editor/comments/controller.d.ts +7 -0
- package/dist/admin/editor/comments/controller.js +12 -0
- package/dist/admin/editor/comments/useCommentFromURL.d.ts +2 -0
- package/dist/admin/editor/comments/useCommentFromURL.js +36 -0
- package/dist/admin/editor/dnd/{dnd.scss → dnd.css} +78 -80
- package/dist/admin/editor/dnd/smooth.js +1 -1
- package/dist/admin/editor/{editor.scss → editor.css} +798 -751
- package/dist/admin/editor/empty/EmptyStart.d.ts +1 -1
- package/dist/admin/editor/empty/EmptyStart.js +3 -3
- package/dist/admin/editor/empty/{empty.scss → empty.css} +12 -13
- package/dist/admin/editor/fields/ArrayField.js +3 -3
- package/dist/admin/editor/fields/FormBlock.d.ts +20 -0
- package/dist/admin/editor/fields/FormBlock.js +167 -0
- package/dist/admin/editor/fields/FormFieldName.d.ts +25 -0
- package/dist/admin/editor/fields/FormFieldName.js +58 -0
- package/dist/admin/editor/fields/GroupField.d.ts +22 -2
- package/dist/admin/editor/fields/GroupField.js +30 -1
- package/dist/admin/editor/fields/MergeTags.d.ts +8 -0
- package/dist/admin/editor/fields/MergeTags.js +62 -0
- package/dist/admin/editor/fields/arrayRows.d.ts +0 -2
- package/dist/admin/editor/fields/arrayRows.js +0 -4
- package/dist/admin/editor/fields/fields.css +786 -0
- package/dist/admin/editor/fields/values.d.ts +0 -2
- package/dist/admin/editor/fields/values.js +0 -14
- package/dist/admin/editor/generate/GenerateImage.d.ts +1 -1
- package/dist/admin/editor/generate/GenerateImage.js +1 -1
- package/dist/admin/editor/generate/{generate.scss → generate.css} +83 -82
- package/dist/admin/editor/icons.d.ts +3 -0
- package/dist/admin/editor/icons.js +3 -0
- package/dist/admin/editor/insert/InsertHandle.js +1 -1
- package/dist/admin/editor/insert/picker.d.ts +3 -2
- package/dist/admin/editor/insert/picker.js +9 -3
- package/dist/admin/editor/layout/LeftPanel.js +5 -3
- package/dist/admin/editor/layout/layout.css +243 -0
- package/dist/admin/editor/layout/leftTabs.d.ts +15 -0
- package/dist/admin/editor/layout/leftTabs.js +18 -0
- package/dist/admin/editor/layout/panels.js +1 -1
- package/dist/admin/editor/live/PresenceUI.d.ts +1 -1
- package/dist/admin/editor/live/PresenceUI.js +2 -2
- package/dist/admin/editor/live/{presence.scss → presence.css} +5 -4
- package/dist/admin/editor/locale/LocaleField.d.ts +1 -1
- package/dist/admin/editor/locale/LocaleField.js +1 -1
- package/dist/admin/editor/locale/LocaleSwitcher.d.ts +1 -1
- package/dist/admin/editor/locale/LocaleSwitcher.js +1 -1
- package/dist/admin/editor/locale/locale.css +153 -0
- package/dist/admin/editor/media/ImageEditor.d.ts +9 -3
- package/dist/admin/editor/media/ImageEditor.js +17 -11
- package/dist/admin/editor/media/{media.scss → media.css} +70 -60
- package/dist/admin/editor/media/model.d.ts +10 -1
- package/dist/admin/editor/media/model.js +19 -0
- package/dist/admin/editor/menu/Menu.d.ts +1 -1
- package/dist/admin/editor/menu/Menu.js +1 -1
- package/dist/admin/editor/menu/blockMenu.js +3 -3
- package/dist/admin/editor/menu/menu.css +132 -0
- package/dist/admin/editor/motion/MotionPanel.d.ts +2 -2
- package/dist/admin/editor/motion/MotionPanel.js +2 -2
- package/dist/admin/editor/motion/{motion.scss → motion.css} +24 -21
- package/dist/admin/editor/names.d.ts +9 -0
- package/dist/admin/editor/names.js +18 -0
- package/dist/admin/editor/regions/RegionFields.d.ts +6 -0
- package/dist/admin/editor/regions/RegionFields.js +122 -0
- package/dist/admin/editor/regions/RegionPane.js +5 -3
- package/dist/admin/editor/regions/RegionRows.js +2 -2
- package/dist/admin/editor/regions/required.d.ts +16 -0
- package/dist/admin/editor/regions/required.js +43 -0
- package/dist/admin/editor/renderField.d.ts +10 -3
- package/dist/admin/editor/renderField.js +87 -33
- package/dist/admin/editor/runtime.d.ts +3 -2
- package/dist/admin/editor/runtime.js +12 -18
- package/dist/admin/editor/sections/ComponentFields.d.ts +1 -1
- package/dist/admin/editor/sections/ComponentFields.js +2 -3
- package/dist/admin/editor/sections/PropertyControls.d.ts +1 -1
- package/dist/admin/editor/sections/PropertyControls.js +1 -1
- package/dist/admin/editor/sections/components.css +244 -0
- package/dist/admin/editor/sections/variants.css +93 -0
- package/dist/admin/editor/sections/variants.d.ts +1 -1
- package/dist/admin/editor/sections/variants.js +1 -1
- package/dist/admin/editor/styles/ClassBar.d.ts +1 -1
- package/dist/admin/editor/styles/ClassBar.js +1 -1
- package/dist/admin/editor/styles/StylesPanel.d.ts +1 -1
- package/dist/admin/editor/styles/StylesPanel.js +5 -3
- package/dist/admin/editor/styles/{classes.scss → classes.css} +128 -125
- package/dist/admin/editor/styles/context.js +9 -4
- package/dist/admin/editor/styles/{styles.scss → styles.css} +368 -370
- package/dist/admin/editor/templates/Bindable.d.ts +1 -1
- package/dist/admin/editor/templates/Bindable.js +1 -1
- package/dist/admin/editor/templates/binding.js +4 -1
- package/dist/admin/editor/templates/{templates.scss → templates.css} +207 -206
- package/dist/admin/editor/tooltip/Tooltips.d.ts +1 -1
- package/dist/admin/editor/tooltip/Tooltips.js +1 -1
- package/dist/admin/editor/tooltip/{tooltip.scss → tooltip.css} +11 -10
- package/dist/admin/editor/topbar/ContentModeToggle.d.ts +1 -1
- package/dist/admin/editor/topbar/ContentModeToggle.js +2 -2
- package/dist/admin/editor/topbar/DocumentActions.js +5 -5
- package/dist/admin/editor/topbar/TopBar.d.ts +1 -1
- package/dist/admin/editor/topbar/TopBar.js +2 -3
- package/dist/admin/editor/topbar/contentMode.css +25 -0
- package/dist/admin/editor/topbar/screens/DrawerRouter.d.ts +1 -1
- package/dist/admin/editor/topbar/screens/DrawerRouter.js +52 -40
- package/dist/admin/editor/topbar/screens/ScreenDrawer.d.ts +1 -1
- package/dist/admin/editor/topbar/screens/ScreenDrawer.js +4 -5
- package/dist/admin/editor/topbar/screens/drawerRouterSupport.d.ts +5 -5
- package/dist/admin/editor/topbar/screens/drawerRouterSupport.js +7 -7
- package/dist/admin/editor/topbar/screens/screens.css +139 -0
- package/dist/admin/editor/topbar/settingsDrawer.css +33 -0
- package/dist/admin/editor/topbar/settingsDrawer.d.ts +1 -1
- package/dist/admin/editor/topbar/settingsDrawer.js +3 -3
- package/dist/admin/editor/topbar/{topbar.scss → topbar.css} +189 -231
- package/dist/admin/editor/ui/Select.d.ts +1 -1
- package/dist/admin/editor/ui/Select.js +1 -1
- package/dist/admin/editor/ui/Slider.d.ts +1 -1
- package/dist/admin/editor/ui/Slider.js +1 -1
- package/dist/admin/editor/ui/Tabs.d.ts +17 -0
- package/dist/admin/editor/ui/Tabs.js +17 -0
- package/dist/admin/editor/ui/controls.css +301 -0
- package/dist/admin/forms/SubmissionCells.d.ts +6 -0
- package/dist/admin/forms/SubmissionCells.js +31 -0
- package/dist/admin/forms/SubmissionView.d.ts +5 -0
- package/dist/admin/forms/SubmissionView.js +106 -0
- package/dist/admin/forms/submissionData.d.ts +32 -0
- package/dist/admin/forms/submissionData.js +63 -0
- package/dist/admin/forms/submissions.css +200 -0
- package/dist/admin/layoutField.css +70 -0
- package/dist/admin/rsc.d.ts +2 -0
- package/dist/admin/rsc.js +5 -0
- package/dist/admin/screen/BuilderScreen.d.ts +1 -1
- package/dist/admin/screen/BuilderScreen.js +1 -1
- package/dist/admin/templateConditions.css +25 -0
- package/dist/ai/endpoint.d.ts +5 -0
- package/dist/ai/endpoint.js +18 -8
- package/dist/ai/images/service.js +2 -2
- package/dist/ai/prompt.d.ts +8 -0
- package/dist/ai/prompt.js +30 -0
- package/dist/ai/settings/index.js +3 -0
- package/dist/ai/tools.d.ts +6 -1
- package/dist/ai/tools.js +90 -6
- package/dist/blocks/builtins/carousel.js +10 -1
- package/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/index.js +1 -1
- package/dist/blocks/payload.d.ts +7 -0
- package/dist/blocks/payload.js +16 -2
- package/dist/classes/collection.js +1 -0
- package/dist/classes/sheet.js +2 -0
- package/dist/comments/collection.js +3 -0
- package/dist/comments/shared.d.ts +5 -0
- package/dist/comments/shared.js +5 -0
- package/dist/core/blocks.d.ts +17 -3
- package/dist/core/blocks.js +92 -10
- package/dist/core/classes.d.ts +5 -0
- package/dist/core/classes.js +26 -1
- package/dist/core/conditions.d.ts +7 -0
- package/dist/core/conditions.js +22 -0
- package/dist/core/dropTarget.d.ts +3 -2
- package/dist/core/dropTarget.js +7 -1
- package/dist/core/fieldHooks.d.ts +1 -1
- package/dist/core/index.d.ts +6 -3
- package/dist/core/index.js +6 -3
- package/dist/core/payloadBlocks.js +25 -3
- package/dist/core/references.d.ts +7 -0
- package/dist/core/references.js +29 -11
- package/dist/core/regions.d.ts +14 -0
- package/dist/core/regions.js +17 -1
- package/dist/core/rowLabel.d.ts +8 -0
- package/dist/core/rowLabel.js +98 -0
- package/dist/core/starter.d.ts +10 -0
- package/dist/core/starter.js +40 -0
- package/dist/core/tree.js +4 -0
- package/dist/core/types.d.ts +96 -0
- package/dist/core/uniqueProps.d.ts +40 -0
- package/dist/core/uniqueProps.js +156 -0
- package/dist/core/validate.js +43 -3
- package/dist/forms/answers.d.ts +21 -0
- package/dist/forms/answers.js +82 -0
- package/dist/forms/blocks.d.ts +33 -0
- package/dist/forms/blocks.js +178 -0
- package/dist/forms/conditions.d.ts +78 -0
- package/dist/forms/conditions.js +184 -0
- package/dist/forms/emails.d.ts +23 -0
- package/dist/forms/emails.js +64 -0
- package/dist/forms/fieldConfigs.d.ts +35 -0
- package/dist/forms/fieldConfigs.js +167 -0
- package/dist/forms/fieldOps.d.ts +78 -0
- package/dist/forms/fieldOps.js +378 -0
- package/dist/forms/fieldSettings.d.ts +81 -0
- package/dist/forms/fieldSettings.js +239 -0
- package/dist/forms/files.d.ts +54 -0
- package/dist/forms/files.js +128 -0
- package/dist/forms/index.d.ts +16 -0
- package/dist/forms/index.js +18 -0
- package/dist/forms/mergeTags.d.ts +103 -0
- package/dist/forms/mergeTags.js +150 -0
- package/dist/forms/noScript.d.ts +60 -0
- package/dist/forms/noScript.js +109 -0
- package/dist/forms/pageForms.d.ts +99 -0
- package/dist/forms/pageForms.js +294 -0
- package/dist/forms/pageSync.d.ts +91 -0
- package/dist/forms/pageSync.js +325 -0
- package/dist/forms/rateLimit.d.ts +21 -0
- package/dist/forms/rateLimit.js +50 -0
- package/dist/forms/settings.d.ts +13 -0
- package/dist/forms/settings.js +92 -0
- package/dist/forms/spam.d.ts +100 -0
- package/dist/forms/spam.js +218 -0
- package/dist/forms/spamSettings.d.ts +43 -0
- package/dist/forms/spamSettings.js +25 -0
- package/dist/forms/submission.d.ts +34 -0
- package/dist/forms/submission.js +89 -0
- package/dist/forms/submissionsAdmin.d.ts +26 -0
- package/dist/forms/submissionsAdmin.js +108 -0
- package/dist/forms/summary.d.ts +60 -0
- package/dist/forms/summary.js +113 -0
- package/dist/forms/uploads.d.ts +41 -0
- package/dist/forms/uploads.js +132 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.js +8 -2
- package/dist/live/document.d.ts +12 -0
- package/dist/live/document.js +8 -1
- package/dist/live/draftAccess.js +1 -1
- package/dist/live/endpoints.d.ts +1 -0
- package/dist/live/session.js +3 -1
- package/dist/live/storage.d.ts +13 -2
- package/dist/live/storage.js +18 -7
- package/dist/mcp/forms.d.ts +26 -0
- package/dist/mcp/forms.js +280 -0
- package/dist/mcp/index.d.ts +7 -0
- package/dist/mcp/index.js +29 -10
- package/dist/mcp/shared.d.ts +1 -0
- package/dist/mcp/shared.js +1 -0
- package/dist/plugin/forms.d.ts +30 -0
- package/dist/plugin/forms.js +63 -0
- package/dist/plugin/formsSync.d.ts +138 -0
- package/dist/plugin/formsSync.js +345 -0
- package/dist/plugin/hook.d.ts +22 -0
- package/dist/plugin/hook.js +19 -7
- package/dist/plugin/index.d.ts +14 -0
- package/dist/plugin/index.js +101 -30
- package/dist/plugin/links.d.ts +7 -2
- package/dist/plugin/links.js +9 -3
- package/dist/plugin/references.d.ts +6 -0
- package/dist/plugin/references.js +12 -0
- package/dist/plugin/sections.js +3 -0
- package/dist/plugin/templates.js +5 -1
- package/dist/react/canvas/BuilderCanvas.d.ts +2 -0
- package/dist/react/canvas/BuilderCanvas.js +29 -6
- package/dist/react/canvas/inline/candidates.js +2 -2
- package/dist/react/canvas/inline/mapper.d.ts +6 -1
- package/dist/react/canvas/inline/mapper.js +35 -4
- package/dist/react/canvas/inline/rich/editor.js +9 -1
- package/dist/react/components/Image.d.ts +1 -1
- package/dist/react/components/Image.js +2 -2
- package/dist/react/render/LayoutOutlet.d.ts +7 -3
- package/dist/react/render/LayoutOutlet.js +9 -4
- package/dist/react/render/RenderLayout.js +13 -7
- package/dist/react/render/resolve.d.ts +1 -0
- package/dist/react/render/resolve.js +7 -1
- package/dist/react/render/templates.js +3 -1
- package/dist/react/server.js +19 -0
- package/dist/react/theme/ThemeStyle.js +1 -1
- package/dist/theme/admin/ColorField.d.ts +4 -3
- package/dist/theme/admin/ColorField.js +1 -1
- package/dist/theme/admin/FontField.d.ts +4 -3
- package/dist/theme/admin/FontField.js +1 -1
- package/dist/theme/admin/SaveSignal.js +1 -1
- package/dist/theme/admin/SliderField.d.ts +1 -1
- package/dist/theme/admin/SliderField.js +1 -1
- package/dist/theme/admin/Variables.d.ts +4 -3
- package/dist/theme/admin/Variables.js +2 -2
- package/dist/theme/admin/fields.css +327 -0
- package/dist/theme/global.js +2 -0
- package/package.json +29 -24
- package/dist/admin/aiKeyField.scss +0 -58
- package/dist/admin/diff/layoutDiff.scss +0 -181
- package/dist/admin/editor/classes/manager.scss +0 -262
- package/dist/admin/editor/fields/fields.scss +0 -628
- package/dist/admin/editor/layout/layout.scss +0 -240
- package/dist/admin/editor/locale/locale.scss +0 -154
- package/dist/admin/editor/menu/menu.scss +0 -132
- package/dist/admin/editor/sections/components.scss +0 -238
- package/dist/admin/editor/sections/variants.scss +0 -90
- package/dist/admin/editor/topbar/contentMode.scss +0 -35
- package/dist/admin/editor/topbar/screens/screens.scss +0 -134
- package/dist/admin/editor/topbar/settingsDrawer.scss +0 -32
- package/dist/admin/editor/ui/controls.scss +0 -320
- package/dist/admin/layoutField.scss +0 -69
- package/dist/admin/templateConditions.scss +0 -24
- package/dist/theme/admin/fields.scss +0 -363
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The form submissions admin: the detail view (SubmissionView.tsx) and the list cells
|
|
3
|
+
* (SubmissionCells.tsx). Payload CSS variables only, no Tailwind (it would leak into the admin).
|
|
4
|
+
*/
|
|
5
|
+
@layer payload-default {
|
|
6
|
+
.form-submission {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: calc(1.0156rem * 1.25);
|
|
10
|
+
margin-bottom: calc(1.0156rem * 1.5);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.form-submission__head {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-wrap: wrap;
|
|
16
|
+
align-items: flex-start;
|
|
17
|
+
justify-content: space-between;
|
|
18
|
+
gap: 1.0156rem;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.form-submission__heading {
|
|
22
|
+
min-width: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.form-submission__form {
|
|
26
|
+
margin: 0 0 calc(1.0156rem * 0.25);
|
|
27
|
+
color: var(--color-text-tertiary);
|
|
28
|
+
font-size: 0.6602rem;
|
|
29
|
+
font-weight: 500;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.form-submission__title {
|
|
33
|
+
margin: 0;
|
|
34
|
+
overflow-wrap: anywhere;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.form-submission__meta {
|
|
38
|
+
margin: calc(1.0156rem * 0.25) 0 0;
|
|
39
|
+
color: var(--color-text-secondary);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.form-submission__meta a {
|
|
43
|
+
color: inherit;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.form-submission__answers {
|
|
47
|
+
width: 100%;
|
|
48
|
+
border-collapse: collapse;
|
|
49
|
+
border: 1px solid var(--color-border);
|
|
50
|
+
border-radius: var(--radius-medium);
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.form-submission__answers th,
|
|
55
|
+
.form-submission__answers td {
|
|
56
|
+
padding: calc(1.0156rem * 0.6) calc(1.0156rem * 0.75);
|
|
57
|
+
border-bottom: 1px solid var(--color-border);
|
|
58
|
+
text-align: left;
|
|
59
|
+
vertical-align: top;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.form-submission__answers tr:last-child th,
|
|
63
|
+
.form-submission__answers tr:last-child td {
|
|
64
|
+
border-bottom: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.form-submission__answers th {
|
|
68
|
+
width: 32%;
|
|
69
|
+
color: var(--color-text-secondary);
|
|
70
|
+
font-weight: 500;
|
|
71
|
+
background: var(--color-bg-secondary);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.form-submission__answers td {
|
|
75
|
+
color: var(--color-text);
|
|
76
|
+
overflow-wrap: anywhere;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.form-submission__text {
|
|
80
|
+
white-space: pre-wrap;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.form-submission__empty {
|
|
84
|
+
margin: 0;
|
|
85
|
+
color: var(--color-text-tertiary);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.form-submission__subtitle {
|
|
89
|
+
margin: 0 0 calc(1.0156rem * 0.5);
|
|
90
|
+
font-size: 0.8125rem;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.form-submission__files {
|
|
94
|
+
display: grid;
|
|
95
|
+
grid-template-columns: repeat(auto-fill, minmax(calc(1.0156rem * 14), 1fr));
|
|
96
|
+
gap: calc(1.0156rem * 0.5);
|
|
97
|
+
margin: 0;
|
|
98
|
+
padding: 0;
|
|
99
|
+
list-style: none;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.form-submission__file {
|
|
103
|
+
display: flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
gap: calc(1.0156rem * 0.6);
|
|
106
|
+
padding: calc(1.0156rem * 0.4);
|
|
107
|
+
border: 1px solid var(--color-border);
|
|
108
|
+
border-radius: var(--radius-medium);
|
|
109
|
+
color: inherit;
|
|
110
|
+
text-decoration: none;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
a.form-submission__file:hover {
|
|
114
|
+
border-color: var(--color-border-control-strong);
|
|
115
|
+
background: var(--color-bg-secondary);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.form-submission__thumb {
|
|
119
|
+
display: grid;
|
|
120
|
+
flex: none;
|
|
121
|
+
place-items: center;
|
|
122
|
+
width: calc(1.0156rem * 2.75);
|
|
123
|
+
height: calc(1.0156rem * 2.75);
|
|
124
|
+
overflow: hidden;
|
|
125
|
+
border-radius: var(--radius-medium);
|
|
126
|
+
background: var(--color-bg-hover);
|
|
127
|
+
color: var(--color-text-secondary);
|
|
128
|
+
font-size: 0.5586rem;
|
|
129
|
+
font-weight: 600;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.form-submission__thumb img {
|
|
133
|
+
width: 100%;
|
|
134
|
+
height: 100%;
|
|
135
|
+
object-fit: cover;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.form-submission__file-text {
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-direction: column;
|
|
141
|
+
min-width: 0;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.form-submission__file-name {
|
|
145
|
+
overflow: hidden;
|
|
146
|
+
text-overflow: ellipsis;
|
|
147
|
+
white-space: nowrap;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.form-submission__file-meta {
|
|
151
|
+
color: var(--color-text-tertiary);
|
|
152
|
+
font-size: 0.6094rem;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* List cells. */
|
|
156
|
+
.form-submission-cell {
|
|
157
|
+
display: flex;
|
|
158
|
+
flex-direction: column;
|
|
159
|
+
min-width: 0;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.form-submission-cell__line {
|
|
163
|
+
font-weight: 500;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.form-submission-cell__text,
|
|
167
|
+
.form-submission-cell__opened {
|
|
168
|
+
color: var(--color-text-tertiary);
|
|
169
|
+
font-size: 0.6602rem;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/*
|
|
173
|
+
* Same size as the starter's Status badges (Draft, Published): 12px text, a dot, 2px 8px padding.
|
|
174
|
+
* Payload flips these scales in dark mode, so the same steps work in both themes.
|
|
175
|
+
*/
|
|
176
|
+
.form-submission-badge {
|
|
177
|
+
display: inline-flex;
|
|
178
|
+
align-items: center;
|
|
179
|
+
gap: 6px;
|
|
180
|
+
/* List cells make their children block boxes: keep the badge as wide as its text. */
|
|
181
|
+
width: fit-content;
|
|
182
|
+
padding: 2px 8px;
|
|
183
|
+
border-radius: 999px;
|
|
184
|
+
background: var(--color-bg-selected);
|
|
185
|
+
color: var(--color-text-brand);
|
|
186
|
+
font-size: 12px;
|
|
187
|
+
font-weight: 500;
|
|
188
|
+
line-height: 18px;
|
|
189
|
+
white-space: nowrap;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.form-submission-badge::before {
|
|
193
|
+
content: "";
|
|
194
|
+
width: 6px;
|
|
195
|
+
height: 6px;
|
|
196
|
+
border-radius: 50%;
|
|
197
|
+
background: currentColor;
|
|
198
|
+
opacity: 0.8;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The layout field in Payload's edit view (LayoutField.tsx) and the note while the edit view opens
|
|
3
|
+
* the builder (DocumentEditView.tsx). Payload CSS variables only, no Tailwind (it would leak into
|
|
4
|
+
* the admin).
|
|
5
|
+
*/
|
|
6
|
+
@layer payload-default {
|
|
7
|
+
.builder-summary__box {
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
border: 1px solid var(--color-border);
|
|
10
|
+
border-radius: var(--radius-medium);
|
|
11
|
+
background: var(--field-color-bg, var(--color-bg));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.builder-summary__head {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: space-between;
|
|
18
|
+
gap: 1.0156rem;
|
|
19
|
+
min-height: calc(1.0156rem * 2.5);
|
|
20
|
+
padding: calc(1.0156rem * 0.5) calc(1.0156rem * 0.5) calc(1.0156rem * 0.5) calc(1.0156rem * 0.75);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.builder-summary__head .btn {
|
|
24
|
+
flex: none;
|
|
25
|
+
margin: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.builder-summary__count {
|
|
29
|
+
margin: 0;
|
|
30
|
+
color: var(--color-text);
|
|
31
|
+
font-weight: 500;
|
|
32
|
+
font-variant-numeric: tabular-nums;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* The first sections, numbered like the page order. */
|
|
36
|
+
.builder-summary__list {
|
|
37
|
+
margin: 0;
|
|
38
|
+
padding: calc(1.0156rem * 0.5) calc(1.0156rem * 0.75) calc(1.0156rem * 0.5) calc(1.0156rem * 2);
|
|
39
|
+
border-top: 1px solid var(--color-border);
|
|
40
|
+
color: var(--color-text);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.builder-summary__list li {
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
padding: 2px 0;
|
|
46
|
+
text-overflow: ellipsis;
|
|
47
|
+
white-space: nowrap;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.builder-summary__list li::marker {
|
|
51
|
+
color: var(--color-text-tertiary);
|
|
52
|
+
font-variant-numeric: tabular-nums;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.builder-summary__more {
|
|
56
|
+
margin: 0;
|
|
57
|
+
padding: 0 calc(1.0156rem * 0.75) calc(1.0156rem * 0.5) calc(1.0156rem * 2);
|
|
58
|
+
color: var(--color-text-tertiary);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.builder-summary__error {
|
|
62
|
+
color: var(--color-text-danger);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.builder-open-note {
|
|
66
|
+
display: block;
|
|
67
|
+
margin: calc(1.0156rem * 2) var(--gutter-h, calc(1.0156rem * 2));
|
|
68
|
+
color: var(--color-text-tertiary);
|
|
69
|
+
}
|
|
70
|
+
}
|
package/dist/admin/rsc.d.ts
CHANGED
|
@@ -2,3 +2,5 @@ export { BuilderView } from './server/BuilderView.js';
|
|
|
2
2
|
export { BuilderRedirect } from './server/BuilderRedirect.js';
|
|
3
3
|
export { LayoutDiff } from './diff/LayoutDiff.js';
|
|
4
4
|
export { NoDiff } from './diff/NoDiff.js';
|
|
5
|
+
export { SubmissionView } from './forms/SubmissionView.js';
|
|
6
|
+
export { SubmissionReadCell, SubmissionSummaryCell } from './forms/SubmissionCells.js';
|
package/dist/admin/rsc.js
CHANGED
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
// 'payload-canvas/rsc#BuilderRedirect' — the document's `/builder` path, redirects to it
|
|
4
4
|
// 'payload-canvas/rsc#LayoutDiff' — the layout field in Versions > compare, in plain words
|
|
5
5
|
// 'payload-canvas/rsc#NoDiff' — no row in Versions > compare (the generated CSS)
|
|
6
|
+
// 'payload-canvas/rsc#SubmissionView' — a form submission: answers with the form's labels, files, reply link; marks it read
|
|
7
|
+
// 'payload-canvas/rsc#SubmissionSummaryCell' — the submissions list's Message column
|
|
8
|
+
// 'payload-canvas/rsc#SubmissionReadCell' — the submissions list's "New" badge / opened date
|
|
6
9
|
export { BuilderView } from './server/BuilderView.js';
|
|
7
10
|
export { BuilderRedirect } from './server/BuilderRedirect.js';
|
|
8
11
|
export { LayoutDiff } from './diff/LayoutDiff.js';
|
|
9
12
|
export { NoDiff } from './diff/NoDiff.js';
|
|
13
|
+
export { SubmissionView } from './forms/SubmissionView.js';
|
|
14
|
+
export { SubmissionReadCell, SubmissionSummaryCell } from './forms/SubmissionCells.js';
|
|
@@ -2,7 +2,7 @@ import type { VisibleEntities } from 'payload';
|
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
import type { AiClientConfig } from '../../ai/types.js';
|
|
4
4
|
import type { BuilderDocMeta } from '../../live/types.js';
|
|
5
|
-
import '../editor/editor.
|
|
5
|
+
import '../editor/editor.css';
|
|
6
6
|
/**
|
|
7
7
|
* Client side of the full-screen builder view: finds the collection's builder config, then mounts
|
|
8
8
|
* the editor. The builder stands in for the document's edit view, so it sets edit depth 1 like
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { EditDepthProvider, EntityVisibilityProvider, useConfig } from '@payloadcms/ui';
|
|
4
4
|
import { Editor } from '../editor/Editor.js';
|
|
5
|
-
import '../editor/editor.
|
|
5
|
+
import '../editor/editor.css';
|
|
6
6
|
/** The builder config the plugin put on the collection's layout field (`admin.custom.builder`). */
|
|
7
7
|
function builderConfigOf(fields) {
|
|
8
8
|
for (const field of fields) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The template conditions field in Payload's document form, outside the builder editor. The
|
|
3
|
+
* condition rows and their selects read the editor's color variables, which the editor sets on
|
|
4
|
+
* `.builder-editor`. Here they are set on the page body (the select lists render in a portal
|
|
5
|
+
* there) while the field is on the page. The values match editor.scss.
|
|
6
|
+
*/
|
|
7
|
+
@layer payload-default {
|
|
8
|
+
body:has(.builder-template-conditions) {
|
|
9
|
+
--be-accent: var(--color-bg-brand);
|
|
10
|
+
--be-border: var(--color-border);
|
|
11
|
+
--be-border-soft: var(--color-border);
|
|
12
|
+
--be-muted: var(--color-text-secondary);
|
|
13
|
+
--be-subtle: var(--color-text-tertiary);
|
|
14
|
+
--be-hover: var(--color-bg-hover);
|
|
15
|
+
--be-radius-m: var(--radius-medium, 6px);
|
|
16
|
+
--be-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
|
|
17
|
+
--be-text-s: 0.6875rem;
|
|
18
|
+
--be-text-m: var(--text-body-medium-font-size);
|
|
19
|
+
--be-weight-strong: 600;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.builder-template-conditions {
|
|
23
|
+
margin-bottom: var(--spacing-field, calc(1.0156rem * 1.5));
|
|
24
|
+
}
|
|
25
|
+
}
|
package/dist/ai/endpoint.d.ts
CHANGED
|
@@ -30,6 +30,11 @@ export type AiEndpointOptions = {
|
|
|
30
30
|
images?: ImageService;
|
|
31
31
|
/** The AI settings global: its chat key is read on every request and wins over the adapter's own key. Null: off. */
|
|
32
32
|
settings?: AiSettingsRuntime | null;
|
|
33
|
+
/** The form builder: the forms collection and its field types. The assistant edits a form's fields there. */
|
|
34
|
+
forms?: {
|
|
35
|
+
slug: string;
|
|
36
|
+
blocks: BlockDefinition[];
|
|
37
|
+
} | null;
|
|
33
38
|
/** Tests: replaces the update-access check (default: Payload's docAccessOperation). */
|
|
34
39
|
canUpdate?: (req: PayloadRequest, collection: string, id: string | number, field: string) => Promise<boolean>;
|
|
35
40
|
};
|
package/dist/ai/endpoint.js
CHANGED
|
@@ -13,7 +13,7 @@ import { missingAdapterProblem, SETTINGS_KEY_HINT } from './config.js';
|
|
|
13
13
|
import { createImageService, generateImageToMedia } from './images/service.js';
|
|
14
14
|
import { adapterIdentity, runAgent } from './loop.js';
|
|
15
15
|
import { classesConfigOf, loadClasses } from '../classes/index.js';
|
|
16
|
-
import { breakpointsPx, contextText, systemPrompt } from './prompt.js';
|
|
16
|
+
import { breakpointsPx, contextText, formSystemPrompt, systemPrompt } from './prompt.js';
|
|
17
17
|
import { withSettingsKey } from './settings/index.js';
|
|
18
18
|
import { toolDefinitions, Workspace } from './tools.js';
|
|
19
19
|
/** Path of the assistant endpoints below the API route. */
|
|
@@ -185,6 +185,13 @@ export function aiEndpoints(options) {
|
|
|
185
185
|
};
|
|
186
186
|
// Built once, in a fixed order: tools and system prompt are the cached prompt prefix.
|
|
187
187
|
const tools = toolDefinitions({ ...env, searchMedia: async () => [] });
|
|
188
|
+
// The form builder: its own field types, tools and prompt (forms/fieldOps.ts).
|
|
189
|
+
const forms = options.forms ?? null;
|
|
190
|
+
const formEnv = forms
|
|
191
|
+
? { blocks: forms.blocks, sections: [], savedSections: false, bindingSources: null, mediaCollection, form: true }
|
|
192
|
+
: null;
|
|
193
|
+
const formTools = formEnv ? toolDefinitions({ ...formEnv, searchMedia: async () => [] }) : [];
|
|
194
|
+
const formSystem = forms ? [{ text: formSystemPrompt({ blocks: forms.blocks, instructions: ai.instructions }), cache: true }] : [];
|
|
188
195
|
let prompt = null;
|
|
189
196
|
const getPrompt = async (req) => {
|
|
190
197
|
const tokens = await options.getTokens(req).catch(() => null);
|
|
@@ -259,7 +266,10 @@ export function aiEndpoints(options) {
|
|
|
259
266
|
if (foreign) {
|
|
260
267
|
return errorResponse(409, 'invalid_request', `This chat was started with another AI model (${foreign.provider}). The assistant now uses ${identity}. Start a new chat.`);
|
|
261
268
|
}
|
|
262
|
-
const
|
|
269
|
+
const isForm = forms !== null && formEnv !== null && body.collection === forms.slug;
|
|
270
|
+
const prompted = await getPrompt(req);
|
|
271
|
+
const system = isForm ? formSystem : prompted.system;
|
|
272
|
+
const { breakpoints } = prompted;
|
|
263
273
|
// The key from the AI settings, read now: a new key works without a restart.
|
|
264
274
|
const settings = options.settings ?? null;
|
|
265
275
|
const settingsKey = settings && adapter.acceptsApiKey ? await settings.keyFor(req.payload, 'chat') : undefined;
|
|
@@ -269,14 +279,14 @@ export function aiEndpoints(options) {
|
|
|
269
279
|
const localization = target.localization ?? null;
|
|
270
280
|
const locale = localization ? knownLocale(localization, body.locale) : null;
|
|
271
281
|
const contentOnly = !(await canEditDesign(req));
|
|
272
|
-
const workspace = new Workspace(layout, blocks, { localization, locale, contentOnly });
|
|
282
|
+
const workspace = new Workspace(layout, isForm ? forms.blocks : blocks, { localization, locale, contentOnly });
|
|
273
283
|
const selectedId = body.selectedId && indexLayout(layout).has(body.selectedId) ? body.selectedId : null;
|
|
274
284
|
const titleField = config?.admin?.useAsTitle;
|
|
275
285
|
const title = titleField && typeof doc[titleField] === 'string' ? doc[titleField] : undefined;
|
|
276
286
|
// Saved sections differ per user and change often: they go in the context, not the cached prompt.
|
|
277
|
-
const saved = savedSections ? await loadSavedSections(req, savedSections.slug) : [];
|
|
287
|
+
const saved = savedSections && !isForm ? await loadSavedSections(req, savedSections.slug) : [];
|
|
278
288
|
// Editable classes change at any time too.
|
|
279
|
-
const classes = classesConfigOf(req.payload) ? await loadClasses(req).catch(() => []) : [];
|
|
289
|
+
const classes = classesConfigOf(req.payload) && !isForm ? await loadClasses(req).catch(() => []) : [];
|
|
280
290
|
const isTemplate = templates !== null && body.collection === templates.slug;
|
|
281
291
|
const templateTarget = isTemplate
|
|
282
292
|
? (typeof doc[TEMPLATE_TARGET_FIELD] === 'string' ? doc[TEMPLATE_TARGET_FIELD] : (body.context?.collection ?? null))
|
|
@@ -332,15 +342,15 @@ export function aiEndpoints(options) {
|
|
|
332
342
|
await runAgent({
|
|
333
343
|
adapter: model,
|
|
334
344
|
system,
|
|
335
|
-
tools,
|
|
345
|
+
tools: isForm ? formTools : tools,
|
|
336
346
|
effort: ai.effort,
|
|
337
347
|
maxSteps: ai.maxSteps ?? DEFAULT_MAX_STEPS,
|
|
338
348
|
messages: body.messages,
|
|
339
349
|
context,
|
|
340
350
|
workspace,
|
|
341
351
|
env: {
|
|
342
|
-
...env,
|
|
343
|
-
sections: [...sections, ...saved],
|
|
352
|
+
...(isForm ? formEnv : env),
|
|
353
|
+
sections: isForm ? [] : [...sections, ...saved],
|
|
344
354
|
searchMedia: mediaSearch(req, mediaCollection),
|
|
345
355
|
generateImage: assistantImageGenerator(req, images, controller.signal),
|
|
346
356
|
},
|
|
@@ -216,7 +216,7 @@ export async function generateImageToMedia(req, service, input) {
|
|
|
216
216
|
}
|
|
217
217
|
try {
|
|
218
218
|
const access = config.access?.create;
|
|
219
|
-
const allowed = access ? await access({ req, data }) : Boolean(req.user);
|
|
219
|
+
const allowed = access ? await access({ req, data, slug }) : Boolean(req.user);
|
|
220
220
|
if (!allowed)
|
|
221
221
|
return failure('forbidden', 403, `You may not upload to "${slug}", so you cannot generate images there.`);
|
|
222
222
|
}
|
|
@@ -292,7 +292,7 @@ export async function generateImageToMedia(req, service, input) {
|
|
|
292
292
|
const message = error instanceof Error ? error.message : String(error);
|
|
293
293
|
return failure('api_error', 500, `The image was generated but could not be saved in "${slug}": ${message}`);
|
|
294
294
|
}
|
|
295
|
-
const sizes = isPlainObject(doc.
|
|
295
|
+
const sizes = isPlainObject(doc.variants) ? doc.variants : {};
|
|
296
296
|
const thumbnail = isPlainObject(sizes.thumbnail) ? str(sizes.thumbnail.url) : null;
|
|
297
297
|
const media = {
|
|
298
298
|
id: doc.id,
|
package/dist/ai/prompt.d.ts
CHANGED
|
@@ -18,6 +18,14 @@ export declare function breakpointsPx(tokens: StyleTokens | null): Array<{
|
|
|
18
18
|
}>;
|
|
19
19
|
/** The stable system prompt. Same input, same bytes: keep it free of request data. */
|
|
20
20
|
export declare function systemPrompt(catalog: PromptCatalog): string;
|
|
21
|
+
/**
|
|
22
|
+
* The system prompt of the form builder (`websiteBuilder({ forms })`): the assistant edits a
|
|
23
|
+
* form's fields, not a page. `blocks` are the form's field types.
|
|
24
|
+
*/
|
|
25
|
+
export declare function formSystemPrompt(catalog: {
|
|
26
|
+
blocks: BlockDefinition[];
|
|
27
|
+
instructions?: string;
|
|
28
|
+
}): string;
|
|
21
29
|
export type ContextInput = {
|
|
22
30
|
collection: string;
|
|
23
31
|
id: string | number;
|
package/dist/ai/prompt.js
CHANGED
|
@@ -7,6 +7,7 @@ import { localeLabel } from '../core/locale.js';
|
|
|
7
7
|
import { sectionVersions } from '../core/sections.js';
|
|
8
8
|
import { BINDINGS_GUIDE, describeBlock, layoutGuide, outline } from '../mcp/shared.js';
|
|
9
9
|
import { componentProperties } from '../core/components.js';
|
|
10
|
+
import { formFieldTypes, FORM_FIELDS_GUIDE } from '../forms/fieldOps.js';
|
|
10
11
|
/** Default Tailwind palette colors (red-500 …) and keywords. The prompt lists only theme colors. */
|
|
11
12
|
const PALETTE = /-\d{2,3}$/;
|
|
12
13
|
const KEYWORDS = new Set(['black', 'white', 'transparent', 'current', 'inherit']);
|
|
@@ -139,6 +140,35 @@ RICH TEXT
|
|
|
139
140
|
parts.push(`INSTRUCTIONS FROM THE SITE OWNER\n${extra}`);
|
|
140
141
|
return parts.join('\n\n');
|
|
141
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* The system prompt of the form builder (`websiteBuilder({ forms })`): the assistant edits a
|
|
145
|
+
* form's fields, not a page. `blocks` are the form's field types.
|
|
146
|
+
*/
|
|
147
|
+
export function formSystemPrompt(catalog) {
|
|
148
|
+
const parts = [
|
|
149
|
+
`You are the AI assistant inside a form builder for Payload CMS. The user has one form open (a contact form, a booking request, a survey) and asks you to change its fields: add, rename, reorder or remove questions, make them required, set their options, display conditions and classes (the width too). You make those changes with your tools.
|
|
150
|
+
|
|
151
|
+
HOW YOUR EDITS WORK
|
|
152
|
+
- editFormFields changes the open form. Each change appears in the form builder at once. You never save: the builder saves as usual, and the user can undo your whole reply in one step.
|
|
153
|
+
- Each user message comes with an <editor_context> block: the form's fields as a layout JSON (each block is one field; its type is "form" plus the field type, e.g. "formEmail"; its props are the field's values). The newest context block is the truth. getForm returns the fields in a simpler shape.
|
|
154
|
+
- "this" and "the selected field" mean the selected block.
|
|
155
|
+
- You cannot change the form's settings (title, submit button, confirmation message, emails, spam protection). When the user asks for one, tell them to click an empty spot of the canvas: the right panel then shows the form settings.
|
|
156
|
+
|
|
157
|
+
HOW TO WORK
|
|
158
|
+
1. Start with one short sentence that says what you are going to do.
|
|
159
|
+
2. Put related changes into one editFormFields call. Changes apply in order, all or nothing.
|
|
160
|
+
3. Ask people only for what you need: keep forms short, mark only the needed fields required, and use the field type that fits (email for addresses, textarea for messages, select or radio for a fixed list of choices, checkbox to accept terms).
|
|
161
|
+
4. Labels are short questions or nouns ("Your name", "Email", "How can we help?"). Names are short, lowercase, with _ ("company_size").
|
|
162
|
+
5. When a tool returns an error, read it, fix the input and try again. Do not repeat a call that failed.
|
|
163
|
+
6. When you are done, say in one or two plain sentences what you changed. Do not list ids or JSON.`,
|
|
164
|
+
FORM_FIELDS_GUIDE,
|
|
165
|
+
`FIELD TYPES (JSON). The types this form offers, with their props.\n${JSON.stringify(formFieldTypes(catalog.blocks))}`,
|
|
166
|
+
];
|
|
167
|
+
const extra = catalog.instructions?.trim();
|
|
168
|
+
if (extra)
|
|
169
|
+
parts.push(`INSTRUCTIONS FROM THE SITE OWNER\n${extra}`);
|
|
170
|
+
return parts.join('\n\n');
|
|
171
|
+
}
|
|
142
172
|
const MAX_STRING = 160;
|
|
143
173
|
const MAX_ITEMS = 5;
|
|
144
174
|
const MAX_DEPTH = 3;
|
|
@@ -150,6 +150,9 @@ export function aiSettingsGlobal(ai, options = {}) {
|
|
|
150
150
|
return {
|
|
151
151
|
slug,
|
|
152
152
|
label: 'AI settings',
|
|
153
|
+
// Payload 4 turns versions and authorship on by default. Versions would keep old API keys.
|
|
154
|
+
versions: false,
|
|
155
|
+
authorship: false,
|
|
153
156
|
// Keys never go through GraphQL.
|
|
154
157
|
graphQL: false,
|
|
155
158
|
access: { read: access, update: access },
|
package/dist/ai/tools.d.ts
CHANGED
|
@@ -35,6 +35,11 @@ export type ToolEnv = {
|
|
|
35
35
|
}) => Promise<GenerateImageOutcome>;
|
|
36
36
|
/** The upload collection images come from and go to. Default "media". */
|
|
37
37
|
mediaCollection?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The open document is a form (`websiteBuilder({ forms })`): `blocks` are its field types, and
|
|
40
|
+
* the tools are getForm, getBlockSchema and editFormFields (forms/fieldOps.ts).
|
|
41
|
+
*/
|
|
42
|
+
form?: boolean;
|
|
38
43
|
};
|
|
39
44
|
/** Result of one tool call. `ops` is set when the call changed the layout. */
|
|
40
45
|
export type ToolOutcome = {
|
|
@@ -87,7 +92,7 @@ export declare class Workspace {
|
|
|
87
92
|
};
|
|
88
93
|
}
|
|
89
94
|
/** "Added 2 blocks, updated 1 block" for the editor. */
|
|
90
|
-
export declare function describeOps(ops: Operation[]): string;
|
|
95
|
+
export declare function describeOps(ops: Operation[], noun?: string): string;
|
|
91
96
|
/** Tool definitions in a fixed order (the order is part of the cached prompt prefix). */
|
|
92
97
|
export declare function toolDefinitions(env: ToolEnv): AiToolDefinition[];
|
|
93
98
|
/** Running summaries, shown while the tool input streams in. */
|