@riverbankcms/sdk 0.78.0 → 0.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/README.md +125 -43
  2. package/dist/{PreviewEditorSidebar-RIKFQ72L.mjs → PreviewEditorSidebar-56NMJMIK.mjs} +750 -65
  3. package/dist/{PreviewEditorUI-XO7TUWKK.mjs → PreviewEditorUI-27KJVEET.mjs} +4 -4
  4. package/dist/SdkPreviewModeRuntime-H4BSP6E7.mjs +8 -0
  5. package/dist/_dts/ai/src/contracts/proposals.d.ts +72 -0
  6. package/dist/_dts/api/src/contentRuntime.d.ts +1 -0
  7. package/dist/_dts/api/src/endpoints.d.ts +64 -0
  8. package/dist/_dts/api/src/index.d.ts +8 -6
  9. package/dist/_dts/api/src/media.d.ts +8 -1
  10. package/dist/_dts/api/src/navigation/dashboardSettingsNav.d.ts +1 -1
  11. package/dist/_dts/api/src/navigation/dashboardSiteNav.d.ts +8 -8
  12. package/dist/_dts/api/src/navigation/identity.d.ts +59 -0
  13. package/dist/_dts/api/src/navigation.d.ts +2 -0
  14. package/dist/_dts/api/src/public/types.d.ts +1 -1
  15. package/dist/_dts/api/src/publicExperienceEndpoints.d.ts +4 -0
  16. package/dist/_dts/api/src/request.d.ts +3 -11
  17. package/dist/_dts/api/src/sdkConfig/contracts.d.ts +1 -0
  18. package/dist/_dts/api/src/sdkContracts.d.ts +8 -1
  19. package/dist/_dts/api/src/siteIcons.d.ts +128 -0
  20. package/dist/_dts/api/src/siteManagementEndpoints.d.ts +26 -0
  21. package/dist/_dts/api/src/sitePlatformEndpoints.d.ts +8 -0
  22. package/dist/_dts/api/src/siteRuntimeEndpoints.d.ts +21 -20
  23. package/dist/_dts/api/src/types.d.ts +12 -27
  24. package/dist/_dts/api/src/webhooks.d.ts +239 -0
  25. package/dist/_dts/block-form/src/fields/types.d.ts +6 -0
  26. package/dist/_dts/block-form/src/widgets/RepeaterField/components/RepeaterList.d.ts +3 -2
  27. package/dist/_dts/block-form/src/widgets/RepeaterField/components/RepeaterRow.d.ts +6 -3
  28. package/dist/_dts/block-form/src/widgets/RepeaterField/components/RepeaterRowActions.d.ts +8 -3
  29. package/dist/_dts/block-form/src/widgets/RepeaterField/hooks/index.d.ts +1 -1
  30. package/dist/_dts/block-form/src/widgets/RepeaterField/hooks/useLinearRepeaterDnd.d.ts +1 -0
  31. package/dist/_dts/block-form/src/widgets/RepeaterField/hooks/useRepeaterPointerDragCapability.d.ts +1 -0
  32. package/dist/_dts/block-form/src/widgets/RepeaterField/hooks/useResolvedItemLabel.d.ts +7 -0
  33. package/dist/_dts/block-form/src/widgets/RepeaterField/utils/buildSummary.d.ts +1 -0
  34. package/dist/_dts/block-form/src/widgets/RepeaterField/utils/index.d.ts +3 -1
  35. package/dist/_dts/block-form/src/widgets/RepeaterField/utils/repeaterDndDomain.d.ts +1 -1
  36. package/dist/_dts/block-form/src/widgets/RepeaterField/utils/repeaterLabelSource.d.ts +15 -0
  37. package/dist/_dts/block-form/src/widgets/RepeaterField/utils/repeaterRowActionsDomain.d.ts +50 -0
  38. package/dist/_dts/blocks/src/index.d.ts +4 -0
  39. package/dist/_dts/blocks/src/system/blocks/appointment-booking.d.ts +879 -288
  40. package/dist/_dts/blocks/src/system/blocks/blog-listing.d.ts +879 -288
  41. package/dist/_dts/blocks/src/system/blocks/cart.d.ts +879 -288
  42. package/dist/_dts/blocks/src/system/blocks/checkout.d.ts +879 -288
  43. package/dist/_dts/blocks/src/system/blocks/collection.d.ts +879 -288
  44. package/dist/_dts/blocks/src/system/blocks/faq.d.ts +885 -289
  45. package/dist/_dts/blocks/src/system/blocks/feature-card-icons.d.ts +57 -0
  46. package/dist/_dts/blocks/src/system/blocks/feature-cards.d.ts +4 -0
  47. package/dist/_dts/blocks/src/system/blocks/gifting.d.ts +879 -288
  48. package/dist/_dts/blocks/src/system/blocks/index.d.ts +1 -0
  49. package/dist/_dts/blocks/src/system/blocks/location-map.d.ts +3 -1
  50. package/dist/_dts/blocks/src/system/blocks/media-text.d.ts +69 -22
  51. package/dist/_dts/blocks/src/system/blocks/product-detail.d.ts +879 -288
  52. package/dist/_dts/blocks/src/system/blocks/product-list.d.ts +879 -288
  53. package/dist/_dts/blocks/src/system/blocks/shop.d.ts +879 -288
  54. package/dist/_dts/blocks/src/system/blocks/team-members.d.ts +3 -0
  55. package/dist/_dts/blocks/src/system/blocks/testimonials.d.ts +7 -1
  56. package/dist/_dts/blocks/src/system/customize/backgrounds.d.ts +170 -0
  57. package/dist/_dts/blocks/src/system/fragments/library/testimonialsCarousel.d.ts +5 -0
  58. package/dist/_dts/blocks/src/system/helpers/resolveBackground.d.ts +3 -1
  59. package/dist/_dts/blocks/src/system/icons/ids.d.ts +13 -0
  60. package/dist/_dts/blocks/src/system/icons/index.d.ts +6 -0
  61. package/dist/_dts/blocks/src/system/icons/presets.d.ts +4 -0
  62. package/dist/_dts/blocks/src/system/icons/registry.d.ts +18 -0
  63. package/dist/_dts/blocks/src/system/icons/semantic.d.ts +239 -0
  64. package/dist/_dts/blocks/src/system/icons/value.d.ts +94 -0
  65. package/dist/_dts/blocks/src/system/index.d.ts +1 -0
  66. package/dist/_dts/blocks/src/system/manifest/fieldValidation/index.d.ts +4 -1
  67. package/dist/_dts/blocks/src/system/manifest/schema.d.ts +187 -0
  68. package/dist/_dts/blocks/src/system/runtime/hooks/useHeadlessBookingFlow.state.d.ts +1 -1
  69. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.headless.state.d.ts +1 -1
  70. package/dist/_dts/blocks/src/system/runtime/nodes/feature-card-icon.d.ts +13 -0
  71. package/dist/_dts/content-editor/src/index.d.ts +1 -1
  72. package/dist/_dts/content-editor/src/ui/editorSnapshot.d.ts +2 -2
  73. package/dist/_dts/content-model/src/content-types/schema.d.ts +14 -0
  74. package/dist/_dts/content-model/src/contentManifest.d.ts +3 -1
  75. package/dist/_dts/content-model/src/templates/bindingTypeCompatibility.d.ts +3 -1
  76. package/dist/_dts/content-model/src/templates/bindingValidation.d.ts +10 -4
  77. package/dist/_dts/content-model/src/templates/fieldPaths.d.ts +20 -0
  78. package/dist/_dts/content-model/src/templates/manifestAdapter.d.ts +5 -2
  79. package/dist/_dts/core/src/branded.d.ts +114 -85
  80. package/dist/_dts/core/src/csv-types.d.ts +2 -2
  81. package/dist/_dts/core/src/editor-state.d.ts +7 -7
  82. package/dist/_dts/core/src/participants.d.ts +2 -2
  83. package/dist/_dts/db/src/generated/supabase/database.types.d.ts +202 -0
  84. package/dist/_dts/editor-blocks/src/block-editor/BlockCard.d.ts +12 -1
  85. package/dist/_dts/editor-blocks/src/block-editor/BlockCardBody.d.ts +12 -1
  86. package/dist/_dts/editor-blocks/src/block-editor/BlockCardHeader.d.ts +12 -2
  87. package/dist/_dts/editor-blocks/src/block-editor/FeatureCardIconsPanel.d.ts +21 -0
  88. package/dist/_dts/editor-blocks/src/block-editor/GeneratedIconSetDialog.d.ts +40 -0
  89. package/dist/_dts/editor-blocks/src/block-editor/SortableBlockItem.d.ts +11 -1
  90. package/dist/_dts/editor-blocks/src/block-editor/featureCardIconActions.d.ts +82 -0
  91. package/dist/_dts/editor-blocks/src/blockPayload.d.ts +1 -1
  92. package/dist/_dts/editor-blocks/src/widgets/icon-picker/IconPickerField.d.ts +1 -1
  93. package/dist/_dts/media-core/src/fileDomain.d.ts +8 -1
  94. package/dist/_dts/media-editor/src/MediaEditor.d.ts +5 -2
  95. package/dist/_dts/media-editor/src/MediaPreview.d.ts +3 -1
  96. package/dist/_dts/media-editor/src/fieldUi.d.ts +5 -0
  97. package/dist/_dts/media-editor/src/index.d.ts +1 -1
  98. package/dist/_dts/media-react/src/components/MediaLibrary.d.ts +2 -1
  99. package/dist/_dts/media-react/src/components/MediaPickerMini.d.ts +2 -1
  100. package/dist/_dts/preview-next/src/client/blocks/previewCustomizeActions.d.ts +17 -0
  101. package/dist/_dts/preview-next/src/client/preview/PageDesignEditorStateContext.d.ts +4 -0
  102. package/dist/_dts/preview-next/src/client/preview/StyleConfigurator.state.d.ts +3 -2
  103. package/dist/_dts/preview-next/src/client/preview/previewCustomizeHistory.d.ts +6 -0
  104. package/dist/_dts/sdk/src/cli/commands/push/consts.d.ts +1 -1
  105. package/dist/_dts/sdk/src/cli/commands/push/metadata.d.ts +2 -0
  106. package/dist/_dts/sdk/src/cli/commands/push/stale.d.ts +3 -3
  107. package/dist/_dts/sdk/src/cli/commands/push-execute.d.ts +7 -0
  108. package/dist/_dts/sdk/src/cli/commands/push.d.ts +2 -0
  109. package/dist/_dts/sdk/src/cli/content/reader.d.ts +13 -0
  110. package/dist/_dts/sdk/src/cli/content/writer.d.ts +2 -1
  111. package/dist/_dts/sdk/src/cli/helpers.d.ts +2 -0
  112. package/dist/_dts/sdk/src/cli/navigationIdentity.d.ts +11 -0
  113. package/dist/_dts/sdk/src/cli/site-commands/commandKeys.d.ts +6 -6
  114. package/dist/_dts/sdk/src/cli/site-commands/commandRuntime.d.ts +5 -0
  115. package/dist/_dts/sdk/src/cli/site-commands/commandSurfaceDispatch.d.ts +4 -0
  116. package/dist/_dts/sdk/src/cli/site-commands/navigationCommands.d.ts +4 -0
  117. package/dist/_dts/sdk/src/cli/site-commands/oneOffCommands.d.ts +1 -0
  118. package/dist/_dts/sdk/src/cli/site-commands/pageCommands.d.ts +5 -2
  119. package/dist/_dts/sdk/src/cli/site-commands/pushExecution.d.ts +10 -1
  120. package/dist/_dts/sdk/src/cli/site-commands/pushExecutionTypes.d.ts +1 -1
  121. package/dist/_dts/sdk/src/cli/sync/diff.d.ts +9 -0
  122. package/dist/_dts/sdk/src/client/management/types.d.ts +8 -0
  123. package/dist/_dts/sdk/src/client/types.d.ts +2 -2
  124. package/dist/_dts/sdk/src/config/content-types.d.ts +7 -0
  125. package/dist/_dts/sdk/src/config/field-definitions.d.ts +5 -1
  126. package/dist/_dts/sdk/src/contracts/index.d.ts +1 -1
  127. package/dist/_dts/sdk/src/contracts/system-block-content.d.ts +19 -2
  128. package/dist/_dts/sdk/src/next/index.d.ts +1 -1
  129. package/dist/_dts/sdk/src/next/revalidate.d.ts +26 -5
  130. package/dist/_dts/sdk/src/next/static-params.d.ts +28 -3
  131. package/dist/_dts/sdk/src/public-api/contracts.d.ts +5 -1
  132. package/dist/_dts/sdk/src/public-api/runtime.d.ts +1 -1
  133. package/dist/_dts/sdk/src/version.d.ts +1 -1
  134. package/dist/_dts/sdk/src/webhooks/index.d.ts +1 -1
  135. package/dist/_dts/sdk/src/webhooks/verify.d.ts +6 -102
  136. package/dist/_dts/site-commands/src/commands.d.ts +6 -0
  137. package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
  138. package/dist/_dts/theme-core/src/mock-themes/all.d.ts +3 -3
  139. package/dist/_dts/theme-core/src/schema.d.ts +5 -5
  140. package/dist/_dts/theme-core/src/site-styles/curatedSiteStyles.d.ts +25 -2
  141. package/dist/_dts/theme-core/src/site-styles/designState.d.ts +5 -5
  142. package/dist/_dts/theme-core/src/site-styles/generatedSchemas.d.ts +4 -2
  143. package/dist/_dts/theme-core/src/site-styles/previewCompiler.d.ts +4 -4
  144. package/dist/_dts/theme-core/src/tokens/themeColorTokens.d.ts +2 -0
  145. package/dist/_dts/ui/src/combobox.d.ts +1 -0
  146. package/dist/{altcha-B5XGSXP5.mjs → altcha-EKUEQ4RP.mjs} +1 -1
  147. package/dist/{chunk-F7RTCZYN.mjs → chunk-4HCW7FHJ.mjs} +504 -63
  148. package/dist/{chunk-SXOLGNMX.mjs → chunk-A3HHFKVT.mjs} +1 -1
  149. package/dist/{chunk-TXDES5P2.mjs → chunk-GP555I66.mjs} +180 -10
  150. package/dist/{chunk-SVMMM2NA.mjs → chunk-K2IIF34C.mjs} +79 -5
  151. package/dist/{chunk-NIDXI46P.mjs → chunk-LCY32PXF.mjs} +1 -1
  152. package/dist/{chunk-XGB3TDIC.mjs → chunk-R7POPVJR.mjs} +2 -8
  153. package/dist/{chunk-OECWLDHN.mjs → chunk-V47ZU33I.mjs} +2762 -732
  154. package/dist/cli/index.mjs +1799 -345
  155. package/dist/cli/init-docs/content/cli-reference.md +3 -2
  156. package/dist/cli/init-docs/content/content-management.md +2 -2
  157. package/dist/cli/init-docs/content/workflow-editor-workflows.md +2 -0
  158. package/dist/cli/init-docs/content/workflow-isr-revalidation.md +138 -0
  159. package/dist/cli/init-docs/content/workflow-preview-mode.md +68 -2
  160. package/dist/client/{accordion-EVDEOUPR.mjs → accordion-QLA7KBYO.mjs} +2 -2
  161. package/dist/client/analytics.mjs +1 -1
  162. package/dist/client/{bookingForm-DIHBLC64.mjs → bookingForm-PYZIPA5G.mjs} +55 -48
  163. package/dist/client/bookings.mjs +172 -57
  164. package/dist/client/{carousel-FEBQHIWI.mjs → carousel-5EIULWBI.mjs} +3 -3
  165. package/dist/client/{cart-7CKSXAE4.mjs → cart-DOP3FNI4.mjs} +7 -7
  166. package/dist/client/{checkout-WKYCANLV.mjs → checkout-BVMF6FBV.mjs} +7 -7
  167. package/dist/client/{chunk-GUK2FPXQ.mjs → chunk-44K2U3QI.mjs} +37 -15
  168. package/dist/client/{chunk-IVNCUVAV.mjs → chunk-AUJ5DBZJ.mjs} +18 -18
  169. package/dist/client/{chunk-VPPMNXCF.mjs → chunk-CCNTDRCF.mjs} +2 -2
  170. package/dist/client/{chunk-36WJCERQ.mjs → chunk-CE7IBGVW.mjs} +3 -1
  171. package/dist/client/{chunk-2SAVKN2M.mjs → chunk-GG4M2NP6.mjs} +2 -2
  172. package/dist/client/{chunk-65F47D7Y.mjs → chunk-R5ESWNKX.mjs} +49 -39
  173. package/dist/client/{chunk-RZDWX7QW.mjs → chunk-TYONZMST.mjs} +1 -1
  174. package/dist/client/{chunk-OFMSCGNY.mjs → chunk-UDS3NTWA.mjs} +2 -2
  175. package/dist/client/{chunk-YDSEG6GZ.mjs → chunk-V6M5FCR5.mjs} +2 -2
  176. package/dist/client/{chunk-F7LHOKEH.mjs → chunk-XSV6KW4D.mjs} +1 -1
  177. package/dist/client/{chunk-RV6FX7UH.mjs → chunk-YLDYVRZL.mjs} +9 -9
  178. package/dist/client/{chunk-PD6NBCEY.mjs → chunk-ZFHRN6W2.mjs} +1 -1
  179. package/dist/client/client.mjs +21501 -19812
  180. package/dist/client/{courseRegistration-5QF2PHKM.mjs → courseRegistration-E6EAA6NL.mjs} +10 -10
  181. package/dist/client/{eventCalendar-4ZOSETDU.mjs → eventCalendar-HBG3HAK6.mjs} +9 -9
  182. package/dist/client/{eventCombined-WQGU7JUX.mjs → eventCombined-6K5ZZWAK.mjs} +9 -9
  183. package/dist/client/{eventDetails-AYWVUJ5Y.mjs → eventDetails-Q75ICXLT.mjs} +9 -9
  184. package/dist/client/{eventListing-NT7C6UT5.mjs → eventListing-27P5F7DZ.mjs} +9 -9
  185. package/dist/client/{eventRegistration-OH24F4ZJ.mjs → eventRegistration-IQ7AMASR.mjs} +9 -9
  186. package/dist/client/{form-7L42SRBB.mjs → form-JRTD65FN.mjs} +6 -3
  187. package/dist/client/{headerSection-OZRZNZ52.mjs → headerSection-7FPSSZHS.mjs} +3 -3
  188. package/dist/client/hooks.mjs +428 -83
  189. package/dist/client/{locationMap-ZBXRPQ7C.mjs → locationMap-7NGFNYBH.mjs} +3 -3
  190. package/dist/client/{newsletterForm-SNAGFF2I.mjs → newsletterForm-F3BADCI2.mjs} +2 -2
  191. package/dist/client/{productDetail-I46BOFGV.mjs → productDetail-V3HP7ITJ.mjs} +7 -7
  192. package/dist/client/{productList-BOYHTYI6.mjs → productList-L3EGJUF2.mjs} +7 -7
  193. package/dist/client/rendering/client.mjs +2886 -1513
  194. package/dist/client/rendering/islands.mjs +19 -19
  195. package/dist/client/rendering.mjs +2244 -564
  196. package/dist/client/{shop-XTXPZTKR.mjs → shop-DQUB5E2C.mjs} +7 -7
  197. package/dist/preview-next/before-render.mjs +65 -1
  198. package/dist/preview-next/client/runtime.mjs +6 -6
  199. package/dist/preview-next/middleware.mjs +65 -1
  200. package/dist/preview-next/tailwind-sources.css +1 -0
  201. package/dist/sdk-runtime-AF6KXJU4.mjs +8 -0
  202. package/dist/server/components.mjs +2270 -835
  203. package/dist/server/config-template-validation.mjs +221 -15
  204. package/dist/server/config-validation.mjs +426 -77
  205. package/dist/server/config.mjs +426 -77
  206. package/dist/server/data.mjs +427 -82
  207. package/dist/server/index.mjs +94 -10
  208. package/dist/server/next/revalidate.mjs +229 -34
  209. package/dist/server/next.mjs +2439 -888
  210. package/dist/server/page-converter.mjs +335 -74
  211. package/dist/server/prebuild.mjs +1 -1
  212. package/dist/server/rendering/server.mjs +2281 -846
  213. package/dist/server/rendering.mjs +2298 -860
  214. package/dist/server/routing.mjs +860 -113
  215. package/dist/server/server.mjs +452 -92
  216. package/dist/server/theme-bridge.mjs +164 -2
  217. package/dist/server/theme.mjs +2 -2
  218. package/dist/server/webhooks.mjs +129 -25
  219. package/dist/styles/index.css +55 -0
  220. package/package.json +2 -1
  221. package/dist/SdkPreviewModeRuntime-LAGYMPNF.mjs +0 -8
  222. package/dist/sdk-runtime-ZJLKC6DR.mjs +0 -8
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { useOptionalPreviewLayout, PreviewQueryProvider } from './chunk-SXOLGNMX.mjs';
3
- import { PreviewThemeOverlayProvider, PreviewDesignCoordinatorProvider, resolveSiteStyleAccess, usePreviewDesignCoordinator, createOptimisticActionRunner, resolveStyleConfiguratorInitialSnapshot, createStyleConfiguratorState, syncStyleConfiguratorState, buildSiteChromeLookModels, planSiteStylePreviewChange, markApplyFailed, markApplySaved, markApplySaving, previewHeaderStyle, previewHeaderLayout, previewFooterLook, cycleSiteChromeLookId, usePreviewThemeOverlay, resolvePreviewDashboardSetupHandoff, buildPreviewDashboardSetupUrl, resolvePreviewSetupBannerModel, planSiteChromeLookSelection, sanitizeDashboardPath } from './chunk-NIDXI46P.mjs';
4
- import { resolvePreviewChromeSurface, getPreviewSidebarTab, onPreviewSidebarOpenRequest, getPreviewChromeSurfaceDataProps, PREVIEW_CHROME_THEME_CLASS_NAME, setPreviewSidebarTab, PreviewPageDesignEditorStateProvider, usePreviewPageDesignEditorState, PREVIEW_SURFACE_PARAM } from './chunk-TXDES5P2.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, SITE_CHROME_CLASS_NAMES, Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, buildEditorModelRuntimeFieldsByBlockId, applyCompiledRuntimeFieldsToContent, assertNever2, getBlockDefinition, systemCustomizeFacetDefinitionsForBlock, systemCustomizeFacetAppliesToLayoutVariant, systemCustomizeFacetCurrentValue, systemCustomizeFacetLabelForValue, visibleHeaderClearancePx, systemCustomizeFacetNextValue, EDITABLE_SURFACE_FORWARDING_PROP, assertNever, SITE_CHROME_VISIBLE_HEADER_SELECTOR } from './chunk-OECWLDHN.mjs';
6
- import { API_ENDPOINTS, createBearerAPIClient, isPreviewRuntimeSessionEditable, DEFAULT_SURFACE_ID, initPreviewAuth, usePreviewAuth, usePreviewAuthFetch, markPreviewAuthExpired, usePreviewToken, parseSurfaceId } from './chunk-SVMMM2NA.mjs';
2
+ import { useOptionalPreviewLayout, PreviewQueryProvider } from './chunk-A3HHFKVT.mjs';
3
+ import { PreviewThemeOverlayProvider, PreviewDesignCoordinatorProvider, resolveSiteStyleAccess, usePreviewDesignCoordinator, createOptimisticActionRunner, resolveStyleConfiguratorInitialSnapshot, createStyleConfiguratorState, syncStyleConfiguratorState, buildSiteChromeLookModels, planSiteStylePreviewChange, markApplyFailed, markApplySaved, markApplySaving, previewHeaderStyle, previewHeaderLayout, previewFooterLook, cycleSiteChromeLookId, usePreviewThemeOverlay, resolvePreviewDashboardSetupHandoff, buildPreviewDashboardSetupUrl, resolvePreviewSetupBannerModel, planSiteChromeLookSelection, sanitizeDashboardPath } from './chunk-LCY32PXF.mjs';
4
+ import { resolvePreviewChromeSurface, getPreviewSidebarTab, onPreviewSidebarOpenRequest, getPreviewChromeSurfaceDataProps, PREVIEW_CHROME_THEME_CLASS_NAME, setPreviewSidebarTab, PreviewPageDesignEditorStateProvider, usePreviewPageDesignEditorState, PREVIEW_SURFACE_PARAM } from './chunk-GP555I66.mjs';
5
+ import { clientComponentRegistry, deriveLaunchReadiness, DEFAULT_LAUNCH_READINESS_INPUT, useEditorUiStore, ResizableSplitPane, BlockApiProvider, EditorProvider, MediaEditorProvider, getCuratedSiteStyle, useEditor, createRoutingHelpers, createSnapshotFromPageRecord, EntryControllerProvider, useEntryEditorController, useEditorUiStoreInstance, surfaceResolutionContextFromTheme, unsafeAsEditorBlockId, EditableBlockProvider, asDesignBlockId, PageRenderer, planSiteDocument, ThemeScope, FixedBottomSurface, Button, unwrapResponse, X, ChevronLeft, ChevronRight, RotateCcw, parseBackgroundOverrideFromContent, rankBackgroundImagePoolItems, imagePoolForOverride, resolveBackgroundCapability, enabledBackgroundModes, PreviewRichTextEditor, RichText, PreviewTextEditor, Text, buildThemeRuntime, renderBlock, siteHeaderManifest, siteFooterManifest, SiteDocumentLayout, SITE_CHROME_CLASS_NAMES, Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, buildEditorModelRuntimeFieldsByBlockId, applyCompiledRuntimeFieldsToContent, assertNever2, getBlockDefinition, systemCustomizeFacetDefinitionsForBlock, systemCustomizeFacetAppliesToLayoutVariant, systemCustomizeFacetCurrentValue, systemCustomizeFacetLabelForValue, Image, useMediaEditorOptional, defaultBackgroundOverrideForMode, Upload, MediaEditor, visibleHeaderClearancePx, systemCustomizeFacetNextValue, GRADIENT_PRESETS, planBackgroundTransition, parseMediaAssetId, planBackgroundOverride, EDITABLE_SURFACE_FORWARDING_PROP, assertNever, SITE_CHROME_VISIBLE_HEADER_SELECTOR } from './chunk-V47ZU33I.mjs';
6
+ import { API_ENDPOINTS, createBearerAPIClient, isPreviewRuntimeSessionEditable, DEFAULT_SURFACE_ID, initPreviewAuth, usePreviewAuth, usePreviewAuthFetch, markPreviewAuthExpired, usePreviewToken, parseSurfaceId } from './chunk-K2IIF34C.mjs';
7
7
  import React9, { createContext, useMemo, useState, useEffect, useRef, useCallback, useId, useReducer, Children, isValidElement, Fragment as Fragment$1, cloneElement, useContext } from 'react';
8
8
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
9
 
@@ -123,9 +123,12 @@ function previewProjectionsFromAiOverlays(overlays) {
123
123
  }
124
124
  return projections;
125
125
  }
126
+ function toStringArray(value) {
127
+ return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
128
+ }
126
129
  function applyStructureProjection(blockItems, projection) {
127
- const order = projection.viewMode === "before" ? projection.before.blockIds : projection.after.blockIds;
128
- if (!Array.isArray(order) || order.length === 0) return blockItems.slice();
130
+ const order = projection.viewMode === "before" ? toStringArray(projection.before.blockIds) : toStringArray(projection.after.blockIds);
131
+ if (order.length === 0) return blockItems.slice();
129
132
  const itemsById = /* @__PURE__ */ new Map();
130
133
  const unknownIdItems = [];
131
134
  for (const item of blockItems) {
@@ -256,7 +259,7 @@ function getDraftSnapshots(uiStore) {
256
259
  }
257
260
  function mergeBlockWithDraft(block, draftMap, index, projections = []) {
258
261
  const id = block.id ?? null;
259
- const editorBlockId = id ? asEditorBlockId(id) : null;
262
+ const editorBlockId = id ? unsafeAsEditorBlockId(id) : null;
260
263
  const snap = editorBlockId ? draftMap.get(editorBlockId) ?? null : null;
261
264
  const rawDraft = snap?.current ?? null;
262
265
  const draftContent = editorBlockId ? applyPreviewContentFieldProjections(editorBlockId, rawDraft, projections) : rawDraft;
@@ -470,6 +473,25 @@ function cyclePageDesignBlockFacet(input) {
470
473
  baseContentId: input.block.contentRevision?.contentId ?? null
471
474
  };
472
475
  }
476
+ function setPageDesignBlockBackground(input) {
477
+ const current = input.currentContent ? parseBackgroundOverrideFromContent(input.currentContent) : {
478
+ kind: "supported",
479
+ override: input.fromOverride ?? { kind: "default" }
480
+ };
481
+ const capability = resolveBackgroundCapability({
482
+ block: input.block,
483
+ imagePool: input.imagePool ?? imagePoolForOverride(input.override)
484
+ });
485
+ const plan = planBackgroundOverride(current, capability, input.override);
486
+ if (plan.kind !== "apply") return null;
487
+ return {
488
+ kind: "set-background",
489
+ blockId: input.block.blockId,
490
+ override: plan.override,
491
+ fromOverride: plan.fromOverride,
492
+ baseContentId: input.block.contentRevision?.contentId ?? null
493
+ };
494
+ }
473
495
  function cyclePageDesignBoundaryBreak(boundary, direction) {
474
496
  if (boundary.availableBreaks.length === 0) return null;
475
497
  const breakIds = boundary.availableBreaks.map((option) => option.id);
@@ -584,6 +606,9 @@ function focusableElementsIn(root) {
584
606
  )
585
607
  ).filter((element) => !element.hasAttribute("disabled") && element.getAttribute("aria-hidden") !== "true");
586
608
  }
609
+ function isUnknownArray(value) {
610
+ return Array.isArray(value);
611
+ }
587
612
  function BlockToolbar({
588
613
  blockId,
589
614
  blockKind,
@@ -598,12 +623,16 @@ function BlockToolbar({
598
623
  [blockKind, content]
599
624
  );
600
625
  const [customizeOpen, setCustomizeOpen] = useState(false);
626
+ const [backgroundChooserOpen, setBackgroundChooserOpen] = useState(false);
601
627
  const customizeButtonRef = useRef(null);
602
628
  const {
603
629
  state: pageDesignState,
604
630
  applyAction: applyPageDesignAction,
605
631
  isHistoryPending,
606
- historyFailure
632
+ historyFailure,
633
+ backgroundImagePool = [],
634
+ backgroundImagePoolStatus = "idle",
635
+ loadBackgroundImagePool = async () => []
607
636
  } = usePreviewPageDesignEditorState();
608
637
  const closeCustomize = useCallback(() => {
609
638
  setCustomizeOpen(false);
@@ -637,13 +666,51 @@ function BlockToolbar({
637
666
  [blockKind, content, designBlock]
638
667
  );
639
668
  const hasFacetControls = facetControls.length > 0;
640
- const hasCustomizeControls = hasLayoutControls || hasLookControls || hasFacetControls;
669
+ const currentBackground = useMemo(
670
+ () => parseBackgroundOverrideFromContent(content),
671
+ [content]
672
+ );
673
+ const mergedBackgroundImagePool = useMemo(
674
+ () => rankBackgroundImagePoolItems(
675
+ dedupeBackgroundImagePool([
676
+ ...currentBackground.kind === "supported" ? imagePoolForOverride(currentBackground.override) : [],
677
+ ...backgroundImagePool
678
+ ])
679
+ ),
680
+ [backgroundImagePool, currentBackground]
681
+ );
682
+ const backgroundCapability = useMemo(
683
+ () => designBlock ? resolveBackgroundCapability({
684
+ block: designBlock,
685
+ imagePool: mergedBackgroundImagePool
686
+ }) : null,
687
+ [designBlock, mergedBackgroundImagePool]
688
+ );
689
+ const enabledBackgroundModeList = useMemo(
690
+ () => backgroundCapability ? enabledBackgroundModes(backgroundCapability) : [],
691
+ [backgroundCapability]
692
+ );
693
+ const hasBackgroundControls = currentBackground.kind === "supported" && enabledBackgroundModeList.length > 1;
694
+ const hasCustomizeControls = hasLayoutControls || hasLookControls || hasFacetControls || hasBackgroundControls;
641
695
  const isSavingCustomize = isHistoryPending;
642
696
  useEffect(() => {
643
697
  if (!hasCustomizeControls) {
644
698
  setCustomizeOpen(false);
699
+ setBackgroundChooserOpen(false);
645
700
  }
646
701
  }, [hasCustomizeControls]);
702
+ useEffect(() => {
703
+ if (!customizeOpen || !backgroundCapability?.modes.includes("image")) {
704
+ return;
705
+ }
706
+ if (backgroundImagePoolStatus !== "idle") return;
707
+ void loadBackgroundImagePool();
708
+ }, [
709
+ backgroundCapability,
710
+ backgroundImagePoolStatus,
711
+ customizeOpen,
712
+ loadBackgroundImagePool
713
+ ]);
647
714
  const handleEdit = (e) => {
648
715
  e.preventDefault();
649
716
  e.stopPropagation();
@@ -652,7 +719,7 @@ function BlockToolbar({
652
719
  state.setPreviewSidebarTab("editor");
653
720
  state.setDrawerOpen(true);
654
721
  state.requestFocus({
655
- blockId: asEditorBlockId(blockId),
722
+ blockId: unsafeAsEditorBlockId(blockId),
656
723
  fieldPath: focusTarget.fieldPath,
657
724
  itemIndex: focusTarget.itemIndex
658
725
  });
@@ -691,6 +758,42 @@ function BlockToolbar({
691
758
  if (!action) return;
692
759
  saveBlockCustomizeAction(action);
693
760
  };
761
+ const handleBackgroundCycle = (action) => (e) => {
762
+ e.preventDefault();
763
+ e.stopPropagation();
764
+ saveBackgroundTransition(action);
765
+ };
766
+ const chooseBackgroundOverride = (override) => {
767
+ if (!designBlock) return;
768
+ const action = setPageDesignBlockBackground({
769
+ block: designBlock,
770
+ override,
771
+ currentContent: content,
772
+ imagePool: mergedBackgroundImagePool
773
+ });
774
+ if (!action) return;
775
+ saveBlockCustomizeAction(action);
776
+ setBackgroundChooserOpen(false);
777
+ };
778
+ const saveBackgroundTransition = (transition) => {
779
+ if (!designBlock || !backgroundCapability || currentBackground.kind !== "supported") {
780
+ return;
781
+ }
782
+ const plan = planBackgroundTransition(
783
+ currentBackground.override,
784
+ backgroundCapability,
785
+ transition
786
+ );
787
+ if (plan.kind !== "apply") return;
788
+ const action = setPageDesignBlockBackground({
789
+ block: designBlock,
790
+ override: plan.override,
791
+ currentContent: content,
792
+ imagePool: mergedBackgroundImagePool
793
+ });
794
+ if (!action) return;
795
+ saveBlockCustomizeAction(action);
796
+ };
694
797
  const saveBlockCustomizeAction = (action) => {
695
798
  void applyPageDesignAction(action);
696
799
  };
@@ -845,6 +948,100 @@ function BlockToolbar({
845
948
  },
846
949
  control.facetId
847
950
  )),
951
+ hasBackgroundControls && currentBackground.kind === "supported" && backgroundCapability ? /* @__PURE__ */ jsxs("div", { children: [
952
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
953
+ /* @__PURE__ */ jsxs(
954
+ "button",
955
+ {
956
+ type: "button",
957
+ className: "flex min-w-0 items-center gap-2 text-left",
958
+ "aria-expanded": backgroundChooserOpen,
959
+ onClick: (event) => {
960
+ event.preventDefault();
961
+ event.stopPropagation();
962
+ setBackgroundChooserOpen((open) => !open);
963
+ },
964
+ children: [
965
+ /* @__PURE__ */ jsx(BackgroundPreviewSwatch, { override: currentBackground.override }),
966
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
967
+ /* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: "Background" }),
968
+ /* @__PURE__ */ jsx("div", { className: "truncate text-xs text-muted-foreground", children: backgroundOverrideLabel(currentBackground.override) })
969
+ ] })
970
+ ]
971
+ }
972
+ ),
973
+ /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [
974
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center overflow-hidden rounded-full border bg-background", children: [
975
+ /* @__PURE__ */ jsx(
976
+ "button",
977
+ {
978
+ type: "button",
979
+ onClick: handleBackgroundCycle({
980
+ kind: "cycle-mode",
981
+ direction: "prev"
982
+ }),
983
+ className: "grid h-8 w-8 place-items-center hover:bg-muted",
984
+ "aria-label": "Previous background mode",
985
+ children: /* @__PURE__ */ jsx(ChevronLeft, { size: 14 })
986
+ }
987
+ ),
988
+ /* @__PURE__ */ jsx(
989
+ "button",
990
+ {
991
+ type: "button",
992
+ onClick: handleBackgroundCycle({
993
+ kind: "cycle-mode",
994
+ direction: "next"
995
+ }),
996
+ className: "grid h-8 w-8 place-items-center border-l hover:bg-muted",
997
+ "aria-label": "Next background mode",
998
+ children: /* @__PURE__ */ jsx(ChevronRight, { size: 14 })
999
+ }
1000
+ )
1001
+ ] }),
1002
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center overflow-hidden rounded-full border bg-background", children: [
1003
+ /* @__PURE__ */ jsx(
1004
+ "button",
1005
+ {
1006
+ type: "button",
1007
+ onClick: handleBackgroundCycle({
1008
+ kind: "cycle-value",
1009
+ direction: "prev"
1010
+ }),
1011
+ className: "grid h-8 w-8 place-items-center hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
1012
+ "aria-label": "Previous background value",
1013
+ disabled: currentBackground.override.kind === "default",
1014
+ children: /* @__PURE__ */ jsx(ChevronLeft, { size: 14 })
1015
+ }
1016
+ ),
1017
+ /* @__PURE__ */ jsx(
1018
+ "button",
1019
+ {
1020
+ type: "button",
1021
+ onClick: handleBackgroundCycle({
1022
+ kind: "cycle-value",
1023
+ direction: "next"
1024
+ }),
1025
+ className: "grid h-8 w-8 place-items-center border-l hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
1026
+ "aria-label": "Next background value",
1027
+ disabled: currentBackground.override.kind === "default",
1028
+ children: /* @__PURE__ */ jsx(ChevronRight, { size: 14 })
1029
+ }
1030
+ )
1031
+ ] })
1032
+ ] })
1033
+ ] }),
1034
+ backgroundChooserOpen ? /* @__PURE__ */ jsx(
1035
+ BackgroundChooser,
1036
+ {
1037
+ capability: backgroundCapability,
1038
+ current: currentBackground.override,
1039
+ enabledModes: enabledBackgroundModeList,
1040
+ imagePoolStatus: backgroundImagePoolStatus,
1041
+ onChoose: chooseBackgroundOverride
1042
+ }
1043
+ ) : null
1044
+ ] }) : null,
848
1045
  hasLookControls ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
849
1046
  /* @__PURE__ */ jsxs("div", { children: [
850
1047
  /* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: "Look" }),
@@ -884,6 +1081,163 @@ function BlockToolbar({
884
1081
  }
885
1082
  );
886
1083
  }
1084
+ function BackgroundChooser({
1085
+ capability,
1086
+ current,
1087
+ enabledModes,
1088
+ imagePoolStatus,
1089
+ onChoose
1090
+ }) {
1091
+ const mediaEditorContext = useMediaEditorOptional();
1092
+ const [mediaPickerOpenKey, setMediaPickerOpenKey] = useState(0);
1093
+ const enabledModeSet = new Set(enabledModes);
1094
+ const images = rankBackgroundImagePoolItems(capability.imagePool ?? []);
1095
+ const recommendedTokens = capability.recommendedColorTokens ?? capability.colorTokens ?? [];
1096
+ const advancedTokens = capability.advancedColorTokens ?? [];
1097
+ const chooseFromClick = (override) => (event) => {
1098
+ event.preventDefault();
1099
+ event.stopPropagation();
1100
+ onChoose(override);
1101
+ };
1102
+ const chooseMediaValue = (value) => {
1103
+ if (value?.type !== "image" || !value.assetId) return;
1104
+ const parsed = parseMediaAssetId(value.assetId);
1105
+ if (!parsed.ok) return;
1106
+ onChoose({ kind: "image", mediaId: parsed.value });
1107
+ setMediaPickerOpenKey(0);
1108
+ };
1109
+ return /* @__PURE__ */ jsxs("div", { className: "mt-2 max-h-80 overflow-y-auto rounded-md border bg-muted/20 p-2", children: [
1110
+ /* @__PURE__ */ jsx("div", { className: "mb-2 grid grid-cols-4 gap-1", children: ["default", "color", "gradient", "image"].map((mode) => /* @__PURE__ */ jsx(
1111
+ "button",
1112
+ {
1113
+ type: "button",
1114
+ className: `rounded-md border px-2 py-1 text-xs ${current.kind === mode ? "border-foreground bg-foreground text-background" : "bg-background hover:bg-muted"} disabled:cursor-not-allowed disabled:opacity-50`,
1115
+ disabled: !enabledModeSet.has(mode),
1116
+ onClick: chooseFromClick(defaultBackgroundOverrideForMode(mode, capability)),
1117
+ children: backgroundModeLabel(mode)
1118
+ },
1119
+ mode
1120
+ )) }),
1121
+ recommendedTokens.length || advancedTokens.length ? /* @__PURE__ */ jsxs("div", { className: "mb-2", children: [
1122
+ /* @__PURE__ */ jsx("div", { className: "mb-1 text-xs font-medium text-muted-foreground", children: "Colors" }),
1123
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-1", children: recommendedTokens.map((token) => /* @__PURE__ */ jsxs(
1124
+ "button",
1125
+ {
1126
+ type: "button",
1127
+ className: `flex min-w-0 items-center gap-2 rounded-md border px-2 py-1 text-left text-xs hover:bg-muted ${current.kind === "color" && current.token === token ? "border-foreground" : "bg-background"}`,
1128
+ onClick: chooseFromClick({ kind: "color", token }),
1129
+ children: [
1130
+ /* @__PURE__ */ jsx(
1131
+ "span",
1132
+ {
1133
+ className: "h-3 w-3 shrink-0 rounded-full border",
1134
+ style: { backgroundColor: tokenSwatchCss(token) }
1135
+ }
1136
+ ),
1137
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: formatTokenLabel(token) })
1138
+ ]
1139
+ },
1140
+ token
1141
+ )) }),
1142
+ advancedTokens.length ? /* @__PURE__ */ jsxs("details", { className: "mt-1", children: [
1143
+ /* @__PURE__ */ jsx("summary", { className: "cursor-pointer text-xs text-muted-foreground", children: "More colors" }),
1144
+ /* @__PURE__ */ jsx("div", { className: "mt-1 grid grid-cols-2 gap-1", children: advancedTokens.map((token) => /* @__PURE__ */ jsxs(
1145
+ "button",
1146
+ {
1147
+ type: "button",
1148
+ className: `flex min-w-0 items-center gap-2 rounded-md border px-2 py-1 text-left text-xs hover:bg-muted ${current.kind === "color" && current.token === token ? "border-foreground" : "bg-background"}`,
1149
+ onClick: chooseFromClick({ kind: "color", token }),
1150
+ children: [
1151
+ /* @__PURE__ */ jsx(
1152
+ "span",
1153
+ {
1154
+ className: "h-3 w-3 shrink-0 rounded-full border",
1155
+ style: { backgroundColor: tokenSwatchCss(token) }
1156
+ }
1157
+ ),
1158
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: formatTokenLabel(token) })
1159
+ ]
1160
+ },
1161
+ token
1162
+ )) })
1163
+ ] }) : null
1164
+ ] }) : null,
1165
+ capability.gradientIds?.length ? /* @__PURE__ */ jsxs("div", { className: "mb-2", children: [
1166
+ /* @__PURE__ */ jsx("div", { className: "mb-1 text-xs font-medium text-muted-foreground", children: "Gradients" }),
1167
+ /* @__PURE__ */ jsx("div", { className: "space-y-1", children: capability.gradientIds.map((gradientId) => /* @__PURE__ */ jsx(
1168
+ "button",
1169
+ {
1170
+ type: "button",
1171
+ className: `w-full rounded-md border px-2 py-1 text-left text-xs hover:bg-muted ${current.kind === "gradient" && current.gradientId === gradientId ? "border-foreground" : "bg-background"}`,
1172
+ onClick: chooseFromClick({ kind: "gradient", gradientId }),
1173
+ children: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
1174
+ /* @__PURE__ */ jsx(
1175
+ "span",
1176
+ {
1177
+ className: "h-4 w-8 shrink-0 rounded border",
1178
+ style: { backgroundImage: gradientPreviewCss(gradientId) }
1179
+ }
1180
+ ),
1181
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: gradientLabel(gradientId) })
1182
+ ] })
1183
+ },
1184
+ gradientId
1185
+ )) })
1186
+ ] }) : null,
1187
+ capability.modes.includes("image") ? /* @__PURE__ */ jsxs("div", { children: [
1188
+ /* @__PURE__ */ jsx("div", { className: "mb-1 text-xs font-medium text-muted-foreground", children: "Images" }),
1189
+ mediaEditorContext ? /* @__PURE__ */ jsxs(
1190
+ "button",
1191
+ {
1192
+ type: "button",
1193
+ className: "mb-2 inline-flex w-full items-center justify-center gap-2 rounded-md border bg-background px-2 py-1.5 text-xs font-medium hover:bg-muted",
1194
+ onClick: (event) => {
1195
+ event.preventDefault();
1196
+ event.stopPropagation();
1197
+ setMediaPickerOpenKey((key) => key + 1);
1198
+ },
1199
+ children: [
1200
+ /* @__PURE__ */ jsx(Upload, { size: 13 }),
1201
+ "Media library"
1202
+ ]
1203
+ }
1204
+ ) : null,
1205
+ images.length ? /* @__PURE__ */ jsx("div", { className: "space-y-1", children: images.map((item) => /* @__PURE__ */ jsx(
1206
+ "button",
1207
+ {
1208
+ type: "button",
1209
+ className: `w-full rounded-md border px-2 py-1 text-left text-xs hover:bg-muted ${current.kind === "image" && current.mediaId === item.mediaId ? "border-foreground" : "bg-background"}`,
1210
+ onClick: chooseFromClick({ kind: "image", mediaId: item.mediaId }),
1211
+ children: /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [
1212
+ /* @__PURE__ */ jsx("span", { className: "grid h-7 w-9 shrink-0 place-items-center rounded border bg-muted", children: /* @__PURE__ */ jsx(Image, { size: 14 }) }),
1213
+ /* @__PURE__ */ jsxs("span", { className: "min-w-0", children: [
1214
+ /* @__PURE__ */ jsx("span", { className: "block truncate", children: item.label ?? "Image" }),
1215
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground", children: imageSourceLabel(item.source) })
1216
+ ] })
1217
+ ] })
1218
+ },
1219
+ `${item.source}:${item.mediaId}`
1220
+ )) }) : /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: imagePoolStatus === "loading" ? "Loading images..." : "No images available yet." }),
1221
+ mediaPickerOpenKey > 0 && mediaEditorContext ? /* @__PURE__ */ jsx("div", { onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx(
1222
+ MediaEditor,
1223
+ {
1224
+ value: void 0,
1225
+ onChange: chooseMediaValue,
1226
+ allowedKinds: ["image"],
1227
+ mediaPickerAutoOpen: true,
1228
+ showPreview: false,
1229
+ showAltInput: false,
1230
+ uploadIntent: { tag: "media-library", allowedRenderUses: ["image"] },
1231
+ onUploadComplete: (asset) => {
1232
+ onChoose({ kind: "image", mediaId: asset.id });
1233
+ setMediaPickerOpenKey(0);
1234
+ }
1235
+ },
1236
+ mediaPickerOpenKey
1237
+ ) }) : null
1238
+ ] }) : null
1239
+ ] });
1240
+ }
887
1241
  function computeDefaultFocus(blockKind, content) {
888
1242
  const definition = getBlockDefinition(blockKind);
889
1243
  if (!definition?.manifest) {
@@ -917,7 +1271,7 @@ function findFirstFieldPath(fields, data, prefix) {
917
1271
  }
918
1272
  if (field.type === "repeater" && field.schema) {
919
1273
  const collection = isRecord3(data) ? data[field.id] : void 0;
920
- const items = Array.isArray(collection) ? collection : [];
1274
+ const items = isUnknownArray(collection) ? collection : [];
921
1275
  if (items.length > 0) {
922
1276
  const firstItem = items[0];
923
1277
  const nested = findFirstFieldPath(field.schema.fields, firstItem, [
@@ -953,6 +1307,83 @@ function lookLabel(block) {
953
1307
  }
954
1308
  return option?.label ?? "Selected look";
955
1309
  }
1310
+ function backgroundOverrideLabel(override) {
1311
+ switch (override.kind) {
1312
+ case "default":
1313
+ return "Default";
1314
+ case "color":
1315
+ return `Color: ${formatTokenLabel(override.token)}`;
1316
+ case "gradient":
1317
+ return `Gradient: ${gradientLabel(override.gradientId)}`;
1318
+ case "image":
1319
+ return "Image";
1320
+ }
1321
+ }
1322
+ function BackgroundPreviewSwatch({ override }) {
1323
+ const baseClassName = "grid h-8 w-10 shrink-0 place-items-center overflow-hidden rounded-md border";
1324
+ switch (override.kind) {
1325
+ case "default":
1326
+ return /* @__PURE__ */ jsx("span", { className: `${baseClassName} bg-background`, children: /* @__PURE__ */ jsx("span", { className: "h-3 w-3 rounded-full border bg-muted" }) });
1327
+ case "color":
1328
+ return /* @__PURE__ */ jsx(
1329
+ "span",
1330
+ {
1331
+ className: baseClassName,
1332
+ style: { backgroundColor: tokenSwatchCss(override.token) }
1333
+ }
1334
+ );
1335
+ case "gradient":
1336
+ return /* @__PURE__ */ jsx(
1337
+ "span",
1338
+ {
1339
+ className: baseClassName,
1340
+ style: { backgroundImage: gradientPreviewCss(override.gradientId) }
1341
+ }
1342
+ );
1343
+ case "image":
1344
+ return /* @__PURE__ */ jsx("span", { className: `${baseClassName} bg-muted`, children: /* @__PURE__ */ jsx(Image, { size: 15 }) });
1345
+ }
1346
+ }
1347
+ function backgroundModeLabel(mode) {
1348
+ return mode === "default" ? "Default" : formatVariantLabel(mode);
1349
+ }
1350
+ function gradientLabel(gradientId) {
1351
+ return GRADIENT_PRESETS.find((preset) => preset.id === gradientId)?.name ?? formatVariantLabel(gradientId);
1352
+ }
1353
+ function imageSourceLabel(source) {
1354
+ switch (source) {
1355
+ case "current":
1356
+ return "Current";
1357
+ case "generated-ambient":
1358
+ return "Generated";
1359
+ case "previous-background":
1360
+ return "Previous";
1361
+ case "general-media":
1362
+ return "Media library";
1363
+ }
1364
+ }
1365
+ function tokenSwatchCss(token) {
1366
+ return `rgb(var(--tb-${token}))`;
1367
+ }
1368
+ function gradientPreviewCss(gradientId) {
1369
+ const preset = GRADIENT_PRESETS.find((candidate) => candidate.id === gradientId);
1370
+ if (!preset) return "linear-gradient(135deg, rgb(var(--tb-primary)), rgb(var(--tb-secondary)))";
1371
+ const stops = preset.stops.map((stop) => `${tokenSwatchCss(stop.color)} ${stop.position}%`).join(", ");
1372
+ return preset.type === "radial" ? `radial-gradient(circle, ${stops})` : `linear-gradient(${preset.angle ?? 135}deg, ${stops})`;
1373
+ }
1374
+ function formatTokenLabel(token) {
1375
+ return formatVariantLabel(token.replace(/\//g, " "));
1376
+ }
1377
+ function dedupeBackgroundImagePool(items) {
1378
+ const seen = /* @__PURE__ */ new Set();
1379
+ const deduped = [];
1380
+ for (const item of items) {
1381
+ if (seen.has(item.mediaId)) continue;
1382
+ seen.add(item.mediaId);
1383
+ deduped.push(item);
1384
+ }
1385
+ return deduped;
1386
+ }
956
1387
  function BoundaryControl({
957
1388
  previousBlockId,
958
1389
  nextBlockId,
@@ -1257,7 +1688,7 @@ function EditablePageRenderer(props) {
1257
1688
  const previousBlock = blockIndex > 0 ? blockItemsForRender[blockIndex - 1] ?? null : null;
1258
1689
  const canonicalBlockIndex = blockItems.findIndex((b) => b.id === blockId);
1259
1690
  const canonicalPreviousBlock = canonicalBlockIndex > 0 ? blockItems[canonicalBlockIndex - 1] ?? null : null;
1260
- const editorBlockId = asEditorBlockId(blockId);
1691
+ const editorBlockId = unsafeAsEditorBlockId(blockId);
1261
1692
  if (!block) {
1262
1693
  return /* @__PURE__ */ jsx(EditableBlockProvider, { blockId, children: rendered });
1263
1694
  }
@@ -1570,7 +2001,7 @@ function usePreviewKeepAlive({ enabled, fetcher, onExpired, intervalMs = DEFAULT
1570
2001
  }
1571
2002
  }
1572
2003
  }
1573
- keepAlive();
2004
+ void keepAlive();
1574
2005
  const id = window.setInterval(keepAlive, withJitter(intervalMs));
1575
2006
  return () => {
1576
2007
  isActive = false;
@@ -3088,11 +3519,11 @@ function renderPreviewDocument({
3088
3519
  }
3089
3520
  var previewContainerResponsiveEnabled = process.env.NEXT_PUBLIC_ENABLE_PREVIEW_CONTAINER_RESPONSIVE !== "false";
3090
3521
  var PreviewEditorSidebar = React9.lazy(async () => {
3091
- const mod = await import('./PreviewEditorSidebar-RIKFQ72L.mjs');
3522
+ const mod = await import('./PreviewEditorSidebar-56NMJMIK.mjs');
3092
3523
  return { default: mod.PreviewEditorSidebar };
3093
3524
  });
3094
3525
  var PreviewEditorUI = React9.lazy(async () => {
3095
- const mod = await import('./PreviewEditorUI-XO7TUWKK.mjs');
3526
+ const mod = await import('./PreviewEditorUI-27KJVEET.mjs');
3096
3527
  return { default: mod.PreviewEditorUI };
3097
3528
  });
3098
3529
  var previewPaneContainmentStyle = {
@@ -3568,59 +3999,69 @@ function PreviewShell({
3568
3999
  initialBlocks,
3569
4000
  pageMetadata,
3570
4001
  apiClient,
3571
- children: /* @__PURE__ */ jsxs(
4002
+ children: /* @__PURE__ */ jsx(
3572
4003
  PreviewPageDesignEditorStateProvider,
3573
4004
  {
3574
4005
  apiClient,
3575
4006
  siteId,
3576
4007
  pageId,
3577
4008
  enabled: designEditorEnabled,
3578
- children: [
3579
- /* @__PURE__ */ jsx(PreviewKeepAliveClient, { baseFetch }),
3580
- /* @__PURE__ */ jsx(
3581
- PreviewShellLayout,
3582
- {
3583
- theme,
3584
- surfaceId,
3585
- siteId,
3586
- dashboardBaseUrl,
3587
- pageId,
3588
- entryData: entryData ?? null,
3589
- contentTypeSchema,
3590
- referenceContentTypeKeys,
3591
- draftContent,
3592
- currentTemplate,
3593
- apiClient,
3594
- bearerToken: previewToken,
3595
- themeId,
3596
- themeSelectionId,
3597
- themeSelectionVersion,
3598
- themeSelectionUpdatedAt,
3599
- themeSelectionButtonPersonalityId,
3600
- themeSelectionPaletteVariantId,
3601
- themeSelectionPaletteOverrides,
3602
- themeSelectionHeaderLayoutId,
3603
- themeSelectionHeaderStyleId,
3604
- themeSelectionTypographyPresetId,
3605
- themeSelectionTypographyBodyFontOverride,
3606
- themeSelectionTypographyHeadingFontOverride,
3607
- themeSelectionHeaderLookId,
3608
- themeSelectionFooterLookId,
3609
- themeSelectionHeaderContext,
3610
- themeSelectionFooterContext,
3611
- supabaseUrl,
3612
- isSiteLaunched,
3613
- maintenanceModeEnabled,
3614
- entrySubrouteContext,
3615
- assistantPanel,
3616
- sdkConfig: sdkConfig ?? null,
3617
- mediaAssets,
3618
- useThemeScope,
3619
- siteStyleAccess,
3620
- children
3621
- }
3622
- )
3623
- ]
4009
+ children: /* @__PURE__ */ jsxs(
4010
+ MediaEditorProvider,
4011
+ {
4012
+ siteId,
4013
+ apiClient,
4014
+ bearerToken: previewToken,
4015
+ supabaseUrl,
4016
+ mediaAssets,
4017
+ children: [
4018
+ /* @__PURE__ */ jsx(PreviewKeepAliveClient, { baseFetch }),
4019
+ /* @__PURE__ */ jsx(
4020
+ PreviewShellLayout,
4021
+ {
4022
+ theme,
4023
+ surfaceId,
4024
+ siteId,
4025
+ dashboardBaseUrl,
4026
+ pageId,
4027
+ entryData: entryData ?? null,
4028
+ contentTypeSchema,
4029
+ referenceContentTypeKeys,
4030
+ draftContent,
4031
+ currentTemplate,
4032
+ apiClient,
4033
+ bearerToken: previewToken,
4034
+ themeId,
4035
+ themeSelectionId,
4036
+ themeSelectionVersion,
4037
+ themeSelectionUpdatedAt,
4038
+ themeSelectionButtonPersonalityId,
4039
+ themeSelectionPaletteVariantId,
4040
+ themeSelectionPaletteOverrides,
4041
+ themeSelectionHeaderLayoutId,
4042
+ themeSelectionHeaderStyleId,
4043
+ themeSelectionTypographyPresetId,
4044
+ themeSelectionTypographyBodyFontOverride,
4045
+ themeSelectionTypographyHeadingFontOverride,
4046
+ themeSelectionHeaderLookId,
4047
+ themeSelectionFooterLookId,
4048
+ themeSelectionHeaderContext,
4049
+ themeSelectionFooterContext,
4050
+ supabaseUrl,
4051
+ isSiteLaunched,
4052
+ maintenanceModeEnabled,
4053
+ entrySubrouteContext,
4054
+ assistantPanel,
4055
+ sdkConfig: sdkConfig ?? null,
4056
+ mediaAssets,
4057
+ useThemeScope,
4058
+ siteStyleAccess,
4059
+ children
4060
+ }
4061
+ )
4062
+ ]
4063
+ }
4064
+ )
3624
4065
  }
3625
4066
  )
3626
4067
  }