@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.
package/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # @uxfront/ui
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.
4
+
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
+
7
+ ## Install
8
+
9
+ ```sh
10
+ pnpm add @uxfront/ui @uxfront/scene
11
+ ```
12
+
13
+ The package ships Vue single-file components as source, so each component's styles compile with the app and can be inlined into the server-rendered HTML. It needs a Vite build with `@vitejs/plugin-vue`. Outside Nuxt (VitePress, plain Vite), let Vite compile it:
14
+
15
+ ```ts
16
+ // vite.config.ts
17
+ export default defineConfig({
18
+ optimizeDeps: { exclude: ["@uxfront/ui"] },
19
+ ssr: { noExternal: ["@uxfront/ui"] },
20
+ });
21
+ ```
22
+
23
+ ## A page
24
+
25
+ ```vue
26
+ <script setup lang="ts">
27
+ import { corridor, ink, monolith } from "@uxfront/scene/formations";
28
+
29
+ // One formation per section: the hero, each chapter, the finale.
30
+ const scene = [
31
+ monolith({ label: "Foundation" }),
32
+ ink({ label: "Inkline" }),
33
+ corridor({ label: "Build" }),
34
+ ];
35
+ </script>
36
+
37
+ <template>
38
+ <UxSite :scene="scene" skip-to="#inkline">
39
+ <template #header>
40
+ <UxHeader brand="Inkline" :nav="[{ href: '#inkline', label: 'Library', index: '01' }]" />
41
+ </template>
42
+
43
+ <UxHero kicker="Inkline" title="The UI library for every framework" scroll-href="#inkline">
44
+ <template #lines>
45
+ <UxHeroLine>The UI library</UxHeroLine>
46
+ <UxHeroLine>for <em class="ux-serif">every</em> framework</UxHeroLine>
47
+ </template>
48
+ <template #lead>Perfectly designed components, in all seven frameworks.</template>
49
+ </UxHero>
50
+
51
+ <UxChapter
52
+ id="inkline"
53
+ index="01"
54
+ role="Library"
55
+ title="Inkline"
56
+ href="https://inkline.io"
57
+ :steps="2"
58
+ >
59
+ <template #lead>Built on the foundation.</template>
60
+ <UxSpec
61
+ :items="[
62
+ { term: 'Built with', detail: 'Unframework' },
63
+ { term: 'Ships to', detail: 'Seven frameworks' },
64
+ ]"
65
+ />
66
+ </UxChapter>
67
+
68
+ <UxFinale
69
+ kicker="Inkline"
70
+ :cards="[{ href: 'https://inkline.io', name: 'Inkline', meta: '01 · UI library' }]"
71
+ >
72
+ <template #title>Build on the <em class="ux-serif">foundation</em>.</template>
73
+ <template #footer><span>© 2026 Inkline</span></template>
74
+ </UxFinale>
75
+ </UxSite>
76
+ </template>
77
+ ```
78
+
79
+ [`apps/web/app/pages/index.vue`](../../apps/web/app/pages/index.vue) is the full uxfront.com homepage.
80
+
81
+ ## Components
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: kicker, `title`, `lead`, 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; `brand` slot to style the name), section nav (marks the one held) and a GitHub link. |
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`, `UxFrameworkLogo`, `UxFrontMark`. |
94
+
95
+ Also exported: `useExperience()` (the scene's reactive state inside a `UxSite`), the `v-scramble` directive, `FRAMEWORKS` and their logos, and `uxRenderHookKey`.
96
+
97
+ ## Styles
98
+
99
+ Everything is scoped to pages that render a `UxSite` (or `UxErrorPage`), so the components can share an app with other pages. Tokens and the page base sit on `:root:has(.ux-site)`. Utilities are prefixed (`.ux-mono`, `.ux-serif`, `.ux-sr-only`), and component styles are scoped.
100
+
101
+ The tokens are the shared look, so sites shouldn't need to change them. If one must, override it with the same selector:
102
+
103
+ ```css
104
+ :root:has(.ux-site) {
105
+ --ux-fg: #f2f2f5;
106
+ --ux-spectrum-0: #ff4a5a; /* …to 6: the prism's rails and the chips' tones */
107
+ }
108
+ ```
109
+
110
+ Keep `--ux-bg` at `#050507`: the scene's canvas paints that colour itself.
111
+
112
+ The typefaces are Geist, Geist Mono and Instrument Serif (`--font-ux-sans`, `--font-ux-mono`, `--font-ux-serif`). Without Nuxt, load them yourself.
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@uxfront/ui",
3
+ "version": "0.1.0",
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
+ "keywords": [
6
+ "components",
7
+ "homepage",
8
+ "vue",
9
+ "webgl"
10
+ ],
11
+ "homepage": "https://github.com/uxfront-com/uxfront/tree/main/packages/ui#readme",
12
+ "bugs": "https://github.com/uxfront-com/uxfront/issues",
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/uxfront-com/uxfront.git",
17
+ "directory": "packages/ui"
18
+ },
19
+ "files": [
20
+ "src"
21
+ ],
22
+ "type": "module",
23
+ "sideEffects": [
24
+ "*.css",
25
+ "*.vue"
26
+ ],
27
+ "exports": {
28
+ ".": "./src/index.ts",
29
+ "./components/*": "./src/components/*",
30
+ "./composables": "./src/composables/index.ts",
31
+ "./directives": "./src/directives/index.ts",
32
+ "./frameworks": "./src/frameworks.ts",
33
+ "./keys": "./src/keys.ts",
34
+ "./css": "./src/styles/index.css",
35
+ "./css/*": "./src/styles/*",
36
+ "./package.json": "./package.json"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "dependencies": {
42
+ "@uxfront/scene": "^0.1.0"
43
+ },
44
+ "devDependencies": {
45
+ "@uxfront/typescript-config": "0.1.0",
46
+ "@vitejs/plugin-vue": "^6.0.9",
47
+ "@vue/test-utils": "^2.5.1",
48
+ "happy-dom": "^20.14.5",
49
+ "vitest": "^5.0.1",
50
+ "vue": "^3.5.43"
51
+ },
52
+ "peerDependencies": {
53
+ "vue": "^3.5.0"
54
+ },
55
+ "scripts": {
56
+ "check-types": "tsc --noEmit",
57
+ "test": "vitest run"
58
+ }
59
+ }
@@ -0,0 +1,162 @@
1
+ <script setup lang="ts">
2
+ const { variant = "tag" } = defineProps<{
3
+ /** A formation anchor id, like `plates:0` (see each formation's docs). */
4
+ anchor: string;
5
+ /**
6
+ * `callout`: a dot, a leader line, a bold label and a detail line.
7
+ * `tag`: an optional icon and a label.
8
+ * `button`: a clickable label; place it in `UxSite`'s `controls` slot.
9
+ */
10
+ variant?: "callout" | "tag" | "button";
11
+ label?: string;
12
+ /** Callouts only. Hidden where the formation stacks above the copy. */
13
+ detail?: string;
14
+ }>();
15
+ </script>
16
+
17
+ <template>
18
+ <button
19
+ v-if="variant === 'button'"
20
+ type="button"
21
+ class="ux-anchor ux-anchor--button"
22
+ :data-anchor="anchor"
23
+ >
24
+ <span class="ux-anchor__text"
25
+ ><slot>{{ label }}</slot></span
26
+ >
27
+ </button>
28
+ <div v-else class="ux-anchor" :class="`ux-anchor--${variant}`" :data-anchor="anchor">
29
+ <template v-if="variant === 'callout'">
30
+ <span class="ux-anchor__dot" />
31
+ <span class="ux-anchor__line" />
32
+ <span class="ux-anchor__text">
33
+ <slot>
34
+ <b>{{ label }}</b>
35
+ <span v-if="detail" class="ux-anchor__detail">{{ detail }}</span>
36
+ </slot>
37
+ </span>
38
+ </template>
39
+ <template v-else>
40
+ <slot name="icon" />
41
+ <span class="ux-anchor__text"
42
+ ><slot>{{ label }}</slot></span
43
+ >
44
+ </template>
45
+ </div>
46
+ </template>
47
+
48
+ <style scoped>
49
+ .ux-anchor {
50
+ position: absolute;
51
+ top: 0;
52
+ left: 0;
53
+ display: flex;
54
+ align-items: center;
55
+ gap: 0.6rem;
56
+ visibility: hidden;
57
+ font-family: var(--font-ux-mono);
58
+ font-size: 0.75rem;
59
+ letter-spacing: 0.06em;
60
+ line-height: 1;
61
+ text-transform: uppercase;
62
+ white-space: nowrap;
63
+ color: var(--ux-fg);
64
+ will-change: transform, opacity;
65
+ }
66
+
67
+ .ux-anchor :deep(b) {
68
+ font-weight: 500;
69
+ }
70
+
71
+ .ux-anchor__dot {
72
+ width: 5px;
73
+ height: 5px;
74
+ margin-left: -2.5px;
75
+ border-radius: 50%;
76
+ background: var(--ux-fg);
77
+ box-shadow: 0 0 12px rgb(255 255 255 / 0.8);
78
+ }
79
+
80
+ .ux-anchor--callout {
81
+ translate: 0 -50%;
82
+ }
83
+
84
+ .ux-anchor--callout .ux-anchor__line {
85
+ width: clamp(1.25rem, 3vw, 2.5rem);
86
+ height: 1px;
87
+ background: linear-gradient(90deg, rgb(255 255 255 / 0.7), rgb(255 255 255 / 0.15));
88
+ }
89
+
90
+ .ux-anchor--callout .ux-anchor__text {
91
+ display: grid;
92
+ gap: 0.4rem;
93
+ color: var(--ux-fg-2);
94
+ }
95
+
96
+ .ux-anchor__detail {
97
+ font-family: var(--font-ux-sans);
98
+ letter-spacing: 0;
99
+ text-transform: none;
100
+ }
101
+
102
+ .ux-anchor--callout :deep(b) {
103
+ color: var(--ux-fg);
104
+ }
105
+
106
+ .ux-anchor--tag {
107
+ translate: 1.1rem -50%;
108
+ }
109
+
110
+ .ux-anchor--tag :deep(svg) {
111
+ width: 0.875rem;
112
+ height: 0.875rem;
113
+ }
114
+
115
+ .ux-anchor--button {
116
+ translate: 0 -50%;
117
+ padding: 0;
118
+ color: var(--ux-fg-2);
119
+ background: none;
120
+ border: 0;
121
+ cursor: pointer;
122
+ pointer-events: auto;
123
+ transition: color 0.3s var(--ux-ease-out);
124
+ }
125
+
126
+ /* A comfortable hit area around the small label. */
127
+ .ux-anchor--button::before {
128
+ content: "";
129
+ position: absolute;
130
+ inset: -0.75rem -0.5rem;
131
+ }
132
+
133
+ .ux-anchor--button :deep(b) {
134
+ margin-left: 0.4rem;
135
+ color: var(--ux-fg);
136
+ text-decoration: underline dotted rgb(255 255 255 / 0.45);
137
+ text-underline-offset: 0.35em;
138
+ }
139
+
140
+ .ux-anchor--button:hover {
141
+ color: var(--ux-fg);
142
+ }
143
+
144
+ .ux-anchor--button:hover :deep(b) {
145
+ text-decoration-style: solid;
146
+ text-decoration-color: currentColor;
147
+ }
148
+
149
+ /* Stacked layout (see UxChapter): less room beside the formations. */
150
+ @media (max-width: 1099px), (max-aspect-ratio: 5/4) {
151
+ .ux-anchor__detail,
152
+ .ux-anchor--button {
153
+ display: none;
154
+ }
155
+ }
156
+
157
+ @media (max-width: 760px) {
158
+ .ux-anchor--tag {
159
+ display: none;
160
+ }
161
+ }
162
+ </style>
@@ -0,0 +1,236 @@
1
+ <script setup lang="ts">
2
+ import UxPillLink from "./UxPillLink.vue";
3
+
4
+ const { align = "start", valign = "center" } = defineProps<{
5
+ id: string;
6
+ /** Eyebrow before the rule, like `01`. */
7
+ index?: string;
8
+ /** Eyebrow after the rule, like `Compiler`. */
9
+ role?: string;
10
+ title: string;
11
+ href?: string;
12
+ /** Label of the link; defaults to `href` without its protocol. */
13
+ linkLabel?: string;
14
+ /** "end" puts the copy on the right, leaving the left to the formation. */
15
+ align?: "start" | "end";
16
+ /** "end" leaves the upper half of the screen to the formation. */
17
+ valign?: "center" | "end";
18
+ /** Items (`data-step-item="0"`, `"1"`, …) highlighted one after another while the chapter is pinned. */
19
+ steps?: number;
20
+ }>();
21
+
22
+ defineSlots<{
23
+ lead?(): unknown;
24
+ /** Details below the lead, like `UxPillars`, `UxChips`, `UxTraits` or `UxSpec`. */
25
+ default?(): unknown;
26
+ }>();
27
+ </script>
28
+
29
+ <template>
30
+ <section
31
+ :id="id"
32
+ class="ux-chapter"
33
+ :class="{ 'ux-chapter--right': align === 'end', 'ux-chapter--bottom': valign === 'end' }"
34
+ data-stage
35
+ :data-steps="steps"
36
+ :aria-labelledby="`${id}-title`"
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>
55
+ </div>
56
+ </section>
57
+ </template>
58
+
59
+ <style scoped>
60
+ .ux-chapter {
61
+ position: relative;
62
+ height: 240vh;
63
+ }
64
+
65
+ .ux-chapter__pin {
66
+ position: sticky;
67
+ top: 0;
68
+ display: flex;
69
+ align-items: center;
70
+ height: 100vh;
71
+ height: 100svh;
72
+ padding: 6rem var(--ux-gutter) 5rem;
73
+ }
74
+
75
+ .ux-chapter--right .ux-chapter__pin {
76
+ justify-content: flex-end;
77
+ }
78
+
79
+ .ux-chapter--bottom .ux-chapter__pin {
80
+ align-items: flex-end;
81
+ }
82
+
83
+ .ux-chapter__body {
84
+ position: relative;
85
+ isolation: isolate;
86
+ width: min(100%, 33rem, 40vw);
87
+ }
88
+
89
+ /* A soft pool of darkness keeps the copy legible over the particles. */
90
+ .ux-chapter__body::before {
91
+ content: "";
92
+ position: absolute;
93
+ inset: -25% -35%;
94
+ z-index: -1;
95
+ background: radial-gradient(closest-side, rgb(5 5 7 / 0.78), rgb(5 5 7 / 0));
96
+ pointer-events: none;
97
+ }
98
+
99
+ .ux-chapter__eyebrow {
100
+ display: flex;
101
+ align-items: center;
102
+ gap: 0.75rem;
103
+ margin: 0 0 1.5rem;
104
+ font-family: var(--font-ux-mono);
105
+ font-size: 0.75rem;
106
+ letter-spacing: 0.08em;
107
+ text-transform: uppercase;
108
+ color: var(--ux-fg-2);
109
+ }
110
+
111
+ .ux-chapter__rule {
112
+ width: 2.5rem;
113
+ height: 1px;
114
+ background: var(--ux-line-strong);
115
+ }
116
+
117
+ .ux-chapter__title {
118
+ margin: 0 0 1.5rem;
119
+ font-size: clamp(2.75rem, 1.2rem + 4.6vw, 5.75rem);
120
+ font-weight: 500;
121
+ line-height: 0.92;
122
+ letter-spacing: -0.055em;
123
+ text-wrap: balance;
124
+ }
125
+
126
+ .ux-chapter__lead {
127
+ margin: 0 0 2rem;
128
+ font-size: clamp(1.125rem, 0.95rem + 0.55vw, 1.5rem);
129
+ line-height: 1.35;
130
+ letter-spacing: -0.015em;
131
+ color: var(--ux-fg);
132
+ text-wrap: pretty;
133
+ }
134
+
135
+ .ux-chapter__link {
136
+ margin-top: 2.25rem;
137
+ background: rgb(5 5 7 / 0.4);
138
+ backdrop-filter: blur(8px);
139
+ }
140
+
141
+ /* Short screens: the pinned copy has to fit between the header and the HUD. */
142
+ @media (max-height: 860px) {
143
+ .ux-chapter__pin {
144
+ padding-top: 5rem;
145
+ padding-bottom: 4rem;
146
+ }
147
+
148
+ .ux-chapter__eyebrow {
149
+ margin-bottom: 1rem;
150
+ }
151
+
152
+ .ux-chapter__title {
153
+ margin-bottom: 1rem;
154
+ font-size: clamp(2.5rem, 8vh, 5.75rem);
155
+ }
156
+
157
+ .ux-chapter__lead {
158
+ margin-bottom: 1.25rem;
159
+ font-size: clamp(1.0625rem, 2.3vh, 1.5rem);
160
+ }
161
+
162
+ .ux-chapter__link {
163
+ margin-top: 1.5rem;
164
+ }
165
+ }
166
+
167
+ /* Portrait, squarish and small screens (STACKED_QUERY in @uxfront/scene,
168
+ 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. */
171
+ @media (max-aspect-ratio: 5/4), (max-width: 1099px) and (max-aspect-ratio: 8/5) {
172
+ .ux-chapter__pin {
173
+ position: relative;
174
+ display: block;
175
+ height: auto;
176
+ padding: 58svh var(--ux-gutter) 0;
177
+ }
178
+
179
+ .ux-chapter__body {
180
+ width: min(100%, 36rem);
181
+ }
182
+
183
+ .ux-chapter--right .ux-chapter__body {
184
+ margin-left: auto;
185
+ }
186
+
187
+ /* A full-width band that travels with the copy as it passes over the art. */
188
+ .ux-chapter__body::before {
189
+ inset: -4rem -100vw;
190
+ background: linear-gradient(
191
+ 180deg,
192
+ rgb(5 5 7 / 0),
193
+ rgb(5 5 7 / 0.9) 4rem,
194
+ rgb(5 5 7 / 0.9) calc(100% - 4rem),
195
+ rgb(5 5 7 / 0)
196
+ );
197
+ }
198
+ }
199
+
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. */
202
+ @media (max-width: 1099px) and (min-aspect-ratio: 1601/1000) {
203
+ .ux-chapter__pin {
204
+ position: relative;
205
+ display: block;
206
+ height: auto;
207
+ padding: 24svh var(--ux-gutter) 20svh;
208
+ }
209
+
210
+ .ux-chapter__body {
211
+ width: min(100%, 46vw);
212
+ }
213
+
214
+ .ux-chapter--right .ux-chapter__body {
215
+ margin-left: auto;
216
+ }
217
+ }
218
+
219
+ @media (max-width: 760px) {
220
+ .ux-chapter__eyebrow {
221
+ margin-bottom: 1rem;
222
+ }
223
+
224
+ .ux-chapter__title {
225
+ margin-bottom: 1rem;
226
+ }
227
+
228
+ .ux-chapter__lead {
229
+ margin-bottom: 1.25rem;
230
+ }
231
+
232
+ .ux-chapter__link {
233
+ margin-top: 1.5rem;
234
+ }
235
+ }
236
+ </style>
@@ -0,0 +1,51 @@
1
+ <script setup lang="ts">
2
+ import type { UxChip } from "../types";
3
+ import UxFrameworkLogo from "./icons/UxFrameworkLogo.vue";
4
+
5
+ defineProps<{ items: UxChip[] }>();
6
+ </script>
7
+
8
+ <template>
9
+ <!-- Pills that light up one after another (set `steps` on the UxChapter). -->
10
+ <ul class="ux-chips">
11
+ <li
12
+ v-for="(item, i) in items"
13
+ :key="item.label"
14
+ :data-step-item="i"
15
+ :style="item.tone ? { '--tone': item.tone } : undefined"
16
+ >
17
+ <UxFrameworkLogo v-if="item.framework" :name="item.framework" />
18
+ {{ item.label }}
19
+ </li>
20
+ </ul>
21
+ </template>
22
+
23
+ <style scoped>
24
+ .ux-chips {
25
+ display: flex;
26
+ flex-wrap: wrap;
27
+ gap: 0.5rem;
28
+ padding: 0;
29
+ list-style: none;
30
+ }
31
+
32
+ .ux-chips li {
33
+ --tone: var(--ux-fg);
34
+ display: inline-flex;
35
+ align-items: center;
36
+ gap: 0.55rem;
37
+ padding: 0.5rem 0.85rem;
38
+ font-family: var(--font-ux-mono);
39
+ font-size: 0.8125rem;
40
+ letter-spacing: 0.02em;
41
+ color: color-mix(in srgb, var(--ux-fg) calc(var(--active, 0) * 100%), var(--ux-fg-2));
42
+ border: 1px solid color-mix(in srgb, var(--tone) calc(20% + var(--active, 0) * 60%), transparent);
43
+ border-radius: 999px;
44
+ background: color-mix(in srgb, var(--tone) calc(var(--active, 0) * 14%), rgb(5 5 7 / 0.5));
45
+ }
46
+
47
+ .ux-chips svg {
48
+ width: 0.9375rem;
49
+ height: 0.9375rem;
50
+ }
51
+ </style>
@@ -0,0 +1,74 @@
1
+ <script setup lang="ts">
2
+ import { inject } from "vue";
3
+
4
+ import { uxRenderHookKey } from "../keys";
5
+ import UxPillLink from "./UxPillLink.vue";
6
+
7
+ const { homeHref = "/" } = defineProps<{
8
+ code: number | string;
9
+ title: string;
10
+ lead?: string;
11
+ homeHref?: string;
12
+ homeLabel: string;
13
+ }>();
14
+
15
+ defineEmits<{
16
+ /** The home link was clicked; call `preventDefault()` to navigate yourself. */
17
+ home: [event: MouseEvent];
18
+ }>();
19
+
20
+ // Like UxSite, it brings its own styles: the host can load everything else after first paint.
21
+ inject(uxRenderHookKey, null)?.();
22
+ </script>
23
+
24
+ <template>
25
+ <div class="ux-site">
26
+ <main class="ux-error">
27
+ <p class="ux-error__code ux-mono">Error {{ code }}</p>
28
+ <h1 class="ux-error__title">{{ title }}</h1>
29
+ <p v-if="lead" class="ux-error__lead">{{ lead }}</p>
30
+ <UxPillLink
31
+ :href="homeHref"
32
+ :label="homeLabel"
33
+ :arrow="false"
34
+ :scramble="false"
35
+ @click="$emit('home', $event)"
36
+ />
37
+ </main>
38
+ </div>
39
+ </template>
40
+
41
+ <style>
42
+ /* An error page replaces the whole app, so it brings the base styles itself. */
43
+ @import "../styles/index.css";
44
+ </style>
45
+
46
+ <style scoped>
47
+ .ux-error {
48
+ display: grid;
49
+ align-content: center;
50
+ justify-items: start;
51
+ gap: 1.5rem;
52
+ min-height: 100vh;
53
+ min-height: 100svh;
54
+ padding: var(--ux-gutter);
55
+ background: radial-gradient(60% 50% at 70% 40%, rgb(120 140 255 / 0.08), transparent 70%);
56
+ }
57
+
58
+ .ux-error__code {
59
+ color: var(--ux-fg-2);
60
+ }
61
+
62
+ .ux-error__title {
63
+ font-size: clamp(2.75rem, 1rem + 6vw, 6.5rem);
64
+ font-weight: 500;
65
+ line-height: 0.95;
66
+ letter-spacing: -0.055em;
67
+ }
68
+
69
+ .ux-error__lead {
70
+ max-width: 30rem;
71
+ font-size: 1.125rem;
72
+ color: var(--ux-fg-2);
73
+ }
74
+ </style>