@ohhwells/bridge 0.1.52 → 0.1.53-next.145
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/README.md +42 -2
- package/dist/index.cjs +3538 -756
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +140 -1
- package/dist/index.d.ts +140 -1
- package/dist/index.js +3501 -718
- package/dist/index.js.map +1 -1
- package/dist/styles.css +89 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -7,6 +7,145 @@ import { Toggle as Toggle$1, DropdownMenu as DropdownMenu$1, Tooltip as Tooltip$
|
|
|
7
7
|
|
|
8
8
|
declare function OhhwellsBridge(): React__default.ReactPortal | null;
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* AI layout-tree contract — the bridge-side vocabulary for rendering
|
|
12
|
+
* AI-generated sections.
|
|
13
|
+
*
|
|
14
|
+
* The source of truth is the backend's `app/constants/ai-block-library.ts` +
|
|
15
|
+
* `app/helpers/ai-layout-tree.ts`: the server validates every tree fail-closed
|
|
16
|
+
* before it ever reaches the bridge, so rendering trusts the shape but still
|
|
17
|
+
* degrades gracefully (unknown block types render nothing, never throw).
|
|
18
|
+
* `schemaVersion` guards cross-version drift: the renderer only accepts
|
|
19
|
+
* versions it knows.
|
|
20
|
+
*/
|
|
21
|
+
declare const AI_TREE_SCHEMA_VERSIONS: readonly [1];
|
|
22
|
+
type SectionScaffold = 'stacked' | 'split' | 'overlay';
|
|
23
|
+
type AiBlockType = 'text' | 'button' | 'media' | 'media-list' | 'rating' | 'divider' | 'input' | 'section-header' | 'button-row' | 'card' | 'collection' | 'accordion' | 'form' | 'embed' | 'schedule-widget';
|
|
24
|
+
interface AiBlockNode {
|
|
25
|
+
type: AiBlockType;
|
|
26
|
+
span: number;
|
|
27
|
+
slots?: Record<string, unknown>;
|
|
28
|
+
children?: AiBlockNode[];
|
|
29
|
+
items?: Array<{
|
|
30
|
+
question: string;
|
|
31
|
+
answer: string;
|
|
32
|
+
}>;
|
|
33
|
+
animation?: {
|
|
34
|
+
effect: 'fade-in' | 'fade-in-up' | 'slide-in-left' | 'slide-in-right' | 'zoom-in';
|
|
35
|
+
trigger: 'on-scroll' | 'on-load' | 'on-hover';
|
|
36
|
+
duration: 'fast' | 'normal' | 'slow';
|
|
37
|
+
stagger?: boolean;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
interface AiSectionSettings {
|
|
41
|
+
spacing?: 'tight' | 'balanced' | 'airy';
|
|
42
|
+
alignment?: 'left' | 'center';
|
|
43
|
+
ratio?: '1:1' | '5:3' | '3:5';
|
|
44
|
+
verticalPosition?: 'top' | 'center';
|
|
45
|
+
overlayIntensity?: 'low' | 'medium' | 'high';
|
|
46
|
+
backgroundMedia?: string;
|
|
47
|
+
}
|
|
48
|
+
interface AiLayoutTree {
|
|
49
|
+
schemaVersion: number;
|
|
50
|
+
type: 'section';
|
|
51
|
+
scaffold: SectionScaffold;
|
|
52
|
+
tag?: string;
|
|
53
|
+
settings?: AiSectionSettings;
|
|
54
|
+
rows: Array<{
|
|
55
|
+
blocks: AiBlockNode[];
|
|
56
|
+
}>;
|
|
57
|
+
}
|
|
58
|
+
/** The site brand kit the renderer styles from (editor Brand settings). */
|
|
59
|
+
interface AiBrandKit {
|
|
60
|
+
palette: {
|
|
61
|
+
dark: string;
|
|
62
|
+
primary: string;
|
|
63
|
+
accent: string;
|
|
64
|
+
light: string;
|
|
65
|
+
};
|
|
66
|
+
fonts: {
|
|
67
|
+
heading: string;
|
|
68
|
+
body: string;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** Section System defaults — used when a site has no brand kit override. */
|
|
72
|
+
declare const AI_DEFAULT_BRAND: AiBrandKit;
|
|
73
|
+
/** Design tokens from the Section System Blocks page (px unless noted). */
|
|
74
|
+
declare const AI_TREE_TOKENS: {
|
|
75
|
+
readonly textPrimaryForeground: "#FAFAF9";
|
|
76
|
+
readonly spacing2: 8;
|
|
77
|
+
readonly spacing3: 12;
|
|
78
|
+
readonly spacing4: 16;
|
|
79
|
+
readonly spacing6: 24;
|
|
80
|
+
readonly spacing8: 32;
|
|
81
|
+
readonly paddingBlock: 32;
|
|
82
|
+
readonly radiusButton: 10;
|
|
83
|
+
readonly radiusCard: 18;
|
|
84
|
+
readonly sectionMaxWidth: 1280;
|
|
85
|
+
readonly sectionPadding: {
|
|
86
|
+
readonly tight: 40;
|
|
87
|
+
readonly balanced: 64;
|
|
88
|
+
readonly airy: 96;
|
|
89
|
+
};
|
|
90
|
+
readonly type: {
|
|
91
|
+
readonly display: {
|
|
92
|
+
readonly size: 56;
|
|
93
|
+
readonly line: 1.1;
|
|
94
|
+
readonly weight: 700;
|
|
95
|
+
};
|
|
96
|
+
readonly h2: {
|
|
97
|
+
readonly size: 40;
|
|
98
|
+
readonly line: 1.15;
|
|
99
|
+
readonly weight: 700;
|
|
100
|
+
};
|
|
101
|
+
readonly h3: {
|
|
102
|
+
readonly size: 24;
|
|
103
|
+
readonly line: 1.3;
|
|
104
|
+
readonly weight: 700;
|
|
105
|
+
};
|
|
106
|
+
readonly bodyL: {
|
|
107
|
+
readonly size: 18;
|
|
108
|
+
readonly line: 1.45;
|
|
109
|
+
readonly weight: 400;
|
|
110
|
+
};
|
|
111
|
+
readonly bodyM: {
|
|
112
|
+
readonly size: 16;
|
|
113
|
+
readonly line: 1.5;
|
|
114
|
+
readonly weight: 400;
|
|
115
|
+
};
|
|
116
|
+
readonly bodyMBold: {
|
|
117
|
+
readonly size: 16;
|
|
118
|
+
readonly line: 1.5;
|
|
119
|
+
readonly weight: 700;
|
|
120
|
+
};
|
|
121
|
+
readonly eyebrow: {
|
|
122
|
+
readonly size: 14;
|
|
123
|
+
readonly line: 1.5;
|
|
124
|
+
readonly weight: 500;
|
|
125
|
+
};
|
|
126
|
+
readonly button: {
|
|
127
|
+
readonly size: 16;
|
|
128
|
+
readonly line: 1.5;
|
|
129
|
+
readonly weight: 500;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
declare function isRenderableTree(value: unknown): value is AiLayoutTree;
|
|
134
|
+
|
|
135
|
+
interface AiTreeRendererProps {
|
|
136
|
+
tree: AiLayoutTree;
|
|
137
|
+
brand?: AiBrandKit;
|
|
138
|
+
/** Resolves a media ref to a URL; null renders a placeholder. */
|
|
139
|
+
resolveMedia?: (ref: string) => string | null;
|
|
140
|
+
/**
|
|
141
|
+
* When set (e.g. `ai.<sectionId>`), text and media elements emit
|
|
142
|
+
* `data-ohw-key="<prefix>.<path>"` + `data-ohw-editable` markers, making
|
|
143
|
+
* generated sections click-to-edit and AI-editable like template sections.
|
|
144
|
+
*/
|
|
145
|
+
editKeyPrefix?: string;
|
|
146
|
+
}
|
|
147
|
+
declare function AiTreeRenderer({ tree, brand, resolveMedia, editKeyPrefix }: AiTreeRendererProps): react_jsx_runtime.JSX.Element | null;
|
|
148
|
+
|
|
10
149
|
type LinkPage = {
|
|
11
150
|
path: string;
|
|
12
151
|
title: string;
|
|
@@ -285,4 +424,4 @@ declare function useOhwCarousel(key: string, initial: CarouselSlide[]): {
|
|
|
285
424
|
bind: Record<string, string>;
|
|
286
425
|
};
|
|
287
426
|
|
|
288
|
-
export { type CarouselSlide, CustomToolbar, CustomToolbarButton, CustomToolbarDivider, DragHandle, DropIndicator, type DropIndicatorProps, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, ItemActionToolbar, type ItemActionToolbarProps, ItemInteractionLayer, type ItemInteractionLayerProps, type ItemInteractionState, LinkEditorPanel, type LinkModalMode, type LinkModalProps, type LinkPage, LinkPopover, type LinkSection, OhhwellsBridge, SchedulingWidget, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buildTarget, dropIndicatorVariants, filterAvailablePages, getEditModeInitialState, isEditSessionActive, isValidUrl, parseTarget, toggleVariants, useOhwCarousel, validateUrlInput };
|
|
427
|
+
export { AI_DEFAULT_BRAND, AI_TREE_SCHEMA_VERSIONS, AI_TREE_TOKENS, type AiBlockNode, type AiBrandKit, type AiLayoutTree, AiTreeRenderer, type AiTreeRendererProps, type CarouselSlide, CustomToolbar, CustomToolbarButton, CustomToolbarDivider, DragHandle, DropIndicator, type DropIndicatorProps, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, ItemActionToolbar, type ItemActionToolbarProps, ItemInteractionLayer, type ItemInteractionLayerProps, type ItemInteractionState, LinkEditorPanel, type LinkModalMode, type LinkModalProps, type LinkPage, LinkPopover, type LinkSection, OhhwellsBridge, SchedulingWidget, type SectionScaffold, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buildTarget, dropIndicatorVariants, filterAvailablePages, getEditModeInitialState, isEditSessionActive, isRenderableTree, isValidUrl, parseTarget, toggleVariants, useOhwCarousel, validateUrlInput };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,145 @@ import { Toggle as Toggle$1, DropdownMenu as DropdownMenu$1, Tooltip as Tooltip$
|
|
|
7
7
|
|
|
8
8
|
declare function OhhwellsBridge(): React__default.ReactPortal | null;
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* AI layout-tree contract — the bridge-side vocabulary for rendering
|
|
12
|
+
* AI-generated sections.
|
|
13
|
+
*
|
|
14
|
+
* The source of truth is the backend's `app/constants/ai-block-library.ts` +
|
|
15
|
+
* `app/helpers/ai-layout-tree.ts`: the server validates every tree fail-closed
|
|
16
|
+
* before it ever reaches the bridge, so rendering trusts the shape but still
|
|
17
|
+
* degrades gracefully (unknown block types render nothing, never throw).
|
|
18
|
+
* `schemaVersion` guards cross-version drift: the renderer only accepts
|
|
19
|
+
* versions it knows.
|
|
20
|
+
*/
|
|
21
|
+
declare const AI_TREE_SCHEMA_VERSIONS: readonly [1];
|
|
22
|
+
type SectionScaffold = 'stacked' | 'split' | 'overlay';
|
|
23
|
+
type AiBlockType = 'text' | 'button' | 'media' | 'media-list' | 'rating' | 'divider' | 'input' | 'section-header' | 'button-row' | 'card' | 'collection' | 'accordion' | 'form' | 'embed' | 'schedule-widget';
|
|
24
|
+
interface AiBlockNode {
|
|
25
|
+
type: AiBlockType;
|
|
26
|
+
span: number;
|
|
27
|
+
slots?: Record<string, unknown>;
|
|
28
|
+
children?: AiBlockNode[];
|
|
29
|
+
items?: Array<{
|
|
30
|
+
question: string;
|
|
31
|
+
answer: string;
|
|
32
|
+
}>;
|
|
33
|
+
animation?: {
|
|
34
|
+
effect: 'fade-in' | 'fade-in-up' | 'slide-in-left' | 'slide-in-right' | 'zoom-in';
|
|
35
|
+
trigger: 'on-scroll' | 'on-load' | 'on-hover';
|
|
36
|
+
duration: 'fast' | 'normal' | 'slow';
|
|
37
|
+
stagger?: boolean;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
interface AiSectionSettings {
|
|
41
|
+
spacing?: 'tight' | 'balanced' | 'airy';
|
|
42
|
+
alignment?: 'left' | 'center';
|
|
43
|
+
ratio?: '1:1' | '5:3' | '3:5';
|
|
44
|
+
verticalPosition?: 'top' | 'center';
|
|
45
|
+
overlayIntensity?: 'low' | 'medium' | 'high';
|
|
46
|
+
backgroundMedia?: string;
|
|
47
|
+
}
|
|
48
|
+
interface AiLayoutTree {
|
|
49
|
+
schemaVersion: number;
|
|
50
|
+
type: 'section';
|
|
51
|
+
scaffold: SectionScaffold;
|
|
52
|
+
tag?: string;
|
|
53
|
+
settings?: AiSectionSettings;
|
|
54
|
+
rows: Array<{
|
|
55
|
+
blocks: AiBlockNode[];
|
|
56
|
+
}>;
|
|
57
|
+
}
|
|
58
|
+
/** The site brand kit the renderer styles from (editor Brand settings). */
|
|
59
|
+
interface AiBrandKit {
|
|
60
|
+
palette: {
|
|
61
|
+
dark: string;
|
|
62
|
+
primary: string;
|
|
63
|
+
accent: string;
|
|
64
|
+
light: string;
|
|
65
|
+
};
|
|
66
|
+
fonts: {
|
|
67
|
+
heading: string;
|
|
68
|
+
body: string;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** Section System defaults — used when a site has no brand kit override. */
|
|
72
|
+
declare const AI_DEFAULT_BRAND: AiBrandKit;
|
|
73
|
+
/** Design tokens from the Section System Blocks page (px unless noted). */
|
|
74
|
+
declare const AI_TREE_TOKENS: {
|
|
75
|
+
readonly textPrimaryForeground: "#FAFAF9";
|
|
76
|
+
readonly spacing2: 8;
|
|
77
|
+
readonly spacing3: 12;
|
|
78
|
+
readonly spacing4: 16;
|
|
79
|
+
readonly spacing6: 24;
|
|
80
|
+
readonly spacing8: 32;
|
|
81
|
+
readonly paddingBlock: 32;
|
|
82
|
+
readonly radiusButton: 10;
|
|
83
|
+
readonly radiusCard: 18;
|
|
84
|
+
readonly sectionMaxWidth: 1280;
|
|
85
|
+
readonly sectionPadding: {
|
|
86
|
+
readonly tight: 40;
|
|
87
|
+
readonly balanced: 64;
|
|
88
|
+
readonly airy: 96;
|
|
89
|
+
};
|
|
90
|
+
readonly type: {
|
|
91
|
+
readonly display: {
|
|
92
|
+
readonly size: 56;
|
|
93
|
+
readonly line: 1.1;
|
|
94
|
+
readonly weight: 700;
|
|
95
|
+
};
|
|
96
|
+
readonly h2: {
|
|
97
|
+
readonly size: 40;
|
|
98
|
+
readonly line: 1.15;
|
|
99
|
+
readonly weight: 700;
|
|
100
|
+
};
|
|
101
|
+
readonly h3: {
|
|
102
|
+
readonly size: 24;
|
|
103
|
+
readonly line: 1.3;
|
|
104
|
+
readonly weight: 700;
|
|
105
|
+
};
|
|
106
|
+
readonly bodyL: {
|
|
107
|
+
readonly size: 18;
|
|
108
|
+
readonly line: 1.45;
|
|
109
|
+
readonly weight: 400;
|
|
110
|
+
};
|
|
111
|
+
readonly bodyM: {
|
|
112
|
+
readonly size: 16;
|
|
113
|
+
readonly line: 1.5;
|
|
114
|
+
readonly weight: 400;
|
|
115
|
+
};
|
|
116
|
+
readonly bodyMBold: {
|
|
117
|
+
readonly size: 16;
|
|
118
|
+
readonly line: 1.5;
|
|
119
|
+
readonly weight: 700;
|
|
120
|
+
};
|
|
121
|
+
readonly eyebrow: {
|
|
122
|
+
readonly size: 14;
|
|
123
|
+
readonly line: 1.5;
|
|
124
|
+
readonly weight: 500;
|
|
125
|
+
};
|
|
126
|
+
readonly button: {
|
|
127
|
+
readonly size: 16;
|
|
128
|
+
readonly line: 1.5;
|
|
129
|
+
readonly weight: 500;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
declare function isRenderableTree(value: unknown): value is AiLayoutTree;
|
|
134
|
+
|
|
135
|
+
interface AiTreeRendererProps {
|
|
136
|
+
tree: AiLayoutTree;
|
|
137
|
+
brand?: AiBrandKit;
|
|
138
|
+
/** Resolves a media ref to a URL; null renders a placeholder. */
|
|
139
|
+
resolveMedia?: (ref: string) => string | null;
|
|
140
|
+
/**
|
|
141
|
+
* When set (e.g. `ai.<sectionId>`), text and media elements emit
|
|
142
|
+
* `data-ohw-key="<prefix>.<path>"` + `data-ohw-editable` markers, making
|
|
143
|
+
* generated sections click-to-edit and AI-editable like template sections.
|
|
144
|
+
*/
|
|
145
|
+
editKeyPrefix?: string;
|
|
146
|
+
}
|
|
147
|
+
declare function AiTreeRenderer({ tree, brand, resolveMedia, editKeyPrefix }: AiTreeRendererProps): react_jsx_runtime.JSX.Element | null;
|
|
148
|
+
|
|
10
149
|
type LinkPage = {
|
|
11
150
|
path: string;
|
|
12
151
|
title: string;
|
|
@@ -285,4 +424,4 @@ declare function useOhwCarousel(key: string, initial: CarouselSlide[]): {
|
|
|
285
424
|
bind: Record<string, string>;
|
|
286
425
|
};
|
|
287
426
|
|
|
288
|
-
export { type CarouselSlide, CustomToolbar, CustomToolbarButton, CustomToolbarDivider, DragHandle, DropIndicator, type DropIndicatorProps, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, ItemActionToolbar, type ItemActionToolbarProps, ItemInteractionLayer, type ItemInteractionLayerProps, type ItemInteractionState, LinkEditorPanel, type LinkModalMode, type LinkModalProps, type LinkPage, LinkPopover, type LinkSection, OhhwellsBridge, SchedulingWidget, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buildTarget, dropIndicatorVariants, filterAvailablePages, getEditModeInitialState, isEditSessionActive, isValidUrl, parseTarget, toggleVariants, useOhwCarousel, validateUrlInput };
|
|
427
|
+
export { AI_DEFAULT_BRAND, AI_TREE_SCHEMA_VERSIONS, AI_TREE_TOKENS, type AiBlockNode, type AiBrandKit, type AiLayoutTree, AiTreeRenderer, type AiTreeRendererProps, type CarouselSlide, CustomToolbar, CustomToolbarButton, CustomToolbarDivider, DragHandle, DropIndicator, type DropIndicatorProps, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, ItemActionToolbar, type ItemActionToolbarProps, ItemInteractionLayer, type ItemInteractionLayerProps, type ItemInteractionState, LinkEditorPanel, type LinkModalMode, type LinkModalProps, type LinkPage, LinkPopover, type LinkSection, OhhwellsBridge, SchedulingWidget, type SectionScaffold, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buildTarget, dropIndicatorVariants, filterAvailablePages, getEditModeInitialState, isEditSessionActive, isRenderableTree, isValidUrl, parseTarget, toggleVariants, useOhwCarousel, validateUrlInput };
|