@riverbankcms/sdk 0.76.0 → 0.77.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PreviewEditorSidebar-X2HWXFOL.mjs → PreviewEditorSidebar-DVUG7GK4.mjs} +1019 -442
- package/dist/{PreviewEditorUI-AQXIXPOH.mjs → PreviewEditorUI-P7RN4CDS.mjs} +2 -2
- package/dist/SdkPreviewModeRuntime-KLPX47SE.mjs +8 -0
- package/dist/_dts/ai/src/contracts/proposals.d.ts +538 -20
- package/dist/_dts/api/src/contentRuntime.d.ts +5 -0
- package/dist/_dts/api/src/siteAssets.d.ts +1 -0
- package/dist/_dts/api/src/siteRuntimeEndpoints.d.ts +26 -2
- package/dist/_dts/block-form/src/blockDraftSaveability.d.ts +28 -0
- package/dist/_dts/block-form/src/client/index.d.ts +2 -2
- package/dist/_dts/block-form/src/index.d.ts +2 -1
- package/dist/_dts/block-form/src/widgets/DateField/dateFieldSchema.d.ts +1 -1
- package/dist/_dts/block-form/src/widgets/DateTimeField/dateTimeFieldSchema.d.ts +1 -1
- package/dist/_dts/block-form/src/widgets/TimeField/timeFieldSchema.d.ts +1 -1
- package/dist/_dts/blocks/src/PageRenderer.d.ts +10 -10
- package/dist/_dts/blocks/src/client/site-chrome.d.ts +22 -0
- package/dist/_dts/blocks/src/customBlockRegistry.d.ts +57 -0
- package/dist/_dts/blocks/src/index.d.ts +2 -0
- package/dist/_dts/blocks/src/system/blocks/faq.d.ts +20 -2
- package/dist/_dts/blocks/src/system/blocks/feature-cards.d.ts +25 -0
- package/dist/_dts/blocks/src/system/blocks/index.d.ts +2 -0
- package/dist/_dts/blocks/src/system/blocks/intro.d.ts +24 -0
- package/dist/_dts/blocks/src/system/blocks/media-text.d.ts +3 -34
- package/dist/_dts/blocks/src/system/blocks/site-header.d.ts +2 -2
- package/dist/_dts/blocks/src/system/constants/blockKinds.d.ts +1 -1
- package/dist/_dts/blocks/src/system/fields/aspectRatio.d.ts +30 -0
- package/dist/_dts/blocks/src/system/fields/boxStyles.d.ts +4 -1
- package/dist/_dts/blocks/src/system/fields/ctas.d.ts +7 -0
- package/dist/_dts/blocks/src/system/manifest/fieldValidation/index.d.ts +16 -2
- package/dist/_dts/blocks/src/system/node/validation-constants.d.ts +1 -1
- package/dist/_dts/blocks/src/system/runtime/components/multi-step/runtimeFormValidation.d.ts +28 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/accordion.d.ts +2 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/accordion.server.d.ts +2 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/accordionIconTreatment.d.ts +5 -0
- package/dist/_dts/blocks/src/system/transforms/registry/layout.d.ts +5 -4
- package/dist/_dts/blocks/src/system/transforms/typed.d.ts +2 -1
- package/dist/_dts/content-editor/src/controller/EntryControllerProvider.d.ts +2 -0
- package/dist/_dts/content-editor/src/hooks/blockDraftLifecycle.d.ts +48 -0
- package/dist/_dts/content-editor/src/hooks/invalidBlockSelectors.d.ts +4 -0
- package/dist/_dts/content-editor/src/hooks/publishability.d.ts +47 -0
- package/dist/_dts/content-editor/src/index.d.ts +1 -0
- package/dist/_dts/db/src/generated/supabase/database.types.d.ts +20 -0
- package/dist/_dts/editor-blocks/src/BlockEditor.d.ts +2 -1
- package/dist/_dts/editor-blocks/src/block-editor/SortableBlockItem.d.ts +2 -1
- package/dist/_dts/editor-blocks/src/block-editor/customBlockRegistry.d.ts +2 -0
- package/dist/_dts/editor-blocks/src/block-editor/sdkBlockMerger.d.ts +9 -37
- package/dist/_dts/editor-blocks/src/index.d.ts +2 -2
- package/dist/_dts/preview-next/src/client/index.d.ts +3 -0
- package/dist/_dts/preview-next/src/client/layout/PreviewLayoutContext.d.ts +5 -1
- package/dist/_dts/preview-next/src/client/preview/PreviewDesignCoordinatorContext.d.ts +20 -0
- package/dist/_dts/preview-next/src/client/preview/PreviewEditorSidebar.d.ts +7 -2
- package/dist/_dts/preview-next/src/client/preview/PreviewShell.d.ts +7 -2
- package/dist/_dts/preview-next/src/client/preview/PreviewShellLayout.d.ts +7 -2
- package/dist/_dts/preview-next/src/client/preview/PreviewThemedSiteDocument.d.ts +18 -0
- package/dist/_dts/preview-next/src/client/preview/SiteChromeCustomizeContext.d.ts +20 -3
- package/dist/_dts/preview-next/src/client/preview/StyleConfigurator.d.ts +6 -1
- package/dist/_dts/preview-next/src/client/preview/StyleConfigurator.state.d.ts +14 -4
- package/dist/_dts/preview-next/src/client/preview/previewDesignCoordinator.d.ts +73 -0
- package/dist/_dts/preview-next/src/client/preview/siteChromeLookRows.d.ts +12 -4
- package/dist/_dts/preview-next/src/client/preview/siteStylePreviewPlanner.d.ts +46 -0
- package/dist/_dts/preview-next/src/client/preview/styleConfiguratorSnapshot.d.ts +6 -1
- package/dist/_dts/preview-next/src/client/preview/typographySelectionInput.d.ts +14 -0
- package/dist/_dts/preview-next/src/client/sdk/SdkPreviewModeRuntime.d.ts +1 -1
- package/dist/_dts/sdk/src/cli/commands/style.d.ts +8 -0
- package/dist/_dts/sdk/src/client/management/types.d.ts +6 -1
- package/dist/_dts/sdk/src/client/types.d.ts +9 -0
- package/dist/_dts/sdk/src/client.d.ts +1 -1
- package/dist/_dts/sdk/src/contracts/system-block-content.d.ts +35 -0
- package/dist/_dts/sdk/src/contracts/theme.d.ts +1 -1
- package/dist/_dts/sdk/src/index.d.ts +2 -1
- package/dist/_dts/sdk/src/public-api/contracts.d.ts +5 -0
- package/dist/_dts/sdk/src/rendering/components/Layout.d.ts +2 -2
- package/dist/_dts/sdk/src/types/block-kinds.d.ts +1 -1
- package/dist/_dts/sdk/src/version.d.ts +1 -1
- package/dist/_dts/site-commands/src/commands.d.ts +15 -0
- package/dist/_dts/theme-core/src/buttons/personalities/earth-pill.d.ts +16 -0
- package/dist/_dts/theme-core/src/buttons/personalities/index.d.ts +11 -0
- package/dist/_dts/theme-core/src/fonts/types.d.ts +1 -1
- package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
- package/dist/_dts/theme-core/src/mock-themes/all.d.ts +72 -27
- package/dist/_dts/theme-core/src/palette/variants/index.d.ts +15 -0
- package/dist/_dts/theme-core/src/palette/variants/warm-neutral.d.ts +16 -0
- package/dist/_dts/theme-core/src/schema.d.ts +306 -30
- package/dist/_dts/theme-core/src/site-styles/appearancePresetCatalog.d.ts +81 -0
- package/dist/_dts/theme-core/src/site-styles/appearancePresetTypes.d.ts +6 -4
- package/dist/_dts/theme-core/src/site-styles/blockAppearancePresets.d.ts +81 -0
- package/dist/_dts/theme-core/src/site-styles/curatedSiteStyles.d.ts +119 -3
- package/dist/_dts/theme-core/src/site-styles/designState.d.ts +4 -4
- package/dist/_dts/theme-core/src/site-styles/footerLooks.d.ts +13 -0
- package/dist/_dts/theme-core/src/site-styles/generatedSchemas.d.ts +4 -2
- package/dist/_dts/theme-core/src/site-styles/headerLooks.d.ts +402 -13
- package/dist/_dts/theme-core/src/site-styles/headerOpeningSection.d.ts +6 -0
- package/dist/_dts/theme-core/src/site-styles/index.d.ts +2 -0
- package/dist/_dts/theme-core/src/site-styles/persistedIdParseResult.d.ts +9 -0
- package/dist/_dts/theme-core/src/site-styles/previewCompiler.d.ts +20 -4
- package/dist/_dts/theme-core/src/site-styles/types.d.ts +74 -2
- package/dist/_dts/theme-core/src/site-styles/typographyPresets.d.ts +189 -0
- package/dist/{chunk-Q4OLG66B.mjs → chunk-2SPENC5M.mjs} +476 -153
- package/dist/{chunk-Z7JLNTJR.mjs → chunk-6SMUFTXD.mjs} +2 -1
- package/dist/{chunk-TW2Y4RR5.mjs → chunk-IENWFSLO.mjs} +365 -52
- package/dist/{chunk-LYI7TEMH.mjs → chunk-KWJPDZH2.mjs} +4682 -1463
- package/dist/{chunk-V5VORNEJ.mjs → chunk-ZYEJLCTN.mjs} +1 -1
- package/dist/cli/index.mjs +2314 -267
- package/dist/client/{accordion-2YHIBOZH.mjs → accordion-RZMQSYLR.mjs} +1 -1
- package/dist/client/{bookingForm-35IBDWAS.mjs → bookingForm-NF4ASVNV.mjs} +2 -2
- package/dist/client/bookings.mjs +92 -0
- package/dist/client/{carousel-K6XG7NZQ.mjs → carousel-LDX47ZIK.mjs} +1 -1
- package/dist/client/{cart-HCFYUTTU.mjs → cart-RGXDS5F4.mjs} +3 -3
- package/dist/client/{checkout-J3U4XR7K.mjs → checkout-P7WWSNNY.mjs} +3 -3
- package/dist/client/{chunk-BOIHIU7E.mjs → chunk-E2TDNXCL.mjs} +1 -1
- package/dist/client/{chunk-PFBX3IQL.mjs → chunk-GMVTOKYG.mjs} +2 -2
- package/dist/client/{chunk-FGUIVT2B.mjs → chunk-JNC7CGHX.mjs} +1 -1
- package/dist/client/{chunk-SNSWVZEP.mjs → chunk-L3DNHIJX.mjs} +3 -3
- package/dist/client/{chunk-7UOSCYY4.mjs → chunk-R56FQ3RR.mjs} +92 -0
- package/dist/client/{chunk-J227A3CQ.mjs → chunk-UFSWADAO.mjs} +1 -1
- package/dist/client/client.mjs +3579 -1351
- package/dist/client/{courseRegistration-ZBXS7VGI.mjs → courseRegistration-7F65K5ZR.mjs} +2 -2
- package/dist/client/{eventCalendar-EQQZHJBA.mjs → eventCalendar-GLSC5KTL.mjs} +4 -4
- package/dist/client/{eventCombined-JCFTGBFQ.mjs → eventCombined-ZHK4WKUR.mjs} +4 -4
- package/dist/client/{eventDetails-HLUTQSYY.mjs → eventDetails-E3PJYBIN.mjs} +4 -4
- package/dist/client/{eventListing-FG4MICVB.mjs → eventListing-EMS3WC3E.mjs} +4 -4
- package/dist/client/{eventRegistration-GUEB7LBT.mjs → eventRegistration-NZOTVNPI.mjs} +4 -4
- package/dist/client/{form-YQEW4YIT.mjs → form-ETFZFATW.mjs} +1 -1
- package/dist/client/{headerSection-GTR3TTRM.mjs → headerSection-4LBP7ULT.mjs} +2 -2
- package/dist/client/hooks.mjs +2226 -402
- package/dist/client/{locationMap-SPC7VGUH.mjs → locationMap-5M655YSJ.mjs} +1 -1
- package/dist/client/{newsletterForm-4IW5BLID.mjs → newsletterForm-QOUYW44O.mjs} +1 -1
- package/dist/client/{productDetail-KP5H2WJO.mjs → productDetail-O4DOCWQG.mjs} +3 -3
- package/dist/client/{productList-3M3M72XZ.mjs → productList-A5RO5WIS.mjs} +3 -3
- package/dist/client/rendering/client.mjs +198 -32
- package/dist/client/rendering/islands.mjs +18 -18
- package/dist/client/rendering.mjs +3573 -1355
- package/dist/client/{shop-ACQKVGOM.mjs → shop-L4MZH4I2.mjs} +3 -3
- package/dist/preview-next/client/runtime.mjs +4 -4
- package/dist/{sdk-runtime-K7HNB4U2.mjs → sdk-runtime-6UT2S7KZ.mjs} +5 -5
- package/dist/server/components.mjs +3497 -1333
- package/dist/server/config-validation.mjs +2229 -402
- package/dist/server/config.mjs +2229 -402
- package/dist/server/data.mjs +2226 -402
- package/dist/server/index.mjs +31 -2
- package/dist/server/next.mjs +3503 -1329
- package/dist/server/page-converter.mjs +2213 -403
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/rendering/server.mjs +3497 -1333
- package/dist/server/rendering.mjs +3497 -1333
- package/dist/server/routing.mjs +2250 -363
- package/dist/server/server.mjs +2243 -400
- package/dist/server/theme-bridge.mjs +1313 -1035
- package/dist/server/theme.mjs +237 -12
- package/dist/styles/index.css +1081 -1028
- package/package.json +1 -1
- package/dist/SdkPreviewModeRuntime-ZQNDCASH.mjs +0 -8
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useOptionalPreviewLayout, PreviewQueryProvider } from './chunk-
|
|
3
|
-
import { PreviewThemeOverlayProvider, resolveSiteStyleAccess,
|
|
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,
|
|
2
|
+
import { useOptionalPreviewLayout, PreviewQueryProvider } from './chunk-6SMUFTXD.mjs';
|
|
3
|
+
import { PreviewThemeOverlayProvider, PreviewDesignCoordinatorProvider, resolveSiteStyleAccess, usePreviewDesignCoordinator, createOptimisticActionRunner, resolveStyleConfiguratorInitialSnapshot, createStyleConfiguratorState, syncStyleConfiguratorState, buildSiteChromeLookModels, planSiteStylePreviewChange, markApplyFailed, markApplySaved, markApplySaving, previewHeaderStyle, previewFooterLook, cycleSiteChromeLookId, usePreviewThemeOverlay, resolvePreviewDashboardSetupHandoff, buildPreviewDashboardSetupUrl, resolvePreviewSetupBannerModel, planSiteChromeLookSelection, sanitizeDashboardPath } from './chunk-IENWFSLO.mjs';
|
|
4
|
+
import { resolvePreviewChromeSurface, getPreviewSidebarTab, onPreviewSidebarOpenRequest, getPreviewChromeSurfaceDataProps, PREVIEW_CHROME_THEME_CLASS_NAME, setPreviewSidebarTab, PreviewPageDesignEditorStateProvider, usePreviewPageDesignEditorState, PREVIEW_SURFACE_PARAM } from './chunk-ZYEJLCTN.mjs';
|
|
5
|
+
import { clientComponentRegistry, deriveLaunchReadiness, DEFAULT_LAUNCH_READINESS_INPUT, useEditorUiStore, ResizableSplitPane, BlockApiProvider, EditorProvider, getCuratedSiteStyle, useEditor, createRoutingHelpers, createSnapshotFromPageRecord, EntryControllerProvider, useEntryEditorController, useEditorUiStoreInstance, surfaceResolutionContextFromTheme, asEditorBlockId, EditableBlockProvider, asDesignBlockId, PageRenderer, planSiteDocument, ThemeScope, FixedBottomSurface, Button, unwrapResponse, X, ChevronLeft, ChevronRight, RotateCcw, PreviewRichTextEditor, RichText, PreviewTextEditor, Text, buildThemeRuntime, renderBlock, siteHeaderManifest, siteFooterManifest, SiteDocumentLayout, Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, buildEditorModelRuntimeFieldsByBlockId, applyCompiledRuntimeFieldsToContent, assertNever2, getBlockDefinition, systemCustomizeFacetDefinitionsForBlock, systemCustomizeFacetAppliesToLayoutVariant, systemCustomizeFacetCurrentValue, systemCustomizeFacetLabelForValue, systemCustomizeFacetNextValue, assertNever } from './chunk-KWJPDZH2.mjs';
|
|
6
6
|
import { API_ENDPOINTS, createBearerAPIClient, isPreviewRuntimeSessionEditable, DEFAULT_SURFACE_ID, initPreviewAuth, usePreviewAuth, usePreviewAuthFetch, markPreviewAuthExpired, usePreviewToken, parseSurfaceId } from './chunk-VX7B5VAC.mjs';
|
|
7
|
-
import
|
|
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
|
|
|
10
10
|
// ../preview-next/src/client/utils/path.ts
|
|
@@ -2323,7 +2323,8 @@ function SiteChromeCustomizeProvider({
|
|
|
2323
2323
|
footerSelectionContext,
|
|
2324
2324
|
siteStyleAccess = { kind: "hidden" }
|
|
2325
2325
|
}) {
|
|
2326
|
-
const
|
|
2326
|
+
const previewDesign = usePreviewDesignCoordinator();
|
|
2327
|
+
const { clearPreview, previewTheme } = previewDesign;
|
|
2327
2328
|
const runnerRef = useRef(createOptimisticActionRunner());
|
|
2328
2329
|
const saveQueueRef = useRef(Promise.resolve());
|
|
2329
2330
|
const latestSelectionUpdatedAtRef = useRef(
|
|
@@ -2347,9 +2348,13 @@ function SiteChromeCustomizeProvider({
|
|
|
2347
2348
|
() => baseSnapshot ? createStyleConfiguratorState(baseSnapshot) : null
|
|
2348
2349
|
);
|
|
2349
2350
|
const stateRef = useRef(state);
|
|
2351
|
+
const clearPreviewRef = useRef(clearPreview);
|
|
2350
2352
|
useEffect(() => {
|
|
2351
2353
|
stateRef.current = state;
|
|
2352
2354
|
}, [state]);
|
|
2355
|
+
useEffect(() => {
|
|
2356
|
+
clearPreviewRef.current = clearPreview;
|
|
2357
|
+
}, [clearPreview]);
|
|
2353
2358
|
useEffect(() => {
|
|
2354
2359
|
latestSelectionUpdatedAtRef.current = baseSnapshot?.selectionUpdatedAt ?? null;
|
|
2355
2360
|
}, [baseSnapshot?.selectionUpdatedAt]);
|
|
@@ -2366,9 +2371,9 @@ function SiteChromeCustomizeProvider({
|
|
|
2366
2371
|
const runner = runnerRef.current;
|
|
2367
2372
|
return () => {
|
|
2368
2373
|
runner.invalidate();
|
|
2369
|
-
|
|
2374
|
+
clearPreviewRef.current("site-chrome");
|
|
2370
2375
|
};
|
|
2371
|
-
}, [
|
|
2376
|
+
}, []);
|
|
2372
2377
|
const lookModels = useMemo(() => {
|
|
2373
2378
|
if (!state) return null;
|
|
2374
2379
|
const siteStyle = getCuratedSiteStyle(state.previewed.siteStyleId);
|
|
@@ -2384,19 +2389,38 @@ function SiteChromeCustomizeProvider({
|
|
|
2384
2389
|
const getSurfaceState = useCallback(
|
|
2385
2390
|
(surface) => {
|
|
2386
2391
|
if (!state || !lookModels) return { kind: "unavailable" };
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
+
if (surface === "header") {
|
|
2393
|
+
const currentId2 = state.previewed.headerStyleId;
|
|
2394
|
+
const selected2 = lookModels.headerStyle.options.find((option) => option.id === currentId2);
|
|
2395
|
+
const rendered2 = lookModels.headerStyle.options.find(
|
|
2396
|
+
(option) => option.id === lookModels.headerStyle.renderedStyleId
|
|
2397
|
+
);
|
|
2398
|
+
return {
|
|
2399
|
+
kind: "available",
|
|
2400
|
+
surface: "header",
|
|
2401
|
+
label: "Header",
|
|
2402
|
+
currentId: currentId2,
|
|
2403
|
+
currentLabel: selected2?.label ?? (rendered2 ? `${rendered2.label} (default)` : "Unknown Look"),
|
|
2404
|
+
options: lookModels.headerStyle.options,
|
|
2405
|
+
diagnostics: [],
|
|
2406
|
+
saving: state.saveStatus.kind === "saving",
|
|
2407
|
+
failure: state.saveStatus.kind === "failed" ? state.saveStatus.message : null,
|
|
2408
|
+
applyAllowed
|
|
2409
|
+
};
|
|
2410
|
+
}
|
|
2411
|
+
const currentId = state.previewed.footerLookId;
|
|
2412
|
+
const selected = lookModels.footer.options.find((option) => option.id === currentId);
|
|
2413
|
+
const rendered = lookModels.footer.options.find(
|
|
2414
|
+
(option) => option.id === lookModels.footer.renderedLookId
|
|
2392
2415
|
);
|
|
2393
2416
|
return {
|
|
2394
2417
|
kind: "available",
|
|
2395
|
-
|
|
2418
|
+
surface: "footer",
|
|
2419
|
+
label: "Footer",
|
|
2396
2420
|
currentId,
|
|
2397
2421
|
currentLabel: selected?.label ?? (currentId ? "Unknown Look" : `${rendered?.label ?? "Site style"} (default)`),
|
|
2398
|
-
options:
|
|
2399
|
-
diagnostics:
|
|
2422
|
+
options: lookModels.footer.options,
|
|
2423
|
+
diagnostics: lookModels.footer.diagnostics,
|
|
2400
2424
|
saving: state.saveStatus.kind === "saving",
|
|
2401
2425
|
failure: state.saveStatus.kind === "failed" ? state.saveStatus.message : null,
|
|
2402
2426
|
applyAllowed
|
|
@@ -2408,19 +2432,16 @@ function SiteChromeCustomizeProvider({
|
|
|
2408
2432
|
(surface, nextSnapshot) => {
|
|
2409
2433
|
const siteStyle = getCuratedSiteStyle(nextSnapshot.siteStyleId);
|
|
2410
2434
|
if (!siteStyle) return;
|
|
2411
|
-
const compiled =
|
|
2435
|
+
const compiled = planSiteStylePreviewChange({
|
|
2412
2436
|
siteStyle,
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
paletteOverrides: nextSnapshot.paletteOverrides,
|
|
2416
|
-
headerLookId: nextSnapshot.headerLookId,
|
|
2417
|
-
footerLookId: nextSnapshot.footerLookId,
|
|
2437
|
+
selection: nextSnapshot,
|
|
2438
|
+
baseTheme: theme,
|
|
2418
2439
|
headerSelectionContext,
|
|
2419
2440
|
footerSelectionContext
|
|
2420
2441
|
});
|
|
2421
2442
|
void runnerRef.current.run({
|
|
2422
2443
|
optimistic: () => {
|
|
2423
|
-
|
|
2444
|
+
previewTheme("site-chrome", compiled.themeOverlay, "site-chrome");
|
|
2424
2445
|
setState((latest) => {
|
|
2425
2446
|
if (!latest) return latest;
|
|
2426
2447
|
return markApplySaving({ ...latest, previewed: nextSnapshot });
|
|
@@ -2431,14 +2452,16 @@ function SiteChromeCustomizeProvider({
|
|
|
2431
2452
|
const body = surface === "header" ? {
|
|
2432
2453
|
surface,
|
|
2433
2454
|
lookId: nextSnapshot.headerLookId,
|
|
2434
|
-
|
|
2455
|
+
layoutId: nextSnapshot.headerLayoutId,
|
|
2456
|
+
styleId: nextSnapshot.headerStyleId,
|
|
2457
|
+
theme: compiled.themeOverlay,
|
|
2435
2458
|
themeId: themeId ?? null,
|
|
2436
2459
|
selectionId: selectionId ?? null,
|
|
2437
2460
|
baseSelectionUpdatedAt: latestSelectionUpdatedAtRef.current
|
|
2438
2461
|
} : {
|
|
2439
2462
|
surface,
|
|
2440
2463
|
lookId: nextSnapshot.footerLookId,
|
|
2441
|
-
theme: compiled.
|
|
2464
|
+
theme: compiled.themeOverlay,
|
|
2442
2465
|
themeId: themeId ?? null,
|
|
2443
2466
|
selectionId: selectionId ?? null,
|
|
2444
2467
|
baseSelectionUpdatedAt: latestSelectionUpdatedAtRef.current
|
|
@@ -2468,7 +2491,12 @@ function SiteChromeCustomizeProvider({
|
|
|
2468
2491
|
buttonPersonalityId: compiled.resolvedSelections.buttonPersonalityId,
|
|
2469
2492
|
paletteVariantId: compiled.resolvedSelections.paletteVariantId,
|
|
2470
2493
|
paletteOverrides: nextSnapshot.paletteOverrides,
|
|
2494
|
+
typographyPresetId: compiled.resolvedSelections.typographyPresetId,
|
|
2495
|
+
typographyBodyFontOverride: compiled.resolvedSelections.typographyBodyFontOverride,
|
|
2496
|
+
typographyHeadingFontOverride: compiled.resolvedSelections.typographyHeadingFontOverride,
|
|
2471
2497
|
headerLookId: saved.headerLookId ?? nextSnapshot.headerLookId,
|
|
2498
|
+
headerLayoutId: saved.headerLayoutId ?? compiled.resolvedSelections.headerLayoutId,
|
|
2499
|
+
headerStyleId: saved.headerStyleId ?? compiled.resolvedSelections.headerStyleId,
|
|
2472
2500
|
footerLookId: saved.footerLookId ?? nextSnapshot.footerLookId
|
|
2473
2501
|
};
|
|
2474
2502
|
setState((latest) => latest ? markApplySaved(latest, persisted) : latest);
|
|
@@ -2483,26 +2511,30 @@ function SiteChromeCustomizeProvider({
|
|
|
2483
2511
|
apiClient,
|
|
2484
2512
|
footerSelectionContext,
|
|
2485
2513
|
headerSelectionContext,
|
|
2514
|
+
previewTheme,
|
|
2486
2515
|
selectionId,
|
|
2487
|
-
setOverrideTheme,
|
|
2488
2516
|
siteId,
|
|
2489
|
-
themeId
|
|
2517
|
+
themeId,
|
|
2518
|
+
theme
|
|
2490
2519
|
]
|
|
2491
2520
|
);
|
|
2492
|
-
const
|
|
2493
|
-
(
|
|
2521
|
+
const selectHeaderStyle = useCallback(
|
|
2522
|
+
(styleId) => {
|
|
2494
2523
|
if (!applyAllowed) return;
|
|
2495
2524
|
const current = stateRef.current;
|
|
2496
2525
|
if (!current) return;
|
|
2497
|
-
const
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2526
|
+
const nextState = previewHeaderStyle(current, styleId);
|
|
2527
|
+
persistSelection("header", nextState.previewed);
|
|
2528
|
+
},
|
|
2529
|
+
[applyAllowed, persistSelection]
|
|
2530
|
+
);
|
|
2531
|
+
const selectFooterLook = useCallback(
|
|
2532
|
+
(lookId) => {
|
|
2533
|
+
if (!applyAllowed) return;
|
|
2534
|
+
const current = stateRef.current;
|
|
2535
|
+
if (!current) return;
|
|
2536
|
+
const nextState = previewFooterLook(current, planFooterLookSelection(lookId));
|
|
2537
|
+
persistSelection("footer", nextState.previewed);
|
|
2506
2538
|
},
|
|
2507
2539
|
[applyAllowed, persistSelection]
|
|
2508
2540
|
);
|
|
@@ -2510,16 +2542,23 @@ function SiteChromeCustomizeProvider({
|
|
|
2510
2542
|
(surface, direction) => {
|
|
2511
2543
|
const currentState = getSurfaceState(surface);
|
|
2512
2544
|
if (currentState.kind !== "available") return;
|
|
2545
|
+
if (currentState.surface === "header") {
|
|
2546
|
+
const next2 = cycleSiteChromeLookId(
|
|
2547
|
+
currentState.options,
|
|
2548
|
+
currentState.currentId,
|
|
2549
|
+
direction
|
|
2550
|
+
);
|
|
2551
|
+
if (next2 !== void 0 && next2 !== null) selectHeaderStyle(next2);
|
|
2552
|
+
return;
|
|
2553
|
+
}
|
|
2513
2554
|
const next = cycleSiteChromeLookId(
|
|
2514
2555
|
currentState.options,
|
|
2515
2556
|
currentState.currentId,
|
|
2516
2557
|
direction
|
|
2517
2558
|
);
|
|
2518
|
-
if (next !== void 0)
|
|
2519
|
-
selectSurfaceLook(surface, next);
|
|
2520
|
-
}
|
|
2559
|
+
if (next !== void 0) selectFooterLook(next);
|
|
2521
2560
|
},
|
|
2522
|
-
[getSurfaceState,
|
|
2561
|
+
[getSurfaceState, selectFooterLook, selectHeaderStyle]
|
|
2523
2562
|
);
|
|
2524
2563
|
const value = useMemo(
|
|
2525
2564
|
() => ({
|
|
@@ -2530,13 +2569,351 @@ function SiteChromeCustomizeProvider({
|
|
|
2530
2569
|
);
|
|
2531
2570
|
return /* @__PURE__ */ jsx(SiteChromeCustomizeContext.Provider, { value, children });
|
|
2532
2571
|
}
|
|
2572
|
+
function planFooterLookSelection(lookId) {
|
|
2573
|
+
const plan = planSiteChromeLookSelection({ surface: "footer", lookId });
|
|
2574
|
+
if (plan.kind !== "footer") return lookId;
|
|
2575
|
+
return plan.next.footerLookId;
|
|
2576
|
+
}
|
|
2577
|
+
function useSiteChromeCustomizeOptional() {
|
|
2578
|
+
return useContext(SiteChromeCustomizeContext);
|
|
2579
|
+
}
|
|
2580
|
+
|
|
2581
|
+
// ../blocks/src/client/site-chrome.tsx
|
|
2582
|
+
function renderSiteChromeBlock(model, surface, theme) {
|
|
2583
|
+
const spec = model[surface];
|
|
2584
|
+
const themeConfig = applyThemeConfigOverride(theme, spec.themeConfigOverride);
|
|
2585
|
+
const themeRuntime = buildThemeRuntime(themeConfig);
|
|
2586
|
+
const manifest = surface === "header" ? siteHeaderManifest : siteFooterManifest;
|
|
2587
|
+
return renderBlock(manifest, spec.content, {
|
|
2588
|
+
registry: clientComponentRegistry,
|
|
2589
|
+
theme: themeRuntime.tokens,
|
|
2590
|
+
themeConfig,
|
|
2591
|
+
viewModelOverrides: spec.viewModelOverrides
|
|
2592
|
+
});
|
|
2593
|
+
}
|
|
2594
|
+
function applyThemeConfigOverride(theme, override) {
|
|
2595
|
+
if (!override) return theme;
|
|
2596
|
+
return {
|
|
2597
|
+
...theme,
|
|
2598
|
+
...override.header ? { header: mergeDefinedObject(theme.header, override.header) } : {},
|
|
2599
|
+
...override.footer ? { footer: mergeDefinedObject(theme.footer, override.footer) } : {}
|
|
2600
|
+
};
|
|
2601
|
+
}
|
|
2602
|
+
function mergeDefinedObject(base, override) {
|
|
2603
|
+
return Object.fromEntries([
|
|
2604
|
+
...Object.entries(base ?? {}),
|
|
2605
|
+
...Object.entries(override).filter(([, value]) => value !== void 0)
|
|
2606
|
+
]);
|
|
2607
|
+
}
|
|
2608
|
+
function SiteChromeCustomizeButton({
|
|
2609
|
+
surface
|
|
2610
|
+
}) {
|
|
2611
|
+
const customize = useSiteChromeCustomizeOptional();
|
|
2612
|
+
const customizePanelId = useId();
|
|
2613
|
+
const customizeDescriptionId = `${customizePanelId}-description`;
|
|
2614
|
+
const [customizeOpen, setCustomizeOpen] = useState(false);
|
|
2615
|
+
const customizeButtonRef = useRef(null);
|
|
2616
|
+
const closeCustomize = useCallback(() => {
|
|
2617
|
+
setCustomizeOpen(false);
|
|
2618
|
+
}, []);
|
|
2619
|
+
const {
|
|
2620
|
+
dialogRef: customizeDialogRef,
|
|
2621
|
+
registerInitialFocus: registerCustomizeInitialFocus,
|
|
2622
|
+
setReturnFocusTarget: setCustomizeReturnFocusTarget,
|
|
2623
|
+
handleDialogKeyDown: handleCustomizeDialogKeyDown
|
|
2624
|
+
} = useDialogFocusTrap({
|
|
2625
|
+
open: customizeOpen,
|
|
2626
|
+
onClose: closeCustomize
|
|
2627
|
+
});
|
|
2628
|
+
const surfaceState = customize?.getSurfaceState(surface) ?? {
|
|
2629
|
+
kind: "unavailable"
|
|
2630
|
+
};
|
|
2631
|
+
const hasCustomizeControls = surfaceState.kind === "available";
|
|
2632
|
+
const cycleableOptionCount = useMemo(() => {
|
|
2633
|
+
if (surfaceState.kind !== "available") return 0;
|
|
2634
|
+
return surfaceState.options.filter((option) => option.available).length;
|
|
2635
|
+
}, [surfaceState]);
|
|
2636
|
+
const toggleCustomize = (event) => {
|
|
2637
|
+
event.preventDefault();
|
|
2638
|
+
event.stopPropagation();
|
|
2639
|
+
if (!customizeOpen) {
|
|
2640
|
+
setCustomizeReturnFocusTarget(
|
|
2641
|
+
event.currentTarget instanceof HTMLElement ? event.currentTarget : customizeButtonRef.current
|
|
2642
|
+
);
|
|
2643
|
+
}
|
|
2644
|
+
setCustomizeOpen((open) => !open);
|
|
2645
|
+
};
|
|
2646
|
+
return /* @__PURE__ */ jsxs("div", { className: "pointer-events-auto absolute right-2 top-2 z-50 opacity-0 transition group-focus-within/site-chrome:opacity-100 group-hover/site-chrome:opacity-100", children: [
|
|
2647
|
+
/* @__PURE__ */ jsx(
|
|
2648
|
+
"button",
|
|
2649
|
+
{
|
|
2650
|
+
ref: customizeButtonRef,
|
|
2651
|
+
type: "button",
|
|
2652
|
+
onClick: toggleCustomize,
|
|
2653
|
+
className: previewCustomizePillButtonClassName,
|
|
2654
|
+
"aria-label": `Customize ${surface}`,
|
|
2655
|
+
"aria-expanded": customizeOpen,
|
|
2656
|
+
"aria-haspopup": "dialog",
|
|
2657
|
+
"aria-controls": customizeOpen ? customizePanelId : void 0,
|
|
2658
|
+
disabled: !hasCustomizeControls,
|
|
2659
|
+
children: surfaceState.kind === "available" && surfaceState.saving ? "Saving..." : "Customize"
|
|
2660
|
+
}
|
|
2661
|
+
),
|
|
2662
|
+
customizeOpen && surfaceState.kind === "available" ? /* @__PURE__ */ jsxs(
|
|
2663
|
+
"div",
|
|
2664
|
+
{
|
|
2665
|
+
id: customizePanelId,
|
|
2666
|
+
className: "builder-dashboard-chrome-theme fixed inset-x-3 bottom-[calc(var(--builder-editor-chrome-offset,0px)+1rem)] z-[70] rounded-lg border bg-background p-3 text-foreground shadow-xl sm:absolute sm:inset-x-auto sm:bottom-auto sm:right-0 sm:top-9 sm:w-72",
|
|
2667
|
+
role: "dialog",
|
|
2668
|
+
"aria-modal": "true",
|
|
2669
|
+
"aria-label": `Customize ${surface}`,
|
|
2670
|
+
"aria-describedby": customizeDescriptionId,
|
|
2671
|
+
ref: customizeDialogRef,
|
|
2672
|
+
onKeyDown: handleCustomizeDialogKeyDown,
|
|
2673
|
+
onClick: (event) => event.stopPropagation(),
|
|
2674
|
+
children: [
|
|
2675
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-3 flex items-start justify-between gap-3", children: [
|
|
2676
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2677
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs font-medium uppercase text-muted-foreground", children: "Site" }),
|
|
2678
|
+
/* @__PURE__ */ jsx(
|
|
2679
|
+
"div",
|
|
2680
|
+
{
|
|
2681
|
+
id: customizeDescriptionId,
|
|
2682
|
+
className: "text-sm font-semibold",
|
|
2683
|
+
children: surfaceState.label
|
|
2684
|
+
}
|
|
2685
|
+
)
|
|
2686
|
+
] }),
|
|
2687
|
+
/* @__PURE__ */ jsx(
|
|
2688
|
+
"button",
|
|
2689
|
+
{
|
|
2690
|
+
ref: registerCustomizeInitialFocus,
|
|
2691
|
+
type: "button",
|
|
2692
|
+
className: "rounded-full px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
2693
|
+
onClick: (event) => {
|
|
2694
|
+
event.preventDefault();
|
|
2695
|
+
event.stopPropagation();
|
|
2696
|
+
closeCustomize();
|
|
2697
|
+
},
|
|
2698
|
+
children: "Close"
|
|
2699
|
+
}
|
|
2700
|
+
)
|
|
2701
|
+
] }),
|
|
2702
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
2703
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2704
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2705
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: "Look" }),
|
|
2706
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: surfaceState.currentLabel })
|
|
2707
|
+
] }),
|
|
2708
|
+
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center overflow-hidden rounded-full border bg-background", children: [
|
|
2709
|
+
/* @__PURE__ */ jsx(
|
|
2710
|
+
"button",
|
|
2711
|
+
{
|
|
2712
|
+
type: "button",
|
|
2713
|
+
onClick: (event) => {
|
|
2714
|
+
event.preventDefault();
|
|
2715
|
+
event.stopPropagation();
|
|
2716
|
+
customize?.cycleSurfaceLook(surface, "prev");
|
|
2717
|
+
},
|
|
2718
|
+
className: "grid h-8 w-8 place-items-center hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
|
|
2719
|
+
"aria-label": `Previous ${surface} Look`,
|
|
2720
|
+
disabled: surfaceState.saving || !surfaceState.applyAllowed || cycleableOptionCount <= 1,
|
|
2721
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { size: 14 })
|
|
2722
|
+
}
|
|
2723
|
+
),
|
|
2724
|
+
/* @__PURE__ */ jsx(
|
|
2725
|
+
"button",
|
|
2726
|
+
{
|
|
2727
|
+
type: "button",
|
|
2728
|
+
onClick: (event) => {
|
|
2729
|
+
event.preventDefault();
|
|
2730
|
+
event.stopPropagation();
|
|
2731
|
+
customize?.cycleSurfaceLook(surface, "next");
|
|
2732
|
+
},
|
|
2733
|
+
className: "grid h-8 w-8 place-items-center border-l hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
|
|
2734
|
+
"aria-label": `Next ${surface} Look`,
|
|
2735
|
+
disabled: surfaceState.saving || !surfaceState.applyAllowed || cycleableOptionCount <= 1,
|
|
2736
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { size: 14 })
|
|
2737
|
+
}
|
|
2738
|
+
)
|
|
2739
|
+
] })
|
|
2740
|
+
] }),
|
|
2741
|
+
surfaceState.diagnostics.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "space-y-1 text-xs text-amber-700", children: surfaceState.diagnostics.map((diagnostic) => /* @__PURE__ */ jsx("li", { children: diagnostic }, diagnostic)) }) : null,
|
|
2742
|
+
surfaceState.failure ? /* @__PURE__ */ jsx("p", { className: "text-xs text-red-700", children: surfaceState.failure }) : null,
|
|
2743
|
+
!surfaceState.applyAllowed ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Preview only - ask an admin to apply." }) : null
|
|
2744
|
+
] })
|
|
2745
|
+
]
|
|
2746
|
+
}
|
|
2747
|
+
) : null
|
|
2748
|
+
] });
|
|
2749
|
+
}
|
|
2750
|
+
function SiteChromeEditableSurface({
|
|
2751
|
+
surface,
|
|
2752
|
+
children,
|
|
2753
|
+
preserveSingleComponentRoot = false
|
|
2754
|
+
}) {
|
|
2755
|
+
return renderEditableSurface(
|
|
2756
|
+
children,
|
|
2757
|
+
surface,
|
|
2758
|
+
/* @__PURE__ */ jsx(SiteChromeCustomizeButton, { surface }),
|
|
2759
|
+
{ preserveSingleComponentRoot }
|
|
2760
|
+
);
|
|
2761
|
+
}
|
|
2762
|
+
function renderEditableSurface(children, surface, customizeButton, options) {
|
|
2763
|
+
const childArray = Children.toArray(children);
|
|
2764
|
+
const child = childArray.length === 1 ? childArray[0] : null;
|
|
2765
|
+
if (isValidElement(child) && child.type !== Fragment$1 && (isHostElement(child) || options.preserveSingleComponentRoot)) {
|
|
2766
|
+
return cloneElement(child, {
|
|
2767
|
+
className: joinClassNames(child.props.className, "group/site-chrome relative"),
|
|
2768
|
+
"data-preview-site-chrome-surface": surface,
|
|
2769
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2770
|
+
child.props.children,
|
|
2771
|
+
customizeButton
|
|
2772
|
+
] })
|
|
2773
|
+
});
|
|
2774
|
+
}
|
|
2775
|
+
return /* @__PURE__ */ jsxs("div", { className: "group/site-chrome relative", "data-preview-site-chrome-surface": surface, children: [
|
|
2776
|
+
children,
|
|
2777
|
+
customizeButton
|
|
2778
|
+
] });
|
|
2779
|
+
}
|
|
2780
|
+
function isHostElement(child) {
|
|
2781
|
+
return typeof child.type === "string";
|
|
2782
|
+
}
|
|
2783
|
+
function joinClassNames(...values) {
|
|
2784
|
+
const className = values.filter(Boolean).join(" ");
|
|
2785
|
+
return className.length > 0 ? className : void 0;
|
|
2786
|
+
}
|
|
2787
|
+
function PreviewThemedSiteDocument({
|
|
2788
|
+
children,
|
|
2789
|
+
useThemeScope,
|
|
2790
|
+
useContainerResponsiveMode,
|
|
2791
|
+
viewportMode,
|
|
2792
|
+
viewportWidth,
|
|
2793
|
+
scale,
|
|
2794
|
+
contentHeight,
|
|
2795
|
+
scaleContainerRef,
|
|
2796
|
+
contentRef,
|
|
2797
|
+
staticHeaderNode,
|
|
2798
|
+
bannerNode,
|
|
2799
|
+
staticFooterNode,
|
|
2800
|
+
siteChromeRenderModel
|
|
2801
|
+
}) {
|
|
2802
|
+
const { effectiveTheme } = usePreviewThemeOverlay();
|
|
2803
|
+
const siteDocumentPlan = planSiteDocument({
|
|
2804
|
+
headerPositioning: effectiveTheme.header?.positioning ?? "static",
|
|
2805
|
+
headerVariant: effectiveTheme.header?.variant ?? null,
|
|
2806
|
+
hasVisibleBanner: Boolean(bannerNode)
|
|
2807
|
+
});
|
|
2808
|
+
const headerNode = siteChromeRenderModel ? /* @__PURE__ */ jsx(SiteChromeEditableSurface, { surface: "header", children: renderSiteChromeBlock(siteChromeRenderModel, "header", effectiveTheme) }) : staticHeaderNode;
|
|
2809
|
+
const canRenderFooterReactively = Boolean(siteChromeRenderModel) && siteChromeRenderModel?.footer.canRenderReactively !== false;
|
|
2810
|
+
const footerNode = canRenderFooterReactively && siteChromeRenderModel ? /* @__PURE__ */ jsx(SiteChromeEditableSurface, { surface: "footer", preserveSingleComponentRoot: true, children: renderSiteChromeBlock(siteChromeRenderModel, "footer", effectiveTheme) }) : staticFooterNode;
|
|
2811
|
+
const documentNode = renderPreviewDocument({
|
|
2812
|
+
viewportMode,
|
|
2813
|
+
viewportWidth,
|
|
2814
|
+
scale,
|
|
2815
|
+
contentHeight,
|
|
2816
|
+
scaleContainerRef,
|
|
2817
|
+
contentRef,
|
|
2818
|
+
siteDocumentPlan,
|
|
2819
|
+
headerNode,
|
|
2820
|
+
bannerNode,
|
|
2821
|
+
footerNode,
|
|
2822
|
+
children
|
|
2823
|
+
});
|
|
2824
|
+
if (!useThemeScope) {
|
|
2825
|
+
return documentNode;
|
|
2826
|
+
}
|
|
2827
|
+
return /* @__PURE__ */ jsx(
|
|
2828
|
+
ThemeScope,
|
|
2829
|
+
{
|
|
2830
|
+
theme: effectiveTheme,
|
|
2831
|
+
responsiveMode: useContainerResponsiveMode ? "container" : "viewport",
|
|
2832
|
+
className: "flex flex-1 flex-col",
|
|
2833
|
+
children: documentNode
|
|
2834
|
+
}
|
|
2835
|
+
);
|
|
2836
|
+
}
|
|
2837
|
+
function renderPreviewDocument({
|
|
2838
|
+
viewportMode,
|
|
2839
|
+
viewportWidth,
|
|
2840
|
+
scale,
|
|
2841
|
+
contentHeight,
|
|
2842
|
+
scaleContainerRef,
|
|
2843
|
+
contentRef,
|
|
2844
|
+
siteDocumentPlan,
|
|
2845
|
+
headerNode,
|
|
2846
|
+
bannerNode,
|
|
2847
|
+
footerNode,
|
|
2848
|
+
children
|
|
2849
|
+
}) {
|
|
2850
|
+
if (viewportMode === "squeeze") {
|
|
2851
|
+
return /* @__PURE__ */ jsx(
|
|
2852
|
+
SiteDocumentLayout,
|
|
2853
|
+
{
|
|
2854
|
+
as: "main",
|
|
2855
|
+
role: "main",
|
|
2856
|
+
plan: siteDocumentPlan,
|
|
2857
|
+
headerNode,
|
|
2858
|
+
bannerNode,
|
|
2859
|
+
footerNode,
|
|
2860
|
+
minHeightClassName: null,
|
|
2861
|
+
className: "flex-1 pb-[calc(var(--builder-editor-chrome-offset,0px)+var(--builder-preview-banner-offset,0px))]",
|
|
2862
|
+
children
|
|
2863
|
+
}
|
|
2864
|
+
);
|
|
2865
|
+
}
|
|
2866
|
+
if (viewportMode === "fixed") {
|
|
2867
|
+
const targetWidthPx = viewportWidth === "full" ? 1440 : viewportWidth;
|
|
2868
|
+
const scaledWidth = targetWidthPx * scale;
|
|
2869
|
+
const scaledHeight = contentHeight > 0 ? contentHeight * scale : 0;
|
|
2870
|
+
const wrapperStyle = {
|
|
2871
|
+
width: `${scaledWidth}px`,
|
|
2872
|
+
margin: "0 auto"
|
|
2873
|
+
};
|
|
2874
|
+
if (scaledHeight > 0) {
|
|
2875
|
+
wrapperStyle.height = `${scaledHeight}px`;
|
|
2876
|
+
} else {
|
|
2877
|
+
wrapperStyle.minHeight = "100%";
|
|
2878
|
+
}
|
|
2879
|
+
return /* @__PURE__ */ jsx("div", { ref: scaleContainerRef, className: "h-full overflow-auto", children: /* @__PURE__ */ jsx("div", { style: wrapperStyle, children: /* @__PURE__ */ jsx(
|
|
2880
|
+
"div",
|
|
2881
|
+
{
|
|
2882
|
+
ref: contentRef,
|
|
2883
|
+
className: "border-x shadow-sm",
|
|
2884
|
+
style: {
|
|
2885
|
+
minHeight: "100%",
|
|
2886
|
+
width: `${targetWidthPx}px`,
|
|
2887
|
+
transform: `scale(${scale})`,
|
|
2888
|
+
transformOrigin: "top left"
|
|
2889
|
+
},
|
|
2890
|
+
children: /* @__PURE__ */ jsx(
|
|
2891
|
+
SiteDocumentLayout,
|
|
2892
|
+
{
|
|
2893
|
+
as: "main",
|
|
2894
|
+
role: "main",
|
|
2895
|
+
plan: siteDocumentPlan,
|
|
2896
|
+
headerNode,
|
|
2897
|
+
bannerNode,
|
|
2898
|
+
footerNode,
|
|
2899
|
+
minHeightClassName: "min-h-full",
|
|
2900
|
+
className: "pb-[calc(var(--builder-editor-chrome-offset,0px)+var(--builder-preview-banner-offset,0px))]",
|
|
2901
|
+
style: { width: `${targetWidthPx}px` },
|
|
2902
|
+
children
|
|
2903
|
+
}
|
|
2904
|
+
)
|
|
2905
|
+
}
|
|
2906
|
+
) }) });
|
|
2907
|
+
}
|
|
2908
|
+
return null;
|
|
2909
|
+
}
|
|
2533
2910
|
var previewContainerResponsiveEnabled = process.env.NEXT_PUBLIC_ENABLE_PREVIEW_CONTAINER_RESPONSIVE !== "false";
|
|
2534
|
-
var PreviewEditorSidebar =
|
|
2535
|
-
const mod = await import('./PreviewEditorSidebar-
|
|
2911
|
+
var PreviewEditorSidebar = React9.lazy(async () => {
|
|
2912
|
+
const mod = await import('./PreviewEditorSidebar-DVUG7GK4.mjs');
|
|
2536
2913
|
return { default: mod.PreviewEditorSidebar };
|
|
2537
2914
|
});
|
|
2538
|
-
var PreviewEditorUI =
|
|
2539
|
-
const mod = await import('./PreviewEditorUI-
|
|
2915
|
+
var PreviewEditorUI = React9.lazy(async () => {
|
|
2916
|
+
const mod = await import('./PreviewEditorUI-P7RN4CDS.mjs');
|
|
2540
2917
|
return { default: mod.PreviewEditorUI };
|
|
2541
2918
|
});
|
|
2542
2919
|
var previewPaneContainmentStyle = {
|
|
@@ -2565,6 +2942,11 @@ function PreviewShellLayout({
|
|
|
2565
2942
|
themeSelectionButtonPersonalityId = null,
|
|
2566
2943
|
themeSelectionPaletteVariantId = null,
|
|
2567
2944
|
themeSelectionPaletteOverrides = null,
|
|
2945
|
+
themeSelectionHeaderLayoutId = null,
|
|
2946
|
+
themeSelectionHeaderStyleId = null,
|
|
2947
|
+
themeSelectionTypographyPresetId = null,
|
|
2948
|
+
themeSelectionTypographyBodyFontOverride = null,
|
|
2949
|
+
themeSelectionTypographyHeadingFontOverride = null,
|
|
2568
2950
|
themeSelectionHeaderLookId = null,
|
|
2569
2951
|
themeSelectionFooterLookId = null,
|
|
2570
2952
|
themeSelectionHeaderContext,
|
|
@@ -2583,18 +2965,11 @@ function PreviewShellLayout({
|
|
|
2583
2965
|
const headerNode = layout?.headerNode ?? null;
|
|
2584
2966
|
const bannerNode = layout?.bannerNode ?? null;
|
|
2585
2967
|
const footerNode = layout?.footerNode ?? null;
|
|
2968
|
+
const siteChromeRenderModel = layout?.siteChromeRenderModel ?? null;
|
|
2586
2969
|
const surfaceDocument = useMemo(
|
|
2587
2970
|
() => resolvePreviewChromeSurface(surfaceId),
|
|
2588
2971
|
[surfaceId]
|
|
2589
2972
|
);
|
|
2590
|
-
const siteDocumentPlan = useMemo(
|
|
2591
|
-
() => planSiteDocument({
|
|
2592
|
-
headerPositioning: theme.header?.positioning ?? "static",
|
|
2593
|
-
headerVariant: theme.header?.variant ?? null,
|
|
2594
|
-
hasVisibleBanner: Boolean(bannerNode)
|
|
2595
|
-
}),
|
|
2596
|
-
[bannerNode, theme.header?.positioning, theme.header?.variant]
|
|
2597
|
-
);
|
|
2598
2973
|
const isOpen = useEditorUiStore((s) => s.drawerOpen);
|
|
2599
2974
|
const setDrawerOpen = useEditorUiStore((s) => s.setDrawerOpen);
|
|
2600
2975
|
const sidebarTab = useEditorUiStore((s) => s.previewSidebarTab);
|
|
@@ -2749,91 +3124,29 @@ function PreviewShellLayout({
|
|
|
2749
3124
|
}
|
|
2750
3125
|
return ZOOM_PERCENTAGES[zoom];
|
|
2751
3126
|
}, [viewportMode, viewportWidth, zoom, containerWidth]);
|
|
2752
|
-
const renderPreviewContent = useCallback(() => {
|
|
2753
|
-
if (viewportMode === "squeeze") {
|
|
2754
|
-
return /* @__PURE__ */ jsx(
|
|
2755
|
-
SiteDocumentLayout,
|
|
2756
|
-
{
|
|
2757
|
-
as: "main",
|
|
2758
|
-
role: "main",
|
|
2759
|
-
plan: siteDocumentPlan,
|
|
2760
|
-
headerNode,
|
|
2761
|
-
bannerNode,
|
|
2762
|
-
footerNode,
|
|
2763
|
-
minHeightClassName: null,
|
|
2764
|
-
className: "flex-1 pb-[calc(var(--builder-editor-chrome-offset,0px)+var(--builder-preview-banner-offset,0px))]",
|
|
2765
|
-
children
|
|
2766
|
-
}
|
|
2767
|
-
);
|
|
2768
|
-
}
|
|
2769
|
-
if (viewportMode === "fixed") {
|
|
2770
|
-
const targetWidthPx = viewportWidth === "full" ? 1440 : viewportWidth;
|
|
2771
|
-
const scaledWidth = targetWidthPx * scale;
|
|
2772
|
-
const scaledHeight = contentHeight > 0 ? contentHeight * scale : 0;
|
|
2773
|
-
const wrapperStyle = {
|
|
2774
|
-
width: `${scaledWidth}px`,
|
|
2775
|
-
margin: "0 auto"
|
|
2776
|
-
};
|
|
2777
|
-
if (scaledHeight > 0) {
|
|
2778
|
-
wrapperStyle.height = `${scaledHeight}px`;
|
|
2779
|
-
} else {
|
|
2780
|
-
wrapperStyle.minHeight = "100%";
|
|
2781
|
-
}
|
|
2782
|
-
return /* @__PURE__ */ jsx("div", { ref: scaleContainerRef, className: "h-full overflow-auto", children: /* @__PURE__ */ jsx("div", { style: wrapperStyle, children: /* @__PURE__ */ jsx(
|
|
2783
|
-
"div",
|
|
2784
|
-
{
|
|
2785
|
-
ref: contentRef,
|
|
2786
|
-
className: "border-x shadow-sm",
|
|
2787
|
-
style: {
|
|
2788
|
-
minHeight: "100%",
|
|
2789
|
-
width: `${targetWidthPx}px`,
|
|
2790
|
-
transform: `scale(${scale})`,
|
|
2791
|
-
transformOrigin: "top left"
|
|
2792
|
-
},
|
|
2793
|
-
children: /* @__PURE__ */ jsx(
|
|
2794
|
-
SiteDocumentLayout,
|
|
2795
|
-
{
|
|
2796
|
-
as: "main",
|
|
2797
|
-
role: "main",
|
|
2798
|
-
plan: siteDocumentPlan,
|
|
2799
|
-
headerNode,
|
|
2800
|
-
bannerNode,
|
|
2801
|
-
footerNode,
|
|
2802
|
-
minHeightClassName: "min-h-full",
|
|
2803
|
-
className: "pb-[calc(var(--builder-editor-chrome-offset,0px)+var(--builder-preview-banner-offset,0px))]",
|
|
2804
|
-
style: { width: `${targetWidthPx}px` },
|
|
2805
|
-
children
|
|
2806
|
-
}
|
|
2807
|
-
)
|
|
2808
|
-
}
|
|
2809
|
-
) }) });
|
|
2810
|
-
}
|
|
2811
|
-
return null;
|
|
2812
|
-
}, [
|
|
2813
|
-
viewportMode,
|
|
2814
|
-
viewportWidth,
|
|
2815
|
-
siteDocumentPlan,
|
|
2816
|
-
headerNode,
|
|
2817
|
-
bannerNode,
|
|
2818
|
-
children,
|
|
2819
|
-
footerNode,
|
|
2820
|
-
scale,
|
|
2821
|
-
contentHeight,
|
|
2822
|
-
scaleContainerRef
|
|
2823
|
-
]);
|
|
2824
|
-
const previewContent = renderPreviewContent();
|
|
2825
3127
|
const leftPane = /* @__PURE__ */ jsx(
|
|
2826
3128
|
"div",
|
|
2827
3129
|
{
|
|
2828
3130
|
className: "relative flex h-full min-h-0 flex-col overflow-auto bg-muted/30",
|
|
2829
3131
|
style: previewPaneContainmentStyle,
|
|
2830
|
-
children:
|
|
2831
|
-
|
|
3132
|
+
children: /* @__PURE__ */ jsx(
|
|
3133
|
+
PreviewThemedSiteDocument,
|
|
2832
3134
|
{
|
|
3135
|
+
useThemeScope,
|
|
2833
3136
|
useContainerResponsiveMode: previewContainerResponsiveEnabled,
|
|
2834
|
-
|
|
3137
|
+
viewportMode,
|
|
3138
|
+
viewportWidth,
|
|
3139
|
+
scale,
|
|
3140
|
+
contentHeight,
|
|
3141
|
+
scaleContainerRef,
|
|
3142
|
+
contentRef,
|
|
3143
|
+
staticHeaderNode: headerNode,
|
|
3144
|
+
bannerNode,
|
|
3145
|
+
staticFooterNode: footerNode,
|
|
3146
|
+
siteChromeRenderModel,
|
|
3147
|
+
children
|
|
2835
3148
|
}
|
|
2836
|
-
)
|
|
3149
|
+
)
|
|
2837
3150
|
}
|
|
2838
3151
|
);
|
|
2839
3152
|
const rightPane = /* @__PURE__ */ jsx(
|
|
@@ -2841,7 +3154,7 @@ function PreviewShellLayout({
|
|
|
2841
3154
|
{
|
|
2842
3155
|
className: `${PREVIEW_CHROME_THEME_CLASS_NAME} flex h-full min-h-0 flex-col overflow-hidden ${surfaceDocument.surfaceClassName ?? ""}`,
|
|
2843
3156
|
...getPreviewChromeSurfaceDataProps(surfaceDocument),
|
|
2844
|
-
children: /* @__PURE__ */ jsx(
|
|
3157
|
+
children: /* @__PURE__ */ jsx(React9.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
|
|
2845
3158
|
PreviewEditorSidebar,
|
|
2846
3159
|
{
|
|
2847
3160
|
surfaceId,
|
|
@@ -2863,6 +3176,11 @@ function PreviewShellLayout({
|
|
|
2863
3176
|
themeSelectionButtonPersonalityId,
|
|
2864
3177
|
themeSelectionPaletteVariantId,
|
|
2865
3178
|
themeSelectionPaletteOverrides,
|
|
3179
|
+
themeSelectionHeaderLayoutId,
|
|
3180
|
+
themeSelectionHeaderStyleId,
|
|
3181
|
+
themeSelectionTypographyPresetId,
|
|
3182
|
+
themeSelectionTypographyBodyFontOverride,
|
|
3183
|
+
themeSelectionTypographyHeadingFontOverride,
|
|
2866
3184
|
themeSelectionHeaderLookId,
|
|
2867
3185
|
themeSelectionFooterLookId,
|
|
2868
3186
|
themeSelectionHeaderContext,
|
|
@@ -2891,7 +3209,7 @@ function PreviewShellLayout({
|
|
|
2891
3209
|
) })
|
|
2892
3210
|
}
|
|
2893
3211
|
);
|
|
2894
|
-
const editorUI = /* @__PURE__ */ jsx(
|
|
3212
|
+
const editorUI = /* @__PURE__ */ jsx(React9.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
|
|
2895
3213
|
PreviewEditorUI,
|
|
2896
3214
|
{
|
|
2897
3215
|
inMaintenanceMode: maintenanceModeEnabled,
|
|
@@ -2909,7 +3227,7 @@ function PreviewShellLayout({
|
|
|
2909
3227
|
}
|
|
2910
3228
|
);
|
|
2911
3229
|
if (!isOpen) {
|
|
2912
|
-
return /* @__PURE__ */ jsx(PreviewThemeOverlayProvider, { baseTheme: theme, children: /* @__PURE__ */ jsxs(
|
|
3230
|
+
return /* @__PURE__ */ jsx(PreviewThemeOverlayProvider, { baseTheme: theme, children: /* @__PURE__ */ jsx(PreviewDesignCoordinatorProvider, { children: /* @__PURE__ */ jsxs(
|
|
2913
3231
|
SiteChromeCustomizeProvider,
|
|
2914
3232
|
{
|
|
2915
3233
|
siteId,
|
|
@@ -2925,6 +3243,11 @@ function PreviewShellLayout({
|
|
|
2925
3243
|
buttonPersonalityId: themeSelectionButtonPersonalityId,
|
|
2926
3244
|
paletteVariantId: themeSelectionPaletteVariantId,
|
|
2927
3245
|
paletteOverrides: themeSelectionPaletteOverrides,
|
|
3246
|
+
headerLayoutId: themeSelectionHeaderLayoutId,
|
|
3247
|
+
headerStyleId: themeSelectionHeaderStyleId,
|
|
3248
|
+
typographyPresetId: themeSelectionTypographyPresetId,
|
|
3249
|
+
typographyBodyFontOverride: themeSelectionTypographyBodyFontOverride,
|
|
3250
|
+
typographyHeadingFontOverride: themeSelectionTypographyHeadingFontOverride,
|
|
2928
3251
|
headerLookId: themeSelectionHeaderLookId,
|
|
2929
3252
|
footerLookId: themeSelectionFooterLookId
|
|
2930
3253
|
},
|
|
@@ -2937,9 +3260,9 @@ function PreviewShellLayout({
|
|
|
2937
3260
|
/* @__PURE__ */ jsx("div", { className: "fixed inset-0 overflow-hidden bg-background", children: leftPane })
|
|
2938
3261
|
]
|
|
2939
3262
|
}
|
|
2940
|
-
) });
|
|
3263
|
+
) }) });
|
|
2941
3264
|
}
|
|
2942
|
-
return /* @__PURE__ */ jsx(PreviewThemeOverlayProvider, { baseTheme: theme, children: /* @__PURE__ */ jsxs(
|
|
3265
|
+
return /* @__PURE__ */ jsx(PreviewThemeOverlayProvider, { baseTheme: theme, children: /* @__PURE__ */ jsx(PreviewDesignCoordinatorProvider, { children: /* @__PURE__ */ jsxs(
|
|
2943
3266
|
SiteChromeCustomizeProvider,
|
|
2944
3267
|
{
|
|
2945
3268
|
siteId,
|
|
@@ -2955,6 +3278,11 @@ function PreviewShellLayout({
|
|
|
2955
3278
|
buttonPersonalityId: themeSelectionButtonPersonalityId,
|
|
2956
3279
|
paletteVariantId: themeSelectionPaletteVariantId,
|
|
2957
3280
|
paletteOverrides: themeSelectionPaletteOverrides,
|
|
3281
|
+
headerLayoutId: themeSelectionHeaderLayoutId,
|
|
3282
|
+
headerStyleId: themeSelectionHeaderStyleId,
|
|
3283
|
+
typographyPresetId: themeSelectionTypographyPresetId,
|
|
3284
|
+
typographyBodyFontOverride: themeSelectionTypographyBodyFontOverride,
|
|
3285
|
+
typographyHeadingFontOverride: themeSelectionTypographyHeadingFontOverride,
|
|
2958
3286
|
headerLookId: themeSelectionHeaderLookId,
|
|
2959
3287
|
footerLookId: themeSelectionFooterLookId
|
|
2960
3288
|
},
|
|
@@ -2982,22 +3310,7 @@ function PreviewShellLayout({
|
|
|
2982
3310
|
) })
|
|
2983
3311
|
]
|
|
2984
3312
|
}
|
|
2985
|
-
) });
|
|
2986
|
-
}
|
|
2987
|
-
function PreviewThemeScopeBoundary({
|
|
2988
|
-
children,
|
|
2989
|
-
useContainerResponsiveMode
|
|
2990
|
-
}) {
|
|
2991
|
-
const { effectiveTheme } = usePreviewThemeOverlay();
|
|
2992
|
-
return /* @__PURE__ */ jsx(
|
|
2993
|
-
ThemeScope,
|
|
2994
|
-
{
|
|
2995
|
-
theme: effectiveTheme,
|
|
2996
|
-
responsiveMode: useContainerResponsiveMode ? "container" : "viewport",
|
|
2997
|
-
className: "flex flex-1 flex-col",
|
|
2998
|
-
children
|
|
2999
|
-
}
|
|
3000
|
-
);
|
|
3313
|
+
) }) });
|
|
3001
3314
|
}
|
|
3002
3315
|
function PreviewShell({
|
|
3003
3316
|
children,
|
|
@@ -3018,6 +3331,11 @@ function PreviewShell({
|
|
|
3018
3331
|
themeSelectionButtonPersonalityId = null,
|
|
3019
3332
|
themeSelectionPaletteVariantId = null,
|
|
3020
3333
|
themeSelectionPaletteOverrides = null,
|
|
3334
|
+
themeSelectionHeaderLayoutId = null,
|
|
3335
|
+
themeSelectionHeaderStyleId = null,
|
|
3336
|
+
themeSelectionTypographyPresetId = null,
|
|
3337
|
+
themeSelectionTypographyBodyFontOverride = null,
|
|
3338
|
+
themeSelectionTypographyHeadingFontOverride = null,
|
|
3021
3339
|
themeSelectionHeaderLookId = null,
|
|
3022
3340
|
themeSelectionFooterLookId = null,
|
|
3023
3341
|
themeSelectionHeaderContext,
|
|
@@ -3102,6 +3420,11 @@ function PreviewShell({
|
|
|
3102
3420
|
themeSelectionButtonPersonalityId,
|
|
3103
3421
|
themeSelectionPaletteVariantId,
|
|
3104
3422
|
themeSelectionPaletteOverrides,
|
|
3423
|
+
themeSelectionHeaderLayoutId,
|
|
3424
|
+
themeSelectionHeaderStyleId,
|
|
3425
|
+
themeSelectionTypographyPresetId,
|
|
3426
|
+
themeSelectionTypographyBodyFontOverride,
|
|
3427
|
+
themeSelectionTypographyHeadingFontOverride,
|
|
3105
3428
|
themeSelectionHeaderLookId,
|
|
3106
3429
|
themeSelectionFooterLookId,
|
|
3107
3430
|
themeSelectionHeaderContext,
|
|
@@ -3167,7 +3490,7 @@ function SdkPreviewModeRuntime(props) {
|
|
|
3167
3490
|
const customBlocks = content.customBlocks ?? null;
|
|
3168
3491
|
const typedBlockOverrides = blockOverrides ?? null;
|
|
3169
3492
|
const sdkConfigForEditor = useMemo(() => {
|
|
3170
|
-
const blocks =
|
|
3493
|
+
const blocks = customBlocks ?? sdkConfig?.customBlocks ?? void 0;
|
|
3171
3494
|
if (!blocks || blocks.length === 0) return null;
|
|
3172
3495
|
return { customBlocks: blocks };
|
|
3173
3496
|
}, [sdkConfig, customBlocks]);
|