@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,128 +1,178 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx
|
|
3
|
-
import { Canvas, useFrame, useThree } from
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Canvas, useFrame, useThree } from "@react-three/fiber";
|
|
4
|
+
import {
|
|
5
|
+
Suspense,
|
|
6
|
+
useEffect,
|
|
7
|
+
useLayoutEffect,
|
|
8
|
+
useMemo,
|
|
9
|
+
useRef,
|
|
10
|
+
useState
|
|
11
|
+
} from "react";
|
|
12
|
+
import * as THREE from "three";
|
|
6
13
|
const GL = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
alpha: true,
|
|
15
|
+
antialias: true,
|
|
16
|
+
depth: true,
|
|
17
|
+
outputColorSpace: "srgb",
|
|
18
|
+
powerPreference: "high-performance",
|
|
19
|
+
stencil: false
|
|
13
20
|
};
|
|
14
21
|
const tmp = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
camDir: new THREE.Vector3(),
|
|
23
|
+
hit: new THREE.Vector3(),
|
|
24
|
+
ndc: new THREE.Vector2(),
|
|
25
|
+
origin: new THREE.Vector3(0, 0, 0),
|
|
26
|
+
plane: new THREE.Plane(),
|
|
27
|
+
ray: new THREE.Raycaster()
|
|
21
28
|
};
|
|
22
29
|
function useBounds(target) {
|
|
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
|
-
|
|
30
|
+
const bounds = useRef(null);
|
|
31
|
+
useLayoutEffect(() => {
|
|
32
|
+
if (!target) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const measure = () => {
|
|
36
|
+
const b = target.getBoundingClientRect();
|
|
37
|
+
bounds.current = {
|
|
38
|
+
height: b.height,
|
|
39
|
+
pageX: b.left + window.scrollX,
|
|
40
|
+
pageY: b.top + window.scrollY,
|
|
41
|
+
width: b.width
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
measure();
|
|
45
|
+
const ro = new ResizeObserver(measure);
|
|
46
|
+
ro.observe(target);
|
|
47
|
+
ro.observe(document.body);
|
|
48
|
+
window.addEventListener("resize", measure, { passive: true });
|
|
49
|
+
return () => {
|
|
50
|
+
ro.disconnect();
|
|
51
|
+
window.removeEventListener("resize", measure);
|
|
52
|
+
};
|
|
53
|
+
}, [target]);
|
|
54
|
+
return bounds;
|
|
48
55
|
}
|
|
49
|
-
function PositionedGroup({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
56
|
+
function PositionedGroup({
|
|
57
|
+
baseZoom,
|
|
58
|
+
bounds,
|
|
59
|
+
children
|
|
60
|
+
}) {
|
|
61
|
+
const ref = useRef(null);
|
|
62
|
+
const { camera, size, viewport } = useThree();
|
|
63
|
+
useFrame(() => {
|
|
64
|
+
const g = ref.current;
|
|
65
|
+
const b = bounds.current;
|
|
66
|
+
if (!g || !b) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const left = b.pageX - window.scrollX;
|
|
70
|
+
const top = b.pageY - window.scrollY;
|
|
71
|
+
tmp.ndc.set(
|
|
72
|
+
(left + b.width / 2) / size.width * 2 - 1,
|
|
73
|
+
1 - (top + b.height / 2) / size.height * 2
|
|
74
|
+
);
|
|
75
|
+
camera.getWorldDirection(tmp.camDir);
|
|
76
|
+
tmp.plane.setFromNormalAndCoplanarPoint(tmp.camDir, tmp.origin);
|
|
77
|
+
tmp.ray.setFromCamera(tmp.ndc, camera);
|
|
78
|
+
const hit = tmp.ray.ray.intersectPlane(tmp.plane, tmp.hit);
|
|
79
|
+
if (hit) {
|
|
80
|
+
g.position.copy(hit);
|
|
81
|
+
}
|
|
82
|
+
const zoom = camera.zoom ?? 1;
|
|
83
|
+
g.scale.setScalar(
|
|
84
|
+
Math.min(
|
|
85
|
+
b.width / size.width * viewport.width,
|
|
86
|
+
b.height / size.height * viewport.height
|
|
87
|
+
) * (baseZoom > 0 ? zoom / baseZoom : 1)
|
|
88
|
+
);
|
|
89
|
+
});
|
|
90
|
+
return /* @__PURE__ */ jsx("group", { ref, children });
|
|
72
91
|
}
|
|
73
|
-
export function SceneCanvas({
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
92
|
+
export function SceneCanvas({
|
|
93
|
+
camera,
|
|
94
|
+
children,
|
|
95
|
+
className,
|
|
96
|
+
contained,
|
|
97
|
+
frameloop = "always",
|
|
98
|
+
noEvents,
|
|
99
|
+
style
|
|
100
|
+
}) {
|
|
101
|
+
const [container, setContainer] = useState(null);
|
|
102
|
+
const baseZoom = camera?.zoom ?? 150;
|
|
103
|
+
const bounds = useBounds(
|
|
104
|
+
contained ? container?.parentElement ?? null : null
|
|
105
|
+
);
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
const el = contained && !noEvents ? container : null;
|
|
108
|
+
if (!el) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const lock = () => document.body.style.userSelect = "none";
|
|
112
|
+
const unlock = () => document.body.style.userSelect = "";
|
|
113
|
+
el.addEventListener("pointerdown", lock);
|
|
114
|
+
window.addEventListener("pointerup", unlock);
|
|
115
|
+
return () => {
|
|
116
|
+
el.removeEventListener("pointerdown", lock);
|
|
117
|
+
window.removeEventListener("pointerup", unlock);
|
|
118
|
+
};
|
|
119
|
+
}, [container, contained, noEvents]);
|
|
120
|
+
const [pageHidden, setPageHidden] = useState(
|
|
121
|
+
typeof document !== "undefined" && document.hidden
|
|
122
|
+
);
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
const onVisibility = () => setPageHidden(document.hidden);
|
|
125
|
+
document.addEventListener("visibilitychange", onVisibility);
|
|
126
|
+
return () => document.removeEventListener("visibilitychange", onVisibility);
|
|
127
|
+
}, []);
|
|
128
|
+
const effectiveFrameloop = pageHidden ? "never" : frameloop;
|
|
129
|
+
const cam = useMemo(
|
|
130
|
+
() => ({
|
|
131
|
+
far: camera?.far ?? 100,
|
|
132
|
+
near: camera?.near ?? -100,
|
|
133
|
+
position: camera?.position ?? [0, 0, 10],
|
|
134
|
+
zoom: baseZoom * (contained ? 1 : 2)
|
|
135
|
+
}),
|
|
136
|
+
[baseZoom, camera, contained]
|
|
137
|
+
);
|
|
138
|
+
const canvas = /* @__PURE__ */ jsx(
|
|
139
|
+
Canvas,
|
|
140
|
+
{
|
|
141
|
+
camera: cam,
|
|
142
|
+
className,
|
|
143
|
+
dpr: [1, 2],
|
|
144
|
+
eventPrefix: contained ? "client" : "offset",
|
|
145
|
+
eventSource: contained ? container ?? void 0 : void 0,
|
|
146
|
+
frameloop: effectiveFrameloop,
|
|
147
|
+
gl: GL,
|
|
148
|
+
orthographic: true,
|
|
149
|
+
style: contained ? {
|
|
150
|
+
height: "100dvh",
|
|
151
|
+
inset: 0,
|
|
152
|
+
pointerEvents: "none",
|
|
153
|
+
position: "fixed",
|
|
154
|
+
width: "100dvw",
|
|
155
|
+
zIndex: 0,
|
|
156
|
+
...style
|
|
157
|
+
} : { height: "100%", width: "100%", ...style },
|
|
158
|
+
children: contained ? /* @__PURE__ */ jsx(PositionedGroup, { baseZoom, bounds, children: children() }) : children()
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
return contained ? /* @__PURE__ */ jsxs(Suspense, { children: [
|
|
162
|
+
/* @__PURE__ */ jsx(
|
|
163
|
+
"div",
|
|
164
|
+
{
|
|
165
|
+
ref: setContainer,
|
|
166
|
+
style: {
|
|
167
|
+
height: "100%",
|
|
168
|
+
inset: 0,
|
|
169
|
+
pointerEvents: noEvents ? "none" : "auto",
|
|
170
|
+
position: "absolute",
|
|
171
|
+
width: "100%",
|
|
172
|
+
zIndex: 1
|
|
81
173
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return () => {
|
|
87
|
-
el.removeEventListener('pointerdown', lock);
|
|
88
|
-
window.removeEventListener('pointerup', unlock);
|
|
89
|
-
};
|
|
90
|
-
}, [container, contained, noEvents]);
|
|
91
|
-
// Pause the R3F render loop when the tab is hidden. Even on
|
|
92
|
-
// `frameloop="always"` scenes we don't want the GPU running while the
|
|
93
|
-
// user can't see anything — this is the dominant fix for the "fans
|
|
94
|
-
// crank up after hours of idle" symptom.
|
|
95
|
-
const [pageHidden, setPageHidden] = useState(typeof document !== 'undefined' && document.hidden);
|
|
96
|
-
useEffect(() => {
|
|
97
|
-
const onVisibility = () => setPageHidden(document.hidden);
|
|
98
|
-
document.addEventListener('visibilitychange', onVisibility);
|
|
99
|
-
return () => document.removeEventListener('visibilitychange', onVisibility);
|
|
100
|
-
}, []);
|
|
101
|
-
const effectiveFrameloop = pageHidden ? 'never' : frameloop;
|
|
102
|
-
const cam = useMemo(() => ({
|
|
103
|
-
far: camera?.far ?? 100,
|
|
104
|
-
near: camera?.near ?? -100,
|
|
105
|
-
position: camera?.position ?? [0, 0, 10],
|
|
106
|
-
zoom: baseZoom * (contained ? 1 : 2)
|
|
107
|
-
}), [baseZoom, camera, contained]);
|
|
108
|
-
const canvas = (_jsx(Canvas, { camera: cam, className: className, dpr: [1, 2], eventPrefix: contained ? 'client' : 'offset', eventSource: contained ? (container ?? undefined) : undefined, frameloop: effectiveFrameloop, gl: GL, orthographic: true, style: contained
|
|
109
|
-
? {
|
|
110
|
-
height: '100dvh',
|
|
111
|
-
inset: 0,
|
|
112
|
-
pointerEvents: 'none',
|
|
113
|
-
position: 'fixed',
|
|
114
|
-
width: '100dvw',
|
|
115
|
-
zIndex: 0,
|
|
116
|
-
...style
|
|
117
|
-
}
|
|
118
|
-
: { height: '100%', width: '100%', ...style }, children: contained ? (_jsx(PositionedGroup, { baseZoom: baseZoom, bounds: bounds, children: children() })) : (children()) }));
|
|
119
|
-
return contained ? (_jsxs(Suspense, { children: [_jsx("div", { ref: setContainer, style: {
|
|
120
|
-
height: '100%',
|
|
121
|
-
inset: 0,
|
|
122
|
-
pointerEvents: noEvents ? 'none' : 'auto',
|
|
123
|
-
position: 'absolute',
|
|
124
|
-
width: '100%',
|
|
125
|
-
zIndex: 1
|
|
126
|
-
} }), canvas] })) : (canvas);
|
|
174
|
+
}
|
|
175
|
+
),
|
|
176
|
+
canvas
|
|
177
|
+
] }) : canvas;
|
|
127
178
|
}
|
|
128
|
-
//# sourceMappingURL=scene-canvas.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
|
-
export declare function Scramble({ children, dur, spread, target }: ScrambleProps): import("react
|
|
2
|
+
export declare function Scramble({ children, dur, spread, target }: ScrambleProps): import("react").JSX.Element;
|
|
3
3
|
interface ScrambleProps {
|
|
4
4
|
children: string;
|
|
5
5
|
dur?: number;
|
|
@@ -7,4 +7,3 @@ interface ScrambleProps {
|
|
|
7
7
|
target?: RefObject<HTMLElement | null>;
|
|
8
8
|
}
|
|
9
9
|
export {};
|
|
10
|
-
//# sourceMappingURL=scramble.d.ts.map
|
|
@@ -1,61 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
import { Fragment
|
|
3
|
-
import { useEffect, useRef, useState } from
|
|
4
|
-
const CHARS = '
|
|
5
|
-
export function Scramble({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
.split('')
|
|
26
|
-
.map((c, i) => {
|
|
27
|
-
if (c === ' ') {
|
|
28
|
-
return c;
|
|
29
|
-
}
|
|
30
|
-
for (const w of waves.current) {
|
|
31
|
-
const age = t - w.time;
|
|
32
|
-
const rad = (Math.min(age / dur, 1) *
|
|
33
|
-
(Math.max(w.pos, len - w.pos - 1) + 5)) /
|
|
34
|
-
spread;
|
|
35
|
-
const dist = Math.abs(i - w.pos);
|
|
36
|
-
const int = rad - dist;
|
|
37
|
-
if (dist <= rad && int > 0 && int <= 3) {
|
|
38
|
-
return CHARS[(dist * 3 + ((age / 40) | 0)) % CHARS.length];
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return c;
|
|
42
|
-
})
|
|
43
|
-
.join(''));
|
|
44
|
-
frame.current = requestAnimationFrame(animate);
|
|
45
|
-
};
|
|
46
|
-
const onEnter = () => {
|
|
47
|
-
waves.current.push({ pos: len >> 1, time: Date.now() });
|
|
48
|
-
frame.current ?? (frame.current = requestAnimationFrame(animate));
|
|
49
|
-
};
|
|
50
|
-
el.addEventListener('mouseenter', onEnter);
|
|
51
|
-
return () => {
|
|
52
|
-
el.removeEventListener('mouseenter', onEnter);
|
|
53
|
-
frame.current && cancelAnimationFrame(frame.current);
|
|
54
|
-
};
|
|
55
|
-
}, [target, text, len, dur, spread]);
|
|
56
|
-
useEffect(() => {
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
const CHARS = '.,\xB7-\u2500~+:;=*\u03C0""\u2510\u250C\u2518\u2534\u252C\u2557\u2554\u255D\u255A\u256C\u2560\u2563\u2569\u2566\u2551\u2591\u2592\u2593\u2588\u2584\u2580\u258C\u2590\u25A0!?&#$@0123456789*';
|
|
5
|
+
export function Scramble({
|
|
6
|
+
children,
|
|
7
|
+
dur = 666,
|
|
8
|
+
spread = 1,
|
|
9
|
+
target
|
|
10
|
+
}) {
|
|
11
|
+
const text = String(children);
|
|
12
|
+
const len = text.length;
|
|
13
|
+
const [display, setDisplay] = useState(text);
|
|
14
|
+
const frame = useRef(null);
|
|
15
|
+
const waves = useRef([]);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const el = target?.current;
|
|
18
|
+
if (!el) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const animate = () => {
|
|
22
|
+
const t = Date.now();
|
|
23
|
+
waves.current = waves.current.filter((w) => t - w.time < dur);
|
|
24
|
+
if (!waves.current.length) {
|
|
57
25
|
setDisplay(text);
|
|
58
|
-
|
|
59
|
-
|
|
26
|
+
frame.current = null;
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
setDisplay(
|
|
30
|
+
text.split("").map((c, i) => {
|
|
31
|
+
if (c === " ") {
|
|
32
|
+
return c;
|
|
33
|
+
}
|
|
34
|
+
for (const w of waves.current) {
|
|
35
|
+
const age = t - w.time;
|
|
36
|
+
const rad = Math.min(age / dur, 1) * (Math.max(w.pos, len - w.pos - 1) + 5) / spread;
|
|
37
|
+
const dist = Math.abs(i - w.pos);
|
|
38
|
+
const int = rad - dist;
|
|
39
|
+
if (dist <= rad && int > 0 && int <= 3) {
|
|
40
|
+
return CHARS[(dist * 3 + (age / 40 | 0)) % CHARS.length];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return c;
|
|
44
|
+
}).join("")
|
|
45
|
+
);
|
|
46
|
+
frame.current = requestAnimationFrame(animate);
|
|
47
|
+
};
|
|
48
|
+
const onEnter = () => {
|
|
49
|
+
waves.current.push({ pos: len >> 1, time: Date.now() });
|
|
50
|
+
frame.current ??= requestAnimationFrame(animate);
|
|
51
|
+
};
|
|
52
|
+
el.addEventListener("mouseenter", onEnter);
|
|
53
|
+
return () => {
|
|
54
|
+
el.removeEventListener("mouseenter", onEnter);
|
|
55
|
+
frame.current && cancelAnimationFrame(frame.current);
|
|
56
|
+
};
|
|
57
|
+
}, [target, text, len, dur, spread]);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
setDisplay(text);
|
|
60
|
+
}, [text]);
|
|
61
|
+
return /* @__PURE__ */ jsx(Fragment, { children: display });
|
|
60
62
|
}
|
|
61
|
-
//# sourceMappingURL=scramble.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
export declare function Segmented<T extends string>({ className, onChange, options, size, value }: SegmentedProps<T>): import("react
|
|
3
|
-
export declare function FilterGroup({ children, className, label }: FilterGroupProps): import("react
|
|
2
|
+
export declare function Segmented<T extends string>({ className, onChange, options, size, value }: SegmentedProps<T>): import("react").JSX.Element;
|
|
3
|
+
export declare function FilterGroup({ children, className, label }: FilterGroupProps): import("react").JSX.Element;
|
|
4
4
|
interface FilterGroupProps {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
className?: string;
|
|
@@ -18,4 +18,3 @@ interface SegmentedProps<T extends string> {
|
|
|
18
18
|
value: T;
|
|
19
19
|
}
|
|
20
20
|
export {};
|
|
21
|
-
//# sourceMappingURL=segmented.d.ts.map
|
|
@@ -1,15 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx
|
|
3
|
-
import { cn } from
|
|
4
|
-
export function Segmented({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../utils/index.js";
|
|
4
|
+
export function Segmented({
|
|
5
|
+
className,
|
|
6
|
+
onChange,
|
|
7
|
+
options,
|
|
8
|
+
size = "sm",
|
|
9
|
+
value
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
className: cn(
|
|
15
|
+
"inline-flex border border-midground/15 bg-background/30",
|
|
16
|
+
className
|
|
17
|
+
),
|
|
18
|
+
role: "radiogroup",
|
|
19
|
+
children: options.map((opt) => {
|
|
20
|
+
const active = opt.value === value;
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
"button",
|
|
23
|
+
{
|
|
24
|
+
"aria-checked": active,
|
|
25
|
+
className: cn(
|
|
26
|
+
"font-mondwest tracking-[0.1em] uppercase",
|
|
27
|
+
"transition-colors cursor-pointer whitespace-nowrap",
|
|
28
|
+
"border-r border-midground/15 last:border-r-0",
|
|
29
|
+
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-midground/30",
|
|
30
|
+
size === "sm" && "h-7 px-2.5 text-[0.65rem]",
|
|
31
|
+
size === "md" && "h-8 px-3 text-xs",
|
|
32
|
+
active ? "bg-midground text-background" : "text-midground/60 hover:bg-midground/10 hover:text-midground"
|
|
33
|
+
),
|
|
34
|
+
onClick: () => onChange(opt.value),
|
|
35
|
+
role: "radio",
|
|
36
|
+
type: "button",
|
|
37
|
+
children: opt.label
|
|
38
|
+
},
|
|
39
|
+
opt.value
|
|
40
|
+
);
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
);
|
|
11
44
|
}
|
|
12
45
|
export function FilterGroup({ children, className, label }) {
|
|
13
|
-
|
|
46
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2", className), children: [
|
|
47
|
+
/* @__PURE__ */ jsx("span", { className: "font-mondwest text-[0.65rem] tracking-[0.12em] uppercase text-midground/50", children: label }),
|
|
48
|
+
children
|
|
49
|
+
] });
|
|
14
50
|
}
|
|
15
|
-
//# sourceMappingURL=segmented.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
-
export declare function Select({ children, className, disabled, id, onValueChange, placeholder, style, value }: SelectProps): import("react
|
|
2
|
+
export declare function Select({ children, className, disabled, id, onValueChange, placeholder, style, value }: SelectProps): import("react").JSX.Element;
|
|
3
3
|
export declare function SelectOption(_props: SelectOptionProps): null;
|
|
4
4
|
interface SelectOptionProps {
|
|
5
5
|
children: ReactNode;
|
|
@@ -16,4 +16,3 @@ interface SelectProps {
|
|
|
16
16
|
value?: string;
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
19
|
-
//# sourceMappingURL=select.d.ts.map
|