@uxfront/ui 0.5.0 → 0.7.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
@@ -80,17 +80,25 @@ 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 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
- | `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.
100
+
101
+ `UxPillLink` is an outline pill that fills on hover. Set `variant="filled"` to fill it from the start, so the one action you want people to take, like "Get started", stands out from the links around it. The arrow after the label can give way to another icon through the `#icon` slot, sized to the arrow's 16 × 16px: `<template #icon><UxStarIcon /></template>`. Set `:arrow="false"` to show the label alone.
94
102
 
95
103
  Also exported: `useExperience()` (the scene's reactive state inside a `UxSite`), the `v-scramble` directive, `FRAMEWORKS` and their logos, and `uxRenderHookKey`.
96
104
 
@@ -110,3 +118,21 @@ The tokens are the shared look, so sites shouldn't need to change them. If one m
110
118
  Keep `--ux-bg` at `#050507`: the scene's canvas paints that colour itself.
111
119
 
112
120
  The typefaces are Geist, Geist Mono and Instrument Serif (`--font-ux-sans`, `--font-ux-mono`, `--font-ux-serif`). Without Nuxt, load them yourself.
121
+
122
+ ### The frame
123
+
124
+ 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`).
125
+
126
+ | Token | Default | Effect |
127
+ | ------------------ | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
128
+ | `--ux-frame` | `1920px` | The frame's width, as a px length. `100vw` turns the frame off. |
129
+ | `--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. |
130
+ | `--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. |
131
+
132
+ 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.
133
+
134
+ ```css
135
+ :root:has(.ux-site) {
136
+ --ux-frame: 1200px; /* or 100vw, for no frame */
137
+ }
138
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxfront/ui",
3
- "version": "0.5.0",
3
+ "version": "0.7.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.4.0"
42
+ "@uxfront/scene": "^0.5.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@uxfront/typescript-config": "0.1.0",
@@ -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
 
@@ -2,21 +2,32 @@
2
2
  import { vScramble } from "../directives/scramble";
3
3
  import UxArrowIcon from "./icons/UxArrowIcon.vue";
4
4
 
5
- const { arrow = true, scramble = true } = defineProps<{
5
+ const {
6
+ variant = "outline",
7
+ arrow = true,
8
+ scramble = true,
9
+ } = defineProps<{
6
10
  href: string;
7
11
  label: string;
12
+ /** An outline pill that fills on hover, or a pill filled from the start. */
13
+ variant?: "outline" | "filled";
8
14
  /** An arrow pointing out of the page, nudged on hover. */
9
15
  arrow?: boolean;
10
16
  /** Decodes the label through random glyphs on hover and focus. */
11
17
  scramble?: boolean;
12
18
  }>();
19
+
20
+ defineSlots<{
21
+ /** In place of the arrow, sized like it, like `UxStarIcon`. */
22
+ icon?(): unknown;
23
+ }>();
13
24
  </script>
14
25
 
15
26
  <template>
16
- <a class="ux-pill-link" :href="href">
27
+ <a class="ux-pill-link" :class="{ 'ux-pill-link--filled': variant === 'filled' }" :href="href">
17
28
  <span v-if="scramble" v-scramble>{{ label }}</span>
18
29
  <span v-else>{{ label }}</span>
19
- <UxArrowIcon v-if="arrow" />
30
+ <slot name="icon"><UxArrowIcon v-if="arrow" class="ux-pill-link__arrow" /></slot>
20
31
  </a>
21
32
  </template>
22
33
 
@@ -42,19 +53,25 @@ a.ux-pill-link {
42
53
  border-color 0.4s var(--ux-ease-out);
43
54
  }
44
55
 
45
- .ux-pill-link svg {
56
+ .ux-pill-link__arrow,
57
+ .ux-pill-link :slotted(svg) {
46
58
  width: 1rem;
47
59
  height: 1rem;
60
+ }
61
+
62
+ .ux-pill-link__arrow {
48
63
  transition: transform 0.4s var(--ux-ease-out);
49
64
  }
50
65
 
51
- .ux-pill-link:hover {
66
+ /* A filled pill wears the outline pill's hover colours, at rest and on hover. */
67
+ .ux-pill-link:hover,
68
+ a.ux-pill-link--filled {
52
69
  color: var(--ux-bg);
53
70
  background: var(--ux-fg);
54
71
  border-color: var(--ux-fg);
55
72
  }
56
73
 
57
- .ux-pill-link:hover svg {
74
+ .ux-pill-link:hover .ux-pill-link__arrow {
58
75
  transform: translate(2px, -2px);
59
76
  }
60
77
  </style>
@@ -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";
@@ -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 {