@riverbankcms/sdk 0.79.0 → 0.81.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 (327) hide show
  1. package/dist/PreviewEditorSidebar-RDCMEXIJ.mjs +3163 -0
  2. package/dist/{PreviewEditorUI-27KJVEET.mjs → PreviewEditorUI-NYGQ6K7B.mjs} +194 -30
  3. package/dist/SdkPreviewModeRuntime-AKCSCZEC.mjs +8 -0
  4. package/dist/_dts/ai/src/contracts/proposals.d.ts +20 -0
  5. package/dist/_dts/api/src/contentRuntime.d.ts +12 -0
  6. package/dist/_dts/api/src/contentTypes.d.ts +6 -0
  7. package/dist/_dts/api/src/endpoints.d.ts +24 -0
  8. package/dist/_dts/api/src/index.d.ts +3 -3
  9. package/dist/_dts/api/src/publicExperienceEndpoints.d.ts +53 -0
  10. package/dist/_dts/api/src/siteInfrastructure.d.ts +124 -0
  11. package/dist/_dts/api/src/siteOnboarding.d.ts +13 -0
  12. package/dist/_dts/api/src/sitePlatformEndpoints.d.ts +10 -1
  13. package/dist/_dts/block-form/src/backend/store-backend.d.ts +3 -1
  14. package/dist/_dts/block-form/src/backend/types.d.ts +3 -3
  15. package/dist/_dts/block-form/src/client/index.d.ts +2 -0
  16. package/dist/_dts/block-form/src/index.d.ts +2 -0
  17. package/dist/_dts/block-form/src/utils/evaluateVisibility.d.ts +2 -1
  18. package/dist/_dts/blocks/src/PageRenderer.d.ts +3 -0
  19. package/dist/_dts/blocks/src/client/header.d.ts +1 -1
  20. package/dist/_dts/blocks/src/client.d.ts +12 -12
  21. package/dist/_dts/blocks/src/contracts/proof-block-islands.d.ts +20 -28
  22. package/dist/_dts/blocks/src/index.d.ts +7 -5
  23. package/dist/_dts/blocks/src/primitives/content/components/Text.d.ts +1 -1
  24. package/dist/_dts/blocks/src/primitives/content/primitives.d.ts +1 -0
  25. package/dist/_dts/blocks/src/server.d.ts +1 -1
  26. package/dist/_dts/blocks/src/system/blocks/events/event-calendar.d.ts +3 -2
  27. package/dist/_dts/blocks/src/system/blocks/events/event-listing.d.ts +2 -2
  28. package/dist/_dts/blocks/src/system/blocks/events/event-spotlight.d.ts +2 -1
  29. package/dist/_dts/blocks/src/system/blocks/events/shared/schemas.d.ts +135 -0
  30. package/dist/_dts/blocks/src/system/blocks/events/shared/types.d.ts +9 -1
  31. package/dist/_dts/blocks/src/system/blocks/feature-cards.d.ts +2 -0
  32. package/dist/_dts/blocks/src/system/blocks/form.d.ts +20 -1
  33. package/dist/_dts/blocks/src/system/blocks/hero.d.ts +2 -0
  34. package/dist/_dts/blocks/src/system/blocks/offerings-preview/index.d.ts +19 -0
  35. package/dist/_dts/blocks/src/system/blocks/offerings-preview/model.d.ts +134 -0
  36. package/dist/_dts/blocks/src/system/blocks/testimonials.d.ts +7 -1
  37. package/dist/_dts/blocks/src/system/componentFactory.d.ts +1 -0
  38. package/dist/_dts/blocks/src/system/constants/background.d.ts +1 -1
  39. package/dist/_dts/blocks/src/system/constants/blockKinds.d.ts +1 -1
  40. package/dist/_dts/blocks/src/system/customize/backgrounds.d.ts +34 -15
  41. package/dist/_dts/blocks/src/system/data/index.d.ts +2 -0
  42. package/dist/_dts/blocks/src/system/data/linkedContentEntries.d.ts +64 -0
  43. package/dist/_dts/blocks/src/system/data/loaderEndpoints.d.ts +1 -1
  44. package/dist/_dts/blocks/src/system/designCapabilities.d.ts +2 -2
  45. package/dist/_dts/blocks/src/system/fields/boxStyles.d.ts +10 -3
  46. package/dist/_dts/blocks/src/system/fragments/library/testimonialsCarousel.d.ts +5 -0
  47. package/dist/_dts/blocks/src/system/media/slotContracts.d.ts +2 -0
  48. package/dist/_dts/blocks/src/system/node/fragments/headingDecoration.d.ts +1 -4
  49. package/dist/_dts/blocks/src/system/node/types.d.ts +8 -1
  50. package/dist/_dts/blocks/src/system/node/validation-constants.d.ts +2 -2
  51. package/dist/_dts/blocks/src/system/registry.d.ts +1 -0
  52. package/dist/_dts/blocks/src/system/runtime/components/registry.client.d.ts +51 -57
  53. package/dist/_dts/blocks/src/system/runtime/components/runtime-backed-blocks.d.ts +24 -27
  54. package/dist/_dts/blocks/src/system/runtime/header/enhanceHeaderSection.d.ts +10 -2
  55. package/dist/_dts/blocks/src/system/runtime/headingDecoration.d.ts +21 -0
  56. package/dist/_dts/blocks/src/system/runtime/hooks/useCalendarEvents.d.ts +45 -14
  57. package/dist/_dts/blocks/src/system/runtime/hooks/useEventFilters.d.ts +2 -9
  58. package/dist/_dts/blocks/src/system/runtime/hooks/useEventPagination.d.ts +1 -10
  59. package/dist/_dts/blocks/src/system/runtime/nodes/basic.d.ts +1 -0
  60. package/dist/_dts/blocks/src/system/runtime/nodes/events/EventCalendar.interactive.d.ts +21 -16
  61. package/dist/_dts/blocks/src/system/runtime/nodes/events/EventCombined.client.d.ts +3 -2
  62. package/dist/_dts/blocks/src/system/runtime/nodes/events/EventCombined.interactive.d.ts +21 -16
  63. package/dist/_dts/blocks/src/system/runtime/nodes/events/EventListing.interactive.d.ts +22 -33
  64. package/dist/_dts/blocks/src/system/runtime/nodes/events/EventListing.server.d.ts +2 -2
  65. package/dist/_dts/blocks/src/system/runtime/nodes/events/EventSpotlight.d.ts +2 -2
  66. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/EventCard.d.ts +2 -2
  67. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/EventDetailModal.d.ts +2 -2
  68. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/EventModals.d.ts +2 -2
  69. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/EventPaginatedListView.client.d.ts +2 -3
  70. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/WeekAgendaView.d.ts +3 -3
  71. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/listOptions.d.ts +50 -0
  72. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/utils.d.ts +2 -1
  73. package/dist/_dts/blocks/src/system/runtime/nodes/header-section.client.d.ts +2 -2
  74. package/dist/_dts/blocks/src/system/runtime/nodes/media.d.ts +29 -14
  75. package/dist/_dts/blocks/src/system/runtime/nodes/offerings-preview.d.ts +21 -0
  76. package/dist/_dts/blocks/src/system/runtime/resolver.d.ts +7 -0
  77. package/dist/_dts/blocks/src/system/transforms/registry/_utils/sectionForegroundStyles.d.ts +2 -0
  78. package/dist/_dts/blocks/src/system/transforms/registry/boxStyles.d.ts +7 -2
  79. package/dist/_dts/blocks/src/system/transforms/registry/layout.d.ts +9 -0
  80. package/dist/_dts/blocks/src/system/transforms/typed.d.ts +14 -1
  81. package/dist/_dts/calendar/src/grid.d.ts +27 -0
  82. package/dist/_dts/calendar/src/index.d.ts +2 -2
  83. package/dist/_dts/content-editor/src/controller/useAutosaveTriggers.d.ts +3 -1
  84. package/dist/_dts/content-editor/src/editorTransactionState.d.ts +1 -0
  85. package/dist/_dts/content-editor/src/hooks/autosaveScopePlanning.d.ts +26 -0
  86. package/dist/_dts/content-editor/src/hooks/publishability.d.ts +1 -0
  87. package/dist/_dts/content-editor/src/hooks/useLinkedEntryAutosave.d.ts +23 -0
  88. package/dist/_dts/content-editor/src/hooks/useReactiveToolbar.d.ts +1 -1
  89. package/dist/_dts/content-editor/src/hooks/useSimpleAutosave.d.ts +2 -2
  90. package/dist/_dts/content-editor/src/index.d.ts +3 -1
  91. package/dist/_dts/content-editor/src/lib/json.d.ts +2 -0
  92. package/dist/_dts/content-editor/src/linkedEntries/domain.d.ts +8 -0
  93. package/dist/_dts/content-editor/src/ui/editorSnapshot.d.ts +58 -0
  94. package/dist/_dts/content-editor/src/ui/editorTransactionState.d.ts +93 -0
  95. package/dist/_dts/content-editor/src/ui/editorUiStore.d.ts +60 -3
  96. package/dist/_dts/content-editor/src/ui/stores/autosaveStore.d.ts +2 -0
  97. package/dist/_dts/content-editor/src/ui/stores/types.d.ts +1 -1
  98. package/dist/_dts/content-model/src/content-types/builtins.d.ts +43 -0
  99. package/dist/_dts/content-model/src/metadataConfig.d.ts +87 -47
  100. package/dist/_dts/core/src/branded.d.ts +5 -0
  101. package/dist/_dts/core/src/index.d.ts +1 -0
  102. package/dist/_dts/core/src/stable-json.d.ts +1 -0
  103. package/dist/_dts/db/src/generated/supabase/database.types.d.ts +9 -3
  104. package/dist/_dts/editor/src/EditorProvider.d.ts +26 -0
  105. package/dist/_dts/editor/src/chrome/EditorChrome.d.ts +26 -0
  106. package/dist/_dts/editor/src/chrome/EditorStatusBar.d.ts +45 -0
  107. package/dist/_dts/editor/src/chrome/statusBarPresentation.d.ts +25 -0
  108. package/dist/_dts/editor/src/components/EditingToggle.d.ts +9 -0
  109. package/dist/_dts/editor/src/hooks/useEditableElement.d.ts +18 -0
  110. package/dist/_dts/editor/src/index.d.ts +29 -0
  111. package/dist/_dts/editor/src/inline/InlineTextEditor.d.ts +1 -0
  112. package/dist/_dts/editor/src/lib/utils.d.ts +1 -0
  113. package/dist/_dts/editor/src/primitives/EditorPrimitivesProvider.d.ts +20 -0
  114. package/dist/_dts/editor/src/primitives/InlineFieldContext.d.ts +11 -0
  115. package/dist/_dts/editor/src/primitives/SaveContext.d.ts +12 -0
  116. package/dist/_dts/editor/src/primitives/helpers.d.ts +1 -0
  117. package/dist/_dts/editor/src/primitives/rich-text/RichTextEditorSurface.d.ts +26 -0
  118. package/dist/_dts/editor/src/primitives/rich-text/RichTextToolbar.d.ts +16 -0
  119. package/dist/_dts/editor/src/primitives/rich-text/config.d.ts +23 -0
  120. package/dist/_dts/editor/src/primitives/rich-text/extensions/RichTextImage.d.ts +2 -0
  121. package/dist/_dts/editor/src/primitives/rich-text/extensions/RichTextLink.d.ts +1 -0
  122. package/dist/_dts/editor/src/primitives/rich-text/imageActions.d.ts +22 -0
  123. package/dist/_dts/editor/src/primitives/rich-text/sanitize.d.ts +23 -0
  124. package/dist/_dts/editor/src/primitives/rich-text/toolbar/BlockTypeDropdown.d.ts +6 -0
  125. package/dist/_dts/editor/src/primitives/rich-text/toolbar/LinkPopover.d.ts +10 -0
  126. package/dist/_dts/editor/src/primitives/rich-text/toolbar/ToolbarIconButton.d.ts +11 -0
  127. package/dist/_dts/editor/src/primitives/rich-text/toolbar/linkPopoverUtils.d.ts +58 -0
  128. package/dist/_dts/editor/src/primitives/rich-text/useRichTextEditor.d.ts +19 -0
  129. package/dist/_dts/editor/src/primitives/rich-text/utils.d.ts +20 -0
  130. package/dist/_dts/editor/src/utils/optimisticTokens.d.ts +27 -0
  131. package/dist/_dts/editor-blocks/src/BlockEditor.d.ts +2 -2
  132. package/dist/_dts/editor-blocks/src/block-editor/BlockCard.d.ts +5 -9
  133. package/dist/_dts/editor-blocks/src/block-editor/BlockCardBody.d.ts +2 -6
  134. package/dist/_dts/editor-blocks/src/block-editor/BlockCardHeader.d.ts +6 -10
  135. package/dist/_dts/editor-blocks/src/block-editor/FeatureCardIconsPanel.d.ts +2 -6
  136. package/dist/_dts/editor-blocks/src/block-editor/GeneratedIconSetDialog.d.ts +6 -4
  137. package/dist/_dts/editor-blocks/src/block-editor/SortableBlockItem.d.ts +4 -8
  138. package/dist/_dts/editor-blocks/src/block-editor/actionPresentation.d.ts +15 -0
  139. package/dist/_dts/editor-blocks/src/block-editor/blockHeaderActionPlan.d.ts +49 -0
  140. package/dist/_dts/editor-blocks/src/index.d.ts +2 -0
  141. package/dist/_dts/editor-blocks/src/widgets/index.d.ts +1 -0
  142. package/dist/_dts/editor-blocks/src/widgets/rich-text/RichTextWidgetProvider.d.ts +1 -1
  143. package/dist/_dts/editor-blocks/src/widgets/rich-text/useImagePicker.d.ts +1 -1
  144. package/dist/_dts/editor-blocks/src/widgets/site-option-picker/SiteOptionPickerField.d.ts +3 -0
  145. package/dist/_dts/editor-blocks/src/widgets/site-option-picker/SiteOptionWidgetProvider.d.ts +14 -0
  146. package/dist/_dts/editor-blocks/src/widgets/site-option-picker/index.d.ts +6 -0
  147. package/dist/_dts/editor-blocks/src/widgets/site-option-picker/loaders.d.ts +51 -0
  148. package/dist/_dts/editor-blocks/src/widgets/site-option-picker/types.d.ts +20 -0
  149. package/dist/_dts/editor-blocks/src/widgets/site-option-picker/utils.d.ts +5 -0
  150. package/dist/_dts/media-core/src/index.d.ts +1 -0
  151. package/dist/_dts/media-core/src/renderableMediaAsset.d.ts +18 -0
  152. package/dist/_dts/media-editor/src/MediaEditor.d.ts +4 -1
  153. package/dist/_dts/media-editor/src/MediaPickerDialog.d.ts +2 -1
  154. package/dist/_dts/media-editor/src/index.d.ts +1 -1
  155. package/dist/_dts/preview-next/src/client/blocks/BlockToolbar.d.ts +7 -2
  156. package/dist/_dts/preview-next/src/client/blocks/EditablePageRenderer.d.ts +5 -1
  157. package/dist/_dts/preview-next/src/client/blocks/blockCustomizePopoverRows.d.ts +25 -0
  158. package/dist/_dts/preview-next/src/client/blocks/composer/mergeDrafts.d.ts +2 -1
  159. package/dist/_dts/preview-next/src/client/blocks/composer/types.d.ts +4 -30
  160. package/dist/_dts/preview-next/src/client/blocks/linkedEntryRenderOverlay.d.ts +11 -0
  161. package/dist/_dts/preview-next/src/client/blocks/previewCustomizeActions.d.ts +3 -9
  162. package/dist/_dts/preview-next/src/client/blocks/previewCustomizeControlPlan.d.ts +24 -0
  163. package/dist/_dts/preview-next/src/client/blocks/useBlockCustomizeControls.d.ts +35 -0
  164. package/dist/_dts/preview-next/src/client/index.d.ts +0 -1
  165. package/dist/_dts/preview-next/src/client/preview/EntryEditorPanel.d.ts +3 -1
  166. package/dist/_dts/preview-next/src/client/preview/LinkedEntryEditEventBridge.d.ts +1 -0
  167. package/dist/_dts/preview-next/src/client/preview/PageBlockEditorPanel.d.ts +5 -6
  168. package/dist/_dts/preview-next/src/client/preview/PageDesignEditorStateContext.d.ts +4 -1
  169. package/dist/_dts/preview-next/src/client/preview/PreviewBlockCustomizeSelectionContext.d.ts +20 -0
  170. package/dist/_dts/preview-next/src/client/preview/PreviewChromeLayer.d.ts +20 -0
  171. package/dist/_dts/preview-next/src/client/preview/PreviewDesignHistoryOrderContext.d.ts +13 -0
  172. package/dist/_dts/preview-next/src/client/preview/PreviewOpenEditorButton.d.ts +2 -0
  173. package/dist/_dts/preview-next/src/client/preview/PreviewShell.d.ts +19 -19
  174. package/dist/_dts/preview-next/src/client/preview/PreviewSidebarSection.d.ts +13 -0
  175. package/dist/_dts/preview-next/src/client/preview/SelectedBlockCustomizePanel.d.ts +13 -0
  176. package/dist/_dts/preview-next/src/client/preview/SiteChromeCustomizeContext.d.ts +47 -4
  177. package/dist/_dts/preview-next/src/client/preview/StyleConfigurator.state.d.ts +14 -1
  178. package/dist/_dts/preview-next/src/client/preview/linkedEntryEditEvents.d.ts +5 -0
  179. package/dist/_dts/preview-next/src/client/preview/previewChromePlacement.d.ts +46 -0
  180. package/dist/_dts/preview-next/src/client/preview/previewCustomizeControls.d.ts +68 -0
  181. package/dist/_dts/preview-next/src/client/preview/previewCustomizeEditorDraftPatch.d.ts +13 -0
  182. package/dist/_dts/preview-next/src/client/preview/previewCustomizeHistory.d.ts +8 -1
  183. package/dist/_dts/preview-next/src/client/preview/previewCustomizeRuntimePatch.d.ts +2 -0
  184. package/dist/_dts/preview-next/src/client/preview/previewCustomizeWorkflowState.d.ts +11 -9
  185. package/dist/_dts/preview-next/src/client/preview/previewDesignHistoryOrder.d.ts +18 -0
  186. package/dist/_dts/preview-next/src/client/preview/previewUndoDomains.d.ts +1 -1
  187. package/dist/_dts/preview-next/src/client/preview/siteChromeBrandPreferences.d.ts +41 -0
  188. package/dist/_dts/preview-next/src/client/preview/siteChromeQuickControlHistoryState.d.ts +101 -0
  189. package/dist/_dts/preview-next/src/client/preview/siteChromeSavePlan.d.ts +29 -0
  190. package/dist/_dts/preview-next/src/client/preview/siteStyleHistoryState.d.ts +55 -0
  191. package/dist/_dts/preview-next/src/client/preview/storeTypes.d.ts +4 -0
  192. package/dist/_dts/preview-next/src/client/preview/styleConfiguratorApplyPayload.d.ts +1 -0
  193. package/dist/_dts/preview-next/src/client/widgets/widgetAdapters.d.ts +2 -1
  194. package/dist/_dts/preview-next/src/client/widgets/widgetOverrides.d.ts +6 -3
  195. package/dist/_dts/preview-next/src/constants.d.ts +0 -1
  196. package/dist/_dts/sdk/src/cli/commands/webhooks.d.ts +44 -0
  197. package/dist/_dts/sdk/src/cli/config-loader.d.ts +3 -1
  198. package/dist/_dts/sdk/src/cli/content/reader.d.ts +5 -3
  199. package/dist/_dts/sdk/src/cli/site-commands/commandSurfaceDispatch.d.ts +1 -0
  200. package/dist/_dts/sdk/src/cli/site-commands/pageCommands.d.ts +3 -1
  201. package/dist/_dts/sdk/src/cli/site-commands/pushExecution.d.ts +1 -0
  202. package/dist/_dts/sdk/src/client/management/index.d.ts +1 -1
  203. package/dist/_dts/sdk/src/client/management/types.d.ts +56 -0
  204. package/dist/_dts/sdk/src/client/management/webhooks.d.ts +3 -0
  205. package/dist/_dts/sdk/src/config/types.d.ts +1 -1
  206. package/dist/_dts/sdk/src/config/validation.d.ts +3 -3
  207. package/dist/_dts/sdk/src/contracts/system-block-content.d.ts +34 -5
  208. package/dist/_dts/sdk/src/public-api/contracts.d.ts +10 -0
  209. package/dist/_dts/sdk/src/rendering/islands/types.d.ts +42 -0
  210. package/dist/_dts/sdk/src/rendering/mediaAssets.d.ts +4 -0
  211. package/dist/_dts/sdk/src/types/block-kinds.d.ts +1 -1
  212. package/dist/_dts/sdk/src/version.d.ts +1 -1
  213. package/dist/_dts/theme-core/src/accordions/siteStyleDefaults.d.ts +220 -0
  214. package/dist/_dts/theme-core/src/accordions/types.d.ts +45 -2
  215. package/dist/_dts/theme-core/src/blockOverrides.d.ts +8 -0
  216. package/dist/_dts/theme-core/src/blocks/types.d.ts +1 -1
  217. package/dist/_dts/theme-core/src/blocks/vars/testimonials.d.ts +4 -1
  218. package/dist/_dts/theme-core/src/buttons/constants.d.ts +26 -1
  219. package/dist/_dts/theme-core/src/buttons/personalities/index.d.ts +11 -0
  220. package/dist/_dts/theme-core/src/buttons/personalities/joy-stamp.d.ts +22 -0
  221. package/dist/_dts/theme-core/src/buttons/personalities/types.d.ts +2 -1
  222. package/dist/_dts/theme-core/src/buttons/types.d.ts +9 -0
  223. package/dist/_dts/theme-core/src/cards/core.d.ts +20 -0
  224. package/dist/_dts/theme-core/src/cards/generateDefaultCardSystem.d.ts +6 -3
  225. package/dist/_dts/theme-core/src/cards/siteStyleDefaults.d.ts +149 -0
  226. package/dist/_dts/theme-core/src/cards/types.d.ts +177 -0
  227. package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
  228. package/dist/_dts/theme-core/src/interactive/types.d.ts +10 -0
  229. package/dist/_dts/theme-core/src/mock-themes/all.d.ts +180 -21
  230. package/dist/_dts/theme-core/src/palette/variants/index.d.ts +30 -0
  231. package/dist/_dts/theme-core/src/palette/variants/soft-natural.d.ts +16 -0
  232. package/dist/_dts/theme-core/src/palette/variants/types.d.ts +1 -1
  233. package/dist/_dts/theme-core/src/palette/variants/warm-dark.d.ts +27 -0
  234. package/dist/_dts/theme-core/src/schema.d.ts +486 -55
  235. package/dist/_dts/theme-core/src/site-styles/accessibleSurfaces.d.ts +4 -1
  236. package/dist/_dts/theme-core/src/site-styles/appearancePresetCatalog.d.ts +172 -47
  237. package/dist/_dts/theme-core/src/site-styles/appearancePresetResolution.d.ts +6 -2
  238. package/dist/_dts/theme-core/src/site-styles/appearancePresetTypes.d.ts +2 -3
  239. package/dist/_dts/theme-core/src/site-styles/blockAppearancePresets.d.ts +172 -47
  240. package/dist/_dts/theme-core/src/site-styles/curatedSiteStyles.d.ts +140 -2
  241. package/dist/_dts/theme-core/src/site-styles/designState.d.ts +18 -2
  242. package/dist/_dts/theme-core/src/site-styles/footerLooks.d.ts +20 -1
  243. package/dist/_dts/theme-core/src/site-styles/generatedSchemas.d.ts +10 -2
  244. package/dist/_dts/theme-core/src/site-styles/headerLooks.d.ts +291 -6
  245. package/dist/_dts/theme-core/src/site-styles/index.d.ts +3 -0
  246. package/dist/_dts/theme-core/src/site-styles/logoBranding.d.ts +193 -0
  247. package/dist/_dts/theme-core/src/site-styles/pageDesignEditorModel.d.ts +3 -23
  248. package/dist/_dts/theme-core/src/site-styles/pageDesignIntent.d.ts +276 -4
  249. package/dist/_dts/theme-core/src/site-styles/previewCompiler.d.ts +2 -8
  250. package/dist/_dts/theme-core/src/site-styles/rawStyleFields.d.ts +2 -0
  251. package/dist/_dts/theme-core/src/site-styles/runtimeCompiler.d.ts +43 -10
  252. package/dist/_dts/theme-core/src/site-styles/sectionTransitions.d.ts +508 -0
  253. package/dist/_dts/theme-core/src/site-styles/siteStyleThemeCompiler.d.ts +11 -0
  254. package/dist/_dts/theme-core/src/site-styles/sourceCatalogs.d.ts +10 -10
  255. package/dist/_dts/theme-core/src/site-styles/styleTags.d.ts +1 -1
  256. package/dist/_dts/theme-core/src/site-styles/testimonialQuotePresets.d.ts +15 -0
  257. package/dist/_dts/theme-core/src/site-styles/tokenRecipes.d.ts +1 -1
  258. package/dist/_dts/theme-core/src/site-styles/types.d.ts +28 -32
  259. package/dist/_dts/theme-core/src/site-styles/typographyPresets.d.ts +16 -1
  260. package/dist/{chunk-4HCW7FHJ.mjs → chunk-3PTVPAT4.mjs} +1984 -1142
  261. package/dist/{PreviewEditorSidebar-56NMJMIK.mjs → chunk-3QWQ2MUQ.mjs} +1050 -2609
  262. package/dist/{chunk-GP555I66.mjs → chunk-3VT7LZY2.mjs} +413 -157
  263. package/dist/{chunk-A3HHFKVT.mjs → chunk-4T5JIPWY.mjs} +1 -1
  264. package/dist/{chunk-K2IIF34C.mjs → chunk-E3NZYEKF.mjs} +25 -7
  265. package/dist/{chunk-V47ZU33I.mjs → chunk-WUHKQBB6.mjs} +12062 -3211
  266. package/dist/cli/index.mjs +3395 -817
  267. package/dist/cli/init-docs/content/workflow-isr-revalidation.md +16 -4
  268. package/dist/client/{accordion-QLA7KBYO.mjs → accordion-SFIIZWNH.mjs} +2 -2
  269. package/dist/client/{bookingForm-PYZIPA5G.mjs → bookingForm-CFKZVWGA.mjs} +5 -5
  270. package/dist/client/bookings.mjs +1422 -345
  271. package/dist/client/{carousel-5EIULWBI.mjs → carousel-ELXWSBLA.mjs} +3 -3
  272. package/dist/client/{cart-DOP3FNI4.mjs → cart-6SSCPYY5.mjs} +6 -6
  273. package/dist/client/{checkout-BVMF6FBV.mjs → checkout-UFQ34HPV.mjs} +6 -6
  274. package/dist/client/{chunk-44K2U3QI.mjs → chunk-76JUETXQ.mjs} +139 -186
  275. package/dist/client/{chunk-AUJ5DBZJ.mjs → chunk-7BXX7WXH.mjs} +112 -28
  276. package/dist/client/{chunk-UDS3NTWA.mjs → chunk-G56BSZAM.mjs} +2 -2
  277. package/dist/client/{chunk-V6M5FCR5.mjs → chunk-IUEDYLFJ.mjs} +1 -1
  278. package/dist/client/{chunk-YLDYVRZL.mjs → chunk-NP47RHIX.mjs} +5 -5
  279. package/dist/client/{chunk-R5ESWNKX.mjs → chunk-NX6X3GRF.mjs} +419 -85
  280. package/dist/client/{chunk-CCNTDRCF.mjs → chunk-PA2LJH2M.mjs} +2 -2
  281. package/dist/client/{chunk-CE7IBGVW.mjs → chunk-RMWMT3ZD.mjs} +1 -1
  282. package/dist/client/{chunk-TYONZMST.mjs → chunk-TCJS3NY5.mjs} +1 -1
  283. package/dist/client/{chunk-GG4M2NP6.mjs → chunk-V6XI4M2Q.mjs} +1 -1
  284. package/dist/client/client.mjs +9077 -4410
  285. package/dist/client/{courseRegistration-E6EAA6NL.mjs → courseRegistration-HJIISAAG.mjs} +5 -5
  286. package/dist/client/{eventCalendar-HBG3HAK6.mjs → eventCalendar-F6YVUCZR.mjs} +7 -7
  287. package/dist/client/{eventCombined-6K5ZZWAK.mjs → eventCombined-B5DSTIOK.mjs} +7 -7
  288. package/dist/client/{eventDetails-Q75ICXLT.mjs → eventDetails-SEJDDHQC.mjs} +7 -7
  289. package/dist/client/{eventListing-27P5F7DZ.mjs → eventListing-TPMWIIBO.mjs} +7 -7
  290. package/dist/client/{eventRegistration-IQ7AMASR.mjs → eventRegistration-QU6W2PV6.mjs} +7 -7
  291. package/dist/client/{form-JRTD65FN.mjs → form-LVTYNTDE.mjs} +2 -2
  292. package/dist/client/{headerSection-7FPSSZHS.mjs → headerSection-SO3MFC4U.mjs} +110 -28
  293. package/dist/client/hooks.mjs +4695 -2260
  294. package/dist/client/{locationMap-7NGFNYBH.mjs → locationMap-5E5FLAKO.mjs} +2 -2
  295. package/dist/client/{newsletterForm-F3BADCI2.mjs → newsletterForm-GN32JEBQ.mjs} +2 -2
  296. package/dist/client/{productDetail-V3HP7ITJ.mjs → productDetail-Q346KSVR.mjs} +6 -6
  297. package/dist/client/{productList-L3EGJUF2.mjs → productList-DTDMQYGZ.mjs} +6 -6
  298. package/dist/client/rendering/client.mjs +5795 -3582
  299. package/dist/client/rendering/islands.mjs +32 -20
  300. package/dist/client/rendering.mjs +7988 -3317
  301. package/dist/client/{shop-DQUB5E2C.mjs → shop-OFUW7KPN.mjs} +6 -6
  302. package/dist/preview-next/before-render.mjs +24 -0
  303. package/dist/preview-next/client/runtime.mjs +5 -5
  304. package/dist/preview-next/constants.mjs +0 -2
  305. package/dist/preview-next/index.mjs +0 -2
  306. package/dist/preview-next/middleware.mjs +24 -0
  307. package/dist/{sdk-runtime-AF6KXJU4.mjs → sdk-runtime-2GIX6I7X.mjs} +6 -6
  308. package/dist/server/components.mjs +7384 -3089
  309. package/dist/server/config-validation.mjs +4747 -2418
  310. package/dist/server/config.mjs +4747 -2418
  311. package/dist/server/data.mjs +4695 -2260
  312. package/dist/server/index.mjs +26 -1
  313. package/dist/server/next.mjs +7430 -3039
  314. package/dist/server/page-converter.mjs +3985 -2070
  315. package/dist/server/prebuild.mjs +1 -1
  316. package/dist/server/rendering/server.mjs +7489 -3094
  317. package/dist/server/rendering.mjs +7491 -3096
  318. package/dist/server/routing.mjs +4965 -2386
  319. package/dist/server/server.mjs +4713 -2278
  320. package/dist/server/theme-bridge.mjs +2181 -383
  321. package/dist/server/theme.mjs +477 -222
  322. package/dist/styles/index.css +747 -71
  323. package/package.json +1 -1
  324. package/dist/SdkPreviewModeRuntime-H4BSP6E7.mjs +0 -8
  325. package/dist/_dts/editor-blocks/src/block-editor/actionControlMode.d.ts +0 -2
  326. package/dist/_dts/preview-next/src/client/preview/previewSurface.d.ts +0 -3
  327. package/dist/chunk-LCY32PXF.mjs +0 -1175
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { assertNever2, useOptionalEditorUiStoreInstance, getPageDesignEditorState, PAGE_DESIGN_EDITOR_STATE_FETCH_ERROR_MESSAGE, unwrapResponse, useDebouncedLatestSave, applyPageDesignEditorAction, AMBIENT_BACKGROUND_ROLES, unsafeAsEditorBlockId, unsafeAsEditorBlockValues, resolvePreviewSidebarTab, applyBackgroundOverrideContentPatch, systemCustomizeFacetDefinitionForBlock, systemCustomizeFacetRollbackContentPatch, systemCustomizeFacetApplyContentPatch, createHistoryState, redoHistory, undoHistory, pushHistoryEntry, canRedoHistory, canUndoHistory, backgroundOverrideEquals, planPageDesignLayoutLookCompatibility } from './chunk-V47ZU33I.mjs';
3
- import { ApiRequestError, resolveSurfaceDocumentAttributes, SURFACE_DOCUMENT_DATA_ATTRIBUTE, SURFACE_IDS } from './chunk-K2IIF34C.mjs';
4
- import { createContext, useState, useRef, useEffect, useMemo, useContext } from 'react';
2
+ import { assertNever2, usePreviewDesignHistoryOrder, useOptionalEditorUiStoreInstance, getPageDesignEditorState, PAGE_DESIGN_EDITOR_STATE_FETCH_ERROR_MESSAGE, unwrapResponse, useDebouncedLatestSave, AMBIENT_BACKGROUND_ROLES, applyPageDesignEditorAction, resolvePreviewSidebarTab, confirmAutosaveBatch, beginAutosaveBatch, enqueueTransaction, applyBackgroundOverrideContentPatch, systemCustomizeFacetDefinitionForBlock, systemCustomizeFacetRollbackContentPatch, systemCustomizeFacetApplyContentPatch, unsafeAsEditorBlockId, createHistoryState, rejectAutosaveBatch, redoHistory, undoHistory, pushHistoryEntry, idleEditorTransactionQueueState, canRedoHistory, deriveTransactionCapabilities, canUndoHistory, backgroundOverrideEquals, attachRenderableMediaAssetFields, planPageDesignLayoutLookCompatibility, unsafeAsEditorBlockValues } from './chunk-WUHKQBB6.mjs';
3
+ import { ApiRequestError, resolveSurfaceDocumentAttributes, SURFACE_DOCUMENT_DATA_ATTRIBUTE, SURFACE_IDS } from './chunk-E3NZYEKF.mjs';
4
+ import { createContext, useState, useRef, useEffect, useMemo, useLayoutEffect, useContext } from 'react';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
 
7
7
  // ../preview-next/src/client/preview/previewCustomizeHistory.ts
@@ -23,6 +23,16 @@ function pushPreviewCustomizeHistoryEntry(state, entry, editorModel) {
23
23
  }
24
24
  );
25
25
  }
26
+ function previewCustomizeBatchHistoryEntry(entries) {
27
+ const atomicEntries = entries.flatMap((entry) => {
28
+ if (!entry) return [];
29
+ return entry.kind === "batch" ? entry.entries : [entry];
30
+ });
31
+ if (atomicEntries.length === 0) return null;
32
+ const firstEntry = atomicEntries[0];
33
+ if (atomicEntries.length === 1 && firstEntry) return firstEntry;
34
+ return { kind: "batch", entries: atomicEntries };
35
+ }
26
36
  function replacePreviewCustomizeHistoryModel(state, editorModel) {
27
37
  return {
28
38
  past: pruneHistoryPresents(state.past, editorModel),
@@ -125,11 +135,11 @@ function previewCustomizeHistoryEntryFromAction(editorModel, action) {
125
135
  return assertNever2(action, "Unhandled preview customize action");
126
136
  }
127
137
  }
128
- function previewCustomizeUndoActionForEntry(entry, editorModel) {
129
- return previewCustomizeActionForEntryValue(entry, "from", editorModel);
138
+ function previewCustomizeUndoActionsForEntry(entry, editorModel) {
139
+ return previewCustomizeActionsForEntryValue(entry, "from", editorModel);
130
140
  }
131
- function previewCustomizeRedoActionForEntry(entry, editorModel) {
132
- return previewCustomizeActionForEntryValue(entry, "to", editorModel);
141
+ function previewCustomizeRedoActionsForEntry(entry, editorModel) {
142
+ return previewCustomizeActionsForEntryValue(entry, "to", editorModel);
133
143
  }
134
144
  function previewCustomizeHistoryPresentEquals(left, right) {
135
145
  return left.editorModel === right.editorModel && previewCustomizeHistoryEntryEquals(left.entry, right.entry);
@@ -189,6 +199,15 @@ function previewCustomizeActionForEntryValue(entry, valueKey, editorModel) {
189
199
  return assertNever2(entry, "Unhandled preview customize history entry");
190
200
  }
191
201
  }
202
+ function previewCustomizeActionsForEntryValue(entry, valueKey, editorModel) {
203
+ if (entry.kind === "batch") {
204
+ const entries = valueKey === "from" ? [...entry.entries].reverse() : entry.entries;
205
+ return entries.map(
206
+ (batchEntry) => previewCustomizeActionForEntryValue(batchEntry, valueKey, editorModel)
207
+ );
208
+ }
209
+ return [previewCustomizeActionForEntryValue(entry, valueKey, editorModel)];
210
+ }
192
211
  function contentRevisionIdForBlock(editorModel, blockId) {
193
212
  return editorModel.blocks.find((block) => block.blockId === blockId)?.contentRevision?.contentId ?? null;
194
213
  }
@@ -214,6 +233,10 @@ function previewCustomizeHistoryEntryStillApplies(entry, editorModel) {
214
233
  return editorModel.boundaries.some(
215
234
  (boundary) => boundary.boundaryId === entry.boundaryId && boundary.previousBlockId === entry.previousBlockId && boundary.nextBlockId === entry.nextBlockId
216
235
  );
236
+ case "batch":
237
+ return entry.entries.every(
238
+ (batchEntry) => previewCustomizeHistoryEntryStillApplies(batchEntry, editorModel)
239
+ );
217
240
  default:
218
241
  return assertNever2(entry, "Unhandled preview customize history entry");
219
242
  }
@@ -232,6 +255,13 @@ function previewCustomizeHistoryEntryEquals(left, right) {
232
255
  return right.kind === "background" && left.blockId === right.blockId && backgroundOverrideEquals(left.fromOverride, right.fromOverride) && backgroundOverrideEquals(left.toOverride, right.toOverride);
233
256
  case "boundary":
234
257
  return right.kind === "boundary" && left.boundaryId === right.boundaryId && left.previousBlockId === right.previousBlockId && left.nextBlockId === right.nextBlockId && left.fromBoundaryOptionId === right.fromBoundaryOptionId && left.toBoundaryOptionId === right.toBoundaryOptionId;
258
+ case "batch":
259
+ return right.kind === "batch" && left.entries.length === right.entries.length && left.entries.every(
260
+ (entry, index) => previewCustomizeHistoryEntryEquals(
261
+ entry,
262
+ right.entries[index] ?? null
263
+ )
264
+ );
235
265
  default:
236
266
  return assertNever2(left, "Unhandled preview customize history entry");
237
267
  }
@@ -286,23 +316,21 @@ function beginPreviewCustomizeApply(workflow, action) {
286
316
  workflow.pageState.editorModel,
287
317
  action
288
318
  );
289
- const nextIntent = { action, historyEntry };
290
- const nextMutation = workflow.mutation.kind === "applying" ? {
291
- ...workflow.mutation,
292
- queuedActions: coalescePreviewCustomizeActions(
293
- workflow.mutation.queuedActions,
294
- nextIntent
295
- )
296
- } : {
297
- kind: "dirty",
298
- actions: coalescePreviewCustomizeActions(
299
- pendingCustomizeIntents(workflow.mutation),
319
+ const nextIntent = {
320
+ targetKey: previewCustomizeTargetKey(action),
321
+ action,
322
+ historyEntry
323
+ };
324
+ const nextMutation = previewCustomizeMutationFromQueueState(
325
+ enqueueTransaction(
326
+ previewCustomizeQueueStateFromMutation(workflow.mutation),
300
327
  nextIntent
301
328
  )
302
- };
329
+ );
303
330
  return {
304
331
  kind: "started",
305
- action,
332
+ actions: [action],
333
+ recordsHistoryEntry: Boolean(historyEntry),
306
334
  state: {
307
335
  ...workflow,
308
336
  pageState: applyPreviewCustomizeActionToLoadedState(
@@ -316,21 +344,27 @@ function beginPreviewCustomizeApply(workflow, action) {
316
344
  function beginPreviewCustomizeAutosave(workflow) {
317
345
  if (workflow.kind !== "loaded")
318
346
  return skippedPreviewCustomizeBeginResult("not-loaded");
319
- if (workflow.mutation.kind !== "dirty")
347
+ if (workflow.mutation.kind !== "dirty" && workflow.mutation.kind !== "failed")
348
+ return skippedPreviewCustomizeBeginResult("no-history-entry");
349
+ const nextMutation = previewCustomizeMutationFromQueueState(
350
+ beginAutosaveBatch(
351
+ previewCustomizeQueueStateFromMutation(workflow.mutation)
352
+ )
353
+ );
354
+ if (nextMutation.kind !== "applying")
355
+ return skippedPreviewCustomizeBeginResult("no-history-entry");
356
+ const actions = nextMutation.batch.transactions.map((intent) => intent.action);
357
+ if (actions.length === 0)
320
358
  return skippedPreviewCustomizeBeginResult("no-history-entry");
321
- const intent = workflow.mutation.actions[0] ?? null;
322
- if (!intent) return skippedPreviewCustomizeBeginResult("no-history-entry");
323
359
  return {
324
360
  kind: "started",
325
- action: intent.action,
361
+ actions,
362
+ recordsHistoryEntry: nextMutation.batch.transactions.some(
363
+ (intent) => Boolean(intent.historyEntry)
364
+ ),
326
365
  state: {
327
366
  ...workflow,
328
- mutation: {
329
- kind: "applying",
330
- action: intent.action,
331
- historyEntry: intent.historyEntry,
332
- queuedActions: []
333
- }
367
+ mutation: nextMutation
334
368
  }
335
369
  };
336
370
  }
@@ -343,22 +377,24 @@ function beginPreviewCustomizeUndo(workflow) {
343
377
  return skippedPreviewCustomizeBeginResult("cannot-undo");
344
378
  const entry = workflow.history.present.entry;
345
379
  if (!entry) return skippedPreviewCustomizeBeginResult("no-history-entry");
346
- const action = previewCustomizeUndoActionForEntry(
380
+ const actions = previewCustomizeUndoActionsForEntry(
347
381
  entry,
348
382
  workflow.pageState.editorModel
349
383
  );
384
+ assertPreviewCustomizeActions(actions);
350
385
  return {
351
386
  kind: "started",
352
- action,
387
+ actions,
388
+ recordsHistoryEntry: true,
353
389
  state: {
354
390
  ...workflow,
355
- pageState: applyPreviewCustomizeActionToLoadedState(
391
+ pageState: applyPreviewCustomizeActionsToLoadedState(
356
392
  workflow.pageState,
357
- action
393
+ actions
358
394
  ),
359
395
  mutation: {
360
396
  kind: "undoing",
361
- action,
397
+ actions,
362
398
  entry
363
399
  }
364
400
  }
@@ -373,22 +409,24 @@ function beginPreviewCustomizeRedo(workflow) {
373
409
  return skippedPreviewCustomizeBeginResult("cannot-redo");
374
410
  const entry = workflow.history.future[0]?.entry ?? null;
375
411
  if (!entry) return skippedPreviewCustomizeBeginResult("no-history-entry");
376
- const action = previewCustomizeRedoActionForEntry(
412
+ const actions = previewCustomizeRedoActionsForEntry(
377
413
  entry,
378
414
  workflow.pageState.editorModel
379
415
  );
416
+ assertPreviewCustomizeActions(actions);
380
417
  return {
381
418
  kind: "started",
382
- action,
419
+ actions,
420
+ recordsHistoryEntry: true,
383
421
  state: {
384
422
  ...workflow,
385
- pageState: applyPreviewCustomizeActionToLoadedState(
423
+ pageState: applyPreviewCustomizeActionsToLoadedState(
386
424
  workflow.pageState,
387
- action
425
+ actions
388
426
  ),
389
427
  mutation: {
390
428
  kind: "redoing",
391
- action,
429
+ actions,
392
430
  entry
393
431
  }
394
432
  }
@@ -402,6 +440,11 @@ function confirmPreviewCustomizeMutation(workflow, response) {
402
440
  workflow.pageState,
403
441
  response
404
442
  );
443
+ const historyEntry = previewCustomizeBatchHistoryEntry(
444
+ workflow.mutation.batch.transactions.map(
445
+ (intent) => intent.historyEntry
446
+ )
447
+ );
405
448
  const pageStateWithQueuedActions = workflow.mutation.queuedActions.reduce(
406
449
  (pageState, intent) => applyPreviewCustomizeActionToLoadedState(pageState, intent.action),
407
450
  confirmedPageState
@@ -409,15 +452,19 @@ function confirmPreviewCustomizeMutation(workflow, response) {
409
452
  return {
410
453
  ...workflow,
411
454
  pageState: pageStateWithQueuedActions,
412
- history: workflow.mutation.historyEntry ? pushPreviewCustomizeHistoryEntry(
455
+ history: historyEntry ? pushPreviewCustomizeHistoryEntry(
413
456
  workflow.history,
414
- workflow.mutation.historyEntry,
457
+ historyEntry,
415
458
  response.editorModel
416
459
  ) : replacePreviewCustomizeHistoryModel(
417
460
  workflow.history,
418
461
  response.editorModel
419
462
  ),
420
- mutation: workflow.mutation.queuedActions.length > 0 ? { kind: "dirty", actions: workflow.mutation.queuedActions } : { kind: "idle" }
463
+ mutation: previewCustomizeMutationFromQueueState(
464
+ confirmAutosaveBatch(
465
+ previewCustomizeQueueStateFromMutation(workflow.mutation)
466
+ )
467
+ )
421
468
  };
422
469
  }
423
470
  case "undoing":
@@ -456,7 +503,10 @@ function rejectPreviewCustomizeMutation(previousWorkflow, outcome) {
456
503
  if (previousWorkflow.kind !== "loaded") return previousWorkflow;
457
504
  return {
458
505
  ...previousWorkflow,
459
- mutation: outcome.kind === "stale" ? { kind: "stale", message: outcome.message } : { kind: "failed", message: outcome.message }
506
+ mutation: rejectedPreviewCustomizeMutation(
507
+ previousWorkflow.mutation,
508
+ outcome
509
+ )
460
510
  };
461
511
  }
462
512
  function previewCustomizeCanUndo(workflow) {
@@ -525,6 +575,8 @@ function skippedPreviewCustomizeMessage(reason) {
525
575
  function skipReasonForCustomizeApply(workflow) {
526
576
  if (workflow.kind !== "loaded") return "not-loaded";
527
577
  if (workflow.mutation.kind === "stale") return "stale";
578
+ if (workflow.mutation.kind === "undoing" || workflow.mutation.kind === "redoing")
579
+ return "mutation-pending";
528
580
  return null;
529
581
  }
530
582
  function skipReasonForHistoryMutation(workflow) {
@@ -535,7 +587,11 @@ function skipReasonForHistoryMutation(workflow) {
535
587
  return null;
536
588
  }
537
589
  function previewCustomizeCanStartHistoryMutation(workflow) {
538
- return workflow.mutation.kind !== "stale" && workflow.mutation.kind !== "dirty" && !isPendingMutation(workflow.mutation);
590
+ if (workflow.mutation.kind === "undoing" || workflow.mutation.kind === "redoing")
591
+ return false;
592
+ return deriveTransactionCapabilities(
593
+ previewCustomizeQueueStateFromMutation(workflow.mutation)
594
+ ).canUseHistory;
539
595
  }
540
596
  function isPendingMutation(mutation) {
541
597
  switch (mutation.kind) {
@@ -558,10 +614,11 @@ function pendingCustomizeIntents(mutation) {
558
614
  return mutation.actions;
559
615
  case "applying":
560
616
  return mutation.queuedActions;
617
+ case "failed":
618
+ return mutation.actions;
561
619
  case "idle":
562
620
  case "undoing":
563
621
  case "redoing":
564
- case "failed":
565
622
  case "stale":
566
623
  return [];
567
624
  default:
@@ -571,31 +628,93 @@ function pendingCustomizeIntents(mutation) {
571
628
  function previewCustomizePendingActions(workflow) {
572
629
  return workflow.kind === "loaded" ? pendingCustomizeIntents(workflow.mutation).map((intent) => intent.action) : [];
573
630
  }
574
- function coalescePreviewCustomizeActions(actions, nextAction) {
575
- return [
576
- ...actions.filter(
577
- (action) => !sameCustomizeTarget(action.action, nextAction.action)
578
- ),
579
- nextAction
580
- ];
581
- }
582
- function sameCustomizeTarget(left, right) {
583
- switch (left.kind) {
631
+ function previewCustomizeTargetKey(action) {
632
+ switch (action.kind) {
584
633
  case "set-layout":
585
- return right.kind === "set-layout" && left.blockId === right.blockId;
634
+ return `block:${action.blockId}:layout`;
586
635
  case "set-look":
587
- return right.kind === "set-look" && left.blockId === right.blockId;
636
+ return `block:${action.blockId}:look`;
588
637
  case "set-block-facet":
589
- return right.kind === "set-block-facet" && left.blockId === right.blockId && left.facetId === right.facetId;
638
+ return `block:${action.blockId}:facet:${action.facetId}`;
590
639
  case "set-background":
591
- return right.kind === "set-background" && left.blockId === right.blockId;
640
+ return `block:${action.blockId}:background`;
592
641
  case "set-boundary":
593
642
  case "reset-boundary":
594
- return (right.kind === "set-boundary" || right.kind === "reset-boundary") && left.previousBlockId === right.previousBlockId && left.nextBlockId === right.nextBlockId;
643
+ return `boundary:${action.previousBlockId}:${action.nextBlockId}`;
644
+ default:
645
+ return assertNever2(action, "Unhandled preview customize action");
646
+ }
647
+ }
648
+ function previewCustomizeQueueStateFromMutation(mutation) {
649
+ switch (mutation.kind) {
650
+ case "idle":
651
+ return idleEditorTransactionQueueState();
652
+ case "dirty":
653
+ return { kind: "dirty", transactions: mutation.actions };
654
+ case "applying":
655
+ return {
656
+ kind: "saving",
657
+ batch: mutation.batch,
658
+ followUpTransactions: mutation.queuedActions
659
+ };
660
+ case "failed":
661
+ return {
662
+ kind: "failed",
663
+ message: mutation.message,
664
+ transactions: mutation.actions
665
+ };
666
+ case "stale":
667
+ return {
668
+ kind: "stale",
669
+ message: mutation.message,
670
+ transactions: mutation.actions
671
+ };
672
+ case "undoing":
673
+ case "redoing":
674
+ return idleEditorTransactionQueueState();
675
+ default:
676
+ return assertNever2(mutation, "Unhandled preview customize mutation");
677
+ }
678
+ }
679
+ function previewCustomizeMutationFromQueueState(state) {
680
+ switch (state.kind) {
681
+ case "idle":
682
+ return { kind: "idle" };
683
+ case "dirty":
684
+ return { kind: "dirty", actions: state.transactions };
685
+ case "saving":
686
+ return {
687
+ kind: "applying",
688
+ batch: state.batch,
689
+ queuedActions: state.followUpTransactions
690
+ };
691
+ case "failed":
692
+ return {
693
+ kind: "failed",
694
+ message: state.message,
695
+ actions: state.transactions
696
+ };
697
+ case "stale":
698
+ return {
699
+ kind: "stale",
700
+ message: state.message,
701
+ actions: state.transactions
702
+ };
595
703
  default:
596
- return assertNever2(left, "Unhandled preview customize action");
704
+ return assertNever2(state, "Unhandled editor transaction queue state");
597
705
  }
598
706
  }
707
+ function rejectedPreviewCustomizeMutation(mutation, outcome) {
708
+ if (mutation.kind === "applying") {
709
+ return previewCustomizeMutationFromQueueState(
710
+ rejectAutosaveBatch(previewCustomizeQueueStateFromMutation(mutation), {
711
+ kind: outcome.kind === "stale" ? "stale" : "retryable",
712
+ message: outcome.message
713
+ })
714
+ );
715
+ }
716
+ return outcome.kind === "stale" ? { kind: "stale", message: outcome.message, actions: [] } : { kind: "failed", message: outcome.message, actions: [] };
717
+ }
599
718
  function confirmedLoadedState(current, response) {
600
719
  return {
601
720
  ...current,
@@ -673,6 +792,15 @@ function applyPreviewCustomizeActionToLoadedState(state, action) {
673
792
  return assertNever2(action, "Unhandled preview customize action");
674
793
  }
675
794
  }
795
+ function applyPreviewCustomizeActionsToLoadedState(state, actions) {
796
+ return actions.reduce(applyPreviewCustomizeActionToLoadedState, state);
797
+ }
798
+ function assertPreviewCustomizeActions(actions) {
799
+ const action = actions[0] ?? null;
800
+ if (!action) {
801
+ throw new Error("Expected preview customize history to produce an action");
802
+ }
803
+ }
676
804
  function optimisticLayoutLookState(block, layoutVariantKey) {
677
805
  const plan = planPageDesignLayoutLookCompatibility(block, layoutVariantKey);
678
806
  switch (plan.kind) {
@@ -746,6 +874,7 @@ function derivePreviewCustomizeRuntimePatch(input) {
746
874
  case "set-layout":
747
875
  return {
748
876
  blockId: action.blockId,
877
+ ownedRuntimeFieldPaths: [],
749
878
  previousContent,
750
879
  nextContent: contentWithLayoutVariant(
751
880
  previousContent,
@@ -765,6 +894,7 @@ function derivePreviewCustomizeRuntimePatch(input) {
765
894
  if (!definition) return null;
766
895
  return {
767
896
  blockId: action.blockId,
897
+ ownedRuntimeFieldPaths: [],
768
898
  previousContent,
769
899
  nextContent: systemCustomizeFacetApplyContentPatch(
770
900
  definition,
@@ -781,10 +911,14 @@ function derivePreviewCustomizeRuntimePatch(input) {
781
911
  case "set-background":
782
912
  return {
783
913
  blockId: action.blockId,
914
+ ownedRuntimeFieldPaths: ["_sectionStyles.background"],
784
915
  previousContent,
785
- nextContent: applyBackgroundOverrideContentPatch(
786
- previousContent,
787
- action.override
916
+ nextContent: withRuntimeBackgroundImageAsset(
917
+ applyBackgroundOverrideContentPatch(
918
+ previousContent,
919
+ action.override
920
+ ),
921
+ action.imageAsset
788
922
  ),
789
923
  rollback: (currentContent) => contentWithPreviousBackground(currentContent, previousContent)
790
924
  };
@@ -829,9 +963,108 @@ function contentWithPreviousBackground(currentContent, previousContent) {
829
963
  delete nextContent._sectionStyles;
830
964
  return nextContent;
831
965
  }
966
+ function withRuntimeBackgroundImageAsset(content, imageAsset) {
967
+ if (!imageAsset) return content;
968
+ const sectionStyles = isRecord(content._sectionStyles) ? content._sectionStyles : null;
969
+ const background = isRecord(sectionStyles?.background) ? sectionStyles.background : null;
970
+ const image = isRecord(background?.image) ? background.image : null;
971
+ if (!sectionStyles || !background || !image || background.type !== "image") {
972
+ return content;
973
+ }
974
+ return {
975
+ ...content,
976
+ _sectionStyles: {
977
+ ...sectionStyles,
978
+ background: {
979
+ ...background,
980
+ image: {
981
+ ...attachRenderableMediaAssetFields(image, imageAsset)
982
+ }
983
+ }
984
+ }
985
+ };
986
+ }
832
987
  function isRecord(value) {
833
988
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
834
989
  }
990
+
991
+ // ../preview-next/src/client/preview/previewCustomizeEditorDraftPatch.ts
992
+ function applyPreviewCustomizeDraftPatch(uiStore, patch, editorModel) {
993
+ return replaceLocalBlockContentWithoutHistory({
994
+ uiStore,
995
+ targetBlockId: patch.blockId,
996
+ nextContent: patch.nextContent,
997
+ previousContent: patch.previousContent,
998
+ editorModel
999
+ });
1000
+ }
1001
+ function rollbackPreviewCustomizeDraftPatch(uiStore, patch) {
1002
+ if (!patch) return { kind: "missing-current-content" };
1003
+ const currentContent = currentLocalBlockContent(uiStore, patch.blockId);
1004
+ if (!currentContent) return { kind: "missing-current-content" };
1005
+ return replaceLocalBlockContentWithoutHistory({
1006
+ uiStore,
1007
+ targetBlockId: patch.blockId,
1008
+ nextContent: patch.rollback(currentContent),
1009
+ previousContent: patch.previousContent,
1010
+ editorModel: null
1011
+ });
1012
+ }
1013
+ function currentLocalBlockContent(uiStore, targetBlockId) {
1014
+ const current = uiStore.getState().drafts.getCurrentValues(unsafeAsEditorBlockId(targetBlockId));
1015
+ return isRecord2(current) ? current : null;
1016
+ }
1017
+ function replaceLocalBlockContentWithoutHistory(input) {
1018
+ const editorBlockId = unsafeAsEditorBlockId(input.targetBlockId);
1019
+ const history = input.uiStore.getState().history;
1020
+ const snapshot = history.getState().present;
1021
+ const draft = snapshot.drafts[editorBlockId];
1022
+ const nextDraft = draft ? applyDraftContentPatch(draft, input.nextContent) : localRuntimeDraftForBlock({
1023
+ editorBlockId,
1024
+ targetBlockId: input.targetBlockId,
1025
+ editorModel: input.editorModel,
1026
+ previousContent: input.previousContent,
1027
+ nextContent: input.nextContent
1028
+ });
1029
+ if (!nextDraft) return { kind: "missing-block-model" };
1030
+ history.restorePresent({
1031
+ ...snapshot,
1032
+ drafts: {
1033
+ ...snapshot.drafts,
1034
+ [editorBlockId]: nextDraft
1035
+ }
1036
+ });
1037
+ return { kind: "applied" };
1038
+ }
1039
+ function applyDraftContentPatch(draft, nextContent) {
1040
+ return {
1041
+ ...draft,
1042
+ version: draft.version + 1,
1043
+ current: unsafeAsEditorBlockValues(nextContent)
1044
+ };
1045
+ }
1046
+ function localRuntimeDraftForBlock(input) {
1047
+ const block = input.editorModel?.blocks.find(
1048
+ (candidate) => candidate.blockId === input.targetBlockId
1049
+ ) ?? null;
1050
+ if (!block) return null;
1051
+ return {
1052
+ id: input.editorBlockId,
1053
+ version: 1,
1054
+ baseline: unsafeAsEditorBlockValues(input.previousContent),
1055
+ current: unsafeAsEditorBlockValues(input.nextContent),
1056
+ syncState: { kind: "pending" },
1057
+ meta: {
1058
+ kind: block.blockKind,
1059
+ purpose: null,
1060
+ orderIndex: null,
1061
+ publishedContent: null
1062
+ }
1063
+ };
1064
+ }
1065
+ function isRecord2(value) {
1066
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
1067
+ }
835
1068
  var PREVIEW_CUSTOMIZE_STALE_MESSAGE = "This page changed since that design choice. Refresh the preview, then try again.";
836
1069
  var PageDesignEditorStateContext = createContext({
837
1070
  state: { kind: "unsupported" },
@@ -862,8 +1095,12 @@ function PreviewPageDesignEditorStateProvider({
862
1095
  unsupportedPreviewCustomizeWorkflowState
863
1096
  );
864
1097
  const [backgroundImagePool, setBackgroundImagePool] = useState([]);
865
- const [backgroundImagePoolStatus, setBackgroundImagePoolStatus] = useState("idle");
1098
+ const [backgroundImagePoolStatus, setBackgroundImagePoolStatus] = useState(
1099
+ "idle"
1100
+ );
866
1101
  const workflowStateRef = useRef(workflowState);
1102
+ const pendingDesignHistoryOrderRecordRef = useRef(false);
1103
+ const previewDesignHistoryOrder = usePreviewDesignHistoryOrder();
867
1104
  const backgroundImagePoolRequestRef = useRef(null);
868
1105
  const uiStore = useOptionalEditorUiStoreInstance();
869
1106
  useEffect(() => {
@@ -919,7 +1156,10 @@ function PreviewPageDesignEditorStateProvider({
919
1156
  options: { cache: "no-store" }
920
1157
  }).then((response) => {
921
1158
  const result = unwrapResponse(response);
922
- const nextPool = result.items.map(backgroundImagePoolItemForAsset);
1159
+ const nextPool = result.items.flatMap((asset) => {
1160
+ const item = backgroundImagePoolItemForAsset(asset);
1161
+ return item ? [item] : [];
1162
+ });
923
1163
  setBackgroundImagePool(nextPool);
924
1164
  setBackgroundImagePoolStatus("loaded");
925
1165
  return nextPool;
@@ -954,31 +1194,23 @@ function PreviewPageDesignEditorStateProvider({
954
1194
  delay: autosaveDelayMs,
955
1195
  save: async (actions) => {
956
1196
  if (!pageId) return null;
957
- let lastResponse = null;
958
- for (const action of actions) {
959
- const currentPageState = previewCustomizeWorkflowPageState(
960
- workflowStateRef.current
961
- );
962
- const currentEditorModel = currentPageState.kind === "loaded" ? currentPageState.editorModel : null;
963
- lastResponse = await applyPageDesignEditorAction(apiClient, {
964
- siteId,
965
- pageId,
966
- body: {
967
- action: pageDesignEditorActionForPersistence(
968
- actionWithCurrentBaseContentId(
969
- action,
970
- lastResponse?.editorModel ?? currentEditorModel
971
- )
972
- )
973
- }
974
- });
975
- }
976
- return lastResponse;
1197
+ const currentPageState = previewCustomizeWorkflowPageState(
1198
+ workflowStateRef.current
1199
+ );
1200
+ return persistPageDesignEditorActions({
1201
+ apiClient,
1202
+ siteId,
1203
+ pageId,
1204
+ actions,
1205
+ editorModel: currentPageState.kind === "loaded" ? currentPageState.editorModel : null
1206
+ });
977
1207
  },
978
1208
  onSaving: () => {
979
1209
  setWorkflowState((current) => {
980
1210
  const begin = beginPreviewCustomizeAutosave(current);
981
- return begin.kind === "started" ? begin.state : current;
1211
+ if (begin.kind !== "started") return current;
1212
+ pendingDesignHistoryOrderRecordRef.current = begin.recordsHistoryEntry;
1213
+ return begin.state;
982
1214
  });
983
1215
  },
984
1216
  onSaved: (response) => {
@@ -986,15 +1218,27 @@ function PreviewPageDesignEditorStateProvider({
986
1218
  setWorkflowState(
987
1219
  (current) => confirmPreviewCustomizeMutation(current, response)
988
1220
  );
1221
+ if (pendingDesignHistoryOrderRecordRef.current) {
1222
+ pendingDesignHistoryOrderRecordRef.current = false;
1223
+ previewDesignHistoryOrder.record("theme-customize");
1224
+ }
989
1225
  },
990
1226
  onFailed: (error) => {
1227
+ pendingDesignHistoryOrderRecordRef.current = false;
991
1228
  const outcome = classifyApplyActionError(error);
992
1229
  setWorkflowState(
993
1230
  (current) => rejectPreviewCustomizeMutation(current, outcome)
994
1231
  );
995
- setReloadKey((current) => current + 1);
1232
+ if (outcome.kind === "stale") {
1233
+ setReloadKey((current) => current + 1);
1234
+ }
996
1235
  }
997
1236
  });
1237
+ useLayoutEffect(() => {
1238
+ return () => {
1239
+ autosave.flush();
1240
+ };
1241
+ }, [autosave]);
998
1242
  const value = useMemo(
999
1243
  () => ({
1000
1244
  state: previewCustomizeWorkflowPageState(workflowState),
@@ -1002,7 +1246,7 @@ function PreviewPageDesignEditorStateProvider({
1002
1246
  backgroundImagePool,
1003
1247
  backgroundImagePoolStatus,
1004
1248
  loadBackgroundImagePool,
1005
- applyAction: async (action) => {
1249
+ applyAction: async (action, options) => {
1006
1250
  if (!enabled) return skippedPreviewCustomizeOutcome("disabled");
1007
1251
  if (!pageId) return skippedPreviewCustomizeOutcome("missing-page");
1008
1252
  const previousWorkflow = workflowState;
@@ -1010,7 +1254,12 @@ function PreviewPageDesignEditorStateProvider({
1010
1254
  if (begin.kind === "skipped") return begin;
1011
1255
  const previousPageState = previewCustomizeWorkflowPageState(previousWorkflow);
1012
1256
  if (previousPageState.kind === "loaded" && uiStore) {
1013
- applyLocalRuntimePatch(uiStore, action, previousPageState.editorModel);
1257
+ applyLocalRuntimePatch(
1258
+ uiStore,
1259
+ action,
1260
+ previousPageState.editorModel,
1261
+ options?.runtimeContent ?? null
1262
+ );
1014
1263
  }
1015
1264
  setWorkflowState(begin.state);
1016
1265
  autosave.trigger();
@@ -1023,20 +1272,24 @@ function PreviewPageDesignEditorStateProvider({
1023
1272
  const begin = beginPreviewCustomizeUndo(previousWorkflow);
1024
1273
  if (begin.kind === "skipped") return begin;
1025
1274
  const previousPageState = previewCustomizeWorkflowPageState(previousWorkflow);
1026
- const runtimePatch = previousPageState.kind === "loaded" && uiStore ? applyLocalRuntimePatch(
1027
- uiStore,
1028
- begin.action,
1029
- previousPageState.editorModel
1030
- ) : null;
1275
+ const runtimePatches = previousPageState.kind === "loaded" && uiStore ? begin.actions.map(
1276
+ (action) => applyLocalRuntimePatch(
1277
+ uiStore,
1278
+ action,
1279
+ previousPageState.editorModel
1280
+ )
1281
+ ) : [];
1031
1282
  setWorkflowState(begin.state);
1032
1283
  try {
1033
- const response = await applyPageDesignEditorAction(apiClient, {
1284
+ const response = await persistPageDesignEditorActions({
1285
+ apiClient,
1034
1286
  siteId,
1035
1287
  pageId,
1036
- body: {
1037
- action: pageDesignEditorActionForPersistence(begin.action)
1038
- }
1288
+ actions: begin.actions,
1289
+ editorModel: previousPageState.kind === "loaded" ? previousPageState.editorModel : null
1039
1290
  });
1291
+ if (!response)
1292
+ return skippedPreviewCustomizeOutcome("no-history-entry");
1040
1293
  setWorkflowState(
1041
1294
  (current) => confirmPreviewCustomizeMutation(current, response)
1042
1295
  );
@@ -1047,7 +1300,7 @@ function PreviewPageDesignEditorStateProvider({
1047
1300
  rejectPreviewCustomizeMutation(previousWorkflow, outcome)
1048
1301
  );
1049
1302
  if (uiStore) {
1050
- rollbackLocalRuntimePatch(uiStore, runtimePatch);
1303
+ rollbackLocalRuntimePatches(uiStore, runtimePatches);
1051
1304
  }
1052
1305
  return outcome;
1053
1306
  }
@@ -1059,20 +1312,24 @@ function PreviewPageDesignEditorStateProvider({
1059
1312
  const begin = beginPreviewCustomizeRedo(previousWorkflow);
1060
1313
  if (begin.kind === "skipped") return begin;
1061
1314
  const previousPageState = previewCustomizeWorkflowPageState(previousWorkflow);
1062
- const runtimePatch = previousPageState.kind === "loaded" && uiStore ? applyLocalRuntimePatch(
1063
- uiStore,
1064
- begin.action,
1065
- previousPageState.editorModel
1066
- ) : null;
1315
+ const runtimePatches = previousPageState.kind === "loaded" && uiStore ? begin.actions.map(
1316
+ (action) => applyLocalRuntimePatch(
1317
+ uiStore,
1318
+ action,
1319
+ previousPageState.editorModel
1320
+ )
1321
+ ) : [];
1067
1322
  setWorkflowState(begin.state);
1068
1323
  try {
1069
- const response = await applyPageDesignEditorAction(apiClient, {
1324
+ const response = await persistPageDesignEditorActions({
1325
+ apiClient,
1070
1326
  siteId,
1071
1327
  pageId,
1072
- body: {
1073
- action: pageDesignEditorActionForPersistence(begin.action)
1074
- }
1328
+ actions: begin.actions,
1329
+ editorModel: previousPageState.kind === "loaded" ? previousPageState.editorModel : null
1075
1330
  });
1331
+ if (!response)
1332
+ return skippedPreviewCustomizeOutcome("no-history-entry");
1076
1333
  setWorkflowState(
1077
1334
  (current) => confirmPreviewCustomizeMutation(current, response)
1078
1335
  );
@@ -1083,7 +1340,7 @@ function PreviewPageDesignEditorStateProvider({
1083
1340
  rejectPreviewCustomizeMutation(previousWorkflow, outcome)
1084
1341
  );
1085
1342
  if (uiStore) {
1086
- rollbackLocalRuntimePatch(uiStore, runtimePatch);
1343
+ rollbackLocalRuntimePatches(uiStore, runtimePatches);
1087
1344
  }
1088
1345
  return outcome;
1089
1346
  }
@@ -1111,10 +1368,20 @@ function PreviewPageDesignEditorStateProvider({
1111
1368
  }
1112
1369
  function backgroundImagePoolItemForAsset(asset) {
1113
1370
  const backgroundUse = backgroundUseForAsset(asset.fileUses ?? []);
1371
+ if (backgroundUse === null) return null;
1114
1372
  return {
1115
1373
  mediaId: asset.id,
1116
- source: backgroundUse === null ? "general-media" : backgroundUse === "selected-background" ? "previous-background" : "generated-ambient",
1374
+ source: backgroundUse === "selected-background" ? "previous-background" : "generated-ambient",
1117
1375
  label: asset.title || asset.filename,
1376
+ mediaAsset: {
1377
+ id: asset.id,
1378
+ identifier: asset.identifier ?? null,
1379
+ storageBucket: asset.storageBucket,
1380
+ storagePath: asset.storagePath,
1381
+ width: asset.width ?? null,
1382
+ height: asset.height ?? null,
1383
+ mimeType: asset.mimeType
1384
+ },
1118
1385
  ...isAmbientBackgroundRole(backgroundUse) ? { rank: AMBIENT_BACKGROUND_ROLES.indexOf(backgroundUse) } : {}
1119
1386
  };
1120
1387
  }
@@ -1169,6 +1436,30 @@ function pageDesignEditorActionForPersistence(action) {
1169
1436
  return assertNever2(action, "Unhandled page design editor action");
1170
1437
  }
1171
1438
  }
1439
+ async function persistPageDesignEditorActions({
1440
+ apiClient,
1441
+ siteId,
1442
+ pageId,
1443
+ actions,
1444
+ editorModel
1445
+ }) {
1446
+ let lastResponse = null;
1447
+ for (const action of actions) {
1448
+ lastResponse = await applyPageDesignEditorAction(apiClient, {
1449
+ siteId,
1450
+ pageId,
1451
+ body: {
1452
+ action: pageDesignEditorActionForPersistence(
1453
+ actionWithCurrentBaseContentId(
1454
+ action,
1455
+ lastResponse?.editorModel ?? editorModel
1456
+ )
1457
+ )
1458
+ }
1459
+ });
1460
+ }
1461
+ return lastResponse;
1462
+ }
1172
1463
  function actionWithCurrentBaseContentId(action, editorModel) {
1173
1464
  switch (action.kind) {
1174
1465
  case "set-layout":
@@ -1205,35 +1496,26 @@ function classifyApplyActionError(error) {
1205
1496
  function usePreviewPageDesignEditorState() {
1206
1497
  return useContext(PageDesignEditorStateContext);
1207
1498
  }
1208
- function applyLocalRuntimePatch(uiStore, action, editorModel) {
1499
+ function applyLocalRuntimePatch(uiStore, action, editorModel, fallbackContent = null) {
1209
1500
  if (classifyPreviewCustomizeActionDomain(action).kind !== "block-content-write") {
1210
1501
  return null;
1211
1502
  }
1212
1503
  const patch = derivePreviewCustomizeRuntimePatch({
1213
1504
  action,
1214
1505
  editorModel,
1215
- currentContent: currentLocalBlockContent(
1216
- uiStore,
1217
- blockIdForRuntimePatch(action)
1218
- )
1506
+ currentContent: currentLocalBlockContent(uiStore, blockIdForRuntimePatch(action)) ?? fallbackContent
1219
1507
  });
1220
1508
  if (!patch) return null;
1221
- replaceLocalBlockContentWithoutHistory(
1222
- uiStore,
1223
- patch.blockId,
1224
- patch.nextContent
1225
- );
1509
+ applyPreviewCustomizeDraftPatch(uiStore, patch, editorModel);
1226
1510
  return patch;
1227
1511
  }
1228
1512
  function rollbackLocalRuntimePatch(uiStore, patch) {
1229
- if (!patch) return;
1230
- const currentContent = currentLocalBlockContent(uiStore, patch.blockId);
1231
- if (!currentContent) return;
1232
- replaceLocalBlockContentWithoutHistory(
1233
- uiStore,
1234
- patch.blockId,
1235
- patch.rollback(currentContent)
1236
- );
1513
+ rollbackPreviewCustomizeDraftPatch(uiStore, patch);
1514
+ }
1515
+ function rollbackLocalRuntimePatches(uiStore, patches) {
1516
+ for (const patch of [...patches].reverse()) {
1517
+ rollbackLocalRuntimePatch(uiStore, patch);
1518
+ }
1237
1519
  }
1238
1520
  function blockIdForRuntimePatch(action) {
1239
1521
  switch (action.kind) {
@@ -1249,30 +1531,6 @@ function blockIdForRuntimePatch(action) {
1249
1531
  return assertNever2(action, "Unhandled runtime patch action");
1250
1532
  }
1251
1533
  }
1252
- function currentLocalBlockContent(uiStore, targetBlockId) {
1253
- const current = uiStore.getState().drafts.getCurrentValues(unsafeAsEditorBlockId(targetBlockId));
1254
- return isRecord2(current) ? current : null;
1255
- }
1256
- function replaceLocalBlockContentWithoutHistory(uiStore, targetBlockId, nextContent) {
1257
- const editorBlockId = unsafeAsEditorBlockId(targetBlockId);
1258
- const history = uiStore.getState().history;
1259
- const snapshot = history.getState().present;
1260
- const draft = snapshot.drafts[editorBlockId];
1261
- if (!draft) return;
1262
- history.restorePresent({
1263
- ...snapshot,
1264
- drafts: {
1265
- ...snapshot.drafts,
1266
- [editorBlockId]: {
1267
- ...draft,
1268
- current: unsafeAsEditorBlockValues(nextContent)
1269
- }
1270
- }
1271
- });
1272
- }
1273
- function isRecord2(value) {
1274
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
1275
- }
1276
1534
 
1277
1535
  // ../preview-next/src/client/preview/previewChromeSurface.ts
1278
1536
  var PREVIEW_CHROME_THEME_CLASS_NAME = "builder-dashboard-chrome-theme";
@@ -1350,7 +1608,5 @@ function onPreviewSidebarOpenRequest(handler) {
1350
1608
  function isRecord3(value) {
1351
1609
  return typeof value === "object" && value !== null;
1352
1610
  }
1353
- var PREVIEW_SURFACE_PARAM = "preview_surface";
1354
- var PREVIEW_THEME_COOKIE_NAME = "preview_theme_id";
1355
1611
 
1356
- export { PREVIEW_CHROME_PORTAL_CLASS_NAME, PREVIEW_CHROME_THEME_CLASS_NAME, PREVIEW_SURFACE_PARAM, PREVIEW_THEME_COOKIE_NAME, PreviewPageDesignEditorStateProvider, applyPreviewChromeSurfaceToElement, getPreviewChromeSurfaceDataProps, getPreviewSidebarTab, onPreviewSidebarOpenRequest, resolvePreviewChromeSurface, setPreviewSidebarTab, usePreviewPageDesignEditorState };
1612
+ export { PREVIEW_CHROME_PORTAL_CLASS_NAME, PREVIEW_CHROME_THEME_CLASS_NAME, PreviewPageDesignEditorStateProvider, applyPreviewChromeSurfaceToElement, getPreviewChromeSurfaceDataProps, getPreviewSidebarTab, onPreviewSidebarOpenRequest, resolvePreviewChromeSurface, setPreviewSidebarTab, usePreviewPageDesignEditorState };