@riverbankcms/sdk 0.78.2 → 0.79.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 +80 -0
- package/dist/{PreviewEditorSidebar-4DXLYX2V.mjs → PreviewEditorSidebar-56NMJMIK.mjs} +724 -47
- package/dist/{PreviewEditorUI-CS5P4N3P.mjs → PreviewEditorUI-27KJVEET.mjs} +3 -3
- package/dist/SdkPreviewModeRuntime-H4BSP6E7.mjs +8 -0
- package/dist/_dts/ai/src/contracts/proposals.d.ts +36 -0
- package/dist/_dts/api/src/endpoints.d.ts +55 -0
- package/dist/_dts/api/src/index.d.ts +5 -3
- package/dist/_dts/api/src/media.d.ts +8 -1
- package/dist/_dts/api/src/navigation/dashboardSettingsNav.d.ts +1 -1
- package/dist/_dts/api/src/navigation/dashboardSiteNav.d.ts +8 -8
- package/dist/_dts/api/src/navigation/identity.d.ts +59 -0
- package/dist/_dts/api/src/navigation.d.ts +2 -0
- package/dist/_dts/api/src/publicExperienceEndpoints.d.ts +4 -0
- package/dist/_dts/api/src/sdkContracts.d.ts +1 -0
- package/dist/_dts/api/src/siteIcons.d.ts +128 -0
- package/dist/_dts/api/src/siteManagementEndpoints.d.ts +16 -0
- package/dist/_dts/api/src/sitePlatformEndpoints.d.ts +7 -0
- package/dist/_dts/api/src/siteRuntimeEndpoints.d.ts +6 -1
- package/dist/_dts/api/src/types.d.ts +1 -1
- package/dist/_dts/api/src/webhooks.d.ts +239 -0
- package/dist/_dts/blocks/src/index.d.ts +4 -0
- package/dist/_dts/blocks/src/system/blocks/appointment-booking.d.ts +288 -288
- package/dist/_dts/blocks/src/system/blocks/blog-listing.d.ts +288 -288
- package/dist/_dts/blocks/src/system/blocks/cart.d.ts +288 -288
- package/dist/_dts/blocks/src/system/blocks/checkout.d.ts +288 -288
- package/dist/_dts/blocks/src/system/blocks/collection.d.ts +288 -288
- package/dist/_dts/blocks/src/system/blocks/faq.d.ts +294 -289
- package/dist/_dts/blocks/src/system/blocks/feature-card-icons.d.ts +57 -0
- package/dist/_dts/blocks/src/system/blocks/feature-cards.d.ts +4 -0
- package/dist/_dts/blocks/src/system/blocks/gifting.d.ts +288 -288
- package/dist/_dts/blocks/src/system/blocks/index.d.ts +1 -0
- package/dist/_dts/blocks/src/system/blocks/location-map.d.ts +1 -1
- package/dist/_dts/blocks/src/system/blocks/media-text.d.ts +22 -22
- package/dist/_dts/blocks/src/system/blocks/product-detail.d.ts +288 -288
- package/dist/_dts/blocks/src/system/blocks/product-list.d.ts +288 -288
- package/dist/_dts/blocks/src/system/blocks/shop.d.ts +288 -288
- package/dist/_dts/blocks/src/system/blocks/testimonials.d.ts +7 -1
- package/dist/_dts/blocks/src/system/customize/backgrounds.d.ts +170 -0
- package/dist/_dts/blocks/src/system/fragments/library/testimonialsCarousel.d.ts +5 -0
- package/dist/_dts/blocks/src/system/helpers/resolveBackground.d.ts +3 -1
- package/dist/_dts/blocks/src/system/icons/ids.d.ts +13 -0
- package/dist/_dts/blocks/src/system/icons/index.d.ts +6 -0
- package/dist/_dts/blocks/src/system/icons/presets.d.ts +4 -0
- package/dist/_dts/blocks/src/system/icons/registry.d.ts +18 -0
- package/dist/_dts/blocks/src/system/icons/semantic.d.ts +239 -0
- package/dist/_dts/blocks/src/system/icons/value.d.ts +94 -0
- package/dist/_dts/blocks/src/system/index.d.ts +1 -0
- package/dist/_dts/blocks/src/system/manifest/fieldValidation/index.d.ts +4 -1
- package/dist/_dts/blocks/src/system/manifest/schema.d.ts +23 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/feature-card-icon.d.ts +13 -0
- package/dist/_dts/content-model/src/contentManifest.d.ts +3 -1
- package/dist/_dts/core/src/branded.d.ts +6 -0
- package/dist/_dts/db/src/generated/supabase/database.types.d.ts +191 -0
- package/dist/_dts/editor-blocks/src/block-editor/BlockCard.d.ts +12 -1
- package/dist/_dts/editor-blocks/src/block-editor/BlockCardBody.d.ts +12 -1
- package/dist/_dts/editor-blocks/src/block-editor/BlockCardHeader.d.ts +12 -2
- package/dist/_dts/editor-blocks/src/block-editor/FeatureCardIconsPanel.d.ts +21 -0
- package/dist/_dts/editor-blocks/src/block-editor/GeneratedIconSetDialog.d.ts +40 -0
- package/dist/_dts/editor-blocks/src/block-editor/SortableBlockItem.d.ts +11 -1
- package/dist/_dts/editor-blocks/src/block-editor/featureCardIconActions.d.ts +82 -0
- package/dist/_dts/editor-blocks/src/widgets/icon-picker/IconPickerField.d.ts +1 -1
- package/dist/_dts/media-core/src/fileDomain.d.ts +8 -1
- package/dist/_dts/media-editor/src/MediaEditor.d.ts +3 -2
- package/dist/_dts/media-react/src/components/MediaLibrary.d.ts +2 -1
- package/dist/_dts/media-react/src/components/MediaPickerMini.d.ts +2 -1
- package/dist/_dts/preview-next/src/client/blocks/previewCustomizeActions.d.ts +17 -0
- package/dist/_dts/preview-next/src/client/preview/PageDesignEditorStateContext.d.ts +4 -0
- package/dist/_dts/preview-next/src/client/preview/StyleConfigurator.state.d.ts +3 -2
- package/dist/_dts/preview-next/src/client/preview/previewCustomizeHistory.d.ts +6 -0
- package/dist/_dts/sdk/src/cli/navigationIdentity.d.ts +11 -0
- package/dist/_dts/sdk/src/cli/site-commands/navigationCommands.d.ts +4 -0
- package/dist/_dts/sdk/src/cli/site-commands/oneOffCommands.d.ts +1 -0
- package/dist/_dts/sdk/src/cli/sync/diff.d.ts +9 -0
- package/dist/_dts/sdk/src/client/management/types.d.ts +2 -0
- package/dist/_dts/sdk/src/config/field-definitions.d.ts +3 -1
- package/dist/_dts/sdk/src/contracts/index.d.ts +1 -1
- package/dist/_dts/sdk/src/contracts/system-block-content.d.ts +19 -2
- package/dist/_dts/sdk/src/next/index.d.ts +1 -1
- package/dist/_dts/sdk/src/next/revalidate.d.ts +26 -5
- package/dist/_dts/sdk/src/next/static-params.d.ts +28 -3
- package/dist/_dts/sdk/src/public-api/contracts.d.ts +5 -1
- package/dist/_dts/sdk/src/public-api/runtime.d.ts +1 -1
- package/dist/_dts/sdk/src/version.d.ts +1 -1
- package/dist/_dts/sdk/src/webhooks/index.d.ts +1 -1
- package/dist/_dts/sdk/src/webhooks/verify.d.ts +6 -102
- package/dist/_dts/site-commands/src/commands.d.ts +3 -0
- package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
- package/dist/_dts/theme-core/src/mock-themes/all.d.ts +3 -3
- package/dist/_dts/theme-core/src/schema.d.ts +5 -5
- package/dist/_dts/theme-core/src/site-styles/curatedSiteStyles.d.ts +25 -2
- package/dist/_dts/theme-core/src/site-styles/designState.d.ts +5 -5
- package/dist/_dts/theme-core/src/site-styles/generatedSchemas.d.ts +4 -2
- package/dist/_dts/theme-core/src/site-styles/previewCompiler.d.ts +4 -4
- package/dist/_dts/theme-core/src/tokens/themeColorTokens.d.ts +2 -0
- package/dist/_dts/ui/src/combobox.d.ts +1 -0
- package/dist/{chunk-RGTOD4AJ.mjs → chunk-4HCW7FHJ.mjs} +491 -56
- package/dist/{chunk-OKMBEAXY.mjs → chunk-A3HHFKVT.mjs} +1 -1
- package/dist/{chunk-6HYXHRAI.mjs → chunk-GP555I66.mjs} +177 -7
- package/dist/{chunk-CR5HKAGU.mjs → chunk-K2IIF34C.mjs} +55 -0
- package/dist/{chunk-4QEGTLK6.mjs → chunk-LCY32PXF.mjs} +1 -1
- package/dist/{chunk-MCRQMPET.mjs → chunk-V47ZU33I.mjs} +1745 -157
- package/dist/cli/index.mjs +1169 -171
- package/dist/cli/init-docs/content/workflow-editor-workflows.md +2 -0
- package/dist/cli/init-docs/content/workflow-isr-revalidation.md +138 -0
- package/dist/client/{accordion-PLYNJIIM.mjs → accordion-QLA7KBYO.mjs} +1 -1
- package/dist/client/{bookingForm-BXAP6AO7.mjs → bookingForm-PYZIPA5G.mjs} +3 -3
- package/dist/client/bookings.mjs +110 -2
- package/dist/client/{carousel-TRBXDHGF.mjs → carousel-5EIULWBI.mjs} +2 -2
- package/dist/client/{cart-Z7H3HJRS.mjs → cart-DOP3FNI4.mjs} +5 -5
- package/dist/client/{checkout-WAFCUBIX.mjs → checkout-BVMF6FBV.mjs} +5 -5
- package/dist/client/{chunk-JRDUHZCT.mjs → chunk-44K2U3QI.mjs} +4 -4
- package/dist/client/{chunk-UVQEJJTN.mjs → chunk-CCNTDRCF.mjs} +1 -1
- package/dist/client/{chunk-ZI3LLBPZ.mjs → chunk-GG4M2NP6.mjs} +1 -1
- package/dist/client/{chunk-JGXPTEI2.mjs → chunk-R5ESWNKX.mjs} +6 -3
- package/dist/client/{chunk-CWGTG37I.mjs → chunk-TYONZMST.mjs} +1 -1
- package/dist/client/{chunk-75OUS5MT.mjs → chunk-UDS3NTWA.mjs} +1 -1
- package/dist/client/{chunk-DNRGY432.mjs → chunk-V6M5FCR5.mjs} +1 -1
- package/dist/client/{chunk-FUXW6VW2.mjs → chunk-YLDYVRZL.mjs} +4 -4
- package/dist/client/client.mjs +21329 -19729
- package/dist/client/{courseRegistration-AHFQHWIJ.mjs → courseRegistration-E6EAA6NL.mjs} +3 -3
- package/dist/client/{eventCalendar-LDXTV5R7.mjs → eventCalendar-HBG3HAK6.mjs} +5 -5
- package/dist/client/{eventCombined-A4JGTNJO.mjs → eventCombined-6K5ZZWAK.mjs} +5 -5
- package/dist/client/{eventDetails-4YXTZ7EG.mjs → eventDetails-Q75ICXLT.mjs} +5 -5
- package/dist/client/{eventListing-P72TPFFM.mjs → eventListing-27P5F7DZ.mjs} +5 -5
- package/dist/client/{eventRegistration-LSYJHGMT.mjs → eventRegistration-IQ7AMASR.mjs} +5 -5
- package/dist/client/{form-AOPYOKOW.mjs → form-JRTD65FN.mjs} +1 -1
- package/dist/client/{headerSection-5TFYDFVQ.mjs → headerSection-7FPSSZHS.mjs} +2 -2
- package/dist/client/hooks.mjs +350 -35
- package/dist/client/{locationMap-QSZ3ZVAZ.mjs → locationMap-7NGFNYBH.mjs} +1 -1
- package/dist/client/{newsletterForm-KTRHZY52.mjs → newsletterForm-F3BADCI2.mjs} +1 -1
- package/dist/client/{productDetail-N4E775RG.mjs → productDetail-V3HP7ITJ.mjs} +5 -5
- package/dist/client/{productList-UGUQ2S45.mjs → productList-L3EGJUF2.mjs} +5 -5
- package/dist/client/rendering/client.mjs +2713 -1382
- package/dist/client/rendering/islands.mjs +18 -18
- package/dist/client/rendering.mjs +2014 -414
- package/dist/client/{shop-VHSZEEQ2.mjs → shop-DQUB5E2C.mjs} +5 -5
- package/dist/preview-next/before-render.mjs +55 -0
- package/dist/preview-next/client/runtime.mjs +5 -5
- package/dist/preview-next/middleware.mjs +55 -0
- package/dist/{sdk-runtime-WHPJEF5G.mjs → sdk-runtime-AF6KXJU4.mjs} +6 -6
- package/dist/server/components.mjs +2169 -781
- package/dist/server/config-validation.mjs +350 -35
- package/dist/server/config.mjs +350 -35
- package/dist/server/data.mjs +350 -35
- package/dist/server/index.mjs +64 -1
- package/dist/server/next/revalidate.mjs +229 -34
- package/dist/server/next.mjs +2307 -818
- package/dist/server/page-converter.mjs +275 -34
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/rendering/server.mjs +2174 -786
- package/dist/server/rendering.mjs +2187 -799
- package/dist/server/routing.mjs +767 -50
- package/dist/server/server.mjs +351 -36
- package/dist/server/theme-bridge.mjs +164 -2
- package/dist/server/theme.mjs +2 -2
- package/dist/server/webhooks.mjs +129 -25
- package/dist/styles/index.css +55 -0
- package/package.json +2 -1
- package/dist/SdkPreviewModeRuntime-IJDHTW4W.mjs +0 -8
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useOptionalPreviewLayout, PreviewQueryProvider } from './chunk-
|
|
3
|
-
import { PreviewThemeOverlayProvider, PreviewDesignCoordinatorProvider, resolveSiteStyleAccess, usePreviewDesignCoordinator, createOptimisticActionRunner, resolveStyleConfiguratorInitialSnapshot, createStyleConfiguratorState, syncStyleConfiguratorState, buildSiteChromeLookModels, planSiteStylePreviewChange, markApplyFailed, markApplySaved, markApplySaving, previewHeaderStyle, previewHeaderLayout, previewFooterLook, cycleSiteChromeLookId, usePreviewThemeOverlay, resolvePreviewDashboardSetupHandoff, buildPreviewDashboardSetupUrl, resolvePreviewSetupBannerModel, planSiteChromeLookSelection, sanitizeDashboardPath } from './chunk-
|
|
4
|
-
import { resolvePreviewChromeSurface, getPreviewSidebarTab, onPreviewSidebarOpenRequest, getPreviewChromeSurfaceDataProps, PREVIEW_CHROME_THEME_CLASS_NAME, setPreviewSidebarTab, PreviewPageDesignEditorStateProvider, usePreviewPageDesignEditorState, PREVIEW_SURFACE_PARAM } from './chunk-
|
|
5
|
-
import { clientComponentRegistry, deriveLaunchReadiness, DEFAULT_LAUNCH_READINESS_INPUT, useEditorUiStore, ResizableSplitPane, BlockApiProvider, EditorProvider, getCuratedSiteStyle, useEditor, createRoutingHelpers, createSnapshotFromPageRecord, EntryControllerProvider, useEntryEditorController, useEditorUiStoreInstance, surfaceResolutionContextFromTheme, unsafeAsEditorBlockId, EditableBlockProvider, asDesignBlockId, PageRenderer, planSiteDocument, ThemeScope, FixedBottomSurface, Button, unwrapResponse, X, ChevronLeft, ChevronRight, RotateCcw, PreviewRichTextEditor, RichText, PreviewTextEditor, Text, buildThemeRuntime, renderBlock, siteHeaderManifest, siteFooterManifest, SiteDocumentLayout, SITE_CHROME_CLASS_NAMES, Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, buildEditorModelRuntimeFieldsByBlockId, applyCompiledRuntimeFieldsToContent, assertNever2, getBlockDefinition, systemCustomizeFacetDefinitionsForBlock, systemCustomizeFacetAppliesToLayoutVariant, systemCustomizeFacetCurrentValue, systemCustomizeFacetLabelForValue, visibleHeaderClearancePx, systemCustomizeFacetNextValue, EDITABLE_SURFACE_FORWARDING_PROP, assertNever, SITE_CHROME_VISIBLE_HEADER_SELECTOR } from './chunk-
|
|
6
|
-
import { API_ENDPOINTS, createBearerAPIClient, isPreviewRuntimeSessionEditable, DEFAULT_SURFACE_ID, initPreviewAuth, usePreviewAuth, usePreviewAuthFetch, markPreviewAuthExpired, usePreviewToken, parseSurfaceId } from './chunk-
|
|
2
|
+
import { useOptionalPreviewLayout, PreviewQueryProvider } from './chunk-A3HHFKVT.mjs';
|
|
3
|
+
import { PreviewThemeOverlayProvider, PreviewDesignCoordinatorProvider, resolveSiteStyleAccess, usePreviewDesignCoordinator, createOptimisticActionRunner, resolveStyleConfiguratorInitialSnapshot, createStyleConfiguratorState, syncStyleConfiguratorState, buildSiteChromeLookModels, planSiteStylePreviewChange, markApplyFailed, markApplySaved, markApplySaving, previewHeaderStyle, previewHeaderLayout, previewFooterLook, cycleSiteChromeLookId, usePreviewThemeOverlay, resolvePreviewDashboardSetupHandoff, buildPreviewDashboardSetupUrl, resolvePreviewSetupBannerModel, planSiteChromeLookSelection, sanitizeDashboardPath } from './chunk-LCY32PXF.mjs';
|
|
4
|
+
import { resolvePreviewChromeSurface, getPreviewSidebarTab, onPreviewSidebarOpenRequest, getPreviewChromeSurfaceDataProps, PREVIEW_CHROME_THEME_CLASS_NAME, setPreviewSidebarTab, PreviewPageDesignEditorStateProvider, usePreviewPageDesignEditorState, PREVIEW_SURFACE_PARAM } from './chunk-GP555I66.mjs';
|
|
5
|
+
import { clientComponentRegistry, deriveLaunchReadiness, DEFAULT_LAUNCH_READINESS_INPUT, useEditorUiStore, ResizableSplitPane, BlockApiProvider, EditorProvider, MediaEditorProvider, getCuratedSiteStyle, useEditor, createRoutingHelpers, createSnapshotFromPageRecord, EntryControllerProvider, useEntryEditorController, useEditorUiStoreInstance, surfaceResolutionContextFromTheme, unsafeAsEditorBlockId, EditableBlockProvider, asDesignBlockId, PageRenderer, planSiteDocument, ThemeScope, FixedBottomSurface, Button, unwrapResponse, X, ChevronLeft, ChevronRight, RotateCcw, parseBackgroundOverrideFromContent, rankBackgroundImagePoolItems, imagePoolForOverride, resolveBackgroundCapability, enabledBackgroundModes, PreviewRichTextEditor, RichText, PreviewTextEditor, Text, buildThemeRuntime, renderBlock, siteHeaderManifest, siteFooterManifest, SiteDocumentLayout, SITE_CHROME_CLASS_NAMES, Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, buildEditorModelRuntimeFieldsByBlockId, applyCompiledRuntimeFieldsToContent, assertNever2, getBlockDefinition, systemCustomizeFacetDefinitionsForBlock, systemCustomizeFacetAppliesToLayoutVariant, systemCustomizeFacetCurrentValue, systemCustomizeFacetLabelForValue, Image, useMediaEditorOptional, defaultBackgroundOverrideForMode, Upload, MediaEditor, visibleHeaderClearancePx, systemCustomizeFacetNextValue, GRADIENT_PRESETS, planBackgroundTransition, parseMediaAssetId, planBackgroundOverride, EDITABLE_SURFACE_FORWARDING_PROP, assertNever, SITE_CHROME_VISIBLE_HEADER_SELECTOR } from './chunk-V47ZU33I.mjs';
|
|
6
|
+
import { API_ENDPOINTS, createBearerAPIClient, isPreviewRuntimeSessionEditable, DEFAULT_SURFACE_ID, initPreviewAuth, usePreviewAuth, usePreviewAuthFetch, markPreviewAuthExpired, usePreviewToken, parseSurfaceId } from './chunk-K2IIF34C.mjs';
|
|
7
7
|
import React9, { createContext, useMemo, useState, useEffect, useRef, useCallback, useId, useReducer, Children, isValidElement, Fragment as Fragment$1, cloneElement, useContext } from 'react';
|
|
8
8
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
9
|
|
|
@@ -473,6 +473,25 @@ function cyclePageDesignBlockFacet(input) {
|
|
|
473
473
|
baseContentId: input.block.contentRevision?.contentId ?? null
|
|
474
474
|
};
|
|
475
475
|
}
|
|
476
|
+
function setPageDesignBlockBackground(input) {
|
|
477
|
+
const current = input.currentContent ? parseBackgroundOverrideFromContent(input.currentContent) : {
|
|
478
|
+
kind: "supported",
|
|
479
|
+
override: input.fromOverride ?? { kind: "default" }
|
|
480
|
+
};
|
|
481
|
+
const capability = resolveBackgroundCapability({
|
|
482
|
+
block: input.block,
|
|
483
|
+
imagePool: input.imagePool ?? imagePoolForOverride(input.override)
|
|
484
|
+
});
|
|
485
|
+
const plan = planBackgroundOverride(current, capability, input.override);
|
|
486
|
+
if (plan.kind !== "apply") return null;
|
|
487
|
+
return {
|
|
488
|
+
kind: "set-background",
|
|
489
|
+
blockId: input.block.blockId,
|
|
490
|
+
override: plan.override,
|
|
491
|
+
fromOverride: plan.fromOverride,
|
|
492
|
+
baseContentId: input.block.contentRevision?.contentId ?? null
|
|
493
|
+
};
|
|
494
|
+
}
|
|
476
495
|
function cyclePageDesignBoundaryBreak(boundary, direction) {
|
|
477
496
|
if (boundary.availableBreaks.length === 0) return null;
|
|
478
497
|
const breakIds = boundary.availableBreaks.map((option) => option.id);
|
|
@@ -604,12 +623,16 @@ function BlockToolbar({
|
|
|
604
623
|
[blockKind, content]
|
|
605
624
|
);
|
|
606
625
|
const [customizeOpen, setCustomizeOpen] = useState(false);
|
|
626
|
+
const [backgroundChooserOpen, setBackgroundChooserOpen] = useState(false);
|
|
607
627
|
const customizeButtonRef = useRef(null);
|
|
608
628
|
const {
|
|
609
629
|
state: pageDesignState,
|
|
610
630
|
applyAction: applyPageDesignAction,
|
|
611
631
|
isHistoryPending,
|
|
612
|
-
historyFailure
|
|
632
|
+
historyFailure,
|
|
633
|
+
backgroundImagePool = [],
|
|
634
|
+
backgroundImagePoolStatus = "idle",
|
|
635
|
+
loadBackgroundImagePool = async () => []
|
|
613
636
|
} = usePreviewPageDesignEditorState();
|
|
614
637
|
const closeCustomize = useCallback(() => {
|
|
615
638
|
setCustomizeOpen(false);
|
|
@@ -643,13 +666,51 @@ function BlockToolbar({
|
|
|
643
666
|
[blockKind, content, designBlock]
|
|
644
667
|
);
|
|
645
668
|
const hasFacetControls = facetControls.length > 0;
|
|
646
|
-
const
|
|
669
|
+
const currentBackground = useMemo(
|
|
670
|
+
() => parseBackgroundOverrideFromContent(content),
|
|
671
|
+
[content]
|
|
672
|
+
);
|
|
673
|
+
const mergedBackgroundImagePool = useMemo(
|
|
674
|
+
() => rankBackgroundImagePoolItems(
|
|
675
|
+
dedupeBackgroundImagePool([
|
|
676
|
+
...currentBackground.kind === "supported" ? imagePoolForOverride(currentBackground.override) : [],
|
|
677
|
+
...backgroundImagePool
|
|
678
|
+
])
|
|
679
|
+
),
|
|
680
|
+
[backgroundImagePool, currentBackground]
|
|
681
|
+
);
|
|
682
|
+
const backgroundCapability = useMemo(
|
|
683
|
+
() => designBlock ? resolveBackgroundCapability({
|
|
684
|
+
block: designBlock,
|
|
685
|
+
imagePool: mergedBackgroundImagePool
|
|
686
|
+
}) : null,
|
|
687
|
+
[designBlock, mergedBackgroundImagePool]
|
|
688
|
+
);
|
|
689
|
+
const enabledBackgroundModeList = useMemo(
|
|
690
|
+
() => backgroundCapability ? enabledBackgroundModes(backgroundCapability) : [],
|
|
691
|
+
[backgroundCapability]
|
|
692
|
+
);
|
|
693
|
+
const hasBackgroundControls = currentBackground.kind === "supported" && enabledBackgroundModeList.length > 1;
|
|
694
|
+
const hasCustomizeControls = hasLayoutControls || hasLookControls || hasFacetControls || hasBackgroundControls;
|
|
647
695
|
const isSavingCustomize = isHistoryPending;
|
|
648
696
|
useEffect(() => {
|
|
649
697
|
if (!hasCustomizeControls) {
|
|
650
698
|
setCustomizeOpen(false);
|
|
699
|
+
setBackgroundChooserOpen(false);
|
|
651
700
|
}
|
|
652
701
|
}, [hasCustomizeControls]);
|
|
702
|
+
useEffect(() => {
|
|
703
|
+
if (!customizeOpen || !backgroundCapability?.modes.includes("image")) {
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
if (backgroundImagePoolStatus !== "idle") return;
|
|
707
|
+
void loadBackgroundImagePool();
|
|
708
|
+
}, [
|
|
709
|
+
backgroundCapability,
|
|
710
|
+
backgroundImagePoolStatus,
|
|
711
|
+
customizeOpen,
|
|
712
|
+
loadBackgroundImagePool
|
|
713
|
+
]);
|
|
653
714
|
const handleEdit = (e) => {
|
|
654
715
|
e.preventDefault();
|
|
655
716
|
e.stopPropagation();
|
|
@@ -697,6 +758,42 @@ function BlockToolbar({
|
|
|
697
758
|
if (!action) return;
|
|
698
759
|
saveBlockCustomizeAction(action);
|
|
699
760
|
};
|
|
761
|
+
const handleBackgroundCycle = (action) => (e) => {
|
|
762
|
+
e.preventDefault();
|
|
763
|
+
e.stopPropagation();
|
|
764
|
+
saveBackgroundTransition(action);
|
|
765
|
+
};
|
|
766
|
+
const chooseBackgroundOverride = (override) => {
|
|
767
|
+
if (!designBlock) return;
|
|
768
|
+
const action = setPageDesignBlockBackground({
|
|
769
|
+
block: designBlock,
|
|
770
|
+
override,
|
|
771
|
+
currentContent: content,
|
|
772
|
+
imagePool: mergedBackgroundImagePool
|
|
773
|
+
});
|
|
774
|
+
if (!action) return;
|
|
775
|
+
saveBlockCustomizeAction(action);
|
|
776
|
+
setBackgroundChooserOpen(false);
|
|
777
|
+
};
|
|
778
|
+
const saveBackgroundTransition = (transition) => {
|
|
779
|
+
if (!designBlock || !backgroundCapability || currentBackground.kind !== "supported") {
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
const plan = planBackgroundTransition(
|
|
783
|
+
currentBackground.override,
|
|
784
|
+
backgroundCapability,
|
|
785
|
+
transition
|
|
786
|
+
);
|
|
787
|
+
if (plan.kind !== "apply") return;
|
|
788
|
+
const action = setPageDesignBlockBackground({
|
|
789
|
+
block: designBlock,
|
|
790
|
+
override: plan.override,
|
|
791
|
+
currentContent: content,
|
|
792
|
+
imagePool: mergedBackgroundImagePool
|
|
793
|
+
});
|
|
794
|
+
if (!action) return;
|
|
795
|
+
saveBlockCustomizeAction(action);
|
|
796
|
+
};
|
|
700
797
|
const saveBlockCustomizeAction = (action) => {
|
|
701
798
|
void applyPageDesignAction(action);
|
|
702
799
|
};
|
|
@@ -851,6 +948,100 @@ function BlockToolbar({
|
|
|
851
948
|
},
|
|
852
949
|
control.facetId
|
|
853
950
|
)),
|
|
951
|
+
hasBackgroundControls && currentBackground.kind === "supported" && backgroundCapability ? /* @__PURE__ */ jsxs("div", { children: [
|
|
952
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
953
|
+
/* @__PURE__ */ jsxs(
|
|
954
|
+
"button",
|
|
955
|
+
{
|
|
956
|
+
type: "button",
|
|
957
|
+
className: "flex min-w-0 items-center gap-2 text-left",
|
|
958
|
+
"aria-expanded": backgroundChooserOpen,
|
|
959
|
+
onClick: (event) => {
|
|
960
|
+
event.preventDefault();
|
|
961
|
+
event.stopPropagation();
|
|
962
|
+
setBackgroundChooserOpen((open) => !open);
|
|
963
|
+
},
|
|
964
|
+
children: [
|
|
965
|
+
/* @__PURE__ */ jsx(BackgroundPreviewSwatch, { override: currentBackground.override }),
|
|
966
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
967
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: "Background" }),
|
|
968
|
+
/* @__PURE__ */ jsx("div", { className: "truncate text-xs text-muted-foreground", children: backgroundOverrideLabel(currentBackground.override) })
|
|
969
|
+
] })
|
|
970
|
+
]
|
|
971
|
+
}
|
|
972
|
+
),
|
|
973
|
+
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
974
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center overflow-hidden rounded-full border bg-background", children: [
|
|
975
|
+
/* @__PURE__ */ jsx(
|
|
976
|
+
"button",
|
|
977
|
+
{
|
|
978
|
+
type: "button",
|
|
979
|
+
onClick: handleBackgroundCycle({
|
|
980
|
+
kind: "cycle-mode",
|
|
981
|
+
direction: "prev"
|
|
982
|
+
}),
|
|
983
|
+
className: "grid h-8 w-8 place-items-center hover:bg-muted",
|
|
984
|
+
"aria-label": "Previous background mode",
|
|
985
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { size: 14 })
|
|
986
|
+
}
|
|
987
|
+
),
|
|
988
|
+
/* @__PURE__ */ jsx(
|
|
989
|
+
"button",
|
|
990
|
+
{
|
|
991
|
+
type: "button",
|
|
992
|
+
onClick: handleBackgroundCycle({
|
|
993
|
+
kind: "cycle-mode",
|
|
994
|
+
direction: "next"
|
|
995
|
+
}),
|
|
996
|
+
className: "grid h-8 w-8 place-items-center border-l hover:bg-muted",
|
|
997
|
+
"aria-label": "Next background mode",
|
|
998
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { size: 14 })
|
|
999
|
+
}
|
|
1000
|
+
)
|
|
1001
|
+
] }),
|
|
1002
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center overflow-hidden rounded-full border bg-background", children: [
|
|
1003
|
+
/* @__PURE__ */ jsx(
|
|
1004
|
+
"button",
|
|
1005
|
+
{
|
|
1006
|
+
type: "button",
|
|
1007
|
+
onClick: handleBackgroundCycle({
|
|
1008
|
+
kind: "cycle-value",
|
|
1009
|
+
direction: "prev"
|
|
1010
|
+
}),
|
|
1011
|
+
className: "grid h-8 w-8 place-items-center hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
|
|
1012
|
+
"aria-label": "Previous background value",
|
|
1013
|
+
disabled: currentBackground.override.kind === "default",
|
|
1014
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { size: 14 })
|
|
1015
|
+
}
|
|
1016
|
+
),
|
|
1017
|
+
/* @__PURE__ */ jsx(
|
|
1018
|
+
"button",
|
|
1019
|
+
{
|
|
1020
|
+
type: "button",
|
|
1021
|
+
onClick: handleBackgroundCycle({
|
|
1022
|
+
kind: "cycle-value",
|
|
1023
|
+
direction: "next"
|
|
1024
|
+
}),
|
|
1025
|
+
className: "grid h-8 w-8 place-items-center border-l hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
|
|
1026
|
+
"aria-label": "Next background value",
|
|
1027
|
+
disabled: currentBackground.override.kind === "default",
|
|
1028
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { size: 14 })
|
|
1029
|
+
}
|
|
1030
|
+
)
|
|
1031
|
+
] })
|
|
1032
|
+
] })
|
|
1033
|
+
] }),
|
|
1034
|
+
backgroundChooserOpen ? /* @__PURE__ */ jsx(
|
|
1035
|
+
BackgroundChooser,
|
|
1036
|
+
{
|
|
1037
|
+
capability: backgroundCapability,
|
|
1038
|
+
current: currentBackground.override,
|
|
1039
|
+
enabledModes: enabledBackgroundModeList,
|
|
1040
|
+
imagePoolStatus: backgroundImagePoolStatus,
|
|
1041
|
+
onChoose: chooseBackgroundOverride
|
|
1042
|
+
}
|
|
1043
|
+
) : null
|
|
1044
|
+
] }) : null,
|
|
854
1045
|
hasLookControls ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
855
1046
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
856
1047
|
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: "Look" }),
|
|
@@ -890,6 +1081,163 @@ function BlockToolbar({
|
|
|
890
1081
|
}
|
|
891
1082
|
);
|
|
892
1083
|
}
|
|
1084
|
+
function BackgroundChooser({
|
|
1085
|
+
capability,
|
|
1086
|
+
current,
|
|
1087
|
+
enabledModes,
|
|
1088
|
+
imagePoolStatus,
|
|
1089
|
+
onChoose
|
|
1090
|
+
}) {
|
|
1091
|
+
const mediaEditorContext = useMediaEditorOptional();
|
|
1092
|
+
const [mediaPickerOpenKey, setMediaPickerOpenKey] = useState(0);
|
|
1093
|
+
const enabledModeSet = new Set(enabledModes);
|
|
1094
|
+
const images = rankBackgroundImagePoolItems(capability.imagePool ?? []);
|
|
1095
|
+
const recommendedTokens = capability.recommendedColorTokens ?? capability.colorTokens ?? [];
|
|
1096
|
+
const advancedTokens = capability.advancedColorTokens ?? [];
|
|
1097
|
+
const chooseFromClick = (override) => (event) => {
|
|
1098
|
+
event.preventDefault();
|
|
1099
|
+
event.stopPropagation();
|
|
1100
|
+
onChoose(override);
|
|
1101
|
+
};
|
|
1102
|
+
const chooseMediaValue = (value) => {
|
|
1103
|
+
if (value?.type !== "image" || !value.assetId) return;
|
|
1104
|
+
const parsed = parseMediaAssetId(value.assetId);
|
|
1105
|
+
if (!parsed.ok) return;
|
|
1106
|
+
onChoose({ kind: "image", mediaId: parsed.value });
|
|
1107
|
+
setMediaPickerOpenKey(0);
|
|
1108
|
+
};
|
|
1109
|
+
return /* @__PURE__ */ jsxs("div", { className: "mt-2 max-h-80 overflow-y-auto rounded-md border bg-muted/20 p-2", children: [
|
|
1110
|
+
/* @__PURE__ */ jsx("div", { className: "mb-2 grid grid-cols-4 gap-1", children: ["default", "color", "gradient", "image"].map((mode) => /* @__PURE__ */ jsx(
|
|
1111
|
+
"button",
|
|
1112
|
+
{
|
|
1113
|
+
type: "button",
|
|
1114
|
+
className: `rounded-md border px-2 py-1 text-xs ${current.kind === mode ? "border-foreground bg-foreground text-background" : "bg-background hover:bg-muted"} disabled:cursor-not-allowed disabled:opacity-50`,
|
|
1115
|
+
disabled: !enabledModeSet.has(mode),
|
|
1116
|
+
onClick: chooseFromClick(defaultBackgroundOverrideForMode(mode, capability)),
|
|
1117
|
+
children: backgroundModeLabel(mode)
|
|
1118
|
+
},
|
|
1119
|
+
mode
|
|
1120
|
+
)) }),
|
|
1121
|
+
recommendedTokens.length || advancedTokens.length ? /* @__PURE__ */ jsxs("div", { className: "mb-2", children: [
|
|
1122
|
+
/* @__PURE__ */ jsx("div", { className: "mb-1 text-xs font-medium text-muted-foreground", children: "Colors" }),
|
|
1123
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-1", children: recommendedTokens.map((token) => /* @__PURE__ */ jsxs(
|
|
1124
|
+
"button",
|
|
1125
|
+
{
|
|
1126
|
+
type: "button",
|
|
1127
|
+
className: `flex min-w-0 items-center gap-2 rounded-md border px-2 py-1 text-left text-xs hover:bg-muted ${current.kind === "color" && current.token === token ? "border-foreground" : "bg-background"}`,
|
|
1128
|
+
onClick: chooseFromClick({ kind: "color", token }),
|
|
1129
|
+
children: [
|
|
1130
|
+
/* @__PURE__ */ jsx(
|
|
1131
|
+
"span",
|
|
1132
|
+
{
|
|
1133
|
+
className: "h-3 w-3 shrink-0 rounded-full border",
|
|
1134
|
+
style: { backgroundColor: tokenSwatchCss(token) }
|
|
1135
|
+
}
|
|
1136
|
+
),
|
|
1137
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: formatTokenLabel(token) })
|
|
1138
|
+
]
|
|
1139
|
+
},
|
|
1140
|
+
token
|
|
1141
|
+
)) }),
|
|
1142
|
+
advancedTokens.length ? /* @__PURE__ */ jsxs("details", { className: "mt-1", children: [
|
|
1143
|
+
/* @__PURE__ */ jsx("summary", { className: "cursor-pointer text-xs text-muted-foreground", children: "More colors" }),
|
|
1144
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 grid grid-cols-2 gap-1", children: advancedTokens.map((token) => /* @__PURE__ */ jsxs(
|
|
1145
|
+
"button",
|
|
1146
|
+
{
|
|
1147
|
+
type: "button",
|
|
1148
|
+
className: `flex min-w-0 items-center gap-2 rounded-md border px-2 py-1 text-left text-xs hover:bg-muted ${current.kind === "color" && current.token === token ? "border-foreground" : "bg-background"}`,
|
|
1149
|
+
onClick: chooseFromClick({ kind: "color", token }),
|
|
1150
|
+
children: [
|
|
1151
|
+
/* @__PURE__ */ jsx(
|
|
1152
|
+
"span",
|
|
1153
|
+
{
|
|
1154
|
+
className: "h-3 w-3 shrink-0 rounded-full border",
|
|
1155
|
+
style: { backgroundColor: tokenSwatchCss(token) }
|
|
1156
|
+
}
|
|
1157
|
+
),
|
|
1158
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: formatTokenLabel(token) })
|
|
1159
|
+
]
|
|
1160
|
+
},
|
|
1161
|
+
token
|
|
1162
|
+
)) })
|
|
1163
|
+
] }) : null
|
|
1164
|
+
] }) : null,
|
|
1165
|
+
capability.gradientIds?.length ? /* @__PURE__ */ jsxs("div", { className: "mb-2", children: [
|
|
1166
|
+
/* @__PURE__ */ jsx("div", { className: "mb-1 text-xs font-medium text-muted-foreground", children: "Gradients" }),
|
|
1167
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-1", children: capability.gradientIds.map((gradientId) => /* @__PURE__ */ jsx(
|
|
1168
|
+
"button",
|
|
1169
|
+
{
|
|
1170
|
+
type: "button",
|
|
1171
|
+
className: `w-full rounded-md border px-2 py-1 text-left text-xs hover:bg-muted ${current.kind === "gradient" && current.gradientId === gradientId ? "border-foreground" : "bg-background"}`,
|
|
1172
|
+
onClick: chooseFromClick({ kind: "gradient", gradientId }),
|
|
1173
|
+
children: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
1174
|
+
/* @__PURE__ */ jsx(
|
|
1175
|
+
"span",
|
|
1176
|
+
{
|
|
1177
|
+
className: "h-4 w-8 shrink-0 rounded border",
|
|
1178
|
+
style: { backgroundImage: gradientPreviewCss(gradientId) }
|
|
1179
|
+
}
|
|
1180
|
+
),
|
|
1181
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: gradientLabel(gradientId) })
|
|
1182
|
+
] })
|
|
1183
|
+
},
|
|
1184
|
+
gradientId
|
|
1185
|
+
)) })
|
|
1186
|
+
] }) : null,
|
|
1187
|
+
capability.modes.includes("image") ? /* @__PURE__ */ jsxs("div", { children: [
|
|
1188
|
+
/* @__PURE__ */ jsx("div", { className: "mb-1 text-xs font-medium text-muted-foreground", children: "Images" }),
|
|
1189
|
+
mediaEditorContext ? /* @__PURE__ */ jsxs(
|
|
1190
|
+
"button",
|
|
1191
|
+
{
|
|
1192
|
+
type: "button",
|
|
1193
|
+
className: "mb-2 inline-flex w-full items-center justify-center gap-2 rounded-md border bg-background px-2 py-1.5 text-xs font-medium hover:bg-muted",
|
|
1194
|
+
onClick: (event) => {
|
|
1195
|
+
event.preventDefault();
|
|
1196
|
+
event.stopPropagation();
|
|
1197
|
+
setMediaPickerOpenKey((key) => key + 1);
|
|
1198
|
+
},
|
|
1199
|
+
children: [
|
|
1200
|
+
/* @__PURE__ */ jsx(Upload, { size: 13 }),
|
|
1201
|
+
"Media library"
|
|
1202
|
+
]
|
|
1203
|
+
}
|
|
1204
|
+
) : null,
|
|
1205
|
+
images.length ? /* @__PURE__ */ jsx("div", { className: "space-y-1", children: images.map((item) => /* @__PURE__ */ jsx(
|
|
1206
|
+
"button",
|
|
1207
|
+
{
|
|
1208
|
+
type: "button",
|
|
1209
|
+
className: `w-full rounded-md border px-2 py-1 text-left text-xs hover:bg-muted ${current.kind === "image" && current.mediaId === item.mediaId ? "border-foreground" : "bg-background"}`,
|
|
1210
|
+
onClick: chooseFromClick({ kind: "image", mediaId: item.mediaId }),
|
|
1211
|
+
children: /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
1212
|
+
/* @__PURE__ */ jsx("span", { className: "grid h-7 w-9 shrink-0 place-items-center rounded border bg-muted", children: /* @__PURE__ */ jsx(Image, { size: 14 }) }),
|
|
1213
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0", children: [
|
|
1214
|
+
/* @__PURE__ */ jsx("span", { className: "block truncate", children: item.label ?? "Image" }),
|
|
1215
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground", children: imageSourceLabel(item.source) })
|
|
1216
|
+
] })
|
|
1217
|
+
] })
|
|
1218
|
+
},
|
|
1219
|
+
`${item.source}:${item.mediaId}`
|
|
1220
|
+
)) }) : /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: imagePoolStatus === "loading" ? "Loading images..." : "No images available yet." }),
|
|
1221
|
+
mediaPickerOpenKey > 0 && mediaEditorContext ? /* @__PURE__ */ jsx("div", { onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx(
|
|
1222
|
+
MediaEditor,
|
|
1223
|
+
{
|
|
1224
|
+
value: void 0,
|
|
1225
|
+
onChange: chooseMediaValue,
|
|
1226
|
+
allowedKinds: ["image"],
|
|
1227
|
+
mediaPickerAutoOpen: true,
|
|
1228
|
+
showPreview: false,
|
|
1229
|
+
showAltInput: false,
|
|
1230
|
+
uploadIntent: { tag: "media-library", allowedRenderUses: ["image"] },
|
|
1231
|
+
onUploadComplete: (asset) => {
|
|
1232
|
+
onChoose({ kind: "image", mediaId: asset.id });
|
|
1233
|
+
setMediaPickerOpenKey(0);
|
|
1234
|
+
}
|
|
1235
|
+
},
|
|
1236
|
+
mediaPickerOpenKey
|
|
1237
|
+
) }) : null
|
|
1238
|
+
] }) : null
|
|
1239
|
+
] });
|
|
1240
|
+
}
|
|
893
1241
|
function computeDefaultFocus(blockKind, content) {
|
|
894
1242
|
const definition = getBlockDefinition(blockKind);
|
|
895
1243
|
if (!definition?.manifest) {
|
|
@@ -959,6 +1307,83 @@ function lookLabel(block) {
|
|
|
959
1307
|
}
|
|
960
1308
|
return option?.label ?? "Selected look";
|
|
961
1309
|
}
|
|
1310
|
+
function backgroundOverrideLabel(override) {
|
|
1311
|
+
switch (override.kind) {
|
|
1312
|
+
case "default":
|
|
1313
|
+
return "Default";
|
|
1314
|
+
case "color":
|
|
1315
|
+
return `Color: ${formatTokenLabel(override.token)}`;
|
|
1316
|
+
case "gradient":
|
|
1317
|
+
return `Gradient: ${gradientLabel(override.gradientId)}`;
|
|
1318
|
+
case "image":
|
|
1319
|
+
return "Image";
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
function BackgroundPreviewSwatch({ override }) {
|
|
1323
|
+
const baseClassName = "grid h-8 w-10 shrink-0 place-items-center overflow-hidden rounded-md border";
|
|
1324
|
+
switch (override.kind) {
|
|
1325
|
+
case "default":
|
|
1326
|
+
return /* @__PURE__ */ jsx("span", { className: `${baseClassName} bg-background`, children: /* @__PURE__ */ jsx("span", { className: "h-3 w-3 rounded-full border bg-muted" }) });
|
|
1327
|
+
case "color":
|
|
1328
|
+
return /* @__PURE__ */ jsx(
|
|
1329
|
+
"span",
|
|
1330
|
+
{
|
|
1331
|
+
className: baseClassName,
|
|
1332
|
+
style: { backgroundColor: tokenSwatchCss(override.token) }
|
|
1333
|
+
}
|
|
1334
|
+
);
|
|
1335
|
+
case "gradient":
|
|
1336
|
+
return /* @__PURE__ */ jsx(
|
|
1337
|
+
"span",
|
|
1338
|
+
{
|
|
1339
|
+
className: baseClassName,
|
|
1340
|
+
style: { backgroundImage: gradientPreviewCss(override.gradientId) }
|
|
1341
|
+
}
|
|
1342
|
+
);
|
|
1343
|
+
case "image":
|
|
1344
|
+
return /* @__PURE__ */ jsx("span", { className: `${baseClassName} bg-muted`, children: /* @__PURE__ */ jsx(Image, { size: 15 }) });
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
function backgroundModeLabel(mode) {
|
|
1348
|
+
return mode === "default" ? "Default" : formatVariantLabel(mode);
|
|
1349
|
+
}
|
|
1350
|
+
function gradientLabel(gradientId) {
|
|
1351
|
+
return GRADIENT_PRESETS.find((preset) => preset.id === gradientId)?.name ?? formatVariantLabel(gradientId);
|
|
1352
|
+
}
|
|
1353
|
+
function imageSourceLabel(source) {
|
|
1354
|
+
switch (source) {
|
|
1355
|
+
case "current":
|
|
1356
|
+
return "Current";
|
|
1357
|
+
case "generated-ambient":
|
|
1358
|
+
return "Generated";
|
|
1359
|
+
case "previous-background":
|
|
1360
|
+
return "Previous";
|
|
1361
|
+
case "general-media":
|
|
1362
|
+
return "Media library";
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
function tokenSwatchCss(token) {
|
|
1366
|
+
return `rgb(var(--tb-${token}))`;
|
|
1367
|
+
}
|
|
1368
|
+
function gradientPreviewCss(gradientId) {
|
|
1369
|
+
const preset = GRADIENT_PRESETS.find((candidate) => candidate.id === gradientId);
|
|
1370
|
+
if (!preset) return "linear-gradient(135deg, rgb(var(--tb-primary)), rgb(var(--tb-secondary)))";
|
|
1371
|
+
const stops = preset.stops.map((stop) => `${tokenSwatchCss(stop.color)} ${stop.position}%`).join(", ");
|
|
1372
|
+
return preset.type === "radial" ? `radial-gradient(circle, ${stops})` : `linear-gradient(${preset.angle ?? 135}deg, ${stops})`;
|
|
1373
|
+
}
|
|
1374
|
+
function formatTokenLabel(token) {
|
|
1375
|
+
return formatVariantLabel(token.replace(/\//g, " "));
|
|
1376
|
+
}
|
|
1377
|
+
function dedupeBackgroundImagePool(items) {
|
|
1378
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1379
|
+
const deduped = [];
|
|
1380
|
+
for (const item of items) {
|
|
1381
|
+
if (seen.has(item.mediaId)) continue;
|
|
1382
|
+
seen.add(item.mediaId);
|
|
1383
|
+
deduped.push(item);
|
|
1384
|
+
}
|
|
1385
|
+
return deduped;
|
|
1386
|
+
}
|
|
962
1387
|
function BoundaryControl({
|
|
963
1388
|
previousBlockId,
|
|
964
1389
|
nextBlockId,
|
|
@@ -3094,11 +3519,11 @@ function renderPreviewDocument({
|
|
|
3094
3519
|
}
|
|
3095
3520
|
var previewContainerResponsiveEnabled = process.env.NEXT_PUBLIC_ENABLE_PREVIEW_CONTAINER_RESPONSIVE !== "false";
|
|
3096
3521
|
var PreviewEditorSidebar = React9.lazy(async () => {
|
|
3097
|
-
const mod = await import('./PreviewEditorSidebar-
|
|
3522
|
+
const mod = await import('./PreviewEditorSidebar-56NMJMIK.mjs');
|
|
3098
3523
|
return { default: mod.PreviewEditorSidebar };
|
|
3099
3524
|
});
|
|
3100
3525
|
var PreviewEditorUI = React9.lazy(async () => {
|
|
3101
|
-
const mod = await import('./PreviewEditorUI-
|
|
3526
|
+
const mod = await import('./PreviewEditorUI-27KJVEET.mjs');
|
|
3102
3527
|
return { default: mod.PreviewEditorUI };
|
|
3103
3528
|
});
|
|
3104
3529
|
var previewPaneContainmentStyle = {
|
|
@@ -3574,59 +3999,69 @@ function PreviewShell({
|
|
|
3574
3999
|
initialBlocks,
|
|
3575
4000
|
pageMetadata,
|
|
3576
4001
|
apiClient,
|
|
3577
|
-
children: /* @__PURE__ */
|
|
4002
|
+
children: /* @__PURE__ */ jsx(
|
|
3578
4003
|
PreviewPageDesignEditorStateProvider,
|
|
3579
4004
|
{
|
|
3580
4005
|
apiClient,
|
|
3581
4006
|
siteId,
|
|
3582
4007
|
pageId,
|
|
3583
4008
|
enabled: designEditorEnabled,
|
|
3584
|
-
children:
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
4009
|
+
children: /* @__PURE__ */ jsxs(
|
|
4010
|
+
MediaEditorProvider,
|
|
4011
|
+
{
|
|
4012
|
+
siteId,
|
|
4013
|
+
apiClient,
|
|
4014
|
+
bearerToken: previewToken,
|
|
4015
|
+
supabaseUrl,
|
|
4016
|
+
mediaAssets,
|
|
4017
|
+
children: [
|
|
4018
|
+
/* @__PURE__ */ jsx(PreviewKeepAliveClient, { baseFetch }),
|
|
4019
|
+
/* @__PURE__ */ jsx(
|
|
4020
|
+
PreviewShellLayout,
|
|
4021
|
+
{
|
|
4022
|
+
theme,
|
|
4023
|
+
surfaceId,
|
|
4024
|
+
siteId,
|
|
4025
|
+
dashboardBaseUrl,
|
|
4026
|
+
pageId,
|
|
4027
|
+
entryData: entryData ?? null,
|
|
4028
|
+
contentTypeSchema,
|
|
4029
|
+
referenceContentTypeKeys,
|
|
4030
|
+
draftContent,
|
|
4031
|
+
currentTemplate,
|
|
4032
|
+
apiClient,
|
|
4033
|
+
bearerToken: previewToken,
|
|
4034
|
+
themeId,
|
|
4035
|
+
themeSelectionId,
|
|
4036
|
+
themeSelectionVersion,
|
|
4037
|
+
themeSelectionUpdatedAt,
|
|
4038
|
+
themeSelectionButtonPersonalityId,
|
|
4039
|
+
themeSelectionPaletteVariantId,
|
|
4040
|
+
themeSelectionPaletteOverrides,
|
|
4041
|
+
themeSelectionHeaderLayoutId,
|
|
4042
|
+
themeSelectionHeaderStyleId,
|
|
4043
|
+
themeSelectionTypographyPresetId,
|
|
4044
|
+
themeSelectionTypographyBodyFontOverride,
|
|
4045
|
+
themeSelectionTypographyHeadingFontOverride,
|
|
4046
|
+
themeSelectionHeaderLookId,
|
|
4047
|
+
themeSelectionFooterLookId,
|
|
4048
|
+
themeSelectionHeaderContext,
|
|
4049
|
+
themeSelectionFooterContext,
|
|
4050
|
+
supabaseUrl,
|
|
4051
|
+
isSiteLaunched,
|
|
4052
|
+
maintenanceModeEnabled,
|
|
4053
|
+
entrySubrouteContext,
|
|
4054
|
+
assistantPanel,
|
|
4055
|
+
sdkConfig: sdkConfig ?? null,
|
|
4056
|
+
mediaAssets,
|
|
4057
|
+
useThemeScope,
|
|
4058
|
+
siteStyleAccess,
|
|
4059
|
+
children
|
|
4060
|
+
}
|
|
4061
|
+
)
|
|
4062
|
+
]
|
|
4063
|
+
}
|
|
4064
|
+
)
|
|
3630
4065
|
}
|
|
3631
4066
|
)
|
|
3632
4067
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { ApiRequestError, markPreviewAuthExpired } from './chunk-
|
|
2
|
+
import { ApiRequestError, markPreviewAuthExpired } from './chunk-K2IIF34C.mjs';
|
|
3
3
|
import { createContext, useContext, useRef } from 'react';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
import { QueryClient, MutationCache, QueryCache, QueryClientProvider } from '@tanstack/react-query';
|