@nous-research/ui 0.13.2 → 0.14.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/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/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/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 +41 -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,88 +1,112 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { useEffect, useRef, useState } from
|
|
4
|
-
const ease = (t) =>
|
|
5
|
-
const easeD = (t) =>
|
|
6
|
-
export function useAnimatedCount(from, rate, ts = new Date(), pausedAt) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (rounded !== last) {
|
|
30
|
-
last = rounded;
|
|
31
|
-
setValue(rounded);
|
|
32
|
-
}
|
|
33
|
-
if (!pausedAt || Math.abs(current.current - target()) > 0.5) {
|
|
34
|
-
raf = requestAnimationFrame(tick);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
const ease = (t) => t < 0.5 ? 4 * t ** 3 : 1 - (-2 * t + 2) ** 3 / 2;
|
|
5
|
+
const easeD = (t) => t < 0.5 ? 12 * t ** 2 : 6 * (-2 * t + 2) ** 2;
|
|
6
|
+
export function useAnimatedCount(from, rate, ts = /* @__PURE__ */ new Date(), pausedAt) {
|
|
7
|
+
const [value, setValue] = useState(from);
|
|
8
|
+
const current = useRef(from);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!rate) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
let raf;
|
|
14
|
+
let prev = Date.now();
|
|
15
|
+
let last = current.current;
|
|
16
|
+
const target = () => from + Math.floor(
|
|
17
|
+
(pausedAt ? Math.max(0, pausedAt.getTime() - ts.getTime()) : Date.now() - ts.getTime()) / 1e3 * rate * 0.9
|
|
18
|
+
);
|
|
19
|
+
const tick = () => {
|
|
20
|
+
const now = Date.now();
|
|
21
|
+
current.current += (target() - current.current) * Math.min(1, (now - prev) / 1e3 * 3);
|
|
22
|
+
prev = now;
|
|
23
|
+
const rounded = Math.round(current.current);
|
|
24
|
+
if (rounded !== last) {
|
|
25
|
+
last = rounded;
|
|
26
|
+
setValue(rounded);
|
|
27
|
+
}
|
|
28
|
+
if (!pausedAt || Math.abs(current.current - target()) > 0.5) {
|
|
37
29
|
raf = requestAnimationFrame(tick);
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
raf = requestAnimationFrame(tick);
|
|
33
|
+
return () => cancelAnimationFrame(raf);
|
|
34
|
+
}, [from, ts, rate, pausedAt]);
|
|
35
|
+
return value;
|
|
41
36
|
}
|
|
42
|
-
export function AnimatedCount({
|
|
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
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
37
|
+
export function AnimatedCount({
|
|
38
|
+
damping = 1,
|
|
39
|
+
duration,
|
|
40
|
+
pausedAt,
|
|
41
|
+
rate = 0,
|
|
42
|
+
value
|
|
43
|
+
}) {
|
|
44
|
+
const id = useRef(Math.random().toString(36).slice(2, 9));
|
|
45
|
+
const prev = useRef(value);
|
|
46
|
+
const [display, setDisplay] = useState(value);
|
|
47
|
+
const [velocity, setVelocity] = useState(rate);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (!duration) {
|
|
50
|
+
prev.current = value;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const start = prev.current;
|
|
54
|
+
const delta = value - start;
|
|
55
|
+
const dur = duration * damping;
|
|
56
|
+
prev.current = value;
|
|
57
|
+
if (!delta) {
|
|
58
|
+
setVelocity(0);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const t0 = performance.now();
|
|
62
|
+
const tick = (now) => {
|
|
63
|
+
const t = Math.min((now - t0) / dur, 1);
|
|
64
|
+
setDisplay(Math.round(start + delta * ease(t)));
|
|
65
|
+
setVelocity(Math.abs(delta * easeD(t) / dur) * 1e3);
|
|
66
|
+
t < 1 ? requestAnimationFrame(tick) : setVelocity(0);
|
|
67
|
+
};
|
|
68
|
+
const raf = requestAnimationFrame(tick);
|
|
69
|
+
return () => cancelAnimationFrame(raf);
|
|
70
|
+
}, [value, duration, rate, damping]);
|
|
71
|
+
const digits = Math.round(duration ? display : value).toLocaleString().split("");
|
|
72
|
+
const v = duration ? velocity : rate;
|
|
73
|
+
const paused = !duration && pausedAt;
|
|
74
|
+
const blurred = new Set(
|
|
75
|
+
digits.map((c, i) => {
|
|
76
|
+
if (!/\d/.test(c) || v <= 0 || paused) {
|
|
77
|
+
return -1;
|
|
78
|
+
}
|
|
79
|
+
const pos = digits.filter((x) => /\d/.test(x)).length - digits.slice(0, i + 1).filter((x) => /\d/.test(x)).length;
|
|
80
|
+
return 10 ** Math.max(0, pos) / v * 1e3 < 500 ? i : -1;
|
|
81
|
+
}).filter((i) => i >= 0)
|
|
82
|
+
);
|
|
83
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
84
|
+
/* @__PURE__ */ jsx("svg", { className: "pointer-events-none absolute size-0", children: /* @__PURE__ */ jsx("defs", { children: digits.map((_, i) => /* @__PURE__ */ jsx(
|
|
85
|
+
"filter",
|
|
86
|
+
{
|
|
87
|
+
id: `blur-${id.current}-${i}`,
|
|
88
|
+
suppressHydrationWarning: true,
|
|
89
|
+
children: /* @__PURE__ */ jsx(
|
|
90
|
+
"feGaussianBlur",
|
|
91
|
+
{
|
|
92
|
+
stdDeviation: `0 ${blurred.has(i) ? 1 + [...blurred].indexOf(i) * 0.6 : 0}`
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
},
|
|
96
|
+
i
|
|
97
|
+
)) }) }),
|
|
98
|
+
/* @__PURE__ */ jsx("span", { className: "inline-flex tabular-nums", children: digits.map((c, i) => /* @__PURE__ */ jsx(
|
|
99
|
+
"span",
|
|
100
|
+
{
|
|
101
|
+
className: "inline-block text-center",
|
|
102
|
+
style: {
|
|
103
|
+
filter: blurred.has(i) ? `url(#blur-${id.current}-${i})` : "none",
|
|
104
|
+
width: c === "," ? "0.4ch" : "1ch"
|
|
105
|
+
},
|
|
106
|
+
suppressHydrationWarning: true,
|
|
107
|
+
children: c
|
|
108
|
+
},
|
|
109
|
+
i
|
|
110
|
+
)) })
|
|
111
|
+
] });
|
|
87
112
|
}
|
|
88
|
-
//# sourceMappingURL=animated-count.js.map
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
export declare function Scramble({ delay, text }: {
|
|
2
2
|
delay?: number;
|
|
3
3
|
text: string;
|
|
4
|
-
}): import("react
|
|
4
|
+
}): import("react").JSX.Element;
|
|
5
5
|
export declare function AsciiSkeleton({ className, cols, rows, speed }: {
|
|
6
6
|
className?: string;
|
|
7
7
|
cols?: number;
|
|
8
8
|
rows?: number;
|
|
9
9
|
speed?: number;
|
|
10
|
-
}): import("react
|
|
11
|
-
//# sourceMappingURL=ascii.d.ts.map
|
|
10
|
+
}): import("react").JSX.Element;
|
|
@@ -1,62 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
import { Fragment
|
|
3
|
-
import { useEffect, useRef, useState } from
|
|
4
|
-
const BLOCK =
|
|
5
|
-
const ALPHA =
|
|
6
|
-
const rand = (chars) => chars[
|
|
7
|
-
export function Scramble({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
const BLOCK = "\u2591\u2592\u2593\u2588\u2584\u2580\u2590\u258C\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u254C\u254E\u28C0\u28E4\u28F6\u28FF";
|
|
5
|
+
const ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*";
|
|
6
|
+
const rand = (chars) => chars[Math.random() * chars.length | 0];
|
|
7
|
+
export function Scramble({
|
|
8
|
+
delay = 0,
|
|
9
|
+
text
|
|
10
|
+
}) {
|
|
11
|
+
const [display, setDisplay] = useState(text);
|
|
12
|
+
const iter = useRef(0);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
iter.current = 0;
|
|
15
|
+
const timeout = setTimeout(() => {
|
|
16
|
+
const interval = setInterval(() => {
|
|
17
|
+
setDisplay(
|
|
18
|
+
text.split("").map(
|
|
19
|
+
(c, i) => c === " " ? " " : i < iter.current ? text[i] : rand(ALPHA)
|
|
20
|
+
).join("")
|
|
21
|
+
);
|
|
22
|
+
iter.current += 1 / 3;
|
|
23
|
+
if (iter.current >= text.length) {
|
|
24
|
+
clearInterval(interval);
|
|
25
|
+
setDisplay(text);
|
|
26
|
+
}
|
|
27
|
+
}, 30);
|
|
28
|
+
return () => clearInterval(interval);
|
|
29
|
+
}, delay);
|
|
30
|
+
return () => clearTimeout(timeout);
|
|
31
|
+
}, [text, delay]);
|
|
32
|
+
return /* @__PURE__ */ jsx(Fragment, { children: display });
|
|
29
33
|
}
|
|
30
|
-
export function AsciiSkeleton({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
export function AsciiSkeleton({
|
|
35
|
+
className = "",
|
|
36
|
+
cols = 12,
|
|
37
|
+
rows = 1,
|
|
38
|
+
speed = 80
|
|
39
|
+
}) {
|
|
40
|
+
const ref = useRef(null);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
const el = ref.current;
|
|
43
|
+
if (!el) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const total = cols * rows;
|
|
47
|
+
let frame = 0;
|
|
48
|
+
const tick = () => {
|
|
49
|
+
let text = "";
|
|
50
|
+
for (let i = 0; i < total; i++) {
|
|
51
|
+
const x = i % cols;
|
|
52
|
+
const shimmer = (x - frame * 0.5 + cols * 2) % (cols * 2);
|
|
53
|
+
text += shimmer < 6 ? " " : rand(BLOCK);
|
|
54
|
+
if (rows > 1 && x === cols - 1) {
|
|
55
|
+
text += "\n";
|
|
36
56
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
fontSize: 'inherit',
|
|
59
|
-
letterSpacing: '0.05em'
|
|
60
|
-
} }));
|
|
57
|
+
}
|
|
58
|
+
el.textContent = text;
|
|
59
|
+
frame++;
|
|
60
|
+
};
|
|
61
|
+
tick();
|
|
62
|
+
const id = setInterval(tick, speed);
|
|
63
|
+
return () => clearInterval(id);
|
|
64
|
+
}, [cols, rows, speed]);
|
|
65
|
+
return /* @__PURE__ */ jsx(
|
|
66
|
+
"span",
|
|
67
|
+
{
|
|
68
|
+
"aria-hidden": true,
|
|
69
|
+
className: `inline-block leading-tight opacity-20 select-none ${className}`,
|
|
70
|
+
ref,
|
|
71
|
+
style: {
|
|
72
|
+
fontFamily: "monospace",
|
|
73
|
+
fontSize: "inherit",
|
|
74
|
+
letterSpacing: "0.05em"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
);
|
|
61
78
|
}
|
|
62
|
-
//# sourceMappingURL=ascii.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export declare const Badge: ({ className, style, tone, ...props }: BadgeProps) => import("react
|
|
1
|
+
export declare const Badge: ({ className, style, tone, ...props }: BadgeProps) => import("react").JSX.Element;
|
|
2
2
|
type Tone = 'default' | 'destructive' | 'outline' | 'secondary' | 'success' | 'warning';
|
|
3
3
|
interface BadgeProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'color'> {
|
|
4
4
|
tone?: Tone;
|
|
5
5
|
}
|
|
6
6
|
export {};
|
|
7
|
-
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -1,22 +1,39 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { cn } from
|
|
3
|
-
import { BlendMode } from
|
|
4
|
-
const BASE_CN =
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../utils/index.js";
|
|
3
|
+
import { BlendMode } from "./blend-mode.js";
|
|
4
|
+
const BASE_CN = "inline-flex items-center font-compressed px-2 py-1 leading-none tracking-[0.2em] uppercase";
|
|
5
5
|
const TONE_CLASSES = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
destructive: "border border-destructive/30 bg-destructive/15 text-destructive",
|
|
7
|
+
outline: "border border-midground/30 bg-transparent text-midground/80",
|
|
8
|
+
secondary: "border border-midground/15 bg-midground/8 text-midground",
|
|
9
|
+
success: "border border-success/30 bg-success/15 text-success",
|
|
10
|
+
warning: "border border-warning/30 bg-warning/15 text-warning"
|
|
11
11
|
};
|
|
12
|
-
export const Badge = ({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
export const Badge = ({
|
|
13
|
+
className,
|
|
14
|
+
style,
|
|
15
|
+
tone = "default",
|
|
16
|
+
...props
|
|
17
|
+
}) => {
|
|
18
|
+
if (tone === "default") {
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
BlendMode,
|
|
21
|
+
{
|
|
22
|
+
as: "span",
|
|
23
|
+
background: "mg/0.075",
|
|
24
|
+
className: cn(BASE_CN, className),
|
|
25
|
+
color: "mg",
|
|
26
|
+
style: { opacity: "var(--midground-alpha)", ...style },
|
|
27
|
+
...props
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
"span",
|
|
33
|
+
{
|
|
34
|
+
className: cn(BASE_CN, TONE_CLASSES[tone], className),
|
|
35
|
+
style,
|
|
36
|
+
...props
|
|
17
37
|
}
|
|
18
|
-
|
|
19
|
-
// red stays red and green stays green regardless of the active Lens.
|
|
20
|
-
return (_jsx("span", { className: cn(BASE_CN, TONE_CLASSES[tone], className), style: style, ...props }));
|
|
38
|
+
);
|
|
21
39
|
};
|
|
22
|
-
//# sourceMappingURL=badge.js.map
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { type SVGProps } from 'react';
|
|
2
|
-
export declare function NousGirlBadge(props: SVGProps<SVGSVGElement>): import("react
|
|
3
|
-
//# sourceMappingURL=nous-girl.d.ts.map
|
|
2
|
+
export declare function NousGirlBadge(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|