@ohhwells/bridge 0.1.174 → 0.1.176
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 +12210 -11999
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +229 -106
- package/dist/index.d.ts +229 -106
- package/dist/index.js +12193 -11999
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1017,6 +1017,174 @@ declare const SITE_OG_IMAGE_KEY = "__ohw_og_image";
|
|
|
1017
1017
|
*/
|
|
1018
1018
|
declare function applyBrandChrome(content: Record<string, string>): void;
|
|
1019
1019
|
|
|
1020
|
+
/**
|
|
1021
|
+
* Background tone signal (OHH-640 colour, OHH-824 image). Every background context on the page
|
|
1022
|
+
* gets `data-ohw-tone="light" | "dark"`: each `[data-ohw-section]`, every element whose background
|
|
1023
|
+
* the editor set, and every nested opaque surface (card, filled panel, badge) big enough to carry
|
|
1024
|
+
* text. The nearest `[data-ohw-tone]` ancestor of an element is the background it sits on, so
|
|
1025
|
+
* `toneFor(el)` and CSS like `[data-ohw-tone="dark"] .x` both read it per context.
|
|
1026
|
+
*
|
|
1027
|
+
* Colour comes from the computed style, so brand tokens, tone presets, custom colours and template
|
|
1028
|
+
* CSS all resolve through the browser with no per-source code; translucent layers are composited up
|
|
1029
|
+
* the ancestor chain over a white page. An image that covers at least 80% of a section is sampled on
|
|
1030
|
+
* a canvas over the area behind the section's text (whole visible image when there is none), with
|
|
1031
|
+
* overlays and gradient fades composited on top. Sampling failure of any kind reads as Light.
|
|
1032
|
+
*
|
|
1033
|
+
* One consumer ships with it: on backgrounds the editor set (`data-ohw-style-bg` tone presets and
|
|
1034
|
+
* custom `data-ohw-style-bgcolor` colours) a text editable whose colour has the same tone as the
|
|
1035
|
+
* background gets `data-ohw-tone-fix`, which the section stylesheet turns into the
|
|
1036
|
+
* brand light or dark text colour. Template-designed sections are never repainted, and an explicit
|
|
1037
|
+
* text colour from the editor (inline `!important`) still wins.
|
|
1038
|
+
*
|
|
1039
|
+
* The second consumer is CTA buttons, on any background: a label with the same tone as the button's
|
|
1040
|
+
* own fill, and an icon with the same tone as the chip right behind it, get `data-ohw-tone-fix` too
|
|
1041
|
+
* (rules mounted by this module). Colours the user picked for a button are never overridden.
|
|
1042
|
+
*/
|
|
1043
|
+
type Tone = 'light' | 'dark';
|
|
1044
|
+
type Rgba = {
|
|
1045
|
+
r: number;
|
|
1046
|
+
g: number;
|
|
1047
|
+
b: number;
|
|
1048
|
+
a: number;
|
|
1049
|
+
};
|
|
1050
|
+
/** Same split as the old editor's getBackgroundTone: luminance at or above it reads Light. */
|
|
1051
|
+
declare const TONE_THRESHOLD = 0.5;
|
|
1052
|
+
declare const TONE_ATTR = "data-ohw-tone";
|
|
1053
|
+
declare const TONE_FIX_ATTR = "data-ohw-tone-fix";
|
|
1054
|
+
declare const TONE_CHANGE_EVENT = "ohw:tone-change";
|
|
1055
|
+
/**
|
|
1056
|
+
* Parses what `getComputedStyle` hands back for a colour: `rgb()/rgba()` (legacy and space syntax),
|
|
1057
|
+
* `color(srgb ...)` (Chrome's form for `color-mix(in srgb, ...)`), `oklch()` and `oklab()`
|
|
1058
|
+
* (Tailwind v4 palettes), hex and `transparent`. Null for anything else.
|
|
1059
|
+
*/
|
|
1060
|
+
declare function parseCssColor(input: string | null | undefined): Rgba | null;
|
|
1061
|
+
/** Porter-Duff "over": `fg` painted on top of `bg`. */
|
|
1062
|
+
declare function compositeColor(fg: Rgba, bg: Rgba): Rgba;
|
|
1063
|
+
/** WCAG relative luminance of an sRGB colour (0..255 channels). Alpha is ignored. */
|
|
1064
|
+
declare function relativeLuminanceOf(color: Rgba): number;
|
|
1065
|
+
declare function toneOfLuminance(luminance: number): Tone;
|
|
1066
|
+
declare function toneOfColor(color: Rgba): Tone;
|
|
1067
|
+
declare function contrastRatioOf(a: Rgba, b: Rgba): number;
|
|
1068
|
+
/** Splits a comma list at the top level only (commas inside `rgb(...)` stay put). */
|
|
1069
|
+
declare function splitTopLevel(value: string): string[];
|
|
1070
|
+
/** The colour stops of one gradient layer, in order. */
|
|
1071
|
+
declare function gradientStopColors(layer: string): Rgba[];
|
|
1072
|
+
/**
|
|
1073
|
+
* A gradient painted over `behind`, read as one colour: each stop composited over what is behind it,
|
|
1074
|
+
* then averaged. A photo fade (`neutral-50` to `transparent`) lands halfway between the two, which is
|
|
1075
|
+
* what text in the middle of that band actually sits on.
|
|
1076
|
+
*/
|
|
1077
|
+
declare function compositeGradient(stops: Rgba[], behind: Rgba): Rgba;
|
|
1078
|
+
type Box = {
|
|
1079
|
+
x: number;
|
|
1080
|
+
y: number;
|
|
1081
|
+
width: number;
|
|
1082
|
+
height: number;
|
|
1083
|
+
};
|
|
1084
|
+
/**
|
|
1085
|
+
* The colour of one linear-gradient layer at point (px, py) of a w x h box, or null for a gradient
|
|
1086
|
+
* this can't place (radial, conic, repeating), which callers read as the averaged layer.
|
|
1087
|
+
*/
|
|
1088
|
+
declare function linearGradientColourAt(layer: string, px: number, py: number, w: number, h: number): Rgba | null;
|
|
1089
|
+
/**
|
|
1090
|
+
* Where a box inside a painted element falls in the image's own pixels. `fit` is the CSS
|
|
1091
|
+
* `background-size` or `object-fit` keyword (or a "W H" pair of px/% sizes), `position` the matching
|
|
1092
|
+
* position pair. Returns null when the box misses the image entirely.
|
|
1093
|
+
*/
|
|
1094
|
+
declare function mapRegionToImage(region: Box, element: {
|
|
1095
|
+
width: number;
|
|
1096
|
+
height: number;
|
|
1097
|
+
}, image: {
|
|
1098
|
+
width: number;
|
|
1099
|
+
height: number;
|
|
1100
|
+
}, fit: string, position: string): Box | null;
|
|
1101
|
+
type StyleLike = Pick<CSSStyleDeclaration, 'backgroundColor' | 'backgroundImage' | 'backgroundSize' | 'backgroundPosition' | 'objectFit' | 'objectPosition' | 'opacity' | 'color' | 'display' | 'visibility'>;
|
|
1102
|
+
type ToneDeps = {
|
|
1103
|
+
style: (el: Element) => StyleLike;
|
|
1104
|
+
rect: (el: Element) => Box;
|
|
1105
|
+
/** Image average for a URL and region; 'loading' while it is not known yet, null on failure. */
|
|
1106
|
+
sample: (url: string, region: (img: {
|
|
1107
|
+
width: number;
|
|
1108
|
+
height: number;
|
|
1109
|
+
}) => Box | null, onReady: () => void) => Rgba | null | 'loading';
|
|
1110
|
+
/** Computed style of a ::before / ::after; optional (tests without pseudo scrims leave it out). */
|
|
1111
|
+
pseudo?: (el: Element, which: '::before' | '::after') => PseudoStyle | null;
|
|
1112
|
+
};
|
|
1113
|
+
type PseudoStyle = StyleLike & Pick<CSSStyleDeclaration, 'content' | 'position' | 'width' | 'height' | 'top' | 'left' | 'right' | 'bottom'>;
|
|
1114
|
+
/**
|
|
1115
|
+
* Recomputes tones. With `only`, just those top-level sections; otherwise every one on the page.
|
|
1116
|
+
* `deps` exists for tests; the browser defaults read computed style, layout and real images.
|
|
1117
|
+
*/
|
|
1118
|
+
declare function computeBackgroundTones(doc: Document, options?: {
|
|
1119
|
+
only?: Iterable<Element>;
|
|
1120
|
+
deps?: ToneDeps;
|
|
1121
|
+
onImageReady?: (section: Element) => void;
|
|
1122
|
+
}): void;
|
|
1123
|
+
/** The tone of the background `el` sits on: its nearest context, Light when none is known. */
|
|
1124
|
+
declare function toneFor(el: Element | null | undefined): Tone;
|
|
1125
|
+
/**
|
|
1126
|
+
* Starts the tone signal on this document and keeps it current: recomputes after style, class,
|
|
1127
|
+
* image and section changes (one pass per animation frame, only the sections touched), after any
|
|
1128
|
+
* change on <html> or <head> (brand vars, stylesheets: every section), on resize and when a sampled
|
|
1129
|
+
* image arrives. Returns the teardown.
|
|
1130
|
+
*/
|
|
1131
|
+
declare function mountBackgroundTone(doc?: Document): () => void;
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* Dark / light logo versions (OHH-528, under OHH-535).
|
|
1135
|
+
*
|
|
1136
|
+
* The owner can upload a version of their logo for dark backgrounds and one for light backgrounds.
|
|
1137
|
+
* Each logo root then shows the version for the tone it sits on (`data-ohw-tone`, OHH-640), and the
|
|
1138
|
+
* main logo wherever that tone has no version of its own.
|
|
1139
|
+
*
|
|
1140
|
+
* The main logo stays the stored truth: a save carries every node on the page, so a swapped version
|
|
1141
|
+
* read back off `img.src` would overwrite `nav-logo-image`. The main URL is kept on the image as
|
|
1142
|
+
* `data-ohw-logo-primary`, and everything that reads the logo back (the save collector, the Logo
|
|
1143
|
+
* panel's identity) reads that attribute first.
|
|
1144
|
+
*
|
|
1145
|
+
* Only the owner's own images are swapped: a template's seeded mark (`data-ohw-template-logo`) stays
|
|
1146
|
+
* what the template drew until the owner uploads a main logo.
|
|
1147
|
+
*/
|
|
1148
|
+
|
|
1149
|
+
/** Content keys. An empty value means "no version: use the main logo". */
|
|
1150
|
+
declare const LOGO_ON_DARK_KEY = "logo-image-on-dark";
|
|
1151
|
+
declare const LOGO_ON_LIGHT_KEY = "logo-image-on-light";
|
|
1152
|
+
/** The main logo URL, kept on an image while it shows a version. */
|
|
1153
|
+
declare const LOGO_PRIMARY_ATTR = "data-ohw-logo-primary";
|
|
1154
|
+
/** Which picture the image shows now: `primary`, `on-dark` or `on-light`. */
|
|
1155
|
+
declare const LOGO_VARIANT_ATTR = "data-ohw-logo-variant";
|
|
1156
|
+
type LogoVersions = {
|
|
1157
|
+
onDark: string | null;
|
|
1158
|
+
onLight: string | null;
|
|
1159
|
+
};
|
|
1160
|
+
declare function getLogoVersions(): LogoVersions;
|
|
1161
|
+
/** The URL a root on `tone` shows: its version when there is one, else the main logo. */
|
|
1162
|
+
declare function pickLogoUrl(tone: Tone, set: {
|
|
1163
|
+
primary: string;
|
|
1164
|
+
onDark: string | null;
|
|
1165
|
+
onLight: string | null;
|
|
1166
|
+
}): string;
|
|
1167
|
+
/** Re-picks every logo root on the page. */
|
|
1168
|
+
declare function repickLogos(doc?: Document): void;
|
|
1169
|
+
/** Sets the versions (null or '' = none) and re-picks every logo. */
|
|
1170
|
+
declare function setLogoVersions(next: Partial<LogoVersions>, doc?: Document): void;
|
|
1171
|
+
/** Reads the versions from site content when it carries them; returns whether it did. */
|
|
1172
|
+
declare function applyLogoVersionsFromContent(content: Record<string, string>, doc?: Document): boolean;
|
|
1173
|
+
/**
|
|
1174
|
+
* The versions an `ow:update-logo-identity` message carries: `imageOnDark` / `imageOnLight`, a URL
|
|
1175
|
+
* to set, null to remove, absent for unchanged. Applies them and returns the content nodes to save.
|
|
1176
|
+
*/
|
|
1177
|
+
declare function logoVersionNodesFromMessage(data: Record<string, unknown>): Array<{
|
|
1178
|
+
key: string;
|
|
1179
|
+
text: string;
|
|
1180
|
+
}>;
|
|
1181
|
+
/**
|
|
1182
|
+
* Keeps the picks current as tones change (a sticky nav going solid on scroll, a section
|
|
1183
|
+
* background edited, the photo under an overlaid nav arriving). Returns the teardown.
|
|
1184
|
+
*/
|
|
1185
|
+
declare function mountLogoTonePick(doc?: Document): () => void;
|
|
1186
|
+
|
|
1187
|
+
type LogoPlacement = 'navbar' | 'footer';
|
|
1020
1188
|
/**
|
|
1021
1189
|
* Marks an <img> that the TEMPLATE ships as its own brand mark — Re:Bound's wordmark PNG, salon's
|
|
1022
1190
|
* "Luxe Locks" lockup — as opposed to one this site's owner uploaded.
|
|
@@ -1046,6 +1214,44 @@ declare const TEMPLATE_LOGO_ATTR = "data-ohw-template-logo";
|
|
|
1046
1214
|
* src already on the element, an upload never does.
|
|
1047
1215
|
*/
|
|
1048
1216
|
declare function releaseTemplateLogoIfReplaced(img: HTMLImageElement, url: string): void;
|
|
1217
|
+
/**
|
|
1218
|
+
* Swap every logo root between uploaded image and text wordmark.
|
|
1219
|
+
* `url = null` removes the image and restores the wordmark.
|
|
1220
|
+
*
|
|
1221
|
+
* `placement` restricts the swap to just the navbar or just the footer root — HVAC-style
|
|
1222
|
+
* templates seed those two with genuinely different files (a light mark for the dark navbar,
|
|
1223
|
+
* a dark mark for the light footer), and a global apply would overwrite whichever one this
|
|
1224
|
+
* call didn't mean to touch (OHH-766).
|
|
1225
|
+
*/
|
|
1226
|
+
declare function applyLogoImage(url: string | null, alt: string, placement?: LogoPlacement): void;
|
|
1227
|
+
declare function readLogoIdentityFromDom(): {
|
|
1228
|
+
text: string;
|
|
1229
|
+
isPlaceholder: boolean;
|
|
1230
|
+
imageUrl: string | null;
|
|
1231
|
+
href: string;
|
|
1232
|
+
alt: string;
|
|
1233
|
+
imageOnDark: string | null;
|
|
1234
|
+
imageOnLight: string | null;
|
|
1235
|
+
};
|
|
1236
|
+
/**
|
|
1237
|
+
* Apply persisted logo fields from site content (edit hydrate + public fetch).
|
|
1238
|
+
* Shows uploaded image and hides the wordmark, or restores text when image is cleared.
|
|
1239
|
+
*/
|
|
1240
|
+
declare function applyLogoFromContent(content: Record<string, string>): boolean;
|
|
1241
|
+
|
|
1242
|
+
type EditableNode = {
|
|
1243
|
+
key: string;
|
|
1244
|
+
type: string;
|
|
1245
|
+
text: string;
|
|
1246
|
+
};
|
|
1247
|
+
/**
|
|
1248
|
+
* Collect all editable nodes for save/draft.
|
|
1249
|
+
* Order-based nav/footer deletes override remounted DOM so deleted keys are cleared.
|
|
1250
|
+
* With a scoped `root` (AI prompt section context), collects pure section content only:
|
|
1251
|
+
* page-global groups (structural order keys, video settings, carousels, delete overrides)
|
|
1252
|
+
* are skipped, since they only make sense for whole-document collection.
|
|
1253
|
+
*/
|
|
1254
|
+
declare function collectEditableNodes(extraContent?: Record<string, string>, root?: ParentNode): EditableNode[];
|
|
1049
1255
|
|
|
1050
1256
|
/**
|
|
1051
1257
|
* Telling a page's content mounting apart from incidental DOM churn, so the hydration pass can run
|
|
@@ -1238,116 +1444,33 @@ declare function useOhwCarousel(key: string, initial: CarouselSlide[]): {
|
|
|
1238
1444
|
};
|
|
1239
1445
|
|
|
1240
1446
|
/**
|
|
1241
|
-
*
|
|
1242
|
-
*
|
|
1243
|
-
*
|
|
1244
|
-
*
|
|
1245
|
-
*
|
|
1246
|
-
*
|
|
1247
|
-
*
|
|
1248
|
-
*
|
|
1249
|
-
*
|
|
1250
|
-
*
|
|
1251
|
-
* overlays and gradient fades composited on top. Sampling failure of any kind reads as Light.
|
|
1252
|
-
*
|
|
1253
|
-
* One consumer ships with it: on backgrounds the editor set (`data-ohw-style-bg` tone presets and
|
|
1254
|
-
* custom `data-ohw-style-bgcolor` colours) a text editable whose colour has the same tone as the
|
|
1255
|
-
* background gets `data-ohw-tone-fix`, which the section stylesheet turns into the
|
|
1256
|
-
* brand light or dark text colour. Template-designed sections are never repainted, and an explicit
|
|
1257
|
-
* text colour from the editor (inline `!important`) still wins.
|
|
1447
|
+
* Site-wide brand kit hydration. The backend resolves a brand change into one reserved node,
|
|
1448
|
+
* `__ohw_brand`, holding an AiBrandKit. The bridge intercepts that key and writes it as inline
|
|
1449
|
+
* custom properties on <html> — both the bridge's own `--ohw-brand-*` namespace (for generated
|
|
1450
|
+
* sections, which do reference it — see ai-tree) and the `--brand-*` BrandProvider contract every
|
|
1451
|
+
* template's own components actually render from (see LEGACY_BRAND_VAR_NAMES: no template maps
|
|
1452
|
+
* anything onto `--ohw-brand-*`, so writing only that namespace applied, undo-snapshotted, and
|
|
1453
|
+
* reported success while the live page never changed — OHH-766). An inline style beats the
|
|
1454
|
+
* template's own static `:root` block on specificity, so this restyles a live site with no
|
|
1455
|
+
* template rebuild; passing null removes every override and the template falls back to its own
|
|
1456
|
+
* `content/brand.ts` look.
|
|
1258
1457
|
*
|
|
1259
|
-
* The
|
|
1260
|
-
*
|
|
1261
|
-
* (rules mounted by this module). Colours the user picked for a button are never overridden.
|
|
1262
|
-
*/
|
|
1263
|
-
type Tone = 'light' | 'dark';
|
|
1264
|
-
type Rgba = {
|
|
1265
|
-
r: number;
|
|
1266
|
-
g: number;
|
|
1267
|
-
b: number;
|
|
1268
|
-
a: number;
|
|
1269
|
-
};
|
|
1270
|
-
/** Same split as the old editor's getBackgroundTone: luminance at or above it reads Light. */
|
|
1271
|
-
declare const TONE_THRESHOLD = 0.5;
|
|
1272
|
-
declare const TONE_ATTR = "data-ohw-tone";
|
|
1273
|
-
declare const TONE_FIX_ATTR = "data-ohw-tone-fix";
|
|
1274
|
-
declare const TONE_CHANGE_EVENT = "ohw:tone-change";
|
|
1275
|
-
/**
|
|
1276
|
-
* Parses what `getComputedStyle` hands back for a colour: `rgb()/rgba()` (legacy and space syntax),
|
|
1277
|
-
* `color(srgb ...)` (Chrome's form for `color-mix(in srgb, ...)`), `oklch()` and `oklab()`
|
|
1278
|
-
* (Tailwind v4 palettes), hex and `transparent`. Null for anything else.
|
|
1279
|
-
*/
|
|
1280
|
-
declare function parseCssColor(input: string | null | undefined): Rgba | null;
|
|
1281
|
-
/** Porter-Duff "over": `fg` painted on top of `bg`. */
|
|
1282
|
-
declare function compositeColor(fg: Rgba, bg: Rgba): Rgba;
|
|
1283
|
-
/** WCAG relative luminance of an sRGB colour (0..255 channels). Alpha is ignored. */
|
|
1284
|
-
declare function relativeLuminanceOf(color: Rgba): number;
|
|
1285
|
-
declare function toneOfLuminance(luminance: number): Tone;
|
|
1286
|
-
declare function toneOfColor(color: Rgba): Tone;
|
|
1287
|
-
declare function contrastRatioOf(a: Rgba, b: Rgba): number;
|
|
1288
|
-
/** Splits a comma list at the top level only (commas inside `rgb(...)` stay put). */
|
|
1289
|
-
declare function splitTopLevel(value: string): string[];
|
|
1290
|
-
/** The colour stops of one gradient layer, in order. */
|
|
1291
|
-
declare function gradientStopColors(layer: string): Rgba[];
|
|
1292
|
-
/**
|
|
1293
|
-
* A gradient painted over `behind`, read as one colour: each stop composited over what is behind it,
|
|
1294
|
-
* then averaged. A photo fade (`neutral-50` to `transparent`) lands halfway between the two, which is
|
|
1295
|
-
* what text in the middle of that band actually sits on.
|
|
1458
|
+
* The namespace and the key string are a contract shared with the backend (the update_brand write)
|
|
1459
|
+
* and the editor (which persists/undoes the node).
|
|
1296
1460
|
*/
|
|
1297
|
-
|
|
1298
|
-
type Box = {
|
|
1299
|
-
x: number;
|
|
1300
|
-
y: number;
|
|
1301
|
-
width: number;
|
|
1302
|
-
height: number;
|
|
1303
|
-
};
|
|
1304
|
-
/**
|
|
1305
|
-
* The colour of one linear-gradient layer at point (px, py) of a w x h box, or null for a gradient
|
|
1306
|
-
* this can't place (radial, conic, repeating), which callers read as the averaged layer.
|
|
1307
|
-
*/
|
|
1308
|
-
declare function linearGradientColourAt(layer: string, px: number, py: number, w: number, h: number): Rgba | null;
|
|
1309
|
-
/**
|
|
1310
|
-
* Where a box inside a painted element falls in the image's own pixels. `fit` is the CSS
|
|
1311
|
-
* `background-size` or `object-fit` keyword (or a "W H" pair of px/% sizes), `position` the matching
|
|
1312
|
-
* position pair. Returns null when the box misses the image entirely.
|
|
1313
|
-
*/
|
|
1314
|
-
declare function mapRegionToImage(region: Box, element: {
|
|
1315
|
-
width: number;
|
|
1316
|
-
height: number;
|
|
1317
|
-
}, image: {
|
|
1318
|
-
width: number;
|
|
1319
|
-
height: number;
|
|
1320
|
-
}, fit: string, position: string): Box | null;
|
|
1321
|
-
type StyleLike = Pick<CSSStyleDeclaration, 'backgroundColor' | 'backgroundImage' | 'backgroundSize' | 'backgroundPosition' | 'objectFit' | 'objectPosition' | 'opacity' | 'color' | 'display' | 'visibility'>;
|
|
1322
|
-
type ToneDeps = {
|
|
1323
|
-
style: (el: Element) => StyleLike;
|
|
1324
|
-
rect: (el: Element) => Box;
|
|
1325
|
-
/** Image average for a URL and region; 'loading' while it is not known yet, null on failure. */
|
|
1326
|
-
sample: (url: string, region: (img: {
|
|
1327
|
-
width: number;
|
|
1328
|
-
height: number;
|
|
1329
|
-
}) => Box | null, onReady: () => void) => Rgba | null | 'loading';
|
|
1330
|
-
/** Computed style of a ::before / ::after; optional (tests without pseudo scrims leave it out). */
|
|
1331
|
-
pseudo?: (el: Element, which: '::before' | '::after') => PseudoStyle | null;
|
|
1332
|
-
};
|
|
1333
|
-
type PseudoStyle = StyleLike & Pick<CSSStyleDeclaration, 'content' | 'position' | 'width' | 'height' | 'top' | 'left' | 'right' | 'bottom'>;
|
|
1461
|
+
|
|
1334
1462
|
/**
|
|
1335
|
-
*
|
|
1336
|
-
*
|
|
1463
|
+
* The colour override values, by role. `surface`, `border`, and `muted` are derived from the four
|
|
1464
|
+
* brand colours so a restyled site keeps its depth (raised surfaces, hairlines, muted text) rather
|
|
1465
|
+
* than collapsing to four flat colours.
|
|
1337
1466
|
*/
|
|
1338
|
-
declare function
|
|
1339
|
-
only?: Iterable<Element>;
|
|
1340
|
-
deps?: ToneDeps;
|
|
1341
|
-
onImageReady?: (section: Element) => void;
|
|
1342
|
-
}): void;
|
|
1343
|
-
/** The tone of the background `el` sits on: its nearest context, Light when none is known. */
|
|
1344
|
-
declare function toneFor(el: Element | null | undefined): Tone;
|
|
1467
|
+
declare function brandColorVars(palette: AiBrandKit['palette']): Record<string, string>;
|
|
1345
1468
|
/**
|
|
1346
|
-
*
|
|
1347
|
-
*
|
|
1348
|
-
*
|
|
1349
|
-
*
|
|
1469
|
+
* The brand colour text on Primary (or Accent) takes (OHH-640): Light or Dark, whichever has the higher
|
|
1470
|
+
* contrast against Primary, ties to Dark. The same comparison the contrast fix and the AI's
|
|
1471
|
+
* Primary bands use, so a pale Primary gets Dark text and a navy one Light. Unparseable values
|
|
1472
|
+
* keep the old Light default.
|
|
1350
1473
|
*/
|
|
1351
|
-
declare function
|
|
1474
|
+
declare function onPrimaryInk(primary: string, light: string, dark: string): string;
|
|
1352
1475
|
|
|
1353
|
-
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, TONE_ATTR, TONE_CHANGE_EVENT, TONE_FIX_ATTR, TONE_THRESHOLD, Toggle, ToggleGroup, ToggleGroupItem, type Tone, type ToneDeps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, addFooterLinkColumn, appendFooterSocial, applyBrandChrome, applyHiddenEditablesToDom, applyStickySearchParams, blockPathFromEditKey, buildDefaultFooterTree, buildTarget, canRemoveAiBlock, canRemoveAiTextBlock, canSoftHideEditable, compositeColor, compositeGradient, computeBackgroundTones, contrastRatioOf, dropIndicatorVariants, ensureFooterTree, filterAvailablePages, foldAlignIntoTrees, getEditModeInitialState, gradientStopColors, hasMountedContentNodes, indexCollectionItems, insertFooterHours, isDeadPageHref, isEditSessionActive, isEditableKeyHidden, isPlainLeftClick, isRenderableFooterTree, isRenderableTree, isStickySearchParam, isValidUrl, linearGradientColourAt, mapRegionToImage, matchCollectionItemClick, mountBackgroundTone, nextViableSlide, parseAiFooterState, parseAiSectionsState, parseCssColor, parseTarget, planAiBlockRemoval, planAiTextBlockRemoval, planBuildPageSync, readHiddenEditables, recordOverriddenPaths, relativeLuminanceOf, releaseTemplateLogoIfReplaced, removeBlockAtPath, removeFooterBlock, resetOverriddenPathsCache, resolveFooterCopyright, resolveSoftHideTarget, resolveStickyNavigation, serializeAiFooterState, shouldFetchContentForPath, softHideEditableInDom, softUnhideEditableInDom, splitTopLevel, stepViableSlide, stripPlaceholderText, stripPlaceholders, stripTextAlignCss, toggleVariants, toneFor, toneOfColor, toneOfLuminance, useOhwCarousel, validateUrlInput, viableSlides, withHiddenEditable, withoutHiddenEditable };
|
|
1476
|
+
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, LOGO_ON_DARK_KEY, LOGO_ON_LIGHT_KEY, LOGO_PRIMARY_ATTR, LOGO_VARIANT_ATTR, 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, addFooterLinkColumn, appendFooterSocial, applyBrandChrome, applyHiddenEditablesToDom, applyLogoFromContent, applyLogoImage, applyLogoVersionsFromContent, applyStickySearchParams, blockPathFromEditKey, brandColorVars, buildDefaultFooterTree, buildTarget, canRemoveAiBlock, canRemoveAiTextBlock, canSoftHideEditable, collectEditableNodes, compositeColor, compositeGradient, computeBackgroundTones, contrastRatioOf, dropIndicatorVariants, ensureFooterTree, filterAvailablePages, foldAlignIntoTrees, getEditModeInitialState, getLogoVersions, gradientStopColors, hasMountedContentNodes, indexCollectionItems, insertFooterHours, isDeadPageHref, isEditSessionActive, isEditableKeyHidden, isPlainLeftClick, isRenderableFooterTree, isRenderableTree, isStickySearchParam, isValidUrl, linearGradientColourAt, logoVersionNodesFromMessage, mapRegionToImage, matchCollectionItemClick, mountBackgroundTone, mountLogoTonePick, nextViableSlide, onPrimaryInk, parseAiFooterState, parseAiSectionsState, parseCssColor, parseTarget, pickLogoUrl, planAiBlockRemoval, planAiTextBlockRemoval, planBuildPageSync, readHiddenEditables, readLogoIdentityFromDom, recordOverriddenPaths, relativeLuminanceOf, releaseTemplateLogoIfReplaced, removeBlockAtPath, removeFooterBlock, repickLogos, resetOverriddenPathsCache, resolveFooterCopyright, resolveSoftHideTarget, resolveStickyNavigation, serializeAiFooterState, setLogoVersions, shouldFetchContentForPath, softHideEditableInDom, softUnhideEditableInDom, splitTopLevel, stepViableSlide, stripPlaceholderText, stripPlaceholders, stripTextAlignCss, toggleVariants, toneFor, toneOfColor, toneOfLuminance, useOhwCarousel, validateUrlInput, viableSlides, withHiddenEditable, withoutHiddenEditable };
|