@ohhwells/bridge 0.1.158 → 0.1.160-next.427
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 +1 -1
- package/dist/index.cjs +1134 -722
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -1
- package/dist/index.d.ts +58 -1
- package/dist/index.js +1171 -743
- package/dist/index.js.map +1 -1
- package/dist/pages.cjs +9 -1
- package/dist/pages.cjs.map +1 -1
- package/dist/pages.d.cts +2 -0
- package/dist/pages.d.ts +2 -0
- package/dist/pages.js +9 -1
- package/dist/pages.js.map +1 -1
- package/dist/styles.css +116 -0
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -348,6 +348,51 @@ interface AiFooterRendererProps {
|
|
|
348
348
|
*/
|
|
349
349
|
declare function AiFooterRenderer({ tree, brand, resolveMedia, editKeyPrefix, logoUrl, resolvePageHref, legal, surface, }: AiFooterRendererProps): react_jsx_runtime.JSX.Element | null;
|
|
350
350
|
|
|
351
|
+
/**
|
|
352
|
+
* Relative headline sizing: "make the section heading bigger" as a MULTIPLIER on whatever the
|
|
353
|
+
* template already renders, not an absolute px token.
|
|
354
|
+
*
|
|
355
|
+
* Why this exists. The original `headlineScale` prop is an absolute 4-token px scale (md 24 / lg 32
|
|
356
|
+
* / xl 40 / display 56) painted by a stylesheet rule. Measuring two real templates at 1440px found
|
|
357
|
+
* 12 of 13 section headings rendering ABOVE the top of that scale (rebound: 148, 64, 72, 84;
|
|
358
|
+
* haven-realty: 86, 58, 48, 64, 58 x5), so every token the model could pick, `display` included,
|
|
359
|
+
* made the heading SMALLER. That is the bug users hit: "make it bigger" visibly shrank the heading.
|
|
360
|
+
*
|
|
361
|
+
* Why a multiplier rather than more tokens. The same headings render 30-56px at 390px wide, i.e.
|
|
362
|
+
* the templates have a working responsive type scale. Any absolute px override freezes one width's
|
|
363
|
+
* value at every width: a `96px` token chosen to beat a 1440px heading would still be 96px on a
|
|
364
|
+
* phone where the template wanted 36px. A multiplier rides the template's own scale instead, so it
|
|
365
|
+
* is correct at every breakpoint by construction.
|
|
366
|
+
*
|
|
367
|
+
* Why this is runtime JS and not CSS. CSS cannot multiply an element's OWN font-size: `em` and `%`
|
|
368
|
+
* both resolve against the PARENT's size, so `font-size: calc(1em * 1.2)` on an <h1> throws away
|
|
369
|
+
* the template's h1 sizing rather than scaling it. The only way to scale what the element actually
|
|
370
|
+
* renders is to read it and write it back, which is what this module does, re-measuring on resize
|
|
371
|
+
* so a breakpoint change re-reads the template's new base.
|
|
372
|
+
*/
|
|
373
|
+
/** Multiplier per token. `base` is the template's own size, which is also the reset target. */
|
|
374
|
+
declare const HEADLINE_SIZE_MULTIPLIERS: Record<string, number>;
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Per-section and per-node style overrides. The backend's update_style verb (and, later, toolbar
|
|
378
|
+
* UI) produces a delta {target, changed}; the editor merges it onto one reserved node,
|
|
379
|
+
* `__ohw_styles`, and hands the whole store to the bridge. The bridge applies it to the DOM:
|
|
380
|
+
*
|
|
381
|
+
* - Section props are written as `data-ohw-style-*` attributes on the `[data-ohw-section]` element
|
|
382
|
+
* plus one injected stylesheet of attribute-scoped rules. The rules are best-effort by design —
|
|
383
|
+
* they nudge presentation (background band, vertical distribution, headline scale, image fit,
|
|
384
|
+
* spacing) and a template whose structure doesn't tolerate one simply keeps its current look.
|
|
385
|
+
* - Node props (text colour/size, button colours) are written inline on every element carrying the
|
|
386
|
+
* node's `data-ohw-key`, which covers native template nodes and generated-section slots alike.
|
|
387
|
+
*
|
|
388
|
+
* Application is idempotent: each pass clears what it wrote before (tracked via the attributes and
|
|
389
|
+
* a wrote-marker) and re-applies from the store, so removing an override restores the original look
|
|
390
|
+
* and re-rendered generated sections just need a re-apply.
|
|
391
|
+
*
|
|
392
|
+
* The store shape, the node key, and the enums are a contract with the backend
|
|
393
|
+
* (`app/helpers/style-update.ts`) and the editor (which persists/undoes the node).
|
|
394
|
+
*/
|
|
395
|
+
|
|
351
396
|
declare const SECTION_BACKGROUNDS: readonly ["default", "surface", "accent", "accent-soft"];
|
|
352
397
|
declare const TEXT_DISTRIBUTIONS: readonly ["top", "center", "space-between"];
|
|
353
398
|
declare const HEADLINE_SCALES: readonly ["md", "lg", "xl", "display"];
|
|
@@ -369,8 +414,20 @@ interface SectionStyleOverride {
|
|
|
369
414
|
fontFamily?: string;
|
|
370
415
|
/** Section-wide heading colour — painted onto the section's h1-h6 editables, over textColor. */
|
|
371
416
|
headingColor?: string;
|
|
417
|
+
/** Section-wide ICON colour (OHH-875) — the glyphs in the section's icon slots, which are
|
|
418
|
+
* neither headings nor body text, so neither textColor nor headingColor could ever reach them.
|
|
419
|
+
* Painted as `color` on each `[data-ohw-editable="icon"]`, which a glyph drawn with
|
|
420
|
+
* stroke/fill="currentColor" (lucide and every set like it) follows. Best-effort, like every
|
|
421
|
+
* other section prop: a glyph with a hardcoded colour of its own keeps it. */
|
|
422
|
+
iconColor?: string;
|
|
372
423
|
textDistribution?: (typeof TEXT_DISTRIBUTIONS)[number];
|
|
424
|
+
/** @deprecated Absolute px headline tokens. Still rendered for stores saved before the switch,
|
|
425
|
+
* but nothing writes it any more: it could only ever name a size BELOW what most templates
|
|
426
|
+
* render, so "bigger" shrank the heading. New edits use `headlineSize`. */
|
|
373
427
|
headlineScale?: (typeof HEADLINE_SCALES)[number];
|
|
428
|
+
/** Headline size as a multiplier on the template's own size (`base` = untouched). Relative on
|
|
429
|
+
* purpose, and applied by measuring rather than by a CSS rule — see lib/headline-size.ts. */
|
|
430
|
+
headlineSize?: keyof typeof HEADLINE_SIZE_MULTIPLIERS;
|
|
374
431
|
imageAspect?: string;
|
|
375
432
|
/** @deprecated OHH-789 folds this into verticalPadding — a store saved before the fold may
|
|
376
433
|
* still carry it; legacyVerticalPaddingAlias resolves it at apply time. */
|
|
@@ -666,7 +723,7 @@ declare function filterAvailablePages(pages: LinkPage[], existingTargets: string
|
|
|
666
723
|
|
|
667
724
|
declare const toggleVariants: (props?: ({
|
|
668
725
|
variant?: "default" | "outline" | null | undefined;
|
|
669
|
-
size?: "default" | "
|
|
726
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
670
727
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
671
728
|
declare function Toggle({ className, variant, size, ...props }: React.ComponentProps<typeof Toggle$1.Root> & VariantProps<typeof toggleVariants>): react_jsx_runtime.JSX.Element;
|
|
672
729
|
|
package/dist/index.d.ts
CHANGED
|
@@ -348,6 +348,51 @@ interface AiFooterRendererProps {
|
|
|
348
348
|
*/
|
|
349
349
|
declare function AiFooterRenderer({ tree, brand, resolveMedia, editKeyPrefix, logoUrl, resolvePageHref, legal, surface, }: AiFooterRendererProps): react_jsx_runtime.JSX.Element | null;
|
|
350
350
|
|
|
351
|
+
/**
|
|
352
|
+
* Relative headline sizing: "make the section heading bigger" as a MULTIPLIER on whatever the
|
|
353
|
+
* template already renders, not an absolute px token.
|
|
354
|
+
*
|
|
355
|
+
* Why this exists. The original `headlineScale` prop is an absolute 4-token px scale (md 24 / lg 32
|
|
356
|
+
* / xl 40 / display 56) painted by a stylesheet rule. Measuring two real templates at 1440px found
|
|
357
|
+
* 12 of 13 section headings rendering ABOVE the top of that scale (rebound: 148, 64, 72, 84;
|
|
358
|
+
* haven-realty: 86, 58, 48, 64, 58 x5), so every token the model could pick, `display` included,
|
|
359
|
+
* made the heading SMALLER. That is the bug users hit: "make it bigger" visibly shrank the heading.
|
|
360
|
+
*
|
|
361
|
+
* Why a multiplier rather than more tokens. The same headings render 30-56px at 390px wide, i.e.
|
|
362
|
+
* the templates have a working responsive type scale. Any absolute px override freezes one width's
|
|
363
|
+
* value at every width: a `96px` token chosen to beat a 1440px heading would still be 96px on a
|
|
364
|
+
* phone where the template wanted 36px. A multiplier rides the template's own scale instead, so it
|
|
365
|
+
* is correct at every breakpoint by construction.
|
|
366
|
+
*
|
|
367
|
+
* Why this is runtime JS and not CSS. CSS cannot multiply an element's OWN font-size: `em` and `%`
|
|
368
|
+
* both resolve against the PARENT's size, so `font-size: calc(1em * 1.2)` on an <h1> throws away
|
|
369
|
+
* the template's h1 sizing rather than scaling it. The only way to scale what the element actually
|
|
370
|
+
* renders is to read it and write it back, which is what this module does, re-measuring on resize
|
|
371
|
+
* so a breakpoint change re-reads the template's new base.
|
|
372
|
+
*/
|
|
373
|
+
/** Multiplier per token. `base` is the template's own size, which is also the reset target. */
|
|
374
|
+
declare const HEADLINE_SIZE_MULTIPLIERS: Record<string, number>;
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Per-section and per-node style overrides. The backend's update_style verb (and, later, toolbar
|
|
378
|
+
* UI) produces a delta {target, changed}; the editor merges it onto one reserved node,
|
|
379
|
+
* `__ohw_styles`, and hands the whole store to the bridge. The bridge applies it to the DOM:
|
|
380
|
+
*
|
|
381
|
+
* - Section props are written as `data-ohw-style-*` attributes on the `[data-ohw-section]` element
|
|
382
|
+
* plus one injected stylesheet of attribute-scoped rules. The rules are best-effort by design —
|
|
383
|
+
* they nudge presentation (background band, vertical distribution, headline scale, image fit,
|
|
384
|
+
* spacing) and a template whose structure doesn't tolerate one simply keeps its current look.
|
|
385
|
+
* - Node props (text colour/size, button colours) are written inline on every element carrying the
|
|
386
|
+
* node's `data-ohw-key`, which covers native template nodes and generated-section slots alike.
|
|
387
|
+
*
|
|
388
|
+
* Application is idempotent: each pass clears what it wrote before (tracked via the attributes and
|
|
389
|
+
* a wrote-marker) and re-applies from the store, so removing an override restores the original look
|
|
390
|
+
* and re-rendered generated sections just need a re-apply.
|
|
391
|
+
*
|
|
392
|
+
* The store shape, the node key, and the enums are a contract with the backend
|
|
393
|
+
* (`app/helpers/style-update.ts`) and the editor (which persists/undoes the node).
|
|
394
|
+
*/
|
|
395
|
+
|
|
351
396
|
declare const SECTION_BACKGROUNDS: readonly ["default", "surface", "accent", "accent-soft"];
|
|
352
397
|
declare const TEXT_DISTRIBUTIONS: readonly ["top", "center", "space-between"];
|
|
353
398
|
declare const HEADLINE_SCALES: readonly ["md", "lg", "xl", "display"];
|
|
@@ -369,8 +414,20 @@ interface SectionStyleOverride {
|
|
|
369
414
|
fontFamily?: string;
|
|
370
415
|
/** Section-wide heading colour — painted onto the section's h1-h6 editables, over textColor. */
|
|
371
416
|
headingColor?: string;
|
|
417
|
+
/** Section-wide ICON colour (OHH-875) — the glyphs in the section's icon slots, which are
|
|
418
|
+
* neither headings nor body text, so neither textColor nor headingColor could ever reach them.
|
|
419
|
+
* Painted as `color` on each `[data-ohw-editable="icon"]`, which a glyph drawn with
|
|
420
|
+
* stroke/fill="currentColor" (lucide and every set like it) follows. Best-effort, like every
|
|
421
|
+
* other section prop: a glyph with a hardcoded colour of its own keeps it. */
|
|
422
|
+
iconColor?: string;
|
|
372
423
|
textDistribution?: (typeof TEXT_DISTRIBUTIONS)[number];
|
|
424
|
+
/** @deprecated Absolute px headline tokens. Still rendered for stores saved before the switch,
|
|
425
|
+
* but nothing writes it any more: it could only ever name a size BELOW what most templates
|
|
426
|
+
* render, so "bigger" shrank the heading. New edits use `headlineSize`. */
|
|
373
427
|
headlineScale?: (typeof HEADLINE_SCALES)[number];
|
|
428
|
+
/** Headline size as a multiplier on the template's own size (`base` = untouched). Relative on
|
|
429
|
+
* purpose, and applied by measuring rather than by a CSS rule — see lib/headline-size.ts. */
|
|
430
|
+
headlineSize?: keyof typeof HEADLINE_SIZE_MULTIPLIERS;
|
|
374
431
|
imageAspect?: string;
|
|
375
432
|
/** @deprecated OHH-789 folds this into verticalPadding — a store saved before the fold may
|
|
376
433
|
* still carry it; legacyVerticalPaddingAlias resolves it at apply time. */
|
|
@@ -666,7 +723,7 @@ declare function filterAvailablePages(pages: LinkPage[], existingTargets: string
|
|
|
666
723
|
|
|
667
724
|
declare const toggleVariants: (props?: ({
|
|
668
725
|
variant?: "default" | "outline" | null | undefined;
|
|
669
|
-
size?: "default" | "
|
|
726
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
670
727
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
671
728
|
declare function Toggle({ className, variant, size, ...props }: React.ComponentProps<typeof Toggle$1.Root> & VariantProps<typeof toggleVariants>): react_jsx_runtime.JSX.Element;
|
|
672
729
|
|