@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 +112 -0
- package/package.json +59 -0
- package/src/components/UxAnchor.vue +162 -0
- package/src/components/UxChapter.vue +236 -0
- package/src/components/UxChips.vue +51 -0
- package/src/components/UxErrorPage.vue +74 -0
- package/src/components/UxFinale.vue +230 -0
- package/src/components/UxHeader.vue +160 -0
- package/src/components/UxHero.vue +265 -0
- package/src/components/UxHeroLine.vue +43 -0
- package/src/components/UxHud.vue +210 -0
- package/src/components/UxPillLink.vue +60 -0
- package/src/components/UxPillars.vue +44 -0
- package/src/components/UxSite.vue +93 -0
- package/src/components/UxSpec.vue +45 -0
- package/src/components/UxStage.vue +82 -0
- package/src/components/UxStageFallback.vue +46 -0
- package/src/components/UxTraits.vue +59 -0
- package/src/components/icons/UxArrowIcon.vue +6 -0
- package/src/components/icons/UxFrameworkLogo.vue +13 -0
- package/src/components/icons/UxFrontMark.vue +12 -0
- package/src/components/icons/UxGithubIcon.vue +8 -0
- package/src/composables/experience.ts +86 -0
- package/src/composables/index.ts +2 -0
- package/src/directives/index.ts +1 -0
- package/src/directives/scramble.ts +52 -0
- package/src/frameworks.ts +22 -0
- package/src/index.ts +27 -0
- package/src/keys.ts +8 -0
- package/src/styles/base.css +159 -0
- package/src/styles/index.css +2 -0
- package/src/styles/tokens.css +31 -0
- package/src/types.ts +43 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { createExperience, initialExperienceState } from "@uxfront/scene";
|
|
2
|
+
import type { Experience, ExperienceState, Formation } from "@uxfront/scene";
|
|
3
|
+
import { inject, provide, shallowReactive } from "vue";
|
|
4
|
+
import type { InjectionKey } from "vue";
|
|
5
|
+
|
|
6
|
+
export interface ExperienceContext {
|
|
7
|
+
/** Reactive. Written on the client only, so server and client render alike. */
|
|
8
|
+
readonly state: Readonly<ExperienceState>;
|
|
9
|
+
/** The formations' HUD labels, in scene order. */
|
|
10
|
+
readonly labels: readonly string[];
|
|
11
|
+
setMotion(on: boolean): void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface StageElements {
|
|
15
|
+
canvas: HTMLCanvasElement;
|
|
16
|
+
/** Layers holding the `[data-anchor]` labels. */
|
|
17
|
+
anchorRoots: HTMLElement[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ExperienceHost extends ExperienceContext {
|
|
21
|
+
/** Called by `UxStage` once mounted. */
|
|
22
|
+
attachStage(elements: StageElements): void;
|
|
23
|
+
/** Starts the scene over `root` (see `ExperienceOptions.root`). Client-only. */
|
|
24
|
+
start(root: HTMLElement): void;
|
|
25
|
+
stop(): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const experienceKey: InjectionKey<ExperienceHost> = Symbol("uxfront:experience");
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Provides the scene's state to the components below (`UxSite` calls it).
|
|
32
|
+
* Nothing runs until `start()`, which only happens on the client.
|
|
33
|
+
*/
|
|
34
|
+
export function provideExperience(formations: readonly Formation[]): ExperienceHost {
|
|
35
|
+
const state = shallowReactive(initialExperienceState());
|
|
36
|
+
let experience: Experience | null = null;
|
|
37
|
+
let stage: StageElements | null = null;
|
|
38
|
+
|
|
39
|
+
const host: ExperienceHost = {
|
|
40
|
+
state,
|
|
41
|
+
labels: formations.map((formation) => formation.label),
|
|
42
|
+
setMotion(on) {
|
|
43
|
+
if (experience) experience.setMotion(on);
|
|
44
|
+
else state.motion = on;
|
|
45
|
+
},
|
|
46
|
+
attachStage(elements) {
|
|
47
|
+
stage = elements;
|
|
48
|
+
},
|
|
49
|
+
start(root) {
|
|
50
|
+
if (experience || !stage) return;
|
|
51
|
+
experience = createExperience({
|
|
52
|
+
root,
|
|
53
|
+
canvas: stage.canvas,
|
|
54
|
+
formations,
|
|
55
|
+
anchorRoots: stage.anchorRoots,
|
|
56
|
+
});
|
|
57
|
+
Object.assign(state, experience.state);
|
|
58
|
+
experience.subscribe((next) => Object.assign(state, next));
|
|
59
|
+
},
|
|
60
|
+
stop() {
|
|
61
|
+
experience?.destroy();
|
|
62
|
+
experience = null;
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
provide(experienceKey, host);
|
|
66
|
+
return host;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const detached: ExperienceHost = {
|
|
70
|
+
state: initialExperienceState(),
|
|
71
|
+
labels: [],
|
|
72
|
+
setMotion() {},
|
|
73
|
+
attachStage() {},
|
|
74
|
+
start() {},
|
|
75
|
+
stop() {},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/** The scene's state, inside a `UxSite`. Outside one, a still, empty scene. */
|
|
79
|
+
export function useExperience(): ExperienceContext {
|
|
80
|
+
return inject(experienceKey, detached);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** @internal For `UxStage`. */
|
|
84
|
+
export function useExperienceHost(): ExperienceHost {
|
|
85
|
+
return inject(experienceKey, detached);
|
|
86
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { vScramble } from "./scramble";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Directive } from "vue";
|
|
2
|
+
|
|
3
|
+
const GLYPHS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/<>[]{}=+*#";
|
|
4
|
+
const DURATION = 420;
|
|
5
|
+
|
|
6
|
+
const cleanups = new WeakMap<HTMLElement, () => void>();
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Decodes the element's text through random glyphs when its link or button is
|
|
10
|
+
* hovered or focused. Meant for monospace text, so the width never changes.
|
|
11
|
+
*/
|
|
12
|
+
export const vScramble: Directive<HTMLElement> = {
|
|
13
|
+
mounted(el) {
|
|
14
|
+
const text = el.textContent ?? "";
|
|
15
|
+
const trigger = el.closest<HTMLElement>("a, button") ?? el;
|
|
16
|
+
let frame = 0;
|
|
17
|
+
|
|
18
|
+
const play = () => {
|
|
19
|
+
if (matchMedia("(prefers-reduced-motion: reduce)").matches) return;
|
|
20
|
+
cancelAnimationFrame(frame);
|
|
21
|
+
const start = performance.now();
|
|
22
|
+
const step = (now: number) => {
|
|
23
|
+
const progress = Math.min(1, (now - start) / DURATION);
|
|
24
|
+
const settled = Math.floor(progress * text.length);
|
|
25
|
+
let out = "";
|
|
26
|
+
for (let i = 0; i < text.length; i++) {
|
|
27
|
+
const char = text[i]!;
|
|
28
|
+
out +=
|
|
29
|
+
i < settled || char === " " || char === "."
|
|
30
|
+
? char
|
|
31
|
+
: GLYPHS[Math.floor(Math.random() * GLYPHS.length)];
|
|
32
|
+
}
|
|
33
|
+
el.textContent = out;
|
|
34
|
+
if (progress < 1) frame = requestAnimationFrame(step);
|
|
35
|
+
};
|
|
36
|
+
frame = requestAnimationFrame(step);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
trigger.addEventListener("pointerenter", play);
|
|
40
|
+
trigger.addEventListener("focus", play);
|
|
41
|
+
cleanups.set(el, () => {
|
|
42
|
+
cancelAnimationFrame(frame);
|
|
43
|
+
el.textContent = text;
|
|
44
|
+
trigger.removeEventListener("pointerenter", play);
|
|
45
|
+
trigger.removeEventListener("focus", play);
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
unmounted(el) {
|
|
49
|
+
cleanups.get(el)?.();
|
|
50
|
+
cleanups.delete(el);
|
|
51
|
+
},
|
|
52
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The seven frameworks Unframework compiles to, in the order of the prism's
|
|
3
|
+
* rails (top to bottom) and of the `--ux-spectrum-*` colours.
|
|
4
|
+
*/
|
|
5
|
+
export const FRAMEWORKS = ["Angular", "Svelte", "Astro", "Vue", "React", "Solid", "Qwik"] as const;
|
|
6
|
+
export type Framework = (typeof FRAMEWORKS)[number];
|
|
7
|
+
|
|
8
|
+
/** Monochrome marks from Simple Icons (CC0), on a 24 × 24 view box. */
|
|
9
|
+
export const FRAMEWORK_LOGOS: Record<Framework, string> = {
|
|
10
|
+
Angular:
|
|
11
|
+
"M16.712 17.711H7.288l-1.204 2.916L12 24l5.916-3.373-1.204-2.916ZM14.692 0l7.832 16.855.814-12.856L14.692 0ZM9.308 0 .662 3.999l.814 12.856L9.308 0Zm-.405 13.93h6.198L12 6.396 8.903 13.93Z",
|
|
12
|
+
Svelte:
|
|
13
|
+
"M10.354 21.125a4.44 4.44 0 0 1-4.765-1.767 4.109 4.109 0 0 1-.703-3.107 3.898 3.898 0 0 1 .134-.522l.105-.321.287.21a7.21 7.21 0 0 0 2.186 1.092l.208.063-.02.208a1.253 1.253 0 0 0 .226.83 1.337 1.337 0 0 0 1.435.533 1.231 1.231 0 0 0 .343-.15l5.59-3.562a1.164 1.164 0 0 0 .524-.778 1.242 1.242 0 0 0-.211-.937 1.338 1.338 0 0 0-1.435-.533 1.23 1.23 0 0 0-.343.15l-2.133 1.36a4.078 4.078 0 0 1-1.135.499 4.44 4.44 0 0 1-4.765-1.766 4.108 4.108 0 0 1-.702-3.108 3.855 3.855 0 0 1 1.742-2.582l5.589-3.563a4.072 4.072 0 0 1 1.135-.499 4.44 4.44 0 0 1 4.765 1.767 4.109 4.109 0 0 1 .703 3.107 3.943 3.943 0 0 1-.134.522l-.105.321-.286-.21a7.204 7.204 0 0 0-2.187-1.093l-.208-.063.02-.207a1.255 1.255 0 0 0-.226-.831 1.337 1.337 0 0 0-1.435-.532 1.231 1.231 0 0 0-.343.15L8.62 9.368a1.162 1.162 0 0 0-.524.778 1.24 1.24 0 0 0 .211.937 1.338 1.338 0 0 0 1.435.533 1.235 1.235 0 0 0 .344-.151l2.132-1.36a4.067 4.067 0 0 1 1.135-.498 4.44 4.44 0 0 1 4.765 1.766 4.108 4.108 0 0 1 .702 3.108 3.857 3.857 0 0 1-1.742 2.583l-5.589 3.562a4.072 4.072 0 0 1-1.135.499m10.358-17.95C18.484-.015 14.082-.96 10.9 1.068L5.31 4.63a6.412 6.412 0 0 0-2.896 4.295 6.753 6.753 0 0 0 .666 4.336 6.43 6.43 0 0 0-.96 2.396 6.833 6.833 0 0 0 1.168 5.167c2.229 3.19 6.63 4.135 9.812 2.108l5.59-3.562a6.41 6.41 0 0 0 2.896-4.295 6.756 6.756 0 0 0-.665-4.336 6.429 6.429 0 0 0 .958-2.396 6.831 6.831 0 0 0-1.167-5.168Z",
|
|
14
|
+
Astro:
|
|
15
|
+
"M8.358 20.162c-1.186-1.07-1.532-3.316-1.038-4.944.856 1.026 2.043 1.352 3.272 1.535 1.897.283 3.76.177 5.522-.678.202-.098.388-.229.608-.36.166.473.209.95.151 1.437-.14 1.185-.738 2.1-1.688 2.794-.38.277-.782.525-1.175.787-1.205.804-1.531 1.747-1.078 3.119l.044.148a3.158 3.158 0 0 1-1.407-1.188 3.31 3.31 0 0 1-.544-1.815c-.004-.32-.004-.642-.048-.958-.106-.769-.472-1.113-1.161-1.133-.707-.02-1.267.411-1.415 1.09-.012.053-.028.104-.045.165h.002zm-5.961-4.445s3.24-1.575 6.49-1.575l2.451-7.565c.092-.366.36-.614.662-.614.302 0 .57.248.662.614l2.45 7.565c3.85 0 6.491 1.575 6.491 1.575L16.088.727C15.93.285 15.663 0 15.303 0H8.697c-.36 0-.615.285-.784.727l-5.516 14.99z",
|
|
16
|
+
Vue: "M24,1.61H14.06L12,5.16,9.94,1.61H0L12,22.39ZM12,14.08,5.16,2.23H9.59L12,6.41l2.41-4.18h4.43Z",
|
|
17
|
+
React:
|
|
18
|
+
"M14.23 12.004a2.236 2.236 0 0 1-2.235 2.236 2.236 2.236 0 0 1-2.236-2.236 2.236 2.236 0 0 1 2.235-2.236 2.236 2.236 0 0 1 2.236 2.236zm2.648-10.69c-1.346 0-3.107.96-4.888 2.622-1.78-1.653-3.542-2.602-4.887-2.602-.41 0-.783.093-1.106.278-1.375.793-1.683 3.264-.973 6.365C1.98 8.917 0 10.42 0 12.004c0 1.59 1.99 3.097 5.043 4.03-.704 3.113-.39 5.588.988 6.38.32.187.69.275 1.102.275 1.345 0 3.107-.96 4.888-2.624 1.78 1.654 3.542 2.603 4.887 2.603.41 0 .783-.09 1.106-.275 1.374-.792 1.683-3.263.973-6.365C22.02 15.096 24 13.59 24 12.004c0-1.59-1.99-3.097-5.043-4.032.704-3.11.39-5.587-.988-6.38-.318-.184-.688-.277-1.092-.278zm-.005 1.09v.006c.225 0 .406.044.558.127.666.382.955 1.835.73 3.704-.054.46-.142.945-.25 1.44-.96-.236-2.006-.417-3.107-.534-.66-.905-1.345-1.727-2.035-2.447 1.592-1.48 3.087-2.292 4.105-2.295zm-9.77.02c1.012 0 2.514.808 4.11 2.28-.686.72-1.37 1.537-2.02 2.442-1.107.117-2.154.298-3.113.538-.112-.49-.195-.964-.254-1.42-.23-1.868.054-3.32.714-3.707.19-.09.4-.127.563-.132zm4.882 3.05c.455.468.91.992 1.36 1.564-.44-.02-.89-.034-1.345-.034-.46 0-.915.01-1.36.034.44-.572.895-1.096 1.345-1.565zM12 8.1c.74 0 1.477.034 2.202.093.406.582.802 1.203 1.183 1.86.372.64.71 1.29 1.018 1.946-.308.655-.646 1.31-1.013 1.95-.38.66-.773 1.288-1.18 1.87-.728.063-1.466.098-2.21.098-.74 0-1.477-.035-2.202-.093-.406-.582-.802-1.204-1.183-1.86-.372-.64-.71-1.29-1.018-1.946.303-.657.646-1.313 1.013-1.954.38-.66.773-1.286 1.18-1.868.728-.064 1.466-.098 2.21-.098zm-3.635.254c-.24.377-.48.763-.704 1.16-.225.39-.435.782-.635 1.174-.265-.656-.49-1.31-.676-1.947.64-.15 1.315-.283 2.015-.386zm7.26 0c.695.103 1.365.23 2.006.387-.18.632-.405 1.282-.66 1.933-.2-.39-.41-.783-.64-1.174-.225-.392-.465-.774-.705-1.146zm3.063.675c.484.15.944.317 1.375.498 1.732.74 2.852 1.708 2.852 2.476-.005.768-1.125 1.74-2.857 2.475-.42.18-.88.342-1.355.493-.28-.958-.646-1.956-1.1-2.98.45-1.017.81-2.01 1.085-2.964zm-13.395.004c.278.96.645 1.957 1.1 2.98-.45 1.017-.812 2.01-1.086 2.964-.484-.15-.944-.318-1.37-.5-1.732-.737-2.852-1.706-2.852-2.474 0-.768 1.12-1.742 2.852-2.476.42-.18.88-.342 1.356-.494zm11.678 4.28c.265.657.49 1.312.676 1.948-.64.157-1.316.29-2.016.39.24-.375.48-.762.705-1.158.225-.39.435-.788.636-1.18zm-9.945.02c.2.392.41.783.64 1.175.23.39.465.772.705 1.143-.695-.102-1.365-.23-2.006-.386.18-.63.406-1.282.66-1.933zM17.92 16.32c.112.493.2.968.254 1.423.23 1.868-.054 3.32-.714 3.708-.147.09-.338.128-.563.128-1.012 0-2.514-.807-4.11-2.28.686-.72 1.37-1.536 2.02-2.44 1.107-.118 2.154-.3 3.113-.54zm-11.83.01c.96.234 2.006.415 3.107.532.66.905 1.345 1.727 2.035 2.446-1.595 1.483-3.092 2.295-4.11 2.295-.22-.005-.406-.05-.553-.132-.666-.38-.955-1.834-.73-3.703.054-.46.142-.944.25-1.438zm4.56.64c.44.02.89.034 1.345.034.46 0 .915-.01 1.36-.034-.44.572-.895 1.095-1.345 1.565-.455-.47-.91-.993-1.36-1.565z",
|
|
19
|
+
Solid:
|
|
20
|
+
"M11.558.788A9.082 9.082 0 0 0 9.776.99l-.453.15c-.906.303-1.656.755-2.1 1.348l-.301.452-2.035 3.528c.426-.387.974-.698 1.643-.894h.001l.613-.154h.001a8.82 8.82 0 0 1 1.777-.206c2.916-.053 6.033 1.148 8.423 2.36 2.317 1.175 3.888 2.32 3.987 2.39L24 5.518c-.082-.06-1.66-1.21-3.991-2.386-2.393-1.206-5.521-2.396-8.45-2.343zM8.924 5.366a8.634 8.634 0 0 0-1.745.203l-.606.151c-1.278.376-2.095 1.16-2.43 2.108-.334.948-.188 2.065.487 3.116.33.43.747.813 1.216 1.147L12.328 10h.001a6.943 6.943 0 0 1 6.013 1.013l2.844-.963c-.17-.124-1.663-1.2-3.91-2.34-2.379-1.206-5.479-2.396-8.352-2.344zm5.435 4.497a6.791 6.791 0 0 0-1.984.283L2.94 13.189 0 18.334l9.276-2.992a6.945 6.945 0 0 1 7.408 2.314v.001c.695.903.89 1.906.66 2.808l2.572-4.63c.595-1.041.45-2.225-.302-3.429a6.792 6.792 0 0 0-5.255-2.543zm-3.031 5.341a6.787 6.787 0 0 0-2.006.283L.008 18.492c.175.131 2.02 1.498 4.687 2.768 2.797 1.332 6.37 2.467 9.468 1.712l.454-.152h.002c1.278-.376 2.134-1.162 2.487-2.09.353-.93.207-2.004-.541-2.978a6.791 6.791 0 0 0-5.237-2.548z",
|
|
21
|
+
Qwik: "M7.5469 0a2.957 2.957 0 0 0-2.5606 1.4785L.5332 9.1915a2.957 2.957 0 0 0 0 2.957l4.4531 7.7128A2.955 2.955 0 0 0 7.547 21.338H12l8.5938 2.6484c.2409.0742.4512-.1782.3359-.4023l-1.916-3.7227 4.4531-7.7129a2.957 2.957 0 0 0 0-2.957l-4.4531-7.7129A2.957 2.957 0 0 0 16.453 0zm0 .7656L17.7324 10.67l-1.8965 1.8985.5782 7.5332L6.2676 10.67l2.371-2.373z",
|
|
22
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export { default as UxAnchor } from "./components/UxAnchor.vue";
|
|
2
|
+
export { default as UxChapter } from "./components/UxChapter.vue";
|
|
3
|
+
export { default as UxChips } from "./components/UxChips.vue";
|
|
4
|
+
export { default as UxErrorPage } from "./components/UxErrorPage.vue";
|
|
5
|
+
export { default as UxFinale } from "./components/UxFinale.vue";
|
|
6
|
+
export { default as UxHeader } from "./components/UxHeader.vue";
|
|
7
|
+
export { default as UxHero } from "./components/UxHero.vue";
|
|
8
|
+
export { default as UxHeroLine } from "./components/UxHeroLine.vue";
|
|
9
|
+
export { default as UxHud } from "./components/UxHud.vue";
|
|
10
|
+
export { default as UxPillLink } from "./components/UxPillLink.vue";
|
|
11
|
+
export { default as UxPillars } from "./components/UxPillars.vue";
|
|
12
|
+
export { default as UxSite } from "./components/UxSite.vue";
|
|
13
|
+
export { default as UxSpec } from "./components/UxSpec.vue";
|
|
14
|
+
export { default as UxStage } from "./components/UxStage.vue";
|
|
15
|
+
export { default as UxStageFallback } from "./components/UxStageFallback.vue";
|
|
16
|
+
export { default as UxTraits } from "./components/UxTraits.vue";
|
|
17
|
+
export { default as UxArrowIcon } from "./components/icons/UxArrowIcon.vue";
|
|
18
|
+
export { default as UxFrameworkLogo } from "./components/icons/UxFrameworkLogo.vue";
|
|
19
|
+
export { default as UxFrontMark } from "./components/icons/UxFrontMark.vue";
|
|
20
|
+
export { default as UxGithubIcon } from "./components/icons/UxGithubIcon.vue";
|
|
21
|
+
export { provideExperience, useExperience } from "./composables";
|
|
22
|
+
export type { ExperienceContext, ExperienceHost, StageElements } from "./composables";
|
|
23
|
+
export { vScramble } from "./directives";
|
|
24
|
+
export { FRAMEWORKS, FRAMEWORK_LOGOS } from "./frameworks";
|
|
25
|
+
export type { Framework } from "./frameworks";
|
|
26
|
+
export { uxRenderHookKey } from "./keys";
|
|
27
|
+
export type { UxChip, UxFinaleCard, UxNavItem, UxPillar, UxSpecRow, UxTrait } from "./types";
|
package/src/keys.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { InjectionKey } from "vue";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Called by `UxSite` and `UxErrorPage` while they render. A host can provide
|
|
5
|
+
* it, for example to flag server-rendered pages that carry these components
|
|
6
|
+
* (the Nuxt layer defers their scripts and web fonts until after first paint).
|
|
7
|
+
*/
|
|
8
|
+
export const uxRenderHookKey: InjectionKey<() => void> = Symbol("uxfront:render");
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/* Page base for `.ux-site`. Element rules go through :where() to keep the
|
|
2
|
+
specificity of plain element selectors, so component styles always win. */
|
|
3
|
+
|
|
4
|
+
:root:has(.ux-site) {
|
|
5
|
+
background: var(--ux-bg);
|
|
6
|
+
-webkit-text-size-adjust: 100%;
|
|
7
|
+
text-size-adjust: 100%;
|
|
8
|
+
}
|
|
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;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:root:has(.ux-site) body {
|
|
25
|
+
margin: 0;
|
|
26
|
+
min-height: 100vh;
|
|
27
|
+
font-family: var(--font-ux-sans);
|
|
28
|
+
font-size: 1rem;
|
|
29
|
+
line-height: 1.6;
|
|
30
|
+
color: var(--ux-fg);
|
|
31
|
+
background: var(--ux-bg);
|
|
32
|
+
-webkit-font-smoothing: antialiased;
|
|
33
|
+
-moz-osx-font-smoothing: grayscale;
|
|
34
|
+
text-rendering: optimizeLegibility;
|
|
35
|
+
font-feature-settings: "ss01", "cv11";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:where(.ux-site),
|
|
39
|
+
:where(.ux-site) *,
|
|
40
|
+
:where(.ux-site) *::before,
|
|
41
|
+
:where(.ux-site) *::after {
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:where(.ux-site) ::selection {
|
|
46
|
+
color: var(--ux-bg);
|
|
47
|
+
background: var(--ux-fg);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
:where(.ux-site) :focus-visible {
|
|
51
|
+
outline: 1px solid var(--ux-fg);
|
|
52
|
+
outline-offset: 4px;
|
|
53
|
+
border-radius: 2px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
:where(.ux-site) :is(h1, h2, h3, p, ul, ol, dl, dd) {
|
|
57
|
+
margin: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:where(.ux-site) a {
|
|
61
|
+
color: inherit;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.ux-serif {
|
|
65
|
+
font-family: var(--font-ux-serif);
|
|
66
|
+
font-style: italic;
|
|
67
|
+
font-weight: 400;
|
|
68
|
+
letter-spacing: -0.02em;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.ux-sr-only {
|
|
72
|
+
position: absolute;
|
|
73
|
+
width: 1px;
|
|
74
|
+
height: 1px;
|
|
75
|
+
margin: -1px;
|
|
76
|
+
padding: 0;
|
|
77
|
+
overflow: hidden;
|
|
78
|
+
clip-path: inset(50%);
|
|
79
|
+
white-space: nowrap;
|
|
80
|
+
border: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.ux-mono {
|
|
84
|
+
font-family: var(--font-ux-mono);
|
|
85
|
+
font-size: 0.75rem;
|
|
86
|
+
letter-spacing: 0.08em;
|
|
87
|
+
text-transform: uppercase;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Copy rises into focus as it arrives (the scene adds `.is-in`). Only with
|
|
91
|
+
scripting, so it never hides. */
|
|
92
|
+
@media (scripting: enabled) {
|
|
93
|
+
.ux-site [data-reveal] > * {
|
|
94
|
+
opacity: 0;
|
|
95
|
+
transform: translate3d(0, 1.25rem, 0);
|
|
96
|
+
filter: blur(8px);
|
|
97
|
+
transition:
|
|
98
|
+
opacity 0.9s var(--ux-ease-out),
|
|
99
|
+
transform 1.2s var(--ux-ease-out),
|
|
100
|
+
filter 1s var(--ux-ease-out);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.ux-site [data-reveal].is-in > * {
|
|
104
|
+
opacity: 1;
|
|
105
|
+
transform: none;
|
|
106
|
+
filter: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.ux-site [data-reveal].is-in > :nth-child(2) {
|
|
110
|
+
transition-delay: 0.07s;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.ux-site [data-reveal].is-in > :nth-child(3) {
|
|
114
|
+
transition-delay: 0.14s;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.ux-site [data-reveal].is-in > :nth-child(4) {
|
|
118
|
+
transition-delay: 0.21s;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.ux-site [data-reveal].is-in > :nth-child(5) {
|
|
122
|
+
transition-delay: 0.28s;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.ux-site [data-reveal].is-in > :nth-child(n + 6) {
|
|
126
|
+
transition-delay: 0.35s;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* Step-through highlights while a section is pinned (`data-steps` on the
|
|
131
|
+
section, `data-step-item` on its items): the current item gets --active: 1. */
|
|
132
|
+
:where(.ux-site) [data-step-item] {
|
|
133
|
+
transition:
|
|
134
|
+
color 0.5s var(--ux-ease-out),
|
|
135
|
+
border-color 0.5s var(--ux-ease-out),
|
|
136
|
+
background-color 0.5s var(--ux-ease-out);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
[data-step="0"] [data-step-item="0"],
|
|
140
|
+
[data-step="1"] [data-step-item="1"],
|
|
141
|
+
[data-step="2"] [data-step-item="2"],
|
|
142
|
+
[data-step="3"] [data-step-item="3"],
|
|
143
|
+
[data-step="4"] [data-step-item="4"],
|
|
144
|
+
[data-step="5"] [data-step-item="5"],
|
|
145
|
+
[data-step="6"] [data-step-item="6"],
|
|
146
|
+
[data-step="7"] [data-step-item="7"],
|
|
147
|
+
[data-step="8"] [data-step-item="8"],
|
|
148
|
+
[data-step="9"] [data-step-item="9"] {
|
|
149
|
+
--active: 1;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@media (prefers-reduced-motion: reduce) {
|
|
153
|
+
.ux-site [data-reveal] > * {
|
|
154
|
+
opacity: 1;
|
|
155
|
+
transform: none;
|
|
156
|
+
filter: none;
|
|
157
|
+
transition: none;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* Design tokens, on the root of every page that renders a `.ux-site` (so a
|
|
2
|
+
docs page in the same app keeps its own). Override them with the same
|
|
3
|
+
selector; keep --ux-bg, which the scene's canvas paints itself. */
|
|
4
|
+
:root:has(.ux-site) {
|
|
5
|
+
color-scheme: dark;
|
|
6
|
+
|
|
7
|
+
--ux-bg: #050507;
|
|
8
|
+
--ux-fg: #f2f2f5;
|
|
9
|
+
--ux-fg-2: #b4b4c0;
|
|
10
|
+
--ux-fg-3: #8b8b98;
|
|
11
|
+
--ux-line: rgb(255 255 255 / 0.1);
|
|
12
|
+
--ux-line-strong: rgb(255 255 255 / 0.24);
|
|
13
|
+
|
|
14
|
+
/* The prism's spectrum, one colour per rail (see FRAMEWORKS). */
|
|
15
|
+
--ux-spectrum-0: #ff4a5a;
|
|
16
|
+
--ux-spectrum-1: #ff8a3d;
|
|
17
|
+
--ux-spectrum-2: #ffd24d;
|
|
18
|
+
--ux-spectrum-3: #4dff8f;
|
|
19
|
+
--ux-spectrum-4: #4dcfff;
|
|
20
|
+
--ux-spectrum-5: #6f86ff;
|
|
21
|
+
--ux-spectrum-6: #b27dff;
|
|
22
|
+
|
|
23
|
+
/* Named `--font-*` so @nuxt/fonts finds the families to self-host. */
|
|
24
|
+
--font-ux-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
25
|
+
--font-ux-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
26
|
+
--font-ux-serif: "Instrument Serif", ui-serif, Georgia, "Times New Roman", serif;
|
|
27
|
+
|
|
28
|
+
--ux-gutter: clamp(1.25rem, 3.2vw, 3rem);
|
|
29
|
+
--ux-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
|
|
30
|
+
--ux-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
|
|
31
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Framework } from "./frameworks";
|
|
2
|
+
|
|
3
|
+
export interface UxNavItem {
|
|
4
|
+
/** A section anchor (`#id`) marks the item current while its section is held. */
|
|
5
|
+
href: string;
|
|
6
|
+
label: string;
|
|
7
|
+
/** Shown before the label, like `01`. */
|
|
8
|
+
index?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface UxPillar {
|
|
12
|
+
/** A short mono code, like `UX`. */
|
|
13
|
+
code: string;
|
|
14
|
+
title: string;
|
|
15
|
+
text: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface UxChip {
|
|
19
|
+
label: string;
|
|
20
|
+
/** Border and highlight colour, like `var(--ux-spectrum-0)`. */
|
|
21
|
+
tone?: string;
|
|
22
|
+
/** Shows the framework's mark before the label. */
|
|
23
|
+
framework?: Framework;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface UxTrait {
|
|
27
|
+
title: string;
|
|
28
|
+
text: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface UxSpecRow {
|
|
32
|
+
term: string;
|
|
33
|
+
detail: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface UxFinaleCard {
|
|
37
|
+
href: string;
|
|
38
|
+
name: string;
|
|
39
|
+
/** Mono line above the name, like `01 · Standard`. */
|
|
40
|
+
meta?: string;
|
|
41
|
+
/** Mono line below the name, scrambled on hover; defaults to `href` without its protocol. */
|
|
42
|
+
domain?: string;
|
|
43
|
+
}
|