@uxfront/ui 0.4.2 → 0.6.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @uxfront/ui
2
2
 
3
- Vue components for the uxfront.com family of homepages. With them, a product site gets the same look and feel as uxfront.com. That includes the scroll-driven WebGL scene of [`@uxfront/scene`](../scene), pinned chapters that step through their details, the HUD, the header, the finale and the error page.
3
+ Vue components for the uxfront.com family of homepages. With them, a product site gets the same look and feel as uxfront.com. That includes the scroll-driven WebGL scene of [`@uxfront/scene`](../scene), chapters that step through their details as they scroll by, the HUD, the header, the finale and the error page.
4
4
 
5
5
  In a Nuxt app, extend [`@uxfront/layer-ui`](../layer-ui) instead of installing this package: the layer registers the components and composables, self-hosts the fonts and keeps the first paint free of scripts.
6
6
 
@@ -80,17 +80,23 @@ const scene = [
80
80
 
81
81
  ## Components
82
82
 
83
- | Component | Role |
84
- | -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
85
- | `UxSite` | The page root. Takes the `scene` (one formation per section), starts it on mount and brings the base styles. Slots: `header`, `hud` (defaults to `UxHud`), `anchors`, `controls`, `fallback` and the sections. |
86
- | `UxHero` | The first section: kicker (with an optional `badge`, like "New"), a title in `UxHeroLine`s (with `title` for assistive technology), a lead, an index of sections for small screens and a scroll cue. |
87
- | `UxChapter` | A pinned section: eyebrow (`index`, `role`), `title`, `lead` slot, details and a link. `align="end"` puts the copy on the right, `valign="end"` at the bottom, `steps` highlights details one by one. |
88
- | `UxFinale` | The closing section: a large `mark` slot, kicker, `title`, `lead`, an `actions` slot (buttons), a grid of link `cards` and a `footer`. |
89
- | `UxPillars`, `UxChips`, `UxTraits`, `UxSpec` | Chapter details that light up one after another (set `steps` on the chapter to their count). |
90
- | `UxHeader` | Brand (`mark` slot, `UxFrontMark` by default, empty for none; `brand` slot to style the name), a `byline` slot beside it for links like "by UXFront", section nav (marks the one held), an `actions` slot for extra links and a GitHub link (with an optional `githubStars` count). |
91
- | `UxHud` | Particle count and fps, the chapter counter and progress, and the Motion toggle. |
92
- | `UxAnchor` | A label pinned to a formation anchor, like `plates:0`: `callout`, `tag` or `button` (put buttons in the `controls` slot). |
93
- | `UxPillLink`, `UxErrorPage`, icons | The scrambled pill link, a full error page, and `UxArrowIcon`, `UxGithubIcon`, `UxStarIcon`, `UxFrameworkLogo`, `UxFrontMark`. |
83
+ | Component | Role |
84
+ | -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
85
+ | `UxSite` | The page root. Takes the `scene` (one formation per section), starts it on mount and brings the base styles. Slots: `header`, `hud` (defaults to `UxHud`), `anchors`, `controls`, `fallback` and the sections. |
86
+ | `UxHero` | The first section: kicker (with an optional `badge`, like "New"), a title in `UxHeroLine`s (with `title` for assistive technology), a lead, an index of sections for small screens and a scroll cue. |
87
+ | `UxChapter` | A full-screen section: eyebrow (`index`, `role`), `title`, `lead` slot, details and a link. `align="end"` puts the copy on the right, `valign="end"` at the bottom, `steps` highlights details one by one. |
88
+ | `UxFinale` | The closing section: a large `mark` slot, kicker, `title`, `lead`, an `actions` slot (buttons), a grid of link `cards` and a `footer`. |
89
+ | `UxSplit` | A chapter with its code or a picture beside the copy: `UxChapter`'s eyebrow, `title`, `lead` slot, details, link and `steps`, plus an `aside` slot. Side by side, the copy takes `UxChapter`'s width and the aside centres on the frame's three-quarter line, at most `52rem` wide; on stacked screens the aside goes below the copy. `align="center"` centres the copy in one column, for a split with no aside. |
90
+ | `UxSection` | A section with a chapter's heading (`index`, `role`, `title`, `lead` slot) over a `72rem` panel, for wide content like plans or an FAQ. |
91
+ | `UxPillars`, `UxChips`, `UxTraits`, `UxSpec` | Chapter details that light up one after another (set `steps` on the chapter to their count). |
92
+ | `UxCode` | A code panel captioned with its `title`, for a split's aside. Pass plain text as `code`, or highlighted markup, like Shiki's, in the default slot: it takes the dark theme's colours and scrolls past `70svh`. |
93
+ | `UxVideo` | A muted, looping video (`src`, `poster`, `width`, `height`, `label`) that loads and plays once it scrolls into view and pauses out of view. With reduced motion, or Motion off in the HUD, it pauses and shows its controls. It takes its container's width, and a class on it sets another. |
94
+ | `UxHeader` | Brand (`mark` slot, `UxFrontMark` by default, empty for none; `brand` slot to style the name), a `byline` slot beside it for links like "by UXFront", section nav (marks the one held), an `actions` slot for extra links and a GitHub link (with an optional `githubStars` count). |
95
+ | `UxHud` | Particle count and fps, the chapter counter and progress, and the Motion toggle. |
96
+ | `UxAnchor` | A label pinned to a formation anchor, like `plates:0`: `callout`, `tag` or `button` (put buttons in the `controls` slot). |
97
+ | `UxPillLink`, `UxErrorPage`, icons | The scrambled pill link, a full error page, and `UxArrowIcon`, `UxGithubIcon`, `UxStarIcon`, `UxFrameworkLogo`, `UxFrontMark`. |
98
+
99
+ A `UxTraits` item with an `href` is a link, with an arrow after its title. It's a plain `<a>`, so it loads the page rather than navigating in the app.
94
100
 
95
101
  Also exported: `useExperience()` (the scene's reactive state inside a `UxSite`), the `v-scramble` directive, `FRAMEWORKS` and their logos, and `uxRenderHookKey`.
96
102
 
@@ -110,3 +116,21 @@ The tokens are the shared look, so sites shouldn't need to change them. If one m
110
116
  Keep `--ux-bg` at `#050507`: the scene's canvas paints that colour itself.
111
117
 
112
118
  The typefaces are Geist, Geist Mono and Instrument Serif (`--font-ux-sans`, `--font-ux-mono`, `--font-ux-serif`). Without Nuxt, load them yourself.
119
+
120
+ ### The frame
121
+
122
+ On a wide screen, a line of copy that runs the whole width is hard to read, so the pages sit in a centred frame `--ux-frame` wide, `1920px` by default. Past that width, `--ux-gutter`, which pads the sections, the header, the HUD and the error page, grows by half the extra width. At `1920px` and below, it's `--ux-gutter-base` (`clamp(1.25rem, 3.2vw, 3rem)`), so nothing moves. The scene reads `--ux-frame` too, and draws its formations inside the same frame while the canvas fills the screen. On a screen taller than four fifths of the frame's width (1536px for `1920px`), the scene widens its band to 5:4 of the height, which its formations need (see `@uxfront/scene`).
123
+
124
+ | Token | Default | Effect |
125
+ | ------------------ | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
126
+ | `--ux-frame` | `1920px` | The frame's width, as a px length. `100vw` turns the frame off. |
127
+ | `--ux-gutter-base` | `clamp(1.25rem, 3.2vw, 3rem)` | The gutter inside the frame. Use it, rather than `--ux-gutter`, for a space that shouldn't grow with the frame. |
128
+ | `--ux-gutter` | Computed | The larger of `--ux-gutter-base` and `(100vw - --ux-frame) / 2 + --ux-gutter-base`. Read it, but set the two tokens above. |
129
+
130
+ Override `--ux-frame` on `:root:has(.ux-site)`, where the gutter is computed: on any other element, the gutter keeps the default frame. Leave `--ux-gutter` itself alone, or the page frames twice.
131
+
132
+ ```css
133
+ :root:has(.ux-site) {
134
+ --ux-frame: 1200px; /* or 100vw, for no frame */
135
+ }
136
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxfront/ui",
3
- "version": "0.4.2",
3
+ "version": "0.6.0",
4
4
  "description": "Vue components for the uxfront.com family of homepages: a scroll-driven WebGL scene with pinned chapters, a HUD, a header and a finale, in one look.",
5
5
  "keywords": [
6
6
  "components",
@@ -39,7 +39,7 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@uxfront/scene": "^0.3.0"
42
+ "@uxfront/scene": "^0.5.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@uxfront/typescript-config": "0.1.0",
@@ -15,7 +15,7 @@ const { align = "start", valign = "center" } = defineProps<{
15
15
  align?: "start" | "end";
16
16
  /** "end" leaves the upper half of the screen to the formation. */
17
17
  valign?: "center" | "end";
18
- /** Items (`data-step-item="0"`, `"1"`, …) highlighted one after another while the chapter is pinned. */
18
+ /** Items (`data-step-item="0"`, `"1"`, …) highlighted one after another as the chapter scrolls by. */
19
19
  steps?: number;
20
20
  }>();
21
21
 
@@ -35,48 +35,42 @@ defineSlots<{
35
35
  :data-steps="steps"
36
36
  :aria-labelledby="`${id}-title`"
37
37
  >
38
- <div class="ux-chapter__pin">
39
- <div class="ux-chapter__body" data-reveal>
40
- <p v-if="index || role" class="ux-chapter__eyebrow">
41
- <span>{{ index }}</span>
42
- <span class="ux-chapter__rule" />
43
- <span>{{ role }}</span>
44
- </p>
45
- <h2 :id="`${id}-title`" class="ux-chapter__title">{{ title }}</h2>
46
- <p v-if="$slots.lead" class="ux-chapter__lead"><slot name="lead" /></p>
47
- <slot />
48
- <UxPillLink
49
- v-if="href"
50
- class="ux-chapter__link"
51
- :href="href"
52
- :label="linkLabel ?? href.replace(/^https?:\/\//, '')"
53
- />
54
- </div>
38
+ <div class="ux-chapter__body" data-reveal>
39
+ <p v-if="index || role" class="ux-chapter__eyebrow">
40
+ <span>{{ index }}</span>
41
+ <span class="ux-chapter__rule" />
42
+ <span>{{ role }}</span>
43
+ </p>
44
+ <h2 :id="`${id}-title`" class="ux-chapter__title">{{ title }}</h2>
45
+ <p v-if="$slots.lead" class="ux-chapter__lead"><slot name="lead" /></p>
46
+ <slot />
47
+ <UxPillLink
48
+ v-if="href"
49
+ class="ux-chapter__link"
50
+ :href="href"
51
+ :label="linkLabel ?? href.replace(/^https?:\/\//, '')"
52
+ />
55
53
  </div>
56
54
  </section>
57
55
  </template>
58
56
 
59
57
  <style scoped>
58
+ /* One screen per chapter. The page scrolls freely: the copy moves with it
59
+ while the scene holds the chapter's formation behind it. */
60
60
  .ux-chapter {
61
61
  position: relative;
62
- height: 240vh;
63
- }
64
-
65
- .ux-chapter__pin {
66
- position: sticky;
67
- top: 0;
68
62
  display: flex;
69
63
  align-items: center;
70
- height: 100vh;
71
- height: 100svh;
64
+ min-height: 100vh;
65
+ min-height: 100svh;
72
66
  padding: 6rem var(--ux-gutter) 5rem;
73
67
  }
74
68
 
75
- .ux-chapter--right .ux-chapter__pin {
69
+ .ux-chapter--right {
76
70
  justify-content: flex-end;
77
71
  }
78
72
 
79
- .ux-chapter--bottom .ux-chapter__pin {
73
+ .ux-chapter--bottom {
80
74
  align-items: flex-end;
81
75
  }
82
76
 
@@ -138,9 +132,9 @@ defineSlots<{
138
132
  backdrop-filter: blur(8px);
139
133
  }
140
134
 
141
- /* Short screens: the pinned copy has to fit between the header and the HUD. */
135
+ /* Short screens: the copy still fits one screen, between the header and the HUD. */
142
136
  @media (max-height: 860px) {
143
- .ux-chapter__pin {
137
+ .ux-chapter {
144
138
  padding-top: 5rem;
145
139
  padding-bottom: 4rem;
146
140
  }
@@ -166,13 +160,10 @@ defineSlots<{
166
160
 
167
161
  /* Portrait, squarish and small screens (STACKED_QUERY in @uxfront/scene,
168
162
  which frames the camera to match): the formation owns the top of the
169
- screen and the copy scrolls over it, instead of a tall pinned block hiding
170
- the art. */
163
+ screen and the copy starts below it, then scrolls over it. */
171
164
  @media (max-aspect-ratio: 5/4), (max-width: 1099px) and (max-aspect-ratio: 8/5) {
172
- .ux-chapter__pin {
173
- position: relative;
165
+ .ux-chapter {
174
166
  display: block;
175
- height: auto;
176
167
  padding: 58svh var(--ux-gutter) 0;
177
168
  }
178
169
 
@@ -197,13 +188,11 @@ defineSlots<{
197
188
  }
198
189
  }
199
190
 
200
- /* Landscape phones: too short to pin the copy, wide enough to keep the
201
- formation beside it. The copy scrolls past in its own column. */
191
+ /* Landscape phones: too short to fit the copy on one screen, wide enough to
192
+ keep the formation beside it. The copy scrolls past in its own column. */
202
193
  @media (max-width: 1099px) and (min-aspect-ratio: 1601/1000) {
203
- .ux-chapter__pin {
204
- position: relative;
194
+ .ux-chapter {
205
195
  display: block;
206
- height: auto;
207
196
  padding: 24svh var(--ux-gutter) 20svh;
208
197
  }
209
198
 
@@ -0,0 +1,84 @@
1
+ <script setup lang="ts">
2
+ defineProps<{
3
+ /** The caption, like a file name: `styleframe.config.ts`. */
4
+ title: string;
5
+ /** Plain text, shown as is. Leave it out to put highlighted markup in the default slot. */
6
+ code?: string;
7
+ }>();
8
+
9
+ defineSlots<{
10
+ /** One or more highlighted `<pre>` blocks, like Shiki's output. */
11
+ default?(): unknown;
12
+ }>();
13
+ </script>
14
+
15
+ <template>
16
+ <!-- A code sample in a window frame, named after its file. Plain `code`
17
+ grows with its text. Highlighted markup scrolls past 70svh, and each of
18
+ its <pre> blocks draws the rule above it, dashed between two. -->
19
+ <figure class="ux-code" :class="{ 'ux-code--plain': code !== undefined }" data-outline>
20
+ <figcaption class="ux-mono">{{ title }}</figcaption>
21
+ <pre v-if="code !== undefined"><code>{{ code }}</code></pre>
22
+ <slot v-else />
23
+ </figure>
24
+ </template>
25
+
26
+ <style scoped>
27
+ .ux-code {
28
+ margin: 0;
29
+ border: 1px solid var(--ux-line-strong);
30
+ border-radius: 6px;
31
+ background: rgb(5 5 7 / 0.85);
32
+ backdrop-filter: blur(10px);
33
+ overflow: hidden;
34
+ text-shadow: none;
35
+ }
36
+
37
+ .ux-code figcaption {
38
+ padding: 0.6rem 1rem;
39
+ font-size: 0.75rem;
40
+ color: var(--ux-fg-3);
41
+ }
42
+
43
+ .ux-code :deep(pre) {
44
+ max-height: 70svh;
45
+ margin: 0;
46
+ padding: 1rem;
47
+ overflow: auto;
48
+ font-family: var(--font-ux-mono);
49
+ font-size: 0.8125rem;
50
+ line-height: 1.6;
51
+ color: var(--ux-fg-2);
52
+ border-top: 1px solid var(--ux-line);
53
+ }
54
+
55
+ .ux-code :deep(pre + pre) {
56
+ border-top-style: dashed;
57
+ }
58
+
59
+ .ux-code :deep(.line) {
60
+ display: block;
61
+ }
62
+
63
+ .ux-code--plain figcaption {
64
+ border-bottom: 1px solid var(--ux-line);
65
+ }
66
+
67
+ .ux-code--plain pre {
68
+ max-height: none;
69
+ overflow-x: auto;
70
+ border-top: 0;
71
+ }
72
+
73
+ /* The page is always dark: take the dark theme's colours, whatever colour
74
+ mode the app left on <html>. Shiki's dual themes set the colours with
75
+ `html.light .shiki span` and `html.dark .shiki span`, so this outranks them.
76
+ A touch of the foreground lifts dim comments, like #676e95, to 4.5:1. */
77
+ html .ux-code :deep(pre span) {
78
+ color: color-mix(in srgb, var(--shiki-dark), var(--ux-fg) 12%);
79
+ background: none;
80
+ font-style: var(--shiki-dark-font-style);
81
+ font-weight: var(--shiki-dark-font-weight);
82
+ text-decoration: var(--shiki-dark-text-decoration);
83
+ }
84
+ </style>
@@ -51,7 +51,7 @@ inject(uxRenderHookKey, null)?.();
51
51
  gap: 1.5rem;
52
52
  min-height: 100vh;
53
53
  min-height: 100svh;
54
- padding: var(--ux-gutter);
54
+ padding: var(--ux-gutter-base) var(--ux-gutter);
55
55
  background: radial-gradient(60% 50% at 70% 40%, rgb(120 140 255 / 0.08), transparent 70%);
56
56
  }
57
57
 
@@ -16,53 +16,45 @@ defineSlots<{
16
16
  lead?(): unknown;
17
17
  /** Below the lead, like a `UxPillLink` to the docs. */
18
18
  actions?(): unknown;
19
- /** The page's footer, pinned to the bottom of the screen. Links in it are styled. */
19
+ /** The page's footer, at the bottom of the screen. Links in it are styled. */
20
20
  footer?(): unknown;
21
21
  }>();
22
22
  </script>
23
23
 
24
24
  <template>
25
25
  <section :id="id" class="ux-finale" data-stage :aria-labelledby="`${id}-title`">
26
- <div class="ux-finale__pin">
27
- <div class="ux-finale__body" data-reveal>
28
- <div v-if="$slots.mark" class="ux-finale__mark"><slot name="mark" /></div>
29
- <p v-if="kicker" class="ux-finale__kicker ux-mono">{{ kicker }}</p>
30
- <h2 :id="`${id}-title`" class="ux-finale__title"><slot name="title" /></h2>
31
- <p v-if="$slots.lead" class="ux-finale__lead"><slot name="lead" /></p>
32
- <div v-if="$slots.actions" class="ux-finale__actions"><slot name="actions" /></div>
33
- <ul v-if="cards.length" class="ux-finale__grid">
34
- <li v-for="card in cards" :key="card.href">
35
- <a :href="card.href">
36
- <span v-if="card.meta" class="ux-mono">{{ card.meta }}</span>
37
- <strong>{{ card.name }}</strong>
38
- <span class="ux-finale__domain">
39
- <span v-scramble>{{ card.domain ?? card.href.replace(/^https?:\/\//, "") }}</span>
40
- <UxArrowIcon />
41
- </span>
42
- </a>
43
- </li>
44
- </ul>
45
- </div>
46
- <footer v-if="$slots.footer" class="ux-finale__footer ux-mono"><slot name="footer" /></footer>
26
+ <div class="ux-finale__body" data-reveal>
27
+ <div v-if="$slots.mark" class="ux-finale__mark"><slot name="mark" /></div>
28
+ <p v-if="kicker" class="ux-finale__kicker ux-mono">{{ kicker }}</p>
29
+ <h2 :id="`${id}-title`" class="ux-finale__title"><slot name="title" /></h2>
30
+ <p v-if="$slots.lead" class="ux-finale__lead"><slot name="lead" /></p>
31
+ <div v-if="$slots.actions" class="ux-finale__actions"><slot name="actions" /></div>
32
+ <ul v-if="cards.length" class="ux-finale__grid">
33
+ <li v-for="card in cards" :key="card.href">
34
+ <a :href="card.href">
35
+ <span v-if="card.meta" class="ux-mono">{{ card.meta }}</span>
36
+ <strong>{{ card.name }}</strong>
37
+ <span class="ux-finale__domain">
38
+ <span v-scramble>{{ card.domain ?? card.href.replace(/^https?:\/\//, "") }}</span>
39
+ <UxArrowIcon />
40
+ </span>
41
+ </a>
42
+ </li>
43
+ </ul>
47
44
  </div>
45
+ <footer v-if="$slots.footer" class="ux-finale__footer ux-mono"><slot name="footer" /></footer>
48
46
  </section>
49
47
  </template>
50
48
 
51
49
  <style scoped>
52
50
  .ux-finale {
53
51
  position: relative;
54
- height: 200vh;
55
- }
56
-
57
- .ux-finale__pin {
58
- position: sticky;
59
- top: 0;
60
52
  display: flex;
61
53
  flex-direction: column;
62
54
  justify-content: center;
63
55
  align-items: center;
64
- height: 100vh;
65
- height: 100svh;
56
+ min-height: 100vh;
57
+ min-height: 100svh;
66
58
  padding: 6rem var(--ux-gutter) 4rem;
67
59
  text-align: center;
68
60
  }
@@ -213,17 +205,9 @@ defineSlots<{
213
205
  }
214
206
  }
215
207
 
216
- /* The finale no longer fits one pinned screen: it flows, footer last. */
208
+ /* The finale no longer fits one screen beside its footer: footer last. */
217
209
  @media (max-width: 1099px), (max-aspect-ratio: 5/4), (max-height: 700px) {
218
210
  .ux-finale {
219
- height: auto;
220
- }
221
-
222
- .ux-finale__pin {
223
- position: relative;
224
- height: auto;
225
- min-height: 100vh;
226
- min-height: 100svh;
227
211
  padding: 7rem var(--ux-gutter) 5.5rem;
228
212
  }
229
213
 
@@ -0,0 +1,99 @@
1
+ <script setup lang="ts">
2
+ defineProps<{
3
+ id: string;
4
+ /** Eyebrow before the rule, like `01`. */
5
+ index?: string;
6
+ /** Eyebrow after the rule. */
7
+ role?: string;
8
+ title: string;
9
+ }>();
10
+
11
+ defineSlots<{
12
+ lead?(): unknown;
13
+ default(): unknown;
14
+ }>();
15
+ </script>
16
+
17
+ <template>
18
+ <!-- A section with a chapter's heading and room for wide content, like
19
+ plans or an FAQ, on a panel that keeps it legible over the scene. Like
20
+ UxChapter, it holds a formation while it's on screen. -->
21
+ <section :id="id" class="ux-section" data-stage :aria-labelledby="`${id}-title`">
22
+ <div class="ux-section__head" data-reveal>
23
+ <p v-if="index || role" class="ux-section__eyebrow">
24
+ <span>{{ index }}</span>
25
+ <span class="ux-section__rule" />
26
+ <span>{{ role }}</span>
27
+ </p>
28
+ <h2 :id="`${id}-title`" class="ux-section__title">{{ title }}</h2>
29
+ <p v-if="$slots.lead" class="ux-section__lead"><slot name="lead" /></p>
30
+ </div>
31
+ <div class="ux-section__panel">
32
+ <slot />
33
+ </div>
34
+ </section>
35
+ </template>
36
+
37
+ <style scoped>
38
+ .ux-section {
39
+ position: relative;
40
+ min-height: 100vh;
41
+ min-height: 100svh;
42
+ padding: 8rem var(--ux-gutter) 6rem;
43
+ }
44
+
45
+ .ux-section__head,
46
+ .ux-section__panel {
47
+ width: min(100%, 72rem);
48
+ margin: 0 auto;
49
+ }
50
+
51
+ .ux-section__head {
52
+ margin-bottom: 2.5rem;
53
+ }
54
+
55
+ .ux-section__eyebrow {
56
+ display: flex;
57
+ align-items: center;
58
+ gap: 0.75rem;
59
+ margin: 0 0 1.5rem;
60
+ font-family: var(--font-ux-mono);
61
+ font-size: 0.75rem;
62
+ letter-spacing: 0.08em;
63
+ text-transform: uppercase;
64
+ color: var(--ux-fg-2);
65
+ }
66
+
67
+ .ux-section__rule {
68
+ width: 2.5rem;
69
+ height: 1px;
70
+ background: var(--ux-line-strong);
71
+ }
72
+
73
+ .ux-section__title {
74
+ max-width: 48rem;
75
+ margin: 0 0 1.25rem;
76
+ font-size: clamp(2.5rem, 1.2rem + 3.6vw, 4.5rem);
77
+ font-weight: 500;
78
+ line-height: 0.95;
79
+ letter-spacing: -0.055em;
80
+ text-wrap: balance;
81
+ }
82
+
83
+ .ux-section__lead {
84
+ max-width: 40rem;
85
+ font-size: clamp(1.0625rem, 0.95rem + 0.4vw, 1.25rem);
86
+ line-height: 1.45;
87
+ color: var(--ux-fg-2);
88
+ text-wrap: pretty;
89
+ }
90
+
91
+ .ux-section__panel {
92
+ padding: clamp(1rem, 0.5rem + 2vw, 2rem);
93
+ border: 1px solid var(--ux-line);
94
+ border-radius: 8px;
95
+ background: rgb(5 5 7 / 0.82);
96
+ backdrop-filter: blur(12px);
97
+ text-shadow: none;
98
+ }
99
+ </style>
@@ -0,0 +1,243 @@
1
+ <script setup lang="ts">
2
+ import { computed } from "vue";
3
+
4
+ import { useExperience } from "../composables/experience";
5
+ import UxPillLink from "./UxPillLink.vue";
6
+
7
+ const { align = "start" } = defineProps<{
8
+ id: string;
9
+ /** Eyebrow before the rule, like `01`. */
10
+ index?: string;
11
+ /** Eyebrow after the rule. */
12
+ role?: string;
13
+ title: string;
14
+ href?: string;
15
+ /** Label of the link; defaults to `href` without its protocol. */
16
+ linkLabel?: string;
17
+ /** Items (`data-step-item="0"`, `"1"`, …) highlighted one after another as the chapter scrolls by. */
18
+ steps?: number;
19
+ /** "center" centres the copy in one column, for a section with no aside. */
20
+ align?: "start" | "center";
21
+ }>();
22
+
23
+ defineSlots<{
24
+ lead?(): unknown;
25
+ /** Details below the lead, like `UxTraits`. */
26
+ default?(): unknown;
27
+ /** The code or a picture, beside the copy, or below it on stacked screens. */
28
+ aside?(): unknown;
29
+ }>();
30
+
31
+ // The code panel or picture (`[data-outline]`) fades in once the `outline`
32
+ // formation has gathered around it (`--ux-reveal`, set by the scene). Only
33
+ // once the scene draws, and with motion: the prerendered page, a loading scene
34
+ // and the fallback show it at once.
35
+ const { state } = useExperience();
36
+ const fade = computed(() => state.status === "ready" && state.motion);
37
+ </script>
38
+
39
+ <template>
40
+ <!-- A chapter with its code or a picture beside the copy. Like UxChapter, it
41
+ holds a formation while it's on screen, from its stage (`data-stage`),
42
+ which starts 15vh above the section: the formation morphs in by the time
43
+ the section's top is 40% down the screen, which leaves the aside room to
44
+ fade in once it has. The stage carries the chapter's `id`, since the
45
+ scene names the active chapter after it and the header marks the link
46
+ to it. -->
47
+ <section
48
+ class="ux-split"
49
+ :class="{ 'ux-split--center': align === 'center' }"
50
+ :data-fade="fade || undefined"
51
+ :aria-labelledby="`${id}-title`"
52
+ >
53
+ <div :id="id" class="ux-split__stage" data-stage :data-steps="steps">
54
+ <div class="ux-split__grid">
55
+ <div class="ux-split__copy" data-reveal>
56
+ <p v-if="index || role" class="ux-split__eyebrow">
57
+ <span>{{ index }}</span>
58
+ <span class="ux-split__rule" />
59
+ <span>{{ role }}</span>
60
+ </p>
61
+ <h2 :id="`${id}-title`" class="ux-split__title">{{ title }}</h2>
62
+ <p v-if="$slots.lead" class="ux-split__lead"><slot name="lead" /></p>
63
+ <slot />
64
+ <UxPillLink
65
+ v-if="href"
66
+ class="ux-split__link"
67
+ :href="href"
68
+ :label="linkLabel ?? href.replace(/^https?:\/\//, '')"
69
+ />
70
+ </div>
71
+ <div v-if="$slots.aside" class="ux-split__aside">
72
+ <slot name="aside" />
73
+ </div>
74
+ </div>
75
+ </div>
76
+ </section>
77
+ </template>
78
+
79
+ <style scoped>
80
+ .ux-split {
81
+ --ux-split-lead: 15vh;
82
+ position: relative;
83
+ display: flex;
84
+ min-height: 100vh;
85
+ min-height: 100svh;
86
+ padding: 0 var(--ux-gutter);
87
+ }
88
+
89
+ /* The whole section, and 15vh above it, over the end of the one before,
90
+ without moving the copy; the part above takes no clicks. A link to the
91
+ chapter still lands on the section's top. */
92
+ .ux-split__stage {
93
+ scroll-margin-top: calc(-1 * var(--ux-split-lead));
94
+ display: flex;
95
+ align-items: center;
96
+ width: 100%;
97
+ margin-top: calc(-1 * var(--ux-split-lead));
98
+ padding: calc(var(--ux-split-lead) + 6rem) 0 5rem;
99
+ pointer-events: none;
100
+ }
101
+
102
+ /* No column gap: the aside's own padding sets the space beside the copy. */
103
+ .ux-split__grid {
104
+ display: grid;
105
+ align-items: center;
106
+ row-gap: clamp(2rem, 1rem + 3vw, 4rem);
107
+ width: 100%;
108
+ pointer-events: auto;
109
+ }
110
+
111
+ .ux-split__eyebrow {
112
+ display: flex;
113
+ align-items: center;
114
+ gap: 0.75rem;
115
+ margin: 0 0 1.5rem;
116
+ font-family: var(--font-ux-mono);
117
+ font-size: 0.75rem;
118
+ letter-spacing: 0.08em;
119
+ text-transform: uppercase;
120
+ color: var(--ux-fg-2);
121
+ }
122
+
123
+ .ux-split__rule {
124
+ width: 2.5rem;
125
+ height: 1px;
126
+ background: var(--ux-line-strong);
127
+ }
128
+
129
+ .ux-split__title {
130
+ margin: 0 0 1.5rem;
131
+ font-size: clamp(2.75rem, 1.2rem + 4.6vw, 5.75rem);
132
+ font-weight: 500;
133
+ line-height: 0.92;
134
+ letter-spacing: -0.055em;
135
+ text-wrap: balance;
136
+ }
137
+
138
+ .ux-split__lead {
139
+ margin: 0 0 2rem;
140
+ font-size: clamp(1.0625rem, 0.95rem + 0.4vw, 1.25rem);
141
+ line-height: 1.45;
142
+ color: var(--ux-fg);
143
+ text-wrap: pretty;
144
+ }
145
+
146
+ .ux-split__link {
147
+ margin-top: 2.25rem;
148
+ }
149
+
150
+ .ux-split__aside {
151
+ min-width: 0;
152
+ }
153
+
154
+ /* Side by side (outside STACKED_QUERY in @uxfront/scene), the copy takes
155
+ UxChapter's width at the gutter, and the aside is centred on three quarters
156
+ of the frame, at most 52rem wide: the right half, less the gutter inside the
157
+ frame on its left. Its media and code panels centre in it, whatever their
158
+ own margins. */
159
+ @media not ((max-aspect-ratio: 5/4) or ((max-width: 1099px) and (max-aspect-ratio: 8/5))) {
160
+ .ux-split__grid {
161
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
162
+ }
163
+
164
+ .ux-split__copy {
165
+ width: min(100%, 33rem, 40vw);
166
+ }
167
+
168
+ .ux-split__aside {
169
+ padding-left: var(--ux-gutter-base);
170
+ }
171
+
172
+ .ux-split .ux-split__aside :deep([data-outline]) {
173
+ max-width: 52rem;
174
+ margin-inline: auto;
175
+ }
176
+ }
177
+
178
+ /* Portrait, squarish and small screens (STACKED_QUERY in @uxfront/scene):
179
+ the aside goes below the copy. */
180
+ @media (max-aspect-ratio: 5/4), (max-width: 1099px) and (max-aspect-ratio: 8/5) {
181
+ .ux-split__grid {
182
+ grid-template-columns: minmax(0, 1fr);
183
+ }
184
+ }
185
+
186
+ /* In once the `outline` formation has gathered: hidden until its first
187
+ frame sets `--ux-reveal`. Only the opacity changes, so the panel stays
188
+ put. */
189
+ .ux-split[data-fade] .ux-split__aside :deep([data-outline]) {
190
+ opacity: var(--ux-reveal, 0);
191
+ }
192
+
193
+ .ux-split--center .ux-split__grid {
194
+ grid-template-columns: minmax(0, 1fr);
195
+ }
196
+
197
+ /* The eyebrow, title, lead and link are centred; the details below keep
198
+ their own alignment. */
199
+ .ux-split--center .ux-split__copy {
200
+ justify-self: center;
201
+ width: min(100%, 48rem);
202
+ }
203
+
204
+ .ux-split--center .ux-split__eyebrow {
205
+ justify-content: center;
206
+ }
207
+
208
+ .ux-split--center .ux-split__title,
209
+ .ux-split--center .ux-split__lead {
210
+ text-align: center;
211
+ }
212
+
213
+ .ux-split--center .ux-split__link {
214
+ display: flex;
215
+ width: fit-content;
216
+ margin-inline: auto;
217
+ }
218
+
219
+ /* Short screens: tighter, like UxChapter. */
220
+ @media (max-height: 860px) {
221
+ .ux-split__stage {
222
+ padding-top: calc(var(--ux-split-lead) + 5rem);
223
+ padding-bottom: 4rem;
224
+ }
225
+
226
+ .ux-split__eyebrow {
227
+ margin-bottom: 1rem;
228
+ }
229
+
230
+ .ux-split__title {
231
+ margin-bottom: 1rem;
232
+ font-size: clamp(2.5rem, 8vh, 5.75rem);
233
+ }
234
+
235
+ .ux-split__lead {
236
+ margin-bottom: 1.25rem;
237
+ }
238
+
239
+ .ux-split__link {
240
+ margin-top: 1.5rem;
241
+ }
242
+ }
243
+ </style>
@@ -5,12 +5,21 @@ defineProps<{ items: UxTrait[] }>();
5
5
  </script>
6
6
 
7
7
  <template>
8
- <!-- A two-column grid of cells that light up one after another (set `steps` on the UxChapter). -->
8
+ <!-- A two-column grid of cells that light up one after another (set `steps` on the UxChapter).
9
+ A cell with `href` is a link. -->
9
10
  <ul class="ux-traits">
10
- <li v-for="(item, i) in items" :key="item.title" :data-step-item="i">
11
- <strong>{{ item.title }}</strong>
12
- <span>{{ item.text }}</span>
13
- </li>
11
+ <template v-for="(item, i) in items" :key="item.title">
12
+ <li v-if="item.href" class="ux-traits__linked" :data-step-item="i">
13
+ <a class="ux-traits__link" :href="item.href">
14
+ <strong>{{ item.title }}</strong>
15
+ <span>{{ item.text }}</span>
16
+ </a>
17
+ </li>
18
+ <li v-else :data-step-item="i">
19
+ <strong>{{ item.title }}</strong>
20
+ <span>{{ item.text }}</span>
21
+ </li>
22
+ </template>
14
23
  </ul>
15
24
  </template>
16
25
 
@@ -25,7 +34,8 @@ defineProps<{ items: UxTrait[] }>();
25
34
  background: var(--ux-line);
26
35
  }
27
36
 
28
- .ux-traits li {
37
+ .ux-traits li,
38
+ .ux-traits__link {
29
39
  display: grid;
30
40
  align-content: start;
31
41
  gap: 0.4rem;
@@ -40,6 +50,23 @@ defineProps<{ items: UxTrait[] }>();
40
50
  );
41
51
  }
42
52
 
53
+ /* A linked cell is the link, edge to edge. */
54
+ .ux-traits .ux-traits__linked {
55
+ display: block;
56
+ padding: 0;
57
+ background: none;
58
+ }
59
+
60
+ .ux-traits__link {
61
+ height: 100%;
62
+ text-decoration: none;
63
+ transition: background 0.5s var(--ux-ease-out);
64
+ }
65
+
66
+ .ux-traits__link:hover {
67
+ background: rgb(255 255 255 / 0.08);
68
+ }
69
+
43
70
  .ux-traits strong {
44
71
  font-size: 1rem;
45
72
  font-weight: 500;
@@ -47,12 +74,18 @@ defineProps<{ items: UxTrait[] }>();
47
74
  color: var(--ux-fg);
48
75
  }
49
76
 
77
+ .ux-traits__link strong::after {
78
+ content: " →";
79
+ color: var(--ux-fg-3);
80
+ }
81
+
50
82
  @media (max-width: 760px) {
51
83
  .ux-traits {
52
84
  grid-template-columns: 1fr;
53
85
  }
54
86
 
55
- .ux-traits li {
87
+ .ux-traits li,
88
+ .ux-traits__link {
56
89
  padding: 0.7rem 0.9rem;
57
90
  }
58
91
  }
@@ -0,0 +1,81 @@
1
+ <script setup lang="ts">
2
+ import { computed, onBeforeUnmount, onMounted, ref, useTemplateRef, watch } from "vue";
3
+
4
+ import { useExperience } from "../composables/experience";
5
+
6
+ defineProps<{
7
+ src: string;
8
+ /** The image shown until the video plays, and the only part that loads with the page. */
9
+ poster: string;
10
+ width: number;
11
+ height: number;
12
+ /** The video's accessible name, describing what it shows. */
13
+ label: string;
14
+ }>();
15
+
16
+ // Only the poster loads with the page: the video loads and plays once it
17
+ // scrolls into view, and pauses out of view. Visitors who prefer reduced
18
+ // motion, or who turned Motion off in the HUD, get it paused, with controls.
19
+ const { state } = useExperience();
20
+ const video = useTemplateRef<HTMLVideoElement>("video");
21
+ const reducedMotion = ref(false);
22
+ const still = computed(() => reducedMotion.value || !state.motion);
23
+ let inView = false;
24
+ let observer: IntersectionObserver | undefined;
25
+
26
+ const follow = () => {
27
+ const el = video.value;
28
+ if (!el || still.value) return;
29
+ if (inView) el.play().catch(() => {});
30
+ else el.pause();
31
+ };
32
+
33
+ onMounted(() => {
34
+ reducedMotion.value = matchMedia("(prefers-reduced-motion: reduce)").matches;
35
+ observer = new IntersectionObserver(([entry]) => {
36
+ inView = entry?.isIntersecting ?? false;
37
+ follow();
38
+ });
39
+ observer.observe(video.value!);
40
+ });
41
+ onBeforeUnmount(() => observer?.disconnect());
42
+
43
+ watch(still, (now) => {
44
+ if (now) video.value?.pause();
45
+ else follow();
46
+ });
47
+ </script>
48
+
49
+ <template>
50
+ <video
51
+ ref="video"
52
+ class="ux-video"
53
+ :poster="poster"
54
+ :width="width"
55
+ :height="height"
56
+ :aria-label="label"
57
+ :controls="still"
58
+ preload="none"
59
+ muted
60
+ loop
61
+ playsinline
62
+ >
63
+ <source :src="src" type="video/mp4" />
64
+ </video>
65
+ </template>
66
+
67
+ <style scoped>
68
+ .ux-video {
69
+ display: block;
70
+ height: auto;
71
+ border: 1px solid var(--ux-line-strong);
72
+ border-radius: 6px;
73
+ background: var(--ux-bg);
74
+ }
75
+
76
+ /* The container's width by default. :where() keeps this rule below any class
77
+ a page sets on the video, like `width: min(100%, 70svh)`. */
78
+ :where(.ux-video) {
79
+ width: 100%;
80
+ }
81
+ </style>
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { default as UxAnchor } from "./components/UxAnchor.vue";
2
2
  export { default as UxChapter } from "./components/UxChapter.vue";
3
3
  export { default as UxChips } from "./components/UxChips.vue";
4
+ export { default as UxCode } from "./components/UxCode.vue";
4
5
  export { default as UxErrorPage } from "./components/UxErrorPage.vue";
5
6
  export { default as UxFinale } from "./components/UxFinale.vue";
6
7
  export { default as UxHeader } from "./components/UxHeader.vue";
@@ -9,11 +10,14 @@ export { default as UxHeroLine } from "./components/UxHeroLine.vue";
9
10
  export { default as UxHud } from "./components/UxHud.vue";
10
11
  export { default as UxPillLink } from "./components/UxPillLink.vue";
11
12
  export { default as UxPillars } from "./components/UxPillars.vue";
13
+ export { default as UxSection } from "./components/UxSection.vue";
12
14
  export { default as UxSite } from "./components/UxSite.vue";
13
15
  export { default as UxSpec } from "./components/UxSpec.vue";
16
+ export { default as UxSplit } from "./components/UxSplit.vue";
14
17
  export { default as UxStage } from "./components/UxStage.vue";
15
18
  export { default as UxStageFallback } from "./components/UxStageFallback.vue";
16
19
  export { default as UxTraits } from "./components/UxTraits.vue";
20
+ export { default as UxVideo } from "./components/UxVideo.vue";
17
21
  export { default as UxArrowIcon } from "./components/icons/UxArrowIcon.vue";
18
22
  export { default as UxFrameworkLogo } from "./components/icons/UxFrameworkLogo.vue";
19
23
  export { default as UxFrontMark } from "./components/icons/UxFrontMark.vue";
@@ -7,9 +7,13 @@
7
7
  text-size-adjust: 100%;
8
8
  }
9
9
 
10
- /* In-page links glide while Motion is on. The scroll itself stays native. */
11
- :root:has(.ux-site[data-motion="true"]) {
12
- scroll-behavior: smooth;
10
+ /* In-page links glide while Motion is on. The scroll itself stays native.
11
+ The media query keeps reduced-motion visitors out before hydration, while
12
+ the server-rendered data-motion is still "true". */
13
+ @media (prefers-reduced-motion: no-preference) {
14
+ :root:has(.ux-site[data-motion="true"]) {
15
+ scroll-behavior: smooth;
16
+ }
13
17
  }
14
18
 
15
19
  :root:has(.ux-site) body {
@@ -118,7 +122,7 @@
118
122
  }
119
123
  }
120
124
 
121
- /* Step-through highlights while a section is pinned (`data-steps` on the
125
+ /* Step-through highlights as a section scrolls by (`data-steps` on the
122
126
  section, `data-step-item` on its items): the current item gets --active: 1. */
123
127
  :where(.ux-site) [data-step-item] {
124
128
  transition:
@@ -25,7 +25,16 @@
25
25
  --font-ux-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
26
26
  --font-ux-serif: "Instrument Serif", ui-serif, Georgia, "Times New Roman", serif;
27
27
 
28
- --ux-gutter: clamp(1.25rem, 3.2vw, 3rem);
28
+ /* Past the frame's width, the gutter grows by half the extra, so every
29
+ section sits in a centred frame while the scene's canvas fills the
30
+ screen. The scene reads --ux-frame too, and frames its formations to
31
+ match. A px length; 100vw turns the frame off. */
32
+ --ux-frame: 1920px;
33
+ --ux-gutter-base: clamp(1.25rem, 3.2vw, 3rem);
34
+ --ux-gutter: max(
35
+ var(--ux-gutter-base),
36
+ calc((100vw - var(--ux-frame)) / 2 + var(--ux-gutter-base))
37
+ );
29
38
  --ux-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
30
39
  --ux-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
31
40
  }
package/src/types.ts CHANGED
@@ -26,6 +26,8 @@ export interface UxChip {
26
26
  export interface UxTrait {
27
27
  title: string;
28
28
  text: string;
29
+ /** Makes the cell a link, with an arrow after its title. A plain `<a>`, so it loads the page. */
30
+ href?: string;
29
31
  }
30
32
 
31
33
  export interface UxSpecRow {