@riverbankcms/sdk 0.76.0 → 0.77.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/dist/{PreviewEditorSidebar-X2HWXFOL.mjs → PreviewEditorSidebar-XSX7QKHQ.mjs} +1019 -442
- package/dist/{PreviewEditorUI-AQXIXPOH.mjs → PreviewEditorUI-YZNEZ3QD.mjs} +2 -2
- package/dist/SdkPreviewModeRuntime-5FS5E6BI.mjs +8 -0
- package/dist/_dts/ai/src/contracts/proposals.d.ts +528 -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 +38 -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/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 +11 -2
- package/dist/_dts/blocks/src/system/node/validation-constants.d.ts +1 -1
- 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 +1 -0
- 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/index.d.ts +2 -1
- package/dist/_dts/sdk/src/public-api/contracts.d.ts +5 -0
- 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/mock-themes/all.d.ts +45 -0
- 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 +280 -0
- 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 +118 -2
- 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 +364 -5
- 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-Z7JLNTJR.mjs → chunk-6SMUFTXD.mjs} +2 -1
- package/dist/{chunk-V5VORNEJ.mjs → chunk-ANKDYZ2E.mjs} +1 -1
- package/dist/{chunk-Q4OLG66B.mjs → chunk-EAWHBECW.mjs} +476 -153
- package/dist/{chunk-TW2Y4RR5.mjs → chunk-GSQX43EZ.mjs} +383 -51
- package/dist/{chunk-LYI7TEMH.mjs → chunk-WLQBJN2Z.mjs} +3096 -354
- package/dist/cli/index.mjs +2023 -181
- 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 +2134 -228
- 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 +1918 -293
- 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 +2095 -208
- 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-Q6MTR4KL.mjs} +5 -5
- package/dist/server/components.mjs +2046 -204
- package/dist/server/config-validation.mjs +1921 -293
- package/dist/server/config.mjs +1921 -293
- package/dist/server/data.mjs +1918 -293
- package/dist/server/index.mjs +31 -2
- package/dist/server/next.mjs +2067 -206
- package/dist/server/page-converter.mjs +1894 -281
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/rendering/server.mjs +2046 -204
- package/dist/server/rendering.mjs +2046 -204
- package/dist/server/routing.mjs +1963 -275
- package/dist/server/server.mjs +1932 -288
- package/dist/server/theme-bridge.mjs +158 -1
- package/dist/server/theme.mjs +158 -1
- package/package.json +1 -1
- package/dist/SdkPreviewModeRuntime-ZQNDCASH.mjs +0 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { compileSiteThemeFromSelections, footerLookCatalog,
|
|
3
|
-
import { createContext, useState,
|
|
2
|
+
import { assertNever2, deriveNearestCompatibleHeaderStyle, findLegacyHeaderLookIdForSelection, compileSiteThemeFromSelections, footerLookCatalog, footerLookRejectionReasonLabel, getHeaderStyle, getHeaderLayout, writePlanForLookCustomizationCommand, headerLayoutCatalog, headerStyleCatalog, getCompatibleHeaderStyleIds, siteStyleIdFromTheme, getCuratedSiteStyle } from './chunk-WLQBJN2Z.mjs';
|
|
3
|
+
import { createContext, useState, useCallback, useMemo, useContext, useRef, useEffect } from 'react';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
// ../preview-next/src/client/preview/previewChromeSurfacePolicy.ts
|
|
@@ -374,7 +374,6 @@ function isDebugEnabled() {
|
|
|
374
374
|
}
|
|
375
375
|
function PreviewThemeOverlayProvider({ baseTheme, children }) {
|
|
376
376
|
const [overlay, setOverlay] = useState(NO_THEME_OVERLAY);
|
|
377
|
-
const previousBaseThemeRef = useRef(null);
|
|
378
377
|
const overlayOps = overlay.kind === "patch" ? [...overlay.ops] : null;
|
|
379
378
|
const overlayOpsSource = overlay.kind === "patch" ? overlay.source : null;
|
|
380
379
|
const overrideTheme = overlay.kind === "theme" ? overlay.theme : null;
|
|
@@ -421,12 +420,6 @@ function PreviewThemeOverlayProvider({ baseTheme, children }) {
|
|
|
421
420
|
return NO_THEME_OVERLAY;
|
|
422
421
|
});
|
|
423
422
|
}, []);
|
|
424
|
-
useEffect(() => {
|
|
425
|
-
if (previousBaseThemeRef.current && previousBaseThemeRef.current !== baseTheme) {
|
|
426
|
-
setOverlay(NO_THEME_OVERLAY);
|
|
427
|
-
}
|
|
428
|
-
previousBaseThemeRef.current = baseTheme;
|
|
429
|
-
}, [baseTheme]);
|
|
430
423
|
const effectiveTheme = useMemo(() => {
|
|
431
424
|
if (overlay.kind === "theme") return overlay.theme;
|
|
432
425
|
if (overlay.kind !== "patch" || overlay.ops.length === 0) return baseTheme;
|
|
@@ -478,6 +471,200 @@ function usePreviewThemeOverlay() {
|
|
|
478
471
|
return ctx;
|
|
479
472
|
}
|
|
480
473
|
|
|
474
|
+
// ../preview-next/src/client/preview/previewDesignCoordinator.ts
|
|
475
|
+
var NO_PREVIEW_DESIGN_STATE = { kind: "idle" };
|
|
476
|
+
function transitionPreviewDesignState(state, command) {
|
|
477
|
+
switch (command.kind) {
|
|
478
|
+
case "preview-theme-patch":
|
|
479
|
+
return acceptPreview(state, {
|
|
480
|
+
kind: "active",
|
|
481
|
+
owner: command.producer,
|
|
482
|
+
surface: "theme-json-patch",
|
|
483
|
+
apply: "idle"
|
|
484
|
+
}, {
|
|
485
|
+
kind: "set-patch",
|
|
486
|
+
source: command.producer,
|
|
487
|
+
ops: command.ops
|
|
488
|
+
});
|
|
489
|
+
case "preview-theme":
|
|
490
|
+
return acceptPreview(state, {
|
|
491
|
+
kind: "active",
|
|
492
|
+
owner: command.producer,
|
|
493
|
+
surface: command.sourcePlan,
|
|
494
|
+
apply: "idle"
|
|
495
|
+
}, {
|
|
496
|
+
kind: "set-theme",
|
|
497
|
+
source: command.producer,
|
|
498
|
+
theme: command.theme
|
|
499
|
+
});
|
|
500
|
+
case "clear-preview":
|
|
501
|
+
if (state.kind === "idle") {
|
|
502
|
+
return ignored(state, "no-active-preview");
|
|
503
|
+
}
|
|
504
|
+
if (state.owner !== command.producer) {
|
|
505
|
+
return ignored(state, "producer-does-not-own-preview");
|
|
506
|
+
}
|
|
507
|
+
return accepted(NO_PREVIEW_DESIGN_STATE, { kind: "clear" });
|
|
508
|
+
case "base-theme-changed":
|
|
509
|
+
if (state.kind === "idle") {
|
|
510
|
+
return accepted(state, { kind: "none" });
|
|
511
|
+
}
|
|
512
|
+
return accepted(NO_PREVIEW_DESIGN_STATE, { kind: "clear" });
|
|
513
|
+
case "apply-started":
|
|
514
|
+
if (state.kind === "idle") {
|
|
515
|
+
return ignored(state, "no-active-preview");
|
|
516
|
+
}
|
|
517
|
+
if (state.owner !== command.producer) {
|
|
518
|
+
return ignored(state, "producer-does-not-own-preview");
|
|
519
|
+
}
|
|
520
|
+
return accepted({ ...state, apply: "pending" }, { kind: "none" });
|
|
521
|
+
case "apply-succeeded":
|
|
522
|
+
if (state.kind === "idle") {
|
|
523
|
+
return ignored(state, "apply-event-for-displaced-preview");
|
|
524
|
+
}
|
|
525
|
+
if (state.owner !== command.producer) {
|
|
526
|
+
return ignored(state, "apply-event-for-displaced-preview");
|
|
527
|
+
}
|
|
528
|
+
return accepted(NO_PREVIEW_DESIGN_STATE, { kind: "clear" });
|
|
529
|
+
case "apply-failed":
|
|
530
|
+
if (state.kind === "idle") {
|
|
531
|
+
return ignored(state, "apply-event-for-displaced-preview");
|
|
532
|
+
}
|
|
533
|
+
if (state.owner !== command.producer) {
|
|
534
|
+
return ignored(state, "apply-event-for-displaced-preview");
|
|
535
|
+
}
|
|
536
|
+
return accepted({ ...state, apply: "idle" }, { kind: "none" });
|
|
537
|
+
default:
|
|
538
|
+
return assertNever2(command, "Unhandled preview design command");
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function acceptPreview(current, next, effect) {
|
|
542
|
+
return accepted(next, effect);
|
|
543
|
+
}
|
|
544
|
+
function accepted(state, effect) {
|
|
545
|
+
return {
|
|
546
|
+
kind: "accepted",
|
|
547
|
+
state,
|
|
548
|
+
effect
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
function ignored(state, reason) {
|
|
552
|
+
return {
|
|
553
|
+
kind: "ignored",
|
|
554
|
+
state,
|
|
555
|
+
reason
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
var PreviewDesignCoordinatorContext = createContext(null);
|
|
559
|
+
function PreviewDesignCoordinatorProvider({ children }) {
|
|
560
|
+
const themeOverlay = usePreviewThemeOverlay();
|
|
561
|
+
const {
|
|
562
|
+
baseTheme,
|
|
563
|
+
clearOverlay,
|
|
564
|
+
overlay,
|
|
565
|
+
setOverlayOps,
|
|
566
|
+
setOverrideTheme
|
|
567
|
+
} = themeOverlay;
|
|
568
|
+
const [state, setState] = useState(NO_PREVIEW_DESIGN_STATE);
|
|
569
|
+
const stateRef = useRef(state);
|
|
570
|
+
const previousBaseThemeRef = useRef(null);
|
|
571
|
+
useEffect(() => {
|
|
572
|
+
stateRef.current = state;
|
|
573
|
+
}, [state]);
|
|
574
|
+
const dispatch = useCallback(
|
|
575
|
+
(command) => {
|
|
576
|
+
const transition = transitionPreviewDesignState(stateRef.current, command);
|
|
577
|
+
if (transition.kind === "accepted") {
|
|
578
|
+
stateRef.current = transition.state;
|
|
579
|
+
setState(transition.state);
|
|
580
|
+
switch (transition.effect.kind) {
|
|
581
|
+
case "none":
|
|
582
|
+
break;
|
|
583
|
+
case "clear":
|
|
584
|
+
clearOverlay();
|
|
585
|
+
break;
|
|
586
|
+
case "set-patch":
|
|
587
|
+
setOverlayOps([...transition.effect.ops], {
|
|
588
|
+
source: transition.effect.source
|
|
589
|
+
});
|
|
590
|
+
break;
|
|
591
|
+
case "set-theme":
|
|
592
|
+
setOverrideTheme(transition.effect.theme, {
|
|
593
|
+
source: transition.effect.source
|
|
594
|
+
});
|
|
595
|
+
break;
|
|
596
|
+
default:
|
|
597
|
+
assertNever2(transition.effect, "Unhandled preview design overlay effect");
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return transition;
|
|
601
|
+
},
|
|
602
|
+
[clearOverlay, setOverlayOps, setOverrideTheme]
|
|
603
|
+
);
|
|
604
|
+
useEffect(() => {
|
|
605
|
+
if (previousBaseThemeRef.current && previousBaseThemeRef.current !== baseTheme) {
|
|
606
|
+
dispatch({ kind: "base-theme-changed" });
|
|
607
|
+
}
|
|
608
|
+
previousBaseThemeRef.current = baseTheme;
|
|
609
|
+
}, [baseTheme, dispatch]);
|
|
610
|
+
const previewTheme = useCallback(
|
|
611
|
+
(producer, theme, sourcePlan) => dispatch({ kind: "preview-theme", producer, theme, sourcePlan }),
|
|
612
|
+
[dispatch]
|
|
613
|
+
);
|
|
614
|
+
const previewThemePatch = useCallback(
|
|
615
|
+
(producer, ops) => dispatch({ kind: "preview-theme-patch", producer, ops }),
|
|
616
|
+
[dispatch]
|
|
617
|
+
);
|
|
618
|
+
const clearPreview = useCallback(
|
|
619
|
+
(producer) => dispatch({ kind: "clear-preview", producer }),
|
|
620
|
+
[dispatch]
|
|
621
|
+
);
|
|
622
|
+
const applyStarted = useCallback(
|
|
623
|
+
(producer) => dispatch({ kind: "apply-started", producer }),
|
|
624
|
+
[dispatch]
|
|
625
|
+
);
|
|
626
|
+
const applySucceeded = useCallback(
|
|
627
|
+
(producer) => dispatch({ kind: "apply-succeeded", producer }),
|
|
628
|
+
[dispatch]
|
|
629
|
+
);
|
|
630
|
+
const applyFailed = useCallback(
|
|
631
|
+
(producer) => dispatch({ kind: "apply-failed", producer }),
|
|
632
|
+
[dispatch]
|
|
633
|
+
);
|
|
634
|
+
const value = useMemo(
|
|
635
|
+
() => ({
|
|
636
|
+
state,
|
|
637
|
+
overlay,
|
|
638
|
+
dispatch,
|
|
639
|
+
previewTheme,
|
|
640
|
+
previewThemePatch,
|
|
641
|
+
clearPreview,
|
|
642
|
+
applyStarted,
|
|
643
|
+
applySucceeded,
|
|
644
|
+
applyFailed
|
|
645
|
+
}),
|
|
646
|
+
[
|
|
647
|
+
applyFailed,
|
|
648
|
+
applyStarted,
|
|
649
|
+
applySucceeded,
|
|
650
|
+
clearPreview,
|
|
651
|
+
dispatch,
|
|
652
|
+
previewTheme,
|
|
653
|
+
previewThemePatch,
|
|
654
|
+
state,
|
|
655
|
+
overlay
|
|
656
|
+
]
|
|
657
|
+
);
|
|
658
|
+
return /* @__PURE__ */ jsx(PreviewDesignCoordinatorContext.Provider, { value, children });
|
|
659
|
+
}
|
|
660
|
+
function usePreviewDesignCoordinator() {
|
|
661
|
+
const ctx = useContext(PreviewDesignCoordinatorContext);
|
|
662
|
+
if (!ctx) {
|
|
663
|
+
throw new Error("usePreviewDesignCoordinator must be used within PreviewDesignCoordinatorProvider");
|
|
664
|
+
}
|
|
665
|
+
return ctx;
|
|
666
|
+
}
|
|
667
|
+
|
|
481
668
|
// ../preview-next/src/client/blocks/runOptimisticCustomizeAction.ts
|
|
482
669
|
function createOptimisticActionRunner() {
|
|
483
670
|
let latest = 0;
|
|
@@ -537,17 +724,55 @@ function previewButtonPersonality(state, buttonPersonalityId) {
|
|
|
537
724
|
saveStatus: { kind: "idle" }
|
|
538
725
|
};
|
|
539
726
|
}
|
|
540
|
-
function
|
|
727
|
+
function previewHeaderLayout(state, headerLayoutId) {
|
|
728
|
+
const headerStyleId = deriveNearestCompatibleHeaderStyle(
|
|
729
|
+
state.previewed.headerStyleId,
|
|
730
|
+
headerLayoutId
|
|
731
|
+
);
|
|
732
|
+
return previewHeaderSelection(state, { headerLayoutId, headerStyleId });
|
|
733
|
+
}
|
|
734
|
+
function previewHeaderStyle(state, headerStyleId) {
|
|
735
|
+
return previewHeaderSelection(state, {
|
|
736
|
+
headerLayoutId: state.previewed.headerLayoutId,
|
|
737
|
+
headerStyleId
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
function previewFooterLook(state, footerLookId) {
|
|
541
741
|
return {
|
|
542
742
|
...state,
|
|
543
|
-
previewed: { ...state.previewed,
|
|
743
|
+
previewed: { ...state.previewed, footerLookId },
|
|
544
744
|
saveStatus: { kind: "idle" }
|
|
545
745
|
};
|
|
546
746
|
}
|
|
547
|
-
function
|
|
747
|
+
function previewTypographyPreset(state, typographyPresetId) {
|
|
548
748
|
return {
|
|
549
749
|
...state,
|
|
550
|
-
previewed: { ...state.previewed,
|
|
750
|
+
previewed: { ...state.previewed, typographyPresetId },
|
|
751
|
+
saveStatus: { kind: "idle" }
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
function setTypographyBodyFontOverride(state, typographyBodyFontOverride) {
|
|
755
|
+
return {
|
|
756
|
+
...state,
|
|
757
|
+
previewed: { ...state.previewed, typographyBodyFontOverride },
|
|
758
|
+
saveStatus: { kind: "idle" }
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
function setTypographyHeadingFontOverride(state, typographyHeadingFontOverride) {
|
|
762
|
+
return {
|
|
763
|
+
...state,
|
|
764
|
+
previewed: { ...state.previewed, typographyHeadingFontOverride },
|
|
765
|
+
saveStatus: { kind: "idle" }
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
function clearTypographyFontOverrides(state) {
|
|
769
|
+
return {
|
|
770
|
+
...state,
|
|
771
|
+
previewed: {
|
|
772
|
+
...state.previewed,
|
|
773
|
+
typographyBodyFontOverride: null,
|
|
774
|
+
typographyHeadingFontOverride: null
|
|
775
|
+
},
|
|
551
776
|
saveStatus: { kind: "idle" }
|
|
552
777
|
};
|
|
553
778
|
}
|
|
@@ -573,7 +798,13 @@ function applyResolvedSelections(state, input) {
|
|
|
573
798
|
...paletteScoped,
|
|
574
799
|
previewed: {
|
|
575
800
|
...paletteScoped.previewed,
|
|
576
|
-
buttonPersonalityId: input.resolved.buttonPersonalityId
|
|
801
|
+
buttonPersonalityId: input.resolved.buttonPersonalityId,
|
|
802
|
+
headerLayoutId: input.resolved.headerLayoutId,
|
|
803
|
+
headerStyleId: input.resolved.headerStyleId,
|
|
804
|
+
headerLookId: input.resolved.headerLookId,
|
|
805
|
+
typographyPresetId: input.resolved.typographyPresetId,
|
|
806
|
+
typographyBodyFontOverride: input.resolved.typographyBodyFontOverride,
|
|
807
|
+
typographyHeadingFontOverride: input.resolved.typographyHeadingFontOverride
|
|
577
808
|
},
|
|
578
809
|
warnings: input.warnings
|
|
579
810
|
};
|
|
@@ -672,6 +903,26 @@ function movePreviewToPaletteVariant(state, paletteVariantId) {
|
|
|
672
903
|
saveStatus: { kind: "idle" }
|
|
673
904
|
};
|
|
674
905
|
}
|
|
906
|
+
function previewHeaderSelection(state, selection) {
|
|
907
|
+
const headerStyleId = deriveNearestCompatibleHeaderStyle(
|
|
908
|
+
selection.headerStyleId,
|
|
909
|
+
selection.headerLayoutId
|
|
910
|
+
);
|
|
911
|
+
const headerLookId = findLegacyHeaderLookIdForSelection({
|
|
912
|
+
layoutId: selection.headerLayoutId,
|
|
913
|
+
styleId: headerStyleId
|
|
914
|
+
});
|
|
915
|
+
return {
|
|
916
|
+
...state,
|
|
917
|
+
previewed: {
|
|
918
|
+
...state.previewed,
|
|
919
|
+
headerLayoutId: selection.headerLayoutId,
|
|
920
|
+
headerStyleId,
|
|
921
|
+
headerLookId
|
|
922
|
+
},
|
|
923
|
+
saveStatus: { kind: "idle" }
|
|
924
|
+
};
|
|
925
|
+
}
|
|
675
926
|
function withPaletteOverrideDraft(drafts, paletteVariantId, paletteOverrides) {
|
|
676
927
|
const next = { ...drafts };
|
|
677
928
|
if (paletteOverrides === null) {
|
|
@@ -692,7 +943,7 @@ function appendPaletteOverrideScopeNotice(notices, input) {
|
|
|
692
943
|
return [...notices, { kind }];
|
|
693
944
|
}
|
|
694
945
|
function selectionSnapshotsEqual(a, b) {
|
|
695
|
-
return a.siteStyleId === b.siteStyleId && a.selectionVersion === b.selectionVersion && a.selectionUpdatedAt === b.selectionUpdatedAt && a.headerLookId === b.headerLookId && a.footerLookId === b.footerLookId && a.buttonPersonalityId === b.buttonPersonalityId && a.paletteVariantId === b.paletteVariantId && paletteOverridesEqual(a.paletteOverrides, b.paletteOverrides);
|
|
946
|
+
return a.siteStyleId === b.siteStyleId && a.selectionVersion === b.selectionVersion && a.selectionUpdatedAt === b.selectionUpdatedAt && a.headerLayoutId === b.headerLayoutId && a.headerStyleId === b.headerStyleId && a.headerLookId === b.headerLookId && a.footerLookId === b.footerLookId && a.buttonPersonalityId === b.buttonPersonalityId && a.paletteVariantId === b.paletteVariantId && a.typographyPresetId === b.typographyPresetId && a.typographyBodyFontOverride === b.typographyBodyFontOverride && a.typographyHeadingFontOverride === b.typographyHeadingFontOverride && paletteOverridesEqual(a.paletteOverrides, b.paletteOverrides);
|
|
696
947
|
}
|
|
697
948
|
function paletteOverridesEqual(a, b) {
|
|
698
949
|
if (a === b) return true;
|
|
@@ -711,41 +962,40 @@ function buildSiteChromeLookModels(input) {
|
|
|
711
962
|
buttonPersonalityId: selection.buttonPersonalityId,
|
|
712
963
|
paletteVariantId: selection.paletteVariantId,
|
|
713
964
|
paletteOverrides: selection.paletteOverrides,
|
|
965
|
+
headerLayoutId: selection.headerLayoutId,
|
|
966
|
+
headerStyleId: selection.headerStyleId,
|
|
714
967
|
headerLookId: selection.headerLookId,
|
|
715
968
|
footerLookId: selection.footerLookId,
|
|
716
969
|
headerSelectionContext: input.headerSelectionContext,
|
|
717
970
|
footerSelectionContext: input.footerSelectionContext
|
|
718
971
|
};
|
|
719
972
|
const current = compileSiteThemeFromSelections(common);
|
|
973
|
+
const renderedHeaderLayoutId = current.resolvedSelections.headerLayoutId;
|
|
974
|
+
const renderedHeaderStyleId = current.resolvedSelections.headerStyleId;
|
|
720
975
|
return {
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
options:
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
976
|
+
headerLayout: {
|
|
977
|
+
renderedLayoutId: renderedHeaderLayoutId,
|
|
978
|
+
options: orderedHeaderLayoutIds(input.siteStyle).map((layoutId) => {
|
|
979
|
+
const layout = getHeaderLayout(layoutId);
|
|
980
|
+
return {
|
|
981
|
+
id: layoutId,
|
|
982
|
+
label: layout?.label ?? layoutId,
|
|
983
|
+
description: layout?.description,
|
|
728
984
|
available: true
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
],
|
|
744
|
-
diagnostics: diagnosticsForRequestedHeaderSelection(
|
|
745
|
-
selection.headerLookId,
|
|
746
|
-
current.resolvedSelections.headerLookId,
|
|
747
|
-
current.headerSelection.rejected
|
|
748
|
-
)
|
|
985
|
+
};
|
|
986
|
+
})
|
|
987
|
+
},
|
|
988
|
+
headerStyle: {
|
|
989
|
+
renderedStyleId: renderedHeaderStyleId,
|
|
990
|
+
options: orderedHeaderStyleIds(input.siteStyle, selection.headerLayoutId).map((styleId) => {
|
|
991
|
+
const style = getHeaderStyle(styleId);
|
|
992
|
+
return {
|
|
993
|
+
id: styleId,
|
|
994
|
+
label: style?.label ?? styleId,
|
|
995
|
+
description: style?.description,
|
|
996
|
+
available: true
|
|
997
|
+
};
|
|
998
|
+
})
|
|
749
999
|
},
|
|
750
1000
|
footer: {
|
|
751
1001
|
renderedLookId: current.resolvedSelections.footerLookId,
|
|
@@ -791,10 +1041,14 @@ function cycleableSiteChromeOptions(options) {
|
|
|
791
1041
|
}
|
|
792
1042
|
function planSiteChromeLookSelection(command) {
|
|
793
1043
|
if (command.surface === "header") {
|
|
794
|
-
const
|
|
1044
|
+
const headerLookId = findLegacyHeaderLookIdForSelection({
|
|
1045
|
+
layoutId: command.layoutId,
|
|
1046
|
+
styleId: command.styleId
|
|
1047
|
+
});
|
|
1048
|
+
const lookCommand2 = headerLookId ? {
|
|
795
1049
|
kind: "select",
|
|
796
1050
|
surface: { kind: "site-header" },
|
|
797
|
-
lookId:
|
|
1051
|
+
lookId: headerLookId
|
|
798
1052
|
} : {
|
|
799
1053
|
kind: "clear",
|
|
800
1054
|
surface: { kind: "site-header" }
|
|
@@ -802,7 +1056,11 @@ function planSiteChromeLookSelection(command) {
|
|
|
802
1056
|
return {
|
|
803
1057
|
kind: "header",
|
|
804
1058
|
writePlan: writePlanForLookCustomizationCommand(lookCommand2),
|
|
805
|
-
next: {
|
|
1059
|
+
next: {
|
|
1060
|
+
headerLayoutId: command.layoutId,
|
|
1061
|
+
headerStyleId: command.styleId,
|
|
1062
|
+
headerLookId
|
|
1063
|
+
}
|
|
806
1064
|
};
|
|
807
1065
|
}
|
|
808
1066
|
const lookCommand = command.lookId ? {
|
|
@@ -819,10 +1077,33 @@ function planSiteChromeLookSelection(command) {
|
|
|
819
1077
|
next: { footerLookId: command.lookId }
|
|
820
1078
|
};
|
|
821
1079
|
}
|
|
822
|
-
function
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
1080
|
+
function orderedHeaderLayoutIds(siteStyle) {
|
|
1081
|
+
return orderUnique(
|
|
1082
|
+
siteStyle.recommendedHeaderLayoutChoices.map((choice) => choice.id),
|
|
1083
|
+
headerLayoutCatalog.map((layout) => layout.id)
|
|
1084
|
+
);
|
|
1085
|
+
}
|
|
1086
|
+
function orderedHeaderStyleIds(siteStyle, layoutId) {
|
|
1087
|
+
const curated = headerStyleChoicesForLayout(
|
|
1088
|
+
siteStyle.recommendedHeaderStyleChoicesByLayout,
|
|
1089
|
+
layoutId
|
|
1090
|
+
).map((choice) => choice.id);
|
|
1091
|
+
return orderUnique(curated, getCompatibleHeaderStyleIds(layoutId), headerStyleCatalog.map((style) => style.id));
|
|
1092
|
+
}
|
|
1093
|
+
function headerStyleChoicesForLayout(choicesByLayout, layoutId) {
|
|
1094
|
+
return choicesByLayout[layoutId] ?? [];
|
|
1095
|
+
}
|
|
1096
|
+
function orderUnique(...groups) {
|
|
1097
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1098
|
+
const ordered = [];
|
|
1099
|
+
for (const group of groups) {
|
|
1100
|
+
for (const id of group) {
|
|
1101
|
+
if (seen.has(id)) continue;
|
|
1102
|
+
seen.add(id);
|
|
1103
|
+
ordered.push(id);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
return ordered;
|
|
826
1107
|
}
|
|
827
1108
|
function diagnosticsForRequestedFooterSelection(requestedLookId, renderedLookId, rejected) {
|
|
828
1109
|
if (!requestedLookId || requestedLookId === renderedLookId) return [];
|
|
@@ -830,6 +1111,23 @@ function diagnosticsForRequestedFooterSelection(requestedLookId, renderedLookId,
|
|
|
830
1111
|
return rejectedRequest?.reasons.map(footerLookRejectionReasonLabel) ?? [];
|
|
831
1112
|
}
|
|
832
1113
|
|
|
1114
|
+
// ../preview-next/src/client/preview/typographySelectionInput.ts
|
|
1115
|
+
function typographySelectionInputForSnapshot(snapshot, theme) {
|
|
1116
|
+
if (snapshot.typographyPresetId === null && theme?.typography) {
|
|
1117
|
+
return {
|
|
1118
|
+
typographySelection: {
|
|
1119
|
+
kind: "custom",
|
|
1120
|
+
typography: theme.typography
|
|
1121
|
+
}
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
return {
|
|
1125
|
+
typographyPresetId: snapshot.typographyPresetId,
|
|
1126
|
+
typographyBodyFontOverride: snapshot.typographyBodyFontOverride,
|
|
1127
|
+
typographyHeadingFontOverride: snapshot.typographyHeadingFontOverride
|
|
1128
|
+
};
|
|
1129
|
+
}
|
|
1130
|
+
|
|
833
1131
|
// ../preview-next/src/client/preview/styleConfiguratorSnapshot.ts
|
|
834
1132
|
function resolveStyleConfiguratorInitialSnapshot(input) {
|
|
835
1133
|
const themeSiteStyleId = siteStyleIdFromTheme(input.theme);
|
|
@@ -841,6 +1139,9 @@ function resolveStyleConfiguratorInitialSnapshot(input) {
|
|
|
841
1139
|
buttonPersonalityId: input.initialSelections.buttonPersonalityId,
|
|
842
1140
|
paletteVariantId: input.initialSelections.paletteVariantId,
|
|
843
1141
|
paletteOverrides: input.initialSelections.paletteOverrides,
|
|
1142
|
+
headerLayoutId: input.initialSelections.headerLayoutId ?? null,
|
|
1143
|
+
headerStyleId: input.initialSelections.headerStyleId ?? null,
|
|
1144
|
+
...typographySelectionInputForSnapshot(input.initialSelections, input.theme),
|
|
844
1145
|
headerLookId: input.initialSelections.headerLookId ?? null,
|
|
845
1146
|
footerLookId: input.initialSelections.footerLookId ?? null,
|
|
846
1147
|
headerSelectionContext: input.headerSelectionContext,
|
|
@@ -851,12 +1152,43 @@ function resolveStyleConfiguratorInitialSnapshot(input) {
|
|
|
851
1152
|
siteStyleId: siteStyle.id,
|
|
852
1153
|
selectionVersion: input.initialSelections.selectionVersion ?? 0,
|
|
853
1154
|
selectionUpdatedAt: input.initialSelections.selectionUpdatedAt ?? null,
|
|
1155
|
+
headerLayoutId: compiled.resolvedSelections.headerLayoutId,
|
|
1156
|
+
headerStyleId: compiled.resolvedSelections.headerStyleId,
|
|
854
1157
|
headerLookId: compiled.requestedSelections.headerLookId,
|
|
855
1158
|
footerLookId: compiled.requestedSelections.footerLookId,
|
|
856
1159
|
buttonPersonalityId: compiled.resolvedSelections.buttonPersonalityId,
|
|
857
1160
|
paletteVariantId: compiled.resolvedSelections.paletteVariantId,
|
|
858
|
-
paletteOverrides: paletteChanged ? null : input.initialSelections.paletteOverrides
|
|
1161
|
+
paletteOverrides: paletteChanged ? null : input.initialSelections.paletteOverrides,
|
|
1162
|
+
typographyPresetId: compiled.resolvedSelections.typographyPresetId,
|
|
1163
|
+
typographyBodyFontOverride: compiled.resolvedSelections.typographyBodyFontOverride,
|
|
1164
|
+
typographyHeadingFontOverride: compiled.resolvedSelections.typographyHeadingFontOverride
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
// ../preview-next/src/client/preview/siteStylePreviewPlanner.ts
|
|
1169
|
+
function planSiteStylePreviewChange(input) {
|
|
1170
|
+
const compiled = compileSiteThemeFromSelections({
|
|
1171
|
+
siteStyle: input.siteStyle,
|
|
1172
|
+
buttonPersonalityId: input.selection.buttonPersonalityId,
|
|
1173
|
+
paletteVariantId: input.selection.paletteVariantId,
|
|
1174
|
+
paletteOverrides: input.selection.paletteOverrides,
|
|
1175
|
+
...typographySelectionInputForSnapshot(input.selection, input.baseTheme),
|
|
1176
|
+
headerLayoutId: input.selection.headerLayoutId,
|
|
1177
|
+
headerStyleId: input.selection.headerStyleId,
|
|
1178
|
+
headerLookId: input.selection.headerLookId,
|
|
1179
|
+
footerLookId: input.selection.footerLookId,
|
|
1180
|
+
headerSelectionContext: input.headerSelectionContext,
|
|
1181
|
+
footerSelectionContext: input.footerSelectionContext
|
|
1182
|
+
});
|
|
1183
|
+
return {
|
|
1184
|
+
themeOverlay: compiled.theme,
|
|
1185
|
+
resolvedSelections: compiled.resolvedSelections,
|
|
1186
|
+
chromeSelection: {
|
|
1187
|
+
headerLookId: input.selection.headerLookId,
|
|
1188
|
+
footerLookId: input.selection.footerLookId
|
|
1189
|
+
},
|
|
1190
|
+
warnings: compiled.warnings
|
|
859
1191
|
};
|
|
860
1192
|
}
|
|
861
1193
|
|
|
862
|
-
export { PreviewThemeOverlayProvider, applyResolvedSelections, buildPreviewDashboardSetupUrl, buildSiteChromeLookModels, canApplySiteStyle, canInspectSiteStyle, cancelPreview, createOptimisticActionRunner, createStyleConfiguratorState, cycleSiteChromeLookId, cycleableSiteChromeOptions, dismissNotices, dismissWarnings, isPreviewingChange, markApplyFailed, markApplySaved, markApplySaving, openRow, planSiteChromeLookSelection, previewButtonPersonality, previewFooterLook,
|
|
1194
|
+
export { PreviewDesignCoordinatorProvider, PreviewThemeOverlayProvider, applyResolvedSelections, buildPreviewDashboardSetupUrl, buildSiteChromeLookModels, canApplySiteStyle, canInspectSiteStyle, cancelPreview, clearTypographyFontOverrides, createOptimisticActionRunner, createStyleConfiguratorState, cycleSiteChromeLookId, cycleableSiteChromeOptions, dismissNotices, dismissWarnings, isPreviewingChange, markApplyFailed, markApplySaved, markApplySaving, openRow, planSiteChromeLookSelection, planSiteStylePreviewChange, previewButtonPersonality, previewFooterLook, previewHeaderLayout, previewHeaderStyle, previewPaletteVariant, previewSiteStyle, previewTypographyPreset, resolvePreviewDashboardSetupHandoff, resolvePreviewEditorGuidanceModel, resolvePreviewSetupBannerModel, resolvePreviewSidebarChromeModel, resolveSiteStyleAccess, resolveStyleConfiguratorInitialSnapshot, sanitizeDashboardPath, setPaletteOverrides, setTypographyBodyFontOverride, setTypographyHeadingFontOverride, syncStyleConfiguratorState, toggleRow, usePreviewDesignCoordinator, usePreviewThemeOverlay };
|