efficient-web-builder 1.0.0 → 2.0.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/CHANGELOG.md +30 -0
- package/README.md +2 -1
- package/dist/components/AddBlockRow.d.ts +1 -7
- package/dist/components/AddBlockRow.js +1 -1
- package/dist/components/AddChildRow.d.ts +1 -6
- package/dist/components/AddChildRow.js +1 -1
- package/dist/components/AddSidePanel.d.ts +2 -39
- package/dist/components/AddSidePanel.js +1 -1
- package/dist/components/BlockGapField.js +1 -1
- package/dist/components/BlogPostSource.js +1 -1
- package/dist/components/CardShadowField.js +1 -1
- package/dist/components/ChatSettingsPanel.js +1 -1
- package/dist/components/CornersField.d.ts +0 -1
- package/dist/components/CornersField.js +1 -1
- package/dist/components/DuplicateToPageMenu.js +1 -1
- package/dist/components/EditorScreenMount.d.ts +1 -0
- package/dist/components/EditorScreenMount.js +1 -0
- package/dist/components/EditorStoreProvider.d.ts +1 -0
- package/dist/components/EditorStoreProvider.js +1 -0
- package/dist/components/HeroImageField.js +1 -1
- package/dist/components/HeroSection.d.ts +2 -6
- package/dist/components/HeroSection.js +4 -4
- package/dist/components/HoverEffectField.js +1 -1
- package/dist/components/ImageFocusRow.js +1 -1
- package/dist/components/KeepHint.d.ts +5 -0
- package/dist/components/KeepHint.js +1 -0
- package/dist/components/LocationsGroupedField.js +1 -1
- package/dist/components/MediaSidePanel.d.ts +1 -6
- package/dist/components/MediaSidePanel.js +1 -1
- package/dist/components/MediaUploadField.js +1 -1
- package/dist/components/MultiSelectField.d.ts +4 -1
- package/dist/components/MultiSelectField.js +1 -1
- package/dist/components/NodeContextMenu.d.ts +2 -96
- package/dist/components/NodeContextMenu.js +1 -1
- package/dist/components/PageEditGuardNotices.d.ts +1 -1
- package/dist/components/PageEditGuardNotices.js +1 -1
- package/dist/components/PanelToggleIcon.d.ts +1 -3
- package/dist/components/PanelToggleIcon.js +1 -1
- package/dist/components/PartSettingsPanel.d.ts +5 -0
- package/dist/components/PartSettingsPanel.js +1 -1
- package/dist/components/PhotographyField.js +1 -1
- package/dist/components/PreviewDeviceContext.d.ts +2 -4
- package/dist/components/PreviewDeviceContext.js +1 -1
- package/dist/components/PreviewPartsContext.d.ts +1 -3
- package/dist/components/PreviewPartsContext.js +1 -1
- package/dist/components/SearchSelectField.d.ts +3 -1
- package/dist/components/SearchSelectField.js +1 -1
- package/dist/components/SectionEditor.d.ts +2 -5
- package/dist/components/SectionEditor.js +1 -1
- package/dist/components/SectionEditorShell.d.ts +1 -1
- package/dist/components/SectionEditorShell.js +1 -1
- package/dist/components/SectionThemePicker.d.ts +3 -1
- package/dist/components/SectionThemePicker.js +1 -1
- package/dist/components/ShadowColourField.js +1 -1
- package/dist/components/SidePanelHead.d.ts +1 -23
- package/dist/components/SidePanelHead.js +1 -1
- package/dist/components/SideSpaceField.d.ts +0 -1
- package/dist/components/SideSpaceField.js +1 -1
- package/dist/components/SiteEditorProvider.d.ts +3 -10
- package/dist/components/SiteEditorProvider.js +1 -1
- package/dist/components/SiteWidthField.d.ts +0 -1
- package/dist/components/SiteWidthField.js +1 -1
- package/dist/components/SlotChildActionsContext.d.ts +2 -13
- package/dist/components/SlotChildActionsContext.js +1 -1
- package/dist/components/SocialLinksPanel.js +1 -1
- package/dist/components/SourceStatus.js +1 -1
- package/dist/components/StandaloneSectionEditor.d.ts +1 -0
- package/dist/components/StandaloneSectionEditor.js +1 -1
- package/dist/components/StorefrontDocumentContext.d.ts +2 -67
- package/dist/components/StorefrontDocumentContext.js +1 -1
- package/dist/components/StorefrontEditor.d.ts +1 -0
- package/dist/components/StorefrontEditor.js +1 -1
- package/dist/components/StorefrontEditorChrome.d.ts +1 -1
- package/dist/components/StorefrontEditorChrome.js +1 -1
- package/dist/components/StorefrontLinkField.d.ts +9 -0
- package/dist/components/StorefrontLinkField.js +1 -1
- package/dist/components/ThemeField.js +1 -1
- package/dist/components/TickerSettingsPanel.js +1 -1
- package/dist/components/UiIcon.d.ts +2 -10
- package/dist/components/UiIcon.js +1 -1
- package/dist/components/WebsiteScreenParts.d.ts +2 -0
- package/dist/components/WebsiteScreenParts.js +1 -0
- package/dist/components/WidthFollowField.js +1 -1
- package/dist/components/panel-widths.d.ts +2 -12
- package/dist/components/panel-widths.js +1 -1
- package/dist/components/storefront-editor.css +125 -986
- package/dist/components/useFooterFocus.d.ts +2 -0
- package/dist/components/useFooterFocus.js +1 -0
- package/dist/components/useLocationsTree.d.ts +6 -0
- package/dist/components/useLocationsTree.js +1 -0
- package/dist/components/usePartBridge.d.ts +1 -9
- package/dist/components/usePartBridge.js +1 -1
- package/dist/components/usePinnedChromeSeed.d.ts +2 -0
- package/dist/components/usePinnedChromeSeed.js +1 -0
- package/dist/components/useSocialSettings.js +1 -1
- package/dist/components/useStorefrontBlogPosts.js +1 -1
- package/dist/lib/client-only.d.ts +1 -0
- package/dist/lib/client-only.js +1 -0
- package/dist/lib/content/view-tiers.d.ts +2 -6
- package/dist/lib/content/view-tiers.js +1 -1
- package/dist/lib/editor-admin-bridge.d.ts +2 -29
- package/dist/lib/editor-admin-bridge.js +1 -1
- package/dist/lib/editor-backend-error.d.ts +2 -0
- package/dist/lib/editor-backend-error.js +1 -0
- package/dist/lib/editor-blocks.d.ts +2 -2
- package/dist/lib/editor-chrome.d.ts +2 -52
- package/dist/lib/editor-chrome.js +1 -1
- package/dist/lib/editor-document-adapter.d.ts +3 -51
- package/dist/lib/editor-document-adapter.js +1 -1
- package/dist/lib/editor-document-addressing.d.ts +2 -0
- package/dist/lib/editor-document-addressing.js +1 -0
- package/dist/lib/editor-document-contract.d.ts +1 -0
- package/dist/lib/editor-document-contract.js +0 -0
- package/dist/lib/editor-document-hooks.d.ts +1 -15
- package/dist/lib/editor-document-switch.d.ts +2 -0
- package/dist/lib/editor-document-switch.js +1 -0
- package/dist/lib/editor-failure.d.ts +1 -4
- package/dist/lib/editor-failure.js +1 -1
- package/dist/lib/editor-host-inbound.d.ts +1 -1
- package/dist/lib/editor-host-inbound.js +1 -1
- package/dist/lib/editor-host.d.ts +2 -135
- package/dist/lib/editor-host.js +1 -1
- package/dist/lib/editor-key-scope.d.ts +1 -3
- package/dist/lib/editor-key-scope.js +1 -1
- package/dist/lib/editor-load-error.d.ts +1 -4
- package/dist/lib/editor-load-error.js +1 -1
- package/dist/lib/editor-media-panel.d.ts +2 -23
- package/dist/lib/editor-media-panel.js +1 -1
- package/dist/lib/editor-media-picker.d.ts +2 -12
- package/dist/lib/editor-media-picker.js +1 -1
- package/dist/lib/editor-page-lock.d.ts +1 -1
- package/dist/lib/editor-page-lock.js +1 -1
- package/dist/lib/editor-screen.d.ts +2 -0
- package/dist/lib/editor-screen.js +1 -0
- package/dist/lib/editor-section-templates.d.ts +1 -2
- package/dist/lib/editor-section-templates.js +1 -1
- package/dist/lib/editor-session-context.d.ts +1 -7
- package/dist/lib/editor-session-context.js +1 -1
- package/dist/lib/editor-session.d.ts +2 -45
- package/dist/lib/editor-session.js +1 -1
- package/dist/lib/editor-site-slug.js +1 -1
- package/dist/lib/editor-theme.d.ts +1 -1
- package/dist/lib/editor-theme.js +1 -1
- package/dist/lib/hero-arrows.d.ts +1 -1
- package/dist/lib/links/link-filters.d.ts +1 -0
- package/dist/lib/links/link-filters.js +0 -0
- package/dist/lib/links/link-picker-setup.d.ts +29 -0
- package/dist/lib/links/link-picker-setup.js +1 -0
- package/dist/lib/puck/ColourControl.d.ts +4 -1
- package/dist/lib/puck/ColourControl.js +1 -1
- package/dist/lib/puck/add-palette.d.ts +3 -9
- package/dist/lib/puck/add-palette.js +1 -1
- package/dist/lib/puck/add-target-types.d.ts +1 -0
- package/dist/lib/puck/add-target-types.js +0 -0
- package/dist/lib/puck/add-target.d.ts +2 -9
- package/dist/lib/puck/block-choice.d.ts +2 -0
- package/dist/lib/puck/block-choice.js +1 -0
- package/dist/lib/puck/block-offer.js +1 -1
- package/dist/lib/puck/block-types-in.d.ts +1 -1
- package/dist/lib/puck/block-types-in.js +1 -1
- package/dist/lib/puck/blocks/general/index.d.ts +2 -2
- package/dist/lib/puck/content-tree.d.ts +2 -43
- package/dist/lib/puck/content-tree.js +1 -1
- package/dist/lib/puck/controls.d.ts +11 -22
- package/dist/lib/puck/controls.js +1 -1
- package/dist/lib/puck/device-fields.d.ts +2 -24
- package/dist/lib/puck/device-fields.js +1 -1
- package/dist/lib/puck/field-buckets.d.ts +2 -0
- package/dist/lib/puck/field-buckets.js +1 -0
- package/dist/lib/puck/field-groups.d.ts +3 -3
- package/dist/lib/puck/field-groups.js +1 -1
- package/dist/lib/puck/field-markers.d.ts +2 -16
- package/dist/lib/puck/field-markers.js +1 -1
- package/dist/lib/puck/footer-block-row-name.d.ts +4 -0
- package/dist/lib/puck/footer-block-row-name.js +1 -0
- package/dist/lib/puck/footer-blocks.d.ts +2 -10
- package/dist/lib/puck/footer-blocks.js +1 -1
- package/dist/lib/puck/hidable.d.ts +2 -9
- package/dist/lib/puck/hidable.js +1 -1
- package/dist/lib/puck/palette-sections.d.ts +2 -0
- package/dist/lib/puck/palette-sections.js +1 -0
- package/dist/lib/puck/panel-fields.d.ts +2 -12
- package/dist/lib/puck/panel-fields.js +1 -1
- package/dist/lib/puck/panel-no-control-mark.d.ts +2 -7
- package/dist/lib/puck/panel-no-control-mark.js +1 -1
- package/dist/lib/puck/part-id.d.ts +1 -0
- package/dist/lib/puck/part-id.js +1 -0
- package/dist/lib/puck/pinned-seed-gate.d.ts +2 -12
- package/dist/lib/puck/pinned-seed-gate.js +1 -1
- package/dist/lib/puck/preview-click.d.ts +1 -2
- package/dist/lib/puck/preview-click.js +1 -1
- package/dist/lib/puck/preview-dom.d.ts +1 -6
- package/dist/lib/puck/preview-dom.js +1 -1
- package/dist/lib/puck/preview-events.d.ts +2 -0
- package/dist/lib/puck/preview-events.js +1 -0
- package/dist/lib/puck/preview-selection-context.d.ts +2 -19
- package/dist/lib/puck/preview-selection-context.js +1 -1
- package/dist/lib/puck/section-doc.d.ts +1 -5
- package/dist/lib/puck/section-doc.js +1 -1
- package/dist/lib/puck/section-groups.d.ts +1 -1
- package/dist/lib/puck/slot-child-name.d.ts +2 -8
- package/dist/lib/puck/slot-child-name.js +1 -1
- package/dist/lib/puck/slot-heal.d.ts +1 -2
- package/dist/lib/puck/slot-heal.js +1 -1
- package/dist/lib/puck/slot-section-spec.d.ts +1 -0
- package/dist/lib/puck/slot-section-spec.js +0 -0
- package/dist/lib/puck/slot-specs.d.ts +2 -13
- package/dist/lib/puck/style-clipboard.d.ts +1 -19
- package/dist/lib/puck/style-clipboard.js +1 -1
- package/dist/lib/puck/text-control-kinds.d.ts +2 -13
- package/dist/lib/puck/text-control-kinds.js +1 -1
- package/dist/lib/puck/text-parts.d.ts +2 -5
- package/dist/lib/puck/text-parts.js +1 -1
- package/dist/lib/puck/tree-reveal.d.ts +1 -11
- package/dist/lib/puck/tree-reveal.js +1 -1
- package/dist/lib/puck/use-section-ops.d.ts +2 -25
- package/dist/lib/puck/use-section-ops.js +1 -1
- package/dist/lib/reel.d.ts +1 -1
- package/dist/lib/section-template-types.d.ts +1 -21
- package/dist/lib/sections/new-section-node.d.ts +2 -0
- package/dist/lib/sections/new-section-node.js +1 -0
- package/dist/lib/source-rules/accent-token-name.d.ts +20 -0
- package/dist/lib/source-rules/accent-token-name.js +4 -0
- package/dist/lib/source-rules/button-corners.d.ts +13 -0
- package/dist/lib/source-rules/button-corners.js +2 -0
- package/dist/lib/source-rules/editor-chrome-note.d.ts +16 -0
- package/dist/lib/source-rules/editor-chrome-note.js +13 -0
- package/dist/lib/source-rules/editor-context-menu.d.ts +5 -0
- package/dist/lib/source-rules/editor-context-menu.js +4 -0
- package/dist/lib/source-rules/editor-puck-drag-off.d.ts +8 -0
- package/dist/lib/source-rules/editor-puck-drag-off.js +4 -0
- package/dist/lib/source-rules/efficient-easel-version.d.ts +9 -0
- package/dist/lib/source-rules/efficient-easel-version.js +2 -0
- package/dist/lib/source-rules/every-button-follows-the-button-colour.d.ts +12 -0
- package/dist/lib/source-rules/every-button-follows-the-button-colour.js +7 -0
- package/dist/lib/source-rules/flat-theme-palette.d.ts +10 -0
- package/dist/lib/source-rules/flat-theme-palette.js +8 -0
- package/dist/lib/source-rules/full-width-means-full.d.ts +8 -0
- package/dist/lib/source-rules/full-width-means-full.js +2 -0
- package/dist/lib/source-rules/heading-ceiling-sweep.d.ts +11 -0
- package/dist/lib/source-rules/heading-ceiling-sweep.js +8 -0
- package/dist/lib/source-rules/label-hints.d.ts +7 -0
- package/dist/lib/source-rules/label-hints.js +5 -0
- package/dist/lib/source-rules/label-vocabulary.d.ts +14 -0
- package/dist/lib/source-rules/label-vocabulary.js +5 -0
- package/dist/lib/source-rules/mirrored-rows-agree.d.ts +19 -0
- package/dist/lib/source-rules/mirrored-rows-agree.js +10 -0
- package/dist/lib/source-rules/no-comment-in-jsx.d.ts +9 -0
- package/dist/lib/source-rules/no-comment-in-jsx.js +7 -0
- package/dist/lib/source-rules/no-glyph-rows.d.ts +15 -0
- package/dist/lib/source-rules/no-glyph-rows.js +4 -0
- package/dist/lib/source-rules/one-colour-control.d.ts +7 -0
- package/dist/lib/source-rules/one-colour-control.js +2 -0
- package/dist/lib/source-rules/one-dropdown.d.ts +10 -0
- package/dist/lib/source-rules/one-dropdown.js +4 -0
- package/dist/lib/source-rules/one-editable-list.d.ts +16 -0
- package/dist/lib/source-rules/one-editable-list.js +6 -0
- package/dist/lib/source-rules/one-editor-list.d.ts +7 -0
- package/dist/lib/source-rules/one-editor-list.js +3 -0
- package/dist/lib/source-rules/one-right-click.d.ts +10 -0
- package/dist/lib/source-rules/one-right-click.js +2 -0
- package/dist/lib/source-rules/one-switch.d.ts +9 -0
- package/dist/lib/source-rules/one-switch.js +7 -0
- package/dist/lib/source-rules/one-up-level-link.d.ts +16 -0
- package/dist/lib/source-rules/one-up-level-link.js +18 -0
- package/dist/lib/source-rules/panel-colour-tokens.d.ts +48 -0
- package/dist/lib/source-rules/panel-colour-tokens.js +20 -0
- package/dist/lib/source-rules/panel-no-divider-lines.d.ts +14 -0
- package/dist/lib/source-rules/panel-no-divider-lines.js +10 -0
- package/dist/lib/source-rules/panel-one-arrow.d.ts +21 -0
- package/dist/lib/source-rules/panel-one-arrow.js +1 -0
- package/dist/lib/source-rules/panel-one-hover.d.ts +8 -0
- package/dist/lib/source-rules/panel-one-hover.js +2 -0
- package/dist/lib/source-rules/panel-rows-use-the-shared-row.d.ts +23 -0
- package/dist/lib/source-rules/panel-rows-use-the-shared-row.js +22 -0
- package/dist/lib/source-rules/part-slider-fills-row.d.ts +11 -0
- package/dist/lib/source-rules/part-slider-fills-row.js +29 -0
- package/dist/lib/source-rules/part-style-naming.d.ts +10 -0
- package/dist/lib/source-rules/part-style-naming.js +2 -0
- package/dist/lib/source-rules/puck-document-surfaces.d.ts +16 -0
- package/dist/lib/source-rules/puck-document-surfaces.js +8 -0
- package/dist/lib/source-rules/reduced-motion.d.ts +26 -0
- package/dist/lib/source-rules/reduced-motion.js +9 -0
- package/dist/lib/source-rules/route-content-width.d.ts +22 -0
- package/dist/lib/source-rules/route-content-width.js +5 -0
- package/dist/lib/source-rules/rule.d.ts +21 -0
- package/dist/lib/source-rules/rule.js +1 -0
- package/dist/lib/source-rules/section-theme-preview.d.ts +9 -0
- package/dist/lib/source-rules/section-theme-preview.js +8 -0
- package/dist/lib/source-rules/site-gutter.d.ts +6 -0
- package/dist/lib/source-rules/site-gutter.js +4 -0
- package/dist/lib/source-rules/site-square-by-default.d.ts +17 -0
- package/dist/lib/source-rules/site-square-by-default.js +3 -0
- package/dist/lib/source-rules/site-width.d.ts +11 -0
- package/dist/lib/source-rules/site-width.js +7 -0
- package/dist/lib/source-rules/size-token-paints.d.ts +8 -0
- package/dist/lib/source-rules/size-token-paints.js +11 -0
- package/dist/lib/source-rules/social-icons-import.d.ts +6 -0
- package/dist/lib/source-rules/social-icons-import.js +6 -0
- package/dist/lib/source-rules/source-status-is-shared.d.ts +7 -0
- package/dist/lib/source-rules/source-status-is-shared.js +1 -0
- package/dist/lib/source-rules/style-face-matches-size.d.ts +10 -0
- package/dist/lib/source-rules/style-face-matches-size.js +4 -0
- package/dist/lib/source-rules/support/accent-rename-bytes.d.ts +5 -0
- package/dist/lib/source-rules/support/accent-rename-bytes.js +1 -0
- package/dist/lib/source-rules/support/css-box-model.d.ts +5 -0
- package/dist/lib/source-rules/support/css-box-model.js +1 -0
- package/dist/lib/source-rules/support/css-length.d.ts +2 -0
- package/dist/lib/source-rules/support/css-length.js +1 -0
- package/dist/lib/source-rules/support/css-rules.d.ts +12 -0
- package/dist/lib/source-rules/support/css-rules.js +1 -0
- package/dist/lib/source-rules/support/css-source.d.ts +2 -0
- package/dist/lib/source-rules/support/css-source.js +3 -0
- package/dist/lib/source-rules/support/label-extraction.d.ts +14 -0
- package/dist/lib/source-rules/support/label-extraction.js +5 -0
- package/dist/lib/source-rules/support/panel-select-cascade.d.ts +72 -0
- package/dist/lib/source-rules/support/panel-select-cascade.js +2 -0
- package/dist/lib/source-rules/support/part-slider-call-sites.d.ts +9 -0
- package/dist/lib/source-rules/support/part-slider-call-sites.js +17 -0
- package/dist/lib/source-rules/support/registry-source.d.ts +14 -0
- package/dist/lib/source-rules/support/registry-source.js +3 -0
- package/dist/lib/source-rules/support/ts-source.d.ts +2 -0
- package/dist/lib/source-rules/support/ts-source.js +3 -0
- package/dist/lib/source-rules/theme-mode-controls-gone.d.ts +10 -0
- package/dist/lib/source-rules/theme-mode-controls-gone.js +5 -0
- package/dist/lib/source-rules/upload-intake-guard.d.ts +11 -0
- package/dist/lib/source-rules/upload-intake-guard.js +6 -0
- package/dist/lib/source-rules/word-styles.d.ts +8 -0
- package/dist/lib/source-rules/word-styles.js +4 -0
- package/dist/lib/theme-row-persist.js +1 -1
- package/dist/lib/theme-save-message.js +1 -1
- package/dist/lib/web-backend.d.ts +4 -59
- package/dist/lib/web-backend.js +1 -1
- package/dist/lib/website-document-addressing.d.ts +2 -0
- package/dist/lib/website-document-addressing.js +1 -0
- package/dist/lib/website-host-inbound.d.ts +1 -0
- package/dist/lib/website-host-inbound.js +1 -0
- package/dist/lib/website-session.d.ts +5 -0
- package/dist/lib/website-session.js +1 -0
- package/package.json +15 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{ancestorChain as n,EASEL_NODE_CLIPBOARD as s,nodeMenuItems as o,pageMenuItems as u,textMenuItems as I,useNodeContextMenu as D}from"efficient-easel/screen/components/NodeContextMenu";export{s as EDITOR_NODE_CLIPBOARD,n as ancestorChain,o as nodeMenuItems,u as pageMenuItems,I as textMenuItems,D as useNodeContextMenu};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default
|
|
1
|
+
export { default } from "efficient-easel/screen/components/PageEditGuardNotices";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{default as f}from"efficient-easel/screen/components/PageEditGuardNotices";export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{default as f}from"efficient-easel/screen/components/PanelToggleIcon";export{f as default};
|
|
@@ -36,6 +36,11 @@ export declare function partStyleName(props: Record<string, unknown>, propKey: s
|
|
|
36
36
|
faceRole: FontRole;
|
|
37
37
|
base: PartStyleBase;
|
|
38
38
|
} | null, fonts: FontsValue): string | null;
|
|
39
|
+
export declare function PartStyleSelect({ face, base, onPick, }: {
|
|
40
|
+
face: PartFace;
|
|
41
|
+
base: PartStyleBase | null;
|
|
42
|
+
onPick: (role: FontRole | null) => void;
|
|
43
|
+
}): import("react").JSX.Element;
|
|
39
44
|
export declare function PartStyleCard({ parts, onEditStyle, onClearAll, onFollowStyle, kindLabel, }: {
|
|
40
45
|
parts: readonly PanelPart[];
|
|
41
46
|
onEditStyle?: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as r,Fragment as z}from"react/jsx-runtime";import{useEffect as D,useId as Oe,useRef as Y,useState as J}from"react";import{PartResetDot as ce}from"./PartResetDot.js";import{FieldSelect as Ie,InspectorField as _e}from"efficient-easel/fields";import{SettingsField as de,SettingsGroup as Ae}from"efficient-easel/panel";import{StylesIcon as $e,TextColorIcon as Be,TypeIcon as Le}from"efficient-easel/icons";import{useEasel as ze}from"efficient-easel/easel";import{PartInkControl as De}from"./PartInkControl.js";import{PartTextBox as Me}from"./PartTextBox.js";import ue from"./UiIcon.js";import{usePreviewHeader as Ve}from"./PreviewHeaderContext.js";import{usePartStyle as Ge}from"./PreviewPartStyleContext.js";import{TypeGlyph as We,readHidable as M,textFieldOffPage as je}from"../lib/puck/controls.js";import{TEXT_FIELD_MARKER as He}from"../lib/puck/field-markers.js";import{useSectionOps as Ue}from"../lib/puck/use-section-ops.js";import{FONT_OPTIONS as Ke,FONT_ROLES as fe,FONT_ROLE_LABELS as pe,fontOption as V}from"../lib/fonts.js";import{isMultilineKind as Xe,partPlaceholder as qe,typeInPlaceKind as Ye}from"../lib/puck/part-text.js";import{partRowField as Je}from"../lib/puck/part-row-field.js";import{decodePartKey as Qe,partPropsWithRowValue as Ze,partRowValue as et}from"../lib/puck/part-rows.js";import{PART_WIDTH_MAX as tt,propsWithPartStyleValue as Q,propsWithoutPartStyle as nt,readPartStyle as he}from"../lib/puck/part-styles.js";import{partInks as ot}from"../lib/puck/part-inks.js";import{styleKeyForPart as st,TEXT_KIND_LABELS as rt}from"../lib/sections/section-text-kinds.js";import{commitPartText as lt}from"../lib/puck/part-typing.js";import{useEditorHost as it}from"../lib/editor-host.js";import{SOURCE_LINES as at,SOURCE_ACTIONS as ct,SOURCE_ACTION_LABEL as dt,partSourceOf as ut,sourceSlugOf as me}from"../lib/puck/source-bound-parts.js";import{encodePartId as ft,holdsAuthoredText as pt}from"../lib/puck/text-parts.js";import{regionsForSection as ht}from"../lib/sections/section-text-regions.js";import{textRegionOfPartKey as mt}from"../lib/sections/text-regions.js";const yt={400:"Regular",500:"Medium",600:"Semibold",700:"Bold"},ye=[{key:"font",label:"Font",group:"Style"},{key:"color",label:"Color",group:"Style"}],gt=[...new Set(ye.map(t=>t.group))],bt={font:e(Le,{}),color:e(Be,{})};function G(t){return t.kind==="role"?pe[t.role]:t.kind==="custom"?"Custom":null}const xt=t=>t.kind==="role"?`role:${t.role}`:t.kind;function kt(t){const o=t.role;return o&&fe.includes(o)?{kind:"role",role:o}:null}function St(t,o){if(!t)return{kind:"unread"};const{faceRole:s,base:l}=t;if(o[s]===l.fontKey)return{kind:"role",role:s};const c=Object.keys(o).filter(b=>o[b]===l.fontKey);return c.length===1?{kind:"role",role:c[0]}:{kind:"custom"}}function Z(t,o,s,l){return kt(he(t,o))??St(s,l)}function ln(t,o,s,l){return G(Z(t,o,s,l))}function ee(t,o){if(!t.length)return null;const s=o(t[0]);return t.every(l=>o(l)===s)?s:null}function Nt(t){return Object.values(t).filter(o=>o!==void 0).length}function vt(t,o){const s=t.style[o];return o==="color"?s??"":s!==void 0?String(s):t.base.fontKey}function ge({face:t,base:o,onPick:s}){const[l,c]=J(!1),b=Y(null),h=Y(null),m=Oe();D(()=>{if(!l)return;const i=T=>{b.current&&!b.current.contains(T.target)&&c(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[l]);const d=t.kind==="role"?t.role:null,N=i=>{s(i),c(!1),h.current?.focus()};return r("div",{className:"sf-part-style-pick",ref:b,children:[r("button",{ref:h,type:"button",className:"sf-part-style-trigger","aria-expanded":l,"aria-controls":m,"aria-label":`Follows ${G(t)??"no style"} \u2014 change`,onClick:()=>c(i=>!i),onKeyDown:i=>{i.key==="Escape"&&l&&(i.preventDefault(),c(!1))},children:[e("span",{className:"sf-part-style-name",style:{fontFamily:o?.fontKey?`var(${V(o.fontKey)?.cssVar})`:void 0,fontWeight:o?.weight},children:G(t)}),e("span",{className:"sf-part-style-sign","aria-hidden":"true"})]}),l&&r("div",{className:"sf-multi-menu sf-part-style-menu",id:m,role:"listbox",onKeyDown:i=>{i.key==="Escape"&&(i.preventDefault(),c(!1),h.current?.focus())},children:[r("button",{type:"button",role:"option","aria-selected":d===null,className:`sf-part-style-option${d===null?" is-on":""}`,onClick:()=>N(null),children:[e("span",{className:"sf-part-style-option-name",children:"No style"}),e("span",{className:"sf-note",children:"Section\u2019s own"})]}),fe.map(i=>e("button",{type:"button",role:"option","aria-selected":d===i,className:`sf-part-style-option${d===i?" is-on":""}`,onClick:()=>N(i),children:e("span",{className:"sf-part-style-option-name",style:{fontFamily:`var(--font-role-${i})`},children:pe[i]})},i))]})]})}function Pt({parts:t,onEditStyle:o,onClearAll:s,onFollowStyle:l,kindLabel:c}){const h=ee(t,T=>xt(T.face))?t[0].face:null,m=h?G(h):null,d=h&&h.kind!=="unread"?t[0].base:null,N=t.reduce((T,I)=>T+Nt(I.style),0),i=d?V(d.fontKey)?.label:void 0;return r("div",{className:`sf-part-style${N?" has-overrides":""}`,children:[e("div",{className:"sf-part-style-caption",children:"Style"}),t.length>1&&r("div",{className:"sf-part-style-count",children:[t.length," selected"]}),t.length===1&&c&&r("div",{className:"sf-part-style-count",children:[c," \xB7 every row"]}),m&&d?r(z,{children:[l&&h?e(ge,{face:h,base:d,onPick:l}):e("div",{className:"sf-part-style-name",style:{fontFamily:i?`var(${V(d.fontKey)?.cssVar})`:void 0,fontWeight:d.weight},children:m}),e("div",{className:"sf-part-style-meta",children:[i,`${Math.round(d.sizePx)} px`,yt[d.weight]].filter(Boolean).join(" \xB7 ")})]}):e("div",{className:"sf-part-style-name",children:"Mixed styles"}),r("div",{className:"sf-part-style-top",children:[m?N?r(z,{children:[r("span",{className:"sf-part-chip",children:[N," changed"]}),e("button",{type:"button",className:"sf-part-link",onClick:s,children:"Clear"})]}):e("span",{className:"sf-part-style-state",children:"This text follows the site style."}):e("span",{className:"sf-part-style-state",children:"Changes apply to all selected."}),e("span",{className:"sf-part-style-gap"}),m&&o&&e("button",{type:"button",className:"sf-part-link",onClick:o,children:"Edit"})]})]})}function wt({sectionName:t,onBack:o,textEditor:s,styleRow:l,children:c}){return r("div",{className:"sf-part-panel",children:[r("button",{type:"button",className:"sf-part-back",onClick:o,children:[e(W,{}),r("span",{children:["All of ",t]})]}),s,l,c]})}function W(){return e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e("path",{d:"M15 5 8 12l7 7"})})}function be({source:t,slug:o}){const s=it(),l=ct[t],c=!l.needsSlug||!!o;return e("div",{className:"sf-note sf-note--source",children:r("p",{className:"sf-field-hint",children:[at[t],c?r(z,{children:[" ",e("button",{type:"button",className:"sf-source-open",onClick:()=>{l.type==="storefront-editor:open-menus"?s.send(l.type):o&&s.send(l.type,{slug:o})},children:dt})]}):null]})})}const xe=4,Tt=120;function Ct({region:t,sizePx:o,face:s,base:l,onFollowStyle:c,source:b,slug:h,onBack:m}){const d=t.follows;return r("div",{className:"sf-note",children:[e("p",{children:e("strong",{children:t.label})}),r("p",{children:["Its size follows Site styles \u25B8 ",d,o?` \u2014 ${Math.round(o)}px right now`:"","."]}),c?r(z,{children:[e(de,{label:"Style",icon:e($e,{}),children:e(ge,{face:s,base:l,onPick:c})}),r("p",{className:"sf-field-hint",children:["Every ",t.label.toLowerCase()," in this section follows it. The face and the size change; the letter case is the section\u2019s own and stays as it is."]})]}):e("p",{className:"sf-field-hint",children:"Only the size follows a site style. This section sets its own font, weight and letter case."}),b?e(be,{source:b,slug:h}):null,r("button",{type:"button",className:"sf-part-back",onClick:m,children:[e(W,{}),e("span",{children:"Back to the page"})]})]})}function Et({onBack:t}){return r("div",{className:"sf-note",children:[e("p",{children:e("strong",{children:"This part is no longer here."})}),e("p",{children:"The section it belonged to has been changed or removed."}),r("button",{type:"button",className:"sf-part-back",onClick:t,children:[e(W,{}),e("span",{children:"Back to the page"})]})]})}function Rt({onBack:t,partId:o,why:s}){return r("div",{className:"sf-note",children:[e("p",{children:e("strong",{children:"This part's settings did not open."})}),e("p",{children:"The words are still on your page and nothing has been lost. The editor could not work out which control belongs to them, which is a fault on our side. Go back and click the section to open its settings instead."}),e("p",{className:"sf-note-detail",children:r("code",{children:[o," \u2014 ",s]})}),r("button",{type:"button",className:"sf-part-back",onClick:t,children:[e(W,{}),e("span",{children:"Back to the page"})]})]})}function Ft({nodeId:t,propKey:o,onBack:s,onEditStyle:l}){const{getItemById:c,getSelectorForId:b,config:h}=ze(n=>n),m=Ue(),{partStyle:d}=Ge(),{fonts:N}=Ve(),[i,T]=J({}),I=Y(null),y=c(t),x=b(t),te=y?h.components[y.type]:void 0,{key:C,row:v}=Qe(o),ne=te?.fields?.[C],P=v?Je(ne,v):ne,O=ft(t,o),f=y?.props??{},w=Ye(P),ke=je(P),Se=pt(P),j=y?ut(y.type):null,H=v?et(f[C],v):f[C],oe=!!v&&!(Array.isArray(f[C])&&v.index<f[C].length);D(()=>{I.current?.querySelector(".es-copy [contenteditable='true'], .es-copy textarea, .sf-copybox textarea, .sf-copybox input")?.focus()},[O]);const[U,se]=J(0);D(()=>se(0),[O]);const K=!!y&&!oe&&(!x||!P);D(()=>{if(!K||U>=xe)return;const n=setTimeout(()=>se(a=>a+1),Tt);return()=>clearTimeout(n)},[K,U]);const Ne=K&&U<xe;if(!y||oe)return e(Et,{onBack:s});const _=ht(y.type),re=_?mt(_,o):null;if(_&&re){const n=d?.partId===O?d:null,a=_[re],p=a.writable===!0&&!!x,g=u=>{x&&m.replaceComponent(x.zone,x.index,{...y,props:Q(f,o,"role",u)})};return e(Ct,{region:a,sizePx:n?.base.sizePx??null,face:Z(f,o,n,N),base:n?.base??null,onFollowStyle:p?g:void 0,source:j,slug:me(f),onBack:s})}if(!x||!P)return Ne?e("div",{className:"sf-note","aria-busy":"true"}):e(Rt,{onBack:s,partId:O,why:x?"no field":"no selector"});const A=n=>{m.replaceComponent(x.zone,x.index,{...y,props:n})},X=n=>{if(M(n).hidden!==M(H).hidden||!w){const p=v?Ze(f,C,v,n):{...f,[C]:n};p&&A(p);return}lt({node:y,propKey:o,kind:w,zone:x.zone,index:x.index},M(n).text,m.replaceComponent)},ve=H,$=st(y?.type,o),Pe=he(f,$),B=d?.partId===O?d:null,k=[{partKey:$,face:Z(f,$,B,N),sizeGroup:B?.sizeGroup??null,base:B?.base??Ot,style:Pe}],we=ee(k,n=>n.sizeGroup),le=ot(B?.inks),L=(n,a)=>{let p=f;for(const g of k)p=Q(p,g.partKey,n,a);A(p)},Te=n=>L("role",n),Ce=()=>{let n=f;for(const a of k)n=nt(n,a.partKey);A(n)},Ee=n=>{let a=f;for(const p of k)for(const[g,u]of Object.entries(n))a=Q(a,p.partKey,g,u??null);A(a)},Re=(n,a)=>{const p=k.some(S=>S.style[n]!==void 0),g=ee(k,S=>vt(S,n)),u=g===null,F=`sf-part-${t}-${o}-${n}`;return n==="color"?e(De,{value:u?null:String(g),label:a,colors:le,onChange:S=>L("color",S)},n):e(de,{label:a,icon:bt[n],className:"sf-part-field",changed:p,htmlFor:F,action:p?e(ce,{label:a,onClear:()=>L(n,null)}):void 0,children:n==="font"?e(Ie,{id:F,ariaLabel:a,value:!u&&V(String(g))?String(g):void 0,placeholder:u?"Mixed":"Site style",options:Ke.map(S=>({label:S.label,value:S.key})),onChange:S=>L("font",S||null)}):null},n)},ie=w==="text"||w==="textarea",{text:ae,hidden:E}=M(H),R=P?.[He]?.label??o,Fe=r("div",{className:"sf-field-head",children:[e(We,{}),e("span",{className:"sf-field-label sf-field-label--inline",children:R}),ie&&e("button",{type:"button",className:"sf-field-eye","aria-pressed":E,"aria-label":E?`Show ${R} on the slide`:`Hide ${R} on the slide`,title:E?`Show ${R} on the slide`:`Hide ${R} on the slide`,onClick:()=>X({text:ae,hidden:!E}),children:E?e(ue,{name:"eye-off",size:14}):e(ue,{name:"eye",size:14})})]}),q=!ke&&Se;return r(wt,{sectionName:te?.label??y.type,onBack:s,textEditor:r("div",{ref:I,className:"sf-part-text",children:[w?e(Me,{text:ae,onTextChange:n=>X(ie?{text:n,hidden:E}:n),multiline:Xe(w),markup:w!=="plainText",styled:q,style:k[0].style,base:k[0].base,setValue:Ee,colors:le.map(n=>({name:n.key,label:n.name,value:n.value})),placeholder:qe(P),ariaLabel:R,head:Fe}):e(_e,{field:P,name:o,value:ve,onChange:X,id:`sf-part-${t}-${o}`}),q&&w&&we===null&&e("p",{className:"sf-field-hint",children:"Fixed size \u2014 the site\u2019s Text setting doesn\u2019t resize this."})]}),children:[j&&e(be,{source:j,slug:me(f)}),q&>.map(n=>{const a=ye.filter(u=>u.group===n),p=a.filter(u=>k.some(F=>F.style[u.key]!==void 0)).length,g=`sf-part-g-${t}-${o}-${n.replace(/\W+/g,"-")}`;return r(Ae,{id:g,title:n,open:i[n]!==!0,onToggle:u=>T(F=>({...F,[n]:!u})),count:p,children:[e(Pt,{parts:k,onEditStyle:l,onClearAll:Ce,onFollowStyle:Te,kindLabel:rt[$]}),a.map(u=>Re(u.key,u.label))]},n)})]})}const Ot={fontKey:"",sizePx:16,weight:400,lineRatio:1.4,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:tt};export{ye as PART_FIELDS,wt as PartPanelBody,ce as PartResetDot,be as PartSourceNote,Pt as PartStyleCard,Ft as default,Z as partFace,ln as partStyleName};
|
|
1
|
+
"use client";import{jsx as t,jsxs as r,Fragment as O}from"react/jsx-runtime";import{useEffect as M,useId as _e,useRef as J,useState as Q}from"react";import{PartResetDot as fe}from"./PartResetDot.js";import{FieldSelect as pe,InspectorField as $e}from"efficient-easel/fields";import{SettingsField as me,SettingsGroup as Ae}from"efficient-easel/panel";import{InspectorUpLevel as G}from"efficient-easel/chrome";import{StylesIcon as Le,TextColorIcon as ze,TypeIcon as he}from"efficient-easel/icons";import{useEasel as Be}from"efficient-easel/easel";import{PartInkControl as De}from"./PartInkControl.js";import{PartTextBox as Ve}from"./PartTextBox.js";import ye from"./UiIcon.js";import{usePreviewHeader as Me}from"./PreviewHeaderContext.js";import{usePartStyle as Ge}from"./PreviewPartStyleContext.js";import{readHidable as W,textFieldOffPage as We}from"../lib/puck/controls.js";import{TEXT_FIELD_MARKER as je}from"../lib/puck/field-markers.js";import{useSectionOps as He}from"../lib/puck/use-section-ops.js";import{FONT_OPTIONS as Ue,FONT_ROLES as Z,FONT_ROLE_LABELS as ee,fontOption as _}from"../lib/fonts.js";import{isMultilineKind as Ke,partPlaceholder as Xe,typeInPlaceKind as Ye}from"../lib/puck/part-text.js";import{partRowField as qe}from"../lib/puck/part-row-field.js";import{decodePartKey as Je,partPropsWithRowValue as Qe,partRowValue as Ze}from"../lib/puck/part-rows.js";import{PART_WIDTH_MAX as et,propsWithPartStyleValue as te,propsWithoutPartStyle as tt,readPartStyle as ge}from"../lib/puck/part-styles.js";import{partInks as nt}from"../lib/puck/part-inks.js";import{styleKeyForPart as ot,TEXT_KIND_LABELS as st}from"../lib/sections/section-text-kinds.js";import{commitPartText as lt}from"../lib/puck/part-typing.js";import{useEditorHost as rt}from"../lib/editor-host.js";import{SOURCE_LINES as it,SOURCE_ACTIONS as at,SOURCE_ACTION_LABEL as ct,partSourceOf as dt,sourceSlugOf as be}from"../lib/puck/source-bound-parts.js";import{encodePartId as ut,holdsAuthoredText as ft}from"../lib/puck/text-parts.js";import{regionsForSection as pt}from"../lib/sections/section-text-regions.js";import{textRegionOfPartKey as mt}from"../lib/sections/text-regions.js";const ht={400:"Regular",500:"Medium",600:"Semibold",700:"Bold"},Se=[{key:"font",label:"Font",group:"Style"},{key:"color",label:"Color",group:"Style"}],yt=[...new Set(Se.map(e=>e.group))],gt={font:t(he,{}),color:t(ze,{})};function $(e){return e.kind==="role"?ee[e.role]:e.kind==="custom"?"Custom":null}const bt=e=>e.kind==="role"?`role:${e.role}`:e.kind;function St(e){const n=e.role;return n&&Z.includes(n)?{kind:"role",role:n}:null}function xt(e,n){if(!e)return{kind:"unread"};const{faceRole:s,base:l}=e;if(n[s]===l.fontKey)return{kind:"role",role:s};const a=Object.keys(n).filter(c=>n[c]===l.fontKey);return a.length===1?{kind:"role",role:a[0]}:{kind:"custom"}}function ne(e,n,s,l){return St(ge(e,n))??xt(s,l)}function cn(e,n,s,l){return $(ne(e,n,s,l))}function oe(e,n){if(!e.length)return null;const s=n(e[0]);return e.every(l=>n(l)===s)?s:null}function Nt(e){return Object.values(e).filter(n=>n!==void 0).length}function vt(e,n){const s=e.style[n];return n==="color"?s??"":s!==void 0?String(s):e.base.fontKey}function Pt({face:e,base:n,onPick:s}){const[l,a]=Q(!1),c=J(null),h=J(null),y=_e();M(()=>{if(!l)return;const i=T=>{c.current&&!c.current.contains(T.target)&&a(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[l]);const u=e.kind==="role"?e.role:null,v=i=>{s(i),a(!1),h.current?.focus()};return r("div",{className:"sf-part-style-pick",ref:c,children:[r("button",{ref:h,type:"button",className:"sf-part-style-trigger","aria-expanded":l,"aria-controls":y,"aria-label":`Follows ${$(e)??"no style"} \u2014 change`,onClick:()=>a(i=>!i),onKeyDown:i=>{i.key==="Escape"&&l&&(i.preventDefault(),a(!1))},children:[t("span",{className:"sf-part-style-name",style:{fontFamily:n?.fontKey?`var(${_(n.fontKey)?.cssVar})`:void 0,fontWeight:n?.weight},children:$(e)}),t("span",{className:"sf-part-style-sign","aria-hidden":"true"})]}),l&&r("div",{className:"sf-multi-menu sf-part-style-menu",id:y,role:"listbox",onKeyDown:i=>{i.key==="Escape"&&(i.preventDefault(),a(!1),h.current?.focus())},children:[r("button",{type:"button",role:"option","aria-selected":u===null,className:`sf-part-style-option${u===null?" is-on":""}`,onClick:()=>v(null),children:[t("span",{className:"sf-part-style-option-name",children:"No style"}),t("span",{className:"sf-note",children:"Section\u2019s own"})]}),Z.map(i=>t("button",{type:"button",role:"option","aria-selected":u===i,className:`sf-part-style-option${u===i?" is-on":""}`,onClick:()=>v(i),children:t("span",{className:"sf-part-style-option-name",style:{fontFamily:`var(--font-role-${i})`},children:ee[i]})},i))]})]})}const j="";function kt({face:e,base:n,onPick:s}){const l=e.kind==="role"?e.role:j,a=[{label:"No style",value:j},...Z.map(c=>({label:ee[c],value:c}))];return t(pe,{ariaLabel:"Style",value:l,options:a,inline:!0,onChange:c=>s(c===j?null:c),renderOption:c=>c.value===j?r(O,{children:[t("span",{className:"es-fsel-label sf-part-style-keep",children:c.label}),t("span",{className:"sf-part-style-aside","aria-hidden":"true",children:"Section\u2019s own"})]}):t("span",{className:"es-fsel-label",style:{fontFamily:`var(--font-role-${c.value})`},children:c.label}),renderValue:()=>t("span",{style:{fontFamily:n?.fontKey?`var(${_(n.fontKey)?.cssVar})`:void 0,fontWeight:n?.weight},children:$(e)})})}function wt({parts:e,onEditStyle:n,onClearAll:s,onFollowStyle:l,kindLabel:a}){const h=oe(e,T=>bt(T.face))?e[0].face:null,y=h?$(h):null,u=h&&h.kind!=="unread"?e[0].base:null,v=e.reduce((T,A)=>T+Nt(A.style),0),i=u?_(u.fontKey)?.label:void 0;return r("div",{className:`sf-part-style${v?" has-overrides":""}`,children:[t("div",{className:"sf-part-style-caption",children:"Style"}),e.length>1&&r("div",{className:"sf-part-style-count",children:[e.length," selected"]}),e.length===1&&a&&r("div",{className:"sf-part-style-count",children:[a," \xB7 every row"]}),y&&u?r(O,{children:[l&&h?t(Pt,{face:h,base:u,onPick:l}):t("div",{className:"sf-part-style-name",style:{fontFamily:i?`var(${_(u.fontKey)?.cssVar})`:void 0,fontWeight:u.weight},children:y}),t("div",{className:"sf-part-style-meta",children:[i,`${Math.round(u.sizePx)} px`,ht[u.weight]].filter(Boolean).join(" \xB7 ")})]}):t("div",{className:"sf-part-style-name",children:"Mixed styles"}),r("div",{className:"sf-part-style-top",children:[y?v?r(O,{children:[r("span",{className:"sf-part-chip",children:[v," changed"]}),t("button",{type:"button",className:"sf-part-link",onClick:s,children:"Clear"})]}):t("span",{className:"sf-part-style-state",children:"This text follows the site style."}):t("span",{className:"sf-part-style-state",children:"Changes apply to all selected."}),t("span",{className:"sf-part-style-gap"}),y&&n&&t("button",{type:"button",className:"sf-part-link",onClick:n,children:"Edit"})]})]})}function Tt({sectionName:e,onBack:n,textEditor:s,styleRow:l,children:a}){return r("div",{className:"sf-part-panel",children:[t(G,{inline:!0,name:e,onSelect:n}),s,l,a]})}function xe({source:e,slug:n}){const s=rt(),l=at[e],a=!l.needsSlug||!!n;return t("div",{className:"sf-note sf-note--source",children:r("p",{className:"es-field-hint sf-hint-keep",children:[it[e],a?r(O,{children:[" ",t("button",{type:"button",className:"sf-source-open",onClick:()=>{l.type==="storefront-editor:open-menus"?s.send(l.type):n&&s.send(l.type,{slug:n})},children:ct})]}):null]})})}const Ne=4,Et=120;function Rt({region:e,sizePx:n,face:s,base:l,onFollowStyle:a,source:c,slug:h,onBack:y}){const u=e.follows;return r("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:e.label})}),r("p",{children:["Its size follows Site styles \u25B8 ",u,n?` \u2014 ${Math.round(n)}px right now`:"","."]}),a?t(O,{children:t(me,{label:"Style",icon:t(Le,{}),hint:r(O,{children:["Every ",e.label.toLowerCase()," in this section follows it. The face and the size change; the letter case is the section\u2019s own and stays as it is."]}),children:t(kt,{face:s,base:l,onPick:a})})}):t("p",{className:"es-field-hint sf-hint-keep",children:"Only the size follows a site style. This section sets its own font, weight and letter case."}),c?t(xe,{source:c,slug:h}):null,t(G,{inline:!0,name:"Page",onSelect:y})]})}function Ct({onBack:e}){return r("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:"This part is no longer here."})}),t("p",{children:"The section it belonged to has been changed or removed."}),t(G,{inline:!0,name:"Page",onSelect:e})]})}function Ft({onBack:e,partId:n,why:s}){return r("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:"This part's settings did not open."})}),t("p",{children:"The words are still on your page and nothing has been lost. The editor could not work out which control belongs to them, which is a fault on our side. Go back and click the section to open its settings instead."}),t("p",{className:"sf-note-detail",children:r("code",{children:[n," \u2014 ",s]})}),t(G,{inline:!0,name:"Page",onSelect:e})]})}function Ot({nodeId:e,propKey:n,onBack:s,onEditStyle:l}){const{getItemById:a,getSelectorForId:c,config:h}=Be(o=>o),y=He(),{partStyle:u}=Ge(),{fonts:v}=Me(),[i,T]=Q({}),A=J(null),g=a(e),S=c(e),se=g?h.components[g.type]:void 0,{key:E,row:P}=Je(n),le=se?.fields?.[E],k=P?qe(le,P):le,I=ut(e,n),p=g?.props??{},w=Ye(k),ve=We(k),Pe=ft(k),H=g?dt(g.type):null,U=P?Ze(p[E],P):p[E],re=!!P&&!(Array.isArray(p[E])&&P.index<p[E].length);M(()=>{A.current?.querySelector(".es-copy [contenteditable='true'], .es-copy textarea, .sf-copybox textarea, .sf-copybox input")?.focus()},[I]);const[K,ie]=Q(0);M(()=>ie(0),[I]);const X=!!g&&!re&&(!S||!k);M(()=>{if(!X||K>=Ne)return;const o=setTimeout(()=>ie(d=>d+1),Et);return()=>clearTimeout(o)},[X,K]);const ke=X&&K<Ne;if(!g||re)return t(Ct,{onBack:s});const L=pt(g.type),ae=L?mt(L,n):null;if(L&&ae){const o=u?.partId===I?u:null,d=L[ae],m=d.writable===!0&&!!S,b=f=>{S&&y.replaceComponent(S.zone,S.index,{...g,props:te(p,n,"role",f)})};return t(Rt,{region:d,sizePx:o?.base.sizePx??null,face:ne(p,n,o,v),base:o?.base??null,onFollowStyle:m?b:void 0,source:H,slug:be(p),onBack:s})}if(!S||!k)return ke?t("div",{className:"sf-note","aria-busy":"true"}):t(Ft,{onBack:s,partId:I,why:S?"no field":"no selector"});const z=o=>{y.replaceComponent(S.zone,S.index,{...g,props:o})},Y=o=>{if(W(o).hidden!==W(U).hidden||!w){const m=P?Qe(p,E,P,o):{...p,[E]:o};m&&z(m);return}lt({node:g,propKey:n,kind:w,zone:S.zone,index:S.index},W(o).text,y.replaceComponent)},we=U,B=ot(g?.type,n),Te=ge(p,B),D=u?.partId===I?u:null,x=[{partKey:B,face:ne(p,B,D,v),sizeGroup:D?.sizeGroup??null,base:D?.base??It,style:Te}],Ee=oe(x,o=>o.sizeGroup),ce=nt(D?.inks),V=(o,d)=>{let m=p;for(const b of x)m=te(m,b.partKey,o,d);z(m)},Re=o=>V("role",o),Ce=()=>{let o=p;for(const d of x)o=tt(o,d.partKey);z(o)},Fe=o=>{let d=p;for(const m of x)for(const[b,f]of Object.entries(o))d=te(d,m.partKey,b,f??null);z(d)},Oe=(o,d)=>{const m=x.some(N=>N.style[o]!==void 0),b=oe(x,N=>vt(N,o)),f=b===null,F=`sf-part-${e}-${n}-${o}`;return o==="color"?t(De,{value:f?null:String(b),label:d,colors:ce,onChange:N=>V("color",N)},o):t(me,{label:d,icon:gt[o],className:"sf-part-field",changed:m,htmlFor:F,action:m?t(fe,{label:d,onClear:()=>V(o,null)}):void 0,children:o==="font"?t(pe,{id:F,ariaLabel:d,value:!f&&_(String(b))?String(b):void 0,placeholder:f?"Mixed":"Site style",options:Ue.map(N=>({label:N.label,value:N.key})),onChange:N=>V("font",N||null)}):null},o)},de=w==="text"||w==="textarea",{text:ue,hidden:R}=W(U),C=k?.[je]?.label??n,Ie=r("div",{className:"sf-field-head",children:[t(he,{}),t("span",{className:"sf-field-label sf-field-label--inline",children:C}),de&&t("button",{type:"button",className:"sf-field-eye","aria-pressed":R,"aria-label":R?`Show ${C} on the slide`:`Hide ${C} on the slide`,title:R?`Show ${C} on the slide`:`Hide ${C} on the slide`,onClick:()=>Y({text:ue,hidden:!R}),children:R?t(ye,{name:"eye-off",size:14}):t(ye,{name:"eye",size:14})})]}),q=!ve&&Pe;return r(Tt,{sectionName:se?.label??g.type,onBack:s,textEditor:r("div",{ref:A,className:"sf-part-text",children:[w?t(Ve,{text:ue,onTextChange:o=>Y(de?{text:o,hidden:R}:o),multiline:Ke(w),markup:w!=="plainText",styled:q,style:x[0].style,base:x[0].base,setValue:Fe,colors:ce.map(o=>({name:o.key,label:o.name,value:o.value})),placeholder:Xe(k),ariaLabel:C,head:Ie}):t($e,{field:k,name:n,value:we,onChange:Y,id:`sf-part-${e}-${n}`}),q&&w&&Ee===null&&t("p",{className:"es-field-hint sf-hint-keep",children:"Fixed size \u2014 the site\u2019s Text setting doesn\u2019t resize this."})]}),children:[H&&t(xe,{source:H,slug:be(p)}),q&&yt.map(o=>{const d=Se.filter(f=>f.group===o),m=d.filter(f=>x.some(F=>F.style[f.key]!==void 0)).length,b=`sf-part-g-${e}-${n}-${o.replace(/\W+/g,"-")}`;return r(Ae,{id:b,title:o,open:i[o]!==!0,onToggle:f=>T(F=>({...F,[o]:!f})),count:m,children:[t(wt,{parts:x,onEditStyle:l,onClearAll:Ce,onFollowStyle:Re,kindLabel:st[B]}),d.map(f=>Oe(f.key,f.label))]},o)})]})}const It={fontKey:"",sizePx:16,weight:400,lineRatio:1.4,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:et};export{Se as PART_FIELDS,Tt as PartPanelBody,fe as PartResetDot,xe as PartSourceNote,wt as PartStyleCard,kt as PartStyleSelect,Ot as default,ne as partFace,cn as partStyleName};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t}from"react/jsx-runtime";import{
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import{SettingsDefaultReset as c,SettingsField as h,SettingsSegmented as d}from"efficient-easel/panel";import{DropIcon as f}from"efficient-easel/icons";const a="Photography",l=[{grayscale:!1,label:"As shot"},{grayscale:!0,label:"Black and white"}],g="Black and white photographs return to color on hover. Wheels and tyres keep their real finish either way.";function p({value:n,onChange:o,showHint:i=!0}){const r=n===null,s=n??!1;return t(h,{label:a,icon:t(f,{}),value:l.find(e=>e.grayscale===s).label,changed:!r,action:t(c,{label:a,changed:!r,detail:l.find(e=>!e.grayscale).label,onReset:()=>o(null)}),hint:i?g:void 0,children:t(d,{options:l.map(e=>({id:e.grayscale,label:e.label})),value:s,ariaLabel:a,onChange:o})})}export{a as SITE_PHOTOGRAPHY_LABEL,p as default};
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export type PreviewDevice
|
|
3
|
-
export declare const PreviewDeviceContext: import("react").Context<ViewTier>;
|
|
4
|
-
export declare const usePreviewDevice: () => PreviewDevice;
|
|
1
|
+
export { PreviewDeviceContext, usePreviewDevice } from "efficient-easel/screen/components/PreviewDeviceContext";
|
|
2
|
+
export type { PreviewDevice } from "efficient-easel/screen/components/PreviewDeviceContext";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{PreviewDeviceContext as r,usePreviewDevice as t}from"efficient-easel/screen/components/PreviewDeviceContext";export{r as PreviewDeviceContext,t as usePreviewDevice};
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
children: import("react").ReactNode;
|
|
3
|
-
}) => import("react").JSX.Element, usePreviewParts: () => import("../lib/puck/preview-selection-context.js").PreviewIdSelection<"selectedPartId">;
|
|
1
|
+
export { PreviewPartsProvider, usePreviewParts } from "efficient-easel/screen/components/PreviewPartsContext";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{PreviewPartsProvider as P,usePreviewParts as i}from"efficient-easel/screen/components/PreviewPartsContext";export{P as PreviewPartsProvider,i as usePreviewParts};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
1
2
|
import { type FieldOption } from "efficient-easel/fields";
|
|
2
3
|
export interface SearchSelectOption {
|
|
3
4
|
value: string;
|
|
@@ -15,6 +16,7 @@ interface Props {
|
|
|
15
16
|
onChange: (value: string) => void;
|
|
16
17
|
placeholder?: string;
|
|
17
18
|
bare?: boolean;
|
|
19
|
+
icon?: ReactNode;
|
|
18
20
|
}
|
|
19
|
-
export default function SearchSelectField({ label, options, fallback, value, onChange, placeholder, bare, }: Props): import("react").JSX.Element;
|
|
21
|
+
export default function SearchSelectField({ label, options, fallback, value, onChange, placeholder, bare, icon, }: Props): import("react").JSX.Element;
|
|
20
22
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as f
|
|
1
|
+
"use client";import{jsx as f}from"react/jsx-runtime";import{useId as b}from"react";import{FieldSelect as S}from"efficient-easel/fields";import{SettingsField as x}from"efficient-easel/panel";function I(n){return n.map(({value:t,label:l,group:o,thumb:r,meta:e})=>({value:t,label:l,...o!==void 0?{group:o}:{},...r!==void 0?{thumb:r}:{},...e!==void 0?{meta:e}:{}}))}function $({label:n,options:t,fallback:l,value:o,onChange:r,placeholder:e,bare:i=!1,icon:m}){const c=b(),a=`${c}-label`,d=`${c}-button`,s=o??"",p=t.some(h=>h.value===s)?s:l,u=f(S,{id:d,value:p,options:I(t),onChange:r,placeholder:e,searchPlaceholder:e,...i?{ariaLabel:n}:{ariaLabelledBy:`${a} ${d}`},searchable:!0,groupCount:!0,inline:!0});return i?u:f(x,{label:n,labelId:a,icon:m,children:u})}export{$ as default,I as searchSelectOptions};
|
|
@@ -2,6 +2,7 @@ import type { SendToHost } from "../lib/editor-host.js";
|
|
|
2
2
|
import type { ReactNode, RefObject } from "react";
|
|
3
3
|
import type { EditorChrome } from "../lib/editor-chrome.js";
|
|
4
4
|
import type { EditorCapabilities } from "../lib/editor-document-adapter.js";
|
|
5
|
+
import { type ScreenPartMode } from "../lib/editor-screen.js";
|
|
5
6
|
export type InspectorMode = {
|
|
6
7
|
kind: "puck";
|
|
7
8
|
} | {
|
|
@@ -15,11 +16,7 @@ export type InspectorMode = {
|
|
|
15
16
|
} | {
|
|
16
17
|
kind: "ticker";
|
|
17
18
|
heroId: string;
|
|
18
|
-
} |
|
|
19
|
-
kind: "part";
|
|
20
|
-
nodeId: string;
|
|
21
|
-
propKey: string;
|
|
22
|
-
};
|
|
19
|
+
} | ScreenPartMode;
|
|
23
20
|
export declare const PUCK_MODE: InspectorMode;
|
|
24
21
|
export declare const HEADER_MODE: InspectorMode;
|
|
25
22
|
export declare const WEBSITE_MODE: InspectorMode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsxs as l,jsx as n,Fragment as w}from"react/jsx-runtime";import{useState as ce}from"react";import{useEasel as de}from"efficient-easel/easel";import{InspectorHead as me,InspectorIconButton as F}from"efficient-easel/chrome";import{DuplicateIcon as fe,TrashIcon as ue}from"efficient-easel/icons";import{panelFieldsOf as he}from"../lib/puck/panel-fields.js";import{TICKER_PART_LABEL as x}from"./PreviewTickerContext.js";import Se from"./SectionIcon.js";import{PanelHideButton as B}from"./SidePanelHead.js";import{useEditorSession as be}from"../lib/editor-session-context.js";import
|
|
1
|
+
"use client";import{jsxs as l,jsx as n,Fragment as w}from"react/jsx-runtime";import{useState as ce}from"react";import{useEasel as de}from"efficient-easel/easel";import{InspectorHead as me,InspectorIconButton as F}from"efficient-easel/chrome";import{DuplicateIcon as fe,TrashIcon as ue}from"efficient-easel/icons";import{panelFieldsOf as he}from"../lib/puck/panel-fields.js";import{TICKER_PART_LABEL as x}from"./PreviewTickerContext.js";import Se from"./SectionIcon.js";import{PanelHideButton as B}from"./SidePanelHead.js";import{useEditorSession as be}from"../lib/editor-session-context.js";import ge,{HintsToggle as ke,SHOW_HINTS_DEFAULT as we}from"./WebsiteSettingsPanel.js";import ve from"./ChatSettingsPanel.js";import Pe from"./SocialLinksPanel.js";import ye from"./TickerSettingsPanel.js";import Ie,{PartSourceNote as Ee,partStyleName as Te}from"./PartSettingsPanel.js";import Le from"./DuplicateToPageMenu.js";import{useStorefrontDocument as Ne}from"./StorefrontDocumentContext.js";import{usePreviewHeader as Oe}from"./PreviewHeaderContext.js";import{usePartStyle as He}from"./PreviewPartStyleContext.js";import{useSectionOps as _e}from"../lib/puck/use-section-ops.js";import{SELECTION_MODE as Re}from"../lib/editor-screen.js";import{usePreviewParts as Ce}from"./PreviewPartsContext.js";import{SectionTextEntries as De}from"./SectionTextEntries.js";import{SectionTextSuppressProvider as Ae}from"../lib/puck/section-text-suppress.js";import{HEADER_TYPE as Fe,ROOT_ZONE as z}from"../lib/puck/content-tree.js";import{duplicateBlocked as xe}from"../lib/hero-group-placement.js";import{FOOTER_TYPE as v}from"../lib/puck/footer-blocks.js";import Be from"./SwitchToBoxFooter.js";import{SiteFields as K}from"./SiteFields.js";import{SITE_FOOTER_SLUG as ze}from"../lib/content/footer.js";import{SettingsSwitch as Ke}from"efficient-easel/panel";import{foldTopTier as Me}from"../lib/puck/field-groups.js";import{FoldHeadingScope as We}from"../lib/puck/panel-heading-scope.js";import{partRowField as $e}from"../lib/puck/part-row-field.js";import{decodePartKey as je,partRowHeadLabel as Ue}from"../lib/puck/part-rows.js";import{encodePartId as M,partHeadLabel as Ye,partLabel as Ge,sectionTextParts as Ze}from"../lib/puck/text-parts.js";import{partSourceOf as qe,sourceSlugOf as Je}from"../lib/puck/source-bound-parts.js";const Kt=Re,Mt={kind:"header"},Wt={kind:"website"},$t={kind:"chat"},jt={kind:"social"},f="Part";function Qe(t,o,i){const p=t.describeNode(o);return{name:i,kindLabel:p?`${f} of ${p.label}`:f}}function W({what:t}){return l("div",{className:"sf-note",children:[n("p",{children:l("strong",{children:[t," settings belong to a website."]})}),l("p",{children:["A template is a blueprint \u2014 it has no website of its own, so there is nothing here to change. Each website created from this template sets its own ",t.toLowerCase()," afterwards."]})]})}const Ve={header:{name:"Header",kindLabel:"Site settings",icon:"header",render:(t,o)=>{const i=o.hostPanels?.header;return i?n(i,{placeholderMode:o.capabilities.placeholderFrames,tokenRef:o.tokenRef,siteId:o.siteId,websiteName:o.websiteName,onOpenWebsiteSettings:o.onOpenWebsiteSettings,onAuthExpired:()=>o.notifyParent("storefront-editor:auth-expired")}):null}},website:{name:"Appearance",kindLabel:"Site settings",icon:"website",render:(t,o)=>n(ge,{themeFromDocument:!o.capabilities.hasSiteTheme,tokenRef:o.tokenRef,siteId:o.siteId,onNotify:o.onNotify})},chat:{name:"Live chat",kindLabel:"Site settings",icon:"chat",render:()=>n(ve,{})},social:{name:"Social links",kindLabel:"Site settings",icon:"social",render:()=>n(Pe,{unavailable:n(W,{what:"Social link"})})},ticker:{name:x,kindLabel:f,icon:"ticker",head:(t,o)=>t.kind==="ticker"?Qe(o,t.heroId,x):null,render:t=>n(ye,{heroId:t.kind==="ticker"?t.heroId:""})},part:{name:f,kindLabel:f,icon:"Text",head:(t,o)=>{if(t.kind!=="part")return null;const i=o.describeNode(t.nodeId);if(!i)return null;const{key:p,row:u}=je(t.propKey),b=u?$e(i.fields[p],u):i.fields[p],m=Ue(Ye(Ge(b??{},p)),u);return{name:o.styleNameOfPart(t.nodeId,t.propKey)??m,kindLabel:`${f} of ${i.label}`}},render:(t,o)=>t.kind==="part"?n(Ie,{nodeId:t.nodeId,propKey:t.propKey,onBack:()=>o.onSelectNode(t.nodeId),onEditStyle:o.onOpenSiteStyles}):null}},Xe=new Set(["header","website","chat"]);function et(t,o){if(t==="puck")return null;const i=Ve[t];return Xe.has(t)&&!o.hasSiteSettings?{...i,kindLabel:"Not part of a template",render:()=>n(W,{what:i.name})}:i}function tt({mode:t,onOpenWebsiteSettings:o,onOpenSiteStyles:i,onSelectNode:p,hideNodeActions:u=!1,onNotify:b,onHidePanel:m}){const{capabilities:h,tokenRef:P,notifyParent:$,currentSlug:y,siteId:I,runAuthed:j}=Ne(),{websiteName:U,fonts:Y}=Oe(),{partStyle:E}=He(),g=_e(),{select:G}=Ce(),{selectedItem:e,getItemById:T,getSelectorForId:Z,config:c,appState:q}=de(a=>a),J=he(c,e?{type:e.type,props:e.props}:null),Q=a=>c.components[a]?.label??a,r=e?Z(e.props.id):void 0,s=et(t.kind,h),L=be(),N=L.chrome?.panels?.chromePage,O={capabilities:h,tokenRef:P,hostPanels:L.chrome?.panels,describeNode:a=>{const d=T(a);if(!d)return null;const S=c.components[d.type];return{type:d.type,label:S?.label??d.type,fields:S?.fields??{}}},styleNameOfPart:(a,d)=>{const S=T(a);if(!S)return null;const le=M(a,d),pe=E?.partId===le?E:null;return Te(S.props,d,pe,Y)},siteId:I,websiteName:U??null,notifyParent:$,onNotify:b,onOpenWebsiteSettings:o,onOpenSiteStyles:i,onSelectNode:p},H=s?.head?.(t,O)??null,V=H?.name??(s?s.name:e?Q(e.type):"Page settings"),X=H?.kindLabel??(s?s.kindLabel:e?r&&r.zone!==z?"Block":"Section":"Page"),ee=s?s.icon:e?e.type:"page",_=s?null:e?c.components[e.type]?.fields??null:c.root?.fields??null,te=_?Me(_):2,R=t.kind==="puck"&&e?qe(e.type):null,ne=!!e&&!!r&&r.zone===z&&e.type!==v&&e.type!==Fe,k=xe(q?.data,e),oe=()=>{k||r&&g.duplicateComponent(r.zone,r.index)},ie=()=>{r&&(g.removeComponent(r.zone,r.index),g.select(null))},re=e?c.components[e.type]?.defaultProps?.previewHover:void 0,C=t.kind==="puck"&&!!e&&!!r&&re!==void 0,D=C&&e.props.previewHover===!0,se=()=>{!e||!r||g.replaceComponent(r.zone,r.index,{...e,props:{...e.props,previewHover:!D}})},[A,ae]=ce(we);return l("div",{className:`es-sidepanel es-sidepanel--right sf-panel sf-panel--right${A||!(!s&&!!e)?"":" sf-hints-folded"}`,children:[n(me,{icon:n(Se,{type:ee,size:15}),name:V,kind:X,actions:!u&&t.kind==="puck"&&e&&e.type!==v?l(w,{children:[n(F,{label:"Duplicate section",title:k??void 0,disabled:k!==null,onClick:oe,children:n(fe,{size:15})}),ne&&h.hasSiteSettings&&n(Le,{node:e,currentSlug:y,siteId:I??void 0,tokenRef:P,runAuthed:j,onNotify:b}),n(F,{label:"Remove section",danger:!0,onClick:ie,children:n(ue,{size:15})}),m?n(B,{side:"right",onHide:m,divider:!0}):null]}):m?n(B,{side:"right",onHide:m}):void 0}),C&&l("div",{className:"sf-preview-pin",children:[l("div",{className:"sf-preview-pin-text",children:[n("span",{className:"sf-preview-pin-label",children:"Preview hover state"}),n("span",{className:"sf-preview-pin-hint",children:"not shown live"})]}),n(Ke,{checked:D,onChange:se,ariaLabel:"Preview hover state"})]}),n(We,{tier:te,children:n("div",{className:"sf-insp-body sf-scroll",children:s?s.render(t,O):e?l(w,{children:[n(Ae,{children:n(K,{entries:n(De,{parts:Ze(J??c.components[e.type]?.fields,e.props),onOpen:a=>G(M(e.props.id,a))})})}),e.type===v&&h.hasSiteSettings&&n(Be,{}),R&&n(Ee,{source:R,slug:Je(e?.props)}),n(ke,{shown:A,onChange:ae})]}):l(w,{children:[n(K,{}),y===ze&&h.hasSiteSettings&&N&&n(N,{})]})})})]})}export{$t as CHAT_MODE,Mt as HEADER_MODE,Kt as PUCK_MODE,jt as SOCIAL_MODE,Wt as WEBSITE_MODE,tt as default,et as resolvePanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default
|
|
1
|
+
export { default } from "efficient-easel/screen/components/SectionScreenShell";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{default as f}from"efficient-easel/screen/components/SectionScreenShell";export{f as default};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
1
2
|
import { type ThemeColors } from "../lib/theme.js";
|
|
2
3
|
export declare const SECTION_THEME_FOLLOW_LABEL = "Follow the page";
|
|
3
4
|
export declare const BLOCK_THEME_FOLLOW_LABEL = "Follow the slideshow";
|
|
@@ -16,8 +17,9 @@ export declare function SectionThemeEditor({ index, colors, onChange, onDone, }:
|
|
|
16
17
|
onChange: (next: ThemeColors) => void;
|
|
17
18
|
onDone: () => void;
|
|
18
19
|
}): import("react").JSX.Element;
|
|
19
|
-
export default function SectionThemePicker({ value, onChange, followLabel, }: {
|
|
20
|
+
export default function SectionThemePicker({ value, onChange, followLabel, hint, }: {
|
|
20
21
|
value: unknown;
|
|
21
22
|
onChange: (next: number) => void;
|
|
22
23
|
followLabel?: string;
|
|
24
|
+
hint?: ReactNode;
|
|
23
25
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as i,Fragment as
|
|
1
|
+
"use client";import{jsx as e,jsxs as i,Fragment as M}from"react/jsx-runtime";import{useCallback as z,useContext as B,useEffect as K,useId as _,useRef as D,useState as L}from"react";import{ThemeIcon as W}from"efficient-easel/icons";import{SettingsField as V}from"efficient-easel/panel";import{usePreviewHeader as q}from"./PreviewHeaderContext.js";import{StorefrontDocumentContext as G}from"./StorefrontDocumentContext.js";import{ThemeCard as J,ThemeCardTrigger as Q,ThemeColourRows as U,themeName as k}from"./ThemeCard.js";import{useThemeRowPersist as X}from"../lib/theme-row-persist.js";import{normalizeTheme as S,normalizeThemeColors as Y,selectedThemeColors as Z}from"../lib/theme.js";import{SECTION_ACCENT_INHERIT as ee,resolveSectionAccent as te}from"../lib/content/section-surface.js";const ne="Follow the page",Ce="Follow the slideshow",se=s=>`Editing ${s} changes it everywhere.`;function oe({colors:s}){if(!s)return e("span",{className:"sf-secttheme-chip sf-secttheme-chip--none","aria-hidden":"true"});const n=Y(s);return i("span",{className:"sf-secttheme-chip","aria-hidden":"true",children:[e("i",{style:{background:n.background}}),e("i",{className:"sf-secttheme-chip-accent",style:{background:n.accent}})]})}function ce({themes:s,value:n,onPick:r,onEdit:u,menuId:l,followLabel:m}){return i("div",{className:"sf-multi-menu sf-secttheme-menu",id:l,role:"listbox",children:[m!==void 0&&i(M,{children:[i("button",{type:"button",role:"option","aria-selected":n===null,className:`sf-secttheme-item${n===null?" is-active":""}`,onClick:()=>r(ee),children:[e(oe,{}),e("span",{className:"sf-secttheme-name",children:m})]}),e("div",{className:"sf-secttheme-sep",role:"presentation"})]}),n!==null&&s[n]&&e("p",{className:"sf-secttheme-oncard",role:"presentation",children:`${k(n)} is on this section`}),s.map((C,c)=>c===n?null:e(J,{role:"option",index:c,colors:C,selected:!1,onPick:()=>r(c),onEdit:()=>u(c)},c))]})}function re({index:s,colors:n,onChange:r,onDone:u}){const l=k(s),m=_();return i("div",{className:"sf-secttheme-sheet",children:[i("div",{className:"sf-secttheme-sheet-head",children:[e("span",{children:l}),e("button",{type:"button",className:"sf-secttheme-done",onClick:u,children:"Done"})]}),e("div",{className:"sf-secttheme-rows",children:e(U,{colors:n,onChange:r,idPrefix:m})}),e("p",{className:"sf-secttheme-warn",children:se(l)})]})}function ie({value:s,onChange:n,followLabel:r,hint:u}){const{theme:l,setTheme:m}=q(),C=S(l),c=B(G),y=c?.tokenRef,R=c?.siteId??null,F=!c?.capabilities?.hasSiteTheme,{persist:O,flush:N}=X({themeFromDocument:F,tokenRef:y,siteId:R}),g=S(C),a=g.themes,d=te(s),v=d!==null?a[d]:void 0,$=v??(a.length?Z(g):void 0),[f,T]=L(!1),[o,E]=L(null),x=D(null),b=D(null),p=_(),h=z(()=>{T(!1),E(null)},[]);K(()=>{if(!f&&o===null)return;const t=w=>{x.current&&!x.current.contains(w.target)&&(N(),h())};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[f,o,h,N]);const P=t=>{n(t),h()},j=t=>{if(o===null)return;const w=a.map((A,H)=>H===o?t:A),I={...g,themes:w};m(I),O({selected_preset:I.selected,theme_presets:I.themes})};return i("div",{className:"sf-secttheme",ref:x,children:[e(V,{label:"Theme",icon:e(W,{}),labelId:`${p}-label`,hint:u,children:e(Q,{colors:$,onEdit:d!==null?()=>{E(d),T(!1)}:void 0,name:v?k(d):r??ne,nameId:`${p}-value`,labelId:`${p}-label`,open:f,menuId:p,buttonRef:b,onClick:()=>{E(null),T(t=>!t)},onKeyDown:t=>{t.key==="Escape"&&(f||o!==null)&&(t.preventDefault(),h())}})}),f&&o===null&&e("div",{onKeyDown:t=>{t.key==="Escape"&&(t.preventDefault(),h(),b.current?.focus())},children:e(ce,{themes:a,value:d,onPick:P,onEdit:t=>{E(t),T(!1)},menuId:p,followLabel:r})}),o!==null&&a[o]&&e(re,{index:o,colors:a[o],onChange:j,onDone:()=>{N(),h(),b.current?.focus()}})]})}export{Ce as BLOCK_THEME_FOLLOW_LABEL,ne as SECTION_THEME_FOLLOW_LABEL,re as SectionThemeEditor,ce as SectionThemeMenu,ie as default,se as sectionThemeEditWarning};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as o}from"react/jsx-runtime";import{SettingsDefaultReset as a,SettingsField as d}from"efficient-easel/panel";import{ShadowIcon as i}from"efficient-easel/icons";import{ColourControl as s}from"../lib/puck/ColourControl.js";import{DEFAULT_SHADOW_COLOR as r}from"../lib/theme.js";const h="Most useful on a dark theme, where a black shadow cannot be seen. Also used by the Lift hover, even with the card shadow off.";function u({value:t,onChange:n,showHint:l=!0}){const e=t===null;return o(d,{label:"Shadow color",icon:o(i,{}),changed:!e,action:s({value:t??"",inherited:e?r:void 0,onChange:n,label:"Shadow color",after:o(a,{label:"Shadow color",changed:!e,detail:r,onReset:()=>n(null)})}),hint:l?h:void 0})}export{u as default};
|
|
@@ -1,23 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function SidePanelHead({ icon, title, context, actions, side, onHide, }: {
|
|
3
|
-
icon: ReactNode;
|
|
4
|
-
title: ReactNode;
|
|
5
|
-
context: ReactNode;
|
|
6
|
-
actions?: ReactNode;
|
|
7
|
-
side?: "left" | "right";
|
|
8
|
-
onHide?: () => void;
|
|
9
|
-
}): import("react").JSX.Element;
|
|
10
|
-
export declare function PanelHideButton({ side, onHide, divider, }: {
|
|
11
|
-
side: "left" | "right";
|
|
12
|
-
onHide: () => void;
|
|
13
|
-
divider?: boolean;
|
|
14
|
-
}): import("react").JSX.Element;
|
|
15
|
-
export declare function PanelShowStrip({ side, onShow }: {
|
|
16
|
-
side: "left" | "right";
|
|
17
|
-
onShow: () => void;
|
|
18
|
-
}): import("react").JSX.Element;
|
|
19
|
-
export declare function PanelModeExit({ label, onClick, description }: {
|
|
20
|
-
label: string;
|
|
21
|
-
onClick: () => void;
|
|
22
|
-
description?: string;
|
|
23
|
-
}): import("react").JSX.Element;
|
|
1
|
+
export { default, PanelHideButton, PanelModeExit, PanelShowStrip } from "efficient-easel/screen/components/SidePanelHead";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{default as l,PanelHideButton as n,PanelModeExit as o,PanelShowStrip as a}from"efficient-easel/screen/components/SidePanelHead";export{n as PanelHideButton,o as PanelModeExit,a as PanelShowStrip,l as default};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const SIDE_SPACE_LABEL = "Side space";
|
|
2
|
-
export declare const SIDE_SPACE_UNSET_LABEL = "Not set";
|
|
3
2
|
export declare const SIDE_SPACE_HINT = "The room left at the left and right edge of every page.";
|
|
4
3
|
export default function SideSpaceField({ value, onChange, showHint, }: {
|
|
5
4
|
value: number | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e}from"react/jsx-runtime";import{SettingsField as
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import{SettingsDefaultReset as d,SettingsField as s}from"efficient-easel/panel";import{PaddingXIcon as p}from"efficient-easel/icons";import{SITE_GUTTER as t}from"../lib/content/page-width.js";import{Slider as c}from"../lib/puck/controls.js";const i="Side space",o=t.default,f="The room left at the left and right edge of every page.";function m({value:n,onChange:a,showHint:r=!0}){const l=n===null;return e(s,{label:i,labelId:"sf-side-space",icon:e(p,{}),value:`${n??o}px`,changed:!l,action:e(d,{label:i,changed:!l,detail:`${o}px`,onReset:()=>a(null)}),hint:r?f:void 0,children:e(c,{min:t.min,max:t.max,step:t.step,value:n??o,readout:!1,ariaLabel:i,onChange:a})})}export{f as SIDE_SPACE_HINT,i as SIDE_SPACE_LABEL,m as default};
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export default function SiteEditorProvider({ config, data, onChange, permissions, children, }: {
|
|
5
|
-
config: unknown;
|
|
6
|
-
data: Data;
|
|
7
|
-
onChange?: (data: Data) => void;
|
|
8
|
-
permissions?: Partial<Permissions>;
|
|
9
|
-
children?: ReactNode;
|
|
10
|
-
}): import("react").JSX.Element;
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import EditorStoreProvider from "./EditorStoreProvider.js";
|
|
3
|
+
export default function SiteEditorProvider(props: Omit<ComponentProps<typeof EditorStoreProvider>, "parts">): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as o}from"react/jsx-runtime";import t from"./EditorStoreProvider.js";import{WEBSITE_SCREEN as i}from"./WebsiteScreenParts.js";function e(r){return o(t,{...r,parts:i})}export{e as default};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const SITE_WIDTH_LABEL = "Content width";
|
|
2
|
-
export declare const SITE_WIDTH_UNSET_LABEL = "Not set";
|
|
3
2
|
export declare const SITE_WIDTH_HINT = "The standard width every page on this site renders at.";
|
|
4
3
|
export default function SiteWidthField({ value, onChange, showHint, }: {
|
|
5
4
|
value: number | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t}from"react/jsx-runtime";import{SettingsField as
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import{SettingsDefaultReset as d,SettingsField as l}from"efficient-easel/panel";import{WidthIcon as m}from"efficient-easel/icons";import{PAGE_WIDTH as e}from"../lib/content/page-width.js";import{Slider as p}from"../lib/puck/controls.js";const n="Content width",o=e.default,c="The standard width every page on this site renders at.";function f({value:i,onChange:r,showHint:s=!0}){const a=i===null;return t(l,{label:n,labelId:"sf-site-width",icon:t(m,{}),value:`${i??o}px`,changed:!a,action:t(d,{label:n,changed:!a,detail:`${o}px`,onReset:()=>r(null)}),hint:s?c:void 0,children:t(p,{min:e.min,max:e.max,step:e.step,value:i??o,readout:!1,ariaLabel:n,onChange:r})})}export{c as SITE_WIDTH_HINT,n as SITE_WIDTH_LABEL,f as default};
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type SlotChildActions = {
|
|
4
|
-
selectChild: (zone: string, index: number, id: string, parentType: string) => void;
|
|
5
|
-
addChild: (parentId: string, slot: string, childType: string, atIndex: number, parentType: string) => void;
|
|
6
|
-
childRowName: (child: TreeItem) => string;
|
|
7
|
-
blockRowName: (child: TreeItem) => string;
|
|
8
|
-
};
|
|
9
|
-
export declare function SlotChildActionsProvider({ value, children, }: {
|
|
10
|
-
value: SlotChildActions;
|
|
11
|
-
children: ReactNode;
|
|
12
|
-
}): import("react").JSX.Element;
|
|
13
|
-
export declare function useSlotChildActions(): SlotChildActions | null;
|
|
1
|
+
export { SlotChildActionsProvider, useSlotChildActions } from "efficient-easel/screen/components/SlotChildActionsContext";
|
|
2
|
+
export type { SlotChildActions } from "efficient-easel/screen/components/SlotChildActionsContext";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{SlotChildActionsProvider as t,useSlotChildActions as e}from"efficient-easel/screen/components/SlotChildActionsContext";export{t as SlotChildActionsProvider,e as useSlotChildActions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,Fragment as l,jsxs as p}from"react/jsx-runtime";import{useEffect as b,useId as d,useState as h}from"react";import{SettingsField as L}from"efficient-easel/panel";import{usePreviewSocial as y}from"./PreviewSocialContext.js";import{SocialMark as v}from"./socialIcons.js";import{SOCIAL_PLATFORMS as w,SOCIAL_PLATFORM_LABELS as x}from"../lib/content/social-links.js";const A={instagram:"instagram.com/yourshop",facebook:"facebook.com/yourshop",tiktok:"tiktok.com/@yourshop",youtube:"youtube.com/@yourshop",x:"x.com/yourshop",linkedin:"linkedin.com/company/yourshop",pinterest:"pinterest.com/yourshop",whatsapp:"wa.me/61400000000"};function E({platform:e}){const{rows:c,saveLink:n}=y(),{value:o,error:i}=c[e],[s,a]=h(o),[k,u]=h(!1),f=d(),m=d();b(()=>a(o),[o]);const S=async()=>{if(s.trim()===o){s!==o&&a(o);return}u(!0),await n(e,s),u(!1)},g=x[e];return p(l,{children:[t(L,{label:g,htmlFor:f,icon:t(v,{platform:e,iconStyle:"outline",size:18}),children:t("input",{id:f,type:"text",inputMode:"url",value:s,placeholder:A[e],onChange:r=>a(r.target.value),onBlur:()=>{S()},onKeyDown:r=>{r.key==="Enter"&&r.currentTarget.blur(),r.key==="Escape"&&(a(o),r.currentTarget.blur())},"aria-invalid":i?!0:void 0,"aria-describedby":i?m:void 0,"aria-busy":k||void 0,autoComplete:"off",spellCheck:!1})}),i&&t("p",{id:m,className:"sf-note sf-note--error",role:"alert",children:i})]})}function F({unavailable:e}){const{canSave:c}=y();return!c&&e?t(l,{children:e}):p(l,{children:[t("p",{className:"
|
|
1
|
+
"use client";import{jsx as t,Fragment as l,jsxs as p}from"react/jsx-runtime";import{useEffect as b,useId as d,useState as h}from"react";import{SettingsField as L}from"efficient-easel/panel";import{usePreviewSocial as y}from"./PreviewSocialContext.js";import{SocialMark as v}from"./socialIcons.js";import{SOCIAL_PLATFORMS as w,SOCIAL_PLATFORM_LABELS as x}from"../lib/content/social-links.js";const A={instagram:"instagram.com/yourshop",facebook:"facebook.com/yourshop",tiktok:"tiktok.com/@yourshop",youtube:"youtube.com/@yourshop",x:"x.com/yourshop",linkedin:"linkedin.com/company/yourshop",pinterest:"pinterest.com/yourshop",whatsapp:"wa.me/61400000000"};function E({platform:e}){const{rows:c,saveLink:n}=y(),{value:o,error:i}=c[e],[s,a]=h(o),[k,u]=h(!1),f=d(),m=d();b(()=>a(o),[o]);const S=async()=>{if(s.trim()===o){s!==o&&a(o);return}u(!0),await n(e,s),u(!1)},g=x[e];return p(l,{children:[t(L,{label:g,htmlFor:f,icon:t(v,{platform:e,iconStyle:"outline",size:18}),children:t("input",{id:f,type:"text",inputMode:"url",value:s,placeholder:A[e],onChange:r=>a(r.target.value),onBlur:()=>{S()},onKeyDown:r=>{r.key==="Enter"&&r.currentTarget.blur(),r.key==="Escape"&&(a(o),r.currentTarget.blur())},"aria-invalid":i?!0:void 0,"aria-describedby":i?m:void 0,"aria-busy":k||void 0,autoComplete:"off",spellCheck:!1})}),i&&t("p",{id:m,className:"sf-note sf-note--error",role:"alert",children:i})]})}function F({unavailable:e}){const{canSave:c}=y();return!c&&e?t(l,{children:e}):p(l,{children:[t("p",{className:"es-field-hint sf-hint-keep",children:"Paste a link to each profile. A platform left empty shows nothing on the site."}),w.map(n=>t(E,{platform:n},n))]})}export{F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as s,jsxs as r}from"react/jsx-runtime";function u({status:l,statusText:t,onRefresh:n,busy:
|
|
1
|
+
"use client";import{jsx as s,jsxs as r}from"react/jsx-runtime";function u({status:l,statusText:t,onRefresh:n,busy:a=!1,edit:e,hint:o,spaced:c=!0}){return r("div",{className:"sf-blogsource",style:c?{marginTop:9}:void 0,children:[s("p",{className:"sf-blogsource-status","data-state":l,children:t}),s("button",{type:"button",className:"sf-blogsource-btn",onClick:n,disabled:a,children:"Refresh now"}),e?s("button",{type:"button",className:"sf-blogsource-btn",onClick:e.onClick,children:e.label}):null,s("p",{className:"es-field-hint sf-hint-keep",children:o})]})}export{u as default};
|
|
@@ -10,6 +10,7 @@ import "efficient-easel/text-styles.css";
|
|
|
10
10
|
import "efficient-easel/menu.css";
|
|
11
11
|
import "efficient-easel/chrome.css";
|
|
12
12
|
import "efficient-easel/tree.css";
|
|
13
|
+
import "efficient-easel/screen.css";
|
|
13
14
|
import "./storefront-editor.css";
|
|
14
15
|
export default function StandaloneSectionEditor({ id, initialType, initialName, }: {
|
|
15
16
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as o}from"react/jsx-runtime";import{useCallback as R,useEffect as S,useMemo as m,useRef as Q,useState as u}from"react";import x from"next/dynamic";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"./storefront-editor.css";import{buildConfig as V}from"../lib/puck/build-config.js";import{withTemplateMediaPlaceholders as X}from"../lib/puck/templateFields.js";import{setEditorPageSlug as B}from"../lib/puck/editor-page-context.js";import{StorefrontDocumentContext as Z}from"./StorefrontDocumentContext.js";import{PreviewHeaderProvider as $}from"./PreviewHeaderContext.js";import{PreviewTickerProvider as ee}from"./PreviewTickerContext.js";import{PreviewPartsProvider as te}from"./PreviewPartsContext.js";import{PreviewLocationPartProvider as re}from"./PreviewLocationPartContext.js";import{PreviewPartStyleProvider as oe}from"./PreviewPartStyleContext.js";import{sectionTemplates as O}from"../lib/editor-section-templates.js";import{nodeToDoc as
|
|
1
|
+
"use client";import{jsx as o}from"react/jsx-runtime";import{useCallback as R,useEffect as S,useMemo as m,useRef as Q,useState as u}from"react";import x from"next/dynamic";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{buildConfig as V}from"../lib/puck/build-config.js";import{withTemplateMediaPlaceholders as X}from"../lib/puck/templateFields.js";import{setEditorPageSlug as B}from"../lib/puck/editor-page-context.js";import{StorefrontDocumentContext as Z}from"./StorefrontDocumentContext.js";import{PreviewHeaderProvider as $}from"./PreviewHeaderContext.js";import{PreviewTickerProvider as ee}from"./PreviewTickerContext.js";import{PreviewPartsProvider as te}from"./PreviewPartsContext.js";import{PreviewLocationPartProvider as re}from"./PreviewLocationPartContext.js";import{PreviewPartStyleProvider as oe}from"./PreviewPartStyleContext.js";import{sectionTemplates as O}from"../lib/editor-section-templates.js";import{nodeToDoc as ie,docToNode as F}from"../lib/puck/section-doc.js";import{newNodeId as ne}from"../lib/puck/content-tree.js";import{migrateRenamedProps as se}from"../lib/puck/renamed-props.js";import{buildSlotSeedChildren as de}from"../lib/puck/slot-specs.js";import{FOOTER_TYPE as ae,buildDefaultFooterBlocks as ce}from"../lib/puck/footer-blocks.js";import{NO_BRIDGED_CAPABILITIES as le,useAdminBridge as me}from"../lib/editor-admin-bridge.js";import{useEditorHost as ue}from"../lib/editor-host.js";import{ChromeWrap as fe}from"../lib/editor-chrome.js";import{sessionRegistry as pe}from"../lib/editor-session.js";import{useEditorSession as ve}from"../lib/editor-session-context.js";import{routeSharedHostMessage as ge}from"../lib/editor-host-inbound.js";import{routeWebsiteHostMessage as he}from"../lib/website-host-inbound.js";import{DEFAULT_THEME_MODE as P,THEME_MODE_KEY as Se}from"../lib/theme.js";import{makeSitePageAdapter as H}from"../lib/editor-document-adapter.js";import{documentPermissions as Pe}from"efficient-easel/edit-lock";import{useAutosave as Ee}from"efficient-easel/autosave";import{saveStatusOf as ye}from"../lib/puck/pinned-seed-gate.js";import{blocksOf as Te}from"../lib/website-session.js";const we=x(()=>import("./SiteEditorProvider.js"),{ssr:!1}),Ne=x(()=>import("./SectionEditorShell.js"),{ssr:!1}),L="HeroSingle",U="Untitled section";function ke(i,E){const d=E.components,r=d[i]?i:L,y=d[r]?.defaultProps??{},n=de(r,f=>d[f]?.defaultProps??{}),s=r===ae?{blocks:ce()}:null;return{type:r,props:{id:ne(r),...y,...n?{[n.slot]:n.children}:null,...s}}}function Ae(){if(typeof window>"u")return P;try{const i=window.localStorage.getItem(Se);return i==="light"||i==="dark"||i==="auto"?i:P}catch{return P}}function Ce({id:i,initialType:E,initialName:d=U}){const[r,y]=u(i),n=Q(r);S(()=>{n.current=r},[r]);const s=ue(),[f,Y]=u(E),[b,j]=u(d),[a,T]=u(void 0),[K,W]=u(P),{token:w,tokenRef:M}=me({onMessage:e=>{if(he(e)||ge(e))return;const t=e;if(t?.type==="storefront-editor:navigate"&&t.target?.kind==="section"&&t.target.id){const I=t.target.id;if(I===n.current)return;const z=t.target.type,J=t.target.name;k().then(()=>{Y(z),j(J||U),y(I),s.address.show({kind:"section",id:I})})}}}),N=Ee({save:e=>O.update(e.id,e.node).then(()=>{}),onFailure:(e,t)=>{t===0&&s.send("storefront-editor:save-failed")}}),{state:p,push:_,flush:k}=N;S(()=>W(Ae()),[]);const c=ve(),v=c.usesBridgedToken?!!w:!0,g=m(()=>V(pe(c),Te(c)),[c]);S(()=>{if(!v)return;let e=!1;return T(void 0),O.ensure(r,b,ke(f??L,g)).then(t=>!e&&T(t.node)).catch(()=>!e&&T(null)),()=>{e=!0}},[r,f,b,v,g]);const A=R(e=>{s.send("storefront-editor:dirty");const t=F(e);t&&_({id:n.current,node:t})},[_,s]),h=s.send,D=R(async e=>{try{return await e(M.current??""),!0}catch{return h("storefront-editor:save-failed"),!1}},[h]),G=m(()=>X(g,!0),[g]);S(()=>(B(null),()=>B(null)),[]);const l=m(()=>a?se(ie(a)):null,[a]),C=m(()=>({target:{kind:"page",slug:""},adapter:H(void 0),capabilities:H(void 0).capabilities,templateId:null,currentSlug:"",currentKind:null,siteId:null,ready:v,token:w,tokenRef:M,notifyParent:h,runAuthed:D,docId:r,data:l,getLiveData:()=>l,footerOriginSlug:null,error:null,redirecting:!1,saveStatus:ye(p),saveState:p,autoSaveEnabled:!0,autoSaveStoppedByConflict:!1,hasUnsavedEdits:p.pending,toggleAutoSave:()=>{},retrySave:()=>{N.retryNow()},onChange:A,flushSave:k,onPublish:async e=>{const t=F(e);t&&await O.update(n.current,t)},bridgeCapabilities:le,access:{kind:"editing"},readOnly:!1,takeOverEditing:()=>{},viewReadOnly:()=>{},saveConflict:null,reloadFromServer:()=>{},navigate:()=>{},pendingNav:null,cancelPendingNav:()=>{},discardAndNavigate:()=>{},saveAndNavigate:async()=>{}}),[r,v,w,h,D,l,p,A,k,N.retryNow]),q=m(()=>Pe(!C.readOnly),[C.readOnly]);return a===void 0?o("div",{className:"sf-msg",children:"Loading\u2026"}):a===null||!l?o("div",{className:"sf-msg sf-msg--error",children:"Couldn\u2019t open this section."}):o(Z.Provider,{value:C,children:o($,{themeMode:K,chromePlaceholder:!0,children:o(fe,{wrap:c.chrome?.wrap,surface:"section",children:o(ee,{children:o(te,{children:o(re,{children:o(oe,{children:o(we,{config:G,data:l,onChange:A,permissions:q,children:o(Ne,{})},r)})})})})})})})}export{Ce as default};
|