@ohhwells/bridge 0.1.171 → 0.1.172-next.457

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
@@ -546,6 +546,89 @@ declare function foldAlignIntoTrees(state: AiSectionsState, store: StyleStore):
546
546
  changed: boolean;
547
547
  };
548
548
 
549
+ /**
550
+ * Client-side structural remove for any AI layout block (toolbar / keyboard Delete).
551
+ * Mirrors rn-mobile-backend `removeBlockAtPath` / `blockPathFromEditKey` (OHH-837); callers
552
+ * still round-trip the result through `POST .../ai/validate-tree` before applying.
553
+ */
554
+
555
+ type RemoveBlockSuccess = {
556
+ ok: true;
557
+ tree: AiLayoutTree;
558
+ path: string;
559
+ entry: AiSectionEntry;
560
+ };
561
+ type RemoveBlockFailure = {
562
+ ok: false;
563
+ reasons: string[];
564
+ };
565
+ type RemoveBlockResult = RemoveBlockSuccess | RemoveBlockFailure;
566
+ /** Map a canvas edit key (`ai.<sectionId>.r0.b1.content`) to the block path (`r0.b1`). */
567
+ declare function blockPathFromEditKey(sectionId: string, key: string): string | undefined;
568
+ /**
569
+ * Remove the block at `path` from a clone of `tree`. Empty rows drop; a promoted stack with
570
+ * one child left unwraps. Does not run the full layout validator — callers must.
571
+ */
572
+ declare function removeBlockAtPath(tree: AiLayoutTree, path: string): {
573
+ ok: true;
574
+ tree: AiLayoutTree;
575
+ } | RemoveBlockFailure;
576
+ /**
577
+ * Resolve any canvas edit/href key under an AI section to a removable block + next tree.
578
+ * Returns null when the key is not an AI layout block (template nodes, nav, etc.).
579
+ */
580
+ declare function planAiBlockRemoval(aiSectionsRaw: string | null | undefined, editKey: string | null | undefined): RemoveBlockResult | null;
581
+ /** @deprecated Prefer planAiBlockRemoval — same behaviour (any block type). */
582
+ declare const planAiTextBlockRemoval: typeof planAiBlockRemoval;
583
+ /** Whether Delete can remove the AI layout block addressed by this edit key. */
584
+ declare function canRemoveAiBlock(aiSectionsRaw: string | null | undefined, editKey: string | null | undefined): boolean;
585
+ /** @deprecated Prefer canRemoveAiBlock. */
586
+ declare const canRemoveAiTextBlock: typeof canRemoveAiBlock;
587
+
588
+ declare const HIDDEN_EDITABLES_KEY = "__ohw_hidden_editables";
589
+ type ContentNode = {
590
+ key: string;
591
+ text: string;
592
+ };
593
+ declare function readHiddenEditables(content: Record<string, string> | null | undefined): string[];
594
+ declare function isEditableKeyHidden(content: Record<string, string> | null | undefined, key: string | null | undefined): boolean;
595
+ /**
596
+ * Element actually removed from view:
597
+ * - CTA label → whole button
598
+ * - anything inside a form (labels) → whole form
599
+ */
600
+ declare function resolveSoftHideTarget(el: HTMLElement): HTMLElement;
601
+ /**
602
+ * Whether the floating Delete control can soft-hide this template editable.
603
+ * `isNavFooterItem` is only for true nav/footer chrome (not section CTAs) — those keep
604
+ * their dedicated item-delete paths.
605
+ */
606
+ declare function canSoftHideEditable(el: HTMLElement | null | undefined, opts?: {
607
+ isNavFooterItem?: boolean;
608
+ }): boolean;
609
+ declare function withHiddenEditable(content: Record<string, string>, key: string): {
610
+ content: Record<string, string>;
611
+ nodes: ContentNode[];
612
+ added: boolean;
613
+ };
614
+ declare function withoutHiddenEditable(content: Record<string, string>, key: string): {
615
+ content: Record<string, string>;
616
+ nodes: ContentNode[];
617
+ };
618
+ /** Hide every persisted key in the live DOM (edit hydrate + published apply). */
619
+ declare function applyHiddenEditablesToDom(content: Record<string, string> | null | undefined, root?: ParentNode): void;
620
+ /** Soft-hide one editable now and return previous content for Undo. */
621
+ declare function softHideEditableInDom(el: HTMLElement, content: Record<string, string>): {
622
+ content: Record<string, string>;
623
+ nodes: ContentNode[];
624
+ key: string;
625
+ target: HTMLElement;
626
+ } | null;
627
+ declare function softUnhideEditableInDom(key: string, content: Record<string, string>, root?: ParentNode): {
628
+ content: Record<string, string>;
629
+ nodes: ContentNode[];
630
+ };
631
+
549
632
  /**
550
633
  * Site-wide AI footer persistence .
551
634
  *
@@ -1154,4 +1237,4 @@ declare function useOhwCarousel(key: string, initial: CarouselSlide[]): {
1154
1237
  bind: Record<string, string>;
1155
1238
  };
1156
1239
 
1157
- 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, stripPlaceholderText, stripPlaceholders, stripTextAlignCss, toggleVariants, useOhwCarousel, validateUrlInput, viableSlides };
1240
+ 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, HIDDEN_EDITABLES_KEY, 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, applyHiddenEditablesToDom, applyStickySearchParams, blockPathFromEditKey, buildDefaultFooterTree, buildTarget, canRemoveAiBlock, canRemoveAiTextBlock, canSoftHideEditable, dropIndicatorVariants, ensureFooterTree, filterAvailablePages, foldAlignIntoTrees, getEditModeInitialState, hasMountedContentNodes, indexCollectionItems, insertFooterHours, isDeadPageHref, isEditSessionActive, isEditableKeyHidden, isPlainLeftClick, isRenderableFooterTree, isRenderableTree, isStickySearchParam, isValidUrl, matchCollectionItemClick, nextViableSlide, parseAiFooterState, parseAiSectionsState, parseTarget, planAiBlockRemoval, planAiTextBlockRemoval, planBuildPageSync, readHiddenEditables, recordOverriddenPaths, releaseTemplateLogoIfReplaced, removeBlockAtPath, removeFooterBlock, resetOverriddenPathsCache, resolveFooterCopyright, resolveSoftHideTarget, resolveStickyNavigation, serializeAiFooterState, shouldFetchContentForPath, softHideEditableInDom, softUnhideEditableInDom, stepViableSlide, stripPlaceholderText, stripPlaceholders, stripTextAlignCss, toggleVariants, useOhwCarousel, validateUrlInput, viableSlides, withHiddenEditable, withoutHiddenEditable };
package/dist/index.d.ts CHANGED
@@ -546,6 +546,89 @@ declare function foldAlignIntoTrees(state: AiSectionsState, store: StyleStore):
546
546
  changed: boolean;
547
547
  };
548
548
 
549
+ /**
550
+ * Client-side structural remove for any AI layout block (toolbar / keyboard Delete).
551
+ * Mirrors rn-mobile-backend `removeBlockAtPath` / `blockPathFromEditKey` (OHH-837); callers
552
+ * still round-trip the result through `POST .../ai/validate-tree` before applying.
553
+ */
554
+
555
+ type RemoveBlockSuccess = {
556
+ ok: true;
557
+ tree: AiLayoutTree;
558
+ path: string;
559
+ entry: AiSectionEntry;
560
+ };
561
+ type RemoveBlockFailure = {
562
+ ok: false;
563
+ reasons: string[];
564
+ };
565
+ type RemoveBlockResult = RemoveBlockSuccess | RemoveBlockFailure;
566
+ /** Map a canvas edit key (`ai.<sectionId>.r0.b1.content`) to the block path (`r0.b1`). */
567
+ declare function blockPathFromEditKey(sectionId: string, key: string): string | undefined;
568
+ /**
569
+ * Remove the block at `path` from a clone of `tree`. Empty rows drop; a promoted stack with
570
+ * one child left unwraps. Does not run the full layout validator — callers must.
571
+ */
572
+ declare function removeBlockAtPath(tree: AiLayoutTree, path: string): {
573
+ ok: true;
574
+ tree: AiLayoutTree;
575
+ } | RemoveBlockFailure;
576
+ /**
577
+ * Resolve any canvas edit/href key under an AI section to a removable block + next tree.
578
+ * Returns null when the key is not an AI layout block (template nodes, nav, etc.).
579
+ */
580
+ declare function planAiBlockRemoval(aiSectionsRaw: string | null | undefined, editKey: string | null | undefined): RemoveBlockResult | null;
581
+ /** @deprecated Prefer planAiBlockRemoval — same behaviour (any block type). */
582
+ declare const planAiTextBlockRemoval: typeof planAiBlockRemoval;
583
+ /** Whether Delete can remove the AI layout block addressed by this edit key. */
584
+ declare function canRemoveAiBlock(aiSectionsRaw: string | null | undefined, editKey: string | null | undefined): boolean;
585
+ /** @deprecated Prefer canRemoveAiBlock. */
586
+ declare const canRemoveAiTextBlock: typeof canRemoveAiBlock;
587
+
588
+ declare const HIDDEN_EDITABLES_KEY = "__ohw_hidden_editables";
589
+ type ContentNode = {
590
+ key: string;
591
+ text: string;
592
+ };
593
+ declare function readHiddenEditables(content: Record<string, string> | null | undefined): string[];
594
+ declare function isEditableKeyHidden(content: Record<string, string> | null | undefined, key: string | null | undefined): boolean;
595
+ /**
596
+ * Element actually removed from view:
597
+ * - CTA label → whole button
598
+ * - anything inside a form (labels) → whole form
599
+ */
600
+ declare function resolveSoftHideTarget(el: HTMLElement): HTMLElement;
601
+ /**
602
+ * Whether the floating Delete control can soft-hide this template editable.
603
+ * `isNavFooterItem` is only for true nav/footer chrome (not section CTAs) — those keep
604
+ * their dedicated item-delete paths.
605
+ */
606
+ declare function canSoftHideEditable(el: HTMLElement | null | undefined, opts?: {
607
+ isNavFooterItem?: boolean;
608
+ }): boolean;
609
+ declare function withHiddenEditable(content: Record<string, string>, key: string): {
610
+ content: Record<string, string>;
611
+ nodes: ContentNode[];
612
+ added: boolean;
613
+ };
614
+ declare function withoutHiddenEditable(content: Record<string, string>, key: string): {
615
+ content: Record<string, string>;
616
+ nodes: ContentNode[];
617
+ };
618
+ /** Hide every persisted key in the live DOM (edit hydrate + published apply). */
619
+ declare function applyHiddenEditablesToDom(content: Record<string, string> | null | undefined, root?: ParentNode): void;
620
+ /** Soft-hide one editable now and return previous content for Undo. */
621
+ declare function softHideEditableInDom(el: HTMLElement, content: Record<string, string>): {
622
+ content: Record<string, string>;
623
+ nodes: ContentNode[];
624
+ key: string;
625
+ target: HTMLElement;
626
+ } | null;
627
+ declare function softUnhideEditableInDom(key: string, content: Record<string, string>, root?: ParentNode): {
628
+ content: Record<string, string>;
629
+ nodes: ContentNode[];
630
+ };
631
+
549
632
  /**
550
633
  * Site-wide AI footer persistence .
551
634
  *
@@ -1154,4 +1237,4 @@ declare function useOhwCarousel(key: string, initial: CarouselSlide[]): {
1154
1237
  bind: Record<string, string>;
1155
1238
  };
1156
1239
 
1157
- 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, stripPlaceholderText, stripPlaceholders, stripTextAlignCss, toggleVariants, useOhwCarousel, validateUrlInput, viableSlides };
1240
+ 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, HIDDEN_EDITABLES_KEY, 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, applyHiddenEditablesToDom, applyStickySearchParams, blockPathFromEditKey, buildDefaultFooterTree, buildTarget, canRemoveAiBlock, canRemoveAiTextBlock, canSoftHideEditable, dropIndicatorVariants, ensureFooterTree, filterAvailablePages, foldAlignIntoTrees, getEditModeInitialState, hasMountedContentNodes, indexCollectionItems, insertFooterHours, isDeadPageHref, isEditSessionActive, isEditableKeyHidden, isPlainLeftClick, isRenderableFooterTree, isRenderableTree, isStickySearchParam, isValidUrl, matchCollectionItemClick, nextViableSlide, parseAiFooterState, parseAiSectionsState, parseTarget, planAiBlockRemoval, planAiTextBlockRemoval, planBuildPageSync, readHiddenEditables, recordOverriddenPaths, releaseTemplateLogoIfReplaced, removeBlockAtPath, removeFooterBlock, resetOverriddenPathsCache, resolveFooterCopyright, resolveSoftHideTarget, resolveStickyNavigation, serializeAiFooterState, shouldFetchContentForPath, softHideEditableInDom, softUnhideEditableInDom, stepViableSlide, stripPlaceholderText, stripPlaceholders, stripTextAlignCss, toggleVariants, useOhwCarousel, validateUrlInput, viableSlides, withHiddenEditable, withoutHiddenEditable };