@ohhwells/bridge 0.1.179 → 0.1.180-next.482
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.cjs +6043 -2843
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +329 -7
- package/dist/index.d.ts +329 -7
- package/dist/index.js +5948 -2764
- package/dist/index.js.map +1 -1
- package/dist/pages.cjs.map +1 -1
- package/dist/pages.js.map +1 -1
- package/dist/styles.css +252 -3
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -105,10 +105,12 @@ interface AiLayoutTree {
|
|
|
105
105
|
scaffold: SectionScaffold;
|
|
106
106
|
tag?: string;
|
|
107
107
|
settings?: AiSectionSettings;
|
|
108
|
-
/** A row's `align` sets the vertical alignment of its columns; `stretch` equalises heights.
|
|
108
|
+
/** A row's `align` sets the vertical alignment of its columns; `stretch` equalises heights.
|
|
109
|
+
* `layer: 'card'` draws the row inside a card laid over the row before it (a form over a map). */
|
|
109
110
|
rows: Array<{
|
|
110
111
|
blocks: AiBlockNode[];
|
|
111
112
|
align?: 'top' | 'center' | 'bottom' | 'stretch';
|
|
113
|
+
layer?: 'card';
|
|
112
114
|
}>;
|
|
113
115
|
}
|
|
114
116
|
declare const BUTTON_FILL_TOKENS: readonly ["dark", "primary", "accent", "light"];
|
|
@@ -585,8 +587,154 @@ declare function canRemoveAiBlock(aiSectionsRaw: string | null | undefined, edit
|
|
|
585
587
|
/** @deprecated Prefer canRemoveAiBlock. */
|
|
586
588
|
declare const canRemoveAiTextBlock: typeof canRemoveAiBlock;
|
|
587
589
|
|
|
590
|
+
/**
|
|
591
|
+
* Buttons in generated sections (OHH-1067 / OHH-1068): Duplicate and Add button as tree edits.
|
|
592
|
+
*
|
|
593
|
+
* A generated section is rendered from its saved tree, so a button put straight into its DOM
|
|
594
|
+
* would be lost on the next render. These helpers return the next tree instead; the caller
|
|
595
|
+
* round-trips it through validate-tree and applies it like any other tree edit.
|
|
596
|
+
*
|
|
597
|
+
* - The button already sits in a `button-row`: the new one goes into that row.
|
|
598
|
+
* - It sits in a card that lists its buttons as children (pricing): the new one goes right after
|
|
599
|
+
* the card's last button, so the card keeps rendering it.
|
|
600
|
+
* - Anything else (a lone button block, or a button in a stack): the button is wrapped in a
|
|
601
|
+
* `button-row`, so the pair lays out side by side like a template's button group.
|
|
602
|
+
*/
|
|
603
|
+
|
|
604
|
+
declare const AI_NEW_BUTTON_LABEL = "Button";
|
|
605
|
+
type AiButtonCopyMode = 'duplicate' | 'new';
|
|
606
|
+
type AiButtonCopyPlan = {
|
|
607
|
+
entry: AiSectionEntry;
|
|
608
|
+
tree: AiLayoutTree;
|
|
609
|
+
/** Href key of the button that will exist after the tree renders, to select it. */
|
|
610
|
+
newHrefKey: string;
|
|
611
|
+
};
|
|
612
|
+
/** Whether `hrefKey` addresses a button node of a generated section. */
|
|
613
|
+
declare function isAiTreeButtonKey(aiSectionsRaw: string | null | undefined, hrefKey: string | null | undefined): boolean;
|
|
614
|
+
/**
|
|
615
|
+
* Next tree with a copy of the button at `hrefKey`: an exact copy right after it ('duplicate'),
|
|
616
|
+
* or a Secondary "Button" after the last button of its row ('new').
|
|
617
|
+
*/
|
|
618
|
+
declare function planAiButtonCopy(aiSectionsRaw: string | null | undefined, hrefKey: string | null | undefined, mode: AiButtonCopyMode): AiButtonCopyPlan | null;
|
|
619
|
+
/** Whether `planAiButtonCopy` would produce a tree for this button (drives "+" and Duplicate). */
|
|
620
|
+
declare function canCopyAiButton(aiSectionsRaw: string | null | undefined, hrefKey: string | null | undefined, mode: AiButtonCopyMode): boolean;
|
|
621
|
+
|
|
622
|
+
/** Old path -> new path for every node that survived the edit (unchanged paths included). */
|
|
623
|
+
type AiPathMoves = Record<string, string>;
|
|
624
|
+
/**
|
|
625
|
+
* Draft writes that carry the section's copy along with `moves`. A key is rewritten when the node
|
|
626
|
+
* now at its path is not the one that was there: it takes that node's saved value, else what that
|
|
627
|
+
* node rendered (`rendered` reads the live DOM before the edit), else `''` for a path nobody holds.
|
|
628
|
+
*/
|
|
629
|
+
declare function remapAiSlotKeys(sectionId: string, moves: AiPathMoves, content: Record<string, string>, rendered: (key: string) => string | null): Array<{
|
|
630
|
+
key: string;
|
|
631
|
+
text: string;
|
|
632
|
+
}>;
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* OHH-1067 rule 5: "The whole collection moves like any other block". A section's button
|
|
636
|
+
* collection is dragged as one block and dropped above or below another block of any template
|
|
637
|
+
* section on the page (a heading, a paragraph, an image, another button collection).
|
|
638
|
+
*
|
|
639
|
+
* - Blocks that stack top to bottom take the collection in the flow, between them.
|
|
640
|
+
* - A block that is a column of a side-by-side row (an image next to the text) is first wrapped
|
|
641
|
+
* in a column (COLLECTION_COLUMN_ATTR) that takes its place in the row, so the collection sits above or
|
|
642
|
+
* below it without breaking the row. The column goes away when the collection leaves it.
|
|
643
|
+
* - The move is saved under BUTTON_COLLECTION_POS_KEY as "next to this block": the block is found
|
|
644
|
+
* again by its content key on every load, so the move survives a remount and a reload.
|
|
645
|
+
* - The collection's original place is marked, so taking the move back (undo) returns it there.
|
|
646
|
+
* - Generated sections take a collection too (between their texts and images), but only in their
|
|
647
|
+
* flow: their blocks belong to React, so they are never wrapped in a column, and a re-render that
|
|
648
|
+
* drops the collection's parent is undone on the next pass (MOVED keeps the detached element).
|
|
649
|
+
*/
|
|
650
|
+
|
|
651
|
+
declare const BUTTON_COLLECTION_POS_KEY = "__ohw_button_collection_pos";
|
|
652
|
+
type CollectionPlace = 'before' | 'after';
|
|
653
|
+
type ContentNode$2 = {
|
|
654
|
+
key: string;
|
|
655
|
+
text: string;
|
|
656
|
+
};
|
|
657
|
+
type CollectionDropTarget = {
|
|
658
|
+
anchor: string;
|
|
659
|
+
place: CollectionPlace;
|
|
660
|
+
/** Where the collection goes: `parent.insertBefore(collection, ref)`. */
|
|
661
|
+
parent: HTMLElement;
|
|
662
|
+
ref: Element | null;
|
|
663
|
+
/**
|
|
664
|
+
* Set when the anchor block is a column of a side-by-side row: on drop it is wrapped in a
|
|
665
|
+
* column first, and `parent`/`ref` are not used. The drag shows these spots over the page.
|
|
666
|
+
*/
|
|
667
|
+
column?: HTMLElement;
|
|
668
|
+
/** A generated section's group moves by a tree edit to this spot (OHH-1070), never in the DOM. */
|
|
669
|
+
ai?: AiDropTarget;
|
|
670
|
+
};
|
|
671
|
+
/**
|
|
672
|
+
* Every place the collection can be dropped: above and below each block, once per gap, leaving
|
|
673
|
+
* out the two gaps right next to the collection (dropping there would change nothing).
|
|
674
|
+
*/
|
|
675
|
+
declare function collectionDropTargets(collection: HTMLElement): CollectionDropTarget[];
|
|
676
|
+
type CollectionMoveResult = {
|
|
677
|
+
content: Record<string, string>;
|
|
678
|
+
nodes: ContentNode$2[];
|
|
679
|
+
};
|
|
680
|
+
/** Moves the collection to `target` and returns the content to save. */
|
|
681
|
+
declare function moveButtonCollection(collection: HTMLElement, target: CollectionDropTarget, content: Record<string, string>): CollectionMoveResult | null;
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Button groups of generated sections as collections (OHH-1070, part A).
|
|
685
|
+
*
|
|
686
|
+
* A generated section renders from its saved tree, so a group is edited by planning the next tree
|
|
687
|
+
* and round-tripping it through validate-tree, like Duplicate / Add button (ai-button-tree.ts).
|
|
688
|
+
* The renderer marks each group (`aiButtonCollectionAttrs`):
|
|
689
|
+
* - `row`: a `button-row` (also the one inside a section-header),
|
|
690
|
+
* - `lone`: a single `button` block, wrapped in the DOM only (the tree is not changed),
|
|
691
|
+
* - `card`: a card's own buttons; they reorder inside the card and never leave it.
|
|
692
|
+
*
|
|
693
|
+
* The planners mirror the backend rules (rn-mobile-backend ai-block-library / ai-layout-tree):
|
|
694
|
+
* - a `button-row` holds 1-2 buttons; a section-header takes one `button-row`,
|
|
695
|
+
* - a stack group takes `button` and `button-row` children,
|
|
696
|
+
* - nesting depth is at most 3 (a top-level block is depth 1; a promoted stack adds none),
|
|
697
|
+
* - a pricing card keeps exactly one primary when it has 2 buttons (order never changes that).
|
|
698
|
+
*/
|
|
699
|
+
|
|
700
|
+
/** Edit key of a block that can take a dropped group beside it, or inside it (section-header). */
|
|
701
|
+
declare const AI_BLOCK_ATTR = "data-ohw-ai-block";
|
|
702
|
+
/** `moves`: where each node went, so the section's saved copy can follow it (ai-slot-key-remap). */
|
|
703
|
+
type AiTreePlan = {
|
|
704
|
+
entry: AiSectionEntry;
|
|
705
|
+
tree: AiLayoutTree;
|
|
706
|
+
moves: AiPathMoves;
|
|
707
|
+
};
|
|
708
|
+
/**
|
|
709
|
+
* Where a dropped group goes, by the edit key of the block it lands next to:
|
|
710
|
+
* - `stack`: before/after a child of a stack group,
|
|
711
|
+
* - `header`: into a section-header that has no button row yet (`place` is 'after'),
|
|
712
|
+
* - `row`: in a new row of its own before/after a section row (stacked scaffold only).
|
|
713
|
+
*/
|
|
714
|
+
type AiDropTarget = {
|
|
715
|
+
kind: 'stack' | 'header' | 'row';
|
|
716
|
+
/** Edit key of the anchor: the stack child, the section-header, or the row (`ai.<id>.r2`). */
|
|
717
|
+
anchorKey: string;
|
|
718
|
+
place: 'before' | 'after';
|
|
719
|
+
};
|
|
720
|
+
/**
|
|
721
|
+
* Next tree with the group's button at `from` moved to `to` (indexes among the group's buttons,
|
|
722
|
+
* `to` counted after taking it out). A `row` reorders its children; a `card` reorders its buttons
|
|
723
|
+
* among the slots its buttons already use, so its other children keep their place.
|
|
724
|
+
*/
|
|
725
|
+
declare function planAiButtonReorder(aiSectionsRaw: string | null | undefined, collectionKey: string | null | undefined, from: number, to: number): AiTreePlan | null;
|
|
726
|
+
/** Final index of a dragged button among the group's buttons, from the drop slot index. */
|
|
727
|
+
declare function reorderTargetIndex(from: number, insertIndex: number, count: number): number;
|
|
728
|
+
/** Where a moved group can land in its section, own spot and its own inside left out. */
|
|
729
|
+
declare function aiCollectionDropTargets(aiSectionsRaw: string | null | undefined, collectionKey: string | null | undefined): AiDropTarget[];
|
|
730
|
+
/**
|
|
731
|
+
* Next tree with the group at `collectionKey` moved to `target`. A row moves as a row and a lone
|
|
732
|
+
* button as a button; into a section-header a lone button goes in a new one-button row.
|
|
733
|
+
*/
|
|
734
|
+
declare function planAiButtonGroupMove(aiSectionsRaw: string | null | undefined, collectionKey: string | null | undefined, target: AiDropTarget): AiTreePlan | null;
|
|
735
|
+
|
|
588
736
|
declare const HIDDEN_EDITABLES_KEY = "__ohw_hidden_editables";
|
|
589
|
-
type ContentNode = {
|
|
737
|
+
type ContentNode$1 = {
|
|
590
738
|
key: string;
|
|
591
739
|
text: string;
|
|
592
740
|
};
|
|
@@ -608,26 +756,114 @@ declare function canSoftHideEditable(el: HTMLElement | null | undefined, opts?:
|
|
|
608
756
|
}): boolean;
|
|
609
757
|
declare function withHiddenEditable(content: Record<string, string>, key: string): {
|
|
610
758
|
content: Record<string, string>;
|
|
611
|
-
nodes: ContentNode[];
|
|
759
|
+
nodes: ContentNode$1[];
|
|
612
760
|
added: boolean;
|
|
613
761
|
};
|
|
614
762
|
declare function withoutHiddenEditable(content: Record<string, string>, key: string): {
|
|
615
763
|
content: Record<string, string>;
|
|
616
|
-
nodes: ContentNode[];
|
|
764
|
+
nodes: ContentNode$1[];
|
|
617
765
|
};
|
|
618
766
|
/** Hide every persisted key in the live DOM (edit hydrate + published apply). */
|
|
619
767
|
declare function applyHiddenEditablesToDom(content: Record<string, string> | null | undefined, root?: ParentNode): void;
|
|
620
768
|
/** Soft-hide one editable now and return previous content for Undo. */
|
|
621
769
|
declare function softHideEditableInDom(el: HTMLElement, content: Record<string, string>): {
|
|
622
770
|
content: Record<string, string>;
|
|
623
|
-
nodes: ContentNode[];
|
|
771
|
+
nodes: ContentNode$1[];
|
|
624
772
|
key: string;
|
|
625
773
|
target: HTMLElement;
|
|
626
774
|
} | null;
|
|
627
775
|
declare function softUnhideEditableInDom(key: string, content: Record<string, string>, root?: ParentNode): {
|
|
776
|
+
content: Record<string, string>;
|
|
777
|
+
nodes: ContentNode$1[];
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Duplicate / delete / add for canvas buttons (OHH-802, OHH-1067).
|
|
782
|
+
*
|
|
783
|
+
* Navbar: the first duplicate wraps the original and the copy in a collection.
|
|
784
|
+
* Sections: every free-standing button always sits in a collection, even a single one
|
|
785
|
+
* (OHH-1067). A parent that holds only buttons becomes the collection as it is; a button with
|
|
786
|
+
* other content beside it gets a small wrapper. A collection keeps living at one button and
|
|
787
|
+
* is hidden once its last button is deleted.
|
|
788
|
+
* Navbar keeps at least one button — delete is blocked, not hidden.
|
|
789
|
+
*/
|
|
790
|
+
declare const BUTTON_COLLECTIONS_KEY = "__ohw_button_collections";
|
|
791
|
+
declare const BUTTON_HIDDEN_KEY = "__ohw_button_hidden";
|
|
792
|
+
declare const COLLECTION_ATTR = "data-ohw-button-collection";
|
|
793
|
+
type ContentNode = {
|
|
794
|
+
key: string;
|
|
795
|
+
text: string;
|
|
796
|
+
};
|
|
797
|
+
declare function buttonCollectionOf(el: HTMLElement | null | undefined): HTMLElement | null;
|
|
798
|
+
/**
|
|
799
|
+
* A free-standing button of a page section (OHH-1067): not the navbar, footer, a form, a card's
|
|
800
|
+
* own button, or a generated section's (those render their collection from the tree).
|
|
801
|
+
*/
|
|
802
|
+
declare function isSectionCta(el: HTMLElement): boolean;
|
|
803
|
+
/**
|
|
804
|
+
* A button the editor can style can also be duplicated: every CTA with an id, wherever it sits
|
|
805
|
+
* (section, card, form, header, footer). Free-standing section buttons always sit in a
|
|
806
|
+
* collection (OHH-1067); any other one gets a collection on its first copy, like the navbar.
|
|
807
|
+
* Generated sections are React-rendered from their tree, so a copy put into their DOM would be
|
|
808
|
+
* lost; they add buttons through tree edits instead.
|
|
809
|
+
*/
|
|
810
|
+
declare function canDuplicateButton(el: HTMLElement): boolean;
|
|
811
|
+
/** "+" / Add button: every duplicable button except the navbar's, which has its own inserter. */
|
|
812
|
+
declare function canAddButton(el: HTMLElement): boolean;
|
|
813
|
+
/** Add button next to `button`: a Secondary "Button" at the end of its row, or right after it. */
|
|
814
|
+
declare function addButtonNextTo(button: HTMLElement, content: Record<string, string>): ButtonDuplicateResult | null;
|
|
815
|
+
/**
|
|
816
|
+
* Every free-standing section button sits in a collection, even a single one (OHH-1067).
|
|
817
|
+
* Runs after the saved collections were rebuilt, so only buttons outside one are grouped here.
|
|
818
|
+
*/
|
|
819
|
+
declare function ensureSectionButtonCollections(doc: Document, content: Record<string, string>): void;
|
|
820
|
+
type ButtonDuplicateResult = {
|
|
821
|
+
copy: HTMLElement;
|
|
628
822
|
content: Record<string, string>;
|
|
629
823
|
nodes: ContentNode[];
|
|
630
824
|
};
|
|
825
|
+
type ButtonCopyMode = 'duplicate' | 'new';
|
|
826
|
+
/**
|
|
827
|
+
* `duplicate`: an exact copy right after `source`.
|
|
828
|
+
* `new` (Add button, OHH-1068 / OHH-1069): a Secondary button labelled "Button", built from
|
|
829
|
+
* `source` (the last button of the collection) so it shares its shape, size and link.
|
|
830
|
+
*/
|
|
831
|
+
declare function duplicateButton(source: HTMLElement, content: Record<string, string>, mode?: ButtonCopyMode): ButtonDuplicateResult | null;
|
|
832
|
+
/** Buttons of a collection the visitor sees, in page order. */
|
|
833
|
+
declare function visibleCollectionButtons(collection: HTMLElement): HTMLElement[];
|
|
834
|
+
/** Add button (OHH-1068 / OHH-1069): a Secondary "Button" at the end of the collection. */
|
|
835
|
+
declare function addButtonToCollection(collection: HTMLElement, content: Record<string, string>): ButtonDuplicateResult | null;
|
|
836
|
+
type ButtonDeleteResult = {
|
|
837
|
+
content: Record<string, string>;
|
|
838
|
+
nodes: ContentNode[];
|
|
839
|
+
undo: () => void;
|
|
840
|
+
};
|
|
841
|
+
declare function deleteButton(source: HTMLElement, content: Record<string, string>): ButtonDeleteResult | null;
|
|
842
|
+
type ButtonDropSlot = {
|
|
843
|
+
insertIndex: number;
|
|
844
|
+
left: number;
|
|
845
|
+
top: number;
|
|
846
|
+
width: number;
|
|
847
|
+
height: number;
|
|
848
|
+
direction: 'vertical' | 'horizontal';
|
|
849
|
+
};
|
|
850
|
+
/** Gap lines between navbar CTAs — same DropIndicator as nav links (OHH-798). */
|
|
851
|
+
declare function buildButtonCollectionDropSlots(collection: HTMLElement): ButtonDropSlot[];
|
|
852
|
+
/** Index of the slot nearest the pointer; being outside a slot's own line counts heavily. */
|
|
853
|
+
declare function nearestButtonDropSlot(slots: ButtonDropSlot[], clientX: number, clientY: number): number;
|
|
854
|
+
/**
|
|
855
|
+
* Re-apply collection membership and hidden buttons after a template remount.
|
|
856
|
+
* Missing copies are rebuilt from the snapshot taken at duplicate time.
|
|
857
|
+
* Label/href always prefer live content over the snapshot so edits survive remount.
|
|
858
|
+
*/
|
|
859
|
+
declare function syncButtonsFromContent(doc: Document, content: Record<string, string>): void;
|
|
860
|
+
/**
|
|
861
|
+
* Reorder CTAs: navbar (collection wrapper, or 2+ CTAs in the same nav, OHH-798) and section
|
|
862
|
+
* buttons, which always sit in a collection (OHH-1067).
|
|
863
|
+
*/
|
|
864
|
+
declare function collectionDragEnabled(el: HTMLElement): boolean;
|
|
865
|
+
|
|
866
|
+
declare function nearestSpotIndex(rects: DOMRect[], x: number, y: number, radius?: number): number;
|
|
631
867
|
|
|
632
868
|
/**
|
|
633
869
|
* Site-wide AI footer persistence .
|
|
@@ -871,6 +1107,8 @@ declare function CustomToolbarDivider({ className, ...props }: React.HTMLAttribu
|
|
|
871
1107
|
/** Figma Toggle: 28×28, radius calc(var(--radius)-2px)=6px, icon 16. */
|
|
872
1108
|
declare const CustomToolbarButton: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
873
1109
|
active?: boolean;
|
|
1110
|
+
/** `icon`: 28×28 square. `label`: icon + words, e.g. "Add button" (OHH-1069). */
|
|
1111
|
+
size?: "icon" | "label";
|
|
874
1112
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
875
1113
|
|
|
876
1114
|
type ItemActionToolbarProps = {
|
|
@@ -892,6 +1130,10 @@ type ItemActionToolbarProps = {
|
|
|
892
1130
|
showEditLink?: boolean;
|
|
893
1131
|
/** Hide Add item — CTA buttons only show Edit link (prototype). */
|
|
894
1132
|
showAddItem?: boolean;
|
|
1133
|
+
/** Words on the add button (OHH-1069): "Add button", "Add card", or "Add item". */
|
|
1134
|
+
addItemLabel?: string;
|
|
1135
|
+
/** Show the add button as a bare "+" with the label as its tooltip (a single button's toolbar). */
|
|
1136
|
+
addItemIconOnly?: boolean;
|
|
895
1137
|
showStyle?: boolean;
|
|
896
1138
|
/** Reflects whether the style panel is open, so the button reads as a toggle. */
|
|
897
1139
|
styleActive?: boolean;
|
|
@@ -913,7 +1155,7 @@ type ItemActionToolbarProps = {
|
|
|
913
1155
|
onHeadingVisibleChange?: (visible: boolean) => void;
|
|
914
1156
|
};
|
|
915
1157
|
/** Item-action fill for Custom/Toolbar — Edit link / Add item / More (+ OHH-468 toggles). */
|
|
916
|
-
declare function ItemActionToolbar({ onEditLink, onAddItem, onStyle, onSelectParent, onDuplicate, onDelete, editLinkDisabled, addItemDisabled, moreDisabled, selectParentDisabled, duplicateDisabled, deleteDisabled, showEditLink, showAddItem, showStyle, styleActive, showMore, tooltipSide, dropdownOpen, onDropdownOpenChange, headingVisible, onHeadingVisibleChange, }: ItemActionToolbarProps): react_jsx_runtime.JSX.Element;
|
|
1158
|
+
declare function ItemActionToolbar({ onEditLink, onAddItem, onStyle, onSelectParent, onDuplicate, onDelete, editLinkDisabled, addItemDisabled, moreDisabled, selectParentDisabled, duplicateDisabled, deleteDisabled, showEditLink, showAddItem, addItemLabel, addItemIconOnly, showStyle, styleActive, showMore, tooltipSide, dropdownOpen, onDropdownOpenChange, headingVisible, onHeadingVisibleChange, }: ItemActionToolbarProps): react_jsx_runtime.JSX.Element;
|
|
917
1159
|
|
|
918
1160
|
type ItemInteractionState = 'default' | 'hover' | 'sibling-hint' | 'active-top' | 'active-bottom' | 'dragging';
|
|
919
1161
|
type ItemInteractionLayerProps = {
|
|
@@ -1473,4 +1715,84 @@ declare function brandColorVars(palette: AiBrandKit['palette']): Record<string,
|
|
|
1473
1715
|
*/
|
|
1474
1716
|
declare function onPrimaryInk(primary: string, light: string, dark: string): string;
|
|
1475
1717
|
|
|
1476
|
-
|
|
1718
|
+
/**
|
|
1719
|
+
* validate-tree answers with developer reasons ("rows[1].blocks[0].children[0]: "card" needs 0-2
|
|
1720
|
+
* children, got 3"). The editor shows them in a toast, so they are turned into a plain sentence:
|
|
1721
|
+
* the tree path goes, block types get their editor names, and the known limits say what to do.
|
|
1722
|
+
*/
|
|
1723
|
+
declare function humanizeTreeReason(reason: string | null | undefined): string;
|
|
1724
|
+
|
|
1725
|
+
/**
|
|
1726
|
+
* OHH-990: live layout previews for the editor's layout strip, the pure half.
|
|
1727
|
+
*
|
|
1728
|
+
* The editor (cross-origin parent) can't render an AI tree itself, so the bridge renders each
|
|
1729
|
+
* layout offscreen with the real AiTreeRenderer and ships the result as a self-contained HTML
|
|
1730
|
+
* document. The editor drops it into a sandboxed `srcdoc` iframe and scales it into a card.
|
|
1731
|
+
* This file holds the parts that need no DOM: the message shapes, the document builder and the
|
|
1732
|
+
* card background rule. The DOM half lives in ui/ai-tree/layoutPreviews.tsx.
|
|
1733
|
+
*/
|
|
1734
|
+
declare const LAYOUT_PREVIEWS_REQUEST = "ow:ai-layout-previews";
|
|
1735
|
+
declare const LAYOUT_PREVIEW_REPLY = "ow:ai-layout-preview";
|
|
1736
|
+
interface LayoutPreviewRequest {
|
|
1737
|
+
requestId: string;
|
|
1738
|
+
layouts: Array<{
|
|
1739
|
+
id: string;
|
|
1740
|
+
tree: unknown;
|
|
1741
|
+
}>;
|
|
1742
|
+
/** The live section the previews stand in for; its width is the render width. */
|
|
1743
|
+
sectionId?: string;
|
|
1744
|
+
media?: Record<string, string>;
|
|
1745
|
+
brand?: unknown;
|
|
1746
|
+
}
|
|
1747
|
+
interface LayoutPreviewReply {
|
|
1748
|
+
type: typeof LAYOUT_PREVIEW_REPLY;
|
|
1749
|
+
requestId: string;
|
|
1750
|
+
id: string;
|
|
1751
|
+
/** A full HTML document for `<iframe srcdoc>`. Empty when the render failed. */
|
|
1752
|
+
doc: string;
|
|
1753
|
+
width: number;
|
|
1754
|
+
height: number;
|
|
1755
|
+
/** Card background behind the scaled preview. */
|
|
1756
|
+
bg: string;
|
|
1757
|
+
}
|
|
1758
|
+
/** What the page looks like around the section, read off the live document. */
|
|
1759
|
+
interface PreviewPageContext {
|
|
1760
|
+
/** `location.origin`, so relative stylesheet, image and font URLs still resolve. */
|
|
1761
|
+
origin: string;
|
|
1762
|
+
/** Absolute stylesheet hrefs, in document order. */
|
|
1763
|
+
stylesheets: string[];
|
|
1764
|
+
/** Inline `<style>` text, in document order. */
|
|
1765
|
+
styles: string[];
|
|
1766
|
+
htmlClass: string;
|
|
1767
|
+
htmlStyle: string;
|
|
1768
|
+
bodyClass: string;
|
|
1769
|
+
bodyStyle: string;
|
|
1770
|
+
/** Inherited text styles of the section's parent (font, colour), so wrapper-only rules survive. */
|
|
1771
|
+
inherited: string;
|
|
1772
|
+
}
|
|
1773
|
+
/**
|
|
1774
|
+
* The srcdoc document: the page's stylesheets and root variables around one section's markup.
|
|
1775
|
+
* No scripts ever: the iframe is sandboxed and the markup is a static snapshot.
|
|
1776
|
+
*/
|
|
1777
|
+
declare function buildLayoutPreviewDoc(sectionHtml: string, ctx: PreviewPageContext, width: number): string;
|
|
1778
|
+
/**
|
|
1779
|
+
* The card colour behind a preview: the section's own background colour, or white when the
|
|
1780
|
+
* section has none of its own (transparent) or paints an image (the image fills the card anyway,
|
|
1781
|
+
* white only shows while it loads).
|
|
1782
|
+
*/
|
|
1783
|
+
declare function layoutPreviewBackground(backgroundColor: string, backgroundImage: string): string;
|
|
1784
|
+
type PreviewBackgroundLayer = {
|
|
1785
|
+
backgroundColor: string;
|
|
1786
|
+
backgroundImage: string;
|
|
1787
|
+
};
|
|
1788
|
+
/**
|
|
1789
|
+
* The card colour from the layers behind a preview, nearest first: the section's own elements,
|
|
1790
|
+
* then the page around it (wrapper, main, body, html). A transparent section shows the page
|
|
1791
|
+
* colour, so its card must too, or a section on a dark page previews on white (QA 2026-11-18).
|
|
1792
|
+
* The first layer that paints anything decides.
|
|
1793
|
+
*/
|
|
1794
|
+
declare function layoutPreviewBackgroundOf(layers: PreviewBackgroundLayer[]): string;
|
|
1795
|
+
/** A request is usable when it has an id and at least one layout with an id and a tree. */
|
|
1796
|
+
declare function isLayoutPreviewRequest(value: unknown): value is LayoutPreviewRequest;
|
|
1797
|
+
|
|
1798
|
+
export { AI_BLOCK_ATTR, AI_DEFAULT_BRAND, AI_FOOTER_KEY, AI_NEW_BUTTON_LABEL, 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, BUTTON_COLLECTIONS_KEY, BUTTON_COLLECTION_POS_KEY, BUTTON_HIDDEN_KEY, COLLECTION_ATTR, 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, LAYOUT_PREVIEWS_REQUEST, LAYOUT_PREVIEW_REPLY, LOGO_ON_DARK_KEY, LOGO_ON_LIGHT_KEY, LOGO_PRIMARY_ATTR, LOGO_VARIANT_ATTR, type LayoutPreviewReply, type LayoutPreviewRequest, 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, TONE_ATTR, TONE_CHANGE_EVENT, TONE_FIX_ATTR, TONE_THRESHOLD, Toggle, ToggleGroup, ToggleGroupItem, type Tone, type ToneDeps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, addButtonNextTo, addButtonToCollection, addFooterLinkColumn, aiCollectionDropTargets, appendFooterSocial, applyBrandChrome, applyHiddenEditablesToDom, applyLogoFromContent, applyLogoImage, applyLogoVersionsFromContent, applyStickySearchParams, blockPathFromEditKey, brandColorVars, buildButtonCollectionDropSlots, buildDefaultFooterTree, buildLayoutPreviewDoc, buildTarget, buttonCollectionOf, canAddButton, canCopyAiButton, canDuplicateButton, canRemoveAiBlock, canRemoveAiTextBlock, canSoftHideEditable, collectEditableNodes, collectionDragEnabled, collectionDropTargets, compositeColor, compositeGradient, computeBackgroundTones, contrastRatioOf, deleteButton, dropIndicatorVariants, duplicateButton, ensureFooterTree, ensureSectionButtonCollections, filterAvailablePages, foldAlignIntoTrees, getEditModeInitialState, getLogoVersions, gradientStopColors, hasMountedContentNodes, humanizeTreeReason, indexCollectionItems, insertFooterHours, isAiTreeButtonKey, isDeadPageHref, isEditSessionActive, isEditableKeyHidden, isLayoutPreviewRequest, isPlainLeftClick, isRenderableFooterTree, isRenderableTree, isSectionCta, isStickySearchParam, isValidUrl, layoutPreviewBackground, layoutPreviewBackgroundOf, linearGradientColourAt, logoVersionNodesFromMessage, mapRegionToImage, matchCollectionItemClick, mountBackgroundTone, mountLogoTonePick, moveButtonCollection, nearestButtonDropSlot, nearestSpotIndex, nextViableSlide, onPrimaryInk, parseAiFooterState, parseAiSectionsState, parseCssColor, parseTarget, pickLogoUrl, planAiBlockRemoval, planAiButtonCopy, planAiButtonGroupMove, planAiButtonReorder, planAiTextBlockRemoval, planBuildPageSync, readHiddenEditables, readLogoIdentityFromDom, recordOverriddenPaths, relativeLuminanceOf, releaseTemplateLogoIfReplaced, remapAiSlotKeys, removeBlockAtPath, removeFooterBlock, reorderTargetIndex, repickLogos, resetOverriddenPathsCache, resolveFooterCopyright, resolveSoftHideTarget, resolveStickyNavigation, serializeAiFooterState, setLogoVersions, shouldFetchContentForPath, softHideEditableInDom, softUnhideEditableInDom, splitTopLevel, stepViableSlide, stripPlaceholderText, stripPlaceholders, stripTextAlignCss, syncButtonsFromContent, toggleVariants, toneFor, toneOfColor, toneOfLuminance, useOhwCarousel, validateUrlInput, viableSlides, visibleCollectionButtons, withHiddenEditable, withoutHiddenEditable };
|