@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
|
@@ -9,12 +9,13 @@ function PreviewLayoutProvider({
|
|
|
9
9
|
headerNode,
|
|
10
10
|
bannerNode = null,
|
|
11
11
|
footerNode,
|
|
12
|
+
siteChromeRenderModel = null,
|
|
12
13
|
children
|
|
13
14
|
}) {
|
|
14
15
|
return /* @__PURE__ */ jsx(
|
|
15
16
|
PreviewLayoutContext.Provider,
|
|
16
17
|
{
|
|
17
|
-
value: { headerNode, bannerNode, footerNode },
|
|
18
|
+
value: { headerNode, bannerNode, footerNode, siteChromeRenderModel },
|
|
18
19
|
children
|
|
19
20
|
}
|
|
20
21
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { compileSiteThemeFromSelections, footerLookCatalog,
|
|
3
|
-
import { createContext, useState,
|
|
2
|
+
import { assertNever2, deriveNearestCompatibleHeaderStyle, findLegacyHeaderLookIdForSelection, compileSiteThemeFromSelections, footerLookCatalog, getOrderedHeaderStyleIdsForLayout, getOrderedHeaderLayoutIdsForCuration, footerLookRejectionReasonLabel, getHeaderStyle, getHeaderLayout, writePlanForLookCustomizationCommand, siteStyleIdFromTheme, getCuratedSiteStyle } from './chunk-KWJPDZH2.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,42 +962,46 @@ 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
|
-
label: "Site style default",
|
|
727
|
-
description: "Use the header chosen for this site style.",
|
|
728
|
-
available: true
|
|
729
|
-
},
|
|
730
|
-
...headerLookCatalog.map((look) => {
|
|
731
|
-
const result = compileSiteThemeFromSelections({
|
|
732
|
-
...common,
|
|
733
|
-
headerLookId: look.id
|
|
734
|
-
});
|
|
735
|
-
const rejected = result.headerSelection.rejected.find((item) => item.lookId === look.id);
|
|
976
|
+
headerLayout: {
|
|
977
|
+
renderedLayoutId: renderedHeaderLayoutId,
|
|
978
|
+
options: getOrderedHeaderLayoutIdsForCuration(input.siteStyle).map(
|
|
979
|
+
(layoutId) => {
|
|
980
|
+
const layout = getHeaderLayout(layoutId);
|
|
736
981
|
return {
|
|
737
|
-
id:
|
|
738
|
-
label:
|
|
739
|
-
description:
|
|
740
|
-
available:
|
|
982
|
+
id: layoutId,
|
|
983
|
+
label: layout?.label ?? layoutId,
|
|
984
|
+
description: layout?.description,
|
|
985
|
+
available: true
|
|
741
986
|
};
|
|
742
|
-
}
|
|
743
|
-
],
|
|
744
|
-
diagnostics: diagnosticsForRequestedHeaderSelection(
|
|
745
|
-
selection.headerLookId,
|
|
746
|
-
current.resolvedSelections.headerLookId,
|
|
747
|
-
current.headerSelection.rejected
|
|
987
|
+
}
|
|
748
988
|
)
|
|
749
989
|
},
|
|
990
|
+
headerStyle: {
|
|
991
|
+
renderedStyleId: renderedHeaderStyleId,
|
|
992
|
+
options: getOrderedHeaderStyleIdsForLayout(
|
|
993
|
+
input.siteStyle,
|
|
994
|
+
selection.headerLayoutId
|
|
995
|
+
).map((styleId) => {
|
|
996
|
+
const style = getHeaderStyle(styleId);
|
|
997
|
+
return {
|
|
998
|
+
id: styleId,
|
|
999
|
+
label: style?.label ?? styleId,
|
|
1000
|
+
description: style?.description,
|
|
1001
|
+
available: true
|
|
1002
|
+
};
|
|
1003
|
+
})
|
|
1004
|
+
},
|
|
750
1005
|
footer: {
|
|
751
1006
|
renderedLookId: current.resolvedSelections.footerLookId,
|
|
752
1007
|
options: [
|
|
@@ -761,7 +1016,9 @@ function buildSiteChromeLookModels(input) {
|
|
|
761
1016
|
...common,
|
|
762
1017
|
footerLookId: look.id
|
|
763
1018
|
});
|
|
764
|
-
const rejected = result.footerSelection.rejected.find(
|
|
1019
|
+
const rejected = result.footerSelection.rejected.find(
|
|
1020
|
+
(item) => item.lookId === look.id
|
|
1021
|
+
);
|
|
765
1022
|
return {
|
|
766
1023
|
id: look.id,
|
|
767
1024
|
label: look.label,
|
|
@@ -791,10 +1048,14 @@ function cycleableSiteChromeOptions(options) {
|
|
|
791
1048
|
}
|
|
792
1049
|
function planSiteChromeLookSelection(command) {
|
|
793
1050
|
if (command.surface === "header") {
|
|
794
|
-
const
|
|
1051
|
+
const headerLookId = findLegacyHeaderLookIdForSelection({
|
|
1052
|
+
layoutId: command.layoutId,
|
|
1053
|
+
styleId: command.styleId
|
|
1054
|
+
});
|
|
1055
|
+
const lookCommand2 = headerLookId ? {
|
|
795
1056
|
kind: "select",
|
|
796
1057
|
surface: { kind: "site-header" },
|
|
797
|
-
lookId:
|
|
1058
|
+
lookId: headerLookId
|
|
798
1059
|
} : {
|
|
799
1060
|
kind: "clear",
|
|
800
1061
|
surface: { kind: "site-header" }
|
|
@@ -802,7 +1063,11 @@ function planSiteChromeLookSelection(command) {
|
|
|
802
1063
|
return {
|
|
803
1064
|
kind: "header",
|
|
804
1065
|
writePlan: writePlanForLookCustomizationCommand(lookCommand2),
|
|
805
|
-
next: {
|
|
1066
|
+
next: {
|
|
1067
|
+
headerLayoutId: command.layoutId,
|
|
1068
|
+
headerStyleId: command.styleId,
|
|
1069
|
+
headerLookId
|
|
1070
|
+
}
|
|
806
1071
|
};
|
|
807
1072
|
}
|
|
808
1073
|
const lookCommand = command.lookId ? {
|
|
@@ -819,17 +1084,31 @@ function planSiteChromeLookSelection(command) {
|
|
|
819
1084
|
next: { footerLookId: command.lookId }
|
|
820
1085
|
};
|
|
821
1086
|
}
|
|
822
|
-
function diagnosticsForRequestedHeaderSelection(requestedLookId, renderedLookId, rejected) {
|
|
823
|
-
if (!requestedLookId || requestedLookId === renderedLookId) return [];
|
|
824
|
-
const rejectedRequest = rejected.find((item) => item.lookId === requestedLookId);
|
|
825
|
-
return rejectedRequest?.reasons.map(headerLookRejectionReasonLabel) ?? [];
|
|
826
|
-
}
|
|
827
1087
|
function diagnosticsForRequestedFooterSelection(requestedLookId, renderedLookId, rejected) {
|
|
828
1088
|
if (!requestedLookId || requestedLookId === renderedLookId) return [];
|
|
829
|
-
const rejectedRequest = rejected.find(
|
|
1089
|
+
const rejectedRequest = rejected.find(
|
|
1090
|
+
(item) => item.lookId === requestedLookId
|
|
1091
|
+
);
|
|
830
1092
|
return rejectedRequest?.reasons.map(footerLookRejectionReasonLabel) ?? [];
|
|
831
1093
|
}
|
|
832
1094
|
|
|
1095
|
+
// ../preview-next/src/client/preview/typographySelectionInput.ts
|
|
1096
|
+
function typographySelectionInputForSnapshot(snapshot, theme) {
|
|
1097
|
+
if (snapshot.typographyPresetId === null && theme?.typography) {
|
|
1098
|
+
return {
|
|
1099
|
+
typographySelection: {
|
|
1100
|
+
kind: "custom",
|
|
1101
|
+
typography: theme.typography
|
|
1102
|
+
}
|
|
1103
|
+
};
|
|
1104
|
+
}
|
|
1105
|
+
return {
|
|
1106
|
+
typographyPresetId: snapshot.typographyPresetId,
|
|
1107
|
+
typographyBodyFontOverride: snapshot.typographyBodyFontOverride,
|
|
1108
|
+
typographyHeadingFontOverride: snapshot.typographyHeadingFontOverride
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
|
|
833
1112
|
// ../preview-next/src/client/preview/styleConfiguratorSnapshot.ts
|
|
834
1113
|
function resolveStyleConfiguratorInitialSnapshot(input) {
|
|
835
1114
|
const themeSiteStyleId = siteStyleIdFromTheme(input.theme);
|
|
@@ -841,6 +1120,9 @@ function resolveStyleConfiguratorInitialSnapshot(input) {
|
|
|
841
1120
|
buttonPersonalityId: input.initialSelections.buttonPersonalityId,
|
|
842
1121
|
paletteVariantId: input.initialSelections.paletteVariantId,
|
|
843
1122
|
paletteOverrides: input.initialSelections.paletteOverrides,
|
|
1123
|
+
headerLayoutId: input.initialSelections.headerLayoutId ?? null,
|
|
1124
|
+
headerStyleId: input.initialSelections.headerStyleId ?? null,
|
|
1125
|
+
...typographySelectionInputForSnapshot(input.initialSelections, input.theme),
|
|
844
1126
|
headerLookId: input.initialSelections.headerLookId ?? null,
|
|
845
1127
|
footerLookId: input.initialSelections.footerLookId ?? null,
|
|
846
1128
|
headerSelectionContext: input.headerSelectionContext,
|
|
@@ -851,12 +1133,43 @@ function resolveStyleConfiguratorInitialSnapshot(input) {
|
|
|
851
1133
|
siteStyleId: siteStyle.id,
|
|
852
1134
|
selectionVersion: input.initialSelections.selectionVersion ?? 0,
|
|
853
1135
|
selectionUpdatedAt: input.initialSelections.selectionUpdatedAt ?? null,
|
|
1136
|
+
headerLayoutId: compiled.resolvedSelections.headerLayoutId,
|
|
1137
|
+
headerStyleId: compiled.resolvedSelections.headerStyleId,
|
|
854
1138
|
headerLookId: compiled.requestedSelections.headerLookId,
|
|
855
1139
|
footerLookId: compiled.requestedSelections.footerLookId,
|
|
856
1140
|
buttonPersonalityId: compiled.resolvedSelections.buttonPersonalityId,
|
|
857
1141
|
paletteVariantId: compiled.resolvedSelections.paletteVariantId,
|
|
858
|
-
paletteOverrides: paletteChanged ? null : input.initialSelections.paletteOverrides
|
|
1142
|
+
paletteOverrides: paletteChanged ? null : input.initialSelections.paletteOverrides,
|
|
1143
|
+
typographyPresetId: compiled.resolvedSelections.typographyPresetId,
|
|
1144
|
+
typographyBodyFontOverride: compiled.resolvedSelections.typographyBodyFontOverride,
|
|
1145
|
+
typographyHeadingFontOverride: compiled.resolvedSelections.typographyHeadingFontOverride
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
// ../preview-next/src/client/preview/siteStylePreviewPlanner.ts
|
|
1150
|
+
function planSiteStylePreviewChange(input) {
|
|
1151
|
+
const compiled = compileSiteThemeFromSelections({
|
|
1152
|
+
siteStyle: input.siteStyle,
|
|
1153
|
+
buttonPersonalityId: input.selection.buttonPersonalityId,
|
|
1154
|
+
paletteVariantId: input.selection.paletteVariantId,
|
|
1155
|
+
paletteOverrides: input.selection.paletteOverrides,
|
|
1156
|
+
...typographySelectionInputForSnapshot(input.selection, input.baseTheme),
|
|
1157
|
+
headerLayoutId: input.selection.headerLayoutId,
|
|
1158
|
+
headerStyleId: input.selection.headerStyleId,
|
|
1159
|
+
headerLookId: input.selection.headerLookId,
|
|
1160
|
+
footerLookId: input.selection.footerLookId,
|
|
1161
|
+
headerSelectionContext: input.headerSelectionContext,
|
|
1162
|
+
footerSelectionContext: input.footerSelectionContext
|
|
1163
|
+
});
|
|
1164
|
+
return {
|
|
1165
|
+
themeOverlay: compiled.theme,
|
|
1166
|
+
resolvedSelections: compiled.resolvedSelections,
|
|
1167
|
+
chromeSelection: {
|
|
1168
|
+
headerLookId: input.selection.headerLookId,
|
|
1169
|
+
footerLookId: input.selection.footerLookId
|
|
1170
|
+
},
|
|
1171
|
+
warnings: compiled.warnings
|
|
859
1172
|
};
|
|
860
1173
|
}
|
|
861
1174
|
|
|
862
|
-
export { PreviewThemeOverlayProvider, applyResolvedSelections, buildPreviewDashboardSetupUrl, buildSiteChromeLookModels, canApplySiteStyle, canInspectSiteStyle, cancelPreview, createOptimisticActionRunner, createStyleConfiguratorState, cycleSiteChromeLookId, cycleableSiteChromeOptions, dismissNotices, dismissWarnings, isPreviewingChange, markApplyFailed, markApplySaved, markApplySaving, openRow, planSiteChromeLookSelection, previewButtonPersonality, previewFooterLook,
|
|
1175
|
+
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 };
|