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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useDraggable } from '@dnd-kit/core';
|
|
4
4
|
import { memo, useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
5
5
|
import { describeMotion, findLocation, getBlockDefinition, slotNames, walkBlocks } from '../../core/index.js';
|
|
@@ -11,10 +11,14 @@ import { missingWords, useUntranslated } from './locale/locale.js';
|
|
|
11
11
|
import { BLOCK_KEYS, keyText } from './menu/keys.js';
|
|
12
12
|
import { openBlockMenu, renameRequest } from './menu/requests.js';
|
|
13
13
|
import { blockPreview, blockSummary, childrenOf, customLabel, typeName } from './names.js';
|
|
14
|
+
import { useContentMode } from './contentMode.js';
|
|
14
15
|
import { OUTLINE_INDENT, useRuntime } from './runtime.js';
|
|
15
16
|
import { RegionRows } from './regions/RegionRows.js';
|
|
16
17
|
import { useEditor } from './store.js';
|
|
17
|
-
import {
|
|
18
|
+
import { bindingPaths, scopeSources, visibilityFieldPaths } from '../../core/bindings.js';
|
|
19
|
+
import { findBindingField } from './templates/binding.js';
|
|
20
|
+
import { visibilityRows } from './templates/visibilityRows.js';
|
|
21
|
+
import { conditionSummary } from './fields/conditions.js';
|
|
18
22
|
import { useValue, useValueSelector } from './valueStore.js';
|
|
19
23
|
/** Visible rows, depth first. Children of collapsed containers are left out. */
|
|
20
24
|
function visibleRows(runtime, layout, collapsed) {
|
|
@@ -82,18 +86,19 @@ function brokenBindingIds(runtime, layout, templateTarget) {
|
|
|
82
86
|
return out;
|
|
83
87
|
}
|
|
84
88
|
const NO_ISSUES = [];
|
|
85
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* True when a binding or a visibility condition of the block reads a field its document does not
|
|
91
|
+
* have (or there is no document): the template's, each list item's, or each repeat row's.
|
|
92
|
+
*/
|
|
86
93
|
function hasBrokenBinding(runtime, layout, block, templateTarget) {
|
|
87
|
-
|
|
94
|
+
// Every plain path the bindings read (templates and fallback chains have several), and the conditions' fields.
|
|
95
|
+
const paths = [...Object.values(block.bindings ?? {}).flatMap(bindingPaths), ...visibilityFieldPaths(block.visibility)];
|
|
88
96
|
if (paths.length === 0)
|
|
89
97
|
return false;
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return true;
|
|
95
|
-
const fields = runtime.config.templates?.sources?.[collection] ?? [];
|
|
96
|
-
return paths.some((path) => path !== URL_PATH && !findBindingField(fields, path));
|
|
98
|
+
const fields = scopeSources(layout, block.id, runtime.config.templates?.sources ?? {}, templateTarget);
|
|
99
|
+
if (!fields)
|
|
100
|
+
return Object.keys(block.bindings ?? {}).length > 0;
|
|
101
|
+
return paths.some((path) => !findBindingField(fields, path));
|
|
97
102
|
}
|
|
98
103
|
/**
|
|
99
104
|
* The outline tree. Rows stay a flat list, which keeps them simple to measure for drop targets.
|
|
@@ -209,7 +214,7 @@ export function Outline() {
|
|
|
209
214
|
selectRow(runtime, rows[index + 1]);
|
|
210
215
|
return;
|
|
211
216
|
case 'F2':
|
|
212
|
-
if (!row)
|
|
217
|
+
if (!row || runtime.contentMode.get())
|
|
213
218
|
return;
|
|
214
219
|
e.preventDefault();
|
|
215
220
|
runtime.store.select(row.block.id);
|
|
@@ -255,7 +260,9 @@ const OutlineRow = memo(function OutlineRow({ block, depth, container, open, chi
|
|
|
255
260
|
const typeLabel = runtime.blockLabel(block.type);
|
|
256
261
|
const icon = runtime.blockIcon(block.type);
|
|
257
262
|
const data = { source: { kind: 'block', id: block.id }, label: typeLabel, icon };
|
|
258
|
-
|
|
263
|
+
// Content mode moves no blocks by dragging (items move with Move up and Move down).
|
|
264
|
+
const contentMode = useContentMode(runtime);
|
|
265
|
+
const { setNodeRef, listeners, attributes } = useDraggable({ id: `outline:${block.id}`, data, disabled: renaming || contentMode });
|
|
259
266
|
const label = customLabel(block);
|
|
260
267
|
const name = label ?? typeName(block, typeLabel);
|
|
261
268
|
const bindingCount = Object.keys(block.bindings ?? {}).length;
|
|
@@ -273,7 +280,7 @@ const OutlineRow = memo(function OutlineRow({ block, depth, container, open, chi
|
|
|
273
280
|
// Two hover actions, so the row keeps room for its name. Rename, duplicate and delete are in
|
|
274
281
|
// the menu and on their keys.
|
|
275
282
|
const actions = [
|
|
276
|
-
...(storesBuilderData(runtime)
|
|
283
|
+
...(storesBuilderData(runtime) && !contentMode
|
|
277
284
|
? [
|
|
278
285
|
{
|
|
279
286
|
icon: (block.hidden ? 'eye' : 'eyeOff'),
|
|
@@ -293,10 +300,10 @@ const OutlineRow = memo(function OutlineRow({ block, depth, container, open, chi
|
|
|
293
300
|
},
|
|
294
301
|
},
|
|
295
302
|
];
|
|
296
|
-
return (_jsxs("div", { ref: setNodeRef, "data-outline-row": block.id, "data-depth": depth, className: className, onClick: () => runtime.store.select(block.id), onDoubleClick: () => onRename(block.id), onContextMenu: (e) => openRowMenu(runtime, block.id, e),
|
|
303
|
+
return (_jsxs("div", { ref: setNodeRef, "data-outline-row": block.id, "data-depth": depth, className: className, onClick: () => runtime.store.select(block.id), onDoubleClick: () => !contentMode && onRename(block.id), onContextMenu: (e) => openRowMenu(runtime, block.id, e),
|
|
297
304
|
// Not while dragging: the row actions would mount and unmount under the pointer, and every
|
|
298
305
|
// DOM insert restyles the whole admin (Payload's `body:has(...)` rules).
|
|
299
|
-
onPointerEnter: () => !runtime.drag.get() && runtime.store.hover(block.id), onPointerLeave: () => !runtime.drag.get() && runtime.store.hover(null), ...listeners, ...attributes, role: "treeitem", "aria-label": [
|
|
306
|
+
onPointerEnter: () => !runtime.drag.get() && runtime.store.hover(block.id), onPointerLeave: () => !runtime.drag.get() && runtime.store.hover(null), ...listeners, ...attributes, "aria-disabled": undefined, role: "treeitem", "aria-label": [
|
|
300
307
|
blockSummary(block, typeLabel),
|
|
301
308
|
block.hidden && 'hidden on the site',
|
|
302
309
|
block.motion && 'animated',
|
|
@@ -304,11 +311,11 @@ const OutlineRow = memo(function OutlineRow({ block, depth, container, open, chi
|
|
|
304
311
|
...issues,
|
|
305
312
|
]
|
|
306
313
|
.filter(Boolean)
|
|
307
|
-
.join(', '), "aria-level": depth + 1, "aria-selected": selected, "aria-expanded": container && childCount > 0 ? open : undefined, "aria-roledescription": "block", tabIndex: selected || focusable ? 0 : -1, "data-tooltip": `${typeLabel}${tag}${label ? '' : ' · double-click to rename'}`, "data-tooltip-side": "right", children: [Array.from({ length: depth }, (_, i) => (_jsx("span", { className: "builder-editor__guide", style: { left: 15 + i * OUTLINE_INDENT } }, i))), _jsx("span", { className: "builder-editor__row-indent", style: { width: depth * OUTLINE_INDENT } }), container && childCount > 0 ? (_jsx("button", { type: "button", className: "builder-editor__caret", "aria-label": open ? 'Collapse' : 'Expand', tabIndex: -1, onPointerDown: stop, onClick: (e) => {
|
|
314
|
+
.join(', '), "aria-level": depth + 1, "aria-selected": selected, "aria-expanded": container && childCount > 0 ? open : undefined, "aria-roledescription": "block", tabIndex: selected || focusable ? 0 : -1, "data-tooltip": `${typeLabel}${tag}${label || contentMode ? '' : ' · double-click to rename'}`, "data-tooltip-side": "right", children: [Array.from({ length: depth }, (_, i) => (_jsx("span", { className: "builder-editor__guide", style: { left: 15 + i * OUTLINE_INDENT } }, i))), _jsx("span", { className: "builder-editor__row-indent", style: { width: depth * OUTLINE_INDENT } }), container && childCount > 0 ? (_jsx("button", { type: "button", className: "builder-editor__caret", "aria-label": open ? 'Collapse' : 'Expand', tabIndex: -1, onPointerDown: stop, onClick: (e) => {
|
|
308
315
|
e.stopPropagation();
|
|
309
316
|
setCollapsed(runtime, block.id, open);
|
|
310
|
-
}, children: _jsx(Icon, { name: open ? 'chevronDown' : 'chevronRight', size: 12 }) })) : (_jsx("span", { className: "builder-editor__caret builder-editor__caret--empty" })), _jsx("span", { className: "builder-editor__row-icon", children: _jsx(BlockIcon, { name: icon, size: 14 }) }), renaming ? (_jsx(RenameInput, { block: block, placeholder: blockPreview(block) || name, onDone: () => onRename(null) })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "builder-editor__row-type", children: name }), text && _jsx("span", { className: "builder-editor__row-text", children: text })] })), _jsx(PeerDots, { blockId: block.id }), untranslated > 0 && (_jsx("span", { className: "builder-editor__row-untranslated", "aria-hidden": "true", "data-tooltip": `${untranslated} ${untranslated === 1 ? 'field is' : 'fields are'} ${missing}`, "data-tooltip-side": "right" })), issues.length > 0 && (_jsx("span", { className: "builder-editor__row-problem", "data-tooltip": issues.join('\n'), "data-tooltip-side": "right", children: _jsx(Icon, { name: "warning", size: 13 }) })), block.motion && (_jsx("span", { className: "builder-editor__row-motion", "data-tooltip": `Animation: ${describeMotion(block.motion)}`, "data-tooltip-side": "right", children: _jsx(Icon, { name: "motion", size: 12 }) })), bindingCount > 0 && (_jsx("span", { className: `builder-editor__row-bound${broken ? ' builder-editor__row-bound--broken' : ''}`, "aria-label": broken ? 'A bound field is missing' : `${bindingCount} bound ${bindingCount === 1 ? 'field' : 'fields'}`, "data-tooltip-side": "right", "data-tooltip": broken
|
|
311
|
-
? 'A
|
|
317
|
+
}, children: _jsx(Icon, { name: open ? 'chevronDown' : 'chevronRight', size: 12 }) })) : (_jsx("span", { className: "builder-editor__caret builder-editor__caret--empty" })), _jsx("span", { className: "builder-editor__row-icon", children: _jsx(BlockIcon, { name: icon, size: 14 }) }), renaming ? (_jsx(RenameInput, { block: block, placeholder: blockPreview(block) || name, onDone: () => onRename(null) })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "builder-editor__row-type", children: name }), text && _jsx("span", { className: "builder-editor__row-text", children: text })] })), _jsx(PeerDots, { blockId: block.id }), untranslated > 0 && (_jsx("span", { className: "builder-editor__row-untranslated", "aria-hidden": "true", "data-tooltip": `${untranslated} ${untranslated === 1 ? 'field is' : 'fields are'} ${missing}`, "data-tooltip-side": "right" })), issues.length > 0 && (_jsx("span", { className: "builder-editor__row-problem", "data-tooltip": issues.join('\n'), "data-tooltip-side": "right", children: _jsx(Icon, { name: "warning", size: 13 }) })), block.motion && (_jsx("span", { className: "builder-editor__row-motion", "data-tooltip": `Animation: ${describeMotion(block.motion)}`, "data-tooltip-side": "right", children: _jsx(Icon, { name: "motion", size: 12 }) })), block.visibility && (_jsx("span", { className: "builder-editor__row-motion", "aria-label": "Shows only when its conditions match", "data-tooltip": `Shows only when ${conditionSummary(visibilityRows(block.visibility), [])}`, "data-tooltip-side": "right", children: _jsx(Icon, { name: "eye", size: 12 }) })), (bindingCount > 0 || broken) && (_jsx("span", { className: `builder-editor__row-bound${broken ? ' builder-editor__row-bound--broken' : ''}`, "aria-label": broken ? 'A bound field is missing' : `${bindingCount} bound ${bindingCount === 1 ? 'field' : 'fields'}`, "data-tooltip-side": "right", "data-tooltip": broken
|
|
318
|
+
? 'A field a binding or a visibility condition reads is missing from the collection. Select the block to fix it.'
|
|
312
319
|
: `Shows data: ${Object.entries(block.bindings ?? {})
|
|
313
320
|
.map(([prop, field]) => `${prop} ← ${field}`)
|
|
314
321
|
.join(', ')}`, children: _jsx(Icon, { name: broken ? 'unlink' : 'bind', size: 12 }) })), !open && childCount > 0 && _jsx("span", { className: "builder-editor__row-count", children: childCount }), !renaming && hovered && (_jsx("span", { className: "builder-editor__row-actions", children: actions.map((action) => (_jsx("button", { type: "button", tabIndex: -1, className: "builder-editor__row-action", "aria-label": action.label, "aria-haspopup": action.icon === 'more' ? 'menu' : undefined, "data-tooltip": action.tooltip, onPointerDown: stop, onClick: (e) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useDraggable } from '@dnd-kit/core';
|
|
4
4
|
import { findBlock, findLocation } from '../../core/index.js';
|
|
5
|
+
import { DropOutlines } from './dnd/DropOutlines.js';
|
|
5
6
|
import { smoothView } from './dnd/smooth.js';
|
|
6
7
|
import { BlockIcon, Icon } from './icons.js';
|
|
7
8
|
import { inlineEditing } from './inline.js';
|
|
@@ -13,7 +14,9 @@ import { MenuButton } from './menu/Menu.js';
|
|
|
13
14
|
import { blockName } from './names.js';
|
|
14
15
|
import { PeerCursors, PeerSelections } from './live/PresenceUI.js';
|
|
15
16
|
import { RegionOverlay } from './regions/RegionOverlay.js';
|
|
17
|
+
import { SectionVariantSwitch } from './sections/variants.js';
|
|
16
18
|
import { shortName } from './live/presence.js';
|
|
19
|
+
import { useContentMode } from './contentMode.js';
|
|
17
20
|
import { toRect, useRuntime } from './runtime.js';
|
|
18
21
|
import { useEditor } from './store.js';
|
|
19
22
|
import { Tooltips } from './tooltip/Tooltips.js';
|
|
@@ -121,7 +124,7 @@ export function Overlay() {
|
|
|
121
124
|
if (!rect)
|
|
122
125
|
return null;
|
|
123
126
|
return (_jsx("div", { className: "builder-editor__problem-box", style: box(rect), children: _jsxs("span", { className: "builder-editor__problem-tag", "data-tooltip": problem.message, children: [_jsx(Icon, { name: "warning", size: 12 }), problem.message] }) }, `${problem.blockId}:${i}`));
|
|
124
|
-
}), parentRect && _jsx("div", { className: "builder-editor__parent-hint", style: box(parentRect) }), smooth?.placeholder && (_jsx("div", { className: "builder-dnd-scroll", style: { transform: `translate3d(${-gapShift.x}px, ${-gapShift.y}px, 0)` }, children: _jsx("div", { className: "builder-dnd-gap", "data-settle": smooth.phase === 'settle' || undefined, style: {
|
|
127
|
+
}), parentRect && _jsx("div", { className: "builder-editor__parent-hint", style: box(parentRect) }), _jsx(DropOutlines, {}), smooth?.placeholder && (_jsx("div", { className: "builder-dnd-scroll", style: { transform: `translate3d(${-gapShift.x}px, ${-gapShift.y}px, 0)` }, children: _jsx("div", { className: "builder-dnd-gap", "data-settle": smooth.phase === 'settle' || undefined, style: {
|
|
125
128
|
transform: `translate3d(${smooth.placeholder.x}px, ${smooth.placeholder.y}px, 0)`,
|
|
126
129
|
width: smooth.placeholder.width,
|
|
127
130
|
height: smooth.placeholder.height,
|
|
@@ -144,9 +147,11 @@ export function Overlay() {
|
|
|
144
147
|
function ActionBar({ id, label, icon, parentId, rect, inside, below, hidden }) {
|
|
145
148
|
const runtime = useRuntime();
|
|
146
149
|
const data = { source: { kind: 'block', id }, label, icon };
|
|
147
|
-
|
|
150
|
+
// Content mode moves no blocks by dragging and switches no section variants.
|
|
151
|
+
const contentMode = useContentMode(runtime);
|
|
152
|
+
const { setNodeRef, listeners, attributes } = useDraggable({ id: `canvas:${id}`, data, disabled: contentMode });
|
|
148
153
|
const place = below ? 'below' : inside ? 'inside' : 'above';
|
|
149
154
|
const visibility = hidden ? 'hidden' : undefined;
|
|
150
155
|
const style = place === 'below' ? { left: rect.x, top: rect.y + rect.height, visibility } : { left: rect.x + rect.width, top: rect.y, visibility };
|
|
151
|
-
return (_jsxs("div", { className: `builder-editor__actions builder-editor__actions--${place}`, style: style, children: [_jsx("button", { ref: setNodeRef, type: "button", className: "builder-editor__action builder-editor__handle", "aria-label": "Drag to move", "data-tooltip": "Drag to move", ...listeners, ...attributes, children: _jsx(Icon, { name: "drag", size: 14 }) }), _jsx("button", { type: "button", className: "builder-editor__action", "aria-label": "Select the parent block", "data-tooltip": "Select parent", disabled: !parentId, onClick: () => parentId && runtime.store.select(parentId), children: _jsx(Icon, { name: "parent", size: 14 }) }), _jsx(MenuButton, { className: "builder-editor__action", triggerLabel: "More block actions", tooltip: "More actions", label: "Block actions", items: () => blockMenuEntries(runtime, id, 'canvas'), children: _jsx(Icon, { name: "more", size: 14 }) })] }));
|
|
156
|
+
return (_jsxs("div", { className: `builder-editor__actions builder-editor__actions--${place}`, style: style, children: [!contentMode && _jsx(SectionVariantSwitch, { id: id }), !contentMode && (_jsx("button", { ref: setNodeRef, type: "button", className: "builder-editor__action builder-editor__handle", "aria-label": "Drag to move", "data-tooltip": "Drag to move", ...listeners, ...attributes, children: _jsx(Icon, { name: "drag", size: 14 }) })), _jsx("button", { type: "button", className: "builder-editor__action", "aria-label": "Select the parent block", "data-tooltip": "Select parent", disabled: !parentId, onClick: () => parentId && runtime.store.select(parentId), children: _jsx(Icon, { name: "parent", size: 14 }) }), _jsx(MenuButton, { className: "builder-editor__action", triggerLabel: "More block actions", tooltip: "More actions", label: "Block actions", items: () => blockMenuEntries(runtime, id, 'canvas'), children: _jsx(Icon, { name: "more", size: 14 }) })] }));
|
|
152
157
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Block, CanvasMeasurement, Layout, Position } from '../../core/types.js';
|
|
1
|
+
import type { Block, CanvasMeasurement, Layout, Position, SectionDefinition } from '../../core/types.js';
|
|
2
2
|
import { type CopiedStyles } from './menu/styleClipboard.js';
|
|
3
3
|
import type { Runtime } from './runtime.js';
|
|
4
4
|
/**
|
|
@@ -27,8 +27,24 @@ export declare function insertNewBlockAt(runtime: Runtime, type: string, to: Pos
|
|
|
27
27
|
* position was picked). Null when the parent block is gone.
|
|
28
28
|
*/
|
|
29
29
|
export declare function currentPosition(layout: Layout, to: Position): Position | null;
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Inserts copies (new ids) of `blocks` as one undo step and selects the first one. A copy leaves
|
|
32
|
+
* out the HTML ids (`attrs.id`) the page already uses, so a paste or a second section stays valid.
|
|
33
|
+
*/
|
|
31
34
|
export declare function insertBlocks(runtime: Runtime, blocks: Block[], to: Position): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The blocks a saved section inserts as plain blocks: a component's own content, without its
|
|
37
|
+
* property bindings (they mean nothing outside a copy).
|
|
38
|
+
*/
|
|
39
|
+
export declare function plainSectionBlocks(runtime: Runtime, blocks: readonly Block[]): Block[];
|
|
40
|
+
/** A new copy of a saved section that stays in sync (a `sectionRef` block), or null for built-in sections. */
|
|
41
|
+
export declare function componentCopy(section: SectionDefinition): Block | null;
|
|
42
|
+
/**
|
|
43
|
+
* "Detach section": replaces a live saved section (`sectionRef`) with a copy of its blocks, as one
|
|
44
|
+
* undo step. A component's copy keeps its own values in the blocks. Later changes to the saved
|
|
45
|
+
* section no longer reach this page.
|
|
46
|
+
*/
|
|
47
|
+
export declare function detachSection(runtime: Runtime, id: string): Promise<void>;
|
|
32
48
|
export declare function duplicateBlock(runtime: Runtime, id: string): void;
|
|
33
49
|
export declare function removeBlock(runtime: Runtime, id: string): void;
|
|
34
50
|
export declare function toggleHidden(runtime: Runtime, id: string): void;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
// Editor actions shared by the toolbar, the overlay, the outline, the inspector, the menus and the
|
|
3
3
|
// shortcuts: insert, duplicate, remove, hide, move, copy and paste (blocks and styles).
|
|
4
|
-
import {
|
|
4
|
+
import { SECTION_REF_BLOCK, sectionDetachOps, sectionRefId } from '../../blocks/builtins/sectionRef.js';
|
|
5
|
+
import { applyComponentValues, componentValuesOf } from '../../core/components.js';
|
|
6
|
+
import { createId, findBlock, findLocation, getBlockDefinition, htmlIdsOf, slotAcceptsAt, slotNames, withoutTakenHtmlIds } from '../../core/index.js';
|
|
5
7
|
import { normalizeClasses, parseStyles, setStylesOps, stylesText } from './menu/styleClipboard.js';
|
|
6
8
|
import { countText } from './counts.js';
|
|
7
9
|
/**
|
|
@@ -92,15 +94,63 @@ export function currentPosition(layout, to) {
|
|
|
92
94
|
return null;
|
|
93
95
|
return { ...to, index: Math.min(to.index, parent.slots?.[to.slot ?? 'children']?.length ?? 0) };
|
|
94
96
|
}
|
|
95
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* Inserts copies (new ids) of `blocks` as one undo step and selects the first one. A copy leaves
|
|
99
|
+
* out the HTML ids (`attrs.id`) the page already uses, so a paste or a second section stays valid.
|
|
100
|
+
*/
|
|
96
101
|
export function insertBlocks(runtime, blocks, to) {
|
|
97
|
-
const fresh = blocks
|
|
102
|
+
const fresh = freshCopies(runtime, blocks);
|
|
98
103
|
const first = fresh[0];
|
|
99
104
|
if (!first)
|
|
100
105
|
return false;
|
|
101
106
|
const ops = fresh.map((block, i) => ({ type: 'insert', block, to: { ...to, index: to.index + i } }));
|
|
102
107
|
return runtime.store.apply(ops, { select: first.id });
|
|
103
108
|
}
|
|
109
|
+
/** Copies with new ids, without the HTML ids the page already uses. */
|
|
110
|
+
function freshCopies(runtime, blocks) {
|
|
111
|
+
const taken = htmlIdsOf(runtime.store.getState().layout.blocks);
|
|
112
|
+
return blocks.map((block) => {
|
|
113
|
+
const copy = withoutTakenHtmlIds(withNewIds(block), taken);
|
|
114
|
+
htmlIdsOf([copy], taken);
|
|
115
|
+
return copy;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The blocks a saved section inserts as plain blocks: a component's own content, without its
|
|
120
|
+
* property bindings (they mean nothing outside a copy).
|
|
121
|
+
*/
|
|
122
|
+
export function plainSectionBlocks(runtime, blocks) {
|
|
123
|
+
return applyComponentValues(blocks, {}, runtime.config.blocks);
|
|
124
|
+
}
|
|
125
|
+
/** A new copy of a saved section that stays in sync (a `sectionRef` block), or null for built-in sections. */
|
|
126
|
+
export function componentCopy(section) {
|
|
127
|
+
if (section.savedId === undefined)
|
|
128
|
+
return null;
|
|
129
|
+
return { id: createId(), type: SECTION_REF_BLOCK, props: { section: section.savedId } };
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* "Detach section": replaces a live saved section (`sectionRef`) with a copy of its blocks, as one
|
|
133
|
+
* undo step. A component's copy keeps its own values in the blocks. Later changes to the saved
|
|
134
|
+
* section no longer reach this page.
|
|
135
|
+
*/
|
|
136
|
+
export async function detachSection(runtime, id) {
|
|
137
|
+
const ref = findBlock(runtime.store.getState().layout, id);
|
|
138
|
+
const sectionId = ref ? sectionRefId(ref.props?.section) : null;
|
|
139
|
+
if (sectionId === null)
|
|
140
|
+
return;
|
|
141
|
+
await runtime.sections.load();
|
|
142
|
+
const section = runtime.sections.saved.get()?.find((s) => s.savedId !== undefined && String(s.savedId) === String(sectionId));
|
|
143
|
+
if (!section) {
|
|
144
|
+
runtime.notify('This saved section cannot be loaded. It may be deleted.');
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const copies = freshCopies(runtime, applyComponentValues(section.blocks, componentValuesOf(ref?.props), runtime.config.blocks));
|
|
148
|
+
const ops = sectionDetachOps(runtime.store.getState().layout, id, copies);
|
|
149
|
+
if (ops && runtime.store.apply(ops, { select: copies[0].id }))
|
|
150
|
+
runtime.notify(`Detached "${section.label}": this page now has its own copy`);
|
|
151
|
+
else
|
|
152
|
+
runtime.notify("The section's blocks cannot go here.");
|
|
153
|
+
}
|
|
104
154
|
export function duplicateBlock(runtime, id) {
|
|
105
155
|
const newId = createId();
|
|
106
156
|
if (runtime.store.apply({ type: 'duplicate', id, newId }, { select: newId }))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
// The Assistant tab of the inspector: the chat with the AI that edits this layout.
|
|
4
4
|
// State lives in the runtime's assistant controller; this file only renders it.
|
|
5
5
|
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
@@ -167,7 +167,9 @@ function SetupState({ assistant, message }) {
|
|
|
167
167
|
const noAdapter = !ai || ai.adapter === 'none';
|
|
168
168
|
const keyEnv = ai?.keyEnv ?? null;
|
|
169
169
|
const keyPage = ai?.keyUrl ?? null;
|
|
170
|
-
|
|
170
|
+
// The user may open the AI settings, where an API key makes the assistant work.
|
|
171
|
+
const settingsUrl = ai?.settingsUrl ?? null;
|
|
172
|
+
return (_jsxs(_Fragment, { children: [_jsxs("output", { className: "builder-assistant__card builder-assistant__card--setup", children: [_jsx("p", { className: "builder-assistant__card-title", children: "The AI assistant is not set up yet" }), settingsUrl ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "builder-assistant__card-text", children: "The AI assistant needs an API key. Paste one in the AI settings, then check again." }), _jsx("div", { className: "builder-assistant__card-actions", children: _jsxs("a", { className: "builder-assistant__link", href: settingsUrl, target: "_blank", rel: "noopener noreferrer", children: ["Open AI settings ", _jsx(Icon, { name: "external", size: 12 })] }) })] })) : (_jsx("p", { className: "builder-assistant__card-text", children: "The AI assistant is not set up on this site yet. Ask your developer to add an API key." })), _jsxs("details", { className: "builder-assistant__details", children: [_jsx("summary", { children: "Details for developers" }), _jsxs("div", { className: "builder-assistant__details-body", children: [_jsx("p", { className: "builder-assistant__card-text", children: message }), keyEnv && _jsxs("pre", { className: "builder-assistant__card-code", children: [keyEnv, "=\u2026"] }), !noAdapter && (_jsxs("p", { className: "builder-assistant__card-text", children: ["The adapter is ", ai.label, ". To use another one, change ", _jsx("code", { children: "ai.adapter" }), " in ", _jsx("code", { children: "payload.config.ts" }), "."] })), _jsxs("div", { className: "builder-assistant__card-actions", children: [keyPage && (_jsxs("a", { className: "builder-assistant__link", href: keyPage, target: "_blank", rel: "noopener noreferrer", children: ["Get an API key ", _jsx(Icon, { name: "external", size: 12 })] })), _jsxs("a", { className: "builder-assistant__link", href: PROVIDER_DOCS, target: "_blank", rel: "noopener noreferrer", children: ["Provider guide ", _jsx(Icon, { name: "external", size: 12 })] })] })] })] }), _jsx("div", { className: "builder-assistant__card-actions", children: _jsxs("button", { type: "button", className: "builder-assistant__ghost", onClick: assistant.clearSetup, children: [_jsx(Icon, { name: "retry", size: 12 }), " Check again"] }) })] }), _jsx("p", { className: "builder-assistant__info", children: "Or use your own Claude or ChatGPT plan." }), _jsx(ConnectAgents, {})] }));
|
|
171
173
|
}
|
|
172
174
|
const TEXT_BLOCKS = new Set(['heading', 'text', 'richText', 'quote']);
|
|
173
175
|
const CONTAINER_BLOCKS = new Set(['stack', 'grid', 'section']);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
// "Use Claude Code or Codex": connect the official CLIs (signed in with a Claude Pro/Max or
|
|
4
4
|
// ChatGPT plan) to this site's MCP endpoint. They edit pages through the live channel, so changes
|
|
5
5
|
// appear in the open editor. Subscriptions are never used as API keys: the CLIs are the MCP clients.
|