@uxfront/ui 0.4.1 → 0.5.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
 
@@ -84,7 +84,7 @@ const scene = [
84
84
  | -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
85
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
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. |
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
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
89
  | `UxPillars`, `UxChips`, `UxTraits`, `UxSpec` | Chapter details that light up one after another (set `steps` on the chapter to their count). |
90
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). |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxfront/ui",
3
- "version": "0.4.1",
3
+ "version": "0.5.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.2.0"
42
+ "@uxfront/scene": "^0.4.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
 
@@ -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
 
@@ -24,7 +24,7 @@ const stats = computed(() => {
24
24
  </p>
25
25
  <p class="ux-hud__chapter" aria-hidden="true">
26
26
  <span>{{ pad(state.chapter + 1) }} / {{ pad(labels.length) }}</span>
27
- <span class="ux-hud__bar"><span class="ux-hud__fill" /></span>
27
+ <span class="ux-hud__bar"><span class="ux-hud__fill" data-progress /></span>
28
28
  <span class="ux-hud__label">{{ labels[state.chapter] }}</span>
29
29
  </p>
30
30
  <button
@@ -39,7 +39,7 @@ onBeforeUnmount(() => experience.stop());
39
39
  </script>
40
40
 
41
41
  <template>
42
- <div ref="root" class="ux-site">
42
+ <div ref="root" class="ux-site" :data-motion="experience.state.motion">
43
43
  <a v-if="skipTo" class="ux-site__skip" :href="skipTo">{{ skipLabel }}</a>
44
44
  <UxStage>
45
45
  <template #fallback
@@ -7,18 +7,13 @@
7
7
  text-size-adjust: 100%;
8
8
  }
9
9
 
10
- /* Lenis owns smooth scrolling; native smoothing would fight it. */
11
- html.lenis,
12
- html.lenis body {
13
- height: auto;
14
- }
15
-
16
- .lenis.lenis-smooth {
17
- scroll-behavior: auto !important;
18
- }
19
-
20
- .lenis.lenis-stopped {
21
- overflow: clip;
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
+ }
22
17
  }
23
18
 
24
19
  :root:has(.ux-site) body {
@@ -127,7 +122,7 @@ html.lenis body {
127
122
  }
128
123
  }
129
124
 
130
- /* 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
131
126
  section, `data-step-item` on its items): the current item gets --active: 1. */
132
127
  :where(.ux-site) [data-step-item] {
133
128
  transition: