@uxfront/ui 0.9.1 → 0.9.2

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.
Files changed (34) hide show
  1. package/README.md +46 -46
  2. package/package.json +4 -4
  3. package/src/components/UxAnchor.vue +100 -100
  4. package/src/components/UxChapter.vue +157 -157
  5. package/src/components/UxChips.vue +32 -32
  6. package/src/components/UxCode.vue +42 -42
  7. package/src/components/UxErrorPage.vue +37 -37
  8. package/src/components/UxFeatures.vue +70 -70
  9. package/src/components/UxFinale.vue +148 -148
  10. package/src/components/UxHeader.vue +171 -171
  11. package/src/components/UxHero.vue +179 -179
  12. package/src/components/UxHeroLine.vue +18 -18
  13. package/src/components/UxHud.vue +139 -137
  14. package/src/components/UxPillLink.vue +41 -41
  15. package/src/components/UxPillars.vue +22 -22
  16. package/src/components/UxSection.vue +60 -60
  17. package/src/components/UxSite.vue +52 -48
  18. package/src/components/UxSpec.vue +21 -21
  19. package/src/components/UxSplit.vue +138 -138
  20. package/src/components/UxStage.vue +40 -38
  21. package/src/components/UxStageFallback.vue +28 -28
  22. package/src/components/UxTraits.vue +55 -55
  23. package/src/components/UxVideo.vue +50 -40
  24. package/src/components/icons/UxArrowIcon.vue +4 -4
  25. package/src/components/icons/UxFrameworkLogo.vue +4 -4
  26. package/src/components/icons/UxFrontMark.vue +10 -10
  27. package/src/components/icons/UxGithubIcon.vue +6 -6
  28. package/src/components/icons/UxStarIcon.vue +6 -6
  29. package/src/composables/experience.ts +58 -53
  30. package/src/directives/scramble.ts +41 -37
  31. package/src/frameworks.ts +12 -12
  32. package/src/styles/base.css +88 -88
  33. package/src/styles/tokens.css +28 -28
  34. package/src/types.ts +26 -26
@@ -1,92 +1,92 @@
1
1
  <script setup lang="ts">
2
2
  import type { UxTrait } from "../types";
3
3
 
4
- defineProps<{ items: UxTrait[] }>();
4
+ defineProps<{ items: Array<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
9
  A cell with `href` is a link. -->
10
- <ul class="ux-traits">
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>
23
- </ul>
10
+ <ul class="ux-traits">
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>
23
+ </ul>
24
24
  </template>
25
25
 
26
26
  <style scoped>
27
27
  .ux-traits {
28
- display: grid;
29
- grid-template-columns: repeat(2, minmax(0, 1fr));
30
- gap: 1px;
31
- padding: 0;
32
- list-style: none;
33
- border: 1px solid var(--ux-line);
34
- background: var(--ux-line);
28
+ display: grid;
29
+ grid-template-columns: repeat(2, minmax(0, 1fr));
30
+ gap: 1px;
31
+ padding: 0;
32
+ list-style: none;
33
+ border: 1px solid var(--ux-line);
34
+ background: var(--ux-line);
35
35
  }
36
36
 
37
37
  .ux-traits li,
38
38
  .ux-traits__link {
39
- display: grid;
40
- align-content: start;
41
- gap: 0.4rem;
42
- padding: 1rem 1.1rem 1.15rem;
43
- font-size: 0.875rem;
44
- line-height: 1.45;
45
- color: color-mix(in srgb, var(--ux-fg-2) calc(var(--active, 0) * 100%), var(--ux-fg-3));
46
- background: color-mix(
47
- in srgb,
48
- rgb(255 255 255 / 0.06) calc(var(--active, 0) * 100%),
49
- var(--ux-bg)
50
- );
39
+ display: grid;
40
+ align-content: start;
41
+ gap: 0.4rem;
42
+ padding: 1rem 1.1rem 1.15rem;
43
+ font-size: 0.875rem;
44
+ line-height: 1.45;
45
+ color: color-mix(in srgb, var(--ux-fg-2) calc(var(--active, 0) * 100%), var(--ux-fg-3));
46
+ background: color-mix(
47
+ in srgb,
48
+ rgb(255 255 255 / 0.06) calc(var(--active, 0) * 100%),
49
+ var(--ux-bg)
50
+ );
51
51
  }
52
52
 
53
53
  /* A linked cell is the link, edge to edge. */
54
54
  .ux-traits .ux-traits__linked {
55
- display: block;
56
- padding: 0;
57
- background: none;
55
+ display: block;
56
+ padding: 0;
57
+ background: none;
58
58
  }
59
59
 
60
60
  .ux-traits__link {
61
- height: 100%;
62
- text-decoration: none;
63
- transition: background 0.5s var(--ux-ease-out);
61
+ height: 100%;
62
+ text-decoration: none;
63
+ transition: background 0.5s var(--ux-ease-out);
64
64
  }
65
65
 
66
66
  .ux-traits__link:hover {
67
- background: rgb(255 255 255 / 0.08);
67
+ background: rgb(255 255 255 / 0.08);
68
68
  }
69
69
 
70
70
  .ux-traits strong {
71
- font-size: 1rem;
72
- font-weight: 500;
73
- letter-spacing: -0.01em;
74
- color: var(--ux-fg);
71
+ font-size: 1rem;
72
+ font-weight: 500;
73
+ letter-spacing: -0.01em;
74
+ color: var(--ux-fg);
75
75
  }
76
76
 
77
77
  .ux-traits__link strong::after {
78
- content: " →";
79
- color: var(--ux-fg-3);
78
+ content: " →";
79
+ color: var(--ux-fg-3);
80
80
  }
81
81
 
82
82
  @media (max-width: 760px) {
83
- .ux-traits {
84
- grid-template-columns: 1fr;
85
- }
83
+ .ux-traits {
84
+ grid-template-columns: 1fr;
85
+ }
86
86
 
87
- .ux-traits li,
88
- .ux-traits__link {
89
- padding: 0.7rem 0.9rem;
90
- }
87
+ .ux-traits li,
88
+ .ux-traits__link {
89
+ padding: 0.7rem 0.9rem;
90
+ }
91
91
  }
92
92
  </style>
@@ -4,13 +4,13 @@ import { computed, onBeforeUnmount, onMounted, ref, useTemplateRef, watch } from
4
4
  import { useExperience } from "../composables/experience";
5
5
 
6
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;
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
14
  }>();
15
15
 
16
16
  // Only the poster loads with the page: the video loads and plays once it
@@ -24,58 +24,68 @@ let inView = false;
24
24
  let observer: IntersectionObserver | undefined;
25
25
 
26
26
  const follow = () => {
27
- const el = video.value;
28
- if (!el || still.value) return;
29
- if (inView) el.play().catch(() => {});
30
- else el.pause();
27
+ const el = video.value;
28
+ if (!el || still.value) {
29
+ return;
30
+ }
31
+ if (inView) {
32
+ el.play().catch(() => {});
33
+ } else {
34
+ el.pause();
35
+ }
31
36
  };
32
37
 
33
38
  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!);
39
+ reducedMotion.value = matchMedia("(prefers-reduced-motion: reduce)").matches;
40
+ observer = new IntersectionObserver(([entry]) => {
41
+ inView = entry?.isIntersecting ?? false;
42
+ follow();
43
+ });
44
+ if (video.value) {
45
+ observer.observe(video.value);
46
+ }
40
47
  });
41
48
  onBeforeUnmount(() => observer?.disconnect());
42
49
 
43
50
  watch(still, (now) => {
44
- if (now) video.value?.pause();
45
- else follow();
51
+ if (now) {
52
+ video.value?.pause();
53
+ } else {
54
+ follow();
55
+ }
46
56
  });
47
57
  </script>
48
58
 
49
59
  <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>
60
+ <video
61
+ ref="video"
62
+ class="ux-video"
63
+ :poster="poster"
64
+ :width="width"
65
+ :height="height"
66
+ :aria-label="label"
67
+ :controls="still"
68
+ preload="none"
69
+ muted
70
+ loop
71
+ playsinline
72
+ >
73
+ <source :src="src" type="video/mp4" />
74
+ </video>
65
75
  </template>
66
76
 
67
77
  <style scoped>
68
78
  .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);
79
+ display: block;
80
+ height: auto;
81
+ border: 1px solid var(--ux-line-strong);
82
+ border-radius: 6px;
83
+ background: var(--ux-bg);
74
84
  }
75
85
 
76
86
  /* The container's width by default. :where() keeps this rule below any class
77
87
  a page sets on the video, like `width: min(100%, 70svh)`. */
78
88
  :where(.ux-video) {
79
- width: 100%;
89
+ width: 100%;
80
90
  }
81
91
  </style>
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <!-- An arrow pointing up and out: the link leaves the page. -->
3
- <svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
4
- <path d="M4.5 11.5l7-7M5.5 4.5h6v6" fill="none" stroke="currentColor" stroke-width="1.4" />
5
- </svg>
2
+ <!-- An arrow pointing up and out: the link leaves the page. -->
3
+ <svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
4
+ <path d="M4.5 11.5l7-7M5.5 4.5h6v6" fill="none" stroke="currentColor" stroke-width="1.4" />
5
+ </svg>
6
6
  </template>
@@ -6,8 +6,8 @@ defineProps<{ name: Framework }>();
6
6
  </script>
7
7
 
8
8
  <template>
9
- <!-- Filled with the current text colour. -->
10
- <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
11
- <path fill="currentColor" :d="FRAMEWORK_LOGOS[name]" />
12
- </svg>
9
+ <!-- Filled with the current text colour. -->
10
+ <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
11
+ <path fill="currentColor" :d="FRAMEWORK_LOGOS[name]" />
12
+ </svg>
13
13
  </template>
@@ -1,12 +1,12 @@
1
1
  <template>
2
- <!-- Four rounded U strokes, each a quarter turn from the last: the UXFront mark. -->
3
- <svg viewBox="-43.5 -43.5 87 87" fill="none" aria-hidden="true" focusable="false">
4
- <path
5
- d="M-21-38V-16A14 14 0 0 0-7-2H7A14 14 0 0 0 21-16V-38M38-21H16A14 14 0 0 0 2-7V7A14 14 0 0 0 16 21H38M21 38V16A14 14 0 0 0 7 2H-7A14 14 0 0 0-21 16V38M-38 21H-16A14 14 0 0 0-2 7V-7A14 14 0 0 0-16-21H-38"
6
- stroke="currentColor"
7
- stroke-width="8"
8
- stroke-linecap="round"
9
- stroke-linejoin="round"
10
- />
11
- </svg>
2
+ <!-- Four rounded U strokes, each a quarter turn from the last: the UXFront mark. -->
3
+ <svg viewBox="-43.5 -43.5 87 87" fill="none" aria-hidden="true" focusable="false">
4
+ <path
5
+ d="M-21-38V-16A14 14 0 0 0-7-2H7A14 14 0 0 0 21-16V-38M38-21H16A14 14 0 0 0 2-7V7A14 14 0 0 0 16 21H38M21 38V16A14 14 0 0 0 7 2H-7A14 14 0 0 0-21 16V38M-38 21H-16A14 14 0 0 0-2 7V-7A14 14 0 0 0-16-21H-38"
6
+ stroke="currentColor"
7
+ stroke-width="8"
8
+ stroke-linecap="round"
9
+ stroke-linejoin="round"
10
+ />
11
+ </svg>
12
12
  </template>
@@ -1,8 +1,8 @@
1
1
  <template>
2
- <svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
3
- <path
4
- fill="currentColor"
5
- d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"
6
- />
7
- </svg>
2
+ <svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
3
+ <path
4
+ fill="currentColor"
5
+ d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"
6
+ />
7
+ </svg>
8
8
  </template>
@@ -1,8 +1,8 @@
1
1
  <template>
2
- <svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
3
- <path
4
- fill="currentColor"
5
- d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Z"
6
- />
7
- </svg>
2
+ <svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
3
+ <path
4
+ fill="currentColor"
5
+ d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Z"
6
+ />
7
+ </svg>
8
8
  </template>
@@ -4,25 +4,25 @@ import { inject, provide, shallowReactive } from "vue";
4
4
  import type { InjectionKey } from "vue";
5
5
 
6
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;
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: ReadonlyArray<string>;
11
+ setMotion(on: boolean): void;
12
12
  }
13
13
 
14
14
  export interface StageElements {
15
- canvas: HTMLCanvasElement;
16
- /** Layers holding the `[data-anchor]` labels. */
17
- anchorRoots: HTMLElement[];
15
+ canvas: HTMLCanvasElement;
16
+ /** Layers holding the `[data-anchor]` labels. */
17
+ anchorRoots: Array<HTMLElement>;
18
18
  }
19
19
 
20
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;
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
26
  }
27
27
 
28
28
  const experienceKey: InjectionKey<ExperienceHost> = Symbol("uxfront:experience");
@@ -31,56 +31,61 @@ const experienceKey: InjectionKey<ExperienceHost> = Symbol("uxfront:experience")
31
31
  * Provides the scene's state to the components below (`UxSite` calls it).
32
32
  * Nothing runs until `start()`, which only happens on the client.
33
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;
34
+ export function provideExperience(formations: ReadonlyArray<Formation>): ExperienceHost {
35
+ const state = shallowReactive(initialExperienceState());
36
+ let experience: Experience | null = null;
37
+ let stage: StageElements | null = null;
38
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;
39
+ const host: ExperienceHost = {
40
+ state,
41
+ labels: formations.map((formation) => formation.label),
42
+ setMotion(on) {
43
+ if (experience) {
44
+ experience.setMotion(on);
45
+ } else {
46
+ state.motion = on;
47
+ }
48
+ },
49
+ attachStage(elements) {
50
+ stage = elements;
51
+ },
52
+ start(root) {
53
+ if (experience || !stage) {
54
+ return;
55
+ }
56
+ experience = createExperience({
57
+ root,
58
+ canvas: stage.canvas,
59
+ formations,
60
+ anchorRoots: stage.anchorRoots,
61
+ });
62
+ Object.assign(state, experience.state);
63
+ experience.subscribe((next) => Object.assign(state, next));
64
+ },
65
+ stop() {
66
+ experience?.destroy();
67
+ experience = null;
68
+ },
69
+ };
70
+ provide(experienceKey, host);
71
+ return host;
67
72
  }
68
73
 
69
74
  const detached: ExperienceHost = {
70
- state: initialExperienceState(),
71
- labels: [],
72
- setMotion() {},
73
- attachStage() {},
74
- start() {},
75
- stop() {},
75
+ state: initialExperienceState(),
76
+ labels: [],
77
+ setMotion() {},
78
+ attachStage() {},
79
+ start() {},
80
+ stop() {},
76
81
  };
77
82
 
78
83
  /** The scene's state, inside a `UxSite`. Outside one, a still, empty scene. */
79
84
  export function useExperience(): ExperienceContext {
80
- return inject(experienceKey, detached);
85
+ return inject(experienceKey, detached);
81
86
  }
82
87
 
83
88
  /** @internal For `UxStage`. */
84
89
  export function useExperienceHost(): ExperienceHost {
85
- return inject(experienceKey, detached);
90
+ return inject(experienceKey, detached);
86
91
  }
@@ -10,43 +10,47 @@ const cleanups = new WeakMap<HTMLElement, () => void>();
10
10
  * hovered or focused. Meant for monospace text, so the width never changes.
11
11
  */
12
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;
13
+ mounted(el) {
14
+ const text = el.textContent ?? "";
15
+ const trigger = el.closest<HTMLElement>("a, button") ?? el;
16
+ let frame = 0;
17
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
- };
18
+ const play = () => {
19
+ if (matchMedia("(prefers-reduced-motion: reduce)").matches) {
20
+ return;
21
+ }
22
+ cancelAnimationFrame(frame);
23
+ const start = performance.now();
24
+ const step = (now: number) => {
25
+ const progress = Math.min(1, (now - start) / DURATION);
26
+ const settled = Math.floor(progress * text.length);
27
+ let out = "";
28
+ for (let i = 0; i < text.length; i++) {
29
+ const char = text.charAt(i);
30
+ out +=
31
+ i < settled || char === " " || char === "."
32
+ ? char
33
+ : GLYPHS[Math.floor(Math.random() * GLYPHS.length)];
34
+ }
35
+ el.textContent = out;
36
+ if (progress < 1) {
37
+ frame = requestAnimationFrame(step);
38
+ }
39
+ };
40
+ frame = requestAnimationFrame(step);
41
+ };
38
42
 
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
- },
43
+ trigger.addEventListener("pointerenter", play);
44
+ trigger.addEventListener("focus", play);
45
+ cleanups.set(el, () => {
46
+ cancelAnimationFrame(frame);
47
+ el.textContent = text;
48
+ trigger.removeEventListener("pointerenter", play);
49
+ trigger.removeEventListener("focus", play);
50
+ });
51
+ },
52
+ unmounted(el) {
53
+ cleanups.get(el)?.();
54
+ cleanups.delete(el);
55
+ },
52
56
  };
package/src/frameworks.ts CHANGED
@@ -7,16 +7,16 @@ export type Framework = (typeof FRAMEWORKS)[number];
7
7
 
8
8
  /** Monochrome marks from Simple Icons (CC0), on a 24 × 24 view box. */
9
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",
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
22
  };