payload-canvas 0.4.0 → 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 +625 -153
- 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 -2
- package/dist/blocks/index.js +1 -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/bindings.d.ts +77 -32
- package/dist/core/bindings.js +319 -134
- package/dist/core/blockNames.d.ts +9 -0
- package/dist/core/blockNames.js +11 -0
- package/dist/core/blocks.d.ts +21 -8
- package/dist/core/blocks.js +37 -16
- package/dist/core/classes.d.ts +16 -8
- package/dist/core/classes.js +31 -27
- package/dist/core/components.d.ts +72 -0
- package/dist/core/components.js +294 -0
- package/dist/core/contentMode.d.ts +27 -0
- package/dist/core/contentMode.js +0 -0
- package/dist/core/dropTarget.d.ts +11 -0
- package/dist/core/dropTarget.js +24 -1
- package/dist/core/fields.d.ts +5 -0
- package/dist/core/fields.js +11 -0
- package/dist/core/headings.d.ts +5 -2
- package/dist/core/headings.js +14 -6
- package/dist/core/index.d.ts +8 -3
- package/dist/core/index.js +8 -3
- package/dist/core/layers.d.ts +9 -0
- package/dist/core/layers.js +29 -0
- package/dist/core/operations.d.ts +6 -0
- package/dist/core/operations.js +85 -24
- package/dist/core/payloadBlocks.js +5 -1
- package/dist/core/references.js +28 -0
- package/dist/core/schema.js +20 -6
- package/dist/core/sectionOrigin.d.ts +6 -0
- package/dist/core/sectionOrigin.js +21 -0
- package/dist/core/sections.d.ts +72 -0
- package/dist/core/sections.js +331 -0
- package/dist/core/templateChoice.d.ts +24 -0
- package/dist/core/templateChoice.js +43 -0
- package/dist/core/tree.js +18 -6
- package/dist/core/types.d.ts +148 -18
- package/dist/core/validate.d.ts +4 -1
- package/dist/core/validate.js +28 -11
- package/dist/core/visibility.d.ts +63 -0
- package/dist/core/visibility.js +214 -0
- package/dist/core/whereValues.d.ts +22 -0
- package/dist/core/whereValues.js +43 -0
- package/dist/css/classes.d.ts +16 -0
- package/dist/css/classes.js +172 -0
- package/dist/css/index.d.ts +32 -1
- package/dist/css/index.js +64 -5
- package/dist/css/tokens.d.ts +10 -0
- package/dist/css/tokens.js +23 -10
- package/dist/index.d.ts +5 -2
- package/dist/index.js +6 -1
- package/dist/live/contentMode.d.ts +24 -0
- package/dist/live/contentMode.js +39 -0
- package/dist/live/endpoints.js +3 -0
- package/dist/live/session.d.ts +5 -0
- package/dist/live/session.js +8 -0
- package/dist/live/types.d.ts +16 -1
- package/dist/mcp/index.d.ts +10 -1
- package/dist/mcp/index.js +146 -54
- package/dist/mcp/shared.d.ts +93 -3
- package/dist/mcp/shared.js +211 -15
- package/dist/plugin/hook.d.ts +7 -1
- package/dist/plugin/hook.js +30 -4
- package/dist/plugin/index.d.ts +19 -8
- package/dist/plugin/index.js +89 -20
- package/dist/plugin/links.d.ts +24 -0
- package/dist/plugin/links.js +27 -0
- package/dist/plugin/listCollections.d.ts +9 -7
- package/dist/plugin/listCollections.js +30 -21
- package/dist/plugin/sections.d.ts +14 -7
- package/dist/plugin/sections.js +69 -23
- package/dist/plugin/sectionsUsedIn.d.ts +6 -0
- package/dist/plugin/sectionsUsedIn.js +24 -0
- package/dist/plugin/templateEndpoint.d.ts +9 -0
- package/dist/plugin/templateEndpoint.js +49 -0
- package/dist/plugin/templates.js +23 -8
- package/dist/protocol/index.d.ts +16 -1
- package/dist/react/canvas/BuilderCanvas.js +144 -21
- package/dist/react/canvas/classes.d.ts +17 -0
- package/dist/react/canvas/classes.js +102 -0
- package/dist/react/canvas/controls.d.ts +31 -0
- package/dist/react/canvas/controls.js +75 -0
- package/dist/react/canvas/fetchDocs.d.ts +2 -2
- package/dist/react/canvas/fetchDocs.js +16 -8
- package/dist/react/canvas/measure.d.ts +9 -0
- package/dist/react/canvas/measure.js +106 -7
- package/dist/react/canvas/resolveLayout.d.ts +1 -1
- package/dist/react/canvas/resolveLayout.js +4 -3
- package/dist/react/canvas/thumbnail/ThumbnailCanvas.js +17 -4
- package/dist/react/classes/ClassesStyle.d.ts +27 -0
- package/dist/react/classes/ClassesStyle.js +27 -0
- package/dist/react/components/Button.d.ts +2 -11
- package/dist/react/components/Button.js +8 -43
- package/dist/react/components/CollectionList.d.ts +4 -1
- package/dist/react/components/CollectionList.js +10 -3
- package/dist/react/components/Container.d.ts +5 -2
- package/dist/react/components/Container.js +7 -4
- package/dist/react/components/Field.js +3 -14
- package/dist/react/components/Link.d.ts +1 -1
- package/dist/react/components/Link.js +5 -3
- package/dist/react/components/List.d.ts +1 -1
- package/dist/react/components/List.js +2 -2
- package/dist/react/components/Menu.d.ts +10 -1
- package/dist/react/components/Menu.js +39 -12
- package/dist/react/components/RichText.d.ts +3 -4
- package/dist/react/components/RichText.js +5 -5
- package/dist/react/components/builtins/Accordion.d.ts +4 -3
- package/dist/react/components/builtins/Accordion.js +6 -5
- package/dist/react/components/builtins/AdjacentLinks.d.ts +11 -0
- package/dist/react/components/builtins/AdjacentLinks.js +20 -0
- package/dist/react/components/builtins/Carousel.d.ts +21 -10
- package/dist/react/components/builtins/Carousel.js +175 -100
- package/dist/react/components/builtins/Disclosure.d.ts +4 -3
- package/dist/react/components/builtins/Disclosure.js +6 -5
- package/dist/react/components/builtins/Embed.d.ts +11 -0
- package/dist/react/components/builtins/Embed.js +23 -0
- package/dist/react/components/builtins/EmbedHtml.d.ts +15 -0
- package/dist/react/components/builtins/EmbedHtml.js +51 -0
- package/dist/react/components/builtins/EmbedPreview.d.ts +34 -0
- package/dist/react/components/builtins/EmbedPreview.js +105 -0
- package/dist/react/components/builtins/FilterLink.d.ts +1 -1
- package/dist/react/components/builtins/FilterLink.js +4 -4
- package/dist/react/components/builtins/Marquee.d.ts +8 -0
- package/dist/react/components/builtins/Marquee.js +15 -0
- package/dist/react/components/builtins/Popup.d.ts +26 -0
- package/dist/react/components/builtins/Popup.js +146 -0
- package/dist/react/components/builtins/SectionRef.d.ts +4 -3
- package/dist/react/components/builtins/SectionRef.js +9 -5
- package/dist/react/components/builtins/Tab.d.ts +7 -0
- package/dist/react/components/builtins/Tab.js +21 -0
- package/dist/react/components/builtins/TableOfContents.d.ts +17 -3
- package/dist/react/components/builtins/TableOfContents.js +22 -7
- package/dist/react/components/builtins/Tabs.d.ts +17 -0
- package/dist/react/components/builtins/Tabs.js +71 -0
- package/dist/react/components/builtins/index.d.ts +37 -20
- package/dist/react/components/builtins/index.js +54 -20
- package/dist/react/components/builtins/tabsContext.d.ts +12 -0
- package/dist/react/components/builtins/tabsContext.js +6 -0
- package/dist/react/components/index.js +11 -8
- package/dist/react/components/lazy.d.ts +32 -0
- package/dist/react/components/lazy.js +20 -0
- package/dist/react/components/lazyBlock.d.ts +17 -0
- package/dist/react/components/lazyBlock.js +23 -0
- package/dist/react/index.d.ts +6 -3
- package/dist/react/index.js +5 -2
- package/dist/react/render/RenderLayout.d.ts +9 -7
- package/dist/react/render/RenderLayout.js +96 -45
- package/dist/react/render/canvasMode.d.ts +13 -0
- package/dist/react/render/canvasMode.js +13 -0
- package/dist/react/render/canvasServer.js +4 -3
- package/dist/react/render/canvasServerTypes.d.ts +5 -0
- package/dist/react/render/lists.d.ts +36 -4
- package/dist/react/render/lists.js +132 -15
- package/dist/react/render/marks.d.ts +15 -0
- package/dist/react/render/marks.js +23 -0
- package/dist/react/render/payload.d.ts +8 -1
- package/dist/react/render/payload.js +12 -3
- package/dist/react/render/preview.d.ts +11 -0
- package/dist/react/render/preview.js +13 -0
- package/dist/react/render/relations.d.ts +10 -0
- package/dist/react/render/relations.js +39 -0
- package/dist/react/render/resolve.d.ts +8 -4
- package/dist/react/render/resolve.js +11 -5
- package/dist/react/render/reveal.d.ts +17 -0
- package/dist/react/render/reveal.js +39 -0
- package/dist/react/render/sections.d.ts +11 -5
- package/dist/react/render/sections.js +52 -24
- package/dist/react/render/templates.d.ts +47 -0
- package/dist/react/render/templates.js +139 -0
- package/dist/react/render/types.d.ts +62 -5
- package/dist/react/server.d.ts +2 -37
- package/dist/react/server.js +8 -133
- package/dist/react/theme/ThemeLiveLoader.d.ts +4 -0
- package/dist/react/theme/ThemeLiveLoader.js +5 -0
- package/dist/react/theme/ThemeStyle.js +1 -1
- package/dist/theme/admin/Variables.d.ts +11 -0
- package/dist/theme/admin/Variables.js +115 -0
- package/dist/theme/admin/fields.scss +113 -0
- package/dist/theme/client.d.ts +1 -0
- package/dist/theme/client.js +2 -0
- package/dist/theme/css.d.ts +6 -1
- package/dist/theme/css.js +12 -4
- package/dist/theme/global.js +83 -0
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.js +1 -0
- package/dist/theme/server.d.ts +15 -0
- package/dist/theme/server.js +43 -0
- package/dist/theme/usage.d.ts +23 -0
- package/dist/theme/usage.js +68 -0
- package/dist/theme/variables.d.ts +72 -0
- package/dist/theme/variables.js +231 -0
- package/package.json +4 -2
- package/dist/admin/editor/styles/SiteClasses.d.ts +0 -9
- package/dist/admin/editor/styles/SiteClasses.js +0 -31
- package/dist/blocks/builtins/headingId.d.ts +0 -15
- package/dist/blocks/builtins/headingId.js +0 -36
- package/dist/blocks/builtins/lightbox.d.ts +0 -43
- package/dist/blocks/builtins/lightbox.js +0 -93
- package/dist/blocks/builtins/mediaBackdrop.d.ts +0 -11
- package/dist/blocks/builtins/mediaBackdrop.js +0 -79
- package/dist/react/components/Quote.d.ts +0 -3
- package/dist/react/components/Quote.js +0 -12
- package/dist/react/components/Spacer.d.ts +0 -3
- package/dist/react/components/Spacer.js +0 -6
- package/dist/react/components/builtins/BackdropVideo.d.ts +0 -13
- package/dist/react/components/builtins/BackdropVideo.js +0 -16
- package/dist/react/components/builtins/Lightbox.d.ts +0 -45
- package/dist/react/components/builtins/Lightbox.js +0 -252
- package/dist/react/components/builtins/MediaBackdrop.d.ts +0 -14
- package/dist/react/components/builtins/MediaBackdrop.js +0 -61
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const EMBED_BLOCK = "embed";
|
|
2
|
+
/** `inline`: the HTML goes into the page and its scripts run. `isolated`: it runs in a sandboxed frame. */
|
|
3
|
+
export declare const EMBED_MODES: readonly ['inline', 'isolated'];
|
|
4
|
+
export type EmbedMode = (typeof EMBED_MODES)[number];
|
|
5
|
+
/** The longest code a block may hold, in characters, unless `builtinBlocks({ embed: { maxLength } })` says otherwise. */
|
|
6
|
+
export declare const EMBED_MAX_LENGTH = 50000;
|
|
7
|
+
/** Classes the embed component adds itself: a frame without the browser's border, as wide as its box. */
|
|
8
|
+
export declare const EMBED_CLASS_MAP: {
|
|
9
|
+
frame: string;
|
|
10
|
+
};
|
|
11
|
+
/** The embed's labels and their English defaults. `title`: the frame's name for screen readers. */
|
|
12
|
+
export declare const EMBED_LABELS: {
|
|
13
|
+
title: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* What the isolated frame may do on the site: run its scripts, send forms and open links in new
|
|
17
|
+
* tabs. Never `allow-same-origin`: with it, the code could reach the page and the visitor's session.
|
|
18
|
+
*/
|
|
19
|
+
export declare const EMBED_SANDBOX = "allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox";
|
|
20
|
+
/** The embed's mode: `isolated`, else `inline` (the default). */
|
|
21
|
+
export declare function embedMode(value: unknown): EmbedMode;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Read by the embed components in the browser. A leaf module: no block definitions, so the
|
|
2
|
+
// components' JavaScript does not carry them. The block definition re-exports these values.
|
|
3
|
+
import { classMap } from './helpers.js';
|
|
4
|
+
export const EMBED_BLOCK = 'embed';
|
|
5
|
+
/** `inline`: the HTML goes into the page and its scripts run. `isolated`: it runs in a sandboxed frame. */
|
|
6
|
+
export const EMBED_MODES = ['inline', 'isolated'];
|
|
7
|
+
/** The longest code a block may hold, in characters, unless `builtinBlocks({ embed: { maxLength } })` says otherwise. */
|
|
8
|
+
export const EMBED_MAX_LENGTH = 50_000;
|
|
9
|
+
/** Classes the embed component adds itself: a frame without the browser's border, as wide as its box. */
|
|
10
|
+
export const EMBED_CLASS_MAP = classMap({
|
|
11
|
+
frame: 'block w-full border-0',
|
|
12
|
+
});
|
|
13
|
+
/** The embed's labels and their English defaults. `title`: the frame's name for screen readers. */
|
|
14
|
+
export const EMBED_LABELS = { title: 'Embedded content' };
|
|
15
|
+
/**
|
|
16
|
+
* What the isolated frame may do on the site: run its scripts, send forms and open links in new
|
|
17
|
+
* tabs. Never `allow-same-origin`: with it, the code could reach the page and the visitor's session.
|
|
18
|
+
*/
|
|
19
|
+
export const EMBED_SANDBOX = 'allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox';
|
|
20
|
+
/** The embed's mode: `isolated`, else `inline` (the default). */
|
|
21
|
+
export function embedMode(value) {
|
|
22
|
+
return value === 'isolated' ? 'isolated' : 'inline';
|
|
23
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classes the field component adds to rich text that has no `prose` class of its own (see `Field.tsx`),
|
|
3
|
+
* so a post body looks right by default. Listed in the field block's `classes`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const FIELD_CLASS_MAP: {
|
|
6
|
+
readonly richText: 'prose max-w-none';
|
|
7
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Read by the Field block component in the browser. A leaf module: no block definitions, so the
|
|
2
|
+
// component's JavaScript does not carry them. The block definition re-exports these values.
|
|
3
|
+
import { classMap } from './helpers.js';
|
|
4
|
+
/**
|
|
5
|
+
* Classes the field component adds to rich text that has no `prose` class of its own (see `Field.tsx`),
|
|
6
|
+
* so a post body looks right by default. Listed in the field block's `classes`.
|
|
7
|
+
*/
|
|
8
|
+
export const FIELD_CLASS_MAP = classMap({ richText: 'prose max-w-none' });
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** A URL query: `URLSearchParams`, or the `searchParams` object of a Next.js page. */
|
|
2
|
+
export type FilterQuery = URLSearchParams | Record<string, string | string[] | undefined>;
|
|
3
|
+
export type FilterLinkTarget = {
|
|
4
|
+
param: string;
|
|
5
|
+
value: string;
|
|
6
|
+
multiple?: boolean;
|
|
7
|
+
/** Page parameters of lists with their own `pageParam`, dropped like `page`. */
|
|
8
|
+
pageParams?: readonly string[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Where a filter link goes and whether it is the current filter. An empty `param` clears every
|
|
12
|
+
* query value ("All"). An empty `value` clears its param. `multiple` toggles the value in the
|
|
13
|
+
* param's comma list; otherwise the value replaces the param's values. Other params stay.
|
|
14
|
+
* `path` is the page path; with an empty path the href is relative (`?a=b`, or `?` for none).
|
|
15
|
+
*/
|
|
16
|
+
export declare function filterHref(path: string, query: FilterQuery, { param, value, multiple, pageParams }: FilterLinkTarget): {
|
|
17
|
+
href: string;
|
|
18
|
+
active: boolean;
|
|
19
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Read by the filter link component in the browser. A leaf module: no block definitions, so the
|
|
2
|
+
// component's JavaScript does not carry them. The block definition re-exports these values.
|
|
3
|
+
import { PAGE_PARAM } from '../../core/blockNames.js';
|
|
4
|
+
/** The values of one param: repeated params and comma lists both count. */
|
|
5
|
+
function valuesOf(query, param) {
|
|
6
|
+
const raw = query instanceof URLSearchParams ? query.getAll(param) : [].concat(query[param] ?? []);
|
|
7
|
+
return raw.flatMap((value) => value.split(',')).map((value) => value.trim()).filter(Boolean);
|
|
8
|
+
}
|
|
9
|
+
const keysOf = (query) => [...new Set(query instanceof URLSearchParams ? query.keys() : Object.keys(query))];
|
|
10
|
+
/**
|
|
11
|
+
* Where a filter link goes and whether it is the current filter. An empty `param` clears every
|
|
12
|
+
* query value ("All"). An empty `value` clears its param. `multiple` toggles the value in the
|
|
13
|
+
* param's comma list; otherwise the value replaces the param's values. Other params stay.
|
|
14
|
+
* `path` is the page path; with an empty path the href is relative (`?a=b`, or `?` for none).
|
|
15
|
+
*/
|
|
16
|
+
export function filterHref(path, query, { param, value, multiple, pageParams = [] }) {
|
|
17
|
+
// A new filter starts again at page 1, so the page numbers are dropped.
|
|
18
|
+
const pages = new Set([PAGE_PARAM, ...pageParams]);
|
|
19
|
+
const params = keysOf(query).filter((key) => !pages.has(key) && valuesOf(query, key).length > 0);
|
|
20
|
+
const link = (search) => (search ? `${path}?${search}` : path || '?');
|
|
21
|
+
if (!param)
|
|
22
|
+
return { href: link(''), active: params.length === 0 };
|
|
23
|
+
const current = valuesOf(query, param);
|
|
24
|
+
const active = value ? current.includes(value) : current.length === 0;
|
|
25
|
+
const next = !value ? [] : !multiple ? [value] : active ? current.filter((item) => item !== value) : [...current, value];
|
|
26
|
+
const search = [...params.filter((key) => key !== param), ...(next.length > 0 ? [param] : [])]
|
|
27
|
+
.map((key) => `${encodeURIComponent(key)}=${(key === param ? next : valuesOf(query, key)).map(encodeURIComponent).join(',')}`)
|
|
28
|
+
.join('&');
|
|
29
|
+
return { href: link(search), active };
|
|
30
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
type ClassTree = {
|
|
2
|
+
readonly [key: string]: string | ClassTree;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Adds the marker class to every class string of a map, nested maps too (see
|
|
6
|
+
* `BUILDER_CSS_CLASS`). A component puts these strings on its own elements; its definition lists
|
|
7
|
+
* them in `classes` (`classesOf`), so the generated CSS has them.
|
|
8
|
+
*/
|
|
9
|
+
export declare function classMap<T extends ClassTree>(map: T): T;
|
|
10
|
+
/** Plain string props: trimmed, or the fallback when empty. */
|
|
11
|
+
export declare const textOr: (value: unknown, fallback: string) => string;
|
|
12
|
+
/** Prop name -> default text of a label (`{n}` and `{count}` are filled in where noted). */
|
|
13
|
+
export type ControlLabels = Record<string, string>;
|
|
14
|
+
/**
|
|
15
|
+
* A label: the prop, or the default when empty. `labels` are the defaults: the English text with
|
|
16
|
+
* the site's labels over it. `values` fill `{n}`-style placeholders ("Slide {n} of {count}").
|
|
17
|
+
*/
|
|
18
|
+
export declare function labelOf(props: Record<string, unknown>, labels: ControlLabels, name: string, values?: Record<string, string | number>): string;
|
|
19
|
+
/** Class strings joined with spaces; empty and missing ones are left out. */
|
|
20
|
+
export declare const joinClasses: (...classes: (string | undefined)[]) => string;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Helpers the block components use when they render. A leaf module (it imports only the marker
|
|
2
|
+
// class), so a client component that uses it ships no block definitions to the browser.
|
|
3
|
+
import { BUILDER_CSS_CLASS } from '../../css/marker.js';
|
|
4
|
+
/**
|
|
5
|
+
* Adds the marker class to every class string of a map, nested maps too (see
|
|
6
|
+
* `BUILDER_CSS_CLASS`). A component puts these strings on its own elements; its definition lists
|
|
7
|
+
* them in `classes` (`classesOf`), so the generated CSS has them.
|
|
8
|
+
*/
|
|
9
|
+
export function classMap(map) {
|
|
10
|
+
const entries = Object.entries(map).map(([key, value]) => [key, typeof value === 'string' ? `${value} ${BUILDER_CSS_CLASS}` : classMap(value)]);
|
|
11
|
+
return Object.fromEntries(entries);
|
|
12
|
+
}
|
|
13
|
+
/** Plain string props: trimmed, or the fallback when empty. */
|
|
14
|
+
export const textOr = (value, fallback) => typeof value === 'string' && value.trim() ? value.trim() : fallback;
|
|
15
|
+
/**
|
|
16
|
+
* A label: the prop, or the default when empty. `labels` are the defaults: the English text with
|
|
17
|
+
* the site's labels over it. `values` fill `{n}`-style placeholders ("Slide {n} of {count}").
|
|
18
|
+
*/
|
|
19
|
+
export function labelOf(props, labels, name, values = {}) {
|
|
20
|
+
const template = textOr(props[name], labels[name] ?? '');
|
|
21
|
+
return template.replace(/\{(\w+)\}/g, (match, key) => (key in values ? String(values[key]) : match));
|
|
22
|
+
}
|
|
23
|
+
/** Class strings joined with spaces; empty and missing ones are left out. */
|
|
24
|
+
export const joinClasses = (...classes) => classes.filter(Boolean).join(' ');
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** The seconds one round takes, by `speed`. */
|
|
2
|
+
export declare const MARQUEE_SECONDS: {
|
|
3
|
+
readonly slow: 60;
|
|
4
|
+
readonly normal: 35;
|
|
5
|
+
readonly fast: 20;
|
|
6
|
+
};
|
|
7
|
+
export type MarqueeSpeed = keyof typeof MARQUEE_SECONDS;
|
|
8
|
+
/**
|
|
9
|
+
* The marquee's own CSS, in one `<style>` that React puts once in the page's head. Plain CSS on
|
|
10
|
+
* data attributes, so it needs no classes in the generated CSS. The track holds the items twice
|
|
11
|
+
* and moves by half its width, so the second copy takes the place of the first. Still on the
|
|
12
|
+
* canvas and with reduced motion: the items wrap and the copy is not shown.
|
|
13
|
+
*/
|
|
14
|
+
export declare const MARQUEE_CSS = "\n@keyframes builder-marquee { from { transform: translate3d(0, 0, 0) } to { transform: translate3d(-50%, 0, 0) } }\n[data-marquee] { overflow: hidden }\n[data-marquee-track] { display: flex; width: max-content; animation: builder-marquee var(--marquee-duration, 35s) linear infinite }\n[data-marquee-track] > * { flex-shrink: 0 }\n[data-marquee=\"right\"] [data-marquee-track] { animation-direction: reverse }\n[data-marquee-pause]:hover [data-marquee-track], [data-marquee-pause]:focus-within [data-marquee-track] { animation-play-state: paused }\n[data-marquee-still] [data-marquee-track] { width: auto; animation: none }\n[data-marquee-still] [data-marquee-track] > * { flex-shrink: 1; flex-wrap: wrap }\n@media (prefers-reduced-motion: reduce) {\n [data-marquee-track] { width: auto; animation: none }\n [data-marquee-track] > * { flex-shrink: 1; flex-wrap: wrap }\n [data-marquee-copy] { display: none }\n}\n";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Read by the marquee component. A leaf module: no block definitions. The block definition
|
|
2
|
+
// re-exports these values.
|
|
3
|
+
/** The seconds one round takes, by `speed`. */
|
|
4
|
+
export const MARQUEE_SECONDS = { slow: 60, normal: 35, fast: 20 };
|
|
5
|
+
/**
|
|
6
|
+
* The marquee's own CSS, in one `<style>` that React puts once in the page's head. Plain CSS on
|
|
7
|
+
* data attributes, so it needs no classes in the generated CSS. The track holds the items twice
|
|
8
|
+
* and moves by half its width, so the second copy takes the place of the first. Still on the
|
|
9
|
+
* canvas and with reduced motion: the items wrap and the copy is not shown.
|
|
10
|
+
*/
|
|
11
|
+
export const MARQUEE_CSS = `
|
|
12
|
+
@keyframes builder-marquee { from { transform: translate3d(0, 0, 0) } to { transform: translate3d(-50%, 0, 0) } }
|
|
13
|
+
[data-marquee] { overflow: hidden }
|
|
14
|
+
[data-marquee-track] { display: flex; width: max-content; animation: builder-marquee var(--marquee-duration, 35s) linear infinite }
|
|
15
|
+
[data-marquee-track] > * { flex-shrink: 0 }
|
|
16
|
+
[data-marquee="right"] [data-marquee-track] { animation-direction: reverse }
|
|
17
|
+
[data-marquee-pause]:hover [data-marquee-track], [data-marquee-pause]:focus-within [data-marquee-track] { animation-play-state: paused }
|
|
18
|
+
[data-marquee-still] [data-marquee-track] { width: auto; animation: none }
|
|
19
|
+
[data-marquee-still] [data-marquee-track] > * { flex-shrink: 1; flex-wrap: wrap }
|
|
20
|
+
@media (prefers-reduced-motion: reduce) {
|
|
21
|
+
[data-marquee-track] { width: auto; animation: none }
|
|
22
|
+
[data-marquee-track] > * { flex-shrink: 1; flex-wrap: wrap }
|
|
23
|
+
[data-marquee-copy] { display: none }
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classes the menu component uses itself (the toggle, the panel and the links). They are listed in
|
|
3
|
+
* the block's `classes`, so the generated CSS has them. Each string also holds `builder-css`:
|
|
4
|
+
* the generated CSS only styles elements with that class. Keep in sync with `Menu.tsx` in
|
|
5
|
+
* `payload-canvas/react`. Colours read the theme's CSS variables (`--color-background`,
|
|
6
|
+
* `--color-foreground`, `--color-border`, `--color-primary`, `--color-primary-foreground`) with
|
|
7
|
+
* system colours as the fallback, so the menu assumes no design system. The block's parts
|
|
8
|
+
* (`partClassName`) take other colours.
|
|
9
|
+
*/
|
|
10
|
+
export declare const MENU_CLASS_MAP: {
|
|
11
|
+
/** The inline list: its items become children of the <nav>, so the block's className lays them out. */
|
|
12
|
+
readonly list: {
|
|
13
|
+
readonly md: 'hidden md:contents';
|
|
14
|
+
readonly lg: 'hidden lg:contents';
|
|
15
|
+
readonly never: 'contents';
|
|
16
|
+
};
|
|
17
|
+
readonly toggleWrap: {
|
|
18
|
+
readonly md: 'md:hidden';
|
|
19
|
+
readonly lg: 'lg:hidden';
|
|
20
|
+
};
|
|
21
|
+
readonly link: string;
|
|
22
|
+
readonly toggle: string;
|
|
23
|
+
readonly iconOpen: 'size-5 group-open:hidden';
|
|
24
|
+
readonly iconClose: 'hidden size-5 group-open:block';
|
|
25
|
+
readonly panel: "absolute inset-x-0 top-full z-50 border-y px-5 pt-2 pb-6 shadow-md bg-[var(--color-background,Canvas)] text-[var(--color-foreground,CanvasText)] border-[var(--color-border,color-mix(in_oklab,currentColor_15%,transparent))]";
|
|
26
|
+
readonly panelList: 'flex flex-col';
|
|
27
|
+
readonly panelLink: string;
|
|
28
|
+
/** A link with children (one level): a <details> dropdown next to, or in place of, the link. */
|
|
29
|
+
readonly submenu: 'relative flex items-center gap-1';
|
|
30
|
+
readonly submenuDetails: 'group/submenu';
|
|
31
|
+
readonly submenuToggle: string;
|
|
32
|
+
readonly submenuIcon: 'size-4 transition-transform group-open/submenu:rotate-180 motion-reduce:transition-none';
|
|
33
|
+
readonly submenuList: "absolute top-full left-0 z-50 flex min-w-48 flex-col border p-2 shadow-md bg-[var(--color-background,Canvas)] text-[var(--color-foreground,CanvasText)] border-[var(--color-border,color-mix(in_oklab,currentColor_15%,transparent))]";
|
|
34
|
+
readonly submenuLink: string;
|
|
35
|
+
/** The children of a link in the small-screen panel: a nested list. */
|
|
36
|
+
readonly panelSubList: 'flex flex-col pl-4';
|
|
37
|
+
readonly panelSubLink: string;
|
|
38
|
+
/** The optional button after the links in the panel. */
|
|
39
|
+
readonly panelCta: string;
|
|
40
|
+
};
|
|
41
|
+
/** The menu's labels and their English defaults (`builtinComponents({ labels: { menu } })`). */
|
|
42
|
+
export declare const MENU_LABELS: {
|
|
43
|
+
label: string;
|
|
44
|
+
toggleLabel: string;
|
|
45
|
+
submenuLabel: string;
|
|
46
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Read by the menu component in the browser. A leaf module: no block definitions, so the
|
|
2
|
+
// component's JavaScript does not carry them. The block definition re-exports these values.
|
|
3
|
+
import { classMap } from './helpers.js';
|
|
4
|
+
/** A panel's background, text and border colours: the theme's, else the system's. */
|
|
5
|
+
const SURFACE = 'bg-[var(--color-background,Canvas)] text-[var(--color-foreground,CanvasText)] ' +
|
|
6
|
+
'border-[var(--color-border,color-mix(in_oklab,currentColor_15%,transparent))]';
|
|
7
|
+
/**
|
|
8
|
+
* Classes the menu component uses itself (the toggle, the panel and the links). They are listed in
|
|
9
|
+
* the block's `classes`, so the generated CSS has them. Each string also holds `builder-css`:
|
|
10
|
+
* the generated CSS only styles elements with that class. Keep in sync with `Menu.tsx` in
|
|
11
|
+
* `payload-canvas/react`. Colours read the theme's CSS variables (`--color-background`,
|
|
12
|
+
* `--color-foreground`, `--color-border`, `--color-primary`, `--color-primary-foreground`) with
|
|
13
|
+
* system colours as the fallback, so the menu assumes no design system. The block's parts
|
|
14
|
+
* (`partClassName`) take other colours.
|
|
15
|
+
*/
|
|
16
|
+
export const MENU_CLASS_MAP = classMap({
|
|
17
|
+
/** The inline list: its items become children of the <nav>, so the block's className lays them out. */
|
|
18
|
+
list: { md: 'hidden md:contents', lg: 'hidden lg:contents', never: 'contents' },
|
|
19
|
+
toggleWrap: { md: 'md:hidden', lg: 'lg:hidden' },
|
|
20
|
+
link: 'inline-flex items-center py-2 opacity-75 transition-opacity hover:opacity-100 ' +
|
|
21
|
+
'aria-[current=page]:opacity-100 aria-[current=page]:underline decoration-1 underline-offset-8',
|
|
22
|
+
toggle: 'flex min-h-11 min-w-11 cursor-pointer list-none items-center justify-center gap-2 rounded-md px-2 -mr-2 ' +
|
|
23
|
+
'[&::-webkit-details-marker]:hidden',
|
|
24
|
+
iconOpen: 'size-5 group-open:hidden',
|
|
25
|
+
iconClose: 'hidden size-5 group-open:block',
|
|
26
|
+
panel: `absolute inset-x-0 top-full z-50 border-y px-5 pt-2 pb-6 shadow-md ${SURFACE}`,
|
|
27
|
+
panelList: 'flex flex-col',
|
|
28
|
+
panelLink: 'flex min-h-12 items-center border-b border-[var(--color-border,color-mix(in_oklab,currentColor_15%,transparent))] py-3 text-lg ' +
|
|
29
|
+
'aria-[current=page]:font-semibold aria-[current=page]:underline decoration-1 underline-offset-8',
|
|
30
|
+
/** A link with children (one level): a <details> dropdown next to, or in place of, the link. */
|
|
31
|
+
submenu: 'relative flex items-center gap-1',
|
|
32
|
+
submenuDetails: 'group/submenu',
|
|
33
|
+
submenuToggle: 'inline-flex cursor-pointer list-none items-center gap-1 py-2 opacity-75 transition-opacity hover:opacity-100 ' +
|
|
34
|
+
'aria-[current=true]:opacity-100 [&::-webkit-details-marker]:hidden',
|
|
35
|
+
submenuIcon: 'size-4 transition-transform group-open/submenu:rotate-180 motion-reduce:transition-none',
|
|
36
|
+
submenuList: `absolute top-full left-0 z-50 flex min-w-48 flex-col border p-2 shadow-md ${SURFACE}`,
|
|
37
|
+
submenuLink: 'flex min-h-10 items-center px-3 py-2 opacity-75 transition-opacity hover:opacity-100 ' +
|
|
38
|
+
'aria-[current=page]:opacity-100 aria-[current=page]:underline decoration-1 underline-offset-8',
|
|
39
|
+
/** The children of a link in the small-screen panel: a nested list. */
|
|
40
|
+
panelSubList: 'flex flex-col pl-4',
|
|
41
|
+
panelSubLink: 'flex min-h-11 items-center py-2 text-base ' +
|
|
42
|
+
'aria-[current=page]:font-semibold aria-[current=page]:underline decoration-1 underline-offset-8',
|
|
43
|
+
/** The optional button after the links in the panel. */
|
|
44
|
+
panelCta: 'mt-5 flex min-h-12 items-center justify-center rounded-full bg-[var(--color-primary,CanvasText)] px-6 text-base ' +
|
|
45
|
+
'font-medium text-[var(--color-primary-foreground,Canvas)] transition-colors ' +
|
|
46
|
+
'hover:bg-[color-mix(in_oklch,var(--color-primary,CanvasText),black_14%)]',
|
|
47
|
+
});
|
|
48
|
+
/** The menu's labels and their English defaults (`builtinComponents({ labels: { menu } })`). */
|
|
49
|
+
export const MENU_LABELS = { label: 'Main', toggleLabel: 'Menu', submenuLabel: '{label} menu' };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classes the popup component adds itself. No sizes or colours: those come from the parts'
|
|
3
|
+
* classes (`panel`, `trigger`, `close`). `panel`: Tailwind's reset removes the dialog's
|
|
4
|
+
* `margin: auto`, which centres an open modal dialog; this puts it back.
|
|
5
|
+
*/
|
|
6
|
+
export declare const POPUP_CLASS_MAP: {
|
|
7
|
+
panel: string;
|
|
8
|
+
trigger: string;
|
|
9
|
+
close: string;
|
|
10
|
+
icon: string;
|
|
11
|
+
};
|
|
12
|
+
/** The popup's labels and their English defaults. */
|
|
13
|
+
export declare const POPUP_LABELS: {
|
|
14
|
+
closeLabel: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Read by the popup component in the browser. A leaf module: no block definitions, so the
|
|
2
|
+
// component's JavaScript does not carry them. The block definition re-exports these values.
|
|
3
|
+
import { classMap } from './helpers.js';
|
|
4
|
+
/**
|
|
5
|
+
* Classes the popup component adds itself. No sizes or colours: those come from the parts'
|
|
6
|
+
* classes (`panel`, `trigger`, `close`). `panel`: Tailwind's reset removes the dialog's
|
|
7
|
+
* `margin: auto`, which centres an open modal dialog; this puts it back.
|
|
8
|
+
*/
|
|
9
|
+
export const POPUP_CLASS_MAP = classMap({
|
|
10
|
+
panel: 'm-auto',
|
|
11
|
+
trigger: 'cursor-pointer',
|
|
12
|
+
close: 'inline-flex cursor-pointer items-center justify-center',
|
|
13
|
+
icon: 'size-5',
|
|
14
|
+
});
|
|
15
|
+
/** The popup's labels and their English defaults. */
|
|
16
|
+
export const POPUP_LABELS = { closeLabel: 'Close' };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The child block type of the tabs block: one tab with its label and content. */
|
|
2
|
+
export declare const TAB_BLOCK = "tab";
|
|
3
|
+
/** Classes the tabs component adds itself. Sizes and colours come from the parts' classes. */
|
|
4
|
+
export declare const TABS_CLASS_MAP: {
|
|
5
|
+
tab: string;
|
|
6
|
+
};
|
|
7
|
+
/** The tabs' labels and their English defaults. `{n}`: the tab number, for a tab without a label. */
|
|
8
|
+
export declare const TABS_LABELS: {
|
|
9
|
+
tabLabel: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Read by the tabs component in the browser. A leaf module: no block definitions, so the
|
|
2
|
+
// component's JavaScript does not carry them. The block definition re-exports these values.
|
|
3
|
+
import { classMap } from './helpers.js';
|
|
4
|
+
/** The child block type of the tabs block: one tab with its label and content. */
|
|
5
|
+
export const TAB_BLOCK = 'tab';
|
|
6
|
+
/** Classes the tabs component adds itself. Sizes and colours come from the parts' classes. */
|
|
7
|
+
export const TABS_CLASS_MAP = classMap({
|
|
8
|
+
tab: 'cursor-pointer',
|
|
9
|
+
});
|
|
10
|
+
/** The tabs' labels and their English defaults. `{n}`: the tab number, for a tab without a label. */
|
|
11
|
+
export const TABS_LABELS = { tabLabel: 'Tab {n}' };
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import type { Field } from 'payload';
|
|
1
2
|
import type { BlockDefinition } from '../core/types.js';
|
|
3
|
+
import { FIELD_CLASS_MAP } from './client/field.js';
|
|
4
|
+
import { MENU_CLASS_MAP, MENU_LABELS } from './client/menu.js';
|
|
5
|
+
export { FIELD_CLASS_MAP, MENU_CLASS_MAP, MENU_LABELS };
|
|
2
6
|
export type DefaultBlocksOptions = {
|
|
3
7
|
/** Upload collection for the image and video blocks. Default "media". */
|
|
4
8
|
mediaCollection?: string;
|
|
@@ -12,61 +16,20 @@ export type DefaultBlocksOptions = {
|
|
|
12
16
|
* Default: a text field. The plugin turns it into a select of its collections that have a `url`.
|
|
13
17
|
*/
|
|
14
18
|
listCollections?: string[];
|
|
15
|
-
/**
|
|
16
|
-
* The names of the site's icons: the same list as `builtinBlocks({ icons })`. With names, the
|
|
17
|
-
* button block gets the props `icon`, `iconPosition` and `iconClassName`, and
|
|
18
|
-
* `builtinComponents({ icons })` renders them. Without names the button has no icon props.
|
|
19
|
-
*/
|
|
20
|
-
icons?: readonly string[];
|
|
21
|
-
};
|
|
22
|
-
/** "arrowUpRight" -> "arrow up right". */
|
|
23
|
-
export declare const iconLabel: (name: string) => string;
|
|
24
|
-
/**
|
|
25
|
-
* Classes the menu component uses itself (the toggle, the panel and the links). They are listed in
|
|
26
|
-
* the block's `classes`, so the generated CSS has them. Each string also holds `builder-css`:
|
|
27
|
-
* the generated CSS only styles elements with that class. Keep in sync with `Menu.tsx` in
|
|
28
|
-
* `payload-canvas/react`.
|
|
29
|
-
*/
|
|
30
|
-
export declare const MENU_CLASS_MAP: {
|
|
31
|
-
/** The inline list: its items become children of the <nav>, so the block's className lays them out. */
|
|
32
|
-
readonly list: {
|
|
33
|
-
readonly md: 'hidden md:contents';
|
|
34
|
-
readonly lg: 'hidden lg:contents';
|
|
35
|
-
readonly never: 'contents';
|
|
36
|
-
};
|
|
37
|
-
readonly toggleWrap: {
|
|
38
|
-
readonly md: 'md:hidden';
|
|
39
|
-
readonly lg: 'lg:hidden';
|
|
40
|
-
};
|
|
41
|
-
readonly link: string;
|
|
42
|
-
readonly toggle: string;
|
|
43
|
-
readonly iconOpen: 'size-5 group-open:hidden';
|
|
44
|
-
readonly iconClose: 'hidden size-5 group-open:block';
|
|
45
|
-
readonly panel: string;
|
|
46
|
-
readonly panelList: 'flex flex-col';
|
|
47
|
-
readonly panelLink: string;
|
|
48
|
-
/** A link with children (one level): a <details> dropdown next to, or in place of, the link. */
|
|
49
|
-
readonly submenu: 'relative flex items-center gap-1';
|
|
50
|
-
readonly submenuDetails: 'group/submenu';
|
|
51
|
-
readonly submenuToggle: string;
|
|
52
|
-
readonly submenuIcon: 'size-4 transition-transform group-open/submenu:rotate-180 motion-reduce:transition-none';
|
|
53
|
-
readonly submenuList: 'absolute top-full left-0 z-50 flex min-w-48 flex-col border border-border bg-background p-2 text-foreground shadow-md';
|
|
54
|
-
readonly submenuLink: string;
|
|
55
|
-
/** The children of a link in the small-screen panel: a nested list. */
|
|
56
|
-
readonly panelSubList: 'flex flex-col pl-4';
|
|
57
|
-
readonly panelSubLink: string;
|
|
58
|
-
/** The optional button after the links in the panel. */
|
|
59
|
-
readonly panelCta: string;
|
|
60
19
|
};
|
|
61
20
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
21
|
+
* The `collection` field of the collection list and repeat blocks: a select of `slugs`, or a text
|
|
22
|
+
* field when there are none. The plugin's `listCollectionsOf` uses it too.
|
|
64
23
|
*/
|
|
65
|
-
export declare
|
|
66
|
-
|
|
67
|
-
|
|
24
|
+
export declare function listCollectionField(slugs: readonly string[] | undefined, args: {
|
|
25
|
+
label: string;
|
|
26
|
+
required: boolean;
|
|
27
|
+
description?: string;
|
|
28
|
+
}): Field;
|
|
29
|
+
/** The collection list's picked documents: a relationship to `slugs`, or ids as text when there are none. */
|
|
30
|
+
export declare function pickedDocumentsField(slugs: readonly string[] | undefined): Field;
|
|
68
31
|
/**
|
|
69
|
-
* The
|
|
70
|
-
* its listItem blocks),
|
|
32
|
+
* The default blocks: stack, grid, heading, text, richText, image, button, link, menu, list (with
|
|
33
|
+
* its listItem blocks), divider, video, and the dynamic blocks field, collectionList and repeat.
|
|
71
34
|
*/
|
|
72
35
|
export declare function defaultBlocks(options?: DefaultBlocksOptions): BlockDefinition[];
|