payload-canvas 0.3.0-next.1 → 0.5.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 +1010 -55
- package/dist/admin/AiKeyField.d.ts +8 -0
- package/dist/admin/AiKeyField.js +54 -0
- package/dist/admin/BuilderTab.js +4 -1
- package/dist/admin/DocumentEditView.d.ts +9 -0
- package/dist/admin/DocumentEditView.js +45 -0
- package/dist/admin/LayoutField.d.ts +2 -2
- package/dist/admin/LayoutField.js +10 -7
- package/dist/admin/TemplateConditionsField.d.ts +9 -0
- package/dist/admin/TemplateConditionsField.js +22 -0
- package/dist/admin/aiKeyField.scss +58 -0
- package/dist/admin/client.d.ts +3 -0
- package/dist/admin/client.js +6 -0
- package/dist/admin/diff/LayoutDiff.js +3 -3
- package/dist/admin/diff/changes.js +13 -0
- package/dist/admin/diff/layoutDiff.scss +48 -48
- package/dist/admin/editor/Canvas.js +20 -5
- package/dist/admin/editor/DragLayer.js +1 -1
- package/dist/admin/editor/Editor.d.ts +3 -1
- package/dist/admin/editor/Editor.js +6 -3
- package/dist/admin/editor/InlineToolbar.js +1 -1
- package/dist/admin/editor/Inspector.js +115 -23
- package/dist/admin/editor/Library.js +40 -15
- package/dist/admin/editor/Outline.js +26 -19
- package/dist/admin/editor/Overlay.js +9 -4
- package/dist/admin/editor/actions.d.ts +18 -2
- package/dist/admin/editor/actions.js +53 -3
- package/dist/admin/editor/assistant/AssistantPanel.js +4 -2
- package/dist/admin/editor/assistant/ConnectAgents.js +1 -1
- package/dist/admin/editor/assistant/assistant.scss +65 -65
- package/dist/admin/editor/classes/ClassManager.d.ts +4 -0
- package/dist/admin/editor/classes/ClassManager.js +56 -0
- package/dist/admin/editor/classes/controller.d.ts +112 -0
- package/dist/admin/editor/classes/controller.js +326 -0
- package/dist/admin/editor/classes/manager.scss +262 -0
- package/dist/admin/editor/classes/managerModel.d.ts +5 -0
- package/dist/admin/editor/classes/managerModel.js +27 -0
- package/dist/admin/editor/comments/CommentLayer.d.ts +2 -0
- package/dist/admin/editor/comments/CommentLayer.js +143 -0
- package/dist/admin/editor/comments/CommentsPanel.d.ts +8 -0
- package/dist/admin/editor/comments/CommentsPanel.js +73 -0
- package/dist/admin/editor/comments/Thread.d.ts +26 -0
- package/dist/admin/editor/comments/Thread.js +84 -0
- package/dist/admin/editor/comments/comments.scss +539 -0
- package/dist/admin/editor/comments/controller.d.ts +48 -0
- package/dist/admin/editor/comments/controller.js +142 -0
- package/dist/admin/editor/contentMode.d.ts +17 -0
- package/dist/admin/editor/contentMode.js +37 -0
- package/dist/admin/editor/dnd/DropOutlines.d.ts +1 -0
- package/dist/admin/editor/dnd/DropOutlines.js +73 -0
- package/dist/admin/editor/dnd/dnd.scss +45 -2
- package/dist/admin/editor/dnd/mode.d.ts +4 -0
- package/dist/admin/editor/dnd/mode.js +39 -0
- package/dist/admin/editor/editor.scss +138 -183
- package/dist/admin/editor/empty/EmptyStart.js +21 -43
- package/dist/admin/editor/empty/empty.scss +3 -3
- package/dist/admin/editor/fields/AddButton.d.ts +15 -0
- package/dist/admin/editor/fields/AddButton.js +14 -0
- package/dist/admin/editor/fields/ArrayField.js +4 -3
- package/dist/admin/editor/fields/CheckedInputs.d.ts +1 -0
- package/dist/admin/editor/fields/ConditionRows.d.ts +19 -0
- package/dist/admin/editor/fields/ConditionRows.js +137 -0
- package/dist/admin/editor/fields/GroupField.d.ts +5 -2
- package/dist/admin/editor/fields/GroupField.js +6 -2
- package/dist/admin/editor/fields/ListWhereField.d.ts +8 -0
- package/dist/admin/editor/fields/ListWhereField.js +20 -0
- package/dist/admin/editor/fields/QueryFiltersField.d.ts +18 -0
- package/dist/admin/editor/fields/QueryFiltersField.js +41 -0
- package/dist/admin/editor/fields/RelatedField.d.ts +19 -0
- package/dist/admin/editor/fields/RelatedField.js +44 -0
- package/dist/admin/editor/fields/SortField.d.ts +13 -0
- package/dist/admin/editor/fields/SortField.js +37 -0
- package/dist/admin/editor/fields/WhereField.d.ts +25 -0
- package/dist/admin/editor/fields/WhereField.js +47 -0
- package/dist/admin/editor/fields/access.d.ts +1 -1
- package/dist/admin/editor/fields/collectionFields.d.ts +6 -0
- package/dist/admin/editor/fields/collectionFields.js +15 -0
- package/dist/admin/editor/fields/conditions.d.ts +99 -0
- package/dist/admin/editor/fields/conditions.js +339 -0
- package/dist/admin/editor/fields/fields.scss +346 -34
- package/dist/admin/editor/fields/listOptions.d.ts +44 -0
- package/dist/admin/editor/fields/listOptions.js +111 -0
- package/dist/admin/editor/fields/queryFilterRows.d.ts +8 -0
- package/dist/admin/editor/fields/queryFilterRows.js +29 -0
- package/dist/admin/editor/fields/whereRows.d.ts +27 -0
- package/dist/admin/editor/fields/whereRows.js +167 -0
- package/dist/admin/editor/generate/GenerateImage.js +1 -1
- package/dist/admin/editor/generate/generate.scss +48 -48
- package/dist/admin/editor/icons.d.ts +17 -1
- package/dist/admin/editor/icons.js +33 -2
- package/dist/admin/editor/inline.js +9 -0
- package/dist/admin/editor/insert/InsertHandle.js +5 -2
- package/dist/admin/editor/insert/picker.d.ts +3 -1
- package/dist/admin/editor/insert/picker.js +17 -10
- package/dist/admin/editor/insert/spots.d.ts +12 -1
- package/dist/admin/editor/insert/spots.js +49 -10
- package/dist/admin/editor/layout/FrameResize.js +1 -1
- package/dist/admin/editor/layout/LeftPanel.js +12 -7
- package/dist/admin/editor/layout/layout.scss +4 -4
- package/dist/admin/editor/live/PresenceUI.js +1 -1
- package/dist/admin/editor/live/presence.scss +1 -1
- package/dist/admin/editor/live/useMultiplayer.js +9 -1
- package/dist/admin/editor/locale/LocaleField.d.ts +2 -2
- package/dist/admin/editor/locale/LocaleField.js +4 -2
- package/dist/admin/editor/locale/locale.scss +12 -12
- package/dist/admin/editor/media/ImageEditor.js +1 -1
- package/dist/admin/editor/media/media.scss +23 -23
- package/dist/admin/editor/menu/Menu.js +1 -1
- package/dist/admin/editor/menu/blockMenu.js +32 -18
- package/dist/admin/editor/menu/menu.scss +16 -16
- package/dist/admin/editor/motion/MotionPanel.js +2 -2
- package/dist/admin/editor/motion/model.d.ts +2 -2
- package/dist/admin/editor/motion/model.js +2 -2
- package/dist/admin/editor/motion/motion.scss +2 -2
- package/dist/admin/editor/names.js +11 -3
- package/dist/admin/editor/regions/RegionOverlay.js +1 -1
- package/dist/admin/editor/regions/RegionPane.js +1 -1
- package/dist/admin/editor/renderField.d.ts +5 -1
- package/dist/admin/editor/renderField.js +73 -13
- package/dist/admin/editor/runtime.d.ts +14 -0
- package/dist/admin/editor/runtime.js +68 -6
- package/dist/admin/editor/sections/ComponentFields.d.ts +8 -0
- package/dist/admin/editor/sections/ComponentFields.js +116 -0
- package/dist/admin/editor/sections/PropertyControls.d.ts +18 -0
- package/dist/admin/editor/sections/PropertyControls.js +65 -0
- package/dist/admin/editor/sections/components.d.ts +29 -0
- package/dist/admin/editor/sections/components.js +112 -0
- package/dist/admin/editor/sections/components.scss +238 -0
- package/dist/admin/editor/sections/variants.d.ts +32 -0
- package/dist/admin/editor/sections/variants.js +59 -0
- package/dist/admin/editor/sections/variants.scss +90 -0
- package/dist/admin/editor/shortcuts.d.ts +4 -1
- package/dist/admin/editor/shortcuts.js +19 -3
- package/dist/admin/editor/store.d.ts +18 -0
- package/dist/admin/editor/store.js +46 -0
- package/dist/admin/editor/styles/ClassBar.d.ts +14 -0
- package/dist/admin/editor/styles/ClassBar.js +90 -0
- package/dist/admin/editor/styles/ClassCss.d.ts +4 -0
- package/dist/admin/editor/styles/ClassCss.js +28 -0
- package/dist/admin/editor/styles/ClassDialog.d.ts +2 -0
- package/dist/admin/editor/styles/ClassDialog.js +151 -0
- package/dist/admin/editor/styles/ColorPicker.js +6 -3
- package/dist/admin/editor/styles/RawClasses.d.ts +26 -1
- package/dist/admin/editor/styles/RawClasses.js +184 -32
- package/dist/admin/editor/styles/StylesPanel.d.ts +3 -1
- package/dist/admin/editor/styles/StylesPanel.js +53 -11
- package/dist/admin/editor/styles/VariantBar.js +3 -3
- package/dist/admin/editor/styles/classEdit.d.ts +4 -0
- package/dist/admin/editor/styles/classEdit.js +20 -0
- package/dist/admin/editor/styles/classes.scss +381 -0
- package/dist/admin/editor/styles/context.d.ts +24 -4
- package/dist/admin/editor/styles/context.js +32 -9
- package/dist/admin/editor/styles/controls.d.ts +3 -1
- package/dist/admin/editor/styles/controls.js +31 -13
- package/dist/admin/editor/styles/popover.d.ts +6 -0
- package/dist/admin/editor/styles/popover.js +5 -5
- package/dist/admin/editor/styles/sections.js +2 -2
- package/dist/admin/editor/styles/styles.scss +115 -139
- package/dist/admin/editor/styles/suggestions.d.ts +22 -0
- package/dist/admin/editor/styles/suggestions.js +77 -0
- package/dist/admin/editor/styles/tokens.js +14 -0
- package/dist/admin/editor/templates/Bindable.d.ts +14 -6
- package/dist/admin/editor/templates/Bindable.js +146 -61
- package/dist/admin/editor/templates/SamplePicker.js +2 -2
- package/dist/admin/editor/templates/Visibility.d.ts +9 -0
- package/dist/admin/editor/templates/Visibility.js +54 -0
- package/dist/admin/editor/templates/binding.d.ts +11 -4
- package/dist/admin/editor/templates/binding.js +23 -3
- package/dist/admin/editor/templates/templates.scss +117 -90
- package/dist/admin/editor/templates/visibilityRows.d.ts +22 -0
- package/dist/admin/editor/templates/visibilityRows.js +83 -0
- package/dist/admin/editor/tooltip/tooltip.scss +4 -4
- package/dist/admin/editor/topbar/ContentModeToggle.d.ts +5 -0
- package/dist/admin/editor/topbar/ContentModeToggle.js +26 -0
- package/dist/admin/editor/topbar/DocumentActions.d.ts +1 -1
- package/dist/admin/editor/topbar/DocumentActions.js +6 -5
- package/dist/admin/editor/topbar/DocumentTitle.js +8 -3
- package/dist/admin/editor/topbar/TopBar.js +15 -3
- package/dist/admin/editor/topbar/contentMode.scss +35 -0
- package/dist/admin/editor/topbar/screens/DrawerRouter.d.ts +1 -1
- package/dist/admin/editor/topbar/screens/ScreenDrawer.js +1 -1
- package/dist/admin/editor/topbar/screens/drawerRouterSupport.d.ts +1 -1
- package/dist/admin/editor/topbar/screens/screens.scss +20 -20
- package/dist/admin/editor/topbar/settingsDrawer.js +3 -3
- package/dist/admin/editor/topbar/settingsDrawer.scss +7 -7
- package/dist/admin/editor/topbar/topbar.scss +50 -48
- package/dist/admin/editor/ui/Select.js +1 -1
- package/dist/admin/editor/ui/controls.scss +26 -26
- package/dist/admin/formChoice.d.ts +3 -0
- package/dist/admin/formChoice.js +10 -0
- package/dist/admin/layoutField.scss +69 -0
- package/dist/admin/screen/BuilderScreen.d.ts +6 -1
- package/dist/admin/screen/BuilderScreen.js +5 -4
- package/dist/admin/server/BuilderView.js +10 -3
- package/dist/admin/templateConditions.scss +24 -0
- package/dist/ai/adapters/anthropic.d.ts +2 -2
- package/dist/ai/adapters/anthropic.js +17 -4
- package/dist/ai/adapters/cloudflare-gateway.js +7 -1
- package/dist/ai/adapters/cloudflare-workers-ai.js +2 -0
- package/dist/ai/adapters/openai-compatible.js +1 -0
- package/dist/ai/adapters/openrouter.js +2 -0
- package/dist/ai/config.d.ts +24 -4
- package/dist/ai/config.js +27 -8
- package/dist/ai/endpoint.d.ts +5 -2
- package/dist/ai/endpoint.js +31 -26
- package/dist/ai/images/cloudflare-workers-ai.js +6 -2
- package/dist/ai/images/openai.js +8 -3
- package/dist/ai/images/openrouter.js +6 -2
- package/dist/ai/images/service.d.ts +10 -4
- package/dist/ai/images/service.js +24 -8
- package/dist/ai/loop.d.ts +5 -5
- package/dist/ai/openai-format.d.ts +7 -0
- package/dist/ai/openai-format.js +17 -5
- package/dist/ai/prompt.d.ts +8 -0
- package/dist/ai/prompt.js +30 -4
- package/dist/ai/settings/index.d.ts +62 -0
- package/dist/ai/settings/index.js +264 -0
- package/dist/ai/settings/secret.d.ts +11 -0
- package/dist/ai/settings/secret.js +46 -0
- package/dist/ai/settings/shared.d.ts +22 -0
- package/dist/ai/settings/shared.js +3 -0
- package/dist/ai/tools.d.ts +3 -0
- package/dist/ai/tools.js +83 -10
- package/dist/ai/types.d.ts +43 -0
- package/dist/blocks/builtins/adjacentLinks.d.ts +5 -0
- package/dist/blocks/builtins/adjacentLinks.js +76 -0
- package/dist/blocks/builtins/carousel.d.ts +5 -0
- package/dist/blocks/builtins/carousel.js +115 -0
- package/dist/blocks/builtins/disclosure.d.ts +14 -0
- package/dist/blocks/builtins/disclosure.js +97 -0
- package/dist/blocks/builtins/embed.d.ts +15 -0
- package/dist/blocks/builtins/embed.js +47 -0
- package/dist/blocks/builtins/faq.d.ts +17 -0
- package/dist/blocks/builtins/faq.js +88 -0
- package/dist/blocks/builtins/filterLink.d.ts +4 -0
- package/dist/blocks/builtins/filterLink.js +35 -0
- package/dist/blocks/builtins/icon.d.ts +10 -0
- package/dist/blocks/builtins/icon.js +45 -0
- package/dist/blocks/builtins/index.d.ts +40 -0
- package/dist/blocks/builtins/index.js +71 -0
- package/dist/blocks/builtins/marquee.d.ts +5 -0
- package/dist/blocks/builtins/marquee.js +68 -0
- package/dist/blocks/builtins/popup.d.ts +5 -0
- package/dist/blocks/builtins/popup.js +83 -0
- package/dist/blocks/builtins/sectionRef.d.ts +40 -0
- package/dist/blocks/builtins/sectionRef.js +100 -0
- package/dist/blocks/builtins/shared.d.ts +28 -0
- package/dist/blocks/builtins/shared.js +62 -0
- package/dist/blocks/builtins/tableOfContents.d.ts +7 -0
- package/dist/blocks/builtins/tableOfContents.js +38 -0
- package/dist/blocks/builtins/tabs.d.ts +6 -0
- package/dist/blocks/builtins/tabs.js +87 -0
- package/dist/blocks/client/adjacentLinks.d.ts +4 -0
- package/dist/blocks/client/adjacentLinks.js +4 -0
- package/dist/blocks/client/carousel.d.ts +45 -0
- package/dist/blocks/client/carousel.js +53 -0
- package/dist/blocks/client/embed.d.ts +21 -0
- package/dist/blocks/client/embed.js +23 -0
- package/dist/blocks/client/field.d.ts +7 -0
- package/dist/blocks/client/field.js +8 -0
- package/dist/blocks/client/filterLink.d.ts +19 -0
- package/dist/blocks/client/filterLink.js +30 -0
- package/dist/blocks/client/helpers.d.ts +21 -0
- package/dist/blocks/client/helpers.js +24 -0
- package/dist/blocks/client/marquee.d.ts +14 -0
- package/dist/blocks/client/marquee.js +25 -0
- package/dist/blocks/client/menu.d.ts +46 -0
- package/dist/blocks/client/menu.js +49 -0
- package/dist/blocks/client/popup.d.ts +15 -0
- package/dist/blocks/client/popup.js +16 -0
- package/dist/blocks/client/tabs.d.ts +10 -0
- package/dist/blocks/client/tabs.js +11 -0
- package/dist/blocks/defaults.d.ts +15 -34
- package/dist/blocks/defaults.js +339 -180
- package/dist/blocks/index.d.ts +4 -3
- package/dist/blocks/index.js +3 -2
- package/dist/classes/actions.d.ts +97 -0
- package/dist/classes/actions.js +296 -0
- package/dist/classes/collection.d.ts +5 -0
- package/dist/classes/collection.js +189 -0
- package/dist/classes/config.d.ts +34 -0
- package/dist/classes/config.js +8 -0
- package/dist/classes/endpoints.d.ts +2 -0
- package/dist/classes/endpoints.js +120 -0
- package/dist/classes/index.d.ts +36 -0
- package/dist/classes/index.js +42 -0
- package/dist/classes/mcp.d.ts +6 -0
- package/dist/classes/mcp.js +161 -0
- package/dist/classes/shared.d.ts +131 -0
- package/dist/classes/shared.js +300 -0
- package/dist/classes/sheet.d.ts +34 -0
- package/dist/classes/sheet.js +126 -0
- package/dist/classes/usage.d.ts +57 -0
- package/dist/classes/usage.js +208 -0
- package/dist/comments/collection.d.ts +38 -0
- package/dist/comments/collection.js +226 -0
- package/dist/comments/config.d.ts +15 -0
- package/dist/comments/config.js +2 -0
- package/dist/comments/index.d.ts +20 -0
- package/dist/comments/index.js +22 -0
- package/dist/comments/shared.d.ts +54 -0
- package/dist/comments/shared.js +104 -0
- package/dist/core/attrs.d.ts +27 -0
- package/dist/core/attrs.js +132 -0
- package/dist/core/bindings.d.ts +171 -15
- package/dist/core/bindings.js +697 -27
- package/dist/core/blockNames.d.ts +9 -0
- package/dist/core/blockNames.js +11 -0
- package/dist/core/blocks.d.ts +62 -4
- package/dist/core/blocks.js +164 -7
- package/dist/core/classes.d.ts +18 -2
- package/dist/core/classes.js +37 -4
- package/dist/core/components.d.ts +72 -0
- package/dist/core/components.js +294 -0
- package/dist/core/contentMode.d.ts +27 -0
- package/dist/core/contentMode.js +0 -0
- package/dist/core/dropTarget.d.ts +11 -0
- package/dist/core/dropTarget.js +24 -1
- package/dist/core/fieldAccess.js +1 -1
- package/dist/core/fieldHooks.d.ts +1 -1
- package/dist/core/fields.d.ts +5 -0
- package/dist/core/fields.js +11 -0
- package/dist/core/headings.d.ts +24 -0
- package/dist/core/headings.js +55 -0
- package/dist/core/index.d.ts +10 -3
- package/dist/core/index.js +10 -3
- package/dist/core/layers.d.ts +9 -0
- package/dist/core/layers.js +29 -0
- package/dist/core/motion.d.ts +24 -15
- package/dist/core/motion.js +20 -12
- package/dist/core/operations.d.ts +6 -0
- package/dist/core/operations.js +124 -6
- package/dist/core/payloadBlocks.js +7 -1
- package/dist/core/references.js +28 -0
- package/dist/core/schema.js +35 -1
- package/dist/core/sectionOrigin.d.ts +6 -0
- package/dist/core/sectionOrigin.js +21 -0
- package/dist/core/sections.d.ts +72 -0
- package/dist/core/sections.js +331 -0
- package/dist/core/templateChoice.d.ts +24 -0
- package/dist/core/templateChoice.js +43 -0
- package/dist/core/tree.js +37 -2
- package/dist/core/types.d.ts +219 -2
- package/dist/core/validate.d.ts +4 -1
- package/dist/core/validate.js +48 -6
- package/dist/core/visibility.d.ts +63 -0
- package/dist/core/visibility.js +214 -0
- package/dist/core/whereValues.d.ts +22 -0
- package/dist/core/whereValues.js +43 -0
- package/dist/css/classes.d.ts +16 -0
- package/dist/css/classes.js +172 -0
- package/dist/css/index.d.ts +32 -1
- package/dist/css/index.js +64 -5
- package/dist/css/tokens.d.ts +14 -1
- package/dist/css/tokens.js +61 -2
- package/dist/index.d.ts +6 -3
- package/dist/index.js +7 -2
- package/dist/live/contentMode.d.ts +24 -0
- package/dist/live/contentMode.js +39 -0
- package/dist/live/draftAccess.js +1 -1
- package/dist/live/endpoints.js +3 -0
- package/dist/live/session.d.ts +6 -1
- package/dist/live/session.js +8 -0
- package/dist/live/storage.js +4 -2
- package/dist/live/types.d.ts +16 -1
- package/dist/mcp/index.d.ts +12 -1
- package/dist/mcp/index.js +177 -48
- package/dist/mcp/shared.d.ts +123 -30
- package/dist/mcp/shared.js +222 -11
- package/dist/plugin/hook.d.ts +7 -1
- package/dist/plugin/hook.js +30 -4
- package/dist/plugin/index.d.ts +27 -8
- package/dist/plugin/index.js +113 -26
- package/dist/plugin/links.d.ts +24 -0
- package/dist/plugin/links.js +27 -0
- package/dist/plugin/listCollections.d.ts +20 -3
- package/dist/plugin/listCollections.js +54 -8
- package/dist/plugin/references.d.ts +5 -0
- package/dist/plugin/references.js +1 -1
- package/dist/plugin/sections.d.ts +14 -7
- package/dist/plugin/sections.js +69 -23
- package/dist/plugin/sectionsUsedIn.d.ts +6 -0
- package/dist/plugin/sectionsUsedIn.js +24 -0
- package/dist/plugin/templateEndpoint.d.ts +9 -0
- package/dist/plugin/templateEndpoint.js +49 -0
- package/dist/plugin/templates.d.ts +4 -0
- package/dist/plugin/templates.js +42 -12
- package/dist/protocol/index.d.ts +19 -2
- package/dist/react/canvas/BuilderCanvas.js +149 -24
- package/dist/react/canvas/classes.d.ts +17 -0
- package/dist/react/canvas/classes.js +102 -0
- package/dist/react/canvas/controls.d.ts +31 -0
- package/dist/react/canvas/controls.js +75 -0
- package/dist/react/canvas/fetchDocs.d.ts +17 -3
- package/dist/react/canvas/fetchDocs.js +51 -10
- package/dist/react/canvas/inline/rich/editor.js +1 -6
- package/dist/react/canvas/measure.d.ts +12 -1
- package/dist/react/canvas/measure.js +130 -7
- package/dist/react/canvas/resolveLayout.d.ts +1 -1
- package/dist/react/canvas/resolveLayout.js +19 -7
- package/dist/react/canvas/serverBlocks.d.ts +11 -0
- package/dist/react/canvas/serverBlocks.js +28 -1
- package/dist/react/canvas/thumbnail/ThumbnailCanvas.js +18 -5
- package/dist/react/classes/ClassesStyle.d.ts +27 -0
- package/dist/react/classes/ClassesStyle.js +27 -0
- package/dist/react/components/Button.d.ts +1 -1
- package/dist/react/components/Button.js +4 -2
- package/dist/react/components/CollectionList.d.ts +9 -3
- package/dist/react/components/CollectionList.js +28 -7
- package/dist/react/components/Container.d.ts +5 -2
- package/dist/react/components/Container.js +10 -4
- package/dist/react/components/Field.js +2 -2
- package/dist/react/components/Heading.js +9 -2
- package/dist/react/components/Image.d.ts +9 -0
- package/dist/react/components/Image.js +16 -1
- package/dist/react/components/Link.d.ts +1 -1
- package/dist/react/components/Link.js +5 -3
- package/dist/react/components/List.d.ts +2 -1
- package/dist/react/components/List.js +8 -2
- package/dist/react/components/Menu.d.ts +26 -1
- package/dist/react/components/Menu.js +116 -25
- package/dist/react/components/RichText.d.ts +6 -2
- package/dist/react/components/RichText.js +23 -2
- package/dist/react/components/builtins/Accordion.d.ts +10 -0
- package/dist/react/components/builtins/Accordion.js +38 -0
- package/dist/react/components/builtins/AdjacentLinks.d.ts +11 -0
- package/dist/react/components/builtins/AdjacentLinks.js +20 -0
- package/dist/react/components/builtins/Carousel.d.ts +24 -0
- package/dist/react/components/builtins/Carousel.js +209 -0
- package/dist/react/components/builtins/Disclosure.d.ts +8 -0
- package/dist/react/components/builtins/Disclosure.js +14 -0
- package/dist/react/components/builtins/Embed.d.ts +11 -0
- package/dist/react/components/builtins/Embed.js +23 -0
- package/dist/react/components/builtins/EmbedHtml.d.ts +15 -0
- package/dist/react/components/builtins/EmbedHtml.js +51 -0
- package/dist/react/components/builtins/EmbedPreview.d.ts +34 -0
- package/dist/react/components/builtins/EmbedPreview.js +105 -0
- package/dist/react/components/builtins/FilterLink.d.ts +8 -0
- package/dist/react/components/builtins/FilterLink.js +30 -0
- package/dist/react/components/builtins/Icon.d.ts +14 -0
- package/dist/react/components/builtins/Icon.js +28 -0
- package/dist/react/components/builtins/Marquee.d.ts +8 -0
- package/dist/react/components/builtins/Marquee.js +15 -0
- package/dist/react/components/builtins/Popup.d.ts +26 -0
- package/dist/react/components/builtins/Popup.js +146 -0
- package/dist/react/components/builtins/SectionRef.d.ts +8 -0
- package/dist/react/components/builtins/SectionRef.js +21 -0
- package/dist/react/components/builtins/Tab.d.ts +7 -0
- package/dist/react/components/builtins/Tab.js +21 -0
- package/dist/react/components/builtins/TableOfContents.d.ts +21 -0
- package/dist/react/components/builtins/TableOfContents.js +36 -0
- package/dist/react/components/builtins/Tabs.d.ts +17 -0
- package/dist/react/components/builtins/Tabs.js +71 -0
- package/dist/react/components/builtins/glyphs.d.ts +8 -0
- package/dist/react/components/builtins/glyphs.js +7 -0
- package/dist/react/components/builtins/index.d.ts +49 -0
- package/dist/react/components/builtins/index.js +70 -0
- package/dist/react/components/builtins/tabsContext.d.ts +12 -0
- package/dist/react/components/builtins/tabsContext.js +6 -0
- package/dist/react/components/index.js +13 -8
- package/dist/react/components/lazy.d.ts +32 -0
- package/dist/react/components/lazy.js +20 -0
- package/dist/react/components/lazyBlock.d.ts +17 -0
- package/dist/react/components/lazyBlock.js +23 -0
- package/dist/react/index.d.ts +8 -3
- package/dist/react/index.js +7 -2
- package/dist/react/motion/runtime.js +10 -6
- package/dist/react/motion/style.js +1 -1
- package/dist/react/render/PayloadRoot.js +1 -1
- package/dist/react/render/RenderLayout.d.ts +9 -7
- package/dist/react/render/RenderLayout.js +145 -41
- package/dist/react/render/canvasMode.d.ts +13 -0
- package/dist/react/render/canvasMode.js +13 -0
- package/dist/react/render/canvasServer.js +4 -3
- package/dist/react/render/canvasServerTypes.d.ts +5 -0
- package/dist/react/render/lists.d.ts +139 -5
- package/dist/react/render/lists.js +401 -9
- package/dist/react/render/marks.d.ts +15 -0
- package/dist/react/render/marks.js +23 -0
- package/dist/react/render/payload.d.ts +8 -1
- package/dist/react/render/payload.js +12 -3
- package/dist/react/render/preview.d.ts +11 -0
- package/dist/react/render/preview.js +13 -0
- package/dist/react/render/relations.d.ts +10 -0
- package/dist/react/render/relations.js +39 -0
- package/dist/react/render/resolve.d.ts +26 -2
- package/dist/react/render/resolve.js +52 -25
- package/dist/react/render/reveal.d.ts +17 -0
- package/dist/react/render/reveal.js +39 -0
- package/dist/react/render/sections.d.ts +15 -0
- package/dist/react/render/sections.js +79 -0
- package/dist/react/render/templates.d.ts +47 -0
- package/dist/react/render/templates.js +139 -0
- package/dist/react/render/types.d.ts +66 -4
- package/dist/react/server.d.ts +3 -38
- package/dist/react/server.js +9 -86
- package/dist/react/theme/ThemeLiveLoader.d.ts +4 -0
- package/dist/react/theme/ThemeLiveLoader.js +5 -0
- package/dist/react/theme/ThemeStyle.d.ts +13 -2
- package/dist/react/theme/ThemeStyle.js +14 -4
- package/dist/theme/admin/ColorField.d.ts +2 -2
- package/dist/theme/admin/ColorField.js +2 -2
- package/dist/theme/admin/FontField.d.ts +2 -2
- package/dist/theme/admin/FontField.js +2 -2
- package/dist/theme/admin/SaveSignal.js +2 -2
- package/dist/theme/admin/Variables.d.ts +11 -0
- package/dist/theme/admin/Variables.js +115 -0
- package/dist/theme/admin/fields.scss +161 -48
- package/dist/theme/client.d.ts +1 -0
- package/dist/theme/client.js +2 -0
- package/dist/theme/css.d.ts +6 -1
- package/dist/theme/css.js +12 -4
- package/dist/theme/global.js +83 -0
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.js +1 -0
- package/dist/theme/server.d.ts +15 -0
- package/dist/theme/server.js +43 -0
- package/dist/theme/usage.d.ts +23 -0
- package/dist/theme/usage.js +68 -0
- package/dist/theme/variables.d.ts +72 -0
- package/dist/theme/variables.js +231 -0
- package/package.json +25 -28
- package/dist/react/components/Quote.d.ts +0 -3
- package/dist/react/components/Quote.js +0 -12
- package/dist/react/components/Spacer.d.ts +0 -3
- package/dist/react/components/Spacer.js +0 -6
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TextFieldClientComponent } from 'payload';
|
|
2
|
+
import './aiKeyField.scss';
|
|
3
|
+
/**
|
|
4
|
+
* An API key in the AI settings global. The stored key never reaches the browser: the field shows
|
|
5
|
+
* only "Set, ends in …4f2a" (from the read-only `keyStatus`), and offers Replace and Clear.
|
|
6
|
+
* The value it sends: a new key (string), `null` to clear, or nothing to keep the stored key.
|
|
7
|
+
*/
|
|
8
|
+
export declare const AiKeyField: TextFieldClientComponent;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button, FieldDescription, FieldLabel, useDocumentInfo, useField, useFormFields, useFormModified } from '@payloadcms/ui';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { KEY_STATUS_FIELD } from '../ai/settings/shared.js';
|
|
6
|
+
import './aiKeyField.scss';
|
|
7
|
+
function statusText(status) {
|
|
8
|
+
if (status?.state === 'set')
|
|
9
|
+
return status.last4 ? `Set, ends in …${status.last4}` : 'Set';
|
|
10
|
+
if (status?.state === 'unreadable')
|
|
11
|
+
return 'Saved, but it cannot be read: the Payload secret changed. Paste the key again.';
|
|
12
|
+
return 'Not set';
|
|
13
|
+
}
|
|
14
|
+
/** What happens without a key here. */
|
|
15
|
+
function fallbackText(custom) {
|
|
16
|
+
if (!custom?.keyEnv)
|
|
17
|
+
return null;
|
|
18
|
+
if (custom.missingKey)
|
|
19
|
+
return `The server has no ${custom.keyEnv} either, so this feature does not work yet.`;
|
|
20
|
+
return `The server uses ${custom.keyEnv} from its environment.`;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* An API key in the AI settings global. The stored key never reaches the browser: the field shows
|
|
24
|
+
* only "Set, ends in …4f2a" (from the read-only `keyStatus`), and offers Replace and Clear.
|
|
25
|
+
* The value it sends: a new key (string), `null` to clear, or nothing to keep the stored key.
|
|
26
|
+
*/
|
|
27
|
+
export const AiKeyField = function AiKeyField({ path, field, readOnly }) {
|
|
28
|
+
const { value, setValue, disabled } = useField({ path });
|
|
29
|
+
// The saved document's status (updated after each save), else the form's copy.
|
|
30
|
+
const saved = useDocumentInfo().data?.[KEY_STATUS_FIELD]?.[path];
|
|
31
|
+
const inForm = useFormFields(([fields]) => fields[KEY_STATUS_FIELD]?.value?.[path]);
|
|
32
|
+
const status = saved ?? inForm;
|
|
33
|
+
const modified = useFormModified();
|
|
34
|
+
const [editing, setEditing] = useState(false);
|
|
35
|
+
const [wasModified, setWasModified] = useState(modified);
|
|
36
|
+
const custom = field.admin?.custom?.aiKey;
|
|
37
|
+
const locked = Boolean(readOnly || disabled);
|
|
38
|
+
const description = field.admin?.description;
|
|
39
|
+
const stored = status?.state === 'set' || status?.state === 'unreadable';
|
|
40
|
+
const clearing = value === null && stored;
|
|
41
|
+
// After a save the form is no longer modified: close the input (the new status shows instead).
|
|
42
|
+
if (modified !== wasModified) {
|
|
43
|
+
setWasModified(modified);
|
|
44
|
+
if (!modified)
|
|
45
|
+
setEditing(false);
|
|
46
|
+
}
|
|
47
|
+
const fallback = !stored || clearing ? fallbackText(custom) : null;
|
|
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
|
+
// 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: () => {
|
|
51
|
+
setValue(undefined);
|
|
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] }));
|
|
54
|
+
};
|
package/dist/admin/BuilderTab.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Button, useConfig, useDocumentInfo } from '@payloadcms/ui';
|
|
4
4
|
import { builderViewPath } from '../plugin/links.js';
|
|
5
|
+
import { forgetForm } from './formChoice.js';
|
|
5
6
|
/**
|
|
6
7
|
* The document's "Builder" tab. The builder opens full screen, so the tab is a link to it,
|
|
7
8
|
* styled like Payload's own document tabs.
|
|
@@ -11,5 +12,7 @@ export function BuilderTab() {
|
|
|
11
12
|
const { config: { routes }, } = useConfig();
|
|
12
13
|
if (id === undefined || id === null || !collectionSlug)
|
|
13
14
|
return null;
|
|
14
|
-
return (_jsx(Button, { buttonStyle: "
|
|
15
|
+
return (_jsx(Button, { buttonStyle: "tab", className: "doc-tab", el: "link", margin: false, size: "medium", to: builderViewPath(routes.admin, collectionSlug, id),
|
|
16
|
+
// With `editor.openInBuilder`, opening the document later goes to the builder again.
|
|
17
|
+
onClick: () => forgetForm(collectionSlug, id), children: _jsx("span", { className: "doc-tab__label", children: "Builder" }) }));
|
|
15
18
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DocumentViewClientProps } from 'payload';
|
|
2
|
+
import './layoutField.scss';
|
|
3
|
+
/**
|
|
4
|
+
* The default edit view of a builder collection with `editor.openInBuilder` on
|
|
5
|
+
* (`views.edit.default`). A saved document opens the full-screen builder instead of Payload's
|
|
6
|
+
* form. The form stays for new documents, in drawers, for users who cannot save, for documents
|
|
7
|
+
* in the trash, and with `?form=1` (the builder's "All fields").
|
|
8
|
+
*/
|
|
9
|
+
export declare function DocumentEditView(props: DocumentViewClientProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
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';
|
|
5
|
+
import { useEffect } from 'react';
|
|
6
|
+
import { builderViewPath, FORM_PARAM, opensInBuilder } from '../plugin/links.js';
|
|
7
|
+
import { formChosen, rememberForm } from './formChoice.js';
|
|
8
|
+
import './layoutField.scss';
|
|
9
|
+
/**
|
|
10
|
+
* The default edit view of a builder collection with `editor.openInBuilder` on
|
|
11
|
+
* (`views.edit.default`). A saved document opens the full-screen builder instead of Payload's
|
|
12
|
+
* form. The form stays for new documents, in drawers, for users who cannot save, for documents
|
|
13
|
+
* in the trash, and with `?form=1` (the builder's "All fields").
|
|
14
|
+
*/
|
|
15
|
+
export function DocumentEditView(props) {
|
|
16
|
+
const { id, collectionSlug, hasSavePermission, isTrashed } = useDocumentInfo();
|
|
17
|
+
const { drawerSlug } = useDocumentDrawerContext();
|
|
18
|
+
const asked = useSearchParams().get(FORM_PARAM) !== null;
|
|
19
|
+
const router = useRouter();
|
|
20
|
+
const { config: { routes }, } = useConfig();
|
|
21
|
+
const hasId = id !== undefined && id !== null && id !== '';
|
|
22
|
+
const remembered = hasId && Boolean(collectionSlug) && formChosen(collectionSlug, id);
|
|
23
|
+
const toBuilder = Boolean(collectionSlug) &&
|
|
24
|
+
opensInBuilder({
|
|
25
|
+
option: true,
|
|
26
|
+
id,
|
|
27
|
+
canSave: hasSavePermission === true,
|
|
28
|
+
trashed: isTrashed === true,
|
|
29
|
+
inDrawer: Boolean(drawerSlug),
|
|
30
|
+
formParam: asked || remembered ? '1' : null,
|
|
31
|
+
});
|
|
32
|
+
const target = toBuilder && hasId && collectionSlug ? builderViewPath(routes.admin, collectionSlug, id) : null;
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (asked && hasId && collectionSlug && !drawerSlug)
|
|
35
|
+
rememberForm(collectionSlug, id);
|
|
36
|
+
}, [asked, hasId, collectionSlug, id, drawerSlug]);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (target)
|
|
39
|
+
router.replace(target);
|
|
40
|
+
}, [target, router]);
|
|
41
|
+
if (target) {
|
|
42
|
+
return (_jsx("output", { className: "builder-open-note", children: "Opening the builder\u2026" }));
|
|
43
|
+
}
|
|
44
|
+
return _jsx(DefaultEditView, { ...props });
|
|
45
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { JSONFieldClientProps } from 'payload';
|
|
2
|
-
import './
|
|
2
|
+
import './layoutField.scss';
|
|
3
3
|
/**
|
|
4
|
-
* Field component of the layout JSON field:
|
|
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
|
|
6
6
|
* builder's own settings drawer it renders nothing: the builder is already open.
|
|
7
7
|
*/
|
|
@@ -6,15 +6,17 @@ import { normalizeLayout, walkBlocks } from '../core/index.js';
|
|
|
6
6
|
import { builderViewPath } from '../plugin/links.js';
|
|
7
7
|
import { blockSummary } from './editor/names.js';
|
|
8
8
|
import { SettingsDrawerSlug } from './editor/topbar/settingsDrawer.js';
|
|
9
|
-
import './
|
|
9
|
+
import { forgetForm } from './formChoice.js';
|
|
10
|
+
import './layoutField.scss';
|
|
10
11
|
/** Top-level blocks named in the summary. */
|
|
11
|
-
const SUMMARY_SECTIONS =
|
|
12
|
+
const SUMMARY_SECTIONS = 5;
|
|
12
13
|
function readConfig(props) {
|
|
13
14
|
const custom = props.field.admin?.custom;
|
|
14
15
|
return custom?.builder ?? null;
|
|
15
16
|
}
|
|
17
|
+
const count = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
16
18
|
/**
|
|
17
|
-
* Field component of the layout JSON field:
|
|
19
|
+
* Field component of the layout JSON field: the page's sections in a box, with an "Open builder"
|
|
18
20
|
* button. The builder itself opens full screen (`{admin}/builder/:collection/:id`). Inside the
|
|
19
21
|
* builder's own settings drawer it renders nothing: the builder is already open.
|
|
20
22
|
*/
|
|
@@ -31,6 +33,7 @@ function LayoutSummary(props) {
|
|
|
31
33
|
const { value } = useField({ path });
|
|
32
34
|
const { id, collectionSlug } = useDocumentInfo();
|
|
33
35
|
const { config: { routes }, } = useConfig();
|
|
36
|
+
const label = typeof props.field.label === 'string' ? props.field.label : 'Layout';
|
|
34
37
|
if (!config) {
|
|
35
38
|
return _jsxs("p", { className: "builder-summary__error", children: ["Builder config missing on field \u201C", props.field.name, "\u201D (admin.custom.builder)."] });
|
|
36
39
|
}
|
|
@@ -43,8 +46,8 @@ function LayoutSummary(props) {
|
|
|
43
46
|
const names = layout.blocks.slice(0, SUMMARY_SECTIONS).map((block) => blockSummary(block, labelOf(block.type)));
|
|
44
47
|
const more = layout.blocks.length - names.length;
|
|
45
48
|
const saved = id !== undefined && id !== null && id !== '';
|
|
46
|
-
const
|
|
47
|
-
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-
|
|
48
|
-
? '
|
|
49
|
-
: `${layout.blocks.length
|
|
49
|
+
const collection = collectionSlug ?? config.collection;
|
|
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
|
+
? '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." })] }));
|
|
50
53
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { JSONFieldClientProps } from 'payload';
|
|
2
|
+
import './editor/fields/fields.scss';
|
|
3
|
+
import './templateConditions.scss';
|
|
4
|
+
/**
|
|
5
|
+
* The templates collection's `conditions` field: the builder's condition rows (field, operator,
|
|
6
|
+
* value, in "or" groups) over the fields of the template's target collection, with "Edit as JSON" for queries
|
|
7
|
+
* the rows cannot show. Stores the same Payload `where` object as a JSON field.
|
|
8
|
+
*/
|
|
9
|
+
export declare function TemplateConditionsField(props: JSONFieldClientProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useField, useFormFields } from '@payloadcms/ui';
|
|
4
|
+
import { TEMPLATE_TARGET_FIELD } from '../core/bindings.js';
|
|
5
|
+
import { WhereField } from './editor/fields/WhereField.js';
|
|
6
|
+
import './editor/fields/fields.scss';
|
|
7
|
+
import './templateConditions.scss';
|
|
8
|
+
/** The conditions test the document itself: a date value may be relative to now, nothing else. */
|
|
9
|
+
const DATE_ONLY = { date: true };
|
|
10
|
+
/**
|
|
11
|
+
* The templates collection's `conditions` field: the builder's condition rows (field, operator,
|
|
12
|
+
* value, in "or" groups) over the fields of the template's target collection, with "Edit as JSON" for queries
|
|
13
|
+
* the rows cannot show. Stores the same Payload `where` object as a JSON field.
|
|
14
|
+
*/
|
|
15
|
+
export function TemplateConditionsField(props) {
|
|
16
|
+
const path = props.path ?? props.field.name;
|
|
17
|
+
const { value, setValue } = useField({ path });
|
|
18
|
+
const target = useFormFields(([fields]) => fields[TEMPLATE_TARGET_FIELD]?.value);
|
|
19
|
+
const label = typeof props.field.label === 'string' ? props.field.label : 'Conditions';
|
|
20
|
+
const description = typeof props.field.admin?.description === 'string' ? props.field.admin.description : undefined;
|
|
21
|
+
return (_jsx("div", { className: "field-type builder-template-conditions", children: _jsx(WhereField, { label: label, description: description, path: path, required: Boolean(props.field.required), value: value ?? undefined, onChange: (next) => setValue(next ?? null), collection: typeof target === 'string' ? target : undefined, sources: DATE_ONLY }) }));
|
|
22
|
+
}
|
|
@@ -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(var(--base) * 1.5));
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.ai-key-field__status {
|
|
8
|
+
margin: 0 0 calc(var(--base) * 0.25);
|
|
9
|
+
color: var(--theme-text);
|
|
10
|
+
font-size: var(--font-body-size-m, 13px);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ai-key-field__status--error {
|
|
14
|
+
color: var(--theme-error-500);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ai-key-field__note {
|
|
18
|
+
margin: 0 0 calc(var(--base) * 0.5);
|
|
19
|
+
color: var(--theme-elevation-500);
|
|
20
|
+
font-size: var(--font-body-size-s, 12px);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ai-key-field__row {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-wrap: wrap;
|
|
26
|
+
align-items: center;
|
|
27
|
+
gap: calc(var(--base) * 0.5);
|
|
28
|
+
margin-bottom: calc(var(--base) * 0.5);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ai-key-field__input {
|
|
32
|
+
flex: 1 1 calc(var(--base) * 16);
|
|
33
|
+
min-width: 0;
|
|
34
|
+
height: calc(var(--base) * 2);
|
|
35
|
+
padding: 0 calc(var(--base) * 0.5);
|
|
36
|
+
border: 1px solid var(--theme-elevation-150);
|
|
37
|
+
border-radius: var(--style-radius-s, var(--border-radius-m));
|
|
38
|
+
background: var(--theme-input-bg);
|
|
39
|
+
color: var(--theme-text);
|
|
40
|
+
font: inherit;
|
|
41
|
+
font-size: var(--font-body-size-m, 13px);
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
outline: none;
|
|
44
|
+
|
|
45
|
+
&:hover {
|
|
46
|
+
border-color: var(--theme-elevation-250);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&:focus {
|
|
50
|
+
border-color: var(--theme-elevation-400);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.ai-key-field__link {
|
|
55
|
+
color: var(--theme-elevation-800);
|
|
56
|
+
font-size: var(--font-body-size-s, 12px);
|
|
57
|
+
}
|
|
58
|
+
}
|
package/dist/admin/client.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
export { AiKeyField } from './AiKeyField.js';
|
|
1
2
|
export { BuilderTab } from './BuilderTab.js';
|
|
3
|
+
export { DocumentEditView } from './DocumentEditView.js';
|
|
2
4
|
export { PublishButton } from './editor/topbar/settingsDrawer.js';
|
|
3
5
|
export { LayoutField } from './LayoutField.js';
|
|
6
|
+
export { TemplateConditionsField } from './TemplateConditionsField.js';
|
|
4
7
|
export { TemplateDefaultCell } from './TemplateDefaultCell.js';
|
package/dist/admin/client.js
CHANGED
|
@@ -2,8 +2,14 @@
|
|
|
2
2
|
// Admin client entry (import map paths used by the plugin):
|
|
3
3
|
// 'payload-canvas/client#LayoutField' — the layout JSON field: a summary and "Open builder"
|
|
4
4
|
// 'payload-canvas/client#BuilderTab' — the document's "Builder" tab, a link to the full-screen view
|
|
5
|
+
// 'payload-canvas/client#DocumentEditView' — the edit view with `editor.openInBuilder`: opens the builder
|
|
5
6
|
// 'payload-canvas/client#PublishButton' — Payload's Publish button, hidden in the builder's settings drawer
|
|
7
|
+
// 'payload-canvas/client#TemplateConditionsField' — a template's conditions as condition rows
|
|
8
|
+
// 'payload-canvas/client#AiKeyField' — an API key in the AI settings global ("Set, ends in …4f2a", Replace, Clear)
|
|
9
|
+
export { AiKeyField } from './AiKeyField.js';
|
|
6
10
|
export { BuilderTab } from './BuilderTab.js';
|
|
11
|
+
export { DocumentEditView } from './DocumentEditView.js';
|
|
7
12
|
export { PublishButton } from './editor/topbar/settingsDrawer.js';
|
|
8
13
|
export { LayoutField } from './LayoutField.js';
|
|
14
|
+
export { TemplateConditionsField } from './TemplateConditionsField.js';
|
|
9
15
|
export { TemplateDefaultCell } from './TemplateDefaultCell.js';
|
|
@@ -51,12 +51,12 @@ function ChangeRow({ change, settings }) {
|
|
|
51
51
|
return (_jsxs("li", { className: `${base}__change ${base}__change--${change.kind}`, children: [_jsxs("div", { className: `${base}__head`, children: [_jsx("span", { className: `${base}__pill ${base}__pill--${change.kind}`, children: KIND_LABELS[change.kind] }), _jsx("strong", { className: `${base}__name`, children: change.name }), (change.kind === 'added' || change.kind === 'removed') && change.where ? (_jsxs("span", { className: `${base}__where`, children: ["in ", change.where] })) : null, (change.kind === 'added' || change.kind === 'removed') && change.inside > 0 ? (_jsxs("span", { className: `${base}__where`, children: ["with ", change.inside, " ", change.inside === 1 ? 'block' : 'blocks', " inside"] })) : null, change.kind === 'moved' ? (_jsxs("span", { className: `${base}__where`, children: ["from ", change.from, " to ", change.to] })) : null] }), change.kind === 'changed' ? (_jsx("ul", { className: `${base}__details`, children: change.details.map((detail, index) => (_jsx(Detail, { detail: detail, settings: settings }, index))) })) : null] }));
|
|
52
52
|
}
|
|
53
53
|
export function LayoutDiff(props) {
|
|
54
|
-
const {
|
|
54
|
+
const { comparisonValue, versionValue, 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(
|
|
59
|
+
const changes = diffLayouts(comparisonValue, versionValue, { 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:
|
|
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 })] })] }));
|
|
62
62
|
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { dataFields } from '../../core/fields.js';
|
|
10
10
|
import { richTextToPlain, isRichText } from '../../core/bindings.js';
|
|
11
11
|
import { isPlainObject, normalizeLayout } from '../../core/tree.js';
|
|
12
|
+
import { visibilityConditions } from '../../core/visibility.js';
|
|
12
13
|
import { blockSummary } from '../editor/names.js';
|
|
13
14
|
/** Longest value text in a change line, in characters. */
|
|
14
15
|
const VALUE_MAX = 80;
|
|
@@ -212,8 +213,20 @@ function blockDetails(ctx, from, to) {
|
|
|
212
213
|
}
|
|
213
214
|
if (!sameValue(from.motion, to.motion))
|
|
214
215
|
out.push({ kind: 'note', label: 'Animation', text: motionNote(from.motion, to.motion) });
|
|
216
|
+
if (!sameValue(from.visibility, to.visibility)) {
|
|
217
|
+
const count = visibilityConditions(to.visibility).length;
|
|
218
|
+
out.push({ kind: 'note', label: 'Visibility conditions', text: count === 0 ? 'Conditions removed' : `${count} ${count === 1 ? 'condition' : 'conditions'}` });
|
|
219
|
+
}
|
|
220
|
+
for (const key of Object.keys(ATTR_NAMES)) {
|
|
221
|
+
const before = from.attrs?.[key];
|
|
222
|
+
const after = to.attrs?.[key];
|
|
223
|
+
if (before !== after)
|
|
224
|
+
out.push({ kind: 'value', label: ATTR_NAMES[key], from: attrText(before), to: attrText(after) });
|
|
225
|
+
}
|
|
215
226
|
return out;
|
|
216
227
|
}
|
|
228
|
+
const ATTR_NAMES = { id: 'HTML id', ariaLabel: 'ARIA label', ariaHidden: 'Hidden from screen readers' };
|
|
229
|
+
const attrText = (value) => (value === true ? 'Yes' : value === undefined ? '' : String(value));
|
|
217
230
|
/** Ids of `list` that keep their relative order (longest common subsequence with `other`). */
|
|
218
231
|
function stableIds(list, other) {
|
|
219
232
|
const n = list.length;
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
&__content {
|
|
10
10
|
display: flex;
|
|
11
11
|
flex-direction: column;
|
|
12
|
-
gap: calc(var(--
|
|
13
|
-
background: var(--
|
|
14
|
-
padding: calc(var(--
|
|
12
|
+
gap: calc(var(--base) * 0.5);
|
|
13
|
+
background: var(--theme-elevation-50);
|
|
14
|
+
padding: calc(var(--base) * 0.5);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
&__summary {
|
|
18
18
|
margin: 0;
|
|
19
|
-
color: var(--
|
|
19
|
+
color: var(--theme-elevation-800);
|
|
20
20
|
font-weight: 500;
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -30,47 +30,47 @@
|
|
|
30
30
|
&__list {
|
|
31
31
|
display: flex;
|
|
32
32
|
flex-direction: column;
|
|
33
|
-
gap: calc(var(--
|
|
33
|
+
gap: calc(var(--base) * 0.25);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
&__change {
|
|
37
|
-
padding: calc(var(--
|
|
38
|
-
border: 1px solid var(--
|
|
39
|
-
border-radius: var(--radius-
|
|
40
|
-
background: var(--
|
|
37
|
+
padding: calc(var(--base) * 0.4) calc(var(--base) * 0.5);
|
|
38
|
+
border: 1px solid var(--theme-elevation-100);
|
|
39
|
+
border-radius: var(--style-radius-s);
|
|
40
|
+
background: var(--theme-elevation-0);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
&__head {
|
|
44
44
|
display: flex;
|
|
45
45
|
flex-wrap: wrap;
|
|
46
46
|
align-items: baseline;
|
|
47
|
-
gap: calc(var(--
|
|
47
|
+
gap: calc(var(--base) * 0.3);
|
|
48
48
|
min-width: 0;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
&__pill {
|
|
52
52
|
flex: none;
|
|
53
|
-
padding: 0 calc(var(--
|
|
54
|
-
border: 1px solid var(--
|
|
55
|
-
border-radius: var(--radius-
|
|
56
|
-
background: var(--
|
|
57
|
-
color: var(--
|
|
58
|
-
font-size: calc(var(--
|
|
53
|
+
padding: 0 calc(var(--base) * 0.25);
|
|
54
|
+
border: 1px solid var(--theme-elevation-150);
|
|
55
|
+
border-radius: var(--style-radius-s);
|
|
56
|
+
background: var(--theme-elevation-100);
|
|
57
|
+
color: var(--theme-elevation-800);
|
|
58
|
+
font-size: calc(var(--base) * 0.55);
|
|
59
59
|
font-weight: 600;
|
|
60
60
|
line-height: 1.6;
|
|
61
61
|
text-transform: uppercase;
|
|
62
62
|
letter-spacing: 0.04em;
|
|
63
63
|
|
|
64
64
|
&--added {
|
|
65
|
-
border-color: var(--diff-create-pill-border, var(--
|
|
66
|
-
background: var(--diff-create-pill-bg, var(--
|
|
67
|
-
color: var(--diff-create-pill-color, var(--
|
|
65
|
+
border-color: var(--diff-create-pill-border, var(--theme-success-400));
|
|
66
|
+
background: var(--diff-create-pill-bg, var(--theme-success-200));
|
|
67
|
+
color: var(--diff-create-pill-color, var(--theme-success-600));
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
&--removed {
|
|
71
|
-
border-color: var(--diff-delete-pill-border, var(--
|
|
72
|
-
background: var(--diff-delete-pill-bg, var(--
|
|
73
|
-
color: var(--diff-delete-pill-color, var(--
|
|
71
|
+
border-color: var(--diff-delete-pill-border, var(--theme-error-400));
|
|
72
|
+
background: var(--diff-delete-pill-bg, var(--theme-error-200));
|
|
73
|
+
color: var(--diff-delete-pill-color, var(--theme-error-600));
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -80,31 +80,31 @@
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
&__where {
|
|
83
|
-
color: var(--
|
|
83
|
+
color: var(--theme-elevation-600);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
&__details {
|
|
87
87
|
display: flex;
|
|
88
88
|
flex-direction: column;
|
|
89
|
-
gap: calc(var(--
|
|
90
|
-
margin-top: calc(var(--
|
|
91
|
-
padding-inline-start: calc(var(--
|
|
92
|
-
border-inline-start: 2px solid var(--
|
|
89
|
+
gap: calc(var(--base) * 0.2);
|
|
90
|
+
margin-top: calc(var(--base) * 0.3);
|
|
91
|
+
padding-inline-start: calc(var(--base) * 0.5);
|
|
92
|
+
border-inline-start: 2px solid var(--theme-elevation-100);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
&__detail {
|
|
96
96
|
display: flex;
|
|
97
97
|
flex-wrap: wrap;
|
|
98
98
|
align-items: baseline;
|
|
99
|
-
gap: calc(var(--
|
|
99
|
+
gap: calc(var(--base) * 0.25);
|
|
100
100
|
min-width: 0;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
&__detail-label {
|
|
104
104
|
display: inline-flex;
|
|
105
105
|
align-items: baseline;
|
|
106
|
-
gap: calc(var(--
|
|
107
|
-
color: var(--
|
|
106
|
+
gap: calc(var(--base) * 0.2);
|
|
107
|
+
color: var(--theme-elevation-600);
|
|
108
108
|
|
|
109
109
|
&::after {
|
|
110
110
|
content: ':';
|
|
@@ -117,59 +117,59 @@
|
|
|
117
117
|
|
|
118
118
|
&__value,
|
|
119
119
|
&__class {
|
|
120
|
-
padding: 0 calc(var(--
|
|
121
|
-
border-radius: var(--radius-
|
|
120
|
+
padding: 0 calc(var(--base) * 0.15);
|
|
121
|
+
border-radius: var(--style-radius-s);
|
|
122
122
|
text-decoration: none;
|
|
123
123
|
overflow-wrap: anywhere;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
&__value--del {
|
|
127
|
-
background: var(--diff-delete-parent-bg, var(--
|
|
128
|
-
color: var(--diff-delete-parent-color, var(--
|
|
127
|
+
background: var(--diff-delete-parent-bg, var(--theme-error-100));
|
|
128
|
+
color: var(--diff-delete-parent-color, var(--theme-error-800));
|
|
129
129
|
text-decoration: line-through;
|
|
130
|
-
text-decoration-color: var(--diff-delete-pill-border, var(--
|
|
130
|
+
text-decoration-color: var(--diff-delete-pill-border, var(--theme-error-400));
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
&__value--ins {
|
|
134
|
-
background: var(--diff-create-parent-bg, var(--
|
|
135
|
-
color: var(--diff-create-parent-color, var(--
|
|
134
|
+
background: var(--diff-create-parent-bg, var(--theme-success-100));
|
|
135
|
+
color: var(--diff-create-parent-color, var(--theme-success-800));
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
&__class {
|
|
139
|
-
font-family: var(--
|
|
140
|
-
font-size: calc(var(--
|
|
139
|
+
font-family: var(--font-mono, ui-monospace, monospace);
|
|
140
|
+
font-size: calc(var(--base) * 0.55);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
&__empty {
|
|
144
|
-
color: var(--
|
|
144
|
+
color: var(--theme-elevation-400);
|
|
145
145
|
font-style: italic;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
&__arrow {
|
|
149
|
-
color: var(--
|
|
149
|
+
color: var(--theme-elevation-400);
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
&__json {
|
|
153
|
-
border-top: 1px solid var(--
|
|
154
|
-
padding-top: calc(var(--
|
|
153
|
+
border-top: 1px solid var(--theme-elevation-100);
|
|
154
|
+
padding-top: calc(var(--base) * 0.4);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
&__json-summary {
|
|
158
158
|
cursor: pointer;
|
|
159
|
-
color: var(--
|
|
159
|
+
color: var(--theme-elevation-600);
|
|
160
160
|
width: fit-content;
|
|
161
161
|
|
|
162
162
|
&:hover {
|
|
163
|
-
color: var(--
|
|
163
|
+
color: var(--theme-elevation-900);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
&__json-content {
|
|
168
168
|
display: grid;
|
|
169
169
|
// Same columns as Payload's field diffs: old on the left, new on the right.
|
|
170
|
-
grid-template-columns: calc(50% - var(--
|
|
171
|
-
gap: var(--
|
|
172
|
-
margin-top: calc(var(--
|
|
170
|
+
grid-template-columns: calc(50% - var(--base) * 0.5) calc(50% - var(--base) * 0.5);
|
|
171
|
+
gap: var(--base);
|
|
172
|
+
margin-top: calc(var(--base) * 0.5);
|
|
173
173
|
overflow-x: auto;
|
|
174
174
|
|
|
175
175
|
pre {
|