@keystone-sites/marketing-design-system 1.0.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/AGENTS.md +163 -0
- package/README.md +85 -0
- package/assets/media/brand/ks-lockup.svg +13 -0
- package/assets/media/brand/ks-logomark.svg +4 -0
- package/assets/media/brand/ks-wordmark-inline.svg +13 -0
- package/assets/media/brand/ks-wordmark.svg +11 -0
- package/assets/media/fonts/gt-standard-standard-vf.woff2 +0 -0
- package/assets/media/fonts/pp-kyoto-variable-upright-vf.woff2 +0 -0
- package/base.css +111 -0
- package/css-vars.d.ts +10 -0
- package/grid/engine.css +368 -0
- package/grid/field-hash.ts +31 -0
- package/grid/field.tsx +48 -0
- package/grid/gates.cjs +34 -0
- package/grid/region.tsx +97 -0
- package/icons.tsx +1224 -0
- package/index.css +77 -0
- package/lib/autoplay-gate.ts +88 -0
- package/lib/focus-trap.ts +42 -0
- package/lib/grader.ts +131 -0
- package/lib/legal-data.ts +1 -0
- package/lib/legal.ts +41 -0
- package/lib/noise.tsx +114 -0
- package/lib/render-boundary.tsx +27 -0
- package/lib/scroll-lock.ts +25 -0
- package/lib/swipe.ts +124 -0
- package/lib/use-active-section.ts +43 -0
- package/lib/use-count-up.ts +26 -0
- package/lib/use-grader-search.ts +118 -0
- package/lib/use-video-carousel.ts +271 -0
- package/media.ts +558 -0
- package/package.json +201 -0
- package/primitives/button-inline.css +52 -0
- package/primitives/button-inline.tsx +38 -0
- package/primitives/buttons.css +449 -0
- package/primitives/buttons.tsx +263 -0
- package/primitives/case-study-button.css +71 -0
- package/primitives/case-study-button.tsx +28 -0
- package/primitives/case-study-card.css +318 -0
- package/primitives/case-study-card.tsx +116 -0
- package/primitives/closer-row.css +14 -0
- package/primitives/closer-row.tsx +22 -0
- package/primitives/cta-row.css +41 -0
- package/primitives/cta-row.tsx +39 -0
- package/primitives/disclosure.css +210 -0
- package/primitives/disclosure.tsx +144 -0
- package/primitives/faq-question.css +220 -0
- package/primitives/faq-question.tsx +55 -0
- package/primitives/field.css +225 -0
- package/primitives/field.tsx +266 -0
- package/primitives/footer-item.css +72 -0
- package/primitives/footer-item.tsx +42 -0
- package/primitives/grader-menu.tsx +84 -0
- package/primitives/grader.css +302 -0
- package/primitives/grader.tsx +284 -0
- package/primitives/modal.css +151 -0
- package/primitives/modal.tsx +90 -0
- package/primitives/notice.css +39 -0
- package/primitives/notice.tsx +56 -0
- package/primitives/persona-card.css +374 -0
- package/primitives/persona-card.tsx +74 -0
- package/primitives/picture.css +11 -0
- package/primitives/picture.tsx +41 -0
- package/primitives/plan-card.css +378 -0
- package/primitives/plan-card.tsx +91 -0
- package/primitives/prose.css +118 -0
- package/primitives/prose.tsx +170 -0
- package/primitives/ramps.css +84 -0
- package/primitives/slider.css +179 -0
- package/primitives/slider.tsx +69 -0
- package/primitives/slug.css +87 -0
- package/primitives/slug.tsx +37 -0
- package/primitives/status.css +298 -0
- package/primitives/status.tsx +222 -0
- package/primitives/strip.css +40 -0
- package/primitives/surface.css +78 -0
- package/primitives/surface.tsx +95 -0
- package/primitives/table.css +226 -0
- package/primitives/table.tsx +122 -0
- package/primitives/tabs.css +85 -0
- package/primitives/tabs.tsx +122 -0
- package/primitives/text.css +110 -0
- package/primitives/toc.css +65 -0
- package/primitives/toc.tsx +42 -0
- package/rules/design-system.md +154 -0
- package/rules/grid-and-layout.md +166 -0
- package/scripts/generate-exports.mjs +61 -0
- package/scripts/generate-type-css.mjs +130 -0
- package/sections/faq-island.tsx +102 -0
- package/sections/faq.css +213 -0
- package/sections/faq.tsx +46 -0
- package/sections/footer-nav.tsx +95 -0
- package/sections/footer-signature.css +183 -0
- package/sections/footer-signature.tsx +114 -0
- package/sections/footer.css +735 -0
- package/sections/footer.tsx +283 -0
- package/sections/gallery-overlay.css +213 -0
- package/sections/gallery-overlay.tsx +267 -0
- package/sections/landing-benefits.css +59 -0
- package/sections/landing-benefits.tsx +81 -0
- package/sections/landing-closer.css +23 -0
- package/sections/landing-closer.tsx +26 -0
- package/sections/landing-hero.css +80 -0
- package/sections/landing-hero.tsx +69 -0
- package/sections/landing-quote.css +19 -0
- package/sections/landing-quote.tsx +30 -0
- package/sections/landing-sample.ts +66 -0
- package/sections/landing.css +45 -0
- package/sections/landing.tsx +69 -0
- package/sections/load-orchestrator.tsx +43 -0
- package/sections/load.css +138 -0
- package/sections/nav-desktop.css +530 -0
- package/sections/nav-desktop.tsx +155 -0
- package/sections/nav-mobile.css +571 -0
- package/sections/nav-mobile.tsx +222 -0
- package/sections/nav.css +126 -0
- package/sections/nav.tsx +394 -0
- package/sections/site-chat-data.ts +16 -0
- package/sections/site-chat-open.tsx +25 -0
- package/sections/site-chat.tsx +67 -0
- package/site-links.ts +36 -0
- package/site.ts +2 -0
- package/themes/inverted.css +139 -0
- package/tokens/fonts.css +38 -0
- package/tokens/motion.css +125 -0
- package/tokens/primitives.css +163 -0
- package/tokens/semantic.css +153 -0
- package/tokens/type-styles.json +145 -0
- package/tokens/type.css +1548 -0
- package/widgets.css +78 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/* Typography has one mechanism. An element with the `type` class carries
|
|
2
|
+
its Figma step as a generated `ts-<step>` class (tokens/type.css), which
|
|
3
|
+
sets the variables below; the element's own rule names the size the
|
|
4
|
+
design gives it at the other anchors:
|
|
5
|
+
|
|
6
|
+
--font: var(--ts-<step>-font); family and weight
|
|
7
|
+
--ls: var(--ts-<step>-ls); tracking (em)
|
|
8
|
+
--opsz: var(--ts-<step>-opsz); GT Standard optical size (sans only)
|
|
9
|
+
--case: var(--ts-<step>-case); text-transform, where the step has one
|
|
10
|
+
--fs-rm / --lh-rm size and line-height (px numbers) at
|
|
11
|
+
the 384 anchor (the ts- class sets them)
|
|
12
|
+
--fs-rs / --lh-rs the same at 576
|
|
13
|
+
--fs-rt / --lh-rt … at 768
|
|
14
|
+
--fs-rd1 / --lh-rd1 … at 960
|
|
15
|
+
--fs-rd2 / --lh-rd2 … at 1344
|
|
16
|
+
|
|
17
|
+
Size follows the grid's law (grid/engine.css) below an anchor: the
|
|
18
|
+
anchor's design zooms down with the tick, so every gate is a fresh
|
|
19
|
+
zoom of the band's anchor. Above its anchor a band holds the anchor's
|
|
20
|
+
size, unless the element names where that band runs:
|
|
21
|
+
|
|
22
|
+
--fs-rm-to / --lh-rm-to the size the 384 band runs toward
|
|
23
|
+
(reached at 576 if the band went on)
|
|
24
|
+
--fs-rs-to, --fs-rt-to, --fs-rd1-to … the same for the other bands
|
|
25
|
+
|
|
26
|
+
Usually the target is the next anchor (`--fs-rs-to: var(--fs-rt)`), so
|
|
27
|
+
the size runs straight from one designed anchor to the next; a card
|
|
28
|
+
that gains columns may run somewhere else. Every designed anchor
|
|
29
|
+
renders exactly. Only the anchors an element names are honoured: a
|
|
30
|
+
missing middle anchor sits on the line from --fs-rm to --fs-rd2, and a
|
|
31
|
+
missing --fs-rd2 holds --fs-rm. No @container block sets a size; a band
|
|
32
|
+
that switches step restates only `--font`/`--ls`/`--opsz`. Anchors
|
|
33
|
+
inherit, so a container may name the ramp for the plain `type` labels
|
|
34
|
+
inside it (`.csi-grid`); an element's own ts- class resets only --fs-rm.
|
|
35
|
+
|
|
36
|
+
--fs/--lh are the fluid unitless results; --fs-band/--lh-band are the
|
|
37
|
+
current band's anchor alone, for a component that scales through its
|
|
38
|
+
own unit and pins `--fs-px: calc(var(--_u) * var(--fs-band))`.
|
|
39
|
+
|
|
40
|
+
`type type-fixed` is site chrome (nav, footer, buttons, forms) that keeps
|
|
41
|
+
the step's px size instead of following the grid; it needs no anchors.
|
|
42
|
+
|
|
43
|
+
The only text written any other way is markdown output (`.legal-prose`,
|
|
44
|
+
`.bp-markdown`), whose elements cannot carry a class. */
|
|
45
|
+
|
|
46
|
+
.type {
|
|
47
|
+
font: var(--font);
|
|
48
|
+
letter-spacing: var(--ls, normal);
|
|
49
|
+
text-transform: var(--case, none);
|
|
50
|
+
/* Pinning the slant axis stops WebKit rendering GT Standard oblique. */
|
|
51
|
+
font-variation-settings: "opsz" var(--opsz, 10), var(--font-sans-slnt);
|
|
52
|
+
font-optical-sizing: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.type:not(.type-fixed) {
|
|
56
|
+
/* Unnamed middle anchors: the point on the rm→rd2 line. */
|
|
57
|
+
--_fs-span: calc(var(--fs-rd2, var(--fs-rm)) - var(--fs-rm));
|
|
58
|
+
--_lh-span: calc(var(--lh-rd2, var(--lh-rm)) - var(--lh-rm));
|
|
59
|
+
--_fs-rs: var(--fs-rs, calc(var(--fs-rm) + var(--_fs-span) * 0.2));
|
|
60
|
+
--_fs-rt: var(--fs-rt, calc(var(--fs-rm) + var(--_fs-span) * 0.4));
|
|
61
|
+
--_fs-rd1: var(--fs-rd1, calc(var(--fs-rm) + var(--_fs-span) * 0.6));
|
|
62
|
+
--_fs-rd2: var(--fs-rd2, var(--fs-rm));
|
|
63
|
+
--_lh-rs: var(--lh-rs, calc(var(--lh-rm) + var(--_lh-span) * 0.2));
|
|
64
|
+
--_lh-rt: var(--lh-rt, calc(var(--lh-rm) + var(--_lh-span) * 0.4));
|
|
65
|
+
--_lh-rd1: var(--lh-rd1, calc(var(--lh-rm) + var(--_lh-span) * 0.6));
|
|
66
|
+
--_lh-rd2: var(--lh-rd2, var(--lh-rm));
|
|
67
|
+
|
|
68
|
+
/* The band's anchor and where it runs above the anchor (default: holds). */
|
|
69
|
+
--fs-band: var(--fs-rm);
|
|
70
|
+
--_fs-next: var(--fs-rm-to, var(--fs-band));
|
|
71
|
+
--lh-band: var(--lh-rm);
|
|
72
|
+
--_lh-next: var(--lh-rm-to, var(--lh-band));
|
|
73
|
+
|
|
74
|
+
--fs: calc(var(--kA) * var(--fs-band) + var(--kB) * var(--_fs-next));
|
|
75
|
+
--lh: calc(var(--kA) * var(--lh-band) + var(--kB) * var(--_lh-next));
|
|
76
|
+
font-size: var(--fs-px, calc(var(--fs) * 1px));
|
|
77
|
+
line-height: var(--lh-px, calc(var(--lh) * 1px));
|
|
78
|
+
}
|
|
79
|
+
@container (--rs) {
|
|
80
|
+
.type:not(.type-fixed) {
|
|
81
|
+
--fs-band: var(--_fs-rs);
|
|
82
|
+
--_fs-next: var(--fs-rs-to, var(--fs-band));
|
|
83
|
+
--lh-band: var(--_lh-rs);
|
|
84
|
+
--_lh-next: var(--lh-rs-to, var(--lh-band));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
@container (--rt) {
|
|
88
|
+
.type:not(.type-fixed) {
|
|
89
|
+
--fs-band: var(--_fs-rt);
|
|
90
|
+
--_fs-next: var(--fs-rt-to, var(--fs-band));
|
|
91
|
+
--lh-band: var(--_lh-rt);
|
|
92
|
+
--_lh-next: var(--lh-rt-to, var(--lh-band));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
@container (--rd1) {
|
|
96
|
+
.type:not(.type-fixed) {
|
|
97
|
+
--fs-band: var(--_fs-rd1);
|
|
98
|
+
--_fs-next: var(--fs-rd1-to, var(--fs-band));
|
|
99
|
+
--lh-band: var(--_lh-rd1);
|
|
100
|
+
--_lh-next: var(--lh-rd1-to, var(--lh-band));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
@container (--rd2) {
|
|
104
|
+
.type:not(.type-fixed) {
|
|
105
|
+
--fs-band: var(--_fs-rd2);
|
|
106
|
+
--_fs-next: var(--_fs-rd2);
|
|
107
|
+
--lh-band: var(--_lh-rd2);
|
|
108
|
+
--_lh-next: var(--_lh-rd2);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/* Table of contents. Material geometry: fixed row height, fixed pads,
|
|
2
|
+
a one-pixel rail the active row's two-pixel rule replaces. The host
|
|
3
|
+
positions it (see `.toc-rail` in case-study-toc.css, `.ds-toc-rail`
|
|
4
|
+
in pages/design.css) and may override `--toc-top`. */
|
|
5
|
+
|
|
6
|
+
.toc {
|
|
7
|
+
--toc-top: var(--t);
|
|
8
|
+
--toc-item-h: 30px;
|
|
9
|
+
--toc-gap: 8px;
|
|
10
|
+
--toc-pad-l: 16px;
|
|
11
|
+
--toc-pad-r: 8px;
|
|
12
|
+
--toc-pad-y: 4px;
|
|
13
|
+
--toc-rule: 2px;
|
|
14
|
+
position: sticky;
|
|
15
|
+
top: var(--toc-top);
|
|
16
|
+
pointer-events: auto;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.toc-list {
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
list-style: none;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
gap: var(--toc-gap);
|
|
26
|
+
/* Align the left rail to the first lattice column. */
|
|
27
|
+
border-left: 1px solid var(--color-border-000);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.toc-item a {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
/* A label that wraps grows the row rather than the next one. */
|
|
35
|
+
min-height: var(--toc-item-h);
|
|
36
|
+
padding: var(--toc-pad-y) var(--toc-pad-r) var(--toc-pad-y) var(--toc-pad-l);
|
|
37
|
+
margin-left: -1px;
|
|
38
|
+
border-left: 1px solid transparent;
|
|
39
|
+
text-decoration: none;
|
|
40
|
+
color: var(--color-text-400);
|
|
41
|
+
--font: var(--ts-text-md-light-font);
|
|
42
|
+
--ls: var(--ts-text-md-light-ls);
|
|
43
|
+
--opsz: var(--ts-text-md-light-opsz);
|
|
44
|
+
transition: color var(--motion-hover-duration) var(--motion-hover-ease);
|
|
45
|
+
}
|
|
46
|
+
@media (hover: hover) {
|
|
47
|
+
.toc-item a:hover {
|
|
48
|
+
color: var(--color-text-200);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
.toc-item a:focus-visible {
|
|
52
|
+
outline: none;
|
|
53
|
+
background: var(--color-bg-300);
|
|
54
|
+
color: var(--color-text-200);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* The active rule replaces the one-pixel rail for this row. */
|
|
58
|
+
.toc-item a[aria-current="true"] {
|
|
59
|
+
border-left: var(--toc-rule) solid var(--color-teal-400);
|
|
60
|
+
padding-left: calc(var(--toc-pad-l) - var(--toc-rule) + 1px);
|
|
61
|
+
color: var(--color-text-200);
|
|
62
|
+
--font: var(--ts-text-md-medium-font);
|
|
63
|
+
--ls: var(--ts-text-md-medium-ls);
|
|
64
|
+
--opsz: var(--ts-text-md-medium-opsz);
|
|
65
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
/** A sticky table of contents: one link per section id, the active one
|
|
4
|
+
* marked by the section whose top has crossed a third of the viewport.
|
|
5
|
+
* The host decides where it sits (a rail beside the content, desktop
|
|
6
|
+
* only); this draws the list. */
|
|
7
|
+
|
|
8
|
+
import { useMemo } from "react";
|
|
9
|
+
import { useActiveSection } from "../lib/use-active-section";
|
|
10
|
+
|
|
11
|
+
export interface TocItem {
|
|
12
|
+
id: string;
|
|
13
|
+
label: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface TocProps {
|
|
17
|
+
items: readonly TocItem[];
|
|
18
|
+
ariaLabel?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function Toc({ items, ariaLabel = "On this page" }: TocProps) {
|
|
22
|
+
const ids = useMemo(() => items.map((item) => item.id), [items]);
|
|
23
|
+
const active = useActiveSection(ids);
|
|
24
|
+
if (items.length === 0) return null;
|
|
25
|
+
return (
|
|
26
|
+
<nav className="toc" aria-label={ariaLabel} data-active={active} data-landmark="toc">
|
|
27
|
+
<ul className="toc-list">
|
|
28
|
+
{items.map((item) => (
|
|
29
|
+
<li key={item.id} className="toc-item" data-id={item.id}>
|
|
30
|
+
<a
|
|
31
|
+
className="type type-fixed"
|
|
32
|
+
href={`#${item.id}`}
|
|
33
|
+
aria-current={active === item.id ? "true" : undefined}
|
|
34
|
+
>
|
|
35
|
+
{item.label}
|
|
36
|
+
</a>
|
|
37
|
+
</li>
|
|
38
|
+
))}
|
|
39
|
+
</ul>
|
|
40
|
+
</nav>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Design system: tokens and styling
|
|
2
|
+
|
|
3
|
+
> Canonical for every consumer of `@keystone-sites/marketing-design-system`.
|
|
4
|
+
> Paths are package-root (`tokens/`, `icons.tsx`, `media.ts`); a consumer's
|
|
5
|
+
> `public/media/` mirrors `assets/media/`. Edit here; consumers reference,
|
|
6
|
+
> never copy.
|
|
7
|
+
|
|
8
|
+
## Values are defined centrally, never inline
|
|
9
|
+
|
|
10
|
+
Any value that *means* something is defined once and referenced by name — even
|
|
11
|
+
with one reference today. By kind:
|
|
12
|
+
|
|
13
|
+
- **Design values** (color, spacing, radius, type, z-index, motion) → a token in
|
|
14
|
+
`tokens/`.
|
|
15
|
+
- **Designed non-token constants** → `tokens/component.css`, per band only
|
|
16
|
+
where used. Constants that reference `--t` or the weights are declared on
|
|
17
|
+
`.page`, never `:root` (a custom property resolves its inner `var()`s where
|
|
18
|
+
it is declared).
|
|
19
|
+
- **Per-island magic numbers** (timings, thresholds, beat positions) → a
|
|
20
|
+
named-constants block at the top of the island file.
|
|
21
|
+
- **Repeated CSS values** → a custom property referenced everywhere.
|
|
22
|
+
- **Copy, labels, URLs, asset paths, endpoints** → a `*-data.ts` module, the
|
|
23
|
+
media registry, or `.env` (see the consumer's `.env` and its `AGENTS.md`).
|
|
24
|
+
- Rename token and component contracts atomically. Search the full repository
|
|
25
|
+
before and after the rename. The old name has zero references, and every new
|
|
26
|
+
reference has one live definition.
|
|
27
|
+
|
|
28
|
+
The test: if another file could ever need to agree on the value, or a reader
|
|
29
|
+
would ask "why this number?", it gets a central name.
|
|
30
|
+
|
|
31
|
+
## Styling lives in the token layers
|
|
32
|
+
|
|
33
|
+
- Reference the custom properties from `tokens/` for every color, font,
|
|
34
|
+
radius, spacing, z, and motion value. No hardcoded hex or magic px in
|
|
35
|
+
component CSS.
|
|
36
|
+
- Structure rides the grid: ticks, weights, em at anchor ratios, or fixed
|
|
37
|
+
material px per band — see `rules/grid-and-layout.md`.
|
|
38
|
+
- Every hex color is a token named by role, not hue. The two commented
|
|
39
|
+
cold-load literals in the root layout (guard style, theme-color) are the
|
|
40
|
+
standing exceptions. SVG paths in `icons.tsx` may carry the exact primitive
|
|
41
|
+
token value as a fallback so exported icons remain legible outside the site
|
|
42
|
+
root; the token remains the active value inside the site.
|
|
43
|
+
- `!important` is forbidden in site styles. Fix the cascade. The base reset's
|
|
44
|
+
`[hidden]` and the token-based `.ks-consent-panel` theme bridge are the only
|
|
45
|
+
exceptions; the packaged consent widget's utilities otherwise win the
|
|
46
|
+
cascade and it exposes no theme props.
|
|
47
|
+
- If a literal appears twice with the same design intent, promote it to a
|
|
48
|
+
custom property. Two copies always drift.
|
|
49
|
+
- Type is established through the `--ts-*` tokens: `font`, `letter-spacing`,
|
|
50
|
+
`font-variation-settings: "opsz" …, var(--font-sans-slnt)`,
|
|
51
|
+
`font-optical-sizing: none`, and `text-transform` where the token carries a
|
|
52
|
+
case. Responsive section rules may override only `font-size` and
|
|
53
|
+
`line-height` with Figma-derived anchor interpolation after establishing the
|
|
54
|
+
complete token; never use a bare `font-size` as the type definition.
|
|
55
|
+
|
|
56
|
+
Inline `style={{}}` is allowed only for: forwarding a per-instance value the
|
|
57
|
+
CSS cannot know (a color role, a frame index); CSS custom properties consumed
|
|
58
|
+
by a stylesheet rule (`style={{ '--gx': n }}`, `setProperty("--eng-x", …)`);
|
|
59
|
+
transient animation state (`willChange`). A value that never changes per
|
|
60
|
+
instance belongs in a class.
|
|
61
|
+
|
|
62
|
+
## The z-index scale
|
|
63
|
+
|
|
64
|
+
Tokens in `tokens/component.css`: `--z-base` · `--z-raised` · `--z-sticky` ·
|
|
65
|
+
`--z-nav` · `--z-modal` · `--z-portal`. Anything that stacks against the rest
|
|
66
|
+
of the page uses a token. Inside one isolated stacking context, siblings may
|
|
67
|
+
use small consecutive integers; values above `3` are reserved for finite
|
|
68
|
+
ordered stacks such as staggered drawer rows. They never compete with the
|
|
69
|
+
global token scale.
|
|
70
|
+
|
|
71
|
+
## Motion grammars
|
|
72
|
+
|
|
73
|
+
Motion is a vocabulary of named CSS grammars in `tokens/motion.css` — each
|
|
74
|
+
defined in prose in the file (draw-down, fade-rise, the chip wipe, the
|
|
75
|
+
carousel slide). No animation runtime ships.
|
|
76
|
+
|
|
77
|
+
- Reuse before inventing. A new grammar is named and defined in prose first.
|
|
78
|
+
- Constants are born in `component.css` and promote to `motion.css` at their
|
|
79
|
+
second consumer, values unchanged, prior names becoming aliases. Alias
|
|
80
|
+
curves; never fork them.
|
|
81
|
+
- Opens run the ease-in-out curve; closes run the ease-out. A hard shadow never
|
|
82
|
+
paints while its box moves: the offset grows from 0,0 after the box lands
|
|
83
|
+
and drops at once on close.
|
|
84
|
+
- Choreographies settle: a load choreography ends its run explicitly on the
|
|
85
|
+
final beat's `animationend`, so band-gated variants never replay motion on
|
|
86
|
+
resize.
|
|
87
|
+
- `prefers-reduced-motion: reduce` renders every grammar state-to-state — no
|
|
88
|
+
transitions, no timers, elements born settled. A no-JS render shows the same
|
|
89
|
+
settled state.
|
|
90
|
+
- Hover styles sit under `@media (hover: hover)`; every state also works on
|
|
91
|
+
touch.
|
|
92
|
+
|
|
93
|
+
## CSS transition constraints
|
|
94
|
+
|
|
95
|
+
- Colors do not transition on gradients; transition the opacity of an absolute
|
|
96
|
+
child that carries the gradient.
|
|
97
|
+
- An inline `style` color overrides a CSS color transition; apply the inline
|
|
98
|
+
style only while active.
|
|
99
|
+
- Never start a `translate`/transform transition inside an element whose paint
|
|
100
|
+
is transitioning — the compositor layer re-rasters the ancestor mid-paint
|
|
101
|
+
(a one-frame flicker `will-change` does not fix). Animate a paint-in-place
|
|
102
|
+
offset (relative `left`) for small moves. `translate` is fine where no
|
|
103
|
+
ancestor paint transitions.
|
|
104
|
+
- Use a CSS `filter` for desaturation on anything whose background transitions;
|
|
105
|
+
`mix-blend-mode: luminosity` interacts badly with it.
|
|
106
|
+
|
|
107
|
+
## Fonts are licensed
|
|
108
|
+
|
|
109
|
+
**GT Standard Standard VF** and **PP Kyoto Variable Upright** are licensed and
|
|
110
|
+
not on any public CDN. Never `@import` them from a URL; never commit them to a
|
|
111
|
+
public mirror. Files live in `public/media/fonts/`, loaded by `@font-face` in
|
|
112
|
+
`tokens/fonts.css` and preloaded by the root layout. GT Standard's variable
|
|
113
|
+
default weight is 900: every style sets an explicit weight or text renders
|
|
114
|
+
Black. Per-step optical-size pins live in `tokens/type.css`.
|
|
115
|
+
|
|
116
|
+
## SVG and icons
|
|
117
|
+
|
|
118
|
+
- Vector geometry is never hand-authored. Icons and marks are exported
|
|
119
|
+
verbatim from Figma through the console bridge; the only permitted edit is
|
|
120
|
+
normalizing paint to `currentColor` where the icon tints with text.
|
|
121
|
+
- Shapes with no vector geometry — dots, plain circles and squares, corner
|
|
122
|
+
triangles — are CSS with token fills, not files.
|
|
123
|
+
- Never export with Figma's Exclude / Boolean Subtract; ask for a flattened
|
|
124
|
+
re-export (background as one `<path>`, foreground as separate paths with
|
|
125
|
+
explicit fills).
|
|
126
|
+
- Threshold: used once and ≤ ~20 lines → inline in the component; used twice
|
|
127
|
+
anywhere → `icons.tsx` with `color`/`size` props; complex artwork → a
|
|
128
|
+
file in `public/media/` registered in `media.ts`. SVG markup appears in
|
|
129
|
+
source exactly once.
|
|
130
|
+
|
|
131
|
+
## Images are art-directed tier sets
|
|
132
|
+
|
|
133
|
+
Photography renders as `<picture>` with one media-gated `<source>` per width
|
|
134
|
+
tier and the smallest tier as the `<img>` fallback. Tier cuts follow the
|
|
135
|
+
structural gates; cut each at 2× its band's rendered frame. Explicit
|
|
136
|
+
`width`/`height` on every image; WebP only; `alt=""` for ambient photography.
|
|
137
|
+
The deploy serves static assets directly (`images.unoptimized`) — the tier
|
|
138
|
+
markup is the delivery mechanism.
|
|
139
|
+
|
|
140
|
+
## Public assets and the media registry
|
|
141
|
+
|
|
142
|
+
Static media lives under `public/media/`, organized by function
|
|
143
|
+
(`hero-carousel/`, `portfolio/`, `engines/`, `testimonials/`, `brand/`,
|
|
144
|
+
`fonts/`). Only favicons, `og-image.png`, and `site.webmanifest` sit at the
|
|
145
|
+
public root.
|
|
146
|
+
|
|
147
|
+
`media.ts` is the single source of truth mapping every asset
|
|
148
|
+
to its path with a typed descriptor. Code never hardcodes an asset path. The
|
|
149
|
+
only literal paths are the contexts that cannot import TS: `@font-face` in
|
|
150
|
+
`fonts.css`, the root layout's preload hrefs, and app metadata.
|
|
151
|
+
|
|
152
|
+
Names are lowercase kebab-case, most general to most specific, identifiable
|
|
153
|
+
without opening the file. Match the folder's existing pattern. Delete replaced
|
|
154
|
+
assets and their registry entries.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Grid and layout
|
|
2
|
+
|
|
3
|
+
> Canonical for every consumer of `@keystone-sites/marketing-design-system`.
|
|
4
|
+
> Paths are package-root (`grid/engine.css`, `grid/gates.cjs`). Edit here;
|
|
5
|
+
> consumers reference, never copy.
|
|
6
|
+
|
|
7
|
+
The engine, painting, hairlines, and lattice alignment live in
|
|
8
|
+
`grid/engine.css`. These laws govern on top of them.
|
|
9
|
+
|
|
10
|
+
## The band system
|
|
11
|
+
|
|
12
|
+
Five anchors where a design exists and renders exact; four structural gates
|
|
13
|
+
at the bands' geometric midpoints, gated by **container queries** on
|
|
14
|
+
`.site-root` — never media queries.
|
|
15
|
+
|
|
16
|
+
| band | gate (written as) | opens at | anchor | tick `--t` |
|
|
17
|
+
|---|---|---|---|---|
|
|
18
|
+
| `rm` | — | — | 384 | 32px |
|
|
19
|
+
| `rs` | `@container (--rs)` | 470 | 576 | 48px |
|
|
20
|
+
| `rt` | `@container (--rt)` | 665 | 768 | 64px |
|
|
21
|
+
| `rd1` | `@container (--rd1)` | 860 | 960 | 80px |
|
|
22
|
+
| `rd2` | `@container (--rd2)` | 1130 | 1344 | 112px |
|
|
23
|
+
|
|
24
|
+
Gates are always written by name — `(--rs)`, `(--rt)`, `(--rd1)`, `(--rd2)`,
|
|
25
|
+
and the closed forms `(--below-rs)`, `(--below-rt)`, `(--below-rd1)`,
|
|
26
|
+
`(--rt-only)` — and resolved by the PostCSS plugin `grid/gates.cjs`; a pixel
|
|
27
|
+
width never appears in a container query.
|
|
28
|
+
|
|
29
|
+
- The tick is the page container's width ÷ 12, capped at 112px. Base CSS is
|
|
30
|
+
the 384 design (mobile-first); each gate overrides upward.
|
|
31
|
+
- **Nearest-anchor rendering.** Every width renders the nearest anchor's
|
|
32
|
+
design: stretched below its anchor, compressed above the gate. In a
|
|
33
|
+
compressed slice the weights collapse to a pure zoom of that anchor, so wrap
|
|
34
|
+
counts and designed clearances hold by construction.
|
|
35
|
+
- Above 1344 the tick caps, the weights pin at 0/1, and the 1344 design
|
|
36
|
+
renders byte-exact at every wider width. The page box (12t) centers on a
|
|
37
|
+
whole-pixel offset (`--page-x`); the freed gutters paint the side fields
|
|
38
|
+
(`.gf-*`, deterministic server-side hash, never animated). Fixed chrome
|
|
39
|
+
carries `--page-x`.
|
|
40
|
+
- Three-anchor pages may be designed at 384 · 768 · 1344 only. `rs` renders
|
|
41
|
+
the 384 design on its tick; `rd1` derives from the 1344 design unless the
|
|
42
|
+
section rules otherwise. A frame drawn later supersedes the derivation.
|
|
43
|
+
- JavaScript that needs the band measures the container (ResizeObserver) or
|
|
44
|
+
reads computed style — never `matchMedia`.
|
|
45
|
+
- Design and acceptance cover all five anchors and one width per structural
|
|
46
|
+
slice, scrollbar forced on. The automated grid sweep is only for lattice
|
|
47
|
+
contract changes.
|
|
48
|
+
|
|
49
|
+
## The four units
|
|
50
|
+
|
|
51
|
+
Every dimension belongs to exactly one unit. Classifying it is the first
|
|
52
|
+
decision.
|
|
53
|
+
|
|
54
|
+
1. **Ticks** — structure: column positions, section heights, exposure regions,
|
|
55
|
+
component footprints. Written in `--t`; fluid by construction.
|
|
56
|
+
2. **Weights** — text columns: wrap-pinning widths and text-block heights in
|
|
57
|
+
flow margins interpolate `calc(var(--wA)*V0 + var(--wB)*V1)` between the
|
|
58
|
+
band's anchors.
|
|
59
|
+
3. **Em at anchor ratios** — line-internal spacing: inline gaps, chip paddings
|
|
60
|
+
ride the type.
|
|
61
|
+
4. **Material** — fixed px per band: buttons, icons, marks, control inners.
|
|
62
|
+
Primitives are material (fixed px per size variant, never band-aware);
|
|
63
|
+
sections choose the size variant per band and own each instance's width.
|
|
64
|
+
|
|
65
|
+
A px value that secretly encodes ticks, weights, or type is a defect: it breaks
|
|
66
|
+
rag, fit, or clearance in the compressed slices. Constants that reference `--t`
|
|
67
|
+
or the weights are declared on `.page`, never `:root`.
|
|
68
|
+
|
|
69
|
+
## The grid and type laws
|
|
70
|
+
|
|
71
|
+
- **Hold-then-switch.** Type interpolates between a band's two anchors only
|
|
72
|
+
when both carry the same structure. At a structural switch, type holds its
|
|
73
|
+
last designed value across the band and switches with the structure at the
|
|
74
|
+
gate.
|
|
75
|
+
- **Size and line-height interpolate; weight and tracking are band
|
|
76
|
+
constants**, restated per band.
|
|
77
|
+
- **Band constants ride the weights.** A designed value constant across a band
|
|
78
|
+
is `calc((var(--wA) + var(--wB)) * V)`, never `Vpx`, so it zooms with the
|
|
79
|
+
tick in the compressed slices. Fixed px broke wraps and rail clearance the
|
|
80
|
+
day sections met the compressed slices.
|
|
81
|
+
- **Line-inclusive content boxes.** A bordered box whose edge lies on exposed
|
|
82
|
+
lattice is sized `k·t + 1px`, so its border lands on the line's pixel. A box
|
|
83
|
+
sized `k·t` exactly doubles the hairline.
|
|
84
|
+
- **The tick wins.** A whole-tick box height governs over its declared padding
|
|
85
|
+
sum; slack compresses padding or sits as clear space.
|
|
86
|
+
- **Content clears the lattice.** Flowed content never touches a tick line or
|
|
87
|
+
another block and keeps at least half a tick of vertical clearance from the
|
|
88
|
+
next section or a bottom-anchored block. Copy never silently compresses a
|
|
89
|
+
gap and never overlaps a sibling: when it needs more room the frame grows
|
|
90
|
+
(see *Flow frames*). **The painted lattice rides the growth**: a region
|
|
91
|
+
drawn against content anchors to the edge it belongs to (`gy` from the
|
|
92
|
+
section top, `gyb` from the section bottom, both to stretch between them),
|
|
93
|
+
so it moves with the frame. A cell left on its drawn row while content
|
|
94
|
+
moves is a defect.
|
|
95
|
+
- **Derived states.** When design supplies one archetype state, siblings
|
|
96
|
+
derive as the smallest whole-tick height that fits their content at the
|
|
97
|
+
band's internals; the derivation is written in a comment at the value.
|
|
98
|
+
- **Choreographies settle.** A load choreography ends explicitly on the final
|
|
99
|
+
beat's `animationend`; band-gated variants re-entering the tree have nothing
|
|
100
|
+
to replay.
|
|
101
|
+
- **Proportional primitives.** A primitive may be declared proportional (the
|
|
102
|
+
pricing button): every interior value is a designed-px-over-anchor-cell
|
|
103
|
+
fraction, so a mount that passes the page tick scales the control with the
|
|
104
|
+
grid. The tell in Figma: when a set's cells equal the anchor ticks
|
|
105
|
+
(32/48/64/80/112), read those px as `1t`.
|
|
106
|
+
- **Overlay chrome** (the nav) never participates in a section's tick stack.
|
|
107
|
+
- **Audits at rest.** Mid-flight motion may be fractional-tick by design; the
|
|
108
|
+
stack-sum, landmark, and exposed-cell clearance audits assert at rest in
|
|
109
|
+
every state. A clearance failure is a collision first.
|
|
110
|
+
- **Rendered truth over metadata.** Every landmark is verified against
|
|
111
|
+
rendered bounds, never Figma metadata `x`/`y`.
|
|
112
|
+
|
|
113
|
+
## Flow frames
|
|
114
|
+
|
|
115
|
+
A design fixes every block's rows at its anchor; a render between anchors,
|
|
116
|
+
or with longer copy, must not collide. Every section is therefore a **flow
|
|
117
|
+
frame**: the designed rows are minimums, and content that needs more room
|
|
118
|
+
pushes everything after it down by exactly what it needs.
|
|
119
|
+
|
|
120
|
+
- A section, card, or text block declares its designed rows as
|
|
121
|
+
`min-height: calc(var(--t) * k)`, never `height`. Media frames and
|
|
122
|
+
controls that hold a fixed tick footprint (`k·t` images, buttons, the
|
|
123
|
+
system diagram) are **tick blocks** and keep `height`.
|
|
124
|
+
- A text block that owns rows uses `.flow-budget` with `--budget` set to
|
|
125
|
+
those rows; its trailing half tick is the clearance to the next block and
|
|
126
|
+
is slack inside the budget.
|
|
127
|
+
- Blocks stack in normal flow: CSS grid (`grid-template-areas`, one row per
|
|
128
|
+
designed row band, `minmax(k·t, auto)` rows) or a flex column. A block's
|
|
129
|
+
designed offset from the previous block is `margin-top`; a bottom-anchored
|
|
130
|
+
block in a frame is `margin-top: auto`, not `position: absolute; bottom`.
|
|
131
|
+
A shared-pixel seam is `margin-bottom: -1px` on the flowed box.
|
|
132
|
+
- Text wraps inside `max-width`, never a fixed `width`.
|
|
133
|
+
- A gap derived by subtraction (a designed top minus the block above, a
|
|
134
|
+
tick minus a material row) floors with `max()` at a spacing token. Type
|
|
135
|
+
stops zooming below the smallest anchor while the tick keeps shrinking, so
|
|
136
|
+
an unfloored derivation goes negative and blocks collide.
|
|
137
|
+
- **The flow contract is what the grid checks verify.** At an anchor every
|
|
138
|
+
section renders its designed rows exactly — growth at an anchor is a defect
|
|
139
|
+
in the section. Between anchors a section may grow by what its copy needs;
|
|
140
|
+
every later section moves down by that growth, and the stack sum carries
|
|
141
|
+
it. Landmarks inside a grown section are audited at the anchors.
|
|
142
|
+
- Regions anchor to the section edge they belong to (`gy`, `gyb`, or both to
|
|
143
|
+
stretch); nothing publishes per-content "extra ticks".
|
|
144
|
+
|
|
145
|
+
## Layout must scale — no fragile positioning
|
|
146
|
+
|
|
147
|
+
Absolute positioning is acceptable only for: media fills (`inset: 0;
|
|
148
|
+
object-fit: cover` in a grid-sized parent); the exposure vocabulary
|
|
149
|
+
(`--gx`/`--gy`/`--gyb` ticks); overlay layers (nav chrome, modal backdrops,
|
|
150
|
+
decorative pseudo-elements, a menu anchored to its control, a tag hanging off
|
|
151
|
+
a card edge); a true escape from document flow (viewport-fixed controls, the
|
|
152
|
+
case-study rail). Everything else is normal flow.
|
|
153
|
+
|
|
154
|
+
| Anti-pattern | Fix |
|
|
155
|
+
|---|---|
|
|
156
|
+
| Fixed px coordinates from Figma's ruler | ticks/weights, grid areas or flex order + `margin-top` |
|
|
157
|
+
| `position: absolute; top: k·t` on ordinary content | grid row / flow order with a tick `margin-top` |
|
|
158
|
+
| `height: k·t` on a section or text frame | `min-height: k·t` (flow frame) |
|
|
159
|
+
| Fixed px widths on text containers | `max-width` weight-riding wrap boxes |
|
|
160
|
+
| Per-content height overrides (`extraTicks`, breakpoint-specific `height`) | flow frame that grows with its content |
|
|
161
|
+
| `line-height: 0` as a spacing hack | flex column + gap |
|
|
162
|
+
| Magic gaps | tick or em expressions per the four units |
|
|
163
|
+
| Media queries for band switches | container queries at the gates |
|
|
164
|
+
|
|
165
|
+
Always: no fixed widths that overflow at 384; touch targets ≥ 44 × 44 px;
|
|
166
|
+
no hover-only interactions.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/** Writes the `exports` map in package.json from the filesystem.
|
|
3
|
+
*
|
|
4
|
+
* Consumers import extensionless subpaths (`.../grid/field`,
|
|
5
|
+
* `.../sections/nav`) and CSS by filename (`.../index.css`). Bundlers and
|
|
6
|
+
* TypeScript resolve those through `exports`, so every shipped module and
|
|
7
|
+
* stylesheet is listed explicitly; run this after adding or moving a file.
|
|
8
|
+
*
|
|
9
|
+
* node scripts/generate-exports.mjs
|
|
10
|
+
*/
|
|
11
|
+
import { readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
12
|
+
import { dirname, join, relative } from "node:path";
|
|
13
|
+
import { fileURLToPath } from "node:url";
|
|
14
|
+
|
|
15
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
16
|
+
const pkgPath = join(root, "package.json");
|
|
17
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
18
|
+
|
|
19
|
+
const DIRS = ["tokens", "grid", "primitives", "sections", "lib", "themes"];
|
|
20
|
+
const ROOT_FILES = [
|
|
21
|
+
"index.css",
|
|
22
|
+
"base.css",
|
|
23
|
+
"widgets.css",
|
|
24
|
+
"icons.tsx",
|
|
25
|
+
"media.ts",
|
|
26
|
+
"site.ts",
|
|
27
|
+
"site-links.ts",
|
|
28
|
+
"css-vars.d.ts",
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const exportsMap = { ".": "./index.css", "./package.json": "./package.json" };
|
|
32
|
+
|
|
33
|
+
function add(file) {
|
|
34
|
+
const rel = "./" + relative(root, file).split("\\").join("/");
|
|
35
|
+
if (rel.endsWith(".d.ts")) return; // ambient augmentation, referenced by path
|
|
36
|
+
if (/\.test\.tsx?$/.test(rel)) return; // unit tests stay out of the surface
|
|
37
|
+
if (
|
|
38
|
+
rel.endsWith(".css") ||
|
|
39
|
+
rel.endsWith(".json") ||
|
|
40
|
+
rel.endsWith(".js") ||
|
|
41
|
+
rel.endsWith(".cjs")
|
|
42
|
+
) {
|
|
43
|
+
exportsMap[rel] = rel;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const bare = rel.replace(/\.(tsx?|mjs)$/, "");
|
|
47
|
+
exportsMap[bare] = rel;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
for (const f of ROOT_FILES) add(join(root, f));
|
|
51
|
+
for (const d of DIRS) {
|
|
52
|
+
const dir = join(root, d);
|
|
53
|
+
for (const name of readdirSync(dir).sort()) {
|
|
54
|
+
const file = join(dir, name);
|
|
55
|
+
if (statSync(file).isFile()) add(file);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
pkg.exports = exportsMap;
|
|
60
|
+
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
|
|
61
|
+
console.log(`exports: ${Object.keys(exportsMap).length} entries`);
|