@nous-research/ui 0.13.2 → 0.14.1
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 +16 -0
- package/dist/assets/filler-bg0.webp +0 -0
- package/dist/assets.d.ts +38 -0
- package/dist/fonts.d.ts +0 -1
- package/dist/fonts.js +5 -7
- package/dist/hooks/use-capped-frame.d.ts +0 -1
- package/dist/hooks/use-capped-frame.js +12 -13
- package/dist/hooks/use-css-var-dims.d.ts +0 -1
- package/dist/hooks/use-css-var-dims.js +26 -21
- package/dist/hooks/use-gpu-tier.d.ts +0 -1
- package/dist/hooks/use-gpu-tier.js +90 -110
- package/dist/hooks/use-render-loop.d.ts +0 -1
- package/dist/hooks/use-render-loop.js +58 -58
- package/dist/hooks/use-smooth-controls.d.ts +0 -1
- package/dist/hooks/use-smooth-controls.js +204 -206
- package/dist/index.d.ts +0 -1
- package/dist/index.js +84 -58
- package/dist/ui/basic-page.d.ts +1 -2
- package/dist/ui/basic-page.js +15 -7
- package/dist/ui/build.css +1 -0
- package/dist/ui/components/animated-count.d.ts +1 -2
- package/dist/ui/components/animated-count.js +109 -85
- package/dist/ui/components/ascii.d.ts +2 -3
- package/dist/ui/components/ascii.js +75 -59
- package/dist/ui/components/badge.d.ts +1 -2
- package/dist/ui/components/badge.js +35 -18
- package/dist/ui/components/badges/nous-girl.d.ts +1 -2
- package/dist/ui/components/badges/nous-girl.js +80 -3
- package/dist/ui/components/blend-mode.d.ts +1 -2
- package/dist/ui/components/blend-mode.js +55 -63
- package/dist/ui/components/blink.d.ts +1 -2
- package/dist/ui/components/blink.js +15 -6
- package/dist/ui/components/button.d.ts +2 -3
- package/dist/ui/components/button.js +139 -90
- package/dist/ui/components/command-block.d.ts +2 -3
- package/dist/ui/components/command-block.js +52 -24
- package/dist/ui/components/cursor.d.ts +1 -2
- package/dist/ui/components/cursor.js +93 -54
- package/dist/ui/components/dropdown-menu.d.ts +1 -2
- package/dist/ui/components/dropdown-menu.js +99 -51
- package/dist/ui/components/fit-text/index.d.ts +0 -1
- package/dist/ui/components/fit-text/index.js +21 -13
- package/dist/ui/components/graphs/bar-chart.d.ts +1 -2
- package/dist/ui/components/graphs/bar-chart.js +116 -63
- package/dist/ui/components/graphs/index.d.ts +0 -1
- package/dist/ui/components/graphs/index.js +3 -4
- package/dist/ui/components/graphs/line-chart.d.ts +1 -2
- package/dist/ui/components/graphs/line-chart.js +159 -102
- package/dist/ui/components/graphs/utils.d.ts +2 -3
- package/dist/ui/components/graphs/utils.js +147 -114
- package/dist/ui/components/grid/index.d.ts +0 -1
- package/dist/ui/components/grid/index.js +12 -9
- package/dist/ui/components/hover-bg.d.ts +0 -1
- package/dist/ui/components/hover-bg.js +11 -6
- package/dist/ui/components/icons/arrow.d.ts +1 -2
- package/dist/ui/components/icons/arrow.js +42 -5
- package/dist/ui/components/icons/chevron.d.ts +1 -2
- package/dist/ui/components/icons/chevron.js +49 -5
- package/dist/ui/components/icons/discord.d.ts +1 -2
- package/dist/ui/components/icons/discord.js +12 -4
- package/dist/ui/components/icons/eye.d.ts +1 -2
- package/dist/ui/components/icons/eye.js +5 -3
- package/dist/ui/components/icons/gear.d.ts +1 -2
- package/dist/ui/components/icons/gear.js +28 -14
- package/dist/ui/components/icons/github.d.ts +1 -2
- package/dist/ui/components/icons/github.js +12 -4
- package/dist/ui/components/icons/hamburger.d.ts +1 -2
- package/dist/ui/components/icons/hamburger.js +54 -5
- package/dist/ui/components/icons/heart.d.ts +1 -2
- package/dist/ui/components/icons/heart.js +8 -3
- package/dist/ui/components/icons/index.d.ts +0 -1
- package/dist/ui/components/icons/index.js +11 -12
- package/dist/ui/components/icons/link.d.ts +1 -2
- package/dist/ui/components/icons/link.js +10 -3
- package/dist/ui/components/icons/minus.d.ts +1 -2
- package/dist/ui/components/icons/minus.js +10 -3
- package/dist/ui/components/icons/search.d.ts +1 -2
- package/dist/ui/components/icons/search.js +30 -3
- package/dist/ui/components/image-distortion.d.ts +1 -2
- package/dist/ui/components/image-distortion.js +300 -265
- package/dist/ui/components/leva-client.d.ts +1 -2
- package/dist/ui/components/leva-client.js +9 -10
- package/dist/ui/components/list-item.d.ts +0 -1
- package/dist/ui/components/list-item.js +26 -10
- package/dist/ui/components/modal/index.d.ts +1 -2
- package/dist/ui/components/modal/index.js +33 -14
- package/dist/ui/components/overlays/blend-modes.d.ts +0 -1
- package/dist/ui/components/overlays/blend-modes.js +11 -12
- package/dist/ui/components/overlays/glitch.d.ts +1 -2
- package/dist/ui/components/overlays/glitch.js +115 -110
- package/dist/ui/components/overlays/greys.d.ts +1 -2
- package/dist/ui/components/overlays/greys.js +200 -179
- package/dist/ui/components/overlays/index.d.ts +1 -2
- package/dist/ui/components/overlays/index.js +31 -17
- package/dist/ui/components/overlays/lens-layers.d.ts +1 -2
- package/dist/ui/components/overlays/lens-layers.js +89 -65
- package/dist/ui/components/overlays/lens.d.ts +0 -1
- package/dist/ui/components/overlays/lens.js +46 -52
- package/dist/ui/components/overlays/noise.d.ts +1 -2
- package/dist/ui/components/overlays/noise.js +112 -113
- package/dist/ui/components/overlays/vignette.d.ts +1 -2
- package/dist/ui/components/overlays/vignette.js +44 -38
- package/dist/ui/components/poster.d.ts +1 -2
- package/dist/ui/components/poster.js +240 -87
- package/dist/ui/components/progress.d.ts +1 -2
- package/dist/ui/components/progress.js +52 -12
- package/dist/ui/components/scene-canvas.d.ts +1 -2
- package/dist/ui/components/scene-canvas.js +169 -119
- package/dist/ui/components/scramble.d.ts +1 -2
- package/dist/ui/components/scramble.js +60 -59
- package/dist/ui/components/segmented.d.ts +2 -3
- package/dist/ui/components/segmented.js +47 -12
- package/dist/ui/components/select.d.ts +1 -2
- package/dist/ui/components/select.js +207 -120
- package/dist/ui/components/selection-switcher.d.ts +0 -1
- package/dist/ui/components/selection-switcher.js +29 -25
- package/dist/ui/components/shader.d.ts +1 -2
- package/dist/ui/components/shader.js +56 -38
- package/dist/ui/components/socials.d.ts +1 -2
- package/dist/ui/components/socials.js +18 -7
- package/dist/ui/components/spinner.d.ts +1 -2
- package/dist/ui/components/spinner.js +36 -25
- package/dist/ui/components/stats.d.ts +1 -2
- package/dist/ui/components/stats.js +33 -9
- package/dist/ui/components/switch.d.ts +0 -1
- package/dist/ui/components/switch.js +35 -11
- package/dist/ui/components/tabs.d.ts +3 -4
- package/dist/ui/components/tabs.js +38 -12
- package/dist/ui/components/terminal-demo.d.ts +1 -2
- package/dist/ui/components/terminal-demo.js +119 -74
- package/dist/ui/components/theme-toggle.d.ts +1 -2
- package/dist/ui/components/theme-toggle.js +63 -8
- package/dist/ui/components/tier-card.d.ts +1 -2
- package/dist/ui/components/tier-card.js +144 -24
- package/dist/ui/components/tv.d.ts +1 -2
- package/dist/ui/components/tv.js +138 -90
- package/dist/ui/components/typography/h1.d.ts +0 -1
- package/dist/ui/components/typography/h1.js +17 -8
- package/dist/ui/components/typography/h2.d.ts +0 -1
- package/dist/ui/components/typography/h2.js +17 -8
- package/dist/ui/components/typography/index.d.ts +0 -1
- package/dist/ui/components/typography/index.js +35 -24
- package/dist/ui/components/typography/legend.d.ts +1 -2
- package/dist/ui/components/typography/legend.js +18 -6
- package/dist/ui/components/typography/small.d.ts +0 -1
- package/dist/ui/components/typography/small.js +8 -7
- package/dist/ui/components/watchlist.d.ts +1 -2
- package/dist/ui/components/watchlist.js +77 -25
- package/dist/ui/fonts.css +7 -7
- package/dist/ui/footer.d.ts +1 -2
- package/dist/ui/footer.js +61 -25
- package/dist/ui/globals.css +5 -1
- package/dist/ui/header.d.ts +1 -2
- package/dist/ui/header.js +255 -60
- package/dist/ui/layout-wrapper.d.ts +1 -2
- package/dist/ui/layout-wrapper.js +5 -4
- package/dist/utils/color.d.ts +0 -1
- package/dist/utils/color.js +8 -9
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +37 -38
- package/dist/utils/poly.d.ts +0 -1
- package/dist/utils/poly.js +1 -2
- package/package.json +42 -24
- package/dist/assets/filler-bg0.jpg +0 -0
- package/dist/fonts.d.ts.map +0 -1
- package/dist/fonts.js.map +0 -1
- package/dist/hooks/use-capped-frame.d.ts.map +0 -1
- package/dist/hooks/use-capped-frame.js.map +0 -1
- package/dist/hooks/use-css-var-dims.d.ts.map +0 -1
- package/dist/hooks/use-css-var-dims.js.map +0 -1
- package/dist/hooks/use-gpu-tier.d.ts.map +0 -1
- package/dist/hooks/use-gpu-tier.js.map +0 -1
- package/dist/hooks/use-render-loop.d.ts.map +0 -1
- package/dist/hooks/use-render-loop.js.map +0 -1
- package/dist/hooks/use-smooth-controls.d.ts.map +0 -1
- package/dist/hooks/use-smooth-controls.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/ui/basic-page.d.ts.map +0 -1
- package/dist/ui/basic-page.js.map +0 -1
- package/dist/ui/components/animated-count.d.ts.map +0 -1
- package/dist/ui/components/animated-count.js.map +0 -1
- package/dist/ui/components/ascii.d.ts.map +0 -1
- package/dist/ui/components/ascii.js.map +0 -1
- package/dist/ui/components/badge.d.ts.map +0 -1
- package/dist/ui/components/badge.js.map +0 -1
- package/dist/ui/components/badges/nous-girl.d.ts.map +0 -1
- package/dist/ui/components/badges/nous-girl.js.map +0 -1
- package/dist/ui/components/blend-mode.d.ts.map +0 -1
- package/dist/ui/components/blend-mode.js.map +0 -1
- package/dist/ui/components/blink.d.ts.map +0 -1
- package/dist/ui/components/blink.js.map +0 -1
- package/dist/ui/components/button.d.ts.map +0 -1
- package/dist/ui/components/button.js.map +0 -1
- package/dist/ui/components/command-block.d.ts.map +0 -1
- package/dist/ui/components/command-block.js.map +0 -1
- package/dist/ui/components/cursor.d.ts.map +0 -1
- package/dist/ui/components/cursor.js.map +0 -1
- package/dist/ui/components/dropdown-menu.d.ts.map +0 -1
- package/dist/ui/components/dropdown-menu.js.map +0 -1
- package/dist/ui/components/fit-text/index.d.ts.map +0 -1
- package/dist/ui/components/fit-text/index.js.map +0 -1
- package/dist/ui/components/graphs/bar-chart.d.ts.map +0 -1
- package/dist/ui/components/graphs/bar-chart.js.map +0 -1
- package/dist/ui/components/graphs/index.d.ts.map +0 -1
- package/dist/ui/components/graphs/index.js.map +0 -1
- package/dist/ui/components/graphs/line-chart.d.ts.map +0 -1
- package/dist/ui/components/graphs/line-chart.js.map +0 -1
- package/dist/ui/components/graphs/utils.d.ts.map +0 -1
- package/dist/ui/components/graphs/utils.js.map +0 -1
- package/dist/ui/components/grid/index.d.ts.map +0 -1
- package/dist/ui/components/grid/index.js.map +0 -1
- package/dist/ui/components/hover-bg.d.ts.map +0 -1
- package/dist/ui/components/hover-bg.js.map +0 -1
- package/dist/ui/components/icons/arrow.d.ts.map +0 -1
- package/dist/ui/components/icons/arrow.js.map +0 -1
- package/dist/ui/components/icons/chevron.d.ts.map +0 -1
- package/dist/ui/components/icons/chevron.js.map +0 -1
- package/dist/ui/components/icons/discord.d.ts.map +0 -1
- package/dist/ui/components/icons/discord.js.map +0 -1
- package/dist/ui/components/icons/eye.d.ts.map +0 -1
- package/dist/ui/components/icons/eye.js.map +0 -1
- package/dist/ui/components/icons/gear.d.ts.map +0 -1
- package/dist/ui/components/icons/gear.js.map +0 -1
- package/dist/ui/components/icons/github.d.ts.map +0 -1
- package/dist/ui/components/icons/github.js.map +0 -1
- package/dist/ui/components/icons/hamburger.d.ts.map +0 -1
- package/dist/ui/components/icons/hamburger.js.map +0 -1
- package/dist/ui/components/icons/heart.d.ts.map +0 -1
- package/dist/ui/components/icons/heart.js.map +0 -1
- package/dist/ui/components/icons/index.d.ts.map +0 -1
- package/dist/ui/components/icons/index.js.map +0 -1
- package/dist/ui/components/icons/link.d.ts.map +0 -1
- package/dist/ui/components/icons/link.js.map +0 -1
- package/dist/ui/components/icons/minus.d.ts.map +0 -1
- package/dist/ui/components/icons/minus.js.map +0 -1
- package/dist/ui/components/icons/search.d.ts.map +0 -1
- package/dist/ui/components/icons/search.js.map +0 -1
- package/dist/ui/components/image-distortion.d.ts.map +0 -1
- package/dist/ui/components/image-distortion.js.map +0 -1
- package/dist/ui/components/leva-client.d.ts.map +0 -1
- package/dist/ui/components/leva-client.js.map +0 -1
- package/dist/ui/components/list-item.d.ts.map +0 -1
- package/dist/ui/components/list-item.js.map +0 -1
- package/dist/ui/components/modal/index.d.ts.map +0 -1
- package/dist/ui/components/modal/index.js.map +0 -1
- package/dist/ui/components/overlays/blend-modes.d.ts.map +0 -1
- package/dist/ui/components/overlays/blend-modes.js.map +0 -1
- package/dist/ui/components/overlays/glitch.d.ts.map +0 -1
- package/dist/ui/components/overlays/glitch.js.map +0 -1
- package/dist/ui/components/overlays/greys.d.ts.map +0 -1
- package/dist/ui/components/overlays/greys.js.map +0 -1
- package/dist/ui/components/overlays/index.d.ts.map +0 -1
- package/dist/ui/components/overlays/index.js.map +0 -1
- package/dist/ui/components/overlays/lens-layers.d.ts.map +0 -1
- package/dist/ui/components/overlays/lens-layers.js.map +0 -1
- package/dist/ui/components/overlays/lens.d.ts.map +0 -1
- package/dist/ui/components/overlays/lens.js.map +0 -1
- package/dist/ui/components/overlays/noise.d.ts.map +0 -1
- package/dist/ui/components/overlays/noise.js.map +0 -1
- package/dist/ui/components/overlays/vignette.d.ts.map +0 -1
- package/dist/ui/components/overlays/vignette.js.map +0 -1
- package/dist/ui/components/poster.d.ts.map +0 -1
- package/dist/ui/components/poster.js.map +0 -1
- package/dist/ui/components/progress.d.ts.map +0 -1
- package/dist/ui/components/progress.js.map +0 -1
- package/dist/ui/components/scene-canvas.d.ts.map +0 -1
- package/dist/ui/components/scene-canvas.js.map +0 -1
- package/dist/ui/components/scramble.d.ts.map +0 -1
- package/dist/ui/components/scramble.js.map +0 -1
- package/dist/ui/components/segmented.d.ts.map +0 -1
- package/dist/ui/components/segmented.js.map +0 -1
- package/dist/ui/components/select.d.ts.map +0 -1
- package/dist/ui/components/select.js.map +0 -1
- package/dist/ui/components/selection-switcher.d.ts.map +0 -1
- package/dist/ui/components/selection-switcher.js.map +0 -1
- package/dist/ui/components/shader.d.ts.map +0 -1
- package/dist/ui/components/shader.js.map +0 -1
- package/dist/ui/components/socials.d.ts.map +0 -1
- package/dist/ui/components/socials.js.map +0 -1
- package/dist/ui/components/spinner.d.ts.map +0 -1
- package/dist/ui/components/spinner.js.map +0 -1
- package/dist/ui/components/stats.d.ts.map +0 -1
- package/dist/ui/components/stats.js.map +0 -1
- package/dist/ui/components/switch.d.ts.map +0 -1
- package/dist/ui/components/switch.js.map +0 -1
- package/dist/ui/components/tabs.d.ts.map +0 -1
- package/dist/ui/components/tabs.js.map +0 -1
- package/dist/ui/components/terminal-demo.d.ts.map +0 -1
- package/dist/ui/components/terminal-demo.js.map +0 -1
- package/dist/ui/components/theme-toggle.d.ts.map +0 -1
- package/dist/ui/components/theme-toggle.js.map +0 -1
- package/dist/ui/components/tier-card.d.ts.map +0 -1
- package/dist/ui/components/tier-card.js.map +0 -1
- package/dist/ui/components/tv.d.ts.map +0 -1
- package/dist/ui/components/tv.js.map +0 -1
- package/dist/ui/components/typography/h1.d.ts.map +0 -1
- package/dist/ui/components/typography/h1.js.map +0 -1
- package/dist/ui/components/typography/h2.d.ts.map +0 -1
- package/dist/ui/components/typography/h2.js.map +0 -1
- package/dist/ui/components/typography/index.d.ts.map +0 -1
- package/dist/ui/components/typography/index.js.map +0 -1
- package/dist/ui/components/typography/legend.d.ts.map +0 -1
- package/dist/ui/components/typography/legend.js.map +0 -1
- package/dist/ui/components/typography/small.d.ts.map +0 -1
- package/dist/ui/components/typography/small.js.map +0 -1
- package/dist/ui/components/watchlist.d.ts.map +0 -1
- package/dist/ui/components/watchlist.js.map +0 -1
- package/dist/ui/footer.d.ts.map +0 -1
- package/dist/ui/footer.js.map +0 -1
- package/dist/ui/header.d.ts.map +0 -1
- package/dist/ui/header.js.map +0 -1
- package/dist/ui/layout-wrapper.d.ts.map +0 -1
- package/dist/ui/layout-wrapper.js.map +0 -1
- package/dist/utils/color.d.ts.map +0 -1
- package/dist/utils/color.js.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/poly.d.ts.map +0 -1
- package/dist/utils/poly.js.map +0 -1
|
@@ -1,127 +1,214 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
Children,
|
|
5
|
+
isValidElement,
|
|
6
|
+
useCallback,
|
|
7
|
+
useEffect,
|
|
8
|
+
useMemo,
|
|
9
|
+
useRef,
|
|
10
|
+
useState
|
|
11
|
+
} from "react";
|
|
12
|
+
import { cn } from "../../utils/index.js";
|
|
13
|
+
const TRIGGER_CN = "flex h-9 w-full items-center justify-between gap-2 border border-midground/15 bg-background/40 px-3 py-1 font-courier text-sm text-left text-midground transition-colors hover:border-midground/25 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-midground/30 focus-visible:border-midground/30 disabled:cursor-not-allowed disabled:opacity-50 cursor-pointer";
|
|
14
|
+
const LISTBOX_CN = "absolute z-50 mt-1 w-full max-h-60 overflow-auto border border-midground/15 bg-background-base text-midground shadow-lg";
|
|
15
|
+
export function Select({
|
|
16
|
+
children,
|
|
17
|
+
className,
|
|
18
|
+
disabled,
|
|
19
|
+
id,
|
|
20
|
+
onValueChange,
|
|
21
|
+
placeholder,
|
|
22
|
+
style,
|
|
23
|
+
value
|
|
24
|
+
}) {
|
|
25
|
+
const [open, setOpen] = useState(false);
|
|
26
|
+
const [highlightedIndex, setHighlightedIndex] = useState(-1);
|
|
27
|
+
const containerRef = useRef(null);
|
|
28
|
+
const listRef = useRef(null);
|
|
29
|
+
const options = useMemo(() => collectOptions(children), [children]);
|
|
30
|
+
const selected = options.find((o) => o.value === value);
|
|
31
|
+
const displayLabel = selected?.label ?? placeholder ?? value ?? "";
|
|
32
|
+
const close = useCallback(() => {
|
|
33
|
+
setOpen(false);
|
|
34
|
+
setHighlightedIndex(-1);
|
|
35
|
+
}, []);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!open) return;
|
|
38
|
+
const ac = new AbortController();
|
|
39
|
+
document.addEventListener(
|
|
40
|
+
"mousedown",
|
|
41
|
+
(e) => {
|
|
42
|
+
if (!containerRef.current?.contains(e.target)) close();
|
|
43
|
+
},
|
|
44
|
+
{ signal: ac.signal }
|
|
45
|
+
);
|
|
46
|
+
return () => ac.abort();
|
|
47
|
+
}, [open, close]);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (!open || highlightedIndex < 0) return;
|
|
50
|
+
const el = listRef.current?.children[highlightedIndex];
|
|
51
|
+
el?.scrollIntoView({ block: "nearest" });
|
|
52
|
+
}, [open, highlightedIndex]);
|
|
53
|
+
const handleKeyDown = (e) => {
|
|
54
|
+
if (disabled) return;
|
|
55
|
+
switch (e.key) {
|
|
56
|
+
case "Enter":
|
|
57
|
+
case " ":
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
if (!open) {
|
|
60
|
+
setOpen(true);
|
|
61
|
+
setHighlightedIndex(options.findIndex((o) => o.value === value));
|
|
62
|
+
} else if (highlightedIndex >= 0 && options[highlightedIndex]) {
|
|
63
|
+
onValueChange?.(options[highlightedIndex].value);
|
|
64
|
+
close();
|
|
65
|
+
}
|
|
66
|
+
break;
|
|
67
|
+
case "ArrowDown":
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
if (!open) {
|
|
70
|
+
setOpen(true);
|
|
71
|
+
setHighlightedIndex(options.findIndex((o) => o.value === value));
|
|
72
|
+
} else {
|
|
73
|
+
setHighlightedIndex((i) => Math.min(i + 1, options.length - 1));
|
|
74
|
+
}
|
|
75
|
+
break;
|
|
76
|
+
case "ArrowUp":
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
if (open) setHighlightedIndex((i) => Math.max(i - 1, 0));
|
|
79
|
+
break;
|
|
80
|
+
case "Home":
|
|
81
|
+
if (open) {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
setHighlightedIndex(0);
|
|
84
|
+
}
|
|
85
|
+
break;
|
|
86
|
+
case "End":
|
|
87
|
+
if (open) {
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
setHighlightedIndex(options.length - 1);
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
case "Escape":
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
close();
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
return /* @__PURE__ */ jsxs(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
className: cn("relative", className),
|
|
102
|
+
id,
|
|
103
|
+
ref: containerRef,
|
|
104
|
+
style,
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ jsxs(
|
|
107
|
+
"button",
|
|
108
|
+
{
|
|
109
|
+
"aria-expanded": open,
|
|
110
|
+
"aria-haspopup": "listbox",
|
|
111
|
+
className: TRIGGER_CN,
|
|
112
|
+
disabled,
|
|
113
|
+
onClick: () => !disabled && setOpen((o) => !o),
|
|
114
|
+
onKeyDown: handleKeyDown,
|
|
115
|
+
role: "combobox",
|
|
116
|
+
type: "button",
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ jsx("span", { className: cn("truncate", !selected && "text-midground/50"), children: displayLabel }),
|
|
119
|
+
/* @__PURE__ */ jsx(
|
|
120
|
+
ChevronDownGlyph,
|
|
121
|
+
{
|
|
122
|
+
className: cn(
|
|
123
|
+
"size-3 shrink-0 text-midground/60 transition-transform",
|
|
124
|
+
open && "rotate-180"
|
|
125
|
+
)
|
|
83
126
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
127
|
+
)
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
open && /* @__PURE__ */ jsx("div", { className: LISTBOX_CN, ref: listRef, role: "listbox", children: options.map((opt, i) => {
|
|
132
|
+
const isSelected = opt.value === value;
|
|
133
|
+
const isHighlighted = i === highlightedIndex;
|
|
134
|
+
return /* @__PURE__ */ jsxs(
|
|
135
|
+
"div",
|
|
136
|
+
{
|
|
137
|
+
"aria-selected": isSelected,
|
|
138
|
+
className: cn(
|
|
139
|
+
"flex cursor-pointer items-center gap-2 px-3 py-2",
|
|
140
|
+
"font-courier text-sm transition-colors",
|
|
141
|
+
isHighlighted && "bg-midground/10",
|
|
142
|
+
isSelected ? "text-midground" : "text-midground/70"
|
|
143
|
+
),
|
|
144
|
+
onClick: () => {
|
|
145
|
+
onValueChange?.(opt.value);
|
|
87
146
|
close();
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
147
|
+
},
|
|
148
|
+
onMouseEnter: () => setHighlightedIndex(i),
|
|
149
|
+
role: "option",
|
|
150
|
+
children: [
|
|
151
|
+
/* @__PURE__ */ jsx(
|
|
152
|
+
CheckGlyph,
|
|
153
|
+
{
|
|
154
|
+
className: cn(
|
|
155
|
+
"size-3 shrink-0",
|
|
156
|
+
isSelected ? "opacity-100" : "opacity-0"
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
),
|
|
160
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: opt.label })
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
opt.value
|
|
164
|
+
);
|
|
165
|
+
}) })
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
);
|
|
99
169
|
}
|
|
100
|
-
// Marker component — `Select` reads `value`/`children` from its tree.
|
|
101
|
-
// Renders nothing on its own.
|
|
102
170
|
export function SelectOption(_props) {
|
|
103
|
-
|
|
171
|
+
return null;
|
|
104
172
|
}
|
|
105
|
-
const ChevronDownGlyph = ({ className }) =>
|
|
106
|
-
|
|
173
|
+
const ChevronDownGlyph = ({ className }) => /* @__PURE__ */ jsx(
|
|
174
|
+
"svg",
|
|
175
|
+
{
|
|
176
|
+
"aria-hidden": true,
|
|
177
|
+
className,
|
|
178
|
+
fill: "none",
|
|
179
|
+
stroke: "currentColor",
|
|
180
|
+
strokeLinecap: "square",
|
|
181
|
+
strokeWidth: 1.5,
|
|
182
|
+
viewBox: "0 0 12 12",
|
|
183
|
+
children: /* @__PURE__ */ jsx("path", { d: "M2.5 4.5 6 8l3.5-3.5" })
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
const CheckGlyph = ({ className }) => /* @__PURE__ */ jsx(
|
|
187
|
+
"svg",
|
|
188
|
+
{
|
|
189
|
+
"aria-hidden": true,
|
|
190
|
+
className,
|
|
191
|
+
fill: "none",
|
|
192
|
+
stroke: "currentColor",
|
|
193
|
+
strokeLinecap: "square",
|
|
194
|
+
strokeWidth: 1.5,
|
|
195
|
+
viewBox: "0 0 12 12",
|
|
196
|
+
children: /* @__PURE__ */ jsx("path", { d: "m2.5 6.5 2.5 2.5L9.5 3.5" })
|
|
197
|
+
}
|
|
198
|
+
);
|
|
107
199
|
function collectOptions(children) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
out.push(...collectOptions(el.props.children));
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
return out;
|
|
200
|
+
const out = [];
|
|
201
|
+
Children.forEach(children, (child) => {
|
|
202
|
+
if (!isValidElement(child)) return;
|
|
203
|
+
const el = child;
|
|
204
|
+
if (el.props.value !== void 0) {
|
|
205
|
+
out.push({
|
|
206
|
+
label: typeof el.props.children === "string" ? el.props.children : String(el.props.value),
|
|
207
|
+
value: String(el.props.value)
|
|
208
|
+
});
|
|
209
|
+
} else if (el.props.children) {
|
|
210
|
+
out.push(...collectOptions(el.props.children));
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
return out;
|
|
126
214
|
}
|
|
127
|
-
//# sourceMappingURL=select.js.map
|
|
@@ -1,29 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
import { useEffect } from
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
3
|
const colors = [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
"oklch(85% 0.12 330)",
|
|
5
|
+
"oklch(85% 0.12 300)",
|
|
6
|
+
"oklch(85% 0.12 270)",
|
|
7
|
+
"oklch(85% 0.12 230)",
|
|
8
|
+
"oklch(85% 0.12 180)",
|
|
9
|
+
"oklch(85% 0.12 150)",
|
|
10
|
+
"oklch(85% 0.12 120)",
|
|
11
|
+
"oklch(85% 0.12 90)",
|
|
12
|
+
"oklch(85% 0.12 60)",
|
|
13
|
+
"oklch(85% 0.12 30)",
|
|
14
|
+
"oklch(88% 0.10 80)"
|
|
15
15
|
];
|
|
16
16
|
export function SelectionSwitcher() {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const ac = new AbortController();
|
|
19
|
+
const { signal } = ac;
|
|
20
|
+
let idx = 0;
|
|
21
|
+
const cycle = () => requestAnimationFrame(
|
|
22
|
+
() => document.documentElement.style.setProperty(
|
|
23
|
+
"--selection-bg",
|
|
24
|
+
colors[idx = (idx + 1) % colors.length]
|
|
25
|
+
)
|
|
26
|
+
);
|
|
27
|
+
const onKey = (e) => e.key.toLowerCase() === "a" && (e.metaKey || e.ctrlKey) && cycle();
|
|
28
|
+
document.addEventListener("selectstart", cycle, { signal });
|
|
29
|
+
document.addEventListener("keydown", onKey, { signal });
|
|
30
|
+
return () => ac.abort();
|
|
31
|
+
}, []);
|
|
32
|
+
return null;
|
|
28
33
|
}
|
|
29
|
-
//# sourceMappingURL=selection-switcher.js.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type ThreeElements } from '@react-three/fiber';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
-
export declare function Shader({ children, defines, depthTest, fragmentShader, uniforms, vertexShader, ...props }: ShaderProps): string | number | bigint | boolean |
|
|
3
|
+
export declare function Shader({ children, defines, depthTest, fragmentShader, uniforms, vertexShader, ...props }: ShaderProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
|
|
4
4
|
interface ShaderProps extends Omit<ThreeElements['mesh'], 'children'>, Pick<ThreeElements['shaderMaterial'], 'defines' | 'depthTest' | 'fragmentShader' | 'uniforms' | 'vertexShader'> {
|
|
5
5
|
children?: ((material: ReactNode) => ReactNode) | ReactNode;
|
|
6
6
|
}
|
|
7
7
|
export {};
|
|
8
|
-
//# sourceMappingURL=shader.d.ts.map
|
|
@@ -1,41 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx
|
|
3
|
-
import { useThree } from
|
|
4
|
-
import { useEffect, useRef } from
|
|
5
|
-
import * as THREE from
|
|
6
|
-
import { useCappedFrame } from
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useThree } from "@react-three/fiber";
|
|
4
|
+
import { useEffect, useRef } from "react";
|
|
5
|
+
import * as THREE from "three";
|
|
6
|
+
import { useCappedFrame } from "../../hooks/use-capped-frame.js";
|
|
7
7
|
const defaultUniforms = {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
uResolution: new THREE.Uniform(new THREE.Vector4()),
|
|
9
|
+
uTime: new THREE.Uniform(0)
|
|
10
10
|
};
|
|
11
|
-
export function Shader({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
11
|
+
export function Shader({
|
|
12
|
+
children,
|
|
13
|
+
defines,
|
|
14
|
+
depthTest,
|
|
15
|
+
fragmentShader,
|
|
16
|
+
uniforms,
|
|
17
|
+
vertexShader,
|
|
18
|
+
...props
|
|
19
|
+
}) {
|
|
20
|
+
const invalidate = useThree((st) => st.invalidate);
|
|
21
|
+
const { size, viewport } = useThree();
|
|
22
|
+
const isMobile = size.width < 1024;
|
|
23
|
+
const uniformsRef = useRef({
|
|
24
|
+
...defaultUniforms,
|
|
25
|
+
...uniforms ?? {}
|
|
26
|
+
});
|
|
27
|
+
useCappedFrame(
|
|
28
|
+
({ clock }) => {
|
|
29
|
+
const w = size.width * viewport.dpr;
|
|
30
|
+
const h = size.height * viewport.dpr;
|
|
31
|
+
uniformsRef.current.uTime.value = clock.getElapsedTime();
|
|
32
|
+
uniformsRef.current.uResolution.value.copy(
|
|
33
|
+
new THREE.Vector4(w, h, w / h, viewport.dpr)
|
|
34
|
+
);
|
|
35
|
+
},
|
|
36
|
+
isMobile ? 0 : 80
|
|
37
|
+
);
|
|
38
|
+
useEffect(
|
|
39
|
+
() => void (uniforms && Object.assign(uniformsRef.current, uniforms)),
|
|
40
|
+
[uniforms]
|
|
41
|
+
);
|
|
42
|
+
useEffect(() => void (isMobile && invalidate(80)), [invalidate, isMobile]);
|
|
43
|
+
const materialProps = {
|
|
44
|
+
defines: defines ?? {},
|
|
45
|
+
depthTest,
|
|
46
|
+
fragmentShader,
|
|
47
|
+
side: THREE.DoubleSide,
|
|
48
|
+
transparent: true,
|
|
49
|
+
uniforms: uniformsRef.current,
|
|
50
|
+
vertexShader
|
|
51
|
+
};
|
|
52
|
+
if (typeof children === "function") {
|
|
53
|
+
return children(/* @__PURE__ */ jsx("shaderMaterial", { ...materialProps }));
|
|
54
|
+
}
|
|
55
|
+
return /* @__PURE__ */ jsxs("mesh", { ...props, children: [
|
|
56
|
+
children ?? /* @__PURE__ */ jsx("planeGeometry", {}),
|
|
57
|
+
/* @__PURE__ */ jsx("shaderMaterial", { ...materialProps })
|
|
58
|
+
] });
|
|
40
59
|
}
|
|
41
|
-
//# sourceMappingURL=shader.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function Socials({ className, items, onNavigate, ...rest }: SocialsProps): import("react
|
|
1
|
+
export declare function Socials({ className, items, onNavigate, ...rest }: SocialsProps): import("react").JSX.Element;
|
|
2
2
|
export interface SocialLink {
|
|
3
3
|
external?: boolean;
|
|
4
4
|
href: string;
|
|
@@ -18,4 +18,3 @@ interface SocialsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
18
18
|
onNavigate?: () => void;
|
|
19
19
|
}
|
|
20
20
|
export {};
|
|
21
|
-
//# sourceMappingURL=socials.d.ts.map
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { cn } from
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../utils/index.js";
|
|
3
3
|
export function Socials({ className, items, onNavigate, ...rest }) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex items-center gap-3", className), ...rest, children: items.map(({ external = true, href, icon: Icon, label, onClick }) => /* @__PURE__ */ jsx(
|
|
5
|
+
"a",
|
|
6
|
+
{
|
|
7
|
+
className: "opacity-60 transition-opacity hover:opacity-100",
|
|
8
|
+
href,
|
|
9
|
+
onClick: (e) => {
|
|
10
|
+
onClick?.(e);
|
|
11
|
+
onNavigate?.();
|
|
12
|
+
},
|
|
13
|
+
rel: external ? "noopener noreferrer" : void 0,
|
|
14
|
+
target: external ? "_blank" : void 0,
|
|
15
|
+
title: label,
|
|
16
|
+
children: /* @__PURE__ */ jsx(Icon, {})
|
|
17
|
+
},
|
|
18
|
+
label
|
|
19
|
+
)) });
|
|
8
20
|
}
|
|
9
|
-
//# sourceMappingURL=socials.js.map
|
|
@@ -11,11 +11,10 @@ import { type BrailleSpinnerName } from 'unicode-animations';
|
|
|
11
11
|
* the spinner has no surrounding loading text and screen readers need to know
|
|
12
12
|
* something is loading.
|
|
13
13
|
*/
|
|
14
|
-
export declare function Spinner({ className, name, style, ...props }: SpinnerProps): import("react
|
|
14
|
+
export declare function Spinner({ className, name, style, ...props }: SpinnerProps): import("react").JSX.Element;
|
|
15
15
|
interface SpinnerProps extends HTMLAttributes<HTMLSpanElement> {
|
|
16
16
|
className?: string;
|
|
17
17
|
name?: BrailleSpinnerName;
|
|
18
18
|
style?: CSSProperties;
|
|
19
19
|
}
|
|
20
20
|
export {};
|
|
21
|
-
//# sourceMappingURL=spinner.d.ts.map
|
|
@@ -1,26 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
useEffect,
|
|
5
|
+
useState
|
|
6
|
+
} from "react";
|
|
7
|
+
import spinners from "unicode-animations";
|
|
8
|
+
import { cn } from "../../utils/index.js";
|
|
9
|
+
export function Spinner({
|
|
10
|
+
className,
|
|
11
|
+
name = "braille",
|
|
12
|
+
style,
|
|
13
|
+
...props
|
|
14
|
+
}) {
|
|
15
|
+
const [frame, setFrame] = useState(0);
|
|
16
|
+
const animation = spinners[name];
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const id = setInterval(
|
|
19
|
+
() => setFrame((f) => (f + 1) % animation.frames.length),
|
|
20
|
+
animation.interval
|
|
21
|
+
);
|
|
22
|
+
return () => clearInterval(id);
|
|
23
|
+
}, [animation.frames.length, animation.interval]);
|
|
24
|
+
return /* @__PURE__ */ jsx(
|
|
25
|
+
"span",
|
|
26
|
+
{
|
|
27
|
+
"aria-hidden": props["aria-label"] ? void 0 : true,
|
|
28
|
+
className: cn(
|
|
29
|
+
"font-mono inline-block leading-none tabular-nums",
|
|
30
|
+
className
|
|
31
|
+
),
|
|
32
|
+
style,
|
|
33
|
+
...props,
|
|
34
|
+
children: animation.frames[frame]
|
|
35
|
+
}
|
|
36
|
+
);
|
|
25
37
|
}
|
|
26
|
-
//# sourceMappingURL=spinner.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
export declare function Stats({ className, items, flip, ...props }: StatsProps):
|
|
2
|
+
export declare function Stats({ className, items, flip, ...props }: StatsProps): React.JSX.Element;
|
|
3
3
|
interface StatsProps extends React.ComponentProps<'div'> {
|
|
4
4
|
items: {
|
|
5
5
|
label: string | {
|
|
@@ -14,4 +14,3 @@ interface StatsProps extends React.ComponentProps<'div'> {
|
|
|
14
14
|
flip?: boolean;
|
|
15
15
|
}
|
|
16
16
|
export {};
|
|
17
|
-
//# sourceMappingURL=stats.d.ts.map
|