@uxfront/ui 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -80,17 +80,17 @@ const scene = [
80
80
 
81
81
  ## Components
82
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: a large `mark` slot, kicker, `title`, `lead`, an `actions` slot (buttons), 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, empty for none; `brand` slot to style the name), a `byline` slot beside it for links like "by UXFront", section nav (marks the one held) 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`. |
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: a large `mark` slot, kicker, `title`, `lead`, an `actions` slot (buttons), 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, empty for none; `brand` slot to style the name), a `byline` slot beside it for links like "by UXFront", section nav (marks the one held), an `actions` slot for extra links and a GitHub link (with an optional `githubStars` count). |
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`, `UxStarIcon`, `UxFrameworkLogo`, `UxFrontMark`. |
94
94
 
95
95
  Also exported: `useExperience()` (the scene's reactive state inside a `UxSite`), the `v-scramble` directive, `FRAMEWORKS` and their logos, and `uxRenderHookKey`.
96
96
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxfront/ui",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Vue components for the uxfront.com family of homepages: a scroll-driven WebGL scene with pinned chapters, a HUD, a header and a finale, in one look.",
5
5
  "keywords": [
6
6
  "components",
@@ -3,6 +3,7 @@ import { useExperience } from "../composables/experience";
3
3
  import type { UxNavItem } from "../types";
4
4
  import UxFrontMark from "./icons/UxFrontMark.vue";
5
5
  import UxGithubIcon from "./icons/UxGithubIcon.vue";
6
+ import UxStarIcon from "./icons/UxStarIcon.vue";
6
7
 
7
8
  const {
8
9
  homeHref = "#top",
@@ -18,6 +19,8 @@ const {
18
19
  navLabel?: string;
19
20
  /** A GitHub URL, linked at the end of the header. */
20
21
  github?: string;
22
+ /** The repository's star count, shown beside the GitHub link. Leave it out to hide it. */
23
+ githubStars?: number;
21
24
  }>();
22
25
 
23
26
  defineSlots<{
@@ -30,9 +33,14 @@ defineSlots<{
30
33
  * like "by <a>UXFront</a>". Smaller and muted.
31
34
  */
32
35
  byline?(): unknown;
36
+ /** Extra links at the end of the header, before the GitHub link. */
37
+ actions?(): unknown;
33
38
  }>();
34
39
 
35
40
  const { state } = useExperience();
41
+
42
+ const compact = new Intl.NumberFormat("en", { notation: "compact" });
43
+ const full = new Intl.NumberFormat("en");
36
44
  </script>
37
45
 
38
46
  <template>
@@ -66,10 +74,22 @@ const { state } = useExperience();
66
74
  </li>
67
75
  </ul>
68
76
  </nav>
69
- <a v-if="github" class="ux-header__github" :href="github">
70
- <UxGithubIcon />
71
- <span>GitHub</span>
72
- </a>
77
+ <div v-if="$slots.actions || github" class="ux-header__end">
78
+ <slot name="actions" />
79
+ <a
80
+ v-if="github"
81
+ class="ux-header__github"
82
+ :href="github"
83
+ :aria-label="githubStars == null ? undefined : `GitHub, ${full.format(githubStars)} stars`"
84
+ >
85
+ <UxGithubIcon />
86
+ <span>GitHub</span>
87
+ <span v-if="githubStars != null" class="ux-header__stars">
88
+ <UxStarIcon />
89
+ {{ compact.format(githubStars) }}
90
+ </span>
91
+ </a>
92
+ </div>
73
93
  </header>
74
94
  </template>
75
95
 
@@ -190,6 +210,23 @@ const { state } = useExperience();
190
210
  color: var(--ux-fg-3);
191
211
  }
192
212
 
213
+ .ux-header__end {
214
+ display: flex;
215
+ align-items: center;
216
+ gap: 1.5rem;
217
+ }
218
+
219
+ .ux-header__end :slotted(a) {
220
+ gap: 0.5rem;
221
+ font-size: 0.875rem;
222
+ color: var(--ux-fg-2);
223
+ transition: color 0.3s var(--ux-ease-out);
224
+ }
225
+
226
+ .ux-header__end :slotted(a:hover) {
227
+ color: var(--ux-fg);
228
+ }
229
+
193
230
  .ux-header__github {
194
231
  gap: 0.5rem;
195
232
  font-size: 0.875rem;
@@ -200,6 +237,24 @@ const { state } = useExperience();
200
237
  height: 1.125rem;
201
238
  }
202
239
 
240
+ .ux-header__stars {
241
+ display: inline-flex;
242
+ align-items: center;
243
+ gap: 0.25rem;
244
+ padding: 0.125rem 0.5rem;
245
+ border: 1px solid var(--ux-line-strong);
246
+ border-radius: 999px;
247
+ font-family: var(--font-ux-mono);
248
+ font-size: 0.75rem;
249
+ font-variant-numeric: tabular-nums;
250
+ color: var(--ux-fg-2);
251
+ }
252
+
253
+ .ux-header__github .ux-header__stars svg {
254
+ width: 0.75rem;
255
+ height: 0.75rem;
256
+ }
257
+
203
258
  @media (max-width: 960px) {
204
259
  .ux-header__nav {
205
260
  display: none;
@@ -0,0 +1,8 @@
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>
8
+ </template>
package/src/index.ts CHANGED
@@ -18,6 +18,7 @@ export { default as UxArrowIcon } from "./components/icons/UxArrowIcon.vue";
18
18
  export { default as UxFrameworkLogo } from "./components/icons/UxFrameworkLogo.vue";
19
19
  export { default as UxFrontMark } from "./components/icons/UxFrontMark.vue";
20
20
  export { default as UxGithubIcon } from "./components/icons/UxGithubIcon.vue";
21
+ export { default as UxStarIcon } from "./components/icons/UxStarIcon.vue";
21
22
  export { provideExperience, useExperience } from "./composables";
22
23
  export type { ExperienceContext, ExperienceHost, StageElements } from "./composables";
23
24
  export { vScramble } from "./directives";