@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,76 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { useStore } from
|
|
4
|
-
import { createElement, useMemo } from
|
|
5
|
-
import { getControlAtom } from
|
|
6
|
-
import { cn, polyRef } from
|
|
7
|
-
import { colorDodge, colorMix } from
|
|
8
|
-
const LAYER_KEYS = { bg:
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useStore } from "@nanostores/react";
|
|
4
|
+
import { createElement, useMemo } from "react";
|
|
5
|
+
import { getControlAtom } from "../../hooks/use-smooth-controls.js";
|
|
6
|
+
import { cn, polyRef } from "../../utils/index.js";
|
|
7
|
+
import { colorDodge, colorMix } from "../../utils/color.js";
|
|
8
|
+
const LAYER_KEYS = { bg: "bgColor", fg: "fgColor", mg: "mgColor" };
|
|
9
9
|
const parseSpec = (spec) => {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const [layer, alpha] = spec.split("/");
|
|
11
|
+
return [layer, alpha ? parseFloat(alpha) : void 0];
|
|
12
12
|
};
|
|
13
13
|
const useControlColor = (key, fallback) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return (atom ? useStore(atom) : undefined) ?? fallback;
|
|
14
|
+
const atom = getControlAtom("Lens", key);
|
|
15
|
+
return (atom ? useStore(atom) : void 0) ?? fallback;
|
|
17
16
|
};
|
|
18
17
|
const useBlend = (against, spec) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
: spec;
|
|
35
|
-
return useMemo(() => {
|
|
36
|
-
if (!spec || !targetColor) {
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
const result = colorDodge(againstColor, targetColor);
|
|
40
|
-
return alpha != null ? colorMix(result, alpha) : result;
|
|
41
|
-
}, [spec, againstColor, targetColor, alpha]);
|
|
18
|
+
const layerKey = spec?.split("/")[0];
|
|
19
|
+
const isLayerSpec = layerKey && layerKey in LAYER_KEYS;
|
|
20
|
+
const [target, alpha] = isLayerSpec ? parseSpec(spec) : [void 0, void 0];
|
|
21
|
+
const againstColor = useControlColor(LAYER_KEYS[against], "#041c1c");
|
|
22
|
+
const fgColor = useControlColor(LAYER_KEYS.fg, "#ffe6cb");
|
|
23
|
+
const mgColor = useControlColor(LAYER_KEYS.mg, "#ffe6cb");
|
|
24
|
+
const bgColor = useControlColor(LAYER_KEYS.bg, "#ffe6cb");
|
|
25
|
+
const targetColor = target ? target === "fg" ? fgColor : target === "mg" ? mgColor : bgColor : spec;
|
|
26
|
+
return useMemo(() => {
|
|
27
|
+
if (!spec || !targetColor) {
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
const result = colorDodge(againstColor, targetColor);
|
|
31
|
+
return alpha != null ? colorMix(result, alpha) : result;
|
|
32
|
+
}, [spec, againstColor, targetColor, alpha]);
|
|
42
33
|
};
|
|
43
34
|
export const useBlendMode = (opts = {}) => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
35
|
+
const { against = "bg", background, color } = opts;
|
|
36
|
+
return {
|
|
37
|
+
backgroundColor: useBlend(against, background),
|
|
38
|
+
color: useBlend(against, color)
|
|
39
|
+
};
|
|
49
40
|
};
|
|
50
41
|
export const withBlendMode = (Component, opts) => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
42
|
+
const Wrapped = (props) => {
|
|
43
|
+
const { against, background, color, ...rest } = props;
|
|
44
|
+
const colors = useBlendMode({
|
|
45
|
+
against: against ?? opts?.against,
|
|
46
|
+
background: background ?? opts?.background,
|
|
47
|
+
color: color ?? opts?.color
|
|
48
|
+
});
|
|
49
|
+
return /* @__PURE__ */ jsx(Component, { ...rest, ...colors });
|
|
50
|
+
};
|
|
51
|
+
Wrapped.displayName = `withBlendMode(${Component.displayName ?? Component.name ?? "Component"})`;
|
|
52
|
+
return Wrapped;
|
|
62
53
|
};
|
|
63
|
-
export const BlendMode = polyRef(
|
|
54
|
+
export const BlendMode = polyRef(
|
|
55
|
+
({ against, as, background, children, className, color, style, ...rest }, ref) => {
|
|
64
56
|
const colors = useBlendMode({ against, background, color });
|
|
65
|
-
if (typeof children ===
|
|
66
|
-
|
|
57
|
+
if (typeof children === "function") {
|
|
58
|
+
return /* @__PURE__ */ jsx(Fragment, { children: children(colors) });
|
|
67
59
|
}
|
|
68
|
-
return createElement(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
60
|
+
return createElement(as ?? "div", {
|
|
61
|
+
...rest,
|
|
62
|
+
children,
|
|
63
|
+
className: cn(className),
|
|
64
|
+
ref,
|
|
65
|
+
style: { ...colors, ...style }
|
|
74
66
|
});
|
|
75
|
-
}
|
|
76
|
-
|
|
67
|
+
}
|
|
68
|
+
);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export declare function Blink({ className, cursor }: BlinkProps): import("react
|
|
1
|
+
export declare function Blink({ className, cursor }: BlinkProps): import("react").JSX.Element;
|
|
2
2
|
interface BlinkProps {
|
|
3
3
|
className?: string;
|
|
4
4
|
cursor?: 'block' | 'line';
|
|
5
5
|
}
|
|
6
6
|
export {};
|
|
7
|
-
//# sourceMappingURL=blink.d.ts.map
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx
|
|
3
|
-
import { cn } from
|
|
4
|
-
export function Blink({ className, cursor =
|
|
5
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../utils/index.js";
|
|
4
|
+
export function Blink({ className, cursor = "block" }) {
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
|
+
"span",
|
|
7
|
+
{
|
|
8
|
+
className: cn(
|
|
9
|
+
"blink hidden group-hover:inline-block",
|
|
10
|
+
"dither ml-1 w-[1.2ch]",
|
|
11
|
+
cursor === "block" ? "-mb-[0.15em] h-[1.1em]" : "-mb-[0.1em] h-[2px]",
|
|
12
|
+
className
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
);
|
|
6
16
|
}
|
|
7
|
-
//# sourceMappingURL=blink.js.map
|
|
@@ -4,12 +4,11 @@ declare const buttonVariants: (props?: ({
|
|
|
4
4
|
ghost?: boolean | null | undefined;
|
|
5
5
|
invert?: boolean | null | undefined;
|
|
6
6
|
outlined?: boolean | null | undefined;
|
|
7
|
-
size?: "
|
|
7
|
+
size?: "sm" | "default" | "icon" | "xs" | null | undefined;
|
|
8
8
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
-
export declare const Button: ({ children, className, destructive, ghost, invert, outlined, prefix, size, suffix, ...props }: ButtonProps) => import("react
|
|
9
|
+
export declare const Button: ({ children, className, destructive, ghost, invert, outlined, prefix, size, suffix, ...props }: ButtonProps) => import("react").JSX.Element;
|
|
10
10
|
interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'prefix' | 'suffix'>, VariantProps<typeof buttonVariants> {
|
|
11
11
|
prefix?: React.ReactNode;
|
|
12
12
|
suffix?: React.ReactNode;
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
15
|
-
//# sourceMappingURL=button.d.ts.map
|
|
@@ -1,97 +1,146 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { cva } from
|
|
3
|
-
import { cloneElement } from
|
|
4
|
-
import { cn } from
|
|
5
|
-
import { Typography } from
|
|
6
|
-
const SHADOW_DEFAULT =
|
|
7
|
-
const SHADOW_INVERT =
|
|
8
|
-
const SHADOW_INVERT_OUTLINED =
|
|
9
|
-
const ACTIVE_FILTER =
|
|
10
|
-
const buttonVariants = cva(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cloneElement } from "react";
|
|
4
|
+
import { cn } from "../../utils/index.js";
|
|
5
|
+
import { Typography } from "./typography/index.js";
|
|
6
|
+
const SHADOW_DEFAULT = "shadow-[inset_-1px_-1px_0_0_#00000080,inset_1px_1px_0_0_#ffffff80]";
|
|
7
|
+
const SHADOW_INVERT = "shadow-[inset_-1px_-1px_0_0_#00000080,inset_1px_1px_0_0_#ffffff29]";
|
|
8
|
+
const SHADOW_INVERT_OUTLINED = "shadow-[inset_-1px_-1px_0_0_#ffffff12,inset_1px_1px_0_0_#ffffff29]";
|
|
9
|
+
const ACTIVE_FILTER = "active:[filter:invert(1)_brightness(calc(100-99*var(--foreground-alpha,0)))]";
|
|
10
|
+
const buttonVariants = cva(
|
|
11
|
+
[
|
|
12
|
+
"group relative grid cursor-pointer grid-cols-[auto_1fr_auto] items-center",
|
|
13
|
+
"leading-0 font-bold tracking-[0.2em] uppercase",
|
|
14
|
+
"disabled:pointer-events-none disabled:bg-midground/15 disabled:text-midground disabled:shadow-none"
|
|
15
|
+
],
|
|
16
|
+
{
|
|
15
17
|
compoundVariants: [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
destructive: false,
|
|
20
|
-
ghost: false,
|
|
21
|
-
invert: false,
|
|
22
|
-
outlined: false
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
class: `bg-midground/15 text-midground ${SHADOW_INVERT} ${ACTIVE_FILTER}`,
|
|
26
|
-
destructive: false,
|
|
27
|
-
ghost: false,
|
|
28
|
-
invert: true,
|
|
29
|
-
outlined: false
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
class: `shadow-midground ${SHADOW_DEFAULT} ${ACTIVE_FILTER}`,
|
|
33
|
-
destructive: false,
|
|
34
|
-
ghost: false,
|
|
35
|
-
invert: false,
|
|
36
|
-
outlined: true
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
class: `${SHADOW_INVERT_OUTLINED} ${ACTIVE_FILTER}`,
|
|
40
|
-
destructive: false,
|
|
41
|
-
ghost: false,
|
|
42
|
-
invert: true,
|
|
43
|
-
outlined: true
|
|
44
|
-
},
|
|
45
|
-
// ── ghost: no chrome, hover bg only ──
|
|
46
|
-
{
|
|
47
|
-
class: 'bg-transparent text-current hover:bg-midground/10 shadow-none',
|
|
48
|
-
destructive: false,
|
|
49
|
-
ghost: true
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
class: 'bg-transparent text-destructive hover:bg-destructive/10 shadow-none',
|
|
53
|
-
destructive: true,
|
|
54
|
-
ghost: true
|
|
55
|
-
},
|
|
56
|
-
// ── solid destructive ──
|
|
57
|
-
{
|
|
58
|
-
class: `bg-destructive text-destructive-foreground hover:bg-destructive/90 ${SHADOW_INVERT}`,
|
|
59
|
-
destructive: true,
|
|
60
|
-
ghost: false,
|
|
61
|
-
outlined: false
|
|
62
|
-
},
|
|
63
|
-
// ── outlined destructive ──
|
|
64
|
-
{
|
|
65
|
-
class: 'border border-destructive/40 bg-transparent text-destructive hover:bg-destructive/10 shadow-none',
|
|
66
|
-
destructive: true,
|
|
67
|
-
ghost: false,
|
|
68
|
-
outlined: true
|
|
69
|
-
}
|
|
70
|
-
],
|
|
71
|
-
defaultVariants: {
|
|
18
|
+
// ── invert × outlined matrix (default surface, no ghost/destructive) ──
|
|
19
|
+
{
|
|
20
|
+
class: `bg-midground text-background-base active:invert ${SHADOW_DEFAULT}`,
|
|
72
21
|
destructive: false,
|
|
73
22
|
ghost: false,
|
|
74
23
|
invert: false,
|
|
75
|
-
outlined: false
|
|
76
|
-
|
|
24
|
+
outlined: false
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
class: `bg-midground/15 text-midground ${SHADOW_INVERT} ${ACTIVE_FILTER}`,
|
|
28
|
+
destructive: false,
|
|
29
|
+
ghost: false,
|
|
30
|
+
invert: true,
|
|
31
|
+
outlined: false
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
class: `shadow-midground ${SHADOW_DEFAULT} ${ACTIVE_FILTER}`,
|
|
35
|
+
destructive: false,
|
|
36
|
+
ghost: false,
|
|
37
|
+
invert: false,
|
|
38
|
+
outlined: true
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
class: `${SHADOW_INVERT_OUTLINED} ${ACTIVE_FILTER}`,
|
|
42
|
+
destructive: false,
|
|
43
|
+
ghost: false,
|
|
44
|
+
invert: true,
|
|
45
|
+
outlined: true
|
|
46
|
+
},
|
|
47
|
+
// ── ghost: no chrome, hover bg only ──
|
|
48
|
+
{
|
|
49
|
+
class: "bg-transparent text-current hover:bg-midground/10 shadow-none",
|
|
50
|
+
destructive: false,
|
|
51
|
+
ghost: true
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
class: "bg-transparent text-destructive hover:bg-destructive/10 shadow-none",
|
|
55
|
+
destructive: true,
|
|
56
|
+
ghost: true
|
|
57
|
+
},
|
|
58
|
+
// ── solid destructive ──
|
|
59
|
+
{
|
|
60
|
+
class: `bg-destructive text-destructive-foreground hover:bg-destructive/90 ${SHADOW_INVERT}`,
|
|
61
|
+
destructive: true,
|
|
62
|
+
ghost: false,
|
|
63
|
+
outlined: false
|
|
64
|
+
},
|
|
65
|
+
// ── outlined destructive ──
|
|
66
|
+
{
|
|
67
|
+
class: "border border-destructive/40 bg-transparent text-destructive hover:bg-destructive/10 shadow-none",
|
|
68
|
+
destructive: true,
|
|
69
|
+
ghost: false,
|
|
70
|
+
outlined: true
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
defaultVariants: {
|
|
74
|
+
destructive: false,
|
|
75
|
+
ghost: false,
|
|
76
|
+
invert: false,
|
|
77
|
+
outlined: false,
|
|
78
|
+
size: "default"
|
|
77
79
|
},
|
|
78
80
|
variants: {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
destructive: { true: "" },
|
|
82
|
+
ghost: { true: "" },
|
|
83
|
+
invert: { true: "" },
|
|
84
|
+
outlined: { true: "text-midground bg-transparent" },
|
|
85
|
+
size: {
|
|
86
|
+
default: "px-[.9em_.75em] py-[1.25em]",
|
|
87
|
+
icon: "p-2 aspect-square grid-cols-1 place-items-center [&>svg]:size-3.5",
|
|
88
|
+
sm: "px-3 py-1.5 text-[0.7rem] tracking-[0.15em] [&>svg]:size-3",
|
|
89
|
+
xs: "p-1 aspect-square grid-cols-1 place-items-center [&>svg]:size-3"
|
|
90
|
+
}
|
|
89
91
|
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
const IconSlot = ({
|
|
95
|
+
icon,
|
|
96
|
+
side
|
|
97
|
+
}) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
98
|
+
/* @__PURE__ */ jsx("span", { className: "w-5" }),
|
|
99
|
+
/* @__PURE__ */ jsx(
|
|
100
|
+
"span",
|
|
101
|
+
{
|
|
102
|
+
className: cn(
|
|
103
|
+
"absolute top-1/2 -translate-y-1/2",
|
|
104
|
+
side === "left" ? "left-3" : "right-3"
|
|
105
|
+
),
|
|
106
|
+
children: typeof icon === "object" ? cloneElement(icon, {
|
|
107
|
+
className: "size-3.5"
|
|
108
|
+
}) : icon
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
] });
|
|
112
|
+
export const Button = ({
|
|
113
|
+
children,
|
|
114
|
+
className,
|
|
115
|
+
destructive,
|
|
116
|
+
ghost,
|
|
117
|
+
invert,
|
|
118
|
+
outlined,
|
|
119
|
+
prefix,
|
|
120
|
+
size,
|
|
121
|
+
suffix,
|
|
122
|
+
...props
|
|
123
|
+
}) => /* @__PURE__ */ jsxs(
|
|
124
|
+
Typography,
|
|
125
|
+
{
|
|
126
|
+
as: "button",
|
|
127
|
+
className: cn(
|
|
128
|
+
buttonVariants({ destructive, ghost, invert, outlined, size }),
|
|
129
|
+
className
|
|
130
|
+
),
|
|
131
|
+
mono: true,
|
|
132
|
+
...props,
|
|
133
|
+
children: [
|
|
134
|
+
!ghost && /* @__PURE__ */ jsx(
|
|
135
|
+
"span",
|
|
136
|
+
{
|
|
137
|
+
"aria-hidden": true,
|
|
138
|
+
className: "arc-border opacity-0 transition-opacity duration-200 group-hover:opacity-100 group-focus-visible:opacity-100 group-active:opacity-100"
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
prefix && /* @__PURE__ */ jsx(IconSlot, { icon: prefix, side: "left" }),
|
|
142
|
+
children,
|
|
143
|
+
suffix && /* @__PURE__ */ jsx(IconSlot, { icon: suffix, side: "right" })
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
);
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* A "copy to clipboard" button that briefly shows a "Copied!" confirmation.
|
|
3
3
|
* Designed to sit alongside a short command string, not as a general button.
|
|
4
4
|
*/
|
|
5
|
-
export declare function CopyButton({ children, className, copiedLabel, label, resetDelayMs, text }: CopyButtonProps): import("react
|
|
5
|
+
export declare function CopyButton({ children, className, copiedLabel, label, resetDelayMs, text }: CopyButtonProps): import("react").JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* A labeled, copy-able command (or code) display. Pairs `<CopyButton>` with
|
|
8
8
|
* a monospace code block. Used for install/setup instructions.
|
|
9
9
|
*/
|
|
10
|
-
export declare function CommandBlock({ className, code, label }: CommandBlockProps): import("react
|
|
10
|
+
export declare function CommandBlock({ className, code, label }: CommandBlockProps): import("react").JSX.Element;
|
|
11
11
|
interface CommandBlockProps {
|
|
12
12
|
className?: string;
|
|
13
13
|
code: string;
|
|
@@ -22,4 +22,3 @@ interface CopyButtonProps {
|
|
|
22
22
|
text: string;
|
|
23
23
|
}
|
|
24
24
|
export {};
|
|
25
|
-
//# sourceMappingURL=command-block.d.ts.map
|
|
@@ -1,27 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx
|
|
3
|
-
import { useCallback, useState } from
|
|
4
|
-
import { cn } from
|
|
5
|
-
import { Small } from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
|
+
import { cn } from "../../utils/index.js";
|
|
5
|
+
import { Small } from "./typography/small.js";
|
|
6
|
+
export function CopyButton({
|
|
7
|
+
children,
|
|
8
|
+
className,
|
|
9
|
+
copiedLabel = "Copied!",
|
|
10
|
+
label = "Copy",
|
|
11
|
+
resetDelayMs = 2e3,
|
|
12
|
+
text
|
|
13
|
+
}) {
|
|
14
|
+
const [copied, setCopied] = useState(false);
|
|
15
|
+
const handleCopy = useCallback(() => {
|
|
16
|
+
void navigator.clipboard.writeText(text).then(() => {
|
|
17
|
+
setCopied(true);
|
|
18
|
+
setTimeout(() => setCopied(false), resetDelayMs);
|
|
19
|
+
});
|
|
20
|
+
}, [resetDelayMs, text]);
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
"button",
|
|
23
|
+
{
|
|
24
|
+
className: cn(
|
|
25
|
+
"font-courier cursor-pointer border-none bg-transparent text-[0.6875rem]",
|
|
26
|
+
"tracking-widest uppercase",
|
|
27
|
+
"hover:text-midground tap-highlight-transparent transition-colors",
|
|
28
|
+
"flex items-center justify-center",
|
|
29
|
+
copied ? "text-midground" : "text-current opacity-60",
|
|
30
|
+
className
|
|
31
|
+
),
|
|
32
|
+
onClick: handleCopy,
|
|
33
|
+
type: "button",
|
|
34
|
+
children: children ?? (copied ? copiedLabel : label)
|
|
35
|
+
}
|
|
36
|
+
);
|
|
19
37
|
}
|
|
20
|
-
/**
|
|
21
|
-
* A labeled, copy-able command (or code) display. Pairs `<CopyButton>` with
|
|
22
|
-
* a monospace code block. Used for install/setup instructions.
|
|
23
|
-
*/
|
|
24
38
|
export function CommandBlock({ className, code, label }) {
|
|
25
|
-
|
|
39
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1", className), children: [
|
|
40
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
41
|
+
/* @__PURE__ */ jsx(Small, { className: "opacity-50", children: label }),
|
|
42
|
+
/* @__PURE__ */ jsx(CopyButton, { text: code })
|
|
43
|
+
] }),
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
className: cn(
|
|
48
|
+
"bg-background/40 font-courier border border-current/20",
|
|
49
|
+
"px-3 py-2 text-[0.6875rem] leading-relaxed lowercase"
|
|
50
|
+
),
|
|
51
|
+
children: /* @__PURE__ */ jsx("code", { className: "break-all", children: code })
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
] });
|
|
26
55
|
}
|
|
27
|
-
//# sourceMappingURL=command-block.js.map
|