@mccaskie-labs/workbench-site 0.15.3 → 0.16.0

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.
@@ -0,0 +1,173 @@
1
+ // The hero designs' rules (docs/hero-and-images.md §5): part of SITE_STYLES.
2
+ // Phones first: each class's own rules and states draw a phone, its `wide`
3
+ // rules take over from 600px, and its `moving` rules play only on a device
4
+ // that hasn't asked for less motion. Every design hangs off data-* attributes
5
+ // on .wb-site-hero-designed, so a project restyles any of it in project.css.
6
+ const v = (name) => `var(--wb-site-${name})`;
7
+ const H = v("hero-height");
8
+ const SPACE = v("space");
9
+ const S = v("hero-shade");
10
+ const PHONE_PICTURE = "clamp(14rem, 50svh, 24rem)";
11
+ /** Two-column designs: words beside the picture from 600px. */
12
+ const TWO = `[data-over="no"]:not([data-design="panorama"]):not([data-design="words-only"])`;
13
+ export const HERO_VARIABLES = [
14
+ { name: "--wb-site-hero-height", value: "clamp(24rem, 72svh, 44rem)", about: "The hero's height (set by Height: short, medium, tall, full screen, or an exact height)" },
15
+ { name: "--wb-site-hero-focal", value: "50% 50%", about: "The point of the picture that always shows (the focal point)" },
16
+ { name: "--wb-site-hero-phone-focal", value: "50% 50%", about: "The point of the picture that always shows on phones" },
17
+ { name: "--wb-site-hero-zoom", value: "1", about: "How far the picture is zoomed in, 1 to 1.5" },
18
+ { name: "--wb-site-hero-shade", value: "rgb(0 0 0 / .45)", about: "The shade over the picture that makes words easier to read" },
19
+ { name: "--wb-site-hero-ink", value: "var(--wb-site-text)", about: "The hero's words' colour (white over a dark shade)" },
20
+ { name: "--wb-site-hero-on-picture", value: "#ffffff", about: "Words over a dark or brand-coloured shade" },
21
+ ];
22
+ const height = (h, value) => ({ selector: `[data-height="${h}"]`, about: `Height: ${h}`, css: `--wb-site-hero-height:${value}` });
23
+ const shade = (strength, colour, value, ink) => ({
24
+ selector: `[data-shade="${strength}"][data-shade-colour="${colour}"]`,
25
+ about: `A ${strength} ${colour} shade`,
26
+ css: `--wb-site-hero-shade:${value};--wb-site-hero-ink:${ink}`,
27
+ });
28
+ const place = (row, align) => ({ selector: `[data-place^="${row}"] .wb-site-hero-words`, about: `Words at the ${row}`, css: `align-self:${align}` });
29
+ /** The hero section and its parts. */
30
+ export const HERO_CLASSES = [
31
+ {
32
+ name: "wb-site-hero-designed",
33
+ element: "section",
34
+ about: "The top of a page in one of the hero designs (data-design and the other data-* settings)",
35
+ css: `position:relative;isolation:isolate;box-sizing:border-box;display:grid;grid-template-columns:minmax(0,1fr);gap:calc(${SPACE} * 1.5);margin:0 0 ${v("section-space")};padding:calc(${SPACE} * 2) 0;color:${v("text")}`,
36
+ states: [
37
+ height("short", "clamp(16rem, 42svh, 26rem)"),
38
+ height("medium", "clamp(20rem, 56svh, 34rem)"),
39
+ height("tall", "clamp(24rem, 72svh, 44rem)"),
40
+ height("full", "max(28rem, calc(100svh - 4.5rem))"),
41
+ { selector: `[data-width="edge"]`, about: "Edge to edge: the hero runs the screen's full width, its words still in line with the page", css: `width:100vw;margin-left:calc(50% - 50vw);margin-right:calc(50% - 50vw);padding-left:max(${SPACE}, calc((100vw - ${v("width")}) / 2));padding-right:max(${SPACE}, calc((100vw - ${v("width")}) / 2))` },
42
+ // Words over a picture.
43
+ { selector: `[data-over="yes"]`, about: "Words over the picture", css: `min-height:${H};padding-top:calc(${SPACE} * 2);padding-bottom:calc(${SPACE} * 2);overflow:hidden;border-radius:${v("radius")}` },
44
+ { selector: `[data-over="yes"][data-width="page"]`, about: "Words over the picture, page width: space at the sides", css: `padding-left:calc(${SPACE} * 1.5);padding-right:calc(${SPACE} * 1.5)` },
45
+ { selector: `[data-over="yes"][data-width="edge"]`, about: "Edge to edge: square corners", css: "border-radius:0" },
46
+ { selector: `[data-over="yes"] .wb-site-hero-media`, about: "The picture behind the words", css: "position:absolute;inset:0;z-index:-1;border-radius:0" },
47
+ shade("soft", "dark", "rgb(0 0 0 / .45)", v("hero-on-picture")),
48
+ shade("strong", "dark", "rgb(0 0 0 / .7)", v("hero-on-picture")),
49
+ shade("soft", "light", "rgb(255 255 255 / .55)", v("text")),
50
+ shade("strong", "light", "rgb(255 255 255 / .82)", v("text")),
51
+ shade("soft", "brand", `color-mix(in srgb, ${v("accent")} 55%, transparent)`, v("hero-on-picture")),
52
+ shade("strong", "brand", `color-mix(in srgb, ${v("accent")} 82%, transparent)`, v("hero-on-picture")),
53
+ { selector: `[data-shade="none"] .wb-site-hero-shade`, about: "No shade", css: "display:none" },
54
+ { selector: `[data-shade="panel"] .wb-site-hero-shade`, about: "A panel behind the words instead of a shade", css: "display:none" },
55
+ { selector: `[data-shade-from="bottom"] .wb-site-hero-shade`, about: "Shade rising from the bottom", css: `background:linear-gradient(to top, ${S} 0%, ${S} 30%, transparent 90%)` },
56
+ { selector: `[data-shade-from="even"] .wb-site-hero-shade`, about: "An even shade over the whole picture", css: `background:${S}` },
57
+ { selector: `[data-over="yes"][data-panel="solid"]`, about: "Words on a solid panel: the page's own text colour", css: `--wb-site-hero-ink:${v("text")}` },
58
+ { selector: `[data-over="yes"][data-panel="frosted"]`, about: "Words on a frosted panel: the page's own text colour", css: `--wb-site-hero-ink:${v("text")}` },
59
+ // On phones, words over a picture can sit under it instead.
60
+ { selector: `[data-over="yes"][data-phone-height="shorter"]`, about: "Phones: a shorter hero", css: `min-height:min(${H}, 60svh)` },
61
+ { selector: `[data-over="yes"][data-phone-height="fit"]`, about: "Phones: just tall enough for the words", css: "min-height:0" },
62
+ { selector: `[data-over="yes"][data-phone-under="yes"]`, about: "Phones: the words under the picture", css: "min-height:0;padding-top:0;padding-bottom:0;overflow:visible;border-radius:0" },
63
+ { selector: `[data-over="yes"][data-phone-under="yes"] .wb-site-hero-media`, about: "Phones: the picture above the words", css: `position:relative;z-index:0;height:${PHONE_PICTURE};border-radius:${v("radius")}` },
64
+ { selector: `[data-over="yes"][data-phone-under="yes"] .wb-site-hero-shade`, about: "Phones: no shade when the words are under the picture", css: "visibility:hidden" },
65
+ { selector: `[data-over="yes"][data-phone-under="yes"] .wb-site-hero-words`, about: "Phones: the words in the page's own colour", css: `color:${v("text")}` },
66
+ // Words beside a picture: on phones the picture comes first, at a fixed height.
67
+ { selector: `[data-over="no"] .wb-site-hero-media`, about: "Phones: the picture above the words", css: `height:${PHONE_PICTURE}` },
68
+ // Where the words sit.
69
+ place("top", "start"),
70
+ place("middle", "center"),
71
+ place("bottom", "end"),
72
+ { selector: `[data-place$="-centre"] .wb-site-hero-words`, about: "Words in the centre", css: "justify-self:center;text-align:center" },
73
+ { selector: `[data-place$="-right"] .wb-site-hero-words`, about: "Words on the right", css: "justify-self:end;text-align:right" },
74
+ { selector: `[data-place$="-centre"] .wb-site-actions`, about: "Buttons in the centre", css: "justify-content:center" },
75
+ { selector: `[data-place$="-right"] .wb-site-actions`, about: "Buttons on the right", css: "justify-content:flex-end" },
76
+ { selector: ` .wb-site-hero-words`, about: "The hero's words in the hero's colour", css: `color:${v("hero-ink")}` },
77
+ { selector: `[data-words-width="narrow"] .wb-site-hero-words`, about: "Words width: narrow", css: "max-width:26rem" },
78
+ { selector: `[data-words-width="medium"] .wb-site-hero-words`, about: "Words width: medium", css: "max-width:36rem" },
79
+ { selector: `[data-words-width="wide"] .wb-site-hero-words`, about: "Words width: wide", css: "max-width:50rem" },
80
+ { selector: `[data-panel="solid"] .wb-site-hero-words`, about: "Words on a solid panel", css: `padding:calc(${SPACE} * 1.5);border-radius:${v("radius")};background:${v("background")};box-shadow:0 8px 28px rgb(0 0 0 / .14)` },
81
+ { selector: `[data-panel="frosted"] .wb-site-hero-words`, about: "Words on a frosted panel", css: `padding:calc(${SPACE} * 1.5);border-radius:${v("radius")};background:color-mix(in srgb, ${v("background")} 72%, transparent);backdrop-filter:blur(12px)` },
82
+ { selector: ` .wb-site-hero-heading`, about: "The heading, a little bigger than a plain hero's", css: "font-size:clamp(2.1rem, 7vw, 3.6rem);line-height:1.08" },
83
+ { selector: ` .wb-site-lead`, about: "The line under the heading, in the hero's colour", css: "color:inherit;opacity:.88" },
84
+ { selector: ` .wb-site-actions`, about: "The buttons, side by side, wrapping on a phone", css: "display:flex;flex-wrap:wrap;gap:.6rem" },
85
+ { selector: ` .wb-site-button-quiet`, about: "The second button, in the words' colour", css: "color:inherit;box-shadow:inset 0 0 0 1px currentColor" },
86
+ // Big words.
87
+ { selector: `[data-design="big-words"] .wb-site-hero-heading`, about: "Big words: a huge, tight heading", css: "font-size:clamp(3rem, 13vw, 7.5rem);line-height:.95;letter-spacing:-.01em" },
88
+ // Card over picture: on phones the card overlaps the bottom of the picture.
89
+ { selector: `[data-design="card-over"]`, about: "Card over picture, phones: the picture, then the card over its lower edge", css: "min-height:0;padding:0;overflow:visible;border-radius:0" },
90
+ { selector: `[data-design="card-over"] .wb-site-hero-media`, about: "Card over picture, phones: the picture", css: `position:relative;z-index:0;height:${PHONE_PICTURE};border-radius:${v("radius")}` },
91
+ { selector: `[data-design="card-over"] .wb-site-hero-words`, about: "Card over picture, phones: the card", css: `margin:calc(${SPACE} * -4) ${SPACE} 0;z-index:1` },
92
+ // Framed, shaped, collage, overlap, feature card: the picture's own look.
93
+ { selector: `[data-design="framed"] .wb-site-hero-media`, about: "Framed: a frame round the picture", css: `padding:calc(${SPACE} * .75);background:${v("surface")};box-shadow:0 10px 30px rgb(0 0 0 / .12)` },
94
+ { selector: `[data-design="framed"] .wb-site-hero-img`, about: "Framed: the picture inside its frame", css: `border-radius:calc(${v("radius")} / 2)` },
95
+ { selector: `[data-design="shaped"][data-shape="arch"] .wb-site-hero-media`, about: "Shaped: an arch", css: `border-radius:999px 999px ${v("radius")} ${v("radius")}` },
96
+ { selector: `[data-design="shaped"][data-shape="circle"] .wb-site-hero-media`, about: "Shaped: a circle", css: "justify-self:center;width:min(100%, 24rem);height:auto;aspect-ratio:1;border-radius:50%" },
97
+ { selector: `[data-design="shaped"][data-shape="soft"] .wb-site-hero-media`, about: "Shaped: a soft blob", css: "border-radius:42% 58% 52% 48% / 48% 42% 58% 52%" },
98
+ { selector: `[data-design="shaped"][data-shape="slant"] .wb-site-hero-media`, about: "Shaped: a slanted edge", css: "border-radius:0;clip-path:polygon(14% 0, 100% 0, 100% 100%, 0 100%)" },
99
+ { selector: `[data-design="collage"] .wb-site-hero-media`, about: "Collage: the photos in a loose grid", css: `height:auto;display:grid;grid-template-columns:repeat(2, minmax(0, 1fr));gap:calc(${SPACE} * .75);padding:calc(${SPACE} * .75);overflow:visible` },
100
+ { selector: `[data-design="collage"][data-pictures="1"] .wb-site-hero-media`, about: "Collage with one photo", css: "grid-template-columns:minmax(0, 1fr)" },
101
+ { selector: `[data-design="collage"] .wb-site-hero-frame`, about: "Collage: each photo, tilted a little", css: `aspect-ratio:4 / 5;overflow:hidden;border-radius:${v("radius")};box-shadow:0 8px 24px rgb(0 0 0 / .16);transform:rotate(-2.5deg)` },
102
+ { selector: `[data-design="collage"] .wb-site-hero-frame:nth-child(2)`, about: "Collage: the second photo", css: "transform:rotate(2.5deg) translateY(1.25rem)" },
103
+ { selector: `[data-design="collage"] .wb-site-hero-frame:nth-child(3)`, about: "Collage: the third photo", css: "transform:rotate(1.5deg)" },
104
+ { selector: `[data-design="collage"] .wb-site-hero-frame:nth-child(4)`, about: "Collage: the fourth photo", css: "transform:rotate(-1.5deg) translateY(1.25rem)" },
105
+ { selector: `[data-design="feature-card"] .wb-site-hero-media`, about: "Feature card: the picture as a card", css: `padding:calc(${SPACE} * .6);background:${v("background")};box-shadow:0 14px 40px rgb(0 0 0 / .16);transform:rotate(-1.5deg)` },
106
+ { selector: `[data-design="feature-card"] .wb-site-hero-img`, about: "Feature card: the picture inside the card", css: `border-radius:calc(${v("radius")} / 2)` },
107
+ { selector: `[data-design="overlap"] .wb-site-hero-heading`, about: "Overlap: very large words", css: "font-size:clamp(2.5rem, 8vw, 5rem);line-height:1" },
108
+ // Panorama: a centred heading over a long, thin picture.
109
+ { selector: `[data-design="panorama"] .wb-site-hero-words`, about: "Panorama: the words first, centred", css: "grid-row:1;justify-self:center;text-align:center" },
110
+ { selector: `[data-design="panorama"] .wb-site-hero-media`, about: "Panorama: the long, thin picture under the words", css: "grid-row:2;height:clamp(9rem, 42vw, 16rem)" },
111
+ // Words only: a band of colour.
112
+ { selector: `[data-design="words-only"]`, about: "Words only: the words on a band of colour", css: `min-height:${H};padding:calc(${SPACE} * 3) ${SPACE};border-radius:${v("radius")};background:${v("surface")}` },
113
+ { selector: `[data-design="words-only"][data-width="edge"]`, about: "Words only, edge to edge: square corners", css: "border-radius:0" },
114
+ ],
115
+ wide: [
116
+ { selector: `[data-over="yes"][data-phone-height]`, about: "From 600px: the chosen height, whatever phones use", css: `min-height:${H}` },
117
+ { selector: `[data-over="yes"][data-phone-under="yes"]`, about: "From 600px: words back over the picture", css: `padding-top:calc(${SPACE} * 2);padding-bottom:calc(${SPACE} * 2);overflow:hidden` },
118
+ { selector: `[data-over="yes"][data-phone-under="yes"] .wb-site-hero-media`, about: "From 600px: the picture back behind the words", css: "position:absolute;z-index:-1;height:auto;border-radius:0" },
119
+ { selector: `[data-over="yes"][data-phone-under="yes"] .wb-site-hero-shade`, about: "From 600px: the shade back", css: "visibility:visible" },
120
+ { selector: `[data-over="yes"][data-phone-under="yes"] .wb-site-hero-words`, about: "From 600px: the words in the hero's colour", css: `color:${v("hero-ink")}` },
121
+ { selector: `[data-shade-from="side"] .wb-site-hero-shade`, about: "From 600px: shade from the words' side", css: `background:linear-gradient(to right, ${S} 0%, ${S} 30%, transparent 85%)` },
122
+ { selector: `[data-shade-from="side"][data-place$="-right"] .wb-site-hero-shade`, about: "From 600px: shade from the right, where the words are", css: `background:linear-gradient(to left, ${S} 0%, ${S} 30%, transparent 85%)` },
123
+ { selector: `[data-shade-from="side"][data-place$="-centre"] .wb-site-hero-shade`, about: "From 600px: an even shade behind centred words", css: `background:${S}` },
124
+ // Two columns.
125
+ { selector: TWO, about: "From 600px: words and picture side by side", css: `grid-template-columns:repeat(2, minmax(0, 1fr));column-gap:calc(${SPACE} * 2.5);min-height:${H}` },
126
+ { selector: `${TWO} .wb-site-hero-media`, about: "From 600px: the picture as tall as the hero", css: "grid-row:1;height:auto;min-height:100%" },
127
+ { selector: `${TWO} .wb-site-hero-words`, about: "From 600px: the words beside the picture", css: "grid-row:1" },
128
+ { selector: `${TWO}[data-side="right"] .wb-site-hero-media`, about: "Picture on the right", css: "grid-column:2" },
129
+ { selector: `${TWO}[data-side="right"] .wb-site-hero-words`, about: "Words on the left", css: "grid-column:1" },
130
+ { selector: `${TWO}[data-side="left"] .wb-site-hero-media`, about: "Picture on the left", css: "grid-column:1" },
131
+ { selector: `${TWO}[data-side="left"] .wb-site-hero-words`, about: "Words on the right", css: "grid-column:2" },
132
+ { selector: `${TWO}[data-split="words"][data-side="right"]`, about: "Words wider, picture on the right", css: "grid-template-columns:minmax(0, 3fr) minmax(0, 2fr)" },
133
+ { selector: `${TWO}[data-split="words"][data-side="left"]`, about: "Words wider, picture on the left", css: "grid-template-columns:minmax(0, 2fr) minmax(0, 3fr)" },
134
+ { selector: `${TWO}[data-split="picture"][data-side="right"]`, about: "Picture wider, on the right", css: "grid-template-columns:minmax(0, 2fr) minmax(0, 3fr)" },
135
+ { selector: `${TWO}[data-split="picture"][data-side="left"]`, about: "Picture wider, on the left", css: "grid-template-columns:minmax(0, 3fr) minmax(0, 2fr)" },
136
+ { selector: `${TWO}[data-design="shaped"][data-shape="circle"] .wb-site-hero-media`, about: "From 600px: the circle centred beside the words", css: "min-height:0;align-self:center" },
137
+ { selector: `${TWO}[data-design="collage"] .wb-site-hero-media`, about: "From 600px: the collage beside the words", css: "min-height:0;align-self:center" },
138
+ { selector: `[data-design="overlap"] .wb-site-hero-media`, about: "From 600px: the picture runs down into the next section", css: `margin-bottom:calc(${v("section-space")} * -1.5);z-index:1;box-shadow:0 18px 40px rgb(0 0 0 / .18)` },
139
+ { selector: `[data-design="panorama"] .wb-site-hero-media`, about: "From 600px: a wider, thinner panorama", css: "height:clamp(10rem, 24vw, 20rem)" },
140
+ // Card over picture.
141
+ { selector: `[data-design="card-over"]`, about: "From 600px: the card over the picture's lower edge", css: `min-height:${H};padding-top:calc(${SPACE} * 2);margin-bottom:calc(${v("section-space")} + ${SPACE} * 4)` },
142
+ { selector: `[data-design="card-over"] .wb-site-hero-media`, about: "From 600px: the picture behind the card", css: "position:absolute;inset:0;z-index:-1;height:auto" },
143
+ { selector: `[data-design="card-over"][data-width="edge"]`, about: "From 600px, edge to edge: the card in line with the page", css: `padding-left:max(${SPACE}, calc((100vw - ${v("width")}) / 2));padding-right:max(${SPACE}, calc((100vw - ${v("width")}) / 2))` },
144
+ { selector: `[data-design="card-over"][data-width="page"]`, about: "From 600px, page width: the card inset from the picture's edge", css: `padding-left:calc(${SPACE} * 2);padding-right:calc(${SPACE} * 2)` },
145
+ { selector: `[data-design="card-over"] .wb-site-hero-words`, about: "From 600px: the card, half over the picture", css: `margin:0 0 calc(${SPACE} * -4)` },
146
+ { selector: `[data-design="card-over"][data-width="page"] .wb-site-hero-media`, about: "From 600px, page width: the picture's corners", css: `border-radius:${v("radius")}` },
147
+ ],
148
+ moving: [
149
+ { selector: `[data-motion="slow-zoom"] .wb-site-hero-img`, about: "Movement: a slow zoom, once", css: "animation:wb-site-hero-zoom 9s ease-out both" },
150
+ { selector: `[data-motion="fade-in"] .wb-site-hero-media`, about: "Movement: the picture fades in", css: "animation:wb-site-hero-fade .8s ease-out both" },
151
+ { selector: `[data-motion="fade-in"] .wb-site-hero-words`, about: "Movement: the words fade in just after", css: "animation:wb-site-hero-fade .8s .15s ease-out both" },
152
+ { selector: `[data-motion="words-rise"] .wb-site-hero-words`, about: "Movement: the words rise into place", css: "animation:wb-site-hero-rise .6s .15s ease-out both" },
153
+ ],
154
+ },
155
+ { name: "wb-site-hero-notice", element: "p", about: "A line above the hero, such as a cut-off time or a warning", css: `margin:0 0 ${SPACE};padding:.55rem ${SPACE};border-radius:${v("radius")};background:${v("accent")};color:${v("on-accent")};font-size:.92rem;font-weight:600;text-align:center`, states: [{ selector: " .wb-site-link", about: "The notice's link", css: "color:inherit;text-decoration:underline" }] },
156
+ { name: "wb-site-hero-media", element: "div", about: "The hero's pictures (and the shade over them)", css: `position:relative;min-width:0;overflow:hidden;border-radius:${v("radius")}` },
157
+ { name: "wb-site-hero-frame", element: "picture", about: "One picture, with a phone version when there is one", css: "display:block;height:100%" },
158
+ {
159
+ name: "wb-site-hero-img",
160
+ element: "img",
161
+ about: "The picture, cropped round its focal point",
162
+ css: `display:block;width:100%;height:100%;object-fit:cover;object-position:${v("hero-phone-focal")};transform:scale(${v("hero-zoom")});transform-origin:${v("hero-phone-focal")}`,
163
+ wide: [{ selector: "", about: "From 600px: the main focal point", css: `object-position:${v("hero-focal")};transform-origin:${v("hero-focal")}` }],
164
+ },
165
+ { name: "wb-site-hero-shade", element: "span", about: "The shade over the picture that makes the words easier to read", css: `position:absolute;inset:0;pointer-events:none;background:linear-gradient(to top, ${S} 0%, ${S} 30%, transparent 90%)` },
166
+ { name: "wb-site-hero-eyebrow", element: "p", about: "The short line above the heading", css: `margin:0 0 .6rem;font-size:.85rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:inherit;opacity:.85` },
167
+ { name: "wb-site-hero-slot", element: "div", about: "A live tool inside the hero, such as a booking search", css: `margin-top:calc(${SPACE} * 1.25);padding:${SPACE};border-radius:${v("radius")};background:${v("background")};color:${v("text")};text-align:left;box-shadow:0 8px 28px rgb(0 0 0 / .12)` },
168
+ ];
169
+ export const HERO_KEYFRAMES = [
170
+ { name: "wb-site-hero-zoom", about: "A slow zoom into the picture", steps: [{ at: "from", css: `transform:scale(${v("hero-zoom")})` }, { at: "to", css: `transform:scale(calc(${v("hero-zoom")} * 1.06))` }] },
171
+ { name: "wb-site-hero-fade", about: "Fading in", steps: [{ at: "from", css: "opacity:0" }, { at: "to", css: "opacity:1" }] },
172
+ { name: "wb-site-hero-rise", about: "Rising a little into place", steps: [{ at: "from", css: "opacity:0;transform:translateY(12px)" }, { at: "to", css: "opacity:1;transform:none" }] },
173
+ ];
package/dist/hero.d.ts ADDED
@@ -0,0 +1,220 @@
1
+ import type { Action, Picture } from "./sections.ts";
2
+ /** One hero design: what owners see, and which parts it uses. */
3
+ export interface HeroDesign {
4
+ id: string;
5
+ /** Its name, as owners see it on the ‹ › stepper. */
6
+ name: string;
7
+ /** One line on what it looks like. */
8
+ about: string;
9
+ /** How many pictures it shows: none, one, or up to four (a collage). */
10
+ pictures: 0 | 1 | 4;
11
+ /** The words sit over the picture, not beside it. */
12
+ over: boolean;
13
+ /** It has room for a live tool, such as a booking search. */
14
+ slot: boolean;
15
+ /** Its settings when nothing else says otherwise. */
16
+ defaults: Readonly<Omit<HeroSettings, "design">>;
17
+ }
18
+ export declare const HERO_HEIGHTS: readonly ["short", "medium", "tall", "full"];
19
+ export declare const HERO_WIDTHS: readonly ["page", "edge"];
20
+ export declare const HERO_PLACES: readonly ["top-left", "top-centre", "top-right", "middle-left", "middle-centre", "middle-right", "bottom-left", "bottom-centre", "bottom-right"];
21
+ export declare const HERO_SHADES: readonly ["none", "soft", "strong", "panel"];
22
+ export declare const HERO_SHADE_COLOURS: readonly ["dark", "light", "brand"];
23
+ export declare const HERO_SHADE_FROM: readonly ["bottom", "side", "even"];
24
+ export declare const HERO_MOTIONS: readonly ["none", "slow-zoom", "fade-in", "words-rise"];
25
+ export declare const HERO_SIDES: readonly ["left", "right"];
26
+ export declare const HERO_SPLITS: readonly ["half", "words", "picture"];
27
+ export declare const HERO_WORDS_WIDTHS: readonly ["narrow", "medium", "wide"];
28
+ export declare const HERO_PANELS: readonly ["none", "solid", "frosted"];
29
+ export declare const HERO_SHAPES: readonly ["arch", "circle", "soft", "slant"];
30
+ export declare const HERO_PHONE_HEIGHTS: readonly ["same", "shorter", "fit"];
31
+ /** A point on the picture that must always show, in percent from the left and from the top. */
32
+ export interface FocalPoint {
33
+ x: number;
34
+ y: number;
35
+ }
36
+ /** Everything about how a hero sits. Only `design` is needed; the design's defaults fill the rest. */
37
+ export interface HeroSettings {
38
+ design: HeroDesignId;
39
+ height?: (typeof HERO_HEIGHTS)[number];
40
+ /** Exact height as a percentage of the screen's height, 20 to 100. Wins over `height`. */
41
+ exactHeight?: number;
42
+ width?: (typeof HERO_WIDTHS)[number];
43
+ /** Where the words sit, on a three by three grid. */
44
+ place?: (typeof HERO_PLACES)[number];
45
+ /** Make words easier to read: a shade over the picture, or a panel behind the words. */
46
+ shade?: (typeof HERO_SHADES)[number];
47
+ shadeColour?: (typeof HERO_SHADE_COLOURS)[number];
48
+ shadeFrom?: (typeof HERO_SHADE_FROM)[number];
49
+ motion?: (typeof HERO_MOTIONS)[number];
50
+ focal?: FocalPoint;
51
+ /** 1 to 1.5. */
52
+ zoom?: number;
53
+ /** The picture's side, for designs with words beside a picture. */
54
+ side?: (typeof HERO_SIDES)[number];
55
+ /** Which side is wider: half and half, the words, or the picture. */
56
+ split?: (typeof HERO_SPLITS)[number];
57
+ wordsWidth?: (typeof HERO_WORDS_WIDTHS)[number];
58
+ panel?: (typeof HERO_PANELS)[number];
59
+ /** The picture's shape, for the Shaped picture design. */
60
+ shape?: (typeof HERO_SHAPES)[number];
61
+ phone?: {
62
+ height?: (typeof HERO_PHONE_HEIGHTS)[number];
63
+ /** On phones, the words go under the picture instead of over it. */
64
+ wordsUnder?: boolean;
65
+ /** Where the phone's crop centres, when it differs. */
66
+ focal?: FocalPoint;
67
+ };
68
+ }
69
+ /** The thirteen designs, in the order owners flip through them. */
70
+ export declare const HERO_DESIGNS: readonly [{
71
+ readonly id: "full-screen";
72
+ readonly name: "Full screen";
73
+ readonly about: "The picture fills the top of the page, with the words over it.";
74
+ readonly pictures: 1;
75
+ readonly over: true;
76
+ readonly slot: false;
77
+ readonly defaults: Omit<HeroSettings, "design">;
78
+ }, {
79
+ readonly id: "split";
80
+ readonly name: "Split";
81
+ readonly about: "Words on one side, the picture on the other.";
82
+ readonly pictures: 1;
83
+ readonly over: false;
84
+ readonly slot: false;
85
+ readonly defaults: Omit<HeroSettings, "design">;
86
+ }, {
87
+ readonly id: "banner";
88
+ readonly name: "Banner";
89
+ readonly about: "A shorter, wide picture with the words over it.";
90
+ readonly pictures: 1;
91
+ readonly over: true;
92
+ readonly slot: false;
93
+ readonly defaults: Omit<HeroSettings, "design">;
94
+ }, {
95
+ readonly id: "framed";
96
+ readonly name: "Framed";
97
+ readonly about: "The picture in a frame with space round it, the words beside.";
98
+ readonly pictures: 1;
99
+ readonly over: false;
100
+ readonly slot: false;
101
+ readonly defaults: Omit<HeroSettings, "design">;
102
+ }, {
103
+ readonly id: "card-over";
104
+ readonly name: "Card over picture";
105
+ readonly about: "A wide picture with a card over its lower edge, which can hold a live tool.";
106
+ readonly pictures: 1;
107
+ readonly over: true;
108
+ readonly slot: true;
109
+ readonly defaults: Omit<HeroSettings, "design">;
110
+ }, {
111
+ readonly id: "search-first";
112
+ readonly name: "Search first";
113
+ readonly about: "A search or finder box under the heading, the picture beside it.";
114
+ readonly pictures: 1;
115
+ readonly over: false;
116
+ readonly slot: true;
117
+ readonly defaults: Omit<HeroSettings, "design">;
118
+ }, {
119
+ readonly id: "big-words";
120
+ readonly name: "Big words";
121
+ readonly about: "A huge heading over the picture, like a poster.";
122
+ readonly pictures: 1;
123
+ readonly over: true;
124
+ readonly slot: false;
125
+ readonly defaults: Omit<HeroSettings, "design">;
126
+ }, {
127
+ readonly id: "collage";
128
+ readonly name: "Collage";
129
+ readonly about: "Two to four photos, slightly tilted, beside the words.";
130
+ readonly pictures: 4;
131
+ readonly over: false;
132
+ readonly slot: false;
133
+ readonly defaults: Omit<HeroSettings, "design">;
134
+ }, {
135
+ readonly id: "shaped";
136
+ readonly name: "Shaped picture";
137
+ readonly about: "The picture in an arch, circle, soft shape or slant, beside the words.";
138
+ readonly pictures: 1;
139
+ readonly over: false;
140
+ readonly slot: false;
141
+ readonly defaults: Omit<HeroSettings, "design">;
142
+ }, {
143
+ readonly id: "overlap";
144
+ readonly name: "Overlap";
145
+ readonly about: "Large words beside a picture that runs down into the next section.";
146
+ readonly pictures: 1;
147
+ readonly over: false;
148
+ readonly slot: false;
149
+ readonly defaults: Omit<HeroSettings, "design">;
150
+ }, {
151
+ readonly id: "panorama";
152
+ readonly name: "Panorama";
153
+ readonly about: "A centred heading over a long, thin picture.";
154
+ readonly pictures: 1;
155
+ readonly over: false;
156
+ readonly slot: false;
157
+ readonly defaults: Omit<HeroSettings, "design">;
158
+ }, {
159
+ readonly id: "feature-card";
160
+ readonly name: "Feature card";
161
+ readonly about: "One card is the star (a profile, a letter, a live tool), the words beside it.";
162
+ readonly pictures: 1;
163
+ readonly over: false;
164
+ readonly slot: true;
165
+ readonly defaults: Omit<HeroSettings, "design">;
166
+ }, {
167
+ readonly id: "words-only";
168
+ readonly name: "Words only";
169
+ readonly about: "No picture: the heading, a line and buttons on a band of colour.";
170
+ readonly pictures: 0;
171
+ readonly over: false;
172
+ readonly slot: false;
173
+ readonly defaults: Omit<HeroSettings, "design">;
174
+ }];
175
+ export type HeroDesignId = (typeof HERO_DESIGNS)[number]["id"];
176
+ /** Settings every design starts from, under its own defaults. */
177
+ declare const BASE: Required<Omit<HeroSettings, "design" | "exactHeight" | "phone">> & {
178
+ phone: Required<Omit<NonNullable<HeroSettings["phone"]>, "focal">>;
179
+ };
180
+ /** A hero's settings with every gap filled from its design's defaults. */
181
+ export type ResolvedHeroSettings = typeof BASE & {
182
+ design: HeroDesignId;
183
+ exactHeight?: number;
184
+ phone: typeof BASE.phone & {
185
+ focal?: FocalPoint;
186
+ };
187
+ };
188
+ export declare const heroDesign: (id: string) => HeroDesign | undefined;
189
+ /** Fills every setting the owner hasn't chosen from the design's defaults, then from the base. */
190
+ export declare function resolveHeroSettings(s: HeroSettings): ResolvedHeroSettings;
191
+ /** What is wrong with some hero settings, in plain words. Empty when they can be drawn. */
192
+ export declare function heroSettingsProblems(s: unknown): string[];
193
+ /** A picture in the hero, with the point that must always show. */
194
+ export interface HeroPicture extends Picture {
195
+ focal?: FocalPoint;
196
+ }
197
+ /** What a hero says and shows. Words are finished text, already looked up. */
198
+ export interface HeroContent {
199
+ /** A short line above the heading. */
200
+ eyebrow?: string;
201
+ /** The page's only h1. */
202
+ heading: string;
203
+ lead?: string;
204
+ /** Up to two buttons: the first is the main one, the second quieter. */
205
+ actions?: readonly Action[];
206
+ /** The hero's pictures; only a collage shows more than one. */
207
+ pictures?: readonly HeroPicture[];
208
+ /** A different picture for phones. */
209
+ phonePicture?: Picture;
210
+ /** A line above the hero, such as a cut-off time or a warning. */
211
+ notice?: {
212
+ text: string;
213
+ link?: Action;
214
+ };
215
+ /** A live tool's own small form, drawn by that tool, for designs with a slot. */
216
+ slot?: string;
217
+ }
218
+ /** A hero, drawn in one of the thirteen designs. The page's only h1. */
219
+ export declare function designedHero(content: HeroContent, settings: HeroSettings): string;
220
+ export {};
package/dist/hero.js ADDED
@@ -0,0 +1,173 @@
1
+ // The landing page hero (docs/hero-and-images.md §4 to §6): thirteen designs
2
+ // harvested from the sample sites, all drawn from one settings shape. A design
3
+ // is code (this file and its rules in styles.ts); a starting point is data
4
+ // (hero-starts.ts). The HTML is the same for every design: an optional notice
5
+ // above, the pictures with their shade, then the words, each part with a
6
+ // wb-site-hero-* class, and the section's data-* attributes choosing the
7
+ // rules. Phones are drawn first; the wider rules start at 600px.
8
+ import { escape, newTab, paragraphs, safeHref } from "./html.js";
9
+ export const HERO_HEIGHTS = ["short", "medium", "tall", "full"];
10
+ export const HERO_WIDTHS = ["page", "edge"];
11
+ export const HERO_PLACES = ["top-left", "top-centre", "top-right", "middle-left", "middle-centre", "middle-right", "bottom-left", "bottom-centre", "bottom-right"];
12
+ export const HERO_SHADES = ["none", "soft", "strong", "panel"];
13
+ export const HERO_SHADE_COLOURS = ["dark", "light", "brand"];
14
+ export const HERO_SHADE_FROM = ["bottom", "side", "even"];
15
+ export const HERO_MOTIONS = ["none", "slow-zoom", "fade-in", "words-rise"];
16
+ export const HERO_SIDES = ["left", "right"];
17
+ export const HERO_SPLITS = ["half", "words", "picture"];
18
+ export const HERO_WORDS_WIDTHS = ["narrow", "medium", "wide"];
19
+ export const HERO_PANELS = ["none", "solid", "frosted"];
20
+ export const HERO_SHAPES = ["arch", "circle", "soft", "slant"];
21
+ export const HERO_PHONE_HEIGHTS = ["same", "shorter", "fit"];
22
+ const d = (o) => o;
23
+ /** The thirteen designs, in the order owners flip through them. */
24
+ export const HERO_DESIGNS = [
25
+ { id: "full-screen", name: "Full screen", about: "The picture fills the top of the page, with the words over it.", pictures: 1, over: true, slot: false, defaults: d({ height: "full", width: "edge", place: "bottom-left", shade: "soft", shadeFrom: "bottom" }) },
26
+ { id: "split", name: "Split", about: "Words on one side, the picture on the other.", pictures: 1, over: false, slot: false, defaults: d({ height: "tall", width: "page", place: "middle-left", side: "right", split: "half" }) },
27
+ { id: "banner", name: "Banner", about: "A shorter, wide picture with the words over it.", pictures: 1, over: true, slot: false, defaults: d({ height: "short", width: "edge", place: "middle-centre", shade: "soft", shadeFrom: "even" }) },
28
+ { id: "framed", name: "Framed", about: "The picture in a frame with space round it, the words beside.", pictures: 1, over: false, slot: false, defaults: d({ height: "tall", width: "page", place: "middle-left", side: "right", split: "half" }) },
29
+ { id: "card-over", name: "Card over picture", about: "A wide picture with a card over its lower edge, which can hold a live tool.", pictures: 1, over: true, slot: true, defaults: d({ height: "tall", width: "edge", place: "bottom-left", shade: "panel" }) },
30
+ { id: "search-first", name: "Search first", about: "A search or finder box under the heading, the picture beside it.", pictures: 1, over: false, slot: true, defaults: d({ height: "tall", width: "page", place: "middle-left", side: "right", split: "words" }) },
31
+ { id: "big-words", name: "Big words", about: "A huge heading over the picture, like a poster.", pictures: 1, over: true, slot: false, defaults: d({ height: "full", width: "edge", place: "bottom-left", shade: "strong", shadeFrom: "bottom", wordsWidth: "wide" }) },
32
+ { id: "collage", name: "Collage", about: "Two to four photos, slightly tilted, beside the words.", pictures: 4, over: false, slot: false, defaults: d({ height: "tall", width: "page", place: "middle-left", side: "right", split: "half" }) },
33
+ { id: "shaped", name: "Shaped picture", about: "The picture in an arch, circle, soft shape or slant, beside the words.", pictures: 1, over: false, slot: false, defaults: d({ height: "tall", width: "page", place: "middle-left", side: "right", split: "half", shape: "arch" }) },
34
+ { id: "overlap", name: "Overlap", about: "Large words beside a picture that runs down into the next section.", pictures: 1, over: false, slot: false, defaults: d({ height: "tall", width: "page", place: "middle-left", side: "right", split: "words", wordsWidth: "wide" }) },
35
+ { id: "panorama", name: "Panorama", about: "A centred heading over a long, thin picture.", pictures: 1, over: false, slot: false, defaults: d({ height: "medium", width: "page", place: "top-centre" }) },
36
+ { id: "feature-card", name: "Feature card", about: "One card is the star (a profile, a letter, a live tool), the words beside it.", pictures: 1, over: false, slot: true, defaults: d({ height: "tall", width: "page", place: "middle-left", side: "right", split: "half" }) },
37
+ { id: "words-only", name: "Words only", about: "No picture: the heading, a line and buttons on a band of colour.", pictures: 0, over: false, slot: false, defaults: d({ height: "short", width: "page", place: "middle-centre" }) },
38
+ ];
39
+ /** Settings every design starts from, under its own defaults. */
40
+ const BASE = {
41
+ height: "tall",
42
+ width: "page",
43
+ place: "middle-left",
44
+ shade: "none",
45
+ shadeColour: "dark",
46
+ shadeFrom: "side",
47
+ motion: "none",
48
+ focal: { x: 50, y: 50 },
49
+ zoom: 1,
50
+ side: "right",
51
+ split: "half",
52
+ wordsWidth: "medium",
53
+ panel: "none",
54
+ shape: "arch",
55
+ phone: { height: "same", wordsUnder: false },
56
+ };
57
+ export const heroDesign = (id) => HERO_DESIGNS.find((x) => x.id === id);
58
+ /** Fills every setting the owner hasn't chosen from the design's defaults, then from the base. */
59
+ export function resolveHeroSettings(s) {
60
+ const design = heroDesign(s.design) ?? HERO_DESIGNS[0];
61
+ const out = { ...BASE, ...design.defaults, ...s, design: design.id, phone: { ...BASE.phone, ...s.phone } };
62
+ return out;
63
+ }
64
+ const oneOf = (list, v) => typeof v === "string" && list.includes(v);
65
+ const percent = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 && v <= 100;
66
+ const point = (v) => !!v && typeof v === "object" && percent(v.x) && percent(v.y);
67
+ const CHOICES = {
68
+ height: { list: HERO_HEIGHTS, what: "Height" },
69
+ width: { list: HERO_WIDTHS, what: "Width" },
70
+ place: { list: HERO_PLACES, what: "Where the words sit" },
71
+ shade: { list: HERO_SHADES, what: "Make words easier to read" },
72
+ shadeColour: { list: HERO_SHADE_COLOURS, what: "Shade colour" },
73
+ shadeFrom: { list: HERO_SHADE_FROM, what: "Shade from" },
74
+ motion: { list: HERO_MOTIONS, what: "Movement" },
75
+ side: { list: HERO_SIDES, what: "Picture side" },
76
+ split: { list: HERO_SPLITS, what: "Split" },
77
+ wordsWidth: { list: HERO_WORDS_WIDTHS, what: "Words width" },
78
+ panel: { list: HERO_PANELS, what: "Words panel" },
79
+ shape: { list: HERO_SHAPES, what: "Shape" },
80
+ };
81
+ /** What is wrong with some hero settings, in plain words. Empty when they can be drawn. */
82
+ export function heroSettingsProblems(s) {
83
+ if (!s || typeof s !== "object" || Array.isArray(s))
84
+ return ["Hero settings must be a set of choices."];
85
+ const o = s;
86
+ const out = [];
87
+ if (!heroDesign(String(o.design)))
88
+ out.push(`Style must be one of ${HERO_DESIGNS.map((x) => x.id).join(", ")}.`);
89
+ for (const [key, c] of Object.entries(CHOICES))
90
+ if (o[key] !== undefined && !oneOf(c.list, o[key]))
91
+ out.push(`${c.what} must be one of ${c.list.join(", ")}.`);
92
+ if (o.exactHeight !== undefined && !(typeof o.exactHeight === "number" && Number.isInteger(o.exactHeight) && o.exactHeight >= 20 && o.exactHeight <= 100))
93
+ out.push("Exact height must be a whole number from 20 to 100 (percent of the screen).");
94
+ if (o.zoom !== undefined && !(typeof o.zoom === "number" && o.zoom >= 1 && o.zoom <= 1.5))
95
+ out.push("Zoom must be from 1 to 1.5.");
96
+ if (o.focal !== undefined && !point(o.focal))
97
+ out.push("Focal point must be two numbers from 0 to 100.");
98
+ if (o.phone !== undefined) {
99
+ const p = o.phone;
100
+ if (!p || typeof p !== "object" || Array.isArray(p))
101
+ out.push("Phone settings must be a set of choices.");
102
+ else {
103
+ if (p.height !== undefined && !oneOf(HERO_PHONE_HEIGHTS, p.height))
104
+ out.push(`Height on phones must be one of ${HERO_PHONE_HEIGHTS.join(", ")}.`);
105
+ if (p.wordsUnder !== undefined && typeof p.wordsUnder !== "boolean")
106
+ out.push("Words under the picture on phones must be yes or no.");
107
+ if (p.focal !== undefined && !point(p.focal))
108
+ out.push("The phone's focal point must be two numbers from 0 to 100.");
109
+ }
110
+ }
111
+ const known = new Set(["design", "exactHeight", "zoom", "focal", "phone", ...Object.keys(CHOICES)]);
112
+ for (const k of Object.keys(o))
113
+ if (!known.has(k))
114
+ out.push(`${k} isn't a hero setting.`);
115
+ return out;
116
+ }
117
+ const pct = (p) => `${Math.round(p.x * 10) / 10}% ${Math.round(p.y * 10) / 10}%`;
118
+ const button = (a, quiet) => `<a class="wb-site-button${quiet ? " wb-site-button-quiet" : ""}" href="${escape(safeHref(a.href))}"${newTab(safeHref(a.href))}>${escape(a.label)}</a>`;
119
+ /** A hero, drawn in one of the thirteen designs. The page's only h1. */
120
+ export function designedHero(content, settings) {
121
+ const s = resolveHeroSettings(settings);
122
+ const design = heroDesign(s.design);
123
+ const pictures = design.pictures === 0 ? [] : (content.pictures ?? []).slice(0, design.pictures);
124
+ const focal = pictures[0]?.focal ?? s.focal;
125
+ const phoneFocal = s.phone.focal ?? focal;
126
+ const style = [`--wb-site-hero-focal:${pct(focal)}`, `--wb-site-hero-phone-focal:${pct(phoneFocal)}`, `--wb-site-hero-zoom:${s.zoom}`];
127
+ if (s.exactHeight)
128
+ style.push(`--wb-site-hero-height:${s.exactHeight}svh`);
129
+ // A panel shade is a solid panel behind the words unless a frosted one is chosen.
130
+ const panel = s.shade === "panel" && s.panel === "none" ? "solid" : s.panel;
131
+ const attrs = {
132
+ "data-design": s.design,
133
+ "data-over": design.over ? "yes" : "no",
134
+ "data-height": s.exactHeight ? "exact" : s.height,
135
+ "data-width": s.width,
136
+ "data-place": s.place,
137
+ "data-shade": s.shade,
138
+ "data-shade-colour": s.shadeColour,
139
+ "data-shade-from": s.shadeFrom,
140
+ "data-panel": panel,
141
+ "data-motion": s.motion,
142
+ "data-side": s.side,
143
+ "data-split": s.split,
144
+ "data-words-width": s.wordsWidth,
145
+ "data-shape": s.shape,
146
+ "data-phone-height": s.phone.height,
147
+ "data-phone-under": s.phone.wordsUnder ? "yes" : "no",
148
+ "data-pictures": String(pictures.length),
149
+ };
150
+ const img = (p, i) => {
151
+ const eager = i === 0;
152
+ const tag = `<img class="wb-site-hero-img" src="${escape(safeHref(p.src))}" alt="${escape(p.alt)}"${eager ? ' fetchpriority="high"' : ' loading="lazy"'} decoding="async"${p.focal && i > 0 ? ` style="object-position:${pct(p.focal)}"` : ""}>`;
153
+ const phone = i === 0 && content.phonePicture ? `<source media="(max-width: 599px)" srcset="${escape(safeHref(content.phonePicture.src))}">` : "";
154
+ return `<picture class="wb-site-hero-frame">${phone}${tag}</picture>`;
155
+ };
156
+ const media = pictures.length ? `<div class="wb-site-hero-media">${pictures.map(img).join("")}${design.over ? '<span class="wb-site-hero-shade"></span>' : ""}</div>` : "";
157
+ const actions = (content.actions ?? []).slice(0, 2);
158
+ const slot = design.slot && content.slot ? `<div class="wb-site-hero-slot">${content.slot}</div>` : "";
159
+ const words = `<div class="wb-site-hero-words">` +
160
+ (content.eyebrow ? `<p class="wb-site-hero-eyebrow">${escape(content.eyebrow)}</p>` : "") +
161
+ `<h1 class="wb-site-hero-heading">${escape(content.heading)}</h1>` +
162
+ (content.lead ? paragraphs(content.lead, "wb-site-lead") : "") +
163
+ (actions.length ? `<p class="wb-site-actions">${actions.map((a, i) => button(a, i > 0)).join("")}</p>` : "") +
164
+ slot +
165
+ `</div>`;
166
+ const notice = content.notice
167
+ ? `<p class="wb-site-hero-notice">${escape(content.notice.text)}${content.notice.link ? ` <a class="wb-site-link" href="${escape(safeHref(content.notice.link.href))}"${newTab(safeHref(content.notice.link.href))}>${escape(content.notice.link.label)}</a>` : ""}</p>`
168
+ : "";
169
+ const attrText = Object.entries(attrs)
170
+ .map(([k, v]) => ` ${k}="${escape(v)}"`)
171
+ .join("");
172
+ return `${notice}<section class="wb-site-hero-designed"${attrText} style="${escape(style.join(";"))}">${media}${words}</section>`;
173
+ }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  export { frame, FOOTERS, FRAMES, HEADERS, type FooterStyle, type FrameLayout, type FrameName, type FrameOptions, type HeaderStyle, type MenuLink } from "./frames.ts";
2
2
  export { escape } from "./html.ts";
3
3
  export { account, callToAction, DESIGN_COOKIE, designModeOn, designModePost, designSwitch, details, enquiryList, needsYou, formSection, hero, HERO_ARRANGEMENTS, list, picture, text, type AccountOptions, type Action, type CallToActionOptions, type DesignSwitchOptions, type DetailRow, type DetailsOptions, type Enquiry, type EnquiryListOptions, type NeedsYouItem, type NeedsYouOptions, type FormSectionOptions, type HeroArrangement, type HeroOptions, type ListItem, type ListOptions, type Picture, type PictureOptions, type TextOptions, } from "./sections.ts";
4
+ export { designedHero, heroDesign, heroSettingsProblems, resolveHeroSettings, HERO_DESIGNS, HERO_HEIGHTS, HERO_MOTIONS, HERO_PANELS, HERO_PHONE_HEIGHTS, HERO_PLACES, HERO_SHADE_COLOURS, HERO_SHADE_FROM, HERO_SHADES, HERO_SHAPES, HERO_SIDES, HERO_SPLITS, HERO_WIDTHS, HERO_WORDS_WIDTHS, type FocalPoint, type HeroContent, type HeroDesign, type HeroDesignId, type HeroPicture, type HeroSettings, type ResolvedHeroSettings, } from "./hero.ts";
5
+ export { SITE_STYLES } from "./styles.ts";
6
+ export { HERO_GROUPS, HERO_SAMPLE_SLOTS, HERO_STARTS, heroStart, heroStartsFor, type HeroSlotTool, type HeroStart } from "./hero-starts.ts";
4
7
  export { recipeKeys, recipeProblems, TIERS, type ActionSpec, type Area, type Group, type PageWords, type Recipe, type SectionSpec, type Tier, type ToolSectionFunction } from "./recipe.ts";
5
8
  export { RECIPES } from "./recipes/index.ts";
6
9
  export { MAX_OWNER_LINE, MAX_OWNER_WORD, ownerWordKey, readOwnerWords, SITE_SETTINGS, siteAnswers, siteSettings, type OwnerWordsReader, type SiteOwnerSettings } from "./owner-words.ts";
package/dist/index.js CHANGED
@@ -4,6 +4,9 @@
4
4
  export { frame, FOOTERS, FRAMES, HEADERS } from "./frames.js";
5
5
  export { escape } from "./html.js";
6
6
  export { account, callToAction, DESIGN_COOKIE, designModeOn, designModePost, designSwitch, details, enquiryList, needsYou, formSection, hero, HERO_ARRANGEMENTS, list, picture, text, } from "./sections.js";
7
+ export { designedHero, heroDesign, heroSettingsProblems, resolveHeroSettings, HERO_DESIGNS, HERO_HEIGHTS, HERO_MOTIONS, HERO_PANELS, HERO_PHONE_HEIGHTS, HERO_PLACES, HERO_SHADE_COLOURS, HERO_SHADE_FROM, HERO_SHADES, HERO_SHAPES, HERO_SIDES, HERO_SPLITS, HERO_WIDTHS, HERO_WORDS_WIDTHS, } from "./hero.js";
8
+ export { SITE_STYLES } from "./styles.js";
9
+ export { HERO_GROUPS, HERO_SAMPLE_SLOTS, HERO_STARTS, heroStart, heroStartsFor } from "./hero-starts.js";
7
10
  export { recipeKeys, recipeProblems, TIERS } from "./recipe.js";
8
11
  export { RECIPES } from "./recipes/index.js";
9
12
  export { MAX_OWNER_LINE, MAX_OWNER_WORD, ownerWordKey, readOwnerWords, SITE_SETTINGS, siteAnswers, siteSettings } from "./owner-words.js";