@ohhwells/bridge 0.1.163 → 0.1.164-next.439

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1043,6 +1043,65 @@ declare function indexCollectionItems(pages: readonly SitePageEntry[]): Collecti
1043
1043
  */
1044
1044
  declare function matchCollectionItemClick(target: Element | null, index: CollectionItemIndex): CollectionItemHit | null;
1045
1045
 
1046
+ /**
1047
+ * Menu and footer follow the onboarding build's page choices (OHH-909).
1048
+ *
1049
+ * After the build removes or renames template pages, the editor posts `ow:pages-sync`. The menu
1050
+ * and footer are shared chrome stored as content keys, so this edits them on the canvas exactly
1051
+ * the way a person deleting or renaming a link would, and posts one `ow:change` for the save:
1052
+ *
1053
+ * - links to a page that no longer renders are removed (navbar and footer)
1054
+ * - a chrome button that is not a menu item (the navbar CTA) is pointed at the contact page
1055
+ * instead, the same target the backend gives body links
1056
+ * - links to a kept page take the plan's label, only while they still carry the template's own
1057
+ * title (a link the person renamed is theirs)
1058
+ * - on a one-page template, `#anchor` links take the plan's label the same way
1059
+ *
1060
+ * Pure planning (`planBuildPageSync`) is split from the DOM work so it can be tested without one.
1061
+ */
1062
+
1063
+ type PagesSyncMessage = {
1064
+ type: 'ow:pages-sync';
1065
+ /** Paths the build soft-deleted. */
1066
+ removed: string[];
1067
+ /** Every path that still renders. */
1068
+ livePaths: string[];
1069
+ relabel: {
1070
+ path: string;
1071
+ label: string;
1072
+ oldTitle: string;
1073
+ }[];
1074
+ anchorLabels: {
1075
+ anchors: string[];
1076
+ label: string;
1077
+ type: string;
1078
+ }[];
1079
+ };
1080
+ type SyncLink = {
1081
+ hrefKey: string;
1082
+ href: string;
1083
+ label: string;
1084
+ /** `chrome`: a shared-chrome link that is not a menu or footer item, such as the navbar CTA. */
1085
+ area: 'nav' | 'footer' | 'chrome';
1086
+ };
1087
+ type SyncPlan = {
1088
+ /** href keys whose links are removed. */
1089
+ remove: string[];
1090
+ /** label key → new label. */
1091
+ relabel: {
1092
+ hrefKey: string;
1093
+ label: string;
1094
+ }[];
1095
+ /** href key → new href, for chrome links that cannot be removed. */
1096
+ retarget: {
1097
+ hrefKey: string;
1098
+ href: string;
1099
+ }[];
1100
+ };
1101
+ /** Mirror of the backend's `isDeadPageHref`: anchors, mailto and external links never are. */
1102
+ declare function isDeadPageHref(href: string, livePaths: string[]): boolean;
1103
+ declare function planBuildPageSync(links: SyncLink[], msg: PagesSyncMessage): SyncPlan;
1104
+
1046
1105
  declare function isStickySearchParam(name: string): boolean;
1047
1106
  /**
1048
1107
  * Copy the sticky params of `currentSearch` onto `target`, and report whether anything changed.
@@ -1087,4 +1146,4 @@ declare function useOhwCarousel(key: string, initial: CarouselSlide[]): {
1087
1146
  bind: Record<string, string>;
1088
1147
  };
1089
1148
 
1090
- export { AI_DEFAULT_BRAND, AI_FOOTER_KEY, AI_TREE_SCHEMA_VERSIONS, AI_TREE_TOKENS, type AiBlockNode, type AiBrandKit, type AiFooterBottomBar, type AiFooterColumn, type AiFooterLayoutTree, AiFooterRenderer, type AiFooterRendererProps, type AiLayoutTree, AiTreeRenderer, type AiTreeRendererProps, BRAND_TITLE_KEY, type CarouselSlide, type CollectionItemHit, type CollectionItemIndex, CustomToolbar, CustomToolbarButton, CustomToolbarDivider, DragHandle, DropIndicator, type DropIndicatorProps, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, EmptySection, type EmptySectionProps, FOOTER_COLUMN_BLOCKS, FOOTER_COLUMN_SPANS, FOOTER_SOCIAL_PLATFORMS, ItemActionToolbar, type ItemActionToolbarProps, ItemInteractionLayer, type ItemInteractionLayerProps, type ItemInteractionState, LinkEditorPanel, type LinkModalMode, type LinkModalProps, type LinkPage, LinkPopover, type LinkSection, OHW_LOADER_PREHYDRATE_SCRIPT, OHW_LOADER_STYLE, OhhwellsBridge, OhwLoaderSpinner, OhwLoaderSurface, SITE_OG_IMAGE_KEY, SchedulingWidget, type SectionScaffold, type SiteLegalLinks, type SitePageEntry, TEMPLATE_LOGO_ATTR, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, addFooterLinkColumn, appendFooterSocial, applyBrandChrome, applyStickySearchParams, buildDefaultFooterTree, buildTarget, dropIndicatorVariants, ensureFooterTree, filterAvailablePages, foldAlignIntoTrees, getEditModeInitialState, hasMountedContentNodes, indexCollectionItems, insertFooterHours, isEditSessionActive, isPlainLeftClick, isRenderableFooterTree, isRenderableTree, isStickySearchParam, isValidUrl, matchCollectionItemClick, nextViableSlide, parseAiFooterState, parseAiSectionsState, parseTarget, recordOverriddenPaths, releaseTemplateLogoIfReplaced, removeFooterBlock, resetOverriddenPathsCache, resolveFooterCopyright, resolveStickyNavigation, serializeAiFooterState, shouldFetchContentForPath, stepViableSlide, stripTextAlignCss, toggleVariants, useOhwCarousel, validateUrlInput, viableSlides };
1149
+ export { AI_DEFAULT_BRAND, AI_FOOTER_KEY, AI_TREE_SCHEMA_VERSIONS, AI_TREE_TOKENS, type AiBlockNode, type AiBrandKit, type AiFooterBottomBar, type AiFooterColumn, type AiFooterLayoutTree, AiFooterRenderer, type AiFooterRendererProps, type AiLayoutTree, AiTreeRenderer, type AiTreeRendererProps, BRAND_TITLE_KEY, type CarouselSlide, type CollectionItemHit, type CollectionItemIndex, CustomToolbar, CustomToolbarButton, CustomToolbarDivider, DragHandle, DropIndicator, type DropIndicatorProps, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, EmptySection, type EmptySectionProps, FOOTER_COLUMN_BLOCKS, FOOTER_COLUMN_SPANS, FOOTER_SOCIAL_PLATFORMS, ItemActionToolbar, type ItemActionToolbarProps, ItemInteractionLayer, type ItemInteractionLayerProps, type ItemInteractionState, LinkEditorPanel, type LinkModalMode, type LinkModalProps, type LinkPage, LinkPopover, type LinkSection, OHW_LOADER_PREHYDRATE_SCRIPT, OHW_LOADER_STYLE, OhhwellsBridge, OhwLoaderSpinner, OhwLoaderSurface, type PagesSyncMessage, SITE_OG_IMAGE_KEY, SchedulingWidget, type SectionScaffold, type SiteLegalLinks, type SitePageEntry, type SyncLink, type SyncPlan, TEMPLATE_LOGO_ATTR, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, addFooterLinkColumn, appendFooterSocial, applyBrandChrome, applyStickySearchParams, buildDefaultFooterTree, buildTarget, dropIndicatorVariants, ensureFooterTree, filterAvailablePages, foldAlignIntoTrees, getEditModeInitialState, hasMountedContentNodes, indexCollectionItems, insertFooterHours, isDeadPageHref, isEditSessionActive, isPlainLeftClick, isRenderableFooterTree, isRenderableTree, isStickySearchParam, isValidUrl, matchCollectionItemClick, nextViableSlide, parseAiFooterState, parseAiSectionsState, parseTarget, planBuildPageSync, recordOverriddenPaths, releaseTemplateLogoIfReplaced, removeFooterBlock, resetOverriddenPathsCache, resolveFooterCopyright, resolveStickyNavigation, serializeAiFooterState, shouldFetchContentForPath, stepViableSlide, stripTextAlignCss, toggleVariants, useOhwCarousel, validateUrlInput, viableSlides };
package/dist/index.d.ts CHANGED
@@ -1043,6 +1043,65 @@ declare function indexCollectionItems(pages: readonly SitePageEntry[]): Collecti
1043
1043
  */
1044
1044
  declare function matchCollectionItemClick(target: Element | null, index: CollectionItemIndex): CollectionItemHit | null;
1045
1045
 
1046
+ /**
1047
+ * Menu and footer follow the onboarding build's page choices (OHH-909).
1048
+ *
1049
+ * After the build removes or renames template pages, the editor posts `ow:pages-sync`. The menu
1050
+ * and footer are shared chrome stored as content keys, so this edits them on the canvas exactly
1051
+ * the way a person deleting or renaming a link would, and posts one `ow:change` for the save:
1052
+ *
1053
+ * - links to a page that no longer renders are removed (navbar and footer)
1054
+ * - a chrome button that is not a menu item (the navbar CTA) is pointed at the contact page
1055
+ * instead, the same target the backend gives body links
1056
+ * - links to a kept page take the plan's label, only while they still carry the template's own
1057
+ * title (a link the person renamed is theirs)
1058
+ * - on a one-page template, `#anchor` links take the plan's label the same way
1059
+ *
1060
+ * Pure planning (`planBuildPageSync`) is split from the DOM work so it can be tested without one.
1061
+ */
1062
+
1063
+ type PagesSyncMessage = {
1064
+ type: 'ow:pages-sync';
1065
+ /** Paths the build soft-deleted. */
1066
+ removed: string[];
1067
+ /** Every path that still renders. */
1068
+ livePaths: string[];
1069
+ relabel: {
1070
+ path: string;
1071
+ label: string;
1072
+ oldTitle: string;
1073
+ }[];
1074
+ anchorLabels: {
1075
+ anchors: string[];
1076
+ label: string;
1077
+ type: string;
1078
+ }[];
1079
+ };
1080
+ type SyncLink = {
1081
+ hrefKey: string;
1082
+ href: string;
1083
+ label: string;
1084
+ /** `chrome`: a shared-chrome link that is not a menu or footer item, such as the navbar CTA. */
1085
+ area: 'nav' | 'footer' | 'chrome';
1086
+ };
1087
+ type SyncPlan = {
1088
+ /** href keys whose links are removed. */
1089
+ remove: string[];
1090
+ /** label key → new label. */
1091
+ relabel: {
1092
+ hrefKey: string;
1093
+ label: string;
1094
+ }[];
1095
+ /** href key → new href, for chrome links that cannot be removed. */
1096
+ retarget: {
1097
+ hrefKey: string;
1098
+ href: string;
1099
+ }[];
1100
+ };
1101
+ /** Mirror of the backend's `isDeadPageHref`: anchors, mailto and external links never are. */
1102
+ declare function isDeadPageHref(href: string, livePaths: string[]): boolean;
1103
+ declare function planBuildPageSync(links: SyncLink[], msg: PagesSyncMessage): SyncPlan;
1104
+
1046
1105
  declare function isStickySearchParam(name: string): boolean;
1047
1106
  /**
1048
1107
  * Copy the sticky params of `currentSearch` onto `target`, and report whether anything changed.
@@ -1087,4 +1146,4 @@ declare function useOhwCarousel(key: string, initial: CarouselSlide[]): {
1087
1146
  bind: Record<string, string>;
1088
1147
  };
1089
1148
 
1090
- export { AI_DEFAULT_BRAND, AI_FOOTER_KEY, AI_TREE_SCHEMA_VERSIONS, AI_TREE_TOKENS, type AiBlockNode, type AiBrandKit, type AiFooterBottomBar, type AiFooterColumn, type AiFooterLayoutTree, AiFooterRenderer, type AiFooterRendererProps, type AiLayoutTree, AiTreeRenderer, type AiTreeRendererProps, BRAND_TITLE_KEY, type CarouselSlide, type CollectionItemHit, type CollectionItemIndex, CustomToolbar, CustomToolbarButton, CustomToolbarDivider, DragHandle, DropIndicator, type DropIndicatorProps, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, EmptySection, type EmptySectionProps, FOOTER_COLUMN_BLOCKS, FOOTER_COLUMN_SPANS, FOOTER_SOCIAL_PLATFORMS, ItemActionToolbar, type ItemActionToolbarProps, ItemInteractionLayer, type ItemInteractionLayerProps, type ItemInteractionState, LinkEditorPanel, type LinkModalMode, type LinkModalProps, type LinkPage, LinkPopover, type LinkSection, OHW_LOADER_PREHYDRATE_SCRIPT, OHW_LOADER_STYLE, OhhwellsBridge, OhwLoaderSpinner, OhwLoaderSurface, SITE_OG_IMAGE_KEY, SchedulingWidget, type SectionScaffold, type SiteLegalLinks, type SitePageEntry, TEMPLATE_LOGO_ATTR, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, addFooterLinkColumn, appendFooterSocial, applyBrandChrome, applyStickySearchParams, buildDefaultFooterTree, buildTarget, dropIndicatorVariants, ensureFooterTree, filterAvailablePages, foldAlignIntoTrees, getEditModeInitialState, hasMountedContentNodes, indexCollectionItems, insertFooterHours, isEditSessionActive, isPlainLeftClick, isRenderableFooterTree, isRenderableTree, isStickySearchParam, isValidUrl, matchCollectionItemClick, nextViableSlide, parseAiFooterState, parseAiSectionsState, parseTarget, recordOverriddenPaths, releaseTemplateLogoIfReplaced, removeFooterBlock, resetOverriddenPathsCache, resolveFooterCopyright, resolveStickyNavigation, serializeAiFooterState, shouldFetchContentForPath, stepViableSlide, stripTextAlignCss, toggleVariants, useOhwCarousel, validateUrlInput, viableSlides };
1149
+ export { AI_DEFAULT_BRAND, AI_FOOTER_KEY, AI_TREE_SCHEMA_VERSIONS, AI_TREE_TOKENS, type AiBlockNode, type AiBrandKit, type AiFooterBottomBar, type AiFooterColumn, type AiFooterLayoutTree, AiFooterRenderer, type AiFooterRendererProps, type AiLayoutTree, AiTreeRenderer, type AiTreeRendererProps, BRAND_TITLE_KEY, type CarouselSlide, type CollectionItemHit, type CollectionItemIndex, CustomToolbar, CustomToolbarButton, CustomToolbarDivider, DragHandle, DropIndicator, type DropIndicatorProps, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, EmptySection, type EmptySectionProps, FOOTER_COLUMN_BLOCKS, FOOTER_COLUMN_SPANS, FOOTER_SOCIAL_PLATFORMS, ItemActionToolbar, type ItemActionToolbarProps, ItemInteractionLayer, type ItemInteractionLayerProps, type ItemInteractionState, LinkEditorPanel, type LinkModalMode, type LinkModalProps, type LinkPage, LinkPopover, type LinkSection, OHW_LOADER_PREHYDRATE_SCRIPT, OHW_LOADER_STYLE, OhhwellsBridge, OhwLoaderSpinner, OhwLoaderSurface, type PagesSyncMessage, SITE_OG_IMAGE_KEY, SchedulingWidget, type SectionScaffold, type SiteLegalLinks, type SitePageEntry, type SyncLink, type SyncPlan, TEMPLATE_LOGO_ATTR, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, addFooterLinkColumn, appendFooterSocial, applyBrandChrome, applyStickySearchParams, buildDefaultFooterTree, buildTarget, dropIndicatorVariants, ensureFooterTree, filterAvailablePages, foldAlignIntoTrees, getEditModeInitialState, hasMountedContentNodes, indexCollectionItems, insertFooterHours, isDeadPageHref, isEditSessionActive, isPlainLeftClick, isRenderableFooterTree, isRenderableTree, isStickySearchParam, isValidUrl, matchCollectionItemClick, nextViableSlide, parseAiFooterState, parseAiSectionsState, parseTarget, planBuildPageSync, recordOverriddenPaths, releaseTemplateLogoIfReplaced, removeFooterBlock, resetOverriddenPathsCache, resolveFooterCopyright, resolveStickyNavigation, serializeAiFooterState, shouldFetchContentForPath, stepViableSlide, stripTextAlignCss, toggleVariants, useOhwCarousel, validateUrlInput, viableSlides };