@dloizides/marketing-astro-kit 1.11.0 → 1.12.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.
package/CHANGELOG.md CHANGED
@@ -1,154 +1,160 @@
1
- # Changelog
2
-
3
- ## 1.11.0
4
-
5
- ### Added
6
-
7
- - `./scrollFade`: `createScrollFade({ belowLevel, switchShare })` returns the scroll-linked opacity curve of a page-wide background (full over the hero, falling to `belowLevel`) and `isBelow`, true once less than `switchShare` of the hero is on screen; `heroProgress(scrollY, heroHeight)` gives that share (MOONCUBE-SITE-4 "Faded background continues below the hero").
8
-
9
- ## 1.10.0
10
-
11
- ### Added
12
-
13
- - `./motionController`: `createMotionController(options)` runs a frame loop only while the page is visible and the target is in view, and holds a still under `prefers-reduced-motion` (MOONCUBE-SITE-3 "Stunning background, DevOps experience and ISO 27001 controls"). Its source is self-contained, so an `is:inline` script can carry it.
14
-
15
- ### Changed
16
-
17
- - `HeroBackdrop` uses `createMotionController`; behaviour unchanged.
18
-
19
- ## 1.9.1
20
-
21
- ### Fixed
22
-
23
- - `MeetingRequestForm`: every input, select and textarea shows a 2px `:focus-visible` ring, colour `--tmk-mr-focus` (default `currentColor`; also feeds the day field's `--tmk-df-focus`). MOONCUBE-SITE-1 "Moon Cube Technologies site: read and book", D-SITE-36.
24
-
25
- ## 1.9.0
26
-
27
- ### Added
28
-
29
- - `<MeetingRequestForm />` (`./MeetingRequestForm.astro`) + `./meetingRequest` helpers: preferred day, time of day, name, email, company, message; validation (past day, bad email), JSON POST with timeout, sent / rate-limited (429) / failed states, mailto assembled in the browser, honeypot `website`, Send loading state, optional Umami event. Labels and endpoint are options; no subject is sent. MOONCUBE-SITE-1 "Moon Cube Technologies site: read and book", AC-07, AC-08, AC-18, AC-20, AC-21, AC-22.
30
- - `<DateField />` (`./DateField.astro`) + `./dateField` helpers: the shared date input for Astro sites (DATE-INPUT-1 "Every date or date-time field uses the shared input"): native picker, label, min/max, error with `aria-invalid` + `aria-describedby`, 44 px control, themed by `--tmk-df-*`. `MeetingRequestForm` uses it for the day. MOONCUBE-SITE-1, D-SITE-17.
31
-
32
- ### Changed
33
-
34
- - `MeetingRequestForm`: the message is required, at least 10 characters (matches the `/contact` server validator); new error kind `too-short` in `labels.errors`.
35
-
36
- ## 1.8.0
37
-
38
- ### Added
39
-
40
- - `<BookingEmbed />` (`./BookingEmbed.astro`) + `./bookingEmbed` helpers: Cal.com inline embed set by options, contact fallback after 8 s or a load error, address assembled in the browser. Unit tests (vitest), lint and typecheck scripts. MOONCUBE-SITE-1 "Moon Cube Technologies site: read and book", AC-18.
41
-
42
- ## 1.7.0
43
-
44
- ### Added
45
-
46
- - `<BottomSheet />` (`./BottomSheet.astro`): slot-based phone bottom sheet opened by `:target`, inline at 1024 px and up. Sits above `--dlz-consent-inset`. BEAD-ONE-2 "One-host follow-ups".
47
-
48
- ## 1.6.1
49
-
50
- ### Fixed
51
-
52
- - `HairlineFigure` mount: a failed lazy-chunk load or figure mount no longer becomes an unhandled rejection. The host gets `data-hairline-failed="true"` and the page logs one `console.warn`. HAIRLINE-1 "Adopt hairline isometric line figures".
53
- - README: a sub-path host (kefi-landings) needs `build.assetsPrefix` set to an ABSOLUTE origin serving `dist/_astro/`; a relative prefix fails silently.
54
-
55
- ## 1.6.0
56
-
57
- ### Added
58
-
59
- - `<HairlineFigure />` (`./HairlineFigure.astro`) plus `HAIRLINE_FIGURES`, `TOUCH_SAFE_HAIRLINE_FIGURES` and `clampHairlineIntensity` (`./hairline`). Wraps `@lucasmarkes/hairline` 0.3.0 (exact pin): SSR 5:4 box, lazy mount near the viewport, destroy on page swap, `--hairline-*` mapped from the theming contract. HAIRLINE-1 "Adopt hairline isometric line figures".
60
-
61
- ## 1.5.2
62
-
63
- ### Fixed
64
-
65
- - `.dmk-disclaimer` (DemoFrame) and `.pmk-footnote` (PricingComparison) cap their measure at 65ch; at 1280 px they ran 102-113 characters per line. Mobile is unaffected.
66
-
67
- ## 1.3.0
68
-
69
- ### Added
70
-
71
- - `<HeroBackdrop />` plus the named hero-backdrop preset catalog (`./heroBackdrop`).
72
- Nine animated hero treatments -- three canvas, one SVG-filter, five pure-CSS --
73
- that until now existed ONLY in a disposable per-session scratchpad and had been
74
- rebuilt from scratch more than once. `HERO_BACKDROP_PRESETS` is the permanent
75
- record: preset name -> `{ variant, engine, palette, css, ember }`, using the
76
- design studio's own parameter names verbatim so a studio export pastes in with
77
- no translation step.
78
- - `csdf-ember-sparse` -- CSDF's shipped configuration. 40 particles, an eighth of
79
- the studio default, which is what makes a canvas backdrop affordable against a
80
- hard Lighthouse >= 80 budget.
81
- - Only the ember canvas engine ships as a RENDERER. The CSS/SVG entries are
82
- recorded PARAMETER SETS painted by the host stylesheet; the component renders
83
- nothing for those, leaving the host's own backdrop untouched.
84
-
85
- ### Notes
86
-
87
- - The component's script is `is:inline` deliberately -- a bundled Astro script
88
- emits a root-absolute `/_astro/*.js` reference, which 404s under kefi-landings'
89
- host-based per-tenant nginx roots.
90
- - Respects `prefers-reduced-motion` (one still frame, no loop) and stops the rAF
91
- loop on `visibilitychange` and when the canvas leaves the viewport.
92
-
93
- ## 1.2.1
94
-
95
- - **a11y fix (serious): the pricing comparison was SILENT to screen readers.**
96
- `PricingComparison.astro` marked each cell with `aria-label` on a bare
97
- `<span>`. `aria-label` is *prohibited* on a roleless generic element, so
98
- assistive tech ignored it — and the inner `<svg>` is `aria-hidden`. Net
99
- effect: a screen-reader user reached every included/not-included cell and
100
- heard **nothing**, so they could not tell which plan carried which feature,
101
- on a public pricing page. Fixed by giving the span `role="img"` alongside
102
- the existing label. Found by the `a11y-public` E2E axe scan against the live
103
- kefi landing: `aria-prohibited-attr`, 27 nodes. Swept the rest of the kit —
104
- no other instances of this shape.
105
-
106
- ## 1.2.0
107
-
108
- - New `DemoFrame.astro` — a themeable, **client-side "try it" demo** shell for
109
- static marketing sites (no backend): an eyebrow/title/intro, a row of clickable
110
- example chips, a per-example result panel (bespoke product body injected via a
111
- named slot `result-<example.id>`), a clearly-visible "sample data" disclaimer,
112
- and a primary CTA (reuses `PrimaryCta`). Tiny inline vanilla JS toggles which
113
- result shows on chip click (+ arrow-key roving tablist); the first example is
114
- visible without JS (progressive enhancement). New `DemoExample` / `DemoFrameData`
115
- types in `schema.ts`.
116
- - New `GuideCard.astro` — a themeable card for a **guides / SEO content-hub**
117
- listing, rendering one guide's tags, title, description and date. New
118
- `GuideCardData` type.
119
- - New `guideFrontmatterSchema` (Zod, built on `astro/zod`) + `GuideFrontmatter`
120
- type in `schema.ts` — plug straight into an Astro content collection
121
- (`defineCollection({ loader: glob(...), schema: guideFrontmatterSchema })`) so
122
- every product's guides validate the same shape (title, description, slug?,
123
- publishDate, updatedDate?, tags, ogImage?, canonical?, draft?). The article
124
- page + routes + JSON-LD stay product-owned.
125
- - `schema.ts` now imports `z` from `astro/zod` (Astro is already a peer dep) —
126
- the ONE runtime import; every other export stays plain types.
127
-
128
- ## 1.1.0
129
-
130
- - New `PrimaryCta.astro` — a themeable primary call-to-action (link OR spam-safe
131
- contact) with an optional secondary CTA and a `tone: 'light' | 'dark'` for
132
- dark bands. Renders a `MarketingCta` so link-vs-lead-capture + analytics wiring
133
- is no longer hand-coded per page.
134
- - New `buildPrimaryCta(opts)` helper + `PrimaryCtaOptions` in `schema.ts`: drive
135
- a primary CTA from ONE `SIGNUP_URL` constant — a real signup link when set,
136
- spam-safe lead-capture when `null` (flip at GA with no template change).
137
- - `ctaAttrs()` promoted from `PricingComparison.astro` into `schema.ts` and now
138
- shared by every CTA-rendering component (no duplication).
139
- - `TrustSection` gains three optional, guarded fields (existing sites
140
- unaffected): `foundingPartner` ("first N free during beta" panel),
141
- `founder` (honest one-line credibility) and `sampleDeliverable` (a "here's the
142
- actual report you get" showcase — image, or a `slot="sample-deliverable"` for
143
- bespoke mock markup while the section chrome stays shared).
144
-
145
- ## 1.0.0
146
-
147
- - Initial release. `PricingComparison.astro` (Free-vs-Pro comparison table with
148
- tier columns, grouped feature rows, optional footnote + one-time callout card)
149
- and `TrustSection.astro` (security cards with inline icons, customer-logo row
150
- with placeholders, testimonial placeholders, discreet built-by line).
151
- - Framework-agnostic data schema (`schema.ts`) + inline icon set (`icons.ts`).
152
- - Themed via host CSS custom properties with fallbacks; no image assets.
153
- - Extracted from `kefi-marketing` as the 2nd genuine use of the pricing/trust
154
- sections across the Astro marketing sites.
1
+ # Changelog
2
+
3
+ ## 1.12.0
4
+
5
+ ### Added
6
+
7
+ - `./logoIntro`: `runLogoIntro(options)` plays a site mark big and centred, glides it into its hero slot at its resting opacity, then runs a reveal; still under `prefers-reduced-motion`; writes `data-logo-intro` (pending, playing, done, still) on the state host; a width change mid-run finishes it. Helpers `drawStrokes`, `sweepStrokes` (logo phase) and `settleReveal` (accent rules and outlines draw, copy settles, overlays fade). FINREG-INTRO-1 "finreginfotech.com opens with a Moon Cube style logo intro".
8
+
9
+ ## 1.11.0
10
+
11
+ ### Added
12
+
13
+ - `./scrollFade`: `createScrollFade({ belowLevel, switchShare })` returns the scroll-linked opacity curve of a page-wide background (full over the hero, falling to `belowLevel`) and `isBelow`, true once less than `switchShare` of the hero is on screen; `heroProgress(scrollY, heroHeight)` gives that share (MOONCUBE-SITE-4 "Faded background continues below the hero").
14
+
15
+ ## 1.10.0
16
+
17
+ ### Added
18
+
19
+ - `./motionController`: `createMotionController(options)` runs a frame loop only while the page is visible and the target is in view, and holds a still under `prefers-reduced-motion` (MOONCUBE-SITE-3 "Stunning background, DevOps experience and ISO 27001 controls"). Its source is self-contained, so an `is:inline` script can carry it.
20
+
21
+ ### Changed
22
+
23
+ - `HeroBackdrop` uses `createMotionController`; behaviour unchanged.
24
+
25
+ ## 1.9.1
26
+
27
+ ### Fixed
28
+
29
+ - `MeetingRequestForm`: every input, select and textarea shows a 2px `:focus-visible` ring, colour `--tmk-mr-focus` (default `currentColor`; also feeds the day field's `--tmk-df-focus`). MOONCUBE-SITE-1 "Moon Cube Technologies site: read and book", D-SITE-36.
30
+
31
+ ## 1.9.0
32
+
33
+ ### Added
34
+
35
+ - `<MeetingRequestForm />` (`./MeetingRequestForm.astro`) + `./meetingRequest` helpers: preferred day, time of day, name, email, company, message; validation (past day, bad email), JSON POST with timeout, sent / rate-limited (429) / failed states, mailto assembled in the browser, honeypot `website`, Send loading state, optional Umami event. Labels and endpoint are options; no subject is sent. MOONCUBE-SITE-1 "Moon Cube Technologies site: read and book", AC-07, AC-08, AC-18, AC-20, AC-21, AC-22.
36
+ - `<DateField />` (`./DateField.astro`) + `./dateField` helpers: the shared date input for Astro sites (DATE-INPUT-1 "Every date or date-time field uses the shared input"): native picker, label, min/max, error with `aria-invalid` + `aria-describedby`, 44 px control, themed by `--tmk-df-*`. `MeetingRequestForm` uses it for the day. MOONCUBE-SITE-1, D-SITE-17.
37
+
38
+ ### Changed
39
+
40
+ - `MeetingRequestForm`: the message is required, at least 10 characters (matches the `/contact` server validator); new error kind `too-short` in `labels.errors`.
41
+
42
+ ## 1.8.0
43
+
44
+ ### Added
45
+
46
+ - `<BookingEmbed />` (`./BookingEmbed.astro`) + `./bookingEmbed` helpers: Cal.com inline embed set by options, contact fallback after 8 s or a load error, address assembled in the browser. Unit tests (vitest), lint and typecheck scripts. MOONCUBE-SITE-1 "Moon Cube Technologies site: read and book", AC-18.
47
+
48
+ ## 1.7.0
49
+
50
+ ### Added
51
+
52
+ - `<BottomSheet />` (`./BottomSheet.astro`): slot-based phone bottom sheet opened by `:target`, inline at 1024 px and up. Sits above `--dlz-consent-inset`. BEAD-ONE-2 "One-host follow-ups".
53
+
54
+ ## 1.6.1
55
+
56
+ ### Fixed
57
+
58
+ - `HairlineFigure` mount: a failed lazy-chunk load or figure mount no longer becomes an unhandled rejection. The host gets `data-hairline-failed="true"` and the page logs one `console.warn`. HAIRLINE-1 "Adopt hairline isometric line figures".
59
+ - README: a sub-path host (kefi-landings) needs `build.assetsPrefix` set to an ABSOLUTE origin serving `dist/_astro/`; a relative prefix fails silently.
60
+
61
+ ## 1.6.0
62
+
63
+ ### Added
64
+
65
+ - `<HairlineFigure />` (`./HairlineFigure.astro`) plus `HAIRLINE_FIGURES`, `TOUCH_SAFE_HAIRLINE_FIGURES` and `clampHairlineIntensity` (`./hairline`). Wraps `@lucasmarkes/hairline` 0.3.0 (exact pin): SSR 5:4 box, lazy mount near the viewport, destroy on page swap, `--hairline-*` mapped from the theming contract. HAIRLINE-1 "Adopt hairline isometric line figures".
66
+
67
+ ## 1.5.2
68
+
69
+ ### Fixed
70
+
71
+ - `.dmk-disclaimer` (DemoFrame) and `.pmk-footnote` (PricingComparison) cap their measure at 65ch; at 1280 px they ran 102-113 characters per line. Mobile is unaffected.
72
+
73
+ ## 1.3.0
74
+
75
+ ### Added
76
+
77
+ - `<HeroBackdrop />` plus the named hero-backdrop preset catalog (`./heroBackdrop`).
78
+ Nine animated hero treatments -- three canvas, one SVG-filter, five pure-CSS --
79
+ that until now existed ONLY in a disposable per-session scratchpad and had been
80
+ rebuilt from scratch more than once. `HERO_BACKDROP_PRESETS` is the permanent
81
+ record: preset name -> `{ variant, engine, palette, css, ember }`, using the
82
+ design studio's own parameter names verbatim so a studio export pastes in with
83
+ no translation step.
84
+ - `csdf-ember-sparse` -- CSDF's shipped configuration. 40 particles, an eighth of
85
+ the studio default, which is what makes a canvas backdrop affordable against a
86
+ hard Lighthouse >= 80 budget.
87
+ - Only the ember canvas engine ships as a RENDERER. The CSS/SVG entries are
88
+ recorded PARAMETER SETS painted by the host stylesheet; the component renders
89
+ nothing for those, leaving the host's own backdrop untouched.
90
+
91
+ ### Notes
92
+
93
+ - The component's script is `is:inline` deliberately -- a bundled Astro script
94
+ emits a root-absolute `/_astro/*.js` reference, which 404s under kefi-landings'
95
+ host-based per-tenant nginx roots.
96
+ - Respects `prefers-reduced-motion` (one still frame, no loop) and stops the rAF
97
+ loop on `visibilitychange` and when the canvas leaves the viewport.
98
+
99
+ ## 1.2.1
100
+
101
+ - **a11y fix (serious): the pricing comparison was SILENT to screen readers.**
102
+ `PricingComparison.astro` marked each cell with `aria-label` on a bare
103
+ `<span>`. `aria-label` is *prohibited* on a roleless generic element, so
104
+ assistive tech ignored it — and the inner `<svg>` is `aria-hidden`. Net
105
+ effect: a screen-reader user reached every included/not-included cell and
106
+ heard **nothing**, so they could not tell which plan carried which feature,
107
+ on a public pricing page. Fixed by giving the span `role="img"` alongside
108
+ the existing label. Found by the `a11y-public` E2E axe scan against the live
109
+ kefi landing: `aria-prohibited-attr`, 27 nodes. Swept the rest of the kit —
110
+ no other instances of this shape.
111
+
112
+ ## 1.2.0
113
+
114
+ - New `DemoFrame.astro` — a themeable, **client-side "try it" demo** shell for
115
+ static marketing sites (no backend): an eyebrow/title/intro, a row of clickable
116
+ example chips, a per-example result panel (bespoke product body injected via a
117
+ named slot `result-<example.id>`), a clearly-visible "sample data" disclaimer,
118
+ and a primary CTA (reuses `PrimaryCta`). Tiny inline vanilla JS toggles which
119
+ result shows on chip click (+ arrow-key roving tablist); the first example is
120
+ visible without JS (progressive enhancement). New `DemoExample` / `DemoFrameData`
121
+ types in `schema.ts`.
122
+ - New `GuideCard.astro` — a themeable card for a **guides / SEO content-hub**
123
+ listing, rendering one guide's tags, title, description and date. New
124
+ `GuideCardData` type.
125
+ - New `guideFrontmatterSchema` (Zod, built on `astro/zod`) + `GuideFrontmatter`
126
+ type in `schema.ts` — plug straight into an Astro content collection
127
+ (`defineCollection({ loader: glob(...), schema: guideFrontmatterSchema })`) so
128
+ every product's guides validate the same shape (title, description, slug?,
129
+ publishDate, updatedDate?, tags, ogImage?, canonical?, draft?). The article
130
+ page + routes + JSON-LD stay product-owned.
131
+ - `schema.ts` now imports `z` from `astro/zod` (Astro is already a peer dep) —
132
+ the ONE runtime import; every other export stays plain types.
133
+
134
+ ## 1.1.0
135
+
136
+ - New `PrimaryCta.astro` — a themeable primary call-to-action (link OR spam-safe
137
+ contact) with an optional secondary CTA and a `tone: 'light' | 'dark'` for
138
+ dark bands. Renders a `MarketingCta` so link-vs-lead-capture + analytics wiring
139
+ is no longer hand-coded per page.
140
+ - New `buildPrimaryCta(opts)` helper + `PrimaryCtaOptions` in `schema.ts`: drive
141
+ a primary CTA from ONE `SIGNUP_URL` constant — a real signup link when set,
142
+ spam-safe lead-capture when `null` (flip at GA with no template change).
143
+ - `ctaAttrs()` promoted from `PricingComparison.astro` into `schema.ts` and now
144
+ shared by every CTA-rendering component (no duplication).
145
+ - `TrustSection` gains three optional, guarded fields (existing sites
146
+ unaffected): `foundingPartner` ("first N free during beta" panel),
147
+ `founder` (honest one-line credibility) and `sampleDeliverable` (a "here's the
148
+ actual report you get" showcase — image, or a `slot="sample-deliverable"` for
149
+ bespoke mock markup while the section chrome stays shared).
150
+
151
+ ## 1.0.0
152
+
153
+ - Initial release. `PricingComparison.astro` (Free-vs-Pro comparison table with
154
+ tier columns, grouped feature rows, optional footnote + one-time callout card)
155
+ and `TrustSection.astro` (security cards with inline icons, customer-logo row
156
+ with placeholders, testimonial placeholders, discreet built-by line).
157
+ - Framework-agnostic data schema (`schema.ts`) + inline icon set (`icons.ts`).
158
+ - Themed via host CSS custom properties with fallbacks; no image assets.
159
+ - Extracted from `kefi-marketing` as the 2nd genuine use of the pricing/trust
160
+ sections across the Astro marketing sites.
package/README.md CHANGED
@@ -10,7 +10,7 @@ credibility + conversion markers an executive scans for before they trust a SaaS
10
10
  | `PrimaryCta.astro` | A themeable **primary call-to-action** (link OR spam-safe contact) with an optional secondary CTA. Pair with `buildPrimaryCta` so ONE `SIGNUP_URL` constant drives whether it's a real signup link or lead-capture. |
11
11
  | `DemoFrame.astro` | A themeable, **client-side "try it" demo** shell for static sites (no backend): eyebrow/title/intro, a row of clickable example chips, a per-example result panel (bespoke product body via a named `result-<id>` slot), a "sample data" disclaimer, and a primary CTA. Tiny inline vanilla JS toggles which result shows; first example visible without JS. |
12
12
  | `GuideCard.astro` | A themeable **card for a guides / SEO content-hub** listing — one guide's tags, title, description and date. Pair with `guideFrontmatterSchema` on an Astro content collection. |
13
- | `BookingEmbed.astro` | A **Cal.com inline booking embed** set by options (link, theme, brand colours), loaded on its page only, with a spam-safe contact fallback after a timeout or load error. |
13
+ | `BookingEmbed.astro` | A **Cal.com inline booking embed** set by options (link, theme, brand colours), loaded on its page only, with a spam-safe contact fallback after a timeout or load error. |
14
14
  | `HairlineFigure.astro` | A **Hairline isometric line figure** (`@lucasmarkes/hairline`, pinned 0.3.0) for heroes and empty states: an empty 5:4 box server-side, drawn on the client once it nears the viewport, coloured from the host's tokens. |
15
15
 
16
16
  ## Config-driven primary CTA (`PrimaryCta` + `buildPrimaryCta`)
@@ -186,29 +186,29 @@ import HairlineFigure from '@dloizides/marketing-astro-kit/HairlineFigure.astro'
186
186
  - **Script bundling:** unlike `HeroBackdrop`, this script is a bundled Astro `<script>` (it imports an npm module), so it emits a root-absolute `/_astro/*.js` URL. On a host that serves a tenant from a sub-directory (kefi-landings: the nginx root is the tenant sub-directory), set Astro's `build.assetsPrefix` to an ABSOLUTE origin (`https://cdn.example.com`) that serves this build's `dist/_astro/`, both the entry script and the lazy Hairline chunk. A relative prefix fails silently: the chunk 404s and the box stays empty, marked `data-hairline-failed` with one `console.warn`.
187
187
  - **Vite-alias consumers** (the kit aliased to source, not installed) must have `@lucasmarkes/hairline@0.3.0` resolvable from the site.
188
188
 
189
- ## Booking embed (`BookingEmbed`)
190
-
191
- ```astro
192
- ---
193
- import BookingEmbed from "@dloizides/marketing-astro-kit/BookingEmbed.astro";
194
- import { BookingTheme, CalLayout } from "@dloizides/marketing-astro-kit/bookingEmbed";
195
- ---
196
- <BookingEmbed
197
- id="book"
198
- label="Book a call"
199
- options={{ calLink: "mooncube/intro", theme: BookingTheme.Dark, layout: CalLayout.Month,
200
- hideEventTypeDetails: true, cssVarsPerTheme: { dark: { "cal-bg": "#0F1B2D", "cal-brand": "#E8C36A" } } }}
201
- contact={{ local: "hello", domain: "example.com" }}
202
- >
203
- <p slot="fallback">Calendar unavailable. Email <a data-booking-contact></a></p>
204
- </BookingEmbed>
205
- ```
206
-
207
- - Options: `calLink` (required, Cal.com path), `theme` (default dark), `layout` (default month view), `hideEventTypeDetails`, `cssVarsPerTheme` (`cal-*` names, hex only, checked at build), `timeoutMs` (default 8000), `namespace` (`^[\w-]+$`, default the host `id`), `origin` (https URL with no path, default `https://app.cal.com`; the embed script loads from `<origin>/embed/embed.js`).
208
- - The Cal.com script is added by the component script only when a host is on the page.
209
- - The fallback slot shows after `timeoutMs` with no `linkReady`, on `linkFailed`, or when the script fails, for hosts mounted by any later call too. Each `[data-booking-contact]` link gets its `mailto:` filled in the browser from `data-local` + `data-domain`; the served HTML holds no address.
210
- - `data-booking-state` on the host is `loading`, `ready` or `fallback`. Set `--tmk-booking-min-height` (default 640px).
211
-
189
+ ## Booking embed (`BookingEmbed`)
190
+
191
+ ```astro
192
+ ---
193
+ import BookingEmbed from "@dloizides/marketing-astro-kit/BookingEmbed.astro";
194
+ import { BookingTheme, CalLayout } from "@dloizides/marketing-astro-kit/bookingEmbed";
195
+ ---
196
+ <BookingEmbed
197
+ id="book"
198
+ label="Book a call"
199
+ options={{ calLink: "mooncube/intro", theme: BookingTheme.Dark, layout: CalLayout.Month,
200
+ hideEventTypeDetails: true, cssVarsPerTheme: { dark: { "cal-bg": "#0F1B2D", "cal-brand": "#E8C36A" } } }}
201
+ contact={{ local: "hello", domain: "example.com" }}
202
+ >
203
+ <p slot="fallback">Calendar unavailable. Email <a data-booking-contact></a></p>
204
+ </BookingEmbed>
205
+ ```
206
+
207
+ - Options: `calLink` (required, Cal.com path), `theme` (default dark), `layout` (default month view), `hideEventTypeDetails`, `cssVarsPerTheme` (`cal-*` names, hex only, checked at build), `timeoutMs` (default 8000), `namespace` (`^[\w-]+$`, default the host `id`), `origin` (https URL with no path, default `https://app.cal.com`; the embed script loads from `<origin>/embed/embed.js`).
208
+ - The Cal.com script is added by the component script only when a host is on the page.
209
+ - The fallback slot shows after `timeoutMs` with no `linkReady`, on `linkFailed`, or when the script fails, for hosts mounted by any later call too. Each `[data-booking-contact]` link gets its `mailto:` filled in the browser from `data-local` + `data-domain`; the served HTML holds no address.
210
+ - `data-booking-state` on the host is `loading`, `ready` or `fallback`. Set `--tmk-booking-min-height` (default 640px).
211
+
212
212
  ## Bottom sheet (`BottomSheet`)
213
213
 
214
214
  Below 1024 px the default slot opens as a bottom sheet when the URL hash equals `id`; link to `#id` to open it. From 1024 px the slot renders inline and the head and foot are hidden. The `foot` slot holds the sticky action. Set `--tmk-sheet-bg` and `--tmk-sheet-edge` to theme it (fallbacks `--paper`, `--ink`). It stays above a consent card through `--dlz-consent-inset`. The close link carries `data-sheet-close`.
@@ -302,5 +302,5 @@ The Astro build (Rollup) only needs the Vite alias — types are not required fo
302
302
  ## Motion controller
303
303
 
304
304
  `@dloizides/marketing-astro-kit/motionController` exports `createMotionController(options): { getState, sync }`. It runs `onFrame(deltaMs)` only while the page is visible and `target` is in view, and calls `onStill()` under `prefers-reduced-motion`. `forceStill` and `canRun` add host conditions; call `sync()` when they change. `watchReducedMotion: false` reads the preference once. The function references no module scope, so `HeroBackdrop` carries its source in an `is:inline` script.
305
-
306
- `@dloizides/marketing-astro-kit/scrollFade` exports `createScrollFade({ belowLevel, switchShare }): { opacity, isBelow }` and `heroProgress(scrollY, heroHeight)`. `heroProgress` is 1 at the top of the page and 0 once the hero has scrolled away; `opacity(progress)` runs from 1 down to `belowLevel`; `isBelow(progress)` is true once less than `switchShare` of the hero is on screen.
305
+
306
+ `@dloizides/marketing-astro-kit/scrollFade` exports `createScrollFade({ belowLevel, switchShare }): { opacity, isBelow }` and `heroProgress(scrollY, heroHeight)`. `heroProgress` is 1 at the top of the page and 0 once the hero has scrolled away; `opacity(progress)` runs from 1 down to `belowLevel`; `isBelow(progress)` is true once less than `switchShare` of the hero is on screen.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dloizides/marketing-astro-kit",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "Reusable, themeable Astro marketing sections for product sites — a Free-vs-Pro pricing comparison table, a trust / credibility section (security cards, customer-logo + testimonial placeholders, discreet built-by), a client-side \"try it\" demo shell, a meeting request form posting to a contact endpoint, and an SEO guides/content-hub card + frontmatter schema. Data-driven via a shared TypeScript schema; themed entirely through the host site's CSS custom properties.",
5
5
  "keywords": [
6
6
  "astro",
@@ -24,7 +24,8 @@
24
24
  "cal.com",
25
25
  "meeting-request",
26
26
  "contact-form",
27
- "date-field"
27
+ "date-field",
28
+ "logo-intro"
28
29
  ],
29
30
  "author": "dloizides",
30
31
  "license": "MIT",
@@ -62,11 +63,12 @@
62
63
  "./DateField.astro": "./src/DateField.astro",
63
64
  "./dateField": "./src/dateField/index.ts",
64
65
  "./motionController": "./src/motionController/index.ts",
65
- "./scrollFade": "./src/scrollFade/index.ts"
66
+ "./scrollFade": "./src/scrollFade/index.ts",
67
+ "./logoIntro": "./src/logoIntro/index.ts"
66
68
  },
67
69
  "scripts": {
68
70
  "test": "vitest run",
69
- "lint": "eslint src/bookingEmbed src/dateField src/meetingRequest src/motionController src/scrollFade --ext .ts",
71
+ "lint": "eslint src/bookingEmbed src/dateField src/meetingRequest src/motionController src/scrollFade src/logoIntro --ext .ts",
70
72
  "typecheck": "tsc --noEmit -p ."
71
73
  },
72
74
  "dependencies": {
@@ -0,0 +1,8 @@
1
+ export const enum LogoIntroState {
2
+ Pending = 'pending',
3
+ Playing = 'playing',
4
+ Done = 'done',
5
+ Still = 'still',
6
+ }
7
+
8
+ export const LOGO_INTRO_DATASET_KEY = 'logoIntro';
@@ -0,0 +1,53 @@
1
+ const HALF = 2;
2
+
3
+ export interface CentreSize {
4
+ widthShare: number;
5
+ heightShare: number;
6
+ maxPx: number;
7
+ centreYShare: number;
8
+ }
9
+
10
+ export interface Box {
11
+ left: number;
12
+ top: number;
13
+ width: number;
14
+ height: number;
15
+ }
16
+
17
+ export interface Viewport {
18
+ width: number;
19
+ height: number;
20
+ }
21
+
22
+ export interface MarkPlacement {
23
+ dx: number;
24
+ dy: number;
25
+ scale: number;
26
+ }
27
+
28
+ interface Measurable {
29
+ getBoundingClientRect(): { width: number; height: number };
30
+ }
31
+
32
+ export const DEFAULT_CENTRE_SIZE: CentreSize = { widthShare: 0.8, heightShare: 0.6, maxPx: 480, centreYShare: 0.46 };
33
+
34
+ /** Side of the centred mark: the smallest of its width share, height share and pixel cap. */
35
+ export function centreSide(viewport: Viewport, size: CentreSize): number {
36
+ return Math.min(viewport.width * size.widthShare, viewport.height * size.heightShare, size.maxPx);
37
+ }
38
+
39
+ /** Offset and scale that move a mark from its slot to the centre of the viewport. */
40
+ export function placeMark(slot: Box, viewport: Viewport, size: CentreSize): MarkPlacement {
41
+ const side = centreSide(viewport, size);
42
+ const dx = viewport.width / HALF - (slot.left + slot.width / HALF);
43
+ const dy = viewport.height * size.centreYShare - (slot.top + slot.height / HALF);
44
+ return { dx, dy, scale: slot.width > 0 ? side / slot.width : 1 };
45
+ }
46
+
47
+ /** First element that has a rendered box, or undefined when none is shown. */
48
+ export function pickVisible<T extends Measurable>(elements: readonly T[]): T | undefined {
49
+ return elements.find((element) => {
50
+ const box = element.getBoundingClientRect();
51
+ return box.width > 0 && box.height > 0;
52
+ });
53
+ }
@@ -0,0 +1,6 @@
1
+ export * from './LogoIntroState';
2
+ export * from './geometry';
3
+ export * from './timeline';
4
+ export * from './strokes';
5
+ export * from './settleReveal';
6
+ export * from './runLogoIntro';
@@ -0,0 +1,75 @@
1
+ import { DEFAULT_CENTRE_SIZE, pickVisible, placeMark, type CentreSize } from './geometry';
2
+ import { LOGO_INTRO_DATASET_KEY, LogoIntroState } from './LogoIntroState';
3
+ import { glideEndMs, glideKeyframes, type LogoIntroTiming } from './timeline';
4
+
5
+ export interface LogoIntroOptions {
6
+ stage: HTMLElement;
7
+ targets: readonly HTMLElement[];
8
+ timing: LogoIntroTiming;
9
+ reducedMotion: boolean;
10
+ size?: CentreSize;
11
+ stateHost?: HTMLElement;
12
+ logoPhase?: (mark: HTMLElement) => readonly Animation[];
13
+ reveal?: (stage: HTMLElement, glideStartMs: number) => readonly Animation[];
14
+ }
15
+
16
+ export interface LogoIntroController {
17
+ readonly state: LogoIntroState;
18
+ readonly done: Promise<void>;
19
+ finish(): void;
20
+ }
21
+
22
+ function setState(host: HTMLElement, state: LogoIntroState): void {
23
+ host.dataset[LOGO_INTRO_DATASET_KEY] = state;
24
+ }
25
+
26
+ function still(host: HTMLElement): LogoIntroController {
27
+ setState(host, LogoIntroState.Still);
28
+ return { state: LogoIntroState.Still, done: Promise.resolve(), finish: (): void => undefined };
29
+ }
30
+
31
+ function glide(mark: HTMLElement, options: LogoIntroOptions): Animation {
32
+ const endOpacity = getComputedStyle(mark).opacity;
33
+ const viewport = { width: window.innerWidth, height: window.innerHeight };
34
+ const placement = placeMark(mark.getBoundingClientRect(), viewport, options.size ?? DEFAULT_CENTRE_SIZE);
35
+ return mark.animate(glideKeyframes(placement, options.timing, endOpacity), {
36
+ duration: glideEndMs(options.timing),
37
+ fill: 'backwards',
38
+ });
39
+ }
40
+
41
+ function startAll(mark: HTMLElement, options: LogoIntroOptions): Animation[] {
42
+ return [
43
+ glide(mark, options),
44
+ ...(options.logoPhase?.(mark) ?? []),
45
+ ...(options.reveal?.(options.stage, options.timing.holdUntilMs) ?? []),
46
+ ];
47
+ }
48
+
49
+ /** Plays the mark centred, glides it to its slot and runs the reveal; still under reduced motion. */
50
+ export function runLogoIntro(options: LogoIntroOptions): LogoIntroController {
51
+ const host = options.stateHost ?? document.documentElement;
52
+ const mark = pickVisible(options.targets);
53
+ if (options.reducedMotion || mark === undefined) return still(host);
54
+ setState(host, LogoIntroState.Playing);
55
+ const animations = startAll(mark, options);
56
+ let state = LogoIntroState.Playing;
57
+ const finish = (): void => animations.forEach((animation) => animation.finish());
58
+ const startWidth = window.innerWidth;
59
+ const onResize = (): void => {
60
+ if (window.innerWidth !== startWidth) finish();
61
+ };
62
+ window.addEventListener('resize', onResize);
63
+ const done = Promise.allSettled(animations.map((animation) => animation.finished)).then(() => {
64
+ window.removeEventListener('resize', onResize);
65
+ state = LogoIntroState.Done;
66
+ setState(host, state);
67
+ });
68
+ return {
69
+ get state(): LogoIntroState {
70
+ return state;
71
+ },
72
+ done,
73
+ finish,
74
+ };
75
+ }
@@ -0,0 +1,146 @@
1
+ import { staggerMs } from './timeline';
2
+
3
+ export interface SettleTiming {
4
+ lineStartMs: number;
5
+ lineStepMs: number;
6
+ ruleDrawMs: number;
7
+ settleAfterMs: number;
8
+ settleMs: number;
9
+ fadeAfterMs: number;
10
+ fadeMs: number;
11
+ frameStepMs: number;
12
+ frameDrawMs: number;
13
+ fillAfterMs: number;
14
+ fillMs: number;
15
+ drawEase: string;
16
+ settleEase: string;
17
+ }
18
+
19
+ export interface LineSchedule {
20
+ ruleAt: number;
21
+ settleAt: number;
22
+ fadeAt: number;
23
+ endAt: number;
24
+ }
25
+
26
+ export interface SettleRevealOptions {
27
+ stage: HTMLElement;
28
+ lines: readonly HTMLElement[];
29
+ frames: readonly HTMLElement[];
30
+ startMs: number;
31
+ accent: string;
32
+ timing: SettleTiming;
33
+ }
34
+
35
+ interface Rect {
36
+ left: number;
37
+ top: number;
38
+ width: number;
39
+ height: number;
40
+ }
41
+
42
+ const RULE_GAP_PX = 4;
43
+ const RULE_PX = 2;
44
+ const FRAME_BORDER = '1.5px';
45
+ const SETTLE_RISE = '0 6px';
46
+ const OVERLAY_LAYER = '3';
47
+
48
+ /** When a line's rule draws, the line settles, the rule fades and all of it ends. */
49
+ export function lineSchedule(index: number, startMs: number, timing: SettleTiming): LineSchedule {
50
+ const ruleAt = staggerMs(index, startMs + timing.lineStartMs, timing.lineStepMs);
51
+ const settleAt = ruleAt + timing.settleAfterMs;
52
+ const fadeAt = settleAt + timing.fadeAfterMs;
53
+ return { ruleAt, settleAt, fadeAt, endAt: fadeAt + timing.fadeMs };
54
+ }
55
+
56
+ /** When the outline of the frame at `index` starts to draw. */
57
+ export function frameDrawAt(index: number, startMs: number, timing: SettleTiming): number {
58
+ return staggerMs(index, startMs + timing.lineStartMs, timing.frameStepMs);
59
+ }
60
+
61
+ function hasSize(element: HTMLElement): boolean {
62
+ const box = element.getBoundingClientRect();
63
+ return box.width > 0 && box.height > 0;
64
+ }
65
+
66
+ function overlay(stage: HTMLElement, box: Rect): HTMLDivElement {
67
+ const origin = stage.getBoundingClientRect();
68
+ const div = document.createElement('div');
69
+ div.setAttribute('aria-hidden', 'true');
70
+ Object.assign(div.style, {
71
+ position: 'absolute',
72
+ left: `${box.left - origin.left}px`,
73
+ top: `${box.top - origin.top}px`,
74
+ width: `${box.width}px`,
75
+ height: `${box.height}px`,
76
+ pointerEvents: 'none',
77
+ zIndex: OVERLAY_LAYER,
78
+ boxSizing: 'border-box',
79
+ });
80
+ stage.appendChild(div);
81
+ return div;
82
+ }
83
+
84
+ function removeOn(animation: Animation, element: HTMLElement): Animation {
85
+ const remove = (): void => element.remove();
86
+ animation.finished.then(remove, remove);
87
+ return animation;
88
+ }
89
+
90
+ function ruleKeyframes(at: LineSchedule, timing: SettleTiming): Keyframe[] {
91
+ const span = at.endAt - at.ruleAt;
92
+ const fadeShare = (at.fadeAt - at.ruleAt) / span;
93
+ const drawnShare = Math.min(timing.ruleDrawMs / span, fadeShare);
94
+ return [
95
+ { scale: '0 1', opacity: 1, offset: 0, easing: timing.drawEase },
96
+ { scale: '1 1', opacity: 1, offset: drawnShare },
97
+ { scale: '1 1', opacity: 1, offset: fadeShare },
98
+ { scale: '1 1', opacity: 0, offset: 1 },
99
+ ];
100
+ }
101
+
102
+ function revealLine(options: SettleRevealOptions, line: HTMLElement, index: number): Animation[] {
103
+ const { timing } = options;
104
+ const at = lineSchedule(index, options.startMs, timing);
105
+ const box = line.getBoundingClientRect();
106
+ const rule = overlay(options.stage, { left: box.left, top: box.bottom + RULE_GAP_PX, width: box.width, height: RULE_PX });
107
+ Object.assign(rule.style, { background: options.accent, transformOrigin: 'left center' });
108
+ const ruleRun = rule.animate(ruleKeyframes(at, timing), { delay: at.ruleAt, duration: at.endAt - at.ruleAt, fill: 'both' });
109
+ const settle = line.animate(
110
+ [
111
+ { opacity: 0, translate: SETTLE_RISE },
112
+ { opacity: 1, translate: '0 0' },
113
+ ],
114
+ { delay: at.settleAt, duration: timing.settleMs, easing: timing.settleEase, fill: 'backwards' },
115
+ );
116
+ return [removeOn(ruleRun, rule), settle];
117
+ }
118
+
119
+ function revealFrame(options: SettleRevealOptions, element: HTMLElement, index: number): Animation[] {
120
+ const { timing } = options;
121
+ const drawAt = frameDrawAt(index, options.startMs, timing);
122
+ const outline = overlay(options.stage, element.getBoundingClientRect());
123
+ Object.assign(outline.style, { border: `${FRAME_BORDER} solid ${options.accent}`, borderRadius: getComputedStyle(element).borderRadius });
124
+ const span = timing.frameDrawMs + timing.fadeMs;
125
+ const draw = outline.animate(
126
+ [
127
+ { clipPath: 'inset(0 100% 0 0)', opacity: 1, offset: 0, easing: timing.drawEase },
128
+ { clipPath: 'inset(0 0 0 0)', opacity: 1, offset: timing.frameDrawMs / span },
129
+ { clipPath: 'inset(0 0 0 0)', opacity: 0, offset: 1 },
130
+ ],
131
+ { delay: drawAt, duration: span, fill: 'both' },
132
+ );
133
+ const fill = element.animate([{ opacity: 0 }, { opacity: 1 }], {
134
+ delay: drawAt + timing.fillAfterMs,
135
+ duration: timing.fillMs,
136
+ fill: 'backwards',
137
+ });
138
+ return [removeOn(draw, outline), fill];
139
+ }
140
+
141
+ /** Entrance where accent rules and outlines draw, the copy settles in, then the overlays fade. */
142
+ export function settleReveal(options: SettleRevealOptions): Animation[] {
143
+ const lines = options.lines.filter(hasSize).flatMap((line, index) => revealLine(options, line, index));
144
+ const frames = options.frames.filter(hasSize).flatMap((frame, index) => revealFrame(options, frame, index));
145
+ return [...lines, ...frames];
146
+ }
@@ -0,0 +1,61 @@
1
+ import { staggerMs } from './timeline';
2
+
3
+ export interface StrokeTiming {
4
+ delayMs: number;
5
+ durationMs: number;
6
+ stepMs: number;
7
+ easing: string;
8
+ }
9
+
10
+ export interface SweepStyle {
11
+ colour: string;
12
+ dashShare: number;
13
+ width: number;
14
+ }
15
+
16
+ const LIGHT_IN = 0.2;
17
+ const LIGHT_OUT = 0.8;
18
+
19
+ /** Draws each stroke from nothing to whole, one after another. */
20
+ export function drawStrokes(strokes: readonly SVGGeometryElement[], timing: StrokeTiming): Animation[] {
21
+ return strokes.map((stroke, index) => {
22
+ stroke.setAttribute('pathLength', '1');
23
+ return stroke.animate(
24
+ [
25
+ { strokeDasharray: '1 1', strokeDashoffset: 1 },
26
+ { strokeDasharray: '1 1', strokeDashoffset: 0 },
27
+ ],
28
+ { delay: staggerMs(index, timing.delayMs, timing.stepMs), duration: timing.durationMs, easing: timing.easing, fill: 'backwards' },
29
+ );
30
+ });
31
+ }
32
+
33
+ function lightFor(stroke: SVGGeometryElement, style: SweepStyle): SVGGeometryElement {
34
+ const light = stroke.cloneNode(false) as SVGGeometryElement;
35
+ light.setAttribute('pathLength', '1');
36
+ light.setAttribute('stroke-width', String(style.width));
37
+ light.setAttribute('stroke-linecap', 'round');
38
+ light.setAttribute('stroke-dasharray', `${style.dashShare} ${1 - style.dashShare}`);
39
+ light.style.stroke = style.colour;
40
+ stroke.after(light);
41
+ return light;
42
+ }
43
+
44
+ /** Runs a short light once round each stroke, then removes it. */
45
+ export function sweepStrokes(strokes: readonly SVGGeometryElement[], timing: StrokeTiming, style: SweepStyle): Animation[] {
46
+ return strokes.map((stroke, index) => {
47
+ const light = lightFor(stroke, style);
48
+ const animation = light.animate(
49
+ [
50
+ { strokeDashoffset: 0, opacity: 0 },
51
+ { opacity: 1, offset: LIGHT_IN },
52
+ { opacity: 1, offset: LIGHT_OUT },
53
+ { strokeDashoffset: -1, opacity: 0 },
54
+ ],
55
+ { delay: staggerMs(index, timing.delayMs, timing.stepMs), duration: timing.durationMs, easing: timing.easing, fill: 'both' },
56
+ );
57
+ const remove = (): void => light.remove();
58
+ animation.finished.then(remove, remove);
59
+ return animation;
60
+ });
61
+ }
@@ -0,0 +1,30 @@
1
+ import type { MarkPlacement } from './geometry';
2
+
3
+ export interface LogoIntroTiming {
4
+ fadeInMs: number;
5
+ holdUntilMs: number;
6
+ glideMs: number;
7
+ glideEase: string;
8
+ }
9
+
10
+ /** Time at which the mark is back in its slot. */
11
+ export function glideEndMs(timing: LogoIntroTiming): number {
12
+ return timing.holdUntilMs + timing.glideMs;
13
+ }
14
+
15
+ /** Start time of the item at `index` in a staggered run. */
16
+ export function staggerMs(index: number, startMs: number, stepMs: number): number {
17
+ return startMs + index * stepMs;
18
+ }
19
+
20
+ /** Keyframes of the whole mark run: fade in centred, hold, glide home to its resting opacity. */
21
+ export function glideKeyframes(placement: MarkPlacement, timing: LogoIntroTiming, endOpacity: string): Keyframe[] {
22
+ const total = glideEndMs(timing);
23
+ const centred = { translate: `${placement.dx}px ${placement.dy}px`, scale: String(placement.scale) };
24
+ return [
25
+ { ...centred, opacity: 0, offset: 0 },
26
+ { ...centred, opacity: 1, offset: timing.fadeInMs / total },
27
+ { ...centred, opacity: 1, offset: timing.holdUntilMs / total, easing: timing.glideEase },
28
+ { translate: '0px 0px', scale: '1', opacity: endOpacity, offset: 1 },
29
+ ];
30
+ }