payload-canvas 0.4.0 → 0.5.1
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 +626 -154
- 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/changes.js +5 -0
- package/dist/admin/editor/Canvas.js +20 -5
- package/dist/admin/editor/Editor.d.ts +3 -1
- package/dist/admin/editor/Editor.js +6 -3
- package/dist/admin/editor/Inspector.js +75 -28
- package/dist/admin/editor/Library.js +40 -15
- package/dist/admin/editor/Outline.js +21 -16
- package/dist/admin/editor/Overlay.js +8 -3
- package/dist/admin/editor/actions.d.ts +10 -2
- package/dist/admin/editor/actions.js +18 -3
- package/dist/admin/editor/assistant/AssistantPanel.js +3 -1
- 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 +43 -0
- 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 +13 -58
- package/dist/admin/editor/empty/EmptyStart.js +18 -66
- 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 +3 -2
- 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/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 +12 -4
- package/dist/admin/editor/fields/WhereField.js +33 -53
- 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 +232 -9
- 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 +11 -12
- package/dist/admin/editor/fields/whereRows.js +83 -34
- package/dist/admin/editor/icons.d.ts +16 -1
- package/dist/admin/editor/icons.js +30 -1
- package/dist/admin/editor/inline.js +9 -0
- package/dist/admin/editor/insert/InsertHandle.js +4 -1
- 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/LeftPanel.js +11 -6
- package/dist/admin/editor/live/useMultiplayer.js +9 -1
- package/dist/admin/editor/menu/blockMenu.js +27 -17
- package/dist/admin/editor/names.js +11 -3
- package/dist/admin/editor/renderField.d.ts +3 -1
- package/dist/admin/editor/renderField.js +63 -12
- package/dist/admin/editor/runtime.d.ts +14 -0
- package/dist/admin/editor/runtime.js +67 -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 +5 -2
- 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 -3
- package/dist/admin/editor/styles/StylesPanel.js +53 -14
- package/dist/admin/editor/styles/VariantBar.js +2 -2
- 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 +19 -6
- package/dist/admin/editor/styles/context.js +24 -6
- package/dist/admin/editor/styles/controls.d.ts +3 -1
- package/dist/admin/editor/styles/controls.js +30 -12
- package/dist/admin/editor/styles/popover.d.ts +6 -0
- package/dist/admin/editor/styles/popover.js +5 -5
- package/dist/admin/editor/styles/styles.scss +26 -104
- 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.js +86 -57
- package/dist/admin/editor/templates/SamplePicker.js +1 -1
- 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 +2 -2
- package/dist/admin/editor/templates/binding.js +2 -2
- package/dist/admin/editor/templates/templates.scss +27 -0
- package/dist/admin/editor/templates/visibilityRows.d.ts +22 -0
- package/dist/admin/editor/templates/visibilityRows.js +83 -0
- 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 +5 -4
- package/dist/admin/editor/topbar/DocumentTitle.js +7 -2
- package/dist/admin/editor/topbar/TopBar.js +15 -3
- package/dist/admin/editor/topbar/contentMode.scss +35 -0
- package/dist/admin/editor/topbar/topbar.scss +3 -1
- 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 +4 -3
- package/dist/admin/server/BuilderView.js +10 -3
- package/dist/admin/templateConditions.scss +24 -0
- 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 +23 -7
- 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 +25 -5
- 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 +79 -15
- 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 +2 -29
- package/dist/blocks/builtins/carousel.js +44 -51
- package/dist/blocks/builtins/disclosure.d.ts +2 -1
- package/dist/blocks/builtins/disclosure.js +22 -32
- package/dist/blocks/builtins/embed.d.ts +15 -0
- package/dist/blocks/builtins/embed.js +47 -0
- package/dist/blocks/builtins/faq.d.ts +1 -1
- package/dist/blocks/builtins/faq.js +2 -2
- package/dist/blocks/builtins/filterLink.d.ts +1 -19
- package/dist/blocks/builtins/filterLink.js +9 -50
- package/dist/blocks/builtins/icon.d.ts +2 -0
- package/dist/blocks/builtins/icon.js +8 -8
- package/dist/blocks/builtins/index.d.ts +18 -13
- package/dist/blocks/builtins/index.js +43 -22
- 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 +16 -2
- package/dist/blocks/builtins/sectionRef.js +34 -12
- package/dist/blocks/builtins/shared.d.ts +18 -23
- package/dist/blocks/builtins/shared.js +34 -42
- package/dist/blocks/builtins/tableOfContents.d.ts +4 -0
- package/dist/blocks/builtins/tableOfContents.js +12 -18
- 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 -52
- package/dist/blocks/defaults.js +203 -437
- package/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/index.js +2 -1
- 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/bindings.d.ts +77 -32
- package/dist/core/bindings.js +319 -134
- package/dist/core/blockNames.d.ts +9 -0
- package/dist/core/blockNames.js +11 -0
- package/dist/core/blocks.d.ts +21 -8
- package/dist/core/blocks.js +37 -16
- package/dist/core/classes.d.ts +16 -8
- package/dist/core/classes.js +31 -27
- 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/fields.d.ts +5 -0
- package/dist/core/fields.js +11 -0
- package/dist/core/headings.d.ts +5 -2
- package/dist/core/headings.js +14 -6
- package/dist/core/index.d.ts +8 -3
- package/dist/core/index.js +8 -3
- package/dist/core/layers.d.ts +9 -0
- package/dist/core/layers.js +29 -0
- package/dist/core/operations.d.ts +6 -0
- package/dist/core/operations.js +85 -24
- package/dist/core/payloadBlocks.js +5 -1
- package/dist/core/references.js +28 -0
- package/dist/core/schema.js +20 -6
- 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 +18 -6
- package/dist/core/types.d.ts +148 -18
- package/dist/core/validate.d.ts +4 -1
- package/dist/core/validate.js +28 -11
- 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 +10 -0
- package/dist/css/tokens.js +23 -10
- package/dist/index.d.ts +5 -2
- package/dist/index.js +6 -1
- package/dist/live/contentMode.d.ts +24 -0
- package/dist/live/contentMode.js +39 -0
- package/dist/live/endpoints.js +3 -0
- package/dist/live/session.d.ts +5 -0
- package/dist/live/session.js +8 -0
- package/dist/live/types.d.ts +16 -1
- package/dist/mcp/index.d.ts +10 -1
- package/dist/mcp/index.js +146 -54
- package/dist/mcp/shared.d.ts +93 -3
- package/dist/mcp/shared.js +211 -15
- package/dist/plugin/hook.d.ts +7 -1
- package/dist/plugin/hook.js +30 -4
- package/dist/plugin/index.d.ts +19 -8
- package/dist/plugin/index.js +89 -20
- package/dist/plugin/links.d.ts +24 -0
- package/dist/plugin/links.js +27 -0
- package/dist/plugin/listCollections.d.ts +9 -7
- package/dist/plugin/listCollections.js +30 -21
- 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.js +23 -8
- package/dist/protocol/index.d.ts +16 -1
- package/dist/react/canvas/BuilderCanvas.js +144 -21
- 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 +2 -2
- package/dist/react/canvas/fetchDocs.js +16 -8
- package/dist/react/canvas/measure.d.ts +9 -0
- package/dist/react/canvas/measure.js +106 -7
- package/dist/react/canvas/resolveLayout.d.ts +1 -1
- package/dist/react/canvas/resolveLayout.js +4 -3
- package/dist/react/canvas/thumbnail/ThumbnailCanvas.js +17 -4
- package/dist/react/classes/ClassesStyle.d.ts +27 -0
- package/dist/react/classes/ClassesStyle.js +27 -0
- package/dist/react/components/Button.d.ts +2 -11
- package/dist/react/components/Button.js +8 -43
- package/dist/react/components/CollectionList.d.ts +4 -1
- package/dist/react/components/CollectionList.js +10 -3
- package/dist/react/components/Container.d.ts +5 -2
- package/dist/react/components/Container.js +7 -4
- package/dist/react/components/Field.js +3 -14
- package/dist/react/components/Link.d.ts +1 -1
- package/dist/react/components/Link.js +5 -3
- package/dist/react/components/List.d.ts +1 -1
- package/dist/react/components/List.js +2 -2
- package/dist/react/components/Menu.d.ts +10 -1
- package/dist/react/components/Menu.js +39 -12
- package/dist/react/components/RichText.d.ts +3 -4
- package/dist/react/components/RichText.js +5 -5
- package/dist/react/components/builtins/Accordion.d.ts +4 -3
- package/dist/react/components/builtins/Accordion.js +6 -5
- 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 +21 -10
- package/dist/react/components/builtins/Carousel.js +175 -100
- package/dist/react/components/builtins/Disclosure.d.ts +4 -3
- package/dist/react/components/builtins/Disclosure.js +6 -5
- 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 +1 -1
- package/dist/react/components/builtins/FilterLink.js +4 -4
- 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 +4 -3
- package/dist/react/components/builtins/SectionRef.js +9 -5
- 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 +17 -3
- package/dist/react/components/builtins/TableOfContents.js +22 -7
- package/dist/react/components/builtins/Tabs.d.ts +17 -0
- package/dist/react/components/builtins/Tabs.js +71 -0
- package/dist/react/components/builtins/index.d.ts +37 -20
- package/dist/react/components/builtins/index.js +54 -20
- 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 +11 -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 +6 -3
- package/dist/react/index.js +5 -2
- package/dist/react/render/RenderLayout.d.ts +9 -7
- package/dist/react/render/RenderLayout.js +96 -45
- 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 +36 -4
- package/dist/react/render/lists.js +132 -15
- 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 +8 -4
- package/dist/react/render/resolve.js +11 -5
- package/dist/react/render/reveal.d.ts +17 -0
- package/dist/react/render/reveal.js +39 -0
- package/dist/react/render/sections.d.ts +11 -5
- package/dist/react/render/sections.js +52 -24
- package/dist/react/render/templates.d.ts +47 -0
- package/dist/react/render/templates.js +139 -0
- package/dist/react/render/types.d.ts +62 -5
- package/dist/react/server.d.ts +2 -37
- package/dist/react/server.js +8 -133
- package/dist/react/theme/ThemeLiveLoader.d.ts +4 -0
- package/dist/react/theme/ThemeLiveLoader.js +5 -0
- package/dist/react/theme/ThemeStyle.js +1 -1
- package/dist/theme/admin/Variables.d.ts +11 -0
- package/dist/theme/admin/Variables.js +115 -0
- package/dist/theme/admin/fields.scss +113 -0
- 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 +4 -2
- package/dist/admin/editor/styles/SiteClasses.d.ts +0 -9
- package/dist/admin/editor/styles/SiteClasses.js +0 -31
- package/dist/blocks/builtins/headingId.d.ts +0 -15
- package/dist/blocks/builtins/headingId.js +0 -36
- package/dist/blocks/builtins/lightbox.d.ts +0 -43
- package/dist/blocks/builtins/lightbox.js +0 -93
- package/dist/blocks/builtins/mediaBackdrop.d.ts +0 -11
- package/dist/blocks/builtins/mediaBackdrop.js +0 -79
- 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
- package/dist/react/components/builtins/BackdropVideo.d.ts +0 -13
- package/dist/react/components/builtins/BackdropVideo.js +0 -16
- package/dist/react/components/builtins/Lightbox.d.ts +0 -45
- package/dist/react/components/builtins/Lightbox.js +0 -252
- package/dist/react/components/builtins/MediaBackdrop.d.ts +0 -14
- package/dist/react/components/builtins/MediaBackdrop.js +0 -61
|
@@ -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: "tab", className: "doc-tab", el: "link", margin: false, size: "medium", to: builderViewPath(routes.admin, collectionSlug, id),
|
|
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';
|
|
@@ -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,6 +213,10 @@ 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
|
+
}
|
|
215
220
|
for (const key of Object.keys(ATTR_NAMES)) {
|
|
216
221
|
const before = from.attrs?.[key];
|
|
217
222
|
const after = to.attrs?.[key];
|
|
@@ -4,7 +4,7 @@ import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
|
4
4
|
import { deepestBlockAt } from '../../core/index.js';
|
|
5
5
|
import { unwrap } from '../../protocol/index.js';
|
|
6
6
|
import { ancestors } from './actions.js';
|
|
7
|
-
import { dragModeChoice, prefersReducedMotion, useDragModeSetting } from './dnd/mode.js';
|
|
7
|
+
import { dragModeChoice, dropOutlinesChoice, prefersReducedMotion, useDragModeSetting, useDropOutlines } from './dnd/mode.js';
|
|
8
8
|
import { dropAt } from './dnd/smooth.js';
|
|
9
9
|
import { BlockIcon, Icon } from './icons.js';
|
|
10
10
|
import { applyInlineChange, applyInlineJoin, applyInlineSplit, boundHint, endRegionInline, inlineEditing, noteInlineStart, refuseLockedInline, stopInlineEditing, } from './inline.js';
|
|
@@ -18,8 +18,9 @@ import { FollowFrame } from './live/PresenceUI.js';
|
|
|
18
18
|
import { FrameResize } from './layout/FrameResize.js';
|
|
19
19
|
import { imageEditor, updateImageEditor, uploadImage } from './media/actions.js';
|
|
20
20
|
import { EmptyStart } from './empty/EmptyStart.js';
|
|
21
|
-
import { EDGE_BAND, insertSpotAt, sameSpot } from './insert/spots.js';
|
|
21
|
+
import { EDGE_BAND, INSERT_BUTTON, insertSpotAt, sameSpot } from './insert/spots.js';
|
|
22
22
|
import { Overlay } from './Overlay.js';
|
|
23
|
+
import { CommentLayer } from './comments/CommentLayer.js';
|
|
23
24
|
import { useRuntime } from './runtime.js';
|
|
24
25
|
import { bindShortcuts } from './shortcuts.js';
|
|
25
26
|
import { useEditor } from './store.js';
|
|
@@ -137,6 +138,13 @@ export function Canvas() {
|
|
|
137
138
|
spotTimer = window.setTimeout(() => runtime.insertSpot.set(null), SPOT_LINGER_MS);
|
|
138
139
|
return;
|
|
139
140
|
}
|
|
141
|
+
// Over a canvas control (a carousel's arrow): it acts as on the site, so no hover and no "+".
|
|
142
|
+
if (message.control) {
|
|
143
|
+
store.hover(null);
|
|
144
|
+
runtime.regions?.hovered.set(null);
|
|
145
|
+
setSpot(null);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
140
148
|
const m = measurement.get();
|
|
141
149
|
if (!m)
|
|
142
150
|
return;
|
|
@@ -152,7 +160,8 @@ export function Canvas() {
|
|
|
152
160
|
// Not on the selected block's own edges, where its frame, name tag and action bar are.
|
|
153
161
|
const { selectedId } = store.getState();
|
|
154
162
|
const selected = selectedId ? { id: selectedId, tolerance: SELECTED_EDGE_PX / (runtime.frame.get().zoom || 1) } : undefined;
|
|
155
|
-
|
|
163
|
+
const button = INSERT_BUTTON / (runtime.frame.get().zoom || 1);
|
|
164
|
+
setSpot(inline.get() ? null : insertSpotAt(layout, runtime.config.blocks, m, message, { band, selected, button }));
|
|
156
165
|
}
|
|
157
166
|
if (message.kind === 'click') {
|
|
158
167
|
if (region && runtime.regions)
|
|
@@ -361,7 +370,7 @@ export function Canvas() {
|
|
|
361
370
|
};
|
|
362
371
|
return (_jsxs("section", { className: "builder-editor__stage", children: [error && (_jsxs("output", { className: "builder-editor__canvas-error", children: [error, _jsx("button", { type: "button", onClick: () => runtime.canvasError.set(null), children: "Dismiss" })] })), _jsxs("div", { ref: viewportRef, className: "builder-editor__viewport", "data-scroll": scrolls || undefined, style: { padding: STAGE_PADDING }, children: [_jsxs("div", { ref: wrapRef, className: "builder-editor__frame-wrap", "data-device": fluid ? 'fluid' : 'fixed', style: { width: frameWidth * zoom || '100%', height: stage.height || '100%' }, children: [_jsxs("div", { ref: frameRef, className: "builder-editor__frame", style: frameStyle,
|
|
363
372
|
// While dragging, the iframe ignores the pointer, so forward the wheel to keep scrolling.
|
|
364
|
-
onWheel: locked ? (e) => runtime.postToCanvas({ type: 'scrollBy', dx: e.deltaX, dy: e.deltaY }) : undefined, children: [_jsx("iframe", { ref: iframeRef, src: config.canvasPath, title: "Canvas", className: "builder-editor__iframe", style: { pointerEvents: locked ? 'none' : undefined } }), _jsx(Overlay, {})] }), _jsx(FrameResize, { wrapRef: wrapRef, frameRef: frameRef, frameWidth: frameWidth, zoom: zoom, space: stage.width }), _jsx(EmptyStart, {})] }), _jsx(FollowFrame, {}), _jsx(Notice, {})] }), _jsx(StatusBar, { frameWidth: frameWidth, zoom: zoom, fit: fit, zoomMode: fluid ? 'fit' : zoomMode, fluid: fluid, onZoom: setZoomMode })] }));
|
|
373
|
+
onWheel: locked ? (e) => runtime.postToCanvas({ type: 'scrollBy', dx: e.deltaX, dy: e.deltaY }) : undefined, children: [_jsx("iframe", { ref: iframeRef, src: config.canvasPath, title: "Canvas", className: "builder-editor__iframe", style: { pointerEvents: locked ? 'none' : undefined } }), _jsx(Overlay, {}), _jsx(CommentLayer, {})] }), _jsx(FrameResize, { wrapRef: wrapRef, frameRef: frameRef, frameWidth: frameWidth, zoom: zoom, space: stage.width }), _jsx(EmptyStart, {})] }), _jsx(FollowFrame, {}), _jsx(Notice, {})] }), _jsx(StatusBar, { frameWidth: frameWidth, zoom: zoom, fit: fit, zoomMode: fluid ? 'fit' : zoomMode, fluid: fluid, onZoom: setZoomMode })] }));
|
|
365
374
|
}
|
|
366
375
|
const ZOOM_STEPS = [0.25, 0.33, 0.5, 0.67, 0.75, 1];
|
|
367
376
|
/** Zoom out, the current zoom (click to fit), zoom in. Fluid always shows 100 %: no zoom there. */
|
|
@@ -404,9 +413,13 @@ function PlayMotionToggle({ runtime }) {
|
|
|
404
413
|
const on = useValue(store);
|
|
405
414
|
return (_jsx("button", { type: "button", className: "builder-editor__icon-button builder-editor__icon-button--small", "aria-pressed": on, "aria-label": "Play animations", "data-tooltip": on ? 'Stop animations' : 'Play animations', onClick: () => store.set(!on), children: _jsx(Icon, { name: "motion", size: 14 }) }));
|
|
406
415
|
}
|
|
407
|
-
/**
|
|
416
|
+
/**
|
|
417
|
+
* Drag and drop style: the drop indicator or the smooth mode, and the drop outlines on or off.
|
|
418
|
+
* The choices stay in this browser.
|
|
419
|
+
*/
|
|
408
420
|
function DragModeMenu({ runtime }) {
|
|
409
421
|
const mode = useDragModeSetting(runtime);
|
|
422
|
+
const outlines = useDropOutlines(runtime);
|
|
410
423
|
const reduced = prefersReducedMotion();
|
|
411
424
|
const choose = (next) => dragModeChoice(runtime).set(next);
|
|
412
425
|
return (_jsx(MenuButton, { className: "builder-editor__icon-button builder-editor__icon-button--small",
|
|
@@ -414,5 +427,7 @@ function DragModeMenu({ runtime }) {
|
|
|
414
427
|
triggerLabel: `Drag and drop style: ${mode === 'smooth' ? 'move blocks out of the way' : 'show a drop line'}`, tooltip: `Drag and drop: ${mode === 'smooth' ? 'blocks move out of the way' : 'a drop line shows'}`, label: "Drag and drop style", side: "top", align: "end", footer: reduced ? 'Your system asks for less motion, so dragging shows the drop line.' : undefined, items: () => [
|
|
415
428
|
{ label: 'Show a drop line', icon: 'drag', checked: mode === 'indicator', run: () => choose('indicator') },
|
|
416
429
|
{ label: 'Move blocks out of the way', icon: 'layers', checked: mode === 'smooth', disabled: reduced, run: () => choose('smooth') },
|
|
430
|
+
'separator',
|
|
431
|
+
{ label: 'Outline where blocks can drop', icon: 'grid', checked: outlines, run: () => dropOutlinesChoice(runtime).set(!outlines) },
|
|
417
432
|
], children: _jsx(Icon, { name: "drag", size: 14 }) }));
|
|
418
433
|
}
|
|
@@ -11,10 +11,12 @@ type EditorProps = {
|
|
|
11
11
|
icon: ReactNode;
|
|
12
12
|
/** The locale to open a localized layout in. */
|
|
13
13
|
locale?: string | null;
|
|
14
|
+
/** The user may change the design. False: content mode (text, images and links only). Default true. */
|
|
15
|
+
canEditDesign?: boolean;
|
|
14
16
|
};
|
|
15
17
|
/**
|
|
16
18
|
* The full-screen editor. The document's live session is the source of truth for the layout: the
|
|
17
19
|
* server loads the draft into it, and every edit goes through it (docs/architecture.md section 12).
|
|
18
20
|
*/
|
|
19
|
-
export declare function Editor({ config, meta, icon, locale }: EditorProps): import("react").JSX.Element;
|
|
21
|
+
export declare function Editor({ config, meta, icon, locale, canEditDesign }: EditorProps): import("react").JSX.Element;
|
|
20
22
|
export {};
|
|
@@ -8,6 +8,7 @@ import { Canvas } from './Canvas.js';
|
|
|
8
8
|
import { DragLayer } from './DragLayer.js';
|
|
9
9
|
import { dropAt, endSmoothDrag, isSmoothDrag, MAKE_ROOM_EASING, SETTLE_EASING, startSmoothDrag } from './dnd/smooth.js';
|
|
10
10
|
import { Inspector } from './Inspector.js';
|
|
11
|
+
import { CommentsOrInspector } from './comments/CommentsPanel.js';
|
|
11
12
|
import { LeftPanel } from './layout/LeftPanel.js';
|
|
12
13
|
import { applySizes, readSizes } from './layout/panels.js';
|
|
13
14
|
import { Splitter } from './layout/Splitter.js';
|
|
@@ -21,6 +22,7 @@ import { useFollow } from './live/useFollow.js';
|
|
|
21
22
|
import { useTemplateController } from './templates/useTemplate.js';
|
|
22
23
|
import { TopBar } from './topbar/TopBar.js';
|
|
23
24
|
import { useValueSelector } from './valueStore.js';
|
|
25
|
+
import { useComponentRefresh } from './sections/components.js';
|
|
24
26
|
const COLLISION_ID = 'builder-drop';
|
|
25
27
|
/** Distance from the canvas top or bottom edge where auto-scroll starts. */
|
|
26
28
|
const AUTO_SCROLL_EDGE = 56;
|
|
@@ -49,9 +51,9 @@ function startAutoScroll(runtime) {
|
|
|
49
51
|
* The full-screen editor. The document's live session is the source of truth for the layout: the
|
|
50
52
|
* server loads the draft into it, and every edit goes through it (docs/architecture.md section 12).
|
|
51
53
|
*/
|
|
52
|
-
export function Editor({ config, meta, icon, locale }) {
|
|
54
|
+
export function Editor({ config, meta, icon, locale, canEditDesign }) {
|
|
53
55
|
const { config: payloadConfig } = useConfig();
|
|
54
|
-
const [runtime] = useState(() => createRuntime(config, payloadConfig.routes.api, meta, { locale }));
|
|
56
|
+
const [runtime] = useState(() => createRuntime(config, payloadConfig.routes.api, meta, { locale, canEditDesign }));
|
|
55
57
|
const docId = meta.id;
|
|
56
58
|
useMultiplayer(runtime, { docId });
|
|
57
59
|
// Ready once the first session arrived. A reconnect keeps the editor open.
|
|
@@ -59,6 +61,7 @@ export function Editor({ config, meta, icon, locale }) {
|
|
|
59
61
|
const ready = useValueSelector(runtime.live, (live) => Boolean(live?.self));
|
|
60
62
|
useFollow(runtime);
|
|
61
63
|
useTemplateController(runtime);
|
|
64
|
+
useComponentRefresh(runtime);
|
|
62
65
|
useEffect(() => runtime.assistant?.setDocument(config.collection, docId), [runtime, config.collection, docId]);
|
|
63
66
|
useEffect(() => () => runtime.assistant?.stop(), [runtime]);
|
|
64
67
|
// The hidden thumbnail iframe goes with the editor.
|
|
@@ -173,5 +176,5 @@ export function Editor({ config, meta, icon, locale }) {
|
|
|
173
176
|
// A stable id keeps dnd-kit's aria ids equal on server and client (no hydration mismatch).
|
|
174
177
|
id: dndId, sensors: sensors, collisionDetection: collisionDetection, autoScroll: false,
|
|
175
178
|
// Before the drag starts: otherwise the iframe swallows pointer moves and dnd-kit never sees them.
|
|
176
|
-
onDragPending: () => runtime.pointerLock.set(true), onDragAbort: () => runtime.pointerLock.set(false), onDragStart: onDragStart, onDragMove: onDragMove, onDragEnd: onDragEnd, onDragCancel: onDragCancel, children: _jsxs("div", { ref: rootRef, className: "builder-editor", children: [_jsx(TopBar, { icon: icon }), ready ? (_jsxs("div", { className: "builder-editor__body", children: [_jsx("aside", { className: "builder-editor__left", children: _jsx(LeftPanel, {}) }), _jsx(Splitter, { panel: "left", side: "before", onActive: lockPointer }), _jsx(Canvas, {}), _jsx(Splitter, { panel: "right", side: "after", onActive: lockPointer }), _jsx("aside", { className: "builder-editor__right", children: _jsx(Inspector, {}) })] })) : (_jsxs("div", { className: "builder-editor__body builder-editor__body--loading", "aria-busy": "true", "aria-label": "Loading the editor", children: [_jsxs("aside", { className: "builder-editor__left", children: [_jsx(ShimmerEffect, { height: "30px" }), _jsx(ShimmerEffect, { height: "240px" })] }), _jsx("div", { className: "builder-editor__stage", children: _jsx(ShimmerEffect, { height: "100%" }) }), _jsxs("aside", { className: "builder-editor__right", children: [_jsx(ShimmerEffect, { height: "34px" }), _jsx(ShimmerEffect, { height: "240px" })] })] })), _jsx(DragLayer, {}), _jsx(SectionDialog, {})] }) }) }));
|
|
179
|
+
onDragPending: () => runtime.pointerLock.set(true), onDragAbort: () => runtime.pointerLock.set(false), onDragStart: onDragStart, onDragMove: onDragMove, onDragEnd: onDragEnd, onDragCancel: onDragCancel, children: _jsxs("div", { ref: rootRef, className: "builder-editor", children: [_jsx(TopBar, { icon: icon }), ready ? (_jsxs("div", { className: "builder-editor__body", children: [_jsx("aside", { className: "builder-editor__left", children: _jsx(LeftPanel, {}) }), _jsx(Splitter, { panel: "left", side: "before", onActive: lockPointer }), _jsx(Canvas, {}), _jsx(Splitter, { panel: "right", side: "after", onActive: lockPointer }), _jsx("aside", { className: "builder-editor__right", children: _jsx(CommentsOrInspector, { children: _jsx(Inspector, {}) }) })] })) : (_jsxs("div", { className: "builder-editor__body builder-editor__body--loading", "aria-busy": "true", "aria-label": "Loading the editor", children: [_jsxs("aside", { className: "builder-editor__left", children: [_jsx(ShimmerEffect, { height: "30px" }), _jsx(ShimmerEffect, { height: "240px" })] }), _jsx("div", { className: "builder-editor__stage", children: _jsx(ShimmerEffect, { height: "100%" }) }), _jsxs("aside", { className: "builder-editor__right", children: [_jsx(ShimmerEffect, { height: "34px" }), _jsx(ShimmerEffect, { height: "240px" })] })] })), _jsx(DragLayer, {}), _jsx(SectionDialog, {})] }) }) }));
|
|
177
180
|
}
|