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
|
@@ -22,8 +22,8 @@ type PropField = {
|
|
|
22
22
|
export declare function propKind(field: PropField): PropKind | null;
|
|
23
23
|
/** Field block: any field with a single value. Containers are offered as their leaf fields. */
|
|
24
24
|
export declare function isFieldBlockSource(source: BindingField): boolean;
|
|
25
|
-
/**
|
|
26
|
-
export declare function
|
|
25
|
+
/** Repeat block: a field with rows, an array or any hasMany field. */
|
|
26
|
+
export declare function isRepeatSource(source: BindingField): boolean;
|
|
27
27
|
/** True when a prop of `kind` can bind to `source`. Containers (group, array) never bind themselves, except for `any`. */
|
|
28
28
|
export declare function isCompatible(kind: PropKind, source: BindingField, prop?: PropField): boolean;
|
|
29
29
|
/** True when the path says nothing the label does not ("Featured image" and `featuredImage`). Then the path is not shown. */
|
|
@@ -59,8 +59,8 @@ const CONTAINER_TYPES = new Set(['group', 'array', 'blocks', 'tabs', 'row', 'col
|
|
|
59
59
|
export function isFieldBlockSource(source) {
|
|
60
60
|
return !CONTAINER_TYPES.has(source.type);
|
|
61
61
|
}
|
|
62
|
-
/**
|
|
63
|
-
export function
|
|
62
|
+
/** Repeat block: a field with rows, an array or any hasMany field. */
|
|
63
|
+
export function isRepeatSource(source) {
|
|
64
64
|
return source.type === 'array' || source.hasMany === true;
|
|
65
65
|
}
|
|
66
66
|
const asList = (value) => (value === undefined ? [] : Array.isArray(value) ? value : [value]);
|
|
@@ -624,4 +624,31 @@
|
|
|
624
624
|
border-radius: 3px;
|
|
625
625
|
background: rgb(255 255 255 / 0.22);
|
|
626
626
|
}
|
|
627
|
+
|
|
628
|
+
// ---------------------------------------------------------------------------
|
|
629
|
+
// Visibility conditions (Visibility.tsx); the rows use the where builder's styles
|
|
630
|
+
// ---------------------------------------------------------------------------
|
|
631
|
+
|
|
632
|
+
.builder-visibility {
|
|
633
|
+
padding-top: calc(var(--base) * 0.75);
|
|
634
|
+
border-top: 1px solid var(--theme-elevation-100);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
// ---------------------------------------------------------------------------
|
|
638
|
+
// Format picker of a bound prop and of the Field block (Bindable.tsx)
|
|
639
|
+
// ---------------------------------------------------------------------------
|
|
640
|
+
|
|
641
|
+
.builder-format {
|
|
642
|
+
display: grid;
|
|
643
|
+
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
|
644
|
+
gap: 4px;
|
|
645
|
+
min-width: 0;
|
|
646
|
+
margin: 0;
|
|
647
|
+
padding: 0;
|
|
648
|
+
border: 0;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
.builder-format__name {
|
|
652
|
+
grid-column: 1 / -1;
|
|
653
|
+
}
|
|
627
654
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { BindingField } from '../../../core/types.js';
|
|
2
|
+
import { type BlockVisibility } from '../../../core/visibility.js';
|
|
3
|
+
import type { ConditionFieldOption, ConditionRow } from '../fields/conditions.js';
|
|
4
|
+
/** The rows of stored conditions, as groups: rows in a group must all match; one group is enough. */
|
|
5
|
+
export declare function visibilityRows(visibility: BlockVisibility | undefined): ConditionRow[][];
|
|
6
|
+
/**
|
|
7
|
+
* The visibility of the row groups, or null for none. Rows without a field are left out, and so
|
|
8
|
+
* is a row whose value does not fit its operator yet (an empty list while typing).
|
|
9
|
+
*/
|
|
10
|
+
export declare function rowsVisibility(groups: readonly ConditionRow[][]): BlockVisibility | null;
|
|
11
|
+
/**
|
|
12
|
+
* The fields a visibility row offers in a binding scope: every field the binding picker shows
|
|
13
|
+
* (groups and one relationship hop walked, `$url` left out), the item number inside lists and
|
|
14
|
+
* repeats, and the number of items of arrays and hasMany fields (`count`, labelled with the
|
|
15
|
+
* field's own label: the operators say "has at least").
|
|
16
|
+
*/
|
|
17
|
+
export declare function visibilityFields(fields: BindingField[], inItem: boolean): ConditionFieldOption[];
|
|
18
|
+
/**
|
|
19
|
+
* The page fields a collection list's `where` row can take its value from (`$page.<path>`): the
|
|
20
|
+
* template collection's fields, and "This page" (its id) for rows that point to that collection.
|
|
21
|
+
*/
|
|
22
|
+
export declare function pageConditionFields(fields: BindingField[], collection: string): ConditionFieldOption[];
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// A block's visibility conditions <-> the condition rows of the inspector ("or" groups of "and"
|
|
2
|
+
// rows), and the fields the rows offer. Pure, so it is tested without React.
|
|
3
|
+
import { INDEX_PATH, URL_PATH } from '../../../core/bindings.js';
|
|
4
|
+
import { checkVisibility, groupsVisibility, VALUELESS_OPERATORS, visibilityGroups, } from '../../../core/visibility.js';
|
|
5
|
+
import { whereValueText } from '../fields/whereRows.js';
|
|
6
|
+
import { pickerRows } from './binding.js';
|
|
7
|
+
/** The rows of stored conditions, as groups: rows in a group must all match; one group is enough. */
|
|
8
|
+
export function visibilityRows(visibility) {
|
|
9
|
+
return visibilityGroups(visibility).map((group) => group.map((condition) => ({
|
|
10
|
+
field: condition.field,
|
|
11
|
+
operator: condition.operator,
|
|
12
|
+
value: condition.value,
|
|
13
|
+
text: whereValueText(condition.value),
|
|
14
|
+
...(condition.valueField !== undefined ? { valueField: condition.valueField } : {}),
|
|
15
|
+
...(condition.count ? { count: true } : {}),
|
|
16
|
+
})));
|
|
17
|
+
}
|
|
18
|
+
/** The condition of a row, or null when it is not complete (no field, a value that does not fit yet). */
|
|
19
|
+
function rowCondition(row) {
|
|
20
|
+
if (!row.field.trim())
|
|
21
|
+
return null;
|
|
22
|
+
const valueless = VALUELESS_OPERATORS.has(row.operator);
|
|
23
|
+
const raw = {
|
|
24
|
+
field: row.field,
|
|
25
|
+
operator: row.operator,
|
|
26
|
+
...(row.count ? { count: true } : {}),
|
|
27
|
+
...(valueless ? {} : row.valueField !== undefined ? { valueField: row.valueField } : { value: row.value }),
|
|
28
|
+
};
|
|
29
|
+
const checked = checkVisibility({ conditions: [raw] });
|
|
30
|
+
return checked && typeof checked !== 'string' ? checked.conditions[0] : null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The visibility of the row groups, or null for none. Rows without a field are left out, and so
|
|
34
|
+
* is a row whose value does not fit its operator yet (an empty list while typing).
|
|
35
|
+
*/
|
|
36
|
+
export function rowsVisibility(groups) {
|
|
37
|
+
const conditions = groups.map((group) => group.flatMap((row) => rowCondition(row) ?? []));
|
|
38
|
+
return groupsVisibility(conditions) ?? null;
|
|
39
|
+
}
|
|
40
|
+
/** Field types with many values: a condition can count them. */
|
|
41
|
+
const isList = (field) => field.type === 'array' || field.hasMany === true;
|
|
42
|
+
/** The condition field of a binding field: its type, and its options and collection for the value input. */
|
|
43
|
+
function fieldOption(field, label) {
|
|
44
|
+
const out = { path: field.path, label, type: field.type };
|
|
45
|
+
if (field.hasMany)
|
|
46
|
+
out.hasMany = true;
|
|
47
|
+
if (field.relationTo !== undefined)
|
|
48
|
+
out.relationTo = field.relationTo;
|
|
49
|
+
if (field.options)
|
|
50
|
+
out.options = field.options;
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The fields a visibility row offers in a binding scope: every field the binding picker shows
|
|
55
|
+
* (groups and one relationship hop walked, `$url` left out), the item number inside lists and
|
|
56
|
+
* repeats, and the number of items of arrays and hasMany fields (`count`, labelled with the
|
|
57
|
+
* field's own label: the operators say "has at least").
|
|
58
|
+
*/
|
|
59
|
+
export function visibilityFields(fields, inItem) {
|
|
60
|
+
const out = [];
|
|
61
|
+
if (inItem && !fields.some((f) => f.path === INDEX_PATH))
|
|
62
|
+
out.push({ path: INDEX_PATH, label: 'Item number', type: 'number' });
|
|
63
|
+
for (const row of pickerRows(fields, (field) => field.path !== URL_PATH && field.type !== 'group')) {
|
|
64
|
+
if (!row.selectable)
|
|
65
|
+
continue;
|
|
66
|
+
const label = row.trail.join(' › ');
|
|
67
|
+
if (!isList(row.field) || row.field.type !== 'array')
|
|
68
|
+
out.push(fieldOption(row.field, label));
|
|
69
|
+
if (isList(row.field))
|
|
70
|
+
out.push({ path: row.field.path, label, type: 'number', count: true });
|
|
71
|
+
}
|
|
72
|
+
return out;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The page fields a collection list's `where` row can take its value from (`$page.<path>`): the
|
|
76
|
+
* template collection's fields, and "This page" (its id) for rows that point to that collection.
|
|
77
|
+
*/
|
|
78
|
+
export function pageConditionFields(fields, collection) {
|
|
79
|
+
return [
|
|
80
|
+
{ path: 'id', label: 'This page', type: 'relationship', relationTo: collection },
|
|
81
|
+
...visibilityFields(fields, false).filter((field) => !field.count && field.path !== 'id'),
|
|
82
|
+
];
|
|
83
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import './contentMode.scss';
|
|
2
|
+
/** The "Content mode" label. Shown only in content mode. */
|
|
3
|
+
export declare function ContentModeLabel(): import("react").JSX.Element | null;
|
|
4
|
+
/** "Preview as client": designers see and edit the page as a client does. Hidden for clients. */
|
|
5
|
+
export declare function PreviewAsClientToggle(): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
// Content mode in the top bar: a calm "Content mode" label while only text, images and links can
|
|
4
|
+
// change, and for designers a "Preview as client" toggle that turns content mode on and off.
|
|
5
|
+
import { setPreviewAsClient, useContentMode } from '../contentMode.js';
|
|
6
|
+
import { Icon } from '../icons.js';
|
|
7
|
+
import { useRuntime } from '../runtime.js';
|
|
8
|
+
import './contentMode.scss';
|
|
9
|
+
const LABEL_TIP = 'You can change text, images and links';
|
|
10
|
+
/** The "Content mode" label. Shown only in content mode. */
|
|
11
|
+
export function ContentModeLabel() {
|
|
12
|
+
const runtime = useRuntime();
|
|
13
|
+
const on = useContentMode(runtime);
|
|
14
|
+
if (!on)
|
|
15
|
+
return null;
|
|
16
|
+
return (_jsxs("span", { className: "builder-bar__content-mode", "data-tooltip": LABEL_TIP, "aria-label": `Content mode. ${LABEL_TIP}.`, children: [_jsx(Icon, { name: "rename", size: 12 }), "Content mode"] }));
|
|
17
|
+
}
|
|
18
|
+
/** "Preview as client": designers see and edit the page as a client does. Hidden for clients. */
|
|
19
|
+
export function PreviewAsClientToggle() {
|
|
20
|
+
const runtime = useRuntime();
|
|
21
|
+
const on = useContentMode(runtime);
|
|
22
|
+
if (!runtime.canEditDesign)
|
|
23
|
+
return null;
|
|
24
|
+
const tip = on ? 'Back to full editing' : 'Edit as a client: text, images and links only';
|
|
25
|
+
return (_jsxs("button", { type: "button", className: "builder-bar__button builder-bar__client-toggle", "aria-pressed": on, "aria-label": "Preview as client", "data-tooltip": tip, onClick: () => setPreviewAsClient(runtime, !on), children: [_jsx(Icon, { name: on ? 'eyeOff' : 'eye', size: 14 }), _jsx("span", { className: "builder-bar__label", children: "Preview as client" })] }));
|
|
26
|
+
}
|
|
@@ -15,7 +15,7 @@ export declare function PreviewButton(): import("react").JSX.Element | null;
|
|
|
15
15
|
export declare function PageSettings(): import("react").JSX.Element;
|
|
16
16
|
/**
|
|
17
17
|
* "Publish changes" (disabled when nothing changed since the last publish) with a menu: Unpublish,
|
|
18
|
-
* Revert to published, the versions and the API screen (in a drawer), and links to
|
|
18
|
+
* Revert to published, the versions and the API screen (in a drawer), and links to all fields
|
|
19
19
|
* and the live page. Collections without drafts get the menu only.
|
|
20
20
|
*/
|
|
21
21
|
export declare function PublishButton(): import("react").JSX.Element;
|
|
@@ -5,6 +5,7 @@ import { ConfirmationModal, useConfig, useDocumentDrawer, useModal, useRouteTran
|
|
|
5
5
|
import { useRouter } from 'next/navigation';
|
|
6
6
|
import { useCallback, useEffect, useEffectEvent, useRef, useState } from 'react';
|
|
7
7
|
import { findBlock } from '../../../core/index.js';
|
|
8
|
+
import { editViewPath } from '../../../plugin/links.js';
|
|
8
9
|
import { BlockIcon, Icon } from '../icons.js';
|
|
9
10
|
import { MenuButton } from '../menu/Menu.js';
|
|
10
11
|
import { blockSummary } from '../names.js';
|
|
@@ -173,7 +174,7 @@ export function PageSettings() {
|
|
|
173
174
|
}
|
|
174
175
|
/**
|
|
175
176
|
* "Publish changes" (disabled when nothing changed since the last publish) with a menu: Unpublish,
|
|
176
|
-
* Revert to published, the versions and the API screen (in a drawer), and links to
|
|
177
|
+
* Revert to published, the versions and the API screen (in a drawer), and links to all fields
|
|
177
178
|
* and the live page. Collections without drafts get the menu only.
|
|
178
179
|
*/
|
|
179
180
|
export function PublishButton() {
|
|
@@ -185,8 +186,8 @@ export function PublishButton() {
|
|
|
185
186
|
const router = useRouter();
|
|
186
187
|
const { startRouteTransition } = useRouteTransition();
|
|
187
188
|
const { config: { routes }, } = useConfig();
|
|
188
|
-
|
|
189
|
-
const docPath =
|
|
189
|
+
// Payload's form with every field. `form`: it stays open also with `editor.openInBuilder`.
|
|
190
|
+
const docPath = editViewPath(routes.admin, meta.collection, meta.id, { form: true });
|
|
190
191
|
const revertSlug = `builder-revert-${meta.collection}-${meta.id}`;
|
|
191
192
|
const unpublishSlug = `builder-unpublish-${meta.collection}-${meta.id}`;
|
|
192
193
|
useModalA11y(revertSlug, { alert: true });
|
|
@@ -198,7 +199,7 @@ export function PublishButton() {
|
|
|
198
199
|
// Versions and API open Payload's screens in a drawer, so the builder stays open.
|
|
199
200
|
const items = () => [
|
|
200
201
|
...(meta.url && (published || !meta.drafts) ? [{ icon: 'external', label: 'View the live page', href: meta.url, newTab: true }] : []),
|
|
201
|
-
{ icon: 'compose', label: '
|
|
202
|
+
{ icon: 'compose', label: 'All fields', run: () => startRouteTransition(() => router.push(docPath)) },
|
|
202
203
|
...(meta.versions !== null
|
|
203
204
|
? [{ icon: 'layers', label: meta.versions > 0 ? `Versions (${meta.versions})` : 'Versions', ownFocus: true, run: () => runtime.doc.openScreen('versions') }]
|
|
204
205
|
: []),
|
|
@@ -6,6 +6,7 @@ import { Link, useConfig } from '@payloadcms/ui';
|
|
|
6
6
|
import { useOptimistic, useRef, useState, useTransition } from 'react';
|
|
7
7
|
import { Icon } from '../icons.js';
|
|
8
8
|
import { useRuntime } from '../runtime.js';
|
|
9
|
+
import { useOwnProperties } from '../sections/components.js';
|
|
9
10
|
import { useCollectionLabel } from '../templates/useTemplate.js';
|
|
10
11
|
import { useValue } from '../valueStore.js';
|
|
11
12
|
const STATUS_LABELS = { draft: 'Draft', published: 'Published', changed: 'Changed' };
|
|
@@ -123,10 +124,14 @@ function SectionCategory() {
|
|
|
123
124
|
export function SectionNote() {
|
|
124
125
|
const runtime = useRuntime();
|
|
125
126
|
const isSection = useValue(runtime.doc.meta).section !== null;
|
|
127
|
+
// A component (a saved section with properties): its copies follow every change.
|
|
128
|
+
const component = useOwnProperties(runtime).length > 0;
|
|
126
129
|
if (!isSection)
|
|
127
130
|
return null;
|
|
128
|
-
const
|
|
129
|
-
|
|
131
|
+
const lines = component
|
|
132
|
+
? ['Changes here show on every copy of this component.', 'Pages with plain copies keep their own blocks.']
|
|
133
|
+
: ['Changes here apply to new inserts only.', 'Pages that already use this section keep their own copy.'];
|
|
134
|
+
return (_jsx("button", { type: "button", className: "builder-bar__note", "aria-label": lines.join(' '), "data-tooltip": lines.join('\n'), children: _jsx(Icon, { name: "help", size: 14 }) }));
|
|
130
135
|
}
|
|
131
136
|
/**
|
|
132
137
|
* Draft / Published / Changed, with a card of dates and the versions count on hover or focus.
|
|
@@ -8,18 +8,23 @@ import { useSearchParams } from 'next/navigation';
|
|
|
8
8
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
9
9
|
import { Icon } from '../icons.js';
|
|
10
10
|
import { Presence } from '../live/PresenceUI.js';
|
|
11
|
+
import { CommentsButton } from '../comments/CommentsPanel.js';
|
|
11
12
|
import { useRuntime } from '../runtime.js';
|
|
12
13
|
import { shortcutList } from '../shortcuts.js';
|
|
13
14
|
import { useEditor } from '../store.js';
|
|
14
15
|
import { TemplateControl } from '../templates/SamplePicker.js';
|
|
16
|
+
import { useCollectionLabel } from '../templates/useTemplate.js';
|
|
15
17
|
import { breakpointAt, breakpointWidths, useStyleTokens, withFallback } from '../styles/tokens.js';
|
|
16
18
|
import { DESKTOP_WIDTH, DEVICE_WIDTHS, deviceForWidth, MAX_CANVAS_WIDTH, MIN_CANVAS_WIDTH } from '../styles/viewport.js';
|
|
17
19
|
import { useValue } from '../valueStore.js';
|
|
18
20
|
import { LocaleSwitcher } from '../locale/LocaleSwitcher.js';
|
|
19
21
|
import { DocumentTitle, documentTitle, SectionNote, StatusChip } from './DocumentTitle.js';
|
|
20
22
|
import { PageSettings, PreviewButton, PublishButton, SaveState } from './DocumentActions.js';
|
|
23
|
+
import { ContentModeLabel, PreviewAsClientToggle } from './ContentModeToggle.js';
|
|
21
24
|
import { ScreenDrawer } from './screens/ScreenDrawer.js';
|
|
22
25
|
import { useDismiss } from './useDismiss.js';
|
|
26
|
+
import { editViewPath, listViewPath } from '../../../plugin/links.js';
|
|
27
|
+
import { forgetForm } from '../../formChoice.js';
|
|
23
28
|
import './topbar.scss';
|
|
24
29
|
/**
|
|
25
30
|
* The `from` query parameter (where the editor came from, e.g. the page builder that opened a
|
|
@@ -48,10 +53,17 @@ export function TopBar({ icon }) {
|
|
|
48
53
|
const { config: { routes }, } = useConfig();
|
|
49
54
|
const admin = routes.admin === '/' ? '' : routes.admin;
|
|
50
55
|
// Back: where the editor came from (a saved section opened from a page), else the edit view.
|
|
56
|
+
// With `editor.openInBuilder` the builder is the document's view, so back goes to the list.
|
|
51
57
|
const from = backPath(useSearchParams().get('from'), admin);
|
|
58
|
+
const openInBuilder = runtime.config.editor?.openInBuilder === true;
|
|
59
|
+
const listLabel = useCollectionLabel(collection);
|
|
52
60
|
const back = from
|
|
53
61
|
? { href: from, label: 'Back to where you came from' }
|
|
54
|
-
:
|
|
62
|
+
: openInBuilder
|
|
63
|
+
? { href: listViewPath(routes.admin, collection), label: `Back to ${listLabel}` }
|
|
64
|
+
: { href: editViewPath(routes.admin, collection, id), label: 'Back to the edit view' };
|
|
65
|
+
// The builder is open: opening the document again goes to the builder, not to the form.
|
|
66
|
+
useEffect(() => forgetForm(collection, id), [collection, id]);
|
|
55
67
|
// Loads the tokens early (shared cache with the Styles panel) for the breakpoint widths.
|
|
56
68
|
const { tokens } = useStyleTokens(runtime.config.tokensEndpoint);
|
|
57
69
|
const widths = useMemo(() => breakpointWidths(withFallback(tokens)), [tokens]);
|
|
@@ -69,7 +81,7 @@ export function TopBar({ icon }) {
|
|
|
69
81
|
observer.observe(document.head, { subtree: true, childList: true, characterData: true });
|
|
70
82
|
return () => observer.disconnect();
|
|
71
83
|
}, [title, isSection]);
|
|
72
|
-
return (_jsxs("header", { className: "builder-bar", children: [_jsxs("div", { className: "builder-bar__start", children: [_jsx(Link, { href: back.href, className: "builder-editor__icon-button", "aria-label": back.label, "data-tooltip": back.label, children: _jsx(Icon, { name: "back" }) }), _jsx(Link, { href: admin || '/', className: "builder-bar__home", "aria-label": "Admin home", "data-tooltip": "Admin home", children: icon }), _jsx(DocumentTitle, {}), _jsx(StatusChip, {}), _jsx(SectionNote, {})] }), _jsxs("div", { className: "builder-bar__center", children: [_jsx(HistoryButtons, {}), _jsx("span", { className: "builder-bar__divider" }), _jsx(CanvasWidth, { widths: widths }), _jsx(TemplateControl, {}), _jsx(LocaleSwitcher, {})] }), _jsxs("div", { className: "builder-bar__end", children: [_jsx(EditorError, {}), _jsx(Presence, { widths: widths }), _jsx(SaveState, {}), _jsx("span", { className: "builder-bar__divider" }), _jsx(PreviewButton, {}), _jsx(PageSettings, {}), _jsx(ShortcutHelp, {}), _jsx(PublishButton, {})] }), _jsx(ScreenDrawer, {})] }));
|
|
84
|
+
return (_jsxs("header", { className: "builder-bar", children: [_jsxs("div", { className: "builder-bar__start", children: [_jsx(Link, { href: back.href, className: "builder-editor__icon-button", "aria-label": back.label, "data-tooltip": back.label, children: _jsx(Icon, { name: "back" }) }), _jsx(Link, { href: admin || '/', className: "builder-bar__home", "aria-label": "Admin home", "data-tooltip": "Admin home", children: icon }), _jsx(DocumentTitle, {}), _jsx(StatusChip, {}), _jsx(ContentModeLabel, {}), _jsx(SectionNote, {})] }), _jsxs("div", { className: "builder-bar__center", children: [_jsx(HistoryButtons, {}), _jsx("span", { className: "builder-bar__divider" }), _jsx(CanvasWidth, { widths: widths }), _jsx(TemplateControl, {}), _jsx(LocaleSwitcher, {})] }), _jsxs("div", { className: "builder-bar__end", children: [_jsx(EditorError, {}), _jsx(Presence, { widths: widths }), _jsx(SaveState, {}), _jsx("span", { className: "builder-bar__divider" }), _jsx(CommentsButton, {}), _jsx(PreviewAsClientToggle, {}), _jsx(PreviewButton, {}), _jsx(PageSettings, {}), _jsx(ShortcutHelp, {}), _jsx(PublishButton, {})] }), _jsx(ScreenDrawer, {})] }));
|
|
73
85
|
}
|
|
74
86
|
function HistoryButtons() {
|
|
75
87
|
const { store } = useRuntime();
|
|
@@ -144,5 +156,5 @@ function ShortcutHelp() {
|
|
|
144
156
|
document.addEventListener('pointerdown', onPointerDown);
|
|
145
157
|
return () => document.removeEventListener('pointerdown', onPointerDown);
|
|
146
158
|
}, [open, runtime]);
|
|
147
|
-
return (_jsxs("div", { ref: ref, className: "builder-editor__help", children: [_jsx("button", { type: "button", className: "builder-editor__icon-button", "aria-label": "Keyboard shortcuts", "aria-expanded": open, "data-tooltip": "Keyboard shortcuts \u00B7 ?", onClick: () => runtime.help.set(!open), children: _jsx(Icon, { name: "help" }) }), open && (_jsxs("section", { className: "builder-editor__help-panel", "aria-label": "Keyboard shortcuts", children: [_jsx("p", { className: "builder-editor__help-title", children: "Keyboard shortcuts" }), _jsx("dl", { children: shortcutList({ ai: Boolean(runtime.config.ai), publish: drafts }).map(({ keys, label }) => (_jsxs("div", { className: "builder-editor__help-row", children: [_jsx("dt", { children: label }), _jsx("dd", { children: keys.map((k) => (_jsx("kbd", { children: k }, k))) })] }, label))) })] }))] }));
|
|
159
|
+
return (_jsxs("div", { ref: ref, className: "builder-editor__help", children: [_jsx("button", { type: "button", className: "builder-editor__icon-button", "aria-label": "Keyboard shortcuts", "aria-expanded": open, "data-tooltip": "Keyboard shortcuts \u00B7 ?", onClick: () => runtime.help.set(!open), children: _jsx(Icon, { name: "help" }) }), open && (_jsxs("section", { className: "builder-editor__help-panel", "aria-label": "Keyboard shortcuts", children: [_jsx("p", { className: "builder-editor__help-title", children: "Keyboard shortcuts" }), _jsx("dl", { children: shortcutList({ ai: Boolean(runtime.config.ai), publish: drafts, comments: Boolean(runtime.comments) }).map(({ keys, label }) => (_jsxs("div", { className: "builder-editor__help-row", children: [_jsx("dt", { children: label }), _jsx("dd", { children: keys.map((k) => (_jsx("kbd", { children: k }, k))) })] }, label))) })] }))] }));
|
|
148
160
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Content mode in the top bar (ContentModeToggle.tsx). Payload CSS variables only, no Tailwind.
|
|
2
|
+
|
|
3
|
+
@layer payload-default {
|
|
4
|
+
// A quiet pill next to the status: it says what this editor can change, not a warning.
|
|
5
|
+
.builder-bar__content-mode {
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
flex: none;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: 5px;
|
|
10
|
+
height: 24px;
|
|
11
|
+
margin-left: 4px;
|
|
12
|
+
padding: 0 9px 0 8px;
|
|
13
|
+
border: 1px solid var(--be-border);
|
|
14
|
+
border-radius: 12px;
|
|
15
|
+
color: var(--theme-elevation-800);
|
|
16
|
+
font-size: var(--be-text-s);
|
|
17
|
+
font-weight: var(--be-weight-strong);
|
|
18
|
+
white-space: nowrap;
|
|
19
|
+
cursor: default;
|
|
20
|
+
|
|
21
|
+
svg {
|
|
22
|
+
flex: none;
|
|
23
|
+
color: var(--theme-elevation-600);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.builder-bar__client-toggle[aria-pressed='true'] {
|
|
28
|
+
border-color: var(--theme-elevation-400);
|
|
29
|
+
background: var(--theme-elevation-100);
|
|
30
|
+
|
|
31
|
+
svg {
|
|
32
|
+
color: var(--theme-text);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -359,7 +359,9 @@
|
|
|
359
359
|
gap: 6px;
|
|
360
360
|
// Wide enough for "Saved · 12:04 PM", so the bar does not move between the normal states.
|
|
361
361
|
// Error texts are longer: the box grows, then truncates (the tooltip has the full text).
|
|
362
|
-
|
|
362
|
+
// When the bar is narrow, the wrapper shrinks below 124px and the text truncates instead of
|
|
363
|
+
// running under the buttons next to it.
|
|
364
|
+
min-width: min(124px, 100%);
|
|
363
365
|
max-width: 300px;
|
|
364
366
|
color: var(--be-muted);
|
|
365
367
|
font-size: var(--be-text-m);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
// With `editor.openInBuilder` on, the documents whose edit form the user opened on purpose ("All
|
|
3
|
+
// fields" in the builder, `?form=1`) in this browser tab. Payload's own document tabs (Versions,
|
|
4
|
+
// API, then Edit) drop the search parameter, so this keeps the form open for them. Opening the
|
|
5
|
+
// builder for the document forgets the choice. A full page load forgets every choice.
|
|
6
|
+
const chosen = new Set();
|
|
7
|
+
const key = (collection, id) => `${collection}:${String(id)}`;
|
|
8
|
+
export const rememberForm = (collection, id) => void chosen.add(key(collection, id));
|
|
9
|
+
export const forgetForm = (collection, id) => void chosen.delete(key(collection, id));
|
|
10
|
+
export const formChosen = (collection, id) => chosen.has(key(collection, id));
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// The layout field in Payload's edit view (LayoutField.tsx) and the note while the edit view opens
|
|
2
|
+
// the builder (DocumentEditView.tsx). Payload CSS variables only, no Tailwind (it would leak into
|
|
3
|
+
// the admin).
|
|
4
|
+
|
|
5
|
+
@layer payload-default {
|
|
6
|
+
.builder-summary__box {
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
border: 1px solid var(--theme-elevation-150);
|
|
9
|
+
border-radius: var(--style-radius-m);
|
|
10
|
+
background: var(--theme-input-bg, var(--theme-elevation-0));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.builder-summary__head {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: space-between;
|
|
17
|
+
gap: var(--base);
|
|
18
|
+
min-height: calc(var(--base) * 2.5);
|
|
19
|
+
padding: calc(var(--base) * 0.5) calc(var(--base) * 0.5) calc(var(--base) * 0.5) calc(var(--base) * 0.75);
|
|
20
|
+
|
|
21
|
+
.btn {
|
|
22
|
+
flex: none;
|
|
23
|
+
margin: 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.builder-summary__count {
|
|
28
|
+
margin: 0;
|
|
29
|
+
color: var(--theme-elevation-800);
|
|
30
|
+
font-weight: 500;
|
|
31
|
+
font-variant-numeric: tabular-nums;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// The first sections, numbered like the page order.
|
|
35
|
+
.builder-summary__list {
|
|
36
|
+
margin: 0;
|
|
37
|
+
padding: calc(var(--base) * 0.5) calc(var(--base) * 0.75) calc(var(--base) * 0.5) calc(var(--base) * 2);
|
|
38
|
+
border-top: 1px solid var(--theme-elevation-100);
|
|
39
|
+
color: var(--theme-elevation-800);
|
|
40
|
+
|
|
41
|
+
li {
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
padding: 2px 0;
|
|
44
|
+
text-overflow: ellipsis;
|
|
45
|
+
white-space: nowrap;
|
|
46
|
+
|
|
47
|
+
&::marker {
|
|
48
|
+
color: var(--theme-elevation-400);
|
|
49
|
+
font-variant-numeric: tabular-nums;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.builder-summary__more {
|
|
55
|
+
margin: 0;
|
|
56
|
+
padding: 0 calc(var(--base) * 0.75) calc(var(--base) * 0.5) calc(var(--base) * 2);
|
|
57
|
+
color: var(--theme-elevation-500);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.builder-summary__error {
|
|
61
|
+
color: var(--theme-error-500);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.builder-open-note {
|
|
65
|
+
display: block;
|
|
66
|
+
margin: calc(var(--base) * 2) var(--gutter-h, calc(var(--base) * 2));
|
|
67
|
+
color: var(--theme-elevation-500);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { VisibleEntities } from 'payload';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
+
import type { AiClientConfig } from '../../ai/types.js';
|
|
3
4
|
import type { BuilderDocMeta } from '../../live/types.js';
|
|
4
5
|
import '../editor/editor.scss';
|
|
5
6
|
/**
|
|
@@ -10,10 +11,14 @@ import '../editor/editor.scss';
|
|
|
10
11
|
* Payload's admin template is not around a root view, so the builder provides the entity
|
|
11
12
|
* visibility it would provide (Payload's Versions screen in the builder's drawer reads it).
|
|
12
13
|
*/
|
|
13
|
-
export declare function BuilderScreen({ meta, icon, visibleEntities, locale, }: {
|
|
14
|
+
export declare function BuilderScreen({ meta, icon, visibleEntities, locale, ai, canEditDesign, }: {
|
|
14
15
|
meta: BuilderDocMeta;
|
|
15
16
|
icon: ReactNode;
|
|
16
17
|
visibleEntities?: VisibleEntities;
|
|
17
18
|
/** The request's locale (`?locale=`, else Payload's locale preference). Localized layouts open in it. */
|
|
18
19
|
locale?: string | null;
|
|
20
|
+
/** The assistant's config for this request (keys in the AI settings count). Replaces the one from the field config. */
|
|
21
|
+
ai?: AiClientConfig | null;
|
|
22
|
+
/** The user may change the design (`editor.canEditDesign`). False: content mode. */
|
|
23
|
+
canEditDesign?: boolean;
|
|
19
24
|
}): import("react").JSX.Element;
|
|
@@ -20,11 +20,12 @@ function builderConfigOf(fields) {
|
|
|
20
20
|
* Payload's admin template is not around a root view, so the builder provides the entity
|
|
21
21
|
* visibility it would provide (Payload's Versions screen in the builder's drawer reads it).
|
|
22
22
|
*/
|
|
23
|
-
export function BuilderScreen({ meta, icon, visibleEntities, locale, }) {
|
|
23
|
+
export function BuilderScreen({ meta, icon, visibleEntities, locale, ai, canEditDesign = true, }) {
|
|
24
24
|
const { getEntityConfig } = useConfig();
|
|
25
|
-
const
|
|
25
|
+
const fieldConfig = builderConfigOf(getEntityConfig({ collectionSlug: meta.collection })?.fields ?? []);
|
|
26
|
+
const config = fieldConfig?.ai && ai ? { ...fieldConfig, ai } : fieldConfig;
|
|
26
27
|
if (!config) {
|
|
27
28
|
return _jsxs("p", { className: "builder-summary__error", children: ["The builder config is missing on the \u201C", meta.collection, "\u201D collection."] });
|
|
28
29
|
}
|
|
29
|
-
return (_jsx(EntityVisibilityProvider, { visibleEntities: visibleEntities, children: _jsx(EditDepthProvider, { children: _jsx(Editor, { config: config, meta: meta, icon: icon, locale: locale }) }) }));
|
|
30
|
+
return (_jsx(EntityVisibilityProvider, { visibleEntities: visibleEntities, children: _jsx(EditDepthProvider, { children: _jsx(Editor, { config: config, meta: meta, icon: icon, locale: locale, canEditDesign: canEditDesign }) }) }));
|
|
30
31
|
}
|
|
@@ -2,10 +2,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent';
|
|
3
3
|
import { PayloadIcon } from '@payloadcms/ui/shared';
|
|
4
4
|
import { notFound, redirect } from 'next/navigation';
|
|
5
|
+
import { aiSettingsOf } from '../../ai/settings/index.js';
|
|
5
6
|
import { builderConfigOf, liveRuntimeOf, loadDocMeta, sessionTargetOf } from '../../live/index.js';
|
|
7
|
+
import { canEditDesign } from '../../live/contentMode.js';
|
|
6
8
|
import { fieldRegistryOf } from '../../live/fieldChecks.js';
|
|
7
9
|
import { siteCssConfigOf } from '../../plugin/index.js';
|
|
8
|
-
import { builderViewPath } from '../../plugin/links.js';
|
|
10
|
+
import { builderViewPath, editViewPath } from '../../plugin/links.js';
|
|
9
11
|
import { savedSectionsConfigOf } from '../../plugin/sections.js';
|
|
10
12
|
import { BuilderScreen } from '../screen/BuilderScreen.js';
|
|
11
13
|
function segment(value) {
|
|
@@ -60,8 +62,13 @@ export async function BuilderView({ initPageResult, params, searchParams }) {
|
|
|
60
62
|
}
|
|
61
63
|
if (!meta)
|
|
62
64
|
notFound();
|
|
65
|
+
// `form`: with `editor.openInBuilder` the edit view must not send the user back here.
|
|
63
66
|
if (!canUpdate)
|
|
64
|
-
redirect(
|
|
67
|
+
redirect(editViewPath(routes.admin, collection, id, { form: true }));
|
|
68
|
+
// Content mode: users without design rights change text, images and links only.
|
|
69
|
+
const designer = await canEditDesign(req);
|
|
70
|
+
// The assistant's readiness now: a key pasted in the AI settings counts without a restart.
|
|
71
|
+
const ai = await (aiSettingsOf(payload)?.clientConfig(req) ?? Promise.resolve(null)).catch(() => null);
|
|
65
72
|
// oxlint-disable-next-line react/capitalized-calls -- Payload's helper (a function) renders the app's icon component
|
|
66
73
|
const icon = RenderServerComponent({
|
|
67
74
|
Component: payload.config.admin.components?.graphics?.Icon,
|
|
@@ -69,5 +76,5 @@ export async function BuilderView({ initPageResult, params, searchParams }) {
|
|
|
69
76
|
importMap: payload.importMap,
|
|
70
77
|
serverProps: { i18n: req.i18n, locale: req.locale, params, payload, permissions, searchParams, user: req.user },
|
|
71
78
|
});
|
|
72
|
-
return _jsx(BuilderScreen, { meta: meta, icon: icon, visibleEntities: initPageResult.visibleEntities, locale: typeof req.locale === 'string' ? req.locale : null });
|
|
79
|
+
return (_jsx(BuilderScreen, { meta: meta, icon: icon, visibleEntities: initPageResult.visibleEntities, locale: typeof req.locale === 'string' ? req.locale : null, ai: ai, canEditDesign: designer }));
|
|
73
80
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// The template conditions field in Payload's document form, outside the builder editor. The
|
|
2
|
+
// condition rows and their selects read the editor's color variables, which the editor sets on
|
|
3
|
+
// `.builder-editor`. Here they are set on the page body (the select lists render in a portal
|
|
4
|
+
// there) while the field is on the page. The values match editor.scss.
|
|
5
|
+
|
|
6
|
+
@layer payload-default {
|
|
7
|
+
body:has(.builder-template-conditions) {
|
|
8
|
+
--be-accent: var(--theme-success-500);
|
|
9
|
+
--be-border: var(--theme-elevation-150);
|
|
10
|
+
--be-border-soft: var(--theme-elevation-100);
|
|
11
|
+
--be-muted: var(--theme-elevation-600);
|
|
12
|
+
--be-subtle: var(--theme-elevation-400);
|
|
13
|
+
--be-hover: var(--theme-elevation-100);
|
|
14
|
+
--be-radius-m: var(--style-radius-m, 6px);
|
|
15
|
+
--be-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
|
|
16
|
+
--be-text-s: calc(1rem - 2px);
|
|
17
|
+
--be-text-m: 1rem;
|
|
18
|
+
--be-weight-strong: 600;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.builder-template-conditions {
|
|
22
|
+
margin-bottom: var(--spacing-field, calc(var(--base) * 1.5));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -101,16 +101,25 @@ export function anthropicAdapter(options = {}) {
|
|
|
101
101
|
// `ant auth login` credentials cannot be seen here: without a key the panel says "probably".
|
|
102
102
|
const seesKey = Boolean(apiKey || process.env.ANTHROPIC_API_KEY?.trim() || process.env.ANTHROPIC_AUTH_TOKEN?.trim() || options.client);
|
|
103
103
|
let client = options.client ?? null;
|
|
104
|
+
/** A key from the AI settings gets its own client, made again when the key changes. */
|
|
105
|
+
let keyed = null;
|
|
104
106
|
/** Credentials resolve once per client: a client that had none is dropped after a failure. */
|
|
105
|
-
const getClient = () => {
|
|
107
|
+
const getClient = (settingsKey) => {
|
|
108
|
+
if (settingsKey && !options.client) {
|
|
109
|
+
if (keyed?.key !== settingsKey)
|
|
110
|
+
keyed = { key: settingsKey, client: new Anthropic({ apiKey: settingsKey }) };
|
|
111
|
+
return keyed.client;
|
|
112
|
+
}
|
|
106
113
|
client ??= (apiKey ? new Anthropic({ apiKey }) : new Anthropic());
|
|
107
114
|
return client;
|
|
108
115
|
};
|
|
109
116
|
const hasCredentials = (c) => Boolean(c.apiKey || c.authToken || c.credentials);
|
|
110
117
|
const describe = (error, streamStarted, current) => {
|
|
111
118
|
if (error instanceof AuthenticationError) {
|
|
112
|
-
if (!options.client)
|
|
119
|
+
if (!options.client) {
|
|
113
120
|
client = null;
|
|
121
|
+
keyed = null;
|
|
122
|
+
}
|
|
114
123
|
return { type: 'error', code: 'auth', message: `The Anthropic API rejected the credentials (401). ${NO_KEY_MESSAGE}` };
|
|
115
124
|
}
|
|
116
125
|
if (error instanceof RateLimitError)
|
|
@@ -125,8 +134,10 @@ export function anthropicAdapter(options = {}) {
|
|
|
125
134
|
// Not an API error: before any stream event this is a missing credential; after events it is
|
|
126
135
|
// a tool input the SDK could not parse (eager input streaming), which the loop retries.
|
|
127
136
|
if (!streamStarted && !hasCredentials(current)) {
|
|
128
|
-
if (!options.client)
|
|
137
|
+
if (!options.client) {
|
|
129
138
|
client = null;
|
|
139
|
+
keyed = null;
|
|
140
|
+
}
|
|
130
141
|
return { type: 'error', code: 'auth', message: NO_KEY_MESSAGE };
|
|
131
142
|
}
|
|
132
143
|
if (streamStarted)
|
|
@@ -141,10 +152,12 @@ export function anthropicAdapter(options = {}) {
|
|
|
141
152
|
setupProblem: seesKey ? null : 'The AI assistant is probably not set up: the server has no ANTHROPIC_API_KEY. Ask your developer to add an API key.',
|
|
142
153
|
keyEnv: 'ANTHROPIC_API_KEY',
|
|
143
154
|
keyUrl: KEY_URL,
|
|
155
|
+
acceptsApiKey: true,
|
|
156
|
+
missingKey: !seesKey,
|
|
144
157
|
async *stream(request) {
|
|
145
158
|
let current;
|
|
146
159
|
try {
|
|
147
|
-
current = getClient();
|
|
160
|
+
current = getClient(request.apiKey?.trim() || undefined);
|
|
148
161
|
}
|
|
149
162
|
catch (error) {
|
|
150
163
|
yield { type: 'error', code: 'auth', message: `${NO_KEY_MESSAGE} (${error instanceof Error ? error.message : String(error)})` };
|