@uxfront/ui 0.1.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.
@@ -0,0 +1,230 @@
1
+ <script setup lang="ts">
2
+ import { vScramble } from "../directives/scramble";
3
+ import type { UxFinaleCard } from "../types";
4
+ import UxArrowIcon from "./icons/UxArrowIcon.vue";
5
+
6
+ const { id = "build", cards = [] } = defineProps<{
7
+ id?: string;
8
+ kicker?: string;
9
+ cards?: UxFinaleCard[];
10
+ }>();
11
+
12
+ defineSlots<{
13
+ title(): unknown;
14
+ lead?(): unknown;
15
+ /** The page's footer, pinned to the bottom of the screen. Links in it are styled. */
16
+ footer?(): unknown;
17
+ }>();
18
+ </script>
19
+
20
+ <template>
21
+ <section :id="id" class="ux-finale" data-stage :aria-labelledby="`${id}-title`">
22
+ <div class="ux-finale__pin">
23
+ <div class="ux-finale__body" data-reveal>
24
+ <p v-if="kicker" class="ux-finale__kicker ux-mono">{{ kicker }}</p>
25
+ <h2 :id="`${id}-title`" class="ux-finale__title"><slot name="title" /></h2>
26
+ <p v-if="$slots.lead" class="ux-finale__lead"><slot name="lead" /></p>
27
+ <ul v-if="cards.length" class="ux-finale__grid">
28
+ <li v-for="card in cards" :key="card.href">
29
+ <a :href="card.href">
30
+ <span v-if="card.meta" class="ux-mono">{{ card.meta }}</span>
31
+ <strong>{{ card.name }}</strong>
32
+ <span class="ux-finale__domain">
33
+ <span v-scramble>{{ card.domain ?? card.href.replace(/^https?:\/\//, "") }}</span>
34
+ <UxArrowIcon />
35
+ </span>
36
+ </a>
37
+ </li>
38
+ </ul>
39
+ </div>
40
+ <footer v-if="$slots.footer" class="ux-finale__footer ux-mono"><slot name="footer" /></footer>
41
+ </div>
42
+ </section>
43
+ </template>
44
+
45
+ <style scoped>
46
+ .ux-finale {
47
+ position: relative;
48
+ height: 200vh;
49
+ }
50
+
51
+ .ux-finale__pin {
52
+ position: sticky;
53
+ top: 0;
54
+ display: flex;
55
+ flex-direction: column;
56
+ justify-content: center;
57
+ align-items: center;
58
+ height: 100vh;
59
+ height: 100svh;
60
+ padding: 6rem var(--ux-gutter) 4rem;
61
+ text-align: center;
62
+ }
63
+
64
+ .ux-finale__body {
65
+ position: relative;
66
+ isolation: isolate;
67
+ display: flex;
68
+ flex-direction: column;
69
+ align-items: center;
70
+ width: min(100%, 64rem);
71
+ }
72
+
73
+ .ux-finale__body::before {
74
+ content: "";
75
+ position: absolute;
76
+ inset: -15% -10%;
77
+ z-index: -1;
78
+ background: radial-gradient(closest-side, rgb(5 5 7 / 0.7), rgb(5 5 7 / 0));
79
+ }
80
+
81
+ .ux-finale__kicker {
82
+ margin-bottom: 1.5rem;
83
+ color: var(--ux-fg-2);
84
+ }
85
+
86
+ .ux-finale__title {
87
+ font-size: clamp(2.75rem, 1rem + 6vw, 7.5rem);
88
+ font-weight: 500;
89
+ line-height: 0.95;
90
+ letter-spacing: -0.055em;
91
+ text-wrap: balance;
92
+ }
93
+
94
+ .ux-finale__lead {
95
+ max-width: 32rem;
96
+ margin: 1.75rem 0 3rem;
97
+ font-size: clamp(1.0625rem, 0.95rem + 0.4vw, 1.25rem);
98
+ line-height: 1.45;
99
+ color: var(--ux-fg-2);
100
+ }
101
+
102
+ .ux-finale__grid {
103
+ display: grid;
104
+ grid-template-columns: repeat(4, minmax(0, 1fr));
105
+ gap: 1px;
106
+ width: 100%;
107
+ padding: 0;
108
+ list-style: none;
109
+ text-align: left;
110
+ border: 1px solid var(--ux-line);
111
+ background: var(--ux-line);
112
+ }
113
+
114
+ .ux-finale__grid a {
115
+ display: grid;
116
+ gap: 0.6rem;
117
+ height: 100%;
118
+ padding: 1.25rem 1.25rem 1.1rem;
119
+ color: var(--ux-fg);
120
+ text-decoration: none;
121
+ background: rgb(5 5 7 / 0.72);
122
+ backdrop-filter: blur(10px);
123
+ transition: background 0.5s var(--ux-ease-out);
124
+ }
125
+
126
+ .ux-finale__grid a:hover {
127
+ background: rgb(255 255 255 / 0.08);
128
+ }
129
+
130
+ .ux-finale__grid .ux-mono {
131
+ color: var(--ux-fg-3);
132
+ }
133
+
134
+ .ux-finale__grid strong {
135
+ font-size: 1.25rem;
136
+ font-weight: 500;
137
+ letter-spacing: -0.03em;
138
+ }
139
+
140
+ .ux-finale__domain {
141
+ display: inline-flex;
142
+ align-items: center;
143
+ gap: 0.4rem;
144
+ overflow-wrap: anywhere;
145
+ font-family: var(--font-ux-mono);
146
+ font-size: 0.75rem;
147
+ color: var(--ux-fg-2);
148
+ }
149
+
150
+ .ux-finale__domain svg {
151
+ width: 0.875rem;
152
+ height: 0.875rem;
153
+ transition: transform 0.4s var(--ux-ease-out);
154
+ }
155
+
156
+ .ux-finale__grid a:hover .ux-finale__domain svg {
157
+ transform: translate(2px, -2px);
158
+ }
159
+
160
+ .ux-finale__footer {
161
+ position: absolute;
162
+ left: var(--ux-gutter);
163
+ right: var(--ux-gutter);
164
+ bottom: 4.25rem;
165
+ display: flex;
166
+ justify-content: space-between;
167
+ gap: 1rem;
168
+ color: var(--ux-fg-3);
169
+ }
170
+
171
+ .ux-finale__footer :slotted(a) {
172
+ display: inline-flex;
173
+ align-items: center;
174
+ min-height: 1.5rem;
175
+ color: var(--ux-fg-2);
176
+ text-decoration: none;
177
+ }
178
+
179
+ .ux-finale__footer :slotted(a:hover) {
180
+ color: var(--ux-fg);
181
+ }
182
+
183
+ @media (max-width: 960px) {
184
+ .ux-finale__grid {
185
+ grid-template-columns: repeat(2, minmax(0, 1fr));
186
+ }
187
+ }
188
+
189
+ /* The finale no longer fits one pinned screen: it flows, footer last. */
190
+ @media (max-width: 1099px), (max-aspect-ratio: 5/4), (max-height: 700px) {
191
+ .ux-finale {
192
+ height: auto;
193
+ }
194
+
195
+ .ux-finale__pin {
196
+ position: relative;
197
+ height: auto;
198
+ min-height: 100vh;
199
+ min-height: 100svh;
200
+ padding: 7rem var(--ux-gutter) 5.5rem;
201
+ }
202
+
203
+ .ux-finale__footer {
204
+ position: static;
205
+ width: 100%;
206
+ margin-top: 3rem;
207
+ }
208
+ }
209
+
210
+ @media (max-width: 760px) {
211
+ .ux-finale__lead {
212
+ margin-bottom: 2rem;
213
+ }
214
+
215
+ .ux-finale__grid strong {
216
+ font-size: 1.0625rem;
217
+ }
218
+ }
219
+
220
+ /* Two columns leave no room for the domains on the narrowest phones. */
221
+ @media (max-width: 430px) {
222
+ .ux-finale__grid {
223
+ grid-template-columns: 1fr;
224
+ }
225
+
226
+ .ux-finale__grid a {
227
+ padding: 1rem 1.1rem;
228
+ }
229
+ }
230
+ </style>
@@ -0,0 +1,160 @@
1
+ <script setup lang="ts">
2
+ import { useExperience } from "../composables/experience";
3
+ import type { UxNavItem } from "../types";
4
+ import UxFrontMark from "./icons/UxFrontMark.vue";
5
+ import UxGithubIcon from "./icons/UxGithubIcon.vue";
6
+
7
+ const {
8
+ homeHref = "#top",
9
+ nav = [],
10
+ navLabel = "Sections",
11
+ } = defineProps<{
12
+ /** Shown beside the mark unless the `brand` slot restyles it; also names the link. */
13
+ brand: string;
14
+ homeHref?: string;
15
+ /** Accessible name of the brand link. Defaults to "<brand>, back to top". */
16
+ homeLabel?: string;
17
+ nav?: UxNavItem[];
18
+ navLabel?: string;
19
+ /** A GitHub URL, linked at the end of the header. */
20
+ github?: string;
21
+ }>();
22
+
23
+ const { state } = useExperience();
24
+ </script>
25
+
26
+ <template>
27
+ <header class="ux-header">
28
+ <a class="ux-header__brand" :href="homeHref" :aria-label="homeLabel ?? `${brand}, back to top`">
29
+ <slot name="mark"><UxFrontMark class="ux-header__mark" /></slot>
30
+ <span
31
+ ><slot name="brand">{{ brand }}</slot></span
32
+ >
33
+ </a>
34
+ <nav v-if="nav.length" class="ux-header__nav" :aria-label="navLabel">
35
+ <ul>
36
+ <li v-for="item in nav" :key="item.href">
37
+ <a
38
+ :href="item.href"
39
+ :aria-current="
40
+ state.activeId && item.href === `#${state.activeId}` ? 'location' : undefined
41
+ "
42
+ >
43
+ <span v-if="item.index" class="ux-header__index">{{ item.index }}</span>
44
+ {{ item.label }}
45
+ </a>
46
+ </li>
47
+ </ul>
48
+ </nav>
49
+ <a v-if="github" class="ux-header__github" :href="github">
50
+ <UxGithubIcon />
51
+ <span>GitHub</span>
52
+ </a>
53
+ </header>
54
+ </template>
55
+
56
+ <style scoped>
57
+ .ux-header {
58
+ position: fixed;
59
+ inset: 0 0 auto;
60
+ z-index: 20;
61
+ display: flex;
62
+ align-items: center;
63
+ justify-content: space-between;
64
+ gap: 2rem;
65
+ padding: 1.1rem var(--ux-gutter);
66
+ background: linear-gradient(180deg, rgb(5 5 7 / 0.85), rgb(5 5 7 / 0));
67
+ }
68
+
69
+ .ux-header a {
70
+ display: inline-flex;
71
+ align-items: center;
72
+ min-height: 2.75rem;
73
+ color: var(--ux-fg);
74
+ text-decoration: none;
75
+ }
76
+
77
+ .ux-header__brand {
78
+ gap: 0.6rem;
79
+ font-size: 1.0625rem;
80
+ font-weight: 500;
81
+ letter-spacing: -0.02em;
82
+ }
83
+
84
+ .ux-header__brand :slotted(svg),
85
+ .ux-header__mark {
86
+ width: 1.5rem;
87
+ height: 1.5rem;
88
+ }
89
+
90
+ .ux-header__nav ul {
91
+ display: flex;
92
+ gap: clamp(1rem, 2.4vw, 2.5rem);
93
+ margin: 0;
94
+ padding: 0;
95
+ list-style: none;
96
+ }
97
+
98
+ .ux-header__nav a {
99
+ position: relative;
100
+ gap: 0.5rem;
101
+ font-size: 0.875rem;
102
+ color: var(--ux-fg-2);
103
+ transition: color 0.3s var(--ux-ease-out);
104
+ }
105
+
106
+ .ux-header__nav a::after {
107
+ content: "";
108
+ position: absolute;
109
+ left: 0;
110
+ right: 0;
111
+ bottom: 0.55rem;
112
+ height: 1px;
113
+ background: currentColor;
114
+ transform: scaleX(0);
115
+ transform-origin: right;
116
+ transition: transform 0.5s var(--ux-ease-out);
117
+ }
118
+
119
+ .ux-header__nav a:hover,
120
+ .ux-header__nav a[aria-current] {
121
+ color: var(--ux-fg);
122
+ }
123
+
124
+ .ux-header__nav a:hover::after,
125
+ .ux-header__nav a[aria-current]::after {
126
+ transform: scaleX(1);
127
+ transform-origin: left;
128
+ }
129
+
130
+ .ux-header__index {
131
+ font-family: var(--font-ux-mono);
132
+ font-size: 0.75rem;
133
+ color: var(--ux-fg-3);
134
+ }
135
+
136
+ .ux-header__github {
137
+ gap: 0.5rem;
138
+ font-size: 0.875rem;
139
+ }
140
+
141
+ .ux-header__github svg {
142
+ width: 1.125rem;
143
+ height: 1.125rem;
144
+ }
145
+
146
+ @media (max-width: 960px) {
147
+ .ux-header__nav {
148
+ display: none;
149
+ }
150
+ }
151
+
152
+ /* Where the copy scrolls under the header (stacked and landscape-phone
153
+ layouts, see UxChapter), a solid band keeps it off the logo. */
154
+ @media (max-width: 1099px), (max-aspect-ratio: 5/4) {
155
+ .ux-header {
156
+ padding-bottom: 1.6rem;
157
+ background: linear-gradient(180deg, rgb(5 5 7 / 0.96), rgb(5 5 7 / 0.9) 58%, rgb(5 5 7 / 0));
158
+ }
159
+ }
160
+ </style>
@@ -0,0 +1,265 @@
1
+ <script setup lang="ts">
2
+ import type { UxNavItem } from "../types";
3
+
4
+ const {
5
+ id = "top",
6
+ index = [],
7
+ indexLabel = "Sections",
8
+ scrollLabel = "Scroll to explore",
9
+ } = defineProps<{
10
+ id?: string;
11
+ /** A short mono line above the title, after a pulsing dot. */
12
+ kicker?: string;
13
+ /** A tag between the dot and the kicker, like "New". */
14
+ badge?: string;
15
+ /** The title as one sentence, for assistive technology. `lines` are only visual. */
16
+ title: string;
17
+ /** Section links, shown below the lead on small screens instead of the header's nav. */
18
+ index?: UxNavItem[];
19
+ indexLabel?: string;
20
+ /** Where the scroll cue leads, usually the first chapter. */
21
+ scrollHref?: string;
22
+ scrollLabel?: string;
23
+ }>();
24
+
25
+ defineSlots<{
26
+ /** The title, one `UxHeroLine` per line. */
27
+ lines(): unknown;
28
+ lead?(): unknown;
29
+ }>();
30
+ </script>
31
+
32
+ <template>
33
+ <section :id="id" class="ux-hero" data-stage :aria-labelledby="`${id}-title`">
34
+ <div class="ux-hero__content">
35
+ <p v-if="kicker" class="ux-hero__kicker ux-mono">
36
+ <span class="ux-hero__pulse" aria-hidden="true" />
37
+ <span v-if="badge" class="ux-hero__badge">{{ badge }}</span>
38
+ {{ kicker }}
39
+ </p>
40
+ <h1 :id="`${id}-title`" class="ux-hero__title">
41
+ <span class="ux-sr-only">{{ title }}</span>
42
+ <span class="ux-hero__lines" aria-hidden="true"><slot name="lines" /></span>
43
+ </h1>
44
+ <p v-if="$slots.lead" class="ux-hero__lead"><slot name="lead" /></p>
45
+ <ol v-if="index.length" class="ux-hero__index" :aria-label="indexLabel">
46
+ <li v-for="item in index" :key="item.href">
47
+ <a :href="item.href">
48
+ <span v-if="item.index" class="ux-mono">{{ item.index }}</span>
49
+ {{ item.label }}
50
+ </a>
51
+ </li>
52
+ </ol>
53
+ </div>
54
+ <a v-if="scrollHref" class="ux-hero__scroll ux-mono" :href="scrollHref">
55
+ <span class="ux-hero__scroll-line" aria-hidden="true" />
56
+ {{ scrollLabel }}
57
+ </a>
58
+ </section>
59
+ </template>
60
+
61
+ <style scoped>
62
+ .ux-hero {
63
+ position: relative;
64
+ display: flex;
65
+ flex-direction: column;
66
+ justify-content: flex-end;
67
+ min-height: 100vh;
68
+ min-height: 100svh;
69
+ padding: 7rem var(--ux-gutter) 8.5rem;
70
+ }
71
+
72
+ .ux-hero__content {
73
+ /* Keeps long lines, like the kicker, clear of the formation. */
74
+ max-width: min(60rem, 64vw);
75
+ }
76
+
77
+ .ux-hero__kicker {
78
+ display: flex;
79
+ align-items: center;
80
+ gap: 0.75rem;
81
+ margin-bottom: 1.75rem;
82
+ color: var(--ux-fg-2);
83
+ animation: rise 1.2s var(--ux-ease-out) both;
84
+ }
85
+
86
+ .ux-hero__pulse {
87
+ width: 6px;
88
+ height: 6px;
89
+ border-radius: 50%;
90
+ background: var(--ux-fg);
91
+ box-shadow: 0 0 0 0 rgb(255 255 255 / 0.6);
92
+ animation: pulse 2.4s var(--ux-ease-out) infinite;
93
+ }
94
+
95
+ .ux-hero__badge {
96
+ flex: none;
97
+ padding: 0.3em 0.6em 0.25em;
98
+ font-size: 0.6875rem;
99
+ line-height: 1;
100
+ border: 1px solid var(--ux-line-strong);
101
+ border-radius: 999px;
102
+ }
103
+
104
+ .ux-hero__title {
105
+ /* Wide enough to lead, never wide enough to reach the formation. */
106
+ font-size: clamp(2.5rem, min(0.5rem + 5.2vw, 11vh), 6.75rem);
107
+ font-weight: 500;
108
+ line-height: 0.94;
109
+ letter-spacing: -0.055em;
110
+ }
111
+
112
+ .ux-hero__lines {
113
+ display: block;
114
+ }
115
+
116
+ .ux-hero__lead {
117
+ max-width: 34rem;
118
+ margin-top: 2rem;
119
+ font-size: clamp(1.0625rem, 0.95rem + 0.4vw, 1.3125rem);
120
+ line-height: 1.45;
121
+ letter-spacing: -0.01em;
122
+ color: var(--ux-fg-2);
123
+ text-wrap: pretty;
124
+ animation: rise 1.2s 0.35s var(--ux-ease-out) both;
125
+ }
126
+
127
+ .ux-hero__index {
128
+ display: none;
129
+ }
130
+
131
+ .ux-hero__scroll {
132
+ position: absolute;
133
+ left: var(--ux-gutter);
134
+ bottom: 4.25rem;
135
+ display: inline-flex;
136
+ align-items: center;
137
+ gap: 0.9rem;
138
+ min-height: 2.75rem;
139
+ color: var(--ux-fg-2);
140
+ text-decoration: none;
141
+ animation: rise 1.2s 0.6s var(--ux-ease-out) both;
142
+ }
143
+
144
+ .ux-hero__scroll-line {
145
+ position: relative;
146
+ width: 3rem;
147
+ height: 1px;
148
+ overflow: hidden;
149
+ background: var(--ux-line-strong);
150
+ }
151
+
152
+ .ux-hero__scroll-line::after {
153
+ content: "";
154
+ position: absolute;
155
+ inset: 0;
156
+ background: var(--ux-fg);
157
+ animation: sweep 2.2s var(--ux-ease-in-out) infinite;
158
+ }
159
+
160
+ @keyframes rise {
161
+ from {
162
+ filter: blur(8px);
163
+ transform: translate3d(0, 1rem, 0);
164
+ }
165
+ }
166
+
167
+ @keyframes pulse {
168
+ 70%,
169
+ 100% {
170
+ box-shadow: 0 0 0 10px rgb(255 255 255 / 0);
171
+ }
172
+ }
173
+
174
+ @keyframes sweep {
175
+ from {
176
+ transform: translateX(-100%);
177
+ }
178
+ to {
179
+ transform: translateX(100%);
180
+ }
181
+ }
182
+
183
+ @media (max-width: 960px) {
184
+ .ux-hero__index {
185
+ display: flex;
186
+ flex-wrap: wrap;
187
+ gap: 0.25rem 1.25rem;
188
+ margin-top: 1.75rem;
189
+ padding: 0;
190
+ list-style: none;
191
+ }
192
+
193
+ .ux-hero__index a {
194
+ display: inline-flex;
195
+ align-items: center;
196
+ gap: 0.5rem;
197
+ min-height: 2.75rem;
198
+ font-size: 0.9375rem;
199
+ color: var(--ux-fg);
200
+ text-decoration: none;
201
+ }
202
+
203
+ .ux-hero__index .ux-mono {
204
+ color: var(--ux-fg-3);
205
+ }
206
+
207
+ .ux-hero__scroll {
208
+ display: none;
209
+ }
210
+ }
211
+
212
+ /* Portrait, squarish and small screens (STACKED_QUERY in @uxfront/scene):
213
+ the formation holds the top of the screen and the copy starts below it. */
214
+ @media (max-aspect-ratio: 5/4), (max-width: 1099px) and (max-aspect-ratio: 8/5) {
215
+ .ux-hero {
216
+ justify-content: flex-start;
217
+ padding-top: 46svh;
218
+ padding-bottom: 4rem;
219
+ }
220
+
221
+ .ux-hero__content {
222
+ max-width: 60rem;
223
+ }
224
+
225
+ .ux-hero__title {
226
+ font-size: min(8.6vw, 6.75rem);
227
+ }
228
+
229
+ .ux-hero__scroll {
230
+ display: none;
231
+ }
232
+ }
233
+
234
+ /* Landscape phones keep the formation beside the copy, with less air. */
235
+ @media (max-height: 560px) and (min-aspect-ratio: 1601/1000) {
236
+ .ux-hero {
237
+ padding-top: 5.5rem;
238
+ padding-bottom: 4.5rem;
239
+ }
240
+
241
+ .ux-hero__kicker {
242
+ margin-bottom: 1rem;
243
+ }
244
+
245
+ .ux-hero__lead {
246
+ margin-top: 1rem;
247
+ }
248
+ }
249
+
250
+ @media (max-width: 760px) {
251
+ .ux-hero__lead {
252
+ margin-top: 1.25rem;
253
+ }
254
+ }
255
+
256
+ @media (prefers-reduced-motion: reduce) {
257
+ .ux-hero__kicker,
258
+ .ux-hero__lead,
259
+ .ux-hero__scroll,
260
+ .ux-hero__pulse,
261
+ .ux-hero__scroll-line::after {
262
+ animation: none;
263
+ }
264
+ }
265
+ </style>
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <!-- One line of the UxHero title, focusing in after the one before. -->
3
+ <span class="ux-hero-line"><slot /></span>
4
+ </template>
5
+
6
+ <style scoped>
7
+ .ux-hero-line {
8
+ display: block;
9
+ animation: focus-in 1.5s var(--ux-ease-out) both;
10
+ }
11
+
12
+ .ux-hero-line:nth-child(2) {
13
+ animation-delay: 0.1s;
14
+ }
15
+
16
+ .ux-hero-line:nth-child(3) {
17
+ animation-delay: 0.2s;
18
+ }
19
+
20
+ .ux-hero-line:nth-child(n + 4) {
21
+ animation-delay: 0.3s;
22
+ }
23
+
24
+ .ux-hero-line :slotted(em) {
25
+ padding-right: 0.06em;
26
+ font-size: 1.08em;
27
+ letter-spacing: -0.035em;
28
+ }
29
+
30
+ @keyframes focus-in {
31
+ from {
32
+ filter: blur(14px);
33
+ transform: translate3d(0, 0.28em, 0);
34
+ letter-spacing: -0.02em;
35
+ }
36
+ }
37
+
38
+ @media (prefers-reduced-motion: reduce) {
39
+ .ux-hero-line {
40
+ animation: none;
41
+ }
42
+ }
43
+ </style>